diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5394de3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*.{py,pyi,rst,md,yml,yaml,toml,json,txt}] +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space + +[*.{py,pyi,toml,json}] +indent_size = 4 + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.flake8 b/.flake8 index 4d5b841..67fa993 100644 --- a/.flake8 +++ b/.flake8 @@ -1,26 +1,43 @@ -# Some PEP8 deviations are considered irrelevant to stub files: -# E301 expected 1 blank line -# E302 expected 2 blank lines -# E305 expected 2 blank lines -# E701 multiple statements on one line (colon) -# E741 ambiguous variable name -# F401 imported but unused -# F403 import *' used; unable to detect undefined names -# F405 defined from star imports -# F822 undefined name in __all__ +# The following rules are incompatible with or enforced by black: +# E203 whitespace before ':' -- scripts only +# E301 expected 1 blank line +# E302 expected 2 blank lines +# E305 expected 2 blank lines +# E501 line too long -# Nice-to-haves ignored for now -# E501 line too long +# Some rules are considered irrelevant to stub files: +# B All flake8-bugbear rules are .py-specific +# E701 multiple statements on one line (colon) -- disallows "..." on the same line +# F401 imported but unused -- does not recognize re-exports +# https://github.com/PyCQA/pyflakes/issues/474 +# F822 undefined name in __all__ -- flake8 does not recognize 'foo: Any' +# https://github.com/PyCQA/pyflakes/issues/533 + +# Rules that are out of the control of stub authors: +# E741 ambiguous variable name +# F403 import *' used; unable to detect undefined names +# F405 defined from star imports + +# Rules that we'd like to enable in the future: +# Y037 Use PEP 604 syntax instead of `typing.Union` and `typing.Optional`. +# Currently can't be enabled due to a few lingering bugs in mypy regarding +# PEP 604 type aliases (see #4819). +# NQA102 "noqa" code has no matching violations. We often introduce "noqa" comments +# into the typeshed codebase to unblock flake8-pyi PRs, meaning these comments +# have "no matching violations" since the relevant flake8-pyi checks haven't +# yet been released. [flake8] per-file-ignores = - *.py: E203, W503 - *.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822 + *.py: E203, E301, E302, E305, E501 + *.pyi: B, E301, E302, E305, E501, E701, E741, NQA102, F401, F403, F405, F822, Y037 # Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload. # Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself. - typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822 + # https://github.com/PyCQA/flake8/issues/1079 + # F811 redefinition of unused '...' + stdlib/typing.pyi: B, E301, E302, E305, E501, E701, E741, NQA102, F401, F403, F405, F811, F822, Y037 + # Generated protobuf files include docstrings + *_pb2.pyi: B, E301, E302, E305, E501, E701, NQA102, Y021, Y026 -# We are checking with Python 3 but many of the stubs are Python 2 stubs. -builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange -exclude = .venv*,.git,*_pb2.pyi -max-line-length = 130 +exclude = .venv*,.git +noqa_require_code = true diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 224e7f0..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pc/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..caf463c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +repos: + - repo: https://github.com/hadialqattan/pycln + rev: v2.1.1 # must match requirements-tests.txt + hooks: + - id: pycln + args: [--all, stubs, stdlib, tests, scripts] + - repo: https://github.com/psf/black + rev: 22.10.0 # must match requirements-tests.txt + hooks: + - id: black + language_version: python3.9 + - repo: https://github.com/pycqa/isort + rev: 5.10.1 # must match requirements-tests.txt + hooks: + - id: isort + name: isort (python) + - repo: https://github.com/pycqa/flake8 + rev: 5.0.4 # must match requirements-tests.txt + hooks: + - id: flake8 + additional_dependencies: + - 'flake8-bugbear==22.10.27' # must match requirements-tests.txt + - 'flake8-noqa==1.2.9' # must match requirements-tests.txt + - 'flake8-pyi==22.10.0' # must match requirements-tests.txt + +ci: + autofix_commit_msg: '[pre-commit.ci] auto fixes from pre-commit.com hooks' + autofix_prs: true + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [flake8] + submodules: false diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 11d22e4..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,5 +0,0 @@ -Everyone participating in the typeshed community, and in particular in -our issue tracker, pull requests, and Gitter channel, is expected to treat -other people with respect and more generally to follow the guidelines -articulated in the [Python Community Code of -Conduct](https://www.python.org/psf/codeofconduct/). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c1025c3..dee7be8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,8 +15,8 @@ are important to the project's success. but [contact us](README.md#discussion) before starting significant work. * Create your stubs, considering [what to include](#what-to-include) and conforming to the [coding style](#stub-file-coding-style). -4. [Format and check your stubs](#formatting-stubs). -5. Optionally [run the tests](#running-the-tests). +4. Optionally [format and check your stubs](#code-formatting). +5. Optionally [run the tests](tests/README.md). 6. [Submit your changes](#submitting-changes) by opening a pull request. You can expect a reply within a few days, but please be patient when @@ -24,34 +24,103 @@ it takes a bit longer. For more details, read below. ## Preparing the environment -To reformat the code, check for common problems, and -run the tests, you need to prepare a -[virtual environment](https://docs.python.org/3/tutorial/venv.html) -with the necessary libraries installed. To do this, run: +### Code away! + +Typeshed runs continuous integration (CI) on all pull requests. This means that +if you file a pull request (PR), our full test suite -- including our linter, +`flake8` -- is run on your PR. It also means that bots will automatically apply +changes to your PR (using `pycln`, `black` and `isort`) to fix any formatting issues. +This frees you up to ignore all local setup on your side, focus on the +code and rely on the CI to fix everything, or point you to the places that +need fixing. + +### ... Or create a local development environment + +If you prefer to run the tests & formatting locally, it's +possible too. Follow platform-specific instructions below. +For more information about our available tests, see +[tests/README.md](tests/README.md). + +Whichever platform you're using, you will need a +virtual environment. If you're not familiar with what it is and how it works, +please refer to this +[documentation](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/). + +### Linux/Mac OS + +On Linux and Mac OS, you will be able to run the full test suite on Python 3.8, +3.9 or 3.10. +To install the necessary requirements, run the following commands from a +terminal window: ``` -$ python3 -m venv .venv3 -$ source .venv3/bin/activate -(.venv3)$ pip install -U pip -(.venv3)$ pip install -r requirements-tests-py3.txt +$ python3 -m venv .venv +$ source .venv/bin/activate +(.venv)$ pip install -U pip +(.venv)$ pip install -r requirements-tests.txt ``` -To automatically check your code before committing, copy the file -`pre-commit` to `.git/hooks/pre-commit`. +### Windows + +If you are using a Windows operating system, you will not be able to run the pytype +tests, as pytype +[does not currently support running on Windows](https://github.com/google/pytype#requirements). +One option is to install +[Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/faq), +which will allow you to run the full suite of tests. If you choose to install +WSL, follow the Linux/Mac OS instructions above. + +If you do not wish to install WSL, run the following commands from a Windows +terminal to install all non-pytype requirements: + +``` +> python -m venv .venv +> ".venv/scripts/activate" +(.venv) > pip install -U pip +(.venv) > pip install -r requirements-tests.txt +``` + +## Code formatting + +The code is formatted using `black` and `isort`. Unused imports are also +auto-removed using `pycln`. + +The repository is equipped with a [`pre-commit.ci`](https://pre-commit.ci/) +configuration file. This means that you don't *need* to do anything yourself to +run the code formatters. When you push a commit, a bot will run those for you +right away and add a commit to your PR. + +That being said, if you *want* to run the checks locally when you commit, +you're free to do so. Either run `pycln`, `black` and `isort` manually... + +``` +pycln --all . +isort . +black . +``` + +...Or install the pre-commit hooks: please refer to the +[pre-commit](https://pre-commit.com/) documentation. + +Our code is also linted using `flake8`, with plugins `flake8-pyi`, +`flake8-bugbear`, and `flake8-noqa`. As with our other checks, running +flake8 before filing a PR is not required. However, if you wish to run flake8 +locally, install the test dependencies as outlined above, and then run: + +``` +flake8 . +``` ## Where to make changes ### Standard library stubs The `stdlib` directory contains stubs for modules in the -Python 3 standard library — which +Python standard library — which includes pure Python modules, dynamically loaded extension modules, hard-linked extension modules, and the builtins. The `VERSIONS` file lists the versions of Python where the module is available. -Stubs for Python 2 are available in the `stdlib/@python2` subdirectory. -Modules that are only available for Python 2 are not listed in `VERSIONS`. - ### Third-party library stubs We accept stubs for third-party packages into typeshed as long as: @@ -59,23 +128,16 @@ We accept stubs for third-party packages into typeshed as long as: * the package supports any Python version supported by typeshed; and * the package does not ship with its own stubs or type annotations. +The fastest way to generate new stubs is to use `scripts/create_baseline_stubs.py` (see below). + Stubs for third-party packages go into `stubs`. Each subdirectory there represents a PyPI distribution, and contains the following: * `METADATA.toml`, describing the package. See below for details. * Stubs (i.e. `*.pyi` files) for packages and modules that are shipped in the source distribution. -* If the stubs are either Python 2-only, or if the Python 2 and Python 3 stubs - are separate, the Python 2 stubs are put in a `@python2` subdirectory. - Stubs outside `@python2` are always used with Python 3, - and also with Python 2 if `python2 = true` is set in `METADATA.toml` (see below). * (Rarely) some docs specific to a given type stub package in `README` file. -The fastest way to generate new stubs is to use [stubgen](https://mypy.readthedocs.io/en/stable/stubgen.html), -a tool shipped with mypy. Please make sure to use the latest version. -The generated stubs usually need some trimming of imports. You also need -to run `black` and `isort` manually on the generated stubs (see below). - When a third party stub is added or modified, an updated version of the corresponding distribution will be automatically uploaded to PyPI within a few hours. @@ -95,17 +157,18 @@ The metadata file describes the stubs package using the [TOML file format](https://toml.io/en/). Currently, the following keys are supported: -* `version`: The latest version of the library that the stubs support. - For libraries that reflect API changes in the version number only - the parts indicating the API level should be specified. In the case - of [Semantic Versioning](https://semver.org/) that is the first two - components. When the stubs are updated to a newer version +* `version`: The versions of the library that the stubs support. Two + formats are supported: + - A concrete version. This is especially suited for libraries that + use [Calendar Versioning](https://calver.org/). + - A version range ending in `.*`. This is suited for libraries that + reflect API changes in the version number only, where the API-independent + part is represented by the asterisk. In the case + of [Semantic Versioning](https://semver.org/), this version could look + like this: `2.7.*`. + When the stubs are updated to a newer version of the library, the version of the stub should be bumped (note that - previous versions are still available on PyPI). Some legacy stubs are - marked with version `0.1`, indicating that their supported version is - unknown and needs to be updated. -* `python2` (default: `false`): If set to `true`, the top-level stubs - support both Python 2 and Python 3. + previous versions are still available on PyPI). * `requires` (optional): A list of other stub packages or packages with type information that are imported by the stubs in this package. Only packages generated by typeshed or required by the upstream package are allowed to @@ -117,6 +180,18 @@ supported: [removing obsolete third-party libraries](#third-party-library-removal-policy). It contains the first version of the corresponding library that ships its own `py.typed` file. +* `no_longer_updated` (optional): This field is set to `true` before removing + stubs for other reasons than the upstream library shipping with type + information. + +In addition, we specify configuration for stubtest in the `tool.stubtest` table. +This has the following keys: +* `skip` (default: `false`): Whether stubtest should be run against this + package. Please avoid setting this to `true`, and add a comment if you have + to. +* `apt_dependencies` (default: `[]`): A list of Ubuntu APT packages + that need to be installed for stubtest to run successfully. These are + usually packages needed to pip install the implementation distribution. The format of all `METADATA.toml` files can be checked by running `python3 ./tests/check_consistent.py`. @@ -145,6 +220,27 @@ See [PEP 484](http://www.python.org/dev/peps/pep-0484/) for the exact syntax of the stub files and [below](#stub-file-coding-style) for the coding style used in typeshed. +### Auto-generating stub files + +Typeshed includes `scripts/create_baseline_stubs.py`. +It generates stubs automatically using a tool called +[stubgen](https://mypy.readthedocs.io/en/latest/stubgen.html) that comes with mypy. + +To get started, fork typeshed, clone your fork, and then +[create a virtualenv](#-or-create-a-local-development-environment). +You can then install the library with `pip` into the virtualenv and run the script, +replacing `libraryname` with the name of the library below: + +``` +(.venv3)$ pip install libraryname +(.venv3)$ python3 scripts/create_baseline_stubs.py libraryname +``` + +When the script has finished running, it will print instructions telling you what to do next. + +If it has been a while since you set up the virtualenv, make sure you have +the latest mypy (`pip install -r requirements-tests.txt`) before running the script. + ### Supported type system features Since PEP 484 was accepted, there have been many other PEPs that added @@ -156,8 +252,6 @@ Accepted features that *cannot* yet be used in typeshed include: - [PEP 570](https://www.python.org/dev/peps/pep-0570/) (positional-only arguments): see [#4972](https://github.com/python/typeshed/issues/4972), use argument names prefixed with `__` instead -- [PEP 613](https://www.python.org/dev/peps/pep-0613/) (TypeAlias): - see [#4913](https://github.com/python/typeshed/issues/4913) The following features are partially supported: - [PEP 585](https://www.python.org/dev/peps/pep-0585/) (builtin @@ -184,10 +278,22 @@ instead in typeshed stubs. This currently affects: - `Literal` (new in Python 3.8) - `SupportsIndex` (new in Python 3.8) - `TypedDict` (new in Python 3.8) +- `Concatenate` (new in Python 3.10) +- `ParamSpec` (new in Python 3.10) - `TypeGuard` (new in Python 3.10) -An exception is `Protocol`: although it was added in Python 3.8, it -can be used in stubs regardless of Python version. +Two exceptions are `Protocol` and `runtime_checkable`: although +these were added in Python 3.8, they can be used in stubs regardless +of Python version. + +[PEP 688](https://www.python.org/dev/peps/pep-0688/), which is +currently a draft, removes the implicit promotion of the +`bytearray` and `memoryview` classes to `bytes`. +Typeshed stubs should be written assuming that this proposal +is accepted, so a parameter that accepts either `bytes` or +`bytearray` should be typed as `bytes | bytearray`. +Often one of the aliases from `_typeshed`, such as +`_typeshed.ReadableBuffer`, can be used instead. ### What to include @@ -233,7 +339,7 @@ project's tracker to fix their documentation. 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. Because of this, if a given functionality was +two-tuples. Because of this, if a given functionality was introduced in, say, Python 3.7.4, your check: * should be expressed as `if sys.version_info >= (3, 7):` @@ -255,7 +361,7 @@ follow the following guidelines: `# incomplete` comment (see example below). * Partial modules (i.e. modules that are missing some or all classes, functions, or attributes) must include a top-level `__getattr__()` - function marked with an `# incomplete` comment (see example below). + function marked with an `Incomplete` return type (see example below). * Partial packages (i.e. packages that are missing one or more sub-modules) must have a `__init__.pyi` stub that is marked as incomplete (see above). A better alternative is to create empty stubs for all sub-modules and @@ -265,24 +371,17 @@ Example of a partial module with a partial class `Foo` and a partially annotated function `bar()`: ```python -def __getattr__(name: str) -> Any: ... # incomplete +from _typeshed import Incomplete class Foo: - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... x: int y: str def bar(x: str, y, *, z=...): ... -``` -### Using stubgen - -Mypy includes a tool called [stubgen](https://mypy.readthedocs.io/en/latest/stubgen.html) -that auto-generates stubs for Python and C modules using static analysis, -Sphinx docs, and runtime introspection. It can be used to get a starting -point for your stubs. Note that this generator is currently unable to -determine most argument and return types and omits them or uses ``Any`` in -their place. Fill out manually the types that you know. +def __getattr__(name: str) -> Incomplete: ... +``` ## Stub file coding style @@ -301,7 +400,7 @@ class date: @classmethod def today(cls: Type[_S]) -> _S: ... @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... + def fromordinal(cls: Type[_S], __n: int) -> _S: ... @property def year(self) -> int: ... def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ... @@ -339,8 +438,7 @@ checker, and leave out unnecessary detail: Some further tips for good type hints: * use built-in generics (`list`, `dict`, `tuple`, `set`), instead - of importing them from `typing`, **except** in type aliases, in base classes, and for - arbitrary length tuples (`Tuple[int, ...]`); + of importing them from `typing`. * use `X | Y` instead of `Union[X, Y]` and `X | None`, instead of `Optional[X]`, **except** when it is not possible due to mypy bugs (type aliases and base classes); * in Python 3 stubs, import collections (`Mapping`, `Iterable`, etc.) @@ -348,10 +446,10 @@ Some further tips for good type hints: * 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 - possible type, and `Text` if it can be either `unicode` or `bytes`; * use platform checks like `if sys.platform == 'win32'` to denote - platform-dependent APIs. + platform-dependent APIs; +* use mypy error codes for mypy-specific `# type: ignore` annotations, + e.g. `# type: ignore[override]` for Liskov Substitution Principle violations. Imports in stubs are considered private (not part of the exported API) unless: @@ -402,37 +500,6 @@ into any of those categories, use your best judgement. * Use `HasX` for protocols that have readable and/or writable attributes or getter/setter methods (e.g. `HasItems`, `HasFileno`). -## Formatting stubs - -Stubs should be reformatted with the formatters -[black](https://github.com/psf/black) and -[isort](https://github.com/PyCQA/isort) before submission. They -should also be checked for common problems by using -[flake8](https://flake8.pycqa.org/en/latest/) and the flake8 plugins -[flake8-pyi](https://github.com/ambv/flake8-pyi) and -[flake8-bugbear](https://github.com/PyCQA/flake8-bugbear). -All of these packages have been installed if you followed the -[setup instructions above](#preparing-the-environment). - -To format and check your stubs, run the following commands: - -``` -(.venv3)$ black stdlib stubs -(.venv3)$ isort stdlib stubs -(.venv3)$ flake8 -``` - - -## Running the tests - -The tests are automatically run on every PR and push to the repo. -Therefore you don't need to run them locally, unless you want to run -them before making a pull request or you want to debug some problem without -creating several small commits. - -For more information about our available tests, see -[tests/README.md](tests/README.md). - ## Submitting Changes @@ -464,10 +531,10 @@ if it consisted of several smaller commits. ## Third-party library removal policy -Third-party packages are generally removed from typeshed when one of the +Third-party stubs are generally removed from typeshed when one of the following criteria is met: -* The upstream package ships a `py.typed` file for at least 6-12 months, or +* The upstream package ships a `py.typed` file for at least six months, or * the package does not support any of the Python versions supported by typeshed. @@ -478,6 +545,21 @@ If a package ships its own `py.typed` file, please follow these steps: ["removal" label](https://github.com/python/typeshed/labels/removal). 3. Open a PR that sets the `obsolete_since` field in the `METADATA.toml` file to the first version of the package that shipped `py.typed`. +4. After at least six months, open a PR to remove the stubs. + +If third-party stubs should be removed for other reasons, please follow these +steps: + +1. Open an issue explaining why the stubs should be removed. +2. A maintainer will add the + ["removal" label](https://github.com/python/typeshed/labels/removal). +3. Open a PR that sets the `no_longer_updated` field in the `METADATA.toml` + file to `true`. +4. When a new version of the package was automatically uploaded to PyPI + (which usually takes up to 3 hours), open a PR to remove the stubs. + +If feeling kindly, please update [mypy](https://github.com/python/mypy/blob/master/mypy/stubinfo.py) +for any stub obsoletions or removals. ## Maintainer guidelines diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 15ff6c9..5b133d7 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -6,12 +6,22 @@ At present the active maintainers are (alphabetically): * Sebastian Rittau (@srittau) * Guido van Rossum (@gvanrossum) * Shantanu (@hauntsaninja) -* Rune Tynan (@CraftSpider) * Aku Viljanen (@Akuli) +* Alex Waygood (@AlexWaygood) * Jelle Zijlstra (@JelleZijlstra) -Former and inactive maintainers include: +Former maintainers include: + * David Fisher (@ddfisher) -* Łukasz Langa (@ambv) * Matthias Kramm (@matthiaskramm) +* Łukasz Langa (@ambv) * Greg Price (@gnprice) +* Rune Tynan (@CraftSpider) + +For security reasons, maintainers who haven't been active for twelve months +(no PR reviews or merges, no opened PRs, no significant participation in +issues or on typing-sig) will have their access rights removed. They will +also be moved to the "former maintainers" section here. + +Former maintainers who want their access rights restored should open +an issue or mail one of the active maintainers. diff --git a/README.md b/README.md index e18354d..7c97f2a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # typeshed -[![Build status](https://github.com/python/typeshed/workflows/Check%20stubs/badge.svg)](https://github.com/python/typeshed/actions?query=workflow%3A%22Check+stubs%22) +[![Tests](https://github.com/python/typeshed/actions/workflows/tests.yml/badge.svg)](https://github.com/python/typeshed/actions/workflows/tests.yml) [![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Pull Requests Welcome](https://img.shields.io/badge/pull%20requests-welcome-brightgreen.svg)](https://github.com/python/typeshed/blob/master/CONTRIBUTING.md) +[![Pull Requests Welcome](https://img.shields.io/badge/pull%20requests-welcome-brightgreen.svg)](https://github.com/python/typeshed/blob/main/CONTRIBUTING.md) ## About @@ -17,7 +17,10 @@ contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read it before submitting pull requests; do not report issues with annotations to the project the stubs are for, but instead report them here to typeshed.** -Typeshed supports Python versions 2.7 and 3.6 and up. +Further documentation on stub files, typeshed, and Python's typing system in +general, can also be found at https://typing.readthedocs.io/en/latest/. + +Typeshed supports Python versions 3.7 and up. ## Using @@ -31,19 +34,18 @@ you can install the type stubs using $ pip install types-six types-requests 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). +and are automatically released (multiple times a day, when needed) by +[typeshed internal machinery](https://github.com/typeshed-internal/stub_uploader). -PyCharm, pytype etc. work in a similar way, for more details see documentation -for the type-checking tool you are using. +Type checkers should be able to use these stub packages when installed. For more +details, see the documentation for your type checker. ### The `_typeshed` package typeshed includes a package `_typeshed` as part of the standard library. This package and its submodules contains utility types, but is not available at runtime. For more information about how to use this package, -[see the `stdlib/_typeshed` directory](https://github.com/python/typeshed/tree/master/stdlib/_typeshed). +[see the `stdlib/_typeshed` directory](https://github.com/python/typeshed/tree/main/stdlib/_typeshed). ## Discussion diff --git a/debian/.gitattributes b/debian/.gitattributes new file mode 100644 index 0000000..7560f16 --- /dev/null +++ b/debian/.gitattributes @@ -0,0 +1,3 @@ +.gitattributes export-ignore +gbp.conf export-ignore +salsa-ci.yml export-ignore diff --git a/debian/changelog b/debian/changelog index 83c9490..aa02ce2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,33 @@ +typeshed (0.0~git20221107.4f381af-1) unstable; urgency=medium + + * Team upload. + * New upstream version + * Standards-Version: 4.6.1 (routine-update) + * debian/install_stubs.py: update for latest code + * debian/patches/relative_package_list: find the data files more + flexibly. + * d/control: additional build-deps + + -- Michael R. Crusoe Tue, 08 Nov 2022 15:26:03 +0100 + +typeshed (0.0~git20220610.ad48606-2) unstable; urgency=medium + + [ Debian Janitor ] + * Apply multi-arch hints. + python3-typeshed: Add :any qualifier for python3 dependency. + + -- Jelmer Vernooij Fri, 28 Oct 2022 18:54:29 +0100 + +typeshed (0.0~git20220610.ad48606-1) unstable; urgency=medium + + * New upstream snapshot 0.0~git20220610.ad48606 + * Remove patch (applied upstream) + * debian/install_stubs.py: remove --system option (Closes: #1005472) + * debian/install_stubs.py: remove .* from version numbers + * Depends: add python3, drop ${python3:Depends} + * debian/rules: drop executable bit from files installed + + -- Antonio Terceiro Fri, 10 Jun 2022 19:59:30 -0300 + typeshed (0.0~git20211009.0142ea8-3) unstable; urgency=medium * Break/Replace python3-types-toml, python3-types-typed-ast (Closes: #999461) diff --git a/debian/control b/debian/control index e7402b1..298cd02 100644 --- a/debian/control +++ b/debian/control @@ -8,8 +8,10 @@ Build-Depends: debhelper-compat (= 13), python3, python3-pip, python3-requests, - python3-toml -Standards-Version: 4.6.0.1 + python3-toml, + python3-tomli, + python3-packaging +Standards-Version: 4.6.1 Vcs-Git: https://salsa.debian.org/python-team/packages/typeshed.git Vcs-Browser: https://salsa.debian.org/python-team/packages/typeshed Homepage: https://github.com/python/typeshed @@ -17,10 +19,11 @@ Rules-Requires-Root: no Package: python3-typeshed Architecture: all -Depends: ${misc:Depends}, ${python3:Depends} +Depends: ${misc:Depends}, python3:any Provides: ${typeshed:Provides} Breaks: python3-types-toml, python3-types-typed-ast Replaces: python3-types-toml, python3-types-typed-ast +Multi-Arch: foreign Description: collection of library stubs for Python, with static types Typeshed contains external type annotations for the Python standard library and Python builtins, as well as third party packages as contributed by people diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..3016916 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,4 @@ +[DEFAULT] +component = stub-uploader +debian-branch = debian/unstable +pristine-tar = True diff --git a/debian/install_stubs.py b/debian/install_stubs.py index f73b5ad..30c21f2 100644 --- a/debian/install_stubs.py +++ b/debian/install_stubs.py @@ -9,8 +9,7 @@ import shutil import subprocess import toml -from scripts.build_wheel import main as build_wheel -from scripts.metadata import determine_version +from stub_uploader.build_wheel import main as build_wheel debian = Path(".") / "debian" @@ -24,7 +23,7 @@ def run(cmd): provides = [] for stub in sys.argv[1:]: metadata = toml.load(f"stubs/{stub}/METADATA.toml") - version = metadata["version"] + version = metadata["version"].replace(".*", "") build_dir = f"debian/build/{stub}" if os.path.exists(build_dir): shutil.rmtree(build_dir) @@ -35,7 +34,6 @@ def run(cmd): sys.executable, "-mpip", "install", - "--system", "--no-deps", f"--target={install_root}/usr/lib/python3/dist-packages", str(wheel), diff --git a/debian/patches/0001-build_wheel-accept-an-argument-for-build-directory.patch b/debian/patches/0001-build_wheel-accept-an-argument-for-build-directory.patch deleted file mode 100644 index e58cb77..0000000 --- a/debian/patches/0001-build_wheel-accept-an-argument-for-build-directory.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Antonio Terceiro -Date: Sat, 16 Oct 2021 08:39:17 -0300 -Subject: build_wheel: accept an argument for build directory - -This makes it possible to build the stubs reproducibly. With -invocation-specific temporary directories, you get wheels that are -different each time with diffs like: - -> @@ -1,4 +1,4 @@ -> { -> "archive_info": {}, -> - "url": "file:///tmp/tmp9m978pzy/dist/types_waitress-0.1.10-py3-none-any.whl" -> + "url": "file:///tmp/tmpttp0wpav/dist/types_waitress-0.1.10-py3-none-any.whl" -> } ---- - stub-uploader/scripts/build_wheel.py | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/stub-uploader/scripts/build_wheel.py b/stub-uploader/scripts/build_wheel.py -index 2ff9ada..eeaca4e 100644 ---- a/stub-uploader/scripts/build_wheel.py -+++ b/stub-uploader/scripts/build_wheel.py -@@ -25,7 +25,7 @@ import subprocess - from collections import defaultdict - from glob import glob - from textwrap import dedent --from typing import List, Dict, Any, Tuple, Set, Mapping -+from typing import List, Dict, Any, Tuple, Set, Mapping, Optional - - from scripts import get_version - from scripts.const import * -@@ -371,7 +371,7 @@ def generate_long_description( - return "\n\n".join(parts) - - --def main(typeshed_dir: str, distribution: str, version: str) -> str: -+def main(typeshed_dir: str, distribution: str, version: str, build_dir: Optional[str] = None) -> str: - """Generate a wheel for a third-party distribution in typeshed. - - Return the path to directory where wheel is created. -@@ -380,7 +380,10 @@ def main(typeshed_dir: str, distribution: str, version: str) -> str: - created after uploading it. - """ - build_data = BuildData(typeshed_dir, distribution) -- tmpdir = tempfile.mkdtemp() -+ if build_dir: -+ tmpdir = build_dir -+ else: -+ tmpdir = tempfile.mkdtemp() - commit = subprocess.run( - ["git", "rev-parse", "HEAD"], - capture_output=True, -@@ -411,10 +414,11 @@ def main(typeshed_dir: str, distribution: str, version: str) -> str: - - if __name__ == "__main__": - parser = argparse.ArgumentParser() -+ parser.add_argument("--build-dir", default=None, help="build directory") - parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") - parser.add_argument("distribution", help="Third-party distribution to build") - parser.add_argument("version", help="New stub version") - args = parser.parse_args() - print( -- "Wheel is built in:", main(args.typeshed_dir, args.distribution, args.version) -+ "Wheel is built in:", main(args.typeshed_dir, args.distribution, args.version, args.build_dir) - ) diff --git a/debian/patches/relative_package_list b/debian/patches/relative_package_list new file mode 100644 index 0000000..9fa6cb7 --- /dev/null +++ b/debian/patches/relative_package_list @@ -0,0 +1,18 @@ +From: Michael R. Crusoe +Description: relative paths for stub_uploader data files +Forwarded: https://github.com/typeshed-internal/stub_uploader/pull/74 +--- python3-typeshed.orig/stub-uploader/stub_uploader/const.py ++++ python3-typeshed/stub-uploader/stub_uploader/const.py +@@ -1,7 +1,10 @@ ++import pathlib ++ + THIRD_PARTY_NAMESPACE = "stubs" + TESTS_NAMESPACE = "@tests" + META = "METADATA.toml" + TYPES_PREFIX = "types-" + +-CHANGELOG_PATH = "data/changelogs" +-UPLOADED_PATH = "data/uploaded_packages.txt" ++_ROOT=pathlib.Path(__file__).parent.parent ++CHANGELOG_PATH = str((_ROOT/"data"/"changelogs").resolve()) ++UPLOADED_PATH = str((_ROOT/"data"/"uploaded_packages.txt").resolve()) diff --git a/debian/patches/series b/debian/patches/series index d567391..c76da2c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1 @@ -0001-build_wheel-accept-an-argument-for-build-directory.patch +relative_package_list diff --git a/debian/rules b/debian/rules index 2a7eefa..4c9b98d 100755 --- a/debian/rules +++ b/debian/rules @@ -10,6 +10,8 @@ override_dh_auto_install: python3 debian/install_stubs.py $(stubs) find debian/python3-typeshed/ -name direct_url.json -delete find debian/python3-typeshed/ -name RECORD -exec sed -i -e /direct_url.json/d '{}' ';' + find debian/python3-typeshed/usr/lib/python3/dist-packages \ + -type f -executable -exec chmod -x '{}' ';' override_dh_auto_clean: dh_auto_clean diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..57fbc7c --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,9 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + + +variables: + SALSA_CI_LINTIAN_SUPPRESS_TAGS: "python-package-missing-depends-on-python,python3-depends-but-no-python3-helper,rules-require-build-prerequisite" + SALSA_CI_DISABLE_CROSSBUILD_ARM64: '1' diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..00688cf --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,3 @@ +--- +Bug-Database: https://github.com/python/typeshed/issues +Bug-Submit: https://github.com/python/typeshed/issues/new diff --git a/pre-commit b/pre-commit deleted file mode 100755 index b3d79c2..0000000 --- a/pre-commit +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# An example hook script that will run flake8, black, and isort -# prior to committing and will stop the commit if there are any -# warnings. Adjust BIN_DIR to the virtual environment where flake8, -# black, and isort are installed. -# -# To enable this hook, copy this file to ".git/hooks". - -BIN_DIR=./.venv3/bin - -CHANGED_FILES=$(git diff --cached --name-only --diff-filter=AM | grep .pyi || true) - -if test -n "${CHANGED_FILES}" -a -d "${BIN_DIR}"; then - ${BIN_DIR}/flake8 ${CHANGED_FILES} - ${BIN_DIR}/black --check ${CHANGED_FILES} - ${BIN_DIR}/isort --check-only ${CHANGED_FILES} - - # Replace the last two lines with the following lines - # if you want to reformat changed files automatically - # before committing. Please note that partial commits - # (git add -p) will not work and will commit the whole - # file! - # - # ${BIN_DIR}/black ${CHANGED_FILES} || true - # ${BIN_DIR}/isort -y ${CHANGED_FILES} || true - # git add ${CHANGED_FILES} -fi diff --git a/pyproject.toml b/pyproject.toml index fbe58f2..648db59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,44 +1,57 @@ [tool.black] line_length = 130 -target_version = ["py37"] -exclude = ".*_pb2.pyi" +target_version = ["py310"] skip_magic_trailing_comma = true +# Exclude protobuf files because they have long line lengths +# Ideally, we could configure black to allow longer line lengths +# for just these files, but doesn't seem possible yet. +force-exclude = ".*_pb2.pyi" [tool.isort] profile = "black" combine_as_imports = true line_length = 130 -skip_glob = "*_pb2.pyi" +skip = [".git", ".github", ".venv"] extra_standard_library = [ "typing_extensions", "_typeshed", # Extra modules not recognized by isort + "_ast", + "_bisect", + "_bootlocale", + "_codecs", + "_collections_abc", + "_compat_pickle", "_compression", "_csv", + "_ctypes", "_curses", + "_decimal", + "_dummy_thread", + "_dummy_threading", + "_heapq", + "_imp", + "_json", "_markupbase", + "_msi", + "_operator", + "_osx_support", + "_posixsubprocess", + "_py_abc", + "_pydecimal", "_random", + "_sitebuiltins", + "_socket", + "_stat", + "_thread", + "_threading_local", "_tkinter", + "_tracemalloc", + "_warnings", + "_weakref", "_weakrefset", + "_winapi", "genericpath", "opcode", "pyexpat", - # Python 2 modules - "__builtin__", - "cookielib", - "cStringIO", - "httplib", - "mimetools", - "rfc822", - "thread", - "urllib2", - "urlparse", - "BaseHTTPServer", - "Queue", - "SimpleHTTPServer", - "SocketServer", - "StringIO", - "UserDict", - "UserList", - "UserString", ] diff --git a/pyrightconfig.json b/pyrightconfig.json index 95bd224..9bf5e14 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,20 +1,15 @@ { + "$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json", "typeshedPath": ".", "include": [ "stdlib", "stubs" ], - "exclude": [ - // Python 2 only modules. - "**/@python2", - "stubs/enum34", - "stubs/futures", - "stubs/ipaddress" - ], "typeCheckingMode": "basic", "strictListInference": true, "strictDictionaryInference": true, "strictParameterNoneValue": true, + "strictSetInference": true, "reportFunctionMemberAccess": "error", "reportMissingModuleSource": "none", "reportMissingTypeStubs": "error", @@ -35,8 +30,6 @@ "reportUntypedNamedTuple": "error", "reportPrivateUsage": "none", "reportConstantRedefinition": "error", - "reportIncompatibleMethodOverride": "error", - "reportIncompatibleVariableOverride": "error", "reportInvalidStringEscapeSequence": "error", "reportUnknownArgumentType": "error", "reportUnknownLambdaType": "error", @@ -45,14 +38,19 @@ "reportUnboundVariable": "error", "reportInvalidStubStatement": "error", "reportInvalidTypeVarUse": "error", - "reportPropertyTypeMismatch": "error", - "reportSelfClsParameterName": "error", - // Overlapping overloads cannot be enabled at this time because - // of the "factions.Fraction.__pow__" method and "tasks.gather" function. - // Mypy's overlapping overload logic misses these issues (see mypy - // issue #10143 and #10157). + "reportUnsupportedDunderAll": "error", + "reportInconsistentConstructor": "error", + "reportTypeCommentUsage": "error", + "reportUnnecessaryComparison": "error", + // Incompatible overrides and property type mismatches are out of typeshed's control + // as they are inherited from the implementation. + "reportPropertyTypeMismatch": "none", + "reportIncompatibleMethodOverride": "none", + "reportIncompatibleVariableOverride": "none", + // Overlapping overloads are often necessary in a stub, meaning pyright's check + // (which is stricter than mypy's; see mypy issue #10143 and #10157) + // would cause many false positives and catch few bugs. "reportOverlappingOverload": "none", - // Several stubs refer to symbols in __all__ that are conditionally - // declared based on platform or version checks. - "reportUnsupportedDunderAll": "none", + // The name of the self/cls parameter is out of typeshed's control. + "reportSelfClsParameterName": "none", } diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 0680f5e..9c332fb 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -6,73 +6,81 @@ "stubs" ], "exclude": [ - // Python 2 only modules. - "**/@python2", - "stubs/enum34", - "stubs/futures", - "stubs/ipaddress", - // Modules that are incomplete in some way. "stdlib/distutils/command", "stdlib/lib2to3/refactor.pyi", + "stdlib/multiprocessing/reduction.pyi", "stdlib/sqlite3/dbapi2.pyi", - "stdlib/tkinter", - "stdlib/xml/dom", + "stdlib/_tkinter.pyi", + "stdlib/tkinter/__init__.pyi", + "stdlib/tkinter/filedialog.pyi", + "stdlib/tkinter/messagebox.pyi", + "stdlib/tkinter/tix.pyi", + "stdlib/tkinter/ttk.pyi", + "stdlib/xml/dom/NodeFilter.pyi", + "stdlib/xml/dom/expatbuilder.pyi", + "stdlib/xml/dom/minidom.pyi", + "stdlib/xml/dom/pulldom.pyi", "stdlib/xml/sax", - "stubs/appdirs", "stubs/aws-xray-sdk", "stubs/babel", - "stubs/backports.ssl_match_hostname", - "stubs/backports_abc", "stubs/bleach", "stubs/boto", "stubs/beautifulsoup4", "stubs/braintree", "stubs/caldav", + "stubs/cffi", "stubs/commonmark", "stubs/cryptography", "stubs/dateparser", "stubs/docutils", - "stubs/Flask", + "stubs/Flask-SQLAlchemy", + "stubs/fpdf2", "stubs/html5lib", "stubs/httplib2", "stubs/humanfriendly", - "stubs/Jinja2", + "stubs/invoke", "stubs/jmespath", "stubs/jsonschema", + "stubs/ldap3", "stubs/Markdown", "stubs/mysqlclient", "stubs/oauthlib", + "stubs/openpyxl", "stubs/Pillow", - "stubs/paramiko", "stubs/prettytable", "stubs/protobuf", + "stubs/python-crontab", + "stubs/google-cloud-ndb", + "stubs/passlib", + "stubs/peewee", "stubs/psutil", "stubs/psycopg2", + "stubs/pyflakes", "stubs/Pygments", "stubs/PyMySQL", "stubs/python-dateutil", - "stubs/pyvmomi", + "stubs/python-jose", + "stubs/pywin32", "stubs/PyYAML", "stubs/redis", "stubs/requests", - "stubs/selenium", - "stubs/Send2Trash", "stubs/setuptools", - "stubs/simplejson", "stubs/slumber", + "stubs/SQLAlchemy", "stubs/stripe", - "stubs/toposort", + "stubs/tqdm", "stubs/ttkthemes", - "stubs/vobject", - "stubs/waitress", - "stubs/Werkzeug" + "stubs/urllib3", + "stubs/vobject" ], "typeCheckingMode": "basic", "strictListInference": true, "strictDictionaryInference": true, "strictParameterNoneValue": true, + "strictSetInference": true, "reportFunctionMemberAccess": "error", "reportMissingModuleSource": "none", + "reportMissingParameterType": "error", "reportMissingTypeStubs": "error", "reportUnusedImport": "error", "reportUnusedClass": "error", @@ -91,8 +99,6 @@ "reportUntypedNamedTuple": "error", "reportPrivateUsage": "none", "reportConstantRedefinition": "error", - "reportIncompatibleMethodOverride": "error", - "reportIncompatibleVariableOverride": "error", "reportInvalidStringEscapeSequence": "error", "reportUnknownParameterType": "error", "reportUnknownArgumentType": "error", @@ -104,14 +110,19 @@ "reportUnboundVariable": "error", "reportInvalidStubStatement": "error", "reportInvalidTypeVarUse": "error", - "reportPropertyTypeMismatch": "error", - "reportSelfClsParameterName": "error", - // Overlapping overloads cannot be enabled at this time because - // of the "factions.Fraction.__pow__" method and "tasks.gather" function. - // Mypy's overlapping overload logic misses these issues (see mypy - // issue #10143 and #10157). + "reportUnsupportedDunderAll": "error", + "reportInconsistentConstructor": "error", + "reportTypeCommentUsage": "error", + "reportUnnecessaryComparison": "error", + // Incompatible overrides and property type mismatches are out of typeshed's control + // as they are inherited from the implementation. + "reportIncompatibleMethodOverride": "none", + "reportIncompatibleVariableOverride": "none", + "reportPropertyTypeMismatch": "none", + // Overlapping overloads are often necessary in a stub, meaning pyright's check + // (which is stricter than mypy's; see mypy issue #10143 and #10157) + // would cause many false positives and catch few bugs. "reportOverlappingOverload": "none", - // Several stubs refer to symbols in __all__ that are conditionally - // declared based on platform or version checks. - "reportUnsupportedDunderAll": "none", + // The name of the self/cls parameter is out of typeshed's control. + "reportSelfClsParameterName": "none", } diff --git a/pyrightconfig.testcases.json b/pyrightconfig.testcases.json new file mode 100644 index 0000000..0e0ec73 --- /dev/null +++ b/pyrightconfig.testcases.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json", + "typeshedPath": ".", + "include": [ + "test_cases" + ], + "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": "none", + "reportConstantRedefinition": "error", + "reportInvalidStringEscapeSequence": "error", + "reportUnknownParameterType": "error", + "reportUnknownArgumentType": "error", + "reportUnknownLambdaType": "error", + "reportUnknownVariableType": "error", + "reportUnknownMemberType": "error", + "reportMissingTypeArgument": "error", + "reportUndefinedVariable": "error", + "reportUnboundVariable": "error", + "reportInvalidStubStatement": "error", + "reportInvalidTypeVarUse": "error", + "reportPropertyTypeMismatch": "error", + "reportSelfClsParameterName": "error", + "reportUnsupportedDunderAll": "error", + "reportIncompatibleMethodOverride": "error", + "reportIncompatibleVariableOverride": "error", + "reportOverlappingOverload": "error", + "reportUnnecessaryTypeIgnoreComment": "error", + "reportMissingTypeStubs": "error", + "reportMatchNotExhaustive": "error" +} diff --git a/requirements-tests-py3.txt b/requirements-tests-py3.txt deleted file mode 100644 index ec58d60..0000000 --- a/requirements-tests-py3.txt +++ /dev/null @@ -1,9 +0,0 @@ -mypy==0.910 -pytype==2021.9.9 -typed-ast==1.4.3 -black==21.7b0 -flake8==3.9.2 -flake8-bugbear==21.4.3 -flake8-pyi==20.10.0 -isort==5.9.3 -tomli==1.1.0 diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 0000000..e84fccd --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1,17 @@ +aiohttp==3.8.3 +black==22.10.0 # must match .pre-commit-config.yaml +flake8==5.0.4 # must match .pre-commit-config.yaml +flake8-bugbear==22.10.27 # must match .pre-commit-config.yaml +flake8-noqa==1.2.9 # must match .pre-commit-config.yaml +flake8-pyi==22.10.0 # must match .pre-commit-config.yaml +isort==5.10.1 # must match .pre-commit-config.yaml +mypy==0.990 +packaging==21.3 +pathspec +pycln==2.1.1 # must match .pre-commit-config.yaml +pyyaml==6.0 +pytype==2022.10.26; platform_system != "Windows" and python_version < "3.11" +termcolor>=2 +tomli==2.0.1 +tomlkit==0.11.6 +types-pyyaml diff --git a/scripts/create_baseline_stubs.py b/scripts/create_baseline_stubs.py old mode 100644 new mode 100755 index ba0c7b3..49dcd16 --- a/scripts/create_baseline_stubs.py +++ b/scripts/create_baseline_stubs.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + """Script to generate unannotated baseline stubs using stubgen. Basic usage: @@ -6,18 +8,21 @@ Run with -h for more help. """ +from __future__ import annotations + import argparse import os import re -import shutil import subprocess import sys -from typing import Optional, Tuple + +if sys.version_info >= (3, 8): + from importlib.metadata import distribution PYRIGHT_CONFIG = "pyrightconfig.stricter.json" -def search_pip_freeze_output(project: str, output: str) -> Optional[Tuple[str, str]]: +def search_pip_freeze_output(project: str, output: str) -> tuple[str, str] | None: # Look for lines such as "typed-ast==1.4.2". '-' matches '_' and # '_' matches '-' in project name, so that "typed_ast" matches # "typed-ast", and vice versa. @@ -28,7 +33,7 @@ def search_pip_freeze_output(project: str, output: str) -> Optional[Tuple[str, s return m.group(1), m.group(2) -def get_installed_package_info(project: str) -> Optional[Tuple[str, str]]: +def get_installed_package_info(project: str) -> tuple[str, str] | None: """Find package information from pip freeze output. Match project name somewhat fuzzily (case sensitive; '-' matches '_', and @@ -40,24 +45,9 @@ def get_installed_package_info(project: str) -> Optional[Tuple[str, str]]: return search_pip_freeze_output(project, r.stdout) -def run_stubgen(package: str) -> None: - print(f"Running stubgen: stubgen -p {package}") - subprocess.run(["python", "-m", "mypy.stubgen", "-p", package], check=True) - - -def copy_stubs(src_base_dir: str, package: str, stub_dir: str) -> None: - """Copy generated stubs to the target directory under stub_dir/.""" - print(f"Copying stubs to {stub_dir}") - if not os.path.isdir(stub_dir): - os.mkdir(stub_dir) - src_dir = os.path.join(src_base_dir, package) - if os.path.isdir(src_dir): - shutil.copytree(src_dir, os.path.join(stub_dir, package)) - else: - src_file = os.path.join("out", package + ".pyi") - if not os.path.isfile(src_file): - sys.exit("Error: Cannot find generated stubs") - shutil.copy(src_file, stub_dir) +def run_stubgen(package: str, output: str) -> None: + print(f"Running stubgen: stubgen -o {output} -p {package}") + subprocess.run(["stubgen", "-o", output, "-p", package, "--export-less"], check=True) def run_black(stub_dir: str) -> None: @@ -72,20 +62,28 @@ def run_isort(stub_dir: str) -> None: def create_metadata(stub_dir: str, version: str) -> None: """Create a METADATA.toml file.""" - m = re.match(r"[0-9]+.[0-9]+", version) - if m is None: + match = re.match(r"[0-9]+.[0-9]+", version) + if match is None: sys.exit(f"Error: Cannot parse version number: {version}") - fnam = os.path.join(stub_dir, "METADATA.toml") - version = m.group(0) - assert not os.path.exists(fnam) - print(f"Writing {fnam}") - with open(fnam, "w") as f: - f.write(f'version = "{version}"\n') + filename = os.path.join(stub_dir, "METADATA.toml") + version = match.group(0) + if os.path.exists(filename): + return + print(f"Writing {filename}") + with open(filename, "w", encoding="UTF-8") as file: + file.write( + f"""\ +version = "{version}.*" + +[tool.stubtest] +ignore_missing_stub = false +""" + ) def add_pyright_exclusion(stub_dir: str) -> None: """Exclude stub_dir from strict pyright checks.""" - with open(PYRIGHT_CONFIG) as f: + with open(PYRIGHT_CONFIG, encoding="UTF-8") as f: lines = f.readlines() i = 0 while i < len(lines) and not lines[i].strip().startswith('"exclude": ['): @@ -93,7 +91,8 @@ def add_pyright_exclusion(stub_dir: str) -> None: assert i < len(lines), f"Error parsing {PYRIGHT_CONFIG}" while not lines[i].strip().startswith("]"): i += 1 - line_to_add = f' "{stub_dir}",' + # Must use forward slash in the .json file + line_to_add = f' "{stub_dir}",'.replace("\\", "/") initial = i - 1 while lines[i].lower() > line_to_add.lower(): i -= 1 @@ -106,7 +105,7 @@ def add_pyright_exclusion(stub_dir: str) -> None: lines[i] = lines[i].rstrip() + ",\n" lines.insert(i + 1, line_to_add + "\n") print(f"Updating {PYRIGHT_CONFIG}") - with open(PYRIGHT_CONFIG, "w") as f: + with open(PYRIGHT_CONFIG, "w", encoding="UTF-8") as f: f.writelines(lines) @@ -114,11 +113,11 @@ def main() -> None: parser = argparse.ArgumentParser( description="""Generate baseline stubs automatically for an installed pip package using stubgen. Also run black and isort. If the name of - the project is different from the runtime Python package name, you must - also use --package (example: --package yaml PyYAML).""" + the project is different from the runtime Python package name, you may + need to use --package (example: --package yaml PyYAML).""" ) parser.add_argument("project", help="name of PyPI project for which to generate stubs under stubs/") - parser.add_argument("--package", help="generate stubs for this Python package (defaults to project)") + parser.add_argument("--package", help="generate stubs for this Python package (default is autodetected)") args = parser.parse_args() project = args.project package = args.package @@ -127,7 +126,20 @@ def main() -> None: sys.exit(f"Invalid character in project name: {project!r}") if not package: - package = project # TODO: infer from installed files + package = project # default + # Try to find which packages are provided by the project + # Use default if that fails or if several packages are found + # + # The importlib.metadata module is used for projects whose name is different + # from the runtime Python package name (example: PyYAML/yaml) + if sys.version_info >= (3, 8): + dist = distribution(project).read_text("top_level.txt") + if dist is not None: + packages = [name for name in dist.split() if not name.startswith("_")] + if len(packages) == 1: + package = packages[0] + print(f'Using detected package "{package}" for project "{project}"', file=sys.stderr) + print("Suggestion: Try again with --package argument if that's not what you wanted", file=sys.stderr) if not os.path.isdir("stubs") or not os.path.isdir("stdlib"): sys.exit("Error: Current working directory must be the root of typeshed repository") @@ -142,13 +154,11 @@ def main() -> None: project, version = info stub_dir = os.path.join("stubs", project) - if os.path.exists(stub_dir): - sys.exit(f"Error: {stub_dir} already exists (delete it first)") - - run_stubgen(package) + package_dir = os.path.join(stub_dir, package) + if os.path.exists(package_dir): + sys.exit(f"Error: {package_dir} already exists (delete it first)") - # Stubs were generated under out/. Copy them to stubs/. - copy_stubs("out", package, stub_dir) + run_stubgen(package, stub_dir) run_isort(stub_dir) run_black(stub_dir) @@ -161,11 +171,8 @@ def main() -> None: print("\nDone!\n\nSuggested next steps:") print(f" 1. Manually review the generated stubs in {stub_dir}") - print(f' 2. Run "MYPYPATH={stub_dir} python3 -m mypy.stubtest {package}" to check the stubs against runtime') - print(f' 3. Run "mypy {stub_dir}" to check for errors') - print(f' 4. Run "black {stub_dir}" and "isort {stub_dir}" (if you\'ve made code changes)') - print(f' 5. Run "flake8 {stub_dir}" to check for e.g. unused imports') - print(" 6. Commit the changes on a new branch and create a typeshed PR") + print(" 2. Optionally run tests and autofixes (see tests/README.md for details)") + print(" 3. Commit the changes on a new branch and create a typeshed PR (don't force-push!)") if __name__ == "__main__": diff --git a/scripts/generate_proto_stubs.sh b/scripts/generate_proto_stubs.sh index f7d8cd3..f1315b8 100755 --- a/scripts/generate_proto_stubs.sh +++ b/scripts/generate_proto_stubs.sh @@ -1,18 +1,19 @@ -#!/bin/bash +#!/usr/bin/env bash # Some of the proto .pyi stubs in stubs/protobuf/ # are autogenerated using the mypy-protobuf project on the # latest `.proto` files shipped with protoc. -# + +set -ex -o pipefail + # When run, this script will autogenerate the _pb2.pyi stubs to # 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 # # Update these two variables when rerunning script -PROTOBUF_VERSION=3.17.3 -MYPY_PROTOBUF_VERSION=v2.8 - -set -ex +PROTOBUF_VERSION=21.8 +PYTHON_PROTOBUF_VERSION=4.21.8 +MYPY_PROTOBUF_VERSION=v3.4.0 if uname -a | grep Darwin; then # brew install coreutils wget @@ -20,45 +21,45 @@ if uname -a | grep Darwin; then else PLAT=linux fi -REPO_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..) -TMP_DIR=$(mktemp -d) -PYTHON_PROTOBUF_FILENAME=protobuf-python-${PROTOBUF_VERSION}.zip -PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-${PLAT}-x86_64.zip -PROTOC_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME} -PYTHON_PROTOBUF_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${PYTHON_PROTOBUF_FILENAME} +REPO_ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")"/..)" +TMP_DIR="$(mktemp -d)" +PYTHON_PROTOBUF_FILENAME="protobuf-python-${PYTHON_PROTOBUF_VERSION}.zip" +PROTOC_FILENAME="protoc-${PROTOBUF_VERSION}-${PLAT}-x86_64.zip" +PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/$PROTOC_FILENAME" +PYTHON_PROTOBUF_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/$PYTHON_PROTOBUF_FILENAME" -cd $TMP_DIR +cd "$TMP_DIR" echo "Working in $TMP_DIR" # Install protoc -wget $PROTOC_URL +wget "$PROTOC_URL" mkdir protoc_install -unzip $PROTOC_FILENAME -d protoc_install +unzip "$PROTOC_FILENAME" -d protoc_install # Fetch protoc-python (which contains all the .proto files) -wget $PYTHON_PROTOBUF_URL -unzip $PYTHON_PROTOBUF_FILENAME -PYTHON_PROTOBUF_DIR=protobuf-$PROTOBUF_VERSION +wget "$PYTHON_PROTOBUF_URL" +unzip "$PYTHON_PROTOBUF_FILENAME" +PYTHON_PROTOBUF_DIR="protobuf-$PYTHON_PROTOBUF_VERSION" # Prepare virtualenv VENV=venv -python3 -m venv $VENV -source $VENV/bin/activate -pip install -r $REPO_ROOT/requirements-tests-py3.txt # for black and isort +python3 -m venv "$VENV" +source "$VENV/bin/activate" +pip install -r "$REPO_ROOT/requirements-tests.txt" # for black and isort # Install mypy-protobuf -pip install git+https://github.com/dropbox/mypy-protobuf@${MYPY_PROTOBUF_VERSION} +pip install "git+https://github.com/dropbox/mypy-protobuf@$MYPY_PROTOBUF_VERSION" # Remove existing pyi -find $REPO_ROOT/stubs/protobuf/ -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. -# The logic (as of 3.14.0) can roughly be described as a allowlist of .proto files +# The logic (as of 3.20.1) can roughly be described as a allowlist of .proto files # further limited to exclude *test* and internal/ # https://github.com/protocolbuffers/protobuf/blob/master/python/setup.py -PROTO_FILES=$(grep "generate_proto.*google" $PYTHON_PROTOBUF_DIR/python/setup.py | \ - cut -d\" -f2 | \ +PROTO_FILES=$(grep "GenProto.*google" $PYTHON_PROTOBUF_DIR/python/setup.py | \ + cut -d\' -f2 | \ grep -v "test" | \ grep -v google/protobuf/internal/ | \ grep -v google/protobuf/pyext/python.proto | \ @@ -69,9 +70,11 @@ 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/stubs/protobuf $PROTO_FILES +# shellcheck disable=SC2086 +protoc_install/bin/protoc --proto_path="$PYTHON_PROTOBUF_DIR/src" --mypy_out="relax_strict_optional_primitives:$REPO_ROOT/stubs/protobuf" $PROTO_FILES -isort $REPO_ROOT/stubs/protobuf -black $REPO_ROOT/stubs/protobuf +isort "$REPO_ROOT/stubs/protobuf" +black "$REPO_ROOT/stubs/protobuf" -sed -i="" "s/mypy-protobuf [^\"]*/mypy-protobuf ${MYPY_PROTOBUF_VERSION}/" $REPO_ROOT/stubs/protobuf/METADATA.toml +sed -i "" "s/mypy-protobuf [^\"]*/mypy-protobuf ${MYPY_PROTOBUF_VERSION}/" "$REPO_ROOT/stubs/protobuf/METADATA.toml" +sed -i "" "s/version = .*$/version = \"$(echo ${PYTHON_PROTOBUF_VERSION} | cut -d. -f1-2)\.\*\"/" "$REPO_ROOT/stubs/protobuf/METADATA.toml" diff --git a/scripts/runtests.py b/scripts/runtests.py new file mode 100644 index 0000000..4d76a74 --- /dev/null +++ b/scripts/runtests.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import re +import subprocess +import sys +from pathlib import Path + +try: + from termcolor import colored +except ImportError: + + def colored(text: str, color: str = "") -> str: # type: ignore[misc] + return text + + +_STRICTER_CONFIG_FILE = "pyrightconfig.stricter.json" +_SUCCESS = colored("Success", "green") +_SKIPPED = colored("Skipped", "yellow") +_FAILED = colored("Failed", "red") +# We're using the oldest supported version because it's the most likely to produce errors +# due to unsupported syntax, feature, or bug in a tool. +_PYTHON_VERSION = "3.7" + + +def _parse_jsonc(json_text: str) -> str: + # strip comments from the file + lines = [line for line in json_text.split("\n") if not line.strip().startswith("//")] + # strip trailing commas from the file + valid_json = re.sub(r",(\s*?[\}\]])", r"\1", "\n".join(lines)) + return valid_json + + +def _get_strict_params(stub_path: str) -> list[str]: + with open(_STRICTER_CONFIG_FILE, encoding="UTF-8") as file: + data = json.loads(_parse_jsonc(file.read())) + lower_stub_path = stub_path.lower() + if any(lower_stub_path == stub.lower() for stub in data["exclude"]): + return [] + return ["-p", _STRICTER_CONFIG_FILE] + + +def main() -> None: + try: + path = sys.argv[1] + except IndexError: + print("Missing path argument in format /", file=sys.stderr) + sys.exit(1) + assert os.path.exists(path), rf"Path {path} does not exist." + path_tokens = Path(path).parts + assert len(path_tokens) == 2, "Path argument should be in format /." + folder, stub = path_tokens + assert folder in {"stdlib", "stubs"}, "Only the 'stdlib' and 'stubs' folders are supported." + stubtest_result: subprocess.CompletedProcess[bytes] | None = None + pytype_result: subprocess.CompletedProcess[bytes] | None = None + + # Run formatters first. Order matters. + print("\nRunning pycln...") + subprocess.run([sys.executable, "-m", "pycln", path, "--all"]) + print("\nRunning isort...") + subprocess.run([sys.executable, "-m", "isort", path]) + print("\nRunning Black...") + black_result = subprocess.run([sys.executable, "-m", "black", path]) + if black_result.returncode == 123: + print("Could not run tests due to an internal error with Black. See above for details.", file=sys.stderr) + sys.exit(black_result.returncode) + + print("\nRunning Flake8...") + flake8_result = subprocess.run([sys.executable, "-m", "flake8", path]) + + print("\nRunning check_consistent.py...") + check_consistent_result = subprocess.run([sys.executable, "tests/check_consistent.py"]) + print("\nRunning check_new_syntax.py...") + check_new_syntax_result = subprocess.run([sys.executable, "tests/check_new_syntax.py"]) + + print(f"\nRunning Pyright on Python {_PYTHON_VERSION}...") + pyright_result = subprocess.run( + [sys.executable, "tests/pyright_test.py", path, "--pythonversion", _PYTHON_VERSION] + _get_strict_params(path), + stderr=subprocess.PIPE, + text=True, + ) + if re.match(r"error (runn|find)ing npx", pyright_result.stderr): + print(colored("\nSkipping Pyright tests: npx is not installed or can't be run!", "yellow")) + pyright_returncode = 0 + pyright_skipped = True + else: + print(pyright_result.stderr) + pyright_returncode = pyright_result.returncode + pyright_skipped = False + + print(f"\nRunning mypy for Python {_PYTHON_VERSION}...") + mypy_result = subprocess.run([sys.executable, "tests/mypy_test.py", path, "--python-version", _PYTHON_VERSION]) + # If mypy failed, stubtest will fail without any helpful error + if mypy_result.returncode == 0: + if folder == "stdlib": + print("\nRunning stubtest...") + stubtest_result = subprocess.run([sys.executable, "tests/stubtest_stdlib.py", stub]) + else: + run_stubtest_query = ( + f"\nRun stubtest for {stub!r} (Y/N)?\n\n" + "NOTE: Running third-party stubtest involves downloading and executing arbitrary code from PyPI.\n" + f"Only run stubtest if you trust the {stub!r} package.\n" + ) + run_stubtest_answer = input(colored(run_stubtest_query, "yellow")).lower() + while run_stubtest_answer not in {"yes", "no", "y", "n"}: + run_stubtest_answer = input(colored("Invalid response; please try again.\n", "red")).lower() + if run_stubtest_answer in {"yes", "y"}: + print("\nRunning stubtest.") + stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub]) + else: + print(colored(f"\nSkipping stubtest for {stub!r}...", "yellow")) + else: + print(colored("\nSkipping stubtest since mypy failed.", "yellow")) + + if sys.platform == "win32": + print(colored("\nSkipping pytype on Windows. You can run the test with WSL.", "yellow")) + else: + print("\nRunning pytype...") + pytype_result = subprocess.run([sys.executable, "tests/pytype_test.py", path]) + + print(f"\nRunning regression tests for Python {_PYTHON_VERSION}...") + regr_test_result = subprocess.run( + [sys.executable, "tests/regr_test.py", "stdlib" if folder == "stdlib" else stub, "--python-version", _PYTHON_VERSION], + stderr=subprocess.PIPE, + text=True, + ) + # No test means they all ran successfully (0 out of 0). Not all 3rd-party stubs have regression tests. + if "No test cases found" in regr_test_result.stderr: + regr_test_returncode = 0 + print(colored(f"\nNo test cases found for {stub!r}!", "green")) + else: + regr_test_returncode = regr_test_result.returncode + print(regr_test_result.stderr) + + any_failure = any( + [ + flake8_result.returncode, + check_consistent_result.returncode, + check_new_syntax_result.returncode, + pyright_returncode, + mypy_result.returncode, + getattr(stubtest_result, "returncode", 0), + getattr(pytype_result, "returncode", 0), + regr_test_returncode, + ] + ) + + if any_failure: + print(colored("\n\n--- TEST SUMMARY: One or more tests failed. See above for details. ---\n", "red")) + else: + print(colored("\n\n--- TEST SUMMARY: All tests passed! ---\n", "green")) + print("Flake8:", _SUCCESS if flake8_result.returncode == 0 else _FAILED) + print("Check consistent:", _SUCCESS if check_consistent_result.returncode == 0 else _FAILED) + print("Check new syntax:", _SUCCESS if check_new_syntax_result.returncode == 0 else _FAILED) + if pyright_skipped: + print("Pyright:", _SKIPPED) + else: + print("Pyright:", _SUCCESS if pyright_returncode == 0 else _FAILED) + print("mypy:", _SUCCESS if mypy_result.returncode == 0 else _FAILED) + if stubtest_result is None: + print("stubtest:", _SKIPPED) + else: + print("stubtest:", _SUCCESS if stubtest_result.returncode == 0 else _FAILED) + if pytype_result is None: + print("pytype:", _SKIPPED) + else: + print("pytype:", _SUCCESS if pytype_result.returncode == 0 else _FAILED) + print("Regression test:", _SUCCESS if regr_test_returncode == 0 else _FAILED) + + sys.exit(int(any_failure)) + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + print(colored("\nTests aborted due to KeyboardInterrupt!\n", "red")) + sys.exit(1) diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py new file mode 100644 index 0000000..bb2b7bc --- /dev/null +++ b/scripts/stubsabot.py @@ -0,0 +1,742 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import argparse +import asyncio +import contextlib +import datetime +import enum +import functools +import io +import os +import re +import subprocess +import sys +import tarfile +import textwrap +import urllib.parse +import zipfile +from collections.abc import Iterator, Mapping, Sequence +from dataclasses import dataclass +from pathlib import Path +from typing import Annotated, Any, ClassVar, NamedTuple, TypeVar +from typing_extensions import TypeAlias + +import aiohttp +import packaging.specifiers +import packaging.version +import tomli +import tomlkit +from termcolor import colored + +ActionLevelSelf = TypeVar("ActionLevelSelf", bound="ActionLevel") + + +class ActionLevel(enum.IntEnum): + def __new__(cls: type[ActionLevelSelf], value: int, doc: str) -> ActionLevelSelf: + member = int.__new__(cls, value) + member._value_ = value + member.__doc__ = doc + return member + + @classmethod + def from_cmd_arg(cls, cmd_arg: str) -> ActionLevel: + try: + return cls[cmd_arg] + except KeyError: + raise argparse.ArgumentTypeError(f'Argument must be one of "{list(cls.__members__)}"') + + nothing = 0, "make no changes" + local = 1, "make changes that affect local repo" + fork = 2, "make changes that affect remote repo, but won't open PRs against upstream" + everything = 3, "do everything, e.g. open PRs" + + +@dataclass +class StubInfo: + distribution: str + version_spec: str + obsolete: bool + no_longer_updated: bool + + +def read_typeshed_stub_metadata(stub_path: Path) -> StubInfo: + with (stub_path / "METADATA.toml").open("rb") as f: + meta = tomli.load(f) + return StubInfo( + distribution=stub_path.name, + version_spec=meta["version"], + obsolete="obsolete_since" in meta, + no_longer_updated=meta.get("no_longer_updated", False), + ) + + +@dataclass +class PypiReleaseDownload: + url: str + packagetype: Annotated[str, "Should hopefully be either 'bdist_wheel' or 'sdist'"] + filename: str + version: packaging.version.Version + upload_date: datetime.datetime + + +VersionString: TypeAlias = str +ReleaseDownload: TypeAlias = dict[str, Any] + + +@dataclass +class PypiInfo: + distribution: str + pypi_root: str + releases: dict[VersionString, list[ReleaseDownload]] + info: dict[str, Any] + + def get_release(self, *, version: VersionString) -> PypiReleaseDownload: + # prefer wheels, since it's what most users will get / it's pretty easy to mess up MANIFEST + release_info = sorted(self.releases[version], key=lambda x: bool(x["packagetype"] == "bdist_wheel"))[-1] + return PypiReleaseDownload( + url=release_info["url"], + packagetype=release_info["packagetype"], + filename=release_info["filename"], + version=packaging.version.Version(version), + upload_date=datetime.datetime.fromisoformat(release_info["upload_time"]), + ) + + def get_latest_release(self) -> PypiReleaseDownload: + return self.get_release(version=self.info["version"]) + + def releases_in_descending_order(self) -> Iterator[PypiReleaseDownload]: + for version in sorted(self.releases, key=packaging.version.Version, reverse=True): + yield self.get_release(version=version) + + +async def fetch_pypi_info(distribution: str, session: aiohttp.ClientSession) -> PypiInfo: + # Cf. # https://warehouse.pypa.io/api-reference/json.html#get--pypi--project_name--json + pypi_root = f"https://pypi.org/pypi/{urllib.parse.quote(distribution)}" + async with session.get(f"{pypi_root}/json") as response: + response.raise_for_status() + j = await response.json() + return PypiInfo(distribution=distribution, pypi_root=pypi_root, releases=j["releases"], info=j["info"]) + + +@dataclass +class Update: + distribution: str + stub_path: Path + old_version_spec: str + new_version_spec: str + links: dict[str, str] + diff_analysis: DiffAnalysis | None + + def __str__(self) -> str: + return f"Updating {self.distribution} from {self.old_version_spec!r} to {self.new_version_spec!r}" + + +@dataclass +class Obsolete: + distribution: str + stub_path: Path + obsolete_since_version: str + obsolete_since_date: datetime.datetime + links: dict[str, str] + + def __str__(self) -> str: + return f"Marking {self.distribution} as obsolete since {self.obsolete_since_version!r}" + + +@dataclass +class NoUpdate: + distribution: str + reason: str + + def __str__(self) -> str: + return f"Skipping {self.distribution}: {self.reason}" + + +async def release_contains_py_typed(release_to_download: PypiReleaseDownload, *, session: aiohttp.ClientSession) -> bool: + async with session.get(release_to_download.url) as response: + body = io.BytesIO(await response.read()) + + packagetype = release_to_download.packagetype + if packagetype == "bdist_wheel": + assert release_to_download.filename.endswith(".whl") + with zipfile.ZipFile(body) as zf: + return any(Path(f).name == "py.typed" for f in zf.namelist()) + elif packagetype == "sdist": + assert release_to_download.filename.endswith(".tar.gz") + with tarfile.open(fileobj=body, mode="r:gz") as zf: + return any(Path(f).name == "py.typed" for f in zf.getnames()) + else: + raise AssertionError(f"Unknown package type: {packagetype!r}") + + +async def find_first_release_with_py_typed(pypi_info: PypiInfo, *, session: aiohttp.ClientSession) -> PypiReleaseDownload: + release_iter = pypi_info.releases_in_descending_order() + while await release_contains_py_typed(release := next(release_iter), session=session): + first_release_with_py_typed = release + return first_release_with_py_typed + + +def _check_spec(updated_spec: str, version: packaging.version.Version) -> str: + assert version in packaging.specifiers.SpecifierSet(f"=={updated_spec}"), f"{version} not in {updated_spec}" + return updated_spec + + +def get_updated_version_spec(spec: str, version: packaging.version.Version) -> str: + """ + Given the old specifier and an updated version, returns an updated specifier that has the + specificity of the old specifier, but matches the updated version. + + For example: + spec="1", version="1.2.3" -> "1.2.3" + spec="1.0.1", version="1.2.3" -> "1.2.3" + spec="1.*", version="1.2.3" -> "1.*" + spec="1.*", version="2.3.4" -> "2.*" + spec="1.1.*", version="1.2.3" -> "1.2.*" + spec="1.1.1.*", version="1.2.3" -> "1.2.3.*" + """ + if not spec.endswith(".*"): + return _check_spec(version.base_version, version) + + specificity = spec.count(".") if spec.removesuffix(".*") else 0 + rounded_version = version.base_version.split(".")[:specificity] + rounded_version.extend(["0"] * (specificity - len(rounded_version))) + + return _check_spec(".".join(rounded_version) + ".*", version) + + +@functools.cache +def get_github_api_headers() -> Mapping[str, str]: + headers = {"Accept": "application/vnd.github.v3+json"} + secret = os.environ.get("GITHUB_TOKEN") + if secret is not None: + headers["Authorization"] = f"token {secret}" if secret.startswith("ghp") else f"Bearer {secret}" + return headers + + +@dataclass +class GithubInfo: + repo_path: str + tags: list[dict[str, Any]] + + +async def get_github_repo_info(session: aiohttp.ClientSession, pypi_info: PypiInfo) -> GithubInfo | None: + """ + If the project represented by `pypi_info` is hosted on GitHub, + return information regarding the project as it exists on GitHub. + + Else, return None. + """ + project_urls = pypi_info.info.get("project_urls", {}).values() + for project_url in project_urls: + assert isinstance(project_url, str) + split_url = urllib.parse.urlsplit(project_url) + if split_url.netloc == "github.com" and not split_url.query and not split_url.fragment: + url_path = split_url.path.strip("/") + if len(Path(url_path).parts) == 2: + github_tags_info_url = f"https://api.github.com/repos/{url_path}/tags" + async with session.get(github_tags_info_url, headers=get_github_api_headers()) as response: + if response.status == 200: + tags = await response.json() + assert isinstance(tags, list) + return GithubInfo(repo_path=url_path, tags=tags) + return None + + +class GithubDiffInfo(NamedTuple): + repo_path: str + old_tag: str + new_tag: str + diff_url: str + + +async def get_diff_info( + session: aiohttp.ClientSession, stub_info: StubInfo, pypi_info: PypiInfo, pypi_version: packaging.version.Version +) -> GithubDiffInfo | None: + """Return a tuple giving info about the diff between two releases, if possible. + + Return `None` if the project isn't hosted on GitHub, + or if a link pointing to the diff couldn't be found for any other reason. + """ + github_info = await get_github_repo_info(session, pypi_info) + if github_info is None: + return None + + versions_to_tags = {} + for tag in github_info.tags: + tag_name = tag["name"] + # Some packages in typeshed (e.g. emoji) have tag names + # that are invalid to be passed to the Version() constructor, + # e.g. v.1.4.2 + with contextlib.suppress(packaging.version.InvalidVersion): + versions_to_tags[packaging.version.Version(tag_name)] = tag_name + + curr_specifier = packaging.specifiers.SpecifierSet(f"=={stub_info.version_spec}") + + try: + new_tag = versions_to_tags[pypi_version] + except KeyError: + return None + + try: + old_version = max(version for version in versions_to_tags if version in curr_specifier) + except ValueError: + return None + else: + old_tag = versions_to_tags[old_version] + + diff_url = f"https://github.com/{github_info.repo_path}/compare/{old_tag}...{new_tag}" + async with session.get(diff_url, headers=get_github_api_headers()) as response: + # Double-check we're returning a valid URL here + response.raise_for_status() + return GithubDiffInfo(repo_path=github_info.repo_path, old_tag=old_tag, new_tag=new_tag, diff_url=diff_url) + + +FileInfo: TypeAlias = dict[str, Any] + + +def _plural_s(num: int, /) -> str: + return "s" if num != 1 else "" + + +@dataclass +class DiffAnalysis: + MAXIMUM_NUMBER_OF_FILES_TO_LIST: ClassVar[int] = 7 + py_files: list[FileInfo] + py_files_stubbed_in_typeshed: list[FileInfo] + + @property + def runtime_definitely_has_consistent_directory_structure_with_typeshed(self) -> bool: + """ + If 0 .py files in the GitHub diff exist in typeshed's stubs, + there's a possibility that the .py files might be found + in a different directory at runtime. + + For example: pyopenssl has its .py files in the `src/OpenSSL/` directory at runtime, + but in typeshed the stubs are in the `OpenSSL/` directory. + """ + return bool(self.py_files_stubbed_in_typeshed) + + @functools.cached_property + def public_files_added(self) -> Sequence[str]: + return [ + file["filename"] + for file in self.py_files + if not re.match("_[^_]", Path(file["filename"]).name) and file["status"] == "added" + ] + + @functools.cached_property + def typeshed_files_deleted(self) -> Sequence[str]: + return [file["filename"] for file in self.py_files_stubbed_in_typeshed if file["status"] == "removed"] + + @functools.cached_property + def typeshed_files_modified(self) -> Sequence[str]: + return [file["filename"] for file in self.py_files_stubbed_in_typeshed if file["status"] in {"modified", "renamed"}] + + @property + def total_lines_added(self) -> int: + return sum(file["additions"] for file in self.py_files) + + @property + def total_lines_deleted(self) -> int: + return sum(file["deletions"] for file in self.py_files) + + def _describe_files(self, *, verb: str, filenames: Sequence[str]) -> str: + num_files = len(filenames) + if num_files > 1: + description = f"have been {verb}" + # Don't list the filenames if there are *loads* of files + if num_files <= self.MAXIMUM_NUMBER_OF_FILES_TO_LIST: + description += ": " + description += ", ".join(f"`{filename}`" for filename in filenames) + description += "." + return description + if num_files == 1: + return f"has been {verb}: `{filenames[0]}`." + return f"have been {verb}." + + def describe_public_files_added(self) -> str: + num_files_added = len(self.public_files_added) + analysis = f"{num_files_added} public Python file{_plural_s(num_files_added)} " + analysis += self._describe_files(verb="added", filenames=self.public_files_added) + return analysis + + def describe_typeshed_files_deleted(self) -> str: + num_files_deleted = len(self.typeshed_files_deleted) + analysis = f"{num_files_deleted} file{_plural_s(num_files_deleted)} included in typeshed's stubs " + analysis += self._describe_files(verb="deleted", filenames=self.typeshed_files_deleted) + return analysis + + def describe_typeshed_files_modified(self) -> str: + num_files_modified = len(self.typeshed_files_modified) + analysis = f"{num_files_modified} file{_plural_s(num_files_modified)} included in typeshed's stubs " + analysis += self._describe_files(verb="modified or renamed", filenames=self.typeshed_files_modified) + return analysis + + def __str__(self) -> str: + data_points = [] + if self.runtime_definitely_has_consistent_directory_structure_with_typeshed: + data_points += [ + self.describe_public_files_added(), + self.describe_typeshed_files_deleted(), + self.describe_typeshed_files_modified(), + ] + data_points += [ + f"Total lines of Python code added: {self.total_lines_added}.", + f"Total lines of Python code deleted: {self.total_lines_deleted}.", + ] + return "Stubsabot analysis of the diff between the two releases:\n - " + "\n - ".join(data_points) + + +async def analyze_diff( + github_repo_path: str, stub_path: Path, old_tag: str, new_tag: str, *, session: aiohttp.ClientSession +) -> DiffAnalysis | None: + url = f"https://api.github.com/repos/{github_repo_path}/compare/{old_tag}...{new_tag}" + async with session.get(url, headers=get_github_api_headers()) as response: + response.raise_for_status() + json_resp = await response.json() + assert isinstance(json_resp, dict) + # https://docs.github.com/en/rest/commits/commits#compare-two-commits + py_files: list[FileInfo] = [file for file in json_resp["files"] if Path(file["filename"]).suffix == ".py"] + files_in_typeshed = set(stub_path.rglob("*.pyi")) + py_files_stubbed_in_typeshed = [file for file in py_files if (stub_path / f"{file['filename']}i") in files_in_typeshed] + return DiffAnalysis(py_files=py_files, py_files_stubbed_in_typeshed=py_files_stubbed_in_typeshed) + + +async def determine_action(stub_path: Path, session: aiohttp.ClientSession) -> Update | NoUpdate | Obsolete: + stub_info = read_typeshed_stub_metadata(stub_path) + if stub_info.obsolete: + return NoUpdate(stub_info.distribution, "obsolete") + if stub_info.no_longer_updated: + return NoUpdate(stub_info.distribution, "no longer updated") + + pypi_info = await fetch_pypi_info(stub_info.distribution, session) + latest_release = pypi_info.get_latest_release() + latest_version = latest_release.version + spec = packaging.specifiers.SpecifierSet(f"=={stub_info.version_spec}") + if latest_version in spec: + return NoUpdate(stub_info.distribution, "up to date") + + is_obsolete = await release_contains_py_typed(latest_release, session=session) + if is_obsolete: + first_release_with_py_typed = await find_first_release_with_py_typed(pypi_info, session=session) + relevant_version = version_obsolete_since = first_release_with_py_typed.version + else: + relevant_version = latest_version + + project_urls = pypi_info.info["project_urls"] or {} + maybe_links: dict[str, str | None] = { + "Release": f"{pypi_info.pypi_root}/{relevant_version}", + "Homepage": project_urls.get("Homepage"), + "Changelog": project_urls.get("Changelog") or project_urls.get("Changes") or project_urls.get("Change Log"), + } + links = {k: v for k, v in maybe_links.items() if v is not None} + + diff_info = await get_diff_info(session, stub_info, pypi_info, relevant_version) + if diff_info is not None: + github_repo_path, old_tag, new_tag, diff_url = diff_info + links["Diff"] = diff_url + + if is_obsolete: + return Obsolete( + stub_info.distribution, + stub_path, + obsolete_since_version=str(version_obsolete_since), + obsolete_since_date=first_release_with_py_typed.upload_date, + links=links, + ) + + if diff_info is None: + diff_analysis: DiffAnalysis | None = None + else: + diff_analysis = await analyze_diff( + github_repo_path=github_repo_path, stub_path=stub_path, old_tag=old_tag, new_tag=new_tag, session=session + ) + + return Update( + distribution=stub_info.distribution, + stub_path=stub_path, + old_version_spec=stub_info.version_spec, + new_version_spec=get_updated_version_spec(stub_info.version_spec, latest_version), + links=links, + diff_analysis=diff_analysis, + ) + + +TYPESHED_OWNER = "python" + + +@functools.lru_cache() +def get_origin_owner() -> str: + output = subprocess.check_output(["git", "remote", "get-url", "origin"], text=True).strip() + match = re.match(r"(git@github.com:|https://github.com/)(?P[^/]+)/(?P[^/\s]+)", output) + assert match is not None, f"Couldn't identify origin's owner: {output!r}" + assert match.group("repo").removesuffix(".git") == "typeshed", f'Unexpected repo: {match.group("repo")!r}' + return match.group("owner") + + +async def create_or_update_pull_request(*, title: str, body: str, branch_name: str, session: aiohttp.ClientSession) -> None: + fork_owner = get_origin_owner() + + async with session.post( + f"https://api.github.com/repos/{TYPESHED_OWNER}/typeshed/pulls", + json={"title": title, "body": body, "head": f"{fork_owner}:{branch_name}", "base": "main"}, + headers=get_github_api_headers(), + ) as response: + resp_json = await response.json() + if response.status == 422 and any( + "A pull request already exists" in e.get("message", "") for e in resp_json.get("errors", []) + ): + # Find the existing PR + async with session.get( + f"https://api.github.com/repos/{TYPESHED_OWNER}/typeshed/pulls", + params={"state": "open", "head": f"{fork_owner}:{branch_name}", "base": "main"}, + headers=get_github_api_headers(), + ) as response: + response.raise_for_status() + resp_json = await response.json() + assert len(resp_json) >= 1 + pr_number = resp_json[0]["number"] + # Update the PR's title and body + async with session.patch( + f"https://api.github.com/repos/{TYPESHED_OWNER}/typeshed/pulls/{pr_number}", + json={"title": title, "body": body}, + headers=get_github_api_headers(), + ) as response: + response.raise_for_status() + return + response.raise_for_status() + + +def has_non_stubsabot_commits(branch: str) -> bool: + assert not branch.startswith("origin/") + try: + # commits on origin/branch that are not on branch or are + # patch equivalent to a commit on branch + print( + "[debugprint]", + subprocess.check_output( + ["git", "log", "--right-only", "--pretty=%an %s", "--cherry-pick", f"{branch}...origin/{branch}"] + ), + ) + print( + "[debugprint]", + subprocess.check_output( + ["git", "log", "--right-only", "--pretty=%an", "--cherry-pick", f"{branch}...origin/{branch}"] + ), + ) + output = subprocess.check_output( + ["git", "log", "--right-only", "--pretty=%an", "--cherry-pick", f"{branch}...origin/{branch}"], + stderr=subprocess.DEVNULL, + ) + return bool(set(output.splitlines()) - {b"stubsabot"}) + except subprocess.CalledProcessError: + # origin/branch does not exist + return False + + +def latest_commit_is_different_to_last_commit_on_origin(branch: str) -> bool: + assert not branch.startswith("origin/") + try: + # https://www.git-scm.com/docs/git-range-diff + # If the number of lines is >1, + # it indicates that something about our commit is different to the last commit + # (Could be the commit "content", or the commit message). + commit_comparison = subprocess.run( + ["git", "range-diff", f"origin/{branch}~1..origin/{branch}", "HEAD~1..HEAD"], check=True, capture_output=True + ) + return len(commit_comparison.stdout.splitlines()) > 1 + except subprocess.CalledProcessError: + # origin/branch does not exist + return True + + +class RemoteConflict(Exception): + pass + + +def somewhat_safe_force_push(branch: str) -> None: + if has_non_stubsabot_commits(branch): + raise RemoteConflict(f"origin/{branch} has non-stubsabot changes that are not on {branch}!") + subprocess.check_call(["git", "push", "origin", branch, "--force"]) + + +def normalize(name: str) -> str: + # PEP 503 normalization + return re.sub(r"[-_.]+", "-", name).lower() + + +# lock should be unnecessary, but can't hurt to enforce mutual exclusion +_repo_lock = asyncio.Lock() + +BRANCH_PREFIX = "stubsabot" + + +def get_update_pr_body(update: Update, metadata: dict[str, Any]) -> str: + body = "\n".join(f"{k}: {v}" for k, v in update.links.items()) + + if update.diff_analysis is not None: + body += f"\n\n{update.diff_analysis}" + + stubtest_will_run = not metadata.get("stubtest", {}).get("skip", False) + if stubtest_will_run: + body += textwrap.dedent( + """ + + If stubtest fails for this PR: + - Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) + - Fix stubtest failures in another PR, then close this PR + + Note that you will need to close and re-open the PR in order to trigger CI + """ + ) + else: + body += textwrap.dedent( + f""" + + :warning: Review this PR manually, as stubtest is skipped in CI for {update.distribution}! :warning: + """ + ) + return body + + +async def suggest_typeshed_update(update: Update, session: aiohttp.ClientSession, action_level: ActionLevel) -> None: + if action_level <= ActionLevel.nothing: + return + title = f"[stubsabot] Bump {update.distribution} to {update.new_version_spec}" + async with _repo_lock: + branch_name = f"{BRANCH_PREFIX}/{normalize(update.distribution)}" + subprocess.check_call(["git", "checkout", "-B", branch_name, "origin/main"]) + with open(update.stub_path / "METADATA.toml", "rb") as f: + meta = tomlkit.load(f) + meta["version"] = update.new_version_spec + with open(update.stub_path / "METADATA.toml", "w", encoding="UTF-8") as f: + tomlkit.dump(meta, f) + body = get_update_pr_body(update, meta) + subprocess.check_call(["git", "commit", "--all", "-m", f"{title}\n\n{body}"]) + if action_level <= ActionLevel.local: + return + if not latest_commit_is_different_to_last_commit_on_origin(branch_name): + print(f"No pushing to origin required: origin/{branch_name} exists and requires no changes!") + return + somewhat_safe_force_push(branch_name) + if action_level <= ActionLevel.fork: + return + + await create_or_update_pull_request(title=title, body=body, branch_name=branch_name, session=session) + + +async def suggest_typeshed_obsolete(obsolete: Obsolete, session: aiohttp.ClientSession, action_level: ActionLevel) -> None: + if action_level <= ActionLevel.nothing: + return + title = f"[stubsabot] Mark {obsolete.distribution} as obsolete since {obsolete.obsolete_since_version}" + async with _repo_lock: + branch_name = f"{BRANCH_PREFIX}/{normalize(obsolete.distribution)}" + subprocess.check_call(["git", "checkout", "-B", branch_name, "origin/main"]) + with open(obsolete.stub_path / "METADATA.toml", "rb") as f: + meta = tomlkit.load(f) + obs_string = tomlkit.string(obsolete.obsolete_since_version) + obs_string.comment(f"Released on {obsolete.obsolete_since_date.date().isoformat()}") + meta["obsolete_since"] = obs_string + with open(obsolete.stub_path / "METADATA.toml", "w", encoding="UTF-8") as f: + tomlkit.dump(meta, f) + body = "\n".join(f"{k}: {v}" for k, v in obsolete.links.items()) + subprocess.check_call(["git", "commit", "--all", "-m", f"{title}\n\n{body}"]) + if action_level <= ActionLevel.local: + return + if not latest_commit_is_different_to_last_commit_on_origin(branch_name): + print(f"No PR required: origin/{branch_name} exists and requires no changes!") + return + somewhat_safe_force_push(branch_name) + if action_level <= ActionLevel.fork: + return + + await create_or_update_pull_request(title=title, body=body, branch_name=branch_name, session=session) + + +async def main() -> None: + assert sys.version_info >= (3, 9) + + parser = argparse.ArgumentParser() + parser.add_argument( + "--action-level", + type=ActionLevel.from_cmd_arg, + default=ActionLevel.everything, + help="Limit actions performed to achieve dry runs for different levels of dryness", + ) + parser.add_argument( + "--action-count-limit", + type=int, + default=None, + help="Limit number of actions performed and the remainder are logged. Useful for testing", + ) + args = parser.parse_args() + + if args.action_level > ActionLevel.nothing: + subprocess.run(["git", "update-index", "--refresh"], capture_output=True) + diff_result = subprocess.run(["git", "diff-index", "HEAD", "--name-only"], text=True, capture_output=True) + if diff_result.returncode: + print("Unexpected exception!") + print(diff_result.stdout) + print(diff_result.stderr) + sys.exit(diff_result.returncode) + if diff_result.stdout: + changed_files = ", ".join(repr(line) for line in diff_result.stdout.split("\n") if line) + print(f"Cannot run stubsabot, as uncommitted changes are present in {changed_files}!") + sys.exit(1) + + if args.action_level > ActionLevel.fork: + if os.environ.get("GITHUB_TOKEN") is None: + raise ValueError("GITHUB_TOKEN environment variable must be set") + + denylist = {"gdb"} # gdb is not a pypi distribution + + original_branch = subprocess.run( + ["git", "branch", "--show-current"], text=True, capture_output=True, check=True + ).stdout.strip() + + if args.action_level >= ActionLevel.fork: + subprocess.check_call(["git", "fetch", "--prune", "--all"]) + + try: + conn = aiohttp.TCPConnector(limit_per_host=10) + async with aiohttp.ClientSession(connector=conn) as session: + tasks = [ + asyncio.create_task(determine_action(stubs_path, session)) + for stubs_path in Path("stubs").iterdir() + if stubs_path.name not in denylist + ] + + action_count = 0 + for task in asyncio.as_completed(tasks): + update = await task + print(update) + + if isinstance(update, NoUpdate): + continue + + if args.action_count_limit is not None and action_count >= args.action_count_limit: + print(colored("... but we've reached action count limit", "red")) + continue + action_count += 1 + + try: + if isinstance(update, Update): + await suggest_typeshed_update(update, session, action_level=args.action_level) + continue + if isinstance(update, Obsolete): + await suggest_typeshed_obsolete(update, session, action_level=args.action_level) + continue + except RemoteConflict as e: + print(colored(f"... but ran into {type(e).__qualname__}: {e}", "red")) + continue + raise AssertionError + finally: + # if you need to cleanup, try: + # git branch -D $(git branch --list 'stubsabot/*') + if args.action_level >= ActionLevel.local: + subprocess.check_call(["git", "checkout", original_branch]) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/scripts/update-stubtest-allowlist.py b/scripts/update-stubtest-allowlist.py deleted file mode 100755 index 0d9c44e..0000000 --- a/scripts/update-stubtest-allowlist.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 - -# This script removes lines from stubtest allowlists, according to -# an input file. The input file has one entry to remove per line. -# Each line consists of a allowlist filename and an entry, separated -# by a colon. - -# This script is used by the workflow to remove unused allowlist entries. - -import sys -from collections import defaultdict -from typing import Dict, List, Set, Tuple - - -def main() -> None: - if len(sys.argv) != 2: - print(f"Usage: {sys.argv[0]} FILENAME", file=sys.stderr) - sys.exit(1) - - to_remove = parse_input_file(sys.argv[1]) - for filename, entries in to_remove.items(): - remove_entries_from_allowlist(filename, entries) - - -def parse_input_file(input_file: str) -> Dict[str, Set[str]]: - to_remove = defaultdict(set) - with open(input_file) as f: - for filename, wl_entry in [parse_input_line(li) for li in f if li.strip()]: - to_remove[filename].add(wl_entry) - return to_remove - - -# Returns a (filename, entry) tuple. -def parse_input_line(line: str) -> Tuple[str, str]: - line = line.strip() - filename, entry = line.split(":", maxsplit=1) - return filename, entry - - -def remove_entries_from_allowlist(filename: str, entries: Set[str]) -> None: - new_lines: List[str] = [] - with open(filename) as f: - for line in f: - entry = line.split("#")[0].strip() - if entry in entries: - entries.remove(entry) - else: - new_lines.append(line) - if entries: - print(f"WARNING: The following entries were not found in '{filename}':", file=sys.stderr) - for entry in entries: - print(f" * {entry}") - with open(filename, "w") as f: - for line in new_lines: - f.write(line) - - -if __name__ == "__main__": - main() diff --git a/stdlib/@python2/BaseHTTPServer.pyi b/stdlib/@python2/BaseHTTPServer.pyi deleted file mode 100644 index 46946aa..0000000 --- a/stdlib/@python2/BaseHTTPServer.pyi +++ /dev/null @@ -1,41 +0,0 @@ -import mimetools -import SocketServer -from typing import Any, BinaryIO, Callable, Mapping, Tuple - -class HTTPServer(SocketServer.TCPServer): - server_name: str - server_port: int - def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ... - -class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): - client_address: Tuple[str, int] - server: SocketServer.BaseServer - close_connection: bool - command: str - path: str - request_version: str - headers: mimetools.Message - rfile: BinaryIO - wfile: BinaryIO - server_version: str - sys_version: str - error_message_format: str - error_content_type: str - protocol_version: str - MessageClass: type - responses: Mapping[int, Tuple[str, str]] - def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ... - def handle(self) -> None: ... - def handle_one_request(self) -> None: ... - def send_error(self, code: int, message: str | None = ...) -> None: ... - def send_response(self, code: int, message: str | None = ...) -> None: ... - def send_header(self, keyword: str, value: str) -> None: ... - def end_headers(self) -> None: ... - def flush_headers(self) -> None: ... - def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ... - def log_error(self, format: str, *args: Any) -> None: ... - def log_message(self, format: str, *args: Any) -> None: ... - def version_string(self) -> str: ... - def date_time_string(self, timestamp: int | None = ...) -> str: ... - def log_date_time_string(self) -> str: ... - def address_string(self) -> str: ... diff --git a/stdlib/@python2/CGIHTTPServer.pyi b/stdlib/@python2/CGIHTTPServer.pyi deleted file mode 100644 index 393dcb8..0000000 --- a/stdlib/@python2/CGIHTTPServer.pyi +++ /dev/null @@ -1,6 +0,0 @@ -import SimpleHTTPServer -from typing import List - -class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): - cgi_directories: List[str] - def do_POST(self) -> None: ... diff --git a/stdlib/@python2/ConfigParser.pyi b/stdlib/@python2/ConfigParser.pyi deleted file mode 100644 index 89167b3..0000000 --- a/stdlib/@python2/ConfigParser.pyi +++ /dev/null @@ -1,97 +0,0 @@ -from _typeshed import SupportsNoArgReadline -from typing import IO, Any, Dict, List, Sequence, Tuple - -DEFAULTSECT: str -MAX_INTERPOLATION_DEPTH: int - -class Error(Exception): - message: Any - def __init__(self, msg: str = ...) -> None: ... - def _get_message(self) -> None: ... - def _set_message(self, value: str) -> None: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... - -class NoSectionError(Error): - section: str - def __init__(self, section: str) -> None: ... - -class DuplicateSectionError(Error): - section: str - def __init__(self, section: str) -> None: ... - -class NoOptionError(Error): - section: str - option: str - def __init__(self, option: str, section: str) -> None: ... - -class InterpolationError(Error): - section: str - option: str - msg: str - def __init__(self, option: str, section: str, msg: str) -> None: ... - -class InterpolationMissingOptionError(InterpolationError): - reference: str - def __init__(self, option: str, section: str, rawval: str, reference: str) -> None: ... - -class InterpolationSyntaxError(InterpolationError): ... - -class InterpolationDepthError(InterpolationError): - def __init__(self, option: str, section: str, rawval: str) -> None: ... - -class ParsingError(Error): - filename: str - errors: List[Tuple[Any, Any]] - def __init__(self, filename: str) -> None: ... - def append(self, lineno: Any, line: Any) -> None: ... - -class MissingSectionHeaderError(ParsingError): - lineno: Any - line: Any - def __init__(self, filename: str, lineno: Any, line: Any) -> None: ... - -class RawConfigParser: - _dict: Any - _sections: Dict[Any, Any] - _defaults: Dict[Any, Any] - _optcre: Any - SECTCRE: Any - OPTCRE: Any - OPTCRE_NV: Any - def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ... - def defaults(self) -> Dict[Any, Any]: ... - def sections(self) -> List[str]: ... - def add_section(self, section: str) -> None: ... - def has_section(self, section: str) -> bool: ... - def options(self, section: str) -> List[str]: ... - def read(self, filenames: str | Sequence[str]) -> List[str]: ... - def readfp(self, fp: SupportsNoArgReadline[str], filename: str = ...) -> None: ... - def get(self, section: str, option: str) -> str: ... - def items(self, section: str) -> List[Tuple[Any, Any]]: ... - def _get(self, section: str, conv: type, option: str) -> Any: ... - def getint(self, section: str, option: str) -> int: ... - def getfloat(self, section: str, option: str) -> float: ... - _boolean_states: Dict[str, bool] - def getboolean(self, section: str, option: str) -> bool: ... - def optionxform(self, optionstr: str) -> str: ... - def has_option(self, section: str, option: str) -> bool: ... - def set(self, section: str, option: str, value: Any = ...) -> None: ... - def write(self, fp: IO[str]) -> None: ... - def remove_option(self, section: str, option: Any) -> bool: ... - def remove_section(self, section: str) -> bool: ... - def _read(self, fp: IO[str], fpname: str) -> None: ... - -class ConfigParser(RawConfigParser): - _KEYCRE: Any - def get(self, section: str, option: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> Any: ... - def items(self, section: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> List[Tuple[str, Any]]: ... - def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ... - def _interpolation_replace(self, match: Any) -> str: ... - -class SafeConfigParser(ConfigParser): - _interpvar_re: Any - def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ... - def _interpolate_some( - self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int - ) -> None: ... diff --git a/stdlib/@python2/Cookie.pyi b/stdlib/@python2/Cookie.pyi deleted file mode 100644 index 3d01c3c..0000000 --- a/stdlib/@python2/Cookie.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from typing import Any, Dict - -class CookieError(Exception): ... - -class Morsel(Dict[Any, Any]): - key: Any - def __init__(self): ... - def __setitem__(self, K, V): ... - def isReservedKey(self, K): ... - value: Any - coded_value: Any - def set(self, key, val, coded_val, LegalChars=..., idmap=..., translate=...): ... - def output(self, attrs: Any | None = ..., header=...): ... - def js_output(self, attrs: Any | None = ...): ... - def OutputString(self, attrs: Any | None = ...): ... - -class BaseCookie(Dict[Any, Any]): - def value_decode(self, val): ... - def value_encode(self, val): ... - def __init__(self, input: Any | None = ...): ... - def __setitem__(self, key, value): ... - def output(self, attrs: Any | None = ..., header=..., sep=...): ... - def js_output(self, attrs: Any | None = ...): ... - def load(self, rawdata): ... - -class SimpleCookie(BaseCookie): - def value_decode(self, val): ... - def value_encode(self, val): ... - -class SerialCookie(BaseCookie): - def __init__(self, input: Any | None = ...): ... - def value_decode(self, val): ... - def value_encode(self, val): ... - -class SmartCookie(BaseCookie): - def __init__(self, input: Any | None = ...): ... - def value_decode(self, val): ... - def value_encode(self, val): ... - -Cookie: Any diff --git a/stdlib/@python2/HTMLParser.pyi b/stdlib/@python2/HTMLParser.pyi deleted file mode 100644 index ebc2735..0000000 --- a/stdlib/@python2/HTMLParser.pyi +++ /dev/null @@ -1,28 +0,0 @@ -from typing import AnyStr, List, Tuple - -from markupbase import ParserBase - -class HTMLParser(ParserBase): - def __init__(self) -> None: ... - def feed(self, feed: AnyStr) -> None: ... - def close(self) -> None: ... - def reset(self) -> None: ... - def get_starttag_text(self) -> AnyStr: ... - def set_cdata_mode(self, AnyStr) -> None: ... - def clear_cdata_mode(self) -> None: ... - def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... - def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... - def handle_endtag(self, tag: AnyStr): ... - def handle_charref(self, name: AnyStr): ... - def handle_entityref(self, name: AnyStr): ... - def handle_data(self, data: AnyStr): ... - def handle_comment(self, data: AnyStr): ... - def handle_decl(self, decl: AnyStr): ... - def handle_pi(self, data: AnyStr): ... - def unknown_decl(self, data: AnyStr): ... - def unescape(self, s: AnyStr) -> AnyStr: ... - -class HTMLParseError(Exception): - msg: str - lineno: int - offset: int diff --git a/stdlib/@python2/Queue.pyi b/stdlib/@python2/Queue.pyi deleted file mode 100644 index 24743a8..0000000 --- a/stdlib/@python2/Queue.pyi +++ /dev/null @@ -1,28 +0,0 @@ -from typing import Any, Deque, Generic, TypeVar - -_T = TypeVar("_T") - -class Empty(Exception): ... -class Full(Exception): ... - -class Queue(Generic[_T]): - maxsize: Any - mutex: Any - not_empty: Any - not_full: Any - all_tasks_done: Any - unfinished_tasks: Any - queue: Deque[Any] # undocumented - def __init__(self, maxsize: int = ...) -> None: ... - def task_done(self) -> None: ... - def join(self) -> None: ... - def qsize(self) -> int: ... - def empty(self) -> bool: ... - def full(self) -> bool: ... - def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ... - def put_nowait(self, item: _T) -> None: ... - def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... - def get_nowait(self) -> _T: ... - -class PriorityQueue(Queue[_T]): ... -class LifoQueue(Queue[_T]): ... diff --git a/stdlib/@python2/SimpleHTTPServer.pyi b/stdlib/@python2/SimpleHTTPServer.pyi deleted file mode 100644 index 758d5bd..0000000 --- a/stdlib/@python2/SimpleHTTPServer.pyi +++ /dev/null @@ -1,14 +0,0 @@ -import BaseHTTPServer -from StringIO import StringIO -from typing import IO, Any, AnyStr, Mapping - -class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): - server_version: str - def do_GET(self) -> None: ... - def do_HEAD(self) -> None: ... - def send_head(self) -> IO[str] | None: ... - def list_directory(self, path: str | unicode) -> StringIO[Any] | None: ... - def translate_path(self, path: AnyStr) -> AnyStr: ... - def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ... - def guess_type(self, path: str | unicode) -> str: ... - extensions_map: Mapping[str, str] diff --git a/stdlib/@python2/SocketServer.pyi b/stdlib/@python2/SocketServer.pyi deleted file mode 100644 index e5a19ff..0000000 --- a/stdlib/@python2/SocketServer.pyi +++ /dev/null @@ -1,114 +0,0 @@ -import sys -from socket import SocketType -from typing import Any, BinaryIO, Callable, ClassVar, List, Text, Tuple, Union - -class BaseServer: - address_family: int - RequestHandlerClass: Callable[..., BaseRequestHandler] - server_address: Tuple[str, int] - socket: SocketType - allow_reuse_address: bool - request_queue_size: int - socket_type: int - timeout: float | None - def __init__(self, server_address: Any, RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ... - def fileno(self) -> int: ... - def handle_request(self) -> None: ... - def serve_forever(self, poll_interval: float = ...) -> None: ... - def shutdown(self) -> None: ... - def server_close(self) -> None: ... - def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - def get_request(self) -> Tuple[SocketType, Tuple[str, int]]: ... - def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - def handle_timeout(self) -> None: ... - def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - def server_activate(self) -> None: ... - def server_bind(self) -> None: ... - def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ... - -class TCPServer(BaseServer): - def __init__( - self, - server_address: Tuple[str, int], - RequestHandlerClass: Callable[..., BaseRequestHandler], - bind_and_activate: bool = ..., - ) -> None: ... - -class UDPServer(BaseServer): - def __init__( - self, - server_address: Tuple[str, int], - RequestHandlerClass: Callable[..., BaseRequestHandler], - bind_and_activate: bool = ..., - ) -> None: ... - -if sys.platform != "win32": - class UnixStreamServer(BaseServer): - def __init__( - self, - server_address: Text | bytes, - RequestHandlerClass: Callable[..., BaseRequestHandler], - bind_and_activate: bool = ..., - ) -> None: ... - class UnixDatagramServer(BaseServer): - def __init__( - self, - server_address: Text | bytes, - RequestHandlerClass: Callable[..., BaseRequestHandler], - bind_and_activate: bool = ..., - ) -> None: ... - -if sys.platform != "win32": - class ForkingMixIn: - timeout: float | None # undocumented - active_children: List[int] | None # undocumented - max_children: int # undocumented - def collect_children(self) -> None: ... # undocumented - def handle_timeout(self) -> None: ... # undocumented - def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - -class ThreadingMixIn: - daemon_threads: bool - def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented - def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... - -if sys.platform != "win32": - class ForkingTCPServer(ForkingMixIn, TCPServer): ... - class ForkingUDPServer(ForkingMixIn, UDPServer): ... - -class ThreadingTCPServer(ThreadingMixIn, TCPServer): ... -class ThreadingUDPServer(ThreadingMixIn, UDPServer): ... - -if sys.platform != "win32": - class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): ... - class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): ... - -class BaseRequestHandler: - # Those are technically of types, respectively: - # * Union[SocketType, Tuple[bytes, SocketType]] - # * Union[Tuple[str, int], str] - # But there are some concerns that having unions here would cause - # too much inconvenience to people using it (see - # https://github.com/python/typeshed/pull/384#issuecomment-234649696) - request: Any - client_address: Any - server: BaseServer - def __init__(self, request: Any, client_address: Any, server: BaseServer) -> None: ... - def setup(self) -> None: ... - def handle(self) -> None: ... - def finish(self) -> None: ... - -class StreamRequestHandler(BaseRequestHandler): - rbufsize: ClassVar[int] # undocumented - wbufsize: ClassVar[int] # undocumented - timeout: ClassVar[float | None] # undocumented - disable_nagle_algorithm: ClassVar[bool] # undocumented - connection: SocketType # undocumented - rfile: BinaryIO - wfile: BinaryIO - -class DatagramRequestHandler(BaseRequestHandler): - packet: SocketType # undocumented - socket: SocketType # undocumented - rfile: BinaryIO - wfile: BinaryIO diff --git a/stdlib/@python2/StringIO.pyi b/stdlib/@python2/StringIO.pyi deleted file mode 100644 index efa90f8..0000000 --- a/stdlib/@python2/StringIO.pyi +++ /dev/null @@ -1,28 +0,0 @@ -from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List - -class StringIO(IO[AnyStr], Generic[AnyStr]): - closed: bool - softspace: int - len: int - name: str - def __init__(self, buf: AnyStr = ...) -> None: ... - def __iter__(self) -> Iterator[AnyStr]: ... - def next(self) -> AnyStr: ... - def close(self) -> None: ... - def isatty(self) -> bool: ... - def seek(self, pos: int, mode: int = ...) -> int: ... - def tell(self) -> int: ... - def read(self, n: int = ...) -> AnyStr: ... - def readline(self, length: int = ...) -> AnyStr: ... - def readlines(self, sizehint: int = ...) -> List[AnyStr]: ... - def truncate(self, size: int | None = ...) -> int: ... - def write(self, s: AnyStr) -> int: ... - def writelines(self, iterable: Iterable[AnyStr]) -> None: ... - def flush(self) -> None: ... - def getvalue(self) -> AnyStr: ... - def __enter__(self) -> Any: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> Any: ... - def fileno(self) -> int: ... - def readable(self) -> bool: ... - def seekable(self) -> bool: ... - def writable(self) -> bool: ... diff --git a/stdlib/@python2/UserDict.pyi b/stdlib/@python2/UserDict.pyi deleted file mode 100644 index dce7beb..0000000 --- a/stdlib/@python2/UserDict.pyi +++ /dev/null @@ -1,38 +0,0 @@ -from typing import Any, Container, Dict, Generic, Iterable, Iterator, List, Mapping, Sized, Tuple, TypeVar, overload - -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") -_T = TypeVar("_T") - -class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]): - data: Dict[_KT, _VT] - def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ... - # TODO: __iter__ is not available for UserDict - -class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]): ... - -class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]): - def has_key(self, key: _KT) -> bool: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[_KT]: ... - # From typing.Mapping[_KT, _VT] - # (can't inherit because of keys()) - @overload - def get(self, k: _KT) -> _VT | None: ... - @overload - def get(self, k: _KT, default: _VT | _T) -> _VT | _T: ... - def values(self) -> List[_VT]: ... - def items(self) -> List[Tuple[_KT, _VT]]: ... - def iterkeys(self) -> Iterator[_KT]: ... - def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... - def __contains__(self, o: Any) -> bool: ... - # From typing.MutableMapping[_KT, _VT] - def clear(self) -> None: ... - def pop(self, k: _KT, default: _VT = ...) -> _VT: ... - def popitem(self) -> Tuple[_KT, _VT]: ... - def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ... - @overload - def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... diff --git a/stdlib/@python2/UserList.pyi b/stdlib/@python2/UserList.pyi deleted file mode 100644 index be4ebce..0000000 --- a/stdlib/@python2/UserList.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import Iterable, List, MutableSequence, TypeVar, overload - -_T = TypeVar("_T") -_S = TypeVar("_S") - -class UserList(MutableSequence[_T]): - data: List[_T] - def insert(self, index: int, object: _T) -> None: ... - @overload - def __setitem__(self, i: int, o: _T) -> None: ... - @overload - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __len__(self) -> int: ... - @overload - def __getitem__(self, i: int) -> _T: ... - @overload - def __getitem__(self: _S, s: slice) -> _S: ... - def sort(self) -> None: ... diff --git a/stdlib/@python2/UserString.pyi b/stdlib/@python2/UserString.pyi deleted file mode 100644 index f60dbe1..0000000 --- a/stdlib/@python2/UserString.pyi +++ /dev/null @@ -1,74 +0,0 @@ -from typing import Any, Iterable, List, MutableSequence, Sequence, Text, Tuple, TypeVar, overload - -_UST = TypeVar("_UST", bound=UserString) -_MST = TypeVar("_MST", bound=MutableString) - -class UserString(Sequence[UserString]): - data: unicode - def __init__(self, seq: object) -> None: ... - def __int__(self) -> int: ... - def __long__(self) -> long: ... - def __float__(self) -> float: ... - def __complex__(self) -> complex: ... - def __hash__(self) -> int: ... - def __len__(self) -> int: ... - @overload - def __getitem__(self: _UST, i: int) -> _UST: ... - @overload - def __getitem__(self: _UST, s: slice) -> _UST: ... - def __add__(self: _UST, other: Any) -> _UST: ... - def __radd__(self: _UST, other: Any) -> _UST: ... - def __mul__(self: _UST, other: int) -> _UST: ... - def __rmul__(self: _UST, other: int) -> _UST: ... - def __mod__(self: _UST, args: Any) -> _UST: ... - def capitalize(self: _UST) -> _UST: ... - def center(self: _UST, width: int, *args: Any) -> _UST: ... - def count(self, sub: int, start: int = ..., end: int = ...) -> int: ... - def decode(self: _UST, encoding: str | None = ..., errors: str | None = ...) -> _UST: ... - def encode(self: _UST, encoding: str | None = ..., errors: str | None = ...) -> _UST: ... - def endswith(self, suffix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ... - def expandtabs(self: _UST, tabsize: int = ...) -> _UST: ... - def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ... - def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ... - def isalpha(self) -> bool: ... - def isalnum(self) -> bool: ... - def isdecimal(self) -> bool: ... - def isdigit(self) -> bool: ... - def islower(self) -> bool: ... - def isnumeric(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, seq: Iterable[Text]) -> Text: ... - def ljust(self: _UST, width: int, *args: Any) -> _UST: ... - def lower(self: _UST) -> _UST: ... - def lstrip(self: _UST, chars: Text | None = ...) -> _UST: ... - def partition(self, sep: Text) -> Tuple[Text, Text, Text]: ... - def replace(self: _UST, old: Text, new: Text, maxsplit: int = ...) -> _UST: ... - def rfind(self, sub: Text, start: int = ..., end: int = ...) -> int: ... - def rindex(self, sub: Text, start: int = ..., end: int = ...) -> int: ... - def rjust(self: _UST, width: int, *args: Any) -> _UST: ... - def rpartition(self, sep: Text) -> Tuple[Text, Text, Text]: ... - def rstrip(self: _UST, chars: Text | None = ...) -> _UST: ... - def split(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ... - def rsplit(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ... - def splitlines(self, keepends: int = ...) -> List[Text]: ... - def startswith(self, prefix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ... - def strip(self: _UST, chars: Text | None = ...) -> _UST: ... - def swapcase(self: _UST) -> _UST: ... - def title(self: _UST) -> _UST: ... - def translate(self: _UST, *args: Any) -> _UST: ... - def upper(self: _UST) -> _UST: ... - def zfill(self: _UST, width: int) -> _UST: ... - -class MutableString(UserString, MutableSequence[MutableString]): - @overload - def __getitem__(self: _MST, i: int) -> _MST: ... - @overload - def __getitem__(self: _MST, s: slice) -> _MST: ... - def __setitem__(self, index: int | slice, sub: Any) -> None: ... - def __delitem__(self, index: int | slice) -> None: ... - def immutable(self) -> UserString: ... - def __iadd__(self: _MST, other: Any) -> _MST: ... - def __imul__(self, n: int) -> _MST: ... - def insert(self, index: int, value: Any) -> None: ... diff --git a/stdlib/@python2/__builtin__.pyi b/stdlib/@python2/__builtin__.pyi deleted file mode 100644 index ebe9cdd..0000000 --- a/stdlib/@python2/__builtin__.pyi +++ /dev/null @@ -1,1182 +0,0 @@ -# True and False are deliberately omitted because they are keywords in -# Python 3, and stub files conform to Python 3 syntax. - -from _typeshed import ReadableBuffer, SupportsKeysAndGetItem, SupportsWrite -from abc import ABCMeta -from ast import mod -from types import CodeType -from typing import ( - AbstractSet, - Any, - AnyStr, - BinaryIO, - ByteString, - Callable, - Container, - Dict, - FrozenSet, - Generic, - ItemsView, - Iterable, - Iterator, - KeysView, - List, - Mapping, - MutableMapping, - MutableSequence, - MutableSet, - NoReturn, - Protocol, - Reversible, - Sequence, - Set, - Sized, - SupportsAbs, - SupportsComplex, - SupportsFloat, - SupportsInt, - Text, - Tuple, - Type, - TypeVar, - ValuesView, - overload, -) -from typing_extensions import Literal, final - -class _SupportsIndex(Protocol): - def __index__(self) -> int: ... - -class _SupportsTrunc(Protocol): - def __trunc__(self) -> int: ... - -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") -_S = TypeVar("_S") -_T1 = TypeVar("_T1") -_T2 = TypeVar("_T2") -_T3 = TypeVar("_T3") -_T4 = TypeVar("_T4") -_T5 = TypeVar("_T5") -_TT = TypeVar("_TT", bound="type") -_TBE = TypeVar("_TBE", bound="BaseException") - -class object: - __doc__: str | None - __dict__: Dict[str, Any] - __slots__: Text | Iterable[Text] - __module__: str - @property - def __class__(self: _T) -> Type[_T]: ... - @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... # noqa: F811 - def __init__(self) -> None: ... - def __new__(cls) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __eq__(self, o: object) -> bool: ... - def __ne__(self, o: object) -> bool: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - def __format__(self, format_spec: str) -> str: ... - def __getattribute__(self, name: str) -> Any: ... - def __delattr__(self, name: str) -> None: ... - def __sizeof__(self) -> int: ... - def __reduce__(self) -> str | Tuple[Any, ...]: ... - def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ... - -class staticmethod(object): # Special, only valid as a decorator. - __func__: Callable[..., Any] - def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... - -class classmethod(object): # Special, only valid as a decorator. - __func__: Callable[..., Any] - def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... - -class type(object): - __base__: type - __bases__: Tuple[type, ...] - __basicsize__: int - __dict__: Dict[str, Any] - __dictoffset__: int - __flags__: int - __itemsize__: int - __module__: str - __mro__: Tuple[type, ...] - __name__: str - __weakrefoffset__: int - @overload - def __init__(self, o: object) -> None: ... - @overload - def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ... - @overload - def __new__(cls, o: object) -> type: ... - @overload - def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ... - def __call__(self, *args: Any, **kwds: Any) -> Any: ... - def __subclasses__(self: _TT) -> List[_TT]: ... - # Note: the documentation doesnt specify what the return type is, the standard - # implementation seems to be returning a list. - def mro(self) -> List[type]: ... - def __instancecheck__(self, instance: Any) -> bool: ... - def __subclasscheck__(self, subclass: type) -> bool: ... - -class super(object): - @overload - def __init__(self, t: Any, obj: Any) -> None: ... - @overload - def __init__(self, t: Any) -> None: ... - -class int: - @overload - def __new__(cls: Type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ... - @overload - def __new__(cls: Type[_T], x: Text | bytes | bytearray, base: int) -> _T: ... - @property - def real(self) -> int: ... - @property - def imag(self) -> int: ... - @property - def numerator(self) -> int: ... - @property - def denominator(self) -> int: ... - def conjugate(self) -> int: ... - def bit_length(self) -> int: ... - def __add__(self, x: int) -> int: ... - def __sub__(self, x: int) -> int: ... - def __mul__(self, x: int) -> int: ... - def __floordiv__(self, x: int) -> int: ... - def __div__(self, x: int) -> int: ... - def __truediv__(self, x: int) -> float: ... - def __mod__(self, x: int) -> int: ... - def __divmod__(self, x: int) -> Tuple[int, int]: ... - def __radd__(self, x: int) -> int: ... - def __rsub__(self, x: int) -> int: ... - def __rmul__(self, x: int) -> int: ... - def __rfloordiv__(self, x: int) -> int: ... - def __rdiv__(self, x: int) -> int: ... - def __rtruediv__(self, x: int) -> float: ... - def __rmod__(self, x: int) -> int: ... - def __rdivmod__(self, x: int) -> Tuple[int, int]: ... - @overload - def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ... - @overload - def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x. - def __rpow__(self, x: int, mod: int | None = ...) -> Any: ... - def __and__(self, n: int) -> int: ... - def __or__(self, n: int) -> int: ... - def __xor__(self, n: int) -> int: ... - def __lshift__(self, n: int) -> int: ... - def __rshift__(self, n: int) -> int: ... - def __rand__(self, n: int) -> int: ... - def __ror__(self, n: int) -> int: ... - def __rxor__(self, n: int) -> int: ... - def __rlshift__(self, n: int) -> int: ... - def __rrshift__(self, n: int) -> int: ... - def __neg__(self) -> int: ... - def __pos__(self) -> int: ... - def __invert__(self) -> int: ... - def __trunc__(self) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: int) -> bool: ... - def __le__(self, x: int) -> bool: ... - def __gt__(self, x: int) -> bool: ... - def __ge__(self, x: int) -> bool: ... - def __str__(self) -> str: ... - def __float__(self) -> float: ... - def __int__(self) -> int: ... - def __abs__(self) -> int: ... - def __hash__(self) -> int: ... - def __nonzero__(self) -> bool: ... - def __index__(self) -> int: ... - -class float: - def __new__(cls: Type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ... - def as_integer_ratio(self) -> Tuple[int, int]: ... - def hex(self) -> str: ... - def is_integer(self) -> bool: ... - @classmethod - def fromhex(cls, __s: str) -> float: ... - @property - def real(self) -> float: ... - @property - def imag(self) -> float: ... - def conjugate(self) -> float: ... - def __add__(self, x: float) -> float: ... - def __sub__(self, x: float) -> float: ... - def __mul__(self, x: float) -> float: ... - def __floordiv__(self, x: float) -> float: ... - def __div__(self, x: float) -> float: ... - def __truediv__(self, x: float) -> float: ... - def __mod__(self, x: float) -> float: ... - def __divmod__(self, x: float) -> Tuple[float, float]: ... - def __pow__( - self, x: float, mod: None = ... - ) -> float: ... # In Python 3, returns complex if self is negative and x is not whole - def __radd__(self, x: float) -> float: ... - def __rsub__(self, x: float) -> float: ... - def __rmul__(self, x: float) -> float: ... - def __rfloordiv__(self, x: float) -> float: ... - def __rdiv__(self, x: float) -> float: ... - def __rtruediv__(self, x: float) -> float: ... - def __rmod__(self, x: float) -> float: ... - def __rdivmod__(self, x: float) -> Tuple[float, float]: ... - def __rpow__(self, x: float, mod: None = ...) -> float: ... - def __getnewargs__(self) -> Tuple[float]: ... - def __trunc__(self) -> int: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: float) -> bool: ... - def __le__(self, x: float) -> bool: ... - def __gt__(self, x: float) -> bool: ... - def __ge__(self, x: float) -> bool: ... - def __neg__(self) -> float: ... - def __pos__(self) -> float: ... - def __str__(self) -> str: ... - def __int__(self) -> int: ... - def __float__(self) -> float: ... - def __abs__(self) -> float: ... - def __hash__(self) -> int: ... - def __nonzero__(self) -> bool: ... - -class complex: - @overload - def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ... - @overload - def __new__(cls: Type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ... - @property - def real(self) -> float: ... - @property - def imag(self) -> float: ... - def conjugate(self) -> complex: ... - def __add__(self, x: complex) -> complex: ... - def __sub__(self, x: complex) -> complex: ... - def __mul__(self, x: complex) -> complex: ... - def __pow__(self, x: complex, mod: None = ...) -> complex: ... - def __div__(self, x: complex) -> complex: ... - def __truediv__(self, x: complex) -> complex: ... - def __radd__(self, x: complex) -> complex: ... - def __rsub__(self, x: complex) -> complex: ... - def __rmul__(self, x: complex) -> complex: ... - def __rpow__(self, x: complex, mod: None = ...) -> complex: ... - def __rdiv__(self, x: complex) -> complex: ... - def __rtruediv__(self, x: complex) -> complex: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __neg__(self) -> complex: ... - def __pos__(self) -> complex: ... - def __str__(self) -> str: ... - def __complex__(self) -> complex: ... - def __abs__(self) -> float: ... - def __hash__(self) -> int: ... - def __nonzero__(self) -> bool: ... - -class basestring(metaclass=ABCMeta): ... - -class unicode(basestring, Sequence[unicode]): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, o: object) -> None: ... - @overload - def __init__(self, o: str, encoding: unicode = ..., errors: unicode = ...) -> None: ... - def capitalize(self) -> unicode: ... - def center(self, width: int, fillchar: unicode = ...) -> unicode: ... - def count(self, x: unicode) -> int: ... - def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... - def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, __suffix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def expandtabs(self, tabsize: int = ...) -> unicode: ... - def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def format(self, *args: object, **kwargs: object) -> unicode: ... - def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def isalnum(self) -> bool: ... - def isalpha(self) -> bool: ... - def isdecimal(self) -> bool: ... - def isdigit(self) -> bool: ... - def isidentifier(self) -> bool: ... - def islower(self) -> bool: ... - def isnumeric(self) -> bool: ... - def isprintable(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, iterable: Iterable[unicode]) -> unicode: ... - def ljust(self, width: int, fillchar: unicode = ...) -> unicode: ... - def lower(self) -> unicode: ... - def lstrip(self, chars: unicode = ...) -> unicode: ... - def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def replace(self, old: unicode, new: unicode, count: int = ...) -> unicode: ... - def rfind(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ... - def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... - def rstrip(self, chars: unicode = ...) -> unicode: ... - def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, __prefix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def strip(self, chars: unicode = ...) -> unicode: ... - def swapcase(self) -> unicode: ... - def title(self) -> unicode: ... - def translate(self, table: Dict[int, Any] | unicode) -> unicode: ... - def upper(self) -> unicode: ... - def zfill(self, width: int) -> unicode: ... - @overload - def __getitem__(self, i: int) -> unicode: ... - @overload - def __getitem__(self, s: slice) -> unicode: ... - def __getslice__(self, start: int, stop: int) -> unicode: ... - def __add__(self, s: unicode) -> unicode: ... - def __mul__(self, n: int) -> unicode: ... - def __rmul__(self, n: int) -> unicode: ... - def __mod__(self, x: Any) -> unicode: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: unicode) -> bool: ... - def __le__(self, x: unicode) -> bool: ... - def __gt__(self, x: unicode) -> bool: ... - def __ge__(self, x: unicode) -> bool: ... - def __len__(self) -> int: ... - # The argument type is incompatible with Sequence - def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore - def __iter__(self) -> Iterator[unicode]: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __int__(self) -> int: ... - def __float__(self) -> float: ... - def __hash__(self) -> int: ... - def __getnewargs__(self) -> Tuple[unicode]: ... - -class _FormatMapMapping(Protocol): - def __getitem__(self, __key: str) -> Any: ... - -class str(Sequence[str], basestring): - def __init__(self, o: object = ...) -> None: ... - def capitalize(self) -> str: ... - def center(self, __width: int, __fillchar: str = ...) -> str: ... - def count(self, x: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... - def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... - def endswith(self, __suffix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def expandtabs(self, tabsize: int = ...) -> str: ... - def find(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def format(self, *args: object, **kwargs: object) -> str: ... - def format_map(self, map: _FormatMapMapping) -> str: ... - def index(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def isalnum(self) -> bool: ... - def isalpha(self) -> bool: ... - def isdigit(self) -> bool: ... - def islower(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, __iterable: Iterable[AnyStr]) -> AnyStr: ... - def ljust(self, __width: int, __fillchar: str = ...) -> str: ... - def lower(self) -> str: ... - @overload - def lstrip(self, __chars: str = ...) -> str: ... - @overload - def lstrip(self, __chars: unicode) -> unicode: ... - @overload - def partition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... - @overload - def partition(self, __sep: str) -> Tuple[str, str, str]: ... - @overload - def partition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def replace(self, __old: AnyStr, __new: AnyStr, __count: int = ...) -> AnyStr: ... - def rfind(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def rindex(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def rjust(self, __width: int, __fillchar: str = ...) -> str: ... - @overload - def rpartition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... - @overload - def rpartition(self, __sep: str) -> Tuple[str, str, str]: ... - @overload - def rpartition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - @overload - def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... - @overload - def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... - @overload - def rstrip(self, __chars: str = ...) -> str: ... - @overload - def rstrip(self, __chars: unicode) -> unicode: ... - @overload - def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... - @overload - def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, __prefix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - @overload - def strip(self, __chars: str = ...) -> str: ... - @overload - def strip(self, chars: unicode) -> unicode: ... - def swapcase(self) -> str: ... - def title(self) -> str: ... - def translate(self, __table: AnyStr | None, deletechars: AnyStr = ...) -> AnyStr: ... - def upper(self) -> str: ... - def zfill(self, __width: int) -> str: ... - def __add__(self, s: AnyStr) -> AnyStr: ... - # Incompatible with Sequence.__contains__ - def __contains__(self, o: str | Text) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ge__(self, x: Text) -> bool: ... - def __getitem__(self, i: int | slice) -> str: ... - def __gt__(self, x: Text) -> bool: ... - def __hash__(self) -> int: ... - def __iter__(self) -> Iterator[str]: ... - def __le__(self, x: Text) -> bool: ... - def __len__(self) -> int: ... - def __lt__(self, x: Text) -> bool: ... - def __mod__(self, x: Any) -> str: ... - def __mul__(self, n: int) -> str: ... - def __ne__(self, x: object) -> bool: ... - def __repr__(self) -> str: ... - def __rmul__(self, n: int) -> str: ... - def __str__(self) -> str: ... - def __getnewargs__(self) -> Tuple[str]: ... - def __getslice__(self, start: int, stop: int) -> str: ... - def __float__(self) -> float: ... - def __int__(self) -> int: ... - -bytes = str - -class bytearray(MutableSequence[int], ByteString): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, ints: Iterable[int]) -> None: ... - @overload - def __init__(self, string: str) -> None: ... - @overload - def __init__(self, string: Text, encoding: Text, errors: Text = ...) -> None: ... - @overload - def __init__(self, length: int) -> None: ... - def capitalize(self) -> bytearray: ... - def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... - def count(self, __sub: str) -> int: ... - def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ... - def endswith(self, __suffix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def expandtabs(self, tabsize: int = ...) -> bytearray: ... - def extend(self, iterable: str | Iterable[int]) -> None: ... - def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... - def index(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... - def insert(self, __index: int, __item: int) -> None: ... - def isalnum(self) -> bool: ... - def isalpha(self) -> bool: ... - def isdigit(self) -> bool: ... - def islower(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, __iterable: Iterable[str]) -> bytearray: ... - def ljust(self, __width: int, __fillchar: str = ...) -> bytearray: ... - def lower(self) -> bytearray: ... - def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ... - def rfind(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... - def rindex(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... - def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... - def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... - def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... - def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... - def startswith(self, __prefix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def strip(self, __bytes: bytes | None = ...) -> bytearray: ... - def swapcase(self) -> bytearray: ... - def title(self) -> bytearray: ... - def translate(self, __table: str) -> bytearray: ... - def upper(self) -> bytearray: ... - def zfill(self, __width: int) -> bytearray: ... - @classmethod - def fromhex(cls, __string: str) -> bytearray: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[int]: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __int__(self) -> int: ... - def __float__(self) -> float: ... - __hash__: None # type: ignore - @overload - def __getitem__(self, i: int) -> int: ... - @overload - def __getitem__(self, s: slice) -> bytearray: ... - @overload - def __setitem__(self, i: int, x: int) -> None: ... - @overload - def __setitem__(self, s: slice, x: Iterable[int] | bytes) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __getslice__(self, start: int, stop: int) -> bytearray: ... - def __setslice__(self, start: int, stop: int, x: Sequence[int] | str) -> None: ... - def __delslice__(self, start: int, stop: int) -> None: ... - def __add__(self, s: bytes) -> bytearray: ... - def __mul__(self, n: int) -> bytearray: ... - # Incompatible with Sequence.__contains__ - def __contains__(self, o: int | bytes) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: bytes) -> bool: ... - def __le__(self, x: bytes) -> bool: ... - def __gt__(self, x: bytes) -> bool: ... - def __ge__(self, x: bytes) -> bool: ... - -class memoryview(Sized, Container[str]): - format: str - itemsize: int - shape: Tuple[int, ...] | None - strides: Tuple[int, ...] | None - suboffsets: Tuple[int, ...] | None - readonly: bool - ndim: int - def __init__(self, obj: ReadableBuffer) -> None: ... - @overload - def __getitem__(self, i: int) -> str: ... - @overload - def __getitem__(self, s: slice) -> memoryview: ... - def __contains__(self, x: object) -> bool: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - @overload - def __setitem__(self, s: slice, o: bytes) -> None: ... - @overload - def __setitem__(self, i: int, o: int) -> None: ... - def tobytes(self) -> bytes: ... - def tolist(self) -> List[int]: ... - -@final -class bool(int): - def __new__(cls: Type[_T], __o: object = ...) -> _T: ... - @overload - def __and__(self, x: bool) -> bool: ... - @overload - def __and__(self, x: int) -> int: ... - @overload - def __or__(self, x: bool) -> bool: ... - @overload - def __or__(self, x: int) -> int: ... - @overload - def __xor__(self, x: bool) -> bool: ... - @overload - def __xor__(self, x: int) -> int: ... - @overload - def __rand__(self, x: bool) -> bool: ... - @overload - def __rand__(self, x: int) -> int: ... - @overload - def __ror__(self, x: bool) -> bool: ... - @overload - def __ror__(self, x: int) -> int: ... - @overload - def __rxor__(self, x: bool) -> bool: ... - @overload - def __rxor__(self, x: int) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... - -class slice(object): - start: Any - step: Any - stop: Any - @overload - def __init__(self, stop: Any) -> None: ... - @overload - def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ... - __hash__: None # type: ignore - def indices(self, len: int) -> Tuple[int, int, int]: ... - -class tuple(Sequence[_T_co], Generic[_T_co]): - def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... - def __len__(self) -> int: ... - def __contains__(self, x: object) -> bool: ... - @overload - def __getitem__(self, x: int) -> _T_co: ... - @overload - def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ... - def __iter__(self) -> Iterator[_T_co]: ... - def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __le__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ... - @overload - def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ... - @overload - def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ... - def __mul__(self, n: int) -> Tuple[_T_co, ...]: ... - def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ... - def count(self, __value: Any) -> int: ... - def index(self, __value: Any) -> int: ... - -class function: - # TODO not defined in builtins! - __name__: str - __module__: str - __code__: CodeType - -class list(MutableSequence[_T], Generic[_T]): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, iterable: Iterable[_T]) -> None: ... - def append(self, __object: _T) -> None: ... - def extend(self, __iterable: Iterable[_T]) -> None: ... - def pop(self, __index: int = ...) -> _T: ... - def index(self, __value: _T, __start: int = ..., __stop: int = ...) -> int: ... - def count(self, __value: _T) -> int: ... - def insert(self, __index: int, __object: _T) -> None: ... - def remove(self, __value: _T) -> None: ... - def reverse(self) -> None: ... - def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - __hash__: None # type: ignore - @overload - def __getitem__(self, i: int) -> _T: ... - @overload - def __getitem__(self, s: slice) -> List[_T]: ... - @overload - def __setitem__(self, i: int, o: _T) -> None: ... - @overload - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __getslice__(self, start: int, stop: int) -> List[_T]: ... - def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ... - def __delslice__(self, start: int, stop: int) -> None: ... - def __add__(self, x: List[_T]) -> List[_T]: ... - def __iadd__(self: _S, x: Iterable[_T]) -> _S: ... - def __mul__(self, n: int) -> List[_T]: ... - def __rmul__(self, n: int) -> List[_T]: ... - def __contains__(self, o: object) -> bool: ... - def __reversed__(self) -> Iterator[_T]: ... - def __gt__(self, x: List[_T]) -> bool: ... - def __ge__(self, x: List[_T]) -> bool: ... - def __lt__(self, x: List[_T]) -> bool: ... - def __le__(self, x: List[_T]) -> bool: ... - -class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): - # NOTE: Keyword arguments are special. If they are used, _KT must include - # str, but we have no way of enforcing it here. - @overload - def __init__(self, **kwargs: _VT) -> None: ... - @overload - def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... - def has_key(self, k: _KT) -> bool: ... - def clear(self) -> None: ... - def copy(self) -> Dict[_KT, _VT]: ... - def popitem(self) -> Tuple[_KT, _VT]: ... - def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ... - @overload - def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - @overload - def update(self, **kwargs: _VT) -> None: ... - def iterkeys(self) -> Iterator[_KT]: ... - def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... - def viewkeys(self) -> KeysView[_KT]: ... - def viewvalues(self) -> ValuesView[_VT]: ... - def viewitems(self) -> ItemsView[_KT, _VT]: ... - @classmethod - @overload - def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ... - @classmethod - @overload - def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... - def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __iter__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... - __hash__: None # type: ignore - -class set(MutableSet[_T], Generic[_T]): - def __init__(self, iterable: Iterable[_T] = ...) -> None: ... - def add(self, element: _T) -> None: ... - def clear(self) -> None: ... - def copy(self) -> Set[_T]: ... - def difference(self, *s: Iterable[Any]) -> Set[_T]: ... - def difference_update(self, *s: Iterable[Any]) -> None: ... - def discard(self, element: _T) -> None: ... - def intersection(self, *s: Iterable[Any]) -> Set[_T]: ... - def intersection_update(self, *s: Iterable[Any]) -> None: ... - def isdisjoint(self, s: Iterable[Any]) -> bool: ... - def issubset(self, s: Iterable[Any]) -> bool: ... - def issuperset(self, s: Iterable[Any]) -> bool: ... - def pop(self) -> _T: ... - def remove(self, element: _T) -> None: ... - def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ... - def symmetric_difference_update(self, s: Iterable[_T]) -> None: ... - def union(self, *s: Iterable[_T]) -> Set[_T]: ... - def update(self, *s: Iterable[_T]) -> None: ... - def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - @overload - def __sub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... - @overload - def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - @overload # type: ignore - def __isub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... - @overload - def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __le__(self, s: AbstractSet[object]) -> bool: ... - def __lt__(self, s: AbstractSet[object]) -> bool: ... - def __ge__(self, s: AbstractSet[object]) -> bool: ... - def __gt__(self, s: AbstractSet[object]) -> bool: ... - __hash__: None # type: ignore - -class frozenset(AbstractSet[_T_co], Generic[_T_co]): - def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ... - def copy(self) -> FrozenSet[_T_co]: ... - def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def isdisjoint(self, s: Iterable[_T_co]) -> bool: ... - def issubset(self, s: Iterable[object]) -> bool: ... - def issuperset(self, s: Iterable[object]) -> bool: ... - def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_T_co]: ... - def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __le__(self, s: AbstractSet[object]) -> bool: ... - def __lt__(self, s: AbstractSet[object]) -> bool: ... - def __ge__(self, s: AbstractSet[object]) -> bool: ... - def __gt__(self, s: AbstractSet[object]) -> bool: ... - -class enumerate(Iterator[Tuple[int, _T]], Generic[_T]): - def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ... - def __iter__(self) -> Iterator[Tuple[int, _T]]: ... - def next(self) -> Tuple[int, _T]: ... - -class xrange(Sized, Iterable[int], Reversible[int]): - @overload - def __init__(self, stop: int) -> None: ... - @overload - def __init__(self, start: int, stop: int, step: int = ...) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[int]: ... - def __getitem__(self, i: _SupportsIndex) -> int: ... - def __reversed__(self) -> Iterator[int]: ... - -class property(object): - def __init__( - self, - fget: Callable[[Any], Any] | None = ..., - fset: Callable[[Any, Any], None] | None = ..., - fdel: Callable[[Any], None] | None = ..., - doc: str | None = ..., - ) -> None: ... - def getter(self, fget: Callable[[Any], Any]) -> property: ... - def setter(self, fset: Callable[[Any, Any], None]) -> property: ... - def deleter(self, fdel: Callable[[Any], None]) -> property: ... - def __get__(self, obj: Any, type: type | None = ...) -> Any: ... - def __set__(self, obj: Any, value: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... - def fget(self) -> Any: ... - def fset(self, value: Any) -> None: ... - def fdel(self) -> None: ... - -long = int - -class _NotImplementedType(Any): # type: ignore - # A little weird, but typing the __call__ as NotImplemented makes the error message - # for NotImplemented() much better - __call__: NotImplemented # type: ignore - -NotImplemented: _NotImplementedType - -def abs(__x: SupportsAbs[_T]) -> _T: ... -def all(__iterable: Iterable[object]) -> bool: ... -def any(__iterable: Iterable[object]) -> bool: ... -def apply(__func: Callable[..., _T], __args: Sequence[Any] | None = ..., __kwds: Mapping[str, Any] | None = ...) -> _T: ... -def bin(__number: int | _SupportsIndex) -> str: ... -def callable(__obj: object) -> bool: ... -def chr(__i: int) -> str: ... -def cmp(__x: Any, __y: Any) -> int: ... - -_N1 = TypeVar("_N1", bool, int, float, complex) - -def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... -def compile(source: Text | mod, filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ... -def delattr(__obj: Any, __name: Text) -> None: ... -def dir(__o: object = ...) -> List[str]: ... - -_N2 = TypeVar("_N2", int, float) - -def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ... -def eval( - __source: Text | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... -) -> Any: ... -def execfile(__filename: str, __globals: Dict[str, Any] | None = ..., __locals: Dict[str, Any] | None = ...) -> None: ... -def exit(code: object = ...) -> NoReturn: ... -@overload -def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore -@overload -def filter(__function: None, __iterable: Tuple[_T | None, ...]) -> Tuple[_T, ...]: ... # type: ignore -@overload -def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore -@overload -def filter(__function: None, __iterable: Iterable[_T | None]) -> List[_T]: ... -@overload -def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ... -def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode -@overload -def getattr(__o: Any, name: Text) -> Any: ... - -# While technically covered by the last overload, spelling out the types for None and bool -# help mypy out in some tricky situations involving type context (aka bidirectional inference) -@overload -def getattr(__o: Any, name: Text, __default: None) -> Any | None: ... -@overload -def getattr(__o: Any, name: Text, __default: bool) -> Any | bool: ... -@overload -def getattr(__o: Any, name: Text, __default: _T) -> Any | _T: ... -def globals() -> Dict[str, Any]: ... -def hasattr(__obj: Any, __name: Text) -> bool: ... -def hash(__obj: object) -> int: ... -def hex(__number: int | _SupportsIndex) -> str: ... -def id(__obj: object) -> int: ... -def input(__prompt: Any = ...) -> Any: ... -def intern(__string: str) -> str: ... -@overload -def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... -@overload -def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ... -@overload -def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ... -def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... -def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... -def len(__obj: Sized) -> int: ... -def locals() -> Dict[str, Any]: ... -@overload -def map(__func: None, __iter1: Iterable[_T1]) -> List[_T1]: ... -@overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... -@overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... -@overload -def map( - __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def map( - __func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5], -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def map( - __func: None, - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... -@overload -def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> List[_S]: ... -@overload -def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[_S]: ... -@overload -def map( - __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] -) -> List[_S]: ... -@overload -def map( - __func: Callable[[_T1, _T2, _T3, _T4], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], -) -> List[_S]: ... -@overload -def map( - __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5], -) -> List[_S]: ... -@overload -def map( - __func: Callable[..., _S], - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any], -) -> List[_S]: ... -@overload -def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def next(__i: Iterator[_T]) -> _T: ... -@overload -def next(__i: Iterator[_T], default: _VT) -> _T | _VT: ... -def oct(__number: int | _SupportsIndex) -> str: ... -def open(name: unicode | int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... -def ord(__c: Text | bytes) -> int: ... - -# This is only available after from __future__ import print_function. -def print(*values: object, sep: Text | None = ..., end: Text | None = ..., file: SupportsWrite[Any] | None = ...) -> None: ... - -_E = TypeVar("_E", contravariant=True) -_M = TypeVar("_M", contravariant=True) - -class _SupportsPow2(Protocol[_E, _T_co]): - def __pow__(self, __other: _E) -> _T_co: ... - -class _SupportsPow3(Protocol[_E, _M, _T_co]): - def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ... - -@overload -def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative -@overload -def pow(__base: int, __exp: int, __mod: int) -> int: ... -@overload -def pow(__base: float, __exp: float, __mod: None = ...) -> float: ... -@overload -def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ... -@overload -def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ... -def quit(code: object = ...) -> NoReturn: ... -def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811 -def raw_input(__prompt: Any = ...) -> str: ... -@overload -def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ... -@overload -def reduce(__function: Callable[[_T, _T], _T], __iterable: Iterable[_T]) -> _T: ... -def reload(__module: Any) -> Any: ... -@overload -def reversed(__sequence: Sequence[_T]) -> Iterator[_T]: ... -@overload -def reversed(__sequence: Reversible[_T]) -> Iterator[_T]: ... -def repr(__obj: object) -> str: ... -@overload -def round(number: float) -> float: ... -@overload -def round(number: float, ndigits: int) -> float: ... -@overload -def round(number: SupportsFloat) -> float: ... -@overload -def round(number: SupportsFloat, ndigits: int) -> float: ... -def setattr(__obj: Any, __name: Text, __value: Any) -> None: ... -def sorted( - __iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] | None = ..., reverse: bool = ... -) -> List[_T]: ... -@overload -def sum(__iterable: Iterable[_T]) -> _T | int: ... -@overload -def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ... -def unichr(__i: int) -> unicode: ... -def vars(__object: Any = ...) -> Dict[str, Any]: ... -@overload -def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ... -@overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... -@overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... -@overload -def zip( - __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def zip( - __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def zip( - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... -def __import__( - name: Text, - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., - fromlist: Sequence[str] = ..., - level: int = ..., -) -> Any: ... - -# Actually the type of Ellipsis is , but since it's -# not exposed anywhere under that name, we make it private here. -class ellipsis: ... - -Ellipsis: ellipsis - -# TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check. -_AnyBuffer = TypeVar("_AnyBuffer", str, unicode, bytearray, buffer) - -class buffer(Sized): - def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ... - def __add__(self, other: _AnyBuffer) -> str: ... - def __cmp__(self, other: _AnyBuffer) -> bool: ... - def __getitem__(self, key: int | slice) -> str: ... - def __getslice__(self, i: int, j: int) -> str: ... - def __len__(self) -> int: ... - def __mul__(self, x: int) -> str: ... - -class BaseException(object): - args: Tuple[Any, ...] - message: Any - def __init__(self, *args: object) -> None: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __getitem__(self, i: int) -> Any: ... - def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ... - -class GeneratorExit(BaseException): ... -class KeyboardInterrupt(BaseException): ... - -class SystemExit(BaseException): - code: int - -class Exception(BaseException): ... -class StopIteration(Exception): ... -class StandardError(Exception): ... - -_StandardError = StandardError - -class EnvironmentError(StandardError): - errno: int - strerror: str - # TODO can this be unicode? - filename: str - -class OSError(EnvironmentError): ... -class IOError(EnvironmentError): ... -class ArithmeticError(_StandardError): ... -class AssertionError(_StandardError): ... -class AttributeError(_StandardError): ... -class BufferError(_StandardError): ... -class EOFError(_StandardError): ... -class ImportError(_StandardError): ... -class LookupError(_StandardError): ... -class MemoryError(_StandardError): ... -class NameError(_StandardError): ... -class ReferenceError(_StandardError): ... -class RuntimeError(_StandardError): ... - -class SyntaxError(_StandardError): - msg: str - lineno: int | None - offset: int | None - text: str | None - filename: str | None - -class SystemError(_StandardError): ... -class TypeError(_StandardError): ... -class ValueError(_StandardError): ... -class FloatingPointError(ArithmeticError): ... -class OverflowError(ArithmeticError): ... -class ZeroDivisionError(ArithmeticError): ... -class IndexError(LookupError): ... -class KeyError(LookupError): ... -class UnboundLocalError(NameError): ... - -class WindowsError(OSError): - winerror: int - -class NotImplementedError(RuntimeError): ... -class IndentationError(SyntaxError): ... -class TabError(IndentationError): ... -class UnicodeError(ValueError): ... - -class UnicodeDecodeError(UnicodeError): - encoding: str - object: bytes - start: int - end: int - reason: str - def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ... - -class UnicodeEncodeError(UnicodeError): - encoding: str - object: Text - start: int - end: int - reason: str - def __init__(self, __encoding: str, __object: Text, __start: int, __end: int, __reason: str) -> None: ... - -class UnicodeTranslateError(UnicodeError): ... -class Warning(Exception): ... -class UserWarning(Warning): ... -class DeprecationWarning(Warning): ... -class SyntaxWarning(Warning): ... -class RuntimeWarning(Warning): ... -class FutureWarning(Warning): ... -class PendingDeprecationWarning(Warning): ... -class ImportWarning(Warning): ... -class UnicodeWarning(Warning): ... -class BytesWarning(Warning): ... - -class file(BinaryIO): - @overload - def __init__(self, file: str, mode: str = ..., buffering: int = ...) -> None: ... - @overload - def __init__(self, file: unicode, mode: str = ..., buffering: int = ...) -> None: ... - @overload - def __init__(self, file: int, mode: str = ..., buffering: int = ...) -> None: ... - def __iter__(self) -> Iterator[str]: ... - def next(self) -> str: ... - def read(self, n: int = ...) -> str: ... - def __enter__(self) -> BinaryIO: ... - def __exit__(self, t: type | None = ..., exc: BaseException | None = ..., tb: Any | None = ...) -> bool | None: ... - def flush(self) -> None: ... - def fileno(self) -> int: ... - def isatty(self) -> bool: ... - def close(self) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def seekable(self) -> bool: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... - def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... - def write(self, data: str) -> int: ... - def writelines(self, data: Iterable[str]) -> None: ... - def truncate(self, pos: int | None = ...) -> int: ... diff --git a/stdlib/@python2/__future__.pyi b/stdlib/@python2/__future__.pyi deleted file mode 100644 index 8f5ff06..0000000 --- a/stdlib/@python2/__future__.pyi +++ /dev/null @@ -1,17 +0,0 @@ -import sys -from typing import List - -class _Feature: - def __init__(self, optionalRelease: sys._version_info, mandatoryRelease: sys._version_info, compiler_flag: int) -> None: ... - def getOptionalRelease(self) -> sys._version_info: ... - def getMandatoryRelease(self) -> sys._version_info: ... - compiler_flag: int - -absolute_import: _Feature -division: _Feature -generators: _Feature -nested_scopes: _Feature -print_function: _Feature -unicode_literals: _Feature -with_statement: _Feature -all_feature_names: List[str] # undocumented diff --git a/stdlib/@python2/__main__.pyi b/stdlib/@python2/__main__.pyi deleted file mode 100644 index e27843e..0000000 --- a/stdlib/@python2/__main__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... diff --git a/stdlib/@python2/_ast.pyi b/stdlib/@python2/_ast.pyi deleted file mode 100644 index 05cbc70..0000000 --- a/stdlib/@python2/_ast.pyi +++ /dev/null @@ -1,302 +0,0 @@ -import typing - -__version__: str -PyCF_ONLY_AST: int -_identifier = str - -class AST: - _attributes: typing.Tuple[str, ...] - _fields: typing.Tuple[str, ...] - def __init__(self, *args, **kwargs) -> None: ... - -class mod(AST): ... - -class Module(mod): - body: typing.List[stmt] - -class Interactive(mod): - body: typing.List[stmt] - -class Expression(mod): - body: expr - -class Suite(mod): - body: typing.List[stmt] - -class stmt(AST): - lineno: int - col_offset: int - -class FunctionDef(stmt): - name: _identifier - args: arguments - body: typing.List[stmt] - decorator_list: typing.List[expr] - -class ClassDef(stmt): - name: _identifier - bases: typing.List[expr] - body: typing.List[stmt] - decorator_list: typing.List[expr] - -class Return(stmt): - value: expr | None - -class Delete(stmt): - targets: typing.List[expr] - -class Assign(stmt): - targets: typing.List[expr] - value: expr - -class AugAssign(stmt): - target: expr - op: operator - value: expr - -class Print(stmt): - dest: expr | None - values: typing.List[expr] - nl: bool - -class For(stmt): - target: expr - iter: expr - body: typing.List[stmt] - orelse: typing.List[stmt] - -class While(stmt): - test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] - -class If(stmt): - test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] - -class With(stmt): - context_expr: expr - optional_vars: expr | None - body: typing.List[stmt] - -class Raise(stmt): - type: expr | None - inst: expr | None - tback: expr | None - -class TryExcept(stmt): - body: typing.List[stmt] - handlers: typing.List[ExceptHandler] - orelse: typing.List[stmt] - -class TryFinally(stmt): - body: typing.List[stmt] - finalbody: typing.List[stmt] - -class Assert(stmt): - test: expr - msg: expr | None - -class Import(stmt): - names: typing.List[alias] - -class ImportFrom(stmt): - module: _identifier | None - names: typing.List[alias] - level: int | None - -class Exec(stmt): - body: expr - globals: expr | None - locals: expr | None - -class Global(stmt): - names: typing.List[_identifier] - -class Expr(stmt): - value: expr - -class Pass(stmt): ... -class Break(stmt): ... -class Continue(stmt): ... -class slice(AST): ... - -_slice = slice # this lets us type the variable named 'slice' below - -class Slice(slice): - lower: expr | None - upper: expr | None - step: expr | None - -class ExtSlice(slice): - dims: typing.List[slice] - -class Index(slice): - value: expr - -class Ellipsis(slice): ... - -class expr(AST): - lineno: int - col_offset: int - -class BoolOp(expr): - op: boolop - values: typing.List[expr] - -class BinOp(expr): - left: expr - op: operator - right: expr - -class UnaryOp(expr): - op: unaryop - operand: expr - -class Lambda(expr): - args: arguments - body: expr - -class IfExp(expr): - test: expr - body: expr - orelse: expr - -class Dict(expr): - keys: typing.List[expr] - values: typing.List[expr] - -class Set(expr): - elts: typing.List[expr] - -class ListComp(expr): - elt: expr - generators: typing.List[comprehension] - -class SetComp(expr): - elt: expr - generators: typing.List[comprehension] - -class DictComp(expr): - key: expr - value: expr - generators: typing.List[comprehension] - -class GeneratorExp(expr): - elt: expr - generators: typing.List[comprehension] - -class Yield(expr): - value: expr | None - -class Compare(expr): - left: expr - ops: typing.List[cmpop] - comparators: typing.List[expr] - -class Call(expr): - func: expr - args: typing.List[expr] - keywords: typing.List[keyword] - starargs: expr | None - kwargs: expr | None - -class Repr(expr): - value: expr - -class Num(expr): - n: float - -class Str(expr): - s: str - -class Attribute(expr): - value: expr - attr: _identifier - ctx: expr_context - -class Subscript(expr): - value: expr - slice: _slice - ctx: expr_context - -class Name(expr): - id: _identifier - ctx: expr_context - -class List(expr): - elts: typing.List[expr] - ctx: expr_context - -class Tuple(expr): - elts: typing.List[expr] - ctx: expr_context - -class expr_context(AST): ... -class AugLoad(expr_context): ... -class AugStore(expr_context): ... -class Del(expr_context): ... -class Load(expr_context): ... -class Param(expr_context): ... -class Store(expr_context): ... -class boolop(AST): ... -class And(boolop): ... -class Or(boolop): ... -class operator(AST): ... -class Add(operator): ... -class BitAnd(operator): ... -class BitOr(operator): ... -class BitXor(operator): ... -class Div(operator): ... -class FloorDiv(operator): ... -class LShift(operator): ... -class Mod(operator): ... -class Mult(operator): ... -class Pow(operator): ... -class RShift(operator): ... -class Sub(operator): ... -class unaryop(AST): ... -class Invert(unaryop): ... -class Not(unaryop): ... -class UAdd(unaryop): ... -class USub(unaryop): ... -class cmpop(AST): ... -class Eq(cmpop): ... -class Gt(cmpop): ... -class GtE(cmpop): ... -class In(cmpop): ... -class Is(cmpop): ... -class IsNot(cmpop): ... -class Lt(cmpop): ... -class LtE(cmpop): ... -class NotEq(cmpop): ... -class NotIn(cmpop): ... - -class comprehension(AST): - target: expr - iter: expr - ifs: typing.List[expr] - -class excepthandler(AST): ... - -class ExceptHandler(excepthandler): - type: expr | None - name: expr | None - body: typing.List[stmt] - lineno: int - col_offset: int - -class arguments(AST): - args: typing.List[expr] - vararg: _identifier | None - kwarg: _identifier | None - defaults: typing.List[expr] - -class keyword(AST): - arg: _identifier - value: expr - -class alias(AST): - name: _identifier - asname: _identifier | None diff --git a/stdlib/@python2/_bisect.pyi b/stdlib/@python2/_bisect.pyi deleted file mode 100644 index e3327a0..0000000 --- a/stdlib/@python2/_bisect.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import MutableSequence, Sequence, TypeVar - -_T = TypeVar("_T") - -def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> int: ... -def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> int: ... -def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> None: ... -def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> None: ... diff --git a/stdlib/@python2/_codecs.pyi b/stdlib/@python2/_codecs.pyi deleted file mode 100644 index 83601f6..0000000 --- a/stdlib/@python2/_codecs.pyi +++ /dev/null @@ -1,66 +0,0 @@ -import codecs -import sys -from typing import Any, Callable, Dict, Text, Tuple, Union - -# For convenience: -_Handler = Callable[[Exception], Tuple[Text, int]] -_String = Union[bytes, str] -_Errors = Union[str, Text, None] -_Decodable = Union[bytes, Text] -_Encodable = Union[bytes, Text] - -# This type is not exposed; it is defined in unicodeobject.c -class _EncodingMap(object): - def size(self) -> int: ... - -_MapT = Union[Dict[int, int], _EncodingMap] - -def register(__search_function: Callable[[str], Any]) -> None: ... -def register_error(__errors: str | Text, __handler: _Handler) -> None: ... -def lookup(__encoding: str | Text) -> codecs.CodecInfo: ... -def lookup_error(__name: str | Text) -> _Handler: ... -def decode(obj: Any, encoding: str | Text = ..., errors: _Errors = ...) -> Any: ... -def encode(obj: Any, encoding: str | Text = ..., errors: _Errors = ...) -> Any: ... -def charmap_build(__map: Text) -> _MapT: ... -def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> Tuple[Text, int]: ... -def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> Tuple[bytes, int]: ... -def escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[str, int]: ... -def escape_encode(__data: bytes, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def latin_1_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def latin_1_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def raw_unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def raw_unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def readbuffer_encode(__data: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def unicode_escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def unicode_escape_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def unicode_internal_decode(__obj: _String, __errors: _Errors = ...) -> Tuple[Text, int]: ... -def unicode_internal_encode(__obj: _String, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_16_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_16_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_16_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_16_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... -def utf_16_ex_decode( - __data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ... -) -> Tuple[Text, int, int]: ... -def utf_16_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_16_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_32_be_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_32_be_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_32_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_32_encode(__str: _Encodable, __errors: _Errors = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... -def utf_32_ex_decode( - __data: _Decodable, __errors: _Errors = ..., __byteorder: int = ..., __final: int = ... -) -> Tuple[Text, int, int]: ... -def utf_32_le_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_32_le_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_7_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_7_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... -def utf_8_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... -def utf_8_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... - -if sys.platform == "win32": - def mbcs_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ... - def mbcs_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ... diff --git a/stdlib/@python2/_collections.pyi b/stdlib/@python2/_collections.pyi deleted file mode 100644 index 22ada07..0000000 --- a/stdlib/@python2/_collections.pyi +++ /dev/null @@ -1,36 +0,0 @@ -from typing import Any, Callable, Dict, Generic, Iterator, TypeVar - -_K = TypeVar("_K") -_V = TypeVar("_V") -_T = TypeVar("_T") -_T2 = TypeVar("_T2") - -class defaultdict(Dict[_K, _V]): - default_factory: None - def __init__(self, __default_factory: Callable[[], _V] = ..., init: Any = ...) -> None: ... - def __missing__(self, key: _K) -> _V: ... - def __copy__(self: _T) -> _T: ... - def copy(self: _T) -> _T: ... - -class deque(Generic[_T]): - maxlen: int | None - def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ... - def append(self, x: _T) -> None: ... - def appendleft(self, x: _T) -> None: ... - def clear(self) -> None: ... - def count(self, x: Any) -> int: ... - def extend(self, iterable: Iterator[_T]) -> None: ... - def extendleft(self, iterable: Iterator[_T]) -> None: ... - def pop(self) -> _T: ... - def popleft(self) -> _T: ... - def remove(self, value: _T) -> None: ... - def reverse(self) -> None: ... - def rotate(self, n: int = ...) -> None: ... - def __contains__(self, o: Any) -> bool: ... - def __copy__(self) -> deque[_T]: ... - def __getitem__(self, i: int) -> _T: ... - def __iadd__(self, other: deque[_T2]) -> deque[_T | _T2]: ... - def __iter__(self) -> Iterator[_T]: ... - def __len__(self) -> int: ... - def __reversed__(self) -> Iterator[_T]: ... - def __setitem__(self, i: int, x: _T) -> None: ... diff --git a/stdlib/@python2/_csv.pyi b/stdlib/@python2/_csv.pyi deleted file mode 100644 index ebe44ba..0000000 --- a/stdlib/@python2/_csv.pyi +++ /dev/null @@ -1,42 +0,0 @@ -from typing import Any, Iterable, Iterator, List, Protocol, Sequence, Text, Type, Union - -QUOTE_ALL: int -QUOTE_MINIMAL: int -QUOTE_NONE: int -QUOTE_NONNUMERIC: int - -class Error(Exception): ... - -class Dialect: - delimiter: str - quotechar: str | None - escapechar: str | None - doublequote: bool - skipinitialspace: bool - lineterminator: str - quoting: int - strict: int - def __init__(self) -> None: ... - -_DialectLike = Union[str, Dialect, Type[Dialect]] - -class _reader(Iterator[List[str]]): - dialect: Dialect - line_num: int - def next(self) -> List[str]: ... - -class _writer: - dialect: Dialect - def writerow(self, row: Sequence[Any]) -> Any: ... - def writerows(self, rows: Iterable[Sequence[Any]]) -> None: ... - -class _Writer(Protocol): - def write(self, s: str) -> Any: ... - -def writer(csvfile: _Writer, dialect: _DialectLike = ..., **fmtparams: Any) -> _writer: ... -def reader(csvfile: Iterable[Text], dialect: _DialectLike = ..., **fmtparams: Any) -> _reader: ... -def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ... -def unregister_dialect(name: str) -> None: ... -def get_dialect(name: str) -> Dialect: ... -def list_dialects() -> List[str]: ... -def field_size_limit(new_limit: int = ...) -> int: ... diff --git a/stdlib/@python2/_curses.pyi b/stdlib/@python2/_curses.pyi deleted file mode 100644 index 32c1f76..0000000 --- a/stdlib/@python2/_curses.pyi +++ /dev/null @@ -1,511 +0,0 @@ -from typing import IO, Any, BinaryIO, Tuple, Union, overload - -_chtype = Union[str, bytes, int] - -# ACS codes are only initialized after initscr is called -ACS_BBSS: int -ACS_BLOCK: int -ACS_BOARD: int -ACS_BSBS: int -ACS_BSSB: int -ACS_BSSS: int -ACS_BTEE: int -ACS_BULLET: int -ACS_CKBOARD: int -ACS_DARROW: int -ACS_DEGREE: int -ACS_DIAMOND: int -ACS_GEQUAL: int -ACS_HLINE: int -ACS_LANTERN: int -ACS_LARROW: int -ACS_LEQUAL: int -ACS_LLCORNER: int -ACS_LRCORNER: int -ACS_LTEE: int -ACS_NEQUAL: int -ACS_PI: int -ACS_PLMINUS: int -ACS_PLUS: int -ACS_RARROW: int -ACS_RTEE: int -ACS_S1: int -ACS_S3: int -ACS_S7: int -ACS_S9: int -ACS_SBBS: int -ACS_SBSB: int -ACS_SBSS: int -ACS_SSBB: int -ACS_SSBS: int -ACS_SSSB: int -ACS_SSSS: int -ACS_STERLING: int -ACS_TTEE: int -ACS_UARROW: int -ACS_ULCORNER: int -ACS_URCORNER: int -ACS_VLINE: int -ALL_MOUSE_EVENTS: int -A_ALTCHARSET: int -A_ATTRIBUTES: int -A_BLINK: int -A_BOLD: int -A_CHARTEXT: int -A_COLOR: int -A_DIM: int -A_HORIZONTAL: int -A_INVIS: int -A_LEFT: int -A_LOW: int -A_NORMAL: int -A_PROTECT: int -A_REVERSE: int -A_RIGHT: int -A_STANDOUT: int -A_TOP: int -A_UNDERLINE: int -A_VERTICAL: int -BUTTON1_CLICKED: int -BUTTON1_DOUBLE_CLICKED: int -BUTTON1_PRESSED: int -BUTTON1_RELEASED: int -BUTTON1_TRIPLE_CLICKED: int -BUTTON2_CLICKED: int -BUTTON2_DOUBLE_CLICKED: int -BUTTON2_PRESSED: int -BUTTON2_RELEASED: int -BUTTON2_TRIPLE_CLICKED: int -BUTTON3_CLICKED: int -BUTTON3_DOUBLE_CLICKED: int -BUTTON3_PRESSED: int -BUTTON3_RELEASED: int -BUTTON3_TRIPLE_CLICKED: int -BUTTON4_CLICKED: int -BUTTON4_DOUBLE_CLICKED: int -BUTTON4_PRESSED: int -BUTTON4_RELEASED: int -BUTTON4_TRIPLE_CLICKED: int -BUTTON_ALT: int -BUTTON_CTRL: int -BUTTON_SHIFT: int -COLOR_BLACK: int -COLOR_BLUE: int -COLOR_CYAN: int -COLOR_GREEN: int -COLOR_MAGENTA: int -COLOR_RED: int -COLOR_WHITE: int -COLOR_YELLOW: int -ERR: int -KEY_A1: int -KEY_A3: int -KEY_B2: int -KEY_BACKSPACE: int -KEY_BEG: int -KEY_BREAK: int -KEY_BTAB: int -KEY_C1: int -KEY_C3: int -KEY_CANCEL: int -KEY_CATAB: int -KEY_CLEAR: int -KEY_CLOSE: int -KEY_COMMAND: int -KEY_COPY: int -KEY_CREATE: int -KEY_CTAB: int -KEY_DC: int -KEY_DL: int -KEY_DOWN: int -KEY_EIC: int -KEY_END: int -KEY_ENTER: int -KEY_EOL: int -KEY_EOS: int -KEY_EXIT: int -KEY_F0: int -KEY_F1: int -KEY_F10: int -KEY_F11: int -KEY_F12: int -KEY_F13: int -KEY_F14: int -KEY_F15: int -KEY_F16: int -KEY_F17: int -KEY_F18: int -KEY_F19: int -KEY_F2: int -KEY_F20: int -KEY_F21: int -KEY_F22: int -KEY_F23: int -KEY_F24: int -KEY_F25: int -KEY_F26: int -KEY_F27: int -KEY_F28: int -KEY_F29: int -KEY_F3: int -KEY_F30: int -KEY_F31: int -KEY_F32: int -KEY_F33: int -KEY_F34: int -KEY_F35: int -KEY_F36: int -KEY_F37: int -KEY_F38: int -KEY_F39: int -KEY_F4: int -KEY_F40: int -KEY_F41: int -KEY_F42: int -KEY_F43: int -KEY_F44: int -KEY_F45: int -KEY_F46: int -KEY_F47: int -KEY_F48: int -KEY_F49: int -KEY_F5: int -KEY_F50: int -KEY_F51: int -KEY_F52: int -KEY_F53: int -KEY_F54: int -KEY_F55: int -KEY_F56: int -KEY_F57: int -KEY_F58: int -KEY_F59: int -KEY_F6: int -KEY_F60: int -KEY_F61: int -KEY_F62: int -KEY_F63: int -KEY_F7: int -KEY_F8: int -KEY_F9: int -KEY_FIND: int -KEY_HELP: int -KEY_HOME: int -KEY_IC: int -KEY_IL: int -KEY_LEFT: int -KEY_LL: int -KEY_MARK: int -KEY_MAX: int -KEY_MESSAGE: int -KEY_MIN: int -KEY_MOUSE: int -KEY_MOVE: int -KEY_NEXT: int -KEY_NPAGE: int -KEY_OPEN: int -KEY_OPTIONS: int -KEY_PPAGE: int -KEY_PREVIOUS: int -KEY_PRINT: int -KEY_REDO: int -KEY_REFERENCE: int -KEY_REFRESH: int -KEY_REPLACE: int -KEY_RESET: int -KEY_RESIZE: int -KEY_RESTART: int -KEY_RESUME: int -KEY_RIGHT: int -KEY_SAVE: int -KEY_SBEG: int -KEY_SCANCEL: int -KEY_SCOMMAND: int -KEY_SCOPY: int -KEY_SCREATE: int -KEY_SDC: int -KEY_SDL: int -KEY_SELECT: int -KEY_SEND: int -KEY_SEOL: int -KEY_SEXIT: int -KEY_SF: int -KEY_SFIND: int -KEY_SHELP: int -KEY_SHOME: int -KEY_SIC: int -KEY_SLEFT: int -KEY_SMESSAGE: int -KEY_SMOVE: int -KEY_SNEXT: int -KEY_SOPTIONS: int -KEY_SPREVIOUS: int -KEY_SPRINT: int -KEY_SR: int -KEY_SREDO: int -KEY_SREPLACE: int -KEY_SRESET: int -KEY_SRIGHT: int -KEY_SRSUME: int -KEY_SSAVE: int -KEY_SSUSPEND: int -KEY_STAB: int -KEY_SUNDO: int -KEY_SUSPEND: int -KEY_UNDO: int -KEY_UP: int -OK: int -REPORT_MOUSE_POSITION: int -_C_API: Any -version: bytes - -def baudrate() -> int: ... -def beep() -> None: ... -def can_change_color() -> bool: ... -def cbreak(__flag: bool = ...) -> None: ... -def color_content(__color_number: int) -> Tuple[int, int, int]: ... - -# Changed in Python 3.8.8 and 3.9.2 -def color_pair(__color_number: int) -> int: ... -def curs_set(__visibility: int) -> int: ... -def def_prog_mode() -> None: ... -def def_shell_mode() -> None: ... -def delay_output(__ms: int) -> None: ... -def doupdate() -> None: ... -def echo(__flag: bool = ...) -> None: ... -def endwin() -> None: ... -def erasechar() -> bytes: ... -def filter() -> None: ... -def flash() -> None: ... -def flushinp() -> None: ... -def getmouse() -> Tuple[int, int, int, int, int]: ... -def getsyx() -> Tuple[int, int]: ... -def getwin(__file: BinaryIO) -> _CursesWindow: ... -def halfdelay(__tenths: int) -> None: ... -def has_colors() -> bool: ... -def has_ic() -> bool: ... -def has_il() -> bool: ... -def has_key(__key: int) -> bool: ... -def init_color(__color_number: int, __r: int, __g: int, __b: int) -> None: ... -def init_pair(__pair_number: int, __fg: int, __bg: int) -> None: ... -def initscr() -> _CursesWindow: ... -def intrflush(__flag: bool) -> None: ... -def is_term_resized(__nlines: int, __ncols: int) -> bool: ... -def isendwin() -> bool: ... -def keyname(__key: int) -> bytes: ... -def killchar() -> bytes: ... -def longname() -> bytes: ... -def meta(__yes: bool) -> None: ... -def mouseinterval(__interval: int) -> None: ... -def mousemask(__newmask: int) -> Tuple[int, int]: ... -def napms(__ms: int) -> int: ... -def newpad(__nlines: int, __ncols: int) -> _CursesWindow: ... -def newwin(__nlines: int, __ncols: int, __begin_y: int = ..., __begin_x: int = ...) -> _CursesWindow: ... -def nl(__flag: bool = ...) -> None: ... -def nocbreak() -> None: ... -def noecho() -> None: ... -def nonl() -> None: ... -def noqiflush() -> None: ... -def noraw() -> None: ... -def pair_content(__pair_number: int) -> Tuple[int, int]: ... -def pair_number(__attr: int) -> int: ... -def putp(__string: bytes) -> None: ... -def qiflush(__flag: bool = ...) -> None: ... -def raw(__flag: bool = ...) -> None: ... -def reset_prog_mode() -> None: ... -def reset_shell_mode() -> None: ... -def resetty() -> None: ... -def resize_term(__nlines: int, __ncols: int) -> None: ... -def resizeterm(__nlines: int, __ncols: int) -> None: ... -def savetty() -> None: ... -def setsyx(__y: int, __x: int) -> None: ... -def setupterm(term: str | None = ..., fd: int = ...) -> None: ... -def start_color() -> None: ... -def termattrs() -> int: ... -def termname() -> bytes: ... -def tigetflag(__capname: str) -> int: ... -def tigetnum(__capname: str) -> int: ... -def tigetstr(__capname: str) -> bytes: ... -def tparm( - __str: bytes, - __i1: int = ..., - __i2: int = ..., - __i3: int = ..., - __i4: int = ..., - __i5: int = ..., - __i6: int = ..., - __i7: int = ..., - __i8: int = ..., - __i9: int = ..., -) -> bytes: ... -def typeahead(__fd: int) -> None: ... -def unctrl(__ch: _chtype) -> bytes: ... -def ungetch(__ch: _chtype) -> None: ... -def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ... -def use_default_colors() -> None: ... -def use_env(__flag: bool) -> None: ... - -class error(Exception): ... - -class _CursesWindow: - @overload - def addch(self, ch: _chtype, attr: int = ...) -> None: ... - @overload - def addch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ... - @overload - def addnstr(self, str: str, n: int, attr: int = ...) -> None: ... - @overload - def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... - @overload - def addstr(self, str: str, attr: int = ...) -> None: ... - @overload - def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... - def attroff(self, __attr: int) -> None: ... - def attron(self, __attr: int) -> None: ... - def attrset(self, __attr: int) -> None: ... - def bkgd(self, __ch: _chtype, __attr: int = ...) -> None: ... - def bkgdset(self, __ch: _chtype, __attr: int = ...) -> None: ... - def border( - self, - ls: _chtype = ..., - rs: _chtype = ..., - ts: _chtype = ..., - bs: _chtype = ..., - tl: _chtype = ..., - tr: _chtype = ..., - bl: _chtype = ..., - br: _chtype = ..., - ) -> None: ... - @overload - def box(self) -> None: ... - @overload - def box(self, vertch: _chtype = ..., horch: _chtype = ...) -> None: ... - @overload - def chgat(self, attr: int) -> None: ... - @overload - def chgat(self, num: int, attr: int) -> None: ... - @overload - def chgat(self, y: int, x: int, attr: int) -> None: ... - @overload - def chgat(self, y: int, x: int, num: int, attr: int) -> None: ... - def clear(self) -> None: ... - def clearok(self, yes: int) -> None: ... - def clrtobot(self) -> None: ... - def clrtoeol(self) -> None: ... - def cursyncup(self) -> None: ... - @overload - def delch(self) -> None: ... - @overload - def delch(self, y: int, x: int) -> None: ... - def deleteln(self) -> None: ... - @overload - def derwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... - def echochar(self, __ch: _chtype, __attr: int = ...) -> None: ... - def enclose(self, __y: int, __x: int) -> bool: ... - def erase(self) -> None: ... - def getbegyx(self) -> Tuple[int, int]: ... - def getbkgd(self) -> Tuple[int, int]: ... - @overload - def getch(self) -> int: ... - @overload - def getch(self, y: int, x: int) -> int: ... - @overload - def getkey(self) -> str: ... - @overload - def getkey(self, y: int, x: int) -> str: ... - def getmaxyx(self) -> Tuple[int, int]: ... - def getparyx(self) -> Tuple[int, int]: ... - @overload - def getstr(self) -> _chtype: ... - @overload - def getstr(self, n: int) -> _chtype: ... - @overload - def getstr(self, y: int, x: int) -> _chtype: ... - @overload - def getstr(self, y: int, x: int, n: int) -> _chtype: ... - def getyx(self) -> Tuple[int, int]: ... - @overload - def hline(self, ch: _chtype, n: int) -> None: ... - @overload - def hline(self, y: int, x: int, ch: _chtype, n: int) -> None: ... - def idcok(self, flag: bool) -> None: ... - def idlok(self, yes: bool) -> None: ... - def immedok(self, flag: bool) -> None: ... - @overload - def inch(self) -> _chtype: ... - @overload - def inch(self, y: int, x: int) -> _chtype: ... - @overload - def insch(self, ch: _chtype, attr: int = ...) -> None: ... - @overload - def insch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ... - def insdelln(self, nlines: int) -> None: ... - def insertln(self) -> None: ... - @overload - def insnstr(self, str: str, n: int, attr: int = ...) -> None: ... - @overload - def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... - @overload - def insstr(self, str: str, attr: int = ...) -> None: ... - @overload - def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... - @overload - def instr(self, n: int = ...) -> _chtype: ... - @overload - def instr(self, y: int, x: int, n: int = ...) -> _chtype: ... - def is_linetouched(self, __line: int) -> bool: ... - def is_wintouched(self) -> bool: ... - def keypad(self, yes: bool) -> None: ... - def leaveok(self, yes: bool) -> None: ... - def move(self, new_y: int, new_x: int) -> None: ... - def mvderwin(self, y: int, x: int) -> None: ... - def mvwin(self, new_y: int, new_x: int) -> None: ... - def nodelay(self, yes: bool) -> None: ... - def notimeout(self, yes: bool) -> None: ... - def noutrefresh(self) -> None: ... - @overload - def overlay(self, destwin: _CursesWindow) -> None: ... - @overload - def overlay( - self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int - ) -> None: ... - @overload - def overwrite(self, destwin: _CursesWindow) -> None: ... - @overload - def overwrite( - self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int - ) -> None: ... - def putwin(self, __file: IO[Any]) -> None: ... - def redrawln(self, __beg: int, __num: int) -> None: ... - def redrawwin(self) -> None: ... - @overload - def refresh(self) -> None: ... - @overload - def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... - def resize(self, nlines: int, ncols: int) -> None: ... - def scroll(self, lines: int = ...) -> None: ... - def scrollok(self, flag: bool) -> None: ... - def setscrreg(self, __top: int, __bottom: int) -> None: ... - def standend(self) -> None: ... - def standout(self) -> None: ... - @overload - def subpad(self, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def subwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... - def syncdown(self) -> None: ... - def syncok(self, flag: bool) -> None: ... - def syncup(self) -> None: ... - def timeout(self, delay: int) -> None: ... - def touchline(self, start: int, count: int, changed: bool = ...) -> None: ... - def touchwin(self) -> None: ... - def untouchwin(self) -> None: ... - @overload - def vline(self, ch: _chtype, n: int) -> None: ... - @overload - def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ... diff --git a/stdlib/@python2/_dummy_threading.pyi b/stdlib/@python2/_dummy_threading.pyi deleted file mode 100644 index e45a1b5..0000000 --- a/stdlib/@python2/_dummy_threading.pyi +++ /dev/null @@ -1,109 +0,0 @@ -from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar - -# TODO recursive type -_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] - -_PF = Callable[[FrameType, str, Any], None] -_T = TypeVar("_T") - -__all__: List[str] - -def active_count() -> int: ... -def activeCount() -> int: ... -def current_thread() -> Thread: ... -def currentThread() -> Thread: ... -def enumerate() -> List[Thread]: ... -def settrace(func: _TF) -> None: ... -def setprofile(func: _PF | None) -> None: ... -def stack_size(size: int = ...) -> int: ... - -class ThreadError(Exception): ... - -class local(object): - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... - -class Thread: - name: str - ident: int | None - daemon: bool - def __init__( - self, - group: None = ..., - target: Callable[..., Any] | None = ..., - name: Text | None = ..., - args: Iterable[Any] = ..., - kwargs: Mapping[Text, Any] | None = ..., - ) -> None: ... - def start(self) -> None: ... - def run(self) -> None: ... - def join(self, timeout: float | None = ...) -> None: ... - def getName(self) -> str: ... - def setName(self, name: Text) -> None: ... - def is_alive(self) -> bool: ... - def isAlive(self) -> bool: ... - def isDaemon(self) -> bool: ... - def setDaemon(self, daemonic: bool) -> None: ... - -class _DummyThread(Thread): ... - -class Lock: - def __init__(self) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - def locked(self) -> bool: ... - -class _RLock: - def __init__(self) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - -RLock = _RLock - -class Condition: - def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... - def notify(self, n: int = ...) -> None: ... - def notify_all(self) -> None: ... - def notifyAll(self) -> None: ... - -class Semaphore: - def __init__(self, value: int = ...) -> None: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def __enter__(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - -class BoundedSemaphore(Semaphore): ... - -class Event: - def __init__(self) -> None: ... - def is_set(self) -> bool: ... - def isSet(self) -> bool: ... - def set(self) -> None: ... - def clear(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... - -class Timer(Thread): - def __init__( - self, interval: float, function: Callable[..., Any], args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ... - ) -> None: ... - def cancel(self) -> None: ... diff --git a/stdlib/@python2/_functools.pyi b/stdlib/@python2/_functools.pyi deleted file mode 100644 index e683982..0000000 --- a/stdlib/@python2/_functools.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Callable, Dict, Iterable, Tuple, TypeVar, overload - -_T = TypeVar("_T") -_S = TypeVar("_S") - -@overload -def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ... -@overload -def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... - -class partial(object): - func: Callable[..., Any] - args: Tuple[Any, ...] - keywords: Dict[str, Any] - def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... diff --git a/stdlib/@python2/_heapq.pyi b/stdlib/@python2/_heapq.pyi deleted file mode 100644 index 08a8add..0000000 --- a/stdlib/@python2/_heapq.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any, Callable, Iterable, List, TypeVar - -_T = TypeVar("_T") - -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: ... -def heapreplace(__heap: List[_T], __item: _T) -> _T: ... -def nlargest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> List[_T]: ... -def nsmallest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> List[_T]: ... diff --git a/stdlib/@python2/_hotshot.pyi b/stdlib/@python2/_hotshot.pyi deleted file mode 100644 index b048f6f..0000000 --- a/stdlib/@python2/_hotshot.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import Any, Tuple - -def coverage(a: str) -> Any: ... -def logreader(a: str) -> LogReaderType: ... -def profiler(a: str, *args, **kwargs) -> Any: ... -def resolution() -> Tuple[Any, ...]: ... - -class LogReaderType(object): - def close(self) -> None: ... - def fileno(self) -> int: ... - -class ProfilerType(object): - def addinfo(self, a: str, b: str) -> None: ... - def close(self) -> None: ... - def fileno(self) -> int: ... - def runcall(self, *args, **kwargs) -> Any: ... - def runcode(self, a, b, *args, **kwargs) -> Any: ... - def start(self) -> None: ... - def stop(self) -> None: ... diff --git a/stdlib/@python2/_io.pyi b/stdlib/@python2/_io.pyi deleted file mode 100644 index fedbbe1..0000000 --- a/stdlib/@python2/_io.pyi +++ /dev/null @@ -1,180 +0,0 @@ -from _typeshed import Self -from mmap import mmap -from typing import IO, Any, BinaryIO, Iterable, List, Text, TextIO, Tuple, Type, TypeVar, Union - -_bytearray_like = Union[bytearray, mmap] - -DEFAULT_BUFFER_SIZE: int - -class BlockingIOError(IOError): - characters_written: int - -class UnsupportedOperation(ValueError, IOError): ... - -_T = TypeVar("_T") - -class _IOBase(BinaryIO): - @property - def closed(self) -> bool: ... - def _checkClosed(self, msg: str | None = ...) -> None: ... # undocumented - def _checkReadable(self) -> None: ... - def _checkSeekable(self) -> None: ... - def _checkWritable(self) -> None: ... - # All these methods are concrete here (you can instantiate this) - def close(self) -> None: ... - def fileno(self) -> int: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def readable(self) -> bool: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def seekable(self) -> bool: ... - def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> int: ... - def writable(self) -> bool: ... - def __enter__(self: Self) -> Self: ... - def __exit__(self, t: Type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ... - def __iter__(self: _T) -> _T: ... - # The parameter type of writelines[s]() is determined by that of write(): - def writelines(self, lines: Iterable[bytes]) -> None: ... - # The return type of readline[s]() and next() is determined by that of read(): - def readline(self, limit: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... - def next(self) -> bytes: ... - # These don't actually exist but we need to pretend that it does - # so that this class is concrete. - def write(self, s: bytes) -> int: ... - def read(self, n: int = ...) -> bytes: ... - -class _BufferedIOBase(_IOBase): - def read1(self, n: int) -> bytes: ... - def read(self, size: int = ...) -> bytes: ... - def readinto(self, buffer: _bytearray_like) -> int: ... - def write(self, s: bytes) -> int: ... - def detach(self) -> _IOBase: ... - -class BufferedRWPair(_BufferedIOBase): - def __init__(self, reader: _RawIOBase, writer: _RawIOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... - def peek(self, n: int = ...) -> bytes: ... - def __enter__(self: Self) -> Self: ... - -class BufferedRandom(_BufferedIOBase): - mode: str - name: str - raw: _IOBase - def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... - def peek(self, n: int = ...) -> bytes: ... - -class BufferedReader(_BufferedIOBase): - mode: str - name: str - raw: _IOBase - def __init__(self, raw: _IOBase, buffer_size: int = ...) -> None: ... - def peek(self, n: int = ...) -> bytes: ... - -class BufferedWriter(_BufferedIOBase): - name: str - raw: _IOBase - mode: str - def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... - -class BytesIO(_BufferedIOBase): - def __init__(self, initial_bytes: bytes = ...) -> None: ... - def __setstate__(self, state: Tuple[Any, ...]) -> None: ... - def __getstate__(self) -> Tuple[Any, ...]: ... - # BytesIO does not contain a "name" field. This workaround is necessary - # to allow BytesIO sub-classes to add this field, as it is defined - # as a read-only property on IO[]. - name: Any - def getvalue(self) -> bytes: ... - def write(self, s: bytes) -> int: ... - def writelines(self, lines: Iterable[bytes]) -> None: ... - def read1(self, size: int) -> bytes: ... - def next(self) -> bytes: ... - -class _RawIOBase(_IOBase): - def readall(self) -> str: ... - def read(self, n: int = ...) -> str: ... - -class FileIO(_RawIOBase, BytesIO): - mode: str - closefd: bool - def __init__(self, file: str | int, mode: str = ..., closefd: bool = ...) -> None: ... - def readinto(self, buffer: _bytearray_like) -> int: ... - def write(self, pbuf: str) -> int: ... - -class IncrementalNewlineDecoder(object): - newlines: str | unicode - def __init__(self, decoder, translate, z=...) -> None: ... - def decode(self, input, final) -> Any: ... - def getstate(self) -> Tuple[Any, int]: ... - def setstate(self, state: Tuple[Any, int]) -> None: ... - def reset(self) -> None: ... - -# Note: In the actual _io.py, _TextIOBase inherits from _IOBase. -class _TextIOBase(TextIO): - errors: str | None - # TODO: On _TextIOBase, this is always None. But it's unicode/bytes in subclasses. - newlines: None | unicode | bytes - encoding: str - @property - def closed(self) -> bool: ... - def _checkClosed(self) -> None: ... - def _checkReadable(self) -> None: ... - def _checkSeekable(self) -> None: ... - def _checkWritable(self) -> None: ... - def close(self) -> None: ... - def detach(self) -> IO[Any]: ... - def fileno(self) -> int: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def next(self) -> unicode: ... - def read(self, size: int = ...) -> unicode: ... - def readable(self) -> bool: ... - def readline(self, limit: int = ...) -> unicode: ... - def readlines(self, hint: int = ...) -> list[unicode]: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def seekable(self) -> bool: ... - def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> int: ... - def writable(self) -> bool: ... - def write(self, pbuf: unicode) -> int: ... - def writelines(self, lines: Iterable[unicode]) -> None: ... - def __enter__(self: Self) -> Self: ... - def __exit__(self, t: Type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ... - def __iter__(self: _T) -> _T: ... - -class StringIO(_TextIOBase): - line_buffering: bool - def __init__(self, initial_value: unicode | None = ..., newline: unicode | None = ...) -> None: ... - def __setstate__(self, state: Tuple[Any, ...]) -> None: ... - def __getstate__(self) -> Tuple[Any, ...]: ... - # StringIO does not contain a "name" field. This workaround is necessary - # to allow StringIO sub-classes to add this field, as it is defined - # as a read-only property on IO[]. - name: Any - def getvalue(self) -> unicode: ... - -class TextIOWrapper(_TextIOBase): - name: str - line_buffering: bool - buffer: BinaryIO - _CHUNK_SIZE: int - def __init__( - self, - buffer: IO[Any], - encoding: Text | None = ..., - errors: Text | None = ..., - newline: Text | None = ..., - line_buffering: bool = ..., - write_through: bool = ..., - ) -> None: ... - -def open( - file: str | unicode | int, - mode: Text = ..., - buffering: int = ..., - encoding: Text | None = ..., - errors: Text | None = ..., - newline: Text | None = ..., - closefd: bool = ..., -) -> IO[Any]: ... diff --git a/stdlib/@python2/_json.pyi b/stdlib/@python2/_json.pyi deleted file mode 100644 index a9868b3..0000000 --- a/stdlib/@python2/_json.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Any, Tuple - -def encode_basestring_ascii(*args, **kwargs) -> str: ... -def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ... - -class Encoder(object): ... -class Scanner(object): ... diff --git a/stdlib/@python2/_markupbase.pyi b/stdlib/@python2/_markupbase.pyi deleted file mode 100644 index d8bc79f..0000000 --- a/stdlib/@python2/_markupbase.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Tuple - -class ParserBase: - def __init__(self) -> None: ... - def error(self, message: str) -> None: ... - def reset(self) -> None: ... - def getpos(self) -> Tuple[int, int]: ... - def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/@python2/_md5.pyi b/stdlib/@python2/_md5.pyi deleted file mode 100644 index 96111b7..0000000 --- a/stdlib/@python2/_md5.pyi +++ /dev/null @@ -1,13 +0,0 @@ -blocksize: int -digest_size: int - -class MD5Type(object): - name: str - block_size: int - digest_size: int - def copy(self) -> MD5Type: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def update(self, arg: str) -> None: ... - -def new(arg: str = ...) -> MD5Type: ... diff --git a/stdlib/@python2/_msi.pyi b/stdlib/@python2/_msi.pyi deleted file mode 100644 index a1030a6..0000000 --- a/stdlib/@python2/_msi.pyi +++ /dev/null @@ -1,49 +0,0 @@ -import sys -from typing import List - -if sys.platform == "win32": - - # Actual typename View, not exposed by the implementation - class _View: - def Execute(self, params: _Record | None = ...) -> None: ... - def GetColumnInfo(self, kind: int) -> _Record: ... - def Fetch(self) -> _Record: ... - def Modify(self, mode: int, record: _Record) -> None: ... - def Close(self) -> None: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - # Actual typename Summary, not exposed by the implementation - class _Summary: - def GetProperty(self, propid: int) -> str | bytes | None: ... - def GetPropertyCount(self) -> int: ... - def SetProperty(self, propid: int, value: str | bytes) -> None: ... - def Persist(self) -> None: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - # Actual typename Database, not exposed by the implementation - class _Database: - def OpenView(self, sql: str) -> _View: ... - def Commit(self) -> None: ... - def GetSummaryInformation(self, updateCount: int) -> _Summary: ... - def Close(self) -> None: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - # Actual typename Record, not exposed by the implementation - class _Record: - def GetFieldCount(self) -> int: ... - def GetInteger(self, field: int) -> int: ... - def GetString(self, field: int) -> str: ... - def SetString(self, field: int, str: str) -> None: ... - def SetStream(self, field: int, stream: str) -> None: ... - def SetInteger(self, field: int, int: int) -> None: ... - def ClearData(self) -> None: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - def UuidCreate() -> str: ... - def FCICreate(cabname: str, files: List[str]) -> None: ... - def OpenDatabase(name: str, flags: int) -> _Database: ... - def CreateRecord(count: int) -> _Record: ... diff --git a/stdlib/@python2/_osx_support.pyi b/stdlib/@python2/_osx_support.pyi deleted file mode 100644 index 1b890d8..0000000 --- a/stdlib/@python2/_osx_support.pyi +++ /dev/null @@ -1,33 +0,0 @@ -from typing import Dict, Iterable, List, Sequence, Tuple, TypeVar - -_T = TypeVar("_T") -_K = TypeVar("_K") -_V = TypeVar("_V") - -__all__: List[str] - -_UNIVERSAL_CONFIG_VARS: Tuple[str, ...] # undocumented -_COMPILER_CONFIG_VARS: Tuple[str, ...] # undocumented -_INITPRE: str # undocumented - -def _find_executable(executable: str, path: str | None = ...) -> str | None: ... # undocumented -def _read_output(commandstring: str) -> str | None: ... # undocumented -def _find_build_tool(toolname: str) -> str: ... # undocumented - -_SYSTEM_VERSION: str | None # undocumented - -def _get_system_version() -> str: ... # undocumented -def _remove_original_values(_config_vars: Dict[str, str]) -> None: ... # undocumented -def _save_modified_value(_config_vars: Dict[str, str], cv: str, newvalue: str) -> None: ... # undocumented -def _supports_universal_builds() -> bool: ... # undocumented -def _find_appropriate_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _remove_universal_flags(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _remove_unsupported_archs(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _override_all_archs(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _check_for_unavailable_sdk(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def compiler_fixup(compiler_so: Iterable[str], cc_args: Sequence[str]) -> List[str]: ... -def customize_config_vars(_config_vars: Dict[str, str]) -> Dict[str, str]: ... -def customize_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ... -def get_platform_osx( - _config_vars: Dict[str, str], osname: _T, release: _K, machine: _V -) -> Tuple[str | _T, str | _K, str | _V]: ... diff --git a/stdlib/@python2/_random.pyi b/stdlib/@python2/_random.pyi deleted file mode 100644 index 7c2dd61..0000000 --- a/stdlib/@python2/_random.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Tuple - -# Actually Tuple[(int,) * 625] -_State = Tuple[int, ...] - -class Random(object): - def __init__(self, seed: object = ...) -> None: ... - def seed(self, __n: object = ...) -> None: ... - def getstate(self) -> _State: ... - def setstate(self, __state: _State) -> None: ... - def random(self) -> float: ... - def getrandbits(self, __k: int) -> int: ... - def jumpahead(self, i: int) -> None: ... diff --git a/stdlib/@python2/_sha.pyi b/stdlib/@python2/_sha.pyi deleted file mode 100644 index 7c47256..0000000 --- a/stdlib/@python2/_sha.pyi +++ /dev/null @@ -1,15 +0,0 @@ -blocksize: int -block_size: int -digest_size: int - -class sha(object): # not actually exposed - name: str - block_size: int - digest_size: int - digestsize: int - def copy(self) -> sha: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def update(self, arg: str) -> None: ... - -def new(arg: str = ...) -> sha: ... diff --git a/stdlib/@python2/_sha256.pyi b/stdlib/@python2/_sha256.pyi deleted file mode 100644 index 7464320..0000000 --- a/stdlib/@python2/_sha256.pyi +++ /dev/null @@ -1,21 +0,0 @@ -class sha224(object): - name: str - block_size: int - digest_size: int - digestsize: int - def __init__(self, init: str | None) -> None: ... - def copy(self) -> sha224: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def update(self, arg: str) -> None: ... - -class sha256(object): - name: str - block_size: int - digest_size: int - digestsize: int - def __init__(self, init: str | None) -> None: ... - def copy(self) -> sha256: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def update(self, arg: str) -> None: ... diff --git a/stdlib/@python2/_sha512.pyi b/stdlib/@python2/_sha512.pyi deleted file mode 100644 index 90e2aee..0000000 --- a/stdlib/@python2/_sha512.pyi +++ /dev/null @@ -1,21 +0,0 @@ -class sha384(object): - name: str - block_size: int - digest_size: int - digestsize: int - def __init__(self, init: str | None) -> None: ... - def copy(self) -> sha384: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def update(self, arg: str) -> None: ... - -class sha512(object): - name: str - block_size: int - digest_size: int - digestsize: int - def __init__(self, init: str | None) -> None: ... - def copy(self) -> sha512: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def update(self, arg: str) -> None: ... diff --git a/stdlib/@python2/_socket.pyi b/stdlib/@python2/_socket.pyi deleted file mode 100644 index c505384..0000000 --- a/stdlib/@python2/_socket.pyi +++ /dev/null @@ -1,281 +0,0 @@ -from typing import IO, Any, Tuple, overload - -AF_APPLETALK: int -AF_ASH: int -AF_ATMPVC: int -AF_ATMSVC: int -AF_AX25: int -AF_BLUETOOTH: int -AF_BRIDGE: int -AF_DECnet: int -AF_ECONET: int -AF_INET: int -AF_INET6: int -AF_IPX: int -AF_IRDA: int -AF_KEY: int -AF_LLC: int -AF_NETBEUI: int -AF_NETLINK: int -AF_NETROM: int -AF_PACKET: int -AF_PPPOX: int -AF_ROSE: int -AF_ROUTE: int -AF_SECURITY: int -AF_SNA: int -AF_TIPC: int -AF_UNIX: int -AF_UNSPEC: int -AF_WANPIPE: int -AF_X25: int -AI_ADDRCONFIG: int -AI_ALL: int -AI_CANONNAME: int -AI_NUMERICHOST: int -AI_NUMERICSERV: int -AI_PASSIVE: int -AI_V4MAPPED: int -BDADDR_ANY: str -BDADDR_LOCAL: str -BTPROTO_HCI: int -BTPROTO_L2CAP: int -BTPROTO_RFCOMM: int -BTPROTO_SCO: int -EAI_ADDRFAMILY: int -EAI_AGAIN: int -EAI_BADFLAGS: int -EAI_FAIL: int -EAI_FAMILY: int -EAI_MEMORY: int -EAI_NODATA: int -EAI_NONAME: int -EAI_OVERFLOW: int -EAI_SERVICE: int -EAI_SOCKTYPE: int -EAI_SYSTEM: int -EBADF: int -EINTR: int -HCI_DATA_DIR: int -HCI_FILTER: int -HCI_TIME_STAMP: int -INADDR_ALLHOSTS_GROUP: int -INADDR_ANY: int -INADDR_BROADCAST: int -INADDR_LOOPBACK: int -INADDR_MAX_LOCAL_GROUP: int -INADDR_NONE: int -INADDR_UNSPEC_GROUP: int -IPPORT_RESERVED: int -IPPORT_USERRESERVED: int -IPPROTO_AH: int -IPPROTO_DSTOPTS: int -IPPROTO_EGP: int -IPPROTO_ESP: int -IPPROTO_FRAGMENT: int -IPPROTO_GRE: int -IPPROTO_HOPOPTS: int -IPPROTO_ICMP: int -IPPROTO_ICMPV6: int -IPPROTO_IDP: int -IPPROTO_IGMP: int -IPPROTO_IP: int -IPPROTO_IPIP: int -IPPROTO_IPV6: int -IPPROTO_NONE: int -IPPROTO_PIM: int -IPPROTO_PUP: int -IPPROTO_RAW: int -IPPROTO_ROUTING: int -IPPROTO_RSVP: int -IPPROTO_TCP: int -IPPROTO_TP: int -IPPROTO_UDP: int -IPV6_CHECKSUM: int -IPV6_DSTOPTS: int -IPV6_HOPLIMIT: int -IPV6_HOPOPTS: int -IPV6_JOIN_GROUP: int -IPV6_LEAVE_GROUP: int -IPV6_MULTICAST_HOPS: int -IPV6_MULTICAST_IF: int -IPV6_MULTICAST_LOOP: int -IPV6_NEXTHOP: int -IPV6_PKTINFO: int -IPV6_RECVDSTOPTS: int -IPV6_RECVHOPLIMIT: int -IPV6_RECVHOPOPTS: int -IPV6_RECVPKTINFO: int -IPV6_RECVRTHDR: int -IPV6_RECVTCLASS: int -IPV6_RTHDR: int -IPV6_RTHDRDSTOPTS: int -IPV6_RTHDR_TYPE_0: int -IPV6_TCLASS: int -IPV6_UNICAST_HOPS: int -IPV6_V6ONLY: int -IP_ADD_MEMBERSHIP: int -IP_DEFAULT_MULTICAST_LOOP: int -IP_DEFAULT_MULTICAST_TTL: int -IP_DROP_MEMBERSHIP: int -IP_HDRINCL: int -IP_MAX_MEMBERSHIPS: int -IP_MULTICAST_IF: int -IP_MULTICAST_LOOP: int -IP_MULTICAST_TTL: int -IP_OPTIONS: int -IP_RECVOPTS: int -IP_RECVRETOPTS: int -IP_RETOPTS: int -IP_TOS: int -IP_TTL: int -MSG_CTRUNC: int -MSG_DONTROUTE: int -MSG_DONTWAIT: int -MSG_EOR: int -MSG_OOB: int -MSG_PEEK: int -MSG_TRUNC: int -MSG_WAITALL: int -MethodType: type -NETLINK_DNRTMSG: int -NETLINK_FIREWALL: int -NETLINK_IP6_FW: int -NETLINK_NFLOG: int -NETLINK_ROUTE: int -NETLINK_USERSOCK: int -NETLINK_XFRM: int -NI_DGRAM: int -NI_MAXHOST: int -NI_MAXSERV: int -NI_NAMEREQD: int -NI_NOFQDN: int -NI_NUMERICHOST: int -NI_NUMERICSERV: int -PACKET_BROADCAST: int -PACKET_FASTROUTE: int -PACKET_HOST: int -PACKET_LOOPBACK: int -PACKET_MULTICAST: int -PACKET_OTHERHOST: int -PACKET_OUTGOING: int -PF_PACKET: int -SHUT_RD: int -SHUT_RDWR: int -SHUT_WR: int -SOCK_DGRAM: int -SOCK_RAW: int -SOCK_RDM: int -SOCK_SEQPACKET: int -SOCK_STREAM: int -SOL_HCI: int -SOL_IP: int -SOL_SOCKET: int -SOL_TCP: int -SOL_TIPC: int -SOL_UDP: int -SOMAXCONN: int -SO_ACCEPTCONN: int -SO_BROADCAST: int -SO_DEBUG: int -SO_DONTROUTE: int -SO_ERROR: int -SO_KEEPALIVE: int -SO_LINGER: int -SO_OOBINLINE: int -SO_RCVBUF: int -SO_RCVLOWAT: int -SO_RCVTIMEO: int -SO_REUSEADDR: int -SO_REUSEPORT: int -SO_SNDBUF: int -SO_SNDLOWAT: int -SO_SNDTIMEO: int -SO_TYPE: int -SSL_ERROR_EOF: int -SSL_ERROR_INVALID_ERROR_CODE: int -SSL_ERROR_SSL: int -SSL_ERROR_SYSCALL: int -SSL_ERROR_WANT_CONNECT: int -SSL_ERROR_WANT_READ: int -SSL_ERROR_WANT_WRITE: int -SSL_ERROR_WANT_X509_LOOKUP: int -SSL_ERROR_ZERO_RETURN: int -TCP_CORK: int -TCP_DEFER_ACCEPT: int -TCP_INFO: int -TCP_KEEPCNT: int -TCP_KEEPIDLE: int -TCP_KEEPINTVL: int -TCP_LINGER2: int -TCP_MAXSEG: int -TCP_NODELAY: int -TCP_QUICKACK: int -TCP_SYNCNT: int -TCP_WINDOW_CLAMP: int -TIPC_ADDR_ID: int -TIPC_ADDR_NAME: int -TIPC_ADDR_NAMESEQ: int -TIPC_CFG_SRV: int -TIPC_CLUSTER_SCOPE: int -TIPC_CONN_TIMEOUT: int -TIPC_CRITICAL_IMPORTANCE: int -TIPC_DEST_DROPPABLE: int -TIPC_HIGH_IMPORTANCE: int -TIPC_IMPORTANCE: int -TIPC_LOW_IMPORTANCE: int -TIPC_MEDIUM_IMPORTANCE: int -TIPC_NODE_SCOPE: int -TIPC_PUBLISHED: int -TIPC_SRC_DROPPABLE: int -TIPC_SUBSCR_TIMEOUT: int -TIPC_SUB_CANCEL: int -TIPC_SUB_PORTS: int -TIPC_SUB_SERVICE: int -TIPC_TOP_SRV: int -TIPC_WAIT_FOREVER: int -TIPC_WITHDRAWN: int -TIPC_ZONE_SCOPE: int - -# PyCapsule -CAPI: Any - -has_ipv6: bool - -class error(IOError): ... -class gaierror(error): ... -class timeout(error): ... - -class SocketType(object): - family: int - type: int - proto: int - timeout: float - def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ... - def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ... - def bind(self, address: Tuple[Any, ...]) -> None: ... - def close(self) -> None: ... - def connect(self, address: Tuple[Any, ...]) -> None: ... - def connect_ex(self, address: Tuple[Any, ...]) -> int: ... - def dup(self) -> SocketType: ... - def fileno(self) -> int: ... - def getpeername(self) -> Tuple[Any, ...]: ... - def getsockname(self) -> Tuple[Any, ...]: ... - def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ... - def gettimeout(self) -> float: ... - def listen(self, backlog: int) -> None: ... - def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ... - def recv(self, buffersize: int, flags: int = ...) -> str: ... - def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ... - def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]: ... - def recvfrom_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ... - def send(self, data: str, flags: int = ...) -> int: ... - def sendall(self, data: str, flags: int = ...) -> None: ... - @overload - def sendto(self, data: str, address: Tuple[Any, ...]) -> int: ... - @overload - def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ... - def setblocking(self, flag: bool) -> None: ... - def setsockopt(self, level: int, option: int, value: int | str) -> None: ... - def settimeout(self, value: float | None) -> None: ... - def shutdown(self, flag: int) -> None: ... diff --git a/stdlib/@python2/_sre.pyi b/stdlib/@python2/_sre.pyi deleted file mode 100644 index 3bacc09..0000000 --- a/stdlib/@python2/_sre.pyi +++ /dev/null @@ -1,51 +0,0 @@ -from typing import Any, Dict, Iterable, List, Mapping, Sequence, Tuple, overload - -CODESIZE: int -MAGIC: int -MAXREPEAT: long -copyright: str - -class SRE_Match(object): - def start(self, group: int = ...) -> int: ... - def end(self, group: int = ...) -> int: ... - def expand(self, s: str) -> Any: ... - @overload - def group(self) -> str: ... - @overload - def group(self, group: int = ...) -> str | None: ... - def groupdict(self) -> Dict[int, str | None]: ... - def groups(self) -> Tuple[str | None, ...]: ... - def span(self) -> Tuple[int, int]: ... - @property - def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented - -class SRE_Scanner(object): - pattern: str - def match(self) -> SRE_Match: ... - def search(self) -> SRE_Match: ... - -class SRE_Pattern(object): - pattern: str - flags: int - groups: int - groupindex: Mapping[str, int] - indexgroup: Sequence[int] - def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Tuple[Any, ...] | str]: ... - def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Tuple[Any, ...] | str]: ... - def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ... - def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ... - def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ... - def split(self, source: str, maxsplit: int = ...) -> List[str | None]: ... - def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ... - def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ... - -def compile( - pattern: str, - flags: int, - code: List[int], - groups: int = ..., - groupindex: Mapping[str, int] = ..., - indexgroup: Sequence[int] = ..., -) -> SRE_Pattern: ... -def getcodesize() -> int: ... -def getlower(a: int, b: int) -> int: ... diff --git a/stdlib/@python2/_struct.pyi b/stdlib/@python2/_struct.pyi deleted file mode 100644 index 316307e..0000000 --- a/stdlib/@python2/_struct.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import Any, AnyStr, Tuple - -class error(Exception): ... - -class Struct(object): - size: int - format: str - def __init__(self, fmt: str) -> None: ... - def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ... - def pack(self, *args) -> str: ... - def unpack(self, s: str) -> Tuple[Any, ...]: ... - def unpack_from(self, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ... - -def _clearcache() -> None: ... -def calcsize(fmt: str) -> int: ... -def pack(fmt: AnyStr, obj: Any) -> str: ... -def pack_into(fmt: AnyStr, buffer: bytearray, offset: int, obj: Any) -> None: ... -def unpack(fmt: AnyStr, data: str) -> Tuple[Any, ...]: ... -def unpack_from(fmt: AnyStr, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ... diff --git a/stdlib/@python2/_symtable.pyi b/stdlib/@python2/_symtable.pyi deleted file mode 100644 index 5b23704..0000000 --- a/stdlib/@python2/_symtable.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from typing import Dict, List - -CELL: int -DEF_BOUND: int -DEF_FREE: int -DEF_FREE_CLASS: int -DEF_GLOBAL: int -DEF_IMPORT: int -DEF_LOCAL: int -DEF_PARAM: int -FREE: int -GLOBAL_EXPLICIT: int -GLOBAL_IMPLICIT: int -LOCAL: int -OPT_BARE_EXEC: int -OPT_EXEC: int -OPT_IMPORT_STAR: int -SCOPE_MASK: int -SCOPE_OFF: int -TYPE_CLASS: int -TYPE_FUNCTION: int -TYPE_MODULE: int -USE: int - -class _symtable_entry(object): ... - -class symtable(object): - children: List[_symtable_entry] - id: int - lineno: int - name: str - nested: int - optimized: int - symbols: Dict[str, int] - type: int - varnames: List[str] - def __init__(self, src: str, filename: str, startstr: str) -> None: ... diff --git a/stdlib/@python2/_thread.pyi b/stdlib/@python2/_thread.pyi deleted file mode 100644 index 562ece6..0000000 --- a/stdlib/@python2/_thread.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from types import TracebackType -from typing import Any, Callable, Dict, NoReturn, Tuple, Type - -error = RuntimeError - -def _count() -> int: ... - -_dangling: Any - -class LockType: - def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... - def release(self) -> None: ... - def locked(self) -> bool: ... - def __enter__(self) -> bool: ... - def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ... -def interrupt_main() -> None: ... -def exit() -> NoReturn: ... -def allocate_lock() -> LockType: ... -def get_ident() -> int: ... -def stack_size(size: int = ...) -> int: ... - -TIMEOUT_MAX: float diff --git a/stdlib/@python2/_threading_local.pyi b/stdlib/@python2/_threading_local.pyi deleted file mode 100644 index 481d304..0000000 --- a/stdlib/@python2/_threading_local.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -class _localbase(object): ... - -class local(_localbase): - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... - def __del__(self) -> None: ... - -def _patch(self: local) -> None: ... diff --git a/stdlib/@python2/_tkinter.pyi b/stdlib/@python2/_tkinter.pyi deleted file mode 100644 index 378b042..0000000 --- a/stdlib/@python2/_tkinter.pyi +++ /dev/null @@ -1,95 +0,0 @@ -from typing import Any -from typing_extensions import Literal - -# _tkinter is meant to be only used internally by tkinter, but some tkinter -# functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl -# object that hasn't been converted to a string. -# -# There are not many ways to get Tcl_Objs from tkinter, and I'm not sure if the -# only existing ways are supposed to return Tcl_Objs as opposed to returning -# strings. Here's one of these things that return Tcl_Objs: -# -# >>> import tkinter -# >>> text = tkinter.Text() -# >>> text.tag_add('foo', '1.0', 'end') -# >>> text.tag_ranges('foo') -# (, ) -class Tcl_Obj: - string: str # str(tclobj) returns this - typename: str - -class TclError(Exception): ... - -# This class allows running Tcl code. Tkinter uses it internally a lot, and -# it's often handy to drop a piece of Tcl code into a tkinter program. Example: -# -# >>> import tkinter, _tkinter -# >>> tkapp = tkinter.Tk().tk -# >>> isinstance(tkapp, _tkinter.TkappType) -# True -# >>> tkapp.call('set', 'foo', (1,2,3)) -# (1, 2, 3) -# >>> tkapp.eval('return $foo') -# '1 2 3' -# >>> -# -# call args can be pretty much anything. Also, call(some_tuple) is same as call(*some_tuple). -# -# eval always returns str because _tkinter_tkapp_eval_impl in _tkinter.c calls -# Tkapp_UnicodeResult, and it returns a string when it succeeds. -class TkappType: - # Please keep in sync with tkinter.Tk - def call(self, __command: Any, *args: Any) -> Any: ... - def eval(self, __script: str) -> str: ... - adderrorinfo: Any - createcommand: Any - createfilehandler: Any - createtimerhandler: Any - deletecommand: Any - deletefilehandler: Any - dooneevent: Any - evalfile: Any - exprboolean: Any - exprdouble: Any - exprlong: Any - exprstring: Any - getboolean: Any - getdouble: Any - getint: Any - getvar: Any - globalgetvar: Any - globalsetvar: Any - globalunsetvar: Any - interpaddr: Any - loadtk: Any - mainloop: Any - quit: Any - record: Any - setvar: Any - split: Any - splitlist: Any - unsetvar: Any - wantobjects: Any - willdispatch: Any - -# These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS -ALL_EVENTS: Literal[-3] -FILE_EVENTS: Literal[8] -IDLE_EVENTS: Literal[32] -TIMER_EVENTS: Literal[16] -WINDOW_EVENTS: Literal[4] - -DONT_WAIT: Literal[2] -EXCEPTION: Literal[8] -READABLE: Literal[2] -WRITABLE: Literal[4] - -TCL_VERSION: str -TK_VERSION: str - -# TODO: figure out what these are (with e.g. help()) and get rid of Any -TkttType: Any -_flatten: Any -create: Any -getbusywaitinterval: Any -setbusywaitinterval: Any diff --git a/stdlib/@python2/_typeshed/__init__.pyi b/stdlib/@python2/_typeshed/__init__.pyi deleted file mode 100644 index ca698e2..0000000 --- a/stdlib/@python2/_typeshed/__init__.pyi +++ /dev/null @@ -1,162 +0,0 @@ -# Utility types for typeshed - -# This module contains various common types to be used by typeshed. The -# module and its types do not exist at runtime. You can use this module -# outside of typeshed, but no API stability guarantees are made. To use -# it in implementation (.py) files, the following construct must be used: -# -# from typing import TYPE_CHECKING -# if TYPE_CHECKING: -# from _typeshed import ... -# -# If on Python versions < 3.10 and "from __future__ import annotations" -# is not used, types from this module must be quoted. - -import array -import mmap -from typing import Any, Container, Iterable, Protocol, Text, Tuple, TypeVar, Union -from typing_extensions import Literal, final - -_KT = TypeVar("_KT") -_KT_co = TypeVar("_KT_co", covariant=True) -_KT_contra = TypeVar("_KT_contra", contravariant=True) -_VT = TypeVar("_VT") -_VT_co = TypeVar("_VT_co", covariant=True) -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_T_contra = TypeVar("_T_contra", contravariant=True) - -# Use for "self" annotations: -# def __enter__(self: Self) -> Self: ... -Self = TypeVar("Self") # noqa Y001 - -class IdentityFunction(Protocol): - def __call__(self, __x: _T) -> _T: ... - -class SupportsLessThan(Protocol): - def __lt__(self, __other: Any) -> bool: ... - -SupportsLessThanT = TypeVar("SupportsLessThanT", bound=SupportsLessThan) # noqa: Y001 - -class SupportsDivMod(Protocol[_T_contra, _T_co]): - def __divmod__(self, __other: _T_contra) -> _T_co: ... - -class SupportsRDivMod(Protocol[_T_contra, _T_co]): - def __rdivmod__(self, __other: _T_contra) -> _T_co: ... - -# Mapping-like protocols - -class SupportsItems(Protocol[_KT_co, _VT_co]): - # We want dictionaries to support this on Python 2. - def items(self) -> Iterable[Tuple[_KT_co, _VT_co]]: ... - -class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]): - def keys(self) -> Iterable[_KT]: ... - def __getitem__(self, __k: _KT) -> _VT_co: ... - -class SupportsGetItem(Container[_KT_contra], Protocol[_KT_contra, _VT_co]): - def __getitem__(self, __k: _KT_contra) -> _VT_co: ... - -class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra, _VT]): - def __setitem__(self, __k: _KT_contra, __v: _VT) -> None: ... - def __delitem__(self, __v: _KT_contra) -> None: ... - -# These aliases can be used in places where a PathLike object can be used -# instead of a string in Python 3. -StrPath = Text -BytesPath = str -StrOrBytesPath = Text -AnyPath = StrOrBytesPath # obsolete, will be removed soon - -OpenTextModeUpdating = Literal[ - "r+", - "+r", - "rt+", - "r+t", - "+rt", - "tr+", - "t+r", - "+tr", - "w+", - "+w", - "wt+", - "w+t", - "+wt", - "tw+", - "t+w", - "+tw", - "a+", - "+a", - "at+", - "a+t", - "+at", - "ta+", - "t+a", - "+ta", - "x+", - "+x", - "xt+", - "x+t", - "+xt", - "tx+", - "t+x", - "+tx", -] -OpenTextModeWriting = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"] -OpenTextModeReading = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"] -OpenTextMode = Union[OpenTextModeUpdating, OpenTextModeWriting, OpenTextModeReading] -OpenBinaryModeUpdating = Literal[ - "rb+", - "r+b", - "+rb", - "br+", - "b+r", - "+br", - "wb+", - "w+b", - "+wb", - "bw+", - "b+w", - "+bw", - "ab+", - "a+b", - "+ab", - "ba+", - "b+a", - "+ba", - "xb+", - "x+b", - "+xb", - "bx+", - "b+x", - "+bx", -] -OpenBinaryModeWriting = Literal["wb", "bw", "ab", "ba", "xb", "bx"] -OpenBinaryModeReading = Literal["rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr"] -OpenBinaryMode = Union[OpenBinaryModeUpdating, OpenBinaryModeReading, OpenBinaryModeWriting] - -class HasFileno(Protocol): - def fileno(self) -> int: ... - -FileDescriptor = int -FileDescriptorLike = Union[int, HasFileno] - -class SupportsRead(Protocol[_T_co]): - def read(self, __length: int = ...) -> _T_co: ... - -class SupportsReadline(Protocol[_T_co]): - def readline(self, __length: int = ...) -> _T_co: ... - -class SupportsNoArgReadline(Protocol[_T_co]): - def readline(self) -> _T_co: ... - -class SupportsWrite(Protocol[_T_contra]): - def write(self, __s: _T_contra) -> Any: ... - -ReadableBuffer = Union[bytes, bytearray, memoryview, array.array[Any], mmap.mmap, buffer] -WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap, buffer] - -# Used by type checkers for checks involving None (does not exist at runtime) -@final -class NoneType: - def __bool__(self) -> Literal[False]: ... diff --git a/stdlib/@python2/_typeshed/wsgi.pyi b/stdlib/@python2/_typeshed/wsgi.pyi deleted file mode 100644 index a1f1044..0000000 --- a/stdlib/@python2/_typeshed/wsgi.pyi +++ /dev/null @@ -1,35 +0,0 @@ -# Types to support PEP 3333 (WSGI) -# -# This module doesn't exist at runtime and neither do the types defined in this -# file. They are provided for type checking purposes. - -from sys import _OptExcInfo -from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Text, Tuple - -class StartResponse(Protocol): - def __call__( - self, status: str, headers: List[Tuple[str, str]], exc_info: _OptExcInfo | None = ... - ) -> Callable[[bytes], Any]: ... - -WSGIEnvironment = Dict[Text, Any] -WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] - -# WSGI input streams per PEP 3333 -class InputStream(Protocol): - def read(self, size: int = ...) -> bytes: ... - def readline(self, size: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... - def __iter__(self) -> Iterable[bytes]: ... - -# WSGI error streams per PEP 3333 -class ErrorStream(Protocol): - def flush(self) -> None: ... - def write(self, s: str) -> None: ... - def writelines(self, seq: List[str]) -> None: ... - -class _Readable(Protocol): - def read(self, size: int = ...) -> bytes: ... - -# Optional file wrapper in wsgi.file_wrapper -class FileWrapper(Protocol): - def __call__(self, file: _Readable, block_size: int = ...) -> Iterable[bytes]: ... diff --git a/stdlib/@python2/_typeshed/xml.pyi b/stdlib/@python2/_typeshed/xml.pyi deleted file mode 100644 index 6a5d253..0000000 --- a/stdlib/@python2/_typeshed/xml.pyi +++ /dev/null @@ -1,10 +0,0 @@ -# Stub-only types. This module does not exist at runtime. - -from typing import Any -from typing_extensions import Protocol - -# As defined https://docs.python.org/3/library/xml.dom.html#domimplementation-objects -class DOMImplementation(Protocol): - def hasFeature(self, feature: str, version: str | None) -> bool: ... - def createDocument(self, namespaceUri: str, qualifiedName: str, doctype: Any | None) -> Any: ... - def createDocumentType(self, qualifiedName: str, publicId: str, systemId: str) -> Any: ... diff --git a/stdlib/@python2/_warnings.pyi b/stdlib/@python2/_warnings.pyi deleted file mode 100644 index ccc51fe..0000000 --- a/stdlib/@python2/_warnings.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Any, Dict, List, Tuple, Type, overload - -default_action: str -once_registry: Dict[Any, Any] - -filters: List[Tuple[Any, ...]] - -@overload -def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ...) -> None: ... -@overload -def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ... -@overload -def warn_explicit( - message: str, - category: Type[Warning], - filename: str, - lineno: int, - module: str | None = ..., - registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ..., - module_globals: Dict[str, Any] | None = ..., -) -> None: ... -@overload -def warn_explicit( - message: Warning, - category: Any, - filename: str, - lineno: int, - module: str | None = ..., - registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ..., - module_globals: Dict[str, Any] | None = ..., -) -> None: ... diff --git a/stdlib/@python2/_weakref.pyi b/stdlib/@python2/_weakref.pyi deleted file mode 100644 index a283d4c..0000000 --- a/stdlib/@python2/_weakref.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from typing import Any, Callable, Generic, List, TypeVar, overload - -_C = TypeVar("_C", bound=Callable[..., Any]) -_T = TypeVar("_T") - -class CallableProxyType(Generic[_C]): # "weakcallableproxy" - def __getattr__(self, attr: str) -> Any: ... - -class ProxyType(Generic[_T]): # "weakproxy" - def __getattr__(self, attr: str) -> Any: ... - -class ReferenceType(Generic[_T]): - def __init__(self, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> None: ... - def __call__(self) -> _T | None: ... - def __hash__(self) -> int: ... - -ref = ReferenceType - -def getweakrefcount(__object: Any) -> int: ... -def getweakrefs(object: Any) -> List[Any]: ... -@overload -def proxy(object: _C, callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ... - -# Return CallableProxyType if object is callable, ProxyType otherwise -@overload -def proxy(object: _T, callback: Callable[[_T], Any] | None = ...) -> Any: ... diff --git a/stdlib/@python2/_weakrefset.pyi b/stdlib/@python2/_weakrefset.pyi deleted file mode 100644 index f2cde7d..0000000 --- a/stdlib/@python2/_weakrefset.pyi +++ /dev/null @@ -1,41 +0,0 @@ -from typing import Any, Generic, Iterable, Iterator, MutableSet, TypeVar - -_S = TypeVar("_S") -_T = TypeVar("_T") -_SelfT = TypeVar("_SelfT", bound=WeakSet[Any]) - -class WeakSet(MutableSet[_T], Generic[_T]): - def __init__(self, data: Iterable[_T] | None = ...) -> None: ... - def add(self, item: _T) -> None: ... - def clear(self) -> None: ... - def discard(self, item: _T) -> None: ... - def copy(self: _SelfT) -> _SelfT: ... - def pop(self) -> _T: ... - def remove(self, item: _T) -> None: ... - def update(self, other: Iterable[_T]) -> None: ... - def __contains__(self, item: object) -> bool: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[_T]: ... - def __ior__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def difference(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def __sub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def difference_update(self, other: Iterable[_T]) -> None: ... - def __isub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def intersection(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def __and__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def intersection_update(self, other: Iterable[_T]) -> None: ... - def __iand__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def issubset(self, other: Iterable[_T]) -> bool: ... - def __le__(self, other: Iterable[_T]) -> bool: ... - def __lt__(self, other: Iterable[_T]) -> bool: ... - def issuperset(self, other: Iterable[_T]) -> bool: ... - def __ge__(self, other: Iterable[_T]) -> bool: ... - def __gt__(self, other: Iterable[_T]) -> bool: ... - def __eq__(self, other: object) -> bool: ... - def symmetric_difference(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def __xor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def symmetric_difference_update(self, other: Iterable[Any]) -> None: ... - def __ixor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def union(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def __or__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def isdisjoint(self, other: Iterable[_T]) -> bool: ... diff --git a/stdlib/@python2/_winreg.pyi b/stdlib/@python2/_winreg.pyi deleted file mode 100644 index 7297626..0000000 --- a/stdlib/@python2/_winreg.pyi +++ /dev/null @@ -1,96 +0,0 @@ -from types import TracebackType -from typing import Any, Tuple, Type, Union - -_KeyType = Union[HKEYType, int] - -def CloseKey(__hkey: _KeyType) -> None: ... -def ConnectRegistry(__computer_name: str | None, __key: _KeyType) -> HKEYType: ... -def CreateKey(__key: _KeyType, __sub_key: str | None) -> HKEYType: ... -def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = ..., access: int = ...) -> HKEYType: ... -def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ... -def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ... -def DeleteValue(__key: _KeyType, __value: str) -> None: ... -def EnumKey(__key: _KeyType, __index: int) -> str: ... -def EnumValue(__key: _KeyType, __index: int) -> Tuple[str, Any, int]: ... -def ExpandEnvironmentStrings(__str: str) -> str: ... -def FlushKey(__key: _KeyType) -> None: ... -def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ... -def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... -def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... -def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ... -def QueryValue(__key: _KeyType, __sub_key: str | None) -> str: ... -def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ... -def SaveKey(__key: _KeyType, __file_name: str) -> None: ... -def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ... -def SetValueEx( - __key: _KeyType, __value_name: str | None, __reserved: Any, __type: int, __value: str | int -) -> None: ... # reserved is ignored -def DisableReflectionKey(__key: _KeyType) -> None: ... -def EnableReflectionKey(__key: _KeyType) -> None: ... -def QueryReflectionKey(__key: _KeyType) -> bool: ... - -HKEY_CLASSES_ROOT: int -HKEY_CURRENT_USER: int -HKEY_LOCAL_MACHINE: int -HKEY_USERS: int -HKEY_PERFORMANCE_DATA: int -HKEY_CURRENT_CONFIG: int -HKEY_DYN_DATA: int - -KEY_ALL_ACCESS: int -KEY_WRITE: int -KEY_READ: int -KEY_EXECUTE: int -KEY_QUERY_VALUE: int -KEY_SET_VALUE: int -KEY_CREATE_SUB_KEY: int -KEY_ENUMERATE_SUB_KEYS: int -KEY_NOTIFY: int -KEY_CREATE_LINK: int - -KEY_WOW64_64KEY: int -KEY_WOW64_32KEY: int - -REG_BINARY: int -REG_DWORD: int -REG_DWORD_LITTLE_ENDIAN: int -REG_DWORD_BIG_ENDIAN: int -REG_EXPAND_SZ: int -REG_LINK: int -REG_MULTI_SZ: int -REG_NONE: int -REG_RESOURCE_LIST: int -REG_FULL_RESOURCE_DESCRIPTOR: int -REG_RESOURCE_REQUIREMENTS_LIST: int -REG_SZ: int - -REG_CREATED_NEW_KEY: int # undocumented -REG_LEGAL_CHANGE_FILTER: int # undocumented -REG_LEGAL_OPTION: int # undocumented -REG_NOTIFY_CHANGE_ATTRIBUTES: int # undocumented -REG_NOTIFY_CHANGE_LAST_SET: int # undocumented -REG_NOTIFY_CHANGE_NAME: int # undocumented -REG_NOTIFY_CHANGE_SECURITY: int # undocumented -REG_NO_LAZY_FLUSH: int # undocumented -REG_OPENED_EXISTING_KEY: int # undocumented -REG_OPTION_BACKUP_RESTORE: int # undocumented -REG_OPTION_CREATE_LINK: int # undocumented -REG_OPTION_NON_VOLATILE: int # undocumented -REG_OPTION_OPEN_LINK: int # undocumented -REG_OPTION_RESERVED: int # undocumented -REG_OPTION_VOLATILE: int # undocumented -REG_REFRESH_HIVE: int # undocumented -REG_WHOLE_HIVE_VOLATILE: int # undocumented - -error = OSError - -# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason -class HKEYType: - def __bool__(self) -> bool: ... - def __int__(self) -> int: ... - def __enter__(self) -> HKEYType: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def Close(self) -> None: ... - def Detach(self) -> int: ... diff --git a/stdlib/@python2/abc.pyi b/stdlib/@python2/abc.pyi deleted file mode 100644 index ac14246..0000000 --- a/stdlib/@python2/abc.pyi +++ /dev/null @@ -1,31 +0,0 @@ -import _weakrefset -from _typeshed import SupportsWrite -from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar - -_FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) - -# NOTE: mypy has special processing for ABCMeta and abstractmethod. - -def abstractmethod(funcobj: _FuncT) -> _FuncT: ... - -class ABCMeta(type): - __abstractmethods__: frozenset[str] - _abc_cache: _weakrefset.WeakSet[Any] - _abc_invalidation_counter: int - _abc_negative_cache: _weakrefset.WeakSet[Any] - _abc_negative_cache_version: int - _abc_registry: _weakrefset.WeakSet[Any] - def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> None: ... - def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ... - def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ... - def _dump_registry(cls: ABCMeta, file: SupportsWrite[Any] | None = ...) -> None: ... - def register(cls: ABCMeta, subclass: Type[Any]) -> None: ... - -# TODO: The real abc.abstractproperty inherits from "property". -class abstractproperty(object): - def __new__(cls, func: Any) -> Any: ... - __isabstractmethod__: bool - doc: Any - fdel: Any - fget: Any - fset: Any diff --git a/stdlib/@python2/aifc.pyi b/stdlib/@python2/aifc.pyi deleted file mode 100644 index 42f20b7..0000000 --- a/stdlib/@python2/aifc.pyi +++ /dev/null @@ -1,74 +0,0 @@ -from typing import IO, Any, List, NamedTuple, Text, Tuple, Union, overload -from typing_extensions import Literal - -class Error(Exception): ... - -class _aifc_params(NamedTuple): - nchannels: int - sampwidth: int - framerate: int - nframes: int - comptype: bytes - compname: bytes - -_File = Union[Text, IO[bytes]] -_Marker = Tuple[int, int, bytes] - -class Aifc_read: - def __init__(self, f: _File) -> None: ... - def initfp(self, file: IO[bytes]) -> None: ... - def getfp(self) -> IO[bytes]: ... - def rewind(self) -> None: ... - def close(self) -> None: ... - def tell(self) -> int: ... - def getnchannels(self) -> int: ... - def getnframes(self) -> int: ... - def getsampwidth(self) -> int: ... - def getframerate(self) -> int: ... - def getcomptype(self) -> bytes: ... - def getcompname(self) -> bytes: ... - def getparams(self) -> _aifc_params: ... - def getmarkers(self) -> List[_Marker] | None: ... - def getmark(self, id: int) -> _Marker: ... - def setpos(self, pos: int) -> None: ... - def readframes(self, nframes: int) -> bytes: ... - -class Aifc_write: - def __init__(self, f: _File) -> None: ... - def __del__(self) -> None: ... - def initfp(self, file: IO[bytes]) -> None: ... - def aiff(self) -> None: ... - def aifc(self) -> None: ... - def setnchannels(self, nchannels: int) -> None: ... - def getnchannels(self) -> int: ... - def setsampwidth(self, sampwidth: int) -> None: ... - def getsampwidth(self) -> int: ... - def setframerate(self, framerate: int) -> None: ... - def getframerate(self) -> int: ... - def setnframes(self, nframes: int) -> None: ... - def getnframes(self) -> int: ... - def setcomptype(self, comptype: bytes, compname: bytes) -> None: ... - def getcomptype(self) -> bytes: ... - def getcompname(self) -> bytes: ... - def setparams(self, params: Tuple[int, int, int, int, bytes, bytes]) -> None: ... - def getparams(self) -> _aifc_params: ... - def setmark(self, id: int, pos: int, name: bytes) -> None: ... - def getmark(self, id: int) -> _Marker: ... - def getmarkers(self) -> List[_Marker] | None: ... - def tell(self) -> int: ... - def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol - def writeframes(self, data: Any) -> None: ... - def close(self) -> None: ... - -@overload -def open(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ... -@overload -def open(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ... -@overload -def open(f: _File, mode: str | None = ...) -> Any: ... -@overload -def openfp(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ... -@overload -def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ... -@overload -def openfp(f: _File, mode: str | None = ...) -> Any: ... diff --git a/stdlib/@python2/argparse.pyi b/stdlib/@python2/argparse.pyi deleted file mode 100644 index 4d77f65..0000000 --- a/stdlib/@python2/argparse.pyi +++ /dev/null @@ -1,371 +0,0 @@ -from typing import ( - IO, - Any, - Callable, - Dict, - Generator, - Iterable, - List, - NoReturn, - Pattern, - Protocol, - Sequence, - Text, - Tuple, - Type, - TypeVar, - Union, - overload, -) - -_T = TypeVar("_T") -_ActionT = TypeVar("_ActionT", bound=Action) -_N = TypeVar("_N") - -_Text = Union[str, unicode] - -ONE_OR_MORE: str -OPTIONAL: str -PARSER: str -REMAINDER: str -SUPPRESS: str -ZERO_OR_MORE: str -_UNRECOGNIZED_ARGS_ATTR: str # undocumented - -class ArgumentError(Exception): - argument_name: str | None - message: str - def __init__(self, argument: Action | None, message: str) -> None: ... - -# undocumented -class _AttributeHolder: - def _get_kwargs(self) -> List[Tuple[str, Any]]: ... - def _get_args(self) -> List[Any]: ... - -# undocumented -class _ActionsContainer: - description: _Text | None - prefix_chars: _Text - argument_default: Any - conflict_handler: _Text - - _registries: Dict[_Text, Dict[Any, Any]] - _actions: List[Action] - _option_string_actions: Dict[_Text, Action] - _action_groups: List[_ArgumentGroup] - _mutually_exclusive_groups: List[_MutuallyExclusiveGroup] - _defaults: Dict[str, Any] - _negative_number_matcher: Pattern[str] - _has_negative_number_optionals: List[bool] - def __init__(self, description: Text | None, prefix_chars: Text, argument_default: Any, conflict_handler: Text) -> None: ... - def register(self, registry_name: Text, value: Any, object: Any) -> None: ... - def _registry_get(self, registry_name: Text, value: Any, default: Any = ...) -> Any: ... - def set_defaults(self, **kwargs: Any) -> None: ... - def get_default(self, dest: Text) -> Any: ... - def add_argument( - self, - *name_or_flags: Text, - action: Text | Type[Action] = ..., - nargs: int | Text = ..., - const: Any = ..., - default: Any = ..., - type: Callable[[Text], _T] | Callable[[str], _T] | FileType = ..., - choices: Iterable[_T] = ..., - required: bool = ..., - help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., - dest: Text | None = ..., - version: Text = ..., - **kwargs: Any, - ) -> Action: ... - def add_argument_group(self, *args: Any, **kwargs: Any) -> _ArgumentGroup: ... - def add_mutually_exclusive_group(self, **kwargs: Any) -> _MutuallyExclusiveGroup: ... - def _add_action(self, action: _ActionT) -> _ActionT: ... - def _remove_action(self, action: Action) -> None: ... - def _add_container_actions(self, container: _ActionsContainer) -> None: ... - def _get_positional_kwargs(self, dest: Text, **kwargs: Any) -> Dict[str, Any]: ... - def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ... - def _pop_action_class(self, kwargs: Any, default: Type[Action] | None = ...) -> Type[Action]: ... - def _get_handler(self) -> Callable[[Action, Iterable[Tuple[Text, Action]]], Any]: ... - def _check_conflict(self, action: Action) -> None: ... - def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> NoReturn: ... - def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> None: ... - -class _FormatterClass(Protocol): - def __call__(self, prog: str) -> HelpFormatter: ... - -class ArgumentParser(_AttributeHolder, _ActionsContainer): - prog: _Text - usage: _Text | None - epilog: _Text | None - formatter_class: _FormatterClass - fromfile_prefix_chars: _Text | None - add_help: bool - - # undocumented - _positionals: _ArgumentGroup - _optionals: _ArgumentGroup - _subparsers: _ArgumentGroup | None - def __init__( - self, - prog: Text | None = ..., - usage: Text | None = ..., - description: Text | None = ..., - epilog: Text | None = ..., - parents: Sequence[ArgumentParser] = ..., - formatter_class: _FormatterClass = ..., - prefix_chars: Text = ..., - fromfile_prefix_chars: Text | None = ..., - argument_default: Any = ..., - conflict_handler: Text = ..., - add_help: bool = ..., - ) -> None: ... - # The type-ignores in these overloads should be temporary. See: - # https://github.com/python/typeshed/pull/2643#issuecomment-442280277 - @overload - def parse_args(self, args: Sequence[Text] | None = ...) -> Namespace: ... - @overload - def parse_args(self, args: Sequence[Text] | None, namespace: None) -> Namespace: ... # type: ignore - @overload - def parse_args(self, args: Sequence[Text] | None, namespace: _N) -> _N: ... - @overload - def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore - @overload - def parse_args(self, *, namespace: _N) -> _N: ... - def add_subparsers( - self, - *, - title: Text = ..., - description: Text | None = ..., - prog: Text = ..., - parser_class: Type[ArgumentParser] = ..., - action: Type[Action] = ..., - option_string: Text = ..., - dest: Text | None = ..., - help: Text | None = ..., - metavar: Text | None = ..., - ) -> _SubParsersAction: ... - def print_usage(self, file: IO[str] | None = ...) -> None: ... - def print_help(self, file: IO[str] | None = ...) -> None: ... - def format_usage(self) -> str: ... - def format_help(self) -> str: ... - def parse_known_args( - self, args: Sequence[Text] | None = ..., namespace: Namespace | None = ... - ) -> Tuple[Namespace, List[str]]: ... - def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ... - def exit(self, status: int = ..., message: Text | None = ...) -> NoReturn: ... - def error(self, message: Text) -> NoReturn: ... - # undocumented - def _get_optional_actions(self) -> List[Action]: ... - def _get_positional_actions(self) -> List[Action]: ... - def _parse_known_args(self, arg_strings: List[Text], namespace: Namespace) -> Tuple[Namespace, List[str]]: ... - def _read_args_from_files(self, arg_strings: List[Text]) -> List[Text]: ... - def _match_argument(self, action: Action, arg_strings_pattern: Text) -> int: ... - def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: Text) -> List[int]: ... - def _parse_optional(self, arg_string: Text) -> Tuple[Action | None, Text, Text | None] | None: ... - def _get_option_tuples(self, option_string: Text) -> List[Tuple[Action, Text, Text | None]]: ... - def _get_nargs_pattern(self, action: Action) -> _Text: ... - def _get_values(self, action: Action, arg_strings: List[Text]) -> Any: ... - def _get_value(self, action: Action, arg_string: Text) -> Any: ... - def _check_value(self, action: Action, value: Any) -> None: ... - def _get_formatter(self) -> HelpFormatter: ... - def _print_message(self, message: str, file: IO[str] | None = ...) -> None: ... - -class HelpFormatter: - # undocumented - _prog: _Text - _indent_increment: int - _max_help_position: int - _width: int - _current_indent: int - _level: int - _action_max_length: int - _root_section: Any - _current_section: Any - _whitespace_matcher: Pattern[str] - _long_break_matcher: Pattern[str] - _Section: Type[Any] # Nested class - def __init__( - self, prog: Text, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ... - ) -> None: ... - def _indent(self) -> None: ... - def _dedent(self) -> None: ... - def _add_item(self, func: Callable[..., _Text], args: Iterable[Any]) -> None: ... - def start_section(self, heading: Text | None) -> None: ... - def end_section(self) -> None: ... - def add_text(self, text: Text | None) -> None: ... - def add_usage( - self, usage: Text | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Text | None = ... - ) -> None: ... - def add_argument(self, action: Action) -> None: ... - def add_arguments(self, actions: Iterable[Action]) -> None: ... - def format_help(self) -> _Text: ... - def _join_parts(self, part_strings: Iterable[Text]) -> _Text: ... - def _format_usage( - self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Text | None - ) -> _Text: ... - def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> _Text: ... - def _format_text(self, text: Text) -> _Text: ... - def _format_action(self, action: Action) -> _Text: ... - def _format_action_invocation(self, action: Action) -> _Text: ... - def _metavar_formatter(self, action: Action, default_metavar: Text) -> Callable[[int], Tuple[_Text, ...]]: ... - def _format_args(self, action: Action, default_metavar: Text) -> _Text: ... - def _expand_help(self, action: Action) -> _Text: ... - def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ... - def _split_lines(self, text: Text, width: int) -> List[_Text]: ... - def _fill_text(self, text: Text, width: int, indent: Text) -> _Text: ... - def _get_help_string(self, action: Action) -> _Text | None: ... - def _get_default_metavar_for_optional(self, action: Action) -> _Text: ... - def _get_default_metavar_for_positional(self, action: Action) -> _Text: ... - -class RawDescriptionHelpFormatter(HelpFormatter): ... -class RawTextHelpFormatter(RawDescriptionHelpFormatter): ... -class ArgumentDefaultsHelpFormatter(HelpFormatter): ... - -class Action(_AttributeHolder): - option_strings: Sequence[_Text] - dest: _Text - nargs: int | _Text | None - const: Any - default: Any - type: Callable[[str], Any] | FileType | None - choices: Iterable[Any] | None - required: bool - help: _Text | None - metavar: _Text | Tuple[_Text, ...] | None - def __init__( - self, - option_strings: Sequence[Text], - dest: Text, - nargs: int | Text | None = ..., - const: _T | None = ..., - default: _T | str | None = ..., - type: Callable[[Text], _T] | Callable[[str], _T] | FileType | None = ..., - choices: Iterable[_T] | None = ..., - required: bool = ..., - help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., - ) -> None: ... - def __call__( - self, parser: ArgumentParser, namespace: Namespace, values: Text | Sequence[Any] | None, option_string: Text | None = ... - ) -> None: ... - -class Namespace(_AttributeHolder): - def __init__(self, **kwargs: Any) -> None: ... - def __getattr__(self, name: Text) -> Any: ... - def __setattr__(self, name: Text, value: Any) -> None: ... - def __contains__(self, key: str) -> bool: ... - -class FileType: - # undocumented - _mode: _Text - _bufsize: int - def __init__(self, mode: Text = ..., bufsize: int | None = ...) -> None: ... - def __call__(self, string: Text) -> IO[Any]: ... - -# undocumented -class _ArgumentGroup(_ActionsContainer): - title: _Text | None - _group_actions: List[Action] - def __init__( - self, container: _ActionsContainer, title: Text | None = ..., description: Text | None = ..., **kwargs: Any - ) -> None: ... - -# undocumented -class _MutuallyExclusiveGroup(_ArgumentGroup): - required: bool - _container: _ActionsContainer - def __init__(self, container: _ActionsContainer, required: bool = ...) -> None: ... - -# undocumented -class _StoreAction(Action): ... - -# undocumented -class _StoreConstAction(Action): - def __init__( - self, - option_strings: Sequence[Text], - dest: Text, - const: Any, - default: Any = ..., - required: bool = ..., - help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., - ) -> None: ... - -# undocumented -class _StoreTrueAction(_StoreConstAction): - def __init__( - self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Text | None = ... - ) -> None: ... - -# undocumented -class _StoreFalseAction(_StoreConstAction): - def __init__( - self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Text | None = ... - ) -> None: ... - -# undocumented -class _AppendAction(Action): ... - -# undocumented -class _AppendConstAction(Action): - def __init__( - self, - option_strings: Sequence[Text], - dest: Text, - const: Any, - default: Any = ..., - required: bool = ..., - help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., - ) -> None: ... - -# undocumented -class _CountAction(Action): - def __init__( - self, option_strings: Sequence[Text], dest: Text, default: Any = ..., required: bool = ..., help: Text | None = ... - ) -> None: ... - -# undocumented -class _HelpAction(Action): - def __init__( - self, option_strings: Sequence[Text], dest: Text = ..., default: Text = ..., help: Text | None = ... - ) -> None: ... - -# undocumented -class _VersionAction(Action): - version: _Text | None - def __init__( - self, option_strings: Sequence[Text], version: Text | None = ..., dest: Text = ..., default: Text = ..., help: Text = ... - ) -> None: ... - -# undocumented -class _SubParsersAction(Action): - _ChoicesPseudoAction: Type[Any] # nested class - _prog_prefix: _Text - _parser_class: Type[ArgumentParser] - _name_parser_map: Dict[_Text, ArgumentParser] - choices: Dict[_Text, ArgumentParser] - _choices_actions: List[Action] - def __init__( - self, - option_strings: Sequence[Text], - prog: Text, - parser_class: Type[ArgumentParser], - dest: Text = ..., - help: Text | None = ..., - metavar: Text | Tuple[Text, ...] | None = ..., - ) -> None: ... - # TODO: Type keyword args properly. - def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ... - def _get_subactions(self) -> List[Action]: ... - -# undocumented -class ArgumentTypeError(Exception): ... - -# undocumented -def _ensure_value(namespace: Namespace, name: Text, value: Any) -> Any: ... - -# undocumented -def _get_action_name(argument: Action | None) -> str | None: ... diff --git a/stdlib/@python2/array.pyi b/stdlib/@python2/array.pyi deleted file mode 100644 index 39670fe..0000000 --- a/stdlib/@python2/array.pyi +++ /dev/null @@ -1,65 +0,0 @@ -from typing import Any, BinaryIO, Generic, Iterable, List, MutableSequence, Text, Tuple, TypeVar, Union, overload -from typing_extensions import Literal - -_IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] -_FloatTypeCode = Literal["f", "d"] -_UnicodeTypeCode = Literal["u"] -_TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode] - -_T = TypeVar("_T", int, float, Text) - -class array(MutableSequence[_T], Generic[_T]): - typecode: _TypeCode - itemsize: int - @overload - def __init__(self: array[int], typecode: _IntTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ... - @overload - def __init__(self: array[float], typecode: _FloatTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ... - @overload - def __init__(self: array[Text], typecode: _UnicodeTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ... - @overload - def __init__(self, typecode: str, __initializer: bytes | Iterable[_T] = ...) -> None: ... - def append(self, __v: _T) -> None: ... - def buffer_info(self) -> Tuple[int, int]: ... - def byteswap(self) -> None: ... - def count(self, __v: Any) -> int: ... - def extend(self, __bb: Iterable[_T]) -> None: ... - def fromfile(self, __f: BinaryIO, __n: int) -> None: ... - def fromlist(self, __list: List[_T]) -> None: ... - def fromunicode(self, __ustr: str) -> None: ... - def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence - def insert(self, __i: int, __v: _T) -> None: ... - def pop(self, __i: int = ...) -> _T: ... - def read(self, f: BinaryIO, n: int) -> None: ... - def remove(self, __v: Any) -> None: ... - def reverse(self) -> None: ... - def tofile(self, __f: BinaryIO) -> None: ... - def tolist(self) -> List[_T]: ... - def tounicode(self) -> str: ... - def write(self, f: BinaryIO) -> None: ... - def fromstring(self, __buffer: bytes) -> None: ... - def tostring(self) -> bytes: ... - def __len__(self) -> int: ... - @overload - def __getitem__(self, i: int) -> _T: ... - @overload - def __getitem__(self, s: slice) -> array[_T]: ... - @overload # type: ignore # Overrides MutableSequence - def __setitem__(self, i: int, o: _T) -> None: ... - @overload - def __setitem__(self, s: slice, o: array[_T]) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __add__(self, x: array[_T]) -> array[_T]: ... - def __ge__(self, other: array[_T]) -> bool: ... - def __gt__(self, other: array[_T]) -> bool: ... - def __iadd__(self, x: array[_T]) -> array[_T]: ... # type: ignore # Overrides MutableSequence - def __imul__(self, n: int) -> array[_T]: ... - def __le__(self, other: array[_T]) -> bool: ... - def __lt__(self, other: array[_T]) -> bool: ... - def __mul__(self, n: int) -> array[_T]: ... - def __rmul__(self, n: int) -> array[_T]: ... - def __delslice__(self, i: int, j: int) -> None: ... - def __getslice__(self, i: int, j: int) -> array[_T]: ... - def __setslice__(self, i: int, j: int, y: array[_T]) -> None: ... - -ArrayType = array diff --git a/stdlib/@python2/ast.pyi b/stdlib/@python2/ast.pyi deleted file mode 100644 index ec370e1..0000000 --- a/stdlib/@python2/ast.pyi +++ /dev/null @@ -1,28 +0,0 @@ -# Python 2.7 ast - -# Rename typing to _typing, as not to conflict with typing imported -# from _ast below when loaded in an unorthodox way by the Dropbox -# internal Bazel integration. -import typing as _typing -from typing import Any, Iterator - -from _ast import * -from _ast import AST, Module - -def parse(source: str | unicode, filename: str | unicode = ..., mode: str | unicode = ...) -> Module: ... -def copy_location(new_node: AST, old_node: AST) -> AST: ... -def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... -def fix_missing_locations(node: AST) -> AST: ... -def get_docstring(node: AST, clean: bool = ...) -> str: ... -def increment_lineno(node: AST, n: int = ...) -> AST: ... -def iter_child_nodes(node: AST) -> Iterator[AST]: ... -def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ... -def literal_eval(node_or_string: str | unicode | AST) -> Any: ... -def walk(node: AST) -> Iterator[AST]: ... - -class NodeVisitor: - def visit(self, node: AST) -> Any: ... - def generic_visit(self, node: AST) -> Any: ... - -class NodeTransformer(NodeVisitor): - def generic_visit(self, node: AST) -> AST | None: ... diff --git a/stdlib/@python2/asynchat.pyi b/stdlib/@python2/asynchat.pyi deleted file mode 100644 index 0f5526d..0000000 --- a/stdlib/@python2/asynchat.pyi +++ /dev/null @@ -1,37 +0,0 @@ -import asyncore -import socket -from abc import abstractmethod -from typing import Sequence, Tuple - -class simple_producer: - def __init__(self, data: bytes, buffer_size: int = ...) -> None: ... - def more(self) -> bytes: ... - -class async_chat(asyncore.dispatcher): - ac_in_buffer_size: int - ac_out_buffer_size: int - def __init__(self, sock: socket.socket | None = ..., map: asyncore._maptype | None = ...) -> None: ... - @abstractmethod - def collect_incoming_data(self, data: bytes) -> None: ... - @abstractmethod - def found_terminator(self) -> None: ... - def set_terminator(self, term: bytes | int | None) -> None: ... - def get_terminator(self) -> bytes | int | None: ... - def handle_read(self) -> None: ... - def handle_write(self) -> None: ... - def handle_close(self) -> None: ... - def push(self, data: bytes) -> None: ... - def push_with_producer(self, producer: simple_producer) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def close_when_done(self) -> None: ... - def initiate_send(self) -> None: ... - def discard_buffers(self) -> None: ... - -class fifo: - def __init__(self, list: Sequence[bytes | simple_producer] = ...) -> None: ... - def __len__(self) -> int: ... - def is_empty(self) -> bool: ... - def first(self) -> bytes: ... - def push(self, data: bytes | simple_producer) -> None: ... - def pop(self) -> Tuple[int, bytes]: ... diff --git a/stdlib/@python2/asyncore.pyi b/stdlib/@python2/asyncore.pyi deleted file mode 100644 index 95acf9b..0000000 --- a/stdlib/@python2/asyncore.pyi +++ /dev/null @@ -1,118 +0,0 @@ -import sys -from _typeshed import FileDescriptorLike -from socket import SocketType -from typing import Any, Dict, Optional, Tuple, overload - -# cyclic dependence with asynchat -_maptype = Dict[int, Any] - -socket_map: _maptype = ... # undocumented - -class ExitNow(Exception): ... - -def read(obj: Any) -> None: ... -def write(obj: Any) -> None: ... -def readwrite(obj: Any, flags: int) -> None: ... -def poll(timeout: float = ..., map: _maptype | None = ...) -> None: ... -def poll2(timeout: float = ..., map: _maptype | None = ...) -> None: ... - -poll3 = poll2 - -def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype | None = ..., count: int | None = ...) -> None: ... - -# Not really subclass of socket.socket; it's only delegation. -# It is not covariant to it. -class dispatcher: - - debug: bool - connected: bool - accepting: bool - connecting: bool - closing: bool - ignore_log_types: frozenset[str] - socket: SocketType | None - def __init__(self, sock: SocketType | None = ..., map: _maptype | None = ...) -> None: ... - def add_channel(self, map: _maptype | None = ...) -> None: ... - def del_channel(self, map: _maptype | None = ...) -> None: ... - def create_socket(self, family: int = ..., type: int = ...) -> None: ... - def set_socket(self, sock: SocketType, map: _maptype | None = ...) -> None: ... - def set_reuse_addr(self) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def listen(self, num: int) -> None: ... - def bind(self, addr: Tuple[Any, ...] | str) -> None: ... - def connect(self, address: Tuple[Any, ...] | str) -> None: ... - def accept(self) -> Tuple[SocketType, Any] | None: ... - def send(self, data: bytes) -> int: ... - def recv(self, buffer_size: int) -> bytes: ... - def close(self) -> None: ... - def log(self, message: Any) -> None: ... - def log_info(self, message: Any, type: str = ...) -> None: ... - def handle_read_event(self) -> None: ... - def handle_connect_event(self) -> None: ... - def handle_write_event(self) -> None: ... - def handle_expt_event(self) -> None: ... - def handle_error(self) -> None: ... - def handle_expt(self) -> None: ... - def handle_read(self) -> None: ... - def handle_write(self) -> None: ... - def handle_connect(self) -> None: ... - def handle_accept(self) -> None: ... - def handle_close(self) -> None: ... - # Historically, some methods were "imported" from `self.socket` by - # means of `__getattr__`. This was long deprecated, and as of Python - # 3.5 has been removed; simply call the relevant methods directly on - # self.socket if necessary. - def detach(self) -> int: ... - def fileno(self) -> int: ... - # return value is an address - def getpeername(self) -> Any: ... - def getsockname(self) -> Any: ... - @overload - def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ... - @overload - def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - def gettimeout(self) -> float: ... - def ioctl(self, control: object, option: Tuple[int, int, int]) -> None: ... - # TODO the return value may be BinaryIO or TextIO, depending on mode - def makefile( - self, mode: str = ..., buffering: int = ..., encoding: str = ..., errors: str = ..., newline: str = ... - ) -> Any: ... - # return type is an address - def recvfrom(self, bufsize: int, flags: int = ...) -> Any: ... - def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ... - def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ... - def sendall(self, data: bytes, flags: int = ...) -> None: ... - def sendto(self, data: bytes, address: Tuple[str, int] | str, flags: int = ...) -> int: ... - def setblocking(self, flag: bool) -> None: ... - def settimeout(self, value: float | None) -> None: ... - def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ... - def shutdown(self, how: int) -> None: ... - -class dispatcher_with_send(dispatcher): - def __init__(self, sock: SocketType = ..., map: _maptype | None = ...) -> None: ... - def initiate_send(self) -> None: ... - def handle_write(self) -> None: ... - # incompatible signature: - # def send(self, data: bytes) -> Optional[int]: ... - -def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ... -def close_all(map: _maptype | None = ..., ignore_all: bool = ...) -> None: ... - -if sys.platform != "win32": - class file_wrapper: - fd: int - def __init__(self, fd: int) -> None: ... - def recv(self, bufsize: int, flags: int = ...) -> bytes: ... - def send(self, data: bytes, flags: int = ...) -> int: ... - @overload - def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ... - @overload - def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - def read(self, bufsize: int, flags: int = ...) -> bytes: ... - def write(self, data: bytes, flags: int = ...) -> int: ... - def close(self) -> None: ... - def fileno(self) -> int: ... - class file_dispatcher(dispatcher): - def __init__(self, fd: FileDescriptorLike, map: _maptype | None = ...) -> None: ... - def set_file(self, fd: int) -> None: ... diff --git a/stdlib/@python2/atexit.pyi b/stdlib/@python2/atexit.pyi deleted file mode 100644 index 2336bf9..0000000 --- a/stdlib/@python2/atexit.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import Any, TypeVar - -_FT = TypeVar("_FT") - -def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ... diff --git a/stdlib/@python2/audioop.pyi b/stdlib/@python2/audioop.pyi deleted file mode 100644 index 71671af..0000000 --- a/stdlib/@python2/audioop.pyi +++ /dev/null @@ -1,42 +0,0 @@ -from typing import Tuple - -AdpcmState = Tuple[int, int] -RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]] - -class error(Exception): ... - -def add(__fragment1: bytes, __fragment2: bytes, __width: int) -> bytes: ... -def adpcm2lin(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ... -def alaw2lin(__fragment: bytes, __width: int) -> bytes: ... -def avg(__fragment: bytes, __width: int) -> int: ... -def avgpp(__fragment: bytes, __width: int) -> int: ... -def bias(__fragment: bytes, __width: int, __bias: int) -> bytes: ... -def byteswap(__fragment: bytes, __width: int) -> bytes: ... -def cross(__fragment: bytes, __width: int) -> int: ... -def findfactor(__fragment: bytes, __reference: bytes) -> float: ... -def findfit(__fragment: bytes, __reference: bytes) -> Tuple[int, float]: ... -def findmax(__fragment: bytes, __length: int) -> int: ... -def getsample(__fragment: bytes, __width: int, __index: int) -> int: ... -def lin2adpcm(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ... -def lin2alaw(__fragment: bytes, __width: int) -> bytes: ... -def lin2lin(__fragment: bytes, __width: int, __newwidth: int) -> bytes: ... -def lin2ulaw(__fragment: bytes, __width: int) -> bytes: ... -def max(__fragment: bytes, __width: int) -> int: ... -def maxpp(__fragment: bytes, __width: int) -> int: ... -def minmax(__fragment: bytes, __width: int) -> Tuple[int, int]: ... -def mul(__fragment: bytes, __width: int, __factor: float) -> bytes: ... -def ratecv( - __fragment: bytes, - __width: int, - __nchannels: int, - __inrate: int, - __outrate: int, - __state: RatecvState | None, - __weightA: int = ..., - __weightB: int = ..., -) -> Tuple[bytes, RatecvState]: ... -def reverse(__fragment: bytes, __width: int) -> bytes: ... -def rms(__fragment: bytes, __width: int) -> int: ... -def tomono(__fragment: bytes, __width: int, __lfactor: float, __rfactor: float) -> bytes: ... -def tostereo(__fragment: bytes, __width: int, __lfactor: float, __rfactor: float) -> bytes: ... -def ulaw2lin(__fragment: bytes, __width: int) -> bytes: ... diff --git a/stdlib/@python2/base64.pyi b/stdlib/@python2/base64.pyi deleted file mode 100644 index 00856aa..0000000 --- a/stdlib/@python2/base64.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import IO, Union - -_encodable = Union[bytes, unicode] -_decodable = Union[bytes, unicode] - -def b64encode(s: _encodable, altchars: bytes | None = ...) -> bytes: ... -def b64decode(s: _decodable, altchars: bytes | None = ..., validate: bool = ...) -> bytes: ... -def standard_b64encode(s: _encodable) -> bytes: ... -def standard_b64decode(s: _decodable) -> bytes: ... -def urlsafe_b64encode(s: _encodable) -> bytes: ... -def urlsafe_b64decode(s: _decodable) -> bytes: ... -def b32encode(s: _encodable) -> bytes: ... -def b32decode(s: _decodable, casefold: bool = ..., map01: bytes | None = ...) -> bytes: ... -def b16encode(s: _encodable) -> bytes: ... -def b16decode(s: _decodable, casefold: bool = ...) -> bytes: ... -def decode(input: IO[bytes], output: IO[bytes]) -> None: ... -def encode(input: IO[bytes], output: IO[bytes]) -> None: ... -def encodestring(s: bytes) -> bytes: ... -def decodestring(s: bytes) -> bytes: ... diff --git a/stdlib/@python2/bdb.pyi b/stdlib/@python2/bdb.pyi deleted file mode 100644 index 5bee9da..0000000 --- a/stdlib/@python2/bdb.pyi +++ /dev/null @@ -1,94 +0,0 @@ -from types import CodeType, FrameType, TracebackType -from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, Set, SupportsInt, Tuple, Type, TypeVar - -_T = TypeVar("_T") -_TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type -_ExcInfo = Tuple[Type[BaseException], BaseException, FrameType] - -GENERATOR_AND_COROUTINE_FLAGS: int = ... - -class BdbQuit(Exception): ... - -class Bdb: - - skip: Set[str] | None - breaks: Dict[str, List[int]] - fncache: Dict[str, str] - frame_returning: FrameType | None - botframe: FrameType | None - quitting: bool - stopframe: FrameType | None - returnframe: FrameType | None - stoplineno: int - def __init__(self, skip: Iterable[str] | None = ...) -> None: ... - def canonic(self, filename: str) -> str: ... - def reset(self) -> None: ... - def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> _TraceDispatch: ... - def dispatch_line(self, frame: FrameType) -> _TraceDispatch: ... - def dispatch_call(self, frame: FrameType, arg: None) -> _TraceDispatch: ... - def dispatch_return(self, frame: FrameType, arg: Any) -> _TraceDispatch: ... - def dispatch_exception(self, frame: FrameType, arg: _ExcInfo) -> _TraceDispatch: ... - def is_skipped_module(self, module_name: str) -> bool: ... - def stop_here(self, frame: FrameType) -> bool: ... - def break_here(self, frame: FrameType) -> bool: ... - def do_clear(self, arg: Any) -> bool | None: ... - def break_anywhere(self, frame: FrameType) -> bool: ... - def user_call(self, frame: FrameType, argument_list: None) -> None: ... - def user_line(self, frame: FrameType) -> None: ... - def user_return(self, frame: FrameType, return_value: Any) -> None: ... - def user_exception(self, frame: FrameType, exc_info: _ExcInfo) -> None: ... - def set_until(self, frame: FrameType, lineno: int | None = ...) -> None: ... - def set_step(self) -> None: ... - def set_next(self, frame: FrameType) -> None: ... - def set_return(self, frame: FrameType) -> None: ... - def set_trace(self, frame: FrameType | None = ...) -> None: ... - def set_continue(self) -> None: ... - def set_quit(self) -> None: ... - def set_break( - self, filename: str, lineno: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ... - ) -> None: ... - def clear_break(self, filename: str, lineno: int) -> None: ... - def clear_bpbynumber(self, arg: SupportsInt) -> None: ... - def clear_all_file_breaks(self, filename: str) -> None: ... - def clear_all_breaks(self) -> None: ... - def get_bpbynumber(self, arg: SupportsInt) -> Breakpoint: ... - def get_break(self, filename: str, lineno: int) -> bool: ... - def get_breaks(self, filename: str, lineno: int) -> List[Breakpoint]: ... - def get_file_breaks(self, filename: str) -> List[Breakpoint]: ... - def get_all_breaks(self) -> List[Breakpoint]: ... - def get_stack(self, f: FrameType | None, t: TracebackType | None) -> Tuple[List[Tuple[FrameType, int]], int]: ... - def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ... - def run(self, cmd: str | CodeType, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runeval(self, expr: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runctx(self, cmd: str | CodeType, globals: Dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... - -class Breakpoint: - - next: int = ... - bplist: Dict[Tuple[str, int], List[Breakpoint]] = ... - bpbynumber: List[Breakpoint | None] = ... - - funcname: str | None - func_first_executable_line: int | None - file: str - line: int - temporary: bool - cond: str | None - enabled: bool - ignore: int - hits: int - number: int - def __init__( - self, file: str, line: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ... - ) -> None: ... - def deleteMe(self) -> None: ... - def enable(self) -> None: ... - def disable(self) -> None: ... - def bpprint(self, out: IO[str] | None = ...) -> None: ... - def bpformat(self) -> str: ... - def __str__(self) -> str: ... - -def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ... -def effective(file: str, line: int, frame: FrameType) -> Tuple[Breakpoint, bool] | Tuple[None, None]: ... -def set_trace() -> None: ... diff --git a/stdlib/@python2/binascii.pyi b/stdlib/@python2/binascii.pyi deleted file mode 100644 index b8da269..0000000 --- a/stdlib/@python2/binascii.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from typing import Text - -# Python 2 accepts unicode ascii pretty much everywhere. -_Bytes = Text -_Ascii = Text - -def a2b_uu(__data: _Ascii) -> bytes: ... -def b2a_uu(__data: _Bytes) -> bytes: ... -def a2b_base64(__data: _Ascii) -> bytes: ... -def b2a_base64(__data: _Bytes) -> bytes: ... -def a2b_qp(data: _Ascii, header: bool = ...) -> bytes: ... -def b2a_qp(data: _Bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ... -def a2b_hqx(__data: _Ascii) -> bytes: ... -def rledecode_hqx(__data: _Bytes) -> bytes: ... -def rlecode_hqx(__data: _Bytes) -> bytes: ... -def b2a_hqx(__data: _Bytes) -> bytes: ... -def crc_hqx(__data: _Bytes, __crc: int) -> int: ... -def crc32(__data: _Bytes, __crc: int = ...) -> int: ... -def b2a_hex(__data: _Bytes) -> bytes: ... -def hexlify(__data: _Bytes) -> bytes: ... -def a2b_hex(__hexstr: _Ascii) -> bytes: ... -def unhexlify(__hexstr: _Ascii) -> bytes: ... - -class Error(ValueError): ... -class Incomplete(Exception): ... diff --git a/stdlib/@python2/binhex.pyi b/stdlib/@python2/binhex.pyi deleted file mode 100644 index 02d094f..0000000 --- a/stdlib/@python2/binhex.pyi +++ /dev/null @@ -1,42 +0,0 @@ -from typing import IO, Any, Tuple, Union - -class Error(Exception): ... - -REASONABLY_LARGE: int -LINELEN: int -RUNCHAR: bytes - -class FInfo: - def __init__(self) -> None: ... - Type: str - Creator: str - Flags: int - -_FileInfoTuple = Tuple[str, FInfo, int, int] -_FileHandleUnion = Union[str, IO[bytes]] - -def getfileinfo(name: str) -> _FileInfoTuple: ... - -class openrsrc: - def __init__(self, *args: Any) -> None: ... - def read(self, *args: Any) -> bytes: ... - def write(self, *args: Any) -> None: ... - def close(self) -> None: ... - -class BinHex: - def __init__(self, name_finfo_dlen_rlen: _FileInfoTuple, ofp: _FileHandleUnion) -> None: ... - def write(self, data: bytes) -> None: ... - def close_data(self) -> None: ... - def write_rsrc(self, data: bytes) -> None: ... - def close(self) -> None: ... - -def binhex(inp: str, out: str) -> None: ... - -class HexBin: - def __init__(self, ifp: _FileHandleUnion) -> None: ... - def read(self, *n: int) -> bytes: ... - def close_data(self) -> None: ... - def read_rsrc(self, *n: int) -> bytes: ... - def close(self) -> None: ... - -def hexbin(inp: str, out: str) -> None: ... diff --git a/stdlib/@python2/bisect.pyi b/stdlib/@python2/bisect.pyi deleted file mode 100644 index 60dfc48..0000000 --- a/stdlib/@python2/bisect.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from _bisect import * - -bisect = bisect_right -insort = insort_right diff --git a/stdlib/@python2/builtins.pyi b/stdlib/@python2/builtins.pyi deleted file mode 100644 index ebe9cdd..0000000 --- a/stdlib/@python2/builtins.pyi +++ /dev/null @@ -1,1182 +0,0 @@ -# True and False are deliberately omitted because they are keywords in -# Python 3, and stub files conform to Python 3 syntax. - -from _typeshed import ReadableBuffer, SupportsKeysAndGetItem, SupportsWrite -from abc import ABCMeta -from ast import mod -from types import CodeType -from typing import ( - AbstractSet, - Any, - AnyStr, - BinaryIO, - ByteString, - Callable, - Container, - Dict, - FrozenSet, - Generic, - ItemsView, - Iterable, - Iterator, - KeysView, - List, - Mapping, - MutableMapping, - MutableSequence, - MutableSet, - NoReturn, - Protocol, - Reversible, - Sequence, - Set, - Sized, - SupportsAbs, - SupportsComplex, - SupportsFloat, - SupportsInt, - Text, - Tuple, - Type, - TypeVar, - ValuesView, - overload, -) -from typing_extensions import Literal, final - -class _SupportsIndex(Protocol): - def __index__(self) -> int: ... - -class _SupportsTrunc(Protocol): - def __trunc__(self) -> int: ... - -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") -_S = TypeVar("_S") -_T1 = TypeVar("_T1") -_T2 = TypeVar("_T2") -_T3 = TypeVar("_T3") -_T4 = TypeVar("_T4") -_T5 = TypeVar("_T5") -_TT = TypeVar("_TT", bound="type") -_TBE = TypeVar("_TBE", bound="BaseException") - -class object: - __doc__: str | None - __dict__: Dict[str, Any] - __slots__: Text | Iterable[Text] - __module__: str - @property - def __class__(self: _T) -> Type[_T]: ... - @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... # noqa: F811 - def __init__(self) -> None: ... - def __new__(cls) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __eq__(self, o: object) -> bool: ... - def __ne__(self, o: object) -> bool: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - def __format__(self, format_spec: str) -> str: ... - def __getattribute__(self, name: str) -> Any: ... - def __delattr__(self, name: str) -> None: ... - def __sizeof__(self) -> int: ... - def __reduce__(self) -> str | Tuple[Any, ...]: ... - def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ... - -class staticmethod(object): # Special, only valid as a decorator. - __func__: Callable[..., Any] - def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... - -class classmethod(object): # Special, only valid as a decorator. - __func__: Callable[..., Any] - def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... - -class type(object): - __base__: type - __bases__: Tuple[type, ...] - __basicsize__: int - __dict__: Dict[str, Any] - __dictoffset__: int - __flags__: int - __itemsize__: int - __module__: str - __mro__: Tuple[type, ...] - __name__: str - __weakrefoffset__: int - @overload - def __init__(self, o: object) -> None: ... - @overload - def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ... - @overload - def __new__(cls, o: object) -> type: ... - @overload - def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ... - def __call__(self, *args: Any, **kwds: Any) -> Any: ... - def __subclasses__(self: _TT) -> List[_TT]: ... - # Note: the documentation doesnt specify what the return type is, the standard - # implementation seems to be returning a list. - def mro(self) -> List[type]: ... - def __instancecheck__(self, instance: Any) -> bool: ... - def __subclasscheck__(self, subclass: type) -> bool: ... - -class super(object): - @overload - def __init__(self, t: Any, obj: Any) -> None: ... - @overload - def __init__(self, t: Any) -> None: ... - -class int: - @overload - def __new__(cls: Type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ... - @overload - def __new__(cls: Type[_T], x: Text | bytes | bytearray, base: int) -> _T: ... - @property - def real(self) -> int: ... - @property - def imag(self) -> int: ... - @property - def numerator(self) -> int: ... - @property - def denominator(self) -> int: ... - def conjugate(self) -> int: ... - def bit_length(self) -> int: ... - def __add__(self, x: int) -> int: ... - def __sub__(self, x: int) -> int: ... - def __mul__(self, x: int) -> int: ... - def __floordiv__(self, x: int) -> int: ... - def __div__(self, x: int) -> int: ... - def __truediv__(self, x: int) -> float: ... - def __mod__(self, x: int) -> int: ... - def __divmod__(self, x: int) -> Tuple[int, int]: ... - def __radd__(self, x: int) -> int: ... - def __rsub__(self, x: int) -> int: ... - def __rmul__(self, x: int) -> int: ... - def __rfloordiv__(self, x: int) -> int: ... - def __rdiv__(self, x: int) -> int: ... - def __rtruediv__(self, x: int) -> float: ... - def __rmod__(self, x: int) -> int: ... - def __rdivmod__(self, x: int) -> Tuple[int, int]: ... - @overload - def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ... - @overload - def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x. - def __rpow__(self, x: int, mod: int | None = ...) -> Any: ... - def __and__(self, n: int) -> int: ... - def __or__(self, n: int) -> int: ... - def __xor__(self, n: int) -> int: ... - def __lshift__(self, n: int) -> int: ... - def __rshift__(self, n: int) -> int: ... - def __rand__(self, n: int) -> int: ... - def __ror__(self, n: int) -> int: ... - def __rxor__(self, n: int) -> int: ... - def __rlshift__(self, n: int) -> int: ... - def __rrshift__(self, n: int) -> int: ... - def __neg__(self) -> int: ... - def __pos__(self) -> int: ... - def __invert__(self) -> int: ... - def __trunc__(self) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: int) -> bool: ... - def __le__(self, x: int) -> bool: ... - def __gt__(self, x: int) -> bool: ... - def __ge__(self, x: int) -> bool: ... - def __str__(self) -> str: ... - def __float__(self) -> float: ... - def __int__(self) -> int: ... - def __abs__(self) -> int: ... - def __hash__(self) -> int: ... - def __nonzero__(self) -> bool: ... - def __index__(self) -> int: ... - -class float: - def __new__(cls: Type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ... - def as_integer_ratio(self) -> Tuple[int, int]: ... - def hex(self) -> str: ... - def is_integer(self) -> bool: ... - @classmethod - def fromhex(cls, __s: str) -> float: ... - @property - def real(self) -> float: ... - @property - def imag(self) -> float: ... - def conjugate(self) -> float: ... - def __add__(self, x: float) -> float: ... - def __sub__(self, x: float) -> float: ... - def __mul__(self, x: float) -> float: ... - def __floordiv__(self, x: float) -> float: ... - def __div__(self, x: float) -> float: ... - def __truediv__(self, x: float) -> float: ... - def __mod__(self, x: float) -> float: ... - def __divmod__(self, x: float) -> Tuple[float, float]: ... - def __pow__( - self, x: float, mod: None = ... - ) -> float: ... # In Python 3, returns complex if self is negative and x is not whole - def __radd__(self, x: float) -> float: ... - def __rsub__(self, x: float) -> float: ... - def __rmul__(self, x: float) -> float: ... - def __rfloordiv__(self, x: float) -> float: ... - def __rdiv__(self, x: float) -> float: ... - def __rtruediv__(self, x: float) -> float: ... - def __rmod__(self, x: float) -> float: ... - def __rdivmod__(self, x: float) -> Tuple[float, float]: ... - def __rpow__(self, x: float, mod: None = ...) -> float: ... - def __getnewargs__(self) -> Tuple[float]: ... - def __trunc__(self) -> int: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: float) -> bool: ... - def __le__(self, x: float) -> bool: ... - def __gt__(self, x: float) -> bool: ... - def __ge__(self, x: float) -> bool: ... - def __neg__(self) -> float: ... - def __pos__(self) -> float: ... - def __str__(self) -> str: ... - def __int__(self) -> int: ... - def __float__(self) -> float: ... - def __abs__(self) -> float: ... - def __hash__(self) -> int: ... - def __nonzero__(self) -> bool: ... - -class complex: - @overload - def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ... - @overload - def __new__(cls: Type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ... - @property - def real(self) -> float: ... - @property - def imag(self) -> float: ... - def conjugate(self) -> complex: ... - def __add__(self, x: complex) -> complex: ... - def __sub__(self, x: complex) -> complex: ... - def __mul__(self, x: complex) -> complex: ... - def __pow__(self, x: complex, mod: None = ...) -> complex: ... - def __div__(self, x: complex) -> complex: ... - def __truediv__(self, x: complex) -> complex: ... - def __radd__(self, x: complex) -> complex: ... - def __rsub__(self, x: complex) -> complex: ... - def __rmul__(self, x: complex) -> complex: ... - def __rpow__(self, x: complex, mod: None = ...) -> complex: ... - def __rdiv__(self, x: complex) -> complex: ... - def __rtruediv__(self, x: complex) -> complex: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __neg__(self) -> complex: ... - def __pos__(self) -> complex: ... - def __str__(self) -> str: ... - def __complex__(self) -> complex: ... - def __abs__(self) -> float: ... - def __hash__(self) -> int: ... - def __nonzero__(self) -> bool: ... - -class basestring(metaclass=ABCMeta): ... - -class unicode(basestring, Sequence[unicode]): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, o: object) -> None: ... - @overload - def __init__(self, o: str, encoding: unicode = ..., errors: unicode = ...) -> None: ... - def capitalize(self) -> unicode: ... - def center(self, width: int, fillchar: unicode = ...) -> unicode: ... - def count(self, x: unicode) -> int: ... - def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... - def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, __suffix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def expandtabs(self, tabsize: int = ...) -> unicode: ... - def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def format(self, *args: object, **kwargs: object) -> unicode: ... - def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def isalnum(self) -> bool: ... - def isalpha(self) -> bool: ... - def isdecimal(self) -> bool: ... - def isdigit(self) -> bool: ... - def isidentifier(self) -> bool: ... - def islower(self) -> bool: ... - def isnumeric(self) -> bool: ... - def isprintable(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, iterable: Iterable[unicode]) -> unicode: ... - def ljust(self, width: int, fillchar: unicode = ...) -> unicode: ... - def lower(self) -> unicode: ... - def lstrip(self, chars: unicode = ...) -> unicode: ... - def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def replace(self, old: unicode, new: unicode, count: int = ...) -> unicode: ... - def rfind(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... - def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ... - def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... - def rstrip(self, chars: unicode = ...) -> unicode: ... - def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, __prefix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def strip(self, chars: unicode = ...) -> unicode: ... - def swapcase(self) -> unicode: ... - def title(self) -> unicode: ... - def translate(self, table: Dict[int, Any] | unicode) -> unicode: ... - def upper(self) -> unicode: ... - def zfill(self, width: int) -> unicode: ... - @overload - def __getitem__(self, i: int) -> unicode: ... - @overload - def __getitem__(self, s: slice) -> unicode: ... - def __getslice__(self, start: int, stop: int) -> unicode: ... - def __add__(self, s: unicode) -> unicode: ... - def __mul__(self, n: int) -> unicode: ... - def __rmul__(self, n: int) -> unicode: ... - def __mod__(self, x: Any) -> unicode: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: unicode) -> bool: ... - def __le__(self, x: unicode) -> bool: ... - def __gt__(self, x: unicode) -> bool: ... - def __ge__(self, x: unicode) -> bool: ... - def __len__(self) -> int: ... - # The argument type is incompatible with Sequence - def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore - def __iter__(self) -> Iterator[unicode]: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __int__(self) -> int: ... - def __float__(self) -> float: ... - def __hash__(self) -> int: ... - def __getnewargs__(self) -> Tuple[unicode]: ... - -class _FormatMapMapping(Protocol): - def __getitem__(self, __key: str) -> Any: ... - -class str(Sequence[str], basestring): - def __init__(self, o: object = ...) -> None: ... - def capitalize(self) -> str: ... - def center(self, __width: int, __fillchar: str = ...) -> str: ... - def count(self, x: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... - def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... - def endswith(self, __suffix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def expandtabs(self, tabsize: int = ...) -> str: ... - def find(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def format(self, *args: object, **kwargs: object) -> str: ... - def format_map(self, map: _FormatMapMapping) -> str: ... - def index(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def isalnum(self) -> bool: ... - def isalpha(self) -> bool: ... - def isdigit(self) -> bool: ... - def islower(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, __iterable: Iterable[AnyStr]) -> AnyStr: ... - def ljust(self, __width: int, __fillchar: str = ...) -> str: ... - def lower(self) -> str: ... - @overload - def lstrip(self, __chars: str = ...) -> str: ... - @overload - def lstrip(self, __chars: unicode) -> unicode: ... - @overload - def partition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... - @overload - def partition(self, __sep: str) -> Tuple[str, str, str]: ... - @overload - def partition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - def replace(self, __old: AnyStr, __new: AnyStr, __count: int = ...) -> AnyStr: ... - def rfind(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def rindex(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ... - def rjust(self, __width: int, __fillchar: str = ...) -> str: ... - @overload - def rpartition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ... - @overload - def rpartition(self, __sep: str) -> Tuple[str, str, str]: ... - @overload - def rpartition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ... - @overload - def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... - @overload - def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... - @overload - def rstrip(self, __chars: str = ...) -> str: ... - @overload - def rstrip(self, __chars: unicode) -> unicode: ... - @overload - def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... - @overload - def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... - def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, __prefix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - @overload - def strip(self, __chars: str = ...) -> str: ... - @overload - def strip(self, chars: unicode) -> unicode: ... - def swapcase(self) -> str: ... - def title(self) -> str: ... - def translate(self, __table: AnyStr | None, deletechars: AnyStr = ...) -> AnyStr: ... - def upper(self) -> str: ... - def zfill(self, __width: int) -> str: ... - def __add__(self, s: AnyStr) -> AnyStr: ... - # Incompatible with Sequence.__contains__ - def __contains__(self, o: str | Text) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ge__(self, x: Text) -> bool: ... - def __getitem__(self, i: int | slice) -> str: ... - def __gt__(self, x: Text) -> bool: ... - def __hash__(self) -> int: ... - def __iter__(self) -> Iterator[str]: ... - def __le__(self, x: Text) -> bool: ... - def __len__(self) -> int: ... - def __lt__(self, x: Text) -> bool: ... - def __mod__(self, x: Any) -> str: ... - def __mul__(self, n: int) -> str: ... - def __ne__(self, x: object) -> bool: ... - def __repr__(self) -> str: ... - def __rmul__(self, n: int) -> str: ... - def __str__(self) -> str: ... - def __getnewargs__(self) -> Tuple[str]: ... - def __getslice__(self, start: int, stop: int) -> str: ... - def __float__(self) -> float: ... - def __int__(self) -> int: ... - -bytes = str - -class bytearray(MutableSequence[int], ByteString): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, ints: Iterable[int]) -> None: ... - @overload - def __init__(self, string: str) -> None: ... - @overload - def __init__(self, string: Text, encoding: Text, errors: Text = ...) -> None: ... - @overload - def __init__(self, length: int) -> None: ... - def capitalize(self) -> bytearray: ... - def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... - def count(self, __sub: str) -> int: ... - def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ... - def endswith(self, __suffix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def expandtabs(self, tabsize: int = ...) -> bytearray: ... - def extend(self, iterable: str | Iterable[int]) -> None: ... - def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... - def index(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... - def insert(self, __index: int, __item: int) -> None: ... - def isalnum(self) -> bool: ... - def isalpha(self) -> bool: ... - def isdigit(self) -> bool: ... - def islower(self) -> bool: ... - def isspace(self) -> bool: ... - def istitle(self) -> bool: ... - def isupper(self) -> bool: ... - def join(self, __iterable: Iterable[str]) -> bytearray: ... - def ljust(self, __width: int, __fillchar: str = ...) -> bytearray: ... - def lower(self) -> bytearray: ... - def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ... - def rfind(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... - def rindex(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ... - def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... - def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... - def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ... - def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... - def startswith(self, __prefix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ... - def strip(self, __bytes: bytes | None = ...) -> bytearray: ... - def swapcase(self) -> bytearray: ... - def title(self) -> bytearray: ... - def translate(self, __table: str) -> bytearray: ... - def upper(self) -> bytearray: ... - def zfill(self, __width: int) -> bytearray: ... - @classmethod - def fromhex(cls, __string: str) -> bytearray: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[int]: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __int__(self) -> int: ... - def __float__(self) -> float: ... - __hash__: None # type: ignore - @overload - def __getitem__(self, i: int) -> int: ... - @overload - def __getitem__(self, s: slice) -> bytearray: ... - @overload - def __setitem__(self, i: int, x: int) -> None: ... - @overload - def __setitem__(self, s: slice, x: Iterable[int] | bytes) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __getslice__(self, start: int, stop: int) -> bytearray: ... - def __setslice__(self, start: int, stop: int, x: Sequence[int] | str) -> None: ... - def __delslice__(self, start: int, stop: int) -> None: ... - def __add__(self, s: bytes) -> bytearray: ... - def __mul__(self, n: int) -> bytearray: ... - # Incompatible with Sequence.__contains__ - def __contains__(self, o: int | bytes) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: bytes) -> bool: ... - def __le__(self, x: bytes) -> bool: ... - def __gt__(self, x: bytes) -> bool: ... - def __ge__(self, x: bytes) -> bool: ... - -class memoryview(Sized, Container[str]): - format: str - itemsize: int - shape: Tuple[int, ...] | None - strides: Tuple[int, ...] | None - suboffsets: Tuple[int, ...] | None - readonly: bool - ndim: int - def __init__(self, obj: ReadableBuffer) -> None: ... - @overload - def __getitem__(self, i: int) -> str: ... - @overload - def __getitem__(self, s: slice) -> memoryview: ... - def __contains__(self, x: object) -> bool: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - @overload - def __setitem__(self, s: slice, o: bytes) -> None: ... - @overload - def __setitem__(self, i: int, o: int) -> None: ... - def tobytes(self) -> bytes: ... - def tolist(self) -> List[int]: ... - -@final -class bool(int): - def __new__(cls: Type[_T], __o: object = ...) -> _T: ... - @overload - def __and__(self, x: bool) -> bool: ... - @overload - def __and__(self, x: int) -> int: ... - @overload - def __or__(self, x: bool) -> bool: ... - @overload - def __or__(self, x: int) -> int: ... - @overload - def __xor__(self, x: bool) -> bool: ... - @overload - def __xor__(self, x: int) -> int: ... - @overload - def __rand__(self, x: bool) -> bool: ... - @overload - def __rand__(self, x: int) -> int: ... - @overload - def __ror__(self, x: bool) -> bool: ... - @overload - def __ror__(self, x: int) -> int: ... - @overload - def __rxor__(self, x: bool) -> bool: ... - @overload - def __rxor__(self, x: int) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... - -class slice(object): - start: Any - step: Any - stop: Any - @overload - def __init__(self, stop: Any) -> None: ... - @overload - def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ... - __hash__: None # type: ignore - def indices(self, len: int) -> Tuple[int, int, int]: ... - -class tuple(Sequence[_T_co], Generic[_T_co]): - def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... - def __len__(self) -> int: ... - def __contains__(self, x: object) -> bool: ... - @overload - def __getitem__(self, x: int) -> _T_co: ... - @overload - def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ... - def __iter__(self) -> Iterator[_T_co]: ... - def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __le__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ... - @overload - def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ... - @overload - def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ... - def __mul__(self, n: int) -> Tuple[_T_co, ...]: ... - def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ... - def count(self, __value: Any) -> int: ... - def index(self, __value: Any) -> int: ... - -class function: - # TODO not defined in builtins! - __name__: str - __module__: str - __code__: CodeType - -class list(MutableSequence[_T], Generic[_T]): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, iterable: Iterable[_T]) -> None: ... - def append(self, __object: _T) -> None: ... - def extend(self, __iterable: Iterable[_T]) -> None: ... - def pop(self, __index: int = ...) -> _T: ... - def index(self, __value: _T, __start: int = ..., __stop: int = ...) -> int: ... - def count(self, __value: _T) -> int: ... - def insert(self, __index: int, __object: _T) -> None: ... - def remove(self, __value: _T) -> None: ... - def reverse(self) -> None: ... - def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - __hash__: None # type: ignore - @overload - def __getitem__(self, i: int) -> _T: ... - @overload - def __getitem__(self, s: slice) -> List[_T]: ... - @overload - def __setitem__(self, i: int, o: _T) -> None: ... - @overload - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __getslice__(self, start: int, stop: int) -> List[_T]: ... - def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ... - def __delslice__(self, start: int, stop: int) -> None: ... - def __add__(self, x: List[_T]) -> List[_T]: ... - def __iadd__(self: _S, x: Iterable[_T]) -> _S: ... - def __mul__(self, n: int) -> List[_T]: ... - def __rmul__(self, n: int) -> List[_T]: ... - def __contains__(self, o: object) -> bool: ... - def __reversed__(self) -> Iterator[_T]: ... - def __gt__(self, x: List[_T]) -> bool: ... - def __ge__(self, x: List[_T]) -> bool: ... - def __lt__(self, x: List[_T]) -> bool: ... - def __le__(self, x: List[_T]) -> bool: ... - -class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): - # NOTE: Keyword arguments are special. If they are used, _KT must include - # str, but we have no way of enforcing it here. - @overload - def __init__(self, **kwargs: _VT) -> None: ... - @overload - def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... - def has_key(self, k: _KT) -> bool: ... - def clear(self) -> None: ... - def copy(self) -> Dict[_KT, _VT]: ... - def popitem(self) -> Tuple[_KT, _VT]: ... - def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ... - @overload - def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - @overload - def update(self, **kwargs: _VT) -> None: ... - def iterkeys(self) -> Iterator[_KT]: ... - def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... - def viewkeys(self) -> KeysView[_KT]: ... - def viewvalues(self) -> ValuesView[_VT]: ... - def viewitems(self) -> ItemsView[_KT, _VT]: ... - @classmethod - @overload - def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ... - @classmethod - @overload - def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... - def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __iter__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... - __hash__: None # type: ignore - -class set(MutableSet[_T], Generic[_T]): - def __init__(self, iterable: Iterable[_T] = ...) -> None: ... - def add(self, element: _T) -> None: ... - def clear(self) -> None: ... - def copy(self) -> Set[_T]: ... - def difference(self, *s: Iterable[Any]) -> Set[_T]: ... - def difference_update(self, *s: Iterable[Any]) -> None: ... - def discard(self, element: _T) -> None: ... - def intersection(self, *s: Iterable[Any]) -> Set[_T]: ... - def intersection_update(self, *s: Iterable[Any]) -> None: ... - def isdisjoint(self, s: Iterable[Any]) -> bool: ... - def issubset(self, s: Iterable[Any]) -> bool: ... - def issuperset(self, s: Iterable[Any]) -> bool: ... - def pop(self) -> _T: ... - def remove(self, element: _T) -> None: ... - def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ... - def symmetric_difference_update(self, s: Iterable[_T]) -> None: ... - def union(self, *s: Iterable[_T]) -> Set[_T]: ... - def update(self, *s: Iterable[_T]) -> None: ... - def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - @overload - def __sub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... - @overload - def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - @overload # type: ignore - def __isub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ... - @overload - def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __le__(self, s: AbstractSet[object]) -> bool: ... - def __lt__(self, s: AbstractSet[object]) -> bool: ... - def __ge__(self, s: AbstractSet[object]) -> bool: ... - def __gt__(self, s: AbstractSet[object]) -> bool: ... - __hash__: None # type: ignore - -class frozenset(AbstractSet[_T_co], Generic[_T_co]): - def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ... - def copy(self) -> FrozenSet[_T_co]: ... - def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def isdisjoint(self, s: Iterable[_T_co]) -> bool: ... - def issubset(self, s: Iterable[object]) -> bool: ... - def issuperset(self, s: Iterable[object]) -> bool: ... - def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_T_co]: ... - def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __le__(self, s: AbstractSet[object]) -> bool: ... - def __lt__(self, s: AbstractSet[object]) -> bool: ... - def __ge__(self, s: AbstractSet[object]) -> bool: ... - def __gt__(self, s: AbstractSet[object]) -> bool: ... - -class enumerate(Iterator[Tuple[int, _T]], Generic[_T]): - def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ... - def __iter__(self) -> Iterator[Tuple[int, _T]]: ... - def next(self) -> Tuple[int, _T]: ... - -class xrange(Sized, Iterable[int], Reversible[int]): - @overload - def __init__(self, stop: int) -> None: ... - @overload - def __init__(self, start: int, stop: int, step: int = ...) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[int]: ... - def __getitem__(self, i: _SupportsIndex) -> int: ... - def __reversed__(self) -> Iterator[int]: ... - -class property(object): - def __init__( - self, - fget: Callable[[Any], Any] | None = ..., - fset: Callable[[Any, Any], None] | None = ..., - fdel: Callable[[Any], None] | None = ..., - doc: str | None = ..., - ) -> None: ... - def getter(self, fget: Callable[[Any], Any]) -> property: ... - def setter(self, fset: Callable[[Any, Any], None]) -> property: ... - def deleter(self, fdel: Callable[[Any], None]) -> property: ... - def __get__(self, obj: Any, type: type | None = ...) -> Any: ... - def __set__(self, obj: Any, value: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... - def fget(self) -> Any: ... - def fset(self, value: Any) -> None: ... - def fdel(self) -> None: ... - -long = int - -class _NotImplementedType(Any): # type: ignore - # A little weird, but typing the __call__ as NotImplemented makes the error message - # for NotImplemented() much better - __call__: NotImplemented # type: ignore - -NotImplemented: _NotImplementedType - -def abs(__x: SupportsAbs[_T]) -> _T: ... -def all(__iterable: Iterable[object]) -> bool: ... -def any(__iterable: Iterable[object]) -> bool: ... -def apply(__func: Callable[..., _T], __args: Sequence[Any] | None = ..., __kwds: Mapping[str, Any] | None = ...) -> _T: ... -def bin(__number: int | _SupportsIndex) -> str: ... -def callable(__obj: object) -> bool: ... -def chr(__i: int) -> str: ... -def cmp(__x: Any, __y: Any) -> int: ... - -_N1 = TypeVar("_N1", bool, int, float, complex) - -def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... -def compile(source: Text | mod, filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ... -def delattr(__obj: Any, __name: Text) -> None: ... -def dir(__o: object = ...) -> List[str]: ... - -_N2 = TypeVar("_N2", int, float) - -def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ... -def eval( - __source: Text | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... -) -> Any: ... -def execfile(__filename: str, __globals: Dict[str, Any] | None = ..., __locals: Dict[str, Any] | None = ...) -> None: ... -def exit(code: object = ...) -> NoReturn: ... -@overload -def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore -@overload -def filter(__function: None, __iterable: Tuple[_T | None, ...]) -> Tuple[_T, ...]: ... # type: ignore -@overload -def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore -@overload -def filter(__function: None, __iterable: Iterable[_T | None]) -> List[_T]: ... -@overload -def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ... -def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode -@overload -def getattr(__o: Any, name: Text) -> Any: ... - -# While technically covered by the last overload, spelling out the types for None and bool -# help mypy out in some tricky situations involving type context (aka bidirectional inference) -@overload -def getattr(__o: Any, name: Text, __default: None) -> Any | None: ... -@overload -def getattr(__o: Any, name: Text, __default: bool) -> Any | bool: ... -@overload -def getattr(__o: Any, name: Text, __default: _T) -> Any | _T: ... -def globals() -> Dict[str, Any]: ... -def hasattr(__obj: Any, __name: Text) -> bool: ... -def hash(__obj: object) -> int: ... -def hex(__number: int | _SupportsIndex) -> str: ... -def id(__obj: object) -> int: ... -def input(__prompt: Any = ...) -> Any: ... -def intern(__string: str) -> str: ... -@overload -def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... -@overload -def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ... -@overload -def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ... -def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... -def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... -def len(__obj: Sized) -> int: ... -def locals() -> Dict[str, Any]: ... -@overload -def map(__func: None, __iter1: Iterable[_T1]) -> List[_T1]: ... -@overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... -@overload -def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... -@overload -def map( - __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def map( - __func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5], -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def map( - __func: None, - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... -@overload -def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> List[_S]: ... -@overload -def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[_S]: ... -@overload -def map( - __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] -) -> List[_S]: ... -@overload -def map( - __func: Callable[[_T1, _T2, _T3, _T4], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], -) -> List[_S]: ... -@overload -def map( - __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5], -) -> List[_S]: ... -@overload -def map( - __func: Callable[..., _S], - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any], -) -> List[_S]: ... -@overload -def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... -@overload -def next(__i: Iterator[_T]) -> _T: ... -@overload -def next(__i: Iterator[_T], default: _VT) -> _T | _VT: ... -def oct(__number: int | _SupportsIndex) -> str: ... -def open(name: unicode | int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... -def ord(__c: Text | bytes) -> int: ... - -# This is only available after from __future__ import print_function. -def print(*values: object, sep: Text | None = ..., end: Text | None = ..., file: SupportsWrite[Any] | None = ...) -> None: ... - -_E = TypeVar("_E", contravariant=True) -_M = TypeVar("_M", contravariant=True) - -class _SupportsPow2(Protocol[_E, _T_co]): - def __pow__(self, __other: _E) -> _T_co: ... - -class _SupportsPow3(Protocol[_E, _M, _T_co]): - def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ... - -@overload -def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative -@overload -def pow(__base: int, __exp: int, __mod: int) -> int: ... -@overload -def pow(__base: float, __exp: float, __mod: None = ...) -> float: ... -@overload -def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ... -@overload -def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ... -def quit(code: object = ...) -> NoReturn: ... -def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811 -def raw_input(__prompt: Any = ...) -> str: ... -@overload -def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ... -@overload -def reduce(__function: Callable[[_T, _T], _T], __iterable: Iterable[_T]) -> _T: ... -def reload(__module: Any) -> Any: ... -@overload -def reversed(__sequence: Sequence[_T]) -> Iterator[_T]: ... -@overload -def reversed(__sequence: Reversible[_T]) -> Iterator[_T]: ... -def repr(__obj: object) -> str: ... -@overload -def round(number: float) -> float: ... -@overload -def round(number: float, ndigits: int) -> float: ... -@overload -def round(number: SupportsFloat) -> float: ... -@overload -def round(number: SupportsFloat, ndigits: int) -> float: ... -def setattr(__obj: Any, __name: Text, __value: Any) -> None: ... -def sorted( - __iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] | None = ..., reverse: bool = ... -) -> List[_T]: ... -@overload -def sum(__iterable: Iterable[_T]) -> _T | int: ... -@overload -def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ... -def unichr(__i: int) -> unicode: ... -def vars(__object: Any = ...) -> Dict[str, Any]: ... -@overload -def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ... -@overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... -@overload -def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... -@overload -def zip( - __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] -) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def zip( - __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] -) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def zip( - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any], -) -> List[Tuple[Any, ...]]: ... -def __import__( - name: Text, - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., - fromlist: Sequence[str] = ..., - level: int = ..., -) -> Any: ... - -# Actually the type of Ellipsis is , but since it's -# not exposed anywhere under that name, we make it private here. -class ellipsis: ... - -Ellipsis: ellipsis - -# TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check. -_AnyBuffer = TypeVar("_AnyBuffer", str, unicode, bytearray, buffer) - -class buffer(Sized): - def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ... - def __add__(self, other: _AnyBuffer) -> str: ... - def __cmp__(self, other: _AnyBuffer) -> bool: ... - def __getitem__(self, key: int | slice) -> str: ... - def __getslice__(self, i: int, j: int) -> str: ... - def __len__(self) -> int: ... - def __mul__(self, x: int) -> str: ... - -class BaseException(object): - args: Tuple[Any, ...] - message: Any - def __init__(self, *args: object) -> None: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __getitem__(self, i: int) -> Any: ... - def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ... - -class GeneratorExit(BaseException): ... -class KeyboardInterrupt(BaseException): ... - -class SystemExit(BaseException): - code: int - -class Exception(BaseException): ... -class StopIteration(Exception): ... -class StandardError(Exception): ... - -_StandardError = StandardError - -class EnvironmentError(StandardError): - errno: int - strerror: str - # TODO can this be unicode? - filename: str - -class OSError(EnvironmentError): ... -class IOError(EnvironmentError): ... -class ArithmeticError(_StandardError): ... -class AssertionError(_StandardError): ... -class AttributeError(_StandardError): ... -class BufferError(_StandardError): ... -class EOFError(_StandardError): ... -class ImportError(_StandardError): ... -class LookupError(_StandardError): ... -class MemoryError(_StandardError): ... -class NameError(_StandardError): ... -class ReferenceError(_StandardError): ... -class RuntimeError(_StandardError): ... - -class SyntaxError(_StandardError): - msg: str - lineno: int | None - offset: int | None - text: str | None - filename: str | None - -class SystemError(_StandardError): ... -class TypeError(_StandardError): ... -class ValueError(_StandardError): ... -class FloatingPointError(ArithmeticError): ... -class OverflowError(ArithmeticError): ... -class ZeroDivisionError(ArithmeticError): ... -class IndexError(LookupError): ... -class KeyError(LookupError): ... -class UnboundLocalError(NameError): ... - -class WindowsError(OSError): - winerror: int - -class NotImplementedError(RuntimeError): ... -class IndentationError(SyntaxError): ... -class TabError(IndentationError): ... -class UnicodeError(ValueError): ... - -class UnicodeDecodeError(UnicodeError): - encoding: str - object: bytes - start: int - end: int - reason: str - def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ... - -class UnicodeEncodeError(UnicodeError): - encoding: str - object: Text - start: int - end: int - reason: str - def __init__(self, __encoding: str, __object: Text, __start: int, __end: int, __reason: str) -> None: ... - -class UnicodeTranslateError(UnicodeError): ... -class Warning(Exception): ... -class UserWarning(Warning): ... -class DeprecationWarning(Warning): ... -class SyntaxWarning(Warning): ... -class RuntimeWarning(Warning): ... -class FutureWarning(Warning): ... -class PendingDeprecationWarning(Warning): ... -class ImportWarning(Warning): ... -class UnicodeWarning(Warning): ... -class BytesWarning(Warning): ... - -class file(BinaryIO): - @overload - def __init__(self, file: str, mode: str = ..., buffering: int = ...) -> None: ... - @overload - def __init__(self, file: unicode, mode: str = ..., buffering: int = ...) -> None: ... - @overload - def __init__(self, file: int, mode: str = ..., buffering: int = ...) -> None: ... - def __iter__(self) -> Iterator[str]: ... - def next(self) -> str: ... - def read(self, n: int = ...) -> str: ... - def __enter__(self) -> BinaryIO: ... - def __exit__(self, t: type | None = ..., exc: BaseException | None = ..., tb: Any | None = ...) -> bool | None: ... - def flush(self) -> None: ... - def fileno(self) -> int: ... - def isatty(self) -> bool: ... - def close(self) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def seekable(self) -> bool: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... - def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... - def write(self, data: str) -> int: ... - def writelines(self, data: Iterable[str]) -> None: ... - def truncate(self, pos: int | None = ...) -> int: ... diff --git a/stdlib/@python2/bz2.pyi b/stdlib/@python2/bz2.pyi deleted file mode 100644 index 81ee6f6..0000000 --- a/stdlib/@python2/bz2.pyi +++ /dev/null @@ -1,32 +0,0 @@ -import io -from _typeshed import ReadableBuffer, WriteableBuffer -from typing import IO, Any, Iterable, List, Text, TypeVar, Union -from typing_extensions import SupportsIndex - -_PathOrFile = Union[Text, IO[bytes]] -_T = TypeVar("_T") - -def compress(data: bytes, compresslevel: int = ...) -> bytes: ... -def decompress(data: bytes) -> bytes: ... - -class BZ2File(io.BufferedIOBase, IO[bytes]): - def __enter__(self: _T) -> _T: ... - def __init__(self, filename: _PathOrFile, mode: str = ..., buffering: Any | None = ..., compresslevel: int = ...) -> None: ... - def read(self, size: int | None = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... - def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore - def readinto(self, b: WriteableBuffer) -> int: ... - def readlines(self, size: SupportsIndex = ...) -> List[bytes]: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def write(self, data: ReadableBuffer) -> int: ... - def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... - -class BZ2Compressor(object): - def __init__(self, compresslevel: int = ...) -> None: ... - def compress(self, __data: bytes) -> bytes: ... - def flush(self) -> bytes: ... - -class BZ2Decompressor(object): - def decompress(self, data: bytes) -> bytes: ... - @property - def unused_data(self) -> bytes: ... diff --git a/stdlib/@python2/cPickle.pyi b/stdlib/@python2/cPickle.pyi deleted file mode 100644 index d8db140..0000000 --- a/stdlib/@python2/cPickle.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from typing import IO, Any, List - -HIGHEST_PROTOCOL: int -compatible_formats: List[str] -format_version: str - -class Pickler: - def __init__(self, file: IO[str], protocol: int = ...) -> None: ... - def dump(self, obj: Any) -> None: ... - def clear_memo(self) -> None: ... - -class Unpickler: - def __init__(self, file: IO[str]) -> None: ... - def load(self) -> Any: ... - def noload(self) -> Any: ... - -def dump(obj: Any, file: IO[str], protocol: int = ...) -> None: ... -def dumps(obj: Any, protocol: int = ...) -> str: ... -def load(file: IO[str]) -> Any: ... -def loads(str: str) -> Any: ... - -class PickleError(Exception): ... -class UnpicklingError(PickleError): ... -class BadPickleGet(UnpicklingError): ... -class PicklingError(PickleError): ... -class UnpickleableError(PicklingError): ... diff --git a/stdlib/@python2/cProfile.pyi b/stdlib/@python2/cProfile.pyi deleted file mode 100644 index 1257b0c..0000000 --- a/stdlib/@python2/cProfile.pyi +++ /dev/null @@ -1,28 +0,0 @@ -from types import CodeType -from typing import Any, Callable, Dict, Text, Tuple, TypeVar - -def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... -def runctx( - statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ... -) -> None: ... - -_SelfT = TypeVar("_SelfT", bound=Profile) -_T = TypeVar("_T") -_Label = Tuple[str, int, str] - -class Profile: - stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented - def __init__( - self, timer: Callable[[], float] = ..., timeunit: float = ..., subcalls: bool = ..., builtins: bool = ... - ) -> None: ... - def enable(self) -> None: ... - def disable(self) -> None: ... - def print_stats(self, sort: str | int = ...) -> None: ... - def dump_stats(self, file: Text) -> None: ... - def create_stats(self) -> None: ... - def snapshot_stats(self) -> None: ... - def run(self: _SelfT, cmd: str) -> _SelfT: ... - def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... - -def label(code: str | CodeType) -> _Label: ... # undocumented diff --git a/stdlib/@python2/cStringIO.pyi b/stdlib/@python2/cStringIO.pyi deleted file mode 100644 index 7703e03..0000000 --- a/stdlib/@python2/cStringIO.pyi +++ /dev/null @@ -1,47 +0,0 @@ -from abc import ABCMeta -from typing import IO, Iterable, Iterator, List, overload - -# This class isn't actually abstract, but you can't instantiate it -# directly, so we might as well treat it as abstract in the stub. -class InputType(IO[str], Iterator[str], metaclass=ABCMeta): - def getvalue(self) -> str: ... - def close(self) -> None: ... - @property - def closed(self) -> bool: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def read(self, size: int = ...) -> str: ... - def readline(self, size: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> int: ... - def __iter__(self) -> InputType: ... - def next(self) -> str: ... - def reset(self) -> None: ... - -class OutputType(IO[str], Iterator[str], metaclass=ABCMeta): - @property - def softspace(self) -> int: ... - def getvalue(self) -> str: ... - def close(self) -> None: ... - @property - def closed(self) -> bool: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def read(self, size: int = ...) -> str: ... - def readline(self, size: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> int: ... - def __iter__(self) -> OutputType: ... - def next(self) -> str: ... - def reset(self) -> None: ... - def write(self, b: str | unicode) -> int: ... - def writelines(self, lines: Iterable[str | unicode]) -> None: ... - -@overload -def StringIO() -> OutputType: ... -@overload -def StringIO(s: str) -> InputType: ... diff --git a/stdlib/@python2/calendar.pyi b/stdlib/@python2/calendar.pyi deleted file mode 100644 index ce76521..0000000 --- a/stdlib/@python2/calendar.pyi +++ /dev/null @@ -1,105 +0,0 @@ -import datetime -from time import struct_time -from typing import Any, Iterable, List, Optional, Sequence, Tuple - -_LocaleType = Tuple[Optional[str], Optional[str]] - -class IllegalMonthError(ValueError): - def __init__(self, month: int) -> None: ... - def __str__(self) -> str: ... - -class IllegalWeekdayError(ValueError): - def __init__(self, weekday: int) -> None: ... - def __str__(self) -> str: ... - -def isleap(year: int) -> bool: ... -def leapdays(y1: int, y2: int) -> int: ... -def weekday(year: int, month: int, day: int) -> int: ... -def monthrange(year: int, month: int) -> Tuple[int, int]: ... - -class Calendar: - firstweekday: int - def __init__(self, firstweekday: int = ...) -> None: ... - def getfirstweekday(self) -> int: ... - def setfirstweekday(self, firstweekday: int) -> None: ... - def iterweekdays(self) -> Iterable[int]: ... - def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ... - def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ... - def itermonthdays(self, year: int, month: int) -> Iterable[int]: ... - def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ... - def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ... - def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ... - def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ... - def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ... - def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ... - -class TextCalendar(Calendar): - def prweek(self, theweek: int, width: int) -> None: ... - def formatday(self, day: int, weekday: int, width: int) -> str: ... - def formatweek(self, theweek: int, width: int) -> str: ... - def formatweekday(self, day: int, width: int) -> str: ... - def formatweekheader(self, width: int) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ... - def prmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ... - def formatmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ... - def formatyear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ... - def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... - -def firstweekday() -> int: ... -def monthcalendar(year: int, month: int) -> List[List[int]]: ... -def prweek(theweek: int, width: int) -> None: ... -def week(theweek: int, width: int) -> str: ... -def weekheader(width: int) -> str: ... -def prmonth(theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ... -def month(theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ... -def calendar(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ... -def prcal(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... - -class HTMLCalendar(Calendar): - def formatday(self, day: int, weekday: int) -> str: ... - def formatweek(self, theweek: int) -> str: ... - def formatweekday(self, day: int) -> str: ... - def formatweekheader(self) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... - def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... - def formatyear(self, theyear: int, width: int = ...) -> str: ... - def formatyearpage(self, theyear: int, width: int = ..., css: str | None = ..., encoding: str | None = ...) -> str: ... - -class TimeEncoding: - def __init__(self, locale: _LocaleType) -> None: ... - def __enter__(self) -> _LocaleType: ... - def __exit__(self, *args: Any) -> None: ... - -class LocaleTextCalendar(TextCalendar): - def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... - def formatweekday(self, day: int, width: int) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ... - -class LocaleHTMLCalendar(HTMLCalendar): - def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... - def formatweekday(self, day: int) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... - -c: TextCalendar - -def setfirstweekday(firstweekday: int) -> None: ... -def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... -def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... -def timegm(tuple: Tuple[int, ...] | struct_time) -> int: ... - -# Data attributes -day_name: Sequence[str] -day_abbr: Sequence[str] -month_name: Sequence[str] -month_abbr: Sequence[str] - -# Below constants are not in docs or __all__, but enough people have used them -# they are now effectively public. - -MONDAY: int -TUESDAY: int -WEDNESDAY: int -THURSDAY: int -FRIDAY: int -SATURDAY: int -SUNDAY: int diff --git a/stdlib/@python2/cgi.pyi b/stdlib/@python2/cgi.pyi deleted file mode 100644 index 6747482..0000000 --- a/stdlib/@python2/cgi.pyi +++ /dev/null @@ -1,109 +0,0 @@ -from _typeshed import SupportsGetItem, SupportsItemAccess -from builtins import type as _type -from typing import IO, Any, AnyStr, Iterable, Iterator, List, Mapping, Protocol, TypeVar -from UserDict import UserDict - -_T = TypeVar("_T", bound=FieldStorage) - -def parse( - fp: IO[Any] | None = ..., - 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: IO[bytes] | None - 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: _type | None - keep_blank_values: int - strict_parsing: int - qs_on_post: str | None - headers: Mapping[str, str] - fp: IO[bytes] - encoding: str - errors: str - outerboundary: bytes - bytes_read: int - limit: int | None - disposition: str - disposition_options: dict[str, str] - filename: str | None - file: IO[bytes] | None - type: str - type_options: dict[str, str] - innerboundary: bytes - length: int - done: int - list: List[Any] | None - value: 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/stdlib/@python2/cgitb.pyi b/stdlib/@python2/cgitb.pyi deleted file mode 100644 index daa0233..0000000 --- a/stdlib/@python2/cgitb.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from types import FrameType, TracebackType -from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type - -_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] - -def reset() -> str: ... # undocumented -def small(text: str) -> str: ... # undocumented -def strong(text: str) -> str: ... # undocumented -def grey(text: str) -> str: ... # undocumented -def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[str | None, Any]: ... # undocumented -def scanvars( - reader: Callable[[], bytes], frame: FrameType, locals: Dict[str, Any] -) -> List[Tuple[str, str | None, Any]]: ... # undocumented -def html(einfo: _ExcInfo, context: int = ...) -> str: ... -def text(einfo: _ExcInfo, context: int = ...) -> str: ... - -class Hook: # undocumented - def __init__( - self, display: int = ..., logdir: Text | None = ..., context: int = ..., file: IO[str] | None = ..., format: str = ... - ) -> None: ... - def __call__(self, etype: Type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... - def handle(self, info: _ExcInfo | None = ...) -> None: ... - -def handler(info: _ExcInfo | None = ...) -> None: ... -def enable(display: int = ..., logdir: Text | None = ..., context: int = ..., format: str = ...) -> None: ... diff --git a/stdlib/@python2/chunk.pyi b/stdlib/@python2/chunk.pyi deleted file mode 100644 index 50ff267..0000000 --- a/stdlib/@python2/chunk.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from typing import IO - -class Chunk: - closed: bool - align: bool - file: IO[bytes] - chunkname: bytes - chunksize: int - size_read: int - offset: int - seekable: bool - def __init__(self, file: IO[bytes], align: bool = ..., bigendian: bool = ..., inclheader: bool = ...) -> None: ... - def getname(self) -> bytes: ... - def getsize(self) -> int: ... - def close(self) -> None: ... - def isatty(self) -> bool: ... - def seek(self, pos: int, whence: int = ...) -> None: ... - def tell(self) -> int: ... - def read(self, size: int = ...) -> bytes: ... - def skip(self) -> None: ... diff --git a/stdlib/@python2/cmath.pyi b/stdlib/@python2/cmath.pyi deleted file mode 100644 index 1e19687..0000000 --- a/stdlib/@python2/cmath.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import SupportsComplex, SupportsFloat, Tuple, Union - -e: float -pi: float -_C = Union[SupportsFloat, SupportsComplex, complex] - -def acos(__z: _C) -> complex: ... -def acosh(__z: _C) -> complex: ... -def asin(__z: _C) -> complex: ... -def asinh(__z: _C) -> complex: ... -def atan(__z: _C) -> complex: ... -def atanh(__z: _C) -> complex: ... -def cos(__z: _C) -> complex: ... -def cosh(__z: _C) -> complex: ... -def exp(__z: _C) -> complex: ... -def isinf(__z: _C) -> bool: ... -def isnan(__z: _C) -> bool: ... -def log(__x: _C, __y_obj: _C = ...) -> complex: ... -def log10(__z: _C) -> complex: ... -def phase(__z: _C) -> float: ... -def polar(__z: _C) -> Tuple[float, float]: ... -def rect(__r: float, __phi: float) -> complex: ... -def sin(__z: _C) -> complex: ... -def sinh(__z: _C) -> complex: ... -def sqrt(__z: _C) -> complex: ... -def tan(__z: _C) -> complex: ... -def tanh(__z: _C) -> complex: ... diff --git a/stdlib/@python2/cmd.pyi b/stdlib/@python2/cmd.pyi deleted file mode 100644 index ffccba8..0000000 --- a/stdlib/@python2/cmd.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from typing import IO, Any, Callable, List, Tuple - -class Cmd: - prompt: str - identchars: str - ruler: str - lastcmd: str - intro: Any | None - doc_leader: str - doc_header: str - misc_header: str - undoc_header: str - nohelp: str - use_rawinput: bool - stdin: IO[str] - stdout: IO[str] - cmdqueue: List[str] - completekey: str - def __init__(self, completekey: str = ..., stdin: IO[str] | None = ..., stdout: IO[str] | None = ...) -> None: ... - old_completer: Callable[[str, int], str | None] | None - def cmdloop(self, intro: Any | None = ...) -> None: ... - def precmd(self, line: str) -> str: ... - def postcmd(self, stop: bool, line: str) -> bool: ... - def preloop(self) -> None: ... - def postloop(self) -> None: ... - def parseline(self, line: str) -> Tuple[str | None, str | None, str]: ... - def onecmd(self, line: str) -> bool: ... - def emptyline(self) -> bool: ... - def default(self, line: str) -> bool: ... - def completedefault(self, *ignored: Any) -> List[str]: ... - def completenames(self, text: str, *ignored: Any) -> List[str]: ... - completion_matches: List[str] | None - def complete(self, text: str, state: int) -> List[str] | None: ... - def get_names(self) -> List[str]: ... - # Only the first element of args matters. - def complete_help(self, *args: Any) -> List[str]: ... - def do_help(self, arg: str) -> bool | None: ... - def print_topics(self, header: str, cmds: List[str] | None, cmdlen: Any, maxcol: int) -> None: ... - def columnize(self, list: List[str] | None, displaywidth: int = ...) -> None: ... diff --git a/stdlib/@python2/code.pyi b/stdlib/@python2/code.pyi deleted file mode 100644 index ae8dfc9..0000000 --- a/stdlib/@python2/code.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from types import CodeType -from typing import Any, Callable, Mapping - -class InteractiveInterpreter: - def __init__(self, locals: Mapping[str, Any] | None = ...) -> None: ... - def runsource(self, source: str, filename: str = ..., symbol: str = ...) -> bool: ... - def runcode(self, code: CodeType) -> None: ... - def showsyntaxerror(self, filename: str | None = ...) -> None: ... - def showtraceback(self) -> None: ... - def write(self, data: str) -> None: ... - -class InteractiveConsole(InteractiveInterpreter): - def __init__(self, locals: Mapping[str, Any] | None = ..., filename: str = ...) -> None: ... - def interact(self, banner: str | None = ...) -> None: ... - def push(self, line: str) -> bool: ... - def resetbuffer(self) -> None: ... - def raw_input(self, prompt: str = ...) -> str: ... - -def interact( - banner: str | None = ..., readfunc: Callable[[str], str] | None = ..., local: Mapping[str, Any] | None = ... -) -> None: ... -def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... diff --git a/stdlib/@python2/codecs.pyi b/stdlib/@python2/codecs.pyi deleted file mode 100644 index a783510..0000000 --- a/stdlib/@python2/codecs.pyi +++ /dev/null @@ -1,286 +0,0 @@ -import types -from abc import abstractmethod -from typing import ( - IO, - Any, - BinaryIO, - Callable, - Generator, - Iterable, - Iterator, - List, - Protocol, - Text, - TextIO, - Tuple, - Type, - TypeVar, - Union, - overload, -) -from typing_extensions import Literal - -# TODO: this only satisfies the most common interface, where -# bytes (py2 str) is the raw form and str (py2 unicode) is the cooked form. -# In the long run, both should become template parameters maybe? -# There *are* bytes->bytes and str->str encodings in the standard library. -# They are much more common in Python 2 than in Python 3. - -_Decoded = Text -_Encoded = bytes - -class _Encoder(Protocol): - def __call__(self, input: _Decoded, errors: str = ...) -> Tuple[_Encoded, int]: ... # signature of Codec().encode - -class _Decoder(Protocol): - def __call__(self, input: _Encoded, errors: str = ...) -> Tuple[_Decoded, int]: ... # signature of Codec().decode - -class _StreamReader(Protocol): - def __call__(self, stream: IO[_Encoded], errors: str = ...) -> StreamReader: ... - -class _StreamWriter(Protocol): - def __call__(self, stream: IO[_Encoded], errors: str = ...) -> StreamWriter: ... - -class _IncrementalEncoder(Protocol): - def __call__(self, errors: str = ...) -> IncrementalEncoder: ... - -class _IncrementalDecoder(Protocol): - def __call__(self, errors: str = ...) -> IncrementalDecoder: ... - -# The type ignore on `encode` and `decode` is to avoid issues with overlapping overloads, for more details, see #300 -# mypy and pytype disagree about where the type ignore can and cannot go, so alias the long type -_BytesToBytesEncodingT = Literal[ - "base64", - "base_64", - "base64_codec", - "bz2", - "bz2_codec", - "hex", - "hex_codec", - "quopri", - "quotedprintable", - "quoted_printable", - "quopri_codec", - "uu", - "uu_codec", - "zip", - "zlib", - "zlib_codec", -] - -@overload -def encode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... -@overload -def encode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... # type: ignore -@overload -def encode(obj: _Decoded, encoding: str = ..., errors: str = ...) -> _Encoded: ... -@overload -def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... # type: ignore -@overload -def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> Text: ... -@overload -def decode(obj: _Encoded, encoding: str = ..., errors: str = ...) -> _Decoded: ... -def lookup(__encoding: str) -> CodecInfo: ... -def utf_16_be_decode( - __data: _Encoded, __errors: str | None = ..., __final: bool = ... -) -> Tuple[_Decoded, int]: ... # undocumented -def utf_16_be_encode(__str: _Decoded, __errors: str | None = ...) -> Tuple[_Encoded, int]: ... # undocumented - -class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): - @property - def encode(self) -> _Encoder: ... - @property - def decode(self) -> _Decoder: ... - @property - def streamreader(self) -> _StreamReader: ... - @property - def streamwriter(self) -> _StreamWriter: ... - @property - def incrementalencoder(self) -> _IncrementalEncoder: ... - @property - def incrementaldecoder(self) -> _IncrementalDecoder: ... - name: str - def __new__( - cls, - encode: _Encoder, - decode: _Decoder, - streamreader: _StreamReader | None = ..., - streamwriter: _StreamWriter | None = ..., - incrementalencoder: _IncrementalEncoder | None = ..., - incrementaldecoder: _IncrementalDecoder | None = ..., - name: str | None = ..., - *, - _is_text_encoding: bool | None = ..., - ) -> CodecInfo: ... - -def getencoder(encoding: str) -> _Encoder: ... -def getdecoder(encoding: str) -> _Decoder: ... -def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ... -def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... -def getreader(encoding: str) -> _StreamReader: ... -def getwriter(encoding: str) -> _StreamWriter: ... -def register(__search_function: Callable[[str], CodecInfo | None]) -> None: ... -def open( - filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., buffering: int = ... -) -> StreamReaderWriter: ... -def EncodedFile(file: IO[_Encoded], data_encoding: str, file_encoding: str | None = ..., errors: str = ...) -> StreamRecoder: ... -def iterencode(iterator: Iterable[_Decoded], encoding: str, errors: str = ...) -> Generator[_Encoded, None, None]: ... -def iterdecode(iterator: Iterable[_Encoded], encoding: str, errors: str = ...) -> Generator[_Decoded, None, None]: ... - -BOM: bytes -BOM_BE: bytes -BOM_LE: bytes -BOM_UTF8: bytes -BOM_UTF16: bytes -BOM_UTF16_BE: bytes -BOM_UTF16_LE: bytes -BOM_UTF32: bytes -BOM_UTF32_BE: bytes -BOM_UTF32_LE: bytes - -# It is expected that different actions be taken depending on which of the -# three subclasses of `UnicodeError` is actually ...ed. However, the Union -# is still needed for at least one of the cases. -def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[str | bytes, int]]) -> None: ... -def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[str | bytes, int]]: ... -def strict_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def replace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def ignore_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def backslashreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... - -class Codec: - # These are sort of @abstractmethod but sort of not. - # The StreamReader and StreamWriter subclasses only implement one. - def encode(self, input: _Decoded, errors: str = ...) -> Tuple[_Encoded, int]: ... - def decode(self, input: _Encoded, errors: str = ...) -> Tuple[_Decoded, int]: ... - -class IncrementalEncoder: - errors: str - def __init__(self, errors: str = ...) -> None: ... - @abstractmethod - def encode(self, input: _Decoded, final: bool = ...) -> _Encoded: ... - def reset(self) -> None: ... - # documentation says int but str is needed for the subclass. - def getstate(self) -> int | _Decoded: ... - def setstate(self, state: int | _Decoded) -> None: ... - -class IncrementalDecoder: - errors: str - def __init__(self, errors: str = ...) -> None: ... - @abstractmethod - def decode(self, input: _Encoded, final: bool = ...) -> _Decoded: ... - def reset(self) -> None: ... - def getstate(self) -> Tuple[_Encoded, int]: ... - def setstate(self, state: Tuple[_Encoded, int]) -> None: ... - -# These are not documented but used in encodings/*.py implementations. -class BufferedIncrementalEncoder(IncrementalEncoder): - buffer: str - def __init__(self, errors: str = ...) -> None: ... - @abstractmethod - def _buffer_encode(self, input: _Decoded, errors: str, final: bool) -> _Encoded: ... - def encode(self, input: _Decoded, final: bool = ...) -> _Encoded: ... - -class BufferedIncrementalDecoder(IncrementalDecoder): - buffer: bytes - def __init__(self, errors: str = ...) -> None: ... - @abstractmethod - def _buffer_decode(self, input: _Encoded, errors: str, final: bool) -> Tuple[_Decoded, int]: ... - def decode(self, input: _Encoded, final: bool = ...) -> _Decoded: ... - -_SW = TypeVar("_SW", bound=StreamWriter) - -# TODO: it is not possible to specify the requirement that all other -# attributes and methods are passed-through from the stream. -class StreamWriter(Codec): - errors: str - def __init__(self, stream: IO[_Encoded], errors: str = ...) -> None: ... - def write(self, object: _Decoded) -> None: ... - def writelines(self, list: Iterable[_Decoded]) -> None: ... - def reset(self) -> None: ... - def __enter__(self: _SW) -> _SW: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... - def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ... - -_SR = TypeVar("_SR", bound=StreamReader) - -class StreamReader(Codec): - errors: str - def __init__(self, stream: IO[_Encoded], errors: str = ...) -> None: ... - def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> _Decoded: ... - def readline(self, size: int | None = ..., keepends: bool = ...) -> _Decoded: ... - def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> List[_Decoded]: ... - def reset(self) -> None: ... - def __enter__(self: _SR) -> _SR: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... - def __iter__(self) -> Iterator[_Decoded]: ... - def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ... - -_T = TypeVar("_T", bound=StreamReaderWriter) - -# Doesn't actually inherit from TextIO, but wraps a BinaryIO to provide text reading and writing -# and delegates attributes to the underlying binary stream with __getattr__. -class StreamReaderWriter(TextIO): - def __init__(self, stream: IO[_Encoded], Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ... - def read(self, size: int = ...) -> _Decoded: ... - def readline(self, size: int | None = ...) -> _Decoded: ... - def readlines(self, sizehint: int | None = ...) -> List[_Decoded]: ... - def next(self) -> Text: ... - def __iter__(self: _T) -> _T: ... - # This actually returns None, but that's incompatible with the supertype - def write(self, data: _Decoded) -> int: ... - def writelines(self, list: Iterable[_Decoded]) -> None: ... - def reset(self) -> None: ... - # Same as write() - def seek(self, offset: int, whence: int = ...) -> int: ... - def __enter__(self: _T) -> _T: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... - def __getattr__(self, name: str) -> Any: ... - # These methods don't actually exist directly, but they are needed to satisfy the TextIO - # interface. At runtime, they are delegated through __getattr__. - def close(self) -> None: ... - def fileno(self) -> int: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def readable(self) -> bool: ... - def truncate(self, size: int | None = ...) -> int: ... - def seekable(self) -> bool: ... - def tell(self) -> int: ... - def writable(self) -> bool: ... - -_SRT = TypeVar("_SRT", bound=StreamRecoder) - -class StreamRecoder(BinaryIO): - def __init__( - self, - stream: IO[_Encoded], - encode: _Encoder, - decode: _Decoder, - Reader: _StreamReader, - Writer: _StreamWriter, - errors: str = ..., - ) -> None: ... - def read(self, size: int = ...) -> bytes: ... - def readline(self, size: int | None = ...) -> bytes: ... - def readlines(self, sizehint: int | None = ...) -> List[bytes]: ... - def next(self) -> bytes: ... - def __iter__(self: _SRT) -> _SRT: ... - def write(self, data: bytes) -> int: ... - def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore # it's supposed to return None - def reset(self) -> None: ... - def __getattr__(self, name: str) -> Any: ... - def __enter__(self: _SRT) -> _SRT: ... - def __exit__(self, type: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... - # These methods don't actually exist directly, but they are needed to satisfy the BinaryIO - # interface. At runtime, they are delegated through __getattr__. - def seek(self, offset: int, whence: int = ...) -> int: ... - def close(self) -> None: ... - def fileno(self) -> int: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def readable(self) -> bool: ... - def truncate(self, size: int | None = ...) -> int: ... - def seekable(self) -> bool: ... - def tell(self) -> int: ... - def writable(self) -> bool: ... diff --git a/stdlib/@python2/codeop.pyi b/stdlib/@python2/codeop.pyi deleted file mode 100644 index 8ed5710..0000000 --- a/stdlib/@python2/codeop.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from types import CodeType - -def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... - -class Compile: - flags: int - def __init__(self) -> None: ... - def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ... - -class CommandCompiler: - compiler: Compile - def __init__(self) -> None: ... - def __call__(self, source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... diff --git a/stdlib/@python2/collections.pyi b/stdlib/@python2/collections.pyi deleted file mode 100644 index 5a2f73a..0000000 --- a/stdlib/@python2/collections.pyi +++ /dev/null @@ -1,122 +0,0 @@ -from typing import ( - AbstractSet, - Any, - Callable as Callable, - Container as Container, - Dict, - Generic, - Hashable as Hashable, - ItemsView as ItemsView, - Iterable as Iterable, - Iterator as Iterator, - KeysView as KeysView, - List, - Mapping as Mapping, - MappingView as MappingView, - MutableMapping as MutableMapping, - MutableSequence as MutableSequence, - MutableSet as MutableSet, - Reversible, - Sequence as Sequence, - Sized as Sized, - Tuple, - Type, - TypeVar, - ValuesView as ValuesView, - overload, -) - -Set = AbstractSet - -_S = TypeVar("_S") -_T = TypeVar("_T") -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") - -# namedtuple is special-cased in the type checker; the initializer is ignored. -def namedtuple( - typename: str | unicode, field_names: str | unicode | Iterable[str | unicode], verbose: bool = ..., rename: bool = ... -) -> Type[Tuple[Any, ...]]: ... - -class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]): - def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ... - @property - def maxlen(self) -> int | None: ... - def append(self, x: _T) -> None: ... - def appendleft(self, x: _T) -> None: ... - def clear(self) -> None: ... - def count(self, x: _T) -> int: ... - def extend(self, iterable: Iterable[_T]) -> None: ... - def extendleft(self, iterable: Iterable[_T]) -> None: ... - def pop(self) -> _T: ... - def popleft(self) -> _T: ... - def remove(self, value: _T) -> None: ... - def reverse(self) -> None: ... - def rotate(self, n: int = ...) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - def __hash__(self) -> int: ... - def __getitem__(self, i: int) -> _T: ... - def __setitem__(self, i: int, x: _T) -> None: ... - def __contains__(self, o: _T) -> bool: ... - def __reversed__(self) -> Iterator[_T]: ... - def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ... - -class Counter(Dict[_T, int], Generic[_T]): - @overload - def __init__(self, **kwargs: int) -> None: ... - @overload - def __init__(self, mapping: Mapping[_T, int]) -> None: ... - @overload - def __init__(self, iterable: Iterable[_T]) -> None: ... - def copy(self: _S) -> _S: ... - def elements(self) -> Iterator[_T]: ... - def most_common(self, n: int | None = ...) -> List[Tuple[_T, int]]: ... - @overload - def subtract(self, __mapping: Mapping[_T, int]) -> None: ... - @overload - def subtract(self, iterable: Iterable[_T]) -> None: ... - # The Iterable[Tuple[...]] argument type is not actually desirable - # (the tuples will be added as keys, breaking type safety) but - # it's included so that the signature is compatible with - # Dict.update. Not sure if we should use '# type: ignore' instead - # and omit the type from the union. - @overload - def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ... - @overload - def update(self, __m: Iterable[_T] | Iterable[Tuple[_T, int]], **kwargs: int) -> None: ... - @overload - def update(self, **kwargs: int) -> None: ... - def __add__(self, other: Counter[_T]) -> Counter[_T]: ... - def __sub__(self, other: Counter[_T]) -> Counter[_T]: ... - def __and__(self, other: Counter[_T]) -> Counter[_T]: ... - def __or__(self, other: Counter[_T]) -> Counter[_T]: ... - def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ... - def __isub__(self, other: Counter[_T]) -> Counter[_T]: ... - def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... - def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... - -class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): - def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ... - def copy(self: _S) -> _S: ... - def __reversed__(self) -> Iterator[_KT]: ... - -class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): - default_factory: Callable[[], _VT] - @overload - def __init__(self, **kwargs: _VT) -> None: ... - @overload - def __init__(self, default_factory: Callable[[], _VT] | None) -> None: ... - @overload - def __init__(self, default_factory: Callable[[], _VT] | None, **kwargs: _VT) -> None: ... - @overload - def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT]) -> None: ... - @overload - def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... - @overload - def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __missing__(self, key: _KT) -> _VT: ... - def copy(self: _S) -> _S: ... diff --git a/stdlib/@python2/colorsys.pyi b/stdlib/@python2/colorsys.pyi deleted file mode 100644 index 8db2e2c..0000000 --- a/stdlib/@python2/colorsys.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Tuple - -def rgb_to_yiq(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def yiq_to_rgb(y: float, i: float, q: float) -> Tuple[float, float, float]: ... -def rgb_to_hls(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def hls_to_rgb(h: float, l: float, s: float) -> Tuple[float, float, float]: ... -def rgb_to_hsv(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def hsv_to_rgb(h: float, s: float, v: float) -> Tuple[float, float, float]: ... - -# TODO undocumented -ONE_SIXTH: float -ONE_THIRD: float -TWO_THIRD: float diff --git a/stdlib/@python2/commands.pyi b/stdlib/@python2/commands.pyi deleted file mode 100644 index 970d6cc..0000000 --- a/stdlib/@python2/commands.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import AnyStr, Text, Tuple, overload - -def getstatus(file: Text) -> str: ... -def getoutput(cmd: Text) -> str: ... -def getstatusoutput(cmd: Text) -> Tuple[int, str]: ... -@overload -def mk2arg(head: bytes, x: bytes) -> bytes: ... -@overload -def mk2arg(head: Text, x: Text) -> Text: ... -def mkarg(x: AnyStr) -> AnyStr: ... diff --git a/stdlib/@python2/compileall.pyi b/stdlib/@python2/compileall.pyi deleted file mode 100644 index ef22929..0000000 --- a/stdlib/@python2/compileall.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any, Pattern, Text - -# rx can be any object with a 'search' method; once we have Protocols we can change the type -def compile_dir( - dir: Text, maxlevels: int = ..., ddir: Text | None = ..., force: bool = ..., rx: Pattern[Any] | None = ..., quiet: int = ... -) -> int: ... -def compile_file( - fullname: Text, ddir: Text | None = ..., force: bool = ..., rx: Pattern[Any] | None = ..., quiet: int = ... -) -> int: ... -def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ... diff --git a/stdlib/@python2/contextlib.pyi b/stdlib/@python2/contextlib.pyi deleted file mode 100644 index 6aabf5a..0000000 --- a/stdlib/@python2/contextlib.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from types import TracebackType -from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Type, TypeVar -from typing_extensions import Protocol - -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_T_io = TypeVar("_T_io", bound=Optional[IO[str]]) -_F = TypeVar("_F", bound=Callable[..., Any]) - -_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool] -_CM_EF = TypeVar("_CM_EF", ContextManager[Any], _ExitFunc) - -class GeneratorContextManager(ContextManager[_T_co]): - def __call__(self, func: _F) -> _F: ... - -def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ... -def nested(*mgr: ContextManager[Any]) -> ContextManager[Iterable[Any]]: ... - -class _SupportsClose(Protocol): - def close(self) -> None: ... - -_SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose) - -class closing(ContextManager[_SupportsCloseT]): - def __init__(self, thing: _SupportsCloseT) -> None: ... diff --git a/stdlib/@python2/cookielib.pyi b/stdlib/@python2/cookielib.pyi deleted file mode 100644 index 0f813c1..0000000 --- a/stdlib/@python2/cookielib.pyi +++ /dev/null @@ -1,142 +0,0 @@ -from typing import Any - -class Cookie: - version: Any - name: Any - value: Any - port: Any - port_specified: Any - domain: Any - domain_specified: Any - domain_initial_dot: Any - path: Any - path_specified: Any - secure: Any - expires: Any - discard: Any - comment: Any - comment_url: Any - rfc2109: Any - def __init__( - self, - version, - name, - value, - port, - port_specified, - domain, - domain_specified, - domain_initial_dot, - path, - path_specified, - secure, - expires, - discard, - comment, - comment_url, - rest, - rfc2109: bool = ..., - ): ... - def has_nonstandard_attr(self, name): ... - def get_nonstandard_attr(self, name, default: Any | None = ...): ... - def set_nonstandard_attr(self, name, value): ... - def is_expired(self, now: Any | None = ...): ... - -class CookiePolicy: - def set_ok(self, cookie, request): ... - def return_ok(self, cookie, request): ... - def domain_return_ok(self, domain, request): ... - def path_return_ok(self, path, request): ... - -class DefaultCookiePolicy(CookiePolicy): - DomainStrictNoDots: Any - DomainStrictNonDomain: Any - DomainRFC2965Match: Any - DomainLiberal: Any - DomainStrict: Any - netscape: Any - rfc2965: Any - rfc2109_as_netscape: Any - hide_cookie2: Any - strict_domain: Any - strict_rfc2965_unverifiable: Any - strict_ns_unverifiable: Any - strict_ns_domain: Any - strict_ns_set_initial_dollar: Any - strict_ns_set_path: Any - def __init__( - self, - blocked_domains: Any | None = ..., - allowed_domains: Any | None = ..., - netscape: bool = ..., - rfc2965: bool = ..., - rfc2109_as_netscape: Any | None = ..., - hide_cookie2: bool = ..., - strict_domain: bool = ..., - strict_rfc2965_unverifiable: bool = ..., - strict_ns_unverifiable: bool = ..., - strict_ns_domain=..., - strict_ns_set_initial_dollar: bool = ..., - strict_ns_set_path: bool = ..., - ): ... - def blocked_domains(self): ... - def set_blocked_domains(self, blocked_domains): ... - def is_blocked(self, domain): ... - def allowed_domains(self): ... - def set_allowed_domains(self, allowed_domains): ... - def is_not_allowed(self, domain): ... - def set_ok(self, cookie, request): ... - def set_ok_version(self, cookie, request): ... - def set_ok_verifiability(self, cookie, request): ... - def set_ok_name(self, cookie, request): ... - def set_ok_path(self, cookie, request): ... - def set_ok_domain(self, cookie, request): ... - def set_ok_port(self, cookie, request): ... - def return_ok(self, cookie, request): ... - def return_ok_version(self, cookie, request): ... - def return_ok_verifiability(self, cookie, request): ... - def return_ok_secure(self, cookie, request): ... - def return_ok_expires(self, cookie, request): ... - def return_ok_port(self, cookie, request): ... - def return_ok_domain(self, cookie, request): ... - def domain_return_ok(self, domain, request): ... - def path_return_ok(self, path, request): ... - -class Absent: ... - -class CookieJar: - non_word_re: Any - quote_re: Any - strict_domain_re: Any - domain_re: Any - dots_re: Any - magic_re: Any - def __init__(self, policy: Any | None = ...): ... - def set_policy(self, policy): ... - def add_cookie_header(self, request): ... - def make_cookies(self, response, request): ... - def set_cookie_if_ok(self, cookie, request): ... - def set_cookie(self, cookie): ... - def extract_cookies(self, response, request): ... - def clear(self, domain: Any | None = ..., path: Any | None = ..., name: Any | None = ...): ... - def clear_session_cookies(self): ... - def clear_expired_cookies(self): ... - def __iter__(self): ... - def __len__(self): ... - -class LoadError(IOError): ... - -class FileCookieJar(CookieJar): - filename: Any - delayload: Any - def __init__(self, filename: Any | None = ..., delayload: bool = ..., policy: Any | None = ...): ... - def save(self, filename: Any | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ... - def load(self, filename: Any | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ... - def revert(self, filename: Any | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ... - -class LWPCookieJar(FileCookieJar): - def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented - -MozillaCookieJar = FileCookieJar - -def lwp_cookie_str(cookie: Cookie) -> str: ... diff --git a/stdlib/@python2/copy.pyi b/stdlib/@python2/copy.pyi deleted file mode 100644 index c88f928..0000000 --- a/stdlib/@python2/copy.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from typing import Any, Dict, TypeVar - -_T = TypeVar("_T") - -# None in CPython but non-None in Jython -PyStringMap: Any - -# Note: memo and _nil are internal kwargs. -def deepcopy(x: _T, memo: Dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ... -def copy(x: _T) -> _T: ... - -class Error(Exception): ... - -error = Error diff --git a/stdlib/@python2/copy_reg.pyi b/stdlib/@python2/copy_reg.pyi deleted file mode 100644 index 91b0998..0000000 --- a/stdlib/@python2/copy_reg.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union - -_TypeT = TypeVar("_TypeT", bound=type) -_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]] - -__all__: List[str] - -def pickle( - ob_type: _TypeT, - pickle_function: Callable[[_TypeT], str | _Reduce[_TypeT]], - constructor_ob: Callable[[_Reduce[_TypeT]], _TypeT] | None = ..., -) -> None: ... -def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ... -def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... -def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ... -def clear_extension_cache() -> None: ... diff --git a/stdlib/@python2/copyreg.pyi b/stdlib/@python2/copyreg.pyi deleted file mode 100644 index 91b0998..0000000 --- a/stdlib/@python2/copyreg.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union - -_TypeT = TypeVar("_TypeT", bound=type) -_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]] - -__all__: List[str] - -def pickle( - ob_type: _TypeT, - pickle_function: Callable[[_TypeT], str | _Reduce[_TypeT]], - constructor_ob: Callable[[_Reduce[_TypeT]], _TypeT] | None = ..., -) -> None: ... -def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ... -def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... -def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ... -def clear_extension_cache() -> None: ... diff --git a/stdlib/@python2/crypt.pyi b/stdlib/@python2/crypt.pyi deleted file mode 100644 index c4036db..0000000 --- a/stdlib/@python2/crypt.pyi +++ /dev/null @@ -1 +0,0 @@ -def crypt(word: str, salt: str) -> str: ... diff --git a/stdlib/@python2/csv.pyi b/stdlib/@python2/csv.pyi deleted file mode 100644 index 886de62..0000000 --- a/stdlib/@python2/csv.pyi +++ /dev/null @@ -1,102 +0,0 @@ -from _csv import ( - QUOTE_ALL as QUOTE_ALL, - QUOTE_MINIMAL as QUOTE_MINIMAL, - QUOTE_NONE as QUOTE_NONE, - QUOTE_NONNUMERIC as QUOTE_NONNUMERIC, - Dialect as Dialect, - Error as Error, - _DialectLike, - _reader, - _writer, - field_size_limit as field_size_limit, - get_dialect as get_dialect, - list_dialects as list_dialects, - reader as reader, - register_dialect as register_dialect, - unregister_dialect as unregister_dialect, - writer as writer, -) -from typing import ( - Any, - Dict as _DictReadMapping, - Generic, - Iterable, - Iterator, - List, - Mapping, - Sequence, - Text, - Type, - TypeVar, - overload, -) - -_T = TypeVar("_T") - -class excel(Dialect): - delimiter: str - quotechar: str - doublequote: bool - skipinitialspace: bool - lineterminator: str - quoting: int - -class excel_tab(excel): - delimiter: str - -class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]): - fieldnames: Sequence[_T] | None - restkey: str | None - restval: str | None - reader: _reader - dialect: _DialectLike - line_num: int - @overload - def __init__( - self, - f: Iterable[Text], - fieldnames: Sequence[_T], - restkey: str | None = ..., - restval: str | None = ..., - dialect: _DialectLike = ..., - *args: Any, - **kwds: Any, - ) -> None: ... - @overload - def __init__( - self: DictReader[str], - f: Iterable[Text], - fieldnames: Sequence[str] | None = ..., - restkey: str | None = ..., - restval: str | None = ..., - dialect: _DialectLike = ..., - *args: Any, - **kwds: Any, - ) -> None: ... - def __iter__(self) -> DictReader[_T]: ... - def next(self) -> _DictReadMapping[_T, str]: ... - -class DictWriter(Generic[_T]): - fieldnames: Sequence[_T] - restval: Any | None - extrasaction: str - writer: _writer - def __init__( - self, - f: Any, - fieldnames: Sequence[_T], - restval: Any | None = ..., - extrasaction: str = ..., - dialect: _DialectLike = ..., - *args: Any, - **kwds: Any, - ) -> None: ... - def writeheader(self) -> None: ... - def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ... - def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ... - -class Sniffer(object): - preferred: List[str] - def __init__(self) -> None: ... - def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ... - def has_header(self, sample: str) -> bool: ... diff --git a/stdlib/@python2/ctypes/__init__.pyi b/stdlib/@python2/ctypes/__init__.pyi deleted file mode 100644 index 149e9f2..0000000 --- a/stdlib/@python2/ctypes/__init__.pyi +++ /dev/null @@ -1,293 +0,0 @@ -import sys -from array import array -from typing import ( - Any, - Callable, - ClassVar, - Generic, - Iterable, - Iterator, - List, - Mapping, - Optional, - Sequence, - Text, - Tuple, - Type, - TypeVar, - Union as _UnionT, - overload, -) - -_T = TypeVar("_T") -_DLLT = TypeVar("_DLLT", bound=CDLL) -_CT = TypeVar("_CT", bound=_CData) - -RTLD_GLOBAL: int = ... -RTLD_LOCAL: int = ... -DEFAULT_MODE: int = ... - -class CDLL(object): - _func_flags_: ClassVar[int] = ... - _func_restype_: ClassVar[_CData] = ... - _name: str = ... - _handle: int = ... - _FuncPtr: Type[_FuncPointer] = ... - def __init__( - self, name: str | None, mode: int = ..., handle: int | None = ..., use_errno: bool = ..., use_last_error: bool = ... - ) -> None: ... - def __getattr__(self, name: str) -> _NamedFuncPointer: ... - def __getitem__(self, name: str) -> _NamedFuncPointer: ... - -if sys.platform == "win32": - class OleDLL(CDLL): ... - class WinDLL(CDLL): ... - -class PyDLL(CDLL): ... - -class LibraryLoader(Generic[_DLLT]): - def __init__(self, dlltype: Type[_DLLT]) -> None: ... - def __getattr__(self, name: str) -> _DLLT: ... - def __getitem__(self, name: str) -> _DLLT: ... - def LoadLibrary(self, name: str) -> _DLLT: ... - -cdll: LibraryLoader[CDLL] = ... -if sys.platform == "win32": - windll: LibraryLoader[WinDLL] = ... - oledll: LibraryLoader[OleDLL] = ... -pydll: LibraryLoader[PyDLL] = ... -pythonapi: PyDLL = ... - -# Anything that implements the read-write buffer interface. -# The buffer interface is defined purely on the C level, so we cannot define a normal Protocol -# for it. Instead we have to list the most common stdlib buffer classes in a Union. -_WritableBuffer = _UnionT[bytearray, memoryview, array[Any], _CData] -# Same as _WritableBuffer, but also includes read-only buffer types (like bytes). -_ReadOnlyBuffer = _UnionT[_WritableBuffer, bytes] - -class _CDataMeta(type): - # By default mypy complains about the following two methods, because strictly speaking cls - # might not be a Type[_CT]. However this can never actually happen, because the only class that - # uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here. - def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore - def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore - -class _CData(metaclass=_CDataMeta): - _b_base: int = ... - _b_needsfree_: bool = ... - _objects: Mapping[Any, int] | None = ... - @classmethod - def from_buffer(cls: Type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ... - @classmethod - def from_buffer_copy(cls: Type[_CT], source: _ReadOnlyBuffer, offset: int = ...) -> _CT: ... - @classmethod - def from_address(cls: Type[_CT], address: int) -> _CT: ... - @classmethod - def from_param(cls: Type[_CT], obj: Any) -> _UnionT[_CT, _CArgObject]: ... - @classmethod - def in_dll(cls: Type[_CT], library: CDLL, name: str) -> _CT: ... - -class _CanCastTo(_CData): ... -class _PointerLike(_CanCastTo): ... - -_ECT = Callable[[Optional[Type[_CData]], _FuncPointer, Tuple[_CData, ...]], _CData] -_PF = _UnionT[Tuple[int], Tuple[int, str], Tuple[int, str, Any]] - -class _FuncPointer(_PointerLike, _CData): - restype: _UnionT[Type[_CData], Callable[[int], Any], None] = ... - argtypes: Sequence[Type[_CData]] = ... - errcheck: _ECT = ... - @overload - def __init__(self, address: int) -> None: ... - @overload - def __init__(self, callable: Callable[..., Any]) -> None: ... - @overload - def __init__(self, func_spec: Tuple[_UnionT[str, int], CDLL], paramflags: Tuple[_PF, ...] = ...) -> None: ... - @overload - def __init__(self, vtlb_index: int, name: str, paramflags: Tuple[_PF, ...] = ..., iid: pointer[c_int] = ...) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - -class _NamedFuncPointer(_FuncPointer): - __name__: str - -class ArgumentError(Exception): ... - -def CFUNCTYPE( - restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... -) -> Type[_FuncPointer]: ... - -if sys.platform == "win32": - def WINFUNCTYPE( - restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... - ) -> Type[_FuncPointer]: ... - -def PYFUNCTYPE(restype: Type[_CData] | None, *argtypes: Type[_CData]) -> Type[_FuncPointer]: ... - -class _CArgObject: ... - -# Any type that can be implicitly converted to c_void_p when passed as a C function argument. -# (bytes is not included here, see below.) -_CVoidPLike = _UnionT[_PointerLike, Array[Any], _CArgObject, int] -# Same as above, but including types known to be read-only (i. e. bytes). -# This distinction is not strictly necessary (ctypes doesn't differentiate between const -# and non-const pointers), but it catches errors like memmove(b'foo', buf, 4) -# when memmove(buf, b'foo', 4) was intended. -_CVoidConstPLike = _UnionT[_CVoidPLike, bytes] - -def addressof(obj: _CData) -> int: ... -def alignment(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ... -def byref(obj: _CData, offset: int = ...) -> _CArgObject: ... - -_CastT = TypeVar("_CastT", bound=_CanCastTo) - -def cast(obj: _UnionT[_CData, _CArgObject, int], typ: Type[_CastT]) -> _CastT: ... -def create_string_buffer(init: _UnionT[int, bytes], size: int | None = ...) -> Array[c_char]: ... - -c_buffer = create_string_buffer - -def create_unicode_buffer(init: _UnionT[int, Text], size: int | None = ...) -> Array[c_wchar]: ... - -if sys.platform == "win32": - def DllCanUnloadNow() -> int: ... - def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented - def FormatError(code: int) -> str: ... - def GetLastError() -> int: ... - -def get_errno() -> int: ... - -if sys.platform == "win32": - def get_last_error() -> int: ... - -def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> None: ... -def memset(dst: _CVoidPLike, c: int, count: int) -> None: ... -def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ... - -# The real ctypes.pointer is a function, not a class. The stub version of pointer behaves like -# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer, -# it can be instantiated directly (to mimic the behavior of the real pointer function). -class pointer(Generic[_CT], _PointerLike, _CData): - _type_: ClassVar[Type[_CT]] = ... - contents: _CT = ... - def __init__(self, arg: _CT = ...) -> None: ... - @overload - def __getitem__(self, i: int) -> _CT: ... - @overload - def __getitem__(self, s: slice) -> List[_CT]: ... - @overload - def __setitem__(self, i: int, o: _CT) -> None: ... - @overload - def __setitem__(self, s: slice, o: Iterable[_CT]) -> None: ... - -def resize(obj: _CData, size: int) -> None: ... -def set_conversion_mode(encoding: str, errors: str) -> Tuple[str, str]: ... -def set_errno(value: int) -> int: ... - -if sys.platform == "win32": - def set_last_error(value: int) -> int: ... - -def sizeof(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ... -def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ... - -if sys.platform == "win32": - def WinError(code: int | None = ..., descr: str | None = ...) -> OSError: ... - -def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ... - -class _SimpleCData(Generic[_T], _CData): - value: _T = ... - def __init__(self, value: _T = ...) -> None: ... - -class c_byte(_SimpleCData[int]): ... - -class c_char(_SimpleCData[bytes]): - def __init__(self, value: _UnionT[int, bytes] = ...) -> None: ... - -class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]): - def __init__(self, value: _UnionT[int, bytes] | None = ...) -> None: ... - -class c_double(_SimpleCData[float]): ... -class c_longdouble(_SimpleCData[float]): ... -class c_float(_SimpleCData[float]): ... -class c_int(_SimpleCData[int]): ... -class c_int8(_SimpleCData[int]): ... -class c_int16(_SimpleCData[int]): ... -class c_int32(_SimpleCData[int]): ... -class c_int64(_SimpleCData[int]): ... -class c_long(_SimpleCData[int]): ... -class c_longlong(_SimpleCData[int]): ... -class c_short(_SimpleCData[int]): ... -class c_size_t(_SimpleCData[int]): ... -class c_ssize_t(_SimpleCData[int]): ... -class c_ubyte(_SimpleCData[int]): ... -class c_uint(_SimpleCData[int]): ... -class c_uint8(_SimpleCData[int]): ... -class c_uint16(_SimpleCData[int]): ... -class c_uint32(_SimpleCData[int]): ... -class c_uint64(_SimpleCData[int]): ... -class c_ulong(_SimpleCData[int]): ... -class c_ulonglong(_SimpleCData[int]): ... -class c_ushort(_SimpleCData[int]): ... -class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ... -class c_wchar(_SimpleCData[Text]): ... - -class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]): - def __init__(self, value: _UnionT[int, Text] | None = ...) -> None: ... - -class c_bool(_SimpleCData[bool]): - def __init__(self, value: bool = ...) -> None: ... - -if sys.platform == "win32": - class HRESULT(_SimpleCData[int]): ... # TODO undocumented - -class py_object(_CanCastTo, _SimpleCData[_T]): ... - -class _CField: - offset: int = ... - size: int = ... - -class _StructUnionMeta(_CDataMeta): - _fields_: Sequence[_UnionT[Tuple[str, Type[_CData]], Tuple[str, Type[_CData], int]]] = ... - _pack_: int = ... - _anonymous_: Sequence[str] = ... - def __getattr__(self, name: str) -> _CField: ... - -class _StructUnionBase(_CData, metaclass=_StructUnionMeta): - def __init__(self, *args: Any, **kw: Any) -> None: ... - def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - -class Union(_StructUnionBase): ... -class Structure(_StructUnionBase): ... -class BigEndianStructure(Structure): ... -class LittleEndianStructure(Structure): ... - -class Array(Generic[_CT], _CData): - _length_: ClassVar[int] = ... - _type_: ClassVar[Type[_CT]] = ... - raw: bytes = ... # Note: only available if _CT == c_char - value: Any = ... # Note: bytes if _CT == c_char, Text if _CT == c_wchar, unavailable otherwise - # TODO These methods cannot be annotated correctly at the moment. - # All of these "Any"s stand for the array's element type, but it's not possible to use _CT - # here, because of a special feature of ctypes. - # By default, when accessing an element of an Array[_CT], the returned object has type _CT. - # However, when _CT is a "simple type" like c_int, ctypes automatically "unboxes" the object - # and converts it to the corresponding Python primitive. For example, when accessing an element - # of an Array[c_int], a Python int object is returned, not a c_int. - # This behavior does *not* apply to subclasses of "simple types". - # If MyInt is a subclass of c_int, then accessing an element of an Array[MyInt] returns - # a MyInt, not an int. - # This special behavior is not easy to model in a stub, so for now all places where - # the array element type would belong are annotated with Any instead. - def __init__(self, *args: Any) -> None: ... - @overload - def __getitem__(self, i: int) -> Any: ... - @overload - def __getitem__(self, s: slice) -> List[Any]: ... - @overload - def __setitem__(self, i: int, o: Any) -> None: ... - @overload - def __setitem__(self, s: slice, o: Iterable[Any]) -> None: ... - def __iter__(self) -> Iterator[Any]: ... - # Can't inherit from Sized because the metaclass conflict between - # Sized and _CData prevents using _CDataMeta. - def __len__(self) -> int: ... diff --git a/stdlib/@python2/ctypes/util.pyi b/stdlib/@python2/ctypes/util.pyi deleted file mode 100644 index c0274f5..0000000 --- a/stdlib/@python2/ctypes/util.pyi +++ /dev/null @@ -1,6 +0,0 @@ -import sys - -def find_library(name: str) -> str | None: ... - -if sys.platform == "win32": - def find_msvcrt() -> str | None: ... diff --git a/stdlib/@python2/ctypes/wintypes.pyi b/stdlib/@python2/ctypes/wintypes.pyi deleted file mode 100644 index c178a9b..0000000 --- a/stdlib/@python2/ctypes/wintypes.pyi +++ /dev/null @@ -1,234 +0,0 @@ -from ctypes import ( - Array, - Structure, - _SimpleCData, - c_byte, - c_char, - c_char_p, - c_double, - c_float, - c_int, - c_long, - c_longlong, - c_short, - c_uint, - c_ulong, - c_ulonglong, - c_ushort, - c_void_p, - c_wchar, - c_wchar_p, - pointer, -) - -BYTE = c_byte -WORD = c_ushort -DWORD = c_ulong -CHAR = c_char -WCHAR = c_wchar -UINT = c_uint -INT = c_int -DOUBLE = c_double -FLOAT = c_float -BOOLEAN = BYTE -BOOL = c_long - -class VARIANT_BOOL(_SimpleCData[bool]): ... - -ULONG = c_ulong -LONG = c_long -USHORT = c_ushort -SHORT = c_short -LARGE_INTEGER = c_longlong -_LARGE_INTEGER = c_longlong -ULARGE_INTEGER = c_ulonglong -_ULARGE_INTEGER = c_ulonglong - -OLESTR = c_wchar_p -LPOLESTR = c_wchar_p -LPCOLESTR = c_wchar_p -LPWSTR = c_wchar_p -LPCWSTR = c_wchar_p -LPSTR = c_char_p -LPCSTR = c_char_p -LPVOID = c_void_p -LPCVOID = c_void_p - -# These two types are pointer-sized unsigned and signed ints, respectively. -# At runtime, they are either c_[u]long or c_[u]longlong, depending on the host's pointer size -# (they are not really separate classes). -class WPARAM(_SimpleCData[int]): ... -class LPARAM(_SimpleCData[int]): ... - -ATOM = WORD -LANGID = WORD -COLORREF = DWORD -LGRPID = DWORD -LCTYPE = DWORD -LCID = DWORD - -HANDLE = c_void_p -HACCEL = HANDLE -HBITMAP = HANDLE -HBRUSH = HANDLE -HCOLORSPACE = HANDLE -HDC = HANDLE -HDESK = HANDLE -HDWP = HANDLE -HENHMETAFILE = HANDLE -HFONT = HANDLE -HGDIOBJ = HANDLE -HGLOBAL = HANDLE -HHOOK = HANDLE -HICON = HANDLE -HINSTANCE = HANDLE -HKEY = HANDLE -HKL = HANDLE -HLOCAL = HANDLE -HMENU = HANDLE -HMETAFILE = HANDLE -HMODULE = HANDLE -HMONITOR = HANDLE -HPALETTE = HANDLE -HPEN = HANDLE -HRGN = HANDLE -HRSRC = HANDLE -HSTR = HANDLE -HTASK = HANDLE -HWINSTA = HANDLE -HWND = HANDLE -SC_HANDLE = HANDLE -SERVICE_STATUS_HANDLE = HANDLE - -class RECT(Structure): - left: LONG - top: LONG - right: LONG - bottom: LONG - -RECTL = RECT -_RECTL = RECT -tagRECT = RECT - -class _SMALL_RECT(Structure): - Left: SHORT - Top: SHORT - Right: SHORT - Bottom: SHORT - -SMALL_RECT = _SMALL_RECT - -class _COORD(Structure): - X: SHORT - Y: SHORT - -class POINT(Structure): - x: LONG - y: LONG - -POINTL = POINT -_POINTL = POINT -tagPOINT = POINT - -class SIZE(Structure): - cx: LONG - cy: LONG - -SIZEL = SIZE -tagSIZE = SIZE - -def RGB(red: int, green: int, blue: int) -> int: ... - -class FILETIME(Structure): - dwLowDateTime: DWORD - dwHighDateTime: DWORD - -_FILETIME = FILETIME - -class MSG(Structure): - hWnd: HWND - message: UINT - wParam: WPARAM - lParam: LPARAM - time: DWORD - pt: POINT - -tagMSG = MSG -MAX_PATH: int - -class WIN32_FIND_DATAA(Structure): - dwFileAttributes: DWORD - ftCreationTime: FILETIME - ftLastAccessTime: FILETIME - ftLastWriteTime: FILETIME - nFileSizeHigh: DWORD - nFileSizeLow: DWORD - dwReserved0: DWORD - dwReserved1: DWORD - cFileName: Array[CHAR] - cAlternateFileName: Array[CHAR] - -class WIN32_FIND_DATAW(Structure): - dwFileAttributes: DWORD - ftCreationTime: FILETIME - ftLastAccessTime: FILETIME - ftLastWriteTime: FILETIME - nFileSizeHigh: DWORD - nFileSizeLow: DWORD - dwReserved0: DWORD - dwReserved1: DWORD - cFileName: Array[WCHAR] - cAlternateFileName: Array[WCHAR] - -# These pointer type definitions use pointer[...] instead of POINTER(...), to allow them -# to be used in type annotations. -PBOOL = pointer[BOOL] -LPBOOL = pointer[BOOL] -PBOOLEAN = pointer[BOOLEAN] -PBYTE = pointer[BYTE] -LPBYTE = pointer[BYTE] -PCHAR = pointer[CHAR] -LPCOLORREF = pointer[COLORREF] -PDWORD = pointer[DWORD] -LPDWORD = pointer[DWORD] -PFILETIME = pointer[FILETIME] -LPFILETIME = pointer[FILETIME] -PFLOAT = pointer[FLOAT] -PHANDLE = pointer[HANDLE] -LPHANDLE = pointer[HANDLE] -PHKEY = pointer[HKEY] -LPHKL = pointer[HKL] -PINT = pointer[INT] -LPINT = pointer[INT] -PLARGE_INTEGER = pointer[LARGE_INTEGER] -PLCID = pointer[LCID] -PLONG = pointer[LONG] -LPLONG = pointer[LONG] -PMSG = pointer[MSG] -LPMSG = pointer[MSG] -PPOINT = pointer[POINT] -LPPOINT = pointer[POINT] -PPOINTL = pointer[POINTL] -PRECT = pointer[RECT] -LPRECT = pointer[RECT] -PRECTL = pointer[RECTL] -LPRECTL = pointer[RECTL] -LPSC_HANDLE = pointer[SC_HANDLE] -PSHORT = pointer[SHORT] -PSIZE = pointer[SIZE] -LPSIZE = pointer[SIZE] -PSIZEL = pointer[SIZEL] -LPSIZEL = pointer[SIZEL] -PSMALL_RECT = pointer[SMALL_RECT] -PUINT = pointer[UINT] -LPUINT = pointer[UINT] -PULARGE_INTEGER = pointer[ULARGE_INTEGER] -PULONG = pointer[ULONG] -PUSHORT = pointer[USHORT] -PWCHAR = pointer[WCHAR] -PWIN32_FIND_DATAA = pointer[WIN32_FIND_DATAA] -LPWIN32_FIND_DATAA = pointer[WIN32_FIND_DATAA] -PWIN32_FIND_DATAW = pointer[WIN32_FIND_DATAW] -LPWIN32_FIND_DATAW = pointer[WIN32_FIND_DATAW] -PWORD = pointer[WORD] -LPWORD = pointer[WORD] diff --git a/stdlib/@python2/curses/__init__.pyi b/stdlib/@python2/curses/__init__.pyi deleted file mode 100644 index 73e84fb..0000000 --- a/stdlib/@python2/curses/__init__.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from _curses import * # noqa: F403 -from _curses import _CursesWindow as _CursesWindow -from typing import Any, Callable, TypeVar - -_T = TypeVar("_T") - -# available after calling `curses.initscr()` -LINES: int -COLS: int - -# available after calling `curses.start_color()` -COLORS: int -COLOR_PAIRS: int - -def wrapper(__func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ... diff --git a/stdlib/@python2/curses/ascii.pyi b/stdlib/@python2/curses/ascii.pyi deleted file mode 100644 index 05efb32..0000000 --- a/stdlib/@python2/curses/ascii.pyi +++ /dev/null @@ -1,62 +0,0 @@ -from typing import List, TypeVar - -_CharT = TypeVar("_CharT", str, int) - -NUL: int -SOH: int -STX: int -ETX: int -EOT: int -ENQ: int -ACK: int -BEL: int -BS: int -TAB: int -HT: int -LF: int -NL: int -VT: int -FF: int -CR: int -SO: int -SI: int -DLE: int -DC1: int -DC2: int -DC3: int -DC4: int -NAK: int -SYN: int -ETB: int -CAN: int -EM: int -SUB: int -ESC: int -FS: int -GS: int -RS: int -US: int -SP: int -DEL: int - -controlnames: List[int] - -def isalnum(c: str | int) -> bool: ... -def isalpha(c: str | int) -> bool: ... -def isascii(c: str | int) -> bool: ... -def isblank(c: str | int) -> bool: ... -def iscntrl(c: str | int) -> bool: ... -def isdigit(c: str | int) -> bool: ... -def isgraph(c: str | int) -> bool: ... -def islower(c: str | int) -> bool: ... -def isprint(c: str | int) -> bool: ... -def ispunct(c: str | int) -> bool: ... -def isspace(c: str | int) -> bool: ... -def isupper(c: str | int) -> bool: ... -def isxdigit(c: str | int) -> bool: ... -def isctrl(c: str | int) -> bool: ... -def ismeta(c: str | int) -> bool: ... -def ascii(c: _CharT) -> _CharT: ... -def ctrl(c: _CharT) -> _CharT: ... -def alt(c: _CharT) -> _CharT: ... -def unctrl(c: str | int) -> str: ... diff --git a/stdlib/@python2/curses/panel.pyi b/stdlib/@python2/curses/panel.pyi deleted file mode 100644 index 138e4a9..0000000 --- a/stdlib/@python2/curses/panel.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from _curses import _CursesWindow - -class _Curses_Panel: # type is (note the space in the class name) - def above(self) -> _Curses_Panel: ... - def below(self) -> _Curses_Panel: ... - def bottom(self) -> None: ... - def hidden(self) -> bool: ... - def hide(self) -> None: ... - def move(self, y: int, x: int) -> None: ... - def replace(self, win: _CursesWindow) -> None: ... - def set_userptr(self, obj: object) -> None: ... - def show(self) -> None: ... - def top(self) -> None: ... - def userptr(self) -> object: ... - def window(self) -> _CursesWindow: ... - -def bottom_panel() -> _Curses_Panel: ... -def new_panel(__win: _CursesWindow) -> _Curses_Panel: ... -def top_panel() -> _Curses_Panel: ... -def update_panels() -> _Curses_Panel: ... diff --git a/stdlib/@python2/curses/textpad.pyi b/stdlib/@python2/curses/textpad.pyi deleted file mode 100644 index 578a579..0000000 --- a/stdlib/@python2/curses/textpad.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from _curses import _CursesWindow -from typing import Callable - -def rectangle(win: _CursesWindow, uly: int, ulx: int, lry: int, lrx: int) -> None: ... - -class Textbox: - stripspaces: bool - def __init__(self, win: _CursesWindow, insert_mode: bool = ...) -> None: ... - def edit(self, validate: Callable[[int], int] | None = ...) -> str: ... - def do_command(self, ch: str | int) -> None: ... - def gather(self) -> str: ... diff --git a/stdlib/@python2/datetime.pyi b/stdlib/@python2/datetime.pyi deleted file mode 100644 index 8b19a3d..0000000 --- a/stdlib/@python2/datetime.pyi +++ /dev/null @@ -1,226 +0,0 @@ -from time import struct_time -from typing import AnyStr, ClassVar, SupportsAbs, Tuple, Type, TypeVar, Union, overload - -_S = TypeVar("_S") - -_Text = Union[str, unicode] - -MINYEAR: int -MAXYEAR: int - -class tzinfo: - def tzname(self, dt: datetime | None) -> str | None: ... - def utcoffset(self, dt: datetime | None) -> timedelta | None: ... - def dst(self, dt: datetime | None) -> timedelta | None: ... - def fromutc(self, dt: datetime) -> datetime: ... - -_tzinfo = tzinfo - -class date: - min: ClassVar[date] - max: ClassVar[date] - resolution: ClassVar[timedelta] - def __new__(cls: Type[_S], year: int, month: int, day: int) -> _S: ... - @classmethod - def fromtimestamp(cls: Type[_S], __timestamp: float) -> _S: ... - @classmethod - def today(cls: Type[_S]) -> _S: ... - @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... - @property - def year(self) -> int: ... - @property - def month(self) -> int: ... - @property - def day(self) -> int: ... - def ctime(self) -> str: ... - def strftime(self, fmt: _Text) -> str: ... - def __format__(self, fmt: AnyStr) -> AnyStr: ... - def isoformat(self) -> str: ... - def timetuple(self) -> struct_time: ... - def toordinal(self) -> int: ... - def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ... - def __le__(self, other: date) -> bool: ... - def __lt__(self, other: date) -> bool: ... - def __ge__(self, other: date) -> bool: ... - def __gt__(self, other: date) -> bool: ... - def __add__(self, other: timedelta) -> date: ... - def __radd__(self, other: timedelta) -> date: ... - @overload - def __sub__(self, other: timedelta) -> date: ... - @overload - def __sub__(self, other: date) -> timedelta: ... - def __hash__(self) -> int: ... - def weekday(self) -> int: ... - def isoweekday(self) -> int: ... - def isocalendar(self) -> Tuple[int, int, int]: ... - -class time: - min: ClassVar[time] - max: ClassVar[time] - resolution: ClassVar[timedelta] - def __new__( - cls: Type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ... - ) -> _S: ... - @property - def hour(self) -> int: ... - @property - def minute(self) -> int: ... - @property - def second(self) -> int: ... - @property - def microsecond(self) -> int: ... - @property - def tzinfo(self) -> _tzinfo | None: ... - def __le__(self, other: time) -> bool: ... - def __lt__(self, other: time) -> bool: ... - def __ge__(self, other: time) -> bool: ... - def __gt__(self, other: time) -> bool: ... - def __hash__(self) -> int: ... - def isoformat(self) -> str: ... - def strftime(self, fmt: _Text) -> str: ... - def __format__(self, fmt: AnyStr) -> AnyStr: ... - def utcoffset(self) -> timedelta | None: ... - def tzname(self) -> str | None: ... - def dst(self) -> timedelta | None: ... - def replace( - self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ... - ) -> time: ... - -_date = date -_time = time - -class timedelta(SupportsAbs[timedelta]): - min: ClassVar[timedelta] - max: ClassVar[timedelta] - resolution: ClassVar[timedelta] - def __new__( - cls: Type[_S], - days: float = ..., - seconds: float = ..., - microseconds: float = ..., - milliseconds: float = ..., - minutes: float = ..., - hours: float = ..., - weeks: float = ..., - ) -> _S: ... - @property - def days(self) -> int: ... - @property - def seconds(self) -> int: ... - @property - def microseconds(self) -> int: ... - def total_seconds(self) -> float: ... - def __add__(self, other: timedelta) -> timedelta: ... - def __radd__(self, other: timedelta) -> timedelta: ... - def __sub__(self, other: timedelta) -> timedelta: ... - def __rsub__(self, other: timedelta) -> timedelta: ... - def __neg__(self) -> timedelta: ... - def __pos__(self) -> timedelta: ... - def __abs__(self) -> timedelta: ... - def __mul__(self, other: float) -> timedelta: ... - def __rmul__(self, other: float) -> timedelta: ... - @overload - def __floordiv__(self, other: timedelta) -> int: ... - @overload - def __floordiv__(self, other: int) -> timedelta: ... - @overload - def __div__(self, other: timedelta) -> float: ... - @overload - def __div__(self, other: float) -> timedelta: ... - def __le__(self, other: timedelta) -> bool: ... - def __lt__(self, other: timedelta) -> bool: ... - def __ge__(self, other: timedelta) -> bool: ... - def __gt__(self, other: timedelta) -> bool: ... - def __hash__(self) -> int: ... - -class datetime(date): - min: ClassVar[datetime] - max: ClassVar[datetime] - resolution: ClassVar[timedelta] - def __new__( - cls: Type[_S], - year: int, - month: int, - day: int, - hour: int = ..., - minute: int = ..., - second: int = ..., - microsecond: int = ..., - tzinfo: _tzinfo | None = ..., - ) -> _S: ... - @property - def year(self) -> int: ... - @property - def month(self) -> int: ... - @property - def day(self) -> int: ... - @property - def hour(self) -> int: ... - @property - def minute(self) -> int: ... - @property - def second(self) -> int: ... - @property - def microsecond(self) -> int: ... - @property - def tzinfo(self) -> _tzinfo | None: ... - @classmethod - def fromtimestamp(cls: Type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ... - @classmethod - def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ... - @classmethod - def today(cls: Type[_S]) -> _S: ... - @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... - @overload - @classmethod - def now(cls: Type[_S], tz: None = ...) -> _S: ... - @overload - @classmethod - def now(cls, tz: _tzinfo) -> datetime: ... - @classmethod - def utcnow(cls: Type[_S]) -> _S: ... - @classmethod - def combine(cls, date: _date, time: _time) -> datetime: ... - def strftime(self, fmt: _Text) -> str: ... - def __format__(self, fmt: AnyStr) -> AnyStr: ... - def toordinal(self) -> int: ... - def timetuple(self) -> struct_time: ... - def utctimetuple(self) -> struct_time: ... - def date(self) -> _date: ... - def time(self) -> _time: ... - def timetz(self) -> _time: ... - def replace( - self, - year: int = ..., - month: int = ..., - day: int = ..., - hour: int = ..., - minute: int = ..., - second: int = ..., - microsecond: int = ..., - tzinfo: _tzinfo | None = ..., - ) -> datetime: ... - def astimezone(self, tz: _tzinfo) -> datetime: ... - def ctime(self) -> str: ... - def isoformat(self, sep: str = ...) -> str: ... - @classmethod - def strptime(cls, date_string: _Text, format: _Text) -> datetime: ... - def utcoffset(self) -> timedelta | None: ... - def tzname(self) -> str | None: ... - def dst(self) -> timedelta | None: ... - def __le__(self, other: datetime) -> bool: ... # type: ignore - def __lt__(self, other: datetime) -> bool: ... # type: ignore - def __ge__(self, other: datetime) -> bool: ... # type: ignore - def __gt__(self, other: datetime) -> bool: ... # type: ignore - def __add__(self, other: timedelta) -> datetime: ... - def __radd__(self, other: timedelta) -> datetime: ... - @overload # type: ignore - def __sub__(self, other: datetime) -> timedelta: ... - @overload - def __sub__(self, other: timedelta) -> datetime: ... - def __hash__(self) -> int: ... - def weekday(self) -> int: ... - def isoweekday(self) -> int: ... - def isocalendar(self) -> Tuple[int, int, int]: ... diff --git a/stdlib/@python2/dbm/__init__.pyi b/stdlib/@python2/dbm/__init__.pyi deleted file mode 100644 index 95f6d9c..0000000 --- a/stdlib/@python2/dbm/__init__.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from types import TracebackType -from typing import Iterator, MutableMapping, Tuple, Type, Union -from typing_extensions import Literal - -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] - -class _Database(MutableMapping[_KeyType, bytes]): - def close(self) -> None: ... - def __getitem__(self, key: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __iter__(self) -> Iterator[bytes]: ... - def __len__(self) -> int: ... - def __del__(self) -> None: ... - def __enter__(self) -> _Database: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - -class _error(Exception): ... - -error = Tuple[Type[_error], Type[OSError]] - -def whichdb(filename: str) -> str: ... -def open(file: str, flag: Literal["r", "w", "c", "n"] = ..., mode: int = ...) -> _Database: ... diff --git a/stdlib/@python2/dbm/dumb.pyi b/stdlib/@python2/dbm/dumb.pyi deleted file mode 100644 index fb5e2da..0000000 --- a/stdlib/@python2/dbm/dumb.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from types import TracebackType -from typing import Iterator, MutableMapping, Type, Union - -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] - -error = OSError - -class _Database(MutableMapping[_KeyType, bytes]): - def __init__(self, filebasename: str, mode: str, flag: str = ...) -> None: ... - def sync(self) -> None: ... - def iterkeys(self) -> Iterator[bytes]: ... # undocumented - def close(self) -> None: ... - def __getitem__(self, key: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __iter__(self) -> Iterator[bytes]: ... - def __len__(self) -> int: ... - def __del__(self) -> None: ... - def __enter__(self) -> _Database: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - -def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ... diff --git a/stdlib/@python2/dbm/gnu.pyi b/stdlib/@python2/dbm/gnu.pyi deleted file mode 100644 index 0e9339b..0000000 --- a/stdlib/@python2/dbm/gnu.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from types import TracebackType -from typing import List, Type, TypeVar, Union, overload - -_T = TypeVar("_T") -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] - -class error(OSError): ... - -# Actual typename gdbm, not exposed by the implementation -class _gdbm: - def firstkey(self) -> bytes | None: ... - def nextkey(self, key: _KeyType) -> bytes | None: ... - def reorganize(self) -> None: ... - def sync(self) -> None: ... - def close(self) -> None: ... - def __getitem__(self, item: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __len__(self) -> int: ... - def __enter__(self) -> _gdbm: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - @overload - def get(self, k: _KeyType) -> bytes | None: ... - @overload - def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> List[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - -def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _gdbm: ... diff --git a/stdlib/@python2/dbm/ndbm.pyi b/stdlib/@python2/dbm/ndbm.pyi deleted file mode 100644 index 28f4dd8..0000000 --- a/stdlib/@python2/dbm/ndbm.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from types import TracebackType -from typing import List, Type, TypeVar, Union, overload - -_T = TypeVar("_T") -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] - -class error(OSError): ... - -library: str = ... - -# Actual typename dbm, not exposed by the implementation -class _dbm: - def close(self) -> None: ... - def __getitem__(self, item: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __len__(self) -> int: ... - def __del__(self) -> None: ... - def __enter__(self) -> _dbm: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - @overload - def get(self, k: _KeyType) -> bytes | None: ... - @overload - def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> List[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - -def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ... diff --git a/stdlib/@python2/decimal.pyi b/stdlib/@python2/decimal.pyi deleted file mode 100644 index 915bdda..0000000 --- a/stdlib/@python2/decimal.pyi +++ /dev/null @@ -1,246 +0,0 @@ -from types import TracebackType -from typing import Any, Container, Dict, List, NamedTuple, Sequence, Text, Tuple, Type, TypeVar, Union - -_Decimal = Union[Decimal, int] -_DecimalNew = Union[Decimal, float, Text, Tuple[int, Sequence[int], int]] -_ComparableNum = Union[Decimal, float] -_DecimalT = TypeVar("_DecimalT", bound=Decimal) - -class DecimalTuple(NamedTuple): - sign: int - digits: Tuple[int, ...] - exponent: int - -ROUND_DOWN: str -ROUND_HALF_UP: str -ROUND_HALF_EVEN: str -ROUND_CEILING: str -ROUND_FLOOR: str -ROUND_UP: str -ROUND_HALF_DOWN: str -ROUND_05UP: str - -class DecimalException(ArithmeticError): - def handle(self, context: Context, *args: Any) -> Decimal | None: ... - -class Clamped(DecimalException): ... -class InvalidOperation(DecimalException): ... -class ConversionSyntax(InvalidOperation): ... -class DivisionByZero(DecimalException, ZeroDivisionError): ... -class DivisionImpossible(InvalidOperation): ... -class DivisionUndefined(InvalidOperation, ZeroDivisionError): ... -class Inexact(DecimalException): ... -class InvalidContext(InvalidOperation): ... -class Rounded(DecimalException): ... -class Subnormal(DecimalException): ... -class Overflow(Inexact, Rounded): ... -class Underflow(Inexact, Rounded, Subnormal): ... - -def setcontext(__context: Context) -> None: ... -def getcontext() -> Context: ... -def localcontext(ctx: Context | None = ...) -> _ContextManager: ... - -class Decimal(object): - def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ... - @classmethod - def from_float(cls, __f: float) -> Decimal: ... - def __nonzero__(self) -> bool: ... - def __div__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rdiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __ne__(self, other: object, context: Context | None = ...) -> bool: ... - def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __hash__(self) -> int: ... - def as_tuple(self) -> DecimalTuple: ... - def to_eng_string(self, context: Context | None = ...) -> str: ... - def __abs__(self, round: bool = ..., context: Context | None = ...) -> Decimal: ... - def __add__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __divmod__(self, other: _Decimal, context: Context | None = ...) -> Tuple[Decimal, Decimal]: ... - def __eq__(self, other: object, context: Context | None = ...) -> bool: ... - def __floordiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __ge__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ... - def __gt__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ... - def __le__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ... - def __lt__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ... - def __mod__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __mul__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __neg__(self, context: Context | None = ...) -> Decimal: ... - def __pos__(self, context: Context | None = ...) -> Decimal: ... - def __pow__(self, other: _Decimal, modulo: _Decimal | None = ..., context: Context | None = ...) -> Decimal: ... - def __radd__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rdivmod__(self, other: _Decimal, context: Context | None = ...) -> Tuple[Decimal, Decimal]: ... - def __rfloordiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rmod__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rmul__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rsub__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rtruediv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __str__(self, eng: bool = ..., context: Context | None = ...) -> str: ... - def __sub__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __truediv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __float__(self) -> float: ... - def __int__(self) -> int: ... - def __trunc__(self) -> int: ... - @property - def real(self) -> Decimal: ... - @property - def imag(self) -> Decimal: ... - def conjugate(self) -> Decimal: ... - def __complex__(self) -> complex: ... - def __long__(self) -> long: ... - def fma(self, other: _Decimal, third: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rpow__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def normalize(self, context: Context | None = ...) -> Decimal: ... - def quantize( - self, exp: _Decimal, rounding: str | None = ..., context: Context | None = ..., watchexp: bool = ... - ) -> Decimal: ... - def same_quantum(self, other: _Decimal) -> bool: ... - def to_integral_exact(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def to_integral_value(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def to_integral(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def sqrt(self, context: Context | None = ...) -> Decimal: ... - def max(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def min(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def adjusted(self) -> int: ... - def canonical(self, context: Context | None = ...) -> Decimal: ... - def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def compare_total(self, other: _Decimal) -> Decimal: ... - def compare_total_mag(self, other: _Decimal) -> Decimal: ... - def copy_abs(self) -> Decimal: ... - def copy_negate(self) -> Decimal: ... - def copy_sign(self, other: _Decimal) -> Decimal: ... - def exp(self, context: Context | None = ...) -> Decimal: ... - def is_canonical(self) -> bool: ... - def is_finite(self) -> bool: ... - def is_infinite(self) -> bool: ... - def is_nan(self) -> bool: ... - def is_normal(self, context: Context | None = ...) -> bool: ... - def is_qnan(self) -> bool: ... - def is_signed(self) -> bool: ... - def is_snan(self) -> bool: ... - def is_subnormal(self, context: Context | None = ...) -> bool: ... - def is_zero(self) -> bool: ... - def ln(self, context: Context | None = ...) -> Decimal: ... - def log10(self, context: Context | None = ...) -> Decimal: ... - def logb(self, context: Context | None = ...) -> Decimal: ... - def logical_and(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def logical_invert(self, context: Context | None = ...) -> Decimal: ... - def logical_or(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def logical_xor(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def max_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def min_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def next_minus(self, context: Context | None = ...) -> Decimal: ... - def next_plus(self, context: Context | None = ...) -> Decimal: ... - def next_toward(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def number_class(self, context: Context | None = ...) -> str: ... - def radix(self) -> Decimal: ... - def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __reduce__(self) -> Tuple[Type[Decimal], Tuple[str]]: ... - def __copy__(self) -> Decimal: ... - def __deepcopy__(self, memo: Any) -> Decimal: ... - def __format__(self, specifier: str, context: Context | None = ...) -> str: ... - -class _ContextManager(object): - new_context: Context - saved_context: Context - def __init__(self, new_context: Context) -> None: ... - def __enter__(self) -> Context: ... - def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... - -_TrapType = Type[DecimalException] - -class Context(object): - prec: int - rounding: str - Emin: int - Emax: int - capitals: int - _clamp: int - traps: Dict[_TrapType, bool] - flags: Dict[_TrapType, bool] - def __init__( - self, - prec: int | None = ..., - rounding: str | None = ..., - traps: None | Dict[_TrapType, bool] | Container[_TrapType] = ..., - flags: None | Dict[_TrapType, bool] | Container[_TrapType] = ..., - Emin: int | None = ..., - Emax: int | None = ..., - capitals: int | None = ..., - _clamp: int | None = ..., - _ignored_flags: List[_TrapType] | None = ..., - ) -> None: ... - def clear_flags(self) -> None: ... - def copy(self) -> Context: ... - def __copy__(self) -> Context: ... - __hash__: Any = ... - def Etiny(self) -> int: ... - def Etop(self) -> int: ... - def create_decimal(self, __num: _DecimalNew = ...) -> Decimal: ... - def create_decimal_from_float(self, __f: float) -> Decimal: ... - def abs(self, __x: _Decimal) -> Decimal: ... - def add(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def canonical(self, __x: Decimal) -> Decimal: ... - def compare(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def compare_signal(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def compare_total(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def compare_total_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def copy_abs(self, __x: _Decimal) -> Decimal: ... - def copy_decimal(self, __x: _Decimal) -> Decimal: ... - def copy_negate(self, __x: _Decimal) -> Decimal: ... - def copy_sign(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divide(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divide_int(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divmod(self, __x: _Decimal, __y: _Decimal) -> Tuple[Decimal, Decimal]: ... - def exp(self, __x: _Decimal) -> Decimal: ... - def fma(self, __x: _Decimal, __y: _Decimal, __z: _Decimal) -> Decimal: ... - def is_canonical(self, __x: _Decimal) -> bool: ... - def is_finite(self, __x: _Decimal) -> bool: ... - def is_infinite(self, __x: _Decimal) -> bool: ... - def is_nan(self, __x: _Decimal) -> bool: ... - def is_normal(self, __x: _Decimal) -> bool: ... - def is_qnan(self, __x: _Decimal) -> bool: ... - def is_signed(self, __x: _Decimal) -> bool: ... - def is_snan(self, __x: _Decimal) -> bool: ... - def is_subnormal(self, __x: _Decimal) -> bool: ... - def is_zero(self, __x: _Decimal) -> bool: ... - def ln(self, __x: _Decimal) -> Decimal: ... - def log10(self, __x: _Decimal) -> Decimal: ... - def logb(self, __x: _Decimal) -> Decimal: ... - def logical_and(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def logical_invert(self, __x: _Decimal) -> Decimal: ... - def logical_or(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def logical_xor(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def max(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def max_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def min(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def min_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def minus(self, __x: _Decimal) -> Decimal: ... - def multiply(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def next_minus(self, __x: _Decimal) -> Decimal: ... - def next_plus(self, __x: _Decimal) -> Decimal: ... - def next_toward(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def normalize(self, __x: _Decimal) -> Decimal: ... - def number_class(self, __x: _Decimal) -> str: ... - def plus(self, __x: _Decimal) -> Decimal: ... - def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ... - def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def radix(self) -> Decimal: ... - def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def remainder_near(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def rotate(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def same_quantum(self, __x: _Decimal, __y: _Decimal) -> bool: ... - def scaleb(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def shift(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def sqrt(self, __x: _Decimal) -> Decimal: ... - def subtract(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def to_eng_string(self, __x: _Decimal) -> str: ... - def to_sci_string(self, __x: _Decimal) -> str: ... - def to_integral_exact(self, __x: _Decimal) -> Decimal: ... - def to_integral_value(self, __x: _Decimal) -> Decimal: ... - def to_integral(self, __x: _Decimal) -> Decimal: ... - -DefaultContext: Context -BasicContext: Context -ExtendedContext: Context diff --git a/stdlib/@python2/difflib.pyi b/stdlib/@python2/difflib.pyi deleted file mode 100644 index 41ffc6a..0000000 --- a/stdlib/@python2/difflib.pyi +++ /dev/null @@ -1,112 +0,0 @@ -from typing import ( - Any, - AnyStr, - Callable, - Generic, - Iterable, - Iterator, - List, - NamedTuple, - Sequence, - Text, - Tuple, - TypeVar, - Union, - overload, -) - -_T = TypeVar("_T") - -# Aliases can't point to type vars, so we need to redeclare AnyStr -_StrType = TypeVar("_StrType", Text, bytes) - -_JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]] - -class Match(NamedTuple): - a: int - b: int - size: int - -class SequenceMatcher(Generic[_T]): - def __init__( - self, isjunk: Callable[[_T], bool] | None = ..., a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = ... - ) -> None: ... - def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... - def set_seq1(self, a: Sequence[_T]) -> None: ... - def set_seq2(self, b: Sequence[_T]) -> None: ... - def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ... - def get_matching_blocks(self) -> List[Match]: ... - def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ... - def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ... - def ratio(self) -> float: ... - def quick_ratio(self) -> float: ... - def real_quick_ratio(self) -> float: ... - -# mypy thinks the signatures of the overloads overlap, but the types still work fine -@overload -def get_close_matches( # type: ignore - word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ... -) -> List[AnyStr]: ... -@overload -def get_close_matches( - word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ... -) -> List[Sequence[_T]]: ... - -class Differ: - def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ... - def compare(self, a: Sequence[_StrType], b: Sequence[_StrType]) -> Iterator[_StrType]: ... - -def IS_LINE_JUNK(line: _StrType, pat: Any = ...) -> bool: ... # pat is undocumented -def IS_CHARACTER_JUNK(ch: _StrType, ws: _StrType = ...) -> bool: ... # ws is undocumented -def unified_diff( - a: Sequence[_StrType], - b: Sequence[_StrType], - fromfile: _StrType = ..., - tofile: _StrType = ..., - fromfiledate: _StrType = ..., - tofiledate: _StrType = ..., - n: int = ..., - lineterm: _StrType = ..., -) -> Iterator[_StrType]: ... -def context_diff( - a: Sequence[_StrType], - b: Sequence[_StrType], - fromfile: _StrType = ..., - tofile: _StrType = ..., - fromfiledate: _StrType = ..., - tofiledate: _StrType = ..., - n: int = ..., - lineterm: _StrType = ..., -) -> Iterator[_StrType]: ... -def ndiff( - a: Sequence[_StrType], b: Sequence[_StrType], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ... -) -> Iterator[_StrType]: ... - -class HtmlDiff(object): - def __init__( - self, - tabsize: int = ..., - wrapcolumn: int | None = ..., - linejunk: _JunkCallback | None = ..., - charjunk: _JunkCallback | None = ..., - ) -> None: ... - def make_file( - self, - fromlines: Sequence[_StrType], - tolines: Sequence[_StrType], - fromdesc: _StrType = ..., - todesc: _StrType = ..., - context: bool = ..., - numlines: int = ..., - ) -> _StrType: ... - def make_table( - self, - fromlines: Sequence[_StrType], - tolines: Sequence[_StrType], - fromdesc: _StrType = ..., - todesc: _StrType = ..., - context: bool = ..., - numlines: int = ..., - ) -> _StrType: ... - -def restore(delta: Iterable[_StrType], which: int) -> Iterator[_StrType]: ... diff --git a/stdlib/@python2/dircache.pyi b/stdlib/@python2/dircache.pyi deleted file mode 100644 index 366909d..0000000 --- a/stdlib/@python2/dircache.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import List, MutableSequence, Text - -def reset() -> None: ... -def listdir(path: Text) -> List[str]: ... - -opendir = listdir - -def annotate(head: Text, list: MutableSequence[str] | MutableSequence[Text] | MutableSequence[str | Text]) -> None: ... diff --git a/stdlib/@python2/dis.pyi b/stdlib/@python2/dis.pyi deleted file mode 100644 index 1d65376..0000000 --- a/stdlib/@python2/dis.pyi +++ /dev/null @@ -1,30 +0,0 @@ -import types -from opcode import ( - EXTENDED_ARG as EXTENDED_ARG, - HAVE_ARGUMENT as HAVE_ARGUMENT, - cmp_op as cmp_op, - hascompare as hascompare, - hasconst as hasconst, - hasfree as hasfree, - hasjabs as hasjabs, - hasjrel as hasjrel, - haslocal as haslocal, - hasname as hasname, - opmap as opmap, - opname as opname, -) -from typing import Any, Callable, Dict, Iterator, List, Tuple, Union - -# Strictly this should not have to include Callable, but mypy doesn't use FunctionType -# for functions (python/mypy#3171) -_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]] -_have_code_or_string = Union[_have_code, str, bytes] - -COMPILER_FLAG_NAMES: Dict[int, str] - -def findlabels(code: _have_code) -> List[int]: ... -def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ... -def dis(x: _have_code_or_string = ...) -> None: ... -def distb(tb: types.TracebackType = ...) -> None: ... -def disassemble(co: _have_code, lasti: int = ...) -> None: ... -def disco(co: _have_code, lasti: int = ...) -> None: ... diff --git a/stdlib/@python2/distutils/archive_util.pyi b/stdlib/@python2/distutils/archive_util.pyi deleted file mode 100644 index dd2cbda..0000000 --- a/stdlib/@python2/distutils/archive_util.pyi +++ /dev/null @@ -1,5 +0,0 @@ -def make_archive( - base_name: str, format: str, root_dir: str | None = ..., base_dir: str | None = ..., verbose: int = ..., dry_run: int = ... -) -> str: ... -def make_tarball(base_name: str, base_dir: str, compress: str | None = ..., verbose: int = ..., dry_run: int = ...) -> str: ... -def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ... diff --git a/stdlib/@python2/distutils/ccompiler.pyi b/stdlib/@python2/distutils/ccompiler.pyi deleted file mode 100644 index b0539bf..0000000 --- a/stdlib/@python2/distutils/ccompiler.pyi +++ /dev/null @@ -1,150 +0,0 @@ -from typing import Any, Callable, List, Optional, Tuple, Union - -_Macro = Union[Tuple[str], Tuple[str, Optional[str]]] - -def gen_lib_options( - compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str] -) -> List[str]: ... -def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ... -def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ... -def new_compiler( - plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ... -) -> CCompiler: ... -def show_compilers() -> None: ... - -class CCompiler: - dry_run: bool - force: bool - verbose: bool - output_dir: str | None - macros: List[_Macro] - include_dirs: List[str] - libraries: List[str] - library_dirs: List[str] - runtime_library_dirs: List[str] - objects: List[str] - def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ... - def add_include_dir(self, dir: str) -> None: ... - def set_include_dirs(self, dirs: List[str]) -> None: ... - def add_library(self, libname: str) -> None: ... - def set_libraries(self, libnames: List[str]) -> None: ... - def add_library_dir(self, dir: str) -> None: ... - def set_library_dirs(self, dirs: List[str]) -> None: ... - def add_runtime_library_dir(self, dir: str) -> None: ... - def set_runtime_library_dirs(self, dirs: List[str]) -> None: ... - def define_macro(self, name: str, value: str | None = ...) -> None: ... - def undefine_macro(self, name: str) -> None: ... - def add_link_object(self, object: str) -> None: ... - def set_link_objects(self, objects: List[str]) -> None: ... - def detect_language(self, sources: str | List[str]) -> str | None: ... - def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> str | None: ... - def has_function( - self, - funcname: str, - includes: List[str] | None = ..., - include_dirs: List[str] | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - ) -> bool: ... - def library_dir_option(self, dir: str) -> str: ... - def library_option(self, lib: str) -> str: ... - def runtime_library_dir_option(self, dir: str) -> str: ... - def set_executables(self, **args: str) -> None: ... - def compile( - self, - sources: List[str], - output_dir: str | None = ..., - macros: _Macro | None = ..., - include_dirs: List[str] | None = ..., - debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - depends: List[str] | None = ..., - ) -> List[str]: ... - def create_static_lib( - self, - objects: List[str], - output_libname: str, - output_dir: str | None = ..., - debug: bool = ..., - target_lang: str | None = ..., - ) -> None: ... - def link( - self, - target_desc: str, - objects: List[str], - output_filename: str, - output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., - debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - build_temp: str | None = ..., - target_lang: str | None = ..., - ) -> None: ... - def link_executable( - self, - objects: List[str], - output_progname: str, - output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - target_lang: str | None = ..., - ) -> None: ... - def link_shared_lib( - self, - objects: List[str], - output_libname: str, - output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., - debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - build_temp: str | None = ..., - target_lang: str | None = ..., - ) -> None: ... - def link_shared_object( - self, - objects: List[str], - output_filename: str, - output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., - debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - build_temp: str | None = ..., - target_lang: str | None = ..., - ) -> None: ... - def preprocess( - self, - source: str, - output_file: str | None = ..., - macros: List[_Macro] | None = ..., - include_dirs: List[str] | None = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - ) -> None: ... - def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... - def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... - def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ... - def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... - def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... - def spawn(self, cmd: List[str]) -> None: ... - def mkpath(self, name: str, mode: int = ...) -> None: ... - def move_file(self, src: str, dst: str) -> str: ... - def announce(self, msg: str, level: int = ...) -> None: ... - def warn(self, msg: str) -> None: ... - def debug_print(self, msg: str) -> None: ... diff --git a/stdlib/@python2/distutils/cmd.pyi b/stdlib/@python2/distutils/cmd.pyi deleted file mode 100644 index d4e90bf..0000000 --- a/stdlib/@python2/distutils/cmd.pyi +++ /dev/null @@ -1,67 +0,0 @@ -from abc import abstractmethod -from distutils.dist import Distribution -from typing import Any, Callable, Iterable, List, Text, Tuple - -class Command: - sub_commands: List[Tuple[str, Callable[[Command], bool] | None]] - def __init__(self, dist: Distribution) -> None: ... - @abstractmethod - def initialize_options(self) -> None: ... - @abstractmethod - def finalize_options(self) -> None: ... - @abstractmethod - def run(self) -> None: ... - def announce(self, msg: Text, level: int = ...) -> None: ... - def debug_print(self, msg: Text) -> None: ... - def ensure_string(self, option: str, default: str | None = ...) -> None: ... - def ensure_string_list(self, option: str | List[str]) -> None: ... - def ensure_filename(self, option: str) -> None: ... - def ensure_dirname(self, option: str) -> None: ... - def get_command_name(self) -> str: ... - def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ... - def get_finalized_command(self, command: Text, create: int = ...) -> Command: ... - def reinitialize_command(self, command: Command | Text, reinit_subcommands: int = ...) -> Command: ... - def run_command(self, command: Text) -> None: ... - def get_sub_commands(self) -> List[str]: ... - def warn(self, msg: Text) -> None: ... - def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Text | None = ..., level: int = ...) -> None: ... - def mkpath(self, name: str, mode: int = ...) -> None: ... - def copy_file( - self, - infile: str, - outfile: str, - preserve_mode: int = ..., - preserve_times: int = ..., - link: str | None = ..., - level: Any = ..., - ) -> Tuple[str, bool]: ... # level is not used - def copy_tree( - self, - infile: str, - outfile: str, - preserve_mode: int = ..., - preserve_times: int = ..., - preserve_symlinks: int = ..., - level: Any = ..., - ) -> List[str]: ... # level is not used - def move_file(self, src: str, dst: str, level: Any = ...) -> str: ... # level is not used - def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used - def make_archive( - self, - base_name: str, - format: str, - root_dir: str | None = ..., - base_dir: str | None = ..., - owner: str | None = ..., - group: str | None = ..., - ) -> str: ... - def make_file( - self, - infiles: str | List[str] | Tuple[str], - outfile: str, - func: Callable[..., Any], - args: List[Any], - exec_msg: str | None = ..., - skip_msg: str | None = ..., - level: Any = ..., - ) -> None: ... # level is not used diff --git a/stdlib/@python2/distutils/command/bdist_msi.pyi b/stdlib/@python2/distutils/command/bdist_msi.pyi deleted file mode 100644 index a761792..0000000 --- a/stdlib/@python2/distutils/command/bdist_msi.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from distutils.cmd import Command - -class bdist_msi(Command): - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - def run(self) -> None: ... diff --git a/stdlib/@python2/distutils/command/build_py.pyi b/stdlib/@python2/distutils/command/build_py.pyi deleted file mode 100644 index a29a1f3..0000000 --- a/stdlib/@python2/distutils/command/build_py.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from distutils.cmd import Command - -class build_py(Command): - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - def run(self) -> None: ... diff --git a/stdlib/@python2/distutils/command/config.pyi b/stdlib/@python2/distutils/command/config.pyi deleted file mode 100644 index d0fd762..0000000 --- a/stdlib/@python2/distutils/command/config.pyi +++ /dev/null @@ -1,83 +0,0 @@ -from distutils import log as log -from distutils.ccompiler import CCompiler -from distutils.core import Command as Command -from distutils.errors import DistutilsExecError as DistutilsExecError -from distutils.sysconfig import customize_compiler as customize_compiler -from typing import Dict, List, Pattern, Sequence, Tuple - -LANG_EXT: Dict[str, str] - -class config(Command): - description: str = ... - # Tuple is full name, short name, description - user_options: Sequence[Tuple[str, str | None, str]] = ... - compiler: str | CCompiler | None = ... - cc: str | None = ... - include_dirs: Sequence[str] | None = ... - libraries: Sequence[str] | None = ... - library_dirs: Sequence[str] | None = ... - noisy: int = ... - dump_source: int = ... - temp_files: Sequence[str] = ... - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - def run(self) -> None: ... - def try_cpp( - self, - body: str | None = ..., - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - lang: str = ..., - ) -> bool: ... - def search_cpp( - self, - pattern: Pattern[str] | str, - body: str | None = ..., - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - lang: str = ..., - ) -> bool: ... - def try_compile( - self, body: str, headers: Sequence[str] | None = ..., include_dirs: Sequence[str] | None = ..., lang: str = ... - ) -> bool: ... - def try_link( - self, - body: str, - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - libraries: Sequence[str] | None = ..., - library_dirs: Sequence[str] | None = ..., - lang: str = ..., - ) -> bool: ... - def try_run( - self, - body: str, - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - libraries: Sequence[str] | None = ..., - library_dirs: Sequence[str] | None = ..., - lang: str = ..., - ) -> bool: ... - def check_func( - self, - func: str, - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - libraries: Sequence[str] | None = ..., - library_dirs: Sequence[str] | None = ..., - decl: int = ..., - call: int = ..., - ) -> bool: ... - def check_lib( - self, - library: str, - library_dirs: Sequence[str] | None = ..., - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - other_libraries: List[str] = ..., - ) -> bool: ... - def check_header( - self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ... - ) -> bool: ... - -def dump_file(filename: str, head: str | None = ...) -> None: ... diff --git a/stdlib/@python2/distutils/command/install.pyi b/stdlib/@python2/distutils/command/install.pyi deleted file mode 100644 index 2824236..0000000 --- a/stdlib/@python2/distutils/command/install.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from distutils.cmd import Command -from typing import Text - -class install(Command): - user: bool - prefix: Text | None - home: Text | None - root: Text | None - install_lib: Text | None - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - def run(self) -> None: ... diff --git a/stdlib/@python2/distutils/command/install_egg_info.pyi b/stdlib/@python2/distutils/command/install_egg_info.pyi deleted file mode 100644 index bf3d073..0000000 --- a/stdlib/@python2/distutils/command/install_egg_info.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from distutils.cmd import Command -from typing import ClassVar, List, Tuple - -class install_egg_info(Command): - description: ClassVar[str] - user_options: ClassVar[List[Tuple[str, str | None, str]]] - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - def run(self) -> None: ... - def get_outputs(self) -> List[str]: ... diff --git a/stdlib/@python2/distutils/command/upload.pyi b/stdlib/@python2/distutils/command/upload.pyi deleted file mode 100644 index 3835d9f..0000000 --- a/stdlib/@python2/distutils/command/upload.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from distutils.config import PyPIRCCommand -from typing import ClassVar, List, Tuple - -class upload(PyPIRCCommand): - description: ClassVar[str] - boolean_options: ClassVar[List[str]] - def run(self) -> None: ... - def upload_file(self, command, pyversion, filename) -> None: ... diff --git a/stdlib/@python2/distutils/config.pyi b/stdlib/@python2/distutils/config.pyi deleted file mode 100644 index bcd626c..0000000 --- a/stdlib/@python2/distutils/config.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from abc import abstractmethod -from distutils.cmd import Command -from typing import ClassVar, List, Tuple - -DEFAULT_PYPIRC: str - -class PyPIRCCommand(Command): - DEFAULT_REPOSITORY: ClassVar[str] - DEFAULT_REALM: ClassVar[str] - repository: None - realm: None - user_options: ClassVar[List[Tuple[str, str | None, str]]] - boolean_options: ClassVar[List[str]] - def initialize_options(self) -> None: ... - def finalize_options(self) -> None: ... - @abstractmethod - def run(self) -> None: ... diff --git a/stdlib/@python2/distutils/core.pyi b/stdlib/@python2/distutils/core.pyi deleted file mode 100644 index 48bd7b5..0000000 --- a/stdlib/@python2/distutils/core.pyi +++ /dev/null @@ -1,48 +0,0 @@ -from distutils.cmd import Command as Command -from distutils.dist import Distribution as Distribution -from distutils.extension import Extension as Extension -from typing import Any, List, Mapping, Tuple, Type - -def setup( - *, - name: str = ..., - version: str = ..., - description: str = ..., - long_description: str = ..., - author: str = ..., - author_email: str = ..., - maintainer: str = ..., - maintainer_email: str = ..., - url: str = ..., - download_url: str = ..., - packages: List[str] = ..., - py_modules: List[str] = ..., - scripts: List[str] = ..., - ext_modules: List[Extension] = ..., - classifiers: List[str] = ..., - distclass: Type[Distribution] = ..., - script_name: str = ..., - script_args: List[str] = ..., - options: Mapping[str, Any] = ..., - license: str = ..., - keywords: List[str] | str = ..., - platforms: List[str] | str = ..., - cmdclass: Mapping[str, Type[Command]] = ..., - data_files: List[Tuple[str, List[str]]] = ..., - package_dir: Mapping[str, str] = ..., - obsoletes: List[str] = ..., - provides: List[str] = ..., - requires: List[str] = ..., - command_packages: List[str] = ..., - command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ..., - package_data: Mapping[str, List[str]] = ..., - include_package_data: bool = ..., - libraries: List[str] = ..., - headers: List[str] = ..., - ext_package: str = ..., - include_dirs: List[str] = ..., - password: str = ..., - fullname: str = ..., - **attrs: Any, -) -> None: ... -def run_setup(script_name: str, script_args: List[str] | None = ..., stop_after: str = ...) -> Distribution: ... diff --git a/stdlib/@python2/distutils/debug.pyi b/stdlib/@python2/distutils/debug.pyi deleted file mode 100644 index 098dc3d..0000000 --- a/stdlib/@python2/distutils/debug.pyi +++ /dev/null @@ -1 +0,0 @@ -DEBUG: bool diff --git a/stdlib/@python2/distutils/dep_util.pyi b/stdlib/@python2/distutils/dep_util.pyi deleted file mode 100644 index 6f779d5..0000000 --- a/stdlib/@python2/distutils/dep_util.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import List, Tuple - -def newer(source: str, target: str) -> bool: ... -def newer_pairwise(sources: List[str], targets: List[str]) -> List[Tuple[str, str]]: ... -def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ... diff --git a/stdlib/@python2/distutils/dir_util.pyi b/stdlib/@python2/distutils/dir_util.pyi deleted file mode 100644 index 4c4a221..0000000 --- a/stdlib/@python2/distutils/dir_util.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import List - -def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ... -def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... -def copy_tree( - src: str, - dst: str, - preserve_mode: int = ..., - preserve_times: int = ..., - preserve_symlinks: int = ..., - update: int = ..., - verbose: int = ..., - dry_run: int = ..., -) -> List[str]: ... -def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ... diff --git a/stdlib/@python2/distutils/dist.pyi b/stdlib/@python2/distutils/dist.pyi deleted file mode 100644 index adba8f0..0000000 --- a/stdlib/@python2/distutils/dist.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from distutils.cmd import Command -from typing import Any, Dict, Iterable, Mapping, Text, Tuple, Type - -class Distribution: - cmdclass: Dict[str, Type[Command]] - def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ... - def get_option_dict(self, command: str) -> Dict[str, Tuple[str, Text]]: ... - def parse_config_files(self, filenames: Iterable[Text] | None = ...) -> None: ... - def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ... diff --git a/stdlib/@python2/distutils/emxccompiler.pyi b/stdlib/@python2/distutils/emxccompiler.pyi deleted file mode 100644 index 19e4023..0000000 --- a/stdlib/@python2/distutils/emxccompiler.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from distutils.unixccompiler import UnixCCompiler - -class EMXCCompiler(UnixCCompiler): ... diff --git a/stdlib/@python2/distutils/extension.pyi b/stdlib/@python2/distutils/extension.pyi deleted file mode 100644 index 9335fad..0000000 --- a/stdlib/@python2/distutils/extension.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import List, Tuple - -class Extension: - def __init__( - self, - name: str, - sources: List[str], - include_dirs: List[str] = ..., - define_macros: List[Tuple[str, str | None]] = ..., - undef_macros: List[str] = ..., - library_dirs: List[str] = ..., - libraries: List[str] = ..., - runtime_library_dirs: List[str] = ..., - extra_objects: List[str] = ..., - extra_compile_args: List[str] = ..., - extra_link_args: List[str] = ..., - export_symbols: List[str] = ..., - swig_opts: str | None = ..., # undocumented - depends: List[str] = ..., - language: str = ..., - ) -> None: ... diff --git a/stdlib/@python2/distutils/fancy_getopt.pyi b/stdlib/@python2/distutils/fancy_getopt.pyi deleted file mode 100644 index d0e3309..0000000 --- a/stdlib/@python2/distutils/fancy_getopt.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Any, List, Mapping, Optional, Tuple, overload - -_Option = Tuple[str, Optional[str], str] -_GR = Tuple[List[str], OptionDummy] - -def fancy_getopt( - options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: List[str] | None -) -> List[str] | _GR: ... -def wrap_text(text: str, width: int) -> List[str]: ... - -class FancyGetopt: - def __init__(self, option_table: List[_Option] | None = ...) -> None: ... - # TODO kinda wrong, `getopt(object=object())` is invalid - @overload - def getopt(self, args: List[str] | None = ...) -> _GR: ... - @overload - def getopt(self, args: List[str] | None, object: Any) -> List[str]: ... - def get_option_order(self) -> List[Tuple[str, str]]: ... - def generate_help(self, header: str | None = ...) -> List[str]: ... - -class OptionDummy: ... diff --git a/stdlib/@python2/distutils/filelist.pyi b/stdlib/@python2/distutils/filelist.pyi deleted file mode 100644 index 8fa55d0..0000000 --- a/stdlib/@python2/distutils/filelist.pyi +++ /dev/null @@ -1 +0,0 @@ -class FileList: ... diff --git a/stdlib/@python2/distutils/log.pyi b/stdlib/@python2/distutils/log.pyi deleted file mode 100644 index 668adaa..0000000 --- a/stdlib/@python2/distutils/log.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from typing import Any, Text - -DEBUG: int -INFO: int -WARN: int -ERROR: int -FATAL: int - -class Log: - def __init__(self, threshold: int = ...) -> None: ... - def log(self, level: int, msg: Text, *args: Any) -> None: ... - def debug(self, msg: Text, *args: Any) -> None: ... - def info(self, msg: Text, *args: Any) -> None: ... - def warn(self, msg: Text, *args: Any) -> None: ... - def error(self, msg: Text, *args: Any) -> None: ... - def fatal(self, msg: Text, *args: Any) -> None: ... - -def log(level: int, msg: Text, *args: Any) -> None: ... -def debug(msg: Text, *args: Any) -> None: ... -def info(msg: Text, *args: Any) -> None: ... -def warn(msg: Text, *args: Any) -> None: ... -def error(msg: Text, *args: Any) -> None: ... -def fatal(msg: Text, *args: Any) -> None: ... -def set_threshold(level: int) -> int: ... -def set_verbosity(v: int) -> None: ... diff --git a/stdlib/@python2/distutils/spawn.pyi b/stdlib/@python2/distutils/spawn.pyi deleted file mode 100644 index 0fffc54..0000000 --- a/stdlib/@python2/distutils/spawn.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import List - -def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... -def find_executable(executable: str, path: str | None = ...) -> str | None: ... diff --git a/stdlib/@python2/distutils/sysconfig.pyi b/stdlib/@python2/distutils/sysconfig.pyi deleted file mode 100644 index 7d9fe7d..0000000 --- a/stdlib/@python2/distutils/sysconfig.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from distutils.ccompiler import CCompiler -from typing import Mapping - -PREFIX: str -EXEC_PREFIX: str - -def get_config_var(name: str) -> int | str | None: ... -def get_config_vars(*args: str) -> Mapping[str, int | str]: ... -def get_config_h_filename() -> str: ... -def get_makefile_filename() -> str: ... -def get_python_inc(plat_specific: bool = ..., prefix: str | None = ...) -> str: ... -def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = ...) -> str: ... -def customize_compiler(compiler: CCompiler) -> None: ... -def set_python_build() -> None: ... diff --git a/stdlib/@python2/distutils/util.pyi b/stdlib/@python2/distutils/util.pyi deleted file mode 100644 index c0882d1..0000000 --- a/stdlib/@python2/distutils/util.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from typing import Any, Callable, List, Mapping, Tuple - -def get_platform() -> str: ... -def convert_path(pathname: str) -> str: ... -def change_root(new_root: str, pathname: str) -> str: ... -def check_environ() -> None: ... -def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... -def split_quoted(s: str) -> List[str]: ... -def execute( - func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... -) -> None: ... -def strtobool(val: str) -> bool: ... -def byte_compile( - py_files: List[str], - optimize: int = ..., - force: bool = ..., - prefix: str | None = ..., - base_dir: str | None = ..., - verbose: bool = ..., - dry_run: bool = ..., - direct: bool | None = ..., -) -> None: ... -def rfc822_escape(header: str) -> str: ... diff --git a/stdlib/@python2/distutils/version.pyi b/stdlib/@python2/distutils/version.pyi deleted file mode 100644 index dd0969b..0000000 --- a/stdlib/@python2/distutils/version.pyi +++ /dev/null @@ -1,33 +0,0 @@ -from abc import abstractmethod -from typing import Pattern, Text, Tuple, TypeVar - -_T = TypeVar("_T", bound=Version) - -class Version: - def __repr__(self) -> str: ... - @abstractmethod - def __init__(self, vstring: Text | None = ...) -> None: ... - @abstractmethod - def parse(self: _T, vstring: Text) -> _T: ... - @abstractmethod - def __str__(self) -> str: ... - @abstractmethod - def __cmp__(self: _T, other: _T | str) -> bool: ... - -class StrictVersion(Version): - version_re: Pattern[str] - version: Tuple[int, int, int] - prerelease: Tuple[Text, int] | None - def __init__(self, vstring: Text | None = ...) -> None: ... - def parse(self: _T, vstring: Text) -> _T: ... - def __str__(self) -> str: ... - def __cmp__(self: _T, other: _T | str) -> bool: ... - -class LooseVersion(Version): - component_re: Pattern[str] - vstring: Text - version: Tuple[Text | int, ...] - def __init__(self, vstring: Text | None = ...) -> None: ... - def parse(self: _T, vstring: Text) -> _T: ... - def __str__(self) -> str: ... - def __cmp__(self: _T, other: _T | str) -> bool: ... diff --git a/stdlib/@python2/doctest.pyi b/stdlib/@python2/doctest.pyi deleted file mode 100644 index 6c3b922..0000000 --- a/stdlib/@python2/doctest.pyi +++ /dev/null @@ -1,209 +0,0 @@ -import types -import unittest -from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Type - -class TestResults(NamedTuple): - failed: int - attempted: int - -OPTIONFLAGS_BY_NAME: Dict[str, int] - -def register_optionflag(name: str) -> int: ... - -DONT_ACCEPT_TRUE_FOR_1: int -DONT_ACCEPT_BLANKLINE: int -NORMALIZE_WHITESPACE: int -ELLIPSIS: int -SKIP: int -IGNORE_EXCEPTION_DETAIL: int - -COMPARISON_FLAGS: int - -REPORT_UDIFF: int -REPORT_CDIFF: int -REPORT_NDIFF: int -REPORT_ONLY_FIRST_FAILURE: int -REPORTING_FLAGS: int - -BLANKLINE_MARKER: str -ELLIPSIS_MARKER: str - -class Example: - source: str - want: str - exc_msg: str | None - lineno: int - indent: int - options: Dict[int, bool] - def __init__( - self, - source: str, - want: str, - exc_msg: str | None = ..., - lineno: int = ..., - indent: int = ..., - options: Dict[int, bool] | None = ..., - ) -> None: ... - def __hash__(self) -> int: ... - -class DocTest: - examples: List[Example] - globs: Dict[str, Any] - name: str - filename: str | None - lineno: int | None - docstring: str | None - def __init__( - self, - examples: List[Example], - globs: Dict[str, Any], - name: str, - filename: str | None, - lineno: int | None, - docstring: str | None, - ) -> None: ... - def __hash__(self) -> int: ... - def __lt__(self, other: DocTest) -> bool: ... - -class DocTestParser: - def parse(self, string: str, name: str = ...) -> List[str | Example]: ... - def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... - def get_examples(self, string: str, name: str = ...) -> List[Example]: ... - -class DocTestFinder: - def __init__( - self, verbose: bool = ..., parser: DocTestParser = ..., recurse: bool = ..., exclude_empty: bool = ... - ) -> None: ... - def find( - self, - obj: object, - name: str | None = ..., - module: None | bool | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - extraglobs: Dict[str, Any] | None = ..., - ) -> List[DocTest]: ... - -_Out = Callable[[str], Any] -_ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType] - -class DocTestRunner: - DIVIDER: str - optionflags: int - original_optionflags: int - tries: int - failures: int - test: DocTest - def __init__(self, checker: OutputChecker | None = ..., verbose: bool | None = ..., optionflags: int = ...) -> None: ... - def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ... - def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... - def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... - def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ... - def run( - self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ... - ) -> TestResults: ... - def summarize(self, verbose: bool | None = ...) -> TestResults: ... - def merge(self, other: DocTestRunner) -> None: ... - -class OutputChecker: - def check_output(self, want: str, got: str, optionflags: int) -> bool: ... - def output_difference(self, example: Example, got: str, optionflags: int) -> str: ... - -class DocTestFailure(Exception): - test: DocTest - example: Example - got: str - def __init__(self, test: DocTest, example: Example, got: str) -> None: ... - -class UnexpectedException(Exception): - test: DocTest - example: Example - exc_info: _ExcInfo - def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ... - -class DebugRunner(DocTestRunner): ... - -master: DocTestRunner | None - -def testmod( - m: types.ModuleType | None = ..., - name: str | None = ..., - globs: Dict[str, Any] | None = ..., - verbose: bool | None = ..., - report: bool = ..., - optionflags: int = ..., - extraglobs: Dict[str, Any] | None = ..., - raise_on_error: bool = ..., - exclude_empty: bool = ..., -) -> TestResults: ... -def testfile( - filename: str, - module_relative: bool = ..., - name: str | None = ..., - package: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - verbose: bool | None = ..., - report: bool = ..., - optionflags: int = ..., - extraglobs: Dict[str, Any] | None = ..., - raise_on_error: bool = ..., - parser: DocTestParser = ..., - encoding: str | None = ..., -) -> TestResults: ... -def run_docstring_examples( - f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ... -) -> None: ... -def set_unittest_reportflags(flags: int) -> int: ... - -class DocTestCase(unittest.TestCase): - def __init__( - self, - test: DocTest, - optionflags: int = ..., - setUp: Callable[[DocTest], Any] | None = ..., - tearDown: Callable[[DocTest], Any] | None = ..., - checker: OutputChecker | None = ..., - ) -> None: ... - def setUp(self) -> None: ... - def tearDown(self) -> None: ... - def runTest(self) -> None: ... - def format_failure(self, err: str) -> str: ... - def debug(self) -> None: ... - def id(self) -> str: ... - def __hash__(self) -> int: ... - def shortDescription(self) -> str: ... - -class SkipDocTestCase(DocTestCase): - def __init__(self, module: types.ModuleType) -> None: ... - def setUp(self) -> None: ... - def test_skip(self) -> None: ... - def shortDescription(self) -> str: ... - -_DocTestSuite = unittest.TestSuite - -def DocTestSuite( - module: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - extraglobs: Dict[str, Any] | None = ..., - test_finder: DocTestFinder | None = ..., - **options: Any, -) -> _DocTestSuite: ... - -class DocFileCase(DocTestCase): - def id(self) -> str: ... - def format_failure(self, err: str) -> str: ... - -def DocFileTest( - path: str, - module_relative: bool = ..., - package: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - parser: DocTestParser = ..., - encoding: str | None = ..., - **options: Any, -) -> DocFileCase: ... -def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ... -def script_from_examples(s: str) -> str: ... -def testsource(module: None | str | types.ModuleType, name: str) -> str: ... -def debug_src(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ... -def debug_script(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ... -def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ... diff --git a/stdlib/@python2/dummy_thread.pyi b/stdlib/@python2/dummy_thread.pyi deleted file mode 100644 index 0a28b3a..0000000 --- a/stdlib/@python2/dummy_thread.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Any, Callable, Dict, NoReturn, Tuple - -class error(Exception): - def __init__(self, *args: Any) -> None: ... - -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> None: ... -def exit() -> NoReturn: ... -def get_ident() -> int: ... -def allocate_lock() -> LockType: ... -def stack_size(size: int | None = ...) -> int: ... - -class LockType(object): - locked_status: bool - def __init__(self) -> None: ... - def acquire(self, waitflag: bool | None = ...) -> bool: ... - def __enter__(self, waitflag: bool | None = ...) -> bool: ... - def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ... - def release(self) -> bool: ... - def locked(self) -> bool: ... - -def interrupt_main() -> None: ... diff --git a/stdlib/@python2/dummy_threading.pyi b/stdlib/@python2/dummy_threading.pyi deleted file mode 100644 index 757cb8d..0000000 --- a/stdlib/@python2/dummy_threading.pyi +++ /dev/null @@ -1,2 +0,0 @@ -from _dummy_threading import * -from _dummy_threading import __all__ as __all__ diff --git a/stdlib/@python2/email/MIMEText.pyi b/stdlib/@python2/email/MIMEText.pyi deleted file mode 100644 index 3b05977..0000000 --- a/stdlib/@python2/email/MIMEText.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.nonmultipart import MIMENonMultipart - -class MIMEText(MIMENonMultipart): - def __init__(self, _text, _subtype=..., _charset=...) -> None: ... diff --git a/stdlib/@python2/email/__init__.pyi b/stdlib/@python2/email/__init__.pyi deleted file mode 100644 index 83d9895..0000000 --- a/stdlib/@python2/email/__init__.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import IO, AnyStr - -def message_from_string(s: AnyStr, *args, **kwargs): ... -def message_from_bytes(s: str, *args, **kwargs): ... -def message_from_file(fp: IO[AnyStr], *args, **kwargs): ... -def message_from_binary_file(fp: IO[str], *args, **kwargs): ... diff --git a/stdlib/@python2/email/_parseaddr.pyi b/stdlib/@python2/email/_parseaddr.pyi deleted file mode 100644 index 74ea3a6..0000000 --- a/stdlib/@python2/email/_parseaddr.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from typing import Any - -def parsedate_tz(data): ... -def parsedate(data): ... -def mktime_tz(data): ... -def quote(str): ... - -class AddrlistClass: - specials: Any - pos: Any - LWS: Any - CR: Any - FWS: Any - atomends: Any - phraseends: Any - field: Any - commentlist: Any - def __init__(self, field): ... - def gotonext(self): ... - def getaddrlist(self): ... - def getaddress(self): ... - def getrouteaddr(self): ... - def getaddrspec(self): ... - def getdomain(self): ... - def getdelimited(self, beginchar, endchars, allowcomments: bool = ...): ... - def getquote(self): ... - def getcomment(self): ... - def getdomainliteral(self): ... - def getatom(self, atomends: Any | None = ...): ... - def getphraselist(self): ... - -class AddressList(AddrlistClass): - addresslist: Any - def __init__(self, field): ... - def __len__(self): ... - def __add__(self, other): ... - def __iadd__(self, other): ... - def __sub__(self, other): ... - def __isub__(self, other): ... - def __getitem__(self, index): ... diff --git a/stdlib/@python2/email/base64mime.pyi b/stdlib/@python2/email/base64mime.pyi deleted file mode 100644 index fc65529..0000000 --- a/stdlib/@python2/email/base64mime.pyi +++ /dev/null @@ -1,11 +0,0 @@ -def base64_len(s: bytes) -> int: ... -def header_encode(header, charset=..., keep_eols=..., maxlinelen=..., eol=...): ... -def encode(s, binary=..., maxlinelen=..., eol=...): ... - -body_encode = encode -encodestring = encode - -def decode(s, convert_eols=...): ... - -body_decode = decode -decodestring = decode diff --git a/stdlib/@python2/email/charset.pyi b/stdlib/@python2/email/charset.pyi deleted file mode 100644 index 88b5f88..0000000 --- a/stdlib/@python2/email/charset.pyi +++ /dev/null @@ -1,26 +0,0 @@ -def add_charset(charset, header_enc=..., body_enc=..., output_charset=...) -> None: ... -def add_alias(alias, canonical) -> None: ... -def add_codec(charset, codecname) -> None: ... - -QP: int # undocumented -BASE64: int # undocumented -SHORTEST: int # undocumented - -class Charset: - input_charset = ... - header_encoding = ... - body_encoding = ... - output_charset = ... - input_codec = ... - output_codec = ... - def __init__(self, input_charset=...) -> None: ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def get_body_encoding(self): ... - def convert(self, s): ... - def to_splittable(self, s): ... - def from_splittable(self, ustr, to_output: bool = ...): ... - def get_output_charset(self): ... - def encoded_header_len(self, s): ... - def header_encode(self, s, convert: bool = ...): ... - def body_encode(self, s, convert: bool = ...): ... diff --git a/stdlib/@python2/email/encoders.pyi b/stdlib/@python2/email/encoders.pyi deleted file mode 100644 index 5670cba..0000000 --- a/stdlib/@python2/email/encoders.pyi +++ /dev/null @@ -1,4 +0,0 @@ -def encode_base64(msg) -> None: ... -def encode_quopri(msg) -> None: ... -def encode_7or8bit(msg) -> None: ... -def encode_noop(msg) -> None: ... diff --git a/stdlib/@python2/email/feedparser.pyi b/stdlib/@python2/email/feedparser.pyi deleted file mode 100644 index fb2aa9f..0000000 --- a/stdlib/@python2/email/feedparser.pyi +++ /dev/null @@ -1,17 +0,0 @@ -class BufferedSubFile: - def __init__(self) -> None: ... - def push_eof_matcher(self, pred) -> None: ... - def pop_eof_matcher(self): ... - def close(self) -> None: ... - def readline(self): ... - def unreadline(self, line) -> None: ... - def push(self, data): ... - def pushlines(self, lines) -> None: ... - def is_closed(self): ... - def __iter__(self): ... - def next(self): ... - -class FeedParser: - def __init__(self, _factory=...) -> None: ... - def feed(self, data) -> None: ... - def close(self): ... diff --git a/stdlib/@python2/email/generator.pyi b/stdlib/@python2/email/generator.pyi deleted file mode 100644 index a5f5983..0000000 --- a/stdlib/@python2/email/generator.pyi +++ /dev/null @@ -1,8 +0,0 @@ -class Generator: - def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ...) -> None: ... - def write(self, s) -> None: ... - def flatten(self, msg, unixfrom: bool = ...) -> None: ... - def clone(self, fp): ... - -class DecodedGenerator(Generator): - def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ..., fmt=...) -> None: ... diff --git a/stdlib/@python2/email/header.pyi b/stdlib/@python2/email/header.pyi deleted file mode 100644 index 429ee16..0000000 --- a/stdlib/@python2/email/header.pyi +++ /dev/null @@ -1,10 +0,0 @@ -def decode_header(header): ... -def make_header(decoded_seq, maxlinelen=..., header_name=..., continuation_ws=...): ... - -class Header: - def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=..., errors=...) -> None: ... - def __unicode__(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def append(self, s, charset=..., errors=...) -> None: ... - def encode(self, splitchars=...): ... diff --git a/stdlib/@python2/email/iterators.pyi b/stdlib/@python2/email/iterators.pyi deleted file mode 100644 index 5002644..0000000 --- a/stdlib/@python2/email/iterators.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import Any, Generator - -def walk(self) -> Generator[Any, Any, Any]: ... -def body_line_iterator(msg, decode: bool = ...) -> Generator[Any, Any, Any]: ... -def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator[Any, Any, Any]: ... diff --git a/stdlib/@python2/email/message.pyi b/stdlib/@python2/email/message.pyi deleted file mode 100644 index 642bba7..0000000 --- a/stdlib/@python2/email/message.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from typing import Any, Generator - -class Message: - preamble = ... - epilogue = ... - defects = ... - def __init__(self): ... - def as_string(self, unixfrom=...): ... - def is_multipart(self) -> bool: ... - def set_unixfrom(self, unixfrom) -> None: ... - def get_unixfrom(self): ... - def attach(self, payload) -> None: ... - def get_payload(self, i=..., decode: bool = ...): ... - def set_payload(self, payload, charset=...) -> None: ... - def set_charset(self, charset): ... - def get_charset(self): ... - def __len__(self): ... - def __getitem__(self, name): ... - def __setitem__(self, name, val) -> None: ... - def __delitem__(self, name) -> None: ... - def __contains__(self, name): ... - def has_key(self, name) -> bool: ... - def keys(self): ... - def values(self): ... - def items(self): ... - def get(self, name, failobj=...): ... - def get_all(self, name, failobj=...): ... - def add_header(self, _name, _value, **_params) -> None: ... - def replace_header(self, _name, _value) -> None: ... - def get_content_type(self): ... - def get_content_maintype(self): ... - def get_content_subtype(self): ... - def get_default_type(self): ... - def set_default_type(self, ctype) -> None: ... - def get_params(self, failobj=..., header=..., unquote: bool = ...): ... - def get_param(self, param, failobj=..., header=..., unquote: bool = ...): ... - def set_param(self, param, value, header=..., requote: bool = ..., charset=..., language=...) -> None: ... - def del_param(self, param, header=..., requote: bool = ...): ... - def set_type(self, type, header=..., requote: bool = ...): ... - def get_filename(self, failobj=...): ... - def get_boundary(self, failobj=...): ... - def set_boundary(self, boundary) -> None: ... - def get_content_charset(self, failobj=...): ... - def get_charsets(self, failobj=...): ... - def walk(self) -> Generator[Any, Any, Any]: ... diff --git a/stdlib/@python2/email/mime/application.pyi b/stdlib/@python2/email/mime/application.pyi deleted file mode 100644 index 4245e3e..0000000 --- a/stdlib/@python2/email/mime/application.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from email.mime.nonmultipart import MIMENonMultipart -from typing import Callable, Optional, Tuple, Union - -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] - -class MIMEApplication(MIMENonMultipart): - def __init__( - self, _data: bytes, _subtype: str = ..., _encoder: Callable[[MIMEApplication], None] = ..., **_params: _ParamsType - ) -> None: ... diff --git a/stdlib/@python2/email/mime/audio.pyi b/stdlib/@python2/email/mime/audio.pyi deleted file mode 100644 index 5f11f8d..0000000 --- a/stdlib/@python2/email/mime/audio.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.nonmultipart import MIMENonMultipart - -class MIMEAudio(MIMENonMultipart): - def __init__(self, _audiodata, _subtype=..., _encoder=..., **_params) -> None: ... diff --git a/stdlib/@python2/email/mime/base.pyi b/stdlib/@python2/email/mime/base.pyi deleted file mode 100644 index 4bde4f0..0000000 --- a/stdlib/@python2/email/mime/base.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email import message - -class MIMEBase(message.Message): - def __init__(self, _maintype, _subtype, **_params) -> None: ... diff --git a/stdlib/@python2/email/mime/image.pyi b/stdlib/@python2/email/mime/image.pyi deleted file mode 100644 index 3fe8249..0000000 --- a/stdlib/@python2/email/mime/image.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.nonmultipart import MIMENonMultipart - -class MIMEImage(MIMENonMultipart): - def __init__(self, _imagedata, _subtype=..., _encoder=..., **_params) -> None: ... diff --git a/stdlib/@python2/email/mime/message.pyi b/stdlib/@python2/email/mime/message.pyi deleted file mode 100644 index 9d6fafa..0000000 --- a/stdlib/@python2/email/mime/message.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.nonmultipart import MIMENonMultipart - -class MIMEMessage(MIMENonMultipart): - def __init__(self, _msg, _subtype=...) -> None: ... diff --git a/stdlib/@python2/email/mime/multipart.pyi b/stdlib/@python2/email/mime/multipart.pyi deleted file mode 100644 index 0a7d3fa..0000000 --- a/stdlib/@python2/email/mime/multipart.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.base import MIMEBase - -class MIMEMultipart(MIMEBase): - def __init__(self, _subtype=..., boundary=..., _subparts=..., **_params) -> None: ... diff --git a/stdlib/@python2/email/mime/nonmultipart.pyi b/stdlib/@python2/email/mime/nonmultipart.pyi deleted file mode 100644 index 04d130e..0000000 --- a/stdlib/@python2/email/mime/nonmultipart.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.base import MIMEBase - -class MIMENonMultipart(MIMEBase): - def attach(self, payload): ... diff --git a/stdlib/@python2/email/mime/text.pyi b/stdlib/@python2/email/mime/text.pyi deleted file mode 100644 index 3b05977..0000000 --- a/stdlib/@python2/email/mime/text.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from email.mime.nonmultipart import MIMENonMultipart - -class MIMEText(MIMENonMultipart): - def __init__(self, _text, _subtype=..., _charset=...) -> None: ... diff --git a/stdlib/@python2/email/parser.pyi b/stdlib/@python2/email/parser.pyi deleted file mode 100644 index 4f22828..0000000 --- a/stdlib/@python2/email/parser.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from .feedparser import FeedParser as FeedParser # not in __all__ but listed in documentation - -class Parser: - def __init__(self, *args, **kws) -> None: ... - def parse(self, fp, headersonly: bool = ...): ... - def parsestr(self, text, headersonly: bool = ...): ... - -class HeaderParser(Parser): - def parse(self, fp, headersonly: bool = ...): ... - def parsestr(self, text, headersonly: bool = ...): ... diff --git a/stdlib/@python2/email/quoprimime.pyi b/stdlib/@python2/email/quoprimime.pyi deleted file mode 100644 index 3f2963c..0000000 --- a/stdlib/@python2/email/quoprimime.pyi +++ /dev/null @@ -1,18 +0,0 @@ -def header_quopri_check(c): ... -def body_quopri_check(c): ... -def header_quopri_len(s): ... -def body_quopri_len(str): ... -def unquote(s): ... -def quote(c): ... -def header_encode(header, charset: str = ..., keep_eols: bool = ..., maxlinelen: int = ..., eol=...): ... -def encode(body, binary: bool = ..., maxlinelen: int = ..., eol=...): ... - -body_encode = encode -encodestring = encode - -def decode(encoded, eol=...): ... - -body_decode = decode -decodestring = decode - -def header_decode(s): ... diff --git a/stdlib/@python2/email/utils.pyi b/stdlib/@python2/email/utils.pyi deleted file mode 100644 index 0d18513..0000000 --- a/stdlib/@python2/email/utils.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from email._parseaddr import ( - AddressList as _AddressList, - mktime_tz as mktime_tz, - parsedate as _parsedate, - parsedate_tz as _parsedate_tz, -) -from quopri import decodestring as _qdecode -from typing import Any - -def formataddr(pair): ... -def getaddresses(fieldvalues): ... -def formatdate(timeval: Any | None = ..., localtime: bool = ..., usegmt: bool = ...): ... -def make_msgid(idstring: Any | None = ...): ... -def parsedate(data): ... -def parsedate_tz(data): ... -def parseaddr(addr): ... -def unquote(str): ... -def decode_rfc2231(s): ... -def encode_rfc2231(s, charset: Any | None = ..., language: Any | None = ...): ... -def decode_params(params): ... -def collapse_rfc2231_value(value, errors=..., fallback_charset=...): ... diff --git a/stdlib/@python2/encodings/__init__.pyi b/stdlib/@python2/encodings/__init__.pyi deleted file mode 100644 index d6f4389..0000000 --- a/stdlib/@python2/encodings/__init__.pyi +++ /dev/null @@ -1,7 +0,0 @@ -import codecs -from typing import Any - -def search_function(encoding: str) -> codecs.CodecInfo: ... - -# Explicitly mark this package as incomplete. -def __getattr__(name: str) -> Any: ... diff --git a/stdlib/@python2/encodings/utf_8.pyi b/stdlib/@python2/encodings/utf_8.pyi deleted file mode 100644 index d38bd58..0000000 --- a/stdlib/@python2/encodings/utf_8.pyi +++ /dev/null @@ -1,15 +0,0 @@ -import codecs -from typing import Text, Tuple - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input: Text, final: bool = ...) -> bytes: ... - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[Text, int]: ... - -class StreamWriter(codecs.StreamWriter): ... -class StreamReader(codecs.StreamReader): ... - -def getregentry() -> codecs.CodecInfo: ... -def encode(input: Text, errors: Text = ...) -> bytes: ... -def decode(input: bytes, errors: Text = ...) -> Text: ... diff --git a/stdlib/@python2/ensurepip/__init__.pyi b/stdlib/@python2/ensurepip/__init__.pyi deleted file mode 100644 index 60946e7..0000000 --- a/stdlib/@python2/ensurepip/__init__.pyi +++ /dev/null @@ -1,9 +0,0 @@ -def version() -> str: ... -def bootstrap( - root: str | None = ..., - upgrade: bool = ..., - user: bool = ..., - altinstall: bool = ..., - default_pip: bool = ..., - verbosity: int = ..., -) -> None: ... diff --git a/stdlib/@python2/errno.pyi b/stdlib/@python2/errno.pyi deleted file mode 100644 index b053604..0000000 --- a/stdlib/@python2/errno.pyi +++ /dev/null @@ -1,137 +0,0 @@ -from typing import Mapping - -errorcode: Mapping[int, str] - -EPERM: int -ENOENT: int -ESRCH: int -EINTR: int -EIO: int -ENXIO: int -E2BIG: int -ENOEXEC: int -EBADF: int -ECHILD: int -EAGAIN: int -ENOMEM: int -EACCES: int -EFAULT: int -ENOTBLK: int -EBUSY: int -EEXIST: int -EXDEV: int -ENODEV: int -ENOTDIR: int -EISDIR: int -EINVAL: int -ENFILE: int -EMFILE: int -ENOTTY: int -ETXTBSY: int -EFBIG: int -ENOSPC: int -ESPIPE: int -EROFS: int -EMLINK: int -EPIPE: int -EDOM: int -ERANGE: int -EDEADLCK: int -ENAMETOOLONG: int -ENOLCK: int -ENOSYS: int -ENOTEMPTY: int -ELOOP: int -EWOULDBLOCK: int -ENOMSG: int -EIDRM: int -ECHRNG: int -EL2NSYNC: int -EL3HLT: int -EL3RST: int -ELNRNG: int -EUNATCH: int -ENOCSI: int -EL2HLT: int -EBADE: int -EBADR: int -EXFULL: int -ENOANO: int -EBADRQC: int -EBADSLT: int -EDEADLOCK: int -EBFONT: int -ENOSTR: int -ENODATA: int -ETIME: int -ENOSR: int -ENONET: int -ENOPKG: int -EREMOTE: int -ENOLINK: int -EADV: int -ESRMNT: int -ECOMM: int -EPROTO: int -EMULTIHOP: int -EDOTDOT: int -EBADMSG: int -EOVERFLOW: int -ENOTUNIQ: int -EBADFD: int -EREMCHG: int -ELIBACC: int -ELIBBAD: int -ELIBSCN: int -ELIBMAX: int -ELIBEXEC: int -EILSEQ: int -ERESTART: int -ESTRPIPE: int -EUSERS: int -ENOTSOCK: int -EDESTADDRREQ: int -EMSGSIZE: int -EPROTOTYPE: int -ENOPROTOOPT: int -EPROTONOSUPPORT: int -ESOCKTNOSUPPORT: int -ENOTSUP: int -EOPNOTSUPP: int -EPFNOSUPPORT: int -EAFNOSUPPORT: int -EADDRINUSE: int -EADDRNOTAVAIL: int -ENETDOWN: int -ENETUNREACH: int -ENETRESET: int -ECONNABORTED: int -ECONNRESET: int -ENOBUFS: int -EISCONN: int -ENOTCONN: int -ESHUTDOWN: int -ETOOMANYREFS: int -ETIMEDOUT: int -ECONNREFUSED: int -EHOSTDOWN: int -EHOSTUNREACH: int -EALREADY: int -EINPROGRESS: int -ESTALE: int -EUCLEAN: int -ENOTNAM: int -ENAVAIL: int -EISNAM: int -EREMOTEIO: int -EDQUOT: int -ECANCELED: int # undocumented -EKEYEXPIRED: int # undocumented -EKEYREJECTED: int # undocumented -EKEYREVOKED: int # undocumented -EMEDIUMTYPE: int # undocumented -ENOKEY: int # undocumented -ENOMEDIUM: int # undocumented -ENOTRECOVERABLE: int # undocumented -EOWNERDEAD: int # undocumented -ERFKILL: int # undocumented diff --git a/stdlib/@python2/exceptions.pyi b/stdlib/@python2/exceptions.pyi deleted file mode 100644 index fbad897..0000000 --- a/stdlib/@python2/exceptions.pyi +++ /dev/null @@ -1,50 +0,0 @@ -from __builtin__ import ( - ArithmeticError as ArithmeticError, - AssertionError as AssertionError, - AttributeError as AttributeError, - BaseException as BaseException, - BufferError as BufferError, - BytesWarning as BytesWarning, - DeprecationWarning as DeprecationWarning, - EnvironmentError as EnvironmentError, - EOFError as EOFError, - Exception as Exception, - FloatingPointError as FloatingPointError, - FutureWarning as FutureWarning, - GeneratorExit as GeneratorExit, - ImportError as ImportError, - ImportWarning as ImportWarning, - IndentationError as IndentationError, - IndexError as IndexError, - IOError as IOError, - KeyboardInterrupt as KeyboardInterrupt, - KeyError as KeyError, - LookupError as LookupError, - MemoryError as MemoryError, - NameError as NameError, - NotImplementedError as NotImplementedError, - OSError as OSError, - OverflowError as OverflowError, - PendingDeprecationWarning as PendingDeprecationWarning, - ReferenceError as ReferenceError, - RuntimeError as RuntimeError, - RuntimeWarning as RuntimeWarning, - StandardError as StandardError, - StopIteration as StopIteration, - SyntaxError as SyntaxError, - SyntaxWarning as SyntaxWarning, - SystemError as SystemError, - SystemExit as SystemExit, - TabError as TabError, - TypeError as TypeError, - UnboundLocalError as UnboundLocalError, - UnicodeDecodeError as UnicodeDecodeError, - UnicodeEncodeError as UnicodeEncodeError, - UnicodeError as UnicodeError, - UnicodeTranslateError as UnicodeTranslateError, - UnicodeWarning as UnicodeWarning, - UserWarning as UserWarning, - ValueError as ValueError, - Warning as Warning, - ZeroDivisionError as ZeroDivisionError, -) diff --git a/stdlib/@python2/fcntl.pyi b/stdlib/@python2/fcntl.pyi deleted file mode 100644 index b373027..0000000 --- a/stdlib/@python2/fcntl.pyi +++ /dev/null @@ -1,82 +0,0 @@ -from _typeshed import FileDescriptorLike -from typing import Any - -FASYNC: int -FD_CLOEXEC: int - -DN_ACCESS: int -DN_ATTRIB: int -DN_CREATE: int -DN_DELETE: int -DN_MODIFY: int -DN_MULTISHOT: int -DN_RENAME: int -F_DUPFD: int -F_EXLCK: int -F_GETFD: int -F_GETFL: int -F_GETLEASE: int -F_GETLK: int -F_GETLK64: int -F_GETOWN: int -F_GETSIG: int -F_NOTIFY: int -F_RDLCK: int -F_SETFD: int -F_SETFL: int -F_SETLEASE: int -F_SETLK: int -F_SETLK64: int -F_SETLKW: int -F_SETLKW64: int -F_SETOWN: int -F_SETSIG: int -F_SHLCK: int -F_UNLCK: int -F_WRLCK: int -I_ATMARK: int -I_CANPUT: int -I_CKBAND: int -I_FDINSERT: int -I_FIND: int -I_FLUSH: int -I_FLUSHBAND: int -I_GETBAND: int -I_GETCLTIME: int -I_GETSIG: int -I_GRDOPT: int -I_GWROPT: int -I_LINK: int -I_LIST: int -I_LOOK: int -I_NREAD: int -I_PEEK: int -I_PLINK: int -I_POP: int -I_PUNLINK: int -I_PUSH: int -I_RECVFD: int -I_SENDFD: int -I_SETCLTIME: int -I_SETSIG: int -I_SRDOPT: int -I_STR: int -I_SWROPT: int -I_UNLINK: int -LOCK_EX: int -LOCK_MAND: int -LOCK_NB: int -LOCK_READ: int -LOCK_RW: int -LOCK_SH: int -LOCK_UN: int -LOCK_WRITE: int - -# TODO All these return either int or bytes depending on the value of -# cmd (not on the type of arg). -def fcntl(fd: FileDescriptorLike, op: int, arg: int | bytes = ...) -> Any: ... - -# TODO: arg: int or read-only buffer interface or read-write buffer interface -def ioctl(fd: FileDescriptorLike, op: int, arg: int | bytes = ..., mutate_flag: bool = ...) -> Any: ... -def flock(fd: FileDescriptorLike, op: int) -> None: ... -def lockf(fd: FileDescriptorLike, op: int, length: int = ..., start: int = ..., whence: int = ...) -> Any: ... diff --git a/stdlib/@python2/filecmp.pyi b/stdlib/@python2/filecmp.pyi deleted file mode 100644 index 0be5596..0000000 --- a/stdlib/@python2/filecmp.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Sequence, Text, Tuple - -DEFAULT_IGNORES: List[str] - -def cmp(f1: bytes | Text, f2: bytes | Text, shallow: int | bool = ...) -> bool: ... -def cmpfiles( - a: AnyStr, b: AnyStr, common: Iterable[AnyStr], shallow: int | bool = ... -) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ... - -class dircmp(Generic[AnyStr]): - def __init__( - self, a: AnyStr, b: AnyStr, ignore: Sequence[AnyStr] | None = ..., hide: Sequence[AnyStr] | None = ... - ) -> None: ... - left: AnyStr - right: AnyStr - hide: Sequence[AnyStr] - ignore: Sequence[AnyStr] - # These properties are created at runtime by __getattr__ - subdirs: Dict[AnyStr, dircmp[AnyStr]] - same_files: List[AnyStr] - diff_files: List[AnyStr] - funny_files: List[AnyStr] - common_dirs: List[AnyStr] - common_files: List[AnyStr] - common_funny: List[AnyStr] - common: List[AnyStr] - left_only: List[AnyStr] - right_only: List[AnyStr] - left_list: List[AnyStr] - right_list: List[AnyStr] - def report(self) -> None: ... - def report_partial_closure(self) -> None: ... - def report_full_closure(self) -> None: ... - methodmap: Dict[str, Callable[[], None]] - def phase0(self) -> None: ... - def phase1(self) -> None: ... - def phase2(self) -> None: ... - def phase3(self) -> None: ... - def phase4(self) -> None: ... - def phase4_closure(self) -> None: ... diff --git a/stdlib/@python2/fileinput.pyi b/stdlib/@python2/fileinput.pyi deleted file mode 100644 index 316643f..0000000 --- a/stdlib/@python2/fileinput.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Text - -def input( - files: Text | Iterable[Text] | None = ..., - inplace: bool = ..., - backup: str = ..., - bufsize: int = ..., - mode: str = ..., - openhook: Callable[[Text, str], IO[AnyStr]] = ..., -) -> FileInput[AnyStr]: ... -def close() -> None: ... -def nextfile() -> None: ... -def filename() -> str: ... -def lineno() -> int: ... -def filelineno() -> int: ... -def fileno() -> int: ... -def isfirstline() -> bool: ... -def isstdin() -> bool: ... - -class FileInput(Iterable[AnyStr], Generic[AnyStr]): - def __init__( - self, - files: None | Text | Iterable[Text] = ..., - inplace: bool = ..., - backup: str = ..., - bufsize: int = ..., - mode: str = ..., - openhook: Callable[[Text, str], IO[AnyStr]] = ..., - ) -> None: ... - def __del__(self) -> None: ... - def close(self) -> None: ... - def __iter__(self) -> Iterator[AnyStr]: ... - def __next__(self) -> AnyStr: ... - def __getitem__(self, i: int) -> AnyStr: ... - def nextfile(self) -> None: ... - def readline(self) -> AnyStr: ... - def filename(self) -> str: ... - def lineno(self) -> int: ... - def filelineno(self) -> int: ... - def fileno(self) -> int: ... - def isfirstline(self) -> bool: ... - def isstdin(self) -> bool: ... - -def hook_compressed(filename: Text, mode: str) -> IO[Any]: ... -def hook_encoded(encoding: str) -> Callable[[Text, str], IO[Any]]: ... diff --git a/stdlib/@python2/fnmatch.pyi b/stdlib/@python2/fnmatch.pyi deleted file mode 100644 index e933b7b..0000000 --- a/stdlib/@python2/fnmatch.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import AnyStr, Iterable, List, Union - -_EitherStr = Union[str, unicode] - -def fnmatch(filename: _EitherStr, pattern: _EitherStr) -> bool: ... -def fnmatchcase(filename: _EitherStr, pattern: _EitherStr) -> bool: ... -def filter(names: Iterable[AnyStr], pattern: _EitherStr) -> List[AnyStr]: ... -def translate(pattern: AnyStr) -> AnyStr: ... diff --git a/stdlib/@python2/formatter.pyi b/stdlib/@python2/formatter.pyi deleted file mode 100644 index da165f2..0000000 --- a/stdlib/@python2/formatter.pyi +++ /dev/null @@ -1,103 +0,0 @@ -from typing import IO, Any, Iterable, List, Tuple - -AS_IS: None -_FontType = Tuple[str, bool, bool, bool] -_StylesType = Tuple[Any, ...] - -class NullFormatter: - writer: NullWriter | None - def __init__(self, writer: NullWriter | None = ...) -> None: ... - def end_paragraph(self, blankline: int) -> None: ... - def add_line_break(self) -> None: ... - def add_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def add_label_data(self, format: str, counter: int, blankline: int | None = ...) -> None: ... - def add_flowing_data(self, data: str) -> None: ... - def add_literal_data(self, data: str) -> None: ... - def flush_softspace(self) -> None: ... - def push_alignment(self, align: str | None) -> None: ... - def pop_alignment(self) -> None: ... - def push_font(self, x: _FontType) -> None: ... - def pop_font(self) -> None: ... - def push_margin(self, margin: int) -> None: ... - def pop_margin(self) -> None: ... - def set_spacing(self, spacing: str | None) -> None: ... - def push_style(self, *styles: _StylesType) -> None: ... - def pop_style(self, n: int = ...) -> None: ... - def assert_line_data(self, flag: int = ...) -> None: ... - -class AbstractFormatter: - writer: NullWriter - align: str | None - align_stack: List[str | None] - font_stack: List[_FontType] - margin_stack: List[int] - spacing: str | None - style_stack: Any - nospace: int - softspace: int - para_end: int - parskip: int - hard_break: int - have_label: int - def __init__(self, writer: NullWriter) -> None: ... - def end_paragraph(self, blankline: int) -> None: ... - def add_line_break(self) -> None: ... - def add_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def add_label_data(self, format: str, counter: int, blankline: int | None = ...) -> None: ... - def format_counter(self, format: Iterable[str], counter: int) -> str: ... - def format_letter(self, case: str, counter: int) -> str: ... - def format_roman(self, case: str, counter: int) -> str: ... - def add_flowing_data(self, data: str) -> None: ... - def add_literal_data(self, data: str) -> None: ... - def flush_softspace(self) -> None: ... - def push_alignment(self, align: str | None) -> None: ... - def pop_alignment(self) -> None: ... - def push_font(self, font: _FontType) -> None: ... - def pop_font(self) -> None: ... - def push_margin(self, margin: int) -> None: ... - def pop_margin(self) -> None: ... - def set_spacing(self, spacing: str | None) -> None: ... - def push_style(self, *styles: _StylesType) -> None: ... - def pop_style(self, n: int = ...) -> None: ... - def assert_line_data(self, flag: int = ...) -> None: ... - -class NullWriter: - def __init__(self) -> None: ... - def flush(self) -> None: ... - def new_alignment(self, align: str | None) -> None: ... - def new_font(self, font: _FontType) -> None: ... - def new_margin(self, margin: int, level: int) -> None: ... - def new_spacing(self, spacing: str | None) -> None: ... - def new_styles(self, styles: Tuple[Any, ...]) -> None: ... - def send_paragraph(self, blankline: int) -> None: ... - def send_line_break(self) -> None: ... - def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def send_label_data(self, data: str) -> None: ... - def send_flowing_data(self, data: str) -> None: ... - def send_literal_data(self, data: str) -> None: ... - -class AbstractWriter(NullWriter): - def new_alignment(self, align: str | None) -> None: ... - def new_font(self, font: _FontType) -> None: ... - def new_margin(self, margin: int, level: int) -> None: ... - def new_spacing(self, spacing: str | None) -> None: ... - def new_styles(self, styles: Tuple[Any, ...]) -> None: ... - def send_paragraph(self, blankline: int) -> None: ... - def send_line_break(self) -> None: ... - def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def send_label_data(self, data: str) -> None: ... - def send_flowing_data(self, data: str) -> None: ... - def send_literal_data(self, data: str) -> None: ... - -class DumbWriter(NullWriter): - file: IO[str] - maxcol: int - def __init__(self, file: IO[str] | None = ..., maxcol: int = ...) -> None: ... - def reset(self) -> None: ... - def send_paragraph(self, blankline: int) -> None: ... - def send_line_break(self) -> None: ... - def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def send_literal_data(self, data: str) -> None: ... - def send_flowing_data(self, data: str) -> None: ... - -def test(file: str | None = ...) -> None: ... diff --git a/stdlib/@python2/fractions.pyi b/stdlib/@python2/fractions.pyi deleted file mode 100644 index 872e20e..0000000 --- a/stdlib/@python2/fractions.pyi +++ /dev/null @@ -1,145 +0,0 @@ -from decimal import Decimal -from numbers import Integral, Rational, Real -from typing import Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal - -_ComparableNum = Union[int, float, Decimal, Real] -_T = TypeVar("_T") - -@overload -def gcd(a: int, b: int) -> int: ... -@overload -def gcd(a: Integral, b: int) -> Integral: ... -@overload -def gcd(a: int, b: Integral) -> Integral: ... -@overload -def gcd(a: Integral, b: Integral) -> Integral: ... - -class Fraction(Rational): - @overload - def __new__( - cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... - ) -> _T: ... - @overload - def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ... - @classmethod - def from_float(cls, f: float) -> Fraction: ... - @classmethod - def from_decimal(cls, dec: Decimal) -> Fraction: ... - def limit_denominator(self, max_denominator: int = ...) -> Fraction: ... - @property - def numerator(self) -> int: ... - @property - def denominator(self) -> int: ... - @overload - def __add__(self, other: int | Fraction) -> Fraction: ... - @overload - def __add__(self, other: float) -> float: ... - @overload - def __add__(self, other: complex) -> complex: ... - @overload - def __radd__(self, other: int | Fraction) -> Fraction: ... - @overload - def __radd__(self, other: float) -> float: ... - @overload - def __radd__(self, other: complex) -> complex: ... - @overload - def __sub__(self, other: int | Fraction) -> Fraction: ... - @overload - def __sub__(self, other: float) -> float: ... - @overload - def __sub__(self, other: complex) -> complex: ... - @overload - def __rsub__(self, other: int | Fraction) -> Fraction: ... - @overload - def __rsub__(self, other: float) -> float: ... - @overload - def __rsub__(self, other: complex) -> complex: ... - @overload - def __mul__(self, other: int | Fraction) -> Fraction: ... - @overload - def __mul__(self, other: float) -> float: ... - @overload - def __mul__(self, other: complex) -> complex: ... - @overload - def __rmul__(self, other: int | Fraction) -> Fraction: ... - @overload - def __rmul__(self, other: float) -> float: ... - @overload - def __rmul__(self, other: complex) -> complex: ... - @overload - def __truediv__(self, other: int | Fraction) -> Fraction: ... - @overload - def __truediv__(self, other: float) -> float: ... - @overload - def __truediv__(self, other: complex) -> complex: ... - @overload - def __rtruediv__(self, other: int | Fraction) -> Fraction: ... - @overload - def __rtruediv__(self, other: float) -> float: ... - @overload - def __rtruediv__(self, other: complex) -> complex: ... - @overload - def __div__(self, other: int | Fraction) -> Fraction: ... - @overload - def __div__(self, other: float) -> float: ... - @overload - def __div__(self, other: complex) -> complex: ... - @overload - def __rdiv__(self, other: int | Fraction) -> Fraction: ... - @overload - def __rdiv__(self, other: float) -> float: ... - @overload - def __rdiv__(self, other: complex) -> complex: ... - @overload - def __floordiv__(self, other: int | Fraction) -> int: ... - @overload - def __floordiv__(self, other: float) -> float: ... - @overload - def __rfloordiv__(self, other: int | Fraction) -> int: ... - @overload - def __rfloordiv__(self, other: float) -> float: ... - @overload - def __mod__(self, other: int | Fraction) -> Fraction: ... - @overload - def __mod__(self, other: float) -> float: ... - @overload - def __rmod__(self, other: int | Fraction) -> Fraction: ... - @overload - def __rmod__(self, other: float) -> float: ... - @overload - def __divmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ... - @overload - def __divmod__(self, other: float) -> Tuple[float, Fraction]: ... - @overload - def __rdivmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ... - @overload - def __rdivmod__(self, other: float) -> Tuple[float, Fraction]: ... - @overload - def __pow__(self, other: int) -> Fraction: ... - @overload - def __pow__(self, other: float | Fraction) -> float: ... - @overload - def __pow__(self, other: complex) -> complex: ... - @overload - def __rpow__(self, other: int | float | Fraction) -> float: ... - @overload - def __rpow__(self, other: complex) -> complex: ... - def __pos__(self) -> Fraction: ... - def __neg__(self) -> Fraction: ... - def __abs__(self) -> Fraction: ... - def __trunc__(self) -> int: ... - def __hash__(self) -> int: ... - def __eq__(self, other: object) -> bool: ... - def __lt__(self, other: _ComparableNum) -> bool: ... - def __gt__(self, other: _ComparableNum) -> bool: ... - def __le__(self, other: _ComparableNum) -> bool: ... - def __ge__(self, other: _ComparableNum) -> bool: ... - def __nonzero__(self) -> bool: ... - # Not actually defined within fractions.py, but provides more useful - # overrides - @property - def real(self) -> Fraction: ... - @property - def imag(self) -> Literal[0]: ... - def conjugate(self) -> Fraction: ... diff --git a/stdlib/@python2/ftplib.pyi b/stdlib/@python2/ftplib.pyi deleted file mode 100644 index 0931a9d..0000000 --- a/stdlib/@python2/ftplib.pyi +++ /dev/null @@ -1,128 +0,0 @@ -from _typeshed import SupportsRead, SupportsReadline -from socket import socket -from ssl import SSLContext -from typing import Any, BinaryIO, Callable, List, Text, Tuple, Type, TypeVar, Union -from typing_extensions import Literal - -_T = TypeVar("_T") -_IntOrStr = Union[int, Text] - -MSG_OOB: int -FTP_PORT: int -MAXLINE: int -CRLF: str - -class Error(Exception): ... -class error_reply(Error): ... -class error_temp(Error): ... -class error_perm(Error): ... -class error_proto(Error): ... - -all_errors: Tuple[Type[Exception], ...] - -class FTP: - debugging: int - - # Note: This is technically the type that's passed in as the host argument. But to make it easier in Python 2 we - # accept Text but return str. - host: str - - port: int - maxline: int - sock: socket | None - welcome: str | None - passiveserver: int - timeout: int - af: int - lastresp: str - - file: BinaryIO | None - def __init__( - self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., timeout: float = ... - ) -> None: ... - def connect(self, host: Text = ..., port: int = ..., timeout: float = ...) -> str: ... - def getwelcome(self) -> str: ... - def set_debuglevel(self, level: int) -> None: ... - def debug(self, level: int) -> None: ... - def set_pasv(self, val: bool | int) -> None: ... - def sanitize(self, s: Text) -> str: ... - def putline(self, line: Text) -> None: ... - def putcmd(self, line: Text) -> None: ... - def getline(self) -> str: ... - def getmultiline(self) -> str: ... - def getresp(self) -> str: ... - def voidresp(self) -> str: ... - def abort(self) -> str: ... - def sendcmd(self, cmd: Text) -> str: ... - def voidcmd(self, cmd: Text) -> str: ... - def sendport(self, host: Text, port: int) -> str: ... - def sendeprt(self, host: Text, port: int) -> str: ... - def makeport(self) -> socket: ... - def makepasv(self) -> Tuple[str, int]: ... - def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ...) -> str: ... - # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers. - def ntransfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> Tuple[socket, int]: ... - def transfercmd(self, cmd: Text, rest: _IntOrStr | None = ...) -> socket: ... - def retrbinary( - self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: _IntOrStr | None = ... - ) -> str: ... - def storbinary( - self, - cmd: Text, - fp: SupportsRead[bytes], - blocksize: int = ..., - callback: Callable[[bytes], Any] | None = ..., - rest: _IntOrStr | None = ..., - ) -> str: ... - def retrlines(self, cmd: Text, callback: Callable[[str], Any] | None = ...) -> str: ... - def storlines(self, cmd: Text, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ... - def acct(self, password: Text) -> str: ... - def nlst(self, *args: Text) -> List[str]: ... - # Technically only the last arg can be a Callable but ... - def dir(self, *args: str | Callable[[str], None]) -> None: ... - def rename(self, fromname: Text, toname: Text) -> str: ... - def delete(self, filename: Text) -> str: ... - def cwd(self, dirname: Text) -> str: ... - def size(self, filename: Text) -> int | None: ... - def mkd(self, dirname: Text) -> str: ... - def rmd(self, dirname: Text) -> str: ... - def pwd(self) -> str: ... - def quit(self) -> str: ... - def close(self) -> None: ... - -class FTP_TLS(FTP): - def __init__( - self, - host: Text = ..., - user: Text = ..., - passwd: Text = ..., - acct: Text = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - context: SSLContext | None = ..., - timeout: float = ..., - source_address: Tuple[str, int] | None = ..., - ) -> None: ... - ssl_version: int - keyfile: str | None - certfile: str | None - context: SSLContext - def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ..., secure: bool = ...) -> str: ... - def auth(self) -> str: ... - def prot_p(self) -> str: ... - def prot_c(self) -> str: ... - -class Netrc: - def __init__(self, filename: Text | None = ...) -> None: ... - def get_hosts(self) -> List[str]: ... - def get_account(self, host: Text) -> Tuple[str | None, str | None, str | None]: ... - def get_macros(self) -> List[str]: ... - def get_macro(self, macro: Text) -> Tuple[str, ...]: ... - -def parse150(resp: str) -> int | None: ... # undocumented -def parse227(resp: str) -> Tuple[str, int]: ... # undocumented -def parse229(resp: str, peer: Any) -> Tuple[str, int]: ... # undocumented -def parse257(resp: str) -> str: ... # undocumented -def ftpcp( - source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ... -) -> None: ... # undocumented diff --git a/stdlib/@python2/functools.pyi b/stdlib/@python2/functools.pyi deleted file mode 100644 index dd87370..0000000 --- a/stdlib/@python2/functools.pyi +++ /dev/null @@ -1,30 +0,0 @@ -from typing import Any, Callable, Dict, Generic, Iterable, Sequence, Tuple, Type, TypeVar, overload - -_AnyCallable = Callable[..., Any] - -_T = TypeVar("_T") -_S = TypeVar("_S") - -@overload -def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ... -@overload -def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... - -WRAPPER_ASSIGNMENTS: Sequence[str] -WRAPPER_UPDATES: Sequence[str] - -def update_wrapper( - wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... -) -> _AnyCallable: ... -def wraps( - wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... -) -> Callable[[_AnyCallable], _AnyCallable]: ... -def total_ordering(cls: Type[_T]) -> Type[_T]: ... -def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ... - -class partial(Generic[_T]): - func = ... # Callable[..., _T] - args: Tuple[Any, ...] - keywords: Dict[str, Any] - def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> _T: ... diff --git a/stdlib/@python2/future_builtins.pyi b/stdlib/@python2/future_builtins.pyi deleted file mode 100644 index 2a06c73..0000000 --- a/stdlib/@python2/future_builtins.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from itertools import ifilter, imap, izip -from typing import Any - -filter = ifilter -map = imap -zip = izip - -def ascii(obj: Any) -> str: ... -def hex(x: int) -> str: ... -def oct(x: int) -> str: ... diff --git a/stdlib/@python2/gc.pyi b/stdlib/@python2/gc.pyi deleted file mode 100644 index b1fb1ac..0000000 --- a/stdlib/@python2/gc.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from typing import Any, List, Tuple - -def enable() -> None: ... -def disable() -> None: ... -def isenabled() -> bool: ... -def collect(generation: int = ...) -> int: ... -def set_debug(flags: int) -> None: ... -def get_debug() -> int: ... -def get_objects() -> List[Any]: ... -def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ... -def get_count() -> Tuple[int, int, int]: ... -def get_threshold() -> Tuple[int, int, int]: ... -def get_referrers(*objs: Any) -> List[Any]: ... -def get_referents(*objs: Any) -> List[Any]: ... -def is_tracked(obj: Any) -> bool: ... - -garbage: List[Any] - -DEBUG_STATS: int -DEBUG_COLLECTABLE: int -DEBUG_UNCOLLECTABLE: int -DEBUG_INSTANCES: int -DEBUG_OBJECTS: int -DEBUG_SAVEALL: int -DEBUG_LEAK: int diff --git a/stdlib/@python2/genericpath.pyi b/stdlib/@python2/genericpath.pyi deleted file mode 100644 index ba29db4..0000000 --- a/stdlib/@python2/genericpath.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from _typeshed import SupportsLessThanT -from typing import List, Sequence, Text, Tuple, Union, overload -from typing_extensions import Literal - -# All overloads can return empty string. Ideally, Literal[""] would be a valid -# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return -# type. But because this only works when T is str, we need Sequence[T] instead. -@overload -def commonprefix(m: Sequence[str]) -> str | Literal[""]: ... # type: ignore -@overload -def commonprefix(m: Sequence[Text]) -> Text: ... # type: ignore -@overload -def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... -@overload -def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... -def exists(path: Text) -> bool: ... -def getsize(filename: Text) -> int: ... -def isfile(path: Text) -> bool: ... -def isdir(s: Text) -> bool: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: Text) -> float: ... -def getmtime(filename: Text) -> float: ... -def getctime(filename: Text) -> float: ... diff --git a/stdlib/@python2/getopt.pyi b/stdlib/@python2/getopt.pyi deleted file mode 100644 index 370d4d5..0000000 --- a/stdlib/@python2/getopt.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import List, Tuple - -class GetoptError(Exception): - opt: str - msg: str - def __init__(self, msg: str, opt: str = ...) -> None: ... - def __str__(self) -> str: ... - -error = GetoptError - -def getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ... -def gnu_getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ... diff --git a/stdlib/@python2/getpass.pyi b/stdlib/@python2/getpass.pyi deleted file mode 100644 index 784eb1a..0000000 --- a/stdlib/@python2/getpass.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import IO, Any - -class GetPassWarning(UserWarning): ... - -def getpass(prompt: str = ..., stream: IO[Any] = ...) -> str: ... -def getuser() -> str: ... diff --git a/stdlib/@python2/gettext.pyi b/stdlib/@python2/gettext.pyi deleted file mode 100644 index a91234f..0000000 --- a/stdlib/@python2/gettext.pyi +++ /dev/null @@ -1,48 +0,0 @@ -from typing import IO, Any, Container, Dict, List, Sequence, Type - -def bindtextdomain(domain: str, localedir: str = ...) -> str: ... -def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ... -def textdomain(domain: str = ...) -> str: ... -def gettext(message: str) -> str: ... -def lgettext(message: str) -> str: ... -def dgettext(domain: str, message: str) -> str: ... -def ldgettext(domain: str, message: str) -> str: ... -def ngettext(singular: str, plural: str, n: int) -> str: ... -def lngettext(singular: str, plural: str, n: int) -> str: ... -def dngettext(domain: str, singular: str, plural: str, n: int) -> str: ... -def ldngettext(domain: str, singular: str, plural: str, n: int) -> str: ... - -class NullTranslations(object): - def __init__(self, fp: IO[str] = ...) -> None: ... - def _parse(self, fp: IO[str]) -> None: ... - def add_fallback(self, fallback: NullTranslations) -> None: ... - def gettext(self, message: str) -> str: ... - def lgettext(self, message: str) -> str: ... - def ugettext(self, message: str | unicode) -> unicode: ... - def ngettext(self, singular: str, plural: str, n: int) -> str: ... - def lngettext(self, singular: str, plural: str, n: int) -> str: ... - def ungettext(self, singular: str | unicode, plural: str | unicode, n: int) -> unicode: ... - def info(self) -> Dict[str, str]: ... - def charset(self) -> str | None: ... - def output_charset(self) -> str | None: ... - def set_output_charset(self, charset: str | None) -> None: ... - def install(self, unicode: bool = ..., names: Container[str] = ...) -> None: ... - -class GNUTranslations(NullTranslations): - LE_MAGIC: int - BE_MAGIC: int - -def find( - domain: str, localedir: str | None = ..., languages: Sequence[str] | None = ..., all: Any = ... -) -> str | List[str] | None: ... -def translation( - domain: str, - localedir: str | None = ..., - languages: Sequence[str] | None = ..., - class_: Type[NullTranslations] | None = ..., - fallback: bool = ..., - codeset: str | None = ..., -) -> NullTranslations: ... -def install( - domain: str, localedir: str | None = ..., unicode: bool = ..., codeset: str | None = ..., names: Container[str] = ... -) -> None: ... diff --git a/stdlib/@python2/glob.pyi b/stdlib/@python2/glob.pyi deleted file mode 100644 index f5a389a..0000000 --- a/stdlib/@python2/glob.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import AnyStr, Iterator, List - -def glob(pathname: AnyStr) -> List[AnyStr]: ... -def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ... -def glob1(dirname: str | unicode, pattern: AnyStr) -> List[AnyStr]: ... -def glob0(dirname: str | unicode, basename: AnyStr) -> List[AnyStr]: ... -def has_magic(s: str | unicode) -> bool: ... # undocumented diff --git a/stdlib/@python2/grp.pyi b/stdlib/@python2/grp.pyi deleted file mode 100644 index 63898b2..0000000 --- a/stdlib/@python2/grp.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import List, NamedTuple - -class struct_group(NamedTuple): - gr_name: str - gr_passwd: str | None - gr_gid: int - gr_mem: List[str] - -def getgrall() -> List[struct_group]: ... -def getgrgid(id: int) -> struct_group: ... -def getgrnam(name: str) -> struct_group: ... diff --git a/stdlib/@python2/gzip.pyi b/stdlib/@python2/gzip.pyi deleted file mode 100644 index f5c5af9..0000000 --- a/stdlib/@python2/gzip.pyi +++ /dev/null @@ -1,38 +0,0 @@ -import io -from typing import IO, Any, Text - -class GzipFile(io.BufferedIOBase): - myfileobj: Any - max_read_chunk: Any - mode: Any - extrabuf: Any - extrasize: Any - extrastart: Any - name: Any - min_readsize: Any - compress: Any - fileobj: Any - offset: Any - mtime: Any - def __init__( - self, filename: str = ..., mode: Text = ..., compresslevel: int = ..., fileobj: IO[str] = ..., mtime: float = ... - ) -> None: ... - @property - def filename(self): ... - size: Any - crc: Any - def write(self, data): ... - def read(self, size=...): ... - @property - def closed(self): ... - def close(self): ... - def flush(self, zlib_mode=...): ... - def fileno(self): ... - def rewind(self): ... - def readable(self): ... - def writable(self): ... - def seekable(self): ... - def seek(self, offset, whence=...): ... - def readline(self, size=...): ... - -def open(filename: str, mode: Text = ..., compresslevel: int = ...) -> GzipFile: ... diff --git a/stdlib/@python2/hashlib.pyi b/stdlib/@python2/hashlib.pyi deleted file mode 100644 index 9c53d2b..0000000 --- a/stdlib/@python2/hashlib.pyi +++ /dev/null @@ -1,32 +0,0 @@ -from typing import Tuple, Union - -_DataType = Union[str, unicode, bytearray, buffer, memoryview] - -class _hash(object): # This is not actually in the module namespace. - @property - def name(self) -> str: ... - @property - def block_size(self) -> int: ... - @property - def digest_size(self) -> int: ... - @property - def digestsize(self) -> int: ... - def __init__(self, arg: _DataType = ...) -> None: ... - def update(self, arg: _DataType) -> None: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def copy(self) -> _hash: ... - -def new(name: str, data: str = ...) -> _hash: ... -def md5(s: _DataType = ...) -> _hash: ... -def sha1(s: _DataType = ...) -> _hash: ... -def sha224(s: _DataType = ...) -> _hash: ... -def sha256(s: _DataType = ...) -> _hash: ... -def sha384(s: _DataType = ...) -> _hash: ... -def sha512(s: _DataType = ...) -> _hash: ... - -algorithms: Tuple[str, ...] -algorithms_guaranteed: Tuple[str, ...] -algorithms_available: Tuple[str, ...] - -def pbkdf2_hmac(name: str, password: str, salt: str, rounds: int, dklen: int = ...) -> str: ... diff --git a/stdlib/@python2/heapq.pyi b/stdlib/@python2/heapq.pyi deleted file mode 100644 index 78ce6fd..0000000 --- a/stdlib/@python2/heapq.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from _typeshed import SupportsLessThan -from typing import Callable, Iterable, List, TypeVar - -_T = TypeVar("_T") - -def cmp_lt(x, y) -> bool: ... -def heappush(heap: List[_T], item: _T) -> None: ... -def heappop(heap: List[_T]) -> _T: ... -def heappushpop(heap: List[_T], item: _T) -> _T: ... -def heapify(x: List[_T]) -> None: ... -def heapreplace(heap: List[_T], item: _T) -> _T: ... -def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ... -def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> List[_T]: ... -def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> List[_T]: ... -def _heapify_max(__x: List[_T]) -> None: ... # undocumented diff --git a/stdlib/@python2/hmac.pyi b/stdlib/@python2/hmac.pyi deleted file mode 100644 index cc39d8c..0000000 --- a/stdlib/@python2/hmac.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from _typeshed import ReadableBuffer -from types import ModuleType -from typing import Any, AnyStr, Callable, Union, overload - -# TODO more precise type for object of hashlib -_Hash = Any -_DigestMod = Union[str, Callable[[], _Hash], ModuleType] - -digest_size: None - -def new(key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ... - -class HMAC: - def __init__(self, key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod = ...) -> None: ... - def update(self, msg: ReadableBuffer) -> None: ... - def digest(self) -> bytes: ... - def hexdigest(self) -> str: ... - def copy(self) -> HMAC: ... - -@overload -def compare_digest(__a: ReadableBuffer, __b: ReadableBuffer) -> bool: ... -@overload -def compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ... diff --git a/stdlib/@python2/htmlentitydefs.pyi b/stdlib/@python2/htmlentitydefs.pyi deleted file mode 100644 index 749b303..0000000 --- a/stdlib/@python2/htmlentitydefs.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import Dict - -name2codepoint: Dict[str, int] -codepoint2name: Dict[int, str] -entitydefs: Dict[str, str] diff --git a/stdlib/@python2/httplib.pyi b/stdlib/@python2/httplib.pyi deleted file mode 100644 index f216381..0000000 --- a/stdlib/@python2/httplib.pyi +++ /dev/null @@ -1,217 +0,0 @@ -import mimetools -from typing import Any, Dict, Protocol - -class HTTPMessage(mimetools.Message): - def addcontinue(self, key: str, more: str) -> None: ... - dict: Dict[str, str] - def addheader(self, key: str, value: str) -> None: ... - unixfrom: str - headers: Any - status: str - seekable: bool - def readheaders(self) -> None: ... - -class HTTPResponse: - fp: Any - debuglevel: Any - strict: Any - msg: Any - version: Any - status: Any - reason: Any - chunked: Any - chunk_left: Any - length: Any - will_close: Any - def __init__( - self, sock, debuglevel: int = ..., strict: int = ..., method: Any | None = ..., buffering: bool = ... - ) -> None: ... - def begin(self): ... - def close(self): ... - def isclosed(self): ... - def read(self, amt: Any | None = ...): ... - def fileno(self): ... - def getheader(self, name, default: Any | None = ...): ... - def getheaders(self): ... - -# This is an API stub only for HTTPConnection and HTTPSConnection, as used in -# urllib2.AbstractHTTPHandler.do_open, which takes either the class -# HTTPConnection or the class HTTPSConnection, *not* an instance of either -# class. do_open does not use all of the parameters of HTTPConnection.__init__ -# or HTTPSConnection.__init__, so HTTPConnectionProtocol only implements the -# parameters that do_open does use. -class HTTPConnectionProtocol(Protocol): - def __call__(self, host: str, timeout: int = ..., **http_con_args: Any) -> HTTPConnection: ... - -class HTTPConnection: - response_class: Any - default_port: Any - auto_open: Any - debuglevel: Any - strict: Any - timeout: Any - source_address: Any - sock: Any - host: str = ... - port: int = ... - def __init__( - self, host, port: Any | None = ..., strict: Any | None = ..., timeout=..., source_address: Any | None = ... - ) -> None: ... - def set_tunnel(self, host, port: Any | None = ..., headers: Any | None = ...): ... - def set_debuglevel(self, level): ... - def connect(self): ... - def close(self): ... - def send(self, data): ... - def putrequest(self, method, url, skip_host: int = ..., skip_accept_encoding: int = ...): ... - def putheader(self, header, *values): ... - def endheaders(self, message_body: Any | None = ...): ... - def request(self, method, url, body: Any | None = ..., headers=...): ... - def getresponse(self, buffering: bool = ...): ... - -class HTTP: - debuglevel: Any - def __init__(self, host: str = ..., port: Any | None = ..., strict: Any | None = ...) -> None: ... - def connect(self, host: Any | None = ..., port: Any | None = ...): ... - def getfile(self): ... - file: Any - headers: Any - def getreply(self, buffering: bool = ...): ... - def close(self): ... - -class HTTPSConnection(HTTPConnection): - default_port: Any - key_file: Any - cert_file: Any - def __init__( - self, - host, - port: Any | None = ..., - key_file: Any | None = ..., - cert_file: Any | None = ..., - strict: Any | None = ..., - timeout=..., - source_address: Any | None = ..., - context: Any | None = ..., - ) -> None: ... - sock: Any - def connect(self): ... - -class HTTPS(HTTP): - key_file: Any - cert_file: Any - def __init__( - self, - host: str = ..., - port: Any | None = ..., - key_file: Any | None = ..., - cert_file: Any | None = ..., - strict: Any | None = ..., - context: Any | None = ..., - ) -> None: ... - -class HTTPException(Exception): ... -class NotConnected(HTTPException): ... -class InvalidURL(HTTPException): ... - -class UnknownProtocol(HTTPException): - args: Any - version: Any - def __init__(self, version) -> None: ... - -class UnknownTransferEncoding(HTTPException): ... -class UnimplementedFileMode(HTTPException): ... - -class IncompleteRead(HTTPException): - args: Any - partial: Any - expected: Any - def __init__(self, partial, expected: Any | None = ...) -> None: ... - -class ImproperConnectionState(HTTPException): ... -class CannotSendRequest(ImproperConnectionState): ... -class CannotSendHeader(ImproperConnectionState): ... -class ResponseNotReady(ImproperConnectionState): ... - -class BadStatusLine(HTTPException): - args: Any - line: Any - def __init__(self, line) -> None: ... - -class LineTooLong(HTTPException): - def __init__(self, line_type) -> None: ... - -error: Any - -class LineAndFileWrapper: - def __init__(self, line, file) -> None: ... - def __getattr__(self, attr): ... - def read(self, amt: Any | None = ...): ... - def readline(self): ... - def readlines(self, size: Any | None = ...): ... - -# Constants - -responses: Dict[int, str] - -HTTP_PORT: int -HTTPS_PORT: int - -# status codes -# informational -CONTINUE: int -SWITCHING_PROTOCOLS: int -PROCESSING: int - -# successful -OK: int -CREATED: int -ACCEPTED: int -NON_AUTHORITATIVE_INFORMATION: int -NO_CONTENT: int -RESET_CONTENT: int -PARTIAL_CONTENT: int -MULTI_STATUS: int -IM_USED: int - -# redirection -MULTIPLE_CHOICES: int -MOVED_PERMANENTLY: int -FOUND: int -SEE_OTHER: int -NOT_MODIFIED: int -USE_PROXY: int -TEMPORARY_REDIRECT: int - -# client error -BAD_REQUEST: int -UNAUTHORIZED: int -PAYMENT_REQUIRED: int -FORBIDDEN: int -NOT_FOUND: int -METHOD_NOT_ALLOWED: int -NOT_ACCEPTABLE: int -PROXY_AUTHENTICATION_REQUIRED: int -REQUEST_TIMEOUT: int -CONFLICT: int -GONE: int -LENGTH_REQUIRED: int -PRECONDITION_FAILED: int -REQUEST_ENTITY_TOO_LARGE: int -REQUEST_URI_TOO_LONG: int -UNSUPPORTED_MEDIA_TYPE: int -REQUESTED_RANGE_NOT_SATISFIABLE: int -EXPECTATION_FAILED: int -UNPROCESSABLE_ENTITY: int -LOCKED: int -FAILED_DEPENDENCY: int -UPGRADE_REQUIRED: int - -# server error -INTERNAL_SERVER_ERROR: int -NOT_IMPLEMENTED: int -BAD_GATEWAY: int -SERVICE_UNAVAILABLE: int -GATEWAY_TIMEOUT: int -HTTP_VERSION_NOT_SUPPORTED: int -INSUFFICIENT_STORAGE: int -NOT_EXTENDED: int diff --git a/stdlib/@python2/imaplib.pyi b/stdlib/@python2/imaplib.pyi deleted file mode 100644 index c434685..0000000 --- a/stdlib/@python2/imaplib.pyi +++ /dev/null @@ -1,130 +0,0 @@ -import subprocess -import time -from socket import socket as _socket -from ssl import SSLSocket -from typing import IO, Any, Callable, Dict, List, Pattern, Text, Tuple, Type, Union -from typing_extensions import Literal - -# TODO: Commands should use their actual return types, not this type alias. -# E.g. Tuple[Literal["OK"], List[bytes]] -_CommandResults = Tuple[str, List[Any]] - -_AnyResponseData = Union[List[None], List[Union[bytes, Tuple[bytes, bytes]]]] - -class IMAP4: - error: Type[Exception] = ... - abort: Type[Exception] = ... - readonly: Type[Exception] = ... - mustquote: Pattern[Text] = ... - debug: int = ... - state: str = ... - literal: Text | None = ... - tagged_commands: Dict[bytes, List[bytes] | None] - untagged_responses: Dict[str, List[bytes | Tuple[bytes, bytes]]] - continuation_response: str = ... - is_readonly: bool = ... - tagnum: int = ... - tagpre: str = ... - tagre: Pattern[Text] = ... - welcome: bytes = ... - capabilities: Tuple[str] = ... - PROTOCOL_VERSION: str = ... - def __init__(self, host: str = ..., port: int = ...) -> None: ... - def open(self, host: str = ..., port: int = ...) -> None: ... - def __getattr__(self, attr: str) -> Any: ... - host: str = ... - port: int = ... - sock: _socket = ... - file: IO[Text] | IO[bytes] = ... - def read(self, size: int) -> bytes: ... - def readline(self) -> bytes: ... - def send(self, data: bytes) -> None: ... - def shutdown(self) -> None: ... - def socket(self) -> _socket: ... - def recent(self) -> _CommandResults: ... - def response(self, code: str) -> _CommandResults: ... - def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ... - def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> Tuple[str, str]: ... - def capability(self) -> _CommandResults: ... - def check(self) -> _CommandResults: ... - def close(self) -> _CommandResults: ... - def copy(self, message_set: str, new_mailbox: str) -> _CommandResults: ... - def create(self, mailbox: str) -> _CommandResults: ... - def delete(self, mailbox: str) -> _CommandResults: ... - def deleteacl(self, mailbox: str, who: str) -> _CommandResults: ... - def expunge(self) -> _CommandResults: ... - def fetch(self, message_set: str, message_parts: str) -> Tuple[str, _AnyResponseData]: ... - def getacl(self, mailbox: str) -> _CommandResults: ... - def getannotation(self, mailbox: str, entry: str, attribute: str) -> _CommandResults: ... - def getquota(self, root: str) -> _CommandResults: ... - def getquotaroot(self, mailbox: str) -> _CommandResults: ... - def list(self, directory: str = ..., pattern: str = ...) -> Tuple[str, _AnyResponseData]: ... - def login(self, user: str, password: str) -> Tuple[Literal["OK"], List[bytes]]: ... - def login_cram_md5(self, user: str, password: str) -> _CommandResults: ... - def logout(self) -> Tuple[str, _AnyResponseData]: ... - def lsub(self, directory: str = ..., pattern: str = ...) -> _CommandResults: ... - def myrights(self, mailbox: str) -> _CommandResults: ... - def namespace(self) -> _CommandResults: ... - def noop(self) -> Tuple[str, List[bytes]]: ... - def partial(self, message_num: str, message_part: str, start: str, length: str) -> _CommandResults: ... - def proxyauth(self, user: str) -> _CommandResults: ... - def rename(self, oldmailbox: str, newmailbox: str) -> _CommandResults: ... - def search(self, charset: str | None, *criteria: str) -> _CommandResults: ... - def select(self, mailbox: str = ..., readonly: bool = ...) -> Tuple[str, List[bytes | None]]: ... - def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ... - def setannotation(self, *args: str) -> _CommandResults: ... - def setquota(self, root: str, limits: str) -> _CommandResults: ... - def sort(self, sort_criteria: str, charset: str, *search_criteria: str) -> _CommandResults: ... - def status(self, mailbox: str, names: str) -> _CommandResults: ... - def store(self, message_set: str, command: str, flags: str) -> _CommandResults: ... - def subscribe(self, mailbox: str) -> _CommandResults: ... - def thread(self, threading_algorithm: str, charset: str, *search_criteria: str) -> _CommandResults: ... - def uid(self, command: str, *args: str) -> _CommandResults: ... - def unsubscribe(self, mailbox: str) -> _CommandResults: ... - def xatom(self, name: str, *args: str) -> _CommandResults: ... - def print_log(self) -> None: ... - -class IMAP4_SSL(IMAP4): - keyfile: str = ... - certfile: str = ... - def __init__(self, host: str = ..., port: int = ..., keyfile: str | None = ..., certfile: str | None = ...) -> None: ... - host: str = ... - port: int = ... - sock: _socket = ... - sslobj: SSLSocket = ... - file: IO[Any] = ... - def open(self, host: str = ..., port: int | None = ...) -> None: ... - def read(self, size: int) -> bytes: ... - def readline(self) -> bytes: ... - def send(self, data: bytes) -> None: ... - def shutdown(self) -> None: ... - def socket(self) -> _socket: ... - def ssl(self) -> SSLSocket: ... - -class IMAP4_stream(IMAP4): - command: str = ... - def __init__(self, command: str) -> None: ... - host: str = ... - port: int = ... - sock: _socket = ... - file: IO[Any] = ... - process: subprocess.Popen[bytes] = ... - writefile: IO[Any] = ... - readfile: IO[Any] = ... - def open(self, host: str | None = ..., port: int | None = ...) -> None: ... - def read(self, size: int) -> bytes: ... - def readline(self) -> bytes: ... - def send(self, data: bytes) -> None: ... - def shutdown(self) -> None: ... - -class _Authenticator: - mech: Callable[[bytes], bytes] = ... - def __init__(self, mechinst: Callable[[bytes], bytes]) -> None: ... - def process(self, data: str) -> str: ... - def encode(self, inp: bytes) -> str: ... - def decode(self, inp: str) -> bytes: ... - -def Internaldate2tuple(resp: str) -> time.struct_time: ... -def Int2AP(num: int) -> str: ... -def ParseFlags(resp: str) -> Tuple[str]: ... -def Time2Internaldate(date_time: float | time.struct_time | str) -> str: ... diff --git a/stdlib/@python2/imghdr.pyi b/stdlib/@python2/imghdr.pyi deleted file mode 100644 index d60cafa..0000000 --- a/stdlib/@python2/imghdr.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Any, BinaryIO, Callable, List, Protocol, Text, Union, overload - -class _ReadableBinary(Protocol): - def tell(self) -> int: ... - def read(self, size: int) -> bytes: ... - def seek(self, offset: int) -> Any: ... - -_File = Union[Text, _ReadableBinary] - -@overload -def what(file: _File, h: None = ...) -> str | None: ... -@overload -def what(file: Any, h: bytes) -> str | None: ... - -tests: List[Callable[[bytes, BinaryIO | None], str | None]] diff --git a/stdlib/@python2/imp.pyi b/stdlib/@python2/imp.pyi deleted file mode 100644 index 128bd90..0000000 --- a/stdlib/@python2/imp.pyi +++ /dev/null @@ -1,33 +0,0 @@ -import types -from typing import IO, Any, Iterable, List, Tuple - -C_BUILTIN: int -C_EXTENSION: int -IMP_HOOK: int -PKG_DIRECTORY: int -PY_CODERESOURCE: int -PY_COMPILED: int -PY_FROZEN: int -PY_RESOURCE: int -PY_SOURCE: int -SEARCH_ERROR: int - -def acquire_lock() -> None: ... -def find_module(name: str, path: Iterable[str] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]] | None: ... -def get_magic() -> str: ... -def get_suffixes() -> List[Tuple[str, str, int]]: ... -def init_builtin(name: str) -> types.ModuleType: ... -def init_frozen(name: str) -> types.ModuleType: ... -def is_builtin(name: str) -> int: ... -def is_frozen(name: str) -> bool: ... -def load_compiled(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ... -def load_dynamic(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ... -def load_module(name: str, file: str, pathname: str, description: Tuple[str, str, int]) -> types.ModuleType: ... -def load_source(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ... -def lock_held() -> bool: ... -def new_module(name: str) -> types.ModuleType: ... -def release_lock() -> None: ... - -class NullImporter: - def __init__(self, path_string: str) -> None: ... - def find_module(self, fullname: str, path: str = ...) -> None: ... diff --git a/stdlib/@python2/importlib.pyi b/stdlib/@python2/importlib.pyi deleted file mode 100644 index 530cb1a..0000000 --- a/stdlib/@python2/importlib.pyi +++ /dev/null @@ -1,4 +0,0 @@ -import types -from typing import Text - -def import_module(name: Text, package: Text | None = ...) -> types.ModuleType: ... diff --git a/stdlib/@python2/inspect.pyi b/stdlib/@python2/inspect.pyi deleted file mode 100644 index c6118ea..0000000 --- a/stdlib/@python2/inspect.pyi +++ /dev/null @@ -1,129 +0,0 @@ -from types import CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType -from typing import Any, AnyStr, Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, Union - -# Types and members -class EndOfBlock(Exception): ... - -class BlockFinder: - indent: int - islambda: bool - started: bool - passline: bool - last: int - def tokeneater( - self, type: int, token: AnyStr, srow_scol: Tuple[int, int], erow_ecol: Tuple[int, int], line: AnyStr - ) -> None: ... - -CO_GENERATOR: int -CO_NESTED: int -CO_NEWLOCALS: int -CO_NOFREE: int -CO_OPTIMIZED: int -CO_VARARGS: int -CO_VARKEYWORDS: int -TPFLAGS_IS_ABSTRACT: int - -class ModuleInfo(NamedTuple): - name: str - suffix: str - mode: str - module_type: int - -def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> List[Tuple[str, Any]]: ... -def getmoduleinfo(path: str | unicode) -> ModuleInfo | None: ... -def getmodulename(path: AnyStr) -> AnyStr | None: ... -def ismodule(object: object) -> bool: ... -def isclass(object: object) -> bool: ... -def ismethod(object: object) -> bool: ... -def isfunction(object: object) -> bool: ... -def isgeneratorfunction(object: object) -> bool: ... -def isgenerator(object: object) -> bool: ... -def istraceback(object: object) -> bool: ... -def isframe(object: object) -> bool: ... -def iscode(object: object) -> bool: ... -def isbuiltin(object: object) -> bool: ... -def isroutine(object: object) -> bool: ... -def isabstract(object: object) -> bool: ... -def ismethoddescriptor(object: object) -> bool: ... -def isdatadescriptor(object: object) -> bool: ... -def isgetsetdescriptor(object: object) -> bool: ... -def ismemberdescriptor(object: object) -> bool: ... - -# Retrieving source code -_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]] - -def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ... -def getabsfile(object: _SourceObjectType) -> str: ... -def getblock(lines: Sequence[AnyStr]) -> Sequence[AnyStr]: ... -def getdoc(object: object) -> str | None: ... -def getcomments(object: object) -> str | None: ... -def getfile(object: _SourceObjectType) -> str: ... -def getmodule(object: object) -> ModuleType | None: ... -def getsourcefile(object: _SourceObjectType) -> str | None: ... -def getsourcelines(object: _SourceObjectType) -> Tuple[List[str], int]: ... -def getsource(object: _SourceObjectType) -> str: ... -def cleandoc(doc: AnyStr) -> AnyStr: ... -def indentsize(line: str | unicode) -> int: ... - -# Classes and functions -def getclasstree(classes: List[type], unique: bool = ...) -> List[Tuple[type, Tuple[type, ...]] | List[Any]]: ... - -class ArgSpec(NamedTuple): - args: List[str] - varargs: str | None - keywords: str | None - defaults: Tuple[Any, ...] - -class ArgInfo(NamedTuple): - args: List[str] - varargs: str | None - keywords: str | None - locals: Dict[str, Any] - -class Arguments(NamedTuple): - args: List[str | List[Any]] - varargs: str | None - keywords: str | None - -def getargs(co: CodeType) -> Arguments: ... -def getargspec(func: object) -> ArgSpec: ... -def getargvalues(frame: FrameType) -> ArgInfo: ... -def formatargspec( - args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=... -) -> str: ... -def formatargvalues( - args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=... -) -> str: ... -def getmro(cls: type) -> Tuple[type, ...]: ... -def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ... - -# The interpreter stack - -class Traceback(NamedTuple): - filename: str - lineno: int - function: str - code_context: List[str] | None - index: int | None # type: ignore - -_FrameInfo = Tuple[FrameType, str, int, str, Optional[List[str]], Optional[int]] - -def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ... -def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ... -def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ... -def getlineno(frame: FrameType) -> int: ... -def currentframe(depth: int = ...) -> FrameType: ... -def stack(context: int = ...) -> List[_FrameInfo]: ... -def trace(context: int = ...) -> List[_FrameInfo]: ... - -# Create private type alias to avoid conflict with symbol of same -# name created in Attribute class. -_Object = object - -class Attribute(NamedTuple): - name: str - kind: str - defining_class: type - object: _Object - -def classify_class_attrs(cls: type) -> List[Attribute]: ... diff --git a/stdlib/@python2/io.pyi b/stdlib/@python2/io.pyi deleted file mode 100644 index f36138e..0000000 --- a/stdlib/@python2/io.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from typing import IO, Any - -import _io -from _io import ( - DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE, - BlockingIOError as BlockingIOError, - BufferedRandom as BufferedRandom, - BufferedReader as BufferedReader, - BufferedRWPair as BufferedRWPair, - BufferedWriter as BufferedWriter, - BytesIO as BytesIO, - FileIO as FileIO, - IncrementalNewlineDecoder as IncrementalNewlineDecoder, - StringIO as StringIO, - TextIOWrapper as TextIOWrapper, - UnsupportedOperation as UnsupportedOperation, - open as open, -) - -def _OpenWrapper( - file: str | unicode | int, - mode: unicode = ..., - buffering: int = ..., - encoding: unicode = ..., - errors: unicode = ..., - newline: unicode = ..., - closefd: bool = ..., -) -> IO[Any]: ... - -SEEK_SET: int -SEEK_CUR: int -SEEK_END: int - -class IOBase(_io._IOBase): ... -class RawIOBase(_io._RawIOBase, IOBase): ... -class BufferedIOBase(_io._BufferedIOBase, IOBase): ... - -# Note: In the actual io.py, TextIOBase subclasses IOBase. -# (Which we don't do here because we don't want to subclass both TextIO and BinaryIO.) -class TextIOBase(_io._TextIOBase): ... diff --git a/stdlib/@python2/itertools.pyi b/stdlib/@python2/itertools.pyi deleted file mode 100644 index 12996d4..0000000 --- a/stdlib/@python2/itertools.pyi +++ /dev/null @@ -1,165 +0,0 @@ -from typing import Any, Callable, Generic, Iterable, Iterator, Sequence, Tuple, TypeVar, overload - -_T = TypeVar("_T") -_S = TypeVar("_S") - -def count(start: int = ..., step: int = ...) -> Iterator[int]: ... # more general types? - -class cycle(Iterator[_T], Generic[_T]): - def __init__(self, iterable: Iterable[_T]) -> None: ... - def next(self) -> _T: ... - def __iter__(self) -> Iterator[_T]: ... - -def repeat(object: _T, times: int = ...) -> Iterator[_T]: ... - -class chain(Iterator[_T], Generic[_T]): - def __init__(self, *iterables: Iterable[_T]) -> None: ... - def next(self) -> _T: ... - def __iter__(self) -> Iterator[_T]: ... - @staticmethod - def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ... - -def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ... -def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... -def ifilter(predicate: Callable[[_T], Any] | None, iterable: Iterable[_T]) -> Iterator[_T]: ... -def ifilterfalse(predicate: Callable[[_T], Any] | None, iterable: Iterable[_T]) -> Iterator[_T]: ... -@overload -def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ... -@overload -def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... -@overload -def islice(iterable: Iterable[_T], stop: int | None) -> Iterator[_T]: ... -@overload -def islice(iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ...) -> Iterator[_T]: ... - -_T1 = TypeVar("_T1") -_T2 = TypeVar("_T2") -_T3 = TypeVar("_T3") -_T4 = TypeVar("_T4") -_T5 = TypeVar("_T5") -_T6 = TypeVar("_T6") - -@overload -def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ... -@overload -def imap(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[_S]: ... -@overload -def imap( - func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3] -) -> Iterator[_S]: ... -@overload -def imap( - func: Callable[[_T1, _T2, _T3, _T4], _S], - iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], -) -> Iterator[_S]: ... -@overload -def imap( - func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5], -) -> Iterator[_S]: ... -@overload -def imap( - func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S], - iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5], - iter6: Iterable[_T6], -) -> Iterator[_S]: ... -@overload -def imap( - func: Callable[..., _S], - iter1: Iterable[Any], - iter2: Iterable[Any], - iter3: Iterable[Any], - iter4: Iterable[Any], - iter5: Iterable[Any], - iter6: Iterable[Any], - iter7: Iterable[Any], - *iterables: Iterable[Any], -) -> Iterator[_S]: ... -def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ... -def takewhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... -def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ... -@overload -def izip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... -@overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... -@overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... -@overload -def izip( - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def izip( - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def izip( - iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5], - iter6: Iterable[_T6], -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... -@overload -def izip( - iter1: Iterable[Any], - iter2: Iterable[Any], - iter3: Iterable[Any], - iter4: Iterable[Any], - iter5: Iterable[Any], - iter6: Iterable[Any], - iter7: Iterable[Any], - *iterables: Iterable[Any], -) -> Iterator[Tuple[Any, ...]]: ... -def izip_longest(*p: Iterable[Any], fillvalue: Any = ...) -> Iterator[Any]: ... -@overload -def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... -@overload -def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... -@overload -def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... -@overload -def product( - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def product( - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def product( - iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5], - iter6: Iterable[_T6], -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... -@overload -def product( - iter1: Iterable[Any], - iter2: Iterable[Any], - iter3: Iterable[Any], - iter4: Iterable[Any], - iter5: Iterable[Any], - iter6: Iterable[Any], - iter7: Iterable[Any], - *iterables: Iterable[Any], -) -> Iterator[Tuple[Any, ...]]: ... -@overload -def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ... -def permutations(iterable: Iterable[_T], r: int = ...) -> Iterator[Sequence[_T]]: ... -def combinations(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ... -def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ... diff --git a/stdlib/@python2/json.pyi b/stdlib/@python2/json.pyi deleted file mode 100644 index bfbddb2..0000000 --- a/stdlib/@python2/json.pyi +++ /dev/null @@ -1,93 +0,0 @@ -from _typeshed import SupportsRead -from typing import IO, Any, Callable, Dict, List, Text, Tuple, Type - -def dumps( - obj: Any, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: Type[JSONEncoder] | None = ..., - indent: int | None = ..., - separators: Tuple[str, str] | None = ..., - encoding: str = ..., - default: Callable[[Any], Any] | None = ..., - sort_keys: bool = ..., - **kwds: Any, -) -> str: ... -def dump( - obj: Any, - fp: IO[str] | IO[Text], - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: Type[JSONEncoder] | None = ..., - indent: int | None = ..., - separators: Tuple[str, str] | None = ..., - encoding: str = ..., - default: Callable[[Any], Any] | None = ..., - sort_keys: bool = ..., - **kwds: Any, -) -> None: ... -def loads( - s: Text | bytes, - encoding: Any = ..., - cls: Type[JSONDecoder] | None = ..., - object_hook: Callable[[Dict[Any, Any]], Any] | None = ..., - parse_float: Callable[[str], Any] | None = ..., - parse_int: Callable[[str], Any] | None = ..., - parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ..., - **kwds: Any, -) -> Any: ... -def load( - fp: SupportsRead[Text | bytes], - encoding: str | None = ..., - cls: Type[JSONDecoder] | None = ..., - object_hook: Callable[[Dict[Any, Any]], Any] | None = ..., - parse_float: Callable[[str], Any] | None = ..., - parse_int: Callable[[str], Any] | None = ..., - parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ..., - **kwds: Any, -) -> Any: ... - -class JSONDecoder(object): - def __init__( - self, - encoding: Text | bytes = ..., - object_hook: Callable[..., Any] = ..., - parse_float: Callable[[str], float] = ..., - parse_int: Callable[[str], int] = ..., - parse_constant: Callable[[str], Any] = ..., - strict: bool = ..., - object_pairs_hook: Callable[..., Any] = ..., - ) -> None: ... - def decode(self, s: Text | bytes, _w: Any = ...) -> Any: ... - def raw_decode(self, s: Text | bytes, idx: int = ...) -> Tuple[Any, Any]: ... - -class JSONEncoder(object): - item_separator: str - key_separator: str - skipkeys: bool - ensure_ascii: bool - check_circular: bool - allow_nan: bool - sort_keys: bool - indent: int | None - def __init__( - self, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - sort_keys: bool = ..., - indent: int | None = ..., - separators: Tuple[Text | bytes, Text | bytes] = ..., - encoding: Text | bytes = ..., - default: Callable[..., Any] = ..., - ) -> None: ... - def default(self, o: Any) -> Any: ... - def encode(self, o: Any) -> str: ... - def iterencode(self, o: Any, _one_shot: bool = ...) -> str: ... diff --git a/stdlib/@python2/keyword.pyi b/stdlib/@python2/keyword.pyi deleted file mode 100644 index e84ea1c..0000000 --- a/stdlib/@python2/keyword.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import Sequence, Text - -def iskeyword(s: Text) -> bool: ... - -kwlist: Sequence[str] diff --git a/stdlib/@python2/lib2to3/pgen2/driver.pyi b/stdlib/@python2/lib2to3/pgen2/driver.pyi deleted file mode 100644 index f36e3dd..0000000 --- a/stdlib/@python2/lib2to3/pgen2/driver.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from _typeshed import StrPath -from lib2to3.pgen2.grammar import Grammar -from lib2to3.pytree import _NL, _Convert -from logging import Logger -from typing import IO, Any, Iterable, Text - -class Driver: - grammar: Grammar - logger: Logger - convert: _Convert - def __init__(self, grammar: Grammar, convert: _Convert | None = ..., logger: Logger | None = ...) -> None: ... - def parse_tokens(self, tokens: Iterable[Any], debug: bool = ...) -> _NL: ... - def parse_stream_raw(self, stream: IO[Text], debug: bool = ...) -> _NL: ... - def parse_stream(self, stream: IO[Text], debug: bool = ...) -> _NL: ... - def parse_file(self, filename: StrPath, encoding: Text | None = ..., debug: bool = ...) -> _NL: ... - def parse_string(self, text: Text, debug: bool = ...) -> _NL: ... - -def load_grammar( - gt: Text = ..., gp: Text | None = ..., save: bool = ..., force: bool = ..., logger: Logger | None = ... -) -> Grammar: ... diff --git a/stdlib/@python2/lib2to3/pgen2/grammar.pyi b/stdlib/@python2/lib2to3/pgen2/grammar.pyi deleted file mode 100644 index 6ec97ce..0000000 --- a/stdlib/@python2/lib2to3/pgen2/grammar.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from _typeshed import StrPath -from typing import Dict, List, Optional, Text, Tuple, TypeVar - -_P = TypeVar("_P") -_Label = Tuple[int, Optional[Text]] -_DFA = List[List[Tuple[int, int]]] -_DFAS = Tuple[_DFA, Dict[int, int]] - -class Grammar: - symbol2number: Dict[Text, int] - number2symbol: Dict[int, Text] - states: List[_DFA] - dfas: Dict[int, _DFAS] - labels: List[_Label] - keywords: Dict[Text, int] - tokens: Dict[int, int] - symbol2label: Dict[Text, int] - start: int - def __init__(self) -> None: ... - def dump(self, filename: StrPath) -> None: ... - def load(self, filename: StrPath) -> None: ... - def copy(self: _P) -> _P: ... - def report(self) -> None: ... - -opmap_raw: Text -opmap: Dict[Text, Text] diff --git a/stdlib/@python2/lib2to3/pgen2/literals.pyi b/stdlib/@python2/lib2to3/pgen2/literals.pyi deleted file mode 100644 index 160d6fd..0000000 --- a/stdlib/@python2/lib2to3/pgen2/literals.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Dict, Match, Text - -simple_escapes: Dict[Text, Text] - -def escape(m: Match[str]) -> Text: ... -def evalString(s: Text) -> Text: ... -def test() -> None: ... diff --git a/stdlib/@python2/lib2to3/pgen2/parse.pyi b/stdlib/@python2/lib2to3/pgen2/parse.pyi deleted file mode 100644 index eed165d..0000000 --- a/stdlib/@python2/lib2to3/pgen2/parse.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from lib2to3.pgen2.grammar import _DFAS, Grammar -from lib2to3.pytree import _NL, _Convert, _RawNode -from typing import Any, List, Sequence, Set, Text, Tuple - -_Context = Sequence[Any] - -class ParseError(Exception): - msg: Text - type: int - value: Text | None - context: _Context - def __init__(self, msg: Text, type: int, value: Text | None, context: _Context) -> None: ... - -class Parser: - grammar: Grammar - convert: _Convert - stack: List[Tuple[_DFAS, int, _RawNode]] - rootnode: _NL | None - used_names: Set[Text] - def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ... - def setup(self, start: int | None = ...) -> None: ... - def addtoken(self, type: int, value: Text | None, context: _Context) -> bool: ... - def classify(self, type: int, value: Text | None, context: _Context) -> int: ... - def shift(self, type: int, value: Text | None, newstate: int, context: _Context) -> None: ... - def push(self, type: int, newdfa: _DFAS, newstate: int, context: _Context) -> None: ... - def pop(self) -> None: ... diff --git a/stdlib/@python2/lib2to3/pgen2/pgen.pyi b/stdlib/@python2/lib2to3/pgen2/pgen.pyi deleted file mode 100644 index 67dbbcc..0000000 --- a/stdlib/@python2/lib2to3/pgen2/pgen.pyi +++ /dev/null @@ -1,46 +0,0 @@ -from _typeshed import StrPath -from lib2to3.pgen2 import grammar -from lib2to3.pgen2.tokenize import _TokenInfo -from typing import IO, Any, Dict, Iterable, Iterator, List, NoReturn, Text, Tuple - -class PgenGrammar(grammar.Grammar): ... - -class ParserGenerator: - filename: StrPath - stream: IO[Text] - generator: Iterator[_TokenInfo] - first: Dict[Text, Dict[Text, int]] - def __init__(self, filename: StrPath, stream: IO[Text] | None = ...) -> None: ... - def make_grammar(self) -> PgenGrammar: ... - def make_first(self, c: PgenGrammar, name: Text) -> Dict[int, int]: ... - def make_label(self, c: PgenGrammar, label: Text) -> int: ... - def addfirstsets(self) -> None: ... - def calcfirst(self, name: Text) -> None: ... - def parse(self) -> Tuple[Dict[Text, List[DFAState]], Text]: ... - def make_dfa(self, start: NFAState, finish: NFAState) -> List[DFAState]: ... - def dump_nfa(self, name: Text, start: NFAState, finish: NFAState) -> List[DFAState]: ... - def dump_dfa(self, name: Text, dfa: Iterable[DFAState]) -> None: ... - def simplify_dfa(self, dfa: List[DFAState]) -> None: ... - def parse_rhs(self) -> Tuple[NFAState, NFAState]: ... - def parse_alt(self) -> Tuple[NFAState, NFAState]: ... - def parse_item(self) -> Tuple[NFAState, NFAState]: ... - def parse_atom(self) -> Tuple[NFAState, NFAState]: ... - def expect(self, type: int, value: Any | None = ...) -> Text: ... - def gettoken(self) -> None: ... - def raise_error(self, msg: str, *args: Any) -> NoReturn: ... - -class NFAState: - arcs: List[Tuple[Text | None, NFAState]] - def __init__(self) -> None: ... - def addarc(self, next: NFAState, label: Text | None = ...) -> None: ... - -class DFAState: - nfaset: Dict[NFAState, Any] - isfinal: bool - arcs: Dict[Text, DFAState] - def __init__(self, nfaset: Dict[NFAState, Any], final: NFAState) -> None: ... - def addarc(self, next: DFAState, label: Text) -> None: ... - def unifystate(self, old: DFAState, new: DFAState) -> None: ... - def __eq__(self, other: Any) -> bool: ... - -def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ... diff --git a/stdlib/@python2/lib2to3/pgen2/token.pyi b/stdlib/@python2/lib2to3/pgen2/token.pyi deleted file mode 100644 index 3f4e41d..0000000 --- a/stdlib/@python2/lib2to3/pgen2/token.pyi +++ /dev/null @@ -1,63 +0,0 @@ -from typing import Dict, Text - -ENDMARKER: int -NAME: int -NUMBER: int -STRING: int -NEWLINE: int -INDENT: int -DEDENT: int -LPAR: int -RPAR: int -LSQB: int -RSQB: int -COLON: int -COMMA: int -SEMI: int -PLUS: int -MINUS: int -STAR: int -SLASH: int -VBAR: int -AMPER: int -LESS: int -GREATER: int -EQUAL: int -DOT: int -PERCENT: int -BACKQUOTE: int -LBRACE: int -RBRACE: int -EQEQUAL: int -NOTEQUAL: int -LESSEQUAL: int -GREATEREQUAL: int -TILDE: int -CIRCUMFLEX: int -LEFTSHIFT: int -RIGHTSHIFT: int -DOUBLESTAR: int -PLUSEQUAL: int -MINEQUAL: int -STAREQUAL: int -SLASHEQUAL: int -PERCENTEQUAL: int -AMPEREQUAL: int -VBAREQUAL: int -CIRCUMFLEXEQUAL: int -LEFTSHIFTEQUAL: int -RIGHTSHIFTEQUAL: int -DOUBLESTAREQUAL: int -DOUBLESLASH: int -DOUBLESLASHEQUAL: int -OP: int -COMMENT: int -NL: int -ERRORTOKEN: int -N_TOKENS: int -NT_OFFSET: int -tok_name: Dict[int, Text] - -def ISTERMINAL(x: int) -> bool: ... -def ISNONTERMINAL(x: int) -> bool: ... -def ISEOF(x: int) -> bool: ... diff --git a/stdlib/@python2/lib2to3/pgen2/tokenize.pyi b/stdlib/@python2/lib2to3/pgen2/tokenize.pyi deleted file mode 100644 index 477341c..0000000 --- a/stdlib/@python2/lib2to3/pgen2/tokenize.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from lib2to3.pgen2.token import * # noqa -from typing import Callable, Iterable, Iterator, List, Text, Tuple - -_Coord = Tuple[int, int] -_TokenEater = Callable[[int, Text, _Coord, _Coord, Text], None] -_TokenInfo = Tuple[int, Text, _Coord, _Coord, Text] - -class TokenError(Exception): ... -class StopTokenizing(Exception): ... - -def tokenize(readline: Callable[[], Text], tokeneater: _TokenEater = ...) -> None: ... - -class Untokenizer: - tokens: List[Text] - prev_row: int - prev_col: int - def __init__(self) -> None: ... - def add_whitespace(self, start: _Coord) -> None: ... - def untokenize(self, iterable: Iterable[_TokenInfo]) -> Text: ... - def compat(self, token: Tuple[int, Text], iterable: Iterable[_TokenInfo]) -> None: ... - -def untokenize(iterable: Iterable[_TokenInfo]) -> Text: ... -def generate_tokens(readline: Callable[[], Text]) -> Iterator[_TokenInfo]: ... diff --git a/stdlib/@python2/lib2to3/pygram.pyi b/stdlib/@python2/lib2to3/pygram.pyi deleted file mode 100644 index bf96a55..0000000 --- a/stdlib/@python2/lib2to3/pygram.pyi +++ /dev/null @@ -1,113 +0,0 @@ -from lib2to3.pgen2.grammar import Grammar - -class Symbols: - def __init__(self, grammar: Grammar) -> None: ... - -class python_symbols(Symbols): - and_expr: int - and_test: int - annassign: int - arglist: int - argument: int - arith_expr: int - assert_stmt: int - async_funcdef: int - async_stmt: int - atom: int - augassign: int - break_stmt: int - classdef: int - comp_for: int - comp_if: int - comp_iter: int - comp_op: int - comparison: int - compound_stmt: int - continue_stmt: int - decorated: int - decorator: int - decorators: int - del_stmt: int - dictsetmaker: int - dotted_as_name: int - dotted_as_names: int - dotted_name: int - encoding_decl: int - eval_input: int - except_clause: int - exec_stmt: int - expr: int - expr_stmt: int - exprlist: int - factor: int - file_input: int - flow_stmt: int - for_stmt: int - funcdef: int - global_stmt: int - if_stmt: int - import_as_name: int - import_as_names: int - import_from: int - import_name: int - import_stmt: int - lambdef: int - listmaker: int - not_test: int - old_lambdef: int - old_test: int - or_test: int - parameters: int - pass_stmt: int - power: int - print_stmt: int - raise_stmt: int - return_stmt: int - shift_expr: int - simple_stmt: int - single_input: int - sliceop: int - small_stmt: int - star_expr: int - stmt: int - subscript: int - subscriptlist: int - suite: int - term: int - test: int - testlist: int - testlist1: int - testlist_gexp: int - testlist_safe: int - testlist_star_expr: int - tfpdef: int - tfplist: int - tname: int - trailer: int - try_stmt: int - typedargslist: int - varargslist: int - vfpdef: int - vfplist: int - vname: int - while_stmt: int - with_item: int - with_stmt: int - with_var: int - xor_expr: int - yield_arg: int - yield_expr: int - yield_stmt: int - -class pattern_symbols(Symbols): - Alternative: int - Alternatives: int - Details: int - Matcher: int - NegatedUnit: int - Repeater: int - Unit: int - -python_grammar: Grammar -python_grammar_no_print_statement: Grammar -pattern_grammar: Grammar diff --git a/stdlib/@python2/lib2to3/pytree.pyi b/stdlib/@python2/lib2to3/pytree.pyi deleted file mode 100644 index 27c6485..0000000 --- a/stdlib/@python2/lib2to3/pytree.pyi +++ /dev/null @@ -1,90 +0,0 @@ -from lib2to3.pgen2.grammar import Grammar -from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union - -_P = TypeVar("_P") -_NL = Union[Node, Leaf] -_Context = Tuple[Text, int, int] -_Results = Dict[Text, _NL] -_RawNode = Tuple[int, Text, _Context, Optional[List[_NL]]] -_Convert = Callable[[Grammar, _RawNode], Any] - -HUGE: int - -def type_repr(type_num: int) -> Text: ... - -class Base: - type: int - parent: Node | None - prefix: Text - children: List[_NL] - was_changed: bool - was_checked: bool - def __eq__(self, other: Any) -> bool: ... - def _eq(self: _P, other: _P) -> bool: ... - def clone(self: _P) -> _P: ... - def post_order(self) -> Iterator[_NL]: ... - def pre_order(self) -> Iterator[_NL]: ... - def replace(self, new: _NL | List[_NL]) -> None: ... - def get_lineno(self) -> int: ... - def changed(self) -> None: ... - def remove(self) -> int | None: ... - @property - def next_sibling(self) -> _NL | None: ... - @property - def prev_sibling(self) -> _NL | None: ... - def leaves(self) -> Iterator[Leaf]: ... - def depth(self) -> int: ... - def get_suffix(self) -> Text: ... - def get_prefix(self) -> Text: ... - def set_prefix(self, prefix: Text) -> None: ... - -class Node(Base): - fixers_applied: List[Any] - def __init__( - self, - type: int, - children: List[_NL], - context: Any | None = ..., - prefix: Text | None = ..., - fixers_applied: List[Any] | None = ..., - ) -> None: ... - def set_child(self, i: int, child: _NL) -> None: ... - def insert_child(self, i: int, child: _NL) -> None: ... - def append_child(self, child: _NL) -> None: ... - -class Leaf(Base): - lineno: int - column: int - value: Text - fixers_applied: List[Any] - def __init__( - self, type: int, value: Text, context: _Context | None = ..., prefix: Text | None = ..., fixers_applied: List[Any] = ... - ) -> None: ... - -def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ... - -class BasePattern: - type: int - content: Text | None - name: Text | None - def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns - def match(self, node: _NL, results: _Results | None = ...) -> bool: ... - def match_seq(self, nodes: List[_NL], results: _Results | None = ...) -> bool: ... - def generate_matches(self, nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ... - -class LeafPattern(BasePattern): - def __init__(self, type: int | None = ..., content: Text | None = ..., name: Text | None = ...) -> None: ... - -class NodePattern(BasePattern): - wildcards: bool - def __init__(self, type: int | None = ..., content: Text | None = ..., name: Text | None = ...) -> None: ... - -class WildcardPattern(BasePattern): - min: int - max: int - def __init__(self, content: Text | None = ..., min: int = ..., max: int = ..., name: Text | None = ...) -> None: ... - -class NegatedPattern(BasePattern): - def __init__(self, content: Text | None = ...) -> None: ... - -def generate_matches(patterns: List[BasePattern], nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ... diff --git a/stdlib/@python2/linecache.pyi b/stdlib/@python2/linecache.pyi deleted file mode 100644 index 8628a0c..0000000 --- a/stdlib/@python2/linecache.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from typing import Any, Dict, List, Text - -_ModuleGlobals = Dict[str, Any] - -def getline(filename: Text, lineno: int, module_globals: _ModuleGlobals | None = ...) -> str: ... -def clearcache() -> None: ... -def getlines(filename: Text, module_globals: _ModuleGlobals | None = ...) -> List[str]: ... -def checkcache(filename: Text | None = ...) -> None: ... -def updatecache(filename: Text, module_globals: _ModuleGlobals | None = ...) -> List[str]: ... diff --git a/stdlib/@python2/locale.pyi b/stdlib/@python2/locale.pyi deleted file mode 100644 index 21a7da1..0000000 --- a/stdlib/@python2/locale.pyi +++ /dev/null @@ -1,96 +0,0 @@ -# workaround for mypy#2010 -from __builtin__ import str as _str -from decimal import Decimal -from typing import Any, Callable, Dict, Iterable, List, Mapping, Sequence, Tuple - -CODESET: int -D_T_FMT: int -D_FMT: int -T_FMT: int -T_FMT_AMPM: int - -DAY_1: int -DAY_2: int -DAY_3: int -DAY_4: int -DAY_5: int -DAY_6: int -DAY_7: int -ABDAY_1: int -ABDAY_2: int -ABDAY_3: int -ABDAY_4: int -ABDAY_5: int -ABDAY_6: int -ABDAY_7: int - -MON_1: int -MON_2: int -MON_3: int -MON_4: int -MON_5: int -MON_6: int -MON_7: int -MON_8: int -MON_9: int -MON_10: int -MON_11: int -MON_12: int -ABMON_1: int -ABMON_2: int -ABMON_3: int -ABMON_4: int -ABMON_5: int -ABMON_6: int -ABMON_7: int -ABMON_8: int -ABMON_9: int -ABMON_10: int -ABMON_11: int -ABMON_12: int - -RADIXCHAR: int -THOUSEP: int -YESEXPR: int -NOEXPR: int -CRNCYSTR: int - -ERA: int -ERA_D_T_FMT: int -ERA_D_FMT: int -ERA_T_FMT: int - -ALT_DIGITS: int - -LC_CTYPE: int -LC_COLLATE: int -LC_TIME: int -LC_MONETARY: int -LC_MESSAGES: int -LC_NUMERIC: int -LC_ALL: int - -CHAR_MAX: int - -class Error(Exception): ... - -def setlocale(category: int, locale: _str | Iterable[_str] | None = ...) -> _str: ... -def localeconv() -> Mapping[_str, int | _str | List[int]]: ... -def nl_langinfo(__key: int) -> _str: ... -def getdefaultlocale(envvars: Tuple[_str, ...] = ...) -> Tuple[_str | None, _str | None]: ... -def getlocale(category: int = ...) -> Sequence[_str]: ... -def getpreferredencoding(do_setlocale: bool = ...) -> _str: ... -def normalize(localename: _str) -> _str: ... -def resetlocale(category: int = ...) -> None: ... -def strcoll(string1: _str, string2: _str) -> int: ... -def strxfrm(string: _str) -> _str: ... -def format(percent: _str, value: float | Decimal, grouping: bool = ..., monetary: bool = ..., *additional: Any) -> _str: ... -def format_string(f: _str, val: Any, grouping: bool = ...) -> _str: ... -def currency(val: int | float | Decimal, symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ... -def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ... -def atoi(string: _str) -> int: ... -def str(val: float) -> _str: ... - -locale_alias: Dict[_str, _str] # undocumented -locale_encoding_alias: Dict[_str, _str] # undocumented -windows_locale: Dict[int, _str] # undocumented diff --git a/stdlib/@python2/logging/__init__.pyi b/stdlib/@python2/logging/__init__.pyi deleted file mode 100644 index 9cca9b5..0000000 --- a/stdlib/@python2/logging/__init__.pyi +++ /dev/null @@ -1,255 +0,0 @@ -import threading -from _typeshed import StrPath -from time import struct_time -from types import FrameType, TracebackType -from typing import IO, Any, Callable, Dict, List, Mapping, MutableMapping, Optional, Sequence, Text, Tuple, Union, overload - -_SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], Tuple[None, None, None]] -_ExcInfoType = Union[None, bool, _SysExcInfoType] -_ArgsType = Union[Tuple[Any, ...], Mapping[str, Any]] -_FilterType = Union[Filter, Callable[[LogRecord], int]] -_Level = Union[int, Text] - -raiseExceptions: bool -logThreads: bool -logMultiprocessing: bool -logProcesses: bool -_srcfile: str | None - -def currentframe() -> FrameType: ... - -_levelNames: Dict[int | str, str | int] # Union[int:str, str:int] - -class Filterer(object): - filters: List[Filter] - def __init__(self) -> None: ... - def addFilter(self, filter: _FilterType) -> None: ... - def removeFilter(self, filter: _FilterType) -> None: ... - def filter(self, record: LogRecord) -> bool: ... - -class Logger(Filterer): - name: str - level: int - parent: Logger | PlaceHolder - propagate: bool - handlers: List[Handler] - disabled: int - def __init__(self, name: str, level: _Level = ...) -> None: ... - def setLevel(self, level: _Level) -> None: ... - def isEnabledFor(self, level: int) -> bool: ... - def getEffectiveLevel(self) -> int: ... - def getChild(self, suffix: str) -> Logger: ... - def debug( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def info( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def warning( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - warn = warning - def error( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def critical( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - fatal = critical - def log( - self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def exception( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def _log( - self, level: int, msg: Any, args: _ArgsType, exc_info: _ExcInfoType | None = ..., extra: Dict[str, Any] | None = ... - ) -> None: ... # undocumented - def filter(self, record: LogRecord) -> bool: ... - def addHandler(self, hdlr: Handler) -> None: ... - def removeHandler(self, hdlr: Handler) -> None: ... - def findCaller(self) -> Tuple[str, int, str]: ... - def handle(self, record: LogRecord) -> None: ... - def makeRecord( - self, - name: str, - level: int, - fn: str, - lno: int, - msg: Any, - args: _ArgsType, - exc_info: _SysExcInfoType | None, - func: str | None = ..., - extra: Mapping[str, Any] | None = ..., - ) -> LogRecord: ... - -CRITICAL: int -FATAL: int -ERROR: int -WARNING: int -WARN: int -INFO: int -DEBUG: int -NOTSET: int - -class Handler(Filterer): - level: int # undocumented - formatter: Formatter | None # undocumented - lock: threading.Lock | None # undocumented - name: str | None # undocumented - def __init__(self, level: _Level = ...) -> None: ... - def createLock(self) -> None: ... - def acquire(self) -> None: ... - def release(self) -> None: ... - def setLevel(self, level: _Level) -> None: ... - def setFormatter(self, fmt: Formatter) -> None: ... - def filter(self, record: LogRecord) -> bool: ... - def flush(self) -> None: ... - def close(self) -> None: ... - def handle(self, record: LogRecord) -> None: ... - def handleError(self, record: LogRecord) -> None: ... - def format(self, record: LogRecord) -> str: ... - def emit(self, record: LogRecord) -> None: ... - -class Formatter: - converter: Callable[[float | None], struct_time] - _fmt: str | None - datefmt: str | None - def __init__(self, fmt: str | None = ..., datefmt: str | None = ...) -> None: ... - def format(self, record: LogRecord) -> str: ... - def formatTime(self, record: LogRecord, datefmt: str | None = ...) -> str: ... - def formatException(self, ei: _SysExcInfoType) -> str: ... - -class Filter: - def __init__(self, name: str = ...) -> None: ... - def filter(self, record: LogRecord) -> bool: ... - -class LogRecord: - args: _ArgsType - asctime: str - created: int - exc_info: _SysExcInfoType | None - exc_text: str | None - filename: str - funcName: str - levelname: str - levelno: int - lineno: int - module: str - msecs: int - message: str - msg: str - name: str - pathname: str - process: int - processName: str - relativeCreated: int - thread: int - threadName: str - def __init__( - self, - name: str, - level: int, - pathname: str, - lineno: int, - msg: Any, - args: _ArgsType, - exc_info: _SysExcInfoType | None, - func: str | None = ..., - ) -> None: ... - def getMessage(self) -> str: ... - -class LoggerAdapter: - logger: Logger - extra: Mapping[str, Any] - def __init__(self, logger: Logger, extra: Mapping[str, Any]) -> None: ... - def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> Tuple[Any, MutableMapping[str, Any]]: ... - def debug( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def info( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def warning( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def error( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def exception( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def critical( - self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def log( - self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any - ) -> None: ... - def isEnabledFor(self, level: int) -> bool: ... - -@overload -def getLogger() -> Logger: ... -@overload -def getLogger(name: Text | str) -> Logger: ... -def getLoggerClass() -> type: ... -def debug(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def info(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def warning(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... - -warn = warning - -def error(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def critical(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def exception(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any) -> None: ... -def log( - level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Dict[str, Any] | None = ..., **kwargs: Any -) -> None: ... - -fatal = critical - -def disable(level: int) -> None: ... -def addLevelName(level: int, levelName: str) -> None: ... -def getLevelName(level: int | str) -> Any: ... -def makeLogRecord(dict: Mapping[str, Any]) -> LogRecord: ... -@overload -def basicConfig() -> None: ... -@overload -def basicConfig( - *, - filename: str | None = ..., - filemode: str = ..., - format: str = ..., - datefmt: str | None = ..., - level: _Level | None = ..., - stream: IO[str] = ..., -) -> None: ... -def shutdown(handlerList: Sequence[Any] = ...) -> None: ... # handlerList is undocumented -def setLoggerClass(klass: type) -> None: ... -def captureWarnings(capture: bool) -> None: ... - -class StreamHandler(Handler): - stream: IO[str] # undocumented - def __init__(self, stream: IO[str] | None = ...) -> None: ... - -class FileHandler(StreamHandler): - baseFilename: str # undocumented - mode: str # undocumented - encoding: str | None # undocumented - delay: bool # undocumented - def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ... - def _open(self) -> IO[Any]: ... - -class NullHandler(Handler): ... - -class PlaceHolder: - def __init__(self, alogger: Logger) -> None: ... - def append(self, alogger: Logger) -> None: ... - -# Below aren't in module docs but still visible - -class RootLogger(Logger): - def __init__(self, level: int) -> None: ... - -root: RootLogger - -BASIC_FORMAT: str diff --git a/stdlib/@python2/logging/config.pyi b/stdlib/@python2/logging/config.pyi deleted file mode 100644 index 03707bb..0000000 --- a/stdlib/@python2/logging/config.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from _typeshed import StrPath -from threading import Thread -from typing import IO, Any, Dict - -_Path = StrPath - -def dictConfig(config: Dict[str, Any]) -> None: ... -def fileConfig(fname: str | IO[str], defaults: Dict[str, str] | None = ..., disable_existing_loggers: bool = ...) -> None: ... -def listen(port: int = ...) -> Thread: ... -def stopListening() -> None: ... diff --git a/stdlib/@python2/logging/handlers.pyi b/stdlib/@python2/logging/handlers.pyi deleted file mode 100644 index d18d57e..0000000 --- a/stdlib/@python2/logging/handlers.pyi +++ /dev/null @@ -1,129 +0,0 @@ -from _typeshed import StrPath -from logging import FileHandler, Handler, LogRecord -from socket import SocketKind, SocketType -from typing import Any, ClassVar, Dict, List, Tuple - -DEFAULT_TCP_LOGGING_PORT: int -DEFAULT_UDP_LOGGING_PORT: int -DEFAULT_HTTP_LOGGING_PORT: int -DEFAULT_SOAP_LOGGING_PORT: int -SYSLOG_UDP_PORT: int -SYSLOG_TCP_PORT: int - -class WatchedFileHandler(FileHandler): - dev: int - ino: int - def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ... - def _statstream(self) -> None: ... - -class RotatingFileHandler(Handler): - def __init__( - self, - filename: str, - mode: str = ..., - maxBytes: int = ..., - backupCount: int = ..., - encoding: str | None = ..., - delay: bool = ..., - ) -> None: ... - def doRollover(self) -> None: ... - -class TimedRotatingFileHandler(Handler): - def __init__( - self, - filename: str, - when: str = ..., - interval: int = ..., - backupCount: int = ..., - encoding: str | None = ..., - delay: bool = ..., - utc: bool = ..., - ) -> None: ... - def doRollover(self) -> None: ... - -class SocketHandler(Handler): - retryStart: float - retryFactor: float - retryMax: float - def __init__(self, host: str, port: int) -> None: ... - def makeSocket(self, timeout: float = ...) -> SocketType: ... # timeout is undocumented - def makePickle(self, record: LogRecord) -> bytes: ... - def send(self, s: bytes) -> None: ... - def createSocket(self) -> None: ... - -class DatagramHandler(SocketHandler): - def makeSocket(self) -> SocketType: ... # type: ignore - -class SysLogHandler(Handler): - LOG_EMERG: int - LOG_ALERT: int - LOG_CRIT: int - LOG_ERR: int - LOG_WARNING: int - LOG_NOTICE: int - LOG_INFO: int - LOG_DEBUG: int - - LOG_KERN: int - LOG_USER: int - LOG_MAIL: int - LOG_DAEMON: int - LOG_AUTH: int - LOG_SYSLOG: int - LOG_LPR: int - LOG_NEWS: int - LOG_UUCP: int - LOG_CRON: int - LOG_AUTHPRIV: int - LOG_FTP: int - LOG_LOCAL0: int - LOG_LOCAL1: int - LOG_LOCAL2: int - LOG_LOCAL3: int - LOG_LOCAL4: int - LOG_LOCAL5: int - LOG_LOCAL6: int - LOG_LOCAL7: int - address: Tuple[str, int] | str # undocumented - unixsocket: bool # undocumented - socktype: SocketKind # undocumented - facility: int # undocumented - priority_names: ClassVar[Dict[str, int]] # undocumented - facility_names: ClassVar[Dict[str, int]] # undocumented - priority_map: ClassVar[Dict[str, str]] # undocumented - def __init__(self, address: Tuple[str, int] | str = ..., facility: int = ..., socktype: SocketKind | None = ...) -> None: ... - def encodePriority(self, facility: int | str, priority: int | str) -> int: ... - def mapPriority(self, levelName: str) -> str: ... - -class NTEventLogHandler(Handler): - def __init__(self, appname: str, dllname: str | None = ..., logtype: str = ...) -> None: ... - def getEventCategory(self, record: LogRecord) -> int: ... - # TODO correct return value? - def getEventType(self, record: LogRecord) -> int: ... - def getMessageID(self, record: LogRecord) -> int: ... - -class SMTPHandler(Handler): - # TODO `secure` can also be an empty tuple - def __init__( - self, - mailhost: str | Tuple[str, int], - fromaddr: str, - toaddrs: List[str], - subject: str, - credentials: Tuple[str, str] | None = ..., - secure: Tuple[str] | Tuple[str, str] | None = ..., - ) -> None: ... - def getSubject(self, record: LogRecord) -> str: ... - -class BufferingHandler(Handler): - buffer: List[LogRecord] - def __init__(self, capacity: int) -> None: ... - def shouldFlush(self, record: LogRecord) -> bool: ... - -class MemoryHandler(BufferingHandler): - def __init__(self, capacity: int, flushLevel: int = ..., target: Handler | None = ...) -> None: ... - def setTarget(self, target: Handler) -> None: ... - -class HTTPHandler(Handler): - def __init__(self, host: str, url: str, method: str = ...) -> None: ... - def mapLogRecord(self, record: LogRecord) -> Dict[str, Any]: ... diff --git a/stdlib/@python2/macpath.pyi b/stdlib/@python2/macpath.pyi deleted file mode 100644 index bcb882e..0000000 --- a/stdlib/@python2/macpath.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from genericpath import ( - commonprefix as commonprefix, - exists as exists, - getatime as getatime, - getctime as getctime, - getmtime as getmtime, - getsize as getsize, - isdir as isdir, - isfile as isfile, -) - -# Re-export common definitions from posixpath to reduce duplication -from posixpath import ( - abspath as abspath, - curdir as curdir, - defpath as defpath, - devnull as devnull, - expanduser as expanduser, - expandvars as expandvars, - extsep as extsep, - isabs as isabs, - lexists as lexists, - pardir as pardir, - pathsep as pathsep, - sep as sep, - splitdrive as splitdrive, - splitext as splitext, - supports_unicode_filenames as supports_unicode_filenames, -) -from typing import AnyStr, Text, Tuple, overload - -altsep: str | None - -def basename(s: AnyStr) -> AnyStr: ... -def dirname(s: AnyStr) -> AnyStr: ... -def normcase(path: AnyStr) -> AnyStr: ... -def normpath(s: AnyStr) -> AnyStr: ... -def realpath(path: AnyStr) -> AnyStr: ... -def islink(s: Text) -> bool: ... - -# Make sure signatures are disjunct, and allow combinations of bytes and unicode. -# (Since Python 2 allows that, too) -# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in -# a type error. -@overload -def join(__p1: bytes, *p: bytes) -> bytes: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ... -@overload -def join(__p1: Text, *p: Text) -> Text: ... -def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ... diff --git a/stdlib/@python2/macurl2path.pyi b/stdlib/@python2/macurl2path.pyi deleted file mode 100644 index 6aac6df..0000000 --- a/stdlib/@python2/macurl2path.pyi +++ /dev/null @@ -1,3 +0,0 @@ -def url2pathname(pathname: str) -> str: ... -def pathname2url(pathname: str) -> str: ... -def _pncomp2url(component: str | bytes) -> str: ... diff --git a/stdlib/@python2/mailbox.pyi b/stdlib/@python2/mailbox.pyi deleted file mode 100644 index 18a66fa..0000000 --- a/stdlib/@python2/mailbox.pyi +++ /dev/null @@ -1,187 +0,0 @@ -import email.message -from types import TracebackType -from typing import ( - IO, - Any, - AnyStr, - Callable, - Dict, - Generic, - Iterable, - Iterator, - List, - Mapping, - Protocol, - Sequence, - Text, - Tuple, - Type, - TypeVar, - Union, - overload, -) -from typing_extensions import Literal - -_T = TypeVar("_T") -_MessageT = TypeVar("_MessageT", bound=Message) -_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]] - -class _HasIteritems(Protocol): - def iteritems(self) -> Iterator[Tuple[str, _MessageData]]: ... - -class _HasItems(Protocol): - def items(self) -> Iterator[Tuple[str, _MessageData]]: ... - -linesep: bytes - -class Mailbox(Generic[_MessageT]): - - _path: bytes | str # undocumented - _factory: Callable[[IO[Any]], _MessageT] | None # undocumented - def __init__(self, path: Text, factory: Callable[[IO[Any]], _MessageT] | None = ..., create: bool = ...) -> None: ... - def add(self, message: _MessageData) -> str: ... - def remove(self, key: str) -> None: ... - def __delitem__(self, key: str) -> None: ... - def discard(self, key: str) -> None: ... - def __setitem__(self, key: str, message: _MessageData) -> None: ... - @overload - def get(self, key: str, default: None = ...) -> _MessageT | None: ... - @overload - def get(self, key: str, default: _T) -> _MessageT | _T: ... - def __getitem__(self, key: str) -> _MessageT: ... - def get_message(self, key: str) -> _MessageT: ... - def get_string(self, key: str) -> str: ... - def get_bytes(self, key: str) -> bytes: ... - # As '_ProxyFile' doesn't implement the full IO spec, and BytesIO is incompatible with it, get_file return is Any here - def get_file(self, key: str) -> Any: ... - def iterkeys(self) -> Iterator[str]: ... - def keys(self) -> List[str]: ... - def itervalues(self) -> Iterator[_MessageT]: ... - def __iter__(self) -> Iterator[_MessageT]: ... - def values(self) -> List[_MessageT]: ... - def iteritems(self) -> Iterator[Tuple[str, _MessageT]]: ... - def items(self) -> List[Tuple[str, _MessageT]]: ... - def __contains__(self, key: str) -> bool: ... - def __len__(self) -> int: ... - def clear(self) -> None: ... - @overload - def pop(self, key: str, default: None = ...) -> _MessageT | None: ... - @overload - def pop(self, key: str, default: _T = ...) -> _MessageT | _T: ... - def popitem(self) -> Tuple[str, _MessageT]: ... - def update(self, arg: _HasIteritems | _HasItems | Iterable[Tuple[str, _MessageData]] | None = ...) -> None: ... - def flush(self) -> None: ... - def lock(self) -> None: ... - def unlock(self) -> None: ... - def close(self) -> None: ... - -class Maildir(Mailbox[MaildirMessage]): - - colon: str - def __init__(self, dirname: Text, factory: Callable[[IO[Any]], MaildirMessage] | None = ..., create: bool = ...) -> None: ... - def get_file(self, key: str) -> _ProxyFile[bytes]: ... - def list_folders(self) -> List[str]: ... - def get_folder(self, folder: Text) -> Maildir: ... - def add_folder(self, folder: Text) -> Maildir: ... - def remove_folder(self, folder: Text) -> None: ... - def clean(self) -> None: ... - def next(self) -> str | None: ... - -class _singlefileMailbox(Mailbox[_MessageT]): ... - -class _mboxMMDF(_singlefileMailbox[_MessageT]): - def get_file(self, key: str, from_: bool = ...) -> _PartialFile[bytes]: ... - def get_bytes(self, key: str, from_: bool = ...) -> bytes: ... - def get_string(self, key: str, from_: bool = ...) -> str: ... - -class mbox(_mboxMMDF[mboxMessage]): - def __init__(self, path: Text, factory: Callable[[IO[Any]], mboxMessage] | None = ..., create: bool = ...) -> None: ... - -class MMDF(_mboxMMDF[MMDFMessage]): - def __init__(self, path: Text, factory: Callable[[IO[Any]], MMDFMessage] | None = ..., create: bool = ...) -> None: ... - -class MH(Mailbox[MHMessage]): - def __init__(self, path: Text, factory: Callable[[IO[Any]], MHMessage] | None = ..., create: bool = ...) -> None: ... - def get_file(self, key: str) -> _ProxyFile[bytes]: ... - def list_folders(self) -> List[str]: ... - def get_folder(self, folder: Text) -> MH: ... - def add_folder(self, folder: Text) -> MH: ... - def remove_folder(self, folder: Text) -> None: ... - def get_sequences(self) -> Dict[str, List[int]]: ... - def set_sequences(self, sequences: Mapping[str, Sequence[int]]) -> None: ... - def pack(self) -> None: ... - -class Babyl(_singlefileMailbox[BabylMessage]): - def __init__(self, path: Text, factory: Callable[[IO[Any]], BabylMessage] | None = ..., create: bool = ...) -> None: ... - def get_file(self, key: str) -> IO[bytes]: ... - def get_labels(self) -> List[str]: ... - -class Message(email.message.Message): - def __init__(self, message: _MessageData | None = ...) -> None: ... - -class MaildirMessage(Message): - def get_subdir(self) -> str: ... - def set_subdir(self, subdir: Literal["new", "cur"]) -> None: ... - def get_flags(self) -> str: ... - def set_flags(self, flags: Iterable[str]) -> None: ... - def add_flag(self, flag: str) -> None: ... - def remove_flag(self, flag: str) -> None: ... - def get_date(self) -> int: ... - def set_date(self, date: float) -> None: ... - def get_info(self) -> str: ... - def set_info(self, info: str) -> None: ... - -class _mboxMMDFMessage(Message): - def get_from(self) -> str: ... - def set_from(self, from_: str, time_: bool | Tuple[int, int, int, int, int, int, int, int, int] | None = ...) -> None: ... - def get_flags(self) -> str: ... - def set_flags(self, flags: Iterable[str]) -> None: ... - def add_flag(self, flag: str) -> None: ... - def remove_flag(self, flag: str) -> None: ... - -class mboxMessage(_mboxMMDFMessage): ... - -class MHMessage(Message): - def get_sequences(self) -> List[str]: ... - def set_sequences(self, sequences: Iterable[str]) -> None: ... - def add_sequence(self, sequence: str) -> None: ... - def remove_sequence(self, sequence: str) -> None: ... - -class BabylMessage(Message): - def get_labels(self) -> List[str]: ... - def set_labels(self, labels: Iterable[str]) -> None: ... - def add_label(self, label: str) -> None: ... - def remove_label(self, label: str) -> None: ... - def get_visible(self) -> Message: ... - def set_visible(self, visible: _MessageData) -> None: ... - def update_visible(self) -> None: ... - -class MMDFMessage(_mboxMMDFMessage): ... - -class _ProxyFile(Generic[AnyStr]): - def __init__(self, f: IO[AnyStr], pos: int | None = ...) -> None: ... - def read(self, size: int | None = ...) -> AnyStr: ... - def read1(self, size: int | None = ...) -> AnyStr: ... - def readline(self, size: int | None = ...) -> AnyStr: ... - def readlines(self, sizehint: int | None = ...) -> List[AnyStr]: ... - def __iter__(self) -> Iterator[AnyStr]: ... - def tell(self) -> int: ... - def seek(self, offset: int, whence: int = ...) -> None: ... - def close(self) -> None: ... - def __enter__(self) -> _ProxyFile[AnyStr]: ... - def __exit__(self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def seekable(self) -> bool: ... - def flush(self) -> None: ... - @property - def closed(self) -> bool: ... - -class _PartialFile(_ProxyFile[AnyStr]): - def __init__(self, f: IO[AnyStr], start: int | None = ..., stop: int | None = ...) -> None: ... - -class Error(Exception): ... -class NoSuchMailboxError(Error): ... -class NotEmptyError(Error): ... -class ExternalClashError(Error): ... -class FormatError(Error): ... diff --git a/stdlib/@python2/mailcap.pyi b/stdlib/@python2/mailcap.pyi deleted file mode 100644 index b29854f..0000000 --- a/stdlib/@python2/mailcap.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Dict, List, Mapping, Sequence, Tuple, Union - -_Cap = Dict[str, Union[str, int]] - -def findmatch( - caps: Mapping[str, List[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... -) -> Tuple[str | None, _Cap | None]: ... -def getcaps() -> Dict[str, List[_Cap]]: ... diff --git a/stdlib/@python2/markupbase.pyi b/stdlib/@python2/markupbase.pyi deleted file mode 100644 index 727daaa..0000000 --- a/stdlib/@python2/markupbase.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Tuple - -class ParserBase(object): - def __init__(self) -> None: ... - def error(self, message: str) -> None: ... - def reset(self) -> None: ... - def getpos(self) -> Tuple[int, int]: ... - def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/@python2/marshal.pyi b/stdlib/@python2/marshal.pyi deleted file mode 100644 index b2fde67..0000000 --- a/stdlib/@python2/marshal.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import IO, Any - -version: int - -def dump(__value: Any, __file: IO[Any], __version: int = ...) -> None: ... -def load(__file: IO[Any]) -> Any: ... -def dumps(__value: Any, __version: int = ...) -> bytes: ... -def loads(__bytes: bytes) -> Any: ... diff --git a/stdlib/@python2/math.pyi b/stdlib/@python2/math.pyi deleted file mode 100644 index caddced..0000000 --- a/stdlib/@python2/math.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from typing import Iterable, SupportsFloat, SupportsInt, Tuple - -e: float -pi: float - -def acos(__x: SupportsFloat) -> float: ... -def acosh(__x: SupportsFloat) -> float: ... -def asin(__x: SupportsFloat) -> float: ... -def asinh(__x: SupportsFloat) -> float: ... -def atan(__x: SupportsFloat) -> float: ... -def atan2(__y: SupportsFloat, __x: SupportsFloat) -> float: ... -def atanh(__x: SupportsFloat) -> float: ... -def ceil(__x: SupportsFloat) -> float: ... -def copysign(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def cos(__x: SupportsFloat) -> float: ... -def cosh(__x: SupportsFloat) -> float: ... -def degrees(__x: SupportsFloat) -> float: ... -def erf(__x: SupportsFloat) -> float: ... -def erfc(__x: SupportsFloat) -> float: ... -def exp(__x: SupportsFloat) -> float: ... -def expm1(__x: SupportsFloat) -> float: ... -def fabs(__x: SupportsFloat) -> float: ... -def factorial(__x: SupportsInt) -> int: ... -def floor(__x: SupportsFloat) -> float: ... -def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def frexp(__x: SupportsFloat) -> Tuple[float, int]: ... -def fsum(__seq: Iterable[float]) -> float: ... -def gamma(__x: SupportsFloat) -> float: ... -def hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def isinf(__x: SupportsFloat) -> bool: ... -def isnan(__x: SupportsFloat) -> bool: ... -def ldexp(__x: SupportsFloat, __i: int) -> float: ... -def lgamma(__x: SupportsFloat) -> float: ... -def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ... -def log10(__x: SupportsFloat) -> float: ... -def log1p(__x: SupportsFloat) -> float: ... -def modf(__x: SupportsFloat) -> Tuple[float, float]: ... -def pow(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def radians(__x: SupportsFloat) -> float: ... -def sin(__x: SupportsFloat) -> float: ... -def sinh(__x: SupportsFloat) -> float: ... -def sqrt(__x: SupportsFloat) -> float: ... -def tan(__x: SupportsFloat) -> float: ... -def tanh(__x: SupportsFloat) -> float: ... -def trunc(__x: SupportsFloat) -> int: ... diff --git a/stdlib/@python2/md5.pyi b/stdlib/@python2/md5.pyi deleted file mode 100644 index 371f611..0000000 --- a/stdlib/@python2/md5.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from hashlib import md5 as md5 - -new = md5 -blocksize: int -digest_size: int diff --git a/stdlib/@python2/mimetools.pyi b/stdlib/@python2/mimetools.pyi deleted file mode 100644 index 3c6cbfc..0000000 --- a/stdlib/@python2/mimetools.pyi +++ /dev/null @@ -1,27 +0,0 @@ -import rfc822 -from typing import Any - -class Message(rfc822.Message): - encodingheader: Any - typeheader: Any - def __init__(self, fp, seekable: int = ...): ... - plisttext: Any - type: Any - maintype: Any - subtype: Any - def parsetype(self): ... - plist: Any - def parseplist(self): ... - def getplist(self): ... - def getparam(self, name): ... - def getparamnames(self): ... - def getencoding(self): ... - def gettype(self): ... - def getmaintype(self): ... - def getsubtype(self): ... - -def choose_boundary(): ... -def decode(input, output, encoding): ... -def encode(input, output, encoding): ... -def copyliteral(input, output): ... -def copybinary(input, output): ... diff --git a/stdlib/@python2/mimetypes.pyi b/stdlib/@python2/mimetypes.pyi deleted file mode 100644 index a9661da..0000000 --- a/stdlib/@python2/mimetypes.pyi +++ /dev/null @@ -1,30 +0,0 @@ -import sys -from typing import IO, Dict, List, Sequence, Text, Tuple - -def guess_type(url: Text, strict: bool = ...) -> Tuple[str | None, str | None]: ... -def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ... -def guess_extension(type: str, strict: bool = ...) -> str | None: ... -def init(files: Sequence[str] | None = ...) -> None: ... -def read_mime_types(file: str) -> Dict[str, str] | None: ... -def add_type(type: str, ext: str, strict: bool = ...) -> None: ... - -inited: bool -knownfiles: List[str] -suffix_map: Dict[str, str] -encodings_map: Dict[str, str] -types_map: Dict[str, str] -common_types: Dict[str, str] - -class MimeTypes: - suffix_map: Dict[str, str] - encodings_map: Dict[str, str] - types_map: Tuple[Dict[str, str], Dict[str, str]] - types_map_inv: Tuple[Dict[str, str], Dict[str, str]] - def __init__(self, filenames: Tuple[str, ...] = ..., strict: bool = ...) -> None: ... - def guess_extension(self, type: str, strict: bool = ...) -> str | None: ... - def guess_type(self, url: str, strict: bool = ...) -> Tuple[str | None, str | None]: ... - def guess_all_extensions(self, type: str, strict: bool = ...) -> List[str]: ... - def read(self, filename: str, strict: bool = ...) -> None: ... - def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... - if sys.platform == "win32": - def read_windows_registry(self, strict: bool = ...) -> None: ... diff --git a/stdlib/@python2/mmap.pyi b/stdlib/@python2/mmap.pyi deleted file mode 100644 index 44369e6..0000000 --- a/stdlib/@python2/mmap.pyi +++ /dev/null @@ -1,51 +0,0 @@ -import sys -from typing import NoReturn, Sequence - -ACCESS_DEFAULT: int -ACCESS_READ: int -ACCESS_WRITE: int -ACCESS_COPY: int - -ALLOCATIONGRANULARITY: int - -if sys.platform == "linux": - MAP_DENYWRITE: int - MAP_EXECUTABLE: int - -if sys.platform != "win32": - MAP_ANON: int - MAP_ANONYMOUS: int - MAP_PRIVATE: int - MAP_SHARED: int - PROT_EXEC: int - PROT_READ: int - PROT_WRITE: int - - PAGESIZE: int - -class mmap(Sequence[bytes]): - if sys.platform == "win32": - def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ... - else: - def __init__( - self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... - ) -> None: ... - def close(self) -> None: ... - def flush(self, offset: int = ..., size: int = ...) -> int: ... - def move(self, dest: int, src: int, count: int) -> None: ... - def read_byte(self) -> bytes: ... - def readline(self) -> bytes: ... - def resize(self, newsize: int) -> None: ... - def seek(self, pos: int, whence: int = ...) -> None: ... - def size(self) -> int: ... - def tell(self) -> int: ... - def write_byte(self, byte: bytes) -> None: ... - def __len__(self) -> int: ... - def find(self, string: bytes, start: int = ..., end: int = ...) -> int: ... - def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ... - def read(self, num: int) -> bytes: ... - def write(self, string: bytes) -> None: ... - def __getitem__(self, index: int | slice) -> bytes: ... - def __getslice__(self, i: int | None, j: int | None) -> bytes: ... - def __delitem__(self, index: int | slice) -> NoReturn: ... - def __setitem__(self, index: int | slice, object: bytes) -> None: ... diff --git a/stdlib/@python2/modulefinder.pyi b/stdlib/@python2/modulefinder.pyi deleted file mode 100644 index 76fd014..0000000 --- a/stdlib/@python2/modulefinder.pyi +++ /dev/null @@ -1,63 +0,0 @@ -from types import CodeType -from typing import IO, Any, Container, Dict, Iterable, List, Sequence, Tuple - -LOAD_CONST: int # undocumented -IMPORT_NAME: int # undocumented -STORE_NAME: int # undocumented -STORE_GLOBAL: int # undocumented -STORE_OPS: Tuple[int, int] # undocumented -EXTENDED_ARG: int # undocumented - -packagePathMap: Dict[str, List[str]] # undocumented - -def AddPackagePath(packagename: str, path: str) -> None: ... - -replacePackageMap: Dict[str, str] # undocumented - -def ReplacePackage(oldname: str, newname: str) -> None: ... - -class Module: # undocumented - def __init__(self, name: str, file: str | None = ..., path: str | None = ...) -> None: ... - def __repr__(self) -> str: ... - -class ModuleFinder: - - modules: Dict[str, Module] - path: List[str] # undocumented - badmodules: Dict[str, Dict[str, int]] # undocumented - debug: int # undocumented - indent: int # undocumented - excludes: Container[str] # undocumented - replace_paths: Sequence[Tuple[str, str]] # undocumented - def __init__( - self, - path: List[str] | None = ..., - debug: int = ..., - excludes: Container[str] = ..., - replace_paths: Sequence[Tuple[str, str]] = ..., - ) -> None: ... - def msg(self, level: int, str: str, *args: Any) -> None: ... # undocumented - def msgin(self, *args: Any) -> None: ... # undocumented - def msgout(self, *args: Any) -> None: ... # undocumented - def run_script(self, pathname: str) -> None: ... - def load_file(self, pathname: str) -> None: ... # undocumented - def import_hook( - self, name: str, caller: Module | None = ..., fromlist: List[str] | None = ..., level: int = ... - ) -> Module | None: ... # undocumented - def determine_parent(self, caller: Module | None, level: int = ...) -> Module | None: ... # undocumented - def find_head_package(self, parent: Module, name: str) -> Tuple[Module, str]: ... # undocumented - def load_tail(self, q: Module, tail: str) -> Module: ... # undocumented - def ensure_fromlist(self, m: Module, fromlist: Iterable[str], recursive: int = ...) -> None: ... # undocumented - def find_all_submodules(self, m: Module) -> Iterable[str]: ... # undocumented - def import_module(self, partname: str, fqname: str, parent: Module) -> Module | None: ... # undocumented - def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: Tuple[str, str, str]) -> Module: ... # undocumented - def scan_code(self, co: CodeType, m: Module) -> None: ... # undocumented - def load_package(self, fqname: str, pathname: str) -> Module: ... # undocumented - def add_module(self, fqname: str) -> Module: ... # undocumented - def find_module( - self, name: str, path: str | None, parent: Module | None = ... - ) -> Tuple[IO[Any] | None, str | None, Tuple[str, str, int]]: ... # undocumented - def report(self) -> None: ... - def any_missing(self) -> List[str]: ... # undocumented - def any_missing_maybe(self) -> Tuple[List[str], List[str]]: ... # undocumented - def replace_paths_in_code(self, co: CodeType) -> CodeType: ... # undocumented diff --git a/stdlib/@python2/msilib/__init__.pyi b/stdlib/@python2/msilib/__init__.pyi deleted file mode 100644 index fa67576..0000000 --- a/stdlib/@python2/msilib/__init__.pyi +++ /dev/null @@ -1,175 +0,0 @@ -import sys -from types import ModuleType -from typing import Any, Container, Dict, Iterable, List, Sequence, Set, Tuple, Type -from typing_extensions import Literal - -if sys.platform == "win32": - from _msi import _Database - - AMD64: bool - Itanium: bool - Win64: bool - - datasizemask: Literal[0x00FF] - type_valid: Literal[0x0100] - type_localizable: Literal[0x0200] - typemask: Literal[0x0C00] - type_long: Literal[0x0000] - type_short: Literal[0x0400] - type_string: Literal[0x0C00] - type_binary: Literal[0x0800] - type_nullable: Literal[0x1000] - type_key: Literal[0x2000] - knownbits: Literal[0x3FFF] - class Table: - - name: str - fields: List[Tuple[int, str, int]] - def __init__(self, name: str) -> None: ... - def add_field(self, index: int, name: str, type: int) -> None: ... - def sql(self) -> str: ... - def create(self, db: _Database) -> None: ... - class _Unspecified: ... - def change_sequence( - seq: Sequence[Tuple[str, str | None, int]], - action: str, - seqno: int | Type[_Unspecified] = ..., - cond: str | Type[_Unspecified] = ..., - ) -> None: ... - def add_data(db: _Database, table: str, values: Iterable[Tuple[Any, ...]]) -> None: ... - def add_stream(db: _Database, name: str, path: str) -> None: ... - def init_database( - name: str, schema: ModuleType, ProductName: str, ProductCode: str, ProductVersion: str, Manufacturer: str - ) -> _Database: ... - def add_tables(db: _Database, module: ModuleType) -> None: ... - def make_id(str: str) -> str: ... - def gen_uuid() -> str: ... - class CAB: - - name: str - files: List[Tuple[str, str]] - filenames: Set[str] - index: int - def __init__(self, name: str) -> None: ... - def gen_id(self, file: str) -> str: ... - def append(self, full: str, file: str, logical: str) -> Tuple[int, str]: ... - def commit(self, db: _Database) -> None: ... - _directories: Set[str] - class Directory: - - db: _Database - cab: CAB - basedir: str - physical: str - logical: str - component: str | None - short_names: Set[str] - ids: Set[str] - keyfiles: Dict[str, str] - componentflags: int | None - absolute: str - def __init__( - self, - db: _Database, - cab: CAB, - basedir: str, - physical: str, - _logical: str, - default: str, - componentflags: int | None = ..., - ) -> None: ... - def start_component( - self, - component: str | None = ..., - feature: Feature | None = ..., - flags: int | None = ..., - keyfile: str | None = ..., - uuid: str | None = ..., - ) -> None: ... - def make_short(self, file: str) -> str: ... - def add_file(self, file: str, src: str | None = ..., version: str | None = ..., language: str | None = ...) -> str: ... - def glob(self, pattern: str, exclude: Container[str] | None = ...) -> List[str]: ... - def remove_pyc(self) -> None: ... - class Binary: - - name: str - def __init__(self, fname: str) -> None: ... - def __repr__(self) -> str: ... - class Feature: - - id: str - def __init__( - self, - db: _Database, - id: str, - title: str, - desc: str, - display: int, - level: int = ..., - parent: Feature | None = ..., - directory: str | None = ..., - attributes: int = ..., - ) -> None: ... - def set_current(self) -> None: ... - class Control: - - dlg: Dialog - name: str - def __init__(self, dlg: Dialog, name: str) -> None: ... - def event(self, event: str, argument: str, condition: str = ..., ordering: int | None = ...) -> None: ... - def mapping(self, event: str, attribute: str) -> None: ... - def condition(self, action: str, condition: str) -> None: ... - class RadioButtonGroup(Control): - - property: str - index: int - def __init__(self, dlg: Dialog, name: str, property: str) -> None: ... - def add(self, name: str, x: int, y: int, w: int, h: int, text: str, value: str | None = ...) -> None: ... - class Dialog: - - db: _Database - name: str - x: int - y: int - w: int - h: int - def __init__( - self, - db: _Database, - name: str, - x: int, - y: int, - w: int, - h: int, - attr: int, - title: str, - first: str, - default: str, - cancel: str, - ) -> None: ... - def control( - self, - name: str, - type: str, - x: int, - y: int, - w: int, - h: int, - attr: int, - prop: str | None, - text: str | None, - next: str | None, - help: str | None, - ) -> Control: ... - def text(self, name: str, x: int, y: int, w: int, h: int, attr: int, text: str | None) -> Control: ... - def bitmap(self, name: str, x: int, y: int, w: int, h: int, text: str | None) -> Control: ... - def line(self, name: str, x: int, y: int, w: int, h: int) -> Control: ... - def pushbutton( - self, name: str, x: int, y: int, w: int, h: int, attr: int, text: str | None, next: str | None - ) -> Control: ... - def radiogroup( - self, name: str, x: int, y: int, w: int, h: int, attr: int, prop: str | None, text: str | None, next: str | None - ) -> RadioButtonGroup: ... - def checkbox( - self, name: str, x: int, y: int, w: int, h: int, attr: int, prop: str | None, text: str | None, next: str | None - ) -> Control: ... diff --git a/stdlib/@python2/msilib/schema.pyi b/stdlib/@python2/msilib/schema.pyi deleted file mode 100644 index d59e976..0000000 --- a/stdlib/@python2/msilib/schema.pyi +++ /dev/null @@ -1,95 +0,0 @@ -import sys -from typing import List, Tuple - -if sys.platform == "win32": - from . import Table - - _Validation: Table - ActionText: Table - AdminExecuteSequence: Table - Condition: Table - AdminUISequence: Table - AdvtExecuteSequence: Table - AdvtUISequence: Table - AppId: Table - AppSearch: Table - Property: Table - BBControl: Table - Billboard: Table - Feature: Table - Binary: Table - BindImage: Table - File: Table - CCPSearch: Table - CheckBox: Table - Class: Table - Component: Table - Icon: Table - ProgId: Table - ComboBox: Table - CompLocator: Table - Complus: Table - Directory: Table - Control: Table - Dialog: Table - ControlCondition: Table - ControlEvent: Table - CreateFolder: Table - CustomAction: Table - DrLocator: Table - DuplicateFile: Table - Environment: Table - Error: Table - EventMapping: Table - Extension: Table - MIME: Table - FeatureComponents: Table - FileSFPCatalog: Table - SFPCatalog: Table - Font: Table - IniFile: Table - IniLocator: Table - InstallExecuteSequence: Table - InstallUISequence: Table - IsolatedComponent: Table - LaunchCondition: Table - ListBox: Table - ListView: Table - LockPermissions: Table - Media: Table - MoveFile: Table - MsiAssembly: Table - MsiAssemblyName: Table - MsiDigitalCertificate: Table - MsiDigitalSignature: Table - MsiFileHash: Table - MsiPatchHeaders: Table - ODBCAttribute: Table - ODBCDriver: Table - ODBCDataSource: Table - ODBCSourceAttribute: Table - ODBCTranslator: Table - Patch: Table - PatchPackage: Table - PublishComponent: Table - RadioButton: Table - Registry: Table - RegLocator: Table - RemoveFile: Table - RemoveIniFile: Table - RemoveRegistry: Table - ReserveCost: Table - SelfReg: Table - ServiceControl: Table - ServiceInstall: Table - Shortcut: Table - Signature: Table - TextStyle: Table - TypeLib: Table - UIText: Table - Upgrade: Table - Verb: Table - - tables: List[Table] - - _Validation_records: List[Tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] diff --git a/stdlib/@python2/msilib/sequence.pyi b/stdlib/@python2/msilib/sequence.pyi deleted file mode 100644 index e4f400d..0000000 --- a/stdlib/@python2/msilib/sequence.pyi +++ /dev/null @@ -1,14 +0,0 @@ -import sys -from typing import List, Optional, Tuple - -if sys.platform == "win32": - - _SequenceType = List[Tuple[str, Optional[str], int]] - - AdminExecuteSequence: _SequenceType - AdminUISequence: _SequenceType - AdvtExecuteSequence: _SequenceType - InstallExecuteSequence: _SequenceType - InstallUISequence: _SequenceType - - tables: List[str] diff --git a/stdlib/@python2/msilib/text.pyi b/stdlib/@python2/msilib/text.pyi deleted file mode 100644 index 4ae8ee6..0000000 --- a/stdlib/@python2/msilib/text.pyi +++ /dev/null @@ -1,9 +0,0 @@ -import sys -from typing import List, Tuple - -if sys.platform == "win32": - - ActionText: List[Tuple[str, str, str | None]] - UIText: List[Tuple[str, str | None]] - - tables: List[str] diff --git a/stdlib/@python2/msvcrt.pyi b/stdlib/@python2/msvcrt.pyi deleted file mode 100644 index ede80c9..0000000 --- a/stdlib/@python2/msvcrt.pyi +++ /dev/null @@ -1,24 +0,0 @@ -import sys -from typing import Text - -# This module is only available on Windows -if sys.platform == "win32": - LK_LOCK: int - LK_NBLCK: int - LK_NBRLCK: int - LK_RLCK: int - LK_UNLCK: int - def locking(__fd: int, __mode: int, __nbytes: int) -> None: ... - def setmode(__fd: int, __mode: int) -> int: ... - def open_osfhandle(__handle: int, __flags: int) -> int: ... - def get_osfhandle(__fd: int) -> int: ... - def kbhit() -> bool: ... - def getch() -> bytes: ... - def getwch() -> Text: ... - def getche() -> bytes: ... - def getwche() -> Text: ... - def putch(__char: bytes) -> None: ... - def putwch(__unicode_char: Text) -> None: ... - def ungetch(__char: bytes) -> None: ... - def ungetwch(__unicode_char: Text) -> None: ... - def heapmin() -> None: ... diff --git a/stdlib/@python2/multiprocessing/__init__.pyi b/stdlib/@python2/multiprocessing/__init__.pyi deleted file mode 100644 index e22e090..0000000 --- a/stdlib/@python2/multiprocessing/__init__.pyi +++ /dev/null @@ -1,50 +0,0 @@ -from multiprocessing import pool -from multiprocessing.process import Process as Process, active_children as active_children, current_process as current_process -from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING -from Queue import Queue as _BaseQueue -from typing import Any, Callable, Iterable, TypeVar - -class ProcessError(Exception): ... -class BufferTooShort(ProcessError): ... -class TimeoutError(ProcessError): ... -class AuthenticationError(ProcessError): ... - -_T = TypeVar("_T") - -class Queue(_BaseQueue[_T]): - def __init__(self, maxsize: int = ...) -> None: ... - def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... - def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ... - def qsize(self) -> int: ... - def empty(self) -> bool: ... - def full(self) -> bool: ... - def put_nowait(self, item: _T) -> None: ... - def get_nowait(self) -> _T: ... - def close(self) -> None: ... - def join_thread(self) -> None: ... - def cancel_join_thread(self) -> None: ... - -def Manager(): ... -def Pipe(duplex: bool = ...): ... -def cpu_count() -> int: ... -def freeze_support(): ... -def get_logger(): ... -def log_to_stderr(level: Any | None = ...): ... -def allow_connection_pickling(): ... -def Lock(): ... -def RLock(): ... -def Condition(lock: Any | None = ...): ... -def Semaphore(value: int = ...): ... -def BoundedSemaphore(value: int = ...): ... -def Event(): ... -def JoinableQueue(maxsize: int = ...): ... -def RawValue(typecode_or_type, *args): ... -def RawArray(typecode_or_type, size_or_initializer): ... -def Value(typecode_or_type, *args, **kwds): ... -def Array(typecode_or_type, size_or_initializer, **kwds): ... -def Pool( - processes: int | None = ..., - initializer: Callable[..., Any] | None = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: int | None = ..., -) -> pool.Pool: ... diff --git a/stdlib/@python2/multiprocessing/dummy/__init__.pyi b/stdlib/@python2/multiprocessing/dummy/__init__.pyi deleted file mode 100644 index 80a1456..0000000 --- a/stdlib/@python2/multiprocessing/dummy/__init__.pyi +++ /dev/null @@ -1,41 +0,0 @@ -import array -import threading -import weakref -from Queue import Queue -from typing import Any, List - -class DummyProcess(threading.Thread): - _children: weakref.WeakKeyDictionary[Any, Any] - _parent: threading.Thread - _pid: None - _start_called: bool - def __init__(self, group=..., target=..., name=..., args=..., kwargs=...) -> None: ... - @property - def exitcode(self) -> int | None: ... - -Process = DummyProcess - -# This should be threading._Condition but threading.pyi exports it as Condition -class Condition(threading.Condition): - notify_all: Any - -class Namespace(object): - def __init__(self, **kwds) -> None: ... - -class Value(object): - _typecode: Any - _value: Any - value: Any - def __init__(self, typecode, value, lock=...) -> None: ... - def _get(self) -> Any: ... - def _set(self, value) -> None: ... - -JoinableQueue = Queue - -def Array(typecode, sequence, lock=...) -> array.array[Any]: ... -def Manager() -> Any: ... -def Pool(processes=..., initializer=..., initargs=...) -> Any: ... -def active_children() -> List[Any]: ... -def current_process() -> threading.Thread: ... -def freeze_support() -> None: ... -def shutdown() -> None: ... diff --git a/stdlib/@python2/multiprocessing/dummy/connection.pyi b/stdlib/@python2/multiprocessing/dummy/connection.pyi deleted file mode 100644 index ae5e05e..0000000 --- a/stdlib/@python2/multiprocessing/dummy/connection.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from Queue import Queue -from typing import Any, List, Tuple - -families: List[None] - -class Connection(object): - _in: Any - _out: Any - recv: Any - recv_bytes: Any - send: Any - send_bytes: Any - def __init__(self, _in, _out) -> None: ... - def close(self) -> None: ... - def poll(self, timeout=...) -> Any: ... - -class Listener(object): - _backlog_queue: Queue[Any] | None - address: Any - def __init__(self, address=..., family=..., backlog=...) -> None: ... - def accept(self) -> Connection: ... - def close(self) -> None: ... - -def Client(address) -> Connection: ... -def Pipe(duplex=...) -> Tuple[Connection, Connection]: ... diff --git a/stdlib/@python2/multiprocessing/pool.pyi b/stdlib/@python2/multiprocessing/pool.pyi deleted file mode 100644 index be9747e..0000000 --- a/stdlib/@python2/multiprocessing/pool.pyi +++ /dev/null @@ -1,52 +0,0 @@ -from typing import Any, Callable, Dict, Iterable, Iterator, List, TypeVar - -_T = TypeVar("_T", bound=Pool) - -class AsyncResult: - def get(self, timeout: float | None = ...) -> Any: ... - def wait(self, timeout: float | None = ...) -> None: ... - def ready(self) -> bool: ... - def successful(self) -> bool: ... - -class IMapIterator(Iterator[Any]): - def __iter__(self) -> Iterator[Any]: ... - def next(self, timeout: float | None = ...) -> Any: ... - -class IMapUnorderedIterator(IMapIterator): ... - -class Pool(object): - def __init__( - self, - processes: int | None = ..., - initializer: Callable[..., None] | None = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: int | None = ..., - ) -> None: ... - def apply(self, func: Callable[..., Any], args: Iterable[Any] = ..., kwds: Dict[str, Any] = ...) -> Any: ... - def apply_async( - self, - func: Callable[..., Any], - args: Iterable[Any] = ..., - kwds: Dict[str, Any] = ..., - callback: Callable[..., None] | None = ..., - ) -> AsyncResult: ... - def map(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: int | None = ...) -> List[Any]: ... - def map_async( - self, - func: Callable[..., Any], - iterable: Iterable[Any] = ..., - chunksize: int | None = ..., - callback: Callable[..., None] | None = ..., - ) -> AsyncResult: ... - def imap(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: int | None = ...) -> IMapIterator: ... - def imap_unordered( - self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: int | None = ... - ) -> IMapIterator: ... - def close(self) -> None: ... - def terminate(self) -> None: ... - def join(self) -> None: ... - -class ThreadPool(Pool): - def __init__( - self, processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ... - ) -> None: ... diff --git a/stdlib/@python2/multiprocessing/process.pyi b/stdlib/@python2/multiprocessing/process.pyi deleted file mode 100644 index 2cb6913..0000000 --- a/stdlib/@python2/multiprocessing/process.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from typing import Any - -def current_process(): ... -def active_children(): ... - -class Process: - def __init__(self, group: Any | None = ..., target: Any | None = ..., name: Any | None = ..., args=..., kwargs=...): ... - def run(self): ... - def start(self): ... - def terminate(self): ... - def join(self, timeout: Any | None = ...): ... - def is_alive(self): ... - @property - def name(self): ... - @name.setter - def name(self, name): ... - @property - def daemon(self): ... - @daemon.setter - def daemon(self, daemonic): ... - @property - def authkey(self): ... - @authkey.setter - def authkey(self, authkey): ... - @property - def exitcode(self): ... - @property - def ident(self): ... - pid: Any - -class AuthenticationString(bytes): - def __reduce__(self): ... - -class _MainProcess(Process): - def __init__(self): ... diff --git a/stdlib/@python2/multiprocessing/util.pyi b/stdlib/@python2/multiprocessing/util.pyi deleted file mode 100644 index 6976bc3..0000000 --- a/stdlib/@python2/multiprocessing/util.pyi +++ /dev/null @@ -1,29 +0,0 @@ -import threading -from typing import Any - -SUBDEBUG: Any -SUBWARNING: Any - -def sub_debug(msg, *args): ... -def debug(msg, *args): ... -def info(msg, *args): ... -def sub_warning(msg, *args): ... -def get_logger(): ... -def log_to_stderr(level: Any | None = ...): ... -def get_temp_dir(): ... -def register_after_fork(obj, func): ... - -class Finalize: - def __init__(self, obj, callback, args=..., kwargs: Any | None = ..., exitpriority: Any | None = ...): ... - def __call__(self, wr: Any | None = ...): ... - def cancel(self): ... - def still_active(self): ... - -def is_exiting(): ... - -class ForkAwareThreadLock: - def __init__(self): ... - -class ForkAwareLocal(threading.local): - def __init__(self): ... - def __reduce__(self): ... diff --git a/stdlib/@python2/mutex.pyi b/stdlib/@python2/mutex.pyi deleted file mode 100644 index e0931dc..0000000 --- a/stdlib/@python2/mutex.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any, Callable, Deque, TypeVar - -_T = TypeVar("_T") - -class mutex: - locked: bool - queue: Deque[Any] - def __init__(self) -> None: ... - def test(self) -> bool: ... - def testandset(self) -> bool: ... - def lock(self, function: Callable[[_T], Any], argument: _T) -> None: ... - def unlock(self) -> None: ... diff --git a/stdlib/@python2/netrc.pyi b/stdlib/@python2/netrc.pyi deleted file mode 100644 index 3033c2f..0000000 --- a/stdlib/@python2/netrc.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Dict, List, Optional, Text, Tuple - -class NetrcParseError(Exception): - filename: str | None - lineno: int | None - msg: str - def __init__(self, msg: str, filename: Text | None = ..., lineno: int | None = ...) -> None: ... - -# (login, account, password) tuple -_NetrcTuple = Tuple[str, Optional[str], Optional[str]] - -class netrc: - hosts: Dict[str, _NetrcTuple] - macros: Dict[str, List[str]] - def __init__(self, file: Text | None = ...) -> None: ... - def authenticators(self, host: str) -> _NetrcTuple | None: ... diff --git a/stdlib/@python2/nis.pyi b/stdlib/@python2/nis.pyi deleted file mode 100644 index bc6c2bc..0000000 --- a/stdlib/@python2/nis.pyi +++ /dev/null @@ -1,9 +0,0 @@ -import sys -from typing import Dict, List - -if sys.platform != "win32": - def cat(map: str, domain: str = ...) -> Dict[str, str]: ... - def get_default_domain() -> str: ... - def maps(domain: str = ...) -> List[str]: ... - def match(key: str, map: str, domain: str = ...) -> str: ... - class error(Exception): ... diff --git a/stdlib/@python2/nntplib.pyi b/stdlib/@python2/nntplib.pyi deleted file mode 100644 index 56545d3..0000000 --- a/stdlib/@python2/nntplib.pyi +++ /dev/null @@ -1,109 +0,0 @@ -import datetime -import socket -import ssl -from typing import IO, Any, Dict, Iterable, List, NamedTuple, Tuple, TypeVar, Union - -_SelfT = TypeVar("_SelfT", bound=_NNTPBase) -_File = Union[IO[bytes], bytes, str, None] - -class NNTPError(Exception): - response: str - -class NNTPReplyError(NNTPError): ... -class NNTPTemporaryError(NNTPError): ... -class NNTPPermanentError(NNTPError): ... -class NNTPProtocolError(NNTPError): ... -class NNTPDataError(NNTPError): ... - -NNTP_PORT: int -NNTP_SSL_PORT: int - -class GroupInfo(NamedTuple): - group: str - last: str - first: str - flag: str - -class ArticleInfo(NamedTuple): - number: int - message_id: str - lines: List[bytes] - -def decode_header(header_str: str) -> str: ... - -class _NNTPBase: - encoding: str - errors: str - - host: str - file: IO[bytes] - debugging: int - welcome: str - readermode_afterauth: bool - tls_on: bool - authenticated: bool - nntp_implementation: str - nntp_version: int - def __init__(self, file: IO[bytes], host: str, readermode: bool | None = ..., timeout: float = ...) -> None: ... - def __enter__(self: _SelfT) -> _SelfT: ... - def __exit__(self, *args: Any) -> None: ... - def getwelcome(self) -> str: ... - def getcapabilities(self) -> Dict[str, List[str]]: ... - def set_debuglevel(self, level: int) -> None: ... - def debug(self, level: int) -> None: ... - def capabilities(self) -> Tuple[str, Dict[str, List[str]]]: ... - def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> Tuple[str, List[str]]: ... - def description(self, group: str) -> str: ... - def descriptions(self, group_pattern: str) -> Tuple[str, Dict[str, str]]: ... - def group(self, name: str) -> Tuple[str, int, int, int, str]: ... - def help(self, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def stat(self, message_spec: Any = ...) -> Tuple[str, int, str]: ... - def next(self) -> Tuple[str, int, str]: ... - def last(self) -> Tuple[str, int, str]: ... - def head(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def body(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def article(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def slave(self) -> str: ... - def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> Tuple[str, List[str]]: ... - def xover(self, start: int, end: int, *, file: _File = ...) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... - def over( - self, message_spec: None | str | List[Any] | Tuple[Any, ...], *, file: _File = ... - ) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... - def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[str, str]]]: ... - def xpath(self, id: Any) -> Tuple[str, str]: ... - def date(self) -> Tuple[str, datetime.datetime]: ... - def post(self, data: bytes | Iterable[bytes]) -> str: ... - def ihave(self, message_id: Any, data: bytes | Iterable[bytes]) -> str: ... - def quit(self) -> str: ... - def login(self, user: str | None = ..., password: str | None = ..., usenetrc: bool = ...) -> None: ... - def starttls(self, context: ssl.SSLContext | None = ...) -> None: ... - -class NNTP(_NNTPBase): - port: int - sock: socket.socket - def __init__( - self, - host: str, - port: int = ..., - user: str | None = ..., - password: str | None = ..., - readermode: bool | None = ..., - usenetrc: bool = ..., - timeout: float = ..., - ) -> None: ... - -class NNTP_SSL(_NNTPBase): - sock: socket.socket - def __init__( - self, - host: str, - port: int = ..., - user: str | None = ..., - password: str | None = ..., - ssl_context: ssl.SSLContext | None = ..., - readermode: bool | None = ..., - usenetrc: bool = ..., - timeout: float = ..., - ) -> None: ... diff --git a/stdlib/@python2/ntpath.pyi b/stdlib/@python2/ntpath.pyi deleted file mode 100644 index 514db76..0000000 --- a/stdlib/@python2/ntpath.pyi +++ /dev/null @@ -1,84 +0,0 @@ -import os -import sys -from genericpath import exists as exists -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload - -_T = TypeVar("_T") - -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: str | None -extsep: str -pathsep: str -defpath: str -devnull: str - -# ----- os.path function stubs ----- -def abspath(path: AnyStr) -> AnyStr: ... -def basename(p: AnyStr) -> AnyStr: ... -def dirname(p: AnyStr) -> AnyStr: ... -def expanduser(path: AnyStr) -> AnyStr: ... -def expandvars(path: AnyStr) -> AnyStr: ... -def normcase(s: AnyStr) -> AnyStr: ... -def normpath(path: AnyStr) -> AnyStr: ... - -if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - -else: - def realpath(filename: AnyStr) -> AnyStr: ... - -# NOTE: Empty lists results in '' (str) regardless of contained type. -# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes -# So, fall back to Any -def commonprefix(m: Sequence[Text]) -> Any: ... -def lexists(path: Text) -> bool: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: Text) -> float: ... -def getmtime(filename: Text) -> float: ... -def getctime(filename: Text) -> float: ... -def getsize(filename: Text) -> int: ... -def isabs(s: Text) -> bool: ... -def isfile(path: Text) -> bool: ... -def isdir(s: Text) -> bool: ... -def islink(path: Text) -> bool: ... -def ismount(path: Text) -> bool: ... - -# Make sure signatures are disjunct, and allow combinations of bytes and unicode. -# (Since Python 2 allows that, too) -# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in -# a type error. -@overload -def join(__p1: bytes, *p: bytes) -> bytes: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ... -@overload -def join(__p1: Text, *p: Text) -> Text: ... -@overload -def relpath(path: str, start: str | None = ...) -> str: ... -@overload -def relpath(path: Text, start: Text | None = ...) -> Text: ... -def samefile(f1: Text, f2: Text) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated - -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/nturl2path.pyi b/stdlib/@python2/nturl2path.pyi deleted file mode 100644 index b87b008..0000000 --- a/stdlib/@python2/nturl2path.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import AnyStr - -def url2pathname(url: AnyStr) -> AnyStr: ... -def pathname2url(p: AnyStr) -> AnyStr: ... diff --git a/stdlib/@python2/numbers.pyi b/stdlib/@python2/numbers.pyi deleted file mode 100644 index fb88e07..0000000 --- a/stdlib/@python2/numbers.pyi +++ /dev/null @@ -1,119 +0,0 @@ -# Note: these stubs are incomplete. The more complex type -# signatures are currently omitted. - -from abc import ABCMeta, abstractmethod -from typing import Any, SupportsFloat - -class Number(metaclass=ABCMeta): - @abstractmethod - def __hash__(self) -> int: ... - -class Complex(Number): - @abstractmethod - def __complex__(self) -> complex: ... - def __nonzero__(self) -> bool: ... - @property - @abstractmethod - def real(self) -> Any: ... - @property - @abstractmethod - def imag(self) -> Any: ... - @abstractmethod - def __add__(self, other: Any) -> Any: ... - @abstractmethod - def __radd__(self, other: Any) -> Any: ... - @abstractmethod - def __neg__(self) -> Any: ... - @abstractmethod - def __pos__(self) -> Any: ... - def __sub__(self, other: Any) -> Any: ... - def __rsub__(self, other: Any) -> Any: ... - @abstractmethod - def __mul__(self, other: Any) -> Any: ... - @abstractmethod - def __rmul__(self, other: Any) -> Any: ... - @abstractmethod - def __div__(self, other): ... - @abstractmethod - def __rdiv__(self, other): ... - @abstractmethod - def __truediv__(self, other: Any) -> Any: ... - @abstractmethod - def __rtruediv__(self, other: Any) -> Any: ... - @abstractmethod - def __pow__(self, exponent: Any) -> Any: ... - @abstractmethod - def __rpow__(self, base: Any) -> Any: ... - def __abs__(self) -> Real: ... - def conjugate(self) -> Any: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... - -class Real(Complex, SupportsFloat): - @abstractmethod - def __float__(self) -> float: ... - @abstractmethod - def __trunc__(self) -> int: ... - def __divmod__(self, other: Any) -> Any: ... - def __rdivmod__(self, other: Any) -> Any: ... - @abstractmethod - def __floordiv__(self, other: Any) -> int: ... - @abstractmethod - def __rfloordiv__(self, other: Any) -> int: ... - @abstractmethod - def __mod__(self, other: Any) -> Any: ... - @abstractmethod - def __rmod__(self, other: Any) -> Any: ... - @abstractmethod - def __lt__(self, other: Any) -> bool: ... - @abstractmethod - def __le__(self, other: Any) -> bool: ... - def __complex__(self) -> complex: ... - @property - def real(self) -> Any: ... - @property - def imag(self) -> Any: ... - def conjugate(self) -> Any: ... - -class Rational(Real): - @property - @abstractmethod - def numerator(self) -> int: ... - @property - @abstractmethod - def denominator(self) -> int: ... - def __float__(self) -> float: ... - -class Integral(Rational): - @abstractmethod - def __long__(self) -> long: ... - def __index__(self) -> int: ... - @abstractmethod - def __pow__(self, exponent: Any, modulus: Any | None = ...) -> Any: ... - @abstractmethod - def __lshift__(self, other: Any) -> Any: ... - @abstractmethod - def __rlshift__(self, other: Any) -> Any: ... - @abstractmethod - def __rshift__(self, other: Any) -> Any: ... - @abstractmethod - def __rrshift__(self, other: Any) -> Any: ... - @abstractmethod - def __and__(self, other: Any) -> Any: ... - @abstractmethod - def __rand__(self, other: Any) -> Any: ... - @abstractmethod - def __xor__(self, other: Any) -> Any: ... - @abstractmethod - def __rxor__(self, other: Any) -> Any: ... - @abstractmethod - def __or__(self, other: Any) -> Any: ... - @abstractmethod - def __ror__(self, other: Any) -> Any: ... - @abstractmethod - def __invert__(self) -> Any: ... - def __float__(self) -> float: ... - @property - def numerator(self) -> int: ... - @property - def denominator(self) -> int: ... diff --git a/stdlib/@python2/opcode.pyi b/stdlib/@python2/opcode.pyi deleted file mode 100644 index 893dd7c..0000000 --- a/stdlib/@python2/opcode.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Dict, List, Sequence - -cmp_op: Sequence[str] -hasconst: List[int] -hasname: List[int] -hasjrel: List[int] -hasjabs: List[int] -haslocal: List[int] -hascompare: List[int] -hasfree: List[int] -opname: List[str] - -opmap: Dict[str, int] -HAVE_ARGUMENT: int -EXTENDED_ARG: int diff --git a/stdlib/@python2/operator.pyi b/stdlib/@python2/operator.pyi deleted file mode 100644 index 76a8a9b..0000000 --- a/stdlib/@python2/operator.pyi +++ /dev/null @@ -1,190 +0,0 @@ -from typing import ( - Any, - Container, - Generic, - Mapping, - MutableMapping, - MutableSequence, - Sequence, - SupportsAbs, - Tuple, - TypeVar, - overload, -) - -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_K = TypeVar("_K") -_V = TypeVar("_V") - -def lt(__a: Any, __b: Any) -> Any: ... -def le(__a: Any, __b: Any) -> Any: ... -def eq(__a: Any, __b: Any) -> Any: ... -def ne(__a: Any, __b: Any) -> Any: ... -def ge(__a: Any, __b: Any) -> Any: ... -def gt(__a: Any, __b: Any) -> Any: ... -def __lt__(a: Any, b: Any) -> Any: ... -def __le__(a: Any, b: Any) -> Any: ... -def __eq__(a: Any, b: Any) -> Any: ... -def __ne__(a: Any, b: Any) -> Any: ... -def __ge__(a: Any, b: Any) -> Any: ... -def __gt__(a: Any, b: Any) -> Any: ... -def not_(__a: Any) -> bool: ... -def __not__(a: Any) -> bool: ... -def truth(__a: Any) -> bool: ... -def is_(__a: Any, __b: Any) -> bool: ... -def is_not(__a: Any, __b: Any) -> bool: ... -def abs(__a: SupportsAbs[_T]) -> _T: ... -def __abs__(a: SupportsAbs[_T]) -> _T: ... -def add(__a: Any, __b: Any) -> Any: ... -def __add__(a: Any, b: Any) -> Any: ... -def and_(__a: Any, __b: Any) -> Any: ... -def __and__(a: Any, b: Any) -> Any: ... -def div(a: Any, b: Any) -> Any: ... -def __div__(a: Any, b: Any) -> Any: ... -def floordiv(__a: Any, __b: Any) -> Any: ... -def __floordiv__(a: Any, b: Any) -> Any: ... -def index(__a: Any) -> int: ... -def __index__(a: Any) -> int: ... -def inv(__a: Any) -> Any: ... -def invert(__a: Any) -> Any: ... -def __inv__(a: Any) -> Any: ... -def __invert__(a: Any) -> Any: ... -def lshift(__a: Any, __b: Any) -> Any: ... -def __lshift__(a: Any, b: Any) -> Any: ... -def mod(__a: Any, __b: Any) -> Any: ... -def __mod__(a: Any, b: Any) -> Any: ... -def mul(__a: Any, __b: Any) -> Any: ... -def __mul__(a: Any, b: Any) -> Any: ... -def neg(__a: Any) -> Any: ... -def __neg__(a: Any) -> Any: ... -def or_(__a: Any, __b: Any) -> Any: ... -def __or__(a: Any, b: Any) -> Any: ... -def pos(__a: Any) -> Any: ... -def __pos__(a: Any) -> Any: ... -def pow(__a: Any, __b: Any) -> Any: ... -def __pow__(a: Any, b: Any) -> Any: ... -def rshift(__a: Any, __b: Any) -> Any: ... -def __rshift__(a: Any, b: Any) -> Any: ... -def sub(__a: Any, __b: Any) -> Any: ... -def __sub__(a: Any, b: Any) -> Any: ... -def truediv(__a: Any, __b: Any) -> Any: ... -def __truediv__(a: Any, b: Any) -> Any: ... -def xor(__a: Any, __b: Any) -> Any: ... -def __xor__(a: Any, b: Any) -> Any: ... -def concat(__a: Sequence[_T], __b: Sequence[_T]) -> Sequence[_T]: ... -def __concat__(a: Sequence[_T], b: Sequence[_T]) -> Sequence[_T]: ... -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[Any], __b: int) -> None: ... -@overload -def delitem(__a: MutableSequence[Any], __b: slice) -> None: ... -@overload -def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ... -@overload -def __delitem__(a: MutableSequence[Any], b: int) -> None: ... -@overload -def __delitem__(a: MutableSequence[Any], b: slice) -> None: ... -@overload -def __delitem__(a: MutableMapping[_K, Any], b: _K) -> None: ... -def delslice(a: MutableSequence[Any], b: int, c: int) -> None: ... -def __delslice__(a: MutableSequence[Any], b: int, c: int) -> None: ... -@overload -def getitem(__a: Sequence[_T], __b: int) -> _T: ... -@overload -def getitem(__a: Sequence[_T], __b: slice) -> Sequence[_T]: ... -@overload -def getitem(__a: Mapping[_K, _V], __b: _K) -> _V: ... -@overload -def __getitem__(a: Sequence[_T], b: int) -> _T: ... -@overload -def __getitem__(a: Sequence[_T], b: slice) -> Sequence[_T]: ... -@overload -def __getitem__(a: Mapping[_K, _V], b: _K) -> _V: ... -def getslice(a: Sequence[_T], b: int, c: int) -> Sequence[_T]: ... -def __getslice__(a: Sequence[_T], b: int, c: int) -> Sequence[_T]: ... -def indexOf(__a: Sequence[_T], __b: _T) -> int: ... -def repeat(a: Any, b: int) -> Any: ... -def __repeat__(a: Any, b: int) -> Any: ... -def sequenceIncludes(a: Container[Any], b: Any) -> bool: ... -@overload -def setitem(__a: MutableSequence[_T], __b: int, __c: _T) -> None: ... -@overload -def setitem(__a: MutableSequence[_T], __b: slice, __c: Sequence[_T]) -> None: ... -@overload -def setitem(__a: MutableMapping[_K, _V], __b: _K, __c: _V) -> None: ... -@overload -def __setitem__(a: MutableSequence[_T], b: int, c: _T) -> None: ... -@overload -def __setitem__(a: MutableSequence[_T], b: slice, c: Sequence[_T]) -> None: ... -@overload -def __setitem__(a: MutableMapping[_K, _V], b: _K, c: _V) -> None: ... -def setslice(a: MutableSequence[_T], b: int, c: int, v: Sequence[_T]) -> None: ... -def __setslice__(a: MutableSequence[_T], b: int, c: int, v: Sequence[_T]) -> None: ... - -class attrgetter(Generic[_T_co]): - @overload - def __new__(cls, attr: str) -> attrgetter[Any]: ... - @overload - def __new__(cls, attr: str, __attr2: str) -> attrgetter[Tuple[Any, Any]]: ... - @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[Tuple[Any, Any, Any]]: ... - @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[Tuple[Any, Any, Any, Any]]: ... - @overload - def __new__(cls, attr: str, *attrs: str) -> attrgetter[Tuple[Any, ...]]: ... - def __call__(self, obj: Any) -> _T_co: ... - -class itemgetter(Generic[_T_co]): - @overload - def __new__(cls, item: Any) -> itemgetter[Any]: ... - @overload - def __new__(cls, item: Any, __item2: Any) -> itemgetter[Tuple[Any, Any]]: ... - @overload - def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[Tuple[Any, Any, Any]]: ... - @overload - def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[Tuple[Any, Any, Any, Any]]: ... - @overload - def __new__(cls, item: Any, *items: Any) -> itemgetter[Tuple[Any, ...]]: ... - def __call__(self, obj: Any) -> _T_co: ... - -class methodcaller: - def __init__(self, __name: str, *args: Any, **kwargs: Any) -> None: ... - def __call__(self, obj: Any) -> Any: ... - -def iadd(__a: Any, __b: Any) -> Any: ... -def __iadd__(a: Any, b: Any) -> Any: ... -def iand(__a: Any, __b: Any) -> Any: ... -def __iand__(a: Any, b: Any) -> Any: ... -def iconcat(__a: Any, __b: Any) -> Any: ... -def __iconcat__(a: Any, b: Any) -> Any: ... -def idiv(a: Any, b: Any) -> Any: ... -def __idiv__(a: Any, b: Any) -> Any: ... -def ifloordiv(__a: Any, __b: Any) -> Any: ... -def __ifloordiv__(a: Any, b: Any) -> Any: ... -def ilshift(__a: Any, __b: Any) -> Any: ... -def __ilshift__(a: Any, b: Any) -> Any: ... -def imod(__a: Any, __b: Any) -> Any: ... -def __imod__(a: Any, b: Any) -> Any: ... -def imul(__a: Any, __b: Any) -> Any: ... -def __imul__(a: Any, b: Any) -> Any: ... -def ior(__a: Any, __b: Any) -> Any: ... -def __ior__(a: Any, b: Any) -> Any: ... -def ipow(__a: Any, __b: Any) -> Any: ... -def __ipow__(a: Any, b: Any) -> Any: ... -def irepeat(a: Any, b: int) -> Any: ... -def __irepeat__(a: Any, b: int) -> Any: ... -def irshift(__a: Any, __b: Any) -> Any: ... -def __irshift__(a: Any, b: Any) -> Any: ... -def isub(__a: Any, __b: Any) -> Any: ... -def __isub__(a: Any, b: Any) -> Any: ... -def itruediv(__a: Any, __b: Any) -> Any: ... -def __itruediv__(a: Any, b: Any) -> Any: ... -def ixor(__a: Any, __b: Any) -> Any: ... -def __ixor__(a: Any, b: Any) -> Any: ... -def isCallable(x: Any) -> bool: ... -def isMappingType(x: Any) -> bool: ... -def isNumberType(x: Any) -> bool: ... -def isSequenceType(x: Any) -> bool: ... diff --git a/stdlib/@python2/optparse.pyi b/stdlib/@python2/optparse.pyi deleted file mode 100644 index 08a926e..0000000 --- a/stdlib/@python2/optparse.pyi +++ /dev/null @@ -1,229 +0,0 @@ -from typing import IO, Any, AnyStr, Callable, Dict, Iterable, List, Mapping, Sequence, Tuple, Type, Union, overload - -# See https://groups.google.com/forum/#!topic/python-ideas/gA1gdj3RZ5g -_Text = Union[str, unicode] - -NO_DEFAULT: Tuple[_Text, ...] -SUPPRESS_HELP: _Text -SUPPRESS_USAGE: _Text - -def check_builtin(option: Option, opt: Any, value: _Text) -> Any: ... -def check_choice(option: Option, opt: Any, value: _Text) -> Any: ... -def isbasestring(x: Any) -> bool: ... - -class OptParseError(Exception): - msg: _Text - def __init__(self, msg: _Text) -> None: ... - -class BadOptionError(OptParseError): - opt_str: _Text - def __init__(self, opt_str: _Text) -> None: ... - -class AmbiguousOptionError(BadOptionError): - possibilities: Iterable[_Text] - def __init__(self, opt_str: _Text, possibilities: Sequence[_Text]) -> None: ... - -class OptionError(OptParseError): - msg: _Text - option_id: _Text - def __init__(self, msg: _Text, option: Option) -> None: ... - -class OptionConflictError(OptionError): ... -class OptionValueError(OptParseError): ... - -class HelpFormatter: - NO_DEFAULT_VALUE: _Text - _long_opt_fmt: _Text - _short_opt_fmt: _Text - current_indent: int - default_tag: _Text - help_position: Any - help_width: Any - indent_increment: int - level: int - max_help_position: int - option_strings: Dict[Option, _Text] - parser: OptionParser - short_first: Any - width: int - def __init__(self, indent_increment: int, max_help_position: int, width: int | None, short_first: int) -> None: ... - def dedent(self) -> None: ... - def expand_default(self, option: Option) -> _Text: ... - def format_description(self, description: _Text) -> _Text: ... - def format_epilog(self, epilog: _Text) -> _Text: ... - def format_heading(self, heading: Any) -> _Text: ... - def format_option(self, option: Option) -> _Text: ... - def format_option_strings(self, option: Option) -> _Text: ... - def format_usage(self, usage: Any) -> _Text: ... - def indent(self) -> None: ... - def set_long_opt_delimiter(self, delim: _Text) -> None: ... - def set_parser(self, parser: OptionParser) -> None: ... - def set_short_opt_delimiter(self, delim: _Text) -> None: ... - def store_option_strings(self, parser: OptionParser) -> None: ... - -class IndentedHelpFormatter(HelpFormatter): - def __init__( - self, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ..., short_first: int = ... - ) -> None: ... - def format_heading(self, heading: _Text) -> _Text: ... - def format_usage(self, usage: _Text) -> _Text: ... - -class TitledHelpFormatter(HelpFormatter): - def __init__( - self, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ..., short_first: int = ... - ) -> None: ... - def format_heading(self, heading: _Text) -> _Text: ... - def format_usage(self, usage: _Text) -> _Text: ... - -class Option: - ACTIONS: Tuple[_Text, ...] - ALWAYS_TYPED_ACTIONS: Tuple[_Text, ...] - ATTRS: List[_Text] - CHECK_METHODS: List[Callable[..., Any]] | None - CONST_ACTIONS: Tuple[_Text, ...] - STORE_ACTIONS: Tuple[_Text, ...] - TYPED_ACTIONS: Tuple[_Text, ...] - TYPES: Tuple[_Text, ...] - TYPE_CHECKER: Dict[_Text, Callable[..., Any]] - _long_opts: List[_Text] - _short_opts: List[_Text] - action: _Text - dest: _Text | None - default: Any - nargs: int - type: Any - callback: Callable[..., Any] | None - callback_args: Tuple[Any, ...] | None - callback_kwargs: Dict[_Text, Any] | None - help: _Text | None - metavar: _Text | None - def __init__(self, *opts: _Text | None, **attrs: Any) -> None: ... - def _check_action(self) -> None: ... - def _check_callback(self) -> None: ... - def _check_choice(self) -> None: ... - def _check_const(self) -> None: ... - def _check_dest(self) -> None: ... - def _check_nargs(self) -> None: ... - def _check_opt_strings(self, opts: Iterable[_Text | None]) -> List[_Text]: ... - def _check_type(self) -> None: ... - def _set_attrs(self, attrs: Dict[_Text, Any]) -> None: ... - def _set_opt_strings(self, opts: Iterable[_Text]) -> None: ... - def check_value(self, opt: _Text, value: Any) -> Any: ... - def convert_value(self, opt: _Text, value: Any) -> Any: ... - def get_opt_string(self) -> _Text: ... - def process(self, opt: Any, value: Any, values: Any, parser: OptionParser) -> int: ... - def take_action(self, action: _Text, dest: _Text, opt: Any, value: Any, values: Any, parser: OptionParser) -> int: ... - def takes_value(self) -> bool: ... - -make_option = Option - -class OptionContainer: - _long_opt: Dict[_Text, Option] - _short_opt: Dict[_Text, Option] - conflict_handler: _Text - defaults: Dict[_Text, Any] - description: Any - option_class: Type[Option] - def __init__(self, option_class: Type[Option], conflict_handler: Any, description: Any) -> None: ... - def _check_conflict(self, option: Any) -> None: ... - def _create_option_mappings(self) -> None: ... - def _share_option_mappings(self, parser: OptionParser) -> None: ... - @overload - def add_option(self, opt: Option) -> Option: ... - @overload - def add_option(self, *args: _Text | None, **kwargs: Any) -> Any: ... - def add_options(self, option_list: Iterable[Option]) -> None: ... - def destroy(self) -> None: ... - def format_description(self, formatter: HelpFormatter | None) -> Any: ... - def format_help(self, formatter: HelpFormatter | None) -> _Text: ... - def format_option_help(self, formatter: HelpFormatter | None) -> _Text: ... - def get_description(self) -> Any: ... - def get_option(self, opt_str: _Text) -> Option | None: ... - def has_option(self, opt_str: _Text) -> bool: ... - def remove_option(self, opt_str: _Text) -> None: ... - def set_conflict_handler(self, handler: Any) -> None: ... - def set_description(self, description: Any) -> None: ... - -class OptionGroup(OptionContainer): - option_list: List[Option] - parser: OptionParser - title: _Text - def __init__(self, parser: OptionParser, title: _Text, description: _Text | None = ...) -> None: ... - def _create_option_list(self) -> None: ... - def set_title(self, title: _Text) -> None: ... - -class Values: - def __init__(self, defaults: Mapping[str, Any] | None = ...) -> None: ... - def _update(self, dict: Mapping[_Text, Any], mode: Any) -> None: ... - def _update_careful(self, dict: Mapping[_Text, Any]) -> None: ... - def _update_loose(self, dict: Mapping[_Text, Any]) -> None: ... - def ensure_value(self, attr: _Text, value: Any) -> Any: ... - def read_file(self, filename: _Text, mode: _Text = ...) -> None: ... - def read_module(self, modname: _Text, mode: _Text = ...) -> None: ... - def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - -class OptionParser(OptionContainer): - allow_interspersed_args: bool - epilog: _Text | None - formatter: HelpFormatter - largs: List[_Text] | None - option_groups: List[OptionGroup] - option_list: List[Option] - process_default_values: Any - prog: _Text | None - rargs: List[Any] | None - standard_option_list: List[Option] - usage: _Text | None - values: Values | None - version: _Text - def __init__( - self, - usage: _Text | None = ..., - option_list: Iterable[Option] | None = ..., - option_class: Type[Option] = ..., - version: _Text | None = ..., - conflict_handler: _Text = ..., - description: _Text | None = ..., - formatter: HelpFormatter | None = ..., - add_help_option: bool = ..., - prog: _Text | None = ..., - epilog: _Text | None = ..., - ) -> None: ... - def _add_help_option(self) -> None: ... - def _add_version_option(self) -> None: ... - def _create_option_list(self) -> None: ... - def _get_all_options(self) -> List[Option]: ... - def _get_args(self, args: Iterable[Any]) -> List[Any]: ... - def _init_parsing_state(self) -> None: ... - def _match_long_opt(self, opt: _Text) -> _Text: ... - def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = ...) -> None: ... - def _process_args(self, largs: List[Any], rargs: List[Any], values: Values) -> None: ... - def _process_long_opt(self, rargs: List[Any], values: Any) -> None: ... - def _process_short_opts(self, rargs: List[Any], values: Any) -> None: ... - @overload - def add_option_group(self, __opt_group: OptionGroup) -> OptionGroup: ... - @overload - def add_option_group(self, *args: Any, **kwargs: Any) -> OptionGroup: ... - def check_values(self, values: Values, args: List[_Text]) -> Tuple[Values, List[_Text]]: ... - def disable_interspersed_args(self) -> None: ... - def enable_interspersed_args(self) -> None: ... - def error(self, msg: _Text) -> None: ... - def exit(self, status: int = ..., msg: str | None = ...) -> None: ... - def expand_prog_name(self, s: _Text | None) -> Any: ... - def format_epilog(self, formatter: HelpFormatter) -> Any: ... - def format_help(self, formatter: HelpFormatter | None = ...) -> _Text: ... - def format_option_help(self, formatter: HelpFormatter | None = ...) -> _Text: ... - def get_default_values(self) -> Values: ... - def get_option_group(self, opt_str: _Text) -> Any: ... - def get_prog_name(self) -> _Text: ... - def get_usage(self) -> _Text: ... - def get_version(self) -> _Text: ... - def parse_args(self, args: Sequence[AnyStr] | None = ..., values: Values | None = ...) -> Tuple[Values, List[AnyStr]]: ... - def print_usage(self, file: IO[str] | None = ...) -> None: ... - def print_help(self, file: IO[str] | None = ...) -> None: ... - def print_version(self, file: IO[str] | None = ...) -> None: ... - def set_default(self, dest: Any, value: Any) -> None: ... - def set_defaults(self, **kwargs: Any) -> None: ... - def set_process_default_values(self, process: Any) -> None: ... - def set_usage(self, usage: _Text) -> None: ... diff --git a/stdlib/@python2/os/__init__.pyi b/stdlib/@python2/os/__init__.pyi deleted file mode 100644 index 1955c07..0000000 --- a/stdlib/@python2/os/__init__.pyi +++ /dev/null @@ -1,334 +0,0 @@ -import sys -from _typeshed import FileDescriptorLike -from builtins import OSError -from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078 -from typing import ( - IO, - Any, - AnyStr, - Callable, - Dict, - Generic, - Iterator, - List, - Mapping, - MutableMapping, - NamedTuple, - NoReturn, - Sequence, - Text, - Tuple, - TypeVar, - Union, - overload, -) - -from . import path as path - -# We need to use something from path, or flake8 and pytype get unhappy -_supports_unicode_filenames = path.supports_unicode_filenames - -_T = TypeVar("_T") - -# ----- os variables ----- - -error = OSError - -SEEK_SET: int -SEEK_CUR: int -SEEK_END: int - -O_RDONLY: int -O_WRONLY: int -O_RDWR: int -O_APPEND: int -O_CREAT: int -O_EXCL: int -O_TRUNC: int -# We don't use sys.platform for O_* flags to denote platform-dependent APIs because some codes, -# including tests for mypy, use a more finer way than sys.platform before using these APIs -# See https://github.com/python/typeshed/pull/2286 for discussions -O_DSYNC: int # Unix only -O_RSYNC: int # Unix only -O_SYNC: int # Unix only -O_NDELAY: int # Unix only -O_NONBLOCK: int # Unix only -O_NOCTTY: int # Unix only -O_SHLOCK: int # Unix only -O_EXLOCK: int # Unix only -O_BINARY: int # Windows only -O_NOINHERIT: int # Windows only -O_SHORT_LIVED: int # Windows only -O_TEMPORARY: int # Windows only -O_RANDOM: int # Windows only -O_SEQUENTIAL: int # Windows only -O_TEXT: int # Windows only -O_ASYNC: int # Gnu extension if in C library -O_DIRECT: int # Gnu extension if in C library -O_DIRECTORY: int # Gnu extension if in C library -O_NOFOLLOW: int # Gnu extension if in C library -O_NOATIME: int # Gnu extension if in C library -O_LARGEFILE: int # Gnu extension if in C library - -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: str | None -extsep: str -pathsep: str -defpath: str -linesep: str -devnull: str -name: str - -F_OK: int -R_OK: int -W_OK: int -X_OK: int - -class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): - def copy(self) -> Dict[AnyStr, AnyStr]: ... - def __delitem__(self, key: AnyStr) -> None: ... - def __getitem__(self, key: AnyStr) -> AnyStr: ... - def __setitem__(self, key: AnyStr, value: AnyStr) -> None: ... - def __iter__(self) -> Iterator[AnyStr]: ... - def __len__(self) -> int: ... - -environ: _Environ[str] -if sys.platform != "win32": - # Unix only - confstr_names: Dict[str, int] - pathconf_names: Dict[str, int] - sysconf_names: Dict[str, int] - - EX_OK: int - EX_USAGE: int - EX_DATAERR: int - EX_NOINPUT: int - EX_NOUSER: int - EX_NOHOST: int - EX_UNAVAILABLE: int - EX_SOFTWARE: int - EX_OSERR: int - EX_OSFILE: int - EX_CANTCREAT: int - EX_IOERR: int - EX_TEMPFAIL: int - EX_PROTOCOL: int - EX_NOPERM: int - EX_CONFIG: int - EX_NOTFOUND: int - -P_NOWAIT: int -P_NOWAITO: int -P_WAIT: int -if sys.platform == "win32": - P_DETACH: int - P_OVERLAY: int - -# wait()/waitpid() options -if sys.platform != "win32": - WNOHANG: int # Unix only - WCONTINUED: int # some Unix systems - WUNTRACED: int # Unix only - -TMP_MAX: int # Undocumented, but used by tempfile - -# ----- os classes (structures) ----- -class _StatVFS(NamedTuple): - f_bsize: int - f_frsize: int - f_blocks: int - f_bfree: int - f_bavail: int - f_files: int - f_ffree: int - f_favail: int - f_flag: int - f_namemax: int - -def getlogin() -> str: ... -def getpid() -> int: ... -def getppid() -> int: ... -def strerror(code: int) -> str: ... -def umask(mask: int) -> int: ... - -if sys.platform != "win32": - def ctermid() -> str: ... - def getegid() -> int: ... - def geteuid() -> int: ... - def getgid() -> int: ... - def getgroups() -> List[int]: ... # Unix only, behaves differently on Mac - def initgroups(username: str, gid: int) -> None: ... - def getpgid(pid: int) -> int: ... - def getpgrp() -> int: ... - def getresuid() -> Tuple[int, int, int]: ... - def getresgid() -> Tuple[int, int, int]: ... - def getuid() -> int: ... - def setegid(egid: int) -> None: ... - def seteuid(euid: int) -> None: ... - def setgid(gid: int) -> None: ... - def setgroups(groups: Sequence[int]) -> None: ... - def setpgrp() -> None: ... - def setpgid(pid: int, pgrp: int) -> None: ... - def setregid(rgid: int, egid: int) -> None: ... - def setresgid(rgid: int, egid: int, sgid: int) -> None: ... - def setresuid(ruid: int, euid: int, suid: int) -> None: ... - def setreuid(ruid: int, euid: int) -> None: ... - def getsid(pid: int) -> int: ... - def setsid() -> None: ... - def setuid(uid: int) -> None: ... - def uname() -> Tuple[str, str, str, str, str]: ... - -@overload -def getenv(key: Text) -> str | None: ... -@overload -def getenv(key: Text, default: _T) -> str | _T: ... -def putenv(key: bytes | Text, value: bytes | Text) -> None: ... -def unsetenv(key: bytes | Text) -> None: ... -def fdopen(fd: int, *args, **kwargs) -> IO[Any]: ... -def close(fd: int) -> None: ... -def closerange(fd_low: int, fd_high: int) -> None: ... -def dup(fd: int) -> int: ... -def dup2(fd: int, fd2: int) -> None: ... -def fstat(fd: int) -> Any: ... -def fsync(fd: FileDescriptorLike) -> None: ... -def lseek(fd: int, pos: int, how: int) -> int: ... -def open(file: Text, flags: int, mode: int = ...) -> int: ... -def pipe() -> Tuple[int, int]: ... -def read(fd: int, n: int) -> bytes: ... -def write(fd: int, string: bytes | buffer) -> int: ... -def access(path: Text, mode: int) -> bool: ... -def chdir(path: Text) -> None: ... -def fchdir(fd: FileDescriptorLike) -> None: ... -def getcwd() -> str: ... -def getcwdu() -> unicode: ... -def chmod(path: Text, mode: int) -> None: ... -def link(src: Text, link_name: Text) -> None: ... -def lstat(path: Text) -> Any: ... -def mknod(filename: Text, mode: int = ..., device: int = ...) -> None: ... -def major(device: int) -> int: ... -def minor(device: int) -> int: ... -def makedev(major: int, minor: int) -> int: ... -def mkdir(path: Text, mode: int = ...) -> None: ... -def makedirs(path: Text, mode: int = ...) -> None: ... -def readlink(path: AnyStr) -> AnyStr: ... -def remove(path: Text) -> None: ... -def removedirs(path: Text) -> None: ... -def rename(src: Text, dst: Text) -> None: ... -def renames(old: Text, new: Text) -> None: ... -def rmdir(path: Text) -> None: ... -def stat(path: Text) -> Any: ... -@overload -def stat_float_times() -> bool: ... -@overload -def stat_float_times(newvalue: bool) -> None: ... -def symlink(source: Text, link_name: Text) -> None: ... -def unlink(path: Text) -> None: ... - -# TODO: add ns, dir_fd, follow_symlinks argument -def utime(path: Text, times: Tuple[float, float] | None) -> None: ... - -if sys.platform != "win32": - # Unix only - def fchmod(fd: int, mode: int) -> None: ... - def fchown(fd: int, uid: int, gid: int) -> None: ... - if sys.platform != "darwin": - def fdatasync(fd: FileDescriptorLike) -> None: ... # Unix only, not Mac - def fpathconf(fd: int, name: str | int) -> int: ... - def fstatvfs(fd: int) -> _StatVFS: ... - def ftruncate(fd: int, length: int) -> None: ... - def isatty(fd: int) -> bool: ... - def openpty() -> Tuple[int, int]: ... # some flavors of Unix - def tcgetpgrp(fd: int) -> int: ... - def tcsetpgrp(fd: int, pg: int) -> None: ... - def ttyname(fd: int) -> str: ... - def chflags(path: Text, flags: int) -> None: ... - def chroot(path: Text) -> None: ... - def chown(path: Text, uid: int, gid: int) -> None: ... - def lchflags(path: Text, flags: int) -> None: ... - def lchmod(path: Text, mode: int) -> None: ... - def lchown(path: Text, uid: int, gid: int) -> None: ... - def mkfifo(path: Text, mode: int = ...) -> None: ... - def pathconf(path: Text, name: str | int) -> int: ... - def statvfs(path: Text) -> _StatVFS: ... - -def walk( - top: AnyStr, topdown: bool = ..., onerror: Callable[[OSError], Any] | None = ..., followlinks: bool = ... -) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ... -def abort() -> NoReturn: ... - -# These are defined as execl(file, *args) but the first *arg is mandatory. -def execl(file: Text, __arg0: bytes | Text, *args: bytes | Text) -> NoReturn: ... -def execlp(file: Text, __arg0: bytes | Text, *args: bytes | Text) -> NoReturn: ... - -# These are: execle(file, *args, env) but env is pulled from the last element of the args. -def execle(file: Text, __arg0: bytes | Text, *args: Any) -> NoReturn: ... -def execlpe(file: Text, __arg0: bytes | Text, *args: Any) -> NoReturn: ... - -# The docs say `args: tuple or list of strings` -# The implementation enforces tuple or list so we can't use Sequence. -_ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]] - -def execv(path: Text, args: _ExecVArgs) -> NoReturn: ... -def execve(path: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... -def execvp(file: Text, args: _ExecVArgs) -> NoReturn: ... -def execvpe(file: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... -def _exit(n: int) -> NoReturn: ... -def kill(pid: int, sig: int) -> None: ... - -if sys.platform != "win32": - # Unix only - def fork() -> int: ... - def forkpty() -> Tuple[int, int]: ... # some flavors of Unix - def killpg(__pgid: int, __signal: int) -> None: ... - def nice(increment: int) -> int: ... - def plock(op: int) -> None: ... # ???op is int? - -def popen(command: str, *args, **kwargs) -> IO[Any]: ... -def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ... -def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ... -def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ... -def spawnl(mode: int, path: Text, arg0: bytes | Text, *args: bytes | Text) -> int: ... -def spawnle(mode: int, path: Text, arg0: bytes | Text, *args: Any) -> int: ... # Imprecise sig -def spawnv(mode: int, path: Text, args: List[bytes | Text]) -> int: ... -def spawnve(mode: int, path: Text, args: List[bytes | Text], env: Mapping[str, str]) -> int: ... -def system(command: Text) -> int: ... -def times() -> Tuple[float, float, float, float, float]: ... -def waitpid(pid: int, options: int) -> Tuple[int, int]: ... -def urandom(n: int) -> bytes: ... - -if sys.platform == "win32": - def startfile(path: Text, operation: str | None = ...) -> None: ... - -else: - # Unix only - def spawnlp(mode: int, file: Text, arg0: bytes | Text, *args: bytes | Text) -> int: ... - def spawnlpe(mode: int, file: Text, arg0: bytes | Text, *args: Any) -> int: ... # Imprecise signature - def spawnvp(mode: int, file: Text, args: List[bytes | Text]) -> int: ... - def spawnvpe(mode: int, file: Text, args: List[bytes | Text], env: Mapping[str, str]) -> int: ... - def wait() -> Tuple[int, int]: ... - def wait3(options: int) -> Tuple[int, int, Any]: ... - def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ... - def WCOREDUMP(status: int) -> bool: ... - def WIFCONTINUED(status: int) -> bool: ... - def WIFSTOPPED(status: int) -> bool: ... - def WIFSIGNALED(status: int) -> bool: ... - def WIFEXITED(status: int) -> bool: ... - def WEXITSTATUS(status: int) -> int: ... - def WSTOPSIG(status: int) -> int: ... - def WTERMSIG(status: int) -> int: ... - def confstr(name: str | int) -> str | None: ... - def getloadavg() -> Tuple[float, float, float]: ... - def sysconf(name: str | int) -> int: ... - -def tmpfile() -> IO[Any]: ... -def tmpnam() -> str: ... -def tempnam(dir: str = ..., prefix: str = ...) -> str: ... - -P_ALL: int -WEXITED: int -WNOWAIT: int diff --git a/stdlib/@python2/os/path.pyi b/stdlib/@python2/os/path.pyi deleted file mode 100644 index 2ce2f59..0000000 --- a/stdlib/@python2/os/path.pyi +++ /dev/null @@ -1,84 +0,0 @@ -import os -import sys -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload - -_T = TypeVar("_T") - -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: str | None -extsep: str -pathsep: str -defpath: str -devnull: str - -# ----- os.path function stubs ----- -def abspath(path: AnyStr) -> AnyStr: ... -def basename(p: AnyStr) -> AnyStr: ... -def dirname(p: AnyStr) -> AnyStr: ... -def expanduser(path: AnyStr) -> AnyStr: ... -def expandvars(path: AnyStr) -> AnyStr: ... -def normcase(s: AnyStr) -> AnyStr: ... -def normpath(path: AnyStr) -> AnyStr: ... - -if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - -else: - def realpath(filename: AnyStr) -> AnyStr: ... - -# NOTE: Empty lists results in '' (str) regardless of contained type. -# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes -# So, fall back to Any -def commonprefix(m: Sequence[Text]) -> Any: ... -def exists(path: Text) -> bool: ... -def lexists(path: Text) -> bool: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: Text) -> float: ... -def getmtime(filename: Text) -> float: ... -def getctime(filename: Text) -> float: ... -def getsize(filename: Text) -> int: ... -def isabs(s: Text) -> bool: ... -def isfile(path: Text) -> bool: ... -def isdir(s: Text) -> bool: ... -def islink(path: Text) -> bool: ... -def ismount(path: Text) -> bool: ... - -# Make sure signatures are disjunct, and allow combinations of bytes and unicode. -# (Since Python 2 allows that, too) -# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in -# a type error. -@overload -def join(__p1: bytes, *p: bytes) -> bytes: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ... -@overload -def join(__p1: Text, *p: Text) -> Text: ... -@overload -def relpath(path: str, start: str | None = ...) -> str: ... -@overload -def relpath(path: Text, start: Text | None = ...) -> Text: ... -def samefile(f1: Text, f2: Text) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated - -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/os2emxpath.pyi b/stdlib/@python2/os2emxpath.pyi deleted file mode 100644 index 514db76..0000000 --- a/stdlib/@python2/os2emxpath.pyi +++ /dev/null @@ -1,84 +0,0 @@ -import os -import sys -from genericpath import exists as exists -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload - -_T = TypeVar("_T") - -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: str | None -extsep: str -pathsep: str -defpath: str -devnull: str - -# ----- os.path function stubs ----- -def abspath(path: AnyStr) -> AnyStr: ... -def basename(p: AnyStr) -> AnyStr: ... -def dirname(p: AnyStr) -> AnyStr: ... -def expanduser(path: AnyStr) -> AnyStr: ... -def expandvars(path: AnyStr) -> AnyStr: ... -def normcase(s: AnyStr) -> AnyStr: ... -def normpath(path: AnyStr) -> AnyStr: ... - -if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - -else: - def realpath(filename: AnyStr) -> AnyStr: ... - -# NOTE: Empty lists results in '' (str) regardless of contained type. -# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes -# So, fall back to Any -def commonprefix(m: Sequence[Text]) -> Any: ... -def lexists(path: Text) -> bool: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: Text) -> float: ... -def getmtime(filename: Text) -> float: ... -def getctime(filename: Text) -> float: ... -def getsize(filename: Text) -> int: ... -def isabs(s: Text) -> bool: ... -def isfile(path: Text) -> bool: ... -def isdir(s: Text) -> bool: ... -def islink(path: Text) -> bool: ... -def ismount(path: Text) -> bool: ... - -# Make sure signatures are disjunct, and allow combinations of bytes and unicode. -# (Since Python 2 allows that, too) -# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in -# a type error. -@overload -def join(__p1: bytes, *p: bytes) -> bytes: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ... -@overload -def join(__p1: Text, *p: Text) -> Text: ... -@overload -def relpath(path: str, start: str | None = ...) -> str: ... -@overload -def relpath(path: Text, start: Text | None = ...) -> Text: ... -def samefile(f1: Text, f2: Text) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated - -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/ossaudiodev.pyi b/stdlib/@python2/ossaudiodev.pyi deleted file mode 100644 index af3e2c2..0000000 --- a/stdlib/@python2/ossaudiodev.pyi +++ /dev/null @@ -1,131 +0,0 @@ -from typing import Any, List, overload -from typing_extensions import Literal - -AFMT_AC3: int -AFMT_A_LAW: int -AFMT_IMA_ADPCM: int -AFMT_MPEG: int -AFMT_MU_LAW: int -AFMT_QUERY: int -AFMT_S16_BE: int -AFMT_S16_LE: int -AFMT_S16_NE: int -AFMT_S8: int -AFMT_U16_BE: int -AFMT_U16_LE: int -AFMT_U8: int -SNDCTL_COPR_HALT: int -SNDCTL_COPR_LOAD: int -SNDCTL_COPR_RCODE: int -SNDCTL_COPR_RCVMSG: int -SNDCTL_COPR_RDATA: int -SNDCTL_COPR_RESET: int -SNDCTL_COPR_RUN: int -SNDCTL_COPR_SENDMSG: int -SNDCTL_COPR_WCODE: int -SNDCTL_COPR_WDATA: int -SNDCTL_DSP_BIND_CHANNEL: int -SNDCTL_DSP_CHANNELS: int -SNDCTL_DSP_GETBLKSIZE: int -SNDCTL_DSP_GETCAPS: int -SNDCTL_DSP_GETCHANNELMASK: int -SNDCTL_DSP_GETFMTS: int -SNDCTL_DSP_GETIPTR: int -SNDCTL_DSP_GETISPACE: int -SNDCTL_DSP_GETODELAY: int -SNDCTL_DSP_GETOPTR: int -SNDCTL_DSP_GETOSPACE: int -SNDCTL_DSP_GETSPDIF: int -SNDCTL_DSP_GETTRIGGER: int -SNDCTL_DSP_MAPINBUF: int -SNDCTL_DSP_MAPOUTBUF: int -SNDCTL_DSP_NONBLOCK: int -SNDCTL_DSP_POST: int -SNDCTL_DSP_PROFILE: int -SNDCTL_DSP_RESET: int -SNDCTL_DSP_SAMPLESIZE: int -SNDCTL_DSP_SETDUPLEX: int -SNDCTL_DSP_SETFMT: int -SNDCTL_DSP_SETFRAGMENT: int -SNDCTL_DSP_SETSPDIF: int -SNDCTL_DSP_SETSYNCRO: int -SNDCTL_DSP_SETTRIGGER: int -SNDCTL_DSP_SPEED: int -SNDCTL_DSP_STEREO: int -SNDCTL_DSP_SUBDIVIDE: int -SNDCTL_DSP_SYNC: int -SNDCTL_FM_4OP_ENABLE: int -SNDCTL_FM_LOAD_INSTR: int -SNDCTL_MIDI_INFO: int -SNDCTL_MIDI_MPUCMD: int -SNDCTL_MIDI_MPUMODE: int -SNDCTL_MIDI_PRETIME: int -SNDCTL_SEQ_CTRLRATE: int -SNDCTL_SEQ_GETINCOUNT: int -SNDCTL_SEQ_GETOUTCOUNT: int -SNDCTL_SEQ_GETTIME: int -SNDCTL_SEQ_NRMIDIS: int -SNDCTL_SEQ_NRSYNTHS: int -SNDCTL_SEQ_OUTOFBAND: int -SNDCTL_SEQ_PANIC: int -SNDCTL_SEQ_PERCMODE: int -SNDCTL_SEQ_RESET: int -SNDCTL_SEQ_RESETSAMPLES: int -SNDCTL_SEQ_SYNC: int -SNDCTL_SEQ_TESTMIDI: int -SNDCTL_SEQ_THRESHOLD: int -SNDCTL_SYNTH_CONTROL: int -SNDCTL_SYNTH_ID: int -SNDCTL_SYNTH_INFO: int -SNDCTL_SYNTH_MEMAVL: int -SNDCTL_SYNTH_REMOVESAMPLE: int -SNDCTL_TMR_CONTINUE: int -SNDCTL_TMR_METRONOME: int -SNDCTL_TMR_SELECT: int -SNDCTL_TMR_SOURCE: int -SNDCTL_TMR_START: int -SNDCTL_TMR_STOP: int -SNDCTL_TMR_TEMPO: int -SNDCTL_TMR_TIMEBASE: int -SOUND_MIXER_ALTPCM: int -SOUND_MIXER_BASS: int -SOUND_MIXER_CD: int -SOUND_MIXER_DIGITAL1: int -SOUND_MIXER_DIGITAL2: int -SOUND_MIXER_DIGITAL3: int -SOUND_MIXER_IGAIN: int -SOUND_MIXER_IMIX: int -SOUND_MIXER_LINE: int -SOUND_MIXER_LINE1: int -SOUND_MIXER_LINE2: int -SOUND_MIXER_LINE3: int -SOUND_MIXER_MIC: int -SOUND_MIXER_MONITOR: int -SOUND_MIXER_NRDEVICES: int -SOUND_MIXER_OGAIN: int -SOUND_MIXER_PCM: int -SOUND_MIXER_PHONEIN: int -SOUND_MIXER_PHONEOUT: int -SOUND_MIXER_RADIO: int -SOUND_MIXER_RECLEV: int -SOUND_MIXER_SPEAKER: int -SOUND_MIXER_SYNTH: int -SOUND_MIXER_TREBLE: int -SOUND_MIXER_VIDEO: int -SOUND_MIXER_VOLUME: int - -control_labels: List[str] -control_names: List[str] - -# TODO: oss_audio_device return type -@overload -def open(mode: Literal["r", "w", "rw"]) -> Any: ... -@overload -def open(device: str, mode: Literal["r", "w", "rw"]) -> Any: ... - -# TODO: oss_mixer_device return type -def openmixer(device: str = ...) -> Any: ... - -class OSSAudioError(Exception): ... - -error = OSSAudioError diff --git a/stdlib/@python2/parser.pyi b/stdlib/@python2/parser.pyi deleted file mode 100644 index ff8bf03..0000000 --- a/stdlib/@python2/parser.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from types import CodeType -from typing import Any, List, Sequence, Text, Tuple - -def expr(source: Text) -> STType: ... -def suite(source: Text) -> STType: ... -def sequence2st(sequence: Sequence[Any]) -> STType: ... -def tuple2st(sequence: Sequence[Any]) -> STType: ... -def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ... -def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ... -def compilest(st: STType, filename: Text = ...) -> CodeType: ... -def isexpr(st: STType) -> bool: ... -def issuite(st: STType) -> bool: ... - -class ParserError(Exception): ... - -class STType: - def compile(self, filename: Text = ...) -> CodeType: ... - def isexpr(self) -> bool: ... - def issuite(self) -> bool: ... - def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ... - def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ... diff --git a/stdlib/@python2/pdb.pyi b/stdlib/@python2/pdb.pyi deleted file mode 100644 index 6d3a6d5..0000000 --- a/stdlib/@python2/pdb.pyi +++ /dev/null @@ -1,165 +0,0 @@ -from bdb import Bdb -from cmd import Cmd -from types import FrameType, TracebackType -from typing import IO, Any, Callable, ClassVar, Dict, Iterable, List, Mapping, Tuple, TypeVar - -_T = TypeVar("_T") - -line_prefix: str # undocumented - -class Restart(Exception): ... - -def run(statement: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... -def runeval(expression: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... -def runctx(statement: str, globals: Dict[str, Any], locals: Mapping[str, Any]) -> None: ... -def runcall(func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... -def set_trace() -> None: ... -def post_mortem(t: TracebackType | None = ...) -> None: ... -def pm() -> None: ... - -class Pdb(Bdb, Cmd): - # Everything here is undocumented, except for __init__ - - commands_resuming: ClassVar[List[str]] - - aliases: Dict[str, str] - mainpyfile: str - _wait_for_mainpyfile: bool - rcLines: List[str] - commands: Dict[int, List[str]] - commands_doprompt: Dict[int, bool] - commands_silent: Dict[int, bool] - commands_defining: bool - commands_bnum: int | None - lineno: int | None - stack: List[Tuple[FrameType, int]] - curindex: int - curframe: FrameType | None - curframe_locals: Mapping[str, Any] - def __init__( - self, completekey: str = ..., stdin: IO[str] | None = ..., stdout: IO[str] | None = ..., skip: Iterable[str] | None = ... - ) -> None: ... - def forget(self) -> None: ... - def setup(self, f: FrameType | None, tb: TracebackType | None) -> None: ... - def execRcLines(self) -> None: ... - def bp_commands(self, frame: FrameType) -> bool: ... - def interaction(self, frame: FrameType | None, traceback: TracebackType | None) -> None: ... - def displayhook(self, obj: object) -> None: ... - def handle_command_def(self, line: str) -> bool: ... - def defaultFile(self) -> str: ... - def lineinfo(self, identifier: str) -> Tuple[None, None, None] | Tuple[str, str, int]: ... - def checkline(self, filename: str, lineno: int) -> int: ... - def _getval(self, arg: str) -> object: ... - def print_stack_trace(self) -> None: ... - def print_stack_entry(self, frame_lineno: Tuple[FrameType, int], prompt_prefix: str = ...) -> None: ... - def lookupmodule(self, filename: str) -> str | None: ... - def _runscript(self, filename: str) -> None: ... - def do_commands(self, arg: str) -> bool | None: ... - def do_break(self, arg: str, temporary: bool = ...) -> bool | None: ... - def do_tbreak(self, arg: str) -> bool | None: ... - def do_enable(self, arg: str) -> bool | None: ... - def do_disable(self, arg: str) -> bool | None: ... - def do_condition(self, arg: str) -> bool | None: ... - def do_ignore(self, arg: str) -> bool | None: ... - def do_clear(self, arg: str) -> bool | None: ... - def do_where(self, arg: str) -> bool | None: ... - def do_up(self, arg: str) -> bool | None: ... - def do_down(self, arg: str) -> bool | None: ... - def do_until(self, arg: str) -> bool | None: ... - def do_step(self, arg: str) -> bool | None: ... - def do_next(self, arg: str) -> bool | None: ... - def do_run(self, arg: str) -> bool | None: ... - def do_return(self, arg: str) -> bool | None: ... - def do_continue(self, arg: str) -> bool | None: ... - def do_jump(self, arg: str) -> bool | None: ... - def do_debug(self, arg: str) -> bool | None: ... - def do_quit(self, arg: str) -> bool | None: ... - def do_EOF(self, arg: str) -> bool | None: ... - def do_args(self, arg: str) -> bool | None: ... - def do_retval(self, arg: str) -> bool | None: ... - def do_p(self, arg: str) -> bool | None: ... - def do_pp(self, arg: str) -> bool | None: ... - def do_list(self, arg: str) -> bool | None: ... - def do_whatis(self, arg: str) -> bool | None: ... - def do_alias(self, arg: str) -> bool | None: ... - def do_unalias(self, arg: str) -> bool | None: ... - def do_help(self, arg: str) -> bool | None: ... - do_b = do_break - do_cl = do_clear - do_w = do_where - do_bt = do_where - do_u = do_up - do_d = do_down - do_unt = do_until - do_s = do_step - do_n = do_next - do_restart = do_run - do_r = do_return - do_c = do_continue - do_cont = do_continue - do_j = do_jump - do_q = do_quit - do_exit = do_quit - do_a = do_args - do_rv = do_retval - do_l = do_list - do_h = do_help - def help_exec(self) -> None: ... - def help_pdb(self) -> None: ... - def help_help(self) -> None: ... - def help_h(self) -> None: ... - def help_where(self) -> None: ... - def help_w(self) -> None: ... - def help_down(self) -> None: ... - def help_d(self) -> None: ... - def help_up(self) -> None: ... - def help_u(self) -> None: ... - def help_break(self) -> None: ... - def help_b(self) -> None: ... - def help_clear(self) -> None: ... - def help_cl(self) -> None: ... - def help_tbreak(self) -> None: ... - def help_enable(self) -> None: ... - def help_disable(self) -> None: ... - def help_ignore(self) -> None: ... - def help_condition(self) -> None: ... - def help_step(self) -> None: ... - def help_s(self) -> None: ... - def help_until(self) -> None: ... - def help_unt(self) -> None: ... - def help_next(self) -> None: ... - def help_n(self) -> None: ... - def help_return(self) -> None: ... - def help_r(self) -> None: ... - def help_continue(self) -> None: ... - def help_cont(self) -> None: ... - def help_c(self) -> None: ... - def help_jump(self) -> None: ... - def help_j(self) -> None: ... - def help_debug(self) -> None: ... - def help_list(self) -> None: ... - def help_l(self) -> None: ... - def help_args(self) -> None: ... - def help_a(self) -> None: ... - def help_p(self) -> None: ... - def help_pp(self) -> None: ... - def help_run(self) -> None: ... - def help_quit(self) -> None: ... - def help_q(self) -> None: ... - def help_whatis(self) -> None: ... - def help_EOF(self) -> None: ... - def help_alias(self) -> None: ... - def help_unalias(self) -> None: ... - def help_commands(self) -> None: ... - help_bt = help_w - help_restart = help_run - help_exit = help_q - -# undocumented - -def find_function(funcname: str, filename: str) -> Tuple[str, str, int] | None: ... -def main() -> None: ... -def help() -> None: ... - -class _rstr(str): - def __repr__(self) -> _rstr: ... diff --git a/stdlib/@python2/pickle.pyi b/stdlib/@python2/pickle.pyi deleted file mode 100644 index 07e32e6..0000000 --- a/stdlib/@python2/pickle.pyi +++ /dev/null @@ -1,95 +0,0 @@ -from typing import IO, Any, Callable, Iterator, Optional, Tuple, Type, Union - -HIGHEST_PROTOCOL: int -bytes_types: Tuple[Type[Any], ...] # undocumented - -def dump(obj: Any, file: IO[bytes], protocol: int | None = ...) -> None: ... -def dumps(obj: Any, protocol: int | None = ...) -> bytes: ... -def load(file: IO[bytes]) -> Any: ... -def loads(string: bytes) -> Any: ... - -class PickleError(Exception): ... -class PicklingError(PickleError): ... -class UnpicklingError(PickleError): ... - -_reducedtype = Union[ - str, - Tuple[Callable[..., Any], Tuple[Any, ...]], - Tuple[Callable[..., Any], Tuple[Any, ...], Any], - Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]]], - Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]], Optional[Iterator[Any]]], -] - -class Pickler: - fast: bool - def __init__(self, file: IO[bytes], protocol: int | None = ...) -> None: ... - def dump(self, __obj: Any) -> None: ... - def clear_memo(self) -> None: ... - def persistent_id(self, obj: Any) -> Any: ... - -class Unpickler: - def __init__(self, file: IO[bytes]) -> None: ... - def load(self) -> Any: ... - def find_class(self, __module_name: str, __global_name: str) -> Any: ... - -MARK: bytes -STOP: bytes -POP: bytes -POP_MARK: bytes -DUP: bytes -FLOAT: bytes -INT: bytes -BININT: bytes -BININT1: bytes -LONG: bytes -BININT2: bytes -NONE: bytes -PERSID: bytes -BINPERSID: bytes -REDUCE: bytes -STRING: bytes -BINSTRING: bytes -SHORT_BINSTRING: bytes -UNICODE: bytes -BINUNICODE: bytes -APPEND: bytes -BUILD: bytes -GLOBAL: bytes -DICT: bytes -EMPTY_DICT: bytes -APPENDS: bytes -GET: bytes -BINGET: bytes -INST: bytes -LONG_BINGET: bytes -LIST: bytes -EMPTY_LIST: bytes -OBJ: bytes -PUT: bytes -BINPUT: bytes -LONG_BINPUT: bytes -SETITEM: bytes -TUPLE: bytes -EMPTY_TUPLE: bytes -SETITEMS: bytes -BINFLOAT: bytes - -TRUE: bytes -FALSE: bytes - -# protocol 2 -PROTO: bytes -NEWOBJ: bytes -EXT1: bytes -EXT2: bytes -EXT4: bytes -TUPLE1: bytes -TUPLE2: bytes -TUPLE3: bytes -NEWTRUE: bytes -NEWFALSE: bytes -LONG1: bytes -LONG4: bytes - -def encode_long(x: int) -> bytes: ... # undocumented -def decode_long(data: bytes) -> int: ... # undocumented diff --git a/stdlib/@python2/pickletools.pyi b/stdlib/@python2/pickletools.pyi deleted file mode 100644 index 14ec0fd..0000000 --- a/stdlib/@python2/pickletools.pyi +++ /dev/null @@ -1,124 +0,0 @@ -from typing import IO, Any, Callable, Iterator, List, MutableMapping, Text, Tuple, Type - -_Reader = Callable[[IO[bytes]], Any] - -UP_TO_NEWLINE: int -TAKEN_FROM_ARGUMENT1: int -TAKEN_FROM_ARGUMENT4: int - -class ArgumentDescriptor(object): - name: str - n: int - reader: _Reader - doc: str - def __init__(self, name: str, n: int, reader: _Reader, doc: str) -> None: ... - -def read_uint1(f: IO[bytes]) -> int: ... - -uint1: ArgumentDescriptor - -def read_uint2(f: IO[bytes]) -> int: ... - -uint2: ArgumentDescriptor - -def read_int4(f: IO[bytes]) -> int: ... - -int4: ArgumentDescriptor - -def read_stringnl(f: IO[bytes], decode: bool = ..., stripquotes: bool = ...) -> bytes | Text: ... - -stringnl: ArgumentDescriptor - -def read_stringnl_noescape(f: IO[bytes]) -> str: ... - -stringnl_noescape: ArgumentDescriptor - -def read_stringnl_noescape_pair(f: IO[bytes]) -> Text: ... - -stringnl_noescape_pair: ArgumentDescriptor - -def read_string1(f: IO[bytes]) -> str: ... - -string1: ArgumentDescriptor - -def read_string4(f: IO[bytes]) -> str: ... - -string4: ArgumentDescriptor - -def read_unicodestringnl(f: IO[bytes]) -> Text: ... - -unicodestringnl: ArgumentDescriptor - -def read_unicodestring4(f: IO[bytes]) -> Text: ... - -unicodestring4: ArgumentDescriptor - -def read_decimalnl_short(f: IO[bytes]) -> int: ... -def read_decimalnl_long(f: IO[bytes]) -> int: ... - -decimalnl_short: ArgumentDescriptor -decimalnl_long: ArgumentDescriptor - -def read_floatnl(f: IO[bytes]) -> float: ... - -floatnl: ArgumentDescriptor - -def read_float8(f: IO[bytes]) -> float: ... - -float8: ArgumentDescriptor - -def read_long1(f: IO[bytes]) -> int: ... - -long1: ArgumentDescriptor - -def read_long4(f: IO[bytes]) -> int: ... - -long4: ArgumentDescriptor - -class StackObject(object): - name: str - obtype: Type[Any] | Tuple[Type[Any], ...] - doc: str - def __init__(self, name: str, obtype: Type[Any] | Tuple[Type[Any], ...], doc: str) -> None: ... - -pyint: StackObject -pylong: StackObject -pyinteger_or_bool: StackObject -pybool: StackObject -pyfloat: StackObject -pystring: StackObject -pyunicode: StackObject -pynone: StackObject -pytuple: StackObject -pylist: StackObject -pydict: StackObject -anyobject: StackObject -markobject: StackObject -stackslice: StackObject - -class OpcodeInfo(object): - name: str - code: str - arg: ArgumentDescriptor | None - stack_before: List[StackObject] - stack_after: List[StackObject] - proto: int - doc: str - def __init__( - self, - name: str, - code: str, - arg: ArgumentDescriptor | None, - stack_before: List[StackObject], - stack_after: List[StackObject], - proto: int, - doc: str, - ) -> None: ... - -opcodes: List[OpcodeInfo] - -def genops(pickle: bytes | IO[bytes]) -> Iterator[Tuple[OpcodeInfo, Any | None, int | None]]: ... -def optimize(p: bytes | IO[bytes]) -> bytes: ... -def dis( - pickle: bytes | IO[bytes], out: IO[str] | None = ..., memo: MutableMapping[int, Any] | None = ..., indentlevel: int = ... -) -> None: ... diff --git a/stdlib/@python2/pipes.pyi b/stdlib/@python2/pipes.pyi deleted file mode 100644 index 5249543..0000000 --- a/stdlib/@python2/pipes.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import IO, Any, AnyStr - -class Template: - def __init__(self) -> None: ... - def reset(self) -> None: ... - def clone(self) -> Template: ... - def debug(self, flag: bool) -> None: ... - def append(self, cmd: str, kind: str) -> None: ... - def prepend(self, cmd: str, kind: str) -> None: ... - def open(self, file: str, mode: str) -> IO[Any]: ... - def copy(self, infile: str, outfile: str) -> None: ... - -def quote(s: AnyStr) -> AnyStr: ... diff --git a/stdlib/@python2/pkgutil.pyi b/stdlib/@python2/pkgutil.pyi deleted file mode 100644 index fd42af9..0000000 --- a/stdlib/@python2/pkgutil.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from _typeshed import SupportsRead -from typing import IO, Any, Callable, Iterable, Iterator, List, Tuple, Union - -Loader = Any -MetaPathFinder = Any -PathEntryFinder = Any - -_ModuleInfoLike = Tuple[Union[MetaPathFinder, PathEntryFinder], str, bool] - -def extend_path(path: List[str], name: str) -> List[str]: ... - -class ImpImporter: - def __init__(self, path: str | None = ...) -> None: ... - -class ImpLoader: - def __init__(self, fullname: str, file: IO[str], filename: str, etc: Tuple[str, str, int]) -> None: ... - -def find_loader(fullname: str) -> Loader | None: ... -def get_importer(path_item: str) -> PathEntryFinder | None: ... -def get_loader(module_or_name: str) -> Loader: ... -def iter_importers(fullname: str = ...) -> Iterator[MetaPathFinder | PathEntryFinder]: ... -def iter_modules(path: Iterable[str] | None = ..., prefix: str = ...) -> Iterator[_ModuleInfoLike]: ... -def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented -def walk_packages( - path: Iterable[str] | None = ..., prefix: str = ..., onerror: Callable[[str], None] | None = ... -) -> Iterator[_ModuleInfoLike]: ... -def get_data(package: str, resource: str) -> bytes | None: ... diff --git a/stdlib/@python2/platform.pyi b/stdlib/@python2/platform.pyi deleted file mode 100644 index b984a2b..0000000 --- a/stdlib/@python2/platform.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from typing import Any, Tuple - -__copyright__: Any -DEV_NULL: Any - -def libc_ver(executable=..., lib=..., version=..., chunksize: int = ...): ... -def linux_distribution(distname=..., version=..., id=..., supported_dists=..., full_distribution_name: int = ...): ... -def dist(distname=..., version=..., id=..., supported_dists=...): ... - -class _popen: - tmpfile: Any - pipe: Any - bufsize: Any - mode: Any - def __init__(self, cmd, mode=..., bufsize: Any | None = ...): ... - def read(self): ... - def readlines(self): ... - def close(self, remove=..., error=...): ... - __del__: Any - -def popen(cmd, mode=..., bufsize: Any | None = ...): ... -def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> Tuple[str, str, str, str]: ... -def mac_ver( - release: str = ..., versioninfo: Tuple[str, str, str] = ..., machine: str = ... -) -> Tuple[str, Tuple[str, str, str], str]: ... -def java_ver( - release: str = ..., vendor: str = ..., vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ... -) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ... -def system_alias(system, release, version): ... -def architecture(executable=..., bits=..., linkage=...) -> Tuple[str, str]: ... -def uname() -> Tuple[str, str, str, str, str, str]: ... -def system() -> str: ... -def node() -> str: ... -def release() -> str: ... -def version() -> str: ... -def machine() -> str: ... -def processor() -> str: ... -def python_implementation() -> str: ... -def python_version() -> str: ... -def python_version_tuple() -> Tuple[str, str, str]: ... -def python_branch() -> str: ... -def python_revision() -> str: ... -def python_build() -> Tuple[str, str]: ... -def python_compiler() -> str: ... -def platform(aliased: int = ..., terse: int = ...) -> str: ... diff --git a/stdlib/@python2/plistlib.pyi b/stdlib/@python2/plistlib.pyi deleted file mode 100644 index d815e3c..0000000 --- a/stdlib/@python2/plistlib.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from typing import IO, Any, Dict as DictT, Mapping, Text, Union - -_Path = Union[str, Text] - -def readPlist(pathOrFile: _Path | IO[bytes]) -> Any: ... -def writePlist(value: Mapping[str, Any], pathOrFile: _Path | IO[bytes]) -> None: ... -def readPlistFromBytes(data: bytes) -> Any: ... -def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ... -def readPlistFromResource(path: _Path, restype: str = ..., resid: int = ...) -> Any: ... -def writePlistToResource(rootObject: Mapping[str, Any], path: _Path, restype: str = ..., resid: int = ...) -> None: ... -def readPlistFromString(data: str) -> Any: ... -def writePlistToString(rootObject: Mapping[str, Any]) -> str: ... - -class Dict(DictT[str, Any]): - def __getattr__(self, attr: str) -> Any: ... - def __setattr__(self, attr: str, value: Any) -> None: ... - def __delattr__(self, attr: str) -> None: ... - -class Data: - data: bytes - def __init__(self, data: bytes) -> None: ... - -class InvalidFileException(ValueError): - def __init__(self, message: str = ...) -> None: ... diff --git a/stdlib/@python2/popen2.pyi b/stdlib/@python2/popen2.pyi deleted file mode 100644 index 0efee4e..0000000 --- a/stdlib/@python2/popen2.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Any, Iterable, TextIO, Tuple, TypeVar - -_T = TypeVar("_T") - -class Popen3: - sts: int - cmd: Iterable[Any] - pid: int - tochild: TextIO - fromchild: TextIO - childerr: TextIO | None - def __init__(self, cmd: Iterable[Any] = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ... - def __del__(self) -> None: ... - def poll(self, _deadstate: _T = ...) -> int | _T: ... - def wait(self) -> int: ... - -class Popen4(Popen3): - childerr: None - cmd: Iterable[Any] - pid: int - tochild: TextIO - fromchild: TextIO - def __init__(self, cmd: Iterable[Any] = ..., bufsize: int = ...) -> None: ... - -def popen2(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ... -def popen3(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ... -def popen4(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ... diff --git a/stdlib/@python2/poplib.pyi b/stdlib/@python2/poplib.pyi deleted file mode 100644 index 7a71f98..0000000 --- a/stdlib/@python2/poplib.pyi +++ /dev/null @@ -1,45 +0,0 @@ -import socket -from typing import Any, BinaryIO, List, Pattern, Text, Tuple, overload - -_LongResp = Tuple[bytes, List[bytes], int] - -class error_proto(Exception): ... - -POP3_PORT: int -POP3_SSL_PORT: int -CR: bytes -LF: bytes -CRLF: bytes - -class POP3: - host: Text - port: int - sock: socket.socket - file: BinaryIO - welcome: bytes - def __init__(self, host: Text, port: int = ..., timeout: float = ...) -> None: ... - def getwelcome(self) -> bytes: ... - def set_debuglevel(self, level: int) -> None: ... - def user(self, user: Text) -> bytes: ... - def pass_(self, pswd: Text) -> bytes: ... - def stat(self) -> Tuple[int, int]: ... - def list(self, which: Any | None = ...) -> _LongResp: ... - def retr(self, which: Any) -> _LongResp: ... - def dele(self, which: Any) -> bytes: ... - def noop(self) -> bytes: ... - def rset(self) -> bytes: ... - def quit(self) -> bytes: ... - def close(self) -> None: ... - def rpop(self, user: Text) -> bytes: ... - timestamp: Pattern[Text] - def apop(self, user: Text, secret: Text) -> bytes: ... - def top(self, which: Any, howmuch: int) -> _LongResp: ... - @overload - def uidl(self) -> _LongResp: ... - @overload - def uidl(self, which: Any) -> bytes: ... - -class POP3_SSL(POP3): - def __init__( - self, host: Text, port: int = ..., keyfile: Text | None = ..., certfile: Text | None = ..., timeout: float = ... - ) -> None: ... diff --git a/stdlib/@python2/posix.pyi b/stdlib/@python2/posix.pyi deleted file mode 100644 index c39ce32..0000000 --- a/stdlib/@python2/posix.pyi +++ /dev/null @@ -1,201 +0,0 @@ -from _typeshed import FileDescriptorLike -from typing import IO, AnyStr, Dict, List, Mapping, NamedTuple, Sequence, Tuple, TypeVar - -error = OSError - -confstr_names: Dict[str, int] -environ: Dict[str, str] -pathconf_names: Dict[str, int] -sysconf_names: Dict[str, int] - -_T = TypeVar("_T") - -EX_CANTCREAT: int -EX_CONFIG: int -EX_DATAERR: int -EX_IOERR: int -EX_NOHOST: int -EX_NOINPUT: int -EX_NOPERM: int -EX_NOUSER: int -EX_OK: int -EX_OSERR: int -EX_OSFILE: int -EX_PROTOCOL: int -EX_SOFTWARE: int -EX_TEMPFAIL: int -EX_UNAVAILABLE: int -EX_USAGE: int -F_OK: int -NGROUPS_MAX: int -O_APPEND: int -O_ASYNC: int -O_CREAT: int -O_DIRECT: int -O_DIRECTORY: int -O_DSYNC: int -O_EXCL: int -O_LARGEFILE: int -O_NDELAY: int -O_NOATIME: int -O_NOCTTY: int -O_NOFOLLOW: int -O_NONBLOCK: int -O_RDONLY: int -O_RDWR: int -O_RSYNC: int -O_SYNC: int -O_TRUNC: int -O_WRONLY: int -R_OK: int -TMP_MAX: int -WCONTINUED: int -WNOHANG: int -WUNTRACED: int -W_OK: int -X_OK: int - -def WCOREDUMP(status: int) -> bool: ... -def WEXITSTATUS(status: int) -> bool: ... -def WIFCONTINUED(status: int) -> bool: ... -def WIFEXITED(status: int) -> bool: ... -def WIFSIGNALED(status: int) -> bool: ... -def WIFSTOPPED(status: int) -> bool: ... -def WSTOPSIG(status: int) -> bool: ... -def WTERMSIG(status: int) -> bool: ... - -class stat_result(object): - n_fields: int - n_sequence_fields: int - n_unnamed_fields: int - st_mode: int - st_ino: int - st_dev: int - st_nlink: int - st_uid: int - st_gid: int - st_size: int - st_atime: int - st_mtime: int - st_ctime: int - -class statvfs_result(NamedTuple): - f_bsize: int - f_frsize: int - f_blocks: int - f_bfree: int - f_bavail: int - f_files: int - f_ffree: int - f_favail: int - f_flag: int - f_namemax: int - -def _exit(status: int) -> None: ... -def abort() -> None: ... -def access(path: unicode, mode: int) -> bool: ... -def chdir(path: unicode) -> None: ... -def chmod(path: unicode, mode: int) -> None: ... -def chown(path: unicode, uid: int, gid: int) -> None: ... -def chroot(path: unicode) -> None: ... -def close(fd: int) -> None: ... -def closerange(fd_low: int, fd_high: int) -> None: ... -def confstr(name: str | int) -> str: ... -def ctermid() -> str: ... -def dup(fd: int) -> int: ... -def dup2(fd: int, fd2: int) -> None: ... -def execv(path: str, args: Sequence[str], env: Mapping[str, str]) -> None: ... -def execve(path: str, args: Sequence[str], env: Mapping[str, str]) -> None: ... -def fchdir(fd: FileDescriptorLike) -> None: ... -def fchmod(fd: int, mode: int) -> None: ... -def fchown(fd: int, uid: int, gid: int) -> None: ... -def fdatasync(fd: FileDescriptorLike) -> None: ... -def fdopen(fd: int, mode: str = ..., bufsize: int = ...) -> IO[str]: ... -def fork() -> int: ... -def forkpty() -> Tuple[int, int]: ... -def fpathconf(fd: int, name: str) -> None: ... -def fstat(fd: int) -> stat_result: ... -def fstatvfs(fd: int) -> statvfs_result: ... -def fsync(fd: FileDescriptorLike) -> None: ... -def ftruncate(fd: int, length: int) -> None: ... -def getcwd() -> str: ... -def getcwdu() -> unicode: ... -def getegid() -> int: ... -def geteuid() -> int: ... -def getgid() -> int: ... -def getgroups() -> List[int]: ... -def getloadavg() -> Tuple[float, float, float]: ... -def getlogin() -> str: ... -def getpgid(pid: int) -> int: ... -def getpgrp() -> int: ... -def getpid() -> int: ... -def getppid() -> int: ... -def getresgid() -> Tuple[int, int, int]: ... -def getresuid() -> Tuple[int, int, int]: ... -def getsid(pid: int) -> int: ... -def getuid() -> int: ... -def initgroups(username: str, gid: int) -> None: ... -def isatty(fd: int) -> bool: ... -def kill(pid: int, sig: int) -> None: ... -def killpg(pgid: int, sig: int) -> None: ... -def lchown(path: unicode, uid: int, gid: int) -> None: ... -def link(source: unicode, link_name: str) -> None: ... -def listdir(path: AnyStr) -> List[AnyStr]: ... -def lseek(fd: int, pos: int, how: int) -> None: ... -def lstat(path: unicode) -> stat_result: ... -def major(device: int) -> int: ... -def makedev(major: int, minor: int) -> int: ... -def minor(device: int) -> int: ... -def mkdir(path: unicode, mode: int = ...) -> None: ... -def mkfifo(path: unicode, mode: int = ...) -> None: ... -def mknod(filename: unicode, mode: int = ..., device: int = ...) -> None: ... -def nice(increment: int) -> int: ... -def open(file: unicode, flags: int, mode: int = ...) -> int: ... -def openpty() -> Tuple[int, int]: ... -def pathconf(path: unicode, name: str) -> str: ... -def pipe() -> Tuple[int, int]: ... -def popen(command: str, mode: str = ..., bufsize: int = ...) -> IO[str]: ... -def putenv(varname: str, value: str) -> None: ... -def read(fd: int, n: int) -> str: ... -def readlink(path: _T) -> _T: ... -def remove(path: unicode) -> None: ... -def rename(src: unicode, dst: unicode) -> None: ... -def rmdir(path: unicode) -> None: ... -def setegid(egid: int) -> None: ... -def seteuid(euid: int) -> None: ... -def setgid(gid: int) -> None: ... -def setgroups(groups: Sequence[int]) -> None: ... -def setpgid(pid: int, pgrp: int) -> None: ... -def setpgrp() -> None: ... -def setregid(rgid: int, egid: int) -> None: ... -def setresgid(rgid: int, egid: int, sgid: int) -> None: ... -def setresuid(ruid: int, euid: int, suid: int) -> None: ... -def setreuid(ruid: int, euid: int) -> None: ... -def setsid() -> None: ... -def setuid(pid: int) -> None: ... -def stat(path: unicode) -> stat_result: ... -def statvfs(path: unicode) -> statvfs_result: ... -def stat_float_times(fd: int) -> None: ... -def strerror(code: int) -> str: ... -def symlink(source: unicode, link_name: unicode) -> None: ... -def sysconf(name: str | int) -> int: ... -def system(command: unicode) -> int: ... -def tcgetpgrp(fd: int) -> int: ... -def tcsetpgrp(fd: int, pg: int) -> None: ... -def times() -> Tuple[float, float, float, float, float]: ... -def tmpfile() -> IO[str]: ... -def ttyname(fd: int) -> str: ... -def umask(mask: int) -> int: ... -def uname() -> Tuple[str, str, str, str, str]: ... -def unlink(path: unicode) -> None: ... -def unsetenv(varname: str) -> None: ... -def urandom(n: int) -> str: ... -def utime(path: unicode, times: Tuple[int, int] | None) -> None: ... -def wait() -> int: ... - -_r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] - -def wait3(options: int) -> Tuple[int, int, _r]: ... -def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ... -def waitpid(pid: int, options: int) -> int: ... -def write(fd: int, str: str) -> int: ... diff --git a/stdlib/@python2/posixpath.pyi b/stdlib/@python2/posixpath.pyi deleted file mode 100644 index 514db76..0000000 --- a/stdlib/@python2/posixpath.pyi +++ /dev/null @@ -1,84 +0,0 @@ -import os -import sys -from genericpath import exists as exists -from typing import Any, AnyStr, Callable, List, Sequence, Text, Tuple, TypeVar, overload - -_T = TypeVar("_T") - -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: str | None -extsep: str -pathsep: str -defpath: str -devnull: str - -# ----- os.path function stubs ----- -def abspath(path: AnyStr) -> AnyStr: ... -def basename(p: AnyStr) -> AnyStr: ... -def dirname(p: AnyStr) -> AnyStr: ... -def expanduser(path: AnyStr) -> AnyStr: ... -def expandvars(path: AnyStr) -> AnyStr: ... -def normcase(s: AnyStr) -> AnyStr: ... -def normpath(path: AnyStr) -> AnyStr: ... - -if sys.platform == "win32": - def realpath(path: AnyStr) -> AnyStr: ... - -else: - def realpath(filename: AnyStr) -> AnyStr: ... - -# NOTE: Empty lists results in '' (str) regardless of contained type. -# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes -# So, fall back to Any -def commonprefix(m: Sequence[Text]) -> Any: ... -def lexists(path: Text) -> bool: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: Text) -> float: ... -def getmtime(filename: Text) -> float: ... -def getctime(filename: Text) -> float: ... -def getsize(filename: Text) -> int: ... -def isabs(s: Text) -> bool: ... -def isfile(path: Text) -> bool: ... -def isdir(s: Text) -> bool: ... -def islink(path: Text) -> bool: ... -def ismount(path: Text) -> bool: ... - -# Make sure signatures are disjunct, and allow combinations of bytes and unicode. -# (Since Python 2 allows that, too) -# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in -# a type error. -@overload -def join(__p1: bytes, *p: bytes) -> bytes: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ... -@overload -def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ... -@overload -def join(__p1: Text, *p: Text) -> Text: ... -@overload -def relpath(path: str, start: str | None = ...) -> str: ... -@overload -def relpath(path: Text, start: Text | None = ...) -> Text: ... -def samefile(f1: Text, f2: Text) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated - -def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/@python2/pprint.pyi b/stdlib/@python2/pprint.pyi deleted file mode 100644 index 407a9af..0000000 --- a/stdlib/@python2/pprint.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import IO, Any, Dict, Tuple - -def pformat(object: object, indent: int = ..., width: int = ..., depth: int | None = ...) -> str: ... -def pprint( - object: object, stream: IO[str] | None = ..., indent: int = ..., width: int = ..., depth: int | None = ... -) -> None: ... -def isreadable(object: object) -> bool: ... -def isrecursive(object: object) -> bool: ... -def saferepr(object: object) -> str: ... - -class PrettyPrinter: - def __init__(self, indent: int = ..., width: int = ..., depth: int | None = ..., stream: IO[str] | None = ...) -> None: ... - def pformat(self, object: object) -> str: ... - def pprint(self, object: object) -> None: ... - def isreadable(self, object: object) -> bool: ... - def isrecursive(self, object: object) -> bool: ... - def format(self, object: object, context: Dict[int, Any], maxlevels: int, level: int) -> Tuple[str, bool, bool]: ... diff --git a/stdlib/@python2/profile.pyi b/stdlib/@python2/profile.pyi deleted file mode 100644 index 08e9b90..0000000 --- a/stdlib/@python2/profile.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from typing import Any, Callable, Dict, Text, Tuple, TypeVar - -def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... -def runctx( - statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ... -) -> None: ... - -_SelfT = TypeVar("_SelfT", bound=Profile) -_T = TypeVar("_T") -_Label = Tuple[str, int, str] - -class Profile: - bias: int - stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented - def __init__(self, timer: Callable[[], float] | None = ..., bias: int | None = ...) -> None: ... - def set_cmd(self, cmd: str) -> None: ... - def simulate_call(self, name: str) -> None: ... - def simulate_cmd_complete(self) -> None: ... - def print_stats(self, sort: str | int = ...) -> None: ... - def dump_stats(self, file: Text) -> None: ... - def create_stats(self) -> None: ... - def snapshot_stats(self) -> None: ... - def run(self: _SelfT, cmd: str) -> _SelfT: ... - def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... - def calibrate(self, m: int, verbose: int = ...) -> float: ... diff --git a/stdlib/@python2/pstats.pyi b/stdlib/@python2/pstats.pyi deleted file mode 100644 index cecd1e8..0000000 --- a/stdlib/@python2/pstats.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from cProfile import Profile as _cProfile -from profile import Profile -from typing import IO, Any, Dict, Iterable, List, Text, Tuple, TypeVar, Union, overload - -_Selector = Union[str, float, int] -_T = TypeVar("_T", bound=Stats) - -class Stats: - sort_arg_dict_default: Dict[str, Tuple[Any, str]] - def __init__( - self: _T, - __arg: None | str | Text | Profile | _cProfile = ..., - *args: None | str | Text | Profile | _cProfile | _T, - stream: IO[Any] | None = ..., - ) -> None: ... - def init(self, arg: None | str | Text | Profile | _cProfile) -> None: ... - def load_stats(self, arg: None | str | Text | Profile | _cProfile) -> None: ... - def get_top_level_stats(self) -> None: ... - def add(self: _T, *arg_list: None | str | Text | Profile | _cProfile | _T) -> _T: ... - def dump_stats(self, filename: Text) -> None: ... - def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ... - @overload - def sort_stats(self: _T, field: int) -> _T: ... - @overload - def sort_stats(self: _T, *field: str) -> _T: ... - def reverse_order(self: _T) -> _T: ... - def strip_dirs(self: _T) -> _T: ... - def calc_callees(self) -> None: ... - def eval_print_amount(self, sel: _Selector, list: List[str], msg: str) -> Tuple[List[str], str]: ... - def get_print_list(self, sel_list: Iterable[_Selector]) -> Tuple[int, List[str]]: ... - def print_stats(self: _T, *amount: _Selector) -> _T: ... - def print_callees(self: _T, *amount: _Selector) -> _T: ... - def print_callers(self: _T, *amount: _Selector) -> _T: ... - def print_call_heading(self, name_size: int, column_title: str) -> None: ... - def print_call_line(self, name_size: int, source: str, call_dict: Dict[str, Any], arrow: str = ...) -> None: ... - def print_title(self) -> None: ... - def print_line(self, func: str) -> None: ... diff --git a/stdlib/@python2/pty.pyi b/stdlib/@python2/pty.pyi deleted file mode 100644 index e8afa2d..0000000 --- a/stdlib/@python2/pty.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Callable, Iterable, Tuple - -_Reader = Callable[[int], bytes] - -STDIN_FILENO: int -STDOUT_FILENO: int -STDERR_FILENO: int - -CHILD: int - -def openpty() -> Tuple[int, int]: ... -def master_open() -> Tuple[int, str]: ... -def slave_open(tty_name: str) -> int: ... -def fork() -> Tuple[int, int]: ... -def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> None: ... diff --git a/stdlib/@python2/pwd.pyi b/stdlib/@python2/pwd.pyi deleted file mode 100644 index 83020c1..0000000 --- a/stdlib/@python2/pwd.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from typing import List, Tuple - -class struct_passwd(Tuple[str, str, int, int, str, str, str]): - pw_name: str - pw_passwd: str - pw_uid: int - pw_gid: int - pw_gecos: str - pw_dir: str - pw_shell: str - -def getpwall() -> List[struct_passwd]: ... -def getpwuid(__uid: int) -> struct_passwd: ... -def getpwnam(__name: str) -> struct_passwd: ... diff --git a/stdlib/@python2/py_compile.pyi b/stdlib/@python2/py_compile.pyi deleted file mode 100644 index 44905b4..0000000 --- a/stdlib/@python2/py_compile.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import List, Text, Type, Union - -_EitherStr = Union[bytes, Text] - -class PyCompileError(Exception): - exc_type_name: str - exc_value: BaseException - file: str - msg: str - def __init__(self, exc_type: Type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ... - -def compile(file: _EitherStr, cfile: _EitherStr | None = ..., dfile: _EitherStr | None = ..., doraise: bool = ...) -> None: ... -def main(args: List[Text] | None = ...) -> int: ... diff --git a/stdlib/@python2/pyclbr.pyi b/stdlib/@python2/pyclbr.pyi deleted file mode 100644 index 8930799..0000000 --- a/stdlib/@python2/pyclbr.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Dict, List, Sequence - -class Class: - module: str - name: str - super: List[Class | str] | None - methods: Dict[str, int] - file: int - lineno: int - def __init__(self, module: str, name: str, super: List[Class | str] | None, file: str, lineno: int) -> None: ... - -class Function: - module: str - name: str - file: int - lineno: int - def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ... - -def readmodule(module: str, path: Sequence[str] | None = ...) -> Dict[str, Class]: ... -def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> Dict[str, Class | Function | List[str]]: ... diff --git a/stdlib/@python2/pydoc.pyi b/stdlib/@python2/pydoc.pyi deleted file mode 100644 index dee0c47..0000000 --- a/stdlib/@python2/pydoc.pyi +++ /dev/null @@ -1,258 +0,0 @@ -from _typeshed import SupportsWrite -from types import MethodType, ModuleType, TracebackType -from typing import ( - IO, - Any, - AnyStr, - Callable, - Container, - Dict, - List, - Mapping, - MutableMapping, - NoReturn, - Optional, - Text, - Tuple, - Type, -) - -from repr import Repr - -# the return type of sys.exc_info(), used by ErrorDuringImport.__init__ -_Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] - -__author__: str -__date__: str -__version__: str -__credits__: str - -def pathdirs() -> List[str]: ... -def getdoc(object: object) -> Text: ... -def splitdoc(doc: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def classname(object: object, modname: str) -> str: ... -def isdata(object: object) -> bool: ... -def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ... -def cram(text: str, maxlen: int) -> str: ... -def stripid(text: str) -> str: ... -def allmethods(cl: type) -> MutableMapping[str, MethodType]: ... -def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ... -def classify_class_attrs(object: object) -> List[Tuple[str, str, type, str]]: ... -def ispackage(path: str) -> bool: ... -def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ... -def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> str | None: ... - -class ErrorDuringImport(Exception): - filename: str - exc: Type[BaseException] | None - value: BaseException | None - tb: TracebackType | None - def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ... - -def importfile(path: str) -> ModuleType: ... -def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ... - -class Doc: - PYTHONDOCS: str - def document(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def fail(self, object: object, name: str | None = ..., *args: Any) -> NoReturn: ... - def docmodule(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def docclass(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def docroutine(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def docother(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def docproperty(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def docdata(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def getdocloc(self, object: object, basedir: str = ...) -> str | None: ... - -class HTMLRepr(Repr): - maxlist: int - maxtuple: int - maxdict: int - maxstring: int - maxother: int - def __init__(self) -> None: ... - def escape(self, text: str) -> str: ... - def repr(self, object: object) -> str: ... - def repr1(self, x: object, level: complex) -> str: ... - def repr_string(self, x: Text, level: complex) -> str: ... - def repr_str(self, x: Text, level: complex) -> str: ... - def repr_instance(self, x: object, level: complex) -> str: ... - def repr_unicode(self, x: AnyStr, level: complex) -> str: ... - -class HTMLDoc(Doc): - repr: Callable[[object], str] - escape: Callable[[str], str] - def page(self, title: str, contents: str) -> str: ... - def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ... - def section( - self, - title: str, - fgcol: str, - bgcol: str, - contents: str, - width: int = ..., - prelude: str = ..., - marginalia: str | None = ..., - gap: str = ..., - ) -> str: ... - def bigsection(self, title: str, *args: Any) -> str: ... - def preformat(self, text: str) -> str: ... - def multicolumn(self, list: List[Any], format: Callable[[Any], str], cols: int = ...) -> str: ... - def grey(self, text: str) -> str: ... - def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ... - def classlink(self, object: object, modname: str) -> str: ... - def modulelink(self, object: object) -> str: ... - def modpkglink(self, modpkginfo: Tuple[str, str, bool, bool]) -> str: ... - def markup( - self, - text: str, - escape: Callable[[str], str] | None = ..., - funcs: Mapping[str, str] = ..., - classes: Mapping[str, str] = ..., - methods: Mapping[str, str] = ..., - ) -> str: ... - def formattree( - self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ... - ) -> str: ... - def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... - def docclass( - self, - object: object, - name: str | None = ..., - mod: str | None = ..., - funcs: Mapping[str, str] = ..., - classes: Mapping[str, str] = ..., - *ignored: Any, - ) -> str: ... - def formatvalue(self, object: object) -> str: ... - def docroutine( - self, - object: object, - name: str | None = ..., - mod: str | None = ..., - funcs: Mapping[str, str] = ..., - classes: Mapping[str, str] = ..., - methods: Mapping[str, str] = ..., - cl: type | None = ..., - *ignored: Any, - ) -> str: ... - def docproperty( - self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docother(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ... - def docdata( - self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = ...) -> str: ... - def filelink(self, url: str, path: str) -> str: ... - -class TextRepr(Repr): - maxlist: int - maxtuple: int - maxdict: int - maxstring: int - maxother: int - def __init__(self) -> None: ... - def repr1(self, x: object, level: complex) -> str: ... - def repr_string(self, x: str, level: complex) -> str: ... - def repr_str(self, x: str, level: complex) -> str: ... - def repr_instance(self, x: object, level: complex) -> str: ... - -class TextDoc(Doc): - repr: Callable[[object], str] - def bold(self, text: str) -> str: ... - def indent(self, text: str, prefix: str = ...) -> str: ... - def section(self, title: str, contents: str) -> str: ... - def formattree( - self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ..., prefix: str = ... - ) -> str: ... - def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ... - def docclass(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... - def formatvalue(self, object: object) -> str: ... - def docroutine( - self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docproperty( - self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docdata( - self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docother( - self, - object: object, - name: str | None = ..., - mod: str | None = ..., - parent: str | None = ..., - maxlen: int | None = ..., - doc: Any | None = ..., - *ignored: Any, - ) -> str: ... - -def pager(text: str) -> None: ... -def getpager() -> Callable[[str], None]: ... -def plain(text: str) -> str: ... -def pipepager(text: str, cmd: str) -> None: ... -def tempfilepager(text: str, cmd: str) -> None: ... -def ttypager(text: str) -> None: ... -def plainpager(text: str) -> None: ... -def describe(thing: Any) -> str: ... -def locate(path: str, forceload: bool = ...) -> object: ... - -text: TextDoc -html: HTMLDoc - -class _OldStyleClass: ... - -def resolve(thing: str | object, forceload: bool = ...) -> Tuple[object, str] | None: ... -def render_doc(thing: str | object, title: str = ..., forceload: bool = ..., renderer: Doc | None = ...) -> str: ... -def doc(thing: str | object, title: str = ..., forceload: bool = ..., output: SupportsWrite[str] | None = ...) -> None: ... -def writedoc(thing: str | object, forceload: bool = ...) -> None: ... -def writedocs(dir: str, pkgpath: str = ..., done: Any | None = ...) -> None: ... - -class Helper: - keywords: Dict[str, str | Tuple[str, str]] - symbols: Dict[str, str] - topics: Dict[str, str | Tuple[str, ...]] - def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ... - input: IO[str] - output: IO[str] - def __call__(self, request: str | Helper | object = ...) -> None: ... - def interact(self) -> None: ... - def getline(self, prompt: str) -> str: ... - def help(self, request: Any) -> None: ... - def intro(self) -> None: ... - def list(self, items: List[str], columns: int = ..., width: int = ...) -> None: ... - def listkeywords(self) -> None: ... - def listsymbols(self) -> None: ... - def listtopics(self) -> None: ... - def showtopic(self, topic: str, more_xrefs: str = ...) -> None: ... - def showsymbol(self, symbol: str) -> None: ... - def listmodules(self, key: str = ...) -> None: ... - -help: Helper - -# See Python issue #11182: "remove the unused and undocumented pydoc.Scanner class" -# class Scanner: -# roots = ... # type: Any -# state = ... # type: Any -# children = ... # type: Any -# descendp = ... # type: Any -# def __init__(self, roots, children, descendp) -> None: ... -# def next(self): ... - -class ModuleScanner: - quit: bool - def run( - self, - callback: Callable[[str | None, str, str], None], - key: Any | None = ..., - completer: Callable[[], None] | None = ..., - onerror: Callable[[str], None] | None = ..., - ) -> None: ... - -def apropos(key: str) -> None: ... -def ispath(x: Any) -> bool: ... -def cli() -> None: ... -def serve(port: int, callback: Callable[[Any], None] | None = ..., completer: Callable[[], None] | None = ...) -> None: ... -def gui() -> None: ... diff --git a/stdlib/@python2/pydoc_data/topics.pyi b/stdlib/@python2/pydoc_data/topics.pyi deleted file mode 100644 index 1c48f40..0000000 --- a/stdlib/@python2/pydoc_data/topics.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Dict - -topics: Dict[str, str] diff --git a/stdlib/@python2/pyexpat/__init__.pyi b/stdlib/@python2/pyexpat/__init__.pyi deleted file mode 100644 index bd73f85..0000000 --- a/stdlib/@python2/pyexpat/__init__.pyi +++ /dev/null @@ -1,75 +0,0 @@ -import pyexpat.errors as errors -import pyexpat.model as model -from _typeshed import SupportsRead -from typing import Any, Callable, Dict, List, Optional, Text, Tuple - -EXPAT_VERSION: str # undocumented -version_info: Tuple[int, int, int] # undocumented -native_encoding: str # undocumented -features: List[Tuple[str, int]] # undocumented - -class ExpatError(Exception): - code: int - lineno: int - offset: int - -error = ExpatError - -XML_PARAM_ENTITY_PARSING_NEVER: int -XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: int -XML_PARAM_ENTITY_PARSING_ALWAYS: int - -_Model = Tuple[int, int, Optional[str], Tuple[Any, ...]] - -class XMLParserType(object): - def Parse(self, __data: Text | bytes, __isfinal: bool = ...) -> int: ... - def ParseFile(self, __file: SupportsRead[bytes]) -> int: ... - def SetBase(self, __base: Text) -> None: ... - def GetBase(self) -> str | None: ... - def GetInputContext(self) -> bytes | None: ... - def ExternalEntityParserCreate(self, __context: Text | None, __encoding: Text = ...) -> XMLParserType: ... - def SetParamEntityParsing(self, __flag: int) -> int: ... - def UseForeignDTD(self, __flag: bool = ...) -> None: ... - buffer_size: int - buffer_text: bool - buffer_used: int - namespace_prefixes: bool # undocumented - ordered_attributes: bool - specified_attributes: bool - ErrorByteIndex: int - ErrorCode: int - ErrorColumnNumber: int - ErrorLineNumber: int - CurrentByteIndex: int - CurrentColumnNumber: int - CurrentLineNumber: int - XmlDeclHandler: Callable[[str, str | None, int], Any] | None - StartDoctypeDeclHandler: Callable[[str, str | None, str | None, bool], Any] | None - EndDoctypeDeclHandler: Callable[[], Any] | None - ElementDeclHandler: Callable[[str, _Model], Any] | None - AttlistDeclHandler: Callable[[str, str, str, str | None, bool], Any] | None - StartElementHandler: Callable[[str, Dict[str, str]], Any] | Callable[[str, List[str]], Any] | Callable[ - [str, Dict[str, str], List[str]], Any - ] | None - EndElementHandler: Callable[[str], Any] | None - ProcessingInstructionHandler: Callable[[str, str], Any] | None - CharacterDataHandler: Callable[[str], Any] | None - UnparsedEntityDeclHandler: Callable[[str, str | None, str, str | None, str], Any] | None - EntityDeclHandler: Callable[[str, bool, str | None, str | None, str, str | None, str | None], Any] | None - NotationDeclHandler: Callable[[str, str | None, str, str | None], Any] | None - StartNamespaceDeclHandler: Callable[[str, str], Any] | None - EndNamespaceDeclHandler: Callable[[str], Any] | None - CommentHandler: Callable[[str], Any] | None - StartCdataSectionHandler: Callable[[], Any] | None - EndCdataSectionHandler: Callable[[], Any] | None - DefaultHandler: Callable[[str], Any] | None - DefaultHandlerExpand: Callable[[str], Any] | None - NotStandaloneHandler: Callable[[], int] | None - ExternalEntityRefHandler: Callable[[str, str | None, str | None, str | None], int] | None - -def ErrorString(__code: int) -> str: ... - -# intern is undocumented -def ParserCreate( - encoding: Text | None = ..., namespace_separator: Text | None = ..., intern: Dict[str, Any] | None = ... -) -> XMLParserType: ... diff --git a/stdlib/@python2/pyexpat/errors.pyi b/stdlib/@python2/pyexpat/errors.pyi deleted file mode 100644 index 498030f..0000000 --- a/stdlib/@python2/pyexpat/errors.pyi +++ /dev/null @@ -1,37 +0,0 @@ -XML_ERROR_ABORTED: str -XML_ERROR_ASYNC_ENTITY: str -XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: str -XML_ERROR_BAD_CHAR_REF: str -XML_ERROR_BINARY_ENTITY_REF: str -XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING: str -XML_ERROR_DUPLICATE_ATTRIBUTE: str -XML_ERROR_ENTITY_DECLARED_IN_PE: str -XML_ERROR_EXTERNAL_ENTITY_HANDLING: str -XML_ERROR_FEATURE_REQUIRES_XML_DTD: str -XML_ERROR_FINISHED: str -XML_ERROR_INCOMPLETE_PE: str -XML_ERROR_INCORRECT_ENCODING: str -XML_ERROR_INVALID_TOKEN: str -XML_ERROR_JUNK_AFTER_DOC_ELEMENT: str -XML_ERROR_MISPLACED_XML_PI: str -XML_ERROR_NOT_STANDALONE: str -XML_ERROR_NOT_SUSPENDED: str -XML_ERROR_NO_ELEMENTS: str -XML_ERROR_NO_MEMORY: str -XML_ERROR_PARAM_ENTITY_REF: str -XML_ERROR_PARTIAL_CHAR: str -XML_ERROR_PUBLICID: str -XML_ERROR_RECURSIVE_ENTITY_REF: str -XML_ERROR_SUSPENDED: str -XML_ERROR_SUSPEND_PE: str -XML_ERROR_SYNTAX: str -XML_ERROR_TAG_MISMATCH: str -XML_ERROR_TEXT_DECL: str -XML_ERROR_UNBOUND_PREFIX: str -XML_ERROR_UNCLOSED_CDATA_SECTION: str -XML_ERROR_UNCLOSED_TOKEN: str -XML_ERROR_UNDECLARING_PREFIX: str -XML_ERROR_UNDEFINED_ENTITY: str -XML_ERROR_UNEXPECTED_STATE: str -XML_ERROR_UNKNOWN_ENCODING: str -XML_ERROR_XML_DECL: str diff --git a/stdlib/@python2/pyexpat/model.pyi b/stdlib/@python2/pyexpat/model.pyi deleted file mode 100644 index f357cf6..0000000 --- a/stdlib/@python2/pyexpat/model.pyi +++ /dev/null @@ -1,11 +0,0 @@ -XML_CTYPE_ANY: int -XML_CTYPE_CHOICE: int -XML_CTYPE_EMPTY: int -XML_CTYPE_MIXED: int -XML_CTYPE_NAME: int -XML_CTYPE_SEQ: int - -XML_CQUANT_NONE: int -XML_CQUANT_OPT: int -XML_CQUANT_PLUS: int -XML_CQUANT_REP: int diff --git a/stdlib/@python2/quopri.pyi b/stdlib/@python2/quopri.pyi deleted file mode 100644 index c2ffabe..0000000 --- a/stdlib/@python2/quopri.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import BinaryIO - -def encode(input: BinaryIO, output: BinaryIO, quotetabs: int, header: int = ...) -> None: ... -def encodestring(s: bytes, quotetabs: int = ..., header: int = ...) -> bytes: ... -def decode(input: BinaryIO, output: BinaryIO, header: int = ...) -> None: ... -def decodestring(s: bytes, header: int = ...) -> bytes: ... diff --git a/stdlib/@python2/random.pyi b/stdlib/@python2/random.pyi deleted file mode 100644 index 6fb5d60..0000000 --- a/stdlib/@python2/random.pyi +++ /dev/null @@ -1,67 +0,0 @@ -import _random -from typing import Any, Callable, Iterator, List, MutableSequence, Protocol, Sequence, TypeVar, overload - -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) - -class _Sampleable(Protocol[_T_co]): - def __iter__(self) -> Iterator[_T_co]: ... - def __len__(self) -> int: ... - -class Random(_random.Random): - def __init__(self, x: object = ...) -> None: ... - def seed(self, x: object = ...) -> None: ... - def getstate(self) -> _random._State: ... - def setstate(self, state: _random._State) -> None: ... - def jumpahead(self, n: int) -> None: ... - def getrandbits(self, k: int) -> int: ... - @overload - def randrange(self, stop: int) -> int: ... - @overload - def randrange(self, start: int, stop: int, step: int = ...) -> int: ... - def randint(self, a: int, b: int) -> int: ... - def choice(self, seq: Sequence[_T]) -> _T: ... - def shuffle(self, x: MutableSequence[Any], random: Callable[[], None] = ...) -> None: ... - def sample(self, population: _Sampleable[_T], k: int) -> List[_T]: ... - def random(self) -> float: ... - def uniform(self, a: float, b: float) -> float: ... - def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ... - def betavariate(self, alpha: float, beta: float) -> float: ... - def expovariate(self, lambd: float) -> float: ... - def gammavariate(self, alpha: float, beta: float) -> float: ... - def gauss(self, mu: float, sigma: float) -> float: ... - def lognormvariate(self, mu: float, sigma: float) -> float: ... - def normalvariate(self, mu: float, sigma: float) -> float: ... - def vonmisesvariate(self, mu: float, kappa: float) -> float: ... - def paretovariate(self, alpha: float) -> float: ... - def weibullvariate(self, alpha: float, beta: float) -> float: ... - -# SystemRandom is not implemented for all OS's; good on Windows & Linux -class SystemRandom(Random): ... - -# ----- random function stubs ----- -def seed(x: object = ...) -> None: ... -def getstate() -> object: ... -def setstate(state: object) -> None: ... -def jumpahead(n: int) -> None: ... -def getrandbits(k: int) -> int: ... -@overload -def randrange(stop: int) -> int: ... -@overload -def randrange(start: int, stop: int, step: int = ...) -> int: ... -def randint(a: int, b: int) -> int: ... -def choice(seq: Sequence[_T]) -> _T: ... -def shuffle(x: MutableSequence[Any], random: Callable[[], float] = ...) -> None: ... -def sample(population: _Sampleable[_T], k: int) -> List[_T]: ... -def random() -> float: ... -def uniform(a: float, b: float) -> float: ... -def triangular(low: float = ..., high: float = ..., mode: float = ...) -> float: ... -def betavariate(alpha: float, beta: float) -> float: ... -def expovariate(lambd: float) -> float: ... -def gammavariate(alpha: float, beta: float) -> float: ... -def gauss(mu: float, sigma: float) -> float: ... -def lognormvariate(mu: float, sigma: float) -> float: ... -def normalvariate(mu: float, sigma: float) -> float: ... -def vonmisesvariate(mu: float, kappa: float) -> float: ... -def paretovariate(alpha: float) -> float: ... -def weibullvariate(alpha: float, beta: float) -> float: ... diff --git a/stdlib/@python2/re.pyi b/stdlib/@python2/re.pyi deleted file mode 100644 index fbe021c..0000000 --- a/stdlib/@python2/re.pyi +++ /dev/null @@ -1,87 +0,0 @@ -from typing import Any, AnyStr, Callable, Iterator, List, Match, Pattern, Tuple, overload - -# ----- re variables and constants ----- -DEBUG: int -I: int -IGNORECASE: int -L: int -LOCALE: int -M: int -MULTILINE: int -S: int -DOTALL: int -X: int -VERBOSE: int -U: int -UNICODE: int -T: int -TEMPLATE: int - -class error(Exception): ... - -@overload -def compile(pattern: AnyStr, flags: int = ...) -> Pattern[AnyStr]: ... -@overload -def compile(pattern: Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ... -@overload -def search(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ... -@overload -def search(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ... -@overload -def match(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ... -@overload -def match(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ... -@overload -def split(pattern: str | unicode, string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ... -@overload -def split(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ... -@overload -def findall(pattern: str | unicode, string: AnyStr, flags: int = ...) -> List[Any]: ... -@overload -def findall(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> List[Any]: ... - -# Return an iterator yielding match objects over all non-overlapping matches -# for the RE pattern in string. The string is scanned left-to-right, and -# matches are returned in the order found. Empty matches are included in the -# result unless they touch the beginning of another match. -@overload -def finditer(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ... -@overload -def finditer(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ... -@overload -def sub(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ... -@overload -def sub( - pattern: str | unicode, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ... -) -> AnyStr: ... -@overload -def sub(pattern: Pattern[str] | Pattern[unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ... -@overload -def sub( - pattern: Pattern[str] | Pattern[unicode], - repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, - count: int = ..., - flags: int = ..., -) -> AnyStr: ... -@overload -def subn(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> Tuple[AnyStr, int]: ... -@overload -def subn( - pattern: str | unicode, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ... -) -> Tuple[AnyStr, int]: ... -@overload -def subn( - pattern: Pattern[str] | Pattern[unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ... -) -> Tuple[AnyStr, int]: ... -@overload -def subn( - pattern: Pattern[str] | Pattern[unicode], - repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, - count: int = ..., - flags: int = ..., -) -> Tuple[AnyStr, int]: ... -def escape(string: AnyStr) -> AnyStr: ... -def purge() -> None: ... -def template(pattern: AnyStr | Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ... diff --git a/stdlib/@python2/readline.pyi b/stdlib/@python2/readline.pyi deleted file mode 100644 index fb9b12d..0000000 --- a/stdlib/@python2/readline.pyi +++ /dev/null @@ -1,30 +0,0 @@ -from typing import Callable, Optional, Sequence, Text - -_CompleterT = Optional[Callable[[str, int], Optional[str]]] -_CompDispT = Optional[Callable[[str, Sequence[str], int], None]] - -def parse_and_bind(__string: str) -> None: ... -def read_init_file(__filename: Text | None = ...) -> None: ... -def get_line_buffer() -> str: ... -def insert_text(__string: str) -> None: ... -def redisplay() -> None: ... -def read_history_file(__filename: Text | None = ...) -> None: ... -def write_history_file(__filename: Text | None = ...) -> None: ... -def get_history_length() -> int: ... -def set_history_length(__length: int) -> None: ... -def clear_history() -> None: ... -def get_current_history_length() -> int: ... -def get_history_item(__index: int) -> str: ... -def remove_history_item(__pos: int) -> None: ... -def replace_history_item(__pos: int, __line: str) -> None: ... -def add_history(__string: str) -> None: ... -def set_startup_hook(__function: Callable[[], None] | None = ...) -> None: ... -def set_pre_input_hook(__function: Callable[[], None] | None = ...) -> None: ... -def set_completer(__function: _CompleterT = ...) -> None: ... -def get_completer() -> _CompleterT: ... -def get_completion_type() -> int: ... -def get_begidx() -> int: ... -def get_endidx() -> int: ... -def set_completer_delims(__string: str) -> None: ... -def get_completer_delims() -> str: ... -def set_completion_display_matches_hook(__function: _CompDispT = ...) -> None: ... diff --git a/stdlib/@python2/repr.pyi b/stdlib/@python2/repr.pyi deleted file mode 100644 index bdb8822..0000000 --- a/stdlib/@python2/repr.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from typing import Any, List - -class Repr: - maxarray: int - maxdeque: int - maxdict: int - maxfrozenset: int - maxlevel: int - maxlist: int - maxlong: int - maxother: int - maxset: int - maxstring: int - maxtuple: int - def __init__(self) -> None: ... - def _repr_iterable(self, x, level: complex, left, right, maxiter, trail=...) -> str: ... - def repr(self, x) -> str: ... - def repr1(self, x, level: complex) -> str: ... - def repr_array(self, x, level: complex) -> str: ... - def repr_deque(self, x, level: complex) -> str: ... - def repr_dict(self, x, level: complex) -> str: ... - def repr_frozenset(self, x, level: complex) -> str: ... - def repr_instance(self, x, level: complex) -> str: ... - def repr_list(self, x, level: complex) -> str: ... - def repr_long(self, x, level: complex) -> str: ... - def repr_set(self, x, level: complex) -> str: ... - def repr_str(self, x, level: complex) -> str: ... - def repr_tuple(self, x, level: complex) -> str: ... - -def _possibly_sorted(x) -> List[Any]: ... - -aRepr: Repr - -def repr(x) -> str: ... diff --git a/stdlib/@python2/resource.pyi b/stdlib/@python2/resource.pyi deleted file mode 100644 index ad9502d..0000000 --- a/stdlib/@python2/resource.pyi +++ /dev/null @@ -1,46 +0,0 @@ -from typing import NamedTuple, Tuple - -class error(Exception): ... - -RLIM_INFINITY: int - -def getrlimit(resource: int) -> Tuple[int, int]: ... -def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ... - -RLIMIT_CORE: int -RLIMIT_CPU: int -RLIMIT_FSIZE: int -RLIMIT_DATA: int -RLIMIT_STACK: int -RLIMIT_RSS: int -RLIMIT_NPROC: int -RLIMIT_NOFILE: int -RLIMIT_OFILE: int -RLIMIT_MEMLOCK: int -RLIMIT_VMEM: int -RLIMIT_AS: int - -class _RUsage(NamedTuple): - ru_utime: float - ru_stime: float - ru_maxrss: int - ru_ixrss: int - ru_idrss: int - ru_isrss: int - ru_minflt: int - ru_majflt: int - ru_nswap: int - ru_inblock: int - ru_oublock: int - ru_msgsnd: int - ru_msgrcv: int - ru_nsignals: int - ru_nvcsw: int - ru_nivcsw: int - -def getrusage(who: int) -> _RUsage: ... -def getpagesize() -> int: ... - -RUSAGE_SELF: int -RUSAGE_CHILDREN: int -RUSAGE_BOTH: int diff --git a/stdlib/@python2/rfc822.pyi b/stdlib/@python2/rfc822.pyi deleted file mode 100644 index d6ae003..0000000 --- a/stdlib/@python2/rfc822.pyi +++ /dev/null @@ -1,75 +0,0 @@ -from typing import Any - -class Message: - fp: Any - seekable: Any - startofheaders: Any - startofbody: Any - def __init__(self, fp, seekable: int = ...): ... - def rewindbody(self): ... - dict: Any - unixfrom: Any - headers: Any - status: Any - def readheaders(self): ... - def isheader(self, line): ... - def islast(self, line): ... - def iscomment(self, line): ... - def getallmatchingheaders(self, name): ... - def getfirstmatchingheader(self, name): ... - def getrawheader(self, name): ... - def getheader(self, name, default: Any | None = ...): ... - get: Any - def getheaders(self, name): ... - def getaddr(self, name): ... - def getaddrlist(self, name): ... - def getdate(self, name): ... - def getdate_tz(self, name): ... - def __len__(self): ... - def __getitem__(self, name): ... - def __setitem__(self, name, value): ... - def __delitem__(self, name): ... - def setdefault(self, name, default=...): ... - def has_key(self, name): ... - def __contains__(self, name): ... - def __iter__(self): ... - def keys(self): ... - def values(self): ... - def items(self): ... - -class AddrlistClass: - specials: Any - pos: Any - LWS: Any - CR: Any - atomends: Any - phraseends: Any - field: Any - commentlist: Any - def __init__(self, field): ... - def gotonext(self): ... - def getaddrlist(self): ... - def getaddress(self): ... - def getrouteaddr(self): ... - def getaddrspec(self): ... - def getdomain(self): ... - def getdelimited(self, beginchar, endchars, allowcomments: int = ...): ... - def getquote(self): ... - def getcomment(self): ... - def getdomainliteral(self): ... - def getatom(self, atomends: Any | None = ...): ... - def getphraselist(self): ... - -class AddressList(AddrlistClass): - addresslist: Any - def __init__(self, field): ... - def __len__(self): ... - def __add__(self, other): ... - def __iadd__(self, other): ... - def __sub__(self, other): ... - def __isub__(self, other): ... - def __getitem__(self, index): ... - -def parsedate_tz(data): ... -def parsedate(data): ... -def mktime_tz(data): ... diff --git a/stdlib/@python2/rlcompleter.pyi b/stdlib/@python2/rlcompleter.pyi deleted file mode 100644 index a61c61e..0000000 --- a/stdlib/@python2/rlcompleter.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Any, Dict, Union - -_Text = Union[str, unicode] - -class Completer: - def __init__(self, namespace: Dict[str, Any] | None = ...) -> None: ... - def complete(self, text: _Text, state: int) -> str | None: ... diff --git a/stdlib/@python2/robotparser.pyi b/stdlib/@python2/robotparser.pyi deleted file mode 100644 index 403039a..0000000 --- a/stdlib/@python2/robotparser.pyi +++ /dev/null @@ -1,7 +0,0 @@ -class RobotFileParser: - def set_url(self, url: str): ... - def read(self): ... - def parse(self, lines: str): ... - def can_fetch(self, user_agent: str, url: str): ... - def mtime(self): ... - def modified(self): ... diff --git a/stdlib/@python2/runpy.pyi b/stdlib/@python2/runpy.pyi deleted file mode 100644 index 3d5f050..0000000 --- a/stdlib/@python2/runpy.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import Any - -class _TempModule: - mod_name: Any - module: Any - def __init__(self, mod_name): ... - def __enter__(self): ... - def __exit__(self, *args): ... - -class _ModifiedArgv0: - value: Any - def __init__(self, value): ... - def __enter__(self): ... - def __exit__(self, *args): ... - -def run_module(mod_name, init_globals: Any | None = ..., run_name: Any | None = ..., alter_sys: bool = ...): ... -def run_path(path_name, init_globals: Any | None = ..., run_name: Any | None = ...): ... diff --git a/stdlib/@python2/sched.pyi b/stdlib/@python2/sched.pyi deleted file mode 100644 index f718dd7..0000000 --- a/stdlib/@python2/sched.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any, Callable, Dict, List, NamedTuple, Text, Tuple - -class Event(NamedTuple): - time: float - priority: Any - action: Callable[..., Any] - argument: Tuple[Any, ...] - kwargs: Dict[Text, Any] - -class scheduler: - def __init__(self, timefunc: Callable[[], float], delayfunc: Callable[[float], None]) -> None: ... - def enterabs(self, time: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ... - def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ... - def run(self) -> None: ... - def cancel(self, event: Event) -> None: ... - def empty(self) -> bool: ... - @property - def queue(self) -> List[Event]: ... diff --git a/stdlib/@python2/select.pyi b/stdlib/@python2/select.pyi deleted file mode 100644 index b960fd4..0000000 --- a/stdlib/@python2/select.pyi +++ /dev/null @@ -1,124 +0,0 @@ -import sys -from _typeshed import FileDescriptorLike -from typing import Any, Iterable, List, Tuple - -if sys.platform != "win32": - PIPE_BUF: int - POLLERR: int - POLLHUP: int - POLLIN: int - POLLMSG: int - POLLNVAL: int - POLLOUT: int - POLLPRI: int - POLLRDBAND: int - POLLRDNORM: int - POLLWRBAND: int - POLLWRNORM: int - -class poll: - def __init__(self) -> None: ... - def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... - def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... - def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> List[Tuple[int, int]]: ... - -def select( - __rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: float | None = ... -) -> Tuple[List[Any], List[Any], List[Any]]: ... - -class error(Exception): ... - -if sys.platform != "linux" and sys.platform != "win32": - # BSD only - class kevent(object): - data: Any - fflags: int - filter: int - flags: int - ident: int - udata: Any - def __init__( - self, - ident: FileDescriptorLike, - filter: int = ..., - flags: int = ..., - fflags: int = ..., - data: Any = ..., - udata: Any = ..., - ) -> None: ... - # BSD only - class kqueue(object): - closed: bool - def __init__(self) -> None: ... - def close(self) -> None: ... - def control( - self, __changelist: Iterable[kevent] | None, __maxevents: int, __timeout: float | None = ... - ) -> List[kevent]: ... - def fileno(self) -> int: ... - @classmethod - def fromfd(cls, __fd: FileDescriptorLike) -> kqueue: ... - KQ_EV_ADD: int - KQ_EV_CLEAR: int - KQ_EV_DELETE: int - KQ_EV_DISABLE: int - KQ_EV_ENABLE: int - KQ_EV_EOF: int - KQ_EV_ERROR: int - KQ_EV_FLAG1: int - KQ_EV_ONESHOT: int - KQ_EV_SYSFLAGS: int - KQ_FILTER_AIO: int - KQ_FILTER_NETDEV: int - KQ_FILTER_PROC: int - KQ_FILTER_READ: int - KQ_FILTER_SIGNAL: int - KQ_FILTER_TIMER: int - KQ_FILTER_VNODE: int - KQ_FILTER_WRITE: int - KQ_NOTE_ATTRIB: int - KQ_NOTE_CHILD: int - KQ_NOTE_DELETE: int - KQ_NOTE_EXEC: int - KQ_NOTE_EXIT: int - KQ_NOTE_EXTEND: int - KQ_NOTE_FORK: int - KQ_NOTE_LINK: int - if sys.platform != "darwin": - KQ_NOTE_LINKDOWN: int - KQ_NOTE_LINKINV: int - KQ_NOTE_LINKUP: int - KQ_NOTE_LOWAT: int - KQ_NOTE_PCTRLMASK: int - KQ_NOTE_PDATAMASK: int - KQ_NOTE_RENAME: int - KQ_NOTE_REVOKE: int - KQ_NOTE_TRACK: int - KQ_NOTE_TRACKERR: int - KQ_NOTE_WRITE: int - -if sys.platform == "linux": - class epoll(object): - def __init__(self, sizehint: int = ...) -> None: ... - def close(self) -> None: ... - closed: bool - def fileno(self) -> int: ... - def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... - def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... - def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ..., maxevents: int = ...) -> List[Tuple[int, int]]: ... - @classmethod - def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ... - EPOLLERR: int - EPOLLET: int - EPOLLHUP: int - EPOLLIN: int - EPOLLMSG: int - EPOLLONESHOT: int - EPOLLOUT: int - EPOLLPRI: int - EPOLLRDBAND: int - EPOLLRDNORM: int - EPOLLWRBAND: int - EPOLLWRNORM: int - EPOLL_RDHUP: int diff --git a/stdlib/@python2/sets.pyi b/stdlib/@python2/sets.pyi deleted file mode 100644 index d2b94ea..0000000 --- a/stdlib/@python2/sets.pyi +++ /dev/null @@ -1,60 +0,0 @@ -from typing import Any, Hashable, Iterable, Iterator, MutableMapping, TypeVar, Union - -_T = TypeVar("_T") -_Setlike = Union[BaseSet[_T], Iterable[_T]] -_SelfT = TypeVar("_SelfT") - -class BaseSet(Iterable[_T]): - def __init__(self) -> None: ... - def __len__(self) -> int: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... - def __iter__(self) -> Iterator[_T]: ... - def __cmp__(self, other: Any) -> int: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... - def copy(self: _SelfT) -> _SelfT: ... - def __copy__(self: _SelfT) -> _SelfT: ... - def __deepcopy__(self: _SelfT, memo: MutableMapping[int, BaseSet[_T]]) -> _SelfT: ... - def __or__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def union(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ... - def __and__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def intersection(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ... - def __xor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def symmetric_difference(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ... - def __sub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def difference(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ... - def __contains__(self, element: Any) -> bool: ... - def issubset(self, other: BaseSet[_T]) -> bool: ... - def issuperset(self, other: BaseSet[_T]) -> bool: ... - def __le__(self, other: BaseSet[_T]) -> bool: ... - def __ge__(self, other: BaseSet[_T]) -> bool: ... - def __lt__(self, other: BaseSet[_T]) -> bool: ... - def __gt__(self, other: BaseSet[_T]) -> bool: ... - -class ImmutableSet(BaseSet[_T], Hashable): - def __init__(self, iterable: _Setlike[_T] | None = ...) -> None: ... - def __hash__(self) -> int: ... - -class Set(BaseSet[_T]): - def __init__(self, iterable: _Setlike[_T] | None = ...) -> None: ... - def __ior__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def union_update(self, other: _Setlike[_T]) -> None: ... - def __iand__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def intersection_update(self, other: _Setlike[Any]) -> None: ... - def __ixor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def symmetric_difference_update(self, other: _Setlike[_T]) -> None: ... - def __isub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ... - def difference_update(self, other: _Setlike[Any]) -> None: ... - def update(self, iterable: _Setlike[_T]) -> None: ... - def clear(self) -> None: ... - def add(self, element: _T) -> None: ... - def remove(self, element: _T) -> None: ... - def discard(self, element: _T) -> None: ... - def pop(self) -> _T: ... - def __as_immutable__(self) -> ImmutableSet[_T]: ... - def __as_temporarily_immutable__(self) -> _TemporarilyImmutableSet[_T]: ... - -class _TemporarilyImmutableSet(BaseSet[_T]): - def __init__(self, set: BaseSet[_T]) -> None: ... - def __hash__(self) -> int: ... diff --git a/stdlib/@python2/sha.pyi b/stdlib/@python2/sha.pyi deleted file mode 100644 index aac8c8b..0000000 --- a/stdlib/@python2/sha.pyi +++ /dev/null @@ -1,10 +0,0 @@ -class sha(object): - def update(self, arg: str) -> None: ... - def digest(self) -> str: ... - def hexdigest(self) -> str: ... - def copy(self) -> sha: ... - -def new(string: str = ...) -> sha: ... - -blocksize: int -digest_size: int diff --git a/stdlib/@python2/shelve.pyi b/stdlib/@python2/shelve.pyi deleted file mode 100644 index d9b1a00..0000000 --- a/stdlib/@python2/shelve.pyi +++ /dev/null @@ -1,36 +0,0 @@ -import collections -from typing import Any, Dict, Iterator, List, Tuple - -class Shelf(collections.MutableMapping[Any, Any]): - def __init__( - self, dict: Dict[Any, Any], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... - ) -> None: ... - def __iter__(self) -> Iterator[str]: ... - def keys(self) -> List[Any]: ... - def __len__(self) -> int: ... - def has_key(self, key: Any) -> bool: ... - def __contains__(self, key: Any) -> bool: ... - def get(self, key: Any, default: Any = ...) -> Any: ... - def __getitem__(self, key: Any) -> Any: ... - def __setitem__(self, key: Any, value: Any) -> None: ... - def __delitem__(self, key: Any) -> None: ... - def __enter__(self) -> Shelf: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... - def close(self) -> None: ... - def __del__(self) -> None: ... - def sync(self) -> None: ... - -class BsdDbShelf(Shelf): - def __init__( - self, dict: Dict[Any, Any], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... - ) -> None: ... - def set_location(self, key: Any) -> Tuple[str, Any]: ... - def next(self) -> Tuple[str, Any]: ... - def previous(self) -> Tuple[str, Any]: ... - def first(self) -> Tuple[str, Any]: ... - def last(self) -> Tuple[str, Any]: ... - -class DbfilenameShelf(Shelf): - def __init__(self, filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... - -def open(filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> DbfilenameShelf: ... diff --git a/stdlib/@python2/shlex.pyi b/stdlib/@python2/shlex.pyi deleted file mode 100644 index 89c28fc..0000000 --- a/stdlib/@python2/shlex.pyi +++ /dev/null @@ -1,30 +0,0 @@ -from typing import IO, Any, List, Text, TypeVar - -def split(s: str | None, comments: bool = ..., posix: bool = ...) -> List[str]: ... - -_SLT = TypeVar("_SLT", bound=shlex) - -class shlex: - def __init__(self, instream: IO[Any] | Text = ..., infile: IO[Any] = ..., posix: bool = ...) -> None: ... - def __iter__(self: _SLT) -> _SLT: ... - def next(self) -> str: ... - def get_token(self) -> str | None: ... - def push_token(self, _str: str) -> None: ... - def read_token(self) -> str: ... - def sourcehook(self, filename: str) -> None: ... - def push_source(self, stream: IO[Any], filename: str = ...) -> None: ... - def pop_source(self) -> IO[Any]: ... - def error_leader(self, file: str = ..., line: int = ...) -> str: ... - commenters: str - wordchars: str - whitespace: str - escape: str - quotes: str - escapedquotes: str - whitespace_split: bool - infile: IO[Any] - source: str | None - debug: int - lineno: int - token: Any - eof: str | None diff --git a/stdlib/@python2/shutil.pyi b/stdlib/@python2/shutil.pyi deleted file mode 100644 index 4805c8e..0000000 --- a/stdlib/@python2/shutil.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from _typeshed import SupportsRead, SupportsWrite -from typing import Any, AnyStr, Callable, Iterable, List, Sequence, Set, Text, Tuple, Type, TypeVar, Union - -_AnyStr = TypeVar("_AnyStr", str, unicode) -_AnyPath = TypeVar("_AnyPath", str, unicode) -_PathReturn = Type[None] - -class Error(EnvironmentError): ... -class SpecialFileError(EnvironmentError): ... -class ExecError(EnvironmentError): ... - -def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ... -def copyfile(src: Text, dst: Text) -> None: ... -def copymode(src: Text, dst: Text) -> None: ... -def copystat(src: Text, dst: Text) -> None: ... -def copy(src: Text, dst: Text) -> _PathReturn: ... -def copy2(src: Text, dst: Text) -> _PathReturn: ... -def ignore_patterns(*patterns: Text) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ... -def copytree( - src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: None | Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]] = ... -) -> _PathReturn: ... -def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Callable[[Any, _AnyPath, Any], Any] | None = ...) -> None: ... - -_CopyFn = Union[Callable[[str, str], None], Callable[[Text, Text], None]] - -def move(src: Text, dst: Text) -> _PathReturn: ... -def make_archive( - base_name: _AnyStr, - format: str, - root_dir: Text | None = ..., - base_dir: Text | None = ..., - verbose: bool = ..., - dry_run: bool = ..., - owner: str | None = ..., - group: str | None = ..., - logger: Any | None = ..., -) -> _AnyStr: ... -def get_archive_formats() -> List[Tuple[str, str]]: ... -def register_archive_format( - name: str, - function: Callable[..., Any], - extra_args: Sequence[Tuple[str, Any] | List[Any]] | None = ..., - description: str = ..., -) -> None: ... -def unregister_archive_format(name: str) -> None: ... diff --git a/stdlib/@python2/signal.pyi b/stdlib/@python2/signal.pyi deleted file mode 100644 index 16a8f2d..0000000 --- a/stdlib/@python2/signal.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from types import FrameType -from typing import Callable, Tuple, Union - -SIG_DFL: int = ... -SIG_IGN: int = ... - -ITIMER_REAL: int = ... -ITIMER_VIRTUAL: int = ... -ITIMER_PROF: int = ... - -NSIG: int = ... - -SIGABRT: int = ... -SIGALRM: int = ... -SIGBREAK: int = ... # Windows -SIGBUS: int = ... -SIGCHLD: int = ... -SIGCLD: int = ... -SIGCONT: int = ... -SIGEMT: int = ... -SIGFPE: int = ... -SIGHUP: int = ... -SIGILL: int = ... -SIGINFO: int = ... -SIGINT: int = ... -SIGIO: int = ... -SIGIOT: int = ... -SIGKILL: int = ... -SIGPIPE: int = ... -SIGPOLL: int = ... -SIGPROF: int = ... -SIGPWR: int = ... -SIGQUIT: int = ... -SIGRTMAX: int = ... -SIGRTMIN: int = ... -SIGSEGV: int = ... -SIGSTOP: int = ... -SIGSYS: int = ... -SIGTERM: int = ... -SIGTRAP: int = ... -SIGTSTP: int = ... -SIGTTIN: int = ... -SIGTTOU: int = ... -SIGURG: int = ... -SIGUSR1: int = ... -SIGUSR2: int = ... -SIGVTALRM: int = ... -SIGWINCH: int = ... -SIGXCPU: int = ... -SIGXFSZ: int = ... - -# Windows -CTRL_C_EVENT: int = ... -CTRL_BREAK_EVENT: int = ... - -class ItimerError(IOError): ... - -_HANDLER = Union[Callable[[int, FrameType], None], int, None] - -def alarm(time: int) -> int: ... -def getsignal(signalnum: int) -> _HANDLER: ... -def pause() -> None: ... -def setitimer(which: int, seconds: float, interval: float = ...) -> Tuple[float, float]: ... -def getitimer(which: int) -> Tuple[float, float]: ... -def set_wakeup_fd(fd: int) -> int: ... -def siginterrupt(signalnum: int, flag: bool) -> None: ... -def signal(signalnum: int, handler: _HANDLER) -> _HANDLER: ... -def default_int_handler(signum: int, frame: FrameType) -> None: ... diff --git a/stdlib/@python2/site.pyi b/stdlib/@python2/site.pyi deleted file mode 100644 index c77c939..0000000 --- a/stdlib/@python2/site.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Iterable, List - -PREFIXES: List[str] -ENABLE_USER_SITE: bool | None -USER_SITE: str | None -USER_BASE: str | None - -def main() -> None: ... -def addsitedir(sitedir: str, known_paths: Iterable[str] | None = ...) -> None: ... -def getsitepackages(prefixes: Iterable[str] | None = ...) -> List[str]: ... -def getuserbase() -> str: ... -def getusersitepackages() -> str: ... diff --git a/stdlib/@python2/smtpd.pyi b/stdlib/@python2/smtpd.pyi deleted file mode 100644 index 1c17b82..0000000 --- a/stdlib/@python2/smtpd.pyi +++ /dev/null @@ -1,45 +0,0 @@ -import asynchat -import asyncore -import socket -from typing import Any, List, Text, Tuple, Type - -_Address = Tuple[str, int] # (host, port) - -class SMTPChannel(asynchat.async_chat): - COMMAND: int - DATA: int - def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ... - # base asynchat.async_chat.push() accepts bytes - def push(self, msg: Text) -> None: ... # type: ignore - def collect_incoming_data(self, data: bytes) -> None: ... - def found_terminator(self) -> None: ... - def smtp_HELO(self, arg: str) -> None: ... - def smtp_NOOP(self, arg: str) -> None: ... - def smtp_QUIT(self, arg: str) -> None: ... - def smtp_MAIL(self, arg: str) -> None: ... - def smtp_RCPT(self, arg: str) -> None: ... - def smtp_RSET(self, arg: str) -> None: ... - def smtp_DATA(self, arg: str) -> None: ... - -class SMTPServer(asyncore.dispatcher): - channel_class: Type[SMTPChannel] - - data_size_limit: int - enable_SMTPUTF8: bool - def __init__(self, localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ...) -> None: ... - def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ... - def process_message( - self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: bytes | str, **kwargs: Any - ) -> str | None: ... - -class DebuggingServer(SMTPServer): ... - -class PureProxy(SMTPServer): - def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: bytes | str - ) -> str | None: ... - -class MailmanProxy(PureProxy): - def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: bytes | str - ) -> str | None: ... diff --git a/stdlib/@python2/smtplib.pyi b/stdlib/@python2/smtplib.pyi deleted file mode 100644 index 438221a..0000000 --- a/stdlib/@python2/smtplib.pyi +++ /dev/null @@ -1,86 +0,0 @@ -from typing import Any - -class SMTPException(Exception): ... -class SMTPServerDisconnected(SMTPException): ... - -class SMTPResponseException(SMTPException): - smtp_code: Any - smtp_error: Any - args: Any - def __init__(self, code, msg) -> None: ... - -class SMTPSenderRefused(SMTPResponseException): - smtp_code: Any - smtp_error: Any - sender: Any - args: Any - def __init__(self, code, msg, sender) -> None: ... - -class SMTPRecipientsRefused(SMTPException): - recipients: Any - args: Any - def __init__(self, recipients) -> None: ... - -class SMTPDataError(SMTPResponseException): ... -class SMTPConnectError(SMTPResponseException): ... -class SMTPHeloError(SMTPResponseException): ... -class SMTPAuthenticationError(SMTPResponseException): ... - -def quoteaddr(addr): ... -def quotedata(data): ... - -class SSLFakeFile: - sslobj: Any - def __init__(self, sslobj) -> None: ... - def readline(self, size=...): ... - def close(self): ... - -class SMTP: - debuglevel: Any - file: Any - helo_resp: Any - ehlo_msg: Any - ehlo_resp: Any - does_esmtp: Any - default_port: Any - timeout: Any - esmtp_features: Any - local_hostname: Any - def __init__(self, host: str = ..., port: int = ..., local_hostname=..., timeout=...) -> None: ... - def set_debuglevel(self, debuglevel): ... - sock: Any - def connect(self, host=..., port=...): ... - def send(self, str): ... - def putcmd(self, cmd, args=...): ... - def getreply(self): ... - def docmd(self, cmd, args=...): ... - def helo(self, name=...): ... - def ehlo(self, name=...): ... - def has_extn(self, opt): ... - def help(self, args=...): ... - def rset(self): ... - def noop(self): ... - def mail(self, sender, options=...): ... - def rcpt(self, recip, options=...): ... - def data(self, msg): ... - def verify(self, address): ... - vrfy: Any - def expn(self, address): ... - def ehlo_or_helo_if_needed(self): ... - def login(self, user, password): ... - def starttls(self, keyfile=..., certfile=...): ... - def sendmail(self, from_addr, to_addrs, msg, mail_options=..., rcpt_options=...): ... - def close(self): ... - def quit(self): ... - -class SMTP_SSL(SMTP): - default_port: Any - keyfile: Any - certfile: Any - def __init__(self, host=..., port=..., local_hostname=..., keyfile=..., certfile=..., timeout=...) -> None: ... - -class LMTP(SMTP): - ehlo_msg: Any - def __init__(self, host=..., port=..., local_hostname=...) -> None: ... - sock: Any - def connect(self, host=..., port=...): ... diff --git a/stdlib/@python2/sndhdr.pyi b/stdlib/@python2/sndhdr.pyi deleted file mode 100644 index 189529f..0000000 --- a/stdlib/@python2/sndhdr.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import Text, Tuple, Union - -_SndHeaders = Tuple[str, int, int, int, Union[int, str]] - -def what(filename: Text) -> _SndHeaders | None: ... -def whathdr(filename: Text) -> _SndHeaders | None: ... diff --git a/stdlib/@python2/socket.pyi b/stdlib/@python2/socket.pyi deleted file mode 100644 index 2bf719d..0000000 --- a/stdlib/@python2/socket.pyi +++ /dev/null @@ -1,471 +0,0 @@ -import sys -from typing import Any, BinaryIO, Iterable, List, Text, Tuple, TypeVar, Union, overload - -# ----- Constants ----- -# Some socket families are listed in the "Socket families" section of the docs, -# but not the "Constants" section. These are listed at the end of the list of -# constants. -# -# Besides those and the first few constants listed, the constants are listed in -# documentation order. - -# Constants defined by Python (i.e. not OS constants re-exported from C) -has_ipv6: bool -SocketType: Any -# Re-exported errno -EAGAIN: int -EBADF: int -EINTR: int -EWOULDBLOCK: int - -# Constants re-exported from C - -# Per socketmodule.c, only these three families are portable -AF_UNIX: AddressFamily -AF_INET: AddressFamily -AF_INET6: AddressFamily - -SOCK_STREAM: SocketKind -SOCK_DGRAM: SocketKind -SOCK_RAW: SocketKind -SOCK_RDM: SocketKind -SOCK_SEQPACKET: SocketKind - -# Address families not mentioned in the docs -AF_AAL5: AddressFamily -AF_APPLETALK: AddressFamily -AF_ASH: AddressFamily -AF_ATMPVC: AddressFamily -AF_ATMSVC: AddressFamily -AF_AX25: AddressFamily -AF_BRIDGE: AddressFamily -AF_DECnet: AddressFamily -AF_ECONET: AddressFamily -AF_IPX: AddressFamily -AF_IRDA: AddressFamily -AF_KEY: AddressFamily -AF_LLC: AddressFamily -AF_NETBEUI: AddressFamily -AF_NETROM: AddressFamily -AF_PPPOX: AddressFamily -AF_ROSE: AddressFamily -AF_ROUTE: AddressFamily -AF_SECURITY: AddressFamily -AF_SNA: AddressFamily -AF_SYSTEM: AddressFamily -AF_UNSPEC: AddressFamily -AF_WANPIPE: AddressFamily -AF_X25: AddressFamily - -# The "many constants" referenced by the docs -SOMAXCONN: int -AI_ADDRCONFIG: AddressInfo -AI_ALL: AddressInfo -AI_CANONNAME: AddressInfo -AI_DEFAULT: AddressInfo -AI_MASK: AddressInfo -AI_NUMERICHOST: AddressInfo -AI_NUMERICSERV: AddressInfo -AI_PASSIVE: AddressInfo -AI_V4MAPPED: AddressInfo -AI_V4MAPPED_CFG: AddressInfo -EAI_ADDRFAMILY: int -EAI_AGAIN: int -EAI_BADFLAGS: int -EAI_BADHINTS: int -EAI_FAIL: int -EAI_FAMILY: int -EAI_MAX: int -EAI_MEMORY: int -EAI_NODATA: int -EAI_NONAME: int -EAI_OVERFLOW: int -EAI_PROTOCOL: int -EAI_SERVICE: int -EAI_SOCKTYPE: int -EAI_SYSTEM: int -INADDR_ALLHOSTS_GROUP: int -INADDR_ANY: int -INADDR_BROADCAST: int -INADDR_LOOPBACK: int -INADDR_MAX_LOCAL_GROUP: int -INADDR_NONE: int -INADDR_UNSPEC_GROUP: int -IPPORT_RESERVED: int -IPPORT_USERRESERVED: int -IPPROTO_AH: int -IPPROTO_BIP: int -IPPROTO_DSTOPTS: int -IPPROTO_EGP: int -IPPROTO_EON: int -IPPROTO_ESP: int -IPPROTO_FRAGMENT: int -IPPROTO_GGP: int -IPPROTO_GRE: int -IPPROTO_HELLO: int -IPPROTO_HOPOPTS: int -IPPROTO_ICMP: int -IPPROTO_ICMPV6: int -IPPROTO_IDP: int -IPPROTO_IGMP: int -IPPROTO_IP: int -IPPROTO_IPCOMP: int -IPPROTO_IPIP: int -IPPROTO_IPV4: int -IPPROTO_IPV6: int -IPPROTO_MAX: int -IPPROTO_MOBILE: int -IPPROTO_ND: int -IPPROTO_NONE: int -IPPROTO_PIM: int -IPPROTO_PUP: int -IPPROTO_RAW: int -IPPROTO_ROUTING: int -IPPROTO_RSVP: int -IPPROTO_SCTP: int -IPPROTO_TCP: int -IPPROTO_TP: int -IPPROTO_UDP: int -IPPROTO_VRRP: int -IPPROTO_XTP: int -IPV6_CHECKSUM: int -IPV6_DONTFRAG: int -IPV6_DSTOPTS: int -IPV6_HOPLIMIT: int -IPV6_HOPOPTS: int -IPV6_JOIN_GROUP: int -IPV6_LEAVE_GROUP: int -IPV6_MULTICAST_HOPS: int -IPV6_MULTICAST_IF: int -IPV6_MULTICAST_LOOP: int -IPV6_NEXTHOP: int -IPV6_PATHMTU: int -IPV6_PKTINFO: int -IPV6_RECVDSTOPTS: int -IPV6_RECVHOPLIMIT: int -IPV6_RECVHOPOPTS: int -IPV6_RECVPATHMTU: int -IPV6_RECVPKTINFO: int -IPV6_RECVRTHDR: int -IPV6_RECVTCLASS: int -IPV6_RTHDR: int -IPV6_RTHDRDSTOPTS: int -IPV6_RTHDR_TYPE_0: int -IPV6_TCLASS: int -IPV6_UNICAST_HOPS: int -IPV6_USE_MIN_MTU: int -IPV6_V6ONLY: int -IPX_TYPE: int -IP_ADD_MEMBERSHIP: int -IP_DEFAULT_MULTICAST_LOOP: int -IP_DEFAULT_MULTICAST_TTL: int -IP_DROP_MEMBERSHIP: int -IP_HDRINCL: int -IP_MAX_MEMBERSHIPS: int -IP_MULTICAST_IF: int -IP_MULTICAST_LOOP: int -IP_MULTICAST_TTL: int -IP_OPTIONS: int -IP_RECVDSTADDR: int -IP_RECVOPTS: int -IP_RECVRETOPTS: int -IP_RETOPTS: int -IP_TOS: int -IP_TRANSPARENT: int -IP_TTL: int -LOCAL_PEERCRED: int -MSG_BCAST: MsgFlag -MSG_BTAG: MsgFlag -MSG_CMSG_CLOEXEC: MsgFlag -MSG_CONFIRM: MsgFlag -MSG_CTRUNC: MsgFlag -MSG_DONTROUTE: MsgFlag -MSG_DONTWAIT: MsgFlag -MSG_EOF: MsgFlag -MSG_EOR: MsgFlag -MSG_ERRQUEUE: MsgFlag -MSG_ETAG: MsgFlag -MSG_FASTOPEN: MsgFlag -MSG_MCAST: MsgFlag -MSG_MORE: MsgFlag -MSG_NOSIGNAL: MsgFlag -MSG_NOTIFICATION: MsgFlag -MSG_OOB: MsgFlag -MSG_PEEK: MsgFlag -MSG_TRUNC: MsgFlag -MSG_WAITALL: MsgFlag -NI_DGRAM: int -NI_MAXHOST: int -NI_MAXSERV: int -NI_NAMEREQD: int -NI_NOFQDN: int -NI_NUMERICHOST: int -NI_NUMERICSERV: int -SCM_CREDENTIALS: int -SCM_CREDS: int -SCM_RIGHTS: int -SHUT_RD: int -SHUT_RDWR: int -SHUT_WR: int -SOL_ATALK: int -SOL_AX25: int -SOL_HCI: int -SOL_IP: int -SOL_IPX: int -SOL_NETROM: int -SOL_ROSE: int -SOL_SOCKET: int -SOL_TCP: int -SOL_UDP: int -SO_ACCEPTCONN: int -SO_BINDTODEVICE: int -SO_BROADCAST: int -SO_DEBUG: int -SO_DONTROUTE: int -SO_ERROR: int -SO_EXCLUSIVEADDRUSE: int -SO_KEEPALIVE: int -SO_LINGER: int -SO_MARK: int -SO_OOBINLINE: int -SO_PASSCRED: int -SO_PEERCRED: int -SO_PRIORITY: int -SO_RCVBUF: int -SO_RCVLOWAT: int -SO_RCVTIMEO: int -SO_REUSEADDR: int -SO_REUSEPORT: int -SO_SETFIB: int -SO_SNDBUF: int -SO_SNDLOWAT: int -SO_SNDTIMEO: int -SO_TYPE: int -SO_USELOOPBACK: int -TCP_CORK: int -TCP_DEFER_ACCEPT: int -TCP_FASTOPEN: int -TCP_INFO: int -TCP_KEEPCNT: int -TCP_KEEPIDLE: int -TCP_KEEPINTVL: int -TCP_LINGER2: int -TCP_MAXSEG: int -TCP_NODELAY: int -TCP_QUICKACK: int -TCP_SYNCNT: int -TCP_WINDOW_CLAMP: int -# Specifically-documented constants - -if sys.platform == "linux": - AF_PACKET: AddressFamily - PF_PACKET: int - PACKET_BROADCAST: int - PACKET_FASTROUTE: int - PACKET_HOST: int - PACKET_LOOPBACK: int - PACKET_MULTICAST: int - PACKET_OTHERHOST: int - PACKET_OUTGOING: int - -if sys.platform == "win32": - SIO_RCVALL: int - SIO_KEEPALIVE_VALS: int - RCVALL_IPLEVEL: int - RCVALL_MAX: int - RCVALL_OFF: int - RCVALL_ON: int - RCVALL_SOCKETLEVELONLY: int - -if sys.platform == "linux": - AF_TIPC: AddressFamily - SOL_TIPC: int - TIPC_ADDR_ID: int - TIPC_ADDR_NAME: int - TIPC_ADDR_NAMESEQ: int - TIPC_CFG_SRV: int - TIPC_CLUSTER_SCOPE: int - TIPC_CONN_TIMEOUT: int - TIPC_CRITICAL_IMPORTANCE: int - TIPC_DEST_DROPPABLE: int - TIPC_HIGH_IMPORTANCE: int - TIPC_IMPORTANCE: int - TIPC_LOW_IMPORTANCE: int - TIPC_MEDIUM_IMPORTANCE: int - TIPC_NODE_SCOPE: int - TIPC_PUBLISHED: int - TIPC_SRC_DROPPABLE: int - TIPC_SUBSCR_TIMEOUT: int - TIPC_SUB_CANCEL: int - TIPC_SUB_PORTS: int - TIPC_SUB_SERVICE: int - TIPC_TOP_SRV: int - TIPC_WAIT_FOREVER: int - TIPC_WITHDRAWN: int - TIPC_ZONE_SCOPE: int - -AF_LINK: AddressFamily # Availability: BSD, macOS - -# Semi-documented constants -# (Listed under "Socket families" in the docs, but not "Constants") - -if sys.platform == "linux": - # Netlink is defined by Linux - AF_NETLINK: AddressFamily - NETLINK_ARPD: int - NETLINK_CRYPTO: int - NETLINK_DNRTMSG: int - NETLINK_FIREWALL: int - NETLINK_IP6_FW: int - NETLINK_NFLOG: int - NETLINK_ROUTE6: int - NETLINK_ROUTE: int - NETLINK_SKIP: int - NETLINK_TAPBASE: int - NETLINK_TCPDIAG: int - NETLINK_USERSOCK: int - NETLINK_W1: int - NETLINK_XFRM: int - -if sys.platform != "win32" and sys.platform != "darwin": - # Linux and some BSD support is explicit in the docs - # Windows and macOS do not support in practice - AF_BLUETOOTH: AddressFamily - BTPROTO_HCI: int - BTPROTO_L2CAP: int - BTPROTO_RFCOMM: int - BTPROTO_SCO: int # not in FreeBSD - - BDADDR_ANY: str - BDADDR_LOCAL: str - - HCI_FILTER: int # not in NetBSD or DragonFlyBSD - # not in FreeBSD, NetBSD, or DragonFlyBSD - HCI_TIME_STAMP: int - HCI_DATA_DIR: int - -if sys.platform == "darwin": - # PF_SYSTEM is defined by macOS - PF_SYSTEM: int - SYSPROTO_CONTROL: int - -# enum versions of above flags -AddressFamily = int -SocketKind = int - -AddressInfo = int -MsgFlag = int - -# ----- Exceptions ----- - -class error(IOError): ... - -class herror(error): - def __init__(self, herror: int = ..., string: str = ...) -> None: ... - -class gaierror(error): - def __init__(self, error: int = ..., string: str = ...) -> None: ... - -class timeout(error): - def __init__(self, error: int = ..., string: str = ...) -> None: ... - -# ----- Classes ----- - -# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6, -# AF_NETLINK, AF_TIPC) or strings (AF_UNIX). -_Address = Union[Tuple[Any, ...], str] -_RetAddress = Any -# TODO Most methods allow bytes as address objects - -_WriteBuffer = Union[bytearray, memoryview] - -_CMSG = Tuple[int, int, bytes] -_SelfT = TypeVar("_SelfT", bound=socket) - -class socket: - family: int - type: int - proto: int - def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ... - # --- methods --- - def accept(self) -> Tuple[socket, _RetAddress]: ... - def bind(self, address: _Address | bytes) -> None: ... - def close(self) -> None: ... - def connect(self, address: _Address | bytes) -> None: ... - def connect_ex(self, address: _Address | bytes) -> int: ... - def detach(self) -> int: ... - def dup(self) -> socket: ... - def fileno(self) -> int: ... - def getpeername(self) -> _RetAddress: ... - def getsockname(self) -> _RetAddress: ... - @overload - def getsockopt(self, level: int, optname: int) -> int: ... - @overload - def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - def gettimeout(self) -> float | None: ... - if sys.platform == "win32": - def ioctl(self, control: int, option: int | Tuple[int, int, int]) -> None: ... - def listen(self, __backlog: int) -> None: ... - # Note that the makefile's documented windows-specific behavior is not represented - def makefile(self, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... - def recv(self, bufsize: int, flags: int = ...) -> bytes: ... - def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ... - def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ... - def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ... - def send(self, data: bytes, flags: int = ...) -> int: ... - def sendall(self, data: bytes, flags: int = ...) -> None: ... # return type: None on success - @overload - def sendto(self, data: bytes, address: _Address) -> int: ... - @overload - def sendto(self, data: bytes, flags: int, address: _Address) -> int: ... - def setblocking(self, flag: bool) -> None: ... - def settimeout(self, value: float | None) -> None: ... - def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ... - if sys.platform == "win32": - def share(self, process_id: int) -> bytes: ... - def shutdown(self, how: int) -> None: ... - -# ----- Functions ----- - -def create_connection( - address: Tuple[str | None, int], - timeout: float | None = ..., - source_address: Tuple[bytearray | bytes | Text, int] | None = ..., -) -> socket: ... -def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ... - -# the 5th tuple item is an address -def getaddrinfo( - host: bytearray | bytes | Text | None, - port: str | int | None, - family: int = ..., - socktype: int = ..., - proto: int = ..., - flags: int = ..., -) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[Any, ...]]]: ... -def getfqdn(name: str = ...) -> str: ... -def gethostbyname(hostname: str) -> str: ... -def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ... -def gethostname() -> str: ... -def gethostbyaddr(ip_address: str) -> Tuple[str, List[str], List[str]]: ... -def getnameinfo(sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int) -> Tuple[str, str]: ... -def getprotobyname(protocolname: str) -> int: ... -def getservbyname(servicename: str, protocolname: str = ...) -> int: ... -def getservbyport(port: int, protocolname: str = ...) -> str: ... - -if sys.platform == "win32": - def socketpair(family: int = ..., type: int = ..., proto: int = ...) -> Tuple[socket, socket]: ... - -else: - def socketpair(family: int | None = ..., type: int = ..., proto: int = ...) -> Tuple[socket, socket]: ... - -def ntohl(x: int) -> int: ... # param & ret val are 32-bit ints -def ntohs(x: int) -> int: ... # param & ret val are 16-bit ints -def htonl(x: int) -> int: ... # param & ret val are 32-bit ints -def htons(x: int) -> int: ... # param & ret val are 16-bit ints -def inet_aton(ip_string: str) -> bytes: ... # ret val 4 bytes in length -def inet_ntoa(packed_ip: bytes) -> str: ... -def inet_pton(address_family: int, ip_string: str) -> bytes: ... -def inet_ntop(address_family: int, packed_ip: bytes) -> str: ... -def getdefaulttimeout() -> float | None: ... -def setdefaulttimeout(timeout: float | None) -> None: ... diff --git a/stdlib/@python2/spwd.pyi b/stdlib/@python2/spwd.pyi deleted file mode 100644 index 756c142..0000000 --- a/stdlib/@python2/spwd.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import List, NamedTuple - -class struct_spwd(NamedTuple): - sp_nam: str - sp_pwd: str - sp_lstchg: int - sp_min: int - sp_max: int - sp_warn: int - sp_inact: int - sp_expire: int - sp_flag: int - -def getspall() -> List[struct_spwd]: ... -def getspnam(name: str) -> struct_spwd: ... diff --git a/stdlib/@python2/sqlite3/__init__.pyi b/stdlib/@python2/sqlite3/__init__.pyi deleted file mode 100644 index d5d20d6..0000000 --- a/stdlib/@python2/sqlite3/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -from sqlite3.dbapi2 import * # noqa: F403 diff --git a/stdlib/@python2/sqlite3/dbapi2.pyi b/stdlib/@python2/sqlite3/dbapi2.pyi deleted file mode 100644 index fadfcc8..0000000 --- a/stdlib/@python2/sqlite3/dbapi2.pyi +++ /dev/null @@ -1,251 +0,0 @@ -from datetime import date, datetime, time -from typing import Any, Callable, Generator, Iterable, Iterator, List, Protocol, Text, Tuple, Type, TypeVar - -_T = TypeVar("_T") - -paramstyle: str -threadsafety: int -apilevel: str -Date = date -Time = time -Timestamp = datetime - -def DateFromTicks(ticks: float) -> Date: ... -def TimeFromTicks(ticks: float) -> Time: ... -def TimestampFromTicks(ticks: float) -> Timestamp: ... - -version_info: Tuple[int, int, int] -sqlite_version_info: Tuple[int, int, int] -Binary = buffer - -# The remaining definitions are imported from _sqlite3. - -PARSE_COLNAMES: int -PARSE_DECLTYPES: int -SQLITE_ALTER_TABLE: int -SQLITE_ANALYZE: int -SQLITE_ATTACH: int -SQLITE_CREATE_INDEX: int -SQLITE_CREATE_TABLE: int -SQLITE_CREATE_TEMP_INDEX: int -SQLITE_CREATE_TEMP_TABLE: int -SQLITE_CREATE_TEMP_TRIGGER: int -SQLITE_CREATE_TEMP_VIEW: int -SQLITE_CREATE_TRIGGER: int -SQLITE_CREATE_VIEW: int -SQLITE_DELETE: int -SQLITE_DENY: int -SQLITE_DETACH: int -SQLITE_DROP_INDEX: int -SQLITE_DROP_TABLE: int -SQLITE_DROP_TEMP_INDEX: int -SQLITE_DROP_TEMP_TABLE: int -SQLITE_DROP_TEMP_TRIGGER: int -SQLITE_DROP_TEMP_VIEW: int -SQLITE_DROP_TRIGGER: int -SQLITE_DROP_VIEW: int -SQLITE_IGNORE: int -SQLITE_INSERT: int -SQLITE_OK: int -SQLITE_PRAGMA: int -SQLITE_READ: int -SQLITE_REINDEX: int -SQLITE_SELECT: int -SQLITE_TRANSACTION: int -SQLITE_UPDATE: int -adapters: Any -converters: Any -sqlite_version: str -version: str - -# TODO: adapt needs to get probed -def adapt(obj, protocol, alternate): ... -def complete_statement(sql: str) -> bool: ... -def connect( - database: bytes | Text, - timeout: float = ..., - detect_types: int = ..., - isolation_level: str | None = ..., - check_same_thread: bool = ..., - factory: Type[Connection] | None = ..., - cached_statements: int = ..., -) -> Connection: ... -def enable_callback_tracebacks(__enable: bool) -> None: ... -def enable_shared_cache(enable: int) -> None: ... -def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ... -def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ... - -class Cache(object): - def __init__(self, *args, **kwargs) -> None: ... - def display(self, *args, **kwargs) -> None: ... - def get(self, *args, **kwargs) -> None: ... - -class _AggregateProtocol(Protocol): - def step(self, value: int) -> None: ... - def finalize(self) -> int: ... - -class Connection(object): - DataError: Any - DatabaseError: Any - Error: Any - IntegrityError: Any - InterfaceError: Any - InternalError: Any - NotSupportedError: Any - OperationalError: Any - ProgrammingError: Any - Warning: Any - in_transaction: Any - isolation_level: Any - row_factory: Any - text_factory: Any - total_changes: Any - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def close(self) -> None: ... - def commit(self) -> None: ... - def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ... - def create_collation(self, __name: str, __callback: Any) -> None: ... - def create_function(self, name: str, num_params: int, func: Any) -> None: ... - def cursor(self, cursorClass: type | None = ...) -> Cursor: ... - def execute(self, sql: str, parameters: Iterable[Any] = ...) -> Cursor: ... - # TODO: please check in executemany() if seq_of_parameters type is possible like this - def executemany(self, __sql: str, __parameters: Iterable[Iterable[Any]]) -> Cursor: ... - def executescript(self, __sql_script: bytes | Text) -> Cursor: ... - def interrupt(self, *args: Any, **kwargs: Any) -> None: ... - def iterdump(self, *args: Any, **kwargs: Any) -> Generator[str, None, None]: ... - def rollback(self, *args: Any, **kwargs: Any) -> None: ... - # TODO: set_authorizer(authorzer_callback) - # see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_authorizer - # returns [SQLITE_OK, SQLITE_DENY, SQLITE_IGNORE] so perhaps int - def set_authorizer(self, *args: Any, **kwargs: Any) -> None: ... - # set_progress_handler(handler, n) -> see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_progress_handler - def set_progress_handler(self, *args: Any, **kwargs: Any) -> None: ... - def set_trace_callback(self, *args: Any, **kwargs: Any) -> None: ... - # enable_load_extension and load_extension is not available on python distributions compiled - # without sqlite3 loadable extension support. see footnotes https://docs.python.org/3/library/sqlite3.html#f1 - def enable_load_extension(self, enabled: bool) -> None: ... - def load_extension(self, path: str) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __enter__(self) -> Connection: ... - def __exit__(self, t: type | None, exc: BaseException | None, tb: Any | None) -> None: ... - -class Cursor(Iterator[Any]): - arraysize: Any - connection: Any - description: Any - lastrowid: Any - row_factory: Any - rowcount: Any - # TODO: Cursor class accepts exactly 1 argument - # required type is sqlite3.Connection (which is imported as _Connection) - # however, the name of the __init__ variable is unknown - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def close(self, *args: Any, **kwargs: Any) -> None: ... - def execute(self, __sql: str, __parameters: Iterable[Any] = ...) -> Cursor: ... - def executemany(self, __sql: str, __seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ... - def executescript(self, __sql_script: bytes | Text) -> Cursor: ... - def fetchall(self) -> List[Any]: ... - def fetchmany(self, size: int | None = ...) -> List[Any]: ... - def fetchone(self) -> Any: ... - def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ... - def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ... - def __iter__(self) -> Cursor: ... - def next(self) -> Any: ... - -class DataError(DatabaseError): ... -class DatabaseError(Error): ... -class Error(Exception): ... -class IntegrityError(DatabaseError): ... -class InterfaceError(Error): ... -class InternalError(DatabaseError): ... -class NotSupportedError(DatabaseError): ... -class OperationalError(DatabaseError): ... - -class OptimizedUnicode(object): - maketrans: Any - def __init__(self, *args, **kwargs): ... - def capitalize(self, *args, **kwargs): ... - def casefold(self, *args, **kwargs): ... - def center(self, *args, **kwargs): ... - def count(self, *args, **kwargs): ... - def encode(self, *args, **kwargs): ... - def endswith(self, *args, **kwargs): ... - def expandtabs(self, *args, **kwargs): ... - def find(self, *args, **kwargs): ... - def format(self, *args, **kwargs): ... - def format_map(self, *args, **kwargs): ... - def index(self, *args, **kwargs): ... - def isalnum(self, *args, **kwargs): ... - def isalpha(self, *args, **kwargs): ... - def isdecimal(self, *args, **kwargs): ... - def isdigit(self, *args, **kwargs): ... - def isidentifier(self, *args, **kwargs): ... - def islower(self, *args, **kwargs): ... - def isnumeric(self, *args, **kwargs): ... - def isprintable(self, *args, **kwargs): ... - def isspace(self, *args, **kwargs): ... - def istitle(self, *args, **kwargs): ... - def isupper(self, *args, **kwargs): ... - def join(self, *args, **kwargs): ... - def ljust(self, *args, **kwargs): ... - def lower(self, *args, **kwargs): ... - def lstrip(self, *args, **kwargs): ... - def partition(self, *args, **kwargs): ... - def replace(self, *args, **kwargs): ... - def rfind(self, *args, **kwargs): ... - def rindex(self, *args, **kwargs): ... - def rjust(self, *args, **kwargs): ... - def rpartition(self, *args, **kwargs): ... - def rsplit(self, *args, **kwargs): ... - def rstrip(self, *args, **kwargs): ... - def split(self, *args, **kwargs): ... - def splitlines(self, *args, **kwargs): ... - def startswith(self, *args, **kwargs): ... - def strip(self, *args, **kwargs): ... - def swapcase(self, *args, **kwargs): ... - def title(self, *args, **kwargs): ... - def translate(self, *args, **kwargs): ... - def upper(self, *args, **kwargs): ... - def zfill(self, *args, **kwargs): ... - def __add__(self, other): ... - def __contains__(self, *args, **kwargs): ... - def __eq__(self, other): ... - def __format__(self, *args, **kwargs): ... - def __ge__(self, other): ... - def __getitem__(self, index): ... - def __getnewargs__(self, *args, **kwargs): ... - def __gt__(self, other): ... - def __hash__(self): ... - def __iter__(self): ... - def __le__(self, other): ... - def __len__(self, *args, **kwargs): ... - def __lt__(self, other): ... - def __mod__(self, other): ... - def __mul__(self, other): ... - def __ne__(self, other): ... - def __rmod__(self, other): ... - def __rmul__(self, other): ... - -class PrepareProtocol(object): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - -class ProgrammingError(DatabaseError): ... - -class Row(object): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def keys(self, *args: Any, **kwargs: Any): ... - def __eq__(self, other): ... - def __ge__(self, other): ... - def __getitem__(self, index): ... - def __gt__(self, other): ... - def __hash__(self): ... - def __iter__(self): ... - def __le__(self, other): ... - def __len__(self): ... - def __lt__(self, other): ... - def __ne__(self, other): ... - -class Statement(object): - def __init__(self, *args, **kwargs): ... - -class Warning(Exception): ... diff --git a/stdlib/@python2/sre_compile.pyi b/stdlib/@python2/sre_compile.pyi deleted file mode 100644 index efc3e56..0000000 --- a/stdlib/@python2/sre_compile.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from sre_constants import ( - SRE_FLAG_DEBUG as SRE_FLAG_DEBUG, - SRE_FLAG_DOTALL as SRE_FLAG_DOTALL, - SRE_FLAG_IGNORECASE as SRE_FLAG_IGNORECASE, - SRE_FLAG_LOCALE as SRE_FLAG_LOCALE, - SRE_FLAG_MULTILINE as SRE_FLAG_MULTILINE, - SRE_FLAG_TEMPLATE as SRE_FLAG_TEMPLATE, - SRE_FLAG_UNICODE as SRE_FLAG_UNICODE, - SRE_FLAG_VERBOSE as SRE_FLAG_VERBOSE, - SRE_INFO_CHARSET as SRE_INFO_CHARSET, - SRE_INFO_LITERAL as SRE_INFO_LITERAL, - SRE_INFO_PREFIX as SRE_INFO_PREFIX, -) -from sre_parse import SubPattern -from typing import Any, List, Pattern, Tuple, Type - -MAXCODE: int -STRING_TYPES: Tuple[Type[str], Type[unicode]] -_IsStringType = int - -def isstring(obj: Any) -> _IsStringType: ... -def compile(p: str | bytes | SubPattern, flags: int = ...) -> Pattern[Any]: ... diff --git a/stdlib/@python2/sre_constants.pyi b/stdlib/@python2/sre_constants.pyi deleted file mode 100644 index bc15754..0000000 --- a/stdlib/@python2/sre_constants.pyi +++ /dev/null @@ -1,93 +0,0 @@ -from typing import Dict, List, TypeVar - -MAGIC: int -MAXREPEAT: int - -class error(Exception): ... - -FAILURE: str -SUCCESS: str -ANY: str -ANY_ALL: str -ASSERT: str -ASSERT_NOT: str -AT: str -BIGCHARSET: str -BRANCH: str -CALL: str -CATEGORY: str -CHARSET: str -GROUPREF: str -GROUPREF_IGNORE: str -GROUPREF_EXISTS: str -IN: str -IN_IGNORE: str -INFO: str -JUMP: str -LITERAL: str -LITERAL_IGNORE: str -MARK: str -MAX_REPEAT: str -MAX_UNTIL: str -MIN_REPEAT: str -MIN_UNTIL: str -NEGATE: str -NOT_LITERAL: str -NOT_LITERAL_IGNORE: str -RANGE: str -REPEAT: str -REPEAT_ONE: str -SUBPATTERN: str -MIN_REPEAT_ONE: str -AT_BEGINNING: str -AT_BEGINNING_LINE: str -AT_BEGINNING_STRING: str -AT_BOUNDARY: str -AT_NON_BOUNDARY: str -AT_END: str -AT_END_LINE: str -AT_END_STRING: str -AT_LOC_BOUNDARY: str -AT_LOC_NON_BOUNDARY: str -AT_UNI_BOUNDARY: str -AT_UNI_NON_BOUNDARY: str -CATEGORY_DIGIT: str -CATEGORY_NOT_DIGIT: str -CATEGORY_SPACE: str -CATEGORY_NOT_SPACE: str -CATEGORY_WORD: str -CATEGORY_NOT_WORD: str -CATEGORY_LINEBREAK: str -CATEGORY_NOT_LINEBREAK: str -CATEGORY_LOC_WORD: str -CATEGORY_LOC_NOT_WORD: str -CATEGORY_UNI_DIGIT: str -CATEGORY_UNI_NOT_DIGIT: str -CATEGORY_UNI_SPACE: str -CATEGORY_UNI_NOT_SPACE: str -CATEGORY_UNI_WORD: str -CATEGORY_UNI_NOT_WORD: str -CATEGORY_UNI_LINEBREAK: str -CATEGORY_UNI_NOT_LINEBREAK: str - -_T = TypeVar("_T") - -def makedict(list: List[_T]) -> Dict[_T, int]: ... - -OP_IGNORE: Dict[str, str] -AT_MULTILINE: Dict[str, str] -AT_LOCALE: Dict[str, str] -AT_UNICODE: Dict[str, str] -CH_LOCALE: Dict[str, str] -CH_UNICODE: Dict[str, str] -SRE_FLAG_TEMPLATE: int -SRE_FLAG_IGNORECASE: int -SRE_FLAG_LOCALE: int -SRE_FLAG_MULTILINE: int -SRE_FLAG_DOTALL: int -SRE_FLAG_UNICODE: int -SRE_FLAG_VERBOSE: int -SRE_FLAG_DEBUG: int -SRE_INFO_PREFIX: int -SRE_INFO_LITERAL: int -SRE_INFO_CHARSET: int diff --git a/stdlib/@python2/sre_parse.pyi b/stdlib/@python2/sre_parse.pyi deleted file mode 100644 index 35f6d4d..0000000 --- a/stdlib/@python2/sre_parse.pyi +++ /dev/null @@ -1,62 +0,0 @@ -from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union - -SPECIAL_CHARS: str -REPEAT_CHARS: str -DIGITS: Set[Any] -OCTDIGITS: Set[Any] -HEXDIGITS: Set[Any] -WHITESPACE: Set[Any] -ESCAPES: Dict[str, Tuple[str, int]] -CATEGORIES: Dict[str, Tuple[str, str] | Tuple[str, List[Tuple[str, str]]]] -FLAGS: Dict[str, int] - -class Pattern: - flags: int - open: List[int] - groups: int - groupdict: Dict[str, int] - lookbehind: int - def __init__(self) -> None: ... - def opengroup(self, name: str = ...) -> int: ... - def closegroup(self, gid: int) -> None: ... - def checkgroup(self, gid: int) -> bool: ... - -_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern] -_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern] -_OpInType = List[Tuple[str, int]] -_OpBranchType = Tuple[None, List[SubPattern]] -_AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType] -_CodeType = Union[str, _AvType] - -class SubPattern: - pattern: str - data: List[_CodeType] - width: int | None - def __init__(self, pattern, data: List[_CodeType] = ...) -> None: ... - def dump(self, level: int = ...) -> None: ... - def __len__(self) -> int: ... - def __delitem__(self, index: int | slice) -> None: ... - def __getitem__(self, index: int | slice) -> SubPattern | _CodeType: ... - def __setitem__(self, index: int | slice, code: _CodeType): ... - def insert(self, index, code: _CodeType) -> None: ... - def append(self, code: _CodeType) -> None: ... - def getwidth(self) -> int: ... - -class Tokenizer: - string: str - index: int - def __init__(self, string: str) -> None: ... - def match(self, char: str, skip: int = ...) -> int: ... - def get(self) -> str | None: ... - def tell(self) -> Tuple[int, str | None]: ... - def seek(self, index: int) -> None: ... - -def isident(char: str) -> bool: ... -def isdigit(char: str) -> bool: ... -def isname(name: str) -> bool: ... -def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ... - -_Template = Tuple[List[Tuple[int, int]], List[Optional[int]]] - -def parse_template(source: str, pattern: _Pattern[Any]) -> _Template: ... -def expand_template(template: _Template, match: Match[Any]) -> str: ... diff --git a/stdlib/@python2/ssl.pyi b/stdlib/@python2/ssl.pyi deleted file mode 100644 index aabecaa..0000000 --- a/stdlib/@python2/ssl.pyi +++ /dev/null @@ -1,265 +0,0 @@ -import socket -import sys -from _typeshed import StrPath -from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Union, overload -from typing_extensions import Literal - -_PCTRTT = Tuple[Tuple[str, str], ...] -_PCTRTTT = Tuple[_PCTRTT, ...] -_PeerCertRetDictType = Dict[str, Union[str, _PCTRTTT, _PCTRTT]] -_PeerCertRetType = Union[_PeerCertRetDictType, bytes, None] -_EnumRetType = List[Tuple[bytes, str, Union[Set[str], bool]]] -_PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes] - -_SC1ArgT = SSLSocket -_SrvnmeCbType = Callable[[_SC1ArgT, Optional[str], SSLSocket], Optional[int]] - -class SSLError(OSError): - library: str - reason: str - -class SSLZeroReturnError(SSLError): ... -class SSLWantReadError(SSLError): ... -class SSLWantWriteError(SSLError): ... -class SSLSyscallError(SSLError): ... -class SSLEOFError(SSLError): ... -class CertificateError(ValueError): ... - -def wrap_socket( - sock: socket.socket, - keyfile: str | None = ..., - certfile: str | None = ..., - server_side: bool = ..., - cert_reqs: int = ..., - ssl_version: int = ..., - ca_certs: str | None = ..., - do_handshake_on_connect: bool = ..., - suppress_ragged_eofs: bool = ..., - ciphers: str | None = ..., -) -> SSLSocket: ... -def create_default_context( - purpose: Any = ..., *, cafile: str | None = ..., capath: str | None = ..., cadata: Text | bytes | None = ... -) -> SSLContext: ... -def _create_unverified_context( - protocol: int = ..., - *, - cert_reqs: int | None = ..., - check_hostname: bool = ..., - purpose: Any = ..., - certfile: str | None = ..., - keyfile: str | None = ..., - cafile: str | None = ..., - capath: str | None = ..., - cadata: Text | bytes | None = ..., -) -> SSLContext: ... - -_create_default_https_context: Callable[..., SSLContext] - -def RAND_status() -> bool: ... -def RAND_egd(path: str) -> None: ... -def RAND_add(__s: bytes, __entropy: float) -> None: ... -def match_hostname(cert: _PeerCertRetType, hostname: str) -> None: ... -def cert_time_to_seconds(cert_time: str) -> int: ... -def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... -def DER_cert_to_PEM_cert(der_cert_bytes: bytes) -> str: ... -def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... - -class DefaultVerifyPaths(NamedTuple): - cafile: str - capath: str - openssl_cafile_env: str - openssl_cafile: str - openssl_capath_env: str - openssl_capath: str - -def get_default_verify_paths() -> DefaultVerifyPaths: ... - -if sys.platform == "win32": - def enum_certificates(store_name: str) -> _EnumRetType: ... - def enum_crls(store_name: str) -> _EnumRetType: ... - -CERT_NONE: int -CERT_OPTIONAL: int -CERT_REQUIRED: int - -VERIFY_DEFAULT: int -VERIFY_CRL_CHECK_LEAF: int -VERIFY_CRL_CHECK_CHAIN: int -VERIFY_X509_STRICT: int -VERIFY_X509_TRUSTED_FIRST: int - -PROTOCOL_SSLv23: int -PROTOCOL_SSLv2: int -PROTOCOL_SSLv3: int -PROTOCOL_TLSv1: int -PROTOCOL_TLSv1_1: int -PROTOCOL_TLSv1_2: int -PROTOCOL_TLS: int -OP_ALL: int -OP_NO_SSLv2: int -OP_NO_SSLv3: int -OP_NO_TLSv1: int -OP_NO_TLSv1_1: int -OP_NO_TLSv1_2: int -OP_CIPHER_SERVER_PREFERENCE: int -OP_SINGLE_DH_USE: int -OP_SINGLE_ECDH_USE: int -OP_NO_COMPRESSION: int - -HAS_ALPN: bool -HAS_ECDH: bool -HAS_SNI: bool -HAS_NPN: bool -CHANNEL_BINDING_TYPES: List[str] - -OPENSSL_VERSION: str -OPENSSL_VERSION_INFO: Tuple[int, int, int, int, int] -OPENSSL_VERSION_NUMBER: int - -ALERT_DESCRIPTION_HANDSHAKE_FAILURE: int -ALERT_DESCRIPTION_INTERNAL_ERROR: int -ALERT_DESCRIPTION_ACCESS_DENIED: int -ALERT_DESCRIPTION_BAD_CERTIFICATE: int -ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE: int -ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE: int -ALERT_DESCRIPTION_BAD_RECORD_MAC: int -ALERT_DESCRIPTION_CERTIFICATE_EXPIRED: int -ALERT_DESCRIPTION_CERTIFICATE_REVOKED: int -ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN: int -ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE: int -ALERT_DESCRIPTION_CLOSE_NOTIFY: int -ALERT_DESCRIPTION_DECODE_ERROR: int -ALERT_DESCRIPTION_DECOMPRESSION_FAILURE: int -ALERT_DESCRIPTION_DECRYPT_ERROR: int -ALERT_DESCRIPTION_ILLEGAL_PARAMETER: int -ALERT_DESCRIPTION_INSUFFICIENT_SECURITY: int -ALERT_DESCRIPTION_NO_RENEGOTIATION: int -ALERT_DESCRIPTION_PROTOCOL_VERSION: int -ALERT_DESCRIPTION_RECORD_OVERFLOW: int -ALERT_DESCRIPTION_UNEXPECTED_MESSAGE: int -ALERT_DESCRIPTION_UNKNOWN_CA: int -ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY: int -ALERT_DESCRIPTION_UNRECOGNIZED_NAME: int -ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE: int -ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION: int -ALERT_DESCRIPTION_USER_CANCELLED: int - -class _ASN1Object(NamedTuple): - nid: int - shortname: str - longname: str - oid: str - -class Purpose(_ASN1Object): - SERVER_AUTH: ClassVar[Purpose] - CLIENT_AUTH: ClassVar[Purpose] - -class SSLSocket(socket.socket): - context: SSLContext - server_side: bool - server_hostname: str | None - def __init__( - self, - sock: socket.socket | None = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - server_side: bool = ..., - cert_reqs: int = ..., - ssl_version: int = ..., - ca_certs: str | None = ..., - do_handshake_on_connect: bool = ..., - family: int = ..., - type: int = ..., - proto: int = ..., - fileno: int | None = ..., - suppress_ragged_eofs: bool = ..., - npn_protocols: Iterable[str] | None = ..., - ciphers: str | None = ..., - server_hostname: str | None = ..., - _context: SSLContext | None = ..., - _session: Any | None = ..., - ) -> None: ... - def connect(self, addr: socket._Address | bytes) -> None: ... - def connect_ex(self, addr: socket._Address | bytes) -> int: ... - def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ... - def recv_into(self, buffer: socket._WriteBuffer, nbytes: int | None = ..., flags: int = ...) -> int: ... - def recvfrom(self, buflen: int = ..., flags: int = ...) -> tuple[bytes, socket._RetAddress]: ... - def recvfrom_into( - self, buffer: socket._WriteBuffer, nbytes: int | None = ..., flags: int = ... - ) -> tuple[int, socket._RetAddress]: ... - @overload - def sendto(self, data: bytes, flags_or_addr: socket._Address) -> int: ... - @overload - def sendto(self, data: bytes, flags_or_addr: int | socket._Address, addr: socket._Address | None = ...) -> int: ... - def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ... - def write(self, data: bytes) -> int: ... - def do_handshake(self, block: bool = ...) -> None: ... # block is undocumented - @overload - def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... - @overload - def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... - @overload - def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... - def cipher(self) -> Tuple[str, str, int] | None: ... - def compression(self) -> str | None: ... - def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ... - def selected_alpn_protocol(self) -> str | None: ... - def selected_npn_protocol(self) -> str | None: ... - def accept(self) -> Tuple[SSLSocket, socket._RetAddress]: ... - def unwrap(self) -> socket.socket: ... - def version(self) -> str | None: ... - def pending(self) -> int: ... - -class SSLContext: - check_hostname: bool - options: int - def __new__(cls, protocol: int, *args: Any, **kwargs: Any) -> SSLContext: ... - @property - def protocol(self) -> int: ... - verify_flags: int - verify_mode: int - def __init__(self, protocol: int) -> None: ... - def cert_store_stats(self) -> Dict[str, int]: ... - def load_cert_chain(self, certfile: StrPath, keyfile: StrPath | None = ..., password: _PasswordType | None = ...) -> None: ... - def load_default_certs(self, purpose: Purpose = ...) -> None: ... - def load_verify_locations( - self, cafile: StrPath | None = ..., capath: StrPath | None = ..., cadata: Text | bytes | None = ... - ) -> None: ... - def get_ca_certs(self, binary_form: bool = ...) -> List[_PeerCertRetDictType] | List[bytes]: ... - def set_default_verify_paths(self) -> None: ... - def set_ciphers(self, __cipherlist: str) -> None: ... - def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ... - def set_npn_protocols(self, npn_protocols: Iterable[str]) -> None: ... - def set_servername_callback(self, __method: _SrvnmeCbType | None) -> None: ... - def load_dh_params(self, __path: str) -> None: ... - def set_ecdh_curve(self, __name: str) -> None: ... - def wrap_socket( - self, - sock: socket.socket, - server_side: bool = ..., - do_handshake_on_connect: bool = ..., - suppress_ragged_eofs: bool = ..., - server_hostname: str | None = ..., - ) -> SSLSocket: ... - def session_stats(self) -> Dict[str, int]: ... - -# TODO below documented in cpython but not in docs.python.org -# taken from python 3.4 -SSL_ERROR_EOF: int -SSL_ERROR_INVALID_ERROR_CODE: int -SSL_ERROR_SSL: int -SSL_ERROR_SYSCALL: int -SSL_ERROR_WANT_CONNECT: int -SSL_ERROR_WANT_READ: int -SSL_ERROR_WANT_WRITE: int -SSL_ERROR_WANT_X509_LOOKUP: int -SSL_ERROR_ZERO_RETURN: int - -def get_protocol_name(protocol_code: int) -> str: ... - -AF_INET: int -PEM_FOOTER: str -PEM_HEADER: str -SOCK_STREAM: int -SOL_SOCKET: int -SO_TYPE: int diff --git a/stdlib/@python2/stat.pyi b/stdlib/@python2/stat.pyi deleted file mode 100644 index b75c955..0000000 --- a/stdlib/@python2/stat.pyi +++ /dev/null @@ -1,58 +0,0 @@ -def S_ISDIR(mode: int) -> bool: ... -def S_ISCHR(mode: int) -> bool: ... -def S_ISBLK(mode: int) -> bool: ... -def S_ISREG(mode: int) -> bool: ... -def S_ISFIFO(mode: int) -> bool: ... -def S_ISLNK(mode: int) -> bool: ... -def S_ISSOCK(mode: int) -> bool: ... -def S_IMODE(mode: int) -> int: ... -def S_IFMT(mode: int) -> int: ... - -ST_MODE: int -ST_INO: int -ST_DEV: int -ST_NLINK: int -ST_UID: int -ST_GID: int -ST_SIZE: int -ST_ATIME: int -ST_MTIME: int -ST_CTIME: int -S_IFSOCK: int -S_IFLNK: int -S_IFREG: int -S_IFBLK: int -S_IFDIR: int -S_IFCHR: int -S_IFIFO: int -S_ISUID: int -S_ISGID: int -S_ISVTX: int -S_IRWXU: int -S_IRUSR: int -S_IWUSR: int -S_IXUSR: int -S_IRWXG: int -S_IRGRP: int -S_IWGRP: int -S_IXGRP: int -S_IRWXO: int -S_IROTH: int -S_IWOTH: int -S_IXOTH: int -S_ENFMT: int -S_IREAD: int -S_IWRITE: int -S_IEXEC: int -UF_NODUMP: int -UF_IMMUTABLE: int -UF_APPEND: int -UF_OPAQUE: int -UF_NOUNLINK: int -UF_COMPRESSED: int -UF_HIDDEN: int -SF_ARCHIVED: int -SF_IMMUTABLE: int -SF_APPEND: int -SF_NOUNLINK: int -SF_SNAPSHOT: int diff --git a/stdlib/@python2/string.pyi b/stdlib/@python2/string.pyi deleted file mode 100644 index fe028da..0000000 --- a/stdlib/@python2/string.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from typing import Any, AnyStr, Iterable, List, Mapping, Sequence, Text, Tuple, overload - -ascii_letters: str -ascii_lowercase: str -ascii_uppercase: str -digits: str -hexdigits: str -letters: str -lowercase: str -octdigits: str -punctuation: str -printable: str -uppercase: str -whitespace: str - -def capwords(s: AnyStr, sep: AnyStr = ...) -> AnyStr: ... - -# TODO: originally named 'from' -def maketrans(_from: str, to: str) -> str: ... -def atof(s: unicode) -> float: ... -def atoi(s: unicode, base: int = ...) -> int: ... -def atol(s: unicode, base: int = ...) -> int: ... -def capitalize(word: AnyStr) -> AnyStr: ... -def find(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def rfind(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def index(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def rindex(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def count(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def lower(s: AnyStr) -> AnyStr: ... -def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def rsplit(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def join(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... -def joinfields(word: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... -def lstrip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ... -def rstrip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ... -def strip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ... -def swapcase(s: AnyStr) -> AnyStr: ... -def translate(s: str, table: str, deletechars: str = ...) -> str: ... -def upper(s: AnyStr) -> AnyStr: ... -def ljust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ... -def rjust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ... -def center(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ... -def zfill(s: AnyStr, width: int) -> AnyStr: ... -def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnyStr: ... - -class Template: - template: Text - def __init__(self, template: Text) -> None: ... - @overload - def substitute(self, mapping: Mapping[str, str] | Mapping[unicode, str] = ..., **kwds: str) -> str: ... - @overload - def substitute(self, mapping: Mapping[str, Text] | Mapping[unicode, Text] = ..., **kwds: Text) -> Text: ... - @overload - def safe_substitute(self, mapping: Mapping[str, str] | Mapping[unicode, str] = ..., **kwds: str) -> str: ... - @overload - def safe_substitute(self, mapping: Mapping[str, Text] | Mapping[unicode, Text], **kwds: Text) -> Text: ... - -# TODO(MichalPokorny): This is probably badly and/or loosely typed. -class Formatter(object): - def format(self, format_string: str, *args, **kwargs) -> str: ... - def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ... - def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ... - def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... - def get_value(self, key: int | str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... - def check_unused_args(self, used_args: Sequence[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ... - def format_field(self, value: Any, format_spec: str) -> Any: ... - def convert_field(self, value: Any, conversion: str) -> Any: ... diff --git a/stdlib/@python2/stringold.pyi b/stdlib/@python2/stringold.pyi deleted file mode 100644 index d221547..0000000 --- a/stdlib/@python2/stringold.pyi +++ /dev/null @@ -1,44 +0,0 @@ -from typing import AnyStr, Iterable, List - -whitespace: str -lowercase: str -uppercase: str -letters: str -digits: str -hexdigits: str -octdigits: str -_idmap: str -_idmapL: List[str] | None -index_error = ValueError -atoi_error = ValueError -atof_error = ValueError -atol_error = ValueError - -def lower(s: AnyStr) -> AnyStr: ... -def upper(s: AnyStr) -> AnyStr: ... -def swapcase(s: AnyStr) -> AnyStr: ... -def strip(s: AnyStr) -> AnyStr: ... -def lstrip(s: AnyStr) -> AnyStr: ... -def rstrip(s: AnyStr) -> AnyStr: ... -def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ... -def join(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... -def joinfields(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ... -def index(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def rindex(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def count(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def find(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def rfind(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ... -def atof(s: unicode) -> float: ... -def atoi(s: unicode, base: int = ...) -> int: ... -def atol(s: unicode, base: int = ...) -> long: ... -def ljust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ... -def rjust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ... -def center(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ... -def zfill(s: AnyStr, width: int) -> AnyStr: ... -def expandtabs(s: AnyStr, tabsize: int = ...) -> AnyStr: ... -def translate(s: str, table: str, deletions: str = ...) -> str: ... -def capitalize(s: AnyStr) -> AnyStr: ... -def capwords(s: AnyStr, sep: AnyStr = ...) -> AnyStr: ... -def maketrans(fromstr: str, tostr: str) -> str: ... -def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnyStr: ... diff --git a/stdlib/@python2/stringprep.pyi b/stdlib/@python2/stringprep.pyi deleted file mode 100644 index 604fd2f..0000000 --- a/stdlib/@python2/stringprep.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Text - -def in_table_a1(code: Text) -> bool: ... -def in_table_b1(code: Text) -> bool: ... -def map_table_b3(code: Text) -> Text: ... -def map_table_b2(a: Text) -> Text: ... -def in_table_c11(code: Text) -> bool: ... -def in_table_c12(code: Text) -> bool: ... -def in_table_c11_c12(code: Text) -> bool: ... -def in_table_c21(code: Text) -> bool: ... -def in_table_c22(code: Text) -> bool: ... -def in_table_c21_c22(code: Text) -> bool: ... -def in_table_c3(code: Text) -> bool: ... -def in_table_c4(code: Text) -> bool: ... -def in_table_c5(code: Text) -> bool: ... -def in_table_c6(code: Text) -> bool: ... -def in_table_c7(code: Text) -> bool: ... -def in_table_c8(code: Text) -> bool: ... -def in_table_c9(code: Text) -> bool: ... -def in_table_d1(code: Text) -> bool: ... -def in_table_d2(code: Text) -> bool: ... diff --git a/stdlib/@python2/strop.pyi b/stdlib/@python2/strop.pyi deleted file mode 100644 index 81035ea..0000000 --- a/stdlib/@python2/strop.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import List, Sequence - -lowercase: str -uppercase: str -whitespace: str - -def atof(a: str) -> float: ... -def atoi(a: str, base: int = ...) -> int: ... -def atol(a: str, base: int = ...) -> long: ... -def capitalize(s: str) -> str: ... -def count(s: str, sub: str, start: int = ..., end: int = ...) -> int: ... -def expandtabs(string: str, tabsize: int = ...) -> str: ... -def find(s: str, sub: str, start: int = ..., end: int = ...) -> int: ... -def join(list: Sequence[str], sep: str = ...) -> str: ... -def joinfields(list: Sequence[str], sep: str = ...) -> str: ... -def lower(s: str) -> str: ... -def lstrip(s: str) -> str: ... -def maketrans(frm: str, to: str) -> str: ... -def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str: ... -def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int: ... -def rstrip(s: str) -> str: ... -def split(s: str, sep: str, maxsplit: int = ...) -> List[str]: ... -def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]: ... -def strip(s: str) -> str: ... -def swapcase(s: str) -> str: ... -def translate(s: str, table: str, deletechars: str = ...) -> str: ... -def upper(s: str) -> str: ... diff --git a/stdlib/@python2/struct.pyi b/stdlib/@python2/struct.pyi deleted file mode 100644 index bf27d12..0000000 --- a/stdlib/@python2/struct.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from array import array -from mmap import mmap -from typing import Any, Text, Tuple, Union - -class error(Exception): ... - -_FmtType = Union[bytes, Text] -_BufferType = Union[array[int], bytes, bytearray, buffer, memoryview, mmap] -_WriteBufferType = Union[array[Any], bytearray, buffer, memoryview, mmap] - -def pack(fmt: _FmtType, *v: Any) -> bytes: ... -def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... -def unpack(__format: _FmtType, __buffer: _BufferType) -> Tuple[Any, ...]: ... -def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... -def calcsize(__format: _FmtType) -> int: ... - -class Struct: - format: bytes - size: int - def __init__(self, format: _FmtType) -> None: ... - def pack(self, *v: Any) -> bytes: ... - def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... - def unpack(self, __buffer: _BufferType) -> Tuple[Any, ...]: ... - def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... diff --git a/stdlib/@python2/subprocess.pyi b/stdlib/@python2/subprocess.pyi deleted file mode 100644 index 8c10127..0000000 --- a/stdlib/@python2/subprocess.pyi +++ /dev/null @@ -1,115 +0,0 @@ -from typing import IO, Any, Callable, Generic, Mapping, Optional, Sequence, Text, Tuple, TypeVar, Union - -_FILE = Union[None, int, IO[Any]] -_TXT = Union[bytes, Text] -_CMD = Union[_TXT, Sequence[_TXT]] -_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]] - -# Same args as Popen.__init__ -def call( - args: _CMD, - bufsize: int = ..., - executable: _TXT = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., -) -> int: ... -def check_call( - args: _CMD, - bufsize: int = ..., - executable: _TXT = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., -) -> int: ... - -# Same args as Popen.__init__ except for stdout -def check_output( - args: _CMD, - bufsize: int = ..., - executable: _TXT = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., -) -> bytes: ... - -PIPE: int -STDOUT: int - -class CalledProcessError(Exception): - returncode: int - # morally: _CMD - cmd: Any - # morally: Optional[bytes] - output: bytes - def __init__(self, returncode: int, cmd: _CMD, output: bytes | None = ...) -> None: ... - -# We use a dummy type variable used to make Popen generic like it is in python 3 -_T = TypeVar("_T", bound=bytes) - -class Popen(Generic[_T]): - stdin: IO[bytes] | None - stdout: IO[bytes] | None - stderr: IO[bytes] | None - pid: int - returncode: int - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: _TXT | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - ) -> Popen[bytes]: ... - def poll(self) -> int | None: ... - def wait(self) -> int: ... - # morally: -> Tuple[Optional[bytes], Optional[bytes]] - def communicate(self, input: _TXT | None = ...) -> Tuple[bytes, bytes]: ... - def send_signal(self, signal: int) -> None: ... - def terminate(self) -> None: ... - def kill(self) -> None: ... - -def list2cmdline(seq: Sequence[str]) -> str: ... # undocumented - -# Windows-only: STARTUPINFO etc. - -STD_INPUT_HANDLE: Any -STD_OUTPUT_HANDLE: Any -STD_ERROR_HANDLE: Any -SW_HIDE: Any -STARTF_USESTDHANDLES: Any -STARTF_USESHOWWINDOW: Any -CREATE_NEW_CONSOLE: Any -CREATE_NEW_PROCESS_GROUP: Any diff --git a/stdlib/@python2/sunau.pyi b/stdlib/@python2/sunau.pyi deleted file mode 100644 index 3ee4b96..0000000 --- a/stdlib/@python2/sunau.pyi +++ /dev/null @@ -1,66 +0,0 @@ -from typing import IO, Any, NoReturn, Text, Tuple, Union - -_File = Union[Text, IO[bytes]] - -class Error(Exception): ... - -AUDIO_FILE_MAGIC: int -AUDIO_FILE_ENCODING_MULAW_8: int -AUDIO_FILE_ENCODING_LINEAR_8: int -AUDIO_FILE_ENCODING_LINEAR_16: int -AUDIO_FILE_ENCODING_LINEAR_24: int -AUDIO_FILE_ENCODING_LINEAR_32: int -AUDIO_FILE_ENCODING_FLOAT: int -AUDIO_FILE_ENCODING_DOUBLE: int -AUDIO_FILE_ENCODING_ADPCM_G721: int -AUDIO_FILE_ENCODING_ADPCM_G722: int -AUDIO_FILE_ENCODING_ADPCM_G723_3: int -AUDIO_FILE_ENCODING_ADPCM_G723_5: int -AUDIO_FILE_ENCODING_ALAW_8: int -AUDIO_UNKNOWN_SIZE: int - -_sunau_params = Tuple[int, int, int, int, str, str] - -class Au_read: - def __init__(self, f: _File) -> None: ... - def getfp(self) -> IO[bytes] | None: ... - def rewind(self) -> None: ... - def close(self) -> None: ... - def tell(self) -> int: ... - def getnchannels(self) -> int: ... - def getnframes(self) -> int: ... - def getsampwidth(self) -> int: ... - def getframerate(self) -> int: ... - def getcomptype(self) -> str: ... - def getcompname(self) -> str: ... - def getparams(self) -> _sunau_params: ... - def getmarkers(self) -> None: ... - def getmark(self, id: Any) -> NoReturn: ... - def setpos(self, pos: int) -> None: ... - def readframes(self, nframes: int) -> bytes | None: ... - -class Au_write: - def __init__(self, f: _File) -> None: ... - def setnchannels(self, nchannels: int) -> None: ... - def getnchannels(self) -> int: ... - def setsampwidth(self, sampwidth: int) -> None: ... - def getsampwidth(self) -> int: ... - def setframerate(self, framerate: float) -> None: ... - def getframerate(self) -> int: ... - def setnframes(self, nframes: int) -> None: ... - def getnframes(self) -> int: ... - def setcomptype(self, type: str, name: str) -> None: ... - def getcomptype(self) -> str: ... - def getcompname(self) -> str: ... - def setparams(self, params: _sunau_params) -> None: ... - def getparams(self) -> _sunau_params: ... - def tell(self) -> int: ... - # should be any bytes-like object after 3.4, but we don't have a type for that - def writeframesraw(self, data: bytes) -> None: ... - def writeframes(self, data: bytes) -> None: ... - def close(self) -> None: ... - -# Returns a Au_read if mode is rb and Au_write if mode is wb -def open(f: _File, mode: str | None = ...) -> Any: ... - -openfp = open diff --git a/stdlib/@python2/symbol.pyi b/stdlib/@python2/symbol.pyi deleted file mode 100644 index a3561fe..0000000 --- a/stdlib/@python2/symbol.pyi +++ /dev/null @@ -1,89 +0,0 @@ -from typing import Dict - -single_input: int -file_input: int -eval_input: int -decorator: int -decorators: int -decorated: int -funcdef: int -parameters: int -varargslist: int -fpdef: int -fplist: int -stmt: int -simple_stmt: int -small_stmt: int -expr_stmt: int -augassign: int -print_stmt: int -del_stmt: int -pass_stmt: int -flow_stmt: int -break_stmt: int -continue_stmt: int -return_stmt: int -yield_stmt: int -raise_stmt: int -import_stmt: int -import_name: int -import_from: int -import_as_name: int -dotted_as_name: int -import_as_names: int -dotted_as_names: int -dotted_name: int -global_stmt: int -exec_stmt: int -assert_stmt: int -compound_stmt: int -if_stmt: int -while_stmt: int -for_stmt: int -try_stmt: int -with_stmt: int -with_item: int -except_clause: int -suite: int -testlist_safe: int -old_test: int -old_lambdef: int -test: int -or_test: int -and_test: int -not_test: int -comparison: int -comp_op: int -expr: int -xor_expr: int -and_expr: int -shift_expr: int -arith_expr: int -term: int -factor: int -power: int -atom: int -listmaker: int -testlist_comp: int -lambdef: int -trailer: int -subscriptlist: int -subscript: int -sliceop: int -exprlist: int -testlist: int -dictorsetmaker: int -classdef: int -arglist: int -argument: int -list_iter: int -list_for: int -list_if: int -comp_iter: int -comp_for: int -comp_if: int -testlist1: int -encoding_decl: int -yield_expr: int - -sym_name: Dict[int, str] diff --git a/stdlib/@python2/symtable.pyi b/stdlib/@python2/symtable.pyi deleted file mode 100644 index bd3f25c..0000000 --- a/stdlib/@python2/symtable.pyi +++ /dev/null @@ -1,43 +0,0 @@ -from typing import Any, List, Sequence, Text, Tuple - -def symtable(code: Text, filename: Text, compile_type: Text) -> SymbolTable: ... - -class SymbolTable(object): - def __init__(self, raw_table: Any, filename: str) -> None: ... - def get_type(self) -> str: ... - def get_id(self) -> int: ... - def get_name(self) -> str: ... - def get_lineno(self) -> int: ... - def is_optimized(self) -> bool: ... - def is_nested(self) -> bool: ... - def has_children(self) -> bool: ... - def has_exec(self) -> bool: ... - def has_import_star(self) -> bool: ... - def get_identifiers(self) -> Sequence[str]: ... - def lookup(self, name: str) -> Symbol: ... - def get_symbols(self) -> List[Symbol]: ... - def get_children(self) -> List[SymbolTable]: ... - -class Function(SymbolTable): - def get_parameters(self) -> Tuple[str, ...]: ... - def get_locals(self) -> Tuple[str, ...]: ... - def get_globals(self) -> Tuple[str, ...]: ... - def get_frees(self) -> Tuple[str, ...]: ... - -class Class(SymbolTable): - def get_methods(self) -> Tuple[str, ...]: ... - -class Symbol(object): - def __init__(self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ...) -> None: ... - def get_name(self) -> str: ... - def is_referenced(self) -> bool: ... - def is_parameter(self) -> bool: ... - def is_global(self) -> bool: ... - def is_declared_global(self) -> bool: ... - def is_local(self) -> bool: ... - def is_free(self) -> bool: ... - def is_imported(self) -> bool: ... - def is_assigned(self) -> bool: ... - def is_namespace(self) -> bool: ... - def get_namespaces(self) -> Sequence[SymbolTable]: ... - def get_namespace(self) -> SymbolTable: ... diff --git a/stdlib/@python2/sys.pyi b/stdlib/@python2/sys.pyi deleted file mode 100644 index d4858ec..0000000 --- a/stdlib/@python2/sys.pyi +++ /dev/null @@ -1,130 +0,0 @@ -from types import ClassType, FrameType, TracebackType -from typing import IO, Any, Callable, Dict, List, NoReturn, Text, Tuple, Type, Union - -# The following type alias are stub-only and do not exist during runtime -_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] -_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]] - -class _flags: - bytes_warning: int - debug: int - division_new: int - division_warning: int - dont_write_bytecode: int - hash_randomization: int - ignore_environment: int - inspect: int - interactive: int - no_site: int - no_user_site: int - optimize: int - py3k_warning: int - tabcheck: int - unicode: int - verbose: int - -class _float_info: - max: float - max_exp: int - max_10_exp: int - min: float - min_exp: int - min_10_exp: int - dig: int - mant_dig: int - epsilon: float - radix: int - rounds: int - -class _version_info(Tuple[int, int, int, str, int]): - major: int - minor: int - micro: int - releaselevel: str - serial: int - -_mercurial: Tuple[str, str, str] -api_version: int -argv: List[str] -builtin_module_names: Tuple[str, ...] -byteorder: str -copyright: str -dont_write_bytecode: bool -exec_prefix: str -executable: str -flags: _flags -float_repr_style: str -hexversion: int -long_info: object -maxint: int -maxsize: int -maxunicode: int -modules: Dict[str, Any] -path: List[str] -platform: str -prefix: str -py3kwarning: bool -__stderr__: IO[str] -__stdin__: IO[str] -__stdout__: IO[str] -stderr: IO[str] -stdin: IO[str] -stdout: IO[str] -subversion: Tuple[str, str, str] -version: str -warnoptions: object -float_info: _float_info -version_info: _version_info -ps1: str -ps2: str -last_type: type -last_value: BaseException -last_traceback: TracebackType -# TODO precise types -meta_path: List[Any] -path_hooks: List[Any] -path_importer_cache: Dict[str, Any] -displayhook: Callable[[object], Any] -excepthook: Callable[[Type[BaseException], BaseException, TracebackType], Any] -exc_type: type | None -exc_value: BaseException | ClassType -exc_traceback: TracebackType - -class _WindowsVersionType: - major: Any - minor: Any - build: Any - platform: Any - service_pack: Any - service_pack_major: Any - service_pack_minor: Any - suite_mask: Any - product_type: Any - -def getwindowsversion() -> _WindowsVersionType: ... -def _clear_type_cache() -> None: ... -def _current_frames() -> Dict[int, FrameType]: ... -def _getframe(depth: int = ...) -> FrameType: ... -def call_tracing(fn: Any, args: Any) -> Any: ... -def __displayhook__(value: object) -> None: ... -def __excepthook__(type_: type, value: BaseException, traceback: TracebackType) -> None: ... -def exc_clear() -> None: ... -def exc_info() -> _OptExcInfo: ... - -# sys.exit() accepts an optional argument of anything printable -def exit(arg: Any = ...) -> NoReturn: ... -def getcheckinterval() -> int: ... # deprecated -def getdefaultencoding() -> str: ... -def getdlopenflags() -> int: ... -def getfilesystemencoding() -> str: ... # In practice, never returns None -def getrefcount(arg: Any) -> int: ... -def getrecursionlimit() -> int: ... -def getsizeof(obj: object, default: int = ...) -> int: ... -def getprofile() -> Any | None: ... -def gettrace() -> Any | None: ... -def setcheckinterval(interval: int) -> None: ... # deprecated -def setdlopenflags(n: int) -> None: ... -def setdefaultencoding(encoding: Text) -> None: ... # only exists after reload(sys) -def setprofile(profilefunc: Any) -> None: ... # TODO type -def setrecursionlimit(limit: int) -> None: ... -def settrace(tracefunc: Any) -> None: ... # TODO type diff --git a/stdlib/@python2/sysconfig.pyi b/stdlib/@python2/sysconfig.pyi deleted file mode 100644 index 2bef9e4..0000000 --- a/stdlib/@python2/sysconfig.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import IO, Any, Dict, List, Tuple, overload - -def get_config_var(name: str) -> str | None: ... -@overload -def get_config_vars() -> Dict[str, Any]: ... -@overload -def get_config_vars(arg: str, *args: str) -> List[Any]: ... -def get_scheme_names() -> Tuple[str, ...]: ... -def get_path_names() -> Tuple[str, ...]: ... -def get_path(name: str, scheme: str = ..., vars: Dict[str, Any] | None = ..., expand: bool = ...) -> str: ... -def get_paths(scheme: str = ..., vars: Dict[str, Any] | None = ..., expand: bool = ...) -> Dict[str, str]: ... -def get_python_version() -> str: ... -def get_platform() -> str: ... -def is_python_build(check_home: bool = ...) -> bool: ... -def parse_config_h(fp: IO[Any], vars: Dict[str, Any] | None = ...) -> Dict[str, Any]: ... -def get_config_h_filename() -> str: ... -def get_makefile_filename() -> str: ... diff --git a/stdlib/@python2/syslog.pyi b/stdlib/@python2/syslog.pyi deleted file mode 100644 index 49169f4..0000000 --- a/stdlib/@python2/syslog.pyi +++ /dev/null @@ -1,43 +0,0 @@ -from typing import overload - -LOG_ALERT: int -LOG_AUTH: int -LOG_CONS: int -LOG_CRIT: int -LOG_CRON: int -LOG_DAEMON: int -LOG_DEBUG: int -LOG_EMERG: int -LOG_ERR: int -LOG_INFO: int -LOG_KERN: int -LOG_LOCAL0: int -LOG_LOCAL1: int -LOG_LOCAL2: int -LOG_LOCAL3: int -LOG_LOCAL4: int -LOG_LOCAL5: int -LOG_LOCAL6: int -LOG_LOCAL7: int -LOG_LPR: int -LOG_MAIL: int -LOG_NDELAY: int -LOG_NEWS: int -LOG_NOTICE: int -LOG_NOWAIT: int -LOG_PERROR: int -LOG_PID: int -LOG_SYSLOG: int -LOG_USER: int -LOG_UUCP: int -LOG_WARNING: int - -def LOG_MASK(a: int) -> int: ... -def LOG_UPTO(a: int) -> int: ... -def closelog() -> None: ... -def openlog(ident: str = ..., logoption: int = ..., facility: int = ...) -> None: ... -def setlogmask(x: int) -> int: ... -@overload -def syslog(priority: int, message: str) -> None: ... -@overload -def syslog(message: str) -> None: ... diff --git a/stdlib/@python2/tabnanny.pyi b/stdlib/@python2/tabnanny.pyi deleted file mode 100644 index 9587376..0000000 --- a/stdlib/@python2/tabnanny.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Iterable, Text, Tuple - -verbose: int -filename_only: int - -class NannyNag(Exception): - def __init__(self, lineno: int, msg: str, line: str) -> None: ... - def get_lineno(self) -> int: ... - def get_msg(self) -> str: ... - def get_line(self) -> str: ... - -def check(file: Text) -> None: ... -def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ... diff --git a/stdlib/@python2/tarfile.pyi b/stdlib/@python2/tarfile.pyi deleted file mode 100644 index c08c96b..0000000 --- a/stdlib/@python2/tarfile.pyi +++ /dev/null @@ -1,288 +0,0 @@ -import io -from types import TracebackType -from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Text, Tuple, Type - -# tar constants -NUL: bytes -BLOCKSIZE: int -RECORDSIZE: int -GNU_MAGIC: bytes -POSIX_MAGIC: bytes - -LENGTH_NAME: int -LENGTH_LINK: int -LENGTH_PREFIX: int - -REGTYPE: bytes -AREGTYPE: bytes -LNKTYPE: bytes -SYMTYPE: bytes -CONTTYPE: bytes -BLKTYPE: bytes -DIRTYPE: bytes -FIFOTYPE: bytes -CHRTYPE: bytes - -GNUTYPE_LONGNAME: bytes -GNUTYPE_LONGLINK: bytes -GNUTYPE_SPARSE: bytes - -XHDTYPE: bytes -XGLTYPE: bytes -SOLARIS_XHDTYPE: bytes - -USTAR_FORMAT: int -GNU_FORMAT: int -PAX_FORMAT: int -DEFAULT_FORMAT: int - -# tarfile constants - -SUPPORTED_TYPES: Tuple[bytes, ...] -REGULAR_TYPES: Tuple[bytes, ...] -GNU_TYPES: Tuple[bytes, ...] -PAX_FIELDS: Tuple[str, ...] -PAX_NUMBER_FIELDS: Dict[str, type] - -ENCODING: str - -TAR_PLAIN: int -TAR_GZIPPED: int - -def open( - name: Text | None = ..., - mode: str = ..., - fileobj: IO[bytes] | None = ..., - bufsize: int = ..., - *, - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - errors: str = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - compresslevel: int | None = ..., -) -> TarFile: ... - -class ExFileObject(io.BufferedReader): - def __init__(self, tarfile: TarFile, tarinfo: TarInfo) -> None: ... - -class TarFile(Iterable[TarInfo]): - OPEN_METH: Mapping[str, str] - name: Text | None - mode: str - fileobj: IO[bytes] | None - format: int | None - tarinfo: Type[TarInfo] - dereference: bool | None - ignore_zeros: bool | None - encoding: str | None - errors: str - fileobject: Type[ExFileObject] - pax_headers: Mapping[str, str] | None - debug: int | None - errorlevel: int | None - offset: int # undocumented - posix: bool - def __init__( - self, - name: Text | None = ..., - mode: str = ..., - fileobj: IO[bytes] | None = ..., - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - errors: str = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - copybufsize: int | None = ..., # undocumented - ) -> None: ... - def __enter__(self) -> TarFile: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - def __iter__(self) -> Iterator[TarInfo]: ... - @classmethod - def open( - cls, - name: Text | None = ..., - mode: str = ..., - fileobj: IO[bytes] | None = ..., - bufsize: int = ..., - *, - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - errors: str = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - ) -> TarFile: ... - @classmethod - def taropen( - cls, - name: Text | None, - mode: str = ..., - fileobj: IO[bytes] | None = ..., - *, - compresslevel: int = ..., - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - ) -> TarFile: ... - @classmethod - def gzopen( - cls, - name: Text | None, - mode: str = ..., - fileobj: IO[bytes] | None = ..., - compresslevel: int = ..., - *, - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - ) -> TarFile: ... - @classmethod - def bz2open( - cls, - name: Text | None, - mode: str = ..., - fileobj: IO[bytes] | None = ..., - compresslevel: int = ..., - *, - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - ) -> TarFile: ... - @classmethod - def xzopen( - cls, - name: Text | None, - mode: str = ..., - fileobj: IO[bytes] | None = ..., - preset: int | None = ..., - *, - format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - ) -> TarFile: ... - def getmember(self, name: str) -> TarInfo: ... - def getmembers(self) -> List[TarInfo]: ... - def getnames(self) -> List[str]: ... - def list(self, verbose: bool = ...) -> None: ... - def next(self) -> TarInfo | None: ... - def extractall(self, path: Text = ..., members: Iterable[TarInfo] | None = ...) -> None: ... - def extract(self, member: str | TarInfo, path: Text = ...) -> None: ... - def extractfile(self, member: str | TarInfo) -> IO[bytes] | None: ... - def makedir(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def makefile(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def makeunknown(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def makefifo(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def makedev(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def makelink(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def chown(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def chmod(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def utime(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented - def add( - self, - name: str, - arcname: str | None = ..., - recursive: bool = ..., - exclude: Callable[[str], bool] | None = ..., - filter: Callable[[TarInfo], TarInfo | None] | None = ..., - ) -> None: ... - def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = ...) -> None: ... - def gettarinfo(self, name: str | None = ..., arcname: str | None = ..., fileobj: IO[bytes] | None = ...) -> TarInfo: ... - def close(self) -> None: ... - -def is_tarfile(name: Text) -> bool: ... -def filemode(mode: int) -> str: ... # undocumented - -class TarFileCompat: - def __init__(self, filename: str, mode: str = ..., compression: int = ...) -> None: ... - -class TarError(Exception): ... -class ReadError(TarError): ... -class CompressionError(TarError): ... -class StreamError(TarError): ... -class ExtractError(TarError): ... -class HeaderError(TarError): ... - -class TarInfo: - name: str - path: str - size: int - mtime: int - chksum: int - devmajor: int - devminor: int - offset: int - offset_data: int - sparse: bytes | None - tarfile: TarFile | None - mode: int - type: bytes - linkname: str - uid: int - gid: int - uname: str - gname: str - pax_headers: Mapping[str, str] - def __init__(self, name: str = ...) -> None: ... - @classmethod - 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, str | int | bytes | Mapping[str, str]]: ... - def tobuf(self, format: int | None = ..., encoding: str | None = ..., errors: str = ...) -> bytes: ... - def create_ustar_header( - self, info: Mapping[str, str | int | bytes | Mapping[str, str]], encoding: str, errors: str - ) -> bytes: ... - def create_gnu_header( - self, info: Mapping[str, str | int | bytes | Mapping[str, str]], encoding: str, errors: str - ) -> bytes: ... - def create_pax_header(self, info: Mapping[str, 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: ... - def ischr(self) -> bool: ... - def isblk(self) -> bool: ... - def isfifo(self) -> bool: ... - def isdev(self) -> bool: ... diff --git a/stdlib/@python2/telnetlib.pyi b/stdlib/@python2/telnetlib.pyi deleted file mode 100644 index dfb01f2..0000000 --- a/stdlib/@python2/telnetlib.pyi +++ /dev/null @@ -1,111 +0,0 @@ -import socket -from typing import Any, Callable, Match, Pattern, Sequence, Tuple - -DEBUGLEVEL: int -TELNET_PORT: int - -IAC: bytes -DONT: bytes -DO: bytes -WONT: bytes -WILL: bytes -theNULL: bytes - -SE: bytes -NOP: bytes -DM: bytes -BRK: bytes -IP: bytes -AO: bytes -AYT: bytes -EC: bytes -EL: bytes -GA: bytes -SB: bytes - -BINARY: bytes -ECHO: bytes -RCP: bytes -SGA: bytes -NAMS: bytes -STATUS: bytes -TM: bytes -RCTE: bytes -NAOL: bytes -NAOP: bytes -NAOCRD: bytes -NAOHTS: bytes -NAOHTD: bytes -NAOFFD: bytes -NAOVTS: bytes -NAOVTD: bytes -NAOLFD: bytes -XASCII: bytes -LOGOUT: bytes -BM: bytes -DET: bytes -SUPDUP: bytes -SUPDUPOUTPUT: bytes -SNDLOC: bytes -TTYPE: bytes -EOR: bytes -TUID: bytes -OUTMRK: bytes -TTYLOC: bytes -VT3270REGIME: bytes -X3PAD: bytes -NAWS: bytes -TSPEED: bytes -LFLOW: bytes -LINEMODE: bytes -XDISPLOC: bytes -OLD_ENVIRON: bytes -AUTHENTICATION: bytes -ENCRYPT: bytes -NEW_ENVIRON: bytes - -TN3270E: bytes -XAUTH: bytes -CHARSET: bytes -RSP: bytes -COM_PORT_OPTION: bytes -SUPPRESS_LOCAL_ECHO: bytes -TLS: bytes -KERMIT: bytes -SEND_URL: bytes -FORWARD_X: bytes -PRAGMA_LOGON: bytes -SSPI_LOGON: bytes -PRAGMA_HEARTBEAT: bytes -EXOPL: bytes -NOOPT: bytes - -class Telnet: - host: str | None # undocumented - def __init__(self, host: str | None = ..., port: int = ..., timeout: float = ...) -> None: ... - def open(self, host: str, port: int = ..., timeout: float = ...) -> None: ... - def msg(self, msg: str, *args: Any) -> None: ... - def set_debuglevel(self, debuglevel: int) -> None: ... - def close(self) -> None: ... - def get_socket(self) -> socket.socket: ... - def fileno(self) -> int: ... - def write(self, buffer: bytes) -> None: ... - def read_until(self, match: bytes, timeout: float | None = ...) -> bytes: ... - def read_all(self) -> bytes: ... - def read_some(self) -> bytes: ... - def read_very_eager(self) -> bytes: ... - def read_eager(self) -> bytes: ... - def read_lazy(self) -> bytes: ... - def read_very_lazy(self) -> bytes: ... - def read_sb_data(self) -> bytes: ... - def set_option_negotiation_callback(self, callback: Callable[[socket.socket, bytes, bytes], Any] | None) -> None: ... - def process_rawq(self) -> None: ... - def rawq_getchar(self) -> bytes: ... - def fill_rawq(self) -> None: ... - def sock_avail(self) -> bool: ... - def interact(self) -> None: ... - def mt_interact(self) -> None: ... - def listener(self) -> None: ... - def expect( - self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... - ) -> Tuple[int, Match[bytes] | None, bytes]: ... diff --git a/stdlib/@python2/tempfile.pyi b/stdlib/@python2/tempfile.pyi deleted file mode 100644 index c5f67d2..0000000 --- a/stdlib/@python2/tempfile.pyi +++ /dev/null @@ -1,100 +0,0 @@ -from random import Random -from thread import LockType -from typing import IO, Any, AnyStr, Iterable, Iterator, List, Text, Tuple, overload - -TMP_MAX: int -tempdir: str -template: str -_name_sequence: _RandomNameSequence | None - -class _RandomNameSequence: - characters: str = ... - mutex: LockType - @property - def rng(self) -> Random: ... - def __iter__(self) -> _RandomNameSequence: ... - def next(self) -> str: ... - # from os.path: - def normcase(self, path: AnyStr) -> AnyStr: ... - -class _TemporaryFileWrapper(IO[str]): - delete: bool - file: IO[str] - name: Any - def __init__(self, file: IO[str], name: Any, delete: bool = ...) -> None: ... - def __del__(self) -> None: ... - def __enter__(self) -> _TemporaryFileWrapper: ... - def __exit__(self, exc, value, tb) -> bool | None: ... - def __getattr__(self, name: unicode) -> Any: ... - def close(self) -> None: ... - def unlink(self, path: unicode) -> None: ... - # These methods don't exist directly on this object, but - # are delegated to the underlying IO object through __getattr__. - # We need to add them here so that this class is concrete. - def __iter__(self) -> Iterator[str]: ... - def fileno(self) -> int: ... - def flush(self) -> None: ... - def isatty(self) -> bool: ... - def next(self) -> str: ... - def read(self, n: int = ...) -> str: ... - def readable(self) -> bool: ... - def readline(self, limit: int = ...) -> str: ... - def readlines(self, hint: int = ...) -> List[str]: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def seekable(self) -> bool: ... - def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> int: ... - def writable(self) -> bool: ... - def write(self, s: Text) -> int: ... - def writelines(self, lines: Iterable[str]) -> None: ... - -# TODO text files - -def TemporaryFile( - mode: bytes | unicode = ..., - bufsize: int = ..., - suffix: bytes | unicode = ..., - prefix: bytes | unicode = ..., - dir: bytes | unicode | None = ..., -) -> _TemporaryFileWrapper: ... -def NamedTemporaryFile( - mode: bytes | unicode = ..., - bufsize: int = ..., - suffix: bytes | unicode = ..., - prefix: bytes | unicode = ..., - dir: bytes | unicode | None = ..., - delete: bool = ..., -) -> _TemporaryFileWrapper: ... -def SpooledTemporaryFile( - max_size: int = ..., - mode: bytes | unicode = ..., - buffering: int = ..., - suffix: bytes | unicode = ..., - prefix: bytes | unicode = ..., - dir: bytes | unicode | None = ..., -) -> _TemporaryFileWrapper: ... - -class TemporaryDirectory: - name: Any - def __init__(self, suffix: bytes | unicode = ..., prefix: bytes | unicode = ..., dir: bytes | unicode = ...) -> None: ... - def cleanup(self) -> None: ... - def __enter__(self) -> Any: ... # Can be str or unicode - def __exit__(self, type, value, traceback) -> None: ... - -@overload -def mkstemp() -> Tuple[int, str]: ... -@overload -def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr | None = ..., text: bool = ...) -> Tuple[int, AnyStr]: ... -@overload -def mkdtemp() -> str: ... -@overload -def mkdtemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr | None = ...) -> AnyStr: ... -@overload -def mktemp() -> str: ... -@overload -def mktemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr | None = ...) -> AnyStr: ... -def gettempdir() -> str: ... -def gettempprefix() -> str: ... -def _candidate_tempdir_list() -> List[str]: ... -def _get_candidate_names() -> _RandomNameSequence | None: ... -def _get_default_tempdir() -> str: ... diff --git a/stdlib/@python2/termios.pyi b/stdlib/@python2/termios.pyi deleted file mode 100644 index 0c627f4..0000000 --- a/stdlib/@python2/termios.pyi +++ /dev/null @@ -1,246 +0,0 @@ -from _typeshed import FileDescriptorLike -from typing import Any, List, Union - -_Attr = List[Union[int, List[Union[bytes, int]]]] - -# TODO constants not really documented -B0: int -B1000000: int -B110: int -B115200: int -B1152000: int -B1200: int -B134: int -B150: int -B1500000: int -B1800: int -B19200: int -B200: int -B2000000: int -B230400: int -B2400: int -B2500000: int -B300: int -B3000000: int -B3500000: int -B38400: int -B4000000: int -B460800: int -B4800: int -B50: int -B500000: int -B57600: int -B576000: int -B600: int -B75: int -B921600: int -B9600: int -BRKINT: int -BS0: int -BS1: int -BSDLY: int -CBAUD: int -CBAUDEX: int -CDSUSP: int -CEOF: int -CEOL: int -CEOT: int -CERASE: int -CFLUSH: int -CIBAUD: int -CINTR: int -CKILL: int -CLNEXT: int -CLOCAL: int -CQUIT: int -CR0: int -CR1: int -CR2: int -CR3: int -CRDLY: int -CREAD: int -CRPRNT: int -CRTSCTS: int -CS5: int -CS6: int -CS7: int -CS8: int -CSIZE: int -CSTART: int -CSTOP: int -CSTOPB: int -CSUSP: int -CWERASE: int -ECHO: int -ECHOCTL: int -ECHOE: int -ECHOK: int -ECHOKE: int -ECHONL: int -ECHOPRT: int -EXTA: int -EXTB: int -FF0: int -FF1: int -FFDLY: int -FIOASYNC: int -FIOCLEX: int -FIONBIO: int -FIONCLEX: int -FIONREAD: int -FLUSHO: int -HUPCL: int -ICANON: int -ICRNL: int -IEXTEN: int -IGNBRK: int -IGNCR: int -IGNPAR: int -IMAXBEL: int -INLCR: int -INPCK: int -IOCSIZE_MASK: int -IOCSIZE_SHIFT: int -ISIG: int -ISTRIP: int -IUCLC: int -IXANY: int -IXOFF: int -IXON: int -NCC: int -NCCS: int -NL0: int -NL1: int -NLDLY: int -NOFLSH: int -N_MOUSE: int -N_PPP: int -N_SLIP: int -N_STRIP: int -N_TTY: int -OCRNL: int -OFDEL: int -OFILL: int -OLCUC: int -ONLCR: int -ONLRET: int -ONOCR: int -OPOST: int -PARENB: int -PARMRK: int -PARODD: int -PENDIN: int -TAB0: int -TAB1: int -TAB2: int -TAB3: int -TABDLY: int -TCFLSH: int -TCGETA: int -TCGETS: int -TCIFLUSH: int -TCIOFF: int -TCIOFLUSH: int -TCION: int -TCOFLUSH: int -TCOOFF: int -TCOON: int -TCSADRAIN: int -TCSAFLUSH: int -TCSANOW: int -TCSBRK: int -TCSBRKP: int -TCSETA: int -TCSETAF: int -TCSETAW: int -TCSETS: int -TCSETSF: int -TCSETSW: int -TCXONC: int -TIOCCONS: int -TIOCEXCL: int -TIOCGETD: int -TIOCGICOUNT: int -TIOCGLCKTRMIOS: int -TIOCGPGRP: int -TIOCGSERIAL: int -TIOCGSOFTCAR: int -TIOCGWINSZ: int -TIOCINQ: int -TIOCLINUX: int -TIOCMBIC: int -TIOCMBIS: int -TIOCMGET: int -TIOCMIWAIT: int -TIOCMSET: int -TIOCM_CAR: int -TIOCM_CD: int -TIOCM_CTS: int -TIOCM_DSR: int -TIOCM_DTR: int -TIOCM_LE: int -TIOCM_RI: int -TIOCM_RNG: int -TIOCM_RTS: int -TIOCM_SR: int -TIOCM_ST: int -TIOCNOTTY: int -TIOCNXCL: int -TIOCOUTQ: int -TIOCPKT: int -TIOCPKT_DATA: int -TIOCPKT_DOSTOP: int -TIOCPKT_FLUSHREAD: int -TIOCPKT_FLUSHWRITE: int -TIOCPKT_NOSTOP: int -TIOCPKT_START: int -TIOCPKT_STOP: int -TIOCSCTTY: int -TIOCSERCONFIG: int -TIOCSERGETLSR: int -TIOCSERGETMULTI: int -TIOCSERGSTRUCT: int -TIOCSERGWILD: int -TIOCSERSETMULTI: int -TIOCSERSWILD: int -TIOCSER_TEMT: int -TIOCSETD: int -TIOCSLCKTRMIOS: int -TIOCSPGRP: int -TIOCSSERIAL: int -TIOCSSOFTCAR: int -TIOCSTI: int -TIOCSWINSZ: int -TOSTOP: int -VDISCARD: int -VEOF: int -VEOL: int -VEOL2: int -VERASE: int -VINTR: int -VKILL: int -VLNEXT: int -VMIN: int -VQUIT: int -VREPRINT: int -VSTART: int -VSTOP: int -VSUSP: int -VSWTC: int -VSWTCH: int -VT0: int -VT1: int -VTDLY: int -VTIME: int -VWERASE: int -XCASE: int -XTABS: int - -def tcgetattr(__fd: FileDescriptorLike) -> List[Any]: ... -def tcsetattr(__fd: FileDescriptorLike, __when: int, __attributes: _Attr) -> None: ... -def tcsendbreak(__fd: FileDescriptorLike, __duration: int) -> None: ... -def tcdrain(__fd: FileDescriptorLike) -> None: ... -def tcflush(__fd: FileDescriptorLike, __queue: int) -> None: ... -def tcflow(__fd: FileDescriptorLike, __action: int) -> None: ... - -class error(Exception): ... diff --git a/stdlib/@python2/textwrap.pyi b/stdlib/@python2/textwrap.pyi deleted file mode 100644 index c4147b4..0000000 --- a/stdlib/@python2/textwrap.pyi +++ /dev/null @@ -1,61 +0,0 @@ -from typing import AnyStr, Dict, List, Pattern - -class TextWrapper(object): - width: int = ... - initial_indent: str = ... - subsequent_indent: str = ... - expand_tabs: bool = ... - replace_whitespace: bool = ... - fix_sentence_endings: bool = ... - drop_whitespace: bool = ... - break_long_words: bool = ... - break_on_hyphens: bool = ... - - # Attributes not present in documentation - sentence_end_re: Pattern[str] = ... - wordsep_re: Pattern[str] = ... - wordsep_simple_re: Pattern[str] = ... - whitespace_trans: str = ... - unicode_whitespace_trans: Dict[int, int] = ... - uspace: int = ... - x: int = ... - def __init__( - self, - width: int = ..., - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ..., - ) -> None: ... - def wrap(self, text: AnyStr) -> List[AnyStr]: ... - def fill(self, text: AnyStr) -> AnyStr: ... - -def wrap( - text: AnyStr, - width: int = ..., - initial_indent: AnyStr = ..., - subsequent_indent: AnyStr = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ..., -) -> List[AnyStr]: ... -def fill( - text: AnyStr, - width: int = ..., - initial_indent: AnyStr = ..., - subsequent_indent: AnyStr = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ..., -) -> AnyStr: ... -def dedent(text: AnyStr) -> AnyStr: ... diff --git a/stdlib/@python2/this.pyi b/stdlib/@python2/this.pyi deleted file mode 100644 index 0687a66..0000000 --- a/stdlib/@python2/this.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import Dict - -s: str -d: Dict[str, str] diff --git a/stdlib/@python2/thread.pyi b/stdlib/@python2/thread.pyi deleted file mode 100644 index b3ba062..0000000 --- a/stdlib/@python2/thread.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Any, Callable - -def _count() -> int: ... - -class error(Exception): ... - -class LockType: - def acquire(self, waitflag: int = ...) -> bool: ... - def acquire_lock(self, waitflag: int = ...) -> bool: ... - def release(self) -> None: ... - def release_lock(self) -> None: ... - def locked(self) -> bool: ... - def locked_lock(self) -> bool: ... - def __enter__(self) -> LockType: ... - def __exit__(self, typ: Any, value: Any, traceback: Any) -> None: ... - -class _local(object): ... -class _localdummy(object): ... - -def start_new(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ... -def start_new_thread(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ... -def interrupt_main() -> None: ... -def exit() -> None: ... -def exit_thread() -> Any: ... -def allocate_lock() -> LockType: ... -def get_ident() -> int: ... -def stack_size(size: int = ...) -> int: ... diff --git a/stdlib/@python2/threading.pyi b/stdlib/@python2/threading.pyi deleted file mode 100644 index e45a1b5..0000000 --- a/stdlib/@python2/threading.pyi +++ /dev/null @@ -1,109 +0,0 @@ -from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar - -# TODO recursive type -_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] - -_PF = Callable[[FrameType, str, Any], None] -_T = TypeVar("_T") - -__all__: List[str] - -def active_count() -> int: ... -def activeCount() -> int: ... -def current_thread() -> Thread: ... -def currentThread() -> Thread: ... -def enumerate() -> List[Thread]: ... -def settrace(func: _TF) -> None: ... -def setprofile(func: _PF | None) -> None: ... -def stack_size(size: int = ...) -> int: ... - -class ThreadError(Exception): ... - -class local(object): - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... - -class Thread: - name: str - ident: int | None - daemon: bool - def __init__( - self, - group: None = ..., - target: Callable[..., Any] | None = ..., - name: Text | None = ..., - args: Iterable[Any] = ..., - kwargs: Mapping[Text, Any] | None = ..., - ) -> None: ... - def start(self) -> None: ... - def run(self) -> None: ... - def join(self, timeout: float | None = ...) -> None: ... - def getName(self) -> str: ... - def setName(self, name: Text) -> None: ... - def is_alive(self) -> bool: ... - def isAlive(self) -> bool: ... - def isDaemon(self) -> bool: ... - def setDaemon(self, daemonic: bool) -> None: ... - -class _DummyThread(Thread): ... - -class Lock: - def __init__(self) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - def locked(self) -> bool: ... - -class _RLock: - def __init__(self) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - -RLock = _RLock - -class Condition: - def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... - def notify(self, n: int = ...) -> None: ... - def notify_all(self) -> None: ... - def notifyAll(self) -> None: ... - -class Semaphore: - def __init__(self, value: int = ...) -> None: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ...) -> bool: ... - def __enter__(self, blocking: bool = ...) -> bool: ... - def release(self) -> None: ... - -class BoundedSemaphore(Semaphore): ... - -class Event: - def __init__(self) -> None: ... - def is_set(self) -> bool: ... - def isSet(self) -> bool: ... - def set(self) -> None: ... - def clear(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... - -class Timer(Thread): - def __init__( - self, interval: float, function: Callable[..., Any], args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ... - ) -> None: ... - def cancel(self) -> None: ... diff --git a/stdlib/@python2/time.pyi b/stdlib/@python2/time.pyi deleted file mode 100644 index 48ae9da..0000000 --- a/stdlib/@python2/time.pyi +++ /dev/null @@ -1,45 +0,0 @@ -import sys -from typing import Any, NamedTuple, Tuple - -_TimeTuple = Tuple[int, int, int, int, int, int, int, int, int] - -accept2dyear: bool -altzone: int -daylight: int -timezone: int -tzname: Tuple[str, str] - -class _struct_time(NamedTuple): - tm_year: int - tm_mon: int - tm_mday: int - tm_hour: int - tm_min: int - tm_sec: int - tm_wday: int - tm_yday: int - tm_isdst: int - @property - def n_fields(self) -> int: ... - @property - def n_sequence_fields(self) -> int: ... - @property - def n_unnamed_fields(self) -> int: ... - -class struct_time(_struct_time): - def __init__(self, o: _TimeTuple, _arg: Any = ...) -> None: ... - def __new__(cls, o: _TimeTuple, _arg: Any = ...) -> struct_time: ... - -def asctime(t: _TimeTuple | struct_time = ...) -> str: ... -def clock() -> float: ... -def ctime(secs: float | None = ...) -> str: ... -def gmtime(secs: float | None = ...) -> struct_time: ... -def localtime(secs: float | None = ...) -> struct_time: ... -def mktime(t: _TimeTuple | struct_time) -> float: ... -def sleep(secs: float) -> None: ... -def strftime(format: str, t: _TimeTuple | struct_time = ...) -> str: ... -def strptime(string: str, format: str = ...) -> struct_time: ... -def time() -> float: ... - -if sys.platform != "win32": - def tzset() -> None: ... # Unix only diff --git a/stdlib/@python2/timeit.pyi b/stdlib/@python2/timeit.pyi deleted file mode 100644 index ecb5287..0000000 --- a/stdlib/@python2/timeit.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from typing import IO, Any, Callable, List, Sequence, Text, Union - -_str = Union[str, Text] -_Timer = Callable[[], float] -_stmt = Union[_str, Callable[[], Any]] - -default_timer: _Timer - -class Timer: - def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...) -> None: ... - def print_exc(self, file: IO[str] | None = ...) -> None: ... - def timeit(self, number: int = ...) -> float: ... - def repeat(self, repeat: int = ..., number: int = ...) -> List[float]: ... - -def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ...) -> float: ... -def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ...) -> List[float]: ... - -_timerFunc = Callable[[], float] - -def main(args: Sequence[str] | None = ..., *, _wrap_timer: Callable[[_timerFunc], _timerFunc] | None = ...) -> None: ... diff --git a/stdlib/@python2/toaiff.pyi b/stdlib/@python2/toaiff.pyi deleted file mode 100644 index b70e026..0000000 --- a/stdlib/@python2/toaiff.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from pipes import Template -from typing import Dict, List - -table: Dict[str, Template] -t: Template -uncompress: Template - -class error(Exception): ... - -def toaiff(filename: str) -> str: ... -def _toaiff(filename: str, temps: List[str]) -> str: ... diff --git a/stdlib/@python2/token.pyi b/stdlib/@python2/token.pyi deleted file mode 100644 index 4ba7104..0000000 --- a/stdlib/@python2/token.pyi +++ /dev/null @@ -1,62 +0,0 @@ -from typing import Dict - -ENDMARKER: int -NAME: int -NUMBER: int -STRING: int -NEWLINE: int -INDENT: int -DEDENT: int -LPAR: int -RPAR: int -LSQB: int -RSQB: int -COLON: int -COMMA: int -SEMI: int -PLUS: int -MINUS: int -STAR: int -SLASH: int -VBAR: int -AMPER: int -LESS: int -GREATER: int -EQUAL: int -DOT: int -PERCENT: int -BACKQUOTE: int -LBRACE: int -RBRACE: int -EQEQUAL: int -NOTEQUAL: int -LESSEQUAL: int -GREATEREQUAL: int -TILDE: int -CIRCUMFLEX: int -LEFTSHIFT: int -RIGHTSHIFT: int -DOUBLESTAR: int -PLUSEQUAL: int -MINEQUAL: int -STAREQUAL: int -SLASHEQUAL: int -PERCENTEQUAL: int -AMPEREQUAL: int -VBAREQUAL: int -CIRCUMFLEXEQUAL: int -LEFTSHIFTEQUAL: int -RIGHTSHIFTEQUAL: int -DOUBLESTAREQUAL: int -DOUBLESLASH: int -DOUBLESLASHEQUAL: int -AT: int -OP: int -ERRORTOKEN: int -N_TOKENS: int -NT_OFFSET: int -tok_name: Dict[int, str] - -def ISTERMINAL(x: int) -> bool: ... -def ISNONTERMINAL(x: int) -> bool: ... -def ISEOF(x: int) -> bool: ... diff --git a/stdlib/@python2/tokenize.pyi b/stdlib/@python2/tokenize.pyi deleted file mode 100644 index 98ec01a..0000000 --- a/stdlib/@python2/tokenize.pyi +++ /dev/null @@ -1,133 +0,0 @@ -from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Tuple - -__author__: str -__credits__: str - -AMPER: int -AMPEREQUAL: int -AT: int -BACKQUOTE: int -Binnumber: str -Bracket: str -CIRCUMFLEX: int -CIRCUMFLEXEQUAL: int -COLON: int -COMMA: int -COMMENT: int -Comment: str -ContStr: str -DEDENT: int -DOT: int -DOUBLESLASH: int -DOUBLESLASHEQUAL: int -DOUBLESTAR: int -DOUBLESTAREQUAL: int -Decnumber: str -Double: str -Double3: str -ENDMARKER: int -EQEQUAL: int -EQUAL: int -ERRORTOKEN: int -Expfloat: str -Exponent: str -Floatnumber: str -Funny: str -GREATER: int -GREATEREQUAL: int -Hexnumber: str -INDENT: int - -def ISEOF(x: int) -> bool: ... -def ISNONTERMINAL(x: int) -> bool: ... -def ISTERMINAL(x: int) -> bool: ... - -Ignore: str -Imagnumber: str -Intnumber: str -LBRACE: int -LEFTSHIFT: int -LEFTSHIFTEQUAL: int -LESS: int -LESSEQUAL: int -LPAR: int -LSQB: int -MINEQUAL: int -MINUS: int -NAME: int -NEWLINE: int -NL: int -NOTEQUAL: int -NT_OFFSET: int -NUMBER: int -N_TOKENS: int -Name: str -Number: str -OP: int -Octnumber: str -Operator: str -PERCENT: int -PERCENTEQUAL: int -PLUS: int -PLUSEQUAL: int -PlainToken: str -Pointfloat: str -PseudoExtras: str -PseudoToken: str -RBRACE: int -RIGHTSHIFT: int -RIGHTSHIFTEQUAL: int -RPAR: int -RSQB: int -SEMI: int -SLASH: int -SLASHEQUAL: int -STAR: int -STAREQUAL: int -STRING: int -Single: str -Single3: str -Special: str -String: str -TILDE: int -Token: str -Triple: str -VBAR: int -VBAREQUAL: int -Whitespace: str -chain: type -double3prog: type -endprogs: Dict[str, Any] -pseudoprog: type -single3prog: type -single_quoted: Dict[str, str] -t: str -tabsize: int -tok_name: Dict[int, str] -tokenprog: type -triple_quoted: Dict[str, str] -x: str - -_Pos = Tuple[int, int] -_TokenType = Tuple[int, str, _Pos, _Pos, str] - -def any(*args, **kwargs) -> str: ... -def generate_tokens(readline: Callable[[], str]) -> Generator[_TokenType, None, None]: ... -def group(*args: str) -> str: ... -def maybe(*args: str) -> str: ... -def printtoken(type: int, token: str, srow_scol: _Pos, erow_ecol: _Pos, line: str) -> None: ... -def tokenize(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... -def tokenize_loop(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... -def untokenize(iterable: Iterable[_TokenType]) -> str: ... - -class StopTokenizing(Exception): ... -class TokenError(Exception): ... - -class Untokenizer: - prev_col: int - prev_row: int - tokens: List[str] - def __init__(self) -> None: ... - def add_whitespace(self, _Pos) -> None: ... - def compat(self, token: Tuple[int, Any], iterable: Iterator[_TokenType]) -> None: ... - def untokenize(self, iterable: Iterable[_TokenType]) -> str: ... diff --git a/stdlib/@python2/trace.pyi b/stdlib/@python2/trace.pyi deleted file mode 100644 index 62f2286..0000000 --- a/stdlib/@python2/trace.pyi +++ /dev/null @@ -1,49 +0,0 @@ -import types -from _typeshed import StrPath -from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, TypeVar - -_T = TypeVar("_T") -_localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] -_fileModuleFunction = Tuple[str, Optional[str], str] - -class CoverageResults: - def __init__( - self, - counts: Dict[Tuple[str, int], int] | None = ..., - calledfuncs: Dict[_fileModuleFunction, int] | None = ..., - infile: StrPath | None = ..., - callers: Dict[Tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ..., - outfile: StrPath | None = ..., - ) -> None: ... # undocumented - def update(self, other: CoverageResults) -> None: ... - def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: StrPath | None = ...) -> None: ... - def write_results_file( - self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: str | None = ... - ) -> Tuple[int, int]: ... - -class Trace: - def __init__( - self, - count: int = ..., - trace: int = ..., - countfuncs: int = ..., - countcallers: int = ..., - ignoremods: Sequence[str] = ..., - ignoredirs: Sequence[str] = ..., - infile: StrPath | None = ..., - outfile: StrPath | None = ..., - timing: bool = ..., - ) -> None: ... - def run(self, cmd: str | types.CodeType) -> None: ... - def runctx( - self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ... - ) -> None: ... - def runfunc(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... - def file_module_function_of(self, frame: types.FrameType) -> _fileModuleFunction: ... - def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... - def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ... - def globaltrace_lt(self, frame: types.FrameType, why: str, arg: Any) -> None: ... - def localtrace_trace_and_count(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ... - def localtrace_trace(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ... - def localtrace_count(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ... - def results(self) -> CoverageResults: ... diff --git a/stdlib/@python2/traceback.pyi b/stdlib/@python2/traceback.pyi deleted file mode 100644 index 2152ab2..0000000 --- a/stdlib/@python2/traceback.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from types import FrameType, TracebackType -from typing import IO, List, Optional, Tuple, Type - -_PT = Tuple[str, int, str, Optional[str]] - -def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ... -def print_exception( - etype: Type[BaseException] | None, - value: BaseException | None, - tb: TracebackType | None, - limit: int | None = ..., - file: IO[str] | None = ..., -) -> None: ... -def print_exc(limit: int | None = ..., file: IO[str] | None = ...) -> None: ... -def print_last(limit: int | None = ..., file: IO[str] | None = ...) -> None: ... -def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: IO[str] | None = ...) -> None: ... -def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> List[_PT]: ... -def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> List[_PT]: ... -def format_list(extracted_list: List[_PT]) -> List[str]: ... -def format_exception_only(etype: Type[BaseException] | None, value: BaseException | None) -> List[str]: ... -def format_exception( - etype: Type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, limit: int | None = ... -) -> List[str]: ... -def format_exc(limit: int | None = ...) -> str: ... -def format_tb(tb: TracebackType | None, limit: int | None = ...) -> List[str]: ... -def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> List[str]: ... -def tb_lineno(tb: TracebackType) -> int: ... diff --git a/stdlib/@python2/tty.pyi b/stdlib/@python2/tty.pyi deleted file mode 100644 index c0dc418..0000000 --- a/stdlib/@python2/tty.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import IO, Union - -_FD = Union[int, IO[str]] - -# XXX: Undocumented integer constants -IFLAG: int -OFLAG: int -CFLAG: int -LFLAG: int -ISPEED: int -OSPEED: int -CC: int - -def setraw(fd: _FD, when: int = ...) -> None: ... -def setcbreak(fd: _FD, when: int = ...) -> None: ... diff --git a/stdlib/@python2/turtle.pyi b/stdlib/@python2/turtle.pyi deleted file mode 100644 index 659dfd3..0000000 --- a/stdlib/@python2/turtle.pyi +++ /dev/null @@ -1,504 +0,0 @@ -from typing import Any, Callable, Dict, List, Sequence, Text, Tuple, TypeVar, Union, overload - -# TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module. -Canvas = Any -PhotoImage = Any - -# Note: '_Color' is the alias we use for arguments and _AnyColor is the -# alias we use for return types. Really, these two aliases should be the -# same, but as per the "no union returns" typeshed policy, we'll return -# Any instead. -_Color = Union[Text, Tuple[float, float, float]] -_AnyColor = Any - -# TODO: Replace this with a TypedDict once it becomes standardized. -_PenState = Dict[str, Any] - -_Speed = Union[str, float] -_PolygonCoords = Sequence[Tuple[float, float]] - -# TODO: Type this more accurately -# Vec2D is actually a custom subclass of 'tuple'. -Vec2D = Tuple[float, float] - -class TurtleScreenBase(object): - cv: Canvas = ... - canvwidth: int = ... - canvheight: int = ... - xscale: float = ... - yscale: float = ... - def __init__(self, cv: Canvas) -> None: ... - -class Terminator(Exception): ... -class TurtleGraphicsError(Exception): ... - -class Shape(object): - def __init__(self, type_: str, data: _PolygonCoords | PhotoImage | None = ...) -> None: ... - def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: _Color | None = ...) -> None: ... - -class TurtleScreen(TurtleScreenBase): - def __init__(self, cv: Canvas, mode: str = ..., colormode: float = ..., delay: int = ...) -> None: ... - def clear(self) -> None: ... - @overload - def mode(self, mode: None = ...) -> str: ... - @overload - def mode(self, mode: str) -> None: ... - def setworldcoordinates(self, llx: float, lly: float, urx: float, ury: float) -> None: ... - def register_shape(self, name: str, shape: _PolygonCoords | Shape | None = ...) -> None: ... - @overload - def colormode(self, cmode: None = ...) -> float: ... - @overload - def colormode(self, cmode: float) -> None: ... - def reset(self) -> None: ... - def turtles(self) -> List[Turtle]: ... - @overload - def bgcolor(self) -> _AnyColor: ... - @overload - def bgcolor(self, color: _Color) -> None: ... - @overload - def bgcolor(self, r: float, g: float, b: float) -> None: ... - @overload - def tracer(self, n: None = ...) -> int: ... - @overload - def tracer(self, n: int, delay: int | None = ...) -> None: ... - @overload - def delay(self, delay: None = ...) -> int: ... - @overload - def delay(self, delay: int) -> None: ... - def update(self) -> None: ... - def window_width(self) -> int: ... - def window_height(self) -> int: ... - def getcanvas(self) -> Canvas: ... - def getshapes(self) -> List[str]: ... - def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... - def onkey(self, fun: Callable[[], Any], key: str) -> None: ... - def listen(self, xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... - def ontimer(self, fun: Callable[[], Any], t: int = ...) -> None: ... - @overload - def bgpic(self, picname: None = ...) -> str: ... - @overload - def bgpic(self, picname: str) -> None: ... - @overload - def screensize(self, canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ... - # Looks like if self.cv is not a ScrolledCanvas, this could return a tuple as well - @overload - def screensize(self, canvwidth: int, canvheight: int, bg: _Color | None = ...) -> None: ... - onscreenclick = onclick - resetscreen = reset - clearscreen = clear - addshape = register_shape - -class TNavigator(object): - START_ORIENTATION: Dict[str, Vec2D] = ... - DEFAULT_MODE: str = ... - DEFAULT_ANGLEOFFSET: int = ... - DEFAULT_ANGLEORIENT: int = ... - def __init__(self, mode: str = ...) -> None: ... - def reset(self) -> None: ... - def degrees(self, fullcircle: float = ...) -> None: ... - def radians(self) -> None: ... - def forward(self, distance: float) -> None: ... - def back(self, distance: float) -> None: ... - def right(self, angle: float) -> None: ... - def left(self, angle: float) -> None: ... - def pos(self) -> Vec2D: ... - def xcor(self) -> float: ... - def ycor(self) -> float: ... - @overload - def goto(self, x: Tuple[float, float], y: None = ...) -> None: ... - @overload - def goto(self, x: float, y: float) -> None: ... - def home(self) -> None: ... - def setx(self, x: float) -> None: ... - def sety(self, y: float) -> None: ... - @overload - def distance(self, x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... - @overload - def distance(self, x: float, y: float) -> float: ... - @overload - def towards(self, x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... - @overload - def towards(self, x: float, y: float) -> float: ... - def heading(self) -> float: ... - def setheading(self, to_angle: float) -> None: ... - def circle(self, radius: float, extent: float | None = ..., steps: int | None = ...) -> None: ... - fd = forward - bk = back - backward = back - rt = right - lt = left - position = pos - setpos = goto - setposition = goto - seth = setheading - -class TPen(object): - def __init__(self, resizemode: str = ...) -> None: ... - @overload - def resizemode(self, rmode: None = ...) -> str: ... - @overload - def resizemode(self, rmode: str) -> None: ... - @overload - def pensize(self, width: None = ...) -> int: ... - @overload - def pensize(self, width: int) -> None: ... - def penup(self) -> None: ... - def pendown(self) -> None: ... - def isdown(self) -> bool: ... - @overload - def speed(self, speed: None = ...) -> int: ... - @overload - def speed(self, speed: _Speed) -> None: ... - @overload - def pencolor(self) -> _AnyColor: ... - @overload - def pencolor(self, color: _Color) -> None: ... - @overload - def pencolor(self, r: float, g: float, b: float) -> None: ... - @overload - def fillcolor(self) -> _AnyColor: ... - @overload - def fillcolor(self, color: _Color) -> None: ... - @overload - def fillcolor(self, r: float, g: float, b: float) -> None: ... - @overload - def color(self) -> Tuple[_AnyColor, _AnyColor]: ... - @overload - def color(self, color: _Color) -> None: ... - @overload - def color(self, r: float, g: float, b: float) -> None: ... - @overload - def color(self, color1: _Color, color2: _Color) -> None: ... - def showturtle(self) -> None: ... - def hideturtle(self) -> None: ... - def isvisible(self) -> bool: ... - # Note: signatures 1 and 2 overlap unsafely when no arguments are provided - @overload - def pen(self) -> _PenState: ... # type: ignore - @overload - def pen( - self, - pen: _PenState | None = ..., - *, - shown: bool = ..., - pendown: bool = ..., - pencolor: _Color = ..., - fillcolor: _Color = ..., - pensize: int = ..., - speed: int = ..., - resizemode: str = ..., - stretchfactor: Tuple[float, float] = ..., - outline: int = ..., - tilt: float = ..., - ) -> None: ... - width = pensize - up = penup - pu = penup - pd = pendown - down = pendown - st = showturtle - ht = hideturtle - -_T = TypeVar("_T") - -class RawTurtle(TPen, TNavigator): - def __init__( - self, canvas: Canvas | TurtleScreen | None = ..., shape: str = ..., undobuffersize: int = ..., visible: bool = ... - ) -> None: ... - def reset(self) -> None: ... - def setundobuffer(self, size: int | None) -> None: ... - def undobufferentries(self) -> int: ... - def clear(self) -> None: ... - def clone(self: _T) -> _T: ... - @overload - def shape(self, name: None = ...) -> str: ... - @overload - def shape(self, name: str) -> None: ... - # Unsafely overlaps when no arguments are provided - @overload - def shapesize(self) -> Tuple[float, float, float]: ... # type: ignore - @overload - def shapesize( - self, stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ... - ) -> None: ... - def settiltangle(self, angle: float) -> None: ... - @overload - def tiltangle(self, angle: None = ...) -> float: ... - @overload - def tiltangle(self, angle: float) -> None: ... - def tilt(self, angle: float) -> None: ... - # Can return either 'int' or Tuple[int, ...] based on if the stamp is - # a compound stamp or not. So, as per the "no Union return" policy, - # we return Any. - def stamp(self) -> Any: ... - def clearstamp(self, stampid: int | Tuple[int, ...]) -> None: ... - def clearstamps(self, n: int | None = ...) -> None: ... - def filling(self) -> bool: ... - def begin_fill(self) -> None: ... - def end_fill(self) -> None: ... - def dot(self, size: int | None = ..., *color: _Color) -> None: ... - def write(self, arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ... - def begin_poly(self) -> None: ... - def end_poly(self) -> None: ... - def get_poly(self) -> _PolygonCoords | None: ... - def getscreen(self) -> TurtleScreen: ... - def getturtle(self: _T) -> _T: ... - getpen = getturtle - def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ... - def onrelease(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ... - def ondrag(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ... - def undo(self) -> None: ... - turtlesize = shapesize - -class _Screen(TurtleScreen): - def __init__(self) -> None: ... - # Note int and float are interpreted differently, hence the Union instead of just float - def setup( - self, width: int | float = ..., height: int | float = ..., startx: int | None = ..., starty: int | None = ... - ) -> None: ... - def title(self, titlestring: str) -> None: ... - def bye(self) -> None: ... - def exitonclick(self) -> None: ... - -class Turtle(RawTurtle): - def __init__(self, shape: str = ..., undobuffersize: int = ..., visible: bool = ...) -> None: ... - -RawPen = RawTurtle -Pen = Turtle - -def write_docstringdict(filename: str = ...) -> None: ... - -# Note: it's somewhat unfortunate that we have to copy the function signatures. -# It would be nice if we could partially reduce the redundancy by doing something -# like the following: -# -# _screen: Screen -# clear = _screen.clear -# -# However, it seems pytype does not support this type of syntax in pyi files. - -# Functions copied from TurtleScreenBase: - -# Note: mainloop() was always present in the global scope, but was added to -# TurtleScreenBase in Python 3.0 -def mainloop() -> None: ... - -# Functions copied from TurtleScreen: - -def clear() -> None: ... -@overload -def mode(mode: None = ...) -> str: ... -@overload -def mode(mode: str) -> None: ... -def setworldcoordinates(llx: float, lly: float, urx: float, ury: float) -> None: ... -def register_shape(name: str, shape: _PolygonCoords | Shape | None = ...) -> None: ... -@overload -def colormode(cmode: None = ...) -> float: ... -@overload -def colormode(cmode: float) -> None: ... -def reset() -> None: ... -def turtles() -> List[Turtle]: ... -@overload -def bgcolor() -> _AnyColor: ... -@overload -def bgcolor(color: _Color) -> None: ... -@overload -def bgcolor(r: float, g: float, b: float) -> None: ... -@overload -def tracer(n: None = ...) -> int: ... -@overload -def tracer(n: int, delay: int | None = ...) -> None: ... -@overload -def delay(delay: None = ...) -> int: ... -@overload -def delay(delay: int) -> None: ... -def update() -> None: ... -def window_width() -> int: ... -def window_height() -> int: ... -def getcanvas() -> Canvas: ... -def getshapes() -> List[str]: ... -def onclick(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... -def onkey(fun: Callable[[], Any], key: str) -> None: ... -def listen(xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... -def ontimer(fun: Callable[[], Any], t: int = ...) -> None: ... -@overload -def bgpic(picname: None = ...) -> str: ... -@overload -def bgpic(picname: str) -> None: ... -@overload -def screensize(canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ... -@overload -def screensize(canvwidth: int, canvheight: int, bg: _Color | None = ...) -> None: ... - -onscreenclick = onclick -resetscreen = reset -clearscreen = clear -addshape = register_shape -# Functions copied from _Screen: - -def setup(width: float = ..., height: float = ..., startx: int | None = ..., starty: int | None = ...) -> None: ... -def title(titlestring: str) -> None: ... -def bye() -> None: ... -def exitonclick() -> None: ... -def Screen() -> _Screen: ... - -# Functions copied from TNavigator: - -def degrees(fullcircle: float = ...) -> None: ... -def radians() -> None: ... -def forward(distance: float) -> None: ... -def back(distance: float) -> None: ... -def right(angle: float) -> None: ... -def left(angle: float) -> None: ... -def pos() -> Vec2D: ... -def xcor() -> float: ... -def ycor() -> float: ... -@overload -def goto(x: Tuple[float, float], y: None = ...) -> None: ... -@overload -def goto(x: float, y: float) -> None: ... -def home() -> None: ... -def setx(x: float) -> None: ... -def sety(y: float) -> None: ... -@overload -def distance(x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... -@overload -def distance(x: float, y: float) -> float: ... -@overload -def towards(x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... -@overload -def towards(x: float, y: float) -> float: ... -def heading() -> float: ... -def setheading(to_angle: float) -> None: ... -def circle(radius: float, extent: float | None = ..., steps: int | None = ...) -> None: ... - -fd = forward -bk = back -backward = back -rt = right -lt = left -position = pos -setpos = goto -setposition = goto -seth = setheading - -# Functions copied from TPen: -@overload -def resizemode(rmode: None = ...) -> str: ... -@overload -def resizemode(rmode: str) -> None: ... -@overload -def pensize(width: None = ...) -> int: ... -@overload -def pensize(width: int) -> None: ... -def penup() -> None: ... -def pendown() -> None: ... -def isdown() -> bool: ... -@overload -def speed(speed: None = ...) -> int: ... -@overload -def speed(speed: _Speed) -> None: ... -@overload -def pencolor() -> _AnyColor: ... -@overload -def pencolor(color: _Color) -> None: ... -@overload -def pencolor(r: float, g: float, b: float) -> None: ... -@overload -def fillcolor() -> _AnyColor: ... -@overload -def fillcolor(color: _Color) -> None: ... -@overload -def fillcolor(r: float, g: float, b: float) -> None: ... -@overload -def color() -> Tuple[_AnyColor, _AnyColor]: ... -@overload -def color(color: _Color) -> None: ... -@overload -def color(r: float, g: float, b: float) -> None: ... -@overload -def color(color1: _Color, color2: _Color) -> None: ... -def showturtle() -> None: ... -def hideturtle() -> None: ... -def isvisible() -> bool: ... - -# Note: signatures 1 and 2 overlap unsafely when no arguments are provided -@overload -def pen() -> _PenState: ... # type: ignore -@overload -def pen( - pen: _PenState | None = ..., - *, - shown: bool = ..., - pendown: bool = ..., - pencolor: _Color = ..., - fillcolor: _Color = ..., - pensize: int = ..., - speed: int = ..., - resizemode: str = ..., - stretchfactor: Tuple[float, float] = ..., - outline: int = ..., - tilt: float = ..., -) -> None: ... - -width = pensize -up = penup -pu = penup -pd = pendown -down = pendown -st = showturtle -ht = hideturtle - -# Functions copied from RawTurtle: - -def setundobuffer(size: int | None) -> None: ... -def undobufferentries() -> int: ... -@overload -def shape(name: None = ...) -> str: ... -@overload -def shape(name: str) -> None: ... - -# Unsafely overlaps when no arguments are provided -@overload -def shapesize() -> Tuple[float, float, float]: ... # type: ignore -@overload -def shapesize(stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ...) -> None: ... -def settiltangle(angle: float) -> None: ... -@overload -def tiltangle(angle: None = ...) -> float: ... -@overload -def tiltangle(angle: float) -> None: ... -def tilt(angle: float) -> None: ... - -# Can return either 'int' or Tuple[int, ...] based on if the stamp is -# a compound stamp or not. So, as per the "no Union return" policy, -# we return Any. -def stamp() -> Any: ... -def clearstamp(stampid: int | Tuple[int, ...]) -> None: ... -def clearstamps(n: int | None = ...) -> None: ... -def filling() -> bool: ... -def begin_fill() -> None: ... -def end_fill() -> None: ... -def dot(size: int | None = ..., *color: _Color) -> None: ... -def write(arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ... -def begin_poly() -> None: ... -def end_poly() -> None: ... -def get_poly() -> _PolygonCoords | None: ... -def getscreen() -> TurtleScreen: ... -def getturtle() -> Turtle: ... - -getpen = getturtle - -def onrelease(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... -def ondrag(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... -def undo() -> None: ... - -turtlesize = shapesize - -# Functions copied from RawTurtle with a few tweaks: - -def clone() -> Turtle: ... - -# Extra functions present only in the global scope: - -done = mainloop diff --git a/stdlib/@python2/types.pyi b/stdlib/@python2/types.pyi deleted file mode 100644 index 72b9321..0000000 --- a/stdlib/@python2/types.pyi +++ /dev/null @@ -1,193 +0,0 @@ -from typing import Any, Callable, Dict, Iterable, Iterator, List, Tuple, Type, TypeVar, overload - -_T = TypeVar("_T") - -# Note, all classes "defined" here require special handling. - -class NoneType: ... - -TypeType = type -ObjectType = object - -IntType = int -LongType = int # Really long, but can't reference that due to a mypy import cycle -FloatType = float -BooleanType = bool -ComplexType = complex -StringType = str -UnicodeType = unicode -StringTypes: Tuple[Type[StringType], Type[UnicodeType]] -BufferType = buffer -TupleType = tuple -ListType = list -DictType = dict -DictionaryType = dict - -class _Cell: - cell_contents: Any - -class FunctionType: - func_closure: Tuple[_Cell, ...] | None = ... - func_code: CodeType = ... - func_defaults: Tuple[Any, ...] | None = ... - func_dict: Dict[str, Any] = ... - func_doc: str | None = ... - func_globals: Dict[str, Any] = ... - func_name: str = ... - __closure__ = func_closure - __code__ = func_code - __defaults__ = func_defaults - __dict__ = func_dict - __globals__ = func_globals - __name__ = func_name - def __init__( - self, - code: CodeType, - globals: Dict[str, Any], - name: str | None = ..., - argdefs: Tuple[object, ...] | None = ..., - closure: Tuple[_Cell, ...] | None = ..., - ) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: object | None, type: type | None) -> UnboundMethodType: ... - -LambdaType = FunctionType - -class CodeType: - co_argcount: int - co_cellvars: Tuple[str, ...] - co_code: str - co_consts: Tuple[Any, ...] - co_filename: str - co_firstlineno: int - co_flags: int - co_freevars: Tuple[str, ...] - co_lnotab: str - co_name: str - co_names: Tuple[str, ...] - co_nlocals: int - co_stacksize: int - co_varnames: Tuple[str, ...] - def __init__( - self, - argcount: int, - nlocals: int, - stacksize: int, - flags: int, - codestring: str, - constants: Tuple[Any, ...], - names: Tuple[str, ...], - varnames: Tuple[str, ...], - filename: str, - name: str, - firstlineno: int, - lnotab: str, - freevars: Tuple[str, ...] = ..., - cellvars: Tuple[str, ...] = ..., - ) -> None: ... - -class GeneratorType: - gi_code: CodeType - gi_frame: FrameType - gi_running: int - def __iter__(self) -> GeneratorType: ... - def close(self) -> None: ... - def next(self) -> Any: ... - def send(self, __arg: Any) -> Any: ... - @overload - def throw(self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...) -> Any: ... - @overload - def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Any: ... - -class ClassType: ... - -class UnboundMethodType: - im_class: type = ... - im_func: FunctionType = ... - im_self: object = ... - __name__: str - __func__ = im_func - __self__ = im_self - def __init__(self, func: Callable[..., Any], obj: object) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - -class InstanceType(object): ... - -MethodType = UnboundMethodType - -class BuiltinFunctionType: - __self__: object | None - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - -BuiltinMethodType = BuiltinFunctionType - -class ModuleType: - __doc__: str | None - __file__: str | None - __name__: str - __package__: str | None - __path__: Iterable[str] | None - __dict__: Dict[str, Any] - def __init__(self, name: str, doc: str | None = ...) -> None: ... - -FileType = file -XRangeType = xrange - -class TracebackType: - tb_frame: FrameType - tb_lasti: int - tb_lineno: int - tb_next: TracebackType - -class FrameType: - f_back: FrameType - f_builtins: Dict[str, Any] - f_code: CodeType - f_exc_type: None - f_exc_value: None - f_exc_traceback: None - f_globals: Dict[str, Any] - f_lasti: int - f_lineno: int - f_locals: Dict[str, Any] - f_restricted: bool - f_trace: Callable[[], None] - def clear(self) -> None: ... - -SliceType = slice - -class EllipsisType: ... - -class DictProxyType: - # TODO is it possible to have non-string keys? - # no __init__ - def copy(self) -> Dict[Any, Any]: ... - def get(self, key: str, default: _T = ...) -> Any | _T: ... - def has_key(self, key: str) -> bool: ... - def items(self) -> List[Tuple[str, Any]]: ... - def iteritems(self) -> Iterator[Tuple[str, Any]]: ... - def iterkeys(self) -> Iterator[str]: ... - def itervalues(self) -> Iterator[Any]: ... - def keys(self) -> List[str]: ... - def values(self) -> List[Any]: ... - def __contains__(self, key: str) -> bool: ... - def __getitem__(self, key: str) -> Any: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - -class NotImplementedType: ... - -class GetSetDescriptorType: - __name__: str - __objclass__: type - def __get__(self, obj: Any, type: type = ...) -> Any: ... - def __set__(self, obj: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... - -# Same type on Jython, different on CPython and PyPy, unknown on IronPython. -class MemberDescriptorType: - __name__: str - __objclass__: type - def __get__(self, obj: Any, type: type = ...) -> Any: ... - def __set__(self, obj: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... diff --git a/stdlib/@python2/typing.pyi b/stdlib/@python2/typing.pyi deleted file mode 100644 index a1b02e8..0000000 --- a/stdlib/@python2/typing.pyi +++ /dev/null @@ -1,485 +0,0 @@ -import collections # Needed by aliases like DefaultDict, see mypy issue 2986 -from abc import ABCMeta, abstractmethod -from types import CodeType, FrameType, TracebackType - -# Definitions of special type checking related constructs. Their definitions -# are not used, so their value does not matter. - -Any = object() - -class TypeVar: - __name__: str - __bound__: Type[Any] | None - __constraints__: Tuple[Type[Any], ...] - __covariant__: bool - __contravariant__: bool - def __init__( - self, name: str, *constraints: Type[Any], bound: Type[Any] | None = ..., covariant: bool = ..., contravariant: bool = ... - ) -> None: ... - -_promote = object() - -class _SpecialForm(object): - def __getitem__(self, typeargs: Any) -> object: ... - -Union: _SpecialForm = ... -Optional: _SpecialForm = ... -Tuple: _SpecialForm = ... -Generic: _SpecialForm = ... -Protocol: _SpecialForm = ... -Callable: _SpecialForm = ... -Type: _SpecialForm = ... -ClassVar: _SpecialForm = ... -Final: _SpecialForm = ... -_F = TypeVar("_F", bound=Callable[..., Any]) - -def final(f: _F) -> _F: ... -def overload(f: _F) -> _F: ... - -Literal: _SpecialForm = ... -# TypedDict is a (non-subscriptable) special form. -TypedDict: object = ... - -class GenericMeta(type): ... - -# Return type that indicates a function does not return. -# This type is equivalent to the None type, but the no-op Union is necessary to -# distinguish the None type from the None value. -NoReturn = Union[None] - -# These type variables are used by the container types. -_T = TypeVar("_T") -_S = TypeVar("_S") -_KT = TypeVar("_KT") # Key type. -_VT = TypeVar("_VT") # Value type. -_T_co = TypeVar("_T_co", covariant=True) # Any type covariant containers. -_V_co = TypeVar("_V_co", covariant=True) # Any type covariant containers. -_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. -_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. -_T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant. -_TC = TypeVar("_TC", bound=Type[object]) - -def no_type_check(f: _F) -> _F: ... -def no_type_check_decorator(decorator: _F) -> _F: ... - -# Type aliases and type constructors - -class _Alias: - # Class for defining generic aliases for library types. - def __getitem__(self, typeargs: Any) -> Any: ... - -List = _Alias() -Dict = _Alias() -DefaultDict = _Alias() -Set = _Alias() -FrozenSet = _Alias() -Counter = _Alias() -Deque = _Alias() - -# Predefined type variables. -AnyStr = TypeVar("AnyStr", str, unicode) - -# Abstract base classes. - -def runtime_checkable(cls: _TC) -> _TC: ... -@runtime_checkable -class SupportsInt(Protocol, metaclass=ABCMeta): - @abstractmethod - def __int__(self) -> int: ... - -@runtime_checkable -class SupportsFloat(Protocol, metaclass=ABCMeta): - @abstractmethod - def __float__(self) -> float: ... - -@runtime_checkable -class SupportsComplex(Protocol, metaclass=ABCMeta): - @abstractmethod - def __complex__(self) -> complex: ... - -@runtime_checkable -class SupportsAbs(Protocol[_T_co]): - @abstractmethod - def __abs__(self) -> _T_co: ... - -@runtime_checkable -class Reversible(Protocol[_T_co]): - @abstractmethod - def __reversed__(self) -> Iterator[_T_co]: ... - -@runtime_checkable -class Sized(Protocol, metaclass=ABCMeta): - @abstractmethod - def __len__(self) -> int: ... - -@runtime_checkable -class Hashable(Protocol, metaclass=ABCMeta): - # TODO: This is special, in that a subclass of a hashable class may not be hashable - # (for example, list vs. object). It's not obvious how to represent this. This class - # is currently mostly useless for static checking. - @abstractmethod - def __hash__(self) -> int: ... - -@runtime_checkable -class Iterable(Protocol[_T_co]): - @abstractmethod - def __iter__(self) -> Iterator[_T_co]: ... - -@runtime_checkable -class Iterator(Iterable[_T_co], Protocol[_T_co]): - @abstractmethod - def next(self) -> _T_co: ... - def __iter__(self) -> Iterator[_T_co]: ... - -class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): - @abstractmethod - def next(self) -> _T_co: ... - @abstractmethod - def send(self, __value: _T_contra) -> _T_co: ... - @overload - @abstractmethod - def throw( - self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... - ) -> _T_co: ... - @overload - @abstractmethod - def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ... - @abstractmethod - def close(self) -> None: ... - @property - def gi_code(self) -> CodeType: ... - @property - def gi_frame(self) -> FrameType: ... - @property - def gi_running(self) -> bool: ... - -@runtime_checkable -class Container(Protocol[_T_co]): - @abstractmethod - def __contains__(self, x: object) -> bool: ... - -class Sequence(Iterable[_T_co], Container[_T_co], Reversible[_T_co], Generic[_T_co]): - @overload - @abstractmethod - def __getitem__(self, i: int) -> _T_co: ... - @overload - @abstractmethod - def __getitem__(self, s: slice) -> Sequence[_T_co]: ... - # Mixin methods - def index(self, x: Any) -> int: ... - def count(self, x: Any) -> int: ... - def __contains__(self, x: object) -> bool: ... - def __iter__(self) -> Iterator[_T_co]: ... - def __reversed__(self) -> Iterator[_T_co]: ... - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... - -class MutableSequence(Sequence[_T], Generic[_T]): - @abstractmethod - def insert(self, index: int, object: _T) -> None: ... - @overload - @abstractmethod - def __getitem__(self, i: int) -> _T: ... - @overload - @abstractmethod - def __getitem__(self, s: slice) -> MutableSequence[_T]: ... - @overload - @abstractmethod - def __setitem__(self, i: int, o: _T) -> None: ... - @overload - @abstractmethod - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... - @overload - @abstractmethod - def __delitem__(self, i: int) -> None: ... - @overload - @abstractmethod - def __delitem__(self, i: slice) -> None: ... - # Mixin methods - def append(self, object: _T) -> None: ... - def extend(self, iterable: Iterable[_T]) -> None: ... - def reverse(self) -> None: ... - def pop(self, index: int = ...) -> _T: ... - def remove(self, object: _T) -> None: ... - def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ... - -class AbstractSet(Iterable[_T_co], Container[_T_co], Generic[_T_co]): - @abstractmethod - def __contains__(self, x: object) -> bool: ... - # Mixin methods - def __le__(self, s: AbstractSet[Any]) -> bool: ... - def __lt__(self, s: AbstractSet[Any]) -> bool: ... - def __gt__(self, s: AbstractSet[Any]) -> bool: ... - def __ge__(self, s: AbstractSet[Any]) -> bool: ... - def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ... - def __or__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... - def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... - # TODO: argument can be any container? - def isdisjoint(self, s: AbstractSet[Any]) -> bool: ... - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... - -class MutableSet(AbstractSet[_T], Generic[_T]): - @abstractmethod - def add(self, x: _T) -> None: ... - @abstractmethod - def discard(self, x: _T) -> None: ... - # Mixin methods - def clear(self) -> None: ... - def pop(self) -> _T: ... - def remove(self, element: _T) -> None: ... - def __ior__(self, s: AbstractSet[_S]) -> MutableSet[_T | _S]: ... - def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ... - def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[_T | _S]: ... - def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ... - -class MappingView(object): - def __len__(self) -> int: ... - -class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): - def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ... - -class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]): - def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_KT_co]: ... - -class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): - def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_VT_co]: ... - -@runtime_checkable -class ContextManager(Protocol[_T_co]): - def __enter__(self) -> _T_co: ... - def __exit__( - self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None - ) -> bool | None: ... - -class Mapping(Iterable[_KT], Container[_KT], Generic[_KT, _VT_co]): - # TODO: We wish the key type could also be covariant, but that doesn't work, - # see discussion in https: //github.com/python/typing/pull/273. - @abstractmethod - def __getitem__(self, k: _KT) -> _VT_co: ... - # Mixin methods - @overload - def get(self, k: _KT) -> _VT_co | None: ... - @overload - def get(self, k: _KT, default: _VT_co | _T) -> _VT_co | _T: ... - def keys(self) -> list[_KT]: ... - def values(self) -> list[_VT_co]: ... - def items(self) -> list[Tuple[_KT, _VT_co]]: ... - def iterkeys(self) -> Iterator[_KT]: ... - def itervalues(self) -> Iterator[_VT_co]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT_co]]: ... - def __contains__(self, o: object) -> bool: ... - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... - -class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): - @abstractmethod - def __setitem__(self, k: _KT, v: _VT) -> None: ... - @abstractmethod - def __delitem__(self, v: _KT) -> None: ... - def clear(self) -> None: ... - @overload - def pop(self, k: _KT) -> _VT: ... - @overload - def pop(self, k: _KT, default: _VT | _T = ...) -> _VT | _T: ... - def popitem(self) -> Tuple[_KT, _VT]: ... - def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ... - @overload - def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - @overload - def update(self, **kwargs: _VT) -> None: ... - -Text = unicode - -TYPE_CHECKING = True - -class IO(Iterator[AnyStr], Generic[AnyStr]): - # TODO detach - # TODO use abstract properties - @property - def mode(self) -> str: ... - @property - def name(self) -> str: ... - @abstractmethod - def close(self) -> None: ... - @property - def closed(self) -> bool: ... - @abstractmethod - def fileno(self) -> int: ... - @abstractmethod - def flush(self) -> None: ... - @abstractmethod - def isatty(self) -> bool: ... - # TODO what if n is None? - @abstractmethod - def read(self, n: int = ...) -> AnyStr: ... - @abstractmethod - def readable(self) -> bool: ... - @abstractmethod - def readline(self, limit: int = ...) -> AnyStr: ... - @abstractmethod - def readlines(self, hint: int = ...) -> list[AnyStr]: ... - @abstractmethod - def seek(self, offset: int, whence: int = ...) -> int: ... - @abstractmethod - def seekable(self) -> bool: ... - @abstractmethod - def tell(self) -> int: ... - @abstractmethod - def truncate(self, size: int | None = ...) -> int: ... - @abstractmethod - def writable(self) -> bool: ... - # TODO buffer objects - @abstractmethod - def write(self, s: AnyStr) -> int: ... - @abstractmethod - def writelines(self, lines: Iterable[AnyStr]) -> None: ... - @abstractmethod - def next(self) -> AnyStr: ... - @abstractmethod - def __iter__(self) -> Iterator[AnyStr]: ... - @abstractmethod - def __enter__(self) -> IO[AnyStr]: ... - @abstractmethod - def __exit__( - self, t: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None - ) -> bool | None: ... - -class BinaryIO(IO[str]): - # TODO readinto - # TODO read1? - # TODO peek? - @abstractmethod - def __enter__(self) -> BinaryIO: ... - -class TextIO(IO[unicode]): - # TODO use abstractproperty - @property - def buffer(self) -> BinaryIO: ... - @property - def encoding(self) -> str: ... - @property - def errors(self) -> str | None: ... - @property - def line_buffering(self) -> bool: ... - @property - def newlines(self) -> Any: ... # None, str or tuple - @abstractmethod - def __enter__(self) -> TextIO: ... - -class ByteString(Sequence[int], metaclass=ABCMeta): ... - -class Match(Generic[AnyStr]): - pos: int - endpos: int - lastindex: int | None - string: AnyStr - - # The regular expression object whose match() or search() method produced - # this match instance. This should not be Pattern[AnyStr] because the type - # of the pattern is independent of the type of the matched string in - # Python 2. Strictly speaking Match should be generic over AnyStr twice: - # once for the type of the pattern and once for the type of the matched - # string. - re: Pattern[Any] - # Can be None if there are no groups or if the last group was unnamed; - # otherwise matches the type of the pattern. - lastgroup: Any | None - def expand(self, template: str | Text) -> Any: ... - @overload - def group(self, group1: int = ...) -> AnyStr: ... - @overload - def group(self, group1: str) -> AnyStr: ... - @overload - def group(self, group1: int, group2: int, *groups: int) -> Tuple[AnyStr, ...]: ... - @overload - def group(self, group1: str, group2: str, *groups: str) -> Tuple[AnyStr, ...]: ... - def groups(self, default: AnyStr = ...) -> Tuple[AnyStr, ...]: ... - def groupdict(self, default: AnyStr = ...) -> Dict[str, AnyStr]: ... - def start(self, __group: int | str = ...) -> int: ... - def end(self, __group: int | str = ...) -> int: ... - def span(self, __group: int | str = ...) -> Tuple[int, int]: ... - @property - def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented - -# We need a second TypeVar with the same definition as AnyStr, because -# Pattern is generic over AnyStr (determining the type of its .pattern -# attribute), but at the same time its methods take either bytes or -# Text and return the same type, regardless of the type of the pattern. -_AnyStr2 = TypeVar("_AnyStr2", bytes, Text) - -class Pattern(Generic[AnyStr]): - flags: int - groupindex: Dict[AnyStr, int] - groups: int - pattern: AnyStr - def search(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Match[_AnyStr2] | None: ... - def match(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Match[_AnyStr2] | None: ... - def split(self, string: _AnyStr2, maxsplit: int = ...) -> List[_AnyStr2]: ... - # Returns either a list of _AnyStr2 or a list of tuples, depending on - # whether there are groups in the pattern. - def findall(self, string: bytes | Text, pos: int = ..., endpos: int = ...) -> List[Any]: ... - def finditer(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Iterator[Match[_AnyStr2]]: ... - @overload - def sub(self, repl: _AnyStr2, string: _AnyStr2, count: int = ...) -> _AnyStr2: ... - @overload - def sub(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, count: int = ...) -> _AnyStr2: ... - @overload - def subn(self, repl: _AnyStr2, string: _AnyStr2, count: int = ...) -> Tuple[_AnyStr2, int]: ... - @overload - def subn(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, count: int = ...) -> Tuple[_AnyStr2, int]: ... - -# Functions - -def get_type_hints( - obj: Callable[..., Any], globalns: Dict[Text, Any] | None = ..., localns: Dict[Text, Any] | None = ... -) -> None: ... -@overload -def cast(tp: Type[_T], obj: Any) -> _T: ... -@overload -def cast(tp: str, obj: Any) -> Any: ... -@overload -def cast(tp: object, obj: Any) -> Any: ... - -# Type constructors - -# NamedTuple is special-cased in the type checker -class NamedTuple(Tuple[Any, ...]): - _fields: Tuple[str, ...] - def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., **kwargs: Any) -> None: ... - @classmethod - def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ... - def _asdict(self) -> Dict[str, Any]: ... - def _replace(self: _T, **kwargs: Any) -> _T: ... - -# Internal mypy fallback type for all typed dicts (does not exist at runtime) -class _TypedDict(Mapping[str, object], metaclass=ABCMeta): - def copy(self: _T) -> _T: ... - # Using NoReturn so that only calls using mypy plugin hook that specialize the signature - # can go through. - def setdefault(self, k: NoReturn, default: object) -> object: ... - # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... - def update(self: _T, __m: _T) -> None: ... - def has_key(self, k: str) -> bool: ... - def viewitems(self) -> ItemsView[str, object]: ... - def viewkeys(self) -> KeysView[str]: ... - def viewvalues(self) -> ValuesView[object]: ... - def __delitem__(self, k: NoReturn) -> None: ... - -def NewType(name: str, tp: Type[_T]) -> Type[_T]: ... - -# This itself is only available during type checking -def type_check_only(func_or_cls: _F) -> _F: ... diff --git a/stdlib/@python2/typing_extensions.pyi b/stdlib/@python2/typing_extensions.pyi deleted file mode 100644 index d946cc2..0000000 --- a/stdlib/@python2/typing_extensions.pyi +++ /dev/null @@ -1,105 +0,0 @@ -import abc -from typing import ( - TYPE_CHECKING as TYPE_CHECKING, - Any, - Callable, - ClassVar as ClassVar, - ContextManager as ContextManager, - Counter as Counter, - DefaultDict as DefaultDict, - Deque as Deque, - Dict, - ItemsView, - KeysView, - Mapping, - NewType as NewType, - NoReturn as NoReturn, - Text as Text, - Tuple, - Type as Type, - TypeVar, - ValuesView, - _Alias, - overload as overload, -) - -_T = TypeVar("_T") -_F = TypeVar("_F", bound=Callable[..., Any]) -_TC = TypeVar("_TC", bound=Type[object]) - -class _SpecialForm: - def __getitem__(self, typeargs: Any) -> Any: ... - -def runtime_checkable(cls: _TC) -> _TC: ... - -# This alias for above is kept here for backwards compatibility. -runtime = runtime_checkable -Protocol: _SpecialForm = ... -Final: _SpecialForm = ... - -def final(f: _F) -> _F: ... - -Literal: _SpecialForm = ... - -def IntVar(name: str) -> Any: ... # returns a new TypeVar - -# Internal mypy fallback type for all typed dicts (does not exist at runtime) -class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): - def copy(self: _T) -> _T: ... - # Using NoReturn so that only calls using mypy plugin hook that specialize the signature - # can go through. - def setdefault(self, k: NoReturn, default: object) -> object: ... - # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore - def update(self: _T, __m: _T) -> None: ... - def has_key(self, k: str) -> bool: ... - def viewitems(self) -> ItemsView[str, object]: ... - def viewkeys(self) -> KeysView[str]: ... - def viewvalues(self) -> ValuesView[object]: ... - def __delitem__(self, k: NoReturn) -> None: ... - -# TypedDict is a (non-subscriptable) special form. -TypedDict: object = ... - -OrderedDict = _Alias() - -def get_type_hints( - obj: Callable[..., Any], - globalns: Dict[str, Any] | None = ..., - localns: Dict[str, Any] | None = ..., - include_extras: bool = ..., -) -> Dict[str, Any]: ... - -Annotated: _SpecialForm = ... -_AnnotatedAlias: Any = ... # undocumented - -@runtime_checkable -class SupportsIndex(Protocol, metaclass=abc.ABCMeta): - @abc.abstractmethod - def __index__(self) -> int: ... - -# PEP 612 support for Python < 3.9 -class ParamSpecArgs: - __origin__: ParamSpec - def __init__(self, origin: ParamSpec) -> None: ... - -class ParamSpecKwargs: - __origin__: ParamSpec - def __init__(self, origin: ParamSpec) -> None: ... - -class ParamSpec: - __name__: str - __bound__: Type[Any] | None - __covariant__: bool - __contravariant__: bool - def __init__( - self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ... - ) -> None: ... - @property - def args(self) -> ParamSpecArgs: ... - @property - def kwargs(self) -> ParamSpecKwargs: ... - -Concatenate: _SpecialForm = ... -TypeAlias: _SpecialForm = ... -TypeGuard: _SpecialForm = ... diff --git a/stdlib/@python2/unicodedata.pyi b/stdlib/@python2/unicodedata.pyi deleted file mode 100644 index f4ca655..0000000 --- a/stdlib/@python2/unicodedata.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from typing import Any, Text, TypeVar - -ucd_3_2_0: UCD -ucnhash_CAPI: Any -unidata_version: str - -_T = TypeVar("_T") - -def bidirectional(__chr: Text) -> Text: ... -def category(__chr: Text) -> Text: ... -def combining(__chr: Text) -> int: ... -def decimal(__chr: Text, __default: _T = ...) -> int | _T: ... -def decomposition(__chr: Text) -> Text: ... -def digit(__chr: Text, __default: _T = ...) -> int | _T: ... -def east_asian_width(__chr: Text) -> Text: ... -def lookup(__name: Text | bytes) -> Text: ... -def mirrored(__chr: Text) -> int: ... -def name(__chr: Text, __default: _T = ...) -> Text | _T: ... -def normalize(__form: Text, __unistr: Text) -> Text: ... -def numeric(__chr: Text, __default: _T = ...) -> float | _T: ... - -class UCD(object): - # The methods below are constructed from the same array in C - # (unicodedata_functions) and hence identical to the methods above. - unidata_version: str - def bidirectional(self, __chr: Text) -> str: ... - def category(self, __chr: Text) -> str: ... - def combining(self, __chr: Text) -> int: ... - def decimal(self, __chr: Text, __default: _T = ...) -> int | _T: ... - def decomposition(self, __chr: Text) -> str: ... - def digit(self, __chr: Text, __default: _T = ...) -> int | _T: ... - def east_asian_width(self, __chr: Text) -> str: ... - def lookup(self, __name: Text | bytes) -> Text: ... - def mirrored(self, __chr: Text) -> int: ... - def name(self, __chr: Text, __default: _T = ...) -> Text | _T: ... - def normalize(self, __form: Text, __unistr: Text) -> Text: ... - def numeric(self, __chr: Text, __default: _T = ...) -> float | _T: ... diff --git a/stdlib/@python2/unittest.pyi b/stdlib/@python2/unittest.pyi deleted file mode 100644 index 65a5a78..0000000 --- a/stdlib/@python2/unittest.pyi +++ /dev/null @@ -1,277 +0,0 @@ -import datetime -import types -from abc import ABCMeta, abstractmethod -from typing import ( - Any, - Callable, - Dict, - FrozenSet, - Iterable, - Iterator, - List, - Mapping, - NoReturn, - Pattern, - Sequence, - Set, - Text, - TextIO, - Tuple, - Type, - TypeVar, - Union, - overload, -) - -_T = TypeVar("_T") -_FT = TypeVar("_FT") - -_ExceptionType = Union[Type[BaseException], Tuple[Type[BaseException], ...]] -_Regexp = Union[Text, Pattern[Text]] - -_SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None]] - -class Testable(metaclass=ABCMeta): - @abstractmethod - def run(self, result: TestResult) -> None: ... - @abstractmethod - def debug(self) -> None: ... - @abstractmethod - def countTestCases(self) -> int: ... - -# TODO ABC for test runners? - -class TestResult: - errors: List[Tuple[TestCase, str]] - failures: List[Tuple[TestCase, str]] - skipped: List[Tuple[TestCase, str]] - expectedFailures: List[Tuple[TestCase, str]] - unexpectedSuccesses: List[TestCase] - shouldStop: bool - testsRun: int - buffer: bool - failfast: bool - def wasSuccessful(self) -> bool: ... - def stop(self) -> None: ... - def startTest(self, test: TestCase) -> None: ... - def stopTest(self, test: TestCase) -> None: ... - def startTestRun(self) -> None: ... - def stopTestRun(self) -> None: ... - def addError(self, test: TestCase, err: _SysExcInfoType) -> None: ... - def addFailure(self, test: TestCase, err: _SysExcInfoType) -> None: ... - def addSuccess(self, test: TestCase) -> None: ... - def addSkip(self, test: TestCase, reason: str) -> None: ... - def addExpectedFailure(self, test: TestCase, err: str) -> None: ... - def addUnexpectedSuccess(self, test: TestCase) -> None: ... - -class _AssertRaisesBaseContext: - expected: Any - failureException: Type[BaseException] - obj_name: str - expected_regex: Pattern[str] - -class _AssertRaisesContext(_AssertRaisesBaseContext): - exception: Any - def __enter__(self) -> _AssertRaisesContext: ... - def __exit__(self, exc_type, exc_value, tb) -> bool: ... - -class TestCase(Testable): - failureException: Type[BaseException] - longMessage: bool - maxDiff: int | None - # undocumented - _testMethodName: str - def __init__(self, methodName: str = ...) -> None: ... - def setUp(self) -> None: ... - def tearDown(self) -> None: ... - @classmethod - def setUpClass(cls) -> None: ... - @classmethod - def tearDownClass(cls) -> None: ... - def run(self, result: TestResult = ...) -> None: ... - def debug(self) -> None: ... - def assert_(self, expr: Any, msg: object = ...) -> None: ... - def failUnless(self, expr: Any, msg: object = ...) -> None: ... - def assertTrue(self, expr: Any, msg: object = ...) -> None: ... - def assertEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertEquals(self, first: Any, second: Any, msg: object = ...) -> None: ... - def failUnlessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertNotEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertNotEquals(self, first: Any, second: Any, msg: object = ...) -> None: ... - def failIfEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - @overload - def assertAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... - @overload - def assertAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... - @overload - def assertAlmostEqual( - self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ... - ) -> None: ... - @overload - def assertAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... - @overload - def assertAlmostEquals(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... - @overload - def assertAlmostEquals( - self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ... - ) -> None: ... - def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: object = ...) -> None: ... - @overload - def assertNotAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... - @overload - def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... - @overload - def assertNotAlmostEqual( - self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ... - ) -> None: ... - @overload - def assertNotAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... - @overload - def assertNotAlmostEquals(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... - @overload - def assertNotAlmostEquals( - self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ... - ) -> None: ... - def failIfAlmostEqual( - self, first: float, second: float, places: int = ..., msg: object = ..., delta: float = ... - ) -> None: ... - def assertGreater(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertGreaterEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertMultiLineEqual(self, first: str, second: str, msg: object = ...) -> None: ... - def assertSequenceEqual( - self, first: Sequence[Any], second: Sequence[Any], msg: object = ..., seq_type: type = ... - ) -> None: ... - def assertListEqual(self, first: List[Any], second: List[Any], msg: object = ...) -> None: ... - def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], msg: object = ...) -> None: ... - def assertSetEqual(self, first: Set[Any] | FrozenSet[Any], second: Set[Any] | FrozenSet[Any], msg: object = ...) -> None: ... - def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], msg: object = ...) -> None: ... - def assertLess(self, first: Any, second: Any, msg: object = ...) -> None: ... - def assertLessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... - @overload - def assertRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... - @overload - def assertRaises(self, exception: _ExceptionType) -> _AssertRaisesContext: ... - @overload - def assertRaisesRegexp( - self, exception: _ExceptionType, regexp: _Regexp, callable: Callable[..., Any], *args: Any, **kwargs: Any - ) -> None: ... - @overload - def assertRaisesRegexp(self, exception: _ExceptionType, regexp: _Regexp) -> _AssertRaisesContext: ... - def assertRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ... - def assertNotRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ... - def assertItemsEqual(self, first: Iterable[Any], second: Iterable[Any], msg: object = ...) -> None: ... - def assertDictContainsSubset(self, expected: Mapping[Any, Any], actual: Mapping[Any, Any], msg: object = ...) -> None: ... - def addTypeEqualityFunc(self, typeobj: type, function: Callable[..., None]) -> None: ... - @overload - def failUnlessRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... - @overload - def failUnlessRaises(self, exception: _ExceptionType) -> _AssertRaisesContext: ... - def failIf(self, expr: Any, msg: object = ...) -> None: ... - def assertFalse(self, expr: Any, msg: object = ...) -> None: ... - def assertIs(self, first: object, second: object, msg: object = ...) -> None: ... - def assertIsNot(self, first: object, second: object, msg: object = ...) -> None: ... - def assertIsNone(self, expr: Any, msg: object = ...) -> None: ... - def assertIsNotNone(self, expr: Any, msg: object = ...) -> None: ... - def assertIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ... - def assertNotIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ... - def assertIsInstance(self, obj: Any, cls: type | Tuple[type, ...], msg: object = ...) -> None: ... - def assertNotIsInstance(self, obj: Any, cls: type | Tuple[type, ...], msg: object = ...) -> None: ... - def fail(self, msg: object = ...) -> NoReturn: ... - def countTestCases(self) -> int: ... - def defaultTestResult(self) -> TestResult: ... - def id(self) -> str: ... - def shortDescription(self) -> str: ... # May return None - def addCleanup(self, function: Any, *args: Any, **kwargs: Any) -> None: ... - def doCleanups(self) -> bool: ... - def skipTest(self, reason: Any) -> None: ... - def _formatMessage(self, msg: Text | None, standardMsg: Text) -> str: ... # undocumented - def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented - -class FunctionTestCase(TestCase): - def __init__( - self, - testFunc: Callable[[], None], - setUp: Callable[[], None] | None = ..., - tearDown: Callable[[], None] | None = ..., - description: str | None = ..., - ) -> None: ... - def debug(self) -> None: ... - def countTestCases(self) -> int: ... - -class TestSuite(Testable): - def __init__(self, tests: Iterable[Testable] = ...) -> None: ... - def addTest(self, test: Testable) -> None: ... - def addTests(self, tests: Iterable[Testable]) -> None: ... - def run(self, result: TestResult) -> None: ... - def debug(self) -> None: ... - def countTestCases(self) -> int: ... - def __iter__(self) -> Iterator[Testable]: ... - -class TestLoader: - testMethodPrefix: str - sortTestMethodsUsing: Callable[[str, str], int] | None - suiteClass: Callable[[List[TestCase]], TestSuite] - def loadTestsFromTestCase(self, testCaseClass: Type[TestCase]) -> TestSuite: ... - def loadTestsFromModule(self, module: types.ModuleType = ..., use_load_tests: bool = ...) -> TestSuite: ... - def loadTestsFromName(self, name: str = ..., module: types.ModuleType | None = ...) -> TestSuite: ... - def loadTestsFromNames(self, names: List[str] = ..., module: types.ModuleType | None = ...) -> TestSuite: ... - def discover(self, start_dir: str, pattern: str = ..., top_level_dir: str | None = ...) -> TestSuite: ... - def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ... - -defaultTestLoader: TestLoader - -class TextTestResult(TestResult): - def __init__(self, stream: TextIO, descriptions: bool, verbosity: int) -> None: ... - def getDescription(self, test: TestCase) -> str: ... # undocumented - def printErrors(self) -> None: ... # undocumented - def printErrorList(self, flavour: str, errors: List[Tuple[TestCase, str]]) -> None: ... # undocumented - -class TextTestRunner: - def __init__( - self, - stream: TextIO | None = ..., - descriptions: bool = ..., - verbosity: int = ..., - failfast: bool = ..., - buffer: bool = ..., - resultclass: Type[TestResult] | None = ..., - ) -> None: ... - def _makeResult(self) -> TestResult: ... - def run(self, test: Testable) -> TestResult: ... # undocumented - -class SkipTest(Exception): ... - -# TODO precise types -def skipUnless(condition: Any, reason: str | unicode) -> Any: ... -def skipIf(condition: Any, reason: str | unicode) -> Any: ... -def expectedFailure(func: _FT) -> _FT: ... -def skip(reason: str | unicode) -> Any: ... - -# not really documented -class TestProgram: - result: TestResult - def runTests(self) -> None: ... # undocumented - -def main( - module: None | Text | types.ModuleType = ..., - defaultTest: str | None = ..., - argv: Sequence[str] | None = ..., - testRunner: Type[TextTestRunner] | TextTestRunner | None = ..., - testLoader: TestLoader = ..., - exit: bool = ..., - verbosity: int = ..., - failfast: bool | None = ..., - catchbreak: bool | None = ..., - buffer: bool | None = ..., -) -> TestProgram: ... -def load_tests(loader: TestLoader, tests: TestSuite, pattern: Text | None) -> TestSuite: ... -def installHandler() -> None: ... -def registerResult(result: TestResult) -> None: ... -def removeResult(result: TestResult) -> bool: ... -@overload -def removeHandler() -> None: ... -@overload -def removeHandler(function: Callable[..., Any]) -> Callable[..., Any]: ... - -# private but occasionally used -util: types.ModuleType diff --git a/stdlib/@python2/urllib.pyi b/stdlib/@python2/urllib.pyi deleted file mode 100644 index f6bb555..0000000 --- a/stdlib/@python2/urllib.pyi +++ /dev/null @@ -1,133 +0,0 @@ -from typing import IO, Any, AnyStr, List, Mapping, Sequence, Text, Tuple, TypeVar - -def url2pathname(pathname: AnyStr) -> AnyStr: ... -def pathname2url(pathname: AnyStr) -> AnyStr: ... -def urlopen(url: str, data=..., proxies: Mapping[str, str] = ..., context=...) -> IO[Any]: ... -def urlretrieve(url, filename=..., reporthook=..., data=..., context=...): ... -def urlcleanup() -> None: ... - -class ContentTooShortError(IOError): - content: Any - def __init__(self, message, content) -> None: ... - -class URLopener: - version: Any - proxies: Any - key_file: Any - cert_file: Any - context: Any - addheaders: Any - tempcache: Any - ftpcache: Any - def __init__(self, proxies: Mapping[str, str] = ..., context=..., **x509) -> None: ... - def __del__(self): ... - def close(self): ... - def cleanup(self): ... - def addheader(self, *args): ... - type: Any - def open(self, fullurl: str, data=...): ... - def open_unknown(self, fullurl, data=...): ... - def open_unknown_proxy(self, proxy, fullurl, data=...): ... - def retrieve(self, url, filename=..., reporthook=..., data=...): ... - def open_http(self, url, data=...): ... - def http_error(self, url, fp, errcode, errmsg, headers, data=...): ... - def http_error_default(self, url, fp, errcode, errmsg, headers): ... - def open_https(self, url, data=...): ... - def open_file(self, url): ... - def open_local_file(self, url): ... - def open_ftp(self, url): ... - def open_data(self, url, data=...): ... - -class FancyURLopener(URLopener): - auth_cache: Any - tries: Any - maxtries: Any - def __init__(self, *args, **kwargs) -> None: ... - def http_error_default(self, url, fp, errcode, errmsg, headers): ... - def http_error_302(self, url, fp, errcode, errmsg, headers, data=...): ... - def redirect_internal(self, url, fp, errcode, errmsg, headers, data): ... - def http_error_301(self, url, fp, errcode, errmsg, headers, data=...): ... - def http_error_303(self, url, fp, errcode, errmsg, headers, data=...): ... - def http_error_307(self, url, fp, errcode, errmsg, headers, data=...): ... - def http_error_401(self, url, fp, errcode, errmsg, headers, data=...): ... - def http_error_407(self, url, fp, errcode, errmsg, headers, data=...): ... - def retry_proxy_http_basic_auth(self, url, realm, data=...): ... - def retry_proxy_https_basic_auth(self, url, realm, data=...): ... - def retry_http_basic_auth(self, url, realm, data=...): ... - def retry_https_basic_auth(self, url, realm, data=...): ... - def get_user_passwd(self, host, realm, clear_cache=...): ... - def prompt_user_passwd(self, host, realm): ... - -class ftpwrapper: - user: Any - passwd: Any - host: Any - port: Any - dirs: Any - timeout: Any - refcount: Any - keepalive: Any - def __init__(self, user, passwd, host, port, dirs, timeout=..., persistent=...) -> None: ... - busy: Any - ftp: Any - def init(self): ... - def retrfile(self, file, type): ... - def endtransfer(self): ... - def close(self): ... - def file_close(self): ... - def real_close(self): ... - -_AIUT = TypeVar("_AIUT", bound=addbase) - -class addbase: - fp: Any - def read(self, n: int = ...) -> bytes: ... - def readline(self, limit: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... - def fileno(self) -> int: ... # Optional[int], but that is rare - def __iter__(self: _AIUT) -> _AIUT: ... - def next(self) -> bytes: ... - def __init__(self, fp) -> None: ... - def close(self) -> None: ... - -class addclosehook(addbase): - closehook: Any - hookargs: Any - def __init__(self, fp, closehook, *hookargs) -> None: ... - def close(self): ... - -class addinfo(addbase): - headers: Any - def __init__(self, fp, headers) -> None: ... - def info(self): ... - -class addinfourl(addbase): - headers: Any - url: Any - code: Any - def __init__(self, fp, headers, url, code=...) -> None: ... - def info(self): ... - def getcode(self): ... - def geturl(self): ... - -def unwrap(url): ... -def splittype(url): ... -def splithost(url): ... -def splituser(host): ... -def splitpasswd(user): ... -def splitport(host): ... -def splitnport(host, defport=...): ... -def splitquery(url): ... -def splittag(url): ... -def splitattr(url): ... -def splitvalue(attr): ... -def unquote(s: AnyStr) -> AnyStr: ... -def unquote_plus(s: AnyStr) -> AnyStr: ... -def quote(s: AnyStr, safe: Text = ...) -> AnyStr: ... -def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ... -def urlencode(query: Sequence[Tuple[Any, Any]] | Mapping[Any, Any], doseq=...) -> str: ... -def getproxies() -> Mapping[str, str]: ... -def proxy_bypass(host: str) -> Any: ... # undocumented - -# Names in __all__ with no definition: -# basejoin diff --git a/stdlib/@python2/urllib2.pyi b/stdlib/@python2/urllib2.pyi deleted file mode 100644 index bf6157b..0000000 --- a/stdlib/@python2/urllib2.pyi +++ /dev/null @@ -1,185 +0,0 @@ -import ssl -from httplib import HTTPConnectionProtocol, HTTPResponse -from typing import Any, AnyStr, Callable, Dict, List, Mapping, Sequence, Text, Tuple, Type, Union -from urllib import addinfourl - -_string = Union[str, unicode] - -class URLError(IOError): - reason: str | BaseException - -class HTTPError(URLError, addinfourl): - code: int - headers: Mapping[str, str] - def __init__(self, url, code: int, msg: str, hdrs: Mapping[str, str], fp: addinfourl) -> None: ... - -class Request(object): - host: str - port: str - data: str - headers: Dict[str, str] - unverifiable: bool - type: str | None - origin_req_host = ... - unredirected_hdrs: Dict[str, str] - timeout: float | None # Undocumented, only set after __init__() by OpenerDirector.open() - def __init__( - self, - url: str, - data: str | None = ..., - headers: Dict[str, str] = ..., - origin_req_host: str | None = ..., - unverifiable: bool = ..., - ) -> None: ... - def __getattr__(self, attr): ... - def get_method(self) -> str: ... - def add_data(self, data) -> None: ... - def has_data(self) -> bool: ... - def get_data(self) -> str: ... - def get_full_url(self) -> str: ... - def get_type(self): ... - def get_host(self) -> str: ... - def get_selector(self): ... - def set_proxy(self, host, type) -> None: ... - def has_proxy(self) -> bool: ... - def get_origin_req_host(self) -> str: ... - def is_unverifiable(self) -> bool: ... - def add_header(self, key: str, val: str) -> None: ... - def add_unredirected_header(self, key: str, val: str) -> None: ... - def has_header(self, header_name: str) -> bool: ... - def get_header(self, header_name: str, default: str | None = ...) -> str: ... - def header_items(self): ... - -class OpenerDirector(object): - addheaders: List[Tuple[str, str]] - def add_handler(self, handler: BaseHandler) -> None: ... - def open(self, fullurl: Request | _string, data: _string | None = ..., timeout: float | None = ...) -> addinfourl | None: ... - def error(self, proto: _string, *args: Any): ... - -# Note that this type is somewhat a lie. The return *can* be None if -# a custom opener has been installed that fails to handle the request. -def urlopen( - url: Request | _string, - data: _string | None = ..., - timeout: float | None = ..., - cafile: _string | None = ..., - capath: _string | None = ..., - cadefault: bool = ..., - context: ssl.SSLContext | None = ..., -) -> addinfourl: ... -def install_opener(opener: OpenerDirector) -> None: ... -def build_opener(*handlers: BaseHandler | Type[BaseHandler]) -> OpenerDirector: ... - -class BaseHandler: - handler_order: int - parent: OpenerDirector - def add_parent(self, parent: OpenerDirector) -> None: ... - def close(self) -> None: ... - def __lt__(self, other: Any) -> bool: ... - -class HTTPErrorProcessor(BaseHandler): - def http_response(self, request, response): ... - -class HTTPDefaultErrorHandler(BaseHandler): - def http_error_default(self, req: Request, fp: addinfourl, code: int, msg: str, hdrs: Mapping[str, str]): ... - -class HTTPRedirectHandler(BaseHandler): - max_repeats: int - max_redirections: int - def redirect_request(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str], newurl): ... - def http_error_301(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - def http_error_302(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - def http_error_303(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - def http_error_307(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - inf_msg: str - -class ProxyHandler(BaseHandler): - proxies: Mapping[str, str] - def __init__(self, proxies: Mapping[str, str] | None = ...): ... - def proxy_open(self, req: Request, proxy, type): ... - -class HTTPPasswordMgr: - def __init__(self) -> None: ... - def add_password(self, realm: Text | None, uri: Text | Sequence[Text], user: Text, passwd: Text) -> None: ... - def find_user_password(self, realm: Text | None, authuri: Text) -> Tuple[Any, Any]: ... - def reduce_uri(self, uri: _string, default_port: bool = ...) -> Tuple[Any, Any]: ... - def is_suburi(self, base: _string, test: _string) -> bool: ... - -class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): ... - -class AbstractBasicAuthHandler: - def __init__(self, password_mgr: HTTPPasswordMgr | None = ...) -> None: ... - def add_password(self, realm: Text | None, uri: Text | Sequence[Text], user: Text, passwd: Text) -> None: ... - def http_error_auth_reqed(self, authreq, host, req: Request, headers: Mapping[str, str]): ... - def retry_http_basic_auth(self, host, req: Request, realm): ... - -class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): - auth_header: str - def http_error_401(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - -class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): - auth_header: str - def http_error_407(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - -class AbstractDigestAuthHandler: - def __init__(self, passwd: HTTPPasswordMgr | None = ...) -> None: ... - def add_password(self, realm: Text | None, uri: Text | Sequence[Text], user: Text, passwd: Text) -> None: ... - def reset_retry_count(self) -> None: ... - def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ... - def retry_http_digest_auth(self, req: Request, auth: str) -> HTTPResponse | None: ... - def get_cnonce(self, nonce: str) -> str: ... - def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ... - def get_algorithm_impls(self, algorithm: str) -> Tuple[Callable[[str], str], Callable[[str, str], str]]: ... - def get_entity_digest(self, data: bytes | None, chal: Mapping[str, str]) -> str | None: ... - -class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): - auth_header: str - handler_order: int - def http_error_401(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - -class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): - auth_header: str - handler_order: int - def http_error_407(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... - -class AbstractHTTPHandler(BaseHandler): # undocumented - def __init__(self, debuglevel: int = ...) -> None: ... - def set_http_debuglevel(self, level: int) -> None: ... - def do_request_(self, request: Request) -> Request: ... - def do_open(self, http_class: HTTPConnectionProtocol, req: Request, **http_conn_args: Any | None) -> addinfourl: ... - -class HTTPHandler(AbstractHTTPHandler): - def http_open(self, req: Request) -> addinfourl: ... - def http_request(self, request: Request) -> Request: ... # undocumented - -class HTTPSHandler(AbstractHTTPHandler): - def __init__(self, debuglevel: int = ..., context: ssl.SSLContext | None = ...) -> None: ... - def https_open(self, req: Request) -> addinfourl: ... - def https_request(self, request: Request) -> Request: ... # undocumented - -class HTTPCookieProcessor(BaseHandler): - def __init__(self, cookiejar: Any | None = ...): ... - def http_request(self, request: Request): ... - def http_response(self, request: Request, response): ... - -class UnknownHandler(BaseHandler): - def unknown_open(self, req: Request): ... - -class FileHandler(BaseHandler): - def file_open(self, req: Request): ... - def get_names(self): ... - def open_local_file(self, req: Request): ... - -class FTPHandler(BaseHandler): - def ftp_open(self, req: Request): ... - def connect_ftp(self, user, passwd, host, port, dirs, timeout): ... - -class CacheFTPHandler(FTPHandler): - def __init__(self) -> None: ... - def setTimeout(self, t: float | None): ... - def setMaxConns(self, m: int): ... - def check_cache(self): ... - def clear_cache(self): ... - -def parse_http_list(s: AnyStr) -> List[AnyStr]: ... -def parse_keqv_list(l: List[AnyStr]) -> Dict[AnyStr, AnyStr]: ... diff --git a/stdlib/@python2/urlparse.pyi b/stdlib/@python2/urlparse.pyi deleted file mode 100644 index 6668c74..0000000 --- a/stdlib/@python2/urlparse.pyi +++ /dev/null @@ -1,61 +0,0 @@ -from typing import AnyStr, Dict, List, NamedTuple, Sequence, Tuple, Union, overload - -_String = Union[str, unicode] - -uses_relative: List[str] -uses_netloc: List[str] -uses_params: List[str] -non_hierarchical: List[str] -uses_query: List[str] -uses_fragment: List[str] -scheme_chars: str -MAX_CACHE_SIZE: int - -def clear_cache() -> None: ... - -class ResultMixin(object): - @property - def username(self) -> str | None: ... - @property - def password(self) -> str | None: ... - @property - def hostname(self) -> str | None: ... - @property - def port(self) -> int | None: ... - -class _SplitResult(NamedTuple): - scheme: str - netloc: str - path: str - query: str - fragment: str - -class SplitResult(_SplitResult, ResultMixin): - def geturl(self) -> str: ... - -class _ParseResult(NamedTuple): - scheme: str - netloc: str - path: str - params: str - query: str - fragment: str - -class ParseResult(_ParseResult, ResultMixin): - def geturl(self) -> _String: ... - -def urlparse(url: _String, scheme: _String = ..., allow_fragments: bool = ...) -> ParseResult: ... -def urlsplit(url: _String, scheme: _String = ..., allow_fragments: bool = ...) -> SplitResult: ... -@overload -def urlunparse(data: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... -@overload -def urlunparse(data: Sequence[AnyStr]) -> AnyStr: ... -@overload -def urlunsplit(data: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... -@overload -def urlunsplit(data: Sequence[AnyStr]) -> AnyStr: ... -def urljoin(base: AnyStr, url: AnyStr, allow_fragments: bool = ...) -> AnyStr: ... -def urldefrag(url: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -def unquote(s: AnyStr) -> AnyStr: ... -def parse_qs(qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[AnyStr, List[AnyStr]]: ... -def parse_qsl(qs: AnyStr, keep_blank_values: int = ..., strict_parsing: bool = ...) -> List[Tuple[AnyStr, AnyStr]]: ... diff --git a/stdlib/@python2/user.pyi b/stdlib/@python2/user.pyi deleted file mode 100644 index 9c33922..0000000 --- a/stdlib/@python2/user.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import Any - -def __getattr__(name) -> Any: ... - -home: str -pythonrc: str diff --git a/stdlib/@python2/uu.pyi b/stdlib/@python2/uu.pyi deleted file mode 100644 index e8717ae..0000000 --- a/stdlib/@python2/uu.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import BinaryIO, Text, Union - -_File = Union[Text, BinaryIO] - -class Error(Exception): ... - -def encode(in_file: _File, out_file: _File, name: str | None = ..., mode: int | None = ...) -> None: ... -def decode(in_file: _File, out_file: _File | None = ..., mode: int | None = ..., quiet: int = ...) -> None: ... diff --git a/stdlib/@python2/uuid.pyi b/stdlib/@python2/uuid.pyi deleted file mode 100644 index 2c8a9fb..0000000 --- a/stdlib/@python2/uuid.pyi +++ /dev/null @@ -1,81 +0,0 @@ -from typing import Any, Text, Tuple - -# Because UUID has properties called int and bytes we need to rename these temporarily. -_Int = int -_Bytes = bytes -_FieldsType = Tuple[int, int, int, int, int, int] - -class UUID: - def __init__( - self, - hex: Text | None = ..., - bytes: _Bytes | None = ..., - bytes_le: _Bytes | None = ..., - fields: _FieldsType | None = ..., - int: _Int | None = ..., - version: _Int | None = ..., - ) -> None: ... - @property - def bytes(self) -> _Bytes: ... - @property - def bytes_le(self) -> _Bytes: ... - @property - def clock_seq(self) -> _Int: ... - @property - def clock_seq_hi_variant(self) -> _Int: ... - @property - def clock_seq_low(self) -> _Int: ... - @property - def fields(self) -> _FieldsType: ... - @property - def hex(self) -> str: ... - @property - def int(self) -> _Int: ... - @property - def node(self) -> _Int: ... - @property - def time(self) -> _Int: ... - @property - def time_hi_version(self) -> _Int: ... - @property - def time_low(self) -> _Int: ... - @property - def time_mid(self) -> _Int: ... - @property - def urn(self) -> str: ... - @property - def variant(self) -> str: ... - @property - def version(self) -> _Int | None: ... - def __int__(self) -> _Int: ... - def get_bytes(self) -> _Bytes: ... - def get_bytes_le(self) -> _Bytes: ... - def get_clock_seq(self) -> _Int: ... - def get_clock_seq_hi_variant(self) -> _Int: ... - def get_clock_seq_low(self) -> _Int: ... - def get_fields(self) -> _FieldsType: ... - def get_hex(self) -> str: ... - def get_node(self) -> _Int: ... - def get_time(self) -> _Int: ... - def get_time_hi_version(self) -> _Int: ... - def get_time_low(self) -> _Int: ... - def get_time_mid(self) -> _Int: ... - def get_urn(self) -> str: ... - def get_variant(self) -> str: ... - def get_version(self) -> _Int | None: ... - def __cmp__(self, other: Any) -> _Int: ... - -def getnode() -> int: ... -def uuid1(node: _Int | None = ..., clock_seq: _Int | None = ...) -> UUID: ... -def uuid3(namespace: UUID, name: str) -> UUID: ... -def uuid4() -> UUID: ... -def uuid5(namespace: UUID, name: str) -> UUID: ... - -NAMESPACE_DNS: UUID -NAMESPACE_URL: UUID -NAMESPACE_OID: UUID -NAMESPACE_X500: UUID -RESERVED_NCS: str -RFC_4122: str -RESERVED_MICROSOFT: str -RESERVED_FUTURE: str diff --git a/stdlib/@python2/warnings.pyi b/stdlib/@python2/warnings.pyi deleted file mode 100644 index e3540ed..0000000 --- a/stdlib/@python2/warnings.pyi +++ /dev/null @@ -1,52 +0,0 @@ -from types import ModuleType, TracebackType -from typing import List, TextIO, Type, overload -from typing_extensions import Literal - -from _warnings import warn as warn, warn_explicit as warn_explicit - -def showwarning( - message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ... -) -> None: ... -def formatwarning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ... -def filterwarnings( - action: str, message: str = ..., category: Type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ... -) -> None: ... -def simplefilter(action: str, category: Type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... -def resetwarnings() -> None: ... - -class _OptionError(Exception): ... - -class WarningMessage: - message: Warning | str - category: Type[Warning] - filename: str - lineno: int - file: TextIO | None - line: str | None - def __init__( - self, - message: Warning | str, - category: Type[Warning], - filename: str, - lineno: int, - file: TextIO | None = ..., - line: str | None = ..., - ) -> None: ... - -class catch_warnings: - @overload - def __new__(cls, *, record: Literal[False] = ..., module: ModuleType | None = ...) -> _catch_warnings_without_records: ... - @overload - def __new__(cls, *, record: Literal[True], module: ModuleType | None = ...) -> _catch_warnings_with_records: ... - @overload - def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ... - def __enter__(self) -> List[WarningMessage] | None: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - -class _catch_warnings_without_records(catch_warnings): - def __enter__(self) -> None: ... - -class _catch_warnings_with_records(catch_warnings): - def __enter__(self) -> List[WarningMessage]: ... diff --git a/stdlib/@python2/wave.pyi b/stdlib/@python2/wave.pyi deleted file mode 100644 index 0e9fe61..0000000 --- a/stdlib/@python2/wave.pyi +++ /dev/null @@ -1,56 +0,0 @@ -from typing import IO, Any, BinaryIO, NoReturn, Text, Tuple, Union - -_File = Union[Text, IO[bytes]] - -class Error(Exception): ... - -WAVE_FORMAT_PCM: int - -_wave_params = Tuple[int, int, int, int, str, str] - -class Wave_read: - def __init__(self, f: _File) -> None: ... - def getfp(self) -> BinaryIO | None: ... - def rewind(self) -> None: ... - def close(self) -> None: ... - def tell(self) -> int: ... - def getnchannels(self) -> int: ... - def getnframes(self) -> int: ... - def getsampwidth(self) -> int: ... - def getframerate(self) -> int: ... - def getcomptype(self) -> str: ... - def getcompname(self) -> str: ... - def getparams(self) -> _wave_params: ... - def getmarkers(self) -> None: ... - def getmark(self, id: Any) -> NoReturn: ... - def setpos(self, pos: int) -> None: ... - def readframes(self, nframes: int) -> bytes: ... - -class Wave_write: - def __init__(self, f: _File) -> None: ... - def setnchannels(self, nchannels: int) -> None: ... - def getnchannels(self) -> int: ... - def setsampwidth(self, sampwidth: int) -> None: ... - def getsampwidth(self) -> int: ... - def setframerate(self, framerate: float) -> None: ... - def getframerate(self) -> int: ... - def setnframes(self, nframes: int) -> None: ... - def getnframes(self) -> int: ... - def setcomptype(self, comptype: str, compname: str) -> None: ... - def getcomptype(self) -> str: ... - def getcompname(self) -> str: ... - def setparams(self, params: _wave_params) -> None: ... - def getparams(self) -> _wave_params: ... - def setmark(self, id: Any, pos: Any, name: Any) -> NoReturn: ... - def getmark(self, id: Any) -> NoReturn: ... - def getmarkers(self) -> None: ... - def tell(self) -> int: ... - # should be any bytes-like object after 3.4, but we don't have a type for that - def writeframesraw(self, data: bytes) -> None: ... - def writeframes(self, data: bytes) -> None: ... - def close(self) -> None: ... - -# Returns a Wave_read if mode is rb and Wave_write if mode is wb -def open(f: _File, mode: str | None = ...) -> Any: ... - -openfp = open diff --git a/stdlib/@python2/weakref.pyi b/stdlib/@python2/weakref.pyi deleted file mode 100644 index 6467f3a..0000000 --- a/stdlib/@python2/weakref.pyi +++ /dev/null @@ -1,72 +0,0 @@ -from _weakrefset import WeakSet as WeakSet -from typing import Any, Callable, Generic, Iterable, Iterator, List, Mapping, MutableMapping, Tuple, Type, TypeVar, overload - -from _weakref import ( - CallableProxyType as CallableProxyType, - ProxyType as ProxyType, - ReferenceType as ReferenceType, - getweakrefcount as getweakrefcount, - getweakrefs as getweakrefs, - proxy as proxy, - ref as ref, -) -from exceptions import ReferenceError as ReferenceError - -_S = TypeVar("_S") -_T = TypeVar("_T") -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") - -ProxyTypes: Tuple[Type[Any], ...] - -class WeakValueDictionary(MutableMapping[_KT, _VT]): - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, __other: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def has_key(self, key: object) -> bool: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... - def copy(self) -> WeakValueDictionary[_KT, _VT]: ... - def keys(self) -> List[_KT]: ... - def values(self) -> List[_VT]: ... - def items(self) -> List[Tuple[_KT, _VT]]: ... - def iterkeys(self) -> Iterator[_KT]: ... - def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... - def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... - def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ... - -class KeyedRef(ref[_T], Generic[_KT, _T]): - key: _KT - # This __new__ method uses a non-standard name for the "cls" parameter - def __new__(type, ob: _T, callback: Callable[[_T], Any], key: _KT) -> KeyedRef[_KT, _T]: ... # type: ignore - def __init__(self, ob: _T, callback: Callable[[_T], Any], key: _KT) -> None: ... - -class WeakKeyDictionary(MutableMapping[_KT, _VT]): - @overload - def __init__(self, dict: None = ...) -> None: ... - @overload - def __init__(self, dict: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]]) -> None: ... - def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def has_key(self, key: object) -> bool: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... - def copy(self) -> WeakKeyDictionary[_KT, _VT]: ... - def keys(self) -> List[_KT]: ... - def values(self) -> List[_VT]: ... - def items(self) -> List[Tuple[_KT, _VT]]: ... - def iterkeys(self) -> Iterator[_KT]: ... - def itervalues(self) -> Iterator[_VT]: ... - def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... - def iterkeyrefs(self) -> Iterator[ref[_KT]]: ... - def keyrefs(self) -> List[ref[_KT]]: ... diff --git a/stdlib/@python2/webbrowser.pyi b/stdlib/@python2/webbrowser.pyi deleted file mode 100644 index f634bc1..0000000 --- a/stdlib/@python2/webbrowser.pyi +++ /dev/null @@ -1,96 +0,0 @@ -import sys -from typing import Callable, List, Sequence, Text - -class Error(Exception): ... - -def register( - name: Text, klass: Callable[[], BaseBrowser] | None, instance: BaseBrowser | None = ..., update_tryorder: int = ... -) -> None: ... -def get(using: Text | None = ...) -> BaseBrowser: ... -def open(url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... -def open_new(url: Text) -> bool: ... -def open_new_tab(url: Text) -> bool: ... - -class BaseBrowser: - args: List[str] - name: str - basename: str - def __init__(self, name: Text = ...) -> None: ... - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - def open_new(self, url: Text) -> bool: ... - def open_new_tab(self, url: Text) -> bool: ... - -class GenericBrowser(BaseBrowser): - args: List[str] - name: str - basename: str - def __init__(self, name: Text | Sequence[Text]) -> None: ... - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - -class BackgroundBrowser(GenericBrowser): - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - -class UnixBrowser(BaseBrowser): - raise_opts: List[str] | None - background: bool - redirect_stdout: bool - remote_args: List[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - -class Mozilla(UnixBrowser): - remote_args: List[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool - -class Galeon(UnixBrowser): - raise_opts: List[str] - remote_args: List[str] - remote_action: str - remote_action_newwin: str - background: bool - -class Chrome(UnixBrowser): - remote_args: List[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool - -class Opera(UnixBrowser): - remote_args: List[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool - -class Elinks(UnixBrowser): - remote_args: List[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool - redirect_stdout: bool - -class Konqueror(BaseBrowser): - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - -class Grail(BaseBrowser): - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - -if sys.platform == "win32": - class WindowsDefault(BaseBrowser): - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - -if sys.platform == "darwin": - class MacOSX(BaseBrowser): - name: str - def __init__(self, name: Text) -> None: ... - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... - class MacOSXOSAScript(BaseBrowser): - def __init__(self, name: Text) -> None: ... - def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... diff --git a/stdlib/@python2/whichdb.pyi b/stdlib/@python2/whichdb.pyi deleted file mode 100644 index 1c678e9..0000000 --- a/stdlib/@python2/whichdb.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Text - -def whichdb(filename: Text) -> str | None: ... diff --git a/stdlib/@python2/winsound.pyi b/stdlib/@python2/winsound.pyi deleted file mode 100644 index 3d79f3b..0000000 --- a/stdlib/@python2/winsound.pyi +++ /dev/null @@ -1,27 +0,0 @@ -import sys -from typing import overload -from typing_extensions import Literal - -if sys.platform == "win32": - SND_FILENAME: int - SND_ALIAS: int - SND_LOOP: int - SND_MEMORY: int - SND_PURGE: int - SND_ASYNC: int - SND_NODEFAULT: int - SND_NOSTOP: int - SND_NOWAIT: int - - MB_ICONASTERISK: int - MB_ICONEXCLAMATION: int - MB_ICONHAND: int - MB_ICONQUESTION: int - MB_OK: int - def Beep(frequency: int, duration: int) -> None: ... - # Can actually accept anything ORed with 4, and if not it's definitely str, but that's inexpressible - @overload - def PlaySound(sound: bytes | None, flags: Literal[4]) -> None: ... - @overload - def PlaySound(sound: str | bytes | None, flags: int) -> None: ... - def MessageBeep(type: int = ...) -> None: ... diff --git a/stdlib/@python2/wsgiref/handlers.pyi b/stdlib/@python2/wsgiref/handlers.pyi deleted file mode 100644 index d7e35ba..0000000 --- a/stdlib/@python2/wsgiref/handlers.pyi +++ /dev/null @@ -1,89 +0,0 @@ -from abc import abstractmethod -from types import TracebackType -from typing import IO, Callable, List, MutableMapping, Optional, Text, Tuple, Type - -from .headers import Headers -from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment -from .util import FileWrapper - -_exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] - -def format_date_time(timestamp: float | None) -> str: ... # undocumented - -class BaseHandler: - wsgi_version: Tuple[int, int] # undocumented - wsgi_multithread: bool - wsgi_multiprocess: bool - wsgi_run_once: bool - - origin_server: bool - http_version: str - server_software: str | None - - os_environ: MutableMapping[str, str] - - wsgi_file_wrapper: Type[FileWrapper] | None - headers_class: Type[Headers] # undocumented - - traceback_limit: int | None - error_status: str - error_headers: List[Tuple[Text, Text]] - error_body: bytes - def run(self, application: WSGIApplication) -> None: ... - def setup_environ(self) -> None: ... - def finish_response(self) -> None: ... - def get_scheme(self) -> str: ... - def set_content_length(self) -> None: ... - def cleanup_headers(self) -> None: ... - def start_response( - self, status: Text, headers: List[Tuple[Text, Text]], exc_info: _exc_info | None = ... - ) -> Callable[[bytes], None]: ... - def send_preamble(self) -> None: ... - def write(self, data: bytes) -> None: ... - def sendfile(self) -> bool: ... - def finish_content(self) -> None: ... - def close(self) -> None: ... - def send_headers(self) -> None: ... - def result_is_file(self) -> bool: ... - def client_is_modern(self) -> bool: ... - def log_exception(self, exc_info: _exc_info) -> None: ... - def handle_error(self) -> None: ... - def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... - @abstractmethod - def _write(self, data: bytes) -> None: ... - @abstractmethod - def _flush(self) -> None: ... - @abstractmethod - def get_stdin(self) -> InputStream: ... - @abstractmethod - def get_stderr(self) -> ErrorStream: ... - @abstractmethod - def add_cgi_vars(self) -> None: ... - -class SimpleHandler(BaseHandler): - stdin: InputStream - stdout: IO[bytes] - stderr: ErrorStream - base_env: MutableMapping[str, str] - def __init__( - self, - stdin: InputStream, - stdout: IO[bytes], - stderr: ErrorStream, - environ: MutableMapping[str, str], - multithread: bool = ..., - multiprocess: bool = ..., - ) -> None: ... - def get_stdin(self) -> InputStream: ... - def get_stderr(self) -> ErrorStream: ... - def add_cgi_vars(self) -> None: ... - def _write(self, data: bytes) -> None: ... - def _flush(self) -> None: ... - -class BaseCGIHandler(SimpleHandler): ... - -class CGIHandler(BaseCGIHandler): - def __init__(self) -> None: ... - -class IISCGIHandler(BaseCGIHandler): - def __init__(self) -> None: ... diff --git a/stdlib/@python2/wsgiref/headers.pyi b/stdlib/@python2/wsgiref/headers.pyi deleted file mode 100644 index 08061fe..0000000 --- a/stdlib/@python2/wsgiref/headers.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from typing import List, Pattern, Tuple, overload - -_HeaderList = List[Tuple[str, str]] - -tspecials: Pattern[str] # undocumented - -class Headers: - def __init__(self, headers: _HeaderList) -> None: ... - def __len__(self) -> int: ... - def __setitem__(self, name: str, val: str) -> None: ... - def __delitem__(self, name: str) -> None: ... - def __getitem__(self, name: str) -> str | None: ... - def has_key(self, name: str) -> bool: ... - def __contains__(self, name: str) -> bool: ... - def get_all(self, name: str) -> List[str]: ... - @overload - def get(self, name: str, default: str) -> str: ... - @overload - def get(self, name: str, default: str | None = ...) -> str | None: ... - def keys(self) -> List[str]: ... - def values(self) -> List[str]: ... - def items(self) -> _HeaderList: ... - def setdefault(self, name: str, value: str) -> str: ... - def add_header(self, _name: str, _value: str | None, **_params: str | None) -> None: ... diff --git a/stdlib/@python2/wsgiref/simple_server.pyi b/stdlib/@python2/wsgiref/simple_server.pyi deleted file mode 100644 index a74a26f..0000000 --- a/stdlib/@python2/wsgiref/simple_server.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer -from typing import List, Type, TypeVar, overload - -from .handlers import SimpleHandler -from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment - -server_version: str # undocumented -sys_version: str # undocumented -software_version: str # undocumented - -class ServerHandler(SimpleHandler): # undocumented - server_software: str - def close(self) -> None: ... - -class WSGIServer(HTTPServer): - application: WSGIApplication | None - base_environ: WSGIEnvironment # only available after call to setup_environ() - def setup_environ(self) -> None: ... - def get_app(self) -> WSGIApplication | None: ... - def set_app(self, application: WSGIApplication | None) -> None: ... - -class WSGIRequestHandler(BaseHTTPRequestHandler): - server_version: str - def get_environ(self) -> WSGIEnvironment: ... - def get_stderr(self) -> ErrorStream: ... - def handle(self) -> None: ... - -def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... - -_S = TypeVar("_S", bound=WSGIServer) - -@overload -def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: Type[WSGIRequestHandler] = ...) -> WSGIServer: ... -@overload -def make_server( - host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ... -) -> _S: ... diff --git a/stdlib/@python2/wsgiref/types.pyi b/stdlib/@python2/wsgiref/types.pyi deleted file mode 100644 index c272ae6..0000000 --- a/stdlib/@python2/wsgiref/types.pyi +++ /dev/null @@ -1,3 +0,0 @@ -# Obsolete, use _typeshed.wsgi directly. - -from _typeshed.wsgi import * diff --git a/stdlib/@python2/wsgiref/util.pyi b/stdlib/@python2/wsgiref/util.pyi deleted file mode 100644 index c8e045a..0000000 --- a/stdlib/@python2/wsgiref/util.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import IO, Any, Callable - -from .types import WSGIEnvironment - -class FileWrapper: - filelike: IO[bytes] - blksize: int - close: Callable[[], None] # only exists if filelike.close exists - def __init__(self, filelike: IO[bytes], blksize: int = ...) -> None: ... - def __getitem__(self, key: Any) -> bytes: ... - def __iter__(self) -> FileWrapper: ... - def next(self) -> bytes: ... - -def guess_scheme(environ: WSGIEnvironment) -> str: ... -def application_uri(environ: WSGIEnvironment) -> str: ... -def request_uri(environ: WSGIEnvironment, include_query: bool = ...) -> str: ... -def shift_path_info(environ: WSGIEnvironment) -> str | None: ... -def setup_testing_defaults(environ: WSGIEnvironment) -> None: ... -def is_hop_by_hop(header_name: str) -> bool: ... diff --git a/stdlib/@python2/wsgiref/validate.pyi b/stdlib/@python2/wsgiref/validate.pyi deleted file mode 100644 index b3e629b..0000000 --- a/stdlib/@python2/wsgiref/validate.pyi +++ /dev/null @@ -1,44 +0,0 @@ -from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication -from typing import Any, Callable, Iterable, Iterator, NoReturn - -class WSGIWarning(Warning): ... - -def validator(application: WSGIApplication) -> WSGIApplication: ... - -class InputWrapper: - input: InputStream - def __init__(self, wsgi_input: InputStream) -> None: ... - def read(self, size: int = ...) -> bytes: ... - def readline(self) -> bytes: ... - def readlines(self, hint: int = ...) -> bytes: ... - def __iter__(self) -> Iterable[bytes]: ... - def close(self) -> NoReturn: ... - -class ErrorWrapper: - errors: ErrorStream - def __init__(self, wsgi_errors: ErrorStream) -> None: ... - def write(self, s: str) -> None: ... - def flush(self) -> None: ... - def writelines(self, seq: Iterable[str]) -> None: ... - def close(self) -> NoReturn: ... - -class WriteWrapper: - writer: Callable[[bytes], Any] - def __init__(self, wsgi_writer: Callable[[bytes], Any]) -> None: ... - def __call__(self, s: bytes) -> None: ... - -class PartialIteratorWrapper: - iterator: Iterator[bytes] - def __init__(self, wsgi_iterator: Iterator[bytes]) -> None: ... - def __iter__(self) -> IteratorWrapper: ... - -class IteratorWrapper: - original_iterator: Iterator[bytes] - iterator: Iterator[bytes] - closed: bool - check_start_response: bool | None - def __init__(self, wsgi_iterator: Iterator[bytes], check_start_response: bool | None) -> None: ... - def __iter__(self) -> IteratorWrapper: ... - def next(self) -> bytes: ... - def close(self) -> None: ... - def __del__(self) -> None: ... diff --git a/stdlib/@python2/xdrlib.pyi b/stdlib/@python2/xdrlib.pyi deleted file mode 100644 index 378504c..0000000 --- a/stdlib/@python2/xdrlib.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from typing import Callable, List, Sequence, TypeVar - -_T = TypeVar("_T") - -class Error(Exception): - msg: str - def __init__(self, msg: str) -> None: ... - -class ConversionError(Error): ... - -class Packer: - def __init__(self) -> None: ... - def reset(self) -> None: ... - def get_buffer(self) -> bytes: ... - def get_buf(self) -> bytes: ... - def pack_uint(self, x: int) -> None: ... - def pack_int(self, x: int) -> None: ... - def pack_enum(self, x: int) -> None: ... - def pack_bool(self, x: bool) -> None: ... - def pack_uhyper(self, x: int) -> None: ... - def pack_hyper(self, x: int) -> None: ... - def pack_float(self, x: float) -> None: ... - def pack_double(self, x: float) -> None: ... - def pack_fstring(self, n: int, s: bytes) -> None: ... - def pack_fopaque(self, n: int, s: bytes) -> None: ... - def pack_string(self, s: bytes) -> None: ... - def pack_opaque(self, s: bytes) -> None: ... - def pack_bytes(self, s: bytes) -> None: ... - def pack_list(self, list: Sequence[_T], pack_item: Callable[[_T], None]) -> None: ... - def pack_farray(self, n: int, list: Sequence[_T], pack_item: Callable[[_T], None]) -> None: ... - def pack_array(self, list: Sequence[_T], pack_item: Callable[[_T], None]) -> None: ... - -class Unpacker: - def __init__(self, data: bytes) -> None: ... - def reset(self, data: bytes) -> None: ... - def get_position(self) -> int: ... - def set_position(self, position: int) -> None: ... - def get_buffer(self) -> bytes: ... - def done(self) -> None: ... - def unpack_uint(self) -> int: ... - def unpack_int(self) -> int: ... - def unpack_enum(self) -> int: ... - def unpack_bool(self) -> bool: ... - def unpack_uhyper(self) -> int: ... - def unpack_hyper(self) -> int: ... - def unpack_float(self) -> float: ... - def unpack_double(self) -> float: ... - def unpack_fstring(self, n: int) -> bytes: ... - def unpack_fopaque(self, n: int) -> bytes: ... - def unpack_string(self) -> bytes: ... - def unpack_opaque(self) -> bytes: ... - def unpack_bytes(self) -> bytes: ... - def unpack_list(self, unpack_item: Callable[[], _T]) -> List[_T]: ... - def unpack_farray(self, n: int, unpack_item: Callable[[], _T]) -> List[_T]: ... - def unpack_array(self, unpack_item: Callable[[], _T]) -> List[_T]: ... diff --git a/stdlib/@python2/xml/__init__.pyi b/stdlib/@python2/xml/__init__.pyi deleted file mode 100644 index c524ac2..0000000 --- a/stdlib/@python2/xml/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -import xml.parsers as parsers diff --git a/stdlib/@python2/xml/dom/NodeFilter.pyi b/stdlib/@python2/xml/dom/NodeFilter.pyi deleted file mode 100644 index 80fb73d..0000000 --- a/stdlib/@python2/xml/dom/NodeFilter.pyi +++ /dev/null @@ -1,19 +0,0 @@ -class NodeFilter: - FILTER_ACCEPT: int - FILTER_REJECT: int - FILTER_SKIP: int - - SHOW_ALL: int - SHOW_ELEMENT: int - SHOW_ATTRIBUTE: int - SHOW_TEXT: int - SHOW_CDATA_SECTION: int - SHOW_ENTITY_REFERENCE: int - SHOW_ENTITY: int - SHOW_PROCESSING_INSTRUCTION: int - SHOW_COMMENT: int - SHOW_DOCUMENT: int - SHOW_DOCUMENT_TYPE: int - SHOW_DOCUMENT_FRAGMENT: int - SHOW_NOTATION: int - def acceptNode(self, node) -> int: ... diff --git a/stdlib/@python2/xml/dom/__init__.pyi b/stdlib/@python2/xml/dom/__init__.pyi deleted file mode 100644 index c5766c3..0000000 --- a/stdlib/@python2/xml/dom/__init__.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from typing import Any - -from .domreg import getDOMImplementation as getDOMImplementation, registerDOMImplementation as registerDOMImplementation - -class Node: - ELEMENT_NODE: int - ATTRIBUTE_NODE: int - TEXT_NODE: int - CDATA_SECTION_NODE: int - ENTITY_REFERENCE_NODE: int - ENTITY_NODE: int - PROCESSING_INSTRUCTION_NODE: int - COMMENT_NODE: int - DOCUMENT_NODE: int - DOCUMENT_TYPE_NODE: int - DOCUMENT_FRAGMENT_NODE: int - NOTATION_NODE: int - -# ExceptionCode -INDEX_SIZE_ERR: int -DOMSTRING_SIZE_ERR: int -HIERARCHY_REQUEST_ERR: int -WRONG_DOCUMENT_ERR: int -INVALID_CHARACTER_ERR: int -NO_DATA_ALLOWED_ERR: int -NO_MODIFICATION_ALLOWED_ERR: int -NOT_FOUND_ERR: int -NOT_SUPPORTED_ERR: int -INUSE_ATTRIBUTE_ERR: int -INVALID_STATE_ERR: int -SYNTAX_ERR: int -INVALID_MODIFICATION_ERR: int -NAMESPACE_ERR: int -INVALID_ACCESS_ERR: int -VALIDATION_ERR: int - -class DOMException(Exception): - code: int - def __init__(self, *args: Any, **kw: Any) -> None: ... - def _get_code(self) -> int: ... - -class IndexSizeErr(DOMException): ... -class DomstringSizeErr(DOMException): ... -class HierarchyRequestErr(DOMException): ... -class WrongDocumentErr(DOMException): ... -class NoDataAllowedErr(DOMException): ... -class NoModificationAllowedErr(DOMException): ... -class NotFoundErr(DOMException): ... -class NotSupportedErr(DOMException): ... -class InuseAttributeErr(DOMException): ... -class InvalidStateErr(DOMException): ... -class SyntaxErr(DOMException): ... -class InvalidModificationErr(DOMException): ... -class NamespaceErr(DOMException): ... -class InvalidAccessErr(DOMException): ... -class ValidationErr(DOMException): ... - -class UserDataHandler: - NODE_CLONED: int - NODE_IMPORTED: int - NODE_DELETED: int - NODE_RENAMED: int - -XML_NAMESPACE: str -XMLNS_NAMESPACE: str -XHTML_NAMESPACE: str -EMPTY_NAMESPACE: None -EMPTY_PREFIX: None diff --git a/stdlib/@python2/xml/dom/domreg.pyi b/stdlib/@python2/xml/dom/domreg.pyi deleted file mode 100644 index 2496b38..0000000 --- a/stdlib/@python2/xml/dom/domreg.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from _typeshed.xml import DOMImplementation -from typing import Callable, Dict, Iterable, Tuple - -well_known_implementations: Dict[str, str] -registered: Dict[str, Callable[[], DOMImplementation]] - -def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation(name: str | None = ..., features: str | Iterable[Tuple[str, str | None]] = ...) -> DOMImplementation: ... diff --git a/stdlib/@python2/xml/dom/expatbuilder.pyi b/stdlib/@python2/xml/dom/expatbuilder.pyi deleted file mode 100644 index 964e6fa..0000000 --- a/stdlib/@python2/xml/dom/expatbuilder.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... # incomplete diff --git a/stdlib/@python2/xml/dom/minicompat.pyi b/stdlib/@python2/xml/dom/minicompat.pyi deleted file mode 100644 index e9b0395..0000000 --- a/stdlib/@python2/xml/dom/minicompat.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import Any, Iterable, List, Tuple, Type, TypeVar - -_T = TypeVar("_T") - -StringTypes: Tuple[Type[str]] - -class NodeList(List[_T]): - length: int - def item(self, index: int) -> _T | None: ... - -class EmptyNodeList(Tuple[Any, ...]): - length: int - def item(self, index: int) -> None: ... - def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore - def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ... - -def defproperty(klass: Type[Any], name: str, doc: str) -> None: ... diff --git a/stdlib/@python2/xml/dom/minidom.pyi b/stdlib/@python2/xml/dom/minidom.pyi deleted file mode 100644 index ed46ac4..0000000 --- a/stdlib/@python2/xml/dom/minidom.pyi +++ /dev/null @@ -1,292 +0,0 @@ -import xml.dom -from typing import IO, Any, Text as _Text, TypeVar -from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS -from xml.sax.xmlreader import XMLReader - -_T = TypeVar("_T") - -def parse(file: str | IO[Any], parser: XMLReader | None = ..., bufsize: int | None = ...): ... -def parseString(string: bytes | _Text, parser: XMLReader | None = ...): ... -def getDOMImplementation(features=...): ... - -class Node(xml.dom.Node): - namespaceURI: str | None - parentNode: Any - ownerDocument: Any - nextSibling: Any - previousSibling: Any - prefix: Any - def toxml(self, encoding: Any | None = ...): ... - def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Any | None = ...): ... - def hasChildNodes(self) -> bool: ... - def insertBefore(self, newChild, refChild): ... - def appendChild(self, node): ... - def replaceChild(self, newChild, oldChild): ... - def removeChild(self, oldChild): ... - def normalize(self) -> None: ... - def cloneNode(self, deep): ... - def isSupported(self, feature, version): ... - def isSameNode(self, other): ... - def getInterface(self, feature): ... - def getUserData(self, key): ... - def setUserData(self, key, data, handler): ... - childNodes: Any - def unlink(self) -> None: ... - def __enter__(self: _T) -> _T: ... - def __exit__(self, et, ev, tb) -> None: ... - -class DocumentFragment(Node): - nodeType: Any - nodeName: str - nodeValue: Any - attributes: Any - parentNode: Any - childNodes: Any - def __init__(self) -> None: ... - -class Attr(Node): - name: str - nodeType: Any - attributes: Any - specified: bool - ownerElement: Any - namespaceURI: str | None - childNodes: Any - nodeName: Any - nodeValue: str - value: str - prefix: Any - def __init__( - self, qName: str, namespaceURI: str | None = ..., localName: Any | None = ..., prefix: Any | None = ... - ) -> None: ... - def unlink(self) -> None: ... - -class NamedNodeMap: - def __init__(self, attrs, attrsNS, ownerElement) -> None: ... - def item(self, index): ... - def items(self): ... - def itemsNS(self): ... - def __contains__(self, key): ... - def keys(self): ... - def keysNS(self): ... - def values(self): ... - def get(self, name, value: Any | None = ...): ... - def __len__(self) -> int: ... - def __eq__(self, other: Any) -> bool: ... - def __ge__(self, other: Any) -> bool: ... - def __gt__(self, other: Any) -> bool: ... - def __le__(self, other: Any) -> bool: ... - def __lt__(self, other: Any) -> bool: ... - def __getitem__(self, attname_or_tuple): ... - def __setitem__(self, attname, value) -> None: ... - def getNamedItem(self, name): ... - def getNamedItemNS(self, namespaceURI: str, localName): ... - def removeNamedItem(self, name): ... - def removeNamedItemNS(self, namespaceURI: str, localName): ... - def setNamedItem(self, node): ... - def setNamedItemNS(self, node): ... - def __delitem__(self, attname_or_tuple) -> None: ... - -AttributeList = NamedNodeMap - -class TypeInfo: - namespace: Any - name: Any - def __init__(self, namespace, name) -> None: ... - -class Element(Node): - nodeType: Any - nodeValue: Any - schemaType: Any - parentNode: Any - tagName: str - prefix: Any - namespaceURI: str | None - childNodes: Any - nextSibling: Any - def __init__( - self, tagName, namespaceURI: str | None = ..., prefix: Any | None = ..., localName: Any | None = ... - ) -> None: ... - def unlink(self) -> None: ... - def getAttribute(self, attname): ... - def getAttributeNS(self, namespaceURI: str, localName): ... - def setAttribute(self, attname, value) -> None: ... - def setAttributeNS(self, namespaceURI: str, qualifiedName: str, value) -> None: ... - def getAttributeNode(self, attrname): ... - def getAttributeNodeNS(self, namespaceURI: str, localName): ... - def setAttributeNode(self, attr): ... - setAttributeNodeNS: Any - def removeAttribute(self, name) -> None: ... - def removeAttributeNS(self, namespaceURI: str, localName) -> None: ... - def removeAttributeNode(self, node): ... - removeAttributeNodeNS: Any - def hasAttribute(self, name: str) -> bool: ... - def hasAttributeNS(self, namespaceURI: str, localName) -> bool: ... - def getElementsByTagName(self, name): ... - def getElementsByTagNameNS(self, namespaceURI: str, localName): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... - def hasAttributes(self) -> bool: ... - def setIdAttribute(self, name) -> None: ... - def setIdAttributeNS(self, namespaceURI: str, localName) -> None: ... - def setIdAttributeNode(self, idAttr) -> None: ... - -class Childless: - attributes: Any - childNodes: Any - firstChild: Any - lastChild: Any - def appendChild(self, node) -> None: ... - def hasChildNodes(self) -> bool: ... - def insertBefore(self, newChild, refChild) -> None: ... - def removeChild(self, oldChild) -> None: ... - def normalize(self) -> None: ... - def replaceChild(self, newChild, oldChild) -> None: ... - -class ProcessingInstruction(Childless, Node): - nodeType: Any - target: Any - data: Any - def __init__(self, target, data) -> None: ... - nodeValue: Any - nodeName: Any - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... - -class CharacterData(Childless, Node): - ownerDocument: Any - previousSibling: Any - def __init__(self) -> None: ... - def __len__(self) -> int: ... - data: str - nodeValue: Any - def substringData(self, offset: int, count: int) -> str: ... - def appendData(self, arg: str) -> None: ... - def insertData(self, offset: int, arg: str) -> None: ... - def deleteData(self, offset: int, count: int) -> None: ... - def replaceData(self, offset: int, count: int, arg: str) -> None: ... - -class Text(CharacterData): - nodeType: Any - nodeName: str - attributes: Any - data: Any - def splitText(self, offset): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... - def replaceWholeText(self, content): ... - -class Comment(CharacterData): - nodeType: Any - nodeName: str - def __init__(self, data) -> None: ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... - -class CDATASection(Text): - nodeType: Any - nodeName: str - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... - -class ReadOnlySequentialNamedNodeMap: - def __init__(self, seq=...) -> None: ... - def __len__(self): ... - def getNamedItem(self, name): ... - def getNamedItemNS(self, namespaceURI: str, localName): ... - def __getitem__(self, name_or_tuple): ... - def item(self, index): ... - def removeNamedItem(self, name) -> None: ... - def removeNamedItemNS(self, namespaceURI: str, localName) -> None: ... - def setNamedItem(self, node) -> None: ... - def setNamedItemNS(self, node) -> None: ... - -class Identified: ... - -class DocumentType(Identified, Childless, Node): - nodeType: Any - nodeValue: Any - name: Any - publicId: Any - systemId: Any - internalSubset: Any - entities: Any - notations: Any - nodeName: Any - def __init__(self, qualifiedName: str) -> None: ... - def cloneNode(self, deep): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... - -class Entity(Identified, Node): - attributes: Any - nodeType: Any - nodeValue: Any - actualEncoding: Any - encoding: Any - version: Any - nodeName: Any - notationName: Any - childNodes: Any - def __init__(self, name, publicId, systemId, notation) -> None: ... - def appendChild(self, newChild) -> None: ... - def insertBefore(self, newChild, refChild) -> None: ... - def removeChild(self, oldChild) -> None: ... - def replaceChild(self, newChild, oldChild) -> None: ... - -class Notation(Identified, Childless, Node): - nodeType: Any - nodeValue: Any - nodeName: Any - def __init__(self, name, publicId, systemId) -> None: ... - -class DOMImplementation(DOMImplementationLS): - def hasFeature(self, feature, version) -> bool: ... - def createDocument(self, namespaceURI: str, qualifiedName: str, doctype): ... - def createDocumentType(self, qualifiedName: str, publicId, systemId): ... - def getInterface(self, feature): ... - -class ElementInfo: - tagName: Any - def __init__(self, name) -> None: ... - def getAttributeType(self, aname): ... - def getAttributeTypeNS(self, namespaceURI: str, localName): ... - def isElementContent(self): ... - def isEmpty(self): ... - def isId(self, aname): ... - def isIdNS(self, namespaceURI: str, localName): ... - -class Document(Node, DocumentLS): - implementation: Any - nodeType: Any - nodeName: str - nodeValue: Any - attributes: Any - parentNode: Any - previousSibling: Any - nextSibling: Any - actualEncoding: Any - encoding: Any - standalone: Any - version: Any - strictErrorChecking: bool - errorHandler: Any - documentURI: Any - doctype: Any - childNodes: Any - def __init__(self) -> None: ... - def appendChild(self, node): ... - documentElement: Any - def removeChild(self, oldChild): ... - def unlink(self) -> None: ... - def cloneNode(self, deep): ... - def createDocumentFragment(self): ... - def createElement(self, tagName: str): ... - def createTextNode(self, data): ... - def createCDATASection(self, data): ... - def createComment(self, data): ... - def createProcessingInstruction(self, target, data): ... - def createAttribute(self, qName) -> Attr: ... - def createElementNS(self, namespaceURI: str, qualifiedName: str): ... - def createAttributeNS(self, namespaceURI: str, qualifiedName: str) -> Attr: ... - def getElementById(self, id): ... - def getElementsByTagName(self, name: str): ... - def getElementsByTagNameNS(self, namespaceURI: str, localName): ... - def isSupported(self, feature, version): ... - def importNode(self, node, deep): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Any | None = ...) -> None: ... - def renameNode(self, n, namespaceURI: str, name): ... diff --git a/stdlib/@python2/xml/dom/pulldom.pyi b/stdlib/@python2/xml/dom/pulldom.pyi deleted file mode 100644 index 964e6fa..0000000 --- a/stdlib/@python2/xml/dom/pulldom.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... # incomplete diff --git a/stdlib/@python2/xml/dom/xmlbuilder.pyi b/stdlib/@python2/xml/dom/xmlbuilder.pyi deleted file mode 100644 index d8936bd..0000000 --- a/stdlib/@python2/xml/dom/xmlbuilder.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... # incomplete - -class DocumentLS(Any): ... # type: ignore -class DOMImplementationLS(Any): ... # type: ignore diff --git a/stdlib/@python2/xml/etree/ElementInclude.pyi b/stdlib/@python2/xml/etree/ElementInclude.pyi deleted file mode 100644 index b74285d..0000000 --- a/stdlib/@python2/xml/etree/ElementInclude.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Callable -from xml.etree.ElementTree import Element - -XINCLUDE: str -XINCLUDE_INCLUDE: str -XINCLUDE_FALLBACK: str - -class FatalIncludeError(SyntaxError): ... - -def default_loader(href: str | bytes | int, parse: str, encoding: str | None = ...) -> str | Element: ... - -# TODO: loader is of type default_loader ie it takes a callable that has the -# same signature as default_loader. But default_loader has a keyword argument -# Which can't be represented using Callable... -def include(elem: Element, loader: Callable[..., str | Element] | None = ...) -> None: ... diff --git a/stdlib/@python2/xml/etree/ElementPath.pyi b/stdlib/@python2/xml/etree/ElementPath.pyi deleted file mode 100644 index 02fe845..0000000 --- a/stdlib/@python2/xml/etree/ElementPath.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Callable, Dict, Generator, List, Pattern, Tuple, TypeVar -from xml.etree.ElementTree import Element - -xpath_tokenizer_re: Pattern[str] - -_token = Tuple[str, str] -_next = Callable[[], _token] -_callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]] - -def xpath_tokenizer(pattern: str, namespaces: Dict[str, str] | None = ...) -> Generator[_token, None, None]: ... -def get_parent_map(context: _SelectorContext) -> Dict[Element, Element]: ... -def prepare_child(next: _next, token: _token) -> _callback: ... -def prepare_star(next: _next, token: _token) -> _callback: ... -def prepare_self(next: _next, token: _token) -> _callback: ... -def prepare_descendant(next: _next, token: _token) -> _callback: ... -def prepare_parent(next: _next, token: _token) -> _callback: ... -def prepare_predicate(next: _next, token: _token) -> _callback: ... - -ops: Dict[str, Callable[[_next, _token], _callback]] - -class _SelectorContext: - parent_map: Dict[Element, Element] | None - root: Element - def __init__(self, root: Element) -> None: ... - -_T = TypeVar("_T") - -def iterfind(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Generator[Element, None, None]: ... -def find(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Element | None: ... -def findall(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> List[Element]: ... -def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: Dict[str, str] | None = ...) -> _T | str: ... diff --git a/stdlib/@python2/xml/etree/ElementTree.pyi b/stdlib/@python2/xml/etree/ElementTree.pyi deleted file mode 100644 index a7a0a1c..0000000 --- a/stdlib/@python2/xml/etree/ElementTree.pyi +++ /dev/null @@ -1,201 +0,0 @@ -from _typeshed import FileDescriptor -from typing import ( - IO, - Any, - Callable, - Dict, - Generator, - ItemsView, - Iterable, - Iterator, - KeysView, - List, - MutableSequence, - Sequence, - Text, - Tuple, - TypeVar, - Union, - overload, -) - -VERSION: str - -class ParseError(SyntaxError): - code: int - position: Tuple[int, int] - -def iselement(element: object) -> bool: ... - -_T = TypeVar("_T") - -# Type for parser inputs. Parser will accept any unicode/str/bytes and coerce, -# and this is true in py2 and py3 (even fromstringlist() in python3 can be -# called with a heterogeneous list) -_parser_input_type = Union[bytes, Text] - -# Type for individual tag/attr/ns/text values in args to most functions. -# In py2, the library accepts str or unicode everywhere and coerces -# aggressively. -# In py3, bytes is not coerced to str and so use of bytes is probably an error, -# so we exclude it. (why? the parser never produces bytes when it parses XML, -# so e.g., element.get(b'name') will always return None for parsed XML, even if -# there is a 'name' attribute.) -_str_argument_type = Union[str, Text] - -# Type for return values from individual tag/attr/text values -# in python2, if the tag/attribute/text wasn't decode-able as ascii, it -# comes out as a unicode string; otherwise it comes out as str. (see -# _fixtext function in the source). Client code knows best: -_str_result_type = Any - -_file_or_filename = Union[Text, FileDescriptor, IO[Any]] - -class Element(MutableSequence[Element]): - tag: _str_result_type - attrib: Dict[_str_result_type, _str_result_type] - text: _str_result_type | None - tail: _str_result_type | None - def __init__( - self, - tag: _str_argument_type | Callable[..., Element], - attrib: Dict[_str_argument_type, _str_argument_type] = ..., - **extra: _str_argument_type, - ) -> None: ... - def append(self, __subelement: Element) -> None: ... - def clear(self) -> None: ... - def extend(self, __elements: Iterable[Element]) -> None: ... - def find( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> Element | None: ... - def findall( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> List[Element]: ... - @overload - def findtext( - self, path: _str_argument_type, default: None = ..., namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> _str_result_type | None: ... - @overload - def findtext( - self, path: _str_argument_type, default: _T, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> _T | _str_result_type: ... - @overload - def get(self, key: _str_argument_type, default: None = ...) -> _str_result_type | None: ... - @overload - def get(self, key: _str_argument_type, default: _T) -> _str_result_type | _T: ... - def insert(self, __index: int, __element: Element) -> None: ... - def items(self) -> ItemsView[_str_result_type, _str_result_type]: ... - def iter(self, tag: _str_argument_type | None = ...) -> Generator[Element, None, None]: ... - def iterfind( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> Generator[Element, None, None]: ... - def itertext(self) -> Generator[_str_result_type, None, None]: ... - def keys(self) -> KeysView[_str_result_type]: ... - def makeelement(self, __tag: _str_argument_type, __attrib: Dict[_str_argument_type, _str_argument_type]) -> Element: ... - def remove(self, __subelement: Element) -> None: ... - def set(self, __key: _str_argument_type, __value: _str_argument_type) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - @overload - def __getitem__(self, i: int) -> Element: ... - @overload - def __getitem__(self, s: slice) -> MutableSequence[Element]: ... - def __len__(self) -> int: ... - @overload - def __setitem__(self, i: int, o: Element) -> None: ... - @overload - def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ... - def getchildren(self) -> List[Element]: ... - def getiterator(self, tag: _str_argument_type | None = ...) -> List[Element]: ... - -def SubElement( - parent: Element, - tag: _str_argument_type, - attrib: Dict[_str_argument_type, _str_argument_type] = ..., - **extra: _str_argument_type, -) -> Element: ... -def Comment(text: _str_argument_type | None = ...) -> Element: ... -def ProcessingInstruction(target: _str_argument_type, text: _str_argument_type | None = ...) -> Element: ... - -PI: Callable[..., Element] - -class QName: - text: str - def __init__(self, text_or_uri: _str_argument_type, tag: _str_argument_type | None = ...) -> None: ... - -class ElementTree: - def __init__(self, element: Element | None = ..., file: _file_or_filename | None = ...) -> None: ... - def getroot(self) -> Element: ... - def parse(self, source: _file_or_filename, parser: XMLParser | None = ...) -> Element: ... - def iter(self, tag: _str_argument_type | None = ...) -> Generator[Element, None, None]: ... - def getiterator(self, tag: _str_argument_type | None = ...) -> List[Element]: ... - def find( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> Element | None: ... - @overload - def findtext( - self, path: _str_argument_type, default: None = ..., namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> _str_result_type | None: ... - @overload - def findtext( - self, path: _str_argument_type, default: _T, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> _T | _str_result_type: ... - def findall( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> List[Element]: ... - def iterfind( - self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] | None = ... - ) -> Generator[Element, None, None]: ... - def write( - self, - file_or_filename: _file_or_filename, - encoding: str | None = ..., - xml_declaration: bool | None = ..., - default_namespace: _str_argument_type | None = ..., - method: str | None = ..., - ) -> None: ... - def write_c14n(self, file: _file_or_filename) -> None: ... - -def register_namespace(prefix: _str_argument_type, uri: _str_argument_type) -> None: ... -def tostring(element: Element, encoding: str | None = ..., method: str | None = ...) -> bytes: ... -def tostringlist(element: Element, encoding: str | None = ..., method: str | None = ...) -> List[bytes]: ... -def dump(elem: Element) -> None: ... -def parse(source: _file_or_filename, parser: XMLParser | None = ...) -> ElementTree: ... -def iterparse( - source: _file_or_filename, events: Sequence[str] | None = ..., parser: XMLParser | None = ... -) -> Iterator[Tuple[str, Any]]: ... -def XML(text: _parser_input_type, parser: XMLParser | None = ...) -> Element: ... -def XMLID(text: _parser_input_type, parser: XMLParser | None = ...) -> Tuple[Element, Dict[_str_result_type, Element]]: ... - -# This is aliased to XML in the source. -fromstring = XML - -def fromstringlist(sequence: Sequence[_parser_input_type], parser: XMLParser | None = ...) -> Element: ... - -# This type is both not precise enough and too precise. The TreeBuilder -# requires the elementfactory to accept tag and attrs in its args and produce -# some kind of object that has .text and .tail properties. -# I've chosen to constrain the ElementFactory to always produce an Element -# because that is how almost everyone will use it. -# Unfortunately, the type of the factory arguments is dependent on how -# TreeBuilder is called by client code (they could pass strs, bytes or whatever); -# but we don't want to use a too-broad type, or it would be too hard to write -# elementfactories. -_ElementFactory = Callable[[Any, Dict[Any, Any]], Element] - -class TreeBuilder: - def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ... - def close(self) -> Element: ... - def data(self, __data: _parser_input_type) -> None: ... - def start(self, __tag: _parser_input_type, __attrs: Dict[_parser_input_type, _parser_input_type]) -> Element: ... - def end(self, __tag: _parser_input_type) -> Element: ... - -class XMLParser: - parser: Any - target: Any - # TODO-what is entity used for??? - entity: Any - version: str - def __init__(self, html: int = ..., target: Any = ..., encoding: str | None = ...) -> None: ... - def doctype(self, __name: str, __pubid: str, __system: str) -> None: ... - def close(self) -> Any: ... - def feed(self, __data: _parser_input_type) -> None: ... diff --git a/stdlib/@python2/xml/etree/cElementTree.pyi b/stdlib/@python2/xml/etree/cElementTree.pyi deleted file mode 100644 index c41e2be..0000000 --- a/stdlib/@python2/xml/etree/cElementTree.pyi +++ /dev/null @@ -1 +0,0 @@ -from xml.etree.ElementTree import * # noqa: F403 diff --git a/stdlib/@python2/xml/parsers/__init__.pyi b/stdlib/@python2/xml/parsers/__init__.pyi deleted file mode 100644 index cac0862..0000000 --- a/stdlib/@python2/xml/parsers/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -import xml.parsers.expat as expat diff --git a/stdlib/@python2/xml/parsers/expat/__init__.pyi b/stdlib/@python2/xml/parsers/expat/__init__.pyi deleted file mode 100644 index 73f3758..0000000 --- a/stdlib/@python2/xml/parsers/expat/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -from pyexpat import * diff --git a/stdlib/@python2/xml/parsers/expat/errors.pyi b/stdlib/@python2/xml/parsers/expat/errors.pyi deleted file mode 100644 index e22d769..0000000 --- a/stdlib/@python2/xml/parsers/expat/errors.pyi +++ /dev/null @@ -1 +0,0 @@ -from pyexpat.errors import * diff --git a/stdlib/@python2/xml/parsers/expat/model.pyi b/stdlib/@python2/xml/parsers/expat/model.pyi deleted file mode 100644 index d8f44b4..0000000 --- a/stdlib/@python2/xml/parsers/expat/model.pyi +++ /dev/null @@ -1 +0,0 @@ -from pyexpat.model import * diff --git a/stdlib/@python2/xml/sax/__init__.pyi b/stdlib/@python2/xml/sax/__init__.pyi deleted file mode 100644 index 0c6da9a..0000000 --- a/stdlib/@python2/xml/sax/__init__.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import IO, Any, List, NoReturn, Text -from xml.sax.handler import ContentHandler, ErrorHandler -from xml.sax.xmlreader import Locator, XMLReader - -class SAXException(Exception): - def __init__(self, msg: str, exception: Exception | None = ...) -> None: ... - def getMessage(self) -> str: ... - def getException(self) -> Exception: ... - def __getitem__(self, ix: Any) -> NoReturn: ... - -class SAXParseException(SAXException): - def __init__(self, msg: str, exception: Exception, locator: Locator) -> None: ... - def getColumnNumber(self) -> int: ... - def getLineNumber(self) -> int: ... - def getPublicId(self): ... - def getSystemId(self): ... - -class SAXNotRecognizedException(SAXException): ... -class SAXNotSupportedException(SAXException): ... -class SAXReaderNotAvailable(SAXNotSupportedException): ... - -default_parser_list: List[str] - -def make_parser(parser_list: List[str] = ...) -> XMLReader: ... -def parse(source: str | IO[str] | IO[bytes], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ... -def parseString(string: bytes | Text, handler: ContentHandler, errorHandler: ErrorHandler | None = ...) -> None: ... -def _create_parser(parser_name: str) -> XMLReader: ... diff --git a/stdlib/@python2/xml/sax/handler.pyi b/stdlib/@python2/xml/sax/handler.pyi deleted file mode 100644 index 3a51933..0000000 --- a/stdlib/@python2/xml/sax/handler.pyi +++ /dev/null @@ -1,46 +0,0 @@ -from typing import Any - -version: Any - -class ErrorHandler: - def error(self, exception): ... - def fatalError(self, exception): ... - def warning(self, exception): ... - -class ContentHandler: - def __init__(self) -> None: ... - def setDocumentLocator(self, locator): ... - def startDocument(self): ... - def endDocument(self): ... - def startPrefixMapping(self, prefix, uri): ... - def endPrefixMapping(self, prefix): ... - def startElement(self, name, attrs): ... - def endElement(self, name): ... - def startElementNS(self, name, qname, attrs): ... - def endElementNS(self, name, qname): ... - def characters(self, content): ... - def ignorableWhitespace(self, whitespace): ... - def processingInstruction(self, target, data): ... - def skippedEntity(self, name): ... - -class DTDHandler: - def notationDecl(self, name, publicId, systemId): ... - def unparsedEntityDecl(self, name, publicId, systemId, ndata): ... - -class EntityResolver: - def resolveEntity(self, publicId, systemId): ... - -feature_namespaces: Any -feature_namespace_prefixes: Any -feature_string_interning: Any -feature_validation: Any -feature_external_ges: Any -feature_external_pes: Any -all_features: Any -property_lexical_handler: Any -property_declaration_handler: Any -property_dom_node: Any -property_xml_string: Any -property_encoding: Any -property_interning_dict: Any -all_properties: Any diff --git a/stdlib/@python2/xml/sax/saxutils.pyi b/stdlib/@python2/xml/sax/saxutils.pyi deleted file mode 100644 index 1fc8964..0000000 --- a/stdlib/@python2/xml/sax/saxutils.pyi +++ /dev/null @@ -1,59 +0,0 @@ -from _typeshed import SupportsWrite -from codecs import StreamReaderWriter, StreamWriter -from io import RawIOBase, TextIOBase -from typing import Mapping, Text -from xml.sax import handler, xmlreader - -def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... -def unescape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... -def quoteattr(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... - -class XMLGenerator(handler.ContentHandler): - def __init__( - self, - out: TextIOBase | RawIOBase | StreamWriter | StreamReaderWriter | SupportsWrite[str] | None = ..., - encoding: Text = ..., - ) -> None: ... - def startDocument(self): ... - def endDocument(self): ... - def startPrefixMapping(self, prefix, uri): ... - def endPrefixMapping(self, prefix): ... - def startElement(self, name, attrs): ... - def endElement(self, name): ... - def startElementNS(self, name, qname, attrs): ... - def endElementNS(self, name, qname): ... - def characters(self, content): ... - def ignorableWhitespace(self, content): ... - def processingInstruction(self, target, data): ... - -class XMLFilterBase(xmlreader.XMLReader): - def __init__(self, parent: xmlreader.XMLReader | None = ...) -> None: ... - def error(self, exception): ... - def fatalError(self, exception): ... - def warning(self, exception): ... - def setDocumentLocator(self, locator): ... - def startDocument(self): ... - def endDocument(self): ... - def startPrefixMapping(self, prefix, uri): ... - def endPrefixMapping(self, prefix): ... - def startElement(self, name, attrs): ... - def endElement(self, name): ... - def startElementNS(self, name, qname, attrs): ... - def endElementNS(self, name, qname): ... - def characters(self, content): ... - def ignorableWhitespace(self, chars): ... - def processingInstruction(self, target, data): ... - def skippedEntity(self, name): ... - def notationDecl(self, name, publicId, systemId): ... - def unparsedEntityDecl(self, name, publicId, systemId, ndata): ... - def resolveEntity(self, publicId, systemId): ... - def parse(self, source): ... - def setLocale(self, locale): ... - def getFeature(self, name): ... - def setFeature(self, name, state): ... - def getProperty(self, name): ... - def setProperty(self, name, value): ... - def getParent(self): ... - def setParent(self, parent): ... - -def prepare_input_source(source, base=...): ... diff --git a/stdlib/@python2/xml/sax/xmlreader.pyi b/stdlib/@python2/xml/sax/xmlreader.pyi deleted file mode 100644 index 8afc566..0000000 --- a/stdlib/@python2/xml/sax/xmlreader.pyi +++ /dev/null @@ -1,72 +0,0 @@ -from typing import Mapping, Tuple - -class XMLReader: - def __init__(self) -> None: ... - def parse(self, source): ... - def getContentHandler(self): ... - def setContentHandler(self, handler): ... - def getDTDHandler(self): ... - def setDTDHandler(self, handler): ... - def getEntityResolver(self): ... - def setEntityResolver(self, resolver): ... - def getErrorHandler(self): ... - def setErrorHandler(self, handler): ... - def setLocale(self, locale): ... - def getFeature(self, name): ... - def setFeature(self, name, state): ... - def getProperty(self, name): ... - def setProperty(self, name, value): ... - -class IncrementalParser(XMLReader): - def __init__(self, bufsize: int = ...) -> None: ... - def parse(self, source): ... - def feed(self, data): ... - def prepareParser(self, source): ... - def close(self): ... - def reset(self): ... - -class Locator: - def getColumnNumber(self): ... - def getLineNumber(self): ... - def getPublicId(self): ... - def getSystemId(self): ... - -class InputSource: - def __init__(self, system_id: str | None = ...) -> None: ... - def setPublicId(self, public_id): ... - def getPublicId(self): ... - def setSystemId(self, system_id): ... - def getSystemId(self): ... - def setEncoding(self, encoding): ... - def getEncoding(self): ... - def setByteStream(self, bytefile): ... - def getByteStream(self): ... - def setCharacterStream(self, charfile): ... - def getCharacterStream(self): ... - -class AttributesImpl: - def __init__(self, attrs: Mapping[str, str]) -> None: ... - def getLength(self): ... - def getType(self, name): ... - def getValue(self, name): ... - def getValueByQName(self, name): ... - def getNameByQName(self, name): ... - def getQNameByName(self, name): ... - def getNames(self): ... - def getQNames(self): ... - def __len__(self): ... - def __getitem__(self, name): ... - def keys(self): ... - def __contains__(self, name): ... - def get(self, name, alternative=...): ... - def copy(self): ... - def items(self): ... - def values(self): ... - -class AttributesNSImpl(AttributesImpl): - def __init__(self, attrs: Mapping[Tuple[str, str], str], qnames: Mapping[Tuple[str, str], str]) -> None: ... - def getValueByQName(self, name): ... - def getNameByQName(self, name): ... - def getQNameByName(self, name): ... - def getQNames(self): ... - def copy(self): ... diff --git a/stdlib/@python2/xmlrpclib.pyi b/stdlib/@python2/xmlrpclib.pyi deleted file mode 100644 index 5a7d0fc..0000000 --- a/stdlib/@python2/xmlrpclib.pyi +++ /dev/null @@ -1,244 +0,0 @@ -from datetime import datetime -from gzip import GzipFile -from httplib import HTTPConnection, HTTPResponse, HTTPSConnection -from ssl import SSLContext -from StringIO import StringIO -from time import struct_time -from types import InstanceType -from typing import IO, Any, AnyStr, Callable, Iterable, List, Mapping, MutableMapping, Tuple, Type, Union - -_Unmarshaller = Any -_timeTuple = Tuple[int, int, int, int, int, int, int, int, int] -# Represents types that can be compared against a DateTime object -_dateTimeComp = Union[unicode, DateTime, datetime] -# A "host description" used by Transport factories -_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]] - -def escape(s: AnyStr, replace: Callable[[AnyStr, AnyStr, AnyStr], AnyStr] = ...) -> AnyStr: ... - -MAXINT: int -MININT: int -PARSE_ERROR: int -SERVER_ERROR: int -APPLICATION_ERROR: int -SYSTEM_ERROR: int -TRANSPORT_ERROR: int -NOT_WELLFORMED_ERROR: int -UNSUPPORTED_ENCODING: int -INVALID_ENCODING_CHAR: int -INVALID_XMLRPC: int -METHOD_NOT_FOUND: int -INVALID_METHOD_PARAMS: int -INTERNAL_ERROR: int - -class Error(Exception): ... - -class ProtocolError(Error): - url: str - errcode: int - errmsg: str - headers: Any - def __init__(self, url: str, errcode: int, errmsg: str, headers: Any) -> None: ... - -class ResponseError(Error): ... - -class Fault(Error): - faultCode: Any - faultString: str - def __init__(self, faultCode: Any, faultString: str, **extra: Any) -> None: ... - -boolean: Type[bool] -Boolean: Type[bool] - -class DateTime: - value: str - def __init__(self, value: str | unicode | datetime | float | int | _timeTuple | struct_time = ...) -> None: ... - def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ... - def __lt__(self, other: _dateTimeComp) -> bool: ... - def __le__(self, other: _dateTimeComp) -> bool: ... - def __gt__(self, other: _dateTimeComp) -> bool: ... - def __ge__(self, other: _dateTimeComp) -> bool: ... - def __eq__(self, other: _dateTimeComp) -> bool: ... # type: ignore - def __ne__(self, other: _dateTimeComp) -> bool: ... # type: ignore - def timetuple(self) -> struct_time: ... - def __cmp__(self, other: _dateTimeComp) -> int: ... - def decode(self, data: Any) -> None: ... - def encode(self, out: IO[str]) -> None: ... - -class Binary: - data: str - def __init__(self, data: str | None = ...) -> None: ... - def __cmp__(self, other: Any) -> int: ... - def decode(self, data: str) -> None: ... - def encode(self, out: IO[str]) -> None: ... - -WRAPPERS: Tuple[Type[Any], ...] - -# Still part of the public API, but see http://bugs.python.org/issue1773632 -FastParser: None -FastUnmarshaller: None -FastMarshaller: None - -# xmlrpclib.py will leave ExpatParser undefined if it can't import expat from -# xml.parsers. Because this is Python 2.7, the import will succeed. -class ExpatParser: - def __init__(self, target: _Unmarshaller) -> None: ... - def feed(self, data: str): ... - def close(self): ... - -# TODO: Add xmllib.XMLParser as base class -class SlowParser: - handle_xml: Callable[[str, bool], None] - unknown_starttag: Callable[[str, Any], None] - handle_data: Callable[[str], None] - handle_cdata: Callable[[str], None] - unknown_endtag: Callable[[str, Callable[[Iterable[str], str], str]], None] - def __init__(self, target: _Unmarshaller) -> None: ... - -class Marshaller: - memo: MutableMapping[int, Any] - data: str | None - encoding: str | None - allow_none: bool - def __init__(self, encoding: str | None = ..., allow_none: bool = ...) -> None: ... - dispatch: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]] - def dumps( - self, - values: Iterable[ - None - | int - | bool - | long - | float - | str - | unicode - | List[Any] - | Tuple[Any, ...] - | Mapping[Any, Any] - | datetime - | InstanceType - ] - | Fault, - ) -> str: ... - def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ... - def dump_int(self, value: int, write: Callable[[str], None]) -> None: ... - def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ... - def dump_long(self, value: long, write: Callable[[str], None]) -> None: ... - def dump_double(self, value: float, write: Callable[[str], None]) -> None: ... - def dump_string( - self, - value: str, - write: Callable[[str], None], - escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ..., - ) -> None: ... - def dump_unicode( - self, - value: unicode, - write: Callable[[str], None], - escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ..., - ) -> None: ... - def dump_array(self, value: Iterable[Any], write: Callable[[str], None]) -> None: ... - def dump_struct( - self, - value: Mapping[unicode, Any], - write: Callable[[str], None], - escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ..., - ) -> None: ... - def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ... - def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ... - -class Unmarshaller: - def append(self, object: Any) -> None: ... - def __init__(self, use_datetime: bool = ...) -> None: ... - def close(self) -> Tuple[Any, ...]: ... - def getmethodname(self) -> str | None: ... - def xml(self, encoding: str, standalone: bool) -> None: ... - def start(self, tag: str, attrs: Any) -> None: ... - def data(self, text: str) -> None: ... - def end(self, tag: str, join: Callable[[Iterable[str], str], str] = ...) -> None: ... - def end_dispatch(self, tag: str, data: str) -> None: ... - dispatch: Mapping[str, Callable[[Unmarshaller, str], None]] - def end_nil(self, data: str): ... - def end_boolean(self, data: str) -> None: ... - def end_int(self, data: str) -> None: ... - def end_double(self, data: str) -> None: ... - def end_string(self, data: str) -> None: ... - def end_array(self, data: str) -> None: ... - def end_struct(self, data: str) -> None: ... - def end_base64(self, data: str) -> None: ... - def end_dateTime(self, data: str) -> None: ... - def end_value(self, data: str) -> None: ... - def end_params(self, data: str) -> None: ... - def end_fault(self, data: str) -> None: ... - def end_methodName(self, data: str) -> None: ... - -class _MultiCallMethod: - def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ... - -class MultiCallIterator: - def __init__(self, results: List[Any]) -> None: ... - -class MultiCall: - def __init__(self, server: ServerProxy) -> None: ... - def __getattr__(self, name: str) -> _MultiCallMethod: ... - def __call__(self) -> MultiCallIterator: ... - -def getparser(use_datetime: bool = ...) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ... -def dumps( - params: Tuple[Any, ...] | Fault, - methodname: str | None = ..., - methodresponse: bool | None = ..., - encoding: str | None = ..., - allow_none: bool = ..., -) -> str: ... -def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], str | None]: ... -def gzip_encode(data: str) -> str: ... -def gzip_decode(data: str, max_decode: int = ...) -> str: ... - -class GzipDecodedResponse(GzipFile): - stringio: StringIO[Any] - def __init__(self, response: HTTPResponse) -> None: ... - def close(self): ... - -class _Method: - def __init__(self, send: Callable[[str, Tuple[Any, ...]], Any], name: str) -> None: ... - def __getattr__(self, name: str) -> _Method: ... - def __call__(self, *args: Any) -> Any: ... - -class Transport: - user_agent: str - accept_gzip_encoding: bool - encode_threshold: int | None - def __init__(self, use_datetime: bool = ...) -> None: ... - def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ... - verbose: bool - def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ... - def getparser(self) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ... - def get_host_info(self, host: _hostDesc) -> Tuple[str, List[Tuple[str, str]] | None, Mapping[Any, Any] | None]: ... - def make_connection(self, host: _hostDesc) -> HTTPConnection: ... - def close(self) -> None: ... - def send_request(self, connection: HTTPConnection, handler: str, request_body: str) -> None: ... - def send_host(self, connection: HTTPConnection, host: str) -> None: ... - def send_user_agent(self, connection: HTTPConnection) -> None: ... - def send_content(self, connection: HTTPConnection, request_body: str) -> None: ... - def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ... - -class SafeTransport(Transport): - def __init__(self, use_datetime: bool = ..., context: SSLContext | None = ...) -> None: ... - def make_connection(self, host: _hostDesc) -> HTTPSConnection: ... - -class ServerProxy: - def __init__( - self, - uri: str, - transport: Transport | None = ..., - encoding: str | None = ..., - verbose: bool = ..., - allow_none: bool = ..., - use_datetime: bool = ..., - context: SSLContext | None = ..., - ) -> None: ... - def __getattr__(self, name: str) -> _Method: ... - def __call__(self, attr: str) -> Transport | None: ... - -Server = ServerProxy diff --git a/stdlib/@python2/zipfile.pyi b/stdlib/@python2/zipfile.pyi deleted file mode 100644 index 5a08794..0000000 --- a/stdlib/@python2/zipfile.pyi +++ /dev/null @@ -1,101 +0,0 @@ -import io -from _typeshed import StrPath -from types import TracebackType -from typing import IO, Any, Callable, Dict, Iterable, List, Pattern, Protocol, Sequence, Text, Tuple, Type, Union - -_SZI = Union[Text, ZipInfo] -_DT = Tuple[int, int, int, int, int, int] - -class BadZipfile(Exception): ... - -error = BadZipfile - -class LargeZipFile(Exception): ... - -class ZipExtFile(io.BufferedIOBase): - MAX_N: int = ... - MIN_READ_SIZE: int = ... - - PATTERN: Pattern[str] = ... - - newlines: List[bytes] | None - mode: str - name: str - def __init__( - self, - fileobj: IO[bytes], - mode: str, - zipinfo: ZipInfo, - decrypter: Callable[[Sequence[int]], bytes] | None = ..., - close_fileobj: bool = ..., - ) -> None: ... - def read(self, n: int | None = ...) -> bytes: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore - def __repr__(self) -> str: ... - def peek(self, n: int = ...) -> bytes: ... - def read1(self, n: int | None) -> bytes: ... # type: ignore - -class _Writer(Protocol): - def write(self, __s: str) -> Any: ... - -class ZipFile: - filename: Text | None - debug: int - comment: bytes - filelist: List[ZipInfo] - fp: IO[bytes] | None - NameToInfo: Dict[Text, ZipInfo] - start_dir: int # undocumented - def __init__(self, file: StrPath | IO[bytes], mode: Text = ..., compression: int = ..., allowZip64: bool = ...) -> None: ... - def __enter__(self) -> ZipFile: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - def close(self) -> None: ... - def getinfo(self, name: Text) -> ZipInfo: ... - def infolist(self) -> List[ZipInfo]: ... - def namelist(self) -> List[Text]: ... - def open(self, name: _SZI, mode: Text = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ... - def extract(self, member: _SZI, path: StrPath | None = ..., pwd: bytes | None = ...) -> str: ... - def extractall(self, path: StrPath | None = ..., members: Iterable[Text] | None = ..., pwd: bytes | None = ...) -> None: ... - def printdir(self) -> None: ... - def setpassword(self, pwd: bytes) -> None: ... - def read(self, name: _SZI, pwd: bytes | None = ...) -> bytes: ... - def testzip(self) -> str | None: ... - def write(self, filename: StrPath, arcname: StrPath | None = ..., compress_type: int | None = ...) -> None: ... - def writestr(self, zinfo_or_arcname: _SZI, bytes: bytes, compress_type: int | None = ...) -> None: ... - -class PyZipFile(ZipFile): - def writepy(self, pathname: Text, basename: Text = ...) -> None: ... - -class ZipInfo: - filename: Text - date_time: _DT - compress_type: int - comment: bytes - extra: bytes - create_system: int - create_version: int - extract_version: int - reserved: int - flag_bits: int - volume: int - internal_attr: int - external_attr: int - header_offset: int - CRC: int - compress_size: int - file_size: int - def __init__(self, filename: Text | None = ..., date_time: _DT | None = ...) -> None: ... - def FileHeader(self, zip64: bool | None = ...) -> bytes: ... - -class _PathOpenProtocol(Protocol): - def __call__(self, mode: str = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ... - -def is_zipfile(filename: StrPath | IO[bytes]) -> bool: ... - -ZIP_STORED: int -ZIP_DEFLATED: int -ZIP64_LIMIT: int -ZIP_FILECOUNT_LIMIT: int -ZIP_MAX_COMMENT: int diff --git a/stdlib/@python2/zipimport.pyi b/stdlib/@python2/zipimport.pyi deleted file mode 100644 index bcefd68..0000000 --- a/stdlib/@python2/zipimport.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from types import CodeType, ModuleType - -class ZipImportError(ImportError): ... - -class zipimporter(object): - archive: str - prefix: str - def __init__(self, path: str | bytes) -> None: ... - def find_module(self, fullname: str, path: str | None = ...) -> zipimporter | None: ... - def get_code(self, fullname: str) -> CodeType: ... - def get_data(self, pathname: str) -> str: ... - def get_filename(self, fullname: str) -> str: ... - def get_source(self, fullname: str) -> str | None: ... - def is_package(self, fullname: str) -> bool: ... - def load_module(self, fullname: str) -> ModuleType: ... diff --git a/stdlib/@python2/zlib.pyi b/stdlib/@python2/zlib.pyi deleted file mode 100644 index 2cee20f..0000000 --- a/stdlib/@python2/zlib.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from array import array -from typing import Any - -DEFLATED: int -DEF_MEM_LEVEL: int -MAX_WBITS: int -ZLIB_VERSION: str -Z_BEST_COMPRESSION: int -Z_BEST_SPEED: int -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 - -class error(Exception): ... - -class _Compress: - def compress(self, data: bytes) -> bytes: ... - def flush(self, mode: int = ...) -> bytes: ... - def copy(self) -> _Compress: ... - -class _Decompress: - unused_data: bytes - unconsumed_tail: bytes - def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... - def flush(self, length: int = ...) -> bytes: ... - def copy(self) -> _Decompress: ... - -def adler32(__data: bytes, __value: int = ...) -> int: ... -def compress(__data: bytes, level: int = ...) -> bytes: ... -def compressobj(level: int = ..., method: int = ..., wbits: int = ..., memlevel: int = ..., strategy: int = ...) -> _Compress: ... -def crc32(__data: array[Any] | bytes, __value: int = ...) -> int: ... -def decompress(__data: bytes, wbits: int = ..., bufsize: int = ...) -> bytes: ... -def decompressobj(wbits: int = ...) -> _Decompress: ... diff --git a/stdlib/VERSIONS b/stdlib/VERSIONS index 9b92711..bd1abd2 100644 --- a/stdlib/VERSIONS +++ b/stdlib/VERSIONS @@ -14,46 +14,47 @@ # # Python versions before 2.7 are ignored, so any module that was already # present in 2.7 will have "2.7" as its minimum version. Version ranges -# for unsupported versions of Python 3 (currently 3.5 and lower) are -# generally accurate but we do not guarantee their correctness. +# for unsupported versions of Python 3 are generally accurate but we do +# not guarantee their correctness. __future__: 2.7- __main__: 2.7- _ast: 2.7- _bisect: 2.7- -_bootlocale: 3.6-3.9 +_bootlocale: 3.4-3.9 _codecs: 2.7- _collections_abc: 3.3- -_compat_pickle: 3.6- -_compression: 3.6- +_compat_pickle: 3.1- +_compression: 3.5- _csv: 2.7- +_ctypes: 2.7- _curses: 2.7- -_decimal: 3.6- -_dummy_thread: 3.6- -_dummy_threading: 2.7- +_decimal: 3.3- +_dummy_thread: 3.0-3.8 +_dummy_threading: 2.7-3.8 _heapq: 2.7- -_imp: 3.6- +_imp: 3.0- _json: 2.7- _markupbase: 2.7- _msi: 2.7- -_operator: 3.6- +_operator: 3.4- _osx_support: 2.7- -_posixsubprocess: 3.6- +_posixsubprocess: 3.2- _py_abc: 3.7- -_pydecimal: 3.6- +_pydecimal: 3.5- _random: 2.7- -_sitebuiltins: 3.6- +_sitebuiltins: 3.4- _socket: 3.0- # present in 2.7 at runtime, but not in typeshed -_stat: 3.6- +_stat: 3.4- _thread: 2.7- -_threading_local: 3.6- +_threading_local: 2.7- _tkinter: 2.7- -_tracemalloc: 3.6- +_tracemalloc: 3.4- _typeshed: 2.7- # not present at runtime, only for type checking _warnings: 2.7- _weakref: 2.7- _weakrefset: 2.7- -_winapi: 3.6- +_winapi: 3.3- abc: 2.7- aifc: 2.7- antigravity: 2.7- @@ -62,6 +63,15 @@ array: 2.7- ast: 2.7- asynchat: 2.7- asyncio: 3.4- +asyncio.mixins: 3.10- +asyncio.exceptions: 3.8- +asyncio.format_helpers: 3.7- +asyncio.runners: 3.7- +asyncio.staggered: 3.8- +asyncio.taskgroups: 3.11- +asyncio.threads: 3.9- +asyncio.timeouts: 3.11- +asyncio.trsock: 3.8- asyncore: 2.7- atexit: 2.7- audioop: 2.7- @@ -103,8 +113,10 @@ decimal: 2.7- difflib: 2.7- dis: 2.7- distutils: 2.7- +distutils.command.bdist_msi: 2.7-3.10 +distutils.command.bdist_wininst: 2.7-3.9 doctest: 2.7- -dummy_threading: 2.7- +dummy_threading: 2.7-3.8 email: 2.7- encodings: 2.7- ensurepip: 2.7- @@ -138,6 +150,7 @@ imghdr: 2.7- imp: 2.7- importlib: 2.7- importlib.metadata: 3.8- +importlib.metadata._meta: 3.10- importlib.resources: 3.7- inspect: 2.7- io: 2.7- @@ -151,7 +164,6 @@ locale: 2.7- logging: 2.7- lzma: 3.3- macpath: 2.7-3.7 -macurl2path: 2.7-3.6 mailbox: 2.7- mailcap: 2.7- marshal: 2.7- @@ -162,6 +174,8 @@ modulefinder: 2.7- msilib: 2.7- msvcrt: 2.7- multiprocessing: 2.7- +multiprocessing.resource_tracker: 3.8- +multiprocessing.shared_memory: 3.8- netrc: 2.7- nis: 2.7- nntplib: 2.7- @@ -249,6 +263,7 @@ timeit: 2.7- tkinter: 3.0- token: 2.7- tokenize: 2.7- +tomllib: 3.11- trace: 2.7- traceback: 2.7- tracemalloc: 3.4- @@ -259,6 +274,8 @@ typing: 3.5- typing_extensions: 2.7- unicodedata: 2.7- unittest: 2.7- +unittest._log: 3.9- +unittest.async_case: 3.8- urllib: 2.7- uu: 2.7- uuid: 2.7- @@ -270,10 +287,11 @@ webbrowser: 2.7- winreg: 3.0- winsound: 2.7- wsgiref: 2.7- +wsgiref.types: 3.11- xdrlib: 2.7- xml: 2.7- xmlrpc: 3.0- -xxlimited: 3.6- +xxlimited: 3.2- zipapp: 3.5- zipfile: 2.7- zipimport: 2.7- diff --git a/stdlib/__future__.pyi b/stdlib/__future__.pyi index 1a465c3..a90cf1e 100644 --- a/stdlib/__future__.pyi +++ b/stdlib/__future__.pyi @@ -1,9 +1,11 @@ -import sys +from typing_extensions import TypeAlias + +_VersionInfo: TypeAlias = tuple[int, int, int, str, int] class _Feature: - def __init__(self, optionalRelease: sys._version_info, mandatoryRelease: sys._version_info, compiler_flag: int) -> None: ... - def getOptionalRelease(self) -> sys._version_info: ... - def getMandatoryRelease(self) -> sys._version_info: ... + def __init__(self, optionalRelease: _VersionInfo, mandatoryRelease: _VersionInfo | None, compiler_flag: int) -> None: ... + def getOptionalRelease(self) -> _VersionInfo: ... + def getMandatoryRelease(self) -> _VersionInfo | None: ... compiler_flag: int absolute_import: _Feature @@ -15,36 +17,20 @@ unicode_literals: _Feature with_statement: _Feature barry_as_FLUFL: _Feature generator_stop: _Feature - -if sys.version_info >= (3, 7): - annotations: _Feature +annotations: _Feature all_feature_names: list[str] # undocumented -if sys.version_info >= (3, 7): - __all__ = [ - "all_feature_names", - "absolute_import", - "division", - "generators", - "nested_scopes", - "print_function", - "unicode_literals", - "with_statement", - "barry_as_FLUFL", - "generator_stop", - "annotations", - ] -else: - __all__ = [ - "all_feature_names", - "absolute_import", - "division", - "generators", - "nested_scopes", - "print_function", - "unicode_literals", - "with_statement", - "barry_as_FLUFL", - "generator_stop", - ] +__all__ = [ + "all_feature_names", + "absolute_import", + "division", + "generators", + "nested_scopes", + "print_function", + "unicode_literals", + "with_statement", + "barry_as_FLUFL", + "generator_stop", + "annotations", +] diff --git a/stdlib/_ast.pyi b/stdlib/_ast.pyi index 08725cf..b7d081f 100644 --- a/stdlib/_ast.pyi +++ b/stdlib/_ast.pyi @@ -1,18 +1,19 @@ import sys -import typing from typing import Any, ClassVar -from typing_extensions import Literal +from typing_extensions import Literal, TypeAlias -PyCF_ONLY_AST: int +PyCF_ONLY_AST: Literal[1024] if sys.version_info >= (3, 8): - PyCF_TYPE_COMMENTS: int - PyCF_ALLOW_TOP_LEVEL_AWAIT: int + PyCF_TYPE_COMMENTS: Literal[4096] + PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192] -_identifier = str +_Identifier: TypeAlias = str class AST: - _attributes: ClassVar[typing.Tuple[str, ...]] - _fields: ClassVar[typing.Tuple[str, ...]] + if sys.version_info >= (3, 10): + __match_args__ = () + _attributes: ClassVar[tuple[str, ...]] + _fields: ClassVar[tuple[str, ...]] def __init__(self, *args: Any, **kwargs: Any) -> None: ... # TODO: Not all nodes have all of the following attributes lineno: int @@ -26,126 +27,190 @@ class mod(AST): ... if sys.version_info >= (3, 8): class type_ignore(AST): ... + class TypeIgnore(type_ignore): + if sys.version_info >= (3, 10): + __match_args__ = ("lineno", "tag") tag: str + class FunctionType(mod): + if sys.version_info >= (3, 10): + __match_args__ = ("argtypes", "returns") argtypes: list[expr] returns: expr class Module(mod): + if sys.version_info >= (3, 10): + __match_args__ = ("body", "type_ignores") body: list[stmt] if sys.version_info >= (3, 8): type_ignores: list[TypeIgnore] class Interactive(mod): + if sys.version_info >= (3, 10): + __match_args__ = ("body",) body: list[stmt] class Expression(mod): + if sys.version_info >= (3, 10): + __match_args__ = ("body",) body: expr class stmt(AST): ... class FunctionDef(stmt): - name: _identifier + if sys.version_info >= (3, 10): + __match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment") + name: _Identifier args: arguments body: list[stmt] decorator_list: list[expr] returns: expr | None class AsyncFunctionDef(stmt): - name: _identifier + if sys.version_info >= (3, 10): + __match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment") + name: _Identifier args: arguments body: list[stmt] decorator_list: list[expr] returns: expr | None class ClassDef(stmt): - name: _identifier + if sys.version_info >= (3, 10): + __match_args__ = ("name", "bases", "keywords", "body", "decorator_list") + name: _Identifier bases: list[expr] keywords: list[keyword] body: list[stmt] decorator_list: list[expr] class Return(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("value",) value: expr | None class Delete(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("targets",) targets: list[expr] class Assign(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("targets", "value", "type_comment") targets: list[expr] value: expr class AugAssign(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("target", "op", "value") target: expr op: operator value: expr class AnnAssign(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("target", "annotation", "value", "simple") target: expr annotation: expr value: expr | None simple: int class For(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("target", "iter", "body", "orelse", "type_comment") target: expr iter: expr body: list[stmt] orelse: list[stmt] class AsyncFor(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("target", "iter", "body", "orelse", "type_comment") target: expr iter: expr body: list[stmt] orelse: list[stmt] class While(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("test", "body", "orelse") test: expr body: list[stmt] orelse: list[stmt] class If(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("test", "body", "orelse") test: expr body: list[stmt] orelse: list[stmt] class With(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("items", "body", "type_comment") items: list[withitem] body: list[stmt] class AsyncWith(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("items", "body", "type_comment") items: list[withitem] body: list[stmt] class Raise(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("exc", "cause") exc: expr | None cause: expr | None class Try(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("body", "handlers", "orelse", "finalbody") body: list[stmt] handlers: list[ExceptHandler] orelse: list[stmt] finalbody: list[stmt] +if sys.version_info >= (3, 11): + class TryStar(stmt): + __match_args__ = ("body", "handlers", "orelse", "finalbody") + body: list[stmt] + handlers: list[ExceptHandler] + orelse: list[stmt] + finalbody: list[stmt] + class Assert(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("test", "msg") test: expr msg: expr | None class Import(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("names",) names: list[alias] class ImportFrom(stmt): - module: _identifier | None + if sys.version_info >= (3, 10): + __match_args__ = ("module", "names", "level") + module: str | None names: list[alias] level: int class Global(stmt): - names: list[_identifier] + if sys.version_info >= (3, 10): + __match_args__ = ("names",) + names: list[_Identifier] class Nonlocal(stmt): - names: list[_identifier] + if sys.version_info >= (3, 10): + __match_args__ = ("names",) + names: list[_Identifier] class Expr(stmt): + if sys.version_info >= (3, 10): + __match_args__ = ("value",) value: expr class Pass(stmt): ... @@ -154,90 +219,132 @@ class Continue(stmt): ... class expr(AST): ... class BoolOp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("op", "values") op: boolop values: list[expr] class BinOp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("left", "op", "right") left: expr op: operator right: expr class UnaryOp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("op", "operand") op: unaryop operand: expr class Lambda(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("args", "body") args: arguments body: expr class IfExp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("test", "body", "orelse") test: expr body: expr orelse: expr class Dict(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("keys", "values") keys: list[expr | None] values: list[expr] class Set(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("elts",) elts: list[expr] class ListComp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("elt", "generators") elt: expr generators: list[comprehension] class SetComp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("elt", "generators") elt: expr generators: list[comprehension] class DictComp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("key", "value", "generators") key: expr value: expr generators: list[comprehension] class GeneratorExp(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("elt", "generators") elt: expr generators: list[comprehension] class Await(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value",) value: expr class Yield(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value",) value: expr | None class YieldFrom(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value",) value: expr class Compare(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("left", "ops", "comparators") left: expr ops: list[cmpop] comparators: list[expr] class Call(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("func", "args", "keywords") func: expr args: list[expr] keywords: list[keyword] class FormattedValue(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value", "conversion", "format_spec") value: expr - conversion: int | None + conversion: int format_spec: expr | None class JoinedStr(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("values",) values: list[expr] if sys.version_info < (3, 8): class Num(expr): # Deprecated in 3.8; use Constant n: complex + class Str(expr): # Deprecated in 3.8; use Constant s: str + class Bytes(expr): # Deprecated in 3.8; use Constant s: bytes + class NameConstant(expr): # Deprecated in 3.8; use Constant value: Any + class Ellipsis(expr): ... # Deprecated in 3.8; use Constant class Constant(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value", "kind") value: Any # None, str, bytes, bool, int, float, complex, Ellipsis kind: str | None # Aliases for value, for backwards compatibility @@ -246,21 +353,27 @@ class Constant(expr): if sys.version_info >= (3, 8): class NamedExpr(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("target", "value") target: expr value: expr class Attribute(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value", "attr", "ctx") value: expr - attr: _identifier + attr: _Identifier ctx: expr_context if sys.version_info >= (3, 9): - _SliceT = expr + _Slice: TypeAlias = expr else: class slice(AST): ... - _SliceT = slice + _Slice: TypeAlias = slice -class Slice(_SliceT): +class Slice(_Slice): + if sys.version_info >= (3, 10): + __match_args__ = ("lower", "upper", "step") lower: expr | None upper: expr | None step: expr | None @@ -268,29 +381,42 @@ class Slice(_SliceT): if sys.version_info < (3, 9): class ExtSlice(slice): dims: list[slice] + class Index(slice): value: expr class Subscript(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value", "slice", "ctx") value: expr - slice: _SliceT + slice: _Slice ctx: expr_context class Starred(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("value", "ctx") value: expr ctx: expr_context class Name(expr): - id: _identifier + if sys.version_info >= (3, 10): + __match_args__ = ("id", "ctx") + id: _Identifier ctx: expr_context class List(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("elts", "ctx") elts: list[expr] ctx: expr_context class Tuple(expr): + if sys.version_info >= (3, 10): + __match_args__ = ("elts", "ctx") elts: list[expr] ctx: expr_context + if sys.version_info >= (3, 9): + dims: list[expr] class expr_context(AST): ... @@ -298,6 +424,7 @@ if sys.version_info < (3, 9): class AugLoad(expr_context): ... class AugStore(expr_context): ... class Param(expr_context): ... + class Suite(mod): body: list[stmt] @@ -339,6 +466,8 @@ class NotEq(cmpop): ... class NotIn(cmpop): ... class comprehension(AST): + if sys.version_info >= (3, 10): + __match_args__ = ("target", "iter", "ifs", "is_async") target: expr iter: expr ifs: list[expr] @@ -347,11 +476,15 @@ class comprehension(AST): class excepthandler(AST): ... class ExceptHandler(excepthandler): + if sys.version_info >= (3, 10): + __match_args__ = ("type", "name", "body") type: expr | None - name: _identifier | None + name: _Identifier | None body: list[stmt] class arguments(AST): + if sys.version_info >= (3, 10): + __match_args__ = ("posonlyargs", "args", "vararg", "kwonlyargs", "kw_defaults", "kwarg", "defaults") if sys.version_info >= (3, 8): posonlyargs: list[arg] args: list[arg] @@ -362,51 +495,79 @@ class arguments(AST): defaults: list[expr] class arg(AST): - arg: _identifier + if sys.version_info >= (3, 10): + __match_args__ = ("arg", "annotation", "type_comment") + arg: _Identifier annotation: expr | None class keyword(AST): - arg: _identifier | None + if sys.version_info >= (3, 10): + __match_args__ = ("arg", "value") + arg: _Identifier | None value: expr class alias(AST): - name: _identifier - asname: _identifier | None + if sys.version_info >= (3, 10): + __match_args__ = ("name", "asname") + name: _Identifier + asname: _Identifier | None class withitem(AST): + if sys.version_info >= (3, 10): + __match_args__ = ("context_expr", "optional_vars") context_expr: expr optional_vars: expr | None if sys.version_info >= (3, 10): class Match(stmt): + __match_args__ = ("subject", "cases") subject: expr cases: list[match_case] + class pattern(AST): ... # Without the alias, Pyright complains variables named pattern are recursively defined - _pattern = pattern + _Pattern: TypeAlias = pattern + class match_case(AST): - pattern: _pattern + __match_args__ = ("pattern", "guard", "body") + pattern: _Pattern guard: expr | None body: list[stmt] + class MatchValue(pattern): + __match_args__ = ("value",) value: expr + class MatchSingleton(pattern): + __match_args__ = ("value",) value: Literal[True, False, None] + class MatchSequence(pattern): + __match_args__ = ("patterns",) patterns: list[pattern] + class MatchStar(pattern): - name: _identifier | None + __match_args__ = ("name",) + name: _Identifier | None + class MatchMapping(pattern): + __match_args__ = ("keys", "patterns", "rest") keys: list[expr] patterns: list[pattern] - rest: _identifier | None + rest: _Identifier | None + class MatchClass(pattern): + __match_args__ = ("cls", "patterns", "kwd_attrs", "kwd_patterns") cls: expr patterns: list[pattern] - kwd_attrs: list[_identifier] + kwd_attrs: list[_Identifier] kwd_patterns: list[pattern] + class MatchAs(pattern): - pattern: _pattern | None - name: _identifier | None + __match_args__ = ("pattern", "name") + pattern: _Pattern | None + name: _Identifier | None + class MatchOr(pattern): + __match_args__ = ("patterns",) patterns: list[pattern] diff --git a/stdlib/_bisect.pyi b/stdlib/_bisect.pyi index 6da6e7f..d902e1e 100644 --- a/stdlib/_bisect.pyi +++ b/stdlib/_bisect.pyi @@ -1,25 +1,74 @@ import sys -from _typeshed import SupportsLessThan -from typing import Callable, MutableSequence, Sequence, TypeVar +from _typeshed import SupportsRichComparisonT +from collections.abc import Callable, MutableSequence, Sequence +from typing import TypeVar, overload _T = TypeVar("_T") if sys.version_info >= (3, 10): + @overload def bisect_left( - a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ... + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ..., *, key: None = ... ) -> int: ... + @overload + def bisect_left( + a: Sequence[_T], + x: SupportsRichComparisonT, + lo: int = ..., + hi: int | None = ..., + *, + key: Callable[[_T], SupportsRichComparisonT] = ..., + ) -> int: ... + @overload + def bisect_right( + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ..., *, key: None = ... + ) -> int: ... + @overload def bisect_right( - a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ... + a: Sequence[_T], + x: SupportsRichComparisonT, + lo: int = ..., + hi: int | None = ..., + *, + key: Callable[[_T], SupportsRichComparisonT] = ..., ) -> int: ... + @overload def insort_left( - a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ... + a: MutableSequence[SupportsRichComparisonT], + x: SupportsRichComparisonT, + lo: int = ..., + hi: int | None = ..., + *, + key: None = ..., + ) -> None: ... + @overload + def insort_left( + a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsRichComparisonT] = ... + ) -> None: ... + @overload + def insort_right( + a: MutableSequence[SupportsRichComparisonT], + x: SupportsRichComparisonT, + lo: int = ..., + hi: int | None = ..., + *, + key: None = ..., ) -> None: ... + @overload def insort_right( - a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ... + a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsRichComparisonT] = ... ) -> None: ... else: - def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> int: ... - def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> int: ... - def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> None: ... - def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> None: ... + def bisect_left( + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + ) -> int: ... + def bisect_right( + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + ) -> int: ... + def insort_left( + a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + ) -> None: ... + def insort_right( + a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + ) -> None: ... diff --git a/stdlib/_codecs.pyi b/stdlib/_codecs.pyi index aa30309..232256f 100644 --- a/stdlib/_codecs.pyi +++ b/stdlib/_codecs.pyi @@ -1,66 +1,136 @@ import codecs import sys -from typing import Any, Callable, Dict, Tuple, Union +from _typeshed import ReadableBuffer +from collections.abc import Callable +from typing import overload +from typing_extensions import Literal, TypeAlias # This type is not exposed; it is defined in unicodeobject.c class _EncodingMap: def size(self) -> int: ... -_MapT = Union[Dict[int, int], _EncodingMap] -_Handler = Callable[[Exception], Tuple[str, int]] +_CharMap: TypeAlias = dict[int, int] | _EncodingMap +_Handler: TypeAlias = Callable[[UnicodeError], tuple[str | bytes, int]] +_SearchFunction: TypeAlias = Callable[[str], codecs.CodecInfo | None] + +def register(__search_function: _SearchFunction) -> None: ... + +if sys.version_info >= (3, 10): + def unregister(__search_function: _SearchFunction) -> None: ... -def register(__search_function: Callable[[str], Any]) -> None: ... def register_error(__errors: str, __handler: _Handler) -> None: ... -def lookup(__encoding: str) -> codecs.CodecInfo: ... def lookup_error(__name: str) -> _Handler: ... -def decode(obj: Any, encoding: str = ..., errors: str | None = ...) -> Any: ... -def encode(obj: Any, encoding: str = ..., errors: str | None = ...) -> Any: ... -def charmap_build(__map: str) -> _MapT: ... -def ascii_decode(__data: bytes, __errors: str | None = ...) -> Tuple[str, int]: ... -def ascii_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def charmap_decode(__data: bytes, __errors: str | None = ..., __mapping: _MapT | None = ...) -> Tuple[str, int]: ... -def charmap_encode(__str: str, __errors: str | None = ..., __mapping: _MapT | None = ...) -> Tuple[bytes, int]: ... -def escape_decode(__data: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ... -def escape_encode(__data: bytes, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def latin_1_decode(__data: bytes, __errors: str | None = ...) -> Tuple[str, int]: ... -def latin_1_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def raw_unicode_escape_decode(__data: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ... -def raw_unicode_escape_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def readbuffer_encode(__data: str | bytes, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def unicode_escape_decode(__data: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ... -def unicode_escape_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... + +# The type ignore on `encode` and `decode` is to avoid issues with overlapping overloads, for more details, see #300 +# https://docs.python.org/3/library/codecs.html#binary-transforms +_BytesToBytesEncoding: TypeAlias = Literal[ + "base64", + "base_64", + "base64_codec", + "bz2", + "bz2_codec", + "hex", + "hex_codec", + "quopri", + "quotedprintable", + "quoted_printable", + "quopri_codec", + "uu", + "uu_codec", + "zip", + "zlib", + "zlib_codec", +] +# https://docs.python.org/3/library/codecs.html#text-transforms +_StrToStrEncoding: TypeAlias = Literal["rot13", "rot_13"] + +@overload +def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ... +@overload +def encode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ... # type: ignore[misc] +@overload +def encode(obj: str, encoding: str = ..., errors: str = ...) -> bytes: ... +@overload +def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ... # type: ignore[misc] +@overload +def decode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ... + +# these are documented as text encodings but in practice they also accept str as input +@overload +def decode( + obj: str, encoding: Literal["unicode_escape", "unicode-escape", "raw_unicode_escape", "raw-unicode-escape"], errors: str = ... +) -> str: ... + +# hex is officially documented as a bytes to bytes encoding, but it appears to also work with str +@overload +def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = ...) -> bytes: ... +@overload +def decode(obj: ReadableBuffer, encoding: str = ..., errors: str = ...) -> str: ... +def lookup(__encoding: str) -> codecs.CodecInfo: ... +def charmap_build(__map: str) -> _CharMap: ... +def ascii_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ... +def ascii_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def charmap_decode(__data: ReadableBuffer, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[str, int]: ... +def charmap_encode(__str: str, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[bytes, int]: ... +def escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ... +def escape_encode(__data: bytes, __errors: str | None = ...) -> tuple[bytes, int]: ... +def latin_1_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ... +def latin_1_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... + +if sys.version_info >= (3, 9): + def raw_unicode_escape_decode( + __data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ... + ) -> tuple[str, int]: ... + +else: + def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ... + +def raw_unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def readbuffer_encode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[bytes, int]: ... + +if sys.version_info >= (3, 9): + def unicode_escape_decode( + __data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ... + ) -> tuple[str, int]: ... + +else: + def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ... + +def unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... if sys.version_info < (3, 8): - def unicode_internal_decode(__obj: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ... - def unicode_internal_encode(__obj: str | bytes, __errors: str | None = ...) -> Tuple[bytes, int]: ... + def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ... + def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = ...) -> tuple[bytes, int]: ... -def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_16_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def utf_16_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_16_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... +def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_16_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def utf_16_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_16_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ... def utf_16_ex_decode( - __data: bytes, __errors: str | None = ..., __byteorder: int = ..., __final: int = ... -) -> Tuple[str, int, int]: ... -def utf_16_le_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_16_le_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def utf_32_be_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_32_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def utf_32_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_32_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ... + __data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ... +) -> tuple[str, int, int]: ... +def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_16_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_32_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def utf_32_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_32_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ... def utf_32_ex_decode( - __data: bytes, __errors: str | None = ..., __byteorder: int = ..., __final: int = ... -) -> Tuple[str, int, int]: ... -def utf_32_le_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_32_le_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def utf_7_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_7_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def utf_8_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... -def utf_8_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... + __data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ... +) -> tuple[str, int, int]: ... +def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_32_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def utf_7_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_7_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def utf_8_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... +def utf_8_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... if sys.platform == "win32": - def mbcs_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... - def mbcs_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... - def code_page_decode(__codepage: int, __data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... - def code_page_encode(__code_page: int, __str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... - def oem_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ... - def oem_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... + def mbcs_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... + def mbcs_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... + def code_page_decode( + __codepage: int, __data: ReadableBuffer, __errors: str | None = ..., __final: int = ... + ) -> tuple[str, int]: ... + def code_page_encode(__code_page: int, __str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... + def oem_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ... + def oem_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... diff --git a/stdlib/_collections_abc.pyi b/stdlib/_collections_abc.pyi index 27d5234..8373fe8 100644 --- a/stdlib/_collections_abc.pyi +++ b/stdlib/_collections_abc.pyi @@ -1,4 +1,6 @@ -from typing import ( +import sys +from types import MappingProxyType +from typing import ( # noqa: Y027,Y038 AbstractSet as Set, AsyncGenerator as AsyncGenerator, AsyncIterable as AsyncIterable, @@ -10,6 +12,7 @@ from typing import ( Container as Container, Coroutine as Coroutine, Generator as Generator, + Generic, Hashable as Hashable, ItemsView as ItemsView, Iterable as Iterable, @@ -23,8 +26,10 @@ from typing import ( Reversible as Reversible, Sequence as Sequence, Sized as Sized, + TypeVar, ValuesView as ValuesView, ) +from typing_extensions import final __all__ = [ "Awaitable", @@ -53,3 +58,24 @@ __all__ = [ "MutableSequence", "ByteString", ] + +_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. +_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. + +@final +class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented + if sys.version_info >= (3, 10): + @property + def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ... + +@final +class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented + if sys.version_info >= (3, 10): + @property + def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ... + +@final +class dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]): # undocumented + if sys.version_info >= (3, 10): + @property + def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ... diff --git a/stdlib/_compat_pickle.pyi b/stdlib/_compat_pickle.pyi index ba6c88a..50fb224 100644 --- a/stdlib/_compat_pickle.pyi +++ b/stdlib/_compat_pickle.pyi @@ -1,10 +1,8 @@ -from typing import Tuple - IMPORT_MAPPING: dict[str, str] -NAME_MAPPING: dict[Tuple[str, str], Tuple[str, str]] -PYTHON2_EXCEPTIONS: Tuple[str, ...] -MULTIPROCESSING_EXCEPTIONS: Tuple[str, ...] +NAME_MAPPING: dict[tuple[str, str], tuple[str, str]] +PYTHON2_EXCEPTIONS: tuple[str, ...] +MULTIPROCESSING_EXCEPTIONS: tuple[str, ...] REVERSE_IMPORT_MAPPING: dict[str, str] -REVERSE_NAME_MAPPING: dict[Tuple[str, str], Tuple[str, str]] -PYTHON3_OSERROR_EXCEPTIONS: Tuple[str, ...] -PYTHON3_IMPORTERROR_EXCEPTIONS: Tuple[str, ...] +REVERSE_NAME_MAPPING: dict[tuple[str, str], tuple[str, str]] +PYTHON3_OSERROR_EXCEPTIONS: tuple[str, ...] +PYTHON3_IMPORTERROR_EXCEPTIONS: tuple[str, ...] diff --git a/stdlib/_compression.pyi b/stdlib/_compression.pyi index 8f81847..7047a7b 100644 --- a/stdlib/_compression.pyi +++ b/stdlib/_compression.pyi @@ -1,8 +1,9 @@ from _typeshed import WriteableBuffer -from io import BufferedIOBase, RawIOBase -from typing import Any, Callable, Protocol, Tuple, Type +from collections.abc import Callable +from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase +from typing import Any, Protocol -BUFFER_SIZE: Any +BUFFER_SIZE = DEFAULT_BUFFER_SIZE class _Reader(Protocol): def read(self, __n: int) -> bytes: ... @@ -16,13 +17,9 @@ class DecompressReader(RawIOBase): self, fp: _Reader, decomp_factory: Callable[..., object], - trailing_error: Type[Exception] | Tuple[Type[Exception], ...] = ..., + trailing_error: type[Exception] | tuple[type[Exception], ...] = ..., **decomp_args: Any, ) -> None: ... - def readable(self) -> bool: ... - def close(self) -> None: ... - def seekable(self) -> bool: ... def readinto(self, b: WriteableBuffer) -> int: ... def read(self, size: int = ...) -> bytes: ... def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... diff --git a/stdlib/_csv.pyi b/stdlib/_csv.pyi index 1dc4378..7d15365 100644 --- a/stdlib/_csv.pyi +++ b/stdlib/_csv.pyi @@ -1,9 +1,18 @@ -from typing import Any, Iterable, Iterator, List, Protocol, Type, Union +from _typeshed import SupportsWrite +from collections.abc import Iterable, Iterator +from typing import Any, Union +from typing_extensions import Literal, TypeAlias -QUOTE_ALL: int -QUOTE_MINIMAL: int -QUOTE_NONE: int -QUOTE_NONNUMERIC: int +__version__: str + +QUOTE_ALL: Literal[1] +QUOTE_MINIMAL: Literal[0] +QUOTE_NONE: Literal[3] +QUOTE_NONNUMERIC: Literal[2] + +# Ideally this would be `QUOTE_ALL | QUOTE_MINIMAL | QUOTE_NONE | QUOTE_NONNUMERIC` +# However, using literals in situations like these can cause false-positives (see #7258) +_QuotingType: TypeAlias = int class Error(Exception): ... @@ -14,28 +23,63 @@ class Dialect: doublequote: bool skipinitialspace: bool lineterminator: str - quoting: int - strict: int + quoting: _QuotingType + strict: bool def __init__(self) -> None: ... -_DialectLike = Union[str, Dialect, Type[Dialect]] +_DialectLike: TypeAlias = Union[str, Dialect, type[Dialect]] -class _reader(Iterator[List[str]]): - dialect: Dialect +class _reader(Iterator[list[str]]): + @property + def dialect(self) -> Dialect: ... line_num: int def __next__(self) -> list[str]: ... class _writer: - dialect: Dialect + @property + def dialect(self) -> Dialect: ... def writerow(self, row: Iterable[Any]) -> Any: ... def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ... -class _Writer(Protocol): - def write(self, s: str) -> Any: ... - -def writer(csvfile: _Writer, dialect: _DialectLike = ..., **fmtparams: Any) -> _writer: ... -def reader(csvfile: Iterable[str], dialect: _DialectLike = ..., **fmtparams: Any) -> _reader: ... -def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ... +def writer( + csvfile: SupportsWrite[str], + dialect: _DialectLike = ..., + *, + delimiter: str = ..., + quotechar: str | None = ..., + escapechar: str | None = ..., + doublequote: bool = ..., + skipinitialspace: bool = ..., + lineterminator: str = ..., + quoting: _QuotingType = ..., + strict: bool = ..., +) -> _writer: ... +def reader( + csvfile: Iterable[str], + dialect: _DialectLike = ..., + *, + delimiter: str = ..., + quotechar: str | None = ..., + escapechar: str | None = ..., + doublequote: bool = ..., + skipinitialspace: bool = ..., + lineterminator: str = ..., + quoting: _QuotingType = ..., + strict: bool = ..., +) -> _reader: ... +def register_dialect( + name: str, + dialect: Any = ..., + *, + delimiter: str = ..., + quotechar: str | None = ..., + escapechar: str | None = ..., + doublequote: bool = ..., + skipinitialspace: bool = ..., + lineterminator: str = ..., + quoting: _QuotingType = ..., + strict: bool = ..., +) -> None: ... def unregister_dialect(name: str) -> None: ... def get_dialect(name: str) -> Dialect: ... def list_dialects() -> list[str]: ... diff --git a/stdlib/_ctypes.pyi b/stdlib/_ctypes.pyi new file mode 100644 index 0000000..0ad2fcb --- /dev/null +++ b/stdlib/_ctypes.pyi @@ -0,0 +1,29 @@ +import sys +from ctypes import _CArgObject, _PointerLike +from typing_extensions import TypeAlias + +FUNCFLAG_CDECL: int +FUNCFLAG_PYTHONAPI: int +FUNCFLAG_USE_ERRNO: int +FUNCFLAG_USE_LASTERROR: int +RTLD_GLOBAL: int +RTLD_LOCAL: int + +if sys.version_info >= (3, 11): + CTYPES_MAX_ARGCOUNT: int + +if sys.platform == "win32": + # Description, Source, HelpFile, HelpContext, scode + _COMError_Details: TypeAlias = tuple[str | None, str | None, str | None, int | None, int | None] + + class COMError(Exception): + hresult: int + text: str | None + details: _COMError_Details + + def __init__(self, hresult: int, text: str | None, details: _COMError_Details) -> None: ... + + def CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -> int: ... + + FUNCFLAG_HRESULT: int + FUNCFLAG_STDCALL: int diff --git a/stdlib/_curses.pyi b/stdlib/_curses.pyi index e4fc2a8..7053e85 100644 --- a/stdlib/_curses.pyi +++ b/stdlib/_curses.pyi @@ -1,548 +1,555 @@ import sys -from typing import IO, Any, BinaryIO, NamedTuple, Tuple, Union, overload +from _typeshed import ReadOnlyBuffer, SupportsRead +from typing import IO, Any, NamedTuple, overload +from typing_extensions import TypeAlias, final -_chtype = Union[str, bytes, int] +if sys.platform != "win32": + # Handled by PyCurses_ConvertToChtype in _cursesmodule.c. + _ChType: TypeAlias = str | bytes | int -# ACS codes are only initialized after initscr is called -ACS_BBSS: int -ACS_BLOCK: int -ACS_BOARD: int -ACS_BSBS: int -ACS_BSSB: int -ACS_BSSS: int -ACS_BTEE: int -ACS_BULLET: int -ACS_CKBOARD: int -ACS_DARROW: int -ACS_DEGREE: int -ACS_DIAMOND: int -ACS_GEQUAL: int -ACS_HLINE: int -ACS_LANTERN: int -ACS_LARROW: int -ACS_LEQUAL: int -ACS_LLCORNER: int -ACS_LRCORNER: int -ACS_LTEE: int -ACS_NEQUAL: int -ACS_PI: int -ACS_PLMINUS: int -ACS_PLUS: int -ACS_RARROW: int -ACS_RTEE: int -ACS_S1: int -ACS_S3: int -ACS_S7: int -ACS_S9: int -ACS_SBBS: int -ACS_SBSB: int -ACS_SBSS: int -ACS_SSBB: int -ACS_SSBS: int -ACS_SSSB: int -ACS_SSSS: int -ACS_STERLING: int -ACS_TTEE: int -ACS_UARROW: int -ACS_ULCORNER: int -ACS_URCORNER: int -ACS_VLINE: int -ALL_MOUSE_EVENTS: int -A_ALTCHARSET: int -A_ATTRIBUTES: int -A_BLINK: int -A_BOLD: int -A_CHARTEXT: int -A_COLOR: int -A_DIM: int -A_HORIZONTAL: int -A_INVIS: int -if sys.version_info >= (3, 7): + # ACS codes are only initialized after initscr is called + ACS_BBSS: int + ACS_BLOCK: int + ACS_BOARD: int + ACS_BSBS: int + ACS_BSSB: int + ACS_BSSS: int + ACS_BTEE: int + ACS_BULLET: int + ACS_CKBOARD: int + ACS_DARROW: int + ACS_DEGREE: int + ACS_DIAMOND: int + ACS_GEQUAL: int + ACS_HLINE: int + ACS_LANTERN: int + ACS_LARROW: int + ACS_LEQUAL: int + ACS_LLCORNER: int + ACS_LRCORNER: int + ACS_LTEE: int + ACS_NEQUAL: int + ACS_PI: int + ACS_PLMINUS: int + ACS_PLUS: int + ACS_RARROW: int + ACS_RTEE: int + ACS_S1: int + ACS_S3: int + ACS_S7: int + ACS_S9: int + ACS_SBBS: int + ACS_SBSB: int + ACS_SBSS: int + ACS_SSBB: int + ACS_SSBS: int + ACS_SSSB: int + ACS_SSSS: int + ACS_STERLING: int + ACS_TTEE: int + ACS_UARROW: int + ACS_ULCORNER: int + ACS_URCORNER: int + ACS_VLINE: int + ALL_MOUSE_EVENTS: int + A_ALTCHARSET: int + A_ATTRIBUTES: int + A_BLINK: int + A_BOLD: int + A_CHARTEXT: int + A_COLOR: int + A_DIM: int + A_HORIZONTAL: int + A_INVIS: int A_ITALIC: int -A_LEFT: int -A_LOW: int -A_NORMAL: int -A_PROTECT: int -A_REVERSE: int -A_RIGHT: int -A_STANDOUT: int -A_TOP: int -A_UNDERLINE: int -A_VERTICAL: int -BUTTON1_CLICKED: int -BUTTON1_DOUBLE_CLICKED: int -BUTTON1_PRESSED: int -BUTTON1_RELEASED: int -BUTTON1_TRIPLE_CLICKED: int -BUTTON2_CLICKED: int -BUTTON2_DOUBLE_CLICKED: int -BUTTON2_PRESSED: int -BUTTON2_RELEASED: int -BUTTON2_TRIPLE_CLICKED: int -BUTTON3_CLICKED: int -BUTTON3_DOUBLE_CLICKED: int -BUTTON3_PRESSED: int -BUTTON3_RELEASED: int -BUTTON3_TRIPLE_CLICKED: int -BUTTON4_CLICKED: int -BUTTON4_DOUBLE_CLICKED: int -BUTTON4_PRESSED: int -BUTTON4_RELEASED: int -BUTTON4_TRIPLE_CLICKED: int -# Darwin ncurses doesn't provide BUTTON5_* constants -if sys.version_info >= (3, 10) and sys.platform != "darwin": - BUTTON5_PRESSED: int - BUTTON5_RELEASED: int - BUTTON5_CLICKED: int - BUTTON5_DOUBLE_CLICKED: int - BUTTON5_TRIPLE_CLICKED: int -BUTTON_ALT: int -BUTTON_CTRL: int -BUTTON_SHIFT: int -COLOR_BLACK: int -COLOR_BLUE: int -COLOR_CYAN: int -COLOR_GREEN: int -COLOR_MAGENTA: int -COLOR_RED: int -COLOR_WHITE: int -COLOR_YELLOW: int -ERR: int -KEY_A1: int -KEY_A3: int -KEY_B2: int -KEY_BACKSPACE: int -KEY_BEG: int -KEY_BREAK: int -KEY_BTAB: int -KEY_C1: int -KEY_C3: int -KEY_CANCEL: int -KEY_CATAB: int -KEY_CLEAR: int -KEY_CLOSE: int -KEY_COMMAND: int -KEY_COPY: int -KEY_CREATE: int -KEY_CTAB: int -KEY_DC: int -KEY_DL: int -KEY_DOWN: int -KEY_EIC: int -KEY_END: int -KEY_ENTER: int -KEY_EOL: int -KEY_EOS: int -KEY_EXIT: int -KEY_F0: int -KEY_F1: int -KEY_F10: int -KEY_F11: int -KEY_F12: int -KEY_F13: int -KEY_F14: int -KEY_F15: int -KEY_F16: int -KEY_F17: int -KEY_F18: int -KEY_F19: int -KEY_F2: int -KEY_F20: int -KEY_F21: int -KEY_F22: int -KEY_F23: int -KEY_F24: int -KEY_F25: int -KEY_F26: int -KEY_F27: int -KEY_F28: int -KEY_F29: int -KEY_F3: int -KEY_F30: int -KEY_F31: int -KEY_F32: int -KEY_F33: int -KEY_F34: int -KEY_F35: int -KEY_F36: int -KEY_F37: int -KEY_F38: int -KEY_F39: int -KEY_F4: int -KEY_F40: int -KEY_F41: int -KEY_F42: int -KEY_F43: int -KEY_F44: int -KEY_F45: int -KEY_F46: int -KEY_F47: int -KEY_F48: int -KEY_F49: int -KEY_F5: int -KEY_F50: int -KEY_F51: int -KEY_F52: int -KEY_F53: int -KEY_F54: int -KEY_F55: int -KEY_F56: int -KEY_F57: int -KEY_F58: int -KEY_F59: int -KEY_F6: int -KEY_F60: int -KEY_F61: int -KEY_F62: int -KEY_F63: int -KEY_F7: int -KEY_F8: int -KEY_F9: int -KEY_FIND: int -KEY_HELP: int -KEY_HOME: int -KEY_IC: int -KEY_IL: int -KEY_LEFT: int -KEY_LL: int -KEY_MARK: int -KEY_MAX: int -KEY_MESSAGE: int -KEY_MIN: int -KEY_MOUSE: int -KEY_MOVE: int -KEY_NEXT: int -KEY_NPAGE: int -KEY_OPEN: int -KEY_OPTIONS: int -KEY_PPAGE: int -KEY_PREVIOUS: int -KEY_PRINT: int -KEY_REDO: int -KEY_REFERENCE: int -KEY_REFRESH: int -KEY_REPLACE: int -KEY_RESET: int -KEY_RESIZE: int -KEY_RESTART: int -KEY_RESUME: int -KEY_RIGHT: int -KEY_SAVE: int -KEY_SBEG: int -KEY_SCANCEL: int -KEY_SCOMMAND: int -KEY_SCOPY: int -KEY_SCREATE: int -KEY_SDC: int -KEY_SDL: int -KEY_SELECT: int -KEY_SEND: int -KEY_SEOL: int -KEY_SEXIT: int -KEY_SF: int -KEY_SFIND: int -KEY_SHELP: int -KEY_SHOME: int -KEY_SIC: int -KEY_SLEFT: int -KEY_SMESSAGE: int -KEY_SMOVE: int -KEY_SNEXT: int -KEY_SOPTIONS: int -KEY_SPREVIOUS: int -KEY_SPRINT: int -KEY_SR: int -KEY_SREDO: int -KEY_SREPLACE: int -KEY_SRESET: int -KEY_SRIGHT: int -KEY_SRSUME: int -KEY_SSAVE: int -KEY_SSUSPEND: int -KEY_STAB: int -KEY_SUNDO: int -KEY_SUSPEND: int -KEY_UNDO: int -KEY_UP: int -OK: int -REPORT_MOUSE_POSITION: int -_C_API: Any -version: bytes + A_LEFT: int + A_LOW: int + A_NORMAL: int + A_PROTECT: int + A_REVERSE: int + A_RIGHT: int + A_STANDOUT: int + A_TOP: int + A_UNDERLINE: int + A_VERTICAL: int + BUTTON1_CLICKED: int + BUTTON1_DOUBLE_CLICKED: int + BUTTON1_PRESSED: int + BUTTON1_RELEASED: int + BUTTON1_TRIPLE_CLICKED: int + BUTTON2_CLICKED: int + BUTTON2_DOUBLE_CLICKED: int + BUTTON2_PRESSED: int + BUTTON2_RELEASED: int + BUTTON2_TRIPLE_CLICKED: int + BUTTON3_CLICKED: int + BUTTON3_DOUBLE_CLICKED: int + BUTTON3_PRESSED: int + BUTTON3_RELEASED: int + BUTTON3_TRIPLE_CLICKED: int + BUTTON4_CLICKED: int + BUTTON4_DOUBLE_CLICKED: int + BUTTON4_PRESSED: int + BUTTON4_RELEASED: int + BUTTON4_TRIPLE_CLICKED: int + # Darwin ncurses doesn't provide BUTTON5_* constants + if sys.version_info >= (3, 10) and sys.platform != "darwin": + BUTTON5_PRESSED: int + BUTTON5_RELEASED: int + BUTTON5_CLICKED: int + BUTTON5_DOUBLE_CLICKED: int + BUTTON5_TRIPLE_CLICKED: int + BUTTON_ALT: int + BUTTON_CTRL: int + BUTTON_SHIFT: int + COLOR_BLACK: int + COLOR_BLUE: int + COLOR_CYAN: int + COLOR_GREEN: int + COLOR_MAGENTA: int + COLOR_RED: int + COLOR_WHITE: int + COLOR_YELLOW: int + ERR: int + KEY_A1: int + KEY_A3: int + KEY_B2: int + KEY_BACKSPACE: int + KEY_BEG: int + KEY_BREAK: int + KEY_BTAB: int + KEY_C1: int + KEY_C3: int + KEY_CANCEL: int + KEY_CATAB: int + KEY_CLEAR: int + KEY_CLOSE: int + KEY_COMMAND: int + KEY_COPY: int + KEY_CREATE: int + KEY_CTAB: int + KEY_DC: int + KEY_DL: int + KEY_DOWN: int + KEY_EIC: int + KEY_END: int + KEY_ENTER: int + KEY_EOL: int + KEY_EOS: int + KEY_EXIT: int + KEY_F0: int + KEY_F1: int + KEY_F10: int + KEY_F11: int + KEY_F12: int + KEY_F13: int + KEY_F14: int + KEY_F15: int + KEY_F16: int + KEY_F17: int + KEY_F18: int + KEY_F19: int + KEY_F2: int + KEY_F20: int + KEY_F21: int + KEY_F22: int + KEY_F23: int + KEY_F24: int + KEY_F25: int + KEY_F26: int + KEY_F27: int + KEY_F28: int + KEY_F29: int + KEY_F3: int + KEY_F30: int + KEY_F31: int + KEY_F32: int + KEY_F33: int + KEY_F34: int + KEY_F35: int + KEY_F36: int + KEY_F37: int + KEY_F38: int + KEY_F39: int + KEY_F4: int + KEY_F40: int + KEY_F41: int + KEY_F42: int + KEY_F43: int + KEY_F44: int + KEY_F45: int + KEY_F46: int + KEY_F47: int + KEY_F48: int + KEY_F49: int + KEY_F5: int + KEY_F50: int + KEY_F51: int + KEY_F52: int + KEY_F53: int + KEY_F54: int + KEY_F55: int + KEY_F56: int + KEY_F57: int + KEY_F58: int + KEY_F59: int + KEY_F6: int + KEY_F60: int + KEY_F61: int + KEY_F62: int + KEY_F63: int + KEY_F7: int + KEY_F8: int + KEY_F9: int + KEY_FIND: int + KEY_HELP: int + KEY_HOME: int + KEY_IC: int + KEY_IL: int + KEY_LEFT: int + KEY_LL: int + KEY_MARK: int + KEY_MAX: int + KEY_MESSAGE: int + KEY_MIN: int + KEY_MOUSE: int + KEY_MOVE: int + KEY_NEXT: int + KEY_NPAGE: int + KEY_OPEN: int + KEY_OPTIONS: int + KEY_PPAGE: int + KEY_PREVIOUS: int + KEY_PRINT: int + KEY_REDO: int + KEY_REFERENCE: int + KEY_REFRESH: int + KEY_REPLACE: int + KEY_RESET: int + KEY_RESIZE: int + KEY_RESTART: int + KEY_RESUME: int + KEY_RIGHT: int + KEY_SAVE: int + KEY_SBEG: int + KEY_SCANCEL: int + KEY_SCOMMAND: int + KEY_SCOPY: int + KEY_SCREATE: int + KEY_SDC: int + KEY_SDL: int + KEY_SELECT: int + KEY_SEND: int + KEY_SEOL: int + KEY_SEXIT: int + KEY_SF: int + KEY_SFIND: int + KEY_SHELP: int + KEY_SHOME: int + KEY_SIC: int + KEY_SLEFT: int + KEY_SMESSAGE: int + KEY_SMOVE: int + KEY_SNEXT: int + KEY_SOPTIONS: int + KEY_SPREVIOUS: int + KEY_SPRINT: int + KEY_SR: int + KEY_SREDO: int + KEY_SREPLACE: int + KEY_SRESET: int + KEY_SRIGHT: int + KEY_SRSUME: int + KEY_SSAVE: int + KEY_SSUSPEND: int + KEY_STAB: int + KEY_SUNDO: int + KEY_SUSPEND: int + KEY_UNDO: int + KEY_UP: int + OK: int + REPORT_MOUSE_POSITION: int + _C_API: Any + version: bytes + def baudrate() -> int: ... + def beep() -> None: ... + def can_change_color() -> bool: ... + def cbreak(__flag: bool = ...) -> None: ... + def color_content(__color_number: int) -> tuple[int, int, int]: ... + # Changed in Python 3.8.8 and 3.9.2 + if sys.version_info >= (3, 8): + def color_pair(pair_number: int) -> int: ... + else: + def color_pair(__color_number: int) -> int: ... -def baudrate() -> int: ... -def beep() -> None: ... -def can_change_color() -> bool: ... -def cbreak(__flag: bool = ...) -> None: ... -def color_content(__color_number: int) -> Tuple[int, int, int]: ... + def curs_set(__visibility: int) -> int: ... + def def_prog_mode() -> None: ... + def def_shell_mode() -> None: ... + def delay_output(__ms: int) -> None: ... + def doupdate() -> None: ... + def echo(__flag: bool = ...) -> None: ... + def endwin() -> None: ... + def erasechar() -> bytes: ... + def filter() -> None: ... + def flash() -> None: ... + def flushinp() -> None: ... + if sys.version_info >= (3, 9): + def get_escdelay() -> int: ... + def get_tabsize() -> int: ... -# Changed in Python 3.8.8 and 3.9.2 -if sys.version_info >= (3, 8): - def color_pair(pair_number: int) -> int: ... + def getmouse() -> tuple[int, int, int, int, int]: ... + def getsyx() -> tuple[int, int]: ... + def getwin(__file: SupportsRead[bytes]) -> _CursesWindow: ... + def halfdelay(__tenths: int) -> None: ... + def has_colors() -> bool: ... + if sys.version_info >= (3, 10): + def has_extended_color_support() -> bool: ... -else: - def color_pair(__color_number: int) -> int: ... + def has_ic() -> bool: ... + def has_il() -> bool: ... + def has_key(__key: int) -> bool: ... + def init_color(__color_number: int, __r: int, __g: int, __b: int) -> None: ... + def init_pair(__pair_number: int, __fg: int, __bg: int) -> None: ... + def initscr() -> _CursesWindow: ... + def intrflush(__flag: bool) -> None: ... + def is_term_resized(__nlines: int, __ncols: int) -> bool: ... + def isendwin() -> bool: ... + def keyname(__key: int) -> bytes: ... + def killchar() -> bytes: ... + def longname() -> bytes: ... + def meta(__yes: bool) -> None: ... + def mouseinterval(__interval: int) -> None: ... + def mousemask(__newmask: int) -> tuple[int, int]: ... + def napms(__ms: int) -> int: ... + def newpad(__nlines: int, __ncols: int) -> _CursesWindow: ... + def newwin(__nlines: int, __ncols: int, __begin_y: int = ..., __begin_x: int = ...) -> _CursesWindow: ... + def nl(__flag: bool = ...) -> None: ... + def nocbreak() -> None: ... + def noecho() -> None: ... + def nonl() -> None: ... + def noqiflush() -> None: ... + def noraw() -> None: ... + def pair_content(__pair_number: int) -> tuple[int, int]: ... + def pair_number(__attr: int) -> int: ... + def putp(__string: ReadOnlyBuffer) -> None: ... + def qiflush(__flag: bool = ...) -> None: ... + def raw(__flag: bool = ...) -> None: ... + def reset_prog_mode() -> None: ... + def reset_shell_mode() -> None: ... + def resetty() -> None: ... + def resize_term(__nlines: int, __ncols: int) -> None: ... + def resizeterm(__nlines: int, __ncols: int) -> None: ... + def savetty() -> None: ... + if sys.version_info >= (3, 9): + def set_escdelay(__ms: int) -> None: ... + def set_tabsize(__size: int) -> None: ... -def curs_set(__visibility: int) -> int: ... -def def_prog_mode() -> None: ... -def def_shell_mode() -> None: ... -def delay_output(__ms: int) -> None: ... -def doupdate() -> None: ... -def echo(__flag: bool = ...) -> None: ... -def endwin() -> None: ... -def erasechar() -> bytes: ... -def filter() -> None: ... -def flash() -> None: ... -def flushinp() -> None: ... -def getmouse() -> Tuple[int, int, int, int, int]: ... -def getsyx() -> Tuple[int, int]: ... -def getwin(__file: BinaryIO) -> _CursesWindow: ... -def halfdelay(__tenths: int) -> None: ... -def has_colors() -> bool: ... + def setsyx(__y: int, __x: int) -> None: ... + def setupterm(term: str | None = ..., fd: int = ...) -> None: ... + def start_color() -> None: ... + def termattrs() -> int: ... + def termname() -> bytes: ... + def tigetflag(__capname: str) -> int: ... + def tigetnum(__capname: str) -> int: ... + def tigetstr(__capname: str) -> bytes | None: ... + def tparm( + __str: ReadOnlyBuffer, + __i1: int = ..., + __i2: int = ..., + __i3: int = ..., + __i4: int = ..., + __i5: int = ..., + __i6: int = ..., + __i7: int = ..., + __i8: int = ..., + __i9: int = ..., + ) -> bytes: ... + def typeahead(__fd: int) -> None: ... + def unctrl(__ch: _ChType) -> bytes: ... + def unget_wch(__ch: int | str) -> None: ... + def ungetch(__ch: _ChType) -> None: ... + def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ... + def update_lines_cols() -> None: ... + def use_default_colors() -> None: ... + def use_env(__flag: bool) -> None: ... -if sys.version_info >= (3, 10): - def has_extended_color_support() -> bool: ... + class error(Exception): ... -def has_ic() -> bool: ... -def has_il() -> bool: ... -def has_key(__key: int) -> bool: ... -def init_color(__color_number: int, __r: int, __g: int, __b: int) -> None: ... -def init_pair(__pair_number: int, __fg: int, __bg: int) -> None: ... -def initscr() -> _CursesWindow: ... -def intrflush(__flag: bool) -> None: ... -def is_term_resized(__nlines: int, __ncols: int) -> bool: ... -def isendwin() -> bool: ... -def keyname(__key: int) -> bytes: ... -def killchar() -> bytes: ... -def longname() -> bytes: ... -def meta(__yes: bool) -> None: ... -def mouseinterval(__interval: int) -> None: ... -def mousemask(__newmask: int) -> Tuple[int, int]: ... -def napms(__ms: int) -> int: ... -def newpad(__nlines: int, __ncols: int) -> _CursesWindow: ... -def newwin(__nlines: int, __ncols: int, __begin_y: int = ..., __begin_x: int = ...) -> _CursesWindow: ... -def nl(__flag: bool = ...) -> None: ... -def nocbreak() -> None: ... -def noecho() -> None: ... -def nonl() -> None: ... -def noqiflush() -> None: ... -def noraw() -> None: ... -def pair_content(__pair_number: int) -> Tuple[int, int]: ... -def pair_number(__attr: int) -> int: ... -def putp(__string: bytes) -> None: ... -def qiflush(__flag: bool = ...) -> None: ... -def raw(__flag: bool = ...) -> None: ... -def reset_prog_mode() -> None: ... -def reset_shell_mode() -> None: ... -def resetty() -> None: ... -def resize_term(__nlines: int, __ncols: int) -> None: ... -def resizeterm(__nlines: int, __ncols: int) -> None: ... -def savetty() -> None: ... -def setsyx(__y: int, __x: int) -> None: ... -def setupterm(term: str | None = ..., fd: int = ...) -> None: ... -def start_color() -> None: ... -def termattrs() -> int: ... -def termname() -> bytes: ... -def tigetflag(__capname: str) -> int: ... -def tigetnum(__capname: str) -> int: ... -def tigetstr(__capname: str) -> bytes: ... -def tparm( - __str: bytes, - __i1: int = ..., - __i2: int = ..., - __i3: int = ..., - __i4: int = ..., - __i5: int = ..., - __i6: int = ..., - __i7: int = ..., - __i8: int = ..., - __i9: int = ..., -) -> bytes: ... -def typeahead(__fd: int) -> None: ... -def unctrl(__ch: _chtype) -> bytes: ... -def unget_wch(__ch: int | str) -> None: ... -def ungetch(__ch: _chtype) -> None: ... -def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ... -def update_lines_cols() -> int: ... -def use_default_colors() -> None: ... -def use_env(__flag: bool) -> None: ... - -class error(Exception): ... - -class _CursesWindow: - encoding: str - @overload - def addch(self, ch: _chtype, attr: int = ...) -> None: ... - @overload - def addch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ... - @overload - def addnstr(self, str: str, n: int, attr: int = ...) -> None: ... - @overload - def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... - @overload - def addstr(self, str: str, attr: int = ...) -> None: ... - @overload - def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... - def attroff(self, __attr: int) -> None: ... - def attron(self, __attr: int) -> None: ... - def attrset(self, __attr: int) -> None: ... - def bkgd(self, __ch: _chtype, __attr: int = ...) -> None: ... - def bkgdset(self, __ch: _chtype, __attr: int = ...) -> None: ... - def border( - self, - ls: _chtype = ..., - rs: _chtype = ..., - ts: _chtype = ..., - bs: _chtype = ..., - tl: _chtype = ..., - tr: _chtype = ..., - bl: _chtype = ..., - br: _chtype = ..., - ) -> None: ... - @overload - def box(self) -> None: ... - @overload - def box(self, vertch: _chtype = ..., horch: _chtype = ...) -> None: ... - @overload - def chgat(self, attr: int) -> None: ... - @overload - def chgat(self, num: int, attr: int) -> None: ... - @overload - def chgat(self, y: int, x: int, attr: int) -> None: ... - @overload - def chgat(self, y: int, x: int, num: int, attr: int) -> None: ... - def clear(self) -> None: ... - def clearok(self, yes: int) -> None: ... - def clrtobot(self) -> None: ... - def clrtoeol(self) -> None: ... - def cursyncup(self) -> None: ... - @overload - def delch(self) -> None: ... - @overload - def delch(self, y: int, x: int) -> None: ... - def deleteln(self) -> None: ... - @overload - def derwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... - def echochar(self, __ch: _chtype, __attr: int = ...) -> None: ... - def enclose(self, __y: int, __x: int) -> bool: ... - def erase(self) -> None: ... - def getbegyx(self) -> Tuple[int, int]: ... - def getbkgd(self) -> Tuple[int, int]: ... - @overload - def getch(self) -> int: ... - @overload - def getch(self, y: int, x: int) -> int: ... - @overload - def get_wch(self) -> int | str: ... - @overload - def get_wch(self, y: int, x: int) -> int | str: ... - @overload - def getkey(self) -> str: ... - @overload - def getkey(self, y: int, x: int) -> str: ... - def getmaxyx(self) -> Tuple[int, int]: ... - def getparyx(self) -> Tuple[int, int]: ... - @overload - def getstr(self) -> _chtype: ... - @overload - def getstr(self, n: int) -> _chtype: ... - @overload - def getstr(self, y: int, x: int) -> _chtype: ... - @overload - def getstr(self, y: int, x: int, n: int) -> _chtype: ... - def getyx(self) -> Tuple[int, int]: ... - @overload - def hline(self, ch: _chtype, n: int) -> None: ... - @overload - def hline(self, y: int, x: int, ch: _chtype, n: int) -> None: ... - def idcok(self, flag: bool) -> None: ... - def idlok(self, yes: bool) -> None: ... - def immedok(self, flag: bool) -> None: ... - @overload - def inch(self) -> _chtype: ... - @overload - def inch(self, y: int, x: int) -> _chtype: ... - @overload - def insch(self, ch: _chtype, attr: int = ...) -> None: ... - @overload - def insch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ... - def insdelln(self, nlines: int) -> None: ... - def insertln(self) -> None: ... - @overload - def insnstr(self, str: str, n: int, attr: int = ...) -> None: ... - @overload - def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... - @overload - def insstr(self, str: str, attr: int = ...) -> None: ... - @overload - def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... - @overload - def instr(self, n: int = ...) -> _chtype: ... - @overload - def instr(self, y: int, x: int, n: int = ...) -> _chtype: ... - def is_linetouched(self, __line: int) -> bool: ... - def is_wintouched(self) -> bool: ... - def keypad(self, yes: bool) -> None: ... - def leaveok(self, yes: bool) -> None: ... - def move(self, new_y: int, new_x: int) -> None: ... - def mvderwin(self, y: int, x: int) -> None: ... - def mvwin(self, new_y: int, new_x: int) -> None: ... - def nodelay(self, yes: bool) -> None: ... - def notimeout(self, yes: bool) -> None: ... - @overload - def noutrefresh(self) -> None: ... - @overload - def noutrefresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... - @overload - def overlay(self, destwin: _CursesWindow) -> None: ... - @overload - def overlay( - self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int - ) -> None: ... - @overload - def overwrite(self, destwin: _CursesWindow) -> None: ... - @overload - def overwrite( - self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int - ) -> None: ... - def putwin(self, __file: IO[Any]) -> None: ... - def redrawln(self, __beg: int, __num: int) -> None: ... - def redrawwin(self) -> None: ... - @overload - def refresh(self) -> None: ... - @overload - def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... - def resize(self, nlines: int, ncols: int) -> None: ... - def scroll(self, lines: int = ...) -> None: ... - def scrollok(self, flag: bool) -> None: ... - def setscrreg(self, __top: int, __bottom: int) -> None: ... - def standend(self) -> None: ... - def standout(self) -> None: ... - @overload - def subpad(self, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def subwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ... - @overload - def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... - def syncdown(self) -> None: ... - def syncok(self, flag: bool) -> None: ... - def syncup(self) -> None: ... - def timeout(self, delay: int) -> None: ... - def touchline(self, start: int, count: int, changed: bool = ...) -> None: ... - def touchwin(self) -> None: ... - def untouchwin(self) -> None: ... - @overload - def vline(self, ch: _chtype, n: int) -> None: ... - @overload - def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ... - -if sys.version_info >= (3, 8): - class _ncurses_version(NamedTuple): - major: int - minor: int - patch: int - ncurses_version: _ncurses_version - window = _CursesWindow # undocumented + @final + class _CursesWindow: + encoding: str + @overload + def addch(self, ch: _ChType, attr: int = ...) -> None: ... + @overload + def addch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ... + @overload + def addnstr(self, str: str, n: int, attr: int = ...) -> None: ... + @overload + def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... + @overload + def addstr(self, str: str, attr: int = ...) -> None: ... + @overload + def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... + def attroff(self, __attr: int) -> None: ... + def attron(self, __attr: int) -> None: ... + def attrset(self, __attr: int) -> None: ... + def bkgd(self, __ch: _ChType, __attr: int = ...) -> None: ... + def bkgdset(self, __ch: _ChType, __attr: int = ...) -> None: ... + def border( + self, + ls: _ChType = ..., + rs: _ChType = ..., + ts: _ChType = ..., + bs: _ChType = ..., + tl: _ChType = ..., + tr: _ChType = ..., + bl: _ChType = ..., + br: _ChType = ..., + ) -> None: ... + @overload + def box(self) -> None: ... + @overload + def box(self, vertch: _ChType = ..., horch: _ChType = ...) -> None: ... + @overload + def chgat(self, attr: int) -> None: ... + @overload + def chgat(self, num: int, attr: int) -> None: ... + @overload + def chgat(self, y: int, x: int, attr: int) -> None: ... + @overload + def chgat(self, y: int, x: int, num: int, attr: int) -> None: ... + def clear(self) -> None: ... + def clearok(self, yes: int) -> None: ... + def clrtobot(self) -> None: ... + def clrtoeol(self) -> None: ... + def cursyncup(self) -> None: ... + @overload + def delch(self) -> None: ... + @overload + def delch(self, y: int, x: int) -> None: ... + def deleteln(self) -> None: ... + @overload + def derwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ... + @overload + def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... + def echochar(self, __ch: _ChType, __attr: int = ...) -> None: ... + def enclose(self, __y: int, __x: int) -> bool: ... + def erase(self) -> None: ... + def getbegyx(self) -> tuple[int, int]: ... + def getbkgd(self) -> tuple[int, int]: ... + @overload + def getch(self) -> int: ... + @overload + def getch(self, y: int, x: int) -> int: ... + @overload + def get_wch(self) -> int | str: ... + @overload + def get_wch(self, y: int, x: int) -> int | str: ... + @overload + def getkey(self) -> str: ... + @overload + def getkey(self, y: int, x: int) -> str: ... + def getmaxyx(self) -> tuple[int, int]: ... + def getparyx(self) -> tuple[int, int]: ... + @overload + def getstr(self) -> bytes: ... + @overload + def getstr(self, n: int) -> bytes: ... + @overload + def getstr(self, y: int, x: int) -> bytes: ... + @overload + def getstr(self, y: int, x: int, n: int) -> bytes: ... + def getyx(self) -> tuple[int, int]: ... + @overload + def hline(self, ch: _ChType, n: int) -> None: ... + @overload + def hline(self, y: int, x: int, ch: _ChType, n: int) -> None: ... + def idcok(self, flag: bool) -> None: ... + def idlok(self, yes: bool) -> None: ... + def immedok(self, flag: bool) -> None: ... + @overload + def inch(self) -> int: ... + @overload + def inch(self, y: int, x: int) -> int: ... + @overload + def insch(self, ch: _ChType, attr: int = ...) -> None: ... + @overload + def insch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ... + def insdelln(self, nlines: int) -> None: ... + def insertln(self) -> None: ... + @overload + def insnstr(self, str: str, n: int, attr: int = ...) -> None: ... + @overload + def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ... + @overload + def insstr(self, str: str, attr: int = ...) -> None: ... + @overload + def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ... + @overload + def instr(self, n: int = ...) -> bytes: ... + @overload + def instr(self, y: int, x: int, n: int = ...) -> bytes: ... + def is_linetouched(self, __line: int) -> bool: ... + def is_wintouched(self) -> bool: ... + def keypad(self, yes: bool) -> None: ... + def leaveok(self, yes: bool) -> None: ... + def move(self, new_y: int, new_x: int) -> None: ... + def mvderwin(self, y: int, x: int) -> None: ... + def mvwin(self, new_y: int, new_x: int) -> None: ... + def nodelay(self, yes: bool) -> None: ... + def notimeout(self, yes: bool) -> None: ... + @overload + def noutrefresh(self) -> None: ... + @overload + def noutrefresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... + @overload + def overlay(self, destwin: _CursesWindow) -> None: ... + @overload + def overlay( + self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int + ) -> None: ... + @overload + def overwrite(self, destwin: _CursesWindow) -> None: ... + @overload + def overwrite( + self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int + ) -> None: ... + def putwin(self, __file: IO[Any]) -> None: ... + def redrawln(self, __beg: int, __num: int) -> None: ... + def redrawwin(self) -> None: ... + @overload + def refresh(self) -> None: ... + @overload + def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ... + def resize(self, nlines: int, ncols: int) -> None: ... + def scroll(self, lines: int = ...) -> None: ... + def scrollok(self, flag: bool) -> None: ... + def setscrreg(self, __top: int, __bottom: int) -> None: ... + def standend(self) -> None: ... + def standout(self) -> None: ... + @overload + def subpad(self, begin_y: int, begin_x: int) -> _CursesWindow: ... + @overload + def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... + @overload + def subwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ... + @overload + def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ... + def syncdown(self) -> None: ... + def syncok(self, flag: bool) -> None: ... + def syncup(self) -> None: ... + def timeout(self, delay: int) -> None: ... + def touchline(self, start: int, count: int, changed: bool = ...) -> None: ... + def touchwin(self) -> None: ... + def untouchwin(self) -> None: ... + @overload + def vline(self, ch: _ChType, n: int) -> None: ... + @overload + def vline(self, y: int, x: int, ch: _ChType, n: int) -> None: ... + if sys.version_info >= (3, 8): + class _ncurses_version(NamedTuple): + major: int + minor: int + patch: int + ncurses_version: _ncurses_version + window = _CursesWindow # undocumented diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index e588058..50c0f23 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -1 +1,281 @@ -from decimal import * +import numbers +import sys +from _typeshed import Self +from collections.abc import Container, Sequence +from types import TracebackType +from typing import Any, ClassVar, NamedTuple, Union, overload +from typing_extensions import TypeAlias + +_Decimal: TypeAlias = Decimal | int +_DecimalNew: TypeAlias = Union[Decimal, float, str, tuple[int, Sequence[int], int]] +_ComparableNum: TypeAlias = Decimal | float | numbers.Rational + +__version__: str +__libmpdec_version__: str + +class DecimalTuple(NamedTuple): + sign: int + digits: tuple[int, ...] + exponent: int + +ROUND_DOWN: str +ROUND_HALF_UP: str +ROUND_HALF_EVEN: str +ROUND_CEILING: str +ROUND_FLOOR: str +ROUND_UP: str +ROUND_HALF_DOWN: str +ROUND_05UP: str +HAVE_CONTEXTVAR: bool +HAVE_THREADS: bool +MAX_EMAX: int +MAX_PREC: int +MIN_EMIN: int +MIN_ETINY: int + +class DecimalException(ArithmeticError): ... +class Clamped(DecimalException): ... +class InvalidOperation(DecimalException): ... +class ConversionSyntax(InvalidOperation): ... +class DivisionByZero(DecimalException, ZeroDivisionError): ... +class DivisionImpossible(InvalidOperation): ... +class DivisionUndefined(InvalidOperation, ZeroDivisionError): ... +class Inexact(DecimalException): ... +class InvalidContext(InvalidOperation): ... +class Rounded(DecimalException): ... +class Subnormal(DecimalException): ... +class Overflow(Inexact, Rounded): ... +class Underflow(Inexact, Rounded, Subnormal): ... +class FloatOperation(DecimalException, TypeError): ... + +def setcontext(__context: Context) -> None: ... +def getcontext() -> Context: ... + +if sys.version_info >= (3, 11): + def localcontext( + ctx: Context | None = ..., + *, + prec: int | None = ..., + rounding: str | None = ..., + Emin: int | None = ..., + Emax: int | None = ..., + capitals: int | None = ..., + clamp: int | None = ..., + traps: dict[_TrapType, bool] | None = ..., + flags: dict[_TrapType, bool] | None = ..., + ) -> _ContextManager: ... + +else: + def localcontext(ctx: Context | None = ...) -> _ContextManager: ... + +class Decimal: + def __new__(cls: type[Self], value: _DecimalNew = ..., context: Context | None = ...) -> Self: ... + @classmethod + def from_float(cls: type[Self], __f: float) -> Self: ... + def __bool__(self) -> bool: ... + def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def as_tuple(self) -> DecimalTuple: ... + def as_integer_ratio(self) -> tuple[int, int]: ... + def to_eng_string(self, context: Context | None = ...) -> str: ... + def __abs__(self) -> Decimal: ... + def __add__(self, __other: _Decimal) -> Decimal: ... + def __divmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... + def __eq__(self, __other: object) -> bool: ... + def __floordiv__(self, __other: _Decimal) -> Decimal: ... + def __ge__(self, __other: _ComparableNum) -> bool: ... + def __gt__(self, __other: _ComparableNum) -> bool: ... + def __le__(self, __other: _ComparableNum) -> bool: ... + def __lt__(self, __other: _ComparableNum) -> bool: ... + def __mod__(self, __other: _Decimal) -> Decimal: ... + def __mul__(self, __other: _Decimal) -> Decimal: ... + def __neg__(self) -> Decimal: ... + def __pos__(self) -> Decimal: ... + def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ... + def __radd__(self, __other: _Decimal) -> Decimal: ... + def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... + def __rfloordiv__(self, __other: _Decimal) -> Decimal: ... + def __rmod__(self, __other: _Decimal) -> Decimal: ... + def __rmul__(self, __other: _Decimal) -> Decimal: ... + def __rsub__(self, __other: _Decimal) -> Decimal: ... + def __rtruediv__(self, __other: _Decimal) -> Decimal: ... + def __sub__(self, __other: _Decimal) -> Decimal: ... + def __truediv__(self, __other: _Decimal) -> Decimal: ... + def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def __float__(self) -> float: ... + def __int__(self) -> int: ... + def __trunc__(self) -> int: ... + @property + def real(self) -> Decimal: ... + @property + def imag(self) -> Decimal: ... + def conjugate(self) -> Decimal: ... + def __complex__(self) -> complex: ... + @overload + def __round__(self) -> int: ... + @overload + def __round__(self, __ndigits: int) -> Decimal: ... + def __floor__(self) -> int: ... + def __ceil__(self) -> int: ... + def fma(self, other: _Decimal, third: _Decimal, context: Context | None = ...) -> Decimal: ... + def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... + def normalize(self, context: Context | None = ...) -> Decimal: ... + def quantize(self, exp: _Decimal, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... + def same_quantum(self, other: _Decimal, context: Context | None = ...) -> bool: ... + def to_integral_exact(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... + def to_integral_value(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... + def to_integral(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... + def sqrt(self, context: Context | None = ...) -> Decimal: ... + def max(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def min(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def adjusted(self) -> int: ... + def canonical(self) -> Decimal: ... + def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def compare_total(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def compare_total_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def copy_abs(self) -> Decimal: ... + def copy_negate(self) -> Decimal: ... + def copy_sign(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def exp(self, context: Context | None = ...) -> Decimal: ... + def is_canonical(self) -> bool: ... + def is_finite(self) -> bool: ... + def is_infinite(self) -> bool: ... + def is_nan(self) -> bool: ... + def is_normal(self, context: Context | None = ...) -> bool: ... + def is_qnan(self) -> bool: ... + def is_signed(self) -> bool: ... + def is_snan(self) -> bool: ... + def is_subnormal(self, context: Context | None = ...) -> bool: ... + def is_zero(self) -> bool: ... + def ln(self, context: Context | None = ...) -> Decimal: ... + def log10(self, context: Context | None = ...) -> Decimal: ... + def logb(self, context: Context | None = ...) -> Decimal: ... + def logical_and(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def logical_invert(self, context: Context | None = ...) -> Decimal: ... + def logical_or(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def logical_xor(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def max_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def min_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def next_minus(self, context: Context | None = ...) -> Decimal: ... + def next_plus(self, context: Context | None = ...) -> Decimal: ... + def next_toward(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def number_class(self, context: Context | None = ...) -> str: ... + def radix(self) -> Decimal: ... + def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def __reduce__(self: Self) -> tuple[type[Self], tuple[str]]: ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self, __memo: Any) -> Self: ... + def __format__(self, __specifier: str, __context: Context | None = ...) -> str: ... + +class _ContextManager: + new_context: Context + saved_context: Context + def __init__(self, new_context: Context) -> None: ... + def __enter__(self) -> Context: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + +_TrapType: TypeAlias = type[DecimalException] + +class Context: + # TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime, + # even settable attributes like `prec` and `rounding`, + # but that's inexpressable in the stub. + # Type checkers either ignore it or misinterpret it + # if you add a `def __delattr__(self, __name: str) -> NoReturn` method to the stub + prec: int + rounding: str + Emin: int + Emax: int + capitals: int + clamp: int + traps: dict[_TrapType, bool] + flags: dict[_TrapType, bool] + def __init__( + self, + prec: int | None = ..., + rounding: str | None = ..., + Emin: int | None = ..., + Emax: int | None = ..., + capitals: int | None = ..., + clamp: int | None = ..., + flags: None | dict[_TrapType, bool] | Container[_TrapType] = ..., + traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., + _ignored_flags: list[_TrapType] | None = ..., + ) -> None: ... + def __reduce__(self: Self) -> tuple[type[Self], tuple[Any, ...]]: ... + def clear_flags(self) -> None: ... + def clear_traps(self) -> None: ... + def copy(self) -> Context: ... + def __copy__(self) -> Context: ... + # see https://github.com/python/cpython/issues/94107 + __hash__: ClassVar[None] # type: ignore[assignment] + def Etiny(self) -> int: ... + def Etop(self) -> int: ... + def create_decimal(self, __num: _DecimalNew = ...) -> Decimal: ... + def create_decimal_from_float(self, __f: float) -> Decimal: ... + def abs(self, __x: _Decimal) -> Decimal: ... + def add(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def canonical(self, __x: Decimal) -> Decimal: ... + def compare(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def compare_signal(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def compare_total(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def compare_total_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def copy_abs(self, __x: _Decimal) -> Decimal: ... + def copy_decimal(self, __x: _Decimal) -> Decimal: ... + def copy_negate(self, __x: _Decimal) -> Decimal: ... + def copy_sign(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def divide(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def divide_int(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def divmod(self, __x: _Decimal, __y: _Decimal) -> tuple[Decimal, Decimal]: ... + def exp(self, __x: _Decimal) -> Decimal: ... + def fma(self, __x: _Decimal, __y: _Decimal, __z: _Decimal) -> Decimal: ... + def is_canonical(self, __x: _Decimal) -> bool: ... + def is_finite(self, __x: _Decimal) -> bool: ... + def is_infinite(self, __x: _Decimal) -> bool: ... + def is_nan(self, __x: _Decimal) -> bool: ... + def is_normal(self, __x: _Decimal) -> bool: ... + def is_qnan(self, __x: _Decimal) -> bool: ... + def is_signed(self, __x: _Decimal) -> bool: ... + def is_snan(self, __x: _Decimal) -> bool: ... + def is_subnormal(self, __x: _Decimal) -> bool: ... + def is_zero(self, __x: _Decimal) -> bool: ... + def ln(self, __x: _Decimal) -> Decimal: ... + def log10(self, __x: _Decimal) -> Decimal: ... + def logb(self, __x: _Decimal) -> Decimal: ... + def logical_and(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def logical_invert(self, __x: _Decimal) -> Decimal: ... + def logical_or(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def logical_xor(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def max(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def max_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def min(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def min_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def minus(self, __x: _Decimal) -> Decimal: ... + def multiply(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def next_minus(self, __x: _Decimal) -> Decimal: ... + def next_plus(self, __x: _Decimal) -> Decimal: ... + def next_toward(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def normalize(self, __x: _Decimal) -> Decimal: ... + def number_class(self, __x: _Decimal) -> str: ... + def plus(self, __x: _Decimal) -> Decimal: ... + def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ... + def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def radix(self) -> Decimal: ... + def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def remainder_near(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def rotate(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def same_quantum(self, __x: _Decimal, __y: _Decimal) -> bool: ... + def scaleb(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def shift(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def sqrt(self, __x: _Decimal) -> Decimal: ... + def subtract(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... + def to_eng_string(self, __x: _Decimal) -> str: ... + def to_sci_string(self, __x: _Decimal) -> str: ... + def to_integral_exact(self, __x: _Decimal) -> Decimal: ... + def to_integral_value(self, __x: _Decimal) -> Decimal: ... + def to_integral(self, __x: _Decimal) -> Decimal: ... + +DefaultContext: Context +BasicContext: Context +ExtendedContext: Context diff --git a/stdlib/_dummy_thread.pyi b/stdlib/_dummy_thread.pyi index 886d9d7..ff16b1d 100644 --- a/stdlib/_dummy_thread.pyi +++ b/stdlib/_dummy_thread.pyi @@ -1,21 +1,27 @@ -from typing import Any, Callable, NoReturn, Tuple +from collections.abc import Callable +from types import TracebackType +from typing import Any, NoReturn + +__all__ = ["error", "start_new_thread", "exit", "get_ident", "allocate_lock", "interrupt_main", "LockType", "RLock"] TIMEOUT_MAX: int error = RuntimeError -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: dict[str, Any] = ...) -> None: ... +def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any] = ...) -> None: ... def exit() -> NoReturn: ... def get_ident() -> int: ... def allocate_lock() -> LockType: ... def stack_size(size: int | None = ...) -> int: ... -class LockType(object): +class LockType: locked_status: bool - def __init__(self) -> None: ... def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... def __enter__(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... - def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ... + def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... def release(self) -> bool: ... def locked(self) -> bool: ... +class RLock(LockType): + def release(self) -> None: ... # type: ignore[override] + def interrupt_main() -> None: ... diff --git a/stdlib/_dummy_threading.pyi b/stdlib/_dummy_threading.pyi index 64998d8..8f7f5a9 100644 --- a/stdlib/_dummy_threading.pyi +++ b/stdlib/_dummy_threading.pyi @@ -1,14 +1,37 @@ import sys -from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, Mapping, Optional, Type, TypeVar +from _typeshed import ProfileFunction, TraceFunction +from collections.abc import Callable, Iterable, Mapping +from types import TracebackType +from typing import Any, TypeVar -# TODO recursive type -_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] - -_PF = Callable[[FrameType, str, Any], None] _T = TypeVar("_T") -__all__: list[str] +__all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", +] + +if sys.version_info >= (3, 8): + __all__ += ["ExceptHookArgs", "excepthook"] def active_count() -> int: ... def current_thread() -> Thread: ... @@ -16,31 +39,28 @@ def currentThread() -> Thread: ... def get_ident() -> int: ... def enumerate() -> list[Thread]: ... def main_thread() -> Thread: ... - -if sys.version_info >= (3, 8): - from _thread import get_native_id as get_native_id - -def settrace(func: _TF) -> None: ... -def setprofile(func: _PF | None) -> None: ... +def settrace(func: TraceFunction) -> None: ... +def setprofile(func: ProfileFunction | None) -> None: ... def stack_size(size: int = ...) -> int: ... TIMEOUT_MAX: float class ThreadError(Exception): ... -class local(object): +class local: def __getattribute__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... def __delattr__(self, name: str) -> None: ... class Thread: name: str - ident: int | None daemon: bool + @property + def ident(self) -> int | None: ... def __init__( self, group: None = ..., - target: Callable[..., Any] | None = ..., + target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., kwargs: Mapping[str, Any] | None = ..., @@ -55,29 +75,29 @@ class Thread: if sys.version_info >= (3, 8): @property def native_id(self) -> int | None: ... # only available on some platforms + def is_alive(self) -> bool: ... if sys.version_info < (3, 9): def isAlive(self) -> bool: ... + def isDaemon(self) -> bool: ... def setDaemon(self, daemonic: bool) -> None: ... class _DummyThread(Thread): ... class Lock: - def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... def locked(self) -> bool: ... class _RLock: - def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... @@ -88,7 +108,7 @@ class Condition: def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... @@ -101,7 +121,7 @@ class Condition: class Semaphore: def __init__(self, value: int = ...) -> None: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ... def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ... @@ -113,7 +133,6 @@ class Semaphore: class BoundedSemaphore(Semaphore): ... class Event: - def __init__(self) -> None: ... def is_set(self) -> bool: ... def set(self) -> None: ... def clear(self) -> None: ... @@ -129,16 +148,19 @@ class Timer(Thread): def __init__( self, interval: float, - function: Callable[..., Any], + function: Callable[..., object], args: Iterable[Any] | None = ..., kwargs: Mapping[str, Any] | None = ..., ) -> None: ... def cancel(self) -> None: ... class Barrier: - parties: int - n_waiting: int - broken: bool + @property + def parties(self) -> int: ... + @property + def n_waiting(self) -> int: ... + @property + def broken(self) -> bool: ... def __init__(self, parties: int, action: Callable[[], None] | None = ..., timeout: float | None = ...) -> None: ... def wait(self, timeout: float | None = ...) -> int: ... def reset(self) -> None: ... diff --git a/stdlib/_heapq.pyi b/stdlib/_heapq.pyi index 87e0fe0..90dc28d 100644 --- a/stdlib/_heapq.pyi +++ b/stdlib/_heapq.pyi @@ -2,6 +2,8 @@ from typing import Any, TypeVar _T = TypeVar("_T") +__about__: str + def heapify(__heap: list[Any]) -> None: ... def heappop(__heap: list[_T]) -> _T: ... def heappush(__heap: list[_T], __item: _T) -> None: ... diff --git a/stdlib/_imp.pyi b/stdlib/_imp.pyi index b61c9f2..2b54a0f 100644 --- a/stdlib/_imp.pyi +++ b/stdlib/_imp.pyi @@ -1,17 +1,28 @@ +import sys import types +from _typeshed import ReadableBuffer from importlib.machinery import ModuleSpec from typing import Any +check_hash_based_pycs: str + +def source_hash(key: int, source: ReadableBuffer) -> bytes: ... def create_builtin(__spec: ModuleSpec) -> types.ModuleType: ... -def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> None: ... +def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> types.ModuleType: ... def acquire_lock() -> None: ... def exec_builtin(__mod: types.ModuleType) -> int: ... def exec_dynamic(__mod: types.ModuleType) -> int: ... def extension_suffixes() -> list[str]: ... -def get_frozen_object(__name: str) -> types.CodeType: ... def init_frozen(__name: str) -> types.ModuleType: ... def is_builtin(__name: str) -> int: ... def is_frozen(__name: str) -> bool: ... def is_frozen_package(__name: str) -> bool: ... def lock_held() -> bool: ... def release_lock() -> None: ... + +if sys.version_info >= (3, 11): + def find_frozen(__name: str, *, withdata: bool = ...) -> tuple[memoryview | None, bool, str | None] | None: ... + def get_frozen_object(__name: str, __data: ReadableBuffer | None = ...) -> types.CodeType: ... + +else: + def get_frozen_object(__name: str) -> types.CodeType: ... diff --git a/stdlib/_json.pyi b/stdlib/_json.pyi index f807a85..130f7ab 100644 --- a/stdlib/_json.pyi +++ b/stdlib/_json.pyi @@ -1,14 +1,25 @@ -from typing import Any, Callable, Tuple +from collections.abc import Callable +from typing import Any +from typing_extensions import final +@final class make_encoder: - sort_keys: Any - skipkeys: Any - key_separator: Any - indent: Any - markers: Any - default: Any - encoder: Any - item_separator: Any + @property + def sort_keys(self) -> bool: ... + @property + def skipkeys(self) -> bool: ... + @property + def key_separator(self) -> str: ... + @property + def indent(self) -> int | None: ... + @property + def markers(self) -> dict[int, Any] | None: ... + @property + def default(self) -> Callable[[Any], Any]: ... + @property + def encoder(self) -> Callable[[str], str]: ... + @property + def item_separator(self) -> str: ... def __init__( self, markers: dict[int, Any] | None, @@ -23,6 +34,7 @@ class make_encoder: ) -> None: ... def __call__(self, obj: object, _current_indent_level: int) -> Any: ... +@final class make_scanner: object_hook: Any object_pairs_hook: Any @@ -32,7 +44,7 @@ class make_scanner: strict: bool # TODO: 'context' needs the attrs above (ducktype), but not __call__. def __init__(self, context: make_scanner) -> None: ... - def __call__(self, string: str, index: int) -> Tuple[Any, int]: ... + def __call__(self, string: str, index: int) -> tuple[Any, int]: ... def encode_basestring_ascii(s: str) -> str: ... -def scanstring(string: str, end: int, strict: bool = ...) -> Tuple[str, int]: ... +def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]: ... diff --git a/stdlib/_markupbase.pyi b/stdlib/_markupbase.pyi index d8bc79f..7d2a39a 100644 --- a/stdlib/_markupbase.pyi +++ b/stdlib/_markupbase.pyi @@ -1,8 +1,16 @@ -from typing import Tuple +import sys +from typing import Any class ParserBase: - def __init__(self) -> None: ... - def error(self, message: str) -> None: ... def reset(self) -> None: ... - def getpos(self) -> Tuple[int, int]: ... + def getpos(self) -> tuple[int, int]: ... def unknown_decl(self, data: str) -> None: ... + def parse_comment(self, i: int, report: int = ...) -> int: ... # undocumented + def parse_declaration(self, i: int) -> int: ... # undocumented + def parse_marked_section(self, i: int, report: int = ...) -> int: ... # undocumented + def updatepos(self, i: int, j: int) -> int: ... # undocumented + if sys.version_info < (3, 10): + # Removed from ParserBase: https://bugs.python.org/issue31844 + def error(self, message: str) -> Any: ... # undocumented + lineno: int # undocumented + offset: int # undocumented diff --git a/stdlib/_msi.pyi b/stdlib/_msi.pyi index 754febe..1b86904 100644 --- a/stdlib/_msi.pyi +++ b/stdlib/_msi.pyi @@ -10,26 +10,26 @@ if sys.platform == "win32": def Modify(self, mode: int, record: _Record) -> None: ... def Close(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - # Actual typename Summary, not exposed by the implementation - class _Summary: - def GetProperty(self, propid: int) -> str | bytes | None: ... + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] + # Actual typename SummaryInformation, not exposed by the implementation + class _SummaryInformation: + def GetProperty(self, field: int) -> int | bytes | None: ... def GetPropertyCount(self) -> int: ... - def SetProperty(self, propid: int, value: str | bytes) -> None: ... + def SetProperty(self, field: int, value: int | str) -> None: ... def Persist(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] # Actual typename Database, not exposed by the implementation class _Database: def OpenView(self, sql: str) -> _View: ... def Commit(self) -> None: ... - def GetSummaryInformation(self, updateCount: int) -> _Summary: ... + def GetSummaryInformation(self, updateCount: int) -> _SummaryInformation: ... def Close(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] # Actual typename Record, not exposed by the implementation class _Record: def GetFieldCount(self) -> int: ... @@ -40,9 +40,49 @@ if sys.platform == "win32": def SetInteger(self, field: int, int: int) -> None: ... def ClearData(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] def UuidCreate() -> str: ... - def FCICreate(cabname: str, files: list[str]) -> None: ... - def OpenDatabase(name: str, flags: int) -> _Database: ... - def CreateRecord(count: int) -> _Record: ... + def FCICreate(__cabname: str, __files: list[str]) -> None: ... + def OpenDatabase(__path: str, __persist: int) -> _Database: ... + def CreateRecord(__count: int) -> _Record: ... + + MSICOLINFO_NAMES: int + MSICOLINFO_TYPES: int + MSIDBOPEN_CREATE: int + MSIDBOPEN_CREATEDIRECT: int + MSIDBOPEN_DIRECT: int + MSIDBOPEN_PATCHFILE: int + MSIDBOPEN_READONLY: int + MSIDBOPEN_TRANSACT: int + MSIMODIFY_ASSIGN: int + MSIMODIFY_DELETE: int + MSIMODIFY_INSERT: int + MSIMODIFY_INSERT_TEMPORARY: int + MSIMODIFY_MERGE: int + MSIMODIFY_REFRESH: int + MSIMODIFY_REPLACE: int + MSIMODIFY_SEEK: int + MSIMODIFY_UPDATE: int + MSIMODIFY_VALIDATE: int + MSIMODIFY_VALIDATE_DELETE: int + MSIMODIFY_VALIDATE_FIELD: int + MSIMODIFY_VALIDATE_NEW: int + + PID_APPNAME: int + PID_AUTHOR: int + PID_CHARCOUNT: int + PID_CODEPAGE: int + PID_COMMENTS: int + PID_CREATE_DTM: int + PID_KEYWORDS: int + PID_LASTAUTHOR: int + PID_LASTPRINTED: int + PID_LASTSAVE_DTM: int + PID_PAGECOUNT: int + PID_REVNUMBER: int + PID_SECURITY: int + PID_SUBJECT: int + PID_TEMPLATE: int + PID_TITLE: int + PID_WORDCOUNT: int diff --git a/stdlib/_operator.pyi b/stdlib/_operator.pyi index bea4388..92e04d0 100644 --- a/stdlib/_operator.pyi +++ b/stdlib/_operator.pyi @@ -1,60 +1,144 @@ -# In reality the import is the other way around, but this way we can keep the operator stub in 2and3 -from operator import ( - abs as abs, - add as add, - and_ as and_, - attrgetter as attrgetter, - concat as concat, - contains as contains, - countOf as countOf, - delitem as delitem, - eq as eq, - floordiv as floordiv, - ge as ge, - getitem as getitem, - gt as gt, - iadd as iadd, - iand as iand, - iconcat as iconcat, - ifloordiv as ifloordiv, - ilshift as ilshift, - imatmul as imatmul, - imod as imod, - imul as imul, - index as index, - indexOf as indexOf, - inv as inv, - invert as invert, - ior as ior, - ipow as ipow, - irshift as irshift, - is_ as is_, - is_not as is_not, - isub as isub, - itemgetter as itemgetter, - itruediv as itruediv, - ixor as ixor, - le as le, - length_hint as length_hint, - lshift as lshift, - lt as lt, - matmul as matmul, - methodcaller as methodcaller, - mod as mod, - mul as mul, - ne as ne, - neg as neg, - not_ as not_, - or_ as or_, - pos as pos, - pow as pow, - rshift as rshift, - setitem as setitem, - sub as sub, - truediv as truediv, - truth as truth, - xor as xor, -) -from typing import AnyStr +import sys +from collections.abc import Callable, Container, Iterable, Mapping, MutableMapping, MutableSequence, Sequence +from typing import Any, AnyStr, Generic, Protocol, SupportsAbs, TypeVar, overload +from typing_extensions import ParamSpec, SupportsIndex, TypeAlias, final + +_R = TypeVar("_R") +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) +_K = TypeVar("_K") +_V = TypeVar("_V") +_P = ParamSpec("_P") + +# The following protocols return "Any" instead of bool, since the comparison +# operators can be overloaded to return an arbitrary object. For example, +# the numpy.array comparison dunders return another numpy.array. + +class _SupportsDunderLT(Protocol): + def __lt__(self, __other: Any) -> Any: ... + +class _SupportsDunderGT(Protocol): + def __gt__(self, __other: Any) -> Any: ... + +class _SupportsDunderLE(Protocol): + def __le__(self, __other: Any) -> Any: ... + +class _SupportsDunderGE(Protocol): + def __ge__(self, __other: Any) -> Any: ... + +_SupportsComparison: TypeAlias = _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT + +class _SupportsInversion(Protocol[_T_co]): + def __invert__(self) -> _T_co: ... + +class _SupportsNeg(Protocol[_T_co]): + def __neg__(self) -> _T_co: ... + +class _SupportsPos(Protocol[_T_co]): + def __pos__(self) -> _T_co: ... + +# All four comparison functions must have the same signature, or we get false-positive errors +def lt(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ... +def le(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ... +def eq(__a: object, __b: object) -> Any: ... +def ne(__a: object, __b: object) -> Any: ... +def ge(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ... +def gt(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ... +def not_(__a: object) -> bool: ... +def truth(__a: object) -> bool: ... +def is_(__a: object, __b: object) -> bool: ... +def is_not(__a: object, __b: object) -> bool: ... +def abs(__a: SupportsAbs[_T]) -> _T: ... +def add(__a: Any, __b: Any) -> Any: ... +def and_(__a: Any, __b: Any) -> Any: ... +def floordiv(__a: Any, __b: Any) -> Any: ... +def index(__a: SupportsIndex) -> int: ... +def inv(__a: _SupportsInversion[_T_co]) -> _T_co: ... +def invert(__a: _SupportsInversion[_T_co]) -> _T_co: ... +def lshift(__a: Any, __b: Any) -> Any: ... +def mod(__a: Any, __b: Any) -> Any: ... +def mul(__a: Any, __b: Any) -> Any: ... +def matmul(__a: Any, __b: Any) -> Any: ... +def neg(__a: _SupportsNeg[_T_co]) -> _T_co: ... +def or_(__a: Any, __b: Any) -> Any: ... +def pos(__a: _SupportsPos[_T_co]) -> _T_co: ... +def pow(__a: Any, __b: Any) -> Any: ... +def rshift(__a: Any, __b: Any) -> Any: ... +def sub(__a: Any, __b: Any) -> Any: ... +def truediv(__a: Any, __b: Any) -> Any: ... +def xor(__a: Any, __b: Any) -> Any: ... +def concat(__a: Sequence[_T], __b: Sequence[_T]) -> Sequence[_T]: ... +def contains(__a: Container[object], __b: object) -> bool: ... +def countOf(__a: Iterable[object], __b: object) -> int: ... +@overload +def delitem(__a: MutableSequence[Any], __b: SupportsIndex) -> None: ... +@overload +def delitem(__a: MutableSequence[Any], __b: slice) -> None: ... +@overload +def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ... +@overload +def getitem(__a: Sequence[_T], __b: SupportsIndex) -> _T: ... +@overload +def getitem(__a: Sequence[_T], __b: slice) -> Sequence[_T]: ... +@overload +def getitem(__a: Mapping[_K, _V], __b: _K) -> _V: ... +def indexOf(__a: Iterable[_T], __b: _T) -> int: ... +@overload +def setitem(__a: MutableSequence[_T], __b: SupportsIndex, __c: _T) -> None: ... +@overload +def setitem(__a: MutableSequence[_T], __b: slice, __c: Sequence[_T]) -> None: ... +@overload +def setitem(__a: MutableMapping[_K, _V], __b: _K, __c: _V) -> None: ... +def length_hint(__obj: object, __default: int = ...) -> int: ... +@final +class attrgetter(Generic[_T_co]): + @overload + def __new__(cls, attr: str) -> attrgetter[Any]: ... + @overload + def __new__(cls, attr: str, __attr2: str) -> attrgetter[tuple[Any, Any]]: ... + @overload + def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[tuple[Any, Any, Any]]: ... + @overload + def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[tuple[Any, Any, Any, Any]]: ... + @overload + def __new__(cls, attr: str, *attrs: str) -> attrgetter[tuple[Any, ...]]: ... + def __call__(self, obj: Any) -> _T_co: ... + +@final +class itemgetter(Generic[_T_co]): + @overload + def __new__(cls, item: Any) -> itemgetter[Any]: ... + @overload + def __new__(cls, item: Any, __item2: Any) -> itemgetter[tuple[Any, Any]]: ... + @overload + def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[tuple[Any, Any, Any]]: ... + @overload + def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[tuple[Any, Any, Any, Any]]: ... + @overload + def __new__(cls, item: Any, *items: Any) -> itemgetter[tuple[Any, ...]]: ... + def __call__(self, obj: Any) -> _T_co: ... + +@final +class methodcaller: + def __init__(self, __name: str, *args: Any, **kwargs: Any) -> None: ... + def __call__(self, obj: Any) -> Any: ... + +def iadd(__a: Any, __b: Any) -> Any: ... +def iand(__a: Any, __b: Any) -> Any: ... +def iconcat(__a: Any, __b: Any) -> Any: ... +def ifloordiv(__a: Any, __b: Any) -> Any: ... +def ilshift(__a: Any, __b: Any) -> Any: ... +def imod(__a: Any, __b: Any) -> Any: ... +def imul(__a: Any, __b: Any) -> Any: ... +def imatmul(__a: Any, __b: Any) -> Any: ... +def ior(__a: Any, __b: Any) -> Any: ... +def ipow(__a: Any, __b: Any) -> Any: ... +def irshift(__a: Any, __b: Any) -> Any: ... +def isub(__a: Any, __b: Any) -> Any: ... +def itruediv(__a: Any, __b: Any) -> Any: ... +def ixor(__a: Any, __b: Any) -> Any: ... + +if sys.version_info >= (3, 11): + def call(__obj: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... def _compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ... diff --git a/stdlib/_osx_support.pyi b/stdlib/_osx_support.pyi index f03c37d..7fd0ee9 100644 --- a/stdlib/_osx_support.pyi +++ b/stdlib/_osx_support.pyi @@ -1,17 +1,25 @@ -from typing import Iterable, Sequence, Tuple, TypeVar +import sys +from collections.abc import Iterable, Sequence +from typing import TypeVar _T = TypeVar("_T") _K = TypeVar("_K") _V = TypeVar("_V") -__all__: list[str] +__all__ = ["compiler_fixup", "customize_config_vars", "customize_compiler", "get_platform_osx"] -_UNIVERSAL_CONFIG_VARS: Tuple[str, ...] # undocumented -_COMPILER_CONFIG_VARS: Tuple[str, ...] # undocumented +_UNIVERSAL_CONFIG_VARS: tuple[str, ...] # undocumented +_COMPILER_CONFIG_VARS: tuple[str, ...] # undocumented _INITPRE: str # undocumented def _find_executable(executable: str, path: str | None = ...) -> str | None: ... # undocumented -def _read_output(commandstring: str) -> str | None: ... # undocumented + +if sys.version_info >= (3, 8): + def _read_output(commandstring: str, capture_stderr: bool = ...) -> str | None: ... # undocumented + +else: + def _read_output(commandstring: str) -> str | None: ... # undocumented + def _find_build_tool(toolname: str) -> str: ... # undocumented _SYSTEM_VERSION: str | None # undocumented @@ -30,4 +38,4 @@ def customize_config_vars(_config_vars: dict[str, str]) -> dict[str, str]: ... def customize_compiler(_config_vars: dict[str, str]) -> dict[str, str]: ... def get_platform_osx( _config_vars: dict[str, str], osname: _T, release: _K, machine: _V -) -> Tuple[str | _T, str | _K, str | _V]: ... +) -> tuple[str | _T, str | _K, str | _V]: ... diff --git a/stdlib/_posixsubprocess.pyi b/stdlib/_posixsubprocess.pyi index 05209ba..ca95336 100644 --- a/stdlib/_posixsubprocess.pyi +++ b/stdlib/_posixsubprocess.pyi @@ -1,24 +1,32 @@ -# NOTE: These are incomplete! +import sys +from _typeshed import StrOrBytesPath +from collections.abc import Callable, Sequence +from typing_extensions import SupportsIndex -from typing import Callable, Sequence, Tuple - -def cloexec_pipe() -> Tuple[int, int]: ... -def fork_exec( - args: Sequence[str], - executable_list: Sequence[bytes], - close_fds: bool, - fds_to_keep: Sequence[int], - cwd: str, - env_list: Sequence[bytes], - p2cread: int, - p2cwrite: int, - c2pred: int, - c2pwrite: int, - errread: int, - errwrite: int, - errpipe_read: int, - errpipe_write: int, - restore_signals: int, - start_new_session: int, - preexec_fn: Callable[[], None], -) -> int: ... +if sys.platform != "win32": + def cloexec_pipe() -> tuple[int, int]: ... + def fork_exec( + __process_args: Sequence[StrOrBytesPath] | None, + __executable_list: Sequence[bytes], + __close_fds: bool, + __fds_to_keep: tuple[int, ...], + __cwd_obj: str, + __env_list: Sequence[bytes] | None, + __p2cread: int, + __p2cwrite: int, + __c2pred: int, + __c2pwrite: int, + __errread: int, + __errwrite: int, + __errpipe_read: int, + __errpipe_write: int, + __restore_signals: int, + __call_setsid: int, + __pgid_to_set: int, + __gid_object: SupportsIndex | None, + __groups_list: list[int] | None, + __uid_object: SupportsIndex | None, + __child_umask: int, + __preexec_fn: Callable[[], None], + __allow_vfork: bool, + ) -> int: ... diff --git a/stdlib/_py_abc.pyi b/stdlib/_py_abc.pyi index 8d79389..ddf0436 100644 --- a/stdlib/_py_abc.pyi +++ b/stdlib/_py_abc.pyi @@ -1,10 +1,12 @@ -from typing import Any, Tuple, Type, TypeVar +from _typeshed import Self +from typing import Any, NewType, TypeVar _T = TypeVar("_T") -# TODO: Change the return into a NewType bound to int after pytype/#597 -def get_cache_token() -> object: ... +_CacheToken = NewType("_CacheToken", int) + +def get_cache_token() -> _CacheToken: ... class ABCMeta(type): - def __new__(__mcls, __name: str, __bases: Tuple[Type[Any], ...], __namespace: dict[str, Any]) -> ABCMeta: ... - def register(cls, subclass: Type[_T]) -> Type[_T]: ... + def __new__(__mcls: type[Self], __name: str, __bases: tuple[type[Any], ...], __namespace: dict[str, Any]) -> Self: ... + def register(cls, subclass: type[_T]) -> type[_T]: ... diff --git a/stdlib/_pydecimal.pyi b/stdlib/_pydecimal.pyi index 56fbddf..faff626 100644 --- a/stdlib/_pydecimal.pyi +++ b/stdlib/_pydecimal.pyi @@ -1,3 +1,43 @@ # This is a slight lie, the implementations aren't exactly identical # However, in all likelihood, the differences are inconsequential -from decimal import * +from _decimal import * + +__all__ = [ + "Decimal", + "Context", + "DecimalTuple", + "DefaultContext", + "BasicContext", + "ExtendedContext", + "DecimalException", + "Clamped", + "InvalidOperation", + "DivisionByZero", + "Inexact", + "Rounded", + "Subnormal", + "Overflow", + "Underflow", + "FloatOperation", + "DivisionImpossible", + "InvalidContext", + "ConversionSyntax", + "DivisionUndefined", + "ROUND_DOWN", + "ROUND_HALF_UP", + "ROUND_HALF_EVEN", + "ROUND_CEILING", + "ROUND_FLOOR", + "ROUND_UP", + "ROUND_HALF_DOWN", + "ROUND_05UP", + "setcontext", + "getcontext", + "localcontext", + "MAX_PREC", + "MAX_EMAX", + "MIN_EMIN", + "MIN_ETINY", + "HAVE_THREADS", + "HAVE_CONTEXTVAR", +] diff --git a/stdlib/_random.pyi b/stdlib/_random.pyi index fa80c6d..c4b235f 100644 --- a/stdlib/_random.pyi +++ b/stdlib/_random.pyi @@ -1,9 +1,9 @@ -from typing import Tuple +from typing_extensions import TypeAlias # Actually Tuple[(int,) * 625] -_State = Tuple[int, ...] +_State: TypeAlias = tuple[int, ...] -class Random(object): +class Random: def __init__(self, seed: object = ...) -> None: ... def seed(self, __n: object = ...) -> None: ... def getstate(self) -> _State: ... diff --git a/stdlib/_sitebuiltins.pyi b/stdlib/_sitebuiltins.pyi index a71364b..4a35921 100644 --- a/stdlib/_sitebuiltins.pyi +++ b/stdlib/_sitebuiltins.pyi @@ -1,4 +1,5 @@ -from typing import ClassVar, Iterable, NoReturn +from collections.abc import Iterable +from typing import ClassVar, NoReturn from typing_extensions import Literal class Quitter: diff --git a/stdlib/_socket.pyi b/stdlib/_socket.pyi index 7945c66..df6b45a 100644 --- a/stdlib/_socket.pyi +++ b/stdlib/_socket.pyi @@ -1,23 +1,24 @@ import sys from _typeshed import ReadableBuffer, WriteableBuffer from collections.abc import Iterable -from typing import Any, SupportsInt, Tuple, Union, overload +from typing import Any, SupportsInt, overload +from typing_extensions import TypeAlias if sys.version_info >= (3, 8): from typing import SupportsIndex - _FD = SupportsIndex + _FD: TypeAlias = SupportsIndex else: - _FD = SupportsInt + _FD: TypeAlias = SupportsInt -_CMSG = Tuple[int, int, bytes] -_CMSGArg = Tuple[int, int, ReadableBuffer] +_CMSG: TypeAlias = tuple[int, int, bytes] +_CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer] # Addresses can be either tuples of varying lengths (AF_INET, AF_INET6, -# AF_NETLINK, AF_TIPC) or strings (AF_UNIX). -_Address = Union[Tuple[Any, ...], str] -_RetAddress = Any -# TODO Most methods allow bytes as address objects +# AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX). +# See getsockaddrarg() in socketmodule.c. +_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer +_RetAddress: TypeAlias = Any # ----- Constants ----- # Some socket families are listed in the "Socket families" section of the docs, @@ -29,8 +30,6 @@ _RetAddress = Any has_ipv6: bool -# Per socketmodule.c, only these three families are portable -AF_UNIX: int AF_INET: int AF_INET6: int @@ -45,58 +44,56 @@ if sys.platform == "linux": SOCK_NONBLOCK: int # Address families not mentioned in the docs -AF_AAL5: int AF_APPLETALK: int -AF_ASH: int -AF_ATMPVC: int -AF_ATMSVC: int -AF_AX25: int -AF_BRIDGE: int AF_DECnet: int -AF_ECONET: int AF_IPX: int -AF_IRDA: int -AF_KEY: int -AF_LLC: int -AF_NETBEUI: int -AF_NETROM: int -AF_PPPOX: int -AF_ROSE: int -AF_ROUTE: int -AF_SECURITY: int AF_SNA: int -AF_SYSTEM: int AF_UNSPEC: int -AF_WANPIPE: int -AF_X25: int + +if sys.platform != "win32": + AF_ROUTE: int + AF_SYSTEM: int + AF_UNIX: int + +if sys.platform != "darwin": + AF_IRDA: int + +if sys.platform != "darwin" and sys.platform != "win32": + AF_AAL5: int + AF_ASH: int + AF_ATMPVC: int + AF_ATMSVC: int + AF_AX25: int + AF_BRIDGE: int + AF_ECONET: int + AF_KEY: int + AF_LLC: int + AF_NETBEUI: int + AF_NETROM: int + AF_PPPOX: int + AF_ROSE: int + AF_SECURITY: int + AF_WANPIPE: int + AF_X25: int # The "many constants" referenced by the docs SOMAXCONN: int AI_ADDRCONFIG: int AI_ALL: int AI_CANONNAME: int -AI_DEFAULT: int -AI_MASK: int AI_NUMERICHOST: int AI_NUMERICSERV: int AI_PASSIVE: int AI_V4MAPPED: int -AI_V4MAPPED_CFG: int -EAI_ADDRFAMILY: int EAI_AGAIN: int EAI_BADFLAGS: int -EAI_BADHINTS: int EAI_FAIL: int EAI_FAMILY: int -EAI_MAX: int EAI_MEMORY: int EAI_NODATA: int EAI_NONAME: int -EAI_OVERFLOW: int -EAI_PROTOCOL: int EAI_SERVICE: int EAI_SOCKTYPE: int -EAI_SYSTEM: int INADDR_ALLHOSTS_GROUP: int INADDR_ANY: int INADDR_BROADCAST: int @@ -106,103 +103,81 @@ INADDR_NONE: int INADDR_UNSPEC_GROUP: int IPPORT_RESERVED: int IPPORT_USERRESERVED: int -IPPROTO_AH: int -IPPROTO_BIP: int -IPPROTO_DSTOPTS: int -IPPROTO_EGP: int -IPPROTO_EON: int -IPPROTO_ESP: int -IPPROTO_FRAGMENT: int -IPPROTO_GGP: int -IPPROTO_GRE: int -IPPROTO_HELLO: int -IPPROTO_HOPOPTS: int + +if sys.platform != "win32" or sys.version_info >= (3, 8): + IPPROTO_AH: int + IPPROTO_DSTOPTS: int + IPPROTO_EGP: int + IPPROTO_ESP: int + IPPROTO_FRAGMENT: int + IPPROTO_GGP: int + IPPROTO_HOPOPTS: int + IPPROTO_ICMPV6: int + IPPROTO_IDP: int + IPPROTO_IGMP: int + IPPROTO_IPV4: int + IPPROTO_IPV6: int + IPPROTO_MAX: int + IPPROTO_ND: int + IPPROTO_NONE: int + IPPROTO_PIM: int + IPPROTO_PUP: int + IPPROTO_ROUTING: int + IPPROTO_SCTP: int + + if sys.platform != "darwin": + IPPROTO_CBT: int + IPPROTO_ICLFXBM: int + IPPROTO_IGP: int + IPPROTO_L2TP: int + IPPROTO_PGM: int + IPPROTO_RDP: int + IPPROTO_ST: int + IPPROTO_ICMP: int -IPPROTO_ICMPV6: int -IPPROTO_IDP: int -IPPROTO_IGMP: int IPPROTO_IP: int -IPPROTO_IPCOMP: int -IPPROTO_IPIP: int -IPPROTO_IPV4: int -IPPROTO_IPV6: int -IPPROTO_MAX: int -IPPROTO_MOBILE: int -IPPROTO_ND: int -IPPROTO_NONE: int -IPPROTO_PIM: int -IPPROTO_PUP: int IPPROTO_RAW: int -IPPROTO_ROUTING: int -IPPROTO_RSVP: int -IPPROTO_SCTP: int IPPROTO_TCP: int -IPPROTO_TP: int IPPROTO_UDP: int -IPPROTO_VRRP: int -IPPROTO_XTP: int IPV6_CHECKSUM: int -IPV6_DONTFRAG: int -IPV6_DSTOPTS: int -IPV6_HOPLIMIT: int -IPV6_HOPOPTS: int IPV6_JOIN_GROUP: int IPV6_LEAVE_GROUP: int IPV6_MULTICAST_HOPS: int IPV6_MULTICAST_IF: int IPV6_MULTICAST_LOOP: int -IPV6_NEXTHOP: int -IPV6_PATHMTU: int -IPV6_PKTINFO: int -IPV6_RECVDSTOPTS: int -IPV6_RECVHOPLIMIT: int -IPV6_RECVHOPOPTS: int -IPV6_RECVPATHMTU: int -IPV6_RECVPKTINFO: int -IPV6_RECVRTHDR: int IPV6_RECVTCLASS: int -IPV6_RTHDR: int -IPV6_RTHDRDSTOPTS: int -IPV6_RTHDR_TYPE_0: int IPV6_TCLASS: int IPV6_UNICAST_HOPS: int -IPV6_USE_MIN_MTU: int IPV6_V6ONLY: int -IPX_TYPE: int + +if sys.platform != "darwin" or sys.version_info >= (3, 9): + IPV6_DONTFRAG: int + IPV6_HOPLIMIT: int + IPV6_HOPOPTS: int + IPV6_PKTINFO: int + IPV6_RECVRTHDR: int + IPV6_RTHDR: int + IP_ADD_MEMBERSHIP: int -IP_DEFAULT_MULTICAST_LOOP: int -IP_DEFAULT_MULTICAST_TTL: int IP_DROP_MEMBERSHIP: int IP_HDRINCL: int -IP_MAX_MEMBERSHIPS: int IP_MULTICAST_IF: int IP_MULTICAST_LOOP: int IP_MULTICAST_TTL: int IP_OPTIONS: int IP_RECVDSTADDR: int -IP_RECVOPTS: int -IP_RECVRETOPTS: int -IP_RETOPTS: int +if sys.version_info >= (3, 10): + IP_RECVTOS: int +elif sys.platform != "win32" and sys.platform != "darwin": + IP_RECVTOS: int IP_TOS: int -IP_TRANSPARENT: int IP_TTL: int -LOCAL_PEERCRED: int -MSG_BCAST: int -MSG_BTAG: int -MSG_CMSG_CLOEXEC: int -MSG_CONFIRM: int MSG_CTRUNC: int MSG_DONTROUTE: int -MSG_DONTWAIT: int -MSG_EOF: int -MSG_EOR: int -MSG_ERRQUEUE: int -MSG_ETAG: int -MSG_FASTOPEN: int -MSG_MCAST: int -MSG_MORE: int -MSG_NOSIGNAL: int -MSG_NOTIFICATION: int + +if sys.platform != "darwin": + MSG_ERRQUEUE: int + MSG_OOB: int MSG_PEEK: int MSG_TRUNC: int @@ -214,62 +189,133 @@ NI_NAMEREQD: int NI_NOFQDN: int NI_NUMERICHOST: int NI_NUMERICSERV: int -SCM_CREDENTIALS: int -SCM_CREDS: int -SCM_RIGHTS: int SHUT_RD: int SHUT_RDWR: int SHUT_WR: int -SOL_ATALK: int -SOL_AX25: int -SOL_HCI: int SOL_IP: int -SOL_IPX: int -SOL_NETROM: int -SOL_ROSE: int SOL_SOCKET: int SOL_TCP: int SOL_UDP: int SO_ACCEPTCONN: int -SO_BINDTODEVICE: int SO_BROADCAST: int SO_DEBUG: int SO_DONTROUTE: int SO_ERROR: int -SO_EXCLUSIVEADDRUSE: int SO_KEEPALIVE: int SO_LINGER: int -SO_MARK: int SO_OOBINLINE: int -SO_PASSCRED: int -SO_PEERCRED: int -SO_PRIORITY: int SO_RCVBUF: int SO_RCVLOWAT: int SO_RCVTIMEO: int SO_REUSEADDR: int -SO_REUSEPORT: int -SO_SETFIB: int SO_SNDBUF: int SO_SNDLOWAT: int SO_SNDTIMEO: int SO_TYPE: int SO_USELOOPBACK: int -TCP_CORK: int -TCP_DEFER_ACCEPT: int +if sys.platform == "linux" and sys.version_info >= (3, 11): + SO_INCOMING_CPU: int TCP_FASTOPEN: int -TCP_INFO: int TCP_KEEPCNT: int -TCP_KEEPIDLE: int TCP_KEEPINTVL: int -TCP_LINGER2: int + +if sys.platform != "darwin": + TCP_KEEPIDLE: int + TCP_MAXSEG: int TCP_NODELAY: int -TCP_QUICKACK: int -TCP_SYNCNT: int -TCP_WINDOW_CLAMP: int -if sys.version_info >= (3, 7): +if sys.platform != "win32": TCP_NOTSENT_LOWAT: int +if sys.version_info >= (3, 10) and sys.platform == "darwin": + TCP_KEEPALIVE: int +if sys.version_info >= (3, 11) and sys.platform == "darwin": + TCP_CONNECTION_INFO: int + +if sys.platform != "darwin": + MSG_BCAST: int + MSG_MCAST: int + SO_EXCLUSIVEADDRUSE: int + +if sys.platform != "win32": + AI_DEFAULT: int + AI_MASK: int + AI_V4MAPPED_CFG: int + EAI_ADDRFAMILY: int + EAI_BADHINTS: int + EAI_MAX: int + EAI_OVERFLOW: int + EAI_PROTOCOL: int + EAI_SYSTEM: int + IPPROTO_EON: int + IPPROTO_GRE: int + IPPROTO_HELLO: int + IPPROTO_IPCOMP: int + IPPROTO_IPIP: int + IPPROTO_RSVP: int + IPPROTO_TP: int + IPPROTO_XTP: int + IPV6_RTHDR_TYPE_0: int + IP_DEFAULT_MULTICAST_LOOP: int + IP_DEFAULT_MULTICAST_TTL: int + IP_MAX_MEMBERSHIPS: int + IP_RECVOPTS: int + IP_RECVRETOPTS: int + IP_RETOPTS: int + LOCAL_PEERCRED: int + MSG_DONTWAIT: int + MSG_EOF: int + MSG_EOR: int + MSG_NOSIGNAL: int # Sometimes this exists on darwin, sometimes not + SCM_CREDS: int + SCM_RIGHTS: int + SO_REUSEPORT: int + +if sys.platform != "win32": + if sys.platform != "darwin" or sys.version_info >= (3, 9): + IPV6_DSTOPTS: int + IPV6_NEXTHOP: int + IPV6_PATHMTU: int + IPV6_RECVDSTOPTS: int + IPV6_RECVHOPLIMIT: int + IPV6_RECVHOPOPTS: int + IPV6_RECVPATHMTU: int + IPV6_RECVPKTINFO: int + IPV6_RTHDRDSTOPTS: int + IPV6_USE_MIN_MTU: int + +if sys.platform != "win32" and sys.platform != "darwin": + IPPROTO_BIP: int + IPPROTO_MOBILE: int + IPPROTO_VRRP: int + IPX_TYPE: int + IP_TRANSPARENT: int + MSG_BTAG: int + MSG_CMSG_CLOEXEC: int + MSG_CONFIRM: int + MSG_ETAG: int + MSG_FASTOPEN: int + MSG_MORE: int + MSG_NOTIFICATION: int + SCM_CREDENTIALS: int + SOL_ATALK: int + SOL_AX25: int + SOL_HCI: int + SOL_IPX: int + SOL_NETROM: int + SOL_ROSE: int + SO_BINDTODEVICE: int + SO_MARK: int + SO_PASSCRED: int + SO_PEERCRED: int + SO_PRIORITY: int + SO_SETFIB: int + TCP_CORK: int + TCP_DEFER_ACCEPT: int + TCP_INFO: int + TCP_LINGER2: int + TCP_QUICKACK: int + TCP_SYNCNT: int + TCP_WINDOW_CLAMP: int # Specifically-documented constants @@ -320,11 +366,12 @@ if sys.platform == "linux" and sys.version_info >= (3, 8): CAN_BCM_RX_RTR_FRAME: int CAN_BCM_CAN_FD_FRAME: int -if sys.platform == "linux" and sys.version_info >= (3, 7): +if sys.platform == "linux": CAN_ISOTP: int if sys.platform == "linux" and sys.version_info >= (3, 9): CAN_J1939: int + CAN_RAW_JOIN_FILTERS: int J1939_MAX_UNICAST_ADDR: int J1939_IDLE_ADDR: int @@ -355,6 +402,9 @@ if sys.platform == "linux" and sys.version_info >= (3, 9): J1939_FILTER_MAX: int +if sys.platform == "linux" and sys.version_info >= (3, 10): + IPPROTO_MPTCP: int + if sys.platform == "linux": AF_PACKET: int PF_PACKET: int @@ -393,7 +443,6 @@ if sys.platform == "win32": SIO_RCVALL: int SIO_KEEPALIVE_VALS: int SIO_LOOPBACK_FAST_PATH: int - RCVALL_IPLEVEL: int RCVALL_MAX: int RCVALL_OFF: int RCVALL_ON: int @@ -440,7 +489,7 @@ if sys.platform == "linux": ALG_SET_OP: int ALG_SET_PUBKEY: int -if sys.platform == "linux" and sys.version_info >= (3, 7): +if sys.platform == "linux": AF_VSOCK: int IOCTL_VM_SOCKETS_GET_LOCAL_CID: int VMADDR_CID_ANY: int @@ -451,16 +500,18 @@ if sys.platform == "linux" and sys.version_info >= (3, 7): SO_VM_SOCKETS_BUFFER_MIN_SIZE: int VM_SOCKETS_INVALID_VERSION: int -AF_LINK: int # Availability: BSD, macOS +if sys.platform != "win32" or sys.version_info >= (3, 9): + AF_LINK: int # BDADDR_* and HCI_* listed with other bluetooth constants below -SO_DOMAIN: int -SO_PASSSEC: int -SO_PEERSEC: int -SO_PROTOCOL: int -TCP_CONGESTION: int -TCP_USER_TIMEOUT: int +if sys.platform != "win32" and sys.platform != "darwin": + SO_DOMAIN: int + SO_PASSSEC: int + SO_PEERSEC: int + SO_PROTOCOL: int + TCP_CONGESTION: int + TCP_USER_TIMEOUT: int if sys.platform == "linux" and sys.version_info >= (3, 8): AF_QIPCRTR: int @@ -486,18 +537,19 @@ if sys.platform == "linux": NETLINK_W1: int NETLINK_XFRM: int +if sys.platform != "darwin": + if sys.platform != "win32" or sys.version_info >= (3, 9): + AF_BLUETOOTH: int + BDADDR_ANY: str + BDADDR_LOCAL: str + BTPROTO_RFCOMM: int + if sys.platform != "win32" and sys.platform != "darwin": # Linux and some BSD support is explicit in the docs # Windows and macOS do not support in practice - AF_BLUETOOTH: int BTPROTO_HCI: int BTPROTO_L2CAP: int - BTPROTO_RFCOMM: int BTPROTO_SCO: int # not in FreeBSD - - BDADDR_ANY: str - BDADDR_LOCAL: str - HCI_FILTER: int # not in NetBSD or DragonFlyBSD # not in FreeBSD, NetBSD, or DragonFlyBSD HCI_TIME_STAMP: int @@ -523,14 +575,19 @@ else: # ----- Classes ----- class socket: - family: int - type: int - proto: int + @property + def family(self) -> int: ... + @property + def type(self) -> int: ... + @property + def proto(self) -> int: ... + @property + def timeout(self) -> float | None: ... def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ... - def bind(self, __address: _Address | bytes) -> None: ... + def bind(self, __address: _Address) -> None: ... def close(self) -> None: ... - def connect(self, __address: _Address | bytes) -> None: ... - def connect_ex(self, __address: _Address | bytes) -> int: ... + def connect(self, __address: _Address) -> None: ... + def connect_ex(self, __address: _Address) -> int: ... def detach(self) -> int: ... def fileno(self) -> int: ... def getpeername(self) -> _RetAddress: ... @@ -539,11 +596,11 @@ class socket: def getsockopt(self, __level: int, __optname: int) -> int: ... @overload def getsockopt(self, __level: int, __optname: int, __buflen: int) -> bytes: ... - if sys.version_info >= (3, 7): - def getblocking(self) -> bool: ... + def getblocking(self) -> bool: ... def gettimeout(self) -> float | None: ... if sys.platform == "win32": def ioctl(self, __control: int, __option: int | tuple[int, int, int] | bool) -> None: ... + def listen(self, __backlog: int = ...) -> None: ... def recv(self, __bufsize: int, __flags: int = ...) -> bytes: ... def recvfrom(self, __bufsize: int, __flags: int = ...) -> tuple[bytes, _RetAddress]: ... @@ -552,6 +609,7 @@ class socket: def recvmsg_into( self, __buffers: Iterable[WriteableBuffer], __ancbufsize: int = ..., __flags: int = ... ) -> tuple[int, list[_CMSG], int, Any]: ... + def recvfrom_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ... def recv_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> int: ... def send(self, __data: ReadableBuffer, __flags: int = ...) -> int: ... @@ -566,29 +624,29 @@ class socket: __buffers: Iterable[ReadableBuffer], __ancdata: Iterable[_CMSGArg] = ..., __flags: int = ..., - __address: _Address = ..., + __address: _Address | None = ..., ) -> int: ... if sys.platform == "linux": def sendmsg_afalg( self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ... ) -> int: ... + def setblocking(self, __flag: bool) -> None: ... def settimeout(self, __value: float | None) -> None: ... @overload - def setsockopt(self, __level: int, __optname: int, __value: int | bytes) -> None: ... + def setsockopt(self, __level: int, __optname: int, __value: int | ReadableBuffer) -> None: ... @overload def setsockopt(self, __level: int, __optname: int, __value: None, __optlen: int) -> None: ... if sys.platform == "win32": def share(self, __process_id: int) -> bytes: ... + def shutdown(self, __how: int) -> None: ... SocketType = socket # ----- Functions ----- -if sys.version_info >= (3, 7): - def close(__fd: _FD) -> None: ... - +def close(__fd: _FD) -> None: ... def dup(__fd: _FD) -> int: ... # the 5th tuple item is an address @@ -613,17 +671,17 @@ def ntohs(__x: int) -> int: ... # param & ret val are 16-bit ints def htonl(__x: int) -> int: ... # param & ret val are 32-bit ints def htons(__x: int) -> int: ... # param & ret val are 16-bit ints def inet_aton(__ip_string: str) -> bytes: ... # ret val 4 bytes in length -def inet_ntoa(__packed_ip: bytes) -> str: ... +def inet_ntoa(__packed_ip: ReadableBuffer) -> str: ... def inet_pton(__address_family: int, __ip_string: str) -> bytes: ... -def inet_ntop(__address_family: int, __packed_ip: bytes) -> str: ... -def CMSG_LEN(__length: int) -> int: ... -def CMSG_SPACE(__length: int) -> int: ... +def inet_ntop(__address_family: int, __packed_ip: ReadableBuffer) -> str: ... def getdefaulttimeout() -> float | None: ... def setdefaulttimeout(__timeout: float | None) -> None: ... -def socketpair(__family: int = ..., __type: int = ..., __proto: int = ...) -> tuple[socket, socket]: ... if sys.platform != "win32": def sethostname(__name: str) -> None: ... + def CMSG_LEN(__length: int) -> int: ... + def CMSG_SPACE(__length: int) -> int: ... + def socketpair(__family: int = ..., __type: int = ..., __proto: int = ...) -> tuple[socket, socket]: ... # Windows added these in 3.8, but didn't have them before if sys.platform != "win32" or sys.version_info >= (3, 8): diff --git a/stdlib/_stat.pyi b/stdlib/_stat.pyi index 634f7da..83d832e 100644 --- a/stdlib/_stat.pyi +++ b/stdlib/_stat.pyi @@ -1,54 +1,68 @@ -SF_APPEND: int -SF_ARCHIVED: int -SF_IMMUTABLE: int -SF_NOUNLINK: int -SF_SNAPSHOT: int -ST_ATIME: int -ST_CTIME: int -ST_DEV: int -ST_GID: int -ST_INO: int -ST_MODE: int -ST_MTIME: int -ST_NLINK: int -ST_SIZE: int -ST_UID: int -S_ENFMT: int -S_IEXEC: int -S_IFBLK: int -S_IFCHR: int -S_IFDIR: int +import sys +from typing_extensions import Literal + +SF_APPEND: Literal[0x00040000] +SF_ARCHIVED: Literal[0x00010000] +SF_IMMUTABLE: Literal[0x00020000] +SF_NOUNLINK: Literal[0x00100000] +SF_SNAPSHOT: Literal[0x00200000] + +ST_MODE: Literal[0] +ST_INO: Literal[1] +ST_DEV: Literal[2] +ST_NLINK: Literal[3] +ST_UID: Literal[4] +ST_GID: Literal[5] +ST_SIZE: Literal[6] +ST_ATIME: Literal[7] +ST_MTIME: Literal[8] +ST_CTIME: Literal[9] + +S_IFIFO: Literal[0o010000] +S_IFLNK: Literal[0o120000] +S_IFREG: Literal[0o100000] +S_IFSOCK: Literal[0o140000] +S_IFBLK: Literal[0o060000] +S_IFCHR: Literal[0o020000] +S_IFDIR: Literal[0o040000] + +# These are 0 on systems that don't support the specific kind of file. +# Example: Linux doesn't support door files, so S_IFDOOR is 0 on linux. S_IFDOOR: int -S_IFIFO: int -S_IFLNK: int S_IFPORT: int -S_IFREG: int -S_IFSOCK: int S_IFWHT: int -S_IREAD: int -S_IRGRP: int -S_IROTH: int -S_IRUSR: int -S_IRWXG: int -S_IRWXO: int -S_IRWXU: int -S_ISGID: int -S_ISUID: int -S_ISVTX: int -S_IWGRP: int -S_IWOTH: int -S_IWRITE: int -S_IWUSR: int -S_IXGRP: int -S_IXOTH: int -S_IXUSR: int -UF_APPEND: int -UF_COMPRESSED: int -UF_HIDDEN: int -UF_IMMUTABLE: int -UF_NODUMP: int -UF_NOUNLINK: int -UF_OPAQUE: int + +S_ISUID: Literal[0o4000] +S_ISGID: Literal[0o2000] +S_ISVTX: Literal[0o1000] + +S_IRWXU: Literal[0o0700] +S_IRUSR: Literal[0o0400] +S_IWUSR: Literal[0o0200] +S_IXUSR: Literal[0o0100] + +S_IRWXG: Literal[0o0070] +S_IRGRP: Literal[0o0040] +S_IWGRP: Literal[0o0020] +S_IXGRP: Literal[0o0010] + +S_IRWXO: Literal[0o0007] +S_IROTH: Literal[0o0004] +S_IWOTH: Literal[0o0002] +S_IXOTH: Literal[0o0001] + +S_ENFMT: Literal[0o2000] +S_IREAD: Literal[0o0400] +S_IWRITE: Literal[0o0200] +S_IEXEC: Literal[0o0100] + +UF_APPEND: Literal[0x00000004] +UF_COMPRESSED: Literal[0x00000020] # OS X 10.6+ only +UF_HIDDEN: Literal[0x00008000] # OX X 10.5+ only +UF_IMMUTABLE: Literal[0x00000002] +UF_NODUMP: Literal[0x00000001] +UF_NOUNLINK: Literal[0x00000010] +UF_OPAQUE: Literal[0x00000008] def S_IMODE(mode: int) -> int: ... def S_IFMT(mode: int) -> int: ... @@ -63,3 +77,27 @@ def S_ISREG(mode: int) -> bool: ... def S_ISSOCK(mode: int) -> bool: ... def S_ISWHT(mode: int) -> bool: ... def filemode(mode: int) -> str: ... + +if sys.platform == "win32" and sys.version_info >= (3, 8): + IO_REPARSE_TAG_SYMLINK: int + IO_REPARSE_TAG_MOUNT_POINT: int + IO_REPARSE_TAG_APPEXECLINK: int + +if sys.platform == "win32": + FILE_ATTRIBUTE_ARCHIVE: Literal[32] + FILE_ATTRIBUTE_COMPRESSED: Literal[2048] + FILE_ATTRIBUTE_DEVICE: Literal[64] + FILE_ATTRIBUTE_DIRECTORY: Literal[16] + FILE_ATTRIBUTE_ENCRYPTED: Literal[16384] + FILE_ATTRIBUTE_HIDDEN: Literal[2] + FILE_ATTRIBUTE_INTEGRITY_STREAM: Literal[32768] + FILE_ATTRIBUTE_NORMAL: Literal[128] + FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: Literal[8192] + FILE_ATTRIBUTE_NO_SCRUB_DATA: Literal[131072] + FILE_ATTRIBUTE_OFFLINE: Literal[4096] + FILE_ATTRIBUTE_READONLY: Literal[1] + FILE_ATTRIBUTE_REPARSE_POINT: Literal[1024] + FILE_ATTRIBUTE_SPARSE_FILE: Literal[512] + FILE_ATTRIBUTE_SYSTEM: Literal[4] + FILE_ATTRIBUTE_TEMPORARY: Literal[256] + FILE_ATTRIBUTE_VIRTUAL: Literal[65536] diff --git a/stdlib/_thread.pyi b/stdlib/_thread.pyi index 2425703..152362e 100644 --- a/stdlib/_thread.pyi +++ b/stdlib/_thread.pyi @@ -1,24 +1,25 @@ import sys +from _typeshed import structseq +from collections.abc import Callable from threading import Thread from types import TracebackType -from typing import Any, Callable, NoReturn, Optional, Tuple, Type +from typing import Any, NoReturn +from typing_extensions import Final, final error = RuntimeError def _count() -> int: ... - -_dangling: Any - +@final class LockType: def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... def locked(self) -> bool: ... def __enter__(self) -> bool: ... def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: dict[str, Any] = ...) -> int: ... +def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any] = ...) -> int: ... def interrupt_main() -> None: ... def exit() -> NoReturn: ... def allocate_lock() -> LockType: ... @@ -29,9 +30,12 @@ TIMEOUT_MAX: float if sys.version_info >= (3, 8): def get_native_id() -> int: ... # only available on some platforms - class _ExceptHookArgs(Tuple[Type[BaseException], Optional[BaseException], Optional[TracebackType], Optional[Thread]]): + @final + class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread") @property - def exc_type(self) -> Type[BaseException]: ... + def exc_type(self) -> type[BaseException]: ... @property def exc_value(self) -> BaseException | None: ... @property diff --git a/stdlib/_threading_local.pyi b/stdlib/_threading_local.pyi index 461459d..98683da 100644 --- a/stdlib/_threading_local.pyi +++ b/stdlib/_threading_local.pyi @@ -1,14 +1,15 @@ -from typing import Any, Dict, Tuple +from typing import Any +from typing_extensions import TypeAlias from weakref import ReferenceType -localdict = Dict[Any, Any] +__all__ = ["local"] +_LocalDict: TypeAlias = dict[Any, Any] class _localimpl: key: str - dicts: dict[int, Tuple[ReferenceType[Any], localdict]] - def __init__(self) -> None: ... - def get_dict(self) -> localdict: ... - def create_dict(self) -> localdict: ... + dicts: dict[int, tuple[ReferenceType[Any], _LocalDict]] + def get_dict(self) -> _LocalDict: ... + def create_dict(self) -> _LocalDict: ... class local: def __getattribute__(self, name: str) -> Any: ... diff --git a/stdlib/_tkinter.pyi b/stdlib/_tkinter.pyi index 378b042..fced8c9 100644 --- a/stdlib/_tkinter.pyi +++ b/stdlib/_tkinter.pyi @@ -1,5 +1,6 @@ -from typing import Any -from typing_extensions import Literal +import sys +from typing import Any, ClassVar +from typing_extensions import Literal, final # _tkinter is meant to be only used internally by tkinter, but some tkinter # functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl @@ -14,9 +15,19 @@ from typing_extensions import Literal # >>> text.tag_add('foo', '1.0', 'end') # >>> text.tag_ranges('foo') # (, ) +@final class Tcl_Obj: - string: str # str(tclobj) returns this - typename: str + @property + def string(self) -> str: ... + @property + def typename(self) -> str: ... + __hash__: ClassVar[None] # type: ignore[assignment] + def __eq__(self, __other): ... + def __ge__(self, __other): ... + def __gt__(self, __other): ... + def __le__(self, __other): ... + def __lt__(self, __other): ... + def __ne__(self, __other): ... class TclError(Exception): ... @@ -37,40 +48,45 @@ class TclError(Exception): ... # # eval always returns str because _tkinter_tkapp_eval_impl in _tkinter.c calls # Tkapp_UnicodeResult, and it returns a string when it succeeds. +@final class TkappType: # Please keep in sync with tkinter.Tk + def adderrorinfo(self, __msg): ... def call(self, __command: Any, *args: Any) -> Any: ... + def createcommand(self, __name, __func): ... + if sys.platform != "win32": + def createfilehandler(self, __file, __mask, __func): ... + def deletefilehandler(self, __file): ... + + def createtimerhandler(self, __milliseconds, __func): ... + def deletecommand(self, __name): ... + def dooneevent(self, __flags: int = ...): ... def eval(self, __script: str) -> str: ... - adderrorinfo: Any - createcommand: Any - createfilehandler: Any - createtimerhandler: Any - deletecommand: Any - deletefilehandler: Any - dooneevent: Any - evalfile: Any - exprboolean: Any - exprdouble: Any - exprlong: Any - exprstring: Any - getboolean: Any - getdouble: Any - getint: Any - getvar: Any - globalgetvar: Any - globalsetvar: Any - globalunsetvar: Any - interpaddr: Any - loadtk: Any - mainloop: Any - quit: Any - record: Any - setvar: Any - split: Any - splitlist: Any - unsetvar: Any - wantobjects: Any - willdispatch: Any + def evalfile(self, __fileName): ... + def exprboolean(self, __s): ... + def exprdouble(self, __s): ... + def exprlong(self, __s): ... + def exprstring(self, __s): ... + def getboolean(self, __arg): ... + def getdouble(self, __arg): ... + def getint(self, __arg): ... + def getvar(self, *args, **kwargs): ... + def globalgetvar(self, *args, **kwargs): ... + def globalsetvar(self, *args, **kwargs): ... + def globalunsetvar(self, *args, **kwargs): ... + def interpaddr(self): ... + def loadtk(self) -> None: ... + def mainloop(self, __threshold: int = ...): ... + def quit(self): ... + def record(self, __script): ... + def setvar(self, *ags, **kwargs): ... + if sys.version_info < (3, 11): + def split(self, __arg): ... + + def splitlist(self, __arg): ... + def unsetvar(self, *args, **kwargs): ... + def wantobjects(self, *args, **kwargs): ... + def willdispatch(self): ... # These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS ALL_EVENTS: Literal[-3] @@ -87,9 +103,19 @@ WRITABLE: Literal[4] TCL_VERSION: str TK_VERSION: str -# TODO: figure out what these are (with e.g. help()) and get rid of Any -TkttType: Any -_flatten: Any -create: Any -getbusywaitinterval: Any -setbusywaitinterval: Any +@final +class TkttType: + def deletetimerhandler(self): ... + +def create( + __screenName: str | None = ..., + __baseName: str | None = ..., + __className: str = ..., + __interactive: bool = ..., + __wantobjects: bool = ..., + __wantTk: bool = ..., + __sync: bool = ..., + __use: str | None = ..., +): ... +def getbusywaitinterval(): ... +def setbusywaitinterval(__new_val): ... diff --git a/stdlib/_tracemalloc.pyi b/stdlib/_tracemalloc.pyi index 2763763..2262d4b 100644 --- a/stdlib/_tracemalloc.pyi +++ b/stdlib/_tracemalloc.pyi @@ -1,12 +1,12 @@ import sys -from tracemalloc import _FrameTupleT, _TraceTupleT -from typing import Sequence, Tuple +from collections.abc import Sequence +from tracemalloc import _FrameTuple, _TraceTuple -def _get_object_traceback(__obj: object) -> Sequence[_FrameTupleT] | None: ... -def _get_traces() -> Sequence[_TraceTupleT]: ... +def _get_object_traceback(__obj: object) -> Sequence[_FrameTuple] | None: ... +def _get_traces() -> Sequence[_TraceTuple]: ... def clear_traces() -> None: ... def get_traceback_limit() -> int: ... -def get_traced_memory() -> Tuple[int, int]: ... +def get_traced_memory() -> tuple[int, int]: ... def get_tracemalloc_memory() -> int: ... def is_tracing() -> bool: ... diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index 9e60fd0..849078e 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -5,10 +5,13 @@ import array import ctypes import mmap +import pickle import sys +from collections.abc import Awaitable, Callable, Iterable, Set as AbstractSet from os import PathLike -from typing import AbstractSet, Any, Awaitable, Container, Iterable, Protocol, Tuple, TypeVar, Union -from typing_extensions import Literal, final +from types import FrameType, TracebackType +from typing import Any, AnyStr, Generic, Protocol, TypeVar, Union +from typing_extensions import Final, Literal, LiteralString, TypeAlias, final _KT = TypeVar("_KT") _KT_co = TypeVar("_KT_co", covariant=True) @@ -21,7 +24,17 @@ _T_contra = TypeVar("_T_contra", contravariant=True) # Use for "self" annotations: # def __enter__(self: Self) -> Self: ... -Self = TypeVar("Self") # noqa Y001 +Self = TypeVar("Self") # noqa: Y001 + +# covariant version of typing.AnyStr, useful for protocols +AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True) # noqa: Y001 + +# For partially known annotations. Usually, fields where type annotations +# haven't been added are left unannotated, but in some situations this +# isn't possible or a type is already partially known. In cases like these, +# use Incomplete instead of Any as a marker. For example, use +# "Incomplete | None" instead of "Any | None". +Incomplete: TypeAlias = Any # stable class IdentityFunction(Protocol): @@ -35,10 +48,40 @@ class SupportsNext(Protocol[_T_co]): class SupportsAnext(Protocol[_T_co]): def __anext__(self) -> Awaitable[_T_co]: ... -class SupportsLessThan(Protocol): - def __lt__(self, __other: Any) -> bool: ... +# Comparison protocols + +class SupportsDunderLT(Protocol[_T_contra]): + def __lt__(self, __other: _T_contra) -> bool: ... + +class SupportsDunderGT(Protocol[_T_contra]): + def __gt__(self, __other: _T_contra) -> bool: ... + +class SupportsDunderLE(Protocol[_T_contra]): + def __le__(self, __other: _T_contra) -> bool: ... + +class SupportsDunderGE(Protocol[_T_contra]): + def __ge__(self, __other: _T_contra) -> bool: ... + +class SupportsAllComparisons( + SupportsDunderLT[Any], SupportsDunderGT[Any], SupportsDunderLE[Any], SupportsDunderGE[Any], Protocol +): ... + +SupportsRichComparison: TypeAlias = SupportsDunderLT[Any] | SupportsDunderGT[Any] +SupportsRichComparisonT = TypeVar("SupportsRichComparisonT", bound=SupportsRichComparison) # noqa: Y001 + +# Dunder protocols + +class SupportsAdd(Protocol[_T_contra, _T_co]): + def __add__(self, __x: _T_contra) -> _T_co: ... + +class SupportsRAdd(Protocol[_T_contra, _T_co]): + def __radd__(self, __x: _T_contra) -> _T_co: ... -SupportsLessThanT = TypeVar("SupportsLessThanT", bound=SupportsLessThan) # noqa: Y001 +class SupportsSub(Protocol[_T_contra, _T_co]): + def __sub__(self, __x: _T_contra) -> _T_co: ... + +class SupportsRSub(Protocol[_T_contra, _T_co]): + def __rsub__(self, __x: _T_contra) -> _T_co: ... class SupportsDivMod(Protocol[_T_contra, _T_co]): def __divmod__(self, __other: _T_contra) -> _T_co: ... @@ -46,6 +89,16 @@ class SupportsDivMod(Protocol[_T_contra, _T_co]): class SupportsRDivMod(Protocol[_T_contra, _T_co]): def __rdivmod__(self, __other: _T_contra) -> _T_co: ... +# This protocol is generic over the iterator type, while Iterable is +# generic over the type that is iterated over. +class SupportsIter(Protocol[_T_co]): + def __iter__(self) -> _T_co: ... + +# This protocol is generic over the iterator type, while AsyncIterable is +# generic over the type that is iterated over. +class SupportsAiter(Protocol[_T_co]): + def __aiter__(self) -> _T_co: ... + class SupportsLenAndGetItem(Protocol[_T_co]): def __len__(self) -> int: ... def __getitem__(self, __k: int) -> _T_co: ... @@ -57,28 +110,29 @@ class SupportsTrunc(Protocol): # stable class SupportsItems(Protocol[_KT_co, _VT_co]): - def items(self) -> AbstractSet[Tuple[_KT_co, _VT_co]]: ... + def items(self) -> AbstractSet[tuple[_KT_co, _VT_co]]: ... # stable class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]): def keys(self) -> Iterable[_KT]: ... - def __getitem__(self, __k: _KT) -> _VT_co: ... + def __getitem__(self, __key: _KT) -> _VT_co: ... # stable -class SupportsGetItem(Container[_KT_contra], Protocol[_KT_contra, _VT_co]): - def __getitem__(self, __k: _KT_contra) -> _VT_co: ... +class SupportsGetItem(Protocol[_KT_contra, _VT_co]): + def __contains__(self, __x: object) -> bool: ... + def __getitem__(self, __key: _KT_contra) -> _VT_co: ... # stable class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra, _VT]): - def __setitem__(self, __k: _KT_contra, __v: _VT) -> None: ... - def __delitem__(self, __v: _KT_contra) -> None: ... + def __setitem__(self, __key: _KT_contra, __value: _VT) -> None: ... + def __delitem__(self, __key: _KT_contra) -> None: ... -# These aliases are simple strings in Python 2. -StrPath = Union[str, PathLike[str]] # stable -BytesPath = Union[bytes, PathLike[bytes]] # stable -StrOrBytesPath = Union[str, bytes, PathLike[str], PathLike[bytes]] # stable +StrPath: TypeAlias = str | PathLike[str] # stable +BytesPath: TypeAlias = bytes | PathLike[bytes] # stable +GenericPath: TypeAlias = AnyStr | PathLike[AnyStr] +StrOrBytesPath: TypeAlias = str | bytes | PathLike[str] | PathLike[bytes] # stable -OpenTextModeUpdating = Literal[ +OpenTextModeUpdating: TypeAlias = Literal[ "r+", "+r", "rt+", @@ -112,10 +166,10 @@ OpenTextModeUpdating = Literal[ "t+x", "+tx", ] -OpenTextModeWriting = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"] -OpenTextModeReading = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"] -OpenTextMode = Union[OpenTextModeUpdating, OpenTextModeWriting, OpenTextModeReading] -OpenBinaryModeUpdating = Literal[ +OpenTextModeWriting: TypeAlias = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"] +OpenTextModeReading: TypeAlias = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"] +OpenTextMode: TypeAlias = OpenTextModeUpdating | OpenTextModeWriting | OpenTextModeReading +OpenBinaryModeUpdating: TypeAlias = Literal[ "rb+", "r+b", "+rb", @@ -141,16 +195,16 @@ OpenBinaryModeUpdating = Literal[ "b+x", "+bx", ] -OpenBinaryModeWriting = Literal["wb", "bw", "ab", "ba", "xb", "bx"] -OpenBinaryModeReading = Literal["rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr"] -OpenBinaryMode = Union[OpenBinaryModeUpdating, OpenBinaryModeReading, OpenBinaryModeWriting] +OpenBinaryModeWriting: TypeAlias = Literal["wb", "bw", "ab", "ba", "xb", "bx"] +OpenBinaryModeReading: TypeAlias = Literal["rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr"] +OpenBinaryMode: TypeAlias = OpenBinaryModeUpdating | OpenBinaryModeReading | OpenBinaryModeWriting # stable class HasFileno(Protocol): def fileno(self) -> int: ... -FileDescriptor = int # stable -FileDescriptorLike = Union[int, HasFileno] # stable +FileDescriptor: TypeAlias = int # stable +FileDescriptorLike: TypeAlias = int | HasFileno # stable # stable class SupportsRead(Protocol[_T_co]): @@ -166,15 +220,24 @@ class SupportsNoArgReadline(Protocol[_T_co]): # stable class SupportsWrite(Protocol[_T_contra]): - def write(self, __s: _T_contra) -> Any: ... + def write(self, __s: _T_contra) -> object: ... -ReadOnlyBuffer = bytes # stable +ReadOnlyBuffer: TypeAlias = bytes # stable # Anything that implements the read-write buffer interface. # The buffer interface is defined purely on the C level, so we cannot define a normal Protocol -# for it. Instead we have to list the most common stdlib buffer classes in a Union. -WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap, ctypes._CData] # stable +# for it (until PEP 688 is implemented). Instead we have to list the most common stdlib buffer classes in a Union. +if sys.version_info >= (3, 8): + WriteableBuffer: TypeAlias = ( + bytearray | memoryview | array.array[Any] | mmap.mmap | ctypes._CData | pickle.PickleBuffer + ) # stable +else: + WriteableBuffer: TypeAlias = bytearray | memoryview | array.array[Any] | mmap.mmap | ctypes._CData # stable # Same as _WriteableBuffer, but also includes read-only buffer types (like bytes). -ReadableBuffer = Union[ReadOnlyBuffer, WriteableBuffer] # stable +ReadableBuffer: TypeAlias = ReadOnlyBuffer | WriteableBuffer # stable +_BufferWithLen: TypeAlias = ReadableBuffer # not stable # noqa: Y047 + +ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, TracebackType] +OptExcInfo: TypeAlias = Union[ExcInfo, tuple[None, None, None]] # stable if sys.version_info >= (3, 10): @@ -184,3 +247,34 @@ else: @final class NoneType: def __bool__(self) -> Literal[False]: ... + +# This is an internal CPython type that is like, but subtly different from, a NamedTuple +# Subclasses of this type are found in multiple modules. +# In typeshed, `structseq` is only ever used as a mixin in combination with a fixed-length `Tuple` +# See discussion at #6546 & #6560 +# `structseq` classes are unsubclassable, so are all decorated with `@final`. +class structseq(Generic[_T_co]): + n_fields: Final[int] + n_unnamed_fields: Final[int] + n_sequence_fields: Final[int] + # The first parameter will generally only take an iterable of a specific length. + # E.g. `os.uname_result` takes any iterable of length exactly 5. + # + # The second parameter will accept a dict of any kind without raising an exception, + # but only has any meaning if you supply it a dict where the keys are strings. + # https://github.com/python/typeshed/pull/6560#discussion_r767149830 + def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ... + +# Superset of typing.AnyStr that also inclues LiteralString +AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001 + +# Represents when str or LiteralStr is acceptable. Useful for string processing +# APIs where literalness of return value depends on literalness of inputs +StrOrLiteralStr = TypeVar("StrOrLiteralStr", LiteralString, str) # noqa: Y001 + +# Objects suitable to be passed to sys.setprofile, threading.setprofile, and similar +ProfileFunction: TypeAlias = Callable[[FrameType, str, Any], object] + +# Objects suitable to be passed to sys.settrace, threading.settrace, and similar +# TODO: Ideally this would be a recursive type alias +TraceFunction: TypeAlias = Callable[[FrameType, str, Any], Callable[[FrameType, str, Any], Any] | None] diff --git a/stdlib/_typeshed/dbapi.pyi b/stdlib/_typeshed/dbapi.pyi new file mode 100644 index 0000000..022e959 --- /dev/null +++ b/stdlib/_typeshed/dbapi.pyi @@ -0,0 +1,37 @@ +# PEP 249 Database API 2.0 Types +# https://www.python.org/dev/peps/pep-0249/ + +from collections.abc import Mapping, Sequence +from typing import Any, Protocol +from typing_extensions import TypeAlias + +DBAPITypeCode: TypeAlias = Any | None +# Strictly speaking, this should be a Sequence, but the type system does +# not support fixed-length sequences. +DBAPIColumnDescription: TypeAlias = tuple[str, DBAPITypeCode, int | None, int | None, int | None, int | None, bool | None] + +class DBAPIConnection(Protocol): + def close(self) -> object: ... + def commit(self) -> object: ... + # optional: + # def rollback(self) -> Any: ... + def cursor(self) -> DBAPICursor: ... + +class DBAPICursor(Protocol): + @property + def description(self) -> Sequence[DBAPIColumnDescription] | None: ... + @property + def rowcount(self) -> int: ... + # optional: + # def callproc(self, __procname: str, __parameters: Sequence[Any] = ...) -> Sequence[Any]: ... + def close(self) -> object: ... + def execute(self, __operation: str, __parameters: Sequence[Any] | Mapping[str, Any] = ...) -> object: ... + def executemany(self, __operation: str, __seq_of_parameters: Sequence[Sequence[Any]]) -> object: ... + def fetchone(self) -> Sequence[Any] | None: ... + def fetchmany(self, __size: int = ...) -> Sequence[Sequence[Any]]: ... + def fetchall(self) -> Sequence[Sequence[Any]]: ... + # optional: + # def nextset(self) -> None | Literal[True]: ... + arraysize: int + def setinputsizes(self, __sizes: Sequence[DBAPITypeCode | int | None]) -> object: ... + def setoutputsize(self, __size: int, __column: int = ...) -> object: ... diff --git a/stdlib/_typeshed/wsgi.pyi b/stdlib/_typeshed/wsgi.pyi index ddb32b7..de731ae 100644 --- a/stdlib/_typeshed/wsgi.pyi +++ b/stdlib/_typeshed/wsgi.pyi @@ -1,35 +1,44 @@ # Types to support PEP 3333 (WSGI) # +# Obsolete since Python 3.11: Use wsgiref.types instead. +# # See the README.md file in this directory for more information. -from sys import _OptExcInfo -from typing import Any, Callable, Dict, Iterable, Protocol, Tuple +import sys +from _typeshed import OptExcInfo +from collections.abc import Callable, Iterable, Iterator +from typing import Any, Protocol +from typing_extensions import TypeAlias -# stable -class StartResponse(Protocol): - def __call__( - self, status: str, headers: list[Tuple[str, str]], exc_info: _OptExcInfo | None = ... - ) -> Callable[[bytes], Any]: ... +class _Readable(Protocol): + def read(self, size: int = ...) -> bytes: ... + # Optional: def close(self) -> object: ... -WSGIEnvironment = Dict[str, Any] # stable -WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] # stable +if sys.version_info >= (3, 11): + from wsgiref.types import * +else: + # stable + class StartResponse(Protocol): + def __call__( + self, __status: str, __headers: list[tuple[str, str]], __exc_info: OptExcInfo | None = ... + ) -> Callable[[bytes], object]: ... -# WSGI input streams per PEP 3333, stable -class InputStream(Protocol): - def read(self, size: int = ...) -> bytes: ... - def readline(self, size: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> list[bytes]: ... - def __iter__(self) -> Iterable[bytes]: ... + WSGIEnvironment: TypeAlias = dict[str, Any] # stable + WSGIApplication: TypeAlias = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] # stable -# WSGI error streams per PEP 3333, stable -class ErrorStream(Protocol): - def flush(self) -> None: ... - def write(self, s: str) -> None: ... - def writelines(self, seq: list[str]) -> None: ... + # WSGI input streams per PEP 3333, stable + class InputStream(Protocol): + def read(self, __size: int = ...) -> bytes: ... + def readline(self, __size: int = ...) -> bytes: ... + def readlines(self, __hint: int = ...) -> list[bytes]: ... + def __iter__(self) -> Iterator[bytes]: ... -class _Readable(Protocol): - def read(self, size: int = ...) -> bytes: ... + # WSGI error streams per PEP 3333, stable + class ErrorStream(Protocol): + def flush(self) -> object: ... + def write(self, __s: str) -> object: ... + def writelines(self, __seq: list[str]) -> object: ... -# Optional file wrapper in wsgi.file_wrapper -class FileWrapper(Protocol): - def __call__(self, file: _Readable, block_size: int = ...) -> Iterable[bytes]: ... + # Optional file wrapper in wsgi.file_wrapper + class FileWrapper(Protocol): + def __call__(self, __file: _Readable, __block_size: int = ...) -> Iterable[bytes]: ... diff --git a/stdlib/_typeshed/xml.pyi b/stdlib/_typeshed/xml.pyi index d53b743..231c2b8 100644 --- a/stdlib/_typeshed/xml.pyi +++ b/stdlib/_typeshed/xml.pyi @@ -1,7 +1,6 @@ # See the README.md file in this directory for more information. -from typing import Any -from typing_extensions import Protocol +from typing import Any, Protocol # As defined https://docs.python.org/3/library/xml.dom.html#domimplementation-objects class DOMImplementation(Protocol): diff --git a/stdlib/_warnings.pyi b/stdlib/_warnings.pyi index fef73e6..2eb9ae4 100644 --- a/stdlib/_warnings.pyi +++ b/stdlib/_warnings.pyi @@ -1,21 +1,21 @@ -from typing import Any, Tuple, Type, overload +from typing import Any, overload _defaultaction: str _onceregistry: dict[Any, Any] -filters: list[tuple[str, str | None, Type[Warning], str | None, int]] +filters: list[tuple[str, str | None, type[Warning], str | None, int]] @overload -def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ... +def warn(message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ... @overload def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ... @overload def warn_explicit( message: str, - category: Type[Warning], + category: type[Warning], filename: str, lineno: int, module: str | None = ..., - registry: dict[str | Tuple[str, Type[Warning], int], int] | None = ..., + registry: dict[str | tuple[str, type[Warning], int], int] | None = ..., module_globals: dict[str, Any] | None = ..., source: Any | None = ..., ) -> None: ... @@ -26,7 +26,7 @@ def warn_explicit( filename: str, lineno: int, module: str | None = ..., - registry: dict[str | Tuple[str, Type[Warning], int], int] | None = ..., + registry: dict[str | tuple[str, type[Warning], int], int] | None = ..., module_globals: dict[str, Any] | None = ..., source: Any | None = ..., ) -> None: ... diff --git a/stdlib/_weakref.pyi b/stdlib/_weakref.pyi index 006836f..742bc3a 100644 --- a/stdlib/_weakref.pyi +++ b/stdlib/_weakref.pyi @@ -1,5 +1,8 @@ import sys -from typing import Any, Callable, Generic, TypeVar, overload +from _typeshed import Self +from collections.abc import Callable +from typing import Any, Generic, TypeVar, overload +from typing_extensions import final if sys.version_info >= (3, 9): from types import GenericAlias @@ -7,27 +10,29 @@ if sys.version_info >= (3, 9): _C = TypeVar("_C", bound=Callable[..., Any]) _T = TypeVar("_T") +@final class CallableProxyType(Generic[_C]): # "weakcallableproxy" def __getattr__(self, attr: str) -> Any: ... + __call__: _C +@final class ProxyType(Generic[_T]): # "weakproxy" def __getattr__(self, attr: str) -> Any: ... class ReferenceType(Generic[_T]): __callback__: Callable[[ReferenceType[_T]], Any] - def __init__(self, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> None: ... + def __new__(cls: type[Self], o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ... def __call__(self) -> _T | None: ... - def __hash__(self) -> int: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... ref = ReferenceType def getweakrefcount(__object: Any) -> int: ... -def getweakrefs(object: Any) -> list[Any]: ... -@overload -def proxy(object: _C, callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ... +def getweakrefs(__object: Any) -> list[Any]: ... # Return CallableProxyType if object is callable, ProxyType otherwise @overload -def proxy(object: _T, callback: Callable[[_T], Any] | None = ...) -> Any: ... +def proxy(__object: _C, __callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ... +@overload +def proxy(__object: _T, __callback: Callable[[_T], Any] | None = ...) -> Any: ... diff --git a/stdlib/_weakrefset.pyi b/stdlib/_weakrefset.pyi index 1f0132f..da09442 100644 --- a/stdlib/_weakrefset.pyi +++ b/stdlib/_weakrefset.pyi @@ -1,34 +1,38 @@ import sys -from typing import Any, Generic, Iterable, Iterator, MutableSet, TypeVar +from _typeshed import Self +from collections.abc import Iterable, Iterator, MutableSet +from typing import Any, Generic, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = ["WeakSet"] + _S = TypeVar("_S") _T = TypeVar("_T") -_SelfT = TypeVar("_SelfT", bound=WeakSet[Any]) class WeakSet(MutableSet[_T], Generic[_T]): - def __init__(self, data: Iterable[_T] | None = ...) -> None: ... + @overload + def __init__(self, data: None = ...) -> None: ... + @overload + def __init__(self, data: Iterable[_T]) -> None: ... def add(self, item: _T) -> None: ... - def clear(self) -> None: ... def discard(self, item: _T) -> None: ... - def copy(self: _SelfT) -> _SelfT: ... - def pop(self) -> _T: ... + def copy(self: Self) -> Self: ... def remove(self, item: _T) -> None: ... def update(self, other: Iterable[_T]) -> None: ... def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... - def __ior__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def difference(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def __sub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def difference_update(self, other: Iterable[_T]) -> None: ... - def __isub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def intersection(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def __and__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... - def intersection_update(self, other: Iterable[_T]) -> None: ... - def __iand__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... + def __ior__(self: Self, other: Iterable[_T]) -> Self: ... # type: ignore[override,misc] + def difference(self: Self, other: Iterable[_T]) -> Self: ... + def __sub__(self: Self, other: Iterable[Any]) -> Self: ... + def difference_update(self, other: Iterable[Any]) -> None: ... + def __isub__(self: Self, other: Iterable[Any]) -> Self: ... + def intersection(self: Self, other: Iterable[_T]) -> Self: ... + def __and__(self: Self, other: Iterable[Any]) -> Self: ... + def intersection_update(self, other: Iterable[Any]) -> None: ... + def __iand__(self: Self, other: Iterable[Any]) -> Self: ... def issubset(self, other: Iterable[_T]) -> bool: ... def __le__(self, other: Iterable[_T]) -> bool: ... def __lt__(self, other: Iterable[_T]) -> bool: ... @@ -38,8 +42,8 @@ class WeakSet(MutableSet[_T], Generic[_T]): def __eq__(self, other: object) -> bool: ... def symmetric_difference(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... def __xor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... - def symmetric_difference_update(self, other: Iterable[Any]) -> None: ... - def __ixor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... + def symmetric_difference_update(self, other: Iterable[_T]) -> None: ... + def __ixor__(self: Self, other: Iterable[_T]) -> Self: ... # type: ignore[override,misc] def union(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... def __or__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... def isdisjoint(self, other: Iterable[_T]) -> bool: ... diff --git a/stdlib/_winapi.pyi b/stdlib/_winapi.pyi index eabbad3..3ccac7e 100644 --- a/stdlib/_winapi.pyi +++ b/stdlib/_winapi.pyi @@ -1,134 +1,212 @@ import sys -from typing import Any, NoReturn, Sequence, Tuple, overload -from typing_extensions import Literal +from _typeshed import ReadableBuffer +from collections.abc import Sequence +from typing import Any, NoReturn, overload +from typing_extensions import Literal, final -CREATE_NEW_CONSOLE: int -CREATE_NEW_PROCESS_GROUP: int -DUPLICATE_CLOSE_SOURCE: int -DUPLICATE_SAME_ACCESS: int -ERROR_ALREADY_EXISTS: int -ERROR_BROKEN_PIPE: int -ERROR_IO_PENDING: int -ERROR_MORE_DATA: int -ERROR_NETNAME_DELETED: int -ERROR_NO_DATA: int -ERROR_NO_SYSTEM_RESOURCES: int -ERROR_OPERATION_ABORTED: int -ERROR_PIPE_BUSY: int -ERROR_PIPE_CONNECTED: int -ERROR_SEM_TIMEOUT: int -FILE_FLAG_FIRST_PIPE_INSTANCE: int -FILE_FLAG_OVERLAPPED: int -FILE_GENERIC_READ: int -FILE_GENERIC_WRITE: int -GENERIC_READ: int -GENERIC_WRITE: int -INFINITE: int -NMPWAIT_WAIT_FOREVER: int -NULL: int -OPEN_EXISTING: int -PIPE_ACCESS_DUPLEX: int -PIPE_ACCESS_INBOUND: int -PIPE_READMODE_MESSAGE: int -PIPE_TYPE_MESSAGE: int -PIPE_UNLIMITED_INSTANCES: int -PIPE_WAIT: int -PROCESS_ALL_ACCESS: int -PROCESS_DUP_HANDLE: int -STARTF_USESHOWWINDOW: int -STARTF_USESTDHANDLES: int -STD_ERROR_HANDLE: int -STD_INPUT_HANDLE: int -STD_OUTPUT_HANDLE: int -STILL_ACTIVE: int -SW_HIDE: int -WAIT_ABANDONED_0: int -WAIT_OBJECT_0: int -WAIT_TIMEOUT: int +if sys.platform == "win32": + ABOVE_NORMAL_PRIORITY_CLASS: Literal[32768] + BELOW_NORMAL_PRIORITY_CLASS: Literal[16384] + CREATE_BREAKAWAY_FROM_JOB: Literal[16777216] + CREATE_DEFAULT_ERROR_MODE: Literal[67108864] + CREATE_NO_WINDOW: Literal[134217728] + CREATE_NEW_CONSOLE: Literal[16] + CREATE_NEW_PROCESS_GROUP: Literal[512] + DETACHED_PROCESS: Literal[8] + DUPLICATE_CLOSE_SOURCE: Literal[1] + DUPLICATE_SAME_ACCESS: Literal[2] -def CloseHandle(__handle: int) -> None: ... -@overload -def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ... -@overload -def ConnectNamedPipe(handle: int, overlapped: Literal[False] = ...) -> None: ... -@overload -def ConnectNamedPipe(handle: int, overlapped: bool) -> Overlapped | None: ... -def CreateFile( - __file_name: str, - __desired_access: int, - __share_mode: int, - __security_attributes: int, - __creation_disposition: int, - __flags_and_attributes: int, - __template_file: int, -) -> int: ... -def CreateJunction(__src_path: str, __dst_path: str) -> None: ... -def CreateNamedPipe( - __name: str, - __open_mode: int, - __pipe_mode: int, - __max_instances: int, - __out_buffer_size: int, - __in_buffer_size: int, - __default_timeout: int, - __security_attributes: int, -) -> int: ... -def CreatePipe(__pipe_attrs: Any, __size: int) -> Tuple[int, int]: ... -def CreateProcess( - __application_name: str | None, - __command_line: str | None, - __proc_attrs: Any, - __thread_attrs: Any, - __inherit_handles: bool, - __creation_flags: int, - __env_mapping: dict[str, str], - __current_directory: str | None, - __startup_info: Any, -) -> Tuple[int, int, int, int]: ... -def DuplicateHandle( - __source_process_handle: int, - __source_handle: int, - __target_process_handle: int, - __desired_access: int, - __inherit_handle: bool, - __options: int = ..., -) -> int: ... -def ExitProcess(__ExitCode: int) -> NoReturn: ... + ERROR_ALREADY_EXISTS: Literal[183] + ERROR_BROKEN_PIPE: Literal[109] + ERROR_IO_PENDING: Literal[997] + ERROR_MORE_DATA: Literal[234] + ERROR_NETNAME_DELETED: Literal[64] + ERROR_NO_DATA: Literal[232] + ERROR_NO_SYSTEM_RESOURCES: Literal[1450] + ERROR_OPERATION_ABORTED: Literal[995] + ERROR_PIPE_BUSY: Literal[231] + ERROR_PIPE_CONNECTED: Literal[535] + ERROR_SEM_TIMEOUT: Literal[121] -if sys.version_info >= (3, 7): + FILE_FLAG_FIRST_PIPE_INSTANCE: Literal[524288] + FILE_FLAG_OVERLAPPED: Literal[1073741824] + FILE_GENERIC_READ: Literal[1179785] + FILE_GENERIC_WRITE: Literal[1179926] + if sys.version_info >= (3, 8): + FILE_MAP_ALL_ACCESS: Literal[983071] + FILE_MAP_COPY: Literal[1] + FILE_MAP_EXECUTE: Literal[32] + FILE_MAP_READ: Literal[4] + FILE_MAP_WRITE: Literal[2] + FILE_TYPE_CHAR: Literal[2] + FILE_TYPE_DISK: Literal[1] + FILE_TYPE_PIPE: Literal[3] + FILE_TYPE_REMOTE: Literal[32768] + FILE_TYPE_UNKNOWN: Literal[0] + + GENERIC_READ: Literal[2147483648] + GENERIC_WRITE: Literal[1073741824] + HIGH_PRIORITY_CLASS: Literal[128] + INFINITE: Literal[4294967295] + if sys.version_info >= (3, 8): + INVALID_HANDLE_VALUE: int # very large number + IDLE_PRIORITY_CLASS: Literal[64] + NORMAL_PRIORITY_CLASS: Literal[32] + REALTIME_PRIORITY_CLASS: Literal[256] + NMPWAIT_WAIT_FOREVER: Literal[4294967295] + + if sys.version_info >= (3, 8): + MEM_COMMIT: Literal[4096] + MEM_FREE: Literal[65536] + MEM_IMAGE: Literal[16777216] + MEM_MAPPED: Literal[262144] + MEM_PRIVATE: Literal[131072] + MEM_RESERVE: Literal[8192] + + NULL: Literal[0] + OPEN_EXISTING: Literal[3] + + PIPE_ACCESS_DUPLEX: Literal[3] + PIPE_ACCESS_INBOUND: Literal[1] + PIPE_READMODE_MESSAGE: Literal[2] + PIPE_TYPE_MESSAGE: Literal[4] + PIPE_UNLIMITED_INSTANCES: Literal[255] + PIPE_WAIT: Literal[0] + if sys.version_info >= (3, 8): + PAGE_EXECUTE: Literal[16] + PAGE_EXECUTE_READ: Literal[32] + PAGE_EXECUTE_READWRITE: Literal[64] + PAGE_EXECUTE_WRITECOPY: Literal[128] + PAGE_GUARD: Literal[256] + PAGE_NOACCESS: Literal[1] + PAGE_NOCACHE: Literal[512] + PAGE_READONLY: Literal[2] + PAGE_READWRITE: Literal[4] + PAGE_WRITECOMBINE: Literal[1024] + PAGE_WRITECOPY: Literal[8] + + PROCESS_ALL_ACCESS: Literal[2097151] + PROCESS_DUP_HANDLE: Literal[64] + if sys.version_info >= (3, 8): + SEC_COMMIT: Literal[134217728] + SEC_IMAGE: Literal[16777216] + SEC_LARGE_PAGES: Literal[2147483648] + SEC_NOCACHE: Literal[268435456] + SEC_RESERVE: Literal[67108864] + SEC_WRITECOMBINE: Literal[1073741824] + STARTF_USESHOWWINDOW: Literal[1] + STARTF_USESTDHANDLES: Literal[256] + STD_ERROR_HANDLE: Literal[4294967284] + STD_INPUT_HANDLE: Literal[4294967286] + STD_OUTPUT_HANDLE: Literal[4294967285] + STILL_ACTIVE: Literal[259] + SW_HIDE: Literal[0] + if sys.version_info >= (3, 8): + SYNCHRONIZE: Literal[1048576] + WAIT_ABANDONED_0: Literal[128] + WAIT_OBJECT_0: Literal[0] + WAIT_TIMEOUT: Literal[258] + + if sys.version_info >= (3, 10): + LOCALE_NAME_INVARIANT: str + LOCALE_NAME_MAX_LENGTH: int + LOCALE_NAME_SYSTEM_DEFAULT: str + LOCALE_NAME_USER_DEFAULT: str | None + + LCMAP_FULLWIDTH: int + LCMAP_HALFWIDTH: int + LCMAP_HIRAGANA: int + LCMAP_KATAKANA: int + LCMAP_LINGUISTIC_CASING: int + LCMAP_LOWERCASE: int + LCMAP_SIMPLIFIED_CHINESE: int + LCMAP_TITLECASE: int + LCMAP_TRADITIONAL_CHINESE: int + LCMAP_UPPERCASE: int + + def CloseHandle(__handle: int) -> None: ... + @overload + def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ... + @overload + def ConnectNamedPipe(handle: int, overlapped: Literal[False] = ...) -> None: ... + @overload + def ConnectNamedPipe(handle: int, overlapped: bool) -> Overlapped | None: ... + def CreateFile( + __file_name: str, + __desired_access: int, + __share_mode: int, + __security_attributes: int, + __creation_disposition: int, + __flags_and_attributes: int, + __template_file: int, + ) -> int: ... + def CreateJunction(__src_path: str, __dst_path: str) -> None: ... + def CreateNamedPipe( + __name: str, + __open_mode: int, + __pipe_mode: int, + __max_instances: int, + __out_buffer_size: int, + __in_buffer_size: int, + __default_timeout: int, + __security_attributes: int, + ) -> int: ... + def CreatePipe(__pipe_attrs: Any, __size: int) -> tuple[int, int]: ... + def CreateProcess( + __application_name: str | None, + __command_line: str | None, + __proc_attrs: Any, + __thread_attrs: Any, + __inherit_handles: bool, + __creation_flags: int, + __env_mapping: dict[str, str], + __current_directory: str | None, + __startup_info: Any, + ) -> tuple[int, int, int, int]: ... + def DuplicateHandle( + __source_process_handle: int, + __source_handle: int, + __target_process_handle: int, + __desired_access: int, + __inherit_handle: bool, + __options: int = ..., + ) -> int: ... + def ExitProcess(__ExitCode: int) -> NoReturn: ... def GetACP() -> int: ... def GetFileType(handle: int) -> int: ... + def GetCurrentProcess() -> int: ... + def GetExitCodeProcess(__process: int) -> int: ... + def GetLastError() -> int: ... + def GetModuleFileName(__module_handle: int) -> str: ... + def GetStdHandle(__std_handle: int) -> int: ... + def GetVersion() -> int: ... + def OpenProcess(__desired_access: int, __inherit_handle: bool, __process_id: int) -> int: ... + def PeekNamedPipe(__handle: int, __size: int = ...) -> tuple[int, int] | tuple[bytes, int, int]: ... + if sys.version_info >= (3, 10): + def LCMapStringEx(locale: str, flags: int, src: str) -> str: ... -def GetCurrentProcess() -> int: ... -def GetExitCodeProcess(__process: int) -> int: ... -def GetLastError() -> int: ... -def GetModuleFileName(__module_handle: int) -> str: ... -def GetStdHandle(__std_handle: int) -> int: ... -def GetVersion() -> int: ... -def OpenProcess(__desired_access: int, __inherit_handle: bool, __process_id: int) -> int: ... -def PeekNamedPipe(__handle: int, __size: int = ...) -> Tuple[int, int] | Tuple[bytes, int, int]: ... -@overload -def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> Tuple[Overlapped, int]: ... -@overload -def ReadFile(handle: int, size: int, overlapped: Literal[False] = ...) -> Tuple[bytes, int]: ... -@overload -def ReadFile(handle: int, size: int, overlapped: int | bool) -> Tuple[Any, int]: ... -def SetNamedPipeHandleState( - __named_pipe: int, __mode: int | None, __max_collection_count: int | None, __collect_data_timeout: int | None -) -> None: ... -def TerminateProcess(__handle: int, __exit_code: int) -> None: ... -def WaitForMultipleObjects(__handle_seq: Sequence[int], __wait_flag: bool, __milliseconds: int = ...) -> int: ... -def WaitForSingleObject(__handle: int, __milliseconds: int) -> int: ... -def WaitNamedPipe(__name: str, __timeout: int) -> None: ... -@overload -def WriteFile(handle: int, buffer: bytes, overlapped: Literal[True]) -> Tuple[Overlapped, int]: ... -@overload -def WriteFile(handle: int, buffer: bytes, overlapped: Literal[False] = ...) -> Tuple[int, int]: ... -@overload -def WriteFile(handle: int, buffer: bytes, overlapped: int | bool) -> Tuple[Any, int]: ... - -class Overlapped: - event: int - def GetOverlappedResult(self, __wait: bool) -> Tuple[int, int]: ... - def cancel(self) -> None: ... - def getbuffer(self) -> bytes | None: ... + @overload + def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> tuple[Overlapped, int]: ... + @overload + def ReadFile(handle: int, size: int, overlapped: Literal[False] = ...) -> tuple[bytes, int]: ... + @overload + def ReadFile(handle: int, size: int, overlapped: int | bool) -> tuple[Any, int]: ... + def SetNamedPipeHandleState( + __named_pipe: int, __mode: int | None, __max_collection_count: int | None, __collect_data_timeout: int | None + ) -> None: ... + def TerminateProcess(__handle: int, __exit_code: int) -> None: ... + def WaitForMultipleObjects(__handle_seq: Sequence[int], __wait_flag: bool, __milliseconds: int = ...) -> int: ... + def WaitForSingleObject(__handle: int, __milliseconds: int) -> int: ... + def WaitNamedPipe(__name: str, __timeout: int) -> None: ... + @overload + def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[True]) -> tuple[Overlapped, int]: ... + @overload + def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[False] = ...) -> tuple[int, int]: ... + @overload + def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: int | bool) -> tuple[Any, int]: ... + @final + class Overlapped: + event: int + def GetOverlappedResult(self, __wait: bool) -> tuple[int, int]: ... + def cancel(self) -> None: ... + def getbuffer(self) -> bytes | None: ... diff --git a/stdlib/abc.pyi b/stdlib/abc.pyi index 7896e91..110eba2 100644 --- a/stdlib/abc.pyi +++ b/stdlib/abc.pyi @@ -1,26 +1,44 @@ -from _typeshed import SupportsWrite -from typing import Any, Callable, Tuple, Type, TypeVar +import sys +from _typeshed import Self, SupportsWrite +from collections.abc import Callable +from typing import Any, Generic, TypeVar +from typing_extensions import Literal _T = TypeVar("_T") +_R_co = TypeVar("_R_co", covariant=True) _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) # These definitions have special processing in mypy class ABCMeta(type): __abstractmethods__: frozenset[str] - def __init__(self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]) -> None: ... + if sys.version_info >= (3, 11): + def __new__( + __mcls: type[Self], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwargs: Any + ) -> Self: ... + else: + def __new__(mcls: type[Self], name: str, bases: tuple[type, ...], namespace: dict[str, Any], **kwargs: Any) -> Self: ... + def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ... def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ... def _dump_registry(cls: ABCMeta, file: SupportsWrite[str] | None = ...) -> None: ... - def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ... + def register(cls: ABCMeta, subclass: type[_T]) -> type[_T]: ... def abstractmethod(funcobj: _FuncT) -> _FuncT: ... -class abstractproperty(property): ... +class abstractclassmethod(classmethod[_R_co], Generic[_R_co]): + __isabstractmethod__: Literal[True] + def __init__(self: abstractclassmethod[_R_co], callable: Callable[..., _R_co]) -> None: ... + +class abstractstaticmethod(staticmethod[_R_co], Generic[_R_co]): + __isabstractmethod__: Literal[True] + def __init__(self, callable: Callable[..., _R_co]) -> None: ... -# These two are deprecated and not supported by mypy -def abstractstaticmethod(callable: _FuncT) -> _FuncT: ... -def abstractclassmethod(callable: _FuncT) -> _FuncT: ... +class abstractproperty(property): + __isabstractmethod__: Literal[True] class ABC(metaclass=ABCMeta): ... def get_cache_token() -> object: ... + +if sys.version_info >= (3, 10): + def update_abstractmethods(cls: type[_T]) -> type[_T]: ... diff --git a/stdlib/aifc.pyi b/stdlib/aifc.pyi index 7d7c6b2..14e824f 100644 --- a/stdlib/aifc.pyi +++ b/stdlib/aifc.pyi @@ -1,8 +1,13 @@ import sys from _typeshed import Self from types import TracebackType -from typing import IO, Any, NamedTuple, Tuple, Type, Union, overload -from typing_extensions import Literal +from typing import IO, Any, NamedTuple, overload +from typing_extensions import Literal, TypeAlias + +if sys.version_info >= (3, 9): + __all__ = ["Error", "open"] +else: + __all__ = ["Error", "open", "openfp"] class Error(Exception): ... @@ -14,14 +19,14 @@ class _aifc_params(NamedTuple): comptype: bytes compname: bytes -_File = Union[str, IO[bytes]] -_Marker = Tuple[int, int, bytes] +_File: TypeAlias = str | IO[bytes] +_Marker: TypeAlias = tuple[int, int, bytes] class Aifc_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def initfp(self, file: IO[bytes]) -> None: ... def getfp(self) -> IO[bytes]: ... @@ -45,7 +50,7 @@ class Aifc_write: def __del__(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def initfp(self, file: IO[bytes]) -> None: ... def aiff(self) -> None: ... @@ -61,7 +66,7 @@ class Aifc_write: def setcomptype(self, comptype: bytes, compname: bytes) -> None: ... def getcomptype(self) -> bytes: ... def getcompname(self) -> bytes: ... - def setparams(self, params: Tuple[int, int, int, int, bytes, bytes]) -> None: ... + def setparams(self, params: tuple[int, int, int, int, bytes, bytes]) -> None: ... def getparams(self) -> _aifc_params: ... def setmark(self, id: int, pos: int, name: bytes) -> None: ... def getmark(self, id: int) -> _Marker: ... diff --git a/stdlib/antigravity.pyi b/stdlib/antigravity.pyi index e309175..3986e7d 100644 --- a/stdlib/antigravity.pyi +++ b/stdlib/antigravity.pyi @@ -1 +1,3 @@ -def geohash(latitude: float, longitude: float, datedow: bytes) -> None: ... +from _typeshed import ReadableBuffer + +def geohash(latitude: float, longitude: float, datedow: ReadableBuffer) -> None: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 631030e..1bdcace 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -1,16 +1,54 @@ import sys -from typing import IO, Any, Callable, Generator, Iterable, NoReturn, Pattern, Protocol, Sequence, Tuple, Type, TypeVar, overload +from collections.abc import Callable, Generator, Iterable, Sequence +from re import Pattern +from typing import IO, Any, Generic, NewType, NoReturn, Protocol, TypeVar, overload +from typing_extensions import Literal, TypeAlias + +__all__ = [ + "ArgumentParser", + "ArgumentError", + "ArgumentTypeError", + "FileType", + "HelpFormatter", + "ArgumentDefaultsHelpFormatter", + "RawDescriptionHelpFormatter", + "RawTextHelpFormatter", + "MetavarTypeHelpFormatter", + "Namespace", + "Action", + "ONE_OR_MORE", + "OPTIONAL", + "PARSER", + "REMAINDER", + "SUPPRESS", + "ZERO_OR_MORE", +] + +if sys.version_info >= (3, 9): + __all__ += ["BooleanOptionalAction"] _T = TypeVar("_T") _ActionT = TypeVar("_ActionT", bound=Action) +_ArgumentParserT = TypeVar("_ArgumentParserT", bound=ArgumentParser) _N = TypeVar("_N") +# more precisely, Literal["store", "store_const", "store_true", +# "store_false", "append", "append_const", "count", "help", "version", +# "extend"], but using this would make it hard to annotate callers +# that don't use a literal argument +_ActionStr: TypeAlias = str +# more precisely, Literal["?", "*", "+", "...", "A...", +# "==SUPPRESS=="], but using this would make it hard to annotate +# callers that don't use a literal argument +_NArgsStr: TypeAlias = str -ONE_OR_MORE: str -OPTIONAL: str -PARSER: str -REMAINDER: str -SUPPRESS: str -ZERO_OR_MORE: str +ONE_OR_MORE: Literal["+"] +OPTIONAL: Literal["?"] +PARSER: Literal["A..."] +REMAINDER: Literal["..."] +_SUPPRESS_T = NewType("_SUPPRESS_T", str) +SUPPRESS: _SUPPRESS_T | str # not using Literal because argparse sometimes compares SUPPRESS with is +# the | str is there so that foo = argparse.SUPPRESS; foo = "test" checks out in mypy +ZERO_OR_MORE: Literal["*"] _UNRECOGNIZED_ARGS_ATTR: str # undocumented class ArgumentError(Exception): @@ -20,7 +58,7 @@ class ArgumentError(Exception): # undocumented class _AttributeHolder: - def _get_kwargs(self) -> list[Tuple[str, Any]]: ... + def _get_kwargs(self) -> list[tuple[str, Any]]: ... def _get_args(self) -> list[Any]: ... # undocumented @@ -46,15 +84,15 @@ class _ActionsContainer: def add_argument( self, *name_or_flags: str, - action: str | Type[Action] = ..., - nargs: int | str = ..., + action: _ActionStr | type[Action] = ..., + nargs: int | _NArgsStr | _SUPPRESS_T = ..., const: Any = ..., default: Any = ..., - type: Callable[[str], _T] | Callable[[str], _T] | FileType = ..., + type: Callable[[str], _T] | FileType = ..., choices: Iterable[_T] | None = ..., required: bool = ..., help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., + metavar: str | tuple[str, ...] | None = ..., dest: str | None = ..., version: str = ..., **kwargs: Any, @@ -66,11 +104,11 @@ class _ActionsContainer: def _add_container_actions(self, container: _ActionsContainer) -> None: ... def _get_positional_kwargs(self, dest: str, **kwargs: Any) -> dict[str, Any]: ... def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... - def _pop_action_class(self, kwargs: Any, default: Type[Action] | None = ...) -> Type[Action]: ... - def _get_handler(self) -> Callable[[Action, Iterable[Tuple[str, Action]]], Any]: ... + def _pop_action_class(self, kwargs: Any, default: type[Action] | None = ...) -> type[Action]: ... + def _get_handler(self) -> Callable[[Action, Iterable[tuple[str, Action]]], Any]: ... def _check_conflict(self, action: Action) -> None: ... - def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[str, Action]]) -> NoReturn: ... - def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[str, Action]]) -> None: ... + def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> NoReturn: ... + def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> None: ... class _FormatterClass(Protocol): def __call__(self, prog: str) -> HelpFormatter: ... @@ -89,6 +127,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): _optionals: _ArgumentGroup _subparsers: _ArgumentGroup | None + # Note: the constructor arguments are also used in _SubParsersAction.add_parser. if sys.version_info >= (3, 9): def __init__( self, @@ -127,66 +166,65 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): @overload def parse_args(self, args: Sequence[str] | None = ...) -> Namespace: ... @overload - def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore + def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc] @overload def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ... @overload - def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore + def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc] @overload def parse_args(self, *, namespace: _N) -> _N: ... - if sys.version_info >= (3, 7): - def add_subparsers( - self, - *, - title: str = ..., - description: str | None = ..., - prog: str = ..., - parser_class: Type[ArgumentParser] = ..., - action: Type[Action] = ..., - option_string: str = ..., - dest: str | None = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | None = ..., - ) -> _SubParsersAction: ... - else: - def add_subparsers( - self, - *, - title: str = ..., - description: str | None = ..., - prog: str = ..., - parser_class: Type[ArgumentParser] = ..., - action: Type[Action] = ..., - option_string: str = ..., - dest: str | None = ..., - help: str | None = ..., - metavar: str | None = ..., - ) -> _SubParsersAction: ... + @overload + def add_subparsers( + self: _ArgumentParserT, + *, + title: str = ..., + description: str | None = ..., + prog: str = ..., + action: type[Action] = ..., + option_string: str = ..., + dest: str | None = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | None = ..., + ) -> _SubParsersAction[_ArgumentParserT]: ... + @overload + def add_subparsers( + self, + *, + title: str = ..., + description: str | None = ..., + prog: str = ..., + parser_class: type[_ArgumentParserT], + action: type[Action] = ..., + option_string: str = ..., + dest: str | None = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | None = ..., + ) -> _SubParsersAction[_ArgumentParserT]: ... def print_usage(self, file: IO[str] | None = ...) -> None: ... def print_help(self, file: IO[str] | None = ...) -> None: ... def format_usage(self) -> str: ... def format_help(self) -> str: ... def parse_known_args( self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... - ) -> Tuple[Namespace, list[str]]: ... + ) -> tuple[Namespace, list[str]]: ... def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ... def exit(self, status: int = ..., message: str | None = ...) -> NoReturn: ... def error(self, message: str) -> NoReturn: ... - if sys.version_info >= (3, 7): - def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ... - def parse_known_intermixed_args( - self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... - ) -> Tuple[Namespace, list[str]]: ... + def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ... + def parse_known_intermixed_args( + self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... + ) -> tuple[Namespace, list[str]]: ... # undocumented def _get_optional_actions(self) -> list[Action]: ... def _get_positional_actions(self) -> list[Action]: ... - def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> Tuple[Namespace, list[str]]: ... + def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> tuple[Namespace, list[str]]: ... def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ... def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ... def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ... - def _parse_optional(self, arg_string: str) -> Tuple[Action | None, str, str | None] | None: ... - def _get_option_tuples(self, option_string: str) -> list[Tuple[Action, str, str | None]]: ... + def _parse_optional(self, arg_string: str) -> tuple[Action | None, str, str | None] | None: ... + def _get_option_tuples(self, option_string: str) -> list[tuple[Action, str, str | None]]: ... def _get_nargs_pattern(self, action: Action) -> str: ... def _get_values(self, action: Action, arg_strings: list[str]) -> Any: ... def _get_value(self, action: Action, arg_string: str) -> Any: ... @@ -207,7 +245,7 @@ class HelpFormatter: _current_section: Any _whitespace_matcher: Pattern[str] _long_break_matcher: Pattern[str] - _Section: Type[Any] # Nested class + _Section: type[Any] # Nested class def __init__(self, prog: str, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ...) -> None: ... def _indent(self) -> None: ... def _dedent(self) -> None: ... @@ -223,13 +261,13 @@ class HelpFormatter: def format_help(self) -> str: ... def _join_parts(self, part_strings: Iterable[str]) -> str: ... def _format_usage( - self, usage: str, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None + self, usage: str | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None ) -> str: ... def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> str: ... def _format_text(self, text: str) -> str: ... def _format_action(self, action: Action) -> str: ... def _format_action_invocation(self, action: Action) -> str: ... - def _metavar_formatter(self, action: Action, default_metavar: str) -> Callable[[int], Tuple[str, ...]]: ... + def _metavar_formatter(self, action: Action, default_metavar: str) -> Callable[[int], tuple[str, ...]]: ... def _format_args(self, action: Action, default_metavar: str) -> str: ... def _expand_help(self, action: Action) -> str: ... def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ... @@ -254,7 +292,7 @@ class Action(_AttributeHolder): choices: Iterable[Any] | None required: bool help: str | None - metavar: str | Tuple[str, ...] | None + metavar: str | tuple[str, ...] | None def __init__( self, option_strings: Sequence[str], @@ -262,11 +300,11 @@ class Action(_AttributeHolder): nargs: int | str | None = ..., const: _T | None = ..., default: _T | str | None = ..., - type: Callable[[str], _T] | Callable[[str], _T] | FileType | None = ..., + type: Callable[[str], _T] | FileType | None = ..., choices: Iterable[_T] | None = ..., required: bool = ..., help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., + metavar: str | tuple[str, ...] | None = ..., ) -> None: ... def __call__( self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = ... @@ -281,18 +319,19 @@ if sys.version_info >= (3, 9): option_strings: Sequence[str], dest: str, default: _T | str | None = ..., - type: Callable[[str], _T] | Callable[[str], _T] | FileType | None = ..., + type: Callable[[str], _T] | FileType | None = ..., choices: Iterable[_T] | None = ..., required: bool = ..., help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., + metavar: str | tuple[str, ...] | None = ..., ) -> None: ... class Namespace(_AttributeHolder): def __init__(self, **kwargs: Any) -> None: ... def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... + def __setattr__(self, __name: str, __value: Any) -> None: ... def __contains__(self, key: str) -> bool: ... + def __eq__(self, other: object) -> bool: ... class FileType: # undocumented @@ -322,16 +361,28 @@ class _StoreAction(Action): ... # undocumented class _StoreConstAction(Action): - def __init__( - self, - option_strings: Sequence[str], - dest: str, - const: Any, - default: Any = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., - ) -> None: ... + if sys.version_info >= (3, 11): + def __init__( + self, + option_strings: Sequence[str], + dest: str, + const: Any | None = ..., + default: Any = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | tuple[str, ...] | None = ..., + ) -> None: ... + else: + def __init__( + self, + option_strings: Sequence[str], + dest: str, + const: Any, + default: Any = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | tuple[str, ...] | None = ..., + ) -> None: ... # undocumented class _StoreTrueAction(_StoreConstAction): @@ -348,18 +399,34 @@ class _StoreFalseAction(_StoreConstAction): # undocumented class _AppendAction(Action): ... +# undocumented +if sys.version_info >= (3, 8): + class _ExtendAction(_AppendAction): ... + # undocumented class _AppendConstAction(Action): - def __init__( - self, - option_strings: Sequence[str], - dest: str, - const: Any, - default: Any = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., - ) -> None: ... + if sys.version_info >= (3, 11): + def __init__( + self, + option_strings: Sequence[str], + dest: str, + const: Any | None = ..., + default: Any = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | tuple[str, ...] | None = ..., + ) -> None: ... + else: + def __init__( + self, + option_strings: Sequence[str], + dest: str, + const: Any, + default: Any = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | tuple[str, ...] | None = ..., + ) -> None: ... # undocumented class _CountAction(Action): @@ -379,44 +446,74 @@ class _VersionAction(Action): ) -> None: ... # undocumented -class _SubParsersAction(Action): - _ChoicesPseudoAction: Type[Any] # nested class +class _SubParsersAction(Action, Generic[_ArgumentParserT]): + _ChoicesPseudoAction: type[Any] # nested class _prog_prefix: str - _parser_class: Type[ArgumentParser] - _name_parser_map: dict[str, ArgumentParser] - choices: dict[str, ArgumentParser] + _parser_class: type[_ArgumentParserT] + _name_parser_map: dict[str, _ArgumentParserT] + choices: dict[str, _ArgumentParserT] _choices_actions: list[Action] - if sys.version_info >= (3, 7): - def __init__( + def __init__( + self, + option_strings: Sequence[str], + prog: str, + parser_class: type[_ArgumentParserT], + dest: str = ..., + required: bool = ..., + help: str | None = ..., + metavar: str | tuple[str, ...] | None = ..., + ) -> None: ... + + # Note: `add_parser` accepts all kwargs of `ArgumentParser.__init__`. It also + # accepts its own `help` and `aliases` kwargs. + if sys.version_info >= (3, 9): + def add_parser( self, - option_strings: Sequence[str], - prog: str, - parser_class: Type[ArgumentParser], - dest: str = ..., - required: bool = ..., + name: str, + *, help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., - ) -> None: ... + aliases: Sequence[str] = ..., + # Kwargs from ArgumentParser constructor + prog: str | None = ..., + usage: str | None = ..., + description: str | None = ..., + epilog: str | None = ..., + parents: Sequence[_ArgumentParserT] = ..., + formatter_class: _FormatterClass = ..., + prefix_chars: str = ..., + fromfile_prefix_chars: str | None = ..., + argument_default: Any = ..., + conflict_handler: str = ..., + add_help: bool = ..., + allow_abbrev: bool = ..., + exit_on_error: bool = ..., + ) -> _ArgumentParserT: ... else: - def __init__( + def add_parser( self, - option_strings: Sequence[str], - prog: str, - parser_class: Type[ArgumentParser], - dest: str = ..., + name: str, + *, help: str | None = ..., - metavar: str | Tuple[str, ...] | None = ..., - ) -> None: ... - # TODO: Type keyword args properly. - def add_parser(self, name: str, **kwargs: Any) -> ArgumentParser: ... + aliases: Sequence[str] = ..., + # Kwargs from ArgumentParser constructor + prog: str | None = ..., + usage: str | None = ..., + description: str | None = ..., + epilog: str | None = ..., + parents: Sequence[_ArgumentParserT] = ..., + formatter_class: _FormatterClass = ..., + prefix_chars: str = ..., + fromfile_prefix_chars: str | None = ..., + argument_default: Any = ..., + conflict_handler: str = ..., + add_help: bool = ..., + allow_abbrev: bool = ..., + ) -> _ArgumentParserT: ... + def _get_subactions(self) -> list[Action]: ... # undocumented class ArgumentTypeError(Exception): ... -if sys.version_info < (3, 7): - # undocumented - def _ensure_value(namespace: Namespace, name: str, value: Any) -> Any: ... - # undocumented def _get_action_name(argument: Action | None) -> str | None: ... diff --git a/stdlib/array.pyi b/stdlib/array.pyi index c32136d..e844560 100644 --- a/stdlib/array.pyi +++ b/stdlib/array.pyi @@ -1,69 +1,84 @@ import sys -from typing import Any, BinaryIO, Generic, Iterable, MutableSequence, Tuple, TypeVar, Union, overload -from typing_extensions import Literal +from _typeshed import ReadableBuffer, Self, SupportsRead, SupportsWrite +from collections.abc import Iterable -_IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] -_FloatTypeCode = Literal["f", "d"] -_UnicodeTypeCode = Literal["u"] -_TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode] +# pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence +from typing import Any, Generic, MutableSequence, TypeVar, overload # noqa: Y027 +from typing_extensions import Literal, SupportsIndex, TypeAlias + +_IntTypeCode: TypeAlias = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] +_FloatTypeCode: TypeAlias = Literal["f", "d"] +_UnicodeTypeCode: TypeAlias = Literal["u"] +_TypeCode: TypeAlias = _IntTypeCode | _FloatTypeCode | _UnicodeTypeCode _T = TypeVar("_T", int, float, str) typecodes: str class array(MutableSequence[_T], Generic[_T]): - typecode: _TypeCode - itemsize: int + @property + def typecode(self) -> _TypeCode: ... + @property + def itemsize(self) -> int: ... + @overload + def __init__(self: array[int], __typecode: _IntTypeCode, __initializer: bytes | bytearray | Iterable[int] = ...) -> None: ... @overload - def __init__(self: array[int], typecode: _IntTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ... + def __init__( + self: array[float], __typecode: _FloatTypeCode, __initializer: bytes | bytearray | Iterable[float] = ... + ) -> None: ... @overload - def __init__(self: array[float], typecode: _FloatTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ... + def __init__( + self: array[str], __typecode: _UnicodeTypeCode, __initializer: bytes | bytearray | Iterable[str] = ... + ) -> None: ... @overload - def __init__(self: array[str], typecode: _UnicodeTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ... + def __init__(self, __typecode: str, __initializer: Iterable[_T]) -> None: ... @overload - def __init__(self, typecode: str, __initializer: bytes | Iterable[_T] = ...) -> None: ... + def __init__(self, __typecode: str, __initializer: bytes | bytearray = ...) -> None: ... def append(self, __v: _T) -> None: ... - def buffer_info(self) -> Tuple[int, int]: ... + def buffer_info(self) -> tuple[int, int]: ... def byteswap(self) -> None: ... - def count(self, __v: Any) -> int: ... + def count(self, __v: _T) -> int: ... def extend(self, __bb: Iterable[_T]) -> None: ... - def frombytes(self, __buffer: bytes) -> None: ... - def fromfile(self, __f: BinaryIO, __n: int) -> None: ... + def frombytes(self, __buffer: ReadableBuffer) -> None: ... + def fromfile(self, __f: SupportsRead[bytes], __n: int) -> None: ... def fromlist(self, __list: list[_T]) -> None: ... def fromunicode(self, __ustr: str) -> None: ... if sys.version_info >= (3, 10): def index(self, __v: _T, __start: int = ..., __stop: int = ...) -> int: ... else: - def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence + def index(self, __v: _T) -> int: ... # type: ignore[override] + def insert(self, __i: int, __v: _T) -> None: ... def pop(self, __i: int = ...) -> _T: ... - def remove(self, __v: Any) -> None: ... - def reverse(self) -> None: ... + def remove(self, __v: _T) -> None: ... def tobytes(self) -> bytes: ... - def tofile(self, __f: BinaryIO) -> None: ... + def tofile(self, __f: SupportsWrite[bytes]) -> None: ... def tolist(self) -> list[_T]: ... def tounicode(self) -> str: ... if sys.version_info < (3, 9): - def fromstring(self, __buffer: bytes) -> None: ... + def fromstring(self, __buffer: str | ReadableBuffer) -> None: ... def tostring(self) -> bytes: ... + def __len__(self) -> int: ... @overload - def __getitem__(self, i: int) -> _T: ... + def __getitem__(self, __i: SupportsIndex) -> _T: ... @overload - def __getitem__(self, s: slice) -> array[_T]: ... - @overload # type: ignore # Overrides MutableSequence - def __setitem__(self, i: int, o: _T) -> None: ... + def __getitem__(self, __s: slice) -> array[_T]: ... + @overload # type: ignore[override] + def __setitem__(self, __i: SupportsIndex, __o: _T) -> None: ... @overload - def __setitem__(self, s: slice, o: array[_T]) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __add__(self, x: array[_T]) -> array[_T]: ... - def __ge__(self, other: array[_T]) -> bool: ... - def __gt__(self, other: array[_T]) -> bool: ... - def __iadd__(self, x: array[_T]) -> array[_T]: ... # type: ignore # Overrides MutableSequence - def __imul__(self, n: int) -> array[_T]: ... - def __le__(self, other: array[_T]) -> bool: ... - def __lt__(self, other: array[_T]) -> bool: ... - def __mul__(self, n: int) -> array[_T]: ... - def __rmul__(self, n: int) -> array[_T]: ... + def __setitem__(self, __s: slice, __o: array[_T]) -> None: ... + def __delitem__(self, __i: SupportsIndex | slice) -> None: ... + def __add__(self, __x: array[_T]) -> array[_T]: ... + def __ge__(self, __other: array[_T]) -> bool: ... + def __gt__(self, __other: array[_T]) -> bool: ... + def __iadd__(self: Self, __x: array[_T]) -> Self: ... # type: ignore[override] + def __imul__(self: Self, __n: int) -> Self: ... + def __le__(self, __other: array[_T]) -> bool: ... + def __lt__(self, __other: array[_T]) -> bool: ... + def __mul__(self, __n: int) -> array[_T]: ... + def __rmul__(self, __n: int) -> array[_T]: ... + def __copy__(self) -> array[_T]: ... + def __deepcopy__(self, __unused: Any) -> array[_T]: ... ArrayType = array diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 1649e4a..56c86c9 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -1,31 +1,31 @@ -# Rename typing to _typing, as not to conflict with typing imported -# from _ast below when loaded in an unorthodox way by the Dropbox -# internal Bazel integration. - -# The same unorthodox Bazel integration causes issues with sys, which -# is imported in both modules. unfortunately we can't just rename sys, -# since mypy only supports version checks with a sys that is named -# sys. +import os import sys -import typing as _typing -from typing import Any, Iterator, TypeVar, overload +from _ast import * +from _typeshed import ReadableBuffer +from collections.abc import Iterator +from typing import Any, TypeVar, overload from typing_extensions import Literal -from _ast import * # type: ignore - if sys.version_info >= (3, 8): - class Num(Constant): + class _ABC(type): + if sys.version_info >= (3, 9): + def __init__(cls, *args: object) -> None: ... + + class Num(Constant, metaclass=_ABC): value: complex - class Str(Constant): + + class Str(Constant, metaclass=_ABC): value: str # Aliases for value, for backwards compatibility s: str - class Bytes(Constant): + + class Bytes(Constant, metaclass=_ABC): value: bytes # Aliases for value, for backwards compatibility s: bytes - class NameConstant(Constant): ... - class Ellipsis(Constant): ... + + class NameConstant(Constant, metaclass=_ABC): ... + class Ellipsis(Constant, metaclass=_ABC): ... if sys.version_info >= (3, 9): class slice(AST): ... @@ -89,6 +89,7 @@ class NodeVisitor: def visit_Constant(self, node: Constant) -> Any: ... if sys.version_info >= (3, 8): def visit_NamedExpr(self, node: NamedExpr) -> Any: ... + def visit_Attribute(self, node: Attribute) -> Any: ... def visit_Subscript(self, node: Subscript) -> Any: ... def visit_Starred(self, node: Starred) -> Any: ... @@ -158,28 +159,93 @@ _T = TypeVar("_T", bound=AST) if sys.version_info >= (3, 8): @overload def parse( - source: str | bytes, - filename: str | bytes = ..., + source: str | ReadableBuffer, + filename: str | ReadableBuffer | os.PathLike[Any] = ..., mode: Literal["exec"] = ..., *, type_comments: bool = ..., - feature_version: None | int | _typing.Tuple[int, int] = ..., + feature_version: None | int | tuple[int, int] = ..., ) -> Module: ... @overload def parse( - source: str | bytes, - filename: str | bytes = ..., + source: str | ReadableBuffer, + filename: str | ReadableBuffer | os.PathLike[Any], + mode: Literal["eval"], + *, + type_comments: bool = ..., + feature_version: None | int | tuple[int, int] = ..., + ) -> Expression: ... + @overload + def parse( + source: str | ReadableBuffer, + filename: str | ReadableBuffer | os.PathLike[Any], + mode: Literal["func_type"], + *, + type_comments: bool = ..., + feature_version: None | int | tuple[int, int] = ..., + ) -> FunctionType: ... + @overload + def parse( + source: str | ReadableBuffer, + filename: str | ReadableBuffer | os.PathLike[Any], + mode: Literal["single"], + *, + type_comments: bool = ..., + feature_version: None | int | tuple[int, int] = ..., + ) -> Interactive: ... + @overload + def parse( + source: str | ReadableBuffer, + *, + mode: Literal["eval"], + type_comments: bool = ..., + feature_version: None | int | tuple[int, int] = ..., + ) -> Expression: ... + @overload + def parse( + source: str | ReadableBuffer, + *, + mode: Literal["func_type"], + type_comments: bool = ..., + feature_version: None | int | tuple[int, int] = ..., + ) -> FunctionType: ... + @overload + def parse( + source: str | ReadableBuffer, + *, + mode: Literal["single"], + type_comments: bool = ..., + feature_version: None | int | tuple[int, int] = ..., + ) -> Interactive: ... + @overload + def parse( + source: str | ReadableBuffer, + filename: str | ReadableBuffer | os.PathLike[Any] = ..., mode: str = ..., *, type_comments: bool = ..., - feature_version: None | int | _typing.Tuple[int, int] = ..., + feature_version: None | int | tuple[int, int] = ..., ) -> AST: ... else: @overload - def parse(source: str | bytes, filename: str | bytes = ..., mode: Literal["exec"] = ...) -> Module: ... + def parse( + source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any] = ..., mode: Literal["exec"] = ... + ) -> Module: ... + @overload + def parse( + source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any], mode: Literal["eval"] + ) -> Expression: ... + @overload + def parse( + source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any], mode: Literal["single"] + ) -> Interactive: ... + @overload + def parse(source: str | ReadableBuffer, *, mode: Literal["eval"]) -> Expression: ... + @overload + def parse(source: str | ReadableBuffer, *, mode: Literal["single"]) -> Interactive: ... @overload - def parse(source: str | bytes, filename: str | bytes = ..., mode: str = ...) -> AST: ... + def parse(source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any] = ..., mode: str = ...) -> AST: ... if sys.version_info >= (3, 9): def unparse(ast_obj: AST) -> str: ... @@ -198,10 +264,13 @@ def fix_missing_locations(node: _T) -> _T: ... def get_docstring(node: AST, clean: bool = ...) -> str | None: ... def increment_lineno(node: _T, n: int = ...) -> _T: ... def iter_child_nodes(node: AST) -> Iterator[AST]: ... -def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ... +def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ... def literal_eval(node_or_string: str | AST) -> Any: ... if sys.version_info >= (3, 8): def get_source_segment(source: str, node: AST, *, padded: bool = ...) -> str | None: ... def walk(node: AST) -> Iterator[AST]: ... + +if sys.version_info >= (3, 9): + def main() -> None: ... diff --git a/stdlib/asynchat.pyi b/stdlib/asynchat.pyi index e1787ca..4d43b02 100644 --- a/stdlib/asynchat.pyi +++ b/stdlib/asynchat.pyi @@ -1,5 +1,4 @@ import asyncore -import socket from abc import abstractmethod class simple_producer: @@ -9,20 +8,14 @@ class simple_producer: class async_chat(asyncore.dispatcher): ac_in_buffer_size: int ac_out_buffer_size: int - def __init__(self, sock: socket.socket | None = ..., map: asyncore._maptype | None = ...) -> None: ... @abstractmethod def collect_incoming_data(self, data: bytes) -> None: ... @abstractmethod def found_terminator(self) -> None: ... def set_terminator(self, term: bytes | int | None) -> None: ... def get_terminator(self) -> bytes | int | None: ... - def handle_read(self) -> None: ... - def handle_write(self) -> None: ... - def handle_close(self) -> None: ... def push(self, data: bytes) -> None: ... def push_with_producer(self, producer: simple_producer) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... def close_when_done(self) -> None: ... def initiate_send(self) -> None: ... def discard_buffers(self) -> None: ... diff --git a/stdlib/asyncio/__init__.pyi b/stdlib/asyncio/__init__.pyi index 42e7aa9..4afcd37 100644 --- a/stdlib/asyncio/__init__.pyi +++ b/stdlib/asyncio/__init__.pyi @@ -1,116 +1,30 @@ import sys -from typing import Type -from .base_events import BaseEventLoop as BaseEventLoop -from .coroutines import coroutine as coroutine, iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction -from .events import ( - AbstractEventLoop as AbstractEventLoop, - AbstractEventLoopPolicy as AbstractEventLoopPolicy, - AbstractServer as AbstractServer, - Handle as Handle, - TimerHandle as TimerHandle, - _get_running_loop as _get_running_loop, - _set_running_loop as _set_running_loop, - get_child_watcher as get_child_watcher, - get_event_loop as get_event_loop, - get_event_loop_policy as get_event_loop_policy, - new_event_loop as new_event_loop, - set_child_watcher as set_child_watcher, - set_event_loop as set_event_loop, - set_event_loop_policy as set_event_loop_policy, -) -from .futures import Future as Future, isfuture as isfuture, wrap_future as wrap_future -from .locks import ( - BoundedSemaphore as BoundedSemaphore, - Condition as Condition, - Event as Event, - Lock as Lock, - Semaphore as Semaphore, -) -from .protocols import ( - BaseProtocol as BaseProtocol, - DatagramProtocol as DatagramProtocol, - Protocol as Protocol, - SubprocessProtocol as SubprocessProtocol, -) -from .queues import ( - LifoQueue as LifoQueue, - PriorityQueue as PriorityQueue, - Queue as Queue, - QueueEmpty as QueueEmpty, - QueueFull as QueueFull, -) -from .streams import ( - StreamReader as StreamReader, - StreamReaderProtocol as StreamReaderProtocol, - StreamWriter as StreamWriter, - open_connection as open_connection, - start_server as start_server, -) -from .subprocess import create_subprocess_exec as create_subprocess_exec, create_subprocess_shell as create_subprocess_shell -from .tasks import ( - ALL_COMPLETED as ALL_COMPLETED, - FIRST_COMPLETED as FIRST_COMPLETED, - FIRST_EXCEPTION as FIRST_EXCEPTION, - Task as Task, - as_completed as as_completed, - ensure_future as ensure_future, - gather as gather, - run_coroutine_threadsafe as run_coroutine_threadsafe, - shield as shield, - sleep as sleep, - wait as wait, - wait_for as wait_for, -) -from .transports import ( - BaseTransport as BaseTransport, - DatagramTransport as DatagramTransport, - ReadTransport as ReadTransport, - SubprocessTransport as SubprocessTransport, - Transport as Transport, - WriteTransport as WriteTransport, -) +# As at runtime, this depends on all submodules defining __all__ accurately. +from .base_events import * +from .coroutines import * +from .events import * +from .futures import * +from .locks import * +from .protocols import * +from .queues import * +from .runners import * +from .streams import * +from .subprocess import * +from .tasks import * +from .transports import * -if sys.version_info >= (3, 7): - from .events import get_running_loop as get_running_loop if sys.version_info >= (3, 8): - from .exceptions import ( - CancelledError as CancelledError, - IncompleteReadError as IncompleteReadError, - InvalidStateError as InvalidStateError, - LimitOverrunError as LimitOverrunError, - SendfileNotAvailableError as SendfileNotAvailableError, - TimeoutError as TimeoutError, - ) -else: - if sys.version_info >= (3, 7): - from .events import SendfileNotAvailableError as SendfileNotAvailableError - from .futures import CancelledError as CancelledError, InvalidStateError as InvalidStateError, TimeoutError as TimeoutError - from .streams import IncompleteReadError as IncompleteReadError, LimitOverrunError as LimitOverrunError - -if sys.version_info >= (3, 7): - from .protocols import BufferedProtocol as BufferedProtocol + from .exceptions import * -if sys.version_info >= (3, 7): - from .runners import run as run - -if sys.version_info >= (3, 7): - from .tasks import all_tasks as all_tasks, create_task as create_task, current_task as current_task if sys.version_info >= (3, 9): - from .threads import to_thread as to_thread + from .threads import * + +if sys.version_info >= (3, 11): + from .taskgroups import * + from .timeouts import * -DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy] if sys.platform == "win32": from .windows_events import * - -if sys.platform != "win32": - from .streams import open_unix_connection as open_unix_connection, start_unix_server as start_unix_server - from .unix_events import ( - AbstractChildWatcher as AbstractChildWatcher, - FastChildWatcher as FastChildWatcher, - SafeChildWatcher as SafeChildWatcher, - SelectorEventLoop as SelectorEventLoop, - ) - - if sys.version_info >= (3, 8): - from .unix_events import MultiLoopChildWatcher as MultiLoopChildWatcher, ThreadedChildWatcher as ThreadedChildWatcher +else: + from .unix_events import * diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 3490502..c1ab114 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -1,29 +1,31 @@ import ssl import sys -from _typeshed import FileDescriptorLike -from abc import ABCMeta -from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle +from _typeshed import FileDescriptorLike, ReadableBuffer, WriteableBuffer +from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle, _TaskFactory from asyncio.futures import Future from asyncio.protocols import BaseProtocol from asyncio.tasks import Task -from asyncio.transports import BaseTransport -from collections.abc import Iterable +from asyncio.transports import BaseTransport, ReadTransport, SubprocessTransport, WriteTransport +from collections.abc import Awaitable, Callable, Coroutine, Generator, Iterable, Sequence +from contextvars import Context from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket -from typing import IO, Any, Awaitable, Callable, Dict, Generator, Sequence, Tuple, TypeVar, Union, overload -from typing_extensions import Literal +from typing import IO, Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias -if sys.version_info >= (3, 7): - from contextvars import Context +if sys.version_info >= (3, 9): + __all__ = ("BaseEventLoop", "Server") +else: + __all__ = ("BaseEventLoop",) _T = TypeVar("_T") -_Context = Dict[str, Any] -_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any] -_ProtocolFactory = Callable[[], BaseProtocol] -_SSLContext = Union[bool, None, ssl.SSLContext] -_TransProtPair = Tuple[BaseTransport, BaseProtocol] +_ProtocolT = TypeVar("_ProtocolT", bound=BaseProtocol) +_Context: TypeAlias = dict[str, Any] +_ExceptionHandler: TypeAlias = Callable[[AbstractEventLoop, _Context], object] +_ProtocolFactory: TypeAlias = Callable[[], BaseProtocol] +_SSLContext: TypeAlias = bool | None | ssl.SSLContext class Server(AbstractServer): - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 11): def __init__( self, loop: AbstractEventLoop, @@ -32,19 +34,34 @@ class Server(AbstractServer): ssl_context: _SSLContext, backlog: int, ssl_handshake_timeout: float | None, + ssl_shutdown_timeout: float | None = ..., ) -> None: ... else: - def __init__(self, loop: AbstractEventLoop, sockets: list[socket]) -> None: ... + def __init__( + self, + loop: AbstractEventLoop, + sockets: Iterable[socket], + protocol_factory: _ProtocolFactory, + ssl_context: _SSLContext, + backlog: int, + ssl_handshake_timeout: float | None, + ) -> None: ... + + def get_loop(self) -> AbstractEventLoop: ... + def is_serving(self) -> bool: ... + async def start_serving(self) -> None: ... + async def serve_forever(self) -> None: ... if sys.version_info >= (3, 8): @property - def sockets(self) -> Tuple[socket, ...]: ... - elif sys.version_info >= (3, 7): + def sockets(self) -> tuple[socket, ...]: ... + else: @property def sockets(self) -> list[socket]: ... - else: - sockets: list[socket] | None -class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): + def close(self) -> None: ... + async def wait_closed(self) -> None: ... + +class BaseEventLoop(AbstractEventLoop): def run_forever(self) -> None: ... # Can't use a union, see mypy issue # 1873. @overload @@ -57,45 +74,47 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): def close(self) -> None: ... async def shutdown_asyncgens(self) -> None: ... # Methods scheduling callbacks. All these return Handles. - if sys.version_info >= (3, 7): - def call_soon(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ... - def call_later( - self, delay: float, callback: Callable[..., Any], *args: Any, context: Context | None = ... - ) -> TimerHandle: ... - def call_at( - self, when: float, callback: Callable[..., Any], *args: Any, context: Context | None = ... - ) -> TimerHandle: ... - else: - def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ... - def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... - def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... + def call_soon(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + def call_later( + self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = ... + ) -> TimerHandle: ... + def call_at(self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> TimerHandle: ... def time(self) -> float: ... # Future methods def create_future(self) -> Future[Any]: ... # Tasks methods - if sys.version_info >= (3, 8): - def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T], *, name: object = ...) -> Task[_T]: ... + if sys.version_info >= (3, 11): + def create_task( + self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = ..., context: Context | None = ... + ) -> Task[_T]: ... + elif sys.version_info >= (3, 8): + def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = ...) -> Task[_T]: ... else: - def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T]) -> Task[_T]: ... - def set_task_factory(self, factory: Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None) -> None: ... - def get_task_factory(self) -> Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None: ... + def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T]) -> Task[_T]: ... + + def set_task_factory(self, factory: _TaskFactory | None) -> None: ... + def get_task_factory(self) -> _TaskFactory | None: ... # Methods for interacting with threads - if sys.version_info >= (3, 7): - def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ... - else: - def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... + def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ... def set_default_executor(self, executor: Any) -> None: ... # Network I/O methods returning Futures. async def getaddrinfo( - self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ... - ) -> list[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ... - async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ... - if sys.version_info >= (3, 8): + self, + host: bytes | str | None, + port: bytes | str | int | None, + *, + family: int = ..., + type: int = ..., + proto: int = ..., + flags: int = ..., + ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... + async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = ...) -> tuple[str, str]: ... + if sys.version_info >= (3, 11): @overload async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: str = ..., port: int = ..., *, @@ -104,16 +123,17 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., happy_eyeballs_delay: float | None = ..., interleave: int | None = ..., - ) -> _TransProtPair: ... + ) -> tuple[BaseTransport, _ProtocolT]: ... @overload async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: None = ..., port: None = ..., *, @@ -125,14 +145,15 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): local_addr: None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., happy_eyeballs_delay: float | None = ..., interleave: int | None = ..., - ) -> _TransProtPair: ... - elif sys.version_info >= (3, 7): + ) -> tuple[BaseTransport, _ProtocolT]: ... + elif sys.version_info >= (3, 8): @overload async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: str = ..., port: int = ..., *, @@ -141,14 +162,16 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., - ) -> _TransProtPair: ... + happy_eyeballs_delay: float | None = ..., + interleave: int | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... @overload async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: None = ..., port: None = ..., *, @@ -160,12 +183,14 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): local_addr: None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., - ) -> _TransProtPair: ... + happy_eyeballs_delay: float | None = ..., + interleave: int | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... else: @overload async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: str = ..., port: int = ..., *, @@ -174,13 +199,14 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = ..., server_hostname: str | None = ..., - ) -> _TransProtPair: ... + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... @overload async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: None = ..., port: None = ..., *, @@ -191,11 +217,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): sock: socket, local_addr: None = ..., server_hostname: str | None = ..., - ) -> _TransProtPair: ... - if sys.version_info >= (3, 7): - async def sock_sendfile( - self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ... - ) -> int: ... + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + if sys.version_info >= (3, 11): @overload async def create_server( self, @@ -211,6 +235,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): reuse_address: bool | None = ..., reuse_port: bool | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., start_serving: bool = ..., ) -> Server: ... @overload @@ -228,19 +253,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): reuse_address: bool | None = ..., reuse_port: bool | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., start_serving: bool = ..., ) -> Server: ... - async def connect_accepted_socket( - self, - protocol_factory: _ProtocolFactory, - sock: socket, - *, - ssl: _SSLContext = ..., - ssl_handshake_timeout: float | None = ..., - ) -> _TransProtPair: ... - async def sendfile( - self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ... - ) -> int: ... async def start_tls( self, transport: BaseTransport, @@ -250,7 +265,17 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): server_side: bool = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., ) -> BaseTransport: ... + async def connect_accepted_socket( + self, + protocol_factory: Callable[[], _ProtocolT], + sock: socket, + *, + ssl: _SSLContext = ..., + ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... else: @overload async def create_server( @@ -266,6 +291,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): ssl: _SSLContext = ..., reuse_address: bool | None = ..., reuse_port: bool | None = ..., + ssl_handshake_timeout: float | None = ..., + start_serving: bool = ..., ) -> Server: ... @overload async def create_server( @@ -276,35 +303,78 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): *, family: int = ..., flags: int = ..., - sock: socket, + sock: socket = ..., backlog: int = ..., ssl: _SSLContext = ..., reuse_address: bool | None = ..., reuse_port: bool | None = ..., + ssl_handshake_timeout: float | None = ..., + start_serving: bool = ..., ) -> Server: ... + async def start_tls( + self, + transport: BaseTransport, + protocol: BaseProtocol, + sslcontext: ssl.SSLContext, + *, + server_side: bool = ..., + server_hostname: str | None = ..., + ssl_handshake_timeout: float | None = ..., + ) -> BaseTransport: ... async def connect_accepted_socket( - self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ... - ) -> _TransProtPair: ... - async def create_datagram_endpoint( - self, - protocol_factory: _ProtocolFactory, - local_addr: Tuple[str, int] | None = ..., - remote_addr: Tuple[str, int] | None = ..., - *, - family: int = ..., - proto: int = ..., - flags: int = ..., - reuse_address: bool | None = ..., - reuse_port: bool | None = ..., - allow_broadcast: bool | None = ..., - sock: socket | None = ..., - ) -> _TransProtPair: ... + self, + protocol_factory: Callable[[], _ProtocolT], + sock: socket, + *, + ssl: _SSLContext = ..., + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + + async def sock_sendfile( + self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ... + ) -> int: ... + async def sendfile( + self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ... + ) -> int: ... + if sys.version_info >= (3, 11): + async def create_datagram_endpoint( # type: ignore[override] + self, + protocol_factory: Callable[[], _ProtocolT], + local_addr: tuple[str, int] | None = ..., + remote_addr: tuple[str, int] | None = ..., + *, + family: int = ..., + proto: int = ..., + flags: int = ..., + reuse_port: bool | None = ..., + allow_broadcast: bool | None = ..., + sock: socket | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + else: + async def create_datagram_endpoint( + self, + protocol_factory: Callable[[], _ProtocolT], + local_addr: tuple[str, int] | None = ..., + remote_addr: tuple[str, int] | None = ..., + *, + family: int = ..., + proto: int = ..., + flags: int = ..., + reuse_address: bool | None = ..., + reuse_port: bool | None = ..., + allow_broadcast: bool | None = ..., + sock: socket | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... # Pipes and subprocesses. - async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ... - async def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ... + async def connect_read_pipe( + self, protocol_factory: Callable[[], _ProtocolT], pipe: Any + ) -> tuple[ReadTransport, _ProtocolT]: ... + async def connect_write_pipe( + self, protocol_factory: Callable[[], _ProtocolT], pipe: Any + ) -> tuple[WriteTransport, _ProtocolT]: ... async def subprocess_shell( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], cmd: bytes | str, *, stdin: int | IO[Any] | None = ..., @@ -317,10 +387,10 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): errors: None = ..., text: Literal[False, None] = ..., **kwargs: Any, - ) -> _TransProtPair: ... + ) -> tuple[SubprocessTransport, _ProtocolT]: ... async def subprocess_exec( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], program: Any, *args: Any, stdin: int | IO[Any] | None = ..., @@ -332,23 +402,22 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): encoding: None = ..., errors: None = ..., **kwargs: Any, - ) -> _TransProtPair: ... + ) -> tuple[SubprocessTransport, _ProtocolT]: ... def add_reader(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ... - def remove_reader(self, fd: FileDescriptorLike) -> None: ... + def remove_reader(self, fd: FileDescriptorLike) -> bool: ... def add_writer(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ... - def remove_writer(self, fd: FileDescriptorLike) -> None: ... - # Completion based I/O methods returning Futures prior to 3.7 - if sys.version_info >= (3, 7): - async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ... - async def sock_recv_into(self, sock: socket, buf: bytearray) -> int: ... - async def sock_sendall(self, sock: socket, data: bytes) -> None: ... - async def sock_connect(self, sock: socket, address: _Address) -> None: ... - async def sock_accept(self, sock: socket) -> Tuple[socket, _RetAddress]: ... - else: - def sock_recv(self, sock: socket, nbytes: int) -> Future[bytes]: ... - def sock_sendall(self, sock: socket, data: bytes) -> Future[None]: ... - def sock_connect(self, sock: socket, address: _Address) -> Future[None]: ... - def sock_accept(self, sock: socket) -> Future[Tuple[socket, _RetAddress]]: ... + def remove_writer(self, fd: FileDescriptorLike) -> bool: ... + # The sock_* methods (and probably some others) are not actually implemented on + # BaseEventLoop, only on subclasses. We list them here for now for convenience. + async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ... + async def sock_recv_into(self, sock: socket, buf: WriteableBuffer) -> int: ... + async def sock_sendall(self, sock: socket, data: ReadableBuffer) -> None: ... + async def sock_connect(self, sock: socket, address: _Address) -> None: ... + async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ... + if sys.version_info >= (3, 11): + async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ... + async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = ...) -> int: ... + async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> None: ... # Signal handling. def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ... def remove_signal_handler(self, sig: int) -> bool: ... diff --git a/stdlib/asyncio/base_futures.pyi b/stdlib/asyncio/base_futures.pyi index 1c5f03e..c51174e 100644 --- a/stdlib/asyncio/base_futures.pyi +++ b/stdlib/asyncio/base_futures.pyi @@ -1,22 +1,20 @@ -import sys -from typing import Any, Callable, Sequence, Tuple +from collections.abc import Callable, Sequence +from contextvars import Context +from typing import Any from typing_extensions import Literal -if sys.version_info >= (3, 7): - from contextvars import Context - from . import futures +__all__ = () + +# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py +# but it leads to circular import error in pytype tool. +# That's why the import order is reversed. +from .futures import isfuture as isfuture + _PENDING: Literal["PENDING"] # undocumented _CANCELLED: Literal["CANCELLED"] # undocumented _FINISHED: Literal["FINISHED"] # undocumented -def isfuture(obj: object) -> bool: ... - -if sys.version_info >= (3, 7): - def _format_callbacks(cb: Sequence[Tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented - -else: - def _format_callbacks(cb: Sequence[Callable[[futures.Future[Any]], None]]) -> str: ... # undocumented - +def _format_callbacks(cb: Sequence[tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented def _future_repr_info(future: futures.Future[Any]) -> list[str]: ... # undocumented diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index 6165e0b..d3ab16a 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -1,9 +1,12 @@ import subprocess -from typing import IO, Any, Callable, Deque, Optional, Sequence, Tuple, Union +from collections import deque +from collections.abc import Callable, Sequence +from typing import IO, Any +from typing_extensions import TypeAlias from . import events, futures, protocols, transports -_File = Optional[Union[int, IO[Any]]] +_File: TypeAlias = int | IO[Any] | None class BaseSubprocessTransport(transports.SubprocessTransport): @@ -14,7 +17,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport): _pid: int | None # undocumented _returncode: int | None # undocumented _exit_waiters: list[futures.Future[Any]] # undocumented - _pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented + _pending_calls: deque[tuple[Callable[..., Any], tuple[Any, ...]]] # undocumented _pipes: dict[int, _File] # undocumented _finished: bool # undocumented def __init__( @@ -41,19 +44,12 @@ class BaseSubprocessTransport(transports.SubprocessTransport): bufsize: int, **kwargs: Any, ) -> None: ... # undocumented - def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ... - def get_protocol(self) -> protocols.BaseProtocol: ... - def is_closing(self) -> bool: ... - def close(self) -> None: ... - def get_pid(self) -> int | None: ... # type: ignore - def get_returncode(self) -> int | None: ... - def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore + def get_pid(self) -> int | None: ... # type: ignore[override] + def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override] def _check_proc(self) -> None: ... # undocumented - def send_signal(self, signal: int) -> None: ... # type: ignore - def terminate(self) -> None: ... - def kill(self) -> None: ... + def send_signal(self, signal: int) -> None: ... # type: ignore[override] async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented - def _call(self, cb: Callable[..., Any], *data: Any) -> None: ... # undocumented + def _call(self, cb: Callable[..., object], *data: Any) -> None: ... # undocumented def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented def _pipe_data_received(self, fd: int, data: bytes) -> None: ... # undocumented def _process_exited(self, returncode: int) -> None: ... # undocumented @@ -63,10 +59,5 @@ class BaseSubprocessTransport(transports.SubprocessTransport): class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented def __init__(self, proc: BaseSubprocessTransport, fd: int) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... - def connection_lost(self, exc: BaseException | None) -> None: ... - def pause_writing(self) -> None: ... - def resume_writing(self) -> None: ... -class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): # undocumented - def data_received(self, data: bytes) -> None: ... +class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): ... # undocumented diff --git a/stdlib/asyncio/compat.pyi b/stdlib/asyncio/compat.pyi deleted file mode 100644 index 1beeea9..0000000 --- a/stdlib/asyncio/compat.pyi +++ /dev/null @@ -1,7 +0,0 @@ -import sys - -if sys.version_info < (3, 7): - PY34: bool - PY35: bool - PY352: bool - def flatten_list_bytes(list_of_data: list[bytes]) -> bytes: ... diff --git a/stdlib/asyncio/constants.pyi b/stdlib/asyncio/constants.pyi index 2010fe9..af209fa 100644 --- a/stdlib/asyncio/constants.pyi +++ b/stdlib/asyncio/constants.pyi @@ -1,12 +1,16 @@ import enum import sys +from typing_extensions import Literal -LOG_THRESHOLD_FOR_CONNLOST_WRITES: int -ACCEPT_RETRY_DELAY: int -DEBUG_STACK_DEPTH: int -if sys.version_info >= (3, 7): - SSL_HANDSHAKE_TIMEOUT: float - SENDFILE_FALLBACK_READBUFFER_SIZE: int +LOG_THRESHOLD_FOR_CONNLOST_WRITES: Literal[5] +ACCEPT_RETRY_DELAY: Literal[1] +DEBUG_STACK_DEPTH: Literal[10] +SSL_HANDSHAKE_TIMEOUT: float +SENDFILE_FALLBACK_READBUFFER_SIZE: Literal[262144] +if sys.version_info >= (3, 11): + SSL_SHUTDOWN_TIMEOUT: float + FLOW_CONTROL_HIGH_WATER_SSL_READ: Literal[256] + FLOW_CONTROL_HIGH_WATER_SSL_WRITE: Literal[512] class _SendfileMode(enum.Enum): UNSUPPORTED: int diff --git a/stdlib/asyncio/coroutines.pyi b/stdlib/asyncio/coroutines.pyi index df94d5b..14fb627 100644 --- a/stdlib/asyncio/coroutines.pyi +++ b/stdlib/asyncio/coroutines.pyi @@ -1,16 +1,28 @@ import sys -import types -from collections.abc import Callable, Coroutine -from typing import Any, TypeVar -from typing_extensions import TypeGuard +from collections.abc import Awaitable, Callable, Coroutine +from typing import Any, TypeVar, overload +from typing_extensions import ParamSpec, TypeGuard -_F = TypeVar("_F", bound=Callable[..., Any]) +if sys.version_info >= (3, 11): + __all__ = ("iscoroutinefunction", "iscoroutine") +else: + __all__ = ("coroutine", "iscoroutinefunction", "iscoroutine") -def coroutine(func: _F) -> _F: ... -def iscoroutinefunction(func: object) -> bool: ... +_T = TypeVar("_T") +_FunctionT = TypeVar("_FunctionT", bound=Callable[..., Any]) +_P = ParamSpec("_P") -if sys.version_info < (3, 8): - def iscoroutine(obj: object) -> TypeGuard[types.GeneratorType[Any, Any, Any] | Coroutine[Any, Any, Any]]: ... +if sys.version_info < (3, 11): + def coroutine(func: _FunctionT) -> _FunctionT: ... -else: - def iscoroutine(obj: object) -> TypeGuard[Coroutine[Any, Any, Any]]: ... +@overload +def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... +@overload +def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ... +@overload +def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ... +@overload +def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ... + +# Can actually be a generator-style coroutine on Python 3.7 +def iscoroutine(obj: object) -> TypeGuard[Coroutine[Any, Any, Any]]: ... diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 9b77a91..280be4a 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -1,71 +1,114 @@ import ssl import sys -from _typeshed import FileDescriptorLike, Self +from _typeshed import FileDescriptorLike, ReadableBuffer, Self, StrPath, WriteableBuffer from abc import ABCMeta, abstractmethod +from collections.abc import Awaitable, Callable, Coroutine, Generator, Sequence +from contextvars import Context from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket -from typing import IO, Any, Awaitable, Callable, Dict, Generator, Sequence, Tuple, TypeVar, Union, overload -from typing_extensions import Literal +from typing import IO, Any, Protocol, TypeVar, overload +from typing_extensions import Literal, TypeAlias from .base_events import Server from .futures import Future from .protocols import BaseProtocol from .tasks import Task -from .transports import BaseTransport +from .transports import BaseTransport, ReadTransport, SubprocessTransport, WriteTransport from .unix_events import AbstractChildWatcher -if sys.version_info >= (3, 7): - from contextvars import Context +if sys.version_info >= (3, 8): + __all__ = ( + "AbstractEventLoopPolicy", + "AbstractEventLoop", + "AbstractServer", + "Handle", + "TimerHandle", + "get_event_loop_policy", + "set_event_loop_policy", + "get_event_loop", + "set_event_loop", + "new_event_loop", + "get_child_watcher", + "set_child_watcher", + "_set_running_loop", + "get_running_loop", + "_get_running_loop", + ) + +else: + __all__ = ( + "AbstractEventLoopPolicy", + "AbstractEventLoop", + "AbstractServer", + "Handle", + "TimerHandle", + "SendfileNotAvailableError", + "get_event_loop_policy", + "set_event_loop_policy", + "get_event_loop", + "set_event_loop", + "new_event_loop", + "get_child_watcher", + "set_child_watcher", + "_set_running_loop", + "get_running_loop", + "_get_running_loop", + ) _T = TypeVar("_T") -_Context = Dict[str, Any] -_ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any] -_ProtocolFactory = Callable[[], BaseProtocol] -_SSLContext = Union[bool, None, ssl.SSLContext] -_TransProtPair = Tuple[BaseTransport, BaseProtocol] +_ProtocolT = TypeVar("_ProtocolT", bound=BaseProtocol) +_Context: TypeAlias = dict[str, Any] +_ExceptionHandler: TypeAlias = Callable[[AbstractEventLoop, _Context], object] +_ProtocolFactory: TypeAlias = Callable[[], BaseProtocol] +_SSLContext: TypeAlias = bool | None | ssl.SSLContext + +class _TaskFactory(Protocol): + def __call__( + self, __loop: AbstractEventLoop, __factory: Coroutine[Any, Any, _T] | Generator[Any, None, _T] + ) -> Future[_T]: ... class Handle: - _cancelled = False + _cancelled: bool _args: Sequence[Any] - if sys.version_info >= (3, 7): - def __init__( - self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop, context: Context | None = ... - ) -> None: ... - else: - def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ... - def __repr__(self) -> str: ... + def __init__( + self, callback: Callable[..., object], args: Sequence[Any], loop: AbstractEventLoop, context: Context | None = ... + ) -> None: ... def cancel(self) -> None: ... def _run(self) -> None: ... - if sys.version_info >= (3, 7): - def cancelled(self) -> bool: ... + def cancelled(self) -> bool: ... class TimerHandle(Handle): - if sys.version_info >= (3, 7): - def __init__( - self, - when: float, - callback: Callable[..., Any], - args: Sequence[Any], - loop: AbstractEventLoop, - context: Context | None = ..., - ) -> None: ... - else: - def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ... - def __hash__(self) -> int: ... - if sys.version_info >= (3, 7): - def when(self) -> float: ... + def __init__( + self, + when: float, + callback: Callable[..., object], + args: Sequence[Any], + loop: AbstractEventLoop, + context: Context | None = ..., + ) -> None: ... + def when(self) -> float: ... + def __lt__(self, other: TimerHandle) -> bool: ... + def __le__(self, other: TimerHandle) -> bool: ... + def __gt__(self, other: TimerHandle) -> bool: ... + def __ge__(self, other: TimerHandle) -> bool: ... + def __eq__(self, other: object) -> bool: ... class AbstractServer: + @abstractmethod def close(self) -> None: ... - if sys.version_info >= (3, 7): - async def __aenter__(self: Self) -> Self: ... - async def __aexit__(self, *exc: Any) -> None: ... - def get_loop(self) -> AbstractEventLoop: ... - def is_serving(self) -> bool: ... - async def start_serving(self) -> None: ... - async def serve_forever(self) -> None: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__(self, *exc: object) -> None: ... + @abstractmethod + def get_loop(self) -> AbstractEventLoop: ... + @abstractmethod + def is_serving(self) -> bool: ... + @abstractmethod + async def start_serving(self) -> None: ... + @abstractmethod + async def serve_forever(self) -> None: ... + @abstractmethod async def wait_closed(self) -> None: ... -class AbstractEventLoop(metaclass=ABCMeta): +class AbstractEventLoop: slow_callback_duration: float @abstractmethod def run_forever(self) -> None: ... @@ -87,48 +130,85 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod async def shutdown_asyncgens(self) -> None: ... # Methods scheduling callbacks. All these return Handles. - @abstractmethod - def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ... - @abstractmethod - def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... - @abstractmethod - def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... + if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2 + @abstractmethod + def call_soon(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + @abstractmethod + def call_later( + self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = ... + ) -> TimerHandle: ... + @abstractmethod + def call_at( + self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = ... + ) -> TimerHandle: ... + else: + @abstractmethod + def call_soon(self, callback: Callable[..., object], *args: Any) -> Handle: ... + @abstractmethod + def call_later(self, delay: float, callback: Callable[..., object], *args: Any) -> TimerHandle: ... + @abstractmethod + def call_at(self, when: float, callback: Callable[..., object], *args: Any) -> TimerHandle: ... + @abstractmethod def time(self) -> float: ... # Future methods @abstractmethod def create_future(self) -> Future[Any]: ... # Tasks methods - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 11): @abstractmethod - def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T], *, name: str | None = ...) -> Task[_T]: ... + def create_task( + self, + coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], + *, + name: str | None = ..., + context: Context | None = ..., + ) -> Task[_T]: ... + elif sys.version_info >= (3, 8): + @abstractmethod + def create_task( + self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: str | None = ... + ) -> Task[_T]: ... else: @abstractmethod - def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T]) -> Task[_T]: ... + def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T]) -> Task[_T]: ... + @abstractmethod - def set_task_factory(self, factory: Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None) -> None: ... + def set_task_factory(self, factory: _TaskFactory | None) -> None: ... @abstractmethod - def get_task_factory(self) -> Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None: ... + def get_task_factory(self) -> _TaskFactory | None: ... # Methods for interacting with threads + if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2 + @abstractmethod + def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + else: + @abstractmethod + def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any) -> Handle: ... + @abstractmethod - def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... - @abstractmethod - def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Awaitable[_T]: ... + def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ... @abstractmethod def set_default_executor(self, executor: Any) -> None: ... # Network I/O methods returning Futures. @abstractmethod async def getaddrinfo( - self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ... - ) -> list[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ... + self, + host: bytes | str | None, + port: bytes | str | int | None, + *, + family: int = ..., + type: int = ..., + proto: int = ..., + flags: int = ..., + ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... @abstractmethod - async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ... - if sys.version_info >= (3, 8): + async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = ...) -> tuple[str, str]: ... + if sys.version_info >= (3, 11): @overload @abstractmethod async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: str = ..., port: int = ..., *, @@ -137,17 +217,18 @@ class AbstractEventLoop(metaclass=ABCMeta): proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., happy_eyeballs_delay: float | None = ..., interleave: int | None = ..., - ) -> _TransProtPair: ... + ) -> tuple[BaseTransport, _ProtocolT]: ... @overload @abstractmethod async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: None = ..., port: None = ..., *, @@ -159,15 +240,16 @@ class AbstractEventLoop(metaclass=ABCMeta): local_addr: None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., happy_eyeballs_delay: float | None = ..., interleave: int | None = ..., - ) -> _TransProtPair: ... - elif sys.version_info >= (3, 7): + ) -> tuple[BaseTransport, _ProtocolT]: ... + elif sys.version_info >= (3, 8): @overload @abstractmethod async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: str = ..., port: int = ..., *, @@ -176,15 +258,17 @@ class AbstractEventLoop(metaclass=ABCMeta): proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., - ) -> _TransProtPair: ... + happy_eyeballs_delay: float | None = ..., + interleave: int | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... @overload @abstractmethod async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: None = ..., port: None = ..., *, @@ -196,13 +280,15 @@ class AbstractEventLoop(metaclass=ABCMeta): local_addr: None = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., - ) -> _TransProtPair: ... + happy_eyeballs_delay: float | None = ..., + interleave: int | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... else: @overload @abstractmethod async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: str = ..., port: int = ..., *, @@ -211,14 +297,15 @@ class AbstractEventLoop(metaclass=ABCMeta): proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = ..., server_hostname: str | None = ..., - ) -> _TransProtPair: ... + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... @overload @abstractmethod async def create_connection( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], host: None = ..., port: None = ..., *, @@ -229,12 +316,9 @@ class AbstractEventLoop(metaclass=ABCMeta): sock: socket, local_addr: None = ..., server_hostname: str | None = ..., - ) -> _TransProtPair: ... - if sys.version_info >= (3, 7): - @abstractmethod - async def sock_sendfile( - self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ... - ) -> int: ... + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + if sys.version_info >= (3, 11): @overload @abstractmethod async def create_server( @@ -251,6 +335,7 @@ class AbstractEventLoop(metaclass=ABCMeta): reuse_address: bool | None = ..., reuse_port: bool | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., start_serving: bool = ..., ) -> Server: ... @overload @@ -269,44 +354,33 @@ class AbstractEventLoop(metaclass=ABCMeta): reuse_address: bool | None = ..., reuse_port: bool | None = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., start_serving: bool = ..., ) -> Server: ... - async def create_unix_connection( + @abstractmethod + async def start_tls( self, - protocol_factory: _ProtocolFactory, - path: str | None = ..., + transport: BaseTransport, + protocol: BaseProtocol, + sslcontext: ssl.SSLContext, *, - ssl: _SSLContext = ..., - sock: socket | None = ..., + server_side: bool = ..., server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ..., - ) -> _TransProtPair: ... + ssl_shutdown_timeout: float | None = ..., + ) -> BaseTransport: ... async def create_unix_server( self, protocol_factory: _ProtocolFactory, - path: str | None = ..., + path: StrPath | None = ..., *, sock: socket | None = ..., backlog: int = ..., ssl: _SSLContext = ..., ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., start_serving: bool = ..., ) -> Server: ... - @abstractmethod - async def sendfile( - self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ... - ) -> int: ... - @abstractmethod - async def start_tls( - self, - transport: BaseTransport, - protocol: BaseProtocol, - sslcontext: ssl.SSLContext, - *, - server_side: bool = ..., - server_hostname: str | None = ..., - ssl_handshake_timeout: float | None = ..., - ) -> BaseTransport: ... else: @overload @abstractmethod @@ -323,6 +397,8 @@ class AbstractEventLoop(metaclass=ABCMeta): ssl: _SSLContext = ..., reuse_address: bool | None = ..., reuse_port: bool | None = ..., + ssl_handshake_timeout: float | None = ..., + start_serving: bool = ..., ) -> Server: ... @overload @abstractmethod @@ -334,36 +410,93 @@ class AbstractEventLoop(metaclass=ABCMeta): *, family: int = ..., flags: int = ..., - sock: socket, + sock: socket = ..., backlog: int = ..., ssl: _SSLContext = ..., reuse_address: bool | None = ..., reuse_port: bool | None = ..., + ssl_handshake_timeout: float | None = ..., + start_serving: bool = ..., ) -> Server: ... - async def create_unix_connection( + @abstractmethod + async def start_tls( self, - protocol_factory: _ProtocolFactory, - path: str, + transport: BaseTransport, + protocol: BaseProtocol, + sslcontext: ssl.SSLContext, *, - ssl: _SSLContext = ..., - sock: socket | None = ..., + server_side: bool = ..., server_hostname: str | None = ..., - ) -> _TransProtPair: ... + ssl_handshake_timeout: float | None = ..., + ) -> BaseTransport: ... async def create_unix_server( self, protocol_factory: _ProtocolFactory, - path: str, + path: StrPath | None = ..., *, sock: socket | None = ..., backlog: int = ..., ssl: _SSLContext = ..., + ssl_handshake_timeout: float | None = ..., + start_serving: bool = ..., ) -> Server: ... + if sys.version_info >= (3, 11): + async def connect_accepted_socket( + self, + protocol_factory: Callable[[], _ProtocolT], + sock: socket, + *, + ssl: _SSLContext = ..., + ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + elif sys.version_info >= (3, 10): + async def connect_accepted_socket( + self, + protocol_factory: Callable[[], _ProtocolT], + sock: socket, + *, + ssl: _SSLContext = ..., + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + if sys.version_info >= (3, 11): + async def create_unix_connection( + self, + protocol_factory: Callable[[], _ProtocolT], + path: str | None = ..., + *, + ssl: _SSLContext = ..., + sock: socket | None = ..., + server_hostname: str | None = ..., + ssl_handshake_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + else: + async def create_unix_connection( + self, + protocol_factory: Callable[[], _ProtocolT], + path: str | None = ..., + *, + ssl: _SSLContext = ..., + sock: socket | None = ..., + server_hostname: str | None = ..., + ssl_handshake_timeout: float | None = ..., + ) -> tuple[BaseTransport, _ProtocolT]: ... + + @abstractmethod + async def sock_sendfile( + self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ... + ) -> int: ... + @abstractmethod + async def sendfile( + self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ... + ) -> int: ... @abstractmethod async def create_datagram_endpoint( self, - protocol_factory: _ProtocolFactory, - local_addr: Tuple[str, int] | None = ..., - remote_addr: Tuple[str, int] | None = ..., + protocol_factory: Callable[[], _ProtocolT], + local_addr: tuple[str, int] | None = ..., + remote_addr: tuple[str, int] | None = ..., *, family: int = ..., proto: int = ..., @@ -372,16 +505,20 @@ class AbstractEventLoop(metaclass=ABCMeta): reuse_port: bool | None = ..., allow_broadcast: bool | None = ..., sock: socket | None = ..., - ) -> _TransProtPair: ... + ) -> tuple[BaseTransport, _ProtocolT]: ... # Pipes and subprocesses. @abstractmethod - async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ... + async def connect_read_pipe( + self, protocol_factory: Callable[[], _ProtocolT], pipe: Any + ) -> tuple[ReadTransport, _ProtocolT]: ... @abstractmethod - async def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ... + async def connect_write_pipe( + self, protocol_factory: Callable[[], _ProtocolT], pipe: Any + ) -> tuple[WriteTransport, _ProtocolT]: ... @abstractmethod async def subprocess_shell( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], cmd: bytes | str, *, stdin: int | IO[Any] | None = ..., @@ -394,11 +531,11 @@ class AbstractEventLoop(metaclass=ABCMeta): errors: None = ..., text: Literal[False, None] = ..., **kwargs: Any, - ) -> _TransProtPair: ... + ) -> tuple[SubprocessTransport, _ProtocolT]: ... @abstractmethod async def subprocess_exec( self, - protocol_factory: _ProtocolFactory, + protocol_factory: Callable[[], _ProtocolT], program: Any, *args: Any, stdin: int | IO[Any] | None = ..., @@ -410,39 +547,36 @@ class AbstractEventLoop(metaclass=ABCMeta): encoding: None = ..., errors: None = ..., **kwargs: Any, - ) -> _TransProtPair: ... + ) -> tuple[SubprocessTransport, _ProtocolT]: ... @abstractmethod def add_reader(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ... @abstractmethod - def remove_reader(self, fd: FileDescriptorLike) -> None: ... + def remove_reader(self, fd: FileDescriptorLike) -> bool: ... @abstractmethod def add_writer(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ... @abstractmethod - def remove_writer(self, fd: FileDescriptorLike) -> None: ... + def remove_writer(self, fd: FileDescriptorLike) -> bool: ... # Completion based I/O methods returning Futures prior to 3.7 - if sys.version_info >= (3, 7): - @abstractmethod - async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ... - @abstractmethod - async def sock_recv_into(self, sock: socket, buf: bytearray) -> int: ... - @abstractmethod - async def sock_sendall(self, sock: socket, data: bytes) -> None: ... - @abstractmethod - async def sock_connect(self, sock: socket, address: _Address) -> None: ... - @abstractmethod - async def sock_accept(self, sock: socket) -> Tuple[socket, _RetAddress]: ... - else: - @abstractmethod - def sock_recv(self, sock: socket, nbytes: int) -> Future[bytes]: ... + @abstractmethod + async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ... + @abstractmethod + async def sock_recv_into(self, sock: socket, buf: WriteableBuffer) -> int: ... + @abstractmethod + async def sock_sendall(self, sock: socket, data: ReadableBuffer) -> None: ... + @abstractmethod + async def sock_connect(self, sock: socket, address: _Address) -> None: ... + @abstractmethod + async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ... + if sys.version_info >= (3, 11): @abstractmethod - def sock_sendall(self, sock: socket, data: bytes) -> Future[None]: ... + async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ... @abstractmethod - def sock_connect(self, sock: socket, address: _Address) -> Future[None]: ... + async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = ...) -> int: ... @abstractmethod - def sock_accept(self, sock: socket) -> Future[Tuple[socket, _RetAddress]]: ... + async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> None: ... # Signal handling. @abstractmethod - def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ... + def add_signal_handler(self, sig: int, callback: Callable[..., object], *args: Any) -> None: ... @abstractmethod def remove_signal_handler(self, sig: int) -> bool: ... # Error handlers. @@ -463,7 +597,7 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod async def shutdown_default_executor(self) -> None: ... -class AbstractEventLoopPolicy(metaclass=ABCMeta): +class AbstractEventLoopPolicy: @abstractmethod def get_event_loop(self) -> AbstractEventLoop: ... @abstractmethod @@ -477,7 +611,6 @@ class AbstractEventLoopPolicy(metaclass=ABCMeta): def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta): - def __init__(self) -> None: ... def get_event_loop(self) -> AbstractEventLoop: ... def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ... def new_event_loop(self) -> AbstractEventLoop: ... @@ -491,8 +624,7 @@ def get_child_watcher() -> AbstractChildWatcher: ... def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... def _set_running_loop(__loop: AbstractEventLoop | None) -> None: ... def _get_running_loop() -> AbstractEventLoop: ... +def get_running_loop() -> AbstractEventLoop: ... -if sys.version_info >= (3, 7): - def get_running_loop() -> AbstractEventLoop: ... - if sys.version_info < (3, 8): - class SendfileNotAvailableError(RuntimeError): ... +if sys.version_info < (3, 8): + class SendfileNotAvailableError(RuntimeError): ... diff --git a/stdlib/asyncio/exceptions.pyi b/stdlib/asyncio/exceptions.pyi index 5b99966..075fbb8 100644 --- a/stdlib/asyncio/exceptions.pyi +++ b/stdlib/asyncio/exceptions.pyi @@ -1,14 +1,38 @@ import sys -if sys.version_info >= (3, 8): - class CancelledError(BaseException): ... - class TimeoutError(Exception): ... - class InvalidStateError(Exception): ... - class SendfileNotAvailableError(RuntimeError): ... - class IncompleteReadError(EOFError): - expected: int | None - partial: bytes - def __init__(self, partial: bytes, expected: int | None) -> None: ... - class LimitOverrunError(Exception): - consumed: int - def __init__(self, message: str, consumed: int) -> None: ... +if sys.version_info >= (3, 11): + __all__ = ( + "BrokenBarrierError", + "CancelledError", + "InvalidStateError", + "TimeoutError", + "IncompleteReadError", + "LimitOverrunError", + "SendfileNotAvailableError", + ) +else: + __all__ = ( + "CancelledError", + "InvalidStateError", + "TimeoutError", + "IncompleteReadError", + "LimitOverrunError", + "SendfileNotAvailableError", + ) + +class CancelledError(BaseException): ... +class TimeoutError(Exception): ... +class InvalidStateError(Exception): ... +class SendfileNotAvailableError(RuntimeError): ... + +class IncompleteReadError(EOFError): + expected: int | None + partial: bytes + def __init__(self, partial: bytes, expected: int | None) -> None: ... + +class LimitOverrunError(Exception): + consumed: int + def __init__(self, message: str, consumed: int) -> None: ... + +if sys.version_info >= (3, 11): + class BrokenBarrierError(RuntimeError): ... diff --git a/stdlib/asyncio/format_helpers.pyi b/stdlib/asyncio/format_helpers.pyi index 29cb883..4e2ef8d 100644 --- a/stdlib/asyncio/format_helpers.pyi +++ b/stdlib/asyncio/format_helpers.pyi @@ -1,20 +1,20 @@ import functools -import sys import traceback +from collections.abc import Iterable from types import FrameType, FunctionType -from typing import Any, Iterable, Tuple, Union, overload +from typing import Any, overload +from typing_extensions import TypeAlias class _HasWrapper: __wrapper__: _HasWrapper | FunctionType -_FuncType = Union[FunctionType, _HasWrapper, functools.partial[Any], functools.partialmethod[Any]] +_FuncType: TypeAlias = FunctionType | _HasWrapper | functools.partial[Any] | functools.partialmethod[Any] -if sys.version_info >= (3, 7): - @overload - def _get_function_source(func: _FuncType) -> Tuple[str, int]: ... - @overload - def _get_function_source(func: object) -> Tuple[str, int] | None: ... - def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... - def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... - def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = ...) -> str: ... - def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> traceback.StackSummary: ... +@overload +def _get_function_source(func: _FuncType) -> tuple[str, int]: ... +@overload +def _get_function_source(func: object) -> tuple[str, int] | None: ... +def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... +def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... +def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = ...) -> str: ... +def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> traceback.StackSummary: ... diff --git a/stdlib/asyncio/futures.pyi b/stdlib/asyncio/futures.pyi index 4942796..f917bd5 100644 --- a/stdlib/asyncio/futures.pyi +++ b/stdlib/asyncio/futures.pyi @@ -1,58 +1,60 @@ import sys +from _typeshed import Self +from collections.abc import Awaitable, Callable, Generator, Iterable from concurrent.futures._base import Error, Future as _ConcurrentFuture -from typing import Any, Awaitable, Callable, Generator, Iterable, Tuple, TypeVar +from typing import Any, TypeVar +from typing_extensions import Literal, TypeGuard from .events import AbstractEventLoop if sys.version_info < (3, 8): from concurrent.futures import CancelledError as CancelledError, TimeoutError as TimeoutError + class InvalidStateError(Error): ... -if sys.version_info >= (3, 7): - from contextvars import Context +from contextvars import Context if sys.version_info >= (3, 9): from types import GenericAlias -_T = TypeVar("_T") -_S = TypeVar("_S") +if sys.version_info >= (3, 8): + __all__ = ("Future", "wrap_future", "isfuture") +else: + __all__ = ("CancelledError", "TimeoutError", "InvalidStateError", "Future", "wrap_future", "isfuture") -if sys.version_info < (3, 7): - class _TracebackLogger: - exc: BaseException - tb: list[str] - def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ... - def activate(self) -> None: ... - def clear(self) -> None: ... - def __del__(self) -> None: ... +_T = TypeVar("_T") -def isfuture(obj: object) -> bool: ... +# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py +# but it leads to circular import error in pytype tool. +# That's why the import order is reversed. +def isfuture(obj: object) -> TypeGuard[Future[Any]]: ... class Future(Awaitable[_T], Iterable[_T]): _state: str - _exception: BaseException - _blocking = False - _log_traceback = False + @property + def _exception(self) -> BaseException: ... + _blocking: bool + @property + def _log_traceback(self) -> bool: ... + @_log_traceback.setter + def _log_traceback(self, val: Literal[False]) -> None: ... + _asyncio_future_blocking: bool # is a part of duck-typing contract for `Future` def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... - def __repr__(self) -> str: ... def __del__(self) -> None: ... - if sys.version_info >= (3, 7): - def get_loop(self) -> AbstractEventLoop: ... - def _callbacks(self: _S) -> list[Tuple[Callable[[_S], Any], Context]]: ... - def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ... - else: - @property - def _callbacks(self: _S) -> list[Callable[[_S], Any]]: ... - def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ... + def get_loop(self) -> AbstractEventLoop: ... + @property + def _callbacks(self: Self) -> list[tuple[Callable[[Self], Any], Context]]: ... + def add_done_callback(self: Self, __fn: Callable[[Self], object], *, context: Context | None = ...) -> None: ... if sys.version_info >= (3, 9): def cancel(self, msg: Any | None = ...) -> bool: ... else: def cancel(self) -> bool: ... + def cancelled(self) -> bool: ... def done(self) -> bool: ... def result(self) -> _T: ... def exception(self) -> BaseException | None: ... - def remove_done_callback(self: _S, __fn: Callable[[_S], Any]) -> int: ... + def remove_done_callback(self: Self, __fn: Callable[[Self], object]) -> int: ... def set_result(self, __result: _T) -> None: ... def set_exception(self, __exception: type | BaseException) -> None: ... def __iter__(self) -> Generator[Any, None, _T]: ... diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index 9012327..a5cdf9a 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -1,68 +1,116 @@ +import enum import sys +from _typeshed import Self +from collections import deque +from collections.abc import Callable, Generator from types import TracebackType -from typing import Any, Awaitable, Callable, Deque, Generator, Type, TypeVar +from typing import Any, TypeVar +from typing_extensions import Literal from .events import AbstractEventLoop from .futures import Future +if sys.version_info >= (3, 11): + from .mixins import _LoopBoundMixin + +if sys.version_info >= (3, 11): + __all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore", "Barrier") +else: + __all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore") + _T = TypeVar("_T") if sys.version_info >= (3, 9): class _ContextManagerMixin: - def __init__(self, lock: Lock | Semaphore) -> None: ... - def __aenter__(self) -> Awaitable[None]: ... - def __aexit__( - self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None - ) -> Awaitable[None]: ... + async def __aenter__(self) -> None: ... + async def __aexit__( + self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None + ) -> None: ... else: class _ContextManager: def __init__(self, lock: Lock | Semaphore) -> None: ... - def __enter__(self) -> object: ... - def __exit__(self, *args: Any) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, *args: object) -> None: ... + class _ContextManagerMixin: - def __init__(self, lock: Lock | Semaphore) -> None: ... # Apparently this exists to *prohibit* use as a context manager. - def __enter__(self) -> object: ... - def __exit__(self, *args: Any) -> None: ... + # def __enter__(self) -> NoReturn: ... see: https://github.com/python/typing/issues/1043 + # def __exit__(self, *args: Any) -> None: ... def __iter__(self) -> Generator[Any, None, _ContextManager]: ... def __await__(self) -> Generator[Any, None, _ContextManager]: ... - def __aenter__(self) -> Awaitable[None]: ... - def __aexit__( - self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None - ) -> Awaitable[None]: ... + async def __aenter__(self) -> None: ... + async def __aexit__( + self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None + ) -> None: ... class Lock(_ContextManagerMixin): - def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def __init__(self) -> None: ... + else: + def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... + def locked(self) -> bool: ... - async def acquire(self) -> bool: ... + async def acquire(self) -> Literal[True]: ... def release(self) -> None: ... class Event: - def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def __init__(self) -> None: ... + else: + def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... + def is_set(self) -> bool: ... def set(self) -> None: ... def clear(self) -> None: ... - async def wait(self) -> bool: ... + async def wait(self) -> Literal[True]: ... class Condition(_ContextManagerMixin): - def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def __init__(self, lock: Lock | None = ...) -> None: ... + else: + def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... + def locked(self) -> bool: ... - async def acquire(self) -> bool: ... + async def acquire(self) -> Literal[True]: ... def release(self) -> None: ... - async def wait(self) -> bool: ... + async def wait(self) -> Literal[True]: ... async def wait_for(self, predicate: Callable[[], _T]) -> _T: ... def notify(self, n: int = ...) -> None: ... def notify_all(self) -> None: ... class Semaphore(_ContextManagerMixin): _value: int - _waiters: Deque[Future[Any]] - def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... + _waiters: deque[Future[Any]] + if sys.version_info >= (3, 11): + def __init__(self, value: int = ...) -> None: ... + else: + def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... + def locked(self) -> bool: ... - async def acquire(self) -> bool: ... + async def acquire(self) -> Literal[True]: ... def release(self) -> None: ... def _wake_up_next(self) -> None: ... -class BoundedSemaphore(Semaphore): - def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... +class BoundedSemaphore(Semaphore): ... + +if sys.version_info >= (3, 11): + class _BarrierState(enum.Enum): # undocumented + FILLING: str + DRAINING: str + RESETTING: str + BROKEN: str + + class Barrier(_LoopBoundMixin): + def __init__(self, parties: int) -> None: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__(self, *args: object) -> None: ... + async def wait(self) -> int: ... + async def abort(self) -> None: ... + async def reset(self) -> None: ... + @property + def parties(self) -> int: ... + @property + def n_waiting(self) -> int: ... + @property + def broken(self) -> bool: ... diff --git a/stdlib/asyncio/mixins.pyi b/stdlib/asyncio/mixins.pyi new file mode 100644 index 0000000..6ebcf54 --- /dev/null +++ b/stdlib/asyncio/mixins.pyi @@ -0,0 +1,9 @@ +import sys +import threading +from typing_extensions import Never + +_global_lock: threading.Lock + +class _LoopBoundMixin: + if sys.version_info < (3, 11): + def __init__(self, *, loop: Never = ...) -> None: ... diff --git a/stdlib/asyncio/proactor_events.pyi b/stdlib/asyncio/proactor_events.pyi index 6c8c558..7049394 100644 --- a/stdlib/asyncio/proactor_events.pyi +++ b/stdlib/asyncio/proactor_events.pyi @@ -1,15 +1,18 @@ import sys +from collections.abc import Mapping from socket import socket -from typing import Any, Mapping, Type -from typing_extensions import Literal, Protocol +from typing import Any, ClassVar, Protocol +from typing_extensions import Literal from . import base_events, constants, events, futures, streams, transports +__all__ = ("BaseProactorEventLoop",) + if sys.version_info >= (3, 8): class _WarnCallbackProtocol(Protocol): def __call__( - self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ... - ) -> None: ... + self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ... + ) -> object: ... class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport): def __init__( @@ -21,51 +24,41 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr extra: Mapping[Any, Any] | None = ..., server: events.AbstractServer | None = ..., ) -> None: ... - def __repr__(self) -> str: ... if sys.version_info >= (3, 8): def __del__(self, _warn: _WarnCallbackProtocol = ...) -> None: ... else: def __del__(self) -> None: ... - def get_write_buffer_size(self) -> int: ... class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport): - def __init__( - self, - loop: events.AbstractEventLoop, - sock: socket, - protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., - ) -> None: ... - -class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): - def __init__( - self, - loop: events.AbstractEventLoop, - sock: socket, - protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., - ) -> None: ... - -class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): - def __init__( - self, - loop: events.AbstractEventLoop, - sock: socket, - protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., - ) -> None: ... + if sys.version_info >= (3, 10): + def __init__( + self, + loop: events.AbstractEventLoop, + sock: socket, + protocol: streams.StreamReaderProtocol, + waiter: futures.Future[Any] | None = ..., + extra: Mapping[Any, Any] | None = ..., + server: events.AbstractServer | None = ..., + buffer_size: int = ..., + ) -> None: ... + else: + def __init__( + self, + loop: events.AbstractEventLoop, + sock: socket, + protocol: streams.StreamReaderProtocol, + waiter: futures.Future[Any] | None = ..., + extra: Mapping[Any, Any] | None = ..., + server: events.AbstractServer | None = ..., + ) -> None: ... +class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): ... +class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): ... class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ... class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): - _sendfile_compatible: constants._SendfileMode + _sendfile_compatible: ClassVar[constants._SendfileMode] def __init__( self, loop: events.AbstractEventLoop, @@ -77,7 +70,6 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip ) -> None: ... def _set_extra(self, sock: socket) -> None: ... def can_write_eof(self) -> Literal[True]: ... - def write_eof(self) -> None: ... class BaseProactorEventLoop(base_events.BaseEventLoop): def __init__(self, proactor: Any) -> None: ... diff --git a/stdlib/asyncio/protocols.pyi b/stdlib/asyncio/protocols.pyi index ec8131b..5173b74 100644 --- a/stdlib/asyncio/protocols.pyi +++ b/stdlib/asyncio/protocols.pyi @@ -1,6 +1,8 @@ -import sys +from _typeshed import ReadableBuffer from asyncio import transports -from typing import Tuple +from typing import Any + +__all__ = ("BaseProtocol", "Protocol", "DatagramProtocol", "SubprocessProtocol", "BufferedProtocol") class BaseProtocol: def connection_made(self, transport: transports.BaseTransport) -> None: ... @@ -12,14 +14,18 @@ class Protocol(BaseProtocol): def data_received(self, data: bytes) -> None: ... def eof_received(self) -> bool | None: ... -if sys.version_info >= (3, 7): - class BufferedProtocol(BaseProtocol): - def get_buffer(self, sizehint: int) -> bytearray: ... - def buffer_updated(self, nbytes: int) -> None: ... +class BufferedProtocol(BaseProtocol): + def get_buffer(self, sizehint: int) -> ReadableBuffer: ... + def buffer_updated(self, nbytes: int) -> None: ... + def eof_received(self) -> bool | None: ... class DatagramProtocol(BaseProtocol): - def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore - def datagram_received(self, data: bytes, addr: Tuple[str, int]) -> None: ... + def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore[override] + # addr can be a tuple[int, int] for some unusual protocols like socket.AF_NETLINK. + # Use tuple[str | Any, int] to not cause typechecking issues on most usual cases. + # This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted. + # See https://github.com/python/typing/issues/566 + def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ... def error_received(self, exc: Exception) -> None: ... class SubprocessProtocol(BaseProtocol): diff --git a/stdlib/asyncio/queues.pyi b/stdlib/asyncio/queues.pyi index aff4af7..90ba39a 100644 --- a/stdlib/asyncio/queues.pyi +++ b/stdlib/asyncio/queues.pyi @@ -5,18 +5,22 @@ from typing import Any, Generic, TypeVar if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = ("Queue", "PriorityQueue", "LifoQueue", "QueueFull", "QueueEmpty") + class QueueEmpty(Exception): ... class QueueFull(Exception): ... _T = TypeVar("_T") class Queue(Generic[_T]): - def __init__(self, maxsize: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def __init__(self, maxsize: int = ...) -> None: ... + else: + def __init__(self, maxsize: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... + def _init(self, maxsize: int) -> None: ... def _get(self) -> _T: ... def _put(self, item: _T) -> None: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... def _format(self) -> str: ... def qsize(self) -> int: ... @property diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 3f0f42e..49d236b 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -1,10 +1,28 @@ import sys +from _typeshed import Self +from collections.abc import Callable, Coroutine +from contextvars import Context +from typing import Any, TypeVar -if sys.version_info >= (3, 7): - from typing import Awaitable, TypeVar +from .events import AbstractEventLoop - _T = TypeVar("_T") - if sys.version_info >= (3, 8): - def run(main: Awaitable[_T], *, debug: bool | None = ...) -> _T: ... - else: - def run(main: Awaitable[_T], *, debug: bool = ...) -> _T: ... +if sys.version_info >= (3, 11): + __all__ = ("Runner", "run") +else: + __all__ = ("run",) +_T = TypeVar("_T") + +if sys.version_info >= (3, 11): + class Runner: + def __init__(self, *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, exc_type: object, exc_val: object, exc_tb: object) -> None: ... + def close(self) -> None: ... + def get_loop(self) -> AbstractEventLoop: ... + def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = ...) -> _T: ... + +if sys.version_info >= (3, 8): + def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = ...) -> _T: ... + +else: + def run(main: Coroutine[Any, Any, _T], *, debug: bool = ...) -> _T: ... diff --git a/stdlib/asyncio/selector_events.pyi b/stdlib/asyncio/selector_events.pyi index bcbcd2f..c5468d4 100644 --- a/stdlib/asyncio/selector_events.pyi +++ b/stdlib/asyncio/selector_events.pyi @@ -2,5 +2,7 @@ import selectors from . import base_events +__all__ = ("BaseSelectorEventLoop",) + class BaseSelectorEventLoop(base_events.BaseEventLoop): def __init__(self, selector: selectors.BaseSelector | None = ...) -> None: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 9dda54c..3c1c7b2 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -1,45 +1,67 @@ import ssl import sys -from typing import Any, Callable, ClassVar, Deque, Tuple -from typing_extensions import Literal +from collections import deque +from collections.abc import Callable +from enum import Enum +from typing import Any, ClassVar +from typing_extensions import Literal, TypeAlias from . import constants, events, futures, protocols, transports def _create_transport_context(server_side: bool, server_hostname: str | None) -> ssl.SSLContext: ... -_UNWRAPPED: Literal["UNWRAPPED"] -_DO_HANDSHAKE: Literal["DO_HANDSHAKE"] -_WRAPPED: Literal["WRAPPED"] -_SHUTDOWN: Literal["SHUTDOWN"] +if sys.version_info >= (3, 11): + SSLAgainErrors: tuple[type[ssl.SSLWantReadError], type[ssl.SSLSyscallError]] -class _SSLPipe: + class SSLProtocolState(Enum): + UNWRAPPED: str + DO_HANDSHAKE: str + WRAPPED: str + FLUSHING: str + SHUTDOWN: str - max_size: ClassVar[int] + class AppProtocolState(Enum): + STATE_INIT: str + STATE_CON_MADE: str + STATE_EOF: str + STATE_CON_LOST: str + def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ... - _context: ssl.SSLContext - _server_side: bool - _server_hostname: str | None - _state: str - _incoming: ssl.MemoryBIO - _outgoing: ssl.MemoryBIO - _sslobj: ssl.SSLObject | None - _need_ssldata: bool - _handshake_cb: Callable[[BaseException | None], None] | None - _shutdown_cb: Callable[[], None] | None - def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = ...) -> None: ... - @property - def context(self) -> ssl.SSLContext: ... - @property - def ssl_object(self) -> ssl.SSLObject | None: ... - @property - def need_ssldata(self) -> bool: ... - @property - def wrapped(self) -> bool: ... - def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> list[bytes]: ... - def shutdown(self, callback: Callable[[], None] | None = ...) -> list[bytes]: ... - def feed_eof(self) -> None: ... - def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[list[bytes], list[bytes]]: ... - def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[list[bytes], int]: ... +else: + _UNWRAPPED: Literal["UNWRAPPED"] + _DO_HANDSHAKE: Literal["DO_HANDSHAKE"] + _WRAPPED: Literal["WRAPPED"] + _SHUTDOWN: Literal["SHUTDOWN"] + +if sys.version_info < (3, 11): + class _SSLPipe: + + max_size: ClassVar[int] + + _context: ssl.SSLContext + _server_side: bool + _server_hostname: str | None + _state: str + _incoming: ssl.MemoryBIO + _outgoing: ssl.MemoryBIO + _sslobj: ssl.SSLObject | None + _need_ssldata: bool + _handshake_cb: Callable[[BaseException | None], None] | None + _shutdown_cb: Callable[[], None] | None + def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = ...) -> None: ... + @property + def context(self) -> ssl.SSLContext: ... + @property + def ssl_object(self) -> ssl.SSLObject | None: ... + @property + def need_ssldata(self) -> bool: ... + @property + def wrapped(self) -> bool: ... + def do_handshake(self, callback: Callable[[BaseException | None], object] | None = ...) -> list[bytes]: ... + def shutdown(self, callback: Callable[[], object] | None = ...) -> list[bytes]: ... + def feed_eof(self) -> None: ... + def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> tuple[list[bytes], list[bytes]]: ... + def feed_appdata(self, data: bytes, offset: int = ...) -> tuple[list[bytes], int]: ... class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): @@ -50,45 +72,46 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): _closed: bool def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ... def get_extra_info(self, name: str, default: Any | None = ...) -> dict[str, Any]: ... - def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ... - def get_protocol(self) -> protocols.BaseProtocol: ... - def is_closing(self) -> bool: ... - def close(self) -> None: ... - if sys.version_info >= (3, 7): - def is_reading(self) -> bool: ... - def pause_reading(self) -> None: ... - def resume_reading(self) -> None: ... - def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... - def get_write_buffer_size(self) -> int: ... - if sys.version_info >= (3, 7): - @property - def _protocol_paused(self) -> bool: ... - def write(self, data: bytes) -> None: ... + @property + def _protocol_paused(self) -> bool: ... + def write(self, data: bytes | bytearray | memoryview) -> None: ... def can_write_eof(self) -> Literal[False]: ... - def abort(self) -> None: ... + if sys.version_info >= (3, 11): + def get_write_buffer_limits(self) -> tuple[int, int]: ... + def get_read_buffer_limits(self) -> tuple[int, int]: ... + def set_read_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... + def get_read_buffer_size(self) -> int: ... -class SSLProtocol(protocols.Protocol): +if sys.version_info >= (3, 11): + _SSLProtocolBase: TypeAlias = protocols.BufferedProtocol +else: + _SSLProtocolBase: TypeAlias = protocols.Protocol +class SSLProtocol(_SSLProtocolBase): _server_side: bool _server_hostname: str | None _sslcontext: ssl.SSLContext _extra: dict[str, Any] - _write_backlog: Deque[Tuple[bytes, int]] + _write_backlog: deque[tuple[bytes, int]] _write_buffer_size: int _waiter: futures.Future[Any] _loop: events.AbstractEventLoop _app_transport: _SSLProtocolTransport - _sslpipe: _SSLPipe | None - _session_established: bool - _in_handshake: bool - _in_shutdown: bool _transport: transports.BaseTransport | None - _call_connection_made: bool _ssl_handshake_timeout: int | None _app_protocol: protocols.BaseProtocol _app_protocol_is_buffer: bool - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 11): + max_size: ClassVar[int] + else: + _sslpipe: _SSLPipe | None + _session_established: bool + _call_connection_made: bool + _in_handshake: bool + _in_shutdown: bool + + if sys.version_info >= (3, 11): def __init__( self, loop: events.AbstractEventLoop, @@ -99,6 +122,7 @@ class SSLProtocol(protocols.Protocol): server_hostname: str | None = ..., call_connection_made: bool = ..., ssl_handshake_timeout: int | None = ..., + ssl_shutdown_timeout: float | None = ..., ) -> None: ... else: def __init__( @@ -110,24 +134,27 @@ class SSLProtocol(protocols.Protocol): server_side: bool = ..., server_hostname: str | None = ..., call_connection_made: bool = ..., + ssl_handshake_timeout: int | None = ..., ) -> None: ... - if sys.version_info >= (3, 7): - def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ... + + def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ... def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... def connection_lost(self, exc: BaseException | None) -> None: ... - def pause_writing(self) -> None: ... - def resume_writing(self) -> None: ... - def data_received(self, data: bytes) -> None: ... def eof_received(self) -> None: ... def _get_extra_info(self, name: str, default: Any | None = ...) -> Any: ... def _start_shutdown(self) -> None: ... - def _write_appdata(self, data: bytes) -> None: ... + if sys.version_info >= (3, 11): + def _write_appdata(self, list_of_data: list[bytes]) -> None: ... + else: + def _write_appdata(self, data: bytes) -> None: ... + def _start_handshake(self) -> None: ... - if sys.version_info >= (3, 7): - def _check_handshake_timeout(self) -> None: ... + def _check_handshake_timeout(self) -> None: ... def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ... - def _process_write_backlog(self) -> None: ... def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ... - def _finalize(self) -> None: ... def _abort(self) -> None: ... + if sys.version_info >= (3, 11): + def get_buffer(self, n: int) -> memoryview: ... + else: + def _finalize(self) -> None: ... + def _process_write_backlog(self) -> None: ... diff --git a/stdlib/asyncio/staggered.pyi b/stdlib/asyncio/staggered.pyi index 6ac405a..610d6f7 100644 --- a/stdlib/asyncio/staggered.pyi +++ b/stdlib/asyncio/staggered.pyi @@ -1,9 +1,10 @@ -import sys -from typing import Any, Awaitable, Callable, Iterable, Tuple +from collections.abc import Awaitable, Callable, Iterable +from typing import Any from . import events -if sys.version_info >= (3, 8): - async def staggered_race( - coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = ... - ) -> Tuple[Any, int | None, list[Exception | None]]: ... +__all__ = ("staggered_race",) + +async def staggered_race( + coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = ... +) -> tuple[Any, int | None, list[Exception | None]]: ... diff --git a/stdlib/asyncio/streams.pyi b/stdlib/asyncio/streams.pyi index 6598110..00d95d9 100644 --- a/stdlib/asyncio/streams.pyi +++ b/stdlib/asyncio/streams.pyi @@ -1,58 +1,123 @@ +import ssl import sys -from _typeshed import StrPath -from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Optional, Tuple +from _typeshed import Self, StrPath +from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence +from typing import Any +from typing_extensions import SupportsIndex, TypeAlias from . import events, protocols, transports from .base_events import Server -_ClientConnectedCallback = Callable[[StreamReader, StreamWriter], Optional[Awaitable[None]]] +if sys.platform == "win32": + if sys.version_info >= (3, 8): + __all__ = ("StreamReader", "StreamWriter", "StreamReaderProtocol", "open_connection", "start_server") + else: + __all__ = ( + "StreamReader", + "StreamWriter", + "StreamReaderProtocol", + "open_connection", + "start_server", + "IncompleteReadError", + "LimitOverrunError", + ) +else: + if sys.version_info >= (3, 8): + __all__ = ( + "StreamReader", + "StreamWriter", + "StreamReaderProtocol", + "open_connection", + "start_server", + "open_unix_connection", + "start_unix_server", + ) + else: + __all__ = ( + "StreamReader", + "StreamWriter", + "StreamReaderProtocol", + "open_connection", + "start_server", + "IncompleteReadError", + "LimitOverrunError", + "open_unix_connection", + "start_unix_server", + ) + +_ClientConnectedCallback: TypeAlias = Callable[[StreamReader, StreamWriter], Awaitable[None] | None] if sys.version_info < (3, 8): class IncompleteReadError(EOFError): expected: int | None partial: bytes def __init__(self, partial: bytes, expected: int | None) -> None: ... + class LimitOverrunError(Exception): consumed: int def __init__(self, message: str, consumed: int) -> None: ... -async def open_connection( - host: str | None = ..., - port: int | str | None = ..., - *, - loop: events.AbstractEventLoop | None = ..., - limit: int = ..., - ssl_handshake_timeout: float | None = ..., - **kwds: Any, -) -> Tuple[StreamReader, StreamWriter]: ... -async def start_server( - client_connected_cb: _ClientConnectedCallback, - host: str | None = ..., - port: int | str | None = ..., - *, - loop: events.AbstractEventLoop | None = ..., - limit: int = ..., - ssl_handshake_timeout: float | None = ..., - **kwds: Any, -) -> Server: ... +if sys.version_info >= (3, 10): + async def open_connection( + host: str | None = ..., + port: int | str | None = ..., + *, + limit: int = ..., + ssl_handshake_timeout: float | None = ..., + **kwds: Any, + ) -> tuple[StreamReader, StreamWriter]: ... + async def start_server( + client_connected_cb: _ClientConnectedCallback, + host: str | Sequence[str] | None = ..., + port: int | str | None = ..., + *, + limit: int = ..., + ssl_handshake_timeout: float | None = ..., + **kwds: Any, + ) -> Server: ... -if sys.platform != "win32": - if sys.version_info >= (3, 7): - _PathType = StrPath - else: - _PathType = str - async def open_unix_connection( - path: _PathType | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., **kwds: Any - ) -> Tuple[StreamReader, StreamWriter]: ... - async def start_unix_server( +else: + async def open_connection( + host: str | None = ..., + port: int | str | None = ..., + *, + loop: events.AbstractEventLoop | None = ..., + limit: int = ..., + ssl_handshake_timeout: float | None = ..., + **kwds: Any, + ) -> tuple[StreamReader, StreamWriter]: ... + async def start_server( client_connected_cb: _ClientConnectedCallback, - path: _PathType | None = ..., + host: str | None = ..., + port: int | str | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., + ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> Server: ... +if sys.platform != "win32": + if sys.version_info >= (3, 10): + async def open_unix_connection( + path: StrPath | None = ..., *, limit: int = ..., **kwds: Any + ) -> tuple[StreamReader, StreamWriter]: ... + async def start_unix_server( + client_connected_cb: _ClientConnectedCallback, path: StrPath | None = ..., *, limit: int = ..., **kwds: Any + ) -> Server: ... + else: + async def open_unix_connection( + path: StrPath | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., **kwds: Any + ) -> tuple[StreamReader, StreamWriter]: ... + async def start_unix_server( + client_connected_cb: _ClientConnectedCallback, + path: StrPath | None = ..., + *, + loop: events.AbstractEventLoop | None = ..., + limit: int = ..., + **kwds: Any, + ) -> Server: ... + class FlowControlMixin(protocols.Protocol): def __init__(self, loop: events.AbstractEventLoop | None = ...) -> None: ... @@ -63,43 +128,43 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): client_connected_cb: _ClientConnectedCallback | None = ..., loop: events.AbstractEventLoop | None = ..., ) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... - def connection_lost(self, exc: Exception | None) -> None: ... - def data_received(self, data: bytes) -> None: ... - def eof_received(self) -> bool: ... class StreamWriter: def __init__( self, - transport: transports.BaseTransport, + transport: transports.WriteTransport, protocol: protocols.BaseProtocol, reader: StreamReader | None, loop: events.AbstractEventLoop, ) -> None: ... @property - def transport(self) -> transports.BaseTransport: ... - def write(self, data: bytes) -> None: ... - def writelines(self, data: Iterable[bytes]) -> None: ... + def transport(self) -> transports.WriteTransport: ... + def write(self, data: bytes | bytearray | memoryview) -> None: ... + def writelines(self, data: Iterable[bytes | bytearray | memoryview]) -> None: ... def write_eof(self) -> None: ... def can_write_eof(self) -> bool: ... def close(self) -> None: ... - if sys.version_info >= (3, 7): - def is_closing(self) -> bool: ... - async def wait_closed(self) -> None: ... + def is_closing(self) -> bool: ... + async def wait_closed(self) -> None: ... def get_extra_info(self, name: str, default: Any = ...) -> Any: ... async def drain(self) -> None: ... + if sys.version_info >= (3, 11): + async def start_tls( + self, sslcontext: ssl.SSLContext, *, server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ... + ) -> None: ... -class StreamReader: +class StreamReader(AsyncIterator[bytes]): def __init__(self, limit: int = ..., loop: events.AbstractEventLoop | None = ...) -> None: ... def exception(self) -> Exception: ... def set_exception(self, exc: Exception) -> None: ... def set_transport(self, transport: transports.BaseTransport) -> None: ... def feed_eof(self) -> None: ... def at_eof(self) -> bool: ... - def feed_data(self, data: bytes) -> None: ... + def feed_data(self, data: Iterable[SupportsIndex]) -> None: ... async def readline(self) -> bytes: ... - async def readuntil(self, separator: bytes = ...) -> bytes: ... + # Can be any buffer that supports len(); consider changing to a Protocol if PEP 688 is accepted + async def readuntil(self, separator: bytes | bytearray | memoryview = ...) -> bytes: ... async def read(self, n: int = ...) -> bytes: ... async def readexactly(self, n: int) -> bytes: ... - def __aiter__(self) -> AsyncIterator[bytes]: ... + def __aiter__(self: Self) -> Self: ... async def __anext__(self) -> bytes: ... diff --git a/stdlib/asyncio/subprocess.pyi b/stdlib/asyncio/subprocess.pyi index 428260a..7fb5883 100644 --- a/stdlib/asyncio/subprocess.pyi +++ b/stdlib/asyncio/subprocess.pyi @@ -2,13 +2,16 @@ import subprocess import sys from _typeshed import StrOrBytesPath from asyncio import events, protocols, streams, transports -from typing import IO, Any, Callable, Tuple, Union -from typing_extensions import Literal +from collections.abc import Callable +from typing import IO, Any +from typing_extensions import Literal, TypeAlias + +__all__ = ("create_subprocess_exec", "create_subprocess_shell") if sys.version_info >= (3, 8): - _ExecArg = StrOrBytesPath + _ExecArg: TypeAlias = StrOrBytesPath else: - _ExecArg = Union[str, bytes] + _ExecArg: TypeAlias = str | bytes PIPE: int STDOUT: int @@ -19,10 +22,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessPro stdout: streams.StreamReader | None stderr: streams.StreamReader | None def __init__(self, limit: int, loop: events.AbstractEventLoop) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... def pipe_data_received(self, fd: int, data: bytes | str) -> None: ... - def pipe_connection_lost(self, fd: int, exc: Exception | None) -> None: ... - def process_exited(self) -> None: ... class Process: stdin: streams.StreamWriter | None @@ -38,7 +38,7 @@ class Process: def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... - async def communicate(self, input: bytes | None = ...) -> Tuple[bytes, bytes]: ... + async def communicate(self, input: bytes | bytearray | memoryview | None = ...) -> tuple[bytes, bytes]: ... if sys.version_info >= (3, 10): async def create_subprocess_shell( diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi new file mode 100644 index 0000000..0d508c9 --- /dev/null +++ b/stdlib/asyncio/taskgroups.pyi @@ -0,0 +1,20 @@ +# This only exists in 3.11+. See VERSIONS. + +from _typeshed import Self +from collections.abc import Coroutine, Generator +from contextvars import Context +from types import TracebackType +from typing import Any, TypeVar + +from .tasks import Task + +__all__ = ["TaskGroup"] + +_T = TypeVar("_T") + +class TaskGroup: + async def __aenter__(self: Self) -> Self: ... + async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... + def create_task( + self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ..., context: Context | None = ... + ) -> Task[_T]: ... diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 8cedc1e..67581eb 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -1,293 +1,321 @@ import concurrent.futures import sys -from collections.abc import Awaitable, Generator, Iterable, Iterator +from collections.abc import Awaitable, Coroutine, Generator, Iterable, Iterator from types import FrameType -from typing import Any, Generic, Optional, Set, TextIO, Tuple, TypeVar, Union, overload -from typing_extensions import Literal +from typing import Any, Generic, TextIO, TypeVar, overload +from typing_extensions import Literal, TypeAlias from .events import AbstractEventLoop from .futures import Future if sys.version_info >= (3, 9): from types import GenericAlias +if sys.version_info >= (3, 11): + from contextvars import Context + +__all__ = ( + "Task", + "create_task", + "FIRST_COMPLETED", + "FIRST_EXCEPTION", + "ALL_COMPLETED", + "wait", + "wait_for", + "as_completed", + "sleep", + "gather", + "shield", + "ensure_future", + "run_coroutine_threadsafe", + "current_task", + "all_tasks", + "_register_task", + "_unregister_task", + "_enter_task", + "_leave_task", +) _T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _FT = TypeVar("_FT", bound=Future[Any]) -_FutureT = Union[Future[_T], Generator[Any, None, _T], Awaitable[_T]] -_TaskYieldType = Optional[Future[object]] +_FutureLike: TypeAlias = Future[_T] | Generator[Any, None, _T] | Awaitable[_T] +_TaskYieldType: TypeAlias = Future[object] | None -FIRST_EXCEPTION: str -FIRST_COMPLETED: str -ALL_COMPLETED: str +FIRST_COMPLETED = concurrent.futures.FIRST_COMPLETED +FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION +ALL_COMPLETED = concurrent.futures.ALL_COMPLETED if sys.version_info >= (3, 10): - def as_completed(fs: Iterable[_FutureT[_T]], *, timeout: float | None = ...) -> Iterator[Future[_T]]: ... + def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = ...) -> Iterator[Future[_T]]: ... else: def as_completed( - fs: Iterable[_FutureT[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ... + fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ... ) -> Iterator[Future[_T]]: ... @overload -def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = ...) -> _FT: ... # type: ignore +def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = ...) -> _FT: ... # type: ignore[misc] @overload def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | None = ...) -> Task[_T]: ... -# Prior to Python 3.7 'async' was an alias for 'ensure_future'. -# It became a keyword in 3.7. - # `gather()` actually returns a list with length equal to the number # of tasks passed; however, Tuple is used similar to the annotation for # zip() because typing does not support variadic type variables. See # typing PR #1550 for discussion. +# +# The many type: ignores here are because the overloads overlap, +# but having overlapping overloads is the only way to get acceptable type inference in all edge cases. if sys.version_info >= (3, 10): @overload - def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: Literal[False] = ...) -> Future[Tuple[_T1]]: ... + def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: Literal[False] = ...) -> Future[tuple[_T1]]: ... # type: ignore[misc] @overload - def gather( - coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], *, return_exceptions: Literal[False] = ... - ) -> Future[Tuple[_T1, _T2]]: ... + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], __coro_or_future2: _FutureLike[_T2], *, return_exceptions: Literal[False] = ... + ) -> Future[tuple[_T1, _T2]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], *, return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2, _T3]]: ... + ) -> Future[tuple[_T1, _T2, _T3]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], *, return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ... + ) -> Future[tuple[_T1, _T2, _T3, _T4]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], - coro_or_future5: _FutureT[_T5], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], + __coro_or_future5: _FutureLike[_T5], *, return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... - @overload - def gather( - coro_or_future1: _FutureT[Any], - coro_or_future2: _FutureT[Any], - coro_or_future3: _FutureT[Any], - coro_or_future4: _FutureT[Any], - coro_or_future5: _FutureT[Any], - coro_or_future6: _FutureT[Any], - *coros_or_futures: _FutureT[Any], - return_exceptions: bool = ..., - ) -> Future[list[Any]]: ... + ) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload - def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: bool = ...) -> Future[Tuple[_T1 | BaseException]]: ... + def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ... # type: ignore[misc] @overload - def gather( - coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], *, return_exceptions: bool = ... - ) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException]]: ... + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], __coro_or_future2: _FutureLike[_T2], *, return_exceptions: bool + ) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], *, - return_exceptions: bool = ..., - ) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ... + return_exceptions: bool, + ) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], *, - return_exceptions: bool = ..., - ) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ... + return_exceptions: bool, + ) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], - coro_or_future5: _FutureT[_T5], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], + __coro_or_future5: _FutureLike[_T5], *, - return_exceptions: bool = ..., + return_exceptions: bool, ) -> Future[ - Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException] + tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException] ]: ... + @overload + def gather(*coros_or_futures: _FutureLike[Any], return_exceptions: bool = ...) -> Future[list[Any]]: ... # type: ignore[misc] else: @overload - def gather( - coro_or_future1: _FutureT[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ... - ) -> Future[Tuple[_T1]]: ... + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ... + ) -> Future[tuple[_T1]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2]]: ... + ) -> Future[tuple[_T1, _T2]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2, _T3]]: ... + ) -> Future[tuple[_T1, _T2, _T3]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ... + ) -> Future[tuple[_T1, _T2, _T3, _T4]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], - coro_or_future5: _FutureT[_T5], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], + __coro_or_future5: _FutureLike[_T5], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ..., - ) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... - @overload - def gather( - coro_or_future1: _FutureT[Any], - coro_or_future2: _FutureT[Any], - coro_or_future3: _FutureT[Any], - coro_or_future4: _FutureT[Any], - coro_or_future5: _FutureT[Any], - coro_or_future6: _FutureT[Any], - *coros_or_futures: _FutureT[Any], - loop: AbstractEventLoop | None = ..., - return_exceptions: bool = ..., - ) -> Future[list[Any]]: ... + ) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: bool = ... - ) -> Future[Tuple[_T1 | BaseException]]: ... + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: bool + ) -> Future[tuple[_T1 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], *, loop: AbstractEventLoop | None = ..., - return_exceptions: bool = ..., - ) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException]]: ... + return_exceptions: bool, + ) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], *, loop: AbstractEventLoop | None = ..., - return_exceptions: bool = ..., - ) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ... + return_exceptions: bool, + ) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], *, loop: AbstractEventLoop | None = ..., - return_exceptions: bool = ..., - ) -> Future[Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ... + return_exceptions: bool, + ) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ... @overload - def gather( - coro_or_future1: _FutureT[_T1], - coro_or_future2: _FutureT[_T2], - coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], - coro_or_future5: _FutureT[_T5], + def gather( # type: ignore[misc] + __coro_or_future1: _FutureLike[_T1], + __coro_or_future2: _FutureLike[_T2], + __coro_or_future3: _FutureLike[_T3], + __coro_or_future4: _FutureLike[_T4], + __coro_or_future5: _FutureLike[_T5], *, loop: AbstractEventLoop | None = ..., - return_exceptions: bool = ..., + return_exceptions: bool, ) -> Future[ - Tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException] + tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException] ]: ... + @overload + def gather( # type: ignore[misc] + *coros_or_futures: _FutureLike[Any], loop: AbstractEventLoop | None = ..., return_exceptions: bool = ... + ) -> Future[list[Any]]: ... -def run_coroutine_threadsafe(coro: _FutureT[_T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ... +def run_coroutine_threadsafe(coro: _FutureLike[_T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ... if sys.version_info >= (3, 10): - def shield(arg: _FutureT[_T]) -> Future[_T]: ... - def sleep(delay: float, result: _T = ...) -> Future[_T]: ... + def shield(arg: _FutureLike[_T]) -> Future[_T]: ... + @overload + async def sleep(delay: float) -> None: ... + @overload + async def sleep(delay: float, result: _T) -> _T: ... @overload - def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[Tuple[Set[_FT], Set[_FT]]]: ... # type: ignore + async def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> tuple[set[_FT], set[_FT]]: ... # type: ignore[misc] @overload - def wait( + async def wait( fs: Iterable[Awaitable[_T]], *, timeout: float | None = ..., return_when: str = ... - ) -> Future[Tuple[Set[Task[_T]], Set[Task[_T]]]]: ... - def wait_for(fut: _FutureT[_T], timeout: float | None) -> Future[_T]: ... + ) -> tuple[set[Task[_T]], set[Task[_T]]]: ... + async def wait_for(fut: _FutureLike[_T], timeout: float | None) -> _T: ... else: - def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... - def sleep(delay: float, result: _T = ..., *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... + def shield(arg: _FutureLike[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... @overload - def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[Tuple[Set[_FT], Set[_FT]]]: ... # type: ignore + async def sleep(delay: float, *, loop: AbstractEventLoop | None = ...) -> None: ... @overload - def wait( + async def sleep(delay: float, result: _T, *, loop: AbstractEventLoop | None = ...) -> _T: ... + @overload + async def wait( # type: ignore[misc] + fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ... + ) -> tuple[set[_FT], set[_FT]]: ... + @overload + async def wait( fs: Iterable[Awaitable[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ... - ) -> Future[Tuple[Set[Task[_T]], Set[Task[_T]]]]: ... - def wait_for(fut: _FutureT[_T], timeout: float | None, *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... + ) -> tuple[set[Task[_T]], set[Task[_T]]]: ... + async def wait_for(fut: _FutureLike[_T], timeout: float | None, *, loop: AbstractEventLoop | None = ...) -> _T: ... -class Task(Future[_T], Generic[_T]): +# mypy and pyright complain that a subclass of an invariant class shouldn't be covariant. +# While this is true in general, here it's sort-of okay to have a covariant subclass, +# since the only reason why `asyncio.Future` is invariant is the `set_result()` method, +# and `asyncio.Task.set_result()` always raises. +class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var] if sys.version_info >= (3, 8): def __init__( self, - coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T], + coro: Generator[_TaskYieldType, None, _T_co] | Awaitable[_T_co], *, loop: AbstractEventLoop = ..., name: str | None = ..., ) -> None: ... else: def __init__( - self, coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T], *, loop: AbstractEventLoop = ... + self, coro: Generator[_TaskYieldType, None, _T_co] | Awaitable[_T_co], *, loop: AbstractEventLoop = ... ) -> None: ... - def __repr__(self) -> str: ... if sys.version_info >= (3, 8): - def get_coro(self) -> Generator[_TaskYieldType, None, _T] | Awaitable[_T]: ... + def get_coro(self) -> Generator[_TaskYieldType, None, _T_co] | Awaitable[_T_co]: ... def get_name(self) -> str: ... def set_name(self, __value: object) -> None: ... + def get_stack(self, *, limit: int | None = ...) -> list[FrameType]: ... def print_stack(self, *, limit: int | None = ..., file: TextIO | None = ...) -> None: ... - if sys.version_info >= (3, 9): - def cancel(self, msg: Any | None = ...) -> bool: ... - else: - def cancel(self) -> bool: ... + if sys.version_info >= (3, 11): + def cancelling(self) -> int: ... + def uncancel(self) -> int: ... if sys.version_info < (3, 9): @classmethod def current_task(cls, loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ... @classmethod - def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> Set[Task[Any]]: ... - if sys.version_info < (3, 7): - def _wakeup(self, fut: Future[Any]) -> None: ... + def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -if sys.version_info >= (3, 7): - def all_tasks(loop: AbstractEventLoop | None = ...) -> Set[Task[Any]]: ... - if sys.version_info >= (3, 8): - def create_task(coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T], *, name: str | None = ...) -> Task[_T]: ... - else: - def create_task(coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T]) -> Task[_T]: ... - def current_task(loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ... +def all_tasks(loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ... + +if sys.version_info >= (3, 11): + def create_task( + coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ..., context: Context | None = ... + ) -> Task[_T]: ... + +elif sys.version_info >= (3, 8): + def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ...) -> Task[_T]: ... + +else: + def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T]) -> Task[_T]: ... + +def current_task(loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ... +def _enter_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ... +def _leave_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ... +def _register_task(task: Task[Any]) -> None: ... +def _unregister_task(task: Task[Any]) -> None: ... diff --git a/stdlib/asyncio/threads.pyi b/stdlib/asyncio/threads.pyi index 3f798d8..88c4fdd 100644 --- a/stdlib/asyncio/threads.pyi +++ b/stdlib/asyncio/threads.pyi @@ -1,7 +1,9 @@ -import sys -from typing import Any, Callable, TypeVar +from collections.abc import Callable +from typing import TypeVar +from typing_extensions import ParamSpec -_T = TypeVar("_T") +__all__ = ("to_thread",) +_P = ParamSpec("_P") +_R = TypeVar("_R") -if sys.version_info >= (3, 9): - async def to_thread(__func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ... +async def to_thread(__func: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... diff --git a/stdlib/asyncio/timeouts.pyi b/stdlib/asyncio/timeouts.pyi new file mode 100644 index 0000000..be516b5 --- /dev/null +++ b/stdlib/asyncio/timeouts.pyi @@ -0,0 +1,19 @@ +from _typeshed import Self +from types import TracebackType +from typing_extensions import final + +__all__ = ("Timeout", "timeout", "timeout_at") + +@final +class Timeout: + def __init__(self, when: float | None) -> None: ... + def when(self) -> float | None: ... + def reschedule(self, when: float | None) -> None: ... + def expired(self) -> bool: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + +def timeout(delay: float | None) -> Timeout: ... +def timeout_at(when: float | None) -> Timeout: ... diff --git a/stdlib/asyncio/transports.pyi b/stdlib/asyncio/transports.pyi index 51bf22b..893292d 100644 --- a/stdlib/asyncio/transports.pyi +++ b/stdlib/asyncio/transports.pyi @@ -1,28 +1,30 @@ -import sys from asyncio.events import AbstractEventLoop from asyncio.protocols import BaseProtocol +from collections.abc import Iterable, Mapping from socket import _Address -from typing import Any, Mapping, Tuple +from typing import Any + +__all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "DatagramTransport", "SubprocessTransport") class BaseTransport: - def __init__(self, extra: Mapping[Any, Any] | None = ...) -> None: ... - def get_extra_info(self, name: Any, default: Any = ...) -> Any: ... + def __init__(self, extra: Mapping[str, Any] | None = ...) -> None: ... + def get_extra_info(self, name: str, default: Any = ...) -> Any: ... def is_closing(self) -> bool: ... def close(self) -> None: ... def set_protocol(self, protocol: BaseProtocol) -> None: ... def get_protocol(self) -> BaseProtocol: ... class ReadTransport(BaseTransport): - if sys.version_info >= (3, 7): - def is_reading(self) -> bool: ... + def is_reading(self) -> bool: ... def pause_reading(self) -> None: ... def resume_reading(self) -> None: ... class WriteTransport(BaseTransport): def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... def get_write_buffer_size(self) -> int: ... - def write(self, data: Any) -> None: ... - def writelines(self, list_of_data: list[Any]) -> None: ... + def get_write_buffer_limits(self) -> tuple[int, int]: ... + def write(self, data: bytes | bytearray | memoryview) -> None: ... + def writelines(self, list_of_data: Iterable[bytes | bytearray | memoryview]) -> None: ... def write_eof(self) -> None: ... def can_write_eof(self) -> bool: ... def abort(self) -> None: ... @@ -30,17 +32,16 @@ class WriteTransport(BaseTransport): class Transport(ReadTransport, WriteTransport): ... class DatagramTransport(BaseTransport): - def sendto(self, data: Any, addr: _Address | None = ...) -> None: ... + def sendto(self, data: bytes | bytearray | memoryview, addr: _Address | None = ...) -> None: ... def abort(self) -> None: ... class SubprocessTransport(BaseTransport): def get_pid(self) -> int: ... def get_returncode(self) -> int | None: ... def get_pipe_transport(self, fd: int) -> BaseTransport | None: ... - def send_signal(self, signal: int) -> int: ... + def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... class _FlowControlMixin(Transport): - def __init__(self, extra: Mapping[Any, Any] | None = ..., loop: AbstractEventLoop | None = ...) -> None: ... - def get_write_buffer_limits(self) -> Tuple[int, int]: ... + def __init__(self, extra: Mapping[str, Any] | None = ..., loop: AbstractEventLoop | None = ...) -> None: ... diff --git a/stdlib/asyncio/trsock.pyi b/stdlib/asyncio/trsock.pyi index 16c65d5..742216a 100644 --- a/stdlib/asyncio/trsock.pyi +++ b/stdlib/asyncio/trsock.pyi @@ -1,47 +1,56 @@ import socket import sys +from _typeshed import ReadableBuffer +from builtins import type as Type # alias to avoid name clashes with property named "type" +from collections.abc import Iterable from types import TracebackType -from typing import Any, BinaryIO, Iterable, NoReturn, Tuple, Type, Union, overload +from typing import Any, BinaryIO, NoReturn, overload +from typing_extensions import TypeAlias -if sys.version_info >= (3, 8): - # These are based in socket, maybe move them out into _typeshed.pyi or such - _Address = Union[Tuple[Any, ...], str] - _RetAddress = Any - _WriteBuffer = Union[bytearray, memoryview] - _CMSG = Tuple[int, int, bytes] - class TransportSocket: - def __init__(self, sock: socket.socket) -> None: ... +# These are based in socket, maybe move them out into _typeshed.pyi or such +_Address: TypeAlias = socket._Address +_RetAddress: TypeAlias = Any +_WriteBuffer: TypeAlias = bytearray | memoryview +_CMSG: TypeAlias = tuple[int, int, bytes] + +class TransportSocket: + def __init__(self, sock: socket.socket) -> None: ... + @property + def family(self) -> int: ... + @property + def type(self) -> int: ... + @property + def proto(self) -> int: ... + def __getstate__(self) -> NoReturn: ... + def fileno(self) -> int: ... + def dup(self) -> socket.socket: ... + def get_inheritable(self) -> bool: ... + def shutdown(self, how: int) -> None: ... + @overload + def getsockopt(self, level: int, optname: int) -> int: ... + @overload + def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... + @overload + def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer) -> None: ... + @overload + def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ... + def getpeername(self) -> _RetAddress: ... + def getsockname(self) -> _RetAddress: ... + def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through? + def settimeout(self, value: float | None) -> None: ... + def gettimeout(self) -> float | None: ... + def setblocking(self, flag: bool) -> None: ... + if sys.version_info < (3, 11): def _na(self, what: str) -> None: ... - @property - def family(self) -> int: ... - @property - def type(self) -> int: ... - @property - def proto(self) -> int: ... - def __getstate__(self) -> NoReturn: ... - def fileno(self) -> int: ... - def dup(self) -> socket.socket: ... - def get_inheritable(self) -> bool: ... - def shutdown(self, how: int) -> None: ... - @overload - def getsockopt(self, level: int, optname: int) -> int: ... - @overload - def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - @overload - def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ... - @overload - def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ... - def getpeername(self) -> _RetAddress: ... - def getsockname(self) -> _RetAddress: ... - def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through? - def accept(self) -> Tuple[socket.socket, _RetAddress]: ... - def connect(self, address: _Address | bytes) -> None: ... - def connect_ex(self, address: _Address | bytes) -> int: ... - def bind(self, address: _Address | bytes) -> None: ... + def accept(self) -> tuple[socket.socket, _RetAddress]: ... + def connect(self, address: _Address) -> None: ... + def connect_ex(self, address: _Address) -> int: ... + def bind(self, address: _Address) -> None: ... if sys.platform == "win32": - def ioctl(self, control: int, option: int | Tuple[int, int, int] | bool) -> None: ... + def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ... else: - def ioctl(self, control: int, option: int | Tuple[int, int, int] | bool) -> NoReturn: ... + def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> NoReturn: ... + def listen(self, __backlog: int = ...) -> None: ... def makefile(self) -> BinaryIO: ... def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ... @@ -49,37 +58,40 @@ if sys.version_info >= (3, 8): def detach(self) -> int: ... if sys.platform == "linux": def sendmsg_afalg( - self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ... + self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ... ) -> int: ... else: def sendmsg_afalg( - self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ... + self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ... ) -> NoReturn: ... + def sendmsg( - self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ... + self, + __buffers: Iterable[ReadableBuffer], + __ancdata: Iterable[_CMSG] = ..., + __flags: int = ..., + __address: _Address = ..., ) -> int: ... @overload - def sendto(self, data: bytes, address: _Address) -> int: ... + def sendto(self, data: ReadableBuffer, address: _Address) -> int: ... @overload - def sendto(self, data: bytes, flags: int, address: _Address) -> int: ... - def send(self, data: bytes, flags: int = ...) -> int: ... - def sendall(self, data: bytes, flags: int = ...) -> None: ... + def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ... + def send(self, data: ReadableBuffer, flags: int = ...) -> int: ... + def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ... def set_inheritable(self, inheritable: bool) -> None: ... if sys.platform == "win32": def share(self, process_id: int) -> bytes: ... else: def share(self, process_id: int) -> NoReturn: ... + def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ... - def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ... + def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ... def recvmsg_into( self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ... - ) -> Tuple[int, list[_CMSG], int, Any]: ... - def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, list[_CMSG], int, Any]: ... - def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ... + ) -> tuple[int, list[_CMSG], int, Any]: ... + def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> tuple[bytes, list[_CMSG], int, Any]: ... + def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ... def recv(self, bufsize: int, flags: int = ...) -> bytes: ... - def settimeout(self, value: float | None) -> None: ... - def gettimeout(self) -> float | None: ... - def setblocking(self, flag: bool) -> None: ... def __enter__(self) -> socket.socket: ... def __exit__( self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None diff --git a/stdlib/asyncio/unix_events.pyi b/stdlib/asyncio/unix_events.pyi index e8e57a2..19dd3ca 100644 --- a/stdlib/asyncio/unix_events.pyi +++ b/stdlib/asyncio/unix_events.pyi @@ -1,61 +1,129 @@ import sys import types from _typeshed import Self -from socket import socket -from typing import Any, Callable, Type +from abc import ABCMeta, abstractmethod +from collections.abc import Callable +from typing import Any +from typing_extensions import Literal -from .base_events import Server -from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext +from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy from .selector_events import BaseSelectorEventLoop +# This is also technically not available on Win, +# but other parts of typeshed need this definition. +# So, it is special cased. class AbstractChildWatcher: - def add_child_handler(self, pid: int, callback: Callable[..., Any], *args: Any) -> None: ... + @abstractmethod + def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ... + @abstractmethod def remove_child_handler(self, pid: int) -> bool: ... + @abstractmethod def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + @abstractmethod def close(self) -> None: ... + @abstractmethod def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... + @abstractmethod + def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... if sys.version_info >= (3, 8): + @abstractmethod def is_active(self) -> bool: ... -class BaseChildWatcher(AbstractChildWatcher): - def __init__(self) -> None: ... +if sys.platform != "win32": + if sys.version_info >= (3, 9): + __all__ = ( + "SelectorEventLoop", + "AbstractChildWatcher", + "SafeChildWatcher", + "FastChildWatcher", + "PidfdChildWatcher", + "MultiLoopChildWatcher", + "ThreadedChildWatcher", + "DefaultEventLoopPolicy", + ) + elif sys.version_info >= (3, 8): + __all__ = ( + "SelectorEventLoop", + "AbstractChildWatcher", + "SafeChildWatcher", + "FastChildWatcher", + "MultiLoopChildWatcher", + "ThreadedChildWatcher", + "DefaultEventLoopPolicy", + ) + else: + __all__ = ("SelectorEventLoop", "AbstractChildWatcher", "SafeChildWatcher", "FastChildWatcher", "DefaultEventLoopPolicy") -class SafeChildWatcher(BaseChildWatcher): - def __enter__(self: Self) -> Self: ... + # Doesn't actually have ABCMeta metaclass at runtime, but mypy complains if we don't have it in the stub. + # See discussion in #7412 + class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta): + def close(self) -> None: ... + if sys.version_info >= (3, 8): + def is_active(self) -> bool: ... -class FastChildWatcher(BaseChildWatcher): - def __enter__(self: Self) -> Self: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... -class _UnixSelectorEventLoop(BaseSelectorEventLoop): - if sys.version_info < (3, 7): - async def create_unix_server( - self, - protocol_factory: _ProtocolFactory, - path: str | None = ..., - *, - sock: socket | None = ..., - backlog: int = ..., - ssl: _SSLContext = ..., - ) -> Server: ... - -class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy): - def get_child_watcher(self) -> AbstractChildWatcher: ... - def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ... - -SelectorEventLoop = _UnixSelectorEventLoop - -DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy - -if sys.version_info >= (3, 8): - - from typing import Protocol - class _Warn(Protocol): - def __call__( - self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ... - ) -> None: ... - class MultiLoopChildWatcher(AbstractChildWatcher): + class SafeChildWatcher(BaseChildWatcher): def __enter__(self: Self) -> Self: ... - class ThreadedChildWatcher(AbstractChildWatcher): + def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ... + def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + + class FastChildWatcher(BaseChildWatcher): def __enter__(self: Self) -> Self: ... - def __del__(self, _warn: _Warn = ...) -> None: ... + def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ... + def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + + class _UnixSelectorEventLoop(BaseSelectorEventLoop): ... + + class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy): + def get_child_watcher(self) -> AbstractChildWatcher: ... + def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ... + SelectorEventLoop = _UnixSelectorEventLoop + + DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy + + if sys.version_info >= (3, 8): + + from typing import Protocol + + class _Warn(Protocol): + def __call__( + self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ... + ) -> object: ... + + class MultiLoopChildWatcher(AbstractChildWatcher): + def is_active(self) -> bool: ... + def close(self) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... + def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + + class ThreadedChildWatcher(AbstractChildWatcher): + def is_active(self) -> Literal[True]: ... + def close(self) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... + def __del__(self, _warn: _Warn = ...) -> None: ... + def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + + if sys.version_info >= (3, 9): + class PidfdChildWatcher(AbstractChildWatcher): + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... + def is_active(self) -> bool: ... + def close(self) -> None: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... diff --git a/stdlib/asyncio/windows_events.pyi b/stdlib/asyncio/windows_events.pyi index 19e4561..dca06ea 100644 --- a/stdlib/asyncio/windows_events.pyi +++ b/stdlib/asyncio/windows_events.pyi @@ -1,77 +1,74 @@ import socket import sys -from _typeshed import WriteableBuffer -from typing import IO, Any, Callable, ClassVar, NoReturn, Tuple, Type +from _typeshed import Incomplete, WriteableBuffer +from collections.abc import Callable +from typing import IO, Any, ClassVar, NoReturn +from typing_extensions import Literal from . import events, futures, proactor_events, selector_events, streams, windows_utils -__all__ = [ - "SelectorEventLoop", - "ProactorEventLoop", - "IocpProactor", - "DefaultEventLoopPolicy", - "WindowsSelectorEventLoopPolicy", - "WindowsProactorEventLoopPolicy", -] +if sys.platform == "win32": + __all__ = ( + "SelectorEventLoop", + "ProactorEventLoop", + "IocpProactor", + "DefaultEventLoopPolicy", + "WindowsSelectorEventLoopPolicy", + "WindowsProactorEventLoopPolicy", + ) -NULL: int -INFINITE: int -ERROR_CONNECTION_REFUSED: int -ERROR_CONNECTION_ABORTED: int -CONNECT_PIPE_INIT_DELAY: float -CONNECT_PIPE_MAX_DELAY: float + NULL: Literal[0] + INFINITE: Literal[0xFFFFFFFF] + ERROR_CONNECTION_REFUSED: Literal[1225] + ERROR_CONNECTION_ABORTED: Literal[1236] + CONNECT_PIPE_INIT_DELAY: float + CONNECT_PIPE_MAX_DELAY: float -class PipeServer: - def __init__(self, address: str) -> None: ... - def __del__(self) -> None: ... - def closed(self) -> bool: ... - def close(self) -> None: ... + class PipeServer: + def __init__(self, address: str) -> None: ... + def __del__(self) -> None: ... + def closed(self) -> bool: ... + def close(self) -> None: ... -class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ... + class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ... -class ProactorEventLoop(proactor_events.BaseProactorEventLoop): - def __init__(self, proactor: IocpProactor | None = ...) -> None: ... - async def create_pipe_connection( - self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str - ) -> Tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ... - async def start_serving_pipe( - self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str - ) -> list[PipeServer]: ... + class ProactorEventLoop(proactor_events.BaseProactorEventLoop): + def __init__(self, proactor: IocpProactor | None = ...) -> None: ... + async def create_pipe_connection( + self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str + ) -> tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ... + async def start_serving_pipe( + self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str + ) -> list[PipeServer]: ... -class IocpProactor: - def __init__(self, concurrency: int = ...) -> None: ... - def __repr__(self) -> str: ... - def __del__(self) -> None: ... - def set_loop(self, loop: events.AbstractEventLoop) -> None: ... - def select(self, timeout: int | None = ...) -> list[futures.Future[Any]]: ... - def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ... - if sys.version_info >= (3, 7): + class IocpProactor: + def __init__(self, concurrency: int = ...) -> None: ... + def __del__(self) -> None: ... + def set_loop(self, loop: events.AbstractEventLoop) -> None: ... + def select(self, timeout: int | None = ...) -> list[futures.Future[Any]]: ... + def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ... def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ... - def send(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ... - def accept(self, listener: socket.socket) -> futures.Future[Any]: ... - def connect(self, conn: socket.socket, address: bytes) -> futures.Future[Any]: ... - if sys.version_info >= (3, 7): + def send(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ... + def accept(self, listener: socket.socket) -> futures.Future[Any]: ... + def connect( + self, + conn: socket.socket, + address: tuple[Incomplete, Incomplete] | tuple[Incomplete, Incomplete, Incomplete, Incomplete], + ) -> futures.Future[Any]: ... def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ... - def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ... - async def connect_pipe(self, address: bytes) -> windows_utils.PipeHandle: ... - def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = ...) -> bool: ... - def close(self) -> None: ... + def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ... + async def connect_pipe(self, address: str) -> windows_utils.PipeHandle: ... + def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = ...) -> bool: ... + def close(self) -> None: ... + SelectorEventLoop = _WindowsSelectorEventLoop -SelectorEventLoop = _WindowsSelectorEventLoop - -if sys.version_info >= (3, 7): class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy): - _loop_factory: ClassVar[Type[SelectorEventLoop]] + _loop_factory: ClassVar[type[SelectorEventLoop]] def get_child_watcher(self) -> NoReturn: ... def set_child_watcher(self, watcher: Any) -> NoReturn: ... + class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy): - _loop_factory: ClassVar[Type[ProactorEventLoop]] + _loop_factory: ClassVar[type[ProactorEventLoop]] def get_child_watcher(self) -> NoReturn: ... def set_child_watcher(self, watcher: Any) -> NoReturn: ... DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy -else: - class _WindowsDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy): - _loop_factory: ClassVar[Type[SelectorEventLoop]] - def get_child_watcher(self) -> NoReturn: ... - def set_child_watcher(self, watcher: Any) -> NoReturn: ... - DefaultEventLoopPolicy = _WindowsDefaultEventLoopPolicy diff --git a/stdlib/asyncio/windows_utils.pyi b/stdlib/asyncio/windows_utils.pyi index f32ed3c..6e170dc 100644 --- a/stdlib/asyncio/windows_utils.pyi +++ b/stdlib/asyncio/windows_utils.pyi @@ -1,27 +1,58 @@ +import subprocess import sys from _typeshed import Self +from collections.abc import Callable from types import TracebackType -from typing import Callable, Protocol, Tuple, Type +from typing import Any, AnyStr, Protocol +from typing_extensions import Literal -class _WarnFunction(Protocol): - def __call__(self, message: str, category: Type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...) -> None: ... +if sys.platform == "win32": + __all__ = ("pipe", "Popen", "PIPE", "PipeHandle") -BUFSIZE: int -PIPE: int -STDOUT: int + class _WarnFunction(Protocol): + def __call__( + self, message: str, category: type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ... + ) -> object: ... + BUFSIZE: Literal[8192] + PIPE = subprocess.PIPE + STDOUT = subprocess.STDOUT + def pipe(*, duplex: bool = ..., overlapped: tuple[bool, bool] = ..., bufsize: int = ...) -> tuple[int, int]: ... -def pipe(*, duplex: bool = ..., overlapped: Tuple[bool, bool] = ..., bufsize: int = ...) -> Tuple[int, int]: ... + class PipeHandle: + def __init__(self, handle: int) -> None: ... + if sys.version_info >= (3, 8): + def __del__(self, _warn: _WarnFunction = ...) -> None: ... + else: + def __del__(self) -> None: ... -class PipeHandle: - def __init__(self, handle: int) -> None: ... - def __repr__(self) -> str: ... - if sys.version_info >= (3, 8): - def __del__(self, _warn: _WarnFunction = ...) -> None: ... - else: - def __del__(self) -> None: ... - def __enter__(self: Self) -> Self: ... - def __exit__(self, t: type | None, v: BaseException | None, tb: TracebackType | None) -> None: ... - @property - def handle(self) -> int: ... - def fileno(self) -> int: ... - def close(self, *, CloseHandle: Callable[[int], None] = ...) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + @property + def handle(self) -> int: ... + def fileno(self) -> int: ... + def close(self, *, CloseHandle: Callable[[int], object] = ...) -> None: ... + + class Popen(subprocess.Popen[AnyStr]): + stdin: PipeHandle | None # type: ignore[assignment] + stdout: PipeHandle | None # type: ignore[assignment] + stderr: PipeHandle | None # type: ignore[assignment] + # For simplicity we omit the full overloaded __new__ signature of + # subprocess.Popen. The arguments are mostly the same, but + # subprocess.Popen takes other positional-or-keyword arguments before + # stdin. + def __new__( + cls: type[Self], + args: subprocess._CMD, + stdin: subprocess._FILE | None = ..., + stdout: subprocess._FILE | None = ..., + stderr: subprocess._FILE | None = ..., + **kwds: Any, + ) -> Self: ... + def __init__( + self, + args: subprocess._CMD, + stdin: subprocess._FILE | None = ..., + stdout: subprocess._FILE | None = ..., + stderr: subprocess._FILE | None = ..., + **kwds: Any, + ) -> None: ... diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 146d91f..565deb4 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -1,25 +1,26 @@ import sys -from _typeshed import FileDescriptorLike +from _typeshed import FileDescriptorLike, ReadableBuffer from socket import socket -from typing import Any, Dict, Tuple, overload +from typing import Any, overload +from typing_extensions import TypeAlias # cyclic dependence with asynchat -_maptype = Dict[int, Any] -_socket = socket +_MapType: TypeAlias = dict[int, Any] +_Socket: TypeAlias = socket -socket_map: _maptype # undocumented +socket_map: _MapType # undocumented class ExitNow(Exception): ... def read(obj: Any) -> None: ... def write(obj: Any) -> None: ... def readwrite(obj: Any, flags: int) -> None: ... -def poll(timeout: float = ..., map: _maptype | None = ...) -> None: ... -def poll2(timeout: float = ..., map: _maptype | None = ...) -> None: ... +def poll(timeout: float = ..., map: _MapType | None = ...) -> None: ... +def poll2(timeout: float = ..., map: _MapType | None = ...) -> None: ... poll3 = poll2 -def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype | None = ..., count: int | None = ...) -> None: ... +def loop(timeout: float = ..., use_poll: bool = ..., map: _MapType | None = ..., count: int | None = ...) -> None: ... # Not really subclass of socket.socket; it's only delegation. # It is not covariant to it. @@ -31,20 +32,20 @@ class dispatcher: connecting: bool closing: bool ignore_log_types: frozenset[str] - socket: _socket | None - def __init__(self, sock: _socket | None = ..., map: _maptype | None = ...) -> None: ... - def add_channel(self, map: _maptype | None = ...) -> None: ... - def del_channel(self, map: _maptype | None = ...) -> None: ... + socket: _Socket | None + def __init__(self, sock: _Socket | None = ..., map: _MapType | None = ...) -> None: ... + def add_channel(self, map: _MapType | None = ...) -> None: ... + def del_channel(self, map: _MapType | None = ...) -> None: ... def create_socket(self, family: int = ..., type: int = ...) -> None: ... - def set_socket(self, sock: _socket, map: _maptype | None = ...) -> None: ... + def set_socket(self, sock: _Socket, map: _MapType | None = ...) -> None: ... def set_reuse_addr(self) -> None: ... def readable(self) -> bool: ... def writable(self) -> bool: ... def listen(self, num: int) -> None: ... - def bind(self, addr: Tuple[Any, ...] | str) -> None: ... - def connect(self, address: Tuple[Any, ...] | str) -> None: ... - def accept(self) -> Tuple[_socket, Any] | None: ... - def send(self, data: bytes) -> int: ... + def bind(self, addr: tuple[Any, ...] | str) -> None: ... + def connect(self, address: tuple[Any, ...] | str) -> None: ... + def accept(self) -> tuple[_Socket, Any] | None: ... + def send(self, data: ReadableBuffer) -> int: ... def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... def log(self, message: Any) -> None: ... @@ -62,14 +63,12 @@ class dispatcher: def handle_close(self) -> None: ... class dispatcher_with_send(dispatcher): - def __init__(self, sock: socket | None = ..., map: _maptype | None = ...) -> None: ... def initiate_send(self) -> None: ... - def handle_write(self) -> None: ... # incompatible signature: # def send(self, data: bytes) -> int | None: ... -def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ... -def close_all(map: _maptype | None = ..., ignore_all: bool = ...) -> None: ... +def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ... +def close_all(map: _MapType | None = ..., ignore_all: bool = ...) -> None: ... if sys.platform != "win32": class file_wrapper: @@ -85,6 +84,7 @@ if sys.platform != "win32": def write(self, data: bytes, flags: int = ...) -> int: ... def close(self) -> None: ... def fileno(self) -> int: ... + class file_dispatcher(dispatcher): - def __init__(self, fd: FileDescriptorLike, map: _maptype | None = ...) -> None: ... + def __init__(self, fd: FileDescriptorLike, map: _MapType | None = ...) -> None: ... def set_file(self, fd: int) -> None: ... diff --git a/stdlib/atexit.pyi b/stdlib/atexit.pyi index 9395c60..ea041d7 100644 --- a/stdlib/atexit.pyi +++ b/stdlib/atexit.pyi @@ -1,4 +1,5 @@ -from typing import Any, Callable, TypeVar +from collections.abc import Callable +from typing import TypeVar from typing_extensions import ParamSpec _T = TypeVar("_T") @@ -7,5 +8,5 @@ _P = ParamSpec("_P") def _clear() -> None: ... def _ncallbacks() -> int: ... def _run_exitfuncs() -> None: ... -def register(func: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]: ... # type: ignore -def unregister(func: Callable[..., Any]) -> None: ... +def register(func: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]: ... +def unregister(func: Callable[..., object]) -> None: ... diff --git a/stdlib/audioop.pyi b/stdlib/audioop.pyi index 71671af..62b54ce 100644 --- a/stdlib/audioop.pyi +++ b/stdlib/audioop.pyi @@ -1,12 +1,12 @@ -from typing import Tuple +from typing_extensions import TypeAlias -AdpcmState = Tuple[int, int] -RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]] +_AdpcmState: TypeAlias = tuple[int, int] +_RatecvState: TypeAlias = tuple[int, tuple[tuple[int, int], ...]] class error(Exception): ... def add(__fragment1: bytes, __fragment2: bytes, __width: int) -> bytes: ... -def adpcm2lin(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ... +def adpcm2lin(__fragment: bytes, __width: int, __state: _AdpcmState | None) -> tuple[bytes, _AdpcmState]: ... def alaw2lin(__fragment: bytes, __width: int) -> bytes: ... def avg(__fragment: bytes, __width: int) -> int: ... def avgpp(__fragment: bytes, __width: int) -> int: ... @@ -14,16 +14,16 @@ def bias(__fragment: bytes, __width: int, __bias: int) -> bytes: ... def byteswap(__fragment: bytes, __width: int) -> bytes: ... def cross(__fragment: bytes, __width: int) -> int: ... def findfactor(__fragment: bytes, __reference: bytes) -> float: ... -def findfit(__fragment: bytes, __reference: bytes) -> Tuple[int, float]: ... +def findfit(__fragment: bytes, __reference: bytes) -> tuple[int, float]: ... def findmax(__fragment: bytes, __length: int) -> int: ... def getsample(__fragment: bytes, __width: int, __index: int) -> int: ... -def lin2adpcm(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ... +def lin2adpcm(__fragment: bytes, __width: int, __state: _AdpcmState | None) -> tuple[bytes, _AdpcmState]: ... def lin2alaw(__fragment: bytes, __width: int) -> bytes: ... def lin2lin(__fragment: bytes, __width: int, __newwidth: int) -> bytes: ... def lin2ulaw(__fragment: bytes, __width: int) -> bytes: ... def max(__fragment: bytes, __width: int) -> int: ... def maxpp(__fragment: bytes, __width: int) -> int: ... -def minmax(__fragment: bytes, __width: int) -> Tuple[int, int]: ... +def minmax(__fragment: bytes, __width: int) -> tuple[int, int]: ... def mul(__fragment: bytes, __width: int, __factor: float) -> bytes: ... def ratecv( __fragment: bytes, @@ -31,10 +31,10 @@ def ratecv( __nchannels: int, __inrate: int, __outrate: int, - __state: RatecvState | None, + __state: _RatecvState | None, __weightA: int = ..., __weightB: int = ..., -) -> Tuple[bytes, RatecvState]: ... +) -> tuple[bytes, _RatecvState]: ... def reverse(__fragment: bytes, __width: int) -> bytes: ... def rms(__fragment: bytes, __width: int) -> int: ... def tomono(__fragment: bytes, __width: int, __lfactor: float, __rfactor: float) -> bytes: ... diff --git a/stdlib/base64.pyi b/stdlib/base64.pyi index 8610eea..816622e 100644 --- a/stdlib/base64.pyi +++ b/stdlib/base64.pyi @@ -1,30 +1,57 @@ import sys +from _typeshed import ReadableBuffer from typing import IO -def b64encode(s: bytes, altchars: bytes | None = ...) -> bytes: ... -def b64decode(s: str | bytes, altchars: bytes | None = ..., validate: bool = ...) -> bytes: ... -def standard_b64encode(s: bytes) -> bytes: ... -def standard_b64decode(s: str | bytes) -> bytes: ... -def urlsafe_b64encode(s: bytes) -> bytes: ... -def urlsafe_b64decode(s: str | bytes) -> bytes: ... -def b32encode(s: bytes) -> bytes: ... -def b32decode(s: str | bytes, casefold: bool = ..., map01: bytes | None = ...) -> bytes: ... -def b16encode(s: bytes) -> bytes: ... -def b16decode(s: str | bytes, casefold: bool = ...) -> bytes: ... +__all__ = [ + "encode", + "decode", + "encodebytes", + "decodebytes", + "b64encode", + "b64decode", + "b32encode", + "b32decode", + "b16encode", + "b16decode", + "b85encode", + "b85decode", + "a85encode", + "a85decode", + "standard_b64encode", + "standard_b64decode", + "urlsafe_b64encode", + "urlsafe_b64decode", +] if sys.version_info >= (3, 10): - def b32hexencode(s: bytes) -> bytes: ... - def b32hexdecode(s: str | bytes, casefold: bool = ...) -> bytes: ... + __all__ += ["b32hexencode", "b32hexdecode"] -def a85encode(b: bytes, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ... -def a85decode(b: str | bytes, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: str | bytes = ...) -> bytes: ... -def b85encode(b: bytes, pad: bool = ...) -> bytes: ... -def b85decode(b: str | bytes) -> bytes: ... +def b64encode(s: ReadableBuffer, altchars: ReadableBuffer | None = ...) -> bytes: ... +def b64decode(s: str | ReadableBuffer, altchars: ReadableBuffer | None = ..., validate: bool = ...) -> bytes: ... +def standard_b64encode(s: ReadableBuffer) -> bytes: ... +def standard_b64decode(s: str | ReadableBuffer) -> bytes: ... +def urlsafe_b64encode(s: ReadableBuffer) -> bytes: ... +def urlsafe_b64decode(s: str | ReadableBuffer) -> bytes: ... +def b32encode(s: ReadableBuffer) -> bytes: ... +def b32decode(s: str | ReadableBuffer, casefold: bool = ..., map01: bytes | None = ...) -> bytes: ... +def b16encode(s: ReadableBuffer) -> bytes: ... +def b16decode(s: str | ReadableBuffer, casefold: bool = ...) -> bytes: ... + +if sys.version_info >= (3, 10): + def b32hexencode(s: ReadableBuffer) -> bytes: ... + def b32hexdecode(s: str | ReadableBuffer, casefold: bool = ...) -> bytes: ... + +def a85encode(b: ReadableBuffer, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ... +def a85decode( + b: str | ReadableBuffer, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: bytearray | bytes = ... +) -> bytes: ... +def b85encode(b: ReadableBuffer, pad: bool = ...) -> bytes: ... +def b85decode(b: str | ReadableBuffer) -> bytes: ... def decode(input: IO[bytes], output: IO[bytes]) -> None: ... def encode(input: IO[bytes], output: IO[bytes]) -> None: ... -def encodebytes(s: bytes) -> bytes: ... -def decodebytes(s: bytes) -> bytes: ... +def encodebytes(s: ReadableBuffer) -> bytes: ... +def decodebytes(s: ReadableBuffer) -> bytes: ... if sys.version_info < (3, 9): - def encodestring(s: bytes) -> bytes: ... - def decodestring(s: bytes) -> bytes: ... + def encodestring(s: ReadableBuffer) -> bytes: ... + def decodestring(s: ReadableBuffer) -> bytes: ... diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index 34eb989..5880863 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -1,17 +1,21 @@ +import sys +from _typeshed import ExcInfo, TraceFunction +from collections.abc import Callable, Iterable, Mapping from types import CodeType, FrameType, TracebackType -from typing import IO, Any, Callable, Iterable, Mapping, Set, SupportsInt, Tuple, Type, TypeVar +from typing import IO, Any, SupportsInt, TypeVar +from typing_extensions import Literal, ParamSpec + +__all__ = ["BdbQuit", "Bdb", "Breakpoint"] _T = TypeVar("_T") -_TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type -_ExcInfo = Tuple[Type[BaseException], BaseException, FrameType] +_P = ParamSpec("_P") -GENERATOR_AND_COROUTINE_FLAGS: int +GENERATOR_AND_COROUTINE_FLAGS: Literal[672] class BdbQuit(Exception): ... class Bdb: - - skip: Set[str] | None + skip: set[str] | None breaks: dict[str, list[int]] fncache: dict[str, str] frame_returning: FrameType | None @@ -23,11 +27,11 @@ class Bdb: def __init__(self, skip: Iterable[str] | None = ...) -> None: ... def canonic(self, filename: str) -> str: ... def reset(self) -> None: ... - def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> _TraceDispatch: ... - def dispatch_line(self, frame: FrameType) -> _TraceDispatch: ... - def dispatch_call(self, frame: FrameType, arg: None) -> _TraceDispatch: ... - def dispatch_return(self, frame: FrameType, arg: Any) -> _TraceDispatch: ... - def dispatch_exception(self, frame: FrameType, arg: _ExcInfo) -> _TraceDispatch: ... + def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> TraceFunction: ... + def dispatch_line(self, frame: FrameType) -> TraceFunction: ... + def dispatch_call(self, frame: FrameType, arg: None) -> TraceFunction: ... + def dispatch_return(self, frame: FrameType, arg: Any) -> TraceFunction: ... + def dispatch_exception(self, frame: FrameType, arg: ExcInfo) -> TraceFunction: ... def is_skipped_module(self, module_name: str) -> bool: ... def stop_here(self, frame: FrameType) -> bool: ... def break_here(self, frame: FrameType) -> bool: ... @@ -36,7 +40,7 @@ class Bdb: def user_call(self, frame: FrameType, argument_list: None) -> None: ... def user_line(self, frame: FrameType) -> None: ... def user_return(self, frame: FrameType, return_value: Any) -> None: ... - def user_exception(self, frame: FrameType, exc_info: _ExcInfo) -> None: ... + def user_exception(self, frame: FrameType, exc_info: ExcInfo) -> None: ... def set_until(self, frame: FrameType, lineno: int | None = ...) -> None: ... def set_step(self) -> None: ... def set_next(self, frame: FrameType) -> None: ... @@ -56,17 +60,17 @@ class Bdb: def get_breaks(self, filename: str, lineno: int) -> list[Breakpoint]: ... def get_file_breaks(self, filename: str) -> list[Breakpoint]: ... def get_all_breaks(self) -> list[Breakpoint]: ... - def get_stack(self, f: FrameType | None, t: TracebackType | None) -> Tuple[list[Tuple[FrameType, int]], int]: ... + def get_stack(self, f: FrameType | None, t: TracebackType | None) -> tuple[list[tuple[FrameType, int]], int]: ... def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ... def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... def runeval(self, expr: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... def runctx(self, cmd: str | CodeType, globals: dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... + def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T | None: ... class Breakpoint: next: int - bplist: dict[Tuple[str, int], list[Breakpoint]] + bplist: dict[tuple[str, int], list[Breakpoint]] bpbynumber: list[Breakpoint | None] funcname: str | None @@ -82,13 +86,16 @@ class Breakpoint: def __init__( self, file: str, line: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ... ) -> None: ... + if sys.version_info >= (3, 11): + @staticmethod + def clearBreakpoints() -> None: ... + def deleteMe(self) -> None: ... def enable(self) -> None: ... def disable(self) -> None: ... def bpprint(self, out: IO[str] | None = ...) -> None: ... def bpformat(self) -> str: ... - def __str__(self) -> str: ... def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ... -def effective(file: str, line: int, frame: FrameType) -> Tuple[Breakpoint, bool] | Tuple[None, None]: ... +def effective(file: str, line: int, frame: FrameType) -> tuple[Breakpoint, bool] | tuple[None, None]: ... def set_trace() -> None: ... diff --git a/stdlib/binascii.pyi b/stdlib/binascii.pyi index 962f566..6f834f7 100644 --- a/stdlib/binascii.pyi +++ b/stdlib/binascii.pyi @@ -1,33 +1,44 @@ import sys +from _typeshed import ReadableBuffer +from typing_extensions import TypeAlias -def a2b_uu(__data: str | bytes) -> bytes: ... +# Many functions in binascii accept buffer objects +# or ASCII-only strings. +_AsciiBuffer: TypeAlias = str | ReadableBuffer -if sys.version_info >= (3, 7): - def b2a_uu(__data: bytes, *, backtick: bool = ...) -> bytes: ... +def a2b_uu(__data: _AsciiBuffer) -> bytes: ... +def b2a_uu(__data: ReadableBuffer, *, backtick: bool = ...) -> bytes: ... + +if sys.version_info >= (3, 11): + def a2b_base64(__data: _AsciiBuffer, *, strict_mode: bool = ...) -> bytes: ... else: - def b2a_uu(__data: bytes) -> bytes: ... - -def a2b_base64(__data: str | bytes) -> bytes: ... -def b2a_base64(__data: bytes, *, newline: bool = ...) -> bytes: ... -def a2b_qp(data: str | bytes, header: bool = ...) -> bytes: ... -def b2a_qp(data: bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ... -def a2b_hqx(__data: str | bytes) -> bytes: ... -def rledecode_hqx(__data: bytes) -> bytes: ... -def rlecode_hqx(__data: bytes) -> bytes: ... -def b2a_hqx(__data: bytes) -> bytes: ... -def crc_hqx(__data: bytes, __crc: int) -> int: ... -def crc32(__data: bytes, __crc: int = ...) -> int: ... -def b2a_hex(__data: bytes) -> bytes: ... + def a2b_base64(__data: _AsciiBuffer) -> bytes: ... + +def b2a_base64(__data: ReadableBuffer, *, newline: bool = ...) -> bytes: ... +def a2b_qp(data: _AsciiBuffer, header: bool = ...) -> bytes: ... +def b2a_qp(data: ReadableBuffer, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ... + +if sys.version_info < (3, 11): + def a2b_hqx(__data: _AsciiBuffer) -> bytes: ... + def rledecode_hqx(__data: ReadableBuffer) -> bytes: ... + def rlecode_hqx(__data: ReadableBuffer) -> bytes: ... + def b2a_hqx(__data: ReadableBuffer) -> bytes: ... + +def crc_hqx(__data: ReadableBuffer, __crc: int) -> int: ... +def crc32(__data: ReadableBuffer, __crc: int = ...) -> int: ... if sys.version_info >= (3, 8): - def hexlify(data: bytes, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ... + # sep must be str or bytes, not bytearray or any other buffer + def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ... + def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ... else: - def hexlify(__data: bytes) -> bytes: ... + def b2a_hex(__data: ReadableBuffer) -> bytes: ... + def hexlify(__data: ReadableBuffer) -> bytes: ... -def a2b_hex(__hexstr: str | bytes) -> bytes: ... -def unhexlify(__hexstr: str | bytes) -> bytes: ... +def a2b_hex(__hexstr: _AsciiBuffer) -> bytes: ... +def unhexlify(__hexstr: _AsciiBuffer) -> bytes: ... class Error(ValueError): ... class Incomplete(Exception): ... diff --git a/stdlib/binhex.pyi b/stdlib/binhex.pyi index 02d094f..e0993c8 100644 --- a/stdlib/binhex.pyi +++ b/stdlib/binhex.pyi @@ -1,19 +1,22 @@ -from typing import IO, Any, Tuple, Union +from _typeshed import _BufferWithLen +from typing import IO, Any +from typing_extensions import Literal, TypeAlias + +__all__ = ["binhex", "hexbin", "Error"] class Error(Exception): ... -REASONABLY_LARGE: int -LINELEN: int -RUNCHAR: bytes +REASONABLY_LARGE: Literal[32768] +LINELEN: Literal[64] +RUNCHAR: Literal[b"\x90"] class FInfo: - def __init__(self) -> None: ... Type: str Creator: str Flags: int -_FileInfoTuple = Tuple[str, FInfo, int, int] -_FileHandleUnion = Union[str, IO[bytes]] +_FileInfoTuple: TypeAlias = tuple[str, FInfo, int, int] +_FileHandleUnion: TypeAlias = str | IO[bytes] def getfileinfo(name: str) -> _FileInfoTuple: ... @@ -25,9 +28,9 @@ class openrsrc: class BinHex: def __init__(self, name_finfo_dlen_rlen: _FileInfoTuple, ofp: _FileHandleUnion) -> None: ... - def write(self, data: bytes) -> None: ... + def write(self, data: _BufferWithLen) -> None: ... def close_data(self) -> None: ... - def write_rsrc(self, data: bytes) -> None: ... + def write_rsrc(self, data: _BufferWithLen) -> None: ... def close(self) -> None: ... def binhex(inp: str, out: str) -> None: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 75da5c8..f943366 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1,6 +1,9 @@ import sys import types +from _ast import AST +from _collections_abc import dict_items, dict_keys, dict_values from _typeshed import ( + AnyStr_co, OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, @@ -9,355 +12,446 @@ from _typeshed import ( ReadableBuffer, Self, StrOrBytesPath, + SupportsAdd, + SupportsAiter, SupportsAnext, SupportsDivMod, + SupportsIter, SupportsKeysAndGetItem, SupportsLenAndGetItem, - SupportsLessThan, - SupportsLessThanT, SupportsNext, + SupportsRAdd, SupportsRDivMod, + SupportsRichComparison, + SupportsRichComparisonT, + SupportsTrunc, SupportsWrite, ) -from ast import AST, mod +from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper -from types import CodeType, MappingProxyType, TracebackType -from typing import ( +from types import CodeType, TracebackType, _Cell + +# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping} are imported from collections.abc in builtins.pyi +from typing import ( # noqa: Y027 IO, - AbstractSet, Any, - AsyncIterable, - AsyncIterator, BinaryIO, ByteString, - Callable, - FrozenSet, + ClassVar, Generic, - ItemsView, - Iterable, - Iterator, - KeysView, Mapping, MutableMapping, MutableSequence, - MutableSet, NoReturn, Protocol, - Reversible, Sequence, - Set, - Sized, SupportsAbs, SupportsBytes, SupportsComplex, SupportsFloat, SupportsInt, SupportsRound, - Tuple, - Type, TypeVar, - Union, - ValuesView, overload, + type_check_only, ) -from typing_extensions import Literal, SupportsIndex, final +from typing_extensions import Literal, LiteralString, SupportsIndex, TypeAlias, TypeGuard, final if sys.version_info >= (3, 9): from types import GenericAlias -class _SupportsTrunc(Protocol): - def __trunc__(self) -> int: ... - _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) _T_contra = TypeVar("_T_contra", contravariant=True) +_R_co = TypeVar("_R_co", covariant=True) _KT = TypeVar("_KT") _VT = TypeVar("_VT") -_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. -_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. _S = TypeVar("_S") _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") -_TT = TypeVar("_TT", bound="type") -_TBE = TypeVar("_TBE", bound="BaseException") +_SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True) +_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True) +_AwaitableT = TypeVar("_AwaitableT", bound=Awaitable[Any]) +_AwaitableT_co = TypeVar("_AwaitableT_co", bound=Awaitable[Any], covariant=True) class object: __doc__: str | None __dict__: dict[str, Any] - __slots__: str | Iterable[str] __module__: str __annotations__: dict[str, Any] @property - def __class__(self: _T) -> Type[_T]: ... + def __class__(self: Self) -> type[Self]: ... # Ignore errors about type mismatch between property getter and setter @__class__.setter - def __class__(self, __type: Type[object]) -> None: ... # type: ignore # noqa: F811 + def __class__(self, __type: type[object]) -> None: ... # noqa: F811 def __init__(self) -> None: ... - def __new__(cls: Type[_T]) -> _T: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __eq__(self, o: object) -> bool: ... - def __ne__(self, o: object) -> bool: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... + def __new__(cls: type[Self]) -> Self: ... + # N.B. `object.__setattr__` and `object.__delattr__` are heavily special-cased by type checkers. + # Overriding them in subclasses has different semantics, even if the override has an identical signature. + def __setattr__(self, __name: str, __value: Any) -> None: ... + def __delattr__(self, __name: str) -> None: ... + def __eq__(self, __o: object) -> bool: ... + def __ne__(self, __o: object) -> bool: ... + def __str__(self) -> str: ... # noqa: Y029 + def __repr__(self) -> str: ... # noqa: Y029 def __hash__(self) -> int: ... - def __format__(self, format_spec: str) -> str: ... - def __getattribute__(self, name: str) -> Any: ... - def __delattr__(self, name: str) -> None: ... + def __format__(self, __format_spec: str) -> str: ... + def __getattribute__(self, __name: str) -> Any: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> str | Tuple[Any, ...]: ... + # return type of pickle methods is rather hard to express in the current type system + # see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__ + def __reduce__(self) -> str | tuple[Any, ...]: ... if sys.version_info >= (3, 8): - def __reduce_ex__(self, protocol: SupportsIndex) -> str | Tuple[Any, ...]: ... + def __reduce_ex__(self, __protocol: SupportsIndex) -> str | tuple[Any, ...]: ... else: - def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ... + def __reduce_ex__(self, __protocol: int) -> str | tuple[Any, ...]: ... + def __dir__(self) -> Iterable[str]: ... def __init_subclass__(cls) -> None: ... -class staticmethod(object): # Special, only valid as a decorator. - __func__: Callable[..., Any] - __isabstractmethod__: bool - def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... +class staticmethod(Generic[_R_co]): + @property + def __func__(self) -> Callable[..., _R_co]: ... + @property + def __isabstractmethod__(self) -> bool: ... + def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... + def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + if sys.version_info >= (3, 10): + __name__: str + __qualname__: str + @property + def __wrapped__(self) -> Callable[..., _R_co]: ... + def __call__(self, *args: Any, **kwargs: Any) -> _R_co: ... -class classmethod(object): # Special, only valid as a decorator. - __func__: Callable[..., Any] - __isabstractmethod__: bool - def __init__(self, f: Callable[..., Any]) -> None: ... - def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... - def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ... - -class type(object): - __base__: type - __bases__: Tuple[type, ...] - __basicsize__: int - __dict__: dict[str, Any] - __dictoffset__: int - __flags__: int - __itemsize__: int +class classmethod(Generic[_R_co]): + @property + def __func__(self) -> Callable[..., _R_co]: ... + @property + def __isabstractmethod__(self) -> bool: ... + def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... + def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + if sys.version_info >= (3, 10): + __name__: str + __qualname__: str + @property + def __wrapped__(self) -> Callable[..., _R_co]: ... + +class type: + @property + def __base__(self) -> type: ... + __bases__: tuple[type, ...] + @property + def __basicsize__(self) -> int: ... + @property + def __dict__(self) -> types.MappingProxyType[str, Any]: ... # type: ignore[override] + @property + def __dictoffset__(self) -> int: ... + @property + def __flags__(self) -> int: ... + @property + def __itemsize__(self) -> int: ... __module__: str - __mro__: Tuple[type, ...] + @property + def __mro__(self) -> tuple[type, ...]: ... __name__: str __qualname__: str - __text_signature__: str | None - __weakrefoffset__: int + @property + def __text_signature__(self) -> str | None: ... + @property + def __weakrefoffset__(self) -> int: ... @overload - def __init__(self, o: object) -> None: ... + def __init__(self, __o: object) -> None: ... @overload - def __init__(self, name: str, bases: Tuple[type, ...], dict: dict[str, Any], **kwds: Any) -> None: ... + def __init__(self, __name: str, __bases: tuple[type, ...], __dict: dict[str, Any], **kwds: Any) -> None: ... @overload - def __new__(cls, o: object) -> type: ... + def __new__(cls, __o: object) -> type: ... @overload - def __new__(cls: Type[_TT], name: str, bases: Tuple[type, ...], namespace: dict[str, Any], **kwds: Any) -> _TT: ... + def __new__(cls: type[Self], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwds: Any) -> Self: ... def __call__(self, *args: Any, **kwds: Any) -> Any: ... - def __subclasses__(self: _TT) -> list[_TT]: ... - # Note: the documentation doesnt specify what the return type is, the standard + def __subclasses__(self: Self) -> list[Self]: ... + # Note: the documentation doesn't specify what the return type is, the standard # implementation seems to be returning a list. def mro(self) -> list[type]: ... - def __instancecheck__(self, instance: Any) -> bool: ... - def __subclasscheck__(self, subclass: type) -> bool: ... + def __instancecheck__(self, __instance: Any) -> bool: ... + def __subclasscheck__(self, __subclass: type) -> bool: ... @classmethod - def __prepare__(metacls, __name: str, __bases: Tuple[type, ...], **kwds: Any) -> Mapping[str, Any]: ... + def __prepare__(metacls, __name: str, __bases: tuple[type, ...], **kwds: Any) -> Mapping[str, object]: ... if sys.version_info >= (3, 10): - def __or__(self, t: Any) -> types.UnionType: ... - def __ror__(self, t: Any) -> types.UnionType: ... + def __or__(self, __t: Any) -> types.UnionType: ... + def __ror__(self, __t: Any) -> types.UnionType: ... -class super(object): +class super: @overload - def __init__(self, t: Any, obj: Any) -> None: ... + def __init__(self, __t: Any, __obj: Any) -> None: ... @overload - def __init__(self, t: Any) -> None: ... + def __init__(self, __t: Any) -> None: ... @overload def __init__(self) -> None: ... +_PositiveInteger: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25] +_NegativeInteger: TypeAlias = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20] +_LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed + class int: @overload - def __new__(cls: Type[_T], x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ... + def __new__(cls: type[Self], __x: str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc = ...) -> Self: ... @overload - def __new__(cls: Type[_T], x: str | bytes | bytearray, base: SupportsIndex) -> _T: ... + def __new__(cls: type[Self], __x: str | bytes | bytearray, base: SupportsIndex) -> Self: ... if sys.version_info >= (3, 8): - def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ... + def as_integer_ratio(self) -> tuple[int, Literal[1]]: ... + @property def real(self) -> int: ... @property - def imag(self) -> int: ... + def imag(self) -> Literal[0]: ... @property def numerator(self) -> int: ... @property - def denominator(self) -> int: ... + def denominator(self) -> Literal[1]: ... def conjugate(self) -> int: ... def bit_length(self) -> int: ... if sys.version_info >= (3, 10): def bit_count(self) -> int: ... - def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ... - @classmethod - def from_bytes( - cls, bytes: Iterable[SupportsIndex] | SupportsBytes, byteorder: Literal["little", "big"], *, signed: bool = ... - ) -> int: ... # TODO buffer object argument - def __add__(self, x: int) -> int: ... - def __sub__(self, x: int) -> int: ... - def __mul__(self, x: int) -> int: ... - def __floordiv__(self, x: int) -> int: ... - def __truediv__(self, x: int) -> float: ... - def __mod__(self, x: int) -> int: ... - def __divmod__(self, x: int) -> Tuple[int, int]: ... - def __radd__(self, x: int) -> int: ... - def __rsub__(self, x: int) -> int: ... - def __rmul__(self, x: int) -> int: ... - def __rfloordiv__(self, x: int) -> int: ... - def __rtruediv__(self, x: int) -> float: ... - def __rmod__(self, x: int) -> int: ... - def __rdivmod__(self, x: int) -> Tuple[int, int]: ... - @overload - def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ... - @overload - def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x. - def __rpow__(self, x: int, mod: int | None = ...) -> Any: ... - def __and__(self, n: int) -> int: ... - def __or__(self, n: int) -> int: ... - def __xor__(self, n: int) -> int: ... - def __lshift__(self, n: int) -> int: ... - def __rshift__(self, n: int) -> int: ... - def __rand__(self, n: int) -> int: ... - def __ror__(self, n: int) -> int: ... - def __rxor__(self, n: int) -> int: ... - def __rlshift__(self, n: int) -> int: ... - def __rrshift__(self, n: int) -> int: ... + + if sys.version_info >= (3, 11): + def to_bytes( + self, length: SupportsIndex = ..., byteorder: Literal["little", "big"] = ..., *, signed: bool = ... + ) -> bytes: ... + @classmethod + def from_bytes( + cls: type[Self], + bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer, + byteorder: Literal["little", "big"] = ..., + *, + signed: bool = ..., + ) -> Self: ... + else: + def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ... + @classmethod + def from_bytes( + cls: type[Self], + bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer, + byteorder: Literal["little", "big"], + *, + signed: bool = ..., + ) -> Self: ... + + def __add__(self, __x: int) -> int: ... + def __sub__(self, __x: int) -> int: ... + def __mul__(self, __x: int) -> int: ... + def __floordiv__(self, __x: int) -> int: ... + def __truediv__(self, __x: int) -> float: ... + def __mod__(self, __x: int) -> int: ... + def __divmod__(self, __x: int) -> tuple[int, int]: ... + def __radd__(self, __x: int) -> int: ... + def __rsub__(self, __x: int) -> int: ... + def __rmul__(self, __x: int) -> int: ... + def __rfloordiv__(self, __x: int) -> int: ... + def __rtruediv__(self, __x: int) -> float: ... + def __rmod__(self, __x: int) -> int: ... + def __rdivmod__(self, __x: int) -> tuple[int, int]: ... + @overload + def __pow__(self, __x: Literal[0]) -> Literal[1]: ... + @overload + def __pow__(self, __x: Literal[0], __modulo: None) -> Literal[1]: ... + @overload + def __pow__(self, __x: _PositiveInteger, __modulo: None = ...) -> int: ... + @overload + def __pow__(self, __x: _NegativeInteger, __modulo: None = ...) -> float: ... + # positive x -> int; negative x -> float + # return type must be Any as `int | float` causes too many false-positive errors + @overload + def __pow__(self, __x: int, __modulo: None = ...) -> Any: ... + @overload + def __pow__(self, __x: int, __modulo: int) -> int: ... + def __rpow__(self, __x: int, __mod: int | None = ...) -> Any: ... + def __and__(self, __n: int) -> int: ... + def __or__(self, __n: int) -> int: ... + def __xor__(self, __n: int) -> int: ... + def __lshift__(self, __n: int) -> int: ... + def __rshift__(self, __n: int) -> int: ... + def __rand__(self, __n: int) -> int: ... + def __ror__(self, __n: int) -> int: ... + def __rxor__(self, __n: int) -> int: ... + def __rlshift__(self, __n: int) -> int: ... + def __rrshift__(self, __n: int) -> int: ... def __neg__(self) -> int: ... def __pos__(self) -> int: ... def __invert__(self) -> int: ... def __trunc__(self) -> int: ... def __ceil__(self) -> int: ... def __floor__(self) -> int: ... - def __round__(self, ndigits: SupportsIndex = ...) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: int) -> bool: ... - def __le__(self, x: int) -> bool: ... - def __gt__(self, x: int) -> bool: ... - def __ge__(self, x: int) -> bool: ... - def __str__(self) -> str: ... + def __round__(self, __ndigits: SupportsIndex = ...) -> int: ... + def __getnewargs__(self) -> tuple[int]: ... + def __eq__(self, __x: object) -> bool: ... + def __ne__(self, __x: object) -> bool: ... + def __lt__(self, __x: int) -> bool: ... + def __le__(self, __x: int) -> bool: ... + def __gt__(self, __x: int) -> bool: ... + def __ge__(self, __x: int) -> bool: ... def __float__(self) -> float: ... def __int__(self) -> int: ... def __abs__(self) -> int: ... - def __hash__(self) -> int: ... def __bool__(self) -> bool: ... def __index__(self) -> int: ... class float: - def __new__(cls: Type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ... - def as_integer_ratio(self) -> Tuple[int, int]: ... + def __new__(cls: type[Self], __x: SupportsFloat | SupportsIndex | str | ReadableBuffer = ...) -> Self: ... + def as_integer_ratio(self) -> tuple[int, int]: ... def hex(self) -> str: ... def is_integer(self) -> bool: ... @classmethod - def fromhex(cls, __s: str) -> float: ... + def fromhex(cls: type[Self], __s: str) -> Self: ... @property def real(self) -> float: ... @property def imag(self) -> float: ... def conjugate(self) -> float: ... - def __add__(self, x: float) -> float: ... - def __sub__(self, x: float) -> float: ... - def __mul__(self, x: float) -> float: ... - def __floordiv__(self, x: float) -> float: ... - def __truediv__(self, x: float) -> float: ... - def __mod__(self, x: float) -> float: ... - def __divmod__(self, x: float) -> Tuple[float, float]: ... - def __pow__( - self, x: float, mod: None = ... - ) -> float: ... # In Python 3, returns complex if self is negative and x is not whole - def __radd__(self, x: float) -> float: ... - def __rsub__(self, x: float) -> float: ... - def __rmul__(self, x: float) -> float: ... - def __rfloordiv__(self, x: float) -> float: ... - def __rtruediv__(self, x: float) -> float: ... - def __rmod__(self, x: float) -> float: ... - def __rdivmod__(self, x: float) -> Tuple[float, float]: ... - def __rpow__(self, x: float, mod: None = ...) -> float: ... - def __getnewargs__(self) -> Tuple[float]: ... + def __add__(self, __x: float) -> float: ... + def __sub__(self, __x: float) -> float: ... + def __mul__(self, __x: float) -> float: ... + def __floordiv__(self, __x: float) -> float: ... + def __truediv__(self, __x: float) -> float: ... + def __mod__(self, __x: float) -> float: ... + def __divmod__(self, __x: float) -> tuple[float, float]: ... + @overload + def __pow__(self, __x: int, __mod: None = ...) -> float: ... + # positive x -> float; negative x -> complex + # return type must be Any as `float | complex` causes too many false-positive errors + @overload + def __pow__(self, __x: float, __mod: None = ...) -> Any: ... + def __radd__(self, __x: float) -> float: ... + def __rsub__(self, __x: float) -> float: ... + def __rmul__(self, __x: float) -> float: ... + def __rfloordiv__(self, __x: float) -> float: ... + def __rtruediv__(self, __x: float) -> float: ... + def __rmod__(self, __x: float) -> float: ... + def __rdivmod__(self, __x: float) -> tuple[float, float]: ... + @overload + def __rpow__(self, __x: _PositiveInteger, __modulo: None = ...) -> float: ... + @overload + def __rpow__(self, __x: _NegativeInteger, __mod: None = ...) -> complex: ... + # Returning `complex` for the general case gives too many false-positive errors. + @overload + def __rpow__(self, __x: float, __mod: None = ...) -> Any: ... + def __getnewargs__(self) -> tuple[float]: ... def __trunc__(self) -> int: ... if sys.version_info >= (3, 9): def __ceil__(self) -> int: ... def __floor__(self) -> int: ... + @overload - def __round__(self, ndigits: None = ...) -> int: ... + def __round__(self, __ndigits: None = ...) -> int: ... @overload - def __round__(self, ndigits: SupportsIndex) -> float: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: float) -> bool: ... - def __le__(self, x: float) -> bool: ... - def __gt__(self, x: float) -> bool: ... - def __ge__(self, x: float) -> bool: ... + def __round__(self, __ndigits: SupportsIndex) -> float: ... + def __eq__(self, __x: object) -> bool: ... + def __ne__(self, __x: object) -> bool: ... + def __lt__(self, __x: float) -> bool: ... + def __le__(self, __x: float) -> bool: ... + def __gt__(self, __x: float) -> bool: ... + def __ge__(self, __x: float) -> bool: ... def __neg__(self) -> float: ... def __pos__(self) -> float: ... - def __str__(self) -> str: ... def __int__(self) -> int: ... def __float__(self) -> float: ... def __abs__(self) -> float: ... - def __hash__(self) -> int: ... def __bool__(self) -> bool: ... class complex: - @overload - def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ... - @overload - def __new__(cls: Type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ... + if sys.version_info >= (3, 8): + # Python doesn't currently accept SupportsComplex for the second argument + @overload + def __new__( + cls: type[Self], + real: complex | SupportsComplex | SupportsFloat | SupportsIndex = ..., + imag: complex | SupportsFloat | SupportsIndex = ..., + ) -> Self: ... + @overload + def __new__(cls: type[Self], real: str | SupportsComplex | SupportsFloat | SupportsIndex | complex) -> Self: ... + else: + @overload + def __new__( + cls: type[Self], real: complex | SupportsComplex | SupportsFloat = ..., imag: complex | SupportsFloat = ... + ) -> Self: ... + @overload + def __new__(cls: type[Self], real: str | SupportsComplex | SupportsFloat | complex) -> Self: ... + @property def real(self) -> float: ... @property def imag(self) -> float: ... def conjugate(self) -> complex: ... - def __add__(self, x: complex) -> complex: ... - def __sub__(self, x: complex) -> complex: ... - def __mul__(self, x: complex) -> complex: ... - def __pow__(self, x: complex, mod: None = ...) -> complex: ... - def __truediv__(self, x: complex) -> complex: ... - def __radd__(self, x: complex) -> complex: ... - def __rsub__(self, x: complex) -> complex: ... - def __rmul__(self, x: complex) -> complex: ... - def __rpow__(self, x: complex, mod: None = ...) -> complex: ... - def __rtruediv__(self, x: complex) -> complex: ... - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... + def __add__(self, __x: complex) -> complex: ... + def __sub__(self, __x: complex) -> complex: ... + def __mul__(self, __x: complex) -> complex: ... + def __pow__(self, __x: complex, __mod: None = ...) -> complex: ... + def __truediv__(self, __x: complex) -> complex: ... + def __radd__(self, __x: complex) -> complex: ... + def __rsub__(self, __x: complex) -> complex: ... + def __rmul__(self, __x: complex) -> complex: ... + def __rpow__(self, __x: complex, __mod: None = ...) -> complex: ... + def __rtruediv__(self, __x: complex) -> complex: ... + def __eq__(self, __x: object) -> bool: ... + def __ne__(self, __x: object) -> bool: ... def __neg__(self) -> complex: ... def __pos__(self) -> complex: ... - def __str__(self) -> str: ... def __abs__(self) -> float: ... - def __hash__(self) -> int: ... def __bool__(self) -> bool: ... + if sys.version_info >= (3, 11): + def __complex__(self) -> complex: ... class _FormatMapMapping(Protocol): def __getitem__(self, __key: str) -> Any: ... +class _TranslateTable(Protocol): + def __getitem__(self, __key: int) -> str | int | None: ... + class str(Sequence[str]): @overload - def __new__(cls: Type[_T], o: object = ...) -> _T: ... + def __new__(cls: type[Self], object: object = ...) -> Self: ... + @overload + def __new__(cls: type[Self], object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ... + @overload + def capitalize(self: LiteralString) -> LiteralString: ... + @overload + def capitalize(self) -> str: ... # type: ignore[misc] + @overload + def casefold(self: LiteralString) -> LiteralString: ... + @overload + def casefold(self) -> str: ... # type: ignore[misc] @overload - def __new__(cls: Type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ... - def capitalize(self) -> str: ... - def casefold(self) -> str: ... - def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... + def center(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ... + @overload + def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc] def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ... def endswith( - self, __suffix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... if sys.version_info >= (3, 8): - def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ... + @overload + def expandtabs(self: LiteralString, tabsize: SupportsIndex = ...) -> LiteralString: ... + @overload + def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ... # type: ignore[misc] else: - def expandtabs(self, tabsize: int = ...) -> str: ... + @overload + def expandtabs(self: LiteralString, tabsize: int = ...) -> LiteralString: ... + @overload + def expandtabs(self, tabsize: int = ...) -> str: ... # type: ignore[misc] + def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... - def format(self, *args: object, **kwargs: object) -> str: ... + @overload + def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ... + @overload + def format(self, *args: object, **kwargs: object) -> str: ... # type: ignore[misc] def format_map(self, map: _FormatMapMapping) -> str: ... def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... def isalnum(self) -> bool: ... def isalpha(self) -> bool: ... - if sys.version_info >= (3, 7): - def isascii(self) -> bool: ... + def isascii(self) -> bool: ... def isdecimal(self) -> bool: ... def isdigit(self) -> bool: ... def isidentifier(self) -> bool: ... @@ -367,304 +461,401 @@ class str(Sequence[str]): def isspace(self) -> bool: ... def istitle(self) -> bool: ... def isupper(self) -> bool: ... - def join(self, __iterable: Iterable[str]) -> str: ... - def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... - def lower(self) -> str: ... - def lstrip(self, __chars: str | None = ...) -> str: ... - def partition(self, __sep: str) -> Tuple[str, str, str]: ... - def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ... + @overload + def join(self: LiteralString, __iterable: Iterable[LiteralString]) -> LiteralString: ... + @overload + def join(self, __iterable: Iterable[str]) -> str: ... # type: ignore[misc] + @overload + def ljust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ... + @overload + def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc] + @overload + def lower(self: LiteralString) -> LiteralString: ... + @overload + def lower(self) -> str: ... # type: ignore[misc] + @overload + def lstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ... + @overload + def lstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc] + @overload + def partition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ... + @overload + def partition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc] + @overload + def replace( + self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = ... + ) -> LiteralString: ... + @overload + def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ... # type: ignore[misc] if sys.version_info >= (3, 9): - def removeprefix(self, __prefix: str) -> str: ... - def removesuffix(self, __suffix: str) -> str: ... + @overload + def removeprefix(self: LiteralString, __prefix: LiteralString) -> LiteralString: ... + @overload + def removeprefix(self, __prefix: str) -> str: ... # type: ignore[misc] + @overload + def removesuffix(self: LiteralString, __suffix: LiteralString) -> LiteralString: ... + @overload + def removesuffix(self, __suffix: str) -> str: ... # type: ignore[misc] + def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... - def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... - def rpartition(self, __sep: str) -> Tuple[str, str, str]: ... - def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... - def rstrip(self, __chars: str | None = ...) -> str: ... - def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... - def splitlines(self, keepends: bool = ...) -> list[str]: ... + @overload + def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ... + @overload + def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc] + @overload + def rpartition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ... + @overload + def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc] + @overload + def rsplit(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ... + @overload + def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc] + @overload + def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ... + @overload + def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc] + @overload + def split(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ... + @overload + def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc] + @overload + def splitlines(self: LiteralString, keepends: bool = ...) -> list[LiteralString]: ... + @overload + def splitlines(self, keepends: bool = ...) -> list[str]: ... # type: ignore[misc] def startswith( - self, __prefix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... - def strip(self, __chars: str | None = ...) -> str: ... - def swapcase(self) -> str: ... - def title(self) -> str: ... - def translate(self, __table: Mapping[int, int | str | None] | Sequence[int | str | None]) -> str: ... - def upper(self) -> str: ... - def zfill(self, __width: SupportsIndex) -> str: ... + @overload + def strip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ... + @overload + def strip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc] + @overload + def swapcase(self: LiteralString) -> LiteralString: ... + @overload + def swapcase(self) -> str: ... # type: ignore[misc] + @overload + def title(self: LiteralString) -> LiteralString: ... + @overload + def title(self) -> str: ... # type: ignore[misc] + def translate(self, __table: _TranslateTable) -> str: ... + @overload + def upper(self: LiteralString) -> LiteralString: ... + @overload + def upper(self) -> str: ... # type: ignore[misc] + @overload + def zfill(self: LiteralString, __width: SupportsIndex) -> LiteralString: ... + @overload + def zfill(self, __width: SupportsIndex) -> str: ... # type: ignore[misc] @staticmethod @overload def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ... @staticmethod @overload def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ... - def __add__(self, s: str) -> str: ... + @overload + def __add__(self: LiteralString, __s: LiteralString) -> LiteralString: ... + @overload + def __add__(self, __s: str) -> str: ... # type: ignore[misc] # Incompatible with Sequence.__contains__ - def __contains__(self, o: str) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ge__(self, x: str) -> bool: ... - def __getitem__(self, i: int | slice) -> str: ... - def __gt__(self, x: str) -> bool: ... - def __hash__(self) -> int: ... - def __iter__(self) -> Iterator[str]: ... - def __le__(self, x: str) -> bool: ... + def __contains__(self, __o: str) -> bool: ... # type: ignore[override] + def __eq__(self, __x: object) -> bool: ... + def __ge__(self, __x: str) -> bool: ... + def __getitem__(self, __i: SupportsIndex | slice) -> str: ... + def __gt__(self, __x: str) -> bool: ... + @overload + def __iter__(self: LiteralString) -> Iterator[LiteralString]: ... + @overload + def __iter__(self) -> Iterator[str]: ... # type: ignore[misc] + def __le__(self, __x: str) -> bool: ... def __len__(self) -> int: ... - def __lt__(self, x: str) -> bool: ... - def __mod__(self, x: Any) -> str: ... - def __mul__(self, n: SupportsIndex) -> str: ... - def __ne__(self, x: object) -> bool: ... - def __repr__(self) -> str: ... - def __rmul__(self, n: SupportsIndex) -> str: ... - def __str__(self) -> str: ... - def __getnewargs__(self) -> Tuple[str]: ... - -class bytes(ByteString): + def __lt__(self, __x: str) -> bool: ... + @overload + def __mod__(self: LiteralString, __x: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ... + @overload + def __mod__(self, __x: Any) -> str: ... # type: ignore[misc] @overload - def __new__(cls: Type[_T], ints: Iterable[SupportsIndex]) -> _T: ... + def __mul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ... @overload - def __new__(cls: Type[_T], string: str, encoding: str, errors: str = ...) -> _T: ... + def __mul__(self, __n: SupportsIndex) -> str: ... # type: ignore[misc] + def __ne__(self, __x: object) -> bool: ... + @overload + def __rmul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ... + @overload + def __rmul__(self, __n: SupportsIndex) -> str: ... # type: ignore[misc] + def __getnewargs__(self) -> tuple[str]: ... + +class bytes(ByteString): @overload - def __new__(cls: Type[_T], length: SupportsIndex) -> _T: ... + def __new__(cls: type[Self], __o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer) -> Self: ... @overload - def __new__(cls: Type[_T]) -> _T: ... + def __new__(cls: type[Self], __string: str, encoding: str, errors: str = ...) -> Self: ... @overload - def __new__(cls: Type[_T], o: SupportsBytes) -> _T: ... + def __new__(cls: type[Self]) -> Self: ... def capitalize(self) -> bytes: ... def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ... def count( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def decode(self, encoding: str = ..., errors: str = ...) -> str: ... def endswith( - self, __suffix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, + __suffix: ReadableBuffer | tuple[ReadableBuffer, ...], + __start: SupportsIndex | None = ..., + __end: SupportsIndex | None = ..., ) -> bool: ... if sys.version_info >= (3, 8): def expandtabs(self, tabsize: SupportsIndex = ...) -> bytes: ... else: def expandtabs(self, tabsize: int = ...) -> bytes: ... + def find( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... if sys.version_info >= (3, 8): def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ... else: def hex(self) -> str: ... + def index( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def isalnum(self) -> bool: ... def isalpha(self) -> bool: ... - if sys.version_info >= (3, 7): - def isascii(self) -> bool: ... + def isascii(self) -> bool: ... def isdigit(self) -> bool: ... def islower(self) -> bool: ... def isspace(self) -> bool: ... def istitle(self) -> bool: ... def isupper(self) -> bool: ... - def join(self, __iterable_of_bytes: Iterable[ByteString | memoryview]) -> bytes: ... - def ljust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ... + def join(self, __iterable_of_bytes: Iterable[ReadableBuffer]) -> bytes: ... + def ljust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytes: ... def lower(self) -> bytes: ... - def lstrip(self, __bytes: bytes | None = ...) -> bytes: ... - def partition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ... - def replace(self, __old: bytes, __new: bytes, __count: SupportsIndex = ...) -> bytes: ... + def lstrip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ... + def partition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ... + def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = ...) -> bytes: ... if sys.version_info >= (3, 9): - def removeprefix(self, __prefix: bytes) -> bytes: ... - def removesuffix(self, __suffix: bytes) -> bytes: ... + def removeprefix(self, __prefix: ReadableBuffer) -> bytes: ... + def removesuffix(self, __suffix: ReadableBuffer) -> bytes: ... + def rfind( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def rindex( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... - def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ... - def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... - def rstrip(self, __bytes: bytes | None = ...) -> bytes: ... - def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... + def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytes: ... + def rpartition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ... + def rsplit(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... + def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ... + def split(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... def splitlines(self, keepends: bool = ...) -> list[bytes]: ... def startswith( - self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, + __prefix: ReadableBuffer | tuple[ReadableBuffer, ...], + __start: SupportsIndex | None = ..., + __end: SupportsIndex | None = ..., ) -> bool: ... - def strip(self, __bytes: bytes | None = ...) -> bytes: ... + def strip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ... def swapcase(self) -> bytes: ... def title(self) -> bytes: ... - def translate(self, __table: bytes | None, delete: bytes = ...) -> bytes: ... + def translate(self, __table: ReadableBuffer | None, delete: bytes = ...) -> bytes: ... def upper(self) -> bytes: ... def zfill(self, __width: SupportsIndex) -> bytes: ... @classmethod - def fromhex(cls, __s: str) -> bytes: ... + def fromhex(cls: type[Self], __s: str) -> Self: ... @staticmethod - def maketrans(__frm: bytes, __to: bytes) -> bytes: ... + def maketrans(__frm: ReadableBuffer, __to: ReadableBuffer) -> bytes: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... @overload - def __getitem__(self, i: SupportsIndex) -> int: ... + def __getitem__(self, __i: SupportsIndex) -> int: ... @overload - def __getitem__(self, s: slice) -> bytes: ... - def __add__(self, s: bytes) -> bytes: ... - def __mul__(self, n: SupportsIndex) -> bytes: ... - def __rmul__(self, n: SupportsIndex) -> bytes: ... - def __mod__(self, value: Any) -> bytes: ... + def __getitem__(self, __s: slice) -> bytes: ... + def __add__(self, __s: ReadableBuffer) -> bytes: ... + def __mul__(self, __n: SupportsIndex) -> bytes: ... + def __rmul__(self, __n: SupportsIndex) -> bytes: ... + def __mod__(self, __value: Any) -> bytes: ... # Incompatible with Sequence.__contains__ - def __contains__(self, o: SupportsIndex | bytes) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: bytes) -> bool: ... - def __le__(self, x: bytes) -> bool: ... - def __gt__(self, x: bytes) -> bool: ... - def __ge__(self, x: bytes) -> bool: ... - def __getnewargs__(self) -> Tuple[bytes]: ... + def __contains__(self, __o: SupportsIndex | ReadableBuffer) -> bool: ... # type: ignore[override] + def __eq__(self, __x: object) -> bool: ... + def __ne__(self, __x: object) -> bool: ... + def __lt__(self, __x: bytes) -> bool: ... + def __le__(self, __x: bytes) -> bool: ... + def __gt__(self, __x: bytes) -> bool: ... + def __ge__(self, __x: bytes) -> bool: ... + def __getnewargs__(self) -> tuple[bytes]: ... + if sys.version_info >= (3, 11): + def __bytes__(self) -> bytes: ... class bytearray(MutableSequence[int], ByteString): @overload def __init__(self) -> None: ... @overload - def __init__(self, ints: Iterable[SupportsIndex]) -> None: ... + def __init__(self, __ints: Iterable[SupportsIndex] | SupportsIndex | ReadableBuffer) -> None: ... @overload - def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ... - @overload - def __init__(self, length: SupportsIndex) -> None: ... + def __init__(self, __string: str, encoding: str, errors: str = ...) -> None: ... def append(self, __item: SupportsIndex) -> None: ... def capitalize(self) -> bytearray: ... def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ... def count( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def copy(self) -> bytearray: ... def decode(self, encoding: str = ..., errors: str = ...) -> str: ... def endswith( - self, __suffix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, + __suffix: ReadableBuffer | tuple[ReadableBuffer, ...], + __start: SupportsIndex | None = ..., + __end: SupportsIndex | None = ..., ) -> bool: ... if sys.version_info >= (3, 8): def expandtabs(self, tabsize: SupportsIndex = ...) -> bytearray: ... else: def expandtabs(self, tabsize: int = ...) -> bytearray: ... + def extend(self, __iterable_of_ints: Iterable[SupportsIndex]) -> None: ... def find( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... if sys.version_info >= (3, 8): def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ... else: def hex(self) -> str: ... + def index( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def insert(self, __index: SupportsIndex, __item: SupportsIndex) -> None: ... def isalnum(self) -> bool: ... def isalpha(self) -> bool: ... - if sys.version_info >= (3, 7): - def isascii(self) -> bool: ... + def isascii(self) -> bool: ... def isdigit(self) -> bool: ... def islower(self) -> bool: ... def isspace(self) -> bool: ... def istitle(self) -> bool: ... def isupper(self) -> bool: ... - def join(self, __iterable_of_bytes: Iterable[ByteString | memoryview]) -> bytearray: ... - def ljust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ... + def join(self, __iterable_of_bytes: Iterable[ReadableBuffer]) -> bytearray: ... + def ljust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytearray: ... def lower(self) -> bytearray: ... - def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... + def lstrip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ... + def partition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ... + def pop(self, __index: int = ...) -> int: ... + def remove(self, __value: int) -> None: ... if sys.version_info >= (3, 9): - def removeprefix(self, __prefix: bytes) -> bytearray: ... - def removesuffix(self, __suffix: bytes) -> bytearray: ... - def replace(self, __old: bytes, __new: bytes, __count: SupportsIndex = ...) -> bytearray: ... + def removeprefix(self, __prefix: ReadableBuffer) -> bytearray: ... + def removesuffix(self, __suffix: ReadableBuffer) -> bytearray: ... + + def replace(self, __old: ReadableBuffer, __new: ReadableBuffer, __count: SupportsIndex = ...) -> bytearray: ... def rfind( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def rindex( - self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... - def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ... - def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... - def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... + def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytearray: ... + def rpartition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ... + def rsplit(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... + def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ... + def split(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... def splitlines(self, keepends: bool = ...) -> list[bytearray]: ... def startswith( - self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... + self, + __prefix: ReadableBuffer | tuple[ReadableBuffer, ...], + __start: SupportsIndex | None = ..., + __end: SupportsIndex | None = ..., ) -> bool: ... - def strip(self, __bytes: bytes | None = ...) -> bytearray: ... + def strip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ... def swapcase(self) -> bytearray: ... def title(self) -> bytearray: ... - def translate(self, __table: bytes | None, delete: bytes = ...) -> bytearray: ... + def translate(self, __table: ReadableBuffer | None, delete: bytes = ...) -> bytearray: ... def upper(self) -> bytearray: ... def zfill(self, __width: SupportsIndex) -> bytearray: ... @classmethod - def fromhex(cls, __string: str) -> bytearray: ... + def fromhex(cls: type[Self], __string: str) -> Self: ... @staticmethod - def maketrans(__frm: bytes, __to: bytes) -> bytes: ... + def maketrans(__frm: ReadableBuffer, __to: ReadableBuffer) -> bytes: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - __hash__: None # type: ignore + __hash__: ClassVar[None] # type: ignore[assignment] @overload - def __getitem__(self, i: SupportsIndex) -> int: ... + def __getitem__(self, __i: SupportsIndex) -> int: ... @overload - def __getitem__(self, s: slice) -> bytearray: ... + def __getitem__(self, __s: slice) -> bytearray: ... @overload - def __setitem__(self, i: SupportsIndex, x: SupportsIndex) -> None: ... + def __setitem__(self, __i: SupportsIndex, __x: SupportsIndex) -> None: ... @overload - def __setitem__(self, s: slice, x: Iterable[SupportsIndex] | bytes) -> None: ... - def __delitem__(self, i: SupportsIndex | slice) -> None: ... - def __add__(self, s: bytes) -> bytearray: ... - def __iadd__(self, s: Iterable[int]) -> bytearray: ... - def __mul__(self, n: SupportsIndex) -> bytearray: ... - def __rmul__(self, n: SupportsIndex) -> bytearray: ... - def __imul__(self, n: SupportsIndex) -> bytearray: ... - def __mod__(self, value: Any) -> bytes: ... + def __setitem__(self, __s: slice, __x: Iterable[SupportsIndex] | bytes) -> None: ... + def __delitem__(self, __i: SupportsIndex | slice) -> None: ... + def __add__(self, __s: ReadableBuffer) -> bytearray: ... + # The superclass wants us to accept Iterable[int], but that fails at runtime. + def __iadd__(self: Self, __s: ReadableBuffer) -> Self: ... # type: ignore[override] + def __mul__(self, __n: SupportsIndex) -> bytearray: ... + def __rmul__(self, __n: SupportsIndex) -> bytearray: ... + def __imul__(self: Self, __n: SupportsIndex) -> Self: ... + def __mod__(self, __value: Any) -> bytes: ... # Incompatible with Sequence.__contains__ - def __contains__(self, o: SupportsIndex | bytes) -> bool: ... # type: ignore - def __eq__(self, x: object) -> bool: ... - def __ne__(self, x: object) -> bool: ... - def __lt__(self, x: bytes) -> bool: ... - def __le__(self, x: bytes) -> bool: ... - def __gt__(self, x: bytes) -> bool: ... - def __ge__(self, x: bytes) -> bool: ... - -class memoryview(Sized, Sequence[int]): - format: str - itemsize: int - shape: Tuple[int, ...] | None - strides: Tuple[int, ...] | None - suboffsets: Tuple[int, ...] | None - readonly: bool - ndim: int - - obj: bytes | bytearray - c_contiguous: bool - f_contiguous: bool - contiguous: bool - nbytes: int + def __contains__(self, __o: SupportsIndex | ReadableBuffer) -> bool: ... # type: ignore[override] + def __eq__(self, __x: object) -> bool: ... + def __ne__(self, __x: object) -> bool: ... + def __lt__(self, __x: ReadableBuffer) -> bool: ... + def __le__(self, __x: ReadableBuffer) -> bool: ... + def __gt__(self, __x: ReadableBuffer) -> bool: ... + def __ge__(self, __x: ReadableBuffer) -> bool: ... + def __alloc__(self) -> int: ... + +@final +class memoryview(Sequence[int]): + @property + def format(self) -> str: ... + @property + def itemsize(self) -> int: ... + @property + def shape(self) -> tuple[int, ...] | None: ... + @property + def strides(self) -> tuple[int, ...] | None: ... + @property + def suboffsets(self) -> tuple[int, ...] | None: ... + @property + def readonly(self) -> bool: ... + @property + def ndim(self) -> int: ... + @property + def obj(self) -> ReadableBuffer: ... + @property + def c_contiguous(self) -> bool: ... + @property + def f_contiguous(self) -> bool: ... + @property + def contiguous(self) -> bool: ... + @property + def nbytes(self) -> int: ... def __init__(self, obj: ReadableBuffer) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None ) -> None: ... - def cast(self, format: str, shape: list[int] | Tuple[int, ...] = ...) -> memoryview: ... + def cast(self, format: str, shape: list[int] | tuple[int, ...] = ...) -> memoryview: ... @overload - def __getitem__(self, i: SupportsIndex) -> int: ... + def __getitem__(self, __i: SupportsIndex) -> int: ... @overload - def __getitem__(self, s: slice) -> memoryview: ... - def __contains__(self, x: object) -> bool: ... + def __getitem__(self, __s: slice) -> memoryview: ... + def __contains__(self, __x: object) -> bool: ... def __iter__(self) -> Iterator[int]: ... def __len__(self) -> int: ... @overload - def __setitem__(self, s: slice, o: bytes) -> None: ... + def __setitem__(self, __s: slice, __o: ReadableBuffer) -> None: ... @overload - def __setitem__(self, i: SupportsIndex, o: SupportsIndex) -> None: ... + def __setitem__(self, __i: SupportsIndex, __o: SupportsIndex) -> None: ... if sys.version_info >= (3, 8): def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ... else: def tobytes(self) -> bytes: ... + def tolist(self) -> list[int]: ... if sys.version_info >= (3, 8): def toreadonly(self) -> memoryview: ... + def release(self) -> None: ... if sys.version_info >= (3, 8): def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ... @@ -673,279 +864,313 @@ class memoryview(Sized, Sequence[int]): @final class bool(int): - def __new__(cls: Type[_T], __o: object = ...) -> _T: ... + def __new__(cls: type[Self], __o: object = ...) -> Self: ... + # The following overloads could be represented more elegantly with a TypeVar("_B", bool, int), + # however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880). @overload - def __and__(self, x: bool) -> bool: ... + def __and__(self, __x: bool) -> bool: ... @overload - def __and__(self, x: int) -> int: ... + def __and__(self, __x: int) -> int: ... @overload - def __or__(self, x: bool) -> bool: ... + def __or__(self, __x: bool) -> bool: ... @overload - def __or__(self, x: int) -> int: ... + def __or__(self, __x: int) -> int: ... @overload - def __xor__(self, x: bool) -> bool: ... + def __xor__(self, __x: bool) -> bool: ... @overload - def __xor__(self, x: int) -> int: ... + def __xor__(self, __x: int) -> int: ... @overload - def __rand__(self, x: bool) -> bool: ... + def __rand__(self, __x: bool) -> bool: ... @overload - def __rand__(self, x: int) -> int: ... + def __rand__(self, __x: int) -> int: ... @overload - def __ror__(self, x: bool) -> bool: ... + def __ror__(self, __x: bool) -> bool: ... @overload - def __ror__(self, x: int) -> int: ... + def __ror__(self, __x: int) -> int: ... @overload - def __rxor__(self, x: bool) -> bool: ... + def __rxor__(self, __x: bool) -> bool: ... @overload - def __rxor__(self, x: int) -> int: ... - def __getnewargs__(self) -> Tuple[int]: ... + def __rxor__(self, __x: int) -> int: ... + def __getnewargs__(self) -> tuple[int]: ... -class slice(object): - start: Any - step: Any - stop: Any +@final +class slice: + @property + def start(self) -> Any: ... + @property + def step(self) -> Any: ... + @property + def stop(self) -> Any: ... @overload - def __init__(self, stop: Any) -> None: ... + def __init__(self, __stop: Any) -> None: ... @overload - def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ... - __hash__: None # type: ignore - def indices(self, len: SupportsIndex) -> Tuple[int, int, int]: ... + def __init__(self, __start: Any, __stop: Any, __step: Any = ...) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] + def indices(self, __len: SupportsIndex) -> tuple[int, int, int]: ... class tuple(Sequence[_T_co], Generic[_T_co]): - def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ... + def __new__(cls: type[Self], __iterable: Iterable[_T_co] = ...) -> Self: ... def __len__(self) -> int: ... - def __contains__(self, x: object) -> bool: ... + def __contains__(self, __x: object) -> bool: ... @overload - def __getitem__(self, x: int) -> _T_co: ... + def __getitem__(self, __x: SupportsIndex) -> _T_co: ... @overload - def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ... + def __getitem__(self, __x: slice) -> tuple[_T_co, ...]: ... def __iter__(self) -> Iterator[_T_co]: ... - def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __le__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ... - def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ... + def __lt__(self, __x: tuple[_T_co, ...]) -> bool: ... + def __le__(self, __x: tuple[_T_co, ...]) -> bool: ... + def __gt__(self, __x: tuple[_T_co, ...]) -> bool: ... + def __ge__(self, __x: tuple[_T_co, ...]) -> bool: ... @overload - def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ... + def __add__(self, __x: tuple[_T_co, ...]) -> tuple[_T_co, ...]: ... @overload - def __add__(self, x: Tuple[_T, ...]) -> Tuple[_T_co | _T, ...]: ... - def __mul__(self, n: SupportsIndex) -> Tuple[_T_co, ...]: ... - def __rmul__(self, n: SupportsIndex) -> Tuple[_T_co, ...]: ... + def __add__(self, __x: tuple[_T, ...]) -> tuple[_T_co | _T, ...]: ... + def __mul__(self, __n: SupportsIndex) -> tuple[_T_co, ...]: ... + def __rmul__(self, __n: SupportsIndex) -> tuple[_T_co, ...]: ... def count(self, __value: Any) -> int: ... def index(self, __value: Any, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ... if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... +# Doesn't exist at runtime, but deleting this breaks mypy. See #2999 +@final +@type_check_only class function: - # TODO not defined in builtins! - __name__: str - __module__: str + # Make sure this class definition stays roughly in line with `types.FunctionType` + @property + def __closure__(self) -> tuple[_Cell, ...] | None: ... __code__: CodeType + __defaults__: tuple[Any, ...] | None + __dict__: dict[str, Any] + @property + def __globals__(self) -> dict[str, Any]: ... + __name__: str __qualname__: str __annotations__: dict[str, Any] + __kwdefaults__: dict[str, Any] + if sys.version_info >= (3, 10): + @property + def __builtins__(self) -> dict[str, Any]: ... + + __module__: str + # mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any. + def __get__(self, obj: object | None, type: type | None = ...) -> Any: ... class list(MutableSequence[_T], Generic[_T]): @overload def __init__(self) -> None: ... @overload - def __init__(self, iterable: Iterable[_T]) -> None: ... - def clear(self) -> None: ... + def __init__(self, __iterable: Iterable[_T]) -> None: ... def copy(self) -> list[_T]: ... def append(self, __object: _T) -> None: ... def extend(self, __iterable: Iterable[_T]) -> None: ... def pop(self, __index: SupportsIndex = ...) -> _T: ... + # Signature of `list.index` should be kept in line with `collections.UserList.index()` + # and multiprocessing.managers.ListProxy.index() def index(self, __value: _T, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ... def count(self, __value: _T) -> int: ... def insert(self, __index: SupportsIndex, __object: _T) -> None: ... def remove(self, __value: _T) -> None: ... - def reverse(self) -> None: ... + # Signature of `list.sort` should be kept inline with `collections.UserList.sort()` + # and multiprocessing.managers.ListProxy.sort() + # + # Use list[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison] + # to work around invariance @overload - def sort(self: list[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ... + def sort(self: list[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...) -> None: ... @overload - def sort(self, *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> None: ... + def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - __hash__: None # type: ignore + __hash__: ClassVar[None] # type: ignore[assignment] + @overload + def __getitem__(self, __i: SupportsIndex) -> _T: ... + @overload + def __getitem__(self, __s: slice) -> list[_T]: ... @overload - def __getitem__(self, i: SupportsIndex) -> _T: ... + def __setitem__(self, __i: SupportsIndex, __o: _T) -> None: ... @overload - def __getitem__(self, s: slice) -> list[_T]: ... + def __setitem__(self, __s: slice, __o: Iterable[_T]) -> None: ... + def __delitem__(self, __i: SupportsIndex | slice) -> None: ... + # Overloading looks unnecessary, but is needed to work around complex mypy problems @overload - def __setitem__(self, i: SupportsIndex, o: _T) -> None: ... + def __add__(self, __x: list[_T]) -> list[_T]: ... @overload - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... - def __delitem__(self, i: SupportsIndex | slice) -> None: ... - def __add__(self, x: list[_T]) -> list[_T]: ... - def __iadd__(self: _S, x: Iterable[_T]) -> _S: ... - def __mul__(self, n: SupportsIndex) -> list[_T]: ... - def __rmul__(self, n: SupportsIndex) -> list[_T]: ... - def __imul__(self: _S, n: SupportsIndex) -> _S: ... - def __contains__(self, o: object) -> bool: ... + def __add__(self, __x: list[_S]) -> list[_S | _T]: ... + def __iadd__(self: Self, __x: Iterable[_T]) -> Self: ... # type: ignore[misc] + def __mul__(self, __n: SupportsIndex) -> list[_T]: ... + def __rmul__(self, __n: SupportsIndex) -> list[_T]: ... + def __imul__(self: Self, __n: SupportsIndex) -> Self: ... + def __contains__(self, __o: object) -> bool: ... def __reversed__(self) -> Iterator[_T]: ... - def __gt__(self, x: list[_T]) -> bool: ... - def __ge__(self, x: list[_T]) -> bool: ... - def __lt__(self, x: list[_T]) -> bool: ... - def __le__(self, x: list[_T]) -> bool: ... + def __gt__(self, __x: list[_T]) -> bool: ... + def __ge__(self, __x: list[_T]) -> bool: ... + def __lt__(self, __x: list[_T]) -> bool: ... + def __le__(self, __x: list[_T]) -> bool: ... if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... - -class _dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): - if sys.version_info >= (3, 10): - mapping: MappingProxyType[_KT_co, _VT_co] - -# The generics are the wrong way around because of a mypy limitation -# https://github.com/python/mypy/issues/11138 -class _dict_values(ValuesView[_VT_co], Generic[_VT_co, _KT_co]): - if sys.version_info >= (3, 10): - mapping: MappingProxyType[_KT_co, _VT_co] - -class _dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]): - if sys.version_info >= (3, 10): - mapping: MappingProxyType[_KT_co, _VT_co] + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): + # __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics + # Also multiprocessing.managers.SyncManager.dict() @overload - def __init__(self: dict[_KT, _VT]) -> None: ... + def __init__(self) -> None: ... @overload def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... + def __init__(self, __map: SupportsKeysAndGetItem[_KT, _VT]) -> None: ... + @overload + def __init__(self: dict[str, _VT], __map: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __init__(self, __iterable: Iterable[tuple[_KT, _VT]]) -> None: ... + @overload + def __init__(self: dict[str, _VT], __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> None: ... # Next overload is for dict(string.split(sep) for string in iterable) # Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error @overload - def __init__(self: dict[str, str], iterable: Iterable[list[str]]) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... - def clear(self) -> None: ... + def __init__(self: dict[str, str], __iterable: Iterable[list[str]]) -> None: ... + def __new__(cls: type[Self], *args: Any, **kwargs: Any) -> Self: ... def copy(self) -> dict[_KT, _VT]: ... - def popitem(self) -> Tuple[_KT, _VT]: ... - def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ... - @overload - def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... - @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - @overload - def update(self, **kwargs: _VT) -> None: ... - def keys(self) -> _dict_keys[_KT, _VT]: ... - def values(self) -> _dict_values[_VT, _KT]: ... - def items(self) -> _dict_items[_KT, _VT]: ... + def keys(self) -> dict_keys[_KT, _VT]: ... + def values(self) -> dict_values[_KT, _VT]: ... + def items(self) -> dict_items[_KT, _VT]: ... + # Signature of `dict.fromkeys` should be kept identical to `fromkeys` methods of `OrderedDict`/`ChainMap`/`UserDict` in `collections` + # TODO: the true signature of `dict.fromkeys` is not expressible in the current type system. + # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @classmethod @overload def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Any | None]: ... @classmethod @overload def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ... + # Positional-only in dict, but not in MutableMapping + @overload + def get(self, __key: _KT) -> _VT | None: ... + @overload + def get(self, __key: _KT, __default: _VT | _T) -> _VT | _T: ... + @overload + def pop(self, __key: _KT) -> _VT: ... + @overload + def pop(self, __key: _KT, __default: _VT | _T) -> _VT | _T: ... def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... + def __getitem__(self, __key: _KT) -> _VT: ... + def __setitem__(self, __key: _KT, __value: _VT) -> None: ... + def __delitem__(self, __key: _KT) -> None: ... def __iter__(self) -> Iterator[_KT]: ... if sys.version_info >= (3, 8): def __reversed__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... - __hash__: None # type: ignore + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... def __or__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ... def __ror__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ... - def __ior__(self, __value: Mapping[_KT, _VT]) -> dict[_KT, _VT]: ... # type: ignore + # dict.__ior__ should be kept roughly in line with MutableMapping.update() + @overload # type: ignore[misc] + def __ior__(self: Self, __value: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... + @overload + def __ior__(self: Self, __value: Iterable[tuple[_KT, _VT]]) -> Self: ... class set(MutableSet[_T], Generic[_T]): - def __init__(self, iterable: Iterable[_T] = ...) -> None: ... - def add(self, element: _T) -> None: ... - def clear(self) -> None: ... - def copy(self) -> Set[_T]: ... - def difference(self, *s: Iterable[Any]) -> Set[_T]: ... + @overload + def __init__(self) -> None: ... + @overload + def __init__(self, __iterable: Iterable[_T]) -> None: ... + def add(self, __element: _T) -> None: ... + def copy(self) -> set[_T]: ... + def difference(self, *s: Iterable[Any]) -> set[_T]: ... def difference_update(self, *s: Iterable[Any]) -> None: ... - def discard(self, element: _T) -> None: ... - def intersection(self, *s: Iterable[Any]) -> Set[_T]: ... + def discard(self, __element: _T) -> None: ... + def intersection(self, *s: Iterable[Any]) -> set[_T]: ... def intersection_update(self, *s: Iterable[Any]) -> None: ... - def isdisjoint(self, s: Iterable[Any]) -> bool: ... - def issubset(self, s: Iterable[Any]) -> bool: ... - def issuperset(self, s: Iterable[Any]) -> bool: ... - def pop(self) -> _T: ... - def remove(self, element: _T) -> None: ... - def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ... - def symmetric_difference_update(self, s: Iterable[_T]) -> None: ... - def union(self, *s: Iterable[_T]) -> Set[_T]: ... + def isdisjoint(self, __s: Iterable[Any]) -> bool: ... + def issubset(self, __s: Iterable[Any]) -> bool: ... + def issuperset(self, __s: Iterable[Any]) -> bool: ... + def remove(self, __element: _T) -> None: ... + def symmetric_difference(self, __s: Iterable[_T]) -> set[_T]: ... + def symmetric_difference_update(self, __s: Iterable[_T]) -> None: ... + def union(self, *s: Iterable[_S]) -> set[_T | _S]: ... def update(self, *s: Iterable[_T]) -> None: ... def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... + def __contains__(self, __o: object) -> bool: ... def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ... - def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ... - def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ... - def __le__(self, s: AbstractSet[object]) -> bool: ... - def __lt__(self, s: AbstractSet[object]) -> bool: ... - def __ge__(self, s: AbstractSet[object]) -> bool: ... - def __gt__(self, s: AbstractSet[object]) -> bool: ... - __hash__: None # type: ignore + def __and__(self, __s: AbstractSet[object]) -> set[_T]: ... + def __iand__(self: Self, __s: AbstractSet[object]) -> Self: ... + def __or__(self, __s: AbstractSet[_S]) -> set[_T | _S]: ... + def __ior__(self: Self, __s: AbstractSet[_T]) -> Self: ... # type: ignore[override,misc] + def __sub__(self, __s: AbstractSet[_T | None]) -> set[_T]: ... + def __isub__(self: Self, __s: AbstractSet[object]) -> Self: ... + def __xor__(self, __s: AbstractSet[_S]) -> set[_T | _S]: ... + def __ixor__(self: Self, __s: AbstractSet[_T]) -> Self: ... # type: ignore[override,misc] + def __le__(self, __s: AbstractSet[object]) -> bool: ... + def __lt__(self, __s: AbstractSet[object]) -> bool: ... + def __ge__(self, __s: AbstractSet[object]) -> bool: ... + def __gt__(self, __s: AbstractSet[object]) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... class frozenset(AbstractSet[_T_co], Generic[_T_co]): - def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ... - def copy(self) -> FrozenSet[_T_co]: ... - def difference(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def intersection(self, *s: Iterable[object]) -> FrozenSet[_T_co]: ... - def isdisjoint(self, s: Iterable[_T_co]) -> bool: ... - def issubset(self, s: Iterable[object]) -> bool: ... - def issuperset(self, s: Iterable[object]) -> bool: ... - def symmetric_difference(self, s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... - def union(self, *s: Iterable[_T_co]) -> FrozenSet[_T_co]: ... + @overload + def __new__(cls: type[Self]) -> Self: ... + @overload + def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ... + def copy(self) -> frozenset[_T_co]: ... + def difference(self, *s: Iterable[object]) -> frozenset[_T_co]: ... + def intersection(self, *s: Iterable[object]) -> frozenset[_T_co]: ... + def isdisjoint(self, __s: Iterable[_T_co]) -> bool: ... + def issubset(self, __s: Iterable[object]) -> bool: ... + def issuperset(self, __s: Iterable[object]) -> bool: ... + def symmetric_difference(self, __s: Iterable[_T_co]) -> frozenset[_T_co]: ... + def union(self, *s: Iterable[_S]) -> frozenset[_T_co | _S]: ... def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... + def __contains__(self, __o: object) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... - def __str__(self) -> str: ... - def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ... - def __le__(self, s: AbstractSet[object]) -> bool: ... - def __lt__(self, s: AbstractSet[object]) -> bool: ... - def __ge__(self, s: AbstractSet[object]) -> bool: ... - def __gt__(self, s: AbstractSet[object]) -> bool: ... + def __and__(self, __s: AbstractSet[_T_co]) -> frozenset[_T_co]: ... + def __or__(self, __s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ... + def __sub__(self, __s: AbstractSet[_T_co]) -> frozenset[_T_co]: ... + def __xor__(self, __s: AbstractSet[_S]) -> frozenset[_T_co | _S]: ... + def __le__(self, __s: AbstractSet[object]) -> bool: ... + def __lt__(self, __s: AbstractSet[object]) -> bool: ... + def __ge__(self, __s: AbstractSet[object]) -> bool: ... + def __gt__(self, __s: AbstractSet[object]) -> bool: ... if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... -class enumerate(Iterator[Tuple[int, _T]], Generic[_T]): +class enumerate(Iterator[tuple[int, _T]], Generic[_T]): def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ... - def __iter__(self) -> Iterator[Tuple[int, _T]]: ... - def __next__(self) -> Tuple[int, _T]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> tuple[int, _T]: ... if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... +@final class range(Sequence[int]): - start: int - stop: int - step: int + @property + def start(self) -> int: ... + @property + def stop(self) -> int: ... + @property + def step(self) -> int: ... @overload - def __init__(self, stop: SupportsIndex) -> None: ... + def __init__(self, __stop: SupportsIndex) -> None: ... @overload - def __init__(self, start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = ...) -> None: ... - def count(self, value: int) -> int: ... - def index(self, value: int) -> int: ... # type: ignore + def __init__(self, __start: SupportsIndex, __stop: SupportsIndex, __step: SupportsIndex = ...) -> None: ... + def count(self, __value: int) -> int: ... + def index(self, __value: int) -> int: ... # type: ignore[override] def __len__(self) -> int: ... - def __contains__(self, o: object) -> bool: ... + def __contains__(self, __o: object) -> bool: ... def __iter__(self) -> Iterator[int]: ... @overload - def __getitem__(self, i: SupportsIndex) -> int: ... + def __getitem__(self, __i: SupportsIndex) -> int: ... @overload - def __getitem__(self, s: slice) -> range: ... - def __repr__(self) -> str: ... + def __getitem__(self, __s: slice) -> range: ... def __reversed__(self) -> Iterator[int]: ... -class property(object): +class property: fget: Callable[[Any], Any] | None fset: Callable[[Any, Any], None] | None fdel: Callable[[Any], None] | None + __isabstractmethod__: bool def __init__( self, fget: Callable[[Any], Any] | None = ..., @@ -953,17 +1178,18 @@ class property(object): fdel: Callable[[Any], None] | None = ..., doc: str | None = ..., ) -> None: ... - def getter(self, fget: Callable[[Any], Any]) -> property: ... - def setter(self, fset: Callable[[Any, Any], None]) -> property: ... - def deleter(self, fdel: Callable[[Any], None]) -> property: ... - def __get__(self, obj: Any, type: type | None = ...) -> Any: ... - def __set__(self, obj: Any, value: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... - -class _NotImplementedType(Any): # type: ignore + def getter(self, __fget: Callable[[Any], Any]) -> property: ... + def setter(self, __fset: Callable[[Any, Any], None]) -> property: ... + def deleter(self, __fdel: Callable[[Any], None]) -> property: ... + def __get__(self, __obj: Any, __type: type | None = ...) -> Any: ... + def __set__(self, __obj: Any, __value: Any) -> None: ... + def __delete__(self, __obj: Any) -> None: ... + +@final +class _NotImplementedType(Any): # type: ignore[misc] # A little weird, but typing the __call__ as NotImplemented makes the error message # for NotImplemented() much better - __call__: NotImplemented # type: ignore + __call__: NotImplemented # type: ignore[valid-type] NotImplemented: _NotImplementedType @@ -972,31 +1198,34 @@ def all(__iterable: Iterable[object]) -> bool: ... def any(__iterable: Iterable[object]) -> bool: ... def ascii(__obj: object) -> str: ... def bin(__number: int | SupportsIndex) -> str: ... - -if sys.version_info >= (3, 7): - def breakpoint(*args: Any, **kws: Any) -> None: ... - -def callable(__obj: object) -> bool: ... +def breakpoint(*args: Any, **kws: Any) -> None: ... +def callable(__obj: object) -> TypeGuard[Callable[..., object]]: ... def chr(__i: int) -> str: ... # We define this here instead of using os.PathLike to avoid import cycle issues. # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 -_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) - -class _PathLike(Protocol[_AnyStr_co]): - def __fspath__(self) -> _AnyStr_co: ... +class _PathLike(Protocol[AnyStr_co]): + def __fspath__(self) -> AnyStr_co: ... if sys.version_info >= (3, 10): - def aiter(__iterable: AsyncIterable[_T]) -> AsyncIterator[_T]: ... + def aiter(__async_iterable: SupportsAiter[_SupportsAnextT]) -> _SupportsAnextT: ... + + class _SupportsSynchronousAnext(Protocol[_AwaitableT_co]): + def __anext__(self) -> _AwaitableT_co: ... + @overload - async def anext(__i: SupportsAnext[_T]) -> _T: ... + # `anext` is not, in fact, an async function. When default is not provided + # `anext` is just a passthrough for `obj.__anext__` + # See discussion in #7491 and pure-Python implementation of `anext` at https://github.com/python/cpython/blob/ea786a882b9ed4261eafabad6011bc7ef3b5bf94/Lib/test/test_asyncgen.py#L52-L80 + def anext(__i: _SupportsSynchronousAnext[_AwaitableT]) -> _AwaitableT: ... @overload async def anext(__i: SupportsAnext[_T], default: _VT) -> _T | _VT: ... +# TODO: `compile` has a more precise return type in reality; work on a way of expressing that? if sys.version_info >= (3, 8): def compile( - source: str | bytes | mod | AST, - filename: str | bytes | _PathLike[Any], + source: str | ReadableBuffer | AST, + filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: int = ..., dont_inherit: int = ..., @@ -1007,8 +1236,8 @@ if sys.version_info >= (3, 8): else: def compile( - source: str | bytes | mod | AST, - filename: str | bytes | _PathLike[Any], + source: str | ReadableBuffer | AST, + filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: int = ..., dont_inherit: int = ..., @@ -1017,65 +1246,97 @@ else: def copyright() -> None: ... def credits() -> None: ... -def delattr(__obj: Any, __name: str) -> None: ... +def delattr(__obj: object, __name: str) -> None: ... def dir(__o: object = ...) -> list[str]: ... @overload def divmod(__x: SupportsDivMod[_T_contra, _T_co], __y: _T_contra) -> _T_co: ... @overload def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ... + +# The `globals` argument to `eval` has to be `dict[str, Any]` rather than `dict[str, object]` due to invariance. +# (The `globals` argument has to be a "real dict", rather than any old mapping, unlike the `locals` argument.) def eval( - __source: str | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... + __source: str | ReadableBuffer | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, object] | None = ... ) -> Any: ... -def exec( - __source: str | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... -) -> Any: ... -def exit(code: object = ...) -> NoReturn: ... + +# Comment above regarding `eval` applies to `exec` as well +if sys.version_info >= (3, 11): + def exec( + __source: str | ReadableBuffer | CodeType, + __globals: dict[str, Any] | None = ..., + __locals: Mapping[str, object] | None = ..., + *, + closure: tuple[_Cell, ...] | None = ..., + ) -> None: ... + +else: + def exec( + __source: str | ReadableBuffer | CodeType, + __globals: dict[str, Any] | None = ..., + __locals: Mapping[str, object] | None = ..., + ) -> None: ... + +def exit(code: sys._ExitCode = ...) -> NoReturn: ... class filter(Iterator[_T], Generic[_T]): @overload def __init__(self, __function: None, __iterable: Iterable[_T | None]) -> None: ... @overload + def __init__(self, __function: Callable[[_S], TypeGuard[_T]], __iterable: Iterable[_S]) -> None: ... + @overload def __init__(self, __function: Callable[[_T], Any], __iterable: Iterable[_T]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... -def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode +def format(__value: object, __format_spec: str = ...) -> str: ... @overload -def getattr(__o: object, name: str) -> Any: ... +def getattr(__o: object, __name: str) -> Any: ... -# While technically covered by the last overload, spelling out the types for None and bool -# help mypy out in some tricky situations involving type context (aka bidirectional inference) +# While technically covered by the last overload, spelling out the types for None, bool +# and basic containers help mypy out in some tricky situations involving type context +# (aka bidirectional inference) +@overload +def getattr(__o: object, __name: str, __default: None) -> Any | None: ... +@overload +def getattr(__o: object, __name: str, __default: bool) -> Any | bool: ... @overload -def getattr(__o: object, name: str, __default: None) -> Any | None: ... +def getattr(__o: object, name: str, __default: list[Any]) -> Any | list[Any]: ... @overload -def getattr(__o: object, name: str, __default: bool) -> Any | bool: ... +def getattr(__o: object, name: str, __default: dict[Any, Any]) -> Any | dict[Any, Any]: ... @overload -def getattr(__o: object, name: str, __default: _T) -> Any | _T: ... +def getattr(__o: object, __name: str, __default: _T) -> Any | _T: ... def globals() -> dict[str, Any]: ... def hasattr(__obj: object, __name: str) -> bool: ... def hash(__obj: object) -> int: ... -def help(*args: Any, **kwds: Any) -> None: ... +def help(request: object = ...) -> None: ... def hex(__number: int | SupportsIndex) -> str: ... def id(__obj: object) -> int: ... -def input(__prompt: Any = ...) -> str: ... +def input(__prompt: object = ...) -> str: ... + +class _GetItemIterable(Protocol[_T_co]): + def __getitem__(self, __i: int) -> _T_co: ... + +@overload +def iter(__iterable: SupportsIter[_SupportsNextT]) -> _SupportsNextT: ... @overload -def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... +def iter(__iterable: _GetItemIterable[_T]) -> Iterator[_T]: ... @overload def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ... @overload -def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ... +def iter(__function: Callable[[], _T], __sentinel: object) -> Iterator[_T]: ... +# We need recursive types to express the type of the second argument to `isinstance` properly, hence the use of `Any` if sys.version_info >= (3, 10): def isinstance( - __obj: object, __class_or_tuple: type | types.UnionType | Tuple[type | types.UnionType | Tuple[Any, ...], ...] + __obj: object, __class_or_tuple: type | types.UnionType | tuple[type | types.UnionType | tuple[Any, ...], ...] ) -> bool: ... def issubclass( - __cls: type, __class_or_tuple: type | types.UnionType | Tuple[type | types.UnionType | Tuple[Any, ...], ...] + __cls: type, __class_or_tuple: type | types.UnionType | tuple[type | types.UnionType | tuple[Any, ...], ...] ) -> bool: ... else: - def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... - def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ... + def isinstance(__obj: object, __class_or_tuple: type | tuple[type | tuple[Any, ...], ...]) -> bool: ... + def issubclass(__cls: type, __class_or_tuple: type | tuple[type | tuple[Any, ...], ...]) -> bool: ... def len(__obj: Sized) -> int: ... def license() -> None: ... @@ -1121,45 +1382,45 @@ class map(Iterator[_S], Generic[_S]): __iter6: Iterable[Any], *iterables: Iterable[Any], ) -> None: ... - def __iter__(self) -> Iterator[_S]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _S: ... @overload def max( - __arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ... -) -> SupportsLessThanT: ... + __arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = ... +) -> SupportsRichComparisonT: ... @overload -def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsLessThan]) -> _T: ... +def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsRichComparison]) -> _T: ... @overload -def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> SupportsLessThanT: ... +def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ...) -> SupportsRichComparisonT: ... @overload -def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan]) -> _T: ... +def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison]) -> _T: ... @overload -def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> SupportsLessThanT | _T: ... +def max(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ..., default: _T) -> SupportsRichComparisonT | _T: ... @overload -def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> _T1 | _T2: ... +def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ... @overload def min( - __arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ... -) -> SupportsLessThanT: ... + __arg1: SupportsRichComparisonT, __arg2: SupportsRichComparisonT, *_args: SupportsRichComparisonT, key: None = ... +) -> SupportsRichComparisonT: ... @overload -def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsLessThan]) -> _T: ... +def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], SupportsRichComparison]) -> _T: ... @overload -def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> SupportsLessThanT: ... +def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ...) -> SupportsRichComparisonT: ... @overload -def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan]) -> _T: ... +def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison]) -> _T: ... @overload -def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> SupportsLessThanT | _T: ... +def min(__iterable: Iterable[SupportsRichComparisonT], *, key: None = ..., default: _T) -> SupportsRichComparisonT | _T: ... @overload -def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> _T1 | _T2: ... +def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsRichComparison], default: _T2) -> _T1 | _T2: ... @overload def next(__i: SupportsNext[_T]) -> _T: ... @overload -def next(__i: SupportsNext[_T], default: _VT) -> _T | _VT: ... +def next(__i: SupportsNext[_T], __default: _VT) -> _T | _VT: ... def oct(__number: int | SupportsIndex) -> str: ... -_OpenFile = Union[StrOrBytesPath, int] -_Opener = Callable[[str, int], int] +_OpenFile = StrOrBytesPath | int # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed +_Opener: TypeAlias = Callable[[str, int], int] # Text mode: always returns a TextIOWrapper @overload @@ -1227,7 +1488,7 @@ def open( def open( file: _OpenFile, mode: OpenBinaryMode, - buffering: int, + buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ..., @@ -1247,9 +1508,22 @@ def open( closefd: bool = ..., opener: _Opener | None = ..., ) -> IO[Any]: ... -def ord(__c: str | bytes) -> int: ... +def ord(__c: str | bytes | bytearray) -> int: ... + +class _SupportsWriteAndFlush(SupportsWrite[_T_contra], Protocol[_T_contra]): + def flush(self) -> None: ... + +@overload def print( - *values: object, sep: str | None = ..., end: str | None = ..., file: SupportsWrite[str] | None = ..., flush: bool = ... + *values: object, + sep: str | None = ..., + end: str | None = ..., + file: SupportsWrite[str] | None = ..., + flush: Literal[False] = ..., +) -> None: ... +@overload +def print( + *values: object, sep: str | None = ..., end: str | None = ..., file: _SupportsWriteAndFlush[str] | None = ..., flush: bool ) -> None: ... _E = TypeVar("_E", contravariant=True) @@ -1258,44 +1532,97 @@ _M = TypeVar("_M", contravariant=True) class _SupportsPow2(Protocol[_E, _T_co]): def __pow__(self, __other: _E) -> _T_co: ... +class _SupportsPow3NoneOnly(Protocol[_E, _T_co]): + def __pow__(self, __other: _E, __modulo: None = ...) -> _T_co: ... + class _SupportsPow3(Protocol[_E, _M, _T_co]): def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ... +_SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed + _SupportsPow2[Any, Any] | _SupportsPow3NoneOnly[Any, Any] | _SupportsPow3[Any, Any, Any] +) + if sys.version_info >= (3, 8): - @overload - def pow(base: int, exp: int, mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative + # TODO: `pow(int, int, Literal[0])` fails at runtime, + # but adding a `NoReturn` overload isn't a good solution for expressing that (see #8566). @overload def pow(base: int, exp: int, mod: int) -> int: ... @overload - def pow(base: float, exp: float, mod: None = ...) -> float: ... + def pow(base: int, exp: Literal[0], mod: None = ...) -> Literal[1]: ... # type: ignore[misc] + @overload + def pow(base: int, exp: _PositiveInteger, mod: None = ...) -> int: ... # type: ignore[misc] + @overload + def pow(base: int, exp: _NegativeInteger, mod: None = ...) -> float: ... # type: ignore[misc] + # int base & positive-int exp -> int; int base & negative-int exp -> float + # return type must be Any as `int | float` causes too many false-positive errors + @overload + def pow(base: int, exp: int, mod: None = ...) -> Any: ... @overload - def pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co: ... + def pow(base: _PositiveInteger, exp: float, mod: None = ...) -> float: ... @overload - def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ... + def pow(base: _NegativeInteger, exp: float, mod: None = ...) -> complex: ... + @overload + def pow(base: float, exp: int, mod: None = ...) -> float: ... + # float base & float exp could return float or complex + # return type must be Any (same as complex base, complex exp), + # as `float | complex` causes too many false-positive errors + @overload + def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = ...) -> Any: ... + @overload + def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = ...) -> complex: ... + @overload + def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = ...) -> _T_co: ... + @overload + def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = ...) -> _T_co: ... + @overload + def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M = ...) -> _T_co: ... + @overload + def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = ...) -> Any: ... + @overload + def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = ...) -> complex: ... else: - @overload - def pow( - __base: int, __exp: int, __mod: None = ... - ) -> Any: ... # returns int or float depending on whether exp is non-negative @overload def pow(__base: int, __exp: int, __mod: int) -> int: ... @overload - def pow(__base: float, __exp: float, __mod: None = ...) -> float: ... + def pow(__base: int, __exp: Literal[0], __mod: None = ...) -> Literal[1]: ... # type: ignore[misc] + @overload + def pow(__base: int, __exp: _PositiveInteger, __mod: None = ...) -> int: ... # type: ignore[misc] + @overload + def pow(__base: int, __exp: _NegativeInteger, __mod: None = ...) -> float: ... # type: ignore[misc] + @overload + def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... + @overload + def pow(__base: _PositiveInteger, __exp: float, __mod: None = ...) -> float: ... + @overload + def pow(__base: _NegativeInteger, __exp: float, __mod: None = ...) -> complex: ... + @overload + def pow(__base: float, __exp: int, __mod: None = ...) -> float: ... + @overload + def pow(__base: float, __exp: complex | _SupportsSomeKindOfPow, __mod: None = ...) -> Any: ... + @overload + def pow(__base: complex, __exp: complex | _SupportsSomeKindOfPow, __mod: None = ...) -> complex: ... @overload - def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ... + def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E, __mod: None = ...) -> _T_co: ... @overload - def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ... + def pow(__base: _SupportsPow3NoneOnly[_E, _T_co], __exp: _E, __mod: None = ...) -> _T_co: ... + @overload + def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M = ...) -> _T_co: ... + @overload + def pow(__base: _SupportsSomeKindOfPow, __exp: float, __mod: None = ...) -> Any: ... + @overload + def pow(__base: _SupportsSomeKindOfPow, __exp: complex, __mod: None = ...) -> complex: ... -def quit(code: object = ...) -> NoReturn: ... +def quit(code: sys._ExitCode = ...) -> NoReturn: ... class reversed(Iterator[_T], Generic[_T]): @overload def __init__(self, __sequence: Reversible[_T]) -> None: ... @overload def __init__(self, __sequence: SupportsLenAndGetItem[_T]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... + def __length_hint__(self) -> int: ... def repr(__obj: object) -> str: ... @overload @@ -1304,36 +1631,61 @@ def round(number: SupportsRound[Any]) -> int: ... def round(number: SupportsRound[Any], ndigits: None) -> int: ... @overload def round(number: SupportsRound[_T], ndigits: SupportsIndex) -> _T: ... + +# See https://github.com/python/typeshed/pull/6292#discussion_r748875189 +# for why arg 3 of `setattr` should be annotated with `Any` and not `object` def setattr(__obj: object, __name: str, __value: Any) -> None: ... @overload -def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> list[SupportsLessThanT]: ... +def sorted( + __iterable: Iterable[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ... +) -> list[SupportsRichComparisonT]: ... @overload -def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> list[_T]: ... +def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> list[_T]: ... +_AddableT1 = TypeVar("_AddableT1", bound=SupportsAdd[Any, Any]) +_AddableT2 = TypeVar("_AddableT2", bound=SupportsAdd[Any, Any]) + +class _SupportsSumWithNoDefaultGiven(SupportsAdd[Any, Any], SupportsRAdd[int, Any], Protocol): ... + +_SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWithNoDefaultGiven) + +# In general, the return type of `x + x` is *not* guaranteed to be the same type as x. +# However, we can't express that in the stub for `sum()` +# without creating many false-positive errors (see #7578). +# Instead, we special-case the most common examples of this: bool and literal integers. if sys.version_info >= (3, 8): @overload - def sum(__iterable: Iterable[_T]) -> _T | int: ... - @overload - def sum(__iterable: Iterable[_T], start: _S) -> _T | _S: ... + def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = ...) -> int: ... # type: ignore[misc] else: @overload - def sum(__iterable: Iterable[_T]) -> _T | int: ... + def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = ...) -> int: ... # type: ignore[misc] + +@overload +def sum(__iterable: Iterable[_SupportsSumNoDefaultT]) -> _SupportsSumNoDefaultT | Literal[0]: ... + +if sys.version_info >= (3, 8): @overload - def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ... + def sum(__iterable: Iterable[_AddableT1], start: _AddableT2) -> _AddableT1 | _AddableT2: ... +else: + @overload + def sum(__iterable: Iterable[_AddableT1], __start: _AddableT2) -> _AddableT1 | _AddableT2: ... + +# The argument to `vars()` has to have a `__dict__` attribute, so can't be annotated with `object` +# (A "SupportsDunderDict" protocol doesn't work) def vars(__object: Any = ...) -> dict[str, Any]: ... class zip(Iterator[_T_co], Generic[_T_co]): if sys.version_info >= (3, 10): @overload - def __new__(cls, __iter1: Iterable[_T1], *, strict: bool = ...) -> zip[Tuple[_T1]]: ... + def __new__(cls, __iter1: Iterable[_T1], *, strict: bool = ...) -> zip[tuple[_T1]]: ... @overload - def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], *, strict: bool = ...) -> zip[Tuple[_T1, _T2]]: ... + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], *, strict: bool = ...) -> zip[tuple[_T1, _T2]]: ... @overload def __new__( cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], *, strict: bool = ... - ) -> zip[Tuple[_T1, _T2, _T3]]: ... + ) -> zip[tuple[_T1, _T2, _T3]]: ... @overload def __new__( cls, @@ -1343,7 +1695,7 @@ class zip(Iterator[_T_co], Generic[_T_co]): __iter4: Iterable[_T4], *, strict: bool = ..., - ) -> zip[Tuple[_T1, _T2, _T3, _T4]]: ... + ) -> zip[tuple[_T1, _T2, _T3, _T4]]: ... @overload def __new__( cls, @@ -1354,7 +1706,7 @@ class zip(Iterator[_T_co], Generic[_T_co]): __iter5: Iterable[_T5], *, strict: bool = ..., - ) -> zip[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + ) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def __new__( cls, @@ -1366,18 +1718,18 @@ class zip(Iterator[_T_co], Generic[_T_co]): __iter6: Iterable[Any], *iterables: Iterable[Any], strict: bool = ..., - ) -> zip[Tuple[Any, ...]]: ... + ) -> zip[tuple[Any, ...]]: ... else: @overload - def __new__(cls, __iter1: Iterable[_T1]) -> zip[Tuple[_T1]]: ... + def __new__(cls, __iter1: Iterable[_T1]) -> zip[tuple[_T1]]: ... @overload - def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> zip[Tuple[_T1, _T2]]: ... + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> zip[tuple[_T1, _T2]]: ... @overload - def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> zip[Tuple[_T1, _T2, _T3]]: ... + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> zip[tuple[_T1, _T2, _T3]]: ... @overload def __new__( cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] - ) -> zip[Tuple[_T1, _T2, _T3, _T4]]: ... + ) -> zip[tuple[_T1, _T2, _T3, _T4]]: ... @overload def __new__( cls, @@ -1386,7 +1738,7 @@ class zip(Iterator[_T_co], Generic[_T_co]): __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5], - ) -> zip[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + ) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def __new__( cls, @@ -1397,48 +1749,55 @@ class zip(Iterator[_T_co], Generic[_T_co]): __iter5: Iterable[Any], __iter6: Iterable[Any], *iterables: Iterable[Any], - ) -> zip[Tuple[Any, ...]]: ... - def __iter__(self) -> Iterator[_T_co]: ... + ) -> zip[tuple[Any, ...]]: ... + + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T_co: ... +# Signature of `builtins.__import__` should be kept identical to `importlib.__import__` +# Return type of `__import__` should be kept the same as return type of `importlib.import_module` def __import__( name: str, - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., + globals: Mapping[str, object] | None = ..., + locals: Mapping[str, object] | None = ..., fromlist: Sequence[str] = ..., level: int = ..., -) -> Any: ... +) -> types.ModuleType: ... +def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ... # Actually the type of Ellipsis is , but since it's # not exposed anywhere under that name, we make it private here. +@final +@type_check_only class ellipsis: ... Ellipsis: ellipsis -class BaseException(object): - args: Tuple[Any, ...] +class BaseException: + args: tuple[Any, ...] __cause__: BaseException | None __context__: BaseException | None __suppress_context__: bool __traceback__: TracebackType | None def __init__(self, *args: object) -> None: ... - def __str__(self) -> str: ... - def __repr__(self) -> str: ... - def with_traceback(self: _TBE, tb: TracebackType | None) -> _TBE: ... + def __setstate__(self, __state: dict[str, Any] | None) -> None: ... + def with_traceback(self: Self, __tb: TracebackType | None) -> Self: ... + if sys.version_info >= (3, 11): + # only present after add_note() is called + __notes__: list[str] + def add_note(self, __note: str) -> None: ... class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... class SystemExit(BaseException): - code: int + code: sys._ExitCode class Exception(BaseException): ... class StopIteration(Exception): value: Any -_StandardError = Exception - class OSError(Exception): errno: int strerror: str @@ -1453,37 +1812,38 @@ IOError = OSError if sys.platform == "win32": WindowsError = OSError -class ArithmeticError(_StandardError): ... -class AssertionError(_StandardError): ... +class ArithmeticError(Exception): ... +class AssertionError(Exception): ... -class AttributeError(_StandardError): +class AttributeError(Exception): if sys.version_info >= (3, 10): + def __init__(self, *args: object, name: str | None = ..., obj: object = ...) -> None: ... name: str obj: object -class BufferError(_StandardError): ... -class EOFError(_StandardError): ... +class BufferError(Exception): ... +class EOFError(Exception): ... -class ImportError(_StandardError): +class ImportError(Exception): def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None: ... name: str | None path: str | None msg: str # undocumented -class LookupError(_StandardError): ... -class MemoryError(_StandardError): ... +class LookupError(Exception): ... +class MemoryError(Exception): ... -class NameError(_StandardError): +class NameError(Exception): if sys.version_info >= (3, 10): name: str -class ReferenceError(_StandardError): ... -class RuntimeError(_StandardError): ... +class ReferenceError(Exception): ... +class RuntimeError(Exception): ... class StopAsyncIteration(Exception): value: Any -class SyntaxError(_StandardError): +class SyntaxError(Exception): msg: str lineno: int | None offset: int | None @@ -1493,9 +1853,9 @@ class SyntaxError(_StandardError): end_lineno: int | None end_offset: int | None -class SystemError(_StandardError): ... -class TypeError(_StandardError): ... -class ValueError(_StandardError): ... +class SystemError(Exception): ... +class TypeError(Exception): ... +class ValueError(Exception): ... class FloatingPointError(ArithmeticError): ... class OverflowError(ArithmeticError): ... class ZeroDivisionError(ArithmeticError): ... @@ -1533,7 +1893,7 @@ class UnicodeDecodeError(UnicodeError): start: int end: int reason: str - def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ... + def __init__(self, __encoding: str, __object: ReadableBuffer, __start: int, __end: int, __reason: str) -> None: ... class UnicodeEncodeError(UnicodeError): encoding: str @@ -1543,7 +1903,14 @@ class UnicodeEncodeError(UnicodeError): reason: str def __init__(self, __encoding: str, __object: str, __start: int, __end: int, __reason: str) -> None: ... -class UnicodeTranslateError(UnicodeError): ... +class UnicodeTranslateError(UnicodeError): + encoding: None + object: str + start: int + end: int + reason: str + def __init__(self, __object: str, __start: int, __end: int, __reason: str) -> None: ... + class Warning(Exception): ... class UserWarning(Warning): ... class DeprecationWarning(Warning): ... @@ -1558,3 +1925,48 @@ class ResourceWarning(Warning): ... if sys.version_info >= (3, 10): class EncodingWarning(Warning): ... + +if sys.version_info >= (3, 11): + _BaseExceptionT_co = TypeVar("_BaseExceptionT_co", bound=BaseException, covariant=True) + _BaseExceptionT = TypeVar("_BaseExceptionT", bound=BaseException) + _ExceptionT_co = TypeVar("_ExceptionT_co", bound=Exception, covariant=True) + _ExceptionT = TypeVar("_ExceptionT", bound=Exception) + + class BaseExceptionGroup(BaseException, Generic[_BaseExceptionT_co]): + def __new__(cls: type[Self], __message: str, __exceptions: Sequence[_BaseExceptionT_co]) -> Self: ... + @property + def message(self) -> str: ... + @property + def exceptions(self) -> tuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]: ... + @overload + def subgroup( + self, __condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] + ) -> BaseExceptionGroup[_BaseExceptionT] | None: ... + @overload + def subgroup(self: Self, __condition: Callable[[_BaseExceptionT_co], bool]) -> Self | None: ... + @overload + def split( + self: Self, __condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] + ) -> tuple[BaseExceptionGroup[_BaseExceptionT] | None, Self | None]: ... + @overload + def split(self: Self, __condition: Callable[[_BaseExceptionT_co], bool]) -> tuple[Self | None, Self | None]: ... + def derive(self: Self, __excs: Sequence[_BaseExceptionT_co]) -> Self: ... + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... + + class ExceptionGroup(BaseExceptionGroup[_ExceptionT_co], Exception): + def __new__(cls: type[Self], __message: str, __exceptions: Sequence[_ExceptionT_co]) -> Self: ... + @property + def exceptions(self) -> tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]: ... + # We accept a narrower type, but that's OK. + @overload # type: ignore[override] + def subgroup( + self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...] + ) -> ExceptionGroup[_ExceptionT] | None: ... + @overload + def subgroup(self: Self, __condition: Callable[[_ExceptionT_co], bool]) -> Self | None: ... + @overload # type: ignore[override] + def split( + self: Self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...] + ) -> tuple[ExceptionGroup[_ExceptionT] | None, Self | None]: ... + @overload + def split(self: Self, __condition: Callable[[_ExceptionT_co], bool]) -> tuple[Self | None, Self | None]: ... diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index e7b57ec..295271d 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -2,8 +2,11 @@ import _compression import sys from _compression import BaseStream from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer -from typing import IO, Any, Iterable, Protocol, TextIO, TypeVar, overload -from typing_extensions import Literal, SupportsIndex +from collections.abc import Iterable +from typing import IO, Any, Protocol, TextIO, overload +from typing_extensions import Literal, SupportsIndex, TypeAlias, final + +__all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor", "open", "compress", "decompress"] # The following attributes and methods are optional: # def fileno(self) -> int: ... @@ -16,15 +19,13 @@ class _WritableFileobj(Protocol): # def fileno(self) -> int: ... # def close(self) -> object: ... -_T = TypeVar("_T") - -def compress(data: bytes, compresslevel: int = ...) -> bytes: ... -def decompress(data: bytes) -> bytes: ... +def compress(data: ReadableBuffer, compresslevel: int = ...) -> bytes: ... +def decompress(data: ReadableBuffer) -> bytes: ... -_ReadBinaryMode = Literal["", "r", "rb"] -_WriteBinaryMode = Literal["w", "wb", "x", "xb", "a", "ab"] -_ReadTextMode = Literal["rt"] -_WriteTextMode = Literal["wt", "xt", "at"] +_ReadBinaryMode: TypeAlias = Literal["", "r", "rb"] +_WriteBinaryMode: TypeAlias = Literal["w", "wb", "x", "xb", "a", "ab"] +_ReadTextMode: TypeAlias = Literal["rt"] +_WriteTextMode: TypeAlias = Literal["wt", "xt", "at"] @overload def open( @@ -80,6 +81,15 @@ def open( errors: str | None = ..., newline: str | None = ..., ) -> TextIO: ... +@overload +def open( + filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj, + mode: str, + compresslevel: int = ..., + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., +) -> BZ2File | TextIO: ... class BZ2File(BaseStream, IO[bytes]): def __enter__(self: Self) -> Self: ... @@ -109,22 +119,25 @@ class BZ2File(BaseStream, IO[bytes]): buffering: Any | None = ..., compresslevel: int = ..., ) -> None: ... + def read(self, size: int | None = ...) -> bytes: ... def read1(self, size: int = ...) -> bytes: ... - def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore + def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore[override] def readinto(self, b: WriteableBuffer) -> int: ... def readlines(self, size: SupportsIndex = ...) -> list[bytes]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def write(self, data: ReadableBuffer) -> int: ... def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... -class BZ2Compressor(object): +@final +class BZ2Compressor: def __init__(self, compresslevel: int = ...) -> None: ... - def compress(self, __data: bytes) -> bytes: ... + def compress(self, __data: ReadableBuffer) -> bytes: ... def flush(self) -> bytes: ... -class BZ2Decompressor(object): - def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... +@final +class BZ2Decompressor: + def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ... @property def eof(self) -> bool: ... @property diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index f4a7ab5..6e21fc9 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -1,7 +1,11 @@ import sys from _typeshed import Self, StrOrBytesPath +from collections.abc import Callable from types import CodeType -from typing import Any, Callable, Tuple, TypeVar +from typing import Any, TypeVar +from typing_extensions import ParamSpec, TypeAlias + +__all__ = ["run", "runctx", "Profile"] def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( @@ -9,7 +13,8 @@ def runctx( ) -> None: ... _T = TypeVar("_T") -_Label = Tuple[str, int, str] +_P = ParamSpec("_P") +_Label: TypeAlias = tuple[str, int, str] class Profile: stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented @@ -24,9 +29,9 @@ class Profile: def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... if sys.version_info >= (3, 8): def __enter__(self: Self) -> Self: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__(self, *exc_info: object) -> None: ... def label(code: str | CodeType) -> _Label: ... # undocumented diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 9d701a7..74b8d39 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -1,22 +1,52 @@ import datetime import sys +from collections.abc import Iterable, Sequence from time import struct_time -from typing import Any, Iterable, Optional, Sequence, Tuple - -_LocaleType = Tuple[Optional[str], Optional[str]] +from typing import ClassVar +from typing_extensions import Literal, TypeAlias + +__all__ = [ + "IllegalMonthError", + "IllegalWeekdayError", + "setfirstweekday", + "firstweekday", + "isleap", + "leapdays", + "weekday", + "monthrange", + "monthcalendar", + "prmonth", + "month", + "prcal", + "calendar", + "timegm", + "month_name", + "month_abbr", + "day_name", + "day_abbr", + "Calendar", + "TextCalendar", + "HTMLCalendar", + "LocaleTextCalendar", + "LocaleHTMLCalendar", + "weekheader", +] + +if sys.version_info >= (3, 10): + __all__ += ["FRIDAY", "MONDAY", "SATURDAY", "SUNDAY", "THURSDAY", "TUESDAY", "WEDNESDAY"] + +_LocaleType: TypeAlias = tuple[str | None, str | None] class IllegalMonthError(ValueError): def __init__(self, month: int) -> None: ... - def __str__(self) -> str: ... class IllegalWeekdayError(ValueError): def __init__(self, weekday: int) -> None: ... - def __str__(self) -> str: ... def isleap(year: int) -> bool: ... def leapdays(y1: int, y2: int) -> int: ... def weekday(year: int, month: int, day: int) -> int: ... -def monthrange(year: int, month: int) -> Tuple[int, int]: ... +def monthrange(year: int, month: int) -> tuple[int, int]: ... class Calendar: firstweekday: int @@ -25,17 +55,16 @@ class Calendar: def setfirstweekday(self, firstweekday: int) -> None: ... def iterweekdays(self) -> Iterable[int]: ... def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ... - def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ... + def itermonthdays2(self, year: int, month: int) -> Iterable[tuple[int, int]]: ... def itermonthdays(self, year: int, month: int) -> Iterable[int]: ... def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ... - def monthdays2calendar(self, year: int, month: int) -> list[list[Tuple[int, int]]]: ... + def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: ... def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ... def yeardatescalendar(self, year: int, width: int = ...) -> list[list[int]]: ... - def yeardays2calendar(self, year: int, width: int = ...) -> list[list[Tuple[int, int]]]: ... + def yeardays2calendar(self, year: int, width: int = ...) -> list[list[tuple[int, int]]]: ... def yeardayscalendar(self, year: int, width: int = ...) -> list[list[int]]: ... - if sys.version_info >= (3, 7): - def itermonthdays3(self, year: int, month: int) -> Iterable[Tuple[int, int, int]]: ... - def itermonthdays4(self, year: int, month: int) -> Iterable[Tuple[int, int, int, int]]: ... + def itermonthdays3(self, year: int, month: int) -> Iterable[tuple[int, int, int]]: ... + def itermonthdays4(self, year: int, month: int) -> Iterable[tuple[int, int, int, int]]: ... class TextCalendar(Calendar): def prweek(self, theweek: int, width: int) -> None: ... @@ -60,6 +89,13 @@ def calendar(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = .. def prcal(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... class HTMLCalendar(Calendar): + cssclasses: ClassVar[list[str]] + cssclass_noday: ClassVar[str] + cssclasses_weekday_head: ClassVar[list[str]] + cssclass_month_head: ClassVar[str] + cssclass_month: ClassVar[str] + cssclass_year: ClassVar[str] + cssclass_year_head: ClassVar[str] def formatday(self, day: int, weekday: int) -> str: ... def formatweek(self, theweek: int) -> str: ... def formatweekday(self, day: int) -> str: ... @@ -68,24 +104,14 @@ class HTMLCalendar(Calendar): def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... def formatyear(self, theyear: int, width: int = ...) -> str: ... def formatyearpage(self, theyear: int, width: int = ..., css: str | None = ..., encoding: str | None = ...) -> str: ... - if sys.version_info >= (3, 7): - cssclasses: list[str] - cssclass_noday: str - cssclasses_weekday_head: list[str] - cssclass_month_head: str - cssclass_month: str - cssclass_year: str - cssclass_year_head: str class different_locale: def __init__(self, locale: _LocaleType) -> None: ... - def __enter__(self) -> _LocaleType: ... - def __exit__(self, *args: Any) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, *args: object) -> None: ... class LocaleTextCalendar(TextCalendar): def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... - def formatweekday(self, day: int, width: int) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ... class LocaleHTMLCalendar(HTMLCalendar): def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... @@ -97,7 +123,7 @@ c: TextCalendar def setfirstweekday(firstweekday: int) -> None: ... def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... -def timegm(tuple: Tuple[int, ...] | struct_time) -> int: ... +def timegm(tuple: tuple[int, ...] | struct_time) -> int: ... # Data attributes day_name: Sequence[str] @@ -105,13 +131,12 @@ day_abbr: Sequence[str] month_name: Sequence[str] month_abbr: Sequence[str] -# Below constants are not in docs or __all__, but enough people have used them -# they are now effectively public. +MONDAY: Literal[0] +TUESDAY: Literal[1] +WEDNESDAY: Literal[2] +THURSDAY: Literal[3] +FRIDAY: Literal[4] +SATURDAY: Literal[5] +SUNDAY: Literal[6] -MONDAY: int -TUESDAY: int -WEDNESDAY: int -THURSDAY: int -FRIDAY: int -SATURDAY: int -SUNDAY: int +EPOCH: Literal[1970] diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index 3821de4..ce9a154 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -1,10 +1,28 @@ import sys -from _typeshed import SupportsGetItem, SupportsItemAccess -from builtins import type as _type +from _typeshed import Self, SupportsGetItem, SupportsItemAccess +from builtins import list as _list, type as _type from collections.abc import Iterable, Iterator, Mapping -from typing import IO, Any, Protocol, TypeVar +from email.message import Message +from types import TracebackType +from typing import IO, Any, Protocol -_T = TypeVar("_T", bound=FieldStorage) +__all__ = [ + "MiniFieldStorage", + "FieldStorage", + "parse", + "parse_multipart", + "parse_header", + "test", + "print_exception", + "print_environ", + "print_form", + "print_directory", + "print_arguments", + "print_environ_usage", +] + +if sys.version_info < (3, 8): + __all__ += ["parse_qs", "parse_qsl", "escape"] def parse( fp: IO[Any] | None = ..., @@ -18,13 +36,9 @@ 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]]: ... +def parse_multipart( + fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = ..., errors: str = ..., separator: str = ... +) -> dict[str, list[Any]]: ... class _Environ(Protocol): def __getitem__(self, __k: str) -> str: ... @@ -53,16 +67,13 @@ class MiniFieldStorage: name: Any value: Any def __init__(self, name: Any, value: Any) -> None: ... - def __repr__(self) -> str: ... -_list = list - -class FieldStorage(object): +class FieldStorage: FieldStorageClass: _type | None keep_blank_values: int strict_parsing: int qs_on_post: str | None - headers: Mapping[str, str] + headers: Mapping[str, str] | Message fp: IO[bytes] encoding: str errors: str @@ -83,7 +94,7 @@ class FieldStorage(object): def __init__( self, fp: IO[Any] | None = ..., - headers: Mapping[str, str] | None = ..., + headers: Mapping[str, str] | Message | None = ..., outerboundary: bytes = ..., environ: SupportsGetItem[str, str] = ..., keep_blank_values: int = ..., @@ -94,9 +105,8 @@ class FieldStorage(object): max_num_fields: int | None = ..., separator: str = ..., ) -> None: ... - def __enter__(self: _T) -> _T: ... - def __exit__(self, *args: Any) -> None: ... - def __repr__(self) -> str: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... def __iter__(self) -> Iterator[str]: ... def __getitem__(self, key: str) -> Any: ... def getvalue(self, key: str, default: Any = ...) -> Any: ... @@ -108,3 +118,11 @@ class FieldStorage(object): def __bool__(self) -> bool: ... # In Python 3 it returns bytes or str IO depending on an internal flag def make_file(self) -> IO[Any]: ... + +def print_exception( + type: type[BaseException] | None = ..., + value: BaseException | None = ..., + tb: TracebackType | None = ..., + limit: int | None = ..., +) -> None: ... +def print_arguments() -> None: ... diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index 90226dc..ea5a834 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -1,19 +1,20 @@ -from _typeshed import StrOrBytesPath +from _typeshed import OptExcInfo, StrOrBytesPath +from collections.abc import Callable from types import FrameType, TracebackType -from typing import IO, Any, Callable, Optional, Tuple, Type +from typing import IO, Any -_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +__UNDEF__: object # undocumented sentinel def reset() -> str: ... # undocumented def small(text: str) -> str: ... # undocumented def strong(text: str) -> str: ... # undocumented def grey(text: str) -> str: ... # undocumented -def lookup(name: str, frame: FrameType, locals: dict[str, Any]) -> Tuple[str | None, Any]: ... # undocumented +def lookup(name: str, frame: FrameType, locals: dict[str, Any]) -> tuple[str | None, Any]: ... # undocumented def scanvars( reader: Callable[[], bytes], frame: FrameType, locals: dict[str, Any] -) -> list[Tuple[str, str | None, Any]]: ... # undocumented -def html(einfo: _ExcInfo, context: int = ...) -> str: ... -def text(einfo: _ExcInfo, context: int = ...) -> str: ... +) -> list[tuple[str, str | None, Any]]: ... # undocumented +def html(einfo: OptExcInfo, context: int = ...) -> str: ... +def text(einfo: OptExcInfo, context: int = ...) -> str: ... class Hook: # undocumented def __init__( @@ -24,8 +25,8 @@ class Hook: # undocumented file: IO[str] | None = ..., format: str = ..., ) -> None: ... - def __call__(self, etype: Type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... - def handle(self, info: _ExcInfo | None = ...) -> None: ... + def __call__(self, etype: type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... + def handle(self, info: OptExcInfo | None = ...) -> None: ... -def handler(info: _ExcInfo | None = ...) -> None: ... +def handler(info: OptExcInfo | None = ...) -> None: ... def enable(display: int = ..., logdir: StrOrBytesPath | None = ..., context: int = ..., format: str = ...) -> None: ... diff --git a/stdlib/cmath.pyi b/stdlib/cmath.pyi index 8d67e6c..30ada5d 100644 --- a/stdlib/cmath.pyi +++ b/stdlib/cmath.pyi @@ -1,4 +1,9 @@ -from typing import SupportsComplex, SupportsFloat, Tuple, Union +import sys +from typing import SupportsComplex, SupportsFloat +from typing_extensions import TypeAlias + +if sys.version_info >= (3, 8): + from typing import SupportsIndex e: float pi: float @@ -8,7 +13,10 @@ nan: float nanj: complex tau: float -_C = Union[SupportsFloat, SupportsComplex, complex] +if sys.version_info >= (3, 8): + _C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex +else: + _C: TypeAlias = SupportsFloat | SupportsComplex | complex def acos(__z: _C) -> complex: ... def acosh(__z: _C) -> complex: ... @@ -25,7 +33,7 @@ def isnan(__z: _C) -> bool: ... def log(__x: _C, __y_obj: _C = ...) -> complex: ... def log10(__z: _C) -> complex: ... def phase(__z: _C) -> float: ... -def polar(__z: _C) -> Tuple[float, float]: ... +def polar(__z: _C) -> tuple[float, float]: ... def rect(__r: float, __phi: float) -> complex: ... def sin(__z: _C) -> complex: ... def sinh(__z: _C) -> complex: ... diff --git a/stdlib/cmd.pyi b/stdlib/cmd.pyi index 9f2593d..ddefff2 100644 --- a/stdlib/cmd.pyi +++ b/stdlib/cmd.pyi @@ -1,4 +1,11 @@ -from typing import IO, Any, Callable, Tuple +from collections.abc import Callable +from typing import IO, Any +from typing_extensions import Literal + +__all__ = ["Cmd"] + +PROMPT: Literal["(Cmd) "] +IDENTCHARS: str # Too big to be `Literal` class Cmd: prompt: str @@ -23,10 +30,10 @@ class Cmd: def postcmd(self, stop: bool, line: str) -> bool: ... def preloop(self) -> None: ... def postloop(self) -> None: ... - def parseline(self, line: str) -> Tuple[str | None, str | None, str]: ... + def parseline(self, line: str) -> tuple[str | None, str | None, str]: ... def onecmd(self, line: str) -> bool: ... def emptyline(self) -> bool: ... - def default(self, line: str) -> bool: ... + def default(self, line: str) -> None: ... def completedefault(self, *ignored: Any) -> list[str]: ... def completenames(self, text: str, *ignored: Any) -> list[str]: ... completion_matches: list[str] | None diff --git a/stdlib/code.pyi b/stdlib/code.pyi index ed00eaf..59318aa 100644 --- a/stdlib/code.pyi +++ b/stdlib/code.pyi @@ -1,6 +1,9 @@ from codeop import CommandCompiler +from collections.abc import Callable, Mapping from types import CodeType -from typing import Any, Callable, Mapping +from typing import Any + +__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact", "compile_command"] class InteractiveInterpreter: locals: Mapping[str, Any] # undocumented diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index 9f27cfe..cd6ac00 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -1,27 +1,92 @@ -import sys import types -from _typeshed import Self +from _codecs import * +from _typeshed import ReadableBuffer, Self from abc import abstractmethod -from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, TextIO, Tuple, Type, TypeVar, overload +from collections.abc import Callable, Generator, Iterable +from typing import Any, BinaryIO, Protocol, TextIO from typing_extensions import Literal +__all__ = [ + "register", + "lookup", + "open", + "EncodedFile", + "BOM", + "BOM_BE", + "BOM_LE", + "BOM32_BE", + "BOM32_LE", + "BOM64_BE", + "BOM64_LE", + "BOM_UTF8", + "BOM_UTF16", + "BOM_UTF16_LE", + "BOM_UTF16_BE", + "BOM_UTF32", + "BOM_UTF32_LE", + "BOM_UTF32_BE", + "CodecInfo", + "Codec", + "IncrementalEncoder", + "IncrementalDecoder", + "StreamReader", + "StreamWriter", + "StreamReaderWriter", + "StreamRecoder", + "getencoder", + "getdecoder", + "getincrementalencoder", + "getincrementaldecoder", + "getreader", + "getwriter", + "encode", + "decode", + "iterencode", + "iterdecode", + "strict_errors", + "ignore_errors", + "replace_errors", + "xmlcharrefreplace_errors", + "backslashreplace_errors", + "namereplace_errors", + "register_error", + "lookup_error", +] + +BOM32_BE: Literal[b"\xfe\xff"] +BOM32_LE: Literal[b"\xff\xfe"] +BOM64_BE: Literal[b"\x00\x00\xfe\xff"] +BOM64_LE: Literal[b"\xff\xfe\x00\x00"] + +class _WritableStream(Protocol): + def write(self, __data: bytes) -> object: ... + def seek(self, __offset: int, __whence: int) -> object: ... + def close(self) -> object: ... + +class _ReadableStream(Protocol): + def read(self, __size: int = ...) -> bytes: ... + def seek(self, __offset: int, __whence: int) -> object: ... + def close(self) -> object: ... + +class _Stream(_WritableStream, _ReadableStream, Protocol): ... + # TODO: this only satisfies the most common interface, where # bytes is the raw form and str is the cooked form. # In the long run, both should become template parameters maybe? # There *are* bytes->bytes and str->str encodings in the standard library. -# They are much more common in Python 2 than in Python 3. +# They were much more common in Python 2 than in Python 3. class _Encoder(Protocol): - def __call__(self, input: str, errors: str = ...) -> Tuple[bytes, int]: ... # signature of Codec().encode + def __call__(self, input: str, errors: str = ...) -> tuple[bytes, int]: ... # signature of Codec().encode class _Decoder(Protocol): - def __call__(self, input: bytes, errors: str = ...) -> Tuple[str, int]: ... # signature of Codec().decode + def __call__(self, input: bytes, errors: str = ...) -> tuple[str, int]: ... # signature of Codec().decode class _StreamReader(Protocol): - def __call__(self, stream: IO[bytes], errors: str = ...) -> StreamReader: ... + def __call__(self, stream: _ReadableStream, errors: str = ...) -> StreamReader: ... class _StreamWriter(Protocol): - def __call__(self, stream: IO[bytes], errors: str = ...) -> StreamWriter: ... + def __call__(self, stream: _WritableStream, errors: str = ...) -> StreamWriter: ... class _IncrementalEncoder(Protocol): def __call__(self, errors: str = ...) -> IncrementalEncoder: ... @@ -29,44 +94,7 @@ class _IncrementalEncoder(Protocol): class _IncrementalDecoder(Protocol): def __call__(self, errors: str = ...) -> IncrementalDecoder: ... -# The type ignore on `encode` and `decode` is to avoid issues with overlapping overloads, for more details, see #300 -# mypy and pytype disagree about where the type ignore can and cannot go, so alias the long type -_BytesToBytesEncodingT = Literal[ - "base64", - "base_64", - "base64_codec", - "bz2", - "bz2_codec", - "hex", - "hex_codec", - "quopri", - "quotedprintable", - "quoted_printable", - "quopri_codec", - "uu", - "uu_codec", - "zip", - "zlib", - "zlib_codec", -] - -@overload -def encode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... -@overload -def encode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... # type: ignore -@overload -def encode(obj: str, encoding: str = ..., errors: str = ...) -> bytes: ... -@overload -def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... # type: ignore -@overload -def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... -@overload -def decode(obj: bytes, encoding: str = ..., errors: str = ...) -> str: ... -def lookup(__encoding: str) -> CodecInfo: ... -def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: bool = ...) -> Tuple[str, int]: ... # undocumented -def utf_16_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... # undocumented - -class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): +class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): @property def encode(self) -> _Encoder: ... @property @@ -81,7 +109,7 @@ class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): def incrementaldecoder(self) -> _IncrementalDecoder: ... name: str def __new__( - cls, + cls: type[Self], encode: _Encoder, decode: _Decoder, streamreader: _StreamReader | None = ..., @@ -91,7 +119,7 @@ class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): name: str | None = ..., *, _is_text_encoding: bool | None = ..., - ) -> CodecInfo: ... + ) -> Self: ... def getencoder(encoding: str) -> _Encoder: ... def getdecoder(encoding: str) -> _Decoder: ... @@ -99,44 +127,36 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ... def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... def getreader(encoding: str) -> _StreamReader: ... def getwriter(encoding: str) -> _StreamWriter: ... -def register(__search_function: Callable[[str], CodecInfo | None]) -> None: ... def open( filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., buffering: int = ... ) -> StreamReaderWriter: ... -def EncodedFile(file: IO[bytes], data_encoding: str, file_encoding: str | None = ..., errors: str = ...) -> StreamRecoder: ... +def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = ..., errors: str = ...) -> StreamRecoder: ... def iterencode(iterator: Iterable[str], encoding: str, errors: str = ...) -> Generator[bytes, None, None]: ... def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = ...) -> Generator[str, None, None]: ... -if sys.version_info >= (3, 10): - def unregister(__search_function: Callable[[str], CodecInfo | None]) -> None: ... - -BOM: bytes -BOM_BE: bytes -BOM_LE: bytes -BOM_UTF8: bytes -BOM_UTF16: bytes -BOM_UTF16_BE: bytes -BOM_UTF16_LE: bytes -BOM_UTF32: bytes -BOM_UTF32_BE: bytes -BOM_UTF32_LE: bytes +BOM: Literal[b"\xff\xfe", b"\xfe\xff"] # depends on `sys.byteorder` +BOM_BE: Literal[b"\xfe\xff"] +BOM_LE: Literal[b"\xff\xfe"] +BOM_UTF8: Literal[b"\xef\xbb\xbf"] +BOM_UTF16: Literal[b"\xff\xfe", b"\xfe\xff"] # depends on `sys.byteorder` +BOM_UTF16_BE: Literal[b"\xfe\xff"] +BOM_UTF16_LE: Literal[b"\xff\xfe"] +BOM_UTF32: Literal[b"\xff\xfe\x00\x00", b"\x00\x00\xfe\xff"] # depends on `sys.byteorder` +BOM_UTF32_BE: Literal[b"\x00\x00\xfe\xff"] +BOM_UTF32_LE: Literal[b"\xff\xfe\x00\x00"] -# It is expected that different actions be taken depending on which of the -# three subclasses of `UnicodeError` is actually ...ed. However, the Union -# is still needed for at least one of the cases. -def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[str | bytes, int]]) -> None: ... -def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[str | bytes, int]]: ... -def strict_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def replace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def ignore_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... -def backslashreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ... +def strict_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def replace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def ignore_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def xmlcharrefreplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def backslashreplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... +def namereplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... class Codec: # These are sort of @abstractmethod but sort of not. # The StreamReader and StreamWriter subclasses only implement one. - def encode(self, input: str, errors: str = ...) -> Tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = ...) -> Tuple[str, int]: ... + def encode(self, input: str, errors: str = ...) -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = ...) -> tuple[str, int]: ... class IncrementalEncoder: errors: str @@ -152,10 +172,10 @@ class IncrementalDecoder: errors: str def __init__(self, errors: str = ...) -> None: ... @abstractmethod - def decode(self, input: bytes, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ... def reset(self) -> None: ... - def getstate(self) -> Tuple[bytes, int]: ... - def setstate(self, state: Tuple[bytes, int]) -> None: ... + def getstate(self) -> tuple[bytes, int]: ... + def setstate(self, state: tuple[bytes, int]) -> None: ... # These are not documented but used in encodings/*.py implementations. class BufferedIncrementalEncoder(IncrementalEncoder): @@ -169,52 +189,52 @@ class BufferedIncrementalDecoder(IncrementalDecoder): buffer: bytes def __init__(self, errors: str = ...) -> None: ... @abstractmethod - def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[str, int]: ... - def decode(self, input: bytes, final: bool = ...) -> str: ... + def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ... # TODO: it is not possible to specify the requirement that all other # attributes and methods are passed-through from the stream. class StreamWriter(Codec): + stream: _WritableStream errors: str - def __init__(self, stream: IO[bytes], errors: str = ...) -> None: ... + def __init__(self, stream: _WritableStream, errors: str = ...) -> None: ... def write(self, object: str) -> None: ... def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ... class StreamReader(Codec): + stream: _ReadableStream errors: str - def __init__(self, stream: IO[bytes], errors: str = ...) -> None: ... + def __init__(self, stream: _ReadableStream, errors: str = ...) -> None: ... def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> str: ... def readline(self, size: int | None = ..., keepends: bool = ...) -> str: ... def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> list[str]: ... def reset(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... - def __iter__(self) -> Iterator[str]: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> str: ... def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ... -_T = TypeVar("_T", bound=StreamReaderWriter) - # Doesn't actually inherit from TextIO, but wraps a BinaryIO to provide text reading and writing # and delegates attributes to the underlying binary stream with __getattr__. class StreamReaderWriter(TextIO): - def __init__(self, stream: IO[bytes], Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ... + stream: _Stream + def __init__(self, stream: _Stream, Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ... def read(self, size: int = ...) -> str: ... def readline(self, size: int | None = ...) -> str: ... def readlines(self, sizehint: int | None = ...) -> list[str]: ... def __next__(self) -> str: ... - def __iter__(self: _T) -> _T: ... - # This actually returns None, but that's incompatible with the supertype - def write(self, data: str) -> int: ... + def __iter__(self: Self) -> Self: ... + def write(self, data: str) -> None: ... # type: ignore[override] def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... - # Same as write() - def seek(self, offset: int, whence: int = ...) -> int: ... + def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override] def __enter__(self: Self) -> Self: ... - def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str) -> Any: ... # These methods don't actually exist directly, but they are needed to satisfy the TextIO # interface. At runtime, they are delegated through __getattr__. @@ -228,32 +248,24 @@ class StreamReaderWriter(TextIO): def tell(self) -> int: ... def writable(self) -> bool: ... -_SRT = TypeVar("_SRT", bound=StreamRecoder) - class StreamRecoder(BinaryIO): def __init__( - self, - stream: IO[bytes], - encode: _Encoder, - decode: _Decoder, - Reader: _StreamReader, - Writer: _StreamWriter, - errors: str = ..., + self, stream: _Stream, encode: _Encoder, decode: _Decoder, Reader: _StreamReader, Writer: _StreamWriter, errors: str = ... ) -> None: ... def read(self, size: int = ...) -> bytes: ... def readline(self, size: int | None = ...) -> bytes: ... def readlines(self, sizehint: int | None = ...) -> list[bytes]: ... def __next__(self) -> bytes: ... - def __iter__(self: _SRT) -> _SRT: ... - def write(self, data: bytes) -> int: ... - def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore # it's supposed to return None + def __iter__(self: Self) -> Self: ... + def write(self, data: bytes) -> None: ... # type: ignore[override] + def writelines(self, list: Iterable[bytes]) -> None: ... def reset(self) -> None: ... def __getattr__(self, name: str) -> Any: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... + def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override] # These methods don't actually exist directly, but they are needed to satisfy the BinaryIO # interface. At runtime, they are delegated through __getattr__. - def seek(self, offset: int, whence: int = ...) -> int: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... diff --git a/stdlib/codeop.pyi b/stdlib/codeop.pyi index 8ed5710..36af1d2 100644 --- a/stdlib/codeop.pyi +++ b/stdlib/codeop.pyi @@ -1,13 +1,13 @@ from types import CodeType +__all__ = ["compile_command", "Compile", "CommandCompiler"] + def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... class Compile: flags: int - def __init__(self) -> None: ... def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ... class CommandCompiler: compiler: Compile - def __init__(self) -> None: ... def __call__(self, source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 2aa0bf7..37505c2 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -1,115 +1,176 @@ import sys -from _typeshed import Self -from builtins import _dict_items, _dict_keys, _dict_values -from typing import Any, Dict, Generic, NoReturn, Tuple, Type, TypeVar, overload +from _collections_abc import dict_items, dict_keys, dict_values +from _typeshed import Self, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT +from typing import Any, Generic, NoReturn, TypeVar, overload +from typing_extensions import SupportsIndex, final + +if sys.version_info >= (3, 9): + from types import GenericAlias if sys.version_info >= (3, 10): - from typing import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Reversible, Sequence + from collections.abc import ( + Callable, + ItemsView, + Iterable, + Iterator, + KeysView, + Mapping, + MutableMapping, + MutableSequence, + Reversible, + Sequence, + ValuesView, + ) else: from _collections_abc import * +__all__ = ["ChainMap", "Counter", "OrderedDict", "UserDict", "UserList", "UserString", "defaultdict", "deque", "namedtuple"] + _S = TypeVar("_S") _T = TypeVar("_T") +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") _KT = TypeVar("_KT") _VT = TypeVar("_VT") _KT_co = TypeVar("_KT_co", covariant=True) _VT_co = TypeVar("_VT_co", covariant=True) # namedtuple is special-cased in the type checker; the initializer is ignored. -if sys.version_info >= (3, 7): - def namedtuple( - typename: str, - field_names: str | Iterable[str], - *, - rename: bool = ..., - module: str | None = ..., - defaults: Iterable[Any] | None = ..., - ) -> Type[Tuple[Any, ...]]: ... - -else: - def namedtuple( - typename: str, field_names: str | Iterable[str], *, verbose: bool = ..., rename: bool = ..., module: str | None = ... - ) -> Type[Tuple[Any, ...]]: ... +def namedtuple( + typename: str, + field_names: str | Iterable[str], + *, + rename: bool = ..., + module: str | None = ..., + defaults: Iterable[Any] | None = ..., +) -> type[tuple[Any, ...]]: ... -class UserDict(MutableMapping[_KT, _VT]): +class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): data: dict[_KT, _VT] - def __init__(self, __dict: Mapping[_KT, _VT] | None = ..., **kwargs: _VT) -> None: ... + # __init__ should be kept roughly in line with `dict.__init__`, which has the same semantics + @overload + def __init__(self, __dict: None = ...) -> None: ... + @overload + def __init__(self: UserDict[str, _VT], __dict: None = ..., **kwargs: _VT) -> None: ... + @overload + def __init__(self, __dict: SupportsKeysAndGetItem[_KT, _VT]) -> None: ... + @overload + def __init__(self: UserDict[str, _VT], __dict: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> None: ... + @overload + def __init__(self, __iterable: Iterable[tuple[_KT, _VT]]) -> None: ... + @overload + def __init__(self: UserDict[str, _VT], __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> None: ... + @overload + def __init__(self: UserDict[str, str], __iterable: Iterable[list[str]]) -> None: ... def __len__(self) -> int: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, item: _VT) -> None: ... def __delitem__(self, key: _KT) -> None: ... def __iter__(self) -> Iterator[_KT]: ... def __contains__(self, key: object) -> bool: ... - def copy(self: _S) -> _S: ... + def copy(self: Self) -> Self: ... + def __copy__(self: Self) -> Self: ... + + # `UserDict.fromkeys` has the same semantics as `dict.fromkeys`, so should be kept in line with `dict.fromkeys`. + # TODO: Much like `dict.fromkeys`, the true signature of `UserDict.fromkeys` is inexpressible in the current type system. + # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @classmethod - def fromkeys(cls: Type[_S], iterable: Iterable[_KT], value: _VT | None = ...) -> _S: ... + @overload + def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> UserDict[_T, Any | None]: ... + @classmethod + @overload + def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ... + if sys.version_info >= (3, 9): + def __or__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ... + def __ror__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc] + # UserDict.__ior__ should be kept roughly in line with MutableMapping.update() + @overload # type: ignore[misc] + def __ior__(self: Self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... + @overload + def __ior__(self: Self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... class UserList(MutableSequence[_T]): data: list[_T] - def __init__(self, initlist: Iterable[_T] | None = ...) -> None: ... - def __lt__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... + @overload + def __init__(self, initlist: None = ...) -> None: ... + @overload + def __init__(self, initlist: Iterable[_T]) -> None: ... + def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ... + def __le__(self, other: list[_T] | UserList[_T]) -> bool: ... + def __gt__(self, other: list[_T] | UserList[_T]) -> bool: ... + def __ge__(self, other: list[_T] | UserList[_T]) -> bool: ... + def __eq__(self, other: object) -> bool: ... def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... @overload - def __getitem__(self, i: int) -> _T: ... + def __getitem__(self, i: SupportsIndex) -> _T: ... @overload def __getitem__(self: Self, i: slice) -> Self: ... @overload - def __setitem__(self, i: int, o: _T) -> None: ... + def __setitem__(self, i: SupportsIndex, item: _T) -> None: ... @overload - def __setitem__(self, i: slice, o: Iterable[_T]) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... - def __add__(self: _S, other: Iterable[_T]) -> _S: ... - def __iadd__(self: _S, other: Iterable[_T]) -> _S: ... - def __mul__(self: _S, n: int) -> _S: ... - def __imul__(self: _S, n: int) -> _S: ... + def __setitem__(self, i: slice, item: Iterable[_T]) -> None: ... + def __delitem__(self, i: SupportsIndex | slice) -> None: ... + def __add__(self: Self, other: Iterable[_T]) -> Self: ... + def __radd__(self: Self, other: Iterable[_T]) -> Self: ... + def __iadd__(self: Self, other: Iterable[_T]) -> Self: ... + def __mul__(self: Self, n: int) -> Self: ... + def __rmul__(self: Self, n: int) -> Self: ... + def __imul__(self: Self, n: int) -> Self: ... def append(self, item: _T) -> None: ... def insert(self, i: int, item: _T) -> None: ... def pop(self, i: int = ...) -> _T: ... def remove(self, item: _T) -> None: ... - def clear(self) -> None: ... - def copy(self: _S) -> _S: ... + def copy(self: Self) -> Self: ... + def __copy__(self: Self) -> Self: ... def count(self, item: _T) -> int: ... - def index(self, item: _T, *args: Any) -> int: ... - def reverse(self) -> None: ... - def sort(self, *args: Any, **kwds: Any) -> None: ... + # All arguments are passed to `list.index` at runtime, so the signature should be kept in line with `list.index`. + def index(self, item: _T, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ... + # All arguments are passed to `list.sort` at runtime, so the signature should be kept in line with `list.sort`. + @overload + def sort(self: UserList[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...) -> None: ... + @overload + def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ... def extend(self, other: Iterable[_T]) -> None: ... -_UserStringT = TypeVar("_UserStringT", bound=UserString) - -class UserString(Sequence[str]): +class UserString(Sequence[UserString]): data: str def __init__(self, seq: object) -> None: ... def __int__(self) -> int: ... def __float__(self) -> float: ... def __complex__(self) -> complex: ... - def __getnewargs__(self) -> Tuple[str]: ... + def __getnewargs__(self) -> tuple[str]: ... def __lt__(self, string: str | UserString) -> bool: ... def __le__(self, string: str | UserString) -> bool: ... def __gt__(self, string: str | UserString) -> bool: ... def __ge__(self, string: str | UserString) -> bool: ... + def __eq__(self, string: object) -> bool: ... def __contains__(self, char: object) -> bool: ... def __len__(self) -> int: ... - # It should return a str to implement Sequence correctly, but it doesn't. - def __getitem__(self: _UserStringT, i: int | slice) -> _UserStringT: ... # type: ignore - def __iter__(self: _UserStringT) -> Iterator[_UserStringT]: ... # type: ignore - def __reversed__(self: _UserStringT) -> Iterator[_UserStringT]: ... # type: ignore - def __add__(self: _UserStringT, other: object) -> _UserStringT: ... - def __mul__(self: _UserStringT, n: int) -> _UserStringT: ... - def __mod__(self: _UserStringT, args: Any) -> _UserStringT: ... - def capitalize(self: _UserStringT) -> _UserStringT: ... - def casefold(self: _UserStringT) -> _UserStringT: ... - def center(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... + def __getitem__(self: Self, index: SupportsIndex | slice) -> Self: ... + def __iter__(self: Self) -> Iterator[Self]: ... + def __reversed__(self: Self) -> Iterator[Self]: ... + def __add__(self: Self, other: object) -> Self: ... + def __radd__(self: Self, other: object) -> Self: ... + def __mul__(self: Self, n: int) -> Self: ... + def __rmul__(self: Self, n: int) -> Self: ... + def __mod__(self: Self, args: Any) -> Self: ... + if sys.version_info >= (3, 8): + def __rmod__(self: Self, template: object) -> Self: ... + else: + def __rmod__(self: Self, format: Any) -> Self: ... + + def capitalize(self: Self) -> Self: ... + def casefold(self: Self) -> Self: ... + def center(self: Self, width: int, *args: Any) -> Self: ... def count(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... if sys.version_info >= (3, 8): def encode(self: UserString, encoding: str | None = ..., errors: str | None = ...) -> bytes: ... else: - def encode(self: _UserStringT, encoding: str | None = ..., errors: str | None = ...) -> _UserStringT: ... - def endswith(self, suffix: str | Tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... - def expandtabs(self: _UserStringT, tabsize: int = ...) -> _UserStringT: ... + def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ... + + def endswith(self, suffix: str | tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... + def expandtabs(self: Self, tabsize: int = ...) -> Self: ... def find(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... def format(self, *args: Any, **kwds: Any) -> str: ... def format_map(self, mapping: Mapping[str, Any]) -> str: ... @@ -125,158 +186,213 @@ class UserString(Sequence[str]): def isspace(self) -> bool: ... def istitle(self) -> bool: ... def isupper(self) -> bool: ... + def isascii(self) -> bool: ... def join(self, seq: Iterable[str]) -> str: ... - def ljust(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... - def lower(self: _UserStringT) -> _UserStringT: ... - def lstrip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ... + def ljust(self: Self, width: int, *args: Any) -> Self: ... + def lower(self: Self) -> Self: ... + def lstrip(self: Self, chars: str | None = ...) -> Self: ... @staticmethod @overload def maketrans(x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ... @staticmethod @overload def maketrans(x: str, y: str, z: str = ...) -> dict[int, int | None]: ... - def partition(self, sep: str) -> Tuple[str, str, str]: ... + def partition(self, sep: str) -> tuple[str, str, str]: ... if sys.version_info >= (3, 9): - def removeprefix(self: _UserStringT, __prefix: str | UserString) -> _UserStringT: ... - def removesuffix(self: _UserStringT, __suffix: str | UserString) -> _UserStringT: ... - def replace(self: _UserStringT, old: str | UserString, new: str | UserString, maxsplit: int = ...) -> _UserStringT: ... + def removeprefix(self: Self, __prefix: str | UserString) -> Self: ... + def removesuffix(self: Self, __suffix: str | UserString) -> Self: ... + + def replace(self: Self, old: str | UserString, new: str | UserString, maxsplit: int = ...) -> Self: ... def rfind(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... def rindex(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... - def rjust(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... - def rpartition(self, sep: str) -> Tuple[str, str, str]: ... - def rstrip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ... + def rjust(self: Self, width: int, *args: Any) -> Self: ... + def rpartition(self, sep: str) -> tuple[str, str, str]: ... + def rstrip(self: Self, chars: str | None = ...) -> Self: ... def split(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... def splitlines(self, keepends: bool = ...) -> list[str]: ... - def startswith(self, prefix: str | Tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... - def strip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ... - def swapcase(self: _UserStringT) -> _UserStringT: ... - def title(self: _UserStringT) -> _UserStringT: ... - def translate(self: _UserStringT, *args: Any) -> _UserStringT: ... - def upper(self: _UserStringT) -> _UserStringT: ... - def zfill(self: _UserStringT, width: int) -> _UserStringT: ... + def startswith(self, prefix: str | tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... + def strip(self: Self, chars: str | None = ...) -> Self: ... + def swapcase(self: Self) -> Self: ... + def title(self: Self) -> Self: ... + def translate(self: Self, *args: Any) -> Self: ... + def upper(self: Self) -> Self: ... + def zfill(self: Self, width: int) -> Self: ... class deque(MutableSequence[_T], Generic[_T]): @property def maxlen(self) -> int | None: ... - def __init__(self, iterable: Iterable[_T] = ..., maxlen: int | None = ...) -> None: ... - def append(self, x: _T) -> None: ... - def appendleft(self, x: _T) -> None: ... - def clear(self) -> None: ... - def copy(self) -> deque[_T]: ... - def count(self, x: _T) -> int: ... - def extend(self, iterable: Iterable[_T]) -> None: ... - def extendleft(self, iterable: Iterable[_T]) -> None: ... - def insert(self, i: int, x: _T) -> None: ... - def index(self, x: _T, start: int = ..., stop: int = ...) -> int: ... - def pop(self) -> _T: ... # type: ignore - def popleft(self) -> _T: ... - def remove(self, value: _T) -> None: ... - def reverse(self) -> None: ... - def rotate(self, n: int = ...) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[_T]: ... - def __str__(self) -> str: ... - # These methods of deque don't really take slices, but we need to - # define them as taking a slice to satisfy MutableSequence. - @overload - def __getitem__(self, index: int) -> _T: ... - @overload - def __getitem__(self, s: slice) -> MutableSequence[_T]: ... @overload - def __setitem__(self, i: int, x: _T) -> None: ... + def __init__(self, *, maxlen: int | None = ...) -> None: ... @overload - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... - @overload - def __delitem__(self, i: int) -> None: ... - @overload - def __delitem__(self, s: slice) -> None: ... - def __contains__(self, o: object) -> bool: ... - def __reversed__(self) -> Iterator[_T]: ... - def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ... - def __add__(self, other: deque[_T]) -> deque[_T]: ... - def __mul__(self, other: int) -> deque[_T]: ... - def __imul__(self, other: int) -> None: ... + def __init__(self, iterable: Iterable[_T], maxlen: int | None = ...) -> None: ... + def append(self, __x: _T) -> None: ... + def appendleft(self, __x: _T) -> None: ... + def copy(self: Self) -> Self: ... + def count(self, __x: _T) -> int: ... + def extend(self, __iterable: Iterable[_T]) -> None: ... + def extendleft(self, __iterable: Iterable[_T]) -> None: ... + def insert(self, __i: int, __x: _T) -> None: ... + def index(self, __x: _T, __start: int = ..., __stop: int = ...) -> int: ... + def pop(self) -> _T: ... # type: ignore[override] + def popleft(self) -> _T: ... + def remove(self, __value: _T) -> None: ... + def rotate(self, __n: int = ...) -> None: ... + def __copy__(self: Self) -> Self: ... + def __len__(self) -> int: ... + # These methods of deque don't take slices, unlike MutableSequence, hence the type: ignores + def __getitem__(self, __index: SupportsIndex) -> _T: ... # type: ignore[override] + def __setitem__(self, __i: SupportsIndex, __x: _T) -> None: ... # type: ignore[override] + def __delitem__(self, __i: SupportsIndex) -> None: ... # type: ignore[override] + def __contains__(self, __o: object) -> bool: ... + def __reduce__(self: Self) -> tuple[type[Self], tuple[()], None, Iterator[_T]]: ... + def __iadd__(self: Self, __iterable: Iterable[_T]) -> Self: ... + def __add__(self: Self, __other: Self) -> Self: ... + def __mul__(self: Self, __other: int) -> Self: ... + def __imul__(self: Self, __other: int) -> Self: ... + def __lt__(self, __other: deque[_T]) -> bool: ... + def __le__(self, __other: deque[_T]) -> bool: ... + def __gt__(self, __other: deque[_T]) -> bool: ... + def __ge__(self, __other: deque[_T]) -> bool: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... -class Counter(Dict[_T, int], Generic[_T]): +class Counter(dict[_T, int], Generic[_T]): + @overload + def __init__(self, __iterable: None = ...) -> None: ... @overload - def __init__(self, __iterable: None = ..., **kwargs: int) -> None: ... + def __init__(self: Counter[str], __iterable: None = ..., **kwargs: int) -> None: ... @overload - def __init__(self, __mapping: Mapping[_T, int]) -> None: ... + def __init__(self, __mapping: SupportsKeysAndGetItem[_T, int]) -> None: ... @overload def __init__(self, __iterable: Iterable[_T]) -> None: ... - def copy(self: _S) -> _S: ... + def copy(self: Self) -> Self: ... def elements(self) -> Iterator[_T]: ... - def most_common(self, n: int | None = ...) -> list[Tuple[_T, int]]: ... + def most_common(self, n: int | None = ...) -> list[tuple[_T, int]]: ... @classmethod - def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore + def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore[override] @overload def subtract(self, __iterable: None = ...) -> None: ... @overload def subtract(self, __mapping: Mapping[_T, int]) -> None: ... @overload def subtract(self, __iterable: Iterable[_T]) -> None: ... - # The Iterable[Tuple[...]] argument type is not actually desirable - # (the tuples will be added as keys, breaking type safety) but - # it's included so that the signature is compatible with - # Dict.update. Not sure if we should use '# type: ignore' instead - # and omit the type from the union. - @overload + # Unlike dict.update(), use Mapping instead of SupportsKeysAndGetItem for the first overload + # (source code does an `isinstance(other, Mapping)` check) + # + # The second overload is also deliberately different to dict.update() + # (if it were `Iterable[_T] | Iterable[tuple[_T, int]]`, + # the tuples would be added as keys, breaking type safety) + @overload # type: ignore[override] def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ... @overload - def update(self, __m: Iterable[_T] | Iterable[Tuple[_T, int]], **kwargs: int) -> None: ... + def update(self, __m: Iterable[_T], **kwargs: int) -> None: ... @overload def update(self, __m: None = ..., **kwargs: int) -> None: ... - def __add__(self, other: Counter[_T]) -> Counter[_T]: ... + def __missing__(self, key: _T) -> int: ... + def __delitem__(self, elem: object) -> None: ... + if sys.version_info >= (3, 10): + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + + def __add__(self, other: Counter[_S]) -> Counter[_T | _S]: ... def __sub__(self, other: Counter[_T]) -> Counter[_T]: ... def __and__(self, other: Counter[_T]) -> Counter[_T]: ... - def __or__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore + def __or__(self, other: Counter[_S]) -> Counter[_T | _S]: ... # type: ignore[override] def __pos__(self) -> Counter[_T]: ... def __neg__(self) -> Counter[_T]: ... - def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ... - def __isub__(self, other: Counter[_T]) -> Counter[_T]: ... - def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... - def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore + # several type: ignores because __iadd__ is supposedly incompatible with __add__, etc. + def __iadd__(self: Self, other: Counter[_T]) -> Self: ... # type: ignore[misc] + def __isub__(self: Self, other: Counter[_T]) -> Self: ... + def __iand__(self: Self, other: Counter[_T]) -> Self: ... + def __ior__(self: Self, other: Counter[_T]) -> Self: ... # type: ignore[override,misc] + if sys.version_info >= (3, 10): + def total(self) -> int: ... + def __le__(self, other: Counter[Any]) -> bool: ... + def __lt__(self, other: Counter[Any]) -> bool: ... + def __ge__(self, other: Counter[Any]) -> bool: ... + def __gt__(self, other: Counter[Any]) -> bool: ... -class _OrderedDictKeysView(_dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): +# The pure-Python implementations of the "views" classes +# These are exposed at runtime in `collections/__init__.py` +class _OrderedDictKeysView(KeysView[_KT_co], Reversible[_KT_co]): def __reversed__(self) -> Iterator[_KT_co]: ... -class _OrderedDictItemsView(_dict_items[_KT_co, _VT_co], Reversible[Tuple[_KT_co, _VT_co]]): - def __reversed__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ... +class _OrderedDictItemsView(ItemsView[_KT_co, _VT_co], Reversible[tuple[_KT_co, _VT_co]]): + def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... -# The generics are the wrong way around because of a mypy limitation -# https://github.com/python/mypy/issues/11138 -class _OrderedDictValuesView(_dict_values[_VT_co, _KT_co], Reversible[_VT_co], Generic[_VT_co, _KT_co]): +class _OrderedDictValuesView(ValuesView[_VT_co], Reversible[_VT_co]): def __reversed__(self) -> Iterator[_VT_co]: ... -class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): - def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ... +# The C implementations of the "views" classes +# (At runtime, these are called `odict_keys`, `odict_items` and `odict_values`, +# but they are not exposed anywhere) +@final +class _odict_keys(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] + def __reversed__(self) -> Iterator[_KT_co]: ... + +@final +class _odict_items(dict_items[_KT_co, _VT_co], Reversible[tuple[_KT_co, _VT_co]]): # type: ignore[misc] + def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... + +@final +class _odict_values(dict_values[_KT_co, _VT_co], Reversible[_VT_co], Generic[_KT_co, _VT_co]): # type: ignore[misc] + def __reversed__(self) -> Iterator[_VT_co]: ... + +class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): + def popitem(self, last: bool = ...) -> tuple[_KT, _VT]: ... def move_to_end(self, key: _KT, last: bool = ...) -> None: ... - def copy(self: _S) -> _S: ... + def copy(self: Self) -> Self: ... def __reversed__(self) -> Iterator[_KT]: ... - def keys(self) -> _OrderedDictKeysView[_KT, _VT]: ... - def items(self) -> _OrderedDictItemsView[_KT, _VT]: ... - def values(self) -> _OrderedDictValuesView[_VT, _KT]: ... + def keys(self) -> _odict_keys[_KT, _VT]: ... + def items(self) -> _odict_items[_KT, _VT]: ... + def values(self) -> _odict_values[_KT, _VT]: ... + # The signature of OrderedDict.fromkeys should be kept in line with `dict.fromkeys`, modulo positional-only differences. + # Like dict.fromkeys, its true signature is not expressible in the current type system. + # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. + @classmethod + @overload + def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> OrderedDict[_T, Any | None]: ... + @classmethod + @overload + def fromkeys(cls, iterable: Iterable[_T], value: _S) -> OrderedDict[_T, _S]: ... + # Keep OrderedDict.setdefault in line with MutableMapping.setdefault, modulo positional-only differences. + @overload + def setdefault(self: OrderedDict[_KT, _T | None], key: _KT) -> _T | None: ... + @overload + def setdefault(self, key: _KT, default: _VT) -> _VT: ... -class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): +class defaultdict(dict[_KT, _VT], Generic[_KT, _VT]): default_factory: Callable[[], _VT] | None @overload - def __init__(self, **kwargs: _VT) -> None: ... + def __init__(self) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None) -> None: ... + def __init__(self: defaultdict[str, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, **kwargs: _VT) -> None: ... + def __init__(self, __default_factory: Callable[[], _VT] | None) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT]) -> None: ... + def __init__(self: defaultdict[str, _VT], __default_factory: Callable[[], _VT] | None, **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... + def __init__(self, __default_factory: Callable[[], _VT] | None, __map: SupportsKeysAndGetItem[_KT, _VT]) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... + def __init__( + self: defaultdict[str, _VT], + __default_factory: Callable[[], _VT] | None, + __map: SupportsKeysAndGetItem[str, _VT], + **kwargs: _VT, + ) -> None: ... @overload - def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __missing__(self, key: _KT) -> _VT: ... - # TODO __reversed__ - def copy(self: _S) -> _S: ... + def __init__(self, __default_factory: Callable[[], _VT] | None, __iterable: Iterable[tuple[_KT, _VT]]) -> None: ... + @overload + def __init__( + self: defaultdict[str, _VT], + __default_factory: Callable[[], _VT] | None, + __iterable: Iterable[tuple[str, _VT]], + **kwargs: _VT, + ) -> None: ... + def __missing__(self, __key: _KT) -> _VT: ... + def __copy__(self: Self) -> Self: ... + def copy(self: Self) -> Self: ... class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): maps: list[MutableMapping[_KT, _VT]] @@ -284,9 +400,33 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def new_child(self: Self, m: MutableMapping[_KT, _VT] | None = ...) -> Self: ... @property def parents(self: Self) -> Self: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __getitem__(self, k: _KT) -> _VT: ... + def __setitem__(self, key: _KT, value: _VT) -> None: ... + def __delitem__(self, key: _KT) -> None: ... + def __getitem__(self, key: _KT) -> _VT: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... + def __contains__(self, key: object) -> bool: ... def __missing__(self, key: _KT) -> _VT: ... # undocumented + def __bool__(self) -> bool: ... + def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + @overload + def pop(self, key: _KT) -> _VT: ... + @overload + def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ... + def copy(self: Self) -> Self: ... + __copy__ = copy + # All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime, so the signature should be kept in line with `dict.fromkeys`. + @classmethod + @overload + def fromkeys(cls, iterable: Iterable[_T], __value: None = ...) -> ChainMap[_T, Any | None]: ... + @classmethod + @overload + def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> ChainMap[_T, _S]: ... + if sys.version_info >= (3, 9): + def __or__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ... + def __ror__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ... + # ChainMap.__ior__ should be kept roughly in line with MutableMapping.update() + @overload # type: ignore[misc] + def __ior__(self: Self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... + @overload + def __ior__(self: Self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... diff --git a/stdlib/colorsys.pyi b/stdlib/colorsys.pyi index 8db2e2c..443ee82 100644 --- a/stdlib/colorsys.pyi +++ b/stdlib/colorsys.pyi @@ -1,11 +1,11 @@ -from typing import Tuple +__all__ = ["rgb_to_yiq", "yiq_to_rgb", "rgb_to_hls", "hls_to_rgb", "rgb_to_hsv", "hsv_to_rgb"] -def rgb_to_yiq(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def yiq_to_rgb(y: float, i: float, q: float) -> Tuple[float, float, float]: ... -def rgb_to_hls(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def hls_to_rgb(h: float, l: float, s: float) -> Tuple[float, float, float]: ... -def rgb_to_hsv(r: float, g: float, b: float) -> Tuple[float, float, float]: ... -def hsv_to_rgb(h: float, s: float, v: float) -> Tuple[float, float, float]: ... +def rgb_to_yiq(r: float, g: float, b: float) -> tuple[float, float, float]: ... +def yiq_to_rgb(y: float, i: float, q: float) -> tuple[float, float, float]: ... +def rgb_to_hls(r: float, g: float, b: float) -> tuple[float, float, float]: ... +def hls_to_rgb(h: float, l: float, s: float) -> tuple[float, float, float]: ... +def rgb_to_hsv(r: float, g: float, b: float) -> tuple[float, float, float]: ... +def hsv_to_rgb(h: float, s: float, v: float) -> tuple[float, float, float]: ... # TODO undocumented ONE_SIXTH: float diff --git a/stdlib/compileall.pyi b/stdlib/compileall.pyi index 64b4dc2..dd1de3f 100644 --- a/stdlib/compileall.pyi +++ b/stdlib/compileall.pyi @@ -1,9 +1,9 @@ import sys from _typeshed import StrPath +from py_compile import PycInvalidationMode from typing import Any, Protocol -if sys.version_info >= (3, 7): - from py_compile import PycInvalidationMode +__all__ = ["compile_dir", "compile_file", "compile_path"] class _SupportsSearch(Protocol): def search(self, string: str) -> Any: ... @@ -42,30 +42,6 @@ if sys.version_info >= (3, 9): hardlink_dupes: bool = ..., ) -> int: ... -elif sys.version_info >= (3, 7): - def compile_dir( - dir: StrPath, - maxlevels: int = ..., - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., - optimize: int = ..., - workers: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., - ) -> int: ... - def compile_file( - fullname: StrPath, - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., - optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., - ) -> int: ... - else: def compile_dir( dir: StrPath, @@ -77,6 +53,7 @@ else: legacy: bool = ..., optimize: int = ..., workers: int = ..., + invalidation_mode: PycInvalidationMode | None = ..., ) -> int: ... def compile_file( fullname: StrPath, @@ -86,25 +63,15 @@ else: quiet: int = ..., legacy: bool = ..., optimize: int = ..., - ) -> int: ... - -if sys.version_info >= (3, 7): - def compile_path( - skip_curdir: bool = ..., - maxlevels: int = ..., - force: bool = ..., - quiet: int = ..., - legacy: bool = ..., - optimize: int = ..., invalidation_mode: PycInvalidationMode | None = ..., ) -> int: ... -else: - def compile_path( - skip_curdir: bool = ..., - maxlevels: int = ..., - force: bool = ..., - quiet: int = ..., - legacy: bool = ..., - optimize: int = ..., - ) -> int: ... +def compile_path( + skip_curdir: bool = ..., + maxlevels: int = ..., + force: bool = ..., + quiet: int = ..., + legacy: bool = ..., + optimize: int = ..., + invalidation_mode: PycInvalidationMode | None = ..., +) -> int: ... diff --git a/stdlib/concurrent/futures/__init__.pyi b/stdlib/concurrent/futures/__init__.pyi index f3b54e5..ff2e72b 100644 --- a/stdlib/concurrent/futures/__init__.pyi +++ b/stdlib/concurrent/futures/__init__.pyi @@ -4,6 +4,7 @@ from ._base import ( ALL_COMPLETED as ALL_COMPLETED, FIRST_COMPLETED as FIRST_COMPLETED, FIRST_EXCEPTION as FIRST_EXCEPTION, + BrokenExecutor as BrokenExecutor, CancelledError as CancelledError, Executor as Executor, Future as Future, @@ -16,5 +17,20 @@ from .thread import ThreadPoolExecutor as ThreadPoolExecutor if sys.version_info >= (3, 8): from ._base import InvalidStateError as InvalidStateError -if sys.version_info >= (3, 7): - from ._base import BrokenExecutor as BrokenExecutor + +__all__ = ( + "FIRST_COMPLETED", + "FIRST_EXCEPTION", + "ALL_COMPLETED", + "CancelledError", + "TimeoutError", + "BrokenExecutor", + "Future", + "Executor", + "wait", + "as_completed", + "ProcessPoolExecutor", + "ThreadPoolExecutor", +) + +def __dir__() -> tuple[str, ...]: ... diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index fd73334..3db9688 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -1,22 +1,23 @@ import sys import threading from _typeshed import Self -from abc import abstractmethod -from collections.abc import Container, Iterable, Iterator, Sequence +from collections.abc import Callable, Iterable, Iterator, Sequence from logging import Logger -from typing import Any, Callable, Generic, Protocol, Set, TypeVar, overload +from types import TracebackType +from typing import Any, Generic, TypeVar, overload +from typing_extensions import Literal, ParamSpec, SupportsIndex if sys.version_info >= (3, 9): from types import GenericAlias -FIRST_COMPLETED: str -FIRST_EXCEPTION: str -ALL_COMPLETED: str -PENDING: str -RUNNING: str -CANCELLED: str -CANCELLED_AND_NOTIFIED: str -FINISHED: str +FIRST_COMPLETED: Literal["FIRST_COMPLETED"] +FIRST_EXCEPTION: Literal["FIRST_EXCEPTION"] +ALL_COMPLETED: Literal["ALL_COMPLETED"] +PENDING: Literal["PENDING"] +RUNNING: Literal["RUNNING"] +CANCELLED: Literal["CANCELLED"] +CANCELLED_AND_NOTIFIED: Literal["CANCELLED_AND_NOTIFIED"] +FINISHED: Literal["FINISHED"] _FUTURE_STATES: list[str] _STATE_TO_DESCRIPTION_MAP: dict[str, str] LOGGER: Logger @@ -28,27 +29,17 @@ class TimeoutError(Error): ... if sys.version_info >= (3, 8): class InvalidStateError(Error): ... -if sys.version_info >= (3, 7): - class BrokenExecutor(RuntimeError): ... +class BrokenExecutor(RuntimeError): ... _T = TypeVar("_T") - -_T_co = TypeVar("_T_co", covariant=True) - -# Copied over Collection implementation as it does not exist in Python 2 and <3.6. -# Also to solve pytype issues with _Collection. -class _Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]): - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... +_P = ParamSpec("_P") class Future(Generic[_T]): - def __init__(self) -> None: ... def cancel(self) -> bool: ... def cancelled(self) -> bool: ... def running(self) -> bool: ... def done(self) -> bool: ... - def add_done_callback(self, fn: Callable[[Future[_T]], Any]) -> None: ... + def add_done_callback(self, fn: Callable[[Future[_T]], object]) -> None: ... def result(self, timeout: float | None = ...) -> _T: ... def set_running_or_notify_cancel(self) -> bool: ... def set_result(self, result: _T) -> None: ... @@ -59,9 +50,10 @@ class Future(Generic[_T]): class Executor: if sys.version_info >= (3, 9): - def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + def submit(self, __fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ... else: - def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + def submit(self, fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ... + def map( self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: float | None = ..., chunksize: int = ... ) -> Iterator[_T]: ... @@ -69,55 +61,51 @@ class Executor: def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ... else: def shutdown(self, wait: bool = ...) -> None: ... + def __enter__(self: Self) -> Self: ... - def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool | None: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> bool | None: ... def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ... # Ideally this would be a namedtuple, but mypy doesn't support generic tuple types. See #1976 -class DoneAndNotDoneFutures(Sequence[Set[Future[_T]]]): - done: set[Future[_T]] - not_done: set[Future[_T]] +class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]): + if sys.version_info >= (3, 10): + __match_args__ = ("done", "not_done") + @property + def done(self) -> set[Future[_T]]: ... + @property + def not_done(self) -> set[Future[_T]]: ... def __new__(_cls, done: set[Future[_T]], not_done: set[Future[_T]]) -> DoneAndNotDoneFutures[_T]: ... def __len__(self) -> int: ... @overload - def __getitem__(self, i: int) -> set[Future[_T]]: ... + def __getitem__(self, __i: SupportsIndex) -> set[Future[_T]]: ... @overload - def __getitem__(self, s: slice) -> DoneAndNotDoneFutures[_T]: ... + def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ... def wait(fs: Iterable[Future[_T]], timeout: float | None = ..., return_when: str = ...) -> DoneAndNotDoneFutures[_T]: ... class _Waiter: event: threading.Event finished_futures: list[Future[Any]] - def __init__(self) -> None: ... def add_result(self, future: Future[Any]) -> None: ... def add_exception(self, future: Future[Any]) -> None: ... def add_cancelled(self, future: Future[Any]) -> None: ... class _AsCompletedWaiter(_Waiter): lock: threading.Lock - def __init__(self) -> None: ... - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... -class _FirstCompletedWaiter(_Waiter): - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... +class _FirstCompletedWaiter(_Waiter): ... class _AllCompletedWaiter(_Waiter): num_pending_calls: int stop_on_exception: bool lock: threading.Lock def __init__(self, num_pending_calls: int, stop_on_exception: bool) -> None: ... - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... class _AcquireFutures: futures: Iterable[Future[Any]] def __init__(self, futures: Iterable[Future[Any]]) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... diff --git a/stdlib/concurrent/futures/process.pyi b/stdlib/concurrent/futures/process.pyi index 4ae7913..a98702d 100644 --- a/stdlib/concurrent/futures/process.pyi +++ b/stdlib/concurrent/futures/process.pyi @@ -1,14 +1,16 @@ import sys -from collections.abc import Generator, Iterable, Mapping, MutableMapping, MutableSequence +from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping, MutableSequence from multiprocessing.connection import Connection from multiprocessing.context import BaseContext, Process from multiprocessing.queues import Queue, SimpleQueue from threading import Lock, Semaphore, Thread from types import TracebackType -from typing import Any, Callable, Generic, Tuple, TypeVar +from typing import Any, Generic, TypeVar from weakref import ref -from ._base import Executor, Future +from ._base import BrokenExecutor, Executor, Future + +_T = TypeVar("_T") _threads_wakeups: MutableMapping[Any, Any] _global_shutdown: bool @@ -17,7 +19,6 @@ class _ThreadWakeup: _closed: bool _reader: Connection _writer: Connection - def __init__(self) -> None: ... def close(self) -> None: ... def wakeup(self) -> None: ... def clear(self) -> None: ... @@ -31,30 +32,33 @@ _MAX_WINDOWS_WORKERS: int class _RemoteTraceback(Exception): tb: str def __init__(self, tb: TracebackType) -> None: ... - def __str__(self) -> str: ... class _ExceptionWithTraceback: exc: BaseException tb: TracebackType def __init__(self, exc: BaseException, tb: TracebackType) -> None: ... - def __reduce__(self) -> str | Tuple[Any, ...]: ... + def __reduce__(self) -> str | tuple[Any, ...]: ... def _rebuild_exc(exc: Exception, tb: str) -> Exception: ... -_S = TypeVar("_S") - -class _WorkItem(Generic[_S]): - future: Future[_S] - fn: Callable[..., _S] +class _WorkItem(Generic[_T]): + future: Future[_T] + fn: Callable[..., _T] args: Iterable[Any] kwargs: Mapping[str, Any] - def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ... + def __init__(self, future: Future[_T], fn: Callable[..., _T], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ... class _ResultItem: work_id: int exception: Exception result: Any - def __init__(self, work_id: int, exception: Exception | None = ..., result: Any | None = ...) -> None: ... + if sys.version_info >= (3, 11): + exit_pid: int | None + def __init__( + self, work_id: int, exception: Exception | None = ..., result: Any | None = ..., exit_pid: int | None = ... + ) -> None: ... + else: + def __init__(self, work_id: int, exception: Exception | None = ..., result: Any | None = ...) -> None: ... class _CallItem: work_id: int @@ -63,43 +67,60 @@ class _CallItem: kwargs: Mapping[str, Any] def __init__(self, work_id: int, fn: Callable[..., Any], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ... -if sys.version_info >= (3, 7): - class _SafeQueue(Queue[Future[Any]]): - pending_work_items: dict[int, _WorkItem[Any]] - shutdown_lock: Lock - thread_wakeup: _ThreadWakeup - if sys.version_info >= (3, 9): - def __init__( - self, - max_size: int | None = ..., - *, - ctx: BaseContext, - pending_work_items: dict[int, _WorkItem[Any]], - shutdown_lock: Lock, - thread_wakeup: _ThreadWakeup, - ) -> None: ... - else: - def __init__( - self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]] - ) -> None: ... - def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ... - -def _get_chunks(*iterables: Any, chunksize: int) -> Generator[Tuple[Any, ...], None, None]: ... -def _process_chunk(fn: Callable[..., Any], chunk: Tuple[Any, None, None]) -> Generator[Any, None, None]: ... -def _sendback_result( - result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = ..., exception: Exception | None = ... -) -> None: ... - -if sys.version_info >= (3, 7): +class _SafeQueue(Queue[Future[Any]]): + pending_work_items: dict[int, _WorkItem[Any]] + shutdown_lock: Lock + thread_wakeup: _ThreadWakeup + if sys.version_info >= (3, 9): + def __init__( + self, + max_size: int | None = ..., + *, + ctx: BaseContext, + pending_work_items: dict[int, _WorkItem[Any]], + shutdown_lock: Lock, + thread_wakeup: _ThreadWakeup, + ) -> None: ... + else: + def __init__( + self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]] + ) -> None: ... + + def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ... + +def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...], None, None]: ... +def _process_chunk(fn: Callable[..., _T], chunk: Iterable[tuple[Any, ...]]) -> list[_T]: ... + +if sys.version_info >= (3, 11): + def _sendback_result( + result_queue: SimpleQueue[_WorkItem[Any]], + work_id: int, + result: Any | None = ..., + exception: Exception | None = ..., + exit_pid: int | None = ..., + ) -> None: ... + +else: + def _sendback_result( + result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = ..., exception: Exception | None = ... + ) -> None: ... + +if sys.version_info >= (3, 11): def _process_worker( call_queue: Queue[_CallItem], result_queue: SimpleQueue[_ResultItem], - initializer: Callable[..., None] | None, - initargs: Tuple[Any, ...], + initializer: Callable[..., object] | None, + initargs: tuple[Any, ...], + max_tasks: int | None = ..., ) -> None: ... else: - def _process_worker(call_queue: Queue[_CallItem], result_queue: SimpleQueue[_ResultItem]) -> None: ... + def _process_worker( + call_queue: Queue[_CallItem], + result_queue: SimpleQueue[_ResultItem], + initializer: Callable[..., object] | None, + initargs: tuple[Any, ...], + ) -> None: ... if sys.version_info >= (3, 9): class _ExecutorManagerThread(Thread): @@ -129,17 +150,12 @@ _system_limited: bool | None def _check_system_limits() -> None: ... def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> Any: ... -if sys.version_info >= (3, 7): - from ._base import BrokenExecutor - class BrokenProcessPool(BrokenExecutor): ... - -else: - class BrokenProcessPool(RuntimeError): ... +class BrokenProcessPool(BrokenExecutor): ... class ProcessPoolExecutor(Executor): _mp_context: BaseContext | None = ... _initializer: Callable[..., None] | None = ... - _initargs: Tuple[Any, ...] = ... + _initargs: tuple[Any, ...] = ... _executor_manager_thread: _ThreadWakeup _processes: MutableMapping[int, Process] _shutdown_thread: bool @@ -152,16 +168,25 @@ class ProcessPoolExecutor(Executor): _executor_manager_thread_wakeup: _ThreadWakeup _result_queue: SimpleQueue[Any] _work_ids: Queue[Any] - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 11): def __init__( self, max_workers: int | None = ..., mp_context: BaseContext | None = ..., - initializer: Callable[..., None] | None = ..., - initargs: Tuple[Any, ...] = ..., + initializer: Callable[..., object] | None = ..., + initargs: tuple[Any, ...] = ..., + *, + max_tasks_per_child: int | None = ..., ) -> None: ... else: - def __init__(self, max_workers: int | None = ...) -> None: ... + def __init__( + self, + max_workers: int | None = ..., + mp_context: BaseContext | None = ..., + initializer: Callable[..., object] | None = ..., + initargs: tuple[Any, ...] = ..., + ) -> None: ... if sys.version_info >= (3, 9): def _start_executor_manager_thread(self) -> None: ... + def _adjust_process_count(self) -> None: ... diff --git a/stdlib/concurrent/futures/thread.pyi b/stdlib/concurrent/futures/thread.pyi index 7a35bfc..387ce0d 100644 --- a/stdlib/concurrent/futures/thread.pyi +++ b/stdlib/concurrent/futures/thread.pyi @@ -1,11 +1,11 @@ import queue import sys -from collections.abc import Iterable, Mapping, Set +from collections.abc import Callable, Iterable, Mapping, Set as AbstractSet from threading import Lock, Semaphore, Thread -from typing import Any, Callable, Generic, Tuple, TypeVar +from typing import Any, Generic, TypeVar from weakref import ref -from ._base import Executor, Future +from ._base import BrokenExecutor, Executor, Future _threads_queues: Mapping[Any, Any] _shutdown: bool @@ -28,45 +28,32 @@ class _WorkItem(Generic[_S]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -if sys.version_info >= (3, 7): - def _worker( - executor_reference: ref[Any], - work_queue: queue.SimpleQueue[Any], - initializer: Callable[..., None], - initargs: Tuple[Any, ...], - ) -> None: ... - -else: - def _worker(executor_reference: ref[Any], work_queue: queue.Queue[Any]) -> None: ... +def _worker( + executor_reference: ref[Any], + work_queue: queue.SimpleQueue[Any], + initializer: Callable[..., object], + initargs: tuple[Any, ...], +) -> None: ... -if sys.version_info >= (3, 7): - from ._base import BrokenExecutor - class BrokenThreadPool(BrokenExecutor): ... +class BrokenThreadPool(BrokenExecutor): ... class ThreadPoolExecutor(Executor): _max_workers: int _idle_semaphore: Semaphore - _threads: Set[Thread] + _threads: AbstractSet[Thread] _broken: bool _shutdown: bool _shutdown_lock: Lock _thread_name_prefix: str | None = ... _initializer: Callable[..., None] | None = ... - _initargs: Tuple[Any, ...] = ... - if sys.version_info >= (3, 7): - _work_queue: queue.SimpleQueue[_WorkItem[Any]] - else: - _work_queue: queue.Queue[_WorkItem[Any]] - if sys.version_info >= (3, 7): - def __init__( - self, - max_workers: int | None = ..., - thread_name_prefix: str = ..., - initializer: Callable[..., None] | None = ..., - initargs: Tuple[Any, ...] = ..., - ) -> None: ... - else: - def __init__(self, max_workers: int | None = ..., thread_name_prefix: str = ...) -> None: ... + _initargs: tuple[Any, ...] = ... + _work_queue: queue.SimpleQueue[_WorkItem[Any]] + def __init__( + self, + max_workers: int | None = ..., + thread_name_prefix: str = ..., + initializer: Callable[..., object] | None = ..., + initargs: tuple[Any, ...] = ..., + ) -> None: ... def _adjust_thread_count(self) -> None: ... - if sys.version_info >= (3, 7): - def _initializer_failed(self) -> None: ... + def _initializer_failed(self) -> None: ... diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index c278b82..00a2358 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -1,37 +1,56 @@ import sys -from _typeshed import StrOrBytesPath, StrPath, SupportsWrite +from _typeshed import StrOrBytesPath, SupportsWrite from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence -from typing import Any, ClassVar, Dict, Optional, Pattern, Tuple, Type, TypeVar, overload -from typing_extensions import Literal - -# Internal type aliases -_section = Mapping[str, str] -_parser = MutableMapping[str, _section] -_converter = Callable[[str], Any] -_converters = Dict[str, _converter] -_T = TypeVar("_T") +from re import Pattern +from typing import Any, ClassVar, TypeVar, overload +from typing_extensions import Literal, TypeAlias + +__all__ = [ + "NoSectionError", + "DuplicateOptionError", + "DuplicateSectionError", + "NoOptionError", + "InterpolationError", + "InterpolationDepthError", + "InterpolationMissingOptionError", + "InterpolationSyntaxError", + "ParsingError", + "MissingSectionHeaderError", + "ConfigParser", + "SafeConfigParser", + "RawConfigParser", + "Interpolation", + "BasicInterpolation", + "ExtendedInterpolation", + "LegacyInterpolation", + "SectionProxy", + "ConverterMapping", + "DEFAULTSECT", + "MAX_INTERPOLATION_DEPTH", +] -if sys.version_info >= (3, 7): - _Path = StrOrBytesPath -else: - _Path = StrPath +_Section: TypeAlias = Mapping[str, str] +_Parser: TypeAlias = MutableMapping[str, _Section] +_ConverterCallback: TypeAlias = Callable[[str], Any] +_ConvertersMap: TypeAlias = dict[str, _ConverterCallback] +_T = TypeVar("_T") -DEFAULTSECT: str -MAX_INTERPOLATION_DEPTH: int +DEFAULTSECT: Literal["DEFAULT"] +MAX_INTERPOLATION_DEPTH: Literal[10] class Interpolation: - def before_get(self, parser: _parser, section: str, option: str, value: str, defaults: _section) -> str: ... - def before_set(self, parser: _parser, section: str, option: str, value: str) -> str: ... - def before_read(self, parser: _parser, section: str, option: str, value: str) -> str: ... - def before_write(self, parser: _parser, section: str, option: str, value: str) -> str: ... + def before_get(self, parser: _Parser, section: str, option: str, value: str, defaults: _Section) -> str: ... + def before_set(self, parser: _Parser, section: str, option: str, value: str) -> str: ... + def before_read(self, parser: _Parser, section: str, option: str, value: str) -> str: ... + def before_write(self, parser: _Parser, section: str, option: str, value: str) -> str: ... class BasicInterpolation(Interpolation): ... class ExtendedInterpolation(Interpolation): ... class LegacyInterpolation(Interpolation): - def before_get(self, parser: _parser, section: str, option: str, value: str, vars: _section) -> str: ... + def before_get(self, parser: _Parser, section: str, option: str, value: str, vars: _Section) -> str: ... -class RawConfigParser(_parser): +class RawConfigParser(_Parser): _SECT_TMPL: ClassVar[str] # undocumented _OPT_TMPL: ClassVar[str] # undocumented _OPT_NV_TMPL: ClassVar[str] # undocumented @@ -47,7 +66,7 @@ class RawConfigParser(_parser): def __init__( self, defaults: Mapping[str, str | None] | None = ..., - dict_type: Type[Mapping[str, str]] = ..., + dict_type: type[Mapping[str, str]] = ..., allow_no_value: Literal[True] = ..., *, delimiters: Sequence[str] = ..., @@ -57,13 +76,13 @@ class RawConfigParser(_parser): empty_lines_in_values: bool = ..., default_section: str = ..., interpolation: Interpolation | None = ..., - converters: _converters = ..., + converters: _ConvertersMap = ..., ) -> None: ... @overload def __init__( self, - defaults: _section | None = ..., - dict_type: Type[Mapping[str, str]] = ..., + defaults: _Section | None = ..., + dict_type: type[Mapping[str, str]] = ..., allow_no_value: bool = ..., *, delimiters: Sequence[str] = ..., @@ -73,20 +92,21 @@ class RawConfigParser(_parser): empty_lines_in_values: bool = ..., default_section: str = ..., interpolation: Interpolation | None = ..., - converters: _converters = ..., + converters: _ConvertersMap = ..., ) -> None: ... def __len__(self) -> int: ... - def __getitem__(self, section: str) -> SectionProxy: ... - def __setitem__(self, section: str, options: _section) -> None: ... - def __delitem__(self, section: str) -> None: ... + def __getitem__(self, key: str) -> SectionProxy: ... + def __setitem__(self, key: str, value: _Section) -> None: ... + def __delitem__(self, key: str) -> None: ... def __iter__(self) -> Iterator[str]: ... - def defaults(self) -> _section: ... + def __contains__(self, key: object) -> bool: ... + def defaults(self) -> _Section: ... def sections(self) -> list[str]: ... def add_section(self, section: str) -> None: ... def has_section(self, section: str) -> bool: ... def options(self, section: str) -> list[str]: ... def has_option(self, section: str, option: str) -> bool: ... - def read(self, filenames: _Path | Iterable[_Path], encoding: str | None = ...) -> list[str]: ... + def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = ...) -> list[str]: ... def read_file(self, f: Iterable[str], source: str | None = ...) -> None: ... def read_string(self, string: str, source: str = ...) -> None: ... def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = ...) -> None: ... @@ -94,22 +114,22 @@ class RawConfigParser(_parser): # These get* methods are partially applied (with the same names) in # SectionProxy; the stubs should be kept updated together @overload - def getint(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ...) -> int: ... + def getint(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ... @overload def getint( - self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ..., fallback: _T = ... + self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... ) -> int | _T: ... @overload - def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ...) -> float: ... + def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ... @overload def getfloat( - self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ..., fallback: _T = ... + self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... ) -> float | _T: ... @overload - def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ...) -> bool: ... + def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ... @overload def getboolean( - self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ..., fallback: _T = ... + self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... ) -> bool | _T: ... def _get_conv( self, @@ -118,26 +138,33 @@ class RawConfigParser(_parser): conv: Callable[[str], _T], *, raw: bool = ..., - vars: _section | None = ..., + vars: _Section | None = ..., fallback: _T = ..., ) -> _T: ... # This is incompatible with MutableMapping so we ignore the type - @overload # type: ignore - def get(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ...) -> str: ... + @overload # type: ignore[override] + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str | Any: ... @overload - def get(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ..., fallback: _T) -> str | _T: ... + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T | Any: ... @overload - def items(self, *, raw: bool = ..., vars: _section | None = ...) -> ItemsView[str, SectionProxy]: ... + def items(self, *, raw: bool = ..., vars: _Section | None = ...) -> ItemsView[str, SectionProxy]: ... @overload - def items(self, section: str, raw: bool = ..., vars: _section | None = ...) -> list[tuple[str, str]]: ... + def items(self, section: str, raw: bool = ..., vars: _Section | None = ...) -> list[tuple[str, str]]: ... def set(self, section: str, option: str, value: str | None = ...) -> None: ... def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = ...) -> None: ... def remove_option(self, section: str, option: str) -> bool: ... def remove_section(self, section: str) -> bool: ... def optionxform(self, optionstr: str) -> str: ... -class ConfigParser(RawConfigParser): ... -class SafeConfigParser(ConfigParser): ... +class ConfigParser(RawConfigParser): + # This is incompatible with MutableMapping so we ignore the type + @overload # type: ignore[override] + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str: ... + @overload + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T: ... + +if sys.version_info < (3, 12): + class SafeConfigParser(ConfigParser): ... # deprecated alias class SectionProxy(MutableMapping[str, str]): def __init__(self, parser: RawConfigParser, name: str) -> None: ... @@ -151,29 +178,38 @@ class SectionProxy(MutableMapping[str, str]): def parser(self) -> RawConfigParser: ... @property def name(self) -> str: ... - def get(self, option: str, fallback: str | None = ..., *, raw: bool = ..., vars: _section | None = ..., _impl: Any | None = ..., **kwargs: Any) -> str: ... # type: ignore + def get( # type: ignore[override] + self, + option: str, + fallback: str | None = ..., + *, + raw: bool = ..., + vars: _Section | None = ..., + _impl: Any | None = ..., + **kwargs: Any, + ) -> str | Any: ... # can be None in RawConfigParser's sections # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together @overload - def getint(self, option: str, *, raw: bool = ..., vars: _section | None = ...) -> int: ... + def getint(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ... @overload - def getint(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _section | None = ...) -> int | _T: ... + def getint(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> int | _T: ... @overload - def getfloat(self, option: str, *, raw: bool = ..., vars: _section | None = ...) -> float: ... + def getfloat(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ... @overload - def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _section | None = ...) -> float | _T: ... + def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> float | _T: ... @overload - def getboolean(self, option: str, *, raw: bool = ..., vars: _section | None = ...) -> bool: ... + def getboolean(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ... @overload - def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _section | None = ...) -> bool | _T: ... + def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> bool | _T: ... # SectionProxy can have arbitrary attributes when custom converters are used def __getattr__(self, key: str) -> Callable[..., Any]: ... -class ConverterMapping(MutableMapping[str, Optional[_converter]]): - GETTERCRE: Pattern[Any] +class ConverterMapping(MutableMapping[str, _ConverterCallback | None]): + GETTERCRE: ClassVar[Pattern[Any]] def __init__(self, parser: RawConfigParser) -> None: ... - def __getitem__(self, key: str) -> _converter: ... - def __setitem__(self, key: str, value: _converter | None) -> None: ... + def __getitem__(self, key: str) -> _ConverterCallback: ... + def __setitem__(self, key: str, value: _ConverterCallback | None) -> None: ... def __delitem__(self, key: str) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... @@ -220,7 +256,7 @@ class InterpolationSyntaxError(InterpolationError): ... class ParsingError(Error): source: str - errors: list[Tuple[int, str]] + errors: list[tuple[int, str]] def __init__(self, source: str | None = ..., filename: str | None = ...) -> None: ... def append(self, lineno: int, line: str) -> None: ... diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 8c362cf..ca88304 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -1,107 +1,174 @@ +import abc import sys -from _typeshed import Self +from _typeshed import Self, StrOrBytesPath +from abc import abstractmethod +from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator from types import TracebackType -from typing import ( - IO, - Any, - AsyncContextManager, - AsyncIterator, - Awaitable, - Callable, - ContextManager, - Iterator, - Optional, - Type, - TypeVar, - overload, -) -from typing_extensions import ParamSpec, Protocol - -AbstractContextManager = ContextManager -if sys.version_info >= (3, 7): - AbstractAsyncContextManager = AsyncContextManager +from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable +from typing_extensions import ParamSpec, TypeAlias + +__all__ = [ + "contextmanager", + "closing", + "AbstractContextManager", + "ContextDecorator", + "ExitStack", + "redirect_stdout", + "redirect_stderr", + "suppress", + "AbstractAsyncContextManager", + "AsyncExitStack", + "asynccontextmanager", + "nullcontext", +] + +if sys.version_info >= (3, 10): + __all__ += ["aclosing"] + +if sys.version_info >= (3, 11): + __all__ += ["chdir"] _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) -_T_io = TypeVar("_T_io", bound=Optional[IO[str]]) +_T_io = TypeVar("_T_io", bound=IO[str] | None) _F = TypeVar("_F", bound=Callable[..., Any]) _P = ParamSpec("_P") -_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool] -_CM_EF = TypeVar("_CM_EF", ContextManager[Any], _ExitFunc) +_ExitFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool | None] +_CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any] | _ExitFunc) + +@runtime_checkable +class AbstractContextManager(Protocol[_T_co]): + def __enter__(self) -> _T_co: ... + @abstractmethod + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> bool | None: ... + +@runtime_checkable +class AbstractAsyncContextManager(Protocol[_T_co]): + async def __aenter__(self) -> _T_co: ... + @abstractmethod + async def __aexit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> bool | None: ... -class _GeneratorContextManager(ContextManager[_T_co]): +class ContextDecorator: def __call__(self, func: _F) -> _F: ... -# type ignore to deal with incomplete ParamSpec support in mypy -def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, _GeneratorContextManager[_T]]: ... # type: ignore +class _GeneratorContextManager(AbstractContextManager[_T_co], ContextDecorator, Generic[_T_co]): + # __init__ and all instance attributes are actually inherited from _GeneratorContextManagerBase + # _GeneratorContextManagerBase is more trouble than it's worth to include in the stub; see #6676 + def __init__(self, func: Callable[..., Iterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... + gen: Generator[_T_co, Any, Any] + func: Callable[..., Generator[_T_co, Any, Any]] + args: tuple[Any, ...] + kwds: dict[str, Any] + def __exit__( + self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> bool | None: ... + +def contextmanager(func: Callable[_P, Iterator[_T_co]]) -> Callable[_P, _GeneratorContextManager[_T_co]]: ... + +if sys.version_info >= (3, 10): + _AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]]) + + class AsyncContextDecorator: + def __call__(self, func: _AF) -> _AF: ... -if sys.version_info >= (3, 7): - def asynccontextmanager(func: Callable[_P, AsyncIterator[_T]]) -> Callable[_P, AsyncContextManager[_T]]: ... # type: ignore + class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co], AsyncContextDecorator, Generic[_T_co]): + # __init__ and these attributes are actually defined in the base class _GeneratorContextManagerBase, + # which is more trouble than it's worth to include in the stub (see #6676) + def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... + gen: AsyncGenerator[_T_co, Any] + func: Callable[..., AsyncGenerator[_T_co, Any]] + args: tuple[Any, ...] + kwds: dict[str, Any] + async def __aexit__( + self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> bool | None: ... + +else: + class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co], Generic[_T_co]): + def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... + gen: AsyncGenerator[_T_co, Any] + func: Callable[..., AsyncGenerator[_T_co, Any]] + args: tuple[Any, ...] + kwds: dict[str, Any] + async def __aexit__( + self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> bool | None: ... + +def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ... class _SupportsClose(Protocol): def close(self) -> object: ... _SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose) -class closing(ContextManager[_SupportsCloseT]): +class closing(AbstractContextManager[_SupportsCloseT]): def __init__(self, thing: _SupportsCloseT) -> None: ... + def __exit__(self, *exc_info: object) -> None: ... if sys.version_info >= (3, 10): class _SupportsAclose(Protocol): def aclose(self) -> Awaitable[object]: ... _SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose) - class aclosing(AsyncContextManager[_SupportsAcloseT]): + + class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]): def __init__(self, thing: _SupportsAcloseT) -> None: ... - _AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]]) - class AsyncContextDecorator: - def __call__(self, func: _AF) -> _AF: ... + async def __aexit__(self, *exc_info: object) -> None: ... -class suppress(ContextManager[None]): - def __init__(self, *exceptions: Type[BaseException]) -> None: ... +class suppress(AbstractContextManager[None]): + def __init__(self, *exceptions: type[BaseException]) -> None: ... def __exit__( - self, exctype: Type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None + self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None ) -> bool: ... -class redirect_stdout(ContextManager[_T_io]): +class _RedirectStream(AbstractContextManager[_T_io]): def __init__(self, new_target: _T_io) -> None: ... + def __exit__( + self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None + ) -> None: ... -class redirect_stderr(ContextManager[_T_io]): - def __init__(self, new_target: _T_io) -> None: ... +class redirect_stdout(_RedirectStream[_T_io]): ... +class redirect_stderr(_RedirectStream[_T_io]): ... -class ContextDecorator: - def __call__(self, func: _F) -> _F: ... - -class ExitStack(ContextManager[ExitStack]): - def __init__(self) -> None: ... - def enter_context(self, cm: ContextManager[_T]) -> _T: ... +# In reality this is a subclass of `AbstractContextManager`; +# see #7961 for why we don't do that in the stub +class ExitStack(metaclass=abc.ABCMeta): + def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ... def push(self, exit: _CM_EF) -> _CM_EF: ... - def callback(self, __callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ... + def callback(self, __callback: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> Callable[_P, _T]: ... def pop_all(self: Self) -> Self: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None ) -> bool: ... -if sys.version_info >= (3, 7): - _ExitCoroFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]] - _CallbackCoroFunc = Callable[..., Awaitable[Any]] - _ACM_EF = TypeVar("_ACM_EF", AsyncContextManager[Any], _ExitCoroFunc) - class AsyncExitStack(AsyncContextManager[AsyncExitStack]): - def __init__(self) -> None: ... - def enter_context(self, cm: ContextManager[_T]) -> _T: ... - def enter_async_context(self, cm: AsyncContextManager[_T]) -> Awaitable[_T]: ... - def push(self, exit: _CM_EF) -> _CM_EF: ... - def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ... - def callback(self, __callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ... - def push_async_callback(self, __callback: _CallbackCoroFunc, *args: Any, **kwds: Any) -> _CallbackCoroFunc: ... - def pop_all(self: Self) -> Self: ... - def aclose(self) -> Awaitable[None]: ... - def __aenter__(self: Self) -> Awaitable[Self]: ... - def __aexit__( - self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None - ) -> Awaitable[bool]: ... +_ExitCoroFunc: TypeAlias = Callable[ + [type[BaseException] | None, BaseException | None, TracebackType | None], Awaitable[bool | None] +] +_ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any] | _ExitCoroFunc) + +# In reality this is a subclass of `AbstractAsyncContextManager`; +# see #7961 for why we don't do that in the stub +class AsyncExitStack(metaclass=abc.ABCMeta): + def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ... + async def enter_async_context(self, cm: AbstractAsyncContextManager[_T]) -> _T: ... + def push(self, exit: _CM_EF) -> _CM_EF: ... + def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ... + def callback(self, __callback: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> Callable[_P, _T]: ... + def push_async_callback( + self, __callback: Callable[_P, Awaitable[_T]], *args: _P.args, **kwds: _P.kwargs + ) -> Callable[_P, Awaitable[_T]]: ... + def pop_all(self: Self) -> Self: ... + async def aclose(self) -> None: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> bool: ... if sys.version_info >= (3, 10): class nullcontext(AbstractContextManager[_T], AbstractAsyncContextManager[_T]): @@ -111,11 +178,11 @@ if sys.version_info >= (3, 10): @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... - def __exit__(self, *exctype: Any) -> None: ... + def __exit__(self, *exctype: object) -> None: ... async def __aenter__(self) -> _T: ... - async def __aexit__(self, *exctype: Any) -> None: ... + async def __aexit__(self, *exctype: object) -> None: ... -elif sys.version_info >= (3, 7): +else: class nullcontext(AbstractContextManager[_T]): enter_result: _T @overload @@ -123,4 +190,13 @@ elif sys.version_info >= (3, 7): @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... - def __exit__(self, *exctype: Any) -> None: ... + def __exit__(self, *exctype: object) -> None: ... + +if sys.version_info >= (3, 11): + _T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=int | StrOrBytesPath) + + class chdir(AbstractContextManager[None], Generic[_T_fd_or_any_path]): + path: _T_fd_or_any_path + def __init__(self, path: _T_fd_or_any_path) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, *excinfo: object) -> None: ... diff --git a/stdlib/contextvars.pyi b/stdlib/contextvars.pyi index e97f621..266d96b 100644 --- a/stdlib/contextvars.pyi +++ b/stdlib/contextvars.pyi @@ -1,25 +1,35 @@ import sys -from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, overload +from collections.abc import Callable, Iterator, Mapping +from typing import Any, ClassVar, Generic, TypeVar, overload +from typing_extensions import ParamSpec, final if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = ("Context", "ContextVar", "Token", "copy_context") + _T = TypeVar("_T") _D = TypeVar("_D") +_P = ParamSpec("_P") +@final class ContextVar(Generic[_T]): - def __init__(self, name: str, *, default: _T = ...) -> None: ... + @overload + def __init__(self, name: str) -> None: ... + @overload + def __init__(self, name: str, *, default: _T) -> None: ... @property def name(self) -> str: ... @overload def get(self) -> _T: ... @overload def get(self, default: _D | _T) -> _D | _T: ... - def set(self, value: _T) -> Token[_T]: ... - def reset(self, token: Token[_T]) -> None: ... + def set(self, __value: _T) -> Token[_T]: ... + def reset(self, __token: Token[_T]) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... +@final class Token(Generic[_T]): @property def var(self) -> ContextVar[_T]: ... @@ -33,14 +43,15 @@ def copy_context() -> Context: ... # It doesn't make sense to make this generic, because for most Contexts each ContextVar will have # a different value. +@final class Context(Mapping[ContextVar[Any], Any]): def __init__(self) -> None: ... @overload - def get(self, __key: ContextVar[Any]) -> Any | None: ... + def get(self, __key: ContextVar[_T]) -> _T | None: ... @overload - def get(self, __key: ContextVar[Any], __default: Any | None) -> Any: ... - def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ... + def get(self, __key: ContextVar[_T], __default: _D) -> _T | _D: ... + def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... def copy(self) -> Context: ... - def __getitem__(self, key: ContextVar[Any]) -> Any: ... + def __getitem__(self, __key: ContextVar[_T]) -> _T: ... def __iter__(self) -> Iterator[ContextVar[Any]]: ... def __len__(self) -> int: ... diff --git a/stdlib/copy.pyi b/stdlib/copy.pyi index a5f9420..b53f418 100644 --- a/stdlib/copy.pyi +++ b/stdlib/copy.pyi @@ -1,5 +1,7 @@ from typing import Any, TypeVar +__all__ = ["Error", "copy", "deepcopy"] + _T = TypeVar("_T") # None in CPython but non-None in Jython diff --git a/stdlib/copyreg.pyi b/stdlib/copyreg.pyi index 320097b..4403550 100644 --- a/stdlib/copyreg.pyi +++ b/stdlib/copyreg.pyi @@ -1,18 +1,21 @@ -from typing import Any, Callable, Hashable, Optional, SupportsInt, Tuple, TypeVar, Union +from collections.abc import Callable, Hashable +from typing import Any, SupportsInt, TypeVar, Union +from typing_extensions import TypeAlias -_TypeT = TypeVar("_TypeT", bound=type) -_Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]] +_T = TypeVar("_T") +_Reduce: TypeAlias = Union[tuple[Callable[..., _T], tuple[Any, ...]], tuple[Callable[..., _T], tuple[Any, ...], Any | None]] -__all__: list[str] +__all__ = ["pickle", "constructor", "add_extension", "remove_extension", "clear_extension_cache"] def pickle( - ob_type: _TypeT, - pickle_function: Callable[[_TypeT], str | _Reduce[_TypeT]], - constructor_ob: Callable[[_Reduce[_TypeT]], _TypeT] | None = ..., + ob_type: type[_T], + pickle_function: Callable[[_T], str | _Reduce[_T]], + constructor_ob: Callable[[_Reduce[_T]], _T] | None = ..., ) -> None: ... -def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ... +def constructor(object: Callable[[_Reduce[_T]], _T]) -> None: ... def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ... def clear_extension_cache() -> None: ... -dispatch_table: dict[type, Callable[[type], str | _Reduce[type]]] # undocumented +_DispatchTableType: TypeAlias = dict[type, Callable[[Any], str | _Reduce[Any]]] # imported by multiprocessing.reduction +dispatch_table: _DispatchTableType # undocumented diff --git a/stdlib/crypt.pyi b/stdlib/crypt.pyi index 27e3043..83ad45d 100644 --- a/stdlib/crypt.pyi +++ b/stdlib/crypt.pyi @@ -1,20 +1,12 @@ import sys -class _Method: ... - -METHOD_CRYPT: _Method -METHOD_MD5: _Method -METHOD_SHA256: _Method -METHOD_SHA512: _Method -if sys.version_info >= (3, 7): +if sys.platform != "win32": + class _Method: ... + METHOD_CRYPT: _Method + METHOD_MD5: _Method + METHOD_SHA256: _Method + METHOD_SHA512: _Method METHOD_BLOWFISH: _Method - -methods: list[_Method] - -if sys.version_info >= (3, 7): + methods: list[_Method] def mksalt(method: _Method | None = ..., *, rounds: int | None = ...) -> str: ... - -else: - def mksalt(method: _Method | None = ...) -> str: ... - -def crypt(word: str, salt: str | _Method | None = ...) -> str: ... + def crypt(word: str, salt: str | _Method | None = ...) -> str: ... diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 0b69cb2..8802d6b 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -1,4 +1,6 @@ import sys + +# actually csv.Dialect is a different class to _csv.Dialect at runtime, but for typing purposes, they're identical from _csv import ( QUOTE_ALL as QUOTE_ALL, QUOTE_MINIMAL as QUOTE_MINIMAL, @@ -6,7 +8,9 @@ from _csv import ( QUOTE_NONNUMERIC as QUOTE_NONNUMERIC, Dialect as Dialect, Error as Error, + __version__ as __version__, _DialectLike, + _QuotingType, _reader, _writer, field_size_limit as field_size_limit, @@ -17,36 +21,50 @@ from _csv import ( unregister_dialect as unregister_dialect, writer as writer, ) +from _typeshed import Self, SupportsWrite from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence -from typing import Any, Generic, Type, TypeVar, overload +from typing import Any, Generic, TypeVar, overload +from typing_extensions import Literal if sys.version_info >= (3, 8): - from typing import Dict as _DictReadMapping + from builtins import dict as _DictReadMapping else: from collections import OrderedDict as _DictReadMapping -_T = TypeVar("_T") +if sys.version_info >= (3, 12): + from types import GenericAlias -class excel(Dialect): - delimiter: str - quotechar: str - doublequote: bool - skipinitialspace: bool - lineterminator: str - quoting: int +__all__ = [ + "QUOTE_MINIMAL", + "QUOTE_ALL", + "QUOTE_NONNUMERIC", + "QUOTE_NONE", + "Error", + "Dialect", + "__doc__", + "excel", + "excel_tab", + "field_size_limit", + "reader", + "writer", + "register_dialect", + "get_dialect", + "list_dialects", + "Sniffer", + "unregister_dialect", + "__version__", + "DictReader", + "DictWriter", + "unix_dialect", +] -class excel_tab(excel): - delimiter: str +_T = TypeVar("_T") -class unix_dialect(Dialect): - delimiter: str - quotechar: str - doublequote: bool - skipinitialspace: bool - lineterminator: str - quoting: int +class excel(Dialect): ... +class excel_tab(excel): ... +class unix_dialect(Dialect): ... -class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]): +class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): fieldnames: Sequence[_T] | None restkey: str | None restval: str | None @@ -61,8 +79,15 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]): restkey: str | None = ..., restval: str | None = ..., dialect: _DialectLike = ..., - *args: Any, - **kwds: Any, + *, + delimiter: str = ..., + quotechar: str | None = ..., + escapechar: str | None = ..., + doublequote: bool = ..., + skipinitialspace: bool = ..., + lineterminator: str = ..., + quoting: _QuotingType = ..., + strict: bool = ..., ) -> None: ... @overload def __init__( @@ -72,36 +97,54 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]): restkey: str | None = ..., restval: str | None = ..., dialect: _DialectLike = ..., - *args: Any, - **kwds: Any, + *, + delimiter: str = ..., + quotechar: str | None = ..., + escapechar: str | None = ..., + doublequote: bool = ..., + skipinitialspace: bool = ..., + lineterminator: str = ..., + quoting: _QuotingType = ..., + strict: bool = ..., ) -> None: ... - def __iter__(self) -> DictReader[_T]: ... - def __next__(self) -> _DictReadMapping[_T, str]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> _DictReadMapping[_T | Any, str | Any]: ... + if sys.version_info >= (3, 12): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... class DictWriter(Generic[_T]): fieldnames: Collection[_T] restval: Any | None - extrasaction: str + extrasaction: Literal["raise", "ignore"] writer: _writer def __init__( self, - f: Any, + f: SupportsWrite[str], fieldnames: Collection[_T], restval: Any | None = ..., - extrasaction: str = ..., + extrasaction: Literal["raise", "ignore"] = ..., dialect: _DialectLike = ..., - *args: Any, - **kwds: Any, + *, + delimiter: str = ..., + quotechar: str | None = ..., + escapechar: str | None = ..., + doublequote: bool = ..., + skipinitialspace: bool = ..., + lineterminator: str = ..., + quoting: _QuotingType = ..., + strict: bool = ..., ) -> None: ... if sys.version_info >= (3, 8): def writeheader(self) -> Any: ... else: def writeheader(self) -> None: ... + def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ... def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ... + if sys.version_info >= (3, 12): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... -class Sniffer(object): +class Sniffer: preferred: list[str] - def __init__(self) -> None: ... - def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ... + def sniff(self, sample: str, delimiters: str | None = ...) -> type[Dialect]: ... def has_header(self, sample: str) -> bool: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 6967058..1851d34 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -1,21 +1,10 @@ import sys -from _typeshed import ReadableBuffer, WriteableBuffer -from typing import ( - Any, - Callable, - ClassVar, - Generic, - Iterable, - Iterator, - Mapping, - Optional, - Sequence, - Tuple, - Type, - TypeVar, - Union as _UnionT, - overload, -) +from _ctypes import RTLD_GLOBAL as RTLD_GLOBAL, RTLD_LOCAL as RTLD_LOCAL +from _typeshed import ReadableBuffer, Self, WriteableBuffer +from abc import abstractmethod +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from typing import Any, ClassVar, Generic, TypeVar, Union as _UnionT, overload +from typing_extensions import TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias @@ -24,16 +13,14 @@ _T = TypeVar("_T") _DLLT = TypeVar("_DLLT", bound=CDLL) _CT = TypeVar("_CT", bound=_CData) -RTLD_GLOBAL: int -RTLD_LOCAL: int DEFAULT_MODE: int -class CDLL(object): +class CDLL: _func_flags_: ClassVar[int] _func_restype_: ClassVar[_CData] _name: str _handle: int - _FuncPtr: Type[_FuncPointer] + _FuncPtr: type[_FuncPointer] if sys.version_info >= (3, 8): def __init__( self, @@ -48,8 +35,9 @@ class CDLL(object): def __init__( self, name: str | None, mode: int = ..., handle: int | None = ..., use_errno: bool = ..., use_last_error: bool = ... ) -> None: ... + def __getattr__(self, name: str) -> _NamedFuncPointer: ... - def __getitem__(self, name: str) -> _NamedFuncPointer: ... + def __getitem__(self, name_or_ordinal: str) -> _NamedFuncPointer: ... if sys.platform == "win32": class OleDLL(CDLL): ... @@ -58,7 +46,7 @@ if sys.platform == "win32": class PyDLL(CDLL): ... class LibraryLoader(Generic[_DLLT]): - def __init__(self, dlltype: Type[_DLLT]) -> None: ... + def __init__(self, dlltype: type[_DLLT]) -> None: ... def __getattr__(self, name: str) -> _DLLT: ... def __getitem__(self, name: str) -> _DLLT: ... def LoadLibrary(self, name: str) -> _DLLT: ... @@ -76,42 +64,42 @@ class _CDataMeta(type): # By default mypy complains about the following two methods, because strictly speaking cls # might not be a Type[_CT]. However this can never actually happen, because the only class that # uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here. - def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore - def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore + def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] + def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] class _CData(metaclass=_CDataMeta): _b_base: int _b_needsfree_: bool _objects: Mapping[Any, int] | None @classmethod - def from_buffer(cls: Type[_CT], source: WriteableBuffer, offset: int = ...) -> _CT: ... + def from_buffer(cls: type[Self], source: WriteableBuffer, offset: int = ...) -> Self: ... @classmethod - def from_buffer_copy(cls: Type[_CT], source: ReadableBuffer, offset: int = ...) -> _CT: ... + def from_buffer_copy(cls: type[Self], source: ReadableBuffer, offset: int = ...) -> Self: ... @classmethod - def from_address(cls: Type[_CT], address: int) -> _CT: ... + def from_address(cls: type[Self], address: int) -> Self: ... @classmethod - def from_param(cls: Type[_CT], obj: Any) -> _CT | _CArgObject: ... + def from_param(cls: type[Self], obj: Any) -> Self | _CArgObject: ... @classmethod - def in_dll(cls: Type[_CT], library: CDLL, name: str) -> _CT: ... + def in_dll(cls: type[Self], library: CDLL, name: str) -> Self: ... class _CanCastTo(_CData): ... class _PointerLike(_CanCastTo): ... -_ECT = Callable[[Optional[Type[_CData]], _FuncPointer, Tuple[_CData, ...]], _CData] -_PF = _UnionT[Tuple[int], Tuple[int, str], Tuple[int, str, Any]] +_ECT: TypeAlias = Callable[[type[_CData] | None, _FuncPointer, tuple[_CData, ...]], _CData] +_PF: TypeAlias = _UnionT[tuple[int], tuple[int, str], tuple[int, str, Any]] class _FuncPointer(_PointerLike, _CData): - restype: Type[_CData] | Callable[[int], Any] | None - argtypes: Sequence[Type[_CData]] + restype: type[_CData] | Callable[[int], Any] | None + argtypes: Sequence[type[_CData]] errcheck: _ECT @overload def __init__(self, address: int) -> None: ... @overload def __init__(self, callable: Callable[..., Any]) -> None: ... @overload - def __init__(self, func_spec: Tuple[str | int, CDLL], paramflags: Tuple[_PF, ...] = ...) -> None: ... + def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] = ...) -> None: ... @overload - def __init__(self, vtlb_index: int, name: str, paramflags: Tuple[_PF, ...] = ..., iid: pointer[c_int] = ...) -> None: ... + def __init__(self, vtlb_index: int, name: str, paramflags: tuple[_PF, ...] = ..., iid: _Pointer[c_int] = ...) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class _NamedFuncPointer(_FuncPointer): @@ -120,34 +108,34 @@ class _NamedFuncPointer(_FuncPointer): class ArgumentError(Exception): ... def CFUNCTYPE( - restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... -) -> Type[_FuncPointer]: ... + restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ... +) -> type[_FuncPointer]: ... if sys.platform == "win32": def WINFUNCTYPE( - restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... - ) -> Type[_FuncPointer]: ... + restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ... + ) -> type[_FuncPointer]: ... -def PYFUNCTYPE(restype: Type[_CData] | None, *argtypes: Type[_CData]) -> Type[_FuncPointer]: ... +def PYFUNCTYPE(restype: type[_CData] | None, *argtypes: type[_CData]) -> type[_FuncPointer]: ... class _CArgObject: ... # Any type that can be implicitly converted to c_void_p when passed as a C function argument. # (bytes is not included here, see below.) -_CVoidPLike = _UnionT[_PointerLike, Array[Any], _CArgObject, int] +_CVoidPLike: TypeAlias = _PointerLike | Array[Any] | _CArgObject | int # Same as above, but including types known to be read-only (i. e. bytes). # This distinction is not strictly necessary (ctypes doesn't differentiate between const # and non-const pointers), but it catches errors like memmove(b'foo', buf, 4) # when memmove(buf, b'foo', 4) was intended. -_CVoidConstPLike = _UnionT[_CVoidPLike, bytes] +_CVoidConstPLike: TypeAlias = _CVoidPLike | bytes def addressof(obj: _CData) -> int: ... -def alignment(obj_or_type: _CData | Type[_CData]) -> int: ... +def alignment(obj_or_type: _CData | type[_CData]) -> int: ... def byref(obj: _CData, offset: int = ...) -> _CArgObject: ... _CastT = TypeVar("_CastT", bound=_CanCastTo) -def cast(obj: _CData | _CArgObject | int, typ: Type[_CastT]) -> _CastT: ... +def cast(obj: _CData | _CArgObject | int, typ: type[_CastT]) -> _CastT: ... def create_string_buffer(init: int | bytes, size: int | None = ...) -> Array[c_char]: ... c_buffer = create_string_buffer @@ -157,7 +145,7 @@ def create_unicode_buffer(init: int | str, size: int | None = ...) -> Array[c_wc if sys.platform == "win32": def DllCanUnloadNow() -> int: ... def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented - def FormatError(code: int) -> str: ... + def FormatError(code: int = ...) -> str: ... def GetLastError() -> int: ... def get_errno() -> int: ... @@ -165,33 +153,31 @@ def get_errno() -> int: ... if sys.platform == "win32": def get_last_error() -> int: ... -def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> None: ... -def memset(dst: _CVoidPLike, c: int, count: int) -> None: ... -def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ... +def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ... +def memset(dst: _CVoidPLike, c: int, count: int) -> int: ... +def POINTER(type: type[_CT]) -> type[_Pointer[_CT]]: ... -# The real ctypes.pointer is a function, not a class. The stub version of pointer behaves like -# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer, -# it can be instantiated directly (to mimic the behavior of the real pointer function). -class pointer(Generic[_CT], _PointerLike, _CData): - _type_: ClassVar[Type[_CT]] +class _Pointer(Generic[_CT], _PointerLike, _CData): + _type_: type[_CT] contents: _CT - def __init__(self, arg: _CT = ...) -> None: ... @overload - def __getitem__(self, i: int) -> _CT: ... + def __init__(self) -> None: ... @overload - def __getitem__(self, s: slice) -> list[_CT]: ... + def __init__(self, arg: _CT) -> None: ... @overload - def __setitem__(self, i: int, o: _CT) -> None: ... + def __getitem__(self, __i: int) -> Any: ... @overload - def __setitem__(self, s: slice, o: Iterable[_CT]) -> None: ... + def __getitem__(self, __s: slice) -> list[Any]: ... + def __setitem__(self, __i: int, __o: Any) -> None: ... +def pointer(__arg: _CT) -> _Pointer[_CT]: ... def resize(obj: _CData, size: int) -> None: ... def set_errno(value: int) -> int: ... if sys.platform == "win32": def set_last_error(value: int) -> int: ... -def sizeof(obj_or_type: _CData | Type[_CData]) -> int: ... +def sizeof(obj_or_type: _CData | type[_CData]) -> int: ... def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ... if sys.platform == "win32": @@ -201,14 +187,16 @@ def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ... class _SimpleCData(Generic[_T], _CData): value: _T - def __init__(self, value: _T = ...) -> None: ... + # The TypeVar can be unsolved here, + # but we can't use overloads without creating many, many mypy false-positive errors + def __init__(self, value: _T = ...) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] class c_byte(_SimpleCData[int]): ... class c_char(_SimpleCData[bytes]): - def __init__(self, value: int | bytes = ...) -> None: ... + def __init__(self, value: int | bytes | bytearray = ...) -> None: ... -class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]): +class c_char_p(_PointerLike, _SimpleCData[bytes | None]): def __init__(self, value: int | bytes | None = ...) -> None: ... class c_double(_SimpleCData[float]): ... @@ -233,10 +221,10 @@ class c_uint64(_SimpleCData[int]): ... class c_ulong(_SimpleCData[int]): ... class c_ulonglong(_SimpleCData[int]): ... class c_ushort(_SimpleCData[int]): ... -class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ... +class c_void_p(_PointerLike, _SimpleCData[int | None]): ... class c_wchar(_SimpleCData[str]): ... -class c_wchar_p(_PointerLike, _SimpleCData[Optional[str]]): +class c_wchar_p(_PointerLike, _SimpleCData[str | None]): def __init__(self, value: int | str | None = ...) -> None: ... class c_bool(_SimpleCData[bool]): @@ -252,7 +240,7 @@ class _CField: size: int class _StructUnionMeta(_CDataMeta): - _fields_: Sequence[Tuple[str, Type[_CData]] | Tuple[str, Type[_CData], int]] + _fields_: Sequence[tuple[str, type[_CData]] | tuple[str, type[_CData], int]] _pack_: int _anonymous_: Sequence[str] def __getattr__(self, name: str) -> _CField: ... @@ -268,9 +256,21 @@ class BigEndianStructure(Structure): ... class LittleEndianStructure(Structure): ... class Array(Generic[_CT], _CData): - _length_: ClassVar[int] - _type_: ClassVar[Type[_CT]] - raw: bytes # Note: only available if _CT == c_char + @property + @abstractmethod + def _length_(self) -> int: ... + @_length_.setter + def _length_(self, value: int) -> None: ... + @property + @abstractmethod + def _type_(self) -> type[_CT]: ... + @_type_.setter + def _type_(self, value: type[_CT]) -> None: ... + # Note: only available if _CT == c_char + @property + def raw(self) -> bytes: ... + @raw.setter + def raw(self, value: ReadableBuffer) -> None: ... value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise # TODO These methods cannot be annotated correctly at the moment. # All of these "Any"s stand for the array's element type, but it's not possible to use _CT @@ -286,13 +286,13 @@ class Array(Generic[_CT], _CData): # the array element type would belong are annotated with Any instead. def __init__(self, *args: Any) -> None: ... @overload - def __getitem__(self, i: int) -> Any: ... + def __getitem__(self, __i: int) -> Any: ... @overload - def __getitem__(self, s: slice) -> list[Any]: ... + def __getitem__(self, __s: slice) -> list[Any]: ... @overload - def __setitem__(self, i: int, o: Any) -> None: ... + def __setitem__(self, __i: int, __o: Any) -> None: ... @overload - def __setitem__(self, s: slice, o: Iterable[Any]) -> None: ... + def __setitem__(self, __s: slice, __o: Iterable[Any]) -> None: ... def __iter__(self) -> Iterator[Any]: ... # Can't inherit from Sized because the metaclass conflict between # Sized and _CData prevents using _CDataMeta. diff --git a/stdlib/ctypes/wintypes.pyi b/stdlib/ctypes/wintypes.pyi index c178a9b..3bd2793 100644 --- a/stdlib/ctypes/wintypes.pyi +++ b/stdlib/ctypes/wintypes.pyi @@ -1,6 +1,7 @@ from ctypes import ( Array, Structure, + _Pointer, _SimpleCData, c_byte, c_char, @@ -18,8 +19,8 @@ from ctypes import ( c_void_p, c_wchar, c_wchar_p, - pointer, ) +from typing_extensions import TypeAlias BYTE = c_byte WORD = c_ushort @@ -180,55 +181,55 @@ class WIN32_FIND_DATAW(Structure): cFileName: Array[WCHAR] cAlternateFileName: Array[WCHAR] -# These pointer type definitions use pointer[...] instead of POINTER(...), to allow them +# These pointer type definitions use _Pointer[...] instead of POINTER(...), to allow them # to be used in type annotations. -PBOOL = pointer[BOOL] -LPBOOL = pointer[BOOL] -PBOOLEAN = pointer[BOOLEAN] -PBYTE = pointer[BYTE] -LPBYTE = pointer[BYTE] -PCHAR = pointer[CHAR] -LPCOLORREF = pointer[COLORREF] -PDWORD = pointer[DWORD] -LPDWORD = pointer[DWORD] -PFILETIME = pointer[FILETIME] -LPFILETIME = pointer[FILETIME] -PFLOAT = pointer[FLOAT] -PHANDLE = pointer[HANDLE] -LPHANDLE = pointer[HANDLE] -PHKEY = pointer[HKEY] -LPHKL = pointer[HKL] -PINT = pointer[INT] -LPINT = pointer[INT] -PLARGE_INTEGER = pointer[LARGE_INTEGER] -PLCID = pointer[LCID] -PLONG = pointer[LONG] -LPLONG = pointer[LONG] -PMSG = pointer[MSG] -LPMSG = pointer[MSG] -PPOINT = pointer[POINT] -LPPOINT = pointer[POINT] -PPOINTL = pointer[POINTL] -PRECT = pointer[RECT] -LPRECT = pointer[RECT] -PRECTL = pointer[RECTL] -LPRECTL = pointer[RECTL] -LPSC_HANDLE = pointer[SC_HANDLE] -PSHORT = pointer[SHORT] -PSIZE = pointer[SIZE] -LPSIZE = pointer[SIZE] -PSIZEL = pointer[SIZEL] -LPSIZEL = pointer[SIZEL] -PSMALL_RECT = pointer[SMALL_RECT] -PUINT = pointer[UINT] -LPUINT = pointer[UINT] -PULARGE_INTEGER = pointer[ULARGE_INTEGER] -PULONG = pointer[ULONG] -PUSHORT = pointer[USHORT] -PWCHAR = pointer[WCHAR] -PWIN32_FIND_DATAA = pointer[WIN32_FIND_DATAA] -LPWIN32_FIND_DATAA = pointer[WIN32_FIND_DATAA] -PWIN32_FIND_DATAW = pointer[WIN32_FIND_DATAW] -LPWIN32_FIND_DATAW = pointer[WIN32_FIND_DATAW] -PWORD = pointer[WORD] -LPWORD = pointer[WORD] +PBOOL: TypeAlias = _Pointer[BOOL] +LPBOOL: TypeAlias = _Pointer[BOOL] +PBOOLEAN: TypeAlias = _Pointer[BOOLEAN] +PBYTE: TypeAlias = _Pointer[BYTE] +LPBYTE: TypeAlias = _Pointer[BYTE] +PCHAR: TypeAlias = _Pointer[CHAR] +LPCOLORREF: TypeAlias = _Pointer[COLORREF] +PDWORD: TypeAlias = _Pointer[DWORD] +LPDWORD: TypeAlias = _Pointer[DWORD] +PFILETIME: TypeAlias = _Pointer[FILETIME] +LPFILETIME: TypeAlias = _Pointer[FILETIME] +PFLOAT: TypeAlias = _Pointer[FLOAT] +PHANDLE: TypeAlias = _Pointer[HANDLE] +LPHANDLE: TypeAlias = _Pointer[HANDLE] +PHKEY: TypeAlias = _Pointer[HKEY] +LPHKL: TypeAlias = _Pointer[HKL] +PINT: TypeAlias = _Pointer[INT] +LPINT: TypeAlias = _Pointer[INT] +PLARGE_INTEGER: TypeAlias = _Pointer[LARGE_INTEGER] +PLCID: TypeAlias = _Pointer[LCID] +PLONG: TypeAlias = _Pointer[LONG] +LPLONG: TypeAlias = _Pointer[LONG] +PMSG: TypeAlias = _Pointer[MSG] +LPMSG: TypeAlias = _Pointer[MSG] +PPOINT: TypeAlias = _Pointer[POINT] +LPPOINT: TypeAlias = _Pointer[POINT] +PPOINTL: TypeAlias = _Pointer[POINTL] +PRECT: TypeAlias = _Pointer[RECT] +LPRECT: TypeAlias = _Pointer[RECT] +PRECTL: TypeAlias = _Pointer[RECTL] +LPRECTL: TypeAlias = _Pointer[RECTL] +LPSC_HANDLE: TypeAlias = _Pointer[SC_HANDLE] +PSHORT: TypeAlias = _Pointer[SHORT] +PSIZE: TypeAlias = _Pointer[SIZE] +LPSIZE: TypeAlias = _Pointer[SIZE] +PSIZEL: TypeAlias = _Pointer[SIZEL] +LPSIZEL: TypeAlias = _Pointer[SIZEL] +PSMALL_RECT: TypeAlias = _Pointer[SMALL_RECT] +PUINT: TypeAlias = _Pointer[UINT] +LPUINT: TypeAlias = _Pointer[UINT] +PULARGE_INTEGER: TypeAlias = _Pointer[ULARGE_INTEGER] +PULONG: TypeAlias = _Pointer[ULONG] +PUSHORT: TypeAlias = _Pointer[USHORT] +PWCHAR: TypeAlias = _Pointer[WCHAR] +PWIN32_FIND_DATAA: TypeAlias = _Pointer[WIN32_FIND_DATAA] +LPWIN32_FIND_DATAA: TypeAlias = _Pointer[WIN32_FIND_DATAA] +PWIN32_FIND_DATAW: TypeAlias = _Pointer[WIN32_FIND_DATAW] +LPWIN32_FIND_DATAW: TypeAlias = _Pointer[WIN32_FIND_DATAW] +PWORD: TypeAlias = _Pointer[WORD] +LPWORD: TypeAlias = _Pointer[WORD] diff --git a/stdlib/curses/__init__.pyi b/stdlib/curses/__init__.pyi index 73e84fb..db44fa6 100644 --- a/stdlib/curses/__init__.pyi +++ b/stdlib/curses/__init__.pyi @@ -1,15 +1,21 @@ -from _curses import * # noqa: F403 -from _curses import _CursesWindow as _CursesWindow -from typing import Any, Callable, TypeVar +import sys +from collections.abc import Callable +from typing import TypeVar +from typing_extensions import Concatenate, ParamSpec -_T = TypeVar("_T") +if sys.platform != "win32": + from _curses import * + from _curses import _CursesWindow as _CursesWindow -# available after calling `curses.initscr()` -LINES: int -COLS: int + _T = TypeVar("_T") + _P = ParamSpec("_P") -# available after calling `curses.start_color()` -COLORS: int -COLOR_PAIRS: int + # available after calling `curses.initscr()` + LINES: int + COLS: int -def wrapper(__func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ... + # available after calling `curses.start_color()` + COLORS: int + COLOR_PAIRS: int + + def wrapper(__func: Callable[Concatenate[_CursesWindow, _P], _T], *arg: _P.args, **kwds: _P.kwargs) -> _T: ... diff --git a/stdlib/curses/ascii.pyi b/stdlib/curses/ascii.pyi index 66efbe3..25de8f6 100644 --- a/stdlib/curses/ascii.pyi +++ b/stdlib/curses/ascii.pyi @@ -1,62 +1,63 @@ +import sys from typing import TypeVar -_CharT = TypeVar("_CharT", str, int) +if sys.platform != "win32": + _CharT = TypeVar("_CharT", str, int) -NUL: int -SOH: int -STX: int -ETX: int -EOT: int -ENQ: int -ACK: int -BEL: int -BS: int -TAB: int -HT: int -LF: int -NL: int -VT: int -FF: int -CR: int -SO: int -SI: int -DLE: int -DC1: int -DC2: int -DC3: int -DC4: int -NAK: int -SYN: int -ETB: int -CAN: int -EM: int -SUB: int -ESC: int -FS: int -GS: int -RS: int -US: int -SP: int -DEL: int + NUL: int + SOH: int + STX: int + ETX: int + EOT: int + ENQ: int + ACK: int + BEL: int + BS: int + TAB: int + HT: int + LF: int + NL: int + VT: int + FF: int + CR: int + SO: int + SI: int + DLE: int + DC1: int + DC2: int + DC3: int + DC4: int + NAK: int + SYN: int + ETB: int + CAN: int + EM: int + SUB: int + ESC: int + FS: int + GS: int + RS: int + US: int + SP: int + DEL: int -controlnames: list[int] - -def isalnum(c: str | int) -> bool: ... -def isalpha(c: str | int) -> bool: ... -def isascii(c: str | int) -> bool: ... -def isblank(c: str | int) -> bool: ... -def iscntrl(c: str | int) -> bool: ... -def isdigit(c: str | int) -> bool: ... -def isgraph(c: str | int) -> bool: ... -def islower(c: str | int) -> bool: ... -def isprint(c: str | int) -> bool: ... -def ispunct(c: str | int) -> bool: ... -def isspace(c: str | int) -> bool: ... -def isupper(c: str | int) -> bool: ... -def isxdigit(c: str | int) -> bool: ... -def isctrl(c: str | int) -> bool: ... -def ismeta(c: str | int) -> bool: ... -def ascii(c: _CharT) -> _CharT: ... -def ctrl(c: _CharT) -> _CharT: ... -def alt(c: _CharT) -> _CharT: ... -def unctrl(c: str | int) -> str: ... + controlnames: list[int] + def isalnum(c: str | int) -> bool: ... + def isalpha(c: str | int) -> bool: ... + def isascii(c: str | int) -> bool: ... + def isblank(c: str | int) -> bool: ... + def iscntrl(c: str | int) -> bool: ... + def isdigit(c: str | int) -> bool: ... + def isgraph(c: str | int) -> bool: ... + def islower(c: str | int) -> bool: ... + def isprint(c: str | int) -> bool: ... + def ispunct(c: str | int) -> bool: ... + def isspace(c: str | int) -> bool: ... + def isupper(c: str | int) -> bool: ... + def isxdigit(c: str | int) -> bool: ... + def isctrl(c: str | int) -> bool: ... + def ismeta(c: str | int) -> bool: ... + def ascii(c: _CharT) -> _CharT: ... + def ctrl(c: _CharT) -> _CharT: ... + def alt(c: _CharT) -> _CharT: ... + def unctrl(c: str | int) -> str: ... diff --git a/stdlib/curses/has_key.pyi b/stdlib/curses/has_key.pyi new file mode 100644 index 0000000..ff728ae --- /dev/null +++ b/stdlib/curses/has_key.pyi @@ -0,0 +1,4 @@ +import sys + +if sys.platform != "win32": + def has_key(ch: int | str) -> bool: ... diff --git a/stdlib/curses/panel.pyi b/stdlib/curses/panel.pyi index 138e4a9..3080379 100644 --- a/stdlib/curses/panel.pyi +++ b/stdlib/curses/panel.pyi @@ -1,20 +1,25 @@ -from _curses import _CursesWindow +import sys -class _Curses_Panel: # type is (note the space in the class name) - def above(self) -> _Curses_Panel: ... - def below(self) -> _Curses_Panel: ... - def bottom(self) -> None: ... - def hidden(self) -> bool: ... - def hide(self) -> None: ... - def move(self, y: int, x: int) -> None: ... - def replace(self, win: _CursesWindow) -> None: ... - def set_userptr(self, obj: object) -> None: ... - def show(self) -> None: ... - def top(self) -> None: ... - def userptr(self) -> object: ... - def window(self) -> _CursesWindow: ... +if sys.platform != "win32": + from _curses import _CursesWindow -def bottom_panel() -> _Curses_Panel: ... -def new_panel(__win: _CursesWindow) -> _Curses_Panel: ... -def top_panel() -> _Curses_Panel: ... -def update_panels() -> _Curses_Panel: ... + version: str + + class _Curses_Panel: # type is (note the space in the class name) + def above(self) -> _Curses_Panel: ... + def below(self) -> _Curses_Panel: ... + def bottom(self) -> None: ... + def hidden(self) -> bool: ... + def hide(self) -> None: ... + def move(self, y: int, x: int) -> None: ... + def replace(self, win: _CursesWindow) -> None: ... + def set_userptr(self, obj: object) -> None: ... + def show(self) -> None: ... + def top(self) -> None: ... + def userptr(self) -> object: ... + def window(self) -> _CursesWindow: ... + + def bottom_panel() -> _Curses_Panel: ... + def new_panel(__win: _CursesWindow) -> _Curses_Panel: ... + def top_panel() -> _Curses_Panel: ... + def update_panels() -> _Curses_Panel: ... diff --git a/stdlib/curses/textpad.pyi b/stdlib/curses/textpad.pyi index 578a579..ad99834 100644 --- a/stdlib/curses/textpad.pyi +++ b/stdlib/curses/textpad.pyi @@ -1,11 +1,13 @@ -from _curses import _CursesWindow -from typing import Callable +import sys +from collections.abc import Callable -def rectangle(win: _CursesWindow, uly: int, ulx: int, lry: int, lrx: int) -> None: ... +if sys.platform != "win32": + from _curses import _CursesWindow + def rectangle(win: _CursesWindow, uly: int, ulx: int, lry: int, lrx: int) -> None: ... -class Textbox: - stripspaces: bool - def __init__(self, win: _CursesWindow, insert_mode: bool = ...) -> None: ... - def edit(self, validate: Callable[[int], int] | None = ...) -> str: ... - def do_command(self, ch: str | int) -> None: ... - def gather(self) -> str: ... + class Textbox: + stripspaces: bool + def __init__(self, win: _CursesWindow, insert_mode: bool = ...) -> None: ... + def edit(self, validate: Callable[[int], int] | None = ...) -> str: ... + def do_command(self, ch: str | int) -> None: ... + def gather(self) -> str: ... diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index b6b76af..560147f 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -1,7 +1,10 @@ +import enum import sys import types -from typing import Any, Callable, Generic, Iterable, Mapping, Tuple, Type, TypeVar, overload -from typing_extensions import Protocol +from builtins import type as Type # alias to avoid name clashes with fields named "type" +from collections.abc import Callable, Iterable, Mapping +from typing import Any, Generic, Protocol, TypeVar, overload +from typing_extensions import Literal, TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias @@ -9,9 +12,33 @@ if sys.version_info >= (3, 9): _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) -class _MISSING_TYPE: ... +__all__ = [ + "dataclass", + "field", + "Field", + "FrozenInstanceError", + "InitVar", + "MISSING", + "fields", + "asdict", + "astuple", + "make_dataclass", + "replace", + "is_dataclass", +] -MISSING: _MISSING_TYPE +if sys.version_info >= (3, 10): + __all__ += ["KW_ONLY"] + +# define _MISSING_TYPE as an enum within the type stubs, +# even though that is not really its type at runtime +# this allows us to use Literal[_MISSING_TYPE.MISSING] +# for background, see: +# https://github.com/python/typeshed/pull/5900#issuecomment-895513797 +class _MISSING_TYPE(enum.Enum): + MISSING = enum.auto() + +MISSING = _MISSING_TYPE.MISSING if sys.version_info >= (3, 10): class KW_ONLY: ... @@ -19,17 +46,26 @@ if sys.version_info >= (3, 10): @overload def asdict(obj: Any) -> dict[str, Any]: ... @overload -def asdict(obj: Any, *, dict_factory: Callable[[list[Tuple[str, Any]]], _T]) -> _T: ... +def asdict(obj: Any, *, dict_factory: Callable[[list[tuple[str, Any]]], _T]) -> _T: ... @overload -def astuple(obj: Any) -> Tuple[Any, ...]: ... +def astuple(obj: Any) -> tuple[Any, ...]: ... @overload def astuple(obj: Any, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ... -if sys.version_info >= (3, 10): +if sys.version_info >= (3, 8): + # cls argument is now positional-only + @overload + def dataclass(__cls: type[_T]) -> type[_T]: ... @overload - def dataclass(__cls: Type[_T]) -> Type[_T]: ... + def dataclass(__cls: None) -> Callable[[type[_T]], type[_T]]: ... + +else: + @overload + def dataclass(_cls: type[_T]) -> type[_T]: ... @overload - def dataclass(__cls: None) -> Callable[[Type[_T]], Type[_T]]: ... + def dataclass(_cls: None) -> Callable[[type[_T]], type[_T]]: ... + +if sys.version_info >= (3, 11): @overload def dataclass( *, @@ -42,28 +78,29 @@ if sys.version_info >= (3, 10): match_args: bool = ..., kw_only: bool = ..., slots: bool = ..., - ) -> Callable[[Type[_T]], Type[_T]]: ... + weakref_slot: bool = ..., + ) -> Callable[[type[_T]], type[_T]]: ... -elif sys.version_info >= (3, 8): - # cls argument is now positional-only - @overload - def dataclass(__cls: Type[_T]) -> Type[_T]: ... - @overload - def dataclass(__cls: None) -> Callable[[Type[_T]], Type[_T]]: ... +elif sys.version_info >= (3, 10): @overload def dataclass( - *, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ... - ) -> Callable[[Type[_T]], Type[_T]]: ... + *, + init: bool = ..., + repr: bool = ..., + eq: bool = ..., + order: bool = ..., + unsafe_hash: bool = ..., + frozen: bool = ..., + match_args: bool = ..., + kw_only: bool = ..., + slots: bool = ..., + ) -> Callable[[type[_T]], type[_T]]: ... else: - @overload - def dataclass(_cls: Type[_T]) -> Type[_T]: ... - @overload - def dataclass(_cls: None) -> Callable[[Type[_T]], Type[_T]]: ... @overload def dataclass( *, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ... - ) -> Callable[[Type[_T]], Type[_T]]: ... + ) -> Callable[[type[_T]], type[_T]]: ... # See https://github.com/python/mypy/issues/10750 class _DefaultFactory(Protocol[_T_co]): @@ -72,15 +109,15 @@ class _DefaultFactory(Protocol[_T_co]): class Field(Generic[_T]): name: str type: Type[_T] - default: _T - default_factory: _DefaultFactory[_T] + default: _T | Literal[_MISSING_TYPE.MISSING] + default_factory: _DefaultFactory[_T] | Literal[_MISSING_TYPE.MISSING] repr: bool hash: bool | None init: bool compare: bool metadata: types.MappingProxyType[Any, Any] if sys.version_info >= (3, 10): - kw_only: bool + kw_only: bool | Literal[_MISSING_TYPE.MISSING] def __init__( self, default: _T, @@ -103,6 +140,8 @@ class Field(Generic[_T]): compare: bool, metadata: Mapping[Any, Any], ) -> None: ... + + def __set_name__(self, owner: Type[Any], name: str) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -173,12 +212,19 @@ else: metadata: Mapping[Any, Any] | None = ..., ) -> Any: ... -def fields(class_or_instance: Any) -> Tuple[Field[Any], ...]: ... +def fields(class_or_instance: Any) -> tuple[Field[Any], ...]: ... def is_dataclass(obj: Any) -> bool: ... class FrozenInstanceError(AttributeError): ... -class InitVar(Generic[_T]): +if sys.version_info >= (3, 9): + _InitVarMeta: TypeAlias = type +else: + class _InitVarMeta(type): + # Not used, instead `InitVar.__class_getitem__` is called. + def __getitem__(self, params: Any) -> InitVar[Any]: ... + +class InitVar(Generic[_T], metaclass=_InitVarMeta): type: Type[_T] def __init__(self, type: Type[_T]) -> None: ... if sys.version_info >= (3, 9): @@ -187,12 +233,12 @@ class InitVar(Generic[_T]): @overload def __class_getitem__(cls, type: Any) -> InitVar[Any]: ... -if sys.version_info >= (3, 10): +if sys.version_info >= (3, 11): def make_dataclass( cls_name: str, - fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]], + fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, - bases: Tuple[type, ...] = ..., + bases: tuple[type, ...] = ..., namespace: dict[str, Any] | None = ..., init: bool = ..., repr: bool = ..., @@ -201,15 +247,35 @@ if sys.version_info >= (3, 10): unsafe_hash: bool = ..., frozen: bool = ..., match_args: bool = ..., + kw_only: bool = ..., + slots: bool = ..., + weakref_slot: bool = ..., + ) -> type: ... + +elif sys.version_info >= (3, 10): + def make_dataclass( + cls_name: str, + fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], + *, + bases: tuple[type, ...] = ..., + namespace: dict[str, Any] | None = ..., + init: bool = ..., + repr: bool = ..., + eq: bool = ..., + order: bool = ..., + unsafe_hash: bool = ..., + frozen: bool = ..., + match_args: bool = ..., + kw_only: bool = ..., slots: bool = ..., ) -> type: ... else: def make_dataclass( cls_name: str, - fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]], + fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, - bases: Tuple[type, ...] = ..., + bases: tuple[type, ...] = ..., namespace: dict[str, Any] | None = ..., init: bool = ..., repr: bool = ..., diff --git a/stdlib/datetime.pyi b/stdlib/datetime.pyi index 22782d9..b1b3c17 100644 --- a/stdlib/datetime.pyi +++ b/stdlib/datetime.pyi @@ -1,27 +1,44 @@ import sys +from _typeshed import Self +from abc import abstractmethod from time import struct_time -from typing import ClassVar, NamedTuple, SupportsAbs, Tuple, Type, TypeVar, overload +from typing import ClassVar, NamedTuple, NoReturn, TypeVar, overload +from typing_extensions import Literal, TypeAlias, final -_S = TypeVar("_S") +if sys.version_info >= (3, 11): + __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC") +elif sys.version_info >= (3, 9): + __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR") -MINYEAR: int -MAXYEAR: int +_D = TypeVar("_D", bound=date) + +MINYEAR: Literal[1] +MAXYEAR: Literal[9999] class tzinfo: - def tzname(self, dt: datetime | None) -> str | None: ... - def utcoffset(self, dt: datetime | None) -> timedelta | None: ... - def dst(self, dt: datetime | None) -> timedelta | None: ... - def fromutc(self, dt: datetime) -> datetime: ... + @abstractmethod + def tzname(self, __dt: datetime | None) -> str | None: ... + @abstractmethod + def utcoffset(self, __dt: datetime | None) -> timedelta | None: ... + @abstractmethod + def dst(self, __dt: datetime | None) -> timedelta | None: ... + def fromutc(self, __dt: datetime) -> datetime: ... # Alias required to avoid name conflicts with date(time).tzinfo. -_tzinfo = tzinfo +_TzInfo: TypeAlias = tzinfo +@final class timezone(tzinfo): utc: ClassVar[timezone] min: ClassVar[timezone] max: ClassVar[timezone] def __init__(self, offset: timedelta, name: str = ...) -> None: ... - def __hash__(self) -> int: ... + def tzname(self, __dt: datetime | None) -> str: ... + def utcoffset(self, __dt: datetime | None) -> timedelta: ... + def dst(self, __dt: datetime | None) -> None: ... + +if sys.version_info >= (3, 11): + UTC: timezone if sys.version_info >= (3, 9): class _IsoCalendarDate(NamedTuple): @@ -33,19 +50,19 @@ class date: min: ClassVar[date] max: ClassVar[date] resolution: ClassVar[timedelta] - def __new__(cls: Type[_S], year: int, month: int, day: int) -> _S: ... + def __new__(cls: type[Self], year: int, month: int, day: int) -> Self: ... @classmethod - def fromtimestamp(cls: Type[_S], __timestamp: float) -> _S: ... + def fromtimestamp(cls: type[Self], __timestamp: float) -> Self: ... @classmethod - def today(cls: Type[_S]) -> _S: ... + def today(cls: type[Self]) -> Self: ... @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... - if sys.version_info >= (3, 7): - @classmethod - def fromisoformat(cls: Type[_S], date_string: str) -> _S: ... + def fromordinal(cls: type[Self], __n: int) -> Self: ... + @classmethod + def fromisoformat(cls: type[Self], __date_string: str) -> Self: ... if sys.version_info >= (3, 8): @classmethod - def fromisocalendar(cls: Type[_S], year: int, week: int, day: int) -> _S: ... + def fromisocalendar(cls: type[Self], year: int, week: int, day: int) -> Self: ... + @property def year(self) -> int: ... @property @@ -53,48 +70,57 @@ class date: @property def day(self) -> int: ... def ctime(self) -> str: ... - def strftime(self, fmt: str) -> str: ... - def __format__(self, fmt: str) -> str: ... + def strftime(self, __format: str) -> str: ... + def __format__(self, __fmt: str) -> str: ... def isoformat(self) -> str: ... def timetuple(self) -> struct_time: ... def toordinal(self) -> int: ... - def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ... - def __le__(self, other: date) -> bool: ... - def __lt__(self, other: date) -> bool: ... - def __ge__(self, other: date) -> bool: ... - def __gt__(self, other: date) -> bool: ... + def replace(self: Self, year: int = ..., month: int = ..., day: int = ...) -> Self: ... + def __le__(self, __other: date) -> bool: ... + def __lt__(self, __other: date) -> bool: ... + def __ge__(self, __other: date) -> bool: ... + def __gt__(self, __other: date) -> bool: ... if sys.version_info >= (3, 8): - def __add__(self: _S, other: timedelta) -> _S: ... - def __radd__(self: _S, other: timedelta) -> _S: ... + def __add__(self: Self, __other: timedelta) -> Self: ... + def __radd__(self: Self, __other: timedelta) -> Self: ... + @overload + def __sub__(self: Self, __other: timedelta) -> Self: ... + @overload + def __sub__(self, __other: datetime) -> NoReturn: ... + @overload + def __sub__(self: _D, __other: _D) -> timedelta: ... else: - def __add__(self, other: timedelta) -> date: ... - def __radd__(self, other: timedelta) -> date: ... - @overload - def __sub__(self, other: timedelta) -> date: ... - @overload - def __sub__(self, other: date) -> timedelta: ... - def __hash__(self) -> int: ... + # Prior to Python 3.8, arithmetic operations always returned `date`, even in subclasses + def __add__(self, __other: timedelta) -> date: ... + def __radd__(self, __other: timedelta) -> date: ... + @overload + def __sub__(self, __other: timedelta) -> date: ... + @overload + def __sub__(self, __other: datetime) -> NoReturn: ... + @overload + def __sub__(self, __other: date) -> timedelta: ... + def weekday(self) -> int: ... def isoweekday(self) -> int: ... if sys.version_info >= (3, 9): def isocalendar(self) -> _IsoCalendarDate: ... else: - def isocalendar(self) -> Tuple[int, int, int]: ... + def isocalendar(self) -> tuple[int, int, int]: ... class time: min: ClassVar[time] max: ClassVar[time] resolution: ClassVar[timedelta] def __new__( - cls: Type[_S], + cls: type[Self], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: _tzinfo | None = ..., + tzinfo: _TzInfo | None = ..., *, fold: int = ..., - ) -> _S: ... + ) -> Self: ... @property def hour(self) -> int: ... @property @@ -104,43 +130,41 @@ class time: @property def microsecond(self) -> int: ... @property - def tzinfo(self) -> _tzinfo | None: ... + def tzinfo(self) -> _TzInfo | None: ... @property def fold(self) -> int: ... - def __le__(self, other: time) -> bool: ... - def __lt__(self, other: time) -> bool: ... - def __ge__(self, other: time) -> bool: ... - def __gt__(self, other: time) -> bool: ... - def __hash__(self) -> int: ... + def __le__(self, __other: time) -> bool: ... + def __lt__(self, __other: time) -> bool: ... + def __ge__(self, __other: time) -> bool: ... + def __gt__(self, __other: time) -> bool: ... def isoformat(self, timespec: str = ...) -> str: ... - if sys.version_info >= (3, 7): - @classmethod - def fromisoformat(cls: Type[_S], time_string: str) -> _S: ... - def strftime(self, fmt: str) -> str: ... - def __format__(self, fmt: str) -> str: ... + @classmethod + def fromisoformat(cls: type[Self], __time_string: str) -> Self: ... + def strftime(self, __format: str) -> str: ... + def __format__(self, __fmt: str) -> str: ... def utcoffset(self) -> timedelta | None: ... def tzname(self) -> str | None: ... def dst(self) -> timedelta | None: ... def replace( - self, + self: Self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: _tzinfo | None = ..., + tzinfo: _TzInfo | None = ..., *, fold: int = ..., - ) -> time: ... + ) -> Self: ... -_date = date -_time = time +_Date: TypeAlias = date +_Time: TypeAlias = time -class timedelta(SupportsAbs[timedelta]): +class timedelta: min: ClassVar[timedelta] max: ClassVar[timedelta] resolution: ClassVar[timedelta] def __new__( - cls: Type[_S], + cls: type[Self], days: float = ..., seconds: float = ..., microseconds: float = ..., @@ -148,7 +172,7 @@ class timedelta(SupportsAbs[timedelta]): minutes: float = ..., hours: float = ..., weeks: float = ..., - ) -> _S: ... + ) -> Self: ... @property def days(self) -> int: ... @property @@ -156,38 +180,36 @@ class timedelta(SupportsAbs[timedelta]): @property def microseconds(self) -> int: ... def total_seconds(self) -> float: ... - def __add__(self, other: timedelta) -> timedelta: ... - def __radd__(self, other: timedelta) -> timedelta: ... - def __sub__(self, other: timedelta) -> timedelta: ... - def __rsub__(self, other: timedelta) -> timedelta: ... + def __add__(self, __other: timedelta) -> timedelta: ... + def __radd__(self, __other: timedelta) -> timedelta: ... + def __sub__(self, __other: timedelta) -> timedelta: ... + def __rsub__(self, __other: timedelta) -> timedelta: ... def __neg__(self) -> timedelta: ... def __pos__(self) -> timedelta: ... def __abs__(self) -> timedelta: ... - def __mul__(self, other: float) -> timedelta: ... - def __rmul__(self, other: float) -> timedelta: ... + def __mul__(self, __other: float) -> timedelta: ... + def __rmul__(self, __other: float) -> timedelta: ... @overload - def __floordiv__(self, other: timedelta) -> int: ... + def __floordiv__(self, __other: timedelta) -> int: ... @overload - def __floordiv__(self, other: int) -> timedelta: ... + def __floordiv__(self, __other: int) -> timedelta: ... @overload - def __truediv__(self, other: timedelta) -> float: ... + def __truediv__(self, __other: timedelta) -> float: ... @overload - def __truediv__(self, other: float) -> timedelta: ... - def __mod__(self, other: timedelta) -> timedelta: ... - def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ... - def __le__(self, other: timedelta) -> bool: ... - def __lt__(self, other: timedelta) -> bool: ... - def __ge__(self, other: timedelta) -> bool: ... - def __gt__(self, other: timedelta) -> bool: ... + def __truediv__(self, __other: float) -> timedelta: ... + def __mod__(self, __other: timedelta) -> timedelta: ... + def __divmod__(self, __other: timedelta) -> tuple[int, timedelta]: ... + def __le__(self, __other: timedelta) -> bool: ... + def __lt__(self, __other: timedelta) -> bool: ... + def __ge__(self, __other: timedelta) -> bool: ... + def __gt__(self, __other: timedelta) -> bool: ... def __bool__(self) -> bool: ... - def __hash__(self) -> int: ... class datetime(date): min: ClassVar[datetime] max: ClassVar[datetime] - resolution: ClassVar[timedelta] def __new__( - cls: Type[_S], + cls: type[Self], year: int, month: int, day: int, @@ -195,16 +217,10 @@ class datetime(date): minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: _tzinfo | None = ..., + tzinfo: _TzInfo | None = ..., *, fold: int = ..., - ) -> _S: ... - @property - def year(self) -> int: ... - @property - def month(self) -> int: ... - @property - def day(self) -> int: ... + ) -> Self: ... @property def hour(self) -> int: ... @property @@ -214,45 +230,38 @@ class datetime(date): @property def microsecond(self) -> int: ... @property - def tzinfo(self) -> _tzinfo | None: ... + def tzinfo(self) -> _TzInfo | None: ... @property def fold(self) -> int: ... + # The first parameter in `fromtimestamp` is actually positional-or-keyword, + # but it is named "timestamp" in the C implementation and "t" in the Python implementation, + # so it is only truly *safe* to pass it as a positional argument. @classmethod - def fromtimestamp(cls: Type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ... - @classmethod - def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ... - @classmethod - def today(cls: Type[_S]) -> _S: ... + def fromtimestamp(cls: type[Self], __timestamp: float, tz: _TzInfo | None = ...) -> Self: ... @classmethod - def fromordinal(cls: Type[_S], n: int) -> _S: ... + def utcfromtimestamp(cls: type[Self], __t: float) -> Self: ... if sys.version_info >= (3, 8): @classmethod - def now(cls: Type[_S], tz: _tzinfo | None = ...) -> _S: ... + def now(cls: type[Self], tz: _TzInfo | None = ...) -> Self: ... else: @overload @classmethod - def now(cls: Type[_S], tz: None = ...) -> _S: ... + def now(cls: type[Self], tz: None = ...) -> Self: ... @overload @classmethod - def now(cls, tz: _tzinfo) -> datetime: ... + def now(cls, tz: _TzInfo) -> datetime: ... + @classmethod - def utcnow(cls: Type[_S]) -> _S: ... + def utcnow(cls: type[Self]) -> Self: ... @classmethod - def combine(cls, date: _date, time: _time, tzinfo: _tzinfo | None = ...) -> datetime: ... - if sys.version_info >= (3, 7): - @classmethod - def fromisoformat(cls: Type[_S], date_string: str) -> _S: ... - def strftime(self, fmt: str) -> str: ... - def __format__(self, fmt: str) -> str: ... - def toordinal(self) -> int: ... - def timetuple(self) -> struct_time: ... + def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo | None = ...) -> datetime: ... def timestamp(self) -> float: ... def utctimetuple(self) -> struct_time: ... - def date(self) -> _date: ... - def time(self) -> _time: ... - def timetz(self) -> _time: ... + def date(self) -> _Date: ... + def time(self) -> _Time: ... + def timetz(self) -> _Time: ... def replace( - self, + self: Self, year: int = ..., month: int = ..., day: int = ..., @@ -260,39 +269,35 @@ class datetime(date): minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: _tzinfo | None = ..., + tzinfo: _TzInfo | None = ..., *, fold: int = ..., - ) -> datetime: ... + ) -> Self: ... if sys.version_info >= (3, 8): - def astimezone(self: _S, tz: _tzinfo | None = ...) -> _S: ... + def astimezone(self: Self, tz: _TzInfo | None = ...) -> Self: ... else: - def astimezone(self, tz: _tzinfo | None = ...) -> datetime: ... - def ctime(self) -> str: ... + def astimezone(self, tz: _TzInfo | None = ...) -> datetime: ... + def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ... @classmethod - def strptime(cls, date_string: str, format: str) -> datetime: ... + def strptime(cls, __date_string: str, __format: str) -> datetime: ... def utcoffset(self) -> timedelta | None: ... def tzname(self) -> str | None: ... def dst(self) -> timedelta | None: ... - def __le__(self, other: datetime) -> bool: ... # type: ignore - def __lt__(self, other: datetime) -> bool: ... # type: ignore - def __ge__(self, other: datetime) -> bool: ... # type: ignore - def __gt__(self, other: datetime) -> bool: ... # type: ignore + def __le__(self, __other: datetime) -> bool: ... # type: ignore[override] + def __lt__(self, __other: datetime) -> bool: ... # type: ignore[override] + def __ge__(self, __other: datetime) -> bool: ... # type: ignore[override] + def __gt__(self, __other: datetime) -> bool: ... # type: ignore[override] if sys.version_info >= (3, 8): - def __add__(self: _S, other: timedelta) -> _S: ... - def __radd__(self: _S, other: timedelta) -> _S: ... - else: - def __add__(self, other: timedelta) -> datetime: ... - def __radd__(self, other: timedelta) -> datetime: ... - @overload # type: ignore - def __sub__(self, other: datetime) -> timedelta: ... - @overload - def __sub__(self, other: timedelta) -> datetime: ... - def __hash__(self) -> int: ... - def weekday(self) -> int: ... - def isoweekday(self) -> int: ... - if sys.version_info >= (3, 9): - def isocalendar(self) -> _IsoCalendarDate: ... + @overload # type: ignore[override] + def __sub__(self: Self, __other: timedelta) -> Self: ... + @overload + def __sub__(self: _D, __other: _D) -> timedelta: ... else: - def isocalendar(self) -> Tuple[int, int, int]: ... + # Prior to Python 3.8, arithmetic operations always returned `datetime`, even in subclasses + def __add__(self, __other: timedelta) -> datetime: ... + def __radd__(self, __other: timedelta) -> datetime: ... + @overload # type: ignore[override] + def __sub__(self, __other: datetime) -> timedelta: ... + @overload + def __sub__(self, __other: timedelta) -> datetime: ... diff --git a/stdlib/dbm/__init__.pyi b/stdlib/dbm/__init__.pyi index 9b9f92c..33b8aab 100644 --- a/stdlib/dbm/__init__.pyi +++ b/stdlib/dbm/__init__.pyi @@ -1,11 +1,13 @@ from _typeshed import Self +from collections.abc import Iterator, MutableMapping from types import TracebackType -from typing import Iterator, MutableMapping, Tuple, Type, Union -from typing_extensions import Literal +from typing_extensions import Literal, TypeAlias -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] -_TFlags = Literal[ +__all__ = ["open", "whichdb", "error"] + +_KeyType: TypeAlias = str | bytes +_ValueType: TypeAlias = str | bytes | bytearray +_TFlags: TypeAlias = Literal[ "r", "w", "c", @@ -82,12 +84,12 @@ class _Database(MutableMapping[_KeyType, bytes]): def __del__(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... class _error(Exception): ... -error = Tuple[Type[_error], Type[OSError]] +error: tuple[type[_error], type[OSError]] def whichdb(filename: str) -> str: ... def open(file: str, flag: _TFlags = ..., mode: int = ...) -> _Database: ... diff --git a/stdlib/dbm/dumb.pyi b/stdlib/dbm/dumb.pyi index 0a941b0..738e689 100644 --- a/stdlib/dbm/dumb.pyi +++ b/stdlib/dbm/dumb.pyi @@ -1,26 +1,32 @@ from _typeshed import Self +from collections.abc import Iterator, MutableMapping from types import TracebackType -from typing import Iterator, MutableMapping, Type, Union +from typing_extensions import TypeAlias -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] +__all__ = ["error", "open"] + +_KeyType: TypeAlias = str | bytes +_ValueType: TypeAlias = str | bytes error = OSError +# This class doesn't exist at runtime. open() can return an instance of +# any of the three implementations of dbm (dumb, gnu, ndbm), and this +# class is intended to represent the common interface supported by all three. class _Database(MutableMapping[_KeyType, bytes]): def __init__(self, filebasename: str, mode: str, flag: str = ...) -> None: ... def sync(self) -> None: ... def iterkeys(self) -> Iterator[bytes]: ... # undocumented def close(self) -> None: ... def __getitem__(self, key: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... + def __setitem__(self, key: _KeyType, val: _ValueType) -> None: ... def __delitem__(self, key: _KeyType) -> None: ... def __iter__(self) -> Iterator[bytes]: ... def __len__(self) -> int: ... def __del__(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ... diff --git a/stdlib/dbm/gnu.pyi b/stdlib/dbm/gnu.pyi index 7cec827..93b9df1 100644 --- a/stdlib/dbm/gnu.pyi +++ b/stdlib/dbm/gnu.pyi @@ -1,37 +1,40 @@ -from _typeshed import Self +import sys +from _typeshed import ReadOnlyBuffer, Self from types import TracebackType -from typing import Type, TypeVar, Union, overload +from typing import TypeVar, overload +from typing_extensions import TypeAlias -_T = TypeVar("_T") -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] +if sys.platform != "win32": + _T = TypeVar("_T") + _KeyType: TypeAlias = str | ReadOnlyBuffer + _ValueType: TypeAlias = str | ReadOnlyBuffer -class error(OSError): ... + open_flags: str -# Actual typename gdbm, not exposed by the implementation -class _gdbm: - def firstkey(self) -> bytes | None: ... - def nextkey(self, key: _KeyType) -> bytes | None: ... - def reorganize(self) -> None: ... - def sync(self) -> None: ... - def close(self) -> None: ... - def __getitem__(self, item: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __contains__(self, key: _KeyType) -> bool: ... - def __len__(self) -> int: ... - def __enter__(self: Self) -> Self: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - @overload - def get(self, k: _KeyType) -> bytes | None: ... - @overload - def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> list[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - -def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _gdbm: ... + class error(OSError): ... + # Actual typename gdbm, not exposed by the implementation + class _gdbm: + def firstkey(self) -> bytes | None: ... + def nextkey(self, key: _KeyType) -> bytes | None: ... + def reorganize(self) -> None: ... + def sync(self) -> None: ... + def close(self) -> None: ... + def __getitem__(self, item: _KeyType) -> bytes: ... + def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... + def __delitem__(self, key: _KeyType) -> None: ... + def __contains__(self, key: _KeyType) -> bool: ... + def __len__(self) -> int: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + @overload + def get(self, k: _KeyType) -> bytes | None: ... + @overload + def get(self, k: _KeyType, default: _T) -> bytes | _T: ... + def keys(self) -> list[bytes]: ... + def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... + # Don't exist at runtime + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] + def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _gdbm: ... diff --git a/stdlib/dbm/ndbm.pyi b/stdlib/dbm/ndbm.pyi index a4b35a3..ca65809 100644 --- a/stdlib/dbm/ndbm.pyi +++ b/stdlib/dbm/ndbm.pyi @@ -1,35 +1,36 @@ -from _typeshed import Self +import sys +from _typeshed import ReadOnlyBuffer, Self from types import TracebackType -from typing import Type, TypeVar, Union, overload +from typing import TypeVar, overload +from typing_extensions import TypeAlias -_T = TypeVar("_T") -_KeyType = Union[str, bytes] -_ValueType = Union[str, bytes] +if sys.platform != "win32": + _T = TypeVar("_T") + _KeyType: TypeAlias = str | ReadOnlyBuffer + _ValueType: TypeAlias = str | ReadOnlyBuffer -class error(OSError): ... + class error(OSError): ... + library: str -library: str - -# Actual typename dbm, not exposed by the implementation -class _dbm: - def close(self) -> None: ... - def __getitem__(self, item: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __len__(self) -> int: ... - def __del__(self) -> None: ... - def __enter__(self: Self) -> Self: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - @overload - def get(self, k: _KeyType) -> bytes | None: ... - @overload - def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> list[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore - -def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ... + # Actual typename dbm, not exposed by the implementation + class _dbm: + def close(self) -> None: ... + def __getitem__(self, item: _KeyType) -> bytes: ... + def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... + def __delitem__(self, key: _KeyType) -> None: ... + def __len__(self) -> int: ... + def __del__(self) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + @overload + def get(self, k: _KeyType) -> bytes | None: ... + @overload + def get(self, k: _KeyType, default: _T) -> bytes | _T: ... + def keys(self) -> list[bytes]: ... + def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... + # Don't exist at runtime + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] + def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ... diff --git a/stdlib/decimal.pyi b/stdlib/decimal.pyi index a21ec92..35fc440 100644 --- a/stdlib/decimal.pyi +++ b/stdlib/decimal.pyi @@ -1,258 +1,2 @@ -import numbers -from types import TracebackType -from typing import Any, Container, NamedTuple, Sequence, Tuple, Type, TypeVar, Union, overload - -_Decimal = Union[Decimal, int] -_DecimalNew = Union[Decimal, float, str, Tuple[int, Sequence[int], int]] -_ComparableNum = Union[Decimal, float, numbers.Rational] -_DecimalT = TypeVar("_DecimalT", bound=Decimal) - -class DecimalTuple(NamedTuple): - sign: int - digits: Tuple[int, ...] - exponent: int - -ROUND_DOWN: str -ROUND_HALF_UP: str -ROUND_HALF_EVEN: str -ROUND_CEILING: str -ROUND_FLOOR: str -ROUND_UP: str -ROUND_HALF_DOWN: str -ROUND_05UP: str - -HAVE_THREADS: bool -MAX_EMAX: int -MAX_PREC: int -MIN_EMIN: int -MIN_ETINY: int - -class DecimalException(ArithmeticError): ... -class Clamped(DecimalException): ... -class InvalidOperation(DecimalException): ... -class ConversionSyntax(InvalidOperation): ... -class DivisionByZero(DecimalException, ZeroDivisionError): ... -class DivisionImpossible(InvalidOperation): ... -class DivisionUndefined(InvalidOperation, ZeroDivisionError): ... -class Inexact(DecimalException): ... -class InvalidContext(InvalidOperation): ... -class Rounded(DecimalException): ... -class Subnormal(DecimalException): ... -class Overflow(Inexact, Rounded): ... -class Underflow(Inexact, Rounded, Subnormal): ... -class FloatOperation(DecimalException, TypeError): ... - -def setcontext(__context: Context) -> None: ... -def getcontext() -> Context: ... -def localcontext(ctx: Context | None = ...) -> _ContextManager: ... - -class Decimal(object): - def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ... - @classmethod - def from_float(cls, __f: float) -> Decimal: ... - def __bool__(self) -> bool: ... - def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __hash__(self) -> int: ... - def as_tuple(self) -> DecimalTuple: ... - def as_integer_ratio(self) -> Tuple[int, int]: ... - def to_eng_string(self, context: Context | None = ...) -> str: ... - def __abs__(self) -> Decimal: ... - def __add__(self, other: _Decimal) -> Decimal: ... - def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ... - def __eq__(self, other: object) -> bool: ... - def __floordiv__(self, other: _Decimal) -> Decimal: ... - def __ge__(self, other: _ComparableNum) -> bool: ... - def __gt__(self, other: _ComparableNum) -> bool: ... - def __le__(self, other: _ComparableNum) -> bool: ... - def __lt__(self, other: _ComparableNum) -> bool: ... - def __mod__(self, other: _Decimal) -> Decimal: ... - def __mul__(self, other: _Decimal) -> Decimal: ... - def __neg__(self) -> Decimal: ... - def __pos__(self) -> Decimal: ... - def __pow__(self, other: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ... - def __radd__(self, other: _Decimal) -> Decimal: ... - def __rdivmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ... - def __rfloordiv__(self, other: _Decimal) -> Decimal: ... - def __rmod__(self, other: _Decimal) -> Decimal: ... - def __rmul__(self, other: _Decimal) -> Decimal: ... - def __rsub__(self, other: _Decimal) -> Decimal: ... - def __rtruediv__(self, other: _Decimal) -> Decimal: ... - def __str__(self) -> str: ... - def __sub__(self, other: _Decimal) -> Decimal: ... - def __truediv__(self, other: _Decimal) -> Decimal: ... - def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __float__(self) -> float: ... - def __int__(self) -> int: ... - def __trunc__(self) -> int: ... - @property - def real(self) -> Decimal: ... - @property - def imag(self) -> Decimal: ... - def conjugate(self) -> Decimal: ... - def __complex__(self) -> complex: ... - @overload - def __round__(self) -> int: ... - @overload - def __round__(self, ndigits: int) -> Decimal: ... - def __floor__(self) -> int: ... - def __ceil__(self) -> int: ... - def fma(self, other: _Decimal, third: _Decimal, context: Context | None = ...) -> Decimal: ... - def __rpow__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def normalize(self, context: Context | None = ...) -> Decimal: ... - def quantize(self, exp: _Decimal, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def same_quantum(self, other: _Decimal, context: Context | None = ...) -> bool: ... - def to_integral_exact(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def to_integral_value(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def to_integral(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def sqrt(self, context: Context | None = ...) -> Decimal: ... - def max(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def min(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def adjusted(self) -> int: ... - def canonical(self) -> Decimal: ... - def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def compare_total(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def compare_total_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def copy_abs(self) -> Decimal: ... - def copy_negate(self) -> Decimal: ... - def copy_sign(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def exp(self, context: Context | None = ...) -> Decimal: ... - def is_canonical(self) -> bool: ... - def is_finite(self) -> bool: ... - def is_infinite(self) -> bool: ... - def is_nan(self) -> bool: ... - def is_normal(self, context: Context | None = ...) -> bool: ... - def is_qnan(self) -> bool: ... - def is_signed(self) -> bool: ... - def is_snan(self) -> bool: ... - def is_subnormal(self, context: Context | None = ...) -> bool: ... - def is_zero(self) -> bool: ... - def ln(self, context: Context | None = ...) -> Decimal: ... - def log10(self, context: Context | None = ...) -> Decimal: ... - def logb(self, context: Context | None = ...) -> Decimal: ... - def logical_and(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def logical_invert(self, context: Context | None = ...) -> Decimal: ... - def logical_or(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def logical_xor(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def max_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def min_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def next_minus(self, context: Context | None = ...) -> Decimal: ... - def next_plus(self, context: Context | None = ...) -> Decimal: ... - def next_toward(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def number_class(self, context: Context | None = ...) -> str: ... - def radix(self) -> Decimal: ... - def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def __reduce__(self) -> Tuple[Type[Decimal], Tuple[str]]: ... - def __copy__(self) -> Decimal: ... - def __deepcopy__(self, memo: Any) -> Decimal: ... - def __format__(self, specifier: str, context: Context | None = ...) -> str: ... - -class _ContextManager(object): - new_context: Context - saved_context: Context - def __init__(self, new_context: Context) -> None: ... - def __enter__(self) -> Context: ... - def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... - -_TrapType = Type[DecimalException] - -class Context(object): - prec: int - rounding: str - Emin: int - Emax: int - capitals: int - clamp: int - traps: dict[_TrapType, bool] - flags: dict[_TrapType, bool] - def __init__( - self, - prec: int | None = ..., - rounding: str | None = ..., - Emin: int | None = ..., - Emax: int | None = ..., - capitals: int | None = ..., - clamp: int | None = ..., - flags: None | dict[_TrapType, bool] | Container[_TrapType] = ..., - traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., - _ignored_flags: list[_TrapType] | None = ..., - ) -> None: ... - # __setattr__() only allows to set a specific set of attributes, - # already defined above. - def __delattr__(self, name: str) -> None: ... - def __reduce__(self) -> Tuple[Type[Context], Tuple[Any, ...]]: ... - def clear_flags(self) -> None: ... - def clear_traps(self) -> None: ... - def copy(self) -> Context: ... - def __copy__(self) -> Context: ... - __hash__: Any - def Etiny(self) -> int: ... - def Etop(self) -> int: ... - def create_decimal(self, __num: _DecimalNew = ...) -> Decimal: ... - def create_decimal_from_float(self, __f: float) -> Decimal: ... - def abs(self, __x: _Decimal) -> Decimal: ... - def add(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def canonical(self, __x: Decimal) -> Decimal: ... - def compare(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def compare_signal(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def compare_total(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def compare_total_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def copy_abs(self, __x: _Decimal) -> Decimal: ... - def copy_decimal(self, __x: _Decimal) -> Decimal: ... - def copy_negate(self, __x: _Decimal) -> Decimal: ... - def copy_sign(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divide(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divide_int(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def divmod(self, __x: _Decimal, __y: _Decimal) -> Tuple[Decimal, Decimal]: ... - def exp(self, __x: _Decimal) -> Decimal: ... - def fma(self, __x: _Decimal, __y: _Decimal, __z: _Decimal) -> Decimal: ... - def is_canonical(self, __x: _Decimal) -> bool: ... - def is_finite(self, __x: _Decimal) -> bool: ... - def is_infinite(self, __x: _Decimal) -> bool: ... - def is_nan(self, __x: _Decimal) -> bool: ... - def is_normal(self, __x: _Decimal) -> bool: ... - def is_qnan(self, __x: _Decimal) -> bool: ... - def is_signed(self, __x: _Decimal) -> bool: ... - def is_snan(self, __x: _Decimal) -> bool: ... - def is_subnormal(self, __x: _Decimal) -> bool: ... - def is_zero(self, __x: _Decimal) -> bool: ... - def ln(self, __x: _Decimal) -> Decimal: ... - def log10(self, __x: _Decimal) -> Decimal: ... - def logb(self, __x: _Decimal) -> Decimal: ... - def logical_and(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def logical_invert(self, __x: _Decimal) -> Decimal: ... - def logical_or(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def logical_xor(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def max(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def max_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def min(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def min_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def minus(self, __x: _Decimal) -> Decimal: ... - def multiply(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def next_minus(self, __x: _Decimal) -> Decimal: ... - def next_plus(self, __x: _Decimal) -> Decimal: ... - def next_toward(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def normalize(self, __x: _Decimal) -> Decimal: ... - def number_class(self, __x: _Decimal) -> str: ... - def plus(self, __x: _Decimal) -> Decimal: ... - def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ... - def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def radix(self) -> Decimal: ... - def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def remainder_near(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def rotate(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def same_quantum(self, __x: _Decimal, __y: _Decimal) -> bool: ... - def scaleb(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def shift(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def sqrt(self, __x: _Decimal) -> Decimal: ... - def subtract(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... - def to_eng_string(self, __x: _Decimal) -> str: ... - def to_sci_string(self, __x: _Decimal) -> str: ... - def to_integral_exact(self, __x: _Decimal) -> Decimal: ... - def to_integral_value(self, __x: _Decimal) -> Decimal: ... - def to_integral(self, __x: _Decimal) -> Decimal: ... - -DefaultContext: Context -BasicContext: Context -ExtendedContext: Context +from _decimal import * +from _decimal import __libmpdec_version__ as __libmpdec_version__, __version__ as __version__ diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 5db9472..df2f8be 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -1,11 +1,26 @@ import sys -from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, Tuple, TypeVar, Union, overload +from collections.abc import Callable, Iterable, Iterator, Sequence +from typing import Any, AnyStr, Generic, NamedTuple, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = [ + "get_close_matches", + "ndiff", + "restore", + "SequenceMatcher", + "Differ", + "IS_CHARACTER_JUNK", + "IS_LINE_JUNK", + "context_diff", + "unified_diff", + "diff_bytes", + "HtmlDiff", + "Match", +] + _T = TypeVar("_T") -_JunkCallback = Union[Callable[[str], bool], Callable[[str], bool]] class Match(NamedTuple): a: int @@ -13,8 +28,17 @@ class Match(NamedTuple): size: int class SequenceMatcher(Generic[_T]): + @overload + def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ... + @overload + def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ... + @overload def __init__( - self, isjunk: Callable[[_T], bool] | None = ..., a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = ... + self: SequenceMatcher[str], + isjunk: Callable[[str], bool] | None = ..., + a: Sequence[str] = ..., + b: Sequence[str] = ..., + autojunk: bool = ..., ) -> None: ... def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... def set_seq1(self, a: Sequence[_T]) -> None: ... @@ -23,9 +47,10 @@ class SequenceMatcher(Generic[_T]): def find_longest_match(self, alo: int = ..., ahi: int | None = ..., blo: int = ..., bhi: int | None = ...) -> Match: ... else: def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ... + def get_matching_blocks(self) -> list[Match]: ... - def get_opcodes(self) -> list[Tuple[str, int, int, int, int]]: ... - def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[Tuple[str, int, int, int, int]]]: ... + def get_opcodes(self) -> list[tuple[str, int, int, int, int]]: ... + def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[tuple[str, int, int, int, int]]]: ... def ratio(self) -> float: ... def quick_ratio(self) -> float: ... def real_quick_ratio(self) -> float: ... @@ -34,16 +59,14 @@ class SequenceMatcher(Generic[_T]): # mypy thinks the signatures of the overloads overlap, but the types still work fine @overload -def get_close_matches( # type: ignore - word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ... -) -> list[AnyStr]: ... +def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...) -> list[AnyStr]: ... # type: ignore[misc] @overload def get_close_matches( word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ... ) -> list[Sequence[_T]]: ... class Differ: - def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ... + def __init__(self, linejunk: Callable[[str], bool] | None = ..., charjunk: Callable[[str], bool] | None = ...) -> None: ... def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ... def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented @@ -69,16 +92,16 @@ def context_diff( lineterm: str = ..., ) -> Iterator[str]: ... def ndiff( - a: Sequence[str], b: Sequence[str], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ... + a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = ..., charjunk: Callable[[str], bool] | None = ... ) -> Iterator[str]: ... -class HtmlDiff(object): +class HtmlDiff: def __init__( self, tabsize: int = ..., wrapcolumn: int | None = ..., - linejunk: _JunkCallback | None = ..., - charjunk: _JunkCallback | None = ..., + linejunk: Callable[[str], bool] | None = ..., + charjunk: Callable[[str], bool] | None = ..., ) -> None: ... def make_file( self, @@ -104,12 +127,12 @@ class HtmlDiff(object): def restore(delta: Iterable[str], which: int) -> Iterator[str]: ... def diff_bytes( dfunc: Callable[[Sequence[str], Sequence[str], str, str, str, str, int, str], Iterator[str]], - a: Sequence[bytes], - b: Sequence[bytes], - fromfile: bytes = ..., - tofile: bytes = ..., - fromfiledate: bytes = ..., - tofiledate: bytes = ..., + a: Iterable[bytes | bytearray], + b: Iterable[bytes | bytearray], + fromfile: bytes | bytearray = ..., + tofile: bytes | bytearray = ..., + fromfiledate: bytes | bytearray = ..., + tofiledate: bytes | bytearray = ..., n: int = ..., - lineterm: bytes = ..., + lineterm: bytes | bytearray = ..., ) -> Iterator[bytes]: ... diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index d9e3c72..73adba5 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -1,64 +1,139 @@ import sys import types -from opcode import ( - EXTENDED_ARG as EXTENDED_ARG, - HAVE_ARGUMENT as HAVE_ARGUMENT, - cmp_op as cmp_op, - hascompare as hascompare, - hasconst as hasconst, - hasfree as hasfree, - hasjabs as hasjabs, - hasjrel as hasjrel, - haslocal as haslocal, - hasname as hasname, - hasnargs as hasnargs, - opmap as opmap, - opname as opname, - stack_effect as stack_effect, -) -from typing import IO, Any, Callable, Iterator, NamedTuple, Tuple, Union +from _typeshed import Self +from collections.abc import Callable, Iterator +from opcode import * # `dis` re-exports it as a part of public API +from typing import IO, Any, NamedTuple +from typing_extensions import TypeAlias + +__all__ = [ + "code_info", + "dis", + "disassemble", + "distb", + "disco", + "findlinestarts", + "findlabels", + "show_code", + "get_instructions", + "Instruction", + "Bytecode", + "cmp_op", + "hasconst", + "hasname", + "hasjrel", + "hasjabs", + "haslocal", + "hascompare", + "hasfree", + "opname", + "opmap", + "HAVE_ARGUMENT", + "EXTENDED_ARG", + "hasnargs", + "stack_effect", +] # Strictly this should not have to include Callable, but mypy doesn't use FunctionType # for functions (python/mypy#3171) -_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]] -_have_code_or_string = Union[_have_code, str, bytes] +_HaveCodeType: TypeAlias = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any] + +if sys.version_info >= (3, 11): + class Positions(NamedTuple): + lineno: int | None = ... + end_lineno: int | None = ... + col_offset: int | None = ... + end_col_offset: int | None = ... -class Instruction(NamedTuple): - opname: str - opcode: int - arg: int | None - argval: Any - argrepr: str - offset: int - starts_line: int | None - is_jump_target: bool +if sys.version_info >= (3, 11): + class Instruction(NamedTuple): + opname: str + opcode: int + arg: int | None + argval: Any + argrepr: str + offset: int + starts_line: int | None + is_jump_target: bool + positions: Positions | None = ... + +else: + class Instruction(NamedTuple): + opname: str + opcode: int + arg: int | None + argval: Any + argrepr: str + offset: int + starts_line: int | None + is_jump_target: bool class Bytecode: codeobj: types.CodeType first_line: int - def __init__(self, x: _have_code_or_string, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def __init__( + self, + x: _HaveCodeType | str, + *, + first_line: int | None = ..., + current_offset: int | None = ..., + show_caches: bool = ..., + adaptive: bool = ..., + ) -> None: ... + @classmethod + def from_traceback( + cls: type[Self], tb: types.TracebackType, *, show_caches: bool = ..., adaptive: bool = ... + ) -> Self: ... + else: + def __init__(self, x: _HaveCodeType | str, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ... + @classmethod + def from_traceback(cls: type[Self], tb: types.TracebackType) -> Self: ... + def __iter__(self) -> Iterator[Instruction]: ... - def __repr__(self) -> str: ... def info(self) -> str: ... def dis(self) -> str: ... - @classmethod - def from_traceback(cls, tb: types.TracebackType) -> Bytecode: ... COMPILER_FLAG_NAMES: dict[int, str] -def findlabels(code: _have_code) -> list[int]: ... -def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ... +def findlabels(code: _HaveCodeType) -> list[int]: ... +def findlinestarts(code: _HaveCodeType) -> Iterator[tuple[int, int]]: ... def pretty_flags(flags: int) -> str: ... -def code_info(x: _have_code_or_string) -> str: ... +def code_info(x: _HaveCodeType | str) -> str: ... + +if sys.version_info >= (3, 11): + def dis( + x: _HaveCodeType | str | bytes | bytearray | None = ..., + *, + file: IO[str] | None = ..., + depth: int | None = ..., + show_caches: bool = ..., + adaptive: bool = ..., + ) -> None: ... + +else: + def dis( + x: _HaveCodeType | str | bytes | bytearray | None = ..., *, file: IO[str] | None = ..., depth: int | None = ... + ) -> None: ... -if sys.version_info >= (3, 7): - def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ..., depth: int | None = ...) -> None: ... +if sys.version_info >= (3, 11): + def disassemble( + co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ..., show_caches: bool = ..., adaptive: bool = ... + ) -> None: ... + def disco( + co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ..., show_caches: bool = ..., adaptive: bool = ... + ) -> None: ... + def distb( + tb: types.TracebackType | None = ..., *, file: IO[str] | None = ..., show_caches: bool = ..., adaptive: bool = ... + ) -> None: ... + def get_instructions( + x: _HaveCodeType, *, first_line: int | None = ..., show_caches: bool = ..., adaptive: bool = ... + ) -> Iterator[Instruction]: ... else: - def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ...) -> None: ... + def disassemble(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... + def disco(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... + def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ... + def get_instructions(x: _HaveCodeType, *, first_line: int | None = ...) -> Iterator[Instruction]: ... -def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ... -def disassemble(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... -def disco(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... -def show_code(co: _have_code, *, file: IO[str] | None = ...) -> None: ... -def get_instructions(x: _have_code, *, first_line: int | None = ...) -> Iterator[Instruction]: ... +def show_code(co: _HaveCodeType, *, file: IO[str] | None = ...) -> None: ... diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index d21de46..5b92c5f 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -1,6 +1,8 @@ -from typing import Any, Callable, Optional, Tuple, Union +from collections.abc import Callable +from typing import Any, Union +from typing_extensions import TypeAlias -_Macro = Union[Tuple[str], Tuple[str, Optional[str]]] +_Macro: TypeAlias = Union[tuple[str], tuple[str, str | None]] def gen_lib_options( compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str] @@ -141,7 +143,7 @@ class CCompiler: def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... def object_filenames(self, source_filenames: list[str], strip_dir: int = ..., output_dir: str = ...) -> list[str]: ... def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... - def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... + def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... def spawn(self, cmd: list[str]) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... def move_file(self, src: str, dst: str) -> str: ... diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index dd2e190..e706bdb 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -1,9 +1,10 @@ from abc import abstractmethod +from collections.abc import Callable, Iterable from distutils.dist import Distribution -from typing import Any, Callable, Iterable, Tuple +from typing import Any class Command: - sub_commands: list[Tuple[str, Callable[[Command], bool] | None]] + sub_commands: list[tuple[str, Callable[[Command], bool] | None]] def __init__(self, dist: Distribution) -> None: ... @abstractmethod def initialize_options(self) -> None: ... @@ -18,13 +19,13 @@ class Command: def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... - def set_undefined_options(self, src_cmd: str, *option_pairs: Tuple[str, str]) -> None: ... + def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ... def get_finalized_command(self, command: str, create: int = ...) -> Command: ... def reinitialize_command(self, command: Command | str, reinit_subcommands: int = ...) -> Command: ... def run_command(self, command: str) -> None: ... def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... - def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: str | None = ..., level: int = ...) -> None: ... + def execute(self, func: Callable[..., object], args: Iterable[Any], msg: str | None = ..., level: int = ...) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... def copy_file( self, @@ -34,7 +35,7 @@ class Command: preserve_times: int = ..., link: str | None = ..., level: Any = ..., - ) -> Tuple[str, bool]: ... # level is not used + ) -> tuple[str, bool]: ... # level is not used def copy_tree( self, infile: str, @@ -57,9 +58,9 @@ class Command: ) -> str: ... def make_file( self, - infiles: str | list[str] | Tuple[str], + infiles: str | list[str] | tuple[str, ...], outfile: str, - func: Callable[..., Any], + func: Callable[..., object], args: list[Any], exec_msg: str | None = ..., skip_msg: str | None = ..., diff --git a/stdlib/distutils/command/bdist_msi.pyi b/stdlib/distutils/command/bdist_msi.pyi index e4f64ff..66202e8 100644 --- a/stdlib/distutils/command/bdist_msi.pyi +++ b/stdlib/distutils/command/bdist_msi.pyi @@ -5,6 +5,7 @@ from ..cmd import Command if sys.platform == "win32": from msilib import Dialog + class PyDialog(Dialog): def __init__(self, *args, **kw) -> None: ... def title(self, title) -> None: ... @@ -12,6 +13,7 @@ if sys.platform == "win32": def cancel(self, title, next, name: str = ..., active: int = ...): ... def next(self, title, next, name: str = ..., active: int = ...): ... def xbutton(self, name, title, next, xpos): ... + class bdist_msi(Command): description: str user_options: Any diff --git a/stdlib/distutils/command/bdist_wininst.pyi b/stdlib/distutils/command/bdist_wininst.pyi index e69de29..1091fb2 100644 --- a/stdlib/distutils/command/bdist_wininst.pyi +++ b/stdlib/distutils/command/bdist_wininst.pyi @@ -0,0 +1,16 @@ +from _typeshed import StrOrBytesPath +from distutils.cmd import Command +from typing import Any, ClassVar + +class bdist_wininst(Command): + description: ClassVar[str] + user_options: ClassVar[list[tuple[Any, ...]]] + boolean_options: ClassVar[list[str]] + + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def get_inidata(self) -> str: ... + def create_exe(self, arcname: StrOrBytesPath, fullname: str, bitmap: StrOrBytesPath | None = ...) -> None: ... + def get_installer_filename(self, fullname: str) -> str: ... + def get_exe_bytes(self) -> bytes: ... diff --git a/stdlib/distutils/command/check.pyi b/stdlib/distutils/command/check.pyi index 9149b54..cdbe40f 100644 --- a/stdlib/distutils/command/check.pyi +++ b/stdlib/distutils/command/check.pyi @@ -1,11 +1,12 @@ from typing import Any +from typing_extensions import TypeAlias from ..cmd import Command -_Reporter = Any # really docutils.utils.Reporter +_Reporter: TypeAlias = Any # really docutils.utils.Reporter # Only defined if docutils is installed. -class SilentReporter(_Reporter): # type: ignore +class SilentReporter(_Reporter): messages: Any def __init__( self, diff --git a/stdlib/distutils/command/config.pyi b/stdlib/distutils/command/config.pyi index 7ad71e1..03466ca 100644 --- a/stdlib/distutils/command/config.pyi +++ b/stdlib/distutils/command/config.pyi @@ -1,5 +1,6 @@ from collections.abc import Sequence -from typing import Any, Pattern +from re import Pattern +from typing import Any from ..ccompiler import CCompiler from ..cmd import Command diff --git a/stdlib/distutils/command/install.pyi b/stdlib/distutils/command/install.pyi index 47fa8b0..661d256 100644 --- a/stdlib/distutils/command/install.pyi +++ b/stdlib/distutils/command/install.pyi @@ -1,9 +1,9 @@ -from typing import Any, Tuple +from typing import Any from ..cmd import Command HAS_USER_SITE: bool -SCHEME_KEYS: Tuple[str, ...] +SCHEME_KEYS: tuple[str, ...] INSTALL_SCHEMES: dict[str, dict[Any, Any]] class install(Command): diff --git a/stdlib/distutils/core.pyi b/stdlib/distutils/core.pyi index dc08708..199a4d7 100644 --- a/stdlib/distutils/core.pyi +++ b/stdlib/distutils/core.pyi @@ -1,7 +1,8 @@ +from collections.abc import Mapping from distutils.cmd import Command as Command from distutils.dist import Distribution as Distribution from distutils.extension import Extension as Extension -from typing import Any, Mapping, Tuple, Type +from typing import Any def setup( *, @@ -20,21 +21,21 @@ def setup( scripts: list[str] = ..., ext_modules: list[Extension] = ..., classifiers: list[str] = ..., - distclass: Type[Distribution] = ..., + distclass: type[Distribution] = ..., script_name: str = ..., script_args: list[str] = ..., options: Mapping[str, Any] = ..., license: str = ..., keywords: list[str] | str = ..., platforms: list[str] | str = ..., - cmdclass: Mapping[str, Type[Command]] = ..., - data_files: list[Tuple[str, list[str]]] = ..., + cmdclass: Mapping[str, type[Command]] = ..., + data_files: list[tuple[str, list[str]]] = ..., package_dir: Mapping[str, str] = ..., obsoletes: list[str] = ..., provides: list[str] = ..., requires: list[str] = ..., command_packages: list[str] = ..., - command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ..., + command_options: Mapping[str, Mapping[str, tuple[Any, Any]]] = ..., package_data: Mapping[str, list[str]] = ..., include_package_data: bool = ..., libraries: list[str] = ..., diff --git a/stdlib/distutils/dep_util.pyi b/stdlib/distutils/dep_util.pyi index 595dcb8..929d6ff 100644 --- a/stdlib/distutils/dep_util.pyi +++ b/stdlib/distutils/dep_util.pyi @@ -1,5 +1,3 @@ -from typing import Tuple - def newer(source: str, target: str) -> bool: ... -def newer_pairwise(sources: list[str], targets: list[str]) -> list[Tuple[str, str]]: ... +def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ... diff --git a/stdlib/distutils/dist.pyi b/stdlib/distutils/dist.pyi index ca3f108..ef47e4e 100644 --- a/stdlib/distutils/dist.pyi +++ b/stdlib/distutils/dist.pyi @@ -1,6 +1,7 @@ from _typeshed import StrOrBytesPath, SupportsWrite +from collections.abc import Iterable, Mapping from distutils.cmd import Command -from typing import IO, Any, Iterable, Mapping, Tuple, Type +from typing import IO, Any class DistributionMetadata: def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ... @@ -50,9 +51,9 @@ class DistributionMetadata: def set_obsoletes(self, value: Iterable[str]) -> None: ... class Distribution: - cmdclass: dict[str, Type[Command]] + cmdclass: dict[str, type[Command]] metadata: DistributionMetadata def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ... - def get_option_dict(self, command: str) -> dict[str, Tuple[str, str]]: ... + def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ... def parse_config_files(self, filenames: Iterable[str] | None = ...) -> None: ... def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ... diff --git a/stdlib/distutils/extension.pyi b/stdlib/distutils/extension.pyi index 0941a40..5639f44 100644 --- a/stdlib/distutils/extension.pyi +++ b/stdlib/distutils/extension.pyi @@ -1,12 +1,26 @@ -from typing import Tuple - class Extension: + name: str + sources: list[str] + include_dirs: list[str] + define_macros: list[tuple[str, str | None]] + undef_macros: list[str] + library_dirs: list[str] + libraries: list[str] + runtime_library_dirs: list[str] + extra_objects: list[str] + extra_compile_args: list[str] + extra_link_args: list[str] + export_symbols: list[str] + swig_opts: list[str] + depends: list[str] + language: str | None + optional: bool | None def __init__( self, name: str, sources: list[str], include_dirs: list[str] | None = ..., - define_macros: list[Tuple[str, str | None]] | None = ..., + define_macros: list[tuple[str, str | None]] | None = ..., undef_macros: list[str] | None = ..., library_dirs: list[str] | None = ..., libraries: list[str] | None = ..., @@ -15,7 +29,7 @@ class Extension: extra_compile_args: list[str] | None = ..., extra_link_args: list[str] | None = ..., export_symbols: list[str] | None = ..., - swig_opts: str | None = ..., # undocumented + swig_opts: list[str] | None = ..., depends: list[str] | None = ..., language: str | None = ..., optional: bool | None = ..., diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index a2c2418..6a7124b 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -1,7 +1,9 @@ -from typing import Any, Iterable, List, Mapping, Optional, Tuple, overload +from collections.abc import Iterable, Mapping +from typing import Any, overload +from typing_extensions import TypeAlias -_Option = Tuple[str, Optional[str], str] -_GR = Tuple[List[str], OptionDummy] +_Option: TypeAlias = tuple[str, str | None, str] +_GR: TypeAlias = tuple[list[str], OptionDummy] def fancy_getopt( options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None @@ -15,7 +17,7 @@ class FancyGetopt: def getopt(self, args: list[str] | None = ...) -> _GR: ... @overload def getopt(self, args: list[str] | None, object: Any) -> list[str]: ... - def get_option_order(self) -> list[Tuple[str, str]]: ... + def get_option_order(self) -> list[tuple[str, str]]: ... def generate_help(self, header: str | None = ...) -> list[str]: ... class OptionDummy: diff --git a/stdlib/distutils/file_util.pyi b/stdlib/distutils/file_util.pyi index cfe840e..b312784 100644 --- a/stdlib/distutils/file_util.pyi +++ b/stdlib/distutils/file_util.pyi @@ -1,4 +1,4 @@ -from typing import Sequence, Tuple +from collections.abc import Sequence def copy_file( src: str, @@ -9,6 +9,6 @@ def copy_file( link: str | None = ..., verbose: bool = ..., dry_run: bool = ..., -) -> Tuple[str, str]: ... +) -> tuple[str, str]: ... def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ... def write_file(filename: str, contents: Sequence[str]) -> None: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index 2b43693..1cfdcf0 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -1,4 +1,6 @@ -from typing import Iterable, Pattern, overload +from collections.abc import Iterable +from re import Pattern +from typing import overload from typing_extensions import Literal # class is entirely undocumented @@ -16,34 +18,34 @@ class FileList: def process_template_line(self, line: str) -> None: ... @overload def include_pattern( - self, pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... + self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... ) -> bool: ... @overload def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... @overload def include_pattern( - self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ... + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> bool: ... @overload def exclude_pattern( - self, pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... + self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... ) -> bool: ... @overload def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... @overload def exclude_pattern( - self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ... + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> bool: ... def findall(dir: str = ...) -> list[str]: ... def glob_to_re(pattern: str) -> str: ... @overload def translate_pattern( - pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[False, 0] = ... + pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[False, 0] = ... ) -> Pattern[str]: ... @overload def translate_pattern(pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ... @overload def translate_pattern( - pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ... + pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> Pattern[str]: ... diff --git a/stdlib/distutils/sysconfig.pyi b/stdlib/distutils/sysconfig.pyi index 3f579be..bf7db9c 100644 --- a/stdlib/distutils/sysconfig.pyi +++ b/stdlib/distutils/sysconfig.pyi @@ -1,5 +1,5 @@ +from collections.abc import Mapping from distutils.ccompiler import CCompiler -from typing import Mapping PREFIX: str EXEC_PREFIX: str diff --git a/stdlib/distutils/text_file.pyi b/stdlib/distutils/text_file.pyi index 6a0aded..ace642e 100644 --- a/stdlib/distutils/text_file.pyi +++ b/stdlib/distutils/text_file.pyi @@ -1,4 +1,4 @@ -from typing import IO, Tuple +from typing import IO class TextFile: def __init__( @@ -15,7 +15,7 @@ class TextFile: ) -> None: ... def open(self, filename: str) -> None: ... def close(self) -> None: ... - def warn(self, msg: str, line: list[int] | Tuple[int, int] | int | None = ...) -> None: ... + def warn(self, msg: str, line: list[int] | tuple[int, int] | int | None = ...) -> None: ... def readline(self) -> str | None: ... def readlines(self) -> list[str]: ... def unreadline(self, line: str) -> str: ... diff --git a/stdlib/distutils/util.pyi b/stdlib/distutils/util.pyi index 9b09155..da8d660 100644 --- a/stdlib/distutils/util.pyi +++ b/stdlib/distutils/util.pyi @@ -1,6 +1,7 @@ from _typeshed import StrPath from collections.abc import Callable, Container, Iterable, Mapping -from typing import Any, Tuple +from typing import Any +from typing_extensions import Literal def get_platform() -> str: ... def convert_path(pathname: str) -> str: ... @@ -9,9 +10,9 @@ def check_environ() -> None: ... def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... def split_quoted(s: str) -> list[str]: ... def execute( - func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... + func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... ) -> None: ... -def strtobool(val: str) -> bool: ... +def strtobool(val: str) -> Literal[0, 1]: ... def byte_compile( py_files: list[str], optimize: int = ..., diff --git a/stdlib/distutils/version.pyi b/stdlib/distutils/version.pyi index 29d7217..627d450 100644 --- a/stdlib/distutils/version.pyi +++ b/stdlib/distutils/version.pyi @@ -1,38 +1,36 @@ +from _typeshed import Self from abc import abstractmethod -from typing import Pattern, Tuple, TypeVar - -_T = TypeVar("_T", bound=Version) +from re import Pattern class Version: - def __repr__(self) -> str: ... def __eq__(self, other: object) -> bool: ... - def __lt__(self: _T, other: _T | str) -> bool: ... - def __le__(self: _T, other: _T | str) -> bool: ... - def __gt__(self: _T, other: _T | str) -> bool: ... - def __ge__(self: _T, other: _T | str) -> bool: ... + def __lt__(self: Self, other: Self | str) -> bool: ... + def __le__(self: Self, other: Self | str) -> bool: ... + def __gt__(self: Self, other: Self | str) -> bool: ... + def __ge__(self: Self, other: Self | str) -> bool: ... @abstractmethod def __init__(self, vstring: str | None = ...) -> None: ... @abstractmethod - def parse(self: _T, vstring: str) -> _T: ... + def parse(self: Self, vstring: str) -> Self: ... @abstractmethod def __str__(self) -> str: ... @abstractmethod - def _cmp(self: _T, other: _T | str) -> bool: ... + def _cmp(self: Self, other: Self | str) -> bool: ... class StrictVersion(Version): version_re: Pattern[str] - version: Tuple[int, int, int] - prerelease: Tuple[str, int] | None + version: tuple[int, int, int] + prerelease: tuple[str, int] | None def __init__(self, vstring: str | None = ...) -> None: ... - def parse(self: _T, vstring: str) -> _T: ... - def __str__(self) -> str: ... - def _cmp(self: _T, other: _T | str) -> bool: ... + def parse(self: Self, vstring: str) -> Self: ... + def __str__(self) -> str: ... # noqa: Y029 + def _cmp(self: Self, other: Self | str) -> bool: ... class LooseVersion(Version): component_re: Pattern[str] vstring: str - version: Tuple[str | int, ...] + version: tuple[str | int, ...] def __init__(self, vstring: str | None = ...) -> None: ... - def parse(self: _T, vstring: str) -> _T: ... - def __str__(self) -> str: ... - def _cmp(self: _T, other: _T | str) -> bool: ... + def parse(self: Self, vstring: str) -> Self: ... + def __str__(self) -> str: ... # noqa: Y029 + def _cmp(self: Self, other: Self | str) -> bool: ... diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index 9a9f83b..719551e 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -1,6 +1,45 @@ import types import unittest -from typing import Any, Callable, NamedTuple, Tuple, Type +from _typeshed import ExcInfo +from collections.abc import Callable +from typing import Any, NamedTuple +from typing_extensions import TypeAlias + +__all__ = [ + "register_optionflag", + "DONT_ACCEPT_TRUE_FOR_1", + "DONT_ACCEPT_BLANKLINE", + "NORMALIZE_WHITESPACE", + "ELLIPSIS", + "SKIP", + "IGNORE_EXCEPTION_DETAIL", + "COMPARISON_FLAGS", + "REPORT_UDIFF", + "REPORT_CDIFF", + "REPORT_NDIFF", + "REPORT_ONLY_FIRST_FAILURE", + "REPORTING_FLAGS", + "FAIL_FAST", + "Example", + "DocTest", + "DocTestParser", + "DocTestFinder", + "DocTestRunner", + "OutputChecker", + "DocTestFailure", + "UnexpectedException", + "DebugRunner", + "testmod", + "testfile", + "run_docstring_examples", + "DocTestSuite", + "DocFileSuite", + "set_unittest_reportflags", + "script_from_examples", + "testsource", + "debug_src", + "debug", +] class TestResults(NamedTuple): failed: int @@ -46,7 +85,7 @@ class Example: indent: int = ..., options: dict[int, bool] | None = ..., ) -> None: ... - def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... class DocTest: examples: list[Example] @@ -64,8 +103,8 @@ class DocTest: lineno: int | None, docstring: str | None, ) -> None: ... - def __hash__(self) -> int: ... def __lt__(self, other: DocTest) -> bool: ... + def __eq__(self, other: object) -> bool: ... class DocTestParser: def parse(self, string: str, name: str = ...) -> list[str | Example]: ... @@ -85,8 +124,7 @@ class DocTestFinder: extraglobs: dict[str, Any] | None = ..., ) -> list[DocTest]: ... -_Out = Callable[[str], Any] -_ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType] +_Out: TypeAlias = Callable[[str], object] class DocTestRunner: DIVIDER: str @@ -99,7 +137,7 @@ class DocTestRunner: def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ... def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... - def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ... + def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: ExcInfo) -> None: ... def run( self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ... ) -> TestResults: ... @@ -119,8 +157,8 @@ class DocTestFailure(Exception): class UnexpectedException(Exception): test: DocTest example: Example - exc_info: _ExcInfo - def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ... + exc_info: ExcInfo + def __init__(self, test: DocTest, example: Example, exc_info: ExcInfo) -> None: ... class DebugRunner(DocTestRunner): ... @@ -165,20 +203,13 @@ class DocTestCase(unittest.TestCase): tearDown: Callable[[DocTest], Any] | None = ..., checker: OutputChecker | None = ..., ) -> None: ... - def setUp(self) -> None: ... - def tearDown(self) -> None: ... def runTest(self) -> None: ... def format_failure(self, err: str) -> str: ... - def debug(self) -> None: ... - def id(self) -> str: ... - def __hash__(self) -> int: ... - def shortDescription(self) -> str: ... + def __eq__(self, other: object) -> bool: ... class SkipDocTestCase(DocTestCase): def __init__(self, module: types.ModuleType) -> None: ... - def setUp(self) -> None: ... def test_skip(self) -> None: ... - def shortDescription(self) -> str: ... class _DocTestSuite(unittest.TestSuite): ... @@ -190,9 +221,7 @@ def DocTestSuite( **options: Any, ) -> _DocTestSuite: ... -class DocFileCase(DocTestCase): - def id(self) -> str: ... - def format_failure(self, err: str) -> str: ... +class DocFileCase(DocTestCase): ... def DocFileTest( path: str, diff --git a/stdlib/email/__init__.pyi b/stdlib/email/__init__.pyi index e2c2255..6b59dc7 100644 --- a/stdlib/email/__init__.pyi +++ b/stdlib/email/__init__.pyi @@ -1,9 +1,15 @@ +from collections.abc import Callable from email.message import Message from email.policy import Policy -from typing import IO, Callable +from typing import IO, Union +from typing_extensions import TypeAlias + +# Definitions imported by multiple submodules in typeshed +_ParamType: TypeAlias = Union[str, tuple[str | None, str | None, str]] # noqa: Y047 +_ParamsType: TypeAlias = Union[str, None, tuple[str, str | None, str]] # noqa: Y047 def message_from_string(s: str, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... -def message_from_bytes(s: bytes, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... +def message_from_bytes(s: bytes | bytearray, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... def message_from_file(fp: IO[str], _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... def message_from_binary_file(fp: IO[bytes], _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index 04234b4..28a851d 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -1,29 +1,29 @@ import sys +from _typeshed import Self +from collections.abc import Iterable, Iterator from email.errors import HeaderParseError, MessageDefect from email.policy import Policy -from typing import Any, Iterable, Iterator, List, Pattern, Set, Tuple, Type, TypeVar, Union +from re import Pattern +from typing import Any from typing_extensions import Final -_T = TypeVar("_T") - -WSP: Final[Set[str]] -CFWS_LEADER: Final[Set[str]] -SPECIALS: Final[Set[str]] -ATOM_ENDS: Final[Set[str]] -DOT_ATOM_ENDS: Final[Set[str]] -PHRASE_ENDS: Final[Set[str]] -TSPECIALS: Final[Set[str]] -TOKEN_ENDS: Final[Set[str]] -ASPECIALS: Final[Set[str]] -ATTRIBUTE_ENDS: Final[Set[str]] -EXTENDED_ATTRIBUTE_ENDS: Final[Set[str]] +WSP: Final[set[str]] +CFWS_LEADER: Final[set[str]] +SPECIALS: Final[set[str]] +ATOM_ENDS: Final[set[str]] +DOT_ATOM_ENDS: Final[set[str]] +PHRASE_ENDS: Final[set[str]] +TSPECIALS: Final[set[str]] +TOKEN_ENDS: Final[set[str]] +ASPECIALS: Final[set[str]] +ATTRIBUTE_ENDS: Final[set[str]] +EXTENDED_ATTRIBUTE_ENDS: Final[set[str]] def quote_string(value: Any) -> str: ... -if sys.version_info >= (3, 7): - rfc2047_matcher: Pattern[str] +rfc2047_matcher: Pattern[str] -class TokenList(List[Union[TokenList, Terminal]]): +class TokenList(list[TokenList | Terminal]): token_type: str | None syntactic_break: bool ew_combine_allowed: bool @@ -42,11 +42,7 @@ class TokenList(List[Union[TokenList, Terminal]]): def pprint(self, indent: str = ...) -> None: ... def ppstr(self, indent: str = ...) -> str: ... -class WhiteSpaceTokenList(TokenList): - @property - def value(self) -> str: ... - @property - def comments(self) -> list[str]: ... +class WhiteSpaceTokenList(TokenList): ... class UnstructuredTokenList(TokenList): token_type: str @@ -84,16 +80,12 @@ class QuotedString(TokenList): class BareQuotedString(QuotedString): token_type: str - @property - def value(self) -> str: ... class Comment(WhiteSpaceTokenList): token_type: str def quote(self, value: Any) -> str: ... @property def content(self) -> str: ... - @property - def comments(self) -> list[str]: ... class AddressList(TokenList): token_type: str @@ -182,10 +174,14 @@ class InvalidMailbox(TokenList): token_type: str @property def display_name(self) -> None: ... - local_part: None - domain: None - route: None - addr_spec: None + @property + def local_part(self) -> None: ... + @property + def domain(self) -> None: ... + @property + def route(self) -> None: ... + @property + def addr_spec(self) -> None: ... class Domain(TokenList): token_type: str @@ -213,8 +209,6 @@ class AddrSpec(TokenList): @property def domain(self) -> str: ... @property - def value(self) -> str: ... - @property def addr_spec(self) -> str: ... class ObsLocalPart(TokenList): @@ -223,18 +217,13 @@ class ObsLocalPart(TokenList): class DisplayName(Phrase): token_type: str - ew_combine_allowed: bool @property def display_name(self) -> str: ... - @property - def value(self) -> str: ... class LocalPart(TokenList): token_type: str as_ew_allowed: bool @property - def value(self) -> str: ... - @property def local_part(self) -> str: ... class DomainLiteral(TokenList): @@ -281,12 +270,12 @@ class MimeParameters(TokenList): token_type: str syntactic_break: bool @property - def params(self) -> Iterator[Tuple[str, str]]: ... + def params(self) -> Iterator[tuple[str, str]]: ... class ParameterizedHeaderValue(TokenList): syntactic_break: bool @property - def params(self) -> Iterable[Tuple[str, str]]: ... + def params(self) -> Iterable[tuple[str, str]]: ... class ContentType(ParameterizedHeaderValue): token_type: str @@ -313,8 +302,10 @@ if sys.version_info >= (3, 8): token_type: str as_ew_allowed: bool def fold(self, policy: Policy) -> str: ... + class MessageID(MsgID): token_type: str + class InvalidMessageID(MessageID): token_type: str @@ -327,14 +318,14 @@ class Terminal(str): syntactic_break: bool token_type: str defects: list[MessageDefect] - def __new__(cls: Type[_T], value: str, token_type: str) -> _T: ... + def __new__(cls: type[Self], value: str, token_type: str) -> Self: ... def pprint(self) -> None: ... @property def all_defects(self) -> list[MessageDefect]: ... def pop_trailing_ws(self) -> None: ... @property def comments(self) -> list[str]: ... - def __getnewargs__(self) -> Tuple[str, str]: ... # type: ignore + def __getnewargs__(self) -> tuple[str, str]: ... # type: ignore[override] class WhiteSpaceTerminal(Terminal): @property @@ -346,65 +337,62 @@ class ValueTerminal(Terminal): def value(self) -> ValueTerminal: ... def startswith_fws(self) -> bool: ... -class EWWhiteSpaceTerminal(WhiteSpaceTerminal): - @property - def value(self) -> str: ... - +class EWWhiteSpaceTerminal(WhiteSpaceTerminal): ... class _InvalidEwError(HeaderParseError): ... DOT: Final[ValueTerminal] ListSeparator: Final[ValueTerminal] RouteComponentMarker: Final[ValueTerminal] -def get_fws(value: str) -> Tuple[WhiteSpaceTerminal, str]: ... -def get_encoded_word(value: str) -> Tuple[EncodedWord, str]: ... +def get_fws(value: str) -> tuple[WhiteSpaceTerminal, str]: ... +def get_encoded_word(value: str) -> tuple[EncodedWord, str]: ... def get_unstructured(value: str) -> UnstructuredTokenList: ... -def get_qp_ctext(value: str) -> Tuple[WhiteSpaceTerminal, str]: ... -def get_qcontent(value: str) -> Tuple[ValueTerminal, str]: ... -def get_atext(value: str) -> Tuple[ValueTerminal, str]: ... -def get_bare_quoted_string(value: str) -> Tuple[BareQuotedString, str]: ... -def get_comment(value: str) -> Tuple[Comment, str]: ... -def get_cfws(value: str) -> Tuple[CFWSList, str]: ... -def get_quoted_string(value: str) -> Tuple[QuotedString, str]: ... -def get_atom(value: str) -> Tuple[Atom, str]: ... -def get_dot_atom_text(value: str) -> Tuple[DotAtomText, str]: ... -def get_dot_atom(value: str) -> Tuple[DotAtom, str]: ... -def get_word(value: str) -> Tuple[Any, str]: ... -def get_phrase(value: str) -> Tuple[Phrase, str]: ... -def get_local_part(value: str) -> Tuple[LocalPart, str]: ... -def get_obs_local_part(value: str) -> Tuple[ObsLocalPart, str]: ... -def get_dtext(value: str) -> Tuple[ValueTerminal, str]: ... -def get_domain_literal(value: str) -> Tuple[DomainLiteral, str]: ... -def get_domain(value: str) -> Tuple[Domain, str]: ... -def get_addr_spec(value: str) -> Tuple[AddrSpec, str]: ... -def get_obs_route(value: str) -> Tuple[ObsRoute, str]: ... -def get_angle_addr(value: str) -> Tuple[AngleAddr, str]: ... -def get_display_name(value: str) -> Tuple[DisplayName, str]: ... -def get_name_addr(value: str) -> Tuple[NameAddr, str]: ... -def get_mailbox(value: str) -> Tuple[Mailbox, str]: ... -def get_invalid_mailbox(value: str, endchars: str) -> Tuple[InvalidMailbox, str]: ... -def get_mailbox_list(value: str) -> Tuple[MailboxList, str]: ... -def get_group_list(value: str) -> Tuple[GroupList, str]: ... -def get_group(value: str) -> Tuple[Group, str]: ... -def get_address(value: str) -> Tuple[Address, str]: ... -def get_address_list(value: str) -> Tuple[AddressList, str]: ... +def get_qp_ctext(value: str) -> tuple[WhiteSpaceTerminal, str]: ... +def get_qcontent(value: str) -> tuple[ValueTerminal, str]: ... +def get_atext(value: str) -> tuple[ValueTerminal, str]: ... +def get_bare_quoted_string(value: str) -> tuple[BareQuotedString, str]: ... +def get_comment(value: str) -> tuple[Comment, str]: ... +def get_cfws(value: str) -> tuple[CFWSList, str]: ... +def get_quoted_string(value: str) -> tuple[QuotedString, str]: ... +def get_atom(value: str) -> tuple[Atom, str]: ... +def get_dot_atom_text(value: str) -> tuple[DotAtomText, str]: ... +def get_dot_atom(value: str) -> tuple[DotAtom, str]: ... +def get_word(value: str) -> tuple[Any, str]: ... +def get_phrase(value: str) -> tuple[Phrase, str]: ... +def get_local_part(value: str) -> tuple[LocalPart, str]: ... +def get_obs_local_part(value: str) -> tuple[ObsLocalPart, str]: ... +def get_dtext(value: str) -> tuple[ValueTerminal, str]: ... +def get_domain_literal(value: str) -> tuple[DomainLiteral, str]: ... +def get_domain(value: str) -> tuple[Domain, str]: ... +def get_addr_spec(value: str) -> tuple[AddrSpec, str]: ... +def get_obs_route(value: str) -> tuple[ObsRoute, str]: ... +def get_angle_addr(value: str) -> tuple[AngleAddr, str]: ... +def get_display_name(value: str) -> tuple[DisplayName, str]: ... +def get_name_addr(value: str) -> tuple[NameAddr, str]: ... +def get_mailbox(value: str) -> tuple[Mailbox, str]: ... +def get_invalid_mailbox(value: str, endchars: str) -> tuple[InvalidMailbox, str]: ... +def get_mailbox_list(value: str) -> tuple[MailboxList, str]: ... +def get_group_list(value: str) -> tuple[GroupList, str]: ... +def get_group(value: str) -> tuple[Group, str]: ... +def get_address(value: str) -> tuple[Address, str]: ... +def get_address_list(value: str) -> tuple[AddressList, str]: ... if sys.version_info >= (3, 8): - def get_no_fold_literal(value: str) -> Tuple[NoFoldLiteral, str]: ... - def get_msg_id(value: str) -> Tuple[MsgID, str]: ... + def get_no_fold_literal(value: str) -> tuple[NoFoldLiteral, str]: ... + def get_msg_id(value: str) -> tuple[MsgID, str]: ... def parse_message_id(value: str) -> MessageID: ... def parse_mime_version(value: str) -> MIMEVersion: ... -def get_invalid_parameter(value: str) -> Tuple[InvalidParameter, str]: ... -def get_ttext(value: str) -> Tuple[ValueTerminal, str]: ... -def get_token(value: str) -> Tuple[Token, str]: ... -def get_attrtext(value: str) -> Tuple[ValueTerminal, str]: ... -def get_attribute(value: str) -> Tuple[Attribute, str]: ... -def get_extended_attrtext(value: str) -> Tuple[ValueTerminal, str]: ... -def get_extended_attribute(value: str) -> Tuple[Attribute, str]: ... -def get_section(value: str) -> Tuple[Section, str]: ... -def get_value(value: str) -> Tuple[Value, str]: ... -def get_parameter(value: str) -> Tuple[Parameter, str]: ... +def get_invalid_parameter(value: str) -> tuple[InvalidParameter, str]: ... +def get_ttext(value: str) -> tuple[ValueTerminal, str]: ... +def get_token(value: str) -> tuple[Token, str]: ... +def get_attrtext(value: str) -> tuple[ValueTerminal, str]: ... +def get_attribute(value: str) -> tuple[Attribute, str]: ... +def get_extended_attrtext(value: str) -> tuple[ValueTerminal, str]: ... +def get_extended_attribute(value: str) -> tuple[Attribute, str]: ... +def get_section(value: str) -> tuple[Section, str]: ... +def get_value(value: str) -> tuple[Value, str]: ... +def get_parameter(value: str) -> tuple[Parameter, str]: ... def parse_mime_parameters(value: str) -> MimeParameters: ... def parse_content_type_header(value: str) -> ContentType: ... def parse_content_disposition_header(value: str) -> ContentDisposition: ... diff --git a/stdlib/email/base64mime.pyi b/stdlib/email/base64mime.pyi new file mode 100644 index 0000000..16118a8 --- /dev/null +++ b/stdlib/email/base64mime.pyi @@ -0,0 +1,13 @@ +__all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encode", "header_length"] + +from _typeshed import ReadableBuffer + +def header_length(bytearray: str | bytes | bytearray) -> int: ... +def header_encode(header_bytes: str | ReadableBuffer, charset: str = ...) -> str: ... + +# First argument should be a buffer that supports slicing and len(). +def body_encode(s: bytes | bytearray, maxlinelen: int = ..., eol: str = ...) -> str: ... +def decode(string: str | ReadableBuffer) -> bytes: ... + +body_decode = decode +decodestring = decode diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index 4bf5d11..2369085 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -1,4 +1,6 @@ -from typing import Any, Iterator +from collections.abc import Iterator + +__all__ = ["Charset", "add_alias", "add_charset", "add_codec"] QP: int # undocumented BASE64: int # undocumented @@ -17,9 +19,8 @@ class Charset: def header_encode(self, string: str) -> str: ... def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> list[str]: ... def body_encode(self, string: str) -> str: ... - def __str__(self) -> str: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, __other: object) -> bool: ... def add_charset( charset: str, header_enc: int | None = ..., body_enc: int | None = ..., output_charset: str | None = ... diff --git a/stdlib/email/contentmanager.pyi b/stdlib/email/contentmanager.pyi index 68fe99c..3214f1a 100644 --- a/stdlib/email/contentmanager.pyi +++ b/stdlib/email/contentmanager.pyi @@ -1,8 +1,8 @@ +from collections.abc import Callable from email.message import Message -from typing import Any, Callable +from typing import Any class ContentManager: - def __init__(self) -> None: ... def get_content(self, msg: Message, *args: Any, **kw: Any) -> Any: ... def set_content(self, msg: Message, obj: Any, *args: Any, **kw: Any) -> Any: ... def add_get_handler(self, key: str, handler: Callable[..., Any]) -> None: ... diff --git a/stdlib/email/encoders.pyi b/stdlib/email/encoders.pyi index e05225e..55223bd 100644 --- a/stdlib/email/encoders.pyi +++ b/stdlib/email/encoders.pyi @@ -1,5 +1,7 @@ from email.message import Message +__all__ = ["encode_7or8bit", "encode_base64", "encode_noop", "encode_quopri"] + def encode_base64(msg: Message) -> None: ... def encode_quopri(msg: Message) -> None: ... def encode_7or8bit(msg: Message) -> None: ... diff --git a/stdlib/email/feedparser.pyi b/stdlib/email/feedparser.pyi index ffcf4f0..809f0b0 100644 --- a/stdlib/email/feedparser.pyi +++ b/stdlib/email/feedparser.pyi @@ -1,21 +1,24 @@ +from collections.abc import Callable from email.message import Message from email.policy import Policy -from typing import Callable, Generic, TypeVar, overload +from typing import Generic, TypeVar, overload -_M = TypeVar("_M", bound=Message) +__all__ = ["FeedParser", "BytesFeedParser"] -class FeedParser(Generic[_M]): +_MessageT = TypeVar("_MessageT", bound=Message) + +class FeedParser(Generic[_MessageT]): @overload def __init__(self: FeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ... @overload - def __init__(self, _factory: Callable[[], _M], *, policy: Policy = ...) -> None: ... + def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ... def feed(self, data: str) -> None: ... - def close(self) -> _M: ... + def close(self) -> _MessageT: ... -class BytesFeedParser(Generic[_M]): +class BytesFeedParser(Generic[_MessageT]): @overload def __init__(self: BytesFeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ... @overload - def __init__(self, _factory: Callable[[], _M], *, policy: Policy = ...) -> None: ... - def feed(self, data: bytes) -> None: ... - def close(self) -> _M: ... + def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ... + def feed(self, data: bytes | bytearray) -> None: ... + def close(self) -> _MessageT: ... diff --git a/stdlib/email/generator.pyi b/stdlib/email/generator.pyi index 1a81055..5a6b637 100644 --- a/stdlib/email/generator.pyi +++ b/stdlib/email/generator.pyi @@ -1,27 +1,39 @@ +from _typeshed import SupportsWrite from email.message import Message from email.policy import Policy -from typing import BinaryIO, TextIO + +__all__ = ["Generator", "DecodedGenerator", "BytesGenerator"] class Generator: - def clone(self, fp: TextIO) -> Generator: ... + def clone(self, fp: SupportsWrite[str]) -> Generator: ... def write(self, s: str) -> None: ... def __init__( - self, outfp: TextIO, mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., *, policy: Policy | None = ... + self, + outfp: SupportsWrite[str], + mangle_from_: bool | None = ..., + maxheaderlen: int | None = ..., + *, + policy: Policy | None = ..., ) -> None: ... def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ... class BytesGenerator: - def clone(self, fp: BinaryIO) -> BytesGenerator: ... + def clone(self, fp: SupportsWrite[bytes]) -> BytesGenerator: ... def write(self, s: str) -> None: ... def __init__( - self, outfp: BinaryIO, mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., *, policy: Policy | None = ... + self, + outfp: SupportsWrite[bytes], + mangle_from_: bool | None = ..., + maxheaderlen: int | None = ..., + *, + policy: Policy | None = ..., ) -> None: ... def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ... class DecodedGenerator(Generator): def __init__( self, - outfp: TextIO, + outfp: SupportsWrite[str], mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., fmt: str | None = ..., diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 0d7691a..58740bd 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -1,25 +1,30 @@ +from collections.abc import Iterable from email.charset import Charset -from typing import Any, Tuple +from typing import Any + +__all__ = ["Header", "decode_header", "make_header"] class Header: def __init__( self, - s: bytes | str | None = ..., + s: bytes | bytearray | str | None = ..., charset: Charset | str | None = ..., maxlinelen: int | None = ..., header_name: str | None = ..., continuation_ws: str = ..., errors: str = ..., ) -> None: ... - def append(self, s: bytes | str, charset: Charset | str | None = ..., errors: str = ...) -> None: ... + def append(self, s: bytes | bytearray | str, charset: Charset | str | None = ..., errors: str = ...) -> None: ... def encode(self, splitchars: str = ..., maxlinelen: int | None = ..., linesep: str = ...) -> str: ... - def __str__(self) -> str: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, __other: object) -> bool: ... -def decode_header(header: Header | str) -> list[Tuple[bytes, str | None]]: ... +# decode_header() either returns list[tuple[str, None]] if the header +# contains no encoded parts, or list[tuple[bytes, str | None]] if the header +# contains at least one encoded part. +def decode_header(header: Header | str) -> list[tuple[Any, Any | None]]: ... def make_header( - decoded_seq: list[Tuple[bytes, str | None]], + decoded_seq: Iterable[tuple[bytes | bytearray | str, str | None]], maxlinelen: int | None = ..., header_name: str | None = ..., continuation_ws: str = ..., diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index 69e7bf3..b2b63c4 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -1,5 +1,7 @@ import sys import types +from _typeshed import Self +from collections.abc import Iterable, Mapping from datetime import datetime as _datetime from email._header_value_parser import ( AddressList, @@ -12,28 +14,33 @@ from email._header_value_parser import ( ) from email.errors import MessageDefect from email.policy import Policy -from typing import Any, Iterable, Tuple, Type +from typing import Any, ClassVar, Protocol +from typing_extensions import Literal class BaseHeader(str): + # max_count is actually more of an abstract ClassVar (not defined on the base class, but expected to be defined in subclasses) + max_count: ClassVar[Literal[1] | None] @property def name(self) -> str: ... @property - def defects(self) -> Tuple[MessageDefect, ...]: ... - @property - def max_count(self) -> int | None: ... - def __new__(cls, name: str, value: Any) -> BaseHeader: ... + def defects(self) -> tuple[MessageDefect, ...]: ... + def __new__(cls: type[Self], name: str, value: Any) -> Self: ... def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect]) -> None: ... def fold(self, *, policy: Policy) -> str: ... class UnstructuredHeader: + max_count: ClassVar[Literal[1] | None] @staticmethod def value_parser(value: str) -> UnstructuredTokenList: ... @classmethod def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... -class UniqueUnstructuredHeader(UnstructuredHeader): ... +class UniqueUnstructuredHeader(UnstructuredHeader): + max_count: ClassVar[Literal[1]] class DateHeader: + max_count: ClassVar[Literal[1] | None] + def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect], datetime: _datetime) -> None: ... @property def datetime(self) -> _datetime: ... @staticmethod @@ -41,27 +48,43 @@ class DateHeader: @classmethod def parse(cls, value: str | _datetime, kwds: dict[str, Any]) -> None: ... -class UniqueDateHeader(DateHeader): ... +class UniqueDateHeader(DateHeader): + max_count: ClassVar[Literal[1]] class AddressHeader: + max_count: ClassVar[Literal[1] | None] + def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect], groups: Iterable[Group]) -> None: ... @property - def groups(self) -> Tuple[Group, ...]: ... + def groups(self) -> tuple[Group, ...]: ... @property - def addresses(self) -> Tuple[Address, ...]: ... + def addresses(self) -> tuple[Address, ...]: ... @staticmethod def value_parser(value: str) -> AddressList: ... @classmethod def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... -class UniqueAddressHeader(AddressHeader): ... +class UniqueAddressHeader(AddressHeader): + max_count: ClassVar[Literal[1]] class SingleAddressHeader(AddressHeader): @property def address(self) -> Address: ... -class UniqueSingleAddressHeader(SingleAddressHeader): ... +class UniqueSingleAddressHeader(SingleAddressHeader): + max_count: ClassVar[Literal[1]] class MIMEVersionHeader: + max_count: ClassVar[Literal[1]] + def init( + self, + name: str, + *, + parse_tree: TokenList, + defects: Iterable[MessageDefect], + version: str | None, + major: int | None, + minor: int | None, + ) -> None: ... @property def version(self) -> str | None: ... @property @@ -74,6 +97,8 @@ class MIMEVersionHeader: def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... class ParameterizedMIMEHeader: + max_count: ClassVar[Literal[1]] + def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect], params: Mapping[str, Any]) -> None: ... @property def params(self) -> types.MappingProxyType[str, Any]: ... @classmethod @@ -90,12 +115,15 @@ class ContentTypeHeader(ParameterizedMIMEHeader): def value_parser(value: str) -> ContentType: ... class ContentDispositionHeader(ParameterizedMIMEHeader): + # init is redefined but has the same signature as parent class, so is omitted from the stub @property - def content_disposition(self) -> str: ... + def content_disposition(self) -> str | None: ... @staticmethod def value_parser(value: str) -> ContentDisposition: ... class ContentTransferEncodingHeader: + max_count: ClassVar[Literal[1]] + def init(self, name: str, *, parse_tree: TokenList, defects: Iterable[MessageDefect]) -> None: ... @property def cte(self) -> str: ... @classmethod @@ -105,18 +133,30 @@ class ContentTransferEncodingHeader: if sys.version_info >= (3, 8): from email._header_value_parser import MessageID + class MessageIDHeader: + max_count: ClassVar[Literal[1]] @classmethod def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... @staticmethod def value_parser(value: str) -> MessageID: ... +class _HeaderParser(Protocol): + max_count: ClassVar[Literal[1] | None] + @staticmethod + def value_parser(value: str) -> TokenList: ... + @classmethod + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... + class HeaderRegistry: + registry: dict[str, type[_HeaderParser]] + base_class: type[BaseHeader] + default_class: type[_HeaderParser] def __init__( - self, base_class: Type[BaseHeader] = ..., default_class: Type[BaseHeader] = ..., use_default_map: bool = ... + self, base_class: type[BaseHeader] = ..., default_class: type[_HeaderParser] = ..., use_default_map: bool = ... ) -> None: ... - def map_to_type(self, name: str, cls: Type[BaseHeader]) -> None: ... - def __getitem__(self, name: str) -> Type[BaseHeader]: ... + def map_to_type(self, name: str, cls: type[BaseHeader]) -> None: ... + def __getitem__(self, name: str) -> type[BaseHeader]: ... def __call__(self, name: str, value: Any) -> BaseHeader: ... class Address: @@ -131,12 +171,12 @@ class Address: def __init__( self, display_name: str = ..., username: str | None = ..., domain: str | None = ..., addr_spec: str | None = ... ) -> None: ... - def __str__(self) -> str: ... + def __eq__(self, other: object) -> bool: ... class Group: @property def display_name(self) -> str | None: ... @property - def addresses(self) -> Tuple[Address, ...]: ... + def addresses(self) -> tuple[Address, ...]: ... def __init__(self, display_name: str | None = ..., addresses: Iterable[Address] | None = ...) -> None: ... - def __str__(self) -> str: ... + def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/email/iterators.pyi b/stdlib/email/iterators.pyi index 9081a3e..2906881 100644 --- a/stdlib/email/iterators.pyi +++ b/stdlib/email/iterators.pyi @@ -1,5 +1,12 @@ +from _typeshed import SupportsWrite +from collections.abc import Iterator from email.message import Message -from typing import Iterator + +__all__ = ["body_line_iterator", "typed_subpart_iterator", "walk"] def body_line_iterator(msg: Message, decode: bool = ...) -> Iterator[str]: ... def typed_subpart_iterator(msg: Message, maintype: str = ..., subtype: str | None = ...) -> Iterator[str]: ... +def walk(self: Message) -> Iterator[Message]: ... + +# We include the seemingly private function because it is documented in the stdlib documentation. +def _structure(msg: Message, fp: SupportsWrite[str] | None = ..., level: int = ..., include_default: bool = ...) -> None: ... diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 9ad8c18..3c59aee 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -1,23 +1,26 @@ +from _typeshed import Self +from collections.abc import Generator, Iterator, Sequence +from email import _ParamsType, _ParamType from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy -from typing import Any, Generator, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union +from typing import Any, TypeVar +from typing_extensions import TypeAlias + +__all__ = ["Message", "EmailMessage"] _T = TypeVar("_T") -_PayloadType = Union[List[Message], str, bytes] -_CharsetType = Union[Charset, str, None] -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] -_ParamType = Union[str, Tuple[Optional[str], Optional[str], str]] -_HeaderType = Any +_PayloadType: TypeAlias = list[Message] | str | bytes | bytearray +_CharsetType: TypeAlias = Charset | str | None +_HeaderType: TypeAlias = Any class Message: policy: Policy # undocumented preamble: str | None epilogue: str | None defects: list[MessageDefect] - def __str__(self) -> str: ... def is_multipart(self) -> bool: ... def set_unixfrom(self, unixfrom: str) -> None: ... def get_unixfrom(self) -> str | None: ... @@ -34,7 +37,7 @@ class Message: def __delitem__(self, name: str) -> None: ... def keys(self) -> list[str]: ... def values(self) -> list[_HeaderType]: ... - def items(self) -> list[Tuple[str, _HeaderType]]: ... + def items(self) -> list[tuple[str, _HeaderType]]: ... def get(self, name: str, failobj: _T = ...) -> _HeaderType | _T: ... def get_all(self, name: str, failobj: _T = ...) -> list[_HeaderType] | _T: ... def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ... @@ -44,7 +47,7 @@ class Message: def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... - def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> list[Tuple[str, str]] | _T: ... + def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> list[tuple[str, str]] | _T: ... def get_param(self, param: str, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> _T | _ParamType: ... def del_param(self, param: str, header: str = ..., requote: bool = ...) -> None: ... def set_type(self, type: str, header: str = ..., requote: bool = ...) -> None: ... @@ -53,7 +56,7 @@ class Message: def set_boundary(self, boundary: str) -> None: ... def get_content_charset(self, failobj: _T = ...) -> _T | str: ... def get_charsets(self, failobj: _T = ...) -> _T | list[str]: ... - def walk(self) -> Generator[Message, None, None]: ... + def walk(self: Self) -> Generator[Self, None, None]: ... def get_content_disposition(self) -> str | None: ... def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Policy | None = ...) -> str: ... def as_bytes(self, unixfrom: bool = ..., policy: Policy | None = ...) -> bytes: ... @@ -69,6 +72,9 @@ class Message: replace: bool = ..., ) -> None: ... def __init__(self, policy: Policy = ...) -> None: ... + # The following two methods are undocumented, but a source code comment states that they are public API + def set_raw(self, name: str, value: str) -> None: ... + def raw_items(self) -> Iterator[tuple[str, str]]: ... class MIMEPart(Message): def __init__(self, policy: Policy | None = ...) -> None: ... diff --git a/stdlib/email/mime/application.pyi b/stdlib/email/mime/application.pyi index 11fc470..5ff60bf 100644 --- a/stdlib/email/mime/application.pyi +++ b/stdlib/email/mime/application.pyi @@ -1,15 +1,16 @@ +from collections.abc import Callable +from email import _ParamsType from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy -from typing import Callable, Optional, Tuple, Union -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] +__all__ = ["MIMEApplication"] class MIMEApplication(MIMENonMultipart): def __init__( self, - _data: str | bytes, + _data: str | bytes | bytearray, _subtype: str = ..., - _encoder: Callable[[MIMEApplication], None] = ..., + _encoder: Callable[[MIMEApplication], object] = ..., *, policy: Policy | None = ..., **_params: _ParamsType, diff --git a/stdlib/email/mime/audio.pyi b/stdlib/email/mime/audio.pyi index ee6de41..05e173f 100644 --- a/stdlib/email/mime/audio.pyi +++ b/stdlib/email/mime/audio.pyi @@ -1,15 +1,16 @@ +from collections.abc import Callable +from email import _ParamsType from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy -from typing import Callable, Optional, Tuple, Union -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] +__all__ = ["MIMEAudio"] class MIMEAudio(MIMENonMultipart): def __init__( self, - _audiodata: str | bytes, + _audiodata: str | bytes | bytearray, _subtype: str | None = ..., - _encoder: Callable[[MIMEAudio], None] = ..., + _encoder: Callable[[MIMEAudio], object] = ..., *, policy: Policy | None = ..., **_params: _ParamsType, diff --git a/stdlib/email/mime/base.pyi b/stdlib/email/mime/base.pyi index b88dfd4..c8f2fe6 100644 --- a/stdlib/email/mime/base.pyi +++ b/stdlib/email/mime/base.pyi @@ -1,8 +1,8 @@ import email.message +from email import _ParamsType from email.policy import Policy -from typing import Optional, Tuple, Union -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] +__all__ = ["MIMEBase"] class MIMEBase(email.message.Message): def __init__(self, _maintype: str, _subtype: str, *, policy: Policy | None = ..., **_params: _ParamsType) -> None: ... diff --git a/stdlib/email/mime/image.pyi b/stdlib/email/mime/image.pyi index 886aa74..7e46b83 100644 --- a/stdlib/email/mime/image.pyi +++ b/stdlib/email/mime/image.pyi @@ -1,15 +1,16 @@ +from collections.abc import Callable +from email import _ParamsType from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy -from typing import Callable, Optional, Tuple, Union -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] +__all__ = ["MIMEImage"] class MIMEImage(MIMENonMultipart): def __init__( self, - _imagedata: str | bytes, + _imagedata: str | bytes | bytearray, _subtype: str | None = ..., - _encoder: Callable[[MIMEImage], None] = ..., + _encoder: Callable[[MIMEImage], object] = ..., *, policy: Policy | None = ..., **_params: _ParamsType, diff --git a/stdlib/email/mime/message.pyi b/stdlib/email/mime/message.pyi index 8878741..9e7cd04 100644 --- a/stdlib/email/mime/message.pyi +++ b/stdlib/email/mime/message.pyi @@ -2,5 +2,7 @@ from email.message import Message from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy +__all__ = ["MIMEMessage"] + class MIMEMessage(MIMENonMultipart): def __init__(self, _msg: Message, _subtype: str = ..., *, policy: Policy | None = ...) -> None: ... diff --git a/stdlib/email/mime/multipart.pyi b/stdlib/email/mime/multipart.pyi index 6259ddf..6cd480c 100644 --- a/stdlib/email/mime/multipart.pyi +++ b/stdlib/email/mime/multipart.pyi @@ -1,9 +1,10 @@ +from collections.abc import Sequence +from email import _ParamsType from email.message import Message from email.mime.base import MIMEBase from email.policy import Policy -from typing import Optional, Sequence, Tuple, Union -_ParamsType = Union[str, None, Tuple[str, Optional[str], str]] +__all__ = ["MIMEMultipart"] class MIMEMultipart(MIMEBase): def __init__( diff --git a/stdlib/email/mime/nonmultipart.pyi b/stdlib/email/mime/nonmultipart.pyi index 4addff1..5497d89 100644 --- a/stdlib/email/mime/nonmultipart.pyi +++ b/stdlib/email/mime/nonmultipart.pyi @@ -1,3 +1,5 @@ from email.mime.base import MIMEBase +__all__ = ["MIMENonMultipart"] + class MIMENonMultipart(MIMEBase): ... diff --git a/stdlib/email/mime/text.pyi b/stdlib/email/mime/text.pyi index afcafa6..9672c3b 100644 --- a/stdlib/email/mime/text.pyi +++ b/stdlib/email/mime/text.pyi @@ -1,5 +1,7 @@ from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy +__all__ = ["MIMEText"] + class MIMEText(MIMENonMultipart): def __init__(self, _text: str, _subtype: str = ..., _charset: str | None = ..., *, policy: Policy | None = ...) -> None: ... diff --git a/stdlib/email/parser.pyi b/stdlib/email/parser.pyi index 574c927..1afd894 100644 --- a/stdlib/email/parser.pyi +++ b/stdlib/email/parser.pyi @@ -1,27 +1,21 @@ -import email.feedparser +from collections.abc import Callable +from email.feedparser import BytesFeedParser as BytesFeedParser, FeedParser as FeedParser from email.message import Message from email.policy import Policy -from typing import BinaryIO, Callable, TextIO +from typing import BinaryIO, TextIO -FeedParser = email.feedparser.FeedParser -BytesFeedParser = email.feedparser.BytesFeedParser +__all__ = ["Parser", "HeaderParser", "BytesParser", "BytesHeaderParser", "FeedParser", "BytesFeedParser"] class Parser: def __init__(self, _class: Callable[[], Message] | None = ..., *, policy: Policy = ...) -> None: ... def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ... def parsestr(self, text: str, headersonly: bool = ...) -> Message: ... -class HeaderParser(Parser): - def __init__(self, _class: Callable[[], Message] | None = ..., *, policy: Policy = ...) -> None: ... - def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ... - def parsestr(self, text: str, headersonly: bool = ...) -> Message: ... - -class BytesHeaderParser(BytesParser): - def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... - def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ... - def parsebytes(self, text: bytes, headersonly: bool = ...) -> Message: ... +class HeaderParser(Parser): ... class BytesParser: def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ... - def parsebytes(self, text: bytes, headersonly: bool = ...) -> Message: ... + def parsebytes(self, text: bytes | bytearray, headersonly: bool = ...) -> Message: ... + +class BytesHeaderParser(BytesParser): ... diff --git a/stdlib/email/policy.pyi b/stdlib/email/policy.pyi index 625e6a5..4df3c1e 100644 --- a/stdlib/email/policy.pyi +++ b/stdlib/email/policy.pyi @@ -1,25 +1,38 @@ -from abc import abstractmethod +from abc import ABCMeta, abstractmethod +from collections.abc import Callable from email.contentmanager import ContentManager from email.errors import MessageDefect from email.header import Header from email.message import Message -from typing import Any, Callable, Tuple +from typing import Any -class Policy: +__all__ = ["Compat32", "compat32", "Policy", "EmailPolicy", "default", "strict", "SMTP", "HTTP"] + +class Policy(metaclass=ABCMeta): max_line_length: int | None linesep: str cte_type: str raise_on_defect: bool - mange_from: bool - def __init__(self, **kw: Any) -> None: ... + mangle_from_: bool + message_factory: Callable[[Policy], Message] | None + def __init__( + self, + *, + max_line_length: int | None = ..., + linesep: str = ..., + cte_type: str = ..., + raise_on_defect: bool = ..., + mangle_from_: bool = ..., + message_factory: Callable[[Policy], Message] | None = ..., + ) -> None: ... def clone(self, **kw: Any) -> Policy: ... def handle_defect(self, obj: Message, defect: MessageDefect) -> None: ... def register_defect(self, obj: Message, defect: MessageDefect) -> None: ... def header_max_count(self, name: str) -> int | None: ... @abstractmethod - def header_source_parse(self, sourcelines: list[str]) -> Tuple[str, str]: ... + def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ... @abstractmethod - def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... + def header_store_parse(self, name: str, value: str) -> tuple[str, str]: ... @abstractmethod def header_fetch_parse(self, name: str, value: str) -> str: ... @abstractmethod @@ -28,9 +41,9 @@ class Policy: def fold_binary(self, name: str, value: str) -> bytes: ... class Compat32(Policy): - def header_source_parse(self, sourcelines: list[str]) -> Tuple[str, str]: ... - def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... - def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore + def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ... + def header_store_parse(self, name: str, value: str) -> tuple[str, str]: ... + def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore[override] def fold(self, name: str, value: str) -> str: ... def fold_binary(self, name: str, value: str) -> bytes: ... @@ -41,8 +54,22 @@ class EmailPolicy(Policy): refold_source: str header_factory: Callable[[str, str], str] content_manager: ContentManager - def header_source_parse(self, sourcelines: list[str]) -> Tuple[str, str]: ... - def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... + def __init__( + self, + *, + max_line_length: int | None = ..., + linesep: str = ..., + cte_type: str = ..., + raise_on_defect: bool = ..., + mangle_from_: bool = ..., + message_factory: Callable[[Policy], Message] | None = ..., + utf8: bool = ..., + refold_source: str = ..., + header_factory: Callable[[str, str], str] = ..., + content_manager: ContentManager = ..., + ) -> None: ... + def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ... + def header_store_parse(self, name: str, value: str) -> tuple[str, str]: ... def header_fetch_parse(self, name: str, value: str) -> str: ... def fold(self, name: str, value: str) -> str: ... def fold_binary(self, name: str, value: str) -> bytes: ... diff --git a/stdlib/email/quoprimime.pyi b/stdlib/email/quoprimime.pyi new file mode 100644 index 0000000..ec0c799 --- /dev/null +++ b/stdlib/email/quoprimime.pyi @@ -0,0 +1,28 @@ +from collections.abc import Iterable + +__all__ = [ + "body_decode", + "body_encode", + "body_length", + "decode", + "decodestring", + "header_decode", + "header_encode", + "header_length", + "quote", + "unquote", +] + +def header_check(octet: int) -> bool: ... +def body_check(octet: int) -> bool: ... +def header_length(bytearray: Iterable[int]) -> int: ... +def body_length(bytearray: Iterable[int]) -> int: ... +def unquote(s: str | bytes | bytearray) -> str: ... +def quote(c: str | bytes | bytearray) -> str: ... +def header_encode(header_bytes: bytes | bytearray, charset: str = ...) -> str: ... +def body_encode(body: str, maxlinelen: int = ..., eol: str = ...) -> str: ... +def decode(encoded: str, eol: str = ...) -> str: ... +def header_decode(s: str) -> str: ... + +body_decode = decode +decodestring = decode diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 96d75a6..480c5f7 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -1,20 +1,39 @@ import datetime import sys +from email import _ParamType from email.charset import Charset -from typing import Optional, Tuple, Union, overload +from typing import overload +from typing_extensions import TypeAlias -_ParamType = Union[str, Tuple[Optional[str], Optional[str], str]] -_PDTZ = Tuple[int, int, int, int, int, int, int, int, int, Optional[int]] +__all__ = [ + "collapse_rfc2231_value", + "decode_params", + "decode_rfc2231", + "encode_rfc2231", + "formataddr", + "formatdate", + "format_datetime", + "getaddresses", + "make_msgid", + "mktime_tz", + "parseaddr", + "parsedate", + "parsedate_tz", + "parsedate_to_datetime", + "unquote", +] + +_PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None] def quote(str: str) -> str: ... def unquote(str: str) -> str: ... -def parseaddr(addr: str | None) -> Tuple[str, str]: ... -def formataddr(pair: Tuple[str | None, str], charset: str | Charset = ...) -> str: ... -def getaddresses(fieldvalues: list[str]) -> list[Tuple[str, str]]: ... +def parseaddr(addr: str | None) -> tuple[str, str]: ... +def formataddr(pair: tuple[str | None, str], charset: str | Charset = ...) -> str: ... +def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... @overload -def parsedate(data: str) -> Tuple[int, int, int, int, int, int, int, int, int] | None: ... +def parsedate(data: str) -> tuple[int, int, int, int, int, int, int, int, int] | None: ... @overload def parsedate_tz(data: None) -> None: ... @overload @@ -34,7 +53,7 @@ def formatdate(timeval: float | None = ..., localtime: bool = ..., usegmt: bool def format_datetime(dt: datetime.datetime, usegmt: bool = ...) -> str: ... def localtime(dt: datetime.datetime | None = ..., isdst: int = ...) -> datetime.datetime: ... def make_msgid(idstring: str | None = ..., domain: str | None = ...) -> str: ... -def decode_rfc2231(s: str) -> Tuple[str | None, str | None, str]: ... +def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ... def encode_rfc2231(s: str, charset: str | None = ..., language: str | None = ...) -> str: ... def collapse_rfc2231_value(value: _ParamType, errors: str = ..., fallback_charset: str = ...) -> str: ... -def decode_params(params: list[Tuple[str, str]]) -> list[Tuple[str, _ParamType]]: ... +def decode_params(params: list[tuple[str, str]]) -> list[tuple[str, _ParamType]]: ... diff --git a/stdlib/encodings/__init__.pyi b/stdlib/encodings/__init__.pyi index d864667..2e83f0f 100644 --- a/stdlib/encodings/__init__.pyi +++ b/stdlib/encodings/__init__.pyi @@ -1,5 +1,5 @@ +from _typeshed import Incomplete from codecs import CodecInfo -from typing import Any class CodecRegistryError(LookupError, SystemError): ... @@ -7,4 +7,4 @@ def normalize_encoding(encoding: str | bytes) -> str: ... def search_function(encoding: str) -> CodecInfo | None: ... # Needed for submodules -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stdlib/encodings/utf_8.pyi b/stdlib/encodings/utf_8.pyi index 892f2f0..8e73756 100644 --- a/stdlib/encodings/utf_8.pyi +++ b/stdlib/encodings/utf_8.pyi @@ -1,21 +1,21 @@ import codecs -from typing import Tuple +from _typeshed import ReadableBuffer class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = ...) -> bytes: ... class IncrementalDecoder(codecs.BufferedIncrementalDecoder): @staticmethod - def _buffer_decode(__data: bytes, __errors: str | None = ..., __final: bool = ...) -> Tuple[str, int]: ... + def _buffer_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ... class StreamWriter(codecs.StreamWriter): @staticmethod - def encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... + def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... class StreamReader(codecs.StreamReader): @staticmethod - def decode(__data: bytes, __errors: str | None = ..., __final: bool = ...) -> Tuple[str, int]: ... + def decode(__data: ReadableBuffer, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ... def getregentry() -> codecs.CodecInfo: ... -def encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... -def decode(input: bytes, errors: str | None = ...) -> Tuple[str, int]: ... +def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... +def decode(input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... diff --git a/stdlib/encodings/utf_8_sig.pyi b/stdlib/encodings/utf_8_sig.pyi new file mode 100644 index 0000000..2717106 --- /dev/null +++ b/stdlib/encodings/utf_8_sig.pyi @@ -0,0 +1,22 @@ +import codecs +from _typeshed import ReadableBuffer + +class IncrementalEncoder(codecs.IncrementalEncoder): + def __init__(self, errors: str = ...) -> None: ... + def encode(self, input: str, final: bool = ...) -> bytes: ... + def getstate(self) -> int: ... # type: ignore[override] + def setstate(self, state: int) -> None: ... # type: ignore[override] + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def __init__(self, errors: str = ...) -> None: ... + def _buffer_decode(self, input: ReadableBuffer, errors: str | None, final: bool) -> tuple[str, int]: ... + +class StreamWriter(codecs.StreamWriter): + def encode(self, input: str, errors: str | None = ...) -> tuple[bytes, int]: ... + +class StreamReader(codecs.StreamReader): + def decode(self, input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... + +def getregentry() -> codecs.CodecInfo: ... +def encode(input: str, errors: str | None = ...) -> tuple[bytes, int]: ... +def decode(input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... diff --git a/stdlib/ensurepip/__init__.pyi b/stdlib/ensurepip/__init__.pyi index 749fedc..e2686b8 100644 --- a/stdlib/ensurepip/__init__.pyi +++ b/stdlib/ensurepip/__init__.pyi @@ -1,3 +1,5 @@ +__all__ = ["version", "bootstrap"] + def version() -> str: ... def bootstrap( *, diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 07fea10..a14744f 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -1,11 +1,76 @@ import sys import types +from _typeshed import Self, SupportsKeysAndGetItem from abc import ABCMeta from builtins import property as _builtins_property -from typing import Any, Iterator, Type, TypeVar +from collections.abc import Iterable, Iterator, Mapping +from typing import Any, Generic, TypeVar, overload +from typing_extensions import Literal, TypeAlias -_T = TypeVar("_T") -_S = TypeVar("_S", bound=Type[Enum]) +__all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"] + +if sys.version_info >= (3, 11): + __all__ += [ + "CONFORM", + "CONTINUOUS", + "EJECT", + "EnumCheck", + "EnumType", + "FlagBoundary", + "KEEP", + "NAMED_FLAGS", + "ReprEnum", + "STRICT", + "StrEnum", + "UNIQUE", + "global_enum", + "global_enum_repr", + "global_flag_repr", + "global_str", + "member", + "nonmember", + "property", + "verify", + ] + +_EnumMemberT = TypeVar("_EnumMemberT") +_EnumerationT = TypeVar("_EnumerationT", bound=type[Enum]) + +# The following all work: +# >>> from enum import Enum +# >>> from string import ascii_lowercase +# >>> Enum('Foo', names='RED YELLOW GREEN') +# +# >>> Enum('Foo', names=[('RED', 1), ('YELLOW, 2)]) +# +# >>> Enum('Foo', names=((x for x in (ascii_lowercase[i], i)) for i in range(5))) +# +# >>> Enum('Foo', names={'RED': 1, 'YELLOW': 2}) +# +_EnumNames: TypeAlias = str | Iterable[str] | Iterable[Iterable[str | Any]] | Mapping[str, Any] + +if sys.version_info >= (3, 11): + class nonmember(Generic[_EnumMemberT]): + value: _EnumMemberT + def __init__(self, value: _EnumMemberT) -> None: ... + + class member(Generic[_EnumMemberT]): + value: _EnumMemberT + def __init__(self, value: _EnumMemberT) -> None: ... + +class _EnumDict(dict[str, Any]): + def __init__(self) -> None: ... + def __setitem__(self, key: str, value: Any) -> None: ... + if sys.version_info >= (3, 11): + # See comment above `typing.MutableMapping.update` + # for why overloads are preferable to a Union here + # + # Unlike with MutableMapping.update(), the first argument is required, + # hence the type: ignore + @overload # type: ignore[override] + def update(self, members: SupportsKeysAndGetItem[str, Any], **more_members: Any) -> None: ... + @overload + def update(self, members: Iterable[tuple[str, Any]], **more_members: Any) -> None: ... # Note: EnumMeta actually subclasses type directly, not ABCMeta. # This is a temporary workaround to allow multiple creation of enums with builtins @@ -13,75 +78,192 @@ _S = TypeVar("_S", bound=Type[Enum]) # 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: Type[Any], member: object) -> bool: ... - def __getitem__(self: Type[_T], name: str) -> _T: ... + if sys.version_info >= (3, 11): + def __new__( + metacls: type[Self], + cls: str, + bases: tuple[type, ...], + classdict: _EnumDict, + *, + boundary: FlagBoundary | None = ..., + _simple: bool = ..., + **kwds: Any, + ) -> Self: ... + elif sys.version_info >= (3, 9): + def __new__(metacls: type[Self], cls: str, bases: tuple[type, ...], classdict: _EnumDict, **kwds: Any) -> Self: ... + else: + def __new__(metacls: type[Self], cls: str, bases: tuple[type, ...], classdict: _EnumDict) -> Self: ... + + if sys.version_info >= (3, 9): + @classmethod + def __prepare__(metacls, cls: str, bases: tuple[type, ...], **kwds: Any) -> _EnumDict: ... # type: ignore[override] + else: + @classmethod + def __prepare__(metacls, cls: str, bases: tuple[type, ...]) -> _EnumDict: ... # type: ignore[override] + + def __iter__(self: type[_EnumMemberT]) -> Iterator[_EnumMemberT]: ... + def __reversed__(self: type[_EnumMemberT]) -> Iterator[_EnumMemberT]: ... + def __contains__(self: type[Any], obj: object) -> bool: ... + def __getitem__(self: type[_EnumMemberT], name: str) -> _EnumMemberT: ... @_builtins_property - def __members__(self: Type[_T]) -> types.MappingProxyType[str, _T]: ... + def __members__(self: type[_EnumMemberT]) -> types.MappingProxyType[str, _EnumMemberT]: ... def __len__(self) -> int: ... + def __bool__(self) -> Literal[True]: ... + def __dir__(self) -> list[str]: ... + # Simple value lookup + @overload # type: ignore[override] + def __call__(cls: type[_EnumMemberT], value: Any, names: None = ...) -> _EnumMemberT: ... + # Functional Enum API + if sys.version_info >= (3, 11): + @overload + def __call__( + cls, + value: str, + names: _EnumNames, + *, + module: str | None = ..., + qualname: str | None = ..., + type: type | None = ..., + start: int = ..., + boundary: FlagBoundary | None = ..., + ) -> type[Enum]: ... + else: + @overload + def __call__( + cls, + value: str, + names: _EnumNames, + *, + module: str | None = ..., + qualname: str | None = ..., + type: type | None = ..., + start: int = ..., + ) -> type[Enum]: ... _member_names_: list[str] # undocumented _member_map_: dict[str, Enum] # undocumented _value2member_map_: dict[Any, Enum] # undocumented +if sys.version_info >= (3, 11): + # In 3.11 `EnumMeta` metaclass is renamed to `EnumType`, but old name also exists. + EnumType = EnumMeta + + class property(types.DynamicClassAttribute): + def __set_name__(self, ownerclass: type[Enum], name: str) -> None: ... + name: str + clsname: str + _magic_enum_attr = property +else: + _magic_enum_attr = types.DynamicClassAttribute + class Enum(metaclass=EnumMeta): - name: str - value: Any + @_magic_enum_attr + def name(self) -> str: ... + @_magic_enum_attr + def value(self) -> Any: ... _name_: str _value_: Any - if sys.version_info >= (3, 7): - _ignore_: str | list[str] + _ignore_: 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: ... + # It's not true that `__new__` will accept any argument type, + # so ideally we'd use `Any` to indicate that the argument type is inexpressible. + # However, using `Any` causes too many false-positives for those using mypy's `--disallow-any-expr` + # (see #7752, #2539, mypy/#5788), + # and in practice using `object` here has the same effect as using `Any`. + def __new__(cls: type[Self], value: object) -> Self: ... def __dir__(self) -> list[str]: ... def __format__(self, format_spec: str) -> str: ... - def __hash__(self) -> Any: ... - def __reduce_ex__(self, proto: object) -> Any: ... + def __reduce_ex__(self, proto: object) -> tuple[Any, ...]: ... + +if sys.version_info >= (3, 11): + class ReprEnum(Enum): ... -class IntEnum(int, Enum): - value: int - def __new__(cls: Type[_T], value: int | _T) -> _T: ... +if sys.version_info >= (3, 11): + _IntEnumBase = ReprEnum +else: + _IntEnumBase = Enum -def unique(enumeration: _S) -> _S: ... +class IntEnum(int, _IntEnumBase): + _value_: int + @_magic_enum_attr + def value(self) -> int: ... + def __new__(cls: type[Self], value: int) -> Self: ... + +def unique(enumeration: _EnumerationT) -> _EnumerationT: ... _auto_null: Any # subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto() class auto(IntFlag): - value: Any - def __new__(cls: Type[_T]) -> _T: ... + _value_: Any + @_magic_enum_attr + def value(self) -> Any: ... + def __new__(cls: type[Self]) -> Self: ... class Flag(Enum): - name: str | None # type: ignore - value: int - def __contains__(self: _T, other: _T) -> bool: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... + _name_: str | None # type: ignore[assignment] + _value_: int + @_magic_enum_attr + def name(self) -> str | None: ... # type: ignore[override] + @_magic_enum_attr + def value(self) -> int: ... + def __contains__(self: Self, other: Self) -> bool: ... 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 __new__(cls: Type[_T], value: int | _T) -> _T: ... - def __or__(self: _T, other: int | _T) -> _T: ... - def __and__(self: _T, other: int | _T) -> _T: ... - def __xor__(self: _T, other: int | _T) -> _T: ... - def __ror__(self: _T, n: int | _T) -> _T: ... - def __rand__(self: _T, n: int | _T) -> _T: ... - def __rxor__(self: _T, n: int | _T) -> _T: ... + def __or__(self: Self, other: Self) -> Self: ... + def __and__(self: Self, other: Self) -> Self: ... + def __xor__(self: Self, other: Self) -> Self: ... + def __invert__(self: Self) -> Self: ... + if sys.version_info >= (3, 11): + def __iter__(self: Self) -> Iterator[Self]: ... + def __len__(self) -> int: ... + __ror__ = __or__ + __rand__ = __and__ + __rxor__ = __xor__ if sys.version_info >= (3, 11): - class StrEnum(str, Enum): - def __new__(cls: Type[_T], value: int | _T) -> _T: ... + # The body of the class is the same, but the base classes are different. + class IntFlag(int, ReprEnum, Flag, boundary=KEEP): + def __new__(cls: type[Self], value: int) -> Self: ... + def __or__(self: Self, other: int) -> Self: ... + def __and__(self: Self, other: int) -> Self: ... + def __xor__(self: Self, other: int) -> Self: ... + __ror__ = __or__ + __rand__ = __and__ + __rxor__ = __xor__ + +else: + class IntFlag(int, Flag): + def __new__(cls: type[Self], value: int) -> Self: ... + def __or__(self: Self, other: int) -> Self: ... + def __and__(self: Self, other: int) -> Self: ... + def __xor__(self: Self, other: int) -> Self: ... + __ror__ = __or__ + __rand__ = __and__ + __rxor__ = __xor__ + +if sys.version_info >= (3, 11): + class StrEnum(str, ReprEnum): + def __new__(cls: type[Self], value: str) -> Self: ... + _value_: str + @_magic_enum_attr + def value(self) -> str: ... + + class EnumCheck(StrEnum): + CONTINUOUS: str + NAMED_FLAGS: str + UNIQUE: str + CONTINUOUS = EnumCheck.CONTINUOUS + NAMED_FLAGS = EnumCheck.NAMED_FLAGS + UNIQUE = EnumCheck.UNIQUE + + class verify: + def __init__(self, *checks: EnumCheck) -> None: ... + def __call__(self, enumeration: _EnumerationT) -> _EnumerationT: ... + class FlagBoundary(StrEnum): STRICT: str CONFORM: str @@ -91,7 +273,8 @@ if sys.version_info >= (3, 11): CONFORM = FlagBoundary.CONFORM EJECT = FlagBoundary.EJECT KEEP = FlagBoundary.KEEP - class property(_builtins_property): ... - def global_enum(cls: _S) -> _S: ... + + def global_str(self: Enum) -> str: ... + def global_enum(cls: _EnumerationT, update_str: bool = ...) -> _EnumerationT: ... def global_enum_repr(self: Enum) -> str: ... def global_flag_repr(self: Flag) -> str: ... diff --git a/stdlib/errno.pyi b/stdlib/errno.pyi index b053604..28874d4 100644 --- a/stdlib/errno.pyi +++ b/stdlib/errno.pyi @@ -1,4 +1,5 @@ -from typing import Mapping +import sys +from collections.abc import Mapping errorcode: Mapping[int, str] @@ -16,7 +17,6 @@ EAGAIN: int ENOMEM: int EACCES: int EFAULT: int -ENOTBLK: int EBUSY: int EEXIST: int EXDEV: int @@ -36,7 +36,7 @@ EMLINK: int EPIPE: int EDOM: int ERANGE: int -EDEADLCK: int +EDEADLK: int ENAMETOOLONG: int ENOLCK: int ENOSYS: int @@ -45,49 +45,16 @@ ELOOP: int EWOULDBLOCK: int ENOMSG: int EIDRM: int -ECHRNG: int -EL2NSYNC: int -EL3HLT: int -EL3RST: int -ELNRNG: int -EUNATCH: int -ENOCSI: int -EL2HLT: int -EBADE: int -EBADR: int -EXFULL: int -ENOANO: int -EBADRQC: int -EBADSLT: int -EDEADLOCK: int -EBFONT: int ENOSTR: int ENODATA: int ETIME: int ENOSR: int -ENONET: int -ENOPKG: int EREMOTE: int ENOLINK: int -EADV: int -ESRMNT: int -ECOMM: int EPROTO: int -EMULTIHOP: int -EDOTDOT: int EBADMSG: int EOVERFLOW: int -ENOTUNIQ: int -EBADFD: int -EREMCHG: int -ELIBACC: int -ELIBBAD: int -ELIBSCN: int -ELIBMAX: int -ELIBEXEC: int EILSEQ: int -ERESTART: int -ESTRPIPE: int EUSERS: int ENOTSOCK: int EDESTADDRREQ: int @@ -119,19 +86,135 @@ EHOSTUNREACH: int EALREADY: int EINPROGRESS: int ESTALE: int -EUCLEAN: int -ENOTNAM: int -ENAVAIL: int -EISNAM: int -EREMOTEIO: int EDQUOT: int ECANCELED: int # undocumented -EKEYEXPIRED: int # undocumented -EKEYREJECTED: int # undocumented -EKEYREVOKED: int # undocumented -EMEDIUMTYPE: int # undocumented -ENOKEY: int # undocumented -ENOMEDIUM: int # undocumented ENOTRECOVERABLE: int # undocumented EOWNERDEAD: int # undocumented -ERFKILL: int # undocumented + +if sys.platform != "win32": + ENOTBLK: int + EMULTIHOP: int + # All of the below are undocumented + EAUTH: int + EBADARCH: int + EBADEXEC: int + EBADMACHO: int + EBADRPC: int + EDEVERR: int + EFTYPE: int + ENEEDAUTH: int + ENOATTR: int + ENOPOLICY: int + EPROCLIM: int + EPROCUNAVAIL: int + EPROGMISMATCH: int + EPROGUNAVAIL: int + EPWROFF: int + ERPCMISMATCH: int + ESHLIBVERS: int + + if sys.platform != "darwin" or sys.version_info >= (3, 11): + EQFULL: int # undocumented + +if sys.platform != "darwin": + EDEADLOCK: int + +if sys.platform != "win32" and sys.platform != "darwin": + ECHRNG: int + EL2NSYNC: int + EL3HLT: int + EL3RST: int + ELNRNG: int + EUNATCH: int + ENOCSI: int + EL2HLT: int + EBADE: int + EBADR: int + EXFULL: int + ENOANO: int + EBADRQC: int + EBADSLT: int + EBFONT: int + ENONET: int + ENOPKG: int + EADV: int + ESRMNT: int + ECOMM: int + EDOTDOT: int + ENOTUNIQ: int + EBADFD: int + EREMCHG: int + ELIBACC: int + ELIBBAD: int + ELIBSCN: int + ELIBMAX: int + ELIBEXEC: int + ERESTART: int + ESTRPIPE: int + EUCLEAN: int + ENOTNAM: int + ENAVAIL: int + EISNAM: int + EREMOTEIO: int + # All of the below are undocumented + EKEYEXPIRED: int + EKEYREJECTED: int + EKEYREVOKED: int + EMEDIUMTYPE: int + ENOKEY: int + ENOMEDIUM: int + ERFKILL: int + EL: int + ELOCKUNMAPPED: int + ENOTACTIVE: int + +if sys.platform == "win32": + # All of these are undocumented + WSABASEERR: int + WSAEACCES: int + WSAEADDRINUSE: int + WSAEADDRNOTAVAIL: int + WSAEAFNOSUPPORT: int + WSAEALREADY: int + WSAEBADF: int + WSAECONNABORTED: int + WSAECONNREFUSED: int + WSAECONNRESET: int + WSAEDESTADDRREQ: int + WSAEDISCON: int + WSAEDQUOT: int + WSAEFAULT: int + WSAEHOSTDOWN: int + WSAEHOSTUNREACH: int + WSAEINPROGRESS: int + WSAEINTR: int + WSAEINVAL: int + WSAEISCONN: int + WSAELOOP: int + WSAEMFILE: int + WSAEMSGSIZE: int + WSAENAMETOOLONG: int + WSAENETDOWN: int + WSAENETRESET: int + WSAENETUNREACH: int + WSAENOBUFS: int + WSAENOPROTOOPT: int + WSAENOTCONN: int + WSAENOTEMPTY: int + WSAENOTSOCK: int + WSAEOPNOTSUPP: int + WSAEPFNOSUPPORT: int + WSAEPROCLIM: int + WSAEPROTONOSUPPORT: int + WSAEPROTOTYPE: int + WSAEREMOTE: int + WSAESHUTDOWN: int + WSAESOCKTNOSUPPORT: int + WSAESTALE: int + WSAETIMEDOUT: int + WSAETOOMANYREFS: int + WSAEUSERS: int + WSAEWOULDBLOCK: int + WSANOTINITIALISED: int + WSASYSNOTREADY: int + WSAVERNOTSUPPORTED: int diff --git a/stdlib/fcntl.pyi b/stdlib/fcntl.pyi index 141f9ee..2df1608 100644 --- a/stdlib/fcntl.pyi +++ b/stdlib/fcntl.pyi @@ -3,94 +3,114 @@ from _typeshed import FileDescriptorLike, ReadOnlyBuffer, WriteableBuffer from typing import Any, overload from typing_extensions import Literal -FASYNC: int -FD_CLOEXEC: int -DN_ACCESS: int -DN_ATTRIB: int -DN_CREATE: int -DN_DELETE: int -DN_MODIFY: int -DN_MULTISHOT: int -DN_RENAME: int -F_DUPFD: int -F_DUPFD_CLOEXEC: int -F_FULLFSYNC: int -F_EXLCK: int -F_GETFD: int -F_GETFL: int -F_GETLEASE: int -F_GETLK: int -F_GETLK64: int -F_GETOWN: int -F_NOCACHE: int -F_GETSIG: int -F_NOTIFY: int -F_RDLCK: int -F_SETFD: int -F_SETFL: int -F_SETLEASE: int -F_SETLK: int -F_SETLK64: int -F_SETLKW: int -F_SETLKW64: int -if sys.version_info >= (3, 9) and sys.platform == "linux": - F_OFD_GETLK: int - F_OFD_SETLK: int - F_OFD_SETLKW: int -F_SETOWN: int -F_SETSIG: int -F_SHLCK: int -F_UNLCK: int -F_WRLCK: int -I_ATMARK: int -I_CANPUT: int -I_CKBAND: int -I_FDINSERT: int -I_FIND: int -I_FLUSH: int -I_FLUSHBAND: int -I_GETBAND: int -I_GETCLTIME: int -I_GETSIG: int -I_GRDOPT: int -I_GWROPT: int -I_LINK: int -I_LIST: int -I_LOOK: int -I_NREAD: int -I_PEEK: int -I_PLINK: int -I_POP: int -I_PUNLINK: int -I_PUSH: int -I_RECVFD: int -I_SENDFD: int -I_SETCLTIME: int -I_SETSIG: int -I_SRDOPT: int -I_STR: int -I_SWROPT: int -I_UNLINK: int -LOCK_EX: int -LOCK_MAND: int -LOCK_NB: int -LOCK_READ: int -LOCK_RW: int -LOCK_SH: int -LOCK_UN: int -LOCK_WRITE: int +if sys.platform != "win32": + FASYNC: int + FD_CLOEXEC: int + F_DUPFD: int + F_DUPFD_CLOEXEC: int + F_GETFD: int + F_GETFL: int + F_GETLK: int + F_GETOWN: int + F_RDLCK: int + F_SETFD: int + F_SETFL: int + F_SETLK: int + F_SETLKW: int + F_SETOWN: int + F_UNLCK: int + F_WRLCK: int + if sys.platform == "darwin": + F_FULLFSYNC: int + F_NOCACHE: int + if sys.version_info >= (3, 9): + F_GETPATH: int + if sys.platform == "linux": + F_SETLKW64: int + F_SETSIG: int + F_SHLCK: int + F_SETLK64: int + F_SETLEASE: int + F_GETSIG: int + F_NOTIFY: int + F_EXLCK: int + F_GETLEASE: int + F_GETLK64: int + if sys.version_info >= (3, 8): + F_ADD_SEALS: int + F_GET_SEALS: int + F_SEAL_GROW: int + F_SEAL_SEAL: int + F_SEAL_SHRINK: int + F_SEAL_WRITE: int + if sys.version_info >= (3, 9): + F_OFD_GETLK: int + F_OFD_SETLK: int + F_OFD_SETLKW: int + if sys.version_info >= (3, 10): + F_GETPIPE_SZ: int + F_SETPIPE_SZ: int -@overload -def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = ...) -> int: ... -@overload -def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: bytes) -> bytes: ... -@overload -def ioctl(__fd: FileDescriptorLike, __request: int, __arg: int = ..., __mutate_flag: bool = ...) -> int: ... -@overload -def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[True] = ...) -> int: ... -@overload -def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[False]) -> bytes: ... -@overload -def ioctl(__fd: FileDescriptorLike, __request: int, __arg: ReadOnlyBuffer, __mutate_flag: bool = ...) -> bytes: ... -def flock(__fd: FileDescriptorLike, __operation: int) -> None: ... -def lockf(__fd: FileDescriptorLike, __cmd: int, __len: int = ..., __start: int = ..., __whence: int = ...) -> Any: ... + DN_ACCESS: int + DN_ATTRIB: int + DN_CREATE: int + DN_DELETE: int + DN_MODIFY: int + DN_MULTISHOT: int + DN_RENAME: int + + LOCK_EX: int + LOCK_NB: int + LOCK_SH: int + LOCK_UN: int + if sys.platform == "linux": + LOCK_MAND: int + LOCK_READ: int + LOCK_RW: int + LOCK_WRITE: int + + # These are highly problematic, they might be present or not, depends on the specific OS. + if sys.platform == "linux": + I_ATMARK: int + I_CANPUT: int + I_CKBAND: int + I_FDINSERT: int + I_FIND: int + I_FLUSH: int + I_FLUSHBAND: int + I_GETBAND: int + I_GETCLTIME: int + I_GETSIG: int + I_GRDOPT: int + I_GWROPT: int + I_LINK: int + I_LIST: int + I_LOOK: int + I_NREAD: int + I_PEEK: int + I_PLINK: int + I_POP: int + I_PUNLINK: int + I_PUSH: int + I_RECVFD: int + I_SENDFD: int + I_SETCLTIME: int + I_SETSIG: int + I_SRDOPT: int + I_STR: int + I_SWROPT: int + I_UNLINK: int + @overload + def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = ...) -> int: ... + @overload + def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: str | ReadOnlyBuffer) -> bytes: ... + @overload + def ioctl(__fd: FileDescriptorLike, __request: int, __arg: int = ..., __mutate_flag: bool = ...) -> int: ... + @overload + def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[True] = ...) -> int: ... + @overload + def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[False]) -> bytes: ... + @overload + def ioctl(__fd: FileDescriptorLike, __request: int, __arg: ReadOnlyBuffer, __mutate_flag: bool = ...) -> bytes: ... + def flock(__fd: FileDescriptorLike, __operation: int) -> None: ... + def lockf(__fd: FileDescriptorLike, __cmd: int, __len: int = ..., __start: int = ..., __whence: int = ...) -> Any: ... diff --git a/stdlib/filecmp.pyi b/stdlib/filecmp.pyi index 0cc92ed..dd4a062 100644 --- a/stdlib/filecmp.pyi +++ b/stdlib/filecmp.pyi @@ -1,23 +1,27 @@ import sys -from _typeshed import StrOrBytesPath -from os import PathLike -from typing import Any, AnyStr, Callable, Generic, Iterable, Sequence, Tuple +from _typeshed import GenericPath, StrOrBytesPath +from collections.abc import Callable, Iterable, Sequence +from typing import Any, AnyStr, Generic +from typing_extensions import Literal if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = ["clear_cache", "cmp", "dircmp", "cmpfiles", "DEFAULT_IGNORES"] + DEFAULT_IGNORES: list[str] +BUFSIZE: Literal[8192] -def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: int | bool = ...) -> bool: ... +def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: bool | Literal[0, 1] = ...) -> bool: ... def cmpfiles( - a: AnyStr | PathLike[AnyStr], b: AnyStr | PathLike[AnyStr], common: Iterable[AnyStr], shallow: int | bool = ... -) -> Tuple[list[AnyStr], list[AnyStr], list[AnyStr]]: ... + a: GenericPath[AnyStr], b: GenericPath[AnyStr], common: Iterable[GenericPath[AnyStr]], shallow: bool | Literal[0, 1] = ... +) -> tuple[list[AnyStr], list[AnyStr], list[AnyStr]]: ... class dircmp(Generic[AnyStr]): def __init__( self, - a: AnyStr | PathLike[AnyStr], - b: AnyStr | PathLike[AnyStr], + a: GenericPath[AnyStr], + b: GenericPath[AnyStr], ignore: Sequence[AnyStr] | None = ..., hide: Sequence[AnyStr] | None = ..., ) -> None: ... diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index 3c14b73..e0babbc 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -1,41 +1,153 @@ import sys -from _typeshed import Self, StrOrBytesPath -from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator +from _typeshed import AnyStr_co, Self, StrOrBytesPath +from collections.abc import Callable, Iterable, Iterator +from types import TracebackType +from typing import IO, Any, AnyStr, Generic, Protocol, overload +from typing_extensions import Literal, TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = [ + "input", + "close", + "nextfile", + "filename", + "lineno", + "filelineno", + "fileno", + "isfirstline", + "isstdin", + "FileInput", + "hook_compressed", + "hook_encoded", +] + +if sys.version_info >= (3, 11): + _TextMode: TypeAlias = Literal["r"] +else: + _TextMode: TypeAlias = Literal["r", "rU", "U"] + +class _HasReadlineAndFileno(Protocol[AnyStr_co]): + def readline(self) -> AnyStr_co: ... + def fileno(self) -> int: ... + if sys.version_info >= (3, 10): + # encoding and errors are added + @overload def input( files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., inplace: bool = ..., backup: str = ..., *, - mode: str = ..., - openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., + mode: _TextMode = ..., + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ..., encoding: str | None = ..., errors: str | None = ..., - ) -> FileInput[AnyStr]: ... + ) -> FileInput[str]: ... + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + encoding: None = ..., + errors: None = ..., + ) -> FileInput[bytes]: ... + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + ) -> FileInput[Any]: ... elif sys.version_info >= (3, 8): + # bufsize is dropped and mode and openhook become keyword-only + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: _TextMode = ..., + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ..., + ) -> FileInput[str]: ... + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + ) -> FileInput[bytes]: ... + @overload def input( files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., inplace: bool = ..., backup: str = ..., *, - mode: str = ..., - openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., - ) -> FileInput[AnyStr]: ... + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + ) -> FileInput[Any]: ... else: + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + bufsize: int = ..., + mode: _TextMode = ..., + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ..., + ) -> FileInput[str]: ... + # Because mode isn't keyword-only here yet, we need two overloads each for + # the bytes case and the fallback case. + @overload def input( files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., inplace: bool = ..., backup: str = ..., bufsize: int = ..., - mode: str = ..., - openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., - ) -> FileInput[AnyStr]: ... + *, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + ) -> FileInput[bytes]: ... + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None, + inplace: bool, + backup: str, + bufsize: int, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + ) -> FileInput[bytes]: ... + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + bufsize: int = ..., + *, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + ) -> FileInput[Any]: ... + @overload + def input( + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None, + inplace: bool, + backup: str, + bufsize: int, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + ) -> FileInput[Any]: ... def close() -> None: ... def nextfile() -> None: ... @@ -46,46 +158,146 @@ def fileno() -> int: ... def isfirstline() -> bool: ... def isstdin() -> bool: ... -class FileInput(Iterable[AnyStr], Generic[AnyStr]): +class FileInput(Iterator[AnyStr], Generic[AnyStr]): if sys.version_info >= (3, 10): + # encoding and errors are added + @overload def __init__( - self, - files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ..., + self: FileInput[str], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., inplace: bool = ..., backup: str = ..., *, - mode: str = ..., - openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., + mode: _TextMode = ..., + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ..., encoding: str | None = ..., errors: str | None = ..., ) -> None: ... + @overload + def __init__( + self: FileInput[bytes], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + encoding: None = ..., + errors: None = ..., + ) -> None: ... + @overload + def __init__( + self: FileInput[Any], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + ) -> None: ... + elif sys.version_info >= (3, 8): + # bufsize is dropped and mode and openhook become keyword-only + @overload + def __init__( + self: FileInput[str], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: _TextMode = ..., + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ..., + ) -> None: ... + @overload def __init__( - self, - files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ..., + self: FileInput[bytes], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., inplace: bool = ..., backup: str = ..., *, - mode: str = ..., - openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., ) -> None: ... + @overload + def __init__( + self: FileInput[Any], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + *, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + ) -> None: ... + else: + @overload + def __init__( + self: FileInput[str], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + bufsize: int = ..., + mode: _TextMode = ..., + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ..., + ) -> None: ... + # Because mode isn't keyword-only here yet, we need two overloads each for + # the bytes case and the fallback case. + @overload + def __init__( + self: FileInput[bytes], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., + inplace: bool = ..., + backup: str = ..., + bufsize: int = ..., + *, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + ) -> None: ... + @overload + def __init__( + self: FileInput[bytes], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None, + inplace: bool, + backup: str, + bufsize: int, + mode: Literal["rb"], + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ..., + ) -> None: ... + @overload def __init__( - self, - files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ..., + self: FileInput[Any], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ..., inplace: bool = ..., backup: str = ..., bufsize: int = ..., - mode: str = ..., - openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., + *, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., + ) -> None: ... + @overload + def __init__( + self: FileInput[Any], + files: StrOrBytesPath | Iterable[StrOrBytesPath] | None, + inplace: bool, + backup: str, + bufsize: int, + mode: str, + openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ..., ) -> None: ... + def __del__(self) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... - def __iter__(self) -> Iterator[AnyStr]: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> AnyStr: ... - def __getitem__(self, i: int) -> AnyStr: ... + if sys.version_info < (3, 11): + def __getitem__(self, i: int) -> AnyStr: ... + def nextfile(self) -> None: ... def readline(self) -> AnyStr: ... def filename(self) -> str: ... diff --git a/stdlib/fnmatch.pyi b/stdlib/fnmatch.pyi index 1cbcf00..7051c99 100644 --- a/stdlib/fnmatch.pyi +++ b/stdlib/fnmatch.pyi @@ -1,4 +1,7 @@ -from typing import AnyStr, Iterable +from collections.abc import Iterable +from typing import AnyStr + +__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"] def fnmatch(name: AnyStr, pat: AnyStr) -> bool: ... def fnmatchcase(name: AnyStr, pat: AnyStr) -> bool: ... diff --git a/stdlib/formatter.pyi b/stdlib/formatter.pyi index 7c3b976..388dbd6 100644 --- a/stdlib/formatter.pyi +++ b/stdlib/formatter.pyi @@ -1,8 +1,10 @@ -from typing import IO, Any, Iterable, Tuple +from collections.abc import Iterable +from typing import IO, Any +from typing_extensions import TypeAlias AS_IS: None -_FontType = Tuple[str, bool, bool, bool] -_StylesType = Tuple[Any, ...] +_FontType: TypeAlias = tuple[str, bool, bool, bool] +_StylesType: TypeAlias = tuple[Any, ...] class NullFormatter: writer: NullWriter | None @@ -62,13 +64,12 @@ class AbstractFormatter: def assert_line_data(self, flag: int = ...) -> None: ... class NullWriter: - def __init__(self) -> None: ... def flush(self) -> None: ... def new_alignment(self, align: str | None) -> None: ... def new_font(self, font: _FontType) -> None: ... def new_margin(self, margin: int, level: int) -> None: ... def new_spacing(self, spacing: str | None) -> None: ... - def new_styles(self, styles: Tuple[Any, ...]) -> None: ... + def new_styles(self, styles: tuple[Any, ...]) -> None: ... def send_paragraph(self, blankline: int) -> None: ... def send_line_break(self) -> None: ... def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... @@ -76,28 +77,12 @@ class NullWriter: def send_flowing_data(self, data: str) -> None: ... def send_literal_data(self, data: str) -> None: ... -class AbstractWriter(NullWriter): - def new_alignment(self, align: str | None) -> None: ... - def new_font(self, font: _FontType) -> None: ... - def new_margin(self, margin: int, level: int) -> None: ... - def new_spacing(self, spacing: str | None) -> None: ... - def new_styles(self, styles: Tuple[Any, ...]) -> None: ... - def send_paragraph(self, blankline: int) -> None: ... - def send_line_break(self) -> None: ... - def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def send_label_data(self, data: str) -> None: ... - def send_flowing_data(self, data: str) -> None: ... - def send_literal_data(self, data: str) -> None: ... +class AbstractWriter(NullWriter): ... class DumbWriter(NullWriter): file: IO[str] maxcol: int def __init__(self, file: IO[str] | None = ..., maxcol: int = ...) -> None: ... def reset(self) -> None: ... - def send_paragraph(self, blankline: int) -> None: ... - def send_line_break(self) -> None: ... - def send_hor_rule(self, *args: Any, **kw: Any) -> None: ... - def send_literal_data(self, data: str) -> None: ... - def send_flowing_data(self, data: str) -> None: ... def test(file: str | None = ...) -> None: ... diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index a5d2e21..e05f59e 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -1,13 +1,17 @@ import sys +from _typeshed import Self +from collections.abc import Callable from decimal import Decimal from numbers import Integral, Rational, Real -from typing import Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal +from typing import Any, overload +from typing_extensions import Literal, SupportsIndex, TypeAlias -_ComparableNum = Union[int, float, Decimal, Real] -_T = TypeVar("_T") +_ComparableNum: TypeAlias = int | float | Decimal | Real -if sys.version_info < (3, 9): +if sys.version_info >= (3, 9): + __all__ = ["Fraction"] +else: + __all__ = ["Fraction", "gcd"] @overload def gcd(a: int, b: int) -> int: ... @overload @@ -20,120 +24,125 @@ if sys.version_info < (3, 9): class Fraction(Rational): @overload def __new__( - cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... - ) -> _T: ... + cls: type[Self], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... + ) -> Self: ... @overload - def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ... + def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = ...) -> Self: ... @classmethod - def from_float(cls, f: float) -> Fraction: ... + def from_float(cls: type[Self], f: float) -> Self: ... @classmethod - def from_decimal(cls, dec: Decimal) -> Fraction: ... + def from_decimal(cls: type[Self], dec: Decimal) -> Self: ... def limit_denominator(self, max_denominator: int = ...) -> Fraction: ... if sys.version_info >= (3, 8): - def as_integer_ratio(self) -> Tuple[int, int]: ... + def as_integer_ratio(self) -> tuple[int, int]: ... + @property - def numerator(self) -> int: ... + def numerator(a) -> int: ... @property - def denominator(self) -> int: ... + def denominator(a) -> int: ... @overload - def __add__(self, other: int | Fraction) -> Fraction: ... + def __add__(a, b: int | Fraction) -> Fraction: ... @overload - def __add__(self, other: float) -> float: ... + def __add__(a, b: float) -> float: ... @overload - def __add__(self, other: complex) -> complex: ... + def __add__(a, b: complex) -> complex: ... @overload - def __radd__(self, other: int | Fraction) -> Fraction: ... + def __radd__(b, a: int | Fraction) -> Fraction: ... @overload - def __radd__(self, other: float) -> float: ... + def __radd__(b, a: float) -> float: ... @overload - def __radd__(self, other: complex) -> complex: ... + def __radd__(b, a: complex) -> complex: ... @overload - def __sub__(self, other: int | Fraction) -> Fraction: ... + def __sub__(a, b: int | Fraction) -> Fraction: ... @overload - def __sub__(self, other: float) -> float: ... + def __sub__(a, b: float) -> float: ... @overload - def __sub__(self, other: complex) -> complex: ... + def __sub__(a, b: complex) -> complex: ... @overload - def __rsub__(self, other: int | Fraction) -> Fraction: ... + def __rsub__(b, a: int | Fraction) -> Fraction: ... @overload - def __rsub__(self, other: float) -> float: ... + def __rsub__(b, a: float) -> float: ... @overload - def __rsub__(self, other: complex) -> complex: ... + def __rsub__(b, a: complex) -> complex: ... @overload - def __mul__(self, other: int | Fraction) -> Fraction: ... + def __mul__(a, b: int | Fraction) -> Fraction: ... @overload - def __mul__(self, other: float) -> float: ... + def __mul__(a, b: float) -> float: ... @overload - def __mul__(self, other: complex) -> complex: ... + def __mul__(a, b: complex) -> complex: ... @overload - def __rmul__(self, other: int | Fraction) -> Fraction: ... + def __rmul__(b, a: int | Fraction) -> Fraction: ... @overload - def __rmul__(self, other: float) -> float: ... + def __rmul__(b, a: float) -> float: ... @overload - def __rmul__(self, other: complex) -> complex: ... + def __rmul__(b, a: complex) -> complex: ... @overload - def __truediv__(self, other: int | Fraction) -> Fraction: ... + def __truediv__(a, b: int | Fraction) -> Fraction: ... @overload - def __truediv__(self, other: float) -> float: ... + def __truediv__(a, b: float) -> float: ... @overload - def __truediv__(self, other: complex) -> complex: ... + def __truediv__(a, b: complex) -> complex: ... @overload - def __rtruediv__(self, other: int | Fraction) -> Fraction: ... + def __rtruediv__(b, a: int | Fraction) -> Fraction: ... @overload - def __rtruediv__(self, other: float) -> float: ... + def __rtruediv__(b, a: float) -> float: ... @overload - def __rtruediv__(self, other: complex) -> complex: ... + def __rtruediv__(b, a: complex) -> complex: ... @overload - def __floordiv__(self, other: int | Fraction) -> int: ... + def __floordiv__(a, b: int | Fraction) -> int: ... @overload - def __floordiv__(self, other: float) -> float: ... + def __floordiv__(a, b: float) -> float: ... @overload - def __rfloordiv__(self, other: int | Fraction) -> int: ... + def __rfloordiv__(b, a: int | Fraction) -> int: ... @overload - def __rfloordiv__(self, other: float) -> float: ... + def __rfloordiv__(b, a: float) -> float: ... @overload - def __mod__(self, other: int | Fraction) -> Fraction: ... + def __mod__(a, b: int | Fraction) -> Fraction: ... @overload - def __mod__(self, other: float) -> float: ... + def __mod__(a, b: float) -> float: ... @overload - def __rmod__(self, other: int | Fraction) -> Fraction: ... + def __rmod__(b, a: int | Fraction) -> Fraction: ... @overload - def __rmod__(self, other: float) -> float: ... + def __rmod__(b, a: float) -> float: ... @overload - def __divmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ... + def __divmod__(a, b: int | Fraction) -> tuple[int, Fraction]: ... @overload - def __divmod__(self, other: float) -> Tuple[float, Fraction]: ... + def __divmod__(a, b: float) -> tuple[float, Fraction]: ... @overload - def __rdivmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ... + def __rdivmod__(b, a: int | Fraction) -> tuple[int, Fraction]: ... @overload - def __rdivmod__(self, other: float) -> Tuple[float, Fraction]: ... + def __rdivmod__(b, a: float) -> tuple[float, Fraction]: ... @overload - def __pow__(self, other: int) -> Fraction: ... + def __pow__(a, b: int) -> Fraction: ... @overload - def __pow__(self, other: float | Fraction) -> float: ... + def __pow__(a, b: float | Fraction) -> float: ... @overload - def __pow__(self, other: complex) -> complex: ... + def __pow__(a, b: complex) -> complex: ... @overload - def __rpow__(self, other: int | float | Fraction) -> float: ... + def __rpow__(b, a: float | Fraction) -> float: ... @overload - def __rpow__(self, other: complex) -> complex: ... - def __pos__(self) -> Fraction: ... - def __neg__(self) -> Fraction: ... - def __abs__(self) -> Fraction: ... - def __trunc__(self) -> int: ... - def __floor__(self) -> int: ... - def __ceil__(self) -> int: ... + def __rpow__(b, a: complex) -> complex: ... + def __pos__(a) -> Fraction: ... + def __neg__(a) -> Fraction: ... + def __abs__(a) -> Fraction: ... + def __trunc__(a) -> int: ... + def __floor__(a) -> int: ... + def __ceil__(a) -> int: ... @overload def __round__(self, ndigits: None = ...) -> int: ... @overload def __round__(self, ndigits: int) -> Fraction: ... def __hash__(self) -> int: ... - def __eq__(self, other: object) -> bool: ... - def __lt__(self, other: _ComparableNum) -> bool: ... - def __gt__(self, other: _ComparableNum) -> bool: ... - def __le__(self, other: _ComparableNum) -> bool: ... - def __ge__(self, other: _ComparableNum) -> bool: ... - def __bool__(self) -> bool: ... + def __eq__(a, b: object) -> bool: ... + def __lt__(a, b: _ComparableNum) -> bool: ... + def __gt__(a, b: _ComparableNum) -> bool: ... + def __le__(a, b: _ComparableNum) -> bool: ... + def __ge__(a, b: _ComparableNum) -> bool: ... + def __bool__(a) -> bool: ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self, memo: Any) -> Self: ... + if sys.version_info >= (3, 11): + def __int__(a, _index: Callable[[SupportsIndex], int] = ...) -> int: ... # Not actually defined within fractions.py, but provides more useful # overrides @property diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 4275888..3d284c5 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -1,15 +1,19 @@ +import sys from _typeshed import Self, SupportsRead, SupportsReadline +from collections.abc import Callable, Iterable, Iterator from socket import socket from ssl import SSLContext from types import TracebackType -from typing import Any, Callable, Iterable, Iterator, TextIO, Tuple, Type +from typing import Any, TextIO from typing_extensions import Literal -MSG_OOB: int -FTP_PORT: int -MAXLINE: int -CRLF: str -B_CRLF: bytes +__all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto", "all_errors", "FTP_TLS"] + +MSG_OOB: Literal[1] +FTP_PORT: Literal[21] +MAXLINE: Literal[8192] +CRLF: Literal["\r\n"] +B_CRLF: Literal[b"\r\n"] class Error(Exception): ... class error_reply(Error): ... @@ -17,7 +21,7 @@ class error_temp(Error): ... class error_perm(Error): ... class error_proto(Error): ... -all_errors: Tuple[Type[Exception], ...] +all_errors: tuple[type[Exception], ...] class FTP: debugging: int @@ -34,25 +38,39 @@ class FTP: encoding: str def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - source_address: Tuple[str, int] | None - def __init__( - self, - host: str = ..., - user: str = ..., - passwd: str = ..., - acct: str = ..., - timeout: float = ..., - source_address: Tuple[str, int] | None = ..., + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... + source_address: tuple[str, int] | None + if sys.version_info >= (3, 9): + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + timeout: float = ..., + source_address: tuple[str, int] | None = ..., + *, + encoding: str = ..., + ) -> None: ... + else: + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + timeout: float = ..., + source_address: tuple[str, int] | None = ..., + ) -> None: ... + def connect( - self, host: str = ..., port: int = ..., timeout: float = ..., source_address: Tuple[str, int] | None = ... + self, host: str = ..., port: int = ..., timeout: float = ..., source_address: tuple[str, int] | None = ... ) -> str: ... def getwelcome(self) -> str: ... def set_debuglevel(self, level: int) -> None: ... def debug(self, level: int) -> None: ... - def set_pasv(self, val: bool | int) -> None: ... + def set_pasv(self, val: bool | Literal[0, 1]) -> None: ... def sanitize(self, s: str) -> str: ... def putline(self, line: str) -> None: ... def putcmd(self, line: str) -> None: ... @@ -66,29 +84,29 @@ class FTP: def sendport(self, host: str, port: int) -> str: ... def sendeprt(self, host: str, port: int) -> str: ... def makeport(self) -> socket: ... - def makepasv(self) -> Tuple[str, int]: ... + def makepasv(self) -> tuple[str, int]: ... def login(self, user: str = ..., passwd: str = ..., acct: str = ...) -> str: ... # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers. - def ntransfercmd(self, cmd: str, rest: int | str | None = ...) -> Tuple[socket, int]: ... + def ntransfercmd(self, cmd: str, rest: int | str | None = ...) -> tuple[socket, int]: ... def transfercmd(self, cmd: str, rest: int | str | None = ...) -> socket: ... def retrbinary( - self, cmd: str, callback: Callable[[bytes], Any], blocksize: int = ..., rest: int | str | None = ... + self, cmd: str, callback: Callable[[bytes], object], blocksize: int = ..., rest: int | str | None = ... ) -> str: ... def storbinary( self, cmd: str, fp: SupportsRead[bytes], blocksize: int = ..., - callback: Callable[[bytes], Any] | None = ..., + callback: Callable[[bytes], object] | None = ..., rest: int | str | None = ..., ) -> str: ... - def retrlines(self, cmd: str, callback: Callable[[str], Any] | None = ...) -> str: ... - def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ... + def retrlines(self, cmd: str, callback: Callable[[str], object] | None = ...) -> str: ... + def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], object] | None = ...) -> str: ... def acct(self, password: str) -> str: ... def nlst(self, *args: str) -> list[str]: ... # Technically only the last arg can be a Callable but ... - def dir(self, *args: str | Callable[[str], None]) -> None: ... - def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, dict[str, str]]]: ... + def dir(self, *args: str | Callable[[str], object]) -> None: ... + def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ... def rename(self, fromname: str, toname: str) -> str: ... def delete(self, filename: str) -> str: ... def cwd(self, dirname: str) -> str: ... @@ -100,18 +118,34 @@ class FTP: def close(self) -> None: ... class FTP_TLS(FTP): - def __init__( - self, - host: str = ..., - user: str = ..., - passwd: str = ..., - acct: str = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - context: SSLContext | None = ..., - timeout: float = ..., - source_address: Tuple[str, int] | None = ..., - ) -> None: ... + if sys.version_info >= (3, 9): + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + keyfile: str | None = ..., + certfile: str | None = ..., + context: SSLContext | None = ..., + timeout: float = ..., + source_address: tuple[str, int] | None = ..., + *, + encoding: str = ..., + ) -> None: ... + else: + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + keyfile: str | None = ..., + certfile: str | None = ..., + context: SSLContext | None = ..., + timeout: float = ..., + source_address: tuple[str, int] | None = ..., + ) -> None: ... ssl_version: int keyfile: str | None certfile: str | None @@ -123,8 +157,8 @@ class FTP_TLS(FTP): def ccc(self) -> str: ... def parse150(resp: str) -> int | None: ... # undocumented -def parse227(resp: str) -> Tuple[str, int]: ... # undocumented -def parse229(resp: str, peer: Any) -> Tuple[str, int]: ... # undocumented +def parse227(resp: str) -> tuple[str, int]: ... # undocumented +def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented def parse257(resp: str) -> str: ... # undocumented def ftpcp( source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ... diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 6fe4bb6..5c3f662 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -1,12 +1,34 @@ import sys import types -from _typeshed import SupportsItems, SupportsLessThan -from typing import Any, Callable, Generic, Hashable, Iterable, NamedTuple, Sequence, Set, Sized, Tuple, Type, TypeVar, overload +from _typeshed import IdentityFunction, Self, SupportsAllComparisons, SupportsItems +from collections.abc import Callable, Hashable, Iterable, Sequence, Sized +from typing import Any, Generic, NamedTuple, TypeVar, overload +from typing_extensions import Literal, TypeAlias, final if sys.version_info >= (3, 9): from types import GenericAlias -_AnyCallable = Callable[..., Any] +__all__ = [ + "update_wrapper", + "wraps", + "WRAPPER_ASSIGNMENTS", + "WRAPPER_UPDATES", + "total_ordering", + "cmp_to_key", + "lru_cache", + "reduce", + "partial", + "partialmethod", + "singledispatch", +] + +if sys.version_info >= (3, 8): + __all__ += ["cached_property", "singledispatchmethod"] + +if sys.version_info >= (3, 9): + __all__ += ["cache"] + +_AnyCallable: TypeAlias = Callable[..., object] _T = TypeVar("_T") _S = TypeVar("_S") @@ -22,11 +44,14 @@ class _CacheInfo(NamedTuple): maxsize: int currsize: int +@final class _lru_cache_wrapper(Generic[_T]): __wrapped__: Callable[..., _T] def __call__(self, *args: Hashable, **kwargs: Hashable) -> _T: ... def cache_info(self) -> _CacheInfo: ... def cache_clear(self) -> None: ... + def __copy__(self) -> _lru_cache_wrapper[_T]: ... + def __deepcopy__(self, __memo: Any) -> _lru_cache_wrapper[_T]: ... if sys.version_info >= (3, 8): @overload @@ -37,35 +62,44 @@ if sys.version_info >= (3, 8): else: def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... -WRAPPER_ASSIGNMENTS: Sequence[str] -WRAPPER_UPDATES: Sequence[str] +WRAPPER_ASSIGNMENTS: tuple[ + Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"], +] +WRAPPER_UPDATES: tuple[Literal["__dict__"]] def update_wrapper(wrapper: _T, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> _T: ... -def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_T], _T]: ... -def total_ordering(cls: Type[_T]) -> Type[_T]: ... -def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsLessThan]: ... +def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> IdentityFunction: ... +def total_ordering(cls: type[_T]) -> type[_T]: ... +def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ... class partial(Generic[_T]): - func: Callable[..., _T] - args: Tuple[Any, ...] - keywords: dict[str, Any] - def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> _T: ... + @property + def func(self) -> Callable[..., _T]: ... + @property + def args(self) -> tuple[Any, ...]: ... + @property + def keywords(self) -> dict[str, Any]: ... + def __new__(cls: type[Self], __func: Callable[..., _T], *args: Any, **kwargs: Any) -> Self: ... + def __call__(__self, *args: Any, **kwargs: Any) -> _T: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... # With protocols, this could change into a generic protocol that defines __get__ and returns _T -_Descriptor = Any +_Descriptor: TypeAlias = Any class partialmethod(Generic[_T]): func: Callable[..., _T] | _Descriptor - args: Tuple[Any, ...] + args: tuple[Any, ...] keywords: dict[str, Any] @overload def __init__(self, __func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... @overload def __init__(self, __func: _Descriptor, *args: Any, **keywords: Any) -> None: ... - def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ... + if sys.version_info >= (3, 8): + def __get__(self, obj: Any, cls: type[Any] | None = ...) -> Callable[..., _T]: ... + else: + def __get__(self, obj: Any, cls: type[Any] | None) -> Callable[..., _T]: ... + @property def __isabstractmethod__(self) -> bool: ... if sys.version_info >= (3, 9): @@ -77,16 +111,16 @@ class _SingleDispatchCallable(Generic[_T]): # @fun.register(complex) # def _(arg, verbose=False): ... @overload - def register(self, cls: Type[Any], 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[Any], 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: ... + def __call__(__self, *args: Any, **kwargs: Any) -> _T: ... def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ... @@ -95,22 +129,25 @@ if sys.version_info >= (3, 8): dispatcher: _SingleDispatchCallable[_T] func: Callable[..., _T] def __init__(self, func: Callable[..., _T]) -> None: ... + @property + def __isabstractmethod__(self) -> bool: ... @overload - def register(self, cls: Type[Any], 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[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... - def __call__(self, *args: Any, **kwargs: Any) -> _T: ... + def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... + def __get__(self, obj: _S, cls: type[_S] | None = ...) -> Callable[..., _T]: ... + class cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: Type[Any] | None = ...) -> cached_property[_T]: ... + def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]: ... @overload - def __get__(self, instance: object, owner: Type[Any] | None = ...) -> _T: ... - def __set_name__(self, owner: Type[Any], name: str) -> None: ... + def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T: ... + def __set_name__(self, owner: type[Any], name: str) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -118,11 +155,11 @@ if sys.version_info >= (3, 9): def cache(__user_function: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ... def _make_key( - args: Tuple[Hashable, ...], + args: tuple[Hashable, ...], kwds: SupportsItems[Any, Any], typed: bool, - kwd_mark: Tuple[object, ...] = ..., - fasttypes: Set[type] = ..., + kwd_mark: tuple[object, ...] = ..., + fasttypes: set[type] = ..., tuple: type = ..., type: Any = ..., len: Callable[[Sized], int] = ..., diff --git a/stdlib/gc.pyi b/stdlib/gc.pyi index 6eea018..d24b7c1 100644 --- a/stdlib/gc.pyi +++ b/stdlib/gc.pyi @@ -1,18 +1,23 @@ import sys -from typing import Any, Tuple - -DEBUG_COLLECTABLE: int -DEBUG_LEAK: int -DEBUG_SAVEALL: int -DEBUG_STATS: int -DEBUG_UNCOLLECTABLE: int -callbacks: list[Any] +from collections.abc import Callable +from typing import Any +from typing_extensions import Literal, TypeAlias + +DEBUG_COLLECTABLE: Literal[2] +DEBUG_LEAK: Literal[38] +DEBUG_SAVEALL: Literal[32] +DEBUG_STATS: Literal[1] +DEBUG_UNCOLLECTABLE: Literal[4] + +_CallbackType: TypeAlias = Callable[[Literal["start", "stop"], dict[str, int]], object] + +callbacks: list[_CallbackType] garbage: list[Any] def collect(generation: int = ...) -> int: ... def disable() -> None: ... def enable() -> None: ... -def get_count() -> Tuple[int, int, int]: ... +def get_count() -> tuple[int, int, int]: ... def get_debug() -> int: ... if sys.version_info >= (3, 8): @@ -21,15 +26,13 @@ if sys.version_info >= (3, 8): else: def get_objects() -> list[Any]: ... -if sys.version_info >= (3, 7): - def freeze() -> None: ... - def unfreeze() -> None: ... - def get_freeze_count() -> int: ... - +def freeze() -> None: ... +def unfreeze() -> None: ... +def get_freeze_count() -> int: ... def get_referents(*objs: Any) -> list[Any]: ... def get_referrers(*objs: Any) -> list[Any]: ... def get_stats() -> list[dict[str, Any]]: ... -def get_threshold() -> Tuple[int, int, int]: ... +def get_threshold() -> tuple[int, int, int]: ... def is_tracked(__obj: Any) -> bool: ... if sys.version_info >= (3, 9): diff --git a/stdlib/genericpath.pyi b/stdlib/genericpath.pyi index 1c7be92..911d582 100644 --- a/stdlib/genericpath.pyi +++ b/stdlib/genericpath.pyi @@ -1,29 +1,46 @@ import os -from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsLessThanT -from typing import Sequence, Tuple, overload -from typing_extensions import Literal +from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRichComparisonT +from collections.abc import Sequence +from typing import overload +from typing_extensions import Literal, LiteralString + +__all__ = [ + "commonprefix", + "exists", + "getatime", + "getctime", + "getmtime", + "getsize", + "isdir", + "isfile", + "samefile", + "sameopenfile", + "samestat", +] # All overloads can return empty string. Ideally, Literal[""] would be a valid # Iterable[T], so that list[T] | Literal[""] could be used as a return # type. But because this only works when T is str, we need Sequence[T] instead. @overload +def commonprefix(m: Sequence[LiteralString]) -> LiteralString: ... +@overload def commonprefix(m: Sequence[StrPath]) -> str: ... @overload def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ... @overload -def commonprefix(m: Sequence[list[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... +def commonprefix(m: Sequence[list[SupportsRichComparisonT]]) -> Sequence[SupportsRichComparisonT]: ... @overload -def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... -def exists(path: StrOrBytesPath) -> bool: ... -def getsize(filename: StrOrBytesPath) -> int: ... -def isfile(path: StrOrBytesPath) -> bool: ... -def isdir(s: StrOrBytesPath) -> bool: ... +def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]]) -> Sequence[SupportsRichComparisonT]: ... +def exists(path: StrOrBytesPath | int) -> bool: ... +def getsize(filename: StrOrBytesPath | int) -> int: ... +def isfile(path: StrOrBytesPath | int) -> bool: ... +def isdir(s: StrOrBytesPath | int) -> bool: ... # These return float if os.stat_float_times() == True, # but int is a subclass of float. -def getatime(filename: StrOrBytesPath) -> float: ... -def getmtime(filename: StrOrBytesPath) -> float: ... -def getctime(filename: StrOrBytesPath) -> float: ... -def samefile(f1: StrOrBytesPath, f2: StrOrBytesPath) -> bool: ... +def getatime(filename: StrOrBytesPath | int) -> float: ... +def getmtime(filename: StrOrBytesPath | int) -> float: ... +def getctime(filename: StrOrBytesPath | int) -> float: ... +def samefile(f1: StrOrBytesPath | int, f2: StrOrBytesPath | int) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... diff --git a/stdlib/getopt.pyi b/stdlib/getopt.pyi index 6ae226f..42ddb1c 100644 --- a/stdlib/getopt.pyi +++ b/stdlib/getopt.pyi @@ -1,3 +1,5 @@ +__all__ = ["GetoptError", "error", "getopt", "gnu_getopt"] + def getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tuple[list[tuple[str, str]], list[str]]: ... def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tuple[list[tuple[str, str]], list[str]]: ... diff --git a/stdlib/getpass.pyi b/stdlib/getpass.pyi index 27f4c6a..153db2f 100644 --- a/stdlib/getpass.pyi +++ b/stdlib/getpass.pyi @@ -1,5 +1,7 @@ from typing import TextIO +__all__ = ["getpass", "getuser", "GetPassWarning"] + def getpass(prompt: str = ..., stream: TextIO | None = ...) -> str: ... def getuser() -> str: ... diff --git a/stdlib/gettext.pyi b/stdlib/gettext.pyi index b408d3f..3c07abe 100644 --- a/stdlib/gettext.pyi +++ b/stdlib/gettext.pyi @@ -1,76 +1,159 @@ +import io import sys from _typeshed import StrPath -from typing import IO, Any, Container, Iterable, Sequence, Type, TypeVar, overload -from typing_extensions import Literal +from collections.abc import Callable, Container, Iterable, Sequence +from typing import Any, Protocol, TypeVar, overload +from typing_extensions import Final, Literal + +__all__ = [ + "NullTranslations", + "GNUTranslations", + "Catalog", + "find", + "translation", + "install", + "textdomain", + "bindtextdomain", + "dgettext", + "dngettext", + "gettext", + "ngettext", +] + +if sys.version_info < (3, 11): + __all__ += ["bind_textdomain_codeset", "ldgettext", "ldngettext", "lgettext", "lngettext"] + +if sys.version_info >= (3, 8): + __all__ += ["dnpgettext", "dpgettext", "npgettext", "pgettext"] + +class _TranslationsReader(Protocol): + def read(self) -> bytes: ... + # optional: + # name: str class NullTranslations: - def __init__(self, fp: IO[str] | None = ...) -> None: ... - def _parse(self, fp: IO[str]) -> None: ... + def __init__(self, fp: _TranslationsReader | None = ...) -> None: ... + def _parse(self, fp: _TranslationsReader) -> None: ... def add_fallback(self, fallback: NullTranslations) -> None: ... def gettext(self, message: str) -> str: ... - def lgettext(self, message: str) -> str: ... def ngettext(self, msgid1: str, msgid2: str, n: int) -> str: ... - def lngettext(self, msgid1: str, msgid2: str, n: int) -> str: ... if sys.version_info >= (3, 8): def pgettext(self, context: str, message: str) -> str: ... def npgettext(self, context: str, msgid1: str, msgid2: str, n: int) -> str: ... - def info(self) -> Any: ... - def charset(self) -> Any: ... - def output_charset(self) -> Any: ... - def set_output_charset(self, charset: str) -> None: ... + + def info(self) -> dict[str, str]: ... + def charset(self) -> str | None: ... + if sys.version_info < (3, 11): + def output_charset(self) -> str | None: ... + def set_output_charset(self, charset: str) -> None: ... + def lgettext(self, message: str) -> str: ... + def lngettext(self, msgid1: str, msgid2: str, n: int) -> str: ... + def install(self, names: Container[str] | None = ...) -> None: ... class GNUTranslations(NullTranslations): - LE_MAGIC: int - BE_MAGIC: int + LE_MAGIC: Final[int] + BE_MAGIC: Final[int] CONTEXT: str VERSIONS: Sequence[int] +@overload # ignores incompatible overloads +def find( # type: ignore[misc] + domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[False] = ... +) -> str | None: ... +@overload +def find( + domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[True] = ... +) -> list[str]: ... +@overload def find(domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: bool = ...) -> Any: ... -_T = TypeVar("_T") +_NullTranslationsT = TypeVar("_NullTranslationsT", bound=NullTranslations) + +if sys.version_info >= (3, 11): + @overload + def translation( + domain: str, + localedir: StrPath | None = ..., + languages: Iterable[str] | None = ..., + class_: None = ..., + fallback: Literal[False] = ..., + ) -> GNUTranslations: ... + @overload + def translation( + domain: str, + localedir: StrPath | None = ..., + languages: Iterable[str] | None = ..., + *, + class_: Callable[[io.BufferedReader], _NullTranslationsT], + fallback: Literal[False] = ..., + ) -> _NullTranslationsT: ... + @overload + def translation( + domain: str, + localedir: StrPath | None, + languages: Iterable[str] | None, + class_: Callable[[io.BufferedReader], _NullTranslationsT], + fallback: Literal[False] = ..., + ) -> _NullTranslationsT: ... + @overload + def translation( + domain: str, + localedir: StrPath | None = ..., + languages: Iterable[str] | None = ..., + class_: Callable[[io.BufferedReader], NullTranslations] | None = ..., + fallback: bool = ..., + ) -> NullTranslations: ... + def install(domain: str, localedir: StrPath | None = ..., *, names: Container[str] | None = ...) -> None: ... + +else: + @overload + def translation( + domain: str, + localedir: StrPath | None = ..., + languages: Iterable[str] | None = ..., + class_: None = ..., + fallback: Literal[False] = ..., + codeset: str | None = ..., + ) -> GNUTranslations: ... + @overload + def translation( + domain: str, + localedir: StrPath | None = ..., + languages: Iterable[str] | None = ..., + *, + class_: Callable[[io.BufferedReader], _NullTranslationsT], + fallback: Literal[False] = ..., + codeset: str | None = ..., + ) -> _NullTranslationsT: ... + @overload + def translation( + domain: str, + localedir: StrPath | None, + languages: Iterable[str] | None, + class_: Callable[[io.BufferedReader], _NullTranslationsT], + fallback: Literal[False] = ..., + codeset: str | None = ..., + ) -> _NullTranslationsT: ... + @overload + def translation( + domain: str, + localedir: StrPath | None = ..., + languages: Iterable[str] | None = ..., + class_: Callable[[io.BufferedReader], NullTranslations] | None = ..., + fallback: bool = ..., + codeset: str | None = ..., + ) -> NullTranslations: ... + def install( + domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ... + ) -> None: ... -@overload -def translation( - domain: str, - localedir: StrPath | None = ..., - languages: Iterable[str] | None = ..., - class_: None = ..., - fallback: bool = ..., - codeset: str | None = ..., -) -> NullTranslations: ... -@overload -def translation( - domain: str, - localedir: StrPath | None = ..., - languages: Iterable[str] | None = ..., - class_: Type[_T] = ..., - fallback: Literal[False] = ..., - codeset: str | None = ..., -) -> _T: ... -@overload -def translation( - domain: str, - localedir: StrPath | None = ..., - languages: Iterable[str] | None = ..., - class_: Type[Any] = ..., - fallback: Literal[True] = ..., - codeset: str | None = ..., -) -> Any: ... -def install( - domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ... -) -> None: ... def textdomain(domain: str | None = ...) -> str: ... def bindtextdomain(domain: str, localedir: StrPath | None = ...) -> str: ... -def bind_textdomain_codeset(domain: str, codeset: str | None = ...) -> str: ... def dgettext(domain: str, message: str) -> str: ... -def ldgettext(domain: str, message: str) -> str: ... def dngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ... -def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ... def gettext(message: str) -> str: ... -def lgettext(message: str) -> str: ... def ngettext(msgid1: str, msgid2: str, n: int) -> str: ... -def lngettext(msgid1: str, msgid2: str, n: int) -> str: ... if sys.version_info >= (3, 8): def pgettext(context: str, message: str) -> str: ... @@ -78,4 +161,11 @@ if sys.version_info >= (3, 8): def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ... def dnpgettext(domain: str, context: str, msgid1: str, msgid2: str, n: int) -> str: ... +if sys.version_info < (3, 11): + def lgettext(message: str) -> str: ... + def ldgettext(domain: str, message: str) -> str: ... + def lngettext(msgid1: str, msgid2: str, n: int) -> str: ... + def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ... + def bind_textdomain_codeset(domain: str, codeset: str | None = ...) -> str: ... + Catalog = translation diff --git a/stdlib/glob.pyi b/stdlib/glob.pyi index c1cd176..c63563d 100644 --- a/stdlib/glob.pyi +++ b/stdlib/glob.pyi @@ -1,11 +1,32 @@ import sys from _typeshed import StrOrBytesPath -from typing import AnyStr, Iterator +from collections.abc import Iterator +from typing import AnyStr + +__all__ = ["escape", "glob", "iglob"] def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... -if sys.version_info >= (3, 10): +if sys.version_info >= (3, 11): + def glob( + pathname: AnyStr, + *, + root_dir: StrOrBytesPath | None = ..., + dir_fd: int | None = ..., + recursive: bool = ..., + include_hidden: bool = ..., + ) -> list[AnyStr]: ... + def iglob( + pathname: AnyStr, + *, + root_dir: StrOrBytesPath | None = ..., + dir_fd: int | None = ..., + recursive: bool = ..., + include_hidden: bool = ..., + ) -> Iterator[AnyStr]: ... + +elif sys.version_info >= (3, 10): def glob( pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... ) -> list[AnyStr]: ... diff --git a/stdlib/graphlib.pyi b/stdlib/graphlib.pyi index 0872af4..4c6959d 100644 --- a/stdlib/graphlib.pyi +++ b/stdlib/graphlib.pyi @@ -1,16 +1,28 @@ +import sys from _typeshed import SupportsItems -from typing import Generic, Iterable, Tuple, TypeVar +from collections.abc import Iterable +from typing import Any, Generic, TypeVar, overload + +__all__ = ["TopologicalSorter", "CycleError"] _T = TypeVar("_T") +if sys.version_info >= (3, 11): + from types import GenericAlias + class TopologicalSorter(Generic[_T]): - def __init__(self, graph: SupportsItems[_T, Iterable[_T]] | None = ...) -> None: ... + @overload + def __init__(self, graph: None = ...) -> None: ... + @overload + def __init__(self, graph: SupportsItems[_T, Iterable[_T]]) -> None: ... def add(self, node: _T, *predecessors: _T) -> None: ... def prepare(self) -> None: ... def is_active(self) -> bool: ... def __bool__(self) -> bool: ... def done(self, *nodes: _T) -> None: ... - def get_ready(self) -> Tuple[_T, ...]: ... + def get_ready(self) -> tuple[_T, ...]: ... def static_order(self) -> Iterable[_T]: ... + if sys.version_info >= (3, 11): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... class CycleError(ValueError): ... diff --git a/stdlib/grp.pyi b/stdlib/grp.pyi index 08cbe6b..4b66b84 100644 --- a/stdlib/grp.pyi +++ b/stdlib/grp.pyi @@ -1,11 +1,22 @@ -from typing import NamedTuple +import sys +from _typeshed import structseq +from typing import Any +from typing_extensions import Final, final -class struct_group(NamedTuple): - gr_name: str - gr_passwd: str | None - gr_gid: int - gr_mem: list[str] +if sys.platform != "win32": + @final + class struct_group(structseq[Any], tuple[str, str | None, int, list[str]]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("gr_name", "gr_passwd", "gr_gid", "gr_mem") + @property + def gr_name(self) -> str: ... + @property + def gr_passwd(self) -> str | None: ... + @property + def gr_gid(self) -> int: ... + @property + def gr_mem(self) -> list[str]: ... -def getgrall() -> list[struct_group]: ... -def getgrgid(id: int) -> struct_group: ... -def getgrnam(name: str) -> struct_group: ... + def getgrall() -> list[struct_group]: ... + def getgrgid(id: int) -> struct_group: ... + def getgrnam(name: str) -> struct_group: ... diff --git a/stdlib/gzip.pyi b/stdlib/gzip.pyi index 070ceac..580e605 100644 --- a/stdlib/gzip.pyi +++ b/stdlib/gzip.pyi @@ -1,29 +1,40 @@ import _compression import sys import zlib -from _typeshed import ReadableBuffer, StrOrBytesPath +from _typeshed import ReadableBuffer, StrOrBytesPath, _BufferWithLen from io import FileIO -from typing import Any, Protocol, TextIO, overload -from typing_extensions import Literal +from typing import Protocol, TextIO, overload +from typing_extensions import Literal, TypeAlias -_ReadBinaryMode = Literal["r", "rb"] -_WriteBinaryMode = Literal["a", "ab", "w", "wb", "x", "xb"] -_OpenTextMode = Literal["rt", "at", "wt", "xt"] +if sys.version_info >= (3, 8): + __all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"] +else: + __all__ = ["GzipFile", "open", "compress", "decompress"] + +_ReadBinaryMode: TypeAlias = Literal["r", "rb"] +_WriteBinaryMode: TypeAlias = Literal["a", "ab", "w", "wb", "x", "xb"] +_OpenTextMode: TypeAlias = Literal["rt", "at", "wt", "xt"] -READ: Literal[1] -WRITE: Literal[2] +READ: Literal[1] # undocumented +WRITE: Literal[2] # undocumented + +FTEXT: int # actually Literal[1] # undocumented +FHCRC: int # actually Literal[2] # undocumented +FEXTRA: int # actually Literal[4] # undocumented +FNAME: int # actually Literal[8] # undocumented +FCOMMENT: int # actually Literal[16] # undocumented class _ReadableFileobj(Protocol): def read(self, __n: int) -> bytes: ... - def seek(self, __n: int) -> Any: ... + def seek(self, __n: int) -> object: ... # The following attributes and methods are optional: # name: str # mode: str # def fileno() -> int: ... class _WritableFileobj(Protocol): - def write(self, __b: bytes) -> Any: ... - def flush(self) -> Any: ... + def write(self, __b: bytes) -> object: ... + def flush(self) -> object: ... # The following attributes and methods are optional: # name: str # mode: str @@ -137,26 +148,20 @@ class GzipFile(_compression.BaseStream): def read(self, size: int | None = ...) -> bytes: ... def read1(self, size: int = ...) -> bytes: ... def peek(self, n: int) -> bytes: ... - @property - def closed(self) -> bool: ... def close(self) -> None: ... def flush(self, zlib_mode: int = ...) -> None: ... def fileno(self) -> int: ... def rewind(self) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def seekable(self) -> bool: ... def seek(self, offset: int, whence: int = ...) -> int: ... def readline(self, size: int | None = ...) -> bytes: ... class _GzipReader(_compression.DecompressReader): def __init__(self, fp: _ReadableFileobj) -> None: ... - def read(self, size: int = ...) -> bytes: ... if sys.version_info >= (3, 8): - def compress(data: bytes, compresslevel: int = ..., *, mtime: float | None = ...) -> bytes: ... + def compress(data: _BufferWithLen, compresslevel: int = ..., *, mtime: float | None = ...) -> bytes: ... else: - def compress(data: bytes, compresslevel: int = ...) -> bytes: ... + def compress(data: _BufferWithLen, compresslevel: int = ...) -> bytes: ... -def decompress(data: bytes) -> bytes: ... +def decompress(data: ReadableBuffer) -> bytes: ... diff --git a/stdlib/hashlib.pyi b/stdlib/hashlib.pyi index e39f2f2..2a41736 100644 --- a/stdlib/hashlib.pyi +++ b/stdlib/hashlib.pyi @@ -1,8 +1,54 @@ import sys from _typeshed import ReadableBuffer, Self -from typing import AbstractSet +from collections.abc import Callable, Set as AbstractSet +from typing import Protocol +from typing_extensions import final -class _Hash(object): +if sys.version_info >= (3, 11): + __all__ = ( + "md5", + "sha1", + "sha224", + "sha256", + "sha384", + "sha512", + "blake2b", + "blake2s", + "sha3_224", + "sha3_256", + "sha3_384", + "sha3_512", + "shake_128", + "shake_256", + "new", + "algorithms_guaranteed", + "algorithms_available", + "pbkdf2_hmac", + "file_digest", + ) +else: + __all__ = ( + "md5", + "sha1", + "sha224", + "sha256", + "sha384", + "sha512", + "blake2b", + "blake2s", + "sha3_224", + "sha3_256", + "sha3_384", + "sha3_512", + "shake_128", + "shake_256", + "new", + "algorithms_guaranteed", + "algorithms_available", + "pbkdf2_hmac", + ) + +class _Hash: @property def digest_size(self) -> int: ... @property @@ -49,7 +95,7 @@ def pbkdf2_hmac( hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = ... ) -> bytes: ... -class _VarLenHash(object): +class _VarLenHash: digest_size: int block_size: int name: str @@ -76,7 +122,7 @@ def scrypt( maxmem: int = ..., dklen: int = ..., ) -> bytes: ... - +@final class _BlakeHash(_Hash): MAX_DIGEST_SIZE: int MAX_KEY_SIZE: int @@ -121,3 +167,15 @@ class _BlakeHash(_Hash): blake2b = _BlakeHash blake2s = _BlakeHash + +if sys.version_info >= (3, 11): + class _BytesIOLike(Protocol): + def getbuffer(self) -> ReadableBuffer: ... + + class _FileDigestFileObj(Protocol): + def readinto(self, __buf: bytearray) -> int: ... + def readable(self) -> bool: ... + + def file_digest( + __fileobj: _BytesIOLike | _FileDigestFileObj, __digest: str | Callable[[], _Hash], *, _bufsize: int = ... + ) -> _Hash: ... diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index 81ee025..b280322 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -1,14 +1,17 @@ -from _typeshed import SupportsLessThan -from typing import Any, Callable, Iterable, TypeVar - -_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[Any]) -> None: ... -def heapreplace(__heap: list[_T], __item: _T) -> _T: ... -def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] | None = ..., reverse: bool = ...) -> Iterable[_T]: ... -def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ... -def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ... +from _heapq import * +from _typeshed import SupportsRichComparison +from collections.abc import Callable, Iterable +from typing import Any, TypeVar + +__all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", "nsmallest", "heappushpop"] + +_S = TypeVar("_S") + +__about__: str + +def merge( + *iterables: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ..., reverse: bool = ... +) -> Iterable[_S]: ... +def nlargest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ...) -> list[_S]: ... +def nsmallest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ...) -> list[_S]: ... def _heapify_max(__x: list[Any]) -> None: ... # undocumented diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index 440bddd..dc29836 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -1,11 +1,16 @@ import sys -from _typeshed import ReadableBuffer +from _typeshed import ReadableBuffer, _BufferWithLen +from collections.abc import Callable from types import ModuleType -from typing import Any, AnyStr, Callable, Union, overload +from typing import Any, AnyStr, overload +from typing_extensions import TypeAlias # TODO more precise type for object of hashlib -_Hash = Any -_DigestMod = Union[str, Callable[[], _Hash], ModuleType] +_Hash: TypeAlias = Any +_DigestMod: TypeAlias = str | Callable[[], _Hash] | ModuleType + +trans_5C: bytes +trans_36: bytes digest_size: None @@ -13,18 +18,19 @@ if sys.version_info >= (3, 8): # In reality digestmod has a default value, but the function always throws an error # if the argument is not given, so we pretend it is a required argument. @overload - def new(key: bytes, msg: ReadableBuffer | None, digestmod: _DigestMod) -> HMAC: ... + def new(key: bytes | bytearray, msg: ReadableBuffer | None, digestmod: _DigestMod) -> HMAC: ... @overload - def new(key: bytes, *, digestmod: _DigestMod) -> HMAC: ... + def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ... else: - def new(key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ... + def new(key: bytes | bytearray, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ... class HMAC: digest_size: int block_size: int - name: str - def __init__(self, key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod = ...) -> None: ... + @property + def name(self) -> str: ... + def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = ..., digestmod: _DigestMod = ...) -> None: ... def update(self, msg: ReadableBuffer) -> None: ... def digest(self) -> bytes: ... def hexdigest(self) -> str: ... @@ -34,6 +40,4 @@ class HMAC: def compare_digest(__a: ReadableBuffer, __b: ReadableBuffer) -> bool: ... @overload def compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ... - -if sys.version_info >= (3, 7): - def digest(key: bytes, msg: ReadableBuffer, digest: str) -> bytes: ... +def digest(key: _BufferWithLen, msg: ReadableBuffer, digest: _DigestMod) -> bytes: ... diff --git a/stdlib/html/__init__.pyi b/stdlib/html/__init__.pyi index af2a800..109c5f4 100644 --- a/stdlib/html/__init__.pyi +++ b/stdlib/html/__init__.pyi @@ -1,4 +1,6 @@ from typing import AnyStr +__all__ = ["escape", "unescape"] + def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ... def unescape(s: AnyStr) -> AnyStr: ... diff --git a/stdlib/html/entities.pyi b/stdlib/html/entities.pyi index 1743fcc..be83fd1 100644 --- a/stdlib/html/entities.pyi +++ b/stdlib/html/entities.pyi @@ -1,3 +1,5 @@ +__all__ = ["html5", "name2codepoint", "codepoint2name", "entitydefs"] + name2codepoint: dict[str, int] html5: dict[str, str] codepoint2name: dict[int, str] diff --git a/stdlib/html/parser.pyi b/stdlib/html/parser.pyi index 1cdaf72..6dde9f7 100644 --- a/stdlib/html/parser.pyi +++ b/stdlib/html/parser.pyi @@ -1,24 +1,23 @@ from _markupbase import ParserBase -from typing import Tuple +from re import Pattern + +__all__ = ["HTMLParser"] class HTMLParser(ParserBase): def __init__(self, *, convert_charrefs: bool = ...) -> None: ... def feed(self, data: str) -> None: ... def close(self) -> None: ... - def reset(self) -> None: ... - def getpos(self) -> Tuple[int, int]: ... def get_starttag_text(self) -> str | None: ... - def handle_starttag(self, tag: str, attrs: list[Tuple[str, str | None]]) -> None: ... + def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None: ... def handle_endtag(self, tag: str) -> None: ... - def handle_startendtag(self, tag: str, attrs: list[Tuple[str, str | None]]) -> None: ... + def handle_startendtag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None: ... def handle_data(self, data: str) -> None: ... def handle_entityref(self, name: str) -> None: ... def handle_charref(self, name: str) -> None: ... def handle_comment(self, data: str) -> None: ... def handle_decl(self, decl: str) -> None: ... def handle_pi(self, data: str) -> None: ... - def unknown_decl(self, data: str) -> None: ... - CDATA_CONTENT_ELEMENTS: Tuple[str, ...] + CDATA_CONTENT_ELEMENTS: tuple[str, ...] def check_for_whole_start_tag(self, i: int) -> int: ... # undocumented def clear_cdata_mode(self) -> None: ... # undocumented def goahead(self, end: bool) -> None: ... # undocumented @@ -28,3 +27,8 @@ class HTMLParser(ParserBase): def parse_pi(self, i: int) -> int: ... # undocumented def parse_starttag(self, i: int) -> int: ... # undocumented def set_cdata_mode(self, elem: str) -> None: ... # undocumented + rawdata: str # undocumented + cdata_elem: str | None # undocumented + convert_charrefs: bool # undocumented + interesting: Pattern[str] # undocumented + lasttag: str # undocumented diff --git a/stdlib/http/__init__.pyi b/stdlib/http/__init__.pyi index 9389554..d4b44f2 100644 --- a/stdlib/http/__init__.pyi +++ b/stdlib/http/__init__.pyi @@ -2,6 +2,14 @@ import sys from enum import IntEnum from typing_extensions import Literal +if sys.version_info >= (3, 11): + from enum import StrEnum + +if sys.version_info >= (3, 11): + __all__ = ["HTTPStatus", "HTTPMethod"] +else: + __all__ = ["HTTPStatus"] + class HTTPStatus(IntEnum): @property def phrase(self) -> str: ... @@ -64,11 +72,24 @@ class HTTPStatus(IntEnum): LOOP_DETECTED: int NOT_EXTENDED: int NETWORK_AUTHENTICATION_REQUIRED: int - if sys.version_info >= (3, 7): - MISDIRECTED_REQUEST: int + MISDIRECTED_REQUEST: int if sys.version_info >= (3, 8): UNAVAILABLE_FOR_LEGAL_REASONS: int if sys.version_info >= (3, 9): EARLY_HINTS: Literal[103] IM_A_TEAPOT: Literal[418] TOO_EARLY: Literal[425] + +if sys.version_info >= (3, 11): + class HTTPMethod(StrEnum): + @property + def description(self) -> str: ... + CONNECT: str + DELETE: str + GET: str + HEAD: str + OPTIONS: str + PATCH: str + POST: str + PUT: str + TRACE: str diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index 5081915..ad794ed 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -1,13 +1,36 @@ import email.message import io import ssl -import sys import types -from _typeshed import Self, WriteableBuffer +from _typeshed import ReadableBuffer, Self, SupportsRead, WriteableBuffer +from collections.abc import Callable, Iterable, Iterator, Mapping from socket import socket -from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, Tuple, Type, TypeVar, Union, overload - -_DataType = Union[bytes, IO[Any], Iterable[bytes], str] +from typing import Any, BinaryIO, TypeVar, overload +from typing_extensions import TypeAlias + +__all__ = [ + "HTTPResponse", + "HTTPConnection", + "HTTPException", + "NotConnected", + "UnknownProtocol", + "UnknownTransferEncoding", + "UnimplementedFileMode", + "IncompleteRead", + "InvalidURL", + "ImproperConnectionState", + "CannotSendRequest", + "CannotSendHeader", + "ResponseNotReady", + "BadStatusLine", + "LineTooLong", + "RemoteDisconnected", + "error", + "responses", + "HTTPSConnection", +] + +_DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | ReadableBuffer _T = TypeVar("_T") HTTP_PORT: int @@ -83,71 +106,53 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): headers: HTTPMessage version: int debuglevel: int + fp: io.BufferedReader closed: bool status: int reason: str + chunked: bool + chunk_left: int | None + length: int | None + will_close: bool def __init__(self, sock: socket, debuglevel: int = ..., method: str | None = ..., url: str | None = ...) -> None: ... def peek(self, n: int = ...) -> bytes: ... def read(self, amt: int | None = ...) -> bytes: ... def read1(self, n: int = ...) -> bytes: ... def readinto(self, b: WriteableBuffer) -> int: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore + def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override] @overload def getheader(self, name: str) -> str | None: ... @overload def getheader(self, name: str, default: _T) -> str | _T: ... - def getheaders(self) -> list[Tuple[str, str]]: ... - def fileno(self) -> int: ... + def getheaders(self) -> list[tuple[str, str]]: ... def isclosed(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None - ) -> bool | None: ... + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... def info(self) -> email.message.Message: ... def geturl(self) -> str: ... def getcode(self) -> int: ... def begin(self) -> None: ... -# This is an API stub only for the class below, not a class itself. -# urllib.request uses it for a parameter. -class _HTTPConnectionProtocol(Protocol): - if sys.version_info >= (3, 7): - def __call__( - self, - host: str, - port: int | None = ..., - timeout: float = ..., - source_address: Tuple[str, int] | None = ..., - blocksize: int = ..., - ) -> HTTPConnection: ... - else: - def __call__( - self, host: str, port: int | None = ..., timeout: float = ..., source_address: Tuple[str, int] | None = ... - ) -> HTTPConnection: ... - class HTTPConnection: auto_open: int # undocumented debuglevel: int default_port: int # undocumented - response_class: Type[HTTPResponse] # undocumented + response_class: type[HTTPResponse] # undocumented timeout: float | None host: str port: int - sock: Any - if sys.version_info >= (3, 7): - def __init__( - self, - host: str, - port: int | None = ..., - timeout: float | None = ..., - source_address: Tuple[str, int] | None = ..., - blocksize: int = ..., - ) -> None: ... - else: - def __init__( - self, host: str, port: int | None = ..., timeout: float | None = ..., source_address: Tuple[str, int] | None = ... - ) -> None: ... + sock: socket | Any # can be `None` if `.connect()` was not called + def __init__( + self, + host: str, + port: int | None = ..., + timeout: float | None = ..., + source_address: tuple[str, int] | None = ..., + blocksize: int = ..., + ) -> None: ... def request( self, method: str, url: str, body: _DataType | None = ..., headers: Mapping[str, str] = ..., *, encode_chunked: bool = ... ) -> None: ... @@ -159,36 +164,24 @@ class HTTPConnection: def putrequest(self, method: str, url: str, skip_host: bool = ..., skip_accept_encoding: bool = ...) -> None: ... def putheader(self, header: str, *argument: str) -> None: ... def endheaders(self, message_body: _DataType | None = ..., *, encode_chunked: bool = ...) -> None: ... - def send(self, data: _DataType) -> None: ... + def send(self, data: _DataType | str) -> None: ... class HTTPSConnection(HTTPConnection): - if sys.version_info >= (3, 7): - def __init__( - self, - host: str, - port: int | None = ..., - key_file: str | None = ..., - cert_file: str | None = ..., - timeout: float | None = ..., - source_address: Tuple[str, int] | None = ..., - *, - context: ssl.SSLContext | None = ..., - check_hostname: bool | None = ..., - blocksize: int = ..., - ) -> None: ... - else: - def __init__( - self, - host: str, - port: int | None = ..., - key_file: str | None = ..., - cert_file: str | None = ..., - timeout: float | None = ..., - source_address: Tuple[str, int] | None = ..., - *, - context: ssl.SSLContext | None = ..., - check_hostname: bool | None = ..., - ) -> None: ... + # Can be `None` if `.connect()` was not called: + sock: ssl.SSLSocket | Any # type: ignore[override] + def __init__( + self, + host: str, + port: int | None = ..., + key_file: str | None = ..., + cert_file: str | None = ..., + timeout: float | None = ..., + source_address: tuple[str, int] | None = ..., + *, + context: ssl.SSLContext | None = ..., + check_hostname: bool | None = ..., + blocksize: int = ..., + ) -> None: ... class HTTPException(Exception): ... diff --git a/stdlib/http/cookiejar.pyi b/stdlib/http/cookiejar.pyi index f37fb19..dc3c0e1 100644 --- a/stdlib/http/cookiejar.pyi +++ b/stdlib/http/cookiejar.pyi @@ -1,9 +1,22 @@ import sys from _typeshed import StrPath +from collections.abc import Iterable, Iterator, Sequence from http.client import HTTPResponse -from typing import ClassVar, Iterable, Iterator, Pattern, Sequence, Tuple, TypeVar, overload +from re import Pattern +from typing import ClassVar, TypeVar, overload from urllib.request import Request +__all__ = [ + "Cookie", + "CookieJar", + "CookiePolicy", + "DefaultCookiePolicy", + "FileCookieJar", + "LWPCookieJar", + "LoadError", + "MozillaCookieJar", +] + _T = TypeVar("_T") class LoadError(OSError): ... @@ -27,8 +40,6 @@ class CookieJar(Iterable[Cookie]): def clear_expired_cookies(self) -> None: ... # undocumented def __iter__(self) -> Iterator[Cookie]: ... def __len__(self) -> int: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... class FileCookieJar(CookieJar): filename: str @@ -37,12 +48,14 @@ class FileCookieJar(CookieJar): def __init__(self, filename: StrPath | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ... else: def __init__(self, filename: str | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ... + def save(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... def load(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... def revert(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... class MozillaCookieJar(FileCookieJar): - header: ClassVar[str] # undocumented + if sys.version_info < (3, 10): + header: ClassVar[str] # undocumented class LWPCookieJar(FileCookieJar): def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented @@ -102,10 +115,11 @@ class DefaultCookiePolicy(CookiePolicy): strict_ns_set_initial_dollar: bool = ..., strict_ns_set_path: bool = ..., ) -> None: ... - def blocked_domains(self) -> Tuple[str, ...]: ... + + def blocked_domains(self) -> tuple[str, ...]: ... def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ... def is_blocked(self, domain: str) -> bool: ... - def allowed_domains(self) -> Tuple[str, ...] | None: ... + def allowed_domains(self) -> tuple[str, ...] | None: ... def set_allowed_domains(self, allowed_domains: Sequence[str] | None) -> None: ... def is_not_allowed(self, domain: str) -> bool: ... def set_ok_version(self, cookie: Cookie, request: Request) -> bool: ... # undocumented diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index 5a88121..e2fe44d 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -1,10 +1,14 @@ import sys -from typing import Any, Dict, Generic, Iterable, Mapping, Tuple, TypeVar, Union, overload +from collections.abc import Iterable, Mapping +from typing import Any, Generic, TypeVar, overload +from typing_extensions import TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias -_DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]] +__all__ = ["CookieError", "BaseCookie", "SimpleCookie"] + +_DataType: TypeAlias = str | Mapping[str, str | Morsel[Any]] _T = TypeVar("_T") @overload @@ -18,33 +22,37 @@ def _unquote(str: str) -> str: ... class CookieError(Exception): ... -class Morsel(Dict[str, Any], Generic[_T]): - value: str - coded_value: _T - key: str +class Morsel(dict[str, Any], Generic[_T]): + @property + def value(self) -> str: ... + @property + def coded_value(self) -> _T: ... + @property + def key(self) -> str: ... def __init__(self) -> None: ... - if sys.version_info >= (3, 7): - def set(self, key: str, val: str, coded_val: _T) -> None: ... - else: - def set(self, key: str, val: str, coded_val: _T, LegalChars: str = ...) -> None: ... + def set(self, key: str, val: str, coded_val: _T) -> None: ... def setdefault(self, key: str, val: str | None = ...) -> str: ... # The dict update can also get a keywords argument so this is incompatible - @overload # type: ignore + @overload # type: ignore[override] def update(self, values: Mapping[str, str]) -> None: ... @overload - def update(self, values: Iterable[Tuple[str, str]]) -> None: ... + def update(self, values: Iterable[tuple[str, str]]) -> None: ... def isReservedKey(self, K: str) -> bool: ... def output(self, attrs: list[str] | None = ..., header: str = ...) -> str: ... + __str__ = output def js_output(self, attrs: list[str] | None = ...) -> str: ... def OutputString(self, attrs: list[str] | None = ...) -> str: ... + def __eq__(self, morsel: object) -> bool: ... + def __setitem__(self, K: str, V: Any) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -class BaseCookie(Dict[str, Morsel[_T]], Generic[_T]): +class BaseCookie(dict[str, Morsel[_T]], Generic[_T]): def __init__(self, input: _DataType | None = ...) -> None: ... def value_decode(self, val: str) -> _T: ... def value_encode(self, val: _T) -> str: ... def output(self, attrs: list[str] | None = ..., header: str = ..., sep: str = ...) -> str: ... + __str__ = output def js_output(self, attrs: list[str] | None = ...) -> str: ... def load(self, rawdata: _DataType) -> None: ... def __setitem__(self, key: str, value: str | Morsel[_T]) -> None: ... diff --git a/stdlib/http/server.pyi b/stdlib/http/server.pyi index 92350b2..011d464 100644 --- a/stdlib/http/server.pyi +++ b/stdlib/http/server.pyi @@ -3,19 +3,19 @@ import io import socketserver import sys from _typeshed import StrPath, SupportsRead, SupportsWrite -from typing import Any, AnyStr, BinaryIO, ClassVar, Mapping, Sequence, Tuple +from collections.abc import Mapping, Sequence +from typing import Any, AnyStr, BinaryIO, ClassVar + +__all__ = ["HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler"] class HTTPServer(socketserver.TCPServer): server_name: str server_port: int -if sys.version_info >= (3, 7): - class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer): - daemon_threads: bool # undocumented +class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer): ... class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): - client_address: Tuple[str, int] - server: socketserver.BaseServer + client_address: tuple[str, int] close_connection: bool requestline: str command: str @@ -28,12 +28,10 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): error_content_type: str protocol_version: str MessageClass: type - responses: Mapping[int, Tuple[str, str]] + responses: Mapping[int, tuple[str, str]] default_request_version: str # undocumented weekdayname: ClassVar[Sequence[str]] # undocumented monthname: ClassVar[Sequence[str | None]] # undocumented - def __init__(self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer) -> None: ... - def handle(self) -> None: ... def handle_one_request(self) -> None: ... def handle_expect_100(self) -> bool: ... def send_error(self, code: int, message: str | None = ..., explain: str | None = ...) -> None: ... @@ -52,14 +50,27 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): def parse_request(self) -> bool: ... # undocumented class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): - server_version: str extensions_map: dict[str, str] - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 12): def __init__( - self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer, directory: str | None = ... + self, + request: socketserver._RequestType, + client_address: socketserver._AddressType, + server: socketserver.BaseServer, + *, + directory: str | None = ..., + index_pages: Sequence[str] | None = ..., ) -> None: ... else: - def __init__(self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer) -> None: ... + def __init__( + self, + request: socketserver._RequestType, + client_address: socketserver._AddressType, + server: socketserver.BaseServer, + *, + directory: str | None = ..., + ) -> None: ... + def do_GET(self) -> None: ... def do_HEAD(self) -> None: ... def send_head(self) -> io.BytesIO | BinaryIO | None: ... # undocumented diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 63c57a4..f13e1c9 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -1,36 +1,44 @@ import subprocess import sys import time -from _typeshed import Self +from _typeshed import ReadableBuffer, Self, _BufferWithLen +from builtins import list as _list # conflicts with a method named "list" +from collections.abc import Callable +from datetime import datetime +from re import Pattern from socket import socket as _socket from ssl import SSLContext, SSLSocket from types import TracebackType -from typing import IO, Any, Callable, List, Pattern, Tuple, Type, Union -from typing_extensions import Literal +from typing import IO, Any, SupportsAbs, SupportsInt +from typing_extensions import Literal, TypeAlias + +__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate", "IMAP4_SSL"] # TODO: Commands should use their actual return types, not this type alias. # E.g. Tuple[Literal["OK"], List[bytes]] -_CommandResults = Tuple[str, List[Any]] +_CommandResults: TypeAlias = tuple[str, list[Any]] + +_AnyResponseData: TypeAlias = list[None] | list[bytes | tuple[bytes, bytes]] -_AnyResponseData = Union[List[None], List[Union[bytes, Tuple[bytes, bytes]]]] +Commands: dict[str, tuple[str, ...]] class IMAP4: - error: Type[Exception] - abort: Type[Exception] - readonly: Type[Exception] + class error(Exception): ... + class abort(error): ... + class readonly(abort): ... mustquote: Pattern[str] debug: int state: str literal: str | None - tagged_commands: dict[bytes, List[bytes] | None] - untagged_responses: dict[str, List[bytes | Tuple[bytes, bytes]]] + tagged_commands: dict[bytes, _list[bytes] | None] + untagged_responses: dict[str, _list[bytes | tuple[bytes, bytes]]] continuation_response: str is_readonly: bool tagnum: int tagpre: str tagre: Pattern[str] welcome: bytes - capabilities: Tuple[str] + capabilities: tuple[str, ...] PROTOCOL_VERSION: str if sys.version_info >= (3, 9): def __init__(self, host: str = ..., port: int = ..., timeout: float | None = ...) -> None: ... @@ -38,6 +46,7 @@ class IMAP4: else: def __init__(self, host: str = ..., port: int = ...) -> None: ... def open(self, host: str = ..., port: int = ...) -> None: ... + def __getattr__(self, attr: str) -> Any: ... host: str port: int @@ -45,13 +54,13 @@ class IMAP4: file: IO[str] | IO[bytes] def read(self, size: int) -> bytes: ... def readline(self) -> bytes: ... - def send(self, data: bytes) -> None: ... + def send(self, data: ReadableBuffer) -> None: ... def shutdown(self) -> None: ... def socket(self) -> _socket: ... def recent(self) -> _CommandResults: ... def response(self, code: str) -> _CommandResults: ... - def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ... - def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> Tuple[str, str]: ... + def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> str: ... + def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> tuple[str, str]: ... def capability(self) -> _CommandResults: ... def check(self) -> _CommandResults: ... def close(self) -> _CommandResults: ... @@ -61,31 +70,31 @@ class IMAP4: def deleteacl(self, mailbox: str, who: str) -> _CommandResults: ... def enable(self, capability: str) -> _CommandResults: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... def expunge(self) -> _CommandResults: ... - def fetch(self, message_set: str, message_parts: str) -> Tuple[str, _AnyResponseData]: ... + def fetch(self, message_set: str, message_parts: str) -> tuple[str, _AnyResponseData]: ... def getacl(self, mailbox: str) -> _CommandResults: ... def getannotation(self, mailbox: str, entry: str, attribute: str) -> _CommandResults: ... def getquota(self, root: str) -> _CommandResults: ... def getquotaroot(self, mailbox: str) -> _CommandResults: ... - def list(self, directory: str = ..., pattern: str = ...) -> Tuple[str, _AnyResponseData]: ... - def login(self, user: str, password: str) -> Tuple[Literal["OK"], List[bytes]]: ... + def list(self, directory: str = ..., pattern: str = ...) -> tuple[str, _AnyResponseData]: ... + def login(self, user: str, password: str) -> tuple[Literal["OK"], _list[bytes]]: ... def login_cram_md5(self, user: str, password: str) -> _CommandResults: ... - def logout(self) -> Tuple[str, _AnyResponseData]: ... + def logout(self) -> tuple[str, _AnyResponseData]: ... def lsub(self, directory: str = ..., pattern: str = ...) -> _CommandResults: ... def myrights(self, mailbox: str) -> _CommandResults: ... def namespace(self) -> _CommandResults: ... - def noop(self) -> Tuple[str, List[bytes]]: ... + def noop(self) -> tuple[str, _list[bytes]]: ... def partial(self, message_num: str, message_part: str, start: str, length: str) -> _CommandResults: ... def proxyauth(self, user: str) -> _CommandResults: ... def rename(self, oldmailbox: str, newmailbox: str) -> _CommandResults: ... def search(self, charset: str | None, *criteria: str) -> _CommandResults: ... - def select(self, mailbox: str = ..., readonly: bool = ...) -> Tuple[str, List[bytes | None]]: ... + def select(self, mailbox: str = ..., readonly: bool = ...) -> tuple[str, _list[bytes | None]]: ... def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ... def setannotation(self, *args: str) -> _CommandResults: ... def setquota(self, root: str, limits: str) -> _CommandResults: ... def sort(self, sort_criteria: str, charset: str, *search_criteria: str) -> _CommandResults: ... - def starttls(self, ssl_context: Any | None = ...) -> Tuple[Literal["OK"], List[None]]: ... + def starttls(self, ssl_context: Any | None = ...) -> tuple[Literal["OK"], _list[None]]: ... def status(self, mailbox: str, names: str) -> _CommandResults: ... def store(self, message_set: str, command: str, flags: str) -> _CommandResults: ... def subscribe(self, mailbox: str) -> _CommandResults: ... @@ -94,6 +103,7 @@ class IMAP4: def unsubscribe(self, mailbox: str) -> _CommandResults: ... if sys.version_info >= (3, 9): def unselect(self) -> _CommandResults: ... + def xatom(self, name: str, *args: str) -> _CommandResults: ... def print_log(self) -> None: ... @@ -119,28 +129,18 @@ class IMAP4_SSL(IMAP4): certfile: str | None = ..., ssl_context: SSLContext | None = ..., ) -> None: ... - host: str - port: int - sock: _socket sslobj: SSLSocket file: IO[Any] if sys.version_info >= (3, 9): def open(self, host: str = ..., port: int | None = ..., timeout: float | None = ...) -> None: ... else: def open(self, host: str = ..., port: int | None = ...) -> None: ... - def read(self, size: int) -> bytes: ... - def readline(self) -> bytes: ... - def send(self, data: bytes) -> None: ... - def shutdown(self) -> None: ... - def socket(self) -> _socket: ... + def ssl(self) -> SSLSocket: ... class IMAP4_stream(IMAP4): command: str def __init__(self, command: str) -> None: ... - host: str - port: int - sock: _socket file: IO[Any] process: subprocess.Popen[bytes] writefile: IO[Any] @@ -149,19 +149,15 @@ class IMAP4_stream(IMAP4): def open(self, host: str | None = ..., port: int | None = ..., timeout: float | None = ...) -> None: ... else: def open(self, host: str | None = ..., port: int | None = ...) -> None: ... - def read(self, size: int) -> bytes: ... - def readline(self) -> bytes: ... - def send(self, data: bytes) -> None: ... - def shutdown(self) -> None: ... class _Authenticator: - mech: Callable[[bytes], bytes] - def __init__(self, mechinst: Callable[[bytes], bytes]) -> None: ... + mech: Callable[[bytes], bytes | bytearray | memoryview | str | None] + def __init__(self, mechinst: Callable[[bytes], bytes | bytearray | memoryview | str | None]) -> None: ... def process(self, data: str) -> str: ... - def encode(self, inp: bytes) -> str: ... - def decode(self, inp: str) -> bytes: ... + def encode(self, inp: bytes | bytearray | memoryview) -> str: ... + def decode(self, inp: str | _BufferWithLen) -> bytes: ... -def Internaldate2tuple(resp: str) -> time.struct_time: ... -def Int2AP(num: int) -> str: ... -def ParseFlags(resp: str) -> Tuple[str]: ... -def Time2Internaldate(date_time: float | time.struct_time | str) -> str: ... +def Internaldate2tuple(resp: ReadableBuffer) -> time.struct_time | None: ... +def Int2AP(num: SupportsAbs[SupportsInt]) -> bytes: ... +def ParseFlags(resp: ReadableBuffer) -> tuple[bytes, ...]: ... +def Time2Internaldate(date_time: float | time.struct_time | time._TimeTuple | datetime | str) -> str: ... diff --git a/stdlib/imghdr.pyi b/stdlib/imghdr.pyi index 4515cf2..5f43977 100644 --- a/stdlib/imghdr.pyi +++ b/stdlib/imghdr.pyi @@ -1,5 +1,8 @@ from _typeshed import StrPath -from typing import Any, BinaryIO, Callable, Protocol, overload +from collections.abc import Callable +from typing import Any, BinaryIO, Protocol, overload + +__all__ = ["what"] class _ReadableBinary(Protocol): def tell(self) -> int: ... diff --git a/stdlib/imp.pyi b/stdlib/imp.pyi index aac16f0..889f0ca 100644 --- a/stdlib/imp.pyi +++ b/stdlib/imp.pyi @@ -1,8 +1,4 @@ import types -from _typeshed import StrPath -from os import PathLike -from typing import IO, Any, Protocol, Tuple, TypeVar - from _imp import ( acquire_lock as acquire_lock, create_dynamic as create_dynamic, @@ -14,8 +10,10 @@ from _imp import ( lock_held as lock_held, release_lock as release_lock, ) - -_T = TypeVar("_T") +from _typeshed import StrPath +from os import PathLike +from types import TracebackType +from typing import IO, Any, Protocol SEARCH_ERROR: int PY_SOURCE: int @@ -33,7 +31,7 @@ def get_magic() -> bytes: ... def get_tag() -> str: ... def cache_from_source(path: StrPath, debug_override: bool | None = ...) -> str: ... def source_from_cache(path: StrPath) -> str: ... -def get_suffixes() -> list[Tuple[str, str, int]]: ... +def get_suffixes() -> list[tuple[str, str, int]]: ... class NullImporter: def __init__(self, path: StrPath) -> None: ... @@ -47,18 +45,18 @@ class _FileLike(Protocol): def read(self) -> str | bytes: ... def close(self) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, *args: Any) -> Any: ... + def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> Any: ... # PathLike doesn't work for the pathname argument here def load_source(name: str, pathname: str, file: _FileLike | None = ...) -> types.ModuleType: ... def load_compiled(name: str, pathname: str, file: _FileLike | None = ...) -> types.ModuleType: ... def load_package(name: str, path: StrPath) -> types.ModuleType: ... -def load_module(name: str, file: _FileLike | None, filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ... +def load_module(name: str, file: _FileLike | None, filename: str, details: tuple[str, str, int]) -> types.ModuleType: ... # IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise. def find_module( name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = ... -) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ... +) -> tuple[IO[Any], str, tuple[str, str, int]]: ... def reload(module: types.ModuleType) -> types.ModuleType: ... def init_builtin(name: str) -> types.ModuleType | None: ... def load_dynamic(name: str, path: str, file: Any = ...) -> types.ModuleType: ... # file argument is ignored diff --git a/stdlib/importlib/__init__.pyi b/stdlib/importlib/__init__.pyi index b7986de..42401a0 100644 --- a/stdlib/importlib/__init__.pyi +++ b/stdlib/importlib/__init__.pyi @@ -1,15 +1,20 @@ -import types +from collections.abc import Mapping, Sequence from importlib.abc import Loader -from typing import Any, Mapping, Sequence +from types import ModuleType +__all__ = ["__import__", "import_module", "invalidate_caches", "reload"] + +# Signature of `builtins.__import__` should be kept identical to `importlib.__import__` def __import__( name: str, - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., + globals: Mapping[str, object] | None = ..., + locals: Mapping[str, object] | None = ..., fromlist: Sequence[str] = ..., level: int = ..., -) -> types.ModuleType: ... -def import_module(name: str, package: str | None = ...) -> types.ModuleType: ... +) -> ModuleType: ... + +# `importlib.import_module` return type should be kept the same as `builtins.__import__` +def import_module(name: str, package: str | None = ...) -> ModuleType: ... def find_loader(name: str, path: str | None = ...) -> Loader | None: ... def invalidate_caches() -> None: ... -def reload(module: types.ModuleType) -> types.ModuleType: ... +def reload(module: ModuleType) -> ModuleType: ... diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index 6737912..c961fb2 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -6,89 +6,102 @@ from _typeshed import ( OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode, - StrOrBytesPath, - StrPath, + ReadableBuffer, ) from abc import ABCMeta, abstractmethod +from collections.abc import Iterator, Mapping, Sequence from importlib.machinery import ModuleSpec from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper -from typing import IO, Any, BinaryIO, Iterator, Mapping, Protocol, Sequence, Tuple, Union, overload -from typing_extensions import Literal, runtime_checkable +from typing import IO, Any, BinaryIO, NoReturn, Protocol, overload, runtime_checkable +from typing_extensions import Literal -_Path = Union[bytes, str] +if sys.version_info >= (3, 11): + __all__ = [ + "Loader", + "Finder", + "MetaPathFinder", + "PathEntryFinder", + "ResourceLoader", + "InspectLoader", + "ExecutionLoader", + "FileLoader", + "SourceLoader", + "ResourceReader", + "Traversable", + "TraversableResources", + ] class Finder(metaclass=ABCMeta): ... +class Loader(metaclass=ABCMeta): + def load_module(self, fullname: str) -> types.ModuleType: ... + def module_repr(self, module: types.ModuleType) -> str: ... + def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: ... + # Not defined on the actual class for backwards-compatibility reasons, + # but expected in new code. + def exec_module(self, module: types.ModuleType) -> None: ... + class ResourceLoader(Loader): @abstractmethod - def get_data(self, path: _Path) -> bytes: ... + def get_data(self, path: str) -> bytes: ... class InspectLoader(Loader): def is_package(self, fullname: str) -> bool: ... def get_code(self, fullname: str) -> types.CodeType | None: ... - def load_module(self, fullname: str) -> types.ModuleType: ... @abstractmethod def get_source(self, fullname: str) -> str | None: ... def exec_module(self, module: types.ModuleType) -> None: ... @staticmethod - def source_to_code(data: bytes | str, path: str = ...) -> types.CodeType: ... + def source_to_code(data: ReadableBuffer | str, path: str = ...) -> types.CodeType: ... class ExecutionLoader(InspectLoader): @abstractmethod - def get_filename(self, fullname: str) -> _Path: ... - def get_code(self, fullname: str) -> types.CodeType | None: ... + def get_filename(self, fullname: str) -> str: ... class SourceLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta): - def path_mtime(self, path: _Path) -> float: ... - def set_data(self, path: _Path, data: bytes) -> None: ... + def path_mtime(self, path: str) -> float: ... + def set_data(self, path: str, data: bytes) -> None: ... def get_source(self, fullname: str) -> str | None: ... - def path_stats(self, path: _Path) -> Mapping[str, Any]: ... + def path_stats(self, path: str) -> Mapping[str, Any]: ... # Please keep in sync with sys._MetaPathFinder class MetaPathFinder(Finder): - def find_module(self, fullname: str, path: Sequence[_Path] | None) -> Loader | None: ... + def find_module(self, fullname: str, path: Sequence[str] | None) -> Loader | None: ... def invalidate_caches(self) -> None: ... # Not defined on the actual class, but expected to exist. def find_spec( - self, fullname: str, path: Sequence[_Path] | None, target: types.ModuleType | None = ... + self, fullname: str, path: Sequence[str] | None, target: types.ModuleType | None = ... ) -> ModuleSpec | None: ... class PathEntryFinder(Finder): def find_module(self, fullname: str) -> Loader | None: ... - def find_loader(self, fullname: str) -> Tuple[Loader | None, Sequence[_Path]]: ... + def find_loader(self, fullname: str) -> tuple[Loader | None, Sequence[str]]: ... def invalidate_caches(self) -> None: ... # Not defined on the actual class, but expected to exist. def find_spec(self, fullname: str, target: types.ModuleType | None = ...) -> ModuleSpec | None: ... -class Loader(metaclass=ABCMeta): - def load_module(self, fullname: str) -> types.ModuleType: ... - def module_repr(self, module: types.ModuleType) -> str: ... - def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: ... - # Not defined on the actual class for backwards-compatibility reasons, - # but expected in new code. - def exec_module(self, module: types.ModuleType) -> None: ... - -class _LoaderProtocol(Protocol): - def load_module(self, fullname: str) -> types.ModuleType: ... - class FileLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta): name: str - path: _Path - def __init__(self, fullname: str, path: _Path) -> None: ... - def get_data(self, path: _Path) -> bytes: ... - def get_filename(self, name: str | None = ...) -> _Path: ... + path: str + def __init__(self, fullname: str, path: str) -> None: ... + def get_data(self, path: str) -> bytes: ... + def get_filename(self, name: str | None = ...) -> str: ... def load_module(self, name: str | None = ...) -> types.ModuleType: ... -if sys.version_info >= (3, 7): - class ResourceReader(metaclass=ABCMeta): - @abstractmethod - def open_resource(self, resource: StrOrBytesPath) -> IO[bytes]: ... +class ResourceReader(metaclass=ABCMeta): + @abstractmethod + def open_resource(self, resource: str) -> IO[bytes]: ... + @abstractmethod + def resource_path(self, resource: str) -> str: ... + if sys.version_info >= (3, 10): @abstractmethod - def resource_path(self, resource: StrOrBytesPath) -> str: ... + def is_resource(self, path: str) -> bool: ... + else: @abstractmethod def is_resource(self, name: str) -> bool: ... - @abstractmethod - def contents(self) -> Iterator[str]: ... + + @abstractmethod + def contents(self) -> Iterator[str]: ... if sys.version_info >= (3, 9): @runtime_checkable @@ -99,8 +112,12 @@ if sys.version_info >= (3, 9): def is_file(self) -> bool: ... @abstractmethod def iterdir(self) -> Iterator[Traversable]: ... - @abstractmethod - def joinpath(self, child: StrPath) -> Traversable: ... + if sys.version_info >= (3, 11): + @abstractmethod + def joinpath(self, *descendants: str) -> Traversable: ... + else: + @abstractmethod + def joinpath(self, child: str) -> Traversable: ... # The .open method comes from pathlib.pyi and should be kept in sync. @overload @abstractmethod @@ -153,7 +170,7 @@ if sys.version_info >= (3, 9): @overload @abstractmethod def open( - self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ... + self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ... ) -> BinaryIO: ... # Fallback if mode is not specified @overload @@ -162,10 +179,19 @@ if sys.version_info >= (3, 9): self, mode: str, buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., newline: str | None = ... ) -> IO[Any]: ... @property + @abstractmethod def name(self) -> str: ... @abstractmethod - def __truediv__(self, key: StrPath) -> Traversable: ... + def __truediv__(self, child: str) -> Traversable: ... @abstractmethod def read_bytes(self) -> bytes: ... @abstractmethod def read_text(self, encoding: str | None = ...) -> str: ... + + class TraversableResources(ResourceReader): + @abstractmethod + def files(self) -> Traversable: ... + def open_resource(self, resource: str) -> BufferedReader: ... # type: ignore[override] + def resource_path(self, resource: Any) -> NoReturn: ... + def is_resource(self, path: str) -> bool: ... + def contents(self) -> Iterator[str]: ... diff --git a/stdlib/importlib/machinery.pyi b/stdlib/importlib/machinery.pyi index 30194f6..6e25352 100644 --- a/stdlib/importlib/machinery.pyi +++ b/stdlib/importlib/machinery.pyi @@ -1,8 +1,13 @@ import importlib.abc +import sys import types -from typing import Any, Callable, Sequence, Tuple +from _typeshed import ReadableBuffer +from collections.abc import Callable, Iterable, Sequence +from typing import Any + +if sys.version_info >= (3, 8): + from importlib.metadata import DistributionFinder, PathDistribution -# TODO: the loaders seem a bit backwards, attribute is protocol but __init__ arg isn't? class ModuleSpec: def __init__( self, @@ -14,21 +19,23 @@ class ModuleSpec: is_package: bool | None = ..., ) -> None: ... name: str - loader: importlib.abc._LoaderProtocol | None + loader: importlib.abc.Loader | None origin: str | None submodule_search_locations: list[str] | None loader_state: Any cached: str | None - parent: str | None + @property + def parent(self) -> str | None: ... has_location: bool + def __eq__(self, other: object) -> bool: ... class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @classmethod - def find_module(cls, fullname: str, path: Sequence[importlib.abc._Path] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... @classmethod def find_spec( - cls, fullname: str, path: Sequence[importlib.abc._Path] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... ) -> ModuleSpec | None: ... # InspectLoader @classmethod @@ -42,18 +49,24 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader) # Loader @staticmethod def module_repr(module: types.ModuleType) -> str: ... - @classmethod - def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ... - @classmethod - def exec_module(cls, module: types.ModuleType) -> None: ... + if sys.version_info >= (3, 10): + @staticmethod + def create_module(spec: ModuleSpec) -> types.ModuleType | None: ... + @staticmethod + def exec_module(module: types.ModuleType) -> None: ... + else: + @classmethod + def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ... + @classmethod + def exec_module(cls, module: types.ModuleType) -> None: ... class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @classmethod - def find_module(cls, fullname: str, path: Sequence[importlib.abc._Path] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... @classmethod def find_spec( - cls, fullname: str, path: Sequence[importlib.abc._Path] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... ) -> ModuleSpec | None: ... # InspectLoader @classmethod @@ -67,28 +80,44 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # Loader @staticmethod def module_repr(m: types.ModuleType) -> str: ... - @classmethod - def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ... + if sys.version_info >= (3, 10): + @staticmethod + def create_module(spec: ModuleSpec) -> types.ModuleType | None: ... + else: + @classmethod + def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: ... + @staticmethod def exec_module(module: types.ModuleType) -> None: ... class WindowsRegistryFinder(importlib.abc.MetaPathFinder): @classmethod - def find_module(cls, fullname: str, path: Sequence[importlib.abc._Path] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... @classmethod def find_spec( - cls, fullname: str, path: Sequence[importlib.abc._Path] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... ) -> ModuleSpec | None: ... class PathFinder: - @classmethod - def invalidate_caches(cls) -> None: ... + if sys.version_info >= (3, 10): + @staticmethod + def invalidate_caches() -> None: ... + else: + @classmethod + def invalidate_caches(cls) -> None: ... + if sys.version_info >= (3, 10): + @staticmethod + def find_distributions(context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ... + elif sys.version_info >= (3, 8): + @classmethod + def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ... + @classmethod def find_spec( - cls, fullname: str, path: Sequence[bytes | str] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... ) -> ModuleSpec | None: ... @classmethod - def find_module(cls, fullname: str, path: Sequence[bytes | str] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... SOURCE_SUFFIXES: list[str] DEBUG_BYTECODE_SUFFIXES: list[str] @@ -100,22 +129,22 @@ def all_suffixes() -> list[str]: ... class FileFinder(importlib.abc.PathEntryFinder): path: str - def __init__(self, path: str, *loader_details: Tuple[importlib.abc.Loader, list[str]]) -> None: ... + def __init__(self, path: str, *loader_details: tuple[type[importlib.abc.Loader], list[str]]) -> None: ... @classmethod def path_hook( - cls, *loader_details: Tuple[importlib.abc.Loader, list[str]] + cls, *loader_details: tuple[type[importlib.abc.Loader], list[str]] ) -> Callable[[str], importlib.abc.PathEntryFinder]: ... class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): - def set_data(self, path: importlib.abc._Path, data: bytes, *, _mode: int = ...) -> None: ... + def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = ...) -> None: ... class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ... class ExtensionFileLoader(importlib.abc.ExecutionLoader): - def __init__(self, name: str, path: importlib.abc._Path) -> None: ... - def get_filename(self, name: str | None = ...) -> importlib.abc._Path: ... + def __init__(self, name: str, path: str) -> None: ... + def get_filename(self, name: str | None = ...) -> str: ... def get_source(self, fullname: str) -> None: ... def create_module(self, spec: ModuleSpec) -> types.ModuleType: ... def exec_module(self, module: types.ModuleType) -> None: ... - def is_package(self, fullname: str) -> bool: ... def get_code(self, fullname: str) -> None: ... + def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/importlib/metadata.pyi b/stdlib/importlib/metadata.pyi deleted file mode 100644 index 2c1041b..0000000 --- a/stdlib/importlib/metadata.pyi +++ /dev/null @@ -1,90 +0,0 @@ -import abc -import pathlib -import sys -from _typeshed import StrPath -from collections.abc import Mapping -from email.message import Message -from importlib.abc import MetaPathFinder -from os import PathLike -from pathlib import Path -from typing import Any, Iterable, NamedTuple, Tuple, overload - -if sys.version_info >= (3, 10): - def packages_distributions() -> Mapping[str, list[str]]: ... - -if sys.version_info >= (3, 8): - class PackageNotFoundError(ModuleNotFoundError): ... - class _EntryPointBase(NamedTuple): - name: str - value: str - group: str - class EntryPoint(_EntryPointBase): - def load(self) -> Any: ... # Callable[[], Any] or an importable module - @property - def extras(self) -> list[str]: ... - class PackagePath(pathlib.PurePosixPath): - def read_text(self, encoding: str = ...) -> str: ... - def read_binary(self) -> bytes: ... - def locate(self) -> PathLike[str]: ... - # The following attributes are not defined on PackagePath, but are dynamically added by Distribution.files: - hash: FileHash | None - size: int | None - dist: Distribution - class FileHash: - mode: str - value: str - def __init__(self, spec: str) -> None: ... - class Distribution: - @abc.abstractmethod - def read_text(self, filename: str) -> str | None: ... - @abc.abstractmethod - def locate_file(self, path: StrPath) -> PathLike[str]: ... - @classmethod - def from_name(cls, name: str) -> Distribution: ... - @overload - @classmethod - def discover(cls, *, context: DistributionFinder.Context) -> Iterable[Distribution]: ... - @overload - @classmethod - def discover( - cls, *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any - ) -> Iterable[Distribution]: ... - @staticmethod - def at(path: StrPath) -> PathDistribution: ... - @property - def metadata(self) -> Message: ... - @property - def version(self) -> str: ... - @property - def entry_points(self) -> list[EntryPoint]: ... - @property - def files(self) -> list[PackagePath] | None: ... - @property - def requires(self) -> list[str] | None: ... - class DistributionFinder(MetaPathFinder): - class Context: - name: str | None - def __init__(self, *, name: str | None = ..., path: list[str] = ..., **kwargs: Any) -> None: ... - @property - def path(self) -> list[str]: ... - @abc.abstractmethod - def find_distributions(self, context: DistributionFinder.Context = ...) -> Iterable[Distribution]: ... - class MetadataPathFinder(DistributionFinder): - @classmethod - def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ... - class PathDistribution(Distribution): - def __init__(self, path: Path) -> None: ... - def read_text(self, filename: StrPath) -> str: ... - def locate_file(self, path: StrPath) -> PathLike[str]: ... - def distribution(distribution_name: str) -> Distribution: ... - @overload - def distributions(*, context: DistributionFinder.Context) -> Iterable[Distribution]: ... - @overload - def distributions( - *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any - ) -> Iterable[Distribution]: ... - def metadata(distribution_name: str) -> Message: ... - def version(distribution_name: str) -> str: ... - def entry_points() -> dict[str, Tuple[EntryPoint, ...]]: ... - def files(distribution_name: str) -> list[PackagePath] | None: ... - def requires(distribution_name: str) -> list[str] | None: ... diff --git a/stdlib/importlib/metadata/__init__.pyi b/stdlib/importlib/metadata/__init__.pyi new file mode 100644 index 0000000..01e35db --- /dev/null +++ b/stdlib/importlib/metadata/__init__.pyi @@ -0,0 +1,206 @@ +import abc +import pathlib +import sys +from _typeshed import Self, StrPath +from collections.abc import Iterable, Mapping +from email.message import Message +from importlib.abc import MetaPathFinder +from os import PathLike +from pathlib import Path +from re import Pattern +from typing import Any, ClassVar, NamedTuple, overload + +__all__ = [ + "Distribution", + "DistributionFinder", + "PackageNotFoundError", + "distribution", + "distributions", + "entry_points", + "files", + "metadata", + "requires", + "version", +] + +if sys.version_info >= (3, 10): + __all__ += ["PackageMetadata", "packages_distributions"] + +if sys.version_info >= (3, 10): + from importlib.metadata._meta import PackageMetadata as PackageMetadata + def packages_distributions() -> Mapping[str, list[str]]: ... + +class PackageNotFoundError(ModuleNotFoundError): + @property + def name(self) -> str: ... # type: ignore[override] + +class _EntryPointBase(NamedTuple): + name: str + value: str + group: str + +class EntryPoint(_EntryPointBase): + pattern: ClassVar[Pattern[str]] + if sys.version_info >= (3, 11): + def __init__(self, name: str, value: str, group: str) -> None: ... + + def load(self) -> Any: ... # Callable[[], Any] or an importable module + @property + def extras(self) -> list[str]: ... + if sys.version_info >= (3, 9): + @property + def module(self) -> str: ... + @property + def attr(self) -> str: ... + if sys.version_info >= (3, 10): + dist: ClassVar[Distribution | None] + def matches( + self, + *, + name: str = ..., + value: str = ..., + group: str = ..., + module: str = ..., + attr: str = ..., + extras: list[str] = ..., + ) -> bool: ... # undocumented + +if sys.version_info >= (3, 10): + class EntryPoints(list[EntryPoint]): # use as list is deprecated since 3.10 + # int argument is deprecated since 3.10 + def __getitem__(self, name: int | str) -> EntryPoint: ... # type: ignore[override] + def select( + self, + *, + name: str = ..., + value: str = ..., + group: str = ..., + module: str = ..., + attr: str = ..., + extras: list[str] = ..., + ) -> EntryPoints: ... + @property + def names(self) -> set[str]: ... + @property + def groups(self) -> set[str]: ... + + class SelectableGroups(dict[str, EntryPoints]): # use as dict is deprecated since 3.10 + @classmethod + def load(cls: type[Self], eps: Iterable[EntryPoint]) -> Self: ... + @property + def groups(self) -> set[str]: ... + @property + def names(self) -> set[str]: ... + @overload + def select(self: Self) -> Self: ... # type: ignore[misc] + @overload + def select( + self, + *, + name: str = ..., + value: str = ..., + group: str = ..., + module: str = ..., + attr: str = ..., + extras: list[str] = ..., + ) -> EntryPoints: ... + +class PackagePath(pathlib.PurePosixPath): + def read_text(self, encoding: str = ...) -> str: ... + def read_binary(self) -> bytes: ... + def locate(self) -> PathLike[str]: ... + # The following attributes are not defined on PackagePath, but are dynamically added by Distribution.files: + hash: FileHash | None + size: int | None + dist: Distribution + +class FileHash: + mode: str + value: str + def __init__(self, spec: str) -> None: ... + +class Distribution: + @abc.abstractmethod + def read_text(self, filename: str) -> str | None: ... + @abc.abstractmethod + def locate_file(self, path: StrPath) -> PathLike[str]: ... + @classmethod + def from_name(cls, name: str) -> Distribution: ... + @overload + @classmethod + def discover(cls, *, context: DistributionFinder.Context) -> Iterable[Distribution]: ... + @overload + @classmethod + def discover( + cls, *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any + ) -> Iterable[Distribution]: ... + @staticmethod + def at(path: StrPath) -> PathDistribution: ... + + if sys.version_info >= (3, 10): + @property + def metadata(self) -> PackageMetadata: ... + @property + def entry_points(self) -> EntryPoints: ... + else: + @property + def metadata(self) -> Message: ... + @property + def entry_points(self) -> list[EntryPoint]: ... + + @property + def version(self) -> str: ... + @property + def files(self) -> list[PackagePath] | None: ... + @property + def requires(self) -> list[str] | None: ... + if sys.version_info >= (3, 10): + @property + def name(self) -> str: ... + +class DistributionFinder(MetaPathFinder): + class Context: + name: str | None + def __init__(self, *, name: str | None = ..., path: list[str] = ..., **kwargs: Any) -> None: ... + @property + def path(self) -> list[str]: ... + + @abc.abstractmethod + def find_distributions(self, context: DistributionFinder.Context = ...) -> Iterable[Distribution]: ... + +class MetadataPathFinder(DistributionFinder): + @classmethod + def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ... + if sys.version_info >= (3, 10): + # Yes, this is an instance method that has argumend named "cls" + def invalidate_caches(cls) -> None: ... + +class PathDistribution(Distribution): + def __init__(self, path: Path) -> None: ... + def read_text(self, filename: StrPath) -> str: ... + def locate_file(self, path: StrPath) -> PathLike[str]: ... + +def distribution(distribution_name: str) -> Distribution: ... +@overload +def distributions(*, context: DistributionFinder.Context) -> Iterable[Distribution]: ... +@overload +def distributions( + *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any +) -> Iterable[Distribution]: ... + +if sys.version_info >= (3, 10): + def metadata(distribution_name: str) -> PackageMetadata: ... + @overload + def entry_points() -> SelectableGroups: ... # type: ignore[misc] + @overload + def entry_points( + *, name: str = ..., value: str = ..., group: str = ..., module: str = ..., attr: str = ..., extras: list[str] = ... + ) -> EntryPoints: ... + +else: + def metadata(distribution_name: str) -> Message: ... + def entry_points() -> dict[str, list[EntryPoint]]: ... + +def version(distribution_name: str) -> str: ... +def files(distribution_name: str) -> list[PackagePath] | None: ... +def requires(distribution_name: str) -> list[str] | None: ... diff --git a/stdlib/importlib/metadata/_meta.pyi b/stdlib/importlib/metadata/_meta.pyi new file mode 100644 index 0000000..e3504fe --- /dev/null +++ b/stdlib/importlib/metadata/_meta.pyi @@ -0,0 +1,22 @@ +from collections.abc import Iterator +from typing import Any, Protocol, TypeVar + +_T = TypeVar("_T") + +class PackageMetadata(Protocol): + def __len__(self) -> int: ... + def __contains__(self, item: str) -> bool: ... + def __getitem__(self, key: str) -> str: ... + def __iter__(self) -> Iterator[str]: ... + def get_all(self, name: str, failobj: _T = ...) -> list[Any] | _T: ... + @property + def json(self) -> dict[str, str | list[str]]: ... + +class SimplePath(Protocol): + def joinpath(self) -> SimplePath: ... + def parent(self) -> SimplePath: ... + def read_text(self) -> str: ... + # There was a bug in `SimplePath` definition in cpython, see #8451 + # Strictly speaking `__div__` was defined in 3.10, not __truediv__, + # but it should have always been `__truediv__`. + def __truediv__(self) -> SimplePath: ... diff --git a/stdlib/importlib/resources.pyi b/stdlib/importlib/resources.pyi index 075761a..28ca107 100644 --- a/stdlib/importlib/resources.pyi +++ b/stdlib/importlib/resources.pyi @@ -1,25 +1,39 @@ +import os import sys -from typing import Any - -# This is a >=3.7 module, so we conditionally include its source. -if sys.version_info >= (3, 7): - import os - from pathlib import Path - from types import ModuleType - from typing import BinaryIO, ContextManager, Iterator, TextIO, Union - - Package = Union[str, ModuleType] - Resource = Union[str, os.PathLike[Any]] - def open_binary(package: Package, resource: Resource) -> BinaryIO: ... - def open_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> TextIO: ... - def read_binary(package: Package, resource: Resource) -> bytes: ... - def read_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> str: ... - def path(package: Package, resource: Resource) -> ContextManager[Path]: ... - def is_resource(package: Package, name: str) -> bool: ... - def contents(package: Package) -> Iterator[str]: ... +from collections.abc import Iterator +from contextlib import AbstractContextManager +from pathlib import Path +from types import ModuleType +from typing import Any, BinaryIO, TextIO +from typing_extensions import TypeAlias + +__all__ = ["Package", "Resource", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"] + +if sys.version_info >= (3, 9): + __all__ += ["as_file", "files"] + +if sys.version_info >= (3, 10): + __all__ += ["ResourceReader"] + +Package: TypeAlias = str | ModuleType + +if sys.version_info >= (3, 11): + Resource: TypeAlias = str +else: + Resource: TypeAlias = str | os.PathLike[Any] + +def open_binary(package: Package, resource: Resource) -> BinaryIO: ... +def open_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> TextIO: ... +def read_binary(package: Package, resource: Resource) -> bytes: ... +def read_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> str: ... +def path(package: Package, resource: Resource) -> AbstractContextManager[Path]: ... +def is_resource(package: Package, name: str) -> bool: ... +def contents(package: Package) -> Iterator[str]: ... if sys.version_info >= (3, 9): - from contextlib import AbstractContextManager from importlib.abc import Traversable def files(package: Package) -> Traversable: ... def as_file(path: Traversable) -> AbstractContextManager[Path]: ... + +if sys.version_info >= (3, 10): + from importlib.abc import ResourceReader as ResourceReader diff --git a/stdlib/importlib/util.pyi b/stdlib/importlib/util.pyi index 30b8765..e9c08ae 100644 --- a/stdlib/importlib/util.pyi +++ b/stdlib/importlib/util.pyi @@ -1,22 +1,23 @@ import importlib.abc import importlib.machinery import types -from _typeshed import StrOrBytesPath -from typing import Any, Callable +from _typeshed import ReadableBuffer, StrOrBytesPath +from collections.abc import Callable +from typing import Any from typing_extensions import ParamSpec _P = ParamSpec("_P") -def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore -def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore -def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore +def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... +def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... +def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... def resolve_name(name: str, package: str | None) -> str: ... MAGIC_NUMBER: bytes def cache_from_source(path: str, debug_override: bool | None = ..., *, optimization: Any | None = ...) -> str: ... def source_from_cache(path: str) -> str: ... -def decode_source(source_bytes: bytes) -> str: ... +def decode_source(source_bytes: ReadableBuffer) -> str: ... def find_spec(name: str, package: str | None = ...) -> importlib.machinery.ModuleSpec | None: ... def spec_from_loader( name: str, loader: importlib.abc.Loader | None, *, origin: str | None = ..., is_package: bool | None = ... @@ -34,5 +35,6 @@ class LazyLoader(importlib.abc.Loader): def __init__(self, loader: importlib.abc.Loader) -> None: ... @classmethod def factory(cls, loader: importlib.abc.Loader) -> Callable[..., LazyLoader]: ... - def create_module(self, spec: importlib.machinery.ModuleSpec) -> types.ModuleType | None: ... def exec_module(self, module: types.ModuleType) -> None: ... + +def source_hash(source_bytes: ReadableBuffer) -> int: ... diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index b868e64..b97bc60 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -1,23 +1,137 @@ +import dis import enum import sys import types from _typeshed import Self from collections import OrderedDict -from collections.abc import Awaitable, Callable, Generator, Mapping, Sequence, Set +from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine, Generator, Mapping, Sequence, Set as AbstractSet from types import ( AsyncGeneratorType, BuiltinFunctionType, + BuiltinMethodType, + ClassMethodDescriptorType, CodeType, CoroutineType, FrameType, FunctionType, GeneratorType, + GetSetDescriptorType, + LambdaType, + MemberDescriptorType, + MethodDescriptorType, MethodType, + MethodWrapperType, ModuleType, TracebackType, + WrapperDescriptorType, ) -from typing import Any, ClassVar, NamedTuple, Tuple, Type, Union -from typing_extensions import Literal, TypeGuard +from typing import Any, ClassVar, NamedTuple, Protocol, TypeVar, Union, overload +from typing_extensions import Literal, ParamSpec, TypeAlias, TypeGuard + +if sys.version_info >= (3, 11): + __all__ = [ + "ArgInfo", + "Arguments", + "Attribute", + "BlockFinder", + "BoundArguments", + "CORO_CLOSED", + "CORO_CREATED", + "CORO_RUNNING", + "CORO_SUSPENDED", + "CO_ASYNC_GENERATOR", + "CO_COROUTINE", + "CO_GENERATOR", + "CO_ITERABLE_COROUTINE", + "CO_NESTED", + "CO_NEWLOCALS", + "CO_NOFREE", + "CO_OPTIMIZED", + "CO_VARARGS", + "CO_VARKEYWORDS", + "ClassFoundException", + "ClosureVars", + "EndOfBlock", + "FrameInfo", + "FullArgSpec", + "GEN_CLOSED", + "GEN_CREATED", + "GEN_RUNNING", + "GEN_SUSPENDED", + "Parameter", + "Signature", + "TPFLAGS_IS_ABSTRACT", + "Traceback", + "classify_class_attrs", + "cleandoc", + "currentframe", + "findsource", + "formatannotation", + "formatannotationrelativeto", + "formatargvalues", + "get_annotations", + "getabsfile", + "getargs", + "getargvalues", + "getattr_static", + "getblock", + "getcallargs", + "getclasstree", + "getclosurevars", + "getcomments", + "getcoroutinelocals", + "getcoroutinestate", + "getdoc", + "getfile", + "getframeinfo", + "getfullargspec", + "getgeneratorlocals", + "getgeneratorstate", + "getinnerframes", + "getlineno", + "getmembers", + "getmembers_static", + "getmodule", + "getmodulename", + "getmro", + "getouterframes", + "getsource", + "getsourcefile", + "getsourcelines", + "indentsize", + "isabstract", + "isasyncgen", + "isasyncgenfunction", + "isawaitable", + "isbuiltin", + "isclass", + "iscode", + "iscoroutine", + "iscoroutinefunction", + "isdatadescriptor", + "isframe", + "isfunction", + "isgenerator", + "isgeneratorfunction", + "isgetsetdescriptor", + "ismemberdescriptor", + "ismethod", + "ismethoddescriptor", + "ismethodwrapper", + "ismodule", + "isroutine", + "istraceback", + "signature", + "stack", + "trace", + "unwrap", + "walktree", + ] + +_P = ParamSpec("_P") +_T = TypeVar("_T") +_T_cont = TypeVar("_T_cont", contravariant=True) +_V_cont = TypeVar("_V_cont", contravariant=True) # # Types and members @@ -32,63 +146,129 @@ class BlockFinder: indecorator: bool decoratorhasargs: bool last: int - def tokeneater(self, type: int, token: str, srowcol: Tuple[int, int], erowcol: Tuple[int, int], line: str) -> None: ... - -CO_OPTIMIZED: int -CO_NEWLOCALS: int -CO_VARARGS: int -CO_VARKEYWORDS: int -CO_NESTED: int -CO_GENERATOR: int -CO_NOFREE: int -CO_COROUTINE: int -CO_ITERABLE_COROUTINE: int -CO_ASYNC_GENERATOR: int -TPFLAGS_IS_ABSTRACT: int - -def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> list[Tuple[str, Any]]: ... + def tokeneater(self, type: int, token: str, srowcol: tuple[int, int], erowcol: tuple[int, int], line: str) -> None: ... + +CO_OPTIMIZED: Literal[1] +CO_NEWLOCALS: Literal[2] +CO_VARARGS: Literal[4] +CO_VARKEYWORDS: Literal[8] +CO_NESTED: Literal[16] +CO_GENERATOR: Literal[32] +CO_NOFREE: Literal[64] +CO_COROUTINE: Literal[128] +CO_ITERABLE_COROUTINE: Literal[256] +CO_ASYNC_GENERATOR: Literal[512] +TPFLAGS_IS_ABSTRACT: Literal[1048576] + +modulesbyfile: dict[str, Any] + +_GetMembersPredicate: TypeAlias = Callable[[Any], bool] +_GetMembersReturn: TypeAlias = list[tuple[str, Any]] + +def getmembers(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ... + +if sys.version_info >= (3, 11): + def getmembers_static(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ... + def getmodulename(path: str) -> str | None: ... def ismodule(object: object) -> TypeGuard[ModuleType]: ... -def isclass(object: object) -> TypeGuard[Type[Any]]: ... +def isclass(object: object) -> TypeGuard[type[Any]]: ... def ismethod(object: object) -> TypeGuard[MethodType]: ... def isfunction(object: object) -> TypeGuard[FunctionType]: ... if sys.version_info >= (3, 8): - def isgeneratorfunction(obj: object) -> bool: ... - def iscoroutinefunction(obj: object) -> bool: ... + @overload + def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: ... + @overload + def isgeneratorfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ... + @overload + def isgeneratorfunction(obj: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ... + @overload + def iscoroutinefunction(obj: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... + @overload + def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, _T]]]: ... + @overload + def iscoroutinefunction(obj: Callable[_P, object]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ... + @overload + def iscoroutinefunction(obj: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ... else: - def isgeneratorfunction(object: object) -> bool: ... - def iscoroutinefunction(object: object) -> bool: ... + @overload + def isgeneratorfunction(object: Callable[..., Generator[Any, Any, Any]]) -> bool: ... + @overload + def isgeneratorfunction(object: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ... + @overload + def isgeneratorfunction(object: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ... + @overload + def iscoroutinefunction(object: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... + @overload + def iscoroutinefunction(object: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, _T]]]: ... + @overload + def iscoroutinefunction(object: Callable[_P, Any]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ... + @overload + def iscoroutinefunction(object: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ... def isgenerator(object: object) -> TypeGuard[GeneratorType[Any, Any, Any]]: ... def iscoroutine(object: object) -> TypeGuard[CoroutineType[Any, Any, Any]]: ... def isawaitable(object: object) -> TypeGuard[Awaitable[Any]]: ... if sys.version_info >= (3, 8): - def isasyncgenfunction(obj: object) -> bool: ... + @overload + def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ... + @overload + def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ... + @overload + def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ... else: - def isasyncgenfunction(object: object) -> bool: ... + @overload + def isasyncgenfunction(object: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ... + @overload + def isasyncgenfunction(object: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ... + @overload + def isasyncgenfunction(object: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ... + +class _SupportsSet(Protocol[_T_cont, _V_cont]): + def __set__(self, __instance: _T_cont, __value: _V_cont) -> None: ... + +class _SupportsDelete(Protocol[_T_cont]): + def __delete__(self, __instance: _T_cont) -> None: ... def isasyncgen(object: object) -> TypeGuard[AsyncGeneratorType[Any, Any]]: ... def istraceback(object: object) -> TypeGuard[TracebackType]: ... def isframe(object: object) -> TypeGuard[FrameType]: ... def iscode(object: object) -> TypeGuard[CodeType]: ... def isbuiltin(object: object) -> TypeGuard[BuiltinFunctionType]: ... -def isroutine(object: object) -> bool: ... + +if sys.version_info >= (3, 11): + def ismethodwrapper(object: object) -> TypeGuard[MethodWrapperType]: ... + +def isroutine( + object: object, +) -> TypeGuard[ + FunctionType + | LambdaType + | MethodType + | BuiltinFunctionType + | BuiltinMethodType + | WrapperDescriptorType + | MethodDescriptorType + | ClassMethodDescriptorType +]: ... +def ismethoddescriptor(object: object) -> TypeGuard[MethodDescriptorType]: ... +def ismemberdescriptor(object: object) -> TypeGuard[MemberDescriptorType]: ... def isabstract(object: object) -> bool: ... -def ismethoddescriptor(object: object) -> bool: ... -def isdatadescriptor(object: object) -> bool: ... -def isgetsetdescriptor(object: object) -> bool: ... -def ismemberdescriptor(object: object) -> bool: ... +def isgetsetdescriptor(object: object) -> TypeGuard[GetSetDescriptorType]: ... +def isdatadescriptor(object: object) -> TypeGuard[_SupportsSet[Any, Any] | _SupportsDelete[Any]]: ... # # Retrieving source code # -_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]] +_SourceObjectType: TypeAlias = Union[ + ModuleType, type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any] +] -def findsource(object: _SourceObjectType) -> Tuple[list[str], int]: ... +def findsource(object: _SourceObjectType) -> tuple[list[str], int]: ... def getabsfile(object: _SourceObjectType, _filename: str | None = ...) -> str: ... def getblock(lines: Sequence[str]) -> Sequence[str]: ... def getdoc(object: object) -> str | None: ... @@ -96,17 +276,19 @@ def getcomments(object: object) -> str | None: ... def getfile(object: _SourceObjectType) -> str: ... def getmodule(object: object, _filename: str | None = ...) -> ModuleType | None: ... def getsourcefile(object: _SourceObjectType) -> str | None: ... -def getsourcelines(object: _SourceObjectType) -> Tuple[list[str], int]: ... +def getsourcelines(object: _SourceObjectType) -> tuple[list[str], int]: ... def getsource(object: _SourceObjectType) -> str: ... def cleandoc(doc: str) -> str: ... def indentsize(line: str) -> int: ... +_IntrospectableCallable: TypeAlias = Callable[..., Any] + # # Introspecting callables with the Signature object # if sys.version_info >= (3, 10): def signature( - obj: Callable[..., Any], + obj: _IntrospectableCallable, *, follow_wrapped: bool = ..., globals: Mapping[str, Any] | None = ..., @@ -115,7 +297,7 @@ if sys.version_info >= (3, 10): ) -> Signature: ... else: - def signature(obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ... + def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = ...) -> Signature: ... class _void: ... class _empty: ... @@ -127,32 +309,33 @@ class Signature: empty = _empty @property def parameters(self) -> types.MappingProxyType[str, Parameter]: ... - # TODO: can we be more specific here? @property def return_annotation(self) -> Any: ... def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ... def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ... def replace( - self: Self, *, parameters: Sequence[Parameter] | Type[_void] | None = ..., return_annotation: Any = ... + self: Self, *, parameters: Sequence[Parameter] | type[_void] | None = ..., return_annotation: Any = ... ) -> Self: ... if sys.version_info >= (3, 10): @classmethod def from_callable( - cls, - obj: Callable[..., Any], + cls: type[Self], + obj: _IntrospectableCallable, *, follow_wrapped: bool = ..., globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ..., eval_str: bool = ..., - ) -> Signature: ... + ) -> Self: ... else: @classmethod - def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ... + def from_callable(cls: type[Self], obj: _IntrospectableCallable, *, follow_wrapped: bool = ...) -> Self: ... + + def __eq__(self, other: object) -> bool: ... if sys.version_info >= (3, 10): def get_annotations( - obj: Callable[..., Any] | Type[Any] | ModuleType, + obj: Callable[..., object] | type[Any] | ModuleType, *, globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ..., @@ -168,37 +351,47 @@ class _ParameterKind(enum.IntEnum): VAR_KEYWORD: int if sys.version_info >= (3, 8): - description: str + @property + def description(self) -> str: ... class Parameter: def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ... empty = _empty - name: str - default: Any - annotation: Any - kind: _ParameterKind POSITIONAL_ONLY: ClassVar[Literal[_ParameterKind.POSITIONAL_ONLY]] POSITIONAL_OR_KEYWORD: ClassVar[Literal[_ParameterKind.POSITIONAL_OR_KEYWORD]] VAR_POSITIONAL: ClassVar[Literal[_ParameterKind.VAR_POSITIONAL]] KEYWORD_ONLY: ClassVar[Literal[_ParameterKind.KEYWORD_ONLY]] VAR_KEYWORD: ClassVar[Literal[_ParameterKind.VAR_KEYWORD]] + @property + def name(self) -> str: ... + @property + def default(self) -> Any: ... + @property + def kind(self) -> _ParameterKind: ... + @property + def annotation(self) -> Any: ... def replace( self: Self, *, - name: str | Type[_void] = ..., - kind: _ParameterKind | Type[_void] = ..., + name: str | type[_void] = ..., + kind: _ParameterKind | type[_void] = ..., default: Any = ..., annotation: Any = ..., ) -> Self: ... + def __eq__(self, other: object) -> bool: ... class BoundArguments: arguments: OrderedDict[str, Any] - args: Tuple[Any, ...] - kwargs: dict[str, Any] - signature: Signature + @property + def args(self) -> tuple[Any, ...]: ... + @property + def kwargs(self) -> dict[str, Any]: ... + @property + def signature(self) -> Signature: ... def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ... def apply_defaults(self) -> None: ... + def __eq__(self, other: object) -> bool: ... # # Classes and functions @@ -208,13 +401,7 @@ class BoundArguments: # seem to be supporting this at the moment: # _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]] def getclasstree(classes: list[type], unique: bool = ...) -> list[Any]: ... -def walktree(classes: list[type], children: dict[Type[Any], list[type]], parent: Type[Any] | None) -> list[Any]: ... - -class ArgSpec(NamedTuple): - args: list[str] - varargs: str | None - keywords: str | None - defaults: Tuple[Any, ...] +def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ... class Arguments(NamedTuple): args: list[str] @@ -222,13 +409,20 @@ class Arguments(NamedTuple): varkw: str | None def getargs(co: CodeType) -> Arguments: ... -def getargspec(func: object) -> ArgSpec: ... + +if sys.version_info < (3, 11): + class ArgSpec(NamedTuple): + args: list[str] + varargs: str | None + keywords: str | None + defaults: tuple[Any, ...] + def getargspec(func: object) -> ArgSpec: ... class FullArgSpec(NamedTuple): args: list[str] varargs: str | None varkw: str | None - defaults: Tuple[Any, ...] | None + defaults: tuple[Any, ...] | None kwonlyargs: list[str] kwonlydefaults: dict[str, Any] | None annotations: dict[str, Any] @@ -244,61 +438,108 @@ class ArgInfo(NamedTuple): def getargvalues(frame: FrameType) -> ArgInfo: ... def formatannotation(annotation: object, base_module: str | None = ...) -> str: ... def formatannotationrelativeto(object: object) -> Callable[[object], str]: ... -def formatargspec( - args: list[str], - varargs: str | None = ..., - varkw: str | None = ..., - defaults: Tuple[Any, ...] | None = ..., - kwonlyargs: Sequence[str] | None = ..., - kwonlydefaults: dict[str, Any] | None = ..., - annotations: dict[str, Any] = ..., - formatarg: Callable[[str], str] = ..., - formatvarargs: Callable[[str], str] = ..., - formatvarkw: Callable[[str], str] = ..., - formatvalue: Callable[[Any], str] = ..., - formatreturns: Callable[[Any], str] = ..., - formatannotation: Callable[[Any], str] = ..., -) -> str: ... + +if sys.version_info < (3, 11): + def formatargspec( + args: list[str], + varargs: str | None = ..., + varkw: str | None = ..., + defaults: tuple[Any, ...] | None = ..., + kwonlyargs: Sequence[str] | None = ..., + kwonlydefaults: Mapping[str, Any] | None = ..., + annotations: Mapping[str, Any] = ..., + formatarg: Callable[[str], str] = ..., + formatvarargs: Callable[[str], str] = ..., + formatvarkw: Callable[[str], str] = ..., + formatvalue: Callable[[Any], str] = ..., + formatreturns: Callable[[Any], str] = ..., + formatannotation: Callable[[Any], str] = ..., + ) -> str: ... + def formatargvalues( args: list[str], varargs: str | None, varkw: str | None, - locals: dict[str, Any] | None, + locals: Mapping[str, Any] | None, formatarg: Callable[[str], str] | None = ..., formatvarargs: Callable[[str], str] | None = ..., formatvarkw: Callable[[str], str] | None = ..., formatvalue: Callable[[Any], str] | None = ..., ) -> str: ... -def getmro(cls: type) -> Tuple[type, ...]: ... -def getcallargs(__func: Callable[..., Any], *args: Any, **kwds: Any) -> dict[str, Any]: ... +def getmro(cls: type) -> tuple[type, ...]: ... +def getcallargs(__func: Callable[_P, Any], *args: _P.args, **kwds: _P.kwargs) -> dict[str, Any]: ... class ClosureVars(NamedTuple): nonlocals: Mapping[str, Any] globals: Mapping[str, Any] builtins: Mapping[str, Any] - unbound: Set[str] + unbound: AbstractSet[str] -def getclosurevars(func: Callable[..., Any]) -> ClosureVars: ... -def unwrap(func: Callable[..., Any], *, stop: Callable[[Any], Any] | None = ...) -> Any: ... +def getclosurevars(func: _IntrospectableCallable) -> ClosureVars: ... +def unwrap(func: Callable[..., Any], *, stop: Callable[[Callable[..., Any]], Any] | None = ...) -> Any: ... # # The interpreter stack # -class Traceback(NamedTuple): - filename: str - lineno: int - function: str - code_context: list[str] | None - index: int | None # type: ignore - -class FrameInfo(NamedTuple): - frame: FrameType - filename: str - lineno: int - function: str - code_context: list[str] | None - index: int | None # type: ignore +if sys.version_info >= (3, 11): + class _Traceback(NamedTuple): + filename: str + lineno: int + function: str + code_context: list[str] | None + index: int | None # type: ignore[assignment] + + class Traceback(_Traceback): + positions: dis.Positions | None + def __new__( + cls: type[Self], + filename: str, + lineno: int, + function: str, + code_context: list[str] | None, + index: int | None, + *, + positions: dis.Positions | None = ..., + ) -> Self: ... + + class _FrameInfo(NamedTuple): + frame: FrameType + filename: str + lineno: int + function: str + code_context: list[str] | None + index: int | None # type: ignore[assignment] + + class FrameInfo(_FrameInfo): + positions: dis.Positions | None + def __new__( + cls: type[Self], + frame: FrameType, + filename: str, + lineno: int, + function: str, + code_context: list[str] | None, + index: int | None, + *, + positions: dis.Positions | None = ..., + ) -> Self: ... + +else: + class Traceback(NamedTuple): + filename: str + lineno: int + function: str + code_context: list[str] | None + index: int | None # type: ignore[assignment] + + class FrameInfo(NamedTuple): + frame: FrameType + filename: str + lineno: int + function: str + code_context: list[str] | None + index: int | None # type: ignore[assignment] def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ... def getouterframes(frame: Any, context: int = ...) -> list[FrameInfo]: ... @@ -318,30 +559,29 @@ def getattr_static(obj: object, attr: str, default: Any | None = ...) -> Any: .. # Current State of Generators and Coroutines # -# TODO In the next two blocks of code, can we be more specific regarding the -# type of the "enums"? +GEN_CREATED: Literal["GEN_CREATED"] +GEN_RUNNING: Literal["GEN_RUNNING"] +GEN_SUSPENDED: Literal["GEN_SUSPENDED"] +GEN_CLOSED: Literal["GEN_CLOSED"] -GEN_CREATED: str -GEN_RUNNING: str -GEN_SUSPENDED: str -GEN_CLOSED: str +def getgeneratorstate( + generator: Generator[Any, Any, Any] +) -> Literal["GEN_CREATED", "GEN_RUNNING", "GEN_SUSPENDED", "GEN_CLOSED"]: ... -def getgeneratorstate(generator: Generator[Any, Any, Any]) -> str: ... +CORO_CREATED: Literal["CORO_CREATED"] +CORO_RUNNING: Literal["CORO_RUNNING"] +CORO_SUSPENDED: Literal["CORO_SUSPENDED"] +CORO_CLOSED: Literal["CORO_CLOSED"] -CORO_CREATED: str -CORO_RUNNING: str -CORO_SUSPENDED: str -CORO_CLOSED: str -# TODO can we be more specific than "object"? -def getcoroutinestate(coroutine: object) -> str: ... +def getcoroutinestate( + coroutine: Coroutine[Any, Any, Any] +) -> Literal["CORO_CREATED", "CORO_RUNNING", "CORO_SUSPENDED", "CORO_CLOSED"]: ... def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> dict[str, Any]: ... - -# TODO can we be more specific than "object"? -def getcoroutinelocals(coroutine: object) -> dict[str, Any]: ... +def getcoroutinelocals(coroutine: Coroutine[Any, Any, Any]) -> dict[str, Any]: ... # Create private type alias to avoid conflict with symbol of same # name created in Attribute class. -_Object = object +_Object: TypeAlias = object class Attribute(NamedTuple): name: str diff --git a/stdlib/io.pyi b/stdlib/io.pyi index 6342907..9c4c769 100644 --- a/stdlib/io.pyi +++ b/stdlib/io.pyi @@ -1,16 +1,43 @@ +import abc import builtins import codecs import sys from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer +from collections.abc import Callable, Iterable, Iterator from os import _Opener from types import TracebackType -from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, TextIO, Tuple, Type +from typing import IO, Any, BinaryIO, TextIO +from typing_extensions import Literal + +__all__ = [ + "BlockingIOError", + "open", + "IOBase", + "RawIOBase", + "FileIO", + "BytesIO", + "StringIO", + "BufferedIOBase", + "BufferedReader", + "BufferedWriter", + "BufferedRWPair", + "BufferedRandom", + "TextIOBase", + "TextIOWrapper", + "UnsupportedOperation", + "SEEK_SET", + "SEEK_CUR", + "SEEK_END", +] -DEFAULT_BUFFER_SIZE: int +if sys.version_info >= (3, 8): + __all__ += ["open_code"] + +DEFAULT_BUFFER_SIZE: Literal[8192] -SEEK_SET: int -SEEK_CUR: int -SEEK_END: int +SEEK_SET: Literal[0] +SEEK_CUR: Literal[1] +SEEK_END: Literal[2] open = builtins.open @@ -21,13 +48,13 @@ BlockingIOError = builtins.BlockingIOError class UnsupportedOperation(OSError, ValueError): ... -class IOBase: +class IOBase(metaclass=abc.ABCMeta): def __iter__(self) -> Iterator[bytes]: ... def __next__(self) -> bytes: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... @@ -65,7 +92,7 @@ class BufferedIOBase(IOBase): class FileIO(RawIOBase, BinaryIO): mode: str - name: StrOrBytesPath | int # type: ignore + name: StrOrBytesPath | int # type: ignore[assignment] def __init__( self, file: StrOrBytesPath | int, mode: str = ..., closefd: bool = ..., opener: _Opener | None = ... ) -> None: ... @@ -76,7 +103,7 @@ class FileIO(RawIOBase, BinaryIO): def __enter__(self: Self) -> Self: ... class BytesIO(BufferedIOBase, BinaryIO): - def __init__(self, initial_bytes: bytes = ...) -> None: ... + def __init__(self, initial_bytes: ReadableBuffer = ...) -> None: ... # BytesIO does not contain a "name" field. This workaround is necessary # to allow BytesIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. @@ -84,19 +111,12 @@ class BytesIO(BufferedIOBase, BinaryIO): def __enter__(self: Self) -> Self: ... def getvalue(self) -> bytes: ... def getbuffer(self) -> memoryview: ... - if sys.version_info >= (3, 7): - def read1(self, __size: int | None = ...) -> bytes: ... - else: - def read1(self, __size: int | None) -> bytes: ... # type: ignore + def read1(self, __size: int | None = ...) -> bytes: ... class BufferedReader(BufferedIOBase, BinaryIO): def __enter__(self: Self) -> Self: ... def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ... def peek(self, __size: int = ...) -> bytes: ... - if sys.version_info >= (3, 7): - def read1(self, __size: int = ...) -> bytes: ... - else: - def read1(self, __size: int) -> bytes: ... # type: ignore class BufferedWriter(BufferedIOBase, BinaryIO): def __enter__(self: Self) -> Self: ... @@ -105,12 +125,7 @@ class BufferedWriter(BufferedIOBase, BinaryIO): class BufferedRandom(BufferedReader, BufferedWriter): def __enter__(self: Self) -> Self: ... - def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ... - def seek(self, __target: int, __whence: int = ...) -> int: ... - if sys.version_info >= (3, 7): - def read1(self, __size: int = ...) -> bytes: ... - else: - def read1(self, __size: int) -> bytes: ... # type: ignore + def seek(self, __target: int, __whence: int = ...) -> int: ... # stubtest needs this class BufferedRWPair(BufferedIOBase): def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = ...) -> None: ... @@ -119,16 +134,15 @@ class BufferedRWPair(BufferedIOBase): class TextIOBase(IOBase): encoding: str errors: str | None - newlines: str | Tuple[str, ...] | None - def __iter__(self) -> Iterator[str]: ... # type: ignore - def __next__(self) -> str: ... # type: ignore + newlines: str | tuple[str, ...] | None + def __iter__(self) -> Iterator[str]: ... # type: ignore[override] + def __next__(self) -> str: ... # type: ignore[override] def detach(self) -> BinaryIO: ... def write(self, __s: str) -> int: ... - def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore - def readline(self, __size: int = ...) -> str: ... # type: ignore - def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore + def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override] + def readline(self, __size: int = ...) -> str: ... # type: ignore[override] + def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore[override] def read(self, __size: int | None = ...) -> str: ... - def tell(self) -> int: ... class TextIOWrapper(TextIOBase, TextIO): def __init__( @@ -146,26 +160,25 @@ class TextIOWrapper(TextIOBase, TextIO): def closed(self) -> bool: ... @property def line_buffering(self) -> bool: ... - if sys.version_info >= (3, 7): - @property - def write_through(self) -> bool: ... - def reconfigure( - self, - *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., - line_buffering: bool | None = ..., - write_through: bool | None = ..., - ) -> None: ... + @property + def write_through(self) -> bool: ... + def reconfigure( + self, + *, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., + line_buffering: bool | None = ..., + write_through: bool | None = ..., + ) -> None: ... # These are inherited from TextIOBase, but must exist in the stub to satisfy mypy. def __enter__(self: Self) -> Self: ... - def __iter__(self) -> Iterator[str]: ... # type: ignore - def __next__(self) -> str: ... # type: ignore - def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore - def readline(self, __size: int = ...) -> str: ... # type: ignore - def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore - def seek(self, __cookie: int, __whence: int = ...) -> int: ... + def __iter__(self) -> Iterator[str]: ... # type: ignore[override] + def __next__(self) -> str: ... # type: ignore[override] + def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override] + def readline(self, __size: int = ...) -> str: ... # type: ignore[override] + def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore[override] + def seek(self, __cookie: int, __whence: int = ...) -> int: ... # stubtest needs this class StringIO(TextIOWrapper): def __init__(self, initial_value: str | None = ..., newline: str | None = ...) -> None: ... @@ -177,6 +190,7 @@ class StringIO(TextIOWrapper): class IncrementalNewlineDecoder(codecs.IncrementalDecoder): def __init__(self, decoder: codecs.IncrementalDecoder | None, translate: bool, errors: str = ...) -> None: ... - def decode(self, input: bytes | str, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer | str, final: bool = ...) -> str: ... @property - def newlines(self) -> str | Tuple[str, ...] | None: ... + def newlines(self) -> str | tuple[str, ...] | None: ... + def setstate(self, __state: tuple[bytes, int]) -> None: ... diff --git a/stdlib/ipaddress.pyi b/stdlib/ipaddress.pyi index 710ad27..2c0292d 100644 --- a/stdlib/ipaddress.pyi +++ b/stdlib/ipaddress.pyi @@ -1,25 +1,26 @@ import sys -from typing import Any, Container, Generic, Iterable, Iterator, SupportsInt, Tuple, TypeVar, overload +from _typeshed import Self +from collections.abc import Container, Iterable, Iterator +from typing import Any, Generic, SupportsInt, TypeVar, overload +from typing_extensions import Literal, TypeAlias # Undocumented length constants -IPV4LENGTH: int -IPV6LENGTH: int +IPV4LENGTH: Literal[32] +IPV6LENGTH: Literal[128] _A = TypeVar("_A", IPv4Address, IPv6Address) _N = TypeVar("_N", IPv4Network, IPv6Network) -_T = TypeVar("_T") -def ip_address(address: object) -> Any: ... # morally IPv4Address | IPv6Address -def ip_network(address: object, strict: bool = ...) -> Any: ... # morally IPv4Network | IPv6Network -def ip_interface(address: object) -> Any: ... # morally IPv4Interface | IPv6Interface +_RawIPAddress: TypeAlias = int | str | bytes | IPv4Address | IPv6Address +_RawNetworkPart: TypeAlias = IPv4Network | IPv6Network | IPv4Interface | IPv6Interface + +def ip_address(address: _RawIPAddress) -> IPv4Address | IPv6Address: ... +def ip_network( + address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int], strict: bool = ... +) -> IPv4Network | IPv6Network: ... +def ip_interface(address: _RawIPAddress | _RawNetworkPart) -> IPv4Interface | IPv6Interface: ... class _IPAddressBase: - def __eq__(self, other: Any) -> bool: ... - def __ge__(self: _T, other: _T) -> bool: ... - def __gt__(self: _T, other: _T) -> bool: ... - def __le__(self: _T, other: _T) -> bool: ... - def __lt__(self: _T, other: _T) -> bool: ... - def __ne__(self, other: Any) -> bool: ... @property def compressed(self) -> str: ... @property @@ -31,10 +32,21 @@ class _IPAddressBase: class _BaseAddress(_IPAddressBase, SupportsInt): def __init__(self, address: object) -> None: ... - def __add__(self: _T, other: int) -> _T: ... - def __hash__(self) -> int: ... + def __add__(self: Self, other: int) -> Self: ... def __int__(self) -> int: ... - def __sub__(self: _T, other: int) -> _T: ... + def __sub__(self: Self, other: int) -> Self: ... + def __format__(self, fmt: str) -> str: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self: Self, other: Self) -> bool: ... + if sys.version_info >= (3, 11): + def __ge__(self: Self, other: Self) -> bool: ... + def __gt__(self: Self, other: Self) -> bool: ... + def __le__(self: Self, other: Self) -> bool: ... + else: + def __ge__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ... + def __gt__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ... + def __le__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ... + @property def is_global(self) -> bool: ... @property @@ -61,10 +73,21 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]): def __contains__(self, other: Any) -> bool: ... def __getitem__(self, n: int) -> _A: ... def __iter__(self) -> Iterator[_A]: ... - def address_exclude(self: _T, other: _T) -> Iterator[_T]: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self: Self, other: Self) -> bool: ... + if sys.version_info >= (3, 11): + def __ge__(self: Self, other: Self) -> bool: ... + def __gt__(self: Self, other: Self) -> bool: ... + def __le__(self: Self, other: Self) -> bool: ... + else: + def __ge__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ... + def __gt__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ... + def __le__(self: Self, other: Self, NotImplemented: Any = ...) -> bool: ... + + def address_exclude(self: Self, other: Self) -> Iterator[Self]: ... @property def broadcast_address(self) -> _A: ... - def compare_networks(self: _T, other: _T) -> int: ... + def compare_networks(self: Self, other: Self) -> int: ... def hosts(self) -> Iterator[_A]: ... @property def is_global(self) -> bool: ... @@ -84,14 +107,13 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]): def max_prefixlen(self) -> int: ... @property def num_addresses(self) -> int: ... - def overlaps(self, other: _BaseNetwork[_A]) -> bool: ... + def overlaps(self, other: _BaseNetwork[IPv4Address] | _BaseNetwork[IPv6Address]) -> bool: ... @property def prefixlen(self) -> int: ... - if sys.version_info >= (3, 7): - def subnet_of(self: _T, other: _T) -> bool: ... - def supernet_of(self: _T, other: _T) -> bool: ... - def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: int | None = ...) -> Iterator[_T]: ... - def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: int | None = ...) -> _T: ... + def subnet_of(self: Self, other: Self) -> bool: ... + def supernet_of(self: Self, other: Self) -> bool: ... + def subnets(self: Self, prefixlen_diff: int = ..., new_prefix: int | None = ...) -> Iterator[Self]: ... + def supernet(self: Self, prefixlen_diff: int = ..., new_prefix: int | None = ...) -> Self: ... @property def with_hostmask(self) -> str: ... @property @@ -114,11 +136,23 @@ class _BaseInterface(_BaseAddress, Generic[_A, _N]): @property def with_prefixlen(self) -> str: ... -class IPv4Address(_BaseAddress): ... -class IPv4Network(_BaseNetwork[IPv4Address]): ... +class _BaseV4: + @property + def version(self) -> Literal[4]: ... + @property + def max_prefixlen(self) -> Literal[32]: ... + +class IPv4Address(_BaseV4, _BaseAddress): ... +class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): ... class IPv4Interface(IPv4Address, _BaseInterface[IPv4Address, IPv4Network]): ... -class IPv6Address(_BaseAddress): +class _BaseV6: + @property + def version(self) -> Literal[6]: ... + @property + def max_prefixlen(self) -> Literal[128]: ... + +class IPv6Address(_BaseV6, _BaseAddress): @property def ipv4_mapped(self) -> IPv4Address | None: ... @property @@ -126,9 +160,12 @@ class IPv6Address(_BaseAddress): @property def sixtofour(self) -> IPv4Address | None: ... @property - def teredo(self) -> Tuple[IPv4Address, IPv4Address] | None: ... + def teredo(self) -> tuple[IPv4Address, IPv4Address] | None: ... + if sys.version_info >= (3, 9): + @property + def scope_id(self) -> str | None: ... -class IPv6Network(_BaseNetwork[IPv6Address]): +class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]): @property def is_site_local(self) -> bool: ... @@ -136,17 +173,23 @@ class IPv6Interface(IPv6Address, _BaseInterface[IPv6Address, IPv6Network]): ... def v4_int_to_packed(address: int) -> bytes: ... def v6_int_to_packed(address: int) -> bytes: ... + +# Third overload is technically incorrect, but convenient when first and last are return values of ip_address() @overload def summarize_address_range(first: IPv4Address, last: IPv4Address) -> Iterator[IPv4Network]: ... @overload def summarize_address_range(first: IPv6Address, last: IPv6Address) -> Iterator[IPv6Network]: ... +@overload +def summarize_address_range( + first: IPv4Address | IPv6Address, last: IPv4Address | IPv6Address +) -> Iterator[IPv4Network] | Iterator[IPv6Network]: ... def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: ... @overload -def get_mixed_type_key(obj: _A) -> Tuple[int, _A]: ... +def get_mixed_type_key(obj: _A) -> tuple[int, _A]: ... @overload -def get_mixed_type_key(obj: IPv4Network) -> Tuple[int, IPv4Address, IPv4Address]: ... +def get_mixed_type_key(obj: IPv4Network) -> tuple[int, IPv4Address, IPv4Address]: ... @overload -def get_mixed_type_key(obj: IPv6Network) -> Tuple[int, IPv6Address, IPv6Address]: ... +def get_mixed_type_key(obj: IPv6Network) -> tuple[int, IPv6Address, IPv6Address]: ... class AddressValueError(ValueError): ... class NetmaskValueError(ValueError): ... diff --git a/stdlib/itertools.pyi b/stdlib/itertools.pyi index 4ffa181..7299ee8 100644 --- a/stdlib/itertools.pyi +++ b/stdlib/itertools.pyi @@ -1,28 +1,26 @@ import sys -from _typeshed import _T_co -from typing import ( - Any, - Callable, - Generic, - Iterable, - Iterator, - SupportsComplex, - SupportsFloat, - SupportsInt, - Tuple, - Type, - TypeVar, - Union, - overload, -) -from typing_extensions import Literal, SupportsIndex +from _typeshed import Self +from collections.abc import Callable, Iterable, Iterator +from typing import Any, Generic, SupportsComplex, SupportsFloat, SupportsInt, TypeVar, overload +from typing_extensions import Literal, SupportsIndex, TypeAlias + +if sys.version_info >= (3, 9): + from types import GenericAlias _T = TypeVar("_T") _S = TypeVar("_S") _N = TypeVar("_N", int, float, SupportsFloat, SupportsInt, SupportsIndex, SupportsComplex) -_Step = Union[int, float, SupportsFloat, SupportsInt, SupportsIndex, SupportsComplex] +_T_co = TypeVar("_T_co", covariant=True) +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_T4 = TypeVar("_T4") +_T5 = TypeVar("_T5") +_T6 = TypeVar("_T6") -Predicate = Callable[[_T], object] +_Step: TypeAlias = SupportsFloat | SupportsInt | SupportsIndex | SupportsComplex + +_Predicate: TypeAlias = Callable[[_T], object] # Technically count can take anything that implements a number protocol and has an add method # but we can't enforce the add method @@ -34,12 +32,12 @@ class count(Iterator[_N], Generic[_N]): @overload def __new__(cls, *, step: _N) -> count[_N]: ... def __next__(self) -> _N: ... - def __iter__(self) -> Iterator[_N]: ... + def __iter__(self: Self) -> Self: ... class cycle(Iterator[_T], Generic[_T]): def __init__(self, __iterable: Iterable[_T]) -> None: ... def __next__(self) -> _T: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... class repeat(Iterator[_T], Generic[_T]): @overload @@ -47,7 +45,8 @@ class repeat(Iterator[_T], Generic[_T]): @overload def __init__(self, object: _T, times: int) -> None: ... def __next__(self) -> _T: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... + def __length_hint__(self) -> int: ... class accumulate(Iterator[_T], Generic[_T]): if sys.version_info >= (3, 8): @@ -57,84 +56,154 @@ class accumulate(Iterator[_T], Generic[_T]): def __init__(self, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> None: ... else: def __init__(self, iterable: Iterable[_T], func: Callable[[_T, _T], _T] | None = ...) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... class chain(Iterator[_T], Generic[_T]): def __init__(self, *iterables: Iterable[_T]) -> None: ... def __next__(self) -> _T: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... @classmethod - # We use Type and not Type[_S] to not lose the type inference from __iterable - def from_iterable(cls: Type[Any], __iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ... + # We use type[Any] and not type[_S] to not lose the type inference from __iterable + def from_iterable(cls: type[Any], __iterable: Iterable[Iterable[_S]]) -> chain[_S]: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... class compress(Iterator[_T], Generic[_T]): def __init__(self, data: Iterable[_T], selectors: Iterable[Any]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... class dropwhile(Iterator[_T], Generic[_T]): - def __init__(self, __predicate: Predicate[_T], __iterable: Iterable[_T]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __init__(self, __predicate: _Predicate[_T], __iterable: Iterable[_T]) -> None: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... class filterfalse(Iterator[_T], Generic[_T]): - def __init__(self, __predicate: Predicate[_T] | None, __iterable: Iterable[_T]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __init__(self, __predicate: _Predicate[_T] | None, __iterable: Iterable[_T]) -> None: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... -_T1 = TypeVar("_T1") -_T2 = TypeVar("_T2") - -class groupby(Iterator[Tuple[_T, Iterator[_S]]], Generic[_T, _S]): +class groupby(Iterator[tuple[_T, Iterator[_S]]], Generic[_T, _S]): @overload def __new__(cls, iterable: Iterable[_T1], key: None = ...) -> groupby[_T1, _T1]: ... @overload def __new__(cls, iterable: Iterable[_T1], key: Callable[[_T1], _T2]) -> groupby[_T2, _T1]: ... - def __iter__(self) -> Iterator[Tuple[_T, Iterator[_S]]]: ... - def __next__(self) -> Tuple[_T, Iterator[_S]]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> tuple[_T, Iterator[_S]]: ... class islice(Iterator[_T], Generic[_T]): @overload def __init__(self, __iterable: Iterable[_T], __stop: int | None) -> None: ... @overload def __init__(self, __iterable: Iterable[_T], __start: int | None, __stop: int | None, __step: int | None = ...) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... class starmap(Iterator[_T], Generic[_T]): def __init__(self, __function: Callable[..., _T], __iterable: Iterable[Iterable[Any]]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... class takewhile(Iterator[_T], Generic[_T]): - def __init__(self, __predicate: Predicate[_T], __iterable: Iterable[_T]) -> None: ... - def __iter__(self) -> Iterator[_T]: ... + def __init__(self, __predicate: _Predicate[_T], __iterable: Iterable[_T]) -> None: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T: ... -def tee(__iterable: Iterable[_T], __n: int = ...) -> Tuple[Iterator[_T], ...]: ... - -class zip_longest(Iterator[Any]): - def __init__(self, *p: Iterable[Any], fillvalue: Any = ...) -> None: ... - def __iter__(self) -> Iterator[Any]: ... - def __next__(self) -> Any: ... +def tee(__iterable: Iterable[_T], __n: int = ...) -> tuple[Iterator[_T], ...]: ... -_T3 = TypeVar("_T3") -_T4 = TypeVar("_T4") -_T5 = TypeVar("_T5") -_T6 = TypeVar("_T6") +class zip_longest(Iterator[_T_co], Generic[_T_co]): + # one iterable (fillvalue doesn't matter) + @overload + def __new__(cls, __iter1: Iterable[_T1], *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ... + # two iterables + @overload + # In the overloads without fillvalue, all of the tuple members could theoretically be None, + # but we return Any instead to avoid false positives for code where we know one of the iterables + # is longer. + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> zip_longest[tuple[_T1 | Any, _T2 | Any]]: ... + @overload + def __new__( + cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], *, fillvalue: _T + ) -> zip_longest[tuple[_T1 | _T, _T2 | _T]]: ... + # three iterables + @overload + def __new__( + cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> zip_longest[tuple[_T1 | Any, _T2 | Any, _T3 | Any]]: ... + @overload + def __new__( + cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], *, fillvalue: _T + ) -> zip_longest[tuple[_T1 | _T, _T2 | _T, _T3 | _T]]: ... + # four iterables + @overload + def __new__( + cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> zip_longest[tuple[_T1 | Any, _T2 | Any, _T3 | Any, _T4 | Any]]: ... + @overload + def __new__( + cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], *, fillvalue: _T + ) -> zip_longest[tuple[_T1 | _T, _T2 | _T, _T3 | _T, _T4 | _T]]: ... + # five iterables + @overload + def __new__( + cls, + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> zip_longest[tuple[_T1 | Any, _T2 | Any, _T3 | Any, _T4 | Any, _T5 | Any]]: ... + @overload + def __new__( + cls, + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + *, + fillvalue: _T, + ) -> zip_longest[tuple[_T1 | _T, _T2 | _T, _T3 | _T, _T4 | _T, _T5 | _T]]: ... + # six or more iterables + @overload + def __new__( + cls, + __iter1: Iterable[_T], + __iter2: Iterable[_T], + __iter3: Iterable[_T], + __iter4: Iterable[_T], + __iter5: Iterable[_T], + __iter6: Iterable[_T], + *iterables: Iterable[_T], + ) -> zip_longest[tuple[_T | Any, ...]]: ... + @overload + def __new__( + cls, + __iter1: Iterable[_T], + __iter2: Iterable[_T], + __iter3: Iterable[_T], + __iter4: Iterable[_T], + __iter5: Iterable[_T], + __iter6: Iterable[_T], + *iterables: Iterable[_T], + fillvalue: _T, + ) -> zip_longest[tuple[_T, ...]]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> _T_co: ... class product(Iterator[_T_co], Generic[_T_co]): @overload - def __new__(cls, __iter1: Iterable[_T1]) -> product[Tuple[_T1]]: ... + def __new__(cls, __iter1: Iterable[_T1]) -> product[tuple[_T1]]: ... @overload - def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> product[Tuple[_T1, _T2]]: ... + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> product[tuple[_T1, _T2]]: ... @overload - def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> product[Tuple[_T1, _T2, _T3]]: ... + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> product[tuple[_T1, _T2, _T3]]: ... @overload def __new__( cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] - ) -> product[Tuple[_T1, _T2, _T3, _T4]]: ... + ) -> product[tuple[_T1, _T2, _T3, _T4]]: ... @overload def __new__( cls, @@ -143,7 +212,7 @@ class product(Iterator[_T_co], Generic[_T_co]): __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5], - ) -> product[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + ) -> product[tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload def __new__( cls, @@ -153,7 +222,7 @@ class product(Iterator[_T_co], Generic[_T_co]): __iter4: Iterable[_T4], __iter5: Iterable[_T5], __iter6: Iterable[_T6], - ) -> product[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... + ) -> product[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... @overload def __new__( cls, @@ -165,40 +234,40 @@ class product(Iterator[_T_co], Generic[_T_co]): __iter6: Iterable[Any], __iter7: Iterable[Any], *iterables: Iterable[Any], - ) -> product[Tuple[Any, ...]]: ... + ) -> product[tuple[Any, ...]]: ... @overload - def __new__(cls, *iterables: Iterable[_T1], repeat: int) -> product[Tuple[_T1, ...]]: ... + def __new__(cls, *iterables: Iterable[_T1], repeat: int) -> product[tuple[_T1, ...]]: ... @overload - def __new__(cls, *iterables: Iterable[Any], repeat: int = ...) -> product[Tuple[Any, ...]]: ... - def __iter__(self) -> Iterator[_T_co]: ... + def __new__(cls, *iterables: Iterable[Any], repeat: int = ...) -> product[tuple[Any, ...]]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T_co: ... -class permutations(Iterator[Tuple[_T, ...]], Generic[_T]): +class permutations(Iterator[tuple[_T, ...]], Generic[_T]): def __init__(self, iterable: Iterable[_T], r: int | None = ...) -> None: ... - def __iter__(self) -> Iterator[Tuple[_T, ...]]: ... - def __next__(self) -> Tuple[_T, ...]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> tuple[_T, ...]: ... class combinations(Iterator[_T_co], Generic[_T_co]): @overload - def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations[Tuple[_T, _T]]: ... + def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations[tuple[_T, _T]]: ... @overload - def __new__(cls, iterable: Iterable[_T], r: Literal[3]) -> combinations[Tuple[_T, _T, _T]]: ... + def __new__(cls, iterable: Iterable[_T], r: Literal[3]) -> combinations[tuple[_T, _T, _T]]: ... @overload - def __new__(cls, iterable: Iterable[_T], r: Literal[4]) -> combinations[Tuple[_T, _T, _T, _T]]: ... + def __new__(cls, iterable: Iterable[_T], r: Literal[4]) -> combinations[tuple[_T, _T, _T, _T]]: ... @overload - def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> combinations[Tuple[_T, _T, _T, _T, _T]]: ... + def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> combinations[tuple[_T, _T, _T, _T, _T]]: ... @overload - def __new__(cls, iterable: Iterable[_T], r: int) -> combinations[Tuple[_T, ...]]: ... - def __iter__(self) -> Iterator[_T_co]: ... + def __new__(cls, iterable: Iterable[_T], r: int) -> combinations[tuple[_T, ...]]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T_co: ... -class combinations_with_replacement(Iterator[Tuple[_T, ...]], Generic[_T]): +class combinations_with_replacement(Iterator[tuple[_T, ...]], Generic[_T]): def __init__(self, iterable: Iterable[_T], r: int) -> None: ... - def __iter__(self) -> Iterator[Tuple[_T, ...]]: ... - def __next__(self) -> Tuple[_T, ...]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> tuple[_T, ...]: ... if sys.version_info >= (3, 10): class pairwise(Iterator[_T_co], Generic[_T_co]): - def __new__(cls, __iterable: Iterable[_T]) -> pairwise[Tuple[_T, _T]]: ... - def __iter__(self) -> Iterator[_T_co]: ... + def __new__(cls, __iterable: Iterable[_T]) -> pairwise[tuple[_T, _T]]: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> _T_co: ... diff --git a/stdlib/json/__init__.pyi b/stdlib/json/__init__.pyi index e37e68c..64ab8a1 100644 --- a/stdlib/json/__init__.pyi +++ b/stdlib/json/__init__.pyi @@ -1,9 +1,12 @@ from _typeshed import SupportsRead -from typing import IO, Any, Callable, Tuple, Type +from collections.abc import Callable +from typing import IO, Any from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder from .encoder import JSONEncoder as JSONEncoder +__all__ = ["dump", "dumps", "load", "loads", "JSONDecoder", "JSONDecodeError", "JSONEncoder"] + def dumps( obj: Any, *, @@ -11,9 +14,9 @@ def dumps( ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Type[JSONEncoder] | None = ..., + cls: type[JSONEncoder] | None = ..., indent: None | int | str = ..., - separators: Tuple[str, str] | None = ..., + separators: tuple[str, str] | None = ..., default: Callable[[Any], Any] | None = ..., sort_keys: bool = ..., **kwds: Any, @@ -26,33 +29,33 @@ def dump( ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Type[JSONEncoder] | None = ..., + cls: type[JSONEncoder] | None = ..., indent: None | int | str = ..., - separators: Tuple[str, str] | None = ..., + separators: tuple[str, str] | None = ..., default: Callable[[Any], Any] | None = ..., sort_keys: bool = ..., **kwds: Any, ) -> None: ... def loads( - s: str | bytes, + s: str | bytes | bytearray, *, - cls: Type[JSONDecoder] | None = ..., + cls: type[JSONDecoder] | None = ..., object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[list[Tuple[Any, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ..., **kwds: Any, ) -> Any: ... def load( fp: SupportsRead[str | bytes], *, - cls: Type[JSONDecoder] | None = ..., + cls: type[JSONDecoder] | None = ..., object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[list[Tuple[Any, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ..., **kwds: Any, ) -> Any: ... -def detect_encoding(b: bytes) -> str: ... # undocumented +def detect_encoding(b: bytes | bytearray) -> str: ... # undocumented diff --git a/stdlib/json/decoder.pyi b/stdlib/json/decoder.pyi index 5135eb4..2060cf1 100644 --- a/stdlib/json/decoder.pyi +++ b/stdlib/json/decoder.pyi @@ -1,4 +1,7 @@ -from typing import Any, Callable, Tuple +from collections.abc import Callable +from typing import Any + +__all__ = ["JSONDecoder", "JSONDecodeError"] class JSONDecodeError(ValueError): msg: str @@ -14,7 +17,7 @@ class JSONDecoder: parse_int: Callable[[str], Any] parse_constant: Callable[[str], Any] strict: bool - object_pairs_hook: Callable[[list[Tuple[str, Any]]], Any] + object_pairs_hook: Callable[[list[tuple[str, Any]]], Any] def __init__( self, *, @@ -23,7 +26,7 @@ class JSONDecoder: parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., strict: bool = ..., - object_pairs_hook: Callable[[list[Tuple[str, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[tuple[str, Any]]], Any] | None = ..., ) -> None: ... def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: ... # _w is undocumented - def raw_decode(self, s: str, idx: int = ...) -> Tuple[Any, int]: ... + def raw_decode(self, s: str, idx: int = ...) -> tuple[Any, int]: ... diff --git a/stdlib/json/encoder.pyi b/stdlib/json/encoder.pyi index 36113ed..60e8206 100644 --- a/stdlib/json/encoder.pyi +++ b/stdlib/json/encoder.pyi @@ -1,4 +1,12 @@ -from typing import Any, Callable, Iterator, Tuple +from collections.abc import Callable, Iterator +from re import Pattern +from typing import Any + +ESCAPE: Pattern[str] +ESCAPE_ASCII: Pattern[str] +HAS_UTF8: Pattern[bytes] +ESCAPE_DCT: dict[str, str] +INFINITY: float def py_encode_basestring(s: str) -> str: ... # undocumented def py_encode_basestring_ascii(s: str) -> str: ... # undocumented @@ -22,7 +30,7 @@ class JSONEncoder: allow_nan: bool = ..., sort_keys: bool = ..., indent: int | None = ..., - separators: Tuple[str, str] | None = ..., + separators: tuple[str, str] | None = ..., default: Callable[..., Any] | None = ..., ) -> None: ... def default(self, o: Any) -> Any: ... diff --git a/stdlib/keyword.pyi b/stdlib/keyword.pyi index ac052fe..c17c580 100644 --- a/stdlib/keyword.pyi +++ b/stdlib/keyword.pyi @@ -1,5 +1,10 @@ import sys -from typing import Sequence +from collections.abc import Sequence + +if sys.version_info >= (3, 9): + __all__ = ["iskeyword", "issoftkeyword", "kwlist", "softkwlist"] +else: + __all__ = ["iskeyword", "kwlist"] def iskeyword(s: str) -> bool: ... diff --git a/stdlib/lib2to3/pgen2/__init__.pyi b/stdlib/lib2to3/pgen2/__init__.pyi index e69de29..acc1cc4 100644 --- a/stdlib/lib2to3/pgen2/__init__.pyi +++ b/stdlib/lib2to3/pgen2/__init__.pyi @@ -0,0 +1,8 @@ +from collections.abc import Callable +from lib2to3.pgen2.grammar import Grammar +from lib2to3.pytree import _RawNode +from typing import Any +from typing_extensions import TypeAlias + +# This is imported in several lib2to3/pgen2 submodules +_Convert: TypeAlias = Callable[[Grammar, _RawNode], Any] # noqa: Y047 diff --git a/stdlib/lib2to3/pgen2/driver.pyi b/stdlib/lib2to3/pgen2/driver.pyi index a8159dc..45c9aea 100644 --- a/stdlib/lib2to3/pgen2/driver.pyi +++ b/stdlib/lib2to3/pgen2/driver.pyi @@ -1,8 +1,12 @@ from _typeshed import StrPath +from collections.abc import Iterable +from lib2to3.pgen2 import _Convert from lib2to3.pgen2.grammar import Grammar -from lib2to3.pytree import _NL, _Convert +from lib2to3.pytree import _NL from logging import Logger -from typing import IO, Any, Iterable +from typing import IO, Any + +__all__ = ["Driver", "load_grammar"] class Driver: grammar: Grammar diff --git a/stdlib/lib2to3/pgen2/grammar.pyi b/stdlib/lib2to3/pgen2/grammar.pyi index 48cb4ea..aa0dd68 100644 --- a/stdlib/lib2to3/pgen2/grammar.pyi +++ b/stdlib/lib2to3/pgen2/grammar.pyi @@ -1,10 +1,9 @@ -from _typeshed import StrPath -from typing import Dict, List, Optional, Tuple, TypeVar +from _typeshed import Self, StrPath +from typing_extensions import TypeAlias -_P = TypeVar("_P") -_Label = Tuple[int, Optional[str]] -_DFA = List[List[Tuple[int, int]]] -_DFAS = Tuple[_DFA, Dict[int, int]] +_Label: TypeAlias = tuple[int, str | None] +_DFA: TypeAlias = list[list[tuple[int, int]]] +_DFAS: TypeAlias = tuple[_DFA, dict[int, int]] class Grammar: symbol2number: dict[str, int] @@ -16,10 +15,9 @@ class Grammar: tokens: dict[int, int] symbol2label: dict[str, int] start: int - def __init__(self) -> None: ... def dump(self, filename: StrPath) -> None: ... def load(self, filename: StrPath) -> None: ... - def copy(self: _P) -> _P: ... + def copy(self: Self) -> Self: ... def report(self) -> None: ... opmap_raw: str diff --git a/stdlib/lib2to3/pgen2/literals.pyi b/stdlib/lib2to3/pgen2/literals.pyi index 551ece1..c3fabe8 100644 --- a/stdlib/lib2to3/pgen2/literals.pyi +++ b/stdlib/lib2to3/pgen2/literals.pyi @@ -1,4 +1,4 @@ -from typing import Match +from re import Match simple_escapes: dict[str, str] diff --git a/stdlib/lib2to3/pgen2/parse.pyi b/stdlib/lib2to3/pgen2/parse.pyi index d6e1ec4..6a07c4a 100644 --- a/stdlib/lib2to3/pgen2/parse.pyi +++ b/stdlib/lib2to3/pgen2/parse.pyi @@ -1,8 +1,11 @@ +from collections.abc import Sequence +from lib2to3.pgen2 import _Convert from lib2to3.pgen2.grammar import _DFAS, Grammar -from lib2to3.pytree import _NL, _Convert, _RawNode -from typing import Any, Sequence, Set, Tuple +from lib2to3.pytree import _NL, _RawNode +from typing import Any +from typing_extensions import TypeAlias -_Context = Sequence[Any] +_Context: TypeAlias = Sequence[Any] class ParseError(Exception): msg: str @@ -14,9 +17,9 @@ class ParseError(Exception): class Parser: grammar: Grammar convert: _Convert - stack: list[Tuple[_DFAS, int, _RawNode]] + stack: list[tuple[_DFAS, int, _RawNode]] rootnode: _NL | None - used_names: Set[str] + used_names: set[str] def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ... def setup(self, start: int | None = ...) -> None: ... def addtoken(self, type: int, value: str | None, context: _Context) -> bool: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 87b4a8a..84ee7ae 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -1,7 +1,8 @@ from _typeshed import StrPath +from collections.abc import Iterable, Iterator from lib2to3.pgen2 import grammar from lib2to3.pgen2.tokenize import _TokenInfo -from typing import IO, Any, Iterable, Iterator, NoReturn, Tuple +from typing import IO, Any, NoReturn class PgenGrammar(grammar.Grammar): ... @@ -16,22 +17,21 @@ class ParserGenerator: def make_label(self, c: PgenGrammar, label: str) -> int: ... def addfirstsets(self) -> None: ... def calcfirst(self, name: str) -> None: ... - def parse(self) -> Tuple[dict[str, list[DFAState]], str]: ... + def parse(self) -> tuple[dict[str, list[DFAState]], str]: ... def make_dfa(self, start: NFAState, finish: NFAState) -> list[DFAState]: ... def dump_nfa(self, name: str, start: NFAState, finish: NFAState) -> list[DFAState]: ... def dump_dfa(self, name: str, dfa: Iterable[DFAState]) -> None: ... def simplify_dfa(self, dfa: list[DFAState]) -> None: ... - def parse_rhs(self) -> Tuple[NFAState, NFAState]: ... - def parse_alt(self) -> Tuple[NFAState, NFAState]: ... - def parse_item(self) -> Tuple[NFAState, NFAState]: ... - def parse_atom(self) -> Tuple[NFAState, NFAState]: ... + def parse_rhs(self) -> tuple[NFAState, NFAState]: ... + def parse_alt(self) -> tuple[NFAState, NFAState]: ... + def parse_item(self) -> tuple[NFAState, NFAState]: ... + def parse_atom(self) -> tuple[NFAState, NFAState]: ... def expect(self, type: int, value: Any | None = ...) -> str: ... def gettoken(self) -> None: ... def raise_error(self, msg: str, *args: Any) -> NoReturn: ... class NFAState: - arcs: list[Tuple[str | None, NFAState]] - def __init__(self) -> None: ... + arcs: list[tuple[str | None, NFAState]] def addarc(self, next: NFAState, label: str | None = ...) -> None: ... class DFAState: @@ -41,6 +41,6 @@ class DFAState: def __init__(self, nfaset: dict[NFAState, Any], final: NFAState) -> None: ... def addarc(self, next: DFAState, label: str) -> None: ... def unifystate(self, old: DFAState, new: DFAState) -> None: ... - def __eq__(self, other: Any) -> bool: ... + def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ... diff --git a/stdlib/lib2to3/pgen2/token.pyi b/stdlib/lib2to3/pgen2/token.pyi index c4ab376..debcb21 100644 --- a/stdlib/lib2to3/pgen2/token.pyi +++ b/stdlib/lib2to3/pgen2/token.pyi @@ -57,6 +57,7 @@ ATEQUAL: int AWAIT: int ASYNC: int ERRORTOKEN: int +COLONEQUAL: int N_TOKENS: int NT_OFFSET: int tok_name: dict[int, str] diff --git a/stdlib/lib2to3/pgen2/tokenize.pyi b/stdlib/lib2to3/pgen2/tokenize.pyi index 467fb0d..2a9c3fb 100644 --- a/stdlib/lib2to3/pgen2/tokenize.pyi +++ b/stdlib/lib2to3/pgen2/tokenize.pyi @@ -1,9 +1,82 @@ -from lib2to3.pgen2.token import * # noqa -from typing import Callable, Iterable, Iterator, Tuple +from collections.abc import Callable, Iterable, Iterator +from lib2to3.pgen2.token import * +from typing_extensions import TypeAlias -_Coord = Tuple[int, int] -_TokenEater = Callable[[int, str, _Coord, _Coord, str], None] -_TokenInfo = Tuple[int, str, _Coord, _Coord, str] +__all__ = [ + "AMPER", + "AMPEREQUAL", + "ASYNC", + "AT", + "ATEQUAL", + "AWAIT", + "BACKQUOTE", + "CIRCUMFLEX", + "CIRCUMFLEXEQUAL", + "COLON", + "COMMA", + "COMMENT", + "DEDENT", + "DOT", + "DOUBLESLASH", + "DOUBLESLASHEQUAL", + "DOUBLESTAR", + "DOUBLESTAREQUAL", + "ENDMARKER", + "EQEQUAL", + "EQUAL", + "ERRORTOKEN", + "GREATER", + "GREATEREQUAL", + "INDENT", + "ISEOF", + "ISNONTERMINAL", + "ISTERMINAL", + "LBRACE", + "LEFTSHIFT", + "LEFTSHIFTEQUAL", + "LESS", + "LESSEQUAL", + "LPAR", + "LSQB", + "MINEQUAL", + "MINUS", + "NAME", + "NEWLINE", + "NL", + "NOTEQUAL", + "NT_OFFSET", + "NUMBER", + "N_TOKENS", + "OP", + "PERCENT", + "PERCENTEQUAL", + "PLUS", + "PLUSEQUAL", + "RARROW", + "RBRACE", + "RIGHTSHIFT", + "RIGHTSHIFTEQUAL", + "RPAR", + "RSQB", + "SEMI", + "SLASH", + "SLASHEQUAL", + "STAR", + "STAREQUAL", + "STRING", + "TILDE", + "VBAR", + "VBAREQUAL", + "tok_name", + "tokenize", + "generate_tokens", + "untokenize", + "COLONEQUAL", +] + +_Coord: TypeAlias = tuple[int, int] +_TokenEater: TypeAlias = Callable[[int, str, _Coord, _Coord, str], object] +_TokenInfo: TypeAlias = tuple[int, str, _Coord, _Coord, str] class TokenError(Exception): ... class StopTokenizing(Exception): ... @@ -14,10 +87,9 @@ class Untokenizer: tokens: list[str] prev_row: int prev_col: int - def __init__(self) -> None: ... def add_whitespace(self, start: _Coord) -> None: ... def untokenize(self, iterable: Iterable[_TokenInfo]) -> str: ... - def compat(self, token: Tuple[int, str], iterable: Iterable[_TokenInfo]) -> None: ... + def compat(self, token: tuple[int, str], iterable: Iterable[_TokenInfo]) -> None: ... def untokenize(iterable: Iterable[_TokenInfo]) -> str: ... def generate_tokens(readline: Callable[[], str]) -> Iterator[_TokenInfo]: ... diff --git a/stdlib/lib2to3/pytree.pyi b/stdlib/lib2to3/pytree.pyi index f926e6f..4db9ab9 100644 --- a/stdlib/lib2to3/pytree.pyi +++ b/stdlib/lib2to3/pytree.pyi @@ -1,12 +1,13 @@ +from _typeshed import Self +from collections.abc import Iterator from lib2to3.pgen2.grammar import Grammar -from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, TypeVar, Union +from typing import Any +from typing_extensions import TypeAlias -_P = TypeVar("_P") -_NL = Union[Node, Leaf] -_Context = Tuple[str, int, int] -_Results = Dict[str, _NL] -_RawNode = Tuple[int, str, _Context, Optional[List[_NL]]] -_Convert = Callable[[Grammar, _RawNode], Any] +_NL: TypeAlias = Node | Leaf +_Context: TypeAlias = tuple[str, int, int] +_Results: TypeAlias = dict[str, _NL] +_RawNode: TypeAlias = tuple[int, str, _Context, list[_NL] | None] HUGE: int @@ -19,9 +20,9 @@ class Base: children: list[_NL] was_changed: bool was_checked: bool - def __eq__(self, other: Any) -> bool: ... - def _eq(self: _P, other: _P) -> bool: ... - def clone(self: _P) -> _P: ... + def __eq__(self, other: object) -> bool: ... + def _eq(self: Self, other: Self) -> bool: ... + def clone(self: Self) -> Self: ... def post_order(self) -> Iterator[_NL]: ... def pre_order(self) -> Iterator[_NL]: ... def replace(self, new: _NL | list[_NL]) -> None: ... @@ -49,6 +50,7 @@ class Node(Base): def set_child(self, i: int, child: _NL) -> None: ... def insert_child(self, i: int, child: _NL) -> None: ... def append_child(self, child: _NL) -> None: ... + def __unicode__(self) -> str: ... class Leaf(Base): lineno: int @@ -58,6 +60,7 @@ class Leaf(Base): def __init__( self, type: int, value: str, context: _Context | None = ..., prefix: str | None = ..., fixers_applied: list[Any] = ... ) -> None: ... + def __unicode__(self) -> str: ... def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ... @@ -68,7 +71,7 @@ class BasePattern: def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns def match(self, node: _NL, results: _Results | None = ...) -> bool: ... def match_seq(self, nodes: list[_NL], results: _Results | None = ...) -> bool: ... - def generate_matches(self, nodes: list[_NL]) -> Iterator[Tuple[int, _Results]]: ... + def generate_matches(self, nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ... class LeafPattern(BasePattern): def __init__(self, type: int | None = ..., content: str | None = ..., name: str | None = ...) -> None: ... @@ -85,4 +88,4 @@ class WildcardPattern(BasePattern): class NegatedPattern(BasePattern): def __init__(self, content: str | None = ...) -> None: ... -def generate_matches(patterns: list[BasePattern], nodes: list[_NL]) -> Iterator[Tuple[int, _Results]]: ... +def generate_matches(patterns: list[BasePattern], nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ... diff --git a/stdlib/lib2to3/refactor.pyi b/stdlib/lib2to3/refactor.pyi index 6687092..3aaea0e 100644 --- a/stdlib/lib2to3/refactor.pyi +++ b/stdlib/lib2to3/refactor.pyi @@ -1,11 +1,12 @@ from collections.abc import Container, Generator, Iterable, Mapping from logging import Logger from typing import Any, ClassVar, NoReturn +from typing_extensions import TypeAlias from .pgen2.grammar import Grammar -_Driver = Any # really lib2to3.driver.Driver -_BottomMatcher = Any # really lib2to3.btm_matcher.BottomMatcher +_Driver: TypeAlias = Any # really lib2to3.driver.Driver +_BottomMatcher: TypeAlias = Any # really lib2to3.btm_matcher.BottomMatcher def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = ...) -> list[str]: ... def get_fixers_from_package(pkg_name: str) -> list[str]: ... diff --git a/stdlib/linecache.pyi b/stdlib/linecache.pyi index a66614b..df54fd8 100644 --- a/stdlib/linecache.pyi +++ b/stdlib/linecache.pyi @@ -1,7 +1,14 @@ -from typing import Any, Dict, List, Protocol, Tuple +import sys +from typing import Any, Protocol +from typing_extensions import TypeAlias -_ModuleGlobals = Dict[str, Any] -_ModuleMetadata = Tuple[int, float, List[str], str] +if sys.version_info >= (3, 9): + __all__ = ["getline", "clearcache", "checkcache", "lazycache"] +else: + __all__ = ["getline", "clearcache", "checkcache"] + +_ModuleGlobals: TypeAlias = dict[str, Any] +_ModuleMetadata: TypeAlias = tuple[int, float | None, list[str], str] class _SourceLoader(Protocol): def __call__(self) -> str | None: ... diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index fa2e788..9a3ea65 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -1,10 +1,42 @@ import sys +from _typeshed import StrPath +from collections.abc import Callable, Iterable, Mapping + +__all__ = [ + "getlocale", + "getdefaultlocale", + "getpreferredencoding", + "Error", + "setlocale", + "resetlocale", + "localeconv", + "strcoll", + "strxfrm", + "str", + "atof", + "atoi", + "format", + "format_string", + "currency", + "normalize", + "LC_CTYPE", + "LC_COLLATE", + "LC_MESSAGES", + "LC_TIME", + "LC_MONETARY", + "LC_NUMERIC", + "LC_ALL", + "CHAR_MAX", +] + +if sys.version_info >= (3, 11): + __all__ += ["getencoding"] # This module defines a function "str()", which is why "str" can't be used # as a type annotation or type alias. from builtins import str as _str from decimal import Decimal -from typing import Any, Callable, Iterable, Mapping, Sequence, Tuple +from typing import Any CODESET: int D_T_FMT: int @@ -79,30 +111,38 @@ CHAR_MAX: int class Error(Exception): ... -def setlocale(category: int, locale: _str | Iterable[_str] | None = ...) -> _str: ... +def setlocale(category: int, locale: _str | Iterable[_str | None] | None = ...) -> _str: ... def localeconv() -> Mapping[_str, int | _str | list[int]]: ... def nl_langinfo(__key: int) -> _str: ... -def getdefaultlocale(envvars: Tuple[_str, ...] = ...) -> Tuple[_str | None, _str | None]: ... -def getlocale(category: int = ...) -> Sequence[_str]: ... +def getdefaultlocale(envvars: tuple[_str, ...] = ...) -> tuple[_str | None, _str | None]: ... +def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: ... def getpreferredencoding(do_setlocale: bool = ...) -> _str: ... def normalize(localename: _str) -> _str: ... def resetlocale(category: int = ...) -> None: ... -def strcoll(string1: _str, string2: _str) -> int: ... -def strxfrm(string: _str) -> _str: ... +def strcoll(__os1: _str, __os2: _str) -> int: ... +def strxfrm(__string: _str) -> _str: ... def format(percent: _str, value: float | Decimal, grouping: bool = ..., monetary: bool = ..., *additional: Any) -> _str: ... - -if sys.version_info >= (3, 7): - def format_string(f: _str, val: Any, grouping: bool = ..., monetary: bool = ...) -> _str: ... - -else: - def format_string(f: _str, val: Any, grouping: bool = ...) -> _str: ... - -def currency(val: int | float | Decimal, symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ... +def format_string(f: _str, val: Any, grouping: bool = ..., monetary: bool = ...) -> _str: ... +def currency(val: float | Decimal, symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ... def delocalize(string: _str) -> _str: ... def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ... def atoi(string: _str) -> int: ... def str(val: float) -> _str: ... +# native gettext functions +# https://docs.python.org/3/library/locale.html#access-to-message-catalogs +# https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Modules/_localemodule.c#L626 +if sys.platform == "linux" or sys.platform == "darwin": + def gettext(__msg: _str) -> _str: ... + def dgettext(__domain: _str | None, __msg: _str) -> _str: ... + def dcgettext(__domain: _str | None, __msg: _str, __category: int) -> _str: ... + def textdomain(__domain: _str | None) -> _str: ... + def bindtextdomain(__domain: _str, __dir: StrPath | None) -> _str: ... + def bind_textdomain_codeset(__domain: _str, __codeset: _str | None) -> _str | None: ... + +if sys.version_info >= (3, 11): + def getencoding() -> _str: ... + locale_alias: dict[_str, _str] # undocumented locale_encoding_alias: dict[_str, _str] # undocumented windows_locale: dict[int, _str] # undocumented diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index c972559..575fd8f 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -1,20 +1,72 @@ import sys import threading -from _typeshed import StrPath, SupportsWrite +from _typeshed import Self, StrPath, SupportsWrite from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence from io import TextIOWrapper +from re import Pattern from string import Template from time import struct_time from types import FrameType, TracebackType -from typing import Any, ClassVar, Generic, Optional, Pattern, TextIO, Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal - -_SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, Optional[TracebackType]], Tuple[None, None, None]] -_ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException] -_ArgsType = Union[Tuple[object, ...], Mapping[str, object]] -_FilterType = Union[Filter, Callable[[LogRecord], int]] -_Level = Union[int, str] -_FormatStyle = Literal["%", "{", "$"] +from typing import Any, ClassVar, Generic, TextIO, TypeVar, Union, overload +from typing_extensions import Literal, TypeAlias + +if sys.version_info >= (3, 11): + from types import GenericAlias + +__all__ = [ + "BASIC_FORMAT", + "BufferingFormatter", + "CRITICAL", + "DEBUG", + "ERROR", + "FATAL", + "FileHandler", + "Filter", + "Formatter", + "Handler", + "INFO", + "LogRecord", + "Logger", + "LoggerAdapter", + "NOTSET", + "NullHandler", + "StreamHandler", + "WARN", + "WARNING", + "addLevelName", + "basicConfig", + "captureWarnings", + "critical", + "debug", + "disable", + "error", + "exception", + "fatal", + "getLevelName", + "getLogger", + "getLoggerClass", + "info", + "log", + "makeLogRecord", + "setLoggerClass", + "shutdown", + "warn", + "warning", + "getLogRecordFactory", + "setLogRecordFactory", + "lastResort", + "raiseExceptions", +] + +if sys.version_info >= (3, 11): + __all__ += ["getLevelNamesMapping"] + +_SysExcInfoType: TypeAlias = Union[tuple[type[BaseException], BaseException, TracebackType | None], tuple[None, None, None]] +_ExcInfoType: TypeAlias = None | bool | _SysExcInfoType | BaseException +_ArgsType: TypeAlias = tuple[object, ...] | Mapping[str, object] +_FilterType: TypeAlias = Filter | Callable[[LogRecord], int] +_Level: TypeAlias = int | str +_FormatStyle: TypeAlias = Literal["%", "{", "$"] raiseExceptions: bool logThreads: bool @@ -27,23 +79,22 @@ def currentframe() -> FrameType: ... _levelToName: dict[int, str] _nameToLevel: dict[str, int] -class Filterer(object): +class Filterer: filters: list[Filter] - def __init__(self) -> None: ... def addFilter(self, filter: _FilterType) -> None: ... def removeFilter(self, filter: _FilterType) -> None: ... def filter(self, record: LogRecord) -> bool: ... -class Manager(object): # undocumented +class Manager: # undocumented root: RootLogger disable: int emittedNoHandlerWarning: bool loggerDict: dict[str, Logger | PlaceHolder] - loggerClass: Type[Logger] | None + loggerClass: type[Logger] | None logRecordFactory: Callable[..., LogRecord] | None def __init__(self, rootnode: RootLogger) -> None: ... def getLogger(self, name: str) -> Logger: ... - def setLoggerClass(self, klass: Type[Logger]) -> None: ... + def setLoggerClass(self, klass: type[Logger]) -> None: ... def setLogRecordFactory(self, factory: Callable[..., LogRecord]) -> None: ... class Logger(Filterer): @@ -59,7 +110,7 @@ class Logger(Filterer): def setLevel(self, level: _Level) -> None: ... def isEnabledFor(self, level: int) -> bool: ... def getEffectiveLevel(self) -> int: ... - def getChild(self, suffix: str) -> Logger: ... + def getChild(self: Self, suffix: str) -> Self: ... # see python/typing#980 if sys.version_info >= (3, 8): def debug( self, @@ -220,13 +271,13 @@ class Logger(Filterer): stack_info: bool = ..., ) -> None: ... # undocumented fatal = critical - def filter(self, record: LogRecord) -> bool: ... def addHandler(self, hdlr: Handler) -> None: ... def removeHandler(self, hdlr: Handler) -> None: ... if sys.version_info >= (3, 8): def findCaller(self, stack_info: bool = ..., stacklevel: int = ...) -> tuple[str, int, str, str | None]: ... else: def findCaller(self, stack_info: bool = ...) -> tuple[str, int, str, str | None]: ... + def handle(self, record: LogRecord) -> None: ... def makeRecord( self, @@ -266,7 +317,6 @@ class Handler(Filterer): def release(self) -> None: ... def setLevel(self, level: _Level) -> None: ... def setFormatter(self, fmt: Formatter | None) -> None: ... - def filter(self, record: LogRecord) -> bool: ... def flush(self) -> None: ... def close(self) -> None: ... def handle(self, record: LogRecord) -> bool: ... @@ -285,12 +335,23 @@ class Formatter: else: default_msec_format: str - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 10): + def __init__( + self, + fmt: str | None = ..., + datefmt: str | None = ..., + style: _FormatStyle = ..., + validate: bool = ..., + *, + defaults: Mapping[str, Any] | None = ..., + ) -> None: ... + elif sys.version_info >= (3, 8): def __init__( self, fmt: str | None = ..., datefmt: str | None = ..., style: _FormatStyle = ..., validate: bool = ... ) -> None: ... else: def __init__(self, fmt: str | None = ..., datefmt: str | None = ..., style: _FormatStyle = ...) -> None: ... + def format(self, record: LogRecord) -> str: ... def formatTime(self, record: LogRecord, datefmt: str | None = ...) -> str: ... def formatException(self, ei: _SysExcInfoType) -> str: ... @@ -326,6 +387,7 @@ class LogRecord: lineno: int module: str msecs: float + # Only created when logging.Formatter.format is called. See #6132. message: str msg: str name: str @@ -349,18 +411,21 @@ class LogRecord: sinfo: str | None = ..., ) -> None: ... def getMessage(self) -> str: ... + # Allows setting contextual information on LogRecord objects as per the docs, see #7833 + def __setattr__(self, __name: str, __value: Any) -> None: ... -_L = TypeVar("_L", Logger, LoggerAdapter[Logger], LoggerAdapter[Any]) +_L = TypeVar("_L", bound=Logger | LoggerAdapter[Any]) class LoggerAdapter(Generic[_L]): logger: _L manager: Manager # undocumented if sys.version_info >= (3, 10): extra: Mapping[str, object] | None - def __init__(self, logger: _L, extra: Mapping[str, object] | None) -> None: ... + def __init__(self, logger: _L, extra: Mapping[str, object] | None = ...) -> None: ... else: extra: Mapping[str, object] def __init__(self, logger: _L, extra: Mapping[str, object]) -> None: ... + def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> tuple[Any, MutableMapping[str, Any]]: ... if sys.version_info >= (3, 8): def debug( @@ -518,6 +583,7 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = ..., **kwargs: object, ) -> None: ... + def isEnabledFor(self, level: int) -> bool: ... def getEffectiveLevel(self) -> int: ... def setLevel(self, level: _Level) -> None: ... @@ -533,9 +599,11 @@ class LoggerAdapter(Generic[_L]): ) -> None: ... # undocumented @property def name(self) -> str: ... # undocumented + if sys.version_info >= (3, 11): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... def getLogger(name: str | None = ...) -> Logger: ... -def getLoggerClass() -> Type[Logger]: ... +def getLoggerClass() -> type[Logger]: ... def getLogRecordFactory() -> Callable[..., LogRecord]: ... if sys.version_info >= (3, 8): @@ -638,14 +706,13 @@ else: fatal = critical -if sys.version_info >= (3, 7): - def disable(level: int = ...) -> None: ... - -else: - def disable(level: int) -> None: ... - +def disable(level: int = ...) -> None: ... def addLevelName(level: int, levelName: str) -> None: ... def getLevelName(level: _Level) -> Any: ... + +if sys.version_info >= (3, 11): + def getLevelNamesMapping() -> dict[str, int]: ... + def makeLogRecord(dict: Mapping[str, object]) -> LogRecord: ... if sys.version_info >= (3, 9): @@ -692,7 +759,7 @@ else: ) -> None: ... def shutdown(handlerList: Sequence[Any] = ...) -> None: ... # handlerList is undocumented -def setLoggerClass(klass: Type[Logger]) -> None: ... +def setLoggerClass(klass: type[Logger]) -> None: ... def captureWarnings(capture: bool) -> None: ... def setLogRecordFactory(factory: Callable[..., LogRecord]) -> None: ... @@ -707,8 +774,9 @@ class StreamHandler(Handler, Generic[_StreamT]): def __init__(self: StreamHandler[TextIO], stream: None = ...) -> None: ... @overload def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... - if sys.version_info >= (3, 7): - def setStream(self, stream: _StreamT) -> _StreamT | None: ... + def setStream(self, stream: _StreamT) -> _StreamT | None: ... + if sys.version_info >= (3, 11): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... class FileHandler(StreamHandler[TextIOWrapper]): baseFilename: str # undocumented @@ -722,6 +790,7 @@ class FileHandler(StreamHandler[TextIOWrapper]): ) -> None: ... else: def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ... + def _open(self) -> TextIOWrapper: ... # undocumented class NullHandler(Handler): ... @@ -738,22 +807,27 @@ class RootLogger(Logger): root: RootLogger -class PercentStyle(object): # undocumented +class PercentStyle: # undocumented default_format: str asctime_format: str asctime_search: str if sys.version_info >= (3, 8): validation_pattern: Pattern[str] _fmt: str - def __init__(self, fmt: str) -> None: ... + if sys.version_info >= (3, 10): + def __init__(self, fmt: str, *, defaults: Mapping[str, Any] | None = ...) -> None: ... + else: + def __init__(self, fmt: str) -> None: ... + def usesTime(self) -> bool: ... if sys.version_info >= (3, 8): def validate(self) -> None: ... + def format(self, record: Any) -> str: ... class StrFormatStyle(PercentStyle): # undocumented - fmt_spec = Any - field_spec = Any + fmt_spec: Pattern[str] + field_spec: Pattern[str] class StringTemplateStyle(PercentStyle): # undocumented _tpl: Template diff --git a/stdlib/logging/config.pyi b/stdlib/logging/config.pyi index f84865e..12e2226 100644 --- a/stdlib/logging/config.pyi +++ b/stdlib/logging/config.pyi @@ -1,29 +1,54 @@ import sys -from _typeshed import StrOrBytesPath, StrPath -from collections.abc import Callable +from _typeshed import StrOrBytesPath +from collections.abc import Callable, Sequence from configparser import RawConfigParser +from re import Pattern from threading import Thread -from typing import IO, Any, Pattern +from typing import IO, Any -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal +from . import _Level -if sys.version_info >= (3, 7): - _Path = StrOrBytesPath +if sys.version_info >= (3, 8): + from typing import Literal, TypedDict else: - _Path = StrPath + from typing_extensions import Literal, TypedDict DEFAULT_LOGGING_CONFIG_PORT: int RESET_ERROR: int # undocumented IDENTIFIER: Pattern[str] # undocumented -def dictConfig(config: dict[str, Any]) -> None: ... +class _RootLoggerConfiguration(TypedDict, total=False): + level: _Level + filters: Sequence[str] + handlers: Sequence[str] + +class _LoggerConfiguration(_RootLoggerConfiguration, TypedDict, total=False): + propagate: bool + +class _OptionalDictConfigArgs(TypedDict, total=False): + # these two can have custom factories (key: `()`) which can have extra keys + formatters: dict[str, dict[str, Any]] + filters: dict[str, dict[str, Any]] + # type checkers would warn about extra keys if this was a TypedDict + handlers: dict[str, dict[str, Any]] + loggers: dict[str, _LoggerConfiguration] + root: _RootLoggerConfiguration | None + incremental: bool + disable_existing_loggers: bool + +class _DictConfigArgs(_OptionalDictConfigArgs, TypedDict): + version: Literal[1] + +# Accept dict[str, Any] to avoid false positives if called with a dict +# type, since dict types are not compatible with TypedDicts. +# +# Also accept a TypedDict type, to allow callers to use TypedDict +# types, and for somewhat stricter type checking of dict literals. +def dictConfig(config: _DictConfigArgs | dict[str, Any]) -> None: ... if sys.version_info >= (3, 10): def fileConfig( - fname: _Path | IO[str] | RawConfigParser, + fname: StrOrBytesPath | IO[str] | RawConfigParser, defaults: dict[str, str] | None = ..., disable_existing_loggers: bool = ..., encoding: str | None = ..., @@ -31,7 +56,9 @@ if sys.version_info >= (3, 10): else: def fileConfig( - fname: _Path | IO[str] | RawConfigParser, defaults: dict[str, str] | None = ..., disable_existing_loggers: bool = ... + fname: StrOrBytesPath | IO[str] | RawConfigParser, + defaults: dict[str, str] | None = ..., + disable_existing_loggers: bool = ..., ) -> None: ... def valid_ident(s: str) -> Literal[True]: ... # undocumented diff --git a/stdlib/logging/handlers.pyi b/stdlib/logging/handlers.pyi index 5be6248..f01c67d 100644 --- a/stdlib/logging/handlers.pyi +++ b/stdlib/logging/handlers.pyi @@ -2,16 +2,13 @@ import datetime import http.client import ssl import sys -from _typeshed import StrPath +from _typeshed import ReadableBuffer, StrPath from collections.abc import Callable from logging import FileHandler, Handler, LogRecord +from queue import Queue, SimpleQueue +from re import Pattern from socket import SocketKind, socket -from typing import Any, ClassVar, Pattern - -if sys.version_info >= (3, 7): - from queue import Queue, SimpleQueue -else: - from queue import Queue +from typing import Any, ClassVar DEFAULT_TCP_LOGGING_PORT: int DEFAULT_UDP_LOGGING_PORT: int @@ -29,6 +26,7 @@ class WatchedFileHandler(FileHandler): ) -> None: ... else: def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ... + def _statstream(self) -> None: ... # undocumented def reopenIfNeeded(self) -> None: ... @@ -41,6 +39,7 @@ class BaseRotatingHandler(FileHandler): ) -> None: ... else: def __init__(self, filename: StrPath, mode: str, encoding: str | None = ..., delay: bool = ...) -> None: ... + def rotation_filename(self, default_name: str) -> str: ... def rotate(self, source: str, dest: str) -> None: ... @@ -68,6 +67,7 @@ class RotatingFileHandler(BaseRotatingHandler): encoding: str | None = ..., delay: bool = ..., ) -> None: ... + def doRollover(self) -> None: ... def shouldRollover(self, record: LogRecord) -> int: ... # undocumented @@ -75,7 +75,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler): when: str # undocumented backupCount: int # undocumented utc: bool # undocumented - atTime: datetime.datetime | None # undocumented + atTime: datetime.time | None # undocumented interval: int # undocumented suffix: str # undocumented dayOfWeek: int # undocumented @@ -91,7 +91,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler): encoding: str | None = ..., delay: bool = ..., utc: bool = ..., - atTime: datetime.datetime | None = ..., + atTime: datetime.time | None = ..., errors: str | None = ..., ) -> None: ... else: @@ -104,8 +104,9 @@ class TimedRotatingFileHandler(BaseRotatingHandler): encoding: str | None = ..., delay: bool = ..., utc: bool = ..., - atTime: datetime.datetime | None = ..., + atTime: datetime.time | None = ..., ) -> None: ... + def doRollover(self) -> None: ... def shouldRollover(self, record: LogRecord) -> int: ... # undocumented def computeRollover(self, currentTime: int) -> int: ... # undocumented @@ -124,11 +125,11 @@ class SocketHandler(Handler): def __init__(self, host: str, port: int | None) -> None: ... def makeSocket(self, timeout: float = ...) -> socket: ... # timeout is undocumented def makePickle(self, record: LogRecord) -> bytes: ... - def send(self, s: bytes) -> None: ... + def send(self, s: ReadableBuffer) -> None: ... def createSocket(self) -> None: ... class DatagramHandler(SocketHandler): - def makeSocket(self) -> socket: ... # type: ignore + def makeSocket(self) -> socket: ... # type: ignore[override] class SysLogHandler(Handler): LOG_EMERG: int @@ -177,6 +178,9 @@ class SysLogHandler(Handler): facility_names: ClassVar[dict[str, int]] # undocumented priority_map: ClassVar[dict[str, str]] # undocumented def __init__(self, address: tuple[str, int] | str = ..., facility: int = ..., socktype: SocketKind | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def createSocket(self) -> None: ... + def encodePriority(self, facility: int | str, priority: int | str) -> int: ... def mapPriority(self, levelName: str) -> str: ... @@ -244,26 +248,16 @@ class HTTPHandler(Handler): def getConnection(self, host: str, secure: bool) -> http.client.HTTPConnection: ... # undocumented class QueueHandler(Handler): - if sys.version_info >= (3, 7): - queue: SimpleQueue[Any] | Queue[Any] # undocumented - def __init__(self, queue: SimpleQueue[Any] | Queue[Any]) -> None: ... - else: - queue: Queue[Any] # undocumented - def __init__(self, queue: Queue[Any]) -> None: ... + queue: SimpleQueue[Any] | Queue[Any] # undocumented + def __init__(self, queue: SimpleQueue[Any] | Queue[Any]) -> None: ... def prepare(self, record: LogRecord) -> Any: ... def enqueue(self, record: LogRecord) -> None: ... class QueueListener: - handlers: tuple[Handler] # undocumented + handlers: tuple[Handler, ...] # undocumented respect_handler_level: bool # undocumented - if sys.version_info >= (3, 7): - queue: SimpleQueue[Any] | Queue[Any] # undocumented - def __init__( - self, queue: SimpleQueue[Any] | Queue[Any], *handlers: Handler, respect_handler_level: bool = ... - ) -> None: ... - else: - queue: Queue[Any] # undocumented - def __init__(self, queue: Queue[Any], *handlers: Handler, respect_handler_level: bool = ...) -> None: ... + queue: SimpleQueue[Any] | Queue[Any] # undocumented + def __init__(self, queue: SimpleQueue[Any] | Queue[Any], *handlers: Handler, respect_handler_level: bool = ...) -> None: ... def dequeue(self, block: bool) -> LogRecord: ... def prepare(self, record: LogRecord) -> Any: ... def start(self) -> None: ... diff --git a/stdlib/lzma.pyi b/stdlib/lzma.pyi index 7a26d15..9d75c62 100644 --- a/stdlib/lzma.pyi +++ b/stdlib/lzma.pyi @@ -1,48 +1,89 @@ import io from _typeshed import ReadableBuffer, Self, StrOrBytesPath -from typing import IO, Any, Mapping, Sequence, TextIO, Union, overload -from typing_extensions import Literal +from collections.abc import Mapping, Sequence +from typing import IO, Any, TextIO, overload +from typing_extensions import Literal, TypeAlias, final -_OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"] -_OpenTextWritingMode = Literal["wt", "xt", "at"] +__all__ = [ + "CHECK_NONE", + "CHECK_CRC32", + "CHECK_CRC64", + "CHECK_SHA256", + "CHECK_ID_MAX", + "CHECK_UNKNOWN", + "FILTER_LZMA1", + "FILTER_LZMA2", + "FILTER_DELTA", + "FILTER_X86", + "FILTER_IA64", + "FILTER_ARM", + "FILTER_ARMTHUMB", + "FILTER_POWERPC", + "FILTER_SPARC", + "FORMAT_AUTO", + "FORMAT_XZ", + "FORMAT_ALONE", + "FORMAT_RAW", + "MF_HC3", + "MF_HC4", + "MF_BT2", + "MF_BT3", + "MF_BT4", + "MODE_FAST", + "MODE_NORMAL", + "PRESET_DEFAULT", + "PRESET_EXTREME", + "LZMACompressor", + "LZMADecompressor", + "LZMAFile", + "LZMAError", + "open", + "compress", + "decompress", + "is_check_supported", +] -_PathOrFile = Union[StrOrBytesPath, IO[bytes]] +_OpenBinaryWritingMode: TypeAlias = Literal["w", "wb", "x", "xb", "a", "ab"] +_OpenTextWritingMode: TypeAlias = Literal["wt", "xt", "at"] -_FilterChain = Sequence[Mapping[str, Any]] +_PathOrFile: TypeAlias = StrOrBytesPath | IO[bytes] -FORMAT_AUTO: int -FORMAT_XZ: int -FORMAT_ALONE: int -FORMAT_RAW: int -CHECK_NONE: int -CHECK_CRC32: int -CHECK_CRC64: int -CHECK_SHA256: int -CHECK_ID_MAX: int -CHECK_UNKNOWN: int -FILTER_LZMA1: int -FILTER_LZMA2: int -FILTER_DELTA: int -FILTER_X86: int -FILTER_IA64: int -FILTER_ARM: int -FILTER_ARMTHUMB: int -FILTER_SPARC: int -FILTER_POWERPC: int -MF_HC3: int -MF_HC4: int -MF_BT2: int -MF_BT3: int -MF_BT4: int -MODE_FAST: int -MODE_NORMAL: int -PRESET_DEFAULT: int -PRESET_EXTREME: int +_FilterChain: TypeAlias = Sequence[Mapping[str, Any]] + +FORMAT_AUTO: Literal[0] +FORMAT_XZ: Literal[1] +FORMAT_ALONE: Literal[2] +FORMAT_RAW: Literal[3] +CHECK_NONE: Literal[0] +CHECK_CRC32: Literal[1] +CHECK_CRC64: Literal[4] +CHECK_SHA256: Literal[10] +CHECK_ID_MAX: Literal[15] +CHECK_UNKNOWN: Literal[16] +FILTER_LZMA1: int # v big number +FILTER_LZMA2: Literal[33] +FILTER_DELTA: Literal[3] +FILTER_X86: Literal[4] +FILTER_IA64: Literal[6] +FILTER_ARM: Literal[7] +FILTER_ARMTHUMB: Literal[8] +FILTER_SPARC: Literal[9] +FILTER_POWERPC: Literal[5] +MF_HC3: Literal[3] +MF_HC4: Literal[4] +MF_BT2: Literal[18] +MF_BT3: Literal[19] +MF_BT4: Literal[20] +MODE_FAST: Literal[1] +MODE_NORMAL: Literal[2] +PRESET_DEFAULT: Literal[6] +PRESET_EXTREME: int # v big number # from _lzma.c -class LZMADecompressor(object): +@final +class LZMADecompressor: def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... - def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... + def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ... @property def check(self) -> int: ... @property @@ -53,11 +94,12 @@ class LZMADecompressor(object): def needs_input(self) -> bool: ... # from _lzma.c -class LZMACompressor(object): +@final +class LZMACompressor: def __init__( self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... ) -> None: ... - def compress(self, __data: bytes) -> bytes: ... + def compress(self, __data: ReadableBuffer) -> bytes: ... def flush(self) -> bytes: ... class LZMAError(Exception): ... @@ -74,20 +116,12 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]): filters: _FilterChain | None = ..., ) -> None: ... def __enter__(self: Self) -> Self: ... - def close(self) -> None: ... - @property - def closed(self) -> bool: ... - def fileno(self) -> int: ... - def seekable(self) -> bool: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... def peek(self, size: int = ...) -> bytes: ... def read(self, size: int | None = ...) -> bytes: ... def read1(self, size: int = ...) -> bytes: ... def readline(self, size: int | None = ...) -> bytes: ... def write(self, data: ReadableBuffer) -> int: ... def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... @overload def open( @@ -155,7 +189,9 @@ def open( newline: str | None = ..., ) -> LZMAFile | TextIO: ... def compress( - data: bytes, format: int = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... + data: ReadableBuffer, format: int = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... +) -> bytes: ... +def decompress( + data: ReadableBuffer, format: int = ..., memlimit: int | None = ..., filters: _FilterChain | None = ... ) -> bytes: ... -def decompress(data: bytes, format: int = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> bytes: ... def is_check_supported(__check_id: int) -> bool: ... diff --git a/stdlib/macpath.pyi b/stdlib/macpath.pyi index 5657add..37821f4 100644 --- a/stdlib/macpath.pyi +++ b/stdlib/macpath.pyi @@ -32,7 +32,42 @@ from posixpath import ( splitext as splitext, supports_unicode_filenames as supports_unicode_filenames, ) -from typing import AnyStr, Tuple, overload +from typing import AnyStr, overload + +__all__ = [ + "normcase", + "isabs", + "join", + "splitdrive", + "split", + "splitext", + "basename", + "dirname", + "commonprefix", + "getsize", + "getmtime", + "getatime", + "getctime", + "islink", + "exists", + "lexists", + "isdir", + "isfile", + "expanduser", + "expandvars", + "normpath", + "abspath", + "curdir", + "pardir", + "sep", + "pathsep", + "defpath", + "altsep", + "extsep", + "devnull", + "realpath", + "supports_unicode_filenames", +] altsep: str | None @@ -64,6 +99,6 @@ def join(s: StrPath, *paths: StrPath) -> str: ... @overload def join(s: BytesPath, *paths: BytesPath) -> bytes: ... @overload -def split(s: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +def split(s: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @overload -def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(s: AnyStr) -> tuple[AnyStr, AnyStr]: ... diff --git a/stdlib/macurl2path.pyi b/stdlib/macurl2path.pyi deleted file mode 100644 index 6aac6df..0000000 --- a/stdlib/macurl2path.pyi +++ /dev/null @@ -1,3 +0,0 @@ -def url2pathname(pathname: str) -> str: ... -def pathname2url(pathname: str) -> str: ... -def _pncomp2url(component: str | bytes) -> str: ... diff --git a/stdlib/mailbox.pyi b/stdlib/mailbox.pyi index 544760c..3169e8c 100644 --- a/stdlib/mailbox.pyi +++ b/stdlib/mailbox.pyi @@ -1,38 +1,44 @@ import email.message import sys from _typeshed import Self, StrOrBytesPath +from abc import ABCMeta, abstractmethod +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from types import TracebackType -from typing import ( - IO, - Any, - AnyStr, - Callable, - Generic, - Iterable, - Iterator, - Mapping, - Protocol, - Sequence, - Tuple, - Type, - TypeVar, - Union, - overload, -) -from typing_extensions import Literal +from typing import IO, Any, AnyStr, Generic, Protocol, TypeVar, overload +from typing_extensions import Literal, TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = [ + "Mailbox", + "Maildir", + "mbox", + "MH", + "Babyl", + "MMDF", + "Message", + "MaildirMessage", + "mboxMessage", + "MHMessage", + "BabylMessage", + "MMDFMessage", + "Error", + "NoSuchMailboxError", + "NotEmptyError", + "ExternalClashError", + "FormatError", +] + _T = TypeVar("_T") _MessageT = TypeVar("_MessageT", bound=Message) -_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]] +_MessageData: TypeAlias = email.message.Message | bytes | str | IO[str] | IO[bytes] class _HasIteritems(Protocol): - def iteritems(self) -> Iterator[Tuple[str, _MessageData]]: ... + def iteritems(self) -> Iterator[tuple[str, _MessageData]]: ... class _HasItems(Protocol): - def items(self) -> Iterator[Tuple[str, _MessageData]]: ... + def items(self) -> Iterator[tuple[str, _MessageData]]: ... linesep: bytes @@ -40,43 +46,57 @@ class Mailbox(Generic[_MessageT]): _path: bytes | str # undocumented _factory: Callable[[IO[Any]], _MessageT] | None # undocumented - def __init__( - self, path: StrOrBytesPath, factory: Callable[[IO[Any]], _MessageT] | None = ..., create: bool = ... - ) -> None: ... + @overload + def __init__(self, path: StrOrBytesPath, factory: Callable[[IO[Any]], _MessageT], create: bool = ...) -> None: ... + @overload + def __init__(self, path: StrOrBytesPath, factory: None = ..., create: bool = ...) -> None: ... + @abstractmethod def add(self, message: _MessageData) -> str: ... + @abstractmethod def remove(self, key: str) -> None: ... def __delitem__(self, key: str) -> None: ... def discard(self, key: str) -> None: ... + @abstractmethod def __setitem__(self, key: str, message: _MessageData) -> None: ... @overload def get(self, key: str, default: None = ...) -> _MessageT | None: ... @overload def get(self, key: str, default: _T) -> _MessageT | _T: ... def __getitem__(self, key: str) -> _MessageT: ... + @abstractmethod def get_message(self, key: str) -> _MessageT: ... def get_string(self, key: str) -> str: ... + @abstractmethod def get_bytes(self, key: str) -> bytes: ... # As '_ProxyFile' doesn't implement the full IO spec, and BytesIO is incompatible with it, get_file return is Any here + @abstractmethod def get_file(self, key: str) -> Any: ... + @abstractmethod def iterkeys(self) -> Iterator[str]: ... def keys(self) -> list[str]: ... def itervalues(self) -> Iterator[_MessageT]: ... def __iter__(self) -> Iterator[_MessageT]: ... def values(self) -> list[_MessageT]: ... - def iteritems(self) -> Iterator[Tuple[str, _MessageT]]: ... - def items(self) -> list[Tuple[str, _MessageT]]: ... + def iteritems(self) -> Iterator[tuple[str, _MessageT]]: ... + def items(self) -> list[tuple[str, _MessageT]]: ... + @abstractmethod def __contains__(self, key: str) -> bool: ... + @abstractmethod def __len__(self) -> int: ... def clear(self) -> None: ... @overload def pop(self, key: str, default: None = ...) -> _MessageT | None: ... @overload def pop(self, key: str, default: _T = ...) -> _MessageT | _T: ... - def popitem(self) -> Tuple[str, _MessageT]: ... - def update(self, arg: _HasIteritems | _HasItems | Iterable[Tuple[str, _MessageData]] | None = ...) -> None: ... + def popitem(self) -> tuple[str, _MessageT]: ... + def update(self, arg: _HasIteritems | _HasItems | Iterable[tuple[str, _MessageData]] | None = ...) -> None: ... + @abstractmethod def flush(self) -> None: ... + @abstractmethod def lock(self) -> None: ... + @abstractmethod def unlock(self) -> None: ... + @abstractmethod def close(self) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -87,7 +107,19 @@ class Maildir(Mailbox[MaildirMessage]): def __init__( self, dirname: StrOrBytesPath, factory: Callable[[IO[Any]], MaildirMessage] | None = ..., create: bool = ... ) -> None: ... + def add(self, message: _MessageData) -> str: ... + def remove(self, key: str) -> None: ... + def __setitem__(self, key: str, message: _MessageData) -> None: ... + def get_message(self, key: str) -> MaildirMessage: ... + def get_bytes(self, key: str) -> bytes: ... def get_file(self, key: str) -> _ProxyFile[bytes]: ... + def iterkeys(self) -> Iterator[str]: ... + def __contains__(self, key: str) -> bool: ... + def __len__(self) -> int: ... + def flush(self) -> None: ... + def lock(self) -> None: ... + def unlock(self) -> None: ... + def close(self) -> None: ... def list_folders(self) -> list[str]: ... def get_folder(self, folder: str) -> Maildir: ... def add_folder(self, folder: str) -> Maildir: ... @@ -95,9 +127,20 @@ class Maildir(Mailbox[MaildirMessage]): def clean(self) -> None: ... def next(self) -> str | None: ... -class _singlefileMailbox(Mailbox[_MessageT]): ... +class _singlefileMailbox(Mailbox[_MessageT], metaclass=ABCMeta): + def add(self, message: _MessageData) -> str: ... + def remove(self, key: str) -> None: ... + def __setitem__(self, key: str, message: _MessageData) -> None: ... + def iterkeys(self) -> Iterator[str]: ... + def __contains__(self, key: str) -> bool: ... + def __len__(self) -> int: ... + def lock(self) -> None: ... + def unlock(self) -> None: ... + def flush(self) -> None: ... + def close(self) -> None: ... class _mboxMMDF(_singlefileMailbox[_MessageT]): + def get_message(self, key: str) -> _MessageT: ... def get_file(self, key: str, from_: bool = ...) -> _PartialFile[bytes]: ... def get_bytes(self, key: str, from_: bool = ...) -> bytes: ... def get_string(self, key: str, from_: bool = ...) -> str: ... @@ -116,7 +159,19 @@ class MH(Mailbox[MHMessage]): def __init__( self, path: StrOrBytesPath, factory: Callable[[IO[Any]], MHMessage] | None = ..., create: bool = ... ) -> None: ... + def add(self, message: _MessageData) -> str: ... + def remove(self, key: str) -> None: ... + def __setitem__(self, key: str, message: _MessageData) -> None: ... + def get_message(self, key: str) -> MHMessage: ... + def get_bytes(self, key: str) -> bytes: ... def get_file(self, key: str) -> _ProxyFile[bytes]: ... + def iterkeys(self) -> Iterator[str]: ... + def __contains__(self, key: str) -> bool: ... + def __len__(self) -> int: ... + def flush(self) -> None: ... + def lock(self) -> None: ... + def unlock(self) -> None: ... + def close(self) -> None: ... def list_folders(self) -> list[str]: ... def get_folder(self, folder: StrOrBytesPath) -> MH: ... def add_folder(self, folder: StrOrBytesPath) -> MH: ... @@ -129,6 +184,8 @@ class Babyl(_singlefileMailbox[BabylMessage]): def __init__( self, path: StrOrBytesPath, factory: Callable[[IO[Any]], BabylMessage] | None = ..., create: bool = ... ) -> None: ... + def get_message(self, key: str) -> BabylMessage: ... + def get_bytes(self, key: str) -> bytes: ... def get_file(self, key: str) -> IO[bytes]: ... def get_labels(self) -> list[str]: ... @@ -149,7 +206,7 @@ class MaildirMessage(Message): class _mboxMMDFMessage(Message): def get_from(self) -> str: ... - def set_from(self, from_: str, time_: bool | Tuple[int, int, int, int, int, int, int, int, int] | None = ...) -> None: ... + def set_from(self, from_: str, time_: bool | tuple[int, int, int, int, int, int, int, int, int] | None = ...) -> None: ... def get_flags(self) -> str: ... def set_flags(self, flags: Iterable[str]) -> None: ... def add_flag(self, flag: str) -> None: ... @@ -185,7 +242,7 @@ class _ProxyFile(Generic[AnyStr]): def seek(self, offset: int, whence: int = ...) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... + def __exit__(self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... def readable(self) -> bool: ... def writable(self) -> bool: ... def seekable(self) -> bool: ... diff --git a/stdlib/mailcap.pyi b/stdlib/mailcap.pyi index 2d4008f..e1637ad 100644 --- a/stdlib/mailcap.pyi +++ b/stdlib/mailcap.pyi @@ -1,8 +1,11 @@ -from typing import Dict, Mapping, Sequence, Tuple, Union +from collections.abc import Mapping, Sequence +from typing_extensions import TypeAlias -_Cap = Dict[str, Union[str, int]] +_Cap: TypeAlias = dict[str, str | int] + +__all__ = ["getcaps", "findmatch"] def findmatch( caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... -) -> Tuple[str | None, _Cap | None]: ... +) -> tuple[str | None, _Cap | None]: ... def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/marshal.pyi b/stdlib/marshal.pyi index b2fde67..d68cdd1 100644 --- a/stdlib/marshal.pyi +++ b/stdlib/marshal.pyi @@ -1,8 +1,9 @@ -from typing import IO, Any +from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite +from typing import Any version: int -def dump(__value: Any, __file: IO[Any], __version: int = ...) -> None: ... -def load(__file: IO[Any]) -> Any: ... +def dump(__value: Any, __file: SupportsWrite[bytes], __version: int = ...) -> None: ... +def load(__file: SupportsRead[bytes]) -> Any: ... def dumps(__value: Any, __version: int = ...) -> bytes: ... -def loads(__bytes: bytes) -> Any: ... +def loads(__bytes: ReadableBuffer) -> Any: ... diff --git a/stdlib/math.pyi b/stdlib/math.pyi index 1046676..58eda98 100644 --- a/stdlib/math.pyi +++ b/stdlib/math.pyi @@ -1,6 +1,13 @@ import sys from _typeshed import SupportsTrunc -from typing import Iterable, SupportsFloat, SupportsInt, Tuple, overload +from collections.abc import Iterable +from typing import SupportsFloat, overload +from typing_extensions import SupportsIndex, TypeAlias + +if sys.version_info >= (3, 8): + _SupportsFloatOrIndex: TypeAlias = SupportsFloat | SupportsIndex +else: + _SupportsFloatOrIndex: TypeAlias = SupportsFloat e: float pi: float @@ -8,94 +15,111 @@ inf: float nan: float tau: float -def acos(__x: SupportsFloat) -> float: ... -def acosh(__x: SupportsFloat) -> float: ... -def asin(__x: SupportsFloat) -> float: ... -def asinh(__x: SupportsFloat) -> float: ... -def atan(__x: SupportsFloat) -> float: ... -def atan2(__y: SupportsFloat, __x: SupportsFloat) -> float: ... -def atanh(__x: SupportsFloat) -> float: ... -def ceil(__x: SupportsFloat) -> int: ... +def acos(__x: _SupportsFloatOrIndex) -> float: ... +def acosh(__x: _SupportsFloatOrIndex) -> float: ... +def asin(__x: _SupportsFloatOrIndex) -> float: ... +def asinh(__x: _SupportsFloatOrIndex) -> float: ... +def atan(__x: _SupportsFloatOrIndex) -> float: ... +def atan2(__y: _SupportsFloatOrIndex, __x: _SupportsFloatOrIndex) -> float: ... +def atanh(__x: _SupportsFloatOrIndex) -> float: ... + +if sys.version_info >= (3, 11): + def cbrt(__x: _SupportsFloatOrIndex) -> float: ... + +def ceil(__x: _SupportsFloatOrIndex) -> int: ... if sys.version_info >= (3, 8): - def comb(__n: int, __k: int) -> int: ... + def comb(__n: SupportsIndex, __k: SupportsIndex) -> int: ... -def copysign(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def cos(__x: SupportsFloat) -> float: ... -def cosh(__x: SupportsFloat) -> float: ... -def degrees(__x: SupportsFloat) -> float: ... +def copysign(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... +def cos(__x: _SupportsFloatOrIndex) -> float: ... +def cosh(__x: _SupportsFloatOrIndex) -> float: ... +def degrees(__x: _SupportsFloatOrIndex) -> float: ... if sys.version_info >= (3, 8): - def dist(__p: Iterable[SupportsFloat], __q: Iterable[SupportsFloat]) -> float: ... - -def erf(__x: SupportsFloat) -> float: ... -def erfc(__x: SupportsFloat) -> float: ... -def exp(__x: SupportsFloat) -> float: ... -def expm1(__x: SupportsFloat) -> float: ... -def fabs(__x: SupportsFloat) -> float: ... -def factorial(__x: SupportsInt) -> int: ... -def floor(__x: SupportsFloat) -> int: ... -def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ... -def frexp(__x: SupportsFloat) -> Tuple[float, int]: ... -def fsum(__seq: Iterable[float]) -> float: ... -def gamma(__x: SupportsFloat) -> float: ... + def dist(__p: Iterable[_SupportsFloatOrIndex], __q: Iterable[_SupportsFloatOrIndex]) -> float: ... + +def erf(__x: _SupportsFloatOrIndex) -> float: ... +def erfc(__x: _SupportsFloatOrIndex) -> float: ... +def exp(__x: _SupportsFloatOrIndex) -> float: ... + +if sys.version_info >= (3, 11): + def exp2(__x: _SupportsFloatOrIndex) -> float: ... + +def expm1(__x: _SupportsFloatOrIndex) -> float: ... +def fabs(__x: _SupportsFloatOrIndex) -> float: ... + +if sys.version_info >= (3, 8): + def factorial(__x: SupportsIndex) -> int: ... + +else: + def factorial(__x: int) -> int: ... + +def floor(__x: _SupportsFloatOrIndex) -> int: ... +def fmod(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... +def frexp(__x: _SupportsFloatOrIndex) -> tuple[float, int]: ... +def fsum(__seq: Iterable[_SupportsFloatOrIndex]) -> float: ... +def gamma(__x: _SupportsFloatOrIndex) -> float: ... if sys.version_info >= (3, 9): - def gcd(*integers: int) -> int: ... + def gcd(*integers: SupportsIndex) -> int: ... else: - def gcd(__x: int, __y: int) -> int: ... + def gcd(__x: SupportsIndex, __y: SupportsIndex) -> int: ... if sys.version_info >= (3, 8): - def hypot(*coordinates: SupportsFloat) -> float: ... + def hypot(*coordinates: _SupportsFloatOrIndex) -> float: ... else: - def hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ... - -def isclose(a: SupportsFloat, b: SupportsFloat, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ... -def isinf(__x: SupportsFloat) -> bool: ... -def isfinite(__x: SupportsFloat) -> bool: ... -def isnan(__x: SupportsFloat) -> bool: ... + def hypot(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... + +def isclose( + a: _SupportsFloatOrIndex, + b: _SupportsFloatOrIndex, + *, + rel_tol: _SupportsFloatOrIndex = ..., + abs_tol: _SupportsFloatOrIndex = ..., +) -> bool: ... +def isinf(__x: _SupportsFloatOrIndex) -> bool: ... +def isfinite(__x: _SupportsFloatOrIndex) -> bool: ... +def isnan(__x: _SupportsFloatOrIndex) -> bool: ... if sys.version_info >= (3, 8): - def isqrt(__n: int) -> int: ... + def isqrt(__n: SupportsIndex) -> int: ... if sys.version_info >= (3, 9): - def lcm(*integers: int) -> int: ... + def lcm(*integers: SupportsIndex) -> int: ... -def ldexp(__x: SupportsFloat, __i: int) -> float: ... -def lgamma(__x: SupportsFloat) -> float: ... -def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ... -def log10(__x: SupportsFloat) -> float: ... -def log1p(__x: SupportsFloat) -> float: ... -def log2(__x: SupportsFloat) -> float: ... -def modf(__x: SupportsFloat) -> Tuple[float, float]: ... +def ldexp(__x: _SupportsFloatOrIndex, __i: int) -> float: ... +def lgamma(__x: _SupportsFloatOrIndex) -> float: ... +def log(x: _SupportsFloatOrIndex, base: _SupportsFloatOrIndex = ...) -> float: ... +def log10(__x: _SupportsFloatOrIndex) -> float: ... +def log1p(__x: _SupportsFloatOrIndex) -> float: ... +def log2(__x: _SupportsFloatOrIndex) -> float: ... +def modf(__x: _SupportsFloatOrIndex) -> tuple[float, float]: ... if sys.version_info >= (3, 9): - def nextafter(__x: SupportsFloat, __y: SupportsFloat) -> float: ... + def nextafter(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... if sys.version_info >= (3, 8): - def perm(__n: int, __k: int | None = ...) -> int: ... + def perm(__n: SupportsIndex, __k: SupportsIndex | None = ...) -> int: ... -def pow(__x: SupportsFloat, __y: SupportsFloat) -> float: ... +def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... if sys.version_info >= (3, 8): @overload - def prod(__iterable: Iterable[int], *, start: int = ...) -> int: ... # type: ignore + def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = ...) -> int: ... # type: ignore[misc] @overload - def prod(__iterable: Iterable[SupportsFloat], *, start: SupportsFloat = ...) -> float: ... - -def radians(__x: SupportsFloat) -> float: ... - -if sys.version_info >= (3, 7): - def remainder(__x: SupportsFloat, __y: SupportsFloat) -> float: ... - -def sin(__x: SupportsFloat) -> float: ... -def sinh(__x: SupportsFloat) -> float: ... -def sqrt(__x: SupportsFloat) -> float: ... -def tan(__x: SupportsFloat) -> float: ... -def tanh(__x: SupportsFloat) -> float: ... + def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = ...) -> float: ... + +def radians(__x: _SupportsFloatOrIndex) -> float: ... +def remainder(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... +def sin(__x: _SupportsFloatOrIndex) -> float: ... +def sinh(__x: _SupportsFloatOrIndex) -> float: ... +def sqrt(__x: _SupportsFloatOrIndex) -> float: ... +def tan(__x: _SupportsFloatOrIndex) -> float: ... +def tanh(__x: _SupportsFloatOrIndex) -> float: ... def trunc(__x: SupportsTrunc) -> int: ... if sys.version_info >= (3, 9): - def ulp(__x: SupportsFloat) -> float: ... + def ulp(__x: _SupportsFloatOrIndex) -> float: ... diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 5a3ec91..c2b6ff2 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -1,12 +1,29 @@ import sys from _typeshed import StrPath -from typing import IO, Sequence, Tuple +from collections.abc import Sequence +from typing import IO + +__all__ = [ + "knownfiles", + "inited", + "MimeTypes", + "guess_type", + "guess_all_extensions", + "guess_extension", + "add_type", + "init", + "read_mime_types", + "suffix_map", + "encodings_map", + "types_map", + "common_types", +] if sys.version_info >= (3, 8): - def guess_type(url: StrPath, strict: bool = ...) -> Tuple[str | None, str | None]: ... + def guess_type(url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ... else: - def guess_type(url: str, strict: bool = ...) -> Tuple[str | None, str | None]: ... + def guess_type(url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... def guess_all_extensions(type: str, strict: bool = ...) -> list[str]: ... def guess_extension(type: str, strict: bool = ...) -> str | None: ... @@ -24,11 +41,15 @@ common_types: dict[str, str] class MimeTypes: suffix_map: dict[str, str] encodings_map: dict[str, str] - types_map: Tuple[dict[str, str], dict[str, str]] - types_map_inv: Tuple[dict[str, str], dict[str, str]] - def __init__(self, filenames: Tuple[str, ...] = ..., strict: bool = ...) -> None: ... + types_map: tuple[dict[str, str], dict[str, str]] + types_map_inv: tuple[dict[str, str], dict[str, str]] + def __init__(self, filenames: tuple[str, ...] = ..., strict: bool = ...) -> None: ... def guess_extension(self, type: str, strict: bool = ...) -> str | None: ... - def guess_type(self, url: str, strict: bool = ...) -> Tuple[str | None, str | None]: ... + if sys.version_info >= (3, 8): + def guess_type(self, url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ... + else: + def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... + def guess_all_extensions(self, type: str, strict: bool = ...) -> list[str]: ... def read(self, filename: str, strict: bool = ...) -> None: ... def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index 4dd8f8c..8dbec23 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -1,6 +1,7 @@ import sys -from _typeshed import ReadableBuffer -from typing import ContextManager, Iterable, Iterator, NoReturn, Sized, overload +from _typeshed import ReadableBuffer, Self +from collections.abc import Iterable, Iterator, Sized +from typing import NoReturn, overload ACCESS_DEFAULT: int ACCESS_READ: int @@ -12,6 +13,8 @@ ALLOCATIONGRANULARITY: int if sys.platform == "linux": MAP_DENYWRITE: int MAP_EXECUTABLE: int + if sys.version_info >= (3, 10): + MAP_POPULATE: int if sys.platform != "win32": MAP_ANON: int @@ -24,18 +27,20 @@ if sys.platform != "win32": PAGESIZE: int -class mmap(ContextManager[mmap], Iterable[int], Sized): +class mmap(Iterable[int], Sized): if sys.platform == "win32": def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ... else: def __init__( self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... ) -> None: ... + def close(self) -> None: ... if sys.version_info >= (3, 8): def flush(self, offset: int = ..., size: int = ...) -> None: ... else: def flush(self, offset: int = ..., size: int = ...) -> int: ... + def move(self, dest: int, src: int, count: int) -> None: ... def read_byte(self) -> int: ... def readline(self) -> bytes: ... @@ -48,22 +53,25 @@ class mmap(ContextManager[mmap], Iterable[int], Sized): closed: bool if sys.version_info >= (3, 8) and sys.platform != "win32": def madvise(self, option: int, start: int = ..., length: int = ...) -> None: ... + def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ... def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ... def read(self, n: int | None = ...) -> bytes: ... def write(self, bytes: ReadableBuffer) -> int: ... @overload - def __getitem__(self, index: int) -> int: ... + def __getitem__(self, __index: int) -> int: ... @overload - def __getitem__(self, index: slice) -> bytes: ... - def __delitem__(self, index: int | slice) -> NoReturn: ... + def __getitem__(self, __index: slice) -> bytes: ... + def __delitem__(self, __index: int | slice) -> NoReturn: ... @overload - def __setitem__(self, index: int, object: int) -> None: ... + def __setitem__(self, __index: int, __object: int) -> None: ... @overload - def __setitem__(self, index: slice, object: ReadableBuffer) -> None: ... + def __setitem__(self, __index: slice, __object: ReadableBuffer) -> None: ... # Doesn't actually exist, but the object is actually iterable because it has __getitem__ and # __len__, so we claim that there is also an __iter__ to help type checkers. def __iter__(self) -> Iterator[int]: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... if sys.version_info >= (3, 8) and sys.platform != "win32": MADV_NORMAL: int @@ -71,6 +79,7 @@ if sys.version_info >= (3, 8) and sys.platform != "win32": MADV_SEQUENTIAL: int MADV_WILLNEED: int MADV_DONTNEED: int + MADV_FREE: int if sys.platform == "linux": MADV_REMOVE: int @@ -86,7 +95,6 @@ if sys.version_info >= (3, 8) and sys.platform != "win32": MADV_NOHUGEPAGE: int MADV_DONTDUMP: int MADV_DODUMP: int - MADV_FREE: int # This Values are defined for FreeBSD but type checkers do not support conditions for these if sys.platform != "linux" and sys.platform != "darwin": diff --git a/stdlib/modulefinder.pyi b/stdlib/modulefinder.pyi index 89f8bd4..caed7ef 100644 --- a/stdlib/modulefinder.pyi +++ b/stdlib/modulefinder.pyi @@ -1,13 +1,15 @@ import sys +from collections.abc import Container, Iterable, Iterator, Sequence from types import CodeType -from typing import IO, Any, Container, Iterable, Iterator, Sequence, Tuple +from typing import IO, Any -LOAD_CONST: int # undocumented -IMPORT_NAME: int # undocumented -STORE_NAME: int # undocumented -STORE_GLOBAL: int # undocumented -STORE_OPS: Tuple[int, int] # undocumented -EXTENDED_ARG: int # undocumented +if sys.version_info < (3, 11): + LOAD_CONST: int # undocumented + IMPORT_NAME: int # undocumented + STORE_NAME: int # undocumented + STORE_GLOBAL: int # undocumented + STORE_OPS: tuple[int, int] # undocumented + EXTENDED_ARG: int # undocumented packagePathMap: dict[str, list[str]] # undocumented @@ -19,7 +21,6 @@ def ReplacePackage(oldname: str, newname: str) -> None: ... class Module: # undocumented def __init__(self, name: str, file: str | None = ..., path: str | None = ...) -> None: ... - def __repr__(self) -> str: ... class ModuleFinder: @@ -29,7 +30,7 @@ class ModuleFinder: debug: int # undocumented indent: int # undocumented excludes: Container[str] # undocumented - replace_paths: Sequence[Tuple[str, str]] # undocumented + replace_paths: Sequence[tuple[str, str]] # undocumented if sys.version_info >= (3, 8): def __init__( @@ -37,7 +38,7 @@ class ModuleFinder: path: list[str] | None = ..., debug: int = ..., excludes: Container[str] | None = ..., - replace_paths: Sequence[Tuple[str, str]] | None = ..., + replace_paths: Sequence[tuple[str, str]] | None = ..., ) -> None: ... else: def __init__( @@ -45,8 +46,9 @@ class ModuleFinder: path: list[str] | None = ..., debug: int = ..., excludes: Container[str] = ..., - replace_paths: Sequence[Tuple[str, str]] = ..., + replace_paths: Sequence[tuple[str, str]] = ..., ) -> None: ... + def msg(self, level: int, str: str, *args: Any) -> None: ... # undocumented def msgin(self, *args: Any) -> None: ... # undocumented def msgout(self, *args: Any) -> None: ... # undocumented @@ -56,20 +58,20 @@ class ModuleFinder: self, name: str, caller: Module | None = ..., fromlist: list[str] | None = ..., level: int = ... ) -> Module | None: ... # undocumented def determine_parent(self, caller: Module | None, level: int = ...) -> Module | None: ... # undocumented - def find_head_package(self, parent: Module, name: str) -> Tuple[Module, str]: ... # undocumented + def find_head_package(self, parent: Module, name: str) -> tuple[Module, str]: ... # undocumented def load_tail(self, q: Module, tail: str) -> Module: ... # undocumented def ensure_fromlist(self, m: Module, fromlist: Iterable[str], recursive: int = ...) -> None: ... # undocumented def find_all_submodules(self, m: Module) -> Iterable[str]: ... # undocumented def import_module(self, partname: str, fqname: str, parent: Module) -> Module | None: ... # undocumented - def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: Tuple[str, str, str]) -> Module: ... # undocumented - def scan_opcodes(self, co: CodeType) -> Iterator[Tuple[str, Tuple[Any, ...]]]: ... # undocumented + def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: tuple[str, str, str]) -> Module: ... # undocumented + def scan_opcodes(self, co: CodeType) -> Iterator[tuple[str, tuple[Any, ...]]]: ... # undocumented def scan_code(self, co: CodeType, m: Module) -> None: ... # undocumented def load_package(self, fqname: str, pathname: str) -> Module: ... # undocumented def add_module(self, fqname: str) -> Module: ... # undocumented def find_module( self, name: str, path: str | None, parent: Module | None = ... - ) -> Tuple[IO[Any] | None, str | None, Tuple[str, str, int]]: ... # undocumented + ) -> tuple[IO[Any] | None, str | None, tuple[str, str, int]]: ... # undocumented def report(self) -> None: ... def any_missing(self) -> list[str]: ... # undocumented - def any_missing_maybe(self) -> Tuple[list[str], list[str]]: ... # undocumented + def any_missing_maybe(self) -> tuple[list[str], list[str]]: ... # undocumented def replace_paths_in_code(self, co: CodeType) -> CodeType: ... # undocumented diff --git a/stdlib/msilib/__init__.pyi b/stdlib/msilib/__init__.pyi index ca05ee6..0e18350 100644 --- a/stdlib/msilib/__init__.pyi +++ b/stdlib/msilib/__init__.pyi @@ -1,14 +1,14 @@ import sys +from collections.abc import Container, Iterable, Sequence from types import ModuleType -from typing import Any, Container, Iterable, Sequence, Set, Tuple, Type +from typing import Any from typing_extensions import Literal if sys.platform == "win32": + from _msi import * from _msi import _Database AMD64: bool - if sys.version_info < (3, 7): - Itanium: bool Win64: bool datasizemask: Literal[0x00FF] @@ -22,22 +22,25 @@ if sys.platform == "win32": type_nullable: Literal[0x1000] type_key: Literal[0x2000] knownbits: Literal[0x3FFF] + class Table: name: str - fields: list[Tuple[int, str, int]] + fields: list[tuple[int, str, int]] def __init__(self, name: str) -> None: ... def add_field(self, index: int, name: str, type: int) -> None: ... def sql(self) -> str: ... def create(self, db: _Database) -> None: ... + class _Unspecified: ... + def change_sequence( - seq: Sequence[Tuple[str, str | None, int]], + seq: Sequence[tuple[str, str | None, int]], action: str, - seqno: int | Type[_Unspecified] = ..., - cond: str | Type[_Unspecified] = ..., + seqno: int | type[_Unspecified] = ..., + cond: str | type[_Unspecified] = ..., ) -> None: ... - def add_data(db: _Database, table: str, values: Iterable[Tuple[Any, ...]]) -> None: ... + def add_data(db: _Database, table: str, values: Iterable[tuple[Any, ...]]) -> None: ... def add_stream(db: _Database, name: str, path: str) -> None: ... def init_database( name: str, schema: ModuleType, ProductName: str, ProductCode: str, ProductVersion: str, Manufacturer: str @@ -45,17 +48,19 @@ if sys.platform == "win32": def add_tables(db: _Database, module: ModuleType) -> None: ... def make_id(str: str) -> str: ... def gen_uuid() -> str: ... + class CAB: name: str - files: list[Tuple[str, str]] - filenames: Set[str] + files: list[tuple[str, str]] + filenames: set[str] index: int def __init__(self, name: str) -> None: ... def gen_id(self, file: str) -> str: ... - def append(self, full: str, file: str, logical: str) -> Tuple[int, str]: ... + def append(self, full: str, file: str, logical: str) -> tuple[int, str]: ... def commit(self, db: _Database) -> None: ... - _directories: Set[str] + _directories: set[str] + class Directory: db: _Database @@ -64,8 +69,8 @@ if sys.platform == "win32": physical: str logical: str component: str | None - short_names: Set[str] - ids: Set[str] + short_names: set[str] + ids: set[str] keyfiles: dict[str, str] componentflags: int | None absolute: str @@ -91,11 +96,12 @@ if sys.platform == "win32": def add_file(self, file: str, src: str | None = ..., version: str | None = ..., language: str | None = ...) -> str: ... def glob(self, pattern: str, exclude: Container[str] | None = ...) -> list[str]: ... def remove_pyc(self) -> None: ... + class Binary: name: str def __init__(self, fname: str) -> None: ... - def __repr__(self) -> str: ... + class Feature: id: str @@ -112,6 +118,7 @@ if sys.platform == "win32": attributes: int = ..., ) -> None: ... def set_current(self) -> None: ... + class Control: dlg: Dialog @@ -120,12 +127,14 @@ if sys.platform == "win32": def event(self, event: str, argument: str, condition: str = ..., ordering: int | None = ...) -> None: ... def mapping(self, event: str, attribute: str) -> None: ... def condition(self, action: str, condition: str) -> None: ... + class RadioButtonGroup(Control): property: str index: int def __init__(self, dlg: Dialog, name: str, property: str) -> None: ... def add(self, name: str, x: int, y: int, w: int, h: int, text: str, value: str | None = ...) -> None: ... + class Dialog: db: _Database diff --git a/stdlib/msilib/schema.pyi b/stdlib/msilib/schema.pyi index df57ade..4ad9a17 100644 --- a/stdlib/msilib/schema.pyi +++ b/stdlib/msilib/schema.pyi @@ -1,5 +1,4 @@ import sys -from typing import Tuple if sys.platform == "win32": from . import Table @@ -92,4 +91,4 @@ if sys.platform == "win32": tables: list[Table] - _Validation_records: list[Tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] + _Validation_records: list[tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] diff --git a/stdlib/msilib/sequence.pyi b/stdlib/msilib/sequence.pyi index 123d232..9cc1e0e 100644 --- a/stdlib/msilib/sequence.pyi +++ b/stdlib/msilib/sequence.pyi @@ -1,9 +1,9 @@ import sys -from typing import List, Optional, Tuple +from typing_extensions import TypeAlias if sys.platform == "win32": - _SequenceType = List[Tuple[str, Optional[str], int]] + _SequenceType: TypeAlias = list[tuple[str, str | None, int]] AdminExecuteSequence: _SequenceType AdminUISequence: _SequenceType diff --git a/stdlib/msilib/text.pyi b/stdlib/msilib/text.pyi index fe2dc23..879429e 100644 --- a/stdlib/msilib/text.pyi +++ b/stdlib/msilib/text.pyi @@ -1,9 +1,8 @@ import sys -from typing import Tuple if sys.platform == "win32": - ActionText: list[Tuple[str, str, str | None]] - UIText: list[Tuple[str, str | None]] + ActionText: list[tuple[str, str, str | None]] + UIText: list[tuple[str, str | None]] tables: list[str] diff --git a/stdlib/msvcrt.pyi b/stdlib/msvcrt.pyi index 0441ed8..5849b9b 100644 --- a/stdlib/msvcrt.pyi +++ b/stdlib/msvcrt.pyi @@ -1,12 +1,17 @@ import sys +from typing_extensions import Literal # This module is only available on Windows if sys.platform == "win32": - LK_LOCK: int - LK_NBLCK: int - LK_NBRLCK: int - LK_RLCK: int - LK_UNLCK: int + LK_UNLCK: Literal[0] + LK_LOCK: Literal[1] + LK_NBLCK: Literal[2] + LK_RLCK: Literal[3] + LK_NBRLCK: Literal[4] + SEM_FAILCRITICALERRORS: int + SEM_NOALIGNMENTFAULTEXCEPT: int + SEM_NOGPFAULTERRORBOX: int + SEM_NOOPENFILEERRORBOX: int def locking(__fd: int, __mode: int, __nbytes: int) -> None: ... def setmode(__fd: int, __mode: int) -> int: ... def open_osfhandle(__handle: int, __flags: int) -> int: ... @@ -16,8 +21,8 @@ if sys.platform == "win32": def getwch() -> str: ... def getche() -> bytes: ... def getwche() -> str: ... - def putch(__char: bytes) -> None: ... + def putch(__char: bytes | bytearray) -> None: ... def putwch(__unicode_char: str) -> None: ... - def ungetch(__char: bytes) -> None: ... + def ungetch(__char: bytes | bytearray) -> None: ... def ungetwch(__unicode_char: str) -> None: ... def heapmin() -> None: ... diff --git a/stdlib/multiprocessing/__init__.pyi b/stdlib/multiprocessing/__init__.pyi index 53b0c98..186bd54 100644 --- a/stdlib/multiprocessing/__init__.pyi +++ b/stdlib/multiprocessing/__init__.pyi @@ -1,108 +1,92 @@ import sys -from collections.abc import Callable, Iterable -from logging import Logger -from multiprocessing import connection, context, pool, synchronize +from multiprocessing import context, reduction as reducer from multiprocessing.context import ( AuthenticationError as AuthenticationError, - BaseContext, BufferTooShort as BufferTooShort, - DefaultContext, Process as Process, ProcessError as ProcessError, - SpawnContext, TimeoutError as TimeoutError, ) -from multiprocessing.managers import SyncManager from multiprocessing.process import active_children as active_children, current_process as current_process # These are technically functions that return instances of these Queue classes. -# Using them as annotations is deprecated. Either use imports from -# multiprocessing.queues or the aliases defined below. See #4266 for discussion. +# The stub here doesn't reflect reality exactly -- +# while e.g. `multiprocessing.queues.Queue` is a class, +# `multiprocessing.Queue` is actually a function at runtime. +# Avoid using `multiprocessing.Queue` as a type annotation; +# use imports from multiprocessing.queues instead. +# See #4266 and #8450 for discussion. from multiprocessing.queues import JoinableQueue as JoinableQueue, Queue as Queue, SimpleQueue as SimpleQueue from multiprocessing.spawn import freeze_support as freeze_support -from typing import Any, Union, overload -from typing_extensions import Literal if sys.version_info >= (3, 8): from multiprocessing.process import parent_process as parent_process -if sys.platform != "win32": - from multiprocessing.context import ForkContext, ForkServerContext +__all__ = [ + "Array", + "AuthenticationError", + "Barrier", + "BoundedSemaphore", + "BufferTooShort", + "Condition", + "Event", + "JoinableQueue", + "Lock", + "Manager", + "Pipe", + "Pool", + "Process", + "ProcessError", + "Queue", + "RLock", + "RawArray", + "RawValue", + "Semaphore", + "SimpleQueue", + "TimeoutError", + "Value", + "active_children", + "allow_connection_pickling", + "cpu_count", + "current_process", + "freeze_support", + "get_all_start_methods", + "get_context", + "get_logger", + "get_start_method", + "log_to_stderr", + "reducer", + "set_executable", + "set_forkserver_preload", + "set_start_method", +] -# The following type aliases can be used to annotate the return values of -# the corresponding functions. They are not defined at runtime. -# -# from multiprocessing import Lock -# from typing import TYPE_CHECKING -# if TYPE_CHECKING: -# from multiprocessing import _LockType -# lock: _LockType = Lock() - -_QueueType = Queue -_SimpleQueueType = SimpleQueue -_JoinableQueueType = JoinableQueue -_BarrierType = synchronize.Barrier -_BoundedSemaphoreType = synchronize.BoundedSemaphore -_ConditionType = synchronize.Condition -_EventType = synchronize.Event -_LockType = synchronize.Lock -_RLockType = synchronize.RLock -_SemaphoreType = synchronize.Semaphore - -# N.B. The functions below are generated at runtime by partially applying -# multiprocessing.context.BaseContext's methods, so the two signatures should -# be identical (modulo self). +if sys.version_info >= (3, 8): + __all__ += ["parent_process"] -# Sychronization primitives -_LockLike = Union[synchronize.Lock, synchronize.RLock] +# These functions (really bound methods) +# are all autogenerated at runtime here: https://github.com/python/cpython/blob/600c65c094b0b48704d8ec2416930648052ba715/Lib/multiprocessing/__init__.py#L23 RawValue = context._default_context.RawValue RawArray = context._default_context.RawArray Value = context._default_context.Value Array = context._default_context.Array - -def Barrier(parties: int, action: Callable[..., Any] | None = ..., timeout: float | None = ...) -> _BarrierType: ... -def BoundedSemaphore(value: int = ...) -> _BoundedSemaphoreType: ... -def Condition(lock: _LockLike | None = ...) -> _ConditionType: ... -def Event() -> _EventType: ... -def Lock() -> _LockType: ... -def RLock() -> _RLockType: ... -def Semaphore(value: int = ...) -> _SemaphoreType: ... -def Pipe(duplex: bool = ...) -> tuple[connection.Connection, connection.Connection]: ... -def Pool( - processes: int | None = ..., - initializer: Callable[..., Any] | None = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: int | None = ..., -) -> pool.Pool: ... - -# ----- multiprocessing function stubs ----- -def allow_connection_pickling() -> None: ... -def cpu_count() -> int: ... -def get_logger() -> Logger: ... -def log_to_stderr(level: str | int | None = ...) -> Logger: ... -def Manager() -> SyncManager: ... -def set_executable(executable: str) -> None: ... -def set_forkserver_preload(module_names: list[str]) -> None: ... -def get_all_start_methods() -> list[str]: ... -def get_start_method(allow_none: bool = ...) -> str | None: ... -def set_start_method(method: str, force: bool | None = ...) -> None: ... - -if sys.platform != "win32": - @overload - def get_context(method: None = ...) -> DefaultContext: ... - @overload - def get_context(method: Literal["spawn"]) -> SpawnContext: ... - @overload - def get_context(method: Literal["fork"]) -> ForkContext: ... - @overload - def get_context(method: Literal["forkserver"]) -> ForkServerContext: ... - @overload - def get_context(method: str) -> BaseContext: ... - -else: - @overload - def get_context(method: None = ...) -> DefaultContext: ... - @overload - def get_context(method: Literal["spawn"]) -> SpawnContext: ... - @overload - def get_context(method: str) -> BaseContext: ... +Barrier = context._default_context.Barrier +BoundedSemaphore = context._default_context.BoundedSemaphore +Condition = context._default_context.Condition +Event = context._default_context.Event +Lock = context._default_context.Lock +RLock = context._default_context.RLock +Semaphore = context._default_context.Semaphore +Pipe = context._default_context.Pipe +Pool = context._default_context.Pool +allow_connection_pickling = context._default_context.allow_connection_pickling +cpu_count = context._default_context.cpu_count +get_logger = context._default_context.get_logger +log_to_stderr = context._default_context.log_to_stderr +Manager = context._default_context.Manager +set_executable = context._default_context.set_executable +set_forkserver_preload = context._default_context.set_forkserver_preload +get_all_start_methods = context._default_context.get_all_start_methods +get_start_method = context._default_context.get_start_method +set_start_method = context._default_context.set_start_method +get_context = context._default_context.get_context diff --git a/stdlib/multiprocessing/connection.pyi b/stdlib/multiprocessing/connection.pyi index 4f6dc1b..5036f0e 100644 --- a/stdlib/multiprocessing/connection.pyi +++ b/stdlib/multiprocessing/connection.pyi @@ -1,20 +1,18 @@ import socket import sys import types -from _typeshed import Self -from typing import Any, Iterable, Tuple, Type, Union +from _typeshed import ReadableBuffer, Self +from collections.abc import Iterable +from typing import Any, Union +from typing_extensions import SupportsIndex, TypeAlias -if sys.version_info >= (3, 8): - from typing import SupportsIndex +__all__ = ["Client", "Listener", "Pipe", "wait"] # https://docs.python.org/3/library/multiprocessing.html#address-formats -_Address = Union[str, Tuple[str, int]] +_Address: TypeAlias = Union[str, tuple[str, int]] class _ConnectionBase: - if sys.version_info >= (3, 8): - def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ... - else: - def __init__(self, handle: int, readable: bool = ..., writable: bool = ...) -> None: ... + def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ... @property def closed(self) -> bool: ... # undocumented @property @@ -23,7 +21,7 @@ class _ConnectionBase: def writable(self) -> bool: ... # undocumented def fileno(self) -> int: ... def close(self) -> None: ... - def send_bytes(self, buf: bytes, offset: int = ..., size: int | None = ...) -> None: ... + def send_bytes(self, buf: ReadableBuffer, offset: int = ..., size: int | None = ...) -> None: ... def send(self, obj: Any) -> None: ... def recv_bytes(self, maxlength: int | None = ...) -> bytes: ... def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ... @@ -31,7 +29,7 @@ class _ConnectionBase: def poll(self, timeout: float | None = ...) -> bool: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None ) -> None: ... class Connection(_ConnectionBase): ... @@ -51,7 +49,7 @@ class Listener: def last_accepted(self) -> _Address | None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None ) -> None: ... def deliver_challenge(connection: Connection, authkey: bytes) -> None: ... @@ -60,4 +58,12 @@ def wait( object_list: Iterable[Connection | socket.socket | int], timeout: float | None = ... ) -> list[Connection | socket.socket | int]: ... def Client(address: _Address, family: str | None = ..., authkey: bytes | None = ...) -> Connection: ... -def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... + +# N.B. Keep this in sync with multiprocessing.context.BaseContext.Pipe. +# _ConnectionBase is the common base class of Connection and PipeConnection +# and can be used in cross-platform code. +if sys.platform != "win32": + def Pipe(duplex: bool = ...) -> tuple[Connection, Connection]: ... + +else: + def Pipe(duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ... diff --git a/stdlib/multiprocessing/context.pyi b/stdlib/multiprocessing/context.pyi index e65a387..f6380e2 100644 --- a/stdlib/multiprocessing/context.pyi +++ b/stdlib/multiprocessing/context.pyi @@ -1,17 +1,27 @@ import ctypes -import multiprocessing import sys from collections.abc import Callable, Iterable, Sequence from ctypes import _CData from logging import Logger -from multiprocessing import queues, synchronize +from multiprocessing import popen_fork, popen_forkserver, popen_spawn_posix, popen_spawn_win32, queues, synchronize +from multiprocessing.managers import SyncManager from multiprocessing.pool import Pool as _Pool from multiprocessing.process import BaseProcess from multiprocessing.sharedctypes import SynchronizedArray, SynchronizedBase -from typing import Any, Type, TypeVar, Union, overload -from typing_extensions import Literal +from typing import Any, ClassVar, TypeVar, overload +from typing_extensions import Literal, TypeAlias -_LockLike = Union[synchronize.Lock, synchronize.RLock] +if sys.platform != "win32": + from multiprocessing.connection import Connection +else: + from multiprocessing.connection import PipeConnection + +if sys.version_info >= (3, 8): + __all__ = () +else: + __all__: list[str] = [] + +_LockLike: TypeAlias = synchronize.Lock | synchronize.RLock _CT = TypeVar("_CT", bound=_CData) class ProcessError(Exception): ... @@ -19,12 +29,11 @@ class BufferTooShort(ProcessError): ... class TimeoutError(ProcessError): ... class AuthenticationError(ProcessError): ... -class BaseContext(object): - Process: Type[BaseProcess] - ProcessError: Type[Exception] - BufferTooShort: Type[Exception] - TimeoutError: Type[Exception] - AuthenticationError: Type[Exception] +class BaseContext: + ProcessError: ClassVar[type[ProcessError]] + BufferTooShort: ClassVar[type[BufferTooShort]] + TimeoutError: ClassVar[type[TimeoutError]] + AuthenticationError: ClassVar[type[AuthenticationError]] # N.B. The methods below are applied at runtime to generate # multiprocessing.*, so the signatures should be identical (modulo self). @@ -33,15 +42,22 @@ class BaseContext(object): if sys.version_info >= (3, 8): @staticmethod def parent_process() -> BaseProcess | None: ... + @staticmethod def active_children() -> list[BaseProcess]: ... def cpu_count(self) -> int: ... - # TODO: change return to SyncManager once a stub exists in multiprocessing.managers - def Manager(self) -> Any: ... - # TODO: change return to Pipe once a stub exists in multiprocessing.connection - def Pipe(self, duplex: bool = ...) -> Any: ... + def Manager(self) -> SyncManager: ... + + # N.B. Keep this in sync with multiprocessing.connection.Pipe. + # _ConnectionBase is the common base class of Connection and PipeConnection + # and can be used in cross-platform code. + if sys.platform != "win32": + def Pipe(self, duplex: bool = ...) -> tuple[Connection, Connection]: ... + else: + def Pipe(self, duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ... + def Barrier( - self, parties: int, action: Callable[..., Any] | None = ..., timeout: float | None = ... + self, parties: int, action: Callable[..., object] | None = ..., timeout: float | None = ... ) -> synchronize.Barrier: ... def BoundedSemaphore(self, value: int = ...) -> synchronize.BoundedSemaphore: ... def Condition(self, lock: _LockLike | None = ...) -> synchronize.Condition: ... @@ -55,39 +71,39 @@ class BaseContext(object): def Pool( self, processes: int | None = ..., - initializer: Callable[..., Any] | None = ..., + initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ..., maxtasksperchild: int | None = ..., ) -> _Pool: ... @overload - def RawValue(self, typecode_or_type: Type[_CT], *args: Any) -> _CT: ... + def RawValue(self, typecode_or_type: type[_CT], *args: Any) -> _CT: ... @overload def RawValue(self, typecode_or_type: str, *args: Any) -> Any: ... @overload - def RawArray(self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ... + def RawArray(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ... @overload def RawArray(self, typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ... @overload - def Value(self, typecode_or_type: Type[_CT], *args: Any, lock: Literal[False]) -> _CT: ... + def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> _CT: ... @overload - def Value(self, typecode_or_type: Type[_CT], *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[_CT]: ... + def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[_CT]: ... @overload - def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[Any]: ... + def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[Any]: ... @overload - def Value(self, typecode_or_type: str | Type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ... + def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ... @overload - def Array(self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ... + def Array(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ... @overload def Array( - self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike + self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ... ) -> SynchronizedArray[_CT]: ... @overload def Array( - self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike + self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ... ) -> SynchronizedArray[Any]: ... @overload def Array( - self, typecode_or_type: str | Type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ... + self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ... ) -> Any: ... def freeze_support(self) -> None: ... def get_logger(self) -> Logger: ... @@ -113,7 +129,11 @@ class BaseContext(object): def get_context(self, method: Literal["spawn"]) -> SpawnContext: ... @overload def get_context(self, method: str) -> BaseContext: ... - def get_start_method(self, allow_none: bool = ...) -> str: ... + + @overload + def get_start_method(self, allow_none: Literal[False] = ...) -> str: ... + @overload + def get_start_method(self, allow_none: bool) -> str | None: ... def set_start_method(self, method: str | None, force: bool = ...) -> None: ... @property def reducer(self) -> str: ... @@ -127,45 +147,46 @@ class Process(BaseProcess): def _Popen(process_obj: BaseProcess) -> DefaultContext: ... class DefaultContext(BaseContext): - Process: Type[multiprocessing.Process] + Process: ClassVar[type[Process]] def __init__(self, context: BaseContext) -> None: ... - def set_start_method(self, method: str | None, force: bool = ...) -> None: ... def get_start_method(self, allow_none: bool = ...) -> str: ... def get_all_start_methods(self) -> list[str]: ... + if sys.version_info < (3, 8): + __all__: ClassVar[list[str]] _default_context: DefaultContext +class SpawnProcess(BaseProcess): + _start_method: str + if sys.platform != "win32": + @staticmethod + def _Popen(process_obj: BaseProcess) -> popen_spawn_posix.Popen: ... + else: + @staticmethod + def _Popen(process_obj: BaseProcess) -> popen_spawn_win32.Popen: ... + +class SpawnContext(BaseContext): + _name: str + Process: ClassVar[type[SpawnProcess]] + if sys.platform != "win32": class ForkProcess(BaseProcess): _start_method: str @staticmethod - def _Popen(process_obj: BaseProcess) -> Any: ... - class SpawnProcess(BaseProcess): - _start_method: str - @staticmethod - def _Popen(process_obj: BaseProcess) -> SpawnProcess: ... + def _Popen(process_obj: BaseProcess) -> popen_fork.Popen: ... + class ForkServerProcess(BaseProcess): _start_method: str @staticmethod - def _Popen(process_obj: BaseProcess) -> Any: ... + def _Popen(process_obj: BaseProcess) -> popen_forkserver.Popen: ... + class ForkContext(BaseContext): _name: str - Process: Type[ForkProcess] - class SpawnContext(BaseContext): - _name: str - Process: Type[SpawnProcess] - class ForkServerContext(BaseContext): - _name: str - Process: Type[ForkServerProcess] + Process: ClassVar[type[ForkProcess]] -else: - class SpawnProcess(BaseProcess): - _start_method: str - @staticmethod - def _Popen(process_obj: BaseProcess) -> Any: ... - class SpawnContext(BaseContext): + class ForkServerContext(BaseContext): _name: str - Process: Type[SpawnProcess] + Process: ClassVar[type[ForkServerProcess]] def _force_start_method(method: str) -> None: ... def get_spawning_popen() -> Any | None: ... diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index b4d1c84..5d289c0 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -1,28 +1,54 @@ import array import threading import weakref +from collections.abc import Callable, Iterable, Mapping, Sequence from queue import Queue as Queue -from typing import Any, Callable, Iterable, Mapping, Sequence +from threading import ( + Barrier as Barrier, + BoundedSemaphore as BoundedSemaphore, + Condition as Condition, + Event as Event, + Lock as Lock, + RLock as RLock, + Semaphore as Semaphore, +) +from typing import Any +from typing_extensions import Literal + +from .connection import Pipe as Pipe + +__all__ = [ + "Process", + "current_process", + "active_children", + "freeze_support", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Condition", + "Event", + "Barrier", + "Queue", + "Manager", + "Pipe", + "Pool", + "JoinableQueue", +] JoinableQueue = Queue -Barrier = threading.Barrier -BoundedSemaphore = threading.BoundedSemaphore -Condition = threading.Condition -Event = threading.Event -Lock = threading.Lock -RLock = threading.RLock -Semaphore = threading.Semaphore class DummyProcess(threading.Thread): _children: weakref.WeakKeyDictionary[Any, Any] _parent: threading.Thread _pid: None _start_called: int - exitcode: int | None + @property + def exitcode(self) -> Literal[0] | None: ... def __init__( self, group: Any = ..., - target: Callable[..., Any] | None = ..., + target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ..., @@ -43,8 +69,10 @@ class Value: def Array(typecode: Any, sequence: Sequence[Any], lock: Any = ...) -> array.array[Any]: ... def Manager() -> Any: ... -def Pool(processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ...) -> Any: ... +def Pool(processes: int | None = ..., initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ...) -> Any: ... def active_children() -> list[Any]: ... -def current_process() -> threading.Thread: ... + +current_process = threading.current_thread + def freeze_support() -> None: ... def shutdown() -> None: ... diff --git a/stdlib/multiprocessing/dummy/connection.pyi b/stdlib/multiprocessing/dummy/connection.pyi index 71e9a50..fd909d0 100644 --- a/stdlib/multiprocessing/dummy/connection.pyi +++ b/stdlib/multiprocessing/dummy/connection.pyi @@ -1,13 +1,16 @@ from _typeshed import Self from queue import Queue from types import TracebackType -from typing import Any, Tuple, Type, Union +from typing import Any, Union +from typing_extensions import TypeAlias + +__all__ = ["Client", "Listener", "Pipe"] families: list[None] -_Address = Union[str, Tuple[str, int]] +_Address: TypeAlias = Union[str, tuple[str, int]] -class Connection(object): +class Connection: _in: Any _out: Any recv: Any @@ -16,23 +19,23 @@ class Connection(object): send_bytes: Any def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def __init__(self, _in: Any, _out: Any) -> None: ... def close(self) -> None: ... def poll(self, timeout: float = ...) -> bool: ... -class Listener(object): +class Listener: _backlog_queue: Queue[Any] | None @property def address(self) -> Queue[Any] | None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def __init__(self, address: _Address | None = ..., family: int | None = ..., backlog: int = ...) -> None: ... def accept(self) -> Connection: ... def close(self) -> None: ... def Client(address: _Address) -> Connection: ... -def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... +def Pipe(duplex: bool = ...) -> tuple[Connection, Connection]: ... diff --git a/stdlib/multiprocessing/forkserver.pyi b/stdlib/multiprocessing/forkserver.pyi new file mode 100644 index 0000000..10269df --- /dev/null +++ b/stdlib/multiprocessing/forkserver.pyi @@ -0,0 +1,31 @@ +from _typeshed import FileDescriptorLike +from collections.abc import Sequence +from struct import Struct +from typing import Any + +__all__ = ["ensure_running", "get_inherited_fds", "connect_to_new_process", "set_forkserver_preload"] + +MAXFDS_TO_SEND: int +SIGNED_STRUCT: Struct + +class ForkServer: + def set_forkserver_preload(self, modules_names: list[str]) -> None: ... + def get_inherited_fds(self) -> list[int] | None: ... + def connect_to_new_process(self, fds: Sequence[int]) -> tuple[int, int]: ... + def ensure_running(self) -> None: ... + +def main( + listener_fd: int | None, + alive_r: FileDescriptorLike, + preload: Sequence[str], + main_path: str | None = ..., + sys_path: object | None = ..., +) -> None: ... +def read_signed(fd: int) -> Any: ... +def write_signed(fd: int, n: int) -> None: ... + +_forkserver: ForkServer = ... +ensure_running = _forkserver.ensure_running +get_inherited_fds = _forkserver.get_inherited_fds +connect_to_new_process = _forkserver.connect_to_new_process +set_forkserver_preload = _forkserver.set_forkserver_preload diff --git a/stdlib/multiprocessing/heap.pyi b/stdlib/multiprocessing/heap.pyi new file mode 100644 index 0000000..9c8f556 --- /dev/null +++ b/stdlib/multiprocessing/heap.pyi @@ -0,0 +1,36 @@ +import sys +from _typeshed import Incomplete +from collections.abc import Callable +from mmap import mmap +from typing import Protocol +from typing_extensions import TypeAlias + +__all__ = ["BufferWrapper"] + +class Arena: + size: int + buffer: mmap + if sys.platform == "win32": + name: str + def __init__(self, size: int) -> None: ... + else: + fd: int + def __init__(self, size: int, fd: int = ...) -> None: ... + +_Block: TypeAlias = tuple[Arena, int, int] + +if sys.platform != "win32": + class _SupportsDetach(Protocol): + def detach(self) -> int: ... + + def reduce_arena(a: Arena) -> tuple[Callable[[int, _SupportsDetach], Arena], tuple[int, Incomplete]]: ... + def rebuild_arena(size: int, dupfd: _SupportsDetach) -> Arena: ... + +class Heap: + def __init__(self, size: int = ...) -> None: ... + def free(self, block: _Block) -> None: ... + def malloc(self, size: int) -> _Block: ... + +class BufferWrapper: + def __init__(self, size: int) -> None: ... + def create_memoryview(self) -> memoryview: ... diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index 568845b..2630e58 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -1,18 +1,22 @@ -# NOTE: These are incomplete! - import queue import sys import threading -from typing import Any, AnyStr, Callable, ContextManager, Generic, Iterable, Mapping, Sequence, Tuple, TypeVar +from _typeshed import Self, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT +from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence +from types import TracebackType +from typing import Any, AnyStr, ClassVar, Generic, TypeVar, overload +from typing_extensions import SupportsIndex, TypeAlias from .connection import Connection from .context import BaseContext if sys.version_info >= (3, 8): - from .shared_memory import _SLT, ShareableList, SharedMemory + from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory + + __all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"] - _SharedMemory = SharedMemory - _ShareableList = ShareableList +else: + __all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token"] if sys.version_info >= (3, 9): from types import GenericAlias @@ -26,18 +30,17 @@ class Namespace: def __getattr__(self, __name: str) -> Any: ... def __setattr__(self, __name: str, __value: Any) -> None: ... -_Namespace = Namespace +_Namespace: TypeAlias = Namespace -class Token(object): +class Token: typeid: str | bytes | None - address: Tuple[str | bytes, int] + address: tuple[str | bytes, int] id: str | bytes | int | None - def __init__(self, typeid: bytes | str | None, address: Tuple[str | bytes, int], id: str | bytes | int | None) -> None: ... - def __repr__(self) -> str: ... - def __getstate__(self) -> Tuple[str | bytes | None, Tuple[str | bytes, int], str | bytes | int | None]: ... - def __setstate__(self, state: Tuple[str | bytes | None, Tuple[str | bytes, int], str | bytes | int | None]) -> None: ... + def __init__(self, typeid: bytes | str | None, address: tuple[str | bytes, int], id: str | bytes | int | None) -> None: ... + def __getstate__(self) -> tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]: ... + def __setstate__(self, state: tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]) -> None: ... -class BaseProxy(object): +class BaseProxy: _address_to_local: dict[Any, Any] _mutex: Any def __init__( @@ -51,9 +54,9 @@ class BaseProxy(object): manager_owned: bool = ..., ) -> None: ... def __deepcopy__(self, memo: Any | None) -> Any: ... - def _callmethod(self, methodname: str, args: Tuple[Any, ...] = ..., kwds: dict[Any, Any] = ...) -> None: ... + def _callmethod(self, methodname: str, args: tuple[Any, ...] = ..., kwds: dict[Any, Any] = ...) -> None: ... def _getvalue(self) -> Any: ... - def __reduce__(self) -> Tuple[Any, Tuple[Any, Any, str, dict[Any, Any]]]: ... + def __reduce__(self) -> tuple[Any, tuple[Any, Any, str, dict[Any, Any]]]: ... class ValueProxy(BaseProxy, Generic[_T]): def get(self) -> _T: ... @@ -62,22 +65,88 @@ class ValueProxy(BaseProxy, Generic[_T]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... +class DictProxy(BaseProxy, MutableMapping[_KT, _VT]): + __builtins__: ClassVar[dict[str, Any]] + def __len__(self) -> int: ... + def __getitem__(self, __key: _KT) -> _VT: ... + def __setitem__(self, __key: _KT, __value: _VT) -> None: ... + def __delitem__(self, __key: _KT) -> None: ... + def __iter__(self) -> Iterator[_KT]: ... + def copy(self) -> dict[_KT, _VT]: ... + @overload + def get(self, __key: _KT) -> _VT | None: ... + @overload + def get(self, __key: _KT, __default: _VT | _T) -> _VT | _T: ... + @overload + def pop(self, __key: _KT) -> _VT: ... + @overload + def pop(self, __key: _KT, __default: _VT | _T) -> _VT | _T: ... + def keys(self) -> list[_KT]: ... # type: ignore[override] + def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] + def values(self) -> list[_VT]: ... # type: ignore[override] + +class BaseListProxy(BaseProxy, MutableSequence[_T]): + __builtins__: ClassVar[dict[str, Any]] + def __len__(self) -> int: ... + def __add__(self, __x: list[_T]) -> list[_T]: ... + def __delitem__(self, __i: SupportsIndex | slice) -> None: ... + @overload + def __getitem__(self, __i: SupportsIndex) -> _T: ... + @overload + def __getitem__(self, __s: slice) -> list[_T]: ... + @overload + def __setitem__(self, __i: SupportsIndex, __o: _T) -> None: ... + @overload + def __setitem__(self, __s: slice, __o: Iterable[_T]) -> None: ... + def __mul__(self, __n: SupportsIndex) -> list[_T]: ... + def __rmul__(self, __n: SupportsIndex) -> list[_T]: ... + def __reversed__(self) -> Iterator[_T]: ... + def append(self, __object: _T) -> None: ... + def extend(self, __iterable: Iterable[_T]) -> None: ... + def pop(self, __index: SupportsIndex = ...) -> _T: ... + def index(self, __value: _T, __start: SupportsIndex = ..., __stop: SupportsIndex = ...) -> int: ... + def count(self, __value: _T) -> int: ... + def insert(self, __index: SupportsIndex, __object: _T) -> None: ... + def remove(self, __value: _T) -> None: ... + # Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison] + # to work around invariance + @overload + def sort(self: BaseListProxy[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...) -> None: ... + @overload + def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ... + +class ListProxy(BaseListProxy[_T]): + def __iadd__(self: Self, __x: Iterable[_T]) -> Self: ... # type: ignore[override] + def __imul__(self: Self, __n: SupportsIndex) -> Self: ... # type: ignore[override] + # Returned by BaseManager.get_server() class Server: address: Any def __init__( - self, registry: dict[str, Tuple[Callable[..., Any], Any, Any, Any]], address: Any, authkey: bytes, serializer: str + self, registry: dict[str, tuple[Callable[..., Any], Any, Any, Any]], address: Any, authkey: bytes, serializer: str ) -> None: ... def serve_forever(self) -> None: ... def accept_connection(self, c: Connection, name: str) -> None: ... -class BaseManager(ContextManager[BaseManager]): - def __init__( - self, address: Any | None = ..., authkey: bytes | None = ..., serializer: str = ..., ctx: BaseContext | None = ... - ) -> None: ... +class BaseManager: + if sys.version_info >= (3, 11): + def __init__( + self, + address: Any | None = ..., + authkey: bytes | None = ..., + serializer: str = ..., + ctx: BaseContext | None = ..., + *, + shutdown_timeout: float = ..., + ) -> None: ... + else: + def __init__( + self, address: Any | None = ..., authkey: bytes | None = ..., serializer: str = ..., ctx: BaseContext | None = ... + ) -> None: ... + def get_server(self) -> Server: ... def connect(self) -> None: ... - def start(self, initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ...) -> None: ... + def start(self, initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ...) -> None: ... def shutdown(self) -> None: ... # only available after start() was called def join(self, timeout: float | None = ...) -> None: ... # undocumented @property @@ -86,18 +155,18 @@ class BaseManager(ContextManager[BaseManager]): def register( cls, typeid: str, - callable: Callable[..., Any] | None = ..., + callable: Callable[..., object] | None = ..., proxytype: Any = ..., exposed: Sequence[str] | None = ..., method_to_typeid: Mapping[str, str] | None = ..., create_method: bool = ..., ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... -# Conflicts with method names -_dict = dict -_list = list - -class SyncManager(BaseManager, ContextManager[SyncManager]): +class SyncManager(BaseManager): def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ... def Condition(self, lock: Any = ...) -> threading.Condition: ... def Event(self) -> threading.Event: ... @@ -108,13 +177,31 @@ class SyncManager(BaseManager, ContextManager[SyncManager]): def Semaphore(self, value: Any = ...) -> threading.Semaphore: ... def Array(self, typecode: Any, sequence: Sequence[_T]) -> Sequence[_T]: ... def Value(self, typecode: Any, value: _T) -> ValueProxy[_T]: ... - def dict(self, sequence: Mapping[_KT, _VT] = ...) -> _dict[_KT, _VT]: ... - def list(self, sequence: Sequence[_T] = ...) -> _list[_T]: ... + # Overloads are copied from builtins.dict.__init__ + @overload + def dict(self) -> DictProxy[Any, Any]: ... + @overload + def dict(self, **kwargs: _VT) -> DictProxy[str, _VT]: ... + @overload + def dict(self, __map: SupportsKeysAndGetItem[_KT, _VT]) -> DictProxy[_KT, _VT]: ... + @overload + def dict(self, __map: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> DictProxy[str, _VT]: ... + @overload + def dict(self, __iterable: Iterable[tuple[_KT, _VT]]) -> DictProxy[_KT, _VT]: ... + @overload + def dict(self, __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> DictProxy[str, _VT]: ... + @overload + def dict(self, __iterable: Iterable[list[str]]) -> DictProxy[str, str]: ... + @overload + def list(self, __sequence: Sequence[_T]) -> ListProxy[_T]: ... + @overload + def list(self) -> ListProxy[Any]: ... class RemoteError(Exception): ... if sys.version_info >= (3, 8): class SharedMemoryServer(Server): ... + class SharedMemoryManager(BaseManager): def get_server(self) -> SharedMemoryServer: ... def SharedMemory(self, size: int) -> _SharedMemory: ... diff --git a/stdlib/multiprocessing/pool.pyi b/stdlib/multiprocessing/pool.pyi index 20cfc59..2b97e16 100644 --- a/stdlib/multiprocessing/pool.pyi +++ b/stdlib/multiprocessing/pool.pyi @@ -1,26 +1,31 @@ import sys from _typeshed import Self -from typing import Any, Callable, ContextManager, Dict, Generic, Iterable, Iterator, List, Mapping, TypeVar +from collections.abc import Callable, Iterable, Iterator, Mapping +from types import TracebackType +from typing import Any, Generic, TypeVar +from typing_extensions import Literal if sys.version_info >= (3, 9): from types import GenericAlias -_PT = TypeVar("_PT", bound=Pool) +__all__ = ["Pool", "ThreadPool"] + _S = TypeVar("_S") _T = TypeVar("_T") class ApplyResult(Generic[_T]): if sys.version_info >= (3, 8): def __init__( - self, pool: Pool, callback: Callable[[_T], None] | None, error_callback: Callable[[BaseException], None] | None + self, pool: Pool, callback: Callable[[_T], object] | None, error_callback: Callable[[BaseException], object] | None ) -> None: ... else: def __init__( self, - cache: Dict[int, ApplyResult[Any]], - callback: Callable[[_T], None] | None, - error_callback: Callable[[BaseException], None] | None, + cache: dict[int, ApplyResult[Any]], + callback: Callable[[_T], object] | None, + error_callback: Callable[[BaseException], object] | None, ) -> None: ... + def get(self, timeout: float | None = ...) -> _T: ... def wait(self, timeout: float | None = ...) -> None: ... def ready(self) -> bool: ... @@ -31,42 +36,43 @@ class ApplyResult(Generic[_T]): # alias created during issue #17805 AsyncResult = ApplyResult -class MapResult(ApplyResult[List[_T]]): +class MapResult(ApplyResult[list[_T]]): if sys.version_info >= (3, 8): def __init__( self, pool: Pool, chunksize: int, length: int, - callback: Callable[[List[_T]], None] | None, - error_callback: Callable[[BaseException], None] | None, + callback: Callable[[list[_T]], object] | None, + error_callback: Callable[[BaseException], object] | None, ) -> None: ... else: def __init__( self, - cache: Dict[int, ApplyResult[Any]], + cache: dict[int, ApplyResult[Any]], chunksize: int, length: int, - callback: Callable[[List[_T]], None] | None, - error_callback: Callable[[BaseException], None] | None, + callback: Callable[[list[_T]], object] | None, + error_callback: Callable[[BaseException], object] | None, ) -> None: ... class IMapIterator(Iterator[_T]): if sys.version_info >= (3, 8): def __init__(self, pool: Pool) -> None: ... else: - def __init__(self, cache: Dict[int, IMapIterator[Any]]) -> None: ... - def __iter__(self: _S) -> _S: ... + def __init__(self, cache: dict[int, IMapIterator[Any]]) -> None: ... + + def __iter__(self: Self) -> Self: ... def next(self, timeout: float | None = ...) -> _T: ... def __next__(self, timeout: float | None = ...) -> _T: ... class IMapUnorderedIterator(IMapIterator[_T]): ... -class Pool(ContextManager[Pool]): +class Pool: def __init__( self, processes: int | None = ..., - initializer: Callable[..., None] | None = ..., + initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ..., maxtasksperchild: int | None = ..., context: Any | None = ..., @@ -77,8 +83,8 @@ class Pool(ContextManager[Pool]): func: Callable[..., _T], args: Iterable[Any] = ..., kwds: Mapping[str, Any] = ..., - callback: Callable[[_T], None] | None = ..., - error_callback: Callable[[BaseException], None] | None = ..., + callback: Callable[[_T], object] | None = ..., + error_callback: Callable[[BaseException], object] | None = ..., ) -> AsyncResult[_T]: ... def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> list[_T]: ... def map_async( @@ -86,8 +92,8 @@ class Pool(ContextManager[Pool]): func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ..., - callback: Callable[[_T], None] | None = ..., - error_callback: Callable[[BaseException], None] | None = ..., + callback: Callable[[_T], object] | None = ..., + error_callback: Callable[[BaseException], object] | None = ..., ) -> MapResult[_T]: ... def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> IMapIterator[_T]: ... def imap_unordered( @@ -99,26 +105,29 @@ class Pool(ContextManager[Pool]): func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = ..., - callback: Callable[[_T], None] | None = ..., - error_callback: Callable[[BaseException], None] | None = ..., + callback: Callable[[_T], object] | None = ..., + error_callback: Callable[[BaseException], object] | None = ..., ) -> AsyncResult[list[_T]]: ... def close(self) -> None: ... def terminate(self) -> None: ... def join(self) -> None: ... def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... -class ThreadPool(Pool, ContextManager[ThreadPool]): +class ThreadPool(Pool): def __init__( - self, processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ... + self, processes: int | None = ..., initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ... ) -> None: ... # undocumented if sys.version_info >= (3, 8): - INIT: str - RUN: str - CLOSE: str - TERMINATE: str + INIT: Literal["INIT"] + RUN: Literal["RUN"] + CLOSE: Literal["CLOSE"] + TERMINATE: Literal["TERMINATE"] else: - RUN: int - CLOSE: int - TERMINATE: int + RUN: Literal[0] + CLOSE: Literal[1] + TERMINATE: Literal[2] diff --git a/stdlib/multiprocessing/popen_fork.pyi b/stdlib/multiprocessing/popen_fork.pyi new file mode 100644 index 0000000..3db6a84 --- /dev/null +++ b/stdlib/multiprocessing/popen_fork.pyi @@ -0,0 +1,23 @@ +import sys +from typing import ClassVar + +from .process import BaseProcess +from .util import Finalize + +if sys.platform != "win32": + __all__ = ["Popen"] + + class Popen: + finalizer: Finalize | None + method: ClassVar[str] + pid: int + returncode: int | None + sentinel: int # doesn't exist if os.fork in _launch returns 0 + + def __init__(self, process_obj: BaseProcess) -> None: ... + def duplicate_for_child(self, fd: int) -> int: ... + def poll(self, flag: int = ...) -> int | None: ... + def wait(self, timeout: float | None = ...) -> int | None: ... + def terminate(self) -> None: ... + def kill(self) -> None: ... + def close(self) -> None: ... diff --git a/stdlib/multiprocessing/popen_forkserver.pyi b/stdlib/multiprocessing/popen_forkserver.pyi new file mode 100644 index 0000000..f7d53bb --- /dev/null +++ b/stdlib/multiprocessing/popen_forkserver.pyi @@ -0,0 +1,16 @@ +import sys +from typing import ClassVar + +from . import popen_fork +from .util import Finalize + +if sys.platform != "win32": + __all__ = ["Popen"] + + class _DupFd: + def __init__(self, ind: int) -> None: ... + def detach(self) -> int: ... + + class Popen(popen_fork.Popen): + DupFd: ClassVar[type[_DupFd]] + finalizer: Finalize diff --git a/stdlib/multiprocessing/popen_spawn_posix.pyi b/stdlib/multiprocessing/popen_spawn_posix.pyi new file mode 100644 index 0000000..7e81d39 --- /dev/null +++ b/stdlib/multiprocessing/popen_spawn_posix.pyi @@ -0,0 +1,20 @@ +import sys +from typing import ClassVar + +from . import popen_fork +from .util import Finalize + +if sys.platform != "win32": + __all__ = ["Popen"] + + class _DupFd: + fd: int + + def __init__(self, fd: int) -> None: ... + def detach(self) -> int: ... + + class Popen(popen_fork.Popen): + DupFd: ClassVar[type[_DupFd]] + finalizer: Finalize + pid: int # may not exist if _launch raises in second try / except + sentinel: int # may not exist if _launch raises in second try / except diff --git a/stdlib/multiprocessing/popen_spawn_win32.pyi b/stdlib/multiprocessing/popen_spawn_win32.pyi new file mode 100644 index 0000000..f5cb0a6 --- /dev/null +++ b/stdlib/multiprocessing/popen_spawn_win32.pyi @@ -0,0 +1,30 @@ +import sys +from multiprocessing.process import BaseProcess +from typing import ClassVar + +from .util import Finalize + +if sys.platform == "win32": + __all__ = ["Popen"] + + TERMINATE: int + WINEXE: bool + WINSERVICE: bool + WINENV: bool + + class Popen: + finalizer: Finalize + method: ClassVar[str] + pid: int + returncode: int | None + sentinel: int + + def __init__(self, process_obj: BaseProcess) -> None: ... + def duplicate_for_child(self, handle: int) -> int: ... + def wait(self, timeout: float | None = ...) -> int | None: ... + def poll(self) -> int | None: ... + def terminate(self) -> None: ... + + kill = terminate + + def close(self) -> None: ... diff --git a/stdlib/multiprocessing/process.pyi b/stdlib/multiprocessing/process.pyi index 32c22d1..7c8422e 100644 --- a/stdlib/multiprocessing/process.pyi +++ b/stdlib/multiprocessing/process.pyi @@ -1,17 +1,23 @@ import sys -from typing import Any, Callable, Mapping, Tuple +from collections.abc import Callable, Iterable, Mapping +from typing import Any + +if sys.version_info >= (3, 8): + __all__ = ["BaseProcess", "current_process", "active_children", "parent_process"] +else: + __all__ = ["BaseProcess", "current_process", "active_children"] class BaseProcess: name: str daemon: bool authkey: bytes - _identity: Tuple[int, ...] # undocumented + _identity: tuple[int, ...] # undocumented def __init__( self, group: None = ..., - target: Callable[..., Any] | None = ..., + target: Callable[..., object] | None = ..., name: str | None = ..., - args: Tuple[Any, ...] = ..., + args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ..., *, daemon: bool | None = ..., @@ -19,9 +25,8 @@ class BaseProcess: def run(self) -> None: ... def start(self) -> None: ... def terminate(self) -> None: ... - if sys.version_info >= (3, 7): - def kill(self) -> None: ... - def close(self) -> None: ... + def kill(self) -> None: ... + def close(self) -> None: ... def join(self, timeout: float | None = ...) -> None: ... def is_alive(self) -> bool: ... @property diff --git a/stdlib/multiprocessing/queues.pyi b/stdlib/multiprocessing/queues.pyi index 1c9d769..02a6721 100644 --- a/stdlib/multiprocessing/queues.pyi +++ b/stdlib/multiprocessing/queues.pyi @@ -5,6 +5,8 @@ from typing import Any, Generic, TypeVar if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = ["Queue", "SimpleQueue", "JoinableQueue"] + _T = TypeVar("_T") class Queue(queue.Queue[_T]): @@ -13,23 +15,19 @@ class Queue(queue.Queue[_T]): def __init__(self, maxsize: int = ..., *, ctx: Any = ...) -> None: ... def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... def put(self, obj: _T, block: bool = ..., timeout: float | None = ...) -> None: ... - def qsize(self) -> int: ... - def empty(self) -> bool: ... - def full(self) -> bool: ... def put_nowait(self, item: _T) -> None: ... def get_nowait(self) -> _T: ... def close(self) -> None: ... def join_thread(self) -> None: ... def cancel_join_thread(self) -> None: ... -class JoinableQueue(Queue[_T]): - def task_done(self) -> None: ... - def join(self) -> None: ... +class JoinableQueue(Queue[_T]): ... class SimpleQueue(Generic[_T]): def __init__(self, *, ctx: Any = ...) -> None: ... if sys.version_info >= (3, 9): def close(self) -> None: ... + def empty(self) -> bool: ... def get(self) -> _T: ... def put(self, item: _T) -> None: ... diff --git a/stdlib/multiprocessing/reduction.pyi b/stdlib/multiprocessing/reduction.pyi new file mode 100644 index 0000000..cab86d8 --- /dev/null +++ b/stdlib/multiprocessing/reduction.pyi @@ -0,0 +1,87 @@ +import pickle +import sys +from _typeshed import HasFileno, Incomplete +from abc import ABCMeta +from copyreg import _DispatchTableType +from socket import socket +from typing_extensions import Literal + +if sys.platform == "win32": + __all__ = ["send_handle", "recv_handle", "ForkingPickler", "register", "dump", "DupHandle", "duplicate", "steal_handle"] +else: + __all__ = ["send_handle", "recv_handle", "ForkingPickler", "register", "dump", "DupFd", "sendfds", "recvfds"] + +class ForkingPickler(pickle.Pickler): + dispatch_table: _DispatchTableType + def __init__(self, *args) -> None: ... + @classmethod + def register(cls, type, reduce) -> None: ... + @classmethod + def dumps(cls, obj, protocol: Incomplete | None = ...): ... + loads = pickle.loads + +register = ForkingPickler.register + +def dump(obj, file, protocol: Incomplete | None = ...) -> None: ... + +if sys.platform == "win32": + if sys.version_info >= (3, 8): + def duplicate( + handle: int, target_process: int | None = ..., inheritable: bool = ..., *, source_process: int | None = ... + ) -> int: ... + else: + def duplicate(handle: int, target_process: int | None = ..., inheritable: bool = ...) -> int: ... + + def steal_handle(source_pid, handle): ... + def send_handle(conn, handle, destination_pid) -> None: ... + def recv_handle(conn): ... + + class DupHandle: + def __init__(self, handle, access, pid: Incomplete | None = ...) -> None: ... + def detach(self): ... + +else: + if sys.platform == "darwin": + ACKNOWLEDGE: Literal[True] + else: + ACKNOWLEDGE: Literal[False] + + def recvfds(sock: socket, size: int) -> list[int]: ... + def send_handle(conn, handle, destination_pid) -> None: ... + def recv_handle(conn: HasFileno) -> int: ... + def sendfds(sock, fds) -> None: ... + def DupFd(fd): ... + +# These aliases are to work around pyright complaints. +# Pyright doesn't like it when a class object is defined as an alias +# of a global object with the same name. +_ForkingPickler = ForkingPickler +_register = register +_dump = dump +_send_handle = send_handle +_recv_handle = recv_handle + +if sys.platform == "win32": + _steal_handle = steal_handle + _duplicate = duplicate + _DupHandle = DupHandle +else: + _sendfds = sendfds + _recvfds = recvfds + _DupFd = DupFd + +class AbstractReducer(metaclass=ABCMeta): + ForkingPickler = _ForkingPickler + register = _register + dump = _dump + send_handle = _send_handle + recv_handle = _recv_handle + if sys.platform == "win32": + steal_handle = _steal_handle + duplicate = _duplicate + DupHandle = _DupHandle + else: + sendfds = _sendfds + recvfds = _recvfds + DupFd = _DupFd + def __init__(self, *args) -> None: ... diff --git a/stdlib/multiprocessing/resource_sharer.pyi b/stdlib/multiprocessing/resource_sharer.pyi new file mode 100644 index 0000000..7708df9 --- /dev/null +++ b/stdlib/multiprocessing/resource_sharer.pyi @@ -0,0 +1,20 @@ +import sys +from socket import socket + +__all__ = ["stop"] + +if sys.platform == "win32": + __all__ += ["DupSocket"] + + class DupSocket: + def __init__(self, sock: socket) -> None: ... + def detach(self) -> socket: ... + +else: + __all__ += ["DupFd"] + + class DupFd: + def __init__(self, fd: int) -> None: ... + def detach(self) -> int: ... + +def stop(timeout: float | None = ...) -> None: ... diff --git a/stdlib/multiprocessing/resource_tracker.pyi b/stdlib/multiprocessing/resource_tracker.pyi new file mode 100644 index 0000000..50f3db6 --- /dev/null +++ b/stdlib/multiprocessing/resource_tracker.pyi @@ -0,0 +1,18 @@ +from _typeshed import Incomplete, StrOrBytesPath +from collections.abc import Sized + +__all__ = ["ensure_running", "register", "unregister"] + +class ResourceTracker: + def getfd(self) -> int | None: ... + def ensure_running(self) -> None: ... + def register(self, name: Sized, rtype: Incomplete) -> None: ... + def unregister(self, name: Sized, rtype: Incomplete) -> None: ... + +_resource_tracker: ResourceTracker = ... +ensure_running = _resource_tracker.ensure_running +register = _resource_tracker.register +unregister = _resource_tracker.unregister +getfd = _resource_tracker.getfd + +def main(fd: StrOrBytesPath | int) -> None: ... diff --git a/stdlib/multiprocessing/shared_memory.pyi b/stdlib/multiprocessing/shared_memory.pyi index 47669aa..3ce0ca3 100644 --- a/stdlib/multiprocessing/shared_memory.pyi +++ b/stdlib/multiprocessing/shared_memory.pyi @@ -1,33 +1,39 @@ import sys -from typing import Any, Generic, Iterable, Tuple, TypeVar +from _typeshed import Self +from collections.abc import Iterable +from typing import Any, Generic, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias -_S = TypeVar("_S") +__all__ = ["SharedMemory", "ShareableList"] + _SLT = TypeVar("_SLT", int, float, bool, str, bytes, None) -if sys.version_info >= (3, 8): - class SharedMemory: - def __init__(self, name: str | None = ..., create: bool = ..., size: int = ...) -> None: ... - @property - def buf(self) -> memoryview: ... - @property - def name(self) -> str: ... - @property - def size(self) -> int: ... - def close(self) -> None: ... - def unlink(self) -> None: ... - class ShareableList(Generic[_SLT]): - shm: SharedMemory - def __init__(self, sequence: Iterable[_SLT] | None = ..., *, name: str | None = ...) -> None: ... - def __getitem__(self, position: int) -> _SLT: ... - def __setitem__(self, position: int, value: _SLT) -> None: ... - def __reduce__(self: _S) -> Tuple[_S, Tuple[_SLT, ...]]: ... - def __len__(self) -> int: ... - @property - def format(self) -> str: ... - def count(self, value: _SLT) -> int: ... - def index(self, value: _SLT) -> int: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... +class SharedMemory: + def __init__(self, name: str | None = ..., create: bool = ..., size: int = ...) -> None: ... + @property + def buf(self) -> memoryview: ... + @property + def name(self) -> str: ... + @property + def size(self) -> int: ... + def close(self) -> None: ... + def unlink(self) -> None: ... + +class ShareableList(Generic[_SLT]): + shm: SharedMemory + @overload + def __init__(self, sequence: None = ..., *, name: str | None = ...) -> None: ... + @overload + def __init__(self, sequence: Iterable[_SLT], *, name: str | None = ...) -> None: ... + def __getitem__(self, position: int) -> _SLT: ... + def __setitem__(self, position: int, value: _SLT) -> None: ... + def __reduce__(self: Self) -> tuple[Self, tuple[_SLT, ...]]: ... + def __len__(self) -> int: ... + @property + def format(self) -> str: ... + def count(self, value: _SLT) -> int: ... + def index(self, value: _SLT) -> int: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/stdlib/multiprocessing/sharedctypes.pyi b/stdlib/multiprocessing/sharedctypes.pyi index bd9d8f0..e988cda 100644 --- a/stdlib/multiprocessing/sharedctypes.pyi +++ b/stdlib/multiprocessing/sharedctypes.pyi @@ -3,44 +3,47 @@ from collections.abc import Callable, Iterable, Sequence from ctypes import _CData, _SimpleCData, c_char from multiprocessing.context import BaseContext from multiprocessing.synchronize import _LockLike -from typing import Any, Generic, Protocol, Type, TypeVar, overload +from types import TracebackType +from typing import Any, Generic, Protocol, TypeVar, overload from typing_extensions import Literal +__all__ = ["RawValue", "RawArray", "Value", "Array", "copy", "synchronized"] + _T = TypeVar("_T") _CT = TypeVar("_CT", bound=_CData) @overload -def RawValue(typecode_or_type: Type[_CT], *args: Any) -> _CT: ... +def RawValue(typecode_or_type: type[_CT], *args: Any) -> _CT: ... @overload def RawValue(typecode_or_type: str, *args: Any) -> Any: ... @overload -def RawArray(typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ... +def RawArray(typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ... @overload def RawArray(typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ... @overload -def Value(typecode_or_type: Type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = ...) -> _CT: ... +def Value(typecode_or_type: type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = ...) -> _CT: ... @overload def Value( - typecode_or_type: Type[_CT], *args: Any, lock: Literal[True] | _LockLike, ctx: BaseContext | None = ... + typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ..., ctx: BaseContext | None = ... ) -> SynchronizedBase[_CT]: ... @overload def Value( - typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike, ctx: BaseContext | None = ... + typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = ..., ctx: BaseContext | None = ... ) -> SynchronizedBase[Any]: ... @overload def Value( - typecode_or_type: str | Type[_CData], *args: Any, lock: bool | _LockLike = ..., ctx: BaseContext | None = ... + typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ..., ctx: BaseContext | None = ... ) -> Any: ... @overload def Array( - typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = ... + typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = ... ) -> _CT: ... @overload def Array( - typecode_or_type: Type[_CT], + typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, - lock: Literal[True] | _LockLike, + lock: Literal[True] | _LockLike = ..., ctx: BaseContext | None = ..., ) -> SynchronizedArray[_CT]: ... @overload @@ -48,12 +51,12 @@ def Array( typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, - lock: Literal[True] | _LockLike, + lock: Literal[True] | _LockLike = ..., ctx: BaseContext | None = ..., ) -> SynchronizedArray[Any]: ... @overload def Array( - typecode_or_type: str | Type[_CData], + typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ..., @@ -76,11 +79,13 @@ class SynchronizedBase(Generic[_CT]): acquire: _AcquireFunc release: Callable[[], None] def __init__(self, obj: Any, lock: _LockLike | None = ..., ctx: Any | None = ...) -> None: ... - def __reduce__(self) -> tuple[Callable[..., Any], tuple[Any, _LockLike]]: ... + def __reduce__(self) -> tuple[Callable[[Any, _LockLike], SynchronizedBase[Any]], tuple[Any, _LockLike]]: ... def get_obj(self) -> _CT: ... def get_lock(self) -> _LockLike: ... def __enter__(self) -> bool: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None + ) -> None: ... class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]): value: _T @@ -88,7 +93,7 @@ class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]): class SynchronizedArray(SynchronizedBase[ctypes.Array[_CT]], Generic[_CT]): def __len__(self) -> int: ... def __getitem__(self, i: int) -> _CT: ... - def __setitem__(self, i: int, o: _CT) -> None: ... + def __setitem__(self, i: int, value: _CT) -> None: ... def __getslice__(self, start: int, stop: int) -> list[_CT]: ... def __setslice__(self, start: int, stop: int, values: Iterable[_CT]) -> None: ... diff --git a/stdlib/multiprocessing/spawn.pyi b/stdlib/multiprocessing/spawn.pyi index 34c7322..50570ff 100644 --- a/stdlib/multiprocessing/spawn.pyi +++ b/stdlib/multiprocessing/spawn.pyi @@ -1,5 +1,16 @@ +from collections.abc import Mapping, Sequence from types import ModuleType -from typing import Any, Mapping, Sequence +from typing import Any + +__all__ = [ + "_main", + "freeze_support", + "set_executable", + "get_executable", + "get_preparation_data", + "get_command_line", + "import_main_path", +] WINEXE: bool WINSERVICE: bool diff --git a/stdlib/multiprocessing/synchronize.pyi b/stdlib/multiprocessing/synchronize.pyi index 1741885..c89142f 100644 --- a/stdlib/multiprocessing/synchronize.pyi +++ b/stdlib/multiprocessing/synchronize.pyi @@ -1,31 +1,35 @@ -import sys import threading +from collections.abc import Callable +from contextlib import AbstractContextManager from multiprocessing.context import BaseContext -from typing import Any, Callable, ContextManager, Union +from types import TracebackType +from typing_extensions import TypeAlias -_LockLike = Union[Lock, RLock] +__all__ = ["Lock", "RLock", "Semaphore", "BoundedSemaphore", "Condition", "Event"] + +_LockLike: TypeAlias = Lock | RLock class Barrier(threading.Barrier): def __init__( - self, parties: int, action: Callable[..., Any] | None = ..., timeout: float | None = ..., *ctx: BaseContext + self, parties: int, action: Callable[[], object] | None = ..., timeout: float | None = ..., *ctx: BaseContext ) -> None: ... class BoundedSemaphore(Semaphore): def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... -class Condition(ContextManager[bool]): +class Condition(AbstractContextManager[bool]): def __init__(self, lock: _LockLike | None = ..., *, ctx: BaseContext) -> None: ... - if sys.version_info >= (3, 7): - def notify(self, n: int = ...) -> None: ... - else: - def notify(self) -> None: ... + def notify(self, n: int = ...) -> None: ... def notify_all(self) -> None: ... def wait(self, timeout: float | None = ...) -> bool: ... def wait_for(self, predicate: Callable[[], bool], timeout: float | None = ...) -> bool: ... def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ... def release(self) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None + ) -> None: ... -class Event(ContextManager[bool]): +class Event: def __init__(self, lock: _LockLike | None = ..., *, ctx: BaseContext) -> None: ... def is_set(self) -> bool: ... def set(self) -> None: ... @@ -42,6 +46,9 @@ class Semaphore(SemLock): def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... # Not part of public API -class SemLock(ContextManager[bool]): +class SemLock(AbstractContextManager[bool]): def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ... def release(self) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None + ) -> None: ... diff --git a/stdlib/multiprocessing/util.pyi b/stdlib/multiprocessing/util.pyi new file mode 100644 index 0000000..4b93b7a --- /dev/null +++ b/stdlib/multiprocessing/util.pyi @@ -0,0 +1,85 @@ +import threading +from _typeshed import Incomplete, ReadableBuffer, SupportsTrunc +from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence +from logging import Logger +from typing import Any, SupportsInt +from typing_extensions import SupportsIndex + +__all__ = [ + "sub_debug", + "debug", + "info", + "sub_warning", + "get_logger", + "log_to_stderr", + "get_temp_dir", + "register_after_fork", + "is_exiting", + "Finalize", + "ForkAwareThreadLock", + "ForkAwareLocal", + "close_all_fds_except", + "SUBDEBUG", + "SUBWARNING", +] + +NOTSET: int +SUBDEBUG: int +DEBUG: int +INFO: int +SUBWARNING: int + +LOGGER_NAME: str +DEFAULT_LOGGING_FORMAT: str + +def sub_debug(msg: object, *args: object) -> None: ... +def debug(msg: object, *args: object) -> None: ... +def info(msg: object, *args: object) -> None: ... +def sub_warning(msg: object, *args: object) -> None: ... +def get_logger() -> Logger: ... +def log_to_stderr(level: int | None = ...) -> Logger: ... +def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ... + +abstract_sockets_supported: bool + +def get_temp_dir() -> str: ... +def register_after_fork(obj: Incomplete, func: Callable[[Incomplete], object]) -> None: ... + +class Finalize: + def __init__( + self, + obj: Incomplete | None, + callback: Callable[..., Incomplete], + args: Sequence[Any] = ..., + kwargs: Mapping[str, Any] | None = ..., + exitpriority: int | None = ..., + ) -> None: ... + def __call__( + self, + wr: object = ..., + _finalizer_registry: MutableMapping[Incomplete, Incomplete] = ..., + sub_debug: Callable[..., object] = ..., + getpid: Callable[[], int] = ..., + ) -> Incomplete: ... + def cancel(self) -> None: ... + def still_active(self) -> bool: ... + +def is_exiting() -> bool: ... + +class ForkAwareThreadLock: + acquire: Callable[[bool, float], bool] + release: Callable[[], None] + def __enter__(self) -> bool: ... + def __exit__(self, *args: object) -> None: ... + +class ForkAwareLocal(threading.local): ... + +MAXFD: int + +def close_all_fds_except(fds: Iterable[int]) -> None: ... +def spawnv_passfds( + path: bytes, + # args is anything that can be passed to the int constructor + args: Sequence[str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc], + passfds: Sequence[int], +) -> int: ... diff --git a/stdlib/netrc.pyi b/stdlib/netrc.pyi index b8eac30..803c780 100644 --- a/stdlib/netrc.pyi +++ b/stdlib/netrc.pyi @@ -1,5 +1,7 @@ from _typeshed import StrOrBytesPath -from typing import Optional, Tuple +from typing_extensions import TypeAlias + +__all__ = ["netrc", "NetrcParseError"] class NetrcParseError(Exception): filename: str | None @@ -8,7 +10,7 @@ class NetrcParseError(Exception): def __init__(self, msg: str, filename: StrOrBytesPath | None = ..., lineno: int | None = ...) -> None: ... # (login, account, password) tuple -_NetrcTuple = Tuple[str, Optional[str], Optional[str]] +_NetrcTuple: TypeAlias = tuple[str, str | None, str | None] class netrc: hosts: dict[str, _NetrcTuple] diff --git a/stdlib/nis.pyi b/stdlib/nis.pyi index b762ae4..10eef23 100644 --- a/stdlib/nis.pyi +++ b/stdlib/nis.pyi @@ -5,4 +5,5 @@ if sys.platform != "win32": def get_default_domain() -> str: ... def maps(domain: str = ...) -> list[str]: ... def match(key: str, map: str, domain: str = ...) -> str: ... + class error(Exception): ... diff --git a/stdlib/nntplib.pyi b/stdlib/nntplib.pyi index 4acb8b2..aa5bcba 100644 --- a/stdlib/nntplib.pyi +++ b/stdlib/nntplib.pyi @@ -3,9 +3,24 @@ import socket import ssl import sys from _typeshed import Self -from typing import IO, Any, Iterable, NamedTuple, Tuple, Union +from builtins import list as _list # conflicts with a method named "list" +from collections.abc import Iterable +from typing import IO, Any, NamedTuple +from typing_extensions import Literal, TypeAlias -_File = Union[IO[bytes], bytes, str, None] +__all__ = [ + "NNTP", + "NNTPError", + "NNTPReplyError", + "NNTPTemporaryError", + "NNTPPermanentError", + "NNTPProtocolError", + "NNTPDataError", + "decode_header", + "NNTP_SSL", +] + +_File: TypeAlias = IO[bytes] | bytes | str | None class NNTPError(Exception): response: str @@ -16,8 +31,8 @@ class NNTPPermanentError(NNTPError): ... class NNTPProtocolError(NNTPError): ... class NNTPDataError(NNTPError): ... -NNTP_PORT: int -NNTP_SSL_PORT: int +NNTP_PORT: Literal[119] +NNTP_SSL_PORT: Literal[563] class GroupInfo(NamedTuple): group: str @@ -32,13 +47,13 @@ class ArticleInfo(NamedTuple): def decode_header(header_str: str) -> str: ... -_list = list # conflicts with a method named "list" - -class _NNTPBase: +class NNTP: encoding: str errors: str host: str + port: int + sock: socket.socket file: IO[bytes] debugging: int welcome: str @@ -47,59 +62,56 @@ class _NNTPBase: authenticated: bool nntp_implementation: str nntp_version: int - def __init__(self, file: IO[bytes], host: str, readermode: bool | None = ..., timeout: float = ...) -> None: ... + def __init__( + self, + host: str, + port: int = ..., + user: str | None = ..., + password: str | None = ..., + readermode: bool | None = ..., + usenetrc: bool = ..., + timeout: float = ..., + ) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getwelcome(self) -> str: ... def getcapabilities(self) -> dict[str, _list[str]]: ... def set_debuglevel(self, level: int) -> None: ... def debug(self, level: int) -> None: ... - def capabilities(self) -> Tuple[str, dict[str, _list[str]]]: ... - def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, _list[str]]: ... - def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> Tuple[str, _list[str]]: ... - def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> Tuple[str, _list[str]]: ... + def capabilities(self) -> tuple[str, dict[str, _list[str]]]: ... + def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> tuple[str, _list[str]]: ... + def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> tuple[str, _list[str]]: ... + def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> tuple[str, _list[str]]: ... def description(self, group: str) -> str: ... - def descriptions(self, group_pattern: str) -> Tuple[str, dict[str, str]]: ... - def group(self, name: str) -> Tuple[str, int, int, int, str]: ... - def help(self, *, file: _File = ...) -> Tuple[str, _list[str]]: ... - def stat(self, message_spec: Any = ...) -> Tuple[str, int, str]: ... - def next(self) -> Tuple[str, int, str]: ... - def last(self) -> Tuple[str, int, str]: ... - def head(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def body(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... - def article(self, message_spec: Any = ..., *, file: _File = ...) -> Tuple[str, ArticleInfo]: ... + def descriptions(self, group_pattern: str) -> tuple[str, dict[str, str]]: ... + def group(self, name: str) -> tuple[str, int, int, int, str]: ... + def help(self, *, file: _File = ...) -> tuple[str, _list[str]]: ... + def stat(self, message_spec: Any = ...) -> tuple[str, int, str]: ... + def next(self) -> tuple[str, int, str]: ... + def last(self) -> tuple[str, int, str]: ... + def head(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... + def body(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... + def article(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... def slave(self) -> str: ... - def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> Tuple[str, _list[str]]: ... - def xover(self, start: int, end: int, *, file: _File = ...) -> Tuple[str, _list[Tuple[int, dict[str, str]]]]: ... + def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> tuple[str, _list[str]]: ... + def xover(self, start: int, end: int, *, file: _File = ...) -> tuple[str, _list[tuple[int, dict[str, str]]]]: ... def over( - self, message_spec: None | str | _list[Any] | Tuple[Any, ...], *, file: _File = ... - ) -> Tuple[str, _list[Tuple[int, dict[str, str]]]]: ... + self, message_spec: None | str | _list[Any] | tuple[Any, ...], *, file: _File = ... + ) -> tuple[str, _list[tuple[int, dict[str, str]]]]: ... if sys.version_info < (3, 9): - def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, _list[Tuple[str, str]]]: ... - def xpath(self, id: Any) -> Tuple[str, str]: ... - def date(self) -> Tuple[str, datetime.datetime]: ... + def xgtitle(self, group: str, *, file: _File = ...) -> tuple[str, _list[tuple[str, str]]]: ... + def xpath(self, id: Any) -> tuple[str, str]: ... + + def date(self) -> tuple[str, datetime.datetime]: ... def post(self, data: bytes | Iterable[bytes]) -> str: ... def ihave(self, message_id: Any, data: bytes | Iterable[bytes]) -> str: ... def quit(self) -> str: ... def login(self, user: str | None = ..., password: str | None = ..., usenetrc: bool = ...) -> None: ... def starttls(self, context: ssl.SSLContext | None = ...) -> None: ... -class NNTP(_NNTPBase): - port: int - sock: socket.socket - def __init__( - self, - host: str, - port: int = ..., - user: str | None = ..., - password: str | None = ..., - readermode: bool | None = ..., - usenetrc: bool = ..., - timeout: float = ..., - ) -> None: ... - -class NNTP_SSL(_NNTPBase): - sock: socket.socket +class NNTP_SSL(NNTP): + ssl_context: ssl.SSLContext | None + sock: ssl.SSLSocket def __init__( self, host: str, diff --git a/stdlib/ntpath.pyi b/stdlib/ntpath.pyi index d454d7f..0cd3e44 100644 --- a/stdlib/ntpath.pyi +++ b/stdlib/ntpath.pyi @@ -42,17 +42,61 @@ from posixpath import ( splitext as splitext, supports_unicode_filenames as supports_unicode_filenames, ) -from typing import AnyStr, Tuple, overload +from typing import AnyStr, overload +from typing_extensions import LiteralString -altsep: str -if sys.version_info < (3, 7) and sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated +__all__ = [ + "normcase", + "isabs", + "join", + "splitdrive", + "split", + "splitext", + "basename", + "dirname", + "commonprefix", + "getsize", + "getmtime", + "getatime", + "getctime", + "islink", + "exists", + "lexists", + "isdir", + "isfile", + "ismount", + "expanduser", + "expandvars", + "normpath", + "abspath", + "curdir", + "pardir", + "sep", + "pathsep", + "defpath", + "altsep", + "extsep", + "devnull", + "realpath", + "supports_unicode_filenames", + "relpath", + "samefile", + "sameopenfile", + "samestat", + "commonpath", +] -# Similar to posixpath, but have slightly different argument names +altsep: LiteralString + +# First parameter is not actually pos-only, +# but must be defined as pos-only in the stub or cross-platform code doesn't type-check, +# as the parameter name is different in posixpath.join() +@overload +def join(__path: LiteralString, *paths: LiteralString) -> LiteralString: ... @overload -def join(path: StrPath, *paths: StrPath) -> str: ... +def join(__path: StrPath, *paths: StrPath) -> str: ... @overload -def join(path: BytesPath, *paths: BytesPath) -> bytes: ... +def join(__path: BytesPath, *paths: BytesPath) -> bytes: ... if sys.platform == "win32": if sys.version_info >= (3, 10): diff --git a/stdlib/numbers.pyi b/stdlib/numbers.pyi index eaf53d2..d94ae7f 100644 --- a/stdlib/numbers.pyi +++ b/stdlib/numbers.pyi @@ -4,6 +4,8 @@ from abc import ABCMeta, abstractmethod from typing import Any, SupportsFloat, overload +__all__ = ["Number", "Complex", "Real", "Rational", "Integral"] + class Number(metaclass=ABCMeta): @abstractmethod def __hash__(self) -> int: ... @@ -40,9 +42,12 @@ class Complex(Number): def __pow__(self, exponent: Any) -> Any: ... @abstractmethod def __rpow__(self, base: Any) -> Any: ... + @abstractmethod def __abs__(self) -> Real: ... + @abstractmethod def conjugate(self) -> Any: ... - def __eq__(self, other: Any) -> bool: ... + @abstractmethod + def __eq__(self, other: object) -> bool: ... class Real(Complex, SupportsFloat): @abstractmethod diff --git a/stdlib/opcode.pyi b/stdlib/opcode.pyi index 982ddee..402dbb7 100644 --- a/stdlib/opcode.pyi +++ b/stdlib/opcode.pyi @@ -1,7 +1,40 @@ import sys -from typing import Sequence +from typing_extensions import Literal -cmp_op: Sequence[str] +__all__ = [ + "cmp_op", + "hasconst", + "hasname", + "hasjrel", + "hasjabs", + "haslocal", + "hascompare", + "hasfree", + "opname", + "opmap", + "HAVE_ARGUMENT", + "EXTENDED_ARG", + "hasnargs", + "stack_effect", +] + +if sys.version_info >= (3, 9): + cmp_op: tuple[Literal["<"], Literal["<="], Literal["=="], Literal["!="], Literal[">"], Literal[">="]] +else: + cmp_op: tuple[ + Literal["<"], + Literal["<="], + Literal["=="], + Literal["!="], + Literal[">"], + Literal[">="], + Literal["in"], + Literal["not in"], + Literal["is"], + Literal["is not"], + Literal["exception match"], + Literal["BAD"], + ] hasconst: list[int] hasname: list[int] hasjrel: list[int] @@ -12,8 +45,8 @@ hasfree: list[int] opname: list[str] opmap: dict[str, int] -HAVE_ARGUMENT: int -EXTENDED_ARG: int +HAVE_ARGUMENT: Literal[90] +EXTENDED_ARG: Literal[144] if sys.version_info >= (3, 8): def stack_effect(__opcode: int, __oparg: int | None = ..., *, jump: bool | None = ...) -> int: ... diff --git a/stdlib/operator.pyi b/stdlib/operator.pyi index c9fe47c..a0e5df7 100644 --- a/stdlib/operator.pyi +++ b/stdlib/operator.pyi @@ -1,176 +1,110 @@ -from typing import ( - Any, - Container, - Generic, - Mapping, - MutableMapping, - MutableSequence, - Sequence, - SupportsAbs, - Tuple, - TypeVar, - overload, -) +import sys +from _operator import * -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_K = TypeVar("_K") -_V = TypeVar("_V") +__all__ = [ + "abs", + "add", + "and_", + "attrgetter", + "concat", + "contains", + "countOf", + "delitem", + "eq", + "floordiv", + "ge", + "getitem", + "gt", + "iadd", + "iand", + "iconcat", + "ifloordiv", + "ilshift", + "imatmul", + "imod", + "imul", + "index", + "indexOf", + "inv", + "invert", + "ior", + "ipow", + "irshift", + "is_", + "is_not", + "isub", + "itemgetter", + "itruediv", + "ixor", + "le", + "length_hint", + "lshift", + "lt", + "matmul", + "methodcaller", + "mod", + "mul", + "ne", + "neg", + "not_", + "or_", + "pos", + "pow", + "rshift", + "setitem", + "sub", + "truediv", + "truth", + "xor", +] -def lt(__a: Any, __b: Any) -> Any: ... -def le(__a: Any, __b: Any) -> Any: ... -def eq(__a: Any, __b: Any) -> Any: ... -def ne(__a: Any, __b: Any) -> Any: ... -def ge(__a: Any, __b: Any) -> Any: ... -def gt(__a: Any, __b: Any) -> Any: ... -def __lt__(a: Any, b: Any) -> Any: ... -def __le__(a: Any, b: Any) -> Any: ... -def __eq__(a: Any, b: Any) -> Any: ... -def __ne__(a: Any, b: Any) -> Any: ... -def __ge__(a: Any, b: Any) -> Any: ... -def __gt__(a: Any, b: Any) -> Any: ... -def not_(__a: Any) -> bool: ... -def __not__(a: Any) -> bool: ... -def truth(__a: Any) -> bool: ... -def is_(__a: Any, __b: Any) -> bool: ... -def is_not(__a: Any, __b: Any) -> bool: ... -def abs(__a: SupportsAbs[_T]) -> _T: ... -def __abs__(a: SupportsAbs[_T]) -> _T: ... -def add(__a: Any, __b: Any) -> Any: ... -def __add__(a: Any, b: Any) -> Any: ... -def and_(__a: Any, __b: Any) -> Any: ... -def __and__(a: Any, b: Any) -> Any: ... -def floordiv(__a: Any, __b: Any) -> Any: ... -def __floordiv__(a: Any, b: Any) -> Any: ... -def index(__a: Any) -> int: ... -def __index__(a: Any) -> int: ... -def inv(__a: Any) -> Any: ... -def invert(__a: Any) -> Any: ... -def __inv__(a: Any) -> Any: ... -def __invert__(a: Any) -> Any: ... -def lshift(__a: Any, __b: Any) -> Any: ... -def __lshift__(a: Any, b: Any) -> Any: ... -def mod(__a: Any, __b: Any) -> Any: ... -def __mod__(a: Any, b: Any) -> Any: ... -def mul(__a: Any, __b: Any) -> Any: ... -def __mul__(a: Any, b: Any) -> Any: ... -def matmul(__a: Any, __b: Any) -> Any: ... -def __matmul__(a: Any, b: Any) -> Any: ... -def neg(__a: Any) -> Any: ... -def __neg__(a: Any) -> Any: ... -def or_(__a: Any, __b: Any) -> Any: ... -def __or__(a: Any, b: Any) -> Any: ... -def pos(__a: Any) -> Any: ... -def __pos__(a: Any) -> Any: ... -def pow(__a: Any, __b: Any) -> Any: ... -def __pow__(a: Any, b: Any) -> Any: ... -def rshift(__a: Any, __b: Any) -> Any: ... -def __rshift__(a: Any, b: Any) -> Any: ... -def sub(__a: Any, __b: Any) -> Any: ... -def __sub__(a: Any, b: Any) -> Any: ... -def truediv(__a: Any, __b: Any) -> Any: ... -def __truediv__(a: Any, b: Any) -> Any: ... -def xor(__a: Any, __b: Any) -> Any: ... -def __xor__(a: Any, b: Any) -> Any: ... -def concat(__a: Sequence[_T], __b: Sequence[_T]) -> Sequence[_T]: ... -def __concat__(a: Sequence[_T], b: Sequence[_T]) -> Sequence[_T]: ... -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[Any], __b: int) -> None: ... -@overload -def delitem(__a: MutableSequence[Any], __b: slice) -> None: ... -@overload -def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ... -@overload -def __delitem__(a: MutableSequence[Any], b: int) -> None: ... -@overload -def __delitem__(a: MutableSequence[Any], b: slice) -> None: ... -@overload -def __delitem__(a: MutableMapping[_K, Any], b: _K) -> None: ... -@overload -def getitem(__a: Sequence[_T], __b: int) -> _T: ... -@overload -def getitem(__a: Sequence[_T], __b: slice) -> Sequence[_T]: ... -@overload -def getitem(__a: Mapping[_K, _V], __b: _K) -> _V: ... -@overload -def __getitem__(a: Sequence[_T], b: int) -> _T: ... -@overload -def __getitem__(a: Sequence[_T], b: slice) -> Sequence[_T]: ... -@overload -def __getitem__(a: Mapping[_K, _V], b: _K) -> _V: ... -def indexOf(__a: Sequence[_T], __b: _T) -> int: ... -@overload -def setitem(__a: MutableSequence[_T], __b: int, __c: _T) -> None: ... -@overload -def setitem(__a: MutableSequence[_T], __b: slice, __c: Sequence[_T]) -> None: ... -@overload -def setitem(__a: MutableMapping[_K, _V], __b: _K, __c: _V) -> None: ... -@overload -def __setitem__(a: MutableSequence[_T], b: int, c: _T) -> None: ... -@overload -def __setitem__(a: MutableSequence[_T], b: slice, c: Sequence[_T]) -> None: ... -@overload -def __setitem__(a: MutableMapping[_K, _V], b: _K, c: _V) -> None: ... -def length_hint(__obj: Any, __default: int = ...) -> int: ... +if sys.version_info >= (3, 11): + __all__ += ["call"] -class attrgetter(Generic[_T_co]): - @overload - def __new__(cls, attr: str) -> attrgetter[Any]: ... - @overload - def __new__(cls, attr: str, __attr2: str) -> attrgetter[Tuple[Any, Any]]: ... - @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[Tuple[Any, Any, Any]]: ... - @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[Tuple[Any, Any, Any, Any]]: ... - @overload - def __new__(cls, attr: str, *attrs: str) -> attrgetter[Tuple[Any, ...]]: ... - def __call__(self, obj: Any) -> _T_co: ... - -class itemgetter(Generic[_T_co]): - @overload - def __new__(cls, item: Any) -> itemgetter[Any]: ... - @overload - def __new__(cls, item: Any, __item2: Any) -> itemgetter[Tuple[Any, Any]]: ... - @overload - def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[Tuple[Any, Any, Any]]: ... - @overload - def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[Tuple[Any, Any, Any, Any]]: ... - @overload - def __new__(cls, item: Any, *items: Any) -> itemgetter[Tuple[Any, ...]]: ... - def __call__(self, obj: Any) -> _T_co: ... - -class methodcaller: - def __init__(self, __name: str, *args: Any, **kwargs: Any) -> None: ... - def __call__(self, obj: Any) -> Any: ... - -def iadd(__a: Any, __b: Any) -> Any: ... -def __iadd__(a: Any, b: Any) -> Any: ... -def iand(__a: Any, __b: Any) -> Any: ... -def __iand__(a: Any, b: Any) -> Any: ... -def iconcat(__a: Any, __b: Any) -> Any: ... -def __iconcat__(a: Any, b: Any) -> Any: ... -def ifloordiv(__a: Any, __b: Any) -> Any: ... -def __ifloordiv__(a: Any, b: Any) -> Any: ... -def ilshift(__a: Any, __b: Any) -> Any: ... -def __ilshift__(a: Any, b: Any) -> Any: ... -def imod(__a: Any, __b: Any) -> Any: ... -def __imod__(a: Any, b: Any) -> Any: ... -def imul(__a: Any, __b: Any) -> Any: ... -def __imul__(a: Any, b: Any) -> Any: ... -def imatmul(__a: Any, __b: Any) -> Any: ... -def __imatmul__(a: Any, b: Any) -> Any: ... -def ior(__a: Any, __b: Any) -> Any: ... -def __ior__(a: Any, b: Any) -> Any: ... -def ipow(__a: Any, __b: Any) -> Any: ... -def __ipow__(a: Any, b: Any) -> Any: ... -def irshift(__a: Any, __b: Any) -> Any: ... -def __irshift__(a: Any, b: Any) -> Any: ... -def isub(__a: Any, __b: Any) -> Any: ... -def __isub__(a: Any, b: Any) -> Any: ... -def itruediv(__a: Any, __b: Any) -> Any: ... -def __itruediv__(a: Any, b: Any) -> Any: ... -def ixor(__a: Any, __b: Any) -> Any: ... -def __ixor__(a: Any, b: Any) -> Any: ... +__lt__ = lt +__le__ = le +__eq__ = eq +__ne__ = ne +__ge__ = ge +__gt__ = gt +__not__ = not_ +__abs__ = abs +__add__ = add +__and__ = and_ +__floordiv__ = floordiv +__index__ = index +__inv__ = inv +__invert__ = invert +__lshift__ = lshift +__mod__ = mod +__mul__ = mul +__matmul__ = matmul +__neg__ = neg +__or__ = or_ +__pos__ = pos +__pow__ = pow +__rshift__ = rshift +__sub__ = sub +__truediv__ = truediv +__xor__ = xor +__concat__ = concat +__contains__ = contains +__delitem__ = delitem +__getitem__ = getitem +__setitem__ = setitem +__iadd__ = iadd +__iand__ = iand +__iconcat__ = iconcat +__ifloordiv__ = ifloordiv +__ilshift__ = ilshift +__imod__ = imod +__imul__ = imul +__imatmul__ = imatmul +__ior__ = ior +__ipow__ = ipow +__irshift__ = irshift +__isub__ = isub +__itruediv__ = itruediv +__ixor__ = ixor +if sys.version_info >= (3, 11): + __call__ = call diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 38c7746..5cff397 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -1,11 +1,33 @@ -from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, Tuple, Type, overload - -NO_DEFAULT: Tuple[str, ...] +from abc import abstractmethod +from collections.abc import Callable, Iterable, Mapping, Sequence +from typing import IO, Any, AnyStr, overload + +__all__ = [ + "Option", + "make_option", + "SUPPRESS_HELP", + "SUPPRESS_USAGE", + "Values", + "OptionContainer", + "OptionGroup", + "OptionParser", + "HelpFormatter", + "IndentedHelpFormatter", + "TitledHelpFormatter", + "OptParseError", + "OptionError", + "OptionConflictError", + "OptionValueError", + "BadOptionError", + "check_choice", +] + +NO_DEFAULT: tuple[str, ...] SUPPRESS_HELP: str SUPPRESS_USAGE: str def check_builtin(option: Option, opt: Any, value: str) -> Any: ... -def check_choice(option: Option, opt: Any, value: str) -> Any: ... +def check_choice(option: Option, opt: Any, value: str) -> str: ... class OptParseError(Exception): msg: str @@ -20,7 +42,6 @@ class AmbiguousOptionError(BadOptionError): def __init__(self, opt_str: str, possibilities: Sequence[str]) -> None: ... class OptionError(OptParseError): - msg: str option_id: str def __init__(self, msg: str, option: Option) -> None: ... @@ -47,9 +68,11 @@ class HelpFormatter: def expand_default(self, option: Option) -> str: ... def format_description(self, description: str) -> str: ... def format_epilog(self, epilog: str) -> str: ... + @abstractmethod def format_heading(self, heading: Any) -> str: ... def format_option(self, option: Option) -> str: ... def format_option_strings(self, option: Option) -> str: ... + @abstractmethod def format_usage(self, usage: Any) -> str: ... def indent(self) -> None: ... def set_long_opt_delimiter(self, delim: str) -> None: ... @@ -72,14 +95,14 @@ class TitledHelpFormatter(HelpFormatter): def format_usage(self, usage: str) -> str: ... class Option: - ACTIONS: Tuple[str, ...] - ALWAYS_TYPED_ACTIONS: Tuple[str, ...] + ACTIONS: tuple[str, ...] + ALWAYS_TYPED_ACTIONS: tuple[str, ...] ATTRS: list[str] CHECK_METHODS: list[Callable[..., Any]] | None - CONST_ACTIONS: Tuple[str, ...] - STORE_ACTIONS: Tuple[str, ...] - TYPED_ACTIONS: Tuple[str, ...] - TYPES: Tuple[str, ...] + CONST_ACTIONS: tuple[str, ...] + STORE_ACTIONS: tuple[str, ...] + TYPED_ACTIONS: tuple[str, ...] + TYPES: tuple[str, ...] TYPE_CHECKER: dict[str, Callable[..., Any]] _long_opts: list[str] _short_opts: list[str] @@ -89,7 +112,7 @@ class Option: nargs: int type: Any callback: Callable[..., Any] | None - callback_args: Tuple[Any, ...] | None + callback_args: tuple[Any, ...] | None callback_kwargs: dict[str, Any] | None help: str | None metavar: str | None @@ -119,8 +142,8 @@ class OptionContainer: conflict_handler: str defaults: dict[str, Any] description: Any - option_class: Type[Option] - def __init__(self, option_class: Type[Option], conflict_handler: Any, description: Any) -> None: ... + option_class: type[Option] + def __init__(self, option_class: type[Option], conflict_handler: Any, description: Any) -> None: ... def _check_conflict(self, option: Any) -> None: ... def _create_option_mappings(self) -> None: ... def _share_option_mappings(self, parser: OptionParser) -> None: ... @@ -157,7 +180,8 @@ class Values: def read_file(self, filename: str, mode: str = ...) -> None: ... def read_module(self, modname: str, mode: str = ...) -> None: ... def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... + def __setattr__(self, __name: str, __value: Any) -> None: ... + def __eq__(self, other: object) -> bool: ... class OptionParser(OptionContainer): allow_interspersed_args: bool @@ -177,7 +201,7 @@ class OptionParser(OptionContainer): self, usage: str | None = ..., option_list: Iterable[Option] | None = ..., - option_class: Type[Option] = ..., + option_class: type[Option] = ..., version: str | None = ..., conflict_handler: str = ..., description: str | None = ..., @@ -201,7 +225,7 @@ class OptionParser(OptionContainer): def add_option_group(self, __opt_group: OptionGroup) -> OptionGroup: ... @overload def add_option_group(self, *args: Any, **kwargs: Any) -> OptionGroup: ... - def check_values(self, values: Values, args: list[str]) -> Tuple[Values, list[str]]: ... + def check_values(self, values: Values, args: list[str]) -> tuple[Values, list[str]]: ... def disable_interspersed_args(self) -> None: ... def enable_interspersed_args(self) -> None: ... def error(self, msg: str) -> None: ... @@ -215,7 +239,10 @@ class OptionParser(OptionContainer): def get_prog_name(self) -> str: ... def get_usage(self) -> str: ... def get_version(self) -> str: ... - def parse_args(self, args: Sequence[AnyStr] | None = ..., values: Values | None = ...) -> Tuple[Values, list[AnyStr]]: ... + @overload + def parse_args(self, args: None = ..., values: Values | None = ...) -> tuple[Values, list[str]]: ... + @overload + def parse_args(self, args: Sequence[AnyStr], values: Values | None = ...) -> tuple[Values, list[AnyStr]]: ... def print_usage(self, file: IO[str] | None = ...) -> None: ... def print_help(self, file: IO[str] | None = ...) -> None: ... def print_version(self, file: IO[str] | None = ...) -> None: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 9af9aa3..590d205 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -1,43 +1,30 @@ import sys from _typeshed import ( + AnyStr_co, + BytesPath, FileDescriptorLike, + GenericPath, OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode, + ReadableBuffer, Self, StrOrBytesPath, StrPath, + SupportsLenAndGetItem, + WriteableBuffer, + structseq, ) +from abc import abstractmethod from builtins import OSError +from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence +from contextlib import AbstractContextManager from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper as _TextIOWrapper -from posix import listdir as listdir, times_result from subprocess import Popen -from typing import ( - IO, - Any, - AnyStr, - BinaryIO, - Callable, - ContextManager, - Generic, - Iterable, - Iterator, - List, - Mapping, - MutableMapping, - NoReturn, - Protocol, - Sequence, - Set, - Tuple, - TypeVar, - Union, - overload, - runtime_checkable, -) -from typing_extensions import Literal +from typing import IO, Any, AnyStr, BinaryIO, Generic, NoReturn, Protocol, TypeVar, overload, runtime_checkable +from typing_extensions import Final, Literal, TypeAlias, final from . import path as _path @@ -48,7 +35,8 @@ if sys.version_info >= (3, 9): path = _path _T = TypeVar("_T") -_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") # ----- os variables ----- @@ -56,10 +44,10 @@ error = OSError supports_bytes_environ: bool -supports_dir_fd: Set[Callable[..., Any]] -supports_fd: Set[Callable[..., Any]] -supports_effective_ids: Set[Callable[..., Any]] -supports_follow_symlinks: Set[Callable[..., Any]] +supports_dir_fd: set[Callable[..., Any]] +supports_fd: set[Callable[..., Any]] +supports_effective_ids: set[Callable[..., Any]] +supports_follow_symlinks: set[Callable[..., Any]] if sys.platform != "win32": # Unix only @@ -93,6 +81,9 @@ if sys.platform != "win32": P_PGID: int P_ALL: int + if sys.platform == "linux" and sys.version_info >= (3, 9): + P_PIDFD: int + WEXITED: int WSTOPPED: int WNOWAIT: int @@ -102,6 +93,12 @@ if sys.platform != "win32": CLD_TRAPPED: int CLD_CONTINUED: int + if sys.version_info >= (3, 9): + CLD_KILLED: int + CLD_STOPPED: int + + # TODO: SCHED_RESET_ON_FORK not available on darwin? + # TODO: SCHED_BATCH and SCHED_IDLE are linux only? SCHED_OTHER: int # some flavors of Unix SCHED_BATCH: int # some flavors of Unix SCHED_IDLE: int # some flavors of Unix @@ -120,6 +117,8 @@ if sys.platform != "win32": if sys.platform == "linux": RTLD_DEEPBIND: int + GRND_NONBLOCK: int + GRND_RANDOM: int SEEK_SET: int SEEK_CUR: int @@ -162,6 +161,24 @@ O_NOATIME: int # Gnu extension if in C library O_PATH: int # Gnu extension if in C library O_TMPFILE: int # Gnu extension if in C library O_LARGEFILE: int # Gnu extension if in C library +O_ACCMODE: int # TODO: when does this exist? + +if sys.platform != "win32" and sys.platform != "darwin": + # posix, but apparently missing on macos + ST_APPEND: int + ST_MANDLOCK: int + ST_NOATIME: int + ST_NODEV: int + ST_NODIRATIME: int + ST_NOEXEC: int + ST_RELATIME: int + ST_SYNCHRONOUS: int + ST_WRITE: int + +if sys.platform != "win32": + NGROUPS_MAX: int + ST_NOSUID: int + ST_RDONLY: int curdir: str pardir: str @@ -182,7 +199,7 @@ R_OK: int W_OK: int X_OK: int -_EnvironCodeFunc = Callable[[AnyStr], AnyStr] +_EnvironCodeFunc: TypeAlias = Callable[[AnyStr], AnyStr] class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): encodekey: _EnvironCodeFunc[AnyStr] @@ -199,8 +216,8 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): decodevalue: _EnvironCodeFunc[AnyStr], ) -> None: ... else: - putenv: Callable[[AnyStr, AnyStr], None] - unsetenv: Callable[[AnyStr, AnyStr], None] + putenv: Callable[[AnyStr, AnyStr], object] + unsetenv: Callable[[AnyStr, AnyStr], object] def __init__( self, data: MutableMapping[AnyStr, AnyStr], @@ -208,16 +225,27 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): decodekey: _EnvironCodeFunc[AnyStr], encodevalue: _EnvironCodeFunc[AnyStr], decodevalue: _EnvironCodeFunc[AnyStr], - putenv: Callable[[AnyStr, AnyStr], None], - unsetenv: Callable[[AnyStr, AnyStr], None], + putenv: Callable[[AnyStr, AnyStr], object], + unsetenv: Callable[[AnyStr, AnyStr], object], ) -> None: ... - def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... # type: ignore + + def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... # type: ignore[override] def copy(self) -> dict[AnyStr, AnyStr]: ... def __delitem__(self, key: AnyStr) -> None: ... def __getitem__(self, key: AnyStr) -> AnyStr: ... def __setitem__(self, key: AnyStr, value: AnyStr) -> None: ... def __iter__(self) -> Iterator[AnyStr]: ... def __len__(self) -> int: ... + if sys.version_info >= (3, 9): + def __or__(self, other: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ... + def __ror__(self, other: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ... + # We use @overload instead of a Union for reasons similar to those given for + # overloading MutableMapping.update in stdlib/typing.pyi + # The type: ignore is needed due to incompatible __or__/__ior__ signatures + @overload # type: ignore[misc] + def __ior__(self: Self, other: Mapping[AnyStr, AnyStr]) -> Self: ... + @overload + def __ior__(self: Self, other: Iterable[tuple[AnyStr, AnyStr]]) -> Self: ... environ: _Environ[str] if sys.platform != "win32": @@ -262,64 +290,98 @@ if sys.platform != "win32": TMP_MAX: int # Undocumented, but used by tempfile # ----- os classes (structures) ----- -class stat_result: - # For backward compatibility, the return value of stat() is also - # accessible as a tuple of at least 10 integers giving the most important - # (and portable) members of the stat structure, in the order st_mode, - # st_ino, st_dev, st_nlink, st_uid, st_gid, st_size, st_atime, st_mtime, - # st_ctime. More items may be added at the end by some implementations. - - st_mode: int # protection bits, - st_ino: int # inode number, - st_dev: int # device, - st_nlink: int # number of hard links, - st_uid: int # user id of owner, - st_gid: int # group id of owner, - st_size: int # size of file, in bytes, - st_atime: float # time of most recent access, - st_mtime: float # time of most recent content modification, - st_ctime: float # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) - st_atime_ns: int # time of most recent access, in nanoseconds - st_mtime_ns: int # time of most recent content modification in nanoseconds - st_ctime_ns: int # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds - if sys.version_info >= (3, 8) and sys.platform == "win32": - st_reparse_tag: int +@final +class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, float, float, float]): + # The constructor of this class takes an iterable of variable length (though it must be at least 10). + # + # However, this class behaves like a tuple of 10 elements, + # no matter how long the iterable supplied to the constructor is. + # https://github.com/python/typeshed/pull/6560#discussion_r767162532 + # + # The 10 elements always present are st_mode, st_ino, st_dev, st_nlink, + # st_uid, st_gid, st_size, st_atime, st_mtime, st_ctime. + # + # More items may be added at the end by some implementations. + if sys.version_info >= (3, 10): + __match_args__: Final = ("st_mode", "st_ino", "st_dev", "st_nlink", "st_uid", "st_gid", "st_size") + @property + def st_mode(self) -> int: ... # protection bits, + @property + def st_ino(self) -> int: ... # inode number, + @property + def st_dev(self) -> int: ... # device, + @property + def st_nlink(self) -> int: ... # number of hard links, + @property + def st_uid(self) -> int: ... # user id of owner, + @property + def st_gid(self) -> int: ... # group id of owner, + @property + def st_size(self) -> int: ... # size of file, in bytes, + @property + def st_atime(self) -> float: ... # time of most recent access, + @property + def st_mtime(self) -> float: ... # time of most recent content modification, + # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) + @property + def st_ctime(self) -> float: ... + @property + def st_atime_ns(self) -> int: ... # time of most recent access, in nanoseconds + @property + def st_mtime_ns(self) -> int: ... # time of most recent content modification in nanoseconds + # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds + @property + def st_ctime_ns(self) -> int: ... if sys.platform == "win32": - st_file_attributes: int - def __getitem__(self, i: int) -> int: ... - # not documented - def __init__(self, tuple: Tuple[int, ...]) -> None: ... - # On some Unix systems (such as Linux), the following attributes may also - # be available: - st_blocks: int # number of blocks allocated for file - st_blksize: int # filesystem blocksize - st_rdev: int # type of device if an inode device - st_flags: int # user defined flags for file - - # On other Unix systems (such as FreeBSD), the following attributes may be - # available (but may be only filled out if root tries to use them): - st_gen: int # file generation number - st_birthtime: int # time of file creation - - # On Mac OS systems, the following attributes may also be available: - st_rsize: int - st_creator: int - st_type: int + @property + def st_file_attributes(self) -> int: ... + if sys.version_info >= (3, 8): + @property + def st_reparse_tag(self) -> int: ... + else: + @property + def st_blocks(self) -> int: ... # number of blocks allocated for file + @property + def st_blksize(self) -> int: ... # filesystem blocksize + @property + def st_rdev(self) -> int: ... # type of device if an inode device + if sys.platform != "linux": + # These properties are available on MacOS, but not on Windows or Ubuntu. + # On other Unix systems (such as FreeBSD), the following attributes may be + # available (but may be only filled out if root tries to use them): + @property + def st_gen(self) -> int: ... # file generation number + @property + def st_birthtime(self) -> int: ... # time of file creation + if sys.platform == "darwin": + @property + def st_flags(self) -> int: ... # user defined flags for file + # Attributes documented as sometimes appearing, but deliberately omitted from the stub: `st_creator`, `st_rsize`, `st_type`. + # See https://github.com/python/typeshed/pull/6560#issuecomment-991253327 @runtime_checkable -class PathLike(Protocol[_AnyStr_co]): - def __fspath__(self) -> _AnyStr_co: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... +class PathLike(Protocol[AnyStr_co]): + @abstractmethod + def __fspath__(self) -> AnyStr_co: ... + +@overload +def listdir(path: StrPath | None = ...) -> list[str]: ... +@overload +def listdir(path: BytesPath) -> list[bytes]: ... +@overload +def listdir(path: int) -> list[str]: ... -_FdOrAnyPath = Union[int, StrOrBytesPath] +_FdOrAnyPath: TypeAlias = int | StrOrBytesPath +@final class DirEntry(Generic[AnyStr]): - # This is what the scandir interator yields + # This is what the scandir iterator yields # The constructor is hidden - name: AnyStr - path: AnyStr + @property + def name(self) -> AnyStr: ... + @property + def path(self) -> AnyStr: ... def inode(self) -> int: ... def is_dir(self, *, follow_symlinks: bool = ...) -> bool: ... def is_file(self, *, follow_symlinks: bool = ...) -> bool: ... @@ -329,44 +391,43 @@ class DirEntry(Generic[AnyStr]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -if sys.platform != "win32": - _Tuple10Int = Tuple[int, int, int, int, int, int, int, int, int, int] - _Tuple11Int = Tuple[int, int, int, int, int, int, int, int, int, int, int] - if sys.version_info >= (3, 7): - # f_fsid was added in https://github.com/python/cpython/pull/4571 - class statvfs_result(_Tuple10Int): # Unix only - def __new__(cls, seq: _Tuple10Int | _Tuple11Int, dict: dict[str, int] = ...) -> statvfs_result: ... - n_fields: int - n_sequence_fields: int - n_unnamed_fields: int - - f_bsize: int - f_frsize: int - f_blocks: int - f_bfree: int - f_bavail: int - f_files: int - f_ffree: int - f_favail: int - f_flag: int - f_namemax: int - f_fsid: int - else: - class statvfs_result(_Tuple10Int): # Unix only - n_fields: int - n_sequence_fields: int - n_unnamed_fields: int - - f_bsize: int - f_frsize: int - f_blocks: int - f_bfree: int - f_bavail: int - f_files: int - f_ffree: int - f_favail: int - f_flag: int - f_namemax: int +@final +class statvfs_result(structseq[int], tuple[int, int, int, int, int, int, int, int, int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ( + "f_bsize", + "f_frsize", + "f_blocks", + "f_bfree", + "f_bavail", + "f_files", + "f_ffree", + "f_favail", + "f_flag", + "f_namemax", + ) + @property + def f_bsize(self) -> int: ... + @property + def f_frsize(self) -> int: ... + @property + def f_blocks(self) -> int: ... + @property + def f_bfree(self) -> int: ... + @property + def f_bavail(self) -> int: ... + @property + def f_files(self) -> int: ... + @property + def f_ffree(self) -> int: ... + @property + def f_favail(self) -> int: ... + @property + def f_flag(self) -> int: ... + @property + def f_namemax(self) -> int: ... + @property + def f_fsid(self) -> int: ... # ----- os function stubs ----- def fsencode(filename: StrOrBytesPath) -> bytes: ... @@ -383,9 +444,22 @@ def getpid() -> int: ... def getppid() -> int: ... def strerror(__code: int) -> str: ... def umask(__mask: int) -> int: ... +@final +class uname_result(structseq[str], tuple[str, str, str, str, str]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("sysname", "nodename", "release", "version", "machine") + @property + def sysname(self) -> str: ... + @property + def nodename(self) -> str: ... + @property + def release(self) -> str: ... + @property + def version(self) -> str: ... + @property + def machine(self) -> str: ... if sys.platform != "win32": - # Unix only def ctermid() -> str: ... def getegid() -> int: ... def geteuid() -> int: ... @@ -398,8 +472,9 @@ if sys.platform != "win32": def getpriority(which: int, who: int) -> int: ... def setpriority(which: int, who: int, priority: int) -> None: ... if sys.platform != "darwin": - def getresuid() -> Tuple[int, int, int]: ... - def getresgid() -> Tuple[int, int, int]: ... + def getresuid() -> tuple[int, int, int]: ... + def getresgid() -> tuple[int, int, int]: ... + def getuid() -> int: ... def setegid(__egid: int) -> None: ... def seteuid(__euid: int) -> None: ... @@ -411,11 +486,11 @@ if sys.platform != "win32": if sys.platform != "darwin": def setresgid(rgid: int, egid: int, sgid: int) -> None: ... def setresuid(ruid: int, euid: int, suid: int) -> None: ... + def setreuid(__ruid: int, __euid: int) -> None: ... def getsid(__pid: int) -> int: ... def setsid() -> None: ... def setuid(__uid: int) -> None: ... - from posix import uname_result def uname() -> uname_result: ... @overload @@ -428,13 +503,16 @@ if sys.platform != "win32": def getenvb(key: bytes) -> bytes | None: ... @overload def getenvb(key: bytes, default: _T) -> bytes | _T: ... + def putenv(__name: StrOrBytesPath, __value: StrOrBytesPath) -> None: ... + def unsetenv(__name: StrOrBytesPath) -> None: ... -def putenv(__name: bytes | str, __value: bytes | str) -> None: ... +else: + def putenv(__name: str, __value: str) -> None: ... -if sys.platform != "win32": - def unsetenv(__name: bytes | str) -> None: ... + if sys.version_info >= (3, 9): + def unsetenv(__name: str) -> None: ... -_Opener = Callable[[str, int], int] +_Opener: TypeAlias = Callable[[str, int], int] @overload def fdopen( @@ -495,7 +573,7 @@ def fdopen( def fdopen( fd: int, mode: OpenBinaryMode, - buffering: int, + buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ..., @@ -517,40 +595,47 @@ def close(fd: int) -> None: ... def closerange(__fd_low: int, __fd_high: int) -> None: ... def device_encoding(fd: int) -> str | None: ... def dup(__fd: int) -> int: ... - -if sys.version_info >= (3, 7): - def dup2(fd: int, fd2: int, inheritable: bool = ...) -> int: ... - -else: - def dup2(fd: int, fd2: int, inheritable: bool = ...) -> None: ... - +def dup2(fd: int, fd2: int, inheritable: bool = ...) -> int: ... def fstat(fd: int) -> stat_result: ... +def ftruncate(__fd: int, __length: int) -> None: ... def fsync(fd: FileDescriptorLike) -> None: ... +def isatty(__fd: int) -> bool: ... + +if sys.platform != "win32" and sys.version_info >= (3, 11): + def login_tty(__fd: int) -> None: ... + def lseek(__fd: int, __position: int, __how: int) -> int: ... def open(path: StrOrBytesPath, flags: int, mode: int = ..., *, dir_fd: int | None = ...) -> int: ... -def pipe() -> Tuple[int, int]: ... +def pipe() -> tuple[int, int]: ... def read(__fd: int, __length: int) -> bytes: ... if sys.platform != "win32": - # Unix only def fchmod(fd: int, mode: int) -> None: ... def fchown(fd: int, uid: int, gid: int) -> None: ... - if sys.platform != "darwin": - def fdatasync(fd: FileDescriptorLike) -> None: ... # Unix only, not Mac def fpathconf(__fd: int, __name: str | int) -> int: ... def fstatvfs(__fd: int) -> statvfs_result: ... - def ftruncate(__fd: int, __length: int) -> None: ... def get_blocking(__fd: int) -> bool: ... def set_blocking(__fd: int, __blocking: bool) -> None: ... - def isatty(__fd: int) -> bool: ... def lockf(__fd: int, __command: int, __length: int) -> None: ... - def openpty() -> Tuple[int, int]: ... # some flavors of Unix + def openpty() -> tuple[int, int]: ... # some flavors of Unix if sys.platform != "darwin": - def pipe2(flags: int) -> Tuple[int, int]: ... # some flavors of Unix - def posix_fallocate(fd: int, offset: int, length: int) -> None: ... - def posix_fadvise(fd: int, offset: int, length: int, advice: int) -> None: ... + def fdatasync(fd: FileDescriptorLike) -> None: ... + def pipe2(__flags: int) -> tuple[int, int]: ... # some flavors of Unix + def posix_fallocate(__fd: int, __offset: int, __length: int) -> None: ... + def posix_fadvise(__fd: int, __offset: int, __length: int, __advice: int) -> None: ... + def pread(__fd: int, __length: int, __offset: int) -> bytes: ... - def pwrite(__fd: int, __buffer: bytes, __offset: int) -> int: ... + def pwrite(__fd: int, __buffer: ReadableBuffer, __offset: int) -> int: ... + # In CI, stubtest sometimes reports that these are available on MacOS, sometimes not + def preadv(__fd: int, __buffers: SupportsLenAndGetItem[WriteableBuffer], __offset: int, __flags: int = ...) -> int: ... + def pwritev(__fd: int, __buffers: SupportsLenAndGetItem[ReadableBuffer], __offset: int, __flags: int = ...) -> int: ... + if sys.platform != "darwin": + if sys.version_info >= (3, 10): + RWF_APPEND: int # docs say available on 3.7+, stubtest says otherwise + RWF_DSYNC: int + RWF_SYNC: int + RWF_HIPRI: int + RWF_NOWAIT: int @overload def sendfile(out_fd: int, in_fd: int, offset: int | None, count: int) -> int: ... @overload @@ -559,28 +644,37 @@ if sys.platform != "win32": in_fd: int, offset: int, count: int, - headers: Sequence[bytes] = ..., - trailers: Sequence[bytes] = ..., + headers: Sequence[ReadableBuffer] = ..., + trailers: Sequence[ReadableBuffer] = ..., flags: int = ..., ) -> int: ... # FreeBSD and Mac OS X only - def readv(__fd: int, __buffers: Sequence[bytearray]) -> int: ... - def writev(__fd: int, __buffers: Sequence[bytes]) -> int: ... - -class terminal_size(Tuple[int, int]): - columns: int - lines: int - -def get_terminal_size(fd: int = ...) -> terminal_size: ... + def readv(__fd: int, __buffers: SupportsLenAndGetItem[WriteableBuffer]) -> int: ... + def writev(__fd: int, __buffers: SupportsLenAndGetItem[ReadableBuffer]) -> int: ... + +@final +class terminal_size(structseq[int], tuple[int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("columns", "lines") + @property + def columns(self) -> int: ... + @property + def lines(self) -> int: ... + +def get_terminal_size(__fd: int = ...) -> terminal_size: ... def get_inheritable(__fd: int) -> bool: ... def set_inheritable(__fd: int, __inheritable: bool) -> None: ... +if sys.platform == "win32": + def get_handle_inheritable(__handle: int) -> bool: ... + def set_handle_inheritable(__handle: int, __inheritable: bool) -> None: ... + if sys.platform != "win32": # Unix only def tcgetpgrp(__fd: int) -> int: ... def tcsetpgrp(__fd: int, __pgid: int) -> None: ... def ttyname(__fd: int) -> str: ... -def write(__fd: int, __data: bytes) -> int: ... +def write(__fd: int, __data: ReadableBuffer) -> int: ... def access( path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = ..., effective_ids: bool = ..., follow_symlinks: bool = ... ) -> bool: ... @@ -593,17 +687,14 @@ def getcwd() -> str: ... def getcwdb() -> bytes: ... def chmod(path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ... -if sys.platform != "win32": +if sys.platform != "win32" and sys.platform != "linux": def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix - def chown( - path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ... - ) -> None: ... # Unix only + def lchflags(path: StrOrBytesPath, flags: int) -> None: ... + def lchmod(path: StrOrBytesPath, mode: int) -> None: ... if sys.platform != "win32": - # Unix only def chroot(path: StrOrBytesPath) -> None: ... - def lchflags(path: StrOrBytesPath, flags: int) -> None: ... - def lchmod(path: StrOrBytesPath, mode: int) -> None: ... + def chown(path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ... def lchown(path: StrOrBytesPath, uid: int, gid: int) -> None: ... def link( @@ -629,7 +720,7 @@ if sys.platform != "win32": def makedev(__major: int, __minor: int) -> int: ... def pathconf(path: _FdOrAnyPath, name: str | int) -> int: ... # Unix only -def readlink(path: AnyStr | PathLike[AnyStr], *, dir_fd: int | None = ...) -> AnyStr: ... +def readlink(path: GenericPath[AnyStr], *, dir_fd: int | None = ...) -> AnyStr: ... def remove(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... def removedirs(name: StrOrBytesPath) -> None: ... def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = ..., dst_dir_fd: int | None = ...) -> None: ... @@ -637,32 +728,19 @@ def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ... def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = ..., dst_dir_fd: int | None = ...) -> None: ... def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... -class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]): +class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]): def __next__(self) -> DirEntry[AnyStr]: ... + def __exit__(self, *args: object) -> None: ... def close(self) -> None: ... -if sys.version_info >= (3, 7): - @overload - def scandir(path: None = ...) -> _ScandirIterator[str]: ... - @overload - def scandir(path: int) -> _ScandirIterator[str]: ... - @overload - def scandir(path: AnyStr | PathLike[AnyStr]) -> _ScandirIterator[AnyStr]: ... - -else: - @overload - def scandir(path: None = ...) -> _ScandirIterator[str]: ... - @overload - def scandir(path: AnyStr | PathLike[AnyStr]) -> _ScandirIterator[AnyStr]: ... - +@overload +def scandir(path: None = ...) -> _ScandirIterator[str]: ... +@overload +def scandir(path: int) -> _ScandirIterator[str]: ... +@overload +def scandir(path: GenericPath[AnyStr]) -> _ScandirIterator[AnyStr]: ... def stat(path: _FdOrAnyPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> stat_result: ... -if sys.version_info < (3, 7): - @overload - def stat_float_times() -> bool: ... - @overload - def stat_float_times(__newvalue: bool) -> None: ... - if sys.platform != "win32": def statvfs(path: _FdOrAnyPath) -> statvfs_result: ... # Unix only @@ -675,54 +753,44 @@ def truncate(path: _FdOrAnyPath, length: int) -> None: ... # Unix only up to ve def unlink(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... def utime( path: _FdOrAnyPath, - times: Tuple[int, int] | Tuple[float, float] | None = ..., + times: tuple[int, int] | tuple[float, float] | None = ..., *, - ns: Tuple[int, int] = ..., + ns: tuple[int, int] = ..., dir_fd: int | None = ..., follow_symlinks: bool = ..., ) -> None: ... -_OnError = Callable[[OSError], Any] +_OnError: TypeAlias = Callable[[OSError], object] def walk( - top: AnyStr | PathLike[AnyStr], topdown: bool = ..., onerror: _OnError | None = ..., followlinks: bool = ... -) -> Iterator[Tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ... + top: GenericPath[AnyStr], topdown: bool = ..., onerror: _OnError | None = ..., followlinks: bool = ... +) -> Iterator[tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ... if sys.platform != "win32": - if sys.version_info >= (3, 7): - @overload - def fwalk( - top: StrPath = ..., - topdown: bool = ..., - onerror: _OnError | None = ..., - *, - follow_symlinks: bool = ..., - dir_fd: int | None = ..., - ) -> Iterator[Tuple[str, list[str], list[str], int]]: ... - @overload - def fwalk( - top: bytes, - topdown: bool = ..., - onerror: _OnError | None = ..., - *, - follow_symlinks: bool = ..., - dir_fd: int | None = ..., - ) -> Iterator[Tuple[bytes, list[bytes], list[bytes], int]]: ... - else: - def fwalk( - top: StrPath = ..., - topdown: bool = ..., - onerror: _OnError | None = ..., - *, - follow_symlinks: bool = ..., - dir_fd: int | None = ..., - ) -> Iterator[Tuple[str, list[str], list[str], int]]: ... + @overload + def fwalk( + top: StrPath = ..., + topdown: bool = ..., + onerror: _OnError | None = ..., + *, + follow_symlinks: bool = ..., + dir_fd: int | None = ..., + ) -> Iterator[tuple[str, list[str], list[str], int]]: ... + @overload + def fwalk( + top: BytesPath, + topdown: bool = ..., + onerror: _OnError | None = ..., + *, + follow_symlinks: bool = ..., + dir_fd: int | None = ..., + ) -> Iterator[tuple[bytes, list[bytes], list[bytes], int]]: ... if sys.platform == "linux": def getxattr(path: _FdOrAnyPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> bytes: ... def listxattr(path: _FdOrAnyPath | None = ..., *, follow_symlinks: bool = ...) -> list[str]: ... def removexattr(path: _FdOrAnyPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ... def setxattr( - path: _FdOrAnyPath, attribute: StrOrBytesPath, value: bytes, flags: int = ..., *, follow_symlinks: bool = ... + path: _FdOrAnyPath, attribute: StrOrBytesPath, value: ReadableBuffer, flags: int = ..., *, follow_symlinks: bool = ... ) -> None: ... def abort() -> NoReturn: ... @@ -740,17 +808,21 @@ def execlpe(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoRetur # Not separating out PathLike[str] and PathLike[bytes] here because it doesn't make much difference # in practice, and doing so would explode the number of combinations in this already long union. # All these combinations are necessary due to list being invariant. -_ExecVArgs = Union[ - Tuple[StrOrBytesPath, ...], - List[bytes], - List[str], - List[PathLike[Any]], - List[Union[bytes, str]], - List[Union[bytes, PathLike[Any]]], - List[Union[str, PathLike[Any]]], - List[Union[bytes, str, PathLike[Any]]], -] -_ExecEnv = Union[Mapping[bytes, Union[bytes, str]], Mapping[str, Union[bytes, str]]] +_ExecVArgs: TypeAlias = ( + tuple[StrOrBytesPath, ...] + | list[bytes] + | list[str] + | list[PathLike[Any]] + | list[bytes | str] + | list[bytes | PathLike[Any]] + | list[str | PathLike[Any]] + | list[bytes | str | PathLike[Any]] +) +# Depending on the OS, the keys and values are passed either to +# PyUnicode_FSDecoder (which accepts str | ReadableBuffer) or to +# PyUnicode_FSConverter (which accepts StrOrBytesPath). For simplicity, +# we limit to str | bytes. +_ExecEnv: TypeAlias = Mapping[bytes, bytes | str] | Mapping[str, bytes | str] def execv(__path: StrOrBytesPath, __argv: _ExecVArgs) -> NoReturn: ... def execve(path: _FdOrAnyPath, argv: _ExecVArgs, env: _ExecEnv) -> NoReturn: ... @@ -762,15 +834,15 @@ def kill(__pid: int, __signal: int) -> None: ... if sys.platform != "win32": # Unix only def fork() -> int: ... - def forkpty() -> Tuple[int, int]: ... # some flavors of Unix + def forkpty() -> tuple[int, int]: ... # some flavors of Unix def killpg(__pgid: int, __signal: int) -> None: ... def nice(__increment: int) -> int: ... if sys.platform != "darwin": - def plock(op: int) -> None: ... # ???op is int? + def plock(__op: int) -> None: ... # ???op is int? class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... - def close(self) -> int | None: ... # type: ignore + def close(self) -> int | None: ... # type: ignore[override] def popen(cmd: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ... def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... @@ -785,24 +857,53 @@ else: def spawnve(__mode: int, __path: StrOrBytesPath, __argv: _ExecVArgs, __env: _ExecEnv) -> int: ... def system(command: StrOrBytesPath) -> int: ... +@final +class times_result(structseq[float], tuple[float, float, float, float, float]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("user", "system", "children_user", "children_system", "elapsed") + @property + def user(self) -> float: ... + @property + def system(self) -> float: ... + @property + def children_user(self) -> float: ... + @property + def children_system(self) -> float: ... + @property + def elapsed(self) -> float: ... + def times() -> times_result: ... -def waitpid(__pid: int, __options: int) -> Tuple[int, int]: ... +def waitpid(__pid: int, __options: int) -> tuple[int, int]: ... if sys.platform == "win32": def startfile(path: StrOrBytesPath, operation: str | None = ...) -> None: ... else: - # Unix only def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ... def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ... - def wait() -> Tuple[int, int]: ... # Unix only + def wait() -> tuple[int, int]: ... # Unix only if sys.platform != "darwin": - from posix import waitid_result - def waitid(idtype: int, ident: int, options: int) -> waitid_result: ... - def wait3(options: int) -> Tuple[int, int, Any]: ... - def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ... + @final + class waitid_result(structseq[int], tuple[int, int, int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("si_pid", "si_uid", "si_signo", "si_status", "si_code") + @property + def si_pid(self) -> int: ... + @property + def si_uid(self) -> int: ... + @property + def si_signo(self) -> int: ... + @property + def si_status(self) -> int: ... + @property + def si_code(self) -> int: ... + + def waitid(__idtype: int, __ident: int, __options: int) -> waitid_result: ... + + def wait3(options: int) -> tuple[int, int, Any]: ... + def wait4(pid: int, options: int) -> tuple[int, int, Any]: ... def WCOREDUMP(__status: int) -> bool: ... def WIFCONTINUED(status: int) -> bool: ... def WIFSTOPPED(status: int) -> bool: ... @@ -812,28 +913,63 @@ else: def WSTOPSIG(status: int) -> int: ... def WTERMSIG(status: int) -> int: ... if sys.version_info >= (3, 8): - from posix import posix_spawn as posix_spawn, posix_spawnp as posix_spawnp + def posix_spawn( + path: StrOrBytesPath, + argv: _ExecVArgs, + env: _ExecEnv, + *, + file_actions: Sequence[tuple[Any, ...]] | None = ..., + setpgroup: int | None = ..., + resetids: bool = ..., + setsid: bool = ..., + setsigmask: Iterable[int] = ..., + setsigdef: Iterable[int] = ..., + scheduler: tuple[Any, sched_param] | None = ..., + ) -> int: ... + def posix_spawnp( + path: StrOrBytesPath, + argv: _ExecVArgs, + env: _ExecEnv, + *, + file_actions: Sequence[tuple[Any, ...]] | None = ..., + setpgroup: int | None = ..., + resetids: bool = ..., + setsid: bool = ..., + setsigmask: Iterable[int] = ..., + setsigdef: Iterable[int] = ..., + scheduler: tuple[Any, sched_param] | None = ..., + ) -> int: ... + POSIX_SPAWN_OPEN: int + POSIX_SPAWN_CLOSE: int + POSIX_SPAWN_DUP2: int if sys.platform != "win32": - from posix import sched_param + @final + class sched_param(structseq[int], tuple[int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("sched_priority",) + def __new__(cls: type[Self], sched_priority: int) -> Self: ... + @property + def sched_priority(self) -> int: ... + def sched_get_priority_min(policy: int) -> int: ... # some flavors of Unix def sched_get_priority_max(policy: int) -> int: ... # some flavors of Unix def sched_yield() -> None: ... # some flavors of Unix if sys.platform != "darwin": - def sched_setscheduler(pid: int, policy: int, param: sched_param) -> None: ... # some flavors of Unix - def sched_getscheduler(pid: int) -> int: ... # some flavors of Unix - def sched_rr_get_interval(pid: int) -> float: ... # some flavors of Unix - def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix - def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix - def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix - def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix + def sched_setscheduler(__pid: int, __policy: int, __param: sched_param) -> None: ... # some flavors of Unix + def sched_getscheduler(__pid: int) -> int: ... # some flavors of Unix + def sched_rr_get_interval(__pid: int) -> float: ... # some flavors of Unix + def sched_setparam(__pid: int, __param: sched_param) -> None: ... # some flavors of Unix + def sched_getparam(__pid: int) -> sched_param: ... # some flavors of Unix + def sched_setaffinity(__pid: int, __mask: Iterable[int]) -> None: ... # some flavors of Unix + def sched_getaffinity(__pid: int) -> set[int]: ... # some flavors of Unix def cpu_count() -> int | None: ... if sys.platform != "win32": # Unix only def confstr(__name: str | int) -> str | None: ... - def getloadavg() -> Tuple[float, float, float]: ... + def getloadavg() -> tuple[float, float, float]: ... def sysconf(__name: str | int) -> int: ... if sys.platform == "linux": @@ -841,7 +977,7 @@ if sys.platform == "linux": def urandom(__size: int) -> bytes: ... -if sys.version_info >= (3, 7) and sys.platform != "win32": +if sys.platform != "win32": def register_at_fork( *, before: Callable[..., Any] | None = ..., @@ -853,10 +989,11 @@ if sys.version_info >= (3, 8): if sys.platform == "win32": class _AddedDllDirectory: path: str | None - def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], Any]) -> None: ... + def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], object]) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... + def add_dll_directory(path: str) -> _AddedDllDirectory: ... if sys.platform == "linux": MFD_CLOEXEC: int @@ -877,3 +1014,12 @@ if sys.version_info >= (3, 8): MFD_HUGE_2GB: int MFD_HUGE_16GB: int def memfd_create(name: str, flags: int = ...) -> int: ... + def copy_file_range( + src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ... + ) -> int: ... + +if sys.version_info >= (3, 9): + def waitstatus_to_exitcode(status: int) -> int: ... + + if sys.platform == "linux": + def pidfd_open(pid: int, flags: int = ...) -> int: ... diff --git a/stdlib/os/path.pyi b/stdlib/os/path.pyi index 4533738..dc688a9 100644 --- a/stdlib/os/path.pyi +++ b/stdlib/os/path.pyi @@ -2,5 +2,7 @@ import sys if sys.platform == "win32": from ntpath import * + from ntpath import __all__ as __all__ else: from posixpath import * + from posixpath import __all__ as __all__ diff --git a/stdlib/ossaudiodev.pyi b/stdlib/ossaudiodev.pyi index f221c95..d956a89 100644 --- a/stdlib/ossaudiodev.pyi +++ b/stdlib/ossaudiodev.pyi @@ -1,131 +1,132 @@ +import sys from typing import Any, overload from typing_extensions import Literal -AFMT_AC3: int -AFMT_A_LAW: int -AFMT_IMA_ADPCM: int -AFMT_MPEG: int -AFMT_MU_LAW: int -AFMT_QUERY: int -AFMT_S16_BE: int -AFMT_S16_LE: int -AFMT_S16_NE: int -AFMT_S8: int -AFMT_U16_BE: int -AFMT_U16_LE: int -AFMT_U8: int -SNDCTL_COPR_HALT: int -SNDCTL_COPR_LOAD: int -SNDCTL_COPR_RCODE: int -SNDCTL_COPR_RCVMSG: int -SNDCTL_COPR_RDATA: int -SNDCTL_COPR_RESET: int -SNDCTL_COPR_RUN: int -SNDCTL_COPR_SENDMSG: int -SNDCTL_COPR_WCODE: int -SNDCTL_COPR_WDATA: int -SNDCTL_DSP_BIND_CHANNEL: int -SNDCTL_DSP_CHANNELS: int -SNDCTL_DSP_GETBLKSIZE: int -SNDCTL_DSP_GETCAPS: int -SNDCTL_DSP_GETCHANNELMASK: int -SNDCTL_DSP_GETFMTS: int -SNDCTL_DSP_GETIPTR: int -SNDCTL_DSP_GETISPACE: int -SNDCTL_DSP_GETODELAY: int -SNDCTL_DSP_GETOPTR: int -SNDCTL_DSP_GETOSPACE: int -SNDCTL_DSP_GETSPDIF: int -SNDCTL_DSP_GETTRIGGER: int -SNDCTL_DSP_MAPINBUF: int -SNDCTL_DSP_MAPOUTBUF: int -SNDCTL_DSP_NONBLOCK: int -SNDCTL_DSP_POST: int -SNDCTL_DSP_PROFILE: int -SNDCTL_DSP_RESET: int -SNDCTL_DSP_SAMPLESIZE: int -SNDCTL_DSP_SETDUPLEX: int -SNDCTL_DSP_SETFMT: int -SNDCTL_DSP_SETFRAGMENT: int -SNDCTL_DSP_SETSPDIF: int -SNDCTL_DSP_SETSYNCRO: int -SNDCTL_DSP_SETTRIGGER: int -SNDCTL_DSP_SPEED: int -SNDCTL_DSP_STEREO: int -SNDCTL_DSP_SUBDIVIDE: int -SNDCTL_DSP_SYNC: int -SNDCTL_FM_4OP_ENABLE: int -SNDCTL_FM_LOAD_INSTR: int -SNDCTL_MIDI_INFO: int -SNDCTL_MIDI_MPUCMD: int -SNDCTL_MIDI_MPUMODE: int -SNDCTL_MIDI_PRETIME: int -SNDCTL_SEQ_CTRLRATE: int -SNDCTL_SEQ_GETINCOUNT: int -SNDCTL_SEQ_GETOUTCOUNT: int -SNDCTL_SEQ_GETTIME: int -SNDCTL_SEQ_NRMIDIS: int -SNDCTL_SEQ_NRSYNTHS: int -SNDCTL_SEQ_OUTOFBAND: int -SNDCTL_SEQ_PANIC: int -SNDCTL_SEQ_PERCMODE: int -SNDCTL_SEQ_RESET: int -SNDCTL_SEQ_RESETSAMPLES: int -SNDCTL_SEQ_SYNC: int -SNDCTL_SEQ_TESTMIDI: int -SNDCTL_SEQ_THRESHOLD: int -SNDCTL_SYNTH_CONTROL: int -SNDCTL_SYNTH_ID: int -SNDCTL_SYNTH_INFO: int -SNDCTL_SYNTH_MEMAVL: int -SNDCTL_SYNTH_REMOVESAMPLE: int -SNDCTL_TMR_CONTINUE: int -SNDCTL_TMR_METRONOME: int -SNDCTL_TMR_SELECT: int -SNDCTL_TMR_SOURCE: int -SNDCTL_TMR_START: int -SNDCTL_TMR_STOP: int -SNDCTL_TMR_TEMPO: int -SNDCTL_TMR_TIMEBASE: int -SOUND_MIXER_ALTPCM: int -SOUND_MIXER_BASS: int -SOUND_MIXER_CD: int -SOUND_MIXER_DIGITAL1: int -SOUND_MIXER_DIGITAL2: int -SOUND_MIXER_DIGITAL3: int -SOUND_MIXER_IGAIN: int -SOUND_MIXER_IMIX: int -SOUND_MIXER_LINE: int -SOUND_MIXER_LINE1: int -SOUND_MIXER_LINE2: int -SOUND_MIXER_LINE3: int -SOUND_MIXER_MIC: int -SOUND_MIXER_MONITOR: int -SOUND_MIXER_NRDEVICES: int -SOUND_MIXER_OGAIN: int -SOUND_MIXER_PCM: int -SOUND_MIXER_PHONEIN: int -SOUND_MIXER_PHONEOUT: int -SOUND_MIXER_RADIO: int -SOUND_MIXER_RECLEV: int -SOUND_MIXER_SPEAKER: int -SOUND_MIXER_SYNTH: int -SOUND_MIXER_TREBLE: int -SOUND_MIXER_VIDEO: int -SOUND_MIXER_VOLUME: int +if sys.platform != "win32" and sys.platform != "darwin": + AFMT_AC3: int + AFMT_A_LAW: int + AFMT_IMA_ADPCM: int + AFMT_MPEG: int + AFMT_MU_LAW: int + AFMT_QUERY: int + AFMT_S16_BE: int + AFMT_S16_LE: int + AFMT_S16_NE: int + AFMT_S8: int + AFMT_U16_BE: int + AFMT_U16_LE: int + AFMT_U8: int + SNDCTL_COPR_HALT: int + SNDCTL_COPR_LOAD: int + SNDCTL_COPR_RCODE: int + SNDCTL_COPR_RCVMSG: int + SNDCTL_COPR_RDATA: int + SNDCTL_COPR_RESET: int + SNDCTL_COPR_RUN: int + SNDCTL_COPR_SENDMSG: int + SNDCTL_COPR_WCODE: int + SNDCTL_COPR_WDATA: int + SNDCTL_DSP_BIND_CHANNEL: int + SNDCTL_DSP_CHANNELS: int + SNDCTL_DSP_GETBLKSIZE: int + SNDCTL_DSP_GETCAPS: int + SNDCTL_DSP_GETCHANNELMASK: int + SNDCTL_DSP_GETFMTS: int + SNDCTL_DSP_GETIPTR: int + SNDCTL_DSP_GETISPACE: int + SNDCTL_DSP_GETODELAY: int + SNDCTL_DSP_GETOPTR: int + SNDCTL_DSP_GETOSPACE: int + SNDCTL_DSP_GETSPDIF: int + SNDCTL_DSP_GETTRIGGER: int + SNDCTL_DSP_MAPINBUF: int + SNDCTL_DSP_MAPOUTBUF: int + SNDCTL_DSP_NONBLOCK: int + SNDCTL_DSP_POST: int + SNDCTL_DSP_PROFILE: int + SNDCTL_DSP_RESET: int + SNDCTL_DSP_SAMPLESIZE: int + SNDCTL_DSP_SETDUPLEX: int + SNDCTL_DSP_SETFMT: int + SNDCTL_DSP_SETFRAGMENT: int + SNDCTL_DSP_SETSPDIF: int + SNDCTL_DSP_SETSYNCRO: int + SNDCTL_DSP_SETTRIGGER: int + SNDCTL_DSP_SPEED: int + SNDCTL_DSP_STEREO: int + SNDCTL_DSP_SUBDIVIDE: int + SNDCTL_DSP_SYNC: int + SNDCTL_FM_4OP_ENABLE: int + SNDCTL_FM_LOAD_INSTR: int + SNDCTL_MIDI_INFO: int + SNDCTL_MIDI_MPUCMD: int + SNDCTL_MIDI_MPUMODE: int + SNDCTL_MIDI_PRETIME: int + SNDCTL_SEQ_CTRLRATE: int + SNDCTL_SEQ_GETINCOUNT: int + SNDCTL_SEQ_GETOUTCOUNT: int + SNDCTL_SEQ_GETTIME: int + SNDCTL_SEQ_NRMIDIS: int + SNDCTL_SEQ_NRSYNTHS: int + SNDCTL_SEQ_OUTOFBAND: int + SNDCTL_SEQ_PANIC: int + SNDCTL_SEQ_PERCMODE: int + SNDCTL_SEQ_RESET: int + SNDCTL_SEQ_RESETSAMPLES: int + SNDCTL_SEQ_SYNC: int + SNDCTL_SEQ_TESTMIDI: int + SNDCTL_SEQ_THRESHOLD: int + SNDCTL_SYNTH_CONTROL: int + SNDCTL_SYNTH_ID: int + SNDCTL_SYNTH_INFO: int + SNDCTL_SYNTH_MEMAVL: int + SNDCTL_SYNTH_REMOVESAMPLE: int + SNDCTL_TMR_CONTINUE: int + SNDCTL_TMR_METRONOME: int + SNDCTL_TMR_SELECT: int + SNDCTL_TMR_SOURCE: int + SNDCTL_TMR_START: int + SNDCTL_TMR_STOP: int + SNDCTL_TMR_TEMPO: int + SNDCTL_TMR_TIMEBASE: int + SOUND_MIXER_ALTPCM: int + SOUND_MIXER_BASS: int + SOUND_MIXER_CD: int + SOUND_MIXER_DIGITAL1: int + SOUND_MIXER_DIGITAL2: int + SOUND_MIXER_DIGITAL3: int + SOUND_MIXER_IGAIN: int + SOUND_MIXER_IMIX: int + SOUND_MIXER_LINE: int + SOUND_MIXER_LINE1: int + SOUND_MIXER_LINE2: int + SOUND_MIXER_LINE3: int + SOUND_MIXER_MIC: int + SOUND_MIXER_MONITOR: int + SOUND_MIXER_NRDEVICES: int + SOUND_MIXER_OGAIN: int + SOUND_MIXER_PCM: int + SOUND_MIXER_PHONEIN: int + SOUND_MIXER_PHONEOUT: int + SOUND_MIXER_RADIO: int + SOUND_MIXER_RECLEV: int + SOUND_MIXER_SPEAKER: int + SOUND_MIXER_SYNTH: int + SOUND_MIXER_TREBLE: int + SOUND_MIXER_VIDEO: int + SOUND_MIXER_VOLUME: int -control_labels: list[str] -control_names: list[str] + control_labels: list[str] + control_names: list[str] -# TODO: oss_audio_device return type -@overload -def open(mode: Literal["r", "w", "rw"]) -> Any: ... -@overload -def open(device: str, mode: Literal["r", "w", "rw"]) -> Any: ... + # TODO: oss_audio_device return type + @overload + def open(mode: Literal["r", "w", "rw"]) -> Any: ... + @overload + def open(device: str, mode: Literal["r", "w", "rw"]) -> Any: ... -# TODO: oss_mixer_device return type -def openmixer(device: str = ...) -> Any: ... + # TODO: oss_mixer_device return type + def openmixer(device: str = ...) -> Any: ... -class OSSAudioError(Exception): ... - -error = OSSAudioError + class OSSAudioError(Exception): ... + error = OSSAudioError diff --git a/stdlib/parser.pyi b/stdlib/parser.pyi index aecf324..cce8594 100644 --- a/stdlib/parser.pyi +++ b/stdlib/parser.pyi @@ -1,22 +1,25 @@ from _typeshed import StrOrBytesPath +from collections.abc import Sequence from types import CodeType -from typing import Any, Sequence, Tuple +from typing import Any +from typing_extensions import final def expr(source: str) -> STType: ... def suite(source: str) -> STType: ... def sequence2st(sequence: Sequence[Any]) -> STType: ... def tuple2st(sequence: Sequence[Any]) -> STType: ... def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> list[Any]: ... -def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any, ...]: ... +def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> tuple[Any, ...]: ... def compilest(st: STType, filename: StrOrBytesPath = ...) -> CodeType: ... def isexpr(st: STType) -> bool: ... def issuite(st: STType) -> bool: ... class ParserError(Exception): ... +@final class STType: def compile(self, filename: StrOrBytesPath = ...) -> CodeType: ... def isexpr(self) -> bool: ... def issuite(self) -> bool: ... def tolist(self, line_info: bool = ..., col_info: bool = ...) -> list[Any]: ... - def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any, ...]: ... + def totuple(self, line_info: bool = ..., col_info: bool = ...) -> tuple[Any, ...]: ... diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index e8577eb..79c2352 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -5,37 +5,49 @@ from _typeshed import ( OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode, + ReadableBuffer, Self, + StrOrBytesPath, StrPath, ) +from collections.abc import Callable, Generator, Iterator, Sequence from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from os import PathLike, stat_result from types import TracebackType -from typing import IO, Any, BinaryIO, Generator, Sequence, Tuple, Type, TypeVar, overload +from typing import IO, Any, BinaryIO, overload from typing_extensions import Literal if sys.version_info >= (3, 9): from types import GenericAlias -_P = TypeVar("_P", bound=PurePath) +__all__ = ["PurePath", "PurePosixPath", "PureWindowsPath", "Path", "PosixPath", "WindowsPath"] class PurePath(PathLike[str]): - parts: Tuple[str, ...] - drive: str - root: str - anchor: str - name: str - suffix: str - suffixes: list[str] - stem: str - def __new__(cls: Type[_P], *args: StrPath) -> _P: ... - def __hash__(self) -> int: ... + @property + def parts(self) -> tuple[str, ...]: ... + @property + def drive(self) -> str: ... + @property + def root(self) -> str: ... + @property + def anchor(self) -> str: ... + @property + def name(self) -> str: ... + @property + def suffix(self) -> str: ... + @property + def suffixes(self) -> list[str]: ... + @property + def stem(self) -> str: ... + def __new__(cls: type[Self], *args: StrPath) -> Self: ... + def __eq__(self, other: object) -> bool: ... + def __fspath__(self) -> str: ... 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: StrPath) -> _P: ... - def __rtruediv__(self: _P, key: StrPath) -> _P: ... + def __truediv__(self: Self, key: StrPath) -> Self: ... + def __rtruediv__(self: Self, key: StrPath) -> Self: ... def __bytes__(self) -> bytes: ... def as_posix(self) -> str: ... def as_uri(self) -> str: ... @@ -43,46 +55,48 @@ class PurePath(PathLike[str]): def is_reserved(self) -> bool: ... if sys.version_info >= (3, 9): def is_relative_to(self, *other: StrPath) -> bool: ... + def match(self, path_pattern: str) -> bool: ... - def relative_to(self: _P, *other: StrPath) -> _P: ... - def with_name(self: _P, name: str) -> _P: ... + def relative_to(self: Self, *other: StrPath) -> Self: ... + def with_name(self: Self, name: str) -> Self: ... if sys.version_info >= (3, 9): - def with_stem(self: _P, stem: str) -> _P: ... - def with_suffix(self: _P, suffix: str) -> _P: ... - def joinpath(self: _P, *other: StrPath) -> _P: ... + def with_stem(self: Self, stem: str) -> Self: ... + + def with_suffix(self: Self, suffix: str) -> Self: ... + def joinpath(self: Self, *other: StrPath) -> Self: ... @property - def parents(self: _P) -> Sequence[_P]: ... + def parents(self: Self) -> Sequence[Self]: ... @property - def parent(self: _P) -> _P: ... - if sys.version_info >= (3, 9): + def parent(self: Self) -> Self: ... + if sys.version_info >= (3, 9) and sys.version_info < (3, 11): def __class_getitem__(cls, type: Any) -> GenericAlias: ... class PurePosixPath(PurePath): ... class PureWindowsPath(PurePath): ... class Path(PurePath): - def __new__(cls: Type[_P], *args: StrPath, **kwargs: Any) -> _P: ... + def __new__(cls: type[Self], *args: StrPath, **kwargs: Any) -> Self: ... def __enter__(self: Self) -> Self: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> bool | None: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... @classmethod - def cwd(cls: Type[_P]) -> _P: ... - def stat(self) -> stat_result: ... - def chmod(self, mode: int) -> None: ... + def cwd(cls: type[Self]) -> Self: ... + if sys.version_info >= (3, 10): + def stat(self, *, follow_symlinks: bool = ...) -> stat_result: ... + def chmod(self, mode: int, *, follow_symlinks: bool = ...) -> None: ... + else: + def stat(self) -> stat_result: ... + def chmod(self, mode: int) -> None: ... + def exists(self) -> bool: ... - def glob(self: _P, pattern: str) -> Generator[_P, None, None]: ... - def group(self) -> str: ... + def glob(self: Self, pattern: str) -> Generator[Self, None, None]: ... def is_dir(self) -> bool: ... def is_file(self) -> bool: ... - if sys.version_info >= (3, 7): - def is_mount(self) -> bool: ... def is_symlink(self) -> bool: ... def is_socket(self) -> bool: ... def is_fifo(self) -> bool: ... def is_block_device(self) -> bool: ... def is_char_device(self) -> bool: ... - def iterdir(self: _P) -> Generator[_P, None, None]: ... + def iterdir(self: Self) -> Generator[Self, None, None]: ... def lchmod(self, mode: int) -> None: ... def lstat(self) -> stat_result: ... def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ... @@ -134,42 +148,62 @@ class Path(PurePath): # Buffering cannot be determined: fall back to BinaryIO @overload def open( - self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ... + self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ... ) -> BinaryIO: ... # Fallback if mode is not specified @overload def open( self, mode: str, buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., newline: str | None = ... ) -> IO[Any]: ... - def owner(self) -> str: ... + if sys.platform != "win32": + # These methods do "exist" on Windows, but they always raise NotImplementedError, + # so it's safer to pretend they don't exist + def owner(self) -> str: ... + def group(self) -> str: ... + def is_mount(self) -> bool: ... + if sys.version_info >= (3, 9): - def readlink(self: _P) -> _P: ... + def readlink(self: Self) -> Self: ... if sys.version_info >= (3, 8): - def rename(self: _P, target: str | PurePath) -> _P: ... - def replace(self: _P, target: str | PurePath) -> _P: ... + def rename(self: Self, target: str | PurePath) -> Self: ... + def replace(self: Self, target: str | PurePath) -> Self: ... else: def rename(self, target: str | PurePath) -> None: ... def replace(self, target: str | PurePath) -> None: ... - def resolve(self: _P, strict: bool = ...) -> _P: ... - def rglob(self: _P, pattern: str) -> Generator[_P, None, None]: ... + + def resolve(self: Self, strict: bool = ...) -> Self: ... + def rglob(self: Self, pattern: str) -> Generator[Self, None, None]: ... def rmdir(self) -> None: ... def symlink_to(self, target: str | Path, target_is_directory: bool = ...) -> None: ... + if sys.version_info >= (3, 10): + def hardlink_to(self, target: str | Path) -> None: ... + def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... if sys.version_info >= (3, 8): def unlink(self, missing_ok: bool = ...) -> None: ... else: def unlink(self) -> None: ... + @classmethod - def home(cls: Type[_P]) -> _P: ... - def absolute(self: _P) -> _P: ... - def expanduser(self: _P) -> _P: ... + def home(cls: type[Self]) -> Self: ... + def absolute(self: Self) -> Self: ... + def expanduser(self: Self) -> Self: ... def read_bytes(self) -> bytes: ... def read_text(self, encoding: str | None = ..., errors: str | None = ...) -> str: ... - def samefile(self, other_path: str | bytes | int | Path) -> bool: ... - def write_bytes(self, data: bytes) -> int: ... - def write_text(self, data: str, encoding: str | None = ..., errors: str | None = ...) -> int: ... - if sys.version_info >= (3, 8): - def link_to(self, target: StrPath | bytes) -> None: ... + def samefile(self, other_path: StrPath) -> bool: ... + def write_bytes(self, data: ReadableBuffer) -> int: ... + if sys.version_info >= (3, 10): + def write_text( + self, data: str, encoding: str | None = ..., errors: str | None = ..., newline: str | None = ... + ) -> int: ... + else: + def write_text(self, data: str, encoding: str | None = ..., errors: str | None = ...) -> int: ... + if sys.version_info >= (3, 8) and sys.version_info < (3, 12): + def link_to(self, target: StrOrBytesPath) -> None: ... + if sys.version_info >= (3, 12): + def walk( + self: Self, top_down: bool = ..., on_error: Callable[[OSError], object] | None = ..., follow_symlinks: bool = ... + ) -> Iterator[tuple[Self, list[str], list[str]]]: ... class PosixPath(Path, PurePosixPath): ... class WindowsPath(Path, PureWindowsPath): ... diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index 0a25786..6e95dcf 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -1,12 +1,18 @@ import signal import sys +from _typeshed import Self from bdb import Bdb from cmd import Cmd +from collections.abc import Callable, Iterable, Mapping, Sequence from inspect import _SourceObjectType from types import CodeType, FrameType, TracebackType -from typing import IO, Any, Callable, ClassVar, Iterable, Mapping, Sequence, Tuple, TypeVar +from typing import IO, Any, ClassVar, TypeVar +from typing_extensions import ParamSpec + +__all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", "post_mortem", "help"] _T = TypeVar("_T") +_P = ParamSpec("_P") line_prefix: str # undocumented @@ -15,14 +21,8 @@ class Restart(Exception): ... def run(statement: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... def runeval(expression: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... def runctx(statement: str, globals: dict[str, Any], locals: Mapping[str, Any]) -> None: ... -def runcall(func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... - -if sys.version_info >= (3, 7): - def set_trace(*, header: str | None = ...) -> None: ... - -else: - def set_trace() -> None: ... - +def runcall(func: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T | None: ... +def set_trace(*, header: str | None = ...) -> None: ... def post_mortem(t: TracebackType | None = ...) -> None: ... def pm() -> None: ... @@ -41,7 +41,7 @@ class Pdb(Bdb, Cmd): commands_defining: bool commands_bnum: int | None lineno: int | None - stack: list[Tuple[FrameType, int]] + stack: list[tuple[FrameType, int]] curindex: int curframe: FrameType | None curframe_locals: Mapping[str, Any] @@ -62,13 +62,15 @@ class Pdb(Bdb, Cmd): def displayhook(self, obj: object) -> None: ... def handle_command_def(self, line: str) -> bool: ... def defaultFile(self) -> str: ... - def lineinfo(self, identifier: str) -> Tuple[None, None, None] | Tuple[str, str, int]: ... + def lineinfo(self, identifier: str) -> tuple[None, None, None] | tuple[str, str, int]: ... def checkline(self, filename: str, lineno: int) -> int: ... def _getval(self, arg: str) -> object: ... def print_stack_trace(self) -> None: ... - def print_stack_entry(self, frame_lineno: Tuple[FrameType, int], prompt_prefix: str = ...) -> None: ... + def print_stack_entry(self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = ...) -> None: ... def lookupmodule(self, filename: str) -> str | None: ... - def _runscript(self, filename: str) -> None: ... + if sys.version_info < (3, 11): + def _runscript(self, filename: str) -> None: ... + def do_commands(self, arg: str) -> bool | None: ... def do_break(self, arg: str, temporary: bool = ...) -> bool | None: ... def do_tbreak(self, arg: str) -> bool | None: ... @@ -159,16 +161,16 @@ class Pdb(Bdb, Cmd): complete_whatis = _complete_expression complete_display = _complete_expression - if sys.version_info >= (3, 7): + if sys.version_info < (3, 11): def _runmodule(self, module_name: str) -> None: ... # undocumented -def find_function(funcname: str, filename: str) -> Tuple[str, str, int] | None: ... +def find_function(funcname: str, filename: str) -> tuple[str, str, int] | None: ... def main() -> None: ... def help() -> None: ... -def getsourcelines(obj: _SourceObjectType) -> Tuple[list[str], int]: ... +def getsourcelines(obj: _SourceObjectType) -> tuple[list[str], int]: ... def lasti2lineno(code: CodeType, lasti: int) -> int: ... class _rstr(str): - def __repr__(self) -> _rstr: ... + def __repr__(self: Self) -> Self: ... diff --git a/stdlib/pickle.pyi b/stdlib/pickle.pyi index da6c5d1..f393452 100644 --- a/stdlib/pickle.pyi +++ b/stdlib/pickle.pyi @@ -1,29 +1,112 @@ import sys -from typing import Any, Callable, ClassVar, Iterable, Iterator, Mapping, Optional, Protocol, Tuple, Type, Union +from _typeshed import ReadableBuffer, SupportsWrite +from collections.abc import Callable, Iterable, Iterator, Mapping +from typing import Any, ClassVar, Protocol, SupportsBytes, Union +from typing_extensions import SupportsIndex, TypeAlias, final + +__all__ = [ + "PickleError", + "PicklingError", + "UnpicklingError", + "Pickler", + "Unpickler", + "dump", + "dumps", + "load", + "loads", + "ADDITEMS", + "APPEND", + "APPENDS", + "BINBYTES", + "BINBYTES8", + "BINFLOAT", + "BINGET", + "BININT", + "BININT1", + "BININT2", + "BINPERSID", + "BINPUT", + "BINSTRING", + "BINUNICODE", + "BINUNICODE8", + "BUILD", + "DEFAULT_PROTOCOL", + "DICT", + "DUP", + "EMPTY_DICT", + "EMPTY_LIST", + "EMPTY_SET", + "EMPTY_TUPLE", + "EXT1", + "EXT2", + "EXT4", + "FALSE", + "FLOAT", + "FRAME", + "FROZENSET", + "GET", + "GLOBAL", + "HIGHEST_PROTOCOL", + "INST", + "INT", + "LIST", + "LONG", + "LONG1", + "LONG4", + "LONG_BINGET", + "LONG_BINPUT", + "MARK", + "MEMOIZE", + "NEWFALSE", + "NEWOBJ", + "NEWOBJ_EX", + "NEWTRUE", + "NONE", + "OBJ", + "PERSID", + "POP", + "POP_MARK", + "PROTO", + "PUT", + "REDUCE", + "SETITEM", + "SETITEMS", + "SHORT_BINBYTES", + "SHORT_BINSTRING", + "SHORT_BINUNICODE", + "STACK_GLOBAL", + "STOP", + "STRING", + "TRUE", + "TUPLE", + "TUPLE1", + "TUPLE2", + "TUPLE3", + "UNICODE", +] + +if sys.version_info >= (3, 8): + __all__ += ["BYTEARRAY8", "NEXT_BUFFER", "PickleBuffer", "READONLY_BUFFER"] HIGHEST_PROTOCOL: int DEFAULT_PROTOCOL: int -bytes_types: Tuple[Type[Any], ...] # undocumented +bytes_types: tuple[type[Any], ...] # undocumented class _ReadableFileobj(Protocol): def read(self, __n: int) -> bytes: ... def readline(self) -> bytes: ... -class _WritableFileobj(Protocol): - def write(self, __b: bytes) -> Any: ... - if sys.version_info >= (3, 8): - # TODO: holistic design for buffer interface (typing.Buffer?) + @final class PickleBuffer: - # buffer must be a buffer-providing object - def __init__(self, buffer: Any) -> None: ... + def __init__(self, buffer: ReadableBuffer) -> None: ... def raw(self) -> memoryview: ... def release(self) -> None: ... - _BufferCallback = Optional[Callable[[PickleBuffer], Any]] + _BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None def dump( obj: Any, - file: _WritableFileobj, + file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ..., @@ -41,37 +124,42 @@ if sys.version_info >= (3, 8): buffers: Iterable[Any] | None = ..., ) -> Any: ... def loads( - __data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ..., buffers: Iterable[Any] | None = ... + __data: ReadableBuffer, + *, + fix_imports: bool = ..., + encoding: str = ..., + errors: str = ..., + buffers: Iterable[Any] | None = ..., ) -> Any: ... else: - def dump(obj: Any, file: _WritableFileobj, protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ... + def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ... def dumps(obj: Any, protocol: int | None = ..., *, fix_imports: bool = ...) -> bytes: ... def load(file: _ReadableFileobj, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... - def loads(data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... + def loads(data: ReadableBuffer, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... class PickleError(Exception): ... class PicklingError(PickleError): ... class UnpicklingError(PickleError): ... -_reducedtype = Union[ +_ReducedType: TypeAlias = Union[ str, - Tuple[Callable[..., Any], Tuple[Any, ...]], - Tuple[Callable[..., Any], Tuple[Any, ...], Any], - Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]]], - Tuple[Callable[..., Any], Tuple[Any, ...], Any, Optional[Iterator[Any]], Optional[Iterator[Any]]], + tuple[Callable[..., Any], tuple[Any, ...]], + tuple[Callable[..., Any], tuple[Any, ...], Any], + tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None], + tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None], ] class Pickler: fast: bool - dispatch_table: Mapping[type, Callable[[Any], _reducedtype]] + dispatch_table: Mapping[type, Callable[[Any], _ReducedType]] bin: bool # undocumented dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only if sys.version_info >= (3, 8): def __init__( self, - file: _WritableFileobj, + file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ..., @@ -79,7 +167,8 @@ class Pickler: ) -> None: ... def reducer_override(self, obj: Any) -> Any: ... else: - def __init__(self, file: _WritableFileobj, protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ... + def __init__(self, file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ... + def dump(self, __obj: Any) -> None: ... def clear_memo(self) -> None: ... def persistent_id(self, obj: Any) -> Any: ... @@ -101,6 +190,7 @@ class Unpickler: def __init__( self, file: _ReadableFileobj, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ... ) -> None: ... + def load(self) -> Any: ... def find_class(self, __module_name: str, __global_name: str) -> Any: ... def persistent_load(self, pid: Any) -> Any: ... @@ -187,7 +277,7 @@ if sys.version_info >= (3, 8): READONLY_BUFFER: bytes def encode_long(x: int) -> bytes: ... # undocumented -def decode_long(data: bytes) -> int: ... # undocumented +def decode_long(data: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer) -> int: ... # undocumented # pure-Python implementations _Pickler = Pickler # undocumented diff --git a/stdlib/pickletools.pyi b/stdlib/pickletools.pyi index 0f0fb47..2f0d5f1 100644 --- a/stdlib/pickletools.pyi +++ b/stdlib/pickletools.pyi @@ -1,7 +1,11 @@ -from typing import IO, Any, Callable, Iterator, MutableMapping, Tuple, Type +from collections.abc import Callable, Iterator, MutableMapping +from typing import IO, Any +from typing_extensions import TypeAlias -_Reader = Callable[[IO[bytes]], Any] -bytes_types: Tuple[Type[Any], ...] +__all__ = ["dis", "genops", "optimize"] + +_Reader: TypeAlias = Callable[[IO[bytes]], Any] +bytes_types: tuple[type[Any], ...] UP_TO_NEWLINE: int TAKEN_FROM_ARGUMENT1: int @@ -9,7 +13,7 @@ TAKEN_FROM_ARGUMENT4: int TAKEN_FROM_ARGUMENT4U: int TAKEN_FROM_ARGUMENT8U: int -class ArgumentDescriptor(object): +class ArgumentDescriptor: name: str n: int reader: _Reader @@ -106,11 +110,11 @@ def read_long4(f: IO[bytes]) -> int: ... long4: ArgumentDescriptor -class StackObject(object): +class StackObject: name: str - obtype: Type[Any] | Tuple[Type[Any], ...] + obtype: type[Any] | tuple[type[Any], ...] doc: str - def __init__(self, name: str, obtype: Type[Any] | Tuple[Type[Any], ...], doc: str) -> None: ... + def __init__(self, name: str, obtype: type[Any] | tuple[type[Any], ...], doc: str) -> None: ... pyint: StackObject pylong: StackObject @@ -131,7 +135,7 @@ anyobject: StackObject markobject: StackObject stackslice: StackObject -class OpcodeInfo(object): +class OpcodeInfo: name: str code: str arg: ArgumentDescriptor | None @@ -152,10 +156,10 @@ class OpcodeInfo(object): opcodes: list[OpcodeInfo] -def genops(pickle: bytes | IO[bytes]) -> Iterator[Tuple[OpcodeInfo, Any | None, int | None]]: ... -def optimize(p: bytes | IO[bytes]) -> bytes: ... +def genops(pickle: bytes | bytearray | IO[bytes]) -> Iterator[tuple[OpcodeInfo, Any | None, int | None]]: ... +def optimize(p: bytes | bytearray | IO[bytes]) -> bytes: ... def dis( - pickle: bytes | IO[bytes], + pickle: bytes | bytearray | IO[bytes], out: IO[str] | None = ..., memo: MutableMapping[int, Any] | None = ..., indentlevel: int = ..., diff --git a/stdlib/pipes.pyi b/stdlib/pipes.pyi index fb9d7e4..fe680bf 100644 --- a/stdlib/pipes.pyi +++ b/stdlib/pipes.pyi @@ -1,7 +1,8 @@ import os +__all__ = ["Template"] + class Template: - def __init__(self) -> None: ... def reset(self) -> None: ... def clone(self) -> Template: ... def debug(self, flag: bool) -> None: ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index 54e0f22..f91ab78 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -1,29 +1,47 @@ import sys from _typeshed import SupportsRead +from collections.abc import Callable, Iterable, Iterator from importlib.abc import Loader, MetaPathFinder, PathEntryFinder -from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple, Tuple +from typing import IO, Any, NamedTuple, TypeVar + +__all__ = [ + "get_importer", + "iter_importers", + "get_loader", + "find_loader", + "walk_packages", + "iter_modules", + "get_data", + "ImpImporter", + "ImpLoader", + "read_code", + "extend_path", + "ModuleInfo", +] + +_PathT = TypeVar("_PathT", bound=Iterable[str]) class ModuleInfo(NamedTuple): module_finder: MetaPathFinder | PathEntryFinder name: str ispkg: bool -def extend_path(path: list[str], name: str) -> list[str]: ... +def extend_path(path: _PathT, name: str) -> _PathT: ... class ImpImporter: def __init__(self, path: str | None = ...) -> None: ... class ImpLoader: - def __init__(self, fullname: str, file: IO[str], filename: str, etc: Tuple[str, str, int]) -> None: ... + def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ... def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... -def get_loader(module_or_name: str) -> Loader: ... +def get_loader(module_or_name: str) -> Loader | None: ... def iter_importers(fullname: str = ...) -> Iterator[MetaPathFinder | PathEntryFinder]: ... def iter_modules(path: Iterable[str] | None = ..., prefix: str = ...) -> Iterator[ModuleInfo]: ... def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented def walk_packages( - path: Iterable[str] | None = ..., prefix: str = ..., onerror: Callable[[str], None] | None = ... + path: Iterable[str] | None = ..., prefix: str = ..., onerror: Callable[[str], object] | None = ... ) -> Iterator[ModuleInfo]: ... def get_data(package: str, resource: str) -> bytes | None: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index d0f08a2..765a7a5 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -4,40 +4,40 @@ if sys.version_info < (3, 8): import os DEV_NULL = os.devnull -from typing import NamedTuple, Tuple +from typing import NamedTuple if sys.version_info >= (3, 8): - def libc_ver(executable: str | None = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> Tuple[str, str]: ... + def libc_ver(executable: str | None = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ... else: - def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> Tuple[str, str]: ... + def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ... if sys.version_info < (3, 8): def linux_distribution( distname: str = ..., version: str = ..., id: str = ..., - supported_dists: Tuple[str, ...] = ..., + supported_dists: tuple[str, ...] = ..., full_distribution_name: bool = ..., - ) -> Tuple[str, str, str]: ... + ) -> tuple[str, str, str]: ... def dist( - distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ... - ) -> Tuple[str, str, str]: ... + distname: str = ..., version: str = ..., id: str = ..., supported_dists: tuple[str, ...] = ... + ) -> tuple[str, str, str]: ... -def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> Tuple[str, str, str, str]: ... +def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> tuple[str, str, str, str]: ... if sys.version_info >= (3, 8): def win32_edition() -> str: ... def win32_is_iot() -> bool: ... def mac_ver( - release: str = ..., versioninfo: Tuple[str, str, str] = ..., machine: str = ... -) -> Tuple[str, Tuple[str, str, str], str]: ... + release: str = ..., versioninfo: tuple[str, str, str] = ..., machine: str = ... +) -> tuple[str, tuple[str, str, str], str]: ... def java_ver( - release: str = ..., vendor: str = ..., vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ... -) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ... -def system_alias(system: str, release: str, version: str) -> Tuple[str, str, str]: ... -def architecture(executable: str = ..., bits: str = ..., linkage: str = ...) -> Tuple[str, str]: ... + release: str = ..., vendor: str = ..., vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... +) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... +def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... +def architecture(executable: str = ..., bits: str = ..., linkage: str = ...) -> tuple[str, str]: ... class uname_result(NamedTuple): system: str @@ -56,9 +56,12 @@ def machine() -> str: ... def processor() -> str: ... def python_implementation() -> str: ... def python_version() -> str: ... -def python_version_tuple() -> Tuple[str, str, str]: ... +def python_version_tuple() -> tuple[str, str, str]: ... def python_branch() -> str: ... def python_revision() -> str: ... -def python_build() -> Tuple[str, str]: ... +def python_build() -> tuple[str, str]: ... def python_compiler() -> str: ... def platform(aliased: bool = ..., terse: bool = ...) -> str: ... + +if sys.version_info >= (3, 10): + def freedesktop_os_release() -> dict[str, str]: ... diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 93d4fdc..4ec9cbd 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -1,7 +1,43 @@ import sys +from _typeshed import ReadableBuffer, Self +from collections.abc import Mapping, MutableMapping from datetime import datetime from enum import Enum -from typing import IO, Any, Dict as _Dict, List, Mapping, MutableMapping, Tuple, Type +from typing import IO, Any + +if sys.version_info >= (3, 9): + __all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"] +elif sys.version_info >= (3, 8): + __all__ = [ + "readPlist", + "writePlist", + "readPlistFromBytes", + "writePlistToBytes", + "Data", + "InvalidFileException", + "FMT_XML", + "FMT_BINARY", + "load", + "dump", + "loads", + "dumps", + "UID", + ] +else: + __all__ = [ + "readPlist", + "writePlist", + "readPlistFromBytes", + "writePlistToBytes", + "Data", + "InvalidFileException", + "FMT_XML", + "FMT_BINARY", + "load", + "dump", + "loads", + "dumps", + ] class PlistFormat(Enum): FMT_XML: int @@ -11,8 +47,10 @@ FMT_XML = PlistFormat.FMT_XML FMT_BINARY = PlistFormat.FMT_BINARY if sys.version_info >= (3, 9): - def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: Type[MutableMapping[str, Any]] = ...) -> Any: ... - def loads(value: bytes, *, fmt: PlistFormat | None = ..., dict_type: Type[MutableMapping[str, Any]] = ...) -> Any: ... + def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ... + def loads( + value: ReadableBuffer, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ... + ) -> Any: ... else: def load( @@ -20,18 +58,18 @@ else: *, fmt: PlistFormat | None = ..., use_builtin_types: bool = ..., - dict_type: Type[MutableMapping[str, Any]] = ..., + dict_type: type[MutableMapping[str, Any]] = ..., ) -> Any: ... def loads( - value: bytes, + value: ReadableBuffer, *, fmt: PlistFormat | None = ..., use_builtin_types: bool = ..., - dict_type: Type[MutableMapping[str, Any]] = ..., + dict_type: type[MutableMapping[str, Any]] = ..., ) -> Any: ... def dump( - value: Mapping[str, Any] | List[Any] | Tuple[Any, ...] | str | bool | float | bytes | datetime, + value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime, fp: IO[bytes], *, fmt: PlistFormat = ..., @@ -39,7 +77,7 @@ def dump( skipkeys: bool = ..., ) -> None: ... def dumps( - value: Mapping[str, Any] | List[Any] | Tuple[Any, ...] | str | bool | float | bytes | datetime, + value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime, *, fmt: PlistFormat = ..., skipkeys: bool = ..., @@ -49,15 +87,9 @@ def dumps( if sys.version_info < (3, 9): def readPlist(pathOrFile: str | IO[bytes]) -> Any: ... def writePlist(value: Mapping[str, Any], pathOrFile: str | IO[bytes]) -> None: ... - def readPlistFromBytes(data: bytes) -> Any: ... + def readPlistFromBytes(data: ReadableBuffer) -> Any: ... def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ... -if sys.version_info < (3, 7): - class Dict(_Dict[str, Any]): - def __getattr__(self, attr: str) -> Any: ... - def __setattr__(self, attr: str, value: Any) -> None: ... - def __delattr__(self, attr: str) -> None: ... - if sys.version_info < (3, 9): class Data: data: bytes @@ -68,8 +100,8 @@ if sys.version_info >= (3, 8): data: int def __init__(self, data: int) -> None: ... def __index__(self) -> int: ... - def __reduce__(self) -> Any: ... - def __hash__(self) -> int: ... + def __reduce__(self: Self) -> tuple[type[Self], tuple[int]]: ... + def __eq__(self, other: object) -> bool: ... class InvalidFileException(ValueError): def __init__(self, message: str = ...) -> None: ... diff --git a/stdlib/poplib.pyi b/stdlib/poplib.pyi index 8d19067..fd7afed 100644 --- a/stdlib/poplib.pyi +++ b/stdlib/poplib.pyi @@ -1,16 +1,22 @@ import socket import ssl -from typing import Any, BinaryIO, List, Pattern, Tuple, overload +from builtins import list as _list # conflicts with a method named "list" +from re import Pattern +from typing import Any, BinaryIO, NoReturn, overload +from typing_extensions import Literal, TypeAlias -_LongResp = Tuple[bytes, List[bytes], int] +__all__ = ["POP3", "error_proto", "POP3_SSL"] + +_LongResp: TypeAlias = tuple[bytes, list[bytes], int] class error_proto(Exception): ... -POP3_PORT: int -POP3_SSL_PORT: int -CR: bytes -LF: bytes -CRLF: bytes +POP3_PORT: Literal[110] +POP3_SSL_PORT: Literal[995] +CR: Literal[b"\r"] +LF: Literal[b"\n"] +CRLF: Literal[b"\r\n"] +HAVE_SSL: bool class POP3: encoding: str @@ -24,7 +30,7 @@ class POP3: def set_debuglevel(self, level: int) -> None: ... def user(self, user: str) -> bytes: ... def pass_(self, pswd: str) -> bytes: ... - def stat(self) -> Tuple[int, int]: ... + def stat(self) -> tuple[int, int]: ... def list(self, which: Any | None = ...) -> _LongResp: ... def retr(self, which: Any) -> _LongResp: ... def dele(self, which: Any) -> bytes: ... @@ -41,7 +47,7 @@ class POP3: @overload def uidl(self, which: Any) -> bytes: ... def utf8(self) -> bytes: ... - def capa(self) -> dict[str, List[str]]: ... + def capa(self) -> dict[str, _list[str]]: ... def stls(self, context: ssl.SSLContext | None = ...) -> bytes: ... class POP3_SSL(POP3): @@ -55,4 +61,4 @@ class POP3_SSL(POP3): context: ssl.SSLContext | None = ..., ) -> None: ... # "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored - def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> bytes: ... + def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> NoReturn: ... diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index aef3b54..ffd9675 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -1,201 +1,319 @@ import sys -from _typeshed import StrOrBytesPath -from os import PathLike, _ExecEnv, _ExecVArgs, stat_result as stat_result -from typing import Any, Iterable, NamedTuple, Sequence, Tuple, overload -class uname_result(NamedTuple): - sysname: str - nodename: str - release: str - version: str - machine: str +if sys.platform != "win32": + # Actually defined here, but defining in os allows sharing code with windows + from os import ( + CLD_CONTINUED as CLD_CONTINUED, + CLD_DUMPED as CLD_DUMPED, + CLD_EXITED as CLD_EXITED, + CLD_TRAPPED as CLD_TRAPPED, + EX_CANTCREAT as EX_CANTCREAT, + EX_CONFIG as EX_CONFIG, + EX_DATAERR as EX_DATAERR, + EX_IOERR as EX_IOERR, + EX_NOHOST as EX_NOHOST, + EX_NOINPUT as EX_NOINPUT, + EX_NOPERM as EX_NOPERM, + EX_NOTFOUND as EX_NOTFOUND, + EX_NOUSER as EX_NOUSER, + EX_OK as EX_OK, + EX_OSERR as EX_OSERR, + EX_OSFILE as EX_OSFILE, + EX_PROTOCOL as EX_PROTOCOL, + EX_SOFTWARE as EX_SOFTWARE, + EX_TEMPFAIL as EX_TEMPFAIL, + EX_UNAVAILABLE as EX_UNAVAILABLE, + EX_USAGE as EX_USAGE, + F_LOCK as F_LOCK, + F_OK as F_OK, + F_TEST as F_TEST, + F_TLOCK as F_TLOCK, + F_ULOCK as F_ULOCK, + O_APPEND as O_APPEND, + O_ASYNC as O_ASYNC, + O_CREAT as O_CREAT, + O_DIRECT as O_DIRECT, + O_DIRECTORY as O_DIRECTORY, + O_DSYNC as O_DSYNC, + O_EXCL as O_EXCL, + O_LARGEFILE as O_LARGEFILE, + O_NDELAY as O_NDELAY, + O_NOATIME as O_NOATIME, + O_NOCTTY as O_NOCTTY, + O_NOFOLLOW as O_NOFOLLOW, + O_NONBLOCK as O_NONBLOCK, + O_RDONLY as O_RDONLY, + O_RDWR as O_RDWR, + O_RSYNC as O_RSYNC, + O_SYNC as O_SYNC, + O_TRUNC as O_TRUNC, + O_WRONLY as O_WRONLY, + P_ALL as P_ALL, + P_PGID as P_PGID, + P_PID as P_PID, + PRIO_PGRP as PRIO_PGRP, + PRIO_PROCESS as PRIO_PROCESS, + PRIO_USER as PRIO_USER, + R_OK as R_OK, + RTLD_GLOBAL as RTLD_GLOBAL, + RTLD_LAZY as RTLD_LAZY, + RTLD_LOCAL as RTLD_LOCAL, + RTLD_NODELETE as RTLD_NODELETE, + RTLD_NOLOAD as RTLD_NOLOAD, + RTLD_NOW as RTLD_NOW, + SCHED_BATCH as SCHED_BATCH, + SCHED_FIFO as SCHED_FIFO, + SCHED_IDLE as SCHED_IDLE, + SCHED_OTHER as SCHED_OTHER, + SCHED_RESET_ON_FORK as SCHED_RESET_ON_FORK, + SCHED_RR as SCHED_RR, + SCHED_SPORADIC as SCHED_SPORADIC, + SEEK_DATA as SEEK_DATA, + SEEK_HOLE as SEEK_HOLE, + ST_NOSUID as ST_NOSUID, + ST_RDONLY as ST_RDONLY, + TMP_MAX as TMP_MAX, + W_OK as W_OK, + WCONTINUED as WCONTINUED, + WCOREDUMP as WCOREDUMP, + WEXITED as WEXITED, + WEXITSTATUS as WEXITSTATUS, + WIFCONTINUED as WIFCONTINUED, + WIFEXITED as WIFEXITED, + WIFSIGNALED as WIFSIGNALED, + WIFSTOPPED as WIFSTOPPED, + WNOHANG as WNOHANG, + WNOWAIT as WNOWAIT, + WSTOPPED as WSTOPPED, + WSTOPSIG as WSTOPSIG, + WTERMSIG as WTERMSIG, + WUNTRACED as WUNTRACED, + X_OK as X_OK, + DirEntry as DirEntry, + _exit as _exit, + abort as abort, + access as access, + chdir as chdir, + chmod as chmod, + chown as chown, + chroot as chroot, + close as close, + closerange as closerange, + confstr as confstr, + confstr_names as confstr_names, + cpu_count as cpu_count, + ctermid as ctermid, + device_encoding as device_encoding, + dup as dup, + dup2 as dup2, + error as error, + execv as execv, + execve as execve, + fchdir as fchdir, + fchmod as fchmod, + fchown as fchown, + fork as fork, + forkpty as forkpty, + fpathconf as fpathconf, + fspath as fspath, + fstat as fstat, + fstatvfs as fstatvfs, + fsync as fsync, + ftruncate as ftruncate, + get_blocking as get_blocking, + get_inheritable as get_inheritable, + get_terminal_size as get_terminal_size, + getcwd as getcwd, + getcwdb as getcwdb, + getegid as getegid, + geteuid as geteuid, + getgid as getgid, + getgrouplist as getgrouplist, + getgroups as getgroups, + getloadavg as getloadavg, + getlogin as getlogin, + getpgid as getpgid, + getpgrp as getpgrp, + getpid as getpid, + getppid as getppid, + getpriority as getpriority, + getsid as getsid, + getuid as getuid, + initgroups as initgroups, + isatty as isatty, + kill as kill, + killpg as killpg, + lchown as lchown, + link as link, + listdir as listdir, + lockf as lockf, + lseek as lseek, + lstat as lstat, + major as major, + makedev as makedev, + minor as minor, + mkdir as mkdir, + mkfifo as mkfifo, + mknod as mknod, + nice as nice, + open as open, + openpty as openpty, + pathconf as pathconf, + pathconf_names as pathconf_names, + pipe as pipe, + pread as pread, + putenv as putenv, + pwrite as pwrite, + read as read, + readlink as readlink, + readv as readv, + remove as remove, + rename as rename, + replace as replace, + rmdir as rmdir, + scandir as scandir, + sched_get_priority_max as sched_get_priority_max, + sched_get_priority_min as sched_get_priority_min, + sched_param as sched_param, + sched_yield as sched_yield, + sendfile as sendfile, + set_blocking as set_blocking, + set_inheritable as set_inheritable, + setegid as setegid, + seteuid as seteuid, + setgid as setgid, + setgroups as setgroups, + setpgid as setpgid, + setpgrp as setpgrp, + setpriority as setpriority, + setregid as setregid, + setreuid as setreuid, + setsid as setsid, + setuid as setuid, + stat as stat, + stat_result as stat_result, + statvfs as statvfs, + statvfs_result as statvfs_result, + strerror as strerror, + symlink as symlink, + sync as sync, + sysconf as sysconf, + sysconf_names as sysconf_names, + system as system, + tcgetpgrp as tcgetpgrp, + tcsetpgrp as tcsetpgrp, + terminal_size as terminal_size, + times as times, + times_result as times_result, + truncate as truncate, + ttyname as ttyname, + umask as umask, + uname as uname, + uname_result as uname_result, + unlink as unlink, + unsetenv as unsetenv, + urandom as urandom, + utime as utime, + wait as wait, + wait3 as wait3, + wait4 as wait4, + waitpid as waitpid, + write as write, + writev as writev, + ) -class times_result(NamedTuple): - user: float - system: float - children_user: float - children_system: float - elapsed: float + if sys.platform == "linux": + from os import ( + GRND_NONBLOCK as GRND_NONBLOCK, + GRND_RANDOM as GRND_RANDOM, + RTLD_DEEPBIND as RTLD_DEEPBIND, + XATTR_CREATE as XATTR_CREATE, + XATTR_REPLACE as XATTR_REPLACE, + XATTR_SIZE_MAX as XATTR_SIZE_MAX, + getrandom as getrandom, + getxattr as getxattr, + listxattr as listxattr, + removexattr as removexattr, + setxattr as setxattr, + ) + else: + from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod -if sys.platform != "darwin": - class waitid_result(NamedTuple): - si_pid: int - si_uid: int - si_signo: int - si_status: int - si_code: int + if sys.platform != "darwin": + from os import ( + POSIX_FADV_DONTNEED as POSIX_FADV_DONTNEED, + POSIX_FADV_NOREUSE as POSIX_FADV_NOREUSE, + POSIX_FADV_NORMAL as POSIX_FADV_NORMAL, + POSIX_FADV_RANDOM as POSIX_FADV_RANDOM, + POSIX_FADV_SEQUENTIAL as POSIX_FADV_SEQUENTIAL, + POSIX_FADV_WILLNEED as POSIX_FADV_WILLNEED, + fdatasync as fdatasync, + getresgid as getresgid, + getresuid as getresuid, + pipe2 as pipe2, + posix_fadvise as posix_fadvise, + posix_fallocate as posix_fallocate, + sched_getaffinity as sched_getaffinity, + sched_getparam as sched_getparam, + sched_getscheduler as sched_getscheduler, + sched_rr_get_interval as sched_rr_get_interval, + sched_setaffinity as sched_setaffinity, + sched_setparam as sched_setparam, + sched_setscheduler as sched_setscheduler, + setresgid as setresgid, + setresuid as setresuid, + waitid as waitid, + waitid_result as waitid_result, + ) -class sched_param(NamedTuple): - sched_priority: int + if sys.version_info >= (3, 10): + from os import RWF_APPEND as RWF_APPEND -CLD_CONTINUED: int -CLD_DUMPED: int -CLD_EXITED: int -CLD_TRAPPED: int + if sys.version_info >= (3, 11): + from os import login_tty as login_tty -EX_CANTCREAT: int -EX_CONFIG: int -EX_DATAERR: int -EX_IOERR: int -EX_NOHOST: int -EX_NOINPUT: int -EX_NOPERM: int -EX_NOTFOUND: int -EX_NOUSER: int -EX_OK: int -EX_OSERR: int -EX_OSFILE: int -EX_PROTOCOL: int -EX_SOFTWARE: int -EX_TEMPFAIL: int -EX_UNAVAILABLE: int -EX_USAGE: int + if sys.version_info >= (3, 9): + from os import CLD_KILLED as CLD_KILLED, CLD_STOPPED as CLD_STOPPED, waitstatus_to_exitcode as waitstatus_to_exitcode -F_OK: int -R_OK: int -W_OK: int -X_OK: int + if sys.platform == "linux": + from os import P_PIDFD as P_PIDFD, pidfd_open as pidfd_open -F_LOCK: int -F_TEST: int -F_TLOCK: int -F_ULOCK: int + if sys.version_info >= (3, 8): + from os import ( + POSIX_SPAWN_CLOSE as POSIX_SPAWN_CLOSE, + POSIX_SPAWN_DUP2 as POSIX_SPAWN_DUP2, + POSIX_SPAWN_OPEN as POSIX_SPAWN_OPEN, + posix_spawn as posix_spawn, + posix_spawnp as posix_spawnp, + ) -if sys.platform == "linux": - GRND_NONBLOCK: int - GRND_RANDOM: int -NGROUPS_MAX: int + if sys.platform == "linux": + from os import ( + MFD_ALLOW_SEALING as MFD_ALLOW_SEALING, + MFD_CLOEXEC as MFD_CLOEXEC, + MFD_HUGE_1GB as MFD_HUGE_1GB, + MFD_HUGE_1MB as MFD_HUGE_1MB, + MFD_HUGE_2GB as MFD_HUGE_2GB, + MFD_HUGE_2MB as MFD_HUGE_2MB, + MFD_HUGE_8MB as MFD_HUGE_8MB, + MFD_HUGE_16GB as MFD_HUGE_16GB, + MFD_HUGE_16MB as MFD_HUGE_16MB, + MFD_HUGE_32MB as MFD_HUGE_32MB, + MFD_HUGE_64KB as MFD_HUGE_64KB, + MFD_HUGE_256MB as MFD_HUGE_256MB, + MFD_HUGE_512KB as MFD_HUGE_512KB, + MFD_HUGE_512MB as MFD_HUGE_512MB, + MFD_HUGE_MASK as MFD_HUGE_MASK, + MFD_HUGE_SHIFT as MFD_HUGE_SHIFT, + MFD_HUGETLB as MFD_HUGETLB, + copy_file_range as copy_file_range, + memfd_create as memfd_create, + ) + from os import preadv as preadv, pwritev as pwritev, register_at_fork as register_at_fork -O_APPEND: int -O_ACCMODE: int -O_ASYNC: int -O_CREAT: int -O_DIRECT: int -O_DIRECTORY: int -O_DSYNC: int -O_EXCL: int -O_LARGEFILE: int -O_NDELAY: int -O_NOATIME: int -O_NOCTTY: int -O_NOFOLLOW: int -O_NONBLOCK: int -O_RDONLY: int -O_RDWR: int -O_RSYNC: int -O_SYNC: int -O_TRUNC: int -O_WRONLY: int + if sys.platform != "darwin": + from os import RWF_DSYNC as RWF_DSYNC, RWF_HIPRI as RWF_HIPRI, RWF_NOWAIT as RWF_NOWAIT, RWF_SYNC as RWF_SYNC -if sys.platform != "darwin": - POSIX_FADV_DONTNEED: int - POSIX_FADV_NOREUSE: int - POSIX_FADV_NORMAL: int - POSIX_FADV_RANDOM: int - POSIX_FADV_SEQUENTIAL: int - POSIX_FADV_WILLNEED: int - -PRIO_PGRP: int -PRIO_PROCESS: int -PRIO_USER: int - -P_ALL: int -P_PGID: int -P_PID: int - -if sys.platform == "linux": - RTLD_DEEPBIND: int -RTLD_GLOBAL: int -RTLD_LAZY: int -RTLD_LOCAL: int -RTLD_NODELETE: int -RTLD_NOLOAD: int -RTLD_NOW: int - -SCHED_FIFO: int -SCHED_OTHER: int -SCHED_RR: int - -if sys.platform == "linux": - SCHED_BATCH: int - SCHED_IDLE: int -if sys.platform != "darwin": - SCHED_RESET_ON_FORK: int - -SEEK_DATA: int -SEEK_HOLE: int - -ST_APPEND: int -ST_MANDLOCK: int -ST_NOATIME: int -ST_NODEV: int -ST_NODIRATIME: int -ST_NOEXEC: int -ST_NOSUID: int -ST_RDONLY: int -ST_RELATIME: int -ST_SYNCHRONOUS: int -ST_WRITE: int - -TMP_MAX: int -WCONTINUED: int - -def WCOREDUMP(__status: int) -> bool: ... -def WEXITSTATUS(status: int) -> int: ... -def WIFCONTINUED(status: int) -> bool: ... -def WIFEXITED(status: int) -> bool: ... -def WIFSIGNALED(status: int) -> bool: ... -def WIFSTOPPED(status: int) -> bool: ... - -WNOHANG: int - -def WSTOPSIG(status: int) -> int: ... -def WTERMSIG(status: int) -> int: ... - -WUNTRACED: int - -XATTR_CREATE: int -XATTR_REPLACE: int -XATTR_SIZE_MAX: int - -@overload -def listdir(path: str | None = ...) -> list[str]: ... -@overload -def listdir(path: bytes) -> list[bytes]: ... -@overload -def listdir(path: int) -> list[str]: ... -@overload -def listdir(path: PathLike[str]) -> list[str]: ... - -if sys.platform != "win32" and sys.version_info >= (3, 8): - def posix_spawn( - path: StrOrBytesPath, - argv: _ExecVArgs, - env: _ExecEnv, - *, - file_actions: Sequence[Tuple[Any, ...]] | None = ..., - setpgroup: int | None = ..., - resetids: bool = ..., - setsid: bool = ..., - setsigmask: Iterable[int] = ..., - setsigdef: Iterable[int] = ..., - scheduler: Tuple[Any, sched_param] | None = ..., - ) -> int: ... - def posix_spawnp( - path: StrOrBytesPath, - argv: _ExecVArgs, - env: _ExecEnv, - *, - file_actions: Sequence[Tuple[Any, ...]] | None = ..., - setpgroup: int | None = ..., - resetids: bool = ..., - setsid: bool = ..., - setsigmask: Iterable[int] = ..., - setsigdef: Iterable[int] = ..., - scheduler: Tuple[Any, sched_param] | None = ..., - ) -> int: ... - -if sys.platform == "win32": - environ: dict[str, str] -else: + # Not same as os.environ or os.environb + # Because of this variable, we can't do "from posix import *" in os/__init__.pyi environ: dict[bytes, bytes] diff --git a/stdlib/posixpath.pyi b/stdlib/posixpath.pyi index cc5e5cb..8d880a0 100644 --- a/stdlib/posixpath.pyi +++ b/stdlib/posixpath.pyi @@ -1,5 +1,6 @@ import sys -from _typeshed import BytesPath, StrOrBytesPath, StrPath +from _typeshed import AnyOrLiteralStr, BytesPath, StrOrBytesPath, StrPath +from collections.abc import Sequence from genericpath import ( commonprefix as commonprefix, exists as exists, @@ -14,18 +15,60 @@ from genericpath import ( samestat as samestat, ) from os import PathLike -from typing import AnyStr, Sequence, Tuple, overload +from typing import AnyStr, overload +from typing_extensions import LiteralString + +__all__ = [ + "normcase", + "isabs", + "join", + "splitdrive", + "split", + "splitext", + "basename", + "dirname", + "commonprefix", + "getsize", + "getmtime", + "getatime", + "getctime", + "islink", + "exists", + "lexists", + "isdir", + "isfile", + "ismount", + "expanduser", + "expandvars", + "normpath", + "abspath", + "samefile", + "sameopenfile", + "samestat", + "curdir", + "pardir", + "sep", + "pathsep", + "defpath", + "altsep", + "extsep", + "devnull", + "realpath", + "supports_unicode_filenames", + "relpath", + "commonpath", +] supports_unicode_filenames: bool # aliases (also in os) -curdir: str -pardir: str -sep: str -altsep: str | None -extsep: str -pathsep: str -defpath: str -devnull: str +curdir: LiteralString +pardir: LiteralString +sep: LiteralString +altsep: LiteralString | None +extsep: LiteralString +pathsep: LiteralString +defpath: LiteralString +devnull: LiteralString # Overloads are necessary to work around python/mypy#3644. @overload @@ -35,11 +78,11 @@ def abspath(path: AnyStr) -> AnyStr: ... @overload def basename(p: PathLike[AnyStr]) -> AnyStr: ... @overload -def basename(p: AnyStr) -> AnyStr: ... +def basename(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... @overload def dirname(p: PathLike[AnyStr]) -> AnyStr: ... @overload -def dirname(p: AnyStr) -> AnyStr: ... +def dirname(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... @overload def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -51,19 +94,27 @@ def expandvars(path: AnyStr) -> AnyStr: ... @overload def normcase(s: PathLike[AnyStr]) -> AnyStr: ... @overload -def normcase(s: AnyStr) -> AnyStr: ... +def normcase(s: AnyOrLiteralStr) -> AnyOrLiteralStr: ... @overload def normpath(path: PathLike[AnyStr]) -> AnyStr: ... @overload -def normpath(path: AnyStr) -> AnyStr: ... +def normpath(path: AnyOrLiteralStr) -> AnyOrLiteralStr: ... +@overload +def commonpath(paths: Sequence[LiteralString]) -> LiteralString: ... @overload def commonpath(paths: Sequence[StrPath]) -> str: ... @overload def commonpath(paths: Sequence[BytesPath]) -> bytes: ... + +# First parameter is not actually pos-only, +# but must be defined as pos-only in the stub or cross-platform code doesn't type-check, +# as the parameter name is different in ntpath.join() @overload -def join(a: StrPath, *paths: StrPath) -> str: ... +def join(__a: LiteralString, *paths: LiteralString) -> LiteralString: ... @overload -def join(a: BytesPath, *paths: BytesPath) -> bytes: ... +def join(__a: StrPath, *paths: StrPath) -> str: ... +@overload +def join(__a: BytesPath, *paths: BytesPath) -> bytes: ... if sys.version_info >= (3, 10): @overload @@ -77,23 +128,25 @@ else: @overload def realpath(filename: AnyStr) -> AnyStr: ... +@overload +def relpath(path: LiteralString, start: LiteralString | None = ...) -> LiteralString: ... @overload def relpath(path: BytesPath, start: BytesPath | None = ...) -> bytes: ... @overload def relpath(path: StrPath, start: StrPath | None = ...) -> str: ... @overload -def split(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +def split(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @overload -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def split(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... @overload -def splitdrive(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +def splitdrive(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @overload -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def splitdrive(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... @overload -def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... +def splitext(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... @overload -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def splitext(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... def isabs(s: StrOrBytesPath) -> bool: ... -def islink(path: StrOrBytesPath) -> bool: ... -def ismount(path: StrOrBytesPath) -> bool: ... -def lexists(path: StrOrBytesPath) -> bool: ... +def islink(path: StrOrBytesPath | int) -> bool: ... +def ismount(path: StrOrBytesPath | int) -> bool: ... +def lexists(path: StrOrBytesPath | int) -> bool: ... diff --git a/stdlib/pprint.pyi b/stdlib/pprint.pyi index dcf3fd6..0addc8f 100644 --- a/stdlib/pprint.pyi +++ b/stdlib/pprint.pyi @@ -1,5 +1,10 @@ import sys -from typing import IO, Any, Tuple +from typing import IO + +if sys.version_info >= (3, 8): + __all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"] +else: + __all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter"] if sys.version_info >= (3, 10): def pformat( @@ -126,8 +131,9 @@ class PrettyPrinter: *, compact: bool = ..., ) -> None: ... + def pformat(self, object: object) -> str: ... def pprint(self, object: object) -> None: ... def isreadable(self, object: object) -> bool: ... def isrecursive(self, object: object) -> bool: ... - def format(self, object: object, context: dict[int, Any], maxlevels: int, level: int) -> Tuple[str, bool, bool]: ... + def format(self, object: object, context: dict[int, int], maxlevels: int, level: int) -> tuple[str, bool, bool]: ... diff --git a/stdlib/profile.pyi b/stdlib/profile.pyi index cb0cbf7..4b3f832 100644 --- a/stdlib/profile.pyi +++ b/stdlib/profile.pyi @@ -1,14 +1,18 @@ -from _typeshed import StrOrBytesPath -from typing import Any, Callable, Tuple, TypeVar +from _typeshed import Self, StrOrBytesPath +from collections.abc import Callable +from typing import Any, TypeVar +from typing_extensions import ParamSpec, TypeAlias + +__all__ = ["run", "runctx", "Profile"] def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... ) -> None: ... -_SelfT = TypeVar("_SelfT", bound=Profile) _T = TypeVar("_T") -_Label = Tuple[str, int, str] +_P = ParamSpec("_P") +_Label: TypeAlias = tuple[str, int, str] class Profile: bias: int @@ -21,7 +25,7 @@ class Profile: def dump_stats(self, file: StrOrBytesPath) -> None: ... def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... - def run(self: _SelfT, cmd: str) -> _SelfT: ... - def runctx(self: _SelfT, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> _SelfT: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + def run(self: Self, cmd: str) -> Self: ... + def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... + def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... def calibrate(self, m: int, verbose: int = ...) -> float: ... diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index 6811ec9..10d817b 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -1,51 +1,78 @@ import sys -from _typeshed import StrOrBytesPath +from _typeshed import Self, StrOrBytesPath +from collections.abc import Iterable from cProfile import Profile as _cProfile +from enum import Enum from profile import Profile -from typing import IO, Any, Iterable, Tuple, TypeVar, Union, overload - -_Selector = Union[str, float, int] -_T = TypeVar("_T", bound=Stats) - -if sys.version_info >= (3, 7): - from enum import Enum - class SortKey(str, Enum): - CALLS: str - CUMULATIVE: str - FILENAME: str - LINE: str - NAME: str - NFL: str - PCALLS: str - STDNAME: str - TIME: str +from typing import IO, Any, overload +from typing_extensions import Literal, TypeAlias + +if sys.version_info >= (3, 9): + __all__ = ["Stats", "SortKey", "FunctionProfile", "StatsProfile"] +else: + __all__ = ["Stats", "SortKey"] + +_Selector: TypeAlias = str | float | int + +class SortKey(str, Enum): + CALLS: str + CUMULATIVE: str + FILENAME: str + LINE: str + NAME: str + NFL: str + PCALLS: str + STDNAME: str + TIME: str + +if sys.version_info >= (3, 9): + from dataclasses import dataclass + + @dataclass(unsafe_hash=True) + class FunctionProfile: + ncalls: str + tottime: float + percall_tottime: float + cumtime: float + percall_cumtime: float + file_name: str + line_number: int + @dataclass(unsafe_hash=True) + class StatsProfile: + total_tt: float + func_profiles: dict[str, FunctionProfile] + +_SortArgDict: TypeAlias = dict[str, tuple[tuple[tuple[int, int], ...], str]] class Stats: - sort_arg_dict_default: dict[str, Tuple[Any, str]] + sort_arg_dict_default: _SortArgDict def __init__( - self: _T, + self: Self, __arg: None | str | Profile | _cProfile = ..., - *args: None | str | Profile | _cProfile | _T, + *args: None | str | Profile | _cProfile | Self, stream: IO[Any] | None = ..., ) -> None: ... def init(self, arg: None | str | Profile | _cProfile) -> None: ... def load_stats(self, arg: None | str | Profile | _cProfile) -> None: ... def get_top_level_stats(self) -> None: ... - def add(self: _T, *arg_list: None | str | Profile | _cProfile | _T) -> _T: ... + def add(self: Self, *arg_list: None | str | Profile | _cProfile | Self) -> Self: ... def dump_stats(self, filename: StrOrBytesPath) -> None: ... - def get_sort_arg_defs(self) -> dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ... + def get_sort_arg_defs(self) -> _SortArgDict: ... @overload - def sort_stats(self: _T, field: int) -> _T: ... + def sort_stats(self: Self, field: Literal[-1, 0, 1, 2]) -> Self: ... @overload - def sort_stats(self: _T, *field: str) -> _T: ... - def reverse_order(self: _T) -> _T: ... - def strip_dirs(self: _T) -> _T: ... + def sort_stats(self: Self, *field: str) -> Self: ... + def reverse_order(self: Self) -> Self: ... + def strip_dirs(self: Self) -> Self: ... def calc_callees(self) -> None: ... - def eval_print_amount(self, sel: _Selector, list: list[str], msg: str) -> Tuple[list[str], str]: ... - def get_print_list(self, sel_list: Iterable[_Selector]) -> Tuple[int, list[str]]: ... - def print_stats(self: _T, *amount: _Selector) -> _T: ... - def print_callees(self: _T, *amount: _Selector) -> _T: ... - def print_callers(self: _T, *amount: _Selector) -> _T: ... + def eval_print_amount(self, sel: _Selector, list: list[str], msg: str) -> tuple[list[str], str]: ... + if sys.version_info >= (3, 9): + def get_stats_profile(self) -> StatsProfile: ... + + def get_print_list(self, sel_list: Iterable[_Selector]) -> tuple[int, list[str]]: ... + def print_stats(self: Self, *amount: _Selector) -> Self: ... + def print_callees(self: Self, *amount: _Selector) -> Self: ... + def print_callers(self: Self, *amount: _Selector) -> Self: ... def print_call_heading(self, name_size: int, column_title: str) -> None: ... def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = ...) -> None: ... def print_title(self) -> None: ... diff --git a/stdlib/pty.pyi b/stdlib/pty.pyi index ba6b9b4..a6a2d8f 100644 --- a/stdlib/pty.pyi +++ b/stdlib/pty.pyi @@ -1,15 +1,18 @@ -from typing import Callable, Iterable, Tuple +import sys +from collections.abc import Callable, Iterable +from typing_extensions import Literal, TypeAlias -_Reader = Callable[[int], bytes] +if sys.platform != "win32": + __all__ = ["openpty", "fork", "spawn"] + _Reader: TypeAlias = Callable[[int], bytes] -STDIN_FILENO: int -STDOUT_FILENO: int -STDERR_FILENO: int + STDIN_FILENO: Literal[0] + STDOUT_FILENO: Literal[1] + STDERR_FILENO: Literal[2] -CHILD: int - -def openpty() -> Tuple[int, int]: ... -def master_open() -> Tuple[int, str]: ... -def slave_open(tty_name: str) -> int: ... -def fork() -> Tuple[int, int]: ... -def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ... + CHILD: Literal[0] + def openpty() -> tuple[int, int]: ... + def master_open() -> tuple[int, str]: ... # deprecated, use openpty() + def slave_open(tty_name: str) -> int: ... # deprecated, use openpty() + def fork() -> tuple[int, int]: ... + def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ... diff --git a/stdlib/pwd.pyi b/stdlib/pwd.pyi index 2b93124..8081347 100644 --- a/stdlib/pwd.pyi +++ b/stdlib/pwd.pyi @@ -1,18 +1,28 @@ -from typing import ClassVar, Tuple +import sys +from _typeshed import structseq +from typing import Any +from typing_extensions import Final, final -class struct_passwd(Tuple[str, str, int, int, str, str, str]): - pw_name: str - pw_passwd: str - pw_uid: int - pw_gid: int - pw_gecos: str - pw_dir: str - pw_shell: str +if sys.platform != "win32": + @final + class struct_passwd(structseq[Any], tuple[str, str, int, int, str, str, str]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("pw_name", "pw_passwd", "pw_uid", "pw_gid", "pw_gecos", "pw_dir", "pw_shell") + @property + def pw_name(self) -> str: ... + @property + def pw_passwd(self) -> str: ... + @property + def pw_uid(self) -> int: ... + @property + def pw_gid(self) -> int: ... + @property + def pw_gecos(self) -> str: ... + @property + def pw_dir(self) -> str: ... + @property + def pw_shell(self) -> str: ... - n_fields: ClassVar[int] - n_sequence_fields: ClassVar[int] - n_unnamed_fields: ClassVar[int] - -def getpwall() -> list[struct_passwd]: ... -def getpwuid(__uid: int) -> struct_passwd: ... -def getpwnam(__name: str) -> struct_passwd: ... + def getpwall() -> list[struct_passwd]: ... + def getpwuid(__uid: int) -> struct_passwd: ... + def getpwnam(__name: str) -> struct_passwd: ... diff --git a/stdlib/py_compile.pyi b/stdlib/py_compile.pyi index 1df8185..1e9b6c2 100644 --- a/stdlib/py_compile.pyi +++ b/stdlib/py_compile.pyi @@ -1,20 +1,22 @@ +import enum import sys -from typing import AnyStr, Type +from typing import AnyStr + +__all__ = ["compile", "main", "PyCompileError", "PycInvalidationMode"] class PyCompileError(Exception): exc_type_name: str exc_value: BaseException file: str msg: str - def __init__(self, exc_type: Type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ... + def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ... + +class PycInvalidationMode(enum.Enum): + TIMESTAMP: int + CHECKED_HASH: int + UNCHECKED_HASH: int -if sys.version_info >= (3, 7): - import enum - class PycInvalidationMode(enum.Enum): - TIMESTAMP: int - CHECKED_HASH: int - UNCHECKED_HASH: int - def _get_default_invalidation_mode() -> PycInvalidationMode: ... +def _get_default_invalidation_mode() -> PycInvalidationMode: ... if sys.version_info >= (3, 8): def compile( @@ -27,7 +29,7 @@ if sys.version_info >= (3, 8): quiet: int = ..., ) -> AnyStr | None: ... -elif sys.version_info >= (3, 7): +else: def compile( file: AnyStr, cfile: AnyStr | None = ..., @@ -37,9 +39,8 @@ elif sys.version_info >= (3, 7): invalidation_mode: PycInvalidationMode | None = ..., ) -> AnyStr | None: ... -else: - def compile( - file: AnyStr, cfile: AnyStr | None = ..., dfile: AnyStr | None = ..., doraise: bool = ..., optimize: int = ... - ) -> AnyStr | None: ... +if sys.version_info >= (3, 10): + def main() -> None: ... -def main(args: list[str] | None = ...) -> int: ... +else: + def main(args: list[str] | None = ...) -> int: ... diff --git a/stdlib/pyclbr.pyi b/stdlib/pyclbr.pyi index 10d106b..ab19b44 100644 --- a/stdlib/pyclbr.pyi +++ b/stdlib/pyclbr.pyi @@ -1,5 +1,7 @@ import sys -from typing import Sequence +from collections.abc import Sequence + +__all__ = ["readmodule", "readmodule_ex", "Class", "Function"] class Class: module: str @@ -9,12 +11,28 @@ class Class: file: int lineno: int - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 10): + end_lineno: int | None + + parent: Class | None + children: dict[str, Class | Function] + + if sys.version_info >= (3, 10): def __init__( - self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int, parent: Class | None = ... + self, + module: str, + name: str, + super_: list[Class | str] | None, + file: str, + lineno: int, + parent: Class | None = ..., + *, + end_lineno: int | None = ..., ) -> None: ... else: - def __init__(self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int) -> None: ... + def __init__( + self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int, parent: Class | None = ... + ) -> None: ... class Function: module: str @@ -22,10 +40,27 @@ class Function: file: int lineno: int - if sys.version_info >= (3, 7): - def __init__(self, module: str, name: str, file: str, lineno: int, parent: Function | None = ...) -> None: ... + if sys.version_info >= (3, 10): + end_lineno: int | None + is_async: bool + + parent: Function | Class | None + children: dict[str, Class | Function] + + if sys.version_info >= (3, 10): + def __init__( + self, + module: str, + name: str, + file: str, + lineno: int, + parent: Function | Class | None = ..., + is_async: bool = ..., + *, + end_lineno: int | None = ..., + ) -> None: ... else: - def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ... + def __init__(self, module: str, name: str, file: str, lineno: int, parent: Function | Class | None = ...) -> None: ... def readmodule(module: str, path: Sequence[str] | None = ...) -> dict[str, Class]: ... def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> dict[str, Class | Function | list[str]]: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 778a2e5..0dd2739 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -1,10 +1,16 @@ -from _typeshed import SupportsWrite +import sys +from _typeshed import OptExcInfo, SupportsWrite +from abc import abstractmethod +from builtins import list as _list # "list" conflicts with method name +from collections.abc import Callable, Container, Mapping, MutableMapping from reprlib import Repr from types import MethodType, ModuleType, TracebackType -from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, Optional, Tuple, Type +from typing import IO, Any, AnyStr, NoReturn, TypeVar +from typing_extensions import TypeGuard -# the return type of sys.exc_info(), used by ErrorDuringImport.__init__ -_Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +__all__ = ["help"] + +_T = TypeVar("_T") __author__: str __date__: str @@ -13,7 +19,7 @@ __credits__: str def pathdirs() -> list[str]: ... def getdoc(object: object) -> str: ... -def splitdoc(doc: AnyStr) -> Tuple[AnyStr, AnyStr]: ... +def splitdoc(doc: AnyStr) -> tuple[AnyStr, AnyStr]: ... def classname(object: object, modname: str) -> str: ... def isdata(object: object) -> bool: ... def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ... @@ -21,17 +27,17 @@ def cram(text: str, maxlen: int) -> str: ... def stripid(text: str) -> str: ... def allmethods(cl: type) -> MutableMapping[str, MethodType]: ... def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ... -def classify_class_attrs(object: object) -> list[Tuple[str, str, type, str]]: ... +def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ... def ispackage(path: str) -> bool: ... def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ... -def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> str | None: ... +def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = ...) -> str | None: ... class ErrorDuringImport(Exception): filename: str - exc: Type[BaseException] | None + exc: type[BaseException] | None value: BaseException | None tb: TracebackType | None - def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ... + def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ... def importfile(path: str) -> ModuleType: ... def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ... @@ -40,21 +46,21 @@ class Doc: PYTHONDOCS: str def document(self, object: object, name: str | None = ..., *args: Any) -> str: ... def fail(self, object: object, name: str | None = ..., *args: Any) -> NoReturn: ... + @abstractmethod def docmodule(self, object: object, name: str | None = ..., *args: Any) -> str: ... + @abstractmethod def docclass(self, object: object, name: str | None = ..., *args: Any) -> str: ... + @abstractmethod def docroutine(self, object: object, name: str | None = ..., *args: Any) -> str: ... + @abstractmethod def docother(self, object: object, name: str | None = ..., *args: Any) -> str: ... + @abstractmethod def docproperty(self, object: object, name: str | None = ..., *args: Any) -> str: ... + @abstractmethod def docdata(self, object: object, name: str | None = ..., *args: Any) -> str: ... def getdocloc(self, object: object, basedir: str = ...) -> str | None: ... class HTMLRepr(Repr): - maxlist: int - maxtuple: int - maxdict: int - maxstring: int - maxother: int - def __init__(self) -> None: ... def escape(self, text: str) -> str: ... def repr(self, object: object) -> str: ... def repr1(self, x: object, level: complex) -> str: ... @@ -64,29 +70,45 @@ class HTMLRepr(Repr): def repr_unicode(self, x: AnyStr, level: complex) -> str: ... class HTMLDoc(Doc): - repr: Callable[[object], str] - escape: Callable[[str], str] + _repr_instance: HTMLRepr = ... + repr = _repr_instance.repr + escape = _repr_instance.escape def page(self, title: str, contents: str) -> str: ... - def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ... - def section( - self, - title: str, - fgcol: str, - bgcol: str, - contents: str, - width: int = ..., - prelude: str = ..., - marginalia: str | None = ..., - gap: str = ..., - ) -> str: ... + if sys.version_info >= (3, 11): + def heading(self, title: str, extras: str = ...) -> str: ... + def section( + self, + title: str, + cls: str, + contents: str, + width: int = ..., + prelude: str = ..., + marginalia: str | None = ..., + gap: str = ..., + ) -> str: ... + def multicolumn(self, list: list[_T], format: Callable[[_T], str]) -> str: ... + else: + def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ... + def section( + self, + title: str, + fgcol: str, + bgcol: str, + contents: str, + width: int = ..., + prelude: str = ..., + marginalia: str | None = ..., + gap: str = ..., + ) -> str: ... + def multicolumn(self, list: list[_T], format: Callable[[_T], str], cols: int = ...) -> str: ... + def bigsection(self, title: str, *args: Any) -> str: ... def preformat(self, text: str) -> str: ... - def multicolumn(self, list: list[Any], format: Callable[[Any], str], cols: int = ...) -> str: ... def grey(self, text: str) -> str: ... def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ... def classlink(self, object: object, modname: str) -> str: ... def modulelink(self, object: object) -> str: ... - def modpkglink(self, modpkginfo: Tuple[str, str, bool, bool]) -> str: ... + def modpkglink(self, modpkginfo: tuple[str, str, bool, bool]) -> str: ... def markup( self, text: str, @@ -96,7 +118,7 @@ class HTMLDoc(Doc): methods: Mapping[str, str] = ..., ) -> str: ... def formattree( - self, tree: list[Tuple[type, Tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ... + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ... ) -> str: ... def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... def docclass( @@ -109,7 +131,7 @@ class HTMLDoc(Doc): *ignored: Any, ) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine( + def docroutine( # type: ignore[override] self, object: object, name: str | None = ..., @@ -118,51 +140,35 @@ class HTMLDoc(Doc): classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., cl: type | None = ..., - *ignored: Any, - ) -> str: ... - def docproperty( - self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any ) -> str: ... + def docproperty(self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] def docother(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ... - def docdata( - self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... + def docdata(self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = ...) -> str: ... def filelink(self, url: str, path: str) -> str: ... class TextRepr(Repr): - maxlist: int - maxtuple: int - maxdict: int - maxstring: int - maxother: int - def __init__(self) -> None: ... def repr1(self, x: object, level: complex) -> str: ... def repr_string(self, x: str, level: complex) -> str: ... def repr_str(self, x: str, level: complex) -> str: ... def repr_instance(self, x: object, level: complex) -> str: ... class TextDoc(Doc): - repr: Callable[[object], str] + _repr_instance: TextRepr = ... + repr = _repr_instance.repr def bold(self, text: str) -> str: ... def indent(self, text: str, prefix: str = ...) -> str: ... def section(self, title: str, contents: str) -> str: ... def formattree( - self, tree: list[Tuple[type, Tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ... + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ... ) -> str: ... - def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ... + def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ...) -> str: ... # type: ignore[override] def docclass(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine( - self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docproperty( - self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docdata( - self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any - ) -> str: ... - def docother( + def docroutine(self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] + def docproperty(self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] + def docdata(self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] + def docother( # type: ignore[override] self, object: object, name: str | None = ..., @@ -170,7 +176,6 @@ class TextDoc(Doc): parent: str | None = ..., maxlen: int | None = ..., doc: Any | None = ..., - *ignored: Any, ) -> str: ... def pager(text: str) -> None: ... @@ -186,23 +191,21 @@ def locate(path: str, forceload: bool = ...) -> object: ... text: TextDoc html: HTMLDoc -class _OldStyleClass: ... - -def resolve(thing: str | object, forceload: bool = ...) -> Tuple[object, str] | None: ... +def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ... def render_doc(thing: str | object, title: str = ..., forceload: bool = ..., renderer: Doc | None = ...) -> str: ... def doc(thing: str | object, title: str = ..., forceload: bool = ..., output: SupportsWrite[str] | None = ...) -> None: ... def writedoc(thing: str | object, forceload: bool = ...) -> None: ... def writedocs(dir: str, pkgpath: str = ..., done: Any | None = ...) -> None: ... -_list = list # "list" conflicts with method name - class Helper: - keywords: dict[str, str | Tuple[str, str]] + keywords: dict[str, str | tuple[str, str]] symbols: dict[str, str] - topics: dict[str, str | Tuple[str, ...]] + topics: dict[str, str | tuple[str, ...]] def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ... - input: IO[str] - output: IO[str] + @property + def input(self) -> IO[str]: ... + @property + def output(self) -> IO[str]: ... def __call__(self, request: str | Helper | object = ...) -> None: ... def interact(self) -> None: ... def getline(self, prompt: str) -> str: ... @@ -218,25 +221,16 @@ class Helper: help: Helper -# See Python issue #11182: "remove the unused and undocumented pydoc.Scanner class" -# class Scanner: -# roots = ... # type: Any -# state = ... # type: Any -# children = ... # type: Any -# descendp = ... # type: Any -# def __init__(self, roots, children, descendp) -> None: ... -# def next(self): ... - class ModuleScanner: quit: bool def run( self, - callback: Callable[[str | None, str, str], None], - key: Any | None = ..., - completer: Callable[[], None] | None = ..., - onerror: Callable[[str], None] | None = ..., + callback: Callable[[str | None, str, str], object], + key: str | None = ..., + completer: Callable[[], object] | None = ..., + onerror: Callable[[str], object] | None = ..., ) -> None: ... def apropos(key: str) -> None: ... -def ispath(x: Any) -> bool: ... +def ispath(x: object) -> TypeGuard[str]: ... def cli() -> None: ... diff --git a/stdlib/pyexpat/__init__.pyi b/stdlib/pyexpat/__init__.pyi index 95c1f98..7e635c5 100644 --- a/stdlib/pyexpat/__init__.pyi +++ b/stdlib/pyexpat/__init__.pyi @@ -1,12 +1,13 @@ -import pyexpat.errors as errors -import pyexpat.model as model -from _typeshed import SupportsRead -from typing import Any, Callable, Optional, Tuple +from _typeshed import ReadableBuffer, SupportsRead +from collections.abc import Callable +from pyexpat import errors as errors, model as model +from typing import Any +from typing_extensions import TypeAlias, final EXPAT_VERSION: str # undocumented -version_info: Tuple[int, int, int] # undocumented +version_info: tuple[int, int, int] # undocumented native_encoding: str # undocumented -features: list[Tuple[str, int]] # undocumented +features: list[tuple[str, int]] # undocumented class ExpatError(Exception): code: int @@ -19,10 +20,11 @@ XML_PARAM_ENTITY_PARSING_NEVER: int XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: int XML_PARAM_ENTITY_PARSING_ALWAYS: int -_Model = Tuple[int, int, Optional[str], Tuple[Any, ...]] +_Model: TypeAlias = tuple[int, int, str | None, tuple[Any, ...]] -class XMLParserType(object): - def Parse(self, __data: str | bytes, __isfinal: bool = ...) -> int: ... +@final +class XMLParserType: + def Parse(self, __data: str | ReadableBuffer, __isfinal: bool = ...) -> int: ... def ParseFile(self, __file: SupportsRead[bytes]) -> int: ... def SetBase(self, __base: str) -> None: ... def GetBase(self) -> str | None: ... @@ -30,6 +32,8 @@ class XMLParserType(object): def ExternalEntityParserCreate(self, __context: str | None, __encoding: str = ...) -> XMLParserType: ... def SetParamEntityParsing(self, __flag: int) -> int: ... def UseForeignDTD(self, __flag: bool = ...) -> None: ... + @property + def intern(self) -> dict[str, str]: ... buffer_size: int buffer_text: bool buffer_used: int @@ -66,6 +70,7 @@ class XMLParserType(object): DefaultHandlerExpand: Callable[[str], Any] | None NotStandaloneHandler: Callable[[], int] | None ExternalEntityRefHandler: Callable[[str, str | None, str | None, str | None], int] | None + SkippedEntityHandler: Callable[[str, bool], Any] | None def ErrorString(__code: int) -> str: ... diff --git a/stdlib/pyexpat/errors.pyi b/stdlib/pyexpat/errors.pyi index 61826e1..2e512eb 100644 --- a/stdlib/pyexpat/errors.pyi +++ b/stdlib/pyexpat/errors.pyi @@ -1,3 +1,5 @@ +import sys + codes: dict[str, int] messages: dict[int, str] @@ -38,3 +40,10 @@ XML_ERROR_UNDEFINED_ENTITY: str XML_ERROR_UNEXPECTED_STATE: str XML_ERROR_UNKNOWN_ENCODING: str XML_ERROR_XML_DECL: str +if sys.version_info >= (3, 11): + XML_ERROR_RESERVED_PREFIX_XML: str + XML_ERROR_RESERVED_PREFIX_XMLNS: str + XML_ERROR_RESERVED_NAMESPACE_URI: str + XML_ERROR_INVALID_ARGUMENT: str + XML_ERROR_NO_BUFFER: str + XML_ERROR_AMPLIFICATION_LIMIT_BREACH: str diff --git a/stdlib/queue.pyi b/stdlib/queue.pyi index 9671155..7ea4beb 100644 --- a/stdlib/queue.pyi +++ b/stdlib/queue.pyi @@ -5,6 +5,8 @@ from typing import Any, Generic, TypeVar if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = ["Empty", "Full", "Queue", "PriorityQueue", "LifoQueue", "SimpleQueue"] + _T = TypeVar("_T") class Empty(Exception): ... @@ -18,6 +20,8 @@ class Queue(Generic[_T]): not_full: Condition # undocumented all_tasks_done: Condition # undocumented unfinished_tasks: int # undocumented + # Despite the fact that `queue` has `deque` type, + # we treat it as `Any` to allow different implementations in subtypes. queue: Any # undocumented def __init__(self, maxsize: int = ...) -> None: ... def _init(self, maxsize: int) -> None: ... @@ -36,17 +40,19 @@ class Queue(Generic[_T]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -class PriorityQueue(Queue[_T]): ... -class LifoQueue(Queue[_T]): ... - -if sys.version_info >= (3, 7): - class SimpleQueue(Generic[_T]): - def __init__(self) -> None: ... - def empty(self) -> bool: ... - def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... - def get_nowait(self) -> _T: ... - def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ... - def put_nowait(self, item: _T) -> None: ... - def qsize(self) -> int: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... +class PriorityQueue(Queue[_T]): + queue: list[_T] + +class LifoQueue(Queue[_T]): + queue: list[_T] + +class SimpleQueue(Generic[_T]): + def __init__(self) -> None: ... + def empty(self) -> bool: ... + def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... + def get_nowait(self) -> _T: ... + def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ... + def put_nowait(self, item: _T) -> None: ... + def qsize(self) -> int: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/stdlib/quopri.pyi b/stdlib/quopri.pyi index c2ffabe..5494132 100644 --- a/stdlib/quopri.pyi +++ b/stdlib/quopri.pyi @@ -1,6 +1,11 @@ -from typing import BinaryIO +from _typeshed import ReadableBuffer, SupportsNoArgReadline, SupportsRead, SupportsWrite +from typing import Protocol -def encode(input: BinaryIO, output: BinaryIO, quotetabs: int, header: int = ...) -> None: ... -def encodestring(s: bytes, quotetabs: int = ..., header: int = ...) -> bytes: ... -def decode(input: BinaryIO, output: BinaryIO, header: int = ...) -> None: ... -def decodestring(s: bytes, header: int = ...) -> bytes: ... +__all__ = ["encode", "decode", "encodestring", "decodestring"] + +class _Input(SupportsRead[bytes], SupportsNoArgReadline[bytes], Protocol): ... + +def encode(input: _Input, output: SupportsWrite[bytes], quotetabs: int, header: int = ...) -> None: ... +def encodestring(s: ReadableBuffer, quotetabs: int = ..., header: int = ...) -> bytes: ... +def decode(input: _Input, output: SupportsWrite[bytes], header: int = ...) -> None: ... +def decodestring(s: str | ReadableBuffer, header: int = ...) -> bytes: ... diff --git a/stdlib/random.pyi b/stdlib/random.pyi index f284fe8..a2a1d95 100644 --- a/stdlib/random.pyi +++ b/stdlib/random.pyi @@ -1,85 +1,129 @@ import _random import sys -from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set +from _typeshed import SupportsLenAndGetItem +from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet from fractions import Fraction -from typing import Any, NoReturn, Tuple, TypeVar +from typing import Any, ClassVar, NoReturn, TypeVar + +__all__ = [ + "Random", + "seed", + "random", + "uniform", + "randint", + "choice", + "sample", + "randrange", + "shuffle", + "normalvariate", + "lognormvariate", + "expovariate", + "vonmisesvariate", + "gammavariate", + "triangular", + "gauss", + "betavariate", + "paretovariate", + "weibullvariate", + "getstate", + "setstate", + "getrandbits", + "choices", + "SystemRandom", +] + +if sys.version_info >= (3, 9): + __all__ += ["randbytes"] _T = TypeVar("_T") class Random(_random.Random): + VERSION: ClassVar[int] def __init__(self, x: Any = ...) -> None: ... - def seed(self, a: Any = ..., version: int = ...) -> None: ... - def getstate(self) -> Tuple[Any, ...]: ... - def setstate(self, state: Tuple[Any, ...]) -> None: ... - def getrandbits(self, __k: int) -> int: ... + # Using other `seed` types is deprecated since 3.9 and removed in 3.11 + # Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit + # int better documents conventional usage of random.seed. + if sys.version_info >= (3, 9): + def seed(self, a: int | float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override] # noqa: Y041 + else: + def seed(self, a: Any = ..., version: int = ...) -> None: ... + + def getstate(self) -> tuple[Any, ...]: ... + def setstate(self, state: tuple[Any, ...]) -> None: ... def randrange(self, start: int, stop: int | None = ..., step: int = ...) -> int: ... def randint(self, a: int, b: int) -> int: ... if sys.version_info >= (3, 9): def randbytes(self, n: int) -> bytes: ... - def choice(self, seq: Sequence[_T]) -> _T: ... + + def choice(self, seq: SupportsLenAndGetItem[_T]) -> _T: ... def choices( self, - population: Sequence[_T], + population: SupportsLenAndGetItem[_T], weights: Sequence[float | Fraction] | None = ..., *, cum_weights: Sequence[float | Fraction] | None = ..., k: int = ..., ) -> list[_T]: ... - def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ... - if sys.version_info >= (3, 9): - def sample(self, population: Sequence[_T] | Set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ... + if sys.version_info >= (3, 11): + def shuffle(self, x: MutableSequence[Any]) -> None: ... + else: + def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ... + if sys.version_info >= (3, 11): + def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = ...) -> list[_T]: ... + elif sys.version_info >= (3, 9): + def sample( + self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = ... + ) -> list[_T]: ... else: - def sample(self, population: Sequence[_T] | Set[_T], k: int) -> list[_T]: ... - def random(self) -> float: ... + def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int) -> list[_T]: ... + def uniform(self, a: float, b: float) -> float: ... def triangular(self, low: float = ..., high: float = ..., mode: float | None = ...) -> float: ... def betavariate(self, alpha: float, beta: float) -> float: ... def expovariate(self, lambd: float) -> float: ... def gammavariate(self, alpha: float, beta: float) -> float: ... - def gauss(self, mu: float, sigma: float) -> float: ... + if sys.version_info >= (3, 11): + def gauss(self, mu: float = ..., sigma: float = ...) -> float: ... + def normalvariate(self, mu: float = ..., sigma: float = ...) -> float: ... + else: + def gauss(self, mu: float, sigma: float) -> float: ... + def normalvariate(self, mu: float, sigma: float) -> float: ... + def lognormvariate(self, mu: float, sigma: float) -> float: ... - def normalvariate(self, mu: float, sigma: float) -> float: ... def vonmisesvariate(self, mu: float, kappa: float) -> float: ... def paretovariate(self, alpha: float) -> float: ... def weibullvariate(self, alpha: float, beta: float) -> float: ... # SystemRandom is not implemented for all OS's; good on Windows & Linux class SystemRandom(Random): + def getrandbits(self, k: int) -> int: ... # k can be passed by keyword def getstate(self, *args: Any, **kwds: Any) -> NoReturn: ... def setstate(self, *args: Any, **kwds: Any) -> NoReturn: ... # ----- random function stubs ----- -def seed(a: Any = ..., version: int = ...) -> None: ... -def getstate() -> object: ... -def setstate(state: object) -> None: ... -def getrandbits(__k: int) -> int: ... -def randrange(start: int, stop: None | int = ..., step: int = ...) -> int: ... -def randint(a: int, b: int) -> int: ... - -if sys.version_info >= (3, 9): - def randbytes(n: int) -> bytes: ... - -def choice(seq: Sequence[_T]) -> _T: ... -def choices( - population: Sequence[_T], weights: Sequence[float] | None = ..., *, cum_weights: Sequence[float] | None = ..., k: int = ... -) -> list[_T]: ... -def shuffle(x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ... +_inst: Random = ... +seed = _inst.seed +random = _inst.random +uniform = _inst.uniform +triangular = _inst.triangular +randint = _inst.randint +choice = _inst.choice +randrange = _inst.randrange +sample = _inst.sample +shuffle = _inst.shuffle +choices = _inst.choices +normalvariate = _inst.normalvariate +lognormvariate = _inst.lognormvariate +expovariate = _inst.expovariate +vonmisesvariate = _inst.vonmisesvariate +gammavariate = _inst.gammavariate +gauss = _inst.gauss +betavariate = _inst.betavariate +paretovariate = _inst.paretovariate +weibullvariate = _inst.weibullvariate +getstate = _inst.getstate +setstate = _inst.setstate +getrandbits = _inst.getrandbits if sys.version_info >= (3, 9): - def sample(population: Sequence[_T] | Set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ... - -else: - def sample(population: Sequence[_T] | Set[_T], k: int) -> list[_T]: ... - -def random() -> float: ... -def uniform(a: float, b: float) -> float: ... -def triangular(low: float = ..., high: float = ..., mode: float | None = ...) -> float: ... -def betavariate(alpha: float, beta: float) -> float: ... -def expovariate(lambd: float) -> float: ... -def gammavariate(alpha: float, beta: float) -> float: ... -def gauss(mu: float, sigma: float) -> float: ... -def lognormvariate(mu: float, sigma: float) -> float: ... -def normalvariate(mu: float, sigma: float) -> float: ... -def vonmisesvariate(mu: float, kappa: float) -> float: ... -def paretovariate(alpha: float) -> float: ... -def weibullvariate(alpha: float, beta: float) -> float: ... + randbytes = _inst.randbytes diff --git a/stdlib/re.pyi b/stdlib/re.pyi index f286947..3e52d20 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -1,32 +1,187 @@ import enum +import sre_compile import sys +from _typeshed import ReadableBuffer +from collections.abc import Callable, Iterator, Mapping from sre_constants import error as error -from typing import Any, AnyStr, Callable, Iterator, Tuple, Union, overload +from typing import Any, AnyStr, Generic, TypeVar, overload +from typing_extensions import Literal, TypeAlias, final + +if sys.version_info >= (3, 9): + from types import GenericAlias + +__all__ = [ + "match", + "fullmatch", + "search", + "sub", + "subn", + "split", + "findall", + "finditer", + "compile", + "purge", + "template", + "escape", + "error", + "A", + "I", + "L", + "M", + "S", + "X", + "U", + "ASCII", + "IGNORECASE", + "LOCALE", + "MULTILINE", + "DOTALL", + "VERBOSE", + "UNICODE", + "Match", + "Pattern", +] + +if sys.version_info >= (3, 11): + __all__ += ["NOFLAG", "RegexFlag"] + +_T = TypeVar("_T") + +@final +class Match(Generic[AnyStr]): + @property + def pos(self) -> int: ... + @property + def endpos(self) -> int: ... + @property + def lastindex(self) -> int | None: ... + @property + def lastgroup(self) -> str | None: ... + @property + def string(self) -> AnyStr: ... + + # The regular expression object whose match() or search() method produced + # this match instance. + @property + def re(self) -> Pattern[AnyStr]: ... + @overload + def expand(self: Match[str], template: str) -> str: ... + @overload + def expand(self: Match[bytes], template: ReadableBuffer) -> bytes: ... + # group() returns "AnyStr" or "AnyStr | None", depending on the pattern. + @overload + def group(self, __group: Literal[0] = ...) -> AnyStr: ... + @overload + def group(self, __group: str | int) -> AnyStr | Any: ... + @overload + def group(self, __group1: str | int, __group2: str | int, *groups: str | int) -> tuple[AnyStr | Any, ...]: ... + # Each item of groups()'s return tuple is either "AnyStr" or + # "AnyStr | None", depending on the pattern. + @overload + def groups(self) -> tuple[AnyStr | Any, ...]: ... + @overload + def groups(self, default: _T) -> tuple[AnyStr | _T, ...]: ... + # Each value in groupdict()'s return dict is either "AnyStr" or + # "AnyStr | None", depending on the pattern. + @overload + def groupdict(self) -> dict[str, AnyStr | Any]: ... + @overload + def groupdict(self, default: _T) -> dict[str, AnyStr | _T]: ... + def start(self, __group: int | str = ...) -> int: ... + def end(self, __group: int | str = ...) -> int: ... + def span(self, __group: int | str = ...) -> tuple[int, int]: ... + @property + def regs(self) -> tuple[tuple[int, int], ...]: ... # undocumented + # __getitem__() returns "AnyStr" or "AnyStr | None", depending on the pattern. + @overload + def __getitem__(self, __key: Literal[0]) -> AnyStr: ... + @overload + def __getitem__(self, __key: int | str) -> AnyStr | Any: ... + def __copy__(self) -> Match[AnyStr]: ... + def __deepcopy__(self, __memo: Any) -> Match[AnyStr]: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... + +@final +class Pattern(Generic[AnyStr]): + @property + def flags(self) -> int: ... + @property + def groupindex(self) -> Mapping[str, int]: ... + @property + def groups(self) -> int: ... + @property + def pattern(self) -> AnyStr: ... + @overload + def search(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... + @overload + def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... + @overload + def match(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... + @overload + def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... + @overload + def fullmatch(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... + @overload + def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... + @overload + def split(self: Pattern[str], string: str, maxsplit: int = ...) -> list[str | Any]: ... + @overload + def split(self: Pattern[bytes], string: ReadableBuffer, maxsplit: int = ...) -> list[bytes | Any]: ... + # return type depends on the number of groups in the pattern + @overload + def findall(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> list[Any]: ... + @overload + def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> list[Any]: ... + @overload + def finditer(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Iterator[Match[str]]: ... + @overload + def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Iterator[Match[bytes]]: ... + @overload + def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ...) -> str: ... + @overload + def sub( + self: Pattern[bytes], + repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + ) -> bytes: ... + @overload + def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ...) -> tuple[str, int]: ... + @overload + def subn( + self: Pattern[bytes], + repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + ) -> tuple[bytes, int]: ... + def __copy__(self) -> Pattern[AnyStr]: ... + def __deepcopy__(self, __memo: Any) -> Pattern[AnyStr]: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any) -> GenericAlias: ... # ----- re variables and constants ----- -if sys.version_info >= (3, 7): - from typing import Match as Match, Pattern as Pattern -else: - from typing import Match, Pattern class RegexFlag(enum.IntFlag): - A: int - ASCII: int - DEBUG: int - I: int - IGNORECASE: int - L: int - LOCALE: int - M: int - MULTILINE: int - S: int - DOTALL: int - X: int - VERBOSE: int - U: int - UNICODE: int - T: int - TEMPLATE: int + A = sre_compile.SRE_FLAG_ASCII + ASCII = A + DEBUG = sre_compile.SRE_FLAG_DEBUG + I = sre_compile.SRE_FLAG_IGNORECASE + IGNORECASE = I + L = sre_compile.SRE_FLAG_LOCALE + LOCALE = L + M = sre_compile.SRE_FLAG_MULTILINE + MULTILINE = M + S = sre_compile.SRE_FLAG_DOTALL + DOTALL = S + X = sre_compile.SRE_FLAG_VERBOSE + VERBOSE = X + U = sre_compile.SRE_FLAG_UNICODE + UNICODE = U + T = sre_compile.SRE_FLAG_TEMPLATE + TEMPLATE = T + if sys.version_info >= (3, 11): + NOFLAG: int A = RegexFlag.A ASCII = RegexFlag.ASCII @@ -45,73 +200,71 @@ U = RegexFlag.U UNICODE = RegexFlag.UNICODE T = RegexFlag.T TEMPLATE = RegexFlag.TEMPLATE -_FlagsType = Union[int, RegexFlag] +if sys.version_info >= (3, 11): + NOFLAG = RegexFlag.NOFLAG +_FlagsType: TypeAlias = int | RegexFlag -if sys.version_info < (3, 7): - # undocumented - _pattern_type: type +# Type-wise the compile() overloads are unnecessary, they could also be modeled using +# unions in the parameter types. However mypy has a bug regarding TypeVar +# constraints (https://github.com/python/mypy/issues/11880), +# which limits us here because AnyStr is a constrained TypeVar. +# pattern arguments do *not* accept arbitrary buffers such as bytearray, +# because the pattern must be hashable. @overload def compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]: ... @overload def compile(pattern: Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... @overload -def search(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... +def search(pattern: str | Pattern[str], string: str, flags: _FlagsType = ...) -> Match[str] | None: ... @overload -def search(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... +def search(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = ...) -> Match[bytes] | None: ... @overload -def match(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... +def match(pattern: str | Pattern[str], string: str, flags: _FlagsType = ...) -> Match[str] | None: ... @overload -def match(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... - -# New in Python 3.4 -@overload -def fullmatch(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... +def match(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = ...) -> Match[bytes] | None: ... @overload -def fullmatch(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... +def fullmatch(pattern: str | Pattern[str], string: str, flags: _FlagsType = ...) -> Match[str] | None: ... @overload -def split(pattern: AnyStr, string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> list[AnyStr | Any]: ... +def fullmatch(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = ...) -> Match[bytes] | None: ... @overload -def split(pattern: Pattern[AnyStr], string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> list[AnyStr | Any]: ... +def split(pattern: str | Pattern[str], string: str, maxsplit: int = ..., flags: _FlagsType = ...) -> list[str | Any]: ... @overload -def findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> list[Any]: ... +def split( + pattern: bytes | Pattern[bytes], string: ReadableBuffer, maxsplit: int = ..., flags: _FlagsType = ... +) -> list[bytes | Any]: ... @overload -def findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> list[Any]: ... - -# Return an iterator yielding match objects over all non-overlapping matches -# for the RE pattern in string. The string is scanned left-to-right, and -# matches are returned in the order found. Empty matches are included in the -# result unless they touch the beginning of another match. +def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = ...) -> list[Any]: ... @overload -def finditer(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... +def findall(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = ...) -> list[Any]: ... @overload -def finditer(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... +def finditer(pattern: str | Pattern[str], string: str, flags: _FlagsType = ...) -> Iterator[Match[str]]: ... @overload -def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ... +def finditer(pattern: bytes | Pattern[bytes], string: ReadableBuffer, flags: _FlagsType = ...) -> Iterator[Match[bytes]]: ... @overload def sub( - pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... -) -> AnyStr: ... -@overload -def sub(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ... + pattern: str | Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ..., flags: _FlagsType = ... +) -> str: ... @overload def sub( - pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... -) -> AnyStr: ... -@overload -def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ... -@overload -def subn( - pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... -) -> Tuple[AnyStr, int]: ... + pattern: bytes | Pattern[bytes], + repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: _FlagsType = ..., +) -> bytes: ... @overload def subn( - pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ... -) -> Tuple[AnyStr, int]: ... + pattern: str | Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ..., flags: _FlagsType = ... +) -> tuple[str, int]: ... @overload def subn( - pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... -) -> Tuple[AnyStr, int]: ... + pattern: bytes | Pattern[bytes], + repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: _FlagsType = ..., +) -> tuple[bytes, int]: ... def escape(pattern: AnyStr) -> AnyStr: ... def purge() -> None: ... def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... diff --git a/stdlib/readline.pyi b/stdlib/readline.pyi index 2de749b..ceca2e3 100644 --- a/stdlib/readline.pyi +++ b/stdlib/readline.pyi @@ -1,33 +1,36 @@ +import sys from _typeshed import StrOrBytesPath -from typing import Callable, Optional, Sequence +from collections.abc import Callable, Sequence +from typing_extensions import TypeAlias -_CompleterT = Optional[Callable[[str, int], Optional[str]]] -_CompDispT = Optional[Callable[[str, Sequence[str], int], None]] +if sys.platform != "win32": + _Completer: TypeAlias = Callable[[str, int], str | None] + _CompDisp: TypeAlias = Callable[[str, Sequence[str], int], None] -def parse_and_bind(__string: str) -> None: ... -def read_init_file(__filename: StrOrBytesPath | None = ...) -> None: ... -def get_line_buffer() -> str: ... -def insert_text(__string: str) -> None: ... -def redisplay() -> None: ... -def read_history_file(__filename: StrOrBytesPath | None = ...) -> None: ... -def write_history_file(__filename: StrOrBytesPath | None = ...) -> None: ... -def append_history_file(__nelements: int, __filename: StrOrBytesPath | None = ...) -> None: ... -def get_history_length() -> int: ... -def set_history_length(__length: int) -> None: ... -def clear_history() -> None: ... -def get_current_history_length() -> int: ... -def get_history_item(__index: int) -> str: ... -def remove_history_item(__pos: int) -> None: ... -def replace_history_item(__pos: int, __line: str) -> None: ... -def add_history(__string: str) -> None: ... -def set_auto_history(__enabled: bool) -> None: ... -def set_startup_hook(__function: Callable[[], None] | None = ...) -> None: ... -def set_pre_input_hook(__function: Callable[[], None] | None = ...) -> None: ... -def set_completer(__function: _CompleterT = ...) -> None: ... -def get_completer() -> _CompleterT: ... -def get_completion_type() -> int: ... -def get_begidx() -> int: ... -def get_endidx() -> int: ... -def set_completer_delims(__string: str) -> None: ... -def get_completer_delims() -> str: ... -def set_completion_display_matches_hook(__function: _CompDispT = ...) -> None: ... + def parse_and_bind(__string: str) -> None: ... + def read_init_file(__filename: StrOrBytesPath | None = ...) -> None: ... + def get_line_buffer() -> str: ... + def insert_text(__string: str) -> None: ... + def redisplay() -> None: ... + def read_history_file(__filename: StrOrBytesPath | None = ...) -> None: ... + def write_history_file(__filename: StrOrBytesPath | None = ...) -> None: ... + def append_history_file(__nelements: int, __filename: StrOrBytesPath | None = ...) -> None: ... + def get_history_length() -> int: ... + def set_history_length(__length: int) -> None: ... + def clear_history() -> None: ... + def get_current_history_length() -> int: ... + def get_history_item(__index: int) -> str: ... + def remove_history_item(__pos: int) -> None: ... + def replace_history_item(__pos: int, __line: str) -> None: ... + def add_history(__string: str) -> None: ... + def set_auto_history(__enabled: bool) -> None: ... + def set_startup_hook(__function: Callable[[], object] | None = ...) -> None: ... + def set_pre_input_hook(__function: Callable[[], object] | None = ...) -> None: ... + def set_completer(__function: _Completer | None = ...) -> None: ... + def get_completer() -> _Completer | None: ... + def get_completion_type() -> int: ... + def get_begidx() -> int: ... + def get_endidx() -> int: ... + def set_completer_delims(__string: str) -> None: ... + def get_completer_delims() -> str: ... + def set_completion_display_matches_hook(__function: _CompDisp | None = ...) -> None: ... diff --git a/stdlib/reprlib.pyi b/stdlib/reprlib.pyi index 1529220..9955f12 100644 --- a/stdlib/reprlib.pyi +++ b/stdlib/reprlib.pyi @@ -1,7 +1,12 @@ from array import array -from typing import Any, Callable, Deque, FrozenSet, Set, Tuple +from collections import deque +from collections.abc import Callable +from typing import Any +from typing_extensions import TypeAlias -_ReprFunc = Callable[[Any], str] +__all__ = ["Repr", "repr", "recursive_repr"] + +_ReprFunc: TypeAlias = Callable[[Any], str] def recursive_repr(fillvalue: str = ...) -> Callable[[_ReprFunc], _ReprFunc]: ... @@ -17,15 +22,14 @@ class Repr: maxlong: int maxstring: int maxother: int - def __init__(self) -> None: ... def repr(self, x: Any) -> str: ... def repr1(self, x: Any, level: int) -> str: ... - def repr_tuple(self, x: Tuple[Any, ...], level: int) -> str: ... + def repr_tuple(self, x: tuple[Any, ...], level: int) -> str: ... def repr_list(self, x: list[Any], level: int) -> str: ... def repr_array(self, x: array[Any], level: int) -> str: ... - def repr_set(self, x: Set[Any], level: int) -> str: ... - def repr_frozenset(self, x: FrozenSet[Any], level: int) -> str: ... - def repr_deque(self, x: Deque[Any], level: int) -> str: ... + def repr_set(self, x: set[Any], level: int) -> str: ... + def repr_frozenset(self, x: frozenset[Any], level: int) -> str: ... + def repr_deque(self, x: deque[Any], level: int) -> str: ... def repr_dict(self, x: dict[Any, Any], level: int) -> str: ... def repr_str(self, x: str, level: int) -> str: ... def repr_int(self, x: int, level: int) -> str: ... diff --git a/stdlib/resource.pyi b/stdlib/resource.pyi index 742e438..f2e979f 100644 --- a/stdlib/resource.pyi +++ b/stdlib/resource.pyi @@ -1,58 +1,93 @@ import sys -from typing import Any, Tuple, overload +from _typeshed import structseq +from typing import overload +from typing_extensions import Final, final -RLIMIT_AS: int -RLIMIT_CORE: int -RLIMIT_CPU: int -RLIMIT_DATA: int -RLIMIT_FSIZE: int -RLIMIT_MEMLOCK: int -RLIMIT_NOFILE: int -RLIMIT_NPROC: int -RLIMIT_RSS: int -RLIMIT_STACK: int -RLIM_INFINITY: int -RUSAGE_CHILDREN: int -RUSAGE_SELF: int -if sys.platform == "linux": - RLIMIT_MSGQUEUE: int - RLIMIT_NICE: int - RLIMIT_OFILE: int - RLIMIT_RTPRIO: int - RLIMIT_RTTIME: int - RLIMIT_SIGPENDING: int - RUSAGE_THREAD: int +if sys.platform != "win32": + RLIMIT_AS: int + RLIMIT_CORE: int + RLIMIT_CPU: int + RLIMIT_DATA: int + RLIMIT_FSIZE: int + RLIMIT_MEMLOCK: int + RLIMIT_NOFILE: int + RLIMIT_NPROC: int + RLIMIT_RSS: int + RLIMIT_STACK: int + RLIM_INFINITY: int + RUSAGE_CHILDREN: int + RUSAGE_SELF: int + if sys.platform == "linux": + RLIMIT_MSGQUEUE: int + RLIMIT_NICE: int + RLIMIT_OFILE: int + RLIMIT_RTPRIO: int + RLIMIT_RTTIME: int + RLIMIT_SIGPENDING: int + RUSAGE_THREAD: int + @final + class struct_rusage( + structseq[float], tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] + ): + if sys.version_info >= (3, 10): + __match_args__: Final = ( + "ru_utime", + "ru_stime", + "ru_maxrss", + "ru_ixrss", + "ru_idrss", + "ru_isrss", + "ru_minflt", + "ru_majflt", + "ru_nswap", + "ru_inblock", + "ru_oublock", + "ru_msgsnd", + "ru_msgrcv", + "ru_nsignals", + "ru_nvcsw", + "ru_nivcsw", + ) + @property + def ru_utime(self) -> float: ... + @property + def ru_stime(self) -> float: ... + @property + def ru_maxrss(self) -> int: ... + @property + def ru_ixrss(self) -> int: ... + @property + def ru_idrss(self) -> int: ... + @property + def ru_isrss(self) -> int: ... + @property + def ru_minflt(self) -> int: ... + @property + def ru_majflt(self) -> int: ... + @property + def ru_nswap(self) -> int: ... + @property + def ru_inblock(self) -> int: ... + @property + def ru_oublock(self) -> int: ... + @property + def ru_msgsnd(self) -> int: ... + @property + def ru_msgrcv(self) -> int: ... + @property + def ru_nsignals(self) -> int: ... + @property + def ru_nvcsw(self) -> int: ... + @property + def ru_nivcsw(self) -> int: ... -_Tuple16 = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] - -class struct_rusage(_Tuple16): - def __new__(cls, sequence: _Tuple16, dict: dict[str, Any] = ...) -> struct_rusage: ... - ru_utime: float - ru_stime: float - ru_maxrss: int - ru_ixrss: int - ru_idrss: int - ru_isrss: int - ru_minflt: int - ru_majflt: int - ru_nswap: int - ru_inblock: int - ru_oublock: int - ru_msgsnd: int - ru_msgrcv: int - ru_nsignals: int - ru_nvcsw: int - ru_nivcsw: int - -def getpagesize() -> int: ... -def getrlimit(__resource: int) -> Tuple[int, int]: ... -def getrusage(__who: int) -> struct_rusage: ... -def setrlimit(__resource: int, __limits: Tuple[int, int]) -> None: ... - -if sys.platform == "linux": - @overload - def prlimit(pid: int, resource: int, limits: Tuple[int, int]) -> Tuple[int, int]: ... - @overload - def prlimit(pid: int, resource: int) -> Tuple[int, int]: ... - -error = OSError + def getpagesize() -> int: ... + def getrlimit(__resource: int) -> tuple[int, int]: ... + def getrusage(__who: int) -> struct_rusage: ... + def setrlimit(__resource: int, __limits: tuple[int, int]) -> None: ... + if sys.platform == "linux": + @overload + def prlimit(pid: int, resource: int, limits: tuple[int, int]) -> tuple[int, int]: ... + @overload + def prlimit(pid: int, resource: int) -> tuple[int, int]: ... + error = OSError diff --git a/stdlib/rlcompleter.pyi b/stdlib/rlcompleter.pyi index f971c42..1840b7c 100644 --- a/stdlib/rlcompleter.pyi +++ b/stdlib/rlcompleter.pyi @@ -1,5 +1,9 @@ from typing import Any +__all__ = ["Completer"] + class Completer: def __init__(self, namespace: dict[str, Any] | None = ...) -> None: ... def complete(self, text: str, state: int) -> str | None: ... + def attr_matches(self, text: str) -> list[str]: ... + def global_matches(self, text: str) -> list[str]: ... diff --git a/stdlib/runpy.pyi b/stdlib/runpy.pyi index 371fa9d..256f8da 100644 --- a/stdlib/runpy.pyi +++ b/stdlib/runpy.pyi @@ -2,18 +2,20 @@ from _typeshed import Self from types import ModuleType from typing import Any +__all__ = ["run_module", "run_path"] + class _TempModule: mod_name: str module: ModuleType def __init__(self, mod_name: str) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class _ModifiedArgv0: value: Any def __init__(self, value: Any) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def run_module( mod_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ... diff --git a/stdlib/sched.pyi b/stdlib/sched.pyi index cb96dc2..29c84f9 100644 --- a/stdlib/sched.pyi +++ b/stdlib/sched.pyi @@ -1,29 +1,39 @@ -from typing import Any, Callable, NamedTuple, Tuple +import sys +from collections.abc import Callable +from typing import Any, NamedTuple +from typing_extensions import TypeAlias -class Event(NamedTuple): - time: float - priority: Any - action: Callable[..., Any] - argument: Tuple[Any, ...] - kwargs: dict[str, Any] +__all__ = ["scheduler"] + +_ActionCallback: TypeAlias = Callable[..., Any] + +if sys.version_info >= (3, 10): + class Event(NamedTuple): + time: float + priority: Any + sequence: int + action: _ActionCallback + argument: tuple[Any, ...] + kwargs: dict[str, Any] + +else: + class Event(NamedTuple): + time: float + priority: Any + action: _ActionCallback + argument: tuple[Any, ...] + kwargs: dict[str, Any] class scheduler: - def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], None] = ...) -> None: ... + timefunc: Callable[[], float] + delayfunc: Callable[[float], object] + + def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], object] = ...) -> None: ... def enterabs( - self, - time: float, - priority: Any, - action: Callable[..., Any], - argument: Tuple[Any, ...] = ..., - kwargs: dict[str, Any] = ..., + self, time: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ... ) -> Event: ... def enter( - self, - delay: float, - priority: Any, - action: Callable[..., Any], - argument: Tuple[Any, ...] = ..., - kwargs: dict[str, Any] = ..., + self, delay: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ... ) -> Event: ... def run(self, blocking: bool = ...) -> float | None: ... def cancel(self, event: Event) -> None: ... diff --git a/stdlib/secrets.pyi b/stdlib/secrets.pyi index 6752a30..99b7c14 100644 --- a/stdlib/secrets.pyi +++ b/stdlib/secrets.pyi @@ -1,12 +1,15 @@ +from _typeshed import SupportsLenAndGetItem from hmac import compare_digest as compare_digest from random import SystemRandom as SystemRandom -from typing import Sequence, TypeVar +from typing import TypeVar + +__all__ = ["choice", "randbelow", "randbits", "SystemRandom", "token_bytes", "token_hex", "token_urlsafe", "compare_digest"] _T = TypeVar("_T") def randbelow(exclusive_upper_bound: int) -> int: ... def randbits(k: int) -> int: ... -def choice(seq: Sequence[_T]) -> _T: ... +def choice(seq: SupportsLenAndGetItem[_T]) -> _T: ... def token_bytes(nbytes: int | None = ...) -> bytes: ... def token_hex(nbytes: int | None = ...) -> str: ... def token_urlsafe(nbytes: int | None = ...) -> str: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index fd503dc..6398973 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -1,7 +1,9 @@ import sys from _typeshed import FileDescriptorLike, Self +from collections.abc import Iterable from types import TracebackType -from typing import Any, Iterable, Tuple, Type +from typing import Any +from typing_extensions import final if sys.platform != "win32": PIPE_BUF: int @@ -13,26 +15,27 @@ if sys.platform != "win32": POLLOUT: int POLLPRI: int POLLRDBAND: int + POLLRDHUP: int POLLRDNORM: int POLLWRBAND: int POLLWRNORM: int class poll: - def __init__(self) -> None: ... def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> list[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ... def select( __rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: float | None = ... -) -> Tuple[list[Any], list[Any], list[Any]]: ... +) -> tuple[list[Any], list[Any], list[Any]]: ... error = OSError if sys.platform != "linux" and sys.platform != "win32": # BSD only - class kevent(object): + @final + class kevent: data: Any fflags: int filter: int @@ -49,7 +52,8 @@ if sys.platform != "linux" and sys.platform != "win32": udata: Any = ..., ) -> None: ... # BSD only - class kqueue(object): + @final + class kqueue: closed: bool def __init__(self) -> None: ... def close(self) -> None: ... @@ -99,14 +103,15 @@ if sys.platform != "linux" and sys.platform != "win32": KQ_NOTE_WRITE: int if sys.platform == "linux": - class epoll(object): + @final + class epoll: def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( self, - exc_type: Type[BaseException] | None = ..., - exc_val: BaseException | None = ..., - exc_tb: TracebackType | None = ..., + __exc_type: type[BaseException] | None = ..., + __exc_val: BaseException | None = ..., + __exc_tb: TracebackType | None = ..., ) -> None: ... def close(self) -> None: ... closed: bool @@ -114,10 +119,11 @@ if sys.platform == "linux": def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ..., maxevents: int = ...) -> list[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ..., maxevents: int = ...) -> list[tuple[int, int]]: ... @classmethod def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ... EPOLLERR: int + EPOLLEXCLUSIVE: int EPOLLET: int EPOLLHUP: int EPOLLIN: int @@ -126,10 +132,12 @@ if sys.platform == "linux": EPOLLOUT: int EPOLLPRI: int EPOLLRDBAND: int + EPOLLRDHUP: int EPOLLRDNORM: int EPOLLWRBAND: int EPOLLWRNORM: int EPOLL_RDHUP: int + EPOLL_CLOEXEC: int if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32": # Solaris only @@ -140,4 +148,4 @@ if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> list[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ... diff --git a/stdlib/selectors.pyi b/stdlib/selectors.pyi index a28dc1d..95dfaa4 100644 --- a/stdlib/selectors.pyi +++ b/stdlib/selectors.pyi @@ -1,9 +1,11 @@ import sys from _typeshed import FileDescriptor, FileDescriptorLike, Self from abc import ABCMeta, abstractmethod -from typing import Any, Mapping, NamedTuple, Tuple +from collections.abc import Mapping +from typing import Any, NamedTuple +from typing_extensions import TypeAlias -_EventMask = int +_EventMask: TypeAlias = int EVENT_READ: _EventMask EVENT_WRITE: _EventMask @@ -21,25 +23,25 @@ class BaseSelector(metaclass=ABCMeta): def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... def modify(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... @abstractmethod - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def close(self) -> None: ... def get_key(self, fileobj: FileDescriptorLike) -> SelectorKey: ... @abstractmethod def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class SelectSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... if sys.platform != "win32": class PollSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... if sys.platform == "linux": @@ -47,25 +49,25 @@ if sys.platform == "linux": def fileno(self) -> int: ... def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class DevpollSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class KqueueSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class DefaultSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index 90b2aaf..c801ecd 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -1,7 +1,10 @@ from _typeshed import Self from collections.abc import Iterator, MutableMapping +from dbm import _TFlags from types import TracebackType -from typing import Type, TypeVar, overload +from typing import Any, TypeVar, overload + +__all__ = ["Shelf", "BsdDbShelf", "DbfilenameShelf", "open"] _T = TypeVar("_T") _VT = TypeVar("_VT") @@ -19,9 +22,10 @@ class Shelf(MutableMapping[str, _VT]): def __getitem__(self, key: str) -> _VT: ... def __setitem__(self, key: str, value: _VT) -> None: ... def __delitem__(self, key: str) -> None: ... + def __contains__(self, key: str) -> bool: ... # type: ignore[override] def __enter__(self: Self) -> Self: ... def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... def close(self) -> None: ... def sync(self) -> None: ... @@ -34,6 +38,6 @@ class BsdDbShelf(Shelf[_VT]): def last(self) -> tuple[str, _VT]: ... class DbfilenameShelf(Shelf[_VT]): - def __init__(self, filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... + def __init__(self, filename: str, flag: _TFlags = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... -def open(filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> Shelf[object]: ... +def open(filename: str, flag: _TFlags = ..., protocol: int | None = ..., writeback: bool = ...) -> Shelf[Any]: ... diff --git a/stdlib/shlex.pyi b/stdlib/shlex.pyi index b517d03..f9d6605 100644 --- a/stdlib/shlex.pyi +++ b/stdlib/shlex.pyi @@ -1,5 +1,12 @@ import sys -from typing import Any, Iterable, TextIO, Tuple, TypeVar +from _typeshed import Self +from collections.abc import Iterable +from typing import TextIO + +if sys.version_info >= (3, 8): + __all__ = ["shlex", "split", "quote", "join"] +else: + __all__ = ["shlex", "split", "quote"] def split(s: str, comments: bool = ..., posix: bool = ...) -> list[str]: ... @@ -8,8 +15,6 @@ if sys.version_info >= (3, 8): def quote(s: str) -> str: ... -_SLT = TypeVar("_SLT", bound=shlex) - class shlex(Iterable[str]): commenters: str wordchars: str @@ -18,14 +23,15 @@ class shlex(Iterable[str]): quotes: str escapedquotes: str whitespace_split: bool - infile: str + infile: str | None instream: TextIO source: str debug: int lineno: int token: str eof: str - punctuation_chars: str + @property + def punctuation_chars(self) -> str: ... def __init__( self, instream: str | TextIO | None = ..., @@ -36,10 +42,9 @@ class shlex(Iterable[str]): def get_token(self) -> str: ... def push_token(self, tok: str) -> None: ... def read_token(self) -> str: ... - def sourcehook(self, newfile: str) -> Tuple[str, TextIO]: ... - # TODO argument types - def push_source(self, newstream: Any, newfile: Any = ...) -> None: ... + def sourcehook(self, newfile: str) -> tuple[str, TextIO]: ... + def push_source(self, newstream: str | TextIO, newfile: str | None = ...) -> None: ... def pop_source(self) -> None: ... def error_leader(self, infile: str | None = ..., lineno: int | None = ...) -> None: ... - def __iter__(self: _SLT) -> _SLT: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> str: ... diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index cd2f28c..13c706d 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -1,12 +1,44 @@ import os import sys -from _typeshed import StrPath, SupportsRead, SupportsWrite -from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, Set, Tuple, TypeVar, Union, overload - -_PathT = TypeVar("_PathT", str, os.PathLike[str]) +from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite +from collections.abc import Callable, Iterable, Sequence +from typing import Any, AnyStr, NamedTuple, TypeVar, overload +from typing_extensions import TypeAlias + +__all__ = [ + "copyfileobj", + "copyfile", + "copymode", + "copystat", + "copy", + "copy2", + "copytree", + "move", + "rmtree", + "Error", + "SpecialFileError", + "ExecError", + "make_archive", + "get_archive_formats", + "register_archive_format", + "unregister_archive_format", + "get_unpack_formats", + "register_unpack_format", + "unregister_unpack_format", + "unpack_archive", + "ignore_patterns", + "chown", + "which", + "get_terminal_size", + "SameFileError", + "disk_usage", +] + +_StrOrBytesPathT = TypeVar("_StrOrBytesPathT", bound=StrOrBytesPath) +_StrPathT = TypeVar("_StrPathT", bound=StrPath) # Return value of some functions that may either return a path-like object that was passed in or # a string -_PathReturn = Any +_PathReturn: TypeAlias = Any class Error(OSError): ... class SameFileError(Error): ... @@ -16,12 +48,18 @@ class ReadError(OSError): ... class RegistryError(Exception): ... def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ... -def copyfile(src: StrPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ... -def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ... -def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ... +def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = ...) -> _StrOrBytesPathT: ... +def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ... +def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ... +@overload def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... +@overload +def copy(src: BytesPath, dst: BytesPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... +@overload def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... -def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], Set[str]]: ... +@overload +def copy2(src: BytesPath, dst: BytesPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... +def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], set[str]]: ... if sys.version_info >= (3, 8): def copytree( @@ -29,7 +67,7 @@ if sys.version_info >= (3, 8): dst: StrPath, symlinks: bool = ..., ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., - copy_function: Callable[[str, str], None] = ..., + copy_function: Callable[[str, str], object] = ..., ignore_dangling_symlinks: bool = ..., dirs_exist_ok: bool = ..., ) -> _PathReturn: ... @@ -40,14 +78,25 @@ else: dst: StrPath, symlinks: bool = ..., ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., - copy_function: Callable[[str, str], None] = ..., + copy_function: Callable[[str, str], object] = ..., ignore_dangling_symlinks: bool = ..., ) -> _PathReturn: ... -def rmtree(path: bytes | StrPath, ignore_errors: bool = ..., onerror: Callable[[Any, Any, Any], Any] | None = ...) -> None: ... +_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], Any, Any], object] + +if sys.version_info >= (3, 11): + def rmtree( + path: StrOrBytesPath, ignore_errors: bool = ..., onerror: _OnErrorCallback | None = ..., *, dir_fd: int | None = ... + ) -> None: ... + +else: + def rmtree(path: StrOrBytesPath, ignore_errors: bool = ..., onerror: _OnErrorCallback | None = ...) -> None: ... -_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]] +_CopyFn: TypeAlias = Callable[[str, str], object] | Callable[[StrPath, StrPath], object] +# N.B. shutil.move appears to take bytes arguments, however, +# this does not work when dst is (or is within) an existing directory. +# (#6832) if sys.version_info >= (3, 9): def move(src: StrPath, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ... @@ -60,17 +109,28 @@ class _ntuple_diskusage(NamedTuple): used: int free: int -def disk_usage(path: StrPath) -> _ntuple_diskusage: ... -def chown(path: StrPath, user: str | int | None = ..., group: str | int | None = ...) -> None: ... +def disk_usage(path: int | StrOrBytesPath) -> _ntuple_diskusage: ... + +# While chown can be imported on Windows, it doesn't actually work; +# see https://bugs.python.org/issue33140. We keep it here because it's +# in __all__. +@overload +def chown(path: StrOrBytesPath, user: str | int, group: None = ...) -> None: ... +@overload +def chown(path: StrOrBytesPath, user: None = ..., *, group: str | int) -> None: ... +@overload +def chown(path: StrOrBytesPath, user: None, group: str | int) -> None: ... +@overload +def chown(path: StrOrBytesPath, user: str | int, group: str | int) -> None: ... if sys.version_info >= (3, 8): @overload - def which(cmd: StrPath, mode: int = ..., path: StrPath | None = ...) -> str | None: ... + def which(cmd: _StrPathT, mode: int = ..., path: StrPath | None = ...) -> str | _StrPathT | None: ... @overload def which(cmd: bytes, mode: int = ..., path: StrPath | None = ...) -> bytes | None: ... else: - def which(cmd: StrPath, mode: int = ..., path: StrPath | None = ...) -> str | None: ... + def which(cmd: _StrPathT, mode: int = ..., path: StrPath | None = ...) -> str | _StrPathT | None: ... def make_archive( base_name: str, @@ -83,25 +143,29 @@ def make_archive( group: str | None = ..., logger: Any | None = ..., ) -> str: ... -def get_archive_formats() -> list[Tuple[str, str]]: ... +def get_archive_formats() -> list[tuple[str, str]]: ... +@overload +def register_archive_format( + name: str, function: Callable[..., object], extra_args: Sequence[tuple[str, Any] | list[Any]], description: str = ... +) -> None: ... +@overload def register_archive_format( + name: str, function: Callable[[str, str], object], extra_args: None = ..., description: str = ... +) -> None: ... +def unregister_archive_format(name: str) -> None: ... +def unpack_archive(filename: StrPath, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ... +@overload +def register_unpack_format( name: str, - function: Callable[..., Any], - extra_args: Sequence[Tuple[str, Any] | list[Any]] | None = ..., + extensions: list[str], + function: Callable[..., object], + extra_args: Sequence[tuple[str, Any]], description: str = ..., ) -> None: ... -def unregister_archive_format(name: str) -> None: ... - -if sys.version_info >= (3, 7): - def unpack_archive(filename: StrPath, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ... - -else: - # See http://bugs.python.org/issue30218 - def unpack_archive(filename: str, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ... - +@overload def register_unpack_format( - name: str, extensions: list[str], function: Any, extra_args: Sequence[Tuple[str, Any]] | None = ..., description: str = ... + name: str, extensions: list[str], function: Callable[[str, str], object], extra_args: None = ..., description: str = ... ) -> None: ... def unregister_unpack_format(name: str) -> None: ... -def get_unpack_formats() -> list[Tuple[str, list[str], str]]: ... -def get_terminal_size(fallback: Tuple[int, int] = ...) -> os.terminal_size: ... +def get_unpack_formats() -> list[tuple[str, list[str], str]]: ... +def get_terminal_size(fallback: tuple[int, int] = ...) -> os.terminal_size: ... diff --git a/stdlib/signal.pyi b/stdlib/signal.pyi index 21ad232..8e9bd99 100644 --- a/stdlib/signal.pyi +++ b/stdlib/signal.pyi @@ -1,56 +1,41 @@ import sys +from _typeshed import structseq +from collections.abc import Callable, Iterable from enum import IntEnum from types import FrameType -from typing import Any, Callable, Iterable, Optional, Set, Tuple, Union - -if sys.platform != "win32": - class ItimerError(IOError): ... - ITIMER_PROF: int - ITIMER_REAL: int - ITIMER_VIRTUAL: int +from typing import Any, Union +from typing_extensions import Final, Never, TypeAlias, final NSIG: int class Signals(IntEnum): SIGABRT: int - if sys.platform != "win32": - SIGALRM: int + SIGEMT: int + SIGFPE: int + SIGILL: int + SIGINFO: int + SIGINT: int + SIGSEGV: int + SIGTERM: int + if sys.platform == "win32": SIGBREAK: int - if sys.platform != "win32": + CTRL_C_EVENT: int + CTRL_BREAK_EVENT: int + else: + SIGALRM: int SIGBUS: int SIGCHLD: int - if sys.platform != "darwin" and sys.platform != "win32": - SIGCLD: int - if sys.platform != "win32": SIGCONT: int - SIGEMT: int - SIGFPE: int - if sys.platform != "win32": SIGHUP: int - SIGILL: int - SIGINFO: int - SIGINT: int - if sys.platform != "win32": SIGIO: int SIGIOT: int SIGKILL: int SIGPIPE: int - if sys.platform != "darwin" and sys.platform != "win32": - SIGPOLL: int - SIGPWR: int - if sys.platform != "win32": SIGPROF: int SIGQUIT: int - if sys.platform != "darwin" and sys.platform != "win32": - SIGRTMAX: int - SIGRTMIN: int - SIGSEGV: int - if sys.platform != "win32": SIGSTOP: int SIGSYS: int - SIGTERM: int - if sys.platform != "win32": SIGTRAP: int SIGTSTP: int SIGTTIN: int @@ -62,65 +47,60 @@ class Signals(IntEnum): SIGWINCH: int SIGXCPU: int SIGXFSZ: int + if sys.platform != "darwin": + SIGCLD: int + SIGPOLL: int + SIGPWR: int + SIGRTMAX: int + SIGRTMIN: int class Handlers(IntEnum): SIG_DFL: int SIG_IGN: int -SIG_DFL = Handlers.SIG_DFL -SIG_IGN = Handlers.SIG_IGN +SIG_DFL: Handlers +SIG_IGN: Handlers -if sys.platform != "win32": - class Sigmasks(IntEnum): - SIG_BLOCK: int - SIG_UNBLOCK: int - SIG_SETMASK: int - SIG_BLOCK = Sigmasks.SIG_BLOCK - SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK - SIG_SETMASK = Sigmasks.SIG_SETMASK +_SIGNUM: TypeAlias = int | Signals +_HANDLER: TypeAlias = Union[Callable[[int, FrameType | None], Any], int, Handlers, None] + +def default_int_handler(__signalnum: int, __frame: FrameType | None) -> Never: ... -_SIGNUM = Union[int, Signals] -_HANDLER = Union[Callable[[int, Optional[FrameType]], Any], int, Handlers, None] +if sys.version_info >= (3, 10): # arguments changed in 3.10.2 + def getsignal(signalnum: _SIGNUM) -> _HANDLER: ... + def signal(signalnum: _SIGNUM, handler: _HANDLER) -> _HANDLER: ... + +else: + def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ... + def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ... SIGABRT: Signals -if sys.platform != "win32": - SIGALRM: Signals +SIGEMT: Signals +SIGFPE: Signals +SIGILL: Signals +SIGINFO: Signals +SIGINT: Signals +SIGSEGV: Signals +SIGTERM: Signals + if sys.platform == "win32": SIGBREAK: Signals -if sys.platform != "win32": + CTRL_C_EVENT: Signals + CTRL_BREAK_EVENT: Signals +else: + SIGALRM: Signals SIGBUS: Signals SIGCHLD: Signals -if sys.platform != "darwin" and sys.platform != "win32": - SIGCLD: Signals -if sys.platform != "win32": SIGCONT: Signals -SIGEMT: Signals -SIGFPE: Signals -if sys.platform != "win32": SIGHUP: Signals -SIGILL: Signals -SIGINFO: Signals -SIGINT: Signals -if sys.platform != "win32": SIGIO: Signals SIGIOT: Signals SIGKILL: Signals SIGPIPE: Signals -if sys.platform != "darwin" and sys.platform != "win32": - SIGPOLL: Signals - SIGPWR: Signals -if sys.platform != "win32": SIGPROF: Signals SIGQUIT: Signals -if sys.platform != "darwin" and sys.platform != "win32": - SIGRTMAX: Signals - SIGRTMIN: Signals -SIGSEGV: Signals -if sys.platform != "win32": SIGSTOP: Signals SIGSYS: Signals -SIGTERM: Signals -if sys.platform != "win32": SIGTRAP: Signals SIGTSTP: Signals SIGTTIN: Signals @@ -133,63 +113,69 @@ if sys.platform != "win32": SIGXCPU: Signals SIGXFSZ: Signals -if sys.platform == "win32": - CTRL_C_EVENT: int - CTRL_BREAK_EVENT: int - -if sys.platform != "win32" and sys.platform != "darwin": - class struct_siginfo(Tuple[int, int, int, int, int, int, int]): - def __init__(self, sequence: Iterable[int]) -> None: ... - @property - def si_signo(self) -> int: ... - @property - def si_code(self) -> int: ... - @property - def si_errno(self) -> int: ... - @property - def si_pid(self) -> int: ... - @property - def si_uid(self) -> int: ... - @property - def si_status(self) -> int: ... - @property - def si_band(self) -> int: ... - -if sys.platform != "win32": - def alarm(__seconds: int) -> int: ... - -def default_int_handler(signum: int, frame: FrameType) -> None: ... - -if sys.platform != "win32": - def getitimer(__which: int) -> Tuple[float, float]: ... - -def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ... - -if sys.version_info >= (3, 8): - def strsignal(__signalnum: _SIGNUM) -> str | None: ... - def valid_signals() -> Set[Signals]: ... - def raise_signal(__signalnum: _SIGNUM) -> None: ... + class ItimerError(IOError): ... + ITIMER_PROF: int + ITIMER_REAL: int + ITIMER_VIRTUAL: int -if sys.platform != "win32": + class Sigmasks(IntEnum): + SIG_BLOCK: int + SIG_UNBLOCK: int + SIG_SETMASK: int + SIG_BLOCK = Sigmasks.SIG_BLOCK + SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK + SIG_SETMASK = Sigmasks.SIG_SETMASK + def alarm(__seconds: int) -> int: ... + def getitimer(__which: int) -> tuple[float, float]: ... def pause() -> None: ... def pthread_kill(__thread_id: int, __signalnum: int) -> None: ... - def pthread_sigmask(__how: int, __mask: Iterable[int]) -> Set[_SIGNUM]: ... - -if sys.version_info >= (3, 7): - def set_wakeup_fd(fd: int, *, warn_on_full_buffer: bool = ...) -> int: ... - -else: - def set_wakeup_fd(fd: int) -> int: ... + if sys.version_info >= (3, 10): # arguments changed in 3.10.2 + def pthread_sigmask(how: int, mask: Iterable[int]) -> set[_SIGNUM]: ... + else: + def pthread_sigmask(__how: int, __mask: Iterable[int]) -> set[_SIGNUM]: ... -if sys.platform != "win32": - def setitimer(__which: int, __seconds: float, __interval: float = ...) -> Tuple[float, float]: ... + def setitimer(__which: int, __seconds: float, __interval: float = ...) -> tuple[float, float]: ... def siginterrupt(__signalnum: int, __flag: bool) -> None: ... - -def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ... - -if sys.platform != "win32": def sigpending() -> Any: ... - def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ... + if sys.version_info >= (3, 10): # argument changed in 3.10.2 + def sigwait(sigset: Iterable[int]) -> _SIGNUM: ... + else: + def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ... if sys.platform != "darwin": + SIGCLD: Signals + SIGPOLL: Signals + SIGPWR: Signals + SIGRTMAX: Signals + SIGRTMIN: Signals + @final + class struct_siginfo(structseq[int], tuple[int, int, int, int, int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ("si_signo", "si_code", "si_errno", "si_pid", "si_uid", "si_status", "si_band") + @property + def si_signo(self) -> int: ... + @property + def si_code(self) -> int: ... + @property + def si_errno(self) -> int: ... + @property + def si_pid(self) -> int: ... + @property + def si_uid(self) -> int: ... + @property + def si_status(self) -> int: ... + @property + def si_band(self) -> int: ... + def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ... def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ... + +if sys.version_info >= (3, 8): + def strsignal(__signalnum: _SIGNUM) -> str | None: ... + def valid_signals() -> set[Signals]: ... + def raise_signal(__signalnum: _SIGNUM) -> None: ... + +def set_wakeup_fd(fd: int, *, warn_on_full_buffer: bool = ...) -> int: ... + +if sys.version_info >= (3, 9): + if sys.platform == "linux": + def pidfd_send_signal(__pidfd: int, __sig: int, __siginfo: None = ..., __flags: int = ...) -> None: ... diff --git a/stdlib/site.pyi b/stdlib/site.pyi index fc331c1..53199db 100644 --- a/stdlib/site.pyi +++ b/stdlib/site.pyi @@ -1,4 +1,5 @@ -from typing import Iterable +from _typeshed import StrPath +from collections.abc import Iterable PREFIXES: list[str] ENABLE_USER_SITE: bool | None @@ -6,7 +7,21 @@ USER_SITE: str | None USER_BASE: str | None def main() -> None: ... -def addsitedir(sitedir: str, known_paths: Iterable[str] | None = ...) -> None: ... +def abs_paths() -> None: ... # undocumented +def addpackage(sitedir: StrPath, name: StrPath, known_paths: set[str] | None) -> set[str] | None: ... # undocumented +def addsitedir(sitedir: str, known_paths: set[str] | None = ...) -> None: ... +def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = ...) -> set[str] | None: ... # undocumented +def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented +def check_enableusersite() -> bool | None: ... # undocumented +def enablerlcompleter() -> None: ... # undocumented +def execsitecustomize() -> None: ... # undocumented +def execusercustomize() -> None: ... # undocumented def getsitepackages(prefixes: Iterable[str] | None = ...) -> list[str]: ... def getuserbase() -> str: ... def getusersitepackages() -> str: ... +def makepath(*paths: StrPath) -> tuple[str, str]: ... # undocumented +def removeduppaths() -> set[str]: ... # undocumented +def setcopyright() -> None: ... # undocumented +def sethelper() -> None: ... # undocumented +def setquit() -> None: ... # undocumented +def venv(known_paths: set[str] | None) -> set[str] | None: ... # undocumented diff --git a/stdlib/smtpd.pyi b/stdlib/smtpd.pyi index 5d93073..f2de6c1 100644 --- a/stdlib/smtpd.pyi +++ b/stdlib/smtpd.pyi @@ -1,15 +1,23 @@ import asynchat import asyncore import socket -from typing import Any, DefaultDict, Tuple, Type +import sys +from collections import defaultdict +from typing import Any +from typing_extensions import TypeAlias -_Address = Tuple[str, int] # (host, port) +if sys.version_info >= (3, 11): + __all__ = ["SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy"] +else: + __all__ = ["SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy", "MailmanProxy"] + +_Address: TypeAlias = tuple[str, int] # (host, port) class SMTPChannel(asynchat.async_chat): COMMAND: int DATA: int - command_size_limits: DefaultDict[str, int] + command_size_limits: defaultdict[str, int] smtp_server: SMTPServer conn: socket.socket addr: Any @@ -34,12 +42,12 @@ class SMTPChannel(asynchat.async_chat): conn: socket.socket, addr: Any, data_size_limit: int = ..., - map: asyncore._maptype | None = ..., + map: asyncore._MapType | None = ..., enable_SMTPUTF8: bool = ..., decode_data: bool = ..., ) -> None: ... # base asynchat.async_chat.push() accepts bytes - def push(self, msg: str) -> None: ... # type: ignore + def push(self, msg: str) -> None: ... # type: ignore[override] def collect_incoming_data(self, data: bytes) -> None: ... def found_terminator(self) -> None: ... def smtp_HELO(self, arg: str) -> None: ... @@ -55,7 +63,7 @@ class SMTPChannel(asynchat.async_chat): def smtp_EXPN(self, arg: str) -> None: ... class SMTPServer(asyncore.dispatcher): - channel_class: Type[SMTPChannel] + channel_class: type[SMTPChannel] data_size_limit: int enable_SMTPUTF8: bool @@ -64,7 +72,7 @@ class SMTPServer(asyncore.dispatcher): localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ..., - map: asyncore._maptype | None = ..., + map: asyncore._MapType | None = ..., enable_SMTPUTF8: bool = ..., decode_data: bool = ..., ) -> None: ... @@ -76,11 +84,8 @@ class SMTPServer(asyncore.dispatcher): class DebuggingServer(SMTPServer): ... class PureProxy(SMTPServer): - def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str - ) -> str | None: ... + def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override] -class MailmanProxy(PureProxy): - def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str - ) -> str | None: ... +if sys.version_info < (3, 11): + class MailmanProxy(PureProxy): + def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override] diff --git a/stdlib/smtplib.pyi b/stdlib/smtplib.pyi index 6b3b9bf..9fedd6f 100644 --- a/stdlib/smtplib.pyi +++ b/stdlib/smtplib.pyi @@ -1,14 +1,34 @@ -from _typeshed import Self +import sys +from _socket import _Address as _SourceAddress +from _typeshed import ReadableBuffer, Self, _BufferWithLen +from collections.abc import Sequence from email.message import Message as _Message +from re import Pattern from socket import socket from ssl import SSLContext from types import TracebackType -from typing import Any, Dict, Pattern, Protocol, Sequence, Tuple, Type, Union, overload +from typing import Any, Protocol, overload +from typing_extensions import TypeAlias -_Reply = Tuple[int, bytes] -_SendErrs = Dict[str, _Reply] -# Should match source_address for socket.create_connection -_SourceAddress = Tuple[Union[bytearray, bytes, str], int] +__all__ = [ + "SMTPException", + "SMTPServerDisconnected", + "SMTPResponseException", + "SMTPSenderRefused", + "SMTPRecipientsRefused", + "SMTPDataError", + "SMTPConnectError", + "SMTPHeloError", + "SMTPAuthenticationError", + "quoteaddr", + "quotedata", + "SMTP", + "SMTP_SSL", + "SMTPNotSupportedError", +] + +_Reply: TypeAlias = tuple[int, bytes] +_SendErrs: TypeAlias = dict[str, _Reply] SMTP_PORT: int SMTP_SSL_PORT: int @@ -24,19 +44,18 @@ class SMTPServerDisconnected(SMTPException): ... class SMTPResponseException(SMTPException): smtp_code: int smtp_error: bytes | str - args: Tuple[int, bytes | str] | Tuple[int, bytes, str] + args: tuple[int, bytes | str] | tuple[int, bytes, str] def __init__(self, code: int, msg: bytes | str) -> None: ... class SMTPSenderRefused(SMTPResponseException): - smtp_code: int smtp_error: bytes sender: str - args: Tuple[int, bytes, str] + args: tuple[int, bytes, str] def __init__(self, code: int, msg: bytes, sender: str) -> None: ... class SMTPRecipientsRefused(SMTPException): recipients: _SendErrs - args: Tuple[_SendErrs] + args: tuple[_SendErrs] def __init__(self, recipients: _SendErrs) -> None: ... class SMTPDataError(SMTPResponseException): ... @@ -78,11 +97,11 @@ class SMTP: ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None ) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... def connect(self, host: str = ..., port: int = ..., source_address: _SourceAddress | None = ...) -> _Reply: ... - def send(self, s: bytes | str) -> None: ... + def send(self, s: ReadableBuffer | str) -> None: ... def putcmd(self, cmd: str, args: str = ...) -> None: ... def getreply(self) -> _Reply: ... def docmd(self, cmd: str, args: str = ...) -> _Reply: ... @@ -94,7 +113,7 @@ class SMTP: def noop(self) -> _Reply: ... def mail(self, sender: str, options: Sequence[str] = ...) -> _Reply: ... def rcpt(self, recip: str, options: Sequence[str] = ...) -> _Reply: ... - def data(self, msg: bytes | str) -> _Reply: ... + def data(self, msg: ReadableBuffer | str) -> _Reply: ... def verify(self, address: str) -> _Reply: ... vrfy = verify def expn(self, address: str) -> _Reply: ... @@ -105,16 +124,16 @@ class SMTP: @overload def auth_cram_md5(self, challenge: None = ...) -> None: ... @overload - def auth_cram_md5(self, challenge: bytes) -> str: ... - def auth_plain(self, challenge: bytes | None = ...) -> str: ... - def auth_login(self, challenge: bytes | None = ...) -> str: ... + def auth_cram_md5(self, challenge: ReadableBuffer) -> str: ... + def auth_plain(self, challenge: ReadableBuffer | None = ...) -> str: ... + def auth_login(self, challenge: ReadableBuffer | None = ...) -> str: ... def login(self, user: str, password: str, *, initial_response_ok: bool = ...) -> _Reply: ... def starttls(self, keyfile: str | None = ..., certfile: str | None = ..., context: SSLContext | None = ...) -> _Reply: ... def sendmail( self, from_addr: str, to_addrs: str | Sequence[str], - msg: bytes | str, + msg: _BufferWithLen | str, mail_options: Sequence[str] = ..., rcpt_options: Sequence[str] = ..., ) -> _SendErrs: ... @@ -130,7 +149,6 @@ class SMTP: def quit(self) -> _Reply: ... class SMTP_SSL(SMTP): - default_port: int keyfile: str | None certfile: str | None context: SSLContext @@ -149,6 +167,16 @@ class SMTP_SSL(SMTP): LMTP_PORT: int class LMTP(SMTP): - def __init__( - self, host: str = ..., port: int = ..., local_hostname: str | None = ..., source_address: _SourceAddress | None = ... - ) -> None: ... + if sys.version_info >= (3, 9): + def __init__( + self, + host: str = ..., + port: int = ..., + local_hostname: str | None = ..., + source_address: _SourceAddress | None = ..., + timeout: float = ..., + ) -> None: ... + else: + def __init__( + self, host: str = ..., port: int = ..., local_hostname: str | None = ..., source_address: _SourceAddress | None = ... + ) -> None: ... diff --git a/stdlib/sndhdr.pyi b/stdlib/sndhdr.pyi index 84d6441..f4d4876 100644 --- a/stdlib/sndhdr.pyi +++ b/stdlib/sndhdr.pyi @@ -1,6 +1,8 @@ from _typeshed import StrOrBytesPath from typing import NamedTuple +__all__ = ["what", "whathdr"] + class SndHeaders(NamedTuple): filetype: str framerate: int diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index f721153..678bdaf 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -1,34 +1,19 @@ -import sys -from _typeshed import ReadableBuffer, Self, WriteableBuffer -from collections.abc import Iterable -from enum import IntEnum, IntFlag -from io import RawIOBase -from typing import Any, BinaryIO, TextIO, TypeVar, overload -from typing_extensions import Literal - # Ideally, we'd just do "from _socket import *". Unfortunately, socket # overrides some definitions from _socket incompatibly. mypy incorrectly # prefers the definitions from _socket over those defined here. import _socket +import sys from _socket import ( _FD, - CMSG_LEN as CMSG_LEN, - CMSG_SPACE as CMSG_SPACE, - EAI_ADDRFAMILY as EAI_ADDRFAMILY, EAI_AGAIN as EAI_AGAIN, EAI_BADFLAGS as EAI_BADFLAGS, - EAI_BADHINTS as EAI_BADHINTS, EAI_FAIL as EAI_FAIL, EAI_FAMILY as EAI_FAMILY, - EAI_MAX as EAI_MAX, EAI_MEMORY as EAI_MEMORY, EAI_NODATA as EAI_NODATA, EAI_NONAME as EAI_NONAME, - EAI_OVERFLOW as EAI_OVERFLOW, - EAI_PROTOCOL as EAI_PROTOCOL, EAI_SERVICE as EAI_SERVICE, EAI_SOCKTYPE as EAI_SOCKTYPE, - EAI_SYSTEM as EAI_SYSTEM, INADDR_ALLHOSTS_GROUP as INADDR_ALLHOSTS_GROUP, INADDR_ANY as INADDR_ANY, INADDR_BROADCAST as INADDR_BROADCAST, @@ -37,88 +22,32 @@ from _socket import ( INADDR_NONE as INADDR_NONE, INADDR_UNSPEC_GROUP as INADDR_UNSPEC_GROUP, IP_ADD_MEMBERSHIP as IP_ADD_MEMBERSHIP, - IP_DEFAULT_MULTICAST_LOOP as IP_DEFAULT_MULTICAST_LOOP, - IP_DEFAULT_MULTICAST_TTL as IP_DEFAULT_MULTICAST_TTL, IP_DROP_MEMBERSHIP as IP_DROP_MEMBERSHIP, IP_HDRINCL as IP_HDRINCL, - IP_MAX_MEMBERSHIPS as IP_MAX_MEMBERSHIPS, IP_MULTICAST_IF as IP_MULTICAST_IF, IP_MULTICAST_LOOP as IP_MULTICAST_LOOP, IP_MULTICAST_TTL as IP_MULTICAST_TTL, IP_OPTIONS as IP_OPTIONS, IP_RECVDSTADDR as IP_RECVDSTADDR, - IP_RECVOPTS as IP_RECVOPTS, - IP_RECVRETOPTS as IP_RECVRETOPTS, - IP_RETOPTS as IP_RETOPTS, IP_TOS as IP_TOS, - IP_TRANSPARENT as IP_TRANSPARENT, IP_TTL as IP_TTL, IPPORT_RESERVED as IPPORT_RESERVED, IPPORT_USERRESERVED as IPPORT_USERRESERVED, - IPPROTO_AH as IPPROTO_AH, - IPPROTO_BIP as IPPROTO_BIP, - IPPROTO_DSTOPTS as IPPROTO_DSTOPTS, - IPPROTO_EGP as IPPROTO_EGP, - IPPROTO_EON as IPPROTO_EON, - IPPROTO_ESP as IPPROTO_ESP, - IPPROTO_FRAGMENT as IPPROTO_FRAGMENT, - IPPROTO_GGP as IPPROTO_GGP, - IPPROTO_GRE as IPPROTO_GRE, - IPPROTO_HELLO as IPPROTO_HELLO, - IPPROTO_HOPOPTS as IPPROTO_HOPOPTS, IPPROTO_ICMP as IPPROTO_ICMP, - IPPROTO_ICMPV6 as IPPROTO_ICMPV6, - IPPROTO_IDP as IPPROTO_IDP, - IPPROTO_IGMP as IPPROTO_IGMP, IPPROTO_IP as IPPROTO_IP, - IPPROTO_IPCOMP as IPPROTO_IPCOMP, - IPPROTO_IPIP as IPPROTO_IPIP, - IPPROTO_IPV4 as IPPROTO_IPV4, - IPPROTO_IPV6 as IPPROTO_IPV6, - IPPROTO_MAX as IPPROTO_MAX, - IPPROTO_MOBILE as IPPROTO_MOBILE, - IPPROTO_ND as IPPROTO_ND, - IPPROTO_NONE as IPPROTO_NONE, - IPPROTO_PIM as IPPROTO_PIM, - IPPROTO_PUP as IPPROTO_PUP, IPPROTO_RAW as IPPROTO_RAW, - IPPROTO_ROUTING as IPPROTO_ROUTING, - IPPROTO_RSVP as IPPROTO_RSVP, - IPPROTO_SCTP as IPPROTO_SCTP, IPPROTO_TCP as IPPROTO_TCP, - IPPROTO_TP as IPPROTO_TP, IPPROTO_UDP as IPPROTO_UDP, - IPPROTO_VRRP as IPPROTO_VRRP, - IPPROTO_XTP as IPPROTO_XTP, IPV6_CHECKSUM as IPV6_CHECKSUM, - IPV6_DONTFRAG as IPV6_DONTFRAG, - IPV6_DSTOPTS as IPV6_DSTOPTS, - IPV6_HOPLIMIT as IPV6_HOPLIMIT, - IPV6_HOPOPTS as IPV6_HOPOPTS, IPV6_JOIN_GROUP as IPV6_JOIN_GROUP, IPV6_LEAVE_GROUP as IPV6_LEAVE_GROUP, IPV6_MULTICAST_HOPS as IPV6_MULTICAST_HOPS, IPV6_MULTICAST_IF as IPV6_MULTICAST_IF, IPV6_MULTICAST_LOOP as IPV6_MULTICAST_LOOP, - IPV6_NEXTHOP as IPV6_NEXTHOP, - IPV6_PATHMTU as IPV6_PATHMTU, - IPV6_PKTINFO as IPV6_PKTINFO, - IPV6_RECVDSTOPTS as IPV6_RECVDSTOPTS, - IPV6_RECVHOPLIMIT as IPV6_RECVHOPLIMIT, - IPV6_RECVHOPOPTS as IPV6_RECVHOPOPTS, - IPV6_RECVPATHMTU as IPV6_RECVPATHMTU, - IPV6_RECVPKTINFO as IPV6_RECVPKTINFO, - IPV6_RECVRTHDR as IPV6_RECVRTHDR, IPV6_RECVTCLASS as IPV6_RECVTCLASS, - IPV6_RTHDR as IPV6_RTHDR, - IPV6_RTHDR_TYPE_0 as IPV6_RTHDR_TYPE_0, - IPV6_RTHDRDSTOPTS as IPV6_RTHDRDSTOPTS, IPV6_TCLASS as IPV6_TCLASS, IPV6_UNICAST_HOPS as IPV6_UNICAST_HOPS, - IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU, IPV6_V6ONLY as IPV6_V6ONLY, - IPX_TYPE as IPX_TYPE, - LOCAL_PEERCRED as LOCAL_PEERCRED, NI_DGRAM as NI_DGRAM, NI_MAXHOST as NI_MAXHOST, NI_MAXSERV as NI_MAXSERV, @@ -126,61 +55,35 @@ from _socket import ( NI_NOFQDN as NI_NOFQDN, NI_NUMERICHOST as NI_NUMERICHOST, NI_NUMERICSERV as NI_NUMERICSERV, - SCM_CREDENTIALS as SCM_CREDENTIALS, - SCM_CREDS as SCM_CREDS, - SCM_RIGHTS as SCM_RIGHTS, SHUT_RD as SHUT_RD, SHUT_RDWR as SHUT_RDWR, SHUT_WR as SHUT_WR, SO_ACCEPTCONN as SO_ACCEPTCONN, - SO_BINDTODEVICE as SO_BINDTODEVICE, SO_BROADCAST as SO_BROADCAST, SO_DEBUG as SO_DEBUG, SO_DONTROUTE as SO_DONTROUTE, SO_ERROR as SO_ERROR, - SO_EXCLUSIVEADDRUSE as SO_EXCLUSIVEADDRUSE, SO_KEEPALIVE as SO_KEEPALIVE, SO_LINGER as SO_LINGER, - SO_MARK as SO_MARK, SO_OOBINLINE as SO_OOBINLINE, - SO_PASSCRED as SO_PASSCRED, - SO_PEERCRED as SO_PEERCRED, - SO_PRIORITY as SO_PRIORITY, SO_RCVBUF as SO_RCVBUF, SO_RCVLOWAT as SO_RCVLOWAT, SO_RCVTIMEO as SO_RCVTIMEO, SO_REUSEADDR as SO_REUSEADDR, - SO_REUSEPORT as SO_REUSEPORT, - SO_SETFIB as SO_SETFIB, SO_SNDBUF as SO_SNDBUF, SO_SNDLOWAT as SO_SNDLOWAT, SO_SNDTIMEO as SO_SNDTIMEO, SO_TYPE as SO_TYPE, SO_USELOOPBACK as SO_USELOOPBACK, - SOL_ATALK as SOL_ATALK, - SOL_AX25 as SOL_AX25, - SOL_HCI as SOL_HCI, SOL_IP as SOL_IP, - SOL_IPX as SOL_IPX, - SOL_NETROM as SOL_NETROM, - SOL_ROSE as SOL_ROSE, SOL_SOCKET as SOL_SOCKET, SOL_TCP as SOL_TCP, SOL_UDP as SOL_UDP, SOMAXCONN as SOMAXCONN, - TCP_CORK as TCP_CORK, - TCP_DEFER_ACCEPT as TCP_DEFER_ACCEPT, TCP_FASTOPEN as TCP_FASTOPEN, - TCP_INFO as TCP_INFO, TCP_KEEPCNT as TCP_KEEPCNT, - TCP_KEEPIDLE as TCP_KEEPIDLE, - TCP_KEEPINTVL as TCP_KEEPINTVL, - TCP_LINGER2 as TCP_LINGER2, TCP_MAXSEG as TCP_MAXSEG, TCP_NODELAY as TCP_NODELAY, - TCP_QUICKACK as TCP_QUICKACK, - TCP_SYNCNT as TCP_SYNCNT, - TCP_WINDOW_CLAMP as TCP_WINDOW_CLAMP, SocketType as SocketType, _Address as _Address, _RetAddress as _RetAddress, @@ -209,13 +112,153 @@ from _socket import ( setdefaulttimeout as setdefaulttimeout, timeout as timeout, ) +from _typeshed import ReadableBuffer, Self, WriteableBuffer +from collections.abc import Iterable +from enum import IntEnum, IntFlag +from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper +from typing import Any, Protocol, overload +from typing_extensions import Literal + +if sys.platform != "darwin" or sys.version_info >= (3, 9): + from _socket import ( + IPV6_DONTFRAG as IPV6_DONTFRAG, + IPV6_HOPLIMIT as IPV6_HOPLIMIT, + IPV6_HOPOPTS as IPV6_HOPOPTS, + IPV6_PKTINFO as IPV6_PKTINFO, + IPV6_RECVRTHDR as IPV6_RECVRTHDR, + IPV6_RTHDR as IPV6_RTHDR, + ) + +if sys.platform != "darwin": + from _socket import SO_EXCLUSIVEADDRUSE as SO_EXCLUSIVEADDRUSE + +if sys.version_info >= (3, 10): + from _socket import IP_RECVTOS as IP_RECVTOS +elif sys.platform != "darwin" and sys.platform != "win32": + from _socket import IP_RECVTOS as IP_RECVTOS + +from _socket import TCP_KEEPINTVL as TCP_KEEPINTVL, close as close + +if sys.platform != "darwin": + from _socket import TCP_KEEPIDLE as TCP_KEEPIDLE -if sys.version_info >= (3, 7): - from _socket import close as close +if sys.platform != "win32" or sys.version_info >= (3, 8): + from _socket import ( + IPPROTO_AH as IPPROTO_AH, + IPPROTO_DSTOPTS as IPPROTO_DSTOPTS, + IPPROTO_EGP as IPPROTO_EGP, + IPPROTO_ESP as IPPROTO_ESP, + IPPROTO_FRAGMENT as IPPROTO_FRAGMENT, + IPPROTO_GGP as IPPROTO_GGP, + IPPROTO_HOPOPTS as IPPROTO_HOPOPTS, + IPPROTO_ICMPV6 as IPPROTO_ICMPV6, + IPPROTO_IDP as IPPROTO_IDP, + IPPROTO_IGMP as IPPROTO_IGMP, + IPPROTO_IPV4 as IPPROTO_IPV4, + IPPROTO_IPV6 as IPPROTO_IPV6, + IPPROTO_MAX as IPPROTO_MAX, + IPPROTO_ND as IPPROTO_ND, + IPPROTO_NONE as IPPROTO_NONE, + IPPROTO_PIM as IPPROTO_PIM, + IPPROTO_PUP as IPPROTO_PUP, + IPPROTO_ROUTING as IPPROTO_ROUTING, + IPPROTO_SCTP as IPPROTO_SCTP, + ) + + if sys.platform != "darwin": + from _socket import ( + IPPROTO_CBT as IPPROTO_CBT, + IPPROTO_ICLFXBM as IPPROTO_ICLFXBM, + IPPROTO_IGP as IPPROTO_IGP, + IPPROTO_L2TP as IPPROTO_L2TP, + IPPROTO_PGM as IPPROTO_PGM, + IPPROTO_RDP as IPPROTO_RDP, + IPPROTO_ST as IPPROTO_ST, + ) +if sys.platform != "win32" and sys.platform != "darwin": + from _socket import ( + IP_TRANSPARENT as IP_TRANSPARENT, + IPPROTO_BIP as IPPROTO_BIP, + IPPROTO_MOBILE as IPPROTO_MOBILE, + IPPROTO_VRRP as IPPROTO_VRRP, + IPX_TYPE as IPX_TYPE, + SCM_CREDENTIALS as SCM_CREDENTIALS, + SO_BINDTODEVICE as SO_BINDTODEVICE, + SO_MARK as SO_MARK, + SO_PASSCRED as SO_PASSCRED, + SO_PEERCRED as SO_PEERCRED, + SO_PRIORITY as SO_PRIORITY, + SO_SETFIB as SO_SETFIB, + SOL_ATALK as SOL_ATALK, + SOL_AX25 as SOL_AX25, + SOL_HCI as SOL_HCI, + SOL_IPX as SOL_IPX, + SOL_NETROM as SOL_NETROM, + SOL_ROSE as SOL_ROSE, + TCP_CORK as TCP_CORK, + TCP_DEFER_ACCEPT as TCP_DEFER_ACCEPT, + TCP_INFO as TCP_INFO, + TCP_LINGER2 as TCP_LINGER2, + TCP_QUICKACK as TCP_QUICKACK, + TCP_SYNCNT as TCP_SYNCNT, + TCP_WINDOW_CLAMP as TCP_WINDOW_CLAMP, + ) if sys.platform != "win32": - from _socket import sethostname as sethostname + from _socket import ( + CMSG_LEN as CMSG_LEN, + CMSG_SPACE as CMSG_SPACE, + EAI_ADDRFAMILY as EAI_ADDRFAMILY, + EAI_BADHINTS as EAI_BADHINTS, + EAI_MAX as EAI_MAX, + EAI_OVERFLOW as EAI_OVERFLOW, + EAI_PROTOCOL as EAI_PROTOCOL, + EAI_SYSTEM as EAI_SYSTEM, + IP_DEFAULT_MULTICAST_LOOP as IP_DEFAULT_MULTICAST_LOOP, + IP_DEFAULT_MULTICAST_TTL as IP_DEFAULT_MULTICAST_TTL, + IP_MAX_MEMBERSHIPS as IP_MAX_MEMBERSHIPS, + IP_RECVOPTS as IP_RECVOPTS, + IP_RECVRETOPTS as IP_RECVRETOPTS, + IP_RETOPTS as IP_RETOPTS, + IPPROTO_EON as IPPROTO_EON, + IPPROTO_GRE as IPPROTO_GRE, + IPPROTO_HELLO as IPPROTO_HELLO, + IPPROTO_IPCOMP as IPPROTO_IPCOMP, + IPPROTO_IPIP as IPPROTO_IPIP, + IPPROTO_RSVP as IPPROTO_RSVP, + IPPROTO_TP as IPPROTO_TP, + IPPROTO_XTP as IPPROTO_XTP, + IPV6_RTHDR_TYPE_0 as IPV6_RTHDR_TYPE_0, + LOCAL_PEERCRED as LOCAL_PEERCRED, + SCM_CREDS as SCM_CREDS, + SCM_RIGHTS as SCM_RIGHTS, + SO_REUSEPORT as SO_REUSEPORT, + sethostname as sethostname, + ) + + if sys.platform != "darwin" or sys.version_info >= (3, 9): + from _socket import ( + IPV6_DSTOPTS as IPV6_DSTOPTS, + IPV6_NEXTHOP as IPV6_NEXTHOP, + IPV6_PATHMTU as IPV6_PATHMTU, + IPV6_RECVDSTOPTS as IPV6_RECVDSTOPTS, + IPV6_RECVHOPLIMIT as IPV6_RECVHOPLIMIT, + IPV6_RECVHOPOPTS as IPV6_RECVHOPOPTS, + IPV6_RECVPATHMTU as IPV6_RECVPATHMTU, + IPV6_RECVPKTINFO as IPV6_RECVPKTINFO, + IPV6_RTHDRDSTOPTS as IPV6_RTHDRDSTOPTS, + IPV6_USE_MIN_MTU as IPV6_USE_MIN_MTU, + ) + if sys.platform != "win32" or sys.version_info >= (3, 8): from _socket import if_indextoname as if_indextoname, if_nameindex as if_nameindex, if_nametoindex as if_nametoindex + +if sys.platform != "darwin": + if sys.platform != "win32" or sys.version_info >= (3, 9): + from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM + +if sys.platform == "darwin" and sys.version_info >= (3, 10): + from _socket import TCP_KEEPALIVE as TCP_KEEPALIVE + if sys.platform == "linux": from _socket import ( ALG_OP_DECRYPT as ALG_OP_DECRYPT, @@ -253,6 +296,20 @@ if sys.platform == "linux": CAN_RAW_RECV_OWN_MSGS as CAN_RAW_RECV_OWN_MSGS, CAN_RTR_FLAG as CAN_RTR_FLAG, CAN_SFF_MASK as CAN_SFF_MASK, + NETLINK_ARPD as NETLINK_ARPD, + NETLINK_CRYPTO as NETLINK_CRYPTO, + NETLINK_DNRTMSG as NETLINK_DNRTMSG, + NETLINK_FIREWALL as NETLINK_FIREWALL, + NETLINK_IP6_FW as NETLINK_IP6_FW, + NETLINK_NFLOG as NETLINK_NFLOG, + NETLINK_ROUTE as NETLINK_ROUTE, + NETLINK_ROUTE6 as NETLINK_ROUTE6, + NETLINK_SKIP as NETLINK_SKIP, + NETLINK_TAPBASE as NETLINK_TAPBASE, + NETLINK_TCPDIAG as NETLINK_TCPDIAG, + NETLINK_USERSOCK as NETLINK_USERSOCK, + NETLINK_W1 as NETLINK_W1, + NETLINK_XFRM as NETLINK_XFRM, PACKET_BROADCAST as PACKET_BROADCAST, PACKET_FASTROUTE as PACKET_FASTROUTE, PACKET_HOST as PACKET_HOST, @@ -310,19 +367,20 @@ if sys.platform == "linux": TIPC_WITHDRAWN as TIPC_WITHDRAWN, TIPC_ZONE_SCOPE as TIPC_ZONE_SCOPE, ) -if sys.platform == "linux" and sys.version_info >= (3, 7): +if sys.platform == "linux": from _socket import ( CAN_ISOTP as CAN_ISOTP, IOCTL_VM_SOCKETS_GET_LOCAL_CID as IOCTL_VM_SOCKETS_GET_LOCAL_CID, SO_VM_SOCKETS_BUFFER_MAX_SIZE as SO_VM_SOCKETS_BUFFER_MAX_SIZE, SO_VM_SOCKETS_BUFFER_MIN_SIZE as SO_VM_SOCKETS_BUFFER_MIN_SIZE, SO_VM_SOCKETS_BUFFER_SIZE as SO_VM_SOCKETS_BUFFER_SIZE, - TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT, VM_SOCKETS_INVALID_VERSION as VM_SOCKETS_INVALID_VERSION, VMADDR_CID_ANY as VMADDR_CID_ANY, VMADDR_CID_HOST as VMADDR_CID_HOST, VMADDR_PORT_ANY as VMADDR_PORT_ANY, ) +if sys.platform != "win32": + from _socket import TCP_NOTSENT_LOWAT as TCP_NOTSENT_LOWAT if sys.platform == "linux" and sys.version_info >= (3, 8): from _socket import ( CAN_BCM_CAN_FD_FRAME as CAN_BCM_CAN_FD_FRAME, @@ -341,6 +399,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 8): if sys.platform == "linux" and sys.version_info >= (3, 9): from _socket import ( CAN_J1939 as CAN_J1939, + CAN_RAW_JOIN_FILTERS as CAN_RAW_JOIN_FILTERS, J1939_EE_INFO_NONE as J1939_EE_INFO_NONE, J1939_EE_INFO_TX_ABORT as J1939_EE_INFO_TX_ABORT, J1939_FILTER_MAX as J1939_FILTER_MAX, @@ -365,9 +424,12 @@ if sys.platform == "linux" and sys.version_info >= (3, 9): SO_J1939_PROMISC as SO_J1939_PROMISC, SO_J1939_SEND_PRIO as SO_J1939_SEND_PRIO, ) +if sys.platform == "linux" and sys.version_info >= (3, 10): + from _socket import IPPROTO_MPTCP as IPPROTO_MPTCP +if sys.platform == "linux" and sys.version_info >= (3, 11): + from _socket import SO_INCOMING_CPU as SO_INCOMING_CPU if sys.platform == "win32": from _socket import ( - RCVALL_IPLEVEL as RCVALL_IPLEVEL, RCVALL_MAX as RCVALL_MAX, RCVALL_OFF as RCVALL_OFF, RCVALL_ON as RCVALL_ON, @@ -377,93 +439,106 @@ if sys.platform == "win32": SIO_RCVALL as SIO_RCVALL, ) -_T = TypeVar("_T") - # Re-exported from errno EBADF: int EAGAIN: int EWOULDBLOCK: int class AddressFamily(IntEnum): - AF_UNIX: int AF_INET: int AF_INET6: int - AF_AAL5: int - AF_ALG: int AF_APPLETALK: int - AF_ASH: int - AF_ATMPVC: int - AF_ATMSVC: int - AF_AX25: int - AF_BLUETOOTH: int - AF_BRIDGE: int - AF_CAN: int AF_DECnet: int - AF_ECONET: int AF_IPX: int - AF_IRDA: int - AF_KEY: int - AF_LINK: int - AF_LLC: int - AF_NETBEUI: int - AF_NETLINK: int - AF_NETROM: int - AF_PACKET: int - AF_PPPOX: int - AF_QIPCRTR: int - AF_RDS: int - AF_ROSE: int - AF_ROUTE: int - AF_SECURITY: int AF_SNA: int - AF_SYSTEM: int - AF_TIPC: int AF_UNSPEC: int - AF_VSOCK: int - AF_WANPIPE: int - AF_X25: int - -AF_UNIX: AddressFamily -AF_INET: AddressFamily -AF_INET6: AddressFamily -AF_AAL5: AddressFamily -AF_APPLETALK: AddressFamily -AF_ASH: AddressFamily -AF_ATMPVC: AddressFamily -AF_ATMSVC: AddressFamily -AF_AX25: AddressFamily -AF_BRIDGE: AddressFamily -AF_DECnet: AddressFamily -AF_ECONET: AddressFamily -AF_IPX: AddressFamily -AF_IRDA: AddressFamily -AF_KEY: AddressFamily -AF_LLC: AddressFamily -AF_NETBEUI: AddressFamily -AF_NETROM: AddressFamily -AF_PPPOX: AddressFamily -AF_ROSE: AddressFamily -AF_ROUTE: AddressFamily -AF_SECURITY: AddressFamily -AF_SNA: AddressFamily -AF_SYSTEM: AddressFamily -AF_UNSPEC: AddressFamily -AF_WANPIPE: AddressFamily -AF_X25: AddressFamily + if sys.platform != "darwin": + AF_IRDA: int + if sys.platform != "win32": + AF_ROUTE: int + AF_SYSTEM: int + AF_UNIX: int + if sys.platform != "darwin" and sys.platform != "win32": + AF_AAL5: int + AF_ASH: int + AF_ATMPVC: int + AF_ATMSVC: int + AF_AX25: int + AF_BRIDGE: int + AF_ECONET: int + AF_KEY: int + AF_LLC: int + AF_NETBEUI: int + AF_NETROM: int + AF_PPPOX: int + AF_ROSE: int + AF_SECURITY: int + AF_WANPIPE: int + AF_X25: int + if sys.platform == "linux": + AF_CAN: int + AF_PACKET: int + AF_RDS: int + AF_TIPC: int + AF_ALG: int + AF_NETLINK: int + AF_VSOCK: int + if sys.version_info >= (3, 8): + AF_QIPCRTR: int + if sys.platform != "win32" or sys.version_info >= (3, 9): + AF_LINK: int + if sys.platform != "darwin": + AF_BLUETOOTH: int + +AF_INET = AddressFamily.AF_INET +AF_INET6 = AddressFamily.AF_INET6 +AF_APPLETALK = AddressFamily.AF_APPLETALK +AF_DECnet = AddressFamily.AF_DECnet +AF_IPX = AddressFamily.AF_IPX +AF_SNA = AddressFamily.AF_SNA +AF_UNSPEC = AddressFamily.AF_UNSPEC + +if sys.platform != "darwin": + AF_IRDA = AddressFamily.AF_IRDA + +if sys.platform != "win32": + AF_ROUTE = AddressFamily.AF_ROUTE + AF_SYSTEM = AddressFamily.AF_SYSTEM + AF_UNIX = AddressFamily.AF_UNIX + +if sys.platform != "win32" and sys.platform != "darwin": + AF_AAL5 = AddressFamily.AF_AAL5 + AF_ASH = AddressFamily.AF_ASH + AF_ATMPVC = AddressFamily.AF_ATMPVC + AF_ATMSVC = AddressFamily.AF_ATMSVC + AF_AX25 = AddressFamily.AF_AX25 + AF_BRIDGE = AddressFamily.AF_BRIDGE + AF_ECONET = AddressFamily.AF_ECONET + AF_KEY = AddressFamily.AF_KEY + AF_LLC = AddressFamily.AF_LLC + AF_NETBEUI = AddressFamily.AF_NETBEUI + AF_NETROM = AddressFamily.AF_NETROM + AF_PPPOX = AddressFamily.AF_PPPOX + AF_ROSE = AddressFamily.AF_ROSE + AF_SECURITY = AddressFamily.AF_SECURITY + AF_WANPIPE = AddressFamily.AF_WANPIPE + AF_X25 = AddressFamily.AF_X25 + if sys.platform == "linux": - AF_CAN: AddressFamily - AF_PACKET: AddressFamily - AF_RDS: AddressFamily - AF_TIPC: AddressFamily - AF_ALG: AddressFamily - AF_NETLINK: AddressFamily - if sys.version_info >= (3, 7): - AF_VSOCK: AddressFamily + AF_CAN = AddressFamily.AF_CAN + AF_PACKET = AddressFamily.AF_PACKET + AF_RDS = AddressFamily.AF_RDS + AF_TIPC = AddressFamily.AF_TIPC + AF_ALG = AddressFamily.AF_ALG + AF_NETLINK = AddressFamily.AF_NETLINK + AF_VSOCK = AddressFamily.AF_VSOCK if sys.version_info >= (3, 8): - AF_QIPCRTR: AddressFamily -AF_LINK: AddressFamily # availability: BSD, macOS -if sys.platform != "win32" and sys.platform != "darwin": - AF_BLUETOOTH: AddressFamily + AF_QIPCRTR = AddressFamily.AF_QIPCRTR + +if sys.platform != "win32" or sys.version_info >= (3, 9): + AF_LINK = AddressFamily.AF_LINK + if sys.platform != "darwin": + AF_BLUETOOTH = AddressFamily.AF_BLUETOOTH class SocketKind(IntEnum): SOCK_STREAM: int @@ -471,48 +546,73 @@ class SocketKind(IntEnum): SOCK_RAW: int SOCK_RDM: int SOCK_SEQPACKET: int - SOCK_CLOEXEC: int - SOCK_NONBLOCK: int - -SOCK_STREAM: SocketKind -SOCK_DGRAM: SocketKind -SOCK_RAW: SocketKind -SOCK_RDM: SocketKind -SOCK_SEQPACKET: SocketKind + if sys.platform == "linux": + SOCK_CLOEXEC: int + SOCK_NONBLOCK: int + +SOCK_STREAM = SocketKind.SOCK_STREAM +SOCK_DGRAM = SocketKind.SOCK_DGRAM +SOCK_RAW = SocketKind.SOCK_RAW +SOCK_RDM = SocketKind.SOCK_RDM +SOCK_SEQPACKET = SocketKind.SOCK_SEQPACKET if sys.platform == "linux": - SOCK_CLOEXEC: SocketKind - SOCK_NONBLOCK: SocketKind + SOCK_CLOEXEC = SocketKind.SOCK_CLOEXEC + SOCK_NONBLOCK = SocketKind.SOCK_NONBLOCK class MsgFlag(IntFlag): MSG_CTRUNC: int MSG_DONTROUTE: int - MSG_DONTWAIT: int - MSG_EOR: int MSG_OOB: int MSG_PEEK: int MSG_TRUNC: int MSG_WAITALL: int -MSG_BCAST: MsgFlag -MSG_BTAG: MsgFlag -MSG_CMSG_CLOEXEC: MsgFlag -MSG_CONFIRM: MsgFlag -MSG_CTRUNC: MsgFlag -MSG_DONTROUTE: MsgFlag -MSG_DONTWAIT: MsgFlag -MSG_EOF: MsgFlag -MSG_EOR: MsgFlag -MSG_ERRQUEUE: MsgFlag -MSG_ETAG: MsgFlag -MSG_FASTOPEN: MsgFlag -MSG_MCAST: MsgFlag -MSG_MORE: MsgFlag -MSG_NOSIGNAL: MsgFlag -MSG_NOTIFICATION: MsgFlag -MSG_OOB: MsgFlag -MSG_PEEK: MsgFlag -MSG_TRUNC: MsgFlag -MSG_WAITALL: MsgFlag + if sys.platform != "darwin": + MSG_BCAST: int + MSG_MCAST: int + MSG_ERRQUEUE: int + + if sys.platform != "win32" and sys.platform != "darwin": + MSG_BTAG: int + MSG_CMSG_CLOEXEC: int + MSG_CONFIRM: int + MSG_ETAG: int + MSG_FASTOPEN: int + MSG_MORE: int + MSG_NOTIFICATION: int + + if sys.platform != "win32": + MSG_DONTWAIT: int + MSG_EOF: int + MSG_EOR: int + MSG_NOSIGNAL: int # sometimes this exists on darwin, sometimes not + +MSG_CTRUNC = MsgFlag.MSG_CTRUNC +MSG_DONTROUTE = MsgFlag.MSG_DONTROUTE +MSG_OOB = MsgFlag.MSG_OOB +MSG_PEEK = MsgFlag.MSG_PEEK +MSG_TRUNC = MsgFlag.MSG_TRUNC +MSG_WAITALL = MsgFlag.MSG_WAITALL + +if sys.platform != "darwin": + MSG_BCAST = MsgFlag.MSG_BCAST + MSG_MCAST = MsgFlag.MSG_MCAST + MSG_ERRQUEUE = MsgFlag.MSG_ERRQUEUE + +if sys.platform != "win32": + MSG_DONTWAIT = MsgFlag.MSG_DONTWAIT + MSG_EOF = MsgFlag.MSG_EOF + MSG_EOR = MsgFlag.MSG_EOR + MSG_NOSIGNAL = MsgFlag.MSG_NOSIGNAL # Sometimes this exists on darwin, sometimes not + +if sys.platform != "win32" and sys.platform != "darwin": + MSG_BTAG = MsgFlag.MSG_BTAG + MSG_CMSG_CLOEXEC = MsgFlag.MSG_CMSG_CLOEXEC + MSG_CONFIRM = MsgFlag.MSG_CONFIRM + MSG_ETAG = MsgFlag.MSG_ETAG + MSG_FASTOPEN = MsgFlag.MSG_FASTOPEN + MSG_MORE = MsgFlag.MSG_MORE + MSG_NOTIFICATION = MsgFlag.MSG_NOTIFICATION class AddressInfo(IntFlag): AI_ADDRCONFIG: int @@ -522,56 +622,112 @@ class AddressInfo(IntFlag): AI_NUMERICSERV: int AI_PASSIVE: int AI_V4MAPPED: int + if sys.platform != "win32": + AI_DEFAULT: int + AI_MASK: int + AI_V4MAPPED_CFG: int -AI_ADDRCONFIG: AddressInfo -AI_ALL: AddressInfo -AI_CANONNAME: AddressInfo -AI_DEFAULT: AddressInfo -AI_MASK: AddressInfo -AI_NUMERICHOST: AddressInfo -AI_NUMERICSERV: AddressInfo -AI_PASSIVE: AddressInfo -AI_V4MAPPED: AddressInfo -AI_V4MAPPED_CFG: AddressInfo +AI_ADDRCONFIG = AddressInfo.AI_ADDRCONFIG +AI_ALL = AddressInfo.AI_ALL +AI_CANONNAME = AddressInfo.AI_CANONNAME +AI_NUMERICHOST = AddressInfo.AI_NUMERICHOST +AI_NUMERICSERV = AddressInfo.AI_NUMERICSERV +AI_PASSIVE = AddressInfo.AI_PASSIVE +AI_V4MAPPED = AddressInfo.AI_V4MAPPED + +if sys.platform != "win32": + AI_DEFAULT = AddressInfo.AI_DEFAULT + AI_MASK = AddressInfo.AI_MASK + AI_V4MAPPED_CFG = AddressInfo.AI_V4MAPPED_CFG if sys.platform == "win32": errorTab: dict[int, str] # undocumented +class _SendableFile(Protocol): + def read(self, __size: int) -> bytes: ... + def seek(self, __offset: int) -> object: ... + + # optional fields: + # + # @property + # def mode(self) -> str: ... + # def fileno(self) -> int: ... + class socket(_socket.socket): def __init__( self, family: AddressFamily | int = ..., type: SocketKind | int = ..., proto: int = ..., fileno: int | None = ... ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, *args: object) -> None: ... - def dup(self: _T) -> _T: ... # noqa: F811 + def dup(self: Self) -> Self: ... # noqa: F811 def accept(self) -> tuple[socket, _RetAddress]: ... # Note that the makefile's documented windows-specific behavior is not represented # mode strings with duplicates are intentionally excluded @overload + def makefile( # type: ignore[misc] + self, + mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], + buffering: Literal[0], + *, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., + ) -> SocketIO: ... + @overload def makefile( self, - mode: Literal["r", "w", "rw", "wr", ""] = ..., - buffering: int | None = ..., + mode: Literal["rwb", "rbw", "wrb", "wbr", "brw", "bwr"], + buffering: Literal[-1, 1] | None = ..., *, encoding: str | None = ..., errors: str | None = ..., newline: str | None = ..., - ) -> TextIO: ... + ) -> BufferedRWPair: ... + @overload + def makefile( + self, + mode: Literal["rb", "br"], + buffering: Literal[-1, 1] | None = ..., + *, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., + ) -> BufferedReader: ... + @overload + def makefile( + self, + mode: Literal["wb", "bw"], + buffering: Literal[-1, 1] | None = ..., + *, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., + ) -> BufferedWriter: ... @overload def makefile( self, mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], + buffering: int, + *, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., + ) -> IOBase: ... + @overload + def makefile( + self, + mode: Literal["r", "w", "rw", "wr", ""] = ..., buffering: int | None = ..., *, encoding: str | None = ..., errors: str | None = ..., newline: str | None = ..., - ) -> BinaryIO: ... - def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ... + ) -> TextIOWrapper: ... + def sendfile(self, file: _SendableFile, offset: int = ..., count: int | None = ...) -> int: ... @property - def family(self) -> AddressFamily: ... # type: ignore + def family(self) -> AddressFamily: ... # type: ignore[override] @property - def type(self) -> SocketKind: ... # type: ignore + def type(self) -> SocketKind: ... # type: ignore[override] def get_inheritable(self) -> bool: ... def set_inheritable(self, inheritable: bool) -> None: ... @@ -581,7 +737,7 @@ if sys.platform != "win32": if sys.version_info >= (3, 9): # flags and address appear to be unused in send_fds and recv_fds def send_fds( - sock: socket, buffers: Iterable[bytes], fds: bytes | Iterable[int], flags: int = ..., address: None = ... + sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: int = ..., address: None = ... ) -> int: ... def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = ...) -> tuple[bytes, list[int], int, Any]: ... @@ -592,7 +748,7 @@ if sys.platform == "win32": def socketpair(family: int = ..., type: int = ..., proto: int = ...) -> tuple[socket, socket]: ... else: - def socketpair( # type: ignore + def socketpair( family: int | AddressFamily | None = ..., type: SocketType | int = ..., proto: int = ... ) -> tuple[socket, socket]: ... @@ -606,11 +762,20 @@ class SocketIO(RawIOBase): def mode(self) -> Literal["rb", "wb", "rwb"]: ... def getfqdn(name: str = ...) -> str: ... -def create_connection( - address: tuple[str | None, int], - timeout: float | None = ..., # noqa: F811 - source_address: tuple[bytearray | bytes | str, int] | None = ..., -) -> socket: ... + +if sys.version_info >= (3, 11): + def create_connection( + address: tuple[str | None, int], + timeout: float | None = ..., # noqa: F811 + source_address: _Address | None = ..., + *, + all_errors: bool = ..., + ) -> socket: ... + +else: + def create_connection( + address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = ... # noqa: F811 + ) -> socket: ... if sys.version_info >= (3, 8): def has_dualstack_ipv6() -> bool: ... @@ -620,8 +785,8 @@ if sys.version_info >= (3, 8): # the 5th tuple item is an address def getaddrinfo( - host: bytearray | bytes | str | None, - port: str | int | None, + host: bytes | str | None, + port: bytes | str | int | None, family: int = ..., type: int = ..., proto: int = ..., diff --git a/stdlib/socketserver.pyi b/stdlib/socketserver.pyi index 5966b8d..e597818 100644 --- a/stdlib/socketserver.pyi +++ b/stdlib/socketserver.pyi @@ -1,23 +1,53 @@ import sys import types from _typeshed import Self +from collections.abc import Callable from socket import socket as _socket -from typing import Any, BinaryIO, Callable, ClassVar, Set, Tuple, Type, TypeVar, Union +from typing import Any, BinaryIO, ClassVar, Union +from typing_extensions import TypeAlias -_T = TypeVar("_T") -_RequestType = Union[_socket, Tuple[bytes, _socket]] -_AddressType = Union[Tuple[str, int], str] +__all__ = [ + "BaseServer", + "TCPServer", + "UDPServer", + "ThreadingUDPServer", + "ThreadingTCPServer", + "BaseRequestHandler", + "StreamRequestHandler", + "DatagramRequestHandler", + "ThreadingMixIn", +] +if sys.platform != "win32": + __all__ += [ + "ForkingMixIn", + "ForkingTCPServer", + "ForkingUDPServer", + "ThreadingUnixDatagramServer", + "ThreadingUnixStreamServer", + "UnixDatagramServer", + "UnixStreamServer", + ] + +_RequestType: TypeAlias = Union[_socket, tuple[bytes, _socket]] +_AddressType: TypeAlias = Union[tuple[str, int], str] +# This can possibly be generic at some point: class BaseServer: address_family: int - RequestHandlerClass: Callable[..., BaseRequestHandler] server_address: tuple[str, int] socket: _socket allow_reuse_address: bool request_queue_size: int socket_type: int timeout: float | None - def __init__(self, server_address: Any, RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ... + def __init__( + self: Self, server_address: Any, RequestHandlerClass: Callable[[Any, Any, Self], BaseRequestHandler] + ) -> None: ... + # It is not actually a `@property`, but we need a `Self` type: + @property + def RequestHandlerClass(self: Self) -> Callable[[Any, Any, Self], BaseRequestHandler]: ... + @RequestHandlerClass.setter + def RequestHandlerClass(self: Self, val: Callable[[Any, Any, Self], BaseRequestHandler]) -> None: ... def fileno(self) -> int: ... def handle_request(self) -> None: ... def serve_forever(self, poll_interval: float = ...) -> None: ... @@ -33,65 +63,50 @@ class BaseServer: def verify_request(self, request: _RequestType, client_address: _AddressType) -> bool: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None ) -> None: ... def service_actions(self) -> None: ... def shutdown_request(self, request: _RequestType) -> None: ... # undocumented def close_request(self, request: _RequestType) -> None: ... # undocumented class TCPServer(BaseServer): + if sys.version_info >= (3, 11): + allow_reuse_port: bool def __init__( - self, + self: Self, server_address: tuple[str, int], - RequestHandlerClass: Callable[..., BaseRequestHandler], + RequestHandlerClass: Callable[[Any, Any, Self], BaseRequestHandler], bind_and_activate: bool = ..., ) -> None: ... def get_request(self) -> tuple[_socket, Any]: ... - def finish_request(self, request: _RequestType, client_address: _AddressType) -> None: ... - def handle_error(self, request: _RequestType, client_address: _AddressType) -> None: ... - def process_request(self, request: _RequestType, client_address: _AddressType) -> None: ... - def verify_request(self, request: _RequestType, client_address: _AddressType) -> bool: ... - def shutdown_request(self, request: _RequestType) -> None: ... # undocumented - def close_request(self, request: _RequestType) -> None: ... # undocumented -class UDPServer(BaseServer): - def __init__( - self, - server_address: tuple[str, int], - RequestHandlerClass: Callable[..., BaseRequestHandler], - bind_and_activate: bool = ..., - ) -> None: ... - def get_request(self) -> tuple[tuple[bytes, _socket], Any]: ... - def finish_request(self, request: _RequestType, client_address: _AddressType) -> None: ... - def handle_error(self, request: _RequestType, client_address: _AddressType) -> None: ... - def process_request(self, request: _RequestType, client_address: _AddressType) -> None: ... - def verify_request(self, request: _RequestType, client_address: _AddressType) -> bool: ... - def shutdown_request(self, request: _RequestType) -> None: ... # undocumented - def close_request(self, request: _RequestType) -> None: ... # undocumented +class UDPServer(TCPServer): + max_packet_size: ClassVar[int] + def get_request(self) -> tuple[tuple[bytes, _socket], Any]: ... # type: ignore[override] if sys.platform != "win32": class UnixStreamServer(BaseServer): def __init__( - self, + self: Self, server_address: str | bytes, - RequestHandlerClass: Callable[..., BaseRequestHandler], + RequestHandlerClass: Callable[[Any, Any, Self], BaseRequestHandler], bind_and_activate: bool = ..., ) -> None: ... + class UnixDatagramServer(BaseServer): def __init__( - self, + self: Self, server_address: str | bytes, - RequestHandlerClass: Callable[..., BaseRequestHandler], + RequestHandlerClass: Callable[[Any, Any, Self], BaseRequestHandler], bind_and_activate: bool = ..., ) -> None: ... if sys.platform != "win32": class ForkingMixIn: timeout: float | None # undocumented - active_children: Set[int] | None # undocumented + active_children: set[int] | None # undocumented max_children: int # undocumented - if sys.version_info >= (3, 7): - block_on_close: bool + block_on_close: bool def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented def handle_timeout(self) -> None: ... # undocumented def service_actions(self) -> None: ... # undocumented @@ -100,8 +115,7 @@ if sys.platform != "win32": class ThreadingMixIn: daemon_threads: bool - if sys.version_info >= (3, 7): - block_on_close: bool + block_on_close: bool def process_request_thread(self, request: _RequestType, client_address: _AddressType) -> None: ... # undocumented def process_request(self, request: _RequestType, client_address: _AddressType) -> None: ... def server_close(self) -> None: ... @@ -137,7 +151,7 @@ class StreamRequestHandler(BaseRequestHandler): wbufsize: ClassVar[int] # undocumented timeout: ClassVar[float | None] # undocumented disable_nagle_algorithm: ClassVar[bool] # undocumented - connection: _socket # undocumented + connection: Any # undocumented rfile: BinaryIO wfile: BinaryIO diff --git a/stdlib/spwd.pyi b/stdlib/spwd.pyi index 0f8d36f..27b1061 100644 --- a/stdlib/spwd.pyi +++ b/stdlib/spwd.pyi @@ -1,15 +1,41 @@ -from typing import NamedTuple +import sys +from _typeshed import structseq +from typing import Any +from typing_extensions import Final, final -class struct_spwd(NamedTuple): - sp_namp: str - sp_pwdp: str - sp_lstchg: int - sp_min: int - sp_max: int - sp_warn: int - sp_inact: int - sp_expire: int - sp_flag: int +if sys.platform != "win32": + @final + class struct_spwd(structseq[Any], tuple[str, str, int, int, int, int, int, int, int]): + if sys.version_info >= (3, 10): + __match_args__: Final = ( + "sp_namp", + "sp_pwdp", + "sp_lstchg", + "sp_min", + "sp_max", + "sp_warn", + "sp_inact", + "sp_expire", + "sp_flag", + ) + @property + def sp_namp(self) -> str: ... + @property + def sp_pwdp(self) -> str: ... + @property + def sp_lstchg(self) -> int: ... + @property + def sp_min(self) -> int: ... + @property + def sp_max(self) -> int: ... + @property + def sp_warn(self) -> int: ... + @property + def sp_inact(self) -> int: ... + @property + def sp_expire(self) -> int: ... + @property + def sp_flag(self) -> int: ... -def getspall() -> list[struct_spwd]: ... -def getspnam(__arg: str) -> struct_spwd: ... + def getspall() -> list[struct_spwd]: ... + def getspnam(__arg: str) -> struct_spwd: ... diff --git a/stdlib/sqlite3/__init__.pyi b/stdlib/sqlite3/__init__.pyi index d5d20d6..d747be9 100644 --- a/stdlib/sqlite3/__init__.pyi +++ b/stdlib/sqlite3/__init__.pyi @@ -1 +1 @@ -from sqlite3.dbapi2 import * # noqa: F403 +from sqlite3.dbapi2 import * diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index abce963..4b447a1 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -1,9 +1,21 @@ +import sqlite3 import sys -from _typeshed import Self, StrOrBytesPath +from _typeshed import ReadableBuffer, Self, StrOrBytesPath, SupportsLenAndGetItem +from collections.abc import Callable, Generator, Iterable, Iterator, Mapping from datetime import date, datetime, time -from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, Tuple, Type, TypeVar +from types import TracebackType +from typing import Any, Protocol, TypeVar, overload +from typing_extensions import Literal, SupportsIndex, TypeAlias, final _T = TypeVar("_T") +_CursorT = TypeVar("_CursorT", bound=Cursor) +_SqliteData: TypeAlias = str | ReadableBuffer | int | float | None +# Data that is passed through adapters can be of any type accepted by an adapter. +_AdaptedInputData: TypeAlias = _SqliteData | Any +# The Mapping must really be a dict, but making it invariant is too annoying. +_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData] +_Adapter: TypeAlias = Callable[[_T], _SqliteData] +_Converter: TypeAlias = Callable[[bytes], Any] paramstyle: str threadsafety: int @@ -16,8 +28,8 @@ def DateFromTicks(ticks: float) -> Date: ... def TimeFromTicks(ticks: float) -> Time: ... def TimestampFromTicks(ticks: float) -> Timestamp: ... -version_info: Tuple[int, int, int] -sqlite_version_info: Tuple[int, int, int] +version_info: tuple[int, int, int] +sqlite_version_info: tuple[int, int, int] Binary = memoryview # The remaining definitions are imported from _sqlite3. @@ -35,9 +47,11 @@ SQLITE_CREATE_TEMP_TRIGGER: int SQLITE_CREATE_TEMP_VIEW: int SQLITE_CREATE_TRIGGER: int SQLITE_CREATE_VIEW: int +SQLITE_CREATE_VTABLE: int SQLITE_DELETE: int SQLITE_DENY: int SQLITE_DETACH: int +SQLITE_DONE: int SQLITE_DROP_INDEX: int SQLITE_DROP_TABLE: int SQLITE_DROP_TEMP_INDEX: int @@ -46,176 +60,399 @@ SQLITE_DROP_TEMP_TRIGGER: int SQLITE_DROP_TEMP_VIEW: int SQLITE_DROP_TRIGGER: int SQLITE_DROP_VIEW: int +SQLITE_DROP_VTABLE: int +SQLITE_FUNCTION: int SQLITE_IGNORE: int SQLITE_INSERT: int SQLITE_OK: int +if sys.version_info >= (3, 11): + SQLITE_LIMIT_LENGTH: int + SQLITE_LIMIT_SQL_LENGTH: int + SQLITE_LIMIT_COLUMN: int + SQLITE_LIMIT_EXPR_DEPTH: int + SQLITE_LIMIT_COMPOUND_SELECT: int + SQLITE_LIMIT_VDBE_OP: int + SQLITE_LIMIT_FUNCTION_ARG: int + SQLITE_LIMIT_ATTACHED: int + SQLITE_LIMIT_LIKE_PATTERN_LENGTH: int + SQLITE_LIMIT_VARIABLE_NUMBER: int + SQLITE_LIMIT_TRIGGER_DEPTH: int + SQLITE_LIMIT_WORKER_THREADS: int SQLITE_PRAGMA: int SQLITE_READ: int SQLITE_REINDEX: int +SQLITE_RECURSIVE: int +SQLITE_SAVEPOINT: int SQLITE_SELECT: int SQLITE_TRANSACTION: int SQLITE_UPDATE: int -adapters: Any -converters: Any +adapters: dict[tuple[type[Any], type[Any]], _Adapter[Any]] +converters: dict[str, _Converter] sqlite_version: str version: str -# TODO: adapt needs to get probed -def adapt(obj, protocol, alternate): ... -def complete_statement(sql: str) -> bool: ... - -if sys.version_info >= (3, 7): - def connect( - database: StrOrBytesPath, - timeout: float = ..., - detect_types: int = ..., - isolation_level: str | None = ..., - check_same_thread: bool = ..., - factory: Type[Connection] | None = ..., - cached_statements: int = ..., - uri: bool = ..., - ) -> Connection: ... - -else: - def connect( - database: bytes | str, - timeout: float = ..., - detect_types: int = ..., - isolation_level: str | None = ..., - check_same_thread: bool = ..., - factory: Type[Connection] | None = ..., - cached_statements: int = ..., - uri: bool = ..., - ) -> Connection: ... +if sys.version_info >= (3, 11): + SQLITE_ABORT: int + SQLITE_ABORT_ROLLBACK: int + SQLITE_AUTH: int + SQLITE_AUTH_USER: int + SQLITE_BUSY: int + SQLITE_BUSY_RECOVERY: int + SQLITE_BUSY_SNAPSHOT: int + SQLITE_BUSY_TIMEOUT: int + SQLITE_CANTOPEN: int + SQLITE_CANTOPEN_CONVPATH: int + SQLITE_CANTOPEN_DIRTYWAL: int + SQLITE_CANTOPEN_FULLPATH: int + SQLITE_CANTOPEN_ISDIR: int + SQLITE_CANTOPEN_NOTEMPDIR: int + SQLITE_CANTOPEN_SYMLINK: int + SQLITE_CONSTRAINT: int + SQLITE_CONSTRAINT_CHECK: int + SQLITE_CONSTRAINT_COMMITHOOK: int + SQLITE_CONSTRAINT_FOREIGNKEY: int + SQLITE_CONSTRAINT_FUNCTION: int + SQLITE_CONSTRAINT_NOTNULL: int + SQLITE_CONSTRAINT_PINNED: int + SQLITE_CONSTRAINT_PRIMARYKEY: int + SQLITE_CONSTRAINT_ROWID: int + SQLITE_CONSTRAINT_TRIGGER: int + SQLITE_CONSTRAINT_UNIQUE: int + SQLITE_CONSTRAINT_VTAB: int + SQLITE_CORRUPT: int + SQLITE_CORRUPT_INDEX: int + SQLITE_CORRUPT_SEQUENCE: int + SQLITE_CORRUPT_VTAB: int + SQLITE_EMPTY: int + SQLITE_ERROR: int + SQLITE_ERROR_MISSING_COLLSEQ: int + SQLITE_ERROR_RETRY: int + SQLITE_ERROR_SNAPSHOT: int + SQLITE_FORMAT: int + SQLITE_FULL: int + SQLITE_INTERNAL: int + SQLITE_INTERRUPT: int + SQLITE_IOERR: int + SQLITE_IOERR_ACCESS: int + SQLITE_IOERR_AUTH: int + SQLITE_IOERR_BEGIN_ATOMIC: int + SQLITE_IOERR_BLOCKED: int + SQLITE_IOERR_CHECKRESERVEDLOCK: int + SQLITE_IOERR_CLOSE: int + SQLITE_IOERR_COMMIT_ATOMIC: int + SQLITE_IOERR_CONVPATH: int + SQLITE_IOERR_CORRUPTFS: int + SQLITE_IOERR_DATA: int + SQLITE_IOERR_DELETE: int + SQLITE_IOERR_DELETE_NOENT: int + SQLITE_IOERR_DIR_CLOSE: int + SQLITE_IOERR_DIR_FSYNC: int + SQLITE_IOERR_FSTAT: int + SQLITE_IOERR_FSYNC: int + SQLITE_IOERR_GETTEMPPATH: int + SQLITE_IOERR_LOCK: int + SQLITE_IOERR_MMAP: int + SQLITE_IOERR_NOMEM: int + SQLITE_IOERR_RDLOCK: int + SQLITE_IOERR_READ: int + SQLITE_IOERR_ROLLBACK_ATOMIC: int + SQLITE_IOERR_SEEK: int + SQLITE_IOERR_SHMLOCK: int + SQLITE_IOERR_SHMMAP: int + SQLITE_IOERR_SHMOPEN: int + SQLITE_IOERR_SHMSIZE: int + SQLITE_IOERR_SHORT_READ: int + SQLITE_IOERR_TRUNCATE: int + SQLITE_IOERR_UNLOCK: int + SQLITE_IOERR_VNODE: int + SQLITE_IOERR_WRITE: int + SQLITE_LOCKED: int + SQLITE_LOCKED_SHAREDCACHE: int + SQLITE_LOCKED_VTAB: int + SQLITE_MISMATCH: int + SQLITE_MISUSE: int + SQLITE_NOLFS: int + SQLITE_NOMEM: int + SQLITE_NOTADB: int + SQLITE_NOTFOUND: int + SQLITE_NOTICE: int + SQLITE_NOTICE_RECOVER_ROLLBACK: int + SQLITE_NOTICE_RECOVER_WAL: int + SQLITE_OK_LOAD_PERMANENTLY: int + SQLITE_OK_SYMLINK: int + SQLITE_PERM: int + SQLITE_PROTOCOL: int + SQLITE_RANGE: int + SQLITE_READONLY: int + SQLITE_READONLY_CANTINIT: int + SQLITE_READONLY_CANTLOCK: int + SQLITE_READONLY_DBMOVED: int + SQLITE_READONLY_DIRECTORY: int + SQLITE_READONLY_RECOVERY: int + SQLITE_READONLY_ROLLBACK: int + SQLITE_ROW: int + SQLITE_SCHEMA: int + SQLITE_TOOBIG: int + SQLITE_WARNING: int + SQLITE_WARNING_AUTOINDEX: int +# Can take or return anything depending on what's in the registry. +@overload +def adapt(__obj: Any, __proto: Any) -> Any: ... +@overload +def adapt(__obj: Any, __proto: Any, __alt: _T) -> Any | _T: ... +def complete_statement(statement: str) -> bool: ... +def connect( + database: StrOrBytesPath, + timeout: float = ..., + detect_types: int = ..., + isolation_level: str | None = ..., + check_same_thread: bool = ..., + factory: type[Connection] | None = ..., + cached_statements: int = ..., + uri: bool = ..., +) -> Connection: ... def enable_callback_tracebacks(__enable: bool) -> None: ... + +# takes a pos-or-keyword argument because there is a C wrapper def enable_shared_cache(enable: int) -> None: ... -def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ... -def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ... + +if sys.version_info >= (3, 10): + def register_adapter(__type: type[_T], __adapter: _Adapter[_T]) -> None: ... + def register_converter(__typename: str, __converter: _Converter) -> None: ... + +else: + def register_adapter(__type: type[_T], __caster: _Adapter[_T]) -> None: ... + def register_converter(__name: str, __converter: _Converter) -> None: ... if sys.version_info < (3, 8): - class Cache(object): + class Cache: def __init__(self, *args, **kwargs) -> None: ... def display(self, *args, **kwargs) -> None: ... def get(self, *args, **kwargs) -> None: ... class _AggregateProtocol(Protocol): - def step(self, value: int) -> None: ... + def step(self, __value: int) -> object: ... def finalize(self) -> int: ... -class Connection(object): - DataError: Any - DatabaseError: Any - Error: Any - IntegrityError: Any - InterfaceError: Any - InternalError: Any - NotSupportedError: Any - OperationalError: Any - ProgrammingError: Any - Warning: Any - in_transaction: Any - isolation_level: Any +class _SingleParamWindowAggregateClass(Protocol): + def step(self, __param: Any) -> object: ... + def inverse(self, __param: Any) -> object: ... + def value(self) -> _SqliteData: ... + def finalize(self) -> _SqliteData: ... + +class _AnyParamWindowAggregateClass(Protocol): + def step(self, *args: Any) -> object: ... + def inverse(self, *args: Any) -> object: ... + def value(self) -> _SqliteData: ... + def finalize(self) -> _SqliteData: ... + +class _WindowAggregateClass(Protocol): + step: Callable[..., object] + inverse: Callable[..., object] + def value(self) -> _SqliteData: ... + def finalize(self) -> _SqliteData: ... + +class Connection: + @property + def DataError(self) -> type[sqlite3.DataError]: ... + @property + def DatabaseError(self) -> type[sqlite3.DatabaseError]: ... + @property + def Error(self) -> type[sqlite3.Error]: ... + @property + def IntegrityError(self) -> type[sqlite3.IntegrityError]: ... + @property + def InterfaceError(self) -> type[sqlite3.InterfaceError]: ... + @property + def InternalError(self) -> type[sqlite3.InternalError]: ... + @property + def NotSupportedError(self) -> type[sqlite3.NotSupportedError]: ... + @property + def OperationalError(self) -> type[sqlite3.OperationalError]: ... + @property + def ProgrammingError(self) -> type[sqlite3.ProgrammingError]: ... + @property + def Warning(self) -> type[sqlite3.Warning]: ... + @property + def in_transaction(self) -> bool: ... + isolation_level: str | None # one of '', 'DEFERRED', 'IMMEDIATE' or 'EXCLUSIVE' + @property + def total_changes(self) -> int: ... row_factory: Any text_factory: Any - total_changes: Any - def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, + database: StrOrBytesPath, + timeout: float = ..., + detect_types: int = ..., + isolation_level: str | None = ..., + check_same_thread: bool = ..., + factory: type[Connection] | None = ..., + cached_statements: int = ..., + uri: bool = ..., + ) -> None: ... def close(self) -> None: ... + if sys.version_info >= (3, 11): + def blobopen(self, __table: str, __column: str, __row: int, *, readonly: bool = ..., name: str = ...) -> Blob: ... + def commit(self) -> None: ... def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ... - def create_collation(self, __name: str, __callback: Any) -> None: ... + if sys.version_info >= (3, 11): + # num_params determines how many params will be passed to the aggregate class. We provide an overload + # for the case where num_params = 1, which is expected to be the common case. + @overload + def create_window_function( + self, __name: str, __num_params: Literal[1], __aggregate_class: Callable[[], _SingleParamWindowAggregateClass] | None + ) -> None: ... + # And for num_params = -1, which means the aggregate must accept any number of parameters. + @overload + def create_window_function( + self, __name: str, __num_params: Literal[-1], __aggregate_class: Callable[[], _AnyParamWindowAggregateClass] | None + ) -> None: ... + @overload + def create_window_function( + self, __name: str, __num_params: int, __aggregate_class: Callable[[], _WindowAggregateClass] | None + ) -> None: ... + + def create_collation(self, __name: str, __callback: Callable[[str, str], int | SupportsIndex] | None) -> None: ... if sys.version_info >= (3, 8): - def create_function(self, name: str, narg: int, func: Any, *, deterministic: bool = ...) -> None: ... + def create_function( + self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = ... + ) -> None: ... else: - def create_function(self, name: str, num_params: int, func: Any) -> None: ... - def cursor(self, cursorClass: type | None = ...) -> Cursor: ... - def execute(self, sql: str, parameters: Iterable[Any] = ...) -> Cursor: ... - # TODO: please check in executemany() if seq_of_parameters type is possible like this - def executemany(self, __sql: str, __parameters: Iterable[Iterable[Any]]) -> Cursor: ... - def executescript(self, __sql_script: bytes | str) -> Cursor: ... - def interrupt(self, *args: Any, **kwargs: Any) -> None: ... - def iterdump(self, *args: Any, **kwargs: Any) -> Generator[str, None, None]: ... - def rollback(self, *args: Any, **kwargs: Any) -> None: ... - # TODO: set_authorizer(authorzer_callback) - # see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_authorizer - # returns [SQLITE_OK, SQLITE_DENY, SQLITE_IGNORE] so perhaps int - def set_authorizer(self, *args: Any, **kwargs: Any) -> None: ... - # set_progress_handler(handler, n) -> see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_progress_handler - def set_progress_handler(self, *args: Any, **kwargs: Any) -> None: ... - def set_trace_callback(self, *args: Any, **kwargs: Any) -> None: ... + def create_function(self, name: str, num_params: int, func: Callable[..., _SqliteData] | None) -> None: ... + + @overload + def cursor(self, cursorClass: None = ...) -> Cursor: ... + @overload + def cursor(self, cursorClass: Callable[[], _CursorT]) -> _CursorT: ... + def execute(self, sql: str, parameters: _Parameters = ...) -> Cursor: ... + def executemany(self, __sql: str, __parameters: Iterable[_Parameters]) -> Cursor: ... + def executescript(self, __sql_script: str) -> Cursor: ... + def interrupt(self) -> None: ... + def iterdump(self) -> Generator[str, None, None]: ... + def rollback(self) -> None: ... + def set_authorizer( + self, authorizer_callback: Callable[[int, str | None, str | None, str | None, str | None], int] | None + ) -> None: ... + def set_progress_handler(self, progress_handler: Callable[[], int | None] | None, n: int) -> None: ... + def set_trace_callback(self, trace_callback: Callable[[str], object] | None) -> None: ... # enable_load_extension and load_extension is not available on python distributions compiled # without sqlite3 loadable extension support. see footnotes https://docs.python.org/3/library/sqlite3.html#f1 - def enable_load_extension(self, enabled: bool) -> None: ... - def load_extension(self, path: str) -> None: ... - if sys.version_info >= (3, 7): - def backup( - self, - target: Connection, - *, - pages: int = ..., - progress: Callable[[int, int, int], object] | None = ..., - name: str = ..., - sleep: float = ..., - ) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def enable_load_extension(self, __enabled: bool) -> None: ... + def load_extension(self, __name: str) -> None: ... + def backup( + self, + target: Connection, + *, + pages: int = ..., + progress: Callable[[int, int, int], object] | None = ..., + name: str = ..., + sleep: float = ..., + ) -> None: ... + if sys.version_info >= (3, 11): + def setlimit(self, __category: int, __limit: int) -> int: ... + def getlimit(self, __category: int) -> int: ... + def serialize(self, *, name: str = ...) -> bytes: ... + def deserialize(self, __data: ReadableBuffer, *, name: str = ...) -> None: ... + + def __call__(self, __sql: str) -> _Statement: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, t: type | None, exc: BaseException | None, tb: Any | None) -> None: ... + def __exit__( + self, __type: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None + ) -> Literal[False]: ... class Cursor(Iterator[Any]): - arraysize: Any - connection: Any - description: Any - lastrowid: Any - row_factory: Any - rowcount: Any - # TODO: Cursor class accepts exactly 1 argument - # required type is sqlite3.Connection (which is imported as _Connection) - # however, the name of the __init__ variable is unknown - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def close(self, *args: Any, **kwargs: Any) -> None: ... - def execute(self, __sql: str, __parameters: Iterable[Any] = ...) -> Cursor: ... - def executemany(self, __sql: str, __seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ... - def executescript(self, __sql_script: bytes | str) -> Cursor: ... + arraysize: int + @property + def connection(self) -> Connection: ... + # May be None, but using | Any instead to avoid slightly annoying false positives. + @property + def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | Any: ... + @property + def lastrowid(self) -> int | None: ... + row_factory: Callable[[Cursor, Row], object] | None + @property + def rowcount(self) -> int: ... + def __init__(self, __cursor: Connection) -> None: ... + def close(self) -> None: ... + def execute(self: Self, __sql: str, __parameters: _Parameters = ...) -> Self: ... + def executemany(self: Self, __sql: str, __seq_of_parameters: Iterable[_Parameters]) -> Self: ... + def executescript(self, __sql_script: str) -> Cursor: ... def fetchall(self) -> list[Any]: ... def fetchmany(self, size: int | None = ...) -> list[Any]: ... + # Returns either a row (as created by the row_factory) or None, but + # putting None in the return annotation causes annoying false positives. def fetchone(self) -> Any: ... - def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ... - def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ... - def __iter__(self) -> Cursor: ... + def setinputsizes(self, __sizes: object) -> None: ... # does nothing + def setoutputsize(self, __size: object, __column: object = ...) -> None: ... # does nothing + def __iter__(self: Self) -> Self: ... def __next__(self) -> Any: ... class DataError(DatabaseError): ... class DatabaseError(Error): ... -class Error(Exception): ... + +class Error(Exception): + if sys.version_info >= (3, 11): + sqlite_errorcode: int + sqlite_errorname: str + class IntegrityError(DatabaseError): ... class InterfaceError(Error): ... class InternalError(DatabaseError): ... class NotSupportedError(DatabaseError): ... class OperationalError(DatabaseError): ... -OptimizedUnicode = str +if sys.version_info < (3, 10): + OptimizedUnicode = str -class PrepareProtocol(object): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... +@final +class PrepareProtocol: + def __init__(self, *args: object, **kwargs: object) -> None: ... class ProgrammingError(DatabaseError): ... -class Row(object): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def keys(self, *args: Any, **kwargs: Any): ... - def __eq__(self, other): ... - def __ge__(self, other): ... - def __getitem__(self, index): ... - def __gt__(self, other): ... - def __hash__(self): ... - def __iter__(self): ... - def __le__(self, other): ... - def __len__(self): ... - def __lt__(self, other): ... - def __ne__(self, other): ... +class Row: + def __init__(self, __cursor: Cursor, __data: tuple[Any, ...]) -> None: ... + def keys(self) -> list[str]: ... + @overload + def __getitem__(self, __index: int | str) -> Any: ... + @overload + def __getitem__(self, __index: slice) -> tuple[Any, ...]: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... + # These return NotImplemented for anything that is not a Row. + def __eq__(self, __other: object) -> bool: ... + def __ge__(self, __other: object) -> bool: ... + def __gt__(self, __other: object) -> bool: ... + def __le__(self, __other: object) -> bool: ... + def __lt__(self, __other: object) -> bool: ... + def __ne__(self, __other: object) -> bool: ... -if sys.version_info < (3, 8): - class Statement(object): +if sys.version_info >= (3, 8): + @final + class _Statement: ... + +else: + @final + class Statement: def __init__(self, *args, **kwargs): ... + _Statement: TypeAlias = Statement class Warning(Exception): ... + +if sys.version_info >= (3, 11): + @final + class Blob: + def close(self) -> None: ... + def read(self, __length: int = ...) -> bytes: ... + def write(self, __data: ReadableBuffer) -> None: ... + def tell(self) -> int: ... + # whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END + def seek(self, __offset: int, __origin: int = ...) -> None: ... + def __len__(self) -> int: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, __typ: object, __val: object, __tb: object) -> Literal[False]: ... + def __getitem__(self, __item: SupportsIndex | slice) -> int: ... + def __setitem__(self, __item: SupportsIndex | slice, __value: int) -> None: ... diff --git a/stdlib/sre_compile.pyi b/stdlib/sre_compile.pyi index aac8c02..a9f4d57 100644 --- a/stdlib/sre_compile.pyi +++ b/stdlib/sre_compile.pyi @@ -1,20 +1,8 @@ -from sre_constants import ( - SRE_FLAG_ASCII as SRE_FLAG_ASCII, - SRE_FLAG_DEBUG as SRE_FLAG_DEBUG, - SRE_FLAG_DOTALL as SRE_FLAG_DOTALL, - SRE_FLAG_IGNORECASE as SRE_FLAG_IGNORECASE, - SRE_FLAG_LOCALE as SRE_FLAG_LOCALE, - SRE_FLAG_MULTILINE as SRE_FLAG_MULTILINE, - SRE_FLAG_TEMPLATE as SRE_FLAG_TEMPLATE, - SRE_FLAG_UNICODE as SRE_FLAG_UNICODE, - SRE_FLAG_VERBOSE as SRE_FLAG_VERBOSE, - SRE_INFO_CHARSET as SRE_INFO_CHARSET, - SRE_INFO_LITERAL as SRE_INFO_LITERAL, - SRE_INFO_PREFIX as SRE_INFO_PREFIX, - _NamedIntConstant, -) +from re import Pattern +from sre_constants import * +from sre_constants import _NamedIntConstant from sre_parse import SubPattern -from typing import Any, Pattern +from typing import Any MAXCODE: int diff --git a/stdlib/sre_constants.pyi b/stdlib/sre_constants.pyi index 4658d0e..e7344fa 100644 --- a/stdlib/sre_constants.pyi +++ b/stdlib/sre_constants.pyi @@ -1,6 +1,9 @@ import sys +from _typeshed import Self from typing import Any +MAXGROUPS: int + MAGIC: int class error(Exception): @@ -13,13 +16,15 @@ class error(Exception): class _NamedIntConstant(int): name: Any - def __new__(cls, value: int, name: str) -> _NamedIntConstant: ... + def __new__(cls: type[Self], value: int, name: str) -> Self: ... MAXREPEAT: _NamedIntConstant OPCODES: list[_NamedIntConstant] ATCODES: list[_NamedIntConstant] CHCODES: list[_NamedIntConstant] OP_IGNORE: dict[_NamedIntConstant, _NamedIntConstant] +OP_LOCALE_IGNORE: dict[_NamedIntConstant, _NamedIntConstant] +OP_UNICODE_IGNORE: dict[_NamedIntConstant, _NamedIntConstant] AT_MULTILINE: dict[_NamedIntConstant, _NamedIntConstant] AT_LOCALE: dict[_NamedIntConstant, _NamedIntConstant] AT_UNICODE: dict[_NamedIntConstant, _NamedIntConstant] @@ -49,7 +54,8 @@ ASSERT: _NamedIntConstant ASSERT_NOT: _NamedIntConstant AT: _NamedIntConstant BRANCH: _NamedIntConstant -CALL: _NamedIntConstant +if sys.version_info < (3, 11): + CALL: _NamedIntConstant CATEGORY: _NamedIntConstant CHARSET: _NamedIntConstant BIGCHARSET: _NamedIntConstant @@ -73,10 +79,15 @@ REPEAT: _NamedIntConstant REPEAT_ONE: _NamedIntConstant SUBPATTERN: _NamedIntConstant MIN_REPEAT_ONE: _NamedIntConstant -if sys.version_info >= (3, 7): - RANGE_UNI_IGNORE: _NamedIntConstant -else: - RANGE_IGNORE: _NamedIntConstant +RANGE_UNI_IGNORE: _NamedIntConstant +GROUPREF_LOC_IGNORE: _NamedIntConstant +GROUPREF_UNI_IGNORE: _NamedIntConstant +IN_LOC_IGNORE: _NamedIntConstant +IN_UNI_IGNORE: _NamedIntConstant +LITERAL_LOC_IGNORE: _NamedIntConstant +LITERAL_UNI_IGNORE: _NamedIntConstant +NOT_LITERAL_LOC_IGNORE: _NamedIntConstant +NOT_LITERAL_UNI_IGNORE: _NamedIntConstant MIN_REPEAT: _NamedIntConstant MAX_REPEAT: _NamedIntConstant diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index a242ca3..3dcf8ad 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -1,45 +1,50 @@ import sys +from collections.abc import Iterable +from re import Match, Pattern as _Pattern +from sre_constants import * from sre_constants import _NamedIntConstant as _NIC, error as _Error -from typing import Any, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload +from typing import Any, overload +from typing_extensions import TypeAlias SPECIAL_CHARS: str REPEAT_CHARS: str -DIGITS: FrozenSet[str] -OCTDIGITS: FrozenSet[str] -HEXDIGITS: FrozenSet[str] -ASCIILETTERS: FrozenSet[str] -WHITESPACE: FrozenSet[str] -ESCAPES: dict[str, Tuple[_NIC, int]] -CATEGORIES: dict[str, Tuple[_NIC, _NIC] | Tuple[_NIC, list[Tuple[_NIC, _NIC]]]] +DIGITS: frozenset[str] +OCTDIGITS: frozenset[str] +HEXDIGITS: frozenset[str] +ASCIILETTERS: frozenset[str] +WHITESPACE: frozenset[str] +ESCAPES: dict[str, tuple[_NIC, int]] +CATEGORIES: dict[str, tuple[_NIC, _NIC] | tuple[_NIC, list[tuple[_NIC, _NIC]]]] FLAGS: dict[str, int] +TYPE_FLAGS: int GLOBAL_FLAGS: int -class Verbose(Exception): ... +if sys.version_info < (3, 11): + class Verbose(Exception): ... class _State: flags: int groupdict: dict[str, int] groupwidths: list[int | None] lookbehindgroups: int | None - def __init__(self) -> None: ... @property def groups(self) -> int: ... - def opengroup(self, name: str = ...) -> int: ... + def opengroup(self, name: str | None = ...) -> int: ... def closegroup(self, gid: int, p: SubPattern) -> None: ... def checkgroup(self, gid: int) -> bool: ... def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ... if sys.version_info >= (3, 8): - State = _State + State: TypeAlias = _State else: - Pattern = _State + Pattern: TypeAlias = _State -_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern] -_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern] -_OpInType = List[Tuple[_NIC, int]] -_OpBranchType = Tuple[None, List[SubPattern]] -_AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType] -_CodeType = Tuple[_NIC, _AvType] +_OpSubpatternType: TypeAlias = tuple[int | None, int, int, SubPattern] +_OpGroupRefExistsType: TypeAlias = tuple[int, SubPattern, SubPattern] +_OpInType: TypeAlias = list[tuple[_NIC, int]] +_OpBranchType: TypeAlias = tuple[None, list[SubPattern]] +_AvType: TypeAlias = _OpInType | _OpBranchType | Iterable[SubPattern] | _OpGroupRefExistsType | _OpSubpatternType +_CodeType: TypeAlias = tuple[_NIC, _AvType] class SubPattern: data: list[_CodeType] @@ -51,6 +56,7 @@ class SubPattern: else: pattern: Pattern def __init__(self, pattern: Pattern, data: list[_CodeType] | None = ...) -> None: ... + def dump(self, level: int = ...) -> None: ... def __len__(self) -> int: ... def __delitem__(self, index: int | slice) -> None: ... @@ -58,7 +64,7 @@ class SubPattern: def __setitem__(self, index: int | slice, code: _CodeType) -> None: ... def insert(self, index: int, code: _CodeType) -> None: ... def append(self, code: _CodeType) -> None: ... - def getwidth(self) -> int: ... + def getwidth(self) -> tuple[int, int]: ... class Tokenizer: istext: bool @@ -74,16 +80,20 @@ class Tokenizer: def getuntil(self, terminator: str, name: str) -> str: ... else: def getuntil(self, terminator: str) -> str: ... + @property def pos(self) -> int: ... def tell(self) -> int: ... def seek(self, index: int) -> None: ... def error(self, msg: str, offset: int = ...) -> _Error: ... + if sys.version_info >= (3, 11): + def checkgroupname(self, name: str, offset: int, nested: int) -> None: ... + def fix_flags(src: str | bytes, flags: int) -> int: ... -_TemplateType = Tuple[List[Tuple[int, int]], List[Optional[str]]] -_TemplateByteType = Tuple[List[Tuple[int, int]], List[Optional[bytes]]] +_TemplateType: TypeAlias = tuple[list[tuple[int, int]], list[str | None]] +_TemplateByteType: TypeAlias = tuple[list[tuple[int, int]], list[bytes | None]] if sys.version_info >= (3, 8): def parse(str: str, flags: int = ..., state: State | None = ...) -> SubPattern: ... @overload diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 759b992..543433f 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -2,17 +2,18 @@ import enum import socket import sys from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer -from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Type, Union, overload -from typing_extensions import Literal, TypedDict +from collections.abc import Callable, Iterable +from typing import Any, NamedTuple, Union, overload +from typing_extensions import Literal, TypeAlias, TypedDict, final -_PCTRTT = Tuple[Tuple[str, str], ...] -_PCTRTTT = Tuple[_PCTRTT, ...] -_PeerCertRetDictType = Dict[str, Union[str, _PCTRTTT, _PCTRTT]] -_PeerCertRetType = Union[_PeerCertRetDictType, bytes, None] -_EnumRetType = List[Tuple[bytes, str, Union[Set[str], bool]]] -_PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes] +_PCTRTT: TypeAlias = tuple[tuple[str, str], ...] +_PCTRTTT: TypeAlias = tuple[_PCTRTT, ...] +_PeerCertRetDictType: TypeAlias = dict[str, str | _PCTRTTT | _PCTRTT] +_PeerCertRetType: TypeAlias = _PeerCertRetDictType | bytes | None +_EnumRetType: TypeAlias = list[tuple[bytes, str, set[str] | bool]] +_PasswordType: TypeAlias = Union[Callable[[], str | bytes | bytearray], str, bytes, bytearray] -_SrvnmeCbType = Callable[[Union[SSLSocket, SSLObject], Optional[str], SSLSocket], Optional[int]] +_SrvnmeCbType: TypeAlias = Callable[[SSLSocket | SSLObject, str | None, SSLSocket], int | None] class _Cipher(TypedDict): aead: bool @@ -37,13 +38,11 @@ class SSLWantWriteError(SSLError): ... class SSLSyscallError(SSLError): ... class SSLEOFError(SSLError): ... -if sys.version_info >= (3, 7): - class SSLCertVerificationError(SSLError, ValueError): - verify_code: int - verify_message: str - CertificateError = SSLCertVerificationError -else: - class CertificateError(ValueError): ... +class SSLCertVerificationError(SSLError, ValueError): + verify_code: int + verify_message: str + +CertificateError = SSLCertVerificationError def wrap_socket( sock: socket.socket, @@ -62,48 +61,43 @@ def create_default_context( *, cafile: StrOrBytesPath | None = ..., capath: StrOrBytesPath | None = ..., - cadata: str | bytes | None = ..., + cadata: str | ReadableBuffer | None = ..., +) -> SSLContext: ... +def _create_unverified_context( + protocol: int = ..., + *, + cert_reqs: int = ..., + check_hostname: bool = ..., + purpose: Purpose = ..., + certfile: StrOrBytesPath | None = ..., + keyfile: StrOrBytesPath | None = ..., + cafile: StrOrBytesPath | None = ..., + capath: StrOrBytesPath | None = ..., + cadata: str | ReadableBuffer | None = ..., ) -> SSLContext: ... - -if sys.version_info >= (3, 7): - def _create_unverified_context( - protocol: int = ..., - *, - cert_reqs: int = ..., - check_hostname: bool = ..., - purpose: Purpose = ..., - certfile: StrOrBytesPath | None = ..., - keyfile: StrOrBytesPath | None = ..., - cafile: StrOrBytesPath | None = ..., - capath: StrOrBytesPath | None = ..., - cadata: str | bytes | None = ..., - ) -> SSLContext: ... - -else: - def _create_unverified_context( - protocol: int = ..., - *, - cert_reqs: int | None = ..., - check_hostname: bool = ..., - purpose: Purpose = ..., - certfile: StrOrBytesPath | None = ..., - keyfile: StrOrBytesPath | None = ..., - cafile: StrOrBytesPath | None = ..., - capath: StrOrBytesPath | None = ..., - cadata: str | bytes | None = ..., - ) -> SSLContext: ... _create_default_https_context: Callable[..., SSLContext] def RAND_bytes(__num: int) -> bytes: ... -def RAND_pseudo_bytes(__num: int) -> Tuple[bytes, bool]: ... +def RAND_pseudo_bytes(__num: int) -> tuple[bytes, bool]: ... def RAND_status() -> bool: ... def RAND_egd(path: str) -> None: ... -def RAND_add(__s: bytes, __entropy: float) -> None: ... -def match_hostname(cert: _PeerCertRetType, hostname: str) -> None: ... +def RAND_add(__string: str | ReadableBuffer, __entropy: float) -> None: ... + +if sys.version_info < (3, 12): + def match_hostname(cert: _PeerCertRetDictType, hostname: str) -> None: ... + def cert_time_to_seconds(cert_time: str) -> int: ... -def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... -def DER_cert_to_PEM_cert(der_cert_bytes: bytes) -> str: ... + +if sys.version_info >= (3, 10): + def get_server_certificate( + addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ..., timeout: float = ... + ) -> str: ... + +else: + def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... + +def DER_cert_to_PEM_cert(der_cert_bytes: ReadableBuffer) -> str: ... def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... class DefaultVerifyPaths(NamedTuple): @@ -135,6 +129,9 @@ class VerifyFlags(enum.IntFlag): VERIFY_CRL_CHECK_CHAIN: int VERIFY_X509_STRICT: int VERIFY_X509_TRUSTED_FIRST: int + if sys.version_info >= (3, 10): + VERIFY_ALLOW_PROXY_CERTS: int + VERIFY_X509_PARTIAL_CHAIN: int VERIFY_DEFAULT: VerifyFlags VERIFY_CRL_CHECK_LEAF: VerifyFlags @@ -142,6 +139,10 @@ VERIFY_CRL_CHECK_CHAIN: VerifyFlags VERIFY_X509_STRICT: VerifyFlags VERIFY_X509_TRUSTED_FIRST: VerifyFlags +if sys.version_info >= (3, 10): + VERIFY_ALLOW_PROXY_CERTS: VerifyFlags + VERIFY_X509_PARTIAL_CHAIN: VerifyFlags + class _SSLMethod(enum.IntEnum): PROTOCOL_SSLv23: int PROTOCOL_SSLv2: int @@ -176,8 +177,7 @@ class Options(enum.IntFlag): OP_SINGLE_ECDH_USE: int OP_NO_COMPRESSION: int OP_NO_TICKET: int - if sys.version_info >= (3, 7): - OP_NO_RENEGOTIATION: int + OP_NO_RENEGOTIATION: int if sys.version_info >= (3, 8): OP_ENABLE_MIDDLEBOX_COMPAT: int @@ -193,19 +193,17 @@ OP_SINGLE_DH_USE: Options OP_SINGLE_ECDH_USE: Options OP_NO_COMPRESSION: Options OP_NO_TICKET: Options -if sys.version_info >= (3, 7): - OP_NO_RENEGOTIATION: Options +OP_NO_RENEGOTIATION: Options if sys.version_info >= (3, 8): OP_ENABLE_MIDDLEBOX_COMPAT: Options -if sys.version_info >= (3, 7): - HAS_NEVER_CHECK_COMMON_NAME: bool - HAS_SSLv2: bool - HAS_SSLv3: bool - HAS_TLSv1: bool - HAS_TLSv1_1: bool - HAS_TLSv1_2: bool - HAS_TLSv1_3: bool +HAS_NEVER_CHECK_COMMON_NAME: bool +HAS_SSLv2: bool +HAS_SSLv3: bool +HAS_TLSv1: bool +HAS_TLSv1_1: bool +HAS_TLSv1_2: bool +HAS_TLSv1_3: bool HAS_ALPN: bool HAS_ECDH: bool HAS_SNI: bool @@ -213,7 +211,7 @@ HAS_NPN: bool CHANNEL_BINDING_TYPES: list[str] OPENSSL_VERSION: str -OPENSSL_VERSION_INFO: Tuple[int, int, int, int, int] +OPENSSL_VERSION_INFO: tuple[int, int, int, int, int] OPENSSL_VERSION_NUMBER: int class AlertDescription(enum.IntEnum): @@ -279,9 +277,9 @@ class _ASN1Object(NamedTuple): longname: str oid: str @classmethod - def fromnid(cls: Type[Self], nid: int) -> Self: ... + def fromnid(cls: type[Self], nid: int) -> Self: ... @classmethod - def fromname(cls: Type[Self], name: str) -> Self: ... + def fromname(cls: type[Self], name: str) -> Self: ... class Purpose(_ASN1Object, enum.Enum): SERVER_AUTH: _ASN1Object @@ -292,33 +290,11 @@ class SSLSocket(socket.socket): server_side: bool server_hostname: str | None session: SSLSession | None - session_reused: bool | None - if sys.version_info < (3, 7): - def __init__( - self, - sock: socket.socket | None = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - server_side: bool = ..., - cert_reqs: int = ..., - ssl_version: int = ..., - ca_certs: str | None = ..., - do_handshake_on_connect: bool = ..., - family: int = ..., - type: int = ..., - proto: int = ..., - fileno: int | None = ..., - suppress_ragged_eofs: bool = ..., - npn_protocols: Iterable[str] | None = ..., - ciphers: str | None = ..., - server_hostname: str | None = ..., - _context: SSLContext | None = ..., - _session: Any | None = ..., - ) -> None: ... - else: - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def connect(self, addr: socket._Address | bytes) -> None: ... - def connect_ex(self, addr: socket._Address | bytes) -> int: ... + @property + def session_reused(self) -> bool | None: ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def connect(self, addr: socket._Address) -> None: ... + def connect_ex(self, addr: socket._Address) -> int: ... def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ... def recv_into(self, buffer: WriteableBuffer, nbytes: int | None = ..., flags: int = ...) -> int: ... def recvfrom(self, buflen: int = ..., flags: int = ...) -> tuple[bytes, socket._RetAddress]: ... @@ -328,12 +304,12 @@ class SSLSocket(socket.socket): def send(self, data: ReadableBuffer, flags: int = ...) -> int: ... def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ... @overload - def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address) -> int: ... + def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = ...) -> int: ... @overload - def sendto(self, data: ReadableBuffer, flags_or_addr: int | socket._Address, addr: socket._Address | None = ...) -> int: ... + def sendto(self, data: ReadableBuffer, flags_or_addr: int, addr: socket._Address) -> int: ... def shutdown(self, how: int) -> None: ... def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ... - def write(self, data: bytes) -> int: ... + def write(self, data: ReadableBuffer) -> int: ... def do_handshake(self, block: bool = ...) -> None: ... # block is undocumented @overload def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... @@ -341,28 +317,27 @@ class SSLSocket(socket.socket): def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... - def cipher(self) -> Tuple[str, str, int] | None: ... - def shared_ciphers(self) -> list[Tuple[str, str, int]] | None: ... + def cipher(self) -> tuple[str, str, int] | None: ... + def shared_ciphers(self) -> list[tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ... def selected_alpn_protocol(self) -> str | None: ... def selected_npn_protocol(self) -> str | None: ... - def accept(self) -> Tuple[SSLSocket, socket._RetAddress]: ... + def accept(self) -> tuple[SSLSocket, socket._RetAddress]: ... def unwrap(self) -> socket.socket: ... def version(self) -> str | None: ... def pending(self) -> int: ... if sys.version_info >= (3, 8): def verify_client_post_handshake(self) -> None: ... -if sys.version_info >= (3, 7): - class TLSVersion(enum.IntEnum): - MINIMUM_SUPPORTED: int - MAXIMUM_SUPPORTED: int - SSLv3: int - TLSv1: int - TLSv1_1: int - TLSv1_2: int - TLSv1_3: int +class TLSVersion(enum.IntEnum): + MINIMUM_SUPPORTED: int + MAXIMUM_SUPPORTED: int + SSLv3: int + TLSv1: int + TLSv1_1: int + TLSv1_2: int + TLSv1_3: int class SSLContext: check_hostname: bool @@ -371,36 +346,39 @@ class SSLContext: verify_mode: VerifyMode @property def protocol(self) -> _SSLMethod: ... - if sys.version_info >= (3, 7): - hostname_checks_common_name: bool - maximum_version: TLSVersion - minimum_version: TLSVersion - sni_callback: Callable[[SSLObject, str, SSLContext], None | int] | None - sslobject_class: ClassVar[Type[SSLObject]] - sslsocket_class: ClassVar[Type[SSLSocket]] + hostname_checks_common_name: bool + maximum_version: TLSVersion + minimum_version: TLSVersion + sni_callback: Callable[[SSLObject, str, SSLContext], None | int] | None + # The following two attributes have class-level defaults. + # However, the docs explicitly state that it's OK to override these attributes on instances, + # so making these ClassVars wouldn't be appropriate + sslobject_class: type[SSLObject] + sslsocket_class: type[SSLSocket] if sys.version_info >= (3, 8): keylog_filename: str post_handshake_auth: bool - def __new__(cls, protocol: int = ..., *args: Any, **kwargs: Any) -> SSLContext: ... - def __init__(self, protocol: int = ...) -> None: ... + def __new__(cls: type[Self], protocol: int = ..., *args: Any, **kwargs: Any) -> Self: ... def cert_store_stats(self) -> dict[str, int]: ... def load_cert_chain( self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = ..., password: _PasswordType | None = ... ) -> None: ... def load_default_certs(self, purpose: Purpose = ...) -> None: ... def load_verify_locations( - self, cafile: StrOrBytesPath | None = ..., capath: StrOrBytesPath | None = ..., cadata: str | bytes | None = ... + self, cafile: StrOrBytesPath | None = ..., capath: StrOrBytesPath | None = ..., cadata: str | ReadableBuffer | None = ... ) -> None: ... - def get_ca_certs(self, binary_form: bool = ...) -> list[_PeerCertRetDictType] | list[bytes]: ... + @overload + def get_ca_certs(self, binary_form: Literal[False] = ...) -> list[_PeerCertRetDictType]: ... + @overload + def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]: ... + @overload + def get_ca_certs(self, binary_form: bool = ...) -> Any: ... def get_ciphers(self) -> list[_Cipher]: ... def set_default_verify_paths(self) -> None: ... def set_ciphers(self, __cipherlist: str) -> None: ... def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ... def set_npn_protocols(self, npn_protocols: Iterable[str]) -> None: ... - if sys.version_info >= (3, 7): - def set_servername_callback(self, server_name_callback: _SrvnmeCbType | None) -> None: ... - else: - def set_servername_callback(self, __method: _SrvnmeCbType | None) -> None: ... + def set_servername_callback(self, server_name_callback: _SrvnmeCbType | None) -> None: ... def load_dh_params(self, __path: str) -> None: ... def set_ecdh_curve(self, __name: str) -> None: ... def wrap_socket( @@ -424,16 +402,16 @@ class SSLContext: class SSLObject: context: SSLContext - server_side: bool - server_hostname: str | None + @property + def server_side(self) -> bool: ... + @property + def server_hostname(self) -> str | None: ... session: SSLSession | None - session_reused: bool - if sys.version_info >= (3, 7): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - else: - def __init__(self, sslobj: Any, owner: SSLSocket | SSLObject | None = ..., session: Any | None = ...) -> None: ... + @property + def session_reused(self) -> bool: ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ... - def write(self, data: bytes) -> int: ... + def write(self, data: ReadableBuffer) -> int: ... @overload def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... @overload @@ -442,8 +420,8 @@ class SSLObject: def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... def selected_alpn_protocol(self) -> str | None: ... def selected_npn_protocol(self) -> str | None: ... - def cipher(self) -> Tuple[str, str, int] | None: ... - def shared_ciphers(self) -> list[Tuple[str, str, int]] | None: ... + def cipher(self) -> tuple[str, str, int] | None: ... + def shared_ciphers(self) -> list[tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... def pending(self) -> int: ... def do_handshake(self) -> None: ... @@ -453,19 +431,26 @@ class SSLObject: if sys.version_info >= (3, 8): def verify_client_post_handshake(self) -> None: ... +@final class MemoryBIO: pending: int eof: bool def read(self, __size: int = ...) -> bytes: ... - def write(self, __buf: bytes) -> int: ... + def write(self, __buf: ReadableBuffer) -> int: ... def write_eof(self) -> None: ... +@final class SSLSession: - id: bytes - time: int - timeout: int - ticket_lifetime_hint: int - has_ticket: bool + @property + def has_ticket(self) -> bool: ... + @property + def id(self) -> bytes: ... + @property + def ticket_lifetime_hint(self) -> int: ... + @property + def time(self) -> int: ... + @property + def timeout(self) -> int: ... class SSLErrorNumber(enum.IntEnum): SSL_ERROR_EOF: int diff --git a/stdlib/stat.pyi b/stdlib/stat.pyi index d6450fe..4518acb 100644 --- a/stdlib/stat.pyi +++ b/stdlib/stat.pyi @@ -1,97 +1 @@ -import sys - -def S_ISDIR(mode: int) -> bool: ... -def S_ISCHR(mode: int) -> bool: ... -def S_ISBLK(mode: int) -> bool: ... -def S_ISREG(mode: int) -> bool: ... -def S_ISFIFO(mode: int) -> bool: ... -def S_ISLNK(mode: int) -> bool: ... -def S_ISSOCK(mode: int) -> bool: ... -def S_IMODE(mode: int) -> int: ... -def S_IFMT(mode: int) -> int: ... -def S_ISDOOR(mode: int) -> int: ... -def S_ISPORT(mode: int) -> int: ... -def S_ISWHT(mode: int) -> int: ... -def filemode(mode: int) -> str: ... - -ST_MODE: int -ST_INO: int -ST_DEV: int -ST_NLINK: int -ST_UID: int -ST_GID: int -ST_SIZE: int -ST_ATIME: int -ST_MTIME: int -ST_CTIME: int - -S_IFSOCK: int -S_IFLNK: int -S_IFREG: int -S_IFBLK: int -S_IFDIR: int -S_IFCHR: int -S_IFIFO: int -S_IFDOOR: int -S_IFPORT: int -S_IFWHT: int -S_ISUID: int -S_ISGID: int -S_ISVTX: int - -S_IRWXU: int -S_IRUSR: int -S_IWUSR: int -S_IXUSR: int - -S_IRWXG: int -S_IRGRP: int -S_IWGRP: int -S_IXGRP: int - -S_IRWXO: int -S_IROTH: int -S_IWOTH: int -S_IXOTH: int - -S_ENFMT: int -S_IREAD: int -S_IWRITE: int -S_IEXEC: int - -UF_NODUMP: int -UF_IMMUTABLE: int -UF_APPEND: int -UF_OPAQUE: int -UF_NOUNLINK: int -if sys.platform == "darwin": - UF_COMPRESSED: int # OS X 10.6+ only - UF_HIDDEN: int # OX X 10.5+ only -SF_ARCHIVED: int -SF_IMMUTABLE: int -SF_APPEND: int -SF_NOUNLINK: int -SF_SNAPSHOT: int - -FILE_ATTRIBUTE_ARCHIVE: int -FILE_ATTRIBUTE_COMPRESSED: int -FILE_ATTRIBUTE_DEVICE: int -FILE_ATTRIBUTE_DIRECTORY: int -FILE_ATTRIBUTE_ENCRYPTED: int -FILE_ATTRIBUTE_HIDDEN: int -FILE_ATTRIBUTE_INTEGRITY_STREAM: int -FILE_ATTRIBUTE_NORMAL: int -FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: int -FILE_ATTRIBUTE_NO_SCRUB_DATA: int -FILE_ATTRIBUTE_OFFLINE: int -FILE_ATTRIBUTE_READONLY: int -FILE_ATTRIBUTE_REPARSE_POINT: int -FILE_ATTRIBUTE_SPARSE_FILE: int -FILE_ATTRIBUTE_SYSTEM: int -FILE_ATTRIBUTE_TEMPORARY: int -FILE_ATTRIBUTE_VIRTUAL: int - -if sys.platform == "win32" and sys.version_info >= (3, 8): - IO_REPARSE_TAG_SYMLINK: int - IO_REPARSE_TAG_MOUNT_POINT: int - IO_REPARSE_TAG_APPEXECLINK: int +from _stat import * diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index ec3574a..a01665a 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -1,12 +1,34 @@ import sys -from _typeshed import SupportsLessThanT +from _typeshed import Self, SupportsRichComparisonT +from collections.abc import Hashable, Iterable, Sequence from decimal import Decimal from fractions import Fraction -from typing import Any, Hashable, Iterable, NamedTuple, Sequence, SupportsFloat, Type, TypeVar, Union +from typing import Any, NamedTuple, SupportsFloat, TypeVar +from typing_extensions import Literal, TypeAlias + +__all__ = [ + "StatisticsError", + "pstdev", + "pvariance", + "stdev", + "variance", + "median", + "median_low", + "median_high", + "median_grouped", + "mean", + "mode", + "harmonic_mean", +] + +if sys.version_info >= (3, 8): + __all__ += ["geometric_mean", "multimode", "NormalDist", "fmean", "quantiles"] + +if sys.version_info >= (3, 10): + __all__ += ["covariance", "correlation", "linear_regression"] -_T = TypeVar("_T") # Most functions in this module accept homogeneous collections of one of these types -_Number = Union[float, Decimal, Fraction] +_Number: TypeAlias = float | Decimal | Fraction _NumberT = TypeVar("_NumberT", float, Decimal, Fraction) # Used in mode, multimode @@ -14,8 +36,13 @@ _HashableT = TypeVar("_HashableT", bound=Hashable) class StatisticsError(ValueError): ... -if sys.version_info >= (3, 8): +if sys.version_info >= (3, 11): + def fmean(data: Iterable[SupportsFloat], weights: Iterable[SupportsFloat] | None = ...) -> float: ... + +elif sys.version_info >= (3, 8): def fmean(data: Iterable[SupportsFloat]) -> float: ... + +if sys.version_info >= (3, 8): def geometric_mean(data: Iterable[SupportsFloat]) -> float: ... def mean(data: Iterable[_NumberT]) -> _NumberT: ... @@ -27,9 +54,15 @@ else: def harmonic_mean(data: Iterable[_NumberT]) -> _NumberT: ... def median(data: Iterable[_NumberT]) -> _NumberT: ... -def median_low(data: Iterable[SupportsLessThanT]) -> SupportsLessThanT: ... -def median_high(data: Iterable[SupportsLessThanT]) -> SupportsLessThanT: ... -def median_grouped(data: Iterable[_NumberT], interval: _NumberT = ...) -> _NumberT: ... +def median_low(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparisonT: ... +def median_high(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparisonT: ... + +if sys.version_info >= (3, 11): + def median_grouped(data: Iterable[SupportsFloat], interval: SupportsFloat = ...) -> float: ... + +else: + def median_grouped(data: Iterable[_NumberT], interval: _NumberT = ...) -> _NumberT | float: ... + def mode(data: Iterable[_HashableT]) -> _HashableT: ... if sys.version_info >= (3, 8): @@ -39,7 +72,9 @@ def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = ...) -> _NumberT: ... def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = ...) -> _NumberT: ... if sys.version_info >= (3, 8): - def quantiles(data: Iterable[_NumberT], *, n: int = ..., method: str = ...) -> list[_NumberT]: ... + def quantiles( + data: Iterable[_NumberT], *, n: int = ..., method: Literal["inclusive", "exclusive"] = ... + ) -> list[_NumberT]: ... def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = ...) -> _NumberT: ... def variance(data: Iterable[_NumberT], xbar: _NumberT | None = ...) -> _NumberT: ... @@ -58,7 +93,7 @@ if sys.version_info >= (3, 8): @property def variance(self) -> float: ... @classmethod - def from_samples(cls: Type[_T], data: Iterable[SupportsFloat]) -> _T: ... + def from_samples(cls: type[Self], data: Iterable[SupportsFloat]) -> Self: ... def samples(self, n: int, *, seed: Any | None = ...) -> list[float]: ... def pdf(self, x: float) -> float: ... def cdf(self, x: float) -> float: ... @@ -67,6 +102,8 @@ if sys.version_info >= (3, 8): def quantiles(self, n: int = ...) -> list[float]: ... if sys.version_info >= (3, 9): def zscore(self, x: float) -> float: ... + + def __eq__(self, x2: object) -> bool: ... def __add__(self, x2: float | NormalDist) -> NormalDist: ... def __sub__(self, x2: float | NormalDist) -> NormalDist: ... def __mul__(self, x2: float) -> NormalDist: ... @@ -76,12 +113,19 @@ if sys.version_info >= (3, 8): __radd__ = __add__ def __rsub__(self, x2: float | NormalDist) -> NormalDist: ... __rmul__ = __mul__ - def __hash__(self) -> int: ... if sys.version_info >= (3, 10): def correlation(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ... def covariance(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ... + class LinearRegression(NamedTuple): slope: float intercept: float + +if sys.version_info >= (3, 11): + def linear_regression( + __regressor: Sequence[_Number], __dependent_variable: Sequence[_Number], *, proportional: bool = ... + ) -> LinearRegression: ... + +elif sys.version_info >= (3, 10): def linear_regression(__regressor: Sequence[_Number], __dependent_variable: Sequence[_Number]) -> LinearRegression: ... diff --git a/stdlib/string.pyi b/stdlib/string.pyi index 321b264..6fb803f 100644 --- a/stdlib/string.pyi +++ b/stdlib/string.pyi @@ -1,40 +1,72 @@ import sys -from re import RegexFlag -from typing import Any, Iterable, Mapping, Sequence, Tuple +from _typeshed import StrOrLiteralStr +from collections.abc import Iterable, Mapping, Sequence +from re import Pattern, RegexFlag +from typing import Any, ClassVar, overload +from typing_extensions import LiteralString, TypeAlias -if sys.version_info >= (3, 8): - from re import Pattern -else: - from typing import Pattern +__all__ = [ + "ascii_letters", + "ascii_lowercase", + "ascii_uppercase", + "capwords", + "digits", + "hexdigits", + "octdigits", + "printable", + "punctuation", + "whitespace", + "Formatter", + "Template", +] + +ascii_letters: LiteralString +ascii_lowercase: LiteralString +ascii_uppercase: LiteralString +digits: LiteralString +hexdigits: LiteralString +octdigits: LiteralString +punctuation: LiteralString +printable: LiteralString +whitespace: LiteralString -ascii_letters: str -ascii_lowercase: str -ascii_uppercase: str -digits: str -hexdigits: str -octdigits: str -punctuation: str -printable: str -whitespace: str +def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = ...) -> StrOrLiteralStr: ... -def capwords(s: str, sep: str | None = ...) -> str: ... +if sys.version_info >= (3, 9): + _TemplateMetaclass: TypeAlias = type +else: + class _TemplateMetaclass(type): + pattern: ClassVar[str] + def __init__(cls, name: str, bases: tuple[type, ...], dct: dict[str, Any]) -> None: ... -class Template: +class Template(metaclass=_TemplateMetaclass): template: str - delimiter: str - idpattern: str - braceidpattern: str | None - flags: RegexFlag - pattern: Pattern[str] + delimiter: ClassVar[str] + idpattern: ClassVar[str] + braceidpattern: ClassVar[str | None] + flags: ClassVar[RegexFlag] + pattern: ClassVar[Pattern[str]] def __init__(self, template: str) -> None: ... def substitute(self, __mapping: Mapping[str, object] = ..., **kwds: object) -> str: ... def safe_substitute(self, __mapping: Mapping[str, object] = ..., **kwds: object) -> str: ... + if sys.version_info >= (3, 11): + def get_identifiers(self) -> list[str]: ... + def is_valid(self) -> bool: ... -# TODO(MichalPokorny): This is probably badly and/or loosely typed. class Formatter: + @overload + def format(self, __format_string: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ... + @overload def format(self, __format_string: str, *args: Any, **kwargs: Any) -> str: ... + @overload + def vformat( + self, format_string: LiteralString, args: Sequence[LiteralString], kwargs: Mapping[LiteralString, LiteralString] + ) -> LiteralString: ... + @overload def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ... - def parse(self, format_string: str) -> Iterable[Tuple[str, str | None, str | None, str | None]]: ... + def parse( + self, format_string: StrOrLiteralStr + ) -> Iterable[tuple[StrOrLiteralStr, StrOrLiteralStr | None, StrOrLiteralStr | None, StrOrLiteralStr | None]]: ... def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... def get_value(self, key: int | str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... def check_unused_args(self, used_args: Sequence[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ... diff --git a/stdlib/stringprep.pyi b/stdlib/stringprep.pyi index cbc562d..fc28c02 100644 --- a/stdlib/stringprep.pyi +++ b/stdlib/stringprep.pyi @@ -1,3 +1,11 @@ +b1_set: set[int] +b3_exceptions: dict[int, str] +c22_specials: set[int] +c6_set: set[int] +c7_set: set[int] +c8_set: set[int] +c9_set: set[int] + def in_table_a1(code: str) -> bool: ... def in_table_b1(code: str) -> bool: ... def map_table_b3(code: str) -> str: ... diff --git a/stdlib/struct.pyi b/stdlib/struct.pyi index d7c9cbe..0209738 100644 --- a/stdlib/struct.pyi +++ b/stdlib/struct.pyi @@ -1,25 +1,26 @@ -import sys from _typeshed import ReadableBuffer, WriteableBuffer -from typing import Any, Iterator, Tuple +from collections.abc import Iterator +from typing import Any + +__all__ = ["calcsize", "pack", "pack_into", "unpack", "unpack_from", "iter_unpack", "Struct", "error"] class error(Exception): ... -def pack(fmt: str | bytes, *v: Any) -> bytes: ... -def pack_into(fmt: str | bytes, buffer: WriteableBuffer, offset: int, *v: Any) -> None: ... -def unpack(__format: str | bytes, __buffer: ReadableBuffer) -> Tuple[Any, ...]: ... -def unpack_from(__format: str | bytes, buffer: ReadableBuffer, offset: int = ...) -> Tuple[Any, ...]: ... -def iter_unpack(__format: str | bytes, __buffer: ReadableBuffer) -> Iterator[Tuple[Any, ...]]: ... +def pack(__fmt: str | bytes, *v: Any) -> bytes: ... +def pack_into(__fmt: str | bytes, __buffer: WriteableBuffer, __offset: int, *v: Any) -> None: ... +def unpack(__format: str | bytes, __buffer: ReadableBuffer) -> tuple[Any, ...]: ... +def unpack_from(__format: str | bytes, buffer: ReadableBuffer, offset: int = ...) -> tuple[Any, ...]: ... +def iter_unpack(__format: str | bytes, __buffer: ReadableBuffer) -> Iterator[tuple[Any, ...]]: ... def calcsize(__format: str | bytes) -> int: ... class Struct: - if sys.version_info >= (3, 7): - format: str - else: - format: bytes - size: int + @property + def format(self) -> str: ... + @property + def size(self) -> int: ... def __init__(self, format: str | bytes) -> None: ... def pack(self, *v: Any) -> bytes: ... def pack_into(self, buffer: WriteableBuffer, offset: int, *v: Any) -> None: ... - def unpack(self, __buffer: ReadableBuffer) -> Tuple[Any, ...]: ... - def unpack_from(self, buffer: ReadableBuffer, offset: int = ...) -> Tuple[Any, ...]: ... - def iter_unpack(self, __buffer: ReadableBuffer) -> Iterator[Tuple[Any, ...]]: ... + def unpack(self, __buffer: ReadableBuffer) -> tuple[Any, ...]: ... + def unpack_from(self, buffer: ReadableBuffer, offset: int = ...) -> tuple[Any, ...]: ... + def iter_unpack(self, __buffer: ReadableBuffer) -> Iterator[tuple[Any, ...]]: ... diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index ed8dce2..25b988a 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -1,12 +1,53 @@ import sys from _typeshed import Self, StrOrBytesPath +from collections.abc import Callable, Iterable, Mapping, Sequence from types import TracebackType -from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Mapping, Sequence, Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal +from typing import IO, Any, AnyStr, Generic, TypeVar, overload +from typing_extensions import Literal, TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = [ + "Popen", + "PIPE", + "STDOUT", + "call", + "check_call", + "getstatusoutput", + "getoutput", + "check_output", + "run", + "CalledProcessError", + "DEVNULL", + "SubprocessError", + "TimeoutExpired", + "CompletedProcess", +] + +if sys.platform == "win32": + __all__ += [ + "CREATE_NEW_CONSOLE", + "CREATE_NEW_PROCESS_GROUP", + "STARTF_USESHOWWINDOW", + "STARTF_USESTDHANDLES", + "STARTUPINFO", + "STD_ERROR_HANDLE", + "STD_INPUT_HANDLE", + "STD_OUTPUT_HANDLE", + "SW_HIDE", + "ABOVE_NORMAL_PRIORITY_CLASS", + "BELOW_NORMAL_PRIORITY_CLASS", + "CREATE_BREAKAWAY_FROM_JOB", + "CREATE_DEFAULT_ERROR_MODE", + "CREATE_NO_WINDOW", + "DETACHED_PROCESS", + "HIGH_PRIORITY_CLASS", + "IDLE_PRIORITY_CLASS", + "NORMAL_PRIORITY_CLASS", + "REALTIME_PRIORITY_CLASS", + ] + # We prefer to annotate inputs to methods (eg subprocess.check_call) with these # union types. # For outputs we use laborious literal based overloads to try to determine @@ -21,21 +62,27 @@ if sys.version_info >= (3, 9): # reveal_type(x) # bytes, based on the overloads # except TimeoutError as e: # reveal_type(e.cmd) # Any, but morally is _CMD -_FILE = Union[None, int, IO[Any]] -_TXT = Union[bytes, str] +_FILE: TypeAlias = None | int | IO[Any] +_TXT: TypeAlias = bytes | str if sys.version_info >= (3, 8): - _CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]] + _CMD: TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath] else: - # Python 3.6 doesn't support _CMD being a single PathLike. + # Python 3.7 doesn't support _CMD being a single PathLike. # See: https://bugs.python.org/issue31961 - _CMD = Union[_TXT, Sequence[StrOrBytesPath]] + _CMD: TypeAlias = _TXT | Sequence[StrOrBytesPath] if sys.platform == "win32": - _ENV = Mapping[str, str] + _ENV: TypeAlias = Mapping[str, str] else: - _ENV = Union[Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]] + _ENV: TypeAlias = Mapping[bytes, StrOrBytesPath] | Mapping[str, StrOrBytesPath] _T = TypeVar("_T") +# These two are private but documented +if sys.version_info >= (3, 11): + _USE_VFORK: bool +if sys.version_info >= (3, 8): + _USE_POSIX_SPAWN: bool + class CompletedProcess(Generic[_T]): # morally: _CMD args: Any @@ -44,13 +91,20 @@ class CompletedProcess(Generic[_T]): # and writing all the overloads would be horrific. stdout: _T stderr: _T - def __init__(self, args: _CMD, returncode: int, stdout: _T | None = ..., stderr: _T | None = ...) -> None: ... + # pyright ignore on __init__ because the TypeVar can technically be unsolved, but see comment above + def __init__( + self, + args: _CMD, + returncode: int, + stdout: _T | None = ..., # pyright: ignore[reportInvalidTypeVarUse] + stderr: _T | None = ..., # pyright: ignore[reportInvalidTypeVarUse] + ) -> None: ... def check_returncode(self) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -if sys.version_info >= (3, 7): - # Nearly the same args as for 3.6, except for capture_output and text +if sys.version_info >= (3, 11): + # 3.11 adds "process_group" argument @overload def run( args: _CMD, @@ -78,6 +132,12 @@ if sys.version_info >= (3, 7): input: str | None = ..., text: Literal[True], timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -106,6 +166,12 @@ if sys.version_info >= (3, 7): input: str | None = ..., text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -134,6 +200,12 @@ if sys.version_info >= (3, 7): input: str | None = ..., text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -163,6 +235,12 @@ if sys.version_info >= (3, 7): input: str | None = ..., text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -191,6 +269,12 @@ if sys.version_info >= (3, 7): input: bytes | None = ..., text: Literal[None, False] = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., ) -> CompletedProcess[bytes]: ... @overload def run( @@ -219,10 +303,49 @@ if sys.version_info >= (3, 7): input: _TXT | None = ..., text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., ) -> CompletedProcess[Any]: ... -else: - # Nearly same args as Popen.__init__ except for timeout, input, and check +elif sys.version_info >= (3, 10): + # 3.10 adds "pipesize" argument + @overload + def run( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + capture_output: bool = ..., + check: bool = ..., + encoding: str | None = ..., + errors: str | None = ..., + input: str | None = ..., + text: Literal[True], + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> CompletedProcess[str]: ... @overload def run( args: _CMD, @@ -243,11 +366,18 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, + capture_output: bool = ..., check: bool = ..., encoding: str, errors: str | None = ..., input: str | None = ..., + text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -269,11 +399,18 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, + capture_output: bool = ..., check: bool = ..., encoding: str | None = ..., errors: str, input: str | None = ..., + text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -296,11 +433,18 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., # where the *real* keyword only args start + capture_output: bool = ..., check: bool = ..., encoding: str | None = ..., errors: str | None = ..., input: str | None = ..., + text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., ) -> CompletedProcess[str]: ... @overload def run( @@ -322,11 +466,18 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, + capture_output: bool = ..., check: bool = ..., encoding: None = ..., errors: None = ..., input: bytes | None = ..., + text: Literal[None, False] = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., ) -> CompletedProcess[bytes]: ... @overload def run( @@ -348,66 +499,29 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, + capture_output: bool = ..., check: bool = ..., encoding: str | None = ..., errors: str | None = ..., input: _TXT | None = ..., + text: bool | None = ..., timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., ) -> CompletedProcess[Any]: ... -# Same args as Popen.__init__ -def call( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., -) -> int: ... - -# Same args as Popen.__init__ -def check_call( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float | None = ..., -) -> int: ... - -if sys.version_info >= (3, 7): - # 3.7 added text +elif sys.version_info >= (3, 9): + # 3.9 adds arguments "user", "group", "extra_groups" and "umask" @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -421,18 +535,25 @@ if sys.version_info >= (3, 7): start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str | None = ..., + input: str | None = ..., text: Literal[True], - ) -> str: ... + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -446,18 +567,25 @@ if sys.version_info >= (3, 7): start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: str, errors: str | None = ..., + input: str | None = ..., text: bool | None = ..., - ) -> str: ... + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -471,18 +599,25 @@ if sys.version_info >= (3, 7): start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str, + input: str | None = ..., text: bool | None = ..., - ) -> str: ... + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -496,19 +631,26 @@ if sys.version_info >= (3, 7): restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Any = ..., - # where the real keyword only ones start - timeout: float | None = ..., - input: _TXT | None = ..., + # where the *real* keyword only args start + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str | None = ..., + input: str | None = ..., text: bool | None = ..., - ) -> str: ... + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -522,18 +664,25 @@ if sys.version_info >= (3, 7): start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: None = ..., errors: None = ..., + input: bytes | None = ..., text: Literal[None, False] = ..., - ) -> bytes: ... + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> CompletedProcess[bytes]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -547,20 +696,27 @@ if sys.version_info >= (3, 7): start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str | None = ..., + input: _TXT | None = ..., text: bool | None = ..., - ) -> Any: ... # morally: -> _TXT + timeout: float | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> CompletedProcess[Any]: ... else: @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -574,17 +730,49 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, + capture_output: bool = ..., + check: bool = ..., + encoding: str | None = ..., + errors: str | None = ..., + input: str | None = ..., + text: Literal[True], timeout: float | None = ..., - input: _TXT | None = ..., + ) -> CompletedProcess[str]: ... + @overload + def run( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + capture_output: bool = ..., + check: bool = ..., encoding: str, errors: str | None = ..., - ) -> str: ... + input: str | None = ..., + text: bool | None = ..., + timeout: float | None = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -598,41 +786,50 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str, - ) -> str: ... + input: str | None = ..., + text: bool | None = ..., + timeout: float | None = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: StrOrBytesPath | None = ..., env: _ENV | None = ..., + *, + universal_newlines: Literal[True], startupinfo: Any = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Any = ..., - *, - universal_newlines: Literal[True], - timeout: float | None = ..., - input: _TXT | None = ..., + # where the *real* keyword only args start + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str | None = ..., - ) -> str: ... + input: str | None = ..., + text: bool | None = ..., + timeout: float | None = ..., + ) -> CompletedProcess[str]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -646,17 +843,21 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: None = ..., errors: None = ..., - ) -> bytes: ... + input: bytes | None = ..., + text: Literal[None, False] = ..., + timeout: float | None = ..., + ) -> CompletedProcess[bytes]: ... @overload - def check_output( + def run( args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., stdin: _FILE = ..., + stdout: _FILE = ..., stderr: _FILE = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., @@ -670,27 +871,965 @@ else: start_new_session: bool = ..., pass_fds: Any = ..., *, - timeout: float | None = ..., - input: _TXT | None = ..., + capture_output: bool = ..., + check: bool = ..., encoding: str | None = ..., errors: str | None = ..., - ) -> Any: ... # morally: -> _TXT + input: _TXT | None = ..., + text: bool | None = ..., + timeout: float | None = ..., + ) -> CompletedProcess[Any]: ... -PIPE: int -STDOUT: int -DEVNULL: int +# Same args as Popen.__init__ +if sys.version_info >= (3, 11): + # 3.11 adds "process_group" argument + def call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> int: ... -class SubprocessError(Exception): ... +elif sys.version_info >= (3, 10): + # 3.10 adds "pipesize" argument + def call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> int: ... -class TimeoutExpired(SubprocessError): +elif sys.version_info >= (3, 9): + # 3.9 adds arguments "user", "group", "extra_groups" and "umask" + def call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> int: ... + +else: + def call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + text: bool | None = ..., + ) -> int: ... + +# Same args as Popen.__init__ +if sys.version_info >= (3, 11): + # 3.11 adds "process_group" argument + def check_call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float | None = ..., + *, + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> int: ... + +elif sys.version_info >= (3, 10): + # 3.10 adds "pipesize" argument + def check_call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float | None = ..., + *, + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> int: ... + +elif sys.version_info >= (3, 9): + # 3.9 adds arguments "user", "group", "extra_groups" and "umask" + def check_call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float | None = ..., + *, + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> int: ... + +else: + def check_call( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float | None = ..., + *, + text: bool | None = ..., + ) -> int: ... + +if sys.version_info >= (3, 11): + # 3.11 adds "process_group" argument + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: Literal[True], + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str, + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str, + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + *, + universal_newlines: Literal[True], + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + # where the real keyword only ones start + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: Literal[False] = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: None = ..., + errors: None = ..., + text: Literal[None, False] = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> bytes: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> Any: ... # morally: -> _TXT + +elif sys.version_info >= (3, 10): + # 3.10 adds "pipesize" argument + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: Literal[True], + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str, + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str, + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + *, + universal_newlines: Literal[True], + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + # where the real keyword only ones start + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: Literal[False] = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: None = ..., + errors: None = ..., + text: Literal[None, False] = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> bytes: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> Any: ... # morally: -> _TXT + +elif sys.version_info >= (3, 9): + # 3.9 adds arguments "user", "group", "extra_groups" and "umask" + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: Literal[True], + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str, + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str, + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + *, + universal_newlines: Literal[True], + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + # where the real keyword only ones start + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: Literal[False] = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: None = ..., + errors: None = ..., + text: Literal[None, False] = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> bytes: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> Any: ... # morally: -> _TXT + +else: + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: Literal[True], + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str, + errors: str | None = ..., + text: bool | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str, + text: bool | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + *, + universal_newlines: Literal[True], + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + # where the real keyword only ones start + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + ) -> str: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: Literal[False] = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: None = ..., + errors: None = ..., + text: Literal[None, False] = ..., + ) -> bytes: ... + @overload + def check_output( + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float | None = ..., + input: _TXT | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + text: bool | None = ..., + ) -> Any: ... # morally: -> _TXT + +PIPE: int +STDOUT: int +DEVNULL: int + +class SubprocessError(Exception): ... + +class TimeoutExpired(SubprocessError): def __init__(self, cmd: _CMD, timeout: float, output: _TXT | None = ..., stderr: _TXT | None = ...) -> None: ... # morally: _CMD cmd: Any timeout: float # morally: _TXT | None output: Any - stdout: Any - stderr: Any + stdout: bytes | None + stderr: bytes | None class CalledProcessError(SubprocessError): returncode: int @@ -710,17 +1849,386 @@ class Popen(Generic[AnyStr]): stdout: IO[AnyStr] | None stderr: IO[AnyStr] | None pid: int - returncode: int + returncode: int | Any universal_newlines: bool - # Technically it is wrong that Popen provides __new__ instead of __init__ - # but this shouldn't come up hopefully? - - if sys.version_info >= (3, 7): - # text is added in 3.7 + if sys.version_info >= (3, 11): + # process_group is added in 3.11 + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: bool | None = ..., + encoding: str, + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: bool | None = ..., + encoding: str | None = ..., + errors: str, + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + *, + universal_newlines: Literal[True], + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + # where the *real* keyword only args start + text: bool | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: Literal[True], + encoding: str | None = ..., + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[bytes], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: Literal[False] = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: Literal[None, False] = ..., + encoding: None = ..., + errors: None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[Any], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: bool | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + process_group: int | None = ..., + ) -> None: ... + elif sys.version_info >= (3, 10): + # pipesize is added in 3.10 + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: bool | None = ..., + encoding: str, + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: bool | None = ..., + encoding: str | None = ..., + errors: str, + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + *, + universal_newlines: Literal[True], + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + # where the *real* keyword only args start + text: bool | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: Literal[True], + encoding: str | None = ..., + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[bytes], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: Literal[False] = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: Literal[None, False] = ..., + encoding: None = ..., + errors: None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[Any], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: bool | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + pipesize: int = ..., + ) -> None: ... + elif sys.version_info >= (3, 9): + # user, group, extra_groups, umask were added in 3.9 @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -742,10 +2250,14 @@ class Popen(Generic[AnyStr]): text: bool | None = ..., encoding: str, errors: str | None = ..., - ) -> Popen[str]: ... + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -767,10 +2279,14 @@ class Popen(Generic[AnyStr]): text: bool | None = ..., encoding: str | None = ..., errors: str, - ) -> Popen[str]: ... + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -793,10 +2309,14 @@ class Popen(Generic[AnyStr]): text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., - ) -> Popen[str]: ... + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -818,10 +2338,14 @@ class Popen(Generic[AnyStr]): text: Literal[True], encoding: str | None = ..., errors: str | None = ..., - ) -> Popen[str]: ... + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[bytes], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -843,10 +2367,14 @@ class Popen(Generic[AnyStr]): text: Literal[None, False] = ..., encoding: None = ..., errors: None = ..., - ) -> Popen[bytes]: ... + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[Any], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -868,11 +2396,15 @@ class Popen(Generic[AnyStr]): text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., - ) -> Popen[Any]: ... + user: str | int | None = ..., + group: str | int | None = ..., + extra_groups: Iterable[str | int] | None = ..., + umask: int = ..., + ) -> None: ... else: @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -891,12 +2423,13 @@ class Popen(Generic[AnyStr]): start_new_session: bool = ..., pass_fds: Any = ..., *, + text: bool | None = ..., encoding: str, errors: str | None = ..., - ) -> Popen[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -915,12 +2448,13 @@ class Popen(Generic[AnyStr]): start_new_session: bool = ..., pass_fds: Any = ..., *, + text: bool | None = ..., encoding: str | None = ..., errors: str, - ) -> Popen[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[str], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -940,12 +2474,38 @@ class Popen(Generic[AnyStr]): start_new_session: bool = ..., pass_fds: Any = ..., # where the *real* keyword only args start + text: bool | None = ..., + encoding: str | None = ..., + errors: str | None = ..., + ) -> None: ... + @overload + def __init__( + self: Popen[str], + args: _CMD, + bufsize: int = ..., + executable: StrOrBytesPath | None = ..., + stdin: _FILE | None = ..., + stdout: _FILE | None = ..., + stderr: _FILE | None = ..., + preexec_fn: Callable[[], Any] | None = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: StrOrBytesPath | None = ..., + env: _ENV | None = ..., + universal_newlines: bool = ..., + startupinfo: Any | None = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + text: Literal[True], encoding: str | None = ..., errors: str | None = ..., - ) -> Popen[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[bytes], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -964,12 +2524,13 @@ class Popen(Generic[AnyStr]): start_new_session: bool = ..., pass_fds: Any = ..., *, + text: Literal[None, False] = ..., encoding: None = ..., errors: None = ..., - ) -> Popen[bytes]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: Popen[Any], args: _CMD, bufsize: int = ..., executable: StrOrBytesPath | None = ..., @@ -988,72 +2549,80 @@ class Popen(Generic[AnyStr]): start_new_session: bool = ..., pass_fds: Any = ..., *, + text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., - ) -> Popen[Any]: ... + ) -> None: ... + def poll(self) -> int | None: ... - if sys.version_info >= (3, 7): - def wait(self, timeout: float | None = ...) -> int: ... - else: - def wait(self, timeout: float | None = ..., endtime: float | None = ...) -> int: ... + def wait(self, timeout: float | None = ...) -> int: ... # Return str/bytes def communicate( self, input: AnyStr | None = ..., timeout: float | None = ..., # morally this should be optional - ) -> Tuple[AnyStr, AnyStr]: ... + ) -> tuple[AnyStr, AnyStr]: ... def send_signal(self, sig: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... # The result really is always a str. -def getstatusoutput(cmd: _TXT) -> Tuple[int, str]: ... -def getoutput(cmd: _TXT) -> str: ... -def list2cmdline(seq: Iterable[str]) -> str: ... # undocumented +if sys.version_info >= (3, 11): + def getstatusoutput(cmd: _TXT, *, encoding: str | None = ..., errors: str | None = ...) -> tuple[int, str]: ... + def getoutput(cmd: _TXT, *, encoding: str | None = ..., errors: str | None = ...) -> str: ... + +else: + def getstatusoutput(cmd: _TXT) -> tuple[int, str]: ... + def getoutput(cmd: _TXT) -> str: ... + +if sys.version_info >= (3, 8): + def list2cmdline(seq: Iterable[StrOrBytesPath]) -> str: ... # undocumented + +else: + def list2cmdline(seq: Iterable[str]) -> str: ... # undocumented if sys.platform == "win32": class STARTUPINFO: - if sys.version_info >= (3, 7): - def __init__( - self, - *, - dwFlags: int = ..., - hStdInput: Any | None = ..., - hStdOutput: Any | None = ..., - hStdError: Any | None = ..., - wShowWindow: int = ..., - lpAttributeList: Mapping[str, Any] | None = ..., - ) -> None: ... + def __init__( + self, + *, + dwFlags: int = ..., + hStdInput: Any | None = ..., + hStdOutput: Any | None = ..., + hStdError: Any | None = ..., + wShowWindow: int = ..., + lpAttributeList: Mapping[str, Any] | None = ..., + ) -> None: ... dwFlags: int hStdInput: Any | None hStdOutput: Any | None hStdError: Any | None wShowWindow: int - if sys.version_info >= (3, 7): - lpAttributeList: Mapping[str, Any] - STD_INPUT_HANDLE: Any - STD_OUTPUT_HANDLE: Any - STD_ERROR_HANDLE: Any - SW_HIDE: int - STARTF_USESTDHANDLES: int - STARTF_USESHOWWINDOW: int - CREATE_NEW_CONSOLE: int - CREATE_NEW_PROCESS_GROUP: int - if sys.version_info >= (3, 7): - ABOVE_NORMAL_PRIORITY_CLASS: int - BELOW_NORMAL_PRIORITY_CLASS: int - HIGH_PRIORITY_CLASS: int - IDLE_PRIORITY_CLASS: int - NORMAL_PRIORITY_CLASS: int - REALTIME_PRIORITY_CLASS: int - CREATE_NO_WINDOW: int - DETACHED_PROCESS: int - CREATE_DEFAULT_ERROR_MODE: int - CREATE_BREAKAWAY_FROM_JOB: int + lpAttributeList: Mapping[str, Any] + from _winapi import ( + ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS, + BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS, + CREATE_BREAKAWAY_FROM_JOB as CREATE_BREAKAWAY_FROM_JOB, + CREATE_DEFAULT_ERROR_MODE as CREATE_DEFAULT_ERROR_MODE, + CREATE_NEW_CONSOLE as CREATE_NEW_CONSOLE, + CREATE_NEW_PROCESS_GROUP as CREATE_NEW_PROCESS_GROUP, + CREATE_NO_WINDOW as CREATE_NO_WINDOW, + DETACHED_PROCESS as DETACHED_PROCESS, + HIGH_PRIORITY_CLASS as HIGH_PRIORITY_CLASS, + IDLE_PRIORITY_CLASS as IDLE_PRIORITY_CLASS, + NORMAL_PRIORITY_CLASS as NORMAL_PRIORITY_CLASS, + REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS, + STARTF_USESHOWWINDOW as STARTF_USESHOWWINDOW, + STARTF_USESTDHANDLES as STARTF_USESTDHANDLES, + STD_ERROR_HANDLE as STD_ERROR_HANDLE, + STD_INPUT_HANDLE as STD_INPUT_HANDLE, + STD_OUTPUT_HANDLE as STD_OUTPUT_HANDLE, + SW_HIDE as SW_HIDE, + ) diff --git a/stdlib/sunau.pyi b/stdlib/sunau.pyi index 8393136..5b21cb0 100644 --- a/stdlib/sunau.pyi +++ b/stdlib/sunau.pyi @@ -1,8 +1,9 @@ import sys from _typeshed import Self -from typing import IO, Any, NamedTuple, NoReturn, Union +from typing import IO, Any, NamedTuple, NoReturn, overload +from typing_extensions import Literal, TypeAlias -_File = Union[str, IO[bytes]] +_File: TypeAlias = str | IO[bytes] class Error(Exception): ... @@ -32,7 +33,7 @@ class _sunau_params(NamedTuple): class Au_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getfp(self) -> IO[bytes] | None: ... def rewind(self) -> None: ... def close(self) -> None: ... @@ -52,7 +53,7 @@ class Au_read: class Au_write: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def setnchannels(self, nchannels: int) -> None: ... def getnchannels(self) -> int: ... def setsampwidth(self, sampwidth: int) -> None: ... @@ -72,7 +73,11 @@ class Au_write: def writeframes(self, data: bytes) -> None: ... def close(self) -> None: ... -# Returns a Au_read if mode is rb and Au_write if mode is wb +@overload +def open(f: _File, mode: Literal["r", "rb"]) -> Au_read: ... +@overload +def open(f: _File, mode: Literal["w", "wb"]) -> Au_write: ... +@overload def open(f: _File, mode: str | None = ...) -> Any: ... if sys.version_info < (3, 9): diff --git a/stdlib/symbol.pyi b/stdlib/symbol.pyi index 2d3bd83..bb66603 100644 --- a/stdlib/symbol.pyi +++ b/stdlib/symbol.pyi @@ -1,3 +1,5 @@ +import sys + single_input: int file_input: int eval_input: int @@ -84,5 +86,12 @@ comp_if: int encoding_decl: int yield_expr: int yield_arg: int +sync_comp_for: int +if sys.version_info >= (3, 8): + func_body_suite: int + func_type: int + func_type_input: int + namedexpr_test: int + typelist: int sym_name: dict[int, str] diff --git a/stdlib/symtable.pyi b/stdlib/symtable.pyi index 613ac90..98b62ed 100644 --- a/stdlib/symtable.pyi +++ b/stdlib/symtable.pyi @@ -1,9 +1,13 @@ import sys -from typing import Any, Sequence, Tuple +from _collections_abc import dict_keys +from collections.abc import Sequence +from typing import Any + +__all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"] def symtable(code: str, filename: str, compile_type: str) -> SymbolTable: ... -class SymbolTable(object): +class SymbolTable: def __init__(self, raw_table: Any, filename: str) -> None: ... def get_type(self) -> str: ... def get_id(self) -> int: ... @@ -12,28 +16,34 @@ class SymbolTable(object): def is_optimized(self) -> bool: ... def is_nested(self) -> bool: ... def has_children(self) -> bool: ... - def has_exec(self) -> bool: ... - def get_identifiers(self) -> Sequence[str]: ... + if sys.version_info < (3, 9): + def has_exec(self) -> bool: ... + + def get_identifiers(self) -> dict_keys[str, int]: ... def lookup(self, name: str) -> Symbol: ... def get_symbols(self) -> list[Symbol]: ... def get_children(self) -> list[SymbolTable]: ... class Function(SymbolTable): - def get_parameters(self) -> Tuple[str, ...]: ... - def get_locals(self) -> Tuple[str, ...]: ... - def get_globals(self) -> Tuple[str, ...]: ... - def get_frees(self) -> Tuple[str, ...]: ... + def get_parameters(self) -> tuple[str, ...]: ... + def get_locals(self) -> tuple[str, ...]: ... + def get_globals(self) -> tuple[str, ...]: ... + def get_frees(self) -> tuple[str, ...]: ... + if sys.version_info >= (3, 8): + def get_nonlocals(self) -> tuple[str, ...]: ... class Class(SymbolTable): - def get_methods(self) -> Tuple[str, ...]: ... + def get_methods(self) -> tuple[str, ...]: ... -class Symbol(object): +class Symbol: if sys.version_info >= (3, 8): def __init__( self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ..., *, module_scope: bool = ... ) -> None: ... + def is_nonlocal(self) -> bool: ... else: def __init__(self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ...) -> None: ... + def get_name(self) -> str: ... def is_referenced(self) -> bool: ... def is_parameter(self) -> bool: ... @@ -48,7 +58,6 @@ class Symbol(object): def get_namespaces(self) -> Sequence[SymbolTable]: ... def get_namespace(self) -> SymbolTable: ... -class SymbolTableFactory(object): - def __init__(self) -> None: ... +class SymbolTableFactory: def new(self, table: Any, filename: str) -> SymbolTable: ... def __call__(self, table: Any, filename: str) -> SymbolTable: ... diff --git a/stdlib/sys.pyi b/stdlib/sys.pyi index 3eda857..c374723 100644 --- a/stdlib/sys.pyi +++ b/stdlib/sys.pyi @@ -1,38 +1,23 @@ import sys +from _typeshed import OptExcInfo, ProfileFunction, TraceFunction, structseq from builtins import object as _object -from importlib.abc import Loader, PathEntryFinder +from collections.abc import AsyncGenerator, Callable, Coroutine, Sequence +from importlib.abc import PathEntryFinder from importlib.machinery import ModuleSpec from io import TextIOWrapper from types import FrameType, ModuleType, TracebackType -from typing import ( - Any, - AsyncGenerator, - Callable, - FrozenSet, - NoReturn, - Optional, - Protocol, - Sequence, - TextIO, - Tuple, - Type, - TypeVar, - Union, - overload, -) -from typing_extensions import Literal +from typing import Any, NoReturn, Protocol, TextIO, TypeVar, overload +from typing_extensions import Literal, TypeAlias, final _T = TypeVar("_T") -# The following type alias are stub-only and do not exist during runtime -_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] -_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]] -_PathSequence = Sequence[Union[bytes, str]] +# see https://github.com/python/typeshed/issues/8513#issue-1333671093 for the rationale behind this alias +_ExitCode: TypeAlias = str | int | None +_OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall 2022 or later -# Unlike importlib.abc.MetaPathFinder, invalidate_caches() might not exist (see python docs) +# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder` class _MetaPathFinder(Protocol): - def find_module(self, fullname: str, path: _PathSequence | None) -> Loader | None: ... - def find_spec(self, fullname: str, path: _PathSequence | None, target: ModuleType | None = ...) -> ModuleSpec | None: ... + def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ...) -> ModuleSpec | None: ... # ----- sys variables ----- if sys.platform != "win32": @@ -47,12 +32,12 @@ if sys.platform == "win32": dllhandle: int dont_write_bytecode: bool displayhook: Callable[[object], Any] -excepthook: Callable[[Type[BaseException], BaseException, TracebackType | None], Any] +excepthook: Callable[[type[BaseException], BaseException, TracebackType | None], Any] exec_prefix: str executable: str -float_repr_style: str +float_repr_style: Literal["short", "legacy"] hexversion: int -last_type: Type[BaseException] | None +last_type: type[BaseException] | None last_value: BaseException | None last_traceback: TracebackType | None maxsize: int @@ -62,7 +47,7 @@ modules: dict[str, ModuleType] if sys.version_info >= (3, 10): orig_argv: list[str] path: list[str] -path_hooks: list[Any] # TODO precise type; function, path to finder +path_hooks: list[Callable[[str], PathEntryFinder]] path_importer_cache: dict[str, PathEntryFinder | None] platform: str if sys.version_info >= (3, 9): @@ -76,7 +61,7 @@ stdin: TextIO stdout: TextIO stderr: TextIO if sys.version_info >= (3, 10): - stdlib_module_names: FrozenSet[str] + stdlib_module_names: frozenset[str] __stdin__: TextIOWrapper __stdout__: TextIOWrapper __stderr__: TextIOWrapper @@ -90,49 +75,105 @@ if sys.platform == "win32": winver: str _xoptions: dict[Any, Any] +# Type alias used as a mixin for structseq classes that cannot be instantiated at runtime +# This can't be represented in the type system, so we just use `structseq[Any]` +_UninstantiableStructseq: TypeAlias = structseq[Any] + flags: _flags -class _flags: - debug: int - division_warning: int - inspect: int - interactive: int - optimize: int - dont_write_bytecode: int - no_user_site: int - no_site: int - ignore_environment: int - verbose: int - bytes_warning: int - quiet: int - hash_randomization: int - if sys.version_info >= (3, 7): - dev_mode: int - utf8_mode: int +if sys.version_info >= (3, 10): + _FlagTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, bool, int, int] +else: + _FlagTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, bool, int] + +@final +class _flags(_UninstantiableStructseq, _FlagTuple): + @property + def debug(self) -> int: ... + @property + def inspect(self) -> int: ... + @property + def interactive(self) -> int: ... + @property + def optimize(self) -> int: ... + @property + def dont_write_bytecode(self) -> int: ... + @property + def no_user_site(self) -> int: ... + @property + def no_site(self) -> int: ... + @property + def ignore_environment(self) -> int: ... + @property + def verbose(self) -> int: ... + @property + def bytes_warning(self) -> int: ... + @property + def quiet(self) -> int: ... + @property + def hash_randomization(self) -> int: ... + @property + def isolated(self) -> int: ... + @property + def dev_mode(self) -> bool: ... + @property + def utf8_mode(self) -> int: ... + if sys.version_info >= (3, 10): + @property + def warn_default_encoding(self) -> int: ... # undocumented + if sys.version_info >= (3, 11): + @property + def safe_path(self) -> bool: ... float_info: _float_info -class _float_info: - epsilon: float # DBL_EPSILON - dig: int # DBL_DIG - mant_dig: int # DBL_MANT_DIG - max: float # DBL_MAX - max_exp: int # DBL_MAX_EXP - max_10_exp: int # DBL_MAX_10_EXP - min: float # DBL_MIN - min_exp: int # DBL_MIN_EXP - min_10_exp: int # DBL_MIN_10_EXP - radix: int # FLT_RADIX - rounds: int # FLT_ROUNDS +@final +class _float_info(structseq[float], tuple[float, int, int, float, int, int, int, int, float, int, int]): + @property + def max(self) -> float: ... # DBL_MAX + @property + def max_exp(self) -> int: ... # DBL_MAX_EXP + @property + def max_10_exp(self) -> int: ... # DBL_MAX_10_EXP + @property + def min(self) -> float: ... # DBL_MIN + @property + def min_exp(self) -> int: ... # DBL_MIN_EXP + @property + def min_10_exp(self) -> int: ... # DBL_MIN_10_EXP + @property + def dig(self) -> int: ... # DBL_DIG + @property + def mant_dig(self) -> int: ... # DBL_MANT_DIG + @property + def epsilon(self) -> float: ... # DBL_EPSILON + @property + def radix(self) -> int: ... # FLT_RADIX + @property + def rounds(self) -> int: ... # FLT_ROUNDS hash_info: _hash_info -class _hash_info: - width: int - modulus: int - inf: int - nan: int - imag: int +@final +class _hash_info(structseq[Any | int], tuple[int, int, int, int, int, str, int, int, int]): + @property + def width(self) -> int: ... + @property + def modulus(self) -> int: ... + @property + def inf(self) -> int: ... + @property + def nan(self) -> int: ... + @property + def imag(self) -> int: ... + @property + def algorithm(self) -> str: ... + @property + def hash_bits(self) -> int: ... + @property + def seed_bits(self) -> int: ... + @property + def cutoff(self) -> int: ... # undocumented implementation: _implementation @@ -141,20 +182,36 @@ class _implementation: version: _version_info hexversion: int cache_tag: str - _multiarch: str + # Define __getattr__, as the documentation states: + # > sys.implementation may contain additional attributes specific to the Python implementation. + # > These non-standard attributes must start with an underscore, and are not described here. + def __getattr__(self, name: str) -> Any: ... int_info: _int_info -class _int_info: - bits_per_digit: int - sizeof_digit: int - -class _version_info(Tuple[int, int, int, str, int]): - major: int - minor: int - micro: int - releaselevel: str - serial: int +@final +class _int_info(structseq[int], tuple[int, int, int, int]): + @property + def bits_per_digit(self) -> int: ... + @property + def sizeof_digit(self) -> int: ... + @property + def default_max_str_digits(self) -> int: ... + @property + def str_digits_check_threshold(self) -> int: ... + +@final +class _version_info(_UninstantiableStructseq, tuple[int, int, int, str, int]): + @property + def major(self) -> int: ... + @property + def minor(self) -> int: ... + @property + def micro(self) -> int: ... + @property + def releaselevel(self) -> str: ... + @property + def serial(self) -> int: ... version_info: _version_info @@ -163,12 +220,14 @@ def _clear_type_cache() -> None: ... def _current_frames() -> dict[int, FrameType]: ... def _getframe(__depth: int = ...) -> FrameType: ... def _debugmallocstats() -> None: ... -def __displayhook__(value: object) -> None: ... -def __excepthook__(type_: Type[BaseException], value: BaseException, traceback: TracebackType) -> None: ... -def exc_info() -> _OptExcInfo: ... +def __displayhook__(__value: object) -> None: ... +def __excepthook__(__exctype: type[BaseException], __value: BaseException, __traceback: TracebackType | None) -> None: ... +def exc_info() -> OptExcInfo: ... -# sys.exit() accepts an optional argument of anything printable -def exit(__status: object = ...) -> NoReturn: ... +if sys.version_info >= (3, 11): + def exception() -> BaseException | None: ... + +def exit(__status: _ExitCode = ...) -> NoReturn: ... def getallocatedblocks() -> int: ... def getdefaultencoding() -> str: ... @@ -184,38 +243,44 @@ def getsizeof(obj: object) -> int: ... @overload def getsizeof(obj: object, default: int) -> int: ... def getswitchinterval() -> float: ... - -_ProfileFunc = Callable[[FrameType, str, Any], Any] - -def getprofile() -> _ProfileFunc | None: ... -def setprofile(profilefunc: _ProfileFunc | None) -> None: ... - -_TraceFunc = Callable[[FrameType, str, Any], Optional[Callable[[FrameType, str, Any], Any]]] - -def gettrace() -> _TraceFunc | None: ... -def settrace(tracefunc: _TraceFunc | None) -> None: ... - -class _WinVersion(Tuple[int, int, int, int, str, int, int, int, int, Tuple[int, int, int]]): - major: int - minor: int - build: int - platform: int - service_pack: str - service_pack_minor: int - service_pack_major: int - suite_mast: int - product_type: int - platform_version: Tuple[int, int, int] +def getprofile() -> ProfileFunction | None: ... +def setprofile(profilefunc: ProfileFunction | None) -> None: ... +def gettrace() -> TraceFunction | None: ... +def settrace(tracefunc: TraceFunction | None) -> None: ... if sys.platform == "win32": + # A tuple of length 5, even though it has more than 5 attributes. + @final + class _WinVersion(_UninstantiableStructseq, tuple[int, int, int, int, str]): + @property + def major(self) -> int: ... + @property + def minor(self) -> int: ... + @property + def build(self) -> int: ... + @property + def platform(self) -> int: ... + @property + def service_pack(self) -> str: ... + @property + def service_pack_minor(self) -> int: ... + @property + def service_pack_major(self) -> int: ... + @property + def suite_mask(self) -> int: ... + @property + def product_type(self) -> int: ... + @property + def platform_version(self) -> tuple[int, int, int]: ... + def getwindowsversion() -> _WinVersion: ... def intern(__string: str) -> str: ... def is_finalizing() -> bool: ... -if sys.version_info >= (3, 7): - __breakpointhook__: Any # contains the original value of breakpointhook - def breakpointhook(*args: Any, **kwargs: Any) -> Any: ... +__breakpointhook__: Any # contains the original value of breakpointhook + +def breakpointhook(*args: Any, **kwargs: Any) -> Any: ... if sys.platform != "win32": def setdlopenflags(__flags: int) -> None: ... @@ -228,27 +293,47 @@ if sys.version_info < (3, 9): def getcheckinterval() -> int: ... # deprecated def setcheckinterval(__n: int) -> None: ... # deprecated +if sys.version_info < (3, 9): + # An 11-tuple or None + def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None: ... + if sys.version_info >= (3, 8): - # not exported by sys + # Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily. class UnraisableHookArgs: - exc_type: Type[BaseException] + exc_type: type[BaseException] exc_value: BaseException | None exc_traceback: TracebackType | None err_msg: str | None object: _object | None unraisablehook: Callable[[UnraisableHookArgs], Any] - def addaudithook(hook: Callable[[str, Tuple[Any, ...]], Any]) -> None: ... + def __unraisablehook__(__unraisable: UnraisableHookArgs) -> Any: ... + def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ... def audit(__event: str, *args: Any) -> None: ... -_AsyncgenHook = Optional[Callable[[AsyncGenerator[Any, Any]], None]] +_AsyncgenHook: TypeAlias = Callable[[AsyncGenerator[Any, Any]], None] | None -class _asyncgen_hooks(Tuple[_AsyncgenHook, _AsyncgenHook]): - firstiter: _AsyncgenHook - finalizer: _AsyncgenHook +@final +class _asyncgen_hooks(structseq[_AsyncgenHook], tuple[_AsyncgenHook, _AsyncgenHook]): + @property + def firstiter(self) -> _AsyncgenHook: ... + @property + def finalizer(self) -> _AsyncgenHook: ... def get_asyncgen_hooks() -> _asyncgen_hooks: ... def set_asyncgen_hooks(firstiter: _AsyncgenHook = ..., finalizer: _AsyncgenHook = ...) -> None: ... -if sys.version_info >= (3, 7): - def get_coroutine_origin_tracking_depth() -> int: ... - def set_coroutine_origin_tracking_depth(depth: int) -> None: ... +if sys.platform == "win32": + def _enablelegacywindowsfsencoding() -> None: ... + +def get_coroutine_origin_tracking_depth() -> int: ... +def set_coroutine_origin_tracking_depth(depth: int) -> None: ... + +if sys.version_info < (3, 8): + _CoroWrapper: TypeAlias = Callable[[Coroutine[Any, Any, Any]], Any] + def set_coroutine_wrapper(__wrapper: _CoroWrapper) -> None: ... + def get_coroutine_wrapper() -> _CoroWrapper: ... + +# The following two functions were added in 3.11.0, 3.10.7, 3.9.14, 3.8.14, & 3.7.14, +# as part of the response to CVE-2020-10735 +def set_int_max_str_digits(maxdigits: int) -> None: ... +def get_int_max_str_digits() -> int: ... diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index ff828d5..895abc2 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -1,12 +1,33 @@ -from typing import IO, Any, Tuple, overload +import sys +from typing import IO, Any, overload +from typing_extensions import Literal -def get_config_var(name: str) -> str | None: ... +__all__ = [ + "get_config_h_filename", + "get_config_var", + "get_config_vars", + "get_makefile_filename", + "get_path", + "get_path_names", + "get_paths", + "get_platform", + "get_python_version", + "get_scheme_names", + "parse_config_h", +] + +def get_config_var(name: str) -> Any: ... @overload def get_config_vars() -> dict[str, Any]: ... @overload def get_config_vars(arg: str, *args: str) -> list[Any]: ... -def get_scheme_names() -> Tuple[str, ...]: ... -def get_path_names() -> Tuple[str, ...]: ... +def get_scheme_names() -> tuple[str, ...]: ... + +if sys.version_info >= (3, 10): + def get_default_scheme() -> str: ... + def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... + +def get_path_names() -> tuple[str, ...]: ... def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> str: ... def get_paths(scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> dict[str, str]: ... def get_python_version() -> str: ... diff --git a/stdlib/syslog.pyi b/stdlib/syslog.pyi index 49169f4..cfa8df8 100644 --- a/stdlib/syslog.pyi +++ b/stdlib/syslog.pyi @@ -1,43 +1,47 @@ +import sys from typing import overload +from typing_extensions import Literal -LOG_ALERT: int -LOG_AUTH: int -LOG_CONS: int -LOG_CRIT: int -LOG_CRON: int -LOG_DAEMON: int -LOG_DEBUG: int -LOG_EMERG: int -LOG_ERR: int -LOG_INFO: int -LOG_KERN: int -LOG_LOCAL0: int -LOG_LOCAL1: int -LOG_LOCAL2: int -LOG_LOCAL3: int -LOG_LOCAL4: int -LOG_LOCAL5: int -LOG_LOCAL6: int -LOG_LOCAL7: int -LOG_LPR: int -LOG_MAIL: int -LOG_NDELAY: int -LOG_NEWS: int -LOG_NOTICE: int -LOG_NOWAIT: int -LOG_PERROR: int -LOG_PID: int -LOG_SYSLOG: int -LOG_USER: int -LOG_UUCP: int -LOG_WARNING: int - -def LOG_MASK(a: int) -> int: ... -def LOG_UPTO(a: int) -> int: ... -def closelog() -> None: ... -def openlog(ident: str = ..., logoption: int = ..., facility: int = ...) -> None: ... -def setlogmask(x: int) -> int: ... -@overload -def syslog(priority: int, message: str) -> None: ... -@overload -def syslog(message: str) -> None: ... +if sys.platform != "win32": + LOG_ALERT: Literal[1] + LOG_AUTH: Literal[32] + LOG_AUTHPRIV: Literal[80] + LOG_CONS: Literal[2] + LOG_CRIT: Literal[2] + LOG_CRON: Literal[72] + LOG_DAEMON: Literal[24] + LOG_DEBUG: Literal[7] + LOG_EMERG: Literal[0] + LOG_ERR: Literal[3] + LOG_INFO: Literal[6] + LOG_KERN: Literal[0] + LOG_LOCAL0: Literal[128] + LOG_LOCAL1: Literal[136] + LOG_LOCAL2: Literal[144] + LOG_LOCAL3: Literal[152] + LOG_LOCAL4: Literal[160] + LOG_LOCAL5: Literal[168] + LOG_LOCAL6: Literal[176] + LOG_LOCAL7: Literal[184] + LOG_LPR: Literal[48] + LOG_MAIL: Literal[16] + LOG_NDELAY: Literal[8] + LOG_NEWS: Literal[56] + LOG_NOTICE: Literal[5] + LOG_NOWAIT: Literal[16] + LOG_ODELAY: Literal[4] + LOG_PERROR: Literal[32] + LOG_PID: Literal[1] + LOG_SYSLOG: Literal[40] + LOG_USER: Literal[8] + LOG_UUCP: Literal[64] + LOG_WARNING: Literal[4] + def LOG_MASK(a: int) -> int: ... + def LOG_UPTO(a: int) -> int: ... + def closelog() -> None: ... + def openlog(ident: str = ..., logoption: int = ..., facility: int = ...) -> None: ... + def setlogmask(x: int) -> int: ... + @overload + def syslog(priority: int, message: str) -> None: ... + @overload + def syslog(message: str) -> None: ... diff --git a/stdlib/tabnanny.pyi b/stdlib/tabnanny.pyi index 584c6d4..8a8592f 100644 --- a/stdlib/tabnanny.pyi +++ b/stdlib/tabnanny.pyi @@ -1,5 +1,7 @@ from _typeshed import StrOrBytesPath -from typing import Iterable, Tuple +from collections.abc import Iterable + +__all__ = ["check", "NannyNag", "process_tokens"] verbose: int filename_only: int @@ -11,4 +13,4 @@ class NannyNag(Exception): def get_line(self) -> str: ... def check(file: StrOrBytesPath) -> None: ... -def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ... +def process_tokens(tokens: Iterable[tuple[int, str, tuple[int, int], tuple[int, int], str]]) -> None: ... diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index 53c986a..5ad5af7 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -2,13 +2,30 @@ import bz2 import io import sys from _typeshed import Self, StrOrBytesPath, StrPath +from builtins import list as _list, type as Type # aliases to avoid name clashes with fields named "type" or "list" from collections.abc import Callable, Iterable, Iterator, Mapping from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj from types import TracebackType -from typing import IO, Protocol, Set, Tuple, Type, TypeVar, overload +from typing import IO, ClassVar, Protocol, overload from typing_extensions import Literal -_TF = TypeVar("_TF", bound=TarFile) +__all__ = [ + "TarFile", + "TarInfo", + "is_tarfile", + "TarError", + "ReadError", + "CompressionError", + "StreamError", + "ExtractError", + "HeaderError", + "ENCODING", + "USTAR_FORMAT", + "GNU_FORMAT", + "PAX_FORMAT", + "DEFAULT_FORMAT", + "open", +] class _Fileobj(Protocol): def read(self, __size: int) -> bytes: ... @@ -62,12 +79,12 @@ DEFAULT_FORMAT: int # tarfile constants -SUPPORTED_TYPES: Tuple[bytes, ...] -REGULAR_TYPES: Tuple[bytes, ...] -GNU_TYPES: Tuple[bytes, ...] -PAX_FIELDS: Tuple[str, ...] +SUPPORTED_TYPES: tuple[bytes, ...] +REGULAR_TYPES: tuple[bytes, ...] +GNU_TYPES: tuple[bytes, ...] +PAX_FIELDS: tuple[str, ...] PAX_NUMBER_FIELDS: dict[str, type] -PAX_NAME_FIELDS: Set[str] +PAX_NAME_FIELDS: set[str] ENCODING: str @@ -78,7 +95,7 @@ def open( bufsize: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -92,20 +109,18 @@ def open( class ExFileObject(io.BufferedReader): def __init__(self, tarfile: TarFile, tarinfo: TarInfo) -> None: ... -_list = list # conflicts with method name - class TarFile: - OPEN_METH: Mapping[str, str] + OPEN_METH: ClassVar[Mapping[str, str]] name: StrOrBytesPath | None mode: Literal["r", "a", "w", "x"] fileobj: _Fileobj | None format: int | None - tarinfo: Type[TarInfo] + tarinfo: type[TarInfo] dereference: bool | None ignore_zeros: bool | None encoding: str | None errors: str - fileobject: Type[ExFileObject] + fileobject: type[ExFileObject] pax_headers: Mapping[str, str] | None debug: int | None errorlevel: int | None @@ -116,7 +131,7 @@ class TarFile: mode: Literal["r", "a", "w", "x"] = ..., fileobj: _Fileobj | None = ..., format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -128,19 +143,19 @@ class TarFile: ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... def __iter__(self) -> Iterator[TarInfo]: ... @classmethod def open( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None = ..., mode: str = ..., fileobj: IO[bytes] | None = ..., # depends on mode bufsize: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., @@ -148,113 +163,113 @@ class TarFile: pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... @classmethod def taropen( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None, mode: Literal["r", "a", "w", "x"] = ..., fileobj: _Fileobj | None = ..., *, compresslevel: int = ..., format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... @overload @classmethod def gzopen( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None, mode: Literal["r"] = ..., fileobj: _GzipReadableFileobj | None = ..., compresslevel: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... @overload @classmethod def gzopen( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None, mode: Literal["w", "x"], fileobj: _GzipWritableFileobj | None = ..., compresslevel: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... @overload @classmethod def bz2open( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None, mode: Literal["w", "x"], fileobj: _Bz2WritableFileobj | None = ..., compresslevel: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... @overload @classmethod def bz2open( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None, mode: Literal["r"] = ..., fileobj: _Bz2ReadableFileobj | None = ..., compresslevel: int = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... @classmethod def xzopen( - cls: Type[_TF], + cls: type[Self], name: StrOrBytesPath | None, mode: Literal["r", "w", "x"] = ..., fileobj: IO[bytes] | None = ..., preset: int | None = ..., *, format: int | None = ..., - tarinfo: Type[TarInfo] | None = ..., + tarinfo: type[TarInfo] | None = ..., dereference: bool | None = ..., ignore_zeros: bool | None = ..., encoding: str | None = ..., pax_headers: Mapping[str, str] | None = ..., debug: int | None = ..., errorlevel: int | None = ..., - ) -> _TF: ... + ) -> Self: ... def getmember(self, name: str) -> TarInfo: ... def getmembers(self) -> _list[TarInfo]: ... def getnames(self) -> _list[str]: ... @@ -279,27 +294,18 @@ class TarFile: def chown(self, tarinfo: TarInfo, targetpath: StrOrBytesPath, numeric_owner: bool) -> None: ... # undocumented def chmod(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented def utime(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented - if sys.version_info >= (3, 7): - def add( - self, - name: StrPath, - arcname: StrPath | None = ..., - recursive: bool = ..., - *, - filter: Callable[[TarInfo], TarInfo | None] | None = ..., - ) -> None: ... - else: - def add( - self, - name: StrPath, - arcname: StrPath | None = ..., - recursive: bool = ..., - exclude: Callable[[str], bool] | None = ..., - *, - filter: Callable[[TarInfo], TarInfo | None] | None = ..., - ) -> None: ... + def add( + self, + name: StrPath, + arcname: StrPath | None = ..., + recursive: bool = ..., + *, + filter: Callable[[TarInfo], TarInfo | None] | None = ..., + ) -> None: ... def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = ...) -> None: ... - def gettarinfo(self, name: str | None = ..., arcname: str | None = ..., fileobj: IO[bytes] | None = ...) -> TarInfo: ... + def gettarinfo( + self, name: StrOrBytesPath | None = ..., arcname: str | None = ..., fileobj: IO[bytes] | None = ... + ) -> TarInfo: ... def close(self) -> None: ... if sys.version_info >= (3, 9): @@ -340,9 +346,9 @@ class TarInfo: pax_headers: Mapping[str, str] def __init__(self, name: str = ...) -> None: ... @classmethod - def frombuf(cls, buf: bytes, encoding: str, errors: str) -> TarInfo: ... + def frombuf(cls: Type[Self], buf: bytes | bytearray, encoding: str, errors: str) -> Self: ... @classmethod - def fromtarfile(cls, tarfile: TarFile) -> TarInfo: ... + def fromtarfile(cls: Type[Self], tarfile: TarFile) -> Self: ... @property def linkpath(self) -> str: ... @linkpath.setter diff --git a/stdlib/telnetlib.pyi b/stdlib/telnetlib.pyi index b9c9845..67ae5fc 100644 --- a/stdlib/telnetlib.pyi +++ b/stdlib/telnetlib.pyi @@ -1,6 +1,11 @@ import socket from _typeshed import Self -from typing import Any, Callable, Match, Pattern, Sequence, Tuple +from collections.abc import Callable, Sequence +from re import Match, Pattern +from types import TracebackType +from typing import Any + +__all__ = ["Telnet"] DEBUGLEVEL: int TELNET_PORT: int @@ -99,7 +104,7 @@ class Telnet: def read_lazy(self) -> bytes: ... def read_very_lazy(self) -> bytes: ... def read_sb_data(self) -> bytes: ... - def set_option_negotiation_callback(self, callback: Callable[[socket.socket, bytes, bytes], Any] | None) -> None: ... + def set_option_negotiation_callback(self, callback: Callable[[socket.socket, bytes, bytes], object] | None) -> None: ... def process_rawq(self) -> None: ... def rawq_getchar(self) -> bytes: ... def fill_rawq(self) -> None: ... @@ -109,6 +114,8 @@ class Telnet: def listener(self) -> None: ... def expect( self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... - ) -> Tuple[int, Match[bytes] | None, bytes]: ... + ) -> tuple[int, Match[bytes] | None, bytes]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index 270f506..2c096f0 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -1,43 +1,61 @@ -import os +import io import sys -from _typeshed import Self +from _typeshed import BytesPath, GenericPath, Self, StrPath, WriteableBuffer +from collections.abc import Iterable, Iterator from types import TracebackType -from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, Tuple, Type, Union, overload -from typing_extensions import Literal +from typing import IO, Any, AnyStr, Generic, overload +from typing_extensions import Literal, TypeAlias if sys.version_info >= (3, 9): from types import GenericAlias +__all__ = [ + "NamedTemporaryFile", + "TemporaryFile", + "SpooledTemporaryFile", + "TemporaryDirectory", + "mkstemp", + "mkdtemp", + "mktemp", + "TMP_MAX", + "gettempprefix", + "tempdir", + "gettempdir", + "gettempprefixb", + "gettempdirb", +] + # global variables TMP_MAX: int tempdir: str | None template: str -_DirT = Union[AnyStr, os.PathLike[AnyStr]] +_StrMode: TypeAlias = Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"] +_BytesMode: TypeAlias = Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] if sys.version_info >= (3, 8): @overload def NamedTemporaryFile( - mode: Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"], + mode: _StrMode, buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., delete: bool = ..., *, errors: str | None = ..., ) -> _TemporaryFileWrapper[str]: ... @overload def NamedTemporaryFile( - mode: Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] = ..., + mode: _BytesMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., delete: bool = ..., *, errors: str | None = ..., @@ -50,7 +68,7 @@ if sys.version_info >= (3, 8): newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., delete: bool = ..., *, errors: str | None = ..., @@ -59,24 +77,24 @@ if sys.version_info >= (3, 8): else: @overload def NamedTemporaryFile( - mode: Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"], + mode: _StrMode, buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., delete: bool = ..., ) -> _TemporaryFileWrapper[str]: ... @overload def NamedTemporaryFile( - mode: Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] = ..., + mode: _BytesMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., delete: bool = ..., ) -> _TemporaryFileWrapper[bytes]: ... @overload @@ -87,7 +105,7 @@ else: newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., delete: bool = ..., ) -> _TemporaryFileWrapper[Any]: ... @@ -97,25 +115,25 @@ else: if sys.version_info >= (3, 8): @overload def TemporaryFile( - mode: Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"], + mode: _StrMode, buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., *, errors: str | None = ..., ) -> IO[str]: ... @overload def TemporaryFile( - mode: Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] = ..., + mode: _BytesMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., *, errors: str | None = ..., ) -> IO[bytes]: ... @@ -127,30 +145,30 @@ else: newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., *, errors: str | None = ..., ) -> IO[Any]: ... else: @overload def TemporaryFile( - mode: Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"], + mode: _StrMode, buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., ) -> IO[str]: ... @overload def TemporaryFile( - mode: Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] = ..., + mode: _BytesMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., ) -> IO[bytes]: ... @overload def TemporaryFile( @@ -160,7 +178,7 @@ else: newline: str | None = ..., suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., - dir: _DirT[AnyStr] | None = ..., + dir: GenericPath[AnyStr] | None = ..., ) -> IO[Any]: ... class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]): @@ -169,7 +187,7 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]): delete: bool def __init__(self, file: IO[AnyStr], name: str, delete: bool = ...) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, exc: Type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> bool | None: ... + def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ... def __getattr__(self, name: str) -> Any: ... def close(self) -> None: ... # These methods don't exist directly on this object, but @@ -200,20 +218,25 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]): def write(self, s: AnyStr) -> int: ... def writelines(self, lines: Iterable[AnyStr]) -> None: ... -# It does not actually derive from IO[AnyStr], but it does implement the -# protocol. -class SpooledTemporaryFile(IO[AnyStr]): +if sys.version_info >= (3, 11): + _SpooledTemporaryFileBase = io.IOBase +else: + _SpooledTemporaryFileBase = object + +# It does not actually derive from IO[AnyStr], but it does mostly behave +# like one. +class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase): @property def encoding(self) -> str: ... # undocumented @property - def newlines(self) -> str | Tuple[str, ...] | None: ... # undocumented + def newlines(self) -> str | tuple[str, ...] | None: ... # undocumented # bytes needs to go first, as default mode is to open as bytes if sys.version_info >= (3, 8): @overload def __init__( self: SpooledTemporaryFile[bytes], max_size: int = ..., - mode: Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] = ..., + mode: _BytesMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., @@ -227,7 +250,7 @@ class SpooledTemporaryFile(IO[AnyStr]): def __init__( self: SpooledTemporaryFile[str], max_size: int = ..., - mode: Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"] = ..., + mode: _StrMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., @@ -258,7 +281,7 @@ class SpooledTemporaryFile(IO[AnyStr]): def __init__( self: SpooledTemporaryFile[bytes], max_size: int = ..., - mode: Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"] = ..., + mode: _BytesMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., @@ -270,7 +293,7 @@ class SpooledTemporaryFile(IO[AnyStr]): def __init__( self: SpooledTemporaryFile[str], max_size: int = ..., - mode: Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"] = ..., + mode: _StrMode = ..., buffering: int = ..., encoding: str | None = ..., newline: str | None = ..., @@ -290,11 +313,10 @@ class SpooledTemporaryFile(IO[AnyStr]): prefix: str | None = ..., dir: str | None = ..., ) -> None: ... + def rollover(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... + def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ... # These methods are copied from the abstract methods of IO, because # SpooledTemporaryFile implements IO. # See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918. @@ -302,51 +324,82 @@ class SpooledTemporaryFile(IO[AnyStr]): def fileno(self) -> int: ... def flush(self) -> None: ... def isatty(self) -> bool: ... - def read(self, n: int = ...) -> AnyStr: ... - def readline(self, limit: int = ...) -> AnyStr: ... - def readlines(self, hint: int = ...) -> list[AnyStr]: ... + if sys.version_info >= (3, 11): + # These three work only if the SpooledTemporaryFile is opened in binary mode, + # because the underlying object in text mode does not have these methods. + def read1(self, __size: int = ...) -> AnyStr: ... + def readinto(self, b: WriteableBuffer) -> int: ... + def readinto1(self, b: WriteableBuffer) -> int: ... + def detach(self) -> io.RawIOBase: ... + + def read(self, __n: int = ...) -> AnyStr: ... + def readline(self, __limit: int | None = ...) -> AnyStr: ... # type: ignore[override] + def readlines(self, __hint: int = ...) -> list[AnyStr]: ... # type: ignore[override] def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> int: ... + def truncate(self, size: int | None = ...) -> None: ... # type: ignore[override] def write(self, s: AnyStr) -> int: ... - def writelines(self, iterable: Iterable[AnyStr]) -> None: ... - def __iter__(self) -> Iterator[AnyStr]: ... - # Other than the following methods, which do not exist on SpooledTemporaryFile + def writelines(self, iterable: Iterable[AnyStr]) -> None: ... # type: ignore[override] + def __iter__(self) -> Iterator[AnyStr]: ... # type: ignore[override] + # These exist at runtime only on 3.11+. def readable(self) -> bool: ... def seekable(self) -> bool: ... def writable(self) -> bool: ... - def __next__(self) -> AnyStr: ... + def __next__(self) -> AnyStr: ... # type: ignore[override] if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class TemporaryDirectory(Generic[AnyStr]): name: AnyStr - @overload - def __init__(self: TemporaryDirectory[str], suffix: None = ..., prefix: None = ..., dir: None = ...) -> None: ... - @overload - def __init__(self, suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., dir: _DirT[AnyStr] | None = ...) -> None: ... + if sys.version_info >= (3, 10): + @overload + def __init__( + self: TemporaryDirectory[str], + suffix: str | None = ..., + prefix: str | None = ..., + dir: StrPath | None = ..., + ignore_cleanup_errors: bool = ..., + ) -> None: ... + @overload + def __init__( + self: TemporaryDirectory[bytes], + suffix: bytes | None = ..., + prefix: bytes | None = ..., + dir: BytesPath | None = ..., + ignore_cleanup_errors: bool = ..., + ) -> None: ... + else: + @overload + def __init__( + self: TemporaryDirectory[str], suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ... + ) -> None: ... + @overload + def __init__( + self: TemporaryDirectory[bytes], suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ... + ) -> None: ... + def cleanup(self) -> None: ... def __enter__(self) -> AnyStr: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... + def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... +# The overloads overlap, but they should still work fine. @overload -def mkstemp() -> Tuple[int, str]: ... +def mkstemp( # type: ignore[misc] + suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ..., text: bool = ... +) -> tuple[int, str]: ... @overload def mkstemp( - suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., dir: _DirT[AnyStr] | None = ..., text: bool = ... -) -> Tuple[int, AnyStr]: ... -@overload -def mkdtemp() -> str: ... -@overload -def mkdtemp(suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., dir: _DirT[AnyStr] | None = ...) -> AnyStr: ... + suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ..., text: bool = ... +) -> tuple[int, bytes]: ... + +# The overloads overlap, but they should still work fine. @overload -def mktemp() -> str: ... +def mkdtemp(suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ...) -> str: ... # type: ignore[misc] @overload -def mktemp(suffix: AnyStr | None = ..., prefix: AnyStr | None = ..., dir: _DirT[AnyStr] | None = ...) -> AnyStr: ... +def mkdtemp(suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ...) -> bytes: ... +def mktemp(suffix: str = ..., prefix: str = ..., dir: StrPath | None = ...) -> str: ... def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ... def gettempdir() -> str: ... diff --git a/stdlib/termios.pyi b/stdlib/termios.pyi index ed8522d..494162a 100644 --- a/stdlib/termios.pyi +++ b/stdlib/termios.pyi @@ -1,246 +1,251 @@ +import sys from _typeshed import FileDescriptorLike -from typing import Any, List, Union +from typing import Any +from typing_extensions import TypeAlias -_Attr = List[Union[int, List[Union[bytes, int]]]] +if sys.platform != "win32": + _Attr: TypeAlias = list[int | list[bytes | int]] -# TODO constants not really documented -B0: int -B1000000: int -B110: int -B115200: int -B1152000: int -B1200: int -B134: int -B150: int -B1500000: int -B1800: int -B19200: int -B200: int -B2000000: int -B230400: int -B2400: int -B2500000: int -B300: int -B3000000: int -B3500000: int -B38400: int -B4000000: int -B460800: int -B4800: int -B50: int -B500000: int -B57600: int -B576000: int -B600: int -B75: int -B921600: int -B9600: int -BRKINT: int -BS0: int -BS1: int -BSDLY: int -CBAUD: int -CBAUDEX: int -CDSUSP: int -CEOF: int -CEOL: int -CEOT: int -CERASE: int -CFLUSH: int -CIBAUD: int -CINTR: int -CKILL: int -CLNEXT: int -CLOCAL: int -CQUIT: int -CR0: int -CR1: int -CR2: int -CR3: int -CRDLY: int -CREAD: int -CRPRNT: int -CRTSCTS: int -CS5: int -CS6: int -CS7: int -CS8: int -CSIZE: int -CSTART: int -CSTOP: int -CSTOPB: int -CSUSP: int -CWERASE: int -ECHO: int -ECHOCTL: int -ECHOE: int -ECHOK: int -ECHOKE: int -ECHONL: int -ECHOPRT: int -EXTA: int -EXTB: int -FF0: int -FF1: int -FFDLY: int -FIOASYNC: int -FIOCLEX: int -FIONBIO: int -FIONCLEX: int -FIONREAD: int -FLUSHO: int -HUPCL: int -ICANON: int -ICRNL: int -IEXTEN: int -IGNBRK: int -IGNCR: int -IGNPAR: int -IMAXBEL: int -INLCR: int -INPCK: int -IOCSIZE_MASK: int -IOCSIZE_SHIFT: int -ISIG: int -ISTRIP: int -IUCLC: int -IXANY: int -IXOFF: int -IXON: int -NCC: int -NCCS: int -NL0: int -NL1: int -NLDLY: int -NOFLSH: int -N_MOUSE: int -N_PPP: int -N_SLIP: int -N_STRIP: int -N_TTY: int -OCRNL: int -OFDEL: int -OFILL: int -OLCUC: int -ONLCR: int -ONLRET: int -ONOCR: int -OPOST: int -PARENB: int -PARMRK: int -PARODD: int -PENDIN: int -TAB0: int -TAB1: int -TAB2: int -TAB3: int -TABDLY: int -TCFLSH: int -TCGETA: int -TCGETS: int -TCIFLUSH: int -TCIOFF: int -TCIOFLUSH: int -TCION: int -TCOFLUSH: int -TCOOFF: int -TCOON: int -TCSADRAIN: int -TCSAFLUSH: int -TCSANOW: int -TCSBRK: int -TCSBRKP: int -TCSETA: int -TCSETAF: int -TCSETAW: int -TCSETS: int -TCSETSF: int -TCSETSW: int -TCXONC: int -TIOCCONS: int -TIOCEXCL: int -TIOCGETD: int -TIOCGICOUNT: int -TIOCGLCKTRMIOS: int -TIOCGPGRP: int -TIOCGSERIAL: int -TIOCGSOFTCAR: int -TIOCGWINSZ: int -TIOCINQ: int -TIOCLINUX: int -TIOCMBIC: int -TIOCMBIS: int -TIOCMGET: int -TIOCMIWAIT: int -TIOCMSET: int -TIOCM_CAR: int -TIOCM_CD: int -TIOCM_CTS: int -TIOCM_DSR: int -TIOCM_DTR: int -TIOCM_LE: int -TIOCM_RI: int -TIOCM_RNG: int -TIOCM_RTS: int -TIOCM_SR: int -TIOCM_ST: int -TIOCNOTTY: int -TIOCNXCL: int -TIOCOUTQ: int -TIOCPKT: int -TIOCPKT_DATA: int -TIOCPKT_DOSTOP: int -TIOCPKT_FLUSHREAD: int -TIOCPKT_FLUSHWRITE: int -TIOCPKT_NOSTOP: int -TIOCPKT_START: int -TIOCPKT_STOP: int -TIOCSCTTY: int -TIOCSERCONFIG: int -TIOCSERGETLSR: int -TIOCSERGETMULTI: int -TIOCSERGSTRUCT: int -TIOCSERGWILD: int -TIOCSERSETMULTI: int -TIOCSERSWILD: int -TIOCSER_TEMT: int -TIOCSETD: int -TIOCSLCKTRMIOS: int -TIOCSPGRP: int -TIOCSSERIAL: int -TIOCSSOFTCAR: int -TIOCSTI: int -TIOCSWINSZ: int -TOSTOP: int -VDISCARD: int -VEOF: int -VEOL: int -VEOL2: int -VERASE: int -VINTR: int -VKILL: int -VLNEXT: int -VMIN: int -VQUIT: int -VREPRINT: int -VSTART: int -VSTOP: int -VSUSP: int -VSWTC: int -VSWTCH: int -VT0: int -VT1: int -VTDLY: int -VTIME: int -VWERASE: int -XCASE: int -XTABS: int + # TODO constants not really documented + B0: int + B1000000: int + B110: int + B115200: int + B1152000: int + B1200: int + B134: int + B150: int + B1500000: int + B1800: int + B19200: int + B200: int + B2000000: int + B230400: int + B2400: int + B2500000: int + B300: int + B3000000: int + B3500000: int + B38400: int + B4000000: int + B460800: int + B4800: int + B50: int + B500000: int + B57600: int + B576000: int + B600: int + B75: int + B921600: int + B9600: int + BRKINT: int + BS0: int + BS1: int + BSDLY: int + CBAUD: int + CBAUDEX: int + CDSUSP: int + CEOF: int + CEOL: int + CEOT: int + CERASE: int + CFLUSH: int + CIBAUD: int + CINTR: int + CKILL: int + CLNEXT: int + CLOCAL: int + CQUIT: int + CR0: int + CR1: int + CR2: int + CR3: int + CRDLY: int + CREAD: int + CRPRNT: int + CRTSCTS: int + CS5: int + CS6: int + CS7: int + CS8: int + CSIZE: int + CSTART: int + CSTOP: int + CSTOPB: int + CSUSP: int + CWERASE: int + ECHO: int + ECHOCTL: int + ECHOE: int + ECHOK: int + ECHOKE: int + ECHONL: int + ECHOPRT: int + EXTA: int + EXTB: int + FF0: int + FF1: int + FFDLY: int + FIOASYNC: int + FIOCLEX: int + FIONBIO: int + FIONCLEX: int + FIONREAD: int + FLUSHO: int + HUPCL: int + ICANON: int + ICRNL: int + IEXTEN: int + IGNBRK: int + IGNCR: int + IGNPAR: int + IMAXBEL: int + INLCR: int + INPCK: int + IOCSIZE_MASK: int + IOCSIZE_SHIFT: int + ISIG: int + ISTRIP: int + IUCLC: int + IXANY: int + IXOFF: int + IXON: int + NCC: int + NCCS: int + NL0: int + NL1: int + NLDLY: int + NOFLSH: int + N_MOUSE: int + N_PPP: int + N_SLIP: int + N_STRIP: int + N_TTY: int + OCRNL: int + OFDEL: int + OFILL: int + OLCUC: int + ONLCR: int + ONLRET: int + ONOCR: int + OPOST: int + PARENB: int + PARMRK: int + PARODD: int + PENDIN: int + TAB0: int + TAB1: int + TAB2: int + TAB3: int + TABDLY: int + TCFLSH: int + TCGETA: int + TCGETS: int + TCIFLUSH: int + TCIOFF: int + TCIOFLUSH: int + TCION: int + TCOFLUSH: int + TCOOFF: int + TCOON: int + TCSADRAIN: int + TCSAFLUSH: int + TCSANOW: int + TCSBRK: int + TCSBRKP: int + TCSETA: int + TCSETAF: int + TCSETAW: int + TCSETS: int + TCSETSF: int + TCSETSW: int + TCXONC: int + TIOCCONS: int + TIOCEXCL: int + TIOCGETD: int + TIOCGICOUNT: int + TIOCGLCKTRMIOS: int + TIOCGPGRP: int + TIOCGSERIAL: int + TIOCGSOFTCAR: int + TIOCGWINSZ: int + TIOCINQ: int + TIOCLINUX: int + TIOCMBIC: int + TIOCMBIS: int + TIOCMGET: int + TIOCMIWAIT: int + TIOCMSET: int + TIOCM_CAR: int + TIOCM_CD: int + TIOCM_CTS: int + TIOCM_DSR: int + TIOCM_DTR: int + TIOCM_LE: int + TIOCM_RI: int + TIOCM_RNG: int + TIOCM_RTS: int + TIOCM_SR: int + TIOCM_ST: int + TIOCNOTTY: int + TIOCNXCL: int + TIOCOUTQ: int + TIOCPKT: int + TIOCPKT_DATA: int + TIOCPKT_DOSTOP: int + TIOCPKT_FLUSHREAD: int + TIOCPKT_FLUSHWRITE: int + TIOCPKT_NOSTOP: int + TIOCPKT_START: int + TIOCPKT_STOP: int + TIOCSCTTY: int + TIOCSERCONFIG: int + TIOCSERGETLSR: int + TIOCSERGETMULTI: int + TIOCSERGSTRUCT: int + TIOCSERGWILD: int + TIOCSERSETMULTI: int + TIOCSERSWILD: int + TIOCSER_TEMT: int + TIOCSETD: int + TIOCSLCKTRMIOS: int + TIOCSPGRP: int + TIOCSSERIAL: int + TIOCSSOFTCAR: int + TIOCSTI: int + TIOCSWINSZ: int + TOSTOP: int + VDISCARD: int + VEOF: int + VEOL: int + VEOL2: int + VERASE: int + VINTR: int + VKILL: int + VLNEXT: int + VMIN: int + VQUIT: int + VREPRINT: int + VSTART: int + VSTOP: int + VSUSP: int + VSWTC: int + VSWTCH: int + VT0: int + VT1: int + VTDLY: int + VTIME: int + VWERASE: int + XCASE: int + XTABS: int + def tcgetattr(__fd: FileDescriptorLike) -> list[Any]: ... + def tcsetattr(__fd: FileDescriptorLike, __when: int, __attributes: _Attr) -> None: ... + def tcsendbreak(__fd: FileDescriptorLike, __duration: int) -> None: ... + def tcdrain(__fd: FileDescriptorLike) -> None: ... + def tcflush(__fd: FileDescriptorLike, __queue: int) -> None: ... + def tcflow(__fd: FileDescriptorLike, __action: int) -> None: ... + if sys.version_info >= (3, 11): + def tcgetwinsize(__fd: FileDescriptorLike) -> tuple[int, int]: ... + def tcsetwinsize(__fd: FileDescriptorLike, __winsize: tuple[int, int]) -> None: ... -def tcgetattr(__fd: FileDescriptorLike) -> list[Any]: ... -def tcsetattr(__fd: FileDescriptorLike, __when: int, __attributes: _Attr) -> None: ... -def tcsendbreak(__fd: FileDescriptorLike, __duration: int) -> None: ... -def tcdrain(__fd: FileDescriptorLike) -> None: ... -def tcflush(__fd: FileDescriptorLike, __queue: int) -> None: ... -def tcflow(__fd: FileDescriptorLike, __action: int) -> None: ... - -class error(Exception): ... + class error(Exception): ... diff --git a/stdlib/textwrap.pyi b/stdlib/textwrap.pyi index 3b8fd5c..9e423cb 100644 --- a/stdlib/textwrap.pyi +++ b/stdlib/textwrap.pyi @@ -1,4 +1,7 @@ -from typing import Callable, Pattern +from collections.abc import Callable +from re import Pattern + +__all__ = ["TextWrapper", "wrap", "fill", "dedent", "indent", "shorten"] class TextWrapper: width: int diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index 64998d8..6fb1ab9 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -1,18 +1,47 @@ import sys -from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, Mapping, Optional, Type, TypeVar +from _typeshed import ProfileFunction, TraceFunction +from collections.abc import Callable, Iterable, Mapping +from types import TracebackType +from typing import Any, TypeVar -# TODO recursive type -_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] - -_PF = Callable[[FrameType, str, Any], None] _T = TypeVar("_T") -__all__: list[str] +__all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", +] + +if sys.version_info >= (3, 8): + __all__ += ["ExceptHookArgs", "excepthook", "get_native_id"] + +if sys.version_info >= (3, 10): + __all__ += ["getprofile", "gettrace"] + +_profile_hook: ProfileFunction | None def active_count() -> int: ... +def activeCount() -> int: ... # deprecated alias for active_count() def current_thread() -> Thread: ... -def currentThread() -> Thread: ... +def currentThread() -> Thread: ... # deprecated alias for current_thread() def get_ident() -> int: ... def enumerate() -> list[Thread]: ... def main_thread() -> Thread: ... @@ -20,27 +49,33 @@ def main_thread() -> Thread: ... if sys.version_info >= (3, 8): from _thread import get_native_id as get_native_id -def settrace(func: _TF) -> None: ... -def setprofile(func: _PF | None) -> None: ... +def settrace(func: TraceFunction) -> None: ... +def setprofile(func: ProfileFunction | None) -> None: ... + +if sys.version_info >= (3, 10): + def gettrace() -> TraceFunction | None: ... + def getprofile() -> ProfileFunction | None: ... + def stack_size(size: int = ...) -> int: ... TIMEOUT_MAX: float class ThreadError(Exception): ... -class local(object): - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... +class local: + def __getattribute__(self, __name: str) -> Any: ... + def __setattr__(self, __name: str, __value: Any) -> None: ... + def __delattr__(self, __name: str) -> None: ... class Thread: name: str - ident: int | None + @property + def ident(self) -> int | None: ... daemon: bool def __init__( self, group: None = ..., - target: Callable[..., Any] | None = ..., + target: Callable[..., object] | None = ..., name: str | None = ..., args: Iterable[Any] = ..., kwargs: Mapping[str, Any] | None = ..., @@ -50,37 +85,36 @@ class Thread: def start(self) -> None: ... def run(self) -> None: ... def join(self, timeout: float | None = ...) -> None: ... - def getName(self) -> str: ... - def setName(self, name: str) -> None: ... if sys.version_info >= (3, 8): @property def native_id(self) -> int | None: ... # only available on some platforms + def is_alive(self) -> bool: ... if sys.version_info < (3, 9): def isAlive(self) -> bool: ... + # the following methods are all deprecated + def getName(self) -> str: ... + def setName(self, name: str) -> None: ... def isDaemon(self) -> bool: ... def setDaemon(self, daemonic: bool) -> None: ... -class _DummyThread(Thread): ... +class _DummyThread(Thread): + def __init__(self) -> None: ... class Lock: - def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... def locked(self) -> bool: ... class _RLock: - def __init__(self) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... + __enter__ = acquire + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... RLock = _RLock @@ -88,21 +122,20 @@ class Condition: def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... def __enter__(self) -> bool: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... def wait(self, timeout: float | None = ...) -> bool: ... def wait_for(self, predicate: Callable[[], _T], timeout: float | None = ...) -> _T: ... def notify(self, n: int = ...) -> None: ... def notify_all(self) -> None: ... - def notifyAll(self) -> None: ... + def notifyAll(self) -> None: ... # deprecated alias for notify_all() class Semaphore: + _value: int def __init__(self, value: int = ...) -> None: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ... def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ... if sys.version_info >= (3, 9): @@ -113,8 +146,8 @@ class Semaphore: class BoundedSemaphore(Semaphore): ... class Event: - def __init__(self) -> None: ... def is_set(self) -> bool: ... + def isSet(self) -> bool: ... # deprecated alias for is_set() def set(self) -> None: ... def clear(self) -> None: ... def wait(self, timeout: float | None = ...) -> bool: ... @@ -126,19 +159,28 @@ if sys.version_info >= (3, 8): ExceptHookArgs = _ExceptHookArgs class Timer(Thread): + args: Iterable[Any] # undocumented + finished: Event # undocumented + function: Callable[..., Any] # undocumented + interval: float # undocumented + kwargs: Mapping[str, Any] # undocumented + def __init__( self, interval: float, - function: Callable[..., Any], + function: Callable[..., object], args: Iterable[Any] | None = ..., kwargs: Mapping[str, Any] | None = ..., ) -> None: ... def cancel(self) -> None: ... class Barrier: - parties: int - n_waiting: int - broken: bool + @property + def parties(self) -> int: ... + @property + def n_waiting(self) -> int: ... + @property + def broken(self) -> bool: ... def __init__(self, parties: int, action: Callable[[], None] | None = ..., timeout: float | None = ...) -> None: ... def wait(self, timeout: float | None = ...) -> int: ... def reset(self) -> None: ... diff --git a/stdlib/time.pyi b/stdlib/time.pyi index 039350c..035d789 100644 --- a/stdlib/time.pyi +++ b/stdlib/time.pyi @@ -1,20 +1,20 @@ import sys -from types import SimpleNamespace -from typing import Any, NamedTuple, Tuple +from _typeshed import structseq +from typing import Any, Protocol +from typing_extensions import Final, Literal, TypeAlias, final -_TimeTuple = Tuple[int, int, int, int, int, int, int, int, int] +_TimeTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int] altzone: int daylight: int timezone: int -tzname: Tuple[str, str] +tzname: tuple[str, str] -if sys.version_info >= (3, 7): - if sys.platform == "linux": - CLOCK_BOOTTIME: int - if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": - CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD - CLOCK_UPTIME: int # FreeBSD, OpenBSD +if sys.platform == "linux": + CLOCK_BOOTTIME: int +if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": + CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD + CLOCK_UPTIME: int # FreeBSD, OpenBSD if sys.platform != "win32": CLOCK_MONOTONIC: int @@ -31,38 +31,33 @@ if sys.version_info >= (3, 8) and sys.platform == "darwin": if sys.version_info >= (3, 9) and sys.platform == "linux": CLOCK_TAI: int -class _struct_time(NamedTuple): - tm_year: int - tm_mon: int - tm_mday: int - tm_hour: int - tm_min: int - tm_sec: int - tm_wday: int - tm_yday: int - tm_isdst: int +# Constructor takes an iterable of any type, of length between 9 and 11 elements. +# However, it always *behaves* like a tuple of 9 elements, +# even if an iterable with length >9 is passed. +# https://github.com/python/typeshed/pull/6560#discussion_r767162532 +@final +class struct_time(structseq[Any | int], _TimeTuple): + if sys.version_info >= (3, 10): + __match_args__: Final = ("tm_year", "tm_mon", "tm_mday", "tm_hour", "tm_min", "tm_sec", "tm_wday", "tm_yday", "tm_isdst") @property - def n_fields(self) -> int: ... + def tm_year(self) -> int: ... @property - def n_sequence_fields(self) -> int: ... + def tm_mon(self) -> int: ... @property - def n_unnamed_fields(self) -> int: ... - -class struct_time(_struct_time): - def __init__( - self, - o: Tuple[int, int, int, int, int, int, int, int, int] - | Tuple[int, int, int, int, int, int, int, int, int, str] - | Tuple[int, int, int, int, int, int, int, int, int, str, int], - _arg: Any = ..., - ) -> None: ... - def __new__( - cls, - o: Tuple[int, int, int, int, int, int, int, int, int] - | Tuple[int, int, int, int, int, int, int, int, int, str] - | Tuple[int, int, int, int, int, int, int, int, int, str, int], - _arg: Any = ..., - ) -> struct_time: ... + def tm_mday(self) -> int: ... + @property + def tm_hour(self) -> int: ... + @property + def tm_min(self) -> int: ... + @property + def tm_sec(self) -> int: ... + @property + def tm_wday(self) -> int: ... + @property + def tm_yday(self) -> int: ... + @property + def tm_isdst(self) -> int: ... + # These final two properties only exist if a 10- or 11-item sequence was passed to the constructor. @property def tm_zone(self) -> str: ... @property @@ -85,7 +80,13 @@ def time() -> float: ... if sys.platform != "win32": def tzset() -> None: ... # Unix only -def get_clock_info(name: str) -> SimpleNamespace: ... +class _ClockInfo(Protocol): + adjustable: bool + implementation: str + monotonic: bool + resolution: float + +def get_clock_info(name: Literal["monotonic", "perf_counter", "process_time", "time", "thread_time"]) -> _ClockInfo: ... def monotonic() -> float: ... def perf_counter() -> float: ... def process_time() -> float: ... @@ -95,13 +96,16 @@ if sys.platform != "win32": def clock_gettime(clk_id: int) -> float: ... # Unix only def clock_settime(clk_id: int, time: float) -> None: ... # Unix only -if sys.version_info >= (3, 7): - if sys.platform != "win32": - def clock_gettime_ns(clock_id: int) -> int: ... - def clock_settime_ns(clock_id: int, time: int) -> int: ... - def monotonic_ns() -> int: ... - def perf_counter_ns() -> int: ... - def process_time_ns() -> int: ... - def time_ns() -> int: ... - def thread_time() -> float: ... - def thread_time_ns() -> int: ... +if sys.platform != "win32": + def clock_gettime_ns(clock_id: int) -> int: ... + def clock_settime_ns(clock_id: int, time: int) -> int: ... + +if sys.platform == "linux": + def pthread_getcpuclockid(thread_id: int) -> int: ... + +def monotonic_ns() -> int: ... +def perf_counter_ns() -> int: ... +def process_time_ns() -> int: ... +def time_ns() -> int: ... +def thread_time() -> float: ... +def thread_time_ns() -> int: ... diff --git a/stdlib/timeit.pyi b/stdlib/timeit.pyi index 2a8330d..dda6cef 100644 --- a/stdlib/timeit.pyi +++ b/stdlib/timeit.pyi @@ -1,7 +1,11 @@ -from typing import IO, Any, Callable, Sequence, Tuple, Union +from collections.abc import Callable, Sequence +from typing import IO, Any +from typing_extensions import TypeAlias -_Timer = Callable[[], float] -_Stmt = Union[str, Callable[[], Any]] +__all__ = ["Timer", "timeit", "repeat", "default_timer"] + +_Timer: TypeAlias = Callable[[], float] +_Stmt: TypeAlias = str | Callable[[], object] default_timer: _Timer @@ -12,7 +16,7 @@ class Timer: def print_exc(self, file: IO[str] | None = ...) -> None: ... def timeit(self, number: int = ...) -> float: ... def repeat(self, repeat: int = ..., number: int = ...) -> list[float]: ... - def autorange(self, callback: Callable[[int, float], Any] | None = ...) -> Tuple[int, float]: ... + def autorange(self, callback: Callable[[int, float], object] | None = ...) -> tuple[int, float]: ... def timeit( stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., number: int = ..., globals: dict[str, Any] | None = ... @@ -25,7 +29,4 @@ def repeat( number: int = ..., globals: dict[str, Any] | None = ..., ) -> list[float]: ... - -_timerFunc = Callable[[], float] - -def main(args: Sequence[str] | None = ..., *, _wrap_timer: Callable[[_timerFunc], _timerFunc] | None = ...) -> None: ... +def main(args: Sequence[str] | None = ..., *, _wrap_timer: Callable[[_Timer], _Timer] | None = ...) -> None: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 9ca6392..699dfd2 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1,12 +1,148 @@ import _tkinter import sys -from _typeshed import StrOrBytesPath +from _typeshed import Incomplete, StrOrBytesPath +from collections.abc import Callable, Mapping, Sequence from enum import Enum -from tkinter.constants import * # comment this out to find undefined identifier names with flake8 +from tkinter.constants import * from tkinter.font import _FontDescription from types import TracebackType -from typing import Any, Callable, Generic, List, Mapping, Optional, Protocol, Sequence, Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal, TypedDict +from typing import Any, Generic, NamedTuple, Protocol, TypeVar, Union, overload +from typing_extensions import Literal, TypeAlias, TypedDict + +if sys.version_info >= (3, 9): + __all__ = [ + "TclError", + "NO", + "FALSE", + "OFF", + "YES", + "TRUE", + "ON", + "N", + "S", + "W", + "E", + "NW", + "SW", + "NE", + "SE", + "NS", + "EW", + "NSEW", + "CENTER", + "NONE", + "X", + "Y", + "BOTH", + "LEFT", + "TOP", + "RIGHT", + "BOTTOM", + "RAISED", + "SUNKEN", + "FLAT", + "RIDGE", + "GROOVE", + "SOLID", + "HORIZONTAL", + "VERTICAL", + "NUMERIC", + "CHAR", + "WORD", + "BASELINE", + "INSIDE", + "OUTSIDE", + "SEL", + "SEL_FIRST", + "SEL_LAST", + "END", + "INSERT", + "CURRENT", + "ANCHOR", + "ALL", + "NORMAL", + "DISABLED", + "ACTIVE", + "HIDDEN", + "CASCADE", + "CHECKBUTTON", + "COMMAND", + "RADIOBUTTON", + "SEPARATOR", + "SINGLE", + "BROWSE", + "MULTIPLE", + "EXTENDED", + "DOTBOX", + "UNDERLINE", + "PIESLICE", + "CHORD", + "ARC", + "FIRST", + "LAST", + "BUTT", + "PROJECTING", + "ROUND", + "BEVEL", + "MITER", + "MOVETO", + "SCROLL", + "UNITS", + "PAGES", + "TkVersion", + "TclVersion", + "READABLE", + "WRITABLE", + "EXCEPTION", + "EventType", + "Event", + "NoDefaultRoot", + "Variable", + "StringVar", + "IntVar", + "DoubleVar", + "BooleanVar", + "mainloop", + "getint", + "getdouble", + "getboolean", + "Misc", + "CallWrapper", + "XView", + "YView", + "Wm", + "Tk", + "Tcl", + "Pack", + "Place", + "Grid", + "BaseWidget", + "Widget", + "Toplevel", + "Button", + "Canvas", + "Checkbutton", + "Entry", + "Frame", + "Label", + "Listbox", + "Menu", + "Menubutton", + "Message", + "Radiobutton", + "Scale", + "Scrollbar", + "Text", + "OptionMenu", + "Image", + "PhotoImage", + "BitmapImage", + "image_names", + "image_types", + "Spinbox", + "LabelFrame", + "PanedWindow", + ] # Using anything from tkinter.font in this file means that 'import tkinter' # seems to also load tkinter.font. That's not how it actually works, but @@ -24,96 +160,48 @@ EXCEPTION = _tkinter.EXCEPTION # - Misc: any widget (don't use BaseWidget because Tk doesn't inherit from BaseWidget) # - Widget: anything that is meant to be put into another widget with e.g. pack or grid # -# Instructions for figuring out the correct type of each widget option: -# - See discussion on #4363. +# Don't trust tkinter's docstrings, because they have been created by copy/pasting from +# Tk's manual pages more than 10 years ago. Use the latest manual pages instead: # -# - Find the option from the manual page of the widget. Usually the manual -# page of a non-ttk widget has the same name as the tkinter class, in the -# 3tk section: +# $ sudo apt install tk-doc tcl-doc +# $ man 3tk label # tkinter.Label +# $ man 3tk ttk_label # tkinter.ttk.Label +# $ man 3tcl after # tkinter.Misc.after # -# $ sudo apt install tk-doc -# $ man 3tk label -# -# Ttk manual pages tend to have ttk_ prefixed names: -# -# $ man 3tk ttk_label -# -# Non-GUI things like the .after() method are often in the 3tcl section: -# -# $ sudo apt install tcl-doc -# $ man 3tcl after -# -# If you don't have man or apt, you can read these manual pages online: -# -# https://www.tcl.tk/doc/ -# -# Every option has '-' in front of its name in the manual page (and in Tcl). -# For example, there's an option named '-text' in the label manual page. -# -# - Tkinter has some options documented in docstrings, but don't rely on them. -# They aren't updated when a new version of Tk comes out, so the latest Tk -# manual pages (see above) are much more likely to actually contain all -# possible options. -# -# Also, reading tkinter's source code typically won't help much because it -# uses a lot of **kwargs and duck typing. Typically every argument goes into -# self.tk.call, which is _tkinter.TkappType.call, and the return value is -# whatever that returns. The type of that depends on how the Tcl interpreter -# represents the return value of the executed Tcl code. -# -# - If you think that int is an appropriate type for something, then you may -# actually want _ScreenUnits instead. -# -# - If you think that Callable[something] is an appropriate type for -# something, then you may actually want Callable[something] | str, -# because it's often possible to specify a string of Tcl code. -# -# - Some options can be set only in __init__, but all options are available -# when getting their values with configure's return value or cget. -# -# - Asks other tkinter users if you haven't worked much with tkinter. - -# _TkinterSequence[T] represents a sequence that tkinter understands. It -# differs from typing.Sequence[T]. For example, collections.deque a valid -# Sequence but not a valid _TkinterSequence: -# -# >>> tkinter.Label(font=('Helvetica', 12, collections.deque(['bold']))) -# Traceback (most recent call last): -# ... -# _tkinter.TclError: unknown font style "deque(['bold'])" -_T = TypeVar("_T") -_TkinterSequence = Union[List[_T], Tuple[_T, ...]] -_TkinterSequence2D = Union[List[List[_T]], List[Tuple[_T, ...]], Tuple[List[_T], ...], Tuple[Tuple[_T, ...], ...]] +# You can also read the manual pages online: https://www.tcl.tk/doc/ # Some widgets have an option named -compound that accepts different values # than the _Compound defined here. Many other options have similar things. -_Anchor = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] # manual page: Tk_GetAnchor -_Bitmap = str # manual page: Tk_GetBitmap -_ButtonCommand = Union[str, Callable[[], Any]] # return value is returned from Button.invoke() -_CanvasItemId = int -_Color = str # typically '#rrggbb', '#rgb' or color names. -_Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' -_Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[str, str, str, str]] # manual page: Tk_GetCursor -_EntryValidateCommand = Union[ - Callable[[], bool], str, _TkinterSequence[str] -] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P'] -_GridIndex = Union[int, str, Literal["all"]] -_ImageSpec = Union[_Image, str] # str can be from e.g. tkinter.image_names() -_Padding = Union[ - _ScreenUnits, - Tuple[_ScreenUnits], - Tuple[_ScreenUnits, _ScreenUnits], - Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits], - Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], -] -_Relief = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] # manual page: Tk_GetRelief -_ScreenUnits = Union[str, float] # manual page: Tk_GetPixels -_XYScrollCommand = Union[str, Callable[[float, float], Any]] # -xscrollcommand and -yscrollcommand in 'options' manual page -_TakeFocusValue = Union[int, Literal[""], Callable[[str], Optional[bool]]] # -takefocus in manual page named 'options' +_Anchor: TypeAlias = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] # manual page: Tk_GetAnchor +_Bitmap: TypeAlias = str # manual page: Tk_GetBitmap +_ButtonCommand: TypeAlias = str | Callable[[], Any] # accepts string of tcl code, return value is returned from Button.invoke() +_CanvasItemId: TypeAlias = int +_Color: TypeAlias = str # typically '#rrggbb', '#rgb' or color names. +_Compound: TypeAlias = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' +# manual page: Tk_GetCursor +_Cursor: TypeAlias = Union[str, tuple[str], tuple[str, str], tuple[str, str, str], tuple[str, str, str, str]] +# example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P'] +_EntryValidateCommand: TypeAlias = str | list[str] | tuple[str, ...] | Callable[[], bool] +_GridIndex: TypeAlias = int | str +_ImageSpec: TypeAlias = _Image | str # str can be from e.g. tkinter.image_names() +_Relief: TypeAlias = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] # manual page: Tk_GetRelief +_ScreenUnits: TypeAlias = str | float # Often the right type instead of int. Manual page: Tk_GetPixels +# -xscrollcommand and -yscrollcommand in 'options' manual page +_XYScrollCommand: TypeAlias = str | Callable[[float, float], object] +_TakeFocusValue: TypeAlias = Union[int, Literal[""], Callable[[str], bool | None]] # -takefocus in manual page named 'options' + +if sys.version_info >= (3, 11): + class _VersionInfoType(NamedTuple): + major: int + minor: int + micro: int + releaselevel: str + serial: int class EventType(str, Enum): Activate: str ButtonPress: str + Button = ButtonPress ButtonRelease: str Circulate: str CirculateRequest: str @@ -131,6 +219,7 @@ class EventType(str, Enum): GraphicsExpose: str Gravity: str KeyPress: str + Key = KeyPress KeyRelease: str Keymap: str Leave: str @@ -150,9 +239,9 @@ class EventType(str, Enum): VirtualEvent: str Visibility: str -_W = TypeVar("_W", bound="Misc") +_W = TypeVar("_W", bound=Misc) # Events considered covariant because you should never assign to event.widget. -_W_co = TypeVar("_W_co", covariant=True, bound="Misc") +_W_co = TypeVar("_W_co", covariant=True, bound=Misc) class Event(Generic[_W_co]): serial: int @@ -175,22 +264,23 @@ class Event(Generic[_W_co]): widget: _W_co delta: int -def NoDefaultRoot(): ... +def NoDefaultRoot() -> None: ... -_TraceMode = Literal["array", "read", "write", "unset"] +_TraceMode: TypeAlias = Literal["array", "read", "write", "unset"] class Variable: - def __init__(self, master: Misc | None = ..., value: Any | None = ..., name: str | None = ...) -> None: ... - def set(self, value: Any) -> None: ... + def __init__(self, master: Misc | None = ..., value: Incomplete | None = ..., name: str | None = ...) -> None: ... + def set(self, value) -> None: ... initialize = set - def get(self) -> Any: ... - def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], Any]) -> str: ... + def get(self): ... + def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], object]) -> str: ... def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ... - def trace_info(self) -> list[Tuple[Tuple[_TraceMode, ...], str]]: ... + def trace_info(self) -> list[tuple[tuple[_TraceMode, ...], str]]: ... def trace_variable(self, mode, callback): ... # deprecated - def trace_vdelete(self, mode, cbname): ... # deprecated + def trace_vdelete(self, mode, cbname) -> None: ... # deprecated def trace_vinfo(self): ... # deprecated trace = trace_variable # deprecated + def __eq__(self, other: object) -> bool: ... class StringVar(Variable): def __init__(self, master: Misc | None = ..., value: str | None = ..., name: str | None = ...) -> None: ... @@ -218,8 +308,8 @@ class BooleanVar(Variable): def mainloop(n: int = ...) -> None: ... -getint: Any -getdouble: Any +getint: Incomplete +getdouble: Incomplete def getboolean(s): ... @@ -235,14 +325,14 @@ class Misc: children: dict[str, Widget] def destroy(self) -> None: ... def deletecommand(self, name: str) -> None: ... - def tk_strictMotif(self, boolean: Any | None = ...): ... - def tk_bisque(self): ... - def tk_setPalette(self, *args, **kw): ... + def tk_strictMotif(self, boolean: Incomplete | None = ...): ... + def tk_bisque(self) -> None: ... + def tk_setPalette(self, *args, **kw) -> None: ... def wait_variable(self, name: str | Variable = ...) -> None: ... waitvar = wait_variable def wait_window(self, window: Misc | None = ...) -> None: ... def wait_visibility(self, window: Misc | None = ...) -> None: ... - def setvar(self, name: str = ..., value: str = ...): ... + def setvar(self, name: str = ..., value: str = ...) -> None: ... def getvar(self, name: str = ...): ... def getint(self, s): ... def getdouble(self, s): ... @@ -259,34 +349,39 @@ class Misc: @overload def after(self, ms: int, func: None = ...) -> None: ... @overload - def after(self, ms: int | Literal["idle"], func: Callable[..., Any], *args: Any) -> str: ... + def after(self, ms: int | Literal["idle"], func: Callable[..., object], *args: Any) -> str: ... # after_idle is essentially partialmethod(after, "idle") - def after_idle(self, func: Callable[..., Any], *args: Any) -> str: ... + def after_idle(self, func: Callable[..., object], *args: Any) -> str: ... def after_cancel(self, id: str) -> None: ... - def bell(self, displayof: Literal[0] | Misc | None = ...): ... + def bell(self, displayof: Literal[0] | Misc | None = ...) -> None: ... def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ... def clipboard_clear(self, *, displayof: Misc = ...) -> None: ... - def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...): ... + def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...) -> None: ... def grab_current(self): ... - def grab_release(self): ... + def grab_release(self) -> None: ... def grab_set(self) -> None: ... def grab_set_global(self) -> None: ... - def grab_status(self): ... - def option_add(self, pattern, value, priority: Any | None = ...): ... - def option_clear(self): ... + def grab_status(self) -> Literal["local", "global"] | None: ... + def option_add( + self, pattern, value, priority: int | Literal["widgetDefault", "startupFile", "userDefault", "interactive"] | None = ... + ) -> None: ... + def option_clear(self) -> None: ... def option_get(self, name, className): ... - def option_readfile(self, fileName, priority: Any | None = ...): ... - def selection_clear(self, **kw): ... + def option_readfile(self, fileName, priority: Incomplete | None = ...) -> None: ... + def selection_clear(self, **kw) -> None: ... def selection_get(self, **kw): ... - def selection_handle(self, command, **kw): ... - def selection_own(self, **kw): ... + def selection_handle(self, command, **kw) -> None: ... + def selection_own(self, **kw) -> None: ... def selection_own_get(self, **kw): ... def send(self, interp, cmd, *args): ... - def lower(self, belowThis: Any | None = ...): ... - def tkraise(self, aboveThis: Any | None = ...): ... + def lower(self, belowThis: Incomplete | None = ...) -> None: ... + def tkraise(self, aboveThis: Incomplete | None = ...) -> None: ... lift = tkraise - def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = ...): ... - def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = ...): ... + if sys.version_info >= (3, 11): + def info_patchlevel(self) -> _VersionInfoType: ... + + def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = ...) -> int: ... + def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = ...) -> str: ... def winfo_cells(self) -> int: ... def winfo_children(self) -> list[Widget]: ... # Widget because it can't be Toplevel or Tk def winfo_class(self) -> str: ... @@ -298,7 +393,7 @@ class Misc: def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... - def winfo_interps(self, displayof: Literal[0] | Misc | None = ...) -> Tuple[str, ...]: ... + def winfo_interps(self, displayof: Literal[0] | Misc | None = ...) -> tuple[str, ...]: ... def winfo_ismapped(self) -> bool: ... def winfo_manager(self) -> str: ... def winfo_name(self) -> str: ... @@ -306,11 +401,11 @@ class Misc: def winfo_pathname(self, id: int, displayof: Literal[0] | Misc | None = ...): ... def winfo_pixels(self, number: _ScreenUnits) -> int: ... def winfo_pointerx(self) -> int: ... - def winfo_pointerxy(self) -> Tuple[int, int]: ... + def winfo_pointerxy(self) -> tuple[int, int]: ... def winfo_pointery(self) -> int: ... def winfo_reqheight(self) -> int: ... def winfo_reqwidth(self) -> int: ... - def winfo_rgb(self, color: _Color) -> Tuple[int, int, int]: ... + def winfo_rgb(self, color: _Color) -> tuple[int, int, int]: ... def winfo_rootx(self) -> int: ... def winfo_rooty(self) -> int: ... def winfo_screen(self) -> str: ... @@ -326,7 +421,7 @@ class Misc: def winfo_viewable(self) -> bool: ... def winfo_visual(self) -> str: ... def winfo_visualid(self) -> str: ... - def winfo_visualsavailable(self, includeids: int = ...) -> list[Tuple[str, int]]: ... + def winfo_visualsavailable(self, includeids: int = ...) -> list[tuple[str, int]]: ... def winfo_vrootheight(self) -> int: ... def winfo_vrootwidth(self) -> int: ... def winfo_vrootx(self) -> int: ... @@ -336,43 +431,58 @@ class Misc: def winfo_y(self) -> int: ... def update(self) -> None: ... def update_idletasks(self) -> None: ... - def bindtags(self, tagList: Any | None = ...): ... + @overload + def bindtags(self, tagList: None = ...) -> tuple[str, ...]: ... + @overload + def bindtags(self, tagList: list[str] | tuple[str, ...]) -> None: ... # bind with isinstance(func, str) doesn't return anything, but all other # binds do. The default value of func is not str. @overload def bind( - self, sequence: str | None = ..., func: Callable[[Event[Misc]], Any] | None = ..., add: bool | None = ... + self, + sequence: str | None = ..., + func: Callable[[Event[Misc]], object] | None = ..., + add: Literal["", "+"] | bool | None = ..., ) -> str: ... @overload - def bind(self, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def bind(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... @overload - def bind(self, *, func: str, add: bool | None = ...) -> None: ... + def bind(self, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... # There's no way to know what type of widget bind_all and bind_class # callbacks will get, so those are Misc. @overload def bind_all( - self, sequence: str | None = ..., func: Callable[[Event[Misc]], Any] | None = ..., add: bool | None = ... + self, + sequence: str | None = ..., + func: Callable[[Event[Misc]], object] | None = ..., + add: Literal["", "+"] | bool | None = ..., ) -> str: ... @overload - def bind_all(self, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def bind_all(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... @overload - def bind_all(self, *, func: str, add: bool | None = ...) -> None: ... + def bind_all(self, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... @overload def bind_class( - self, className: str, sequence: str | None = ..., func: Callable[[Event[Misc]], Any] | None = ..., add: bool | None = ... + self, + className: str, + sequence: str | None = ..., + func: Callable[[Event[Misc]], object] | None = ..., + add: Literal["", "+"] | bool | None = ..., ) -> str: ... @overload - def bind_class(self, className: str, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def bind_class(self, className: str, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... @overload - def bind_class(self, className: str, *, func: str, add: bool | None = ...) -> None: ... + def bind_class(self, className: str, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... def unbind(self, sequence: str, funcid: str | None = ...) -> None: ... def unbind_all(self, sequence: str) -> None: ... def unbind_class(self, className: str, sequence: str) -> None: ... def mainloop(self, n: int = ...) -> None: ... - def quit(self): ... + def quit(self) -> None: ... + @property + def _windowingsystem(self) -> Literal["win32", "aqua", "x11"]: ... def nametowidget(self, name: str | Misc | _tkinter.Tcl_Obj) -> Any: ... def register( - self, func: Callable[..., Any], subst: Callable[..., Sequence[Any]] | None = ..., needcleanup: int = ... + self, func: Callable[..., object], subst: Callable[..., Sequence[Any]] | None = ..., needcleanup: int = ... ) -> str: ... def keys(self) -> list[str]: ... @overload @@ -385,11 +495,11 @@ class Misc: @overload def grid_bbox( self, column: None = ..., row: None = ..., col2: None = ..., row2: None = ... - ) -> Tuple[int, int, int, int] | None: ... + ) -> tuple[int, int, int, int] | None: ... @overload - def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> Tuple[int, int, int, int] | None: ... + def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> tuple[int, int, int, int] | None: ... @overload - def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> Tuple[int, int, int, int] | None: ... + def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> tuple[int, int, int, int] | None: ... bbox = grid_bbox def grid_columnconfigure( self, @@ -410,15 +520,15 @@ class Misc: pad: _ScreenUnits = ..., uniform: str = ..., weight: int = ..., - ) -> _GridIndexInfo | Any: ... # can be None but annoyying to check + ) -> _GridIndexInfo | Any: ... # can be None but annoying to check columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure - def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> Tuple[int, int]: ... + def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload def grid_propagate(self) -> bool: ... - def grid_size(self) -> Tuple[int, int]: ... + def grid_size(self) -> tuple[int, int]: ... size = grid_size # Widget because Toplevel or Tk is never a slave def pack_slaves(self) -> list[Widget]: ... @@ -459,9 +569,9 @@ class Misc: x: _ScreenUnits = ..., y: _ScreenUnits = ..., ) -> None: ... - def event_info(self, virtual: str | None = ...) -> Tuple[str, ...]: ... - def image_names(self) -> Tuple[str, ...]: ... - def image_types(self) -> Tuple[str, ...]: ... + def event_info(self, virtual: str | None = ...) -> tuple[str, ...]: ... + def image_names(self) -> tuple[str, ...]: ... + def image_types(self) -> tuple[str, ...]: ... # See #4363 and #4891 def __setitem__(self, key: str, value: Any) -> None: ... def __getitem__(self, key: str) -> Any: ... @@ -470,17 +580,17 @@ class Misc: # TODO: config is an alias of configure, but adding that here creates lots of mypy errors class CallWrapper: - func: Any - subst: Any - widget: Any - def __init__(self, func, subst, widget): ... + func: Incomplete + subst: Incomplete + widget: Incomplete + def __init__(self, func, subst, widget) -> None: ... def __call__(self, *args): ... class XView: @overload - def xview(self) -> Tuple[float, float]: ... + def xview(self) -> tuple[float, float]: ... @overload - def xview(self, *args: Any) -> Any: ... + def xview(self, *args): ... def xview_moveto(self, fraction: float) -> None: ... @overload def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @@ -489,9 +599,9 @@ class XView: class YView: @overload - def yview(self) -> Tuple[float, float]: ... + def yview(self) -> tuple[float, float]: ... @overload - def yview(self, *args: Any) -> Any: ... + def yview(self, *args): ... def yview_moveto(self, fraction: float) -> None: ... @overload def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @@ -504,21 +614,21 @@ class Wm: @overload def wm_aspect( self, minNumer: None = ..., minDenom: None = ..., maxNumer: None = ..., maxDenom: None = ... - ) -> Tuple[int, int, int, int] | None: ... + ) -> tuple[int, int, int, int] | None: ... aspect = wm_aspect @overload - def wm_attributes(self) -> Tuple[Any, ...]: ... + def wm_attributes(self) -> tuple[Any, ...]: ... @overload - def wm_attributes(self, __option: str) -> Any: ... + def wm_attributes(self, __option: str): ... @overload - def wm_attributes(self, __option: str, __value: Any, *__other_option_value_pairs: Any) -> None: ... + def wm_attributes(self, __option: str, __value, *__other_option_value_pairs: Any) -> None: ... attributes = wm_attributes def wm_client(self, name: str | None = ...) -> str: ... client = wm_client @overload def wm_colormapwindows(self) -> list[Misc]: ... @overload - def wm_colormapwindows(self, __wlist: _TkinterSequence[Misc]) -> None: ... + def wm_colormapwindows(self, __wlist: list[Misc] | tuple[Misc, ...]) -> None: ... @overload def wm_colormapwindows(self, __first_wlist_item: Misc, *other_wlist_items: Misc) -> None: ... colormapwindows = wm_colormapwindows @@ -527,11 +637,11 @@ class Wm: # Some of these always return empty string, but return type is set to None to prevent accidentally using it def wm_deiconify(self) -> None: ... deiconify = wm_deiconify - def wm_focusmodel(self, model: Any | None = ...): ... + def wm_focusmodel(self, model: Literal["active", "passive"] | None = ...) -> Literal["active", "passive", ""]: ... focusmodel = wm_focusmodel def wm_forget(self, window: Wm) -> None: ... forget = wm_forget - def wm_frame(self): ... + def wm_frame(self) -> str: ... frame = wm_frame @overload def wm_geometry(self, newGeometry: None = ...) -> str: ... @@ -539,34 +649,38 @@ class Wm: def wm_geometry(self, newGeometry: str) -> None: ... geometry = wm_geometry def wm_grid( - self, baseWidth: Any | None = ..., baseHeight: Any | None = ..., widthInc: Any | None = ..., heightInc: Any | None = ... + self, + baseWidth: Incomplete | None = ..., + baseHeight: Incomplete | None = ..., + widthInc: Incomplete | None = ..., + heightInc: Incomplete | None = ..., ): ... grid = wm_grid - def wm_group(self, pathName: Any | None = ...): ... + def wm_group(self, pathName: Incomplete | None = ...): ... group = wm_group - def wm_iconbitmap(self, bitmap: Any | None = ..., default: Any | None = ...): ... + def wm_iconbitmap(self, bitmap: Incomplete | None = ..., default: Incomplete | None = ...): ... iconbitmap = wm_iconbitmap def wm_iconify(self) -> None: ... iconify = wm_iconify - def wm_iconmask(self, bitmap: Any | None = ...): ... + def wm_iconmask(self, bitmap: Incomplete | None = ...): ... iconmask = wm_iconmask - def wm_iconname(self, newName: Any | None = ...): ... + def wm_iconname(self, newName: Incomplete | None = ...) -> str: ... iconname = wm_iconname def wm_iconphoto(self, default: bool, __image1: Image, *args: Image) -> None: ... iconphoto = wm_iconphoto - def wm_iconposition(self, x: Any | None = ..., y: Any | None = ...): ... + def wm_iconposition(self, x: int | None = ..., y: int | None = ...) -> tuple[int, int] | None: ... iconposition = wm_iconposition - def wm_iconwindow(self, pathName: Any | None = ...): ... + def wm_iconwindow(self, pathName: Incomplete | None = ...): ... iconwindow = wm_iconwindow - def wm_manage(self, widget): ... + def wm_manage(self, widget) -> None: ... manage = wm_manage @overload - def wm_maxsize(self, width: None = ..., height: None = ...) -> Tuple[int, int]: ... + def wm_maxsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ... @overload def wm_maxsize(self, width: int, height: int) -> None: ... maxsize = wm_maxsize @overload - def wm_minsize(self, width: None = ..., height: None = ...) -> Tuple[int, int]: ... + def wm_minsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ... @overload def wm_minsize(self, width: int, height: int) -> None: ... minsize = wm_minsize @@ -575,21 +689,21 @@ class Wm: @overload def wm_overrideredirect(self, boolean: bool) -> None: ... overrideredirect = wm_overrideredirect - def wm_positionfrom(self, who: Any | None = ...): ... + def wm_positionfrom(self, who: Literal["program", "user"] | None = ...) -> Literal["", "program", "user"]: ... positionfrom = wm_positionfrom @overload - def wm_protocol(self, name: str, func: Callable[[], Any] | str) -> None: ... + def wm_protocol(self, name: str, func: Callable[[], object] | str) -> None: ... @overload def wm_protocol(self, name: str, func: None = ...) -> str: ... @overload - def wm_protocol(self, name: None = ..., func: None = ...) -> Tuple[str, ...]: ... + def wm_protocol(self, name: None = ..., func: None = ...) -> tuple[str, ...]: ... protocol = wm_protocol @overload - def wm_resizable(self, width: None = ..., height: None = ...) -> Tuple[bool, bool]: ... + def wm_resizable(self, width: None = ..., height: None = ...) -> tuple[bool, bool]: ... @overload def wm_resizable(self, width: bool, height: bool) -> None: ... resizable = wm_resizable - def wm_sizefrom(self, who: Any | None = ...): ... + def wm_sizefrom(self, who: Literal["program", "user"] | None = ...) -> Literal["", "program", "user"]: ... sizefrom = wm_sizefrom @overload def wm_state(self, newstate: None = ...) -> str: ... @@ -610,12 +724,14 @@ class Wm: withdraw = wm_withdraw class _ExceptionReportingCallback(Protocol): - def __call__(self, __exc: Type[BaseException], __val: BaseException, __tb: TracebackType | None) -> Any: ... + def __call__(self, __exc: type[BaseException], __val: BaseException, __tb: TracebackType | None) -> object: ... class Tk(Misc, Wm): master: None def __init__( - # please update ttkthemes stub if you change this + # Make sure to keep in sync with other functions that use the same + # args. + # use `git grep screenName` to find them self, screenName: str | None = ..., baseName: str | None = ..., @@ -645,49 +761,46 @@ class Tk(Misc, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def loadtk(self) -> None: ... # differs from _tkinter.TkappType.loadtk def destroy(self) -> None: ... def readprofile(self, baseName: str, className: str) -> None: ... report_callback_exception: _ExceptionReportingCallback # Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo - # Please keep in sync with _tkinter.TkappType - call: Callable[..., Any] - def eval(self, __code: str) -> str: ... - adderrorinfo: Any - createcommand: Any - createfilehandler: Any - createtimerhandler: Any - deletecommand: Any - deletefilehandler: Any - dooneevent: Any - evalfile: Any - exprboolean: Any - exprdouble: Any - exprlong: Any - exprstring: Any - getboolean: Any - getdouble: Any - getint: Any - getvar: Any - globalgetvar: Any - globalsetvar: Any - globalunsetvar: Any - interpaddr: Any - mainloop: Any - quit: Any - record: Any - setvar: Any - split: Any - splitlist: Any - unsetvar: Any - wantobjects: Any - willdispatch: Any - -def Tcl(screenName: Any | None = ..., baseName: Any | None = ..., className: str = ..., useTk: bool = ...): ... + # Please keep in sync with _tkinter.TkappType. + # Some methods are intentionally missing because they are inherited from Misc instead. + def adderrorinfo(self, __msg): ... + def call(self, __command: Any, *args: Any) -> Any: ... + def createcommand(self, __name, __func): ... + if sys.platform != "win32": + def createfilehandler(self, __file, __mask, __func): ... + def deletefilehandler(self, __file): ... + + def createtimerhandler(self, __milliseconds, __func): ... + def dooneevent(self, __flags: int = ...): ... + def eval(self, __script: str) -> str: ... + def evalfile(self, __fileName): ... + def exprboolean(self, __s): ... + def exprdouble(self, __s): ... + def exprlong(self, __s): ... + def exprstring(self, __s): ... + def globalgetvar(self, *args, **kwargs): ... + def globalsetvar(self, *args, **kwargs): ... + def globalunsetvar(self, *args, **kwargs): ... + def interpaddr(self): ... + def loadtk(self) -> None: ... + def record(self, __script): ... + if sys.version_info < (3, 11): + def split(self, __arg): ... + + def splitlist(self, __arg): ... + def unsetvar(self, *args, **kwargs): ... + def wantobjects(self, *args, **kwargs): ... + def willdispatch(self): ... + +def Tcl(screenName: str | None = ..., baseName: str | None = ..., className: str = ..., useTk: bool = ...) -> Tk: ... _InMiscTotal = TypedDict("_InMiscTotal", {"in": Misc}) _InMiscNonTotal = TypedDict("_InMiscNonTotal", {"in": Misc}, total=False) @@ -702,8 +815,8 @@ class _PackInfo(_InMiscTotal): # can be specified in pack(). ipadx: int ipady: int - padx: int | Tuple[int, int] - pady: int | Tuple[int, int] + padx: int | tuple[int, int] + pady: int | tuple[int, int] class Pack: # _PackInfo is not the valid type for cnf because pad stuff accepts any @@ -722,8 +835,8 @@ class Pack: side: Literal["left", "right", "top", "bottom"] = ..., ipadx: _ScreenUnits = ..., ipady: _ScreenUnits = ..., - padx: _ScreenUnits | Tuple[_ScreenUnits, _ScreenUnits] = ..., - pady: _ScreenUnits | Tuple[_ScreenUnits, _ScreenUnits] = ..., + padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., + pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 ) -> None: ... @@ -732,14 +845,6 @@ class Pack: pack = pack_configure forget = pack_forget propagate = Misc.pack_propagate - # commented out to avoid mypy getting confused with multiple - # inheritance and how things get overrided with different things - # info = pack_info - # pack_propagate = Misc.pack_propagate - # configure = pack_configure - # config = pack_configure - # slaves = Misc.pack_slaves - # pack_slaves = Misc.pack_slaves class _PlaceInfo(_InMiscNonTotal): # empty dict if widget hasn't been placed anchor: _Anchor @@ -776,13 +881,6 @@ class Place: def place_info(self) -> _PlaceInfo: ... place = place_configure info = place_info - # commented out to avoid mypy getting confused with multiple - # inheritance and how things get overrided with different things - # config = place_configure - # configure = place_configure - # forget = place_forget - # slaves = Misc.place_slaves - # place_slaves = Misc.place_slaves class _GridInfo(_InMiscNonTotal): # empty dict if widget hasn't been gridded column: int @@ -791,8 +889,8 @@ class _GridInfo(_InMiscNonTotal): # empty dict if widget hasn't been gridded rowspan: int ipadx: int ipady: int - padx: int | Tuple[int, int] - pady: int | Tuple[int, int] + padx: int | tuple[int, int] + pady: int | tuple[int, int] sticky: str # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty class Grid: @@ -806,8 +904,8 @@ class Grid: rowspan: int = ..., ipadx: _ScreenUnits = ..., ipady: _ScreenUnits = ..., - padx: _ScreenUnits | Tuple[_ScreenUnits, _ScreenUnits] = ..., - pady: _ScreenUnits | Tuple[_ScreenUnits, _ScreenUnits] = ..., + padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., + pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 @@ -818,29 +916,11 @@ class Grid: grid = grid_configure location = Misc.grid_location size = Misc.grid_size - # commented out to avoid mypy getting confused with multiple - # inheritance and how things get overrided with different things - # bbox = Misc.grid_bbox - # grid_bbox = Misc.grid_bbox - # forget = grid_forget - # info = grid_info - # grid_location = Misc.grid_location - # grid_propagate = Misc.grid_propagate - # grid_size = Misc.grid_size - # rowconfigure = Misc.grid_rowconfigure - # grid_rowconfigure = Misc.grid_rowconfigure - # grid_columnconfigure = Misc.grid_columnconfigure - # columnconfigure = Misc.grid_columnconfigure - # config = grid_configure - # configure = grid_configure - # propagate = Misc.grid_propagate - # slaves = Misc.grid_slaves - # grid_slaves = Misc.grid_slaves class BaseWidget(Misc): master: Misc - widgetName: Any - def __init__(self, master, widgetName, cnf=..., kw=..., extra=...): ... + widgetName: Incomplete + def __init__(self, master, widgetName, cnf=..., kw=..., extra=...) -> None: ... def destroy(self) -> None: ... # This class represents any widget except Toplevel or Tk. @@ -850,12 +930,15 @@ class Widget(BaseWidget, Pack, Place, Grid): # widgets don't. @overload def bind( - self: _W, sequence: str | None = ..., func: Callable[[Event[_W]], Any] | None = ..., add: bool | None = ... + self: _W, + sequence: str | None = ..., + func: Callable[[Event[_W]], object] | None = ..., + add: Literal["", "+"] | bool | None = ..., ) -> str: ... @overload - def bind(self, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def bind(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... @overload - def bind(self, *, func: str, add: bool | None = ...) -> None: ... + def bind(self, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... class Toplevel(BaseWidget, Wm): # Toplevel and Tk have the same options because they correspond to the same @@ -887,7 +970,7 @@ class Toplevel(BaseWidget, Wm): screen: str = ..., # can't be changed after creating widget takefocus: _TakeFocusValue = ..., use: int = ..., - visual: str | Tuple[str, int] = ..., + visual: str | tuple[str, int] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -911,9 +994,9 @@ class Toplevel(BaseWidget, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Button(Widget): @@ -957,7 +1040,7 @@ class Button(Widget): state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., - # We allow the textvariable to be any Variable, not necessarly + # We allow the textvariable to be any Variable, not necessarily # StringVar. This is useful for e.g. a button that displays the value # of an IntVar. textvariable: Variable = ..., @@ -1006,11 +1089,11 @@ class Button(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def flash(self): ... + def flash(self) -> None: ... def invoke(self) -> Any: ... class Canvas(Widget, XView, YView): @@ -1039,11 +1122,11 @@ class Canvas(Widget, XView, YView): insertontime: int = ..., insertwidth: _ScreenUnits = ..., name: str = ..., - offset: Any = ..., # undocumented + offset=..., # undocumented relief: _Relief = ..., # Setting scrollregion to None doesn't reset it back to empty, # but setting it to () does. - scrollregion: Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | Tuple[()] = ..., + scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ..., selectbackground: _Color = ..., selectborderwidth: _ScreenUnits = ..., selectforeground: _Color = ..., @@ -1078,9 +1161,9 @@ class Canvas(Widget, XView, YView): insertofftime: int = ..., insertontime: int = ..., insertwidth: _ScreenUnits = ..., - offset: Any = ..., # undocumented + offset=..., # undocumented relief: _Relief = ..., - scrollregion: Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | Tuple[()] = ..., + scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ..., selectbackground: _Color = ..., selectborderwidth: _ScreenUnits = ..., selectforeground: _Color = ..., @@ -1091,9 +1174,9 @@ class Canvas(Widget, XView, YView): xscrollincrement: _ScreenUnits = ..., yscrollcommand: _XYScrollCommand = ..., yscrollincrement: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def addtag(self, *args): ... # internal method def addtag_above(self, newtag: str, tagOrId: str | _CanvasItemId) -> None: ... @@ -1111,44 +1194,45 @@ class Canvas(Widget, XView, YView): def addtag_overlapping(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ... def addtag_withtag(self, newtag: str, tagOrId: str | _CanvasItemId) -> None: ... def find(self, *args): ... # internal method - def find_above(self, tagOrId: str | _CanvasItemId) -> Tuple[_CanvasItemId, ...]: ... - def find_all(self) -> Tuple[_CanvasItemId, ...]: ... - def find_below(self, tagOrId: str | _CanvasItemId) -> Tuple[_CanvasItemId, ...]: ... + def find_above(self, tagOrId: str | _CanvasItemId) -> tuple[_CanvasItemId, ...]: ... + def find_all(self) -> tuple[_CanvasItemId, ...]: ... + def find_below(self, tagOrId: str | _CanvasItemId) -> tuple[_CanvasItemId, ...]: ... def find_closest( self, x: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | None = ..., start: str | _CanvasItemId | None = ... - ) -> Tuple[_CanvasItemId, ...]: ... + ) -> tuple[_CanvasItemId, ...]: ... def find_enclosed( self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits - ) -> Tuple[_CanvasItemId, ...]: ... - def find_overlapping(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: float) -> Tuple[_CanvasItemId, ...]: ... - def find_withtag(self, tagOrId: str | _CanvasItemId) -> Tuple[_CanvasItemId, ...]: ... - # Canvas.bbox() args are `str | _CanvasItemId`, but mypy rejects that - # description because it's incompatible with Misc.bbox(), an alias for - # Misc.grid_bbox(). Yes it is, but there's not much we can do about it. - def bbox(self, *args: str | _CanvasItemId) -> Tuple[int, int, int, int]: ... # type: ignore + ) -> tuple[_CanvasItemId, ...]: ... + def find_overlapping(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: float) -> tuple[_CanvasItemId, ...]: ... + def find_withtag(self, tagOrId: str | _CanvasItemId) -> tuple[_CanvasItemId, ...]: ... + # Incompatible with Misc.bbox(), tkinter violates LSP + def bbox(self, *args: str | _CanvasItemId) -> tuple[int, int, int, int]: ... # type: ignore[override] @overload def tag_bind( self, - tagOrId: str | int, + tagOrId: str | _CanvasItemId, sequence: str | None = ..., - func: Callable[[Event[Canvas]], Any] | None = ..., - add: bool | None = ..., + func: Callable[[Event[Canvas]], object] | None = ..., + add: Literal["", "+"] | bool | None = ..., ) -> str: ... @overload - def tag_bind(self, tagOrId: str | int, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def tag_bind( + self, tagOrId: str | int, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ... + ) -> None: ... @overload - def tag_bind(self, tagOrId: str | int, *, func: str, add: bool | None = ...) -> None: ... - def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = ...) -> None: ... - def canvasx(self, screenx, gridspacing: Any | None = ...): ... - def canvasy(self, screeny, gridspacing: Any | None = ...): ... + def tag_bind(self, tagOrId: str | _CanvasItemId, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... + def tag_unbind(self, tagOrId: str | _CanvasItemId, sequence: str, funcid: str | None = ...) -> None: ... + def canvasx(self, screenx, gridspacing: Incomplete | None = ...): ... + def canvasy(self, screeny, gridspacing: Incomplete | None = ...): ... @overload - def coords(self) -> list[float]: ... + def coords(self, __tagOrId: str | _CanvasItemId) -> list[float]: ... @overload - def coords(self, __args: _TkinterSequence[int] | _TkinterSequence[float]) -> None: ... + def coords(self, __tagOrId: str | _CanvasItemId, __args: list[int] | list[float] | tuple[float, ...]) -> None: ... @overload - def coords(self, __x1: float, __y1: float, *args: float) -> None: ... - # create_foo() methods accept coords as a list, a tuple, or as separate arguments. - # Keyword arguments should be the same in each pair of overloads. + def coords(self, __tagOrId: str | _CanvasItemId, __x1: float, __y1: float, *args: float) -> None: ... + # create_foo() methods accept coords as a list or tuple, or as separate arguments. + # Lists and tuples can be flat as in [1, 2, 3, 4], or nested as in [(1, 2), (3, 4)]. + # Keyword arguments should be the same in all overloads of each method. def create_arc(self, *args, **kw) -> _CanvasItemId: ... def create_bitmap(self, *args, **kw) -> _CanvasItemId: ... def create_image(self, *args, **kw) -> _CanvasItemId: ... @@ -1160,16 +1244,16 @@ class Canvas(Widget, XView, YView): __x1: float, __y1: float, *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., - arrowshape: Tuple[float, float, float] = ..., + arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledstipple: _Bitmap = ..., disabledwidth: _ScreenUnits = ..., @@ -1180,24 +1264,25 @@ class Canvas(Widget, XView, YView): splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload def create_line( self, - __coords: tuple[float, float, float, float] | list[int] | list[float], + __xy_pair_0: tuple[float, float], + __xy_pair_1: tuple[float, float], *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., - arrowshape: Tuple[float, float, float] = ..., + arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledstipple: _Bitmap = ..., disabledwidth: _ScreenUnits = ..., @@ -1208,7 +1293,42 @@ class Canvas(Widget, XView, YView): splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., + width: _ScreenUnits = ..., + ) -> _CanvasItemId: ... + @overload + def create_line( + self, + __coords: ( + tuple[float, float, float, float] + | tuple[tuple[float, float], tuple[float, float]] + | list[int] + | list[float] + | list[tuple[int, int]] + | list[tuple[float, float]] + ), + *, + activedash: str | list[int] | tuple[int, ...] = ..., + activefill: _Color = ..., + activestipple: str = ..., + activewidth: _ScreenUnits = ..., + arrow: Literal["first", "last", "both"] = ..., + arrowshape: tuple[float, float, float] = ..., + capstyle: Literal["round", "projecting", "butt"] = ..., + dash: str | list[int] | tuple[int, ...] = ..., + dashoffset: _ScreenUnits = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., + disabledfill: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: _ScreenUnits = ..., + fill: _Color = ..., + joinstyle: Literal["round", "bevel", "miter"] = ..., + offset: _ScreenUnits = ..., + smooth: bool = ..., + splinesteps: float = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload @@ -1219,15 +1339,45 @@ class Canvas(Widget, XView, YView): __x1: float, __y1: float, *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., + activefill: _Color = ..., + activeoutline: _Color = ..., + activeoutlinestipple: _Color = ..., + activestipple: str = ..., + activewidth: _ScreenUnits = ..., + dash: str | list[int] | tuple[int, ...] = ..., + dashoffset: _ScreenUnits = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., + disabledfill: _Color = ..., + disabledoutline: _Color = ..., + disabledoutlinestipple: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: _ScreenUnits = ..., + fill: _Color = ..., + offset: _ScreenUnits = ..., + outline: _Color = ..., + outlineoffset: _ScreenUnits = ..., + outlinestipple: _Bitmap = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: str | list[str] | tuple[str, ...] = ..., + width: _ScreenUnits = ..., + ) -> _CanvasItemId: ... + @overload + def create_oval( + self, + __xy_pair_0: tuple[float, float], + __xy_pair_1: tuple[float, float], + *, + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., @@ -1240,23 +1390,30 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload def create_oval( self, - __coords: tuple[float, float, float, float] | list[int] | list[float], + __coords: ( + tuple[float, float, float, float] + | tuple[tuple[float, float], tuple[float, float]] + | list[int] + | list[float] + | list[tuple[int, int]] + | list[tuple[float, float]] + ), *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., @@ -1269,7 +1426,7 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload @@ -1280,15 +1437,48 @@ class Canvas(Widget, XView, YView): __x1: float, __y1: float, *xy_pairs: float, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., + activefill: _Color = ..., + activeoutline: _Color = ..., + activeoutlinestipple: _Color = ..., + activestipple: str = ..., + activewidth: _ScreenUnits = ..., + dash: str | list[int] | tuple[int, ...] = ..., + dashoffset: _ScreenUnits = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., + disabledfill: _Color = ..., + disabledoutline: _Color = ..., + disabledoutlinestipple: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: _ScreenUnits = ..., + fill: _Color = ..., + joinstyle: Literal["round", "bevel", "miter"] = ..., + offset: _ScreenUnits = ..., + outline: _Color = ..., + outlineoffset: _ScreenUnits = ..., + outlinestipple: _Bitmap = ..., + smooth: bool = ..., + splinesteps: float = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: str | list[str] | tuple[str, ...] = ..., + width: _ScreenUnits = ..., + ) -> _CanvasItemId: ... + @overload + def create_polygon( + self, + __xy_pair_0: tuple[float, float], + __xy_pair_1: tuple[float, float], + *xy_pairs: tuple[float, float], + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., @@ -1304,23 +1494,30 @@ class Canvas(Widget, XView, YView): splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload def create_polygon( self, - __coords: Tuple[float, ...] | list[int] | list[float], + __coords: ( + tuple[float, ...] + | tuple[tuple[float, float], ...] + | list[int] + | list[float] + | list[tuple[int, int]] + | list[tuple[float, float]] + ), *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., @@ -1336,7 +1533,7 @@ class Canvas(Widget, XView, YView): splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload @@ -1347,15 +1544,15 @@ class Canvas(Widget, XView, YView): __x1: float, __y1: float, *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., @@ -1368,23 +1565,24 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload def create_rectangle( self, - __coords: tuple[float, float, float, float] | list[int] | list[float], + __xy_pair_0: tuple[float, float], + __xy_pair_1: tuple[float, float], *, - activedash: str | _TkinterSequence[int] = ..., + activedash: str | list[int] | tuple[int, ...] = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: str | _TkinterSequence[int] = ..., + dash: str | list[int] | tuple[int, ...] = ..., dashoffset: _ScreenUnits = ..., - disableddash: str | _TkinterSequence[int] = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., @@ -1397,7 +1595,43 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., + width: _ScreenUnits = ..., + ) -> _CanvasItemId: ... + @overload + def create_rectangle( + self, + __coords: ( + tuple[float, float, float, float] + | tuple[tuple[float, float], tuple[float, float]] + | list[int] + | list[float] + | list[tuple[int, int]] + | list[tuple[float, float]] + ), + *, + activedash: str | list[int] | tuple[int, ...] = ..., + activefill: _Color = ..., + activeoutline: _Color = ..., + activeoutlinestipple: _Color = ..., + activestipple: str = ..., + activewidth: _ScreenUnits = ..., + dash: str | list[int] | tuple[int, ...] = ..., + dashoffset: _ScreenUnits = ..., + disableddash: str | list[int] | tuple[int, ...] = ..., + disabledfill: _Color = ..., + disabledoutline: _Color = ..., + disabledoutlinestipple: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: _ScreenUnits = ..., + fill: _Color = ..., + offset: _ScreenUnits = ..., + outline: _Color = ..., + outlineoffset: _ScreenUnits = ..., + outlinestipple: _Bitmap = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @overload @@ -1417,7 +1651,7 @@ class Canvas(Widget, XView, YView): offset: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @@ -1437,7 +1671,7 @@ class Canvas(Widget, XView, YView): offset: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... @@ -1450,7 +1684,7 @@ class Canvas(Widget, XView, YView): anchor: _Anchor = ..., height: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., window: Widget = ..., ) -> _CanvasItemId: ... @@ -1462,30 +1696,31 @@ class Canvas(Widget, XView, YView): anchor: _Anchor = ..., height: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., - tags: str | _TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., width: _ScreenUnits = ..., window: Widget = ..., ) -> _CanvasItemId: ... - def dchars(self, *args): ... + def dchars(self, *args) -> None: ... def delete(self, *tagsOrCanvasIds: str | _CanvasItemId) -> None: ... @overload def dtag(self, __tag: str, __tag_to_delete: str | None = ...) -> None: ... @overload def dtag(self, __id: _CanvasItemId, __tag_to_delete: str) -> None: ... def focus(self, *args): ... - def gettags(self, __tagOrId: str | _CanvasItemId) -> Tuple[str, ...]: ... - def icursor(self, *args): ... + def gettags(self, __tagOrId: str | _CanvasItemId) -> tuple[str, ...]: ... + def icursor(self, *args) -> None: ... def index(self, *args): ... - def insert(self, *args): ... + def insert(self, *args) -> None: ... def itemcget(self, tagOrId, option): ... # itemconfigure kwargs depend on item type, which is not known when type checking def itemconfigure( self, tagOrId: str | _CanvasItemId, cnf: dict[str, Any] | None = ..., **kw: Any ) -> dict[str, tuple[str, str, str, str, str]] | None: ... itemconfig = itemconfigure - def move(self, *args): ... + def move(self, *args) -> None: ... if sys.version_info >= (3, 8): def moveto(self, tagOrId: str | _CanvasItemId, x: Literal[""] | float = ..., y: Literal[""] | float = ...) -> None: ... + def postscript(self, cnf=..., **kw): ... # tkinter does: # lower = tag_lower @@ -1493,18 +1728,18 @@ class Canvas(Widget, XView, YView): # # But mypy doesn't like aliasing here (maybe because Misc defines the same names) def tag_lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... - def lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore + def lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override] def tag_raise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... - def tkraise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore - def lift(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore - def scale(self, *args): ... - def scan_mark(self, x, y): ... - def scan_dragto(self, x, y, gain: int = ...): ... - def select_adjust(self, tagOrId, index): ... - def select_clear(self): ... - def select_from(self, tagOrId, index): ... + def tkraise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override] + def lift(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override] + def scale(self, *args) -> None: ... + def scan_mark(self, x, y) -> None: ... + def scan_dragto(self, x, y, gain: int = ...) -> None: ... + def select_adjust(self, tagOrId, index) -> None: ... + def select_clear(self) -> None: ... + def select_from(self, tagOrId, index) -> None: ... def select_item(self): ... - def select_to(self, tagOrId, index): ... + def select_to(self, tagOrId, index) -> None: ... def type(self, tagOrId): ... class Checkbutton(Widget): @@ -1614,17 +1849,17 @@ class Checkbutton(Widget): variable: Variable | Literal[""] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def deselect(self): ... - def flash(self): ... + def deselect(self) -> None: ... + def flash(self) -> None: ... def invoke(self) -> Any: ... - def select(self): ... - def toggle(self): ... + def select(self) -> None: ... + def toggle(self) -> None: ... -_EntryIndex = Union[str, int] # "INDICES" in manual page +_EntryIndex: TypeAlias = str | int # "INDICES" in manual page class Entry(Widget, XView): def __init__( @@ -1713,19 +1948,19 @@ class Entry(Widget, XView): vcmd: _EntryValidateCommand = ..., width: int = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def delete(self, first: _EntryIndex, last: _EntryIndex | None = ...) -> None: ... def get(self) -> str: ... def icursor(self, index: _EntryIndex) -> None: ... def index(self, index: _EntryIndex) -> int: ... def insert(self, index: _EntryIndex, string: str) -> None: ... - def scan_mark(self, x): ... - def scan_dragto(self, x): ... + def scan_mark(self, x) -> None: ... + def scan_dragto(self, x) -> None: ... def selection_adjust(self, index: _EntryIndex) -> None: ... - def selection_clear(self) -> None: ... # type: ignore + def selection_clear(self) -> None: ... # type: ignore[override] def selection_from(self, index: _EntryIndex) -> None: ... def selection_present(self) -> bool: ... def selection_range(self, start: _EntryIndex, end: _EntryIndex) -> None: ... @@ -1748,9 +1983,9 @@ class Frame(Widget): bg: _Color = ..., border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., - class_: str = ..., - colormap: Literal["new", ""] | Misc = ..., - container: bool = ..., + class_: str = ..., # can't be changed with configure() + colormap: Literal["new", ""] | Misc = ..., # can't be changed with configure() + container: bool = ..., # can't be changed with configure() cursor: _Cursor = ..., height: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -1761,7 +1996,7 @@ class Frame(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - visual: str | Tuple[str, int] = ..., + visual: str | tuple[str, int] = ..., # can't be changed with configure() width: _ScreenUnits = ..., ) -> None: ... @overload @@ -1784,9 +2019,9 @@ class Frame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Label(Widget): @@ -1864,9 +2099,9 @@ class Label(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Listbox(Widget, XView, YView): @@ -1954,35 +2189,33 @@ class Listbox(Widget, XView, YView): width: int = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def activate(self, index): ... - def bbox(self, index): ... + def activate(self, index: str | int) -> None: ... + def bbox(self, index: str | int) -> tuple[int, int, int, int] | None: ... # type: ignore[override] def curselection(self): ... - def delete(self, first, last: Any | None = ...): ... - def get(self, first, last: Any | None = ...): ... - def index(self, index): ... - def insert(self, index, *elements): ... + def delete(self, first: str | int, last: str | int | None = ...) -> None: ... + def get(self, first: str | int, last: str | int | None = ...): ... + def index(self, index: str | int) -> int: ... + def insert(self, index: str | int, *elements: str | float) -> None: ... def nearest(self, y): ... - def scan_mark(self, x, y): ... - def scan_dragto(self, x, y): ... - def see(self, index): ... - def selection_anchor(self, index): ... - select_anchor: Any - def selection_clear(self, first, last: Any | None = ...): ... # type: ignore - select_clear: Any - def selection_includes(self, index): ... - select_includes: Any - def selection_set(self, first, last: Any | None = ...): ... - select_set: Any - def size(self): ... - def itemcget(self, index, option): ... - def itemconfigure(self, index, cnf: Any | None = ..., **kw): ... - itemconfig: Any - -_MenuIndex = Union[str, int] + def scan_mark(self, x, y) -> None: ... + def scan_dragto(self, x, y) -> None: ... + def see(self, index: str | int) -> None: ... + def selection_anchor(self, index: str | int) -> None: ... + select_anchor = selection_anchor + def selection_clear(self, first: str | int, last: str | int | None = ...) -> None: ... # type: ignore[override] + select_clear = selection_clear + def selection_includes(self, index: str | int): ... + select_includes = selection_includes + def selection_set(self, first: str | int, last: str | int | None = ...) -> None: ... + select_set = selection_set + def size(self) -> int: ... # type: ignore[override] + def itemcget(self, index: str | int, option): ... + def itemconfigure(self, index: str | int, cnf: Incomplete | None = ..., **kw): ... + itemconfig = itemconfigure class Menu(Widget): def __init__( @@ -2004,7 +2237,7 @@ class Menu(Widget): font: _FontDescription = ..., foreground: _Color = ..., name: str = ..., - postcommand: Callable[[], Any] | str = ..., + postcommand: Callable[[], object] | str = ..., relief: _Relief = ..., selectcolor: _Color = ..., takefocus: _TakeFocusValue = ..., @@ -2012,7 +2245,7 @@ class Menu(Widget): # I guess tearoffcommand arguments are supposed to be widget objects, # but they are widget name strings. Use nametowidget() to handle the # arguments of tearoffcommand. - tearoffcommand: Callable[[str, str], Any] | str = ..., + tearoffcommand: Callable[[str, str], object] | str = ..., title: str = ..., type: Literal["menubar", "tearoff", "normal"] = ..., ) -> None: ... @@ -2034,20 +2267,20 @@ class Menu(Widget): fg: _Color = ..., font: _FontDescription = ..., foreground: _Color = ..., - postcommand: Callable[[], Any] | str = ..., + postcommand: Callable[[], object] | str = ..., relief: _Relief = ..., selectcolor: _Color = ..., takefocus: _TakeFocusValue = ..., tearoff: bool = ..., - tearoffcommand: Callable[[str, str], Any] | str = ..., + tearoffcommand: Callable[[str, str], object] | str = ..., title: str = ..., type: Literal["menubar", "tearoff", "normal"] = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def tk_popup(self, x: int, y: int, entry: _MenuIndex = ...) -> None: ... - def activate(self, index: _MenuIndex) -> None: ... + def tk_popup(self, x: int, y: int, entry: str | int = ...) -> None: ... + def activate(self, index: str | int) -> None: ... def add(self, itemType, cnf=..., **kw): ... # docstring says "Internal function." def insert(self, index, itemType, cnf=..., **kw): ... # docstring says "Internal function." def add_cascade( @@ -2060,7 +2293,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2081,7 +2314,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2107,7 +2340,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2127,7 +2360,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2145,7 +2378,7 @@ class Menu(Widget): def add_separator(self, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... def insert_cascade( self, - index: _MenuIndex, + index: str | int, cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., @@ -2154,7 +2387,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2167,7 +2400,7 @@ class Menu(Widget): ) -> None: ... def insert_checkbutton( self, - index: _MenuIndex, + index: str | int, cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., @@ -2176,7 +2409,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2194,7 +2427,7 @@ class Menu(Widget): ) -> None: ... def insert_command( self, - index: _MenuIndex, + index: str | int, cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., @@ -2203,7 +2436,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2215,7 +2448,7 @@ class Menu(Widget): ) -> None: ... def insert_radiobutton( self, - index: _MenuIndex, + index: str | int, cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., @@ -2224,7 +2457,7 @@ class Menu(Widget): background: _Color = ..., bitmap: _Bitmap = ..., columnbreak: int = ..., - command: Callable[[], Any] | str = ..., + command: Callable[[], object] | str = ..., compound: _Compound = ..., font: _FontDescription = ..., foreground: _Color = ..., @@ -2239,20 +2472,20 @@ class Menu(Widget): value: Any = ..., variable: Variable = ..., ) -> None: ... - def insert_separator(self, index: _MenuIndex, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... - def delete(self, index1: _MenuIndex, index2: _MenuIndex | None = ...) -> None: ... - def entrycget(self, index: _MenuIndex, option: str) -> Any: ... + def insert_separator(self, index: str | int, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... + def delete(self, index1: str | int, index2: str | int | None = ...) -> None: ... + def entrycget(self, index: str | int, option: str) -> Any: ... def entryconfigure( - self, index: _MenuIndex, cnf: dict[str, Any] | None = ..., **kw: Any - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + self, index: str | int, cnf: dict[str, Any] | None = ..., **kw: Any + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... entryconfig = entryconfigure - def index(self, index: _MenuIndex) -> int | None: ... - def invoke(self, index: _MenuIndex) -> Any: ... + def index(self, index: str | int) -> int | None: ... + def invoke(self, index: str | int) -> Any: ... def post(self, x: int, y: int) -> None: ... - def type(self, index: _MenuIndex) -> Literal["cascade", "checkbutton", "command", "radiobutton", "separator"]: ... + def type(self, index: str | int) -> Literal["cascade", "checkbutton", "command", "radiobutton", "separator"]: ... def unpost(self) -> None: ... - def xposition(self, index: _MenuIndex) -> int: ... - def yposition(self, index: _MenuIndex) -> int: ... + def xposition(self, index: str | int) -> int: ... + def yposition(self, index: str | int) -> int: ... class Menubutton(Widget): def __init__( @@ -2335,9 +2568,9 @@ class Menubutton(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Message(Widget): @@ -2398,9 +2631,9 @@ class Message(Widget): text: float | str = ..., textvariable: Variable = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Radiobutton(Widget): @@ -2498,14 +2731,14 @@ class Radiobutton(Widget): variable: Variable | Literal[""] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def deselect(self): ... - def flash(self): ... + def deselect(self) -> None: ... + def flash(self) -> None: ... def invoke(self) -> Any: ... - def select(self): ... + def select(self) -> None: ... class Scale(Widget): def __init__( @@ -2521,7 +2754,7 @@ class Scale(Widget): border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., # don't know why the callback gets string instead of float - command: str | Callable[[str], Any] = ..., + command: str | Callable[[str], object] = ..., cursor: _Cursor = ..., digits: int = ..., fg: _Color = ..., @@ -2562,7 +2795,7 @@ class Scale(Widget): bigincrement: float = ..., border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., - command: str | Callable[[str], Any] = ..., + command: str | Callable[[str], object] = ..., cursor: _Cursor = ..., digits: int = ..., fg: _Color = ..., @@ -2589,14 +2822,14 @@ class Scale(Widget): troughcolor: _Color = ..., variable: IntVar | DoubleVar = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def get(self): ... - def set(self, value): ... - def coords(self, value: Any | None = ...): ... - def identify(self, x, y): ... + def get(self) -> float: ... + def set(self, value) -> None: ... + def coords(self, value: float | None = ...) -> tuple[int, int]: ... + def identify(self, x, y) -> Literal["", "slider", "trough1", "trough2"]: ... class Scrollbar(Widget): def __init__( @@ -2615,7 +2848,7 @@ class Scrollbar(Widget): # 'SCROLLING COMMANDS' in scrollbar man page. There doesn't seem to # be any way to specify an overloaded callback function, so we say # that it can take any args while it can't in reality. - command: Callable[..., Tuple[float, float] | None] | str = ..., + command: Callable[..., tuple[float, float] | None] | str = ..., cursor: _Cursor = ..., elementborderwidth: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -2643,7 +2876,7 @@ class Scrollbar(Widget): bg: _Color = ..., border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., - command: Callable[..., Tuple[float, float] | None] | str = ..., + command: Callable[..., tuple[float, float] | None] | str = ..., cursor: _Cursor = ..., elementborderwidth: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -2657,18 +2890,18 @@ class Scrollbar(Widget): takefocus: _TakeFocusValue = ..., troughcolor: _Color = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def activate(self, index: Any | None = ...): ... - def delta(self, deltax, deltay): ... - def fraction(self, x, y): ... - def identify(self, x, y): ... - def get(self): ... - def set(self, first, last): ... + def activate(self, index: Incomplete | None = ...): ... + def delta(self, deltax: int, deltay: int) -> float: ... + def fraction(self, x: int, y: int) -> float: ... + def identify(self, x: int, y: int) -> Literal["arrow1", "arrow2", "slider", "trough1", "trough2", ""]: ... + def get(self) -> tuple[float, float, float, float] | tuple[float, float]: ... + def set(self, first: float, last: float) -> None: ... -_TextIndex = Union[_tkinter.Tcl_Obj, str, float, Misc] +_TextIndex: TypeAlias = _tkinter.Tcl_Obj | str | float | Misc class Text(Widget, XView, YView): def __init__( @@ -2718,7 +2951,7 @@ class Text(Widget, XView, YView): startline: int | Literal[""] = ..., state: Literal["normal", "disabled"] = ..., # Literal inside Tuple doesn't actually work - tabs: _ScreenUnits | str | Tuple[_ScreenUnits | str, ...] = ..., + tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., @@ -2769,7 +3002,7 @@ class Text(Widget, XView, YView): spacing3: _ScreenUnits = ..., startline: int | Literal[""] = ..., state: Literal["normal", "disabled"] = ..., - tabs: _ScreenUnits | str | Tuple[_ScreenUnits | str, ...] = ..., + tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., @@ -2777,11 +3010,11 @@ class Text(Widget, XView, YView): wrap: Literal["none", "char", "word"] = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, index: _TextIndex) -> Tuple[int, int, int, int] | None: ... # type: ignore + def bbox(self, index: _TextIndex) -> tuple[int, int, int, int] | None: ... # type: ignore[override] def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool: ... def count(self, index1, index2, *args): ... # TODO @overload @@ -2789,7 +3022,7 @@ class Text(Widget, XView, YView): @overload def debug(self, boolean: bool) -> None: ... def delete(self, index1: _TextIndex, index2: _TextIndex | None = ...) -> None: ... - def dlineinfo(self, index: _TextIndex) -> Tuple[int, int, int, int, int] | None: ... + def dlineinfo(self, index: _TextIndex) -> tuple[int, int, int, int, int] | None: ... @overload def dump( self, @@ -2803,13 +3036,13 @@ class Text(Widget, XView, YView): tag: bool = ..., text: bool = ..., window: bool = ..., - ) -> list[Tuple[str, str, str]]: ... + ) -> list[tuple[str, str, str]]: ... @overload def dump( self, index1: _TextIndex, index2: _TextIndex | None, - command: Callable[[str, str, str], Any] | str, + command: Callable[[str, str, str], object] | str, *, all: bool = ..., image: bool = ..., @@ -2824,7 +3057,7 @@ class Text(Widget, XView, YView): index1: _TextIndex, index2: _TextIndex | None = ..., *, - command: Callable[[str, str, str], Any] | str, + command: Callable[[str, str, str], object] | str, all: bool = ..., image: bool = ..., mark: bool = ..., @@ -2844,24 +3077,24 @@ class Text(Widget, XView, YView): def get(self, index1: _TextIndex, index2: _TextIndex | None = ...) -> str: ... # TODO: image_* methods def image_cget(self, index, option): ... - def image_configure(self, index, cnf: Any | None = ..., **kw): ... + def image_configure(self, index, cnf: Incomplete | None = ..., **kw): ... def image_create(self, index, cnf=..., **kw): ... def image_names(self): ... def index(self, index: _TextIndex) -> str: ... - def insert(self, index: _TextIndex, chars: str, *args: str | _TkinterSequence[str]) -> None: ... + def insert(self, index: _TextIndex, chars: str, *args: str | list[str] | tuple[str, ...]) -> None: ... @overload def mark_gravity(self, markName: str, direction: None = ...) -> Literal["left", "right"]: ... @overload def mark_gravity(self, markName: str, direction: Literal["left", "right"]) -> None: ... # actually returns empty string - def mark_names(self) -> Tuple[str, ...]: ... + def mark_names(self) -> tuple[str, ...]: ... def mark_set(self, markName: str, index: _TextIndex) -> None: ... def mark_unset(self, *markNames: str) -> None: ... def mark_next(self, index: _TextIndex) -> str | None: ... def mark_previous(self, index: _TextIndex) -> str | None: ... # **kw of peer_create is same as the kwargs of Text.__init__ - def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def peer_names(self) -> Tuple[_tkinter.Tcl_Obj, ...]: ... - def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: str | _TkinterSequence[str]) -> None: ... + def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = ..., **kw) -> None: ... + def peer_names(self) -> tuple[_tkinter.Tcl_Obj, ...]: ... + def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: str | list[str] | tuple[str, ...]) -> None: ... def scan_mark(self, x: int, y: int) -> None: ... def scan_dragto(self, x: int, y: int) -> None: ... def search( @@ -2882,13 +3115,17 @@ class Text(Widget, XView, YView): # tag_bind stuff is very similar to Canvas @overload def tag_bind( - self, tagName: str, sequence: str | None, func: Callable[[Event[Text]], Any] | None, add: bool | None = ... + self, + tagName: str, + sequence: str | None, + func: Callable[[Event[Text]], object] | None, + add: Literal["", "+"] | bool | None = ..., ) -> str: ... @overload - def tag_bind(self, tagName: str, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def tag_bind(self, tagName: str, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ... def tag_unbind(self, tagName: str, sequence: str, funcid: str | None = ...) -> None: ... # allowing any string for cget instead of just Literals because there's no other way to look up tag options - def tag_cget(self, tagName: str, option: str) -> Any: ... + def tag_cget(self, tagName: str, option: str): ... @overload def tag_configure( self, @@ -2923,35 +3160,35 @@ class Text(Widget, XView, YView): underline: bool = ..., underlinefg: _Color = ..., wrap: Literal["none", "char", "word"] = ..., # be careful with "none" vs None - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def tag_configure(self, tagName: str, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def tag_configure(self, tagName: str, cnf: str) -> tuple[str, str, str, Any, Any]: ... tag_config = tag_configure def tag_delete(self, __first_tag_name: str, *tagNames: str) -> None: ... # error if no tag names given def tag_lower(self, tagName: str, belowThis: str | None = ...) -> None: ... - def tag_names(self, index: _TextIndex | None = ...) -> Tuple[str, ...]: ... - def tag_nextrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> Tuple[str, str] | Tuple[()]: ... - def tag_prevrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> Tuple[str, str] | Tuple[()]: ... + def tag_names(self, index: _TextIndex | None = ...) -> tuple[str, ...]: ... + def tag_nextrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> tuple[str, str] | tuple[()]: ... + def tag_prevrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> tuple[str, str] | tuple[()]: ... def tag_raise(self, tagName: str, aboveThis: str | None = ...) -> None: ... - def tag_ranges(self, tagName: str) -> Tuple[_tkinter.Tcl_Obj, ...]: ... + def tag_ranges(self, tagName: str) -> tuple[_tkinter.Tcl_Obj, ...]: ... # tag_remove and tag_delete are different def tag_remove(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> None: ... # TODO: window_* methods def window_cget(self, index, option): ... - def window_configure(self, index, cnf: Any | None = ..., **kw): ... + def window_configure(self, index, cnf: Incomplete | None = ..., **kw): ... window_config = window_configure - def window_create(self, index, cnf=..., **kw): ... + def window_create(self, index, cnf=..., **kw) -> None: ... def window_names(self): ... def yview_pickplace(self, *what): ... # deprecated class _setit: - def __init__(self, var, value, callback: Any | None = ...): ... - def __call__(self, *args): ... + def __init__(self, var, value, callback: Incomplete | None = ...) -> None: ... + def __call__(self, *args) -> None: ... # manual page: tk_optionMenu class OptionMenu(Menubutton): - widgetName: Any - menuname: Any + widgetName: Incomplete + menuname: Incomplete def __init__( # differs from other widgets self, @@ -2960,10 +3197,10 @@ class OptionMenu(Menubutton): value: str, *values: str, # kwarg only from now on - command: Callable[[StringVar], Any] | None = ..., + command: Callable[[StringVar], object] | None = ..., ) -> None: ... # configure, config, cget are inherited from Menubutton - # destroy and __getitem__ are overrided, signature does not change + # destroy and __getitem__ are overridden, signature does not change class _Image(Protocol): tk: _tkinter.TkappType @@ -2971,14 +3208,16 @@ class _Image(Protocol): def width(self) -> int: ... class Image: - name: Any + name: Incomplete tk: _tkinter.TkappType - def __init__(self, imgtype, name: Any | None = ..., cnf=..., master: Misc | _tkinter.TkappType | None = ..., **kw): ... - def __del__(self): ... - def __setitem__(self, key, value): ... + def __init__( + self, imgtype, name: Incomplete | None = ..., cnf=..., master: Misc | _tkinter.TkappType | None = ..., **kw + ) -> None: ... + def __del__(self) -> None: ... + def __setitem__(self, key, value) -> None: ... def __getitem__(self, key): ... - configure: Any - config: Any + configure: Incomplete + config: Incomplete def height(self) -> int: ... def type(self): ... def width(self) -> int: ... @@ -3016,9 +3255,21 @@ class PhotoImage(Image): def copy(self) -> PhotoImage: ... def zoom(self, x: int, y: int | Literal[""] = ...) -> PhotoImage: ... def subsample(self, x: int, y: int | Literal[""] = ...) -> PhotoImage: ... - def get(self, x: int, y: int) -> Tuple[int, int, int]: ... - def put(self, data: str | _TkinterSequence[str] | _TkinterSequence2D[_Color], to: Tuple[int, int] | None = ...) -> None: ... - def write(self, filename: StrOrBytesPath, format: str | None = ..., from_coords: Tuple[int, int] | None = ...) -> None: ... + def get(self, x: int, y: int) -> tuple[int, int, int]: ... + def put( + self, + data: ( + str + | list[str] + | list[list[_Color]] + | list[tuple[_Color, ...]] + | tuple[str, ...] + | tuple[list[_Color], ...] + | tuple[tuple[_Color, ...], ...] + ), + to: tuple[int, int] | None = ..., + ) -> None: ... + def write(self, filename: StrOrBytesPath, format: str | None = ..., from_coords: tuple[int, int] | None = ...) -> None: ... if sys.version_info >= (3, 8): def transparency_get(self, x: int, y: int) -> bool: ... def transparency_set(self, x: int, y: int, boolean: bool) -> None: ... @@ -3026,7 +3277,7 @@ class PhotoImage(Image): class BitmapImage(Image): def __init__( self, - name: Any | None = ..., + name: Incomplete | None = ..., cnf: dict[str, Any] = ..., master: Misc | _tkinter.TkappType | None = ..., *, @@ -3038,8 +3289,8 @@ class BitmapImage(Image): maskfile: StrOrBytesPath = ..., ) -> None: ... -def image_names() -> Tuple[str, ...]: ... -def image_types() -> Tuple[str, ...]: ... +def image_names() -> tuple[str, ...]: ... +def image_types() -> tuple[str, ...]: ... class Spinbox(Widget, XView): def __init__( @@ -3057,8 +3308,8 @@ class Spinbox(Widget, XView): buttoncursor: _Cursor = ..., buttondownrelief: _Relief = ..., buttonuprelief: _Relief = ..., - # percent substitutions don't seem to be supported, it's similar to Entry's validion stuff - command: Callable[[], Any] | str | _TkinterSequence[str] = ..., + # percent substitutions don't seem to be supported, it's similar to Entry's validation stuff + command: Callable[[], object] | str | list[str] | tuple[str, ...] = ..., cursor: _Cursor = ..., disabledbackground: _Color = ..., disabledforeground: _Color = ..., @@ -3095,7 +3346,7 @@ class Spinbox(Widget, XView): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: _EntryValidateCommand = ..., vcmd: _EntryValidateCommand = ..., - values: _TkinterSequence[str] = ..., + values: list[str] | tuple[str, ...] = ..., width: int = ..., wrap: bool = ..., xscrollcommand: _XYScrollCommand = ..., @@ -3115,7 +3366,7 @@ class Spinbox(Widget, XView): buttoncursor: _Cursor = ..., buttondownrelief: _Relief = ..., buttonuprelief: _Relief = ..., - command: Callable[[], Any] | str | _TkinterSequence[str] = ..., + command: Callable[[], object] | str | list[str] | tuple[str, ...] = ..., cursor: _Cursor = ..., disabledbackground: _Color = ..., disabledforeground: _Color = ..., @@ -3151,30 +3402,30 @@ class Spinbox(Widget, XView): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: _EntryValidateCommand = ..., vcmd: _EntryValidateCommand = ..., - values: _TkinterSequence[str] = ..., + values: list[str] | tuple[str, ...] = ..., width: int = ..., wrap: bool = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, index): ... - def delete(self, first, last: Any | None = ...): ... - def get(self): ... + def bbox(self, index) -> tuple[int, int, int, int] | None: ... # type: ignore[override] + def delete(self, first, last: Incomplete | None = ...) -> Literal[""]: ... + def get(self) -> str: ... def icursor(self, index): ... - def identify(self, x, y): ... - def index(self, index): ... - def insert(self, index, s): ... + def identify(self, x: int, y: int) -> Literal["", "buttondown", "buttonup", "entry"]: ... + def index(self, index: _EntryIndex) -> int: ... + def insert(self, index: _EntryIndex, s: str) -> Literal[""]: ... # spinbox.invoke("asdf") gives error mentioning .invoke("none"), but it's not documented def invoke(self, element: Literal["none", "buttonup", "buttondown"]) -> Literal[""]: ... def scan(self, *args): ... def scan_mark(self, x): ... def scan_dragto(self, x): ... - def selection(self, *args: Any) -> Tuple[int, ...]: ... + def selection(self, *args) -> tuple[int, ...]: ... def selection_adjust(self, index): ... def selection_clear(self): ... - def selection_element(self, element: Any | None = ...): ... + def selection_element(self, element: Incomplete | None = ...): ... if sys.version_info >= (3, 8): def selection_from(self, index: int) -> None: ... def selection_present(self) -> None: ... @@ -3192,9 +3443,9 @@ class LabelFrame(Widget): bg: _Color = ..., border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., - class_: str = ..., - colormap: Literal["new", ""] | Misc = ..., - container: bool = ..., # undocumented + class_: str = ..., # can't be changed with configure() + colormap: Literal["new", ""] | Misc = ..., # can't be changed with configure() + container: bool = ..., # undocumented, can't be changed with configure() cursor: _Cursor = ..., fg: _Color = ..., font: _FontDescription = ..., @@ -3212,7 +3463,7 @@ class LabelFrame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., - visual: str | Tuple[str, int] = ..., + visual: str | tuple[str, int] = ..., # can't be changed with configure() width: _ScreenUnits = ..., ) -> None: ... @overload @@ -3241,9 +3492,9 @@ class LabelFrame(Widget): takefocus: _TakeFocusValue = ..., text: float | str = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class PanedWindow(Widget): @@ -3301,14 +3552,14 @@ class PanedWindow(Widget): sashwidth: _ScreenUnits = ..., showhandle: bool = ..., width: _ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def add(self, child: Widget, **kw): ... - def remove(self, child): ... - forget: Any - def identify(self, x, y): ... + def add(self, child: Widget, **kw) -> None: ... + def remove(self, child) -> None: ... + forget: Incomplete + def identify(self, x: int, y: int): ... def proxy(self, *args): ... def proxy_coord(self): ... def proxy_forget(self): ... @@ -3318,6 +3569,8 @@ class PanedWindow(Widget): def sash_mark(self, index): ... def sash_place(self, index, x, y): ... def panecget(self, child, option): ... - def paneconfigure(self, tagOrId, cnf: Any | None = ..., **kw): ... - paneconfig: Any + def paneconfigure(self, tagOrId, cnf: Incomplete | None = ..., **kw): ... + paneconfig: Incomplete def panes(self): ... + +def _test() -> None: ... diff --git a/stdlib/tkinter/colorchooser.pyi b/stdlib/tkinter/colorchooser.pyi index 184f9a2..47eb222 100644 --- a/stdlib/tkinter/colorchooser.pyi +++ b/stdlib/tkinter/colorchooser.pyi @@ -1,7 +1,20 @@ +import sys +from tkinter import Misc, _Color from tkinter.commondialog import Dialog -from typing import Any, ClassVar, Tuple +from typing import ClassVar + +if sys.version_info >= (3, 9): + __all__ = ["Chooser", "askcolor"] class Chooser(Dialog): command: ClassVar[str] -def askcolor(color: str | bytes | None = ..., **options: Any) -> Tuple[None, None] | Tuple[Tuple[float, float, float], str]: ... +if sys.version_info >= (3, 9): + def askcolor( + color: str | bytes | None = ..., *, initialcolor: _Color = ..., parent: Misc = ..., title: str = ... + ) -> tuple[None, None] | tuple[tuple[int, int, int], str]: ... + +else: + def askcolor( + color: str | bytes | None = ..., *, initialcolor: _Color = ..., parent: Misc = ..., title: str = ... + ) -> tuple[None, None] | tuple[tuple[float, float, float], str]: ... diff --git a/stdlib/tkinter/commondialog.pyi b/stdlib/tkinter/commondialog.pyi index aee5811..edae625 100644 --- a/stdlib/tkinter/commondialog.pyi +++ b/stdlib/tkinter/commondialog.pyi @@ -1,8 +1,14 @@ -from typing import Any, ClassVar, Mapping +import sys +from _typeshed import Incomplete +from collections.abc import Mapping +from typing import ClassVar + +if sys.version_info >= (3, 9): + __all__ = ["Dialog"] class Dialog: command: ClassVar[str | None] - master: Any | None - options: Mapping[str, Any] - def __init__(self, master: Any | None = ..., **options) -> None: ... - def show(self, **options) -> Any: ... + master: Incomplete | None + options: Mapping[str, Incomplete] + def __init__(self, master: Incomplete | None = ..., **options: Incomplete) -> None: ... + def show(self, **options: Incomplete) -> Incomplete: ... diff --git a/stdlib/tkinter/dialog.pyi b/stdlib/tkinter/dialog.pyi index bc927e1..032dac2 100644 --- a/stdlib/tkinter/dialog.pyi +++ b/stdlib/tkinter/dialog.pyi @@ -1,10 +1,16 @@ +import sys +from _typeshed import Incomplete +from collections.abc import Mapping from tkinter import Widget -from typing import Any, Mapping +from typing import Any + +if sys.version_info >= (3, 9): + __all__ = ["Dialog"] DIALOG_ICON: str class Dialog(Widget): widgetName: str num: int - def __init__(self, master: Any | None = ..., cnf: Mapping[str, Any] = ..., **kw) -> None: ... + def __init__(self, master: Incomplete | None = ..., cnf: Mapping[str, Any] = ..., **kw: Incomplete) -> None: ... def destroy(self) -> None: ... diff --git a/stdlib/tkinter/dnd.pyi b/stdlib/tkinter/dnd.pyi index 339291a..ad79729 100644 --- a/stdlib/tkinter/dnd.pyi +++ b/stdlib/tkinter/dnd.pyi @@ -1,6 +1,10 @@ +import sys from tkinter import Event, Misc, Tk, Widget from typing import ClassVar, Protocol +if sys.version_info >= (3, 9): + __all__ = ["dnd_start", "DndHandler"] + class _DndSource(Protocol): def dnd_end(self, target: Widget | None, event: Event[Misc] | None) -> None: ... @@ -12,4 +16,4 @@ class DndHandler: def on_motion(self, event: Event[Misc]) -> None: ... def on_release(self, event: Event[Misc]) -> None: ... -def dnd_start(source, event) -> DndHandler | None: ... +def dnd_start(source: _DndSource, event: Event[Misc]) -> DndHandler | None: ... diff --git a/stdlib/tkinter/filedialog.pyi b/stdlib/tkinter/filedialog.pyi index ca5ecff..d0b7e45 100644 --- a/stdlib/tkinter/filedialog.pyi +++ b/stdlib/tkinter/filedialog.pyi @@ -1,14 +1,33 @@ -from _typeshed import StrOrBytesPath -from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, _TkinterSequence, commondialog -from typing import IO, Any, ClassVar, Iterable, Tuple +import sys +from _typeshed import Incomplete, StrOrBytesPath +from collections.abc import Iterable +from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog +from typing import IO, ClassVar from typing_extensions import Literal -dialogstates: dict[Any, Tuple[Any, Any]] +if sys.version_info >= (3, 9): + __all__ = [ + "FileDialog", + "LoadFileDialog", + "SaveFileDialog", + "Open", + "SaveAs", + "Directory", + "askopenfilename", + "asksaveasfilename", + "askopenfilenames", + "askopenfile", + "askopenfiles", + "asksaveasfile", + "askdirectory", + ] + +dialogstates: dict[Incomplete, tuple[Incomplete, Incomplete]] class FileDialog: title: str - master: Any - directory: Any | None + master: Incomplete + directory: Incomplete | None top: Toplevel botframe: Frame selection: Entry @@ -22,21 +41,21 @@ class FileDialog: filter_button: Button cancel_button: Button def __init__( - self, master, title: Any | None = ... + self, master, title: Incomplete | None = ... ) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either - how: Any | None - def go(self, dir_or_file: Any = ..., pattern: str = ..., default: str = ..., key: Any | None = ...): ... - def quit(self, how: Any | None = ...) -> None: ... + how: Incomplete | None + def go(self, dir_or_file=..., pattern: str = ..., default: str = ..., key: Incomplete | None = ...): ... + def quit(self, how: Incomplete | None = ...) -> None: ... def dirs_double_event(self, event) -> None: ... def dirs_select_event(self, event) -> None: ... def files_double_event(self, event) -> None: ... def files_select_event(self, event) -> None: ... def ok_event(self, event) -> None: ... def ok_command(self) -> None: ... - def filter_command(self, event: Any | None = ...) -> None: ... + def filter_command(self, event: Incomplete | None = ...) -> None: ... def get_filter(self): ... def get_selection(self): ... - def cancel_command(self, event: Any | None = ...) -> None: ... + def cancel_command(self, event: Incomplete | None = ...) -> None: ... def set_filter(self, dir, pat) -> None: ... def set_selection(self, file) -> None: ... @@ -46,7 +65,7 @@ class LoadFileDialog(FileDialog): class SaveFileDialog(FileDialog): title: str - def ok_command(self): ... + def ok_command(self) -> None: ... class _Dialog(commondialog.Dialog): ... @@ -64,7 +83,7 @@ def asksaveasfilename( *, confirmoverwrite: bool | None = ..., defaultextension: str | None = ..., - filetypes: Iterable[Tuple[str, str] | Tuple[str, _TkinterSequence[str]]] | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., parent: Misc | None = ..., @@ -74,7 +93,7 @@ def asksaveasfilename( def askopenfilename( *, defaultextension: str | None = ..., - filetypes: Iterable[Tuple[str, str] | Tuple[str, _TkinterSequence[str]]] | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., parent: Misc | None = ..., @@ -84,13 +103,13 @@ def askopenfilename( def askopenfilenames( *, defaultextension: str | None = ..., - filetypes: Iterable[Tuple[str, str] | Tuple[str, _TkinterSequence[str]]] | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., parent: Misc | None = ..., title: str | None = ..., typevariable: StringVar | str | None = ..., -) -> Literal[""] | Tuple[str, ...]: ... +) -> Literal[""] | tuple[str, ...]: ... def askdirectory( *, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = ..., parent: Misc | None = ..., title: str | None = ... ) -> str: ... # can be empty string @@ -101,33 +120,33 @@ def asksaveasfile( *, confirmoverwrite: bool | None = ..., defaultextension: str | None = ..., - filetypes: Iterable[Tuple[str, str] | Tuple[str, _TkinterSequence[str]]] | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., parent: Misc | None = ..., title: str | None = ..., typevariable: StringVar | str | None = ..., -) -> IO[Any] | None: ... +) -> IO[Incomplete] | None: ... def askopenfile( mode: str = ..., *, defaultextension: str | None = ..., - filetypes: Iterable[Tuple[str, str] | Tuple[str, _TkinterSequence[str]]] | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., parent: Misc | None = ..., title: str | None = ..., typevariable: StringVar | str | None = ..., -) -> IO[Any] | None: ... +) -> IO[Incomplete] | None: ... def askopenfiles( mode: str = ..., *, defaultextension: str | None = ..., - filetypes: Iterable[Tuple[str, str] | Tuple[str, _TkinterSequence[str]]] | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., parent: Misc | None = ..., title: str | None = ..., typevariable: StringVar | str | None = ..., -) -> Tuple[IO[Any], ...]: ... # can be empty tuple +) -> tuple[IO[Incomplete], ...]: ... # can be empty tuple def test() -> None: ... diff --git a/stdlib/tkinter/font.pyi b/stdlib/tkinter/font.pyi index df828c4..dff84e9 100644 --- a/stdlib/tkinter/font.pyi +++ b/stdlib/tkinter/font.pyi @@ -1,24 +1,24 @@ import _tkinter import sys import tkinter -from typing import Any, Tuple, Union, overload -from typing_extensions import Literal, TypedDict +from typing import Any, overload +from typing_extensions import Literal, TypeAlias, TypedDict + +if sys.version_info >= (3, 9): + __all__ = ["NORMAL", "ROMAN", "BOLD", "ITALIC", "nametofont", "Font", "families", "names"] NORMAL: Literal["normal"] ROMAN: Literal["roman"] BOLD: Literal["bold"] ITALIC: Literal["italic"] -_FontDescription = Union[ - # "Helvetica 12" - str, - # A font object constructed in Python - Font, - # ("Helvetica", 12, BOLD) - tkinter._TkinterSequence[Any], - # A font object constructed in Tcl - _tkinter.Tcl_Obj, -] +_FontDescription: TypeAlias = ( + str # "Helvetica 12" + | Font # A font object constructed in Python + | list[Any] # ("Helvetica", 12, BOLD) + | tuple[Any, ...] + | _tkinter.Tcl_Obj # A font object constructed in Tcl +) class _FontDict(TypedDict): family: str @@ -100,9 +100,10 @@ class Font: @overload def metrics(self, *, displayof: tkinter.Misc | None = ...) -> _MetricsDict: ... def measure(self, text: str, displayof: tkinter.Misc | None = ...) -> int: ... + def __eq__(self, other: object) -> bool: ... -def families(root: tkinter.Misc | None = ..., displayof: tkinter.Misc | None = ...) -> Tuple[str, ...]: ... -def names(root: tkinter.Misc | None = ...) -> Tuple[str, ...]: ... +def families(root: tkinter.Misc | None = ..., displayof: tkinter.Misc | None = ...) -> tuple[str, ...]: ... +def names(root: tkinter.Misc | None = ...) -> tuple[str, ...]: ... if sys.version_info >= (3, 10): def nametofont(name: str, root: tkinter.Misc | None = ...) -> Font: ... diff --git a/stdlib/tkinter/messagebox.pyi b/stdlib/tkinter/messagebox.pyi index fc4afce..d99c588 100644 --- a/stdlib/tkinter/messagebox.pyi +++ b/stdlib/tkinter/messagebox.pyi @@ -1,5 +1,18 @@ +import sys from tkinter.commondialog import Dialog -from typing import Any, ClassVar +from typing import ClassVar + +if sys.version_info >= (3, 9): + __all__ = [ + "showinfo", + "showwarning", + "showerror", + "askquestion", + "askokcancel", + "askyesno", + "askyesnocancel", + "askretrycancel", + ] ERROR: str INFO: str @@ -21,11 +34,11 @@ NO: str class Message(Dialog): command: ClassVar[str] -def showinfo(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ... -def showwarning(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ... -def showerror(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ... -def askquestion(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ... -def askokcancel(title: str | None = ..., message: str | None = ..., **options: Any) -> bool: ... -def askyesno(title: str | None = ..., message: str | None = ..., **options: Any) -> bool: ... -def askyesnocancel(title: str | None = ..., message: str | None = ..., **options: Any) -> bool | None: ... -def askretrycancel(title: str | None = ..., message: str | None = ..., **options: Any) -> bool: ... +def showinfo(title: str | None = ..., message: str | None = ..., **options) -> str: ... +def showwarning(title: str | None = ..., message: str | None = ..., **options) -> str: ... +def showerror(title: str | None = ..., message: str | None = ..., **options) -> str: ... +def askquestion(title: str | None = ..., message: str | None = ..., **options) -> str: ... +def askokcancel(title: str | None = ..., message: str | None = ..., **options) -> bool: ... +def askyesno(title: str | None = ..., message: str | None = ..., **options) -> bool: ... +def askyesnocancel(title: str | None = ..., message: str | None = ..., **options) -> bool | None: ... +def askretrycancel(title: str | None = ..., message: str | None = ..., **options) -> bool: ... diff --git a/stdlib/tkinter/scrolledtext.pyi b/stdlib/tkinter/scrolledtext.pyi index 246979d..4d8a700 100644 --- a/stdlib/tkinter/scrolledtext.pyi +++ b/stdlib/tkinter/scrolledtext.pyi @@ -1,8 +1,10 @@ +from _typeshed import Incomplete from tkinter import Frame, Misc, Scrollbar, Text -from typing import Any + +__all__ = ["ScrolledText"] # The methods from Pack, Place, and Grid are dynamically added over the parent's impls class ScrolledText(Text): frame: Frame vbar: Scrollbar - def __init__(self, master: Misc | None = ..., **kwargs: Any) -> None: ... + def __init__(self, master: Misc | None = ..., **kwargs: Incomplete) -> None: ... diff --git a/stdlib/tkinter/simpledialog.pyi b/stdlib/tkinter/simpledialog.pyi index ec801af..8ae8b6d 100644 --- a/stdlib/tkinter/simpledialog.pyi +++ b/stdlib/tkinter/simpledialog.pyi @@ -1,10 +1,13 @@ -from tkinter import Event, Misc, Toplevel -from typing import Any +from tkinter import Event, Frame, Misc, Toplevel class Dialog(Toplevel): def __init__(self, parent: Misc | None, title: str | None = ...) -> None: ... - def body(self, master) -> None: ... - def buttonbox(self): ... + def body(self, master: Frame) -> Misc | None: ... + def buttonbox(self) -> None: ... + def ok(self, event: Event[Misc] | None = ...) -> None: ... + def cancel(self, event: Event[Misc] | None = ...) -> None: ... + def validate(self) -> bool: ... + def apply(self) -> None: ... class SimpleDialog: def __init__( @@ -22,6 +25,30 @@ class SimpleDialog: def wm_delete_window(self) -> None: ... def done(self, num: int) -> None: ... -def askfloat(title: str | None, prompt: str, **kwargs: Any) -> float: ... -def askinteger(title: str | None, prompt: str, **kwargs: Any) -> int: ... -def askstring(title: str | None, prompt: str, **kwargs: Any) -> str: ... +def askfloat( + title: str | None, + prompt: str, + *, + initialvalue: float | None = ..., + minvalue: float | None = ..., + maxvalue: float | None = ..., + parent: Misc | None = ..., +) -> float | None: ... +def askinteger( + title: str | None, + prompt: str, + *, + initialvalue: int | None = ..., + minvalue: int | None = ..., + maxvalue: int | None = ..., + parent: Misc | None = ..., +) -> int | None: ... +def askstring( + title: str | None, + prompt: str, + *, + initialvalue: str | None = ..., + show: str | None = ..., + # minvalue/maxvalue is accepted but not useful. + parent: Misc | None = ..., +) -> str | None: ... diff --git a/stdlib/tkinter/tix.pyi b/stdlib/tkinter/tix.pyi index 3518802..db568bc 100644 --- a/stdlib/tkinter/tix.pyi +++ b/stdlib/tkinter/tix.pyi @@ -1,5 +1,6 @@ import tkinter -from typing import Any, Tuple +from _typeshed import Incomplete +from typing import Any from typing_extensions import Literal WINDOW: Literal["window"] @@ -45,7 +46,7 @@ class tixCommand: def tix_resetoptions(self, newScheme: str, newFontSet: str, newScmPrio: str | None = ...) -> None: ... class Tk(tkinter.Tk, tixCommand): - def __init__(self, screenName: str | None = ..., baseName: str | None = ..., className: str = ...): ... + def __init__(self, screenName: str | None = ..., baseName: str | None = ..., className: str = ...) -> None: ... class TixWidget(tkinter.Widget): def __init__( @@ -56,12 +57,12 @@ class TixWidget(tkinter.Widget): cnf: dict[str, Any] = ..., kw: dict[str, Any] = ..., ) -> None: ... - def __getattr__(self, name: str) -> Any: ... + def __getattr__(self, name: str): ... def set_silent(self, value: str) -> None: ... def subwidget(self, name: str) -> tkinter.Widget: ... def subwidgets_all(self) -> list[tkinter.Widget]: ... def config_all(self, option: Any, value: Any) -> None: ... - def image_create(self, imgtype: str, cnf: dict[str, Any] = ..., master: tkinter.Widget | None = ..., **kw: Any) -> None: ... + def image_create(self, imgtype: str, cnf: dict[str, Any] = ..., master: tkinter.Widget | None = ..., **kw) -> None: ... def image_delete(self, imgname: str) -> None: ... class TixSubWidget(TixWidget): @@ -70,102 +71,102 @@ class TixSubWidget(TixWidget): ) -> None: ... class DisplayStyle: - def __init__(self, itemtype: str, cnf: dict[str, Any] = ..., *, master: tkinter.Widget | None = ..., **kw: Any) -> None: ... - def __getitem__(self, key: str) -> Any: ... + def __init__(self, itemtype: str, cnf: dict[str, Any] = ..., *, master: tkinter.Widget | None = ..., **kw) -> None: ... + def __getitem__(self, key: str): ... def __setitem__(self, key: str, value: Any) -> None: ... def delete(self) -> None: ... - def config(self, cnf: dict[str, Any] = ..., **kw: Any) -> Any: ... + def config(self, cnf: dict[str, Any] = ..., **kw): ... class Balloon(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def bind_widget(self, widget: tkinter.Widget, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... + def bind_widget(self, widget: tkinter.Widget, cnf: dict[str, Any] = ..., **kw) -> None: ... def unbind_widget(self, widget: tkinter.Widget) -> None: ... class ButtonBox(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw) -> tkinter.Widget: ... def invoke(self, name: str) -> None: ... class ComboBox(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... def add_history(self, str: str) -> None: ... def append_history(self, str: str) -> None: ... def insert(self, index: int, str: str) -> None: ... def pick(self, index: int) -> None: ... class Control(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... def decrement(self) -> None: ... def increment(self) -> None: ... def invoke(self) -> None: ... class LabelEntry(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... class LabelFrame(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... class Meter(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... class OptionMenu(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add_command(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add_separator(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... + def add_command(self, name: str, cnf: dict[str, Any] = ..., **kw) -> None: ... + def add_separator(self, name: str, cnf: dict[str, Any] = ..., **kw) -> None: ... def delete(self, name: str) -> None: ... def disable(self, name: str) -> None: ... def enable(self, name: str) -> None: ... class PopupMenu(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def bind_widget(self, widget: tkinter.Widget) -> None: ... def unbind_widget(self, widget: tkinter.Widget) -> None: ... def post_widget(self, widget: tkinter.Widget, x: int, y: int) -> None: ... class Select(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw) -> tkinter.Widget: ... def invoke(self, name: str) -> None: ... class StdButtonBox(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... def invoke(self, name: str) -> None: ... class DirList(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def chdir(self, dir: str) -> None: ... class DirTree(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def chdir(self, dir: str) -> None: ... class DirSelectDialog(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def popup(self) -> None: ... def popdown(self) -> None: ... class DirSelectBox(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... class ExFileSelectBox(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def filter(self) -> None: ... def invoke(self) -> None: ... class FileSelectBox(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def apply_filter(self) -> None: ... def invoke(self) -> None: ... class FileEntry(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... def invoke(self) -> None: ... def file_dialog(self) -> None: ... class HList(TixWidget, tkinter.XView, tkinter.YView): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... - def add_child(self, parent: str | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... + def add(self, entry: str, cnf: dict[str, Any] = ..., **kw) -> tkinter.Widget: ... + def add_child(self, parent: str | None = ..., cnf: dict[str, Any] = ..., **kw) -> tkinter.Widget: ... def anchor_set(self, entry: str) -> None: ... def anchor_clear(self) -> None: ... # FIXME: Overload, certain combos return, others don't @@ -178,23 +179,23 @@ class HList(TixWidget, tkinter.XView, tkinter.YView): def dragsite_clear(self) -> None: ... def dropsite_set(self, index: int) -> None: ... def dropsite_clear(self) -> None: ... - def header_create(self, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def header_configure(self, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... - def header_cget(self, col: int, opt: Any) -> Any: ... + def header_create(self, col: int, cnf: dict[str, Any] = ..., **kw) -> None: ... + def header_configure(self, col: int, cnf: dict[str, Any] = ..., **kw) -> Incomplete | None: ... + def header_cget(self, col: int, opt): ... def header_exists(self, col: int) -> bool: ... def header_exist(self, col: int) -> bool: ... def header_delete(self, col: int) -> None: ... def header_size(self, col: int) -> int: ... def hide_entry(self, entry: str) -> None: ... - def indicator_create(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def indicator_configure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... - def indicator_cget(self, entry: str, opt: Any) -> Any: ... + def indicator_create(self, entry: str, cnf: dict[str, Any] = ..., **kw) -> None: ... + def indicator_configure(self, entry: str, cnf: dict[str, Any] = ..., **kw) -> Incomplete | None: ... + def indicator_cget(self, entry: str, opt): ... def indicator_exists(self, entry: str) -> bool: ... def indicator_delete(self, entry: str) -> None: ... def indicator_size(self, entry: str) -> int: ... def info_anchor(self) -> str: ... - def info_bbox(self, entry: str) -> Tuple[int, int, int, int]: ... - def info_children(self, entry: str | None = ...) -> Tuple[str, ...]: ... + def info_bbox(self, entry: str) -> tuple[int, int, int, int]: ... + def info_children(self, entry: str | None = ...) -> tuple[str, ...]: ... def info_data(self, entry: str) -> Any: ... def info_dragsite(self) -> str: ... def info_dropsite(self) -> str: ... @@ -203,33 +204,33 @@ class HList(TixWidget, tkinter.XView, tkinter.YView): def info_next(self, entry: str) -> str: ... def info_parent(self, entry: str) -> str: ... def info_prev(self, entry: str) -> str: ... - def info_selection(self) -> Tuple[str, ...]: ... - def item_cget(self, entry: str, col: int, opt: Any) -> Any: ... - def item_configure(self, entry: str, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... - def item_create(self, entry: str, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def info_selection(self) -> tuple[str, ...]: ... + def item_cget(self, entry: str, col: int, opt): ... + def item_configure(self, entry: str, col: int, cnf: dict[str, Any] = ..., **kw) -> Incomplete | None: ... + def item_create(self, entry: str, col: int, cnf: dict[str, Any] = ..., **kw) -> None: ... def item_exists(self, entry: str, col: int) -> bool: ... def item_delete(self, entry: str, col: int) -> None: ... - def entrycget(self, entry: str, opt: Any) -> Any: ... - def entryconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def entrycget(self, entry: str, opt): ... + def entryconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw) -> Incomplete | None: ... def nearest(self, y: int) -> str: ... def see(self, entry: str) -> None: ... - def selection_clear(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def selection_clear(self, cnf: dict[str, Any] = ..., **kw) -> None: ... def selection_includes(self, entry: str) -> bool: ... def selection_set(self, first: str, last: str | None = ...) -> None: ... def show_entry(self, entry: str) -> None: ... class CheckList(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... def autosetmode(self) -> None: ... def close(self, entrypath: str) -> None: ... def getmode(self, entrypath: str) -> str: ... def open(self, entrypath: str) -> None: ... - def getselection(self, mode: str = ...) -> Tuple[str, ...]: ... + def getselection(self, mode: str = ...) -> tuple[str, ...]: ... def getstatus(self, entrypath: str) -> str: ... def setstatus(self, entrypath: str, mode: str = ...) -> None: ... class Tree(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... def autosetmode(self) -> None: ... def close(self, entrypath: str) -> None: ... def getmode(self, entrypath: str) -> str: ... @@ -237,7 +238,7 @@ class Tree(TixWidget): def setmode(self, entrypath: str, mode: str = ...) -> None: ... class TList(TixWidget, tkinter.XView, tkinter.YView): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... def active_set(self, index: int) -> None: ... def active_clear(self) -> None: ... def anchor_set(self, index: int) -> None: ... @@ -247,40 +248,40 @@ class TList(TixWidget, tkinter.XView, tkinter.YView): def dragsite_clear(self) -> None: ... def dropsite_set(self, index: int) -> None: ... def dropsite_clear(self) -> None: ... - def insert(self, index: int, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def insert(self, index: int, cnf: dict[str, Any] = ..., **kw) -> None: ... def info_active(self) -> int: ... def info_anchor(self) -> int: ... def info_down(self, index: int) -> int: ... def info_left(self, index: int) -> int: ... def info_right(self, index: int) -> int: ... - def info_selection(self) -> Tuple[int, ...]: ... + def info_selection(self) -> tuple[int, ...]: ... def info_size(self) -> int: ... def info_up(self, index: int) -> int: ... def nearest(self, x: int, y: int) -> int: ... def see(self, index: int) -> None: ... - def selection_clear(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def selection_clear(self, cnf: dict[str, Any] = ..., **kw) -> None: ... def selection_includes(self, index: int) -> bool: ... def selection_set(self, first: int, last: int | None = ...) -> None: ... class PanedWindow(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw) -> None: ... def delete(self, name: str) -> None: ... - def forget(self, name: str) -> None: ... # type: ignore - def panecget(self, entry: str, opt: Any) -> Any: ... - def paneconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def forget(self, name: str) -> None: ... # type: ignore[override] + def panecget(self, entry: str, opt): ... + def paneconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw) -> Incomplete | None: ... def panes(self) -> list[tkinter.Widget]: ... class ListNoteBook(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw) -> None: ... def page(self, name: str) -> tkinter.Widget: ... def pages(self) -> list[tkinter.Widget]: ... def raise_page(self, name: str) -> None: ... class NoteBook(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw) -> None: ... def delete(self, name: str) -> None: ... def page(self, name: str) -> tkinter.Widget: ... def pages(self) -> list[tkinter.Widget]: ... @@ -288,14 +289,14 @@ class NoteBook(TixWidget): def raised(self) -> bool: ... class InputOnly(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw) -> None: ... class Form: def __setitem__(self, key: str, value: Any) -> None: ... - def config(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... - def form(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def config(self, cnf: dict[str, Any] = ..., **kw) -> None: ... + def form(self, cnf: dict[str, Any] = ..., **kw) -> None: ... def check(self) -> bool: ... def forget(self) -> None: ... - def grid(self, xsize: int = ..., ysize: int = ...) -> Tuple[int, int] | None: ... - def info(self, option: str | None = ...) -> Any: ... + def grid(self, xsize: int = ..., ysize: int = ...) -> tuple[int, int] | None: ... + def info(self, option: str | None = ...): ... def slaves(self) -> list[tkinter.Widget]: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index cb7a7b6..07584ed 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -1,40 +1,78 @@ import _tkinter import sys import tkinter +from _typeshed import Incomplete +from collections.abc import Callable from tkinter.font import _FontDescription -from typing import Any, Callable, Tuple, Union, overload -from typing_extensions import Literal, TypedDict +from typing import Any, Union, overload +from typing_extensions import Literal, TypeAlias, TypedDict -def tclobjs_to_py(adict): ... -def setup_master(master: Any | None = ...): ... +__all__ = [ + "Button", + "Checkbutton", + "Combobox", + "Entry", + "Frame", + "Label", + "Labelframe", + "LabelFrame", + "Menubutton", + "Notebook", + "Panedwindow", + "PanedWindow", + "Progressbar", + "Radiobutton", + "Scale", + "Scrollbar", + "Separator", + "Sizegrip", + "Style", + "Treeview", + "LabeledScale", + "OptionMenu", + "tclobjs_to_py", + "setup_master", + "Spinbox", +] + +def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... +def setup_master(master: Incomplete | None = ...): ... + +_Padding: TypeAlias = Union[ + tkinter._ScreenUnits, + tuple[tkinter._ScreenUnits], + tuple[tkinter._ScreenUnits, tkinter._ScreenUnits], + tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits], + tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits], +] # from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound -_TtkCompound = Literal["text", "image", tkinter._Compound] +_TtkCompound: TypeAlias = Literal["text", "image", tkinter._Compound] class Style: - master: Any + master: Incomplete tk: _tkinter.TkappType - def __init__(self, master: tkinter.Misc | None = ...): ... - def configure(self, style, query_opt: Any | None = ..., **kw): ... - def map(self, style, query_opt: Any | None = ..., **kw): ... - def lookup(self, style, option, state: Any | None = ..., default: Any | None = ...): ... - def layout(self, style, layoutspec: Any | None = ...): ... - def element_create(self, elementname, etype, *args, **kw): ... + def __init__(self, master: tkinter.Misc | None = ...) -> None: ... + def configure(self, style, query_opt: Incomplete | None = ..., **kw): ... + def map(self, style, query_opt: Incomplete | None = ..., **kw): ... + def lookup(self, style, option, state: Incomplete | None = ..., default: Incomplete | None = ...): ... + def layout(self, style, layoutspec: Incomplete | None = ...): ... + def element_create(self, elementname, etype, *args, **kw) -> None: ... def element_names(self): ... def element_options(self, elementname): ... - def theme_create(self, themename, parent: Any | None = ..., settings: Any | None = ...): ... - def theme_settings(self, themename, settings): ... - def theme_names(self) -> Tuple[str, ...]: ... + def theme_create(self, themename, parent: Incomplete | None = ..., settings: Incomplete | None = ...) -> None: ... + def theme_settings(self, themename, settings) -> None: ... + def theme_names(self) -> tuple[str, ...]: ... @overload def theme_use(self, themename: str) -> None: ... @overload def theme_use(self, themename: None = ...) -> str: ... class Widget(tkinter.Widget): - def __init__(self, master: tkinter.Misc | None, widgetname, kw: Any | None = ...): ... - def identify(self, x, y): ... - def instate(self, statespec, callback: Any | None = ..., *args, **kw): ... - def state(self, statespec: Any | None = ...): ... + def __init__(self, master: tkinter.Misc | None, widgetname, kw: Incomplete | None = ...) -> None: ... + def identify(self, x: int, y: int) -> str: ... + def instate(self, statespec, callback: Incomplete | None = ..., *args, **kw): ... + def state(self, statespec: Incomplete | None = ...): ... class Button(Widget): def __init__( @@ -48,7 +86,7 @@ class Button(Widget): default: Literal["normal", "active", "disabled"] = ..., image: tkinter._ImageSpec = ..., name: str = ..., - padding: Any = ..., # undocumented + padding=..., # undocumented state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -67,7 +105,7 @@ class Button(Widget): cursor: tkinter._Cursor = ..., default: Literal["normal", "active", "disabled"] = ..., image: tkinter._ImageSpec = ..., - padding: Any = ..., + padding=..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -75,9 +113,9 @@ class Button(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def invoke(self) -> Any: ... @@ -94,7 +132,7 @@ class Checkbutton(Widget): name: str = ..., offvalue: Any = ..., onvalue: Any = ..., - padding: Any = ..., # undocumented + padding=..., # undocumented state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -118,7 +156,7 @@ class Checkbutton(Widget): image: tkinter._ImageSpec = ..., offvalue: Any = ..., onvalue: Any = ..., - padding: Any = ..., + padding=..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -127,9 +165,9 @@ class Checkbutton(Widget): underline: int = ..., variable: tkinter.Variable = ..., width: int | Literal[""] = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def invoke(self) -> Any: ... @@ -158,7 +196,7 @@ class Entry(Widget, tkinter.Entry): width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -179,11 +217,11 @@ class Entry(Widget, tkinter.Entry): validatecommand: tkinter._EntryValidateCommand = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Entry().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -204,11 +242,11 @@ class Entry(Widget, tkinter.Entry): validatecommand: tkinter._EntryValidateCommand = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... - def bbox(self, index): ... - def identify(self, x, y): ... + def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def bbox(self, index) -> tuple[int, int, int, int]: ... # type: ignore[override] + def identify(self, x: int, y: int) -> str: ... def validate(self): ... class Combobox(Entry): @@ -226,19 +264,19 @@ class Combobox(Entry): invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented justify: Literal["left", "center", "right"] = ..., name: str = ..., - postcommand: Callable[[], Any] | str = ..., - show: Any = ..., # undocumented + postcommand: Callable[[], object] | str = ..., + show=..., # undocumented state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., # undocumented validatecommand: tkinter._EntryValidateCommand = ..., # undocumented - values: tkinter._TkinterSequence[str] = ..., + values: list[str] | tuple[str, ...] = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., # undocumented ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -251,22 +289,22 @@ class Combobox(Entry): height: int = ..., invalidcommand: tkinter._EntryValidateCommand = ..., justify: Literal["left", "center", "right"] = ..., - postcommand: Callable[[], Any] | str = ..., - show: Any = ..., + postcommand: Callable[[], object] | str = ..., + show=..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: tkinter._EntryValidateCommand = ..., - values: tkinter._TkinterSequence[str] = ..., + values: list[str] | tuple[str, ...] = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Combobox().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -279,22 +317,22 @@ class Combobox(Entry): height: int = ..., invalidcommand: tkinter._EntryValidateCommand = ..., justify: Literal["left", "center", "right"] = ..., - postcommand: Callable[[], Any] | str = ..., - show: Any = ..., + postcommand: Callable[[], object] | str = ..., + show=..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: tkinter._EntryValidateCommand = ..., - values: tkinter._TkinterSequence[str] = ..., + values: list[str] | tuple[str, ...] = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... - def current(self, newindex: Any | None = ...): ... - def set(self, value): ... + def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def current(self, newindex: int | None = ...) -> int: ... + def set(self, value: Any) -> None: ... class Frame(Widget): def __init__( @@ -307,7 +345,7 @@ class Frame(Widget): cursor: tkinter._Cursor = ..., height: tkinter._ScreenUnits = ..., name: str = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., relief: tkinter._Relief = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -322,14 +360,14 @@ class Frame(Widget): borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., height: tkinter._ScreenUnits = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., relief: tkinter._Relief = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: tkinter._ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Label(Widget): @@ -349,7 +387,7 @@ class Label(Widget): image: tkinter._ImageSpec = ..., justify: Literal["left", "center", "right"] = ..., name: str = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., relief: tkinter._Relief = ..., state: str = ..., style: str = ..., @@ -375,7 +413,7 @@ class Label(Widget): foreground: tkinter._Color = ..., image: tkinter._ImageSpec = ..., justify: Literal["left", "center", "right"] = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., relief: tkinter._Relief = ..., state: str = ..., style: str = ..., @@ -385,9 +423,9 @@ class Label(Widget): underline: int = ..., width: int | Literal[""] = ..., wraplength: tkinter._ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Labelframe(Widget): @@ -403,7 +441,7 @@ class Labelframe(Widget): labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., name: str = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., relief: tkinter._Relief = ..., # undocumented style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -422,16 +460,16 @@ class Labelframe(Widget): height: tkinter._ScreenUnits = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., relief: tkinter._Relief = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., text: float | str = ..., underline: int = ..., width: tkinter._ScreenUnits = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure LabelFrame = Labelframe @@ -448,7 +486,7 @@ class Menubutton(Widget): image: tkinter._ImageSpec = ..., menu: tkinter.Menu = ..., name: str = ..., - padding: Any = ..., # undocumented + padding=..., # undocumented state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -467,7 +505,7 @@ class Menubutton(Widget): direction: Literal["above", "below", "left", "right", "flush"] = ..., image: tkinter._ImageSpec = ..., menu: tkinter.Menu = ..., - padding: Any = ..., + padding=..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -475,9 +513,9 @@ class Menubutton(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Notebook(Widget): @@ -489,7 +527,7 @@ class Notebook(Widget): cursor: tkinter._Cursor = ..., height: int = ..., name: str = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., @@ -501,13 +539,13 @@ class Notebook(Widget): *, cursor: tkinter._Cursor = ..., height: int = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def add( self, @@ -515,19 +553,19 @@ class Notebook(Widget): *, state: Literal["normal", "disabled", "hidden"] = ..., sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty - padding: tkinter._Padding = ..., + padding: _Padding = ..., text: str = ..., - image: Any = ..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name) + image=..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name) compound: tkinter._Compound = ..., underline: int = ..., ) -> None: ... - def forget(self, tab_id): ... - def hide(self, tab_id): ... - def identify(self, x, y): ... + def forget(self, tab_id) -> None: ... + def hide(self, tab_id) -> None: ... + def identify(self, x: int, y: int) -> str: ... def index(self, tab_id): ... - def insert(self, pos, child, **kw): ... - def select(self, tab_id: Any | None = ...): ... - def tab(self, tab_id, option: Any | None = ..., **kw): ... + def insert(self, pos, child, **kw) -> None: ... + def select(self, tab_id: Incomplete | None = ...): ... + def tab(self, tab_id, option: Incomplete | None = ..., **kw): ... def tabs(self): ... def enable_traversal(self) -> None: ... @@ -541,13 +579,13 @@ class Panedwindow(Widget, tkinter.PanedWindow): # width and height for tkinter.ttk.Panedwindow are int but for tkinter.PanedWindow they are screen units height: int = ..., name: str = ..., - orient: Literal["vertical", "horizontal"] = ..., + orient: Literal["vertical", "horizontal"] = ..., # can't be changed with configure() style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., ) -> None: ... def add(self, child: tkinter.Widget, *, weight: int = ..., **kw) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -557,11 +595,11 @@ class Panedwindow(Widget, tkinter.PanedWindow): style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Panedwindow().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -571,13 +609,13 @@ class Panedwindow(Widget, tkinter.PanedWindow): style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... - forget: Any - def insert(self, pos, child, **kw): ... - def pane(self, pane, option: Any | None = ..., **kw): ... - def sashpos(self, index, newpos: Any | None = ...): ... + def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + forget: Incomplete + def insert(self, pos, child, **kw) -> None: ... + def pane(self, pane, option: Incomplete | None = ..., **kw): ... + def sashpos(self, index, newpos: Incomplete | None = ...): ... PanedWindow = Panedwindow @@ -614,13 +652,13 @@ class Progressbar(Widget): takefocus: tkinter._TakeFocusValue = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def start(self, interval: Any | None = ...): ... - def step(self, amount: Any | None = ...): ... - def stop(self): ... + def start(self, interval: Literal["idle"] | int | None = ...) -> None: ... + def step(self, amount: float | None = ...) -> None: ... + def stop(self) -> None: ... class Radiobutton(Widget): def __init__( @@ -633,7 +671,7 @@ class Radiobutton(Widget): cursor: tkinter._Cursor = ..., image: tkinter._ImageSpec = ..., name: str = ..., - padding: Any = ..., # undocumented + padding=..., # undocumented state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -653,7 +691,7 @@ class Radiobutton(Widget): compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., image: tkinter._ImageSpec = ..., - padding: Any = ..., + padding=..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -663,19 +701,20 @@ class Radiobutton(Widget): value: Any = ..., variable: tkinter.Variable | Literal[""] = ..., width: int | Literal[""] = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def invoke(self) -> Any: ... -class Scale(Widget, tkinter.Scale): +# type ignore, because identify() methods of Widget and tkinter.Scale are incompatible +class Scale(Widget, tkinter.Scale): # type: ignore[misc] def __init__( self, master: tkinter.Misc | None = ..., *, class_: str = ..., - command: str | Callable[[str], Any] = ..., + command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., length: tkinter._ScreenUnits = ..., @@ -688,12 +727,12 @@ class Scale(Widget, tkinter.Scale): value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., *, - command: str | Callable[[str], Any] = ..., + command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., length: tkinter._ScreenUnits = ..., @@ -704,16 +743,16 @@ class Scale(Widget, tkinter.Scale): to: float = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Scale().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., *, - command: str | Callable[[str], Any] = ..., + command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., length: tkinter._ScreenUnits = ..., @@ -724,51 +763,52 @@ class Scale(Widget, tkinter.Scale): to: float = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... - def get(self, x: Any | None = ..., y: Any | None = ...): ... + def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def get(self, x: int | None = ..., y: int | None = ...) -> float: ... -class Scrollbar(Widget, tkinter.Scrollbar): +# type ignore, because identify() methods of Widget and tkinter.Scale are incompatible +class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc] def __init__( self, master: tkinter.Misc | None = ..., *, class_: str = ..., - command: Callable[..., Tuple[float, float] | None] | str = ..., + command: Callable[..., tuple[float, float] | None] | str = ..., cursor: tkinter._Cursor = ..., name: str = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., *, - command: Callable[..., Tuple[float, float] | None] | str = ..., + command: Callable[..., tuple[float, float] | None] | str = ..., cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Scrollbar().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., *, - command: Callable[..., Tuple[float, float] | None] | str = ..., + command: Callable[..., tuple[float, float] | None] | str = ..., cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... class Separator(Widget): def __init__( @@ -791,9 +831,9 @@ class Separator(Widget): orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Sizegrip(Widget): @@ -815,94 +855,93 @@ class Sizegrip(Widget): cursor: tkinter._Cursor = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure -if sys.version_info >= (3, 7): - class Spinbox(Entry): - def __init__( - self, - master: tkinter.Misc | None = ..., - *, - background: tkinter._Color = ..., # undocumented - class_: str = ..., - command: Callable[[], Any] | str | tkinter._TkinterSequence[str] = ..., - cursor: tkinter._Cursor = ..., - exportselection: bool = ..., # undocumented - font: _FontDescription = ..., # undocumented - foreground: tkinter._Color = ..., # undocumented - format: str = ..., - from_: float = ..., - increment: float = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented - justify: Literal["left", "center", "right"] = ..., # undocumented - name: str = ..., - show: Any = ..., # undocumented - state: str = ..., - style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., - textvariable: tkinter.Variable = ..., # undocumented - to: float = ..., - validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., - values: tkinter._TkinterSequence[str] = ..., - width: int = ..., # undocumented - wrap: bool = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> None: ... - @overload # type: ignore - def configure( - self, - cnf: dict[str, Any] | None = ..., - *, - background: tkinter._Color = ..., - command: Callable[[], Any] | str | tkinter._TkinterSequence[str] = ..., - cursor: tkinter._Cursor = ..., - exportselection: bool = ..., - font: _FontDescription = ..., - foreground: tkinter._Color = ..., - format: str = ..., - from_: float = ..., - increment: float = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., - justify: Literal["left", "center", "right"] = ..., - show: Any = ..., - state: str = ..., - style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., - textvariable: tkinter.Variable = ..., - to: float = ..., - validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., - values: tkinter._TkinterSequence[str] = ..., - width: int = ..., - wrap: bool = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... - @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... - config = configure # type: ignore - def set(self, value: Any) -> None: ... +class Spinbox(Entry): + def __init__( + self, + master: tkinter.Misc | None = ..., + *, + background: tkinter._Color = ..., # undocumented + class_: str = ..., + command: Callable[[], object] | str | list[str] | tuple[str, ...] = ..., + cursor: tkinter._Cursor = ..., + exportselection: bool = ..., # undocumented + font: _FontDescription = ..., # undocumented + foreground: tkinter._Color = ..., # undocumented + format: str = ..., + from_: float = ..., + increment: float = ..., + invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented + justify: Literal["left", "center", "right"] = ..., # undocumented + name: str = ..., + show=..., # undocumented + state: str = ..., + style: str = ..., + takefocus: tkinter._TakeFocusValue = ..., + textvariable: tkinter.Variable = ..., # undocumented + to: float = ..., + validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., + validatecommand: tkinter._EntryValidateCommand = ..., + values: list[str] | tuple[str, ...] = ..., + width: int = ..., # undocumented + wrap: bool = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., + ) -> None: ... + @overload # type: ignore[override] + def configure( + self, + cnf: dict[str, Any] | None = ..., + *, + background: tkinter._Color = ..., + command: Callable[[], object] | str | list[str] | tuple[str, ...] = ..., + cursor: tkinter._Cursor = ..., + exportselection: bool = ..., + font: _FontDescription = ..., + foreground: tkinter._Color = ..., + format: str = ..., + from_: float = ..., + increment: float = ..., + invalidcommand: tkinter._EntryValidateCommand = ..., + justify: Literal["left", "center", "right"] = ..., + show=..., + state: str = ..., + style: str = ..., + takefocus: tkinter._TakeFocusValue = ..., + textvariable: tkinter.Variable = ..., + to: float = ..., + validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., + validatecommand: tkinter._EntryValidateCommand = ..., + values: list[str] | tuple[str, ...] = ..., + width: int = ..., + wrap: bool = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... + @overload + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + config = configure # type: ignore[assignment] + def set(self, value: Any) -> None: ... class _TreeviewItemDict(TypedDict): text: str - image: Literal[""] | list[str] # no idea why it's wrapped in list - values: list[Any] + image: list[str] | Literal[""] # no idea why it's wrapped in list + values: list[Any] | Literal[""] open: bool # actually 0 or 1 - tags: list[str] + tags: list[str] | Literal[""] class _TreeviewTagDict(TypedDict): # There is also 'text' and 'anchor', but they don't seem to do anything, using them is likely a bug foreground: tkinter._Color background: tkinter._Color font: _FontDescription - image: Literal[""] | str # not wrapped in list :D + image: str # not wrapped in list :D class _TreeviewHeaderDict(TypedDict): text: str - image: list[str] + image: list[str] | Literal[""] anchor: tkinter._Anchor command: str state: str # Doesn't seem to appear anywhere else than in these dicts @@ -914,7 +953,7 @@ class _TreeviewColumnDict(TypedDict): anchor: tkinter._Anchor id: str -_TreeviewColumnId = Union[int, str] # manual page: "COLUMN IDENTIFIERS" +_TreeviewColumnId: TypeAlias = int | str # manual page: "COLUMN IDENTIFIERS" class Treeview(Widget, tkinter.XView, tkinter.YView): def __init__( @@ -922,18 +961,18 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): master: tkinter.Misc | None = ..., *, class_: str = ..., - columns: str | tkinter._TkinterSequence[str] = ..., + columns: str | list[str] | tuple[str, ...] = ..., cursor: tkinter._Cursor = ..., - displaycolumns: str | tkinter._TkinterSequence[str] | tkinter._TkinterSequence[int] | Literal["#all"] = ..., + displaycolumns: str | list[str] | tuple[str, ...] | list[int] | tuple[int, ...] = ..., height: int = ..., name: str = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., selectmode: Literal["extended", "browse", "none"] = ..., - # _TkinterSequences of Literal don't actually work, using str instead. + # list/tuple of Literal don't actually work in mypy # # 'tree headings' is same as ['tree', 'headings'], and I wouldn't be - # surprised if someone was using it. - show: Literal["tree", "headings", "tree headings", ""] | tkinter._TkinterSequence[str] = ..., + # surprised if someone is using it. + show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., xscrollcommand: tkinter._XYScrollCommand = ..., @@ -944,23 +983,23 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): self, cnf: dict[str, Any] | None = ..., *, - columns: str | tkinter._TkinterSequence[str] = ..., + columns: str | list[str] | tuple[str, ...] = ..., cursor: tkinter._Cursor = ..., - displaycolumns: str | tkinter._TkinterSequence[str] | tkinter._TkinterSequence[int] | Literal["#all"] = ..., + displaycolumns: str | list[str] | tuple[str, ...] | list[int] | tuple[int, ...] = ..., height: int = ..., - padding: tkinter._Padding = ..., + padding: _Padding = ..., selectmode: Literal["extended", "browse", "none"] = ..., - show: Literal["tree", "headings", "tree headings", ""] | tkinter._TkinterSequence[str] = ..., + show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., xscrollcommand: tkinter._XYScrollCommand = ..., yscrollcommand: tkinter._XYScrollCommand = ..., - ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, item, column: _TreeviewColumnId | None = ...) -> Tuple[int, int, int, int] | Literal[""]: ... # type: ignore - def get_children(self, item: str | None = ...) -> Tuple[str, ...]: ... + def bbox(self, item, column: _TreeviewColumnId | None = ...) -> tuple[int, int, int, int] | Literal[""]: ... # type: ignore[override] + def get_children(self, item: str | None = ...) -> tuple[str, ...]: ... def set_children(self, item: str, *newchildren: str) -> None: ... @overload def column(self, column: _TreeviewColumnId, option: Literal["width", "minwidth"]) -> int: ... @@ -987,14 +1026,14 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): def delete(self, *items: str) -> None: ... def detach(self, *items: str) -> None: ... def exists(self, item: str) -> bool: ... - @overload # type: ignore + @overload # type: ignore[override] def focus(self, item: None = ...) -> str: ... # can return empty string @overload def focus(self, item: str) -> Literal[""]: ... @overload def heading(self, column: _TreeviewColumnId, option: Literal["text"]) -> str: ... @overload - def heading(self, column: _TreeviewColumnId, option: Literal["image"]) -> Tuple[str]: ... + def heading(self, column: _TreeviewColumnId, option: Literal["image"]) -> tuple[str] | str: ... @overload def heading(self, column: _TreeviewColumnId, option: Literal["anchor"]) -> _tkinter.Tcl_Obj: ... @overload @@ -1002,6 +1041,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): @overload def heading(self, column: _TreeviewColumnId, option: str) -> Any: ... @overload + def heading(self, column: _TreeviewColumnId, option: None = ...) -> _TreeviewHeaderDict: ... # type: ignore[misc] + @overload def heading( self, column: _TreeviewColumnId, @@ -1010,9 +1051,9 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): text: str = ..., image: tkinter._ImageSpec = ..., anchor: tkinter._Anchor = ..., - command: str | Callable[[], Any] = ..., - ) -> _TreeviewHeaderDict | None: ... - def identify(self, component, x, y): ... + command: str | Callable[[], object] = ..., + ) -> None: ... + def identify(self, component, x, y): ... # Internal Method. Leave untyped def identify_row(self, y: int) -> str: ... def identify_column(self, x: int) -> str: ... def identify_region(self, x: int, y: int) -> Literal["heading", "separator", "tree", "cell", "nothing"]: ... @@ -1027,23 +1068,25 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): id: str = ..., # same as iid text: str = ..., image: tkinter._ImageSpec = ..., - values: tkinter._TkinterSequence[Any] = ..., + values: list[Any] | tuple[Any, ...] = ..., open: bool = ..., - tags: str | tkinter._TkinterSequence[str] = ..., + tags: str | list[str] | tuple[str, ...] = ..., ) -> str: ... @overload def item(self, item: str, option: Literal["text"]) -> str: ... @overload - def item(self, item: str, option: Literal["image"]) -> Literal[""] | Tuple[str]: ... + def item(self, item: str, option: Literal["image"]) -> tuple[str] | Literal[""]: ... @overload - def item(self, item: str, option: Literal["values"]) -> Literal[""] | Tuple[Any, ...]: ... + def item(self, item: str, option: Literal["values"]) -> tuple[Any, ...] | Literal[""]: ... @overload def item(self, item: str, option: Literal["open"]) -> bool: ... # actually 0 or 1 @overload - def item(self, item: str, option: Literal["tags"]) -> Literal[""] | Tuple[str, ...]: ... + def item(self, item: str, option: Literal["tags"]) -> tuple[str, ...] | Literal[""]: ... @overload def item(self, item: str, option: str) -> Any: ... @overload + def item(self, item: str, option: None = ...) -> _TreeviewItemDict: ... # type: ignore[misc] + @overload def item( self, item: str, @@ -1051,10 +1094,10 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): *, text: str = ..., image: tkinter._ImageSpec = ..., - values: tkinter._TkinterSequence[Any] = ..., + values: list[Any] | tuple[Any, ...] | Literal[""] = ..., open: bool = ..., - tags: str | tkinter._TkinterSequence[str] = ..., - ) -> _TreeviewItemDict | None: ... + tags: str | list[str] | tuple[str, ...] = ..., + ) -> None: ... def move(self, item: str, parent: str, index: int) -> None: ... reattach = move def next(self, item: str) -> str: ... # returning empty string means last item @@ -1062,13 +1105,14 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): def prev(self, item: str) -> str: ... # returning empty string means first item def see(self, item: str) -> None: ... if sys.version_info >= (3, 8): - def selection(self) -> Tuple[str, ...]: ... + def selection(self) -> tuple[str, ...]: ... else: - def selection(self, selop: Any | None = ..., items: Any | None = ...) -> Tuple[str, ...]: ... - def selection_set(self, items: str | tkinter._TkinterSequence[str]) -> None: ... - def selection_add(self, items: str | tkinter._TkinterSequence[str]) -> None: ... - def selection_remove(self, items: str | tkinter._TkinterSequence[str]) -> None: ... - def selection_toggle(self, items: str | tkinter._TkinterSequence[str]) -> None: ... + def selection(self, selop: Incomplete | None = ..., items: Incomplete | None = ...) -> tuple[str, ...]: ... + + def selection_set(self, items: str | list[str] | tuple[str, ...]) -> None: ... + def selection_add(self, items: str | list[str] | tuple[str, ...]) -> None: ... + def selection_remove(self, items: str | list[str] | tuple[str, ...]) -> None: ... + def selection_toggle(self, items: str | list[str] | tuple[str, ...]) -> None: ... @overload def set(self, item: str, column: None = ..., value: None = ...) -> dict[str, Any]: ... @overload @@ -1079,7 +1123,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): # Also, it's 'callback' instead of 'func' here. @overload def tag_bind( - self, tagname: str, sequence: str | None = ..., callback: Callable[[tkinter.Event[Treeview]], Any] | None = ... + self, tagname: str, sequence: str | None = ..., callback: Callable[[tkinter.Event[Treeview]], object] | None = ... ) -> str: ... @overload def tag_bind(self, tagname: str, sequence: str | None, callback: str) -> None: ... @@ -1104,13 +1148,13 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): image: tkinter._ImageSpec = ..., ) -> _TreeviewTagDict | Any: ... # can be None but annoying to check @overload - def tag_has(self, tagname: str, item: None = ...) -> Tuple[str, ...]: ... + def tag_has(self, tagname: str, item: None = ...) -> tuple[str, ...]: ... @overload def tag_has(self, tagname: str, item: str) -> bool: ... class LabeledScale(Frame): - label: Any - scale: Any + label: Incomplete + scale: Incomplete # TODO: don't any-type **kw. That goes to Frame.__init__. def __init__( self, @@ -1119,10 +1163,10 @@ class LabeledScale(Frame): from_: float = ..., to: float = ..., *, - compound: Literal["top"] | Literal["bottom"] = ..., - **kw: Any, + compound: Literal["top", "bottom"] = ..., + **kw, ) -> None: ... - # destroy is overrided, signature does not change + # destroy is overridden, signature does not change value: Any class OptionMenu(Menubutton): @@ -1134,9 +1178,9 @@ class OptionMenu(Menubutton): *values: str, # rest of these are keyword-only because *args syntax used above style: str = ..., - direction: Literal["above"] | Literal["below"] | Literal["left"] | Literal["right"] | Literal["flush"] = ..., - command: Callable[[tkinter.StringVar], Any] | None = ..., + direction: Literal["above", "below", "left", "right", "flush"] = ..., + command: Callable[[tkinter.StringVar], object] | None = ..., ) -> None: ... # configure, config, cget, destroy are inherited from Menubutton - # destroy and __setitem__ are overrided, signature does not change - def set_menu(self, default: Any | None = ..., *values): ... + # destroy and __setitem__ are overridden, signature does not change + def set_menu(self, default: Incomplete | None = ..., *values) -> None: ... diff --git a/stdlib/token.pyi b/stdlib/token.pyi index 9038183..fcd6ef8 100644 --- a/stdlib/token.pyi +++ b/stdlib/token.pyi @@ -1,5 +1,78 @@ import sys +__all__ = [ + "AMPER", + "AMPEREQUAL", + "AT", + "ATEQUAL", + "CIRCUMFLEX", + "CIRCUMFLEXEQUAL", + "COLON", + "COMMA", + "DEDENT", + "DOT", + "DOUBLESLASH", + "DOUBLESLASHEQUAL", + "DOUBLESTAR", + "DOUBLESTAREQUAL", + "ELLIPSIS", + "ENDMARKER", + "EQEQUAL", + "EQUAL", + "ERRORTOKEN", + "GREATER", + "GREATEREQUAL", + "INDENT", + "ISEOF", + "ISNONTERMINAL", + "ISTERMINAL", + "LBRACE", + "LEFTSHIFT", + "LEFTSHIFTEQUAL", + "LESS", + "LESSEQUAL", + "LPAR", + "LSQB", + "MINEQUAL", + "MINUS", + "NAME", + "NEWLINE", + "NOTEQUAL", + "NT_OFFSET", + "NUMBER", + "N_TOKENS", + "OP", + "PERCENT", + "PERCENTEQUAL", + "PLUS", + "PLUSEQUAL", + "RARROW", + "RBRACE", + "RIGHTSHIFT", + "RIGHTSHIFTEQUAL", + "RPAR", + "RSQB", + "SEMI", + "SLASH", + "SLASHEQUAL", + "STAR", + "STAREQUAL", + "STRING", + "TILDE", + "VBAR", + "VBAREQUAL", + "tok_name", + "ENCODING", + "NL", + "COMMENT", +] + +if sys.version_info >= (3, 8): + __all__ += ["ASYNC", "AWAIT", "COLONEQUAL", "TYPE_COMMENT", "TYPE_IGNORE"] + +if sys.version_info >= (3, 10): + __all__ += ["SOFT_KEYWORD"] + ENDMARKER: int NAME: int NUMBER: int @@ -53,8 +126,7 @@ AT: int RARROW: int ELLIPSIS: int ATEQUAL: int -if sys.version_info < (3, 7) or sys.version_info >= (3, 8): - # These were removed in Python 3.7 but added back in Python 3.8 +if sys.version_info >= (3, 8): AWAIT: int ASYNC: int OP: int @@ -62,15 +134,16 @@ ERRORTOKEN: int N_TOKENS: int NT_OFFSET: int tok_name: dict[int, str] -if sys.version_info >= (3, 7): - COMMENT: int - NL: int - ENCODING: int +COMMENT: int +NL: int +ENCODING: int if sys.version_info >= (3, 8): TYPE_COMMENT: int TYPE_IGNORE: int COLONEQUAL: int EXACT_TOKEN_TYPES: dict[str, int] +if sys.version_info >= (3, 10): + SOFT_KEYWORD: int def ISTERMINAL(x: int) -> bool: ... def ISNONTERMINAL(x: int) -> bool: ... diff --git a/stdlib/tokenize.pyi b/stdlib/tokenize.pyi index 136dcfc..7c00b50 100644 --- a/stdlib/tokenize.pyi +++ b/stdlib/tokenize.pyi @@ -1,18 +1,97 @@ import sys from _typeshed import StrOrBytesPath -from builtins import open as _builtin_open -from token import * # noqa: F403 -from typing import Any, Callable, Generator, Iterable, NamedTuple, Pattern, Sequence, Set, TextIO, Tuple, Union - -if sys.version_info < (3, 7): - COMMENT: int - NL: int - ENCODING: int +from collections.abc import Callable, Generator, Iterable, Sequence +from re import Pattern +from token import * +from typing import Any, NamedTuple, TextIO +from typing_extensions import TypeAlias + +__all__ = [ + "AMPER", + "AMPEREQUAL", + "AT", + "ATEQUAL", + "CIRCUMFLEX", + "CIRCUMFLEXEQUAL", + "COLON", + "COMMA", + "COMMENT", + "DEDENT", + "DOT", + "DOUBLESLASH", + "DOUBLESLASHEQUAL", + "DOUBLESTAR", + "DOUBLESTAREQUAL", + "ELLIPSIS", + "ENCODING", + "ENDMARKER", + "EQEQUAL", + "EQUAL", + "ERRORTOKEN", + "GREATER", + "GREATEREQUAL", + "INDENT", + "ISEOF", + "ISNONTERMINAL", + "ISTERMINAL", + "LBRACE", + "LEFTSHIFT", + "LEFTSHIFTEQUAL", + "LESS", + "LESSEQUAL", + "LPAR", + "LSQB", + "MINEQUAL", + "MINUS", + "NAME", + "NEWLINE", + "NL", + "NOTEQUAL", + "NT_OFFSET", + "NUMBER", + "N_TOKENS", + "OP", + "PERCENT", + "PERCENTEQUAL", + "PLUS", + "PLUSEQUAL", + "RARROW", + "RBRACE", + "RIGHTSHIFT", + "RIGHTSHIFTEQUAL", + "RPAR", + "RSQB", + "SEMI", + "SLASH", + "SLASHEQUAL", + "STAR", + "STAREQUAL", + "STRING", + "TILDE", + "TokenInfo", + "VBAR", + "VBAREQUAL", + "detect_encoding", + "tok_name", + "tokenize", + "untokenize", +] + +if sys.version_info >= (3, 8): + __all__ += ["ASYNC", "AWAIT", "COLONEQUAL", "generate_tokens", "TYPE_COMMENT", "TYPE_IGNORE"] + +if sys.version_info >= (3, 10): + __all__ += ["SOFT_KEYWORD"] + +if sys.version_info >= (3, 8): + from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES +else: + EXACT_TOKEN_TYPES: dict[str, int] cookie_re: Pattern[str] blank_re: Pattern[bytes] -_Position = Tuple[int, int] +_Position: TypeAlias = tuple[int, int] class _TokenInfo(NamedTuple): type: int @@ -26,7 +105,7 @@ class TokenInfo(_TokenInfo): def exact_type(self) -> int: ... # Backwards compatible tokens can be sequences of a shorter length too -_Token = Union[TokenInfo, Sequence[Union[int, str, _Position]]] +_Token: TypeAlias = TokenInfo | Sequence[int | str | _Position] class TokenError(Exception): ... class StopTokenizing(Exception): ... # undocumented @@ -36,7 +115,6 @@ class Untokenizer: prev_row: int prev_col: int encoding: str | None - def __init__(self) -> None: ... def add_whitespace(self, start: _Position) -> None: ... def untokenize(self, iterable: Iterable[_Token]) -> str: ... def compat(self, token: Sequence[int | str], iterable: Iterable[_Token]) -> None: ... @@ -44,8 +122,8 @@ class Untokenizer: # the docstring says "returns bytes" but is incorrect -- # if the ENCODING token is missing, it skips the encode def untokenize(iterable: Iterable[_Token]) -> Any: ... -def detect_encoding(readline: Callable[[], bytes]) -> Tuple[str, Sequence[bytes]]: ... -def tokenize(readline: Callable[[], bytes]) -> Generator[TokenInfo, None, None]: ... +def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Sequence[bytes]]: ... +def tokenize(readline: Callable[[], bytes | bytearray]) -> Generator[TokenInfo, None, None]: ... def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ... # undocumented def open(filename: StrOrBytesPath | int) -> TextIO: ... def group(*choices: str) -> str: ... # undocumented @@ -69,7 +147,7 @@ Floatnumber: str # undocumented Imagnumber: str # undocumented Number: str # undocumented -def _all_string_prefixes() -> Set[str]: ... # undocumented +def _all_string_prefixes() -> set[str]: ... # undocumented StringPrefix: str # undocumented @@ -80,10 +158,6 @@ Double3: str # undocumented Triple: str # undocumented String: str # undocumented -if sys.version_info < (3, 7): - Operator: str # undocumented - Bracket: str # undocumented - Special: str # undocumented Funny: str # undocumented @@ -95,7 +169,7 @@ PseudoExtras: str # undocumented PseudoToken: str # undocumented endpats: dict[str, str] # undocumented -single_quoted: Set[str] # undocumented -triple_quoted: Set[str] # undocumented +single_quoted: set[str] # undocumented +triple_quoted: set[str] # undocumented tabsize: int # undocumented diff --git a/stdlib/tomllib.pyi b/stdlib/tomllib.pyi new file mode 100644 index 0000000..3a6ce93 --- /dev/null +++ b/stdlib/tomllib.pyi @@ -0,0 +1,10 @@ +from _typeshed import SupportsRead +from collections.abc import Callable +from typing import Any + +__all__ = ("loads", "load", "TOMLDecodeError") + +class TOMLDecodeError(ValueError): ... + +def load(__fp: SupportsRead[bytes], *, parse_float: Callable[[str], Any] = ...) -> dict[str, Any]: ... +def loads(__s: str, *, parse_float: Callable[[str], Any] = ...) -> dict[str, Any]: ... diff --git a/stdlib/trace.pyi b/stdlib/trace.pyi index c6d993b..1f0de1d 100644 --- a/stdlib/trace.pyi +++ b/stdlib/trace.pyi @@ -1,28 +1,30 @@ import sys import types -from _typeshed import StrPath -from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar -from typing_extensions import ParamSpec +from _typeshed import StrPath, TraceFunction +from collections.abc import Callable, Mapping, Sequence +from typing import Any, TypeVar +from typing_extensions import ParamSpec, TypeAlias + +__all__ = ["Trace", "CoverageResults"] _T = TypeVar("_T") _P = ParamSpec("_P") -_localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] -_fileModuleFunction = Tuple[str, Optional[str], str] +_FileModuleFunction: TypeAlias = tuple[str, str | None, str] class CoverageResults: def __init__( self, - counts: dict[Tuple[str, int], int] | None = ..., - calledfuncs: dict[_fileModuleFunction, int] | None = ..., + counts: dict[tuple[str, int], int] | None = ..., + calledfuncs: dict[_FileModuleFunction, int] | None = ..., infile: StrPath | None = ..., - callers: dict[Tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ..., + callers: dict[tuple[_FileModuleFunction, _FileModuleFunction], int] | None = ..., outfile: StrPath | None = ..., ) -> None: ... # undocumented def update(self, other: CoverageResults) -> None: ... def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: StrPath | None = ...) -> None: ... def write_results_file( self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: str | None = ... - ) -> Tuple[int, int]: ... + ) -> tuple[int, int]: ... def is_ignored_filename(self, filename: str) -> bool: ... # undocumented class Trace: @@ -43,14 +45,15 @@ class Trace: self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ... ) -> None: ... if sys.version_info >= (3, 9): - def runfunc(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... # type: ignore + def runfunc(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... else: - def runfunc(self, func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... # type: ignore - def file_module_function_of(self, frame: types.FrameType) -> _fileModuleFunction: ... + def runfunc(self, func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... + + def file_module_function_of(self, frame: types.FrameType) -> _FileModuleFunction: ... def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ... def globaltrace_lt(self, frame: types.FrameType, why: str, arg: Any) -> None: ... - def localtrace_trace_and_count(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ... - def localtrace_trace(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ... - def localtrace_count(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ... + def localtrace_trace_and_count(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ... + def localtrace_trace(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ... + def localtrace_count(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ... def results(self) -> CoverageResults: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index a6474a1..bf8e24e 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -1,35 +1,81 @@ import sys -from _typeshed import SupportsWrite +from _typeshed import Self, SupportsWrite +from collections.abc import Generator, Iterable, Iterator, Mapping from types import FrameType, TracebackType -from typing import IO, Any, Generator, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type +from typing import Any, overload +from typing_extensions import Literal, TypeAlias -_PT = Tuple[str, int, str, Optional[str]] +__all__ = [ + "extract_stack", + "extract_tb", + "format_exception", + "format_exception_only", + "format_list", + "format_stack", + "format_tb", + "print_exc", + "format_exc", + "print_exception", + "print_last", + "print_stack", + "print_tb", + "clear_frames", + "FrameSummary", + "StackSummary", + "TracebackException", + "walk_stack", + "walk_tb", +] -def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ... +_PT: TypeAlias = tuple[str, int, str, str | None] + +def print_tb(tb: TracebackType | None, limit: int | None = ..., file: SupportsWrite[str] | None = ...) -> None: ... if sys.version_info >= (3, 10): + @overload def print_exception( - __exc: Type[BaseException] | None, + __exc: type[BaseException] | None, value: BaseException | None = ..., tb: TracebackType | None = ..., limit: int | None = ..., - file: IO[str] | None = ..., + file: SupportsWrite[str] | None = ..., chain: bool = ..., ) -> None: ... + @overload + def print_exception( + __exc: BaseException, *, limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ... + ) -> None: ... + @overload + def format_exception( + __exc: type[BaseException] | None, + value: BaseException | None = ..., + tb: TracebackType | None = ..., + limit: int | None = ..., + chain: bool = ..., + ) -> list[str]: ... + @overload + def format_exception(__exc: BaseException, *, limit: int | None = ..., chain: bool = ...) -> list[str]: ... else: def print_exception( - etype: Type[BaseException] | None, + etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, limit: int | None = ..., - file: IO[str] | None = ..., + file: SupportsWrite[str] | None = ..., chain: bool = ..., ) -> None: ... + def format_exception( + etype: type[BaseException] | None, + value: BaseException | None, + tb: TracebackType | None, + limit: int | None = ..., + chain: bool = ..., + ) -> list[str]: ... -def print_exc(limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...) -> None: ... -def print_last(limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...) -> None: ... -def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: IO[str] | None = ...) -> None: ... +def print_exc(limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ... +def print_last(limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ... +def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: SupportsWrite[str] | None = ...) -> None: ... def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> StackSummary: ... def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> StackSummary: ... def format_list(extracted_list: list[FrameSummary]) -> list[str]: ... @@ -38,120 +84,175 @@ def format_list(extracted_list: list[FrameSummary]) -> list[str]: ... def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = ...) -> None: ... if sys.version_info >= (3, 10): - def format_exception_only(__exc: Type[BaseException] | None, value: BaseException | None = ...) -> list[str]: ... + def format_exception_only(__exc: type[BaseException] | None, value: BaseException | None = ...) -> list[str]: ... else: - def format_exception_only(etype: Type[BaseException] | None, value: BaseException | None) -> list[str]: ... - -if sys.version_info >= (3, 10): - def format_exception( - __exc: Type[BaseException] | None, - value: BaseException | None = ..., - tb: TracebackType | None = ..., - limit: int | None = ..., - chain: bool = ..., - ) -> list[str]: ... - -else: - def format_exception( - etype: Type[BaseException] | None, - value: BaseException | None, - tb: TracebackType | None, - limit: int | None = ..., - chain: bool = ..., - ) -> list[str]: ... + def format_exception_only(etype: type[BaseException] | None, value: BaseException | None) -> list[str]: ... def format_exc(limit: int | None = ..., chain: bool = ...) -> str: ... def format_tb(tb: TracebackType | None, limit: int | None = ...) -> list[str]: ... def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> list[str]: ... -def clear_frames(tb: TracebackType) -> None: ... -def walk_stack(f: FrameType | None) -> Iterator[Tuple[FrameType, int]]: ... -def walk_tb(tb: TracebackType | None) -> Iterator[Tuple[FrameType, int]]: ... +def clear_frames(tb: TracebackType | None) -> None: ... +def walk_stack(f: FrameType | None) -> Iterator[tuple[FrameType, int]]: ... +def walk_tb(tb: TracebackType | None) -> Iterator[tuple[FrameType, int]]: ... + +if sys.version_info >= (3, 11): + class _ExceptionPrintContext: + def indent(self) -> str: ... + def emit(self, text_gen: str | Iterable[str], margin_char: str | None = ...) -> Generator[str, None, None]: ... class TracebackException: __cause__: TracebackException __context__: TracebackException __suppress_context__: bool stack: StackSummary - exc_type: Type[BaseException] + exc_type: type[BaseException] filename: str lineno: int text: str offset: int msg: str - if sys.version_info >= (3, 10): + if sys.version_info >= (3, 11): + def __init__( + self, + exc_type: type[BaseException], + exc_value: BaseException, + exc_traceback: TracebackType | None, + *, + limit: int | None = ..., + lookup_lines: bool = ..., + capture_locals: bool = ..., + compact: bool = ..., + max_group_width: int = ..., + max_group_depth: int = ..., + _seen: set[int] | None = ..., + ) -> None: ... + @classmethod + def from_exception( + cls: type[Self], + exc: BaseException, + *, + limit: int | None = ..., + lookup_lines: bool = ..., + capture_locals: bool = ..., + compact: bool = ..., + max_group_width: int = ..., + max_group_depth: int = ..., + ) -> Self: ... + elif sys.version_info >= (3, 10): def __init__( self, - exc_type: Type[BaseException], + exc_type: type[BaseException], exc_value: BaseException, - exc_traceback: TracebackType, + exc_traceback: TracebackType | None, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ..., compact: bool = ..., - _seen: Set[int] | None = ..., + _seen: set[int] | None = ..., ) -> None: ... @classmethod def from_exception( - cls, + cls: type[Self], exc: BaseException, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ..., compact: bool = ..., - ) -> TracebackException: ... + ) -> Self: ... else: def __init__( self, - exc_type: Type[BaseException], + exc_type: type[BaseException], exc_value: BaseException, - exc_traceback: TracebackType, + exc_traceback: TracebackType | None, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ..., - _seen: Set[int] | None = ..., + _seen: set[int] | None = ..., ) -> None: ... @classmethod def from_exception( - cls, exc: BaseException, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ... - ) -> TracebackException: ... - def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ... + cls: type[Self], exc: BaseException, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ... + ) -> Self: ... + + def __eq__(self, other: object) -> bool: ... + if sys.version_info >= (3, 11): + def format(self, *, chain: bool = ..., _ctx: _ExceptionPrintContext | None = ...) -> Generator[str, None, None]: ... + else: + def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ... + def format_exception_only(self) -> Generator[str, None, None]: ... + if sys.version_info >= (3, 11): + def print(self, *, file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ... + class FrameSummary(Iterable[Any]): + if sys.version_info >= (3, 11): + def __init__( + self, + filename: str, + lineno: int | None, + name: str, + *, + lookup_line: bool = ..., + locals: Mapping[str, str] | None = ..., + line: str | None = ..., + end_lineno: int | None = ..., + colno: int | None = ..., + end_colno: int | None = ..., + ) -> None: ... + end_lineno: int | None + colno: int | None + end_colno: int | None + else: + def __init__( + self, + filename: str, + lineno: int | None, + name: str, + *, + lookup_line: bool = ..., + locals: Mapping[str, str] | None = ..., + line: str | None = ..., + ) -> None: ... filename: str - lineno: int + lineno: int | None name: str - line: str locals: dict[str, str] | None - def __init__( - self, - filename: str, - lineno: int, - name: str, - *, - lookup_line: bool = ..., - locals: Mapping[str, str] | None = ..., - line: str | None = ..., - ) -> None: ... - # TODO: more precise typing for __getitem__ and __iter__, - # for a namedtuple-like view on (filename, lineno, name, str). - def __getitem__(self, i: int) -> Any: ... + @property + def line(self) -> str | None: ... + @overload + def __getitem__(self, pos: Literal[0]) -> str: ... + @overload + def __getitem__(self, pos: Literal[1]) -> int: ... + @overload + def __getitem__(self, pos: Literal[2]) -> str: ... + @overload + def __getitem__(self, pos: Literal[3]) -> str | None: ... + @overload + def __getitem__(self, pos: int) -> Any: ... def __iter__(self) -> Iterator[Any]: ... + def __eq__(self, other: object) -> bool: ... + if sys.version_info >= (3, 8): + def __len__(self) -> Literal[4]: ... -class StackSummary(List[FrameSummary]): +class StackSummary(list[FrameSummary]): @classmethod def extract( cls, - frame_gen: Iterable[Tuple[FrameType, int]], + frame_gen: Iterable[tuple[FrameType, int]], *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ..., ) -> StackSummary: ... @classmethod - def from_list(cls, a_list: list[_PT]) -> StackSummary: ... + def from_list(cls, a_list: Iterable[FrameSummary | _PT]) -> StackSummary: ... + if sys.version_info >= (3, 11): + def format_frame_summary(self, frame_summary: FrameSummary) -> str: ... + def format(self) -> list[str]: ... diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index e812b82..ed95261 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -1,21 +1,26 @@ import sys -from typing import Optional, Sequence, Tuple, Union, overload - from _tracemalloc import * +from collections.abc import Sequence +from typing import Any, Union, overload +from typing_extensions import SupportsIndex, TypeAlias def get_object_traceback(obj: object) -> Traceback | None: ... def take_snapshot() -> Snapshot: ... -class DomainFilter: +class BaseFilter: inclusive: bool - domain: int + def __init__(self, inclusive: bool) -> None: ... + +class DomainFilter(BaseFilter): + @property + def domain(self) -> int: ... def __init__(self, inclusive: bool, domain: int) -> None: ... -class Filter: +class Filter(BaseFilter): domain: int | None - inclusive: bool lineno: int | None - filename_pattern: str + @property + def filename_pattern(self) -> str: ... all_frames: bool def __init__( self, inclusive: bool, filename_pattern: str, lineno: int | None = ..., all_frames: bool = ..., domain: int | None = ... @@ -26,6 +31,7 @@ class Statistic: size: int traceback: Traceback def __init__(self, traceback: Traceback, size: int, count: int) -> None: ... + def __eq__(self, other: object) -> bool: ... class StatisticDiff: count: int @@ -34,43 +40,70 @@ class StatisticDiff: size_diff: int traceback: Traceback def __init__(self, traceback: Traceback, size: int, size_diff: int, count: int, count_diff: int) -> None: ... + def __eq__(self, other: object) -> bool: ... -_FrameTupleT = Tuple[str, int] +_FrameTuple: TypeAlias = tuple[str, int] class Frame: - filename: str - lineno: int - def __init__(self, frame: _FrameTupleT) -> None: ... + @property + def filename(self) -> str: ... + @property + def lineno(self) -> int: ... + def __init__(self, frame: _FrameTuple) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: Frame) -> bool: ... + if sys.version_info >= (3, 11): + def __gt__(self, other: Frame) -> bool: ... + def __ge__(self, other: Frame) -> bool: ... + def __le__(self, other: Frame) -> bool: ... + else: + def __gt__(self, other: Frame, NotImplemented: Any = ...) -> bool: ... + def __ge__(self, other: Frame, NotImplemented: Any = ...) -> bool: ... + def __le__(self, other: Frame, NotImplemented: Any = ...) -> bool: ... if sys.version_info >= (3, 9): - _TraceTupleT = Union[Tuple[int, int, Sequence[_FrameTupleT], Optional[int]], Tuple[int, int, Sequence[_FrameTupleT]]] + _TraceTuple: TypeAlias = Union[tuple[int, int, Sequence[_FrameTuple], int | None], tuple[int, int, Sequence[_FrameTuple]]] else: - _TraceTupleT = Tuple[int, int, Sequence[_FrameTupleT]] + _TraceTuple: TypeAlias = tuple[int, int, Sequence[_FrameTuple]] class Trace: - domain: int - size: int - traceback: Traceback - def __init__(self, trace: _TraceTupleT) -> None: ... + @property + def domain(self) -> int: ... + @property + def size(self) -> int: ... + @property + def traceback(self) -> Traceback: ... + def __init__(self, trace: _TraceTuple) -> None: ... + def __eq__(self, other: object) -> bool: ... class Traceback(Sequence[Frame]): if sys.version_info >= (3, 9): - total_nframe: int | None - def __init__(self, frames: Sequence[_FrameTupleT], total_nframe: int | None = ...) -> None: ... - else: - def __init__(self, frames: Sequence[_FrameTupleT]) -> None: ... - if sys.version_info >= (3, 7): - def format(self, limit: int | None = ..., most_recent_first: bool = ...) -> list[str]: ... + @property + def total_nframe(self) -> int | None: ... + def __init__(self, frames: Sequence[_FrameTuple], total_nframe: int | None = ...) -> None: ... else: - def format(self, limit: int | None = ...) -> list[str]: ... + def __init__(self, frames: Sequence[_FrameTuple]) -> None: ... + + def format(self, limit: int | None = ..., most_recent_first: bool = ...) -> list[str]: ... @overload - def __getitem__(self, i: int) -> Frame: ... + def __getitem__(self, index: SupportsIndex) -> Frame: ... @overload - def __getitem__(self, s: slice) -> Sequence[Frame]: ... + def __getitem__(self, index: slice) -> Sequence[Frame]: ... + def __contains__(self, frame: Frame) -> bool: ... # type: ignore[override] def __len__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: Traceback) -> bool: ... + if sys.version_info >= (3, 11): + def __gt__(self, other: Traceback) -> bool: ... + def __ge__(self, other: Traceback) -> bool: ... + def __le__(self, other: Traceback) -> bool: ... + else: + def __gt__(self, other: Traceback, NotImplemented: Any = ...) -> bool: ... + def __ge__(self, other: Traceback, NotImplemented: Any = ...) -> bool: ... + def __le__(self, other: Traceback, NotImplemented: Any = ...) -> bool: ... class Snapshot: - def __init__(self, traces: Sequence[_TraceTupleT], traceback_limit: int) -> None: ... + def __init__(self, traces: Sequence[_TraceTuple], traceback_limit: int) -> None: ... def compare_to(self, old_snapshot: Snapshot, key_type: str, cumulative: bool = ...) -> list[StatisticDiff]: ... def dump(self, filename: str) -> None: ... def filter_traces(self, filters: Sequence[DomainFilter | Filter]) -> Snapshot: ... diff --git a/stdlib/tty.pyi b/stdlib/tty.pyi index c0dc418..8edae9e 100644 --- a/stdlib/tty.pyi +++ b/stdlib/tty.pyi @@ -1,15 +1,19 @@ -from typing import IO, Union +import sys +from typing import IO +from typing_extensions import TypeAlias -_FD = Union[int, IO[str]] +if sys.platform != "win32": + __all__ = ["setraw", "setcbreak"] -# XXX: Undocumented integer constants -IFLAG: int -OFLAG: int -CFLAG: int -LFLAG: int -ISPEED: int -OSPEED: int -CC: int + _FD: TypeAlias = int | IO[str] -def setraw(fd: _FD, when: int = ...) -> None: ... -def setcbreak(fd: _FD, when: int = ...) -> None: ... + # XXX: Undocumented integer constants + IFLAG: int + OFLAG: int + CFLAG: int + LFLAG: int + ISPEED: int + OSPEED: int + CC: int + def setraw(fd: _FD, when: int = ...) -> None: ... + def setcbreak(fd: _FD, when: int = ...) -> None: ... diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index a289fd0..13197c3 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -1,24 +1,173 @@ -from tkinter import Canvas, PhotoImage -from typing import Any, Callable, Dict, Sequence, Tuple, TypeVar, Union, overload +from _typeshed import Self +from collections.abc import Callable, Sequence +from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar +from typing import Any, ClassVar, Union, overload +from typing_extensions import TypeAlias + +__all__ = [ + "ScrolledCanvas", + "TurtleScreen", + "Screen", + "RawTurtle", + "Turtle", + "RawPen", + "Pen", + "Shape", + "Vec2D", + "addshape", + "bgcolor", + "bgpic", + "bye", + "clearscreen", + "colormode", + "delay", + "exitonclick", + "getcanvas", + "getshapes", + "listen", + "mainloop", + "mode", + "numinput", + "onkey", + "onkeypress", + "onkeyrelease", + "onscreenclick", + "ontimer", + "register_shape", + "resetscreen", + "screensize", + "setup", + "setworldcoordinates", + "textinput", + "title", + "tracer", + "turtles", + "update", + "window_height", + "window_width", + "back", + "backward", + "begin_fill", + "begin_poly", + "bk", + "circle", + "clear", + "clearstamp", + "clearstamps", + "clone", + "color", + "degrees", + "distance", + "dot", + "down", + "end_fill", + "end_poly", + "fd", + "fillcolor", + "filling", + "forward", + "get_poly", + "getpen", + "getscreen", + "get_shapepoly", + "getturtle", + "goto", + "heading", + "hideturtle", + "home", + "ht", + "isdown", + "isvisible", + "left", + "lt", + "onclick", + "ondrag", + "onrelease", + "pd", + "pen", + "pencolor", + "pendown", + "pensize", + "penup", + "pos", + "position", + "pu", + "radians", + "right", + "reset", + "resizemode", + "rt", + "seth", + "setheading", + "setpos", + "setposition", + "settiltangle", + "setundobuffer", + "setx", + "sety", + "shape", + "shapesize", + "shapetransform", + "shearfactor", + "showturtle", + "speed", + "st", + "stamp", + "tilt", + "tiltangle", + "towards", + "turtlesize", + "undo", + "undobufferentries", + "up", + "width", + "write", + "xcor", + "ycor", + "write_docstringdict", + "done", + "Terminator", +] # Note: '_Color' is the alias we use for arguments and _AnyColor is the # alias we use for return types. Really, these two aliases should be the # same, but as per the "no union returns" typeshed policy, we'll return # Any instead. -_Color = Union[str, Tuple[float, float, float]] -_AnyColor = Any +_Color: TypeAlias = Union[str, tuple[float, float, float]] +_AnyColor: TypeAlias = Any # TODO: Replace this with a TypedDict once it becomes standardized. -_PenState = Dict[str, Any] - -_Speed = Union[str, float] -_PolygonCoords = Sequence[Tuple[float, float]] - -# TODO: Type this more accurately -# Vec2D is actually a custom subclass of 'tuple'. -Vec2D = Tuple[float, float] +_PenState: TypeAlias = dict[str, Any] + +_Speed: TypeAlias = str | float +_PolygonCoords: TypeAlias = Sequence[tuple[float, float]] + +class Vec2D(tuple[float, float]): + def __new__(cls: type[Self], x: float, y: float) -> Self: ... + def __add__(self, other: tuple[float, float]) -> Vec2D: ... # type: ignore[override] + @overload # type: ignore[override] + def __mul__(self, other: Vec2D) -> float: ... + @overload + def __mul__(self, other: float) -> Vec2D: ... + def __rmul__(self, other: float) -> Vec2D: ... # type: ignore[override] + def __sub__(self, other: tuple[float, float]) -> Vec2D: ... + def __neg__(self) -> Vec2D: ... + def __abs__(self) -> float: ... + def rotate(self, angle: float) -> Vec2D: ... + +# Does not actually inherit from Canvas, but dynamically gets all methods of Canvas +class ScrolledCanvas(Canvas, Frame): # type: ignore[misc] + bg: str + hscroll: Scrollbar + vscroll: Scrollbar + def __init__( + self, master: Misc | None, width: int = ..., height: int = ..., canvwidth: int = ..., canvheight: int = ... + ) -> None: ... + canvwidth: int + canvheight: int + def reset(self, canvwidth: int | None = ..., canvheight: int | None = ..., bg: str | None = ...) -> None: ... -class TurtleScreenBase(object): +class TurtleScreenBase: cv: Canvas canvwidth: int canvheight: int @@ -34,7 +183,7 @@ class TurtleScreenBase(object): class Terminator(Exception): ... class TurtleGraphicsError(Exception): ... -class Shape(object): +class Shape: def __init__(self, type_: str, data: _PolygonCoords | PhotoImage | None = ...) -> None: ... def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: _Color | None = ...) -> None: ... @@ -72,16 +221,16 @@ class TurtleScreen(TurtleScreenBase): def window_height(self) -> int: ... def getcanvas(self) -> Canvas: ... def getshapes(self) -> list[str]: ... - def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... - def onkey(self, fun: Callable[[], Any], key: str) -> None: ... + def onclick(self, fun: Callable[[float, float], object], btn: int = ..., add: Any | None = ...) -> None: ... + def onkey(self, fun: Callable[[], object], key: str) -> None: ... def listen(self, xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... - def ontimer(self, fun: Callable[[], Any], t: int = ...) -> None: ... + def ontimer(self, fun: Callable[[], object], t: int = ...) -> None: ... @overload def bgpic(self, picname: None = ...) -> str: ... @overload def bgpic(self, picname: str) -> None: ... @overload - def screensize(self, canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ... + def screensize(self, canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> tuple[int, int]: ... # Looks like if self.cv is not a ScrolledCanvas, this could return a tuple as well @overload def screensize(self, canvwidth: int, canvheight: int, bg: _Color | None = ...) -> None: ... @@ -89,10 +238,10 @@ class TurtleScreen(TurtleScreenBase): resetscreen = reset clearscreen = clear addshape = register_shape - def onkeypress(self, fun: Callable[[], Any], key: str | None = ...) -> None: ... + def onkeypress(self, fun: Callable[[], object], key: str | None = ...) -> None: ... onkeyrelease = onkey -class TNavigator(object): +class TNavigator: START_ORIENTATION: dict[str, Vec2D] DEFAULT_MODE: str DEFAULT_ANGLEOFFSET: int @@ -109,18 +258,18 @@ class TNavigator(object): def xcor(self) -> float: ... def ycor(self) -> float: ... @overload - def goto(self, x: Tuple[float, float], y: None = ...) -> None: ... + def goto(self, x: tuple[float, float], y: None = ...) -> None: ... @overload def goto(self, x: float, y: float) -> None: ... def home(self) -> None: ... def setx(self, x: float) -> None: ... def sety(self, y: float) -> None: ... @overload - def distance(self, x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... + def distance(self, x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def distance(self, x: float, y: float) -> float: ... @overload - def towards(self, x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... + def towards(self, x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def towards(self, x: float, y: float) -> float: ... def heading(self) -> float: ... @@ -136,7 +285,7 @@ class TNavigator(object): setposition = goto seth = setheading -class TPen(object): +class TPen: def __init__(self, resizemode: str = ...) -> None: ... @overload def resizemode(self, rmode: None = ...) -> str: ... @@ -166,7 +315,7 @@ class TPen(object): @overload def fillcolor(self, r: float, g: float, b: float) -> None: ... @overload - def color(self) -> Tuple[_AnyColor, _AnyColor]: ... + def color(self) -> tuple[_AnyColor, _AnyColor]: ... @overload def color(self, color: _Color) -> None: ... @overload @@ -178,7 +327,7 @@ class TPen(object): def isvisible(self) -> bool: ... # Note: signatures 1 and 2 overlap unsafely when no arguments are provided @overload - def pen(self) -> _PenState: ... # type: ignore + def pen(self) -> _PenState: ... # type: ignore[misc] @overload def pen( self, @@ -191,7 +340,7 @@ class TPen(object): pensize: int = ..., speed: int = ..., resizemode: str = ..., - stretchfactor: Tuple[float, float] = ..., + stretchfactor: tuple[float, float] = ..., outline: int = ..., tilt: float = ..., ) -> None: ... @@ -203,9 +352,9 @@ class TPen(object): st = showturtle ht = hideturtle -_T = TypeVar("_T") - class RawTurtle(TPen, TNavigator): + screen: TurtleScreen + screens: ClassVar[list[TurtleScreen]] def __init__( self, canvas: Canvas | TurtleScreen | None = ..., shape: str = ..., undobuffersize: int = ..., visible: bool = ... ) -> None: ... @@ -213,14 +362,14 @@ class RawTurtle(TPen, TNavigator): def setundobuffer(self, size: int | None) -> None: ... def undobufferentries(self) -> int: ... def clear(self) -> None: ... - def clone(self: _T) -> _T: ... + def clone(self: Self) -> Self: ... @overload def shape(self, name: None = ...) -> str: ... @overload def shape(self, name: str) -> None: ... # Unsafely overlaps when no arguments are provided @overload - def shapesize(self) -> Tuple[float, float, float]: ... # type: ignore + def shapesize(self) -> tuple[float, float, float]: ... # type: ignore[misc] @overload def shapesize( self, stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ... @@ -231,7 +380,7 @@ class RawTurtle(TPen, TNavigator): def shearfactor(self, shear: float) -> None: ... # Unsafely overlaps when no arguments are provided @overload - def shapetransform(self) -> Tuple[float, float, float, float]: ... # type: ignore + def shapetransform(self) -> tuple[float, float, float, float]: ... # type: ignore[misc] @overload def shapetransform( self, t11: float | None = ..., t12: float | None = ..., t21: float | None = ..., t22: float | None = ... @@ -247,22 +396,22 @@ class RawTurtle(TPen, TNavigator): # a compound stamp or not. So, as per the "no Union return" policy, # we return Any. def stamp(self) -> Any: ... - def clearstamp(self, stampid: int | Tuple[int, ...]) -> None: ... + def clearstamp(self, stampid: int | tuple[int, ...]) -> None: ... def clearstamps(self, n: int | None = ...) -> None: ... def filling(self) -> bool: ... def begin_fill(self) -> None: ... def end_fill(self) -> None: ... def dot(self, size: int | None = ..., *color: _Color) -> None: ... - def write(self, arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ... + def write(self, arg: object, move: bool = ..., align: str = ..., font: tuple[str, int, str] = ...) -> None: ... def begin_poly(self) -> None: ... def end_poly(self) -> None: ... def get_poly(self) -> _PolygonCoords | None: ... def getscreen(self) -> TurtleScreen: ... - def getturtle(self: _T) -> _T: ... + def getturtle(self: Self) -> Self: ... getpen = getturtle - def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ... - def onrelease(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ... - def ondrag(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ... + def onclick(self, fun: Callable[[float, float], object], btn: int = ..., add: bool | None = ...) -> None: ... + def onrelease(self, fun: Callable[[float, float], object], btn: int = ..., add: bool | None = ...) -> None: ... + def ondrag(self, fun: Callable[[float, float], object], btn: int = ..., add: bool | None = ...) -> None: ... def undo(self) -> None: ... turtlesize = shapesize @@ -270,7 +419,11 @@ class _Screen(TurtleScreen): def __init__(self) -> None: ... # Note int and float are interpreted differently, hence the Union instead of just float def setup( - self, width: int | float = ..., height: int | float = ..., startx: int | None = ..., starty: int | None = ... + self, + width: int | float = ..., # noqa: Y041 + height: int | float = ..., # noqa: Y041 + startx: int | None = ..., + starty: int | None = ..., ) -> None: ... def title(self, titlestring: str) -> None: ... def bye(self) -> None: ... @@ -337,16 +490,16 @@ def window_width() -> int: ... def window_height() -> int: ... def getcanvas() -> Canvas: ... def getshapes() -> list[str]: ... -def onclick(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... -def onkey(fun: Callable[[], Any], key: str) -> None: ... +def onclick(fun: Callable[[float, float], object], btn: int = ..., add: Any | None = ...) -> None: ... +def onkey(fun: Callable[[], object], key: str) -> None: ... def listen(xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... -def ontimer(fun: Callable[[], Any], t: int = ...) -> None: ... +def ontimer(fun: Callable[[], object], t: int = ...) -> None: ... @overload def bgpic(picname: None = ...) -> str: ... @overload def bgpic(picname: str) -> None: ... @overload -def screensize(canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> Tuple[int, int]: ... +def screensize(canvwidth: None = ..., canvheight: None = ..., bg: None = ...) -> tuple[int, int]: ... @overload def screensize(canvwidth: int, canvheight: int, bg: _Color | None = ...) -> None: ... @@ -355,7 +508,7 @@ resetscreen = reset clearscreen = clear addshape = register_shape -def onkeypress(fun: Callable[[], Any], key: str | None = ...) -> None: ... +def onkeypress(fun: Callable[[], object], key: str | None = ...) -> None: ... onkeyrelease = onkey @@ -379,18 +532,18 @@ def pos() -> Vec2D: ... def xcor() -> float: ... def ycor() -> float: ... @overload -def goto(x: Tuple[float, float], y: None = ...) -> None: ... +def goto(x: tuple[float, float], y: None = ...) -> None: ... @overload def goto(x: float, y: float) -> None: ... def home() -> None: ... def setx(x: float) -> None: ... def sety(y: float) -> None: ... @overload -def distance(x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... +def distance(x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def distance(x: float, y: float) -> float: ... @overload -def towards(x: TNavigator | Tuple[float, float], y: None = ...) -> float: ... +def towards(x: TNavigator | tuple[float, float], y: None = ...) -> float: ... @overload def towards(x: float, y: float) -> float: ... def heading() -> float: ... @@ -436,7 +589,7 @@ def fillcolor(color: _Color) -> None: ... @overload def fillcolor(r: float, g: float, b: float) -> None: ... @overload -def color() -> Tuple[_AnyColor, _AnyColor]: ... +def color() -> tuple[_AnyColor, _AnyColor]: ... @overload def color(color: _Color) -> None: ... @overload @@ -449,7 +602,7 @@ def isvisible() -> bool: ... # Note: signatures 1 and 2 overlap unsafely when no arguments are provided @overload -def pen() -> _PenState: ... # type: ignore +def pen() -> _PenState: ... # type: ignore[misc] @overload def pen( pen: _PenState | None = ..., @@ -461,7 +614,7 @@ def pen( pensize: int = ..., speed: int = ..., resizemode: str = ..., - stretchfactor: Tuple[float, float] = ..., + stretchfactor: tuple[float, float] = ..., outline: int = ..., tilt: float = ..., ) -> None: ... @@ -485,7 +638,7 @@ def shape(name: str) -> None: ... # Unsafely overlaps when no arguments are provided @overload -def shapesize() -> Tuple[float, float, float]: ... # type: ignore +def shapesize() -> tuple[float, float, float]: ... # type: ignore[misc] @overload def shapesize(stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ...) -> None: ... @overload @@ -495,7 +648,7 @@ def shearfactor(shear: float) -> None: ... # Unsafely overlaps when no arguments are provided @overload -def shapetransform() -> Tuple[float, float, float, float]: ... # type: ignore +def shapetransform() -> tuple[float, float, float, float]: ... # type: ignore[misc] @overload def shapetransform( t11: float | None = ..., t12: float | None = ..., t21: float | None = ..., t22: float | None = ... @@ -512,13 +665,13 @@ def tilt(angle: float) -> None: ... # a compound stamp or not. So, as per the "no Union return" policy, # we return Any. def stamp() -> Any: ... -def clearstamp(stampid: int | Tuple[int, ...]) -> None: ... +def clearstamp(stampid: int | tuple[int, ...]) -> None: ... def clearstamps(n: int | None = ...) -> None: ... def filling() -> bool: ... def begin_fill() -> None: ... def end_fill() -> None: ... def dot(size: int | None = ..., *color: _Color) -> None: ... -def write(arg: object, move: bool = ..., align: str = ..., font: Tuple[str, int, str] = ...) -> None: ... +def write(arg: object, move: bool = ..., align: str = ..., font: tuple[str, int, str] = ...) -> None: ... def begin_poly() -> None: ... def end_poly() -> None: ... def get_poly() -> _PolygonCoords | None: ... @@ -527,8 +680,8 @@ def getturtle() -> Turtle: ... getpen = getturtle -def onrelease(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... -def ondrag(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... +def onrelease(fun: Callable[[float, float], object], btn: int = ..., add: Any | None = ...) -> None: ... +def ondrag(fun: Callable[[float, float], object], btn: int = ..., add: Any | None = ...) -> None: ... def undo() -> None: ... turtlesize = shapesize diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 0df2c35..c282ab5 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -1,30 +1,63 @@ import sys -from importlib.abc import _LoaderProtocol -from importlib.machinery import ModuleSpec -from typing import ( - Any, +from _typeshed import SupportsKeysAndGetItem +from collections.abc import ( AsyncGenerator, Awaitable, Callable, Coroutine, Generator, - Generic, ItemsView, Iterable, Iterator, KeysView, - Mapping, - Tuple, - Type, - TypeVar, + MutableSequence, ValuesView, - overload, ) -from typing_extensions import Literal, final +from importlib.machinery import ModuleSpec + +# pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping +from typing import Any, ClassVar, Generic, Mapping, Protocol, TypeVar, overload # noqa: Y027 +from typing_extensions import Literal, ParamSpec, final + +__all__ = [ + "FunctionType", + "LambdaType", + "CodeType", + "MappingProxyType", + "SimpleNamespace", + "GeneratorType", + "CoroutineType", + "AsyncGeneratorType", + "MethodType", + "BuiltinFunctionType", + "ModuleType", + "TracebackType", + "FrameType", + "GetSetDescriptorType", + "MemberDescriptorType", + "new_class", + "prepare_class", + "DynamicClassAttribute", + "coroutine", + "BuiltinMethodType", + "ClassMethodDescriptorType", + "MethodDescriptorType", + "MethodWrapperType", + "WrapperDescriptorType", + "resolve_bases", +] + +if sys.version_info >= (3, 8): + __all__ += ["CellType"] + +if sys.version_info >= (3, 9): + __all__ += ["GenericAlias"] + +if sys.version_info >= (3, 10): + __all__ += ["EllipsisType", "NoneType", "NotImplementedType", "UnionType"] # Note, all classes "defined" here require special handling. -_T = TypeVar("_T") _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") _T_co = TypeVar("_T_co", covariant=True) @@ -35,94 +68,196 @@ _V_co = TypeVar("_V_co", covariant=True) @final class _Cell: - __hash__: None # type: ignore + __hash__: ClassVar[None] # type: ignore[assignment] cell_contents: Any +# Make sure this class definition stays roughly in line with `builtins.function` @final class FunctionType: - __closure__: Tuple[_Cell, ...] | None + @property + def __closure__(self) -> tuple[_Cell, ...] | None: ... __code__: CodeType - __defaults__: Tuple[Any, ...] | None + __defaults__: tuple[Any, ...] | None __dict__: dict[str, Any] - __globals__: dict[str, Any] + @property + def __globals__(self) -> dict[str, Any]: ... __name__: str __qualname__: str __annotations__: dict[str, Any] __kwdefaults__: dict[str, Any] + if sys.version_info >= (3, 10): + @property + def __builtins__(self) -> dict[str, Any]: ... + + __module__: str def __init__( self, code: CodeType, globals: dict[str, Any], name: str | None = ..., - argdefs: Tuple[object, ...] | None = ..., - closure: Tuple[_Cell, ...] | None = ..., + argdefs: tuple[object, ...] | None = ..., + closure: tuple[_Cell, ...] | None = ..., ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: object | None, type: type | None) -> MethodType: ... + @overload + def __get__(self, obj: None, type: type) -> FunctionType: ... + @overload + def __get__(self, obj: object, type: type | None = ...) -> MethodType: ... LambdaType = FunctionType @final class CodeType: - """Create a code object. Not for the faint of heart.""" - - co_argcount: int - if sys.version_info >= (3, 8): - co_posonlyargcount: int - co_kwonlyargcount: int - co_nlocals: int - co_stacksize: int - co_flags: int - co_code: bytes - co_consts: Tuple[Any, ...] - co_names: Tuple[str, ...] - co_varnames: Tuple[str, ...] - co_filename: str - co_name: str - co_firstlineno: int - co_lnotab: bytes - co_freevars: Tuple[str, ...] - co_cellvars: Tuple[str, ...] + @property + def co_argcount(self) -> int: ... if sys.version_info >= (3, 8): + @property + def co_posonlyargcount(self) -> int: ... + + @property + def co_kwonlyargcount(self) -> int: ... + @property + def co_nlocals(self) -> int: ... + @property + def co_stacksize(self) -> int: ... + @property + def co_flags(self) -> int: ... + @property + def co_code(self) -> bytes: ... + @property + def co_consts(self) -> tuple[Any, ...]: ... + @property + def co_names(self) -> tuple[str, ...]: ... + @property + def co_varnames(self) -> tuple[str, ...]: ... + @property + def co_filename(self) -> str: ... + @property + def co_name(self) -> str: ... + @property + def co_firstlineno(self) -> int: ... + @property + def co_lnotab(self) -> bytes: ... + @property + def co_freevars(self) -> tuple[str, ...]: ... + @property + def co_cellvars(self) -> tuple[str, ...]: ... + if sys.version_info >= (3, 10): + @property + def co_linetable(self) -> bytes: ... + def co_lines(self) -> Iterator[tuple[int, int, int | None]]: ... + if sys.version_info >= (3, 11): + @property + def co_exceptiontable(self) -> bytes: ... + @property + def co_qualname(self) -> str: ... + def co_positions(self) -> Iterable[tuple[int | None, int | None, int | None, int | None]]: ... + + if sys.version_info >= (3, 11): + def __init__( + self, + __argcount: int, + __posonlyargcount: int, + __kwonlyargcount: int, + __nlocals: int, + __stacksize: int, + __flags: int, + __codestring: bytes, + __constants: tuple[object, ...], + __names: tuple[str, ...], + __varnames: tuple[str, ...], + __filename: str, + __name: str, + __qualname: str, + __firstlineno: int, + __linetable: bytes, + __exceptiontable: bytes, + __freevars: tuple[str, ...] = ..., + __cellvars: tuple[str, ...] = ..., + ) -> None: ... + elif sys.version_info >= (3, 10): + def __init__( + self, + __argcount: int, + __posonlyargcount: int, + __kwonlyargcount: int, + __nlocals: int, + __stacksize: int, + __flags: int, + __codestring: bytes, + __constants: tuple[object, ...], + __names: tuple[str, ...], + __varnames: tuple[str, ...], + __filename: str, + __name: str, + __firstlineno: int, + __linetable: bytes, + __freevars: tuple[str, ...] = ..., + __cellvars: tuple[str, ...] = ..., + ) -> None: ... + elif sys.version_info >= (3, 8): def __init__( self, - argcount: int, - posonlyargcount: int, - kwonlyargcount: int, - nlocals: int, - stacksize: int, - flags: int, - codestring: bytes, - constants: Tuple[Any, ...], - names: Tuple[str, ...], - varnames: Tuple[str, ...], - filename: str, - name: str, - firstlineno: int, - lnotab: bytes, - freevars: Tuple[str, ...] = ..., - cellvars: Tuple[str, ...] = ..., + __argcount: int, + __posonlyargcount: int, + __kwonlyargcount: int, + __nlocals: int, + __stacksize: int, + __flags: int, + __codestring: bytes, + __constants: tuple[object, ...], + __names: tuple[str, ...], + __varnames: tuple[str, ...], + __filename: str, + __name: str, + __firstlineno: int, + __lnotab: bytes, + __freevars: tuple[str, ...] = ..., + __cellvars: tuple[str, ...] = ..., ) -> None: ... else: def __init__( self, - argcount: int, - kwonlyargcount: int, - nlocals: int, - stacksize: int, - flags: int, - codestring: bytes, - constants: Tuple[Any, ...], - names: Tuple[str, ...], - varnames: Tuple[str, ...], - filename: str, - name: str, - firstlineno: int, - lnotab: bytes, - freevars: Tuple[str, ...] = ..., - cellvars: Tuple[str, ...] = ..., + __argcount: int, + __kwonlyargcount: int, + __nlocals: int, + __stacksize: int, + __flags: int, + __codestring: bytes, + __constants: tuple[object, ...], + __names: tuple[str, ...], + __varnames: tuple[str, ...], + __filename: str, + __name: str, + __firstlineno: int, + __lnotab: bytes, + __freevars: tuple[str, ...] = ..., + __cellvars: tuple[str, ...] = ..., ) -> None: ... - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 11): + def replace( + self, + *, + co_argcount: int = ..., + co_posonlyargcount: int = ..., + co_kwonlyargcount: int = ..., + co_nlocals: int = ..., + co_stacksize: int = ..., + co_flags: int = ..., + co_firstlineno: int = ..., + co_code: bytes = ..., + co_consts: tuple[object, ...] = ..., + co_names: tuple[str, ...] = ..., + co_varnames: tuple[str, ...] = ..., + co_freevars: tuple[str, ...] = ..., + co_cellvars: tuple[str, ...] = ..., + co_filename: str = ..., + co_name: str = ..., + co_qualname: str = ..., + co_linetable: bytes = ..., + co_exceptiontable: bytes = ..., + ) -> CodeType: ... + elif sys.version_info >= (3, 10): def replace( self, *, @@ -134,11 +269,32 @@ class CodeType: co_flags: int = ..., co_firstlineno: int = ..., co_code: bytes = ..., - co_consts: Tuple[Any, ...] = ..., - co_names: Tuple[str, ...] = ..., - co_varnames: Tuple[str, ...] = ..., - co_freevars: Tuple[str, ...] = ..., - co_cellvars: Tuple[str, ...] = ..., + co_consts: tuple[object, ...] = ..., + co_names: tuple[str, ...] = ..., + co_varnames: tuple[str, ...] = ..., + co_freevars: tuple[str, ...] = ..., + co_cellvars: tuple[str, ...] = ..., + co_filename: str = ..., + co_name: str = ..., + co_linetable: bytes = ..., + ) -> CodeType: ... + elif sys.version_info >= (3, 8): + def replace( + self, + *, + co_argcount: int = ..., + co_posonlyargcount: int = ..., + co_kwonlyargcount: int = ..., + co_nlocals: int = ..., + co_stacksize: int = ..., + co_flags: int = ..., + co_firstlineno: int = ..., + co_code: bytes = ..., + co_consts: tuple[object, ...] = ..., + co_names: tuple[str, ...] = ..., + co_varnames: tuple[str, ...] = ..., + co_freevars: tuple[str, ...] = ..., + co_cellvars: tuple[str, ...] = ..., co_filename: str = ..., co_name: str = ..., co_lnotab: bytes = ..., @@ -146,9 +302,9 @@ class CodeType: @final class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]): - __hash__: None # type: ignore - def __init__(self, mapping: Mapping[_KT, _VT_co]) -> None: ... - def __getitem__(self, k: _KT) -> _VT_co: ... + __hash__: ClassVar[None] # type: ignore[assignment] + def __init__(self, mapping: SupportsKeysAndGetItem[_KT, _VT_co]) -> None: ... + def __getitem__(self, __key: _KT) -> _VT_co: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... def copy(self) -> dict[_KT, _VT_co]: ... @@ -162,149 +318,180 @@ class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]): def __ror__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT_co | _T2]: ... class SimpleNamespace: - __hash__: None # type: ignore + __hash__: ClassVar[None] # type: ignore[assignment] def __init__(self, **kwargs: Any) -> None: ... - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... + def __getattribute__(self, __name: str) -> Any: ... + def __setattr__(self, __name: str, __value: Any) -> None: ... + def __delattr__(self, __name: str) -> None: ... + +class _LoaderProtocol(Protocol): + def load_module(self, fullname: str) -> ModuleType: ... class ModuleType: __name__: str - __file__: str - __dict__: dict[str, Any] + __file__: str | None + @property + def __dict__(self) -> dict[str, Any]: ... # type: ignore[override] __loader__: _LoaderProtocol | None __package__: str | None + __path__: MutableSequence[str] __spec__: ModuleSpec | None def __init__(self, name: str, doc: str | None = ...) -> None: ... + # __getattr__ doesn't exist at runtime, + # but having it here in typeshed makes dynamic imports + # using `builtins.__import__` or `importlib.import_module` less painful + def __getattr__(self, name: str) -> Any: ... @final class GeneratorType(Generator[_T_co, _T_contra, _V_co]): - gi_code: CodeType - gi_frame: FrameType - gi_running: bool - gi_yieldfrom: GeneratorType[_T_co, _T_contra, Any] | None + @property + def gi_yieldfrom(self) -> GeneratorType[_T_co, _T_contra, Any] | None: ... + if sys.version_info >= (3, 11): + @property + def gi_suspended(self) -> bool: ... + __name__: str + __qualname__: str def __iter__(self) -> GeneratorType[_T_co, _T_contra, _V_co]: ... def __next__(self) -> _T_co: ... - def close(self) -> None: ... def send(self, __arg: _T_contra) -> _T_co: ... @overload def throw( - self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... + self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... ) -> _T_co: ... @overload def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ... @final class AsyncGeneratorType(AsyncGenerator[_T_co, _T_contra]): - ag_await: Awaitable[Any] | None - ag_frame: FrameType - ag_running: bool - ag_code: CodeType + @property + def ag_await(self) -> Awaitable[Any] | None: ... + __name__: str + __qualname__: str def __aiter__(self) -> AsyncGeneratorType[_T_co, _T_contra]: ... - def __anext__(self) -> Awaitable[_T_co]: ... - def asend(self, __val: _T_contra) -> Awaitable[_T_co]: ... + def __anext__(self) -> Coroutine[Any, Any, _T_co]: ... + def asend(self, __val: _T_contra) -> Coroutine[Any, Any, _T_co]: ... @overload - def athrow( - self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... - ) -> Awaitable[_T_co]: ... + async def athrow( + self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... + ) -> _T_co: ... @overload - def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ... - def aclose(self) -> Awaitable[None]: ... + async def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ... + def aclose(self) -> Coroutine[Any, Any, None]: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, __item: Any) -> GenericAlias: ... @final class CoroutineType(Coroutine[_T_co, _T_contra, _V_co]): __name__: str __qualname__: str - cr_await: Any | None - cr_code: CodeType - cr_frame: FrameType - cr_running: bool + @property + def cr_origin(self) -> tuple[tuple[str, int, str], ...] | None: ... + if sys.version_info >= (3, 11): + @property + def cr_suspended(self) -> bool: ... + def close(self) -> None: ... def __await__(self) -> Generator[Any, None, _V_co]: ... def send(self, __arg: _T_contra) -> _T_co: ... @overload def throw( - self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... + self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... ) -> _T_co: ... @overload def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ... class _StaticFunctionType: - """Fictional type to correct the type of MethodType.__func__. - - FunctionType is a descriptor, so mypy follows the descriptor protocol and - converts MethodType.__func__ back to MethodType (the return type of - FunctionType.__get__). But this is actually a special case; MethodType is - implemented in C and its attribute access doesn't go through - __getattribute__. - - By wrapping FunctionType in _StaticFunctionType, we get the right result; - similar to wrapping a function in staticmethod() at runtime to prevent it - being bound as a method. - """ - + # Fictional type to correct the type of MethodType.__func__. + # FunctionType is a descriptor, so mypy follows the descriptor protocol and + # converts MethodType.__func__ back to MethodType (the return type of + # FunctionType.__get__). But this is actually a special case; MethodType is + # implemented in C and its attribute access doesn't go through + # __getattribute__. + # By wrapping FunctionType in _StaticFunctionType, we get the right result; + # similar to wrapping a function in staticmethod() at runtime to prevent it + # being bound as a method. def __get__(self, obj: object | None, type: type | None) -> FunctionType: ... @final class MethodType: - __closure__: Tuple[_Cell, ...] | None # inherited from the added function - __defaults__: Tuple[Any, ...] | None # inherited from the added function - __func__: _StaticFunctionType - __self__: object - __name__: str # inherited from the added function - __qualname__: str # inherited from the added function - def __init__(self, func: Callable[..., Any], obj: object) -> None: ... + @property + def __closure__(self) -> tuple[_Cell, ...] | None: ... # inherited from the added function + @property + def __defaults__(self) -> tuple[Any, ...] | None: ... # inherited from the added function + @property + def __func__(self) -> _StaticFunctionType: ... + @property + def __self__(self) -> object: ... + @property + def __name__(self) -> str: ... # inherited from the added function + @property + def __qualname__(self) -> str: ... # inherited from the added function + def __init__(self, __func: Callable[..., Any], __obj: object) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... @final class BuiltinFunctionType: - __self__: object | ModuleType - __name__: str - __qualname__: str + @property + def __self__(self) -> object | ModuleType: ... + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... BuiltinMethodType = BuiltinFunctionType -if sys.version_info >= (3, 7): - @final - class WrapperDescriptorType: - __name__: str - __qualname__: str - __objclass__: type - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: Any, type: type = ...) -> Any: ... - @final - class MethodWrapperType: - __self__: object - __name__: str - __qualname__: str - __objclass__: type - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... - @final - class MethodDescriptorType: - __name__: str - __qualname__: str - __objclass__: type - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: Any, type: type = ...) -> Any: ... - @final - class ClassMethodDescriptorType: - __name__: str - __qualname__: str - __objclass__: type - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: Any, type: type = ...) -> Any: ... +@final +class WrapperDescriptorType: + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... + @property + def __objclass__(self) -> type: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + +@final +class MethodWrapperType: + @property + def __self__(self) -> object: ... + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... + @property + def __objclass__(self) -> type: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __eq__(self, __other: object) -> bool: ... + def __ne__(self, __other: object) -> bool: ... + +@final +class MethodDescriptorType: + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... + @property + def __objclass__(self) -> type: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __get__(self, obj: Any, type: type = ...) -> Any: ... + +@final +class ClassMethodDescriptorType: + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... + @property + def __objclass__(self) -> type: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __get__(self, obj: Any, type: type = ...) -> Any: ... @final class TracebackType: - if sys.version_info >= (3, 7): - def __init__(self, tb_next: TracebackType | None, tb_frame: FrameType, tb_lasti: int, tb_lineno: int) -> None: ... - tb_next: TracebackType | None - else: - @property - def tb_next(self) -> TracebackType | None: ... + def __init__(self, tb_next: TracebackType | None, tb_frame: FrameType, tb_lasti: int, tb_lineno: int) -> None: ... + tb_next: TracebackType | None # the rest are read-only even in 3.7 @property def tb_frame(self) -> FrameType: ... @@ -315,82 +502,109 @@ class TracebackType: @final class FrameType: - f_back: FrameType | None - f_builtins: dict[str, Any] - f_code: CodeType - f_globals: dict[str, Any] - f_lasti: int - f_lineno: int - f_locals: dict[str, Any] + @property + def f_back(self) -> FrameType | None: ... + @property + def f_builtins(self) -> dict[str, Any]: ... + @property + def f_code(self) -> CodeType: ... + @property + def f_globals(self) -> dict[str, Any]: ... + @property + def f_lasti(self) -> int: ... + # see discussion in #6769: f_lineno *can* sometimes be None, + # but you should probably file a bug report with CPython if you encounter it being None in the wild. + # An `int | None` annotation here causes too many false-positive errors. + @property + def f_lineno(self) -> int | Any: ... + @property + def f_locals(self) -> dict[str, Any]: ... f_trace: Callable[[FrameType, str, Any], Any] | None - if sys.version_info >= (3, 7): - f_trace_lines: bool - f_trace_opcodes: bool + f_trace_lines: bool + f_trace_opcodes: bool def clear(self) -> None: ... @final class GetSetDescriptorType: - __name__: str - __objclass__: type + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... + @property + def __objclass__(self) -> type: ... def __get__(self, __obj: Any, __type: type = ...) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... + def __delete__(self, __obj: Any) -> None: ... @final class MemberDescriptorType: - __name__: str - __objclass__: type + @property + def __name__(self) -> str: ... + @property + def __qualname__(self) -> str: ... + @property + def __objclass__(self) -> type: ... def __get__(self, __obj: Any, __type: type = ...) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... - def __delete__(self, obj: Any) -> None: ... - -if sys.version_info >= (3, 7): - def new_class( - name: str, - bases: Iterable[object] = ..., - kwds: dict[str, Any] | None = ..., - exec_body: Callable[[dict[str, Any]], None] | None = ..., - ) -> type: ... - def resolve_bases(bases: Iterable[object]) -> Tuple[Any, ...]: ... - -else: - def new_class( - name: str, - bases: Tuple[type, ...] = ..., - kwds: dict[str, Any] | None = ..., - exec_body: Callable[[dict[str, Any]], None] | None = ..., - ) -> type: ... - + def __delete__(self, __obj: Any) -> None: ... + +def new_class( + name: str, + bases: Iterable[object] = ..., + kwds: dict[str, Any] | None = ..., + exec_body: Callable[[dict[str, Any]], object] | None = ..., +) -> type: ... +def resolve_bases(bases: Iterable[object]) -> tuple[Any, ...]: ... def prepare_class( - name: str, bases: Tuple[type, ...] = ..., kwds: dict[str, Any] | None = ... -) -> Tuple[type, dict[str, Any], dict[str, Any]]: ... + name: str, bases: tuple[type, ...] = ..., kwds: dict[str, Any] | None = ... +) -> tuple[type, dict[str, Any], dict[str, Any]]: ... # Actually a different type, but `property` is special and we want that too. DynamicClassAttribute = property -def coroutine(func: Callable[..., Any]) -> CoroutineType[Any, Any, Any]: ... +_Fn = TypeVar("_Fn", bound=Callable[..., object]) +_R = TypeVar("_R") +_P = ParamSpec("_P") + +# it's not really an Awaitable, but can be used in an await expression. Real type: Generator & Awaitable +# The type: ignore is due to overlapping overloads, not the use of ParamSpec +@overload +def coroutine(func: Callable[_P, Generator[_R, Any, Any]]) -> Callable[_P, Awaitable[_R]]: ... # type: ignore[misc] +@overload +def coroutine(func: _Fn) -> _Fn: ... if sys.version_info >= (3, 8): CellType = _Cell if sys.version_info >= (3, 9): class GenericAlias: - __origin__: type - __args__: Tuple[Any, ...] - __parameters__: Tuple[Any, ...] + @property + def __origin__(self) -> type: ... + @property + def __args__(self) -> tuple[Any, ...]: ... + @property + def __parameters__(self) -> tuple[Any, ...]: ... def __init__(self, origin: type, args: Any) -> None: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + if sys.version_info >= (3, 11): + @property + def __unpacked__(self) -> bool: ... + @property + def __typing_unpacked_tuple_args__(self) -> tuple[Any, ...] | None: ... + + # GenericAlias delegates attr access to `__origin__` + def __getattr__(self, name: str) -> Any: ... if sys.version_info >= (3, 10): @final class NoneType: def __bool__(self) -> Literal[False]: ... - EllipsisType = ellipsis # noqa F811 from builtins + EllipsisType = ellipsis # noqa: F821 from builtins from builtins import _NotImplementedType - NotImplementedType = _NotImplementedType # noqa F811 from builtins + NotImplementedType = _NotImplementedType @final class UnionType: - __args__: Tuple[Any, ...] - def __or__(self, obj: Any) -> UnionType: ... - def __ror__(self, obj: Any) -> UnionType: ... + @property + def __args__(self) -> tuple[Any, ...]: ... + def __or__(self, __obj: Any) -> UnionType: ... + def __ror__(self, __obj: Any) -> UnionType: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 4dc92e0..c9cfe30 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1,39 +1,160 @@ +import _typeshed import collections # Needed by aliases like DefaultDict, see mypy issue 2986 import sys +from _collections_abc import dict_items, dict_keys, dict_values +from _typeshed import IdentityFunction, Incomplete, SupportsKeysAndGetItem from abc import ABCMeta, abstractmethod -from types import BuiltinFunctionType, CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType -from typing_extensions import Literal as _Literal, ParamSpec as _ParamSpec +from contextlib import AbstractAsyncContextManager, AbstractContextManager +from re import Match as Match, Pattern as Pattern +from types import ( + BuiltinFunctionType, + CodeType, + FrameType, + FunctionType, + MethodDescriptorType, + MethodType, + MethodWrapperType, + ModuleType, + TracebackType, + WrapperDescriptorType, +) +from typing_extensions import Never as _Never, ParamSpec as _ParamSpec, final as _final + +__all__ = [ + "AbstractSet", + "Any", + "AnyStr", + "AsyncContextManager", + "AsyncGenerator", + "AsyncIterable", + "AsyncIterator", + "Awaitable", + "ByteString", + "Callable", + "ChainMap", + "ClassVar", + "Collection", + "Container", + "ContextManager", + "Coroutine", + "Counter", + "DefaultDict", + "Deque", + "Dict", + "FrozenSet", + "Generator", + "Generic", + "Hashable", + "ItemsView", + "Iterable", + "Iterator", + "KeysView", + "List", + "Mapping", + "MappingView", + "MutableMapping", + "MutableSequence", + "MutableSet", + "NamedTuple", + "NewType", + "Optional", + "Reversible", + "Sequence", + "Set", + "Sized", + "SupportsAbs", + "SupportsBytes", + "SupportsComplex", + "SupportsFloat", + "SupportsInt", + "SupportsRound", + "Text", + "Tuple", + "Type", + "TypeVar", + "Union", + "ValuesView", + "TYPE_CHECKING", + "cast", + "get_type_hints", + "no_type_check", + "no_type_check_decorator", + "overload", + "ForwardRef", + "NoReturn", + "OrderedDict", +] -if sys.version_info >= (3, 7): - from types import MethodDescriptorType, MethodWrapperType, WrapperDescriptorType +if sys.version_info >= (3, 8): + __all__ += [ + "Final", + "Literal", + "Protocol", + "SupportsIndex", + "TypedDict", + "final", + "get_args", + "get_origin", + "runtime_checkable", + ] if sys.version_info >= (3, 9): - from types import GenericAlias + __all__ += ["Annotated", "BinaryIO", "IO", "Match", "Pattern", "TextIO"] + +if sys.version_info >= (3, 10): + __all__ += ["Concatenate", "ParamSpec", "ParamSpecArgs", "ParamSpecKwargs", "TypeAlias", "TypeGuard", "is_typeddict"] + +if sys.version_info >= (3, 11): + __all__ += [ + "LiteralString", + "Never", + "NotRequired", + "Required", + "Self", + "TypeVarTuple", + "Unpack", + "assert_never", + "assert_type", + "clear_overloads", + "dataclass_transform", + "get_overloads", + "reveal_type", + ] -# Definitions of special type checking related constructs. Their definitions -# are not used, so their value does not matter. +ContextManager = AbstractContextManager +AsyncContextManager = AbstractAsyncContextManager + +# This itself is only available during type checking +def type_check_only(func_or_cls: _F) -> _F: ... Any = object() +@_final class TypeVar: __name__: str - __bound__: Type[Any] | None - __constraints__: Tuple[Type[Any], ...] + __bound__: Any | None + __constraints__: tuple[Any, ...] __covariant__: bool __contravariant__: bool def __init__( - self, - name: str, - *constraints: Type[Any], - bound: None | Type[Any] | str = ..., - covariant: bool = ..., - contravariant: bool = ..., + self, name: str, *constraints: Any, bound: Any | None = ..., covariant: bool = ..., contravariant: bool = ... ) -> None: ... + if sys.version_info >= (3, 10): + def __or__(self, right: Any) -> _SpecialForm: ... + def __ror__(self, left: Any) -> _SpecialForm: ... + if sys.version_info >= (3, 11): + def __typing_subst__(self, arg: Incomplete) -> Incomplete: ... +# Used for an undocumented mypy feature. Does not exist at runtime. _promote = object() +# N.B. Keep this definition in sync with typing_extensions._SpecialForm +@_final class _SpecialForm: - def __getitem__(self, typeargs: Any) -> object: ... + def __getitem__(self, parameters: Any) -> object: ... + if sys.version_info >= (3, 10): + def __or__(self, other: Any) -> _SpecialForm: ... + def __ror__(self, other: Any) -> _SpecialForm: ... _F = TypeVar("_F", bound=Callable[..., Any]) _P = _ParamSpec("_P") @@ -41,52 +162,83 @@ _T = TypeVar("_T") def overload(func: _F) -> _F: ... +# Unlike the vast majority module-level objects in stub files, +# these `_SpecialForm` objects in typing need the default value `= ...`, +# due to the fact that they are used elswhere in the same file. +# Otherwise, flake8 erroneously flags them as undefined. +# `_SpecialForm` objects in typing.py that are not used elswhere in the same file +# do not need the default value assignment. Union: _SpecialForm = ... -Optional: _SpecialForm = ... -Tuple: _SpecialForm = ... Generic: _SpecialForm = ... # Protocol is only present in 3.8 and later, but mypy needs it unconditionally Protocol: _SpecialForm = ... Callable: _SpecialForm = ... Type: _SpecialForm = ... +NoReturn: _SpecialForm = ... ClassVar: _SpecialForm = ... + +Optional: _SpecialForm +Tuple: _SpecialForm if sys.version_info >= (3, 8): - Final: _SpecialForm = ... + Final: _SpecialForm def final(f: _T) -> _T: ... - Literal: _SpecialForm = ... + Literal: _SpecialForm # TypedDict is a (non-subscriptable) special form. TypedDict: object -if sys.version_info < (3, 7): - class GenericMeta(type): ... +if sys.version_info >= (3, 11): + Self: _SpecialForm + Never: _SpecialForm = ... + Unpack: _SpecialForm + Required: _SpecialForm + NotRequired: _SpecialForm + LiteralString: _SpecialForm + + class TypeVarTuple: + __name__: str + def __init__(self, name: str) -> None: ... + def __iter__(self) -> Any: ... + def __typing_subst__(self, arg: Never) -> Never: ... + def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ... if sys.version_info >= (3, 10): class ParamSpecArgs: __origin__: ParamSpec def __init__(self, origin: ParamSpec) -> None: ... + class ParamSpecKwargs: __origin__: ParamSpec def __init__(self, origin: ParamSpec) -> None: ... + class ParamSpec: __name__: str - __bound__: Type[Any] | None + __bound__: Any | None __covariant__: bool __contravariant__: bool - def __init__( - self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ... - ) -> None: ... + def __init__(self, name: str, *, bound: Any | None = ..., contravariant: bool = ..., covariant: bool = ...) -> None: ... @property def args(self) -> ParamSpecArgs: ... @property def kwargs(self) -> ParamSpecKwargs: ... - Concatenate: _SpecialForm = ... - TypeAlias: _SpecialForm = ... - TypeGuard: _SpecialForm = ... + if sys.version_info >= (3, 11): + def __typing_subst__(self, arg: Incomplete) -> Incomplete: ... + def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ... + + def __or__(self, right: Any) -> _SpecialForm: ... + def __ror__(self, left: Any) -> _SpecialForm: ... + Concatenate: _SpecialForm + TypeAlias: _SpecialForm + TypeGuard: _SpecialForm + + class NewType: + def __init__(self, name: str, tp: Any) -> None: ... + def __call__(self, x: _T) -> _T: ... + def __or__(self, other: Any) -> _SpecialForm: ... + def __ror__(self, other: Any) -> _SpecialForm: ... + __supertype__: type -# Return type that indicates a function does not return. -# This type is equivalent to the None type, but the no-op Union is necessary to -# distinguish the None type from the None value. -NoReturn = Union[None] +else: + def NewType(name: str, tp: Any) -> Any: ... # These type variables are used by the container types. _S = TypeVar("_S") @@ -100,7 +252,7 @@ _T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant. _TC = TypeVar("_TC", bound=Type[object]) def no_type_check(arg: _F) -> _F: ... -def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore +def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore[misc] # Type aliases and type constructors @@ -117,14 +269,17 @@ Counter = _Alias() Deque = _Alias() ChainMap = _Alias() -if sys.version_info >= (3, 7): - OrderedDict = _Alias() +OrderedDict = _Alias() if sys.version_info >= (3, 9): - Annotated: _SpecialForm = ... + Annotated: _SpecialForm # Predefined type variables. -AnyStr = TypeVar("AnyStr", str, bytes) +AnyStr = TypeVar("AnyStr", str, bytes) # noqa: Y001 + +# Technically in 3.7 this inherited from GenericMeta. But let's not reflect that, since +# type checkers tend to assume that Protocols all have the ABCMeta metaclass. +class _ProtocolMeta(ABCMeta): ... # Abstract base classes. @@ -167,10 +322,10 @@ class SupportsRound(Protocol[_T_co]): def __round__(self) -> int: ... @overload @abstractmethod - def __round__(self, ndigits: int) -> _T_co: ... + def __round__(self, __ndigits: int) -> _T_co: ... @runtime_checkable -class Sized(Protocol, metaclass=ABCMeta): +class Sized(Protocol): @abstractmethod def __len__(self) -> int: ... @@ -250,8 +405,9 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]): @abstractmethod def close(self) -> None: ... -# NOTE: This type does not exist in typing.py or PEP 484. +# NOTE: This type does not exist in typing.py or PEP 484 but mypy needs it to exist. # The parameters correspond to Generator, but the 4th is the original type. +@type_check_only class AwaitableGenerator( Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta ): ... @@ -268,7 +424,6 @@ class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]): def __aiter__(self) -> AsyncIterator[_T_co]: ... class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]): - @abstractmethod def __anext__(self) -> Awaitable[_T_co]: ... @abstractmethod def asend(self, __value: _T_contra) -> Awaitable[_T_co]: ... @@ -280,10 +435,7 @@ class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]): @overload @abstractmethod def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ... - @abstractmethod def aclose(self) -> Awaitable[None]: ... - @abstractmethod - def __aiter__(self) -> AsyncGenerator[_T_co, _T_contra]: ... @property def ag_await(self) -> Any: ... @property @@ -295,28 +447,24 @@ class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]): @runtime_checkable class Container(Protocol[_T_co]): + # This is generic more on vibes than anything else @abstractmethod def __contains__(self, __x: object) -> bool: ... @runtime_checkable -class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]): - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... +class Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ... -_Collection = Collection[_T_co] - -class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]): +class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]): @overload @abstractmethod - def __getitem__(self, i: int) -> _T_co: ... + def __getitem__(self, index: int) -> _T_co: ... @overload @abstractmethod - def __getitem__(self, s: slice) -> Sequence[_T_co]: ... + def __getitem__(self, index: slice) -> Sequence[_T_co]: ... # Mixin methods def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ... def count(self, value: Any) -> int: ... - def __contains__(self, x: object) -> bool: ... + def __contains__(self, value: object) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... def __reversed__(self) -> Iterator[_T_co]: ... @@ -325,22 +473,22 @@ class MutableSequence(Sequence[_T], Generic[_T]): def insert(self, index: int, value: _T) -> None: ... @overload @abstractmethod - def __getitem__(self, i: int) -> _T: ... + def __getitem__(self, index: int) -> _T: ... @overload @abstractmethod - def __getitem__(self, s: slice) -> MutableSequence[_T]: ... + def __getitem__(self, index: slice) -> MutableSequence[_T]: ... @overload @abstractmethod - def __setitem__(self, i: int, o: _T) -> None: ... + def __setitem__(self, index: int, value: _T) -> None: ... @overload @abstractmethod - def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... + def __setitem__(self, index: slice, value: Iterable[_T]) -> None: ... @overload @abstractmethod - def __delitem__(self, i: int) -> None: ... + def __delitem__(self, index: int) -> None: ... @overload @abstractmethod - def __delitem__(self, i: slice) -> None: ... + def __delitem__(self, index: slice) -> None: ... # Mixin methods def append(self, value: _T) -> None: ... def clear(self) -> None: ... @@ -348,20 +496,21 @@ class MutableSequence(Sequence[_T], Generic[_T]): def reverse(self) -> None: ... def pop(self, index: int = ...) -> _T: ... def remove(self, value: _T) -> None: ... - def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ... + def __iadd__(self: _typeshed.Self, values: Iterable[_T]) -> _typeshed.Self: ... -class AbstractSet(_Collection[_T_co], Generic[_T_co]): +class AbstractSet(Collection[_T_co], Generic[_T_co]): @abstractmethod def __contains__(self, x: object) -> bool: ... + def _hash(self) -> int: ... # Mixin methods - def __le__(self, s: AbstractSet[Any]) -> bool: ... - def __lt__(self, s: AbstractSet[Any]) -> bool: ... - def __gt__(self, s: AbstractSet[Any]) -> bool: ... - def __ge__(self, s: AbstractSet[Any]) -> bool: ... - def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ... - def __or__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... - def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ... - def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... + def __le__(self, other: AbstractSet[Any]) -> bool: ... + def __lt__(self, other: AbstractSet[Any]) -> bool: ... + def __gt__(self, other: AbstractSet[Any]) -> bool: ... + def __ge__(self, other: AbstractSet[Any]) -> bool: ... + def __and__(self, other: AbstractSet[Any]) -> AbstractSet[_T_co]: ... + def __or__(self, other: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... + def __sub__(self, other: AbstractSet[Any]) -> AbstractSet[_T_co]: ... + def __xor__(self, other: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... def isdisjoint(self, other: Iterable[Any]) -> bool: ... class MutableSet(AbstractSet[_T], Generic[_T]): @@ -373,116 +522,122 @@ class MutableSet(AbstractSet[_T], Generic[_T]): def clear(self) -> None: ... def pop(self) -> _T: ... def remove(self, value: _T) -> None: ... - def __ior__(self, s: AbstractSet[_S]) -> MutableSet[_T | _S]: ... - def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ... - def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[_T | _S]: ... - def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ... + def __ior__(self: _typeshed.Self, it: AbstractSet[_T]) -> _typeshed.Self: ... # type: ignore[override,misc] + def __iand__(self: _typeshed.Self, it: AbstractSet[Any]) -> _typeshed.Self: ... + def __ixor__(self: _typeshed.Self, it: AbstractSet[_T]) -> _typeshed.Self: ... # type: ignore[override,misc] + def __isub__(self: _typeshed.Self, it: AbstractSet[Any]) -> _typeshed.Self: ... class MappingView(Sized): 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]): +class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... # undocumented - def __and__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ... - def __rand__(self, o: Iterable[_T]) -> Set[_T]: ... - def __contains__(self, o: object) -> bool: ... - def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ... + def __and__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... + def __rand__(self, other: Iterable[_T]) -> set[_T]: ... + def __contains__(self, item: object) -> bool: ... + def __iter__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... if sys.version_info >= (3, 8): - def __reversed__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ... - def __or__(self, o: Iterable[_T]) -> Set[Tuple[_KT_co, _VT_co] | _T]: ... - def __ror__(self, o: Iterable[_T]) -> Set[Tuple[_KT_co, _VT_co] | _T]: ... - def __sub__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ... - def __rsub__(self, o: Iterable[_T]) -> Set[_T]: ... - def __xor__(self, o: Iterable[_T]) -> Set[Tuple[_KT_co, _VT_co] | _T]: ... - def __rxor__(self, o: Iterable[_T]) -> Set[Tuple[_KT_co, _VT_co] | _T]: ... + def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... + + def __or__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __ror__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __sub__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... + def __rsub__(self, other: Iterable[_T]) -> set[_T]: ... + def __xor__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __rxor__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]): 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: ... + def __and__(self, other: Iterable[Any]) -> set[_KT_co]: ... + def __rand__(self, other: Iterable[_T]) -> set[_T]: ... + def __contains__(self, key: object) -> bool: ... def __iter__(self) -> Iterator[_KT_co]: ... if sys.version_info >= (3, 8): def __reversed__(self) -> Iterator[_KT_co]: ... - def __or__(self, o: Iterable[_T]) -> Set[_KT_co | _T]: ... - def __ror__(self, o: Iterable[_T]) -> Set[_KT_co | _T]: ... - def __sub__(self, o: Iterable[Any]) -> Set[_KT_co]: ... - def __rsub__(self, o: Iterable[_T]) -> Set[_T]: ... - def __xor__(self, o: Iterable[_T]) -> Set[_KT_co | _T]: ... - def __rxor__(self, o: Iterable[_T]) -> Set[_KT_co | _T]: ... - -class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): + + def __or__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... + def __ror__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... + def __sub__(self, other: Iterable[Any]) -> set[_KT_co]: ... + def __rsub__(self, other: Iterable[_T]) -> set[_T]: ... + def __xor__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... + def __rxor__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... + +class ValuesView(MappingView, Collection[_VT_co], Generic[_VT_co]): def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented - def __contains__(self, o: object) -> bool: ... + def __contains__(self, value: object) -> bool: ... def __iter__(self) -> Iterator[_VT_co]: ... if sys.version_info >= (3, 8): def __reversed__(self) -> Iterator[_VT_co]: ... -@runtime_checkable -class ContextManager(Protocol[_T_co]): - def __enter__(self) -> _T_co: ... - def __exit__( - self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None - ) -> bool | None: ... - -@runtime_checkable -class AsyncContextManager(Protocol[_T_co]): - def __aenter__(self) -> Awaitable[_T_co]: ... - def __aexit__( - self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> Awaitable[bool | None]: ... - -class Mapping(_Collection[_KT], Generic[_KT, _VT_co]): +class Mapping(Collection[_KT], Generic[_KT, _VT_co]): # TODO: We wish the key type could also be covariant, but that doesn't work, # see discussion in https://github.com/python/typing/pull/273. @abstractmethod - def __getitem__(self, k: _KT) -> _VT_co: ... + def __getitem__(self, __key: _KT) -> _VT_co: ... # Mixin methods @overload - def get(self, key: _KT) -> _VT_co | None: ... + def get(self, __key: _KT) -> _VT_co | None: ... @overload - def get(self, key: _KT, default: _VT_co | _T) -> _VT_co | _T: ... + def get(self, __key: _KT, default: _VT_co | _T) -> _VT_co | _T: ... def items(self) -> ItemsView[_KT, _VT_co]: ... def keys(self) -> KeysView[_KT]: ... def values(self) -> ValuesView[_VT_co]: ... - def __contains__(self, o: object) -> bool: ... + def __contains__(self, __o: object) -> bool: ... class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): @abstractmethod - def __setitem__(self, k: _KT, v: _VT) -> None: ... + def __setitem__(self, __key: _KT, __value: _VT) -> None: ... @abstractmethod - def __delitem__(self, v: _KT) -> None: ... + def __delitem__(self, __key: _KT) -> None: ... def clear(self) -> None: ... @overload - def pop(self, key: _KT) -> _VT: ... + def pop(self, __key: _KT) -> _VT: ... @overload - def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ... - def popitem(self) -> Tuple[_KT, _VT]: ... - def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + def pop(self, __key: _KT, default: _VT | _T) -> _VT | _T: ... + def popitem(self) -> tuple[_KT, _VT]: ... + # This overload should be allowed only if the value type is compatible with None. + # Keep OrderedDict.setdefault in line with MutableMapping.setdefault, modulo positional-only differences. + @overload + def setdefault(self: MutableMapping[_KT, _T | None], __key: _KT) -> _T | None: ... + @overload + def setdefault(self, __key: _KT, __default: _VT) -> _VT: ... # 'update' used to take a Union, but using overloading is better. # The second overloaded type here is a bit too general, because - # Mapping[Tuple[_KT, _VT], W] is a subclass of Iterable[Tuple[_KT, _VT]], + # Mapping[tuple[_KT, _VT], W] is a subclass of Iterable[tuple[_KT, _VT]], # but will always have the behavior of the first overloaded type - # at runtime, leading to keys of a mix of types _KT and Tuple[_KT, _VT]. + # at runtime, leading to keys of a mix of types _KT and tuple[_KT, _VT]. # We don't currently have any way of forcing all Mappings to use # the first overload, but by using overloading rather than a Union, # mypy will commit to using the first overload when the argument is # known to be a Mapping with unknown type parameters, which is closer # to the behavior we want. See mypy issue #1430. + # + # Various mapping classes have __ior__ methods that should be kept roughly in line with .update(): + # -- dict.__ior__ + # -- os._Environ.__ior__ + # -- collections.UserDict.__ior__ + # -- collections.ChainMap.__ior__ + # -- weakref.WeakValueDictionary.__ior__ + # -- weakref.WeakKeyDictionary.__ior__ @overload - def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... + def update(self, __m: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def update(self, __m: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ... @overload def update(self, **kwargs: _VT) -> None: ... Text = str -TYPE_CHECKING = True +TYPE_CHECKING: bool +# In stubs, the arguments of the IO class are marked as positional-only. +# This differs from runtime, but better reflects the fact that in reality +# classes deriving from IO use different names for the arguments. class IO(Iterator[AnyStr], Generic[AnyStr]): - # TODO use abstract properties + # At runtime these are all abstract properties, + # but making them abstract in the stub is hugely disruptive, for not much gain. + # See #8726 @property def mode(self) -> str: ... @property @@ -498,27 +653,27 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): @abstractmethod def isatty(self) -> bool: ... @abstractmethod - def read(self, n: int = ...) -> AnyStr: ... + def read(self, __n: int = ...) -> AnyStr: ... @abstractmethod def readable(self) -> bool: ... @abstractmethod - def readline(self, limit: int = ...) -> AnyStr: ... + def readline(self, __limit: int = ...) -> AnyStr: ... @abstractmethod - def readlines(self, hint: int = ...) -> list[AnyStr]: ... + def readlines(self, __hint: int = ...) -> list[AnyStr]: ... @abstractmethod - def seek(self, offset: int, whence: int = ...) -> int: ... + def seek(self, __offset: int, __whence: int = ...) -> int: ... @abstractmethod def seekable(self) -> bool: ... @abstractmethod def tell(self) -> int: ... @abstractmethod - def truncate(self, size: int | None = ...) -> int: ... + def truncate(self, __size: int | None = ...) -> int: ... @abstractmethod def writable(self) -> bool: ... @abstractmethod - def write(self, s: AnyStr) -> int: ... + def write(self, __s: AnyStr) -> int: ... @abstractmethod - def writelines(self, lines: Iterable[AnyStr]) -> None: ... + def writelines(self, __lines: Iterable[AnyStr]) -> None: ... @abstractmethod def __next__(self) -> AnyStr: ... @abstractmethod @@ -527,15 +682,15 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): def __enter__(self) -> IO[AnyStr]: ... @abstractmethod def __exit__( - self, t: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None - ) -> bool | None: ... + self, __t: Type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None + ) -> None: ... class BinaryIO(IO[bytes]): @abstractmethod def __enter__(self) -> BinaryIO: ... class TextIO(IO[str]): - # TODO use abstractproperty + # See comment regarding the @properties in the `IO` class @property def buffer(self) -> BinaryIO: ... @property @@ -551,89 +706,19 @@ class TextIO(IO[str]): class ByteString(Sequence[int], metaclass=ABCMeta): ... -class Match(Generic[AnyStr]): - pos: int - endpos: int - lastindex: int | None - lastgroup: AnyStr | None - string: AnyStr - - # The regular expression object whose match() or search() method produced - # this match instance. - re: Pattern[AnyStr] - def expand(self, template: AnyStr) -> AnyStr: ... - # group() returns "AnyStr" or "AnyStr | None", depending on the pattern. - @overload - def group(self, __group: _Literal[0] = ...) -> AnyStr: ... - @overload - def group(self, __group: str | int) -> AnyStr | Any: ... - @overload - def group(self, __group1: str | int, __group2: str | int, *groups: str | int) -> Tuple[AnyStr | Any, ...]: ... - # Each item of groups()'s return tuple is either "AnyStr" or - # "AnyStr | None", depending on the pattern. - @overload - def groups(self) -> Tuple[AnyStr | Any, ...]: ... - @overload - def groups(self, default: _T) -> Tuple[AnyStr | _T, ...]: ... - # Each value in groupdict()'s return dict is either "AnyStr" or - # "AnyStr | None", depending on the pattern. - @overload - def groupdict(self) -> dict[str, AnyStr | Any]: ... - @overload - def groupdict(self, default: _T) -> dict[str, AnyStr | _T]: ... - def start(self, __group: int | str = ...) -> int: ... - def end(self, __group: int | str = ...) -> int: ... - def span(self, __group: int | str = ...) -> Tuple[int, int]: ... - @property - def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented - # __getitem__() returns "AnyStr" or "AnyStr | None", depending on the pattern. - @overload - def __getitem__(self, __key: _Literal[0]) -> AnyStr: ... - @overload - def __getitem__(self, __key: int | str) -> AnyStr | Any: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... - -class Pattern(Generic[AnyStr]): - flags: int - groupindex: Mapping[str, int] - groups: int - pattern: AnyStr - def search(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ... - def match(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ... - def fullmatch(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ... - def split(self, string: AnyStr, maxsplit: int = ...) -> list[AnyStr]: ... - def findall(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> list[Any]: ... - def finditer(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Iterator[Match[AnyStr]]: ... - @overload - def sub(self, repl: AnyStr, string: AnyStr, count: int = ...) -> AnyStr: ... - @overload - def sub(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ...) -> AnyStr: ... - @overload - def subn(self, repl: AnyStr, string: AnyStr, count: int = ...) -> Tuple[AnyStr, int]: ... - @overload - def subn(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ...) -> Tuple[AnyStr, int]: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... - # Functions -if sys.version_info >= (3, 7): - _get_type_hints_obj_allowed_types = Union[ - object, - Callable[..., Any], - FunctionType, - BuiltinFunctionType, - MethodType, - ModuleType, - WrapperDescriptorType, - MethodWrapperType, - MethodDescriptorType, - ] -else: - _get_type_hints_obj_allowed_types = Union[ - object, Callable[..., Any], FunctionType, BuiltinFunctionType, MethodType, ModuleType, - ] +_get_type_hints_obj_allowed_types = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed + object + | Callable[..., Any] + | FunctionType + | BuiltinFunctionType + | MethodType + | ModuleType + | WrapperDescriptorType + | MethodWrapperType + | MethodDescriptorType +) if sys.version_info >= (3, 9): def get_type_hints( @@ -650,7 +735,7 @@ else: if sys.version_info >= (3, 8): def get_origin(tp: Any) -> Any | None: ... - def get_args(tp: Any) -> Tuple[Any, ...]: ... + def get_args(tp: Any) -> tuple[Any, ...]: ... @overload def cast(typ: Type[_T], val: Any) -> _T: ... @@ -659,16 +744,33 @@ def cast(typ: str, val: Any) -> Any: ... @overload def cast(typ: object, val: Any) -> Any: ... +if sys.version_info >= (3, 11): + def reveal_type(__obj: _T) -> _T: ... + def assert_never(__arg: Never) -> Never: ... + def assert_type(__val: _T, __typ: Any) -> _T: ... + def clear_overloads() -> None: ... + def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ... + def dataclass_transform( + *, + eq_default: bool = ..., + order_default: bool = ..., + kw_only_default: bool = ..., + field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ..., + **kwargs: Any, + ) -> IdentityFunction: ... + # Type constructors -# NamedTuple is special-cased in the type checker -class NamedTuple(Tuple[Any, ...]): - _field_types: collections.OrderedDict[str, Type[Any]] +class NamedTuple(tuple[Any, ...]): + if sys.version_info < (3, 8): + _field_types: collections.OrderedDict[str, type] + elif sys.version_info < (3, 9): + _field_types: dict[str, type] _field_defaults: dict[str, Any] - _fields: Tuple[str, ...] + _fields: tuple[str, ...] _source: str @overload - def __init__(self, typename: str, fields: Iterable[Tuple[str, Any]] = ...) -> None: ... + def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ... @overload def __init__(self, typename: str, fields: None = ..., **kwargs: Any) -> None: ... @classmethod @@ -677,45 +779,60 @@ class NamedTuple(Tuple[Any, ...]): def _asdict(self) -> dict[str, Any]: ... else: def _asdict(self) -> collections.OrderedDict[str, Any]: ... - def _replace(self: _T, **kwargs: Any) -> _T: ... + + def _replace(self: _typeshed.Self, **kwargs: Any) -> _typeshed.Self: ... # Internal mypy fallback type for all typed dicts (does not exist at runtime) +# N.B. Keep this mostly in sync with typing_extensions._TypedDict/mypy_extensions._TypedDict +@type_check_only class _TypedDict(Mapping[str, object], metaclass=ABCMeta): - def copy(self: _T) -> _T: ... - # Using NoReturn so that only calls using mypy plugin hook that specialize the signature + __total__: ClassVar[bool] + if sys.version_info >= (3, 9): + __required_keys__: ClassVar[frozenset[str]] + __optional_keys__: ClassVar[frozenset[str]] + def copy(self: _typeshed.Self) -> _typeshed.Self: ... + # Using Never so that only calls using mypy plugin hook that specialize the signature # can go through. - def setdefault(self, k: NoReturn, default: object) -> object: ... + def setdefault(self, k: _Never, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore + def pop(self, k: _Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] 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]: ... - -# This itself is only available during type checking -def type_check_only(func_or_cls: _F) -> _F: ... + def __delitem__(self, k: _Never) -> None: ... + def items(self) -> dict_items[str, object]: ... + def keys(self) -> dict_keys[str, object]: ... + def values(self) -> dict_values[str, object]: ... + if sys.version_info >= (3, 9): + def __or__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ... + def __ior__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ... + +@_final +class ForwardRef: + __forward_arg__: str + __forward_code__: CodeType + __forward_evaluated__: bool + __forward_value__: Any | None + __forward_is_argument__: bool + __forward_is_class__: bool + __forward_module__: Any | None + if sys.version_info >= (3, 9): + # The module and is_class arguments were added in later Python 3.9 versions. + def __init__(self, arg: str, is_argument: bool = ..., module: Any | None = ..., *, is_class: bool = ...) -> None: ... + else: + def __init__(self, arg: str, is_argument: bool = ...) -> None: ... -if sys.version_info >= (3, 7): - class ForwardRef: - __forward_arg__: str - __forward_code__: CodeType - __forward_evaluated__: bool - __forward_value__: Any | None - __forward_is_argument__: bool - if sys.version_info >= (3, 9): - # The module argument was added in Python 3.9.7. - def __init__(self, arg: str, is_argument: bool = ..., module: Any | None = ...) -> None: ... - else: - def __init__(self, arg: str, is_argument: bool = ...) -> None: ... + if sys.version_info >= (3, 9): + def _evaluate( + self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, recursive_guard: frozenset[str] + ) -> Any | None: ... + else: def _evaluate(self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None) -> Any | None: ... - def __eq__(self, other: Any) -> bool: ... - def __hash__(self) -> int: ... - def __repr__(self) -> str: ... + + def __eq__(self, other: object) -> bool: ... + if sys.version_info >= (3, 11): + def __or__(self, other: Any) -> _SpecialForm: ... + def __ror__(self, other: Any) -> _SpecialForm: ... if sys.version_info >= (3, 10): - def is_typeddict(tp: Any) -> bool: ... + def is_typeddict(tp: object) -> bool: ... + +def _type_repr(obj: object) -> str: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 59fe3df..df2c1c4 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -1,8 +1,14 @@ +import _typeshed import abc +import collections import sys -from typing import ( +import typing +from _collections_abc import dict_items, dict_keys, dict_values +from _typeshed import IdentityFunction, Incomplete +from collections.abc import Iterable +from typing import ( # noqa: Y022,Y027,Y039 TYPE_CHECKING as TYPE_CHECKING, - Any, + Any as Any, AsyncContextManager as AsyncContextManager, AsyncGenerator as AsyncGenerator, AsyncIterable as AsyncIterable, @@ -16,56 +22,130 @@ from typing import ( Counter as Counter, DefaultDict as DefaultDict, Deque as Deque, - ItemsView, - KeysView, Mapping, NewType as NewType, NoReturn as NoReturn, + Sequence, Text as Text, - Tuple, Type as Type, - TypeVar, - ValuesView, _Alias, overload as overload, + type_check_only, ) -_T = TypeVar("_T") -_F = TypeVar("_F", bound=Callable[..., Any]) -_TC = TypeVar("_TC", bound=Type[object]) +__all__ = [ + "Any", + "ClassVar", + "Concatenate", + "Final", + "LiteralString", + "ParamSpec", + "ParamSpecArgs", + "ParamSpecKwargs", + "Self", + "Type", + "TypeVar", + "TypeVarTuple", + "Unpack", + "Awaitable", + "AsyncIterator", + "AsyncIterable", + "Coroutine", + "AsyncGenerator", + "AsyncContextManager", + "ChainMap", + "ContextManager", + "Counter", + "Deque", + "DefaultDict", + "NamedTuple", + "OrderedDict", + "TypedDict", + "SupportsIndex", + "Annotated", + "assert_never", + "assert_type", + "dataclass_transform", + "final", + "IntVar", + "is_typeddict", + "Literal", + "NewType", + "overload", + "override", + "Protocol", + "reveal_type", + "runtime", + "runtime_checkable", + "Text", + "TypeAlias", + "TypeGuard", + "TYPE_CHECKING", + "Never", + "NoReturn", + "Required", + "NotRequired", + "clear_overloads", + "get_args", + "get_origin", + "get_overloads", + "get_type_hints", +] +_T = typing.TypeVar("_T") +_F = typing.TypeVar("_F", bound=Callable[..., Any]) +_TC = typing.TypeVar("_TC", bound=Type[object]) + +# unfortunately we have to duplicate this class definition from typing.pyi or we break pytype class _SpecialForm: - def __getitem__(self, typeargs: Any) -> Any: ... + def __getitem__(self, parameters: Any) -> object: ... + if sys.version_info >= (3, 10): + def __or__(self, other: Any) -> _SpecialForm: ... + def __ror__(self, other: Any) -> _SpecialForm: ... + +# Do not import (and re-export) Protocol or runtime_checkable from +# typing module because type checkers need to be able to distinguish +# typing.Protocol and typing_extensions.Protocol so they can properly +# warn users about potential runtime exceptions when using typing.Protocol +# on older versions of Python. +Protocol: _SpecialForm = ... def runtime_checkable(cls: _TC) -> _TC: ... # This alias for above is kept here for backwards compatibility. runtime = runtime_checkable -Protocol: _SpecialForm = ... -Final: _SpecialForm = ... +Final: _SpecialForm def final(f: _F) -> _F: ... -Literal: _SpecialForm = ... +Literal: _SpecialForm def IntVar(name: str) -> Any: ... # returns a new TypeVar # Internal mypy fallback type for all typed dicts (does not exist at runtime) +# N.B. Keep this mostly in sync with typing._TypedDict/mypy_extensions._TypedDict +@type_check_only class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): - def copy(self: _T) -> _T: ... - # Using NoReturn so that only calls using mypy plugin hook that specialize the signature + __required_keys__: ClassVar[frozenset[str]] + __optional_keys__: ClassVar[frozenset[str]] + __total__: ClassVar[bool] + def copy(self: _typeshed.Self) -> _typeshed.Self: ... + # Using Never so that only calls using mypy plugin hook that specialize the signature # can go through. - def setdefault(self, k: NoReturn, default: object) -> object: ... + def setdefault(self, k: Never, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore + def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] def update(self: _T, __m: _T) -> None: ... - def items(self) -> ItemsView[str, object]: ... - def keys(self) -> KeysView[str]: ... - def values(self) -> ValuesView[object]: ... - def __delitem__(self, k: NoReturn) -> None: ... + def items(self) -> dict_items[str, object]: ... + def keys(self) -> dict_keys[str, object]: ... + def values(self) -> dict_values[str, object]: ... + def __delitem__(self, k: Never) -> None: ... + if sys.version_info >= (3, 9): + def __or__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ... + def __ior__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ... # TypedDict is a (non-subscriptable) special form. -TypedDict: object = ... +TypedDict: object OrderedDict = _Alias() @@ -75,41 +155,157 @@ def get_type_hints( localns: dict[str, Any] | None = ..., include_extras: bool = ..., ) -> dict[str, Any]: ... +def get_args(tp: Any) -> tuple[Any, ...]: ... +def get_origin(tp: Any) -> Any | None: ... -if sys.version_info >= (3, 7): - def get_args(tp: Any) -> Tuple[Any, ...]: ... - def get_origin(tp: Any) -> Any | None: ... - -Annotated: _SpecialForm = ... -_AnnotatedAlias: Any = ... # undocumented +Annotated: _SpecialForm +_AnnotatedAlias: Any # undocumented @runtime_checkable class SupportsIndex(Protocol, metaclass=abc.ABCMeta): @abc.abstractmethod def __index__(self) -> int: ... -# PEP 612 support for Python < 3.9 +# New things in 3.10 if sys.version_info >= (3, 10): - from typing import Concatenate as Concatenate, ParamSpec as ParamSpec, TypeAlias as TypeAlias, TypeGuard as TypeGuard + from typing import ( + Concatenate as Concatenate, + ParamSpecArgs as ParamSpecArgs, + ParamSpecKwargs as ParamSpecKwargs, + TypeAlias as TypeAlias, + TypeGuard as TypeGuard, + is_typeddict as is_typeddict, + ) else: class ParamSpecArgs: __origin__: ParamSpec def __init__(self, origin: ParamSpec) -> None: ... + class ParamSpecKwargs: __origin__: ParamSpec def __init__(self, origin: ParamSpec) -> None: ... - class ParamSpec: - __name__: str - __bound__: Type[Any] | None - __covariant__: bool - __contravariant__: bool - def __init__( - self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ... - ) -> None: ... - @property - def args(self) -> ParamSpecArgs: ... - @property - def kwargs(self) -> ParamSpecKwargs: ... - Concatenate: _SpecialForm = ... - TypeAlias: _SpecialForm = ... - TypeGuard: _SpecialForm = ... + + Concatenate: _SpecialForm + TypeAlias: _SpecialForm + TypeGuard: _SpecialForm + def is_typeddict(tp: object) -> bool: ... + +# New things in 3.11 +# NamedTuples are not new, but the ability to create generic NamedTuples is new in 3.11 +if sys.version_info >= (3, 11): + from typing import ( + LiteralString as LiteralString, + NamedTuple as NamedTuple, + Never as Never, + NotRequired as NotRequired, + Required as Required, + Self as Self, + Unpack as Unpack, + assert_never as assert_never, + assert_type as assert_type, + clear_overloads as clear_overloads, + dataclass_transform as dataclass_transform, + get_overloads as get_overloads, + reveal_type as reveal_type, + ) +else: + Self: _SpecialForm + Never: _SpecialForm = ... + def reveal_type(__obj: _T) -> _T: ... + def assert_never(__arg: Never) -> Never: ... + def assert_type(__val: _T, __typ: Any) -> _T: ... + def clear_overloads() -> None: ... + def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ... + + Required: _SpecialForm + NotRequired: _SpecialForm + LiteralString: _SpecialForm + Unpack: _SpecialForm + + def dataclass_transform( + *, + eq_default: bool = ..., + order_default: bool = ..., + kw_only_default: bool = ..., + field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ..., + **kwargs: object, + ) -> IdentityFunction: ... + + class NamedTuple(tuple[Any, ...]): + if sys.version_info < (3, 8): + _field_types: collections.OrderedDict[str, type] + elif sys.version_info < (3, 9): + _field_types: dict[str, type] + _field_defaults: dict[str, Any] + _fields: tuple[str, ...] + _source: str + @overload + def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ... + @overload + def __init__(self, typename: str, fields: None = ..., **kwargs: Any) -> None: ... + @classmethod + def _make(cls: type[_typeshed.Self], iterable: Iterable[Any]) -> _typeshed.Self: ... + if sys.version_info >= (3, 8): + def _asdict(self) -> dict[str, Any]: ... + else: + def _asdict(self) -> collections.OrderedDict[str, Any]: ... + + def _replace(self: _typeshed.Self, **kwargs: Any) -> _typeshed.Self: ... + +# New things in 3.xx +# The `default` parameter was added to TypeVar, ParamSpec, and TypeVarTuple (PEP 696) +# The `infer_variance` parameter was added to TypeVar (PEP 695) +# typing_extensions.override (PEP 698) +@final +class TypeVar: + __name__: str + __bound__: Any | None + __constraints__: tuple[Any, ...] + __covariant__: bool + __contravariant__: bool + __default__: Any | None + def __init__( + self, + name: str, + *constraints: Any, + bound: Any | None = ..., + covariant: bool = ..., + contravariant: bool = ..., + default: Any | None = ..., + infer_variance: bool = ..., + ) -> None: ... + if sys.version_info >= (3, 10): + def __or__(self, right: Any) -> _SpecialForm: ... + def __ror__(self, left: Any) -> _SpecialForm: ... + if sys.version_info >= (3, 11): + def __typing_subst__(self, arg: Incomplete) -> Incomplete: ... + +@final +class ParamSpec: + __name__: str + __bound__: type[Any] | None + __covariant__: bool + __contravariant__: bool + __default__: type[Any] | None + def __init__( + self, + name: str, + *, + bound: None | type[Any] | str = ..., + contravariant: bool = ..., + covariant: bool = ..., + default: type[Any] | str | None = ..., + ) -> None: ... + @property + def args(self) -> ParamSpecArgs: ... + @property + def kwargs(self) -> ParamSpecKwargs: ... + +@final +class TypeVarTuple: + __name__: str + __default__: Any | None + def __init__(self, name: str, *, default: Any | None = ...) -> None: ... + def __iter__(self) -> Any: ... # Unpack[Self] + +def override(__arg: _F) -> _F: ... diff --git a/stdlib/unicodedata.pyi b/stdlib/unicodedata.pyi index 66c93f7..5a9aa0a 100644 --- a/stdlib/unicodedata.pyi +++ b/stdlib/unicodedata.pyi @@ -1,10 +1,14 @@ import sys +from _typeshed import ReadOnlyBuffer from typing import Any, TypeVar +from typing_extensions import final ucd_3_2_0: UCD -ucnhash_CAPI: Any unidata_version: str +if sys.version_info < (3, 10): + ucnhash_CAPI: Any + _T = TypeVar("_T") def bidirectional(__chr: str) -> str: ... @@ -18,13 +22,13 @@ def east_asian_width(__chr: str) -> str: ... if sys.version_info >= (3, 8): def is_normalized(__form: str, __unistr: str) -> bool: ... -def lookup(__name: str | bytes) -> str: ... +def lookup(__name: str | ReadOnlyBuffer) -> str: ... def mirrored(__chr: str) -> int: ... def name(__chr: str, __default: _T = ...) -> str | _T: ... def normalize(__form: str, __unistr: str) -> str: ... def numeric(__chr: str, __default: _T = ...) -> float | _T: ... - -class UCD(object): +@final +class UCD: # The methods below are constructed from the same array in C # (unicodedata_functions) and hence identical to the methods above. unidata_version: str @@ -35,7 +39,10 @@ class UCD(object): def decomposition(self, __chr: str) -> str: ... def digit(self, __chr: str, __default: _T = ...) -> int | _T: ... def east_asian_width(self, __chr: str) -> str: ... - def lookup(self, __name: str | bytes) -> str: ... + if sys.version_info >= (3, 8): + def is_normalized(self, __form: str, __unistr: str) -> bool: ... + + def lookup(self, __name: str | ReadOnlyBuffer) -> str: ... def mirrored(self, __chr: str) -> int: ... def name(self, __chr: str, __default: _T = ...) -> str | _T: ... def normalize(self, __form: str, __unistr: str) -> str: ... diff --git a/stdlib/unittest/__init__.pyi b/stdlib/unittest/__init__.pyi index 8f0ef89..33820c7 100644 --- a/stdlib/unittest/__init__.pyi +++ b/stdlib/unittest/__init__.pyi @@ -1,5 +1,4 @@ import sys -from unittest.async_case import * from .case import ( FunctionTestCase as FunctionTestCase, @@ -10,15 +9,61 @@ from .case import ( skipIf as skipIf, skipUnless as skipUnless, ) +from .loader import ( + TestLoader as TestLoader, + defaultTestLoader as defaultTestLoader, + findTestCases as findTestCases, + getTestCaseNames as getTestCaseNames, + makeSuite as makeSuite, +) +from .main import TestProgram as TestProgram, main as main +from .result import TestResult as TestResult +from .runner import TextTestResult as TextTestResult, TextTestRunner as TextTestRunner +from .signals import ( + installHandler as installHandler, + registerResult as registerResult, + removeHandler as removeHandler, + removeResult as removeResult, +) +from .suite import BaseTestSuite as BaseTestSuite, TestSuite as TestSuite if sys.version_info >= (3, 8): + from unittest.async_case import * + from .case import addModuleCleanup as addModuleCleanup -from unittest.loader import * -from unittest.main import * -from unittest.result import TestResult as TestResult -from unittest.runner import * -from unittest.signals import * -from unittest.suite import * +if sys.version_info >= (3, 11): + from .case import doModuleCleanups as doModuleCleanups, enterModuleContext as enterModuleContext + +__all__ = [ + "TestResult", + "TestCase", + "TestSuite", + "TextTestRunner", + "TestLoader", + "FunctionTestCase", + "main", + "defaultTestLoader", + "SkipTest", + "skip", + "skipIf", + "skipUnless", + "expectedFailure", + "TextTestResult", + "installHandler", + "registerResult", + "removeResult", + "removeHandler", + "getTestCaseNames", + "makeSuite", + "findTestCases", +] + +if sys.version_info >= (3, 8): + __all__ += ["addModuleCleanup", "IsolatedAsyncioTestCase"] + +if sys.version_info >= (3, 11): + __all__ += ["enterModuleContext", "doModuleCleanups"] def load_tests(loader: TestLoader, tests: TestSuite, pattern: str | None) -> TestSuite: ... +def __dir__() -> set[str]: ... diff --git a/stdlib/unittest/_log.pyi b/stdlib/unittest/_log.pyi new file mode 100644 index 0000000..4de5d50 --- /dev/null +++ b/stdlib/unittest/_log.pyi @@ -0,0 +1,28 @@ +import logging +import sys +from types import TracebackType +from typing import ClassVar, Generic, NamedTuple, TypeVar +from unittest.case import TestCase + +_L = TypeVar("_L", None, _LoggingWatcher) + +class _LoggingWatcher(NamedTuple): + records: list[logging.LogRecord] + output: list[str] + +class _AssertLogsContext(Generic[_L]): + LOGGING_FORMAT: ClassVar[str] + test_case: TestCase + logger_name: str + level: int + msg: None + if sys.version_info >= (3, 10): + def __init__(self, test_case: TestCase, logger_name: str, level: int, no_logs: bool) -> None: ... + no_logs: bool + else: + def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ... + + def __enter__(self) -> _L: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None + ) -> bool | None: ... diff --git a/stdlib/unittest/async_case.pyi b/stdlib/unittest/async_case.pyi index bdf534b..c1de205 100644 --- a/stdlib/unittest/async_case.pyi +++ b/stdlib/unittest/async_case.pyi @@ -1,10 +1,19 @@ import sys -from typing import Any, Awaitable, Callable +from collections.abc import Awaitable, Callable +from typing import TypeVar +from typing_extensions import ParamSpec from .case import TestCase -if sys.version_info >= (3, 8): - class IsolatedAsyncioTestCase(TestCase): - async def asyncSetUp(self) -> None: ... - async def asyncTearDown(self) -> None: ... - def addAsyncCleanup(self, __func: Callable[..., Awaitable[Any]], *args: Any, **kwargs: Any) -> None: ... +if sys.version_info >= (3, 11): + from contextlib import AbstractAsyncContextManager + +_T = TypeVar("_T") +_P = ParamSpec("_P") + +class IsolatedAsyncioTestCase(TestCase): + async def asyncSetUp(self) -> None: ... + async def asyncTearDown(self) -> None: ... + def addAsyncCleanup(self, __func: Callable[_P, Awaitable[object]], *args: _P.args, **kwargs: _P.kwargs) -> None: ... + if sys.version_info >= (3, 11): + async def enterAsyncContext(self, cm: AbstractAsyncContextManager[_T]) -> _T: ... diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index ebb1f24..c75539a 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -1,40 +1,76 @@ -import datetime import logging import sys import unittest.result -from _typeshed import Self -from collections.abc import Set +from _typeshed import Self, SupportsDunderGE, SupportsDunderGT, SupportsDunderLE, SupportsDunderLT, SupportsRSub, SupportsSub +from collections.abc import Callable, Container, Iterable, Mapping, Sequence, Set as AbstractSet +from contextlib import AbstractContextManager +from re import Pattern from types import TracebackType from typing import ( Any, AnyStr, - Callable, - Container, - ContextManager, + ClassVar, Generic, - Iterable, - Mapping, NamedTuple, NoReturn, - Pattern, - Sequence, - Tuple, - Type, + Protocol, + SupportsAbs, + SupportsRound, TypeVar, + Union, overload, ) +from typing_extensions import ParamSpec, TypeAlias from warnings import WarningMessage if sys.version_info >= (3, 9): from types import GenericAlias +if sys.version_info >= (3, 10): + from types import UnionType + +_T = TypeVar("_T") +_S = TypeVar("_S", bound=SupportsSub[Any, Any]) _E = TypeVar("_E", bound=BaseException) _FT = TypeVar("_FT", bound=Callable[..., Any]) +_P = ParamSpec("_P") + +DIFF_OMITTED: str + +class _BaseTestCaseContext: + def __init__(self, test_case: TestCase) -> None: ... + +if sys.version_info >= (3, 9): + from unittest._log import _AssertLogsContext, _LoggingWatcher +else: + # Unused dummy for _AssertLogsContext. Starting with Python 3.10, + # this is generic over the logging watcher, but in lower versions + # the watcher is hard-coded. + _L = TypeVar("_L") + + class _LoggingWatcher(NamedTuple): + records: list[logging.LogRecord] + output: list[str] + + class _AssertLogsContext(_BaseTestCaseContext, Generic[_L]): + LOGGING_FORMAT: ClassVar[str] + test_case: TestCase + logger_name: str + level: int + msg: None + def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ... + def __enter__(self) -> _LoggingWatcher: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> bool | None: ... if sys.version_info >= (3, 8): - def addModuleCleanup(__function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... + def addModuleCleanup(__function: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ... def doModuleCleanups() -> None: ... +if sys.version_info >= (3, 11): + def enterModuleContext(cm: AbstractContextManager[_T]) -> _T: ... + def expectedFailure(test_item: _FT) -> _FT: ... def skip(reason: str) -> Callable[[_FT], _FT]: ... def skipIf(condition: object, reason: str) -> Callable[[_FT], _FT]: ... @@ -43,8 +79,15 @@ def skipUnless(condition: object, reason: str) -> Callable[[_FT], _FT]: ... class SkipTest(Exception): def __init__(self, reason: str) -> None: ... +class _SupportsAbsAndDunderGE(SupportsDunderGE[Any], SupportsAbs[Any], Protocol): ... + +if sys.version_info >= (3, 10): + _IsInstanceClassInfo: TypeAlias = Union[type, UnionType, tuple[type | UnionType | tuple[Any, ...], ...]] +else: + _IsInstanceClassInfo: TypeAlias = Union[type, tuple[type | tuple[Any, ...], ...]] + class TestCase: - failureException: Type[BaseException] + failureException: type[BaseException] longMessage: bool maxDiff: int | None # undocumented @@ -52,6 +95,7 @@ class TestCase: # undocumented _testMethodDoc: str def __init__(self, methodName: str = ...) -> None: ... + def __eq__(self, other: object) -> bool: ... def setUp(self) -> None: ... def tearDown(self) -> None: ... @classmethod @@ -61,113 +105,159 @@ class TestCase: def run(self, result: unittest.result.TestResult | None = ...) -> unittest.result.TestResult | None: ... def __call__(self, result: unittest.result.TestResult | None = ...) -> unittest.result.TestResult | None: ... def skipTest(self, reason: Any) -> None: ... - def subTest(self, msg: Any = ..., **params: Any) -> ContextManager[None]: ... + def subTest(self, msg: Any = ..., **params: Any) -> AbstractContextManager[None]: ... def debug(self) -> None: ... - def _addSkip(self, result: unittest.result.TestResult, test_case: TestCase, reason: str) -> None: ... + if sys.version_info < (3, 11): + def _addSkip(self, result: unittest.result.TestResult, test_case: TestCase, reason: str) -> None: ... + def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... def assertNotEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... def assertTrue(self, expr: Any, msg: Any = ...) -> None: ... def assertFalse(self, expr: Any, msg: Any = ...) -> None: ... - def assertIs(self, expr1: Any, expr2: Any, msg: Any = ...) -> None: ... - def assertIsNot(self, expr1: Any, expr2: Any, msg: Any = ...) -> None: ... - def assertIsNone(self, obj: Any, msg: Any = ...) -> None: ... - def assertIsNotNone(self, obj: Any, msg: Any = ...) -> None: ... + def assertIs(self, expr1: object, expr2: object, msg: Any = ...) -> None: ... + def assertIsNot(self, expr1: object, expr2: object, msg: Any = ...) -> None: ... + def assertIsNone(self, obj: object, msg: Any = ...) -> None: ... + def assertIsNotNone(self, obj: object, msg: Any = ...) -> None: ... def assertIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = ...) -> None: ... def assertNotIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = ...) -> None: ... - def assertIsInstance(self, obj: Any, cls: type | Tuple[type, ...], msg: Any = ...) -> None: ... - def assertNotIsInstance(self, obj: Any, cls: type | Tuple[type, ...], msg: Any = ...) -> None: ... - def assertGreater(self, a: Any, b: Any, msg: Any = ...) -> None: ... - def assertGreaterEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ... - def assertLess(self, a: Any, b: Any, msg: Any = ...) -> None: ... - def assertLessEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ... + def assertIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = ...) -> None: ... + def assertNotIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = ...) -> None: ... + @overload + def assertGreater(self, a: SupportsDunderGT[_T], b: _T, msg: Any = ...) -> None: ... + @overload + def assertGreater(self, a: _T, b: SupportsDunderLT[_T], msg: Any = ...) -> None: ... + @overload + def assertGreaterEqual(self, a: SupportsDunderGE[_T], b: _T, msg: Any = ...) -> None: ... + @overload + def assertGreaterEqual(self, a: _T, b: SupportsDunderLE[_T], msg: Any = ...) -> None: ... + @overload + def assertLess(self, a: SupportsDunderLT[_T], b: _T, msg: Any = ...) -> None: ... + @overload + def assertLess(self, a: _T, b: SupportsDunderGT[_T], msg: Any = ...) -> None: ... + @overload + def assertLessEqual(self, a: SupportsDunderLT[_T], b: _T, msg: Any = ...) -> None: ... @overload - def assertRaises( # type: ignore + def assertLessEqual(self, a: _T, b: SupportsDunderGT[_T], msg: Any = ...) -> None: ... + # `assertRaises`, `assertRaisesRegex`, and `assertRaisesRegexp` + # are not using `ParamSpec` intentionally, + # because they might be used with explicitly wrong arg types to raise some error in tests. + @overload + def assertRaises( # type: ignore[misc] self, - expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...], + expected_exception: type[BaseException] | tuple[type[BaseException], ...], callable: Callable[..., Any], *args: Any, **kwargs: Any, ) -> None: ... @overload - def assertRaises(self, expected_exception: Type[_E] | Tuple[Type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ... + def assertRaises( + self, expected_exception: type[_E] | tuple[type[_E], ...], *, msg: Any = ... + ) -> _AssertRaisesContext[_E]: ... @overload - def assertRaisesRegex( # type: ignore + def assertRaisesRegex( # type: ignore[misc] self, - expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...], - expected_regex: str | bytes | Pattern[str] | Pattern[bytes], + expected_exception: type[BaseException] | tuple[type[BaseException], ...], + expected_regex: str | Pattern[str], callable: Callable[..., Any], *args: Any, **kwargs: Any, ) -> None: ... @overload def assertRaisesRegex( - self, - expected_exception: Type[_E] | Tuple[Type[_E], ...], - expected_regex: str | bytes | Pattern[str] | Pattern[bytes], - msg: Any = ..., + self, expected_exception: type[_E] | tuple[type[_E], ...], expected_regex: str | Pattern[str], *, msg: Any = ... ) -> _AssertRaisesContext[_E]: ... @overload - def assertWarns( # type: ignore - self, expected_warning: Type[Warning] | Tuple[Type[Warning], ...], callable: Callable[..., Any], *args: Any, **kwargs: Any + def assertWarns( # type: ignore[misc] + self, + expected_warning: type[Warning] | tuple[type[Warning], ...], + callable: Callable[_P, Any], + *args: _P.args, + **kwargs: _P.kwargs, ) -> None: ... @overload - def assertWarns(self, expected_warning: Type[Warning] | Tuple[Type[Warning], ...], msg: Any = ...) -> _AssertWarnsContext: ... + def assertWarns( + self, expected_warning: type[Warning] | tuple[type[Warning], ...], *, msg: Any = ... + ) -> _AssertWarnsContext: ... @overload - def assertWarnsRegex( # type: ignore + def assertWarnsRegex( # type: ignore[misc] self, - expected_warning: Type[Warning] | Tuple[Type[Warning], ...], - expected_regex: str | bytes | Pattern[str] | Pattern[bytes], - callable: Callable[..., Any], - *args: Any, - **kwargs: Any, + expected_warning: type[Warning] | tuple[type[Warning], ...], + expected_regex: str | Pattern[str], + callable: Callable[_P, Any], + *args: _P.args, + **kwargs: _P.kwargs, ) -> None: ... @overload def assertWarnsRegex( - self, - expected_warning: Type[Warning] | Tuple[Type[Warning], ...], - expected_regex: str | bytes | Pattern[str] | Pattern[bytes], - msg: Any = ..., + self, expected_warning: type[Warning] | tuple[type[Warning], ...], expected_regex: str | Pattern[str], *, msg: Any = ... ) -> _AssertWarnsContext: ... - def assertLogs(self, logger: str | logging.Logger | None = ..., level: int | str | None = ...) -> _AssertLogsContext: ... + def assertLogs( + self, logger: str | logging.Logger | None = ..., level: int | str | None = ... + ) -> _AssertLogsContext[_LoggingWatcher]: ... + if sys.version_info >= (3, 10): + def assertNoLogs( + self, logger: str | logging.Logger | None = ..., level: int | str | None = ... + ) -> _AssertLogsContext[None]: ... + + @overload + def assertAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload def assertAlmostEqual( - self, first: float, second: float, places: int | None = ..., msg: Any = ..., delta: float | None = ... + self, first: _S, second: _S, places: None = ..., msg: Any = ..., *, delta: _SupportsAbsAndDunderGE + ) -> None: ... + @overload + def assertAlmostEqual( + self, + first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], + second: _T, + places: int | None = ..., + msg: Any = ..., + delta: None = ..., ) -> None: ... @overload def assertAlmostEqual( self, - first: datetime.datetime, - second: datetime.datetime, + first: _T, + second: SupportsRSub[_T, SupportsAbs[SupportsRound[object]]], places: int | None = ..., msg: Any = ..., - delta: datetime.timedelta | None = ..., + delta: None = ..., ) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ...) -> None: ... + def assertNotAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, places: int | None = ..., msg: Any = ...) -> None: ... + def assertNotAlmostEqual( + self, first: _S, second: _S, places: None = ..., msg: Any = ..., *, delta: _SupportsAbsAndDunderGE + ) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float | None = ...) -> None: ... + def assertNotAlmostEqual( + self, + first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], + second: _T, + places: int | None = ..., + msg: Any = ..., + delta: None = ..., + ) -> None: ... @overload def assertNotAlmostEqual( self, - first: datetime.datetime, - second: datetime.datetime, + first: _T, + second: SupportsRSub[_T, SupportsAbs[SupportsRound[object]]], places: int | None = ..., msg: Any = ..., - delta: datetime.timedelta | None = ..., + delta: None = ..., ) -> None: ... def assertRegex(self, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... def assertNotRegex(self, text: AnyStr, unexpected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], msg: Any = ...) -> None: ... - def addTypeEqualityFunc(self, typeobj: Type[Any], function: Callable[..., None]) -> None: ... + def addTypeEqualityFunc(self, typeobj: type[Any], function: Callable[..., None]) -> None: ... def assertMultiLineEqual(self, first: str, second: str, msg: Any = ...) -> None: ... def assertSequenceEqual( - self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = ..., seq_type: Type[Sequence[Any]] | None = ... + self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = ..., seq_type: type[Sequence[Any]] | None = ... ) -> None: ... def assertListEqual(self, list1: list[Any], list2: list[Any], msg: Any = ...) -> None: ... - def assertTupleEqual(self, tuple1: Tuple[Any, ...], tuple2: Tuple[Any, ...], msg: Any = ...) -> None: ... - def assertSetEqual(self, set1: Set[object], set2: Set[object], msg: Any = ...) -> None: ... + def assertTupleEqual(self, tuple1: tuple[Any, ...], tuple2: tuple[Any, ...], msg: Any = ...) -> None: ... + def assertSetEqual(self, set1: AbstractSet[object], set2: AbstractSet[object], msg: Any = ...) -> None: ... def assertDictEqual(self, d1: Mapping[Any, object], d2: Mapping[Any, object], msg: Any = ...) -> None: ... def fail(self, msg: Any = ...) -> NoReturn: ... def countTestCases(self) -> int: ... @@ -175,80 +265,61 @@ class TestCase: def id(self) -> str: ... def shortDescription(self) -> str | None: ... if sys.version_info >= (3, 8): - def addCleanup(self, __function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... + def addCleanup(self, __function: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ... else: - def addCleanup(self, function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... + def addCleanup(self, function: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ... + + if sys.version_info >= (3, 11): + def enterContext(self, cm: AbstractContextManager[_T]) -> _T: ... + def doCleanups(self) -> None: ... if sys.version_info >= (3, 8): @classmethod - def addClassCleanup(cls, __function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... + def addClassCleanup(cls, __function: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ... @classmethod def doClassCleanups(cls) -> None: ... + + if sys.version_info >= (3, 11): + @classmethod + def enterClassContext(cls, cm: AbstractContextManager[_T]) -> _T: ... + def _formatMessage(self, msg: str | None, standardMsg: str) -> str: ... # undocumented def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented - # below is deprecated - def failUnlessEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def assertEquals(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def failIfEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def assertNotEquals(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def failUnless(self, expr: bool, msg: Any = ...) -> None: ... - def assert_(self, expr: bool, msg: Any = ...) -> None: ... - def failIf(self, expr: bool, msg: Any = ...) -> None: ... - @overload - def failUnlessRaises( # type: ignore - self, - exception: Type[BaseException] | Tuple[Type[BaseException], ...], - callable: Callable[..., Any] = ..., - *args: Any, - **kwargs: Any, - ) -> None: ... - @overload - def failUnlessRaises(self, exception: Type[_E] | Tuple[Type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ... - def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... - def assertAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ...) -> None: ... - def failIfAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... - def assertNotAlmostEquals( - self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ... - ) -> None: ... - def assertRegexpMatches(self, text: AnyStr, regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... - def assertNotRegexpMatches(self, text: AnyStr, regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... - @overload - def assertRaisesRegexp( # type: ignore - self, - exception: Type[BaseException] | Tuple[Type[BaseException], ...], - expected_regex: str | bytes | Pattern[str] | Pattern[bytes], - callable: Callable[..., Any], - *args: Any, - **kwargs: Any, - ) -> None: ... - @overload - def assertRaisesRegexp( - self, - exception: Type[_E] | Tuple[Type[_E], ...], - expected_regex: str | bytes | Pattern[str] | Pattern[bytes], - msg: Any = ..., - ) -> _AssertRaisesContext[_E]: ... - def assertDictContainsSubset(self, subset: Mapping[Any, Any], dictionary: Mapping[Any, Any], msg: object = ...) -> None: ... + if sys.version_info < (3, 12): + failUnlessEqual = assertEqual + assertEquals = assertEqual + failIfEqual = assertNotEqual + assertNotEquals = assertNotEqual + failUnless = assertTrue + assert_ = assertTrue + failIf = assertFalse + failUnlessRaises = assertRaises + failUnlessAlmostEqual = assertAlmostEqual + assertAlmostEquals = assertAlmostEqual + failIfAlmostEqual = assertNotAlmostEqual + assertNotAlmostEquals = assertNotAlmostEqual + assertRegexpMatches = assertRegex + assertNotRegexpMatches = assertNotRegex + assertRaisesRegexp = assertRaisesRegex + def assertDictContainsSubset( + self, subset: Mapping[Any, Any], dictionary: Mapping[Any, Any], msg: object = ... + ) -> None: ... class FunctionTestCase(TestCase): def __init__( self, - testFunc: Callable[[], None], - setUp: Callable[[], None] | None = ..., - tearDown: Callable[[], None] | None = ..., + testFunc: Callable[[], Any], + setUp: Callable[[], Any] | None = ..., + tearDown: Callable[[], Any] | None = ..., description: str | None = ..., ) -> None: ... def runTest(self) -> None: ... -class _LoggingWatcher(NamedTuple): - records: list[logging.LogRecord] - output: list[str] - class _AssertRaisesContext(Generic[_E]): exception: _E def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None ) -> bool: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -260,18 +331,5 @@ class _AssertWarnsContext: warnings: list[WarningMessage] def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None ) -> None: ... - -class _AssertLogsContext: - LOGGING_FORMAT: str - records: list[logging.LogRecord] - output: list[str] - def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ... - if sys.version_info >= (3, 10): - def __enter__(self) -> _LoggingWatcher | None: ... - else: - def __enter__(self) -> _LoggingWatcher: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index d3cb4ce..a1b902e 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -1,46 +1,40 @@ -import sys import unittest.case -import unittest.result import unittest.suite +from collections.abc import Callable, Sequence +from re import Pattern from types import ModuleType -from typing import Any, Callable, List, Sequence, Type +from typing import Any +from typing_extensions import TypeAlias -_SortComparisonMethod = Callable[[str, str], int] -_SuiteClass = Callable[[List[unittest.case.TestCase]], unittest.suite.TestSuite] +_SortComparisonMethod: TypeAlias = Callable[[str, str], int] +_SuiteClass: TypeAlias = Callable[[list[unittest.case.TestCase]], unittest.suite.TestSuite] + +VALID_MODULE_NAME: Pattern[str] class TestLoader: - errors: list[Type[BaseException]] + errors: list[type[BaseException]] testMethodPrefix: str sortTestMethodsUsing: _SortComparisonMethod - - if sys.version_info >= (3, 7): - testNamePatterns: list[str] | None - + testNamePatterns: list[str] | None suiteClass: _SuiteClass - def loadTestsFromTestCase(self, testCaseClass: Type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ... + def loadTestsFromTestCase(self, testCaseClass: type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ... def loadTestsFromModule(self, module: ModuleType, *args: Any, pattern: Any = ...) -> unittest.suite.TestSuite: ... def loadTestsFromName(self, name: str, module: ModuleType | None = ...) -> unittest.suite.TestSuite: ... def loadTestsFromNames(self, names: Sequence[str], module: ModuleType | None = ...) -> unittest.suite.TestSuite: ... - def getTestCaseNames(self, testCaseClass: Type[unittest.case.TestCase]) -> Sequence[str]: ... + def getTestCaseNames(self, testCaseClass: type[unittest.case.TestCase]) -> Sequence[str]: ... def discover(self, start_dir: str, pattern: str = ..., top_level_dir: str | None = ...) -> unittest.suite.TestSuite: ... + def _match_path(self, path: str, full_path: str, pattern: str) -> bool: ... defaultTestLoader: TestLoader -if sys.version_info >= (3, 7): - def getTestCaseNames( - testCaseClass: Type[unittest.case.TestCase], - prefix: str, - sortUsing: _SortComparisonMethod = ..., - testNamePatterns: list[str] | None = ..., - ) -> Sequence[str]: ... - -else: - def getTestCaseNames( - testCaseClass: Type[unittest.case.TestCase], prefix: str, sortUsing: _SortComparisonMethod = ... - ) -> Sequence[str]: ... - +def getTestCaseNames( + testCaseClass: type[unittest.case.TestCase], + prefix: str, + sortUsing: _SortComparisonMethod = ..., + testNamePatterns: list[str] | None = ..., +) -> Sequence[str]: ... def makeSuite( - testCaseClass: Type[unittest.case.TestCase], + testCaseClass: type[unittest.case.TestCase], prefix: str = ..., sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ..., diff --git a/stdlib/unittest/main.pyi b/stdlib/unittest/main.pyi index cd887ce..915d559 100644 --- a/stdlib/unittest/main.pyi +++ b/stdlib/unittest/main.pyi @@ -1,10 +1,13 @@ -import sys import unittest.case import unittest.loader import unittest.result import unittest.suite +from collections.abc import Iterable from types import ModuleType -from typing import Any, Iterable, Protocol, Type +from typing import Any, Protocol + +MAIN_EXAMPLES: str +MODULE_EXAMPLES: str class _TestRunner(Protocol): def run(self, test: unittest.suite.TestSuite | unittest.case.TestCase) -> unittest.result.TestResult: ... @@ -19,15 +22,13 @@ class TestProgram: buffer: bool | None progName: str | None warnings: str | None - - if sys.version_info >= (3, 7): - testNamePatterns: list[str] | None + testNamePatterns: list[str] | None def __init__( self, module: None | str | ModuleType = ..., defaultTest: str | Iterable[str] | None = ..., argv: list[str] | None = ..., - testRunner: Type[_TestRunner] | _TestRunner | None = ..., + testRunner: type[_TestRunner] | _TestRunner | None = ..., testLoader: unittest.loader.TestLoader = ..., exit: bool = ..., verbosity: int = ..., @@ -40,10 +41,7 @@ class TestProgram: ) -> None: ... def usageExit(self, msg: Any = ...) -> None: ... def parseArgs(self, argv: list[str]) -> None: ... - if sys.version_info >= (3, 7): - def createTests(self, from_discovery: bool = ..., Loader: unittest.loader.TestLoader | None = ...) -> None: ... - else: - def createTests(self) -> None: ... + def createTests(self, from_discovery: bool = ..., Loader: unittest.loader.TestLoader | None = ...) -> None: ... def runTests(self) -> None: ... # undocumented main = TestProgram diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 5b3816d..6c58f38 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -1,84 +1,113 @@ import sys -from typing import Any, Callable, Generic, Iterable, List, Mapping, Sequence, Tuple, Type, TypeVar, overload +from _typeshed import Self +from collections.abc import Awaitable, Callable, Iterable, Mapping, Sequence +from contextlib import _GeneratorContextManager +from types import TracebackType +from typing import Any, Generic, TypeVar, overload +from typing_extensions import Literal, TypeAlias _T = TypeVar("_T") -_TT = TypeVar("_TT", bound=Type[Any]) +_TT = TypeVar("_TT", bound=type[Any]) _R = TypeVar("_R") -__all__ = [ - "Mock", - "MagicMock", - "patch", - "sentinel", - "DEFAULT", - "ANY", - "call", - "create_autospec", - "AsyncMock", - "FILTER_DIR", - "NonCallableMock", - "NonCallableMagicMock", - "mock_open", - "PropertyMock", - "seal", -] +if sys.version_info >= (3, 8): + __all__ = ( + "Mock", + "MagicMock", + "patch", + "sentinel", + "DEFAULT", + "ANY", + "call", + "create_autospec", + "AsyncMock", + "FILTER_DIR", + "NonCallableMock", + "NonCallableMagicMock", + "mock_open", + "PropertyMock", + "seal", + ) +else: + __all__ = ( + "Mock", + "MagicMock", + "patch", + "sentinel", + "DEFAULT", + "ANY", + "call", + "create_autospec", + "FILTER_DIR", + "NonCallableMock", + "NonCallableMagicMock", + "mock_open", + "PropertyMock", + "seal", + ) + __version__: str FILTER_DIR: Any -class _slotted: ... - class _SentinelObject: name: Any def __init__(self, name: Any) -> None: ... class _Sentinel: - def __init__(self) -> None: ... def __getattr__(self, name: str) -> Any: ... sentinel: Any DEFAULT: Any -class _Call(Tuple[Any, ...]): +_ArgsKwargs: TypeAlias = tuple[tuple[Any, ...], Mapping[str, Any]] +_NameArgsKwargs: TypeAlias = tuple[str, tuple[Any, ...], Mapping[str, Any]] +_CallValue: TypeAlias = str | tuple[Any, ...] | Mapping[str, Any] | _ArgsKwargs | _NameArgsKwargs + +class _Call(tuple[Any, ...]): def __new__( - cls, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ... - ) -> Any: ... + cls: type[Self], + value: _CallValue = ..., + name: str | None = ..., + parent: Any | None = ..., + two: bool = ..., + from_kall: bool = ..., + ) -> Self: ... name: Any parent: Any from_kall: Any def __init__( - self, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ... + self, value: _CallValue = ..., name: str | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ... ) -> None: ... - def __eq__(self, other: Any) -> bool: ... - __ne__: Any + def __eq__(self, other: object) -> bool: ... + def __ne__(self, __other: object) -> bool: ... def __call__(self, *args: Any, **kwargs: Any) -> _Call: ... def __getattr__(self, attr: Any) -> Any: ... - def count(self, *args: Any, **kwargs: Any) -> Any: ... - def index(self, *args: Any, **kwargs: Any) -> Any: ... + def __getattribute__(self, attr: str) -> Any: ... + if sys.version_info >= (3, 8): + @property + def args(self) -> tuple[Any, ...]: ... + @property + def kwargs(self) -> Mapping[str, Any]: ... + def call_list(self) -> Any: ... call: _Call -class _CallList(List[_Call]): +class _CallList(list[_Call]): def __contains__(self, value: Any) -> bool: ... -class _MockIter: - obj: Any - def __init__(self, obj: Any) -> None: ... - def __iter__(self) -> Any: ... - def __next__(self) -> Any: ... - class Base: def __init__(self, *args: Any, **kwargs: Any) -> None: ... -class NonCallableMock(Base, Any): # type: ignore - def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ... +class NonCallableMock(Base, Any): + def __new__(__cls: type[Self], *args: Any, **kw: Any) -> Self: ... def __init__( self, - spec: list[str] | object | Type[object] | None = ..., + spec: list[str] | object | type[object] | None = ..., wraps: Any | None = ..., name: str | None = ..., - spec_set: list[str] | object | Type[object] | None = ..., + spec_set: list[str] | object | type[object] | None = ..., parent: NonCallableMock | None = ..., _spec_state: Any | None = ..., _new_name: str = ..., @@ -89,6 +118,9 @@ class NonCallableMock(Base, Any): # type: ignore **kwargs: Any, ) -> None: ... def __getattr__(self, name: str) -> Any: ... + def __delattr__(self, name: str) -> None: ... + def __setattr__(self, name: str, value: Any) -> None: ... + def __dir__(self) -> list[str]: ... if sys.version_info >= (3, 8): def _calls_repr(self, prefix: str = ...) -> str: ... def assert_called_with(self, *args: Any, **kwargs: Any) -> None: ... @@ -106,10 +138,10 @@ class NonCallableMock(Base, Any): # type: ignore else: def assert_called(_mock_self) -> None: ... def assert_called_once(_mock_self) -> None: ... + def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ... - if sys.version_info >= (3, 7): - def _extract_mock_name(self) -> str: ... - def _get_call_signature_from_name(self, name: str) -> Any: ... + def _extract_mock_name(self) -> str: ... + def _get_call_signature_from_name(self, name: str) -> Any: ... def assert_any_call(self, *args: Any, **kwargs: Any) -> None: ... def assert_has_calls(self, calls: Sequence[_Call], any_order: bool = ...) -> None: ... def mock_add_spec(self, spec: Any, spec_set: bool = ...) -> None: ... @@ -124,7 +156,7 @@ class NonCallableMock(Base, Any): # type: ignore call_args_list: _CallList mock_calls: _CallList def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ... - def _call_matcher(self, _call: Tuple[_Call, ...]) -> _Call: ... + def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call: ... def _get_child_mock(self, **kw: Any) -> NonCallableMock: ... class CallableMixin(Base): @@ -143,7 +175,10 @@ class CallableMixin(Base): _new_parent: Any | None = ..., **kwargs: Any, ) -> None: ... - def __call__(_mock_self, *args: Any, **kwargs: Any) -> Any: ... + if sys.version_info >= (3, 8): + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + else: + def __call__(_mock_self, *args: Any, **kwargs: Any) -> Any: ... class Mock(CallableMixin, NonCallableMock): ... @@ -162,31 +197,58 @@ class _patch(Generic[_T]): additional_patchers: Any # If new==DEFAULT, self is _patch[Any]. Ideally we'd be able to add an overload for it so that self is _patch[MagicMock], # but that's impossible with the current type system. - def __init__( - self: _patch[_T], - getter: Callable[[], Any], - attribute: str, - new: _T, - spec: Any | None, - create: bool, - spec_set: Any | None, - autospec: Any | None, - new_callable: Any | None, - kwargs: Mapping[str, Any], - ) -> None: ... + if sys.version_info >= (3, 10): + def __init__( + self: _patch[_T], + getter: Callable[[], Any], + attribute: str, + new: _T, + spec: Any | None, + create: bool, + spec_set: Any | None, + autospec: Any | None, + new_callable: Any | None, + kwargs: Mapping[str, Any], + *, + unsafe: bool = ..., + ) -> None: ... + else: + def __init__( + self: _patch[_T], + getter: Callable[[], Any], + attribute: str, + new: _T, + spec: Any | None, + create: bool, + spec_set: Any | None, + autospec: Any | None, + new_callable: Any | None, + kwargs: Mapping[str, Any], + ) -> None: ... + def copy(self) -> _patch[_T]: ... @overload def __call__(self, func: _TT) -> _TT: ... @overload def __call__(self, func: Callable[..., _R]) -> Callable[..., _R]: ... + if sys.version_info >= (3, 8): + def decoration_helper( + self, patched: _patch[Any], args: Sequence[Any], keywargs: Any + ) -> _GeneratorContextManager[tuple[Sequence[Any], Any]]: ... + def decorate_class(self, klass: _TT) -> _TT: ... def decorate_callable(self, func: Callable[..., _R]) -> Callable[..., _R]: ... - def get_original(self) -> Tuple[Any, bool]: ... + if sys.version_info >= (3, 8): + def decorate_async_callable(self, func: Callable[..., Awaitable[_R]]) -> Callable[..., Awaitable[_R]]: ... + + def get_original(self) -> tuple[Any, bool]: ... target: Any temp_original: Any is_local: bool def __enter__(self) -> _T: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> None: ... def start(self) -> _T: ... def stop(self) -> None: ... @@ -198,122 +260,73 @@ class _patch_dict: def __call__(self, f: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, *args: Any) -> Any: ... + def __exit__(self, *args: object) -> Any: ... start: Any stop: Any +if sys.version_info >= (3, 8): + _Mock: TypeAlias = MagicMock | AsyncMock +else: + _Mock: TypeAlias = MagicMock + class _patcher: TEST_PREFIX: str - dict: Type[_patch_dict] - if sys.version_info >= (3, 8): - # This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any]. - # Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock], - # but that's impossible with the current type system. - @overload - def __call__( # type: ignore - self, - target: Any, - new: _T, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[_T]: ... - @overload - def __call__( # type: ignore - self, - target: Any, - *, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[MagicMock | AsyncMock]: ... - else: - @overload - def __call__( # type: ignore - self, - target: Any, - new: _T, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[_T]: ... - @overload - def __call__( # type: ignore - self, - target: Any, - *, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[MagicMock]: ... - if sys.version_info >= (3, 8): - @overload - def object( # type: ignore - self, - target: Any, - attribute: str, - new: _T, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[_T]: ... - @overload - def object( # type: ignore - self, - target: Any, - attribute: str, - *, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[MagicMock | AsyncMock]: ... - else: - @overload - def object( # type: ignore - self, - target: Any, - attribute: str, - new: _T, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[_T]: ... - @overload - def object( # type: ignore - self, - target: Any, - attribute: str, - *, - spec: Any | None = ..., - create: bool = ..., - spec_set: Any | None = ..., - autospec: Any | None = ..., - new_callable: Any | None = ..., - **kwargs: Any, - ) -> _patch[MagicMock]: ... - def multiple( + dict: type[_patch_dict] + # This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any]. + # Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock], + # but that's impossible with the current type system. + @overload + def __call__( # type: ignore[misc] self, + target: str, + new: _T, + spec: Any | None = ..., + create: bool = ..., + spec_set: Any | None = ..., + autospec: Any | None = ..., + new_callable: Any | None = ..., + **kwargs: Any, + ) -> _patch[_T]: ... + @overload + def __call__( + self, + target: str, + *, + spec: Any | None = ..., + create: bool = ..., + spec_set: Any | None = ..., + autospec: Any | None = ..., + new_callable: Any | None = ..., + **kwargs: Any, + ) -> _patch[_Mock]: ... + @overload + @staticmethod + def object( # type: ignore[misc] + target: Any, + attribute: str, + new: _T, + spec: Any | None = ..., + create: bool = ..., + spec_set: Any | None = ..., + autospec: Any | None = ..., + new_callable: Any | None = ..., + **kwargs: Any, + ) -> _patch[_T]: ... + @overload + @staticmethod + def object( + target: Any, + attribute: str, + *, + spec: Any | None = ..., + create: bool = ..., + spec_set: Any | None = ..., + autospec: Any | None = ..., + new_callable: Any | None = ..., + **kwargs: Any, + ) -> _patch[_Mock]: ... + @staticmethod + def multiple( target: Any, spec: Any | None = ..., create: bool = ..., @@ -322,18 +335,16 @@ class _patcher: new_callable: Any | None = ..., **kwargs: Any, ) -> _patch[Any]: ... - def stopall(self) -> None: ... + @staticmethod + def stopall() -> None: ... patch: _patcher class MagicMixin: def __init__(self, *args: Any, **kw: Any) -> None: ... -class NonCallableMagicMock(MagicMixin, NonCallableMock): - def mock_add_spec(self, spec: Any, spec_set: bool = ...) -> None: ... - -class MagicMock(MagicMixin, Mock): - def mock_add_spec(self, spec: Any, spec_set: bool = ...) -> None: ... +class NonCallableMagicMock(MagicMixin, NonCallableMock): ... +class MagicMock(MagicMixin, Mock): ... if sys.version_info >= (3, 8): class AsyncMockMixin(Base): @@ -350,27 +361,44 @@ if sys.version_info >= (3, 8): await_count: int await_args: _Call | None await_args_list: _CallList + class AsyncMagicMixin(MagicMixin): def __init__(self, *args: Any, **kw: Any) -> None: ... + class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ... class MagicProxy: - name: Any + name: str parent: Any - def __init__(self, name: Any, parent: Any) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __init__(self, name: str, parent: Any) -> None: ... + if sys.version_info < (3, 8): + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def create_mock(self) -> Any: ... def __get__(self, obj: Any, _type: Any | None = ...) -> Any: ... class _ANY: - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... + def __eq__(self, other: object) -> Literal[True]: ... + def __ne__(self, other: object) -> Literal[False]: ... ANY: Any -def create_autospec( - spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Any | None = ..., _name: Any | None = ..., **kwargs: Any -) -> Any: ... +if sys.version_info >= (3, 10): + def create_autospec( + spec: Any, + spec_set: Any = ..., + instance: Any = ..., + _parent: Any | None = ..., + _name: Any | None = ..., + *, + unsafe: bool = ..., + **kwargs: Any, + ) -> Any: ... + +else: + def create_autospec( + spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Any | None = ..., _name: Any | None = ..., **kwargs: Any + ) -> Any: ... class _SpecState: spec: Any @@ -391,7 +419,12 @@ class _SpecState: def mock_open(mock: Any | None = ..., read_data: Any = ...) -> Any: ... -PropertyMock = Any +class PropertyMock(Mock): + if sys.version_info >= (3, 8): + def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ... + else: + def __get__(self: Self, obj: _T, obj_type: type[_T] | None) -> Self: ... + + def __set__(self, obj: Any, value: Any) -> None: ... -if sys.version_info >= (3, 7): - def seal(mock: Any) -> None: ... +def seal(mock: Any) -> None: ... diff --git a/stdlib/unittest/result.pyi b/stdlib/unittest/result.pyi index 676c0cd..5dfec13 100644 --- a/stdlib/unittest/result.pyi +++ b/stdlib/unittest/result.pyi @@ -1,19 +1,21 @@ import unittest.case -from types import TracebackType -from typing import Any, Callable, TextIO, Tuple, Type, TypeVar, Union - -_SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]] +from _typeshed import OptExcInfo +from collections.abc import Callable +from typing import Any, TextIO, TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) +STDOUT_LINE: str +STDERR_LINE: str + # undocumented def failfast(method: _F) -> _F: ... class TestResult: - errors: list[Tuple[unittest.case.TestCase, str]] - failures: list[Tuple[unittest.case.TestCase, str]] - skipped: list[Tuple[unittest.case.TestCase, str]] - expectedFailures: list[Tuple[unittest.case.TestCase, str]] + errors: list[tuple[unittest.case.TestCase, str]] + failures: list[tuple[unittest.case.TestCase, str]] + skipped: list[tuple[unittest.case.TestCase, str]] + expectedFailures: list[tuple[unittest.case.TestCase, str]] unexpectedSuccesses: list[unittest.case.TestCase] shouldStop: bool testsRun: int @@ -28,10 +30,10 @@ class TestResult: def stopTest(self, test: unittest.case.TestCase) -> None: ... def startTestRun(self) -> None: ... def stopTestRun(self) -> None: ... - def addError(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ... - def addFailure(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ... + def addError(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ... + def addFailure(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ... def addSuccess(self, test: unittest.case.TestCase) -> None: ... def addSkip(self, test: unittest.case.TestCase, reason: str) -> None: ... - def addExpectedFailure(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ... + def addExpectedFailure(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ... def addUnexpectedSuccess(self, test: unittest.case.TestCase) -> None: ... - def addSubTest(self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, err: _SysExcInfoType | None) -> None: ... + def addSubTest(self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, err: OptExcInfo | None) -> None: ... diff --git a/stdlib/unittest/runner.pyi b/stdlib/unittest/runner.pyi index 128909b..1751482 100644 --- a/stdlib/unittest/runner.pyi +++ b/stdlib/unittest/runner.pyi @@ -1,23 +1,24 @@ import unittest.case import unittest.result import unittest.suite -from typing import Callable, TextIO, Tuple, Type +from collections.abc import Callable, Iterable +from typing import TextIO +from typing_extensions import TypeAlias -_ResultClassType = Callable[[TextIO, bool, int], unittest.result.TestResult] +_ResultClassType: TypeAlias = Callable[[TextIO, bool, int], unittest.result.TestResult] class TextTestResult(unittest.result.TestResult): descriptions: bool # undocumented dots: bool # undocumented separator1: str separator2: str - showall: bool # undocumented + showAll: bool # undocumented stream: TextIO # undocumented def __init__(self, stream: TextIO, descriptions: bool, verbosity: int) -> None: ... def getDescription(self, test: unittest.case.TestCase) -> str: ... - def printErrors(self) -> None: ... - def printErrorList(self, flavour: str, errors: Tuple[unittest.case.TestCase, str]) -> None: ... + def printErrorList(self, flavour: str, errors: Iterable[tuple[unittest.case.TestCase, str]]) -> None: ... -class TextTestRunner(object): +class TextTestRunner: resultclass: _ResultClassType def __init__( self, @@ -27,7 +28,7 @@ class TextTestRunner(object): failfast: bool = ..., buffer: bool = ..., resultclass: _ResultClassType | None = ..., - warnings: Type[Warning] | None = ..., + warnings: type[Warning] | None = ..., *, tb_locals: bool = ..., ) -> None: ... diff --git a/stdlib/unittest/signals.pyi b/stdlib/unittest/signals.pyi index 375b7d7..89e108d 100644 --- a/stdlib/unittest/signals.pyi +++ b/stdlib/unittest/signals.pyi @@ -1,5 +1,6 @@ import unittest.result -from typing import Callable, TypeVar, overload +from collections.abc import Callable +from typing import TypeVar, overload from typing_extensions import ParamSpec _P = ParamSpec("_P") @@ -11,4 +12,4 @@ def removeResult(result: unittest.result.TestResult) -> bool: ... @overload def removeHandler(method: None = ...) -> None: ... @overload -def removeHandler(method: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore +def removeHandler(method: Callable[_P, _T]) -> Callable[_P, _T]: ... diff --git a/stdlib/unittest/suite.pyi b/stdlib/unittest/suite.pyi index 396b46e..26bef65 100644 --- a/stdlib/unittest/suite.pyi +++ b/stdlib/unittest/suite.pyi @@ -1,8 +1,9 @@ import unittest.case import unittest.result -from typing import Iterable, Iterator, Union +from collections.abc import Iterable, Iterator +from typing_extensions import TypeAlias -_TestType = Union[unittest.case.TestCase, TestSuite] +_TestType: TypeAlias = unittest.case.TestCase | TestSuite class BaseTestSuite(Iterable[_TestType]): _tests: list[unittest.case.TestCase] @@ -15,6 +16,7 @@ class BaseTestSuite(Iterable[_TestType]): def debug(self) -> None: ... def countTestCases(self) -> int: ... def __iter__(self) -> Iterator[_TestType]: ... + def __eq__(self, other: object) -> bool: ... class TestSuite(BaseTestSuite): def run(self, result: unittest.result.TestResult, debug: bool = ...) -> unittest.result.TestResult: ... diff --git a/stdlib/unittest/util.pyi b/stdlib/unittest/util.pyi index ffce5d5..f62c728 100644 --- a/stdlib/unittest/util.pyi +++ b/stdlib/unittest/util.pyi @@ -1,7 +1,9 @@ -from typing import Any, Sequence, Tuple, TypeVar +from collections.abc import Sequence +from typing import Any, TypeVar +from typing_extensions import TypeAlias _T = TypeVar("_T") -_Mismatch = Tuple[_T, _T, int] +_Mismatch: TypeAlias = tuple[_T, _T, int] _MAX_LENGTH: int _PLACEHOLDER_LEN: int @@ -11,11 +13,11 @@ _MIN_COMMON_LEN: int _MIN_DIFF_LEN: int def _shorten(s: str, prefixlen: int, suffixlen: int) -> str: ... -def _common_shorten_repr(*args: str) -> Tuple[str]: ... +def _common_shorten_repr(*args: str) -> tuple[str, ...]: ... def safe_repr(obj: object, short: bool = ...) -> str: ... def strclass(cls: type) -> str: ... -def sorted_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> Tuple[list[_T], list[_T]]: ... -def unorderable_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> Tuple[list[_T], list[_T]]: ... +def sorted_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> tuple[list[_T], list[_T]]: ... +def unorderable_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> tuple[list[_T], list[_T]]: ... def three_way_cmp(x: Any, y: Any) -> int: ... def _count_diff_all_purpose(actual: Sequence[_T], expected: Sequence[_T]) -> list[_Mismatch[_T]]: ... def _count_diff_hashable(actual: Sequence[_T], expected: Sequence[_T]) -> list[_Mismatch[_T]]: ... diff --git a/stdlib/urllib/error.pyi b/stdlib/urllib/error.pyi index 557f84a..7a4de10 100644 --- a/stdlib/urllib/error.pyi +++ b/stdlib/urllib/error.pyi @@ -1,17 +1,21 @@ from email.message import Message -from typing import IO, Tuple +from typing import IO from urllib.response import addinfourl -# Stubs for urllib.error +__all__ = ["URLError", "HTTPError", "ContentTooShortError"] class URLError(IOError): reason: str | BaseException def __init__(self, reason: str | BaseException, filename: str | None = ...) -> None: ... class HTTPError(URLError, addinfourl): + @property + def headers(self) -> Message: ... # type: ignore[override] + @property + def reason(self) -> str: ... # type: ignore[override] code: int def __init__(self, url: str, code: int, msg: str, hdrs: Message, fp: IO[bytes] | None) -> None: ... class ContentTooShortError(URLError): - content: Tuple[str, Message] - def __init__(self, message: str, content: Tuple[str, Message]) -> None: ... + content: tuple[str, Message] + def __init__(self, message: str, content: tuple[str, Message]) -> None: ... diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 49a3dd1..207a05e 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -1,10 +1,33 @@ import sys -from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence, Tuple, Union, overload +from collections.abc import Callable, Mapping, Sequence +from typing import Any, AnyStr, Generic, NamedTuple, overload if sys.version_info >= (3, 9): from types import GenericAlias -_Str = Union[bytes, str] +__all__ = [ + "urlparse", + "urlunparse", + "urljoin", + "urldefrag", + "urlsplit", + "urlunsplit", + "urlencode", + "parse_qs", + "parse_qsl", + "quote", + "quote_plus", + "quote_from_bytes", + "unquote", + "unquote_plus", + "unquote_to_bytes", + "DefragResult", + "ParseResult", + "SplitResult", + "DefragResultBytes", + "ParseResultBytes", + "SplitResultBytes", +] uses_relative: list[str] uses_netloc: list[str] @@ -13,7 +36,8 @@ non_hierarchical: list[str] uses_query: list[str] uses_fragment: list[str] scheme_chars: str -MAX_CACHE_SIZE: int +if sys.version_info < (3, 11): + MAX_CACHE_SIZE: int class _ResultMixinBase(Generic[AnyStr]): def geturl(self) -> AnyStr: ... @@ -21,23 +45,33 @@ class _ResultMixinBase(Generic[AnyStr]): class _ResultMixinStr(_ResultMixinBase[str]): def encode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinBytes: ... -class _ResultMixinBytes(_ResultMixinBase[str]): +class _ResultMixinBytes(_ResultMixinBase[bytes]): def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ... class _NetlocResultMixinBase(Generic[AnyStr]): - username: AnyStr | None - password: AnyStr | None - hostname: AnyStr | None - port: int | None + @property + def username(self) -> AnyStr | None: ... + @property + def password(self) -> AnyStr | None: ... + @property + def hostname(self) -> AnyStr | None: ... + @property + def port(self) -> int | None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ... class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ... -class _DefragResultBase(Tuple[Any, ...], Generic[AnyStr]): - url: AnyStr - fragment: AnyStr +# Ideally this would be a generic fixed-length tuple, +# but mypy doesn't support that yet: https://github.com/python/mypy/issues/685#issuecomment-992014179 +class _DefragResultBase(tuple[AnyStr, ...], Generic[AnyStr]): + if sys.version_info >= (3, 10): + __match_args__ = ("url", "fragment") + @property + def url(self) -> AnyStr: ... + @property + def fragment(self) -> AnyStr: ... class _SplitResultBase(NamedTuple): scheme: str @@ -96,30 +130,36 @@ def parse_qsl( errors: str = ..., max_num_fields: int | None = ..., separator: str = ..., -) -> list[Tuple[AnyStr, AnyStr]]: ... +) -> list[tuple[AnyStr, AnyStr]]: ... @overload -def quote(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... +def quote(string: str, safe: str | bytes = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload -def quote(string: bytes, safe: _Str = ...) -> str: ... -def quote_from_bytes(bs: bytes, safe: _Str = ...) -> str: ... +def quote(string: bytes, safe: str | bytes = ...) -> str: ... +def quote_from_bytes(bs: bytes, safe: str | bytes = ...) -> str: ... @overload -def quote_plus(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... +def quote_plus(string: str, safe: str | bytes = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload -def quote_plus(string: bytes, safe: _Str = ...) -> str: ... -def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... -def unquote_to_bytes(string: _Str) -> bytes: ... +def quote_plus(string: bytes, safe: str | bytes = ...) -> str: ... + +if sys.version_info >= (3, 9): + def unquote(string: str | bytes, encoding: str = ..., errors: str = ...) -> str: ... + +else: + def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... + +def unquote_to_bytes(string: str | bytes) -> bytes: ... def unquote_plus(string: str, encoding: str = ..., errors: str = ...) -> str: ... @overload def urldefrag(url: str) -> DefragResult: ... @overload def urldefrag(url: bytes | None) -> DefragResultBytes: ... def urlencode( - query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[Tuple[Any, Any]] | Sequence[Tuple[Any, Sequence[Any]]], + query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], doseq: bool = ..., - safe: AnyStr = ..., + safe: str | bytes = ..., encoding: str = ..., errors: str = ..., - quote_via: Callable[[str, AnyStr, str, str], str] = ..., + quote_via: Callable[[AnyStr, str | bytes, str, str], str] = ..., ) -> str: ... def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = ...) -> AnyStr: ... @overload @@ -132,11 +172,12 @@ def urlsplit(url: str, scheme: str | None = ..., allow_fragments: bool = ...) -> def urlsplit(url: bytes | None, scheme: bytes | None = ..., allow_fragments: bool = ...) -> SplitResultBytes: ... @overload def urlunparse( - components: Tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None] + components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None] ) -> AnyStr: ... @overload def urlunparse(components: Sequence[AnyStr | None]) -> AnyStr: ... @overload -def urlunsplit(components: Tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]) -> AnyStr: ... +def urlunsplit(components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]) -> AnyStr: ... @overload def urlunsplit(components: Sequence[AnyStr | None]) -> AnyStr: ... +def unwrap(url: str) -> str: ... diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index 9ac320c..3cd5fc7 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -1,19 +1,60 @@ import ssl import sys -from _typeshed import StrOrBytesPath +from _typeshed import StrOrBytesPath, SupportsRead +from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence from email.message import Message -from http.client import HTTPMessage, HTTPResponse, _HTTPConnectionProtocol +from http.client import HTTPConnection, HTTPMessage, HTTPResponse from http.cookiejar import CookieJar -from typing import IO, Any, Callable, ClassVar, Mapping, NoReturn, Pattern, Sequence, Tuple, TypeVar, overload -from urllib.error import HTTPError +from re import Pattern +from typing import IO, Any, ClassVar, NoReturn, Protocol, TypeVar, overload +from typing_extensions import TypeAlias +from urllib.error import HTTPError as HTTPError from urllib.response import addclosehook, addinfourl +__all__ = [ + "Request", + "OpenerDirector", + "BaseHandler", + "HTTPDefaultErrorHandler", + "HTTPRedirectHandler", + "HTTPCookieProcessor", + "ProxyHandler", + "HTTPPasswordMgr", + "HTTPPasswordMgrWithDefaultRealm", + "HTTPPasswordMgrWithPriorAuth", + "AbstractBasicAuthHandler", + "HTTPBasicAuthHandler", + "ProxyBasicAuthHandler", + "AbstractDigestAuthHandler", + "HTTPDigestAuthHandler", + "ProxyDigestAuthHandler", + "HTTPHandler", + "FileHandler", + "FTPHandler", + "CacheFTPHandler", + "DataHandler", + "UnknownHandler", + "HTTPErrorProcessor", + "urlopen", + "install_opener", + "build_opener", + "pathname2url", + "url2pathname", + "getproxies", + "urlretrieve", + "urlcleanup", + "URLopener", + "FancyURLopener", + "HTTPSHandler", +] + _T = TypeVar("_T") -_UrlopenRet = Any +_UrlopenRet: TypeAlias = Any +_DataType: TypeAlias = bytes | SupportsRead[bytes] | Iterable[bytes] | None def urlopen( url: str | Request, - data: bytes | None = ..., + data: _DataType | None = ..., timeout: float | None = ..., *, cafile: str | None = ..., @@ -51,8 +92,8 @@ class Request: host: str origin_req_host: str selector: str - data: bytes | None - headers: dict[str, str] + data: _DataType + headers: MutableMapping[str, str] unredirected_hdrs: dict[str, str] unverifiable: bool method: str | None @@ -60,8 +101,8 @@ class Request: def __init__( self, url: str, - data: bytes | None = ..., - headers: dict[str, str] = ..., + data: _DataType = ..., + headers: MutableMapping[str, str] = ..., origin_req_host: str | None = ..., unverifiable: bool = ..., method: str | None = ..., @@ -77,13 +118,13 @@ class Request: def get_header(self, header_name: str) -> str | None: ... @overload def get_header(self, header_name: str, default: _T) -> str | _T: ... - def header_items(self) -> list[Tuple[str, str]]: ... + def header_items(self) -> list[tuple[str, str]]: ... def has_proxy(self) -> bool: ... class OpenerDirector: - addheaders: list[Tuple[str, str]] + addheaders: list[tuple[str, str]] def add_handler(self, handler: BaseHandler) -> None: ... - def open(self, fullurl: str | Request, data: bytes | None = ..., timeout: float | None = ...) -> _UrlopenRet: ... + def open(self, fullurl: str | Request, data: _DataType = ..., timeout: float | None = ...) -> _UrlopenRet: ... def error(self, proto: str, *args: Any) -> _UrlopenRet: ... def close(self) -> None: ... @@ -92,6 +133,7 @@ class BaseHandler: parent: OpenerDirector def add_parent(self, parent: OpenerDirector) -> None: ... def close(self) -> None: ... + def __lt__(self, other: object) -> bool: ... class HTTPDefaultErrorHandler(BaseHandler): def http_error_default( @@ -109,6 +151,10 @@ class HTTPRedirectHandler(BaseHandler): def http_error_302(self, req: Request, fp: IO[bytes], code: int, msg: str, headers: HTTPMessage) -> _UrlopenRet | None: ... def http_error_303(self, req: Request, fp: IO[bytes], code: int, msg: str, headers: HTTPMessage) -> _UrlopenRet | None: ... def http_error_307(self, req: Request, fp: IO[bytes], code: int, msg: str, headers: HTTPMessage) -> _UrlopenRet | None: ... + if sys.version_info >= (3, 11): + def http_error_308( + self, req: Request, fp: IO[bytes], code: int, msg: str, headers: HTTPMessage + ) -> _UrlopenRet | None: ... class HTTPCookieProcessor(BaseHandler): cookiejar: CookieJar @@ -125,13 +171,13 @@ class ProxyHandler(BaseHandler): class HTTPPasswordMgr: def add_password(self, realm: str, uri: str | Sequence[str], user: str, passwd: str) -> None: ... - def find_user_password(self, realm: str, authuri: str) -> Tuple[str | None, str | None]: ... + def find_user_password(self, realm: str, authuri: str) -> tuple[str | None, str | None]: ... def is_suburi(self, base: str, test: str) -> bool: ... # undocumented def reduce_uri(self, uri: str, default_port: bool = ...) -> str: ... # undocumented class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): def add_password(self, realm: str | None, uri: str | Sequence[str], user: str, passwd: str) -> None: ... - def find_user_password(self, realm: str | None, authuri: str) -> Tuple[str | None, str | None]: ... + def find_user_password(self, realm: str | None, authuri: str) -> tuple[str | None, str | None]: ... class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm): def add_password( @@ -167,7 +213,7 @@ class AbstractDigestAuthHandler: def retry_http_digest_auth(self, req: Request, auth: str) -> _UrlopenRet | None: ... def get_cnonce(self, nonce: str) -> str: ... def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ... - def get_algorithm_impls(self, algorithm: str) -> Tuple[Callable[[str], str], Callable[[str, str], str]]: ... + def get_algorithm_impls(self, algorithm: str) -> tuple[Callable[[str], str], Callable[[str, str], str]]: ... def get_entity_digest(self, data: bytes | None, chal: Mapping[str, str]) -> str | None: ... class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): @@ -178,6 +224,16 @@ class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): auth_header: ClassVar[str] # undocumented def http_error_407(self, req: Request, fp: IO[bytes], code: int, msg: str, headers: HTTPMessage) -> _UrlopenRet | None: ... +class _HTTPConnectionProtocol(Protocol): + def __call__( + self, + host: str, + port: int | None = ..., + timeout: float = ..., + source_address: tuple[str, int] | None = ..., + blocksize: int = ..., + ) -> HTTPConnection: ... + class AbstractHTTPHandler(BaseHandler): # undocumented def __init__(self, debuglevel: int = ...) -> None: ... def set_http_debuglevel(self, level: int) -> None: ... @@ -196,9 +252,9 @@ class HTTPSHandler(AbstractHTTPHandler): def https_request(self, request: Request) -> Request: ... # undocumented class FileHandler(BaseHandler): - names: ClassVar[Tuple[str, ...] | None] # undocumented + names: ClassVar[tuple[str, ...] | None] # undocumented def file_open(self, req: Request) -> addinfourl: ... - def get_names(self) -> Tuple[str, ...]: ... # undocumented + def get_names(self) -> tuple[str, ...]: ... # undocumented def open_local_file(self, req: Request) -> addinfourl: ... # undocumented class DataHandler(BaseHandler): @@ -213,7 +269,7 @@ class ftpwrapper: # undocumented def file_close(self) -> None: ... def init(self) -> None: ... def real_close(self) -> None: ... - def retrfile(self, file: str, type: str) -> Tuple[addclosehook, int]: ... + def retrfile(self, file: str, type: str) -> tuple[addclosehook, int]: ... class FTPHandler(BaseHandler): def ftp_open(self, req: Request) -> addinfourl: ... @@ -226,9 +282,6 @@ class CacheFTPHandler(FTPHandler): def setMaxConns(self, m: int) -> None: ... def check_cache(self) -> None: ... # undocumented def clear_cache(self) -> None: ... # undocumented - def connect_ftp( - self, user: str, passwd: str, host: str, port: int, dirs: str, timeout: float - ) -> ftpwrapper: ... # undocumented class UnknownHandler(BaseHandler): def unknown_open(self, req: Request) -> NoReturn: ... @@ -240,9 +293,9 @@ class HTTPErrorProcessor(BaseHandler): def urlretrieve( url: str, filename: StrOrBytesPath | None = ..., - reporthook: Callable[[int, int, int], None] | None = ..., - data: bytes | None = ..., -) -> Tuple[str, HTTPMessage]: ... + reporthook: Callable[[int, int, int], object] | None = ..., + data: _DataType = ..., +) -> tuple[str, HTTPMessage]: ... def urlcleanup() -> None: ... class URLopener: @@ -254,10 +307,10 @@ class URLopener: self, url: str, filename: str | None = ..., - reporthook: Callable[[int, int, int], None] | None = ..., + reporthook: Callable[[int, int, int], object] | None = ..., data: bytes | None = ..., - ) -> Tuple[str, Message | None]: ... - def addheader(self, *args: Tuple[str, str]) -> None: ... # undocumented + ) -> tuple[str, Message | None]: ... + def addheader(self, *args: tuple[str, str]) -> None: ... # undocumented def cleanup(self) -> None: ... # undocumented def close(self) -> None: ... # undocumented def http_error( @@ -275,8 +328,8 @@ class URLopener: def open_unknown_proxy(self, proxy: str, fullurl: str, data: bytes | None = ...) -> None: ... # undocumented class FancyURLopener(URLopener): - def prompt_user_passwd(self, host: str, realm: str) -> Tuple[str, str]: ... - def get_user_passwd(self, host: str, realm: str, clear_cache: int = ...) -> Tuple[str, str]: ... # undocumented + def prompt_user_passwd(self, host: str, realm: str) -> tuple[str, str]: ... + def get_user_passwd(self, host: str, realm: str, clear_cache: int = ...) -> tuple[str, str]: ... # undocumented def http_error_301( self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: bytes | None = ... ) -> _UrlopenRet | addinfourl | None: ... # undocumented @@ -289,6 +342,11 @@ class FancyURLopener(URLopener): def http_error_307( self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: bytes | None = ... ) -> _UrlopenRet | addinfourl | None: ... # undocumented + if sys.version_info >= (3, 11): + def http_error_308( + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: bytes | None = ... + ) -> _UrlopenRet | addinfourl | None: ... # undocumented + def http_error_401( self, url: str, diff --git a/stdlib/urllib/response.pyi b/stdlib/urllib/response.pyi index 647ebf8..8c9a600 100644 --- a/stdlib/urllib/response.pyi +++ b/stdlib/urllib/response.pyi @@ -1,19 +1,20 @@ import sys from _typeshed import Self +from collections.abc import Callable, Iterable from email.message import Message from types import TracebackType -from typing import IO, Any, BinaryIO, Callable, Iterable, Tuple, Type, TypeVar +from typing import IO, Any, BinaryIO -_AIUT = TypeVar("_AIUT", bound=addbase) +__all__ = ["addbase", "addclosehook", "addinfo", "addinfourl"] class addbase(BinaryIO): fp: IO[bytes] def __init__(self, fp: IO[bytes]) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... - def __iter__(self: _AIUT) -> _AIUT: ... + def __iter__(self: Self) -> Self: ... def __next__(self) -> bytes: ... def close(self) -> None: ... # These methods don't actually exist, but the class inherits at runtime from @@ -37,7 +38,7 @@ class addbase(BinaryIO): class addclosehook(addbase): closehook: Callable[..., object] - hookargs: Tuple[Any, ...] + hookargs: tuple[Any, ...] def __init__(self, fp: IO[bytes], closehook: Callable[..., object], *hookargs: Any) -> None: ... class addinfo(addbase): @@ -51,6 +52,7 @@ class addinfourl(addinfo): if sys.version_info >= (3, 9): @property def status(self) -> int | None: ... + def __init__(self, fp: IO[bytes], headers: Message, url: str, code: int | None = ...) -> None: ... def geturl(self) -> str: ... def getcode(self) -> int | None: ... diff --git a/stdlib/urllib/robotparser.pyi b/stdlib/urllib/robotparser.pyi index 3611263..795cf83 100644 --- a/stdlib/urllib/robotparser.pyi +++ b/stdlib/urllib/robotparser.pyi @@ -1,7 +1,10 @@ import sys -from typing import Iterable, NamedTuple +from collections.abc import Iterable +from typing import NamedTuple -class _RequestRate(NamedTuple): +__all__ = ["RobotFileParser"] + +class RequestRate(NamedTuple): requests: int seconds: int @@ -14,6 +17,6 @@ class RobotFileParser: def mtime(self) -> int: ... def modified(self) -> None: ... def crawl_delay(self, useragent: str) -> str | None: ... - def request_rate(self, useragent: str) -> _RequestRate | None: ... + def request_rate(self, useragent: str) -> RequestRate | None: ... if sys.version_info >= (3, 8): def site_maps(self) -> list[str] | None: ... diff --git a/stdlib/uu.pyi b/stdlib/uu.pyi index aacd458..95a7f3d 100644 --- a/stdlib/uu.pyi +++ b/stdlib/uu.pyi @@ -1,16 +1,11 @@ -import sys -from typing import BinaryIO, Union +from typing import BinaryIO +from typing_extensions import TypeAlias -_File = Union[str, BinaryIO] +__all__ = ["Error", "encode", "decode"] -class Error(Exception): ... - -if sys.version_info >= (3, 7): - def encode( - in_file: _File, out_file: _File, name: str | None = ..., mode: int | None = ..., *, backtick: bool = ... - ) -> None: ... +_File: TypeAlias = str | BinaryIO -else: - def encode(in_file: _File, out_file: _File, name: str | None = ..., mode: int | None = ...) -> None: ... +class Error(Exception): ... +def encode(in_file: _File, out_file: _File, name: str | None = ..., mode: int | None = ..., *, backtick: bool = ...) -> None: ... def decode(in_file: _File, out_file: _File | None = ..., mode: int | None = ..., quiet: int = ...) -> None: ... diff --git a/stdlib/uuid.pyi b/stdlib/uuid.pyi index da13d81..3d9b89a 100644 --- a/stdlib/uuid.pyi +++ b/stdlib/uuid.pyi @@ -1,43 +1,30 @@ -import sys -from typing import Any, Tuple +from enum import Enum +from typing_extensions import TypeAlias # Because UUID has properties called int and bytes we need to rename these temporarily. -_Int = int -_Bytes = bytes -_FieldsType = Tuple[int, int, int, int, int, int] +_Int: TypeAlias = int +_Bytes: TypeAlias = bytes +_FieldsType: TypeAlias = tuple[int, int, int, int, int, int] -if sys.version_info >= (3, 7): - from enum import Enum - class SafeUUID(Enum): - safe: int - unsafe: int - unknown: None +class SafeUUID(Enum): + safe: int + unsafe: int + unknown: None class UUID: - if sys.version_info >= (3, 7): - def __init__( - self, - hex: str | None = ..., - bytes: _Bytes | None = ..., - bytes_le: _Bytes | None = ..., - fields: _FieldsType | None = ..., - int: _Int | None = ..., - version: _Int | None = ..., - *, - is_safe: SafeUUID = ..., - ) -> None: ... - @property - def is_safe(self) -> SafeUUID: ... - else: - def __init__( - self, - hex: str | None = ..., - bytes: _Bytes | None = ..., - bytes_le: _Bytes | None = ..., - fields: _FieldsType | None = ..., - int: _Int | None = ..., - version: _Int | None = ..., - ) -> None: ... + def __init__( + self, + hex: str | None = ..., + bytes: _Bytes | None = ..., + bytes_le: _Bytes | None = ..., + fields: _FieldsType | None = ..., + int: _Int | None = ..., + version: _Int | None = ..., + *, + is_safe: SafeUUID = ..., + ) -> None: ... + @property + def is_safe(self) -> SafeUUID: ... @property def bytes(self) -> _Bytes: ... @property @@ -71,11 +58,11 @@ class UUID: @property def version(self) -> _Int | None: ... def __int__(self) -> _Int: ... - def __eq__(self, other: Any) -> bool: ... - def __lt__(self, other: Any) -> bool: ... - def __le__(self, other: Any) -> bool: ... - def __gt__(self, other: Any) -> bool: ... - def __ge__(self, other: Any) -> bool: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: UUID) -> bool: ... + def __le__(self, other: UUID) -> bool: ... + def __gt__(self, other: UUID) -> bool: ... + def __ge__(self, other: UUID) -> bool: ... def getnode() -> int: ... def uuid1(node: _Int | None = ..., clock_seq: _Int | None = ...) -> UUID: ... diff --git a/stdlib/venv/__init__.pyi b/stdlib/venv/__init__.pyi index 25cf615..2e34aed 100644 --- a/stdlib/venv/__init__.pyi +++ b/stdlib/venv/__init__.pyi @@ -1,7 +1,10 @@ import sys from _typeshed import StrOrBytesPath +from collections.abc import Sequence from types import SimpleNamespace -from typing import Sequence + +if sys.version_info >= (3, 9): + CORE_VENV_DEPS: tuple[str, ...] class EnvBuilder: system_site_packages: bool @@ -32,6 +35,7 @@ class EnvBuilder: with_pip: bool = ..., prompt: str | None = ..., ) -> None: ... + def create(self, env_dir: StrOrBytesPath) -> None: ... def clear_directory(self, path: StrOrBytesPath) -> None: ... # undocumented def ensure_directories(self, env_dir: StrOrBytesPath) -> SimpleNamespace: ... diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index 62c41c8..5cc6b94 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -1,26 +1,46 @@ +import sys +from _warnings import warn as warn, warn_explicit as warn_explicit +from collections.abc import Sequence from types import ModuleType, TracebackType -from typing import Any, Sequence, TextIO, Type, overload -from typing_extensions import Literal +from typing import Any, Generic, TextIO, TypeVar, overload +from typing_extensions import Literal, TypeAlias -from _warnings import warn as warn, warn_explicit as warn_explicit +__all__ = [ + "warn", + "warn_explicit", + "showwarning", + "formatwarning", + "filterwarnings", + "simplefilter", + "resetwarnings", + "catch_warnings", +] + +_W = TypeVar("_W", bound=list[WarningMessage] | None) +_ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module", "once"] -filters: Sequence[tuple[str, str | None, Type[Warning], str | None, int]] # undocumented, do not mutate +filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate def showwarning( - message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ... + message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ... ) -> None: ... -def formatwarning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ... +def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ... def filterwarnings( - action: str, message: str = ..., category: Type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ... + action: _ActionKind, + message: str = ..., + category: type[Warning] = ..., + module: str = ..., + lineno: int = ..., + append: bool = ..., ) -> None: ... -def simplefilter(action: str, category: Type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... +def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... def resetwarnings() -> None: ... class _OptionError(Exception): ... class WarningMessage: message: Warning | str - category: Type[Warning] + category: type[Warning] filename: str lineno: int file: TextIO | None @@ -29,7 +49,7 @@ class WarningMessage: def __init__( self, message: Warning | str, - category: Type[Warning], + category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., @@ -37,20 +57,54 @@ class WarningMessage: source: Any | None = ..., ) -> None: ... -class catch_warnings: - @overload - def __new__(cls, *, record: Literal[False] = ..., module: ModuleType | None = ...) -> _catch_warnings_without_records: ... - @overload - def __new__(cls, *, record: Literal[True], module: ModuleType | None = ...) -> _catch_warnings_with_records: ... - @overload - def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ... - def __enter__(self) -> list[WarningMessage] | None: ... +class catch_warnings(Generic[_W]): + if sys.version_info >= (3, 11): + @overload + def __init__( + self: catch_warnings[None], + *, + record: Literal[False] = ..., + module: ModuleType | None = ..., + action: _ActionKind | None = ..., + category: type[Warning] = ..., + lineno: int = ..., + append: bool = ..., + ) -> None: ... + @overload + def __init__( + self: catch_warnings[list[WarningMessage]], + *, + record: Literal[True], + module: ModuleType | None = ..., + action: _ActionKind | None = ..., + category: type[Warning] = ..., + lineno: int = ..., + append: bool = ..., + ) -> None: ... + @overload + def __init__( + self: catch_warnings[list[WarningMessage] | None], + *, + record: bool, + module: ModuleType | None = ..., + action: _ActionKind | None = ..., + category: type[Warning] = ..., + lineno: int = ..., + append: bool = ..., + ) -> None: ... + else: + @overload + def __init__(self: catch_warnings[None], *, record: Literal[False] = ..., module: ModuleType | None = ...) -> None: ... + @overload + def __init__( + self: catch_warnings[list[WarningMessage]], *, record: Literal[True], module: ModuleType | None = ... + ) -> None: ... + @overload + def __init__( + self: catch_warnings[list[WarningMessage] | None], *, record: bool, module: ModuleType | None = ... + ) -> None: ... + + def __enter__(self) -> _W: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... - -class _catch_warnings_without_records(catch_warnings): - def __enter__(self) -> None: ... - -class _catch_warnings_with_records(catch_warnings): - def __enter__(self) -> list[WarningMessage]: ... diff --git a/stdlib/wave.pyi b/stdlib/wave.pyi index 3ce1b88..853a26a 100644 --- a/stdlib/wave.pyi +++ b/stdlib/wave.pyi @@ -1,12 +1,18 @@ import sys -from _typeshed import Self -from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, Union +from _typeshed import ReadableBuffer, Self +from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, overload +from typing_extensions import Literal, TypeAlias -_File = Union[str, IO[bytes]] +if sys.version_info >= (3, 9): + __all__ = ["open", "Error", "Wave_read", "Wave_write"] +else: + __all__ = ["open", "openfp", "Error", "Wave_read", "Wave_write"] + +_File: TypeAlias = str | IO[bytes] class Error(Exception): ... -WAVE_FORMAT_PCM: int +WAVE_FORMAT_PCM: Literal[1] class _wave_params(NamedTuple): nchannels: int @@ -19,7 +25,7 @@ class _wave_params(NamedTuple): class Wave_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getfp(self) -> BinaryIO | None: ... def rewind(self) -> None: ... def close(self) -> None: ... @@ -39,7 +45,7 @@ class Wave_read: class Wave_write: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def setnchannels(self, nchannels: int) -> None: ... def getnchannels(self) -> int: ... def setsampwidth(self, sampwidth: int) -> None: ... @@ -51,18 +57,21 @@ class Wave_write: def setcomptype(self, comptype: str, compname: str) -> None: ... def getcomptype(self) -> str: ... def getcompname(self) -> str: ... - def setparams(self, params: _wave_params) -> None: ... + def setparams(self, params: _wave_params | tuple[int, int, int, int, str, str]) -> None: ... def getparams(self) -> _wave_params: ... def setmark(self, id: Any, pos: Any, name: Any) -> NoReturn: ... def getmark(self, id: Any) -> NoReturn: ... def getmarkers(self) -> None: ... def tell(self) -> int: ... - # should be any bytes-like object after 3.4, but we don't have a type for that - def writeframesraw(self, data: bytes) -> None: ... - def writeframes(self, data: bytes) -> None: ... + def writeframesraw(self, data: ReadableBuffer) -> None: ... + def writeframes(self, data: ReadableBuffer) -> None: ... def close(self) -> None: ... -# Returns a Wave_read if mode is rb and Wave_write if mode is wb +@overload +def open(f: _File, mode: Literal["r", "rb"]) -> Wave_read: ... +@overload +def open(f: _File, mode: Literal["w", "wb"]) -> Wave_write: ... +@overload def open(f: _File, mode: str | None = ...) -> Any: ... if sys.version_info < (3, 9): diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index 12158ee..9a61923 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -1,7 +1,5 @@ -import types -from _weakrefset import WeakSet as WeakSet -from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, Tuple, Type, TypeVar, overload - +import sys +from _typeshed import Self, SupportsKeysAndGetItem from _weakref import ( CallableProxyType as CallableProxyType, ProxyType as ProxyType, @@ -11,67 +9,125 @@ from _weakref import ( proxy as proxy, ref as ref, ) +from _weakrefset import WeakSet as WeakSet +from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping +from typing import Any, Generic, TypeVar, overload +from typing_extensions import ParamSpec + +__all__ = [ + "ref", + "proxy", + "getweakrefcount", + "getweakrefs", + "WeakKeyDictionary", + "ReferenceType", + "ProxyType", + "CallableProxyType", + "ProxyTypes", + "WeakValueDictionary", + "WeakSet", + "WeakMethod", + "finalize", +] -_S = TypeVar("_S") _T = TypeVar("_T") +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") _KT = TypeVar("_KT") _VT = TypeVar("_VT") +_CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) +_P = ParamSpec("_P") -ProxyTypes: Tuple[Type[Any], ...] +ProxyTypes: tuple[type[Any], ...] -class WeakMethod(ref[types.MethodType]): - def __new__(cls, meth: types.MethodType, callback: Callable[[types.MethodType], Any] | None = ...) -> WeakMethod: ... - def __call__(self) -> types.MethodType | None: ... +class WeakMethod(ref[_CallableT], Generic[_CallableT]): + def __new__(cls: type[Self], meth: _CallableT, callback: Callable[[_CallableT], object] | None = ...) -> Self: ... + def __call__(self) -> _CallableT | None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... class WeakValueDictionary(MutableMapping[_KT, _VT]): @overload def __init__(self) -> None: ... @overload - def __init__(self, __other: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __init__(self: WeakValueDictionary[_KT, _VT], __other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ... + @overload + def __init__( + self: WeakValueDictionary[str, _VT], __other: Mapping[str, _VT] | Iterable[tuple[str, _VT]] = ..., **kwargs: _VT + ) -> None: ... def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __contains__(self, o: object) -> bool: ... + def __getitem__(self, key: _KT) -> _VT: ... + def __setitem__(self, key: _KT, value: _VT) -> None: ... + def __delitem__(self, key: _KT) -> None: ... + def __contains__(self, key: object) -> bool: ... def __iter__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... def copy(self) -> WeakValueDictionary[_KT, _VT]: ... + __copy__ = copy + def __deepcopy__(self: Self, memo: Any) -> Self: ... # These are incompatible with Mapping - def keys(self) -> Iterator[_KT]: ... # type: ignore - def values(self) -> Iterator[_VT]: ... # type: ignore - def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore + def keys(self) -> Iterator[_KT]: ... # type: ignore[override] + def values(self) -> Iterator[_VT]: ... # type: ignore[override] + def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... + def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + @overload + def pop(self, key: _KT) -> _VT: ... + @overload + def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ... + if sys.version_info >= (3, 9): + def __or__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ... + def __ror__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ... + # WeakValueDictionary.__ior__ should be kept roughly in line with MutableMapping.update() + @overload # type: ignore[misc] + def __ior__(self: Self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... + @overload + def __ior__(self: Self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... class KeyedRef(ref[_T], Generic[_KT, _T]): key: _KT # This __new__ method uses a non-standard name for the "cls" parameter - def __new__(type, ob: _T, callback: Callable[[_T], Any], key: _KT) -> KeyedRef[_KT, _T]: ... # type: ignore + def __new__(type: type[Self], ob: _T, callback: Callable[[_T], Any], key: _KT) -> Self: ... def __init__(self, ob: _T, callback: Callable[[_T], Any], key: _KT) -> None: ... class WeakKeyDictionary(MutableMapping[_KT, _VT]): @overload def __init__(self, dict: None = ...) -> None: ... @overload - def __init__(self, dict: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]]) -> None: ... + def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ... def __len__(self) -> int: ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __contains__(self, o: object) -> bool: ... + def __getitem__(self, key: _KT) -> _VT: ... + def __setitem__(self, key: _KT, value: _VT) -> None: ... + def __delitem__(self, key: _KT) -> None: ... + def __contains__(self, key: object) -> bool: ... def __iter__(self) -> Iterator[_KT]: ... - def __str__(self) -> str: ... def copy(self) -> WeakKeyDictionary[_KT, _VT]: ... + __copy__ = copy + def __deepcopy__(self: Self, memo: Any) -> Self: ... # These are incompatible with Mapping - def keys(self) -> Iterator[_KT]: ... # type: ignore - def values(self) -> Iterator[_VT]: ... # type: ignore - def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore + def keys(self) -> Iterator[_KT]: ... # type: ignore[override] + def values(self) -> Iterator[_VT]: ... # type: ignore[override] + def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def keyrefs(self) -> list[ref[_KT]]: ... + def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + @overload + def pop(self, key: _KT) -> _VT: ... + @overload + def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ... + if sys.version_info >= (3, 9): + def __or__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ... + def __ror__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ... + # WeakKeyDictionary.__ior__ should be kept roughly in line with MutableMapping.update() + @overload # type: ignore[misc] + def __ior__(self: Self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ... + @overload + def __ior__(self: Self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... -class finalize: - def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... +class finalize: # TODO: This is a good candidate for to be a `Generic[_P, _T]` class + def __init__(self, __obj: object, __func: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ... def __call__(self, _: Any = ...) -> Any | None: ... - def detach(self) -> Tuple[Any, Any, Tuple[Any, ...], dict[str, Any]] | None: ... - def peek(self) -> Tuple[Any, Any, Tuple[Any, ...], dict[str, Any]] | None: ... - alive: bool + def detach(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... + def peek(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... + @property + def alive(self) -> bool: ... atexit: bool diff --git a/stdlib/webbrowser.pyi b/stdlib/webbrowser.pyi index c85288c..8cf8935 100644 --- a/stdlib/webbrowser.pyi +++ b/stdlib/webbrowser.pyi @@ -1,18 +1,15 @@ import sys -from typing import Callable, Sequence +from abc import abstractmethod +from collections.abc import Callable, Sequence +from typing_extensions import Literal -class Error(Exception): ... - -if sys.version_info >= (3, 7): - def register( - name: str, klass: Callable[[], BaseBrowser] | None, instance: BaseBrowser | None = ..., *, preferred: bool = ... - ) -> None: ... +__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"] -else: - def register( - name: str, klass: Callable[[], BaseBrowser] | None, instance: BaseBrowser | None = ..., update_tryorder: int = ... - ) -> None: ... +class Error(Exception): ... +def register( + name: str, klass: Callable[[], BaseBrowser] | None, instance: BaseBrowser | None = ..., *, preferred: bool = ... +) -> None: ... def get(using: str | None = ...) -> BaseBrowser: ... def open(url: str, new: int = ..., autoraise: bool = ...) -> bool: ... def open_new(url: str) -> bool: ... @@ -23,21 +20,19 @@ class BaseBrowser: name: str basename: str def __init__(self, name: str = ...) -> None: ... + @abstractmethod def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... def open_new(self, url: str) -> bool: ... def open_new_tab(self, url: str) -> bool: ... class GenericBrowser(BaseBrowser): - args: list[str] - name: str - basename: str def __init__(self, name: str | Sequence[str]) -> None: ... def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... -class BackgroundBrowser(GenericBrowser): - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... +class BackgroundBrowser(GenericBrowser): ... class UnixBrowser(BaseBrowser): + def open(self, url: str, new: Literal[0, 1, 2] = ..., autoraise: bool = ...) -> bool: ... # type: ignore[override] raise_opts: list[str] | None background: bool redirect_stdout: bool @@ -45,43 +40,15 @@ class UnixBrowser(BaseBrowser): remote_action: str remote_action_newwin: str remote_action_newtab: str - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... -class Mozilla(UnixBrowser): - remote_args: list[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool +class Mozilla(UnixBrowser): ... class Galeon(UnixBrowser): raise_opts: list[str] - remote_args: list[str] - remote_action: str - remote_action_newwin: str - background: bool - -class Chrome(UnixBrowser): - remote_args: list[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool - -class Opera(UnixBrowser): - remote_args: list[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool -class Elinks(UnixBrowser): - remote_args: list[str] - remote_action: str - remote_action_newwin: str - remote_action_newtab: str - background: bool - redirect_stdout: bool +class Chrome(UnixBrowser): ... +class Opera(UnixBrowser): ... +class Elinks(UnixBrowser): ... class Konqueror(BaseBrowser): def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... @@ -95,9 +62,7 @@ if sys.platform == "win32": if sys.platform == "darwin": class MacOSX(BaseBrowser): - name: str - def __init__(self, name: str) -> None: ... def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... - class MacOSXOSAScript(BaseBrowser): - def __init__(self, name: str) -> None: ... + + class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename` def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... diff --git a/stdlib/winreg.pyi b/stdlib/winreg.pyi index 3c7ab01..2cc4231 100644 --- a/stdlib/winreg.pyi +++ b/stdlib/winreg.pyi @@ -1,99 +1,101 @@ +import sys from _typeshed import Self from types import TracebackType -from typing import Any, Tuple, Type, Union +from typing import Any +from typing_extensions import Literal, TypeAlias, final -_KeyType = Union[HKEYType, int] +if sys.platform == "win32": + _KeyType: TypeAlias = HKEYType | int + def CloseKey(__hkey: _KeyType) -> None: ... + def ConnectRegistry(__computer_name: str | None, __key: _KeyType) -> HKEYType: ... + def CreateKey(__key: _KeyType, __sub_key: str | None) -> HKEYType: ... + def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = ..., access: int = ...) -> HKEYType: ... + def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ... + def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ... + def DeleteValue(__key: _KeyType, __value: str) -> None: ... + def EnumKey(__key: _KeyType, __index: int) -> str: ... + def EnumValue(__key: _KeyType, __index: int) -> tuple[str, Any, int]: ... + def ExpandEnvironmentStrings(__str: str) -> str: ... + def FlushKey(__key: _KeyType) -> None: ... + def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ... + def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... + def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... + def QueryInfoKey(__key: _KeyType) -> tuple[int, int, int]: ... + def QueryValue(__key: _KeyType, __sub_key: str | None) -> str: ... + def QueryValueEx(__key: _KeyType, __name: str) -> tuple[Any, int]: ... + def SaveKey(__key: _KeyType, __file_name: str) -> None: ... + def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ... + def SetValueEx( + __key: _KeyType, __value_name: str | None, __reserved: Any, __type: int, __value: str | int + ) -> None: ... # reserved is ignored + def DisableReflectionKey(__key: _KeyType) -> None: ... + def EnableReflectionKey(__key: _KeyType) -> None: ... + def QueryReflectionKey(__key: _KeyType) -> bool: ... + HKEY_CLASSES_ROOT: int + HKEY_CURRENT_USER: int + HKEY_LOCAL_MACHINE: int + HKEY_USERS: int + HKEY_PERFORMANCE_DATA: int + HKEY_CURRENT_CONFIG: int + HKEY_DYN_DATA: int -def CloseKey(__hkey: _KeyType) -> None: ... -def ConnectRegistry(__computer_name: str | None, __key: _KeyType) -> HKEYType: ... -def CreateKey(__key: _KeyType, __sub_key: str | None) -> HKEYType: ... -def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = ..., access: int = ...) -> HKEYType: ... -def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ... -def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ... -def DeleteValue(__key: _KeyType, __value: str) -> None: ... -def EnumKey(__key: _KeyType, __index: int) -> str: ... -def EnumValue(__key: _KeyType, __index: int) -> Tuple[str, Any, int]: ... -def ExpandEnvironmentStrings(__str: str) -> str: ... -def FlushKey(__key: _KeyType) -> None: ... -def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ... -def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... -def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ... -def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ... -def QueryValue(__key: _KeyType, __sub_key: str | None) -> str: ... -def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ... -def SaveKey(__key: _KeyType, __file_name: str) -> None: ... -def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ... -def SetValueEx( - __key: _KeyType, __value_name: str | None, __reserved: Any, __type: int, __value: str | int -) -> None: ... # reserved is ignored -def DisableReflectionKey(__key: _KeyType) -> None: ... -def EnableReflectionKey(__key: _KeyType) -> None: ... -def QueryReflectionKey(__key: _KeyType) -> bool: ... + KEY_ALL_ACCESS: Literal[983103] + KEY_WRITE: Literal[131078] + KEY_READ: Literal[131097] + KEY_EXECUTE: Literal[131097] + KEY_QUERY_VALUE: Literal[1] + KEY_SET_VALUE: Literal[2] + KEY_CREATE_SUB_KEY: Literal[4] + KEY_ENUMERATE_SUB_KEYS: Literal[8] + KEY_NOTIFY: Literal[16] + KEY_CREATE_LINK: Literal[32] -HKEY_CLASSES_ROOT: int -HKEY_CURRENT_USER: int -HKEY_LOCAL_MACHINE: int -HKEY_USERS: int -HKEY_PERFORMANCE_DATA: int -HKEY_CURRENT_CONFIG: int -HKEY_DYN_DATA: int + KEY_WOW64_64KEY: Literal[256] + KEY_WOW64_32KEY: Literal[512] -KEY_ALL_ACCESS: int -KEY_WRITE: int -KEY_READ: int -KEY_EXECUTE: int -KEY_QUERY_VALUE: int -KEY_SET_VALUE: int -KEY_CREATE_SUB_KEY: int -KEY_ENUMERATE_SUB_KEYS: int -KEY_NOTIFY: int -KEY_CREATE_LINK: int + REG_BINARY: Literal[3] + REG_DWORD: Literal[4] + REG_DWORD_LITTLE_ENDIAN: Literal[4] + REG_DWORD_BIG_ENDIAN: Literal[5] + REG_EXPAND_SZ: Literal[2] + REG_LINK: Literal[6] + REG_MULTI_SZ: Literal[7] + REG_NONE: Literal[0] + REG_QWORD: Literal[11] + REG_QWORD_LITTLE_ENDIAN: Literal[11] + REG_RESOURCE_LIST: Literal[8] + REG_FULL_RESOURCE_DESCRIPTOR: Literal[9] + REG_RESOURCE_REQUIREMENTS_LIST: Literal[10] + REG_SZ: Literal[1] -KEY_WOW64_64KEY: int -KEY_WOW64_32KEY: int + REG_CREATED_NEW_KEY: int # undocumented + REG_LEGAL_CHANGE_FILTER: int # undocumented + REG_LEGAL_OPTION: int # undocumented + REG_NOTIFY_CHANGE_ATTRIBUTES: int # undocumented + REG_NOTIFY_CHANGE_LAST_SET: int # undocumented + REG_NOTIFY_CHANGE_NAME: int # undocumented + REG_NOTIFY_CHANGE_SECURITY: int # undocumented + REG_NO_LAZY_FLUSH: int # undocumented + REG_OPENED_EXISTING_KEY: int # undocumented + REG_OPTION_BACKUP_RESTORE: int # undocumented + REG_OPTION_CREATE_LINK: int # undocumented + REG_OPTION_NON_VOLATILE: int # undocumented + REG_OPTION_OPEN_LINK: int # undocumented + REG_OPTION_RESERVED: int # undocumented + REG_OPTION_VOLATILE: int # undocumented + REG_REFRESH_HIVE: int # undocumented + REG_WHOLE_HIVE_VOLATILE: int # undocumented -REG_BINARY: int -REG_DWORD: int -REG_DWORD_LITTLE_ENDIAN: int -REG_DWORD_BIG_ENDIAN: int -REG_EXPAND_SZ: int -REG_LINK: int -REG_MULTI_SZ: int -REG_NONE: int -REG_QWORD: int -REG_QWORD_LITTLE_ENDIAN: int -REG_RESOURCE_LIST: int -REG_FULL_RESOURCE_DESCRIPTOR: int -REG_RESOURCE_REQUIREMENTS_LIST: int -REG_SZ: int + error = OSError -REG_CREATED_NEW_KEY: int # undocumented -REG_LEGAL_CHANGE_FILTER: int # undocumented -REG_LEGAL_OPTION: int # undocumented -REG_NOTIFY_CHANGE_ATTRIBUTES: int # undocumented -REG_NOTIFY_CHANGE_LAST_SET: int # undocumented -REG_NOTIFY_CHANGE_NAME: int # undocumented -REG_NOTIFY_CHANGE_SECURITY: int # undocumented -REG_NO_LAZY_FLUSH: int # undocumented -REG_OPENED_EXISTING_KEY: int # undocumented -REG_OPTION_BACKUP_RESTORE: int # undocumented -REG_OPTION_CREATE_LINK: int # undocumented -REG_OPTION_NON_VOLATILE: int # undocumented -REG_OPTION_OPEN_LINK: int # undocumented -REG_OPTION_RESERVED: int # undocumented -REG_OPTION_VOLATILE: int # undocumented -REG_REFRESH_HIVE: int # undocumented -REG_WHOLE_HIVE_VOLATILE: int # undocumented - -error = OSError - -# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason -class HKEYType: - def __bool__(self) -> bool: ... - def __int__(self) -> int: ... - def __enter__(self: Self) -> Self: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def Close(self) -> None: ... - def Detach(self) -> int: ... + # Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason + @final + class HKEYType: + def __bool__(self) -> bool: ... + def __int__(self) -> int: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None + ) -> bool | None: ... + def Close(self) -> None: ... + def Detach(self) -> int: ... diff --git a/stdlib/winsound.pyi b/stdlib/winsound.pyi index 3d79f3b..fd5a552 100644 --- a/stdlib/winsound.pyi +++ b/stdlib/winsound.pyi @@ -1,27 +1,28 @@ import sys +from _typeshed import ReadableBuffer from typing import overload from typing_extensions import Literal if sys.platform == "win32": - SND_FILENAME: int - SND_ALIAS: int - SND_LOOP: int - SND_MEMORY: int - SND_PURGE: int - SND_ASYNC: int - SND_NODEFAULT: int - SND_NOSTOP: int - SND_NOWAIT: int + SND_FILENAME: Literal[131072] + SND_ALIAS: Literal[65536] + SND_LOOP: Literal[8] + SND_MEMORY: Literal[4] + SND_PURGE: Literal[64] + SND_ASYNC: Literal[1] + SND_NODEFAULT: Literal[2] + SND_NOSTOP: Literal[16] + SND_NOWAIT: Literal[8192] - MB_ICONASTERISK: int - MB_ICONEXCLAMATION: int - MB_ICONHAND: int - MB_ICONQUESTION: int - MB_OK: int + MB_ICONASTERISK: Literal[64] + MB_ICONEXCLAMATION: Literal[48] + MB_ICONHAND: Literal[16] + MB_ICONQUESTION: Literal[32] + MB_OK: Literal[0] def Beep(frequency: int, duration: int) -> None: ... # Can actually accept anything ORed with 4, and if not it's definitely str, but that's inexpressible @overload - def PlaySound(sound: bytes | None, flags: Literal[4]) -> None: ... + def PlaySound(sound: ReadableBuffer | None, flags: Literal[4]) -> None: ... @overload - def PlaySound(sound: str | bytes | None, flags: int) -> None: ... + def PlaySound(sound: str | ReadableBuffer | None, flags: int) -> None: ... def MessageBeep(type: int = ...) -> None: ... diff --git a/stdlib/wsgiref/handlers.pyi b/stdlib/wsgiref/handlers.pyi index b989938..655fba6 100644 --- a/stdlib/wsgiref/handlers.pyi +++ b/stdlib/wsgiref/handlers.pyi @@ -1,18 +1,19 @@ +from _typeshed import OptExcInfo +from _typeshed.wsgi import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment from abc import abstractmethod -from types import TracebackType -from typing import IO, Callable, MutableMapping, Optional, Tuple, Type +from collections.abc import Callable, MutableMapping +from typing import IO from .headers import Headers -from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment from .util import FileWrapper -_exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +__all__ = ["BaseHandler", "SimpleHandler", "BaseCGIHandler", "CGIHandler", "IISCGIHandler", "read_environ"] def format_date_time(timestamp: float | None) -> str: ... # undocumented def read_environ() -> dict[str, str]: ... class BaseHandler: - wsgi_version: Tuple[int, int] # undocumented + wsgi_version: tuple[int, int] # undocumented wsgi_multithread: bool wsgi_multiprocess: bool wsgi_run_once: bool @@ -23,12 +24,12 @@ class BaseHandler: os_environ: MutableMapping[str, str] - wsgi_file_wrapper: Type[FileWrapper] | None - headers_class: Type[Headers] # undocumented + wsgi_file_wrapper: type[FileWrapper] | None + headers_class: type[Headers] # undocumented traceback_limit: int | None error_status: str - error_headers: list[Tuple[str, str]] + error_headers: list[tuple[str, str]] error_body: bytes def run(self, application: WSGIApplication) -> None: ... def setup_environ(self) -> None: ... @@ -37,7 +38,7 @@ class BaseHandler: def set_content_length(self) -> None: ... def cleanup_headers(self) -> None: ... def start_response( - self, status: str, headers: list[Tuple[str, str]], exc_info: _exc_info | None = ... + self, status: str, headers: list[tuple[str, str]], exc_info: OptExcInfo | None = ... ) -> Callable[[bytes], None]: ... def send_preamble(self) -> None: ... def write(self, data: bytes) -> None: ... @@ -47,7 +48,7 @@ class BaseHandler: def send_headers(self) -> None: ... def result_is_file(self) -> bool: ... def client_is_modern(self) -> bool: ... - def log_exception(self, exc_info: _exc_info) -> None: ... + def log_exception(self, exc_info: OptExcInfo) -> None: ... def handle_error(self) -> None: ... def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... @abstractmethod diff --git a/stdlib/wsgiref/headers.pyi b/stdlib/wsgiref/headers.pyi index 531a521..dd963d9 100644 --- a/stdlib/wsgiref/headers.pyi +++ b/stdlib/wsgiref/headers.pyi @@ -1,6 +1,8 @@ -from typing import List, Pattern, Tuple, overload +from re import Pattern +from typing import overload +from typing_extensions import TypeAlias -_HeaderList = List[Tuple[str, str]] +_HeaderList: TypeAlias = list[tuple[str, str]] tspecials: Pattern[str] # undocumented diff --git a/stdlib/wsgiref/simple_server.pyi b/stdlib/wsgiref/simple_server.pyi index 76d0b26..547f562 100644 --- a/stdlib/wsgiref/simple_server.pyi +++ b/stdlib/wsgiref/simple_server.pyi @@ -1,8 +1,10 @@ +from _typeshed.wsgi import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment from http.server import BaseHTTPRequestHandler, HTTPServer -from typing import Type, TypeVar, overload +from typing import TypeVar, overload from .handlers import SimpleHandler -from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment + +__all__ = ["WSGIServer", "WSGIRequestHandler", "demo_app", "make_server"] server_version: str # undocumented sys_version: str # undocumented @@ -10,7 +12,6 @@ software_version: str # undocumented class ServerHandler(SimpleHandler): # undocumented server_software: str - def close(self) -> None: ... class WSGIServer(HTTPServer): application: WSGIApplication | None @@ -23,15 +24,14 @@ class WSGIRequestHandler(BaseHTTPRequestHandler): server_version: str def get_environ(self) -> WSGIEnvironment: ... def get_stderr(self) -> ErrorStream: ... - def handle(self) -> None: ... def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... _S = TypeVar("_S", bound=WSGIServer) @overload -def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: Type[WSGIRequestHandler] = ...) -> WSGIServer: ... +def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: type[WSGIRequestHandler] = ...) -> WSGIServer: ... @overload def make_server( - host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ... + host: str, port: int, app: WSGIApplication, server_class: type[_S], handler_class: type[WSGIRequestHandler] = ... ) -> _S: ... diff --git a/stdlib/wsgiref/types.pyi b/stdlib/wsgiref/types.pyi index c272ae6..4e8f472 100644 --- a/stdlib/wsgiref/types.pyi +++ b/stdlib/wsgiref/types.pyi @@ -1,3 +1,32 @@ -# Obsolete, use _typeshed.wsgi directly. +from collections.abc import Callable, Iterable, Iterator +from sys import _OptExcInfo +from typing import Any, Protocol +from typing_extensions import TypeAlias -from _typeshed.wsgi import * +__all__ = ["StartResponse", "WSGIEnvironment", "WSGIApplication", "InputStream", "ErrorStream", "FileWrapper"] + +class StartResponse(Protocol): + def __call__( + self, __status: str, __headers: list[tuple[str, str]], __exc_info: _OptExcInfo | None = ... + ) -> Callable[[bytes], object]: ... + +WSGIEnvironment: TypeAlias = dict[str, Any] +WSGIApplication: TypeAlias = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] + +class InputStream(Protocol): + def read(self, __size: int = ...) -> bytes: ... + def readline(self, __size: int = ...) -> bytes: ... + def readlines(self, __hint: int = ...) -> list[bytes]: ... + def __iter__(self) -> Iterator[bytes]: ... + +class ErrorStream(Protocol): + def flush(self) -> object: ... + def write(self, __s: str) -> object: ... + def writelines(self, __seq: list[str]) -> object: ... + +class _Readable(Protocol): + def read(self, __size: int = ...) -> bytes: ... + # Optional: def close(self) -> object: ... + +class FileWrapper(Protocol): + def __call__(self, __file: _Readable, __block_size: int = ...) -> Iterable[bytes]: ... diff --git a/stdlib/wsgiref/util.pyi b/stdlib/wsgiref/util.pyi index a7f710e..36e5c1e 100644 --- a/stdlib/wsgiref/util.pyi +++ b/stdlib/wsgiref/util.pyi @@ -1,13 +1,18 @@ -from typing import IO, Any, Callable +import sys +from _typeshed.wsgi import WSGIEnvironment +from collections.abc import Callable +from typing import IO, Any -from .types import WSGIEnvironment +__all__ = ["FileWrapper", "guess_scheme", "application_uri", "request_uri", "shift_path_info", "setup_testing_defaults"] class FileWrapper: filelike: IO[bytes] blksize: int close: Callable[[], None] # only exists if filelike.close exists def __init__(self, filelike: IO[bytes], blksize: int = ...) -> None: ... - def __getitem__(self, key: Any) -> bytes: ... + if sys.version_info < (3, 11): + def __getitem__(self, key: Any) -> bytes: ... + def __iter__(self) -> FileWrapper: ... def __next__(self) -> bytes: ... diff --git a/stdlib/wsgiref/validate.pyi b/stdlib/wsgiref/validate.pyi index 68e2272..fa8a6bb 100644 --- a/stdlib/wsgiref/validate.pyi +++ b/stdlib/wsgiref/validate.pyi @@ -1,5 +1,9 @@ from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication -from typing import Any, Callable, Iterable, Iterator, NoReturn +from collections.abc import Callable, Iterable, Iterator +from typing import Any, NoReturn +from typing_extensions import TypeAlias + +__all__ = ["validator"] class WSGIWarning(Warning): ... @@ -11,7 +15,7 @@ class InputWrapper: def read(self, size: int) -> bytes: ... def readline(self, size: int = ...) -> bytes: ... def readlines(self, hint: int = ...) -> bytes: ... - def __iter__(self) -> Iterable[bytes]: ... + def __iter__(self) -> Iterator[bytes]: ... def close(self) -> NoReturn: ... class ErrorWrapper: @@ -22,9 +26,11 @@ class ErrorWrapper: def writelines(self, seq: Iterable[str]) -> None: ... def close(self) -> NoReturn: ... +_WriterCallback: TypeAlias = Callable[[bytes], Any] + class WriteWrapper: - writer: Callable[[bytes], Any] - def __init__(self, wsgi_writer: Callable[[bytes], Any]) -> None: ... + writer: _WriterCallback + def __init__(self, wsgi_writer: _WriterCallback) -> None: ... def __call__(self, s: bytes) -> None: ... class PartialIteratorWrapper: diff --git a/stdlib/xdrlib.pyi b/stdlib/xdrlib.pyi index f59843f..78f3ece 100644 --- a/stdlib/xdrlib.pyi +++ b/stdlib/xdrlib.pyi @@ -1,4 +1,7 @@ -from typing import Callable, Sequence, TypeVar +from collections.abc import Callable, Sequence +from typing import TypeVar + +__all__ = ["Error", "Packer", "Unpacker", "ConversionError"] _T = TypeVar("_T") @@ -9,7 +12,6 @@ class Error(Exception): class ConversionError(Error): ... class Packer: - def __init__(self) -> None: ... def reset(self) -> None: ... def get_buffer(self) -> bytes: ... def get_buf(self) -> bytes: ... @@ -26,9 +28,9 @@ class Packer: def pack_string(self, s: bytes) -> None: ... def pack_opaque(self, s: bytes) -> None: ... def pack_bytes(self, s: bytes) -> None: ... - def pack_list(self, list: Sequence[_T], pack_item: Callable[[_T], None]) -> None: ... - def pack_farray(self, n: int, list: Sequence[_T], pack_item: Callable[[_T], None]) -> None: ... - def pack_array(self, list: Sequence[_T], pack_item: Callable[[_T], None]) -> None: ... + def pack_list(self, list: Sequence[_T], pack_item: Callable[[_T], object]) -> None: ... + def pack_farray(self, n: int, list: Sequence[_T], pack_item: Callable[[_T], object]) -> None: ... + def pack_array(self, list: Sequence[_T], pack_item: Callable[[_T], object]) -> None: ... class Unpacker: def __init__(self, data: bytes) -> None: ... diff --git a/stdlib/xml/__init__.pyi b/stdlib/xml/__init__.pyi index c524ac2..a487d24 100644 --- a/stdlib/xml/__init__.pyi +++ b/stdlib/xml/__init__.pyi @@ -1 +1 @@ -import xml.parsers as parsers +from xml import parsers as parsers diff --git a/stdlib/xml/dom/__init__.pyi b/stdlib/xml/dom/__init__.pyi index c5766c3..e5b91bf 100644 --- a/stdlib/xml/dom/__init__.pyi +++ b/stdlib/xml/dom/__init__.pyi @@ -43,6 +43,7 @@ class IndexSizeErr(DOMException): ... class DomstringSizeErr(DOMException): ... class HierarchyRequestErr(DOMException): ... class WrongDocumentErr(DOMException): ... +class InvalidCharacterErr(DOMException): ... class NoDataAllowedErr(DOMException): ... class NoModificationAllowedErr(DOMException): ... class NotFoundErr(DOMException): ... diff --git a/stdlib/xml/dom/domreg.pyi b/stdlib/xml/dom/domreg.pyi index 64c18ae..5a276ae 100644 --- a/stdlib/xml/dom/domreg.pyi +++ b/stdlib/xml/dom/domreg.pyi @@ -1,8 +1,8 @@ from _typeshed.xml import DOMImplementation -from typing import Callable, Iterable, Tuple +from collections.abc import Callable, Iterable well_known_implementations: dict[str, str] registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation(name: str | None = ..., features: str | Iterable[Tuple[str, str | None]] = ...) -> DOMImplementation: ... +def getDOMImplementation(name: str | None = ..., features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... diff --git a/stdlib/xml/dom/expatbuilder.pyi b/stdlib/xml/dom/expatbuilder.pyi index 964e6fa..3ca885d 100644 --- a/stdlib/xml/dom/expatbuilder.pyi +++ b/stdlib/xml/dom/expatbuilder.pyi @@ -1,3 +1,100 @@ -from typing import Any +from _typeshed import Incomplete +from typing import Any, NoReturn +from xml.dom.minidom import Document, DOMImplementation, Node, TypeInfo +from xml.dom.xmlbuilder import DOMBuilderFilter, Options -def __getattr__(name: str) -> Any: ... # incomplete +TEXT_NODE = Node.TEXT_NODE +CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE +DOCUMENT_NODE = Node.DOCUMENT_NODE +FILTER_ACCEPT = DOMBuilderFilter.FILTER_ACCEPT +FILTER_REJECT = DOMBuilderFilter.FILTER_REJECT +FILTER_SKIP = DOMBuilderFilter.FILTER_SKIP +FILTER_INTERRUPT = DOMBuilderFilter.FILTER_INTERRUPT +theDOMImplementation: DOMImplementation | None + +class ElementInfo: + tagName: Incomplete + def __init__(self, tagName, model: Incomplete | None = ...) -> None: ... + def getAttributeType(self, aname) -> TypeInfo: ... + def getAttributeTypeNS(self, namespaceURI, localName) -> TypeInfo: ... + def isElementContent(self) -> bool: ... + def isEmpty(self) -> bool: ... + def isId(self, aname) -> bool: ... + def isIdNS(self, euri, ename, auri, aname) -> bool: ... + +class ExpatBuilder: + document: Document # Created in self.reset() + curNode: Incomplete # Created in self.reset() + def __init__(self, options: Options | None = ...) -> None: ... + def createParser(self): ... + def getParser(self): ... + def reset(self) -> None: ... + def install(self, parser) -> None: ... + def parseFile(self, file) -> Document: ... + def parseString(self, string: str) -> Document: ... + def start_doctype_decl_handler(self, doctypeName, systemId, publicId, has_internal_subset) -> None: ... + def end_doctype_decl_handler(self) -> None: ... + def pi_handler(self, target, data) -> None: ... + def character_data_handler_cdata(self, data) -> None: ... + def character_data_handler(self, data) -> None: ... + def start_cdata_section_handler(self) -> None: ... + def end_cdata_section_handler(self) -> None: ... + def entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName) -> None: ... + def notation_decl_handler(self, notationName, base, systemId, publicId) -> None: ... + def comment_handler(self, data) -> None: ... + def external_entity_ref_handler(self, context, base, systemId, publicId) -> int: ... + def first_element_handler(self, name, attributes) -> None: ... + def start_element_handler(self, name, attributes) -> None: ... + def end_element_handler(self, name) -> None: ... + def element_decl_handler(self, name, model) -> None: ... + def attlist_decl_handler(self, elem, name, type, default, required) -> None: ... + def xml_decl_handler(self, version, encoding, standalone) -> None: ... + +class FilterVisibilityController: + filter: DOMBuilderFilter + def __init__(self, filter: DOMBuilderFilter) -> None: ... + def startContainer(self, node: Node) -> int: ... + def acceptNode(self, node: Node) -> int: ... + +class FilterCrutch: + def __init__(self, builder) -> None: ... + +class Rejecter(FilterCrutch): + def start_element_handler(self, *args: Any) -> None: ... + def end_element_handler(self, *args: Any) -> None: ... + +class Skipper(FilterCrutch): + def start_element_handler(self, *args: Any) -> None: ... + def end_element_handler(self, *args: Any) -> None: ... + +class FragmentBuilder(ExpatBuilder): + fragment: Incomplete | None + originalDocument: Incomplete + context: Incomplete + def __init__(self, context, options: Options | None = ...) -> None: ... + +class Namespaces: + def createParser(self): ... + def install(self, parser) -> None: ... + def start_namespace_decl_handler(self, prefix, uri) -> None: ... + def start_element_handler(self, name, attributes) -> None: ... + def end_element_handler(self, name) -> None: ... + +class ExpatBuilderNS(Namespaces, ExpatBuilder): ... +class FragmentBuilderNS(Namespaces, FragmentBuilder): ... +class ParseEscape(Exception): ... + +class InternalSubsetExtractor(ExpatBuilder): + subset: Any | None + def getSubset(self) -> Any | None: ... + def parseFile(self, file) -> None: ... # type: ignore[override] + def parseString(self, string: str) -> None: ... # type: ignore[override] + def start_doctype_decl_handler(self, name, publicId, systemId, has_internal_subset) -> None: ... # type: ignore[override] + def end_doctype_decl_handler(self) -> NoReturn: ... + def start_element_handler(self, name, attrs) -> NoReturn: ... + +def parse(file, namespaces: bool = ...): ... +def parseString(string: str, namespaces: bool = ...): ... +def parseFragment(file, context, namespaces: bool = ...): ... +def parseFragmentString(string: str, context, namespaces: bool = ...): ... +def makeBuilder(options: Options) -> ExpatBuilderNS | ExpatBuilder: ... diff --git a/stdlib/xml/dom/minicompat.pyi b/stdlib/xml/dom/minicompat.pyi index e9b0395..4507b3d 100644 --- a/stdlib/xml/dom/minicompat.pyi +++ b/stdlib/xml/dom/minicompat.pyi @@ -1,17 +1,20 @@ -from typing import Any, Iterable, List, Tuple, Type, TypeVar +from collections.abc import Iterable +from typing import Any, TypeVar + +__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"] _T = TypeVar("_T") -StringTypes: Tuple[Type[str]] +StringTypes: tuple[type[str]] -class NodeList(List[_T]): +class NodeList(list[_T]): length: int def item(self, index: int) -> _T | None: ... -class EmptyNodeList(Tuple[Any, ...]): +class EmptyNodeList(tuple[Any, ...]): length: int def item(self, index: int) -> None: ... - def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore + def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore[override] def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ... -def defproperty(klass: Type[Any], name: str, doc: str) -> None: ... +def defproperty(klass: type[Any], name: str, doc: str) -> None: ... diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index 4d1d7a9..04086fd 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -1,33 +1,35 @@ import sys import xml.dom -from _typeshed import Self -from typing import IO, Any +from _typeshed import Incomplete, Self, SupportsRead, SupportsWrite +from typing_extensions import Literal from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS from xml.sax.xmlreader import XMLReader -def parse(file: str | IO[Any], parser: XMLReader | None = ..., bufsize: int | None = ...): ... +def parse(file: str | SupportsRead[bytes] | SupportsRead[str], parser: XMLReader | None = ..., bufsize: int | None = ...): ... def parseString(string: str | bytes, parser: XMLReader | None = ...): ... def getDOMImplementation(features=...) -> DOMImplementation | None: ... class Node(xml.dom.Node): namespaceURI: str | None - parentNode: Any - ownerDocument: Any - nextSibling: Any - previousSibling: Any - prefix: Any + parentNode: Incomplete + ownerDocument: Incomplete + nextSibling: Incomplete + previousSibling: Incomplete + prefix: Incomplete @property def firstChild(self) -> Node | None: ... @property def lastChild(self) -> Node | None: ... @property def localName(self) -> str | None: ... + def __bool__(self) -> Literal[True]: ... if sys.version_info >= (3, 9): - def toxml(self, encoding: Any | None = ..., standalone: Any | None = ...): ... - def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Any | None = ..., standalone: Any | None = ...): ... + def toxml(self, encoding: str | None = ..., standalone: bool | None = ...): ... + def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: str | None = ..., standalone: bool | None = ...): ... else: - def toxml(self, encoding: Any | None = ...): ... - def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Any | None = ...): ... + def toxml(self, encoding: str | None = ...): ... + def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: str | None = ...): ... + def hasChildNodes(self) -> bool: ... def insertBefore(self, newChild, refChild): ... def appendChild(self, node): ... @@ -40,36 +42,40 @@ class Node(xml.dom.Node): def getInterface(self, feature): ... def getUserData(self, key): ... def setUserData(self, key, data, handler): ... - childNodes: Any + childNodes: Incomplete def unlink(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, et, ev, tb) -> None: ... class DocumentFragment(Node): - nodeType: Any + nodeType: int nodeName: str - nodeValue: Any - attributes: Any - parentNode: Any - childNodes: Any + nodeValue: Incomplete + attributes: Incomplete + parentNode: Incomplete + childNodes: Incomplete def __init__(self) -> None: ... class Attr(Node): name: str - nodeType: Any - attributes: Any + nodeType: int + attributes: Incomplete specified: bool - ownerElement: Any + ownerElement: Incomplete namespaceURI: str | None - childNodes: Any - nodeName: Any + childNodes: Incomplete + nodeName: Incomplete nodeValue: str value: str - prefix: Any + prefix: Incomplete def __init__( - self, qName: str, namespaceURI: str | None = ..., localName: Any | None = ..., prefix: Any | None = ... + self, qName: str, namespaceURI: str | None = ..., localName: str | None = ..., prefix: Incomplete | None = ... ) -> None: ... def unlink(self) -> None: ... + @property + def isId(self) -> bool: ... + @property + def schemaType(self): ... class NamedNodeMap: def __init__(self, attrs, attrsNS, ownerElement) -> None: ... @@ -80,71 +86,76 @@ class NamedNodeMap: def keys(self): ... def keysNS(self): ... def values(self): ... - def get(self, name, value: Any | None = ...): ... + def get(self, name: str, value: Incomplete | None = ...): ... def __len__(self) -> int: ... - def __eq__(self, other: Any) -> bool: ... - def __ge__(self, other: Any) -> bool: ... - def __gt__(self, other: Any) -> bool: ... - def __le__(self, other: Any) -> bool: ... - def __lt__(self, other: Any) -> bool: ... - def __getitem__(self, attname_or_tuple): ... - def __setitem__(self, attname, value) -> None: ... - def getNamedItem(self, name): ... - def getNamedItemNS(self, namespaceURI: str, localName): ... - def removeNamedItem(self, name): ... - def removeNamedItemNS(self, namespaceURI: str, localName): ... - def setNamedItem(self, node): ... - def setNamedItemNS(self, node): ... - def __delitem__(self, attname_or_tuple) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ge__(self, other: NamedNodeMap) -> bool: ... + def __gt__(self, other: NamedNodeMap) -> bool: ... + def __le__(self, other: NamedNodeMap) -> bool: ... + def __lt__(self, other: NamedNodeMap) -> bool: ... + def __getitem__(self, attname_or_tuple: tuple[str, str | None] | str): ... + def __setitem__(self, attname: str, value: Attr | str) -> None: ... + def getNamedItem(self, name: str) -> Attr | None: ... + def getNamedItemNS(self, namespaceURI: str, localName: str | None) -> Attr | None: ... + def removeNamedItem(self, name: str) -> Attr: ... + def removeNamedItemNS(self, namespaceURI: str, localName: str | None): ... + def setNamedItem(self, node: Attr) -> Attr: ... + def setNamedItemNS(self, node: Attr) -> Attr: ... + def __delitem__(self, attname_or_tuple: tuple[str, str | None] | str) -> None: ... + @property + def length(self) -> int: ... AttributeList = NamedNodeMap class TypeInfo: - namespace: Any - name: Any - def __init__(self, namespace, name) -> None: ... + namespace: Incomplete | None + name: str + def __init__(self, namespace: Incomplete | None, name: str) -> None: ... class Element(Node): - nodeType: Any - nodeValue: Any - schemaType: Any - parentNode: Any + nodeType: int + nodeValue: Incomplete + schemaType: Incomplete + parentNode: Incomplete tagName: str - prefix: Any + nodeName: str + prefix: Incomplete namespaceURI: str | None - childNodes: Any - nextSibling: Any + childNodes: Incomplete + nextSibling: Incomplete def __init__( - self, tagName, namespaceURI: str | None = ..., prefix: Any | None = ..., localName: Any | None = ... + self, tagName, namespaceURI: str | None = ..., prefix: Incomplete | None = ..., localName: Incomplete | None = ... ) -> None: ... def unlink(self) -> None: ... - def getAttribute(self, attname): ... + def getAttribute(self, attname: str) -> str: ... def getAttributeNS(self, namespaceURI: str, localName): ... - def setAttribute(self, attname, value) -> None: ... + def setAttribute(self, attname: str, value: str) -> None: ... def setAttributeNS(self, namespaceURI: str, qualifiedName: str, value) -> None: ... - def getAttributeNode(self, attrname): ... + def getAttributeNode(self, attrname: str): ... def getAttributeNodeNS(self, namespaceURI: str, localName): ... def setAttributeNode(self, attr): ... - setAttributeNodeNS: Any - def removeAttribute(self, name) -> None: ... + setAttributeNodeNS: Incomplete + def removeAttribute(self, name: str) -> None: ... def removeAttributeNS(self, namespaceURI: str, localName) -> None: ... def removeAttributeNode(self, node): ... - removeAttributeNodeNS: Any + removeAttributeNodeNS: Incomplete def hasAttribute(self, name: str) -> bool: ... def hasAttributeNS(self, namespaceURI: str, localName) -> bool: ... - def getElementsByTagName(self, name): ... + def getElementsByTagName(self, name: str): ... def getElementsByTagNameNS(self, namespaceURI: str, localName): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... def hasAttributes(self) -> bool: ... def setIdAttribute(self, name) -> None: ... def setIdAttributeNS(self, namespaceURI: str, localName) -> None: ... def setIdAttributeNode(self, idAttr) -> None: ... + @property + def attributes(self) -> NamedNodeMap: ... class Childless: - attributes: Any - childNodes: Any - firstChild: Any - lastChild: Any + attributes: Incomplete + childNodes: Incomplete + firstChild: Incomplete + lastChild: Incomplete def appendChild(self, node) -> None: ... def hasChildNodes(self) -> bool: ... def insertBefore(self, newChild, refChild) -> None: ... @@ -153,46 +164,52 @@ class Childless: def replaceChild(self, newChild, oldChild) -> None: ... class ProcessingInstruction(Childless, Node): - nodeType: Any - target: Any - data: Any + nodeType: int + target: Incomplete + data: Incomplete def __init__(self, target, data) -> None: ... - nodeValue: Any - nodeName: Any - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + nodeValue: Incomplete + nodeName: Incomplete + def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... class CharacterData(Childless, Node): - ownerDocument: Any - previousSibling: Any + ownerDocument: Incomplete + previousSibling: Incomplete def __init__(self) -> None: ... def __len__(self) -> int: ... data: str - nodeValue: Any + nodeValue: Incomplete def substringData(self, offset: int, count: int) -> str: ... def appendData(self, arg: str) -> None: ... def insertData(self, offset: int, arg: str) -> None: ... def deleteData(self, offset: int, count: int) -> None: ... def replaceData(self, offset: int, count: int, arg: str) -> None: ... + @property + def length(self) -> int: ... class Text(CharacterData): - nodeType: Any + nodeType: int nodeName: str - attributes: Any - data: Any + attributes: Incomplete + data: Incomplete def splitText(self, offset): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... def replaceWholeText(self, content): ... + @property + def isWhitespaceInElementContent(self) -> bool: ... + @property + def wholeText(self) -> str: ... class Comment(CharacterData): - nodeType: Any + nodeType: int nodeName: str def __init__(self, data) -> None: ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... class CDATASection(Text): - nodeType: Any + nodeType: int nodeName: str - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... class ReadOnlySequentialNamedNodeMap: def __init__(self, seq=...) -> None: ... @@ -205,33 +222,35 @@ class ReadOnlySequentialNamedNodeMap: def removeNamedItemNS(self, namespaceURI: str, localName) -> None: ... def setNamedItem(self, node) -> None: ... def setNamedItemNS(self, node) -> None: ... + @property + def length(self) -> int: ... -class Identified: ... +class Identified: + publicId: Incomplete + systemId: Incomplete class DocumentType(Identified, Childless, Node): - nodeType: Any - nodeValue: Any - name: Any - publicId: Any - systemId: Any - internalSubset: Any - entities: Any - notations: Any - nodeName: Any + nodeType: int + nodeValue: Incomplete + name: Incomplete + internalSubset: Incomplete + entities: Incomplete + notations: Incomplete + nodeName: Incomplete def __init__(self, qualifiedName: str) -> None: ... def cloneNode(self, deep): ... - def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... class Entity(Identified, Node): - attributes: Any - nodeType: Any - nodeValue: Any - actualEncoding: Any - encoding: Any - version: Any - nodeName: Any - notationName: Any - childNodes: Any + attributes: Incomplete + nodeType: int + nodeValue: Incomplete + actualEncoding: Incomplete + encoding: Incomplete + version: Incomplete + nodeName: Incomplete + notationName: Incomplete + childNodes: Incomplete def __init__(self, name, publicId, systemId, notation) -> None: ... def appendChild(self, newChild) -> None: ... def insertBefore(self, newChild, refChild) -> None: ... @@ -239,19 +258,19 @@ class Entity(Identified, Node): def replaceChild(self, newChild, oldChild) -> None: ... class Notation(Identified, Childless, Node): - nodeType: Any - nodeValue: Any - nodeName: Any + nodeType: int + nodeValue: Incomplete + nodeName: Incomplete def __init__(self, name, publicId, systemId) -> None: ... class DOMImplementation(DOMImplementationLS): - def hasFeature(self, feature, version) -> bool: ... - def createDocument(self, namespaceURI: str | None, qualifiedName: str | None, doctype): ... - def createDocumentType(self, qualifiedName: str | None, publicId, systemId): ... - def getInterface(self, feature): ... + def hasFeature(self, feature: str, version: str | None) -> bool: ... + def createDocument(self, namespaceURI: str | None, qualifiedName: str | None, doctype: DocumentType | None) -> Document: ... + def createDocumentType(self, qualifiedName: str | None, publicId: str, systemId: str) -> DocumentType: ... + def getInterface(self: Self, feature: str) -> Self | None: ... class ElementInfo: - tagName: Any + tagName: Incomplete def __init__(self, name) -> None: ... def getAttributeType(self, aname): ... def getAttributeTypeNS(self, namespaceURI: str, localName): ... @@ -261,34 +280,34 @@ class ElementInfo: def isIdNS(self, namespaceURI: str, localName): ... class Document(Node, DocumentLS): - implementation: Any - nodeType: Any + implementation: Incomplete + nodeType: int nodeName: str - nodeValue: Any - attributes: Any - parentNode: Any - previousSibling: Any - nextSibling: Any - actualEncoding: Any - encoding: Any - standalone: Any - version: Any + nodeValue: Incomplete + attributes: Incomplete + parentNode: Incomplete + previousSibling: Incomplete + nextSibling: Incomplete + actualEncoding: Incomplete + encoding: str | None + standalone: bool | None + version: Incomplete strictErrorChecking: bool - errorHandler: Any - documentURI: Any - doctype: Any - childNodes: Any + errorHandler: Incomplete + documentURI: Incomplete + doctype: DocumentType | None + childNodes: Incomplete def __init__(self) -> None: ... def appendChild(self, node): ... - documentElement: Any + documentElement: Incomplete def removeChild(self, oldChild): ... def unlink(self) -> None: ... def cloneNode(self, deep): ... - def createDocumentFragment(self): ... - def createElement(self, tagName: str): ... - def createTextNode(self, data): ... - def createCDATASection(self, data): ... - def createComment(self, data): ... + def createDocumentFragment(self) -> DocumentFragment: ... + def createElement(self, tagName: str) -> Element: ... + def createTextNode(self, data: str) -> Text: ... + def createCDATASection(self, data: str) -> CDATASection: ... + def createComment(self, data: str) -> Comment: ... def createProcessingInstruction(self, target, data): ... def createAttribute(self, qName) -> Attr: ... def createElementNS(self, namespaceURI: str, qualifiedName: str): ... @@ -296,20 +315,26 @@ class Document(Node, DocumentLS): def getElementById(self, id): ... def getElementsByTagName(self, name: str): ... def getElementsByTagNameNS(self, namespaceURI: str, localName): ... - def isSupported(self, feature, version): ... + def isSupported(self, feature: str, version: str | None) -> bool: ... def importNode(self, node, deep): ... if sys.version_info >= (3, 9): def writexml( self, - writer, + writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ..., - encoding: Any | None = ..., - standalone: Any | None = ..., + encoding: str | None = ..., + standalone: bool | None = ..., ) -> None: ... else: def writexml( - self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Any | None = ... + self, + writer: SupportsWrite[str], + indent: str = ..., + addindent: str = ..., + newl: str = ..., + encoding: Incomplete | None = ..., ) -> None: ... + def renameNode(self, n, namespaceURI: str, name): ... diff --git a/stdlib/xml/dom/pulldom.pyi b/stdlib/xml/dom/pulldom.pyi index ce8816b..b4c03a1 100644 --- a/stdlib/xml/dom/pulldom.pyi +++ b/stdlib/xml/dom/pulldom.pyi @@ -1,5 +1,7 @@ -from typing import IO, Any, Sequence, Tuple, Union -from typing_extensions import Literal +import sys +from _typeshed import Incomplete, SupportsRead +from collections.abc import Sequence +from typing_extensions import Literal, TypeAlias from xml.dom.minidom import Document, DOMImplementation, Element, Text from xml.sax.handler import ContentHandler from xml.sax.xmlreader import XMLReader @@ -13,10 +15,10 @@ PROCESSING_INSTRUCTION: Literal["PROCESSING_INSTRUCTION"] IGNORABLE_WHITESPACE: Literal["IGNORABLE_WHITESPACE"] CHARACTERS: Literal["CHARACTERS"] -_DocumentFactory = Union[DOMImplementation, None] -_Node = Union[Document, Element, Text] +_DocumentFactory: TypeAlias = DOMImplementation | None +_Node: TypeAlias = Document | Element | Text -_Event = Tuple[ +_Event: TypeAlias = tuple[ Literal[ Literal["START_ELEMENT"], Literal["END_ELEMENT"], @@ -33,10 +35,10 @@ _Event = Tuple[ class PullDOM(ContentHandler): document: Document | None documentFactory: _DocumentFactory - firstEvent: Any - lastEvent: Any - elementStack: Sequence[Any] - pending_events: Sequence[Any] + firstEvent: Incomplete + lastEvent: Incomplete + elementStack: Sequence[Incomplete] + pending_events: Sequence[Incomplete] def __init__(self, documentFactory: _DocumentFactory = ...) -> None: ... def pop(self) -> Element: ... def setDocumentLocator(self, locator) -> None: ... @@ -61,12 +63,14 @@ class ErrorHandler: def fatalError(self, exception) -> None: ... class DOMEventStream: - stream: IO[bytes] + stream: SupportsRead[bytes] | SupportsRead[str] parser: XMLReader bufsize: int - def __init__(self, stream: IO[bytes], parser: XMLReader, bufsize: int) -> None: ... - pulldom: Any - def __getitem__(self, pos): ... + def __init__(self, stream: SupportsRead[bytes] | SupportsRead[str], parser: XMLReader, bufsize: int) -> None: ... + pulldom: Incomplete + if sys.version_info < (3, 11): + def __getitem__(self, pos): ... + def __next__(self): ... def __iter__(self): ... def getEvent(self) -> _Event: ... @@ -83,5 +87,7 @@ class SAX2DOM(PullDOM): default_bufsize: int -def parse(stream_or_string: str | IO[bytes], parser: XMLReader | None = ..., bufsize: int | None = ...) -> DOMEventStream: ... +def parse( + stream_or_string: str | SupportsRead[bytes] | SupportsRead[str], parser: XMLReader | None = ..., bufsize: int | None = ... +) -> DOMEventStream: ... def parseString(string: str, parser: XMLReader | None = ...) -> DOMEventStream: ... diff --git a/stdlib/xml/dom/xmlbuilder.pyi b/stdlib/xml/dom/xmlbuilder.pyi index d8936bd..341d717 100644 --- a/stdlib/xml/dom/xmlbuilder.pyi +++ b/stdlib/xml/dom/xmlbuilder.pyi @@ -1,6 +1,109 @@ -from typing import Any +from _typeshed import Incomplete +from typing import Any, NoReturn +from typing_extensions import Literal, TypeAlias +from urllib.request import OpenerDirector +from xml.dom.expatbuilder import ExpatBuilder, ExpatBuilderNS +from xml.dom.minidom import Node -def __getattr__(name: str) -> Any: ... # incomplete +__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"] -class DocumentLS(Any): ... # type: ignore -class DOMImplementationLS(Any): ... # type: ignore +# UNKNOWN TYPES: +# - `Options.errorHandler`. +# The same as `_DOMBuilderErrorHandlerType`? +# Maybe `xml.sax.handler.ErrorHandler`? +# - Return type of DOMBuilder.getFeature(). +# We could get rid of the `Incomplete` if we knew more +# about `Options.errorHandler`. + +# ALIASES REPRESENTING MORE UNKNOWN TYPES: + +# probably the same as `Options.errorHandler`? +# Maybe `xml.sax.handler.ErrorHandler`? +_DOMBuilderErrorHandlerType: TypeAlias = Incomplete | None +# probably some kind of IO... +_DOMInputSourceCharacterStreamType: TypeAlias = Incomplete | None +# probably a string?? +_DOMInputSourceStringDataType: TypeAlias = Incomplete | None +# probably a string?? +_DOMInputSourceEncodingType: TypeAlias = Incomplete | None + +class Options: + namespaces: int + namespace_declarations: bool + validation: bool + external_parameter_entities: bool + external_general_entities: bool + external_dtd_subset: bool + validate_if_schema: bool + validate: bool + datatype_normalization: bool + create_entity_ref_nodes: bool + entities: bool + whitespace_in_element_content: bool + cdata_sections: bool + comments: bool + charset_overrides_xml_encoding: bool + infoset: bool + supported_mediatypes_only: bool + errorHandler: Any | None + filter: DOMBuilderFilter | None # a guess, but seems likely + +class DOMBuilder: + entityResolver: DOMEntityResolver | None # a guess, but seems likely + errorHandler: _DOMBuilderErrorHandlerType + filter: DOMBuilderFilter | None # a guess, but seems likely + ACTION_REPLACE: Literal[1] + ACTION_APPEND_AS_CHILDREN: Literal[2] + ACTION_INSERT_AFTER: Literal[3] + ACTION_INSERT_BEFORE: Literal[4] + def setFeature(self, name: str, state: int) -> None: ... + def supportsFeature(self, name: str) -> bool: ... + def canSetFeature(self, name: str, state: int) -> bool: ... + # getFeature could return any attribute from an instance of `Options` + def getFeature(self, name: str) -> Incomplete: ... + def parseURI(self, uri: str) -> ExpatBuilder | ExpatBuilderNS: ... + def parse(self, input: DOMInputSource) -> ExpatBuilder | ExpatBuilderNS: ... + # `input` and `cnode` argtypes for `parseWithContext` are unknowable + # as the function does nothing with them, and always raises an exception. + # But `input` is *probably* `DOMInputSource`? + def parseWithContext(self, input: object, cnode: object, action: Literal[1, 2, 3, 4]) -> NoReturn: ... + +class DOMEntityResolver: + def resolveEntity(self, publicId: str | None, systemId: str) -> DOMInputSource: ... + +class DOMInputSource: + byteStream: OpenerDirector | None + characterStream: _DOMInputSourceCharacterStreamType + stringData: _DOMInputSourceStringDataType + encoding: _DOMInputSourceEncodingType + publicId: str | None + systemId: str | None + baseURI: str | None + +class DOMBuilderFilter: + FILTER_ACCEPT: Literal[1] + FILTER_REJECT: Literal[2] + FILTER_SKIP: Literal[3] + FILTER_INTERRUPT: Literal[4] + whatToShow: int + # The argtypes for acceptNode and startContainer appear to be irrelevant. + def acceptNode(self, element: object) -> Literal[1]: ... + def startContainer(self, element: object) -> Literal[1]: ... + +class DocumentLS: + async_: bool + def abort(self) -> NoReturn: ... + # `load()` and `loadXML()` always raise exceptions + # so the argtypes of `uri` and `source` are unknowable. + # `source` is *probably* `DOMInputSource`? + # `uri` is *probably* a str? (see DOMBuilder.parseURI()) + def load(self, uri: object) -> NoReturn: ... + def loadXML(self, source: object) -> NoReturn: ... + def saveXML(self, snode: Node | None) -> str: ... + +class DOMImplementationLS: + MODE_SYNCHRONOUS: Literal[1] + MODE_ASYNCHRONOUS: Literal[2] + def createDOMBuilder(self, mode: Literal[1], schemaType: None) -> DOMBuilder: ... + def createDOMWriter(self) -> NoReturn: ... + def createDOMInputSource(self) -> DOMInputSource: ... diff --git a/stdlib/xml/etree/ElementInclude.pyi b/stdlib/xml/etree/ElementInclude.pyi index 0ccccce..7bb78d0 100644 --- a/stdlib/xml/etree/ElementInclude.pyi +++ b/stdlib/xml/etree/ElementInclude.pyi @@ -1,11 +1,14 @@ import sys -from typing import Callable +from collections.abc import Callable from xml.etree.ElementTree import Element XINCLUDE: str XINCLUDE_INCLUDE: str XINCLUDE_FALLBACK: str +if sys.version_info >= (3, 9): + DEFAULT_MAX_INCLUSION_DEPTH: int + class FatalIncludeError(SyntaxError): ... def default_loader(href: str | bytes | int, parse: str, encoding: str | None = ...) -> str | Element: ... @@ -18,5 +21,7 @@ if sys.version_info >= (3, 9): elem: Element, loader: Callable[..., str | Element] | None = ..., base_url: str | None = ..., max_depth: int | None = ... ) -> None: ... + class LimitedRecursiveIncludeError(FatalIncludeError): ... + else: def include(elem: Element, loader: Callable[..., str | Element] | None = ...) -> None: ... diff --git a/stdlib/xml/etree/ElementPath.pyi b/stdlib/xml/etree/ElementPath.pyi index db4bd6a..94ce933 100644 --- a/stdlib/xml/etree/ElementPath.pyi +++ b/stdlib/xml/etree/ElementPath.pyi @@ -1,22 +1,25 @@ -from typing import Callable, Generator, List, Pattern, Tuple, TypeVar +from collections.abc import Callable, Generator +from re import Pattern +from typing import TypeVar +from typing_extensions import TypeAlias from xml.etree.ElementTree import Element xpath_tokenizer_re: Pattern[str] -_token = Tuple[str, str] -_next = Callable[[], _token] -_callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]] +_Token: TypeAlias = tuple[str, str] +_Next: TypeAlias = Callable[[], _Token] +_Callback: TypeAlias = Callable[[_SelectorContext, list[Element]], Generator[Element, None, None]] -def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = ...) -> Generator[_token, None, None]: ... +def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = ...) -> Generator[_Token, None, None]: ... def get_parent_map(context: _SelectorContext) -> dict[Element, Element]: ... -def prepare_child(next: _next, token: _token) -> _callback: ... -def prepare_star(next: _next, token: _token) -> _callback: ... -def prepare_self(next: _next, token: _token) -> _callback: ... -def prepare_descendant(next: _next, token: _token) -> _callback: ... -def prepare_parent(next: _next, token: _token) -> _callback: ... -def prepare_predicate(next: _next, token: _token) -> _callback: ... +def prepare_child(next: _Next, token: _Token) -> _Callback: ... +def prepare_star(next: _Next, token: _Token) -> _Callback: ... +def prepare_self(next: _Next, token: _Token) -> _Callback: ... +def prepare_descendant(next: _Next, token: _Token) -> _Callback: ... +def prepare_parent(next: _Next, token: _Token) -> _Callback: ... +def prepare_predicate(next: _Next, token: _Token) -> _Callback: ... -ops: dict[str, Callable[[_next, _token], _callback]] +ops: dict[str, Callable[[_Next, _Token], _Callback]] class _SelectorContext: parent_map: dict[Element, Element] | None diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index b9ecf52..84059bc 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -1,34 +1,55 @@ import sys -from _typeshed import FileDescriptor, StrOrBytesPath, SupportsWrite -from typing import ( - IO, - Any, - Callable, - Dict, - Generator, - ItemsView, - Iterable, - Iterator, - KeysView, - MutableSequence, - Sequence, - Tuple, - TypeVar, - Union, - overload, -) -from typing_extensions import Literal +from _collections_abc import dict_keys +from _typeshed import FileDescriptor, StrOrBytesPath, SupportsRead, SupportsWrite +from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, Mapping, Sequence +from typing import Any, TypeVar, overload +from typing_extensions import Literal, SupportsIndex, TypeAlias, TypeGuard + +__all__ = [ + "Comment", + "dump", + "Element", + "ElementTree", + "fromstring", + "fromstringlist", + "iselement", + "iterparse", + "parse", + "ParseError", + "PI", + "ProcessingInstruction", + "QName", + "SubElement", + "tostring", + "tostringlist", + "TreeBuilder", + "VERSION", + "XML", + "XMLID", + "XMLParser", + "XMLPullParser", + "register_namespace", +] + +if sys.version_info >= (3, 8): + __all__ += ["C14NWriterTarget", "canonicalize"] + +if sys.version_info >= (3, 9): + __all__ += ["indent"] _T = TypeVar("_T") -_File = Union[StrOrBytesPath, FileDescriptor, IO[Any]] +_FileRead: TypeAlias = StrOrBytesPath | FileDescriptor | SupportsRead[bytes] | SupportsRead[str] +_FileWriteC14N: TypeAlias = StrOrBytesPath | FileDescriptor | SupportsWrite[bytes] +_FileWrite: TypeAlias = _FileWriteC14N | SupportsWrite[str] VERSION: str class ParseError(SyntaxError): code: int - position: Tuple[int, int] + position: tuple[int, int] -def iselement(element: object) -> bool: ... +# In reality it works based on `.tag` attribute duck typing. +def iselement(element: object) -> TypeGuard[Element]: ... if sys.version_info >= (3, 8): @overload @@ -36,7 +57,7 @@ if sys.version_info >= (3, 8): xml_data: str | bytes | None = ..., *, out: None = ..., - from_file: _File | None = ..., + from_file: _FileRead | None = ..., with_comments: bool = ..., strip_text: bool = ..., rewrite_prefixes: bool = ..., @@ -50,7 +71,7 @@ if sys.version_info >= (3, 8): xml_data: str | bytes | None = ..., *, out: SupportsWrite[str], - from_file: _File | None = ..., + from_file: _FileRead | None = ..., with_comments: bool = ..., strip_text: bool = ..., rewrite_prefixes: bool = ..., @@ -60,7 +81,7 @@ if sys.version_info >= (3, 8): exclude_tags: Iterable[str] | None = ..., ) -> None: ... -class Element(MutableSequence[Element]): +class Element: tag: str attrib: dict[str, str] text: str | None @@ -84,20 +105,25 @@ class Element(MutableSequence[Element]): def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ... def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... def itertext(self) -> Generator[str, None, None]: ... - def keys(self) -> KeysView[str]: ... + def keys(self) -> dict_keys[str, str]: ... + # makeelement returns the type of self in Python impl, but not in C impl def makeelement(self, __tag: str, __attrib: dict[str, str]) -> Element: ... def remove(self, __subelement: Element) -> None: ... def set(self, __key: str, __value: str) -> None: ... - def __delitem__(self, i: int | slice) -> None: ... + def __copy__(self) -> Element: ... # returns the type of self in Python impl, but not in C impl + def __deepcopy__(self, __memo: Any) -> Element: ... # Only exists in C impl + def __delitem__(self, __i: SupportsIndex | slice) -> None: ... @overload - def __getitem__(self, i: int) -> Element: ... + def __getitem__(self, __i: SupportsIndex) -> Element: ... @overload - def __getitem__(self, s: slice) -> MutableSequence[Element]: ... + def __getitem__(self, __s: slice) -> list[Element]: ... def __len__(self) -> int: ... + # Doesn't actually exist at runtime, but instance of the class are indeed iterable due to __getitem__. + def __iter__(self) -> Iterator[Element]: ... @overload - def __setitem__(self, i: int, o: Element) -> None: ... + def __setitem__(self, __i: SupportsIndex, __o: Element) -> None: ... @overload - def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ... + def __setitem__(self, __s: slice, __o: Iterable[Element]) -> None: ... if sys.version_info < (3, 9): def getchildren(self) -> list[Element]: ... def getiterator(self, tag: str | None = ...) -> list[Element]: ... @@ -111,14 +137,20 @@ PI: Callable[..., Element] class QName: text: str def __init__(self, text_or_uri: str, tag: str | None = ...) -> None: ... + def __lt__(self, other: QName | str) -> bool: ... + def __le__(self, other: QName | str) -> bool: ... + def __gt__(self, other: QName | str) -> bool: ... + def __ge__(self, other: QName | str) -> bool: ... + def __eq__(self, other: object) -> bool: ... class ElementTree: - def __init__(self, element: Element | None = ..., file: _File | None = ...) -> None: ... - def getroot(self) -> Element: ... - def parse(self, source: _File, parser: XMLParser | None = ...) -> Element: ... + def __init__(self, element: Element | None = ..., file: _FileRead | None = ...) -> None: ... + def getroot(self) -> Element | Any: ... + def parse(self, source: _FileRead, parser: XMLParser | None = ...) -> Element: ... def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ... if sys.version_info < (3, 9): def getiterator(self, tag: str | None = ...) -> list[Element]: ... + def find(self, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... @overload def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... @@ -128,7 +160,7 @@ class ElementTree: def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... def write( self, - file_or_filename: _File, + file_or_filename: _FileWrite, encoding: str | None = ..., xml_declaration: bool | None = ..., default_namespace: str | None = ..., @@ -136,7 +168,7 @@ class ElementTree: *, short_empty_elements: bool = ..., ) -> None: ... - def write_c14n(self, file: _File) -> None: ... + def write_c14n(self, file: _FileWriteC14N) -> None: ... def register_namespace(prefix: str, uri: str) -> None: ... @@ -231,17 +263,21 @@ def dump(elem: Element) -> None: ... if sys.version_info >= (3, 9): def indent(tree: Element | ElementTree, space: str = ..., level: int = ...) -> None: ... -def parse(source: _File, parser: XMLParser | None = ...) -> ElementTree: ... -def iterparse(source: _File, events: Sequence[str] | None = ..., parser: XMLParser | None = ...) -> Iterator[Tuple[str, Any]]: ... +def parse(source: _FileRead, parser: XMLParser | None = ...) -> ElementTree: ... +def iterparse( + source: _FileRead, events: Sequence[str] | None = ..., parser: XMLParser | None = ... +) -> Iterator[tuple[str, Any]]: ... class XMLPullParser: def __init__(self, events: Sequence[str] | None = ..., *, _parser: XMLParser | None = ...) -> None: ... - def feed(self, data: bytes) -> None: ... + def feed(self, data: str | bytes) -> None: ... def close(self) -> None: ... - def read_events(self) -> Iterator[Tuple[str, Element]]: ... + # Second element in the tuple could be `Element`, `tuple[str, str]` or `None`. + # Use `Any` to avoid false-positive errors. + def read_events(self) -> Iterator[tuple[str, Any]]: ... def XML(text: str | bytes, parser: XMLParser | None = ...) -> Element: ... -def XMLID(text: str | bytes, parser: XMLParser | None = ...) -> Tuple[Element, dict[str, Element]]: ... +def XMLID(text: str | bytes, parser: XMLParser | None = ...) -> tuple[Element, dict[str, Element]]: ... # This is aliased to XML in the source. fromstring = XML @@ -257,20 +293,39 @@ def fromstringlist(sequence: Sequence[str | bytes], parser: XMLParser | None = . # TreeBuilder is called by client code (they could pass strs, bytes or whatever); # but we don't want to use a too-broad type, or it would be too hard to write # elementfactories. -_ElementFactory = Callable[[Any, Dict[Any, Any]], Element] +_ElementFactory: TypeAlias = Callable[[Any, dict[Any, Any]], Element] class TreeBuilder: - def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ... + if sys.version_info >= (3, 8): + # comment_factory can take None because passing None to Comment is not an error + def __init__( + self, + element_factory: _ElementFactory | None = ..., + *, + comment_factory: Callable[[str | None], Element] | None = ..., + pi_factory: Callable[[str, str | None], Element] | None = ..., + insert_comments: bool = ..., + insert_pis: bool = ..., + ) -> None: ... + insert_comments: bool + insert_pis: bool + else: + def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ... + def close(self) -> Element: ... def data(self, __data: str | bytes) -> None: ... def start(self, __tag: str | bytes, __attrs: dict[str | bytes, str | bytes]) -> Element: ... def end(self, __tag: str | bytes) -> Element: ... + if sys.version_info >= (3, 8): + # These two methods have pos-only parameters in the C implementation + def comment(self, __text: str | None) -> Element: ... + def pi(self, __target: str, __text: str | None = ...) -> Element: ... if sys.version_info >= (3, 8): class C14NWriterTarget: def __init__( self, - write: Callable[[str], Any], + write: Callable[[str], object], *, with_comments: bool = ..., strip_text: bool = ..., @@ -280,6 +335,12 @@ if sys.version_info >= (3, 8): exclude_attrs: Iterable[str] | None = ..., exclude_tags: Iterable[str] | None = ..., ) -> None: ... + def data(self, data: str) -> None: ... + def start_ns(self, prefix: str, uri: str) -> None: ... + def start(self, tag: str, attrs: Mapping[str, str]) -> None: ... + def end(self, tag: str) -> None: ... + def comment(self, text: str) -> None: ... + def pi(self, target: str, data: str) -> None: ... class XMLParser: parser: Any @@ -292,5 +353,6 @@ class XMLParser: else: def __init__(self, html: int = ..., target: Any = ..., encoding: str | None = ...) -> None: ... def doctype(self, __name: str, __pubid: str, __system: str) -> None: ... + def close(self) -> Any: ... def feed(self, __data: str | bytes) -> None: ... diff --git a/stdlib/xml/etree/cElementTree.pyi b/stdlib/xml/etree/cElementTree.pyi index c41e2be..02272d8 100644 --- a/stdlib/xml/etree/cElementTree.pyi +++ b/stdlib/xml/etree/cElementTree.pyi @@ -1 +1 @@ -from xml.etree.ElementTree import * # noqa: F403 +from xml.etree.ElementTree import * diff --git a/stdlib/xml/parsers/__init__.pyi b/stdlib/xml/parsers/__init__.pyi index cac0862..cebdb6a 100644 --- a/stdlib/xml/parsers/__init__.pyi +++ b/stdlib/xml/parsers/__init__.pyi @@ -1 +1 @@ -import xml.parsers.expat as expat +from xml.parsers import expat as expat diff --git a/stdlib/xml/sax/__init__.pyi b/stdlib/xml/sax/__init__.pyi index a123e7e..af4ee05 100644 --- a/stdlib/xml/sax/__init__.pyi +++ b/stdlib/xml/sax/__init__.pyi @@ -1,8 +1,13 @@ import sys -from typing import IO, Any, Iterable, NoReturn -from xml.sax.handler import ContentHandler, ErrorHandler +from _typeshed import SupportsRead, _T_co +from collections.abc import Iterable +from typing import Any, NoReturn, Protocol +from xml.sax.handler import ContentHandler as ContentHandler, ErrorHandler as ErrorHandler from xml.sax.xmlreader import Locator, XMLReader +class _SupportsReadClose(SupportsRead[_T_co], Protocol[_T_co]): + def close(self) -> None: ... + class SAXException(Exception): def __init__(self, msg: str, exception: Exception | None = ...) -> None: ... def getMessage(self) -> str: ... @@ -28,6 +33,8 @@ if sys.version_info >= (3, 8): else: def make_parser(parser_list: list[str] = ...) -> XMLReader: ... -def parse(source: str | IO[str] | IO[bytes], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ... +def parse( + source: str | _SupportsReadClose[bytes] | _SupportsReadClose[str], handler: ContentHandler, errorHandler: ErrorHandler = ... +) -> None: ... def parseString(string: bytes | str, handler: ContentHandler, errorHandler: ErrorHandler | None = ...) -> None: ... def _create_parser(parser_name: str) -> XMLReader: ... diff --git a/stdlib/xml/sax/handler.pyi b/stdlib/xml/sax/handler.pyi index 3a51933..63b725b 100644 --- a/stdlib/xml/sax/handler.pyi +++ b/stdlib/xml/sax/handler.pyi @@ -1,14 +1,14 @@ -from typing import Any +import sys +from typing import NoReturn -version: Any +version: str class ErrorHandler: - def error(self, exception): ... - def fatalError(self, exception): ... - def warning(self, exception): ... + def error(self, exception: BaseException) -> NoReturn: ... + def fatalError(self, exception: BaseException) -> NoReturn: ... + def warning(self, exception: BaseException) -> None: ... class ContentHandler: - def __init__(self) -> None: ... def setDocumentLocator(self, locator): ... def startDocument(self): ... def endDocument(self): ... @@ -30,17 +30,25 @@ class DTDHandler: class EntityResolver: def resolveEntity(self, publicId, systemId): ... -feature_namespaces: Any -feature_namespace_prefixes: Any -feature_string_interning: Any -feature_validation: Any -feature_external_ges: Any -feature_external_pes: Any -all_features: Any -property_lexical_handler: Any -property_declaration_handler: Any -property_dom_node: Any -property_xml_string: Any -property_encoding: Any -property_interning_dict: Any -all_properties: Any +feature_namespaces: str +feature_namespace_prefixes: str +feature_string_interning: str +feature_validation: str +feature_external_ges: str +feature_external_pes: str +all_features: list[str] +property_lexical_handler: str +property_declaration_handler: str +property_dom_node: str +property_xml_string: str +property_encoding: str +property_interning_dict: str +all_properties: list[str] + +if sys.version_info >= (3, 10): + class LexicalHandler: + def comment(self, content: str) -> object: ... + def startDTD(self, name: str, public_id: str | None, system_id: str | None) -> object: ... + def endDTD(self) -> object: ... + def startCDATA(self) -> object: ... + def endCDATA(self) -> object: ... diff --git a/stdlib/xml/sax/saxutils.pyi b/stdlib/xml/sax/saxutils.pyi index c7304f4..1361949 100644 --- a/stdlib/xml/sax/saxutils.pyi +++ b/stdlib/xml/sax/saxutils.pyi @@ -1,7 +1,7 @@ from _typeshed import SupportsWrite from codecs import StreamReaderWriter, StreamWriter +from collections.abc import Mapping from io import RawIOBase, TextIOBase -from typing import Mapping from xml.sax import handler, xmlreader def escape(data: str, entities: Mapping[str, str] = ...) -> str: ... diff --git a/stdlib/xml/sax/xmlreader.pyi b/stdlib/xml/sax/xmlreader.pyi index 8afc566..517c170 100644 --- a/stdlib/xml/sax/xmlreader.pyi +++ b/stdlib/xml/sax/xmlreader.pyi @@ -1,7 +1,6 @@ -from typing import Mapping, Tuple +from collections.abc import Mapping class XMLReader: - def __init__(self) -> None: ... def parse(self, source): ... def getContentHandler(self): ... def setContentHandler(self, handler): ... @@ -64,7 +63,7 @@ class AttributesImpl: def values(self): ... class AttributesNSImpl(AttributesImpl): - def __init__(self, attrs: Mapping[Tuple[str, str], str], qnames: Mapping[Tuple[str, str], str]) -> None: ... + def __init__(self, attrs: Mapping[tuple[str, str], str], qnames: Mapping[tuple[str, str], str]) -> None: ... def getValueByQName(self, name): ... def getNameByQName(self, name): ... def getQNameByName(self, name): ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index d0144e7..1502910 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -3,19 +3,22 @@ import http.client import sys import time from _typeshed import Self, SupportsRead, SupportsWrite +from collections.abc import Callable, Iterable, Mapping from datetime import datetime from io import BytesIO from types import TracebackType -from typing import Any, Callable, Dict, Iterable, List, Mapping, Protocol, Tuple, Type, Union, overload -from typing_extensions import Literal +from typing import Any, Protocol, Union, overload +from typing_extensions import Literal, TypeAlias class _SupportsTimeTuple(Protocol): def timetuple(self) -> time.struct_time: ... -_DateTimeComparable = Union[DateTime, datetime, str, _SupportsTimeTuple] -_Marshallable = Union[None, bool, int, float, str, bytes, Tuple[Any, ...], List[Any], Dict[Any, Any], datetime, DateTime, Binary] -_XMLDate = Union[int, datetime, Tuple[int, ...], time.struct_time] -_HostType = Union[Tuple[str, Dict[str, str]], str] +_DateTimeComparable: TypeAlias = DateTime | datetime | str | _SupportsTimeTuple +_Marshallable: TypeAlias = ( + bool | int | float | str | bytes | None | tuple[Any, ...] | list[Any] | dict[Any, Any] | datetime | DateTime | Binary +) +_XMLDate: TypeAlias = int | datetime | tuple[int, ...] | time.struct_time +_HostType: TypeAlias = Union[tuple[str, dict[str, str]], str] def escape(s: str) -> str: ... # undocumented @@ -63,13 +66,13 @@ def _strftime(value: _XMLDate) -> str: ... # undocumented class DateTime: value: str # undocumented - def __init__(self, value: int | str | datetime | time.struct_time | Tuple[int, ...] = ...) -> None: ... + def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = ...) -> None: ... def __lt__(self, other: _DateTimeComparable) -> bool: ... def __le__(self, other: _DateTimeComparable) -> bool: ... def __gt__(self, other: _DateTimeComparable) -> bool: ... def __ge__(self, other: _DateTimeComparable) -> bool: ... - def __eq__(self, other: _DateTimeComparable) -> bool: ... # type: ignore - def make_comparable(self, other: _DateTimeComparable) -> Tuple[str, str]: ... # undocumented + def __eq__(self, other: _DateTimeComparable) -> bool: ... # type: ignore[override] + def make_comparable(self, other: _DateTimeComparable) -> tuple[str, str]: ... # undocumented def timetuple(self) -> time.struct_time: ... # undocumented def decode(self, data: Any) -> None: ... def encode(self, out: SupportsWrite[str]) -> None: ... @@ -83,42 +86,42 @@ class Binary: def __init__(self, data: bytes | None = ...) -> None: ... def decode(self, data: bytes) -> None: ... def encode(self, out: SupportsWrite[str]) -> None: ... + def __eq__(self, other: object) -> bool: ... def _binary(data: bytes) -> Binary: ... # undocumented -WRAPPERS: Tuple[Type[DateTime], Type[Binary]] # undocumented +WRAPPERS: tuple[type[DateTime], type[Binary]] # undocumented class ExpatParser: # undocumented def __init__(self, target: Unmarshaller) -> None: ... def feed(self, data: str | bytes) -> None: ... def close(self) -> None: ... -class Marshaller: - - dispatch: dict[ - Type[Any], Callable[[Marshaller, Any, Callable[[str], Any]], None] - ] # TODO: Replace 'Any' with some kind of binding +_WriteCallback: TypeAlias = Callable[[str], object] +class Marshaller: + # TODO: Replace 'Any' with some kind of binding + dispatch: dict[type[Any], Callable[[Marshaller, Any, _WriteCallback], None]] memo: dict[Any, None] data: None encoding: str | None allow_none: bool def __init__(self, encoding: str | None = ..., allow_none: bool = ...) -> None: ... def dumps(self, values: Fault | Iterable[_Marshallable]) -> str: ... - def __dump(self, value: _Marshallable, write: Callable[[str], Any]) -> None: ... # undocumented - def dump_nil(self, value: None, write: Callable[[str], Any]) -> None: ... - def dump_bool(self, value: bool, write: Callable[[str], Any]) -> None: ... - def dump_long(self, value: int, write: Callable[[str], Any]) -> None: ... - def dump_int(self, value: int, write: Callable[[str], Any]) -> None: ... - def dump_double(self, value: float, write: Callable[[str], Any]) -> None: ... - def dump_unicode(self, value: str, write: Callable[[str], Any], escape: Callable[[str], str] = ...) -> None: ... - def dump_bytes(self, value: bytes, write: Callable[[str], Any]) -> None: ... - def dump_array(self, value: Iterable[_Marshallable], write: Callable[[str], Any]) -> None: ... + def __dump(self, value: _Marshallable, write: _WriteCallback) -> None: ... # undocumented + def dump_nil(self, value: None, write: _WriteCallback) -> None: ... + def dump_bool(self, value: bool, write: _WriteCallback) -> None: ... + def dump_long(self, value: int, write: _WriteCallback) -> None: ... + def dump_int(self, value: int, write: _WriteCallback) -> None: ... + def dump_double(self, value: float, write: _WriteCallback) -> None: ... + def dump_unicode(self, value: str, write: _WriteCallback, escape: Callable[[str], str] = ...) -> None: ... + def dump_bytes(self, value: bytes, write: _WriteCallback) -> None: ... + def dump_array(self, value: Iterable[_Marshallable], write: _WriteCallback) -> None: ... def dump_struct( - self, value: Mapping[str, _Marshallable], write: Callable[[str], Any], escape: Callable[[str], str] = ... + self, value: Mapping[str, _Marshallable], write: _WriteCallback, escape: Callable[[str], str] = ... ) -> None: ... - def dump_datetime(self, value: _XMLDate, write: Callable[[str], Any]) -> None: ... - def dump_instance(self, value: object, write: Callable[[str], Any]) -> None: ... + def dump_datetime(self, value: _XMLDate, write: _WriteCallback) -> None: ... + def dump_instance(self, value: object, write: _WriteCallback) -> None: ... class Unmarshaller: @@ -135,7 +138,7 @@ class Unmarshaller: _use_datetime: bool _use_builtin_types: bool def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ...) -> None: ... - def close(self) -> Tuple[_Marshallable, ...]: ... + def close(self) -> tuple[_Marshallable, ...]: ... def getmethodname(self) -> str | None: ... def xml(self, encoding: str, standalone: Any) -> None: ... # Standalone is ignored def start(self, tag: str, attrs: dict[str, str]) -> None: ... @@ -159,9 +162,9 @@ class Unmarshaller: class _MultiCallMethod: # undocumented - __call_list: list[Tuple[str, Tuple[_Marshallable, ...]]] + __call_list: list[tuple[str, tuple[_Marshallable, ...]]] __name: str - def __init__(self, call_list: list[Tuple[str, _Marshallable]], name: str) -> None: ... + def __init__(self, call_list: list[tuple[str, _Marshallable]], name: str) -> None: ... def __getattr__(self, name: str) -> _MultiCallMethod: ... def __call__(self, *args: _Marshallable) -> None: ... @@ -174,9 +177,9 @@ class MultiCallIterator: # undocumented class MultiCall: __server: ServerProxy - __call_list: list[Tuple[str, Tuple[_Marshallable, ...]]] + __call_list: list[tuple[str, tuple[_Marshallable, ...]]] def __init__(self, server: ServerProxy) -> None: ... - def __getattr__(self, item: str) -> _MultiCallMethod: ... + def __getattr__(self, name: str) -> _MultiCallMethod: ... def __call__(self) -> MultiCallIterator: ... # A little white lie @@ -184,15 +187,15 @@ FastMarshaller: Marshaller | None FastParser: ExpatParser | None FastUnmarshaller: Unmarshaller | None -def getparser(use_datetime: bool = ..., use_builtin_types: bool = ...) -> Tuple[ExpatParser, Unmarshaller]: ... +def getparser(use_datetime: bool = ..., use_builtin_types: bool = ...) -> tuple[ExpatParser, Unmarshaller]: ... def dumps( - params: Fault | Tuple[_Marshallable, ...], + params: Fault | tuple[_Marshallable, ...], methodname: str | None = ..., methodresponse: bool | None = ..., encoding: str | None = ..., allow_none: bool = ..., ) -> str: ... -def loads(data: str, use_datetime: bool = ..., use_builtin_types: bool = ...) -> Tuple[Tuple[_Marshallable, ...], str | None]: ... +def loads(data: str, use_datetime: bool = ..., use_builtin_types: bool = ...) -> tuple[tuple[_Marshallable, ...], str | None]: ... def gzip_encode(data: bytes) -> bytes: ... # undocumented def gzip_decode(data: bytes, max_decode: int = ...) -> bytes: ... # undocumented @@ -200,13 +203,12 @@ class GzipDecodedResponse(gzip.GzipFile): # undocumented io: BytesIO def __init__(self, response: SupportsRead[bytes]) -> None: ... - def close(self) -> None: ... class _Method: # undocumented - __send: Callable[[str, Tuple[_Marshallable, ...]], _Marshallable] + __send: Callable[[str, tuple[_Marshallable, ...]], _Marshallable] __name: str - def __init__(self, send: Callable[[str, Tuple[_Marshallable, ...]], _Marshallable], name: str) -> None: ... + def __init__(self, send: Callable[[str, tuple[_Marshallable, ...]], _Marshallable], name: str) -> None: ... def __getattr__(self, name: str) -> _Method: ... def __call__(self, *args: _Marshallable) -> _Marshallable: ... @@ -218,28 +220,29 @@ class Transport: _use_datetime: bool _use_builtin_types: bool - _connection: Tuple[_HostType | None, http.client.HTTPConnection | None] - _headers: list[Tuple[str, str]] - _extra_headers: list[Tuple[str, str]] + _connection: tuple[_HostType | None, http.client.HTTPConnection | None] + _headers: list[tuple[str, str]] + _extra_headers: list[tuple[str, str]] if sys.version_info >= (3, 8): def __init__( - self, use_datetime: bool = ..., use_builtin_types: bool = ..., *, headers: Iterable[Tuple[str, str]] = ... + self, use_datetime: bool = ..., use_builtin_types: bool = ..., *, headers: Iterable[tuple[str, str]] = ... ) -> None: ... else: def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ...) -> None: ... - def request(self, host: _HostType, handler: str, request_body: bytes, verbose: bool = ...) -> Tuple[_Marshallable, ...]: ... + + def request(self, host: _HostType, handler: str, request_body: bytes, verbose: bool = ...) -> tuple[_Marshallable, ...]: ... def single_request( self, host: _HostType, handler: str, request_body: bytes, verbose: bool = ... - ) -> Tuple[_Marshallable, ...]: ... - def getparser(self) -> Tuple[ExpatParser, Unmarshaller]: ... - def get_host_info(self, host: _HostType) -> Tuple[str, list[Tuple[str, str]], dict[str, str]]: ... + ) -> tuple[_Marshallable, ...]: ... + def getparser(self) -> tuple[ExpatParser, Unmarshaller]: ... + def get_host_info(self, host: _HostType) -> tuple[str, list[tuple[str, str]], dict[str, str]]: ... def make_connection(self, host: _HostType) -> http.client.HTTPConnection: ... def close(self) -> None: ... def send_request(self, host: _HostType, handler: str, request_body: bytes, debug: bool) -> http.client.HTTPConnection: ... - def send_headers(self, connection: http.client.HTTPConnection, headers: list[Tuple[str, str]]) -> None: ... + def send_headers(self, connection: http.client.HTTPConnection, headers: list[tuple[str, str]]) -> None: ... def send_content(self, connection: http.client.HTTPConnection, request_body: bytes) -> None: ... - def parse_response(self, response: http.client.HTTPResponse) -> Tuple[_Marshallable, ...]: ... + def parse_response(self, response: http.client.HTTPResponse) -> tuple[_Marshallable, ...]: ... class SafeTransport(Transport): @@ -249,11 +252,12 @@ class SafeTransport(Transport): use_datetime: bool = ..., use_builtin_types: bool = ..., *, - headers: Iterable[Tuple[str, str]] = ..., + headers: Iterable[tuple[str, str]] = ..., context: Any | None = ..., ) -> None: ... else: def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ..., *, context: Any | None = ...) -> None: ... + def make_connection(self, host: _HostType) -> http.client.HTTPSConnection: ... class ServerProxy: @@ -276,7 +280,7 @@ class ServerProxy: use_datetime: bool = ..., use_builtin_types: bool = ..., *, - headers: Iterable[Tuple[str, str]] = ..., + headers: Iterable[tuple[str, str]] = ..., context: Any | None = ..., ) -> None: ... else: @@ -292,6 +296,7 @@ class ServerProxy: *, context: Any | None = ..., ) -> None: ... + def __getattr__(self, name: str) -> _Method: ... @overload def __call__(self, attr: Literal["close"]) -> Callable[[], None]: ... @@ -301,9 +306,9 @@ class ServerProxy: def __call__(self, attr: str) -> Callable[[], None] | Transport: ... def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def __close(self) -> None: ... # undocumented - def __request(self, methodname: str, params: Tuple[_Marshallable, ...]) -> Tuple[_Marshallable, ...]: ... # undocumented + def __request(self, methodname: str, params: tuple[_Marshallable, ...]) -> tuple[_Marshallable, ...]: ... # undocumented Server = ServerProxy diff --git a/stdlib/xmlrpc/server.pyi b/stdlib/xmlrpc/server.pyi index 3240181..c11d8d8 100644 --- a/stdlib/xmlrpc/server.pyi +++ b/stdlib/xmlrpc/server.pyi @@ -1,13 +1,15 @@ import http.server import pydoc import socketserver -import sys +from collections.abc import Callable, Iterable, Mapping from datetime import datetime -from typing import Any, Callable, Dict, Iterable, List, Mapping, Pattern, Protocol, Tuple, Type, Union +from re import Pattern +from typing import Any, ClassVar, Protocol +from typing_extensions import TypeAlias from xmlrpc.client import Fault # TODO: Recursive type on tuple, list, dict -_Marshallable = Union[None, bool, int, float, str, bytes, Tuple[Any, ...], List[Any], Dict[Any, Any], datetime] +_Marshallable: TypeAlias = None | bool | int | float | str | bytes | tuple[Any, ...] | list[Any] | dict[Any, Any] | datetime # The dispatch accepts anywhere from 0 to N arguments, no easy way to allow this in mypy class _DispatchArity0(Protocol): @@ -30,7 +32,9 @@ class _DispatchArity4(Protocol): class _DispatchArityN(Protocol): def __call__(self, *args: _Marshallable) -> _Marshallable: ... -_DispatchProtocol = Union[_DispatchArity0, _DispatchArity1, _DispatchArity2, _DispatchArity3, _DispatchArity4, _DispatchArityN] +_DispatchProtocol: TypeAlias = ( + _DispatchArity0 | _DispatchArity1 | _DispatchArity2 | _DispatchArity3 | _DispatchArity4 | _DispatchArityN +) def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = ...) -> Any: ... # undocumented def list_public_methods(obj: Any) -> list[str]: ... # undocumented @@ -44,16 +48,13 @@ class SimpleXMLRPCDispatcher: # undocumented use_builtin_types: bool def __init__(self, allow_none: bool = ..., encoding: str | None = ..., use_builtin_types: bool = ...) -> None: ... def register_instance(self, instance: Any, allow_dotted_names: bool = ...) -> None: ... - if sys.version_info >= (3, 7): - def register_function(self, function: _DispatchProtocol | None = ..., name: str | None = ...) -> Callable[..., Any]: ... - else: - def register_function(self, function: _DispatchProtocol, name: str | None = ...) -> Callable[..., Any]: ... + def register_function(self, function: _DispatchProtocol | None = ..., name: str | None = ...) -> Callable[..., Any]: ... def register_introspection_functions(self) -> None: ... def register_multicall_functions(self) -> None: ... def _marshaled_dispatch( self, data: str, - dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ..., + dispatch_method: Callable[[str | None, tuple[_Marshallable, ...]], Fault | tuple[_Marshallable, ...]] | None = ..., path: Any | None = ..., ) -> str: ... # undocumented def system_listMethods(self) -> list[str]: ... # undocumented @@ -63,8 +64,7 @@ class SimpleXMLRPCDispatcher: # undocumented def _dispatch(self, method: str, params: Iterable[_Marshallable]) -> _Marshallable: ... # undocumented class SimpleXMLRPCRequestHandler(http.server.BaseHTTPRequestHandler): - - rpc_paths: Tuple[str, str] + rpc_paths: ClassVar[tuple[str, ...]] encode_threshold: int # undocumented aepattern: Pattern[str] # undocumented def accept_encodings(self) -> dict[str, float]: ... @@ -72,16 +72,14 @@ class SimpleXMLRPCRequestHandler(http.server.BaseHTTPRequestHandler): def do_POST(self) -> None: ... def decode_request_content(self, data: bytes) -> bytes | None: ... def report_404(self) -> None: ... - def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ... class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher): - allow_reuse_address: bool _send_traceback_handler: bool def __init__( self, - addr: Tuple[str, int], - requestHandler: Type[SimpleXMLRPCRequestHandler] = ..., + addr: tuple[str, int], + requestHandler: type[SimpleXMLRPCRequestHandler] = ..., logRequests: bool = ..., allow_none: bool = ..., encoding: str | None = ..., @@ -92,12 +90,10 @@ class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher): class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented dispatchers: dict[str, SimpleXMLRPCDispatcher] - allow_none: bool - encoding: str def __init__( self, - addr: Tuple[str, int], - requestHandler: Type[SimpleXMLRPCRequestHandler] = ..., + addr: tuple[str, int], + requestHandler: type[SimpleXMLRPCRequestHandler] = ..., logRequests: bool = ..., allow_none: bool = ..., encoding: str | None = ..., @@ -106,12 +102,6 @@ class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented ) -> None: ... def add_dispatcher(self, path: str, dispatcher: SimpleXMLRPCDispatcher) -> SimpleXMLRPCDispatcher: ... def get_dispatcher(self, path: str) -> SimpleXMLRPCDispatcher: ... - def _marshaled_dispatch( - self, - data: str, - dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ..., - path: Any | None = ..., - ) -> str: ... class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): def __init__(self, allow_none: bool = ..., encoding: str | None = ..., use_builtin_types: bool = ...) -> None: ... @@ -120,7 +110,16 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): def handle_request(self, request_text: str | None = ...) -> None: ... class ServerHTMLDoc(pydoc.HTMLDoc): # undocumented - def docroutine(self, object: object, name: str, mod: str | None = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., cl: type | None = ...) -> str: ... # type: ignore + def docroutine( # type: ignore[override] + self, + object: object, + name: str, + mod: str | None = ..., + funcs: Mapping[str, str] = ..., + classes: Mapping[str, str] = ..., + methods: Mapping[str, str] = ..., + cl: type | None = ..., + ) -> str: ... def docserver(self, server_name: str, package_documentation: str, methods: dict[str, str]) -> str: ... class XMLRPCDocGenerator: # undocumented @@ -128,7 +127,6 @@ class XMLRPCDocGenerator: # undocumented server_name: str server_documentation: str server_title: str - def __init__(self) -> None: ... def set_server_title(self, server_title: str) -> None: ... def set_server_name(self, server_name: str) -> None: ... def set_server_documentation(self, server_documentation: str) -> None: ... @@ -140,8 +138,8 @@ class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): class DocXMLRPCServer(SimpleXMLRPCServer, XMLRPCDocGenerator): def __init__( self, - addr: Tuple[str, int], - requestHandler: Type[SimpleXMLRPCRequestHandler] = ..., + addr: tuple[str, int], + requestHandler: type[SimpleXMLRPCRequestHandler] = ..., logRequests: bool = ..., allow_none: bool = ..., encoding: str | None = ..., diff --git a/stdlib/xxlimited.pyi b/stdlib/xxlimited.pyi index 0dddbb8..b2fb72a 100644 --- a/stdlib/xxlimited.pyi +++ b/stdlib/xxlimited.pyi @@ -1,8 +1,10 @@ import sys from typing import Any +from typing_extensions import final class Str: ... +@final class Xxo: def demo(self) -> None: ... @@ -15,4 +17,5 @@ if sys.version_info >= (3, 10): else: class error: ... class Null: ... + def roj(__b: Any) -> None: ... diff --git a/stdlib/zipapp.pyi b/stdlib/zipapp.pyi index 581d2b7..3363161 100644 --- a/stdlib/zipapp.pyi +++ b/stdlib/zipapp.pyi @@ -1,24 +1,20 @@ -import sys +from collections.abc import Callable from pathlib import Path -from typing import BinaryIO, Callable, Union +from typing import BinaryIO +from typing_extensions import TypeAlias -_Path = Union[str, Path, BinaryIO] +__all__ = ["ZipAppError", "create_archive", "get_interpreter"] -class ZipAppError(ValueError): ... - -if sys.version_info >= (3, 7): - def create_archive( - source: _Path, - target: _Path | None = ..., - interpreter: str | None = ..., - main: str | None = ..., - filter: Callable[[Path], bool] | None = ..., - compressed: bool = ..., - ) -> None: ... +_Path: TypeAlias = str | Path | BinaryIO -else: - def create_archive( - source: _Path, target: _Path | None = ..., interpreter: str | None = ..., main: str | None = ... - ) -> None: ... +class ZipAppError(ValueError): ... +def create_archive( + source: _Path, + target: _Path | None = ..., + interpreter: str | None = ..., + main: str | None = ..., + filter: Callable[[Path], bool] | None = ..., + compressed: bool = ..., +) -> None: ... def get_interpreter(archive: _Path) -> str: ... diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index 2335428..e964cd6 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -1,15 +1,34 @@ import io import sys -from _typeshed import Self, StrPath +from _typeshed import Self, StrOrBytesPath, StrPath, _BufferWithLen +from collections.abc import Callable, Iterable, Iterator from os import PathLike from types import TracebackType -from typing import IO, Any, Callable, Iterable, Iterator, Protocol, Sequence, Tuple, Type, overload -from typing_extensions import Literal +from typing import IO, Any, Protocol, overload +from typing_extensions import Literal, TypeAlias -_DateTuple = Tuple[int, int, int, int, int, int] -_ReadWriteMode = Literal["r", "w"] -_ReadWriteBinaryMode = Literal["r", "w", "rb", "wb"] -_ZipFileMode = Literal["r", "w", "x", "a"] +__all__ = [ + "BadZipFile", + "BadZipfile", + "error", + "ZIP_STORED", + "ZIP_DEFLATED", + "ZIP_BZIP2", + "ZIP_LZMA", + "is_zipfile", + "ZipInfo", + "ZipFile", + "PyZipFile", + "LargeZipFile", +] + +if sys.version_info >= (3, 8): + __all__ += ["Path"] + +_DateTuple: TypeAlias = tuple[int, int, int, int, int, int] +_ReadWriteMode: TypeAlias = Literal["r", "w"] +_ReadWriteBinaryMode: TypeAlias = Literal["r", "w", "rb", "wb"] +_ZipFileMode: TypeAlias = Literal["r", "w", "x", "a"] class BadZipFile(Exception): ... @@ -25,84 +44,50 @@ class _ZipStream(Protocol): # def tell(self) -> int: ... # def seek(self, __n: int) -> object: ... +# Stream shape as required by _EndRecData() and _EndRecData64(). +class _SupportsReadSeekTell(Protocol): + def read(self, __n: int = ...) -> bytes: ... + def seek(self, __cookie: int, __whence: int) -> object: ... + def tell(self) -> int: ... + class _ClosableZipStream(_ZipStream, Protocol): def close(self) -> object: ... class ZipExtFile(io.BufferedIOBase): MAX_N: int MIN_READ_SIZE: int - - if sys.version_info >= (3, 7): - MAX_SEEK_READ: int - + MAX_SEEK_READ: int newlines: list[bytes] | None mode: _ReadWriteMode name: str - if sys.version_info >= (3, 7): - @overload - def __init__( - self, - fileobj: _ClosableZipStream, - mode: _ReadWriteMode, - zipinfo: ZipInfo, - pwd: bytes | None, - close_fileobj: Literal[True], - ) -> None: ... - @overload - def __init__( - self, - fileobj: _ClosableZipStream, - mode: _ReadWriteMode, - zipinfo: ZipInfo, - pwd: bytes | None = ..., - *, - close_fileobj: Literal[True], - ) -> None: ... - @overload - def __init__( - self, - fileobj: _ZipStream, - mode: _ReadWriteMode, - zipinfo: ZipInfo, - pwd: bytes | None = ..., - close_fileobj: Literal[False] = ..., - ) -> None: ... - else: - @overload - def __init__( - self, - fileobj: _ClosableZipStream, - mode: _ReadWriteMode, - zipinfo: ZipInfo, - decrypter: Callable[[Sequence[int]], bytes] | None, - close_fileobj: Literal[True], - ) -> None: ... - @overload - def __init__( - self, - fileobj: _ClosableZipStream, - mode: _ReadWriteMode, - zipinfo: ZipInfo, - decrypter: Callable[[Sequence[int]], bytes] | None = ..., - *, - close_fileobj: Literal[True], - ) -> None: ... - @overload - def __init__( - self, - fileobj: _ZipStream, - mode: _ReadWriteMode, - zipinfo: ZipInfo, - decrypter: Callable[[Sequence[int]], bytes] | None = ..., - close_fileobj: Literal[False] = ..., - ) -> None: ... + @overload + def __init__( + self, fileobj: _ClosableZipStream, mode: _ReadWriteMode, zipinfo: ZipInfo, pwd: bytes | None, close_fileobj: Literal[True] + ) -> None: ... + @overload + def __init__( + self, + fileobj: _ClosableZipStream, + mode: _ReadWriteMode, + zipinfo: ZipInfo, + pwd: bytes | None = ..., + *, + close_fileobj: Literal[True], + ) -> None: ... + @overload + def __init__( + self, + fileobj: _ZipStream, + mode: _ReadWriteMode, + zipinfo: ZipInfo, + pwd: bytes | None = ..., + close_fileobj: Literal[False] = ..., + ) -> None: ... def read(self, n: int | None = ...) -> bytes: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore - def __repr__(self) -> str: ... + def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override] def peek(self, n: int = ...) -> bytes: ... - def read1(self, n: int | None) -> bytes: ... # type: ignore - if sys.version_info >= (3, 7): - def seek(self, offset: int, whence: int = ...) -> int: ... + def read1(self, n: int | None) -> bytes: ... # type: ignore[override] + def seek(self, offset: int, whence: int = ...) -> int: ... class _Writer(Protocol): def write(self, __s: str) -> object: ... @@ -118,8 +103,21 @@ class ZipFile: compression: int # undocumented compresslevel: int | None # undocumented mode: _ZipFileMode # undocumented - pwd: str | None # undocumented - if sys.version_info >= (3, 8): + pwd: bytes | None # undocumented + if sys.version_info >= (3, 11): + @overload + def __init__( + self, + file: StrPath | IO[bytes], + mode: Literal["r"] = ..., + compression: int = ..., + allowZip64: bool = ..., + compresslevel: int | None = ..., + *, + strict_timestamps: bool = ..., + metadata_encoding: str | None, + ) -> None: ... + @overload def __init__( self, file: StrPath | IO[bytes], @@ -129,8 +127,9 @@ class ZipFile: compresslevel: int | None = ..., *, strict_timestamps: bool = ..., + metadata_encoding: None = ..., ) -> None: ... - elif sys.version_info >= (3, 7): + elif sys.version_info >= (3, 8): def __init__( self, file: StrPath | IO[bytes], @@ -138,14 +137,22 @@ class ZipFile: compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., + *, + strict_timestamps: bool = ..., ) -> None: ... else: def __init__( - self, file: StrPath | IO[bytes], mode: _ZipFileMode = ..., compression: int = ..., allowZip64: bool = ... + self, + file: StrPath | IO[bytes], + mode: _ZipFileMode = ..., + compression: int = ..., + allowZip64: bool = ..., + compresslevel: int | None = ..., ) -> None: ... + def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... def close(self) -> None: ... def getinfo(self, name: str) -> ZipInfo: ... @@ -162,26 +169,18 @@ class ZipFile: def setpassword(self, pwd: bytes) -> None: ... def read(self, name: str | ZipInfo, pwd: bytes | None = ...) -> bytes: ... def testzip(self) -> str | None: ... - if sys.version_info >= (3, 7): - def write( - self, - filename: StrPath, - arcname: StrPath | None = ..., - compress_type: int | None = ..., - compresslevel: int | None = ..., - ) -> None: ... - else: - def write(self, filename: StrPath, arcname: StrPath | None = ..., compress_type: int | None = ...) -> None: ... - if sys.version_info >= (3, 7): - def writestr( - self, - zinfo_or_arcname: str | ZipInfo, - data: bytes | str, - compress_type: int | None = ..., - compresslevel: int | None = ..., - ) -> None: ... - else: - def writestr(self, zinfo_or_arcname: str | ZipInfo, data: bytes | str, compress_type: int | None = ...) -> None: ... + def write( + self, filename: StrPath, arcname: StrPath | None = ..., compress_type: int | None = ..., compresslevel: int | None = ... + ) -> None: ... + def writestr( + self, + zinfo_or_arcname: str | ZipInfo, + data: _BufferWithLen | str, + compress_type: int | None = ..., + compresslevel: int | None = ..., + ) -> None: ... + if sys.version_info >= (3, 11): + def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = ...) -> None: ... class PyZipFile(ZipFile): def __init__( @@ -211,10 +210,13 @@ class ZipInfo: def __init__(self, filename: str = ..., date_time: _DateTuple = ...) -> None: ... if sys.version_info >= (3, 8): @classmethod - def from_file(cls, filename: StrPath, arcname: StrPath | None = ..., *, strict_timestamps: bool = ...) -> ZipInfo: ... + def from_file( + cls: type[Self], filename: StrPath, arcname: StrPath | None = ..., *, strict_timestamps: bool = ... + ) -> Self: ... else: @classmethod - def from_file(cls, filename: StrPath, arcname: StrPath | None = ...) -> ZipInfo: ... + def from_file(cls: type[Self], filename: StrPath, arcname: StrPath | None = ...) -> Self: ... + def is_dir(self) -> bool: ... def FileHeader(self, zip64: bool | None = ...) -> bytes: ... @@ -230,12 +232,21 @@ if sys.version_info >= (3, 8): if sys.version_info >= (3, 10): @property def filename(self) -> PathLike[str]: ... # undocumented + if sys.version_info >= (3, 11): + @property + def suffix(self) -> str: ... + @property + def suffixes(self) -> list[str]: ... + @property + def stem(self) -> str: ... + def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = ...) -> None: ... if sys.version_info >= (3, 9): def open(self, mode: _ReadWriteBinaryMode = ..., *args: Any, pwd: bytes | None = ..., **kwargs: Any) -> IO[bytes]: ... else: @property def open(self) -> _PathOpenProtocol: ... + def iterdir(self) -> Iterator[Path]: ... def is_dir(self) -> bool: ... def is_file(self) -> bool: ... @@ -253,9 +264,10 @@ if sys.version_info >= (3, 8): def joinpath(self, *other: StrPath) -> Path: ... else: def joinpath(self, add: StrPath) -> Path: ... # undocumented + def __truediv__(self, add: StrPath) -> Path: ... -def is_zipfile(filename: StrPath | IO[bytes]) -> bool: ... +def is_zipfile(filename: StrOrBytesPath | _SupportsReadSeekTell) -> bool: ... ZIP_STORED: int ZIP_DEFLATED: int diff --git a/stdlib/zipimport.pyi b/stdlib/zipimport.pyi index 8ca97bf..d3017f3 100644 --- a/stdlib/zipimport.pyi +++ b/stdlib/zipimport.pyi @@ -1,24 +1,31 @@ -import os import sys +from _typeshed import StrOrBytesPath +from importlib.abc import ResourceReader +from importlib.machinery import ModuleSpec from types import CodeType, ModuleType -from typing import Any, Tuple -if sys.version_info >= (3, 7): - from importlib.abc import ResourceReader +if sys.version_info >= (3, 8): + __all__ = ["ZipImportError", "zipimporter"] class ZipImportError(ImportError): ... -class zipimporter(object): +class zipimporter: archive: str prefix: str - def __init__(self, path: str | bytes | os.PathLike[Any]) -> None: ... - def find_loader(self, fullname: str, path: str | None = ...) -> Tuple[zipimporter | None, list[str]]: ... # undocumented + if sys.version_info >= (3, 11): + def __init__(self, path: str) -> None: ... + else: + def __init__(self, path: StrOrBytesPath) -> None: ... + + def find_loader(self, fullname: str, path: str | None = ...) -> tuple[zipimporter | None, list[str]]: ... # undocumented def find_module(self, fullname: str, path: str | None = ...) -> zipimporter | None: ... def get_code(self, fullname: str) -> CodeType: ... def get_data(self, pathname: str) -> str: ... def get_filename(self, fullname: str) -> str: ... - if sys.version_info >= (3, 7): - def get_resource_reader(self, fullname: str) -> ResourceReader | None: ... # undocumented + def get_resource_reader(self, fullname: str) -> ResourceReader | None: ... # undocumented def get_source(self, fullname: str) -> str | None: ... def is_package(self, fullname: str) -> bool: ... def load_module(self, fullname: str) -> ModuleType: ... + if sys.version_info >= (3, 10): + def find_spec(self, fullname: str, target: ModuleType | None = ...) -> ModuleSpec | None: ... + def invalidate_caches(self) -> None: ... diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index 5acc419..ea41567 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -1,29 +1,34 @@ -from array import array -from typing import Any +import sys +from _typeshed import ReadableBuffer +from typing_extensions import Literal -DEFLATED: int -DEF_MEM_LEVEL: int +DEFLATED: Literal[8] +DEF_MEM_LEVEL: int # can change +DEF_BUF_SIZE: Literal[16384] MAX_WBITS: int -ZLIB_VERSION: str -Z_BEST_COMPRESSION: int -Z_BEST_SPEED: int -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 -DEF_BUF_SIZE: int -ZLIB_RUNTIME_VERSION: str +ZLIB_VERSION: str # can change +ZLIB_RUNTIME_VERSION: str # can change +Z_NO_COMPRESSION: Literal[0] +Z_PARTIAL_FLUSH: Literal[1] +Z_BEST_COMPRESSION: Literal[9] +Z_BEST_SPEED: Literal[1] +Z_BLOCK: Literal[5] +Z_DEFAULT_COMPRESSION: Literal[-1] +Z_DEFAULT_STRATEGY: Literal[0] +Z_FILTERED: Literal[1] +Z_FINISH: Literal[4] +Z_FIXED: Literal[4] +Z_FULL_FLUSH: Literal[3] +Z_HUFFMAN_ONLY: Literal[2] +Z_NO_FLUSH: Literal[0] +Z_RLE: Literal[3] +Z_SYNC_FLUSH: Literal[2] +Z_TREES: Literal[6] class error(Exception): ... class _Compress: - def compress(self, data: bytes) -> bytes: ... + def compress(self, data: ReadableBuffer) -> bytes: ... def flush(self, mode: int = ...) -> bytes: ... def copy(self) -> _Compress: ... @@ -31,15 +36,26 @@ class _Decompress: unused_data: bytes unconsumed_tail: bytes eof: bool - def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... + def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ... def flush(self, length: int = ...) -> bytes: ... def copy(self) -> _Decompress: ... -def adler32(__data: bytes, __value: int = ...) -> int: ... -def compress(__data: bytes, level: int = ...) -> bytes: ... +def adler32(__data: ReadableBuffer, __value: int = ...) -> int: ... + +if sys.version_info >= (3, 11): + def compress(__data: ReadableBuffer, level: int = ..., wbits: int = ...) -> bytes: ... + +else: + def compress(__data: ReadableBuffer, level: int = ...) -> bytes: ... + def compressobj( - level: int = ..., method: int = ..., wbits: int = ..., memLevel: int = ..., strategy: int = ..., zdict: bytes | None = ... + level: int = ..., + method: int = ..., + wbits: int = ..., + memLevel: int = ..., + strategy: int = ..., + zdict: ReadableBuffer | None = ..., ) -> _Compress: ... -def crc32(__data: array[Any] | bytes, __value: int = ...) -> int: ... -def decompress(__data: bytes, wbits: int = ..., bufsize: int = ...) -> bytes: ... -def decompressobj(wbits: int = ..., zdict: bytes = ...) -> _Decompress: ... +def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ... +def decompress(__data: ReadableBuffer, wbits: int = ..., bufsize: int = ...) -> bytes: ... +def decompressobj(wbits: int = ..., zdict: ReadableBuffer = ...) -> _Decompress: ... diff --git a/stdlib/zoneinfo/__init__.pyi b/stdlib/zoneinfo/__init__.pyi index 2a188c7..8b9ba9e 100644 --- a/stdlib/zoneinfo/__init__.pyi +++ b/stdlib/zoneinfo/__init__.pyi @@ -1,9 +1,9 @@ -import typing -from _typeshed import StrPath -from datetime import tzinfo -from typing import Any, Iterable, Protocol, Sequence, Set, Type +from _typeshed import Self, StrPath +from collections.abc import Iterable, Sequence +from datetime import datetime, timedelta, tzinfo +from typing import Any, Protocol -_T = typing.TypeVar("_T", bound="ZoneInfo") +__all__ = ["ZoneInfo", "reset_tzpath", "available_timezones", "TZPATH", "ZoneInfoNotFoundError", "InvalidTZPathWarning"] class _IOBytes(Protocol): def read(self, __size: int) -> bytes: ... @@ -14,19 +14,24 @@ class ZoneInfo(tzinfo): def key(self) -> str: ... def __init__(self, key: str) -> None: ... @classmethod - def no_cache(cls: Type[_T], key: str) -> _T: ... + def no_cache(cls: type[Self], key: str) -> Self: ... @classmethod - def from_file(cls: Type[_T], __fobj: _IOBytes, key: str | None = ...) -> _T: ... + def from_file(cls: type[Self], __fobj: _IOBytes, key: str | None = ...) -> Self: ... @classmethod - def clear_cache(cls, *, only_keys: Iterable[str] = ...) -> None: ... + def clear_cache(cls, *, only_keys: Iterable[str] | None = ...) -> None: ... + def tzname(self, __dt: datetime | None) -> str | None: ... + def utcoffset(self, __dt: datetime | None) -> timedelta | None: ... + def dst(self, __dt: datetime | None) -> timedelta | None: ... # Note: Both here and in clear_cache, the types allow the use of `str` where # a sequence of strings is required. This should be remedied if a solution # to this typing bug is found: https://github.com/python/typing/issues/256 def reset_tzpath(to: Sequence[StrPath] | None = ...) -> None: ... -def available_timezones() -> Set[str]: ... +def available_timezones() -> set[str]: ... TZPATH: Sequence[str] class ZoneInfoNotFoundError(KeyError): ... class InvalidTZPathWarning(RuntimeWarning): ... + +def __dir__() -> list[str]: ... diff --git a/stub-uploader/.github/workflows/check_scripts.yml b/stub-uploader/.github/workflows/check_scripts.yml index 6d3da4f..1d99716 100644 --- a/stub-uploader/.github/workflows/check_scripts.yml +++ b/stub-uploader/.github/workflows/check_scripts.yml @@ -9,43 +9,45 @@ jobs: name: Check formatting with black runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v2 - - uses: actions/checkout@v2 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - uses: actions/checkout@v3 - run: pip install black - run: | black --version black --check . mypy: - name: Check scripts with mypy + name: Check stub_uploader with mypy runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: - python-version: '3.9' - - uses: actions/checkout@v2 - - run: pip install mypy types-requests types-toml pytest - - run: mypy --strict -p scripts -p tests + python-version: '3.10' + - uses: actions/checkout@v3 + - run: pip install -r requirements.txt + - run: mypy --strict -p stub_uploader -p tests tests: name: Run integration and unit tests runs-on: ubuntu-latest steps: - - name: Setup Python 3.9 - uses: actions/setup-python@v2 + - name: Setup Python + uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Checkout main - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: main - name: Checkout typeshed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: python/typeshed path: typeshed - name: Run tests run: | - pip install pytest toml requests setuptools wheel cd main + pip install -r requirements.txt python -m pytest tests diff --git a/stub-uploader/.github/workflows/force_update.yml b/stub-uploader/.github/workflows/force_update.yml index 837cb04..107d9fe 100644 --- a/stub-uploader/.github/workflows/force_update.yml +++ b/stub-uploader/.github/workflows/force_update.yml @@ -11,30 +11,30 @@ jobs: build-and-upload: runs-on: ubuntu-latest steps: - - name: Setup Python 3.9 - uses: actions/setup-python@v2 + - name: Setup Python + uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Checkout main - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: main - name: Checkout typeshed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: python/typeshed path: typeshed - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine toml requests + pip install -r main/requirements.txt - name: Execute build and upload env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.TYPESHED_BOT_API_TOKEN }} run: | cd main - python -m scripts.upload_some ../typeshed ${{ github.event.inputs.distribution }} data/uploaded_packages.txt + python -m stub_uploader.upload_some ../typeshed "${{ github.event.inputs.distribution }}" # If we are force uploading packages that were never uploaded, they are added to the list if [ -z "$(git status --porcelain)" ]; then exit 0; diff --git a/stub-uploader/.github/workflows/test_api_token.yml b/stub-uploader/.github/workflows/test_api_token.yml index bd4bd49..fb9d515 100644 --- a/stub-uploader/.github/workflows/test_api_token.yml +++ b/stub-uploader/.github/workflows/test_api_token.yml @@ -14,11 +14,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/stub-uploader/.github/workflows/update_stubs.yml b/stub-uploader/.github/workflows/update_stubs.yml index 428be59..d1fc66d 100644 --- a/stub-uploader/.github/workflows/update_stubs.yml +++ b/stub-uploader/.github/workflows/update_stubs.yml @@ -1,4 +1,4 @@ -name: Daily update of stubs from typeshed to PyPI +name: Periodic update of stubs from typeshed to PyPI on: # Triggers the workflow every three hours starting midnight UTC. @@ -11,16 +11,16 @@ jobs: build-and-upload: runs-on: ubuntu-latest steps: - - name: Setup Python 3.9 - uses: actions/setup-python@v2 + - name: Setup Python + uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: '3.10' - name: Checkout main - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: main - name: Checkout typeshed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: python/typeshed path: typeshed @@ -30,14 +30,14 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine toml requests + pip install -r main/requirements.txt - name: Execute diff build and upload tasks env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.TYPESHED_BOT_API_TOKEN }} run: | cd main - python -m scripts.upload_changed ../typeshed $(cat data/last_typeshed_commit.sha1) data/uploaded_packages.txt + python -m stub_uploader.upload_changed ../typeshed $(cat data/last_typeshed_commit.sha1) (cd ../typeshed; git rev-parse HEAD) > data/last_typeshed_commit.sha1 if [ -z "$(git status --porcelain)" ]; then exit 0; diff --git a/stub-uploader/README.md b/stub-uploader/README.md index 074005c..2e54338 100644 --- a/stub-uploader/README.md +++ b/stub-uploader/README.md @@ -1,12 +1,12 @@ # stub_uploader -[![Build status](https://github.com/typeshed-internal/stub_uploader/workflows/Check%20scripts/badge.svg)](https://github.com/typeshed-internal/stub_uploader/actions?query=workflow%3A%22Check+scripts%22) -[![Upload status](https://github.com/typeshed-internal/stub_uploader/workflows/Daily%20update%20of%20stubs%20from%20typeshed%20to%20PyPI/badge.svg)](https://github.com/typeshed-internal/stub_uploader/actions?query=workflow%3A%22Daily+update+of+stubs+from+typeshed+to+PyPI%22) +[![Build status](https://github.com/typeshed-internal/stub_uploader/actions/workflows/check_scripts.yml/badge.svg)](https://github.com/typeshed-internal/stub_uploader/actions/workflows/check_scripts.yml) +[![Upload status](https://github.com/typeshed-internal/stub_uploader/actions/workflows/update_stubs.yml/badge.svg)](https://github.com/typeshed-internal/stub_uploader/actions/workflows/update_stubs.yml) This repository contains scripts and GitHub actions to auto-upload [typeshed](https://github.com/python/typeshed) stubs to [PyPI](https://pypi.org/). The directory layout is self-explanatory: -* `/scripts` contains the Python scripts used by GitHub actions. +* `/stub_uploader` contains the Python scripts used by GitHub actions. * `/tests` contains some tests for the above scripts. * `/data` keeps the state for upload tasks. Currently this is the last [typeshed commit](https://github.com/typeshed-internal/stub_uploader/blob/main/data/last_typeshed_commit.sha1) @@ -55,8 +55,8 @@ specifies version `X.Y`, this will check what is the latest uploaded minor versi [This action](https://github.com/typeshed-internal/stub_uploader/actions?query=workflow%3A%22Force+update+of+some+stubs+from+typeshed+to+PyPI%22) can be run to manually force upload new version of some packages. When you click on "Run workflow", you will need to select the name of distribution to upload. This can be a Python regexp, for example, -`six` will only upload the `six` package, `"(typing-extensions|mypy-extensions)"` will upload both packages, -and entering `".*"` will select all packages (quotes are needed since these are passed as arguments in bash). +`six` will only upload the `six` package, `(typing-extensions|mypy-extensions)` will upload both packages, +and entering `.*` will select all packages. Note that this action also sorts packages in the dependency order, but it doesn't update the typeshed commit. It may update [list of uploaded packages](https://github.com/typeshed-internal/stub_uploader/blob/main/data/uploaded_packages.txt) if this is the first time the package is uploaded. diff --git a/stub-uploader/data/changelogs/D3DShot.md b/stub-uploader/data/changelogs/D3DShot.md new file mode 100644 index 0000000..7d722b7 --- /dev/null +++ b/stub-uploader/data/changelogs/D3DShot.md @@ -0,0 +1,4 @@ +## 0.1.0 (2022-09-12) + +Add stubs for D3DShot (#8652) + diff --git a/stub-uploader/data/changelogs/DateTimeRange.md b/stub-uploader/data/changelogs/DateTimeRange.md new file mode 100644 index 0000000..5e20c9a --- /dev/null +++ b/stub-uploader/data/changelogs/DateTimeRange.md @@ -0,0 +1,47 @@ +## 1.2.8 (2022-08-03) + +Add some missing stubs in datetimerange (#8470) + +## 1.2.7 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 1.2.6 (2022-06-26) + +DateTimeRange: complete stubs (#8168) + +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 1.2.5 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.2.4 (2022-03-24) + +DateTimeRange: __contains__ accepts datetime.datetime (#7541) + +## 1.2.3 (2022-02-07) + +Improve some in-place BinOp methods (#7149) + +## 1.2.1 (2022-01-02) + +Never explicitly inherit from `object` in Python 3-only stubs (#6777) + +## 1.2.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/Deprecated.md b/stub-uploader/data/changelogs/Deprecated.md index 91fbb60..0cbf8a1 100644 --- a/stub-uploader/data/changelogs/Deprecated.md +++ b/stub-uploader/data/changelogs/Deprecated.md @@ -1,3 +1,29 @@ +## 1.2.9 (2022-06-26) + +deprecated: complete stubs (#8169) + +Co-authored-by: hauntsaninja <> + +## 1.2.8 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 1.2.7 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 1.2.6 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.2.5 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.2.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 1.2.1 (2021-09-06) Update deprecated.sphinx.deprecated signature (#6005) diff --git a/stub-uploader/data/changelogs/Flask-Cors.md b/stub-uploader/data/changelogs/Flask-Cors.md new file mode 100644 index 0000000..4433de6 --- /dev/null +++ b/stub-uploader/data/changelogs/Flask-Cors.md @@ -0,0 +1,52 @@ +## 3.0.10 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 3.0.9 (2022-07-07) + +Fix various `TypeAlias` issues (#8248) + +## 3.0.8 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 3.0.7 (2022-05-06) + +`flask-cors.decorator`: allow `re.Pattern` objects to `origins` and `allow_headers` parameters (#7782) + +## 3.0.6 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 3.0.5 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 3.0.4 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 3.0.3 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 3.0.2 (2022-02-20) + +flask-cors: remove unused allowlist (#7309) + +Co-authored-by: hauntsaninja <> + +## 3.0.1 (2022-01-22) + +Use class-based syntax for `TypedDict` in `Flask-Cors/flask_cors/core.pyi` (#6995) + +Refs https://github.com/PyCQA/flake8-pyi/pull/133 + +Add missing default values to flask-cors cross_origin (#6994) + +## 3.0.0 (2022-01-22) + +Add stubs for flask-cors (#6939) + diff --git a/stub-uploader/data/changelogs/Flask-SQLAlchemy.md b/stub-uploader/data/changelogs/Flask-SQLAlchemy.md new file mode 100644 index 0000000..4d6161a --- /dev/null +++ b/stub-uploader/data/changelogs/Flask-SQLAlchemy.md @@ -0,0 +1,48 @@ +## 2.5.9 (2022-08-22) + +`Flask-SQLAlchemy`: `session` should be `scoped_session`, not `Session` (#8589) + +## 2.5.8 (2022-08-20) + +`Flask-SQLAlchemy`: type `session` as `Session` (#8550) + +## 2.5.7 (2022-08-12) + +Annotate Model in SQLAlchemy (#8535) + +## 2.5.6 (2022-08-10) + +`Flask-SQLAlchemy`: Make model query non-generic (#8455) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 2.5.5 (2022-07-31) + +Add type hints to `flask_sqlalchemy.model` (#8389) + +## 2.5.4 (2022-07-31) + +Annotate flask_sqlalchemy.__init__.Pagination (#8390) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 2.5.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 2.5.2 (2022-05-19) + +Import SQLAlchemy types in Flask-SQLAlchemy (#7861) + +## 2.5.1 (2022-01-22) + +Add __getattr__ to flask-sqlalchemy (#6993) + +The SQLAlchemy class exposes dynamically classes of SQLAlchemy. The exact classes depend on used SQLAlchemy version. + +## 2.5.0 (2022-01-20) + +Add stubs for Flask-SQLAlchemy (#6946) + diff --git a/stub-uploader/data/changelogs/Flask.md b/stub-uploader/data/changelogs/Flask.md new file mode 100644 index 0000000..c3bd7cd --- /dev/null +++ b/stub-uploader/data/changelogs/Flask.md @@ -0,0 +1,14 @@ +## 1.1.6 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 1.1.5 (2021-11-09) + +Fix typos (#6263) + +Found via `codespell -q 3 -L alo,asend,ba,nams,spawnve` + +## 1.1.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/JACK-Client.md b/stub-uploader/data/changelogs/JACK-Client.md new file mode 100644 index 0000000..1d3f3e8 --- /dev/null +++ b/stub-uploader/data/changelogs/JACK-Client.md @@ -0,0 +1,57 @@ +## 0.5.10 (2022-06-26) + +`JACK-Client`: audit callback annotations (#8177) + +The returned values from these functions are all ignored at runtime. + +## 0.5.9 (2022-06-19) + +stubtest: use separate table in METADATA.toml (#8096) + +## 0.5.8 (2022-04-28) + +jack: Fix MidiPort properties (#7730) + +Fixes #7729 + +https://github.com/spatialaudio/jackclient-python/blob/26b648a36143b1e3db6e6fc827ca927b0c93cbec/src/jack.py#L1950 + +Co-authored-by: Alex Waygood + +## 0.5.7 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 0.5.6 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.5.5 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 0.5.4 (2022-01-22) + +Add missing context manager stub for JACK Client (#6982) + +Co-authored-by: Akuli + +## 0.5.2 (2021-12-29) + +Enable stubtest for jack (#6727) + +## 0.5.1 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 0.5.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/Jinja2.md b/stub-uploader/data/changelogs/Jinja2.md new file mode 100644 index 0000000..12776be --- /dev/null +++ b/stub-uploader/data/changelogs/Jinja2.md @@ -0,0 +1,12 @@ +## 2.11.9 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 2.11.8 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.11.7 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/Markdown.md b/stub-uploader/data/changelogs/Markdown.md index c278ee6..fb62c9d 100644 --- a/stub-uploader/data/changelogs/Markdown.md +++ b/stub-uploader/data/changelogs/Markdown.md @@ -1,3 +1,163 @@ +## 3.4.2.1 (2022-10-06) + +markdown: Specify md type (#8857) + +Signed-off-by: Anders Kaseorg + +## 3.4.2 (2022-09-18) + +Add markdown.util.nearing_recursion_limit (#8764) + +## 3.4.1 (2022-08-21) + +`Markdown`: `BlockProcessor.detab` returns a pair of strings (#8586) + +## 3.4.0 (2022-07-18) + +[stubsabot] Bump Markdown to 3.4.* (#8309) + +## 3.3.31 (2022-07-16) + +`markdown`: remove deleted methods of `Registry`. (#8197) + +## 3.3.30 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 3.3.29 (2022-06-26) + +Markdown: Fix BlockProcessor method return types (#8166) + +Signed-off-by: Anders Kaseorg + +## 3.3.28 (2022-06-13) + +`markdown`: annotate `HtmlStash`. (#8067) + +## 3.3.27 (2022-06-01) + +markdown: remove `INSTALLED_EXTENSIONS`. (#8002) + +## 3.3.26 (2022-05-31) + +markdown: add `Markdown.registeredExtensions` (#7997) + +## 3.3.25 (2022-05-30) + +markdown: annotate `Registry.__len__()`. (#7986) + +## 3.3.24 (2022-05-28) + +markdown: remove `__getattr__()` (#7962) + +## 3.3.23 (2022-05-26) + +markdown: annotate `__deprecated__` (#7955) + +## 3.3.22 (2022-05-24) + +markdown: Annotate methods of `Registry` (#7926) + +Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> + +## 3.3.21 (2022-05-19) + +markdown: Annotate `parseBoolValue()` (#7875) + +## 3.3.20 (2022-05-18) + +markdown: Annotate `code_escape()`. (#7857) + +## 3.3.19 (2022-05-17) + +Markdown: use I/O protocols (#7851) + +## 3.3.18 (2022-05-17) + +markdown: Annotate `Registry.get_index_for_name()` (#7848) + +## 3.3.17 (2022-05-16) + +markdown: `isBlockLevel()` returns a bool value. (#7839) + +## 3.3.16 (2022-05-13) + +markdown: `@deprecated` argument of `message` is a str. (#7835) + +## 3.3.15 (2022-05-12) + +markdown: PY37 is a bool (#7831) + +## 3.3.14 (2022-04-27) + +Add various missing generic arguments (#7702) + +Co-authored-by: Akuli + +## 3.3.13 (2022-04-16) + +Python 3 stubs: use `str` instead of `typing.Text` (#7638) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 3.3.12 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 3.3.10 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 3.3.9 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 3.3.8 (2021-11-16) + +Add hilite(shebang) argument and return type (#6316) + +## 3.3.7 (2021-11-09) + +Add markdown.blockprocessors.ReferenceProcessor (#6270) + +## 3.3.6 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 3.3.5 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.3.4 (2021-10-05) markdown: fix type of Pattern (#6115) diff --git a/stub-uploader/data/changelogs/MarkupSafe.md b/stub-uploader/data/changelogs/MarkupSafe.md new file mode 100644 index 0000000..72cb9f3 --- /dev/null +++ b/stub-uploader/data/changelogs/MarkupSafe.md @@ -0,0 +1,16 @@ +## 1.1.10 (2021-11-27) + +Improve stubs for sequence types (#6386) + +## 1.1.9 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 1.1.8 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.1.7 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/Pillow.md b/stub-uploader/data/changelogs/Pillow.md index c190475..5a1d0b5 100644 --- a/stub-uploader/data/changelogs/Pillow.md +++ b/stub-uploader/data/changelogs/Pillow.md @@ -1,3 +1,207 @@ +## 9.3.0.0 (2022-10-30) + +[stubsabot] Bump Pillow to 9.3.* (#9039) + +Release: https://pypi.org/pypi/Pillow/9.3.0 +Homepage: https://python-pillow.org +Changelog: https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst +Diff: https://github.com/python-pillow/Pillow/compare/9.2.0...9.3.0 + +Stubsabot analysis of the diff between the two releases: + - Total lines of Python code added: 4163. + - Total lines of Python code deleted: 3435. + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 9.2.2.2 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 9.2.2.1 (2022-10-10) + +Allow PIL.Image.MAX_IMAGE_PIXELS to be None (#8876) + +`_decompression_bomb_check()` explicitly checks for `None` and handles it as "unlimited". + +## 9.2.2 (2022-09-20) + +fix: pillow.ImageDraw.textlength may return float (#8773) + +## 9.2.1 (2022-07-29) + +[pillow] add new `PIL.Image` enums (#8419) + +Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> + +## 9.2.0 (2022-07-04) + +[stubsabot] Bump Pillow to 9.2.* (#8226) + +Improve`_Color` type alias of `PIL.Image` (#8210) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 9.0.20 (2022-06-17) + +Fix `box` parameter type of `Pillow.PIL.Image.paste` (#8090) + +When executing `img.paste(cropped, box=(10.5, 10.5))`: +TypeError: 'float' object cannot be interpreted as an integer + +So the `box` parameter's type should be not `tuple[float, float]` but `tuple[int, int]`. (same as `_Box`) + +## 9.0.19 (2022-05-27) + +Pillow: change `_Mode` type alias to `str` (#7967) + +## 9.0.18 (2022-05-26) + +Pillow: Add missing image modes to `_Mode` type alias in `Image.pyi` stub (issue #7956) (#7960) + +## 9.0.17 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 9.0.16 (2022-05-25) + +`Pillow`: use union type for `Image.paste` (#7893) + +## 9.0.15 (2022-05-08) + +#7805: Ensure all references to mode are Literals, not str. (#7807) + +## 9.0.14 (2022-04-27) + +Add various missing generic arguments (#7702) + +Co-authored-by: Akuli + +## 9.0.13 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 9.0.12 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 9.0.11 (2022-04-05) + +Replace Union with union operator (#7596) + +## 9.0.10 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 9.0.9 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 9.0.8 (2022-03-19) + +Use PEP 604 syntax wherever possible, part II (#7514) + +Co-authored-by: Jelle Zijlstra + +## 9.0.7 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 9.0.6 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 9.0.5 (2022-01-22) + +fix incorrect tuple[T] (#6996) + +Found from PyCQA/flake8-pyi#135. + +## 9.0.4 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 9.0.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 9.0.2 (2022-01-07) + +Pillow: Image fixes (#6848) + +* Fix return type of `Image.transform()`. +* Add animation attributes to `Image`. + +## 9.0.0 (2022-01-05) + +Upgrade stubs to Pillow 9 (#6795) + +Co-authored-by: Akuli + +## 8.3.11 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 8.3.10 (2021-12-23) + +Remove PIL.__main__ (#6665) + +## 8.3.9 (2021-12-21) + +correct border= and fill= kwargs for ImageOps.expand (#6641) + +## 8.3.8 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 8.3.7 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + +## 8.3.6 (2021-10-11) + +Annotate PIL.ImageColor (#6151) + +## 8.3.5 (2021-10-11) + +Color arguments also take (r,g,b,a) tuples (#6148) + ## 8.3.4 (2021-09-06) Fix type of stroke_width parameter in Pillow's ImageDraw.*text* functions (#6008) diff --git a/stub-uploader/data/changelogs/PyAutoGUI.md b/stub-uploader/data/changelogs/PyAutoGUI.md new file mode 100644 index 0000000..b51030b --- /dev/null +++ b/stub-uploader/data/changelogs/PyAutoGUI.md @@ -0,0 +1,25 @@ +## 0.9.3.1 (2022-10-04) + +`PyAutoGUI`: Use types from `PyScreeze` (#8824) + +## 0.9.3 (2022-09-10) + +Run third-party stubtest under xvfb-run (#8719) + +## 0.9.2 (2022-09-09) + +Complete `pyautogui` stubs (#8684) + +Co-authored-by: Alex Waygood + +## 0.9.1 (2022-09-03) + +`pyautogui`: just skip stubtest (#8678) + +## 0.9.0 (2022-09-03) + +Add stubs for `pyautogui` (#8654) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + diff --git a/stub-uploader/data/changelogs/PyMySQL.md b/stub-uploader/data/changelogs/PyMySQL.md new file mode 100644 index 0000000..cf00958 --- /dev/null +++ b/stub-uploader/data/changelogs/PyMySQL.md @@ -0,0 +1,111 @@ +## 1.0.19.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 1.0.19 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 1.0.18 (2022-04-21) + +Update PyMySQL constants (#7670) + +## 1.0.17 (2022-04-16) + +Python 3 stubs: use `str` instead of `typing.Text` (#7638) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.0.16 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.0.15 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 1.0.14 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 1.0.13 (2022-01-28) + +Add __enter__/__exit__ to pymysql.Connection (#7069) + +## 1.0.11 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 1.0.10 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.0.8 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.0.7 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 1.0.6 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 1.0.5 (2021-11-09) + +Improve pymysql.converters stubs (#6267) + +I spent far too much time being confused about why pyanalyze thought `pymysql.converters.escape_dict` only takes two arguments. + +I rewrote the stubs from scratch using the implementation: https://github.com/PyMySQL/PyMySQL/blob/main/pymysql/converters.py. + +The "charset" argument is ignored as far as I can tell; it gets passed to other functions but no function actually uses it. + +Co-authored-by: Sebastian Rittau + +## 1.0.4 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.0.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/PyScreeze.md b/stub-uploader/data/changelogs/PyScreeze.md new file mode 100644 index 0000000..adfe2b1 --- /dev/null +++ b/stub-uploader/data/changelogs/PyScreeze.md @@ -0,0 +1,4 @@ +## 0.1.0.0 (2022-10-03) + +Add pyscreeze stubs (#8823) + diff --git a/stub-uploader/data/changelogs/PyYAML.md b/stub-uploader/data/changelogs/PyYAML.md index 9dc75d4..4982371 100644 --- a/stub-uploader/data/changelogs/PyYAML.md +++ b/stub-uploader/data/changelogs/PyYAML.md @@ -1,3 +1,84 @@ +## 6.0.12.1 (2022-10-26) + +Add a couple of missing type hints in pyyaml.constructor (#8965) + +## 6.0.12 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 6.0.11 (2022-07-24) + +`PyYaml`’s Serializer: annotate `open`, `close`, `serialize` (#8383) + +As seen here: +https://github.com/yaml/pyyaml/blob/master/lib/yaml/serializer.py#L27-L41 + +Neither `open` nor `close` methods return, so `None` added as the return type. + +Finally, serialize accepts a Node and does not return as seen here: +https://github.com/yaml/pyyaml/blob/master/lib/yaml/serializer.py#L46-L58 + +## 6.0.10 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 6.0.9 (2022-06-25) + +PyYAML: check missing defs (#8159) + +## 6.0.8 (2022-06-01) + +PyYAML: Add types to `add_constructor` (#7989) + +## 6.0.7 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 6.0.6 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 6.0.5 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 6.0.4 (2022-01-31) + +Replace IO with protocols (#7092) + +## 6.0.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 6.0.1 (2021-11-12) + +Add more type hints for pyyaml (#6265) + +## 6.0.0 (2021-10-22) + +Upgrade PyYAML to version 6 (#6183) + +* Fix load_all() argument +* Remove Python 2 remnants + + Replace Text with str + + Replace alias "_Str" with str + + Import from collections.abc and re where applicable + + Remove Python 2 branches +* Fix PyYaml allowlist entries + + Add yaml._yaml and move CParser and CEmitter there. + + Add missing functions, classes, and arguments. +* Use relative imports in some modules. +* Add __all__ to yaml.cyaml. +* Remove unnecessary noqa markers. + +## 5.4.12 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 5.4.11 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 5.4.10 (2021-09-01) Delete yaml.CDangerLoader and yaml.CDangerDumper (#5990) diff --git a/stub-uploader/data/changelogs/Pygments.md b/stub-uploader/data/changelogs/Pygments.md new file mode 100644 index 0000000..eb5bde0 --- /dev/null +++ b/stub-uploader/data/changelogs/Pygments.md @@ -0,0 +1,99 @@ +## 2.13.1.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 2.13.1 (2022-09-21) + +`pygments.lexers.guess_lexer_for_filename` cannot return `None` (#8777) + +## 2.13.0 (2022-08-19) + +[stubsabot] Bump Pygments to 2.13.* (#8561) + +Co-authored-by: stubsabot <> + +## 2.12.1 (2022-07-05) + +Pygments: add pygments.__version__ (#8241) + +Signed-off-by: Anders Kaseorg + +## 2.12.0 (2022-06-18) + +[stubsabot] Bump Pygments to 2.12.* (#8093) + +Co-authored-by: hauntsaninja <> +Co-authored-by: Akuli + +## 2.9.19 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.9.18 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.9.17 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 2.9.16 (2022-02-07) + +Improve a bunch of `__(deep)copy__` methods (#7148) + +## 2.9.15 (2022-01-22) + +fix incorrect tuple[T] (#6996) + +Found from PyCQA/flake8-pyi#135. + +## 2.9.14 (2022-01-15) + +pygments: delete _TokenType.__init__ (#6918) + +## 2.9.13 (2022-01-08) + +Pygments: make Formatter generic and improve format/highlight (#6819) + +Co-authored-by: Akuli + +## 2.9.12 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.9.10 (2021-12-28) + +pygments: remove outdated TODOs (#6725) + +## 2.9.9 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.9.8 (2021-12-27) + +Always alias `collections.abc.Set` (#6712) + +## 2.9.7 (2021-12-26) + +Annotate return type of pygments.plugin.iter_entry_points (#6697) + +Co-authored-by: Akuli + +pygments: Annotate several generator functions (#6695) + +## 2.9.6 (2021-12-21) + +pygments.formatters.get_all_formatters yields Formatters (#6636) + +## 2.9.5 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 2.9.4 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 2.9.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/SQLAlchemy.md b/stub-uploader/data/changelogs/SQLAlchemy.md new file mode 100644 index 0000000..46cffd4 --- /dev/null +++ b/stub-uploader/data/changelogs/SQLAlchemy.md @@ -0,0 +1,310 @@ +## 1.4.53.3 (2022-11-05) + +[stubsabot] Bump SQLAlchemy to 1.4.43 (#9092) + +Release: https://pypi.org/pypi/SQLAlchemy/1.4.43 +Homepage: https://www.sqlalchemy.org + +## 1.4.53.2 (2022-10-17) + +Fix stubtest failures on `SQLAlchemy` (#8914) + +## 1.4.53.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 1.4.53 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 1.4.52 (2022-09-22) + +Reexport NoResultFound in orm/exc (#8782) + +## 1.4.51 (2022-09-10) + +`SQLAlchemy`: Use `ParamSpec` for `Engine.transaction()` and `Engine.run_callable()` (#8718) + +## 1.4.50 (2022-08-10) + +Fix stubtest failures on `SQLAlchemy` (#8524) + +## 1.4.49 (2022-07-30) + +Remove or move several `TypeAlias` declarations (#8444) + +## 1.4.48 (2022-07-28) + +Fix TODO RE: Use of `Concatenate` and `ParamSpec` in sqlalchemy (#8415) + +## 1.4.47 (2022-07-26) + +SQLAlchemy: Fix annotations for Query.{update,delete} (#8388) + +Closes: #8387 + +## 1.4.46 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 1.4.45 (2022-07-12) + +Use error codes for type ignores (#8280) + +Disable reportSelfClsParameterName for pytype as this is out of typeshed's +control + +Closes: #7497 + +## 1.4.44 (2022-07-11) + +Remove Python 3.6 branches from typeshed (#8269) + +## 1.4.43 (2022-07-08) + +Add Session annotation for sessionmaker call (#8257) + +## 1.4.42 (2022-07-07) + +Improve `SQLAlchemy` type aliases (#8252) + +* Remove `sqlalchemy.dbapi` (in favor of `_typeshed.dbapi`). +* Don't re-export mypy imports from `sqlalchemy.ext.mypy.*`. + +## 1.4.41 (2022-06-25) + +Fix stubtest failures on `SQLAlchemy` (#8148) + +## 1.4.40 (2022-06-22) + +Improve several `__hash__` methods (#8128) + +## 1.4.39 (2022-06-16) + +Upgrade pyright, improve pyright config files (#8072) + +Fix `TypeVar`s in `beautifulsoup` and `SQLAlchemy` (#8087) + +## 1.4.38 (2022-06-06) + +Always use `TypeAlias` when assigning to `Any` (#8021) + +## 1.4.37 (2022-06-01) + +SQLAlchemy 1.4.37 fixes (#8003) + +Closes: #8001 + +## 1.4.36 (2022-05-27) + +constructors: Fix defaulted TypeVars (#7965) + +From the list in https://github.com/microsoft/pyright/issues/3501 + +## 1.4.35 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 1.4.34 (2022-05-10) + +Update testing_engine() annotations (#7818) + +## 1.4.33 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 1.4.32 (2022-04-27) + +Add various missing generic arguments (#7702) + +Co-authored-by: Akuli + +## 1.4.31 (2022-04-20) + +Add typing for __iter__ in sqlalchemy.orm.Query (#7666) + +## 1.4.30 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.4.29 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.4.28 (2022-04-07) + +SQLAlchemy improvements for Operators (#7604) + +## 1.4.27 (2022-04-07) + +SQLAlchemy improvements for generative methods (#7603) + +## 1.4.26 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 1.4.25 (2022-04-01) + +Update SQLalchemy to 1.4.34 (#7573) + +Closes: #7572 + +## 1.4.24 (2022-03-29) + +Remove unneeded `# noqa` comments, fix broken `# noqa` comments (#7561) + +## 1.4.23 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 1.4.22 (2022-03-16) + +pyright: Don't report incompatible overrides (#7498) + +These overrides are inherited from the implementation and are out of +typeshed's control. + +## 1.4.21 (2022-03-16) + +Use pyright 1.1.230 in CI, temporarily pin pyright-action to 1.0.4 (#7495) + +* Upgrade pyright to 1.1.230 +* Add `type: ignore`s for new pyright checks regarding multiple inheritance +* Temporarily pin pyright-action to 1.0.4, as changes made in 1.0.5 break typeshed's CI + +Co-authored-by: Jelle Zijlstra + +## 1.4.20 (2022-03-14) + +sqlalchemy: Annotate `(Async)Session.__(a)enter__` (#7488) + +## 1.4.19 (2022-03-09) + +Re-enable stubtest on SQLAlchemy (#7456) + +## 1.4.18 (2022-02-22) + +Re-introduce the 'stubtest' key for third-party packages (#7351) + +Some distributions can't be tested with stubtest for a variety of +reasons or because of bugs in stubtest. This key: + +* let's us keep metadata about a distribution in one place, +* prevents us from modifying the scripts because of issues with a + specific distribution, and +* will trigger tests if only the key is changed. + +## 1.4.17 (2022-02-17) + +Annotate Session.execute() and Result (#7252) + +* Annotate return type of Session.execute() + +* Annotate Result return types + +* Remove sub-class overrides with identical signatures + +## 1.4.16 (2022-02-17) + +Various SQLalchemy type improvements (#7238) + +* Make ColumnOperators and ColumnElement generic +* Overload Session.query() return type +* Annotate ColumnOperators methods + +## 1.4.15 (2022-02-16) + +Various SQLalchemy fixes and improvements (#7237) + +## 1.4.14 (2022-01-31) + +Upgrade black version (#7089) + +## 1.4.13 (2022-01-22) + +Update SQLAlchemy stubs for 1.4.31 (#6990) + +## 1.4.12 (2022-01-20) + +Update SQLAlchemy stubs for 1.4.30 (#6973) + +## 1.4.11 (2022-01-19) + +Use PEP 585 syntax in `@python2/_ast`, convert more `TypeVar`s to `_typeshed.Self`, & `# noqa` a `SQLAlchemy` line (#6954) + +* Manual fixes for `_ast` and `SQLAlchemy` + +* Change more `TypeVar`s to `Self`, using script + +## 1.4.9 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 1.4.8 (2022-01-09) + +Further annotate sqlalchemy.engine and collections (#6680) + +## 1.4.7 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.4.6 (2022-01-07) + +Update pyright (#6840) + +## 1.4.4 (2021-12-23) + +Add execution_options to Session.get() (#6656) + +Co-authored-by: Jelle Zijlstra + +## 1.4.3 (2021-12-23) + +Fix third-party issues found by stubtest (#6667) + +## 1.4.2 (2021-12-22) + +Various small SQLAlchemy type improvements (#6623) + +## 1.4.1 (2021-12-21) + +SQLAlchemy: Partly annotate declarative API (#6647) + +## 1.4.0 (2021-12-17) + +Create SQLalchemy stubs using stubgen (#6585) + diff --git a/stub-uploader/data/changelogs/Send2Trash.md b/stub-uploader/data/changelogs/Send2Trash.md index 5b7fe1e..e4980e8 100644 --- a/stub-uploader/data/changelogs/Send2Trash.md +++ b/stub-uploader/data/changelogs/Send2Trash.md @@ -1,3 +1,15 @@ +## 1.8.2.2 (2022-11-03) + +Remove `Send2Trash` from `pyright`'s exclude (#8944) + +## 1.8.2.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 1.8.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 1.8.0 (2021-09-03) Create send2trash stubs (#6000) diff --git a/stub-uploader/data/changelogs/Werkzeug.md b/stub-uploader/data/changelogs/Werkzeug.md new file mode 100644 index 0000000..0a4253e --- /dev/null +++ b/stub-uploader/data/changelogs/Werkzeug.md @@ -0,0 +1,16 @@ +## 1.0.9 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 1.0.8 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 1.0.7 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.0.6 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/aiofiles.md b/stub-uploader/data/changelogs/aiofiles.md new file mode 100644 index 0000000..eb87c24 --- /dev/null +++ b/stub-uploader/data/changelogs/aiofiles.md @@ -0,0 +1,106 @@ +## 22.1.0.1 (2022-11-05) + +Remove `aiofiles/tempfile/temptypes.pyi` from pyright exclude (#9104) + +## 22.1.0 (2022-09-09) + +[stubsabot] Bump aiofiles to 22.1.* (#8714) + +Co-authored-by: stubsabot <> + +## 0.8.11 (2022-08-29) + +Delete some unused `# noqa` comments (#8639) + +## 0.8.10 (2022-07-18) + +Run `pycln` as a pre-commit hook in CI (#8304) + +## 0.8.9 (2022-07-06) + +Add missing aiofiles.tempfile classes (#7523) + +Fixes: #6524 + +Co-authored-by: Andrej Shadura +Co-authored-by: AlexWaygood + +## 0.8.8 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.8.7 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.8.6 (2022-03-29) + +Remove unneeded `# noqa` comments, fix broken `# noqa` comments (#7561) + +## 0.8.5 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 0.8.4 (2022-03-07) + +Improve open overloads when mode is a literal union (#7428) + +As pointed out by @gvanrossum in https://github.com/python/typing/issues/1096 + +Improves type inference in cases when we know that mode is +OpenBinaryMode, but don't know anything more specific: +``` +def my_open(name: str, write: bool): + mode: Literal['rb', 'wb'] = 'wb' if write else 'rb' + with open(name, mode) as f: + reveal_type(f) # previously typing.IO[Any], now typing.BinaryIO +``` + +You may be tempted into thinking this is some limitation of type +checkers. mypy does in fact have logic for detecting if we match +multiple overloads and union-ing up the return types of matched +overloads. The problem is the last overload interferes with this logic. +That is, if you remove the fallback overload (prior to this PR), you'd get +"Union[io.BufferedReader, io.BufferedWriter]" in the above example. + +Co-authored-by: hauntsaninja <> + +## 0.8.3 (2022-01-13) + +Add stubs for aiofiles.os.path (#6787) + +## 0.8.2 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.8.0 (2022-01-02) + +Add missing functions and keyword arguments to aiofiles.os (#6785) + +Co-authored-by: Akuli + +## 0.7.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.7.2 (2021-12-26) + +Enable stubtest for aiofiles (#6698) + +## 0.7.1 (2021-12-25) + +Add a 'stubtest' flag to METADATA.toml (#6687) + +Co-authored-by: Akuli + +## 0.7.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/annoy.md b/stub-uploader/data/changelogs/annoy.md new file mode 100644 index 0000000..75e6b9b --- /dev/null +++ b/stub-uploader/data/changelogs/annoy.md @@ -0,0 +1,26 @@ +## 1.17.8.1 (2022-11-06) + +Remove `annoy` from pyright excludelist (#9114) + +## 1.17.8 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 1.17.7 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 1.17.6 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.17.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/appdirs.md b/stub-uploader/data/changelogs/appdirs.md index c9906b5..3c44673 100644 --- a/stub-uploader/data/changelogs/appdirs.md +++ b/stub-uploader/data/changelogs/appdirs.md @@ -1,3 +1,13 @@ +## 1.4.3 (2022-06-25) + +appdirs, tabulate, termcolor, xmltodict: check missing defs (#8156) + +complete termcolor, xmltodict + +## 1.4.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 1.4.0 (2021-09-20) Create stubs for appdirs (#6047) diff --git a/stub-uploader/data/changelogs/atomicwrites.md b/stub-uploader/data/changelogs/atomicwrites.md index a30132b..23ee12a 100644 --- a/stub-uploader/data/changelogs/atomicwrites.md +++ b/stub-uploader/data/changelogs/atomicwrites.md @@ -1,3 +1,27 @@ +## 1.4.5.1 (2022-10-17) + +Mark `atomicwrites` as no longer updated (#8912) + +[`atomicwrites`](https://github.com/untitaker/python-atomicwrites) is a package that's only really useful for Python 2/3 compatibility. It's now deprecated, archived, and unmaintained. Prior to #8883 a few days ago, marking the stubs as complete, the typeshed stubs hadn't received any significant updates for several years. + +I propose we mark the stubs as no longer updated, and then remove them. + +## 1.4.5 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 1.4.4 (2022-04-27) + +Remove Python 2 support from atomicwrites (#7712) + +## 1.4.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.4.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 1.4.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/aws-xray-sdk.md b/stub-uploader/data/changelogs/aws-xray-sdk.md index a7e24c1..43e3536 100644 --- a/stub-uploader/data/changelogs/aws-xray-sdk.md +++ b/stub-uploader/data/changelogs/aws-xray-sdk.md @@ -1,3 +1,34 @@ +## 2.10.1 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 2.10.0 (2022-07-01) + +[stubsabot] Bump aws-xray-sdk to 2.10.* (#8221) + +Co-authored-by: hauntsaninja <> + +## 2.9.0 (2022-06-26) + +[stubsabot] Bump aws-xray-sdk to 2.9.* (#8180) + +* [stubsabot] Bump aws-xray-sdk to 2.9.* + +Co-authored-by: hauntsaninja <> +Co-authored-by: Alex Waygood + +## 2.8.5 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.8.4 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 2.8.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2.8.1 (2021-09-13) Add more annotations to aws_xray_sdk.core.recorder (#6029) diff --git a/stub-uploader/data/changelogs/babel.md b/stub-uploader/data/changelogs/babel.md new file mode 100644 index 0000000..6d98a4a --- /dev/null +++ b/stub-uploader/data/changelogs/babel.md @@ -0,0 +1,73 @@ +## 2.11.0.2 (2022-11-07) + +Added types for `babel.core` and `babel.numbers` (#9111) + +## 2.11.0.1 (2022-11-05) + +Add new functions for Babel 2.11.0 (#9091) + +Co-authored-by: Alex Waygood + +## 2.11.0.0 (2022-11-02) + +[stubsabot junior] Bump babel to 2.11.* (#9064) + +## 2.10.0 (2022-07-01) + +[stubsabot] Bump babel to 2.10.* (#8222) + +## 2.9.12 (2022-04-27) + +Add various missing generic arguments (#7702) + +Co-authored-by: Akuli + +## 2.9.11 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.9.10 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 2.9.9 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 2.9.8 (2022-02-16) + +Remove unused allowlist entries in `babel` and `requests` (#7233) + +## 2.9.7 (2022-02-07) + +Improve a bunch of `__(deep)copy__` methods (#7148) + +## 2.9.6 (2022-01-28) + +Add babel.core.get_global (#7063) + +## 2.9.5 (2022-01-07) + +Update pyright (#6840) + +Improve Babel dates stub (#6730) + +## 2.9.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.9.2 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 2.9.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/backports.ssl_match_hostname.md b/stub-uploader/data/changelogs/backports.ssl_match_hostname.md index dc30d45..c53aaf1 100644 --- a/stub-uploader/data/changelogs/backports.ssl_match_hostname.md +++ b/stub-uploader/data/changelogs/backports.ssl_match_hostname.md @@ -1,3 +1,25 @@ +## 3.7.4.2 (2022-11-07) + +Remove `ssl_match_hostname` from pyright exclude (#9116) + +## 3.7.4.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 3.7.4 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 3.7.3 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 3.7.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.7.0 (2021-09-19) Fix distribution name backports.ssl_match_hostname (#5997) diff --git a/stub-uploader/data/changelogs/backports_abc.md b/stub-uploader/data/changelogs/backports_abc.md index 3063583..da03da6 100644 --- a/stub-uploader/data/changelogs/backports_abc.md +++ b/stub-uploader/data/changelogs/backports_abc.md @@ -1,3 +1,7 @@ +## 0.5.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 0.5.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/beautifulsoup4.md b/stub-uploader/data/changelogs/beautifulsoup4.md index 7290200..4db14df 100644 --- a/stub-uploader/data/changelogs/beautifulsoup4.md +++ b/stub-uploader/data/changelogs/beautifulsoup4.md @@ -1,3 +1,122 @@ +## 4.11.6 (2022-09-06) + +[bs4] More precise types for bs4.Tag.select(_one) (#8687) + +Co-authored-by: Jelle Zijlstra + +## 4.11.5 (2022-08-18) + +Support extras in stubtest_third_party.py (#8467) + +## 4.11.4 (2022-07-21) + +beautifulsoup4: Fix type of Tag.__iter__ (#8357) + +## 4.11.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 4.11.2 (2022-06-16) + +Fix `TypeVar`s in `beautifulsoup` and `SQLAlchemy` (#8087) + +## 4.11.1 (2022-05-10) + +beautifulsoup4: small fixes and updates (#7816) + +## 4.11.0 (2022-05-06) + +bs4: update to 4.11 (#7785) + +Co-authored-by: hauntsaninja <> + +## 4.10.20 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 4.10.19 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 4.10.18 (2022-04-05) + +Replace Union with union operator (#7596) + +## 4.10.17 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 4.10.16 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 4.10.15 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 4.10.14 (2022-03-02) + +bs4: expose several other classes (#7420) + +On the same lines as #7419 + +These are all imports that are not used within bs4/__init__.py +My main interest here is in exposing NavigableString + +Co-authored-by: hauntsaninja <> + +## 4.10.13 (2022-03-02) + +bs4: expose bs4.PageElement (#7419) + +This is generally useful. It's also imported in the source without being +used in bs4/__init__.py which in well maintained packages is a pretty +good marker of intention to export + +Co-authored-by: hauntsaninja <> + +## 4.10.12 (2022-02-18) + +Tag.attrs is a dict, instead of an immutable Mapping (#7253) + +## 4.10.11 (2022-01-23) + +bs4: Expose bs4.SoupStrainer and bs4.Tag (#7002) + +## 4.10.10 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 4.10.9 (2022-01-07) + +Update pyright (#6840) + +## 4.10.7 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 4.10.6 (2021-12-23) + +Fix third-party issues found by stubtest (#6667) + +## 4.10.5 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 4.10.4 (2021-10-13) + +Cleanup: use lower-case list and dict, add a test (#6161) + +## 4.10.3 (2021-10-12) + +Put Generic last in base class list (#6155) + +## 4.10.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 4.10.1 (2021-09-27) PageElement.find_all() can return any subclass of PageElement (#6081) diff --git a/stub-uploader/data/changelogs/bleach.md b/stub-uploader/data/changelogs/bleach.md index cdfae86..ddc75ad 100644 --- a/stub-uploader/data/changelogs/bleach.md +++ b/stub-uploader/data/changelogs/bleach.md @@ -1,3 +1,39 @@ +## 5.0.3.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 5.0.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 5.0.2 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 5.0.1 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 5.0.0 (2022-04-12) + +Update bleach stubs to version 5 (#7612) + +## 4.1.5 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 4.1.3 (2022-01-02) + +Never explicitly inherit from `object` in Python 3-only stubs (#6777) + +## 4.1.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 4.1.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 4.1.0 (2021-08-30) Update bleach version (no changes) (#5982) diff --git a/stub-uploader/data/changelogs/boto.md b/stub-uploader/data/changelogs/boto.md index 889665e..7bcdcdf 100644 --- a/stub-uploader/data/changelogs/boto.md +++ b/stub-uploader/data/changelogs/boto.md @@ -1,3 +1,87 @@ +## 2.49.18.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 2.49.18 (2022-09-26) + +boto: drop dependency on types-six (#8792) + +## 2.49.17 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 2.49.16 (2022-06-28) + +Improve `boto` callbacks (#8201) + +## 2.49.15 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 2.49.14 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 2.49.13 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.49.12 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.49.11 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 2.49.10 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 2.49.9 (2022-03-10) + +Modernize syntax in various stubs (#7469) + +Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`. + +## 2.49.8 (2022-03-09) + +Remove Python 2 support from some third-party distributions (#7466) + +Co-authored-by: Alex Waygood + +## 2.49.7 (2022-01-30) + +Reduce use of `Any` in equality methods (#7081) + +Co-authored-by: Akuli + +## 2.49.6 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.49.5 (2022-01-07) + +Update pyright (#6840) + +## 2.49.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.49.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.49.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2.49.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/braintree.md b/stub-uploader/data/changelogs/braintree.md new file mode 100644 index 0000000..5a0b560 --- /dev/null +++ b/stub-uploader/data/changelogs/braintree.md @@ -0,0 +1,39 @@ +## 4.17.0.0 (2022-10-05) + +[stubsabot] Bump braintree to 4.17.* (#8847) + +Release: https://pypi.org/pypi/braintree/4.17.0 +Homepage: https://developer.paypal.com/braintree/docs/reference/overview + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 4.16.0 (2022-07-29) + +Bump braintree to 4.16.* (#8433) + +Resolves #8431 + +## 4.15.0 (2022-06-14) + +[stubsabot] Bump braintree to 4.15.* (#8080) + +Co-authored-by: hauntsaninja <> + +## 4.11.4 (2022-03-06) + +Upgrade to stubtest with dunder pos only reverted (#7442) + +## 4.11.3 (2022-01-31) + +Upgrade black version (#7089) + +## 4.11.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/cachetools.md b/stub-uploader/data/changelogs/cachetools.md index 217079f..6ca4ec8 100644 --- a/stub-uploader/data/changelogs/cachetools.md +++ b/stub-uploader/data/changelogs/cachetools.md @@ -1,3 +1,56 @@ +## 5.2.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 5.2.0 (2022-06-21) + +Update cachetools to 5.2.* (#8119) + +## 5.0.2 (2022-06-14) + +`cachetools`: Fix invalid `TypeVar` usage (#8073) + +## 5.0.1 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 5.0.0 (2022-03-08) + +Update cachetools to 5.0.0 (#7455) + +Co-authored-by: Alex Waygood +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 4.2.10 (2022-03-06) + +Upgrade to stubtest with dunder pos only reverted (#7442) + +## 4.2.9 (2022-01-12) + +Fix cachetools maxsize argument types (#6901) + +## 4.2.7 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 4.2.6 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 4.2.5 (2021-11-21) + +Fix MutableMapping overrides (#6352) + +## 4.2.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + +## 4.2.3 (2021-10-11) + +Fix type of lock parameter of cachetools.cachedmethod() decorator (#6144) + ## 4.2.2 (2021-09-30) Remove unncessary MutableMapping overrides (#6097) diff --git a/stub-uploader/data/changelogs/caldav.md b/stub-uploader/data/changelogs/caldav.md new file mode 100644 index 0000000..1b3bb08 --- /dev/null +++ b/stub-uploader/data/changelogs/caldav.md @@ -0,0 +1,42 @@ +## 0.10.0.0 (2022-10-31) + +Update caldav stubs to 0.10 (#9044) + +## 0.9.2 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 0.9.1 (2022-05-31) + +caldav: add verify_expand to Calendar.date_search (#7996) + +Co-authored-by: hauntsaninja <> + +## 0.9.0 (2022-04-28) + +Update caldav stubs for 0.9 (#7734) + +## 0.8.7 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 0.8.6 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.8.4 (2021-12-06) + +caldav: Update DAVError and AuthorizationError (#6508) + +## 0.8.3 (2021-11-09) + +Fix typos (#6263) + +Found via `codespell -q 3 -L alo,asend,ba,nams,spawnve` + +## 0.8.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/certifi.md b/stub-uploader/data/changelogs/certifi.md index 0f4e6ce..0b2fcae 100644 --- a/stub-uploader/data/changelogs/certifi.md +++ b/stub-uploader/data/changelogs/certifi.md @@ -1,3 +1,15 @@ +## 2021.10.8.3 (2022-06-09) + +certifi: mark as obsolete since 2022.5.18.1 (#8045) + +## 2021.10.8.2 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 2021.10.8.0 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2020.4.0 (2021-09-01) Add certifi.contents() (#5989) diff --git a/stub-uploader/data/changelogs/cffi.md b/stub-uploader/data/changelogs/cffi.md new file mode 100644 index 0000000..6706df6 --- /dev/null +++ b/stub-uploader/data/changelogs/cffi.md @@ -0,0 +1,10 @@ +## 1.15.1 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 1.15.0 (2022-09-15) + +Add type stubs for cffi (#8736) + +Co-authored-by: Alex Waygood + diff --git a/stub-uploader/data/changelogs/characteristic.md b/stub-uploader/data/changelogs/characteristic.md index d88635c..45d819e 100644 --- a/stub-uploader/data/changelogs/characteristic.md +++ b/stub-uploader/data/changelogs/characteristic.md @@ -1,3 +1,29 @@ +## 14.3.7 (2022-06-08) + +Mark characteristic as no longer updated (#8038) + +Part of #8012 + +## 14.3.6 (2022-06-06) + +Always use `TypeAlias` when assigning to `Any` (#8021) + +## 14.3.5 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 14.3.4 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 14.3.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 14.3.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 14.3.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/chardet.md b/stub-uploader/data/changelogs/chardet.md index 16c4aea..47f6ecf 100644 --- a/stub-uploader/data/changelogs/chardet.md +++ b/stub-uploader/data/changelogs/chardet.md @@ -1,3 +1,37 @@ +## 5.0.4 (2022-08-10) + +Remove a few unused `TypedDict`s (#8522) + +## 5.0.3 (2022-07-25) + +Add missing `__version__` to `chardet.__init__` (#8401) + +## 5.0.2 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 5.0.1 (2022-06-25) + +chardet: improve stubs (#8155) + +## 5.0.0 (2022-06-25) + +[stubsabot] Bump chardet to 5.0.* (#8150) + +Co-authored-by: hauntsaninja <> + +## 4.0.4 (2022-04-27) + +Drop Python 2 support from chardet (#7708) + +## 4.0.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 4.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 4.0.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/chevron.md b/stub-uploader/data/changelogs/chevron.md new file mode 100644 index 0000000..06847fd --- /dev/null +++ b/stub-uploader/data/changelogs/chevron.md @@ -0,0 +1,14 @@ +## 0.14.2 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.14.1 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.14.0 (2022-02-05) + +Add stubs for `chevron` package (#7139) + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/click-spinner.md b/stub-uploader/data/changelogs/click-spinner.md new file mode 100644 index 0000000..d21698b --- /dev/null +++ b/stub-uploader/data/changelogs/click-spinner.md @@ -0,0 +1,34 @@ +## 0.1.13 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 0.1.12 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.1.11 (2022-04-27) + +Drop Python 2 support from click-spinner (#7710) + +## 0.1.10 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 0.1.9 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.1.7 (2021-12-17) + +Always import Protocol from typing in stubs (#6617) + +## 0.1.6 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/click.md b/stub-uploader/data/changelogs/click.md new file mode 100644 index 0000000..417424d --- /dev/null +++ b/stub-uploader/data/changelogs/click.md @@ -0,0 +1,12 @@ +## 7.1.8 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 7.1.7 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 7.1.6 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/colorama.md b/stub-uploader/data/changelogs/colorama.md new file mode 100644 index 0000000..05b6322 --- /dev/null +++ b/stub-uploader/data/changelogs/colorama.md @@ -0,0 +1,50 @@ +## 0.4.15.2 (2022-10-26) + +colorama: fixes for latest version (#8987) + +Fixes #8986 + +## 0.4.15 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 0.4.14 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.4.13 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 0.4.12 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.4.11 (2022-04-05) + +Replace Union with union operator (#7596) + +## 0.4.10 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 0.4.9 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 0.4.8 (2022-01-31) + +Upgrade black version (#7089) + +## 0.4.7 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 0.4.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.4.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/commonmark.md b/stub-uploader/data/changelogs/commonmark.md new file mode 100644 index 0000000..c2ef993 --- /dev/null +++ b/stub-uploader/data/changelogs/commonmark.md @@ -0,0 +1,4 @@ +## 0.9.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/console-menu.md b/stub-uploader/data/changelogs/console-menu.md new file mode 100644 index 0000000..6febc76 --- /dev/null +++ b/stub-uploader/data/changelogs/console-menu.md @@ -0,0 +1,10 @@ +## 0.7.0.1 (2022-10-20) + +Remove `consolemenu` from `pyright`'s exclude (#8940) + +## 0.7.0.0 (2022-10-03) + +Add type stubs for package console-menu (#8820) + +Co-authored-by: Jelle Zijlstra + diff --git a/stub-uploader/data/changelogs/contextvars.md b/stub-uploader/data/changelogs/contextvars.md new file mode 100644 index 0000000..41811da --- /dev/null +++ b/stub-uploader/data/changelogs/contextvars.md @@ -0,0 +1,41 @@ +## 2.4.7 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 2.4.6 (2022-05-27) + +constructors: Fix defaulted TypeVars (#7965) + +From the list in https://github.com/microsoft/pyright/issues/3501 + +## 2.4.5 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.4.4 (2022-02-22) + +Correct several positional-only differences in third-party stubs (#7352) + +## 2.4.3 (2022-02-21) + +contextvars, pycurl: make classes final (#7334) + +## 2.4.2 (2022-01-27) + +Improve `contextvars.Context` (#7052) + +Similar changes to the ones @sobolevn made in #6942 + +## 2.4.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/croniter.md b/stub-uploader/data/changelogs/croniter.md new file mode 100644 index 0000000..e15c141 --- /dev/null +++ b/stub-uploader/data/changelogs/croniter.md @@ -0,0 +1,84 @@ +## 1.3.2 (2022-07-31) + +Clean up a few Python 2 remnants (#8452) + +## 1.3.1 (2022-07-18) + +croniter: make package, complete public API (#8316) + +## 1.3.0 (2022-06-26) + +[stubsabot] Bump croniter to 1.3.* (#8185) + +## 1.0.11 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 1.0.10 (2022-04-27) + +Drop Python 2 support from croniter (#7705) + +## 1.0.9 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.0.8 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 1.0.7 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 1.0.6 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.0.4 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.0.3 (2021-10-30) + +croniter: Add missing arguments and functions, add types (#6215) + +## 1.0.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/cryptography.md b/stub-uploader/data/changelogs/cryptography.md new file mode 100644 index 0000000..03b7869 --- /dev/null +++ b/stub-uploader/data/changelogs/cryptography.md @@ -0,0 +1,76 @@ +## 3.3.23.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 3.3.23 (2022-08-23) + +`cryptography`: Add some missing `@abstractmethod` decorators (#8598) + +## 3.3.22 (2022-08-16) + +cryptography: Rename parameter of serialize_key_and_certificates (#8543) + +## 3.3.21 (2022-04-28) + +cryptography: make `oid` attributes readonly (#7731) + +## 3.3.20 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 3.3.19 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 3.3.18 (2022-03-10) + +Modernize syntax in various stubs (#7469) + +Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`. + +## 3.3.17 (2022-03-09) + +Remove explicit inheritance from object (#7468) + +## 3.3.16 (2022-03-09) + +Remove Python 2 support from some third-party distributions (#7466) + +Co-authored-by: Alex Waygood + +## 3.3.15 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 3.3.14 (2022-01-17) + +remove quoted strings (#6933) + +## 3.3.13 (2022-01-16) + +remove "= ..." from top-level values (#6930) + +## 3.3.12 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 3.3.10 (2021-12-23) + +Remove unused allowlist entries (#6671) + +## 3.3.9 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 3.3.8 (2021-10-28) + +Add defaults to GCM.__init__ arguments (#6207) + +## 3.3.7 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 3.3.6 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/dataclasses.md b/stub-uploader/data/changelogs/dataclasses.md new file mode 100644 index 0000000..bf492ee --- /dev/null +++ b/stub-uploader/data/changelogs/dataclasses.md @@ -0,0 +1,27 @@ +## 0.6.5 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.6.4 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.6.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.6.1 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 0.6.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/dateparser.md b/stub-uploader/data/changelogs/dateparser.md index c0de83d..52d1fa0 100644 --- a/stub-uploader/data/changelogs/dateparser.md +++ b/stub-uploader/data/changelogs/dateparser.md @@ -1,3 +1,79 @@ +## 1.1.4.2 (2022-11-04) + +dateparser: add new parameter (#9081) + +Fixes #9079 + +## 1.1.4.1 (2022-10-21) + +dateparser: add negative argument to get_date_from_timestamp (#8954) + +Closes #8952 + +## 1.1.4 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 1.1.3 (2022-06-08) + +`dateparser`: Remove redundant import of `_typeshed.Self` (#8041) + +## 1.1.2 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.1.1 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.1.0 (2022-02-23) + +Update dateparser stubs for 1.1 (#7368) + +## 1.0.14 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 1.0.13 (2022-01-22) + +fix incorrect tuple[T] (#6996) + +Found from PyCQA/flake8-pyi#135. + +## 1.0.12 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.0.10 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.0.9 (2021-12-27) + +Always alias `collections.abc.Set` (#6712) + +## 1.0.8 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 1.0.7 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.0.6 (2021-10-14) + +check_new_syntax.py: check nested annotations (#6167) + +## 1.0.5 (2021-10-13) + +dateparser.search.search_dates: allow arbitrary-length tuples for languages argument (#6166) + +Cleanup: use lower-case list and dict, add a test (#6161) + +## 1.0.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 1.0.3 (2021-09-27) Specify concrete types for DateDataParser attributes (#6075) diff --git a/stub-uploader/data/changelogs/decorator.md b/stub-uploader/data/changelogs/decorator.md new file mode 100644 index 0000000..afcf8cf --- /dev/null +++ b/stub-uploader/data/changelogs/decorator.md @@ -0,0 +1,49 @@ +## 5.1.8.1 (2022-10-14) + +Mark `decorator` as complete (#8897) + +## 5.1.8 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 5.1.7 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 5.1.6 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 5.1.5 (2022-04-16) + +Python 3 stubs: use `str` instead of `typing.Text` (#7638) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 5.1.4 (2022-01-27) + +Add `ParamSpec` to `decorator.contextmanager` (#7051) + +There may be other places in this package where `ParamSpec` could be used, but this one is the most clear-cut. + +## 5.1.2 (2022-01-02) + +Never explicitly inherit from `object` in Python 3-only stubs (#6777) + +## 5.1.1 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 5.1.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/dj-database-url.md b/stub-uploader/data/changelogs/dj-database-url.md new file mode 100644 index 0000000..4dbc1d0 --- /dev/null +++ b/stub-uploader/data/changelogs/dj-database-url.md @@ -0,0 +1,33 @@ +## 1.0.0 (2022-08-05) + +[stubsabot] Bump dj-database-url to 1.0.* (#8488) + +* [stubsabot] Bump dj-database-url to 1.0.* + +* Add DJANGO_VERSION + +Co-authored-by: stubsabot <> +Co-authored-by: Sebastian Rittau + +## 0.5.3 (2022-06-25) + +dj-database-url, docopt, editdistance, first: check missing defs (#8154) + +## 0.5.2 (2022-06-01) + +`dj-database-url`: Add missing fields to `_DBConfig` TypedDict (#8008) + +Co-authored-by: Alex Waygood + +## 0.5.1 (2022-05-29) + +dj_database_url: make all keys optional in _DBConfig TypedDict (#7979) + +Co-authored-by: Xavier Francisco + +## 0.5.0 (2022-05-28) + +Add stubs for dj-database-url (#7972) + +Co-authored-by: Xavier Francisco + diff --git a/stub-uploader/data/changelogs/docopt.md b/stub-uploader/data/changelogs/docopt.md new file mode 100644 index 0000000..7afd00f --- /dev/null +++ b/stub-uploader/data/changelogs/docopt.md @@ -0,0 +1,28 @@ +## 0.6.11 (2022-06-25) + +dj-database-url, docopt, editdistance, first: check missing defs (#8154) + +## 0.6.10 (2022-05-21) + +Add docopt.printable_usage (#7913) + +## 0.6.9 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.6.8 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 0.6.7 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.6.6 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 0.6.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/docutils.md b/stub-uploader/data/changelogs/docutils.md new file mode 100644 index 0000000..2a81880 --- /dev/null +++ b/stub-uploader/data/changelogs/docutils.md @@ -0,0 +1,54 @@ +## 0.19.1.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 0.19.1 (2022-09-11) + +Add missing attributes for docutils.io (#8716) + +Co-authored-by: Alex Waygood + +## 0.19.0 (2022-07-08) + +[stubsabot] Bump docutils to 0.19.* (#8260) + +## 0.18.3 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 0.18.2 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.18.1 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.18.0 (2022-02-28) + +docutils: complete nodes.Node & bump version to 0.18.* (#7380) + +## 0.17.7 (2022-02-24) + +docutils: Add missing dunders to nodes.Element (#7377) + +## 0.17.6 (2022-02-21) + +Improve docutils stubs (#7256) + +## 0.17.5 (2022-02-03) + +Use `_typeshed.Self` in `docutils.VersionInfo` and `os.sched_param` (#7117) + +## 0.17.4 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.17.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.17.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/editdistance.md b/stub-uploader/data/changelogs/editdistance.md new file mode 100644 index 0000000..bfaec2b --- /dev/null +++ b/stub-uploader/data/changelogs/editdistance.md @@ -0,0 +1,36 @@ +## 0.6.3.1 (2022-10-20) + +Remove `editdistance` from `pyright`'s exclude (#8941) + +## 0.6.3 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 0.6.2 (2022-07-17) + +Make xxhash, editdistance into packages (#8320) + +This matches the runtime. Also see #8319 + +## 0.6.1 (2022-06-25) + +dj-database-url, docopt, editdistance, first: check missing defs (#8154) + +## 0.6.0 (2022-06-21) + +[stubsabot] Bump editdistance to 0.6.* (#8120) + +Co-authored-by: hauntsaninja <> + +## 0.5.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.5.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/emoji.md b/stub-uploader/data/changelogs/emoji.md new file mode 100644 index 0000000..e6801bc --- /dev/null +++ b/stub-uploader/data/changelogs/emoji.md @@ -0,0 +1,72 @@ +## 2.1.0.1 (2022-11-01) + +[stubsabot] Mark emoji as obsolete since 2.2.0 (#9051) + +Release: https://pypi.org/pypi/emoji/2.2.0 +Homepage: https://github.com/carpedm20/emoji/ +Diff: https://github.com/carpedm20/emoji/compare/v2.1.0...v2.2.0 + +Co-authored-by: stubsabot <> + +## 2.1.0 (2022-09-23) + +[stubsabot] Bump emoji to 2.1.* (#8784) + +Release: https://pypi.org/pypi/emoji/2.1.0 +Homepage: https://github.com/carpedm20/emoji/ +Diff: https://github.com/carpedm20/emoji/compare/v2.0.0...v2.1.0 + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 2.0.1 (2022-08-10) + +Remove a few unused `TypedDict`s (#8522) + +## 2.0.0 (2022-07-28) + +Update emoji stubs for v2.0.0 (#8426) + +## 1.7.4 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 1.7.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 1.7.2 (2022-06-26) + +emoji: complete stubs (#8170) + +Co-authored-by: hauntsaninja <> + +## 1.7.1 (2022-06-10) + +Add stub for emoji.is_emoji (#8053) + +## 1.7.0 (2022-05-22) + +Update emoji stubs for version 1.7 (#7884) + +## 1.2.8 (2022-04-27) + +Drop Python 2 support from emoji (#7716) + +## 1.2.6 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.2.5 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/entrypoints.md b/stub-uploader/data/changelogs/entrypoints.md new file mode 100644 index 0000000..a2ec4b0 --- /dev/null +++ b/stub-uploader/data/changelogs/entrypoints.md @@ -0,0 +1,40 @@ +## 0.4.1.1 (2022-10-15) + +Mark `entrypoints` as complete (#8901) + +## 0.4.1 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 0.4.0 (2022-06-25) + +[stubsabot] Bump entrypoints to 0.4.* (#8157) + +Co-authored-by: hauntsaninja <> + +## 0.3.7 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 0.3.6 (2022-04-27) + +Remove Python 2 support from entrypoints (#7711) + +## 0.3.5 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.3.3 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 0.3.2 (2021-10-13) + +Cleanup: use lower-case list and dict, add a test (#6161) + +## 0.3.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/enum34.md b/stub-uploader/data/changelogs/enum34.md new file mode 100644 index 0000000..fb54e5b --- /dev/null +++ b/stub-uploader/data/changelogs/enum34.md @@ -0,0 +1,22 @@ +## 1.1.8 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 1.1.7 (2022-01-19) + +Use PEP 585 syntax in `@python2/_ast`, convert more `TypeVar`s to `_typeshed.Self`, & `# noqa` a `SQLAlchemy` line (#6954) + +* Manual fixes for `_ast` and `SQLAlchemy` + +* Change more `TypeVar`s to `Self`, using script + +Use PEP 585 syntax in Python 2, `protobuf` & `_ast` stubs, where possible (#6949) + +## 1.1.3 (2022-01-17) + +Use `_typeshed.Self` in Python 2, too (#6932) + +## 1.1.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/filelock.md b/stub-uploader/data/changelogs/filelock.md index 81208b5..8ca808c 100644 --- a/stub-uploader/data/changelogs/filelock.md +++ b/stub-uploader/data/changelogs/filelock.md @@ -1,3 +1,59 @@ +## 3.2.7 (2022-06-09) + +filelock: mark as obsolete since 3.3.0 (#8043) + +## 3.2.6 (2022-05-21) + +Simplify and correct many numeric unions (#7906) + +Unblocks PyCQA/flake8-pyi#222 + +## 3.2.5 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 3.2.4 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 3.2.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 3.2.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.2.0 (2021-09-30) Unbreak CI (#6093) diff --git a/stub-uploader/data/changelogs/first.md b/stub-uploader/data/changelogs/first.md index c60016e..7ca44b5 100644 --- a/stub-uploader/data/changelogs/first.md +++ b/stub-uploader/data/changelogs/first.md @@ -1,3 +1,19 @@ +## 2.0.5 (2022-06-25) + +dj-database-url, docopt, editdistance, first: check missing defs (#8154) + +## 2.0.4 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 2.0.3 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 2.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2.0.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/flake8-2020.md b/stub-uploader/data/changelogs/flake8-2020.md new file mode 100644 index 0000000..4ff961e --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-2020.md @@ -0,0 +1,22 @@ +## 1.7.0.1 (2022-10-15) + +Mark `flake8-2020` as complete (#8902) + +## 1.7.0 (2022-08-05) + +[stubsabot] Bump flake8-2020 to 1.7.* (#8492) + +Co-authored-by: stubsabot <> + +## 1.6.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.6.2 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.6.0 (2021-12-10) + +Add stubs for flake8-2020 (#6555) + diff --git a/stub-uploader/data/changelogs/flake8-bugbear.md b/stub-uploader/data/changelogs/flake8-bugbear.md new file mode 100644 index 0000000..6f9696e --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-bugbear.md @@ -0,0 +1,88 @@ +## 22.10.27.0 (2022-10-27) + +[stubsabot] Bump flake8-bugbear to 22.10.27 (#8992) + +Release: https://pypi.org/pypi/flake8-bugbear/22.10.27 +Homepage: https://github.com/PyCQA/flake8-bugbear +Changelog: https://github.com/PyCQA/flake8-bugbear#change-log +Diff: https://github.com/PyCQA/flake8-bugbear/compare/22.10.25...22.10.27 + +Stubsabot analysis of the diff between the two releases: + - 0 public Python files have been added. + - 0 files included in typeshed's stubs have been deleted. + - 1 file included in typeshed's stubs has been modified or renamed: `bugbear.py`. + - Total lines of Python code added: 193. + - Total lines of Python code deleted: 28. + +## 22.10.25.0 (2022-10-25) + +[stubsabot] Bump flake8-bugbear to 22.10.25 (#8980) + +Release: https://pypi.org/pypi/flake8-bugbear/22.10.25 +Homepage: https://github.com/PyCQA/flake8-bugbear +Changelog: https://github.com/PyCQA/flake8-bugbear#change-log +Diff: https://github.com/PyCQA/flake8-bugbear/compare/22.9.23...22.10.25 + +Stubsabot analysis of the diff between the two releases: + - 1 public Python file has been added: `tests/b027.py`. + - 0 files included in typeshed's stubs have been deleted. + - 1 file included in typeshed's stubs has been modified or renamed: `bugbear.py`. + - Total lines of Python code added: 194. + - Total lines of Python code deleted: 35. + +## 22.9.23.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 22.9.23.0 (2022-09-30) + +[stubsabot] Bump flake8-bugbear to 22.9.23 (#8812) + +Release: https://pypi.org/pypi/flake8-bugbear/22.9.23 +Homepage: https://github.com/PyCQA/flake8-bugbear +Changelog: https://github.com/PyCQA/flake8-bugbear#change-log +Diff: https://github.com/PyCQA/flake8-bugbear/compare/22.9.11...22.9.23 + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +## 22.9.11.0 (2022-09-16) + +[stubsabot] Bump flake8-bugbear to 22.9.11 (#8747) + +Release: https://pypi.org/project/flake8-bugbear/22.9.11/ +Homepage: https://github.com/PyCQA/flake8-bugbear +Changelog: https://github.com/PyCQA/flake8-bugbear#change-log +Diff: https://github.com/PyCQA/flake8-bugbear/compare/22.8.23...22.9.11 + +## 22.8.23.0 (2022-08-26) + +[stubsabot] Bump flake8-bugbear to 22.8.23 (#8622) + +## 22.7.1.0 (2022-07-01) + +[stubsabot] Bump flake8-bugbear to 22.7.1 (#8220) + +## 22.6.22.0 (2022-06-25) + +[stubsabot] Bump flake8-bugbear to 22.6.22 (#8151) + +Co-authored-by: hauntsaninja <> + +## 22.4.25.0 (2022-06-21) + +[stubsabot] Bump flake8-bugbear to 22.4.25 (#8112) + +Co-authored-by: hauntsaninja <> + +## 21.11.29.2 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 21.11.29.0 (2021-12-08) + +Add stubs for flake8-bugbear (#6543) + diff --git a/stub-uploader/data/changelogs/flake8-builtins.md b/stub-uploader/data/changelogs/flake8-builtins.md new file mode 100644 index 0000000..3a4fb49 --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-builtins.md @@ -0,0 +1,43 @@ +## 2.0.0.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 2.0.0.0 (2022-10-09) + +[stubsabot] Bump flake8-builtins to 2.0.* (#8872) + +Release: https://pypi.org/pypi/flake8-builtins/2.0.0 +Homepage: https://github.com/gforcada/flake8-builtins +Diff: https://github.com/gforcada/flake8-builtins/compare/1.5.3...2.0.0 + +Stubsabot analysis of the diff between the two releases: + - 0 public Python files have been added. + - 0 files included in typeshed's stubs have been deleted. + - 1 file included in typeshed's stubs has been modified or renamed: `flake8_builtins.py`. + - Total lines of Python code added: 338. + - Total lines of Python code deleted: 546. + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 1.5.4 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.5.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.5.1 (2021-12-06) + +Mark some fields as ClassVars (#6510) + +## 1.5.0 (2021-12-03) + +Add stubs for flake8-builtins (#6483) + diff --git a/stub-uploader/data/changelogs/flake8-docstrings.md b/stub-uploader/data/changelogs/flake8-docstrings.md new file mode 100644 index 0000000..f499d07 --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-docstrings.md @@ -0,0 +1,18 @@ +## 1.6.3.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 1.6.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.6.2 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.6.0 (2021-12-06) + +Add stubs for flake8-docstrings (#6507) + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/flake8-plugin-utils.md b/stub-uploader/data/changelogs/flake8-plugin-utils.md new file mode 100644 index 0000000..54ef49d --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-plugin-utils.md @@ -0,0 +1,28 @@ +## 1.3.7 (2022-06-14) + +Fix miscellaneous invalid `TypeVar` usages (#8074) + +## 1.3.6 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.3.5 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.3.4 (2022-03-29) + +Remove unneeded `# noqa` comments, fix broken `# noqa` comments (#7561) + +## 1.3.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.3.1 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.3.0 (2021-12-13) + +Add stubs for flake8-plugin-utils (#6506) + diff --git a/stub-uploader/data/changelogs/flake8-rst-docstrings.md b/stub-uploader/data/changelogs/flake8-rst-docstrings.md new file mode 100644 index 0000000..92eaa9b --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-rst-docstrings.md @@ -0,0 +1,16 @@ +## 0.2.2 (2022-06-08) + +Update flake8-rst-docstrings (#8033) + +Fixes #8032 + +Co-authored-by: hauntsaninja <> + +## 0.2.1 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.2.0 (2022-01-25) + +Add stubs for flake8_rst_docstrings (#7029) + diff --git a/stub-uploader/data/changelogs/flake8-simplify.md b/stub-uploader/data/changelogs/flake8-simplify.md new file mode 100644 index 0000000..78ce92b --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-simplify.md @@ -0,0 +1,24 @@ +## 0.19.0 (2022-06-13) + +[stubsabot] Bump flake8-simplify to 0.19.* (#8052) + +## 0.18.1 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.18.0 (2022-02-21) + +Update flake8-simplify (#7339) + +## 0.14.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.14.1 (2021-12-06) + +Mark some fields as ClassVars (#6510) + +## 0.14.0 (2021-12-03) + +Add stubs for flake8-simplify (#6480) + diff --git a/stub-uploader/data/changelogs/flake8-typing-imports.md b/stub-uploader/data/changelogs/flake8-typing-imports.md new file mode 100644 index 0000000..436b20b --- /dev/null +++ b/stub-uploader/data/changelogs/flake8-typing-imports.md @@ -0,0 +1,51 @@ +## 1.14.0.0 (2022-10-25) + +[stubsabot] Bump flake8-typing-imports to 1.14.* (#8978) + +Release: https://pypi.org/pypi/flake8-typing-imports/1.14.0 +Homepage: https://github.com/asottile/flake8-typing-imports +Diff: https://github.com/asottile/flake8-typing-imports/compare/v1.13.0...v1.14.0 + +Stubsabot analysis of the diff between the two releases: + - 0 public Python files have been added. + - 0 files included in typeshed's stubs have been deleted. + - 1 file included in typeshed's stubs has been modified or renamed: `flake8_typing_imports.py`. + - Total lines of Python code added: 487. + - Total lines of Python code deleted: 0. + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 1.13.0.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 1.13.0 (2022-08-05) + +[stubsabot] Bump flake8-typing-imports to 1.13.* (#8489) + +Co-authored-by: stubsabot <> + +## 1.12.0 (2022-06-26) + +[stubsabot] Bump flake8-typing-imports to 1.12.* (#8179) + +Co-authored-by: hauntsaninja <> + +## 1.11.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.11.2 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.11.0 (2021-12-10) + +Add stubs for flake8-typing-imports (#6556) + diff --git a/stub-uploader/data/changelogs/fpdf2.md b/stub-uploader/data/changelogs/fpdf2.md new file mode 100644 index 0000000..76592fd --- /dev/null +++ b/stub-uploader/data/changelogs/fpdf2.md @@ -0,0 +1,86 @@ +## 2.5.4.3 (2022-10-14) + +Add return types to fpdf.drawing (#8891) + +Co-authored-by: Akuli +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 2.5.4.2 (2022-10-06) + +`fpdf2`: complete stubs (#8855) + +## 2.5.4.1 (2022-10-04) + +`fpdf2`: Add missing files (#8836) + +## 2.5.4 (2022-09-11) + +Update `fdpf2` stubs for v2.5.7 (#8721) + +Co-authored-by: Akuli + +## 2.5.3 (2022-08-30) + +`fpdf2`: Remove redundant `str | Literal['DEPRECATED']` union (#8650) + +## 2.5.2 (2022-08-17) + +fpdf2: fix for 2.5.6 changes (#8546) + +Life is much easier when upstream has some annotations + +Fixes #8545 + +## 2.5.1 (2022-07-04) + +Fix size parameter of FPDF.set_font_size (#8234) + +## 2.5.0 (2022-06-29) + +Bump fpdf2 to 2.5.* (#8173) + +Co-authored-by: hauntsaninja <> +Co-authored-by: Alex Waygood +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 2.4.9 (2022-06-26) + +fpdf2: improve types (#8176) + +Co-authored-by: hauntsaninja <> + +## 2.4.8 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.4.7 (2022-02-10) + +fpdf2: Correct annotations of @contextmanager methods (#7172) + +## 2.4.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.4.4 (2021-12-23) + +Fix third-party issues found by stubtest (#6667) + +## 2.4.3 (2021-12-21) + +Add some missing attributes and types to FPDF (#6618) + +## 2.4.2 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 2.4.1 (2021-11-16) + +Improve fpdf.image_parsing (#6313) + +* Annotate more attributes, arguments, and return types. +* Add "dims" argument to get_img_info(), added in 2.4.6. + +## 2.4.0 (2021-11-10) + +Add stubs for fpdf2 (#6252) + diff --git a/stub-uploader/data/changelogs/freezegun.md b/stub-uploader/data/changelogs/freezegun.md new file mode 100644 index 0000000..6e42a00 --- /dev/null +++ b/stub-uploader/data/changelogs/freezegun.md @@ -0,0 +1,38 @@ +## 1.1.10 (2022-06-09) + +freezegun: mark as obsolete since 1.2.1 (#8042) + +Linking #5842 + +## 1.1.9 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.1.8 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 1.1.7 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 1.1.6 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.1.4 (2022-01-02) + +Never explicitly inherit from `object` in Python 3-only stubs (#6777) + +## 1.1.3 (2021-11-02) + +freezegun: Add as_kwarg argument (#6220) + +## 1.1.2 (2021-10-13) + +freezegun: _freeze_time.__enter__ return a freeze factory (#6164) + +## 1.1.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/frozendict.md b/stub-uploader/data/changelogs/frozendict.md new file mode 100644 index 0000000..a642db3 --- /dev/null +++ b/stub-uploader/data/changelogs/frozendict.md @@ -0,0 +1,79 @@ +## 2.0.9 (2022-06-09) + +frozendict: mark as obsolete since 2.2.0 (#8044) + +It has shipped with a py.typed file since v.2.2.0 in January: https://github.com/Marco-Sulla/python-frozendict/commit/7fcdd3aa990aa323fbcecea4b33733468c97cc27 + +It can be removed come July 15 + +Co-authored-by: hauntsaninja <> + +## 2.0.8 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.0.7 (2022-03-06) + +Upgrade to stubtest with dunder pos only reverted (#7442) + +## 2.0.6 (2022-02-22) + +Correct several positional-only differences in third-party stubs (#7352) + +## 2.0.5 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 2.0.4 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 2.0.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.0.1 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.0.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/futures.md b/stub-uploader/data/changelogs/futures.md new file mode 100644 index 0000000..98b89f0 --- /dev/null +++ b/stub-uploader/data/changelogs/futures.md @@ -0,0 +1,16 @@ +## 3.3.8 (2022-01-27) + +Backport many `ParamSpec`-related changes to Python 2 (#7054) + +## 3.3.7 (2022-01-19) + +Use PEP 585 syntax in Python 2, `protobuf` & `_ast` stubs, where possible (#6949) + +## 3.3.3 (2022-01-17) + +Use `_typeshed.Self` in Python 2, too (#6932) + +## 3.3.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/gdb.md b/stub-uploader/data/changelogs/gdb.md new file mode 100644 index 0000000..70b5c34 --- /dev/null +++ b/stub-uploader/data/changelogs/gdb.md @@ -0,0 +1,34 @@ +## 12.1.4 (2022-09-24) + +gdb: add missing automatic imports (#8788) + +When GDB has just started, several `gdb` submodules are automatically +loaded, so user code does not have to manually import them (for instance +`import gdb.events`). Reflect that in `gdb` stubs. + +## 12.1.3 (2022-07-07) + +Fix various `TypeAlias` issues (#8248) + +## 12.1.2 (2022-06-23) + +Various fixes in `gdb` (#8144) + +* gdb.events.BreakpointEvent: fix various typos + +* gdb.printing: remove GenPrinterFunction + +This was meant to be a private type alias, but it is unused and a +duplicate of the better named gdb._PrettyPrinterLookupFunction. + +## 12.1.1 (2022-06-19) + +stubtest: use separate table in METADATA.toml (#8096) + +## 12.1.0 (2022-06-15) + +Add stubs for "gdb" (#8013) + +This commit adds type stubs for the "gdb" package, the Python API to +extend GDB (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html). + diff --git a/stub-uploader/data/changelogs/google-cloud-ndb.md b/stub-uploader/data/changelogs/google-cloud-ndb.md new file mode 100644 index 0000000..acdcfab --- /dev/null +++ b/stub-uploader/data/changelogs/google-cloud-ndb.md @@ -0,0 +1,73 @@ +## 1.11.5 (2022-09-27) + +google-cloud-ndb: drop dependency on types-six (#8793) + +For https://github.com/typeshed-internal/stub_uploader/pull/61#discussion_r979327370 + +## 1.11.4 (2022-09-24) + +google-cloud-ndb: bump stubtest protobuf requirement (#8786) + +Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.20.1 to 3.20.2. +- [Release notes](https://github.com/protocolbuffers/protobuf/releases) +- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/generate_changelog.py) +- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.20.1...v3.20.2) + +--- +updated-dependencies: +- dependency-name: protobuf + dependency-type: direct:production +... + +Signed-off-by: dependabot[bot] + +Signed-off-by: dependabot[bot] +Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> + +## 1.11.3 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 1.11.2 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.11.1 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.11.0 (2022-04-05) + +Update google-cloud-ndb stubs to 1.11 (#7593) + +## 1.9.4 (2022-02-08) + +google-cloud-ndb: Fix incorrect type definition for `validator` (#7116) + +This function was mistakenly typed as `Callable[[Property], object] | +None`, however the actual function accepts two parameters of type +`Property, value`. The value can be of any type. Strictly speaking, the +type corresponds to the type of the property which is defined at runtime. + +Fixes #7103 + +## 1.9.3 (2022-02-03) + +Fix mistyped `get_by_id` class methods (#7120) + +The types for these class methods were mixed up. The async method +returned an optional `Model`, while the synchronous method returned a +`Future`. It's the other way around. + +Fixes #7103 + +Improve `__enter__` & constructor methods (#7114) + +## 1.9.2 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.9.0 (2021-10-21) + +Stubs for google.cloud.ndb the Google Cloud Datastore ndb client library (#5821) + diff --git a/stub-uploader/data/changelogs/hdbcli.md b/stub-uploader/data/changelogs/hdbcli.md new file mode 100644 index 0000000..d775873 --- /dev/null +++ b/stub-uploader/data/changelogs/hdbcli.md @@ -0,0 +1,64 @@ +## 2.14.1.1 (2022-11-03) + +Mark `hdbcli` as complete (#8904) + +## 2.14.1 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 2.14.0 (2022-09-23) + +[stubsabot] Bump hdbcli to 2.14.* (#8783) + +Release: https://pypi.org/pypi/hdbcli/2.14.18 +Homepage: https://www.sap.com/ + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 2.13.0 (2022-06-29) + +[stubsabot] Bump hdbcli to 2.13.* (#8206) + +Co-authored-by: hauntsaninja <> + +## 2.10.7 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.10.6 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.10.5 (2022-01-20) + +Use the Literal["foo", "bar"] syntax consistently (#6984) + +## 2.10.4 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.10.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.10.1 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 2.10.0 (2021-12-09) + +Add stubs for hdbcli (#6550) + +hdbcli is the python dbapi for SAP HANA. Not all methods/attributes are 100% compatible with PEP 249. + diff --git a/stub-uploader/data/changelogs/html5lib.md b/stub-uploader/data/changelogs/html5lib.md new file mode 100644 index 0000000..5c39031 --- /dev/null +++ b/stub-uploader/data/changelogs/html5lib.md @@ -0,0 +1,43 @@ +## 1.1.11 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 1.1.10 (2022-08-18) + +Support extras in stubtest_third_party.py (#8467) + +## 1.1.9 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 1.1.8 (2022-07-11) + +Remove Python 3.6 branches from typeshed (#8269) + +## 1.1.7 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.1.6 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 1.1.4 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.1.3 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 1.1.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/httplib2.md b/stub-uploader/data/changelogs/httplib2.md new file mode 100644 index 0000000..800fc55 --- /dev/null +++ b/stub-uploader/data/changelogs/httplib2.md @@ -0,0 +1,40 @@ +## 0.21.0.0 (2022-10-30) + +[stubsabot] Bump httplib2 to 0.21.* (#9038) + +Release: https://pypi.org/pypi/httplib2/0.21.0 +Homepage: https://github.com/httplib2/httplib2 +Diff: https://github.com/httplib2/httplib2/compare/v0.20.4...v0.21.0 + +Stubsabot analysis of the diff between the two releases: + - Total lines of Python code added: 77. + - Total lines of Python code deleted: 21. + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 0.20.4 (2022-03-29) + +Remove unneeded `# noqa` comments, fix broken `# noqa` comments (#7561) + +## 0.20.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.20.1 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 0.20.0 (2021-11-08) + +Update httplib version to 0.20.* (#6256) + +## 0.19.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/humanfriendly.md b/stub-uploader/data/changelogs/humanfriendly.md new file mode 100644 index 0000000..bde2de8 --- /dev/null +++ b/stub-uploader/data/changelogs/humanfriendly.md @@ -0,0 +1,42 @@ +## 10.0.1 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 10.0.0 (2022-06-21) + +[stubsabot] Bump humanfriendly to 10.0.* (#8118) + +Co-authored-by: hauntsaninja <> + +## 9.2.8 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 9.2.7 (2022-04-27) + +Add various missing generic arguments (#7702) + +Co-authored-by: Akuli + +## 9.2.6 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 9.2.5 (2022-04-01) + +flake8 config: remove line that exists only for Python-2 checking (#7570) + +## 9.2.3 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 9.2.2 (2021-10-28) + +Annotate humanfriendly.__init__.pyi (#6209) + +## 9.2.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/invoke.md b/stub-uploader/data/changelogs/invoke.md new file mode 100644 index 0000000..3ffddce --- /dev/null +++ b/stub-uploader/data/changelogs/invoke.md @@ -0,0 +1,82 @@ +## 1.7.3.3 (2022-10-21) + +Fix `invoke` regression (#8950) + +* Fix `invoke` regression + +## 1.7.3.2 (2022-10-19) + +Add types to `invoke.Task.__call__` (#8918) + +## 1.7.3.1 (2022-10-01) + +Add `parser` to `invoke.completion.complete.complete` (#8819) + +Closes https://github.com/python/typeshed/issues/8818 + +## 1.7.3 (2022-07-13) + +Add types to `invoke.Runner.run` (#8279) + +Co-authored-by: AlexWaygood + +## 1.7.2 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 1.7.1 (2022-06-22) + +Improve several `__hash__` methods (#8128) + +## 1.7.0 (2022-06-21) + +Bump invoke to 1.7.* (#8111) + +## 1.6.8 (2022-05-25) + +invoke: Fix unconstrained TypeVar (#7943) + +Part of #7928 + +https://github.com/pyinvoke/invoke/blob/f34c6c9413146a34ede3a5b529916b4cee649887/invoke/tasks.py#L328 + +## 1.6.7 (2022-05-05) + +Improve types of invoke/env.pyi (#7780) + +## 1.6.6 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.6.5 (2022-03-22) + +Mark pre/post tasks in invoke tasks as iterable (#7531) + +Fix wrong return type of invoke decorator (#7536) + +Closes #7530 + +## 1.6.4 (2022-03-21) + +Fix invoke task decorator (#7511) + +The decorator can be called with and without (). The current types only consider the first case + +## 1.6.3 (2022-03-17) + +Add annotations to invoke.tasks (#7502) + +## 1.6.2 (2022-02-07) + +Improve a bunch of `__(deep)copy__` methods (#7148) + +## 1.6.1 (2022-01-30) + +Reduce use of `Any` in equality methods (#7081) + +Co-authored-by: Akuli + +## 1.6.0 (2022-01-22) + +Add stubs for invoke (#6938) + diff --git a/stub-uploader/data/changelogs/ipaddress.md b/stub-uploader/data/changelogs/ipaddress.md new file mode 100644 index 0000000..d9986cc --- /dev/null +++ b/stub-uploader/data/changelogs/ipaddress.md @@ -0,0 +1,18 @@ +## 1.0.8 (2022-01-30) + +Reduce use of `Any` in equality methods (#7081) + +Co-authored-by: Akuli + +## 1.0.7 (2022-01-19) + +Use PEP 585 syntax in Python 2, `protobuf` & `_ast` stubs, where possible (#6949) + +## 1.0.3 (2022-01-17) + +Use `_typeshed.Self` in Python 2, too (#6932) + +## 1.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/itsdangerous.md b/stub-uploader/data/changelogs/itsdangerous.md new file mode 100644 index 0000000..ccb54ec --- /dev/null +++ b/stub-uploader/data/changelogs/itsdangerous.md @@ -0,0 +1,12 @@ +## 1.1.6 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 1.1.5 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.1.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/jmespath.md b/stub-uploader/data/changelogs/jmespath.md new file mode 100644 index 0000000..aa32aba --- /dev/null +++ b/stub-uploader/data/changelogs/jmespath.md @@ -0,0 +1,28 @@ +## 1.0.2 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 1.0.1 (2022-07-07) + +Annotate `jmespath` public API (#8253) + +## 1.0.0 (2022-06-26) + +[stubsabot] Bump jmespath to 1.0.* (#8183) + +Co-authored-by: hauntsaninja <> + +## 0.10.3 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.10.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/jsonschema.md b/stub-uploader/data/changelogs/jsonschema.md new file mode 100644 index 0000000..225b1b0 --- /dev/null +++ b/stub-uploader/data/changelogs/jsonschema.md @@ -0,0 +1,149 @@ +## 4.17.0.0 (2022-11-02) + +Bump jsonschema to 4.17.* (#9066) + +## 4.16.1.1 (2022-10-14) + +Fix RefResolver's context manager return types (#8898) + +## 4.16.1 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 4.16.0 (2022-09-16) + +[stubsabot] Bump jsonschema to 4.16.* (#8748) + +Release: https://pypi.org/project/jsonschema/4.16.0/ +Homepage: https://github.com/python-jsonschema/jsonschema +Changelog: https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst +Diff: https://github.com/python-jsonschema/jsonschema/compare/v4.15.0...v4.16.0 + +## 4.15.1 (2022-09-03) + +`jsonschema._format`: update some annotations to match upstream (#8673) + +## 4.15.0 (2022-09-02) + +[stubsabot] Bump jsonschema to 4.15.* (#8665) + +Co-authored-by: stubsabot <> + +## 4.14.0 (2022-08-26) + +[stubsabot] Bump jsonschema to 4.14.* (#8619) + +## 4.12.1 (2022-08-25) + +Improve annotation of jsonschema.validators.create (#8608) + +## 4.12.0 (2022-08-19) + +[stubsabot] Bump jsonschema to 4.12.* (#8560) + +Co-authored-by: stubsabot <> + +## 4.9.0 (2022-08-05) + +[stubsabot] Bump jsonschema to 4.9.* (#8491) + +* [stubsabot] Bump jsonschema to 4.9.* + +* Remove jsonschema._reflect + +Co-authored-by: stubsabot <> +Co-authored-by: Sebastian Rittau + +## 4.7.0 (2022-07-15) + +[stubsabot] Bump jsonschema to 4.7.* (#8299) + +## 4.6.0 (2022-06-26) + +Bump jsonschema to 4.6.* (#8161) + +Co-authored-by: AlexWaygood + +## 4.4.9 (2022-06-07) + +`jsonschema`: mark type alias explicitly (#8024) + +## 4.4.8 (2022-05-30) + +Fix exception types for jsonschema._format (#7990) + +The annotated type for the `raises` argument on format checkers was + + Exception | tuple[Exception, ...] + +when it should read + + type[Exception] | tuple[type[Exception], ...] + +Co-authored-by: Sebastian Rittau + +## 4.4.7 (2022-05-30) + +Fix jsonschema exception str|int containers (#7981) + +schema_path, relative_schema_path, and absolute_schema_path are all +(related) attributes of `jsonschema` errors which contain `str | int` +but were accidentally annotated as containing `str`. Fix them for +accuracy. + +## 4.4.6 (2022-05-29) + +jsonschema: {relative,absolute}_path can hold ints (#7980) + +## 4.4.5 (2022-05-27) + +Flesh out more of jsonschema stubs (#7950) + +Apply more detailed annotations to the format module and most of the +exceptions module. + +## 4.4.4 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 4.4.3 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 4.4.2 (2022-03-14) + +jsonschema: mark schemas as Mapping[str, Any] (#7489) + +jsonschema: `RefResolver.referrer` is a `dict[str, Any]` (#7487) + +## 4.4.1 (2022-01-25) + +Treat validators as classes (#7035) + +Co-authored-by: Akuli + +## 4.4.0 (2022-01-24) + +Annotate parts of jsonschema.validators and URIDict (#7025) + +## 4.3.2 (2022-01-16) + +Cleanup: do not quote types unnecessarily (#6931) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 4.3.0 (2021-12-17) + +Add `jsonschema.protocols` to library stubs (#6614) + +`jsonschema.protocols.Validator` was introduced in `jsonschema` v4.3.0 +It's also available under the name `jsonschema.Validator`. + +## 4.2.0 (2021-12-06) + +Updated stubs to jsonschema 4.2 (#6486) + +## 3.2.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/keyboard.md b/stub-uploader/data/changelogs/keyboard.md new file mode 100644 index 0000000..8caa96d --- /dev/null +++ b/stub-uploader/data/changelogs/keyboard.md @@ -0,0 +1,18 @@ +## 0.13.2.1 (2022-11-03) + +Update pyright to 1.1.278 (#9077) + +Co-authored-by: Alex Waygood + +## 0.13.2 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 0.13.1 (2022-09-22) + +Add reportMissingParameterType to `pyrightconfig.stricter.json` (#8770) + +## 0.13.0 (2022-09-06) + +Added stubs for keyboard (#8666) + diff --git a/stub-uploader/data/changelogs/ldap3.md b/stub-uploader/data/changelogs/ldap3.md new file mode 100644 index 0000000..cd61133 --- /dev/null +++ b/stub-uploader/data/changelogs/ldap3.md @@ -0,0 +1,84 @@ +## 2.9.13 (2022-08-17) + +Add SAFE_RESTARTABLE strategy to ldap3 Connection client_strategy parameter (#8547) + +## 2.9.12 (2022-07-07) + +Fix various `TypeAlias` issues (#8248) + +## 2.9.11 (2022-06-20) + +Overhaul `socket` stubs on Windows and MacOS (#8106) + +Reduce the `socket` allowlists for these platforms to a handful of missing constants + +## 2.9.10 (2022-06-06) + +Always use `TypeAlias` when assigning to `Any` (#8021) + +## 2.9.9 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 2.9.8 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.9.7 (2022-03-06) + +Upgrade to stubtest with dunder pos only reverted (#7442) + +## 2.9.6 (2022-02-02) + +Add iterable and ServerPool types to ldap3 Connection.server parameter (#7101) + +## 2.9.5 (2022-01-31) + +Upgrade black version (#7089) + +## 2.9.4 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 2.9.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.9.1 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.9.0 (2021-12-10) + +Add stubs for ldap3 (#6561) + diff --git a/stub-uploader/data/changelogs/mock.md b/stub-uploader/data/changelogs/mock.md new file mode 100644 index 0000000..c33a45e --- /dev/null +++ b/stub-uploader/data/changelogs/mock.md @@ -0,0 +1,72 @@ +## 4.0.15.2 (2022-10-20) + +Remove `mock` from `pyright`'s exclude (#8942) + +## 4.0.15.1 (2022-10-19) + +Mark `mock` as completed (#8919) + +Co-authored-by: Jelle Zijlstra + +## 4.0.15 (2022-06-06) + +Always use `TypeAlias` when assigning to `Any` (#8021) + +## 4.0.14 (2022-05-25) + +mock: Fix unconstrained TypeVar (#7945) + +The first overload covers the case where `new` is not given. + +Part of #7928 + +## 4.0.13 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 4.0.12 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 4.0.11 (2022-02-22) + +Correct several positional-only differences in third-party stubs (#7352) + +## 4.0.10 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 4.0.9 (2022-01-30) + +Reduce use of `Any` in equality methods (#7081) + +Co-authored-by: Akuli + +## 4.0.8 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 4.0.7 (2022-01-07) + +Update pyright (#6840) + +## 4.0.5 (2021-12-25) + +Fixes for third-party mock package (#6685) + +Removed a few unused private classes and methods. They can be re-added if a user reports them missing. + +## 4.0.4 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 4.0.3 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 4.0.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/mypy-extensions.md b/stub-uploader/data/changelogs/mypy-extensions.md new file mode 100644 index 0000000..d523d39 --- /dev/null +++ b/stub-uploader/data/changelogs/mypy-extensions.md @@ -0,0 +1,107 @@ +## 0.4.24 (2022-08-17) + +Normalise use of `Never` vs `NoReturn` (#8549) + +## 0.4.23 (2022-08-13) + +Improve `.keys()`, `.values()`, `.items()` methods for `TypedDict`s (#8532) + +## 0.4.22 (2022-08-10) + +Add missing `TypedDict` methods and `ClassVar`s (#8512) + +## 0.4.21 (2022-07-12) + +Use error codes for type ignores (#8280) + +Disable reportSelfClsParameterName for pytype as this is out of typeshed's +control + +Closes: #7497 + +## 0.4.20 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.4.19 (2022-06-13) + +Use `_typeshed.IdentityFunction` more consistently (#8063) + +## 0.4.18 (2022-05-24) + +`mypy_extensions`: fix `TypeVar` usage (#7937) + +#7928 + +## 0.4.17 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.4.16 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 0.4.15 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 0.4.14 (2022-01-31) + +Upgrade black version (#7089) + +## 0.4.13 (2022-01-25) + +Improve trait signature in mypy_extensions.pyi (#7027) + +Co-authored-by: Mehdi Drissi + +## 0.4.12 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 0.4.11 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.4.9 (2021-12-16) + +mypy_extensions: fix NoReturn, remove inaccurate comment (#6595) + +## 0.4.8 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/mysqlclient.md b/stub-uploader/data/changelogs/mysqlclient.md new file mode 100644 index 0000000..f460a9a --- /dev/null +++ b/stub-uploader/data/changelogs/mysqlclient.md @@ -0,0 +1,54 @@ +## 2.1.5 (2022-07-26) + +mysqlclient.connection: add missing type hints (#8393) + +Co-authored-by: Jelle Zijlstra + +Add type hints to mysqlclient.times (#8392) + +## 2.1.4 (2022-07-25) + +Annotate `mysqlclient.release.version_info` (#8391) + +## 2.1.3 (2022-07-24) + +`mysqlclient`: Annotate types of exceptions in `Connection` class (#8382) + +## 2.1.2 (2022-07-24) + +Add return type to MySQLdb.Connection.__enter__ (#8381) + +This pull request adds the return type, as seen in the link below, to the `mysqlclient.MySQLdb.connections:Connection.__enter__` +https://github.com/PyMySQL/mysqlclient/blob/main/MySQLdb/connections.py#L230-L231 + +## 2.1.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 2.1.0 (2022-06-21) + +Bump mysqlclient to 2.1.* (#8116) + +## 2.0.5 (2022-02-22) + +Correct several positional-only differences in third-party stubs (#7352) + +## 2.0.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.0.2 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 2.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/oauthlib.md b/stub-uploader/data/changelogs/oauthlib.md index ffa4cb9..24c8239 100644 --- a/stub-uploader/data/changelogs/oauthlib.md +++ b/stub-uploader/data/changelogs/oauthlib.md @@ -1,3 +1,19 @@ +## 3.2.0 (2022-06-18) + +Bump oauthlib to 3.2.* (#8081) + +## 3.1.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 3.1.4 (2021-11-18) + +Revert "do not use mypy-specific syntax in '# type: ignore' comments" (#6338) + +## 3.1.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.1.2 (2021-08-29) do not use mypy-specific syntax in '# type: ignore' comments (#5953) diff --git a/stub-uploader/data/changelogs/openpyxl.md b/stub-uploader/data/changelogs/openpyxl.md new file mode 100644 index 0000000..9b7f2e3 --- /dev/null +++ b/stub-uploader/data/changelogs/openpyxl.md @@ -0,0 +1,22 @@ +## 3.0.4 (2022-06-06) + +Always use `TypeAlias` when assigning to `Any` (#8021) + +## 3.0.3 (2022-05-27) + +`openpyxl`: annotate openpyxl.utils.cell stubs (#7969) + +## 3.0.2 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 3.0.1 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 3.0.0 (2022-03-07) + +Add openpyxl stubs (#6801) + diff --git a/stub-uploader/data/changelogs/opentracing.md b/stub-uploader/data/changelogs/opentracing.md new file mode 100644 index 0000000..9008f88 --- /dev/null +++ b/stub-uploader/data/changelogs/opentracing.md @@ -0,0 +1,74 @@ +## 2.4.10 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 2.4.9 (2022-05-21) + +Simplify and correct many numeric unions (#7906) + +Unblocks PyCQA/flake8-pyi#222 + +## 2.4.8 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.4.7 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 2.4.6 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.4.4 (2021-12-10) + +Add missing context proptery to MockSpan (#6549) + +The property context should return a mocked context and not a regular one + +## 2.4.3 (2021-12-08) + +Adjust opentracing return types for mocks (#6527) + +## 2.4.2 (2021-12-03) + +Fix minor issues in opentracing (#6482) + +## 2.4.1 (2021-12-03) + +Annotate remaining opentracing fields, arguments, and return types (#6476) + +## 2.4.0 (2021-12-02) + +Add opentracing stubs (#6473) + diff --git a/stub-uploader/data/changelogs/orjson.md b/stub-uploader/data/changelogs/orjson.md new file mode 100644 index 0000000..19711af --- /dev/null +++ b/stub-uploader/data/changelogs/orjson.md @@ -0,0 +1,4 @@ +## 3.6.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/paho-mqtt.md b/stub-uploader/data/changelogs/paho-mqtt.md new file mode 100644 index 0000000..075a9da --- /dev/null +++ b/stub-uploader/data/changelogs/paho-mqtt.md @@ -0,0 +1,4 @@ +## 1.6.0.0 (2022-10-06) + +Add paho-mqtt stubs (#8853) + diff --git a/stub-uploader/data/changelogs/paramiko.md b/stub-uploader/data/changelogs/paramiko.md index d67022c..cf864ca 100644 --- a/stub-uploader/data/changelogs/paramiko.md +++ b/stub-uploader/data/changelogs/paramiko.md @@ -1,3 +1,178 @@ +## 2.11.6 (2022-09-11) + +Improve `paramiko.win_pageant` stubs (#8671) + +## 2.11.5 (2022-09-03) + +fix: add missing paramiko.win_openssh (#8672) + +## 2.11.4 (2022-08-31) + +`paramiko`: Add missing types in `__init__.pyi` and `_version.pyi` (#8651) + +## 2.11.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 2.11.2 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 2.11.1 (2022-06-26) + +Third-party stubs: audit `Callable[, None]` annotations (#8175) + +## 2.11.0 (2022-06-18) + +[stubsabot] Bump paramiko to 2.11.* (#8091) + +Co-authored-by: hauntsaninja <> + +## 2.10.0 (2022-05-02) + +Upgrade paramiko (#7766) + +## 2.8.21 (2022-04-30) + +Fix paramiko `channel.setblocking()` argument (#7758) + +Add 0,1 as allowed arguments using `Literal[0,1]` + +## 2.8.20 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 2.8.19 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.8.18 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.8.17 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 2.8.16 (2022-03-10) + +Modernize syntax in various stubs (#7469) + +Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`. + +## 2.8.15 (2022-03-09) + +Remove explicit inheritance from object (#7468) + +## 2.8.14 (2022-03-09) + +Remove Python 2 support from some third-party distributions (#7466) + +Co-authored-by: Alex Waygood + +## 2.8.13 (2022-02-08) + +Improve `sock` typing in Paramiko stub (#7156) + +## 2.8.12 (2022-02-03) + +Improve classmethods in `paramiko` stubs (#7113) + +## 2.8.11 (2022-01-31) + +Upgrade black version (#7089) + +## 2.8.10 (2022-01-16) + +remove "= ..." from top-level values (#6930) + +## 2.8.9 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 2.8.8 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 2.8.6 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.8.5 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 2.8.4 (2021-12-08) + +fix: paramiko.HostKeyEntry.hostnames is a list (#6544) + +## 2.8.3 (2021-12-04) + +paramiko.Channel - mark arguments as also accepting bytes (#6276) + +## 2.8.2 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 2.8.1 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 2.8.0 (2021-11-18) + +Add `prefetch` argument to paramiko SFTPClient.getfo (#6331) + +Co-authored-by: Akuli + +## 2.7.4 (2021-11-08) + +paramiko.ServerInterface: replace str with bytes in some methods (#6254) + +## 2.7.3 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.7.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2.7.1 (2021-10-05) Properly export bytes from paramiko.py3compat (#6113) diff --git a/stub-uploader/data/changelogs/parsimonious.md b/stub-uploader/data/changelogs/parsimonious.md new file mode 100644 index 0000000..73c5f0f --- /dev/null +++ b/stub-uploader/data/changelogs/parsimonious.md @@ -0,0 +1,45 @@ +## 0.10.0.1 (2022-10-20) + +Mark `parsimonious` as completed (#8934) + +## 0.10.0 (2022-09-13) + +Update parsimonious to 0.10.0 (#8730) + +## 0.9.1 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 0.9.0 (2022-06-21) + +Bump parsimonious to 0.9.* (#8117) + +## 0.8.5 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.8.4 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.8.3 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.8.2 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 0.8.1 (2022-03-13) + +parsimonious: `re.Match` does not exist in Python 3.6 (#7482) + +It has to be imported from `typing` in <3.7. +Refs https://github.com/python/typeshed/pull/7478. + +## 0.8.0 (2022-03-13) + +Stubs for parsimonious (#7477) + diff --git a/stub-uploader/data/changelogs/passlib.md b/stub-uploader/data/changelogs/passlib.md new file mode 100644 index 0000000..bf11966 --- /dev/null +++ b/stub-uploader/data/changelogs/passlib.md @@ -0,0 +1,43 @@ +## 1.7.7 (2022-07-12) + +Use error codes for type ignores (#8280) + +Disable reportSelfClsParameterName for pytype as this is out of typeshed's +control + +Closes: #7497 + +## 1.7.6 (2022-07-05) + +Improve passlib CryptContext typing (#8237) + +## 1.7.5 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 1.7.4 (2022-03-27) + +passlib: Annotate various handler methods and fields (#7521) + +Co-authored-by: Alex Waygood + +## 1.7.3 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 1.7.2 (2022-03-14) + +passlib: Annotate pbkdf2_sha* (#7486) + +## 1.7.1 (2022-03-13) + +passlib: fix MutableMapping import (#7479) + +Found by #7478 + +## 1.7.0 (2022-03-07) + +Add passlib stubs (#7024) + diff --git a/stub-uploader/data/changelogs/passpy.md b/stub-uploader/data/changelogs/passpy.md new file mode 100644 index 0000000..f043973 --- /dev/null +++ b/stub-uploader/data/changelogs/passpy.md @@ -0,0 +1,14 @@ +## 1.0.2.1 (2022-11-01) + +Complete `passpy` stubs (#8959) + +## 1.0.2 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 1.0.0 (2021-12-22) + +adding stubs for passpy API (#6651) + +Co-authored-by: Jelle Zijlstra + diff --git a/stub-uploader/data/changelogs/peewee.md b/stub-uploader/data/changelogs/peewee.md new file mode 100644 index 0000000..b96468e --- /dev/null +++ b/stub-uploader/data/changelogs/peewee.md @@ -0,0 +1,4 @@ +## 3.15.0.0 (2022-10-04) + +Add auto-generated peewee stubs (#8834) + diff --git a/stub-uploader/data/changelogs/pep8-naming.md b/stub-uploader/data/changelogs/pep8-naming.md new file mode 100644 index 0000000..9bd2214 --- /dev/null +++ b/stub-uploader/data/changelogs/pep8-naming.md @@ -0,0 +1,29 @@ +## 0.13.0.2 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 0.13.0.1 (2022-10-07) + +Add two more methods to `pep8-naming` stub (#8864) + +## 0.13.0 (2022-06-26) + +[stubsabot] Bump pep8-naming to 0.13.* (#8181) + +* [stubsabot] Bump pep8-naming to 0.13.* + +* Bye bye Python 2 + +Co-authored-by: hauntsaninja <> +Co-authored-by: Alex Waygood + +## 0.12.1 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.12.0 (2022-01-25) + +Fix missing return type in pep8ext_naming (#7031) + +Add stubs for pep8-naming (#7030) + diff --git a/stub-uploader/data/changelogs/playsound.md b/stub-uploader/data/changelogs/playsound.md new file mode 100644 index 0000000..dd4c7ac --- /dev/null +++ b/stub-uploader/data/changelogs/playsound.md @@ -0,0 +1,10 @@ +## 1.3.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 1.3.0 (2022-01-10) + +Add stubs for playsound (#6881) + diff --git a/stub-uploader/data/changelogs/polib.md b/stub-uploader/data/changelogs/polib.md new file mode 100644 index 0000000..f5848f2 --- /dev/null +++ b/stub-uploader/data/changelogs/polib.md @@ -0,0 +1,36 @@ +## 1.1.12 (2022-04-27) + +Drop Python 2 support from polib (#7714) + +## 1.1.11 (2022-03-19) + +Add mypy error codes to `type: ignore`s, remove unused ignores (#7504) + +Co-authored-by: Jelle Zijlstra + +## 1.1.10 (2022-01-30) + +Reduce use of `Any` in equality methods (#7081) + +Co-authored-by: Akuli + +## 1.1.9 (2022-01-17) + +remove quoted strings (#6933) + +## 1.1.8 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.1.6 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.1.5 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 1.1.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/prettytable.md b/stub-uploader/data/changelogs/prettytable.md new file mode 100644 index 0000000..1bfc3c4 --- /dev/null +++ b/stub-uploader/data/changelogs/prettytable.md @@ -0,0 +1,50 @@ +## 3.4.2.1 (2022-10-29) + +[stubsabot] Mark prettytable as obsolete since 3.5.0 (#9023) + +Release: https://pypi.org/pypi/prettytable/3.5.0 +Homepage: https://github.com/jazzband/prettytable +Diff: https://github.com/jazzband/prettytable/compare/3.4.1...3.5.0 + +Co-authored-by: stubsabot <> + +## 3.4.2 (2022-09-25) + +prettytable: get_X_string return str (#8791) + +## 3.4.1 (2022-09-03) + +`prettytable`: Fix stubtest errors (#8676) + +Fixes #8674. A partial revert of 9e696275018ef3798bb596821ad0d8b4b8e80ab6. + +## 3.4.0 (2022-08-29) + +Bump prettytable to 3.4.* (#8621) + +## 3.3.1 (2022-07-12) + +Use error codes for type ignores (#8280) + +Disable reportSelfClsParameterName for pytype as this is out of typeshed's +control + +Closes: #7497 + +## 3.3.0 (2022-06-30) + +Bump prettytable to 3.3.* (#8207) + +Co-authored-by: hauntsaninja <> +Co-authored-by: Alex Waygood + +## 2.1.3 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 2.1.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/protobuf.md b/stub-uploader/data/changelogs/protobuf.md new file mode 100644 index 0000000..2945ed0 --- /dev/null +++ b/stub-uploader/data/changelogs/protobuf.md @@ -0,0 +1,173 @@ +## 3.20.4.2 (2022-10-25) + +google.protobuf: Add an __init__ stub to fix type checking (#8982) + +## 3.20.4.1 (2022-10-21) + +Bump mypy-protobuf to 3.4.0 (#8951) + +`types-protobuf`: Bump the rev of protobuf supported to 4.21.8 (#8937) + +## 3.20.4 (2022-09-19) + +Fix protobuf stubtest errors (#8758) + +## 3.20.3 (2022-09-15) + +protobuf: fix stubtest errors (#8735) + +## 3.20.2 (2022-09-08) + +[protobuf] MessageToJson indent parameter can be None (#8705) + +## 3.20.1 (2022-08-26) + +Bump to mypy-protobuf 3.3.0 (#8612) + +* Bump to mypy-protobuf 3.3.0 + +* Remove some ignores for formatting + +## 3.20.0 (2022-08-25) + +Bump protobuf to 3.20.1 (#8609) + +There are even newer versions available (4.*), but I had found a bug +in it which prevented it from working with mypy-protobuf. For now, +sticking to just 3.20.1 + +## 3.19.22 (2022-06-16) + +`protobuf`: Delete some `__new__` and `__init__` methods (#8088) + +## 3.19.21 (2022-05-21) + +Simplify and correct many numeric unions (#7906) + +Unblocks PyCQA/flake8-pyi#222 + +## 3.19.20 (2022-05-10) + +Remove explicit inheritance from `object` (#7819) + +## 3.19.19 (2022-05-09) + +Use `str` instead of `Text` (#7812) + +## 3.19.18 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 3.19.17 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 3.19.16 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 3.19.15 (2022-03-21) + +Revert "Remove google/__init__.pyi (#6106)" (#7522) + +This reverts commit a11a6643a7599c352ae11ac1b08dc5f3d71b106c. + +## 3.19.14 (2022-03-21) + +Remove google/__init__.pyi (#6106) + +Since google is a namespace package, it won't have an init. +Depends on https://github.com/typeshed-internal/stub_uploader/pull/33 + +## 3.19.13 (2022-03-17) + +Use PEP 604 syntax in non-autogenerated protobuf stubs (#7506) + +## 3.19.12 (2022-02-11) + +protobuf doesn't support Python 2 anymore (#7176) + +Remove Python-2-only package "futures" + +## 3.19.11 (2022-02-08) + +protobuf: Bring back Message.Extensions (#7154) + +## 3.19.10 (2022-02-07) + +Improve a bunch of `__(deep)copy__` methods (#7148) + +## 3.19.9 (2022-02-04) + +Makes `DESCRIPTOR` non nullable again (#7125) + +Co-authored-by: Jelle Zijlstra + +## 3.19.8 (2022-02-02) + +Add/fix types to a bunch of non-generated protobuf files (#7017) + +## 3.19.7 (2022-01-29) + +Use relax_strict_optional_primitives on protobuf generated code (#7038) + +Per the suggestion in https://github.com/dropbox/mypy-protobuf/issues/344 +This generates more permissive constructors (which protobuf itself actually +accepts). + +Philosophically, I think it makes sense for the generated code hosted on +typeshed to be most permissive, while the generated code of individual +projects can make individual decisions (defaulting to less permissive). + +## 3.19.6 (2022-01-24) + +Bump to mypy-protobuf 3.2.0 (#7013) + +## 3.19.5 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 3.19.4 (2022-01-19) + +Use `_typeshed.Self` in `protobuf/google/protobuf/message.pyi` (#6955) + +Use PEP 585 syntax in Python 2, `protobuf` & `_ast` stubs, where possible (#6949) + +Flatten stubtest_allowlist for protobuf generated files (#6944) + +I added stubtest testing for generated files within mypy-protobuf. +There are many ways in which the protobuf code is doing *weird* +things and we want the stubs to look a bit different. They're enumerated +in the `stubtest_allowlist.txt` of mypy-protobuf, so squashing them here +so that this one can focus on the non-generated files. + +## 3.19.0 (2022-01-10) + +Bump protobuf to 3.19.2 (#6879) + +## 3.18.3 (2022-01-03) + +Add google.protobuf.internal.api_implementation (#6802) + +## 3.18.2 (2021-11-27) + +Improve stubs for sequence types (#6386) + +## 3.18.1 (2021-11-21) + +Fix MutableMapping overrides (#6352) + +## 3.18.0 (2021-10-13) + +Bump protobuf stub to 3.18.1 and mypy-protobuf 3.0.0 (#6157) + +* Bump protobuf stub to 3.18.1 and mypy-protobuf 3.0.0 + +* Fix ConsumeInteger in google/protobuf/text_format.pyi + +The arg was removed in protobuf 3.18 + +## 3.17.5 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/psutil.md b/stub-uploader/data/changelogs/psutil.md index 4af7006..caa37c1 100644 --- a/stub-uploader/data/changelogs/psutil.md +++ b/stub-uploader/data/changelogs/psutil.md @@ -1,3 +1,123 @@ +## 5.9.5.4 (2022-10-20) + +`psutil`: Fix `win_service_iter()` return type to allow iterating over its result (#8932) + +## 5.9.5.3 (2022-10-19) + +psutil: add snicstats.flags (#8928) + +Fixes #8927 + +See https://github.com/giampaolo/psutil/commit/70eecaf44d61f2cabcd22ffb407b904242a122c9 + +## 5.9.5.2 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 5.9.5.1 (2022-10-03) + +psutil: Improve types for disk_io_counters() and net_io_counters() (#8829) + +## 5.9.5 (2022-08-08) + +psutil: improve svmem types (#8503) + +## 5.9.4 (2022-08-08) + +psutil: types for virtual_memory (#8501) + +## 5.9.3 (2022-07-30) + +Remove or move several `TypeAlias` declarations (#8444) + +## 5.9.2 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 5.9.1 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 5.9.0 (2022-07-01) + +[stubsabot] Bump psutil to 5.9.* (#8213) + +Co-authored-by: hauntsaninja <> + +## 5.8.23 (2022-06-06) + +Always use `TypeAlias` when assigning to `Any` (#8021) + +## 5.8.22 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 5.8.21 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 5.8.20 (2022-01-31) + +Upgrade black version (#7089) + +## 5.8.19 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 5.8.17 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 5.8.16 (2021-12-23) + +fix typing for psutil sconn (#6669) + +## 5.8.15 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 5.8.14 (2021-11-08) + +Process.status returns a status string (#6245) + +Typed STATUS_* constants using Literal + +## 5.8.13 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 5.8.12 (2021-10-07) Add missing annotations for psutil (#6124) diff --git a/stub-uploader/data/changelogs/psycopg2.md b/stub-uploader/data/changelogs/psycopg2.md new file mode 100644 index 0000000..757f9cc --- /dev/null +++ b/stub-uploader/data/changelogs/psycopg2.md @@ -0,0 +1,198 @@ +## 2.9.21.1 (2022-10-07) + +psycopg2: __nonzero__ was removed (#8863) + +Fixes #8862 + +## 2.9.21 (2022-08-21) + +Improve return type for psycopg2 connect function (#8567) + +When a `connection_factory` argument is provided to psycopg2's `connect` function, the function's return type now matches that of the factory output class. However, if `cursor_factory` is set and has a non-`None` value and/or `connection_factory` is not set or is `None`, the return type is simply `connection`, as before. + +## 2.9.20 (2022-08-17) + +Additional return types for psycopg2 connections (#8528) + +* Return types for psycopg2 dict connections + +DB connection and cursor methods that deal with `dict`-style results now indicate the expected return types as implemented. + +* Return types for psycopg2 namedtuple connections + +DB connection and cursor methods that deal with `namedtuple` results now indicate the expected return types as implemented. + +* Use ABC iterator + +As required by flake8, the `Iterator` referenced in psycopg2's `extras` module has been switched to the `collections.abc.Iterator[T]` variant. + +* Fix base psycopg2 cursor iter return type + +The previous return type of `Self` is wrong; `cursor`'s `__iter__` method returns an `Iterator`. + +* Correct return type for cursor iter and next methods + +The previous attempt to fix the return type of `cursor`'s (and subclasses) `__iter__` method was misguided; they should indeed return `Self`. It's the `__next__` methods that had to be updated to return the correct record/row instance type. + +* Comprehensive overloads for psycopg2 extra connections + +Provides full method signatures for the `cursor` methods of the `DictConnection`, `RealDictConnection` and `NamedTupleConnection` types. Notably this includes a default value for `cursor_factory` in each case, while preserving the option to override the parameter manually. + +* Have mypy ignore incompatible psycopg2 return types + +The return types of the `fetch*` and `__next__` methods of `DictCursor`, `RealDictCursor` and `NamedTupleCursor` are incompatible with the base `cursor` class's corresponding methods' return types. However, this does accurately reflect reality, so ignore the mypy errors in those cases. + +* Use ABC callable for psycopg2 extras module + +As required by flake8, the `Callable` referenced in psycopg2's `extras` module has been switched to the `Callable` variant. + +* Remove superfluous psycopg2 member overrides + +Several members in the `DictCursorBase` type definition were entirely unnecessary, so they have been removed. In addition, adds a type to the `size` param of the `cursor`'s `fetchmany` method. + +## 2.9.19 (2022-08-08) + +Enhanced type hinting for psycopg2 stubs (#8500) + +## 2.9.18 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 2.9.17 (2022-07-11) + +Extend annotations for `psycopg2.sql` (#8263) + +## 2.9.16 (2022-06-03) + +psycopg2: stub improvements (#7964) + +Fixes an entry from #7928 along with a number of other improvements. + +I went off the C code: +https://github.com/psycopg/psycopg2/blob/master/psycopg/connection_type.c + +## 2.9.15 (2022-05-30) + +psycopg2: Fix the return type of Composable.as_string (#7984) + +Signed-off-by: Zixuan James Li <359101898@qq.com> + +## 2.9.14 (2022-05-21) + +Annotations for psycopg2.ConnectionInfo (#7834) + +* Annotations for psycopg2.ConnectionInfo + +These annotations come from the documentation here: + +https://www.psycopg.org/docs/extensions.html#psycopg2.extensions.ConnectionInfo +If there was doubt, I referred to the libpq documentation cited by +psycopg2's docs. + +I wasn't completely sure about `dsn_parameters`. Psycopg2's docs list it +as an `dict`, and the example suggests it's a `dict[str, str]` at that. +From psycopg2's source I found + + https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L183-L206 + +which is implemented here: + + https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/utils.c#L251-L279 + +I'm no expert in CPython's API, but this looks to me like it's building +a `dict[str, str]`. + +Additionally, the libpq docs + +https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNINFO +https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNDEFAULTS + +show that the underlying data just consists of strings. + +Additionally, I'm pretty sure from this chunk of source + + https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L581-L598 + +That `ConnectionInfo.__init__` takes one positional-only argument, which +must be a `psycopg2.connection`. But I don't think users are intended to +be constructing this type, so I've not added that annotation. + +* Annotate `connection.info` and related attributes + +* Make ConnectionInfo attributes properties + +According to https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L534-L563 + +* Mark connection attributes as readonly + +according to https://github.com/psycopg/psycopg2/blob/8ef195f2ff187454cc709d7857235676bb4176ee/psycopg/connection_type.c#L1244 + +* Explain why some properties aren't `T | None` + +## 2.9.13 (2022-04-22) + +Annotate Error and Diagnostics (#7671) + +Move cursor class to top of file so it can be used as base class + +## 2.9.12 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 2.9.11 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.9.10 (2022-04-08) + +psycopg2: correct return type (#7607) + +Fixes the return type of `psycopg2.cursor.fetchone()` to match the psycopg2 code: + +https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/cursor_type.c#L647-L651 +https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/cursor_type.c#L748-L786 + +It also matches the [psycopg2 documentation](https://www.psycopg.org/docs/cursor.html?highlight=copy_from#cursor.fetchone) as well as the [DB-API](https://peps.python.org/pep-0249/#fetchone) + +## 2.9.9 (2022-03-16) + +psycopg2: Accept Composable in place of query string (#7494) + +https://www.psycopg.org/docs/sql.html#psycopg2.sql.Composable +“Composable objects can be passed directly to execute(), +executemany(), copy_expert() in place of the query string.” + +Signed-off-by: Anders Kaseorg + +## 2.9.8 (2022-03-08) + +psycopg2: Annotate cursor execute* and dunder methods (#7460) + +## 2.9.7 (2022-02-22) + +Correct several positional-only differences in third-party stubs (#7352) + +## 2.9.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.9.4 (2021-12-02) + +Fix psycopg2 connection.cursor() stub (#6470) + +Adds `scrollable=` argument missing since psycopg2 2.5 and prevents `Any` from being hinted when `cursor_factory=` is passed. + +## 2.9.3 (2021-11-30) + +psycopg2: use Error and Warning from _psycopg.pyi in errors.pyi (#6454) + +## 2.9.2 (2021-11-23) + +Move abstract methods to AbstractConnectionPool (#6340) + +## 2.9.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/pyOpenSSL.md b/stub-uploader/data/changelogs/pyOpenSSL.md index 63906b5..6e6b6e6 100644 --- a/stub-uploader/data/changelogs/pyOpenSSL.md +++ b/stub-uploader/data/changelogs/pyOpenSSL.md @@ -1,3 +1,82 @@ +## 22.1.0.2 (2022-11-05) + +isort: Add more to extra_standard_library (#9098) + +## 22.1.0.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 22.1.0.0 (2022-10-04) + +Update pyOpenSSL stubs to 22.1.* (#8838) + +## 22.0.10 (2022-07-29) + +Add `pyopenssl.rand` module (#8435) + +## 22.0.9 (2022-07-25) + +Add `pyopenssl.version` module (#8384) + +## 22.0.8 (2022-07-24) + +Add missing methods to `OpenSSL.SSL.Connection` (#8374) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 22.0.7 (2022-07-23) + +`pyopenssl`: `data` argument for `set_ocsp_server_callback`/`set_ocsp_client_callback` can be non-`bytes` (#8371) + +## 22.0.6 (2022-07-22) + +Add `ocsp` callback setters to `OpenSSL.SSL` (#8367) + +## 22.0.5 (2022-07-22) + +Add `proto_version` setters to `OpenSSL.SSL` (#8363) + +## 22.0.4 (2022-06-26) + +Third-party stubs: audit `Callable[, None]` annotations (#8175) + +## 22.0.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 22.0.2 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 22.0.1 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 22.0.0 (2022-01-30) + +pyOpenSSL: Adapt to changes in 22.0.0 (#7080) + +## 21.0.2 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 21.0.1 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 21.0.0 (2021-11-10) + +Add pyOpenSSL 21 constants (#6273) + +## 20.0.9 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 20.0.8 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 20.0.7 (2021-09-30) Unbreak CI (#6093) diff --git a/stub-uploader/data/changelogs/pyRFC3339.md b/stub-uploader/data/changelogs/pyRFC3339.md new file mode 100644 index 0000000..0880d44 --- /dev/null +++ b/stub-uploader/data/changelogs/pyRFC3339.md @@ -0,0 +1,11 @@ +## 1.1.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/pyaudio.md b/stub-uploader/data/changelogs/pyaudio.md new file mode 100644 index 0000000..5d025e2 --- /dev/null +++ b/stub-uploader/data/changelogs/pyaudio.md @@ -0,0 +1,60 @@ +## 0.2.16 (2022-06-19) + +stubtest: use separate table in METADATA.toml (#8096) + +## 0.2.15 (2022-05-21) + +Simplify and correct many numeric unions (#7906) + +Unblocks PyCQA/flake8-pyi#222 + +## 0.2.14 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.2.13 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 0.2.12 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.2.11 (2022-03-19) + +PEP 604: Remove some more uses of Union/Optional (#7515) + +The following patterns still break mypy: + +1. `type[]` at top level fails +2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine) +3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9 + +This PR cleans up usage of `Union` and `Optional` outside these patterns. + +## 0.2.10 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 0.2.9 (2022-01-16) + +remove "= ..." from top-level values (#6930) + +## 0.2.7 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.2.6 (2021-12-27) + +Replace METADATA stubtest key with stubtest_apt_packages (#6704) + +## 0.2.5 (2021-12-25) + +Add a 'stubtest' flag to METADATA.toml (#6687) + +Co-authored-by: Akuli + +## 0.2.4 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/pycurl.md b/stub-uploader/data/changelogs/pycurl.md new file mode 100644 index 0000000..8d50567 --- /dev/null +++ b/stub-uploader/data/changelogs/pycurl.md @@ -0,0 +1,55 @@ +## 7.45.1 (2022-07-18) + +`pycurl`: Add `CurlMulti.setopt()` (#8315) + +## 7.45.0 (2022-06-25) + +[stubsabot] Bump pycurl to 7.45.* (#8163) + +Co-authored-by: hauntsaninja <> + +## 7.44.9 (2022-06-19) + +stubtest: use separate table in METADATA.toml (#8096) + +## 7.44.8 (2022-04-16) + +Python 3 stubs: use `str` instead of `typing.Text` (#7638) + +## 7.44.7 (2022-02-21) + +contextvars, pycurl: make classes final (#7334) + +## 7.44.5 (2022-01-02) + +Never explicitly inherit from `object` in Python 3-only stubs (#6777) + +## 7.44.4 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 7.44.3 (2021-12-27) + +Replace METADATA stubtest key with stubtest_apt_packages (#6704) + +## 7.44.2 (2021-12-25) + +Add a 'stubtest' flag to METADATA.toml (#6687) + +Co-authored-by: Akuli + +## 7.44.1 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 7.44.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/pyfarmhash.md b/stub-uploader/data/changelogs/pyfarmhash.md new file mode 100644 index 0000000..23db870 --- /dev/null +++ b/stub-uploader/data/changelogs/pyfarmhash.md @@ -0,0 +1,16 @@ +## 0.3.1 (2022-06-25) + +ujson, pyfarmhash, toposort: check for missing definitions (#8153) + +Co-authored-by: hauntsaninja <> + +## 0.3.0 (2022-06-14) + +[stubsabot] Bump pyfarmhash to 0.3.* (#8079) + +Co-authored-by: hauntsaninja <> + +## 0.2.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/pyflakes.md b/stub-uploader/data/changelogs/pyflakes.md new file mode 100644 index 0000000..8bbdc43 --- /dev/null +++ b/stub-uploader/data/changelogs/pyflakes.md @@ -0,0 +1,20 @@ +## 2.5.0 (2022-08-05) + +Bump pyflakes to 2.5.* (#8495) + +## 2.4.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 2.4.2 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 2.4.1 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.4.0 (2022-02-11) + +Add stubs for pyflakes (#7175) + diff --git a/stub-uploader/data/changelogs/pyinstaller.md b/stub-uploader/data/changelogs/pyinstaller.md new file mode 100644 index 0000000..852d44c --- /dev/null +++ b/stub-uploader/data/changelogs/pyinstaller.md @@ -0,0 +1,52 @@ +## 5.6.0.3 (2022-11-07) + +`PyInstaller`: Fix `DeprecationWarning` when parsing the stub using `ast.parse()` (#9112) + +```python +>>> import ast, warnings +>>> warnings.filterwarnings("always") +>>> with open("typeshed/stubs/pyinstaller/pyi_splash/__init__.pyi", encoding="utf-8") as file: +... source = file.read() +... +>>> ast.parse(source) +:11: DeprecationWarning: invalid escape sequence '\u' + +``` + +Co-authored-by: Jelle Zijlstra + +## 5.6.0.2 (2022-11-03) + +Update pyright to 1.1.278 (#9077) + +Co-authored-by: Alex Waygood + +## 5.6.0.1 (2022-11-03) + +importlib: improve bytes handling (#9070) + +## 5.6.0.0 (2022-10-25) + +Bump pyinstaller to 5.6.* (#8981) + +## 5.5.0.0 (2022-10-10) + +Bump PyInstaller-stubs to 5.5 (#8874) + +## 5.4.2 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 5.4.1 (2022-09-22) + +Add reportMissingParameterType to `pyrightconfig.stricter.json` (#8770) + +Pyinstaller: use `StrPath` over `StrOrBytesPath` (#8780) + +Fix incorrect StrOrBytesPath in PyInstaller stubs +Change StrOrBytesPath to StrPath when exclusively used with strings. + +## 5.4.0 (2022-09-15) + +Add stubs for `PyInstaller` (public API only) (#8702) + diff --git a/stub-uploader/data/changelogs/pynput.md b/stub-uploader/data/changelogs/pynput.md new file mode 100644 index 0000000..7374c56 --- /dev/null +++ b/stub-uploader/data/changelogs/pynput.md @@ -0,0 +1,28 @@ +## 1.7.5 (2022-09-12) + +[pynput] Fix annotations of Controller.Key(Code) (#8722) + +Document stubtest entries + +## 1.7.4 (2022-09-10) + +Run third-party stubtest under xvfb-run (#8719) + +## 1.7.3 (2022-06-26) + +Third-party stubs: audit `Callable[, None]` annotations (#8175) + +## 1.7.2 (2022-06-19) + +stubtest: use separate table in METADATA.toml (#8096) + +## 1.7.1 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 1.7.0 (2022-02-24) + +Add stubs for `pynput` package (#7177) + +Fixes #4328 + diff --git a/stub-uploader/data/changelogs/pysftp.md b/stub-uploader/data/changelogs/pysftp.md new file mode 100644 index 0000000..08c55e3 --- /dev/null +++ b/stub-uploader/data/changelogs/pysftp.md @@ -0,0 +1,56 @@ +## 0.2.17 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 0.2.16 (2022-06-26) + +Third-party stubs: audit `Callable[, None]` annotations (#8175) + +## 0.2.15 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.2.14 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.2.13 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.2.12 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 0.2.11 (2022-03-10) + +Modernize syntax in various stubs (#7469) + +Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`. + +## 0.2.10 (2022-03-09) + +Remove Python 2 support from some third-party distributions (#7466) + +Co-authored-by: Alex Waygood + +## 0.2.9 (2022-01-16) + +Cleanup: do not quote types unnecessarily (#6931) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 0.2.8 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.2.6 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 0.2.5 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/pytest-lazy-fixture.md b/stub-uploader/data/changelogs/pytest-lazy-fixture.md new file mode 100644 index 0000000..0e24446 --- /dev/null +++ b/stub-uploader/data/changelogs/pytest-lazy-fixture.md @@ -0,0 +1,12 @@ +## 0.6.3.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 0.6.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.6.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/python-crontab.md b/stub-uploader/data/changelogs/python-crontab.md new file mode 100644 index 0000000..95962da --- /dev/null +++ b/stub-uploader/data/changelogs/python-crontab.md @@ -0,0 +1,11 @@ +## 2.6.0.1 (2022-10-20) + +Mark `python-crontab` as completed (#8938) + +## 2.6.0.0 (2022-10-20) + +Add stubs for python-cronlog (#8917) + +Co-authored-by: Jelle Zijlstra +Co-authored-by: Alex Waygood + diff --git a/stub-uploader/data/changelogs/python-dateutil.md b/stub-uploader/data/changelogs/python-dateutil.md index 774d069..2c7ec28 100644 --- a/stub-uploader/data/changelogs/python-dateutil.md +++ b/stub-uploader/data/changelogs/python-dateutil.md @@ -1,3 +1,119 @@ +## 2.8.19.2 (2022-10-17) + +`dateutil`: Add comment explaining the use of `ABCMeta` (#8911) + +## 2.8.19.1 (2022-10-17) + +`datetime.tzinfo` is abstract (#8908) + +## 2.8.19 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 2.8.18 (2022-06-22) + +Improve several `__hash__` methods (#8128) + +## 2.8.17 (2022-05-27) + +dateutil: Add dateutil.rrule.weekdays (#7968) + +Closes: #7946 + +## 2.8.16 (2022-05-19) + +Add return type for `dateutil.rrule._rrulestr.__call__`. (#7868) + +## 2.8.15 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 2.8.14 (2022-04-27) + +dateutil.tz.tz: Replace IO with protocols (#7717) + +## 2.8.13 (2022-04-27) + +Drop Python 2 support from python-dateutil (#7715) + +## 2.8.12 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 2.8.11 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.8.10 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 2.8.9 (2022-01-31) + +Upgrade black version (#7089) + +## 2.8.8 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 2.8.7 (2022-01-17) + +Use `_typeshed.Self` in Python 2, too (#6932) + +## 2.8.6 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 2.8.4 (2021-12-25) + +python-datetutil: WEEKDAYS and MONTHS can have arbitrary length tuples (#6689) + +## 2.8.3 (2021-11-23) + +Add tz{utc,offset}.fromutc() (#6360) + +## 2.8.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.8.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + +Annotate rruleset.rrule(rrule) argument (#6149) + ## 2.8.0 (2021-09-02) dateutil.parser: Complete the isoparser module (#5983) diff --git a/stub-uploader/data/changelogs/python-gflags.md b/stub-uploader/data/changelogs/python-gflags.md index 5a8fe16..d0e4902 100644 --- a/stub-uploader/data/changelogs/python-gflags.md +++ b/stub-uploader/data/changelogs/python-gflags.md @@ -1,3 +1,33 @@ +## 3.1.7.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 3.1.7 (2022-07-22) + +Always return `Iterator`, not `Iterable` for `__iter__` (#8361) + +## 3.1.6 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 3.1.5 (2022-04-27) + +Drop Python 2 support from python-gflags (#7709) + +## 3.1.4 (2022-01-28) + +Do not use `True` or `False` as default values in assignments (#7060) + +## 3.1.3 (2022-01-20) + +Remove nearly all `__str__` and `__repr__` methods from typeshed (#6968) + +## 3.1.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.1.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/python-jose.md b/stub-uploader/data/changelogs/python-jose.md new file mode 100644 index 0000000..ce65cb6 --- /dev/null +++ b/stub-uploader/data/changelogs/python-jose.md @@ -0,0 +1,23 @@ +## 3.3.4 (2022-07-15) + +python-jose: improvements to jose.backends (#8294) + +## 3.3.3 (2022-07-13) + +Complete python-jose typing (#8258) + +## 3.3.2 (2022-07-06) + +Improve python-jose jws and jwt modules (#8238) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 3.3.1 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 3.3.0 (2022-04-12) + +Add stubs for Python-Jose (#7613) + diff --git a/stub-uploader/data/changelogs/python-nmap.md b/stub-uploader/data/changelogs/python-nmap.md new file mode 100644 index 0000000..f837282 --- /dev/null +++ b/stub-uploader/data/changelogs/python-nmap.md @@ -0,0 +1,34 @@ +## 0.7.1 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 0.7.0 (2022-06-26) + +[stubsabot] Bump python-nmap to 0.7.* (#8174) + +Co-authored-by: hauntsaninja <> + +## 0.6.7 (2022-04-27) + +Drop Python 2 support from python-nmap (#7706) + +## 0.6.6 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.6.4 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.6.3 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 0.6.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 0.6.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/python-slugify.md b/stub-uploader/data/changelogs/python-slugify.md index 4f5ee1f..64cb5ed 100644 --- a/stub-uploader/data/changelogs/python-slugify.md +++ b/stub-uploader/data/changelogs/python-slugify.md @@ -1,3 +1,19 @@ +## 6.1.0 (2022-06-29) + +[stubsabot] Bump python-slugify to 6.1.* (#8208) + +## 5.0.4 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 5.0.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 5.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 5.0.0 (2021-09-05) Fix python-slugify replacements argument type (#6004) diff --git a/stub-uploader/data/changelogs/pytz.md b/stub-uploader/data/changelogs/pytz.md new file mode 100644 index 0000000..bf4dfa1 --- /dev/null +++ b/stub-uploader/data/changelogs/pytz.md @@ -0,0 +1,118 @@ +## 2022.6.0.1 (2022-11-01) + +Remove `pytz` from `pyright`s exclude (#9041) + +## 2022.6.0.0 (2022-11-01) + +[stubsabot] Bump pytz to 2022.6 (#9049) + +Release: https://pypi.org/pypi/pytz/2022.6 +Homepage: http://pythonhosted.org/pytz + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 2022.5.0.0 (2022-10-19) + +[stubsabot] Bump pytz to 2022.5 (#8926) + +Release: https://pypi.org/pypi/pytz/2022.5 +Homepage: http://pythonhosted.org/pytz + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 2022.4.0.0 (2022-10-05) + +[stubsabot] Bump pytz to 2022.4 (#8848) + +Release: https://pypi.org/pypi/pytz/2022.4 +Homepage: http://pythonhosted.org/pytz + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 2022.2.1.0 (2022-08-19) + +[stubsabot] Bump pytz to 2022.2.1 (#8564) + +Co-authored-by: stubsabot <> + +## 2022.1.2 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 2022.1.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 2022.1.0 (2022-06-21) + +[stubsabot] Bump pytz to 2022.1 (#8121) + +Co-authored-by: hauntsaninja <> + +## 2021.3.8 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 2021.3.7 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 2021.3.6 (2022-03-19) + +pytz: utcoffset only returns None if dt is None (#7510) + +## 2021.3.5 (2022-02-13) + +Fix argument types of pytz.tzinfo.StaticTzInfo (#7184) + +The argument is_dst of the functions StaticTzInfo.localize and +StaticTzInfo.normalize are ignored, and only present for compatibility with +DstTzInfo. The functions in DstTzInfo also accepts None, so for compatibility, +StaticTzInfo should accept them as well. + +[^1] https://github.com/stub42/pytz/blob/2ed682a7c4079042f50975970fc4f503c8450058/src/pytz/tzinfo.py#L112 + +## 2021.3.3 (2021-12-14) + +Add abstract methods to BaseTzInfo (#6579) + +While these abstract methods don't exist at runtime, all sub-classes of +BaseTzInfo implement them. It can be useful to annotate variables with +BaseTzInfo and being able to call these methods on it. + +## 2021.3.2 (2021-12-09) + +pytz: rework stubs (#6551) + +## 2021.3.1 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 2021.3.0 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/pyvmomi.md b/stub-uploader/data/changelogs/pyvmomi.md index 861a7cc..6e6f7cb 100644 --- a/stub-uploader/data/changelogs/pyvmomi.md +++ b/stub-uploader/data/changelogs/pyvmomi.md @@ -1,3 +1,49 @@ +## 7.0.8.2 (2022-10-20) + +Remove `pyvmomi` from `pyright`'s exclude (#8943) + +## 7.0.8.1 (2022-10-15) + +Use `Incomplete` instead of `Any` in `__getattr__` (#8903) + +## 7.0.8 (2022-08-04) + +Various pyvmomi improvements (#8469) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 7.0.7 (2022-04-06) + +Update pyVmomi stubs (#7599) + +* Add generic base class `DynamicData` +* Add missing `key` prop to `OptionValue` +* Fix `MethodFault` not inheriting from `Exception` +* Fix `RetrieveOptions` default `maxObjects` type and default + +## 7.0.6 (2022-03-29) + +Add a few classes to vmodl and vmodl.fault (#7565) + +## 7.0.5 (2022-03-09) + +Remove Python 2 support from some third-party distributions (#7466) + +Co-authored-by: Alex Waygood + +## 7.0.4 (2022-01-31) + +Upgrade black version (#7089) + +## 7.0.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 7.0.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 7.0.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/pywin32.md b/stub-uploader/data/changelogs/pywin32.md new file mode 100644 index 0000000..cc46816 --- /dev/null +++ b/stub-uploader/data/changelogs/pywin32.md @@ -0,0 +1,28 @@ +## 304.0.0.4 (2022-11-05) + +pywin32: Improve some types (#9089) + +## 304.0.0.3 (2022-10-31) + +pywin32 stubs update (#9040) + +boolean methods +win32gui_struct +MonitorFromRect, FindWindow, FindWindowEx, GetWindowPlacement, GetMenuItemRect + +## 304.0.0.2 (2022-10-19) + +pywin32: Remove IID that doesn't exist at runtime (#8930) + +Remove IID that doesn't exist at runtime + +## 304.0.0.1 (2022-10-07) + +pywin32: Complete modules using stubgen & stubtest (#8866) + +Complete modules using stubgen & stubtest + +## 304.0.0.0 (2022-10-03) + +Add `pywin32` type stubs from microsoft/python-type-stubs and mhammond/pywin32 (#8825) + diff --git a/stub-uploader/data/changelogs/redis.md b/stub-uploader/data/changelogs/redis.md index 9749bf3..c4a318b 100644 --- a/stub-uploader/data/changelogs/redis.md +++ b/stub-uploader/data/changelogs/redis.md @@ -1,3 +1,383 @@ +## 4.3.21.3 (2022-10-21) + +Fixes redis.asyncio.client: `AsyncIterator` cannot be `async def` in stubs. (#8961) + +Without the `yield` statement in the method body, these are interpreted by mypy as coroutines that return an `AsyncIterator`. + +Closes #8960 + +## 4.3.21.1 (2022-10-03) + +Add `redis.asyncio.parser` (#8830) + +Source: https://github.com/redis/redis-py/blob/master/redis/asyncio/parser.py + +[redis] Improve `fail` parameter of `Retry.call_with_retry` (#8827) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Jelle Zijlstra + +[redis] Improve `redis.asyncio.lock` types (#8826) + +## 4.3.21 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 4.3.20 (2022-09-02) + +`redis`: Improve `kwargs` typing in `sentinel` (#8661) + +## 4.3.19 (2022-08-29) + +redis: Add `_Encodable` type alias (#8638) + +## 4.3.18 (2022-08-27) + +redis: Improve `ClusterPubSub` types (#8627) + +## 4.3.17 (2022-08-22) + +Update `redis/cluster.pyi` (#8593) + +`redis`: Do not override `AbstractRedis.RESPONSE_CALLBACKS` (#8592) + +## 4.3.16 (2022-08-21) + +Further improve `redis.cluster` (#8578) + +## 4.3.15 (2022-08-20) + +Improve `redis.cluster` types (#8573) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +`redis`: correct `set` command parameter types (#8536) + +## 4.3.14 (2022-08-10) + +Remove a few unused `TypedDict`s (#8522) + +## 4.3.13 (2022-08-01) + +redis.backoff: fix `cap` and `base` type (float) (#8454) + +## 4.3.12 (2022-07-30) + +Improve `redis.cluster` annotations (#8379) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 4.3.11 (2022-07-23) + +Improve `redis.crc` types (#8375) + +## 4.3.10 (2022-07-22) + +Improve `redis.utils` types (#8362) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 4.3.9 (2022-07-21) + +Improve `redis.retry` types (#8354) + +## 4.3.8 (2022-07-21) + +Annotate some `redis.backoff` items (#8352) + +## 4.3.7 (2022-07-20) + +Improve types of `redis.connection` module (#8342) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 4.3.6 (2022-07-19) + +Type async Pipeline commands explicitly (#8325) + +## 4.3.5 (2022-07-19) + +Improve `redis.sentinel` types (#8331) + +## 4.3.4 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 4.3.3 (2022-06-28) + +Update redis stubs to 4.3.4 (#8199) + +Fixes #8196 + +## 4.3.2 (2022-06-23) + +Improve `redis/asyncio/client.pyi` (#8141) + +## 4.3.1 (2022-06-21) + +Rename some confusingly named type aliases (#8129) + +## 4.3.0 (2022-06-20) + +Update redis stubs to 4.3 (#8108) + +## 4.2.8 (2022-06-18) + +redis: remove duplicate allowlist entries (#8097) + +Co-authored-by: hauntsaninja <> + +## 4.2.7 (2022-06-15) + +`redis`: fix more unconstrained `TypeVar`s (#8084) + +## 4.2.6 (2022-05-26) + +redis: Fix unconstrained TypeVars in a few redis commands (#7942) + +Part of #7928 + +## 4.2.5 (2022-05-21) + +Simplify and correct many numeric unions (#7906) + +Unblocks PyCQA/flake8-pyi#222 + +## 4.2.4 (2022-05-19) + +reds: commands from asyncio module must be async (#7820) + +redis-py has introduced an asyncio module since 4.2 and almost all +commands should be async if the redis.asyncio.Redis is used instead of +redis.Redis. + +This changes adds the types for all core commands. + +Related to #7597 + +## 4.2.3 (2022-05-15) + +Add `__version__`/`VERSION` to redis (#7838) + +## 4.2.2 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 4.2.1 (2022-05-04) + +Add missing redis modules and classes (#7676) + +This adds asyncio support and support for redis.typing. + +## 4.2.0 (2022-04-24) + +Update redis stubs to 4.2 (#7675) + +Closes #7597 + +## 4.1.22 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 4.1.21 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 4.1.20 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 4.1.19 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 4.1.18 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 4.1.17 (2022-02-23) + +Re-export RedisCluster from redis (#7371) + +## 4.1.16 (2022-02-17) + +Update to redis 4.1.4 (#7247) + +Closes: #7245 + +## 4.1.15 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 4.1.14 (2022-02-02) + +Redis: Annotate .lolwut() (#7104) + +## 4.1.13 (2022-01-31) + +Redis: Annotate .pttl(), .dump(), and .getdel() (#7091) + +## 4.1.12 (2022-01-31) + +Upgrade black version (#7089) + +## 4.1.11 (2022-01-28) + +Update redis stubs for 4.1.2 (#7064) + +## 4.1.10 (2022-01-19) + +Update redis stubs to 4.1.1 (#6960) + +Closes: #6951 + +## 4.1.9 (2022-01-19) + +Revert "Temporarily fix redis version to 4.1.0" (#6957) + +This reverts commit 7d2de33bba2808e98b3caa46904418ad9a1b07f5. + +Temporarily fix redis version to 4.1.0 (#6952) + +Quick fix for #6951 + +## 4.1.8 (2022-01-13) + +Annotate command kwargs arguments (#6721) + +## 4.1.7 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 4.1.6 (2022-01-09) + +put redis.client._ScoreCastFuncReturn back (#6876) + +#6829 removed it as unused but #6790 added a usage. + +Minor improvements to redis stubs for scan and zset methods (#6790) + +## 4.1.5 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 4.1.3 (2022-01-05) + +Remove several unused `TypeVar`s (#6829) + +## 4.1.2 (2022-01-02) + +Never explicitly inherit from `object` in Python 3-only stubs (#6777) + +## 4.1.1 (2021-12-28) + +redis: Restore type annotations of ping() and save() (#6720) + +Use PEP 585 syntax wherever possible (#6717) + +## 4.1.0 (2021-12-27) + +Update redis stubs to 4.1 (#6711) + +Co-authored-by: Akuli +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 4.0.6 (2021-12-25) + +redis: Add stubs for lmove and blmove (#6586) + +## 4.0.5 (2021-12-21) + +Fix Redis.zpopmin and zpopmax (#6642) + +Co-authored-by: Sebastian Rittau + +## 4.0.4 (2021-12-17) + +Always import Protocol from typing in stubs (#6617) + +## 4.0.3 (2021-12-01) + +Fix various issues in redis.client (#6464) + +## 4.0.2 (2021-12-01) + +redis: fix several stubtest warnings (#6378) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> +Co-authored-by: Jelle Zijlstra + +## 4.0.1 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 4.0.0 (2021-11-25) + +Update redis stubs to version 4 (#6368) + +## 3.5.18 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 3.5.17 (2021-11-18) + +Revert "do not use mypy-specific syntax in '# type: ignore' comments" (#6338) + +## 3.5.16 (2021-11-12) + +Redis Sentinel master_for, slave_for returns a Redis client (#6269) + +## 3.5.15 (2021-10-16) + +Annotate Client.decr() and decrby() (#6179) + +## 3.5.14 (2021-10-15) + +Add redis/sentinel.pyi (#6174) + +## 3.5.13 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 3.5.12 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.5.11 (2021-10-09) Add Redis.memory_purge() (#6138) diff --git a/stub-uploader/data/changelogs/regex.md b/stub-uploader/data/changelogs/regex.md new file mode 100644 index 0000000..e5f30c9 --- /dev/null +++ b/stub-uploader/data/changelogs/regex.md @@ -0,0 +1,84 @@ +## 2022.10.31.0 (2022-11-01) + +[stubsabot] Bump regex to 2022.10.31 (#9050) + +Release: https://pypi.org/pypi/regex/2022.10.31 +Homepage: https://github.com/mrabarnett/mrab-regex +Diff: https://github.com/mrabarnett/mrab-regex/compare/2022.9.13...2022.10.31 + +Stubsabot analysis of the diff between the two releases: + - Total lines of Python code added: 3. + - Total lines of Python code deleted: 2. + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 2022.9.13.0 (2022-09-16) + +[stubsabot] Bump regex to 2022.9.13 (#8751) + +Release: https://pypi.org/project/regex/2022.9.13/ +Homepage: https://github.com/mrabarnett/mrab-regex +Diff: https://github.com/mrabarnett/mrab-regex/compare/2022.8.17...2022.9.13 + +## 2022.8.17.0 (2022-08-19) + +[stubsabot] Bump regex to 2022.8.17 (#8562) + +Co-authored-by: stubsabot <> + +## 2022.7.25.0 (2022-07-29) + +[stubsabot] Bump regex to 2022.7.25 (#8432) + +Co-authored-by: stubsabot <> + +## 2022.7.9.0 (2022-07-15) + +[stubsabot] Bump regex to 2022.7.9 (#8300) + +Co-authored-by: hauntsaninja <> + +## 2022.6.2.0 (2022-06-26) + +Bump regex to 2022.6.2 (#8162) + +Co-authored-by: AlexWaygood + +## 2021.11.10.6 (2022-06-21) + +`requests`, `regex`: use re-exports instead of assignments in a few places (#8127) + +## 2021.11.10.5 (2022-05-11) + +regex: accept buffers (#7680) + +Similar to #7679 + +Co-authored-by: Alex Waygood +Co-authored-by: Akuli + +## 2021.11.10.4 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2021.11.10.3 (2022-02-23) + +regex stubs: Add __getitem__ method to Match (#7372) + +## 2021.11.10.2 (2022-01-07) + +Update pyright (#6840) + +## 2021.11.10.0 (2021-12-30) + +Add regex stubs (#6713) + +Co-authored-by: Alex Waygood +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/requests.md b/stub-uploader/data/changelogs/requests.md index 3c9a189..c57352f 100644 --- a/stub-uploader/data/changelogs/requests.md +++ b/stub-uploader/data/changelogs/requests.md @@ -1,3 +1,330 @@ +## 2.28.11.2 (2022-10-07) + +Mark `requests` stubs as complete (#8858) + +Co-authored-by: Kevin Kirsche + +## 2.28.11.1 (2022-10-04) + +`requests`: Add regression test for #8762 (#8835) + +The final mypy_primer report for #8762 was an empty diff. Considering the number of issues we've had with our requests stubs over the last year, it feels like it makes sense to add a test case to make sure that it doesn't regress. + +## 2.28.11 (2022-09-22) + +`requests`: improve `_Data` type (#8762) + +requests: improve _Data type + +This allows to pass an Iterable[bytes] for streaming request data. + +## 2.28.10 (2022-09-08) + +Add infrastructure allowing for test cases for third-party stubs (#8700) + +- Move the logic for running mypy on the test cases from `tests/mypy_test.py` to a separate script, `tests/regr_test.py`. +- Add the necessary logic in order to be able to have test cases for third-party stubs. +- Move logic common to `tests/mypy_test.py` and `tests/regr_test.py` into `tests/colors.py`, and rename `tests/colors.py` to `tests/utils.py`. +- Add a new check to `tests/check_consistent.py`, to enforce the use of `# pyright: reportUnnecessaryTypeIgnoreComment=true` comments in third-party test cases. These are essential if we want to have our tests against false-negatives work with pyright. +- Update the relevant documentation to account for the new test file. +- Add a new job to the `tests.yml` GitHub workflow, to run the new test in CI. +- Add a simple proof-of-concept test case for `requests`, as a regression test for #7998. + +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau + +## 2.28.9 (2022-08-18) + +Support extras in stubtest_third_party.py (#8467) + +## 2.28.8 (2022-08-05) + +`requests.adapters`: use re-exports rather than assignments (#8485) + +Add `requests.help` submodule (#8486) + +Add `requests.__version__`; improve `requests.__init__` (#8484) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 2.28.7 (2022-08-02) + +requests: fix stubtest (#8463) + +## 2.28.6 (2022-07-30) + +Remove or move several `TypeAlias` declarations (#8444) + +## 2.28.5 (2022-07-26) + +requests: add type hints to requests.utils (#8395) + +Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> + +## 2.28.4 (2022-07-25) + +Add missing re-exports and vars to requests.compat (#8396) + +## 2.28.3 (2022-07-21) + +requests: add annotation for `parse_header_links` (#8349) + +In the requests package the function `utils.parse_header_links()` +takes a str as input and returns a list of dictionaries. + +This can be seen in the unit tests that are used: +https://github.com/psf/requests/blob/786255613bd92f87c9c8f066c4271aab1b9eeaad/tests/test_utils.py#L644-L664 + +## 2.28.2 (2022-07-18) + +`requests`: Annotate `Session.merge_environment_settings` (#8313) + +Co-authored-by: Alex Waygood + +## 2.28.1 (2022-07-12) + +Turn requests.requests.packages into a module (#8281) + +Remove obsolete class VendorAlias + +## 2.28.0 (2022-06-25) + +[stubsabot] Bump requests to 2.28.* (#8152) + +Co-authored-by: hauntsaninja <> + +## 2.27.31 (2022-06-21) + +`requests`, `regex`: use re-exports instead of assignments in a few places (#8127) + +## 2.27.30 (2022-06-01) + +requests: expand types for files (#7999) + +## 2.27.29 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 2.27.28 (2022-05-26) + +requests: allow immutable headers (#7932) + +## 2.27.27 (2022-05-19) + +Fix requests.Session().hooks (#7871) + +Fixes #7776 + +Mutating hooks, as in `session.hooks['response'] = ...`, should work. Reassigning it like `session.hooks = ...` is probably a bad idea, so it will always be a `dict`. + +## 2.27.26 (2022-05-16) + +`requests`: Fix type of request headers (#7773) + +Allow bytes values. In `Session` methods, `None` can be used to ignore the session's headers. + +## 2.27.25 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 2.27.24 (2022-04-28) + +requests: allow non-mutable Mapping for files/hooks parameters (#7732) + +## 2.27.23 (2022-04-28) + +requests: allow str and bytes for fileobj in files parameter (#7728) + +* requests: allow str and bytes for fileobj in files parameter + +* requests: Use SupportsRead instead of IO for files + +## 2.27.22 (2022-04-27) + +requests: Add None to a type alias (#7721) + +Fixes #7720 + +## 2.27.21 (2022-04-27) + +Add more typing hints for requests (#7696) + +Co-authored-by: Alex Waygood +Co-authored-by: Akuli + +## 2.27.20 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 2.27.19 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.27.18 (2022-04-16) + +Use imports instead of TypeAliases in a couple places (#7634) + +Fixes #7632 + +## 2.27.17 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +Use str instead of typing.Text (#7629) + +## 2.27.16 (2022-04-01) + +Third-party stubs: Improve several `__exit__` methods (#7575) + +## 2.27.15 (2022-03-27) + +requests: Update adapters.pyi (#7544) + +The cert can be +* A string / bytes which is a path to a certfile +* A tuple with two string / bytes, where the first is the certfile and the second is a keyfile +* None (optional) + +The tuple could be anything indexable, but there are strict requirement to actualle have two items, don't know if there is something more generic + +See https://github.com/psf/requests/blob/main/requests/adapters.py#L242-L248 + +## 2.27.14 (2022-03-19) + +PEP 604: Remove some more uses of Union/Optional (#7515) + +The following patterns still break mypy: + +1. `type[]` at top level fails +2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine) +3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9 + +This PR cleans up usage of `Union` and `Optional` outside these patterns. + +## 2.27.13 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 2.27.12 (2022-03-13) + +`requests` stubs are not Python 2-compatible (#7483) + +## 2.27.11 (2022-02-22) + +Correct several positional-only differences in third-party stubs (#7352) + +## 2.27.10 (2022-02-16) + +Remove unused allowlist entries in `babel` and `requests` (#7233) + +## 2.27.9 (2022-02-09) + +Added missing import for JSONDecodeError (#7171) + +Co-authored-by: DataGhost + +## 2.27.8 (2022-01-31) + +requests.Session: Accept hooks and lists of hooks (#7094) + +## 2.27.7 (2022-01-13) + +requests: remove an unused allowlist entry (#6911) + +## 2.27.6 (2022-01-12) + +requests: Remove an unused allowlist entry (#6897) + +## 2.27.5 (2022-01-10) + +Always use `_typeshed.Self`, where applicable (#6880) + +* Always use `_typeshed.Self`, where applicable + +* Revert changes to `google-cloud-ndb` (ambiguous) + +* Remove empty line added by script + +* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi` + +* Manually add a few more that the script missed + +* Improve `filelock` annotation + +Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207 + +* Improve `opentracing/scope` annotation + +Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71 + +* Improve `redis/client` stub + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217 + +* Improve `redis/lock` annotation + +Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155 + +* Improve `requests/models` annotation + +Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653 + +## 2.27.4 (2022-01-10) + +Remove unused `requests` allowlist entry (#6882) + +## 2.27.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +Use types-urllib3 for requests (#6859) + +## 2.27.2 (2022-01-07) + +Update pyright (#6840) + +## 2.27.0 (2022-01-07) + +requests: Add JSONDecodeError (#6838) + +## 2.26.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.26.2 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 2.26.1 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 2.26.0 (2021-11-10) + +Add some kwonly arguments to Session.send() (#6266) + +Bump version to 2.26 + +## 2.25.12 (2021-11-09) + +Remove BaseAdapter from requests.sessions (#6264) + +## 2.25.11 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.25.10 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2.25.9 (2021-09-25) requests: Response.encoding can be None (#6067) diff --git a/stub-uploader/data/changelogs/retry.md b/stub-uploader/data/changelogs/retry.md index e938f54..ab06a6f 100644 --- a/stub-uploader/data/changelogs/retry.md +++ b/stub-uploader/data/changelogs/retry.md @@ -1,3 +1,41 @@ +## 0.9.9 (2022-07-20) + +Allowlist useless modules (#8340) + +These are the ones I chose not to add from #8321 + +Fixes most of #8339 + +## 0.9.8 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.9.7 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.9.6 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 0.9.5 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.9.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.9.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 0.9.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 0.9.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/selenium.md b/stub-uploader/data/changelogs/selenium.md new file mode 100644 index 0000000..3b2e276 --- /dev/null +++ b/stub-uploader/data/changelogs/selenium.md @@ -0,0 +1,24 @@ +## 3.141.9 (2022-03-06) + +Upgrade to stubtest with dunder pos only reverted (#7442) + +## 3.141.8 (2022-02-25) + +Mark selenium stubs as obsolete (#7383) + +## 3.141.6 (2021-12-21) + +Fix return type of find_elements* (#6645) + +## 3.141.5 (2021-12-21) + +Update Selenium webdriver with latest return types (#6565) + +## 3.141.4 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 3.141.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/setuptools.md b/stub-uploader/data/changelogs/setuptools.md index 8ae8c49..dfec4d2 100644 --- a/stub-uploader/data/changelogs/setuptools.md +++ b/stub-uploader/data/changelogs/setuptools.md @@ -1,3 +1,190 @@ +## 65.5.0.2 (2022-10-24) + +Fix `pkg_resources.split_sections` (#8975) + +This function is currently documented as returning a list of lines as +the 2nd pair value. It does not return plain str here. + +## 65.5.0.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 65.5.0.0 (2022-10-15) + +[stubsabot] Bump setuptools to 65.5.* (#8900) + +Release: https://pypi.org/pypi/setuptools/65.5.0 +Homepage: https://github.com/pypa/setuptools +Changelog: https://setuptools.pypa.io/en/stable/history.html +Diff: https://github.com/pypa/setuptools/compare/v65.4.1...v65.5.0 + +Stubsabot analysis of the diff between the two releases: + - 0 public Python files have been added. + - 0 files included in typeshed's stubs have been deleted. + - 4 files included in typeshed's stubs have been modified or renamed: `setuptools/build_meta.py`, `setuptools/command/test.py`, `setuptools/monkey.py`, `setuptools/wheel.py`. + - Total lines of Python code added: 111. + - Total lines of Python code deleted: 59. + +If stubtest fails for this PR: +- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) +- Fix stubtest failures in another PR, then close this PR + +Note that you will need to close and re-open the PR in order to trigger CI + +Co-authored-by: stubsabot <> + +## 65.4.0.0 (2022-09-30) + +[stubsabot] Bump setuptools to 65.4.* (#8811) + +Release: https://pypi.org/pypi/setuptools/65.4.0 +Homepage: https://github.com/pypa/setuptools +Changelog: https://setuptools.pypa.io/en/stable/history.html +Diff: https://github.com/pypa/setuptools/compare/v65.3.0...v65.4.0 + +## 65.3.0 (2022-08-26) + +[stubsabot] Bump setuptools to 65.3.* (#8620) + +## 65.1.0 (2022-08-19) + +Update setuptools to 65.1.* (#8565) + +Fixes #8563 + +## 64.0.1 (2022-08-13) + +setuptools: fix stubtest (#8540) + +Fixes #8539 + +## 64.0.0 (2022-08-12) + +[stubsabot] Bump setuptools to 64.0.* (#8534) + +## 63.4.1 (2022-08-11) + +setuptools: delete _distutils.command.check.HAS_DOCUTILS (#8529) + +Fixes #8527 + +## 63.4.0 (2022-08-05) + +[stubsabot] Bump setuptools to 63.4.* (#8493) + +Co-authored-by: stubsabot <> + +## 63.2.3 (2022-08-03) + +Remove redundant `__str__` methods (#8475) + +## 63.2.2 (2022-07-28) + +Fix todo in setuptools.command.test (#8416) + +With https://github.com/python/mypy/pull/10884 merged and released, this should be safe to re-enable per the todo comment. + +https://github.com/pypa/setuptools/blob/main/setuptools/command/test.py#L117 + +## 63.2.1 (2022-07-20) + +Update setuptools stubs (#8345) + +setuptools now vendors `distutils` as `setuptools._distutils`. + +## 63.2.0 (2022-07-15) + +[stubsabot] Bump setuptools to 63.2.* (#8301) + +Co-authored-by: hauntsaninja <> + +## 62.6.1 (2022-07-11) + +Remove Python 3.6 branches from typeshed (#8269) + +## 62.6.0 (2022-07-08) + +[stubsabot] Bump setuptools to 62.6.* (#8224) + +Most of setuptools.config is not included as the module is deprecated. + +## 57.4.18 (2022-06-26) + +Third-party stubs: audit `Callable[, None]` annotations (#8175) + +## 57.4.17 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 57.4.16 (2022-05-25) + +pkg_resources: Fix unconstrained TypeVars (#7941) + +https://github.com/pypa/setuptools/blob/499c468a57d240e5bb450bdb6daedc3e559541dd/pkg_resources/__init__.py#L1049 + +Part of #7928 + +## 57.4.15 (2022-05-22) + +More setuptools.command.easy_install definitions. (#7145) + +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 57.4.14 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 57.4.13 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 57.4.12 (2022-04-05) + +Mark many attributes as read-only properties (#7591) + +## 57.4.11 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 57.4.10 (2022-03-08) + +Widen the `cmdclass` parameter of `setuptools.setup` (#7458) + +## 57.4.9 (2022-02-07) + +Improve some in-place BinOp methods (#7149) + +## 57.4.8 (2022-01-30) + +Reduce use of `Any` in equality methods (#7081) + +Co-authored-by: Akuli + +## 57.4.7 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 57.4.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 57.4.4 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 57.4.3 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 57.4.2 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 57.4.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 57.4.0 (2021-09-19) Add setuptools stubs (#5762) diff --git a/stub-uploader/data/changelogs/simplejson.md b/stub-uploader/data/changelogs/simplejson.md new file mode 100644 index 0000000..2e0a4e0 --- /dev/null +++ b/stub-uploader/data/changelogs/simplejson.md @@ -0,0 +1,28 @@ +## 3.17.7.1 (2022-10-20) + +Remove `simplejson` from `pyright`'s exclude (#8945) + +## 3.17.7 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 3.17.6 (2022-04-27) + +Remove Python 2 support from simplejson (#7704) + +## 3.17.5 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 3.17.4 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 3.17.2 (2021-12-05) + +Create simplejson.errors (#6492) + +## 3.17.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/singledispatch.md b/stub-uploader/data/changelogs/singledispatch.md index 43b8351..c5b81df 100644 --- a/stub-uploader/data/changelogs/singledispatch.md +++ b/stub-uploader/data/changelogs/singledispatch.md @@ -1,3 +1,23 @@ +## 3.7.5 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 3.7.4 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 3.7.3 (2022-02-12) + +singledispatch: fix lint (#7178) + +Co-authored-by: hauntsaninja <> + +Add singledispatchmethod to singledispatch (#6089) + +## 3.7.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.7.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/six.md b/stub-uploader/data/changelogs/six.md new file mode 100644 index 0000000..6d52630 --- /dev/null +++ b/stub-uploader/data/changelogs/six.md @@ -0,0 +1,96 @@ +## 1.16.21.1 (2022-11-03) + +Update pyright to 1.1.278 (#9077) + +Co-authored-by: Alex Waygood + +## 1.16.21 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 1.16.20 (2022-09-25) + +six: Remove unused `__future__` import (#8790) + +## 1.16.19 (2022-08-23) + +`six`: Fix incorrect `type[type[Any]]` annotation (#8599) + +Mypy will (correctly, I think) start flagging `type[type[Any]]` as an illegal annotation when mypy 0.980 comes out. Let's fix it now, before it comes out. + +## 1.16.18 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 1.16.17 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 1.16.16 (2022-06-13) + +Use `_typeshed.IdentityFunction` more consistently (#8063) + +## 1.16.15 (2022-04-13) + +Add back six.moves.http_cookies.Morsel (#7617) + +## 1.16.14 (2022-04-13) + +Add back six.moves.configparser.Error (#7616) + +## 1.16.13 (2022-04-12) + +Add missing definitions to six.moves.http_client (#7615) + +These were removed as a side-effect of #7327, which added +`__all__` to `http.client`. I checked that all the definitions +are present at runtime via `six.moves.http_client`. + +## 1.16.12 (2022-03-09) + +Remove Python 2 support from some third-party distributions (#7466) + +Co-authored-by: Alex Waygood + +## 1.16.11 (2022-03-01) + +Add six.create_bound_method dunders to allowlist (#7409) + +Closes: #7404 + +## 1.16.10 (2022-01-19) + +Use PEP 585 syntax in Python 2, `protobuf` & `_ast` stubs, where possible (#6949) + +## 1.16.9 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 1.16.7 (2022-01-03) + +Add six.moves.copyreg six stubs (#6793) + +## 1.16.6 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.16.5 (2021-12-27) + +Enable stubtest for six (#6699) + +## 1.16.4 (2021-12-25) + +Add a 'stubtest' flag to METADATA.toml (#6687) + +Co-authored-by: Akuli + +## 1.16.3 (2021-11-28) + +dummy_thread/ing: remove in 3.9 (#6408) + +https://bugs.python.org/issue37312 + +## 1.16.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/slumber.md b/stub-uploader/data/changelogs/slumber.md new file mode 100644 index 0000000..3bbf7f4 --- /dev/null +++ b/stub-uploader/data/changelogs/slumber.md @@ -0,0 +1,10 @@ +## 0.7.3 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.7.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/stdlib-list.md b/stub-uploader/data/changelogs/stdlib-list.md new file mode 100644 index 0000000..02078f8 --- /dev/null +++ b/stub-uploader/data/changelogs/stdlib-list.md @@ -0,0 +1,26 @@ +## 0.8.3 (2022-07-20) + +Allowlist useless modules (#8340) + +These are the ones I chose not to add from #8321 + +Fixes most of #8339 + +## 0.8.2 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 0.8.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 0.8.0 (2022-04-08) + +Add stubs for stdlib-list (#7608) + diff --git a/stub-uploader/data/changelogs/stripe.md b/stub-uploader/data/changelogs/stripe.md new file mode 100644 index 0000000..d742d7e --- /dev/null +++ b/stub-uploader/data/changelogs/stripe.md @@ -0,0 +1,70 @@ +## 3.5.2.1 (2022-10-31) + +stripe: test clocks resource (#9026) + +Co-authored-by: Alex Waygood + +## 3.5.2 (2022-09-13) + +`stripe`: Add `SearchableAPIResource`, `SearchResultObject` (#8696) + +## 3.5.1 (2022-08-08) + +Add classmethod to stripe.PaymentIntent.confirm. (#8498) + +Signed-off-by: Zixuan James Li + +## 3.5.0 (2022-07-01) + +[stubsabot] Bump stripe to 3.5.* (#8223) + +Co-authored-by: hauntsaninja <> + +[stubsabot] Bump stripe to 3.4.* (#8212) + +Co-authored-by: hauntsaninja <> + +## 2.59.10 (2022-06-03) + +`stripe`: update a few signatures (#7978) + +Co-authored-by: Alex Waygood + +## 2.59.9 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 2.59.8 (2022-02-28) + +Add stripe.util.convert_to_stripe_object (#7386) + +## 2.59.7 (2022-02-25) + +Improve annotation for stripe DeletableAPIResource delete method (#7230) + +## 2.59.6 (2022-02-07) + +Improve a bunch of `__(deep)copy__` methods (#7148) + +## 2.59.5 (2022-01-31) + +Upgrade black version (#7089) + +## 2.59.3 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.59.2 (2021-12-21) + +add stripe.util.populate_headers (#6637) + +fill out api methods for stripe.Customer (#6638) + +fill out api stubs for stripe.Account (#6639) + +fill out api stubs for stripe.SubscriptionItem (#6640) + +## 2.59.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/tabulate.md b/stub-uploader/data/changelogs/tabulate.md new file mode 100644 index 0000000..febd14a --- /dev/null +++ b/stub-uploader/data/changelogs/tabulate.md @@ -0,0 +1,38 @@ +## 0.9.0.0 (2022-10-07) + +Bump tabulate to `0.9` version (#8865) + +## 0.8.11 (2022-06-25) + +appdirs, tabulate, termcolor, xmltodict: check missing defs (#8156) + +complete termcolor, xmltodict + +## 0.8.10 (2022-06-22) + +tabulate: Add maxcolwidths arguments (#8132) + +## 0.8.9 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.8.8 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 0.8.7 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.8.6 (2022-03-16) + +Use PEP 604 syntax wherever possible (#7493) + +## 0.8.4 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.8.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/termcolor.md b/stub-uploader/data/changelogs/termcolor.md new file mode 100644 index 0000000..72f9e7e --- /dev/null +++ b/stub-uploader/data/changelogs/termcolor.md @@ -0,0 +1,28 @@ +## 1.1.6 (2022-09-16) + +[stubsabot] Mark termcolor as obsolete since 2.0.0 (#8746) + +* [stubsabot] Mark termcolor as obsolete since 2.0.0 + +Release: https://pypi.org/project/termcolor/2.0.1/ +Homepage: https://github.com/termcolor/termcolor +Changelog: https://github.com/termcolor/termcolor/releases +Diff: https://github.com/termcolor/termcolor/compare/1.1.0...2.0.1 + +Co-authored-by: Alex Waygood +Co-authored-by: Sebastian Rittau + +## 1.1.5 (2022-06-25) + +appdirs, tabulate, termcolor, xmltodict: check missing defs (#8156) + +complete termcolor, xmltodict + +## 1.1.4 (2022-04-27) + +Drop support for Python 2 in termcolor (#7707) + +## 1.1.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/toml.md b/stub-uploader/data/changelogs/toml.md index d909b6a..770b1d3 100644 --- a/stub-uploader/data/changelogs/toml.md +++ b/stub-uploader/data/changelogs/toml.md @@ -1,3 +1,33 @@ +## 0.10.8 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 0.10.7 (2022-05-07) + +Import generics from standard modules in all third-party stubs (#7791) + +## 0.10.6 (2022-04-27) + +Remove Python 2 support from toml (#7713) + +## 0.10.5 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 0.10.4 (2022-02-10) + +Improve `toml` typings (#7146) + +Co-authored-by: Akuli + +## 0.10.3 (2022-01-08) + +Use lowercase `type` everywhere (#6853) + +## 0.10.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 0.10.0 (2021-09-19) Update third-party package versions (#5996) diff --git a/stub-uploader/data/changelogs/toposort.md b/stub-uploader/data/changelogs/toposort.md index 0a180ba..4468e77 100644 --- a/stub-uploader/data/changelogs/toposort.md +++ b/stub-uploader/data/changelogs/toposort.md @@ -1,3 +1,25 @@ +## 1.7.4 (2022-06-25) + +ujson, pyfarmhash, toposort: check for missing definitions (#8153) + +Co-authored-by: hauntsaninja <> + +## 1.7.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.7.1 (2021-12-17) + +Always import Protocol from typing in stubs (#6617) + +## 1.7.0 (2021-12-07) + +toposort: Make argument types less restrictive (#6531) + +## 1.6.1 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 1.6.0 (2021-09-19) Create stubs for toposort (#6048) diff --git a/stub-uploader/data/changelogs/tqdm.md b/stub-uploader/data/changelogs/tqdm.md new file mode 100644 index 0000000..529242a --- /dev/null +++ b/stub-uploader/data/changelogs/tqdm.md @@ -0,0 +1,43 @@ +## 4.64.7.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 4.64.7 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 4.64.6 (2022-08-24) + +tqdm: All `leave` arguments can be `None` (#8603) + +All `leave` arguments are optional in tqdm. + +## 4.64.5 (2022-08-18) + +Support extras in stubtest_third_party.py (#8467) + +## 4.64.4 (2022-07-15) + +`tqdm`: Add `__all__` to `__init__.pyi` and submodules (#8308) + +Fixes #8307 + +## 4.64.3 (2022-07-15) + +`tqdm`: Improve a few `__init__` methods (#8246) + +## 4.64.2 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 4.64.1 (2022-07-07) + +Improve `tqdm.contrib.logging` context managers (#8251) + +## 4.64.0 (2022-07-05) + +Add stubs for `tqdm` (#8235) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + diff --git a/stub-uploader/data/changelogs/tree-sitter-languages.md b/stub-uploader/data/changelogs/tree-sitter-languages.md new file mode 100644 index 0000000..da0f44c --- /dev/null +++ b/stub-uploader/data/changelogs/tree-sitter-languages.md @@ -0,0 +1,18 @@ +## 1.5.0 (2022-09-16) + +[stubsabot] Bump tree-sitter-languages to 1.5.* (#8750) + +Release: https://pypi.org/project/tree-sitter-languages/1.5.0/ +Homepage: https://github.com/grantjenks/py-tree-sitter-languages +Diff: https://github.com/grantjenks/py-tree-sitter-languages/compare/v1.4.0...v1.5.0 + +## 1.4.0 (2022-08-26) + +[stubsabot] Bump tree-sitter-languages to 1.4.* (#8623) + +## 1.3.0 (2022-08-17) + +Add stubs for tree-sitter-languages (#8548) + +Co-authored-by: Alex Waygood + diff --git a/stub-uploader/data/changelogs/tree-sitter.md b/stub-uploader/data/changelogs/tree-sitter.md new file mode 100644 index 0000000..816e006 --- /dev/null +++ b/stub-uploader/data/changelogs/tree-sitter.md @@ -0,0 +1,17 @@ +## 0.20.1.1 (2022-10-24) + +Remove `tree-sitter` from `pyright`'s exclude (#8946) + +Co-authored-by: Akuli + +## 0.20.1 (2022-09-06) + +tree-sitter: add missing members (#8693) + +## 0.20.0 (2022-08-17) + +Add stubs for tree_sitter (#8533) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra + diff --git a/stub-uploader/data/changelogs/ttkthemes.md b/stub-uploader/data/changelogs/ttkthemes.md index ca7c6a3..d96d405 100644 --- a/stub-uploader/data/changelogs/ttkthemes.md +++ b/stub-uploader/data/changelogs/ttkthemes.md @@ -1,3 +1,11 @@ +## 3.2.3 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 3.2.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 3.2.1 (2021-09-20) ttkthemes: allow constructing ThemedStyle with no arguments (#6046) diff --git a/stub-uploader/data/changelogs/typed-ast.md b/stub-uploader/data/changelogs/typed-ast.md new file mode 100644 index 0000000..fd0090e --- /dev/null +++ b/stub-uploader/data/changelogs/typed-ast.md @@ -0,0 +1,56 @@ +## 1.5.8.2 (2022-11-07) + +Mark typed_ast as completed (#9121) + +## 1.5.8.1 (2022-10-28) + +typed-ast: fix get_docstring, allow buffer (#9019) + +## 1.5.8 (2022-08-29) + +`typed_ast.ast3`: `arguments.kw_defaults` should be `list[expr | None]` (#8645) + +```python +>>> from typed_ast import ast3 +>>> print(ast3.dump(ast3.parse('def foo(*, arg: int) -> None: ...'))) +Module(body=[FunctionDef(name='foo', args=arguments(args=[], vararg=None, kwonlyargs=[arg(arg='arg', annotation=Name(id='int', ctx=Load()), type_comment=None)], kw_defaults=[None], kwarg=None, defaults=[]), body=[Expr(value=Ellipsis())], decorator_list=[], returns=NameConstant(value=None), type_comment=None)], type_ignores=[]) +``` + +This bug was discovered in https://github.com/python/mypy/pull/13547 + +## 1.5.7 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 1.5.6 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 1.5.5 (2022-05-21) + +Simplify and correct many numeric unions (#7906) + +Unblocks PyCQA/flake8-pyi#222 + +## 1.5.4 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 1.5.3 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.5.1 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 1.5.0 (2021-11-12) + +Bump typed-ast version, recommend Python 3.8 for tests (#6278) + +## 1.4.5 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + diff --git a/stub-uploader/data/changelogs/tzlocal.md b/stub-uploader/data/changelogs/tzlocal.md new file mode 100644 index 0000000..94488ca --- /dev/null +++ b/stub-uploader/data/changelogs/tzlocal.md @@ -0,0 +1,47 @@ +## 4.2.2.1 (2022-10-23) + +Remove tzlocal from pyright's exclude (#8969) + +## 4.2.2 (2022-07-20) + +Allowlist useless modules (#8340) + +These are the ones I chose not to add from #8321 + +Fixes most of #8339 + +## 4.2.1 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 4.2.0 (2022-06-26) + +[stubsabot] Bump tzlocal to 4.2 (#8184) + +Co-authored-by: hauntsaninja <> + +## 4.1.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 4.1.0 (2022-01-14) + +Add get_localzone_name to tzlocal (#6912) + +## 3.0.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/ujson.md b/stub-uploader/data/changelogs/ujson.md new file mode 100644 index 0000000..23f1ec5 --- /dev/null +++ b/stub-uploader/data/changelogs/ujson.md @@ -0,0 +1,41 @@ +## 5.5.0 (2022-09-16) + +[stubsabot] Bump ujson to 5.5.* (#8749) + +Release: https://pypi.org/project/ujson/5.5.0/ +Homepage: https://github.com/ultrajson/ultrajson +Diff: https://github.com/ultrajson/ultrajson/compare/5.4.0...5.5.0 + +## 5.4.0 (2022-07-08) + +[stubsabot] Bump ujson to 5.4.* (#8259) + +Co-authored-by: hauntsaninja <> + +## 5.3.1 (2022-06-25) + +ujson, pyfarmhash, toposort: check for missing definitions (#8153) + +Co-authored-by: hauntsaninja <> + +## 5.3.0 (2022-06-14) + +[stubsabot] Bump ujson to 5.3.* (#8078) + +Co-authored-by: hauntsaninja <> + +## 5.2.0 (2022-05-30) + +ujson: add JSONDecodeError (#7988) + +## 4.2.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/urllib3.md b/stub-uploader/data/changelogs/urllib3.md new file mode 100644 index 0000000..8786ace --- /dev/null +++ b/stub-uploader/data/changelogs/urllib3.md @@ -0,0 +1,119 @@ +## 1.26.25.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 1.26.25 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 1.26.24 (2022-09-08) + +Fix urllib3.response.HTTPResponse.geturl() return type (#8704) + +urllib3.response.HTTPResponse.geturl() return should be `str | None`. + +Source: https://github.com/urllib3/urllib3/blob/3951d3cf8f8c8119c455ce50c171dc0ca50cb130/src/urllib3/response.py#L416-L417 + +## 1.26.23 (2022-08-18) + +Support extras in stubtest_third_party.py (#8467) + +## 1.26.22 (2022-08-04) + +Add `urllib3.contrib.socks`; improve `urllib3.connectionpool` (#8457) + +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Co-authored-by: Alex Waygood + +## 1.26.21 (2022-08-03) + +Improve urllib3.util.url annotations (#8460) + +## 1.26.20 (2022-08-01) + +Improve `urllib3.fields` annotations (#8456) + +Co-authored-by: Alex Waygood + +## 1.26.19 (2022-07-30) + +Add annotations to `urrlib3.util.url` (#8448) + +## 1.26.18 (2022-07-30) + +Remove or move several `TypeAlias` declarations (#8444) + +## 1.26.17 (2022-07-26) + +Add more urllib3.__init__ annotations (#8402) + +## 1.26.16 (2022-07-06) + +Annotate `urllib3.disable_warnings` (#8245) + +## 1.26.15 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 1.26.14 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 1.26.13 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 1.26.12 (2022-04-16) + +Use `TypeAlias` where possible for type aliases (#7630) + +## 1.26.11 (2022-03-13) + +urllib3: stubs are not Python 2 compatible (#7480) + +They use http.client, which is Python 3-only. Another catch from #7478. + +## 1.26.10 (2022-02-28) + +Add DEFAULT_CIPHERS to urllib3.util.ssl_ (#7399) + +## 1.26.9 (2022-02-03) + +Improve `__enter__` & constructor methods (#7114) + +## 1.26.8 (2022-01-31) + +Upgrade black version (#7089) + +## 1.26.7 (2022-01-13) + +urllib3: allow allowed_methods to be False (#6909) + +## 1.26.5 (2022-01-12) + +Update types in urllib3.util.retry (#6892) + +## 1.26.4 (2022-01-11) + +urllib3: add "__version__" (#6890) + +Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> + +## 1.26.3 (2022-01-10) + +Fix urllib3.util.Retry.sleep type (#6883) + +## 1.26.2 (2022-01-09) + +Annotate urllib3.exceptions (#6865) + +Annotate urllib3.response (#6871) + +## 1.26.1 (2022-01-08) + +Use types-urllib3 for requests (#6859) + +Add urllib3 stubs (#6858) + diff --git a/stub-uploader/data/changelogs/vobject.md b/stub-uploader/data/changelogs/vobject.md new file mode 100644 index 0000000..a319a0e --- /dev/null +++ b/stub-uploader/data/changelogs/vobject.md @@ -0,0 +1,32 @@ +## 0.9.8.2 (2022-11-07) + +Mark `vobject` as complete (#9120) + +## 0.9.8.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 0.9.8 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.9.7 (2022-01-31) + +Upgrade black version (#7089) + +## 0.9.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 0.9.4 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 0.9.3 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + +## 0.9.2 (2021-10-11) + +Fix return type of readComponents() (#6143) + diff --git a/stub-uploader/data/changelogs/waitress.md b/stub-uploader/data/changelogs/waitress.md new file mode 100644 index 0000000..4ff8ae0 --- /dev/null +++ b/stub-uploader/data/changelogs/waitress.md @@ -0,0 +1,74 @@ +## 2.1.4.1 (2022-10-16) + +Remove empty `__init__` methods from classes with 0 parents (#8907) + +## 2.1.4 (2022-07-19) + +Third-party stubs: enforce CamelCase for type alias names (#8256) + +Co-authored-by: Jelle Zijlstra + +## 2.1.3 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 2.1.2 (2022-07-04) + +Third-party stubs: audit more `Callable[, Any]` annotations (#8233) + +## 2.1.1 (2022-06-26) + +Third-party stubs: audit `Callable[, None]` annotations (#8175) + +## 2.1.0 (2022-06-21) + +Bump waitress to 2.1.* (#8113) + +## 2.0.9 (2022-05-26) + +Third-party stubs: fix several fictitious type aliases (#7958) + +## 2.0.8 (2022-04-20) + +Use `TypeAlias` for type aliases where possible, part II (#7667) + +## 2.0.7 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 2.0.5 (2021-12-28) + +Use PEP 585 syntax wherever possible (#6717) + +## 2.0.4 (2021-12-17) + +Use stubtest 0.920 (#6589) + +Co-authored-by: Alex Waygood +Co-authored-by: Jelle Zijlstra +Co-authored-by: Sebastian Rittau +Co-authored-by: Akuli + +## 2.0.3 (2021-11-26) + +Add mypy error codes to '# type: ignore' comments (#6379) + +## 2.0.2 (2021-11-23) + +Reduce use of deprecated `typing` aliases (#6358) + +## 2.0.1 (2021-10-15) + +Use lowercase tuple where possible (#6170) + +## 2.0.0 (2021-10-12) + +Update remaining versions for third-party stubs (#6094) + +Also remove the python2 markers of packages that don't list Python 2 +as supported in the latest version. + +Don't special case version '0.1' + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/whatthepatch.md b/stub-uploader/data/changelogs/whatthepatch.md new file mode 100644 index 0000000..060b86e --- /dev/null +++ b/stub-uploader/data/changelogs/whatthepatch.md @@ -0,0 +1,16 @@ +## 1.0.2 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 1.0.1 (2022-06-26) + +Check missing definitions for several packages (#8167) + +Co-authored-by: hauntsaninja <> + +## 1.0.0 (2022-03-17) + +Add stubs for whatthepatch (#7492) + +Co-authored-by: Akuli + diff --git a/stub-uploader/data/changelogs/xmltodict.md b/stub-uploader/data/changelogs/xmltodict.md new file mode 100644 index 0000000..ae137a6 --- /dev/null +++ b/stub-uploader/data/changelogs/xmltodict.md @@ -0,0 +1,24 @@ +## 0.13.0.1 (2022-10-28) + +xmltodict: improve parse input types (#9018) + +## 0.13.0 (2022-06-26) + +Bump xmltodict to 0.13.* (#8172) + +## 0.12.2 (2022-06-25) + +appdirs, tabulate, termcolor, xmltodict: check missing defs (#8156) + +complete termcolor, xmltodict + +## 0.12.1 (2022-04-16) + +Third-party stubs: import from `collections.abc` where possible (#7637) + +## 0.12.0 (2022-03-11) + +Add xmltodict (#7472) + +Signed-off-by: Andrej Shadura + diff --git a/stub-uploader/data/changelogs/xxhash.md b/stub-uploader/data/changelogs/xxhash.md index d03ad3f..5a6ea63 100644 --- a/stub-uploader/data/changelogs/xxhash.md +++ b/stub-uploader/data/changelogs/xxhash.md @@ -1,3 +1,63 @@ +## 3.0.5.1 (2022-10-20) + +[stubsabot] Mark xxhash as obsolete since 3.1.0 (#8935) + +Release: https://pypi.org/pypi/xxhash/3.1.0 +Homepage: https://github.com/ifduyue/python-xxhash +Diff: https://github.com/ifduyue/python-xxhash/compare/v3.0.0...v3.1.0 + +Co-authored-by: stubsabot <> + +## 3.0.5 (2022-09-27) + +Bump mypy to 0.981 (#8796) + +## 3.0.4 (2022-07-20) + +Allowlist useless modules (#8340) + +These are the ones I chose not to add from #8321 + +Fixes most of #8339 + +## 3.0.3 (2022-07-19) + +Add missing third party modules (#8321) + +Co-authored-by: Alex Waygood +Co-authored-by: hauntsaninja <> +Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> + +## 3.0.2 (2022-07-17) + +Make xxhash, editdistance into packages (#8320) + +This matches the runtime. Also see #8319 + +## 3.0.1 (2022-06-21) + +stubtest: per project --ignore-missing-stub (#8122) + +## 3.0.0 (2022-06-08) + +Update xxhash (#8034) + +Co-authored-by: hauntsaninja <> + +## 2.0.5 (2022-04-29) + +Delete python 2 branches from third-party stubs (#7741) + +Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified. + +## 2.0.4 (2022-04-27) + +Drop Python 2 support in third-party stubs (#7703) + +## 2.0.2 (2021-10-12) + +Add star to all non-0.1 versions (#6146) + ## 2.0.1 (2021-09-14) Update the `xxhash` and `hashlib` stubs (#6031) diff --git a/stub-uploader/data/changelogs/zxcvbn.md b/stub-uploader/data/changelogs/zxcvbn.md new file mode 100644 index 0000000..1f74a67 --- /dev/null +++ b/stub-uploader/data/changelogs/zxcvbn.md @@ -0,0 +1,12 @@ +## 4.4.1.1 (2022-11-04) + +Mark `zxcvbn` as completed (#9088) + +## 4.4.1 (2022-07-12) + +Import `Match` and `Pattern` from `re`, not `typing` (#8277) + +## 4.4.0 (2022-06-21) + +Add types for zxcvbn (#8089) + diff --git a/stub-uploader/data/empty_package/setup.py b/stub-uploader/data/empty_package/setup.py index dff391a..885dec1 100644 --- a/stub-uploader/data/empty_package/setup.py +++ b/stub-uploader/data/empty_package/setup.py @@ -1,4 +1,5 @@ import sys + from setuptools import setup increment = int(sys.argv.pop()) @@ -14,6 +15,6 @@ install_requires=[], packages=[], classifiers=[ - "Typing :: Typed", + "Typing :: Stubs Only", ], ) diff --git a/stub-uploader/data/last_typeshed_commit.sha1 b/stub-uploader/data/last_typeshed_commit.sha1 index 4f7e8da..33bae28 100644 --- a/stub-uploader/data/last_typeshed_commit.sha1 +++ b/stub-uploader/data/last_typeshed_commit.sha1 @@ -1 +1 @@ -0142ea8b52931fb5b914f4a159a04a385322189c +4f381af4c5d85f7fd41681231c535da6b5a74f44 diff --git a/stub-uploader/data/test_typeshed/stubs/bogusfiles/METADATA.toml b/stub-uploader/data/test_typeshed/stubs/bogusfiles/METADATA.toml index 31f638b..5f15410 100644 --- a/stub-uploader/data/test_typeshed/stubs/bogusfiles/METADATA.toml +++ b/stub-uploader/data/test_typeshed/stubs/bogusfiles/METADATA.toml @@ -1,2 +1 @@ version = "0.1" -python2 = true diff --git a/stub-uploader/data/test_typeshed/stubs/singlefilepkg/METADATA.toml b/stub-uploader/data/test_typeshed/stubs/singlefilepkg/METADATA.toml index 31f638b..5f15410 100644 --- a/stub-uploader/data/test_typeshed/stubs/singlefilepkg/METADATA.toml +++ b/stub-uploader/data/test_typeshed/stubs/singlefilepkg/METADATA.toml @@ -1,2 +1 @@ version = "0.1" -python2 = true diff --git a/stub-uploader/data/uploaded_packages.txt b/stub-uploader/data/uploaded_packages.txt index 1c9c66b..0fd51b1 100644 --- a/stub-uploader/data/uploaded_packages.txt +++ b/stub-uploader/data/uploaded_packages.txt @@ -1,16 +1,22 @@ +types-D3DShot types-DateTimeRange types-Deprecated types-Flask +types-Flask-Cors +types-Flask-SQLAlchemy types-JACK-Client types-Jinja2 types-Markdown types-MarkupSafe types-Pillow +types-PyAutoGUI types-PyJWT types-PyMySQL +types-PyScreeze types-PyYAML types-Pygments types-Routes +types-SQLAlchemy types-Send2Trash types-Werkzeug types-aiofiles @@ -30,18 +36,22 @@ types-braintree types-cachetools types-caldav types-certifi +types-cffi types-characteristic types-chardet +types-chevron types-click types-click-spinner types-colorama types-commonmark +types-console-menu types-contextvars types-croniter types-cryptography types-dataclasses types-dateparser types-decorator +types-dj-database-url types-docopt types-docutils types-editdistance @@ -51,30 +61,54 @@ types-enum34 types-fb303 types-filelock types-first +types-flake8-2020 +types-flake8-bugbear +types-flake8-builtins +types-flake8-docstrings +types-flake8-plugin-utils +types-flake8-rst-docstrings +types-flake8-simplify +types-flake8-typing-imports +types-fpdf2 types-freezegun types-frozendict types-futures +types-gdb types-geoip2 +types-google-cloud-ndb +types-hdbcli types-html5lib types-httplib2 types-humanfriendly +types-invoke types-ipaddress types-itsdangerous types-jmespath types-jsonschema types-jwt types-kazoo +types-keyboard +types-ldap3 types-maxminddb types-mock types-mypy-extensions types-mysqlclient types-nmap types-oauthlib +types-openpyxl types-openssl-python +types-opentracing types-orjson +types-paho-mqtt types-paramiko +types-parsimonious +types-passlib +types-passpy types-pathlib2 +types-peewee +types-pep8-naming types-pkg_resources +types-playsound types-polib types-prettytable types-protobuf @@ -85,16 +119,23 @@ types-pyRFC3339 types-pyaudio types-pycurl types-pyfarmhash +types-pyflakes +types-pyinstaller types-pymssql +types-pynput types-pysftp types-pytest-lazy-fixture +types-python-crontab types-python-dateutil types-python-gflags +types-python-jose types-python-nmap types-python-slugify types-pytz types-pyvmomi +types-pywin32 types-redis +types-regex types-requests types-retry types-scribe @@ -104,17 +145,25 @@ types-simplejson types-singledispatch types-six types-slumber +types-stdlib-list types-stripe types-tabulate types-termcolor types-toml types-toposort types-tornado +types-tqdm +types-tree-sitter +types-tree-sitter-languages types-ttkthemes types-typed-ast types-typing-extensions types-tzlocal types-ujson +types-urllib3 types-vobject types-waitress -types-xxhash \ No newline at end of file +types-whatthepatch +types-xmltodict +types-xxhash +types-zxcvbn \ No newline at end of file diff --git a/stub-uploader/requirements.txt b/stub-uploader/requirements.txt new file mode 100644 index 0000000..bd15b37 --- /dev/null +++ b/stub-uploader/requirements.txt @@ -0,0 +1,11 @@ +packaging +requests +tomli + +setuptools +wheel +twine + +mypy +pytest +types-requests diff --git a/stub-uploader/scripts/build_wheel.py b/stub-uploader/scripts/build_wheel.py deleted file mode 100644 index 2ff9ada..0000000 --- a/stub-uploader/scripts/build_wheel.py +++ /dev/null @@ -1,420 +0,0 @@ -""" -Basic script to generate a wheel for a third-party distribution in typeshed. - -This generates a PEP 561 types stub package using METADATA.toml file for a given -distribution in typeshed stubs. Such package can be used by type-checking tools -like mypy, PyCharm, pytype etc. to check code that uses the corresponding runtime -Python package. - -The generated wheel includes all type stubs (*.pyi files) and the METADATA.toml -itself, no other files can be included. - -The types stubs live in https://github.com/python/typeshed/tree/master/stubs, -all fixes for types and metadata should be contributed there, see -https://github.com/python/typeshed/blob/master/CONTRIBUTING.md for more details. - -This file also contains some helper functions related to wheel validation and upload. -""" - -import argparse -import os -import os.path -import shutil -import tempfile -import subprocess -from collections import defaultdict -from glob import glob -from textwrap import dedent -from typing import List, Dict, Any, Tuple, Set, Mapping - -from scripts import get_version -from scripts.const import * -from scripts.metadata import Metadata, read_metadata - -CHANGELOG = "CHANGELOG.md" - -SUFFIX = "-stubs" -PY2_SUFFIX = "-python2-stubs" - -SETUP_TEMPLATE = dedent( - """ -from setuptools import setup - -name = "types-{distribution}" -description = "Typing stubs for {distribution}" -long_description = ''' -{long_description} -'''.lstrip() - -setup(name=name, - version="{version}", - description=description, - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/python/typeshed", - install_requires={requires}, - packages={packages}, - package_data={package_data}, - license="Apache-2.0 license", - classifiers=[ - "License :: OSI Approved :: Apache Software License", - "Typing :: Typed", - ] -) -""" -).lstrip() - -OBSOLETE_TEXT_TEMPLATE = """ -*Note:* The `{distribution}` package includes type annotations or type stubs -since version {obsolete_since}. Please uninstall the `types-{distribution}` -package if you use this or a newer version. -""".lstrip() - - -DESCRIPTION_INTRO_TEMPLATE = """ -## Typing stubs for {distribution} - -This is a PEP 561 type stub package for the `{distribution}` package. -It can be used by type-checking tools like mypy, PyCharm, pytype etc. to check code -that uses `{distribution}`. The source for this package can be found at -https://github.com/python/typeshed/tree/master/stubs/{distribution}. All fixes for -types and metadata should be contributed there. -""".strip() - -DESCRIPTION_OUTRO_TEMPLATE = """ -See https://github.com/python/typeshed/blob/master/README.md for more details. -This package was generated from typeshed commit `{commit}`. -""".strip() - - -class BuildData: - def __init__(self, typeshed_dir: str, distribution: str) -> None: - self.distribution = distribution - self._base_dir = os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE, distribution) - # Python 3 (and mixed Python 2 and 3) stubs exist if at least one - # *.pyi file exists on the top-level or in subdirectories, *excluding* - # the @python2 directory. May be more than one level down in the case - # of namespace packages (which lack __init__.pyi or any pyi files) - self.py3_stubs = ( - len(glob(f"{self._base_dir}/*.pyi")) >= 1 - or len(glob(f"{self._base_dir}/[!@]*/*.pyi")) >= 1 - or len(glob(f"{self._base_dir}/[!@]*/**/*.pyi")) >= 1 - ) - # Python 2 stubs exist if a @python2 directory exists. - self.py2_stubs = PY2_NAMESPACE in os.listdir(self._base_dir) - assert self.py3_stubs or self.py2_stubs, "no stubs found" - - @property - def py3_stub_dir(self) -> str: - return self._base_dir - - @property - def py2_stub_dir(self) -> str: - return os.path.join(self._base_dir, PY2_NAMESPACE) - - -def strip_types_prefix(dependency: str) -> str: - assert dependency.startswith( - "types-" - ), "Currently only dependencies on stub packages are supported" - return dependency[len("types-") :] - - -def find_stub_files(top: str) -> List[str]: - """Find all stub files for a given package, relative to package root. - - Raise if we find any unknown file extensions during collection. - """ - result = [] - for root, _, files in os.walk(top): - for file in files: - if file.endswith(".pyi"): - name, _ = os.path.splitext(file) - assert ( - name.isidentifier() - ), "All file names must be valid Python modules" - result.append(os.path.relpath(os.path.join(root, file), top)) - elif not file.endswith((".md", ".rst")): - # Allow having README docs, as some stubs have these (e.g. click). - if ( - subprocess.run(["git", "check-ignore", file], cwd=top).returncode - != 0 - ): - raise ValueError(f"Only stub files are allowed, not {file}") - return sorted(result) - - -def copy_stubs(base_dir: str, dst: str, suffix: str) -> None: - """Copy stubs for given distribution to the build directory. - - For packages change name by appending "-stubs" suffix (PEP 561), - also convert modules to trivial packages with a single __init__.pyi. - """ - for entry in os.listdir(base_dir): - if os.path.isfile(os.path.join(base_dir, entry)): - if not entry.endswith(".pyi"): - continue - stub_dir = os.path.join(dst, entry.split(".")[0] + suffix) - os.mkdir(stub_dir) - shutil.copy( - os.path.join(base_dir, entry), os.path.join(stub_dir, "__init__.pyi") - ) - else: - if entry == PY2_NAMESPACE: - # This is not really a package, but Python 2 stubs root. - # Packages there should be copied using a separate call to this - # function. - continue - if entry == TESTS_NAMESPACE: - # Don't package tests for the stubs - continue - stub_dir = os.path.join(dst, entry + suffix) - shutil.copytree(os.path.join(base_dir, entry), stub_dir) - - # We add original METADATA file in case some type-checking tool will want - # to use it. Note that since it is not easy to package it outside of a package, - # we copy it to every package in given distribution. - if os.path.isfile(os.path.join(base_dir, META)): - shutil.copy(os.path.join(base_dir, META), stub_dir) - else: - upper_dir = os.path.dirname(base_dir) - assert os.path.isfile(os.path.join(upper_dir, META)) - shutil.copy(os.path.join(upper_dir, META), stub_dir) - - -def copy_changelog(distribution: str, dst: str) -> None: - """Copy changelog to the build directory.""" - try: - shutil.copy( - os.path.join(CHANGELOG_PATH, f"{distribution}.md"), - os.path.join(dst, CHANGELOG), - ) - with open(os.path.join(dst, "MANIFEST.in"), "a") as f: - f.write(f"include {CHANGELOG}\n") - except FileNotFoundError: - pass # Ignore missing changelogs - - -def collect_setup_entries( - base_dir: str, - suffix: str, -) -> Dict[str, List[str]]: - """Generate package data for a setuptools.setup() call. - - This reflects the transformations done during copying in copy_stubs(). - """ - package_data = {} - for entry in os.listdir(base_dir): - if entry == META: - # Metadata file entry is added at the end. - continue - original_entry = entry - if os.path.isfile(os.path.join(base_dir, entry)): - if not entry.endswith(".pyi"): - if not entry.endswith((".md", ".rst")): - if ( - subprocess.run( - ["git", "check-ignore", entry], cwd=base_dir - ).returncode - != 0 - ): - raise ValueError(f"Only stub files are allowed: {entry}") - continue - entry = entry.split(".")[0] + suffix - # Module -> package transformation is done while copying. - package_data[entry] = ["__init__.pyi"] - else: - if entry == PY2_NAMESPACE: - # Again, Python 2 entries should be generated by - # a separate call to this function. - continue - if entry == TESTS_NAMESPACE: - continue - entry += suffix - package_data[entry] = find_stub_files( - os.path.join(base_dir, original_entry) - ) - package_data[entry].append(META) - return package_data - - -def verify_dependency(typeshed_dir: str, dependency: str, uploaded: str) -> None: - """Verify this is a valid dependency, i.e. a stub package uploaded by us.""" - known_distributions = set( - os.listdir(os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE)) - ) - assert ";" not in dependency, "Semicolons in dependencies are not supported" - dependency = get_version.strip_dep_version(dependency) - assert ( - strip_types_prefix(dependency) in known_distributions - ), "Only dependencies on typeshed stubs are allowed" - with open(uploaded) as f: - uploaded_distributions = set(f.read().splitlines()) - - msg = f"{dependency} looks like a foreign distribution." - uploaded_distributions_lower = [d.lower() for d in uploaded_distributions] - if ( - dependency not in uploaded_distributions - and dependency.lower() in uploaded_distributions_lower - ): - msg += " Note: list is case sensitive" - assert dependency in uploaded_distributions, msg - - -def update_uploaded(uploaded: str, distribution: str) -> None: - with open(uploaded) as f: - current = set(f.read().splitlines()) - if f"types-{distribution}" not in current: - with open(uploaded, "w") as f: - f.write("\n".join(sorted(current | {f"types-{distribution}"}))) - - -def make_dependency_map( - typeshed_dir: str, distributions: List[str] -) -> Dict[str, Set[str]]: - """Return relative dependency map among distributions. - - Important: this only includes dependencies *within* the given - list of distributions. - """ - result: Dict[str, Set[str]] = {d: set() for d in distributions} - for distribution in distributions: - data = read_metadata(typeshed_dir, distribution) - for dependency in data.get("requires", []): - dependency = strip_types_prefix(get_version.strip_dep_version(dependency)) - if dependency in distributions: - result[distribution].add(dependency) - return result - - -def transitive_deps(dep_map: Dict[str, Set[str]]) -> Dict[str, Set[str]]: - """Propagate dependencies to compute a transitive dependency map. - - Note: this algorithm is O(N**2) in general case, but we don't worry, - because N is small (less than 1000). So it will take few seconds at worst, - while building/uploading 1000 packages will take minutes. - """ - transitive: Dict[str, Set[str]] = defaultdict(set) - for distribution in dep_map: - to_add = {distribution} - while to_add: - new = to_add.pop() - extra = dep_map[new] - transitive[distribution] |= extra - assert ( - distribution not in transitive[distribution] - ), f"Cyclic dependency {distribution} -> {distribution}" - to_add |= extra - return transitive - - -def sort_by_dependency(dep_map: Dict[str, Set[str]]) -> List[str]: - """Sort distributions by dependency order (those depending on nothing appear first).""" - trans_map = transitive_deps(dep_map) - - # We can't use builtin sort w.r.t. trans_map because it makes various assumptions - # about properties of equality and order (like their mutual transitivity). - def sort(ds: List[str]) -> List[str]: - if not ds: - return [] - pivot = ds.pop() - not_dependent = [d for d in ds if pivot not in trans_map[d]] - dependent = [d for d in ds if pivot in trans_map[d]] - return sort(not_dependent) + [pivot] + sort(dependent) - - # Return independent packages sorted by name for stability. - return sort(sorted(dep_map)) - - -def generate_setup_file( - build_data: BuildData, metadata: Metadata, version: str, commit: str -) -> str: - """Auto-generate a setup.py file for given distribution using a template.""" - packages: List[str] = [] - package_data = {} - if build_data.py3_stubs: - py3_package_data = collect_setup_entries(build_data.py3_stub_dir, SUFFIX) - packages.extend(py3_package_data.keys()) - package_data.update(py3_package_data) - if build_data.py2_stubs: - # If there are Python 2 only stubs, add entries from the sub-directory. - py2_package_data = collect_setup_entries(build_data.py2_stub_dir, PY2_SUFFIX) - packages.extend(py2_package_data.keys()) - package_data.update(py2_package_data) - return SETUP_TEMPLATE.format( - distribution=build_data.distribution, - long_description=generate_long_description( - build_data.distribution, commit, metadata - ), - version=version, - requires=metadata.get("requires", []), - packages=packages, - package_data=package_data, - ) - - -def generate_long_description( - distribution: str, commit: str, metadata: Mapping[str, Any] -) -> str: - extra_description = metadata.get("extra_description", "").strip() - parts = [] - parts.append(DESCRIPTION_INTRO_TEMPLATE.format(distribution=distribution)) - if extra_description: - parts.append(extra_description) - if "obsolete_since" in metadata: - parts.append( - OBSOLETE_TEXT_TEMPLATE.format( - distribution=distribution, obsolete_since=metadata["obsolete_since"] - ) - ) - parts.append(DESCRIPTION_OUTRO_TEMPLATE.format(commit=commit)) - return "\n\n".join(parts) - - -def main(typeshed_dir: str, distribution: str, version: str) -> str: - """Generate a wheel for a third-party distribution in typeshed. - - Return the path to directory where wheel is created. - - Note: the caller should clean the temporary directory where wheel is - created after uploading it. - """ - build_data = BuildData(typeshed_dir, distribution) - tmpdir = tempfile.mkdtemp() - commit = subprocess.run( - ["git", "rev-parse", "HEAD"], - capture_output=True, - universal_newlines=True, - cwd=typeshed_dir, - ).stdout.strip() - metadata = read_metadata(typeshed_dir, distribution) - with open(os.path.join(tmpdir, "setup.py"), "w") as f: - f.write(generate_setup_file(build_data, metadata, version, commit)) - if build_data.py3_stubs: - copy_stubs(build_data.py3_stub_dir, tmpdir, SUFFIX) - if build_data.py2_stubs: - # If there are Python 2 only stubs, copy them too. - copy_stubs(build_data.py2_stub_dir, tmpdir, PY2_SUFFIX) - copy_changelog(distribution, tmpdir) - current_dir = os.getcwd() - os.chdir(tmpdir) - universal_args = [] - if build_data.py3_stubs and ( - build_data.py2_stubs or metadata.get("version2", False) - ): - universal_args.append("--universal") - subprocess.run(["python3", "setup.py", "bdist_wheel"] + universal_args) - subprocess.run(["python3", "setup.py", "sdist"]) - os.chdir(current_dir) - return f"{tmpdir}/dist" - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") - parser.add_argument("distribution", help="Third-party distribution to build") - parser.add_argument("version", help="New stub version") - args = parser.parse_args() - print( - "Wheel is built in:", main(args.typeshed_dir, args.distribution, args.version) - ) diff --git a/stub-uploader/scripts/const.py b/stub-uploader/scripts/const.py deleted file mode 100644 index ef4e626..0000000 --- a/stub-uploader/scripts/const.py +++ /dev/null @@ -1,6 +0,0 @@ -THIRD_PARTY_NAMESPACE = "stubs" -PY2_NAMESPACE = "@python2" -TESTS_NAMESPACE = "@tests" -META = "METADATA.toml" - -CHANGELOG_PATH = "data/changelogs" diff --git a/stub-uploader/scripts/get_version.py b/stub-uploader/scripts/get_version.py deleted file mode 100644 index c53519f..0000000 --- a/stub-uploader/scripts/get_version.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -Find the latest typeshed increment for a stub package with given -(or current) version. - -If the given version was never uploaded, this will return -1. See -https://github.com/python/typeshed/blob/master/README.md for details -on stub versioning. - -This file also contains some helper functions related to querying -distribution information. -""" - -from __future__ import annotations - -import argparse -import os.path -import re -from collections.abc import Iterable -from typing import Any, Optional, cast - -import requests -import toml -from requests.adapters import HTTPAdapter -from urllib3.util.retry import Retry # type: ignore[import] - -from scripts.const import * - -PREFIX = "types-" -URL_TEMPLATE = "https://pypi.org/pypi/{}/json" -RETRIES = 5 -RETRY_ON = [429, 500, 502, 503, 504] -TIMEOUT = 3 - - -def fetch_pypi_versions(distribution: str) -> Iterable[str]: - url = URL_TEMPLATE.format(PREFIX + distribution) - retry_strategy = Retry(total=RETRIES, status_forcelist=RETRY_ON) - with requests.Session() as session: - session.mount("https://", HTTPAdapter(max_retries=retry_strategy)) - resp = session.get(url, timeout=TIMEOUT) - if not resp.ok: - if resp.status_code == 404: - # Looks like this is first time this package is ever uploaded. - return [] - raise ValueError("Error while retrieving version") - releases: dict[str, Any] = resp.json()["releases"] - return releases.keys() - - -def read_base_version(typeshed_dir: str, distribution: str) -> str: - """Read distribution version from metadata.""" - metadata_file = os.path.join( - typeshed_dir, THIRD_PARTY_NAMESPACE, distribution, "METADATA.toml" - ) - with open(metadata_file) as f: - data = toml.loads(f.read()) - version = data["version"] - assert isinstance(version, str) - if version.endswith(".*"): - version = version[:-2] - assert re.match(r"\d+(\.\d+)*", version) - return version - - -def strip_dep_version(dependency: str) -> str: - """Strip a possible version suffix, e.g. types-six>=0.1.4 -> types-six.""" - dep_version_pos = len(dependency) - for pos, c in enumerate(dependency): - if c in "=<>": - dep_version_pos = pos - break - return dependency[:dep_version_pos] - - -def check_exists(distribution: str) -> bool: - """Check if any version of this *stub* distribution has ben ever uploaded.""" - url = URL_TEMPLATE.format(distribution) - retry_strategy = Retry(total=RETRIES, status_forcelist=RETRY_ON) - with requests.Session() as session: - session.mount("https://", HTTPAdapter(max_retries=retry_strategy)) - resp = session.get(url, timeout=TIMEOUT) - if resp.ok: - return True - if resp.status_code == 404: - return False - raise ValueError("Error while verifying existence") - - -def main(typeshed_dir: str, distribution: str, version: Optional[str]) -> int: - """A simple function to get version increment of a third-party stub package. - - Supports basic reties and timeouts (as module constants). - """ - pypi_versions = fetch_pypi_versions(distribution) - if not version: - # Use the METADATA.toml version, if not given one. - version = read_base_version(typeshed_dir, distribution) - matching = [v for v in pypi_versions if v.startswith(f"{version}.")] - if not matching: - return -1 - increment = max(int(v.split(".")[-1]) for v in matching) - return increment - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") - parser.add_argument("distribution", help="Third-party distribution to build") - parser.add_argument( - "version", nargs="?", help="Base version for which to get increment" - ) - args = parser.parse_args() - print(main(args.typeshed_dir, args.distribution, args.version)) diff --git a/stub-uploader/scripts/metadata.py b/stub-uploader/scripts/metadata.py deleted file mode 100644 index bf548cf..0000000 --- a/stub-uploader/scripts/metadata.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -from typing import Any, Dict - -import toml - -from scripts import get_version - -from .const import META, THIRD_PARTY_NAMESPACE - - -Metadata = Dict[str, Any] - - -def read_metadata(typeshed_dir: str, distribution: str) -> Metadata: - """Parse metadata from file.""" - file = os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE, distribution, META) - with open(file) as f: - return dict(toml.loads(f.read())) - - -def determine_version(typeshed_dir: str, distribution: str) -> str: - metadata = read_metadata(typeshed_dir, distribution) - version: str = metadata["version"] - # Setting base version to None, so it will be read from current METADATA.toml. - increment = get_version.main(typeshed_dir, distribution, None) - if increment >= 0: - print(f"Existing version found for {distribution}") - increment += 1 - return f"{version}.{increment}" diff --git a/stub-uploader/scripts/upload_changed.py b/stub-uploader/scripts/upload_changed.py deleted file mode 100644 index 5826a91..0000000 --- a/stub-uploader/scripts/upload_changed.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Entry point for scheduled GitHub auto-upload action. - -This does following things: -* Reads the list of stub packages modified since last commit in typeshed -* Checks what is the current stub version increment for each package on PyPI -* Bumps the increment, builds and uploads (unless run with --dry-run) each - new package to PyPI -* Verifies validity of stub dependencies, and updates known dependencies if needed -""" - -import argparse -import os -import subprocess - -from scripts import build_wheel, get_changed, update_changelog -from scripts.metadata import determine_version, read_metadata - - -def main(typeshed_dir: str, commit: str, uploaded: str, dry_run: bool = False) -> None: - """Upload stub typeshed packages modified since commit.""" - changed = get_changed.main(typeshed_dir, commit) - # Ignore those distributions that were completely deleted. - current = set(os.listdir(os.path.join(typeshed_dir, "stubs"))) - changed = [d for d in changed if d in current] - # Sort by dependency to prevent depending on foreign distributions. - to_upload = build_wheel.sort_by_dependency( - build_wheel.make_dependency_map(typeshed_dir, changed) - ) - print("Building and uploading stubs for:", ", ".join(to_upload)) - for distribution in to_upload: - version = determine_version(typeshed_dir, distribution) - update_changelog.update_changelog( - typeshed_dir, commit, distribution, version, dry_run=dry_run - ) - temp_dir = build_wheel.main(typeshed_dir, distribution, version) - if dry_run: - print(f"Would upload: {distribution}, version {version}") - continue - for dependency in read_metadata(typeshed_dir, distribution).get("requires", []): - build_wheel.verify_dependency(typeshed_dir, dependency, uploaded) - subprocess.run(["twine", "upload", os.path.join(temp_dir, "*")], check=True) - build_wheel.update_uploaded(uploaded, distribution) - print(f"Successfully uploaded stubs for {distribution}") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") - parser.add_argument( - "previous_commit", help="Previous typeshed commit for which we performed upload" - ) - parser.add_argument( - "uploaded", - help="File listing previously uploaded packages to validate dependencies", - ) - parser.add_argument( - "--dry-run", - action="store_true", - help="Should we perform a dry run (don't actually upload)", - ) - args = parser.parse_args() - main(args.typeshed_dir, args.previous_commit, args.uploaded, args.dry_run) diff --git a/stub-uploader/scripts/upload_some.py b/stub-uploader/scripts/upload_some.py deleted file mode 100644 index 0b2e16f..0000000 --- a/stub-uploader/scripts/upload_some.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -Entry point for manual GitHub upload action. - -This does following things: -* Finds all distributions with names that match the pattern provided -* Checks what is the current stub version increment for each package on PyPI -* Bumps the increment, builds and uploads the each new package to PyPI -* Verifies validity of stub dependencies, and updates known dependencies if needed -""" - -import argparse -import os -import re -import subprocess - -from scripts import build_wheel -from scripts.metadata import determine_version, read_metadata - - -def main(typeshed_dir: str, pattern: str, uploaded: str) -> None: - """Force upload typeshed stub packages to PyPI.""" - compiled = re.compile(f"^{pattern}$") # force exact matches - matching = [ - d - for d in os.listdir(os.path.join(typeshed_dir, "stubs")) - if re.match(compiled, d) - ] - # Sort by dependency to prevent depending on foreign distributions. - to_upload = build_wheel.sort_by_dependency( - build_wheel.make_dependency_map(typeshed_dir, matching) - ) - print("Uploading stubs for:", ", ".join(to_upload)) - for distribution in to_upload: - version = determine_version(typeshed_dir, distribution) - for dependency in read_metadata(typeshed_dir, distribution).get("requires", []): - build_wheel.verify_dependency(typeshed_dir, dependency, uploaded) - # TODO: Update changelog - temp_dir = build_wheel.main(typeshed_dir, distribution, version) - subprocess.run(["twine", "upload", os.path.join(temp_dir, "*")], check=True) - build_wheel.update_uploaded(uploaded, distribution) - print(f"Successfully uploaded stubs for {distribution}") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") - parser.add_argument( - "pattern", help="Regular expression to select distributions for upload" - ) - parser.add_argument( - "uploaded", - help="File listing previously uploaded packages to validate dependencies", - ) - args = parser.parse_args() - main(args.typeshed_dir, args.pattern, args.uploaded) diff --git a/stub-uploader/stub_uploader/__init__.py b/stub-uploader/stub_uploader/__init__.py new file mode 100644 index 0000000..c5adf88 --- /dev/null +++ b/stub-uploader/stub_uploader/__init__.py @@ -0,0 +1,3 @@ +import sys + +assert sys.version_info >= (3, 9) diff --git a/stub-uploader/stub_uploader/build_wheel.py b/stub-uploader/stub_uploader/build_wheel.py new file mode 100644 index 0000000..5230fb5 --- /dev/null +++ b/stub-uploader/stub_uploader/build_wheel.py @@ -0,0 +1,297 @@ +""" +Basic script to generate a wheel for a third-party distribution in typeshed. + +This generates a PEP 561 types stub package using METADATA.toml file for a given +distribution in typeshed stubs. Such package can be used by type-checking tools +like mypy, PyCharm, pytype etc. to check code that uses the corresponding runtime +Python package. + +The generated wheel includes all type stubs (*.pyi files) and the METADATA.toml +itself, no other files can be included. + +The types stubs live in https://github.com/python/typeshed/tree/main/stubs, +all fixes for types and metadata should be contributed there, see +https://github.com/python/typeshed/blob/main/CONTRIBUTING.md for more details. + +This file also contains some helper functions related to wheel validation and upload. +""" + +import argparse +import os +import os.path +import shutil +import subprocess +import tempfile +from textwrap import dedent +from typing import Optional + +from stub_uploader.const import ( + CHANGELOG_PATH, + META, + TESTS_NAMESPACE, + THIRD_PARTY_NAMESPACE, +) +from stub_uploader.metadata import Metadata, read_metadata + +CHANGELOG = "CHANGELOG.md" + +SUFFIX = "-stubs" + +SETUP_TEMPLATE = dedent( + """ +from setuptools import setup + +name = "types-{distribution}" +description = "Typing stubs for {distribution}" +long_description = ''' +{long_description} +'''.lstrip() + +setup(name=name, + version="{version}", + description=description, + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/python/typeshed", + project_urls={{ + "GitHub": "https://github.com/python/typeshed", + "Changes": "https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/{distribution}.md", + "Issue tracker": "https://github.com/python/typeshed/issues", + "Chat": "https://gitter.im/python/typing", + }}, + install_requires={requires}, + packages={packages}, + package_data={package_data}, + license="Apache-2.0 license", + classifiers=[ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Typing :: Stubs Only", + ] +) +""" +).lstrip() + +NO_LONGER_UPDATED_TEMPLATE = """ +*Note:* `types-{distribution}` is unmaintained and won't be updated. +""".lstrip() + +OBSOLETE_SINCE_TEXT_TEMPLATE = """ +*Note:* The `{distribution}` package includes type annotations or type stubs +since version {obsolete_since}. Please uninstall the `types-{distribution}` +package if you use this or a newer version. +""".lstrip() + +DESCRIPTION_INTRO_TEMPLATE = """ +## Typing stubs for {distribution} + +This is a PEP 561 type stub package for the `{distribution}` package. +It can be used by type-checking tools like mypy, PyCharm, pytype etc. to check code +that uses `{distribution}`. The source for this package can be found at +https://github.com/python/typeshed/tree/main/stubs/{distribution}. All fixes for +types and metadata should be contributed there. +""".strip() + +DESCRIPTION_OUTRO_TEMPLATE = """ +See https://github.com/python/typeshed/blob/main/README.md for more details. +This package was generated from typeshed commit `{commit}`. +""".strip() + + +class BuildData: + def __init__(self, typeshed_dir: str, distribution: str) -> None: + self.distribution = distribution + self.stub_dir = os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE, distribution) + + +def find_stub_files(top: str) -> list[str]: + """Find all stub files for a given package, relative to package root. + + Raise if we find any unknown file extensions during collection. + """ + result = [] + for root, _, files in os.walk(top): + for file in files: + if file.endswith(".pyi"): + name, _ = os.path.splitext(file) + assert ( + name.isidentifier() + ), "All file names must be valid Python modules" + result.append(os.path.relpath(os.path.join(root, file), top)) + elif not file.endswith((".md", ".rst")): + # Allow having README docs, as some stubs have these (e.g. click). + if ( + subprocess.run(["git", "check-ignore", file], cwd=top).returncode + != 0 + ): + raise ValueError(f"Only stub files are allowed, not {file}") + return sorted(result) + + +def copy_stubs(base_dir: str, dst: str) -> None: + """Copy stubs for given distribution to the build directory. + + For packages change name by appending "-stubs" suffix (PEP 561), + also convert modules to trivial packages with a single __init__.pyi. + """ + for entry in os.listdir(base_dir): + if os.path.isfile(os.path.join(base_dir, entry)): + if not entry.endswith(".pyi"): + continue + stub_dir = os.path.join(dst, entry.split(".")[0] + SUFFIX) + os.mkdir(stub_dir) + shutil.copy( + os.path.join(base_dir, entry), os.path.join(stub_dir, "__init__.pyi") + ) + else: + if entry == TESTS_NAMESPACE: + # Don't package tests for the stubs + continue + stub_dir = os.path.join(dst, entry + SUFFIX) + shutil.copytree(os.path.join(base_dir, entry), stub_dir) + + # We add original METADATA file in case some type-checking tool will want + # to use it. Note that since it is not easy to package it outside of a package, + # we copy it to every package in given distribution. + if os.path.isfile(os.path.join(base_dir, META)): + shutil.copy(os.path.join(base_dir, META), stub_dir) + else: + upper_dir = os.path.dirname(base_dir) + assert os.path.isfile(os.path.join(upper_dir, META)) + shutil.copy(os.path.join(upper_dir, META), stub_dir) + + +def copy_changelog(distribution: str, dst: str) -> None: + """Copy changelog to the build directory.""" + try: + shutil.copy( + os.path.join(CHANGELOG_PATH, f"{distribution}.md"), + os.path.join(dst, CHANGELOG), + ) + with open(os.path.join(dst, "MANIFEST.in"), "a") as f: + f.write(f"include {CHANGELOG}\n") + except FileNotFoundError: + pass # Ignore missing changelogs + + +def collect_setup_entries(base_dir: str) -> dict[str, list[str]]: + """Generate package data for a setuptools.setup() call. + + This reflects the transformations done during copying in copy_stubs(). + """ + package_data = {} + for entry in os.listdir(base_dir): + if entry == META: + # Metadata file entry is added at the end. + continue + original_entry = entry + if os.path.isfile(os.path.join(base_dir, entry)): + if not entry.endswith(".pyi"): + if not entry.endswith((".md", ".rst")): + if ( + subprocess.run( + ["git", "check-ignore", entry], cwd=base_dir + ).returncode + != 0 + ): + raise ValueError(f"Only stub files are allowed: {entry}") + continue + entry = entry.split(".")[0] + SUFFIX + # Module -> package transformation is done while copying. + package_data[entry] = ["__init__.pyi"] + else: + if entry == TESTS_NAMESPACE: + continue + entry += SUFFIX + package_data[entry] = find_stub_files( + os.path.join(base_dir, original_entry) + ) + package_data[entry].append(META) + return package_data + + +def generate_setup_file( + build_data: BuildData, metadata: Metadata, version: str, commit: str +) -> str: + """Auto-generate a setup.py file for given distribution using a template.""" + all_requirements = [ + str(req) for req in metadata.requires_typeshed + metadata.requires_external + ] + package_data = collect_setup_entries(build_data.stub_dir) + return SETUP_TEMPLATE.format( + distribution=build_data.distribution, + long_description=generate_long_description( + build_data.distribution, commit, metadata + ), + version=version, + requires=all_requirements, + packages=list(package_data.keys()), + package_data=package_data, + ) + + +def generate_long_description( + distribution: str, commit: str, metadata: Metadata +) -> str: + extra_description = metadata.extra_description.strip() + parts = [] + parts.append(DESCRIPTION_INTRO_TEMPLATE.format(distribution=distribution)) + if extra_description: + parts.append(extra_description) + if metadata.obsolete_since: + parts.append( + OBSOLETE_SINCE_TEXT_TEMPLATE.format( + distribution=distribution, obsolete_since=metadata.obsolete_since + ) + ) + elif metadata.no_longer_updated: + parts.append(NO_LONGER_UPDATED_TEMPLATE.format(distribution=distribution)) + parts.append(DESCRIPTION_OUTRO_TEMPLATE.format(commit=commit)) + return "\n\n".join(parts) + + +def main( + typeshed_dir: str, distribution: str, version: str, build_dir: Optional[str] = None +) -> str: + """Generate a wheel for a third-party distribution in typeshed. + + Return the path to directory where wheel is created. + + Note: the caller should clean the temporary directory where wheel is + created after uploading it. + """ + build_data = BuildData(typeshed_dir, distribution) + if build_dir: + tmpdir = build_dir + else: + tmpdir = tempfile.mkdtemp() + commit = subprocess.run( + ["git", "rev-parse", "HEAD"], + capture_output=True, + text=True, + cwd=typeshed_dir, + ).stdout.strip() + metadata = read_metadata(typeshed_dir, distribution) + with open(os.path.join(tmpdir, "setup.py"), "w") as f: + f.write(generate_setup_file(build_data, metadata, version, commit)) + copy_stubs(build_data.stub_dir, tmpdir) + copy_changelog(distribution, tmpdir) + current_dir = os.getcwd() + os.chdir(tmpdir) + subprocess.run(["python3", "setup.py", "bdist_wheel"]) + subprocess.run(["python3", "setup.py", "sdist"]) + os.chdir(current_dir) + return f"{tmpdir}/dist" + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--build-dir", default=None, help="build directory") + parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") + parser.add_argument("distribution", help="Third-party distribution to build") + parser.add_argument("version", help="New stub version") + args = parser.parse_args() + print( + "Wheel is built in:", + main(args.typeshed_dir, args.distribution, args.version, args.build_dir), + ) diff --git a/stub-uploader/stub_uploader/const.py b/stub-uploader/stub_uploader/const.py new file mode 100644 index 0000000..17179a0 --- /dev/null +++ b/stub-uploader/stub_uploader/const.py @@ -0,0 +1,7 @@ +THIRD_PARTY_NAMESPACE = "stubs" +TESTS_NAMESPACE = "@tests" +META = "METADATA.toml" +TYPES_PREFIX = "types-" + +CHANGELOG_PATH = "data/changelogs" +UPLOADED_PATH = "data/uploaded_packages.txt" diff --git a/stub-uploader/scripts/get_changed.py b/stub-uploader/stub_uploader/get_changed.py similarity index 91% rename from stub-uploader/scripts/get_changed.py rename to stub-uploader/stub_uploader/get_changed.py index c3ca4e6..ab95259 100644 --- a/stub-uploader/scripts/get_changed.py +++ b/stub-uploader/stub_uploader/get_changed.py @@ -11,16 +11,14 @@ import os import subprocess -from typing import List - -def main(typeshed_dir: str, commit: str) -> List[str]: +def main(typeshed_dir: str, commit: str) -> list[str]: """List all distributions that changed since commit.""" assert typeshed_dir.endswith(os.sep + "typeshed") git = subprocess.run( ["git", "diff", "--no-renames", "--name-only", "HEAD", commit], capture_output=True, - universal_newlines=True, + text=True, cwd=typeshed_dir, check=True, ) diff --git a/stub-uploader/stub_uploader/get_version.py b/stub-uploader/stub_uploader/get_version.py new file mode 100644 index 0000000..7043e13 --- /dev/null +++ b/stub-uploader/stub_uploader/get_version.py @@ -0,0 +1,122 @@ +""" +Find the latest typeshed increment for a stub package with given +(or current) version. + +If the given version was never uploaded, this will return -1. See +https://github.com/python/typeshed/blob/main/README.md for details +on stub versioning. + +This file also contains some helper functions related to querying +distribution information. +""" + +from __future__ import annotations + +from typing import Any + +import requests +from packaging.specifiers import SpecifierSet +from packaging.version import Version +from requests.adapters import HTTPAdapter +from urllib3.util.retry import Retry + +from stub_uploader.const import TYPES_PREFIX +from stub_uploader.metadata import Metadata + +URL_TEMPLATE = "https://pypi.org/pypi/{}/json" +RETRIES = 5 +RETRY_ON = [429, 500, 502, 503, 504] +TIMEOUT = 3 + + +def fetch_pypi_versions(distribution: str) -> list[Version]: + assert distribution.startswith(TYPES_PREFIX) + url = URL_TEMPLATE.format(distribution) + retry_strategy = Retry(total=RETRIES, status_forcelist=RETRY_ON) + with requests.Session() as session: + session.mount("https://", HTTPAdapter(max_retries=retry_strategy)) + resp = session.get(url, timeout=TIMEOUT) + if not resp.ok: + if resp.status_code == 404: + # Looks like this is first time this package is ever uploaded. + return [] + raise ValueError("Error while retrieving version") + releases: dict[str, Any] = resp.json()["releases"] + return [Version(release) for release in releases.keys()] + + +def ensure_specificity(ver: list[int], specificity: int) -> None: + ver.extend([0] * (specificity - len(ver))) + + +def compute_incremented_version( + version_spec: str, published_versions: list[Version] +) -> Version: + # The most important postcondition is that the incremented version is greater than + # all published versions. This ensures that users who don't pin get the most + # up to date stub. If we ever maintain multiple versions for a stub, this will + # need revisiting. + max_published = max(published_versions, default=Version("0")) + + # The second thing we try to do (but don't guarantee), is that the incremented + # version will satisfy the version_spec (defined precisely by the `compatible` + # specifier below). This allows users to have expectations of what a stub package + # will contain based on the upstream version they're targeting. + if version_spec.endswith(".*"): + compatible = SpecifierSet(f"=={version_spec}") + else: + compatible = SpecifierSet(f"=={version_spec}.*") + + # Look up the base version and specificity in METADATA.toml. + version_base = Version(version_spec.removesuffix(".*")) + specificity = len(version_base.release) + + if max_published.epoch > 0 or version_base.epoch > 0: + raise NotImplementedError("Epochs in versions are not supported") + + # We'll try to bump the fourth part of the release. So e.g. if our version_spec is + # 1.1, we'll release 1.1.0.0, 1.1.0.1, 1.1.0.2, ... + # But if our version_spec is 5.6.7.8, we'll release 5.6.7.8.0, 5.6.7.8.1, ... + increment_specificity = max(specificity + 1, 4) + + if version_base.release < max_published.release[:specificity]: + # Our published versions have gone too far ahead the upstream version + # So we can't guarantee our second property. + # In practice, this will only happen if the specificity of version_spec is + # changed or we change our versioning scheme. + # For example, version_base=1.2, max_published=1.3.0.4, return 1.3.0.5 + increment_specificity = max(increment_specificity, len(max_published.release)) + incremented = list(max_published.release) + ensure_specificity(incremented, increment_specificity) + incremented[-1] += 1 + + incremented_version = Version(".".join(map(str, incremented))) + assert incremented_version > max_published + # But can't keep versioning compatible with upstream... + assert incremented_version not in compatible + return incremented_version + + if version_base.release > max_published.release[:specificity]: + # For example, version_base=1.2, max_published=1.1.0.4, return 1.2.0.0 + incremented = list(version_base.release) + ensure_specificity(incremented, increment_specificity) + + else: + assert version_base.release == max_published.release[:specificity] + # For example, version_base=1.1, max_published=1.1.0.4, return 1.1.0.5 + incremented = list(max_published.release) + ensure_specificity(incremented, increment_specificity) + incremented[-1] += 1 + + incremented_version = Version(".".join(map(str, incremented))) + assert incremented_version > max_published + assert incremented_version in compatible + return incremented_version + + +def determine_incremented_version(metadata: Metadata) -> str: + published_stub_versions = fetch_pypi_versions(metadata.stub_distribution) + version = compute_incremented_version( + metadata.version_spec, published_stub_versions + ) + return str(version) diff --git a/stub-uploader/stub_uploader/metadata.py b/stub-uploader/stub_uploader/metadata.py new file mode 100644 index 0000000..35bc34a --- /dev/null +++ b/stub-uploader/stub_uploader/metadata.py @@ -0,0 +1,261 @@ +from __future__ import annotations + +import functools +import graphlib +import os +import re +from typing import Any, Optional +from collections.abc import Iterator + +import requests +import tomli +from packaging.requirements import Requirement + +from .const import META, THIRD_PARTY_NAMESPACE, TYPES_PREFIX, UPLOADED_PATH + + +class InvalidRequires(Exception): + pass + + +class Metadata: + def __init__(self, distribution: str, data: dict[str, Any]): + assert not distribution.startswith(TYPES_PREFIX) + self._alleged_upstream_distribution = distribution + self.data = data + + @property + def upstream_distribution(self) -> Optional[str]: + # TODO: add a field to METADATA.toml if the stubs are for a package + # that does not exist on PyPI + if self._alleged_upstream_distribution == "gdb": + return None + return self._alleged_upstream_distribution + + @property + def stub_distribution(self) -> str: + return TYPES_PREFIX + self._alleged_upstream_distribution + + @property + def version_spec(self) -> str: + # The "version" field in METADATA.toml isn't actually a version, it's more + # like a specifier, e.g. we allow it to contain wildcards. + version = self.data["version"] + assert isinstance(version, str) + return version + + @property + def _unvalidated_requires(self) -> list[Requirement]: + return [Requirement(req) for req in self.data.get("requires", [])] + + @property + def _unvalidated_requires_typeshed(self) -> list[Requirement]: + typeshed = uploaded_packages.read() + return [ + r for r in self._unvalidated_requires if canonical_name(r.name) in typeshed + ] + + @functools.cached_property + def requires_typeshed(self) -> list[Requirement]: + reqs = self._unvalidated_requires_typeshed + for req in reqs: + verify_typeshed_req(req) + return reqs + + @property + def _unvalidated_requires_external(self) -> list[Requirement]: + typeshed = uploaded_packages.read() + return [ + r + for r in self._unvalidated_requires + if canonical_name(r.name) not in typeshed + ] + + @functools.cached_property + def requires_external(self) -> list[Requirement]: + reqs = self._unvalidated_requires_external + for req in reqs: + verify_external_req(req, self.upstream_distribution) + return reqs + + @property + def extra_description(self) -> str: + return self.data.get("extra_description", "") + + @property + def obsolete_since(self) -> Optional[str]: + return self.data.get("obsolete_since") + + @property + def no_longer_updated(self) -> bool: + return self.data.get("no_longer_updated", False) + + +def read_metadata(typeshed_dir: str, distribution: str) -> Metadata: + """Parse metadata from file.""" + assert not distribution.startswith(TYPES_PREFIX) + path = os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE, distribution, META) + with open(path, "rb") as f: + data = tomli.load(f) + return Metadata(distribution=distribution, data=data) + + +def canonical_name(name: str) -> str: + # https://peps.python.org/pep-0503/#normalized-names + return re.sub(r"[-_.]+", "-", name).lower() + + +class _UploadedPackages: + def __init__(self, file_path: str) -> None: + self._file_path = file_path + self._cached: Optional[list[str]] = None + + def read(self) -> set[str]: + if self._cached is not None: + return set(map(canonical_name, self._cached)) + with open(self._file_path) as f: + self._cached = f.read().splitlines() + return set(map(canonical_name, self._cached)) + + def add(self, distribution: str) -> None: + assert not distribution.startswith(TYPES_PREFIX) + stub_dist = TYPES_PREFIX + distribution + if canonical_name(stub_dist) not in self.read(): + with open(self._file_path) as f: + current = f.read().splitlines() + current.append(stub_dist) + current.sort() + with open(self._file_path, "w") as f: + f.write("\n".join(current)) + self._cached = None + + +uploaded_packages = _UploadedPackages(UPLOADED_PATH) + + +def strip_types_prefix(dependency: str) -> str: + if not dependency.startswith(TYPES_PREFIX): + raise ValueError("Expected dependency on a typeshed package") + return dependency.removeprefix(TYPES_PREFIX) + + +def verify_typeshed_req(req: Requirement) -> None: + if not req.name.startswith(TYPES_PREFIX): + raise InvalidRequires(f"Expected dependency {req} to start with {TYPES_PREFIX}") + + if not canonical_name(req.name) in uploaded_packages.read(): + raise InvalidRequires( + f"Expected dependency {req} to be uploaded from stub_uploader" + ) + + # TODO: make sure that if a typeshed distribution depends on other typeshed stubs, + # the upstream depends on the upstreams corresponding to those stubs. + # See https://github.com/typeshed-internal/stub_uploader/pull/61#discussion_r979327370 + + +# Presence in the top 1000 PyPI packages could be a necessary but not sufficient criterion for +# inclusion in this allowlist. +# Note we could loosen our criteria once we address: +# https://github.com/typeshed-internal/stub_uploader/pull/61#discussion_r979327370 +EXTERNAL_REQ_ALLOWLIST = { + "numpy", + "cryptography", + "torch", +} + + +def verify_external_req( + req: Requirement, + upstream_distribution: Optional[str], + _unsafe_ignore_allowlist: bool = False, # used for tests +) -> None: + if canonical_name(req.name) in uploaded_packages.read(): + raise InvalidRequires( + f"Expected dependency {req} to not be uploaded from stub_uploader" + ) + if req.name.startswith(TYPES_PREFIX): + # technically this could be allowed, but it's very suspicious + raise InvalidRequires( + f"Expected dependency {req} to not start with {TYPES_PREFIX}" + ) + + if upstream_distribution is None: + raise InvalidRequires( + f"There is no upstream distribution on PyPI, so cannot verify {req}" + ) + + resp = requests.get(f"https://pypi.org/pypi/{upstream_distribution}/json") + if resp.status_code != 200: + raise InvalidRequires( + f"Expected dependency {req} to be accessible on PyPI, but got {resp.status_code}" + ) + + data = resp.json() + + # TODO: consider allowing external dependencies for stubs for packages that do not ship wheels. + # Note that we can't build packages from sdists, since that can execute arbitrary code. + # We could do some hacky setup.py parsing though... + # TODO: PyPI doesn't seem to have version specific requires_dist. This does mean we can be + # broken by new releases of upstream packages, even if they do not match the version spec we + # have for the upstream distribution. + if req.name not in [ + Requirement(r).name for r in (data["info"].get("requires_dist") or []) + ]: + raise InvalidRequires( + f"Expected dependency {req} to be listed in {upstream_distribution}'s requires_dist" + ) + + if req.name not in EXTERNAL_REQ_ALLOWLIST and not _unsafe_ignore_allowlist: + raise InvalidRequires( + f"Expected dependency {req} to be present in the allowlist" + ) + + +def sort_by_dependency(typeshed_dir: str, distributions: list[str]) -> Iterator[str]: + # Just a simple topological sort. Unlike previous versions of the code, we do not rely + # on this to perform validation, like requiring the graph to be complete. + # We only use this to help with edge cases like multiple packages being uploaded + # for the first time that depend on each other. + ts: graphlib.TopologicalSorter[str] = graphlib.TopologicalSorter() + + for dist in os.listdir(os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE)): + metadata = read_metadata(typeshed_dir, dist) + ts.add( + metadata.stub_distribution, + # Use _unvalidated_requires instead of requires_typeshed, in case we're uploading + # a new package B that depends on another new package A. Sorting topologically means + # that the A will be in uploaded_packages.txt by the time it comes to verify and + # upload B. + *[r.name for r in metadata._unvalidated_requires], + ) + + order = [strip_types_prefix(dist) for dist in ts.static_order()] + missing = set(distributions) - set(order) + assert not missing, f"Failed to find distributions {missing}" + + for dist in order: + if dist in distributions: + yield dist + + +def recursive_verify(metadata: Metadata, typeshed_dir: str) -> set[str]: + # While metadata.requires_typeshed and metadata.requires_external will perform validation on the + # stub distribution itself, it seems useful to be able to validate the transitive typeshed + # dependency graph for a stub distribution + _verified: set[str] = set() + + def _verify(metadata: Metadata) -> None: + if metadata.stub_distribution in _verified: + return + _verified.add(metadata.stub_distribution) + + # calling these checks metadata's requires + assert isinstance(metadata.requires_typeshed, list) + assert isinstance(metadata.requires_external, list) + + # and recursively verify all our internal dependencies as well + for req in metadata.requires_typeshed: + _verify(read_metadata(typeshed_dir, strip_types_prefix(req.name))) + + _verify(metadata) + return _verified diff --git a/stub-uploader/scripts/update_changelog.py b/stub-uploader/stub_uploader/update_changelog.py similarity index 97% rename from stub-uploader/scripts/update_changelog.py rename to stub-uploader/stub_uploader/update_changelog.py index a3ad71a..1fb597d 100755 --- a/stub-uploader/scripts/update_changelog.py +++ b/stub-uploader/stub_uploader/update_changelog.py @@ -9,11 +9,9 @@ import os import re import subprocess -from dataclasses import dataclass from pathlib import Path -from scripts.const import CHANGELOG_PATH - +from stub_uploader.const import CHANGELOG_PATH THIRD_PARTY_NAMESPACE = "stubs" diff --git a/stub-uploader/stub_uploader/upload.py b/stub-uploader/stub_uploader/upload.py new file mode 100644 index 0000000..cb00374 --- /dev/null +++ b/stub-uploader/stub_uploader/upload.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +import os +import subprocess + +from stub_uploader import build_wheel +from stub_uploader.get_version import determine_incremented_version +from stub_uploader.update_changelog import update_changelog +from stub_uploader.metadata import ( + read_metadata, + recursive_verify, + sort_by_dependency, + uploaded_packages, +) + + +def upload( + typeshed_dir: str, + distributions: list[str], + commit: str | None = None, + *, + dry_run: bool = False, +) -> None: + to_upload = sort_by_dependency(typeshed_dir, distributions) + print("Building and uploading stubs for:", ", ".join(distributions)) + print() + for distribution in to_upload: + print(f"Building stubs for {distribution}... ", end="") + metadata = read_metadata(typeshed_dir, distribution) + recursive_verify(metadata, typeshed_dir) + + version = determine_incremented_version(metadata) + if commit: + update_changelog( + typeshed_dir, commit, distribution, version, dry_run=dry_run + ) + + temp_dir = build_wheel.main(typeshed_dir, distribution, version) + print(f"ok, version {version}") + + print(f"Uploading stubs for {distribution}... ", end="") + if dry_run: + print(f"skipped") + else: + subprocess.run(["twine", "upload", os.path.join(temp_dir, "*")], check=True) + uploaded_packages.add(distribution) + print(f"ok") + print() diff --git a/stub-uploader/stub_uploader/upload_changed.py b/stub-uploader/stub_uploader/upload_changed.py new file mode 100644 index 0000000..3fe0b31 --- /dev/null +++ b/stub-uploader/stub_uploader/upload_changed.py @@ -0,0 +1,39 @@ +""" +Entry point for scheduled GitHub auto-upload action. + +This does following things: +* Reads the list of stub packages modified since last commit in typeshed +* Checks what is the current stub version increment for each package on PyPI +* Bumps the increment, builds and uploads (unless run with --dry-run) each + new package to PyPI +* Verifies validity of stub dependencies, and updates known dependencies if needed +""" + +import argparse +import os +from stub_uploader import get_changed +from stub_uploader.upload import upload + + +def main(typeshed_dir: str, commit: str, dry_run: bool = False) -> None: + """Upload stub typeshed packages modified since commit.""" + changed = get_changed.main(typeshed_dir, commit) + # Ignore those distributions that were completely deleted. + current = set(os.listdir(os.path.join(typeshed_dir, "stubs"))) + changed = [d for d in changed if d in current] + upload(typeshed_dir, changed, commit, dry_run=dry_run) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") + parser.add_argument( + "previous_commit", help="Previous typeshed commit for which we performed upload" + ) + parser.add_argument( + "--dry-run", + action="store_true", + help="Should we perform a dry run (don't actually upload)", + ) + args = parser.parse_args() + main(args.typeshed_dir, args.previous_commit, args.dry_run) diff --git a/stub-uploader/stub_uploader/upload_some.py b/stub-uploader/stub_uploader/upload_some.py new file mode 100644 index 0000000..2ba6131 --- /dev/null +++ b/stub-uploader/stub_uploader/upload_some.py @@ -0,0 +1,37 @@ +""" +Entry point for manual GitHub upload action. + +This does following things: +* Finds all distributions with names that match the pattern provided +* Checks what is the current stub version increment for each package on PyPI +* Bumps the increment, builds and uploads the each new package to PyPI +* Verifies validity of stub dependencies, and updates known dependencies if needed +""" + +import argparse +import os +import re + +from stub_uploader.upload import upload + + +def main(typeshed_dir: str, pattern: str) -> None: + """Force upload typeshed stub packages to PyPI.""" + compiled = re.compile(f"^{pattern}$") # force exact matches + matching = [ + d + for d in os.listdir(os.path.join(typeshed_dir, "stubs")) + if re.match(compiled, d) + ] + # TODO: Update changelog by providing the "commit" argument + upload(typeshed_dir, matching) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("typeshed_dir", help="Path to typeshed checkout directory") + parser.add_argument( + "pattern", help="Regular expression to select distributions for upload" + ) + args = parser.parse_args() + main(args.typeshed_dir, args.pattern) diff --git a/stub-uploader/tests/test_integration.py b/stub-uploader/tests/test_integration.py index 01de611..025c4cb 100644 --- a/stub-uploader/tests/test_integration.py +++ b/stub-uploader/tests/test_integration.py @@ -4,28 +4,37 @@ a typeshed checkout side by side. """ import os + import pytest -from scripts import get_version, build_wheel -from scripts.metadata import read_metadata +from packaging.requirements import Requirement +from packaging.version import Version + +from stub_uploader import build_wheel, get_version +from stub_uploader.const import THIRD_PARTY_NAMESPACE +from stub_uploader.metadata import ( + InvalidRequires, + Metadata, + read_metadata, + recursive_verify, + sort_by_dependency, + strip_types_prefix, + verify_external_req, + verify_typeshed_req, +) TYPESHED = "../typeshed" -UPLOADED = "data/uploaded_packages.txt" -def test_version() -> None: +def test_fetch_pypi_versions() -> None: """Check that we can query PyPI for package increments.""" - assert get_version.main(TYPESHED, "six", "0.1") >= 0 - assert get_version.main(TYPESHED, "nonexistent-distribution", "0.1") == -1 - assert get_version.main(TYPESHED, "typed-ast", "0.1") == -1 - assert get_version.main(TYPESHED, "typed-ast", None) >= 0 - - -def test_check_exists() -> None: - assert get_version.check_exists("six") - assert not get_version.check_exists("nonexistent-distribution") + assert Version("1.16.0") in get_version.fetch_pypi_versions("types-six") + assert Version("1.5.4") in get_version.fetch_pypi_versions("types-typed-ast") + assert not get_version.fetch_pypi_versions("types-nonexistent-distribution") -@pytest.mark.parametrize("distribution", os.listdir(os.path.join(TYPESHED, "stubs"))) +@pytest.mark.parametrize( + "distribution", os.listdir(os.path.join(TYPESHED, THIRD_PARTY_NAMESPACE)) +) def test_build_wheel(distribution: str) -> None: """Check that we can build wheels for all distributions.""" tmp_dir = build_wheel.main(TYPESHED, distribution, version="1.1.1") @@ -33,30 +42,98 @@ def test_build_wheel(distribution: str) -> None: assert list(os.listdir(tmp_dir)) # check it is not empty -def test_verify_dependency() -> None: - # Check some known dependencies that they verify as valid. - build_wheel.verify_dependency(TYPESHED, "types-six", UPLOADED) - build_wheel.verify_dependency(TYPESHED, "types-six==0.1.1", UPLOADED) - build_wheel.verify_dependency(TYPESHED, "types-typed-ast", UPLOADED) - build_wheel.verify_dependency(TYPESHED, "types-typed-ast>=3.7", UPLOADED) - # Also check couple errors. - with pytest.raises(AssertionError): - build_wheel.verify_dependency(TYPESHED, "unsupported", UPLOADED) - with pytest.raises(AssertionError): - build_wheel.verify_dependency(TYPESHED, "types-unknown-xxx", UPLOADED) +@pytest.mark.parametrize( + "distribution", os.listdir(os.path.join(TYPESHED, THIRD_PARTY_NAMESPACE)) +) +def test_version_increment(distribution: str) -> None: + get_version.determine_incremented_version(read_metadata(TYPESHED, distribution)) + + +def test_unvalidated_properties() -> None: + m = Metadata("fake", {"version": "0.1", "requires": ["numpy", "types-six>=0.1"]}) + assert [r.name for r in m._unvalidated_requires] == ["numpy", "types-six"] + assert [r.name for r in m._unvalidated_requires_external] == ["numpy"] + assert [r.name for r in m._unvalidated_requires_typeshed] == ["types-six"] + + +def test_verify_typeshed_req() -> None: + # Check that some known dependencies verify as valid. + verify_typeshed_req(Requirement("types-six")) + verify_typeshed_req(Requirement("types-six==0.1.1")) + verify_typeshed_req(Requirement("types-typed-ast")) + verify_typeshed_req(Requirement("types-typed-ast>=3.7")) + + with pytest.raises(InvalidRequires, match="to start with types-"): + verify_typeshed_req(Requirement("unsupported")) + + with pytest.raises(InvalidRequires, match="to be uploaded from stub_uploader"): + verify_typeshed_req(Requirement("types-unknown-xxx")) + + m = Metadata("mypy", {"version": "0.1", "requires": ["types-unknown-xxx"]}) + assert m.requires_typeshed == [] + + +def test_verify_external_req() -> None: + # Check that some known dependencies verify as valid. + verify_external_req( + Requirement("typing-extensions"), "mypy", _unsafe_ignore_allowlist=True + ) + verify_external_req( + Requirement("mypy-extensions"), "mypy", _unsafe_ignore_allowlist=True + ) + + with pytest.raises(InvalidRequires, match="to be present in the allowlist"): + verify_external_req(Requirement("typing-extensions"), "mypy") + + m = Metadata("pandas", {"version": "0.1", "requires": ["numpy"]}) + assert [r.name for r in m.requires_external] == ["numpy"] + + with pytest.raises(InvalidRequires, match="to be listed in mypy's requires_dist"): + verify_external_req(Requirement("numpy"), "mypy") + + with pytest.raises(InvalidRequires, match="to not be uploaded from stub_uploader"): + verify_external_req(Requirement("types-typed-ast"), "mypy") + + with pytest.raises(InvalidRequires, match="to not start with types-"): + verify_external_req(Requirement("types-unknown-xxx"), "mypy") + + m = Metadata("mypy", {"version": "0.1", "requires": ["numpy"]}) + with pytest.raises(InvalidRequires, match="to be listed in mypy's requires_dist"): + m.requires_external + with pytest.raises(InvalidRequires, match="to be listed in mypy's requires_dist"): + recursive_verify(m, TYPESHED) + + # TODO: change tests once METADATA.toml specifies whether a dist is on PyPI + m = Metadata("gdb", {"version": "0.1", "requires": []}) + assert m.requires_external == [] + + m = Metadata("gdb", {"version": "0.1", "requires": ["something"]}) + with pytest.raises(InvalidRequires, match="no upstream distribution on PyPI"): + m.requires_external def test_dependency_order() -> None: - """Test that all packages are correctly sorted by dependency.""" + """Test sort_by_dependency correctly sorts all packages by dependency.""" distributions = os.listdir(os.path.join(TYPESHED, "stubs")) - to_upload = build_wheel.sort_by_dependency( - build_wheel.make_dependency_map(TYPESHED, distributions) - ) + to_upload = list(sort_by_dependency(TYPESHED, distributions)) assert len(set(to_upload)) == len(to_upload) for distribution in distributions: - for dependency in read_metadata(TYPESHED, distribution).get("requires", []): - assert to_upload.index( - build_wheel.strip_types_prefix( - get_version.strip_dep_version(dependency) - ) - ) < to_upload.index(distribution) + for req in read_metadata(TYPESHED, distribution).requires_typeshed: + assert to_upload.index(strip_types_prefix(req.name)) < to_upload.index( + distribution + ) + + +def test_recursive_verify_single() -> None: + m = read_metadata(TYPESHED, "six") + assert recursive_verify(m, TYPESHED) == {"types-six"} + + m = read_metadata(TYPESHED, "tzlocal") + assert recursive_verify(m, TYPESHED) == {"types-tzlocal", "types-pytz"} + + +@pytest.mark.parametrize( + "distribution", os.listdir(os.path.join(TYPESHED, THIRD_PARTY_NAMESPACE)) +) +def test_recursive_verify(distribution: str) -> None: + recursive_verify(read_metadata(TYPESHED, distribution), TYPESHED) diff --git a/stub-uploader/tests/test_unit.py b/stub-uploader/tests/test_unit.py index 3a9b9be..f5b1981 100644 --- a/stub-uploader/tests/test_unit.py +++ b/stub-uploader/tests/test_unit.py @@ -1,113 +1,80 @@ """Unit tests for simple helpers should go here.""" import os +import tempfile + import pytest -from scripts.get_version import strip_dep_version -from scripts.build_wheel import ( - collect_setup_entries, - sort_by_dependency, - transitive_deps, - strip_types_prefix, - BuildData, - SUFFIX, - PY2_SUFFIX, -) +from packaging.version import Version + +from stub_uploader.build_wheel import collect_setup_entries +from stub_uploader.get_version import compute_incremented_version, ensure_specificity +from stub_uploader.metadata import _UploadedPackages, strip_types_prefix def test_strip_types_prefix() -> None: assert strip_types_prefix("types-foo") == "foo" - with pytest.raises(AssertionError): + with pytest.raises(ValueError): strip_types_prefix("bad") -def test_strip_version() -> None: - assert strip_dep_version("foo") == "foo" - assert strip_dep_version("types-foo") == "types-foo" - assert strip_dep_version("foo==1.1") == "foo" - assert strip_dep_version("types-foo==1.1") == "types-foo" - assert strip_dep_version("foo>2.3") == "foo" - assert strip_dep_version("types-foo>2.3") == "types-foo" - - -def test_transitive_deps() -> None: - with pytest.raises(KeyError): - # We require the graph to be complete for safety. - transitive_deps({"1": {"2"}}) - assert transitive_deps({"1": {"2"}, "2": set()}) == {"1": {"2"}, "2": set()} - with pytest.raises(AssertionError): - transitive_deps({"1": {"1"}}) - with pytest.raises(AssertionError): - transitive_deps({"1": {"2"}, "2": {"3"}, "3": {"1"}}) - assert transitive_deps({"1": {"2"}, "2": {"3"}, "3": {"4"}, "4": set()}) == ( - {"1": {"2", "3", "4"}, "2": {"3", "4"}, "3": {"4"}, "4": set()} - ) - assert transitive_deps( - { - "1": {"2", "3"}, - "2": {"2a", "2b"}, - "3": {"3a", "3b"}, - "2a": set(), - "2b": set(), - "3a": set(), - "3b": set(), - } - ) == ( - { - "1": {"2", "2a", "2b", "3", "3a", "3b"}, - "2": {"2a", "2b"}, - "3": {"3a", "3b"}, - "2a": set(), - "2b": set(), - "3a": set(), - "3b": set(), - } - ) +def test_ensure_specificity() -> None: + ver = [1] + ensure_specificity(ver, 3) + assert ver == [1, 0, 0] + ver = [1, 2, 3] + ensure_specificity(ver, 3) + assert ver == [1, 2, 3] -def test_sort_by_dependency() -> None: - with pytest.raises(KeyError): - # We require the graph to be complete for safety. - sort_by_dependency({"1": {"2"}}) - assert sort_by_dependency({"1": {"2"}, "2": set()}) == ["2", "1"] - with pytest.raises(AssertionError): - sort_by_dependency({"1": {"1"}}) - with pytest.raises(AssertionError): - sort_by_dependency({"1": {"2"}, "2": {"3"}, "3": {"1"}}) - # Independent are in alphabetic order. - assert sort_by_dependency({"2": set(), "1": set()}) == ["1", "2"] - assert sort_by_dependency({"1": {"2"}, "2": {"3"}, "3": {"4"}, "4": set()}) == [ - "4", - "3", - "2", - "1", - ] - assert ( - sort_by_dependency( - { - "1": {"2", "3"}, - "2": {"2a", "2b"}, - "3": {"3a", "3b"}, - "2a": set(), - "2b": set(), - "3a": set(), - "3b": set(), - } - ) - == ["2a", "2b", "2", "3a", "3b", "3", "1"] - ) + ver = [1, 2, 3, 4, 5] + ensure_specificity(ver, 3) + assert ver == [1, 2, 3, 4, 5] + + +def _incremented_ver(ver: str, published: list[str]) -> str: + published_vers = [Version(v) for v in published] + return str(compute_incremented_version(ver, published_vers)) + + +def test_compute_incremented_version() -> None: + # never before published version + empty_list: list[str] = [] + assert _incremented_ver("1", empty_list) == "1.0.0.0" + assert _incremented_ver("1.2", empty_list) == "1.2.0.0" + + # published greater than version spec + assert _incremented_ver("1.2", ["1.3.0.4"]) == "1.3.0.5" + assert _incremented_ver("1.1", ["1.2.0.1"]) == "1.2.0.2" + assert _incremented_ver("1.1", ["1.2"]) == "1.2.0.1" + assert _incremented_ver("1.1", ["1.2.3"]) == "1.2.3.1" + assert _incremented_ver("1.1", ["1.2.3.4.5"]) == "1.2.3.4.6" + assert _incremented_ver("1.4.40", ["1.4.50"]) == "1.4.50.1" + assert _incremented_ver("1.4.0.40", ["1.4.0.50"]) == "1.4.0.50.1" + + # published less than version spec + assert _incremented_ver("1.2", ["1.1.0.4"]) == "1.2.0.0" + assert _incremented_ver("1", ["0.9"]) == "1.0.0.0" + assert _incremented_ver("1.1", ["0.9"]) == "1.1.0.0" + assert _incremented_ver("1.2.3", ["1.1.0.17"]) == "1.2.3.0" + assert _incremented_ver("1.2.3.4", ["1.1.0.17"]) == "1.2.3.4.0" + + # published equals version spec + assert _incremented_ver("1.1", ["1.1"]) == "1.1.0.1" + assert _incremented_ver("1.1", ["1.1.0.4"]) == "1.1.0.5" + assert _incremented_ver("1.1", ["1.1.3.4"]) == "1.1.3.5" + assert _incremented_ver("1.2.3.4", ["1.2.3.4.5"]) == "1.2.3.4.6" + assert _incremented_ver("1.2.3.4.5", ["1.2.3.4.5"]) == "1.2.3.4.5.1" + + # test that we do the max version right + assert _incremented_ver("1.2", ["1.1.0.7", "1.2.0.7", "1.3.0.7"]) == "1.3.0.8" def test_collect_setup_entries() -> None: stubs = os.path.join("data", "test_typeshed", "stubs") - entries = collect_setup_entries(os.path.join(stubs, "singlefilepkg"), SUFFIX) + entries = collect_setup_entries(os.path.join(stubs, "singlefilepkg")) assert entries == ({"singlefilepkg-stubs": ["__init__.pyi", "METADATA.toml"]}) - entries = collect_setup_entries(os.path.join(stubs, "singlefilepkg"), PY2_SUFFIX) - assert entries == ( - {"singlefilepkg-python2-stubs": ["__init__.pyi", "METADATA.toml"]} - ) - - entries = collect_setup_entries(os.path.join(stubs, "multifilepkg"), SUFFIX) + entries = collect_setup_entries(os.path.join(stubs, "multifilepkg")) assert entries == ( { "multifilepkg-stubs": [ @@ -122,7 +89,7 @@ def test_collect_setup_entries() -> None: } ) - entries = collect_setup_entries(os.path.join(stubs, "nspkg"), SUFFIX) + entries = collect_setup_entries(os.path.join(stubs, "nspkg")) assert entries == ( { "nspkg-stubs": [ @@ -133,30 +100,39 @@ def test_collect_setup_entries() -> None: ) -def test_build_data() -> None: - typeshed = os.path.join("data", "test_typeshed") - singlefilepkg_bd = BuildData(typeshed, "singlefilepkg") - assert singlefilepkg_bd.py3_stubs - assert not singlefilepkg_bd.py2_stubs - nspkg_bd = BuildData(typeshed, "nspkg") - assert nspkg_bd.py3_stubs - assert not nspkg_bd.py2_stubs - - def test_collect_setup_entries_bogusfile() -> None: stubs = os.path.join("data", "test_typeshed", "stubs") with pytest.raises(ValueError, match="Only stub files are allowed: bogusfile.txt"): - collect_setup_entries(os.path.join(stubs, "bogusfiles"), SUFFIX) + collect_setup_entries(os.path.join(stubs, "bogusfiles")) # Make sure gitignored files aren't collected, nor do they crash function with open(os.path.join(stubs, "singlefilepkg", ".METADATA.toml.swp"), "w"): pass - entries = collect_setup_entries(os.path.join(stubs, "singlefilepkg"), SUFFIX) + entries = collect_setup_entries(os.path.join(stubs, "singlefilepkg")) assert len(entries["singlefilepkg-stubs"]) == 2 with open( os.path.join(stubs, "multifilepkg", "multifilepkg", ".METADATA.toml.swp"), "w" ): pass - entries = collect_setup_entries(os.path.join(stubs, "multifilepkg"), SUFFIX) + entries = collect_setup_entries(os.path.join(stubs, "multifilepkg")) assert len(entries["multifilepkg-stubs"]) == 7 + + +def test_uploaded_packages() -> None: + with tempfile.TemporaryDirectory() as td: + file_path = os.path.join(td, "uploaded_packages.txt") + with open(file_path, "w") as f: + f.write("types-SqLaLcHeMy\n") + + up = _UploadedPackages(file_path) + assert up.read() == {"types-sqlalchemy"} + + up.add("SQLAlchemy") + assert up.read() == {"types-sqlalchemy"} + + up.add("six") + assert up.read() == {"types-sqlalchemy", "types-six"} + + with open(file_path) as f: + assert f.read() == "types-SqLaLcHeMy\ntypes-six" diff --git a/stubs/D3DShot/METADATA.toml b/stubs/D3DShot/METADATA.toml new file mode 100644 index 0000000..d6bdd1b --- /dev/null +++ b/stubs/D3DShot/METADATA.toml @@ -0,0 +1,7 @@ +version = "0.1.*" +requires = ["types-Pillow"] + +[tool.stubtest] +# The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI. +# See #8660 +skip = true diff --git a/stubs/D3DShot/d3dshot/__init__.pyi b/stubs/D3DShot/d3dshot/__init__.pyi new file mode 100644 index 0000000..17f1dd8 --- /dev/null +++ b/stubs/D3DShot/d3dshot/__init__.pyi @@ -0,0 +1,12 @@ +from d3dshot.capture_output import CaptureOutputs as CaptureOutputs +from d3dshot.d3dshot import D3DShot as D3DShot + +pil_is_available: bool +numpy_is_available: bool +pytorch_is_available: bool +pytorch_gpu_is_available: bool +capture_output_mapping: dict[str, CaptureOutputs] +capture_outputs: list[str] + +def determine_available_capture_outputs() -> list[CaptureOutputs]: ... +def create(capture_output: str = ..., frame_buffer_size: int = ...) -> D3DShot: ... diff --git a/stubs/D3DShot/d3dshot/capture_output.pyi b/stubs/D3DShot/d3dshot/capture_output.pyi new file mode 100644 index 0000000..aa68b09 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_output.pyi @@ -0,0 +1,44 @@ +import enum +from _typeshed import Incomplete +from collections.abc import Sequence +from ctypes import _CVoidConstPLike +from typing_extensions import Literal, TypeAlias + +from PIL import Image + +_Frame: TypeAlias = Image.Image | Incomplete +# TODO: Complete types once we can import non-types dependencies +# See: #5768 +# from torch import Tensor +# from comtypes import IUnknown +# import numpy.typing as npt +# _Frame: TypeAlias = Image.Image | npt.NDArray[np.int32] | npt.NDArray[np.float32] | Tensor + +class CaptureOutputs(enum.Enum): + PIL: int + NUMPY: int + NUMPY_FLOAT: int + PYTORCH: int + PYTORCH_FLOAT: int + PYTORCH_GPU: int + PYTORCH_FLOAT_GPU: int + +class CaptureOutputError(BaseException): ... + +# All CaptureOutput methods just reference the backend. Making this both a base class and a wrapper. +class CaptureOutput: + # `backend` is a subclass of CaptureOutput based on the CaptureOutputs enum passed to __init__ + backend: CaptureOutput + def __init__(self, backend: CaptureOutputs = ...) -> None: ... + def process( + self, + pointer: _CVoidConstPLike, + pitch: int, + size: int, + width: int, + height: int, + region: tuple[int, int, int, int], + rotation: int, + ) -> _Frame: ... + def to_pil(self, frame: _Frame) -> Image.Image: ... + def stack(self, frames: Sequence[_Frame], stack_dimension: Literal["first", "last"]) -> _Frame: ... diff --git a/stdlib/@python2/distutils/__init__.pyi b/stubs/D3DShot/d3dshot/capture_outputs/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/__init__.pyi rename to stubs/D3DShot/d3dshot/capture_outputs/__init__.pyi diff --git a/stubs/D3DShot/d3dshot/capture_outputs/numpy_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/numpy_capture_output.pyi new file mode 100644 index 0000000..083eeb7 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/numpy_capture_output.pyi @@ -0,0 +1,29 @@ +from _typeshed import Incomplete +from collections.abc import Sequence +from ctypes import _CVoidConstPLike +from typing_extensions import Literal, TypeAlias + +from d3dshot.capture_output import CaptureOutput +from PIL import Image + +# TODO: Complete types once we can import non-types dependencies +# See: #5768 +# import numpy as np +# import numpy.typing as npt +# _NDArray: TypeAlias = npt.NDArray[np.int32] +_NDArray: TypeAlias = Incomplete + +class NumpyCaptureOutput(CaptureOutput): + def __init__(self) -> None: ... + def process( + self, + pointer: _CVoidConstPLike, + pitch: int, + size: int, + width: int, + height: int, + region: tuple[int, int, int, int], + rotation: int, + ) -> _NDArray: ... + def to_pil(self, frame: _NDArray) -> Image.Image: ... + def stack(self, frames: Sequence[_NDArray] | _NDArray, stack_dimension: Literal["first", "last"]) -> _NDArray: ... diff --git a/stubs/D3DShot/d3dshot/capture_outputs/numpy_float_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/numpy_float_capture_output.pyi new file mode 100644 index 0000000..49d4e5d --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/numpy_float_capture_output.pyi @@ -0,0 +1,5 @@ +from d3dshot.capture_outputs.numpy_capture_output import NumpyCaptureOutput + +# TODO: Once we can import non-types dependencies, this CaptureOutput should be float based +# See: #5768 +class NumpyFloatCaptureOutput(NumpyCaptureOutput): ... diff --git a/stubs/D3DShot/d3dshot/capture_outputs/pil_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/pil_capture_output.pyi new file mode 100644 index 0000000..0a593d7 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/pil_capture_output.pyi @@ -0,0 +1,25 @@ +from collections.abc import Sequence +from ctypes import _CVoidConstPLike +from typing import TypeVar +from typing_extensions import TypeAlias + +from d3dshot.capture_output import CaptureOutput +from PIL import Image + +_Unused: TypeAlias = object +_ImageT = TypeVar("_ImageT", bound=Image.Image) + +class PILCaptureOutput(CaptureOutput): + def __init__(self) -> None: ... + def process( + self, + pointer: _CVoidConstPLike, + pitch: int, + size: int, + width: int, + height: int, + region: tuple[int, int, int, int], + rotation: int, + ) -> Image.Image: ... + def to_pil(self, frame: _ImageT) -> _ImageT: ... + def stack(self, frames: Sequence[_ImageT], stack_dimension: _Unused) -> Sequence[_ImageT]: ... diff --git a/stubs/D3DShot/d3dshot/capture_outputs/pytorch_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_capture_output.pyi new file mode 100644 index 0000000..4498bd5 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_capture_output.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete +from collections.abc import Sequence +from ctypes import _CVoidConstPLike +from typing_extensions import Literal, TypeAlias + +from d3dshot.capture_output import CaptureOutput +from PIL import Image + +# TODO: Complete types once we can import non-types dependencies +# See: https://github.com/python/typeshed/issues/5768 +# from torch import Tensor +_Tensor: TypeAlias = Incomplete + +class PytorchCaptureOutput(CaptureOutput): + def __init__(self) -> None: ... + def process( + self, + pointer: _CVoidConstPLike, + pitch: int, + size: int, + width: int, + height: int, + region: tuple[int, int, int, int], + rotation: int, + ) -> _Tensor: ... + def to_pil(self, frame: _Tensor) -> Image.Image: ... + def stack(self, frames: Sequence[_Tensor], stack_dimension: Literal["first", "last"]) -> _Tensor: ... diff --git a/stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_capture_output.pyi new file mode 100644 index 0000000..53e7a73 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_capture_output.pyi @@ -0,0 +1,3 @@ +from d3dshot.capture_outputs.pytorch_capture_output import PytorchCaptureOutput + +class PytorchFloatCaptureOutput(PytorchCaptureOutput): ... diff --git a/stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_gpu_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_gpu_capture_output.pyi new file mode 100644 index 0000000..2e7c6c1 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_float_gpu_capture_output.pyi @@ -0,0 +1,3 @@ +from d3dshot.capture_outputs.pytorch_gpu_capture_output import PytorchGPUCaptureOutput + +class PytorchFloatGPUCaptureOutput(PytorchGPUCaptureOutput): ... diff --git a/stubs/D3DShot/d3dshot/capture_outputs/pytorch_gpu_capture_output.pyi b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_gpu_capture_output.pyi new file mode 100644 index 0000000..d78cc60 --- /dev/null +++ b/stubs/D3DShot/d3dshot/capture_outputs/pytorch_gpu_capture_output.pyi @@ -0,0 +1,3 @@ +from d3dshot.capture_outputs.pytorch_capture_output import PytorchCaptureOutput + +class PytorchGPUCaptureOutput(PytorchCaptureOutput): ... diff --git a/stubs/D3DShot/d3dshot/d3dshot.pyi b/stubs/D3DShot/d3dshot/d3dshot.pyi new file mode 100644 index 0000000..5424517 --- /dev/null +++ b/stubs/D3DShot/d3dshot/d3dshot.pyi @@ -0,0 +1,45 @@ +from collections import deque +from collections.abc import Iterable + +from d3dshot.capture_output import CaptureOutput as CaptureOutput, CaptureOutputs as CaptureOutputs, _Frame +from d3dshot.display import Display as Display + +class Singleton(type): ... + +class D3DShot(metaclass=Singleton): + displays: list[Display] + display: Display + capture_output: CaptureOutput + frame_buffer_size: int + frame_buffer: deque[_Frame] + previous_screenshot: _Frame | None + region: tuple[int, int, int, int] | None + + def __init__( + self, + capture_output: CaptureOutputs = ..., + frame_buffer_size: int = ..., + pil_is_available: bool = ..., + numpy_is_available: bool = ..., + pytorch_is_available: bool = ..., + pytorch_gpu_is_available: bool = ..., + ) -> None: ... + @property + def is_capturing(self) -> bool: ... + def get_latest_frame(self) -> _Frame | None: ... + def get_frame(self, frame_index: int) -> _Frame | None: ... + def get_frames(self, frame_indices: Iterable[int]) -> list[_Frame]: ... + def get_frame_stack(self, frame_indices: Iterable[int], stack_dimension: str | None = ...) -> _Frame: ... + def screenshot(self, region: tuple[int, int, int, int] | None = ...) -> _Frame | None: ... + def screenshot_to_disk( + self, directory: str | None = ..., file_name: str | None = ..., region: tuple[int, int, int, int] | None = ... + ) -> str: ... + def frame_buffer_to_disk(self, directory: str | None = ...) -> None: ... + def capture(self, target_fps: int = ..., region: tuple[int, int, int, int] | None = ...) -> bool: ... + def screenshot_every(self, interval: float, region: tuple[int, int, int, int] | None = ...) -> bool: ... + def screenshot_to_disk_every( + self, interval: float, directory: str | None = ..., region: tuple[int, int, int, int] | None = ... + ) -> bool: ... + def stop(self) -> bool: ... + def benchmark(self) -> None: ... + def detect_displays(self) -> None: ... diff --git a/stubs/D3DShot/d3dshot/display.pyi b/stubs/D3DShot/d3dshot/display.pyi new file mode 100644 index 0000000..fb30dd2 --- /dev/null +++ b/stubs/D3DShot/d3dshot/display.pyi @@ -0,0 +1,49 @@ +from ctypes import _Pointer +from typing_extensions import TypedDict + +from d3dshot.dll import _ProcessFunc, _ProcessFuncRegionArg, _ProcessFuncReturn +from d3dshot.dll.d3d import ID3D11Device, ID3D11DeviceContext +from d3dshot.dll.dxgi import IDXGIAdapter, IDXGIOutput1, IDXGIOutputDuplication + +class _PositionDict(TypedDict): + left: int + top: int + right: int + bottom: int + +class Display: + name: str + adapter_name: str + resolution: tuple[int, int] + position: _PositionDict + rotation: int + scale_factor: float + is_primary: bool + hmonitor: int + dxgi_output: IDXGIOutput1 | None + dxgi_adapter: _Pointer[IDXGIAdapter] | None + # Note that Display.d3d_device and Display.d3d_device_context can never be None. + # Despite initially being set to None in __init__, + # they're always immediately set in _initialize_dxgi_output_duplication() + d3d_device: ID3D11Device + d3d_device_context: ID3D11DeviceContext + dxgi_output_duplication: _Pointer[IDXGIOutputDuplication] + + def __init__( + self, + name: str | None = ..., + adapter_name: str | None = ..., + resolution: tuple[int, int] | None = ..., + position: _PositionDict | None = ..., + rotation: int | None = ..., + scale_factor: float | None = ..., + is_primary: bool = ..., + hmonitor: int | None = ..., + dxgi_output: IDXGIOutput1 | None = ..., + dxgi_adapter: _Pointer[IDXGIAdapter] | None = ..., + ) -> None: ... + def capture( + self, process_func: _ProcessFunc[_ProcessFuncRegionArg, _ProcessFuncReturn] | None, region: _ProcessFuncRegionArg = ... + ) -> _ProcessFuncReturn: ... + @classmethod + def discover_displays(cls) -> list[Display]: ... diff --git a/stubs/D3DShot/d3dshot/dll/__init__.pyi b/stubs/D3DShot/d3dshot/dll/__init__.pyi new file mode 100644 index 0000000..56e0e35 --- /dev/null +++ b/stubs/D3DShot/d3dshot/dll/__init__.pyi @@ -0,0 +1,28 @@ +import sys +from _typeshed import Incomplete +from collections.abc import Callable +from ctypes import _CData, c_ulong +from ctypes.wintypes import PFLOAT +from typing import TypeVar +from typing_extensions import TypeAlias + +from d3dshot.capture_output import _Frame + +_ProcessFuncRegionArg = TypeVar("_ProcessFuncRegionArg", tuple[int, int, int, int], None) +_ProcessFuncReturn = TypeVar("_ProcessFuncReturn", _Frame, None) +# The _ProcessFunc alias is used in multiple submodules +_ProcessFunc: TypeAlias = Callable[[PFLOAT, int, int, int, int, _ProcessFuncRegionArg, int], _ProcessFuncReturn] # noqa: Y047 + +if sys.platform == "win32": + from ctypes import HRESULT + + _HRESULT: TypeAlias = HRESULT +else: + _HRESULT: TypeAlias = Incomplete + +# TODO: Use comtypes.IUnknown once we can import non-types dependencies +# See: #5768 +class _IUnknown(_CData): + def QueryInterface(self, interface: type, iid: _CData | None = ...) -> _HRESULT: ... + def AddRef(self) -> c_ulong: ... + def Release(self) -> c_ulong: ... diff --git a/stubs/D3DShot/d3dshot/dll/d3d.pyi b/stubs/D3DShot/d3dshot/dll/d3d.pyi new file mode 100644 index 0000000..e412c2d --- /dev/null +++ b/stubs/D3DShot/d3dshot/dll/d3d.pyi @@ -0,0 +1,214 @@ +from ctypes import Structure, _Pointer, c_int32, c_uint, c_void_p +from ctypes.wintypes import FLOAT, UINT + +from d3dshot.dll import _HRESULT, _IUnknown +from d3dshot.dll.dxgi import IDXGIAdapter + +class DXGI_SAMPLE_DESC(Structure): + Count: UINT + Quality: UINT + +class D3D11_BOX(Structure): + left: UINT + top: UINT + front: UINT + right: UINT + bottom: UINT + back: UINT + +class D3D11_TEXTURE2D_DESC(Structure): + Width: UINT + Height: UINT + MipLevels: UINT + ArraySize: UINT + Format: UINT + SampleDesc: DXGI_SAMPLE_DESC + Usage: UINT + BindFlags: UINT + CPUAccessFlags: UINT + MiscFlags: UINT + +class ID3D11DeviceChild(_IUnknown): + def GetDevice(self) -> None: ... + def GetPrivateData(self) -> _HRESULT: ... + def SetPrivateData(self) -> _HRESULT: ... + def SetPrivateDataInterface(self) -> _HRESULT: ... + +class ID3D11Resource(ID3D11DeviceChild): + def GetType(self) -> None: ... + def SetEvictionPriority(self) -> None: ... + def GetEvictionPriority(self) -> UINT: ... + +class ID3D11Texture2D(ID3D11Resource): + def GetDesc(self, __pDesc: _Pointer[D3D11_TEXTURE2D_DESC]) -> None: ... + +class ID3D11DeviceContext(ID3D11DeviceChild): + def VSSetConstantBuffers(self) -> None: ... + def PSSetShaderResources(self) -> None: ... + def PSSetShader(self) -> None: ... + def PSSetSamplers(self) -> None: ... + def VSSetShader(self) -> None: ... + def DrawIndexed(self) -> None: ... + def Draw(self) -> None: ... + def Map(self) -> _HRESULT: ... + def Unmap(self) -> None: ... + def PSSetConstantBuffers(self) -> None: ... + def IASetInputLayout(self) -> None: ... + def IASetVertexBuffers(self) -> None: ... + def IASetIndexBuffer(self) -> None: ... + def DrawIndexedInstanced(self) -> None: ... + def DrawInstanced(self) -> None: ... + def GSSetConstantBuffers(self) -> None: ... + def GSSetShader(self) -> None: ... + def IASetPrimitiveTopology(self) -> None: ... + def VSSetShaderResources(self) -> None: ... + def VSSetSamplers(self) -> None: ... + def Begin(self) -> None: ... + def End(self) -> None: ... + def GetData(self) -> _HRESULT: ... + def SetPredication(self) -> None: ... + def GSSetShaderResources(self) -> None: ... + def GSSetSamplers(self) -> None: ... + def OMSetRenderTargets(self) -> None: ... + def OMSetRenderTargetsAndUnorderedAccessViews(self) -> None: ... + def OMSetBlendState(self) -> None: ... + def OMSetDepthStencilState(self) -> None: ... + def SOSetTargets(self) -> None: ... + def DrawAuto(self) -> None: ... + def DrawIndexedInstancedIndirect(self) -> None: ... + def DrawInstancedIndirect(self) -> None: ... + def Dispatch(self) -> None: ... + def DispatchIndirect(self) -> None: ... + def RSSetState(self) -> None: ... + def RSSetViewports(self) -> None: ... + def RSSetScissorRects(self) -> None: ... + def CopySubresourceRegion( + self, + __pDstResource: _Pointer[ID3D11Resource], + __DstSubresource: UINT, + __DstX: UINT, + __DstY: UINT, + __DstZ: UINT, + __pSrcResource: _Pointer[ID3D11Resource], + __SrcSubresource: UINT, + __pSrcBox: _Pointer[D3D11_BOX], + ) -> None: ... + def CopyResource(self, __pDstResource: _Pointer[ID3D11Resource], __pSrcResource: _Pointer[ID3D11Resource]) -> None: ... + def UpdateSubresource(self) -> None: ... + def CopyStructureCount(self) -> None: ... + def ClearRenderTargetView(self) -> None: ... + def ClearUnorderedAccessViewUint(self) -> None: ... + def ClearUnorderedAccessViewFloat(self) -> None: ... + def ClearDepthStencilView(self) -> None: ... + def GenerateMips(self) -> None: ... + def SetResourceMinLOD(self) -> None: ... + def GetResourceMinLOD(self) -> FLOAT: ... + def ResolveSubresource(self) -> None: ... + def ExecuteCommandList(self) -> None: ... + def HSSetShaderResources(self) -> None: ... + def HSSetShader(self) -> None: ... + def HSSetSamplers(self) -> None: ... + def HSSetConstantBuffers(self) -> None: ... + def DSSetShaderResources(self) -> None: ... + def DSSetShader(self) -> None: ... + def DSSetSamplers(self) -> None: ... + def DSSetConstantBuffers(self) -> None: ... + def CSSetShaderResources(self) -> None: ... + def CSSetUnorderedAccessViews(self) -> None: ... + def CSSetShader(self) -> None: ... + def CSSetSamplers(self) -> None: ... + def CSSetConstantBuffers(self) -> None: ... + def VSGetConstantBuffers(self) -> None: ... + def PSGetShaderResources(self) -> None: ... + def PSGetShader(self) -> None: ... + def PSGetSamplers(self) -> None: ... + def VSGetShader(self) -> None: ... + def PSGetConstantBuffers(self) -> None: ... + def IAGetInputLayout(self) -> None: ... + def IAGetVertexBuffers(self) -> None: ... + def IAGetIndexBuffer(self) -> None: ... + def GSGetConstantBuffers(self) -> None: ... + def GSGetShader(self) -> None: ... + def IAGetPrimitiveTopology(self) -> None: ... + def VSGetShaderResources(self) -> None: ... + def VSGetSamplers(self) -> None: ... + def GetPredication(self) -> None: ... + def GSGetShaderResources(self) -> None: ... + def GSGetSamplers(self) -> None: ... + def OMGetRenderTargets(self) -> None: ... + def OMGetRenderTargetsAndUnorderedAccessViews(self) -> None: ... + def OMGetBlendState(self) -> None: ... + def OMGetDepthStencilState(self) -> None: ... + def SOGetTargets(self) -> None: ... + def RSGetState(self) -> None: ... + def RSGetViewports(self) -> None: ... + def RSGetScissorRects(self) -> None: ... + def HSGetShaderResources(self) -> None: ... + def HSGetShader(self) -> None: ... + def HSGetSamplers(self) -> None: ... + def HSGetConstantBuffers(self) -> None: ... + def DSGetShaderResources(self) -> None: ... + def DSGetShader(self) -> None: ... + def DSGetSamplers(self) -> None: ... + def DSGetConstantBuffers(self) -> None: ... + def CSGetShaderResources(self) -> None: ... + def CSGetUnorderedAccessViews(self) -> None: ... + def CSGetShader(self) -> None: ... + def CSGetSamplers(self) -> None: ... + def CSGetConstantBuffers(self) -> None: ... + def ClearState(self) -> None: ... + def Flush(self) -> None: ... + def GetType(self) -> None: ... + def GetContextFlags(self) -> UINT: ... + def FinishCommandList(self) -> _HRESULT: ... + +class ID3D11Device(_IUnknown): + def CreateBuffer(self) -> _HRESULT: ... + def CreateTexture1D(self) -> _HRESULT: ... + def CreateTexture2D( + self, + __pDesc: _Pointer[D3D11_TEXTURE2D_DESC], + __pInitialData: c_void_p, + __ppTexture2D: _Pointer[_Pointer[ID3D11Texture2D]], + ) -> _HRESULT: ... + def CreateTexture3D(self) -> _HRESULT: ... + def CreateShaderResourceView(self) -> _HRESULT: ... + def CreateUnorderedAccessView(self) -> _HRESULT: ... + def CreateRenderTargetView(self) -> _HRESULT: ... + def CreateDepthStencilView(self) -> _HRESULT: ... + def CreateInputLayout(self) -> _HRESULT: ... + def CreateVertexShader(self) -> _HRESULT: ... + def CreateGeometryShader(self) -> _HRESULT: ... + def CreateGeometryShaderWithStreamOutput(self) -> _HRESULT: ... + def CreatePixelShader(self) -> _HRESULT: ... + def CreateHullShader(self) -> _HRESULT: ... + def CreateDomainShader(self) -> _HRESULT: ... + def CreateComputeShader(self) -> _HRESULT: ... + def CreateClassLinkage(self) -> _HRESULT: ... + def CreateBlendState(self) -> _HRESULT: ... + def CreateDepthStencilState(self) -> _HRESULT: ... + def CreateRasterizerState(self) -> _HRESULT: ... + def CreateSamplerState(self) -> _HRESULT: ... + def CreateQuery(self) -> _HRESULT: ... + def CreatePredicate(self) -> _HRESULT: ... + def CreateCounter(self) -> _HRESULT: ... + def CreateDeferredContext(self) -> _HRESULT: ... + def OpenSharedResource(self) -> _HRESULT: ... + def CheckFormatSupport(self) -> _HRESULT: ... + def CheckMultisampleQualityLevels(self) -> _HRESULT: ... + def CheckCounterInfo(self) -> _HRESULT: ... + def CheckCounter(self) -> _HRESULT: ... + def CheckFeatureSupport(self) -> _HRESULT: ... + def GetPrivateData(self) -> _HRESULT: ... + def SetPrivateData(self) -> _HRESULT: ... + def SetPrivateDataInterface(self) -> _HRESULT: ... + def GetFeatureLevel(self) -> c_int32: ... + def GetCreationFlags(self) -> c_uint: ... + def GetDeviceRemovedReason(self) -> _HRESULT: ... + def GetImmediateContext(self, __ppImmediateContext: _Pointer[_Pointer[ID3D11DeviceContext]]) -> None: ... + def SetExceptionMode(self) -> _HRESULT: ... + def GetExceptionMode(self) -> c_uint: ... + +def initialize_d3d_device(dxgi_adapter: _Pointer[IDXGIAdapter]) -> tuple[ID3D11Device, ID3D11DeviceContext]: ... +def describe_d3d11_texture_2d(d3d11_texture_2d: ID3D11Texture2D) -> D3D11_TEXTURE2D_DESC: ... +def prepare_d3d11_texture_2d_for_cpu(d3d11_texture_2d: ID3D11Texture2D, d3d_device: ID3D11Device) -> ID3D11Texture2D: ... diff --git a/stubs/D3DShot/d3dshot/dll/dxgi.pyi b/stubs/D3DShot/d3dshot/dll/dxgi.pyi new file mode 100644 index 0000000..d26d468 --- /dev/null +++ b/stubs/D3DShot/d3dshot/dll/dxgi.pyi @@ -0,0 +1,154 @@ +from ctypes import Array, Structure, _Pointer, c_uint +from ctypes.wintypes import BOOL, DWORD, HMONITOR, INT, LARGE_INTEGER, LONG, PFLOAT, POINT, RECT, UINT, ULARGE_INTEGER, WCHAR +from typing_extensions import TypedDict + +from d3dshot.dll import _HRESULT, _IUnknown, _ProcessFunc, _ProcessFuncRegionArg, _ProcessFuncReturn +from d3dshot.dll.d3d import ID3D11Device + +class _DXGIOutputPosition(TypedDict): + left: LONG + top: LONG + right: LONG + bottom: LONG + +class _DXGIOutput(TypedDict): + name: str + position: _DXGIOutputPosition + resolution: tuple[tuple[LONG, LONG], tuple[LONG, LONG]] + rotation: int + is_attached_to_desktop: bool + +class LUID(Structure): + LowPart: DWORD + HighPart: LONG + +class DXGI_ADAPTER_DESC1(Structure): + Description: Array[WCHAR] + VendorId: UINT + DeviceId: UINT + SubSysId: UINT + Revision: UINT + DedicatedVideoMemory: ULARGE_INTEGER + DedicatedSystemMemory: ULARGE_INTEGER + SharedSystemMemory: ULARGE_INTEGER + AdapterLuid: LUID + Flags: UINT + +class DXGI_OUTPUT_DESC(Structure): + DeviceName: Array[WCHAR] + DesktopCoordinates: RECT + AttachedToDesktop: BOOL + Rotation: UINT + Monitor: HMONITOR + +class DXGI_OUTDUPL_POINTER_POSITION(Structure): + Position: POINT + Visible: BOOL + +class DXGI_OUTDUPL_FRAME_INFO(Structure): + LastPresentTime: LARGE_INTEGER + LastMouseUpdateTime: LARGE_INTEGER + AccumulatedFrames: UINT + RectsCoalesced: BOOL + ProtectedContentMaskedOut: BOOL + PointerPosition: DXGI_OUTDUPL_POINTER_POSITION + TotalMetadataBufferSize: UINT + PointerShapeBufferSize: UINT + +class DXGI_MAPPED_RECT(Structure): + Pitch: INT + pBits: PFLOAT + +class IDXGIObject(_IUnknown): + def SetPrivateData(self) -> _HRESULT: ... + def SetPrivateDataInterface(self) -> _HRESULT: ... + def GetPrivateData(self) -> _HRESULT: ... + def GetParent(self) -> _HRESULT: ... + +class IDXGIDeviceSubObject(IDXGIObject): + def GetDevice(self) -> _HRESULT: ... + +class IDXGIResource(IDXGIDeviceSubObject): + def GetSharedHandle(self) -> _HRESULT: ... + def GetUsage(self) -> _HRESULT: ... + def SetEvictionPriority(self) -> _HRESULT: ... + def GetEvictionPriority(self) -> _HRESULT: ... + +class IDXGISurface(IDXGIDeviceSubObject): + def GetDesc(self) -> _HRESULT: ... + def Map(self, __pLockedRect: _Pointer[DXGI_MAPPED_RECT], __MapFlags: UINT) -> _HRESULT: ... + def Unmap(self) -> _HRESULT: ... + +class IDXGIOutputDuplication(IDXGIObject): + def GetDesc(self) -> None: ... + def AcquireNextFrame( + self, + __TimeoutInMilliseconds: UINT, + __pFrameInfo: _Pointer[DXGI_OUTDUPL_FRAME_INFO], + __ppDesktopResource: _Pointer[_Pointer[IDXGIResource]], + ) -> _HRESULT: ... + def GetFrameDirtyRects(self) -> _HRESULT: ... + def GetFrameMoveRects(self) -> _HRESULT: ... + def GetFramePointerShape(self) -> _HRESULT: ... + def MapDesktopSurface(self) -> _HRESULT: ... + def UnMapDesktopSurface(self) -> _HRESULT: ... + def ReleaseFrame(self) -> _HRESULT: ... + +class IDXGIOutput(IDXGIObject): + def GetDesc(self, __pDesc: _Pointer[DXGI_OUTPUT_DESC]) -> _HRESULT: ... + def GetDisplayModeList(self) -> _HRESULT: ... + def FindClosestMatchingMode(self) -> _HRESULT: ... + def WaitForVBlank(self) -> _HRESULT: ... + def TakeOwnership(self) -> _HRESULT: ... + def ReleaseOwnership(self) -> None: ... + def GetGammaControlCapabilities(self) -> _HRESULT: ... + def SetGammaControl(self) -> _HRESULT: ... + def GetGammaControl(self) -> _HRESULT: ... + def SetDisplaySurface(self) -> _HRESULT: ... + def GetDisplaySurfaceData(self) -> _HRESULT: ... + def GetFrameStatistics(self) -> _HRESULT: ... + +class IDXGIOutput1(IDXGIOutput): + def GetDisplayModeList1(self) -> _HRESULT: ... + def FindClosestMatchingMode1(self) -> _HRESULT: ... + def GetDisplaySurfaceData1(self) -> _HRESULT: ... + def DuplicateOutput( + self, __pDevice: _Pointer[ID3D11Device], __ppOutputDuplication: _Pointer[_Pointer[IDXGIOutputDuplication]] + ) -> _HRESULT: ... + +class IDXGIAdapter(IDXGIObject): + def EnumOutputs(self, __Output: UINT, __ppOutput: _Pointer[_Pointer[IDXGIOutput]]) -> _HRESULT: ... + def GetDesc(self) -> _HRESULT: ... + def CheckInterfaceSupport(self) -> _HRESULT: ... + +class IDXGIAdapter1(IDXGIAdapter): + def GetDesc1(self, __pDesc: _Pointer[DXGI_ADAPTER_DESC1]) -> _HRESULT: ... + +class IDXGIFactory(IDXGIObject): + def EnumAdapters(self) -> _HRESULT: ... + def MakeWindowAssociation(self) -> _HRESULT: ... + def GetWindowAssociation(self) -> _HRESULT: ... + def CreateSwapChain(self) -> _HRESULT: ... + def CreateSoftwareAdapter(self) -> _HRESULT: ... + +class IDXGIFactory1(IDXGIFactory): + def EnumAdapters1(self, __Adapter: c_uint, __ppAdapter: _Pointer[_Pointer[IDXGIAdapter1]]) -> _HRESULT: ... + def IsCurrent(self) -> BOOL: ... + +def initialize_dxgi_factory() -> _Pointer[IDXGIFactory1]: ... +def discover_dxgi_adapters(dxgi_factory: IDXGIFactory1) -> list[_Pointer[IDXGIAdapter1]]: ... +def describe_dxgi_adapter(dxgi_adapter: IDXGIAdapter1) -> Array[WCHAR]: ... +def discover_dxgi_outputs(dxgi_adapter: IDXGIAdapter) -> list[_Pointer[IDXGIOutput1]]: ... +def describe_dxgi_output(dxgi_output: IDXGIOutput) -> _DXGIOutput: ... +def initialize_dxgi_output_duplication( + dxgi_output: IDXGIOutput1, d3d_device: _Pointer[ID3D11Device] +) -> _Pointer[IDXGIOutputDuplication]: ... +def get_dxgi_output_duplication_frame( + dxgi_output_duplication: IDXGIOutputDuplication, + d3d_device: ID3D11Device, + process_func: _ProcessFunc[_ProcessFuncRegionArg, _ProcessFuncReturn] | None = ..., + width: int = ..., + height: int = ..., + region: _ProcessFuncRegionArg = ..., + rotation: int = ..., +) -> _ProcessFuncReturn | None: ... diff --git a/stubs/D3DShot/d3dshot/dll/shcore.pyi b/stubs/D3DShot/d3dshot/dll/shcore.pyi new file mode 100644 index 0000000..3fd5237 --- /dev/null +++ b/stubs/D3DShot/d3dshot/dll/shcore.pyi @@ -0,0 +1,3 @@ +from ctypes.wintypes import HMONITOR + +def get_scale_factor_for_monitor(hmonitor: HMONITOR) -> float: ... diff --git a/stubs/D3DShot/d3dshot/dll/user32.pyi b/stubs/D3DShot/d3dshot/dll/user32.pyi new file mode 100644 index 0000000..a8dfaec --- /dev/null +++ b/stubs/D3DShot/d3dshot/dll/user32.pyi @@ -0,0 +1,13 @@ +import ctypes +from ctypes import wintypes + +class DISPLAY_DEVICE(ctypes.Structure): + cb: wintypes.DWORD + DeviceName: wintypes.WCHAR + DeviceString: wintypes.WCHAR + StateFlags: wintypes.DWORD + DeviceID: wintypes.WCHAR + DeviceKey: wintypes.WCHAR + +def get_display_device_name_mapping() -> dict[str, tuple[str, bool]]: ... +def get_hmonitor_by_point(x: wintypes.LONG, y: wintypes.LONG) -> wintypes.HMONITOR: ... diff --git a/stubs/DateTimeRange/METADATA.toml b/stubs/DateTimeRange/METADATA.toml index 1fbfc0a..a682c0c 100644 --- a/stubs/DateTimeRange/METADATA.toml +++ b/stubs/DateTimeRange/METADATA.toml @@ -1,3 +1,5 @@ -version = "0.1" -python2 = true +version = "1.2.*" requires = ["types-python-dateutil"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/DateTimeRange/datetimerange/__init__.pyi b/stubs/DateTimeRange/datetimerange/__init__.pyi index b38cad3..ec530c7 100644 --- a/stubs/DateTimeRange/datetimerange/__init__.pyi +++ b/stubs/DateTimeRange/datetimerange/__init__.pyi @@ -1,10 +1,20 @@ import datetime -from typing import Iterable +from _typeshed import Self +from collections.abc import Iterable +from typing import ClassVar from dateutil.relativedelta import relativedelta -class DateTimeRange(object): - NOT_A_TIME_STR: str +from .__version__ import ( + __author__ as __author__, + __copyright__ as __copyright__, + __email__ as __email__, + __license__ as __license__, + __version__ as __version__, +) + +class DateTimeRange: + NOT_A_TIME_STR: ClassVar[str] start_time_format: str end_time_format: str is_output_elapse: bool @@ -16,13 +26,17 @@ class DateTimeRange(object): start_time_format: str = ..., end_time_format: str = ..., ) -> None: ... + @classmethod + def from_range_text( + cls, range_text: str, separator: str = ..., start_time_format: str | None = ..., end_time_format: str | None = ... + ) -> DateTimeRange: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... def __add__(self, other: datetime.timedelta) -> DateTimeRange: ... - def __iadd__(self, other: datetime.timedelta) -> DateTimeRange: ... + def __iadd__(self: Self, other: datetime.timedelta) -> Self: ... def __sub__(self, other: datetime.timedelta) -> DateTimeRange: ... - def __isub__(self, other: datetime.timedelta) -> DateTimeRange: ... - def __contains__(self, x: datetime.timedelta | DateTimeRange | str) -> bool: ... + def __isub__(self: Self, other: datetime.timedelta) -> Self: ... + def __contains__(self, x: datetime.timedelta | datetime.datetime | DateTimeRange | str) -> bool: ... @property def start_datetime(self) -> datetime.datetime: ... @property @@ -43,3 +57,5 @@ class DateTimeRange(object): def intersection(self, x: DateTimeRange) -> DateTimeRange: ... def encompass(self, x: DateTimeRange) -> DateTimeRange: ... def truncate(self, percentage: float) -> None: ... + def split(self, separator: str | datetime.datetime) -> list[DateTimeRange]: ... + def subtract(self, x: DateTimeRange) -> DateTimeRange: ... diff --git a/stubs/DateTimeRange/datetimerange/__version__.pyi b/stubs/DateTimeRange/datetimerange/__version__.pyi new file mode 100644 index 0000000..48c3f57 --- /dev/null +++ b/stubs/DateTimeRange/datetimerange/__version__.pyi @@ -0,0 +1,6 @@ +__author__: str = ... +__copyright__: str +__license__: str +__version__: str +__maintainer__ = __author__ +__email__: str diff --git a/stubs/Deprecated/@tests/stubtest_allowlist.txt b/stubs/Deprecated/@tests/stubtest_allowlist.txt deleted file mode 100644 index 5aea61c..0000000 --- a/stubs/Deprecated/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,3 +0,0 @@ -deprecated.sphinx.SphinxAdapter.__init__ -deprecated.sphinx.versionadded -deprecated.sphinx.versionchanged diff --git a/stubs/Deprecated/METADATA.toml b/stubs/Deprecated/METADATA.toml index 9f4230c..5c234dc 100644 --- a/stubs/Deprecated/METADATA.toml +++ b/stubs/Deprecated/METADATA.toml @@ -1,3 +1,5 @@ -version = "1.2" -python2 = true +version = "1.2.*" requires = [] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/Deprecated/deprecated/__init__.pyi b/stubs/Deprecated/deprecated/__init__.pyi index 25df243..c7b200a 100644 --- a/stubs/Deprecated/deprecated/__init__.pyi +++ b/stubs/Deprecated/deprecated/__init__.pyi @@ -1 +1,4 @@ from .classic import deprecated as deprecated + +__credits__: str +__date__: str diff --git a/stubs/Deprecated/deprecated/classic.pyi b/stubs/Deprecated/deprecated/classic.pyi index b6f5462..902e643 100644 --- a/stubs/Deprecated/deprecated/classic.pyi +++ b/stubs/Deprecated/deprecated/classic.pyi @@ -1,16 +1,19 @@ -from typing import Any, Callable, Type, TypeVar, overload -from typing_extensions import Literal +from collections.abc import Callable +from typing import Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias _F = TypeVar("_F", bound=Callable[..., Any]) -_Actions = Literal["default", "error", "ignore", "always", "module", "once"] +_Actions: TypeAlias = Literal["default", "error", "ignore", "always", "module", "once"] + +string_types: tuple[type, ...] class ClassicAdapter: reason: str version: str action: _Actions | None - category: Type[Warning] + category: type[Warning] def __init__( - self, reason: str = ..., version: str = ..., action: _Actions | None = ..., category: Type[Warning] = ... + self, reason: str = ..., version: str = ..., action: _Actions | None = ..., category: type[Warning] = ... ) -> None: ... def get_deprecated_msg(self, wrapped: Callable[..., Any], instance: object) -> str: ... def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... @@ -19,5 +22,5 @@ class ClassicAdapter: def deprecated(__wrapped: _F) -> _F: ... @overload def deprecated( - reason: str = ..., *, version: str = ..., action: _Actions | None = ..., category: Type[Warning] | None = ... + reason: str = ..., *, version: str = ..., action: _Actions | None = ..., category: type[Warning] | None = ... ) -> Callable[[_F], _F]: ... diff --git a/stubs/Deprecated/deprecated/sphinx.pyi b/stubs/Deprecated/deprecated/sphinx.pyi index e5acd94..c9b37ea 100644 --- a/stubs/Deprecated/deprecated/sphinx.pyi +++ b/stubs/Deprecated/deprecated/sphinx.pyi @@ -1,4 +1,5 @@ -from typing import Any, Callable, Type, TypeVar +from collections.abc import Callable +from typing import Any, TypeVar from typing_extensions import Literal from .classic import ClassicAdapter, _Actions @@ -10,24 +11,25 @@ class SphinxAdapter(ClassicAdapter): reason: str version: str action: _Actions | None - category: Type[Warning] + category: type[Warning] def __init__( self, directive: Literal["versionadded", "versionchanged", "deprecated"], reason: str = ..., version: str = ..., action: _Actions | None = ..., - category: Type[Warning] = ..., + category: type[Warning] = ..., + line_length: int = ..., ) -> None: ... def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ... -def versionadded(reason: str = ..., version: str = ...) -> Callable[[_F], _F]: ... -def versionchanged(reason: str = ..., version: str = ...) -> Callable[[_F], _F]: ... +def versionadded(reason: str = ..., version: str = ..., line_length: int = ...) -> Callable[[_F], _F]: ... +def versionchanged(reason: str = ..., version: str = ..., line_length: int = ...) -> Callable[[_F], _F]: ... def deprecated( reason: str = ..., version: str = ..., line_length: int = ..., *, action: _Actions | None = ..., - category: Type[Warning] | None = ..., + category: type[Warning] | None = ..., ) -> Callable[[_F], _F]: ... diff --git a/stubs/Flask-Cors/METADATA.toml b/stubs/Flask-Cors/METADATA.toml new file mode 100644 index 0000000..4a8e90c --- /dev/null +++ b/stubs/Flask-Cors/METADATA.toml @@ -0,0 +1 @@ +version = "3.0.*" diff --git a/stubs/Flask-Cors/flask_cors/__init__.pyi b/stubs/Flask-Cors/flask_cors/__init__.pyi new file mode 100644 index 0000000..b0962a7 --- /dev/null +++ b/stubs/Flask-Cors/flask_cors/__init__.pyi @@ -0,0 +1,7 @@ +from logging import Logger + +from .decorator import cross_origin as cross_origin +from .extension import CORS as CORS +from .version import __version__ as __version__ + +rootlogger: Logger diff --git a/stubs/Flask-Cors/flask_cors/core.pyi b/stubs/Flask-Cors/flask_cors/core.pyi new file mode 100644 index 0000000..52fabdf --- /dev/null +++ b/stubs/Flask-Cors/flask_cors/core.pyi @@ -0,0 +1,64 @@ +from collections.abc import Iterable +from datetime import timedelta +from logging import Logger +from re import Pattern +from typing import Any, TypeVar, overload +from typing_extensions import TypeAlias, TypedDict + +_IterableT = TypeVar("_IterableT", bound=Iterable[Any]) +_T = TypeVar("_T") +_App: TypeAlias = Any # flask is not part of typeshed +_Response: TypeAlias = Any # flask is not part of typeshed +_MultiDict: TypeAlias = Any # werkzeug is not part of typeshed + +class _Options(TypedDict, total=False): + resources: dict[str, dict[str, Any]] | list[str] | str | None + origins: str | list[str] | None + methods: str | list[str] | None + expose_headers: str | list[str] | None + allow_headers: str | list[str] | None + supports_credentials: bool | None + max_age: timedelta | int | str | None + send_wildcard: bool | None + vary_header: bool | None + automatic_options: bool | None + intercept_exceptions: bool | None + always_send: bool | None + +LOG: Logger +ACL_ORIGIN: str +ACL_METHODS: str +ACL_ALLOW_HEADERS: str +ACL_EXPOSE_HEADERS: str +ACL_CREDENTIALS: str +ACL_MAX_AGE: str +ACL_REQUEST_METHOD: str +ACL_REQUEST_HEADERS: str +ALL_METHODS: list[str] +CONFIG_OPTIONS: list[str] +FLASK_CORS_EVALUATED: str +RegexObject: type[Pattern[str]] +DEFAULT_OPTIONS: _Options + +def parse_resources(resources: dict[str, _Options] | Iterable[str] | str | Pattern[str]) -> list[tuple[str, _Options]]: ... +def get_regexp_pattern(regexp: str | Pattern[str]) -> str: ... +def get_cors_origins(options: _Options, request_origin: str | None) -> list[str] | None: ... +def get_allow_headers(options: _Options, acl_request_headers: str | None) -> str | None: ... +def get_cors_headers(options: _Options, request_headers: dict[str, Any], request_method: str) -> _MultiDict: ... +def set_cors_headers(resp: _Response, options: _Options) -> _Response: ... +def probably_regex(maybe_regex: str | Pattern[str]) -> bool: ... +def re_fix(reg: str) -> str: ... +def try_match_any(inst: str, patterns: Iterable[str | Pattern[str]]) -> bool: ... +def try_match(request_origin: str, maybe_regex: str | Pattern[str]) -> bool: ... +def get_cors_options(appInstance: _App | None, *dicts: _Options) -> _Options: ... +def get_app_kwarg_dict(appInstance: _App | None = ...) -> _Options: ... +def flexible_str(obj: object) -> str | None: ... +def serialize_option(options_dict: _Options, key: str, upper: bool = ...) -> None: ... +@overload +def ensure_iterable(inst: str) -> list[str]: ... # type: ignore[misc] +@overload +def ensure_iterable(inst: _IterableT) -> _IterableT: ... +@overload +def ensure_iterable(inst: _T) -> list[_T]: ... +def sanitize_regex_param(param: str | list[str]) -> list[str]: ... +def serialize_options(opts: _Options) -> _Options: ... diff --git a/stubs/Flask-Cors/flask_cors/decorator.pyi b/stubs/Flask-Cors/flask_cors/decorator.pyi new file mode 100644 index 0000000..8eb81d1 --- /dev/null +++ b/stubs/Flask-Cors/flask_cors/decorator.pyi @@ -0,0 +1,23 @@ +from collections.abc import Callable, Iterable +from datetime import timedelta +from logging import Logger +from re import Pattern +from typing import Any +from typing_extensions import ParamSpec + +_P = ParamSpec("_P") + +LOG: Logger + +def cross_origin( + *args: Any, + origins: str | Pattern[str] | Iterable[str | Pattern[str]] | None = ..., + methods: str | list[str] | None = ..., + expose_headers: str | list[str] | None = ..., + allow_headers: str | Pattern[str] | Iterable[str | Pattern[str]] | None = ..., + supports_credentials: bool | None = ..., + max_age: timedelta | int | str | None = ..., + send_wildcard: bool | None = ..., + vary_header: bool | None = ..., + automatic_options: bool | None = ..., +) -> Callable[[Callable[_P, Any]], Callable[_P, Any]]: ... diff --git a/stubs/Flask-Cors/flask_cors/extension.pyi b/stubs/Flask-Cors/flask_cors/extension.pyi new file mode 100644 index 0000000..99cfb44 --- /dev/null +++ b/stubs/Flask-Cors/flask_cors/extension.pyi @@ -0,0 +1,43 @@ +from collections.abc import Callable, Iterable +from datetime import timedelta +from logging import Logger +from typing import Any +from typing_extensions import TypeAlias + +_App: TypeAlias = Any # flask is not part of typeshed + +LOG: Logger + +class CORS: + def __init__( + self, + app: Any | None = ..., + *, + resources: dict[str, dict[str, Any]] | list[str] | str | None = ..., + origins: str | list[str] | None = ..., + methods: str | list[str] | None = ..., + expose_headers: str | list[str] | None = ..., + allow_headers: str | list[str] | None = ..., + supports_credentials: bool | None = ..., + max_age: timedelta | int | str | None = ..., + send_wildcard: bool | None = ..., + vary_header: bool | None = ..., + **kwargs: Any, + ) -> None: ... + def init_app( + self, + app: _App, + *, + resources: dict[str, dict[str, Any]] | list[str] | str = ..., + origins: str | list[str] = ..., + methods: str | list[str] = ..., + expose_headers: str | list[str] = ..., + allow_headers: str | list[str] = ..., + supports_credentials: bool = ..., + max_age: timedelta | int | str | None = ..., + send_wildcard: bool = ..., + vary_header: bool = ..., + **kwargs: Any, + ) -> None: ... + +def make_after_request_function(resources: Iterable[tuple[str, dict[str, Any]]]) -> Callable[..., Any]: ... diff --git a/stubs/Flask-Cors/flask_cors/version.pyi b/stubs/Flask-Cors/flask_cors/version.pyi new file mode 100644 index 0000000..bda5b5a --- /dev/null +++ b/stubs/Flask-Cors/flask_cors/version.pyi @@ -0,0 +1 @@ +__version__: str diff --git a/stubs/Flask-SQLAlchemy/@tests/stubtest_allowlist.txt b/stubs/Flask-SQLAlchemy/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..2187a23 --- /dev/null +++ b/stubs/Flask-SQLAlchemy/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +# Needed due dynamic attribute generation +flask_sqlalchemy.SQLAlchemy.__getattr__ diff --git a/stubs/Flask-SQLAlchemy/METADATA.toml b/stubs/Flask-SQLAlchemy/METADATA.toml new file mode 100644 index 0000000..e53263e --- /dev/null +++ b/stubs/Flask-SQLAlchemy/METADATA.toml @@ -0,0 +1,3 @@ +version = "2.5.*" +requires = ["types-SQLAlchemy"] +obsolete_since = "3.0.1" # Released on 2022-10-11 diff --git a/stubs/Flask-SQLAlchemy/flask_sqlalchemy/__init__.pyi b/stubs/Flask-SQLAlchemy/flask_sqlalchemy/__init__.pyi new file mode 100644 index 0000000..d9986cf --- /dev/null +++ b/stubs/Flask-SQLAlchemy/flask_sqlalchemy/__init__.pyi @@ -0,0 +1,97 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from typing import Any, Generic, TypeVar + +from sqlalchemy.orm import scoped_session +from sqlalchemy.orm.query import Query +from sqlalchemy.orm.session import Session + +from . import utils as utils +from .model import DefaultMeta as DefaultMeta, Model as Model + +models_committed: Any +before_models_committed: Any + +class SignallingSession(Session): + app: Any + def __init__(self, db, autocommit: bool = ..., autoflush: bool = ..., **options) -> None: ... + def get_bind(self, mapper: Any | None = ..., clause: Any | None = ...): ... # type: ignore[override] + +def get_debug_queries(): ... + +_T = TypeVar("_T") + +class BaseQuery(Query[_T]): + def get_or_404(self, ident, description: Incomplete | None = ...): ... + def first_or_404(self, description: Incomplete | None = ...): ... + def paginate( + self, + page: Incomplete | None = ..., + per_page: Incomplete | None = ..., + error_out: bool = ..., + max_per_page: Incomplete | None = ..., + ) -> Pagination[_T]: ... + +class Pagination(Generic[_T]): + query: BaseQuery[_T] | None + page: int + per_page: int + total: int | None + items: Any + def __init__(self, query: BaseQuery[_T] | None, page: int, per_page: int, total: int | None, items) -> None: ... + @property + def pages(self) -> int: ... + def prev(self, error_out: bool = ...) -> Pagination[_T]: ... + @property + def prev_num(self) -> int | None: ... + @property + def has_prev(self) -> bool: ... + def next(self, error_out: bool = ...) -> Pagination[_T]: ... + @property + def has_next(self) -> bool: ... + @property + def next_num(self) -> int | None: ... + def iter_pages( + self, left_edge: int = ..., left_current: int = ..., right_current: int = ..., right_edge: int = ... + ) -> Generator[int | None, None, None]: ... + +def get_state(app): ... + +class SQLAlchemy: + Query: Any + use_native_unicode: Any + session: scoped_session + Model: Model + app: Any + def __init__( + self, + app: Any | None = ..., + use_native_unicode: bool = ..., + session_options: Any | None = ..., + metadata: Any | None = ..., + query_class=..., + model_class=..., + engine_options: Any | None = ..., + ) -> None: ... + @property + def metadata(self): ... + def create_scoped_session(self, options: Any | None = ...): ... + def create_session(self, options): ... + def make_declarative_base(self, model, metadata: Any | None = ...): ... + def init_app(self, app): ... + def apply_pool_defaults(self, app, options): ... + def apply_driver_hacks(self, app, sa_url, options): ... + @property + def engine(self): ... + def make_connector(self, app: Any | None = ..., bind: Any | None = ...): ... + def get_engine(self, app: Any | None = ..., bind: Any | None = ...): ... + def create_engine(self, sa_url, engine_opts): ... + def get_app(self, reference_app: Any | None = ...): ... + def get_tables_for_bind(self, bind: Any | None = ...): ... + def get_binds(self, app: Any | None = ...): ... + def create_all(self, bind: str = ..., app: Any | None = ...) -> None: ... + def drop_all(self, bind: str = ..., app: Any | None = ...) -> None: ... + def reflect(self, bind: str = ..., app: Any | None = ...) -> None: ... + def __getattr__(self, name: str) -> Any: ... # exposes dynamically classes of SQLAlchemy + +class FSADeprecationWarning(DeprecationWarning): ... diff --git a/stubs/Flask-SQLAlchemy/flask_sqlalchemy/model.pyi b/stubs/Flask-SQLAlchemy/flask_sqlalchemy/model.pyi new file mode 100644 index 0000000..f1780c0 --- /dev/null +++ b/stubs/Flask-SQLAlchemy/flask_sqlalchemy/model.pyi @@ -0,0 +1,25 @@ +from re import Pattern +from typing import Any + +from sqlalchemy import Table +from sqlalchemy.ext.declarative import DeclarativeMeta +from sqlalchemy.orm import Query + +def should_set_tablename(cls: type) -> bool: ... + +camelcase_re: Pattern[str] + +def camel_to_snake_case(name: str) -> str: ... + +class NameMetaMixin(type): + def __init__(cls, name: str, bases: tuple[type, ...], d: dict[str, Any]) -> None: ... + def __table_cls__(cls, *args, **kwargs) -> Table | None: ... + +class BindMetaMixin(type): + def __init__(cls, name: str, bases: tuple[type, ...], d: dict[str, Any]) -> None: ... + +class DefaultMeta(NameMetaMixin, BindMetaMixin, DeclarativeMeta): ... + +class Model: + query_class: type[Query[Any]] | None + query: Query[Any] | None diff --git a/stubs/Flask-SQLAlchemy/flask_sqlalchemy/utils.pyi b/stubs/Flask-SQLAlchemy/flask_sqlalchemy/utils.pyi new file mode 100644 index 0000000..190d724 --- /dev/null +++ b/stubs/Flask-SQLAlchemy/flask_sqlalchemy/utils.pyi @@ -0,0 +1,3 @@ +def parse_version(v: str) -> tuple[int, int, int]: ... +def sqlalchemy_version(op: str, val: str) -> bool: ... +def engine_config_warning(config, version: str, deprecated_config_key: str, engine_option) -> None: ... diff --git a/stubs/Flask/METADATA.toml b/stubs/Flask/METADATA.toml deleted file mode 100644 index cd91d47..0000000 --- a/stubs/Flask/METADATA.toml +++ /dev/null @@ -1,4 +0,0 @@ -version = "1.1" -python2 = true -requires = ["types-Jinja2", "types-Werkzeug", "types-click"] -obsolete_since = "2.0" diff --git a/stubs/Flask/flask/__init__.pyi b/stubs/Flask/flask/__init__.pyi deleted file mode 100644 index 4e66d4d..0000000 --- a/stubs/Flask/flask/__init__.pyi +++ /dev/null @@ -1,41 +0,0 @@ -from jinja2 import Markup as Markup, escape as escape -from werkzeug.exceptions import abort as abort -from werkzeug.utils import redirect as redirect - -from .app import Flask as Flask -from .blueprints import Blueprint as Blueprint -from .config import Config as Config -from .ctx import ( - after_this_request as after_this_request, - copy_current_request_context as copy_current_request_context, - has_app_context as has_app_context, - has_request_context as has_request_context, -) -from .globals import current_app as current_app, g as g, request as request, session as session -from .helpers import ( - flash as flash, - get_flashed_messages as get_flashed_messages, - get_template_attribute as get_template_attribute, - make_response as make_response, - safe_join as safe_join, - send_file as send_file, - send_from_directory as send_from_directory, - stream_with_context as stream_with_context, - url_for as url_for, -) -from .json import jsonify as jsonify -from .signals import ( - appcontext_popped as appcontext_popped, - appcontext_pushed as appcontext_pushed, - appcontext_tearing_down as appcontext_tearing_down, - before_render_template as before_render_template, - got_request_exception as got_request_exception, - message_flashed as message_flashed, - request_finished as request_finished, - request_started as request_started, - request_tearing_down as request_tearing_down, - signals_available as signals_available, - template_rendered as template_rendered, -) -from .templating import render_template as render_template, render_template_string as render_template_string -from .wrappers import Request as Request, Response as Response diff --git a/stubs/Flask/flask/app.pyi b/stubs/Flask/flask/app.pyi deleted file mode 100644 index 9469bbb..0000000 --- a/stubs/Flask/flask/app.pyi +++ /dev/null @@ -1,194 +0,0 @@ -from datetime import timedelta -from logging import Logger -from types import TracebackType -from typing import ( - Any, - ByteString, - Callable, - ContextManager, - Dict, - Iterable, - List, - NoReturn, - Optional, - Text, - Tuple, - Type, - TypeVar, - Union, -) - -from .blueprints import Blueprint -from .config import Config -from .ctx import AppContext, RequestContext -from .helpers import _PackageBoundObject -from .testing import FlaskClient -from .wrappers import Response - -def setupmethod(f: Any): ... - -_T = TypeVar("_T") - -_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] -_StartResponse = Callable[[str, List[Tuple[str, str]], Optional[_ExcInfo]], Callable[[bytes], Any]] -_WSGICallable = Callable[[Dict[Text, Any], _StartResponse], Iterable[bytes]] - -_Status = Union[str, int] -_Headers = Union[Dict[Any, Any], List[Tuple[Any, Any]]] -_Body = Union[Text, ByteString, Dict[Text, Any], Response, _WSGICallable] -_ViewFuncReturnType = Union[_Body, Tuple[_Body, _Status, _Headers], Tuple[_Body, _Status], Tuple[_Body, _Headers]] - -_ViewFunc = Union[Callable[..., NoReturn], Callable[..., _ViewFuncReturnType]] -_VT = TypeVar("_VT", bound=_ViewFunc) - -class Flask(_PackageBoundObject): - request_class: type = ... - response_class: type = ... - jinja_environment: type = ... - app_ctx_globals_class: type = ... - config_class: Type[Config] = ... - testing: Any = ... - secret_key: Text | bytes | None = ... - session_cookie_name: Any = ... - permanent_session_lifetime: timedelta = ... - send_file_max_age_default: timedelta = ... - use_x_sendfile: Any = ... - json_encoder: Any = ... - json_decoder: Any = ... - jinja_options: Any = ... - default_config: Any = ... - url_rule_class: type = ... - test_client_class: type = ... - test_cli_runner_class: type = ... - session_interface: Any = ... - import_name: str = ... - template_folder: str = ... - root_path: str | Text = ... - static_url_path: Any = ... - static_folder: str | None = ... - instance_path: str | Text = ... - config: Config = ... - view_functions: Any = ... - error_handler_spec: Any = ... - url_build_error_handlers: Any = ... - before_request_funcs: dict[str | None, list[Callable[[], Any]]] = ... - before_first_request_funcs: list[Callable[[], None]] = ... - after_request_funcs: dict[str | None, list[Callable[[Response], Response]]] = ... - teardown_request_funcs: dict[str | None, list[Callable[[Exception | None], Any]]] = ... - teardown_appcontext_funcs: list[Callable[[Exception | None], Any]] = ... - url_value_preprocessors: Any = ... - url_default_functions: Any = ... - template_context_processors: Any = ... - shell_context_processors: Any = ... - blueprints: Any = ... - extensions: Any = ... - url_map: Any = ... - subdomain_matching: Any = ... - cli: Any = ... - def __init__( - self, - import_name: str, - static_url_path: str | None = ..., - static_folder: str | None = ..., - static_host: str | None = ..., - host_matching: bool = ..., - subdomain_matching: bool = ..., - template_folder: str = ..., - instance_path: str | None = ..., - instance_relative_config: bool = ..., - root_path: str | None = ..., - ) -> None: ... - @property - def name(self) -> str: ... - @property - def propagate_exceptions(self) -> bool: ... - @property - def preserve_context_on_exception(self): ... - @property - def logger(self) -> Logger: ... - @property - def jinja_env(self): ... - @property - def got_first_request(self) -> bool: ... - def make_config(self, instance_relative: bool = ...): ... - def auto_find_instance_path(self): ... - def open_instance_resource(self, resource: str | Text, mode: str = ...): ... - templates_auto_reload: Any = ... - def create_jinja_environment(self): ... - def create_global_jinja_loader(self): ... - def select_jinja_autoescape(self, filename: Any): ... - def update_template_context(self, context: Any) -> None: ... - def make_shell_context(self): ... - env: str | None = ... - debug: bool = ... - def run( - self, - host: str | None = ..., - port: int | str | None = ..., - debug: bool | None = ..., - load_dotenv: bool = ..., - **options: Any, - ) -> None: ... - def test_client(self, use_cookies: bool = ..., **kwargs: Any) -> FlaskClient[Response]: ... - def test_cli_runner(self, **kwargs: Any): ... - def open_session(self, request: Any): ... - def save_session(self, session: Any, response: Any): ... - def make_null_session(self): ... - def register_blueprint(self, blueprint: Blueprint, **options: Any) -> None: ... - def iter_blueprints(self): ... - def add_url_rule( - self, - rule: str, - endpoint: str | None = ..., - view_func: _ViewFunc = ..., - provide_automatic_options: bool | None = ..., - **options: Any, - ) -> None: ... - def route(self, rule: str, **options: Any) -> Callable[[_VT], _VT]: ... - def endpoint(self, endpoint: str) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... - def errorhandler(self, code_or_exception: int | Type[Exception]) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... - def register_error_handler(self, code_or_exception: int | Type[Exception], f: Callable[..., Any]) -> None: ... - def template_filter(self, name: Any | None = ...): ... - def add_template_filter(self, f: Any, name: Any | None = ...) -> None: ... - def template_test(self, name: Any | None = ...): ... - def add_template_test(self, f: Any, name: Any | None = ...) -> None: ... - def template_global(self, name: Any | None = ...): ... - def add_template_global(self, f: Any, name: Any | None = ...) -> None: ... - def before_request(self, f: Callable[[], _T]) -> Callable[[], _T]: ... - def before_first_request(self, f: Callable[[], _T]) -> Callable[[], _T]: ... - def after_request(self, f: Callable[[Response], Response]) -> Callable[[Response], Response]: ... - def teardown_request(self, f: Callable[[Exception | None], _T]) -> Callable[[Exception | None], _T]: ... - def teardown_appcontext(self, f: Callable[[Exception | None], _T]) -> Callable[[Exception | None], _T]: ... - def context_processor(self, f: Any): ... - def shell_context_processor(self, f: Any): ... - def url_value_preprocessor(self, f: Any): ... - def url_defaults(self, f: Any): ... - def handle_http_exception(self, e: Any): ... - def trap_http_exception(self, e: Any): ... - def handle_user_exception(self, e: Any): ... - def handle_exception(self, e: Any): ... - def log_exception(self, exc_info: Any) -> None: ... - def raise_routing_exception(self, request: Any) -> None: ... - def dispatch_request(self): ... - def full_dispatch_request(self): ... - def finalize_request(self, rv: Any, from_error_handler: bool = ...): ... - def try_trigger_before_first_request_functions(self): ... - def make_default_options_response(self): ... - def should_ignore_error(self, error: Any): ... - def make_response(self, rv: Any): ... - def create_url_adapter(self, request: Any): ... - def inject_url_defaults(self, endpoint: Any, values: Any) -> None: ... - def handle_url_build_error(self, error: Any, endpoint: Any, values: Any): ... - def preprocess_request(self): ... - def process_response(self, response: Any): ... - def do_teardown_request(self, exc: Any = ...) -> None: ... - def do_teardown_appcontext(self, exc: Any = ...) -> None: ... - def app_context(self) -> AppContext: ... - def request_context(self, environ: Any): ... - def test_request_context(self, *args: Any, **kwargs: Any) -> ContextManager[RequestContext]: ... - def wsgi_app(self, environ: Any, start_response: Any): ... - def __call__(self, environ: Any, start_response: Any): ... - # These are not preset at runtime but we add them since monkeypatching this - # class is quite common. - def __setattr__(self, name: str, value: Any): ... - def __getattr__(self, name: str): ... diff --git a/stubs/Flask/flask/blueprints.pyi b/stubs/Flask/flask/blueprints.pyi deleted file mode 100644 index df795f1..0000000 --- a/stubs/Flask/flask/blueprints.pyi +++ /dev/null @@ -1,78 +0,0 @@ -from typing import Any, Callable, Type, TypeVar - -from .app import _ViewFunc -from .helpers import _PackageBoundObject - -_T = TypeVar("_T") -_VT = TypeVar("_VT", bound=_ViewFunc) - -class _Sentinel(object): ... - -class BlueprintSetupState: - app: Any = ... - blueprint: Any = ... - options: Any = ... - first_registration: Any = ... - subdomain: Any = ... - url_prefix: Any = ... - url_defaults: Any = ... - def __init__(self, blueprint: Any, app: Any, options: Any, first_registration: Any) -> None: ... - def add_url_rule(self, rule: str, endpoint: str | None = ..., view_func: _ViewFunc = ..., **options: Any) -> None: ... - -class Blueprint(_PackageBoundObject): - warn_on_modifications: bool = ... - json_encoder: Any = ... - json_decoder: Any = ... - import_name: str = ... - template_folder: str | None = ... - root_path: str = ... - name: str = ... - url_prefix: str | None = ... - subdomain: str | None = ... - static_folder: str | None = ... - static_url_path: str | None = ... - deferred_functions: Any = ... - url_values_defaults: Any = ... - cli_group: str | None | _Sentinel = ... - def __init__( - self, - name: str, - import_name: str, - static_folder: str | None = ..., - static_url_path: str | None = ..., - template_folder: str | None = ..., - url_prefix: str | None = ..., - subdomain: str | None = ..., - url_defaults: Any | None = ..., - root_path: str | None = ..., - cli_group: str | None | _Sentinel = ..., - ) -> None: ... - def record(self, func: Any) -> None: ... - def record_once(self, func: Any): ... - def make_setup_state(self, app: Any, options: Any, first_registration: bool = ...): ... - def register(self, app: Any, options: Any, first_registration: bool = ...) -> None: ... - def route(self, rule: str, **options: Any) -> Callable[[_VT], _VT]: ... - def add_url_rule(self, rule: str, endpoint: str | None = ..., view_func: _ViewFunc = ..., **options: Any) -> None: ... - def endpoint(self, endpoint: str) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... - def app_template_filter(self, name: Any | None = ...): ... - def add_app_template_filter(self, f: Any, name: Any | None = ...) -> None: ... - def app_template_test(self, name: Any | None = ...): ... - def add_app_template_test(self, f: Any, name: Any | None = ...) -> None: ... - def app_template_global(self, name: Any | None = ...): ... - def add_app_template_global(self, f: Any, name: Any | None = ...) -> None: ... - def before_request(self, f: Any): ... - def before_app_request(self, f: Any): ... - def before_app_first_request(self, f: Any): ... - def after_request(self, f: Any): ... - def after_app_request(self, f: Any): ... - def teardown_request(self, f: Any): ... - def teardown_app_request(self, f: Any): ... - def context_processor(self, f: Any): ... - def app_context_processor(self, f: Any): ... - def app_errorhandler(self, code: Any): ... - def url_value_preprocessor(self, f: Any): ... - def url_defaults(self, f: Any): ... - def app_url_value_preprocessor(self, f: Any): ... - def app_url_defaults(self, f: Any): ... - def errorhandler(self, code_or_exception: int | Type[Exception]) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... - def register_error_handler(self, code_or_exception: int | Type[Exception], f: Callable[..., Any]) -> None: ... diff --git a/stubs/Flask/flask/cli.pyi b/stubs/Flask/flask/cli.pyi deleted file mode 100644 index 9f79483..0000000 --- a/stubs/Flask/flask/cli.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from typing import Any - -import click - -class NoAppException(click.UsageError): ... - -def find_best_app(script_info: Any, module: Any): ... -def call_factory(script_info: Any, app_factory: Any, arguments: Any = ...): ... -def find_app_by_string(script_info: Any, module: Any, app_name: Any): ... -def prepare_import(path: Any): ... -def locate_app(script_info: Any, module_name: Any, app_name: Any, raise_if_not_found: bool = ...): ... -def get_version(ctx: Any, param: Any, value: Any): ... - -version_option: Any - -class DispatchingApp: - loader: Any = ... - def __init__(self, loader: Any, use_eager_loading: bool = ...) -> None: ... - def __call__(self, environ: Any, start_response: Any): ... - -class ScriptInfo: - app_import_path: Any = ... - create_app: Any = ... - data: Any = ... - def __init__(self, app_import_path: Any | None = ..., create_app: Any | None = ...) -> None: ... - def load_app(self): ... - -pass_script_info: Any - -def with_appcontext(f: Any): ... - -class AppGroup(click.Group): - def command(self, *args: Any, **kwargs: Any): ... - def group(self, *args: Any, **kwargs: Any): ... - -class FlaskGroup(AppGroup): - create_app: Any = ... - load_dotenv: Any = ... - def __init__( - self, - add_default_commands: bool = ..., - create_app: Any | None = ..., - add_version_option: bool = ..., - load_dotenv: bool = ..., - **extra: Any, - ) -> None: ... - def get_command(self, ctx: Any, name: Any): ... - def list_commands(self, ctx: Any): ... - def main(self, *args: Any, **kwargs: Any): ... - -def load_dotenv(path: Any | None = ...): ... -def show_server_banner(env: Any, debug: Any, app_import_path: Any, eager_loading: Any): ... - -class CertParamType(click.ParamType): - name: str = ... - path_type: Any = ... - def __init__(self) -> None: ... - def convert(self, value: Any, param: Any, ctx: Any): ... - -def run_command( - info: Any, host: Any, port: Any, reload: Any, debugger: Any, eager_loading: Any, with_threads: Any, cert: Any -) -> None: ... -def shell_command() -> None: ... -def routes_command(sort: Any, all_methods: Any): ... - -cli: Any - -def main(as_module: bool = ...) -> None: ... diff --git a/stubs/Flask/flask/config.pyi b/stubs/Flask/flask/config.pyi deleted file mode 100644 index b33ddd0..0000000 --- a/stubs/Flask/flask/config.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any, Dict - -class ConfigAttribute: - __name__: Any = ... - get_converter: Any = ... - def __init__(self, name: Any, get_converter: Any | None = ...) -> None: ... - def __get__(self, obj: Any, type: Any | None = ...): ... - def __set__(self, obj: Any, value: Any) -> None: ... - -class Config(Dict[str, Any]): - root_path: Any = ... - def __init__(self, root_path: Any, defaults: Any | None = ...) -> None: ... - def from_envvar(self, variable_name: Any, silent: bool = ...): ... - def from_pyfile(self, filename: Any, silent: bool = ...): ... - def from_object(self, obj: Any) -> None: ... - def from_json(self, filename: Any, silent: bool = ...): ... - def from_mapping(self, *mapping: Any, **kwargs: Any): ... - def get_namespace(self, namespace: Any, lowercase: bool = ..., trim_namespace: bool = ...): ... diff --git a/stubs/Flask/flask/ctx.pyi b/stubs/Flask/flask/ctx.pyi deleted file mode 100644 index 2246ca7..0000000 --- a/stubs/Flask/flask/ctx.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from typing import Any - -class _AppCtxGlobals: - def get(self, name: Any, default: Any | None = ...): ... - def pop(self, name: Any, default: Any = ...): ... - def setdefault(self, name: Any, default: Any | None = ...): ... - def __contains__(self, item: Any): ... - def __iter__(self): ... - -def after_this_request(f: Any): ... -def copy_current_request_context(f: Any): ... -def has_request_context(): ... -def has_app_context(): ... - -class AppContext: - app: Any = ... - url_adapter: Any = ... - g: Any = ... - def __init__(self, app: Any) -> None: ... - def push(self) -> None: ... - def pop(self, exc: Any = ...) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ... - -class RequestContext: - app: Any = ... - request: Any = ... - url_adapter: Any = ... - flashes: Any = ... - session: Any = ... - preserved: bool = ... - def __init__(self, app: Any, environ: Any, request: Any | None = ...) -> None: ... - g: Any = ... - def copy(self): ... - def match_request(self) -> None: ... - def push(self) -> None: ... - def pop(self, exc: Any = ...) -> None: ... - def auto_pop(self, exc: Any) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ... diff --git a/stubs/Flask/flask/debughelpers.pyi b/stubs/Flask/flask/debughelpers.pyi deleted file mode 100644 index 45255a9..0000000 --- a/stubs/Flask/flask/debughelpers.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from typing import Any - -class UnexpectedUnicodeError(AssertionError, UnicodeError): ... - -class DebugFilesKeyError(KeyError, AssertionError): - msg: Any = ... - def __init__(self, request: Any, key: Any) -> None: ... - -class FormDataRoutingRedirect(AssertionError): - def __init__(self, request: Any) -> None: ... - -def attach_enctype_error_multidict(request: Any): ... -def explain_template_loading_attempts(app: Any, template: Any, attempts: Any) -> None: ... -def explain_ignored_app_run() -> None: ... diff --git a/stubs/Flask/flask/globals.pyi b/stubs/Flask/flask/globals.pyi deleted file mode 100644 index c6043c7..0000000 --- a/stubs/Flask/flask/globals.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any - -from werkzeug.local import LocalStack - -from .app import Flask -from .wrappers import Request - -class _FlaskLocalProxy(Flask): - def _get_current_object(self) -> Flask: ... - -_request_ctx_stack: LocalStack -_app_ctx_stack: LocalStack -current_app: _FlaskLocalProxy -request: Request -session: Any -g: Any diff --git a/stubs/Flask/flask/helpers.pyi b/stubs/Flask/flask/helpers.pyi deleted file mode 100644 index bf9a698..0000000 --- a/stubs/Flask/flask/helpers.pyi +++ /dev/null @@ -1,55 +0,0 @@ -from typing import Any - -from .cli import AppGroup -from .wrappers import Response - -def get_env(): ... -def get_debug_flag(): ... -def get_load_dotenv(default: bool = ...): ... -def stream_with_context(generator_or_function: Any): ... -def make_response(*args: Any) -> Response: ... -def url_for(endpoint: str, **values: Any) -> str: ... -def get_template_attribute(template_name: Any, attribute: Any): ... -def flash(message: Any, category: str = ...) -> None: ... -def get_flashed_messages(with_categories: bool = ..., category_filter: Any = ...): ... -def send_file( - filename_or_fp: Any, - mimetype: Any | None = ..., - as_attachment: bool = ..., - attachment_filename: Any | None = ..., - add_etags: bool = ..., - cache_timeout: Any | None = ..., - conditional: bool = ..., - last_modified: Any | None = ..., -) -> Response: ... -def safe_join(directory: Any, *pathnames: Any): ... -def send_from_directory(directory: Any, filename: Any, **options: Any) -> Response: ... -def get_root_path(import_name: Any): ... -def find_package(import_name: Any): ... - -class locked_cached_property: - __name__: Any = ... - __module__: Any = ... - __doc__: Any = ... - func: Any = ... - lock: Any = ... - def __init__(self, func: Any, name: Any | None = ..., doc: Any | None = ...) -> None: ... - def __get__(self, obj: Any, type: Any | None = ...): ... - -class _PackageBoundObject: - import_name: Any = ... - template_folder: Any = ... - root_path: Any = ... - cli: AppGroup = ... - def __init__(self, import_name: Any, template_folder: Any | None = ..., root_path: Any | None = ...) -> None: ... - static_folder: Any = ... - static_url_path: Any = ... - @property - def has_static_folder(self): ... - def jinja_loader(self): ... - def get_send_file_max_age(self, filename: Any): ... - def send_static_file(self, filename: Any) -> Response: ... - def open_resource(self, resource: Any, mode: str = ...): ... - -def total_seconds(td: Any): ... -def is_ip(value: Any): ... diff --git a/stubs/Flask/flask/json/__init__.pyi b/stubs/Flask/flask/json/__init__.pyi deleted file mode 100644 index efdc897..0000000 --- a/stubs/Flask/flask/json/__init__.pyi +++ /dev/null @@ -1,19 +0,0 @@ -import json as _json -from typing import Any - -from jinja2 import Markup - -class JSONEncoder(_json.JSONEncoder): - def default(self, o: Any): ... - -class JSONDecoder(_json.JSONDecoder): ... - -def detect_encoding(data: bytes) -> str: ... # undocumented -def dumps(obj: Any, **kwargs: Any): ... -def dump(obj: Any, fp: Any, **kwargs: Any) -> None: ... -def loads(s: Any, **kwargs: Any): ... -def load(fp: Any, **kwargs: Any): ... -def htmlsafe_dumps(obj: Any, **kwargs: Any): ... -def htmlsafe_dump(obj: Any, fp: Any, **kwargs: Any) -> None: ... -def jsonify(*args: Any, **kwargs: Any): ... -def tojson_filter(obj: Any, **kwargs: Any) -> Markup: ... # undocumented diff --git a/stubs/Flask/flask/json/tag.pyi b/stubs/Flask/flask/json/tag.pyi deleted file mode 100644 index 4b9d15a..0000000 --- a/stubs/Flask/flask/json/tag.pyi +++ /dev/null @@ -1,67 +0,0 @@ -from typing import Any - -class JSONTag: - key: Any = ... - serializer: Any = ... - def __init__(self, serializer: Any) -> None: ... - def check(self, value: Any) -> None: ... - def to_json(self, value: Any) -> None: ... - def to_python(self, value: Any) -> None: ... - def tag(self, value: Any): ... - -class TagDict(JSONTag): - key: str = ... - def check(self, value: Any): ... - def to_json(self, value: Any): ... - def to_python(self, value: Any): ... - -class PassDict(JSONTag): - def check(self, value: Any): ... - def to_json(self, value: Any): ... - tag: Any = ... - -class TagTuple(JSONTag): - key: str = ... - def check(self, value: Any): ... - def to_json(self, value: Any): ... - def to_python(self, value: Any): ... - -class PassList(JSONTag): - def check(self, value: Any): ... - def to_json(self, value: Any): ... - tag: Any = ... - -class TagBytes(JSONTag): - key: str = ... - def check(self, value: Any): ... - def to_json(self, value: Any): ... - def to_python(self, value: Any): ... - -class TagMarkup(JSONTag): - key: str = ... - def check(self, value: Any): ... - def to_json(self, value: Any): ... - def to_python(self, value: Any): ... - -class TagUUID(JSONTag): - key: str = ... - def check(self, value: Any): ... - def to_json(self, value: Any): ... - def to_python(self, value: Any): ... - -class TagDateTime(JSONTag): - key: str = ... - def check(self, value: Any): ... - def to_json(self, value: Any): ... - def to_python(self, value: Any): ... - -class TaggedJSONSerializer: - default_tags: Any = ... - tags: Any = ... - order: Any = ... - def __init__(self) -> None: ... - def register(self, tag_class: Any, force: bool = ..., index: Any | None = ...) -> None: ... - def tag(self, value: Any): ... - def untag(self, value: Any): ... - def dumps(self, value: Any): ... - def loads(self, value: Any): ... diff --git a/stubs/Flask/flask/logging.pyi b/stubs/Flask/flask/logging.pyi deleted file mode 100644 index 9a69c75..0000000 --- a/stubs/Flask/flask/logging.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from _typeshed.wsgi import ErrorStream -from logging import Handler, Logger - -from .app import Flask - -wsgi_errors_stream: ErrorStream - -def has_level_handler(logger: Logger) -> bool: ... - -default_handler: Handler - -def create_logger(app: Flask) -> Logger: ... diff --git a/stubs/Flask/flask/sessions.pyi b/stubs/Flask/flask/sessions.pyi deleted file mode 100644 index 84c3fcc..0000000 --- a/stubs/Flask/flask/sessions.pyi +++ /dev/null @@ -1,57 +0,0 @@ -from abc import ABCMeta -from typing import Any, MutableMapping - -from werkzeug.datastructures import CallbackDict - -class SessionMixin(MutableMapping[str, Any], metaclass=ABCMeta): - @property - def permanent(self): ... - @permanent.setter - def permanent(self, value: Any) -> None: ... - new: bool = ... - modified: bool = ... - accessed: bool = ... - -class SecureCookieSession(CallbackDict[str, Any], SessionMixin): - modified: bool = ... - accessed: bool = ... - def __init__(self, initial: Any | None = ...) -> None: ... - def __getitem__(self, key: Any): ... - def get(self, key: Any, default: Any | None = ...): ... - def setdefault(self, key: Any, default: Any | None = ...): ... - -class NullSession(SecureCookieSession): - __setitem__: Any = ... - __delitem__: Any = ... - clear: Any = ... - pop: Any = ... - popitem: Any = ... - update: Any = ... - setdefault: Any = ... - -class SessionInterface: - null_session_class: Any = ... - pickle_based: bool = ... - def make_null_session(self, app: Any): ... - def is_null_session(self, obj: Any): ... - def get_cookie_domain(self, app: Any): ... - def get_cookie_path(self, app: Any): ... - def get_cookie_httponly(self, app: Any): ... - def get_cookie_secure(self, app: Any): ... - def get_cookie_samesite(self, app: Any): ... - def get_expiration_time(self, app: Any, session: Any): ... - def should_set_cookie(self, app: Any, session: Any): ... - def open_session(self, app: Any, request: Any) -> None: ... - def save_session(self, app: Any, session: Any, response: Any) -> None: ... - -session_json_serializer: Any - -class SecureCookieSessionInterface(SessionInterface): - salt: str = ... - digest_method: Any = ... - key_derivation: str = ... - serializer: Any = ... - session_class: Any = ... - def get_signing_serializer(self, app: Any): ... - def open_session(self, app: Any, request: Any): ... - def save_session(self, app: Any, session: Any, response: Any): ... diff --git a/stubs/Flask/flask/signals.pyi b/stubs/Flask/flask/signals.pyi deleted file mode 100644 index de7c195..0000000 --- a/stubs/Flask/flask/signals.pyi +++ /dev/null @@ -1,29 +0,0 @@ -from typing import Any - -signals_available: bool - -class Namespace: - def signal(self, name: Any, doc: Any | None = ...): ... - -class _FakeSignal: - name: Any = ... - __doc__: Any = ... - def __init__(self, name: Any, doc: Any | None = ...) -> None: ... - send: Any = ... - connect: Any = ... - disconnect: Any = ... - has_receivers_for: Any = ... - receivers_for: Any = ... - temporarily_connected_to: Any = ... - connected_to: Any = ... - -template_rendered: Any -before_render_template: Any -request_started: Any -request_finished: Any -request_tearing_down: Any -got_request_exception: Any -appcontext_tearing_down: Any -appcontext_pushed: Any -appcontext_popped: Any -message_flashed: Any diff --git a/stubs/Flask/flask/templating.pyi b/stubs/Flask/flask/templating.pyi deleted file mode 100644 index d9bf997..0000000 --- a/stubs/Flask/flask/templating.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Iterable, Text - -from jinja2 import BaseLoader, Environment as BaseEnvironment - -class Environment(BaseEnvironment): - app: Any = ... - def __init__(self, app: Any, **options: Any) -> None: ... - -class DispatchingJinjaLoader(BaseLoader): - app: Any = ... - def __init__(self, app: Any) -> None: ... - def get_source(self, environment: Any, template: Any): ... - def list_templates(self): ... - -def render_template(template_name_or_list: Text | Iterable[Text], **context: Any) -> Text: ... -def render_template_string(source: Text, **context: Any) -> Text: ... diff --git a/stubs/Flask/flask/testing.pyi b/stubs/Flask/flask/testing.pyi deleted file mode 100644 index 08f5a0d..0000000 --- a/stubs/Flask/flask/testing.pyi +++ /dev/null @@ -1,56 +0,0 @@ -from typing import IO, Any, Iterable, Mapping, Text, TypeVar - -from click import BaseCommand -from click.testing import CliRunner, Result -from werkzeug.test import Client, EnvironBuilder as WerkzeugEnvironBuilder - -# Response type for the client below. -# By default _R is Tuple[Iterable[Any], Text | int, werkzeug.datastructures.Headers], however -# most commonly it is wrapped in a Reponse object. -_R = TypeVar("_R") - -class FlaskClient(Client[_R]): - preserve_context: bool = ... - environ_base: Any = ... - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def session_transaction(self, *args: Any, **kwargs: Any) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ... - -class FlaskCliRunner(CliRunner): - app: Any = ... - def __init__(self, app: Any, **kwargs: Any) -> None: ... - def invoke( - self, - cli: BaseCommand | None = ..., - args: str | Iterable[str] | None = ..., - input: bytes | IO[Any] | Text | None = ..., - env: Mapping[str, str] | None = ..., - catch_exceptions: bool = ..., - color: bool = ..., - **extra: Any, - ) -> Result: ... - -class EnvironBuilder(WerkzeugEnvironBuilder): - app: Any - def __init__( - self, - app: Any, - path: str = ..., - base_url: Any | None = ..., - subdomain: Any | None = ..., - url_scheme: Any | None = ..., - *args: Any, - **kwargs: Any, - ) -> None: ... - def json_dumps(self, obj: Any, **kwargs: Any) -> str: ... - -def make_test_environ_builder( - app: Any, - path: str = ..., - base_url: Any | None = ..., - subdomain: Any | None = ..., - url_scheme: Any | None = ..., - *args: Any, - **kwargs: Any, -): ... diff --git a/stubs/Flask/flask/views.pyi b/stubs/Flask/flask/views.pyi deleted file mode 100644 index e611263..0000000 --- a/stubs/Flask/flask/views.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import Any - -http_method_funcs: Any - -class View: - methods: Any = ... - provide_automatic_options: Any = ... - decorators: Any = ... - def dispatch_request(self, *args: Any, **kwargs: Any) -> Any: ... - @classmethod - def as_view(cls, name: Any, *class_args: Any, **class_kwargs: Any): ... - -class MethodViewType(type): - def __init__(self, name: Any, bases: Any, d: Any) -> None: ... - -class MethodView(View, metaclass=MethodViewType): - def dispatch_request(self, *args: Any, **kwargs: Any) -> Any: ... diff --git a/stubs/Flask/flask/wrappers.pyi b/stubs/Flask/flask/wrappers.pyi deleted file mode 100644 index e5a4286..0000000 --- a/stubs/Flask/flask/wrappers.pyi +++ /dev/null @@ -1,32 +0,0 @@ -from typing import Any - -from werkzeug.exceptions import HTTPException -from werkzeug.routing import Rule -from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase - -class JSONMixin: - @property - def is_json(self) -> bool: ... - @property - def json(self): ... - def get_json(self, force: bool = ..., silent: bool = ..., cache: bool = ...): ... - def on_json_loading_failed(self, e: Any) -> None: ... - -class Request(RequestBase, JSONMixin): - url_rule: Rule | None = ... - view_args: dict[str, Any] = ... - routing_exception: HTTPException | None = ... - # Request is making the max_content_length readonly, where it was not the - # case in its supertype. - # We would require something like https://github.com/python/typing/issues/241 - @property - def max_content_length(self) -> int | None: ... # type: ignore - @property - def endpoint(self) -> str | None: ... - @property - def blueprint(self) -> str | None: ... - -class Response(ResponseBase, JSONMixin): - default_mimetype: str | None = ... - @property - def max_cookie_size(self) -> int: ... diff --git a/stubs/JACK-Client/@tests/stubtest_allowlist.txt b/stubs/JACK-Client/@tests/stubtest_allowlist.txt deleted file mode 100644 index b0b1dbc..0000000 --- a/stubs/JACK-Client/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1 +0,0 @@ -jack diff --git a/stubs/JACK-Client/METADATA.toml b/stubs/JACK-Client/METADATA.toml index 5f15410..5e65c85 100644 --- a/stubs/JACK-Client/METADATA.toml +++ b/stubs/JACK-Client/METADATA.toml @@ -1 +1,4 @@ -version = "0.1" +version = "0.5.*" + +[tool.stubtest] +apt_dependencies = ["libjack-dev"] diff --git a/stubs/JACK-Client/jack/__init__.pyi b/stubs/JACK-Client/jack/__init__.pyi index 7ce4d21..96b5b97 100644 --- a/stubs/JACK-Client/jack/__init__.pyi +++ b/stubs/JACK-Client/jack/__init__.pyi @@ -1,6 +1,9 @@ -from typing import Any, Callable, Generator, Iterable, Iterator, Sequence, Tuple, overload +from _typeshed import Self +from collections.abc import Callable, Generator, Iterable, Iterator, Sequence +from typing import Any, overload +from typing_extensions import Literal, TypeAlias -_NDArray = Any # FIXME: no typings for numpy arrays +_NDArray: TypeAlias = Any # FIXME: no typings for numpy arrays class _JackPositionT: ... @@ -50,6 +53,8 @@ class Client: servername: str | None = ..., session_id: str | None = ..., ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... @property def name(self) -> str: ... @property @@ -94,34 +99,34 @@ class Client: @transport_frame.setter def transport_frame(self, frame: int) -> None: ... def transport_locate(self, frame: int) -> None: ... - def transport_query(self) -> Tuple[TransportState, dict[str, Any]]: ... - def transport_query_struct(self) -> Tuple[TransportState, _JackPositionT]: ... + def transport_query(self) -> tuple[TransportState, dict[str, Any]]: ... + def transport_query_struct(self) -> tuple[TransportState, _JackPositionT]: ... def transport_reposition_struct(self, position: _JackPositionT) -> None: ... # TODO def set_sync_timeout(self, timeout: int) -> None: ... def set_freewheel(self, onoff: bool) -> None: ... - def set_shutdown_callback(self, callback: Callable[[Status, str], None]) -> None: ... - def set_process_callback(self, callback: Callable[[int], None]) -> None: ... - def set_freewheel_callback(self, callback: Callable[[bool], None]) -> None: ... - def set_blocksize_callback(self, callback: Callable[[int], None]) -> None: ... - def set_samplerate_callback(self, callback: Callable[[int], None]) -> None: ... - def set_client_registration_callback(self, callback: Callable[[str, bool], None]) -> None: ... + def set_shutdown_callback(self, callback: Callable[[Status, str], object]) -> None: ... + def set_process_callback(self, callback: Callable[[int], object]) -> None: ... + def set_freewheel_callback(self, callback: Callable[[bool], object]) -> None: ... + def set_blocksize_callback(self, callback: Callable[[int], object]) -> None: ... + def set_samplerate_callback(self, callback: Callable[[int], object]) -> None: ... + def set_client_registration_callback(self, callback: Callable[[str, bool], object]) -> None: ... def set_port_registration_callback( - self, callback: Callable[[Port, bool], None] | None = ..., only_available: bool = ... + self, callback: Callable[[Port, bool], object] | None = ..., only_available: bool = ... ) -> None: ... def set_port_connect_callback( - self, callback: Callable[[Port, Port, bool], None] | None = ..., only_available: bool = ... + self, callback: Callable[[Port, Port, bool], object] | None = ..., only_available: bool = ... ) -> None: ... def set_port_rename_callback( - self, callback: Callable[[Port, str, str], None] | None = ..., only_available: bool = ... + self, callback: Callable[[Port, str, str], object] | None = ..., only_available: bool = ... ) -> None: ... - def set_graph_order_callback(self, callback: Callable[[], None]) -> None: ... - def set_xrun_callback(self, callback: Callable[[float], None]) -> None: ... - def set_sync_callback(self, callback: Callable[[int, _JackPositionT], None] | None) -> None: ... + def set_graph_order_callback(self, callback: Callable[[], object]) -> None: ... + def set_xrun_callback(self, callback: Callable[[float], object]) -> None: ... + def set_sync_callback(self, callback: Callable[[int, _JackPositionT], object] | None) -> None: ... def release_timebase(self) -> None: ... def set_timebase_callback( - self, callback: Callable[[int, int, _JackPositionT, bool], None] | None = ..., conditional: bool = ... + self, callback: Callable[[int, int, _JackPositionT, bool], object] | None = ..., conditional: bool = ... ) -> bool: ... - def set_property_change_callback(self, callback: Callable[[int, str, int], None]) -> None: ... + def set_property_change_callback(self, callback: Callable[[int, str, int], object]) -> None: ... def get_uuid_for_client_name(self, name: str) -> str: ... def get_client_name_by_uuid(self, uuid: str) -> str: ... def get_port_by_name(self, name: str) -> Port: ... @@ -158,8 +163,10 @@ class Port: def unset_alias(self, alias: str) -> None: ... @property def uuid(self) -> str: ... - is_audio: bool = ... - is_midi: bool = ... + @property + def is_audio(self) -> bool: ... + @property + def is_midi(self) -> bool: ... @property def is_input(self) -> bool: ... @property @@ -173,8 +180,10 @@ class Port: def request_monitor(self, onoff: bool) -> None: ... class MidiPort(Port): - is_audio: bool = ... - is_midi: bool = ... + @property + def is_audio(self) -> Literal[False]: ... + @property + def is_midi(self) -> Literal[True]: ... class OwnPort(Port): @property @@ -196,7 +205,7 @@ class OwnMidiPort(MidiPort, OwnPort): def max_event_size(self) -> int: ... @property def lost_midi_events(self) -> int: ... - def incoming_midi_events(self) -> Generator[Tuple[int, _CBufferType], None, None]: ... + def incoming_midi_events(self) -> Generator[tuple[int, _CBufferType], None, None]: ... def clear_buffer(self) -> None: ... def write_midi_event(self, time: int, event: bytes | Sequence[int] | _CBufferType) -> None: ... def reserve_midi_event(self, time: int, size: int) -> _CBufferType: ... @@ -215,14 +224,14 @@ class RingBuffer: def write_space(self) -> int: ... def write(self, data: bytes | Iterable[int] | _CBufferType) -> int: ... @property - def write_buffers(self) -> Tuple[_CBufferType, _CBufferType]: ... + def write_buffers(self) -> tuple[_CBufferType, _CBufferType]: ... def write_advance(self, size: int) -> None: ... @property def read_space(self) -> int: ... def read(self, size: int) -> _CBufferType: ... def peek(self, size: int) -> _CBufferType: ... @property - def read_buffers(self) -> Tuple[_CBufferType, _CBufferType]: ... + def read_buffers(self) -> tuple[_CBufferType, _CBufferType]: ... def read_advance(self, size: int) -> None: ... def mlock(self) -> None: ... def reset(self, size: int | None = ...) -> None: ... @@ -265,14 +274,14 @@ class TransportState: class CallbackExit(Exception): ... -def get_property(subject: int | str, key: str) -> Tuple[bytes, str] | None: ... -def get_properties(subject: int | str) -> dict[str, Tuple[bytes, str]]: ... -def get_all_properties() -> dict[str, dict[str, Tuple[bytes, str]]]: ... +def get_property(subject: int | str, key: str) -> tuple[bytes, str] | None: ... +def get_properties(subject: int | str) -> dict[str, tuple[bytes, str]]: ... +def get_all_properties() -> dict[str, dict[str, tuple[bytes, str]]]: ... def position2dict(pos: _JackPositionT) -> dict[str, Any]: ... -def version() -> Tuple[int, int, int, int]: ... +def version() -> tuple[int, int, int, int]: ... def version_string() -> str: ... def client_name_size() -> int: ... def port_name_size() -> int: ... -def set_error_function(callback: Callable[[str], None] | None = ...) -> None: ... -def set_info_function(callback: Callable[[str], None] | None = ...) -> None: ... +def set_error_function(callback: Callable[[str], object] | None = ...) -> None: ... +def set_info_function(callback: Callable[[str], object] | None = ...) -> None: ... def client_pid(name: str) -> int: ... diff --git a/stubs/Jinja2/@tests/stubtest_allowlist.txt b/stubs/Jinja2/@tests/stubtest_allowlist.txt deleted file mode 100644 index 9f63edb..0000000 --- a/stubs/Jinja2/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,111 +0,0 @@ -jinja2.Environment.__init__ -jinja2.Environment.extract_translations -jinja2.Environment.handle_exception -jinja2.Environment.install_gettext_callables -jinja2.Environment.install_gettext_translations -jinja2.Environment.install_null_translations -jinja2.Environment.uninstall_gettext_translations -jinja2.Markup.__getslice__ -jinja2.Markup.__mod__ -jinja2.Markup.center -jinja2.Markup.ljust -jinja2.Markup.lstrip -jinja2.Markup.replace -jinja2.Markup.rjust -jinja2.Markup.rstrip -jinja2.Markup.strip -jinja2.Markup.translate -jinja2.Markup.zfill -jinja2.Template.__new__ -jinja2.TemplateError.__unicode__ -jinja2._compat.get_next -jinja2._stringdefs -jinja2.compiler.CodeGenerator.__init__ -jinja2.compiler.CodeGenerator.binop -jinja2.compiler.CodeGenerator.export_assigned_vars -jinja2.compiler.CodeGenerator.function_scoping -jinja2.compiler.CodeGenerator.macro_body -jinja2.compiler.CodeGenerator.macro_def -jinja2.compiler.CodeGenerator.make_assignment_frame -jinja2.compiler.CodeGenerator.pop_scope -jinja2.compiler.CodeGenerator.pull_locals -jinja2.compiler.CodeGenerator.push_scope -jinja2.compiler.CodeGenerator.return_buffer_contents -jinja2.compiler.CodeGenerator.uaop -jinja2.compiler.CodeGenerator.unoptimize_scope -jinja2.compiler.Frame.__init__ -jinja2.compiler.Frame.find_shadowed -jinja2.compiler.Frame.inner -jinja2.compiler.Frame.inspect -jinja2.compiler.FrameIdentifierVisitor -jinja2.compiler.Identifiers -jinja2.compiler.generate -jinja2.compiler.unoptimize_before_dead_code -jinja2.debug.ProcessedTraceback -jinja2.debug.TracebackFrameProxy -jinja2.debug.fake_exc_info -jinja2.debug.make_frame_proxy -jinja2.debug.make_traceback -jinja2.debug.raise_helper -jinja2.debug.tproxy -jinja2.debug.translate_exception -jinja2.debug.translate_syntax_error -jinja2.environment.Environment.__init__ -jinja2.environment.Environment.extract_translations -jinja2.environment.Environment.handle_exception -jinja2.environment.Environment.install_gettext_callables -jinja2.environment.Environment.install_gettext_translations -jinja2.environment.Environment.install_null_translations -jinja2.environment.Environment.uninstall_gettext_translations -jinja2.environment.Template.__new__ -jinja2.environment.TemplateModule.__init__ -jinja2.environment.get_spontaneous_environment -jinja2.exceptions.TemplateError.__unicode__ -jinja2.ext.ExtensionRegistry.__new__ -jinja2.filters.do_dictsort -jinja2.filters.do_indent -jinja2.filters.do_random -jinja2.filters.do_trim -jinja2.filters.do_truncate -jinja2.filters.do_urlize -jinja2.filters.do_wordwrap -jinja2.filters.make_attrgetter -jinja2.meta.TrackingCodeGenerator.pull_locals -jinja2.optimizer.Optimizer.fold -jinja2.optimizer.Optimizer.visit_If -jinja2.parser.Parser.parse_add -jinja2.parser.Parser.parse_assign_target -jinja2.parser.Parser.parse_div -jinja2.parser.Parser.parse_floordiv -jinja2.parser.Parser.parse_mod -jinja2.parser.Parser.parse_mul -jinja2.parser.Parser.parse_sub -jinja2.runtime.Context.call -jinja2.runtime.LoopContext.__init__ -jinja2.runtime.LoopContext.loop -jinja2.runtime.LoopContextIterator -jinja2.runtime.Macro.__init__ -jinja2.runtime.Markup.__getslice__ -jinja2.runtime.Markup.__mod__ -jinja2.runtime.Markup.center -jinja2.runtime.Markup.ljust -jinja2.runtime.Markup.lstrip -jinja2.runtime.Markup.replace -jinja2.runtime.Markup.rjust -jinja2.runtime.Markup.rstrip -jinja2.runtime.Markup.strip -jinja2.runtime.Markup.translate -jinja2.runtime.Markup.zfill -jinja2.sandbox.SandboxedEnvironment.call -jinja2.tests.test_equalto -jinja2.utils.Markup.__getslice__ -jinja2.utils.Markup.__mod__ -jinja2.utils.Markup.center -jinja2.utils.Markup.ljust -jinja2.utils.Markup.lstrip -jinja2.utils.Markup.replace -jinja2.utils.Markup.rjust -jinja2.utils.Markup.rstrip -jinja2.utils.Markup.strip -jinja2.utils.Markup.translate -jinja2.utils.Markup.zfill diff --git a/stubs/Jinja2/METADATA.toml b/stubs/Jinja2/METADATA.toml deleted file mode 100644 index 0edeb45..0000000 --- a/stubs/Jinja2/METADATA.toml +++ /dev/null @@ -1,4 +0,0 @@ -version = "2.11" -python2 = true -requires = ["types-MarkupSafe"] -obsolete_since = "3.0" diff --git a/stubs/Jinja2/jinja2/__init__.pyi b/stubs/Jinja2/jinja2/__init__.pyi deleted file mode 100644 index 1121f8d..0000000 --- a/stubs/Jinja2/jinja2/__init__.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from jinja2.bccache import ( - BytecodeCache as BytecodeCache, - FileSystemBytecodeCache as FileSystemBytecodeCache, - MemcachedBytecodeCache as MemcachedBytecodeCache, -) -from jinja2.environment import Environment as Environment, Template as Template -from jinja2.exceptions import ( - TemplateAssertionError as TemplateAssertionError, - TemplateError as TemplateError, - TemplateNotFound as TemplateNotFound, - TemplatesNotFound as TemplatesNotFound, - TemplateSyntaxError as TemplateSyntaxError, - UndefinedError as UndefinedError, -) -from jinja2.filters import ( - contextfilter as contextfilter, - environmentfilter as environmentfilter, - evalcontextfilter as evalcontextfilter, -) -from jinja2.loaders import ( - BaseLoader as BaseLoader, - ChoiceLoader as ChoiceLoader, - DictLoader as DictLoader, - FileSystemLoader as FileSystemLoader, - FunctionLoader as FunctionLoader, - ModuleLoader as ModuleLoader, - PackageLoader as PackageLoader, - PrefixLoader as PrefixLoader, -) -from jinja2.runtime import ( - DebugUndefined as DebugUndefined, - StrictUndefined as StrictUndefined, - Undefined as Undefined, - make_logging_undefined as make_logging_undefined, -) -from jinja2.utils import ( - Markup as Markup, - clear_caches as clear_caches, - contextfunction as contextfunction, - environmentfunction as environmentfunction, - escape as escape, - evalcontextfunction as evalcontextfunction, - is_undefined as is_undefined, - select_autoescape as select_autoescape, -) diff --git a/stubs/Jinja2/jinja2/_compat.pyi b/stubs/Jinja2/jinja2/_compat.pyi deleted file mode 100644 index f85bd0f..0000000 --- a/stubs/Jinja2/jinja2/_compat.pyi +++ /dev/null @@ -1,36 +0,0 @@ -import sys -from typing import Any - -if sys.version_info >= (3,): - from urllib.parse import quote_from_bytes - - url_quote = quote_from_bytes -else: - import urllib - - url_quote = urllib.quote - -PY2: Any -PYPY: Any -unichr: Any -range_type: Any -text_type: Any -string_types: Any -integer_types: Any -iterkeys: Any -itervalues: Any -iteritems: Any -NativeStringIO: Any - -def reraise(tp, value, tb: Any | None = ...): ... - -ifilter: Any -imap: Any -izip: Any -intern: Any -implements_iterator: Any -implements_to_string: Any -encode_filename: Any -get_next: Any - -def with_metaclass(meta, *bases): ... diff --git a/stubs/Jinja2/jinja2/_stringdefs.pyi b/stubs/Jinja2/jinja2/_stringdefs.pyi deleted file mode 100644 index 060f888..0000000 --- a/stubs/Jinja2/jinja2/_stringdefs.pyi +++ /dev/null @@ -1,40 +0,0 @@ -from typing import Any - -Cc: str -Cf: str -Cn: str -Co: str -Cs: Any -Ll: str -Lm: str -Lo: str -Lt: str -Lu: str -Mc: str -Me: str -Mn: str -Nd: str -Nl: str -No: str -Pc: str -Pd: str -Pe: str -Pf: str -Pi: str -Po: str -Ps: str -Sc: str -Sk: str -Sm: str -So: str -Zl: str -Zp: str -Zs: str -cats: Any - -def combine(*args): ... - -xid_start: str -xid_continue: str - -def allexcept(*args): ... diff --git a/stubs/Jinja2/jinja2/bccache.pyi b/stubs/Jinja2/jinja2/bccache.pyi deleted file mode 100644 index 2f39dce..0000000 --- a/stubs/Jinja2/jinja2/bccache.pyi +++ /dev/null @@ -1,44 +0,0 @@ -from typing import Any - -marshal_dump: Any -marshal_load: Any -bc_version: int -bc_magic: Any - -class Bucket: - environment: Any - key: Any - checksum: Any - def __init__(self, environment, key, checksum) -> None: ... - code: Any - def reset(self): ... - def load_bytecode(self, f): ... - def write_bytecode(self, f): ... - def bytecode_from_string(self, string): ... - def bytecode_to_string(self): ... - -class BytecodeCache: - def load_bytecode(self, bucket): ... - def dump_bytecode(self, bucket): ... - def clear(self): ... - def get_cache_key(self, name, filename: Any | None = ...): ... - def get_source_checksum(self, source): ... - def get_bucket(self, environment, name, filename, source): ... - def set_bucket(self, bucket): ... - -class FileSystemBytecodeCache(BytecodeCache): - directory: Any - pattern: Any - def __init__(self, directory: Any | None = ..., pattern: str = ...) -> None: ... - def load_bytecode(self, bucket): ... - def dump_bytecode(self, bucket): ... - def clear(self): ... - -class MemcachedBytecodeCache(BytecodeCache): - client: Any - prefix: Any - timeout: Any - ignore_memcache_errors: Any - def __init__(self, client, prefix: str = ..., timeout: Any | None = ..., ignore_memcache_errors: bool = ...) -> None: ... - def load_bytecode(self, bucket): ... - def dump_bytecode(self, bucket): ... diff --git a/stubs/Jinja2/jinja2/compiler.pyi b/stubs/Jinja2/jinja2/compiler.pyi deleted file mode 100644 index 43eb332..0000000 --- a/stubs/Jinja2/jinja2/compiler.pyi +++ /dev/null @@ -1,177 +0,0 @@ -from keyword import iskeyword as is_python_keyword -from typing import Any - -from jinja2.visitor import NodeVisitor - -operators: Any -dict_item_iter: str - -unoptimize_before_dead_code: bool - -def generate(node, environment, name, filename, stream: Any | None = ..., defer_init: bool = ...): ... -def has_safe_repr(value): ... -def find_undeclared(nodes, names): ... - -class Identifiers: - declared: Any - outer_undeclared: Any - undeclared: Any - declared_locally: Any - declared_parameter: Any - def __init__(self) -> None: ... - def add_special(self, name): ... - def is_declared(self, name): ... - def copy(self): ... - -class Frame: - eval_ctx: Any - identifiers: Any - toplevel: bool - rootlevel: bool - require_output_check: Any - buffer: Any - block: Any - assigned_names: Any - parent: Any - def __init__(self, eval_ctx, parent: Any | None = ...) -> None: ... - def copy(self): ... - def inspect(self, nodes): ... - def find_shadowed(self, extra: Any = ...): ... - def inner(self): ... - def soft(self): ... - __copy__: Any - -class VisitorExit(RuntimeError): ... - -class DependencyFinderVisitor(NodeVisitor): - filters: Any - tests: Any - def __init__(self) -> None: ... - def visit_Filter(self, node): ... - def visit_Test(self, node): ... - def visit_Block(self, node): ... - -class UndeclaredNameVisitor(NodeVisitor): - names: Any - undeclared: Any - def __init__(self, names) -> None: ... - def visit_Name(self, node): ... - def visit_Block(self, node): ... - -class FrameIdentifierVisitor(NodeVisitor): - identifiers: Any - def __init__(self, identifiers) -> None: ... - def visit_Name(self, node): ... - def visit_If(self, node): ... - def visit_Macro(self, node): ... - def visit_Import(self, node): ... - def visit_FromImport(self, node): ... - def visit_Assign(self, node): ... - def visit_For(self, node): ... - def visit_CallBlock(self, node): ... - def visit_FilterBlock(self, node): ... - def visit_AssignBlock(self, node): ... - def visit_Scope(self, node): ... - def visit_Block(self, node): ... - -class CompilerExit(Exception): ... - -class CodeGenerator(NodeVisitor): - environment: Any - name: Any - filename: Any - stream: Any - created_block_context: bool - defer_init: Any - import_aliases: Any - blocks: Any - extends_so_far: int - has_known_extends: bool - code_lineno: int - tests: Any - filters: Any - debug_info: Any - def __init__(self, environment, name, filename, stream: Any | None = ..., defer_init: bool = ...) -> None: ... - def fail(self, msg, lineno): ... - def temporary_identifier(self): ... - def buffer(self, frame): ... - def return_buffer_contents(self, frame): ... - def indent(self): ... - def outdent(self, step: int = ...): ... - def start_write(self, frame, node: Any | None = ...): ... - def end_write(self, frame): ... - def simple_write(self, s, frame, node: Any | None = ...): ... - def blockvisit(self, nodes, frame): ... - def write(self, x): ... - def writeline(self, x, node: Any | None = ..., extra: int = ...): ... - def newline(self, node: Any | None = ..., extra: int = ...): ... - def signature(self, node, frame, extra_kwargs: Any | None = ...): ... - def pull_locals(self, frame): ... - def pull_dependencies(self, nodes): ... - def unoptimize_scope(self, frame): ... - def push_scope(self, frame, extra_vars: Any = ...): ... - def pop_scope(self, aliases, frame): ... - def function_scoping(self, node, frame, children: Any | None = ..., find_special: bool = ...): ... - def macro_body(self, node, frame, children: Any | None = ...): ... - def macro_def(self, node, frame): ... - def position(self, node): ... - def visit_Template(self, node, frame: Any | None = ...): ... - def visit_Block(self, node, frame): ... - def visit_Extends(self, node, frame): ... - def visit_Include(self, node, frame): ... - def visit_Import(self, node, frame): ... - def visit_FromImport(self, node, frame): ... - def visit_For(self, node, frame): ... - def visit_If(self, node, frame): ... - def visit_Macro(self, node, frame): ... - def visit_CallBlock(self, node, frame): ... - def visit_FilterBlock(self, node, frame): ... - def visit_ExprStmt(self, node, frame): ... - def visit_Output(self, node, frame): ... - def make_assignment_frame(self, frame): ... - def export_assigned_vars(self, frame, assignment_frame): ... - def visit_Assign(self, node, frame): ... - def visit_AssignBlock(self, node, frame): ... - def visit_Name(self, node, frame): ... - def visit_Const(self, node, frame): ... - def visit_TemplateData(self, node, frame): ... - def visit_Tuple(self, node, frame): ... - def visit_List(self, node, frame): ... - def visit_Dict(self, node, frame): ... - def binop(self, interceptable: bool = ...): ... - def uaop(self, interceptable: bool = ...): ... - visit_Add: Any - visit_Sub: Any - visit_Mul: Any - visit_Div: Any - visit_FloorDiv: Any - visit_Pow: Any - visit_Mod: Any - visit_And: Any - visit_Or: Any - visit_Pos: Any - visit_Neg: Any - visit_Not: Any - def visit_Concat(self, node, frame): ... - def visit_Compare(self, node, frame): ... - def visit_Operand(self, node, frame): ... - def visit_Getattr(self, node, frame): ... - def visit_Getitem(self, node, frame): ... - def visit_Slice(self, node, frame): ... - def visit_Filter(self, node, frame): ... - def visit_Test(self, node, frame): ... - def visit_CondExpr(self, node, frame): ... - def visit_Call(self, node, frame, forward_caller: bool = ...): ... - def visit_Keyword(self, node, frame): ... - def visit_MarkSafe(self, node, frame): ... - def visit_MarkSafeIfAutoescape(self, node, frame): ... - def visit_EnvironmentAttribute(self, node, frame): ... - def visit_ExtensionAttribute(self, node, frame): ... - def visit_ImportedName(self, node, frame): ... - def visit_InternalName(self, node, frame): ... - def visit_ContextReference(self, node, frame): ... - def visit_Continue(self, node, frame): ... - def visit_Break(self, node, frame): ... - def visit_Scope(self, node, frame): ... - def visit_EvalContextModifier(self, node, frame): ... - def visit_ScopedEvalContextModifier(self, node, frame): ... diff --git a/stubs/Jinja2/jinja2/constants.pyi b/stubs/Jinja2/jinja2/constants.pyi deleted file mode 100644 index 55ea3ea..0000000 --- a/stubs/Jinja2/jinja2/constants.pyi +++ /dev/null @@ -1 +0,0 @@ -LOREM_IPSUM_WORDS: str diff --git a/stubs/Jinja2/jinja2/debug.pyi b/stubs/Jinja2/jinja2/debug.pyi deleted file mode 100644 index 5bffa43..0000000 --- a/stubs/Jinja2/jinja2/debug.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from typing import Any - -tproxy: Any -raise_helper: str - -class TracebackFrameProxy: - tb: Any - def __init__(self, tb) -> None: ... - @property - def tb_next(self): ... - def set_next(self, next): ... - @property - def is_jinja_frame(self): ... - def __getattr__(self, name): ... - -def make_frame_proxy(frame): ... - -class ProcessedTraceback: - exc_type: Any - exc_value: Any - frames: Any - def __init__(self, exc_type, exc_value, frames) -> None: ... - def render_as_text(self, limit: Any | None = ...): ... - def render_as_html(self, full: bool = ...): ... - @property - def is_template_syntax_error(self): ... - @property - def exc_info(self): ... - @property - def standard_exc_info(self): ... - -def make_traceback(exc_info, source_hint: Any | None = ...): ... -def translate_syntax_error(error, source: Any | None = ...): ... -def translate_exception(exc_info, initial_skip: int = ...): ... -def fake_exc_info(exc_info, filename, lineno): ... - -tb_set_next: Any diff --git a/stubs/Jinja2/jinja2/defaults.pyi b/stubs/Jinja2/jinja2/defaults.pyi deleted file mode 100644 index 8ab2a32..0000000 --- a/stubs/Jinja2/jinja2/defaults.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from typing import Any, Dict - -from jinja2.filters import FILTERS -from jinja2.tests import TESTS - -DEFAULT_FILTERS = FILTERS -DEFAULT_TESTS = TESTS - -BLOCK_START_STRING: str -BLOCK_END_STRING: str -VARIABLE_START_STRING: str -VARIABLE_END_STRING: str -COMMENT_START_STRING: str -COMMENT_END_STRING: str -LINE_STATEMENT_PREFIX: str | None -LINE_COMMENT_PREFIX: str | None -TRIM_BLOCKS: bool -LSTRIP_BLOCKS: bool -NEWLINE_SEQUENCE: str -KEEP_TRAILING_NEWLINE: bool -DEFAULT_NAMESPACE: dict[str, Any] -DEFAULT_POLICIES = Dict[str, Any] diff --git a/stubs/Jinja2/jinja2/environment.pyi b/stubs/Jinja2/jinja2/environment.pyi deleted file mode 100644 index 6633375..0000000 --- a/stubs/Jinja2/jinja2/environment.pyi +++ /dev/null @@ -1,214 +0,0 @@ -import sys -from typing import Any, Callable, Iterator, Sequence, Text, Type - -from .bccache import BytecodeCache -from .loaders import BaseLoader -from .runtime import Context, Undefined - -if sys.version_info >= (3, 6): - from typing import AsyncIterator, Awaitable - -def get_spontaneous_environment(*args): ... -def create_cache(size): ... -def copy_cache(cache): ... -def load_extensions(environment, extensions): ... - -class Environment: - sandboxed: bool - overlayed: bool - linked_to: Any - shared: bool - exception_handler: Any - exception_formatter: Any - code_generator_class: Any - context_class: Any - block_start_string: Text - block_end_string: Text - variable_start_string: Text - variable_end_string: Text - comment_start_string: Text - comment_end_string: Text - line_statement_prefix: Text - line_comment_prefix: Text - trim_blocks: bool - lstrip_blocks: Any - newline_sequence: Text - keep_trailing_newline: bool - undefined: Type[Undefined] - optimized: bool - finalize: Callable[..., Any] - autoescape: Any - filters: Any - tests: Any - globals: dict[str, Any] - loader: BaseLoader - cache: Any - bytecode_cache: BytecodeCache - auto_reload: bool - extensions: list[Any] - def __init__( - self, - block_start_string: Text = ..., - block_end_string: Text = ..., - variable_start_string: Text = ..., - variable_end_string: Text = ..., - comment_start_string: Any = ..., - comment_end_string: Text = ..., - line_statement_prefix: Text = ..., - line_comment_prefix: Text = ..., - trim_blocks: bool = ..., - lstrip_blocks: bool = ..., - newline_sequence: Text = ..., - keep_trailing_newline: bool = ..., - extensions: list[Any] = ..., - optimized: bool = ..., - undefined: Type[Undefined] = ..., - finalize: Callable[..., Any] | None = ..., - autoescape: bool | Callable[[str], bool] = ..., - loader: BaseLoader | None = ..., - cache_size: int = ..., - auto_reload: bool = ..., - bytecode_cache: BytecodeCache | None = ..., - enable_async: bool = ..., - ) -> None: ... - def add_extension(self, extension): ... - def extend(self, **attributes): ... - def overlay( - self, - block_start_string: Text = ..., - block_end_string: Text = ..., - variable_start_string: Text = ..., - variable_end_string: Text = ..., - comment_start_string: Any = ..., - comment_end_string: Text = ..., - line_statement_prefix: Text = ..., - line_comment_prefix: Text = ..., - trim_blocks: bool = ..., - lstrip_blocks: bool = ..., - extensions: list[Any] = ..., - optimized: bool = ..., - undefined: Type[Undefined] = ..., - finalize: Callable[..., Any] = ..., - autoescape: bool = ..., - loader: BaseLoader | None = ..., - cache_size: int = ..., - auto_reload: bool = ..., - bytecode_cache: BytecodeCache | None = ..., - ): ... - lexer: Any - def iter_extensions(self): ... - def getitem(self, obj, argument): ... - def getattr(self, obj, attribute): ... - def call_filter( - self, name, value, args: Any | None = ..., kwargs: Any | None = ..., context: Any | None = ..., eval_ctx: Any | None = ... - ): ... - def call_test(self, name, value, args: Any | None = ..., kwargs: Any | None = ...): ... - def parse(self, source, name: Any | None = ..., filename: Any | None = ...): ... - def lex(self, source, name: Any | None = ..., filename: Any | None = ...): ... - def preprocess(self, source: Text, name: Any | None = ..., filename: Any | None = ...): ... - def compile(self, source, name: Any | None = ..., filename: Any | None = ..., raw: bool = ..., defer_init: bool = ...): ... - def compile_expression(self, source: Text, undefined_to_none: bool = ...): ... - def compile_templates( - self, - target, - extensions: Any | None = ..., - filter_func: Any | None = ..., - zip: str = ..., - log_function: Any | None = ..., - ignore_errors: bool = ..., - py_compile: bool = ..., - ): ... - def list_templates(self, extensions: Any | None = ..., filter_func: Any | None = ...): ... - def handle_exception(self, exc_info: Any | None = ..., rendered: bool = ..., source_hint: Any | None = ...): ... - def join_path(self, template: Template | Text, parent: Text) -> Text: ... - def get_template(self, name: Template | Text, parent: Text | None = ..., globals: Any | None = ...) -> Template: ... - def select_template( - self, names: Sequence[Template | Text], parent: Text | None = ..., globals: dict[str, Any] | None = ... - ) -> Template: ... - def get_or_select_template( - self, - template_name_or_list: Template | Text | Sequence[Template | Text], - parent: Text | None = ..., - globals: dict[str, Any] | None = ..., - ) -> Template: ... - def from_string( - self, source: Text, globals: dict[str, Any] | None = ..., template_class: Type[Template] | None = ... - ) -> Template: ... - def make_globals(self, d: dict[str, Any] | None) -> dict[str, Any]: ... - # Frequently added extensions are included here: - # from InternationalizationExtension: - def install_gettext_translations(self, translations: Any, newstyle: bool | None = ...): ... - def install_null_translations(self, newstyle: bool | None = ...): ... - def install_gettext_callables( - self, gettext: Callable[..., Any], ngettext: Callable[..., Any], newstyle: bool | None = ... - ): ... - def uninstall_gettext_translations(self, translations: Any): ... - def extract_translations(self, source: Any, gettext_functions: Any): ... - newstyle_gettext: bool - -class Template: - name: str | None - filename: str | None - def __new__( - cls, - source, - block_start_string: Any = ..., - block_end_string: Any = ..., - variable_start_string: Any = ..., - variable_end_string: Any = ..., - comment_start_string: Any = ..., - comment_end_string: Any = ..., - line_statement_prefix: Any = ..., - line_comment_prefix: Any = ..., - trim_blocks: Any = ..., - lstrip_blocks: Any = ..., - newline_sequence: Any = ..., - keep_trailing_newline: Any = ..., - extensions: Any = ..., - optimized: bool = ..., - undefined: Any = ..., - finalize: Any | None = ..., - autoescape: bool = ..., - ): ... - environment: Environment = ... - @classmethod - def from_code(cls, environment, code, globals, uptodate: Any | None = ...): ... - @classmethod - def from_module_dict(cls, environment, module_dict, globals): ... - def render(self, *args, **kwargs) -> Text: ... - def stream(self, *args, **kwargs) -> TemplateStream: ... - def generate(self, *args, **kwargs) -> Iterator[Text]: ... - def new_context( - self, vars: dict[str, Any] | None = ..., shared: bool = ..., locals: dict[str, Any] | None = ... - ) -> Context: ... - def make_module( - self, vars: dict[str, Any] | None = ..., shared: bool = ..., locals: dict[str, Any] | None = ... - ) -> Context: ... - @property - def module(self) -> Any: ... - def get_corresponding_lineno(self, lineno): ... - @property - def is_up_to_date(self) -> bool: ... - @property - def debug_info(self): ... - if sys.version_info >= (3, 6): - def render_async(self, *args, **kwargs) -> Awaitable[Text]: ... - def generate_async(self, *args, **kwargs) -> AsyncIterator[Text]: ... - -class TemplateModule: - __name__: Any - def __init__(self, template, context) -> None: ... - def __html__(self): ... - -class TemplateExpression: - def __init__(self, template, undefined_to_none) -> None: ... - def __call__(self, *args, **kwargs): ... - -class TemplateStream: - def __init__(self, gen) -> None: ... - def dump(self, fp, encoding: Text | None = ..., errors: Text = ...): ... - buffered: bool - def disable_buffering(self) -> None: ... - def enable_buffering(self, size: int = ...) -> None: ... - def __iter__(self): ... - def __next__(self): ... diff --git a/stubs/Jinja2/jinja2/exceptions.pyi b/stubs/Jinja2/jinja2/exceptions.pyi deleted file mode 100644 index c227a9b..0000000 --- a/stubs/Jinja2/jinja2/exceptions.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Any, Text - -class TemplateError(Exception): - def __init__(self, message: Text | None = ...) -> None: ... - @property - def message(self): ... - def __unicode__(self): ... - -class TemplateNotFound(IOError, LookupError, TemplateError): - message: Any - name: Any - templates: Any - def __init__(self, name, message: Text | None = ...) -> None: ... - -class TemplatesNotFound(TemplateNotFound): - templates: Any - def __init__(self, names: Any = ..., message: Text | None = ...) -> None: ... - -class TemplateSyntaxError(TemplateError): - lineno: int - name: Text - filename: Text - source: Text - translated: bool - def __init__(self, message: Text, lineno: int, name: Text | None = ..., filename: Text | None = ...) -> None: ... - -class TemplateAssertionError(TemplateSyntaxError): ... -class TemplateRuntimeError(TemplateError): ... -class UndefinedError(TemplateRuntimeError): ... -class SecurityError(TemplateRuntimeError): ... -class FilterArgumentError(TemplateRuntimeError): ... diff --git a/stubs/Jinja2/jinja2/ext.pyi b/stubs/Jinja2/jinja2/ext.pyi deleted file mode 100644 index 61ffa50..0000000 --- a/stubs/Jinja2/jinja2/ext.pyi +++ /dev/null @@ -1,66 +0,0 @@ -from typing import Any - -GETTEXT_FUNCTIONS: Any - -class ExtensionRegistry(type): - def __new__(cls, name, bases, d): ... - -class Extension: - tags: Any - priority: int - environment: Any - def __init__(self, environment) -> None: ... - def bind(self, environment): ... - def preprocess(self, source, name, filename: Any | None = ...): ... - def filter_stream(self, stream): ... - def parse(self, parser): ... - def attr(self, name, lineno: Any | None = ...): ... - def call_method( - self, - name, - args: Any | None = ..., - kwargs: Any | None = ..., - dyn_args: Any | None = ..., - dyn_kwargs: Any | None = ..., - lineno: Any | None = ..., - ): ... - -class InternationalizationExtension(Extension): - tags: Any - def __init__(self, environment) -> None: ... - def parse(self, parser): ... - -class ExprStmtExtension(Extension): - tags: Any - def parse(self, parser): ... - -class LoopControlExtension(Extension): - tags: Any - def parse(self, parser): ... - -class WithExtension(Extension): - tags: Any - def parse(self, parser): ... - -class AutoEscapeExtension(Extension): - tags: Any - def parse(self, parser): ... - -def extract_from_ast(node, gettext_functions: Any = ..., babel_style: bool = ...): ... - -class _CommentFinder: - tokens: Any - comment_tags: Any - offset: int - last_lineno: int - def __init__(self, tokens, comment_tags) -> None: ... - def find_backwards(self, offset): ... - def find_comments(self, lineno): ... - -def babel_extract(fileobj, keywords, comment_tags, options): ... - -i18n: Any -do: Any -loopcontrols: Any -with_: Any -autoescape: Any diff --git a/stubs/Jinja2/jinja2/filters.pyi b/stubs/Jinja2/jinja2/filters.pyi deleted file mode 100644 index ac5614e..0000000 --- a/stubs/Jinja2/jinja2/filters.pyi +++ /dev/null @@ -1,56 +0,0 @@ -from typing import Any, NamedTuple - -def contextfilter(f): ... -def evalcontextfilter(f): ... -def environmentfilter(f): ... -def make_attrgetter(environment, attribute): ... -def do_forceescape(value): ... -def do_urlencode(value): ... -def do_replace(eval_ctx, s, old, new, count: Any | None = ...): ... -def do_upper(s): ... -def do_lower(s): ... -def do_xmlattr(_eval_ctx, d, autospace: bool = ...): ... -def do_capitalize(s): ... -def do_title(s): ... -def do_dictsort(value, case_sensitive: bool = ..., by: str = ...): ... -def do_sort(environment, value, reverse: bool = ..., case_sensitive: bool = ..., attribute: Any | None = ...): ... -def do_default(value, default_value: str = ..., boolean: bool = ...): ... -def do_join(eval_ctx, value, d: str = ..., attribute: Any | None = ...): ... -def do_center(value, width: int = ...): ... -def do_first(environment, seq): ... -def do_last(environment, seq): ... -def do_random(environment, seq): ... -def do_filesizeformat(value, binary: bool = ...): ... -def do_pprint(value, verbose: bool = ...): ... -def do_urlize(eval_ctx, value, trim_url_limit: Any | None = ..., nofollow: bool = ..., target: Any | None = ...): ... -def do_indent(s, width: int = ..., indentfirst: bool = ...): ... -def do_truncate(s, length: int = ..., killwords: bool = ..., end: str = ...): ... -def do_wordwrap(environment, s, width: int = ..., break_long_words: bool = ..., wrapstring: Any | None = ...): ... -def do_wordcount(s): ... -def do_int(value, default: int = ..., base: int = ...): ... -def do_float(value, default: float = ...): ... -def do_format(value, *args, **kwargs): ... -def do_trim(value): ... -def do_striptags(value): ... -def do_slice(value, slices, fill_with: Any | None = ...): ... -def do_batch(value, linecount, fill_with: Any | None = ...): ... -def do_round(value, precision: int = ..., method: str = ...): ... -def do_groupby(environment, value, attribute): ... - -class _GroupTuple(NamedTuple): - grouper: Any - list: Any - -def do_sum(environment, iterable, attribute: Any | None = ..., start: int = ...): ... -def do_list(value): ... -def do_mark_safe(value): ... -def do_mark_unsafe(value): ... -def do_reverse(value): ... -def do_attr(environment, obj, name): ... -def do_map(*args, **kwargs): ... -def do_select(*args, **kwargs): ... -def do_reject(*args, **kwargs): ... -def do_selectattr(*args, **kwargs): ... -def do_rejectattr(*args, **kwargs): ... - -FILTERS: Any diff --git a/stubs/Jinja2/jinja2/lexer.pyi b/stubs/Jinja2/jinja2/lexer.pyi deleted file mode 100644 index 714f76f..0000000 --- a/stubs/Jinja2/jinja2/lexer.pyi +++ /dev/null @@ -1,117 +0,0 @@ -from typing import Any, Tuple - -whitespace_re: Any -string_re: Any -integer_re: Any -name_re: Any -float_re: Any -newline_re: Any -TOKEN_ADD: Any -TOKEN_ASSIGN: Any -TOKEN_COLON: Any -TOKEN_COMMA: Any -TOKEN_DIV: Any -TOKEN_DOT: Any -TOKEN_EQ: Any -TOKEN_FLOORDIV: Any -TOKEN_GT: Any -TOKEN_GTEQ: Any -TOKEN_LBRACE: Any -TOKEN_LBRACKET: Any -TOKEN_LPAREN: Any -TOKEN_LT: Any -TOKEN_LTEQ: Any -TOKEN_MOD: Any -TOKEN_MUL: Any -TOKEN_NE: Any -TOKEN_PIPE: Any -TOKEN_POW: Any -TOKEN_RBRACE: Any -TOKEN_RBRACKET: Any -TOKEN_RPAREN: Any -TOKEN_SEMICOLON: Any -TOKEN_SUB: Any -TOKEN_TILDE: Any -TOKEN_WHITESPACE: Any -TOKEN_FLOAT: Any -TOKEN_INTEGER: Any -TOKEN_NAME: Any -TOKEN_STRING: Any -TOKEN_OPERATOR: Any -TOKEN_BLOCK_BEGIN: Any -TOKEN_BLOCK_END: Any -TOKEN_VARIABLE_BEGIN: Any -TOKEN_VARIABLE_END: Any -TOKEN_RAW_BEGIN: Any -TOKEN_RAW_END: Any -TOKEN_COMMENT_BEGIN: Any -TOKEN_COMMENT_END: Any -TOKEN_COMMENT: Any -TOKEN_LINESTATEMENT_BEGIN: Any -TOKEN_LINESTATEMENT_END: Any -TOKEN_LINECOMMENT_BEGIN: Any -TOKEN_LINECOMMENT_END: Any -TOKEN_LINECOMMENT: Any -TOKEN_DATA: Any -TOKEN_INITIAL: Any -TOKEN_EOF: Any -operators: Any -reverse_operators: Any -operator_re: Any -ignored_tokens: Any -ignore_if_empty: Any - -def describe_token(token): ... -def describe_token_expr(expr): ... -def count_newlines(value): ... -def compile_rules(environment): ... - -class Failure: - message: Any - error_class: Any - def __init__(self, message, cls: Any = ...) -> None: ... - def __call__(self, lineno, filename): ... - -class Token(Tuple[int, Any, Any]): - lineno: Any - type: Any - value: Any - def __new__(cls, lineno, type, value): ... - def test(self, expr): ... - def test_any(self, *iterable): ... - -class TokenStreamIterator: - stream: Any - def __init__(self, stream) -> None: ... - def __iter__(self): ... - def __next__(self): ... - -class TokenStream: - name: Any - filename: Any - closed: bool - current: Any - def __init__(self, generator, name, filename) -> None: ... - def __iter__(self): ... - def __bool__(self): ... - __nonzero__: Any - eos: Any - def push(self, token): ... - def look(self): ... - def skip(self, n: int = ...): ... - def next_if(self, expr): ... - def skip_if(self, expr): ... - def __next__(self): ... - def close(self): ... - def expect(self, expr): ... - -def get_lexer(environment): ... - -class Lexer: - newline_sequence: Any - keep_trailing_newline: Any - rules: Any - def __init__(self, environment) -> None: ... - def tokenize(self, source, name: Any | None = ..., filename: Any | None = ..., state: Any | None = ...): ... - def wrap(self, stream, name: Any | None = ..., filename: Any | None = ...): ... - def tokeniter(self, source, name, filename: Any | None = ..., state: Any | None = ...): ... diff --git a/stubs/Jinja2/jinja2/loaders.pyi b/stubs/Jinja2/jinja2/loaders.pyi deleted file mode 100644 index f707c6b..0000000 --- a/stubs/Jinja2/jinja2/loaders.pyi +++ /dev/null @@ -1,78 +0,0 @@ -import sys -from types import ModuleType -from typing import Any, Callable, Iterable, Text, Tuple, Union - -from .environment import Environment - -if sys.version_info >= (3, 7): - from os import PathLike - - _SearchPath = Union[Text, PathLike[str], Iterable[Union[Text, PathLike[str]]]] -else: - _SearchPath = Union[Text, Iterable[Text]] - -def split_template_path(template: Text) -> list[Text]: ... - -class BaseLoader: - has_source_access: bool - def get_source(self, environment, template): ... - def list_templates(self): ... - def load(self, environment, name, globals: Any | None = ...): ... - -class FileSystemLoader(BaseLoader): - searchpath: Text - encoding: Any - followlinks: Any - def __init__(self, searchpath: _SearchPath, encoding: Text = ..., followlinks: bool = ...) -> None: ... - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ... - def list_templates(self): ... - -class PackageLoader(BaseLoader): - encoding: Text - manager: Any - filesystem_bound: Any - provider: Any - package_path: Any - def __init__(self, package_name: Text, package_path: Text = ..., encoding: Text = ...) -> None: ... - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ... - def list_templates(self): ... - -class DictLoader(BaseLoader): - mapping: Any - def __init__(self, mapping) -> None: ... - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ... - def list_templates(self): ... - -class FunctionLoader(BaseLoader): - load_func: Any - def __init__(self, load_func) -> None: ... - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text | None, Callable[..., Any] | None]: ... - -class PrefixLoader(BaseLoader): - mapping: Any - delimiter: Any - def __init__(self, mapping, delimiter: str = ...) -> None: ... - def get_loader(self, template): ... - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ... - def load(self, environment, name, globals: Any | None = ...): ... - def list_templates(self): ... - -class ChoiceLoader(BaseLoader): - loaders: Any - def __init__(self, loaders) -> None: ... - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ... - def load(self, environment, name, globals: Any | None = ...): ... - def list_templates(self): ... - -class _TemplateModule(ModuleType): ... - -class ModuleLoader(BaseLoader): - has_source_access: bool - module: Any - package_name: Any - def __init__(self, path) -> None: ... - @staticmethod - def get_template_key(name): ... - @staticmethod - def get_module_filename(name): ... - def load(self, environment, name, globals: Any | None = ...): ... diff --git a/stubs/Jinja2/jinja2/meta.pyi b/stubs/Jinja2/jinja2/meta.pyi deleted file mode 100644 index 8f0b50b..0000000 --- a/stubs/Jinja2/jinja2/meta.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any - -from jinja2.compiler import CodeGenerator - -class TrackingCodeGenerator(CodeGenerator): - undeclared_identifiers: Any - def __init__(self, environment) -> None: ... - def write(self, x): ... - def pull_locals(self, frame): ... - -def find_undeclared_variables(ast): ... -def find_referenced_templates(ast): ... diff --git a/stubs/Jinja2/jinja2/nodes.pyi b/stubs/Jinja2/jinja2/nodes.pyi deleted file mode 100644 index 6346ea0..0000000 --- a/stubs/Jinja2/jinja2/nodes.pyi +++ /dev/null @@ -1,254 +0,0 @@ -from typing import Any - -class Impossible(Exception): ... - -class NodeType(type): - def __new__(cls, name, bases, d): ... - -class EvalContext: - environment: Any - autoescape: Any - volatile: bool - def __init__(self, environment, template_name: Any | None = ...) -> None: ... - def save(self): ... - def revert(self, old): ... - -def get_eval_context(node, ctx): ... - -class Node: - fields: Any - attributes: Any - abstract: bool - def __init__(self, *fields, **attributes) -> None: ... - def iter_fields(self, exclude: Any | None = ..., only: Any | None = ...): ... - def iter_child_nodes(self, exclude: Any | None = ..., only: Any | None = ...): ... - def find(self, node_type): ... - def find_all(self, node_type): ... - def set_ctx(self, ctx): ... - def set_lineno(self, lineno, override: bool = ...): ... - def set_environment(self, environment): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - __hash__: Any - -class Stmt(Node): - abstract: bool - -class Helper(Node): - abstract: bool - -class Template(Node): - fields: Any - -class Output(Stmt): - fields: Any - -class Extends(Stmt): - fields: Any - -class For(Stmt): - fields: Any - -class If(Stmt): - fields: Any - -class Macro(Stmt): - fields: Any - name: str - args: list[Any] - defaults: list[Any] - body: list[Any] - -class CallBlock(Stmt): - fields: Any - -class FilterBlock(Stmt): - fields: Any - -class Block(Stmt): - fields: Any - -class Include(Stmt): - fields: Any - -class Import(Stmt): - fields: Any - -class FromImport(Stmt): - fields: Any - -class ExprStmt(Stmt): - fields: Any - -class Assign(Stmt): - fields: Any - -class AssignBlock(Stmt): - fields: Any - -class Expr(Node): - abstract: bool - def as_const(self, eval_ctx: Any | None = ...): ... - def can_assign(self): ... - -class BinExpr(Expr): - fields: Any - operator: Any - abstract: bool - def as_const(self, eval_ctx: Any | None = ...): ... - -class UnaryExpr(Expr): - fields: Any - operator: Any - abstract: bool - def as_const(self, eval_ctx: Any | None = ...): ... - -class Name(Expr): - fields: Any - def can_assign(self): ... - -class Literal(Expr): - abstract: bool - -class Const(Literal): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - @classmethod - def from_untrusted(cls, value, lineno: Any | None = ..., environment: Any | None = ...): ... - -class TemplateData(Literal): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Tuple(Literal): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - def can_assign(self): ... - -class List(Literal): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Dict(Literal): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Pair(Helper): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Keyword(Helper): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class CondExpr(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Filter(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Test(Expr): - fields: Any - -class Call(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Getitem(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - def can_assign(self): ... - -class Getattr(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - def can_assign(self): ... - -class Slice(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Concat(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Compare(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class Operand(Helper): - fields: Any - -class Mul(BinExpr): - operator: str - -class Div(BinExpr): - operator: str - -class FloorDiv(BinExpr): - operator: str - -class Add(BinExpr): - operator: str - -class Sub(BinExpr): - operator: str - -class Mod(BinExpr): - operator: str - -class Pow(BinExpr): - operator: str - -class And(BinExpr): - operator: str - def as_const(self, eval_ctx: Any | None = ...): ... - -class Or(BinExpr): - operator: str - def as_const(self, eval_ctx: Any | None = ...): ... - -class Not(UnaryExpr): - operator: str - -class Neg(UnaryExpr): - operator: str - -class Pos(UnaryExpr): - operator: str - -class EnvironmentAttribute(Expr): - fields: Any - -class ExtensionAttribute(Expr): - fields: Any - -class ImportedName(Expr): - fields: Any - -class InternalName(Expr): - fields: Any - def __init__(self) -> None: ... - -class MarkSafe(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class MarkSafeIfAutoescape(Expr): - fields: Any - def as_const(self, eval_ctx: Any | None = ...): ... - -class ContextReference(Expr): ... -class Continue(Stmt): ... -class Break(Stmt): ... - -class Scope(Stmt): - fields: Any - -class EvalContextModifier(Stmt): - fields: Any - -class ScopedEvalContextModifier(EvalContextModifier): - fields: Any diff --git a/stubs/Jinja2/jinja2/optimizer.pyi b/stubs/Jinja2/jinja2/optimizer.pyi deleted file mode 100644 index d0056ac..0000000 --- a/stubs/Jinja2/jinja2/optimizer.pyi +++ /dev/null @@ -1,30 +0,0 @@ -from typing import Any - -from jinja2.visitor import NodeTransformer - -def optimize(node, environment): ... - -class Optimizer(NodeTransformer): - environment: Any - def __init__(self, environment) -> None: ... - def visit_If(self, node): ... - def fold(self, node): ... - visit_Add: Any - visit_Sub: Any - visit_Mul: Any - visit_Div: Any - visit_FloorDiv: Any - visit_Pow: Any - visit_Mod: Any - visit_And: Any - visit_Or: Any - visit_Pos: Any - visit_Neg: Any - visit_Not: Any - visit_Compare: Any - visit_Getitem: Any - visit_Getattr: Any - visit_Call: Any - visit_Filter: Any - visit_Test: Any - visit_CondExpr: Any diff --git a/stubs/Jinja2/jinja2/parser.pyi b/stubs/Jinja2/jinja2/parser.pyi deleted file mode 100644 index ac99425..0000000 --- a/stubs/Jinja2/jinja2/parser.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from typing import Any - -class Parser: - environment: Any - stream: Any - name: Any - filename: Any - closed: bool - extensions: Any - def __init__( - self, environment, source, name: Any | None = ..., filename: Any | None = ..., state: Any | None = ... - ) -> None: ... - def fail(self, msg, lineno: Any | None = ..., exc: Any = ...): ... - def fail_unknown_tag(self, name, lineno: Any | None = ...): ... - def fail_eof(self, end_tokens: Any | None = ..., lineno: Any | None = ...): ... - def is_tuple_end(self, extra_end_rules: Any | None = ...): ... - def free_identifier(self, lineno: Any | None = ...): ... - def parse_statement(self): ... - def parse_statements(self, end_tokens, drop_needle: bool = ...): ... - def parse_set(self): ... - def parse_for(self): ... - def parse_if(self): ... - def parse_block(self): ... - def parse_extends(self): ... - def parse_import_context(self, node, default): ... - def parse_include(self): ... - def parse_import(self): ... - def parse_from(self): ... - def parse_signature(self, node): ... - def parse_call_block(self): ... - def parse_filter_block(self): ... - def parse_macro(self): ... - def parse_print(self): ... - def parse_assign_target(self, with_tuple: bool = ..., name_only: bool = ..., extra_end_rules: Any | None = ...): ... - def parse_expression(self, with_condexpr: bool = ...): ... - def parse_condexpr(self): ... - def parse_or(self): ... - def parse_and(self): ... - def parse_not(self): ... - def parse_compare(self): ... - def parse_add(self): ... - def parse_sub(self): ... - def parse_concat(self): ... - def parse_mul(self): ... - def parse_div(self): ... - def parse_floordiv(self): ... - def parse_mod(self): ... - def parse_pow(self): ... - def parse_unary(self, with_filter: bool = ...): ... - def parse_primary(self): ... - def parse_tuple( - self, - simplified: bool = ..., - with_condexpr: bool = ..., - extra_end_rules: Any | None = ..., - explicit_parentheses: bool = ..., - ): ... - def parse_list(self): ... - def parse_dict(self): ... - def parse_postfix(self, node): ... - def parse_filter_expr(self, node): ... - def parse_subscript(self, node): ... - def parse_subscribed(self): ... - def parse_call(self, node): ... - def parse_filter(self, node, start_inline: bool = ...): ... - def parse_test(self, node): ... - def subparse(self, end_tokens: Any | None = ...): ... - def parse(self): ... diff --git a/stubs/Jinja2/jinja2/runtime.pyi b/stubs/Jinja2/jinja2/runtime.pyi deleted file mode 100644 index d97f2c2..0000000 --- a/stubs/Jinja2/jinja2/runtime.pyi +++ /dev/null @@ -1,132 +0,0 @@ -from typing import Any, Text - -from jinja2.environment import Environment -from jinja2.exceptions import TemplateNotFound as TemplateNotFound, TemplateRuntimeError as TemplateRuntimeError -from jinja2.utils import Markup as Markup, concat as concat, escape as escape, missing as missing - -to_string: Any -identity: Any - -def markup_join(seq): ... -def unicode_join(seq): ... - -class TemplateReference: - def __init__(self, context) -> None: ... - def __getitem__(self, name): ... - -class Context: - parent: Context | dict[str, Any] - vars: dict[str, Any] - environment: Environment - eval_ctx: Any - exported_vars: Any - name: Text - blocks: dict[str, Any] - def __init__( - self, environment: Environment, parent: Context | dict[str, Any], name: Text, blocks: dict[str, Any] - ) -> None: ... - def super(self, name, current): ... - def get(self, key, default: Any | None = ...): ... - def resolve(self, key): ... - def get_exported(self): ... - def get_all(self): ... - def call(__self, __obj, *args, **kwargs): ... - def derived(self, locals: Any | None = ...): ... - keys: Any - values: Any - items: Any - iterkeys: Any - itervalues: Any - iteritems: Any - def __contains__(self, name): ... - def __getitem__(self, key): ... - -class BlockReference: - name: Any - def __init__(self, name, context, stack, depth) -> None: ... - @property - def super(self): ... - def __call__(self): ... - -class LoopContext: - index0: int - depth0: Any - def __init__(self, iterable, recurse: Any | None = ..., depth0: int = ...) -> None: ... - def cycle(self, *args): ... - first: Any - last: Any - index: Any - revindex: Any - revindex0: Any - depth: Any - def __len__(self): ... - def __iter__(self): ... - def loop(self, iterable): ... - __call__: Any - @property - def length(self): ... - -class LoopContextIterator: - context: Any - def __init__(self, context) -> None: ... - def __iter__(self): ... - def __next__(self): ... - -class Macro: - name: Any - arguments: Any - defaults: Any - catch_kwargs: Any - catch_varargs: Any - caller: Any - def __init__(self, environment, func, name, arguments, defaults, catch_kwargs, catch_varargs, caller) -> None: ... - def __call__(self, *args, **kwargs): ... - -class Undefined: - def __init__(self, hint: Any | None = ..., obj: Any = ..., name: Any | None = ..., exc: Any = ...) -> None: ... - def __getattr__(self, name): ... - __add__: Any - __radd__: Any - __mul__: Any - __rmul__: Any - __div__: Any - __rdiv__: Any - __truediv__: Any - __rtruediv__: Any - __floordiv__: Any - __rfloordiv__: Any - __mod__: Any - __rmod__: Any - __pos__: Any - __neg__: Any - __call__: Any - __getitem__: Any - __lt__: Any - __le__: Any - __gt__: Any - __ge__: Any - __int__: Any - __float__: Any - __complex__: Any - __pow__: Any - __rpow__: Any - def __eq__(self, other): ... - def __ne__(self, other): ... - def __hash__(self): ... - def __len__(self): ... - def __iter__(self): ... - def __nonzero__(self): ... - __bool__: Any - -def make_logging_undefined(logger: Any | None = ..., base: Any | None = ...): ... - -class DebugUndefined(Undefined): ... - -class StrictUndefined(Undefined): - __iter__: Any - __len__: Any - __nonzero__: Any - __eq__: Any - __ne__: Any - __bool__: Any - __hash__: Any diff --git a/stubs/Jinja2/jinja2/sandbox.pyi b/stubs/Jinja2/jinja2/sandbox.pyi deleted file mode 100644 index 1fc319c..0000000 --- a/stubs/Jinja2/jinja2/sandbox.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from typing import Any - -from jinja2.environment import Environment - -MAX_RANGE: int -UNSAFE_FUNCTION_ATTRIBUTES: Any -UNSAFE_METHOD_ATTRIBUTES: Any -UNSAFE_GENERATOR_ATTRIBUTES: Any - -def safe_range(*args): ... -def unsafe(f): ... -def is_internal_attribute(obj, attr): ... -def modifies_known_mutable(obj, attr): ... - -class SandboxedEnvironment(Environment): - sandboxed: bool - default_binop_table: Any - default_unop_table: Any - intercepted_binops: Any - intercepted_unops: Any - def intercept_unop(self, operator): ... - binop_table: Any - unop_table: Any - def __init__(self, *args, **kwargs) -> None: ... - def is_safe_attribute(self, obj, attr, value): ... - def is_safe_callable(self, obj): ... - def call_binop(self, context, operator, left, right): ... - def call_unop(self, context, operator, arg): ... - def getitem(self, obj, argument): ... - def getattr(self, obj, attribute): ... - def unsafe_undefined(self, obj, attribute): ... - def call(__self, __context, __obj, *args, **kwargs): ... - -class ImmutableSandboxedEnvironment(SandboxedEnvironment): - def is_safe_attribute(self, obj, attr, value): ... diff --git a/stubs/Jinja2/jinja2/tests.pyi b/stubs/Jinja2/jinja2/tests.pyi deleted file mode 100644 index 2645fe9..0000000 --- a/stubs/Jinja2/jinja2/tests.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from typing import Any - -number_re: Any -regex_type: Any -test_callable: Any - -def test_odd(value): ... -def test_even(value): ... -def test_divisibleby(value, num): ... -def test_defined(value): ... -def test_undefined(value): ... -def test_none(value): ... -def test_lower(value): ... -def test_upper(value): ... -def test_string(value): ... -def test_mapping(value): ... -def test_number(value): ... -def test_sequence(value): ... -def test_equalto(value, other): ... -def test_sameas(value, other): ... -def test_iterable(value): ... -def test_escaped(value): ... - -TESTS: Any diff --git a/stubs/Jinja2/jinja2/utils.pyi b/stubs/Jinja2/jinja2/utils.pyi deleted file mode 100644 index 41488c0..0000000 --- a/stubs/Jinja2/jinja2/utils.pyi +++ /dev/null @@ -1,84 +0,0 @@ -from _typeshed import StrOrBytesPath -from typing import IO, Any, Callable, Iterable, Protocol, Text, TypeVar -from typing_extensions import Literal - -from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode - -missing: Any -internal_code: Any -concat: Any - -_CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) - -class _ContextFunction(Protocol[_CallableT]): # type: ignore - contextfunction: Literal[True] - __call__: _CallableT - -class _EvalContextFunction(Protocol[_CallableT]): # type: ignore - evalcontextfunction: Literal[True] - __call__: _CallableT - -class _EnvironmentFunction(Protocol[_CallableT]): # type: ignore - environmentfunction: Literal[True] - __call__: _CallableT - -def contextfunction(f: _CallableT) -> _ContextFunction[_CallableT]: ... -def evalcontextfunction(f: _CallableT) -> _EvalContextFunction[_CallableT]: ... -def environmentfunction(f: _CallableT) -> _EnvironmentFunction[_CallableT]: ... -def internalcode(f: _CallableT) -> _CallableT: ... -def is_undefined(obj: object) -> bool: ... -def select_autoescape( - enabled_extensions: Iterable[str] = ..., - disabled_extensions: Iterable[str] = ..., - default_for_string: bool = ..., - default: bool = ..., -) -> Callable[[str], bool]: ... -def consume(iterable: Iterable[object]) -> None: ... -def clear_caches() -> None: ... -def import_string(import_name: str, silent: bool = ...) -> Any: ... -def open_if_exists(filename: StrOrBytesPath, mode: str = ...) -> IO[Any] | None: ... -def object_type_repr(obj: object) -> str: ... -def pformat(obj: object, verbose: bool = ...) -> str: ... -def urlize( - text: Markup | Text, trim_url_limit: int | None = ..., rel: Markup | Text | None = ..., target: Markup | Text | None = ... -) -> str: ... -def generate_lorem_ipsum(n: int = ..., html: bool = ..., min: int = ..., max: int = ...) -> Markup | str: ... -def unicode_urlencode(obj: object, charset: str = ..., for_qs: bool = ...) -> str: ... - -class LRUCache: - capacity: Any - def __init__(self, capacity) -> None: ... - def __getnewargs__(self): ... - def copy(self): ... - def get(self, key, default: Any | None = ...): ... - def setdefault(self, key, default: Any | None = ...): ... - def clear(self): ... - def __contains__(self, key): ... - def __len__(self): ... - def __getitem__(self, key): ... - def __setitem__(self, key, value): ... - def __delitem__(self, key): ... - def items(self): ... - def iteritems(self): ... - def values(self): ... - def itervalue(self): ... - def keys(self): ... - def iterkeys(self): ... - __iter__: Any - def __reversed__(self): ... - __copy__: Any - -class Cycler: - items: Any - def __init__(self, *items) -> None: ... - pos: int - def reset(self): ... - @property - def current(self): ... - def __next__(self): ... - -class Joiner: - sep: Any - used: bool - def __init__(self, sep: str = ...) -> None: ... - def __call__(self): ... diff --git a/stubs/Jinja2/jinja2/visitor.pyi b/stubs/Jinja2/jinja2/visitor.pyi deleted file mode 100644 index ef34328..0000000 --- a/stubs/Jinja2/jinja2/visitor.pyi +++ /dev/null @@ -1,8 +0,0 @@ -class NodeVisitor: - def get_visitor(self, node): ... - def visit(self, node, *args, **kwargs): ... - def generic_visit(self, node, *args, **kwargs): ... - -class NodeTransformer(NodeVisitor): - def generic_visit(self, node, *args, **kwargs): ... - def visit_list(self, node, *args, **kwargs): ... diff --git a/stubs/Markdown/@tests/stubtest_allowlist.txt b/stubs/Markdown/@tests/stubtest_allowlist.txt index a3981e6..60569f6 100644 --- a/stubs/Markdown/@tests/stubtest_allowlist.txt +++ b/stubs/Markdown/@tests/stubtest_allowlist.txt @@ -9,3 +9,4 @@ markdown.extensions.legacy_attrs.LegacyAttrs.run markdown.extensions.toc.TocTreeprocessor.run markdown.extensions.toc.slugify markdown.preprocessors.ReferencePreprocessor +markdown.postprocessors.UnescapePostprocessor # deprecated diff --git a/stubs/Markdown/METADATA.toml b/stubs/Markdown/METADATA.toml index ee7865e..27115ac 100644 --- a/stubs/Markdown/METADATA.toml +++ b/stubs/Markdown/METADATA.toml @@ -1 +1 @@ -version = "3.3" +version = "3.4.*" diff --git a/stubs/Markdown/markdown/blockparser.pyi b/stubs/Markdown/markdown/blockparser.pyi index a747902..69fd02d 100644 --- a/stubs/Markdown/markdown/blockparser.pyi +++ b/stubs/Markdown/markdown/blockparser.pyi @@ -1,4 +1,5 @@ -from typing import Any, Iterable, List, TypeVar +from collections.abc import Iterable +from typing import Any, TypeVar from xml.etree.ElementTree import Element, ElementTree from . import Markdown @@ -6,7 +7,7 @@ from .util import Registry _T = TypeVar("_T") -class State(List[_T]): +class State(list[_T]): def set(self, state: _T) -> None: ... def reset(self) -> None: ... def isstate(self, state: _T) -> bool: ... @@ -16,8 +17,6 @@ class BlockParser: state: State[Any] # TODO: possible to get rid of Any? md: Markdown def __init__(self, md: Markdown) -> None: ... - @property - def markdown(self): ... # deprecated root: Element def parseDocument(self, lines: Iterable[str]) -> ElementTree: ... def parseChunk(self, parent: Element, text: str) -> None: ... diff --git a/stubs/Markdown/markdown/blockprocessors.pyi b/stubs/Markdown/markdown/blockprocessors.pyi index fb771af..70919f7 100644 --- a/stubs/Markdown/markdown/blockprocessors.pyi +++ b/stubs/Markdown/markdown/blockprocessors.pyi @@ -1,5 +1,6 @@ from logging import Logger -from typing import Any, Match, Pattern +from re import Match, Pattern +from typing import Any from xml.etree.ElementTree import Element from markdown import Markdown @@ -15,10 +16,10 @@ class BlockProcessor: tab_length: int def __init__(self, parser: BlockParser) -> None: ... def lastChild(self, parent: Element) -> Element | None: ... - def detab(self, text: str, length: int | None = ...): ... - def looseDetab(self, text: str, level: int = ...): ... - def test(self, parent: Element, block: str) -> None: ... - def run(self, parent: Element, blocks: list[str]) -> None: ... + def detab(self, text: str, length: int | None = ...) -> tuple[str, str]: ... + def looseDetab(self, text: str, level: int = ...) -> str: ... + def test(self, parent: Element, block: str) -> bool: ... + def run(self, parent: Element, blocks: list[str]) -> bool | None: ... class ListIndentProcessor(BlockProcessor): ITEM_TYPES: list[str] @@ -62,4 +63,8 @@ class HRProcessor(BlockProcessor): match: Match[str] class EmptyBlockProcessor(BlockProcessor): ... + +class ReferenceProcessor(BlockProcessor): + RE: Pattern[str] + class ParagraphProcessor(BlockProcessor): ... diff --git a/stubs/Markdown/markdown/core.pyi b/stubs/Markdown/markdown/core.pyi index e43df00..96aa61a 100644 --- a/stubs/Markdown/markdown/core.pyi +++ b/stubs/Markdown/markdown/core.pyi @@ -1,4 +1,6 @@ -from typing import Any, BinaryIO, Callable, ClassVar, Mapping, Sequence, Text, TextIO +from _typeshed import Self +from collections.abc import Callable, Mapping, Sequence +from typing import Any, ClassVar, Protocol from typing_extensions import Literal from xml.etree.ElementTree import Element @@ -6,6 +8,18 @@ from .blockparser import BlockParser from .extensions import Extension from .util import HtmlStash, Registry +# TODO: The following protocols can be replaced by their counterparts from +# codecs, once they have been propagated to all type checkers. +class _WritableStream(Protocol): + def write(self, __data: bytes) -> object: ... + def seek(self, __offset: int, __whence: int) -> object: ... + def close(self) -> object: ... + +class _ReadableStream(Protocol): + def read(self, __size: int = ...) -> bytes: ... + def seek(self, __offset: int, __whence: int) -> object: ... + def close(self) -> object: ... + class Markdown: preprocessors: Registry inlinePatterns: Registry @@ -13,11 +27,12 @@ class Markdown: postprocessors: Registry parser: BlockParser htmlStash: HtmlStash - output_formats: ClassVar[dict[Literal["xhtml", "html"], Callable[[Element], Text]]] + output_formats: ClassVar[dict[Literal["xhtml", "html"], Callable[[Element], str]]] output_format: Literal["xhtml", "html"] - serializer: Callable[[Element], Text] + serializer: Callable[[Element], str] tab_length: int block_level_elements: list[str] + registeredExtensions: list[Extension] def __init__( self, *, @@ -28,31 +43,28 @@ class Markdown: ) -> None: ... def build_parser(self) -> Markdown: ... def registerExtensions(self, extensions: Sequence[Extension | str], configs: Mapping[str, Mapping[str, Any]]) -> Markdown: ... - def build_extension(self, ext_name: Text, configs: Mapping[str, str]) -> Extension: ... + def build_extension(self, ext_name: str, configs: Mapping[str, str]) -> Extension: ... def registerExtension(self, extension: Extension) -> Markdown: ... - def reset(self: Markdown) -> Markdown: ... + def reset(self: Self) -> Self: ... def set_output_format(self, format: Literal["xhtml", "html"]) -> Markdown: ... def is_block_level(self, tag: str) -> bool: ... - def convert(self, source: Text) -> Text: ... + def convert(self, source: str) -> str: ... def convertFile( - self, - input: str | TextIO | BinaryIO | None = ..., - output: str | TextIO | BinaryIO | None = ..., - encoding: str | None = ..., + self, input: str | _ReadableStream | None = ..., output: str | _WritableStream | None = ..., encoding: str | None = ... ) -> Markdown: ... def markdown( - text: Text, + text: str, *, extensions: Sequence[str | Extension] | None = ..., extension_configs: Mapping[str, Mapping[str, Any]] | None = ..., output_format: Literal["xhtml", "html"] | None = ..., tab_length: int | None = ..., -) -> Text: ... +) -> str: ... def markdownFromFile( *, - input: str | TextIO | BinaryIO | None = ..., - output: str | TextIO | BinaryIO | None = ..., + input: str | _ReadableStream | None = ..., + output: str | _WritableStream | None = ..., encoding: str | None = ..., extensions: Sequence[str | Extension] | None = ..., extension_configs: Mapping[str, Mapping[str, Any]] | None = ..., diff --git a/stubs/Markdown/markdown/extensions/__init__.pyi b/stubs/Markdown/markdown/extensions/__init__.pyi index 88842b5..e01e02d 100644 --- a/stubs/Markdown/markdown/extensions/__init__.pyi +++ b/stubs/Markdown/markdown/extensions/__init__.pyi @@ -1,4 +1,5 @@ -from typing import Any, Mapping, Tuple +from collections.abc import Mapping +from typing import Any from markdown.core import Markdown @@ -7,7 +8,7 @@ class Extension: def __init__(self, **kwargs: Any) -> None: ... def getConfig(self, key: str, default: Any = ...) -> Any: ... def getConfigs(self) -> dict[str, Any]: ... - def getConfigInfo(self) -> list[Tuple[str, str]]: ... + def getConfigInfo(self) -> list[tuple[str, str]]: ... def setConfig(self, key: str, value: Any) -> None: ... def setConfigs(self, items: Mapping[str, Any]) -> None: ... def extendMarkdown(self, md: Markdown) -> None: ... diff --git a/stubs/Markdown/markdown/extensions/abbr.pyi b/stubs/Markdown/markdown/extensions/abbr.pyi index a3469d1..aafd0af 100644 --- a/stubs/Markdown/markdown/extensions/abbr.pyi +++ b/stubs/Markdown/markdown/extensions/abbr.pyi @@ -1,4 +1,5 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any from markdown.blockprocessors import BlockProcessor from markdown.extensions import Extension diff --git a/stubs/Markdown/markdown/extensions/admonition.pyi b/stubs/Markdown/markdown/extensions/admonition.pyi index 912c6ce..a7cf510 100644 --- a/stubs/Markdown/markdown/extensions/admonition.pyi +++ b/stubs/Markdown/markdown/extensions/admonition.pyi @@ -1,4 +1,5 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any from markdown.blockprocessors import BlockProcessor from markdown.extensions import Extension diff --git a/stubs/Markdown/markdown/extensions/attr_list.pyi b/stubs/Markdown/markdown/extensions/attr_list.pyi index 416193a..238d943 100644 --- a/stubs/Markdown/markdown/extensions/attr_list.pyi +++ b/stubs/Markdown/markdown/extensions/attr_list.pyi @@ -1,4 +1,4 @@ -from typing import Pattern +from re import Pattern from markdown.extensions import Extension from markdown.treeprocessors import Treeprocessor diff --git a/stubs/Markdown/markdown/extensions/codehilite.pyi b/stubs/Markdown/markdown/extensions/codehilite.pyi index b5a5910..bcd43c3 100644 --- a/stubs/Markdown/markdown/extensions/codehilite.pyi +++ b/stubs/Markdown/markdown/extensions/codehilite.pyi @@ -34,7 +34,7 @@ class CodeHilite: use_pygments: bool = ..., **options: Any, ) -> None: ... - def hilite(self): ... + def hilite(self, shebang: bool = ...) -> str: ... class HiliteTreeprocessor(Treeprocessor): def code_unescape(self, text): ... diff --git a/stubs/Markdown/markdown/extensions/def_list.pyi b/stubs/Markdown/markdown/extensions/def_list.pyi index 187003c..48ef08d 100644 --- a/stubs/Markdown/markdown/extensions/def_list.pyi +++ b/stubs/Markdown/markdown/extensions/def_list.pyi @@ -1,4 +1,4 @@ -from typing import Pattern +from re import Pattern from markdown.blockprocessors import BlockProcessor, ListIndentProcessor from markdown.extensions import Extension diff --git a/stubs/Markdown/markdown/extensions/fenced_code.pyi b/stubs/Markdown/markdown/extensions/fenced_code.pyi index 9aab6be..2d26b07 100644 --- a/stubs/Markdown/markdown/extensions/fenced_code.pyi +++ b/stubs/Markdown/markdown/extensions/fenced_code.pyi @@ -1,4 +1,5 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any from markdown.extensions import Extension from markdown.preprocessors import Preprocessor diff --git a/stubs/Markdown/markdown/extensions/footnotes.pyi b/stubs/Markdown/markdown/extensions/footnotes.pyi index b49e3a9..3f93203 100644 --- a/stubs/Markdown/markdown/extensions/footnotes.pyi +++ b/stubs/Markdown/markdown/extensions/footnotes.pyi @@ -1,5 +1,7 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any +from markdown.core import Markdown from markdown.extensions import Extension from markdown.inlinepatterns import InlineProcessor from markdown.postprocessors import Postprocessor @@ -18,7 +20,7 @@ class FootnoteExtension(Extension): used_refs: Any def __init__(self, **kwargs) -> None: ... parser: Any - md: Any + md: Markdown footnotes: Any def reset(self) -> None: ... def unique_ref(self, reference, found: bool = ...): ... diff --git a/stubs/Markdown/markdown/extensions/legacy_attrs.pyi b/stubs/Markdown/markdown/extensions/legacy_attrs.pyi index 6e06827..30f2e0a 100644 --- a/stubs/Markdown/markdown/extensions/legacy_attrs.pyi +++ b/stubs/Markdown/markdown/extensions/legacy_attrs.pyi @@ -1,4 +1,4 @@ -from typing import Pattern +from re import Pattern from markdown.extensions import Extension from markdown.treeprocessors import Treeprocessor diff --git a/stubs/Markdown/markdown/extensions/meta.pyi b/stubs/Markdown/markdown/extensions/meta.pyi index f6c0621..deca6e2 100644 --- a/stubs/Markdown/markdown/extensions/meta.pyi +++ b/stubs/Markdown/markdown/extensions/meta.pyi @@ -1,5 +1,7 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any +from markdown.core import Markdown from markdown.extensions import Extension from markdown.preprocessors import Preprocessor @@ -10,7 +12,7 @@ BEGIN_RE: Pattern[str] END_RE: Pattern[str] class MetaExtension(Extension): - md: Any + md: Markdown def reset(self) -> None: ... class MetaPreprocessor(Preprocessor): ... diff --git a/stubs/Markdown/markdown/extensions/tables.pyi b/stubs/Markdown/markdown/extensions/tables.pyi index 2250cae..39a4e96 100644 --- a/stubs/Markdown/markdown/extensions/tables.pyi +++ b/stubs/Markdown/markdown/extensions/tables.pyi @@ -12,7 +12,7 @@ class TableProcessor(BlockProcessor): RE_END_BORDER: Any border: bool = ... separator: str = ... - def __init__(self, parser) -> None: ... + def __init__(self, parser, config) -> None: ... class TableExtension(Extension): ... diff --git a/stubs/Markdown/markdown/extensions/toc.pyi b/stubs/Markdown/markdown/extensions/toc.pyi index 1315e77..519880b 100644 --- a/stubs/Markdown/markdown/extensions/toc.pyi +++ b/stubs/Markdown/markdown/extensions/toc.pyi @@ -1,5 +1,7 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any +from markdown.core import Markdown from markdown.extensions import Extension from markdown.treeprocessors import Treeprocessor @@ -38,7 +40,7 @@ class TocTreeprocessor(Treeprocessor): class TocExtension(Extension): TreeProcessorClass: Any def __init__(self, **kwargs) -> None: ... - md: Any + md: Markdown def reset(self) -> None: ... def makeExtension(**kwargs): ... diff --git a/stubs/Markdown/markdown/extensions/wikilinks.pyi b/stubs/Markdown/markdown/extensions/wikilinks.pyi index 044edb0..81c6455 100644 --- a/stubs/Markdown/markdown/extensions/wikilinks.pyi +++ b/stubs/Markdown/markdown/extensions/wikilinks.pyi @@ -1,5 +1,6 @@ from typing import Any +from markdown.core import Markdown from markdown.extensions import Extension from markdown.inlinepatterns import InlineProcessor @@ -7,7 +8,7 @@ def build_url(label, base, end): ... class WikiLinkExtension(Extension): def __init__(self, **kwargs) -> None: ... - md: Any + md: Markdown class WikiLinksInlineProcessor(InlineProcessor): config: Any diff --git a/stubs/Markdown/markdown/inlinepatterns.pyi b/stubs/Markdown/markdown/inlinepatterns.pyi index 20046e0..6cea38b 100644 --- a/stubs/Markdown/markdown/inlinepatterns.pyi +++ b/stubs/Markdown/markdown/inlinepatterns.pyi @@ -1,7 +1,10 @@ -import typing -from typing import Any, Match, Tuple +import re +from re import Match +from typing import Any, ClassVar from xml.etree.ElementTree import Element +from markdown.core import Markdown + def build_inlinepatterns(md, **kwargs): ... NOIMG: str @@ -36,10 +39,8 @@ class Pattern: ANCESTOR_EXCLUDES: Any pattern: Any compiled_re: Any - md: Any - def __init__(self, pattern, md: Any | None = ...) -> None: ... - @property - def markdown(self): ... + md: Markdown + def __init__(self, pattern, md: Markdown | None = ...) -> None: ... def getCompiledRegExp(self): ... def handleMatch(self, m: Match[str]) -> str | Element | None: ... def type(self): ... @@ -47,8 +48,8 @@ class Pattern: class InlineProcessor(Pattern): safe_mode: bool = ... - def __init__(self, pattern, md: Any | None = ...) -> None: ... - def handleMatch(self, m: Match[str], data) -> Tuple[Element, int, int] | Tuple[None, None, None]: ... # type: ignore + def __init__(self, pattern, md: Markdown | None = ...) -> None: ... + def handleMatch(self, m: Match[str], data) -> tuple[Element, int, int] | tuple[None, None, None]: ... # type: ignore[override] class SimpleTextPattern(Pattern): ... class SimpleTextInlineProcessor(InlineProcessor): ... @@ -94,7 +95,7 @@ class LinkInlineProcessor(InlineProcessor): class ImageInlineProcessor(LinkInlineProcessor): ... class ReferenceInlineProcessor(LinkInlineProcessor): - NEWLINE_CLEANUP_RE: typing.Pattern + NEWLINE_CLEANUP_RE: ClassVar[re.Pattern[str]] def evalId(self, data, index, text): ... def makeTag(self, href, title, text): ... diff --git a/stubs/Markdown/markdown/pep562.pyi b/stubs/Markdown/markdown/pep562.pyi deleted file mode 100644 index 6246f86..0000000 --- a/stubs/Markdown/markdown/pep562.pyi +++ /dev/null @@ -1,7 +0,0 @@ -class Version: - def __new__(cls, major, minor, micro, release: str = ..., pre: int = ..., post: int = ..., dev: int = ...): ... - -class Pep562: - def __init__(self, name) -> None: ... - def __dir__(self): ... - def __getattr__(self, name): ... diff --git a/stubs/Markdown/markdown/postprocessors.pyi b/stubs/Markdown/markdown/postprocessors.pyi index 47581da..6b14388 100644 --- a/stubs/Markdown/markdown/postprocessors.pyi +++ b/stubs/Markdown/markdown/postprocessors.pyi @@ -1,4 +1,5 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any from . import util @@ -12,6 +13,6 @@ class RawHtmlPostprocessor(Postprocessor): class AndSubstitutePostprocessor(Postprocessor): ... -class UnescapePostprocessor(Postprocessor): +class UnescapePostprocessor(Postprocessor): # deprecated RE: Pattern[str] def unescape(self, m): ... diff --git a/stubs/Markdown/markdown/preprocessors.pyi b/stubs/Markdown/markdown/preprocessors.pyi index e0ebac0..9478ffd 100644 --- a/stubs/Markdown/markdown/preprocessors.pyi +++ b/stubs/Markdown/markdown/preprocessors.pyi @@ -1,4 +1,5 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any from . import util diff --git a/stubs/Markdown/markdown/util.pyi b/stubs/Markdown/markdown/util.pyi index c252334..865abdd 100644 --- a/stubs/Markdown/markdown/util.pyi +++ b/stubs/Markdown/markdown/util.pyi @@ -1,7 +1,8 @@ -from typing import Any, Pattern +from re import Pattern +from typing import Any, overload + +from markdown.core import Markdown -PY37: Any -__deprecated__: Any BLOCK_LEVEL_ELEMENTS: Any STX: str ETX: str @@ -12,44 +13,39 @@ AMP_SUBSTITUTE: Any HTML_PLACEHOLDER: Any HTML_PLACEHOLDER_RE: Pattern[str] TAG_PLACEHOLDER: Any -INSTALLED_EXTENSIONS: Any RTL_BIDI_RANGES: Any -def deprecated(message, stacklevel: int = ...): ... -def isBlockLevel(tag): ... -def parseBoolValue(value, fail_on_errors: bool = ..., preserve_none: bool = ...): ... -def code_escape(text): ... +def deprecated(message: str, stacklevel: int = ...): ... +def parseBoolValue(value: object, fail_on_errors: bool = ..., preserve_none: bool = ...) -> bool | None: ... +def code_escape(text: str) -> str: ... +def nearing_recursion_limit() -> bool: ... class AtomicString(str): ... class Processor: - md: Any - def __init__(self, md: Any | None = ...) -> None: ... - @property - def markdown(self): ... + md: Markdown + def __init__(self, md: Markdown | None = ...) -> None: ... class HtmlStash: html_counter: int = ... - rawHtmlBlocks: Any + rawHtmlBlocks: list[str] tag_counter: int = ... - tag_data: Any + tag_data: list[dict[str, Any]] def __init__(self) -> None: ... - def store(self, html): ... + def store(self, html: str) -> str: ... def reset(self) -> None: ... - def get_placeholder(self, key): ... - def store_tag(self, tag, attrs, left_index, right_index): ... + def get_placeholder(self, key: int) -> str: ... + def store_tag(self, tag: str, attrs: list[Any], left_index: int, right_index: int) -> str: ... class Registry: def __init__(self) -> None: ... - def __contains__(self, item): ... + def __contains__(self, item: object) -> bool: ... def __iter__(self) -> Any: ... - def __getitem__(self, key): ... - def __len__(self): ... - def get_index_for_name(self, name): ... - def register(self, item, name, priority) -> None: ... - def deregister(self, name, strict: bool = ...) -> None: ... - def __setitem__(self, key, value) -> None: ... - def __delitem__(self, key) -> None: ... - def add(self, key, value, location) -> None: ... - -def __getattr__(name): ... + @overload + def __getitem__(self, key: slice) -> Registry: ... + @overload + def __getitem__(self, key: str | int) -> Any: ... + def __len__(self) -> int: ... + def get_index_for_name(self, name: str) -> int: ... + def register(self, item: Any, name: str, priority: float) -> None: ... + def deregister(self, name: str, strict: bool = ...) -> None: ... diff --git a/stubs/MarkupSafe/@tests/stubtest_allowlist.txt b/stubs/MarkupSafe/@tests/stubtest_allowlist.txt deleted file mode 100644 index 902ba7d..0000000 --- a/stubs/MarkupSafe/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,10 +0,0 @@ -markupsafe.Markup.__getslice__ -markupsafe.Markup.__mod__ -markupsafe.Markup.capitalize -markupsafe.Markup.lower -markupsafe.Markup.swapcase -markupsafe.Markup.title -markupsafe.Markup.upper -markupsafe._compat.int_types -markupsafe._compat.iteritems -markupsafe._compat.string_types diff --git a/stubs/MarkupSafe/METADATA.toml b/stubs/MarkupSafe/METADATA.toml deleted file mode 100644 index 2266533..0000000 --- a/stubs/MarkupSafe/METADATA.toml +++ /dev/null @@ -1,3 +0,0 @@ -version = "1.1" -python2 = true -obsolete_since = "2.0" diff --git a/stubs/MarkupSafe/markupsafe/__init__.pyi b/stubs/MarkupSafe/markupsafe/__init__.pyi deleted file mode 100644 index 1b05a38..0000000 --- a/stubs/MarkupSafe/markupsafe/__init__.pyi +++ /dev/null @@ -1,56 +0,0 @@ -import string -import sys -from typing import Any, Callable, Iterable, Mapping, Sequence, Text, Tuple -from typing_extensions import SupportsIndex - -from markupsafe._compat import text_type -from markupsafe._native import escape as escape, escape_silent as escape_silent, soft_unicode as soft_unicode - -class Markup(text_type): - def __new__(cls, base: Text = ..., encoding: Text | None = ..., errors: Text = ...) -> Markup: ... - def __html__(self) -> Markup: ... - def __add__(self, other: text_type) -> Markup: ... - def __radd__(self, other: text_type) -> Markup: ... - def __mul__(self, num: int) -> Markup: ... # type: ignore - def __rmul__(self, num: int) -> Markup: ... # type: ignore - def __mod__(self, *args: Any) -> Markup: ... - def join(self, seq: Iterable[text_type]) -> Markup: ... - def split(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore - def rsplit(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore - def splitlines(self, keepends: bool = ...) -> list[Markup]: ... # type: ignore - def unescape(self) -> Text: ... - def striptags(self) -> Text: ... - @classmethod - def escape(cls, s: text_type) -> Markup: ... # noqa: F811 - def partition(self, sep: text_type) -> Tuple[Markup, Markup, Markup]: ... - def rpartition(self, sep: text_type) -> Tuple[Markup, Markup, Markup]: ... - def format(self, *args: Any, **kwargs: Any) -> Markup: ... - def __html_format__(self, format_spec: text_type) -> Markup: ... - def __getslice__(self, start: int, stop: int) -> Markup: ... - def __getitem__(self, i: int | slice) -> Markup: ... - def capitalize(self) -> Markup: ... - def title(self) -> Markup: ... - def lower(self) -> Markup: ... - def upper(self) -> Markup: ... - def swapcase(self) -> Markup: ... - def replace(self, old: text_type, new: text_type, count: SupportsIndex = ...) -> Markup: ... - def ljust(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ... - def rjust(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ... - def lstrip(self, chars: text_type | None = ...) -> Markup: ... - def rstrip(self, chars: text_type | None = ...) -> Markup: ... - def strip(self, chars: text_type | None = ...) -> Markup: ... - def center(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ... - def zfill(self, width: SupportsIndex) -> Markup: ... - def translate(self, table: Mapping[int, int | text_type | None] | Sequence[int | text_type | None]) -> Markup: ... - if sys.version_info >= (3, 8): - def expandtabs(self, tabsize: SupportsIndex = ...) -> Markup: ... - else: - def expandtabs(self, tabsize: int = ...) -> Markup: ... - -class EscapeFormatter(string.Formatter): - escape: Callable[[text_type], Markup] - def __init__(self, escape: Callable[[text_type], Markup]) -> None: ... # noqa: F811 - def format_field(self, value: text_type, format_spec: text_type) -> Markup: ... - -if sys.version_info >= (3,): - soft_str = soft_unicode diff --git a/stubs/MarkupSafe/markupsafe/_compat.pyi b/stubs/MarkupSafe/markupsafe/_compat.pyi deleted file mode 100644 index a3c2bc7..0000000 --- a/stubs/MarkupSafe/markupsafe/_compat.pyi +++ /dev/null @@ -1,21 +0,0 @@ -import sys -from typing import Iterator, Mapping, Tuple, TypeVar - -_K = TypeVar("_K") -_V = TypeVar("_V") - -PY2: bool - -def iteritems(d: Mapping[_K, _V]) -> Iterator[Tuple[_K, _V]]: ... - -if sys.version_info >= (3,): - text_type = str - string_types = (str,) - unichr = chr - int_types = (int,) -else: - from __builtin__ import unichr as unichr - - text_type = unicode - string_types = (str, unicode) - int_types = (int, long) diff --git a/stubs/MarkupSafe/markupsafe/_constants.pyi b/stubs/MarkupSafe/markupsafe/_constants.pyi deleted file mode 100644 index 81dc05e..0000000 --- a/stubs/MarkupSafe/markupsafe/_constants.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Text - -HTML_ENTITIES: dict[Text, int] diff --git a/stubs/MarkupSafe/markupsafe/_native.pyi b/stubs/MarkupSafe/markupsafe/_native.pyi deleted file mode 100644 index c9f993e..0000000 --- a/stubs/MarkupSafe/markupsafe/_native.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Text - -from . import Markup -from ._compat import text_type - -def escape(s: Markup | Text) -> Markup: ... -def escape_silent(s: None | Markup | Text) -> Markup: ... -def soft_unicode(s: Text) -> text_type: ... diff --git a/stubs/MarkupSafe/markupsafe/_speedups.pyi b/stubs/MarkupSafe/markupsafe/_speedups.pyi deleted file mode 100644 index c9f993e..0000000 --- a/stubs/MarkupSafe/markupsafe/_speedups.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Text - -from . import Markup -from ._compat import text_type - -def escape(s: Markup | Text) -> Markup: ... -def escape_silent(s: None | Markup | Text) -> Markup: ... -def soft_unicode(s: Text) -> text_type: ... diff --git a/stubs/Pillow/@tests/stubtest_allowlist.txt b/stubs/Pillow/@tests/stubtest_allowlist.txt index b0cdde0..3e34ae1 100644 --- a/stubs/Pillow/@tests/stubtest_allowlist.txt +++ b/stubs/Pillow/@tests/stubtest_allowlist.txt @@ -1,4 +1,6 @@ PIL.FpxImagePlugin PIL.ImageQt.ImageQt +PIL.ImageQt.QImage # Does exist at runtime usually, but stubtest can't see it +PIL.ImageQt.QPixmap # Does exist at runtime usually, but stubtest can't see it PIL.MicImagePlugin PIL.WmfImagePlugin.WmfHandler diff --git a/stubs/Pillow/METADATA.toml b/stubs/Pillow/METADATA.toml index cb3899b..9f95a60 100644 --- a/stubs/Pillow/METADATA.toml +++ b/stubs/Pillow/METADATA.toml @@ -1 +1 @@ -version = "8.3" +version = "9.3.*" diff --git a/stubs/Pillow/PIL/BlpImagePlugin.pyi b/stubs/Pillow/PIL/BlpImagePlugin.pyi index 3e004d9..be0f721 100644 --- a/stubs/Pillow/PIL/BlpImagePlugin.pyi +++ b/stubs/Pillow/PIL/BlpImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile, PyDecoder @@ -18,8 +19,8 @@ def decode_dxt5(data): ... class BLPFormatError(NotImplementedError): ... class BlpImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["BLP"]] + format_description: ClassVar[str] class _BLPBaseDecoder(PyDecoder): magic: Any diff --git a/stubs/Pillow/PIL/BmpImagePlugin.pyi b/stubs/Pillow/PIL/BmpImagePlugin.pyi index c171242..3ebe581 100644 --- a/stubs/Pillow/PIL/BmpImagePlugin.pyi +++ b/stubs/Pillow/PIL/BmpImagePlugin.pyi @@ -1,16 +1,16 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile BIT2MODE: Any class BmpImageFile(ImageFile): - format_description: str - format: str + format_description: ClassVar[str] + format: ClassVar[Literal["BMP", "DIB", "CUR"]] COMPRESSIONS: Any class DibImageFile(BmpImageFile): - format: str - format_description: str + format: ClassVar[Literal["DIB"]] SAVE: Any diff --git a/stubs/Pillow/PIL/BufrStubImagePlugin.pyi b/stubs/Pillow/PIL/BufrStubImagePlugin.pyi index 1fd49e1..812b4e6 100644 --- a/stubs/Pillow/PIL/BufrStubImagePlugin.pyi +++ b/stubs/Pillow/PIL/BufrStubImagePlugin.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import StubImageFile def register_handler(handler) -> None: ... class BufrStubImageFile(StubImageFile): - format: str - format_description: str + format: ClassVar[Literal["BUFR"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/CurImagePlugin.pyi b/stubs/Pillow/PIL/CurImagePlugin.pyi index a6085cb..09d5020 100644 --- a/stubs/Pillow/PIL/CurImagePlugin.pyi +++ b/stubs/Pillow/PIL/CurImagePlugin.pyi @@ -1,5 +1,7 @@ +from typing import ClassVar +from typing_extensions import Literal + from .BmpImagePlugin import BmpImageFile class CurImageFile(BmpImageFile): - format: str - format_description: str + format: ClassVar[Literal["CUR"]] diff --git a/stubs/Pillow/PIL/DcxImagePlugin.pyi b/stubs/Pillow/PIL/DcxImagePlugin.pyi index 4b0389a..f8f64a9 100644 --- a/stubs/Pillow/PIL/DcxImagePlugin.pyi +++ b/stubs/Pillow/PIL/DcxImagePlugin.pyi @@ -1,12 +1,12 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .PcxImagePlugin import PcxImageFile MAGIC: int class DcxImageFile(PcxImageFile): - format: str - format_description: str + format: ClassVar[Literal["DCX"]] frame: Any fp: Any def seek(self, frame) -> None: ... diff --git a/stubs/Pillow/PIL/DdsImagePlugin.pyi b/stubs/Pillow/PIL/DdsImagePlugin.pyi index 1097440..19893d9 100644 --- a/stubs/Pillow/PIL/DdsImagePlugin.pyi +++ b/stubs/Pillow/PIL/DdsImagePlugin.pyi @@ -1,3 +1,4 @@ +from typing import ClassVar from typing_extensions import Literal from .ImageFile import ImageFile @@ -65,6 +66,6 @@ DXGI_FORMAT_BC7_UNORM: int DXGI_FORMAT_BC7_UNORM_SRGB: int class DdsImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["DDS"]] + format_description: ClassVar[str] def load_seek(self, pos) -> None: ... diff --git a/stubs/Pillow/PIL/EpsImagePlugin.pyi b/stubs/Pillow/PIL/EpsImagePlugin.pyi index 741f03e..7e76e86 100644 --- a/stubs/Pillow/PIL/EpsImagePlugin.pyi +++ b/stubs/Pillow/PIL/EpsImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -7,7 +8,7 @@ field: Any gs_windows_binary: Any def has_ghostscript(): ... -def Ghostscript(tile, size, fp, scale: int = ...): ... +def Ghostscript(tile, size, fp, scale: int = ..., transparency: bool = ...): ... class PSFile: fp: Any @@ -17,11 +18,11 @@ class PSFile: def readline(self): ... class EpsImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["EPS"]] + format_description: ClassVar[str] mode_map: Any im: Any mode: Any tile: Any - def load(self, scale: int = ...) -> None: ... + def load(self, scale: int = ..., transparency: bool = ...) -> None: ... def load_seek(self, *args, **kwargs) -> None: ... diff --git a/stubs/Pillow/PIL/ExifTags.pyi b/stubs/Pillow/PIL/ExifTags.pyi index 0ad93f5..ada23d3 100644 --- a/stubs/Pillow/PIL/ExifTags.pyi +++ b/stubs/Pillow/PIL/ExifTags.pyi @@ -1,4 +1,4 @@ -from typing import Mapping +from collections.abc import Mapping TAGS: Mapping[int, str] GPSTAGS: Mapping[int, str] diff --git a/stubs/Pillow/PIL/FitsStubImagePlugin.pyi b/stubs/Pillow/PIL/FitsStubImagePlugin.pyi index ec94b35..cdd6375 100644 --- a/stubs/Pillow/PIL/FitsStubImagePlugin.pyi +++ b/stubs/Pillow/PIL/FitsStubImagePlugin.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import StubImageFile def register_handler(handler) -> None: ... class FITSStubImageFile(StubImageFile): - format: str - format_description: str + format: ClassVar[Literal["FITS"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/FliImagePlugin.pyi b/stubs/Pillow/PIL/FliImagePlugin.pyi index 11f57d4..9859378 100644 --- a/stubs/Pillow/PIL/FliImagePlugin.pyi +++ b/stubs/Pillow/PIL/FliImagePlugin.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile class FliImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["FLI"]] + format_description: ClassVar[str] def seek(self, frame) -> None: ... def tell(self): ... diff --git a/stubs/Pillow/PIL/FpxImagePlugin.pyi b/stubs/Pillow/PIL/FpxImagePlugin.pyi index 0f88b66..069cb6b 100644 --- a/stubs/Pillow/PIL/FpxImagePlugin.pyi +++ b/stubs/Pillow/PIL/FpxImagePlugin.pyi @@ -1,11 +1,12 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile MODES: Any class FpxImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["FPX"]] + format_description: ClassVar[str] fp: Any def load(self): ... diff --git a/stubs/Pillow/PIL/FtexImagePlugin.pyi b/stubs/Pillow/PIL/FtexImagePlugin.pyi index b123ffe..3205880 100644 --- a/stubs/Pillow/PIL/FtexImagePlugin.pyi +++ b/stubs/Pillow/PIL/FtexImagePlugin.pyi @@ -1,3 +1,6 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile MAGIC: bytes @@ -5,6 +8,6 @@ FORMAT_DXT1: int FORMAT_UNCOMPRESSED: int class FtexImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["FTEX"]] + format_description: ClassVar[str] def load_seek(self, pos) -> None: ... diff --git a/stubs/Pillow/PIL/GbrImagePlugin.pyi b/stubs/Pillow/PIL/GbrImagePlugin.pyi index 070d87d..b5ede10 100644 --- a/stubs/Pillow/PIL/GbrImagePlugin.pyi +++ b/stubs/Pillow/PIL/GbrImagePlugin.pyi @@ -1,9 +1,10 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile class GbrImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["GBR"]] + format_description: ClassVar[str] im: Any def load(self) -> None: ... diff --git a/stubs/Pillow/PIL/GdImageFile.pyi b/stubs/Pillow/PIL/GdImageFile.pyi index 185d27b..a50f3f3 100644 --- a/stubs/Pillow/PIL/GdImageFile.pyi +++ b/stubs/Pillow/PIL/GdImageFile.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile class GdImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["GD"]] + format_description: ClassVar[str] def open(fp, mode: str = ...): ... diff --git a/stubs/Pillow/PIL/GifImagePlugin.pyi b/stubs/Pillow/PIL/GifImagePlugin.pyi index 4782707..ff064cc 100644 --- a/stubs/Pillow/PIL/GifImagePlugin.pyi +++ b/stubs/Pillow/PIL/GifImagePlugin.pyi @@ -1,10 +1,11 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile class GifImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["GIF"]] + format_description: ClassVar[str] global_palette: Any def data(self): ... @property diff --git a/stubs/Pillow/PIL/GribStubImagePlugin.pyi b/stubs/Pillow/PIL/GribStubImagePlugin.pyi index 34c773a..70ebaad 100644 --- a/stubs/Pillow/PIL/GribStubImagePlugin.pyi +++ b/stubs/Pillow/PIL/GribStubImagePlugin.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import StubImageFile def register_handler(handler) -> None: ... class GribStubImageFile(StubImageFile): - format: str - format_description: str + format: ClassVar[Literal["GRIB"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/Hdf5StubImagePlugin.pyi b/stubs/Pillow/PIL/Hdf5StubImagePlugin.pyi index b036a17..62760e4 100644 --- a/stubs/Pillow/PIL/Hdf5StubImagePlugin.pyi +++ b/stubs/Pillow/PIL/Hdf5StubImagePlugin.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import StubImageFile def register_handler(handler) -> None: ... class HDF5StubImageFile(StubImageFile): - format: str - format_description: str + format: ClassVar[Literal["HDF5"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/IcnsImagePlugin.pyi b/stubs/Pillow/PIL/IcnsImagePlugin.pyi index 8606fcf..4271414 100644 --- a/stubs/Pillow/PIL/IcnsImagePlugin.pyi +++ b/stubs/Pillow/PIL/IcnsImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -22,8 +23,8 @@ class IcnsFile: def getimage(self, size: Any | None = ...): ... class IcnsImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["ICNS"]] + format_description: ClassVar[str] @property def size(self): ... @size.setter diff --git a/stubs/Pillow/PIL/IcoImagePlugin.pyi b/stubs/Pillow/PIL/IcoImagePlugin.pyi index 536de0a..f84ed76 100644 --- a/stubs/Pillow/PIL/IcoImagePlugin.pyi +++ b/stubs/Pillow/PIL/IcoImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -13,8 +14,8 @@ class IcoFile: def frame(self, idx): ... class IcoImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["ICO"]] + format_description: ClassVar[str] @property def size(self): ... @size.setter diff --git a/stubs/Pillow/PIL/ImImagePlugin.pyi b/stubs/Pillow/PIL/ImImagePlugin.pyi index b6c3d84..09fd684 100644 --- a/stubs/Pillow/PIL/ImImagePlugin.pyi +++ b/stubs/Pillow/PIL/ImImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -18,8 +19,8 @@ split: Any def number(s): ... class ImImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["IM"]] + format_description: ClassVar[str] @property def n_frames(self): ... @property diff --git a/stubs/Pillow/PIL/Image.pyi b/stubs/Pillow/PIL/Image.pyi index 4d71134..6fcedd6 100644 --- a/stubs/Pillow/PIL/Image.pyi +++ b/stubs/Pillow/PIL/Image.pyi @@ -1,8 +1,9 @@ -from _typeshed import SupportsRead, SupportsWrite -from collections.abc import Iterable, Iterator, MutableMapping +from _typeshed import Self, SupportsRead, SupportsWrite +from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence +from enum import IntEnum from pathlib import Path -from typing import Any, Callable, Dict, Protocol, Sequence, SupportsBytes, Tuple, Union -from typing_extensions import Literal +from typing import Any, ClassVar, Protocol, SupportsBytes, Union +from typing_extensions import Literal, TypeAlias from ._imaging import ( DEFAULT_STRATEGY as DEFAULT_STRATEGY, @@ -14,15 +15,18 @@ from ._imaging import ( from .ImageFilter import Filter from .ImagePalette import ImagePalette -_Mode = Literal["1", "CMYK", "F", "HSV", "I", "L", "LAB", "P", "RGB", "RGBA", "RGBX", "YCbCr"] -_Resample = Literal[0, 1, 2, 3, 4, 5] -_Size = Tuple[int, int] -_Box = Tuple[int, int, int, int] +_Mode: TypeAlias = str +_Resample: TypeAlias = Literal[0, 1, 2, 3, 4, 5] +_Size: TypeAlias = tuple[int, int] +_Box: TypeAlias = tuple[int, int, int, int] -_ConversionMatrix = Union[ - Tuple[float, float, float, float], Tuple[float, float, float, float, float, float, float, float, float, float, float, float], +_ConversionMatrix: TypeAlias = Union[ + tuple[float, float, float, float], tuple[float, float, float, float, float, float, float, float, float, float, float, float], ] -_Color = Union[float, Tuple[float, ...]] +# `str` values are only accepted if mode="RGB" for an `Image` object +# `float` values are only accepted for certain modes such as "F" +# See https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.new +_Color: TypeAlias = Union[int, tuple[int], tuple[int, int, int], tuple[int, int, int, int], str, float, tuple[float]] class _Writeable(SupportsWrite[bytes], Protocol): def seek(self, __offset: int) -> Any: ... @@ -35,7 +39,7 @@ CONTAINER: Literal[2] class DecompressionBombWarning(RuntimeWarning): ... class DecompressionBombError(Exception): ... -MAX_IMAGE_PIXELS: int +MAX_IMAGE_PIXELS: int | None NONE: Literal[0] @@ -75,6 +79,46 @@ MAXCOVERAGE: Literal[1] FASTOCTREE: Literal[2] LIBIMAGEQUANT: Literal[3] +class Transpose(IntEnum): + FLIP_LEFT_RIGHT: Literal[0] + FLIP_TOP_BOTTOM: Literal[1] + ROTATE_90: Literal[2] + ROTATE_180: Literal[3] + ROTATE_270: Literal[4] + TRANSPOSE: Literal[5] + TRANSVERSE: Literal[6] + +class Transform(IntEnum): + AFFINE: Literal[0] + EXTENT: Literal[1] + PERSPECTIVE: Literal[2] + QUAD: Literal[3] + MESH: Literal[4] + +class Resampling(IntEnum): + NEAREST: Literal[0] + LANCZOS: Literal[1] + BILINEAR: Literal[2] + BICUBIC: Literal[3] + BOX: Literal[4] + HAMMING: Literal[5] + +class Dither(IntEnum): + NONE: Literal[0] + ORDERED: Literal[1] + RASTERIZE: Literal[2] + FLOYDSTEINBERG: Literal[3] + +class Palette(IntEnum): + WEB: Literal[0] + ADAPTIVE: Literal[1] + +class Quantize(IntEnum): + MEDIANCUT: Literal[0] + MAXCOVERAGE: Literal[1] + FASTOCTREE: Literal[2] + LIBIMAGEQUANT: Literal[3] + ID: list[str] OPEN: dict[str, Any] MIME: dict[str, str] @@ -88,39 +132,40 @@ MODES: list[_Mode] def getmodebase(mode: _Mode) -> Literal["L", "RGB"]: ... def getmodetype(mode: _Mode) -> Literal["L", "I", "F"]: ... -def getmodebandnames(mode: _Mode) -> Tuple[str, ...]: ... +def getmodebandnames(mode: _Mode) -> tuple[str, ...]: ... def getmodebands(mode: _Mode) -> int: ... def preinit() -> None: ... def init() -> None: ... def coerce_e(value) -> _E: ... class _E: - def __init__(self, data) -> None: ... + def __init__(self, scale, data) -> None: ... def __add__(self, other) -> _E: ... def __mul__(self, other) -> _E: ... -_ImageState = Tuple[Dict[str, Any], str, Tuple[int, int], Any, bytes] +_ImageState: TypeAlias = tuple[dict[str, Any], str, tuple[int, int], Any, bytes] class Image: - format: Any - format_description: Any + format: ClassVar[str | None] + format_description: ClassVar[str | None] im: Any - mode: str + mode: _Mode palette: Any info: dict[Any, Any] readonly: int pyaccess: Any + is_animated: bool # not present on all Image objects + n_frames: int # not present on all Image objects @property def width(self) -> int: ... @property def height(self) -> int: ... @property def size(self) -> tuple[int, int]: ... - def __enter__(self) -> Image: ... - def __exit__(self, *args: Any) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... def close(self) -> None: ... def __eq__(self, other: object) -> bool: ... - def __array__(self, dtype=...) -> Any: ... # returns numpy.array() def __getstate__(self) -> _ImageState: ... def __setstate__(self, state: _ImageState) -> None: ... def tobytes(self, encoder_name: str = ..., *args) -> bytes: ... @@ -130,10 +175,10 @@ class Image: def verify(self) -> None: ... def convert( self, - mode: str | None = ..., + mode: _Mode | None = ..., matrix: _ConversionMatrix | None = ..., dither: int | None = ..., - palette: Literal[0, 1] = ..., + palette: Literal[Palette.WEB] = ..., colors: int = ..., ) -> Image: ... def quantize( @@ -147,32 +192,32 @@ class Image: def copy(self) -> Image: ... __copy__ = copy def crop(self, box: _Box | None = ...) -> Image: ... - def draft(self, mode: str, size: _Size) -> None: ... + def draft(self, mode: _Mode, size: _Size) -> None: ... def filter(self, filter: Filter | Callable[[], Filter]) -> Image: ... - def getbands(self) -> Tuple[str, ...]: ... + def getbands(self) -> tuple[str, ...]: ... def getbbox(self) -> tuple[int, int, int, int] | None: ... def getcolors(self, maxcolors: int = ...) -> list[tuple[int, int]]: ... def getdata(self, band: int | None = ...): ... def getextrema(self): ... def getexif(self) -> Exif: ... def getim(self): ... - def getpalette(self) -> list[int] | None: ... + def getpalette(self, rawmode: str | None = ...) -> list[int] | None: ... def getpixel(self, xy: tuple[int, int]): ... def getprojection(self) -> tuple[list[int], list[int]]: ... def histogram(self, mask: Image | None = ..., extrema: tuple[int, int] | tuple[float, float] | None = ...) -> list[int]: ... def entropy(self, mask: Image | None = ..., extrema: tuple[int, int] | tuple[float, float] | None = ...) -> float: ... - def paste(self, im: Image, box: tuple[float, float] | _Box | None = ..., mask: Image | None = ...) -> None: ... + def paste(self, im: Image | _Color, box: tuple[int, int] | _Box | None = ..., mask: Image | None = ...) -> None: ... def alpha_composite(self, im: Image, dest: tuple[int, int] = ..., source: tuple[int, int] = ...) -> None: ... - def point(self, lut, mode: str | None = ...) -> Image: ... + def point(self, lut, mode: _Mode | None = ...) -> Image: ... def putalpha(self, alpha: Image | int) -> None: ... def putdata(self, data: Sequence[int], scale: float = ..., offset: float = ...) -> None: ... - def putpalette(self, data: ImagePalette | bytes | Iterable[int] | SupportsBytes, rawmode: str | None = ...) -> None: ... + def putpalette(self, data: ImagePalette | bytes | Iterable[int] | SupportsBytes, rawmode: _Mode | None = ...) -> None: ... def putpixel(self, xy: tuple[int, int], value: _Color | list[float]) -> None: ... def remap_palette(self, dest_map: Iterable[int], source_palette: Sequence[int] | None = ...) -> Image: ... def resize( self, size: tuple[int, int], - resample: _Resample | None = ..., + resample: Resampling | _Resample | None = ..., box: tuple[float, float, float, float] | None = ..., reducing_gap: float | None = ..., ) -> Image: ... @@ -180,7 +225,7 @@ class Image: def rotate( self, angle: float, - resample: _Resample = ..., + resample: Resampling | _Resample = ..., expand: bool = ..., center: tuple[float, float] | None = ..., translate: tuple[float, float] | None = ..., @@ -196,21 +241,21 @@ class Image: **params: Any, ) -> None: ... def seek(self, frame: int) -> None: ... - def show(self, title: str | None = ..., command: str | None = ...) -> None: ... - def split(self) -> Tuple[Image, ...]: ... + def show(self, title: str | None = ...) -> None: ... + def split(self) -> tuple[Image, ...]: ... def getchannel(self, channel: int | str) -> Image: ... def tell(self) -> int: ... - def thumbnail(self, size: tuple[int, int], resample: _Resample = ..., reducing_gap: float = ...) -> None: ... + def thumbnail(self, size: tuple[int, int], resample: Resampling | _Resample = ..., reducing_gap: float = ...) -> None: ... def transform( self, size: _Size, - method: Literal[0, 1, 2, 3, 4], + method: Transform | Literal[0, 1, 2, 3, 4], data=..., - resample: _Resample = ..., + resample: Resampling | _Resample = ..., fill: int = ..., fillcolor: _Color | int | None = ..., - ) -> None: ... - def transpose(self, method: Literal[0, 1, 2, 3, 4, 5, 6]) -> Image: ... + ) -> Image: ... + def transpose(self, method: Transpose | Literal[0, 1, 2, 3, 4, 5, 6]) -> Image: ... def effect_spread(self, distance: int) -> Image: ... def toqimage(self): ... def toqpixmap(self): ... @@ -218,20 +263,20 @@ class Image: class ImagePointHandler: ... class ImageTransformHandler: ... -def new(mode: _Mode, size: tuple[int, int], color: float | Tuple[float, ...] | str = ...) -> Image: ... +def new(mode: _Mode, size: tuple[int, int], color: _Color = ...) -> Image: ... def frombytes(mode: _Mode, size: tuple[int, int], data, decoder_name: str = ..., *args) -> Image: ... def frombuffer(mode: _Mode, size: tuple[int, int], data, decoder_name: str = ..., *args) -> Image: ... def fromarray(obj, mode: _Mode | None = ...) -> Image: ... def fromqimage(im) -> Image: ... def fromqpixmap(im) -> Image: ... def open( - fp: str | bytes | Path | SupportsRead[bytes], mode: Literal["r"] = ..., formats: list[str] | tuple[str] | None = ... + fp: str | bytes | Path | SupportsRead[bytes], mode: Literal["r"] = ..., formats: list[str] | tuple[str, ...] | None = ... ) -> Image: ... def alpha_composite(im1: Image, im2: Image) -> Image: ... def blend(im1: Image, im2: Image, alpha: float) -> Image: ... def composite(image1: Image, image2: Image, mask: Image) -> Image: ... def eval(image: Image, *args) -> Image: ... -def merge(mode: str, bands: Sequence[Image]) -> Image: ... +def merge(mode: _Mode, bands: Sequence[Image]) -> Image: ... def register_open(id: str, factory, accept=...) -> None: ... def register_mime(id: str, mimetype: str) -> None: ... def register_save(id: str, driver) -> None: ... @@ -243,8 +288,8 @@ def register_decoder(name: str, decoder) -> None: ... def register_encoder(name: str, encoder) -> None: ... def effect_mandelbrot(size: tuple[int, int], extent: tuple[float, float, float, float], quality: int) -> Image: ... def effect_noise(size: tuple[int, int], sigma: float) -> Image: ... -def linear_gradient(mode: str) -> Image: ... -def radial_gradient(mode: str) -> Image: ... +def linear_gradient(mode: _Mode) -> Image: ... +def radial_gradient(mode: _Mode) -> Image: ... class Exif(MutableMapping[int, Any]): def load(self, data: bytes) -> None: ... diff --git a/stubs/Pillow/PIL/ImageColor.pyi b/stubs/Pillow/PIL/ImageColor.pyi index d23db52..1815d70 100644 --- a/stubs/Pillow/PIL/ImageColor.pyi +++ b/stubs/Pillow/PIL/ImageColor.pyi @@ -1,6 +1,11 @@ -from typing import Any +from typing import Union +from typing_extensions import TypeAlias -def getrgb(color): ... -def getcolor(color, mode): ... +_RGB: TypeAlias = Union[tuple[int, int, int], tuple[int, int, int, int]] +_Ink: TypeAlias = str | int | _RGB +_GreyScale: TypeAlias = tuple[int, int] -colormap: Any +def getrgb(color: _Ink) -> _RGB: ... +def getcolor(color: _Ink, mode: str) -> _RGB | _GreyScale: ... + +colormap: dict[str, str] diff --git a/stubs/Pillow/PIL/ImageDraw.pyi b/stubs/Pillow/PIL/ImageDraw.pyi index b8f1973..2123d12 100644 --- a/stubs/Pillow/PIL/ImageDraw.pyi +++ b/stubs/Pillow/PIL/ImageDraw.pyi @@ -1,13 +1,13 @@ -from collections.abc import Container -from typing import Any, Sequence, Tuple, Union, overload -from typing_extensions import Literal +from collections.abc import Container, Sequence +from typing import Any, overload +from typing_extensions import Literal, TypeAlias from .Image import Image +from .ImageColor import _Ink from .ImageFont import _Font -_Ink = Union[str, int, Tuple[int, int, int]] -_XY = Sequence[Union[float, Tuple[float, float]]] -_Outline = Any +_XY: TypeAlias = Sequence[float | tuple[float, float]] +_Outline: TypeAlias = Any class ImageDraw: def __init__(self, im: Image, mode: str | None = ...) -> None: ... @@ -30,7 +30,7 @@ class ImageDraw: width: float = ..., ) -> None: ... def point(self, xy: _XY, fill: _Ink | None = ...) -> None: ... - def polygon(self, xy: _XY, fill: _Ink | None = ..., outline: _Ink | None = ...) -> None: ... + def polygon(self, xy: _XY, fill: _Ink | None = ..., outline: _Ink | None = ..., width: float = ...) -> None: ... def regular_polygon( self, bounding_circle: tuple[float, float] | tuple[float, float, float] | list[int], @@ -116,7 +116,7 @@ class ImageDraw: features: Sequence[str] | None = ..., language: str | None = ..., embedded_color: bool = ..., - ) -> int: ... + ) -> float: ... def textbbox( self, xy: tuple[float, float], diff --git a/stubs/Pillow/PIL/ImageFile.pyi b/stubs/Pillow/PIL/ImageFile.pyi index 745509b..d6f359b 100644 --- a/stubs/Pillow/PIL/ImageFile.pyi +++ b/stubs/Pillow/PIL/ImageFile.pyi @@ -1,16 +1,14 @@ -from typing import Any, NoReturn, TypeVar +from _typeshed import Self +from typing import Any, NoReturn from .Image import Image -_T = TypeVar("_T") - MAXBLOCK: int SAFEBLOCK: Any LOAD_TRUNCATED_IMAGES: bool ERRORS: Any def raise_oserror(error) -> NoReturn: ... -def raise_ioerror(error) -> NoReturn: ... class ImageFile(Image): custom_mimetype: Any @@ -42,8 +40,8 @@ class Parser: def reset(self) -> None: ... decode: Any def feed(self, data) -> None: ... - def __enter__(self: _T) -> _T: ... - def __exit__(self, *args: Any) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... def close(self) -> Image: ... class PyCodecState: diff --git a/stubs/Pillow/PIL/ImageFilter.pyi b/stubs/Pillow/PIL/ImageFilter.pyi index af03bce..fec57d3 100644 --- a/stubs/Pillow/PIL/ImageFilter.pyi +++ b/stubs/Pillow/PIL/ImageFilter.pyi @@ -1,10 +1,11 @@ from _typeshed import Self -from typing import Any, Callable, Iterable, Sequence, Tuple, Type -from typing_extensions import Literal +from collections.abc import Callable, Iterable, Sequence +from typing import Any +from typing_extensions import Literal, TypeAlias from .Image import Image -_FilterArgs = Tuple[Sequence[int], int, int, Sequence[int]] +_FilterArgs: TypeAlias = tuple[Sequence[int], int, int, Sequence[int]] # filter image parameters below are the C images, i.e. Image().im. @@ -121,7 +122,7 @@ class Color3DLUT(MultibandFilter): ) -> None: ... @classmethod def generate( - cls: Type[Self], + cls: type[Self], size: int | tuple[int, int, int], callback: Callable[[float, float, float], Iterable[float]], channels: int = ..., diff --git a/stubs/Pillow/PIL/ImageMath.pyi b/stubs/Pillow/PIL/ImageMath.pyi index de95a29..1dc14d7 100644 --- a/stubs/Pillow/PIL/ImageMath.pyi +++ b/stubs/Pillow/PIL/ImageMath.pyi @@ -1,7 +1,5 @@ from typing import Any -VERBOSE: int - class _Operand: im: Any def __init__(self, im) -> None: ... diff --git a/stubs/Pillow/PIL/ImageMode.pyi b/stubs/Pillow/PIL/ImageMode.pyi index 0716dea..de5a9ab 100644 --- a/stubs/Pillow/PIL/ImageMode.pyi +++ b/stubs/Pillow/PIL/ImageMode.pyi @@ -5,6 +5,6 @@ class ModeDescriptor: bands: Any basemode: Any basetype: Any - def __init__(self, mode, bands, basemode, basetype) -> None: ... + def __init__(self, mode, bands, basemode, basetype, typestr) -> None: ... def getmode(mode): ... diff --git a/stubs/Pillow/PIL/ImageOps.pyi b/stubs/Pillow/PIL/ImageOps.pyi index bff43f6..999879c 100644 --- a/stubs/Pillow/PIL/ImageOps.pyi +++ b/stubs/Pillow/PIL/ImageOps.pyi @@ -1,6 +1,11 @@ -from typing import Any, Iterable, Protocol +from collections.abc import Iterable +from typing import Any, Protocol, Union +from typing_extensions import TypeAlias -from .Image import Image, _Resample, _Size +from .Image import Image, Resampling, _Resample, _Size +from .ImageColor import _Ink + +_Border: TypeAlias = Union[int, tuple[int, int], tuple[int, int, int, int]] class _Deformer(Protocol): def getmesh(self, image: Image): ... @@ -17,16 +22,18 @@ def colorize( whitepoint: int = ..., midpoint: int = ..., ) -> Image: ... -def contain(image: Image, size: _Size, method: _Resample = ...) -> Image: ... +def contain(image: Image, size: _Size, method: Resampling | _Resample = ...) -> Image: ... def pad( - image: Image, size: _Size, method: _Resample = ..., color: Any | None = ..., centering: Iterable[float] = ... + image: Image, size: _Size, method: Resampling | _Resample = ..., color: Any | None = ..., centering: Iterable[float] = ... ) -> Image: ... -def crop(image: Image, border: int = ...) -> Image: ... -def scale(image: Image, factor: float, resample: _Resample = ...) -> Image: ... -def deform(image: Image, deformer: _Deformer, resample: _Resample = ...) -> Image: ... +def crop(image: Image, border: _Border = ...) -> Image: ... +def scale(image: Image, factor: float, resample: Resampling | _Resample = ...) -> Image: ... +def deform(image: Image, deformer: _Deformer, resample: Resampling | _Resample = ...) -> Image: ... def equalize(image: Image, mask: Any | None = ...) -> Image: ... -def expand(image: Image, border: int = ..., fill: int = ...) -> Image: ... -def fit(image: Image, size: _Size, method: _Resample = ..., bleed: float = ..., centering: Iterable[float] = ...) -> Image: ... +def expand(image: Image, border: _Border = ..., fill: _Ink = ...) -> Image: ... +def fit( + image: Image, size: _Size, method: Resampling | _Resample = ..., bleed: float = ..., centering: Iterable[float] = ... +) -> Image: ... def flip(image: Image) -> Image: ... def grayscale(image: Image) -> Image: ... def invert(image: Image) -> Image: ... diff --git a/stubs/Pillow/PIL/ImageQt.pyi b/stubs/Pillow/PIL/ImageQt.pyi index 8b21385..4728370 100644 --- a/stubs/Pillow/PIL/ImageQt.pyi +++ b/stubs/Pillow/PIL/ImageQt.pyi @@ -1,10 +1,10 @@ from typing import Any -from typing_extensions import Literal +from typing_extensions import Literal, TypeAlias from .Image import Image -QImage = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui -QPixmap = Any +QImage: TypeAlias = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui +QPixmap: TypeAlias = Any qt_versions: Any qt_is_installed: bool @@ -15,7 +15,7 @@ def fromqimage(im: Image | QImage) -> Image: ... def fromqpixmap(im: Image | QImage) -> Image: ... def align8to32(bytes: bytes, width: int, mode: Literal["1", "L", "P"]) -> bytes: ... -class ImageQt(QImage): # type: ignore +class ImageQt(QImage): def __init__(self, im: Image) -> None: ... def toqimage(im: Image) -> ImageQt: ... diff --git a/stubs/Pillow/PIL/ImageShow.pyi b/stubs/Pillow/PIL/ImageShow.pyi index 27daf3f..67b7330 100644 --- a/stubs/Pillow/PIL/ImageShow.pyi +++ b/stubs/Pillow/PIL/ImageShow.pyi @@ -1,4 +1,6 @@ +from _typeshed import Incomplete from typing import Any +from typing_extensions import Literal def register(viewer, order: int = ...) -> None: ... def show(image, title: Any | None = ..., **options): ... @@ -11,7 +13,7 @@ class Viewer: def get_command(self, file, **options) -> None: ... def save_image(self, image): ... def show_image(self, image, **options): ... - def show_file(self, file, **options): ... + def show_file(self, path: Incomplete | None = ..., **options): ... class WindowsViewer(Viewer): format: str @@ -22,16 +24,19 @@ class MacViewer(Viewer): format: str options: Any def get_command(self, file, **options): ... - def show_file(self, file, **options): ... + def show_file(self, path: Incomplete | None = ..., **options): ... class UnixViewer(Viewer): format: str options: Any def get_command(self, file, **options): ... - def show_file(self, file, **options): ... + def show_file(self, path: Incomplete | None = ..., **options): ... + +class XDGViewer(UnixViewer): + def get_command_ex(self, file, **options) -> tuple[Literal["xdg-open"], Literal["xdg-open"]]: ... class DisplayViewer(UnixViewer): - def get_command_ex(self, file, **options): ... + def get_command_ex(self, file, title: str | None = ..., **options): ... class GmDisplayViewer(UnixViewer): def get_command_ex(self, file, **options): ... diff --git a/stubs/Pillow/PIL/ImtImagePlugin.pyi b/stubs/Pillow/PIL/ImtImagePlugin.pyi index 567cbe4..eadbef8 100644 --- a/stubs/Pillow/PIL/ImtImagePlugin.pyi +++ b/stubs/Pillow/PIL/ImtImagePlugin.pyi @@ -1,9 +1,10 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile field: Any class ImtImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["IMT"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/IptcImagePlugin.pyi b/stubs/Pillow/PIL/IptcImagePlugin.pyi index dac96b3..738caa9 100644 --- a/stubs/Pillow/PIL/IptcImagePlugin.pyi +++ b/stubs/Pillow/PIL/IptcImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -9,8 +10,8 @@ def i(c): ... def dump(c) -> None: ... class IptcImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["IPTC"]] + format_description: ClassVar[str] def getint(self, key): ... def field(self): ... im: Any diff --git a/stubs/Pillow/PIL/Jpeg2KImagePlugin.pyi b/stubs/Pillow/PIL/Jpeg2KImagePlugin.pyi index 7290781..a37d618 100644 --- a/stubs/Pillow/PIL/Jpeg2KImagePlugin.pyi +++ b/stubs/Pillow/PIL/Jpeg2KImagePlugin.pyi @@ -1,10 +1,11 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile class Jpeg2KImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["JPEG2000"]] + format_description: ClassVar[str] reduce: Any tile: Any def load(self): ... diff --git a/stubs/Pillow/PIL/JpegImagePlugin.pyi b/stubs/Pillow/PIL/JpegImagePlugin.pyi index 0941106..3e2fefd 100644 --- a/stubs/Pillow/PIL/JpegImagePlugin.pyi +++ b/stubs/Pillow/PIL/JpegImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -11,8 +12,8 @@ def DQT(self, marker) -> None: ... MARKER: Any class JpegImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["JPEG", "MPO"]] + format_description: ClassVar[str] def load_read(self, read_bytes): ... mode: Any tile: Any diff --git a/stubs/Pillow/PIL/McIdasImagePlugin.pyi b/stubs/Pillow/PIL/McIdasImagePlugin.pyi index c492fe2..6e7be99 100644 --- a/stubs/Pillow/PIL/McIdasImagePlugin.pyi +++ b/stubs/Pillow/PIL/McIdasImagePlugin.pyi @@ -1,5 +1,8 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile class McIdasImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["MCIDAS"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/MicImagePlugin.pyi b/stubs/Pillow/PIL/MicImagePlugin.pyi index 48fe3c7..b4fdc9d 100644 --- a/stubs/Pillow/PIL/MicImagePlugin.pyi +++ b/stubs/Pillow/PIL/MicImagePlugin.pyi @@ -1,10 +1,10 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .TiffImagePlugin import TiffImageFile class MicImageFile(TiffImageFile): - format: str - format_description: str + format: ClassVar[Literal["MIC"]] fp: Any frame: Any def seek(self, frame) -> None: ... diff --git a/stubs/Pillow/PIL/MpegImagePlugin.pyi b/stubs/Pillow/PIL/MpegImagePlugin.pyi index 4cadacb..0f01f2b 100644 --- a/stubs/Pillow/PIL/MpegImagePlugin.pyi +++ b/stubs/Pillow/PIL/MpegImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -13,5 +14,5 @@ class BitStream: def read(self, bits): ... class MpegImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["MPEG"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/MpoImagePlugin.pyi b/stubs/Pillow/PIL/MpoImagePlugin.pyi index b89dfa2..2096c46 100644 --- a/stubs/Pillow/PIL/MpoImagePlugin.pyi +++ b/stubs/Pillow/PIL/MpoImagePlugin.pyi @@ -1,10 +1,10 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .JpegImagePlugin import JpegImageFile class MpoImageFile(JpegImageFile): - format: str - format_description: str + format: ClassVar[Literal["MPO"]] def load_seek(self, pos) -> None: ... fp: Any offset: Any diff --git a/stubs/Pillow/PIL/MspImagePlugin.pyi b/stubs/Pillow/PIL/MspImagePlugin.pyi index 2f34b05..bc3f25d 100644 --- a/stubs/Pillow/PIL/MspImagePlugin.pyi +++ b/stubs/Pillow/PIL/MspImagePlugin.pyi @@ -1,8 +1,11 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile, PyDecoder class MspImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["MSP"]] + format_description: ClassVar[str] class MspDecoder(PyDecoder): def decode(self, buffer): ... diff --git a/stubs/Pillow/PIL/PcdImagePlugin.pyi b/stubs/Pillow/PIL/PcdImagePlugin.pyi index 0c147ca..a5ea3dd 100644 --- a/stubs/Pillow/PIL/PcdImagePlugin.pyi +++ b/stubs/Pillow/PIL/PcdImagePlugin.pyi @@ -1,9 +1,10 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile class PcdImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["PCD"]] + format_description: ClassVar[str] im: Any def load_end(self) -> None: ... diff --git a/stubs/Pillow/PIL/PcxImagePlugin.pyi b/stubs/Pillow/PIL/PcxImagePlugin.pyi index 8a47f72..b891666 100644 --- a/stubs/Pillow/PIL/PcxImagePlugin.pyi +++ b/stubs/Pillow/PIL/PcxImagePlugin.pyi @@ -1,11 +1,12 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile logger: Any class PcxImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["PCX", "DCX"]] + format_description: ClassVar[str] SAVE: Any diff --git a/stubs/Pillow/PIL/PdfParser.pyi b/stubs/Pillow/PIL/PdfParser.pyi index 4e484ae..991e506 100644 --- a/stubs/Pillow/PIL/PdfParser.pyi +++ b/stubs/Pillow/PIL/PdfParser.pyi @@ -1,5 +1,5 @@ import collections -from typing import Any, List +from typing import Any def encode_text(s: str) -> bytes: ... @@ -44,13 +44,13 @@ class PdfName: allowed_chars: Any def __bytes__(self): ... -class PdfArray(List[Any]): +class PdfArray(list[Any]): def __bytes__(self): ... -class PdfDict(collections.UserDict): +class PdfDict(collections.UserDict[bytes, Any]): def __setattr__(self, key, value) -> None: ... def __getattr__(self, key): ... - def __bytes__(self): ... + def __bytes__(self) -> bytes: ... class PdfBinary: data: Any diff --git a/stubs/Pillow/PIL/PixarImagePlugin.pyi b/stubs/Pillow/PIL/PixarImagePlugin.pyi index 31890c4..8c9bcaf 100644 --- a/stubs/Pillow/PIL/PixarImagePlugin.pyi +++ b/stubs/Pillow/PIL/PixarImagePlugin.pyi @@ -1,5 +1,8 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile class PixarImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["PIXAR"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/PngImagePlugin.pyi b/stubs/Pillow/PIL/PngImagePlugin.pyi index 3126f6b..b2033e6 100644 --- a/stubs/Pillow/PIL/PngImagePlugin.pyi +++ b/stubs/Pillow/PIL/PngImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from ._binary import o8 as o8 from .ImageFile import ImageFile @@ -75,8 +76,8 @@ class PngStream(ChunkStream): def chunk_fdAT(self, pos, length): ... class PngImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["PNG"]] + format_description: ClassVar[str] @property def text(self): ... fp: Any diff --git a/stubs/Pillow/PIL/PpmImagePlugin.pyi b/stubs/Pillow/PIL/PpmImagePlugin.pyi index 2adee46..797bbd7 100644 --- a/stubs/Pillow/PIL/PpmImagePlugin.pyi +++ b/stubs/Pillow/PIL/PpmImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -6,5 +7,5 @@ b_whitespace: bytes MODES: Any class PpmImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["PPM"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/PsdImagePlugin.pyi b/stubs/Pillow/PIL/PsdImagePlugin.pyi index 5a3d381..0d38350 100644 --- a/stubs/Pillow/PIL/PsdImagePlugin.pyi +++ b/stubs/Pillow/PIL/PsdImagePlugin.pyi @@ -1,12 +1,13 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile MODES: Any class PsdImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["PSD"]] + format_description: ClassVar[str] mode: Any tile: Any frame: Any diff --git a/stubs/Pillow/PIL/SgiImagePlugin.pyi b/stubs/Pillow/PIL/SgiImagePlugin.pyi index 2d498db..e7f4ff9 100644 --- a/stubs/Pillow/PIL/SgiImagePlugin.pyi +++ b/stubs/Pillow/PIL/SgiImagePlugin.pyi @@ -1,12 +1,13 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile, PyDecoder MODES: Any class SgiImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["SGI"]] + format_description: ClassVar[str] class SGI16Decoder(PyDecoder): def decode(self, buffer): ... diff --git a/stubs/Pillow/PIL/SpiderImagePlugin.pyi b/stubs/Pillow/PIL/SpiderImagePlugin.pyi index 8a3e213..17f5e6d 100644 --- a/stubs/Pillow/PIL/SpiderImagePlugin.pyi +++ b/stubs/Pillow/PIL/SpiderImagePlugin.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, ClassVar from typing_extensions import Literal from .ImageFile import ImageFile @@ -11,8 +11,8 @@ def isSpiderHeader(t): ... def isSpiderImage(filename): ... class SpiderImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["SPIDER"]] + format_description: ClassVar[str] @property def n_frames(self): ... @property diff --git a/stubs/Pillow/PIL/SunImagePlugin.pyi b/stubs/Pillow/PIL/SunImagePlugin.pyi index 731c788..27ac28a 100644 --- a/stubs/Pillow/PIL/SunImagePlugin.pyi +++ b/stubs/Pillow/PIL/SunImagePlugin.pyi @@ -1,5 +1,8 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile class SunImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["SUN"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/TgaImagePlugin.pyi b/stubs/Pillow/PIL/TgaImagePlugin.pyi index 3072da3..5022107 100644 --- a/stubs/Pillow/PIL/TgaImagePlugin.pyi +++ b/stubs/Pillow/PIL/TgaImagePlugin.pyi @@ -1,11 +1,12 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile MODES: Any class TgaImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["TGA"]] + format_description: ClassVar[str] SAVE: Any diff --git a/stubs/Pillow/PIL/TiffImagePlugin.pyi b/stubs/Pillow/PIL/TiffImagePlugin.pyi index 5eaaa7b..d56baa3 100644 --- a/stubs/Pillow/PIL/TiffImagePlugin.pyi +++ b/stubs/Pillow/PIL/TiffImagePlugin.pyi @@ -1,6 +1,7 @@ from collections.abc import MutableMapping from numbers import Rational -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile @@ -121,8 +122,10 @@ class ImageFileDirectory_v2(MutableMapping[int, Any]): class ImageFileDirectory_v1(ImageFileDirectory_v2): def __init__(self, *args, **kwargs) -> None: ... - tags: Any - tagdata: Any + @property + def tags(self): ... + @property + def tagdata(self): ... tagtype: dict[int, int] @classmethod def from_v2(cls, original): ... @@ -136,8 +139,8 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2): ImageFileDirectory = ImageFileDirectory_v1 class TiffImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["TIFF", "MIC"]] + format_description: ClassVar[str] tag_v2: Any tag: Any def __init__(self, fp: Any | None = ..., filename: Any | None = ...) -> None: ... diff --git a/stubs/Pillow/PIL/TiffTags.pyi b/stubs/Pillow/PIL/TiffTags.pyi index 5559e16..e4582c8 100644 --- a/stubs/Pillow/PIL/TiffTags.pyi +++ b/stubs/Pillow/PIL/TiffTags.pyi @@ -1,5 +1,5 @@ -from typing import Any, Dict, NamedTuple, Tuple, Union -from typing_extensions import Literal +from typing import Any, NamedTuple, Union +from typing_extensions import Literal, TypeAlias class _TagInfo(NamedTuple): value: Any @@ -35,8 +35,8 @@ FLOAT: Literal[11] DOUBLE: Literal[12] IFD: Literal[13] -_TagType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] -_TagTuple = Union[Tuple[str, _TagType, int], Tuple[str, _TagInfo, int, Dict[str, int]]] +_TagType: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] +_TagTuple: TypeAlias = Union[tuple[str, _TagType, int], tuple[str, _TagInfo, int, dict[str, int]]] TAGS_V2: dict[int, _TagTuple] TAGS_V2_GROUPS: dict[int, dict[int, _TagTuple]] diff --git a/stubs/Pillow/PIL/WalImageFile.pyi b/stubs/Pillow/PIL/WalImageFile.pyi index 6355032..24d1cb5 100644 --- a/stubs/Pillow/PIL/WalImageFile.pyi +++ b/stubs/Pillow/PIL/WalImageFile.pyi @@ -1,3 +1,13 @@ +from typing import ClassVar +from typing_extensions import Literal + +from . import ImageFile + +class WalImageFile(ImageFile.ImageFile): + format: ClassVar[Literal["WAL"]] + format_description: ClassVar[str] + def load(self) -> None: ... + def open(filename): ... quake2palette: bytes diff --git a/stubs/Pillow/PIL/WebPImagePlugin.pyi b/stubs/Pillow/PIL/WebPImagePlugin.pyi index 97614e6..f7b7e6c 100644 --- a/stubs/Pillow/PIL/WebPImagePlugin.pyi +++ b/stubs/Pillow/PIL/WebPImagePlugin.pyi @@ -1,12 +1,13 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile SUPPORTED: bool class WebPImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["WEBP"]] + format_description: ClassVar[str] def seek(self, frame) -> None: ... fp: Any tile: Any diff --git a/stubs/Pillow/PIL/WmfImagePlugin.pyi b/stubs/Pillow/PIL/WmfImagePlugin.pyi index b724494..5f7c4d4 100644 --- a/stubs/Pillow/PIL/WmfImagePlugin.pyi +++ b/stubs/Pillow/PIL/WmfImagePlugin.pyi @@ -1,4 +1,5 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import StubImageFile @@ -10,6 +11,6 @@ class WmfHandler: def load(self, im): ... class WmfStubImageFile(StubImageFile): - format: str - format_description: str + format: ClassVar[Literal["WMF"]] + format_description: ClassVar[str] def load(self, dpi: Any | None = ...) -> None: ... diff --git a/stubs/Pillow/PIL/XVThumbImagePlugin.pyi b/stubs/Pillow/PIL/XVThumbImagePlugin.pyi index 3d098da..ebfc7d9 100644 --- a/stubs/Pillow/PIL/XVThumbImagePlugin.pyi +++ b/stubs/Pillow/PIL/XVThumbImagePlugin.pyi @@ -1,7 +1,10 @@ +from typing import ClassVar +from typing_extensions import Literal + from .ImageFile import ImageFile PALETTE: bytes class XVThumbImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["XVThumb"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/XbmImagePlugin.pyi b/stubs/Pillow/PIL/XbmImagePlugin.pyi index f8305c0..588aaac 100644 --- a/stubs/Pillow/PIL/XbmImagePlugin.pyi +++ b/stubs/Pillow/PIL/XbmImagePlugin.pyi @@ -1,9 +1,10 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile xbm_head: Any class XbmImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["XBM"]] + format_description: ClassVar[str] diff --git a/stubs/Pillow/PIL/XpmImagePlugin.pyi b/stubs/Pillow/PIL/XpmImagePlugin.pyi index 600a9e0..d0df39a 100644 --- a/stubs/Pillow/PIL/XpmImagePlugin.pyi +++ b/stubs/Pillow/PIL/XpmImagePlugin.pyi @@ -1,10 +1,11 @@ -from typing import Any +from typing import Any, ClassVar +from typing_extensions import Literal from .ImageFile import ImageFile xpm_head: Any class XpmImageFile(ImageFile): - format: str - format_description: str + format: ClassVar[Literal["XPM"]] + format_description: ClassVar[str] def load_read(self, bytes): ... diff --git a/stubs/Pillow/PIL/_imaging.pyi b/stubs/Pillow/PIL/_imaging.pyi index 44d41ce..b9435b8 100644 --- a/stubs/Pillow/PIL/_imaging.pyi +++ b/stubs/Pillow/PIL/_imaging.pyi @@ -1,5 +1,5 @@ +from _typeshed import Incomplete from collections.abc import Sequence -from typing import Any from typing_extensions import Literal DEFAULT_STRATEGY: Literal[0] @@ -9,7 +9,7 @@ RLE: Literal[3] FIXED: Literal[4] class _Path: - def __getattr__(self, item: str) -> Any: ... # incomplete + def __getattr__(self, item: str) -> Incomplete: ... def path(__x: Sequence[tuple[float, float]] | Sequence[float]) -> _Path: ... -def __getattr__(__name: str) -> Any: ... # incomplete +def __getattr__(__name: str) -> Incomplete: ... diff --git a/stubs/Pillow/PIL/_util.pyi b/stubs/Pillow/PIL/_util.pyi index f5faa8c..e69de29 100644 --- a/stubs/Pillow/PIL/_util.pyi +++ b/stubs/Pillow/PIL/_util.pyi @@ -1,9 +0,0 @@ -from typing import NoReturn - -def isPath(f: object) -> bool: ... -def isDirectory(f: object) -> bool: ... - -class deferred_error: - ex: BaseException - def __init__(self, ex: BaseException) -> None: ... - def __getattr__(self, elt: str) -> NoReturn: ... diff --git a/stubs/PyAutoGUI/METADATA.toml b/stubs/PyAutoGUI/METADATA.toml new file mode 100644 index 0000000..6b8f1dc --- /dev/null +++ b/stubs/PyAutoGUI/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.9.*" +requires = ["types-PyScreeze", "types-Pillow"] diff --git a/stubs/PyAutoGUI/pyautogui/__init__.pyi b/stubs/PyAutoGUI/pyautogui/__init__.pyi new file mode 100644 index 0000000..267fa10 --- /dev/null +++ b/stubs/PyAutoGUI/pyautogui/__init__.pyi @@ -0,0 +1,235 @@ +import contextlib +from collections.abc import Callable, Iterable, Sequence +from datetime import datetime +from typing import NamedTuple, SupportsInt, TypeVar +from typing_extensions import ParamSpec, SupportsIndex, TypeAlias + +from pyscreeze import ( + locate as locate, + locateAll as locateAll, + locateAllOnScreen as locateAllOnScreen, + locateCenterOnScreen as locateCenterOnScreen, + locateOnScreen as locateOnScreen, + locateOnWindow as locateOnWindow, +) + +class PyAutoGUIException(Exception): ... +class FailSafeException(PyAutoGUIException): ... +class ImageNotFoundException(PyAutoGUIException): ... + +_P = ParamSpec("_P") +_R = TypeVar("_R") +_NormalizeableXArg: TypeAlias = str | SupportsInt | Sequence[SupportsInt] + +def raisePyAutoGUIImageNotFoundException(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ... +def mouseInfo() -> None: ... +def useImageNotFoundException(value: bool | None = ...) -> None: ... + +KEY_NAMES: list[str] +KEYBOARD_KEYS: list[str] +LEFT: str +MIDDLE: str +RIGHT: str +PRIMARY: str +SECONDARY: str +QWERTY: str +QWERTZ: str + +def isShiftCharacter(character: str) -> bool: ... + +MINIMUM_DURATION: float +MINIMUM_SLEEP: float +PAUSE: float +DARWIN_CATCH_UP_TIME: float +FAILSAFE: bool +FAILSAFE_POINTS: list[tuple[int, int]] +LOG_SCREENSHOTS: bool +LOG_SCREENSHOTS_LIMIT: int +G_LOG_SCREENSHOTS_FILENAMES: list[str] + +class Point(NamedTuple): + x: float + y: float + +class Size(NamedTuple): + width: int + height: int + +def getPointOnLine(x1: float, y1: float, x2: float, y2: float, n: float) -> tuple[float, float]: ... +def linear(n: float) -> float: ... +def position(x: int | None = ..., y: int | None = ...) -> Point: ... +def size() -> Size: ... +def onScreen(x: _NormalizeableXArg | None, y: SupportsInt | None = ...) -> bool: ... +def mouseDown( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def mouseUp( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def click( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + clicks: SupportsIndex = ..., + interval: float = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def leftClick( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + interval: float = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def rightClick( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + interval: float = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def middleClick( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + interval: float = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def doubleClick( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + interval: float = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def tripleClick( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + interval: float = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def scroll( + clicks: float, + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def hscroll( + clicks: float, + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def vscroll( + clicks: float, + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def moveTo( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool = ..., + _pause: bool = ..., +) -> None: ... +def moveRel( + xOffset: _NormalizeableXArg | None = ..., + yOffset: SupportsInt | None = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + logScreenshot: bool = ..., + _pause: bool = ..., +) -> None: ... + +move = moveRel + +def dragTo( + x: _NormalizeableXArg | None = ..., + y: SupportsInt | None = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., + mouseDownUp: bool = ..., +) -> None: ... +def dragRel( + xOffset: _NormalizeableXArg | None = ..., + yOffset: SupportsInt | None = ..., + duration: float = ..., + tween: Callable[[float], float] = ..., + # Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` + button: str = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., + mouseDownUp: bool = ..., +) -> None: ... + +drag = dragRel + +def isValidKey(key: str) -> bool: ... +def keyDown(key: str, logScreenshot: bool | None = ..., _pause: bool = ...) -> None: ... +def keyUp(key: str, logScreenshot: bool | None = ..., _pause: bool = ...) -> None: ... +def press( + keys: str | Iterable[str], + presses: SupportsIndex = ..., + interval: float = ..., + logScreenshot: bool | None = ..., + _pause: bool = ..., +) -> None: ... +def hold( + keys: str | Iterable[str], logScreenshot: bool | None = ..., _pause: bool = ... +) -> contextlib._GeneratorContextManager[None]: ... +def typewrite( + message: str | Sequence[str], interval: float = ..., logScreenshot: bool | None = ..., _pause: bool = ... +) -> None: ... + +write = typewrite + +def hotkey(*args: str, logScreenshot: bool | None = ..., interval: float = ...) -> None: ... +def failSafeCheck() -> None: ... +def displayMousePosition(xOffset: float = ..., yOffset: float = ...) -> None: ... +def sleep(seconds: float) -> None: ... +def countdown(seconds: SupportsIndex) -> None: ... +def run(commandStr: str, _ssCount: Sequence[int] | None = ...) -> None: ... +def printInfo(dontPrint: bool = ...) -> str: ... +def getInfo() -> tuple[str, str, str, str, Size, datetime]: ... diff --git a/stubs/PyMySQL/@tests/stubtest_allowlist.txt b/stubs/PyMySQL/@tests/stubtest_allowlist.txt index 1bb5673..f8fe065 100644 --- a/stubs/PyMySQL/@tests/stubtest_allowlist.txt +++ b/stubs/PyMySQL/@tests/stubtest_allowlist.txt @@ -2,45 +2,10 @@ pymysql.connections.byte2int pymysql.connections.int2byte pymysql.connections.lenenc_int pymysql.connections.pack_int24 -pymysql.converters.ESCAPE_MAP -pymysql.converters.ESCAPE_REGEX -pymysql.converters.FLAG -pymysql.converters.PYTHON3 -pymysql.converters.charset_by_id -pymysql.converters.convert_bit -pymysql.converters.convert_characters -pymysql.converters.convert_date -pymysql.converters.convert_datetime -pymysql.converters.convert_decimal -pymysql.converters.convert_float -pymysql.converters.convert_int -pymysql.converters.convert_long -pymysql.converters.convert_mysql_timestamp -pymysql.converters.convert_set -pymysql.converters.convert_time -pymysql.converters.convert_timedelta -pymysql.converters.escape_None -pymysql.converters.escape_bool -pymysql.converters.escape_date -pymysql.converters.escape_datetime -pymysql.converters.escape_decimal -pymysql.converters.escape_dict -pymysql.converters.escape_float -pymysql.converters.escape_item -pymysql.converters.escape_long -pymysql.converters.escape_object -pymysql.converters.escape_sequence -pymysql.converters.escape_set -pymysql.converters.escape_string -pymysql.converters.escape_struct_time -pymysql.converters.escape_time -pymysql.converters.escape_timedelta -pymysql.converters.escape_unicode pymysql.cursors.Cursor.__del__ # DictCursorMixin changes method types of inherited classes, but doesn't contain much at runtime pymysql.cursors.DictCursorMixin.__iter__ pymysql.cursors.DictCursorMixin.fetch[a-z]* -pymysql.err.ER pymysql.escape_dict pymysql.escape_sequence pymysql.escape_string diff --git a/stubs/PyMySQL/METADATA.toml b/stubs/PyMySQL/METADATA.toml index f339dc7..f3e83f9 100644 --- a/stubs/PyMySQL/METADATA.toml +++ b/stubs/PyMySQL/METADATA.toml @@ -1,2 +1 @@ -version = "1.0" -python2 = true +version = "1.0.*" diff --git a/stubs/PyMySQL/pymysql/__init__.pyi b/stubs/PyMySQL/pymysql/__init__.pyi index 6cfbf75..163ca68 100644 --- a/stubs/PyMySQL/pymysql/__init__.pyi +++ b/stubs/PyMySQL/pymysql/__init__.pyi @@ -1,6 +1,3 @@ -import sys -from typing import FrozenSet, Tuple - from .connections import Connection as Connection from .constants import FIELD_TYPE as FIELD_TYPE from .converters import escape_dict as escape_dict, escape_sequence as escape_sequence, escape_string as escape_string @@ -30,7 +27,7 @@ threadsafety: int apilevel: str paramstyle: str -class DBAPISet(FrozenSet[int]): +class DBAPISet(frozenset[int]): def __ne__(self, other) -> bool: ... def __eq__(self, other) -> bool: ... def __hash__(self) -> int: ... @@ -44,16 +41,11 @@ TIMESTAMP: DBAPISet DATETIME: DBAPISet ROWID: DBAPISet -if sys.version_info >= (3, 0): - def Binary(x) -> bytes: ... - -else: - def Binary(x) -> bytearray: ... - +def Binary(x) -> bytes: ... def get_client_info() -> str: ... __version__: str -version_info: Tuple[int, int, int, str, int] +version_info: tuple[int, int, int, str, int] NULL: str # pymysql/__init__.py says "Connect = connect = Connection = connections.Connection" diff --git a/stubs/PyMySQL/pymysql/charset.pyi b/stubs/PyMySQL/pymysql/charset.pyi index c47679a..0a36fa6 100644 --- a/stubs/PyMySQL/pymysql/charset.pyi +++ b/stubs/PyMySQL/pymysql/charset.pyi @@ -7,7 +7,6 @@ class Charset: def __init__(self, id, name, collation, is_default): ... class Charsets: - def __init__(self): ... def add(self, c): ... def by_id(self, id): ... def by_name(self, name): ... diff --git a/stubs/PyMySQL/pymysql/connections.pyi b/stubs/PyMySQL/pymysql/connections.pyi index f30e036..ca98f0a 100644 --- a/stubs/PyMySQL/pymysql/connections.pyi +++ b/stubs/PyMySQL/pymysql/connections.pyi @@ -1,5 +1,7 @@ +from _typeshed import Self +from collections.abc import Mapping from socket import socket as _socket -from typing import Any, AnyStr, Generic, Mapping, Tuple, Type, TypeVar, overload +from typing import Any, AnyStr, Generic, TypeVar, overload from .charset import charset_by_id as charset_by_id, charset_by_name as charset_by_name from .constants import CLIENT as CLIENT, COMMAND as COMMAND, FIELD_TYPE as FIELD_TYPE, SERVER_STATUS as SERVER_STATUS @@ -35,7 +37,7 @@ class MysqlPacket: def read_uint64(self) -> Any: ... def read_length_encoded_integer(self) -> int: ... def read_length_coded_string(self) -> bytes: ... - def read_struct(self, fmt: str) -> Tuple[Any, ...]: ... + def read_struct(self, fmt: str) -> tuple[Any, ...]: ... def is_ok_packet(self) -> bool: ... def is_eof_packet(self) -> bool: ... def is_auth_switch_request(self) -> bool: ... @@ -133,7 +135,7 @@ class Connection(Generic[_C]): conv=..., use_unicode: bool | None = ..., client_flag: int = ..., - cursorclass: Type[_C] = ..., # different between overloads + cursorclass: type[_C] = ..., # different between overloads init_command: Any | None = ..., connect_timeout: int | None = ..., ssl: Mapping[Any, Any] | None = ..., @@ -178,7 +180,7 @@ class Connection(Generic[_C]): @overload def cursor(self, cursor: None = ...) -> _C: ... @overload - def cursor(self, cursor: Type[_C2]) -> _C2: ... + def cursor(self, cursor: type[_C2]) -> _C2: ... def query(self, sql, unbuffered: bool = ...) -> int: ... def next_result(self, unbuffered: bool = ...) -> int: ... def affected_rows(self): ... @@ -195,6 +197,8 @@ class Connection(Generic[_C]): def get_proto_info(self): ... def get_server_info(self): ... def show_warnings(self): ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *exc_info: object) -> None: ... Warning: Any Error: Any InterfaceError: Any diff --git a/stubs/PyMySQL/pymysql/constants/CLIENT.pyi b/stubs/PyMySQL/pymysql/constants/CLIENT.pyi index ac8fb55..21019e0 100644 --- a/stubs/PyMySQL/pymysql/constants/CLIENT.pyi +++ b/stubs/PyMySQL/pymysql/constants/CLIENT.pyi @@ -15,4 +15,11 @@ TRANSACTIONS: int SECURE_CONNECTION: int MULTI_STATEMENTS: int MULTI_RESULTS: int +PS_MULTI_RESULTS: int +PLUGIN_AUTH: int +CONNECT_ATTRS: int +PLUGIN_AUTH_LENENC_CLIENT_DATA: int CAPABILITIES: int +HANDLE_EXPIRED_PASSWORDS: int +SESSION_TRACK: int +DEPRECATE_EOF: int diff --git a/stubs/PyMySQL/pymysql/constants/COMMAND.pyi b/stubs/PyMySQL/pymysql/constants/COMMAND.pyi index 1163e6b..fe74c54 100644 --- a/stubs/PyMySQL/pymysql/constants/COMMAND.pyi +++ b/stubs/PyMySQL/pymysql/constants/COMMAND.pyi @@ -20,3 +20,13 @@ COM_BINLOG_DUMP: int COM_TABLE_DUMP: int COM_CONNECT_OUT: int COM_REGISTER_SLAVE: int +COM_STMT_PREPARE: int +COM_STMT_EXECUTE: int +COM_STMT_SEND_LONG_DATA: int +COM_STMT_CLOSE: int +COM_STMT_RESET: int +COM_SET_OPTION: int +COM_STMT_FETCH: int +COM_DAEMON: int +COM_BINLOG_DUMP_GTID: int +COM_END: int diff --git a/stubs/PyMySQL/pymysql/constants/CR.pyi b/stubs/PyMySQL/pymysql/constants/CR.pyi new file mode 100644 index 0000000..0103739 --- /dev/null +++ b/stubs/PyMySQL/pymysql/constants/CR.pyi @@ -0,0 +1,64 @@ +CR_ERROR_FIRST: int +CR_UNKNOWN_ERROR: int +CR_SOCKET_CREATE_ERROR: int +CR_CONNECTION_ERROR: int +CR_CONN_HOST_ERROR: int +CR_IPSOCK_ERROR: int +CR_UNKNOWN_HOST: int +CR_SERVER_GONE_ERROR: int +CR_VERSION_ERROR: int +CR_OUT_OF_MEMORY: int +CR_WRONG_HOST_INFO: int +CR_LOCALHOST_CONNECTION: int +CR_TCP_CONNECTION: int +CR_SERVER_HANDSHAKE_ERR: int +CR_SERVER_LOST: int +CR_COMMANDS_OUT_OF_SYNC: int +CR_NAMEDPIPE_CONNECTION: int +CR_NAMEDPIPEWAIT_ERROR: int +CR_NAMEDPIPEOPEN_ERROR: int +CR_NAMEDPIPESETSTATE_ERROR: int +CR_CANT_READ_CHARSET: int +CR_NET_PACKET_TOO_LARGE: int +CR_EMBEDDED_CONNECTION: int +CR_PROBE_SLAVE_STATUS: int +CR_PROBE_SLAVE_HOSTS: int +CR_PROBE_SLAVE_CONNECT: int +CR_PROBE_MASTER_CONNECT: int +CR_SSL_CONNECTION_ERROR: int +CR_MALFORMED_PACKET: int +CR_WRONG_LICENSE: int +CR_NULL_POINTER: int +CR_NO_PREPARE_STMT: int +CR_PARAMS_NOT_BOUND: int +CR_DATA_TRUNCATED: int +CR_NO_PARAMETERS_EXISTS: int +CR_INVALID_PARAMETER_NO: int +CR_INVALID_BUFFER_USE: int +CR_UNSUPPORTED_PARAM_TYPE: int +CR_SHARED_MEMORY_CONNECTION: int +CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR: int +CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR: int +CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR: int +CR_SHARED_MEMORY_CONNECT_MAP_ERROR: int +CR_SHARED_MEMORY_FILE_MAP_ERROR: int +CR_SHARED_MEMORY_MAP_ERROR: int +CR_SHARED_MEMORY_EVENT_ERROR: int +CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR: int +CR_SHARED_MEMORY_CONNECT_SET_ERROR: int +CR_CONN_UNKNOW_PROTOCOL: int +CR_INVALID_CONN_HANDLE: int +CR_SECURE_AUTH: int +CR_FETCH_CANCELED: int +CR_NO_DATA: int +CR_NO_STMT_METADATA: int +CR_NO_RESULT_SET: int +CR_NOT_IMPLEMENTED: int +CR_SERVER_LOST_EXTENDED: int +CR_STMT_CLOSED: int +CR_NEW_STMT_METADATA: int +CR_ALREADY_CONNECTED: int +CR_AUTH_PLUGIN_CANNOT_LOAD: int +CR_DUPLICATE_CONNECTION_ATTR: int +CR_AUTH_PLUGIN_ERR: int +CR_ERROR_LAST: int diff --git a/stubs/PyMySQL/pymysql/constants/ER.pyi b/stubs/PyMySQL/pymysql/constants/ER.pyi index 5f0a432..0f4c17f 100644 --- a/stubs/PyMySQL/pymysql/constants/ER.pyi +++ b/stubs/PyMySQL/pymysql/constants/ER.pyi @@ -469,3 +469,4 @@ USERNAME: int HOSTNAME: int WRONG_STRING_LENGTH: int ERROR_LAST: int +CONSTRAINT_FAILED: int diff --git a/stubs/PyMySQL/pymysql/constants/FIELD_TYPE.pyi b/stubs/PyMySQL/pymysql/constants/FIELD_TYPE.pyi index f1938b0..4790d92 100644 --- a/stubs/PyMySQL/pymysql/constants/FIELD_TYPE.pyi +++ b/stubs/PyMySQL/pymysql/constants/FIELD_TYPE.pyi @@ -15,6 +15,7 @@ YEAR: int NEWDATE: int VARCHAR: int BIT: int +JSON: int NEWDECIMAL: int ENUM: int SET: int diff --git a/stubs/PyMySQL/pymysql/constants/FLAG.pyi b/stubs/PyMySQL/pymysql/constants/FLAG.pyi index 04b99fa..421f231 100644 --- a/stubs/PyMySQL/pymysql/constants/FLAG.pyi +++ b/stubs/PyMySQL/pymysql/constants/FLAG.pyi @@ -1,17 +1,15 @@ -from typing import Any - -NOT_NULL: Any -PRI_KEY: Any -UNIQUE_KEY: Any -MULTIPLE_KEY: Any -BLOB: Any -UNSIGNED: Any -ZEROFILL: Any -BINARY: Any -ENUM: Any -AUTO_INCREMENT: Any -TIMESTAMP: Any -SET: Any -PART_KEY: Any -GROUP: Any -UNIQUE: Any +NOT_NULL: int +PRI_KEY: int +UNIQUE_KEY: int +MULTIPLE_KEY: int +BLOB: int +UNSIGNED: int +ZEROFILL: int +BINARY: int +ENUM: int +AUTO_INCREMENT: int +TIMESTAMP: int +SET: int +PART_KEY: int +GROUP: int +UNIQUE: int diff --git a/stubs/PyMySQL/pymysql/converters.pyi b/stubs/PyMySQL/pymysql/converters.pyi index 01a2561..850ca79 100644 --- a/stubs/PyMySQL/pymysql/converters.pyi +++ b/stubs/PyMySQL/pymysql/converters.pyi @@ -1,47 +1,40 @@ -from typing import Any - -from .charset import charset_by_id as charset_by_id -from .constants import FIELD_TYPE as FIELD_TYPE, FLAG as FLAG - -PYTHON3: Any -ESCAPE_REGEX: Any -ESCAPE_MAP: Any - -def escape_item(val, charset): ... -def escape_dict(val, charset): ... -def escape_sequence(val, charset): ... -def escape_set(val, charset): ... -def escape_bool(value): ... -def escape_object(value): ... - -escape_int: Any - -escape_long: Any - -def escape_float(value): ... -def escape_string(value): ... -def escape_unicode(value): ... -def escape_None(value): ... -def escape_timedelta(obj): ... -def escape_time(obj): ... -def escape_datetime(obj): ... -def escape_date(obj): ... -def escape_struct_time(obj): ... -def convert_datetime(connection, field, obj): ... -def convert_timedelta(connection, field, obj): ... -def convert_time(connection, field, obj): ... -def convert_date(connection, field, obj): ... -def convert_mysql_timestamp(connection, field, timestamp): ... -def convert_set(s): ... -def convert_bit(connection, field, b): ... -def convert_characters(connection, field, data): ... -def convert_int(connection, field, data): ... -def convert_long(connection, field, data): ... -def convert_float(connection, field, data): ... - -encoders: Any -decoders: Any -conversions: Any - -def convert_decimal(connection, field, data): ... -def escape_decimal(obj): ... +import datetime +import time +from collections.abc import Callable, Mapping, Sequence +from decimal import Decimal +from typing import Any, TypeVar +from typing_extensions import TypeAlias + +_EscaperMapping: TypeAlias = Mapping[type[object], Callable[..., str]] | None +_T = TypeVar("_T") + +def escape_item(val: object, charset: object, mapping: _EscaperMapping = ...) -> str: ... +def escape_dict(val: Mapping[str, object], charset: object, mapping: _EscaperMapping = ...) -> dict[str, str]: ... +def escape_sequence(val: Sequence[object], charset: object, mapping: _EscaperMapping = ...) -> str: ... +def escape_set(val: set[object], charset: object, mapping: _EscaperMapping = ...) -> str: ... +def escape_bool(value: bool, mapping: _EscaperMapping = ...) -> str: ... +def escape_int(value: int, mapping: _EscaperMapping = ...) -> str: ... +def escape_float(value: float, mapping: _EscaperMapping = ...) -> str: ... +def escape_string(value: str, mapping: _EscaperMapping = ...) -> str: ... +def escape_bytes_prefixed(value: bytes, mapping: _EscaperMapping = ...) -> str: ... +def escape_bytes(value: bytes, mapping: _EscaperMapping = ...) -> str: ... +def escape_str(value: str, mapping: _EscaperMapping = ...) -> str: ... +def escape_None(value: None, mapping: _EscaperMapping = ...) -> str: ... +def escape_timedelta(obj: datetime.timedelta, mapping: _EscaperMapping = ...) -> str: ... +def escape_time(obj: datetime.time, mapping: _EscaperMapping = ...) -> str: ... +def escape_datetime(obj: datetime.datetime, mapping: _EscaperMapping = ...) -> str: ... +def escape_date(obj: datetime.date, mapping: _EscaperMapping = ...) -> str: ... +def escape_struct_time(obj: time.struct_time, mapping: _EscaperMapping = ...) -> str: ... +def Decimal2Literal(o: Decimal, d: object) -> str: ... +def convert_datetime(obj: str | bytes) -> datetime.datetime | str: ... +def convert_timedelta(obj: str | bytes) -> datetime.timedelta | str: ... +def convert_time(obj: str | bytes) -> datetime.time | str: ... +def convert_date(obj: str | bytes) -> datetime.date | str: ... +def through(x: _T) -> _T: ... + +convert_bit = through + +encoders: dict[type[object], Callable[..., str]] +decoders: dict[int, Callable[[str | bytes], Any]] +conversions: dict[type[object] | int, Callable[..., Any]] +Thing2Literal = escape_str diff --git a/stubs/PyMySQL/pymysql/cursors.pyi b/stubs/PyMySQL/pymysql/cursors.pyi index b2d1ffb..df03886 100644 --- a/stubs/PyMySQL/pymysql/cursors.pyi +++ b/stubs/PyMySQL/pymysql/cursors.pyi @@ -1,12 +1,12 @@ -from typing import Any, Iterable, Iterator, Text, Tuple, TypeVar +from _typeshed import Self +from collections.abc import Iterable, Iterator +from typing import Any from .connections import Connection -_SelfT = TypeVar("_SelfT") - class Cursor: connection: Connection[Any] - description: Tuple[Text, ...] + description: tuple[str, ...] rownumber: int rowcount: int arraysize: int @@ -19,32 +19,32 @@ class Cursor: def setinputsizes(self, *args) -> None: ... def setoutputsizes(self, *args) -> None: ... def nextset(self) -> bool | None: ... - def mogrify(self, query: Text, args: object = ...) -> str: ... - def execute(self, query: Text, args: object = ...) -> int: ... - def executemany(self, query: Text, args: Iterable[object]) -> int | None: ... - def callproc(self, procname: Text, args: Iterable[Any] = ...) -> Any: ... - def scroll(self, value: int, mode: Text = ...) -> None: ... - def __enter__(self: _SelfT) -> _SelfT: ... - def __exit__(self, *exc_info: Any) -> None: ... + def mogrify(self, query: str, args: object = ...) -> str: ... + def execute(self, query: str, args: object = ...) -> int: ... + def executemany(self, query: str, args: Iterable[object]) -> int | None: ... + def callproc(self, procname: str, args: Iterable[Any] = ...) -> Any: ... + def scroll(self, value: int, mode: str = ...) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *exc_info: object) -> None: ... # Methods returning result tuples are below. - def fetchone(self) -> Tuple[Any, ...] | None: ... - def fetchmany(self, size: int | None = ...) -> Tuple[Tuple[Any, ...], ...]: ... - def fetchall(self) -> Tuple[Tuple[Any, ...], ...]: ... - def __iter__(self) -> Iterator[Tuple[Any, ...]]: ... + def fetchone(self) -> tuple[Any, ...] | None: ... + def fetchmany(self, size: int | None = ...) -> tuple[tuple[Any, ...], ...]: ... + def fetchall(self) -> tuple[tuple[Any, ...], ...]: ... + def __iter__(self) -> Iterator[tuple[Any, ...]]: ... class DictCursorMixin: dict_type: Any # TODO: add support if someone needs this - def fetchone(self) -> dict[Text, Any] | None: ... - def fetchmany(self, size: int | None = ...) -> Tuple[dict[Text, Any], ...]: ... - def fetchall(self) -> Tuple[dict[Text, Any], ...]: ... - def __iter__(self) -> Iterator[dict[Text, Any]]: ... + def fetchone(self) -> dict[str, Any] | None: ... + def fetchmany(self, size: int | None = ...) -> tuple[dict[str, Any], ...]: ... + def fetchall(self) -> tuple[dict[str, Any], ...]: ... + def __iter__(self) -> Iterator[dict[str, Any]]: ... class SSCursor(Cursor): - def fetchall(self) -> list[Tuple[Any, ...]]: ... # type: ignore - def fetchall_unbuffered(self) -> Iterator[Tuple[Any, ...]]: ... - def scroll(self, value: int, mode: Text = ...) -> None: ... + def fetchall(self) -> list[tuple[Any, ...]]: ... # type: ignore[override] + def fetchall_unbuffered(self) -> Iterator[tuple[Any, ...]]: ... + def scroll(self, value: int, mode: str = ...) -> None: ... -class DictCursor(DictCursorMixin, Cursor): ... # type: ignore +class DictCursor(DictCursorMixin, Cursor): ... # type: ignore[misc] -class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore - def fetchall_unbuffered(self) -> Iterator[dict[Text, Any]]: ... # type: ignore +class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore[misc] + def fetchall_unbuffered(self) -> Iterator[dict[str, Any]]: ... # type: ignore[override] diff --git a/stubs/PyMySQL/pymysql/err.pyi b/stubs/PyMySQL/pymysql/err.pyi index 2a13b1d..8aec38f 100644 --- a/stubs/PyMySQL/pymysql/err.pyi +++ b/stubs/PyMySQL/pymysql/err.pyi @@ -1,5 +1,5 @@ import builtins -from typing import NoReturn, Type +from typing import NoReturn from .constants import ER as ER @@ -15,6 +15,6 @@ class InternalError(DatabaseError): ... class ProgrammingError(DatabaseError): ... class NotSupportedError(DatabaseError): ... -error_map: dict[int, Type[DatabaseError]] +error_map: dict[int, type[DatabaseError]] def raise_mysql_exception(data) -> NoReturn: ... diff --git a/stubs/PyScreeze/METADATA.toml b/stubs/PyScreeze/METADATA.toml new file mode 100644 index 0000000..beb02b0 --- /dev/null +++ b/stubs/PyScreeze/METADATA.toml @@ -0,0 +1,5 @@ +version = "0.1.*" +requires = ["types-Pillow"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/PyScreeze/pyscreeze/__init__.pyi b/stubs/PyScreeze/pyscreeze/__init__.pyi new file mode 100644 index 0000000..10bf651 --- /dev/null +++ b/stubs/PyScreeze/pyscreeze/__init__.pyi @@ -0,0 +1,196 @@ +import sys +from _typeshed import Incomplete, StrOrBytesPath +from collections.abc import Callable, Generator +from typing import NamedTuple, SupportsFloat, TypeVar, overload +from typing_extensions import Literal, ParamSpec, SupportsIndex, TypeAlias + +from PIL import Image + +_Unused: TypeAlias = object +_P = ParamSpec("_P") +_R = TypeVar("_R") +# TODO: cv2.Mat is not available as a type yet: https://github.com/microsoft/python-type-stubs/issues/211 +# cv2.Mat is just an alias for a numpy NDArray, but can't import that either. +_Mat: TypeAlias = Incomplete + +useOpenCV: bool +RUNNING_PYTHON_2 = sys.version_info < (3,) +GRAYSCALE_DEFAULT: Literal[False] +USE_IMAGE_NOT_FOUND_EXCEPTION: bool +scrotExists: bool + +class Box(NamedTuple): + left: int + top: int + width: int + height: int + +class Point(NamedTuple): + x: int + y: int + +class RGB(NamedTuple): + red: int + green: int + blue: int + +class PyScreezeException(Exception): ... +class ImageNotFoundException(PyScreezeException): ... + +def requiresPillow(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ... +@overload +def locate( + needleImage: str | Image.Image | _Mat, + haystackImage: str | Image.Image | _Mat, + *, + grayscale: bool | None = ..., + limit: _Unused = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: SupportsFloat | SupportsIndex | str = ..., +) -> Box | None: ... + +# _locateAll_python / _locateAll_pillow +@overload +def locate( + needleImage: str | Image.Image, + haystackImage: str | Image.Image, + *, + grayscale: bool | None = ..., + limit: _Unused = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: None = ..., +) -> Box | None: ... + +# _locateAll_opencv +@overload +def locateOnScreen( + image: str | Image.Image | _Mat, + minSearchTime: float = ..., + *, + grayscale: bool | None = ..., + limit: _Unused = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: SupportsFloat | SupportsIndex | str = ..., +) -> Box | None: ... + +# _locateAll_python / _locateAll_pillow +@overload +def locateOnScreen( + image: str | Image.Image, + minSearchTime: float = ..., + *, + grayscale: bool | None = ..., + limit: _Unused = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: None = ..., +) -> Box | None: ... + +# _locateAll_opencv +@overload +def locateAllOnScreen( + image: str | Image.Image | _Mat, + *, + grayscale: bool | None = ..., + limit: int = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: SupportsFloat | SupportsIndex | str = ..., +) -> Generator[Box, None, None]: ... + +# _locateAll_python / _locateAll_pillow +@overload +def locateAllOnScreen( + image: str | Image.Image, + *, + grayscale: bool | None = ..., + limit: int | None = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: None = ..., +) -> Generator[Box, None, None]: ... + +# _locateAll_opencv +@overload +def locateCenterOnScreen( + image: str | Image.Image | _Mat, + *, + minSearchTime: float, + grayscale: bool | None = ..., + limit: _Unused = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: SupportsFloat | SupportsIndex | str = ..., +) -> Point | None: ... + +# _locateAll_python / _locateAll_pillow +@overload +def locateCenterOnScreen( + image: str | Image.Image, + *, + minSearchTime: float, + grayscale: bool | None = ..., + limit: _Unused = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: None = ..., +) -> Point | None: ... + +# _locateAll_opencv +@overload +def locateOnWindow( + image: str | Image.Image | _Mat, + title: str, + *, + grayscale: bool | None = ..., + limit: _Unused = ..., + step: int = ..., + confidence: SupportsFloat | SupportsIndex | str = ..., +) -> Box | None: ... + +# _locateAll_python / _locateAll_pillow +@overload +def locateOnWindow( + image: str | Image.Image, + title: str, + *, + grayscale: bool | None = ..., + limit: _Unused = ..., + step: int = ..., + confidence: None = ..., +) -> Box | None: ... +def showRegionOnScreen(region: tuple[int, int, int, int], outlineColor: str = ..., filename: str = ...) -> None: ... +def center(coords: tuple[int, int, int, int]) -> Point: ... +def pixelMatchesColor( + x: int, y: int, expectedRGBColor: tuple[int, int, int] | tuple[int, int, int, int], tolerance: int = ... +) -> bool: ... +def pixel(x: int, y: int) -> tuple[int, int, int]: ... +def screenshot(imageFilename: StrOrBytesPath | None = ..., region: tuple[int, int, int, int] | None = ...) -> Image.Image: ... + +grab = screenshot +# _locateAll_opencv +@overload +def locateAll( + needleImage: str | Image.Image | _Mat, + haystackImage: str | Image.Image | _Mat, + grayscale: bool | None = ..., + limit: int = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: SupportsFloat | SupportsIndex | str = ..., +) -> Generator[Box, None, None]: ... + +# _locateAll_python / _locateAll_pillow +@overload +def locateAll( + needleImage: str | Image.Image, + haystackImage: str | Image.Image, + grayscale: bool | None = ..., + limit: int | None = ..., + region: tuple[int, int, int, int] | None = ..., + step: int = ..., + confidence: None = ..., +) -> Generator[Box, None, None]: ... diff --git a/stubs/PyYAML/@tests/stubtest_allowlist.txt b/stubs/PyYAML/@tests/stubtest_allowlist.txt index 65d5a01..abc7ed9 100644 --- a/stubs/PyYAML/@tests/stubtest_allowlist.txt +++ b/stubs/PyYAML/@tests/stubtest_allowlist.txt @@ -1,8 +1,2 @@ -yaml.CBaseDumper.__init__ -yaml.CDumper.__init__ -yaml.CEmitter -yaml.CParser -yaml.YAMLObjectMetaclass.__init__ -yaml.constructor.FullConstructor.set_python_instance_state -yaml.cyaml.CBaseDumper.__init__ -yaml.cyaml.CDumper.__init__ +# yaml._yaml is for backwards compatibility so none of it matters anyway +yaml._yaml.__test__ diff --git a/stubs/PyYAML/METADATA.toml b/stubs/PyYAML/METADATA.toml index c5aa738..5dbca7b 100644 --- a/stubs/PyYAML/METADATA.toml +++ b/stubs/PyYAML/METADATA.toml @@ -1,2 +1,4 @@ -version = "5.4" -python2 = true +version = "6.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 17807a3..04b68a8 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -1,25 +1,24 @@ -import sys -from typing import IO, Any, Callable, Iterable, Iterator, Pattern, Sequence, Text, Type, TypeVar, Union, overload - -from yaml.constructor import BaseConstructor -from yaml.dumper import * # noqa: F403 -from yaml.error import * # noqa: F403 -from yaml.events import * # noqa: F403 -from yaml.loader import * # noqa: F403 -from yaml.nodes import * # noqa: F403 -from yaml.representer import BaseRepresenter -from yaml.resolver import BaseResolver -from yaml.tokens import * # noqa: F403 +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from re import Pattern +from typing import Any, TypeVar, overload +from typing_extensions import TypeAlias from . import resolver as resolver # Help mypy a bit; this is implied by loader and dumper +from .constructor import BaseConstructor from .cyaml import * +from .dumper import * +from .emitter import _WriteStream +from .error import * +from .events import * +from .loader import * +from .nodes import * +from .reader import _ReadStream +from .representer import BaseRepresenter +from .resolver import BaseResolver +from .tokens import * -if sys.version_info >= (3, 0): - _Str = str -else: - _Str = Union[Text, str] -# FIXME: the functions really return py2:unicode/py3:str if encoding is None, otherwise py2:str/py3:bytes. Waiting for python/mypy#5621 -_Yaml = Any +# FIXME: the functions really return str if encoding is None, otherwise bytes. Waiting for python/mypy#5621 +_Yaml: TypeAlias = Any __with_libyaml__: Any __version__: str @@ -28,67 +27,77 @@ _T = TypeVar("_T") _Constructor = TypeVar("_Constructor", bound=BaseConstructor) _Representer = TypeVar("_Representer", bound=BaseRepresenter) +def warnings(settings=...): ... def scan(stream, Loader=...): ... def parse(stream, Loader=...): ... def compose(stream, Loader=...): ... def compose_all(stream, Loader=...): ... -def load(stream: bytes | IO[bytes] | Text | IO[Text], Loader=...) -> Any: ... -def load_all(stream: bytes | IO[bytes] | Text | IO[Text], Loader=...) -> Iterator[Any]: ... -def full_load(stream: bytes | IO[bytes] | Text | IO[Text]) -> Any: ... -def full_load_all(stream: bytes | IO[bytes] | Text | IO[Text]) -> Iterator[Any]: ... -def safe_load(stream: bytes | IO[bytes] | Text | IO[Text]) -> Any: ... -def safe_load_all(stream: bytes | IO[bytes] | Text | IO[Text]) -> Iterator[Any]: ... -def unsafe_load(stream: bytes | IO[bytes] | Text | IO[Text]) -> Any: ... -def unsafe_load_all(stream: bytes | IO[bytes] | Text | IO[Text]) -> Iterator[Any]: ... -def emit(events, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=...): ... +def load(stream: _ReadStream, Loader) -> Any: ... +def load_all(stream: _ReadStream, Loader) -> Iterator[Any]: ... +def full_load(stream: _ReadStream) -> Any: ... +def full_load_all(stream: _ReadStream) -> Iterator[Any]: ... +def safe_load(stream: _ReadStream) -> Any: ... +def safe_load_all(stream: _ReadStream) -> Iterator[Any]: ... +def unsafe_load(stream: _ReadStream) -> Any: ... +def unsafe_load_all(stream: _ReadStream) -> Iterator[Any]: ... +def emit( + events, + stream: _WriteStream[Any] | None = ..., + Dumper=..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., +): ... @overload def serialize_all( nodes, - stream: IO[str], + stream: _WriteStream[Any], Dumper=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., ) -> None: ... @overload def serialize_all( nodes, stream: None = ..., Dumper=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding: _Str | None = ..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., ) -> _Yaml: ... @overload def serialize( node, - stream: IO[str], + stream: _WriteStream[Any], Dumper=..., *, - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., ) -> None: ... @overload def serialize( @@ -96,34 +105,34 @@ def serialize( stream: None = ..., Dumper=..., *, - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding: _Str | None = ..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., ) -> _Yaml: ... @overload def dump_all( documents: Sequence[Any], - stream: IO[str], + stream: _WriteStream[Any], Dumper=..., - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... @overload @@ -131,38 +140,38 @@ def dump_all( documents: Sequence[Any], stream: None = ..., Dumper=..., - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding: _Str | None = ..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> _Yaml: ... @overload def dump( data: Any, - stream: IO[str], + stream: _WriteStream[Any], Dumper=..., *, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... @overload @@ -171,37 +180,37 @@ def dump( stream: None = ..., Dumper=..., *, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding: _Str | None = ..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> _Yaml: ... @overload def safe_dump_all( documents: Sequence[Any], - stream: IO[str], + stream: _WriteStream[Any], *, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... @overload @@ -209,37 +218,37 @@ def safe_dump_all( documents: Sequence[Any], stream: None = ..., *, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding: _Str | None = ..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> _Yaml: ... @overload def safe_dump( data: Any, - stream: IO[str], + stream: _WriteStream[Any], *, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... @overload @@ -247,61 +256,61 @@ def safe_dump( data: Any, stream: None = ..., *, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding: _Str | None = ..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> _Yaml: ... def add_implicit_resolver( - tag: _Str, + tag: str, regexp: Pattern[str], first: Iterable[Any] | None = ..., - Loader: Type[BaseResolver] | None = ..., - Dumper: Type[BaseResolver] = ..., + Loader: type[BaseResolver] | None = ..., + Dumper: type[BaseResolver] = ..., ) -> None: ... def add_path_resolver( - tag: _Str, + tag: str, path: Iterable[Any], - kind: Type[Any] | None = ..., - Loader: Type[BaseResolver] | None = ..., - Dumper: Type[BaseResolver] = ..., + kind: type[Any] | None = ..., + Loader: type[BaseResolver] | None = ..., + Dumper: type[BaseResolver] = ..., ) -> None: ... @overload def add_constructor( - tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = ... + tag: str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = ... ) -> None: ... @overload -def add_constructor(tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor]) -> None: ... +def add_constructor(tag: str, constructor: Callable[[_Constructor, Node], Any], Loader: type[_Constructor]) -> None: ... @overload def add_multi_constructor( - tag_prefix: _Str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, _Str, Node], Any], Loader: None = ... + tag_prefix: str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, str, Node], Any], Loader: None = ... ) -> None: ... @overload def add_multi_constructor( - tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Type[_Constructor] + tag_prefix: str, multi_constructor: Callable[[_Constructor, str, Node], Any], Loader: type[_Constructor] ) -> None: ... @overload -def add_representer(data_type: Type[_T], representer: Callable[[Dumper, _T], Node]) -> None: ... +def add_representer(data_type: type[_T], representer: Callable[[Dumper, _T], Node]) -> None: ... @overload -def add_representer(data_type: Type[_T], representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer]) -> None: ... +def add_representer(data_type: type[_T], representer: Callable[[_Representer, _T], Node], Dumper: type[_Representer]) -> None: ... @overload -def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[Dumper, _T], Node]) -> None: ... +def add_multi_representer(data_type: type[_T], multi_representer: Callable[[Dumper, _T], Node]) -> None: ... @overload def add_multi_representer( - data_type: Type[_T], multi_representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] + data_type: type[_T], multi_representer: Callable[[_Representer, _T], Node], Dumper: type[_Representer] ) -> None: ... class YAMLObjectMetaclass(type): - def __init__(self, name, bases, kwds) -> None: ... + def __init__(cls, name, bases, kwds) -> None: ... class YAMLObject(metaclass=YAMLObjectMetaclass): yaml_loader: Any diff --git a/stubs/PyYAML/yaml/_yaml.pyi b/stubs/PyYAML/yaml/_yaml.pyi new file mode 100644 index 0000000..5eacde5 --- /dev/null +++ b/stubs/PyYAML/yaml/_yaml.pyi @@ -0,0 +1,56 @@ +from _typeshed import SupportsRead +from collections.abc import Mapping, Sequence +from typing import IO, Any + +from .events import Event +from .nodes import Node +from .tokens import Token + +def get_version_string() -> str: ... +def get_version() -> tuple[int, int, int]: ... + +class Mark: + name: Any + index: int + line: int + column: int + buffer: Any + pointer: Any + def __init__(self, name, index: int, line: int, column: int, buffer, pointer) -> None: ... + def get_snippet(self): ... + +class CParser: + def __init__(self, stream: str | bytes | SupportsRead[str | bytes]) -> None: ... + def dispose(self) -> None: ... + def get_token(self) -> Token | None: ... + def peek_token(self) -> Token | None: ... + def check_token(self, *choices) -> bool: ... + def get_event(self) -> Event | None: ... + def peek_event(self) -> Event | None: ... + def check_event(self, *choices) -> bool: ... + def check_node(self) -> bool: ... + def get_node(self) -> Node | None: ... + def get_single_node(self) -> Node | None: ... + def raw_parse(self) -> int: ... + def raw_scan(self) -> int: ... + +class CEmitter: + def __init__( + self, + stream: IO[Any], + canonical: Any | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: Any | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: Any | None = ..., + explicit_end: Any | None = ..., + version: Sequence[int] | None = ..., + tags: Mapping[str, str] | None = ..., + ) -> None: ... + def dispose(self) -> None: ... + def emit(self, event_object) -> None: ... + def open(self) -> None: ... + def close(self) -> None: ... + def serialize(self, node) -> None: ... diff --git a/stubs/PyYAML/yaml/constructor.pyi b/stubs/PyYAML/yaml/constructor.pyi index ef3d48f..a3187c3 100644 --- a/stubs/PyYAML/yaml/constructor.pyi +++ b/stubs/PyYAML/yaml/constructor.pyi @@ -1,10 +1,17 @@ -import sys -from typing import Any, Text, Union +from collections.abc import Callable, Hashable +from datetime import date +from re import Pattern +from typing import Any, ClassVar, TypeVar +from typing_extensions import TypeAlias from yaml.error import MarkedYAMLError -from yaml.nodes import ScalarNode +from yaml.loader import BaseLoader, FullLoader, Loader, SafeLoader, UnsafeLoader +from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode -_Scalar = Union[Text, int, float, bool, None] +_L = TypeVar("_L", bound=Loader | BaseLoader | FullLoader | SafeLoader | UnsafeLoader) +_N = TypeVar("_N", bound=Node) + +_Scalar: TypeAlias = str | int | float | bool | None class ConstructorError(MarkedYAMLError): ... @@ -17,33 +24,35 @@ class BaseConstructor: deep_construct: Any def __init__(self) -> None: ... def check_data(self): ... + def check_state_key(self, key: str) -> None: ... def get_data(self): ... def get_single_data(self) -> Any: ... def construct_document(self, node): ... def construct_object(self, node, deep=...): ... def construct_scalar(self, node: ScalarNode) -> _Scalar: ... - def construct_sequence(self, node, deep=...): ... - def construct_mapping(self, node, deep=...): ... + def construct_sequence(self, node: SequenceNode, deep: bool = ...) -> list[Any]: ... + def construct_mapping(self, node: MappingNode, deep: bool = ...) -> dict[Hashable, Any]: ... def construct_pairs(self, node, deep=...): ... @classmethod - def add_constructor(cls, tag, constructor): ... + # Use typevars so we can have covariant behaviour in the parameter types + def add_constructor(cls, tag: str, constructor: Callable[[_L, _N], Any]) -> None: ... @classmethod def add_multi_constructor(cls, tag_prefix, multi_constructor): ... class SafeConstructor(BaseConstructor): def construct_scalar(self, node: ScalarNode) -> _Scalar: ... - def flatten_mapping(self, node): ... - def construct_mapping(self, node, deep=...): ... - def construct_yaml_null(self, node): ... - bool_values: Any - def construct_yaml_bool(self, node): ... - def construct_yaml_int(self, node): ... - inf_value: Any - nan_value: Any - def construct_yaml_float(self, node): ... - def construct_yaml_binary(self, node): ... - timestamp_regexp: Any - def construct_yaml_timestamp(self, node): ... + def flatten_mapping(self, node: MappingNode) -> None: ... + def construct_mapping(self, node: MappingNode, deep: bool = ...) -> dict[Hashable, Any]: ... + def construct_yaml_null(self, node: ScalarNode) -> None: ... + bool_values: ClassVar[dict[str, bool]] + def construct_yaml_bool(self, node: ScalarNode) -> bool: ... + def construct_yaml_int(self, node: ScalarNode) -> int: ... + inf_value: ClassVar[float] + nan_value: ClassVar[float] + def construct_yaml_float(self, node: ScalarNode) -> float: ... + def construct_yaml_binary(self, node: ScalarNode) -> bytes: ... + timestamp_regexp: ClassVar[Pattern[str]] + def construct_yaml_timestamp(self, node: ScalarNode) -> date: ... def construct_yaml_omap(self, node): ... def construct_yaml_pairs(self, node): ... def construct_yaml_set(self, node): ... @@ -54,6 +63,8 @@ class SafeConstructor(BaseConstructor): def construct_undefined(self, node): ... class FullConstructor(SafeConstructor): + def get_state_keys_blacklist(self) -> list[str]: ... + def get_state_keys_blacklist_regexp(self) -> Pattern[str]: ... def construct_python_str(self, node): ... def construct_python_unicode(self, node): ... def construct_python_bytes(self, node): ... @@ -65,7 +76,7 @@ class FullConstructor(SafeConstructor): def construct_python_name(self, suffix, node): ... def construct_python_module(self, suffix, node): ... def make_python_instance(self, suffix, node, args=..., kwds=..., newobj=..., unsafe=...): ... - def set_python_instance_state(self, instance, state): ... + def set_python_instance_state(self, instance, state, unsafe: bool = ...) -> None: ... def construct_python_object(self, suffix, node): ... def construct_python_object_apply(self, suffix, node, newobj=...): ... def construct_python_object_new(self, suffix, node): ... @@ -86,8 +97,6 @@ class Constructor(SafeConstructor): def find_python_name(self, name, mark): ... def construct_python_name(self, suffix, node): ... def construct_python_module(self, suffix, node): ... - if sys.version_info < (3, 0): - class classobj: ... def make_python_instance(self, suffix, node, args=..., kwds=..., newobj=...): ... def set_python_instance_state(self, instance, state): ... def construct_python_object(self, suffix, node): ... diff --git a/stubs/PyYAML/yaml/cyaml.pyi b/stubs/PyYAML/yaml/cyaml.pyi index 6face45..3fced1d 100644 --- a/stubs/PyYAML/yaml/cyaml.pyi +++ b/stubs/PyYAML/yaml/cyaml.pyi @@ -1,27 +1,16 @@ from _typeshed import SupportsRead -from typing import IO, Any, Mapping, Sequence, Text, Union +from collections.abc import Mapping, Sequence +from typing import IO, Any +from typing_extensions import TypeAlias -from yaml.constructor import BaseConstructor, FullConstructor, SafeConstructor, UnsafeConstructor -from yaml.events import Event -from yaml.nodes import Node -from yaml.representer import BaseRepresenter, SafeRepresenter -from yaml.resolver import BaseResolver, Resolver -from yaml.tokens import Token +from ._yaml import CEmitter, CParser +from .constructor import BaseConstructor, FullConstructor, SafeConstructor, UnsafeConstructor +from .representer import BaseRepresenter, SafeRepresenter +from .resolver import BaseResolver, Resolver -_Readable = SupportsRead[Union[Text, bytes]] +__all__ = ["CBaseLoader", "CSafeLoader", "CFullLoader", "CUnsafeLoader", "CLoader", "CBaseDumper", "CSafeDumper", "CDumper"] -class CParser: - def __init__(self, stream: str | bytes | _Readable) -> None: ... - def dispose(self) -> None: ... - def get_token(self) -> Token | None: ... - def peek_token(self) -> Token | None: ... - def check_token(self, *choices) -> bool: ... - def get_event(self) -> Event | None: ... - def peek_event(self) -> Event | None: ... - def check_event(self, *choices) -> bool: ... - def check_node(self) -> bool: ... - def get_node(self) -> Node | None: ... - def get_single_node(self) -> Node | None: ... +_Readable: TypeAlias = SupportsRead[str | bytes] class CBaseLoader(CParser, BaseConstructor, BaseResolver): def __init__(self, stream: str | bytes | _Readable) -> None: ... @@ -38,40 +27,42 @@ class CFullLoader(CParser, FullConstructor, Resolver): class CUnsafeLoader(CParser, UnsafeConstructor, Resolver): def __init__(self, stream: str | bytes | _Readable) -> None: ... -class CEmitter(object): +class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): def __init__( self, stream: IO[Any], + default_style: str | None = ..., + default_flow_style: bool | None = ..., canonical: Any | None = ..., indent: int | None = ..., width: int | None = ..., allow_unicode: Any | None = ..., line_break: str | None = ..., - encoding: Text | None = ..., + encoding: str | None = ..., explicit_start: Any | None = ..., explicit_end: Any | None = ..., version: Sequence[int] | None = ..., - tags: Mapping[Text, Text] | None = ..., + tags: Mapping[str, str] | None = ..., + sort_keys: bool = ..., ) -> None: ... -class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): +class CDumper(CEmitter, SafeRepresenter, Resolver): def __init__( self, stream: IO[Any], default_style: str | None = ..., - default_flow_style: bool | None = ..., + default_flow_style: bool = ..., canonical: Any | None = ..., indent: int | None = ..., width: int | None = ..., allow_unicode: Any | None = ..., line_break: str | None = ..., - encoding: Text | None = ..., + encoding: str | None = ..., explicit_start: Any | None = ..., explicit_end: Any | None = ..., version: Sequence[int] | None = ..., - tags: Mapping[Text, Text] | None = ..., + tags: Mapping[str, str] | None = ..., + sort_keys: bool = ..., ) -> None: ... -class CDumper(CEmitter, SafeRepresenter, Resolver): ... - CSafeDumper = CDumper diff --git a/stubs/PyYAML/yaml/dumper.pyi b/stubs/PyYAML/yaml/dumper.pyi index b2ca83f..040aa0f 100644 --- a/stubs/PyYAML/yaml/dumper.pyi +++ b/stubs/PyYAML/yaml/dumper.pyi @@ -1,61 +1,66 @@ +from collections.abc import Mapping +from typing import Any + from yaml.emitter import Emitter from yaml.representer import BaseRepresenter, Representer, SafeRepresenter from yaml.resolver import BaseResolver, Resolver from yaml.serializer import Serializer +from .emitter import _WriteStream + class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): def __init__( self, - stream, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + stream: _WriteStream[Any], + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): def __init__( self, - stream, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + stream: _WriteStream[Any], + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... class Dumper(Emitter, Serializer, Representer, Resolver): def __init__( self, - stream, - default_style=..., - default_flow_style=..., - canonical=..., - indent=..., - width=..., - allow_unicode=..., - line_break=..., - encoding=..., - explicit_start=..., - explicit_end=..., - version=..., - tags=..., + stream: _WriteStream[Any], + default_style: str | None = ..., + default_flow_style: bool | None = ..., + canonical: bool | None = ..., + indent: int | None = ..., + width: int | None = ..., + allow_unicode: bool | None = ..., + line_break: str | None = ..., + encoding: str | None = ..., + explicit_start: bool | None = ..., + explicit_end: bool | None = ..., + version: tuple[int, int] | None = ..., + tags: Mapping[str, str] | None = ..., sort_keys: bool = ..., ) -> None: ... diff --git a/stubs/PyYAML/yaml/emitter.pyi b/stubs/PyYAML/yaml/emitter.pyi index 9f44bd7..aaf3b02 100644 --- a/stubs/PyYAML/yaml/emitter.pyi +++ b/stubs/PyYAML/yaml/emitter.pyi @@ -1,7 +1,15 @@ -from typing import Any +from typing import Any, Protocol, TypeVar from yaml.error import YAMLError +_T_contra = TypeVar("_T_contra", str, bytes, contravariant=True) + +class _WriteStream(Protocol[_T_contra]): + def write(self, __data: _T_contra) -> object: ... + # Optional fields: + # encoding: str + # def flush(self) -> object: ... + class EmitterError(YAMLError): ... class ScalarAnalysis: @@ -19,7 +27,7 @@ class ScalarAnalysis: class Emitter: DEFAULT_TAG_PREFIXES: Any - stream: Any + stream: _WriteStream[Any] encoding: Any states: Any state: Any @@ -47,7 +55,9 @@ class Emitter: prepared_tag: Any analysis: Any style: Any - def __init__(self, stream, canonical=..., indent=..., width=..., allow_unicode=..., line_break=...) -> None: ... + def __init__( + self, stream: _WriteStream[Any], canonical=..., indent=..., width=..., allow_unicode=..., line_break=... + ) -> None: ... def dispose(self): ... def emit(self, event): ... def need_more_events(self): ... diff --git a/stubs/PyYAML/yaml/loader.pyi b/stubs/PyYAML/yaml/loader.pyi index 3782cd3..89dea9a 100644 --- a/stubs/PyYAML/yaml/loader.pyi +++ b/stubs/PyYAML/yaml/loader.pyi @@ -5,17 +5,19 @@ from yaml.reader import Reader from yaml.resolver import BaseResolver, Resolver from yaml.scanner import Scanner +from .reader import _ReadStream + class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): - def __init__(self, stream) -> None: ... + def __init__(self, stream: _ReadStream) -> None: ... class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver): - def __init__(self, stream) -> None: ... + def __init__(self, stream: _ReadStream) -> None: ... class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): - def __init__(self, stream) -> None: ... + def __init__(self, stream: _ReadStream) -> None: ... class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): - def __init__(self, stream) -> None: ... + def __init__(self, stream: _ReadStream) -> None: ... class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver): - def __init__(self, stream) -> None: ... + def __init__(self, stream: _ReadStream) -> None: ... diff --git a/stubs/PyYAML/yaml/reader.pyi b/stubs/PyYAML/yaml/reader.pyi index 18c3c7a..01d74cc 100644 --- a/stubs/PyYAML/yaml/reader.pyi +++ b/stubs/PyYAML/yaml/reader.pyi @@ -1,7 +1,11 @@ +from _typeshed import SupportsRead from typing import Any +from typing_extensions import TypeAlias from yaml.error import YAMLError +_ReadStream: TypeAlias = str | bytes | SupportsRead[str] | SupportsRead[bytes] + class ReaderError(YAMLError): name: Any character: Any @@ -12,7 +16,7 @@ class ReaderError(YAMLError): class Reader: name: Any - stream: Any + stream: SupportsRead[str] | SupportsRead[bytes] | None stream_pointer: Any eof: Any buffer: Any @@ -23,7 +27,7 @@ class Reader: index: Any line: Any column: Any - def __init__(self, stream) -> None: ... + def __init__(self, stream: _ReadStream) -> None: ... def peek(self, index=...): ... def prefix(self, length=...): ... def forward(self, length=...): ... diff --git a/stubs/PyYAML/yaml/representer.pyi b/stubs/PyYAML/yaml/representer.pyi index df4e911..f9802d2 100644 --- a/stubs/PyYAML/yaml/representer.pyi +++ b/stubs/PyYAML/yaml/representer.pyi @@ -1,8 +1,8 @@ import datetime -import sys from _typeshed import SupportsItems +from collections.abc import Callable, Iterable, Mapping from types import BuiltinFunctionType, FunctionType, ModuleType -from typing import Any, Callable, ClassVar, Iterable, Mapping, NoReturn, Tuple, Type, TypeVar +from typing import Any, ClassVar, NoReturn, TypeVar from yaml.error import YAMLError as YAMLError from yaml.nodes import MappingNode as MappingNode, Node as Node, ScalarNode as ScalarNode, SequenceNode as SequenceNode @@ -13,8 +13,8 @@ _R = TypeVar("_R", bound=BaseRepresenter) class RepresenterError(YAMLError): ... class BaseRepresenter: - yaml_representers: ClassVar[dict[Type[Any], Callable[[BaseRepresenter, Any], Node]]] - yaml_multi_representers: ClassVar[dict[Type[Any], Callable[[BaseRepresenter, Any], Node]]] + yaml_representers: ClassVar[dict[type[Any], Callable[[BaseRepresenter, Any], Node]]] + yaml_multi_representers: ClassVar[dict[type[Any], Callable[[BaseRepresenter, Any], Node]]] default_style: str | Any sort_keys: bool default_flow_style: bool @@ -24,16 +24,14 @@ class BaseRepresenter: def __init__(self, default_style: str | None = ..., default_flow_style: bool = ..., sort_keys: bool = ...) -> None: ... def represent(self, data) -> None: ... def represent_data(self, data) -> Node: ... - if sys.version_info < (3, 0): - def get_classobj_bases(self, cls): ... @classmethod - def add_representer(cls: Type[_R], data_type: Type[_T], representer: Callable[[_R, _T], Node]) -> None: ... + def add_representer(cls: type[_R], data_type: type[_T], representer: Callable[[_R, _T], Node]) -> None: ... @classmethod - def add_multi_representer(cls: Type[_R], data_type: Type[_T], representer: Callable[[_R, _T], Node]) -> None: ... + def add_multi_representer(cls: type[_R], data_type: type[_T], representer: Callable[[_R, _T], Node]) -> None: ... def represent_scalar(self, tag: str, value, style: str | None = ...) -> ScalarNode: ... def represent_sequence(self, tag: str, sequence: Iterable[Any], flow_style: bool | None = ...) -> SequenceNode: ... def represent_mapping( - self, tag: str, mapping: SupportsItems[Any, Any] | Iterable[Tuple[Any, Any]], flow_style: bool | None = ... + self, tag: str, mapping: SupportsItems[Any, Any] | Iterable[tuple[Any, Any]], flow_style: bool | None = ... ) -> MappingNode: ... def ignore_aliases(self, data) -> bool: ... @@ -42,15 +40,12 @@ class SafeRepresenter(BaseRepresenter): def ignore_aliases(self, data) -> bool: ... def represent_none(self, data) -> ScalarNode: ... def represent_str(self, data: str) -> ScalarNode: ... - if sys.version_info < (3, 0): - def represent_unicode(self, data): ... - def represent_long(self, data): ... def represent_binary(self, data: bytes) -> ScalarNode: ... def represent_bool(self, data: bool) -> ScalarNode: ... def represent_int(self, data: int) -> ScalarNode: ... def represent_float(self, data: float) -> ScalarNode: ... def represent_list(self, data: Iterable[Any]) -> SequenceNode: ... - def represent_dict(self, data: SupportsItems[Any, Any] | Iterable[Tuple[Any, Any]]) -> MappingNode: ... + def represent_dict(self, data: SupportsItems[Any, Any] | Iterable[tuple[Any, Any]]) -> MappingNode: ... def represent_set(self, data: Iterable[Any]) -> MappingNode: ... def represent_date(self, data: datetime.date) -> ScalarNode: ... def represent_datetime(self, data: datetime.datetime) -> ScalarNode: ... @@ -58,10 +53,6 @@ class SafeRepresenter(BaseRepresenter): def represent_undefined(self, data) -> NoReturn: ... class Representer(SafeRepresenter): - if sys.version_info < (3, 0): - def represent_unicode(self, data): ... - def represent_long(self, data): ... - def represent_instance(self, data): ... def represent_complex(self, data: complex) -> ScalarNode: ... def represent_tuple(self, data: Iterable[Any]) -> SequenceNode: ... def represent_name(self, data: BuiltinFunctionType | FunctionType) -> ScalarNode: ... diff --git a/stubs/PyYAML/yaml/serializer.pyi b/stubs/PyYAML/yaml/serializer.pyi index 8b85e3e..0c51590 100644 --- a/stubs/PyYAML/yaml/serializer.pyi +++ b/stubs/PyYAML/yaml/serializer.pyi @@ -1,6 +1,7 @@ from typing import Any from yaml.error import YAMLError +from yaml.nodes import Node class SerializerError(YAMLError): ... @@ -16,9 +17,9 @@ class Serializer: last_anchor_id: Any closed: Any def __init__(self, encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... - def open(self): ... - def close(self): ... - def serialize(self, node): ... + def open(self) -> None: ... + def close(self) -> None: ... + def serialize(self, node: Node) -> None: ... def anchor_node(self, node): ... def generate_anchor(self, node): ... def serialize_node(self, node, parent, index): ... diff --git a/stubs/Pygments/@tests/stubtest_allowlist.txt b/stubs/Pygments/@tests/stubtest_allowlist.txt index 00d6b1e..f72c29a 100644 --- a/stubs/Pygments/@tests/stubtest_allowlist.txt +++ b/stubs/Pygments/@tests/stubtest_allowlist.txt @@ -5,8 +5,5 @@ pygments.style.StyleMeta.__new__ # Defined in lexer classes, intended to be used as static method, but doesn't use @staticmethod pygments.lexer.LexerMeta.analyse_text -# Inheriting from tuple seems to do something weird -pygments.token.Number -pygments.token.String -pygments.token.Token -pygments.token.Whitespace +# Inheriting from tuple is weird +pygments.token._TokenType.__init__ diff --git a/stubs/Pygments/METADATA.toml b/stubs/Pygments/METADATA.toml index efa8f9f..5e1cb88 100644 --- a/stubs/Pygments/METADATA.toml +++ b/stubs/Pygments/METADATA.toml @@ -1,2 +1,2 @@ -version = "2.9" -requires = ["types-docutils"] +version = "2.13.*" +requires = ["types-docutils", "types-setuptools"] diff --git a/stubs/Pygments/pygments/__init__.pyi b/stubs/Pygments/pygments/__init__.pyi index 1b05e27..59c06c2 100644 --- a/stubs/Pygments/pygments/__init__.pyi +++ b/stubs/Pygments/pygments/__init__.pyi @@ -1,5 +1,19 @@ -from typing import Any +from _typeshed import SupportsWrite +from typing import TypeVar, overload + +from pygments.formatter import Formatter + +_T = TypeVar("_T", str, bytes) + +__version__: str +__all__ = ["lex", "format", "highlight"] def lex(code, lexer): ... -def format(tokens, formatter, outfile: Any | None = ...): ... -def highlight(code, lexer, formatter, outfile: Any | None = ...): ... +@overload +def format(tokens, formatter: Formatter[_T], outfile: SupportsWrite[_T]) -> None: ... +@overload +def format(tokens, formatter: Formatter[_T], outfile: None = ...) -> _T: ... +@overload +def highlight(code, lexer, formatter: Formatter[_T], outfile: SupportsWrite[_T]) -> None: ... +@overload +def highlight(code, lexer, formatter: Formatter[_T], outfile: None = ...) -> _T: ... diff --git a/stubs/Pygments/pygments/filters/__init__.pyi b/stubs/Pygments/pygments/filters/__init__.pyi index 15f60f4..05325c8 100644 --- a/stubs/Pygments/pygments/filters/__init__.pyi +++ b/stubs/Pygments/pygments/filters/__init__.pyi @@ -1,4 +1,4 @@ -from collections.abc import Iterable, Iterator +from collections.abc import Generator, Iterable, Iterator from typing import Any from pygments.filter import Filter @@ -7,7 +7,7 @@ from pygments.token import _TokenType def find_filter_class(filtername): ... def get_filter_by_name(filtername, **options): ... -def get_all_filters(): ... +def get_all_filters() -> Generator[str, None, None]: ... class CodeTagFilter(Filter): tag_re: Any diff --git a/stubs/Pygments/pygments/formatter.pyi b/stubs/Pygments/pygments/formatter.pyi index 1fbf82f..f441d48 100644 --- a/stubs/Pygments/pygments/formatter.pyi +++ b/stubs/Pygments/pygments/formatter.pyi @@ -1,6 +1,8 @@ -from typing import Any +from typing import Any, Generic, TypeVar, overload -class Formatter: +_T = TypeVar("_T", str, bytes) + +class Formatter(Generic[_T]): name: Any aliases: Any filenames: Any @@ -10,6 +12,11 @@ class Formatter: title: Any encoding: Any options: Any - def __init__(self, **options) -> None: ... + @overload + def __init__(self: Formatter[str], *, encoding: None = ..., outencoding: None = ..., **options) -> None: ... + @overload + def __init__(self: Formatter[bytes], *, encoding: str, outencoding: None = ..., **options) -> None: ... + @overload + def __init__(self: Formatter[bytes], *, encoding: None = ..., outencoding: str, **options) -> None: ... def get_style_defs(self, arg: str = ...): ... def format(self, tokensource, outfile): ... diff --git a/stubs/Pygments/pygments/formatters/__init__.pyi b/stubs/Pygments/pygments/formatters/__init__.pyi index 0dd9f28..217aa9e 100644 --- a/stubs/Pygments/pygments/formatters/__init__.pyi +++ b/stubs/Pygments/pygments/formatters/__init__.pyi @@ -1,3 +1,7 @@ +from collections.abc import Generator +from typing import Any + +from ..formatter import Formatter from .bbcode import BBCodeFormatter as BBCodeFormatter from .html import HtmlFormatter as HtmlFormatter from .img import ( @@ -15,7 +19,7 @@ from .svg import SvgFormatter as SvgFormatter from .terminal import TerminalFormatter as TerminalFormatter from .terminal256 import Terminal256Formatter as Terminal256Formatter, TerminalTrueColorFormatter as TerminalTrueColorFormatter -def get_all_formatters() -> None: ... +def get_all_formatters() -> Generator[type[Formatter[Any]], None, None]: ... def get_formatter_by_name(_alias, **options): ... def load_formatter_from_file(filename, formattername: str = ..., **options): ... def get_formatter_for_filename(fn, **options): ... diff --git a/stubs/Pygments/pygments/formatters/bbcode.pyi b/stubs/Pygments/pygments/formatters/bbcode.pyi index 332c6c1..df1708b 100644 --- a/stubs/Pygments/pygments/formatters/bbcode.pyi +++ b/stubs/Pygments/pygments/formatters/bbcode.pyi @@ -1,11 +1,12 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class BBCodeFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class BBCodeFormatter(Formatter[_T]): name: str aliases: Any filenames: Any styles: Any - def __init__(self, **options) -> None: ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/html.pyi b/stubs/Pygments/pygments/formatters/html.pyi index ba3d069..b04ca1e 100644 --- a/stubs/Pygments/pygments/formatters/html.pyi +++ b/stubs/Pygments/pygments/formatters/html.pyi @@ -1,8 +1,10 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class HtmlFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class HtmlFormatter(Formatter[_T]): name: str aliases: Any filenames: Any @@ -30,11 +32,10 @@ class HtmlFormatter(Formatter): linespans: Any anchorlinenos: Any hl_lines: Any - def __init__(self, **options) -> None: ... def get_style_defs(self, arg: Any | None = ...): ... def get_token_style_defs(self, arg: Any | None = ...): ... def get_background_style_defs(self, arg: Any | None = ...): ... def get_linenos_style_defs(self): ... def get_css_prefix(self, arg): ... - def wrap(self, source, outfile): ... + def wrap(self, source): ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/img.pyi b/stubs/Pygments/pygments/formatters/img.pyi index 06b50ae..255dc80 100644 --- a/stubs/Pygments/pygments/formatters/img.pyi +++ b/stubs/Pygments/pygments/formatters/img.pyi @@ -1,7 +1,9 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter +_T = TypeVar("_T", str, bytes) + class PilNotAvailable(ImportError): ... class FontNotFound(Exception): ... @@ -15,7 +17,7 @@ class FontManager: def get_text_size(self, text): ... def get_font(self, bold, oblique): ... -class ImageFormatter(Formatter): +class ImageFormatter(Formatter[_T]): name: str aliases: Any filenames: Any @@ -42,23 +44,22 @@ class ImageFormatter(Formatter): hl_lines: Any hl_color: Any drawables: Any - def __init__(self, **options) -> None: ... def get_style_defs(self, arg: str = ...) -> None: ... def format(self, tokensource, outfile) -> None: ... -class GifImageFormatter(ImageFormatter): +class GifImageFormatter(ImageFormatter[_T]): name: str aliases: Any filenames: Any default_image_format: str -class JpgImageFormatter(ImageFormatter): +class JpgImageFormatter(ImageFormatter[_T]): name: str aliases: Any filenames: Any default_image_format: str -class BmpImageFormatter(ImageFormatter): +class BmpImageFormatter(ImageFormatter[_T]): name: str aliases: Any filenames: Any diff --git a/stubs/Pygments/pygments/formatters/irc.pyi b/stubs/Pygments/pygments/formatters/irc.pyi index b8bedfd..7af728d 100644 --- a/stubs/Pygments/pygments/formatters/irc.pyi +++ b/stubs/Pygments/pygments/formatters/irc.pyi @@ -1,13 +1,14 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class IRCFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class IRCFormatter(Formatter[_T]): name: str aliases: Any filenames: Any darkbg: Any colorscheme: Any linenos: Any - def __init__(self, **options) -> None: ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/latex.pyi b/stubs/Pygments/pygments/formatters/latex.pyi index a321c7b..8314743 100644 --- a/stubs/Pygments/pygments/formatters/latex.pyi +++ b/stubs/Pygments/pygments/formatters/latex.pyi @@ -1,9 +1,11 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter from pygments.lexer import Lexer -class LatexFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class LatexFormatter(Formatter[_T]): name: str aliases: Any filenames: Any @@ -21,7 +23,6 @@ class LatexFormatter(Formatter): left: Any right: Any envname: Any - def __init__(self, **options) -> None: ... def get_style_defs(self, arg: str = ...): ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/other.pyi b/stubs/Pygments/pygments/formatters/other.pyi index 222ab05..e02007b 100644 --- a/stubs/Pygments/pygments/formatters/other.pyi +++ b/stubs/Pygments/pygments/formatters/other.pyi @@ -1,14 +1,16 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class NullFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class NullFormatter(Formatter[_T]): name: str aliases: Any filenames: Any def format(self, tokensource, outfile) -> None: ... -class RawTokenFormatter(Formatter): +class RawTokenFormatter(Formatter[_T]): name: str aliases: Any filenames: Any @@ -16,11 +18,9 @@ class RawTokenFormatter(Formatter): encoding: str compress: Any error_color: Any - def __init__(self, **options) -> None: ... def format(self, tokensource, outfile) -> None: ... -class TestcaseFormatter(Formatter): +class TestcaseFormatter(Formatter[_T]): name: str aliases: Any - def __init__(self, **options) -> None: ... def format(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/pangomarkup.pyi b/stubs/Pygments/pygments/formatters/pangomarkup.pyi index c72b9fd..d266bbe 100644 --- a/stubs/Pygments/pygments/formatters/pangomarkup.pyi +++ b/stubs/Pygments/pygments/formatters/pangomarkup.pyi @@ -1,11 +1,12 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class PangoMarkupFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class PangoMarkupFormatter(Formatter[_T]): name: str aliases: Any filenames: Any styles: Any - def __init__(self, **options) -> None: ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/rtf.pyi b/stubs/Pygments/pygments/formatters/rtf.pyi index 2dcffc6..900f43d 100644 --- a/stubs/Pygments/pygments/formatters/rtf.pyi +++ b/stubs/Pygments/pygments/formatters/rtf.pyi @@ -1,12 +1,13 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class RtfFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class RtfFormatter(Formatter[_T]): name: str aliases: Any filenames: Any fontface: Any fontsize: Any - def __init__(self, **options) -> None: ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/svg.pyi b/stubs/Pygments/pygments/formatters/svg.pyi index 8dd0402..f349157 100644 --- a/stubs/Pygments/pygments/formatters/svg.pyi +++ b/stubs/Pygments/pygments/formatters/svg.pyi @@ -1,8 +1,10 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class SvgFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class SvgFormatter(Formatter[_T]): name: str aliases: Any filenames: Any @@ -17,5 +19,4 @@ class SvgFormatter(Formatter): linenostart: Any linenostep: Any linenowidth: Any - def __init__(self, **options) -> None: ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/terminal.pyi b/stubs/Pygments/pygments/formatters/terminal.pyi index 92b2c8b..7448f17 100644 --- a/stubs/Pygments/pygments/formatters/terminal.pyi +++ b/stubs/Pygments/pygments/formatters/terminal.pyi @@ -1,14 +1,15 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter -class TerminalFormatter(Formatter): +_T = TypeVar("_T", str, bytes) + +class TerminalFormatter(Formatter[_T]): name: str aliases: Any filenames: Any darkbg: Any colorscheme: Any linenos: Any - def __init__(self, **options) -> None: ... def format(self, tokensource, outfile): ... def format_unencoded(self, tokensource, outfile) -> None: ... diff --git a/stubs/Pygments/pygments/formatters/terminal256.pyi b/stubs/Pygments/pygments/formatters/terminal256.pyi index 55786c4..69f30cc 100644 --- a/stubs/Pygments/pygments/formatters/terminal256.pyi +++ b/stubs/Pygments/pygments/formatters/terminal256.pyi @@ -1,7 +1,9 @@ -from typing import Any +from typing import Any, TypeVar from pygments.formatter import Formatter +_T = TypeVar("_T", str, bytes) + class EscapeSequence: fg: Any bg: Any @@ -16,7 +18,7 @@ class EscapeSequence: def true_color_string(self): ... def reset_string(self): ... -class Terminal256Formatter(Formatter): +class Terminal256Formatter(Formatter[_T]): name: str aliases: Any filenames: Any @@ -27,11 +29,10 @@ class Terminal256Formatter(Formatter): useunderline: Any useitalic: Any linenos: Any - def __init__(self, **options) -> None: ... def format(self, tokensource, outfile): ... def format_unencoded(self, tokensource, outfile) -> None: ... -class TerminalTrueColorFormatter(Terminal256Formatter): +class TerminalTrueColorFormatter(Terminal256Formatter[_T]): name: str aliases: Any filenames: Any diff --git a/stubs/Pygments/pygments/lexer.pyi b/stubs/Pygments/pygments/lexer.pyi index 979d822..6267deb 100644 --- a/stubs/Pygments/pygments/lexer.pyi +++ b/stubs/Pygments/pygments/lexer.pyi @@ -1,5 +1,5 @@ from collections.abc import Iterable, Iterator, Sequence -from typing import Any, Tuple +from typing import Any from pygments.token import _TokenType from pygments.util import Future @@ -40,7 +40,7 @@ class _inherit: ... inherit: Any -class combined(Tuple[Any]): +class combined(tuple[Any, ...]): def __new__(cls, *args): ... def __init__(self, *args) -> None: ... @@ -89,7 +89,9 @@ class LexerContext: def __init__(self, text, pos, stack: Any | None = ..., end: Any | None = ...) -> None: ... class ExtendedRegexLexer(RegexLexer): - def get_tokens_unprocessed(self, text: str | None = ..., context: LexerContext | None = ...) -> Iterator[tuple[int, _TokenType, str]]: ... # type: ignore + def get_tokens_unprocessed( # type: ignore[override] + self, text: str | None = ..., context: LexerContext | None = ... + ) -> Iterator[tuple[int, _TokenType, str]]: ... class ProfilingRegexLexerMeta(RegexLexerMeta): ... diff --git a/stubs/Pygments/pygments/lexers/__init__.pyi b/stubs/Pygments/pygments/lexers/__init__.pyi index 23a2966..5d04371 100644 --- a/stubs/Pygments/pygments/lexers/__init__.pyi +++ b/stubs/Pygments/pygments/lexers/__init__.pyi @@ -1,13 +1,13 @@ -from _typeshed import StrOrBytesPath, StrPath +from _typeshed import Incomplete, StrOrBytesPath, StrPath from collections.abc import Iterator -from typing import Any, Tuple, Union +from typing import Any +from typing_extensions import TypeAlias from pygments.lexer import Lexer, LexerMeta -_OpenFile = Union[StrOrBytesPath, int] # copy/pasted from builtins.pyi +_OpenFile: TypeAlias = StrOrBytesPath | int # copy/pasted from builtins.pyi -# TODO: use lower-case tuple once mypy updated -def get_all_lexers() -> Iterator[tuple[str, Tuple[str, ...], Tuple[str, ...], Tuple[str, ...]]]: ... +def get_all_lexers(plugins: bool = ...) -> Iterator[tuple[str, tuple[str, ...], tuple[str, ...], tuple[str, ...]]]: ... def find_lexer_class(name: str) -> LexerMeta | None: ... def find_lexer_class_by_name(_alias: str) -> LexerMeta: ... def get_lexer_by_name(_alias: str, **options: Any) -> Lexer: ... @@ -15,8 +15,8 @@ def load_lexer_from_file(filename: _OpenFile, lexername: str = ..., **options: A def find_lexer_class_for_filename(_fn: StrPath, code: str | bytes | None = ...) -> LexerMeta | None: ... def get_lexer_for_filename(_fn: StrPath, code: str | bytes | None = ..., **options: Any) -> Lexer: ... def get_lexer_for_mimetype(_mime: str, **options: Any) -> Lexer: ... -def guess_lexer_for_filename(_fn: StrPath, _text: str, **options: Any) -> LexerMeta | None: ... +def guess_lexer_for_filename(_fn: StrPath, _text: str, **options: Any) -> LexerMeta: ... def guess_lexer(_text: str | bytes, **options: Any) -> Lexer: ... # Having every lexer class here doesn't seem to be worth it -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/Pygments/pygments/plugin.pyi b/stubs/Pygments/pygments/plugin.pyi index e2115ee..308e219 100644 --- a/stubs/Pygments/pygments/plugin.pyi +++ b/stubs/Pygments/pygments/plugin.pyi @@ -1,10 +1,19 @@ +from collections.abc import Generator, Iterable +from typing import Any + +from pkg_resources import EntryPoint +from pygments.filter import Filter +from pygments.formatter import Formatter +from pygments.lexer import Lexer +from pygments.style import Style + LEXER_ENTRY_POINT: str FORMATTER_ENTRY_POINT: str STYLE_ENTRY_POINT: str FILTER_ENTRY_POINT: str -def iter_entry_points(group_name): ... -def find_plugin_lexers() -> None: ... -def find_plugin_formatters() -> None: ... -def find_plugin_styles() -> None: ... -def find_plugin_filters() -> None: ... +def iter_entry_points(group_name: str) -> Iterable[EntryPoint]: ... +def find_plugin_lexers() -> Generator[type[Lexer], None, None]: ... +def find_plugin_formatters() -> Generator[tuple[str, type[Formatter[Any]]], None, None]: ... +def find_plugin_styles() -> Generator[tuple[str, type[Style]], None, None]: ... +def find_plugin_filters() -> Generator[tuple[str, type[Filter]], None, None]: ... diff --git a/stubs/Pygments/pygments/style.pyi b/stubs/Pygments/pygments/style.pyi index 7b4cc56..97ff2ff 100644 --- a/stubs/Pygments/pygments/style.pyi +++ b/stubs/Pygments/pygments/style.pyi @@ -1,9 +1,9 @@ -from collections.abc import Iterator, Mapping, Set +from collections.abc import Iterator, Mapping, Set as AbstractSet from typing_extensions import TypedDict from pygments.token import _TokenType -ansicolors: Set[str] # not intended to be mutable +ansicolors: AbstractSet[str] # not intended to be mutable class _StyleDict(TypedDict): color: str | None diff --git a/stubs/Pygments/pygments/styles/__init__.pyi b/stubs/Pygments/pygments/styles/__init__.pyi index 842f507..18906e4 100644 --- a/stubs/Pygments/pygments/styles/__init__.pyi +++ b/stubs/Pygments/pygments/styles/__init__.pyi @@ -1,5 +1,5 @@ +from _typeshed import Incomplete from collections.abc import Iterator, Mapping -from typing import Any from pygments.style import StyleMeta from pygments.util import ClassNotFound as ClassNotFound @@ -10,4 +10,4 @@ def get_style_by_name(name) -> StyleMeta: ... def get_all_styles() -> Iterator[str]: ... # Having every style class here doesn't seem to be worth it -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/Pygments/pygments/token.pyi b/stubs/Pygments/pygments/token.pyi index b428132..9fb24b7 100644 --- a/stubs/Pygments/pygments/token.pyi +++ b/stubs/Pygments/pygments/token.pyi @@ -1,15 +1,15 @@ +from _typeshed import Self from collections.abc import Mapping -from typing import Tuple +from typing import Any -class _TokenType(Tuple[str]): # TODO: change to lower-case tuple once new mypy released +class _TokenType(tuple[str, ...]): parent: _TokenType | None def split(self) -> list[_TokenType]: ... subtypes: set[_TokenType] - def __init__(self, *args: str) -> None: ... - def __contains__(self, val: _TokenType) -> bool: ... # type: ignore + def __contains__(self, val: _TokenType) -> bool: ... # type: ignore[override] def __getattr__(self, name: str) -> _TokenType: ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self, memo: Any) -> Self: ... Token: _TokenType Text: _TokenType diff --git a/stubs/SQLAlchemy/@tests/stubtest_allowlist.txt b/stubs/SQLAlchemy/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..4d6eb0a --- /dev/null +++ b/stubs/SQLAlchemy/@tests/stubtest_allowlist.txt @@ -0,0 +1,145 @@ +# wrong argument name in implementation ("self" instead of "cls") +sqlalchemy.engine.URL.__new__ +sqlalchemy.engine.url.URL.__new__ +sqlalchemy.util.langhelpers._symbol.__new__ + +# unnecessary re-exports +sqlalchemy.util._collections.* +sqlalchemy.util.compat.* + +# forwards arguments to another function +sqlalchemy.ext.declarative.as_declarative + +# stdlib re-exports with stubtest issues +sqlalchemy.orm.collections.InstrumentedList.* +sqlalchemy.orm.collections.InstrumentedSet.* +sqlalchemy.orm.collections.MappedCollection.* +sqlalchemy.util.StringIO.* + +# method arguments starting with double underscores in the implementation +sqlalchemy.testing.resolve_lambda +sqlalchemy.testing.util.resolve_lambda +sqlalchemy.util.WeakSequence.__init__ + +# not always present +sqlalchemy.engine.Engine.logging_name # initialized if not None +sqlalchemy.engine.base.Engine.logging_name # initialized if not None +sqlalchemy.testing.util.non_refcount_gc_collect + +# replaced at runtime +sqlalchemy.orm.strategy_options.contains_eager +sqlalchemy.orm.strategy_options.load_only +sqlalchemy.orm.strategy_options.joinedload +sqlalchemy.orm.strategy_options.subqueryload +sqlalchemy.orm.strategy_options.selectinload +sqlalchemy.orm.strategy_options.lazyload +sqlalchemy.orm.strategy_options.immediateload +sqlalchemy.orm.strategy_options.noload +sqlalchemy.orm.strategy_options.raiseload +sqlalchemy.orm.strategy_options.defaultload +sqlalchemy.orm.strategy_options.defer +sqlalchemy.orm.strategy_options.undefer +sqlalchemy.orm.strategy_options.undefer_group +sqlalchemy.orm.strategy_options.with_expression +sqlalchemy.orm.strategy_options.selectin_polymorphic +sqlalchemy.testing.provision.configure_follower +sqlalchemy.testing.provision.create_db +sqlalchemy.testing.provision.drop_all_schema_objects_post_tables +sqlalchemy.testing.provision.drop_all_schema_objects_pre_tables +sqlalchemy.testing.provision.drop_db +sqlalchemy.testing.provision.follower_url_from_main +sqlalchemy.testing.provision.generate_driver_url +sqlalchemy.testing.provision.get_temp_table_name +sqlalchemy.testing.provision.post_configure_engine +sqlalchemy.testing.provision.prepare_for_drop_tables +sqlalchemy.testing.provision.run_reap_dbs +sqlalchemy.testing.provision.set_default_schema_on_connection +sqlalchemy.testing.provision.stop_test_class_outside_fixtures +sqlalchemy.testing.provision.temp_table_keyword_args +sqlalchemy.testing.provision.update_db_opts + +# requires other packages +sqlalchemy.testing.plugin.pytestplugin + +# can't be imported +sqlalchemy.testing.fixtures +sqlalchemy.testing.pickleable +sqlalchemy.testing.plugin.bootstrap + +# Initialized to bool during __init__() +sqlalchemy.orm.Mapper.single +sqlalchemy.orm.mapper.Mapper.single + +# Dynamically added methods where the first argument is not named "self" +sqlalchemy.orm.Load.contains_eager +sqlalchemy.orm.Load.defaultload +sqlalchemy.orm.Load.defer +sqlalchemy.orm.Load.immediateload +sqlalchemy.orm.Load.joinedload +sqlalchemy.orm.Load.lazyload +sqlalchemy.orm.Load.load_only +sqlalchemy.orm.Load.noload +sqlalchemy.orm.Load.raiseload +sqlalchemy.orm.Load.selectin_polymorphic +sqlalchemy.orm.Load.selectinload +sqlalchemy.orm.Load.subqueryload +sqlalchemy.orm.Load.undefer +sqlalchemy.orm.Load.undefer_group +sqlalchemy.orm.Load.with_expression +sqlalchemy.orm.strategy_options.Load.contains_eager +sqlalchemy.orm.strategy_options.Load.defaultload +sqlalchemy.orm.strategy_options.Load.defer +sqlalchemy.orm.strategy_options.Load.immediateload +sqlalchemy.orm.strategy_options.Load.joinedload +sqlalchemy.orm.strategy_options.Load.lazyload +sqlalchemy.orm.strategy_options.Load.load_only +sqlalchemy.orm.strategy_options.Load.noload +sqlalchemy.orm.strategy_options.Load.raiseload +sqlalchemy.orm.strategy_options.Load.selectin_polymorphic +sqlalchemy.orm.strategy_options.Load.selectinload +sqlalchemy.orm.strategy_options.Load.subqueryload +sqlalchemy.orm.strategy_options.Load.undefer +sqlalchemy.orm.strategy_options.Load.undefer_group +sqlalchemy.orm.strategy_options.Load.with_expression + +# abstract fields not present at runtime +sqlalchemy.engine.Transaction.connection +sqlalchemy.engine.Transaction.is_active +sqlalchemy.engine.base.Transaction.connection +sqlalchemy.engine.base.Transaction.is_active + +# initialized to None during class construction, but overridden during __init__() +sqlalchemy.engine.Connection.engine +sqlalchemy.engine.base.Connection.engine + +# uses @memoized_property at runtime, but we use @property for compatibility +sqlalchemy.engine.URL.normalized_query +sqlalchemy.engine.url.URL.normalized_query + +# runtime has extra internal arguments that are inconsistent across micro versions +sqlalchemy.testing.engines.testing_engine + +# __new__ signature conflicts with __init__ signature (which is more precise), +# so __new__ is deliberately omitted in the stub +sqlalchemy.sql.annotation.Annotated.__new__ + +# At runtime __new__ is defined, but we define __init__ in the stub +# because otherwise all subclasses would be identified by pyright +# as having conflicting __new__/__init__ methods +sqlalchemy.orm.unitofwork.PostSortRec.__new__ + +# unclear problems +sqlalchemy.sql.elements.quoted_name.lower +sqlalchemy.sql.elements.quoted_name.upper +sqlalchemy.sql.expression.quoted_name.lower +sqlalchemy.sql.expression.quoted_name.upper +sqlalchemy.sql.quoted_name.lower +sqlalchemy.sql.quoted_name.upper +sqlalchemy.util.callable + +sqlalchemy.dialects.mssql.base.MSExecutionContext.get_result_cursor_strategy +sqlalchemy.dialects.postgresql.base.PGDDLCompiler.visit_foreign_key_constraint +sqlalchemy.engine.ExecutionContext.get_result_cursor_strategy +sqlalchemy.engine.interfaces.ExecutionContext.get_result_cursor_strategy +sqlalchemy.orm.ColumnProperty.Comparator.__clause_element__ +sqlalchemy.orm.properties.ColumnProperty.Comparator.__clause_element__ diff --git a/stubs/SQLAlchemy/METADATA.toml b/stubs/SQLAlchemy/METADATA.toml new file mode 100644 index 0000000..575580d --- /dev/null +++ b/stubs/SQLAlchemy/METADATA.toml @@ -0,0 +1,5 @@ +version = "1.4.43" +extra_description = """\ + The `sqlalchemy-stubs` package is an alternative to this package and also \ + includes a mypy plugin for more precise types.\ +""" diff --git a/stubs/SQLAlchemy/sqlalchemy/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/__init__.pyi new file mode 100644 index 0000000..dde3cbc --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/__init__.pyi @@ -0,0 +1,133 @@ +from .engine import ( + create_engine as create_engine, + create_mock_engine as create_mock_engine, + engine_from_config as engine_from_config, +) +from .inspection import inspect as inspect +from .schema import ( + BLANK_SCHEMA as BLANK_SCHEMA, + DDL as DDL, + CheckConstraint as CheckConstraint, + Column as Column, + ColumnDefault as ColumnDefault, + Computed as Computed, + Constraint as Constraint, + DefaultClause as DefaultClause, + FetchedValue as FetchedValue, + ForeignKey as ForeignKey, + ForeignKeyConstraint as ForeignKeyConstraint, + Identity as Identity, + Index as Index, + MetaData as MetaData, + PrimaryKeyConstraint as PrimaryKeyConstraint, + Sequence as Sequence, + Table as Table, + ThreadLocalMetaData as ThreadLocalMetaData, + UniqueConstraint as UniqueConstraint, +) +from .sql import ( + LABEL_STYLE_DEFAULT as LABEL_STYLE_DEFAULT, + LABEL_STYLE_DISAMBIGUATE_ONLY as LABEL_STYLE_DISAMBIGUATE_ONLY, + LABEL_STYLE_NONE as LABEL_STYLE_NONE, + LABEL_STYLE_TABLENAME_PLUS_COL as LABEL_STYLE_TABLENAME_PLUS_COL, + alias as alias, + all_ as all_, + and_ as and_, + any_ as any_, + asc as asc, + between as between, + bindparam as bindparam, + case as case, + cast as cast, + collate as collate, + column as column, + delete as delete, + desc as desc, + distinct as distinct, + except_ as except_, + except_all as except_all, + exists as exists, + extract as extract, + false as false, + func as func, + funcfilter as funcfilter, + insert as insert, + intersect as intersect, + intersect_all as intersect_all, + join as join, + lambda_stmt as lambda_stmt, + lateral as lateral, + literal as literal, + literal_column as literal_column, + modifier as modifier, + not_ as not_, + null as null, + nulls_first as nulls_first, + nulls_last as nulls_last, + nullsfirst as nullsfirst, + nullslast as nullslast, + or_ as or_, + outerjoin as outerjoin, + outparam as outparam, + over as over, + select as select, + subquery as subquery, + table as table, + tablesample as tablesample, + text as text, + true as true, + tuple_ as tuple_, + type_coerce as type_coerce, + union as union, + union_all as union_all, + update as update, + values as values, + within_group as within_group, +) +from .types import ( + ARRAY as ARRAY, + BIGINT as BIGINT, + BINARY as BINARY, + BLOB as BLOB, + BOOLEAN as BOOLEAN, + CHAR as CHAR, + CLOB as CLOB, + DATE as DATE, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + INT as INT, + INTEGER as INTEGER, + JSON as JSON, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + VARBINARY as VARBINARY, + VARCHAR as VARCHAR, + BigInteger as BigInteger, + Boolean as Boolean, + Date as Date, + DateTime as DateTime, + Enum as Enum, + Float as Float, + Integer as Integer, + Interval as Interval, + LargeBinary as LargeBinary, + Numeric as Numeric, + PickleType as PickleType, + SmallInteger as SmallInteger, + String as String, + Text as Text, + Time as Time, + TupleType as TupleType, + TypeDecorator as TypeDecorator, + Unicode as Unicode, + UnicodeText as UnicodeText, +) + +__version__: str diff --git a/stubs/SQLAlchemy/sqlalchemy/cimmutabledict.pyi b/stubs/SQLAlchemy/sqlalchemy/cimmutabledict.pyi new file mode 100644 index 0000000..9883315 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/cimmutabledict.pyi @@ -0,0 +1,19 @@ +from _typeshed import SupportsKeysAndGetItem +from collections.abc import Iterable +from typing import Generic, TypeVar, overload +from typing_extensions import final + +_KT = TypeVar("_KT") +_KT2 = TypeVar("_KT2") +_VT = TypeVar("_VT") +_VT2 = TypeVar("_VT2") + +@final +class immutabledict(dict[_KT, _VT], Generic[_KT, _VT]): + @overload + def union(self, __dict: dict[_KT2, _VT2]) -> immutabledict[_KT | _KT2, _VT | _VT2]: ... + @overload + def union(self, __dict: None = ..., **kw: SupportsKeysAndGetItem[_KT2, _VT2]) -> immutabledict[_KT | _KT2, _VT | _VT2]: ... + def merge_with( + self, *args: SupportsKeysAndGetItem[_KT | _KT2, _VT2] | Iterable[tuple[_KT2, _VT2]] | None + ) -> immutabledict[_KT | _KT2, _VT | _VT2]: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/connectors/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/connectors/__init__.pyi new file mode 100644 index 0000000..b66d337 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/connectors/__init__.pyi @@ -0,0 +1 @@ +class Connector: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/connectors/mxodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/connectors/mxodbc.pyi new file mode 100644 index 0000000..d3bfccd --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/connectors/mxodbc.pyi @@ -0,0 +1,17 @@ +from typing import Any + +from . import Connector + +class MxODBCConnector(Connector): + driver: str + supports_sane_multi_rowcount: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + supports_native_decimal: bool + @classmethod + def dbapi(cls): ... + def on_connect(self): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_execute(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/connectors/pyodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/connectors/pyodbc.pyi new file mode 100644 index 0000000..e821b19 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/connectors/pyodbc.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from . import Connector + +class PyODBCConnector(Connector): + driver: str + supports_sane_rowcount_returning: bool + supports_sane_multi_rowcount: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + supports_native_decimal: bool + default_paramstyle: str + use_setinputsizes: bool + pyodbc_driver_name: Any + def __init__(self, supports_unicode_binds: Any | None = ..., use_setinputsizes: bool = ..., **kw) -> None: ... + @classmethod + def dbapi(cls): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def do_set_input_sizes(self, cursor, list_of_tuples, context) -> None: ... + def set_isolation_level(self, connection, level) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/cresultproxy.pyi b/stubs/SQLAlchemy/sqlalchemy/cresultproxy.pyi new file mode 100644 index 0000000..a1e8302 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/cresultproxy.pyi @@ -0,0 +1,11 @@ +from typing import Any + +class BaseRow: + def __init__(self, parent, processors, keymap, key_style, data) -> None: ... + def __reduce__(self): ... + def __iter__(self): ... + def __len__(self): ... + def __hash__(self): ... + __getitem__: Any + +def safe_rowproxy_reconstructor(__cls, __state): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/databases/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/databases/__init__.pyi new file mode 100644 index 0000000..58f463c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/databases/__init__.pyi @@ -0,0 +1,18 @@ +from ..dialects.firebird import base as firebird_base +from ..dialects.mssql import base as mssql_base +from ..dialects.mysql import base as mysql_base +from ..dialects.oracle import base as oracle_base +from ..dialects.postgresql import base as postgresql_base +from ..dialects.sqlite import base as sqlite_base +from ..dialects.sybase import base as sybase_base + +__all__ = ("firebird", "mssql", "mysql", "postgresql", "sqlite", "oracle", "sybase") + +firebird = firebird_base +mssql = mssql_base +mysql = mysql_base +oracle = oracle_base +postgresql = postgresql_base +postgres = postgresql_base +sqlite = sqlite_base +sybase = sybase_base diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/__init__.pyi new file mode 100644 index 0000000..63292f3 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/__init__.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from . import ( + firebird as firebird, + mssql as mssql, + mysql as mysql, + oracle as oracle, + postgresql as postgresql, + sqlite as sqlite, + sybase as sybase, +) + +__all__ = ("firebird", "mssql", "mysql", "oracle", "postgresql", "sqlite", "sybase") + +registry: Any +plugins: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/__init__.pyi new file mode 100644 index 0000000..c421f78 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/__init__.pyi @@ -0,0 +1,34 @@ +from typing import Any + +from sqlalchemy.dialects.firebird.base import ( + BIGINT as BIGINT, + BLOB as BLOB, + CHAR as CHAR, + DATE as DATE, + FLOAT as FLOAT, + NUMERIC as NUMERIC, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + VARCHAR as VARCHAR, +) + +__all__ = ( + "SMALLINT", + "BIGINT", + "FLOAT", + "FLOAT", + "DATE", + "TIME", + "TEXT", + "NUMERIC", + "FLOAT", + "TIMESTAMP", + "VARCHAR", + "CHAR", + "BLOB", + "dialect", +) + +dialect: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/base.pyi new file mode 100644 index 0000000..d6764ab --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/base.pyi @@ -0,0 +1,108 @@ +from typing import Any + +from sqlalchemy import sql, types as sqltypes +from sqlalchemy.engine import default +from sqlalchemy.sql import compiler +from sqlalchemy.types import ( + BIGINT as BIGINT, + BLOB as BLOB, + DATE as DATE, + FLOAT as FLOAT, + INTEGER as INTEGER, + NUMERIC as NUMERIC, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + Integer as Integer, +) + +RESERVED_WORDS: Any + +class _StringType(sqltypes.String): + charset: Any + def __init__(self, charset: Any | None = ..., **kw) -> None: ... + +class VARCHAR(_StringType, sqltypes.VARCHAR): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class CHAR(_StringType, sqltypes.CHAR): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class _FBDateTime(sqltypes.DateTime): + def bind_processor(self, dialect): ... + +colspecs: Any +ischema_names: Any + +class FBTypeCompiler(compiler.GenericTypeCompiler): + def visit_boolean(self, type_, **kw): ... + def visit_datetime(self, type_, **kw): ... + def visit_TEXT(self, type_, **kw): ... + def visit_BLOB(self, type_, **kw): ... + def visit_CHAR(self, type_, **kw): ... + def visit_VARCHAR(self, type_, **kw): ... + +class FBCompiler(sql.compiler.SQLCompiler): + ansi_bind_rules: bool + def visit_now_func(self, fn, **kw): ... + def visit_startswith_op_binary(self, binary, operator, **kw): ... + def visit_not_startswith_op_binary(self, binary, operator, **kw): ... + def visit_mod_binary(self, binary, operator, **kw): ... + def visit_alias(self, alias, asfrom: bool = ..., **kwargs): ... # type: ignore[override] + def visit_substring_func(self, func, **kw): ... + def visit_length_func(self, function, **kw): ... + visit_char_length_func: Any + def function_argspec(self, func, **kw): ... + def default_from(self): ... + def visit_sequence(self, seq, **kw): ... + def get_select_precolumns(self, select, **kw): ... + def limit_clause(self, select, **kw): ... + def returning_clause(self, stmt, returning_cols): ... + +class FBDDLCompiler(sql.compiler.DDLCompiler): + def visit_create_sequence(self, create): ... + def visit_drop_sequence(self, drop): ... + def visit_computed_column(self, generated): ... + +class FBIdentifierPreparer(sql.compiler.IdentifierPreparer): + reserved_words: Any + illegal_initial_characters: Any + def __init__(self, dialect) -> None: ... + +class FBExecutionContext(default.DefaultExecutionContext): + def fire_sequence(self, seq, type_): ... + +class FBDialect(default.DefaultDialect): + name: str + supports_statement_cache: bool + max_identifier_length: int + supports_sequences: bool + sequences_optional: bool + supports_default_values: bool + postfetch_lastrowid: bool + supports_native_boolean: bool + requires_name_normalize: bool + supports_empty_insert: bool + statement_compiler: Any + ddl_compiler: Any + preparer: Any + type_compiler: Any + colspecs: Any + ischema_names: Any + construct_arguments: Any + def __init__(self, *args, **kwargs) -> None: ... + implicit_returning: Any + def initialize(self, connection) -> None: ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] + def has_sequence(self, connection, sequence_name, schema: Any | None = ...): ... # type: ignore[override] + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_definition(self, connection, view_name, schema: Any | None = ..., **kw): ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_column_sequence(self, connection, table_name, column_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_indexes(self, connection, table_name, schema: Any | None = ..., **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/fdb.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/fdb.pyi new file mode 100644 index 0000000..4bc56c5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/fdb.pyi @@ -0,0 +1,10 @@ +from .kinterbasdb import FBDialect_kinterbasdb + +class FBDialect_fdb(FBDialect_kinterbasdb): + supports_statement_cache: bool + def __init__(self, enable_rowcount: bool = ..., retaining: bool = ..., **kwargs) -> None: ... + @classmethod + def dbapi(cls): ... + def create_connect_args(self, url): ... + +dialect = FBDialect_fdb diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/kinterbasdb.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/kinterbasdb.pyi new file mode 100644 index 0000000..a46e1c3 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/firebird/kinterbasdb.pyi @@ -0,0 +1,38 @@ +from typing import Any + +from ...types import Float, Numeric +from .base import FBDialect, FBExecutionContext + +class _kinterbasdb_numeric: + def bind_processor(self, dialect): ... + +class _FBNumeric_kinterbasdb(_kinterbasdb_numeric, Numeric): ... +class _FBFloat_kinterbasdb(_kinterbasdb_numeric, Float): ... + +class FBExecutionContext_kinterbasdb(FBExecutionContext): + @property + def rowcount(self): ... + +class FBDialect_kinterbasdb(FBDialect): + driver: str + supports_statement_cache: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_native_decimal: bool + colspecs: Any + enable_rowcount: Any + type_conv: Any + concurrency_level: Any + retaining: Any + def __init__( + self, type_conv: int = ..., concurrency_level: int = ..., enable_rowcount: bool = ..., retaining: bool = ..., **kwargs + ) -> None: ... + @classmethod + def dbapi(cls): ... + def do_execute(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_rollback(self, dbapi_connection) -> None: ... + def do_commit(self, dbapi_connection) -> None: ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = FBDialect_kinterbasdb diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/__init__.pyi new file mode 100644 index 0000000..c4b6c72 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/__init__.pyi @@ -0,0 +1,76 @@ +from typing import Any + +from .base import ( + BIGINT as BIGINT, + BINARY as BINARY, + BIT as BIT, + CHAR as CHAR, + DATE as DATE, + DATETIME as DATETIME, + DATETIME2 as DATETIME2, + DATETIMEOFFSET as DATETIMEOFFSET, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + IMAGE as IMAGE, + INTEGER as INTEGER, + JSON as JSON, + MONEY as MONEY, + NCHAR as NCHAR, + NTEXT as NTEXT, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + REAL as REAL, + ROWVERSION as ROWVERSION, + SMALLDATETIME as SMALLDATETIME, + SMALLINT as SMALLINT, + SMALLMONEY as SMALLMONEY, + SQL_VARIANT as SQL_VARIANT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + TINYINT as TINYINT, + UNIQUEIDENTIFIER as UNIQUEIDENTIFIER, + VARBINARY as VARBINARY, + VARCHAR as VARCHAR, + XML as XML, + try_cast as try_cast, +) + +__all__ = ( + "JSON", + "INTEGER", + "BIGINT", + "SMALLINT", + "TINYINT", + "VARCHAR", + "NVARCHAR", + "CHAR", + "NCHAR", + "TEXT", + "NTEXT", + "DECIMAL", + "NUMERIC", + "FLOAT", + "DATETIME", + "DATETIME2", + "DATETIMEOFFSET", + "DATE", + "TIME", + "SMALLDATETIME", + "BINARY", + "VARBINARY", + "BIT", + "REAL", + "IMAGE", + "TIMESTAMP", + "ROWVERSION", + "MONEY", + "SMALLMONEY", + "UNIQUEIDENTIFIER", + "SQL_VARIANT", + "XML", + "dialect", + "try_cast", +) + +dialect: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/base.pyi new file mode 100644 index 0000000..6cfca37 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/base.pyi @@ -0,0 +1,325 @@ +from typing import Any, overload +from typing_extensions import Literal + +import sqlalchemy.types as sqltypes + +from ...engine import default +from ...sql import compiler +from ...sql.elements import Cast +from ...types import ( + BIGINT as BIGINT, + BINARY as BINARY, + CHAR as CHAR, + DATE as DATE, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + INTEGER as INTEGER, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + SMALLINT as SMALLINT, + TEXT as TEXT, + VARCHAR as VARCHAR, +) +from .json import JSON as JSON + +MS_2017_VERSION: Any +MS_2016_VERSION: Any +MS_2014_VERSION: Any +MS_2012_VERSION: Any +MS_2008_VERSION: Any +MS_2005_VERSION: Any +MS_2000_VERSION: Any +RESERVED_WORDS: Any + +class REAL(sqltypes.REAL): + __visit_name__: str + def __init__(self, **kw) -> None: ... + +class TINYINT(sqltypes.Integer): + __visit_name__: str + +class _MSDate(sqltypes.Date): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class TIME(sqltypes.TIME): + precision: Any + def __init__(self, precision: Any | None = ..., **kwargs) -> None: ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +_MSTime = TIME + +class _BASETIMEIMPL(TIME): + __visit_name__: str + +class _DateTimeBase: + def bind_processor(self, dialect): ... + +class _MSDateTime(_DateTimeBase, sqltypes.DateTime): ... + +class SMALLDATETIME(_DateTimeBase, sqltypes.DateTime): + __visit_name__: str + +class DATETIME2(_DateTimeBase, sqltypes.DateTime): + __visit_name__: str + precision: Any + def __init__(self, precision: Any | None = ..., **kw) -> None: ... + +class DATETIMEOFFSET(_DateTimeBase, sqltypes.DateTime): + __visit_name__: str + precision: Any + def __init__(self, precision: Any | None = ..., **kw) -> None: ... + +class _UnicodeLiteral: + def literal_processor(self, dialect): ... + +class _MSUnicode(_UnicodeLiteral, sqltypes.Unicode): ... +class _MSUnicodeText(_UnicodeLiteral, sqltypes.UnicodeText): ... + +class TIMESTAMP(sqltypes._Binary): + __visit_name__: str + length: Any + convert_int: Any + def __init__(self, convert_int: bool = ...) -> None: ... + def result_processor(self, dialect, coltype): ... + +class ROWVERSION(TIMESTAMP): + __visit_name__: str + +class NTEXT(sqltypes.UnicodeText): + __visit_name__: str + +class VARBINARY(sqltypes.VARBINARY, sqltypes.LargeBinary): + __visit_name__: str + filestream: bool + @overload + def __init__(self, length: Literal["max"] | None, filestream: Literal[True]) -> None: ... + @overload + def __init__(self, *, filestream: Literal[True]) -> None: ... + @overload + def __init__(self, length: Any | None = ..., filestream: Literal[False] = ...) -> None: ... + +class IMAGE(sqltypes.LargeBinary): + __visit_name__: str + +class XML(sqltypes.Text): + __visit_name__: str + +class BIT(sqltypes.Boolean): + __visit_name__: str + +class MONEY(sqltypes.TypeEngine): + __visit_name__: str + +class SMALLMONEY(sqltypes.TypeEngine): + __visit_name__: str + +class UNIQUEIDENTIFIER(sqltypes.TypeEngine): + __visit_name__: str + +class SQL_VARIANT(sqltypes.TypeEngine): + __visit_name__: str + +class TryCast(Cast): + __visit_name__: str + stringify_dialect: str + inherit_cache: bool + def __init__(self, *arg, **kw) -> None: ... + +try_cast: Any +MSDateTime: Any +MSDate: Any +MSReal = REAL +MSTinyInteger = TINYINT +MSTime = TIME +MSSmallDateTime = SMALLDATETIME +MSDateTime2 = DATETIME2 +MSDateTimeOffset = DATETIMEOFFSET +MSText = TEXT +MSNText = NTEXT +MSString = VARCHAR +MSNVarchar = NVARCHAR +MSChar = CHAR +MSNChar = NCHAR +MSBinary = BINARY +MSVarBinary = VARBINARY +MSImage = IMAGE +MSBit = BIT +MSMoney = MONEY +MSSmallMoney = SMALLMONEY +MSUniqueIdentifier = UNIQUEIDENTIFIER +MSVariant = SQL_VARIANT +ischema_names: Any + +class MSTypeCompiler(compiler.GenericTypeCompiler): + def visit_FLOAT(self, type_, **kw): ... + def visit_TINYINT(self, type_, **kw): ... + def visit_TIME(self, type_, **kw): ... + def visit_TIMESTAMP(self, type_, **kw): ... + def visit_ROWVERSION(self, type_, **kw): ... + def visit_datetime(self, type_, **kw): ... + def visit_DATETIMEOFFSET(self, type_, **kw): ... + def visit_DATETIME2(self, type_, **kw): ... + def visit_SMALLDATETIME(self, type_, **kw): ... + def visit_unicode(self, type_, **kw): ... + def visit_text(self, type_, **kw): ... + def visit_unicode_text(self, type_, **kw): ... + def visit_NTEXT(self, type_, **kw): ... + def visit_TEXT(self, type_, **kw): ... + def visit_VARCHAR(self, type_, **kw): ... + def visit_CHAR(self, type_, **kw): ... + def visit_NCHAR(self, type_, **kw): ... + def visit_NVARCHAR(self, type_, **kw): ... + def visit_date(self, type_, **kw): ... + def visit__BASETIMEIMPL(self, type_, **kw): ... + def visit_time(self, type_, **kw): ... + def visit_large_binary(self, type_, **kw): ... + def visit_IMAGE(self, type_, **kw): ... + def visit_XML(self, type_, **kw): ... + def visit_VARBINARY(self, type_, **kw): ... + def visit_boolean(self, type_, **kw): ... + def visit_BIT(self, type_, **kw): ... + def visit_JSON(self, type_, **kw): ... + def visit_MONEY(self, type_, **kw): ... + def visit_SMALLMONEY(self, type_, **kw): ... + def visit_UNIQUEIDENTIFIER(self, type_, **kw): ... + def visit_SQL_VARIANT(self, type_, **kw): ... + +class MSExecutionContext(default.DefaultExecutionContext): + def pre_exec(self) -> None: ... + cursor_fetch_strategy: Any + def post_exec(self) -> None: ... + def get_lastrowid(self): ... + @property + def rowcount(self): ... + def handle_dbapi_exception(self, e) -> None: ... + def get_result_cursor_strategy(self, result): ... + def fire_sequence(self, seq, type_): ... + def get_insert_default(self, column): ... + +class MSSQLCompiler(compiler.SQLCompiler): + returning_precedes_values: bool + extract_map: Any + tablealiases: Any + def __init__(self, *args, **kwargs) -> None: ... + def visit_now_func(self, fn, **kw): ... + def visit_current_date_func(self, fn, **kw): ... + def visit_length_func(self, fn, **kw): ... + def visit_char_length_func(self, fn, **kw): ... + def visit_concat_op_binary(self, binary, operator, **kw): ... + def visit_true(self, expr, **kw): ... + def visit_false(self, expr, **kw): ... + def visit_match_op_binary(self, binary, operator, **kw): ... + def get_select_precolumns(self, select, **kw): ... + def get_from_hint_text(self, table, text): ... + def get_crud_hint_text(self, table, text): ... + def fetch_clause(self, cs, **kwargs): ... + def limit_clause(self, cs, **kwargs): ... + def visit_try_cast(self, element, **kw): ... + def translate_select_structure(self, select_stmt, **kwargs): ... + def visit_table(self, table, mssql_aliased: bool = ..., iscrud: bool = ..., **kwargs): ... # type: ignore[override] + def visit_alias(self, alias, **kw): ... + def visit_column(self, column, add_to_result_map: Any | None = ..., **kw): ... # type: ignore[override] + def visit_extract(self, extract, **kw): ... + def visit_savepoint(self, savepoint_stmt): ... + def visit_rollback_to_savepoint(self, savepoint_stmt): ... + def visit_binary(self, binary, **kwargs): ... + def returning_clause(self, stmt, returning_cols): ... + def get_cte_preamble(self, recursive): ... + def label_select_column(self, select, column, asfrom): ... + def for_update_clause(self, select, **kw): ... + def order_by_clause(self, select, **kw): ... + def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw): ... + def delete_table_clause(self, delete_stmt, from_table, extra_froms): ... + def delete_extra_from_clause(self, delete_stmt, from_table, extra_froms, from_hints, **kw): ... + def visit_empty_set_expr(self, type_): ... + def visit_is_distinct_from_binary(self, binary, operator, **kw): ... + def visit_is_not_distinct_from_binary(self, binary, operator, **kw): ... + def visit_json_getitem_op_binary(self, binary, operator, **kw): ... + def visit_json_path_getitem_op_binary(self, binary, operator, **kw): ... + def visit_sequence(self, seq, **kw): ... + +class MSSQLStrictCompiler(MSSQLCompiler): + ansi_bind_rules: bool + def visit_in_op_binary(self, binary, operator, **kw): ... + def visit_not_in_op_binary(self, binary, operator, **kw): ... + def render_literal_value(self, value, type_): ... + +class MSDDLCompiler(compiler.DDLCompiler): + def get_column_specification(self, column, **kwargs): ... + def visit_create_index(self, create, include_schema: bool = ...): ... # type: ignore[override] + def visit_drop_index(self, drop): ... + def visit_primary_key_constraint(self, constraint): ... + def visit_unique_constraint(self, constraint): ... + def visit_computed_column(self, generated): ... + def visit_create_sequence(self, create, **kw): ... + def visit_identity_column(self, identity, **kw): ... + +class MSIdentifierPreparer(compiler.IdentifierPreparer): + reserved_words: Any + def __init__(self, dialect) -> None: ... + def quote_schema(self, schema, force: Any | None = ...): ... + +class MSDialect(default.DefaultDialect): + name: str + supports_statement_cache: bool + supports_default_values: bool + supports_empty_insert: bool + use_scope_identity: bool + max_identifier_length: int + schema_name: str + implicit_returning: bool + full_returning: bool + colspecs: Any + engine_config_types: Any + ischema_names: Any + supports_sequences: bool + sequences_optional: bool + default_sequence_base: int + supports_native_boolean: bool + non_native_boolean_check_constraint: bool + supports_unicode_binds: bool + postfetch_lastrowid: bool + legacy_schema_aliasing: bool + server_version_info: Any + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + preparer: Any + construct_arguments: Any + query_timeout: Any + deprecate_large_types: Any + isolation_level: Any + def __init__( + self, + query_timeout: Any | None = ..., + use_scope_identity: bool = ..., + schema_name: str = ..., + isolation_level: Any | None = ..., + deprecate_large_types: Any | None = ..., + json_serializer: Any | None = ..., + json_deserializer: Any | None = ..., + legacy_schema_aliasing: Any | None = ..., + ignore_no_transaction_on_rollback: bool = ..., + **opts, + ) -> None: ... + def do_savepoint(self, connection, name) -> None: ... + def do_release_savepoint(self, connection, name) -> None: ... + def set_isolation_level(self, connection, level) -> None: ... + def get_isolation_level(self, dbapi_connection): ... + def initialize(self, connection) -> None: ... + def on_connect(self): ... + def has_table(self, connection, tablename, dbname, owner, schema): ... + def has_sequence(self, connection, sequencename, dbname, owner, schema): ... + def get_sequence_names(self, connection, dbname, owner, schema, **kw): ... + def get_schema_names(self, connection, **kw): ... + def get_table_names(self, connection, dbname, owner, schema, **kw): ... + def get_view_names(self, connection, dbname, owner, schema, **kw): ... + def get_indexes(self, connection, tablename, dbname, owner, schema, **kw): ... + def get_view_definition(self, connection, viewname, dbname, owner, schema, **kw): ... + def get_columns(self, connection, tablename, dbname, owner, schema, **kw): ... + def get_pk_constraint(self, connection, tablename, dbname, owner, schema, **kw): ... + def get_foreign_keys(self, connection, tablename, dbname, owner, schema, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/information_schema.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/information_schema.pyi new file mode 100644 index 0000000..0a97a19 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/information_schema.pyi @@ -0,0 +1,35 @@ +from typing import Any + +from ...sql import expression +from ...types import TypeDecorator + +ischema: Any + +class CoerceUnicode(TypeDecorator): + impl: Any + cache_ok: bool + def process_bind_param(self, value, dialect): ... + def bind_expression(self, bindvalue): ... + +class _cast_on_2005(expression.ColumnElement[Any]): + bindvalue: Any + def __init__(self, bindvalue) -> None: ... + +schemata: Any +tables: Any +columns: Any +mssql_temp_table_columns: Any +constraints: Any +column_constraints: Any +key_constraints: Any +ref_constraints: Any +views: Any +computed_columns: Any +sequences: Any + +class IdentitySqlVariant(TypeDecorator): + impl: Any + cache_ok: bool + def column_expression(self, colexpr): ... + +identity_columns: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/json.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/json.pyi new file mode 100644 index 0000000..2ced3be --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/json.pyi @@ -0,0 +1,10 @@ +from ...types import JSON as _JSON + +class JSON(_JSON): ... + +class _FormatTypeMixin: + def bind_processor(self, dialect): ... + def literal_processor(self, dialect): ... + +class JSONIndexType(_FormatTypeMixin, _JSON.JSONIndexType): ... +class JSONPathType(_FormatTypeMixin, _JSON.JSONPathType): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/mxodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/mxodbc.pyi new file mode 100644 index 0000000..bddc192 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/mxodbc.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from ...connectors.mxodbc import MxODBCConnector +from .base import VARBINARY, MSDialect, _MSDate, _MSTime +from .pyodbc import MSExecutionContext_pyodbc, _MSNumeric_pyodbc + +class _MSNumeric_mxodbc(_MSNumeric_pyodbc): ... + +class _MSDate_mxodbc(_MSDate): + def bind_processor(self, dialect): ... + +class _MSTime_mxodbc(_MSTime): + def bind_processor(self, dialect): ... + +class _VARBINARY_mxodbc(VARBINARY): + def bind_processor(self, dialect): ... + +class MSExecutionContext_mxodbc(MSExecutionContext_pyodbc): ... + +class MSDialect_mxodbc(MxODBCConnector, MSDialect): + supports_statement_cache: bool + colspecs: Any + description_encoding: Any + def __init__(self, description_encoding: Any | None = ..., **params) -> None: ... + +dialect = MSDialect_mxodbc diff --git a/stdlib/@python2/antigravity.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/provision.pyi similarity index 100% rename from stdlib/@python2/antigravity.pyi rename to stubs/SQLAlchemy/sqlalchemy/dialects/mssql/provision.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pymssql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pymssql.pyi new file mode 100644 index 0000000..b16a0b4 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pymssql.pyi @@ -0,0 +1,24 @@ +from typing import Any + +from ...types import Numeric +from .base import MSDialect, MSIdentifierPreparer + +class _MSNumeric_pymssql(Numeric): + def result_processor(self, dialect, type_): ... + +class MSIdentifierPreparer_pymssql(MSIdentifierPreparer): + def __init__(self, dialect) -> None: ... + +class MSDialect_pymssql(MSDialect): + supports_statement_cache: bool + supports_native_decimal: bool + driver: str + preparer: Any + colspecs: Any + @classmethod + def dbapi(cls): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def set_isolation_level(self, connection, level) -> None: ... + +dialect = MSDialect_pymssql diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi new file mode 100644 index 0000000..907824c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi @@ -0,0 +1,44 @@ +from typing import Any + +from ...connectors.pyodbc import PyODBCConnector +from ...types import DateTime, Float, Numeric +from .base import BINARY, DATETIMEOFFSET, VARBINARY, MSDialect, MSExecutionContext + +class _ms_numeric_pyodbc: + def bind_processor(self, dialect): ... + +class _MSNumeric_pyodbc(_ms_numeric_pyodbc, Numeric): ... +class _MSFloat_pyodbc(_ms_numeric_pyodbc, Float): ... + +class _ms_binary_pyodbc: + def bind_processor(self, dialect): ... + +class _ODBCDateTimeBindProcessor: + has_tz: bool + def bind_processor(self, dialect): ... + +class _ODBCDateTime(_ODBCDateTimeBindProcessor, DateTime): ... + +class _ODBCDATETIMEOFFSET(_ODBCDateTimeBindProcessor, DATETIMEOFFSET): + has_tz: bool + +class _VARBINARY_pyodbc(_ms_binary_pyodbc, VARBINARY): ... +class _BINARY_pyodbc(_ms_binary_pyodbc, BINARY): ... + +class MSExecutionContext_pyodbc(MSExecutionContext): + def pre_exec(self) -> None: ... + def post_exec(self) -> None: ... + +class MSDialect_pyodbc(PyODBCConnector, MSDialect): + supports_statement_cache: bool + supports_sane_rowcount_returning: bool + colspecs: Any + description_encoding: Any + use_scope_identity: Any + fast_executemany: Any + def __init__(self, description_encoding: Any | None = ..., fast_executemany: bool = ..., **params) -> None: ... + def on_connect(self): ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = MSDialect_pyodbc diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/__init__.pyi new file mode 100644 index 0000000..faaa7d6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/__init__.pyi @@ -0,0 +1,85 @@ +from typing import Any + +from .base import ( + BIGINT as BIGINT, + BINARY as BINARY, + BIT as BIT, + BLOB as BLOB, + BOOLEAN as BOOLEAN, + CHAR as CHAR, + DATE as DATE, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + DOUBLE as DOUBLE, + ENUM as ENUM, + FLOAT as FLOAT, + INTEGER as INTEGER, + JSON as JSON, + LONGBLOB as LONGBLOB, + LONGTEXT as LONGTEXT, + MEDIUMBLOB as MEDIUMBLOB, + MEDIUMINT as MEDIUMINT, + MEDIUMTEXT as MEDIUMTEXT, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + REAL as REAL, + SET as SET, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + TINYBLOB as TINYBLOB, + TINYINT as TINYINT, + TINYTEXT as TINYTEXT, + VARBINARY as VARBINARY, + VARCHAR as VARCHAR, + YEAR as YEAR, +) +from .dml import Insert as Insert, insert as insert +from .expression import match as match + +__all__ = ( + "BIGINT", + "BINARY", + "BIT", + "BLOB", + "BOOLEAN", + "CHAR", + "DATE", + "DATETIME", + "DECIMAL", + "DOUBLE", + "ENUM", + "DECIMAL", + "FLOAT", + "INTEGER", + "INTEGER", + "JSON", + "LONGBLOB", + "LONGTEXT", + "MEDIUMBLOB", + "MEDIUMINT", + "MEDIUMTEXT", + "NCHAR", + "NVARCHAR", + "NUMERIC", + "SET", + "SMALLINT", + "REAL", + "TEXT", + "TIME", + "TIMESTAMP", + "TINYBLOB", + "TINYINT", + "TINYTEXT", + "VARBINARY", + "VARCHAR", + "YEAR", + "dialect", + "insert", + "Insert", + "match", +) + +dialect: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/aiomysql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/aiomysql.pyi new file mode 100644 index 0000000..4021fd9 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/aiomysql.pyi @@ -0,0 +1,73 @@ +from typing import Any + +from ...engine import AdaptedConnection +from .pymysql import MySQLDialect_pymysql + +class AsyncAdapt_aiomysql_cursor: + server_side: bool + await_: Any + def __init__(self, adapt_connection) -> None: ... + @property + def description(self): ... + @property + def rowcount(self): ... + @property + def arraysize(self): ... + @arraysize.setter + def arraysize(self, value) -> None: ... + @property + def lastrowid(self): ... + def close(self) -> None: ... + def execute(self, operation, parameters: Any | None = ...): ... + def executemany(self, operation, seq_of_parameters): ... + def setinputsizes(self, *inputsizes) -> None: ... + def __iter__(self): ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_aiomysql_ss_cursor(AsyncAdapt_aiomysql_cursor): + server_side: bool + await_: Any + def __init__(self, adapt_connection) -> None: ... + def close(self) -> None: ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_aiomysql_connection(AdaptedConnection): + await_: Any + dbapi: Any + def __init__(self, dbapi, connection) -> None: ... + def ping(self, reconnect): ... + def character_set_name(self): ... + def autocommit(self, value) -> None: ... + def cursor(self, server_side: bool = ...): ... + def rollback(self) -> None: ... + def commit(self) -> None: ... + def close(self) -> None: ... + +class AsyncAdaptFallback_aiomysql_connection(AsyncAdapt_aiomysql_connection): + await_: Any + +class AsyncAdapt_aiomysql_dbapi: + aiomysql: Any + pymysql: Any + paramstyle: str + def __init__(self, aiomysql, pymysql) -> None: ... + def connect(self, *arg, **kw): ... + +class MySQLDialect_aiomysql(MySQLDialect_pymysql): + driver: str + supports_statement_cache: bool + supports_server_side_cursors: bool + is_async: bool + @classmethod + def dbapi(cls): ... + @classmethod + def get_pool_class(cls, url): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def get_driver_connection(self, connection): ... + +dialect = MySQLDialect_aiomysql diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/asyncmy.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/asyncmy.pyi new file mode 100644 index 0000000..68d0585 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/asyncmy.pyi @@ -0,0 +1,73 @@ +from typing import Any + +from ...engine import AdaptedConnection +from .pymysql import MySQLDialect_pymysql + +class AsyncAdapt_asyncmy_cursor: + server_side: bool + await_: Any + def __init__(self, adapt_connection) -> None: ... + @property + def description(self): ... + @property + def rowcount(self): ... + @property + def arraysize(self): ... + @arraysize.setter + def arraysize(self, value) -> None: ... + @property + def lastrowid(self): ... + def close(self) -> None: ... + def execute(self, operation, parameters: Any | None = ...): ... + def executemany(self, operation, seq_of_parameters): ... + def setinputsizes(self, *inputsizes) -> None: ... + def __iter__(self): ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_asyncmy_ss_cursor(AsyncAdapt_asyncmy_cursor): + server_side: bool + await_: Any + def __init__(self, adapt_connection) -> None: ... + def close(self) -> None: ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_asyncmy_connection(AdaptedConnection): + await_: Any + dbapi: Any + def __init__(self, dbapi, connection) -> None: ... + def ping(self, reconnect): ... + def character_set_name(self): ... + def autocommit(self, value) -> None: ... + def cursor(self, server_side: bool = ...): ... + def rollback(self) -> None: ... + def commit(self) -> None: ... + def close(self) -> None: ... + +class AsyncAdaptFallback_asyncmy_connection(AsyncAdapt_asyncmy_connection): + await_: Any + +class AsyncAdapt_asyncmy_dbapi: + asyncmy: Any + pymysql: Any + paramstyle: str + def __init__(self, asyncmy: Any) -> None: ... + def connect(self, *arg, **kw): ... + +class MySQLDialect_asyncmy(MySQLDialect_pymysql): + driver: str + supports_statement_cache: bool + supports_server_side_cursors: bool + is_async: bool + @classmethod + def dbapi(cls): ... + @classmethod + def get_pool_class(cls, url): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def get_driver_connection(self, connection): ... + +dialect = MySQLDialect_asyncmy diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/base.pyi new file mode 100644 index 0000000..a7b58f6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/base.pyi @@ -0,0 +1,239 @@ +from typing import Any + +from ...engine import default +from ...sql import compiler +from ...types import BINARY as BINARY, BLOB as BLOB, BOOLEAN as BOOLEAN, DATE as DATE, VARBINARY as VARBINARY +from .enumerated import ENUM as ENUM, SET as SET +from .json import JSON as JSON +from .types import ( + BIGINT as BIGINT, + BIT as BIT, + CHAR as CHAR, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + DOUBLE as DOUBLE, + FLOAT as FLOAT, + INTEGER as INTEGER, + LONGBLOB as LONGBLOB, + LONGTEXT as LONGTEXT, + MEDIUMBLOB as MEDIUMBLOB, + MEDIUMINT as MEDIUMINT, + MEDIUMTEXT as MEDIUMTEXT, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + TINYBLOB as TINYBLOB, + TINYINT as TINYINT, + TINYTEXT as TINYTEXT, + VARCHAR as VARCHAR, + YEAR as YEAR, +) + +AUTOCOMMIT_RE: Any +SET_RE: Any +MSTime = TIME +MSSet = SET +MSEnum = ENUM +MSLongBlob = LONGBLOB +MSMediumBlob = MEDIUMBLOB +MSTinyBlob = TINYBLOB +MSBlob = BLOB +MSBinary = BINARY +MSVarBinary = VARBINARY +MSNChar = NCHAR +MSNVarChar = NVARCHAR +MSChar = CHAR +MSString = VARCHAR +MSLongText = LONGTEXT +MSMediumText = MEDIUMTEXT +MSTinyText = TINYTEXT +MSText = TEXT +MSYear = YEAR +MSTimeStamp = TIMESTAMP +MSBit = BIT +MSSmallInteger = SMALLINT +MSTinyInteger = TINYINT +MSMediumInteger = MEDIUMINT +MSBigInteger = BIGINT +MSNumeric = NUMERIC +MSDecimal = DECIMAL +MSDouble = DOUBLE +MSReal = REAL +MSFloat = FLOAT +MSInteger = INTEGER +colspecs: Any +ischema_names: Any + +class MySQLExecutionContext(default.DefaultExecutionContext): + def should_autocommit_text(self, statement): ... + def create_server_side_cursor(self): ... + def fire_sequence(self, seq, type_): ... + +class MySQLCompiler(compiler.SQLCompiler): + render_table_with_column_in_update_from: bool + extract_map: Any + def default_from(self): ... + def visit_random_func(self, fn, **kw): ... + def visit_sequence(self, seq, **kw): ... + def visit_sysdate_func(self, fn, **kw): ... + def visit_json_getitem_op_binary(self, binary, operator, **kw): ... + def visit_json_path_getitem_op_binary(self, binary, operator, **kw): ... + def visit_on_duplicate_key_update(self, on_duplicate, **kw): ... + def visit_concat_op_binary(self, binary, operator, **kw): ... + def visit_mysql_match(self, element, **kw): ... + def visit_match_op_binary(self, binary, operator, **kw): ... + def get_from_hint_text(self, table, text): ... + def visit_typeclause(self, typeclause, type_: Any | None = ..., **kw): ... + def visit_cast(self, cast, **kw): ... + def render_literal_value(self, value, type_): ... + def visit_true(self, element, **kw): ... + def visit_false(self, element, **kw): ... + def get_select_precolumns(self, select, **kw): ... + def visit_join(self, join, asfrom: bool = ..., from_linter: Any | None = ..., **kwargs): ... + def for_update_clause(self, select, **kw): ... + def limit_clause(self, select, **kw): ... + def update_limit_clause(self, update_stmt): ... + def update_tables_clause(self, update_stmt, from_table, extra_froms, **kw): ... + def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw) -> None: ... + def delete_table_clause(self, delete_stmt, from_table, extra_froms): ... + def delete_extra_from_clause(self, delete_stmt, from_table, extra_froms, from_hints, **kw): ... + def visit_empty_set_expr(self, element_types): ... + def visit_is_distinct_from_binary(self, binary, operator, **kw): ... + def visit_is_not_distinct_from_binary(self, binary, operator, **kw): ... + def visit_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_not_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_regexp_replace_op_binary(self, binary, operator, **kw): ... + +class MySQLDDLCompiler(compiler.DDLCompiler): + def get_column_specification(self, column, **kw): ... + def post_create_table(self, table): ... + def visit_create_index(self, create, **kw): ... + def visit_primary_key_constraint(self, constraint): ... + def visit_drop_index(self, drop): ... + def visit_drop_constraint(self, drop): ... + def define_constraint_match(self, constraint): ... + def visit_set_table_comment(self, create): ... + def visit_drop_table_comment(self, create): ... + def visit_set_column_comment(self, create): ... + +class MySQLTypeCompiler(compiler.GenericTypeCompiler): + def visit_NUMERIC(self, type_, **kw): ... + def visit_DECIMAL(self, type_, **kw): ... + def visit_DOUBLE(self, type_, **kw): ... + def visit_REAL(self, type_, **kw): ... + def visit_FLOAT(self, type_, **kw): ... + def visit_INTEGER(self, type_, **kw): ... + def visit_BIGINT(self, type_, **kw): ... + def visit_MEDIUMINT(self, type_, **kw): ... + def visit_TINYINT(self, type_, **kw): ... + def visit_SMALLINT(self, type_, **kw): ... + def visit_BIT(self, type_, **kw): ... + def visit_DATETIME(self, type_, **kw): ... + def visit_DATE(self, type_, **kw): ... + def visit_TIME(self, type_, **kw): ... + def visit_TIMESTAMP(self, type_, **kw): ... + def visit_YEAR(self, type_, **kw): ... + def visit_TEXT(self, type_, **kw): ... + def visit_TINYTEXT(self, type_, **kw): ... + def visit_MEDIUMTEXT(self, type_, **kw): ... + def visit_LONGTEXT(self, type_, **kw): ... + def visit_VARCHAR(self, type_, **kw): ... + def visit_CHAR(self, type_, **kw): ... + def visit_NVARCHAR(self, type_, **kw): ... + def visit_NCHAR(self, type_, **kw): ... + def visit_VARBINARY(self, type_, **kw): ... + def visit_JSON(self, type_, **kw): ... + def visit_large_binary(self, type_, **kw): ... + def visit_enum(self, type_, **kw): ... + def visit_BLOB(self, type_, **kw): ... + def visit_TINYBLOB(self, type_, **kw): ... + def visit_MEDIUMBLOB(self, type_, **kw): ... + def visit_LONGBLOB(self, type_, **kw): ... + def visit_ENUM(self, type_, **kw): ... + def visit_SET(self, type_, **kw): ... + def visit_BOOLEAN(self, type_, **kw): ... + +class MySQLIdentifierPreparer(compiler.IdentifierPreparer): + reserved_words: Any + def __init__(self, dialect, server_ansiquotes: bool = ..., **kw) -> None: ... + +class MariaDBIdentifierPreparer(MySQLIdentifierPreparer): + reserved_words: Any + +class MySQLDialect(default.DefaultDialect): + logger: Any + name: str + supports_statement_cache: bool + supports_alter: bool + supports_native_boolean: bool + max_identifier_length: int + max_index_name_length: int + max_constraint_name_length: int + supports_native_enum: bool + supports_sequences: bool + sequences_optional: bool + supports_for_update_of: bool + supports_default_values: bool + supports_default_metavalue: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_multivalues_insert: bool + supports_comments: bool + inline_comments: bool + default_paramstyle: str + colspecs: Any + cte_follows_insert: bool + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + ischema_names: Any + preparer: Any + is_mariadb: bool + construct_arguments: Any + isolation_level: Any + def __init__( + self, + isolation_level: Any | None = ..., + json_serializer: Any | None = ..., + json_deserializer: Any | None = ..., + is_mariadb: Any | None = ..., + **kwargs, + ) -> None: ... + def on_connect(self): ... + def set_isolation_level(self, connection, level) -> None: ... + def get_isolation_level(self, connection): ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_recover_twophase(self, connection): ... + def is_disconnect(self, e, connection, cursor): ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] + def has_sequence(self, connection, sequence_name, schema: Any | None = ...): ... # type: ignore[override] + def get_sequence_names(self, connection, schema: Any | None = ..., **kw): ... + identifier_preparer: Any + def initialize(self, connection) -> None: ... + def get_schema_names(self, connection, **kw): ... + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_names(self, connection, schema: Any | None = ..., **kw): ... + def get_table_options(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_check_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_table_comment(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_indexes(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_unique_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_view_definition(self, connection, view_name, schema: Any | None = ..., **kw): ... + +class _DecodingRow: + rowproxy: Any + charset: Any + def __init__(self, rowproxy, charset) -> None: ... + def __getitem__(self, index): ... + def __getattr__(self, attr): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/cymysql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/cymysql.pyi new file mode 100644 index 0000000..408d931 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/cymysql.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from .base import BIT +from .mysqldb import MySQLDialect_mysqldb + +class _cymysqlBIT(BIT): + def result_processor(self, dialect, coltype): ... + +class MySQLDialect_cymysql(MySQLDialect_mysqldb): + driver: str + supports_statement_cache: bool + description_encoding: Any + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_unicode_statements: bool + colspecs: Any + @classmethod + def dbapi(cls): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = MySQLDialect_cymysql diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/dml.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/dml.pyi new file mode 100644 index 0000000..77b095c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/dml.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from ...sql.dml import Insert as StandardInsert +from ...sql.elements import ClauseElement +from ...util import memoized_property + +class Insert(StandardInsert): + stringify_dialect: str + inherit_cache: bool + @property + def inserted(self): ... + @memoized_property + def inserted_alias(self): ... + def on_duplicate_key_update(self, *args, **kw) -> None: ... + +insert: Any + +class OnDuplicateClause(ClauseElement): + __visit_name__: str + stringify_dialect: str + inserted_alias: Any + update: Any + def __init__(self, inserted_alias, update) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi new file mode 100644 index 0000000..e75307e --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from ...sql import sqltypes +from .types import _StringType + +class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum, _StringType): # type: ignore[misc] # incompatible with base class + __visit_name__: str + native_enum: bool + def __init__(self, *enums, **kw) -> None: ... + @classmethod + def adapt_emulated_to_native(cls, impl, **kw): ... + +class SET(_StringType): + __visit_name__: str + retrieve_as_bitwise: Any + values: Any + def __init__(self, *values, **kw) -> None: ... + def column_expression(self, colexpr): ... + def result_processor(self, dialect, coltype): ... + def bind_processor(self, dialect): ... + def adapt(self, impltype, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/expression.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/expression.pyi new file mode 100644 index 0000000..24d6363 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/expression.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from ...sql import elements +from ...sql.base import Generative + +class match(Generative, elements.BinaryExpression): + __visit_name__: str + inherit_cache: bool + def __init__(self, *cols, **kw) -> None: ... + modifiers: Any + def in_boolean_mode(self) -> None: ... + def in_natural_language_mode(self) -> None: ... + def with_query_expansion(self) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/json.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/json.pyi new file mode 100644 index 0000000..c35f9c4 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/json.pyi @@ -0,0 +1,10 @@ +import sqlalchemy.types as sqltypes + +class JSON(sqltypes.JSON): ... + +class _FormatTypeMixin: + def bind_processor(self, dialect): ... + def literal_processor(self, dialect): ... + +class JSONIndexType(_FormatTypeMixin, sqltypes.JSON.JSONIndexType): ... +class JSONPathType(_FormatTypeMixin, sqltypes.JSON.JSONPathType): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadb.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadb.pyi new file mode 100644 index 0000000..db8f5ab --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadb.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from .base import MySQLDialect + +class MariaDBDialect(MySQLDialect): + is_mariadb: bool + supports_statement_cache: bool + name: str + preparer: Any + +def loader(driver): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadbconnector.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadbconnector.pyi new file mode 100644 index 0000000..0735fb7 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadbconnector.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from .base import MySQLCompiler, MySQLDialect, MySQLExecutionContext + +mariadb_cpy_minimum_version: Any + +class MySQLExecutionContext_mariadbconnector(MySQLExecutionContext): + def create_server_side_cursor(self): ... + def create_default_cursor(self): ... + +class MySQLCompiler_mariadbconnector(MySQLCompiler): ... + +class MySQLDialect_mariadbconnector(MySQLDialect): + driver: str + supports_statement_cache: bool + supports_unicode_statements: bool + encoding: str + convert_unicode: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_native_decimal: bool + default_paramstyle: str + statement_compiler: Any + supports_server_side_cursors: bool + paramstyle: str + def __init__(self, **kwargs) -> None: ... + @classmethod + def dbapi(cls): ... + def is_disconnect(self, e, connection, cursor): ... + def create_connect_args(self, url): ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + +dialect = MySQLDialect_mariadbconnector diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqlconnector.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqlconnector.pyi new file mode 100644 index 0000000..df0a635 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqlconnector.pyi @@ -0,0 +1,38 @@ +from typing import Any + +from ...util import memoized_property +from .base import BIT, MySQLCompiler, MySQLDialect, MySQLIdentifierPreparer + +class MySQLCompiler_mysqlconnector(MySQLCompiler): + def visit_mod_binary(self, binary, operator, **kw): ... + def post_process_text(self, text): ... + def escape_literal_column(self, text): ... + +class MySQLIdentifierPreparer_mysqlconnector(MySQLIdentifierPreparer): ... + +class _myconnpyBIT(BIT): + def result_processor(self, dialect, coltype) -> None: ... + +class MySQLDialect_mysqlconnector(MySQLDialect): + driver: str + supports_statement_cache: bool + supports_unicode_binds: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_native_decimal: bool + default_paramstyle: str + statement_compiler: Any + preparer: Any + colspecs: Any + def __init__(self, *arg, **kw) -> None: ... + @property + def description_encoding(self): ... + @memoized_property + def supports_unicode_statements(self): ... + @classmethod + def dbapi(cls): ... + def do_ping(self, dbapi_connection): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = MySQLDialect_mysqlconnector diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqldb.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqldb.pyi new file mode 100644 index 0000000..bb41d16 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqldb.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from ...util import memoized_property +from .base import MySQLCompiler, MySQLDialect, MySQLExecutionContext + +class MySQLExecutionContext_mysqldb(MySQLExecutionContext): + @property + def rowcount(self): ... + +class MySQLCompiler_mysqldb(MySQLCompiler): ... + +class MySQLDialect_mysqldb(MySQLDialect): + driver: str + supports_statement_cache: bool + supports_unicode_statements: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_native_decimal: bool + default_paramstyle: str + statement_compiler: Any + preparer: Any + def __init__(self, **kwargs) -> None: ... + @memoized_property + def supports_server_side_cursors(self): ... + @classmethod + def dbapi(cls): ... + def on_connect(self): ... + def do_ping(self, dbapi_connection): ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def create_connect_args(self, url, _translate_args: Any | None = ...): ... + +dialect = MySQLDialect_mysqldb diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/oursql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/oursql.pyi new file mode 100644 index 0000000..40d1d69 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/oursql.pyi @@ -0,0 +1,39 @@ +from typing import Any + +from .base import BIT, MySQLDialect, MySQLExecutionContext + +class _oursqlBIT(BIT): + def result_processor(self, dialect, coltype) -> None: ... + +class MySQLExecutionContext_oursql(MySQLExecutionContext): + @property + def plain_query(self): ... + +class MySQLDialect_oursql(MySQLDialect): + driver: str + supports_statement_cache: bool + supports_unicode_binds: bool + supports_unicode_statements: bool + supports_native_decimal: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + colspecs: Any + @classmethod + def dbapi(cls): ... + def do_execute(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_begin(self, connection) -> None: ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] + def get_table_options(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_view_names(self, connection, schema: Any | None = ..., **kw): ... + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_schema_names(self, connection, **kw): ... + def initialize(self, connection): ... + def is_disconnect(self, e, connection, cursor): ... + def create_connect_args(self, url): ... + +dialect = MySQLDialect_oursql diff --git a/stdlib/@python2/distutils/command/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/provision.pyi similarity index 100% rename from stdlib/@python2/distutils/command/__init__.pyi rename to stubs/SQLAlchemy/sqlalchemy/dialects/mysql/provision.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pymysql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pymysql.pyi new file mode 100644 index 0000000..a4f6cb6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pymysql.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from ...util import memoized_property +from .mysqldb import MySQLDialect_mysqldb + +class MySQLDialect_pymysql(MySQLDialect_mysqldb): + driver: str + supports_statement_cache: bool + description_encoding: Any + supports_unicode_statements: bool + supports_unicode_binds: bool + @memoized_property + def supports_server_side_cursors(self): ... + @classmethod + def dbapi(cls): ... + def create_connect_args(self, url, _translate_args: Any | None = ...): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = MySQLDialect_pymysql diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi new file mode 100644 index 0000000..f9363c3 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi @@ -0,0 +1,20 @@ +from typing import Any + +from ...connectors.pyodbc import PyODBCConnector +from .base import MySQLDialect, MySQLExecutionContext +from .types import TIME + +class _pyodbcTIME(TIME): + def result_processor(self, dialect, coltype): ... + +class MySQLExecutionContext_pyodbc(MySQLExecutionContext): + def get_lastrowid(self): ... + +class MySQLDialect_pyodbc(PyODBCConnector, MySQLDialect): + supports_statement_cache: bool + colspecs: Any + supports_unicode_statements: bool + pyodbc_driver_name: str + def on_connect(self): ... + +dialect = MySQLDialect_pyodbc diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/reflection.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/reflection.pyi new file mode 100644 index 0000000..f27c185 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/reflection.pyi @@ -0,0 +1,16 @@ +from typing import Any + +class ReflectedState: + columns: Any + table_options: Any + table_name: Any + keys: Any + fk_constraints: Any + ck_constraints: Any + +class MySQLTableDefinitionParser: + logger: Any + dialect: Any + preparer: Any + def __init__(self, dialect, preparer) -> None: ... + def parse(self, show_create, charset): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/reserved_words.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/reserved_words.pyi new file mode 100644 index 0000000..28a741b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/reserved_words.pyi @@ -0,0 +1,4 @@ +from typing import Any + +RESERVED_WORDS_MARIADB: Any +RESERVED_WORDS_MYSQL: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi new file mode 100644 index 0000000..3086e63 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi @@ -0,0 +1,145 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +class _NumericType: + unsigned: Any + zerofill: Any + def __init__(self, unsigned: bool = ..., zerofill: bool = ..., **kw) -> None: ... + +class _FloatType(_NumericType, sqltypes.Float): + scale: Any + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: bool = ..., **kw) -> None: ... + +class _IntegerType(_NumericType, sqltypes.Integer): + display_width: Any + def __init__(self, display_width: Any | None = ..., **kw) -> None: ... + +class _StringType(sqltypes.String): + charset: Any + ascii: Any + unicode: Any + binary: Any + national: Any + def __init__( + self, + charset: Any | None = ..., + collation: Any | None = ..., + ascii: bool = ..., + binary: bool = ..., + unicode: bool = ..., + national: bool = ..., + **kw, + ) -> None: ... + +class _MatchType(sqltypes.Float, sqltypes.MatchType): # type: ignore[misc] # incompatible with base class + def __init__(self, **kw) -> None: ... + +class NUMERIC(_NumericType, sqltypes.NUMERIC): + __visit_name__: str + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: bool = ..., **kw) -> None: ... + +class DECIMAL(_NumericType, sqltypes.DECIMAL): + __visit_name__: str + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: bool = ..., **kw) -> None: ... + +class DOUBLE(_FloatType): + __visit_name__: str + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: bool = ..., **kw) -> None: ... + +class REAL(_FloatType, sqltypes.REAL): + __visit_name__: str + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: bool = ..., **kw) -> None: ... + +class FLOAT(_FloatType, sqltypes.FLOAT): + __visit_name__: str + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: bool = ..., **kw) -> None: ... + def bind_processor(self, dialect) -> None: ... + +class INTEGER(_IntegerType, sqltypes.INTEGER): + __visit_name__: str + def __init__(self, display_width: Any | None = ..., **kw) -> None: ... + +class BIGINT(_IntegerType, sqltypes.BIGINT): + __visit_name__: str + def __init__(self, display_width: Any | None = ..., **kw) -> None: ... + +class MEDIUMINT(_IntegerType): + __visit_name__: str + def __init__(self, display_width: Any | None = ..., **kw) -> None: ... + +class TINYINT(_IntegerType): + __visit_name__: str + def __init__(self, display_width: Any | None = ..., **kw) -> None: ... + +class SMALLINT(_IntegerType, sqltypes.SMALLINT): + __visit_name__: str + def __init__(self, display_width: Any | None = ..., **kw) -> None: ... + +class BIT(sqltypes.TypeEngine): + __visit_name__: str + length: Any + def __init__(self, length: Any | None = ...) -> None: ... + def result_processor(self, dialect, coltype): ... + +class TIME(sqltypes.TIME): + __visit_name__: str + fsp: Any + def __init__(self, timezone: bool = ..., fsp: Any | None = ...) -> None: ... + def result_processor(self, dialect, coltype): ... + +class TIMESTAMP(sqltypes.TIMESTAMP): + __visit_name__: str + fsp: Any + def __init__(self, timezone: bool = ..., fsp: Any | None = ...) -> None: ... + +class DATETIME(sqltypes.DATETIME): + __visit_name__: str + fsp: Any + def __init__(self, timezone: bool = ..., fsp: Any | None = ...) -> None: ... + +class YEAR(sqltypes.TypeEngine): + __visit_name__: str + display_width: Any + def __init__(self, display_width: Any | None = ...) -> None: ... + +class TEXT(_StringType, sqltypes.TEXT): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kw) -> None: ... + +class TINYTEXT(_StringType): + __visit_name__: str + def __init__(self, **kwargs) -> None: ... + +class MEDIUMTEXT(_StringType): + __visit_name__: str + def __init__(self, **kwargs) -> None: ... + +class LONGTEXT(_StringType): + __visit_name__: str + def __init__(self, **kwargs) -> None: ... + +class VARCHAR(_StringType, sqltypes.VARCHAR): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class CHAR(_StringType, sqltypes.CHAR): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class NVARCHAR(_StringType, sqltypes.NVARCHAR): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class NCHAR(_StringType, sqltypes.NCHAR): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class TINYBLOB(sqltypes._Binary): + __visit_name__: str + +class MEDIUMBLOB(sqltypes._Binary): + __visit_name__: str + +class LONGBLOB(sqltypes._Binary): + __visit_name__: str diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/__init__.pyi new file mode 100644 index 0000000..3cc1662 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/__init__.pyi @@ -0,0 +1,52 @@ +from typing import Any + +from .base import ( + BFILE as BFILE, + BINARY_DOUBLE as BINARY_DOUBLE, + BINARY_FLOAT as BINARY_FLOAT, + BLOB as BLOB, + CHAR as CHAR, + CLOB as CLOB, + DATE as DATE, + DOUBLE_PRECISION as DOUBLE_PRECISION, + FLOAT as FLOAT, + INTERVAL as INTERVAL, + LONG as LONG, + NCHAR as NCHAR, + NCLOB as NCLOB, + NUMBER as NUMBER, + NVARCHAR as NVARCHAR, + NVARCHAR2 as NVARCHAR2, + RAW as RAW, + ROWID as ROWID, + TIMESTAMP as TIMESTAMP, + VARCHAR as VARCHAR, + VARCHAR2 as VARCHAR2, +) + +__all__ = ( + "VARCHAR", + "NVARCHAR", + "CHAR", + "NCHAR", + "DATE", + "NUMBER", + "BLOB", + "BFILE", + "CLOB", + "NCLOB", + "TIMESTAMP", + "RAW", + "FLOAT", + "DOUBLE_PRECISION", + "BINARY_DOUBLE", + "BINARY_FLOAT", + "LONG", + "dialect", + "INTERVAL", + "VARCHAR2", + "NVARCHAR2", + "ROWID", +) + +dialect: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/base.pyi new file mode 100644 index 0000000..6b96689 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/base.pyi @@ -0,0 +1,219 @@ +from typing import Any + +from sqlalchemy.sql import ClauseElement + +from ...engine import default +from ...sql import compiler, sqltypes +from ...types import ( + BLOB as BLOB, + CHAR as CHAR, + CLOB as CLOB, + FLOAT as FLOAT, + INTEGER as INTEGER, + NCHAR as NCHAR, + NVARCHAR as NVARCHAR, + TIMESTAMP as TIMESTAMP, + VARCHAR as VARCHAR, +) + +RESERVED_WORDS: Any +NO_ARG_FNS: Any + +class RAW(sqltypes._Binary): + __visit_name__: str + +OracleRaw = RAW + +class NCLOB(sqltypes.Text): + __visit_name__: str + +class VARCHAR2(VARCHAR): + __visit_name__: str + +NVARCHAR2 = NVARCHAR + +class NUMBER(sqltypes.Numeric, sqltypes.Integer): + __visit_name__: str + def __init__(self, precision: Any | None = ..., scale: Any | None = ..., asdecimal: Any | None = ...) -> None: ... + def adapt(self, impltype): ... + +class DOUBLE_PRECISION(sqltypes.Float): + __visit_name__: str + +class BINARY_DOUBLE(sqltypes.Float): + __visit_name__: str + +class BINARY_FLOAT(sqltypes.Float): + __visit_name__: str + +class BFILE(sqltypes.LargeBinary): + __visit_name__: str + +class LONG(sqltypes.Text): + __visit_name__: str + +class DATE(sqltypes.DateTime): + __visit_name__: str + +class INTERVAL(sqltypes.NativeForEmulated, sqltypes._AbstractInterval): + __visit_name__: str + day_precision: Any + second_precision: Any + def __init__(self, day_precision: Any | None = ..., second_precision: Any | None = ...) -> None: ... + def as_generic(self, allow_nulltype: bool = ...): ... + def coerce_compared_value(self, op, value): ... + +class ROWID(sqltypes.TypeEngine): + __visit_name__: str + +class _OracleBoolean(sqltypes.Boolean): + def get_dbapi_type(self, dbapi): ... + +colspecs: Any +ischema_names: Any + +class OracleTypeCompiler(compiler.GenericTypeCompiler): + def visit_datetime(self, type_, **kw): ... + def visit_float(self, type_, **kw): ... + def visit_unicode(self, type_, **kw): ... + def visit_INTERVAL(self, type_, **kw): ... + def visit_LONG(self, type_, **kw): ... + def visit_TIMESTAMP(self, type_, **kw): ... + def visit_DOUBLE_PRECISION(self, type_, **kw): ... + def visit_BINARY_DOUBLE(self, type_, **kw): ... + def visit_BINARY_FLOAT(self, type_, **kw): ... + def visit_FLOAT(self, type_, **kw): ... + def visit_NUMBER(self, type_, **kw): ... + def visit_string(self, type_, **kw): ... + def visit_VARCHAR2(self, type_, **kw): ... + def visit_NVARCHAR2(self, type_, **kw): ... + visit_NVARCHAR: Any + def visit_VARCHAR(self, type_, **kw): ... + def visit_text(self, type_, **kw): ... + def visit_unicode_text(self, type_, **kw): ... + def visit_large_binary(self, type_, **kw): ... + def visit_big_integer(self, type_, **kw): ... + def visit_boolean(self, type_, **kw): ... + def visit_RAW(self, type_, **kw): ... + def visit_ROWID(self, type_, **kw): ... + +class OracleCompiler(compiler.SQLCompiler): + compound_keywords: Any + def __init__(self, *args, **kwargs) -> None: ... + def visit_mod_binary(self, binary, operator, **kw): ... + def visit_now_func(self, fn, **kw): ... + def visit_char_length_func(self, fn, **kw): ... + def visit_match_op_binary(self, binary, operator, **kw): ... + def visit_true(self, expr, **kw): ... + def visit_false(self, expr, **kw): ... + def get_cte_preamble(self, recursive): ... + def get_select_hint_text(self, byfroms): ... + def function_argspec(self, fn, **kw): ... + def visit_function(self, func, **kw): ... + def visit_table_valued_column(self, element, **kw): ... + def default_from(self): ... + def visit_join(self, join, from_linter: Any | None = ..., **kwargs): ... # type: ignore[override] + def visit_outer_join_column(self, vc, **kw): ... + def visit_sequence(self, seq, **kw): ... + def get_render_as_alias_suffix(self, alias_name_text): ... + has_out_parameters: bool + def returning_clause(self, stmt, returning_cols): ... + def translate_select_structure(self, select_stmt, **kwargs): ... + def limit_clause(self, select, **kw): ... + def visit_empty_set_expr(self, type_): ... + def for_update_clause(self, select, **kw): ... + def visit_is_distinct_from_binary(self, binary, operator, **kw): ... + def visit_is_not_distinct_from_binary(self, binary, operator, **kw): ... + def visit_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_not_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_regexp_replace_op_binary(self, binary, operator, **kw): ... + +class OracleDDLCompiler(compiler.DDLCompiler): + def define_constraint_cascades(self, constraint): ... + def visit_drop_table_comment(self, drop): ... + def visit_create_index(self, create): ... + def post_create_table(self, table): ... + def get_identity_options(self, identity_options): ... + def visit_computed_column(self, generated): ... + def visit_identity_column(self, identity, **kw): ... + +class OracleIdentifierPreparer(compiler.IdentifierPreparer): + reserved_words: Any + illegal_initial_characters: Any + def format_savepoint(self, savepoint): ... + +class OracleExecutionContext(default.DefaultExecutionContext): + def fire_sequence(self, seq, type_): ... + +class OracleDialect(default.DefaultDialect): + name: str + supports_statement_cache: bool + supports_alter: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + max_identifier_length: int + supports_simple_order_by_label: bool + cte_follows_insert: bool + supports_sequences: bool + sequences_optional: bool + postfetch_lastrowid: bool + default_paramstyle: str + colspecs: Any + ischema_names: Any + requires_name_normalize: bool + supports_comments: bool + supports_default_values: bool + supports_default_metavalue: bool + supports_empty_insert: bool + supports_identity_columns: bool + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + preparer: Any + reflection_options: Any + construct_arguments: Any + use_ansi: Any + optimize_limits: Any + exclude_tablespaces: Any + def __init__( + self, + use_ansi: bool = ..., + optimize_limits: bool = ..., + use_binds_for_limits: Any | None = ..., + use_nchar_for_unicode: bool = ..., + exclude_tablespaces=..., + **kwargs, + ) -> None: ... + implicit_returning: Any + def initialize(self, connection) -> None: ... + def do_release_savepoint(self, connection, name) -> None: ... + def get_isolation_level(self, connection) -> None: ... + def get_default_isolation_level(self, dbapi_conn): ... + def set_isolation_level(self, connection, level) -> None: ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] + def has_sequence(self, connection, sequence_name, schema: Any | None = ...): ... # type: ignore[override] + def get_schema_names(self, connection, **kw): ... + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_temp_table_names(self, connection, **kw): ... + def get_view_names(self, connection, schema: Any | None = ..., **kw): ... + def get_sequence_names(self, connection, schema: Any | None = ..., **kw): ... + def get_table_options(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_table_comment( + self, connection, table_name, schema: Any | None = ..., resolve_synonyms: bool = ..., dblink: str = ..., **kw + ): ... + def get_indexes( + self, connection, table_name, schema: Any | None = ..., resolve_synonyms: bool = ..., dblink: str = ..., **kw + ): ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_unique_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_view_definition( + self, connection, view_name, schema: Any | None = ..., resolve_synonyms: bool = ..., dblink: str = ..., **kw + ): ... + def get_check_constraints(self, connection, table_name, schema: Any | None = ..., include_all: bool = ..., **kw): ... + +class _OuterJoinColumn(ClauseElement): + __visit_name__: str + column: Any + def __init__(self, column) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/cx_oracle.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/cx_oracle.pyi new file mode 100644 index 0000000..05f26b8 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/cx_oracle.pyi @@ -0,0 +1,127 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +from . import base as oracle +from .base import OracleCompiler, OracleDialect, OracleExecutionContext + +class _OracleInteger(sqltypes.Integer): + def get_dbapi_type(self, dbapi): ... + +class _OracleNumeric(sqltypes.Numeric): + is_number: bool + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype) -> None: ... + +class _OracleBinaryFloat(_OracleNumeric): + def get_dbapi_type(self, dbapi): ... + +class _OracleBINARY_FLOAT(_OracleBinaryFloat, oracle.BINARY_FLOAT): ... +class _OracleBINARY_DOUBLE(_OracleBinaryFloat, oracle.BINARY_DOUBLE): ... + +class _OracleNUMBER(_OracleNumeric): + is_number: bool + +class _OracleDate(sqltypes.Date): + def bind_processor(self, dialect) -> None: ... + def result_processor(self, dialect, coltype): ... + +class _OracleChar(sqltypes.CHAR): + def get_dbapi_type(self, dbapi): ... + +class _OracleNChar(sqltypes.NCHAR): + def get_dbapi_type(self, dbapi): ... + +class _OracleUnicodeStringNCHAR(oracle.NVARCHAR2): + def get_dbapi_type(self, dbapi): ... + +class _OracleUnicodeStringCHAR(sqltypes.Unicode): + def get_dbapi_type(self, dbapi): ... + +class _OracleUnicodeTextNCLOB(oracle.NCLOB): + def get_dbapi_type(self, dbapi): ... + +class _OracleUnicodeTextCLOB(sqltypes.UnicodeText): + def get_dbapi_type(self, dbapi): ... + +class _OracleText(sqltypes.Text): + def get_dbapi_type(self, dbapi): ... + +class _OracleLong(oracle.LONG): + def get_dbapi_type(self, dbapi): ... + +class _OracleString(sqltypes.String): ... + +class _OracleEnum(sqltypes.Enum): + def bind_processor(self, dialect): ... + +class _OracleBinary(sqltypes.LargeBinary): + def get_dbapi_type(self, dbapi): ... + def bind_processor(self, dialect) -> None: ... + def result_processor(self, dialect, coltype): ... + +class _OracleInterval(oracle.INTERVAL): + def get_dbapi_type(self, dbapi): ... + +class _OracleRaw(oracle.RAW): ... + +class _OracleRowid(oracle.ROWID): + def get_dbapi_type(self, dbapi): ... + +class OracleCompiler_cx_oracle(OracleCompiler): + def bindparam_string(self, name, **kw): ... + +class OracleExecutionContext_cx_oracle(OracleExecutionContext): + out_parameters: Any + include_set_input_sizes: Any + def pre_exec(self) -> None: ... + cursor_fetch_strategy: Any + def post_exec(self) -> None: ... + def create_cursor(self): ... + def get_out_parameter_values(self, out_param_names): ... + +class OracleDialect_cx_oracle(OracleDialect): + supports_statement_cache: bool + statement_compiler: Any + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + use_setinputsizes: bool + driver: str + colspecs: Any + execute_sequence_format: Any + arraysize: Any + encoding_errors: Any + auto_convert_lobs: Any + coerce_to_unicode: Any + coerce_to_decimal: Any + cx_oracle_ver: Any + def __init__( + self, + auto_convert_lobs: bool = ..., + coerce_to_unicode: bool = ..., + coerce_to_decimal: bool = ..., + arraysize: int = ..., + encoding_errors: Any | None = ..., + threaded: Any | None = ..., + **kwargs, + ): ... + @classmethod + def dbapi(cls): ... + def initialize(self, connection) -> None: ... + def get_isolation_level(self, connection): ... + def set_isolation_level(self, connection, level) -> None: ... + def on_connect(self): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def create_xid(self): ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_set_input_sizes(self, cursor, list_of_tuples, context) -> None: ... + def do_recover_twophase(self, connection) -> None: ... + +dialect = OracleDialect_cx_oracle diff --git a/stdlib/@python2/distutils/command/bdist.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/oracle/provision.pyi similarity index 100% rename from stdlib/@python2/distutils/command/bdist.pyi rename to stubs/SQLAlchemy/sqlalchemy/dialects/oracle/provision.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/__init__.pyi new file mode 100644 index 0000000..67a7995 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/__init__.pyi @@ -0,0 +1,98 @@ +import typing + +from .array import ARRAY as ARRAY, All as All, Any as Any, array as array +from .base import ( + BIGINT as BIGINT, + BIT as BIT, + BOOLEAN as BOOLEAN, + BYTEA as BYTEA, + CHAR as CHAR, + CIDR as CIDR, + DATE as DATE, + DOUBLE_PRECISION as DOUBLE_PRECISION, + ENUM as ENUM, + FLOAT as FLOAT, + INET as INET, + INTEGER as INTEGER, + INTERVAL as INTERVAL, + MACADDR as MACADDR, + MONEY as MONEY, + NUMERIC as NUMERIC, + OID as OID, + REAL as REAL, + REGCLASS as REGCLASS, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + TSVECTOR as TSVECTOR, + UUID as UUID, + VARCHAR as VARCHAR, + CreateEnumType as CreateEnumType, + DropEnumType as DropEnumType, +) +from .dml import Insert as Insert, insert as insert +from .ext import ExcludeConstraint as ExcludeConstraint, aggregate_order_by as aggregate_order_by, array_agg as array_agg +from .hstore import HSTORE as HSTORE, hstore as hstore +from .json import JSON as JSON, JSONB as JSONB +from .ranges import ( + DATERANGE as DATERANGE, + INT4RANGE as INT4RANGE, + INT8RANGE as INT8RANGE, + NUMRANGE as NUMRANGE, + TSRANGE as TSRANGE, + TSTZRANGE as TSTZRANGE, +) + +__all__ = ( + "INTEGER", + "BIGINT", + "SMALLINT", + "VARCHAR", + "CHAR", + "TEXT", + "NUMERIC", + "FLOAT", + "REAL", + "INET", + "CIDR", + "UUID", + "BIT", + "MACADDR", + "MONEY", + "OID", + "REGCLASS", + "DOUBLE_PRECISION", + "TIMESTAMP", + "TIME", + "DATE", + "BYTEA", + "BOOLEAN", + "INTERVAL", + "ARRAY", + "ENUM", + "dialect", + "array", + "HSTORE", + "hstore", + "INT4RANGE", + "INT8RANGE", + "NUMRANGE", + "DATERANGE", + "TSVECTOR", + "TSRANGE", + "TSTZRANGE", + "JSON", + "JSONB", + "Any", + "All", + "DropEnumType", + "CreateEnumType", + "ExcludeConstraint", + "aggregate_order_by", + "array_agg", + "insert", + "Insert", +) + +dialect: typing.Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi new file mode 100644 index 0000000..5bcc21b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi @@ -0,0 +1,40 @@ +from typing import Any as _Any + +import sqlalchemy.types as sqltypes + +from ...sql import expression + +def Any(other, arrexpr, operator=...): ... +def All(other, arrexpr, operator=...): ... + +class array(expression.ClauseList, expression.ColumnElement[_Any]): + __visit_name__: str + stringify_dialect: str + inherit_cache: bool + type: _Any + def __init__(self, clauses, **kw) -> None: ... + def self_group(self, against: _Any | None = ...): ... + +CONTAINS: _Any +CONTAINED_BY: _Any +OVERLAP: _Any + +class ARRAY(sqltypes.ARRAY): + class Comparator(sqltypes.ARRAY.Comparator[_Any]): + def contains(self, other, **kwargs): ... + def contained_by(self, other): ... + def overlap(self, other): ... + comparator_factory: _Any + item_type: _Any + as_tuple: _Any + dimensions: _Any + zero_indexes: _Any + def __init__(self, item_type, as_tuple: bool = ..., dimensions: _Any | None = ..., zero_indexes: bool = ...) -> None: ... + @property + def hashable(self): ... + @property + def python_type(self): ... + def compare_values(self, x, y): ... + def bind_expression(self, bindvalue): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/asyncpg.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/asyncpg.pyi new file mode 100644 index 0000000..0645aa7 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/asyncpg.pyi @@ -0,0 +1,202 @@ +from typing import Any + +from ...engine import AdaptedConnection +from ...sql import sqltypes +from . import json +from .base import ENUM, INTERVAL, OID, REGCLASS, UUID, PGCompiler, PGDialect, PGExecutionContext, PGIdentifierPreparer + +class AsyncpgTime(sqltypes.Time): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgDate(sqltypes.Date): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgDateTime(sqltypes.DateTime): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgBoolean(sqltypes.Boolean): + def get_dbapi_type(self, dbapi): ... + +class AsyncPgInterval(INTERVAL): + def get_dbapi_type(self, dbapi): ... + @classmethod + def adapt_emulated_to_native(cls, interval, **kw): ... + +class AsyncPgEnum(ENUM): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgInteger(sqltypes.Integer): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgBigInteger(sqltypes.BigInteger): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgJSON(json.JSON): + def get_dbapi_type(self, dbapi): ... + def result_processor(self, dialect, coltype) -> None: ... + +class AsyncpgJSONB(json.JSONB): + def get_dbapi_type(self, dbapi): ... + def result_processor(self, dialect, coltype) -> None: ... + +class AsyncpgJSONIndexType(sqltypes.JSON.JSONIndexType): + def get_dbapi_type(self, dbapi) -> None: ... + +class AsyncpgJSONIntIndexType(sqltypes.JSON.JSONIntIndexType): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgJSONStrIndexType(sqltypes.JSON.JSONStrIndexType): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgJSONPathType(json.JSONPathType): + def bind_processor(self, dialect): ... + +class AsyncpgUUID(UUID): + def get_dbapi_type(self, dbapi): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class AsyncpgNumeric(sqltypes.Numeric): + def get_dbapi_type(self, dbapi): ... + def bind_processor(self, dialect) -> None: ... + def result_processor(self, dialect, coltype): ... + +class AsyncpgFloat(AsyncpgNumeric): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgREGCLASS(REGCLASS): + def get_dbapi_type(self, dbapi): ... + +class AsyncpgOID(OID): + def get_dbapi_type(self, dbapi): ... + +class PGExecutionContext_asyncpg(PGExecutionContext): + def handle_dbapi_exception(self, e) -> None: ... + exclude_set_input_sizes: Any + def pre_exec(self) -> None: ... + def create_server_side_cursor(self): ... + +class PGCompiler_asyncpg(PGCompiler): ... +class PGIdentifierPreparer_asyncpg(PGIdentifierPreparer): ... + +class AsyncAdapt_asyncpg_cursor: + server_side: bool + description: Any + arraysize: int + rowcount: int + def __init__(self, adapt_connection) -> None: ... + def close(self) -> None: ... + def execute(self, operation, parameters: Any | None = ...) -> None: ... + def executemany(self, operation, seq_of_parameters): ... + def setinputsizes(self, *inputsizes) -> None: ... + def __iter__(self): ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_asyncpg_ss_cursor(AsyncAdapt_asyncpg_cursor): + server_side: bool + def __init__(self, adapt_connection) -> None: ... + def close(self) -> None: ... + def __aiter__(self): ... + async def __anext__(self) -> None: ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + def executemany(self, operation, seq_of_parameters) -> None: ... + +class AsyncAdapt_asyncpg_connection(AdaptedConnection): + await_: Any + dbapi: Any + isolation_level: str + readonly: bool + deferrable: bool + def __init__(self, dbapi, connection, prepared_statement_cache_size: int = ...) -> None: ... + @property + def autocommit(self): ... + @autocommit.setter + def autocommit(self, value) -> None: ... + def set_isolation_level(self, level) -> None: ... + def cursor(self, server_side: bool = ...): ... + def rollback(self) -> None: ... + def commit(self) -> None: ... + def close(self) -> None: ... + +class AsyncAdaptFallback_asyncpg_connection(AsyncAdapt_asyncpg_connection): + await_: Any + +class AsyncAdapt_asyncpg_dbapi: + asyncpg: Any + paramstyle: str + def __init__(self, asyncpg) -> None: ... + def connect(self, *arg, **kw): ... + + class Error(Exception): ... + class Warning(Exception): ... + class InterfaceError(Error): ... + class DatabaseError(Error): ... + class InternalError(DatabaseError): ... + class OperationalError(DatabaseError): ... + class ProgrammingError(DatabaseError): ... + class IntegrityError(DatabaseError): ... + class DataError(DatabaseError): ... + class NotSupportedError(DatabaseError): ... + class InternalServerError(InternalError): ... + + class InvalidCachedStatementError(NotSupportedError): + def __init__(self, message) -> None: ... + + def Binary(self, value): ... + STRING: Any + TIMESTAMP: Any + TIMESTAMP_W_TZ: Any + TIME: Any + DATE: Any + INTERVAL: Any + NUMBER: Any + FLOAT: Any + BOOLEAN: Any + INTEGER: Any + BIGINTEGER: Any + BYTES: Any + DECIMAL: Any + JSON: Any + JSONB: Any + ENUM: Any + UUID: Any + BYTEA: Any + DATETIME: Any + BINARY: Any + +class PGDialect_asyncpg(PGDialect): + driver: str + supports_statement_cache: bool + supports_unicode_statements: bool + supports_server_side_cursors: bool + supports_unicode_binds: bool + default_paramstyle: str + supports_sane_multi_rowcount: bool + statement_compiler: Any + preparer: Any + use_setinputsizes: bool + use_native_uuid: bool + colspecs: Any + is_async: bool + @classmethod + def dbapi(cls): ... + def set_isolation_level(self, connection, level) -> None: ... + def set_readonly(self, connection, value) -> None: ... + def get_readonly(self, connection): ... + def set_deferrable(self, connection, value) -> None: ... + def get_deferrable(self, connection): ... + def create_connect_args(self, url): ... + @classmethod + def get_pool_class(cls, url): ... + def is_disconnect(self, e, connection, cursor): ... + def do_set_input_sizes(self, cursor, list_of_tuples, context) -> None: ... + async def setup_asyncpg_json_codec(self, conn): ... + async def setup_asyncpg_jsonb_codec(self, conn): ... + def on_connect(self): ... + def get_driver_connection(self, connection): ... + +dialect = PGDialect_asyncpg diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi new file mode 100644 index 0000000..88de9ce --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi @@ -0,0 +1,302 @@ +from typing import Any + +from ...engine import characteristics, default, reflection +from ...schema import _CreateDropBase +from ...sql import compiler, elements, sqltypes +from ...sql.ddl import DDLBase +from ...types import ( + BIGINT as BIGINT, + BOOLEAN as BOOLEAN, + CHAR as CHAR, + DATE as DATE, + FLOAT as FLOAT, + INTEGER as INTEGER, + NUMERIC as NUMERIC, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + VARCHAR as VARCHAR, +) + +IDX_USING: Any +AUTOCOMMIT_REGEXP: Any +RESERVED_WORDS: Any + +class BYTEA(sqltypes.LargeBinary): + __visit_name__: str + +class DOUBLE_PRECISION(sqltypes.Float): + __visit_name__: str + +class INET(sqltypes.TypeEngine): + __visit_name__: str + +PGInet = INET + +class CIDR(sqltypes.TypeEngine): + __visit_name__: str + +PGCidr = CIDR + +class MACADDR(sqltypes.TypeEngine): + __visit_name__: str + +PGMacAddr = MACADDR + +class MONEY(sqltypes.TypeEngine): + __visit_name__: str + +class OID(sqltypes.TypeEngine): + __visit_name__: str + +class REGCLASS(sqltypes.TypeEngine): + __visit_name__: str + +class TIMESTAMP(sqltypes.TIMESTAMP): + precision: Any + def __init__(self, timezone: bool = ..., precision: Any | None = ...) -> None: ... + +class TIME(sqltypes.TIME): + precision: Any + def __init__(self, timezone: bool = ..., precision: Any | None = ...) -> None: ... + +class INTERVAL(sqltypes.NativeForEmulated, sqltypes._AbstractInterval): + __visit_name__: str + native: bool + precision: Any + fields: Any + def __init__(self, precision: Any | None = ..., fields: Any | None = ...) -> None: ... + @classmethod + def adapt_emulated_to_native(cls, interval, **kw): ... + def as_generic(self, allow_nulltype: bool = ...): ... + @property + def python_type(self): ... + def coerce_compared_value(self, op, value): ... + +PGInterval = INTERVAL + +class BIT(sqltypes.TypeEngine): + __visit_name__: str + length: Any + varying: Any + def __init__(self, length: Any | None = ..., varying: bool = ...) -> None: ... + +PGBit = BIT + +class UUID(sqltypes.TypeEngine): + __visit_name__: str + as_uuid: Any + def __init__(self, as_uuid: bool = ...) -> None: ... + def coerce_compared_value(self, op, value): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +PGUuid = UUID + +class TSVECTOR(sqltypes.TypeEngine): + __visit_name__: str + +class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum): # type: ignore[misc] # base classes incompatible + native_enum: bool + create_type: Any + def __init__(self, *enums, **kw) -> None: ... + @classmethod + def adapt_emulated_to_native(cls, impl, **kw): ... + def create(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + def drop(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + + class EnumGenerator(DDLBase): + checkfirst: Any + def __init__(self, dialect, connection, checkfirst: bool = ..., **kwargs) -> None: ... + def visit_enum(self, enum) -> None: ... + + class EnumDropper(DDLBase): + checkfirst: Any + def __init__(self, dialect, connection, checkfirst: bool = ..., **kwargs) -> None: ... + def visit_enum(self, enum) -> None: ... + +class _ColonCast(elements.Cast): + __visit_name__: str + type: Any + clause: Any + typeclause: Any + def __init__(self, expression, type_) -> None: ... + +colspecs: Any +ischema_names: Any + +class PGCompiler(compiler.SQLCompiler): + def visit_colon_cast(self, element, **kw): ... + def visit_array(self, element, **kw): ... + def visit_slice(self, element, **kw): ... + def visit_json_getitem_op_binary(self, binary, operator, _cast_applied: bool = ..., **kw): ... + def visit_json_path_getitem_op_binary(self, binary, operator, _cast_applied: bool = ..., **kw): ... + def visit_getitem_binary(self, binary, operator, **kw): ... + def visit_aggregate_order_by(self, element, **kw): ... + def visit_match_op_binary(self, binary, operator, **kw): ... + def visit_ilike_op_binary(self, binary, operator, **kw): ... + def visit_not_ilike_op_binary(self, binary, operator, **kw): ... + def visit_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_not_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_regexp_replace_op_binary(self, binary, operator, **kw): ... + def visit_empty_set_expr(self, element_types): ... + def render_literal_value(self, value, type_): ... + def visit_sequence(self, seq, **kw): ... + def limit_clause(self, select, **kw): ... + def format_from_hint_text(self, sqltext, table, hint, iscrud): ... + def get_select_precolumns(self, select, **kw): ... + def for_update_clause(self, select, **kw): ... + def returning_clause(self, stmt, returning_cols): ... + def visit_substring_func(self, func, **kw): ... + def visit_on_conflict_do_nothing(self, on_conflict, **kw): ... + def visit_on_conflict_do_update(self, on_conflict, **kw): ... + def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw): ... + def delete_extra_from_clause(self, delete_stmt, from_table, extra_froms, from_hints, **kw): ... + def fetch_clause(self, select, **kw): ... + +class PGDDLCompiler(compiler.DDLCompiler): + def get_column_specification(self, column, **kwargs): ... + def visit_check_constraint(self, constraint): ... + def visit_drop_table_comment(self, drop): ... + def visit_create_enum_type(self, create): ... + def visit_drop_enum_type(self, drop): ... + def visit_create_index(self, create): ... + def visit_drop_index(self, drop): ... + def visit_exclude_constraint(self, constraint, **kw): ... + def post_create_table(self, table): ... + def visit_computed_column(self, generated): ... + def visit_create_sequence(self, create, **kw): ... + +class PGTypeCompiler(compiler.GenericTypeCompiler): + def visit_TSVECTOR(self, type_, **kw): ... + def visit_INET(self, type_, **kw): ... + def visit_CIDR(self, type_, **kw): ... + def visit_MACADDR(self, type_, **kw): ... + def visit_MONEY(self, type_, **kw): ... + def visit_OID(self, type_, **kw): ... + def visit_REGCLASS(self, type_, **kw): ... + def visit_FLOAT(self, type_, **kw): ... + def visit_DOUBLE_PRECISION(self, type_, **kw): ... + def visit_BIGINT(self, type_, **kw): ... + def visit_HSTORE(self, type_, **kw): ... + def visit_JSON(self, type_, **kw): ... + def visit_JSONB(self, type_, **kw): ... + def visit_INT4RANGE(self, type_, **kw): ... + def visit_INT8RANGE(self, type_, **kw): ... + def visit_NUMRANGE(self, type_, **kw): ... + def visit_DATERANGE(self, type_, **kw): ... + def visit_TSRANGE(self, type_, **kw): ... + def visit_TSTZRANGE(self, type_, **kw): ... + def visit_datetime(self, type_, **kw): ... + def visit_enum(self, type_, **kw): ... + def visit_ENUM(self, type_, identifier_preparer: Any | None = ..., **kw): ... + def visit_TIMESTAMP(self, type_, **kw): ... + def visit_TIME(self, type_, **kw): ... + def visit_INTERVAL(self, type_, **kw): ... + def visit_BIT(self, type_, **kw): ... + def visit_UUID(self, type_, **kw): ... + def visit_large_binary(self, type_, **kw): ... + def visit_BYTEA(self, type_, **kw): ... + def visit_ARRAY(self, type_, **kw): ... + +class PGIdentifierPreparer(compiler.IdentifierPreparer): + reserved_words: Any + def format_type(self, type_, use_schema: bool = ...): ... + +class PGInspector(reflection.Inspector): + def get_table_oid(self, table_name, schema: Any | None = ...): ... + def get_enums(self, schema: Any | None = ...): ... + def get_foreign_table_names(self, schema: Any | None = ...): ... + def get_view_names(self, schema: Any | None = ..., include=...): ... + +class CreateEnumType(_CreateDropBase): + __visit_name__: str + +class DropEnumType(_CreateDropBase): + __visit_name__: str + +class PGExecutionContext(default.DefaultExecutionContext): + def fire_sequence(self, seq, type_): ... + def get_insert_default(self, column): ... + def should_autocommit_text(self, statement): ... + +class PGReadOnlyConnectionCharacteristic(characteristics.ConnectionCharacteristic): + transactional: bool + def reset_characteristic(self, dialect, dbapi_conn) -> None: ... + def set_characteristic(self, dialect, dbapi_conn, value) -> None: ... + def get_characteristic(self, dialect, dbapi_conn): ... + +class PGDeferrableConnectionCharacteristic(characteristics.ConnectionCharacteristic): + transactional: bool + def reset_characteristic(self, dialect, dbapi_conn) -> None: ... + def set_characteristic(self, dialect, dbapi_conn, value) -> None: ... + def get_characteristic(self, dialect, dbapi_conn): ... + +class PGDialect(default.DefaultDialect): + name: str + supports_statement_cache: bool + supports_alter: bool + max_identifier_length: int + supports_sane_rowcount: bool + supports_native_enum: bool + supports_native_boolean: bool + supports_smallserial: bool + supports_sequences: bool + sequences_optional: bool + preexecute_autoincrement_sequences: bool + postfetch_lastrowid: bool + supports_comments: bool + supports_default_values: bool + supports_default_metavalue: bool + supports_empty_insert: bool + supports_multivalues_insert: bool + supports_identity_columns: bool + default_paramstyle: str + ischema_names: Any + colspecs: Any + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + preparer: Any + inspector: Any + isolation_level: Any + implicit_returning: bool + full_returning: bool + connection_characteristics: Any + construct_arguments: Any + reflection_options: Any + def __init__( + self, isolation_level: Any | None = ..., json_serializer: Any | None = ..., json_deserializer: Any | None = ..., **kwargs + ) -> None: ... + def initialize(self, connection) -> None: ... + def on_connect(self): ... + def set_isolation_level(self, connection, level) -> None: ... + def get_isolation_level(self, connection): ... + def set_readonly(self, connection, value) -> None: ... + def get_readonly(self, connection) -> None: ... + def set_deferrable(self, connection, value) -> None: ... + def get_deferrable(self, connection) -> None: ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_recover_twophase(self, connection): ... + def has_schema(self, connection, schema): ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] + def has_sequence(self, connection, sequence_name, schema: Any | None = ...): ... # type: ignore[override] + def has_type(self, connection, type_name, schema: Any | None = ...): ... + def get_table_oid(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_schema_names(self, connection, **kw): ... + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_names(self, connection, schema: Any | None = ..., include=..., **kw): ... + def get_sequence_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_definition(self, connection, view_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys( + self, connection, table_name, schema: Any | None = ..., postgresql_ignore_search_path: bool = ..., **kw + ): ... + def get_indexes(self, connection, table_name, schema, **kw): ... + def get_unique_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_table_comment(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_check_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/dml.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/dml.pyi new file mode 100644 index 0000000..cfa9b38 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/dml.pyi @@ -0,0 +1,47 @@ +from typing import Any + +from ...sql.dml import Insert as StandardInsert +from ...sql.elements import ClauseElement +from ...util import memoized_property + +class Insert(StandardInsert): + stringify_dialect: str + inherit_cache: bool + @memoized_property + def excluded(self): ... + def on_conflict_do_update( + self, + constraint: Any | None = ..., + index_elements: Any | None = ..., + index_where: Any | None = ..., + set_: Any | None = ..., + where: Any | None = ..., + ) -> None: ... + def on_conflict_do_nothing( + self, constraint: Any | None = ..., index_elements: Any | None = ..., index_where: Any | None = ... + ) -> None: ... + +insert: Any + +class OnConflictClause(ClauseElement): + stringify_dialect: str + constraint_target: Any + inferred_target_elements: Any + inferred_target_whereclause: Any + def __init__(self, constraint: Any | None = ..., index_elements: Any | None = ..., index_where: Any | None = ...) -> None: ... + +class OnConflictDoNothing(OnConflictClause): + __visit_name__: str + +class OnConflictDoUpdate(OnConflictClause): + __visit_name__: str + update_values_to_set: Any + update_whereclause: Any + def __init__( + self, + constraint: Any | None = ..., + index_elements: Any | None = ..., + index_where: Any | None = ..., + set_: Any | None = ..., + where: Any | None = ..., + ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ext.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ext.pyi new file mode 100644 index 0000000..6fc6506 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ext.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from ...sql import expression +from ...sql.schema import ColumnCollectionConstraint + +class aggregate_order_by(expression.ColumnElement[Any]): + __visit_name__: str + stringify_dialect: str + target: Any + type: Any + order_by: Any + def __init__(self, target, *order_by) -> None: ... + def self_group(self, against: Any | None = ...): ... + def get_children(self, **kwargs): ... + +class ExcludeConstraint(ColumnCollectionConstraint): + __visit_name__: str + where: Any + inherit_cache: bool + create_drop_stringify_dialect: str + operators: Any + using: Any + ops: Any + def __init__(self, *elements, **kw) -> None: ... + +def array_agg(*arg, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi new file mode 100644 index 0000000..4206ae8 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi @@ -0,0 +1,68 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +from ...sql import functions as sqlfunc + +class HSTORE(sqltypes.Indexable, sqltypes.Concatenable, sqltypes.TypeEngine): + __visit_name__: str + hashable: bool + text_type: Any + def __init__(self, text_type: Any | None = ...) -> None: ... + + class Comparator(sqltypes.Indexable.Comparator[Any], sqltypes.Concatenable.Comparator[Any]): + def has_key(self, other): ... + def has_all(self, other): ... + def has_any(self, other): ... + def contains(self, other, **kwargs): ... + def contained_by(self, other): ... + def defined(self, key): ... + def delete(self, key): ... + def slice(self, array): ... + def keys(self): ... + def vals(self): ... + def array(self): ... + def matrix(self): ... + comparator_factory: Any + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class hstore(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreDefinedFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreDeleteFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreSliceFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreKeysFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreValsFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreArrayFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool + +class _HStoreMatrixFunction(sqlfunc.GenericFunction): + type: Any + name: str + inherit_cache: bool diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/json.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/json.pyi new file mode 100644 index 0000000..fe4c63d --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/json.pyi @@ -0,0 +1,27 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +class JSONPathType(sqltypes.JSON.JSONPathType): + def bind_processor(self, dialect): ... + def literal_processor(self, dialect): ... + +class JSON(sqltypes.JSON): + astext_type: Any + def __init__(self, none_as_null: bool = ..., astext_type: Any | None = ...) -> None: ... + + class Comparator(sqltypes.JSON.Comparator): + @property + def astext(self): ... + comparator_factory: Any + +class JSONB(JSON): + __visit_name__: str + + class Comparator(JSON.Comparator): + def has_key(self, other): ... + def has_all(self, other): ... + def has_any(self, other): ... + def contains(self, other, **kwargs): ... + def contained_by(self, other): ... + comparator_factory: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pg8000.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pg8000.pyi new file mode 100644 index 0000000..fc60c10 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pg8000.pyi @@ -0,0 +1,134 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +from .array import ARRAY as PGARRAY +from .base import ENUM, INTERVAL, UUID, PGCompiler, PGDialect, PGExecutionContext, PGIdentifierPreparer +from .json import JSON, JSONB, JSONPathType + +class _PGNumeric(sqltypes.Numeric): + def result_processor(self, dialect, coltype): ... + +class _PGNumericNoBind(_PGNumeric): + def bind_processor(self, dialect) -> None: ... + +class _PGJSON(JSON): + def result_processor(self, dialect, coltype) -> None: ... + def get_dbapi_type(self, dbapi): ... + +class _PGJSONB(JSONB): + def result_processor(self, dialect, coltype) -> None: ... + def get_dbapi_type(self, dbapi): ... + +class _PGJSONIndexType(sqltypes.JSON.JSONIndexType): + def get_dbapi_type(self, dbapi) -> None: ... + +class _PGJSONIntIndexType(sqltypes.JSON.JSONIntIndexType): + def get_dbapi_type(self, dbapi): ... + +class _PGJSONStrIndexType(sqltypes.JSON.JSONStrIndexType): + def get_dbapi_type(self, dbapi): ... + +class _PGJSONPathType(JSONPathType): + def get_dbapi_type(self, dbapi): ... + +class _PGUUID(UUID): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _PGEnum(ENUM): + def get_dbapi_type(self, dbapi): ... + +class _PGInterval(INTERVAL): + def get_dbapi_type(self, dbapi): ... + @classmethod + def adapt_emulated_to_native(cls, interval, **kw): ... + +class _PGTimeStamp(sqltypes.DateTime): + def get_dbapi_type(self, dbapi): ... + +class _PGTime(sqltypes.Time): + def get_dbapi_type(self, dbapi): ... + +class _PGInteger(sqltypes.Integer): + def get_dbapi_type(self, dbapi): ... + +class _PGSmallInteger(sqltypes.SmallInteger): + def get_dbapi_type(self, dbapi): ... + +class _PGNullType(sqltypes.NullType): + def get_dbapi_type(self, dbapi): ... + +class _PGBigInteger(sqltypes.BigInteger): + def get_dbapi_type(self, dbapi): ... + +class _PGBoolean(sqltypes.Boolean): + def get_dbapi_type(self, dbapi): ... + +class _PGARRAY(PGARRAY): + def bind_expression(self, bindvalue): ... + +class PGExecutionContext_pg8000(PGExecutionContext): + def create_server_side_cursor(self): ... + def pre_exec(self) -> None: ... + +class ServerSideCursor: + server_side: bool + ident: Any + cursor: Any + def __init__(self, cursor, ident) -> None: ... + @property + def connection(self): ... + @property + def rowcount(self): ... + @property + def description(self): ... + def execute(self, operation, args=..., stream: Any | None = ...): ... + def executemany(self, operation, param_sets): ... + def fetchone(self): ... + def fetchmany(self, num: Any | None = ...): ... + def fetchall(self): ... + def close(self) -> None: ... + def setinputsizes(self, *sizes) -> None: ... + def setoutputsize(self, size, column: Any | None = ...) -> None: ... + +class PGCompiler_pg8000(PGCompiler): + def visit_mod_binary(self, binary, operator, **kw): ... + +class PGIdentifierPreparer_pg8000(PGIdentifierPreparer): + def __init__(self, *args, **kwargs) -> None: ... + +class PGDialect_pg8000(PGDialect): + driver: str + supports_statement_cache: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + default_paramstyle: str + supports_sane_multi_rowcount: bool + statement_compiler: Any + preparer: Any + supports_server_side_cursors: bool + use_setinputsizes: bool + description_encoding: Any + colspecs: Any + client_encoding: Any + def __init__(self, client_encoding: Any | None = ..., **kwargs) -> None: ... + @classmethod + def dbapi(cls): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + def set_isolation_level(self, connection, level) -> None: ... + def set_readonly(self, connection, value) -> None: ... + def get_readonly(self, connection): ... + def set_deferrable(self, connection, value) -> None: ... + def get_deferrable(self, connection): ... + def set_client_encoding(self, connection, client_encoding) -> None: ... + def do_set_input_sizes(self, cursor, list_of_tuples, context) -> None: ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_recover_twophase(self, connection): ... + def on_connect(self): ... + +dialect = PGDialect_pg8000 diff --git a/stdlib/@python2/distutils/command/bdist_dumb.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/provision.pyi similarity index 100% rename from stdlib/@python2/distutils/command/bdist_dumb.pyi rename to stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/provision.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2.pyi new file mode 100644 index 0000000..7a5fa99 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2.pyi @@ -0,0 +1,95 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +from .array import ARRAY as PGARRAY +from .base import ENUM, UUID, PGCompiler, PGDialect, PGExecutionContext, PGIdentifierPreparer +from .hstore import HSTORE +from .json import JSON, JSONB + +logger: Any + +class _PGNumeric(sqltypes.Numeric): + def bind_processor(self, dialect) -> None: ... + def result_processor(self, dialect, coltype): ... + +class _PGEnum(ENUM): + def result_processor(self, dialect, coltype): ... + +class _PGHStore(HSTORE): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _PGARRAY(PGARRAY): + def bind_expression(self, bindvalue): ... + +class _PGJSON(JSON): + def result_processor(self, dialect, coltype) -> None: ... + +class _PGJSONB(JSONB): + def result_processor(self, dialect, coltype) -> None: ... + +class _PGUUID(UUID): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class PGExecutionContext_psycopg2(PGExecutionContext): + def create_server_side_cursor(self): ... + cursor_fetch_strategy: Any + def post_exec(self) -> None: ... + +class PGCompiler_psycopg2(PGCompiler): ... +class PGIdentifierPreparer_psycopg2(PGIdentifierPreparer): ... + +EXECUTEMANY_PLAIN: Any +EXECUTEMANY_BATCH: Any +EXECUTEMANY_VALUES: Any +EXECUTEMANY_VALUES_PLUS_BATCH: Any + +class PGDialect_psycopg2(PGDialect): + driver: str + supports_statement_cache: bool + supports_unicode_statements: bool + supports_server_side_cursors: bool + default_paramstyle: str + supports_sane_multi_rowcount: bool + statement_compiler: Any + preparer: Any + psycopg2_version: Any + engine_config_types: Any + colspecs: Any + use_native_unicode: Any + use_native_hstore: Any + use_native_uuid: Any + supports_unicode_binds: Any + client_encoding: Any + executemany_mode: Any + insert_executemany_returning: bool + executemany_batch_page_size: Any + executemany_values_page_size: Any + def __init__( + self, + use_native_unicode: bool = ..., + client_encoding: Any | None = ..., + use_native_hstore: bool = ..., + use_native_uuid: bool = ..., + executemany_mode: str = ..., + executemany_batch_page_size: int = ..., + executemany_values_page_size: int = ..., + **kwargs, + ) -> None: ... + def initialize(self, connection) -> None: ... + @classmethod + def dbapi(cls): ... + def set_isolation_level(self, connection, level) -> None: ... + def set_readonly(self, connection, value) -> None: ... + def get_readonly(self, connection): ... + def set_deferrable(self, connection, value) -> None: ... + def get_deferrable(self, connection): ... + def do_ping(self, dbapi_connection): ... + def on_connect(self): ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = PGDialect_psycopg2 diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2cffi.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2cffi.pyi new file mode 100644 index 0000000..4456b32 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2cffi.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from .psycopg2 import PGDialect_psycopg2 + +class PGDialect_psycopg2cffi(PGDialect_psycopg2): + driver: str + supports_unicode_statements: bool + supports_statement_cache: bool + FEATURE_VERSION_MAP: Any + @classmethod + def dbapi(cls): ... + +dialect = PGDialect_psycopg2cffi diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pygresql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pygresql.pyi new file mode 100644 index 0000000..a6f0d86 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pygresql.pyi @@ -0,0 +1,52 @@ +from typing import Any + +from ...types import Numeric +from .base import UUID, PGCompiler, PGDialect, PGIdentifierPreparer +from .hstore import HSTORE +from .json import JSON, JSONB + +class _PGNumeric(Numeric): + def bind_processor(self, dialect) -> None: ... + def result_processor(self, dialect, coltype): ... + +class _PGHStore(HSTORE): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _PGJSON(JSON): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _PGJSONB(JSONB): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _PGUUID(UUID): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _PGCompiler(PGCompiler): + def visit_mod_binary(self, binary, operator, **kw): ... + def post_process_text(self, text): ... + +class _PGIdentifierPreparer(PGIdentifierPreparer): ... + +class PGDialect_pygresql(PGDialect): + driver: str + supports_statement_cache: bool + statement_compiler: Any + preparer: Any + @classmethod + def dbapi(cls): ... + colspecs: Any + dbapi_version: Any + supports_unicode_statements: bool + supports_unicode_binds: bool + has_native_hstore: Any + has_native_json: Any + has_native_uuid: Any + def __init__(self, **kwargs) -> None: ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = PGDialect_pygresql diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pypostgresql.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pypostgresql.pyi new file mode 100644 index 0000000..1b5bed2 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pypostgresql.pyi @@ -0,0 +1,31 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +from ...util import memoized_property +from .base import PGDialect, PGExecutionContext + +class PGNumeric(sqltypes.Numeric): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class PGExecutionContext_pypostgresql(PGExecutionContext): ... + +class PGDialect_pypostgresql(PGDialect): + driver: str + supports_statement_cache: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + description_encoding: Any + default_paramstyle: str + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + colspecs: Any + @classmethod + def dbapi(cls): ... + @memoized_property + def dbapi_exception_translation_map(self): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = PGDialect_pypostgresql diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi new file mode 100644 index 0000000..c31ee1b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi @@ -0,0 +1,36 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +class RangeOperators: + class comparator_factory(sqltypes.Concatenable.Comparator[Any]): + def __ne__(self, other): ... + def contains(self, other, **kw): ... + def contained_by(self, other): ... + def overlaps(self, other): ... + def strictly_left_of(self, other): ... + __lshift__: Any + def strictly_right_of(self, other): ... + __rshift__: Any + def not_extend_right_of(self, other): ... + def not_extend_left_of(self, other): ... + def adjacent_to(self, other): ... + def __add__(self, other): ... + +class INT4RANGE(RangeOperators, sqltypes.TypeEngine): + __visit_name__: str + +class INT8RANGE(RangeOperators, sqltypes.TypeEngine): + __visit_name__: str + +class NUMRANGE(RangeOperators, sqltypes.TypeEngine): + __visit_name__: str + +class DATERANGE(RangeOperators, sqltypes.TypeEngine): + __visit_name__: str + +class TSRANGE(RangeOperators, sqltypes.TypeEngine): + __visit_name__: str + +class TSTZRANGE(RangeOperators, sqltypes.TypeEngine): + __visit_name__: str diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/__init__.pyi new file mode 100644 index 0000000..7dcb0cd --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/__init__.pyi @@ -0,0 +1,45 @@ +from typing import Any + +from .base import ( + BLOB as BLOB, + BOOLEAN as BOOLEAN, + CHAR as CHAR, + DATE as DATE, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + INTEGER as INTEGER, + JSON as JSON, + NUMERIC as NUMERIC, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + VARCHAR as VARCHAR, +) +from .dml import Insert as Insert, insert as insert + +__all__ = ( + "BLOB", + "BOOLEAN", + "CHAR", + "DATE", + "DATETIME", + "DECIMAL", + "FLOAT", + "INTEGER", + "JSON", + "NUMERIC", + "SMALLINT", + "TEXT", + "TIME", + "TIMESTAMP", + "VARCHAR", + "REAL", + "Insert", + "insert", + "dialect", +) + +dialect: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/aiosqlite.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/aiosqlite.pyi new file mode 100644 index 0000000..dfc3247 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/aiosqlite.pyi @@ -0,0 +1,72 @@ +from typing import Any + +from ...engine import AdaptedConnection +from .base import SQLiteExecutionContext +from .pysqlite import SQLiteDialect_pysqlite + +class AsyncAdapt_aiosqlite_cursor: + server_side: bool + await_: Any + arraysize: int + rowcount: int + description: Any + def __init__(self, adapt_connection) -> None: ... + def close(self) -> None: ... + lastrowid: int + def execute(self, operation, parameters: Any | None = ...) -> None: ... + def executemany(self, operation, seq_of_parameters) -> None: ... + def setinputsizes(self, *inputsizes) -> None: ... + def __iter__(self): ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_aiosqlite_ss_cursor(AsyncAdapt_aiosqlite_cursor): + server_side: bool + def __init__(self, *arg, **kw) -> None: ... + def close(self) -> None: ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def fetchall(self): ... + +class AsyncAdapt_aiosqlite_connection(AdaptedConnection): + await_: Any + dbapi: Any + def __init__(self, dbapi, connection) -> None: ... + @property + def isolation_level(self): ... + @isolation_level.setter + def isolation_level(self, value) -> None: ... + def create_function(self, *args, **kw) -> None: ... + def cursor(self, server_side: bool = ...): ... + def execute(self, *args, **kw): ... + def rollback(self) -> None: ... + def commit(self) -> None: ... + def close(self) -> None: ... + +class AsyncAdaptFallback_aiosqlite_connection(AsyncAdapt_aiosqlite_connection): + await_: Any + +class AsyncAdapt_aiosqlite_dbapi: + aiosqlite: Any + sqlite: Any + paramstyle: str + def __init__(self, aiosqlite, sqlite) -> None: ... + def connect(self, *arg, **kw): ... + +class SQLiteExecutionContext_aiosqlite(SQLiteExecutionContext): + def create_server_side_cursor(self): ... + +class SQLiteDialect_aiosqlite(SQLiteDialect_pysqlite): + driver: str + supports_statement_cache: bool + is_async: bool + supports_server_side_cursors: bool + @classmethod + def dbapi(cls): ... + @classmethod + def get_pool_class(cls, url): ... + def is_disconnect(self, e, connection, cursor): ... + def get_driver_connection(self, connection): ... + +dialect = SQLiteDialect_aiosqlite diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/base.pyi new file mode 100644 index 0000000..31efadb --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/base.pyi @@ -0,0 +1,142 @@ +from typing import Any + +import sqlalchemy.types as sqltypes + +from ...engine import default +from ...sql import compiler +from ...types import ( + BLOB as BLOB, + BOOLEAN as BOOLEAN, + CHAR as CHAR, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + INTEGER as INTEGER, + NUMERIC as NUMERIC, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIMESTAMP as TIMESTAMP, + VARCHAR as VARCHAR, +) +from .json import JSON as JSON + +class _SQliteJson(JSON): + def result_processor(self, dialect, coltype): ... + +class _DateTimeMixin: + def __init__(self, storage_format: Any | None = ..., regexp: Any | None = ..., **kw) -> None: ... + @property + def format_is_text_affinity(self): ... + def adapt(self, cls, **kw): ... + def literal_processor(self, dialect): ... + +class DATETIME(_DateTimeMixin, sqltypes.DateTime): + def __init__(self, *args, **kwargs) -> None: ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class DATE(_DateTimeMixin, sqltypes.Date): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class TIME(_DateTimeMixin, sqltypes.Time): + def __init__(self, *args, **kwargs) -> None: ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +colspecs: Any +ischema_names: Any + +class SQLiteCompiler(compiler.SQLCompiler): + extract_map: Any + def visit_now_func(self, fn, **kw): ... + def visit_localtimestamp_func(self, func, **kw): ... + def visit_true(self, expr, **kw): ... + def visit_false(self, expr, **kw): ... + def visit_char_length_func(self, fn, **kw): ... + def visit_cast(self, cast, **kwargs): ... + def visit_extract(self, extract, **kw): ... + def limit_clause(self, select, **kw): ... + def for_update_clause(self, select, **kw): ... + def visit_is_distinct_from_binary(self, binary, operator, **kw): ... + def visit_is_not_distinct_from_binary(self, binary, operator, **kw): ... + def visit_json_getitem_op_binary(self, binary, operator, **kw): ... + def visit_json_path_getitem_op_binary(self, binary, operator, **kw): ... + def visit_empty_set_op_expr(self, type_, expand_op): ... + def visit_empty_set_expr(self, element_types): ... + def visit_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_not_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_on_conflict_do_nothing(self, on_conflict, **kw): ... + def visit_on_conflict_do_update(self, on_conflict, **kw): ... + +class SQLiteDDLCompiler(compiler.DDLCompiler): + def get_column_specification(self, column, **kwargs): ... + def visit_primary_key_constraint(self, constraint): ... + def visit_unique_constraint(self, constraint): ... + def visit_check_constraint(self, constraint): ... + def visit_column_check_constraint(self, constraint): ... + def visit_foreign_key_constraint(self, constraint): ... + def define_constraint_remote_table(self, constraint, table, preparer): ... + def visit_create_index(self, create, include_schema: bool = ..., include_table_schema: bool = ...): ... # type: ignore[override] + def post_create_table(self, table): ... + +class SQLiteTypeCompiler(compiler.GenericTypeCompiler): + def visit_large_binary(self, type_, **kw): ... + def visit_DATETIME(self, type_, **kw): ... + def visit_DATE(self, type_, **kw): ... + def visit_TIME(self, type_, **kw): ... + def visit_JSON(self, type_, **kw): ... + +class SQLiteIdentifierPreparer(compiler.IdentifierPreparer): + reserved_words: Any + +class SQLiteExecutionContext(default.DefaultExecutionContext): ... + +class SQLiteDialect(default.DefaultDialect): + name: str + supports_alter: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + supports_default_values: bool + supports_default_metavalue: bool + supports_empty_insert: bool + supports_cast: bool + supports_multivalues_insert: bool + tuple_in_values: bool + supports_statement_cache: bool + default_paramstyle: str + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + preparer: Any + ischema_names: Any + colspecs: Any + isolation_level: Any + construct_arguments: Any + native_datetime: Any + def __init__( + self, + isolation_level: Any | None = ..., + native_datetime: bool = ..., + json_serializer: Any | None = ..., + json_deserializer: Any | None = ..., + _json_serializer: Any | None = ..., + _json_deserializer: Any | None = ..., + **kwargs, + ) -> None: ... + def set_isolation_level(self, connection, level) -> None: ... + def get_isolation_level(self, connection): ... + def on_connect(self): ... + def get_schema_names(self, connection, **kw): ... + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_temp_table_names(self, connection, **kw): ... + def get_temp_view_names(self, connection, **kw): ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] + def get_view_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_definition(self, connection, view_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_unique_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_check_constraints(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_indexes(self, connection, table_name, schema: Any | None = ..., **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/dml.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/dml.pyi new file mode 100644 index 0000000..208ceca --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/dml.pyi @@ -0,0 +1,35 @@ +from typing import Any + +from ...sql.dml import Insert as StandardInsert +from ...sql.elements import ClauseElement +from ...util import memoized_property + +class Insert(StandardInsert): + stringify_dialect: str + inherit_cache: bool + @memoized_property + def excluded(self): ... + def on_conflict_do_update( + self, index_elements: Any | None = ..., index_where: Any | None = ..., set_: Any | None = ..., where: Any | None = ... + ) -> None: ... + def on_conflict_do_nothing(self, index_elements: Any | None = ..., index_where: Any | None = ...) -> None: ... + +insert: Any + +class OnConflictClause(ClauseElement): + stringify_dialect: str + constraint_target: Any + inferred_target_elements: Any + inferred_target_whereclause: Any + def __init__(self, index_elements: Any | None = ..., index_where: Any | None = ...) -> None: ... + +class OnConflictDoNothing(OnConflictClause): + __visit_name__: str + +class OnConflictDoUpdate(OnConflictClause): + __visit_name__: str + update_values_to_set: Any + update_whereclause: Any + def __init__( + self, index_elements: Any | None = ..., index_where: Any | None = ..., set_: Any | None = ..., where: Any | None = ... + ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/json.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/json.pyi new file mode 100644 index 0000000..2ced3be --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/json.pyi @@ -0,0 +1,10 @@ +from ...types import JSON as _JSON + +class JSON(_JSON): ... + +class _FormatTypeMixin: + def bind_processor(self, dialect): ... + def literal_processor(self, dialect): ... + +class JSONIndexType(_FormatTypeMixin, _JSON.JSONIndexType): ... +class JSONPathType(_FormatTypeMixin, _JSON.JSONPathType): ... diff --git a/stdlib/@python2/distutils/command/bdist_packager.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/provision.pyi similarity index 100% rename from stdlib/@python2/distutils/command/bdist_packager.pyi rename to stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/provision.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlcipher.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlcipher.pyi new file mode 100644 index 0000000..cf2d873 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlcipher.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from .pysqlite import SQLiteDialect_pysqlite + +class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite): + driver: str + supports_statement_cache: bool + pragmas: Any + @classmethod + def dbapi(cls): ... + @classmethod + def get_pool_class(cls, url): ... + def on_connect_url(self, url): ... + def create_connect_args(self, url): ... + +dialect = SQLiteDialect_pysqlcipher diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlite.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlite.pyi new file mode 100644 index 0000000..5703abb --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlite.pyi @@ -0,0 +1,28 @@ +from typing import Any + +from .base import DATE, DATETIME, SQLiteDialect + +class _SQLite_pysqliteTimeStamp(DATETIME): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _SQLite_pysqliteDate(DATE): + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class SQLiteDialect_pysqlite(SQLiteDialect): + default_paramstyle: str + supports_statement_cache: bool + colspecs: Any + description_encoding: Any + driver: str + @classmethod + def dbapi(cls): ... + @classmethod + def get_pool_class(cls, url): ... + def set_isolation_level(self, connection, level): ... + def on_connect(self): ... + def create_connect_args(self, url): ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = SQLiteDialect_pysqlite diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/__init__.pyi new file mode 100644 index 0000000..3b97262 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/__init__.pyi @@ -0,0 +1,58 @@ +from typing import Any + +from .base import ( + BIGINT as BIGINT, + BINARY as BINARY, + BIT as BIT, + CHAR as CHAR, + DATE as DATE, + DATETIME as DATETIME, + FLOAT as FLOAT, + IMAGE as IMAGE, + INT as INT, + INTEGER as INTEGER, + MONEY as MONEY, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + SMALLINT as SMALLINT, + SMALLMONEY as SMALLMONEY, + TEXT as TEXT, + TIME as TIME, + TINYINT as TINYINT, + UNICHAR as UNICHAR, + UNITEXT as UNITEXT, + UNIVARCHAR as UNIVARCHAR, + VARBINARY as VARBINARY, + VARCHAR as VARCHAR, +) + +__all__ = ( + "CHAR", + "VARCHAR", + "TIME", + "NCHAR", + "NVARCHAR", + "TEXT", + "DATE", + "DATETIME", + "FLOAT", + "NUMERIC", + "BIGINT", + "INT", + "INTEGER", + "SMALLINT", + "BINARY", + "VARBINARY", + "UNITEXT", + "UNICHAR", + "UNIVARCHAR", + "IMAGE", + "BIT", + "MONEY", + "SMALLMONEY", + "TINYINT", + "dialect", +) + +dialect: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/base.pyi new file mode 100644 index 0000000..40d48d6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/base.pyi @@ -0,0 +1,135 @@ +from typing import Any + +from sqlalchemy import types as sqltypes +from sqlalchemy.engine import default, reflection +from sqlalchemy.sql import compiler +from sqlalchemy.types import ( + BIGINT as BIGINT, + BINARY as BINARY, + CHAR as CHAR, + DATE as DATE, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + INT as INT, + INTEGER as INTEGER, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + VARBINARY as VARBINARY, + VARCHAR as VARCHAR, + Unicode as Unicode, +) + +RESERVED_WORDS: Any + +class _SybaseUnitypeMixin: + def result_processor(self, dialect, coltype): ... + +class UNICHAR(_SybaseUnitypeMixin, sqltypes.Unicode): + __visit_name__: str + +class UNIVARCHAR(_SybaseUnitypeMixin, sqltypes.Unicode): + __visit_name__: str + +class UNITEXT(_SybaseUnitypeMixin, sqltypes.UnicodeText): + __visit_name__: str + +class TINYINT(sqltypes.Integer): + __visit_name__: str + +class BIT(sqltypes.TypeEngine): + __visit_name__: str + +class MONEY(sqltypes.TypeEngine): + __visit_name__: str + +class SMALLMONEY(sqltypes.TypeEngine): + __visit_name__: str + +class UNIQUEIDENTIFIER(sqltypes.TypeEngine): + __visit_name__: str + +class IMAGE(sqltypes.LargeBinary): + __visit_name__: str + +class SybaseTypeCompiler(compiler.GenericTypeCompiler): + def visit_large_binary(self, type_, **kw): ... + def visit_boolean(self, type_, **kw): ... + def visit_unicode(self, type_, **kw): ... + def visit_UNICHAR(self, type_, **kw): ... + def visit_UNIVARCHAR(self, type_, **kw): ... + def visit_UNITEXT(self, type_, **kw): ... + def visit_TINYINT(self, type_, **kw): ... + def visit_IMAGE(self, type_, **kw): ... + def visit_BIT(self, type_, **kw): ... + def visit_MONEY(self, type_, **kw): ... + def visit_SMALLMONEY(self, type_, **kw): ... + def visit_UNIQUEIDENTIFIER(self, type_, **kw): ... + +ischema_names: Any + +class SybaseInspector(reflection.Inspector): + def __init__(self, conn) -> None: ... + def get_table_id(self, table_name, schema: Any | None = ...): ... + +class SybaseExecutionContext(default.DefaultExecutionContext): + def set_ddl_autocommit(self, connection, value) -> None: ... + def pre_exec(self) -> None: ... + def post_exec(self) -> None: ... + def get_lastrowid(self): ... + +class SybaseSQLCompiler(compiler.SQLCompiler): + ansi_bind_rules: bool + extract_map: Any + def get_from_hint_text(self, table, text): ... + def limit_clause(self, select, **kw): ... + def visit_extract(self, extract, **kw): ... + def visit_now_func(self, fn, **kw): ... + def for_update_clause(self, select): ... + def order_by_clause(self, select, **kw): ... + def delete_table_clause(self, delete_stmt, from_table, extra_froms): ... + def delete_extra_from_clause(self, delete_stmt, from_table, extra_froms, from_hints, **kw): ... + +class SybaseDDLCompiler(compiler.DDLCompiler): + def get_column_specification(self, column, **kwargs): ... + def visit_drop_index(self, drop): ... + +class SybaseIdentifierPreparer(compiler.IdentifierPreparer): + reserved_words: Any + +class SybaseDialect(default.DefaultDialect): + name: str + supports_unicode_statements: bool + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + supports_statement_cache: bool + supports_native_boolean: bool + supports_unicode_binds: bool + postfetch_lastrowid: bool + colspecs: Any + ischema_names: Any + type_compiler: Any + statement_compiler: Any + ddl_compiler: Any + preparer: Any + inspector: Any + construct_arguments: Any + def __init__(self, *args, **kwargs) -> None: ... + max_identifier_length: int + def initialize(self, connection) -> None: ... + def get_table_id(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_indexes(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw): ... + def get_schema_names(self, connection, **kw): ... + def get_table_names(self, connection, schema: Any | None = ..., **kw): ... + def get_view_definition(self, connection, view_name, schema: Any | None = ..., **kw): ... + def get_view_names(self, connection, schema: Any | None = ..., **kw): ... + def has_table(self, connection, table_name, schema: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/mxodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/mxodbc.pyi new file mode 100644 index 0000000..596496e --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/mxodbc.pyi @@ -0,0 +1,9 @@ +from sqlalchemy.connectors.mxodbc import MxODBCConnector +from sqlalchemy.dialects.sybase.base import SybaseDialect, SybaseExecutionContext + +class SybaseExecutionContext_mxodbc(SybaseExecutionContext): ... + +class SybaseDialect_mxodbc(MxODBCConnector, SybaseDialect): + supports_statement_cache: bool + +dialect = SybaseDialect_mxodbc diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/pyodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/pyodbc.pyi new file mode 100644 index 0000000..3940f1f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/pyodbc.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from sqlalchemy import types as sqltypes +from sqlalchemy.connectors.pyodbc import PyODBCConnector +from sqlalchemy.dialects.sybase.base import SybaseDialect, SybaseExecutionContext + +class _SybNumeric_pyodbc(sqltypes.Numeric): + def bind_processor(self, dialect): ... + +class SybaseExecutionContext_pyodbc(SybaseExecutionContext): + def set_ddl_autocommit(self, connection, value) -> None: ... + +class SybaseDialect_pyodbc(PyODBCConnector, SybaseDialect): + supports_statement_cache: bool + colspecs: Any + @classmethod + def dbapi(cls): ... + +dialect = SybaseDialect_pyodbc diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/pysybase.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/pysybase.pyi new file mode 100644 index 0000000..ae8c059 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/sybase/pysybase.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from sqlalchemy import types as sqltypes +from sqlalchemy.dialects.sybase.base import SybaseDialect, SybaseExecutionContext, SybaseSQLCompiler + +class _SybNumeric(sqltypes.Numeric): + def result_processor(self, dialect, type_): ... + +class SybaseExecutionContext_pysybase(SybaseExecutionContext): + def set_ddl_autocommit(self, dbapi_connection, value) -> None: ... + def pre_exec(self) -> None: ... + +class SybaseSQLCompiler_pysybase(SybaseSQLCompiler): + def bindparam_string(self, name, **kw): ... + +class SybaseDialect_pysybase(SybaseDialect): + driver: str + statement_compiler: Any + supports_statement_cache: bool + colspecs: Any + @classmethod + def dbapi(cls): ... + def create_connect_args(self, url): ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def is_disconnect(self, e, connection, cursor): ... + +dialect = SybaseDialect_pysybase diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/__init__.pyi new file mode 100644 index 0000000..48d019b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/__init__.pyi @@ -0,0 +1,46 @@ +from ..sql import ddl as ddl +from . import events as events, util as util +from .base import ( + Connection as Connection, + Engine as Engine, + NestedTransaction as NestedTransaction, + RootTransaction as RootTransaction, + Transaction as Transaction, + TwoPhaseTransaction as TwoPhaseTransaction, +) +from .create import create_engine as create_engine, engine_from_config as engine_from_config +from .cursor import ( + BaseCursorResult as BaseCursorResult, + BufferedColumnResultProxy as BufferedColumnResultProxy, + BufferedColumnRow as BufferedColumnRow, + BufferedRowResultProxy as BufferedRowResultProxy, + CursorResult as CursorResult, + FullyBufferedResultProxy as FullyBufferedResultProxy, + LegacyCursorResult as LegacyCursorResult, + ResultProxy as ResultProxy, +) +from .interfaces import ( + AdaptedConnection as AdaptedConnection, + Compiled as Compiled, + Connectable as Connectable, + CreateEnginePlugin as CreateEnginePlugin, + Dialect as Dialect, + ExceptionContext as ExceptionContext, + ExecutionContext as ExecutionContext, + TypeCompiler as TypeCompiler, +) +from .mock import create_mock_engine as create_mock_engine +from .reflection import Inspector as Inspector +from .result import ( + ChunkedIteratorResult as ChunkedIteratorResult, + FrozenResult as FrozenResult, + IteratorResult as IteratorResult, + MappingResult as MappingResult, + MergedResult as MergedResult, + Result as Result, + ScalarResult as ScalarResult, + result_tuple as result_tuple, +) +from .row import BaseRow as BaseRow, LegacyRow as LegacyRow, Row as Row, RowMapping as RowMapping +from .url import URL as URL, make_url as make_url +from .util import connection_memoize as connection_memoize diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi new file mode 100644 index 0000000..7d9f242 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi @@ -0,0 +1,213 @@ +from _typeshed import Self +from _typeshed.dbapi import DBAPIConnection +from abc import abstractmethod +from collections.abc import Callable, Mapping +from types import TracebackType +from typing import Any, TypeVar, overload +from typing_extensions import Concatenate, ParamSpec, TypeAlias + +from ..log import Identified, _EchoFlag, echo_property +from ..pool import Pool +from ..sql.compiler import Compiled +from ..sql.ddl import DDLElement +from ..sql.elements import ClauseElement +from ..sql.functions import FunctionElement +from ..sql.schema import DefaultGenerator +from .cursor import CursorResult +from .interfaces import Connectable as Connectable, Dialect, ExceptionContext +from .url import URL +from .util import TransactionalContext + +_T = TypeVar("_T") +_P = ParamSpec("_P") + +_Executable: TypeAlias = ClauseElement | FunctionElement | DDLElement | DefaultGenerator | Compiled + +class Connection(Connectable): + engine: Engine + dialect: Dialect + should_close_with_result: bool + dispatch: Any + def __init__( + self, + engine: Engine, + connection: DBAPIConnection | None = ..., + close_with_result: bool = ..., + _branch_from: Any | None = ..., + _execution_options: Any | None = ..., + _dispatch: Any | None = ..., + _has_events: Any | None = ..., + _allow_revalidate: bool = ..., + ) -> None: ... + def schema_for_object(self, obj) -> str | None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + def execution_options(self, **opt): ... + def get_execution_options(self): ... + @property + def closed(self) -> bool: ... + @property + def invalidated(self) -> bool: ... + @property + def connection(self) -> DBAPIConnection: ... + def get_isolation_level(self): ... + @property + def default_isolation_level(self): ... + @property + def info(self): ... + def connect(self, close_with_result: bool = ...): ... # type: ignore[override] + def invalidate(self, exception: Exception | None = ...) -> None: ... + def detach(self) -> None: ... + def begin(self) -> Transaction: ... + def begin_nested(self) -> Transaction | None: ... + def begin_twophase(self, xid: Any | None = ...) -> TwoPhaseTransaction: ... + def recover_twophase(self): ... + def rollback_prepared(self, xid, recover: bool = ...) -> None: ... + def commit_prepared(self, xid, recover: bool = ...) -> None: ... + def in_transaction(self) -> bool: ... + def in_nested_transaction(self) -> bool: ... + def get_transaction(self) -> Transaction | None: ... + def get_nested_transaction(self) -> Transaction | None: ... + def close(self) -> None: ... + @overload + def scalar(self, object_: _Executable, *multiparams: Mapping[str, Any], **params: Any) -> Any: ... + @overload + def scalar(self, object_: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params: Any) -> Any: ... + def scalars(self, object_, *multiparams, **params): ... + @overload # type: ignore[override] + def execute(self, statement: _Executable, *multiparams: Mapping[str, Any], **params) -> CursorResult: ... + @overload + def execute(self, statement: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params) -> CursorResult: ... + def exec_driver_sql(self, statement: str, parameters: Any | None = ..., execution_options: Any | None = ...): ... + def transaction(self, callable_: Callable[Concatenate[Connection, _P], _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... + def run_callable(self, callable_: Callable[Concatenate[Connection, _P], _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... + +class ExceptionContextImpl(ExceptionContext): + engine: Any + connection: Any + sqlalchemy_exception: Any + original_exception: Any + execution_context: Any + statement: Any + parameters: Any + is_disconnect: Any + invalidate_pool_on_disconnect: Any + def __init__( + self, + exception, + sqlalchemy_exception, + engine, + connection, + cursor, + statement, + parameters, + context, + is_disconnect, + invalidate_pool_on_disconnect, + ) -> None: ... + +class Transaction(TransactionalContext): + def __init__(self, connection: Connection) -> None: ... + @property + def is_valid(self) -> bool: ... + def close(self) -> None: ... + def rollback(self) -> None: ... + def commit(self) -> None: ... + # The following field are technically not defined on Transaction, but on + # all sub-classes. + @property + @abstractmethod + def connection(self) -> Connection: ... + @property + @abstractmethod + def is_active(self) -> bool: ... + +class MarkerTransaction(Transaction): + connection: Connection + @property + def is_active(self) -> bool: ... + +class RootTransaction(Transaction): + connection: Connection + is_active: bool + +class NestedTransaction(Transaction): + connection: Connection + is_active: bool + +class TwoPhaseTransaction(RootTransaction): + xid: Any + def __init__(self, connection: Connection, xid) -> None: ... + def prepare(self) -> None: ... + +class Engine(Connectable, Identified): + pool: Pool + url: URL + dialect: Dialect + logging_name: str # only exists if not None during initialization + echo: echo_property + hide_parameters: bool + def __init__( + self, + pool: Pool, + dialect: Dialect, + url: str | URL, + logging_name: str | None = ..., + echo: _EchoFlag = ..., + query_cache_size: int = ..., + execution_options: Mapping[str, Any] | None = ..., + hide_parameters: bool = ..., + ) -> None: ... + @property + def engine(self) -> Engine: ... + def clear_compiled_cache(self) -> None: ... + def update_execution_options(self, **opt) -> None: ... + def execution_options(self, **opt): ... + def get_execution_options(self): ... + @property + def name(self) -> str: ... + @property + def driver(self): ... + def dispose(self, close: bool = ...) -> None: ... + + class _trans_ctx: + conn: Connection + transaction: Transaction + close_with_result: bool + def __init__(self, conn: Connection, transaction: Transaction, close_with_result: bool) -> None: ... + def __enter__(self) -> Connection: ... + def __exit__( + self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + + def begin(self, close_with_result: bool = ...) -> _trans_ctx: ... + def transaction( + self, callable_: Callable[Concatenate[Connection, _P], _T], *args: _P.args, **kwargs: _P.kwargs + ) -> _T | None: ... + def run_callable(self, callable_: Callable[Concatenate[Connection, _P], _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... + @overload # type: ignore[override] + def execute(self, statement: _Executable, *multiparams: Mapping[str, Any], **params: Any) -> CursorResult: ... + @overload + def execute(self, statement: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params: Any) -> CursorResult: ... + @overload # type: ignore[override] + def scalar(self, statement: _Executable, *multiparams: Mapping[str, Any], **params: Any) -> Any: ... + @overload + def scalar(self, statement: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params: Any) -> Any: ... + def connect(self, close_with_result: bool = ...) -> Connection: ... # type: ignore[override] + def table_names(self, schema: Any | None = ..., connection: Connection | None = ...): ... + def has_table(self, table_name: str, schema: Any | None = ...) -> bool: ... + def raw_connection(self, _connection: Connection | None = ...) -> DBAPIConnection: ... + +class OptionEngineMixin: + url: URL + dialect: Dialect + logging_name: str + echo: bool + hide_parameters: bool + dispatch: Any + def __init__(self, proxied, execution_options) -> None: ... + pool: Pool + +class OptionEngine(OptionEngineMixin, Engine): ... # type: ignore[misc] diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/characteristics.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/characteristics.pyi new file mode 100644 index 0000000..ab5b5f6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/characteristics.pyi @@ -0,0 +1,18 @@ +import abc + +from ..util import ABC + +class ConnectionCharacteristic(ABC, metaclass=abc.ABCMeta): + transactional: bool + @abc.abstractmethod + def reset_characteristic(self, dialect, dbapi_conn): ... + @abc.abstractmethod + def set_characteristic(self, dialect, dbapi_conn, value): ... + @abc.abstractmethod + def get_characteristic(self, dialect, dbapi_conn): ... + +class IsolationLevelCharacteristic(ConnectionCharacteristic): + transactional: bool + def reset_characteristic(self, dialect, dbapi_conn) -> None: ... + def set_characteristic(self, dialect, dbapi_conn, value) -> None: ... + def get_characteristic(self, dialect, dbapi_conn): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/create.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/create.pyi new file mode 100644 index 0000000..40c6b29 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/create.pyi @@ -0,0 +1,21 @@ +from collections.abc import Mapping +from typing import Any, overload +from typing_extensions import Literal + +from ..future.engine import Engine as FutureEngine +from .base import Engine +from .mock import MockConnection +from .url import URL + +# Further kwargs are forwarded to the engine, dialect, or pool. +@overload +def create_engine(url: URL | str, *, strategy: Literal["mock"], **kwargs) -> MockConnection: ... # type: ignore[misc] +@overload +def create_engine( + url: URL | str, *, module: Any | None = ..., enable_from_linting: bool = ..., future: Literal[True], **kwargs +) -> FutureEngine: ... +@overload +def create_engine( + url: URL | str, *, module: Any | None = ..., enable_from_linting: bool = ..., future: Literal[False] = ..., **kwargs +) -> Engine: ... +def engine_from_config(configuration: Mapping[str, Any], prefix: str = ..., **kwargs) -> Engine: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/cursor.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/cursor.pyi new file mode 100644 index 0000000..9802908 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/cursor.pyi @@ -0,0 +1,127 @@ +import abc +from typing import Any + +from ..util import memoized_property +from .result import Result, ResultMetaData +from .row import LegacyRow + +MD_INDEX: int +MD_RESULT_MAP_INDEX: int +MD_OBJECTS: int +MD_LOOKUP_KEY: int +MD_RENDERED_NAME: int +MD_PROCESSOR: int +MD_UNTRANSLATED: int + +class CursorResultMetaData(ResultMetaData): + returns_rows: bool + case_sensitive: Any + def __init__(self, parent, cursor_description) -> None: ... + +class LegacyCursorResultMetaData(CursorResultMetaData): ... + +class ResultFetchStrategy: + alternate_cursor_description: Any + def soft_close(self, result, dbapi_cursor) -> None: ... + def hard_close(self, result, dbapi_cursor) -> None: ... + def yield_per(self, result, dbapi_cursor, num) -> None: ... + def fetchone(self, result, dbapi_cursor, hard_close: bool = ...) -> None: ... + def fetchmany(self, result, dbapi_cursor, size: Any | None = ...) -> None: ... + def fetchall(self, result) -> None: ... + def handle_exception(self, result, dbapi_cursor, err) -> None: ... + +class NoCursorFetchStrategy(ResultFetchStrategy): + def soft_close(self, result, dbapi_cursor) -> None: ... + def hard_close(self, result, dbapi_cursor) -> None: ... + def fetchone(self, result, dbapi_cursor, hard_close: bool = ...): ... + def fetchmany(self, result, dbapi_cursor, size: Any | None = ...): ... + def fetchall(self, result, dbapi_cursor): ... + +class NoCursorDQLFetchStrategy(NoCursorFetchStrategy): ... +class NoCursorDMLFetchStrategy(NoCursorFetchStrategy): ... + +class CursorFetchStrategy(ResultFetchStrategy): + def soft_close(self, result, dbapi_cursor) -> None: ... + def hard_close(self, result, dbapi_cursor) -> None: ... + def handle_exception(self, result, dbapi_cursor, err) -> None: ... + def yield_per(self, result, dbapi_cursor, num) -> None: ... + def fetchone(self, result, dbapi_cursor, hard_close: bool = ...): ... + def fetchmany(self, result, dbapi_cursor, size: Any | None = ...): ... + def fetchall(self, result, dbapi_cursor): ... + +class BufferedRowCursorFetchStrategy(CursorFetchStrategy): + def __init__(self, dbapi_cursor, execution_options, growth_factor: int = ..., initial_buffer: Any | None = ...) -> None: ... + @classmethod + def create(cls, result): ... + def yield_per(self, result, dbapi_cursor, num) -> None: ... + def soft_close(self, result, dbapi_cursor) -> None: ... + def hard_close(self, result, dbapi_cursor) -> None: ... + def fetchone(self, result, dbapi_cursor, hard_close: bool = ...): ... + def fetchmany(self, result, dbapi_cursor, size: Any | None = ...): ... + def fetchall(self, result, dbapi_cursor): ... + +class FullyBufferedCursorFetchStrategy(CursorFetchStrategy): + alternate_cursor_description: Any + def __init__(self, dbapi_cursor, alternate_description: Any | None = ..., initial_buffer: Any | None = ...) -> None: ... + def yield_per(self, result, dbapi_cursor, num) -> None: ... + def soft_close(self, result, dbapi_cursor) -> None: ... + def hard_close(self, result, dbapi_cursor) -> None: ... + def fetchone(self, result, dbapi_cursor, hard_close: bool = ...): ... + def fetchmany(self, result, dbapi_cursor, size: Any | None = ...): ... + def fetchall(self, result, dbapi_cursor): ... + +class _NoResultMetaData(ResultMetaData): + returns_rows: bool + @property + def keys(self) -> None: ... + +class _LegacyNoResultMetaData(_NoResultMetaData): + @property + def keys(self): ... + +class BaseCursorResult: + out_parameters: Any + closed: bool + context: Any + dialect: Any + cursor: Any + cursor_strategy: Any + connection: Any + def __init__(self, context, cursor_strategy, cursor_description): ... + @property + def inserted_primary_key_rows(self): ... + @property + def inserted_primary_key(self): ... + def last_updated_params(self): ... + def last_inserted_params(self): ... + @property + def returned_defaults_rows(self): ... + @property + def returned_defaults(self): ... + def lastrow_has_defaults(self): ... + def postfetch_cols(self): ... + def prefetch_cols(self): ... + def supports_sane_rowcount(self): ... + def supports_sane_multi_rowcount(self): ... + @memoized_property + def rowcount(self): ... + @property + def lastrowid(self): ... + @property + def returns_rows(self): ... + @property + def is_insert(self): ... + +class CursorResult(BaseCursorResult, Result): + def merge(self, *others): ... + def close(self) -> None: ... + +class LegacyCursorResult(CursorResult): + def close(self) -> None: ... + +ResultProxy = LegacyCursorResult + +class BufferedRowResultProxy(ResultProxy): ... +class FullyBufferedResultProxy(ResultProxy): ... +class BufferedColumnRow(LegacyRow, metaclass=abc.ABCMeta): ... +class BufferedColumnResultProxy(ResultProxy): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/default.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/default.pyi new file mode 100644 index 0000000..9e521bb --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/default.pyi @@ -0,0 +1,220 @@ +from typing import Any, ClassVar + +from .. import types as sqltypes +from ..util import memoized_property +from . import interfaces + +AUTOCOMMIT_REGEXP: Any +SERVER_SIDE_CURSOR_RE: Any +CACHE_HIT: Any +CACHE_MISS: Any +CACHING_DISABLED: Any +NO_CACHE_KEY: Any +NO_DIALECT_SUPPORT: Any + +class DefaultDialect(interfaces.Dialect): # type: ignore[misc] + execution_ctx_cls: ClassVar[type[interfaces.ExecutionContext]] + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + preparer: Any + supports_alter: bool + supports_comments: bool + inline_comments: bool + use_setinputsizes: bool + supports_statement_cache: bool + default_sequence_base: int + execute_sequence_format: Any + supports_schemas: bool + supports_views: bool + supports_sequences: bool + sequences_optional: bool + preexecute_autoincrement_sequences: bool + supports_identity_columns: bool + postfetch_lastrowid: bool + implicit_returning: bool + full_returning: bool + insert_executemany_returning: bool + cte_follows_insert: bool + supports_native_enum: bool + supports_native_boolean: bool + non_native_boolean_check_constraint: bool + supports_simple_order_by_label: bool + tuple_in_values: bool + connection_characteristics: Any + engine_config_types: Any + supports_native_decimal: bool + supports_unicode_statements: bool + supports_unicode_binds: bool + returns_unicode_strings: Any + description_encoding: Any + name: str + max_identifier_length: int + isolation_level: Any + max_index_name_length: Any + max_constraint_name_length: Any + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + colspecs: Any + default_paramstyle: str + supports_default_values: bool + supports_default_metavalue: bool + supports_empty_insert: bool + supports_multivalues_insert: bool + supports_is_distinct_from: bool + supports_server_side_cursors: bool + server_side_cursors: bool + supports_for_update_of: bool + server_version_info: Any + default_schema_name: Any + construct_arguments: Any + requires_name_normalize: bool + reflection_options: Any + dbapi_exception_translation_map: Any + is_async: bool + CACHE_HIT: Any + CACHE_MISS: Any + CACHING_DISABLED: Any + NO_CACHE_KEY: Any + NO_DIALECT_SUPPORT: Any + convert_unicode: Any + encoding: Any + positional: bool + dbapi: Any + paramstyle: Any + identifier_preparer: Any + case_sensitive: Any + label_length: Any + compiler_linting: Any + def __init__( + self, + convert_unicode: bool = ..., + encoding: str = ..., + paramstyle: Any | None = ..., + dbapi: Any | None = ..., + implicit_returning: Any | None = ..., + case_sensitive: bool = ..., + supports_native_boolean: Any | None = ..., + max_identifier_length: Any | None = ..., + label_length: Any | None = ..., + compiler_linting=..., + server_side_cursors: bool = ..., + **kwargs, + ) -> None: ... + @property + def dialect_description(self): ... + @property + def supports_sane_rowcount_returning(self): ... + @classmethod + def get_pool_class(cls, url): ... + def get_dialect_pool_class(self, url): ... + @classmethod + def load_provisioning(cls) -> None: ... + default_isolation_level: Any + def initialize(self, connection) -> None: ... + def on_connect(self) -> None: ... + def get_default_isolation_level(self, dbapi_conn): ... + def type_descriptor(self, typeobj): ... + def has_index(self, connection, table_name, index_name, schema: Any | None = ...): ... + def validate_identifier(self, ident) -> None: ... + def connect(self, *cargs, **cparams): ... + def create_connect_args(self, url): ... + def set_engine_execution_options(self, engine, opts) -> None: ... + def set_connection_execution_options(self, connection, opts) -> None: ... + def do_begin(self, dbapi_connection) -> None: ... + def do_rollback(self, dbapi_connection) -> None: ... + def do_commit(self, dbapi_connection) -> None: ... + def do_close(self, dbapi_connection) -> None: ... + def do_ping(self, dbapi_connection): ... + def create_xid(self): ... + def do_savepoint(self, connection, name) -> None: ... + def do_rollback_to_savepoint(self, connection, name) -> None: ... + def do_release_savepoint(self, connection, name) -> None: ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_execute(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_execute_no_params(self, cursor, statement, context: Any | None = ...) -> None: ... # type: ignore[override] + def is_disconnect(self, e, connection, cursor): ... + def reset_isolation_level(self, dbapi_conn) -> None: ... + def normalize_name(self, name): ... + def denormalize_name(self, name): ... + def get_driver_connection(self, connection): ... + +class _RendersLiteral: + def literal_processor(self, dialect): ... + +class _StrDateTime(_RendersLiteral, sqltypes.DateTime): ... +class _StrDate(_RendersLiteral, sqltypes.Date): ... +class _StrTime(_RendersLiteral, sqltypes.Time): ... + +class StrCompileDialect(DefaultDialect): # type: ignore[misc] + statement_compiler: Any + ddl_compiler: Any + type_compiler: Any + preparer: Any + supports_statement_cache: bool + supports_identity_columns: bool + supports_sequences: bool + sequences_optional: bool + preexecute_autoincrement_sequences: bool + implicit_returning: bool + supports_native_boolean: bool + supports_multivalues_insert: bool + supports_simple_order_by_label: bool + colspecs: Any + +class DefaultExecutionContext(interfaces.ExecutionContext): + isinsert: bool + isupdate: bool + isdelete: bool + is_crud: bool + is_text: bool + isddl: bool + executemany: bool + compiled: Any + statement: Any + result_column_struct: Any + returned_default_rows: Any + execution_options: Any + include_set_input_sizes: Any + exclude_set_input_sizes: Any + cursor_fetch_strategy: Any + cache_stats: Any + invoked_statement: Any + cache_hit: Any + @memoized_property + def identifier_preparer(self): ... + @memoized_property + def engine(self): ... + @memoized_property + def postfetch_cols(self): ... + @memoized_property + def prefetch_cols(self): ... + @memoized_property + def returning_cols(self) -> None: ... + @memoized_property + def no_parameters(self): ... + @memoized_property + def should_autocommit(self): ... + @property + def connection(self): ... + def should_autocommit_text(self, statement): ... + def create_cursor(self): ... + def create_default_cursor(self): ... + def create_server_side_cursor(self) -> None: ... + def pre_exec(self) -> None: ... + def get_out_parameter_values(self, names) -> None: ... + def post_exec(self) -> None: ... + def get_result_processor(self, type_, colname, coltype): ... + def get_lastrowid(self): ... + def handle_dbapi_exception(self, e) -> None: ... + @property + def rowcount(self): ... + def supports_sane_rowcount(self): ... + def supports_sane_multi_rowcount(self): ... + @memoized_property + def inserted_primary_key_rows(self): ... + def lastrow_has_defaults(self): ... + current_parameters: Any + def get_current_parameters(self, isolate_multiinsert_groups: bool = ...): ... + def get_insert_default(self, column): ... + def get_update_default(self, column): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/events.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/events.pyi new file mode 100644 index 0000000..7cca8b2 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/events.pyi @@ -0,0 +1,29 @@ +from .. import event as event + +class ConnectionEvents(event.Events): + def before_execute(self, conn, clauseelement, multiparams, params, execution_options) -> None: ... + def after_execute(self, conn, clauseelement, multiparams, params, execution_options, result) -> None: ... + def before_cursor_execute(self, conn, cursor, statement, parameters, context, executemany) -> None: ... + def after_cursor_execute(self, conn, cursor, statement, parameters, context, executemany) -> None: ... + def handle_error(self, exception_context) -> None: ... + def engine_connect(self, conn, branch) -> None: ... + def set_connection_execution_options(self, conn, opts) -> None: ... + def set_engine_execution_options(self, engine, opts) -> None: ... + def engine_disposed(self, engine) -> None: ... + def begin(self, conn) -> None: ... + def rollback(self, conn) -> None: ... + def commit(self, conn) -> None: ... + def savepoint(self, conn, name) -> None: ... + def rollback_savepoint(self, conn, name, context) -> None: ... + def release_savepoint(self, conn, name, context) -> None: ... + def begin_twophase(self, conn, xid) -> None: ... + def prepare_twophase(self, conn, xid) -> None: ... + def rollback_twophase(self, conn, xid, is_prepared) -> None: ... + def commit_twophase(self, conn, xid, is_prepared) -> None: ... + +class DialectEvents(event.Events): + def do_connect(self, dialect, conn_rec, cargs, cparams) -> None: ... + def do_executemany(self, cursor, statement, parameters, context) -> None: ... + def do_execute_no_params(self, cursor, statement, context) -> None: ... + def do_execute(self, cursor, statement, parameters, context) -> None: ... + def do_setinputsizes(self, inputsizes, cursor, statement, parameters, context) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/interfaces.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/interfaces.pyi new file mode 100644 index 0000000..4e962d1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/interfaces.pyi @@ -0,0 +1,167 @@ +from _typeshed.dbapi import DBAPIConnection, DBAPICursor +from abc import abstractmethod +from collections.abc import Callable, Collection, Mapping +from typing import Any, ClassVar, overload + +from ..exc import StatementError +from ..sql.compiler import Compiled as Compiled, IdentifierPreparer, TypeCompiler as TypeCompiler +from ..sql.ddl import DDLElement +from ..sql.elements import ClauseElement +from ..sql.functions import FunctionElement +from ..sql.schema import DefaultGenerator +from .base import Connection, Engine +from .cursor import CursorResult +from .url import URL + +class Dialect: + # Sub-classes are required to have the following attributes: + name: str + driver: str + positional: bool + paramstyle: str + encoding: str + statement_compiler: Compiled + ddl_compiler: Compiled + server_version_info: tuple[Any, ...] + # Only available on supporting dialects: + # default_schema_name: str + execution_ctx_cls: ClassVar[type[ExecutionContext]] + execute_sequence_format: type[tuple[Any] | list[Any]] + preparer: IdentifierPreparer + supports_alter: bool + max_identifier_length: int + supports_sane_rowcount: bool + supports_sane_multi_rowcount: bool + preexecute_autoincrement_sequences: bool + implicit_returning: bool + colspecs: dict[Any, Any] + supports_default_values: bool + supports_sequences: bool + sequences_optional: bool + supports_native_enum: bool + supports_native_boolean: bool + dbapi_exception_translation_map: dict[Any, Any] + + supports_statement_cache: bool + @abstractmethod + def create_connect_args(self, url: URL) -> None: ... + def initialize(self, connection) -> None: ... + def on_connect_url(self, url) -> Callable[[DBAPIConnection], object] | None: ... + def on_connect(self) -> Callable[[DBAPIConnection], object] | None: ... + # The following methods all raise NotImplementedError, but not all + # dialects implement all methods, which is why they can't be marked + # as abstract. + @classmethod + def type_descriptor(cls, typeobj) -> None: ... + def get_columns(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def get_pk_constraint(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def get_foreign_keys(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def get_table_names(self, connection, schema: Any | None = ..., **kw) -> None: ... + def get_temp_table_names(self, connection, schema: Any | None = ..., **kw) -> None: ... + def get_view_names(self, connection, schema: Any | None = ..., **kw) -> None: ... + def get_sequence_names(self, connection, schema: Any | None = ..., **kw) -> None: ... + def get_temp_view_names(self, connection, schema: Any | None = ..., **kw) -> None: ... + def get_view_definition(self, connection, view_name, schema: Any | None = ..., **kw) -> None: ... + def get_indexes(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def get_unique_constraints(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def get_check_constraints(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def get_table_comment(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def normalize_name(self, name) -> None: ... + def denormalize_name(self, name) -> None: ... + def has_table(self, connection, table_name, schema: Any | None = ..., **kw) -> None: ... + def has_index(self, connection, table_name, index_name, schema: Any | None = ...) -> None: ... + def has_sequence(self, connection, sequence_name, schema: Any | None = ..., **kw) -> None: ... + def do_begin(self, dbapi_connection) -> None: ... + def do_rollback(self, dbapi_connection) -> None: ... + def do_commit(self, dbapi_connection) -> None: ... + def do_close(self, dbapi_connection) -> None: ... + def do_set_input_sizes(self, cursor, list_of_tuples, context) -> None: ... + def create_xid(self) -> None: ... + def do_savepoint(self, connection, name) -> None: ... + def do_rollback_to_savepoint(self, connection, name) -> None: ... + def do_release_savepoint(self, connection, name) -> None: ... + def do_begin_twophase(self, connection, xid) -> None: ... + def do_prepare_twophase(self, connection, xid) -> None: ... + def do_rollback_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_commit_twophase(self, connection, xid, is_prepared: bool = ..., recover: bool = ...) -> None: ... + def do_recover_twophase(self, connection) -> None: ... + def do_executemany(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_execute(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def do_execute_no_params(self, cursor, statement, parameters, context: Any | None = ...) -> None: ... + def is_disconnect(self, e, connection, cursor) -> None: ... + def connect(self, *cargs, **cparams) -> DBAPIConnection: ... + def reset_isolation_level(self, dbapi_conn) -> None: ... + def set_isolation_level(self, dbapi_conn, level) -> None: ... + def get_isolation_level(self, dbapi_conn) -> None: ... + def get_default_isolation_level(self, dbapi_conn) -> None: ... + @classmethod + def get_dialect_cls(cls, url): ... + @classmethod + def load_provisioning(cls) -> None: ... + @classmethod + def engine_created(cls, engine) -> None: ... + def get_driver_connection(self, connection) -> None: ... + +class CreateEnginePlugin: + url: URL + def __init__(self, url: URL, kwargs) -> None: ... + def update_url(self, url) -> None: ... + def handle_dialect_kwargs(self, dialect_cls, dialect_args) -> None: ... + def handle_pool_kwargs(self, pool_cls, pool_args) -> None: ... + def engine_created(self, engine) -> None: ... + +class ExecutionContext: + def create_cursor(self) -> None: ... + def pre_exec(self) -> None: ... + def get_out_parameter_values(self, out_param_names) -> None: ... + def post_exec(self) -> None: ... + def get_result_cursor_strategy(self, result) -> None: ... + def handle_dbapi_exception(self, e) -> None: ... + def should_autocommit_text(self, statement) -> None: ... + def lastrow_has_defaults(self) -> None: ... + def get_rowcount(self) -> None: ... + +class Connectable: + @abstractmethod + def connect(self, **kwargs) -> Connection: ... + @property + def engine(self) -> Engine | None: ... + @abstractmethod + @overload + def execute( + self, + object_: ClauseElement | FunctionElement | DDLElement | DefaultGenerator | Compiled, + *multiparams: Mapping[str, Any], + **params: Any, + ) -> CursorResult: ... + @abstractmethod + @overload + def execute(self, object_: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params: Any) -> CursorResult: ... + @abstractmethod + @overload + def scalar( + self, + object_: ClauseElement | FunctionElement | DDLElement | DefaultGenerator | Compiled, + *multiparams: Mapping[str, Any], + **params: Any, + ) -> Any: ... + @abstractmethod + @overload + def scalar(self, object_: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params: Any) -> Any: ... + +class ExceptionContext: + connection: Connection | None + engine: Engine | None + cursor: DBAPICursor | None + statement: str | None + parameters: Collection[Any] | None + original_exception: BaseException | None + sqlalchemy_exception: StatementError | None + chained_exception: BaseException | None + execution_context: ExecutionContext | None + is_disconnect: bool | None + invalidate_pool_on_disconnect: bool + +class AdaptedConnection: + @property + def driver_connection(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi new file mode 100644 index 0000000..dc68576 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi @@ -0,0 +1,32 @@ +from _typeshed import Self +from abc import abstractmethod +from collections.abc import Mapping +from typing import Any, overload + +from .base import _Executable +from .cursor import CursorResult +from .interfaces import Connectable, Dialect +from .url import URL + +class MockConnection(Connectable): + def __init__(self, dialect: Dialect, execute) -> None: ... + @property + def engine(self: Self) -> Self: ... # type: ignore[override] + @property + def dialect(self) -> Dialect: ... + @property + def name(self) -> str: ... + def schema_for_object(self, obj): ... + def connect(self, **kwargs): ... + def execution_options(self, **kw): ... + def compiler(self, statement, parameters, **kwargs): ... + def create(self, entity, **kwargs) -> None: ... + def drop(self, entity, **kwargs) -> None: ... + @abstractmethod + @overload + def execute(self, object_: _Executable, *multiparams: Mapping[str, Any], **params: Any) -> CursorResult: ... + @abstractmethod + @overload + def execute(self, object_: str, *multiparams: Any | tuple[Any, ...] | Mapping[str, Any], **params: Any) -> CursorResult: ... + +def create_mock_engine(url: URL | str, executor, **kw) -> MockConnection: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/reflection.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/reflection.pyi new file mode 100644 index 0000000..fcfd262 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/reflection.pyi @@ -0,0 +1,32 @@ +from typing import Any + +def cache(fn, self, con, *args, **kw): ... + +class Inspector: + def __init__(self, bind): ... + @classmethod + def from_engine(cls, bind): ... + @property + def default_schema_name(self): ... + def get_schema_names(self): ... + def get_table_names(self, schema: Any | None = ...): ... + def has_table(self, table_name, schema: Any | None = ...): ... + def has_sequence(self, sequence_name, schema: Any | None = ...): ... + def get_sorted_table_and_fkc_names(self, schema: Any | None = ...): ... + def get_temp_table_names(self): ... + def get_temp_view_names(self): ... + def get_table_options(self, table_name, schema: Any | None = ..., **kw): ... + def get_view_names(self, schema: Any | None = ...): ... + def get_sequence_names(self, schema: Any | None = ...): ... + def get_view_definition(self, view_name, schema: Any | None = ...): ... + def get_columns(self, table_name, schema: Any | None = ..., **kw): ... + def get_pk_constraint(self, table_name, schema: Any | None = ..., **kw): ... + def get_foreign_keys(self, table_name, schema: Any | None = ..., **kw): ... + def get_indexes(self, table_name, schema: Any | None = ..., **kw): ... + def get_unique_constraints(self, table_name, schema: Any | None = ..., **kw): ... + def get_table_comment(self, table_name, schema: Any | None = ..., **kw): ... + def get_check_constraints(self, table_name, schema: Any | None = ..., **kw): ... + def reflecttable(self, *args, **kwargs): ... + def reflect_table( + self, table, include_columns, exclude_columns=..., resolve_fks: bool = ..., _extend_on: Any | None = ... + ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi new file mode 100644 index 0000000..e6bb880 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi @@ -0,0 +1,118 @@ +from _typeshed import Self +from collections.abc import Generator, KeysView +from typing import Any + +from ..sql.base import InPlaceGenerative +from .row import Row + +class ResultMetaData: + @property + def keys(self): ... + +class RMKeyView(KeysView[Any]): + def __init__(self, parent) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __contains__(self, item): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class SimpleResultMetaData(ResultMetaData): + def __init__( + self, + keys, + extra: Any | None = ..., + _processors: Any | None = ..., + _tuplefilter: Any | None = ..., + _translated_indexes: Any | None = ..., + _unique_filters: Any | None = ..., + ) -> None: ... + +def result_tuple(fields, extra: Any | None = ...): ... + +class ResultInternal(InPlaceGenerative): ... + +class _WithKeys: + def keys(self): ... + +class Result(_WithKeys, ResultInternal): + def __init__(self, cursor_metadata) -> None: ... + def close(self) -> None: ... + def yield_per(self: Self, num: int) -> Self: ... + def unique(self: Self, strategy: Any | None = ...) -> Self: ... + def columns(self, *col_expressions): ... + def scalars(self, index: int = ...) -> ScalarResult: ... + def mappings(self) -> MappingResult: ... + def __iter__(self): ... + def __next__(self): ... + def partitions(self, size: int | None = ...) -> Generator[list[Row], None, None]: ... + def fetchall(self) -> list[Row]: ... + def fetchone(self) -> Row | None: ... + def fetchmany(self, size: int | None = ...) -> list[Row]: ... + def all(self) -> list[Row]: ... + def first(self) -> Row | None: ... + def one_or_none(self) -> Row | None: ... + def scalar_one(self) -> Any: ... + def scalar_one_or_none(self) -> Any | None: ... + def one(self) -> Row: ... + def scalar(self) -> Any | None: ... + def freeze(self) -> FrozenResult: ... + def merge(self, *others) -> MergedResult: ... + +class FilterResult(ResultInternal): ... + +class ScalarResult(FilterResult): + def __init__(self, real_result, index) -> None: ... + def unique(self, strategy: Any | None = ...): ... + def partitions(self, size: Any | None = ...) -> None: ... + def fetchall(self): ... + def fetchmany(self, size: Any | None = ...): ... + def all(self): ... + def __iter__(self): ... + def __next__(self): ... + def first(self): ... + def one_or_none(self): ... + def one(self): ... + +class MappingResult(_WithKeys, FilterResult): + def __init__(self, result) -> None: ... + def unique(self, strategy: Any | None = ...): ... + def columns(self, *col_expressions): ... + def partitions(self, size: Any | None = ...) -> None: ... + def fetchall(self): ... + def fetchone(self): ... + def fetchmany(self, size: Any | None = ...): ... + def all(self): ... + def __iter__(self): ... + def __next__(self): ... + def first(self): ... + def one_or_none(self): ... + def one(self): ... + +class FrozenResult: + metadata: Any + data: Any + def __init__(self, result) -> None: ... + def rewrite_rows(self): ... + def with_new_rows(self, tuple_data): ... + def __call__(self): ... + +class IteratorResult(Result): + iterator: Any + raw: Any + def __init__(self, cursor_metadata, iterator, raw: Any | None = ..., _source_supports_scalars: bool = ...) -> None: ... + +def null_result() -> IteratorResult: ... + +class ChunkedIteratorResult(IteratorResult): + chunks: Any + raw: Any + iterator: Any + dynamic_yield_per: Any + def __init__( + self, cursor_metadata, chunks, source_supports_scalars: bool = ..., raw: Any | None = ..., dynamic_yield_per: bool = ... + ) -> None: ... + +class MergedResult(IteratorResult): + closed: bool + def __init__(self, cursor_metadata, results) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/row.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/row.pyi new file mode 100644 index 0000000..2c588e9 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/row.pyi @@ -0,0 +1,57 @@ +import abc +from collections.abc import ItemsView, KeysView, Mapping, Sequence, ValuesView +from typing import Any + +from ..cresultproxy import BaseRow as BaseRow + +MD_INDEX: int + +def rowproxy_reconstructor(cls, state): ... + +KEY_INTEGER_ONLY: int +KEY_OBJECTS_ONLY: int +KEY_OBJECTS_BUT_WARN: int +KEY_OBJECTS_NO_WARN: int + +class Row(BaseRow, Sequence[Any], metaclass=abc.ABCMeta): + @property + def count(self): ... + @property + def index(self): ... + def __contains__(self, key): ... + __hash__ = BaseRow.__hash__ + def __lt__(self, other): ... + def __le__(self, other): ... + def __ge__(self, other): ... + def __gt__(self, other): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def keys(self): ... + +class LegacyRow(Row, metaclass=abc.ABCMeta): + def __contains__(self, key): ... + def has_key(self, key): ... + def items(self): ... + def iterkeys(self): ... + def itervalues(self): ... + def values(self): ... + +BaseRowProxy = BaseRow +RowProxy = Row + +class ROMappingView(KeysView[Any], ValuesView[Any], ItemsView[Any, Any]): + def __init__(self, mapping, items) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __contains__(self, item): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class RowMapping(BaseRow, Mapping[Any, Any]): + __getitem__: Any + def __iter__(self): ... + def __len__(self): ... + def __contains__(self, key): ... + def items(self): ... + def keys(self): ... + def values(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/strategies.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/strategies.pyi new file mode 100644 index 0000000..25239d1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/strategies.pyi @@ -0,0 +1,4 @@ +from typing import Any + +class MockEngineStrategy: + MockConnection: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi new file mode 100644 index 0000000..30625df --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi @@ -0,0 +1,61 @@ +from _typeshed import Self, SupportsItems +from collections.abc import Iterable, Mapping, Sequence +from typing import Any, NamedTuple +from typing_extensions import TypeAlias + +from ..util import immutabledict +from .interfaces import Dialect + +# stub-only helper class +class _URLTuple(NamedTuple): + drivername: str + username: str | None + password: str | object | None # object that produces a password when called with str() + host: str | None + port: int | None + database: str | None + query: immutabledict[str, str | tuple[str, ...]] + +_Query: TypeAlias = Mapping[str, str | Sequence[str]] | Sequence[tuple[str, str | Sequence[str]]] + +class URL(_URLTuple): + @classmethod + def create( + cls, + drivername: str, + username: str | None = ..., + password: str | object | None = ..., # object that produces a password when called with str() + host: str | None = ..., + port: int | None = ..., + database: str | None = ..., + query: _Query | None = ..., + ) -> URL: ... + def set( + self: Self, + drivername: str | None = ..., + username: str | None = ..., + password: str | object | None = ..., + host: str | None = ..., + port: int | None = ..., + database: str | None = ..., + query: _Query | None = ..., + ) -> Self: ... + def update_query_string(self: Self, query_string: str, append: bool = ...) -> Self: ... + def update_query_pairs(self: Self, key_value_pairs: Iterable[tuple[str, str]], append: bool = ...) -> Self: ... + def update_query_dict(self: Self, query_parameters: SupportsItems[str, str | Sequence[str]], append: bool = ...) -> Self: ... + def difference_update_query(self, names: Iterable[str]) -> URL: ... + @property + def normalized_query(self) -> immutabledict[str, tuple[str, ...]]: ... + def __to_string__(self, hide_password: bool = ...) -> str: ... + def render_as_string(self, hide_password: bool = ...) -> str: ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self, memo: object) -> Self: ... + def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def get_backend_name(self) -> str: ... + def get_driver_name(self) -> str: ... + def get_dialect(self) -> type[Dialect]: ... + def translate_connect_args(self, names: list[str] | None = ..., **kw: str) -> dict[str, Any]: ... + +def make_url(name_or_url: str | URL) -> URL: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi new file mode 100644 index 0000000..f711f0c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi @@ -0,0 +1,12 @@ +from _typeshed import Self +from collections.abc import Callable +from types import TracebackType +from typing import Any + +def connection_memoize(key: str) -> Callable[..., Any]: ... + +class TransactionalContext: + def __enter__(self: Self) -> Self: ... + def __exit__( + self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/event/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/event/__init__.pyi new file mode 100644 index 0000000..a0b0fce --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/event/__init__.pyi @@ -0,0 +1,10 @@ +from .api import ( + CANCEL as CANCEL, + NO_RETVAL as NO_RETVAL, + contains as contains, + listen as listen, + listens_for as listens_for, + remove as remove, +) +from .attr import RefCollection as RefCollection +from .base import Events as Events, dispatcher as dispatcher diff --git a/stubs/SQLAlchemy/sqlalchemy/event/api.pyi b/stubs/SQLAlchemy/sqlalchemy/event/api.pyi new file mode 100644 index 0000000..bea12af --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/event/api.pyi @@ -0,0 +1,9 @@ +from typing import Any + +CANCEL: Any +NO_RETVAL: Any + +def listen(target, identifier, fn, *args, **kw) -> None: ... +def listens_for(target, identifier, *args, **kw): ... +def remove(target, identifier, fn) -> None: ... +def contains(target, identifier, fn): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/event/attr.pyi b/stubs/SQLAlchemy/sqlalchemy/event/attr.pyi new file mode 100644 index 0000000..f0d04c8 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/event/attr.pyi @@ -0,0 +1,85 @@ +from typing import Any + +from .. import util + +class RefCollection(util.MemoizedSlots): + ref: Any + +class _empty_collection: + def append(self, element) -> None: ... + def extend(self, other) -> None: ... + def remove(self, element) -> None: ... + def __iter__(self): ... + def clear(self) -> None: ... + +class _ClsLevelDispatch(RefCollection): + name: Any + clsname: Any + arg_names: Any + has_kw: Any + legacy_signatures: Any + def __init__(self, parent_dispatch_cls, fn): ... + def insert(self, event_key, propagate) -> None: ... + def append(self, event_key, propagate) -> None: ... + def update_subclass(self, target) -> None: ... + def remove(self, event_key) -> None: ... + def clear(self) -> None: ... + def for_modify(self, obj): ... + +class _InstanceLevelDispatch(RefCollection): ... + +class _EmptyListener(_InstanceLevelDispatch): + propagate: Any + listeners: Any + parent: Any + parent_listeners: Any + name: Any + def __init__(self, parent, target_cls) -> None: ... + def for_modify(self, obj): ... + exec_once: Any + exec_once_unless_exception: Any + insert: Any + append: Any + remove: Any + clear: Any + def __call__(self, *args, **kw) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __bool__(self): ... + __nonzero__: Any + +class _CompoundListener(_InstanceLevelDispatch): + def exec_once(self, *args, **kw) -> None: ... + def exec_once_unless_exception(self, *args, **kw) -> None: ... + def __call__(self, *args, **kw) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __bool__(self): ... + __nonzero__: Any + +class _ListenerCollection(_CompoundListener): + parent_listeners: Any + parent: Any + name: Any + listeners: Any + propagate: Any + def __init__(self, parent, target_cls) -> None: ... + def for_modify(self, obj): ... + def insert(self, event_key, propagate) -> None: ... + def append(self, event_key, propagate) -> None: ... + def remove(self, event_key) -> None: ... + def clear(self) -> None: ... + +class _JoinedListener(_CompoundListener): + parent: Any + name: Any + local: Any + parent_listeners: Any + def __init__(self, parent, name, local) -> None: ... + @property + def listeners(self): ... + def for_modify(self, obj): ... + def insert(self, event_key, propagate) -> None: ... + def append(self, event_key, propagate) -> None: ... + def remove(self, event_key) -> None: ... + def clear(self) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/event/base.pyi b/stubs/SQLAlchemy/sqlalchemy/event/base.pyi new file mode 100644 index 0000000..4237aa0 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/event/base.pyi @@ -0,0 +1,30 @@ +from typing import Any + +class _UnpickleDispatch: + def __call__(self, _instance_cls): ... + +class _Dispatch: + def __init__(self, parent, instance_cls: Any | None = ...) -> None: ... + def __getattr__(self, name): ... + def __reduce__(self): ... + +class _EventMeta(type): + def __init__(cls, classname, bases, dict_) -> None: ... + +class Events: + dispatch: Any + +class _JoinedDispatcher: + local: Any + parent: Any + def __init__(self, local, parent) -> None: ... + def __getattr__(self, name): ... + +class dispatcher: + dispatch: Any + events: Any + def __init__(self, events) -> None: ... + def __get__(self, obj, cls): ... + +class slots_dispatcher(dispatcher): + def __get__(self, obj, cls): ... diff --git a/stdlib/@python2/distutils/command/bdist_rpm.pyi b/stubs/SQLAlchemy/sqlalchemy/event/legacy.pyi similarity index 100% rename from stdlib/@python2/distutils/command/bdist_rpm.pyi rename to stubs/SQLAlchemy/sqlalchemy/event/legacy.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/event/registry.pyi b/stubs/SQLAlchemy/sqlalchemy/event/registry.pyi new file mode 100644 index 0000000..54fcc63 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/event/registry.pyi @@ -0,0 +1,21 @@ +from typing import Any + +class _EventKey: + target: Any + identifier: Any + fn: Any + fn_key: Any + fn_wrap: Any + dispatch_target: Any + def __init__(self, target, identifier, fn, dispatch_target, _fn_wrap: Any | None = ...) -> None: ... + def with_wrapper(self, fn_wrap): ... + def with_dispatch_target(self, dispatch_target): ... + def listen(self, *args, **kw) -> None: ... + def remove(self) -> None: ... + def contains(self): ... + def base_listen( + self, propagate: bool = ..., insert: bool = ..., named: bool = ..., retval: Any | None = ..., asyncio: bool = ... + ) -> None: ... + def append_to_list(self, owner, list_): ... + def remove_from_list(self, owner, list_) -> None: ... + def prepend_to_list(self, owner, list_): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/events.pyi b/stubs/SQLAlchemy/sqlalchemy/events.pyi new file mode 100644 index 0000000..8bbbfa5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/events.pyi @@ -0,0 +1,4 @@ +from .engine.events import ConnectionEvents as ConnectionEvents, DialectEvents as DialectEvents +from .pool.events import PoolEvents as PoolEvents +from .sql.base import SchemaEventTarget as SchemaEventTarget +from .sql.events import DDLEvents as DDLEvents diff --git a/stubs/SQLAlchemy/sqlalchemy/exc.pyi b/stubs/SQLAlchemy/sqlalchemy/exc.pyi new file mode 100644 index 0000000..b8775e9 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/exc.pyi @@ -0,0 +1,139 @@ +from typing import Any, ClassVar + +class HasDescriptionCode: + code: str | None + def __init__(self, *arg: Any, code: str | None = ..., **kw: Any) -> None: ... + +class SQLAlchemyError(HasDescriptionCode, Exception): + def __unicode__(self) -> str: ... + +class ArgumentError(SQLAlchemyError): ... + +class ObjectNotExecutableError(ArgumentError): + target: Any + def __init__(self, target) -> None: ... + def __reduce__(self): ... + +class NoSuchModuleError(ArgumentError): ... +class NoForeignKeysError(ArgumentError): ... +class AmbiguousForeignKeysError(ArgumentError): ... + +class CircularDependencyError(SQLAlchemyError): + cycles: Any + edges: Any + def __init__(self, message, cycles, edges, msg: Any | None = ..., code: Any | None = ...) -> None: ... + def __reduce__(self): ... + +class CompileError(SQLAlchemyError): ... + +class UnsupportedCompilationError(CompileError): + code: str + compiler: Any + element_type: Any + message: str | None + def __init__(self, compiler, element_type, message: str | None = ...) -> None: ... + def __reduce__(self): ... + +class IdentifierError(SQLAlchemyError): ... + +class DisconnectionError(SQLAlchemyError): + invalidate_pool: bool + +class InvalidatePoolError(DisconnectionError): + invalidate_pool: bool + +class TimeoutError(SQLAlchemyError): ... +class InvalidRequestError(SQLAlchemyError): ... +class NoInspectionAvailable(InvalidRequestError): ... +class PendingRollbackError(InvalidRequestError): ... +class ResourceClosedError(InvalidRequestError): ... +class NoSuchColumnError(InvalidRequestError, KeyError): ... +class NoResultFound(InvalidRequestError): ... +class MultipleResultsFound(InvalidRequestError): ... +class NoReferenceError(InvalidRequestError): ... + +class AwaitRequired(InvalidRequestError): + code: str + +class MissingGreenlet(InvalidRequestError): + code: str + +class NoReferencedTableError(NoReferenceError): + table_name: Any + def __init__(self, message, tname) -> None: ... + def __reduce__(self): ... + +class NoReferencedColumnError(NoReferenceError): + table_name: Any + column_name: Any + def __init__(self, message, tname, cname) -> None: ... + def __reduce__(self): ... + +class NoSuchTableError(InvalidRequestError): ... +class UnreflectableTableError(InvalidRequestError): ... +class UnboundExecutionError(InvalidRequestError): ... +class DontWrapMixin: ... + +class StatementError(SQLAlchemyError): + statement: Any + params: Any + orig: Any + ismulti: Any + hide_parameters: Any + detail: Any + def __init__( + self, message, statement, params, orig, hide_parameters: bool = ..., code: Any | None = ..., ismulti: Any | None = ... + ) -> None: ... + def add_detail(self, msg) -> None: ... + def __reduce__(self): ... + +class DBAPIError(StatementError): + code: str + @classmethod + def instance( + cls, + statement, + params, + orig, + dbapi_base_err, + hide_parameters: bool = ..., + connection_invalidated: bool = ..., + dialect: Any | None = ..., + ismulti: Any | None = ..., + ): ... + def __reduce__(self): ... + connection_invalidated: Any + def __init__( + self, + statement, + params, + orig, + hide_parameters: bool = ..., + connection_invalidated: bool = ..., + code: Any | None = ..., + ismulti: Any | None = ..., + ) -> None: ... + +class InterfaceError(DBAPIError): ... +class DatabaseError(DBAPIError): ... +class DataError(DatabaseError): ... +class OperationalError(DatabaseError): ... +class IntegrityError(DatabaseError): ... +class InternalError(DatabaseError): ... +class ProgrammingError(DatabaseError): ... +class NotSupportedError(DatabaseError): ... + +class SADeprecationWarning(HasDescriptionCode, DeprecationWarning): + deprecated_since: ClassVar[str | None] + +class Base20DeprecationWarning(SADeprecationWarning): + deprecated_since: ClassVar[str] + +class LegacyAPIWarning(Base20DeprecationWarning): ... +class RemovedIn20Warning(Base20DeprecationWarning): ... +class MovedIn20Warning(RemovedIn20Warning): ... + +class SAPendingDeprecationWarning(PendingDeprecationWarning): + deprecated_since: ClassVar[str | None] + +class SAWarning(HasDescriptionCode, RuntimeWarning): ... diff --git a/stdlib/@python2/email/mime/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/__init__.pyi similarity index 100% rename from stdlib/@python2/email/mime/__init__.pyi rename to stubs/SQLAlchemy/sqlalchemy/ext/__init__.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/associationproxy.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/associationproxy.pyi new file mode 100644 index 0000000..f44cbaf --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/associationproxy.pyi @@ -0,0 +1,199 @@ +from typing import Any + +from ..orm import interfaces +from ..sql.operators import ColumnOperators +from ..util import memoized_property + +def association_proxy(target_collection, attr, **kw): ... + +ASSOCIATION_PROXY: Any + +class AssociationProxy(interfaces.InspectionAttrInfo): + is_attribute: bool + extension_type: Any + target_collection: Any + value_attr: Any + creator: Any + getset_factory: Any + proxy_factory: Any + proxy_bulk_set: Any + cascade_scalar_deletes: Any + key: Any + info: Any + def __init__( + self, + target_collection, + attr, + creator: Any | None = ..., + getset_factory: Any | None = ..., + proxy_factory: Any | None = ..., + proxy_bulk_set: Any | None = ..., + info: Any | None = ..., + cascade_scalar_deletes: bool = ..., + ) -> None: ... + def __get__(self, obj, class_): ... + def __set__(self, obj, values): ... + def __delete__(self, obj): ... + def for_class(self, class_, obj: Any | None = ...): ... + +class AssociationProxyInstance: + parent: Any + key: Any + owning_class: Any + target_collection: Any + collection_class: Any + target_class: Any + value_attr: Any + def __init__(self, parent, owning_class, target_class, value_attr) -> None: ... + @classmethod + def for_proxy(cls, parent, owning_class, parent_instance): ... + def __clause_element__(self) -> None: ... + @property + def remote_attr(self): ... + @property + def local_attr(self): ... + @property + def attr(self): ... + @memoized_property + def scalar(self): ... + @property + def info(self): ... + def get(self, obj): ... + def set(self, obj, values) -> None: ... + def delete(self, obj) -> None: ... + def any(self, criterion: Any | None = ..., **kwargs): ... + def has(self, criterion: Any | None = ..., **kwargs): ... + +class AmbiguousAssociationProxyInstance(AssociationProxyInstance): + def get(self, obj): ... + def __eq__(self, obj): ... + def __ne__(self, obj): ... + def any(self, criterion: Any | None = ..., **kwargs) -> None: ... + def has(self, criterion: Any | None = ..., **kwargs) -> None: ... + +class ObjectAssociationProxyInstance(AssociationProxyInstance): + def contains(self, obj): ... + def __eq__(self, obj): ... + def __ne__(self, obj): ... + +class ColumnAssociationProxyInstance(ColumnOperators[Any], AssociationProxyInstance): + def __eq__(self, other) -> ColumnOperators[Any]: ... # type: ignore[override] + def operate(self, op, *other, **kwargs): ... + +class _lazy_collection: + parent: Any + target: Any + def __init__(self, obj, target) -> None: ... + def __call__(self): ... + +class _AssociationCollection: + lazy_collection: Any + creator: Any + getter: Any + setter: Any + parent: Any + def __init__(self, lazy_collection, creator, getter, setter, parent) -> None: ... + @property + def col(self): ... + def __len__(self): ... + def __bool__(self): ... + __nonzero__: Any + +class _AssociationList(_AssociationCollection): + def __getitem__(self, index): ... + def __setitem__(self, index, value) -> None: ... + def __delitem__(self, index) -> None: ... + def __contains__(self, value): ... + def __getslice__(self, start, end): ... + def __setslice__(self, start, end, values) -> None: ... + def __delslice__(self, start, end) -> None: ... + def __iter__(self): ... + def append(self, value) -> None: ... + def count(self, value): ... + def extend(self, values) -> None: ... + def insert(self, index, value) -> None: ... + def pop(self, index: int = ...): ... + def remove(self, value) -> None: ... + def reverse(self) -> None: ... + def sort(self) -> None: ... + def clear(self) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __cmp__(self, other): ... + def __add__(self, iterable): ... + def __radd__(self, iterable): ... + def __mul__(self, n): ... + __rmul__: Any + def __iadd__(self, iterable): ... + def __imul__(self, n): ... + def index(self, item, *args): ... + def copy(self): ... + def __hash__(self): ... + +class _AssociationDict(_AssociationCollection): + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __contains__(self, key): ... + def has_key(self, key): ... + def __iter__(self): ... + def clear(self) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __cmp__(self, other): ... + def get(self, key, default: Any | None = ...): ... + def setdefault(self, key, default: Any | None = ...): ... + def keys(self): ... + def items(self): ... + def values(self): ... + def pop(self, key, default=...): ... + def popitem(self): ... + def update(self, *a, **kw) -> None: ... + def copy(self): ... + def __hash__(self): ... + +class _AssociationSet(_AssociationCollection): + def __len__(self): ... + def __bool__(self): ... + __nonzero__: Any + def __contains__(self, value): ... + def __iter__(self): ... + def add(self, value) -> None: ... + def discard(self, value) -> None: ... + def remove(self, value) -> None: ... + def pop(self): ... + def update(self, other) -> None: ... + def __ior__(self, other): ... # type: ignore[misc] + def union(self, other): ... + __or__: Any + def difference(self, other): ... + __sub__: Any + def difference_update(self, other) -> None: ... + def __isub__(self, other): ... # type: ignore[misc] + def intersection(self, other): ... + __and__: Any + def intersection_update(self, other) -> None: ... + def __iand__(self, other): ... # type: ignore[misc] + def symmetric_difference(self, other): ... + __xor__: Any + def symmetric_difference_update(self, other) -> None: ... + def __ixor__(self, other): ... # type: ignore[misc] + def issubset(self, other): ... + def issuperset(self, other): ... + def clear(self) -> None: ... + def copy(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __hash__(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/__init__.pyi new file mode 100644 index 0000000..e065d74 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/__init__.pyi @@ -0,0 +1,15 @@ +from .engine import ( + AsyncConnection as AsyncConnection, + AsyncEngine as AsyncEngine, + AsyncTransaction as AsyncTransaction, + create_async_engine as create_async_engine, +) +from .events import AsyncConnectionEvents as AsyncConnectionEvents, AsyncSessionEvents as AsyncSessionEvents +from .result import AsyncMappingResult as AsyncMappingResult, AsyncResult as AsyncResult, AsyncScalarResult as AsyncScalarResult +from .scoping import async_scoped_session as async_scoped_session +from .session import ( + AsyncSession as AsyncSession, + AsyncSessionTransaction as AsyncSessionTransaction, + async_object_session as async_object_session, + async_session as async_session, +) diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/base.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/base.pyi new file mode 100644 index 0000000..8c88946 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/base.pyi @@ -0,0 +1,16 @@ +import abc + +class ReversibleProxy: ... + +class StartableContext(abc.ABC, metaclass=abc.ABCMeta): + @abc.abstractmethod + async def start(self, is_ctxmanager: bool = ...): ... + def __await__(self): ... + async def __aenter__(self): ... + @abc.abstractmethod + async def __aexit__(self, type_, value, traceback): ... + +class ProxyComparable(ReversibleProxy): + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/engine.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/engine.pyi new file mode 100644 index 0000000..dbc88f3 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/engine.pyi @@ -0,0 +1,93 @@ +from typing import Any + +from .base import ProxyComparable, StartableContext + +def create_async_engine(*arg, **kw) -> AsyncEngine: ... + +class AsyncConnectable: ... + +class AsyncConnection(ProxyComparable, StartableContext, AsyncConnectable): + engine: Any + sync_engine: Any + sync_connection: Any + def __init__(self, async_engine, sync_connection: Any | None = ...) -> None: ... + async def start(self, is_ctxmanager: bool = ...): ... + @property + def connection(self) -> None: ... + async def get_raw_connection(self): ... + @property + def info(self): ... + def begin(self): ... + def begin_nested(self): ... + async def invalidate(self, exception: Any | None = ...): ... + async def get_isolation_level(self): ... + async def set_isolation_level(self): ... + def in_transaction(self): ... + def in_nested_transaction(self): ... + def get_transaction(self): ... + def get_nested_transaction(self): ... + async def execution_options(self, **opt): ... + async def commit(self) -> None: ... + async def rollback(self) -> None: ... + async def close(self) -> None: ... + async def exec_driver_sql(self, statement, parameters: Any | None = ..., execution_options=...): ... + async def stream(self, statement, parameters: Any | None = ..., execution_options=...): ... + async def execute(self, statement, parameters: Any | None = ..., execution_options=...): ... + async def scalar(self, statement, parameters: Any | None = ..., execution_options=...): ... + async def scalars(self, statement, parameters: Any | None = ..., execution_options=...): ... + async def stream_scalars(self, statement, parameters: Any | None = ..., execution_options=...): ... + async def run_sync(self, fn, *arg, **kw): ... + def __await__(self): ... + async def __aexit__(self, type_, value, traceback) -> None: ... + # proxied from Connection + dialect: Any + @property + def closed(self): ... + @property + def invalidated(self): ... + @property + def default_isolation_level(self): ... + +class AsyncEngine(ProxyComparable, AsyncConnectable): + class _trans_ctx(StartableContext): + conn: Any + def __init__(self, conn) -> None: ... + transaction: Any + async def start(self, is_ctxmanager: bool = ...): ... + async def __aexit__(self, type_, value, traceback) -> None: ... + sync_engine: Any + def __init__(self, sync_engine) -> None: ... + def begin(self): ... + def connect(self): ... + async def raw_connection(self): ... + def execution_options(self, **opt): ... + async def dispose(self): ... + # proxied from Engine + url: Any + pool: Any + dialect: Any + echo: Any + @property + def engine(self): ... + @property + def name(self): ... + @property + def driver(self): ... + def clear_compiled_cache(self) -> None: ... + def update_execution_options(self, **opt) -> None: ... + def get_execution_options(self): ... + +class AsyncTransaction(ProxyComparable, StartableContext): + connection: Any + sync_transaction: Any + nested: Any + def __init__(self, connection, nested: bool = ...) -> None: ... + @property + def is_valid(self): ... + @property + def is_active(self): ... + async def close(self) -> None: ... + async def rollback(self) -> None: ... + async def commit(self) -> None: ... + async def start(self, is_ctxmanager: bool = ...): ... + async def __aexit__(self, type_, value, traceback) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/events.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/events.pyi new file mode 100644 index 0000000..e9a8bf1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/events.pyi @@ -0,0 +1,5 @@ +from ...engine import events as engine_event +from ...orm import events as orm_event + +class AsyncConnectionEvents(engine_event.ConnectionEvents): ... +class AsyncSessionEvents(orm_event.SessionEvents): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/exc.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/exc.pyi new file mode 100644 index 0000000..56f3b63 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/exc.pyi @@ -0,0 +1,5 @@ +from ...exc import InvalidRequestError + +class AsyncMethodRequired(InvalidRequestError): ... +class AsyncContextNotStarted(InvalidRequestError): ... +class AsyncContextAlreadyStarted(InvalidRequestError): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/result.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/result.pyi new file mode 100644 index 0000000..c04258a --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/result.pyi @@ -0,0 +1,57 @@ +from typing import Any + +from ...engine.result import FilterResult + +class AsyncCommon(FilterResult): + async def close(self) -> None: ... + +class AsyncResult(AsyncCommon): + def __init__(self, real_result) -> None: ... + def keys(self): ... + def unique(self, strategy: Any | None = ...): ... + def columns(self, *col_expressions): ... + async def partitions(self, size: Any | None = ...) -> None: ... + async def fetchone(self): ... + async def fetchmany(self, size: Any | None = ...): ... + async def all(self): ... + def __aiter__(self): ... + async def __anext__(self): ... + async def first(self): ... + async def one_or_none(self): ... + async def scalar_one(self): ... + async def scalar_one_or_none(self): ... + async def one(self): ... + async def scalar(self): ... + async def freeze(self): ... + def merge(self, *others): ... + def scalars(self, index: int = ...): ... + def mappings(self): ... + +class AsyncScalarResult(AsyncCommon): + def __init__(self, real_result, index) -> None: ... + def unique(self, strategy: Any | None = ...): ... + async def partitions(self, size: Any | None = ...) -> None: ... + async def fetchall(self): ... + async def fetchmany(self, size: Any | None = ...): ... + async def all(self): ... + def __aiter__(self): ... + async def __anext__(self): ... + async def first(self): ... + async def one_or_none(self): ... + async def one(self): ... + +class AsyncMappingResult(AsyncCommon): + def __init__(self, result) -> None: ... + def keys(self): ... + def unique(self, strategy: Any | None = ...): ... + def columns(self, *col_expressions): ... + async def partitions(self, size: Any | None = ...) -> None: ... + async def fetchall(self): ... + async def fetchone(self): ... + async def fetchmany(self, size: Any | None = ...): ... + async def all(self): ... + def __aiter__(self): ... + async def __anext__(self): ... + async def first(self): ... + async def one_or_none(self): ... + async def one(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/scoping.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/scoping.pyi new file mode 100644 index 0000000..90e44bc --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/scoping.pyi @@ -0,0 +1,76 @@ +from typing import Any + +from ...orm.scoping import ScopedSessionMixin +from ...util import memoized_property + +class async_scoped_session(ScopedSessionMixin): + session_factory: Any + registry: Any + def __init__(self, session_factory, scopefunc) -> None: ... + async def remove(self) -> None: ... + # proxied from Session + @classmethod + async def close_all(cls): ... + @classmethod + def identity_key(cls, *args, **kwargs): ... + @classmethod + def object_session(cls, instance): ... + bind: Any + identity_map: Any + autoflush: Any + def __contains__(self, instance): ... + def __iter__(self): ... + def add(self, instance, _warn: bool = ...) -> None: ... + def add_all(self, instances) -> None: ... + def begin(self, **kw): ... + def begin_nested(self, **kw): ... + async def close(self): ... + async def commit(self): ... + async def connection(self, **kw): ... + async def delete(self, instance): ... + async def execute( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + def expire(self, instance, attribute_names: Any | None = ...) -> None: ... + def expire_all(self) -> None: ... + def expunge(self, instance) -> None: ... + def expunge_all(self) -> None: ... + async def flush(self, objects: Any | None = ...) -> None: ... + async def get( + self, + entity, + ident, + options: Any | None = ..., + populate_existing: bool = ..., + with_for_update: Any | None = ..., + identity_token: Any | None = ..., + ): ... + def get_bind(self, mapper: Any | None = ..., clause: Any | None = ..., bind: Any | None = ..., **kw): ... + def is_modified(self, instance, include_collections: bool = ...): ... + async def merge(self, instance, load: bool = ..., options: Any | None = ...): ... + async def refresh(self, instance, attribute_names: Any | None = ..., with_for_update: Any | None = ...): ... + async def rollback(self): ... + async def scalar( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def scalars( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def stream( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def stream_scalars( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + @property + def dirty(self): ... + @property + def deleted(self): ... + @property + def new(self): ... + @property + def is_active(self): ... + @property + def no_autoflush(self) -> None: ... + @memoized_property + def info(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi new file mode 100644 index 0000000..3b8a3c0 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi @@ -0,0 +1,107 @@ +from _typeshed import Self +from typing import Any + +from ...util import memoized_property +from .base import ReversibleProxy, StartableContext + +class AsyncSession(ReversibleProxy): + dispatch: Any + bind: Any + binds: Any + sync_session_class: Any + sync_session: Any + def __init__(self, bind: Any | None = ..., binds: Any | None = ..., sync_session_class: Any | None = ..., **kw) -> None: ... + async def refresh(self, instance, attribute_names: Any | None = ..., with_for_update: Any | None = ...): ... + async def run_sync(self, fn, *arg, **kw): ... + async def execute( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def scalar( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def scalars( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def get( + self, + entity, + ident, + options: Any | None = ..., + populate_existing: bool = ..., + with_for_update: Any | None = ..., + identity_token: Any | None = ..., + ): ... + async def stream( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def stream_scalars( + self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw + ): ... + async def delete(self, instance): ... + async def merge(self, instance, load: bool = ..., options: Any | None = ...): ... + async def flush(self, objects: Any | None = ...) -> None: ... + def get_transaction(self): ... + def get_nested_transaction(self): ... + def get_bind(self, mapper: Any | None = ..., clause: Any | None = ..., bind: Any | None = ..., **kw): ... + async def connection(self, **kw): ... + def begin(self, **kw): ... + def begin_nested(self, **kw): ... + async def rollback(self): ... + async def commit(self): ... + async def close(self): ... + @classmethod + async def close_all(cls): ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__(self, type_, value, traceback) -> None: ... + # proxied from Session + identity_map: Any + autoflush: Any + @classmethod + def identity_key(cls, *args, **kwargs): ... + @classmethod + def object_session(cls, instance): ... + def __contains__(self, instance): ... + def __iter__(self): ... + def add(self, instance, _warn: bool = ...) -> None: ... + def add_all(self, instances) -> None: ... + def expire(self, instance, attribute_names: Any | None = ...) -> None: ... + def expire_all(self) -> None: ... + def expunge(self, instance) -> None: ... + def expunge_all(self) -> None: ... + def is_modified(self, instance, include_collections: bool = ...): ... + def in_transaction(self): ... + def in_nested_transaction(self): ... + @property + def no_autoflush(self) -> None: ... + @property + def is_active(self): ... + @property + def dirty(self): ... + @property + def deleted(self): ... + @property + def new(self): ... + @memoized_property + def info(self): ... + +class _AsyncSessionContextManager: + async_session: Any + def __init__(self, async_session) -> None: ... + trans: Any + async def __aenter__(self): ... + async def __aexit__(self, type_, value, traceback) -> None: ... + +class AsyncSessionTransaction(ReversibleProxy, StartableContext): + session: Any + nested: Any + sync_transaction: Any + def __init__(self, session, nested: bool = ...) -> None: ... + @property + def is_active(self): ... + async def rollback(self) -> None: ... + async def commit(self) -> None: ... + async def start(self, is_ctxmanager: bool = ...): ... + async def __aexit__(self, type_, value, traceback) -> None: ... + +def async_object_session(instance): ... +def async_session(session): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/automap.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/automap.pyi new file mode 100644 index 0000000..13b7099 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/automap.pyi @@ -0,0 +1,26 @@ +from typing import Any + +def classname_for_table(base, tablename, table): ... +def name_for_scalar_relationship(base, local_cls, referred_cls, constraint): ... +def name_for_collection_relationship(base, local_cls, referred_cls, constraint): ... +def generate_relationship(base, direction, return_fn, attrname, local_cls, referred_cls, **kw): ... + +class AutomapBase: + __abstract__: bool + classes: Any + @classmethod + def prepare( + cls, + autoload_with: Any | None = ..., + engine: Any | None = ..., + reflect: bool = ..., + schema: Any | None = ..., + classname_for_table: Any | None = ..., + collection_class: Any | None = ..., + name_for_scalar_relationship: Any | None = ..., + name_for_collection_relationship: Any | None = ..., + generate_relationship: Any | None = ..., + reflection_options=..., + ) -> None: ... + +def automap_base(declarative_base: Any | None = ..., **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/baked.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/baked.pyi new file mode 100644 index 0000000..664c226 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/baked.pyi @@ -0,0 +1,45 @@ +from typing import Any + +log: Any + +class Bakery: + cls: Any + cache: Any + def __init__(self, cls_, cache) -> None: ... + def __call__(self, initial_fn, *args): ... + +class BakedQuery: + steps: Any + def __init__(self, bakery, initial_fn, args=...) -> None: ... + @classmethod + def bakery(cls, size: int = ..., _size_alert: Any | None = ...): ... + def __iadd__(self, other): ... + def __add__(self, other): ... + def add_criteria(self, fn, *args): ... + def with_criteria(self, fn, *args): ... + def for_session(self, session): ... + def __call__(self, session): ... + def spoil(self, full: bool = ...): ... + def to_query(self, query_or_session): ... + +class Result: + bq: Any + session: Any + def __init__(self, bq, session) -> None: ... + def params(self, *args, **kw): ... + def with_post_criteria(self, fn): ... + def __iter__(self): ... + def count(self): ... + def scalar(self): ... + def first(self): ... + def one(self): ... + def one_or_none(self): ... + def all(self): ... + def get(self, ident): ... + +def bake_lazy_loaders() -> None: ... +def unbake_lazy_loaders() -> None: ... + +baked_lazyload: Any +baked_lazyload_all: Any +bakery: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/compiler.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/compiler.pyi new file mode 100644 index 0000000..79b29ee --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/compiler.pyi @@ -0,0 +1,8 @@ +from typing import Any + +def compiles(class_, *specs): ... +def deregister(class_) -> None: ... + +class _dispatcher: + specs: Any + def __call__(self, element, compiler, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/declarative/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/declarative/__init__.pyi new file mode 100644 index 0000000..7eddf86 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/declarative/__init__.pyi @@ -0,0 +1,27 @@ +from ...orm.decl_api import ( + DeclarativeMeta as DeclarativeMeta, + as_declarative as as_declarative, + declarative_base as declarative_base, + declared_attr as declared_attr, + has_inherited_table as has_inherited_table, + synonym_for as synonym_for, +) +from .extensions import ( + AbstractConcreteBase as AbstractConcreteBase, + ConcreteBase as ConcreteBase, + DeferredReflection as DeferredReflection, + instrument_declarative as instrument_declarative, +) + +__all__ = [ + "declarative_base", + "synonym_for", + "has_inherited_table", + "instrument_declarative", + "declared_attr", + "as_declarative", + "ConcreteBase", + "AbstractConcreteBase", + "DeclarativeMeta", + "DeferredReflection", +] diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/declarative/extensions.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/declarative/extensions.pyi new file mode 100644 index 0000000..c4fbf0f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/declarative/extensions.pyi @@ -0,0 +1,14 @@ +def instrument_declarative(cls, cls_registry, metadata) -> None: ... + +class ConcreteBase: + @classmethod + def __declare_first__(cls) -> None: ... + +class AbstractConcreteBase(ConcreteBase): + __no_table__: bool + @classmethod + def __declare_first__(cls) -> None: ... + +class DeferredReflection: + @classmethod + def prepare(cls, engine) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/horizontal_shard.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/horizontal_shard.pyi new file mode 100644 index 0000000..b217b31 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/horizontal_shard.pyi @@ -0,0 +1,25 @@ +from typing import Any, Generic, TypeVar + +from ..orm.query import Query +from ..orm.session import Session + +_T = TypeVar("_T") + +class ShardedQuery(Query[_T], Generic[_T]): + id_chooser: Any + query_chooser: Any + execute_chooser: Any + def __init__(self, *args, **kwargs) -> None: ... + def set_shard(self, shard_id): ... + +class ShardedSession(Session): + shard_chooser: Any + id_chooser: Any + execute_chooser: Any + query_chooser: Any + def __init__( + self, shard_chooser, id_chooser, execute_chooser: Any | None = ..., shards: Any | None = ..., query_cls=..., **kwargs + ): ... + def connection_callable(self, mapper: Any | None = ..., instance: Any | None = ..., shard_id: Any | None = ..., **kwargs): ... + def get_bind(self, mapper: Any | None = ..., shard_id: Any | None = ..., instance: Any | None = ..., clause: Any | None = ..., **kw): ... # type: ignore[override] + def bind_shard(self, shard_id, bind) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/hybrid.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/hybrid.pyi new file mode 100644 index 0000000..5c3c186 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/hybrid.pyi @@ -0,0 +1,67 @@ +from typing import Any + +from ..orm import interfaces + +HYBRID_METHOD: Any +HYBRID_PROPERTY: Any + +class hybrid_method(interfaces.InspectionAttrInfo): + is_attribute: bool + extension_type: Any + func: Any + def __init__(self, func, expr: Any | None = ...) -> None: ... + def __get__(self, instance, owner): ... + expr: Any + def expression(self, expr): ... + +class hybrid_property(interfaces.InspectionAttrInfo): + is_attribute: bool + extension_type: Any + fget: Any + fset: Any + fdel: Any + expr: Any + custom_comparator: Any + update_expr: Any + def __init__( + self, + fget, + fset: Any | None = ..., + fdel: Any | None = ..., + expr: Any | None = ..., + custom_comparator: Any | None = ..., + update_expr: Any | None = ..., + ) -> None: ... + def __get__(self, instance, owner): ... + def __set__(self, instance, value) -> None: ... + def __delete__(self, instance) -> None: ... + @property + def overrides(self): ... + def getter(self, fget): ... + def setter(self, fset): ... + def deleter(self, fdel): ... + def expression(self, expr): ... + def comparator(self, comparator): ... + def update_expression(self, meth): ... + +class Comparator(interfaces.PropComparator[Any]): + property: Any + expression: Any + def __init__(self, expression) -> None: ... + def __clause_element__(self): ... + def adapt_to_entity(self, adapt_to_entity): ... + +_property = property + +class ExprComparator(Comparator): + cls: Any + expression: Any + hybrid: Any + def __init__(self, cls, expression, hybrid) -> None: ... + def __getattr__(self, key): ... + @_property + def info(self): ... + @_property + def property(self): ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/indexable.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/indexable.pyi new file mode 100644 index 0000000..0150ec7 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/indexable.pyi @@ -0,0 +1,15 @@ +from typing import Any + +from ..ext.hybrid import hybrid_property + +class index_property(hybrid_property): + attr_name: Any + index: Any + default: Any + datatype: Any + onebased: Any + def __init__(self, attr_name, index, default=..., datatype: Any | None = ..., mutable: bool = ..., onebased: bool = ...): ... + def fget(self, instance): ... + def fset(self, instance, value) -> None: ... + def fdel(self, instance) -> None: ... + def expr(self, model): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/instrumentation.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/instrumentation.pyi new file mode 100644 index 0000000..6420c91 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/instrumentation.pyi @@ -0,0 +1,54 @@ +from typing import Any + +from ..orm.instrumentation import ClassManager, InstrumentationFactory + +INSTRUMENTATION_MANAGER: str + +def find_native_user_instrumentation_hook(cls): ... + +instrumentation_finders: Any + +class ExtendedInstrumentationRegistry(InstrumentationFactory): + def unregister(self, class_) -> None: ... + def manager_of_class(self, cls): ... + def state_of(self, instance): ... + def dict_of(self, instance): ... + +class InstrumentationManager: + def __init__(self, class_) -> None: ... + def manage(self, class_, manager) -> None: ... + def unregister(self, class_, manager) -> None: ... + def manager_getter(self, class_): ... + def instrument_attribute(self, class_, key, inst) -> None: ... + def post_configure_attribute(self, class_, key, inst) -> None: ... + def install_descriptor(self, class_, key, inst) -> None: ... + def uninstall_descriptor(self, class_, key) -> None: ... + def install_member(self, class_, key, implementation) -> None: ... + def uninstall_member(self, class_, key) -> None: ... + def instrument_collection_class(self, class_, key, collection_class): ... + def get_instance_dict(self, class_, instance): ... + def initialize_instance_dict(self, class_, instance) -> None: ... + def install_state(self, class_, instance, state) -> None: ... + def remove_state(self, class_, instance) -> None: ... + def state_getter(self, class_): ... + def dict_getter(self, class_): ... + +class _ClassInstrumentationAdapter(ClassManager): + def __init__(self, class_, override) -> None: ... + def manage(self) -> None: ... + def unregister(self) -> None: ... + def manager_getter(self): ... + def instrument_attribute(self, key, inst, propagated: bool = ...) -> None: ... + def post_configure_attribute(self, key) -> None: ... + def install_descriptor(self, key, inst) -> None: ... + def uninstall_descriptor(self, key) -> None: ... + def install_member(self, key, implementation) -> None: ... + def uninstall_member(self, key) -> None: ... + def instrument_collection_class(self, key, collection_class): ... + def initialize_collection(self, key, state, factory): ... + def new_instance(self, state: Any | None = ...): ... + def setup_instance(self, instance, state: Any | None = ...): ... + def teardown_instance(self, instance) -> None: ... + def has_state(self, instance): ... + def state_getter(self): ... + def dict_getter(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mutable.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mutable.pyi new file mode 100644 index 0000000..c1e4be4 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mutable.pyi @@ -0,0 +1,64 @@ +from typing import Any + +class MutableBase: + @classmethod + def coerce(cls, key, value) -> None: ... + +class Mutable(MutableBase): + def changed(self) -> None: ... + @classmethod + def associate_with_attribute(cls, attribute) -> None: ... + @classmethod + def associate_with(cls, sqltype) -> None: ... + @classmethod + def as_mutable(cls, sqltype): ... + +class MutableComposite(MutableBase): + def changed(self) -> None: ... + +class MutableDict(Mutable, dict[Any, Any]): + def __setitem__(self, key, value) -> None: ... + def setdefault(self, key, value): ... + def __delitem__(self, key) -> None: ... + def update(self, *a, **kw) -> None: ... + def pop(self, *arg): ... + def popitem(self): ... + def clear(self) -> None: ... + @classmethod + def coerce(cls, key, value): ... + +class MutableList(Mutable, list[Any]): + def __reduce_ex__(self, proto): ... + def __setitem__(self, index, value) -> None: ... + def __setslice__(self, start, end, value) -> None: ... + def __delitem__(self, index) -> None: ... + def __delslice__(self, start, end) -> None: ... + def pop(self, *arg): ... + def append(self, x) -> None: ... + def extend(self, x) -> None: ... + def __iadd__(self, x): ... # type: ignore[misc] + def insert(self, i, x) -> None: ... + def remove(self, i) -> None: ... + def clear(self) -> None: ... + def sort(self, **kw) -> None: ... + def reverse(self) -> None: ... + @classmethod + def coerce(cls, index, value): ... + +class MutableSet(Mutable, set[Any]): + def update(self, *arg) -> None: ... + def intersection_update(self, *arg) -> None: ... + def difference_update(self, *arg) -> None: ... + def symmetric_difference_update(self, *arg) -> None: ... + def __ior__(self, other): ... # type: ignore[misc] + def __iand__(self, other): ... # type: ignore[misc] + def __ixor__(self, other): ... # type: ignore[misc] + def __isub__(self, other): ... # type: ignore[misc] + def add(self, elem) -> None: ... + def remove(self, elem) -> None: ... + def discard(self, elem) -> None: ... + def pop(self, *arg): ... + def clear(self) -> None: ... + @classmethod + def coerce(cls, index, value): ... + def __reduce_ex__(self, proto): ... diff --git a/stdlib/@python2/lib2to3/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/__init__.pyi similarity index 100% rename from stdlib/@python2/lib2to3/__init__.pyi rename to stubs/SQLAlchemy/sqlalchemy/ext/mypy/__init__.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi new file mode 100644 index 0000000..651f37c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi @@ -0,0 +1,27 @@ +from typing import Any +from typing_extensions import TypeAlias + +from . import util + +_AssignmentStmt: TypeAlias = Any # mypy.nodes.AssignmentStmt +_NameExpr: TypeAlias = Any # mypy.nodes.NameExpr +_StrExpr: TypeAlias = Any # mypy.nodes.StrExpr +_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface +_ProperType: TypeAlias = Any # mypy.types.ProperType + +def apply_mypy_mapped_attr( + cls, api: _SemanticAnalyzerPluginInterface, item: _NameExpr | _StrExpr, attributes: list[util.SQLAlchemyAttribute] +) -> None: ... +def re_apply_declarative_assignments( + cls, api: _SemanticAnalyzerPluginInterface, attributes: list[util.SQLAlchemyAttribute] +) -> None: ... +def apply_type_to_mapped_statement( + api: _SemanticAnalyzerPluginInterface, + stmt: _AssignmentStmt, + lvalue: _NameExpr, + left_hand_explicit_type: _ProperType | None, + python_type_for_type: _ProperType | None, +) -> None: ... +def add_additional_orm_attributes( + cls, api: _SemanticAnalyzerPluginInterface, attributes: list[util.SQLAlchemyAttribute] +) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi new file mode 100644 index 0000000..9b68ea8 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi @@ -0,0 +1,10 @@ +from typing import Any +from typing_extensions import TypeAlias + +from . import util + +_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface + +def scan_declarative_assignments_and_apply_types( + cls, api: _SemanticAnalyzerPluginInterface, is_mixin_scan: bool = ... +) -> list[util.SQLAlchemyAttribute] | None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi new file mode 100644 index 0000000..0ffb05b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi @@ -0,0 +1,25 @@ +from collections.abc import Sequence +from typing import Any +from typing_extensions import TypeAlias + +_AssignmentStmt: TypeAlias = Any # mypy.nodes.AssignmentStmt +_Expression: TypeAlias = Any # mypy.nodes.Expression +_RefExpr: TypeAlias = Any # mypy.nodes.RefExpr +_TypeInfo: TypeAlias = Any # mypy.nodes.TypeInfo +_Var: TypeAlias = Any # mypy.nodes.Var +_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface +_ProperType: TypeAlias = Any # mypy.types.ProperType + +def infer_type_from_right_hand_nameexpr( + api: _SemanticAnalyzerPluginInterface, + stmt: _AssignmentStmt, + node: _Var, + left_hand_explicit_type: _ProperType | None, + infer_from_right_side: _RefExpr, +) -> _ProperType | None: ... +def infer_type_from_left_hand_type_only( + api: _SemanticAnalyzerPluginInterface, node: _Var, left_hand_explicit_type: _ProperType | None +) -> _ProperType | None: ... +def extract_python_type_from_typeengine( + api: _SemanticAnalyzerPluginInterface, node: _TypeInfo, type_args: Sequence[_Expression] +) -> _ProperType: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/names.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/names.pyi new file mode 100644 index 0000000..ab998e2 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/names.pyi @@ -0,0 +1,38 @@ +from typing import Any +from typing_extensions import TypeAlias + +from ...util import symbol + +_ClassDef: TypeAlias = Any # mypy.nodes.ClassDef +_Expression: TypeAlias = Any # mypy.nodes.Expression +_MemberExpr: TypeAlias = Any # mypy.nodes.MemberExpr +_NameExpr: TypeAlias = Any # mypy.nodes.NameExpr +_SymbolNode: TypeAlias = Any # mypy.nodes.SymbolNode +_TypeInfo: TypeAlias = Any # mypy.nodes.TypeInfo +_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface +_UnboundType: TypeAlias = Any # mypy.types.UnboundType + +COLUMN: symbol +RELATIONSHIP: symbol +REGISTRY: symbol +COLUMN_PROPERTY: symbol +TYPEENGINE: symbol +MAPPED: symbol +DECLARATIVE_BASE: symbol +DECLARATIVE_META: symbol +MAPPED_DECORATOR: symbol +SYNONYM_PROPERTY: symbol +COMPOSITE_PROPERTY: symbol +DECLARED_ATTR: symbol +MAPPER_PROPERTY: symbol +AS_DECLARATIVE: symbol +AS_DECLARATIVE_BASE: symbol +DECLARATIVE_MIXIN: symbol +QUERY_EXPRESSION: symbol + +def has_base_type_id(info: _TypeInfo, type_id: int) -> bool: ... +def mro_has_id(mro: list[_TypeInfo], type_id: int) -> bool: ... +def type_id_for_unbound_type(type_: _UnboundType, cls: _ClassDef, api: _SemanticAnalyzerPluginInterface) -> int | None: ... +def type_id_for_callee(callee: _Expression) -> int | None: ... +def type_id_for_named_node(node: _NameExpr | _MemberExpr | _SymbolNode) -> int | None: ... +def type_id_for_fullname(fullname: str) -> int | None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi new file mode 100644 index 0000000..c9e943a --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi @@ -0,0 +1,21 @@ +from collections.abc import Callable +from typing import Any +from typing_extensions import TypeAlias + +_MypyFile: TypeAlias = Any # mypy.nodes.MypyFile +_AttributeContext: TypeAlias = Any # mypy.plugin.AttributeContext +_ClassDefContext: TypeAlias = Any # mypy.plugin.ClassDefContext +_DynamicClassDefContext: TypeAlias = Any # mypy.plugin.DynamicClassDefContext +_Plugin: TypeAlias = Any # mypy.plugin.Plugin +_Type: TypeAlias = Any # mypy.types.Type + +class SQLAlchemyPlugin(_Plugin): + def get_dynamic_class_hook(self, fullname: str) -> Callable[[_DynamicClassDefContext], None] | None: ... + def get_customize_class_mro_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ... + def get_class_decorator_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ... + def get_metaclass_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ... + def get_base_class_hook(self, fullname: str) -> Callable[[_ClassDefContext], None] | None: ... + def get_attribute_hook(self, fullname: str) -> Callable[[_AttributeContext], _Type] | None: ... + def get_additional_deps(self, file: _MypyFile) -> list[tuple[int, str, int]]: ... + +def plugin(version: str) -> type[SQLAlchemyPlugin]: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/util.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/util.pyi new file mode 100644 index 0000000..43edf16 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/util.pyi @@ -0,0 +1,49 @@ +from collections.abc import Iterable, Iterator +from typing import Any, TypeVar, overload +from typing_extensions import TypeAlias + +_CallExpr: TypeAlias = Any # mypy.nodes._CallExpr +_Context: TypeAlias = Any # mypy.nodes._Context +_Expression: TypeAlias = Any # mypy.nodes._Expression +_JsonDict: TypeAlias = Any # mypy.nodes._JsonDict +_NameExpr: TypeAlias = Any # mypy.nodes._NameExpr +_Statement: TypeAlias = Any # mypy.nodes._Statement +_TypeInfo: TypeAlias = Any # mypy.nodes._TypeInfo +_ClassDefContext: TypeAlias = Any # mypy.plugin._ClassDefContext +_DynamicClassDefContext: TypeAlias = Any # mypy.plugin._DynamicClassDefContext +_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin._SemanticAnalyzerPluginInterface +_Type: TypeAlias = Any # mypy.types._Type + +_TArgType = TypeVar("_TArgType", bound=_CallExpr | _NameExpr) + +class SQLAlchemyAttribute: + name: Any + line: Any + column: Any + type: Any + info: Any + def __init__(self, name: str, line: int, column: int, typ: _Type | None, info: _TypeInfo) -> None: ... + def serialize(self) -> _JsonDict: ... + def expand_typevar_from_subtype(self, sub_type: _TypeInfo) -> None: ... + @classmethod + def deserialize(cls, info: _TypeInfo, data: _JsonDict, api: _SemanticAnalyzerPluginInterface) -> SQLAlchemyAttribute: ... + +def name_is_dunder(name): ... +def establish_as_sqlalchemy(info: _TypeInfo) -> None: ... +def set_is_base(info: _TypeInfo) -> None: ... +def get_is_base(info: _TypeInfo) -> bool: ... +def has_declarative_base(info: _TypeInfo) -> bool: ... +def set_has_table(info: _TypeInfo) -> None: ... +def get_has_table(info: _TypeInfo) -> bool: ... +def get_mapped_attributes(info: _TypeInfo, api: _SemanticAnalyzerPluginInterface) -> list[SQLAlchemyAttribute] | None: ... +def set_mapped_attributes(info: _TypeInfo, attributes: list[SQLAlchemyAttribute]) -> None: ... +def fail(api: _SemanticAnalyzerPluginInterface, msg: str, ctx: _Context) -> None: ... +def add_global(ctx: _ClassDefContext | _DynamicClassDefContext, module: str, symbol_name: str, asname: str) -> None: ... +@overload +def get_callexpr_kwarg(callexpr: _CallExpr, name: str, *, expr_types: None = ...) -> _CallExpr | _NameExpr | None: ... +@overload +def get_callexpr_kwarg(callexpr: _CallExpr, name: str, *, expr_types: tuple[type[_TArgType], ...]) -> _TArgType | None: ... +def flatten_typechecking(stmts: Iterable[_Statement]) -> Iterator[_Statement]: ... +def unbound_to_instance(api: _SemanticAnalyzerPluginInterface, typ: _Type) -> _Type: ... +def info_for_cls(cls, api: _SemanticAnalyzerPluginInterface) -> _TypeInfo | None: ... +def expr_to_mapped_constructor(expr: _Expression) -> _CallExpr: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/orderinglist.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/orderinglist.pyi new file mode 100644 index 0000000..a4fe830 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/orderinglist.pyi @@ -0,0 +1,21 @@ +from typing import Any + +def ordering_list(attr, count_from: Any | None = ..., **kw): ... + +class OrderingList(list[Any]): + ordering_attr: Any + ordering_func: Any + reorder_on_append: Any + def __init__( + self, ordering_attr: Any | None = ..., ordering_func: Any | None = ..., reorder_on_append: bool = ... + ) -> None: ... + def reorder(self) -> None: ... + def append(self, entity) -> None: ... + def insert(self, index, entity) -> None: ... + def remove(self, entity) -> None: ... + def pop(self, index: int = ...): ... # type: ignore[override] + def __setitem__(self, index, entity) -> None: ... + def __delitem__(self, index) -> None: ... + def __setslice__(self, start, end, values) -> None: ... + def __delslice__(self, start, end) -> None: ... + def __reduce__(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/serializer.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/serializer.pyi new file mode 100644 index 0000000..d4a4a2c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/ext/serializer.pyi @@ -0,0 +1,6 @@ +from typing import Any + +def Serializer(*args, **kw): ... +def Deserializer(file, metadata: Any | None = ..., scoped_session: Any | None = ..., engine: Any | None = ...): ... +def dumps(obj, protocol=...): ... +def loads(data, metadata: Any | None = ..., scoped_session: Any | None = ..., engine: Any | None = ...): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/future/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/future/__init__.pyi new file mode 100644 index 0000000..00f3a30 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/future/__init__.pyi @@ -0,0 +1,5 @@ +from typing import Any + +from .engine import Connection as Connection, Engine as Engine, create_engine as create_engine + +select: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/future/engine.pyi b/stubs/SQLAlchemy/sqlalchemy/future/engine.pyi new file mode 100644 index 0000000..bd4ff1d --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/future/engine.pyi @@ -0,0 +1,37 @@ +from typing import Any, overload +from typing_extensions import Literal + +from ..engine import Connection as _LegacyConnection, Engine as _LegacyEngine +from ..engine.base import OptionEngineMixin +from ..engine.mock import MockConnection +from ..engine.url import URL + +NO_OPTIONS: Any + +@overload +def create_engine(url: URL | str, *, strategy: Literal["mock"], **kwargs) -> MockConnection: ... # type: ignore[misc] +@overload +def create_engine( + url: URL | str, *, module: Any | None = ..., enable_from_linting: bool = ..., future: bool = ..., **kwargs +) -> Engine: ... + +class Connection(_LegacyConnection): + def begin(self): ... + def begin_nested(self): ... + def commit(self) -> None: ... + def rollback(self) -> None: ... + def close(self) -> None: ... + def execute(self, statement, parameters: Any | None = ..., execution_options: Any | None = ...): ... # type: ignore[override] + def scalar(self, statement, parameters: Any | None = ..., execution_options: Any | None = ...): ... # type: ignore[override] + +class Engine(_LegacyEngine): + transaction: Any + run_callable: Any + execute: Any + scalar: Any + table_names: Any + has_table: Any + def begin(self) -> None: ... # type: ignore[override] + def connect(self): ... + +class OptionEngine(OptionEngineMixin, Engine): ... # type: ignore[misc] diff --git a/stdlib/@python2/lib2to3/pgen2/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/future/orm/__init__.pyi similarity index 100% rename from stdlib/@python2/lib2to3/pgen2/__init__.pyi rename to stubs/SQLAlchemy/sqlalchemy/future/orm/__init__.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/inspection.pyi b/stubs/SQLAlchemy/sqlalchemy/inspection.pyi new file mode 100644 index 0000000..d758818 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/inspection.pyi @@ -0,0 +1 @@ +def inspect(subject, raiseerr: bool = ...): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/log.pyi b/stubs/SQLAlchemy/sqlalchemy/log.pyi new file mode 100644 index 0000000..54b045c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/log.pyi @@ -0,0 +1,39 @@ +from _typeshed import Self +from logging import Logger +from typing import Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias + +_ClsT = TypeVar("_ClsT", bound=type) +_EchoFlag: TypeAlias = bool | Literal["debug"] | None + +rootlogger: Any + +def class_logger(cls: _ClsT) -> _ClsT: ... + +class Identified: + logging_name: str | None + +class InstanceLogger: + echo: _EchoFlag + logger: Logger + def __init__(self, echo: _EchoFlag, name: str | None) -> None: ... + def debug(self, msg, *args, **kwargs) -> None: ... + def info(self, msg, *args, **kwargs) -> None: ... + def warning(self, msg, *args, **kwargs) -> None: ... + warn = warning + def error(self, msg, *args, **kwargs) -> None: ... + def exception(self, msg, *args, **kwargs) -> None: ... + def critical(self, msg, *args, **kwargs) -> None: ... + def log(self, level, msg, *args, **kwargs) -> None: ... + def isEnabledFor(self, level): ... + def getEffectiveLevel(self): ... + +def instance_logger(instance: Identified, echoflag: _EchoFlag = ...) -> None: ... + +class echo_property: + __doc__: str + @overload + def __get__(self: Self, instance: None, owner: object) -> Self: ... + @overload + def __get__(self, instance: Identified, owner: object) -> _EchoFlag: ... + def __set__(self, instance: Identified, value: _EchoFlag) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/__init__.pyi new file mode 100644 index 0000000..e4b08ee --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/__init__.pyi @@ -0,0 +1,125 @@ +from typing import Any + +from ..util.langhelpers import public_factory as public_factory +from . import exc as exc, strategy_options as strategy_options +from .attributes import ( + AttributeEvent as AttributeEvent, + InstrumentedAttribute as InstrumentedAttribute, + Mapped as Mapped, + QueryableAttribute as QueryableAttribute, +) +from .context import QueryContext as QueryContext +from .decl_api import ( + DeclarativeMeta as DeclarativeMeta, + as_declarative as as_declarative, + declarative_base as declarative_base, + declarative_mixin as declarative_mixin, + declared_attr as declared_attr, + has_inherited_table as has_inherited_table, + registry as registry, + synonym_for as synonym_for, +) +from .descriptor_props import CompositeProperty as CompositeProperty, SynonymProperty as SynonymProperty +from .dynamic import AppenderQuery as AppenderQuery +from .events import ( + AttributeEvents as AttributeEvents, + InstanceEvents as InstanceEvents, + InstrumentationEvents as InstrumentationEvents, + MapperEvents as MapperEvents, + QueryEvents as QueryEvents, + SessionEvents as SessionEvents, +) +from .identity import IdentityMap as IdentityMap +from .instrumentation import ClassManager as ClassManager +from .interfaces import ( + EXT_CONTINUE as EXT_CONTINUE, + EXT_SKIP as EXT_SKIP, + EXT_STOP as EXT_STOP, + MANYTOMANY as MANYTOMANY, + MANYTOONE as MANYTOONE, + NOT_EXTENSION as NOT_EXTENSION, + ONETOMANY as ONETOMANY, + InspectionAttr as InspectionAttr, + InspectionAttrInfo as InspectionAttrInfo, + MapperProperty as MapperProperty, + PropComparator as PropComparator, + UserDefinedOption as UserDefinedOption, +) +from .loading import merge_frozen_result as merge_frozen_result, merge_result as merge_result +from .mapper import ( + Mapper as Mapper, + class_mapper as class_mapper, + configure_mappers as configure_mappers, + reconstructor as reconstructor, + validates as validates, +) +from .properties import ColumnProperty as ColumnProperty +from .query import AliasOption as AliasOption, FromStatement as FromStatement, Query as Query +from .relationships import RelationshipProperty as RelationshipProperty, foreign as foreign, remote as remote +from .scoping import scoped_session as scoped_session +from .session import ( + ORMExecuteState as ORMExecuteState, + Session as Session, + SessionTransaction as SessionTransaction, + close_all_sessions as close_all_sessions, + make_transient as make_transient, + make_transient_to_detached as make_transient_to_detached, + object_session as object_session, + sessionmaker as sessionmaker, +) +from .state import AttributeState as AttributeState, InstanceState as InstanceState +from .strategy_options import Load as Load +from .unitofwork import UOWTransaction as UOWTransaction +from .util import ( + Bundle as Bundle, + CascadeOptions as CascadeOptions, + LoaderCriteriaOption as LoaderCriteriaOption, + aliased as aliased, + join as join, + object_mapper as object_mapper, + outerjoin as outerjoin, + polymorphic_union as polymorphic_union, + was_deleted as was_deleted, + with_parent as with_parent, + with_polymorphic as with_polymorphic, +) + +def create_session(bind: Any | None = ..., **kwargs): ... + +with_loader_criteria: Any +relationship: Any + +def relation(*arg, **kw): ... +def dynamic_loader(argument, **kw): ... + +column_property: Any +composite: Any + +def backref(name, **kwargs): ... +def deferred(*columns, **kw): ... +def query_expression(default_expr=...): ... + +mapper: Any +synonym: Any + +def clear_mappers() -> None: ... + +joinedload: Any +contains_eager: Any +defer: Any +undefer: Any +undefer_group: Any +with_expression: Any +load_only: Any +lazyload: Any +subqueryload: Any +selectinload: Any +immediateload: Any +noload: Any +raiseload: Any +defaultload: Any +selectin_polymorphic: Any + +def eagerload(*args, **kwargs): ... + +contains_alias: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/attributes.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/attributes.pyi new file mode 100644 index 0000000..e68ec23 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/attributes.pyi @@ -0,0 +1,250 @@ +from typing import Any, Generic, NamedTuple, TypeVar + +from ..sql import base as sql_base, roles, traversals +from ..util import memoized_property +from . import interfaces + +_T = TypeVar("_T") + +class NoKey(str): ... + +NO_KEY: Any + +class QueryableAttribute( + interfaces._MappedAttribute, + interfaces.InspectionAttr, + interfaces.PropComparator[Any], + traversals.HasCopyInternals, + roles.JoinTargetRole, + roles.OnClauseRole, + sql_base.Immutable, + sql_base.MemoizedHasCacheKey, +): + is_attribute: bool + __visit_name__: str + class_: Any + key: Any + impl: Any + comparator: Any + def __init__( + self, + class_, + key, + parententity, + impl: Any | None = ..., + comparator: Any | None = ..., + of_type: Any | None = ..., + extra_criteria=..., + ) -> None: ... + def __reduce__(self): ... + def get_history(self, instance, passive=...): ... + @memoized_property + def info(self): ... + @memoized_property + def parent(self): ... + @memoized_property + def expression(self): ... + def __clause_element__(self): ... + def adapt_to_entity(self, adapt_to_entity): ... + def of_type(self, entity): ... + def and_(self, *other): ... + def label(self, name): ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... + def hasparent(self, state, optimistic: bool = ...): ... + def __getattr__(self, key): ... + @memoized_property + def property(self): ... + +class Mapped(QueryableAttribute, Generic[_T]): + def __get__(self, instance, owner) -> None: ... + def __set__(self, instance, value) -> None: ... + def __delete__(self, instance) -> None: ... + +class InstrumentedAttribute(Mapped[Any]): + inherit_cache: bool + def __set__(self, instance, value) -> None: ... + def __delete__(self, instance) -> None: ... + def __get__(self, instance, owner): ... + +class _HasEntityNamespace(NamedTuple): + entity_namespace: Any + +class HasEntityNamespace(_HasEntityNamespace): + is_mapper: bool + is_aliased_class: bool + +def create_proxied_attribute(descriptor): ... + +OP_REMOVE: Any +OP_APPEND: Any +OP_REPLACE: Any +OP_BULK_REPLACE: Any +OP_MODIFIED: Any + +class AttributeEvent: + impl: Any + op: Any + parent_token: Any + def __init__(self, attribute_impl, op) -> None: ... + def __eq__(self, other): ... + @property + def key(self): ... + def hasparent(self, state): ... + +Event = AttributeEvent + +class AttributeImpl: + class_: Any + key: Any + callable_: Any + dispatch: Any + trackparent: Any + parent_token: Any + send_modified_events: Any + is_equal: Any + accepts_scalar_loader: Any + load_on_unexpire: Any + def __init__( + self, + class_, + key, + callable_, + dispatch, + trackparent: bool = ..., + compare_function: Any | None = ..., + active_history: bool = ..., + parent_token: Any | None = ..., + load_on_unexpire: bool = ..., + send_modified_events: bool = ..., + accepts_scalar_loader: Any | None = ..., + **kwargs, + ) -> None: ... + active_history: Any + def hasparent(self, state, optimistic: bool = ...): ... + def sethasparent(self, state, parent_state, value) -> None: ... + def get_history(self, state, dict_, passive=...) -> None: ... + def get_all_pending(self, state, dict_, passive=...) -> None: ... + def get(self, state, dict_, passive=...): ... + def append(self, state, dict_, value, initiator, passive=...) -> None: ... + def remove(self, state, dict_, value, initiator, passive=...) -> None: ... + def pop(self, state, dict_, value, initiator, passive=...) -> None: ... + def set(self, state, dict_, value, initiator, passive=..., check_old: Any | None = ..., pop: bool = ...) -> None: ... + def get_committed_value(self, state, dict_, passive=...): ... + def set_committed_value(self, state, dict_, value): ... + +class ScalarAttributeImpl(AttributeImpl): + default_accepts_scalar_loader: bool + uses_objects: bool + supports_population: bool + collection: bool + dynamic: bool + def __init__(self, *arg, **kw) -> None: ... + def delete(self, state, dict_) -> None: ... + def get_history(self, state, dict_, passive=...): ... + def set(self, state, dict_, value, initiator, passive=..., check_old: Any | None = ..., pop: bool = ...) -> None: ... + def fire_replace_event(self, state, dict_, value, previous, initiator): ... + def fire_remove_event(self, state, dict_, value, initiator) -> None: ... + @property + def type(self) -> None: ... + +class ScalarObjectAttributeImpl(ScalarAttributeImpl): + default_accepts_scalar_loader: bool + uses_objects: bool + supports_population: bool + collection: bool + def delete(self, state, dict_) -> None: ... + def get_history(self, state, dict_, passive=...): ... + def get_all_pending(self, state, dict_, passive=...): ... + def set(self, state, dict_, value, initiator, passive=..., check_old: Any | None = ..., pop: bool = ...) -> None: ... + def fire_remove_event(self, state, dict_, value, initiator) -> None: ... + def fire_replace_event(self, state, dict_, value, previous, initiator): ... + +class CollectionAttributeImpl(AttributeImpl): + default_accepts_scalar_loader: bool + uses_objects: bool + supports_population: bool + collection: bool + dynamic: bool + copy: Any + collection_factory: Any + def __init__( + self, + class_, + key, + callable_, + dispatch, + typecallable: Any | None = ..., + trackparent: bool = ..., + copy_function: Any | None = ..., + compare_function: Any | None = ..., + **kwargs, + ) -> None: ... + def get_history(self, state, dict_, passive=...): ... + def get_all_pending(self, state, dict_, passive=...): ... + def fire_append_event(self, state, dict_, value, initiator): ... + def fire_append_wo_mutation_event(self, state, dict_, value, initiator): ... + def fire_pre_remove_event(self, state, dict_, initiator) -> None: ... + def fire_remove_event(self, state, dict_, value, initiator) -> None: ... + def delete(self, state, dict_) -> None: ... + def append(self, state, dict_, value, initiator, passive=...) -> None: ... + def remove(self, state, dict_, value, initiator, passive=...) -> None: ... + def pop(self, state, dict_, value, initiator, passive=...) -> None: ... + def set( + self, + state, + dict_, + value, + initiator: Any | None = ..., + passive=..., + check_old: Any | None = ..., + pop: bool = ..., + _adapt: bool = ..., + ) -> None: ... + def set_committed_value(self, state, dict_, value): ... + def get_collection(self, state, dict_, user_data: Any | None = ..., passive=...): ... + +def backref_listeners(attribute, key, uselist): ... + +class History: + def __bool__(self): ... + __nonzero__: Any + def empty(self): ... + def sum(self): ... + def non_deleted(self): ... + def non_added(self): ... + def has_changes(self): ... + def as_state(self): ... + @classmethod + def from_scalar_attribute(cls, attribute, state, current): ... + @classmethod + def from_object_attribute(cls, attribute, state, current, original=...): ... + @classmethod + def from_collection(cls, attribute, state, current): ... + +HISTORY_BLANK: Any + +def get_history(obj, key, passive=...): ... +def get_state_history(state, key, passive=...): ... +def has_parent(cls, obj, key, optimistic: bool = ...): ... +def register_attribute(class_, key, **kw): ... +def register_attribute_impl( + class_, + key, + uselist: bool = ..., + callable_: Any | None = ..., + useobject: bool = ..., + impl_class: Any | None = ..., + backref: Any | None = ..., + **kw, +): ... +def register_descriptor(class_, key, comparator: Any | None = ..., parententity: Any | None = ..., doc: Any | None = ...): ... +def unregister_attribute(class_, key) -> None: ... +def init_collection(obj, key): ... +def init_state_collection(state, dict_, key): ... +def set_committed_value(instance, key, value) -> None: ... +def set_attribute(instance, key, value, initiator: Any | None = ...) -> None: ... +def get_attribute(instance, key): ... +def del_attribute(instance, key) -> None: ... +def flag_modified(instance, key) -> None: ... +def flag_dirty(instance) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/base.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/base.pyi new file mode 100644 index 0000000..4d247f5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/base.pyi @@ -0,0 +1,75 @@ +from typing import Any + +from ..util import memoized_property + +PASSIVE_NO_RESULT: Any +PASSIVE_CLASS_MISMATCH: Any +ATTR_WAS_SET: Any +ATTR_EMPTY: Any +NO_VALUE: Any +NEVER_SET: Any +NO_CHANGE: Any +CALLABLES_OK: Any +SQL_OK: Any +RELATED_OBJECT_OK: Any +INIT_OK: Any +NON_PERSISTENT_OK: Any +LOAD_AGAINST_COMMITTED: Any +NO_AUTOFLUSH: Any +NO_RAISE: Any +DEFERRED_HISTORY_LOAD: Any +PASSIVE_OFF: Any +PASSIVE_RETURN_NO_VALUE: Any +PASSIVE_NO_INITIALIZE: Any +PASSIVE_NO_FETCH: Any +PASSIVE_NO_FETCH_RELATED: Any +PASSIVE_ONLY_PERSISTENT: Any +DEFAULT_MANAGER_ATTR: str +DEFAULT_STATE_ATTR: str +EXT_CONTINUE: Any +EXT_STOP: Any +EXT_SKIP: Any +ONETOMANY: Any +MANYTOONE: Any +MANYTOMANY: Any +NOT_EXTENSION: Any + +_never_set: frozenset[Any] +_none_set: frozenset[Any] + +def manager_of_class(cls): ... + +instance_state: Any +instance_dict: Any + +def instance_str(instance): ... +def state_str(state): ... +def state_class_str(state): ... +def attribute_str(instance, attribute): ... +def state_attribute_str(state, attribute): ... +def object_mapper(instance): ... +def object_state(instance): ... +def _class_to_mapper(class_or_mapper): ... +def _mapper_or_none(entity): ... +def _is_mapped_class(entity): ... + +_state_mapper: Any + +def class_mapper(class_, configure: bool = ...): ... + +class InspectionAttr: + is_selectable: bool + is_aliased_class: bool + is_instance: bool + is_mapper: bool + is_bundle: bool + is_property: bool + is_attribute: bool + is_clause_element: bool + extension_type: Any + +class InspectionAttrInfo(InspectionAttr): + @memoized_property + def info(self): ... + +class _MappedAttribute: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/clsregistry.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/clsregistry.pyi new file mode 100644 index 0000000..5851896 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/clsregistry.pyi @@ -0,0 +1,51 @@ +from typing import Any + +def add_class(classname, cls, decl_class_registry) -> None: ... +def remove_class(classname, cls, decl_class_registry) -> None: ... + +class _MultipleClassMarker: + on_remove: Any + contents: Any + def __init__(self, classes, on_remove: Any | None = ...) -> None: ... + def remove_item(self, cls) -> None: ... + def __iter__(self): ... + def attempt_get(self, path, key): ... + def add_item(self, item) -> None: ... + +class _ModuleMarker: + parent: Any + name: Any + contents: Any + mod_ns: Any + path: Any + def __init__(self, name, parent) -> None: ... + def __contains__(self, name): ... + def __getitem__(self, name): ... + def resolve_attr(self, key): ... + def get_module(self, name): ... + def add_class(self, name, cls): ... + def remove_class(self, name, cls) -> None: ... + +class _ModNS: + def __init__(self, parent) -> None: ... + def __getattr__(self, key): ... + +class _GetColumns: + cls: Any + def __init__(self, cls) -> None: ... + def __getattr__(self, key): ... + +class _GetTable: + key: Any + metadata: Any + def __init__(self, key, metadata) -> None: ... + def __getattr__(self, key): ... + +class _class_resolver: + cls: Any + prop: Any + arg: Any + fallback: Any + favor_tables: Any + def __init__(self, cls, prop, fallback, arg, favor_tables: bool = ...) -> None: ... + def __call__(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/collections.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/collections.pyi new file mode 100644 index 0000000..fd59745 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/collections.pyi @@ -0,0 +1,91 @@ +from typing import Any + +class _PlainColumnGetter: + cols: Any + composite: Any + def __init__(self, cols) -> None: ... + def __reduce__(self): ... + def __call__(self, value): ... + +class _SerializableColumnGetter: + colkeys: Any + composite: Any + def __init__(self, colkeys) -> None: ... + def __reduce__(self): ... + def __call__(self, value): ... + +class _SerializableColumnGetterV2(_PlainColumnGetter): + colkeys: Any + composite: Any + def __init__(self, colkeys) -> None: ... + def __reduce__(self): ... + +def column_mapped_collection(mapping_spec): ... + +class _SerializableAttrGetter: + name: Any + getter: Any + def __init__(self, name) -> None: ... + def __call__(self, target): ... + def __reduce__(self): ... + +def attribute_mapped_collection(attr_name): ... +def mapped_collection(keyfunc): ... + +class collection: + @staticmethod + def appender(fn): ... + @staticmethod + def remover(fn): ... + @staticmethod + def iterator(fn): ... + @staticmethod + def internally_instrumented(fn): ... + @staticmethod + def converter(fn): ... + @staticmethod + def adds(arg): ... + @staticmethod + def replaces(arg): ... + @staticmethod + def removes(arg): ... + @staticmethod + def removes_return(): ... + +collection_adapter: Any + +class CollectionAdapter: + attr: Any + owner_state: Any + invalidated: bool + empty: bool + def __init__(self, attr, owner_state, data) -> None: ... + @property + def data(self): ... + def bulk_appender(self): ... + def append_with_event(self, item, initiator: Any | None = ...) -> None: ... + def append_without_event(self, item) -> None: ... + def append_multiple_without_event(self, items) -> None: ... + def bulk_remover(self): ... + def remove_with_event(self, item, initiator: Any | None = ...) -> None: ... + def remove_without_event(self, item) -> None: ... + def clear_with_event(self, initiator: Any | None = ...) -> None: ... + def clear_without_event(self) -> None: ... + def __iter__(self): ... + def __len__(self): ... + def __bool__(self): ... + __nonzero__: Any + def fire_append_wo_mutation_event(self, item, initiator: Any | None = ...): ... + def fire_append_event(self, item, initiator: Any | None = ...): ... + def fire_remove_event(self, item, initiator: Any | None = ...) -> None: ... + def fire_pre_remove_event(self, initiator: Any | None = ...) -> None: ... + +class InstrumentedList(list[Any]): ... +class InstrumentedSet(set[Any]): ... +class InstrumentedDict(dict[Any, Any]): ... + +class MappedCollection(dict[Any, Any]): + keyfunc: Any + def __init__(self, keyfunc) -> None: ... + def set(self, value, _sa_initiator: Any | None = ...) -> None: ... + def remove(self, value, _sa_initiator: Any | None = ...) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/context.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/context.pyi new file mode 100644 index 0000000..8e6edad --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/context.pyi @@ -0,0 +1,211 @@ +from _typeshed import Incomplete +from typing import Any + +from ..sql.base import CacheableOptions, CompileState, Options +from ..sql.selectable import SelectState + +LABEL_STYLE_LEGACY_ORM: Any + +class QueryContext: + class default_load_options(Options): ... + load_options: Any + execution_options: Any + bind_arguments: Any + compile_state: Any + query: Any + session: Any + loaders_require_buffering: bool + loaders_require_uniquing: bool + params: Any + create_eager_joins: Any + propagated_loader_options: Any + attributes: Any + runid: Any + partials: Any + post_load_paths: Any + autoflush: Any + populate_existing: Any + invoke_all_eagers: Any + version_check: Any + refresh_state: Any + yield_per: Any + identity_token: Any + def __init__( + self, + compile_state, + statement, + params, + session, + load_options, + execution_options: Any | None = ..., + bind_arguments: Any | None = ..., + ) -> None: ... + +class ORMCompileState(CompileState): + class default_compile_options(CacheableOptions): ... + current_path: Any + def __init__(self, *arg, **kw) -> None: ... + @classmethod + def create_for_statement(cls, statement_container, compiler, **kw) -> None: ... # type: ignore[override] + @classmethod + def get_column_descriptions(cls, statement): ... + @classmethod + def orm_pre_session_exec(cls, session, statement, params, execution_options, bind_arguments, is_reentrant_invoke): ... + @classmethod + def orm_setup_cursor_result(cls, session, statement, params, execution_options, bind_arguments, result): ... + +class ORMFromStatementCompileState(ORMCompileState): + multi_row_eager_loaders: bool + compound_eager_adapter: Any + extra_criteria_entities: Any + eager_joins: Any + use_legacy_query_style: Any + statement_container: Any + requested_statement: Any + dml_table: Any + compile_options: Any + statement: Any + current_path: Any + attributes: Any + global_attributes: Any + primary_columns: Any + secondary_columns: Any + dedupe_columns: Any + create_eager_joins: Any + order_by: Any + @classmethod + def create_for_statement(cls, statement_container, compiler, **kw): ... + +class ORMSelectCompileState(ORMCompileState, SelectState): + multi_row_eager_loaders: bool + compound_eager_adapter: Any + correlate: Any + correlate_except: Any + global_attributes: Any + select_statement: Any + for_statement: Any + use_legacy_query_style: Any + compile_options: Any + label_style: Any + current_path: Any + eager_order_by: Any + attributes: Any + primary_columns: Any + secondary_columns: Any + dedupe_columns: Any + eager_joins: Any + extra_criteria_entities: Any + create_eager_joins: Any + from_clauses: Any + @classmethod + def create_for_statement(cls, statement, compiler, **kw): ... + @classmethod + def determine_last_joined_entity(cls, statement): ... + @classmethod + def all_selected_columns(cls, statement) -> None: ... + @classmethod + def get_columns_clause_froms(cls, statement): ... + @classmethod + def from_statement(cls, statement, from_statement): ... + +class _QueryEntity: + use_id_for_hash: bool + @classmethod + def to_compile_state(cls, compile_state, entities, entities_collection, is_current_entities): ... + +class _MapperEntity(_QueryEntity): + expr: Any + mapper: Any + entity_zero: Any + is_aliased_class: Any + path: Any + selectable: Any + def __init__(self, compile_state, entity, entities_collection, is_current_entities) -> None: ... + supports_single_entity: bool + use_id_for_hash: bool + @property + def type(self): ... + @property + def entity_zero_or_selectable(self): ... + def corresponds_to(self, entity): ... + def row_processor(self, context, result): ... + def setup_compile_state(self, compile_state) -> None: ... + +class _BundleEntity(_QueryEntity): + bundle: Any + expr: Any + type: Any + supports_single_entity: Any + def __init__( + self, + compile_state, + expr, + entities_collection, + is_current_entities: bool, + setup_entities: bool = ..., + parent_bundle: Incomplete | None = ..., + ) -> None: ... + @property + def mapper(self): ... + @property + def entity_zero(self): ... + def corresponds_to(self, entity): ... + @property + def entity_zero_or_selectable(self): ... + def setup_compile_state(self, compile_state) -> None: ... + def row_processor(self, context, result): ... + +class _ColumnEntity(_QueryEntity): + raw_column_index: Any + translate_raw_column: Any + @property + def type(self): ... + def row_processor(self, context, result): ... + +class _RawColumnEntity(_ColumnEntity): + entity_zero: Any + mapper: Any + supports_single_entity: bool + expr: Any + raw_column_index: Any + translate_raw_column: Any + column: Any + entity_zero_or_selectable: Any + def __init__( + self, + compile_state, + column, + entities_collection, + raw_column_index, + is_current_entities: bool, + parent_bundle: Incomplete | None = ..., + ) -> None: ... + def corresponds_to(self, entity): ... + def setup_compile_state(self, compile_state) -> None: ... + +class _ORMColumnEntity(_ColumnEntity): + supports_single_entity: bool + expr: Any + translate_raw_column: bool + raw_column_index: Any + entity_zero_or_selectable: Any + entity_zero: Any + mapper: Any + column: Any + def __init__( + self, + compile_state, + column, + entities_collection, + parententity, + raw_column_index, + is_current_entities: bool, + parent_bundle: Incomplete | None = ..., + ) -> None: ... + def corresponds_to(self, entity): ... + def setup_compile_state(self, compile_state) -> None: ... + +class _IdentityTokenEntity(_ORMColumnEntity): + translate_raw_column: bool + def setup_compile_state(self, compile_state) -> None: ... + def row_processor(self, context, result): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi new file mode 100644 index 0000000..5970c26 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi @@ -0,0 +1,141 @@ +from collections.abc import Callable +from typing import Any, ClassVar, TypeVar, overload +from typing_extensions import TypeAlias + +from ..engine.interfaces import Connectable +from ..sql.schema import MetaData +from ..util import hybridproperty +from . import interfaces + +_ClsT = TypeVar("_ClsT", bound=type[Any]) +_DeclT = TypeVar("_DeclT", bound=type[_DeclarativeBase]) + +# Dynamic class as created by registry.generate_base() via DeclarativeMeta +# or another metaclass. This class does not exist at runtime. +class _DeclarativeBase(Any): # super classes are dynamic + registry: ClassVar[registry] + metadata: ClassVar[MetaData] + __abstract__: ClassVar[bool] + # not always existing: + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + __mapper_cls__: ClassVar[Any] + __class_getitem__: ClassVar[Any] + +# Meta class (or function) that creates a _DeclarativeBase class. +_DeclarativeBaseMeta: TypeAlias = Callable[[str, tuple[type[Any], ...], dict[str, Any]], _DeclT] + +def has_inherited_table(cls: type[Any]) -> bool: ... + +class DeclarativeMeta(type): + def __init__(cls, classname: str, bases: tuple[type[Any], ...], dict_: dict[str, Any], **kw: object) -> None: ... + def __setattr__(cls, key: str, value: Any) -> None: ... + def __delattr__(cls, key: str) -> None: ... + +def synonym_for(name, map_column: bool = ...): ... + +class declared_attr(interfaces._MappedAttribute, property): + def __init__(self, fget, cascading: bool = ...) -> None: ... + def __get__(self, self_, cls): ... + @hybridproperty + def cascading(self): ... + +class _stateful_declared_attr(declared_attr): + kw: Any + def __init__(self, **kw) -> None: ... + def __call__(self, fn): ... + +def declarative_mixin(cls: _ClsT) -> _ClsT: ... +@overload +def declarative_base( + bind: Connectable | None = ..., + metadata: MetaData | None = ..., + mapper: Any | None = ..., + cls: type[Any] | tuple[type[Any], ...] = ..., + name: str = ..., + constructor: Callable[..., None] = ..., + class_registry: dict[str, type[Any]] | None = ..., +) -> type[_DeclarativeBase]: ... +@overload +def declarative_base( + bind: Connectable | None = ..., + metadata: MetaData | None = ..., + mapper: Any | None = ..., + cls: type[Any] | tuple[type[Any], ...] = ..., + name: str = ..., + constructor: Callable[..., None] = ..., + class_registry: dict[str, type[Any]] | None = ..., + *, + metaclass: _DeclarativeBaseMeta[_DeclT], +) -> _DeclT: ... +@overload +def declarative_base( + bind: Connectable | None, + metadata: MetaData | None, + mapper: Any | None, + cls: type[Any] | tuple[type[Any], ...], + name: str, + constructor: Callable[..., None], + class_registry: dict[str, type[Any]] | None, + metaclass: _DeclarativeBaseMeta[_DeclT], +) -> _DeclT: ... + +class registry: + metadata: MetaData + constructor: Callable[..., None] + def __init__( + self, + metadata: MetaData | None = ..., + class_registry: dict[str, type[Any]] | None = ..., + constructor: Callable[..., None] = ..., + _bind: Connectable | None = ..., + ) -> None: ... + @property + def mappers(self) -> frozenset[Any]: ... + def configure(self, cascade: bool = ...) -> None: ... + def dispose(self, cascade: bool = ...) -> None: ... + @overload + def generate_base( + self, mapper: Any | None = ..., cls: type[Any] | tuple[type[Any], ...] = ..., name: str = ... + ) -> type[_DeclarativeBase]: ... + @overload + def generate_base( + self, + mapper: Any | None = ..., + cls: type[Any] | tuple[type[Any], ...] = ..., + name: str = ..., + *, + metaclass: _DeclarativeBaseMeta[_DeclT], + ) -> _DeclT: ... + @overload + def generate_base( + self, mapper: Any | None, cls: type[Any] | tuple[type[Any], ...], name: str, metaclass: _DeclarativeBaseMeta[_DeclT] + ) -> type[_DeclarativeBase]: ... + def mapped(self, cls: _ClsT) -> _ClsT: ... + # Return type of the callable is a _DeclarativeBase class with the passed in class as base. + # This could be better approximated with Intersection[PassedInClass, _DeclarativeBase]. + @overload + def as_declarative_base(self, *, mapper: Any | None = ...) -> Callable[[_ClsT], _ClsT | DeclarativeMeta | Any]: ... + @overload + def as_declarative_base( + self, *, mapper: Any | None = ..., metaclass: _DeclarativeBaseMeta[_DeclT] + ) -> Callable[[_ClsT], _ClsT | _DeclT | Any]: ... + def map_declaratively(self, cls): ... + def map_imperatively(self, class_, local_table: Any | None = ..., **kw): ... + +@overload +def as_declarative( + *, + bind: Connectable | None = ..., + metadata: MetaData | None = ..., + class_registry: dict[str, type[Any]] | None = ..., + mapper: Any | None = ..., +) -> Callable[[_ClsT], _ClsT | DeclarativeMeta | Any]: ... +@overload +def as_declarative( + *, + bind: Connectable | None = ..., + metadata: MetaData | None = ..., + class_registry: dict[str, type[Any]] | None = ..., + mapper: Any | None = ..., + metaclass: _DeclarativeBaseMeta[_DeclT], +) -> Callable[[_ClsT], _ClsT | _DeclT | Any]: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/decl_base.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/decl_base.pyi new file mode 100644 index 0000000..9d5dbf1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/decl_base.pyi @@ -0,0 +1,47 @@ +from typing import Any + +class _MapperConfig: + @classmethod + def setup_mapping(cls, registry, cls_, dict_, table, mapper_kw): ... + cls: Any + classname: Any + properties: Any + declared_attr_reg: Any + def __init__(self, registry, cls_, mapper_kw) -> None: ... + def set_cls_attribute(self, attrname, value): ... + +class _ImperativeMapperConfig(_MapperConfig): + dict_: Any + local_table: Any + inherits: Any + def __init__(self, registry, cls_, table, mapper_kw) -> None: ... + def map(self, mapper_kw=...): ... + +class _ClassScanMapperConfig(_MapperConfig): + dict_: Any + local_table: Any + persist_selectable: Any + declared_columns: Any + column_copies: Any + table_args: Any + tablename: Any + mapper_args: Any + mapper_args_fn: Any + inherits: Any + def __init__(self, registry, cls_, dict_, table, mapper_kw) -> None: ... + def map(self, mapper_kw=...): ... + +class _DeferredMapperConfig(_ClassScanMapperConfig): + @property + def cls(self): ... + @cls.setter + def cls(self, class_) -> None: ... + @classmethod + def has_cls(cls, class_): ... + @classmethod + def raise_unmapped_for_cls(cls, class_) -> None: ... + @classmethod + def config_for_cls(cls, class_): ... + @classmethod + def classes_for_base(cls, base_cls, sort: bool = ...): ... + def map(self, mapper_kw=...): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/dependency.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/dependency.pyi new file mode 100644 index 0000000..8fe9208 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/dependency.pyi @@ -0,0 +1,74 @@ +from typing import Any + +class DependencyProcessor: + prop: Any + cascade: Any + mapper: Any + parent: Any + secondary: Any + direction: Any + post_update: Any + passive_deletes: Any + passive_updates: Any + enable_typechecks: Any + sort_key: Any + key: Any + def __init__(self, prop) -> None: ... + @classmethod + def from_relationship(cls, prop): ... + def hasparent(self, state): ... + def per_property_preprocessors(self, uow) -> None: ... + def per_property_flush_actions(self, uow) -> None: ... + def per_state_flush_actions(self, uow, states, isdelete) -> None: ... + def presort_deletes(self, uowcommit, states): ... + def presort_saves(self, uowcommit, states): ... + def process_deletes(self, uowcommit, states) -> None: ... + def process_saves(self, uowcommit, states) -> None: ... + def prop_has_changes(self, uowcommit, states, isdelete): ... + +class OneToManyDP(DependencyProcessor): + def per_property_dependencies( + self, uow, parent_saves, child_saves, parent_deletes, child_deletes, after_save, before_delete + ) -> None: ... + def per_state_dependencies( + self, uow, save_parent, delete_parent, child_action, after_save, before_delete, isdelete, childisdelete + ) -> None: ... + def presort_deletes(self, uowcommit, states) -> None: ... + def presort_saves(self, uowcommit, states) -> None: ... + def process_deletes(self, uowcommit, states) -> None: ... + def process_saves(self, uowcommit, states) -> None: ... + +class ManyToOneDP(DependencyProcessor): + def __init__(self, prop) -> None: ... + def per_property_dependencies( + self, uow, parent_saves, child_saves, parent_deletes, child_deletes, after_save, before_delete + ) -> None: ... + def per_state_dependencies( + self, uow, save_parent, delete_parent, child_action, after_save, before_delete, isdelete, childisdelete + ) -> None: ... + def presort_deletes(self, uowcommit, states) -> None: ... + def presort_saves(self, uowcommit, states) -> None: ... + def process_deletes(self, uowcommit, states) -> None: ... + def process_saves(self, uowcommit, states) -> None: ... + +class DetectKeySwitch(DependencyProcessor): + def per_property_preprocessors(self, uow) -> None: ... + def per_property_flush_actions(self, uow) -> None: ... + def per_state_flush_actions(self, uow, states, isdelete) -> None: ... + def presort_deletes(self, uowcommit, states) -> None: ... + def presort_saves(self, uow, states) -> None: ... + def prop_has_changes(self, uow, states, isdelete): ... + def process_deletes(self, uowcommit, states) -> None: ... + def process_saves(self, uowcommit, states) -> None: ... + +class ManyToManyDP(DependencyProcessor): + def per_property_dependencies( + self, uow, parent_saves, child_saves, parent_deletes, child_deletes, after_save, before_delete + ) -> None: ... + def per_state_dependencies( + self, uow, save_parent, delete_parent, child_action, after_save, before_delete, isdelete, childisdelete + ) -> None: ... + def presort_deletes(self, uowcommit, states) -> None: ... + def presort_saves(self, uowcommit, states) -> None: ... + def process_deletes(self, uowcommit, states) -> None: ... + def process_saves(self, uowcommit, states) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/descriptor_props.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/descriptor_props.pyi new file mode 100644 index 0000000..3021db3 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/descriptor_props.pyi @@ -0,0 +1,73 @@ +from typing import Any, ClassVar, Generic, TypeVar + +from ..sql.operators import ColumnOperators +from ..util import memoized_property +from . import util as orm_util +from .interfaces import MapperProperty, PropComparator + +_T = TypeVar("_T") + +class DescriptorProperty(MapperProperty): + doc: Any + uses_objects: bool + key: Any + descriptor: Any + def instrument_class(self, mapper): ... + +class CompositeProperty(DescriptorProperty): + attrs: Any + composite_class: Any + active_history: Any + deferred: Any + group: Any + comparator_factory: Any + info: Any + def __init__(self, class_, *attrs, **kwargs) -> None: ... + def instrument_class(self, mapper) -> None: ... + def do_init(self) -> None: ... + @memoized_property + def props(self): ... + @property + def columns(self): ... + def get_history(self, state, dict_, passive=...): ... + + class CompositeBundle(orm_util.Bundle): + property: Any + def __init__(self, property_, expr) -> None: ... + def create_row_processor(self, query, procs, labels): ... + + class Comparator(PropComparator[_T], Generic[_T]): + __hash__: ClassVar[None] # type: ignore[assignment] + @memoized_property + def clauses(self): ... + def __clause_element__(self): ... + @memoized_property + def expression(self): ... + def __eq__(self, other) -> ColumnOperators[_T]: ... # type: ignore[override] + def __ne__(self, other) -> ColumnOperators[_T]: ... # type: ignore[override] + +class ConcreteInheritedProperty(DescriptorProperty): + descriptor: Any + def __init__(self): ... + +class SynonymProperty(DescriptorProperty): + name: Any + map_column: Any + descriptor: Any + comparator_factory: Any + doc: Any + info: Any + def __init__( + self, + name, + map_column: Any | None = ..., + descriptor: Any | None = ..., + comparator_factory: Any | None = ..., + doc: Any | None = ..., + info: Any | None = ..., + ) -> None: ... + @property + def uses_objects(self): ... + def get_history(self, *arg, **kw): ... + parent: Any + def set_parent(self, parent, init) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/dynamic.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/dynamic.pyi new file mode 100644 index 0000000..801fe6a --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/dynamic.pyi @@ -0,0 +1,84 @@ +from typing import Any, Generic, TypeVar + +from . import attributes, strategies +from .query import Query + +_T = TypeVar("_T") + +class DynaLoader(strategies.AbstractRelationshipLoader): + logger: Any + is_class_level: bool + def init_class_attribute(self, mapper) -> None: ... + +class DynamicAttributeImpl(attributes.AttributeImpl): + uses_objects: bool + default_accepts_scalar_loader: bool + supports_population: bool + collection: bool + dynamic: bool + order_by: Any + target_mapper: Any + query_class: Any + def __init__( + self, class_, key, typecallable, dispatch, target_mapper, order_by, query_class: Any | None = ..., **kw + ) -> None: ... + def get(self, state, dict_, passive=...): ... + def get_collection(self, state, dict_, user_data: Any | None = ..., passive=...): ... + def fire_append_event(self, state, dict_, value, initiator, collection_history: Any | None = ...) -> None: ... + def fire_remove_event(self, state, dict_, value, initiator, collection_history: Any | None = ...) -> None: ... + def set( + self, + state, + dict_, + value, + initiator: Any | None = ..., + passive=..., + check_old: Any | None = ..., + pop: bool = ..., + _adapt: bool = ..., + ) -> None: ... + def delete(self, *args, **kwargs) -> None: ... + def set_committed_value(self, state, dict_, value) -> None: ... + def get_history(self, state, dict_, passive=...): ... + def get_all_pending(self, state, dict_, passive=...): ... + def append(self, state, dict_, value, initiator, passive=...) -> None: ... + def remove(self, state, dict_, value, initiator, passive=...) -> None: ... + def pop(self, state, dict_, value, initiator, passive=...) -> None: ... + +class DynamicCollectionAdapter: + data: Any + def __init__(self, data) -> None: ... + def __iter__(self): ... + def __len__(self): ... + def __bool__(self): ... + __nonzero__: Any + +class AppenderMixin: + query_class: Any + instance: Any + attr: Any + def __init__(self, attr, state) -> None: ... + session: Any + def __getitem__(self, index): ... + def count(self): ... + def extend(self, iterator) -> None: ... + def append(self, item) -> None: ... + def remove(self, item) -> None: ... + +class AppenderQuery(AppenderMixin, Query[_T], Generic[_T]): ... + +def mixin_user_query(cls): ... + +class CollectionHistory: + unchanged_items: Any + added_items: Any + deleted_items: Any + def __init__(self, attr, state, apply_to: Any | None = ...) -> None: ... + @property + def added_plus_unchanged(self): ... + @property + def all_items(self): ... + def as_history(self): ... + def indexed(self, index): ... + def add_added(self, value) -> None: ... + def add_removed(self, value) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi new file mode 100644 index 0000000..dbf481a --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi @@ -0,0 +1,24 @@ +from typing import Any + +from ..sql import operators + +class UnevaluatableError(Exception): ... + +class _NoObject(operators.ColumnOperators[Any]): + def operate(self, *arg, **kw) -> None: ... + def reverse_operate(self, *arg, **kw) -> None: ... + +class EvaluatorCompiler: + target_cls: Any + def __init__(self, target_cls: Any | None = ...) -> None: ... + def process(self, *clauses): ... + def visit_grouping(self, clause): ... + def visit_null(self, clause): ... + def visit_false(self, clause): ... + def visit_true(self, clause): ... + def visit_column(self, clause): ... + def visit_tuple(self, clause): ... + def visit_clauselist(self, clause): ... + def visit_binary(self, clause): ... + def visit_unary(self, clause): ... + def visit_bindparam(self, clause): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/events.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/events.pyi new file mode 100644 index 0000000..36a6414 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/events.pyi @@ -0,0 +1,104 @@ +from typing import Any + +from .. import event + +class InstrumentationEvents(event.Events): + def class_instrument(self, cls) -> None: ... + def class_uninstrument(self, cls) -> None: ... + def attribute_instrument(self, cls, key, inst) -> None: ... + +class _InstrumentationEventsHold: + class_: Any + def __init__(self, class_) -> None: ... + dispatch: Any + +class InstanceEvents(event.Events): + def first_init(self, manager, cls) -> None: ... + def init(self, target, args, kwargs) -> None: ... + def init_failure(self, target, args, kwargs) -> None: ... + def load(self, target, context) -> None: ... + def refresh(self, target, context, attrs) -> None: ... + def refresh_flush(self, target, flush_context, attrs) -> None: ... + def expire(self, target, attrs) -> None: ... + def pickle(self, target, state_dict) -> None: ... + def unpickle(self, target, state_dict) -> None: ... + +class _EventsHold(event.RefCollection): + class_: Any + def __init__(self, class_) -> None: ... + + class HoldEvents: ... + + def remove(self, event_key) -> None: ... + @classmethod + def populate(cls, class_, subject) -> None: ... + +class _InstanceEventsHold(_EventsHold): + all_holds: Any + def resolve(self, class_): ... + + class HoldInstanceEvents(_EventsHold.HoldEvents, InstanceEvents): ... + dispatch: Any + +class MapperEvents(event.Events): + def instrument_class(self, mapper, class_) -> None: ... + def before_mapper_configured(self, mapper, class_) -> None: ... + def mapper_configured(self, mapper, class_) -> None: ... + def before_configured(self) -> None: ... + def after_configured(self) -> None: ... + def before_insert(self, mapper, connection, target) -> None: ... + def after_insert(self, mapper, connection, target) -> None: ... + def before_update(self, mapper, connection, target) -> None: ... + def after_update(self, mapper, connection, target) -> None: ... + def before_delete(self, mapper, connection, target) -> None: ... + def after_delete(self, mapper, connection, target) -> None: ... + +class _MapperEventsHold(_EventsHold): + all_holds: Any + def resolve(self, class_): ... + + class HoldMapperEvents(_EventsHold.HoldEvents, MapperEvents): ... + dispatch: Any + +class SessionEvents(event.Events): + def do_orm_execute(self, orm_execute_state) -> None: ... + def after_transaction_create(self, session, transaction) -> None: ... + def after_transaction_end(self, session, transaction) -> None: ... + def before_commit(self, session) -> None: ... + def after_commit(self, session) -> None: ... + def after_rollback(self, session) -> None: ... + def after_soft_rollback(self, session, previous_transaction) -> None: ... + def before_flush(self, session, flush_context, instances) -> None: ... + def after_flush(self, session, flush_context) -> None: ... + def after_flush_postexec(self, session, flush_context) -> None: ... + def after_begin(self, session, transaction, connection) -> None: ... + def before_attach(self, session, instance) -> None: ... + def after_attach(self, session, instance) -> None: ... + def after_bulk_update(self, update_context) -> None: ... + def after_bulk_delete(self, delete_context) -> None: ... + def transient_to_pending(self, session, instance) -> None: ... + def pending_to_transient(self, session, instance) -> None: ... + def persistent_to_transient(self, session, instance) -> None: ... + def pending_to_persistent(self, session, instance) -> None: ... + def detached_to_persistent(self, session, instance) -> None: ... + def loaded_as_persistent(self, session, instance) -> None: ... + def persistent_to_deleted(self, session, instance) -> None: ... + def deleted_to_persistent(self, session, instance) -> None: ... + def deleted_to_detached(self, session, instance) -> None: ... + def persistent_to_detached(self, session, instance) -> None: ... + +class AttributeEvents(event.Events): + def append(self, target, value, initiator) -> None: ... + def append_wo_mutation(self, target, value, initiator) -> None: ... + def bulk_replace(self, target, values, initiator) -> None: ... + def remove(self, target, value, initiator) -> None: ... + def set(self, target, value, oldvalue, initiator) -> None: ... + def init_scalar(self, target, value, dict_) -> None: ... + def init_collection(self, target, collection, collection_adapter) -> None: ... + def dispose_collection(self, target, collection, collection_adapter) -> None: ... + def modified(self, target, initiator) -> None: ... + +class QueryEvents(event.Events): + def before_compile(self, query) -> None: ... + def before_compile_update(self, query, update_context) -> None: ... + def before_compile_delete(self, query, delete_context) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/exc.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/exc.pyi new file mode 100644 index 0000000..f6536c5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/exc.pyi @@ -0,0 +1,34 @@ +from typing import Any + +from .. import exc as sa_exc +from ..exc import NoResultFound as NoResultFound + +NO_STATE: Any + +class StaleDataError(sa_exc.SQLAlchemyError): ... + +ConcurrentModificationError = StaleDataError + +class FlushError(sa_exc.SQLAlchemyError): ... +class UnmappedError(sa_exc.InvalidRequestError): ... +class ObjectDereferencedError(sa_exc.SQLAlchemyError): ... + +class DetachedInstanceError(sa_exc.SQLAlchemyError): + code: str + +class UnmappedInstanceError(UnmappedError): + def __init__(self, obj, msg: Any | None = ...) -> None: ... + def __reduce__(self): ... + +class UnmappedClassError(UnmappedError): + def __init__(self, cls, msg: Any | None = ...) -> None: ... + def __reduce__(self): ... + +class ObjectDeletedError(sa_exc.InvalidRequestError): + def __init__(self, state, msg: Any | None = ...) -> None: ... + def __reduce__(self): ... + +class UnmappedColumnError(sa_exc.InvalidRequestError): ... + +class LoaderStrategyException(sa_exc.InvalidRequestError): + def __init__(self, applied_to_property_type, requesting_property, applies_to, actual_strategy_type, strategy_key) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/identity.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/identity.pyi new file mode 100644 index 0000000..85329f1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/identity.pyi @@ -0,0 +1,31 @@ +from typing import Any + +class IdentityMap: + def keys(self): ... + def replace(self, state) -> None: ... + def add(self, state) -> None: ... + def update(self, dict_) -> None: ... + def clear(self) -> None: ... + def check_modified(self): ... + def has_key(self, key): ... + def popitem(self) -> None: ... + def pop(self, key, *args) -> None: ... + def setdefault(self, key, default: Any | None = ...) -> None: ... + def __len__(self): ... + def copy(self) -> None: ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + +class WeakInstanceDict(IdentityMap): + def __getitem__(self, key): ... + def __contains__(self, key): ... + def contains_state(self, state): ... + def replace(self, state): ... + def add(self, state): ... + def get(self, key, default: Any | None = ...): ... + def items(self): ... + def values(self): ... + def __iter__(self): ... + def all_states(self): ... + def discard(self, state) -> None: ... + def safe_discard(self, state) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/instrumentation.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/instrumentation.pyi new file mode 100644 index 0000000..d3fcb9d --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/instrumentation.pyi @@ -0,0 +1,87 @@ +from typing import Any + +from ..util import HasMemoized, hybridmethod +from . import base + +DEL_ATTR: Any + +class ClassManager(HasMemoized, dict[Any, Any]): + MANAGER_ATTR: Any + STATE_ATTR: Any + expired_attribute_loader: Any + init_method: Any + factory: Any + mapper: Any + declarative_scan: Any + registry: Any + @property + def deferred_scalar_loader(self): ... + @deferred_scalar_loader.setter + def deferred_scalar_loader(self, obj) -> None: ... + class_: Any + info: Any + new_init: Any + local_attrs: Any + originals: Any + def __init__(self, class_) -> None: ... + def __hash__(self): ... + def __eq__(self, other): ... + @property + def is_mapped(self): ... + # Will be overwritten when mapped + # def mapper(self) -> None: ... + def manage(self) -> None: ... + @hybridmethod + def manager_getter(self): ... + @hybridmethod + def state_getter(self): ... + @hybridmethod + def dict_getter(self): ... + def instrument_attribute(self, key, inst, propagated: bool = ...) -> None: ... + def subclass_managers(self, recursive) -> None: ... + def post_configure_attribute(self, key) -> None: ... + def uninstrument_attribute(self, key, propagated: bool = ...) -> None: ... + def unregister(self) -> None: ... + def install_descriptor(self, key, inst) -> None: ... + def uninstall_descriptor(self, key) -> None: ... + def install_member(self, key, implementation) -> None: ... + def uninstall_member(self, key) -> None: ... + def instrument_collection_class(self, key, collection_class): ... + def initialize_collection(self, key, state, factory): ... + def is_instrumented(self, key, search: bool = ...): ... + def get_impl(self, key): ... + @property + def attributes(self): ... + def new_instance(self, state: Any | None = ...): ... + def setup_instance(self, instance, state: Any | None = ...) -> None: ... + def teardown_instance(self, instance) -> None: ... + def has_state(self, instance): ... + def has_parent(self, state, key, optimistic: bool = ...): ... + def __bool__(self): ... + __nonzero__: Any + +class _SerializeManager: + class_: Any + def __init__(self, state, d) -> None: ... + def __call__(self, state, inst, state_dict) -> None: ... + +class InstrumentationFactory: + def create_manager_for_cls(self, class_): ... + def unregister(self, class_) -> None: ... + +instance_state: Any + +instance_dict: Any +manager_of_class = base.manager_of_class + +def register_class( + class_, + finalize: bool = ..., + mapper: Any | None = ..., + registry: Any | None = ..., + declarative_scan: Any | None = ..., + expired_attribute_loader: Any | None = ..., + init_method: Any | None = ..., +): ... +def unregister_class(class_) -> None: ... +def is_instrumented(instance, key): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/interfaces.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/interfaces.pyi new file mode 100644 index 0000000..ccc6380 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/interfaces.pyi @@ -0,0 +1,130 @@ +from typing import Any, Generic, TypeVar + +from .. import util +from ..sql import operators, roles +from ..sql.base import ExecutableOption +from ..sql.traversals import HasCacheKey +from .base import ( + EXT_CONTINUE as EXT_CONTINUE, + EXT_SKIP as EXT_SKIP, + EXT_STOP as EXT_STOP, + MANYTOMANY as MANYTOMANY, + MANYTOONE as MANYTOONE, + NOT_EXTENSION as NOT_EXTENSION, + ONETOMANY as ONETOMANY, + InspectionAttr as InspectionAttr, + InspectionAttrInfo as InspectionAttrInfo, + _MappedAttribute as _MappedAttribute, +) + +_T = TypeVar("_T") + +__all__ = ( + "EXT_CONTINUE", + "EXT_STOP", + "EXT_SKIP", + "ONETOMANY", + "MANYTOMANY", + "MANYTOONE", + "NOT_EXTENSION", + "LoaderStrategy", + "MapperOption", + "LoaderOption", + "MapperProperty", + "PropComparator", + "StrategizedProperty", +) + +class ORMStatementRole(roles.StatementRole): ... +class ORMColumnsClauseRole(roles.ColumnsClauseRole): ... +class ORMEntityColumnsClauseRole(ORMColumnsClauseRole): ... +class ORMFromClauseRole(roles.StrictFromClauseRole): ... + +class MapperProperty(HasCacheKey, _MappedAttribute, InspectionAttr, util.MemoizedSlots): + cascade: Any + is_property: bool + def setup(self, context, query_entity, path, adapter, **kwargs) -> None: ... + def create_row_processor(self, context, query_entity, path, mapper, result, adapter, populators) -> None: ... + def cascade_iterator(self, type_, state, dict_, visited_states, halt_on: Any | None = ...): ... + parent: Any + def set_parent(self, parent, init) -> None: ... + def instrument_class(self, mapper) -> None: ... + def __init__(self) -> None: ... + def init(self) -> None: ... + @property + def class_attribute(self): ... + def do_init(self) -> None: ... + def post_instrument_class(self, mapper) -> None: ... + def merge( + self, session, source_state, source_dict, dest_state, dest_dict, load, _recursive, _resolve_conflict_map + ) -> None: ... + +class PropComparator(operators.ColumnOperators[_T], Generic[_T]): + __visit_name__: str + prop: Any + property: Any + def __init__(self, prop, parentmapper, adapt_to_entity: Any | None = ...) -> None: ... + def __clause_element__(self) -> None: ... + def adapt_to_entity(self, adapt_to_entity): ... + @property + def adapter(self): ... + @property + def info(self): ... + @staticmethod + def any_op(a, b, **kwargs): ... + @staticmethod + def has_op(a, b, **kwargs): ... + @staticmethod + def of_type_op(a, class_): ... + def of_type(self, class_): ... + def and_(self, *criteria): ... + def any(self, criterion: Any | None = ..., **kwargs): ... + def has(self, criterion: Any | None = ..., **kwargs): ... + +class StrategizedProperty(MapperProperty): + inherit_cache: bool + strategy_wildcard_key: Any + def setup(self, context, query_entity, path, adapter, **kwargs) -> None: ... + def create_row_processor(self, context, query_entity, path, mapper, result, adapter, populators) -> None: ... + strategy: Any + def do_init(self) -> None: ... + def post_instrument_class(self, mapper) -> None: ... + @classmethod + def strategy_for(cls, **kw): ... + +class ORMOption(ExecutableOption): + propagate_to_loaders: bool + +class CompileStateOption(HasCacheKey, ORMOption): + def process_compile_state(self, compile_state) -> None: ... + def process_compile_state_replaced_entities(self, compile_state, mapper_entities) -> None: ... + +class LoaderOption(CompileStateOption): + def process_compile_state_replaced_entities(self, compile_state, mapper_entities) -> None: ... + def process_compile_state(self, compile_state) -> None: ... + +class CriteriaOption(CompileStateOption): + def process_compile_state(self, compile_state) -> None: ... + def get_global_criteria(self, attributes) -> None: ... + +class UserDefinedOption(ORMOption): + propagate_to_loaders: bool + payload: Any + def __init__(self, payload: Any | None = ...) -> None: ... + +class MapperOption(ORMOption): + propagate_to_loaders: bool + def process_query(self, query) -> None: ... + def process_query_conditionally(self, query) -> None: ... + +class LoaderStrategy: + parent_property: Any + is_class_level: bool + parent: Any + key: Any + strategy_key: Any + strategy_opts: Any + def __init__(self, parent, strategy_key) -> None: ... + def init_class_attribute(self, mapper) -> None: ... + def setup_query(self, compile_state, query_entity, path, loadopt, adapter, **kwargs) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/loading.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/loading.pyi new file mode 100644 index 0000000..776f8c5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/loading.pyi @@ -0,0 +1,46 @@ +from typing import Any + +def instances(cursor, context): ... +def merge_frozen_result(session, statement, frozen_result, load: bool = ...): ... +def merge_result(query, iterator, load: bool = ...): ... +def get_from_identity(session, mapper, key, passive): ... +def load_on_ident( + session, + statement, + key, + load_options: Any | None = ..., + refresh_state: Any | None = ..., + with_for_update: Any | None = ..., + only_load_props: Any | None = ..., + no_autoflush: bool = ..., + bind_arguments=..., + execution_options=..., +): ... +def load_on_pk_identity( + session, + statement, + primary_key_identity, + load_options: Any | None = ..., + refresh_state: Any | None = ..., + with_for_update: Any | None = ..., + only_load_props: Any | None = ..., + identity_token: Any | None = ..., + no_autoflush: bool = ..., + bind_arguments=..., + execution_options=..., +): ... + +class PostLoad: + loaders: Any + states: Any + load_keys: Any + def add_state(self, state, overwrite) -> None: ... + def invoke(self, context, path) -> None: ... + @classmethod + def for_context(cls, context, path, only_load_props): ... + @classmethod + def path_exists(cls, context, path, key): ... + @classmethod + def callable_for_path(cls, context, path, limit_to_mapper, token, loader_callable, *arg, **kw) -> None: ... + +def load_scalar_attributes(mapper, state, attribute_names, passive) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/mapper.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/mapper.pyi new file mode 100644 index 0000000..931bde7 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/mapper.pyi @@ -0,0 +1,143 @@ +from typing import Any + +from ..sql import base as sql_base +from ..util import HasMemoized, memoized_property +from .base import ( + _class_to_mapper as _class_to_mapper, + _state_mapper as _state_mapper, + class_mapper as class_mapper, + state_str as state_str, +) +from .interfaces import InspectionAttr, ORMEntityColumnsClauseRole, ORMFromClauseRole + +NO_ATTRIBUTE: Any + +class Mapper(ORMFromClauseRole, ORMEntityColumnsClauseRole, sql_base.MemoizedHasCacheKey, InspectionAttr): + logger: Any + class_: Any + class_manager: Any + non_primary: Any + always_refresh: Any + version_id_prop: Any + version_id_col: Any + version_id_generator: bool + concrete: Any + single: bool + inherits: Any + local_table: Any + inherit_condition: Any + inherit_foreign_keys: Any + batch: Any + eager_defaults: Any + column_prefix: Any + polymorphic_on: Any + validators: Any + passive_updates: Any + passive_deletes: Any + legacy_is_orphan: Any + allow_partial_pks: Any + confirm_deleted_rows: bool + polymorphic_load: Any + polymorphic_identity: Any + polymorphic_map: Any + include_properties: Any + exclude_properties: Any + def __init__( + self, + class_, + local_table: Any | None = ..., + properties: Any | None = ..., + primary_key: Any | None = ..., + non_primary: bool = ..., + inherits: Any | None = ..., + inherit_condition: Any | None = ..., + inherit_foreign_keys: Any | None = ..., + always_refresh: bool = ..., + version_id_col: Any | None = ..., + version_id_generator: Any | None = ..., + polymorphic_on: Any | None = ..., + _polymorphic_map: Any | None = ..., + polymorphic_identity: Any | None = ..., + concrete: bool = ..., + with_polymorphic: Any | None = ..., + polymorphic_load: Any | None = ..., + allow_partial_pks: bool = ..., + batch: bool = ..., + column_prefix: Any | None = ..., + include_properties: Any | None = ..., + exclude_properties: Any | None = ..., + passive_updates: bool = ..., + passive_deletes: bool = ..., + confirm_deleted_rows: bool = ..., + eager_defaults: bool = ..., + legacy_is_orphan: bool = ..., + _compiled_cache_size: int = ..., + ): ... + is_mapper: bool + represents_outer_join: bool + @property + def mapper(self): ... + @property + def entity(self): ... + persist_selectable: Any + configured: bool + tables: Any + primary_key: Any + base_mapper: Any + columns: Any + c: Any + @property + def mapped_table(self): ... + def add_properties(self, dict_of_properties) -> None: ... + def add_property(self, key, prop) -> None: ... + def has_property(self, key): ... + def get_property(self, key, _configure_mappers: bool = ...): ... + def get_property_by_column(self, column): ... + @property + def iterate_properties(self): ... + with_polymorphic_mappers: Any + def __clause_element__(self): ... + @memoized_property + def select_identity_token(self): ... + @property + def selectable(self): ... + @HasMemoized.memoized_attribute + def attrs(self): ... + @HasMemoized.memoized_attribute + def all_orm_descriptors(self): ... + @HasMemoized.memoized_attribute + def synonyms(self): ... + @property + def entity_namespace(self): ... + @HasMemoized.memoized_attribute + def column_attrs(self): ... + @HasMemoized.memoized_attribute + def relationships(self): ... + @HasMemoized.memoized_attribute + def composites(self): ... + def common_parent(self, other): ... + def is_sibling(self, other): ... + def isa(self, other): ... + def iterate_to_root(self) -> None: ... + @HasMemoized.memoized_attribute + def self_and_descendants(self): ... + def polymorphic_iterator(self): ... + def primary_mapper(self): ... + @property + def primary_base_mapper(self): ... + def identity_key_from_row(self, row, identity_token: Any | None = ..., adapter: Any | None = ...): ... + def identity_key_from_primary_key(self, primary_key, identity_token: Any | None = ...): ... + def identity_key_from_instance(self, instance): ... + def primary_key_from_instance(self, instance): ... + def cascade_iterator(self, type_, state, halt_on: Any | None = ...) -> None: ... + +class _OptGetColumnsNotAvailable(Exception): ... + +def configure_mappers() -> None: ... +def reconstructor(fn): ... +def validates(*names, **kw): ... + +class _ColumnMapping(dict[Any, Any]): + mapper: Any + def __init__(self, mapper) -> None: ... + def __missing__(self, column) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/path_registry.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/path_registry.pyi new file mode 100644 index 0000000..6d76489 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/path_registry.pyi @@ -0,0 +1,106 @@ +from typing import Any, ClassVar + +from ..sql.traversals import HasCacheKey +from ..util import memoized_property +from . import base as orm_base + +log: Any + +class PathRegistry(HasCacheKey): + root: ClassVar[RootRegistry] + is_token: bool + is_root: bool + def __eq__(self, other): ... + def __ne__(self, other): ... + def set(self, attributes, key, value) -> None: ... + def setdefault(self, attributes, key, value) -> None: ... + def get(self, attributes, key, value: Any | None = ...): ... + def __len__(self): ... + def __hash__(self): ... + @property + def length(self): ... + def pairs(self) -> None: ... + def contains_mapper(self, mapper): ... + def contains(self, attributes, key): ... + def __reduce__(self): ... + @classmethod + def serialize_context_dict(cls, dict_, tokens): ... + @classmethod + def deserialize_context_dict(cls, serialized): ... + def serialize(self): ... + @classmethod + def deserialize(cls, path): ... + @classmethod + def per_mapper(cls, mapper): ... + @classmethod + def coerce(cls, raw): ... + def token(self, token): ... + def __add__(self, other): ... + +class RootRegistry(PathRegistry): + inherit_cache: bool + path: Any + natural_path: Any + has_entity: bool + is_aliased_class: bool + is_root: bool + def __getitem__(self, entity): ... + +class PathToken(orm_base.InspectionAttr, HasCacheKey, str): + @classmethod + def intern(cls, strvalue): ... + +class TokenRegistry(PathRegistry): + inherit_cache: bool + token: Any + parent: Any + path: Any + natural_path: Any + def __init__(self, parent, token) -> None: ... + has_entity: bool + is_token: bool + def generate_for_superclasses(self) -> None: ... + def __getitem__(self, entity) -> None: ... + +class PropRegistry(PathRegistry): + is_unnatural: bool + inherit_cache: bool + prop: Any + parent: Any + path: Any + natural_path: Any + def __init__(self, parent, prop) -> None: ... + @memoized_property + def has_entity(self): ... + @memoized_property + def entity(self): ... + @property + def mapper(self): ... + @property + def entity_path(self): ... + def __getitem__(self, entity): ... + +class AbstractEntityRegistry(PathRegistry): + has_entity: bool + key: Any + parent: Any + is_aliased_class: Any + entity: Any + path: Any + natural_path: Any + def __init__(self, parent, entity) -> None: ... + @property + def entity_path(self): ... + @property + def mapper(self): ... + def __bool__(self): ... + __nonzero__: Any + def __getitem__(self, entity): ... + +class SlotsEntityRegistry(AbstractEntityRegistry): + inherit_cache: bool + +class CachingEntityRegistry(AbstractEntityRegistry, dict): # type: ignore[misc] + inherit_cache: bool + def __getitem__(self, entity): ... + def __missing__(self, key): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/persistence.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/persistence.pyi new file mode 100644 index 0000000..8d5d721 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/persistence.pyi @@ -0,0 +1,28 @@ +from typing import Any + +from ..sql.base import CompileState, Options +from ..sql.dml import DeleteDMLState, UpdateDMLState + +def save_obj(base_mapper, states, uowtransaction, single: bool = ...) -> None: ... +def post_update(base_mapper, states, uowtransaction, post_update_cols) -> None: ... +def delete_obj(base_mapper, states, uowtransaction) -> None: ... + +class BulkUDCompileState(CompileState): + class default_update_options(Options): ... + + @classmethod + def orm_pre_session_exec(cls, session, statement, params, execution_options, bind_arguments, is_reentrant_invoke): ... + @classmethod + def orm_setup_cursor_result(cls, session, statement, params, execution_options, bind_arguments, result): ... + +class BulkORMUpdate(UpdateDMLState, BulkUDCompileState): + mapper: Any + extra_criteria_entities: Any + @classmethod + def create_for_statement(cls, statement, compiler, **kw): ... + +class BulkORMDelete(DeleteDMLState, BulkUDCompileState): + mapper: Any + extra_criteria_entities: Any + @classmethod + def create_for_statement(cls, statement, compiler, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/properties.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/properties.pyi new file mode 100644 index 0000000..21dd028 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/properties.pyi @@ -0,0 +1,45 @@ +from typing import Any + +from .. import util +from .descriptor_props import ( + CompositeProperty as CompositeProperty, + ConcreteInheritedProperty as ConcreteInheritedProperty, + SynonymProperty as SynonymProperty, +) +from .interfaces import PropComparator, StrategizedProperty +from .relationships import RelationshipProperty as RelationshipProperty + +__all__ = ["ColumnProperty", "CompositeProperty", "ConcreteInheritedProperty", "RelationshipProperty", "SynonymProperty"] + +class ColumnProperty(StrategizedProperty): + logger: Any + strategy_wildcard_key: str + inherit_cache: bool + columns: Any + group: Any + deferred: Any + raiseload: Any + instrument: Any + comparator_factory: Any + descriptor: Any + active_history: Any + expire_on_flush: Any + info: Any + doc: Any + strategy_key: Any + def __init__(self, *columns, **kwargs) -> None: ... + def __clause_element__(self): ... + @property + def expression(self): ... + def instrument_class(self, mapper) -> None: ... + def do_init(self) -> None: ... + def copy(self): ... + def merge( + self, session, source_state, source_dict, dest_state, dest_dict, load, _recursive, _resolve_conflict_map + ) -> None: ... + + class Comparator(util.MemoizedSlots, PropComparator[Any]): + expressions: Any + def _memoized_method___clause_element__(self): ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi new file mode 100644 index 0000000..21aef16 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi @@ -0,0 +1,133 @@ +from _typeshed import Self +from collections.abc import Iterator +from typing import Any, Generic, TypeVar +from typing_extensions import Literal, TypeAlias + +from ..sql.annotation import SupportsCloneAnnotations +from ..sql.base import Executable +from ..sql.selectable import GroupedElement, HasHints, HasPrefixes, HasSuffixes, SelectBase, _SelectFromElements +from . import interfaces +from .context import QueryContext as QueryContext +from .util import aliased as aliased + +__all__ = ["Query", "QueryContext", "aliased"] + +_T = TypeVar("_T") +_SynchronizeSessionArgument: TypeAlias = Literal[False, "evaluate", "fetch"] + +class Query(_SelectFromElements, SupportsCloneAnnotations, HasPrefixes, HasSuffixes, HasHints, Executable, Generic[_T]): + logger: Any + load_options: Any + session: Any + def __init__(self, entities, session: Any | None = ...) -> None: ... + @property + def statement(self): ... + def subquery(self, name: str | None = ..., with_labels: bool = ..., reduce_columns: bool = ...): ... + def cte(self, name: Any | None = ..., recursive: bool = ..., nesting: bool = ...): ... + def label(self, name): ... + def as_scalar(self): ... + def scalar_subquery(self): ... + @property + def selectable(self): ... + def __clause_element__(self): ... + def only_return_tuples(self: Self, value) -> Self: ... + @property + def is_single_entity(self): ... + def enable_eagerloads(self: Self, value) -> Self: ... + def with_labels(self): ... + apply_labels: Any + @property + def get_label_style(self): ... + def set_label_style(self, style): ... + def enable_assertions(self: Self, value) -> Self: ... + @property + def whereclause(self): ... + def with_polymorphic(self: Self, cls_or_mappers, selectable: Any | None = ..., polymorphic_on: Any | None = ...) -> Self: ... + def yield_per(self: Self, count) -> Self: ... + def get(self, ident): ... + @property + def lazy_loaded_from(self): ... + def correlate(self: Self, *fromclauses) -> Self: ... + def autoflush(self: Self, setting) -> Self: ... + def populate_existing(self: Self) -> Self: ... + def with_parent(self, instance, property: Any | None = ..., from_entity: Any | None = ...): ... + def add_entity(self: Self, entity, alias: Any | None = ...) -> Self: ... + def with_session(self: Self, session) -> Self: ... + def from_self(self, *entities): ... + def values(self, *columns): ... + def value(self, column): ... + def with_entities(self: Self, *entities) -> Self: ... + def add_columns(self: Self, *column) -> Self: ... + def add_column(self, column): ... + def options(self: Self, *args) -> Self: ... + def with_transformation(self, fn): ... + def get_execution_options(self): ... + def execution_options(self: Self, **kwargs) -> Self: ... + def with_for_update( + self: Self, read: bool = ..., nowait: bool = ..., of: Any | None = ..., skip_locked: bool = ..., key_share: bool = ... + ) -> Self: ... + def params(self: Self, *args, **kwargs) -> Self: ... + def where(self, *criterion): ... + def filter(self: Self, *criterion) -> Self: ... + def filter_by(self: Self, **kwargs) -> Self: ... + def order_by(self: Self, *clauses) -> Self: ... + def group_by(self: Self, *clauses) -> Self: ... + def having(self: Self, criterion) -> Self: ... + def union(self, *q): ... + def union_all(self, *q): ... + def intersect(self, *q): ... + def intersect_all(self, *q): ... + def except_(self, *q): ... + def except_all(self, *q): ... + def join(self: Self, target, *props, **kwargs) -> Self: ... + def outerjoin(self: Self, target, *props, **kwargs) -> Self: ... + def reset_joinpoint(self: Self) -> Self: ... + def select_from(self: Self, *from_obj) -> Self: ... + def select_entity_from(self: Self, from_obj) -> Self: ... + def __getitem__(self, item): ... + def slice(self: Self, start, stop) -> Self: ... + def limit(self: Self, limit) -> Self: ... + def offset(self: Self, offset) -> Self: ... + def distinct(self: Self, *expr) -> Self: ... + def all(self) -> list[_T]: ... + def from_statement(self: Self, statement) -> Self: ... + def first(self) -> _T | None: ... + def one_or_none(self): ... + def one(self): ... + def scalar(self) -> Any: ... # type: ignore[override] + def __iter__(self) -> Iterator[_T]: ... + @property + def column_descriptions(self): ... + def instances(self, result_proxy, context: Any | None = ...): ... + def merge_result(self, iterator, load: bool = ...): ... + def exists(self): ... + def count(self) -> int: ... + def delete(self, synchronize_session: _SynchronizeSessionArgument = ...) -> int: ... + def update(self, values, synchronize_session: _SynchronizeSessionArgument = ..., update_args: Any | None = ...): ... + +class FromStatement(GroupedElement, SelectBase, Executable): + __visit_name__: str + element: Any + def __init__(self, entities, element) -> None: ... + def get_label_style(self): ... + def set_label_style(self, label_style): ... + def get_children(self, **kw) -> None: ... # type: ignore[override] + +class AliasOption(interfaces.LoaderOption): + def __init__(self, alias) -> None: ... + inherit_cache: bool + def process_compile_state(self, compile_state) -> None: ... + +class BulkUD: + query: Any + mapper: Any + def __init__(self, query) -> None: ... + @property + def session(self): ... + +class BulkUpdate(BulkUD): + values: Any + update_kwargs: Any + def __init__(self, query, values, update_kwargs) -> None: ... + +class BulkDelete(BulkUD): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/relationships.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/relationships.pyi new file mode 100644 index 0000000..09f4eef --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/relationships.pyi @@ -0,0 +1,179 @@ +from typing import Any, ClassVar, Generic, TypeVar + +from ..sql.operators import ColumnOperators +from ..util import memoized_property +from .interfaces import PropComparator, StrategizedProperty + +_T = TypeVar("_T") + +def remote(expr): ... +def foreign(expr): ... + +class RelationshipProperty(StrategizedProperty): + logger: Any + strategy_wildcard_key: str + inherit_cache: bool + uselist: Any + argument: Any + secondary: Any + primaryjoin: Any + secondaryjoin: Any + post_update: Any + direction: Any + viewonly: Any + sync_backref: Any + lazy: Any + single_parent: Any + collection_class: Any + passive_deletes: Any + cascade_backrefs: Any + passive_updates: Any + remote_side: Any + enable_typechecks: Any + query_class: Any + innerjoin: Any + distinct_target_key: Any + doc: Any + active_history: Any + join_depth: Any + omit_join: Any + local_remote_pairs: Any + bake_queries: Any + load_on_pending: Any + comparator_factory: Any + comparator: Any + info: Any + strategy_key: Any + order_by: Any + back_populates: Any + backref: Any + def __init__( + self, + argument, + secondary: Any | None = ..., + primaryjoin: Any | None = ..., + secondaryjoin: Any | None = ..., + foreign_keys: Any | None = ..., + uselist: Any | None = ..., + order_by: bool = ..., + backref: Any | None = ..., + back_populates: Any | None = ..., + overlaps: Any | None = ..., + post_update: bool = ..., + cascade: bool = ..., + viewonly: bool = ..., + lazy: str = ..., + collection_class: Any | None = ..., + passive_deletes=..., + passive_updates=..., + remote_side: Any | None = ..., + enable_typechecks=..., + join_depth: Any | None = ..., + comparator_factory: Any | None = ..., + single_parent: bool = ..., + innerjoin: bool = ..., + distinct_target_key: Any | None = ..., + doc: Any | None = ..., + active_history=..., + cascade_backrefs=..., + load_on_pending: bool = ..., + bake_queries: bool = ..., + _local_remote_pairs: Any | None = ..., + query_class: Any | None = ..., + info: Any | None = ..., + omit_join: Any | None = ..., + sync_backref: Any | None = ..., + _legacy_inactive_history_style: bool = ..., + ) -> None: ... + def instrument_class(self, mapper) -> None: ... + + class Comparator(PropComparator[_T], Generic[_T]): + prop: Any + def __init__( + self, prop, parentmapper, adapt_to_entity: Any | None = ..., of_type: Any | None = ..., extra_criteria=... + ) -> None: ... + def adapt_to_entity(self, adapt_to_entity): ... + @memoized_property + def entity(self): ... + @memoized_property + def mapper(self): ... + def __clause_element__(self): ... + def of_type(self, cls): ... + def and_(self, *other): ... + def in_(self, other) -> ColumnOperators[_T]: ... + __hash__: ClassVar[None] # type: ignore[assignment] + def __eq__(self, other): ... + def any(self, criterion: Any | None = ..., **kwargs): ... + def has(self, criterion: Any | None = ..., **kwargs): ... + def contains(self, other, **kwargs) -> ColumnOperators[_T]: ... + def __ne__(self, other) -> ColumnOperators[_T]: ... # type: ignore[override] + @memoized_property + def property(self): ... + + def merge( + self, session, source_state, source_dict, dest_state, dest_dict, load, _recursive, _resolve_conflict_map + ) -> None: ... + def cascade_iterator(self, type_, state, dict_, visited_states, halt_on: Any | None = ...) -> None: ... + @memoized_property + def entity(self): ... + @memoized_property + def mapper(self): ... + def do_init(self) -> None: ... + @property + def cascade(self): ... + @cascade.setter + def cascade(self, cascade) -> None: ... + +class JoinCondition: + parent_persist_selectable: Any + parent_local_selectable: Any + child_persist_selectable: Any + child_local_selectable: Any + parent_equivalents: Any + child_equivalents: Any + primaryjoin: Any + secondaryjoin: Any + secondary: Any + consider_as_foreign_keys: Any + prop: Any + self_referential: Any + support_sync: Any + can_be_synced_fn: Any + def __init__( + self, + parent_persist_selectable, + child_persist_selectable, + parent_local_selectable, + child_local_selectable, + primaryjoin: Any | None = ..., + secondary: Any | None = ..., + secondaryjoin: Any | None = ..., + parent_equivalents: Any | None = ..., + child_equivalents: Any | None = ..., + consider_as_foreign_keys: Any | None = ..., + local_remote_pairs: Any | None = ..., + remote_side: Any | None = ..., + self_referential: bool = ..., + prop: Any | None = ..., + support_sync: bool = ..., + can_be_synced_fn=..., + ): ... + @property + def primaryjoin_minus_local(self): ... + @property + def secondaryjoin_minus_local(self): ... + @memoized_property + def primaryjoin_reverse_remote(self): ... + @memoized_property + def remote_columns(self): ... + @memoized_property + def local_columns(self): ... + @memoized_property + def foreign_key_columns(self): ... + def join_targets(self, source_selectable, dest_selectable, aliased, single_crit: Any | None = ..., extra_criteria=...): ... + def create_lazy_clause(self, reverse_direction: bool = ...): ... + +class _ColInAnnotations: + name: Any + def __init__(self, name) -> None: ... + def __call__(self, c): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/scoping.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/scoping.pyi new file mode 100644 index 0000000..7d73998 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/scoping.pyi @@ -0,0 +1,96 @@ +from typing import Any + +from ..util import memoized_property + +class ScopedSessionMixin: + def __call__(self, **kw): ... + def configure(self, **kwargs) -> None: ... + +class scoped_session(ScopedSessionMixin): + session_factory: Any + registry: Any + def __init__(self, session_factory, scopefunc: Any | None = ...) -> None: ... + def remove(self) -> None: ... + def query_property(self, query_cls: Any | None = ...): ... + # dynamically proxied from class Session + bind: Any + identity_map: Any + autoflush: Any + autocommit: bool + @property + def dirty(self): ... + @property + def deleted(self): ... + @property + def new(self): ... + @property + def is_active(self): ... + @property + def no_autoflush(self) -> None: ... + @memoized_property + def info(self): ... + @classmethod + def close_all(cls) -> None: ... + @classmethod + def identity_key(cls, *args, **kwargs): ... + @classmethod + def object_session(cls, instance): ... + def __contains__(self, instance): ... + def __iter__(self): ... + def add(self, instance, _warn: bool = ...) -> None: ... + def add_all(self, instances) -> None: ... + def begin(self, subtransactions: bool = ..., nested: bool = ..., _subtrans: bool = ...): ... + def begin_nested(self): ... + def close(self) -> None: ... + def commit(self) -> None: ... + def connection( + self, bind_arguments: Any | None = ..., close_with_result: bool = ..., execution_options: Any | None = ..., **kw + ): ... + def delete(self, instance) -> None: ... + def execute( + self, + statement, + params: Any | None = ..., + execution_options=..., + bind_arguments: Any | None = ..., + _parent_execute_state: Any | None = ..., + _add_event: Any | None = ..., + **kw, + ): ... + def expire(self, instance, attribute_names: Any | None = ...) -> None: ... + def expire_all(self) -> None: ... + def expunge(self, instance) -> None: ... + def expunge_all(self) -> None: ... + def flush(self, objects: Any | None = ...) -> None: ... + def get( + self, + entity, + ident, + options: Any | None = ..., + populate_existing: bool = ..., + with_for_update: Any | None = ..., + identity_token: Any | None = ..., + execution_options: Any | None = ..., + ): ... + def get_bind( + self, + mapper: Any | None = ..., + clause: Any | None = ..., + bind: Any | None = ..., + _sa_skip_events: Any | None = ..., + _sa_skip_for_implicit_returning: bool = ..., + ): ... + def is_modified(self, instance, include_collections: bool = ...): ... + def bulk_save_objects( + self, objects, return_defaults: bool = ..., update_changed_only: bool = ..., preserve_order: bool = ... + ): ... + def bulk_insert_mappings(self, mapper, mappings, return_defaults: bool = ..., render_nulls: bool = ...) -> None: ... + def bulk_update_mappings(self, mapper, mappings) -> None: ... + def merge(self, instance, load: bool = ..., options: Any | None = ...): ... + def query(self, *entities, **kwargs): ... + def refresh(self, instance, attribute_names: Any | None = ..., with_for_update: Any | None = ...) -> None: ... + def rollback(self) -> None: ... + def scalar(self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw): ... + def scalars(self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw): ... + +ScopedSession = scoped_session diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi new file mode 100644 index 0000000..8f9d7b0 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi @@ -0,0 +1,223 @@ +from _typeshed import Self +from collections.abc import Mapping +from typing import Any, TypeVar, overload + +from ..engine.base import Connection +from ..engine.result import Result +from ..engine.util import TransactionalContext +from ..sql.elements import ColumnElement +from ..sql.schema import Table +from ..util import MemoizedSlots, memoized_property +from .query import Query + +_T = TypeVar("_T") + +class _SessionClassMethods: + @classmethod + def close_all(cls) -> None: ... + @classmethod + def identity_key(cls, *args, **kwargs): ... + @classmethod + def object_session(cls, instance): ... + +class ORMExecuteState(MemoizedSlots): + session: Any + statement: Any + parameters: Any + local_execution_options: Any + execution_options: Any + bind_arguments: Any + def __init__( + self, session, statement, parameters, execution_options, bind_arguments, compile_state_cls, events_todo + ) -> None: ... + def invoke_statement( + self, + statement: Any | None = ..., + params: Any | None = ..., + execution_options: Any | None = ..., + bind_arguments: Any | None = ..., + ): ... + @property + def bind_mapper(self): ... + @property + def all_mappers(self): ... + @property + def is_orm_statement(self): ... + @property + def is_select(self): ... + @property + def is_insert(self): ... + @property + def is_update(self): ... + @property + def is_delete(self): ... + def update_execution_options(self, **opts) -> None: ... + @property + def lazy_loaded_from(self): ... + @property + def loader_strategy_path(self): ... + @property + def is_column_load(self): ... + @property + def is_relationship_load(self): ... + @property + def load_options(self): ... + @property + def update_delete_options(self): ... + @property + def user_defined_options(self): ... + +class SessionTransaction(TransactionalContext): + session: Any + nested: Any + def __init__(self, session, parent: Any | None = ..., nested: bool = ..., autobegin: bool = ...) -> None: ... + @property + def parent(self): ... + @property + def is_active(self): ... + def connection(self, bindkey, execution_options: Any | None = ..., **kwargs): ... + def prepare(self) -> None: ... + def commit(self, _to_root: bool = ...): ... + def rollback(self, _capture_exception: bool = ..., _to_root: bool = ...): ... + def close(self, invalidate: bool = ...) -> None: ... + +class Session(_SessionClassMethods): + identity_map: Any + bind: Any + future: Any + hash_key: Any + autoflush: Any + expire_on_commit: Any + enable_baked_queries: Any + autocommit: bool + twophase: Any + def __init__( + self, + bind: Any | None = ..., + autoflush: bool = ..., + future: bool = ..., + expire_on_commit: bool = ..., + autocommit: bool = ..., + twophase: bool = ..., + binds: Any | None = ..., + enable_baked_queries: bool = ..., + info: Any | None = ..., + query_cls: Any | None = ..., + ) -> None: ... + connection_callable: Any + def __enter__(self: Self) -> Self: ... + def __exit__(self, type_, value, traceback) -> None: ... + @property + def transaction(self): ... + def in_transaction(self): ... + def in_nested_transaction(self): ... + def get_transaction(self): ... + def get_nested_transaction(self): ... + @memoized_property + def info(self): ... + def begin(self, subtransactions: bool = ..., nested: bool = ..., _subtrans: bool = ...): ... + def begin_nested(self): ... + def rollback(self) -> None: ... + def commit(self) -> None: ... + def prepare(self) -> None: ... + # TODO: bind_arguments could use a TypedDict + def connection( + self, + bind_arguments: Mapping[str, Any] | None = ..., + close_with_result: bool = ..., + execution_options: Mapping[str, Any] | None = ..., + **kw: Any, + ) -> Connection: ... + def execute( + self, + statement, + params: Any | None = ..., + execution_options=..., + bind_arguments: Any | None = ..., + _parent_execute_state: Any | None = ..., + _add_event: Any | None = ..., + **kw, + ) -> Result: ... + def scalar(self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw): ... + def scalars(self, statement, params: Any | None = ..., execution_options=..., bind_arguments: Any | None = ..., **kw): ... + def close(self) -> None: ... + def invalidate(self) -> None: ... + def expunge_all(self) -> None: ... + def bind_mapper(self, mapper, bind) -> None: ... + def bind_table(self, table, bind) -> None: ... + def get_bind( + self, + mapper: Any | None = ..., + clause: Any | None = ..., + bind: Any | None = ..., + _sa_skip_events: Any | None = ..., + _sa_skip_for_implicit_returning: bool = ..., + ): ... + @overload + def query(self, entities: Table, **kwargs: Any) -> Query[Any]: ... + @overload + def query(self, entities: ColumnElement[_T], **kwargs: Any) -> Query[tuple[_T]]: ... # type: ignore[misc] + @overload + def query(self, *entities: ColumnElement[_T], **kwargs: Any) -> Query[tuple[_T, ...]]: ... + @overload + def query(self, *entities: type[_T], **kwargs: Any) -> Query[_T]: ... + @property + def no_autoflush(self) -> None: ... + def refresh(self, instance, attribute_names: Any | None = ..., with_for_update: Any | None = ...) -> None: ... + def expire_all(self) -> None: ... + def expire(self, instance, attribute_names: Any | None = ...) -> None: ... + def expunge(self, instance) -> None: ... + def add(self, instance, _warn: bool = ...) -> None: ... + def add_all(self, instances) -> None: ... + def delete(self, instance) -> None: ... + def get( + self, + entity, + ident, + options: Any | None = ..., + populate_existing: bool = ..., + with_for_update: Any | None = ..., + identity_token: Any | None = ..., + execution_options: Any | None = ..., + ): ... + def merge(self, instance, load: bool = ..., options: Any | None = ...): ... + def enable_relationship_loading(self, obj) -> None: ... + def __contains__(self, instance): ... + def __iter__(self): ... + def flush(self, objects: Any | None = ...) -> None: ... + def bulk_save_objects( + self, objects, return_defaults: bool = ..., update_changed_only: bool = ..., preserve_order: bool = ... + ): ... + def bulk_insert_mappings(self, mapper, mappings, return_defaults: bool = ..., render_nulls: bool = ...) -> None: ... + def bulk_update_mappings(self, mapper, mappings) -> None: ... + def is_modified(self, instance, include_collections: bool = ...): ... + @property + def is_active(self): ... + @property + def dirty(self): ... + @property + def deleted(self): ... + @property + def new(self): ... + +class sessionmaker(_SessionClassMethods): + kw: Any + class_: Any + def __init__( + self, + bind: Any | None = ..., + class_=..., + autoflush: bool = ..., + autocommit: bool = ..., + expire_on_commit: bool = ..., + info: Any | None = ..., + **kw, + ) -> None: ... + def begin(self): ... + def __call__(self, **local_kw) -> Session: ... + def configure(self, **new_kw) -> None: ... + +def close_all_sessions() -> None: ... +def make_transient(instance) -> None: ... +def make_transient_to_detached(instance) -> None: ... +def object_session(instance): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/state.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/state.pyi new file mode 100644 index 0000000..60621f0 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/state.pyi @@ -0,0 +1,82 @@ +from typing import Any + +from ..util import memoized_property +from . import interfaces + +class InstanceState(interfaces.InspectionAttrInfo): + session_id: Any + key: Any + runid: Any + load_options: Any + load_path: Any + insert_order: Any + modified: bool + expired: bool + is_instance: bool + identity_token: Any + callables: Any + class_: Any + manager: Any + committed_state: Any + expired_attributes: Any + def __init__(self, obj, manager) -> None: ... + @memoized_property + def attrs(self): ... + @property + def transient(self): ... + @property + def pending(self): ... + @property + def deleted(self): ... + @property + def was_deleted(self): ... + @property + def persistent(self): ... + @property + def detached(self): ... + @property + def session(self): ... + @property + def async_session(self): ... + @property + def object(self): ... + @property + def identity(self): ... + @property + def identity_key(self): ... + @memoized_property + def parents(self): ... + @memoized_property + def mapper(self): ... + @property + def has_identity(self): ... + def obj(self) -> None: ... + @property + def dict(self): ... + def get_history(self, key, passive): ... + def get_impl(self, key): ... + @property + def unmodified(self): ... + def unmodified_intersection(self, keys): ... + @property + def unloaded(self): ... + @property + def unloaded_expirable(self): ... + +class AttributeState: + state: Any + key: Any + def __init__(self, state, key) -> None: ... + @property + def loaded_value(self): ... + @property + def value(self): ... + @property + def history(self): ... + def load_history(self): ... + +class PendingCollection: + deleted_items: Any + added_items: Any + def append(self, value) -> None: ... + def remove(self, value) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/strategies.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/strategies.pyi new file mode 100644 index 0000000..463e13e --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/strategies.pyi @@ -0,0 +1,141 @@ +from typing import Any, NamedTuple + +from .. import util +from .interfaces import LoaderStrategy + +class UninstrumentedColumnLoader(LoaderStrategy): + columns: Any + def __init__(self, parent, strategy_key) -> None: ... + def setup_query( + self, compile_state, query_entity, path, loadopt, adapter, column_collection: Any | None = ..., **kwargs + ) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + +class ColumnLoader(LoaderStrategy): + logger: Any + columns: Any + is_composite: Any + def __init__(self, parent, strategy_key) -> None: ... + def setup_query(self, compile_state, query_entity, path, loadopt, adapter, column_collection, memoized_populators, check_for_adapt: bool = ..., **kwargs) -> None: ... # type: ignore[override] + is_class_level: bool + def init_class_attribute(self, mapper) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + +class ExpressionColumnLoader(ColumnLoader): + logger: Any + def __init__(self, parent, strategy_key) -> None: ... + def setup_query(self, compile_state, query_entity, path, loadopt, adapter, column_collection, memoized_populators, **kwargs) -> None: ... # type: ignore[override] + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + is_class_level: bool + def init_class_attribute(self, mapper) -> None: ... + +class DeferredColumnLoader(LoaderStrategy): + logger: Any + raiseload: Any + columns: Any + group: Any + def __init__(self, parent, strategy_key) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + is_class_level: bool + def init_class_attribute(self, mapper) -> None: ... + def setup_query(self, compile_state, query_entity, path, loadopt, adapter, column_collection, memoized_populators, only_load_props: Any | None = ..., **kw) -> None: ... # type: ignore[override] + +class LoadDeferredColumns: + key: Any + raiseload: Any + def __init__(self, key, raiseload: bool = ...) -> None: ... + def __call__(self, state, passive=...): ... + +class AbstractRelationshipLoader(LoaderStrategy): + mapper: Any + entity: Any + target: Any + uselist: Any + def __init__(self, parent, strategy_key) -> None: ... + +class DoNothingLoader(LoaderStrategy): + logger: Any + +class NoLoader(AbstractRelationshipLoader): + logger: Any + is_class_level: bool + def init_class_attribute(self, mapper) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + +class LazyLoader(AbstractRelationshipLoader, util.MemoizedSlots): + logger: Any + is_aliased_class: Any + use_get: Any + def __init__(self, parent, strategy_key) -> None: ... + is_class_level: bool + def init_class_attribute(self, mapper) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + +class LoadLazyAttribute: + key: Any + strategy_key: Any + loadopt: Any + extra_criteria: Any + def __init__(self, key, initiating_strategy, loadopt, extra_criteria) -> None: ... + def __call__(self, state, passive=...): ... + +class PostLoader(AbstractRelationshipLoader): ... + +class ImmediateLoader(PostLoader): + def init_class_attribute(self, mapper) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + +class SubqueryLoader(PostLoader): + logger: Any + join_depth: Any + def __init__(self, parent, strategy_key) -> None: ... + def init_class_attribute(self, mapper) -> None: ... + + class _SubqCollections: + session: Any + execution_options: Any + load_options: Any + params: Any + subq: Any + def __init__(self, context, subq) -> None: ... + def get(self, key, default): ... + def loader(self, state, dict_, row) -> None: ... + + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators): ... + +class JoinedLoader(AbstractRelationshipLoader): + logger: Any + join_depth: Any + def __init__(self, parent, strategy_key) -> None: ... + def init_class_attribute(self, mapper) -> None: ... + def setup_query( + self, + compile_state, + query_entity, + path, + loadopt, + adapter, + column_collection: Any | None = ..., + parentmapper: Any | None = ..., + chained_from_outerjoin: bool = ..., + **kwargs, + ) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators) -> None: ... + +class SelectInLoader(PostLoader, util.MemoizedSlots): + logger: Any + + class query_info(NamedTuple): + load_only_child: Any + load_with_join: Any + in_expr: Any + pk_cols: Any + zero_idx: Any + child_lookup_cols: Any + join_depth: Any + omit_join: Any + def __init__(self, parent, strategy_key) -> None: ... + def init_class_attribute(self, mapper) -> None: ... + def create_row_processor(self, context, query_entity, path, loadopt, mapper, result, adapter, populators): ... + +def single_parent_validator(desc, prop): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/strategy_options.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/strategy_options.pyi new file mode 100644 index 0000000..c687fd1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/strategy_options.pyi @@ -0,0 +1,65 @@ +from typing import Any + +from ..sql.base import Generative +from .interfaces import LoaderOption + +class Load(Generative, LoaderOption): + path: Any + context: Any + local_opts: Any + is_class_strategy: bool + def __init__(self, entity) -> None: ... + @classmethod + def for_existing_path(cls, path): ... + is_opts_only: bool + strategy: Any + propagate_to_loaders: bool + def process_compile_state_replaced_entities(self, compile_state, mapper_entities) -> None: ... + def process_compile_state(self, compile_state) -> None: ... + def options(self, *opts) -> None: ... + def set_relationship_strategy(self, attr, strategy, propagate_to_loaders: bool = ...) -> None: ... + def set_column_strategy(self, attrs, strategy, opts: Any | None = ..., opts_only: bool = ...) -> None: ... + def set_generic_strategy(self, attrs, strategy) -> None: ... + def set_class_strategy(self, strategy, opts) -> None: ... + # added dynamically at runtime + def contains_eager(self, attr, alias: Any | None = ...): ... + def load_only(self, *attrs): ... + def joinedload(self, attr, innerjoin: Any | None = ...): ... + def subqueryload(self, attr): ... + def selectinload(self, attr): ... + def lazyload(self, attr): ... + def immediateload(self, attr): ... + def noload(self, attr): ... + def raiseload(self, attr, sql_only: bool = ...): ... + def defaultload(self, attr): ... + def defer(self, key, raiseload: bool = ...): ... + def undefer(self, key): ... + def undefer_group(self, name): ... + def with_expression(self, key, expression): ... + def selectin_polymorphic(self, classes): ... + +class _UnboundLoad(Load): + path: Any + local_opts: Any + def __init__(self) -> None: ... + +class loader_option: + name: Any + fn: Any + def __call__(self, fn): ... + +def contains_eager(loadopt, attr, alias: Any | None = ...): ... +def load_only(loadopt, *attrs): ... +def joinedload(loadopt, attr, innerjoin: Any | None = ...): ... +def subqueryload(loadopt, attr): ... +def selectinload(loadopt, attr): ... +def lazyload(loadopt, attr): ... +def immediateload(loadopt, attr): ... +def noload(loadopt, attr): ... +def raiseload(loadopt, attr, sql_only: bool = ...): ... +def defaultload(loadopt, attr): ... +def defer(loadopt, key, raiseload: bool = ...): ... +def undefer(loadopt, key): ... +def undefer_group(loadopt, name): ... +def with_expression(loadopt, key, expression): ... +def selectin_polymorphic(loadopt, classes): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/sync.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/sync.pyi new file mode 100644 index 0000000..558c9c8 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/sync.pyi @@ -0,0 +1,6 @@ +def populate(source, source_mapper, dest, dest_mapper, synchronize_pairs, uowcommit, flag_cascaded_pks) -> None: ... +def bulk_populate_inherit_keys(source_dict, source_mapper, synchronize_pairs) -> None: ... +def clear(dest, dest_mapper, synchronize_pairs) -> None: ... +def update(source, source_mapper, dest, old_prefix, synchronize_pairs) -> None: ... +def populate_dict(source, source_mapper, dict_, synchronize_pairs) -> None: ... +def source_modified(uowcommit, source, source_mapper, synchronize_pairs): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/unitofwork.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/unitofwork.pyi new file mode 100644 index 0000000..dde05b0 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/unitofwork.pyi @@ -0,0 +1,108 @@ +from typing import Any + +def track_cascade_events(descriptor, prop): ... + +class UOWTransaction: + session: Any + attributes: Any + deps: Any + mappers: Any + presort_actions: Any + postsort_actions: Any + dependencies: Any + states: Any + post_update_states: Any + def __init__(self, session): ... + @property + def has_work(self): ... + def was_already_deleted(self, state): ... + def is_deleted(self, state): ... + def memo(self, key, callable_): ... + def remove_state_actions(self, state) -> None: ... + def get_attribute_history(self, state, key, passive=...): ... + def has_dep(self, processor): ... + def register_preprocessor(self, processor, fromparent) -> None: ... + def register_object( + self, + state, + isdelete: bool = ..., + listonly: bool = ..., + cancel_delete: bool = ..., + operation: Any | None = ..., + prop: Any | None = ..., + ): ... + def register_post_update(self, state, post_update_cols) -> None: ... + def filter_states_for_dep(self, dep, states): ... + def states_for_mapper_hierarchy(self, mapper, isdelete, listonly) -> None: ... + def execute(self): ... + def finalize_flush_changes(self) -> None: ... + +class IterateMappersMixin: ... + +class Preprocess(IterateMappersMixin): + dependency_processor: Any + fromparent: Any + processed: Any + setup_flush_actions: bool + def __init__(self, dependency_processor, fromparent) -> None: ... + def execute(self, uow): ... + +class PostSortRec: + disabled: Any + # At runtime __new__ is defined, not __init__, + # But if we define __new__ here then all subclasses are identified by pyright + # as having __init__ methods that are inconsistent with their __new__ methods + def __init__(self, uow, *args) -> None: ... + def execute_aggregate(self, uow, recs) -> None: ... + +class ProcessAll(IterateMappersMixin, PostSortRec): + dependency_processor: Any + sort_key: Any + isdelete: Any + fromparent: Any + def __init__(self, uow, dependency_processor, isdelete, fromparent) -> None: ... + def execute(self, uow) -> None: ... + def per_state_flush_actions(self, uow): ... + +class PostUpdateAll(PostSortRec): + mapper: Any + isdelete: Any + sort_key: Any + def __init__(self, uow, mapper, isdelete) -> None: ... + def execute(self, uow) -> None: ... + +class SaveUpdateAll(PostSortRec): + mapper: Any + sort_key: Any + def __init__(self, uow, mapper) -> None: ... + def execute(self, uow) -> None: ... + def per_state_flush_actions(self, uow) -> None: ... + +class DeleteAll(PostSortRec): + mapper: Any + sort_key: Any + def __init__(self, uow, mapper) -> None: ... + def execute(self, uow) -> None: ... + def per_state_flush_actions(self, uow) -> None: ... + +class ProcessState(PostSortRec): + dependency_processor: Any + sort_key: Any + isdelete: Any + state: Any + def __init__(self, uow, dependency_processor, isdelete, state) -> None: ... + def execute_aggregate(self, uow, recs) -> None: ... + +class SaveUpdateState(PostSortRec): + state: Any + mapper: Any + sort_key: Any + def __init__(self, uow, state) -> None: ... + def execute_aggregate(self, uow, recs) -> None: ... + +class DeleteState(PostSortRec): + state: Any + mapper: Any + sort_key: Any + def __init__(self, uow, state) -> None: ... + def execute_aggregate(self, uow, recs) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/util.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/util.pyi new file mode 100644 index 0000000..23a5624 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/orm/util.pyi @@ -0,0 +1,181 @@ +from typing import Any + +from ..sql import base as sql_base, expression, util as sql_util +from ..sql.annotation import SupportsCloneAnnotations +from .base import ( + InspectionAttr as InspectionAttr, + _class_to_mapper as _class_to_mapper, + _never_set as _never_set, + _none_set as _none_set, + attribute_str as attribute_str, + class_mapper as class_mapper, + instance_str as instance_str, + object_mapper as object_mapper, + object_state as object_state, + state_attribute_str as state_attribute_str, + state_class_str as state_class_str, + state_str as state_str, +) +from .interfaces import CriteriaOption, ORMColumnsClauseRole, ORMEntityColumnsClauseRole, ORMFromClauseRole + +all_cascades: Any + +class CascadeOptions(frozenset[Any]): + save_update: Any + delete: Any + refresh_expire: Any + merge: Any + expunge: Any + delete_orphan: Any + def __new__(cls, value_list): ... + @classmethod + def from_string(cls, arg): ... + +def polymorphic_union(table_map, typecolname, aliasname: str = ..., cast_nulls: bool = ...): ... +def identity_key(*args, **kwargs): ... + +class ORMAdapter(sql_util.ColumnAdapter): + mapper: Any + aliased_class: Any + def __init__( + self, + entity, + equivalents: Any | None = ..., + adapt_required: bool = ..., + allow_label_resolve: bool = ..., + anonymize_labels: bool = ..., + ) -> None: ... + +class AliasedClass: + __name__: Any + def __init__( + self, + mapped_class_or_ac, + alias: Any | None = ..., + name: Any | None = ..., + flat: bool = ..., + adapt_on_names: bool = ..., + with_polymorphic_mappers=..., + with_polymorphic_discriminator: Any | None = ..., + base_alias: Any | None = ..., + use_mapper_path: bool = ..., + represents_outer_join: bool = ..., + ) -> None: ... + def __getattr__(self, key): ... + +class AliasedInsp(ORMEntityColumnsClauseRole, ORMFromClauseRole, sql_base.MemoizedHasCacheKey, InspectionAttr): + mapper: Any + selectable: Any + name: Any + polymorphic_on: Any + represents_outer_join: Any + with_polymorphic_mappers: Any + def __init__( + self, + entity, + inspected, + selectable, + name, + with_polymorphic_mappers, + polymorphic_on, + _base_alias, + _use_mapper_path, + adapt_on_names, + represents_outer_join, + nest_adapters: bool, # added in 1.4.30 + ) -> None: ... + @property + def entity(self): ... + is_aliased_class: bool + def __clause_element__(self): ... + @property + def entity_namespace(self): ... + @property + def class_(self): ... + +class _WrapUserEntity: + subject: Any + def __init__(self, subject) -> None: ... + def __getattribute__(self, name): ... + +class LoaderCriteriaOption(CriteriaOption): + root_entity: Any + entity: Any + deferred_where_criteria: bool + where_criteria: Any + include_aliases: Any + propagate_to_loaders: Any + def __init__( + self, + entity_or_base, + where_criteria, + loader_only: bool = ..., + include_aliases: bool = ..., + propagate_to_loaders: bool = ..., + track_closure_variables: bool = ..., + ) -> None: ... + def process_compile_state_replaced_entities(self, compile_state, mapper_entities): ... + def process_compile_state(self, compile_state) -> None: ... + def get_global_criteria(self, attributes) -> None: ... + +def aliased(element, alias: Any | None = ..., name: Any | None = ..., flat: bool = ..., adapt_on_names: bool = ...): ... +def with_polymorphic( + base, + classes, + selectable: bool = ..., + flat: bool = ..., + polymorphic_on: Any | None = ..., + aliased: bool = ..., + adapt_on_names: bool = ..., + innerjoin: bool = ..., + _use_mapper_path: bool = ..., + _existing_alias: Any | None = ..., +) -> AliasedClass: ... + +class Bundle(ORMColumnsClauseRole, SupportsCloneAnnotations, sql_base.MemoizedHasCacheKey, InspectionAttr): + single_entity: bool + is_clause_element: bool + is_mapper: bool + is_aliased_class: bool + is_bundle: bool + name: Any + exprs: Any + c: Any + def __init__(self, name, *exprs, **kw) -> None: ... + @property + def mapper(self): ... + @property + def entity(self): ... + @property + def entity_namespace(self): ... + columns: Any + def __clause_element__(self): ... + @property + def clauses(self): ... + def label(self, name): ... + def create_row_processor(self, query, procs, labels): ... + +class _ORMJoin(expression.Join): + __visit_name__: Any + inherit_cache: bool + onclause: Any + def __init__( + self, + left, + right, + onclause: Any | None = ..., + isouter: bool = ..., + full: bool = ..., + _left_memo: Any | None = ..., + _right_memo: Any | None = ..., + _extra_criteria=..., + ) -> None: ... + def join(self, right, onclause: Any | None = ..., isouter: bool = ..., full: bool = ..., join_to_left: Any | None = ...): ... + def outerjoin(self, right, onclause: Any | None = ..., full: bool = ..., join_to_left: Any | None = ...): ... + +def join(left, right, onclause: Any | None = ..., isouter: bool = ..., full: bool = ..., join_to_left: Any | None = ...): ... +def outerjoin(left, right, onclause: Any | None = ..., full: bool = ..., join_to_left: Any | None = ...): ... +def with_parent(instance, prop, from_entity: Any | None = ...): ... +def has_identity(object_): ... +def was_deleted(object_): ... +def randomize_unitofwork() -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/pool/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/pool/__init__.pyi new file mode 100644 index 0000000..977c65a --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/pool/__init__.pyi @@ -0,0 +1,27 @@ +from .base import Pool as Pool, reset_commit as reset_commit, reset_none as reset_none, reset_rollback as reset_rollback +from .dbapi_proxy import clear_managers as clear_managers, manage as manage +from .impl import ( + AssertionPool as AssertionPool, + AsyncAdaptedQueuePool as AsyncAdaptedQueuePool, + FallbackAsyncAdaptedQueuePool as FallbackAsyncAdaptedQueuePool, + NullPool as NullPool, + QueuePool as QueuePool, + SingletonThreadPool as SingletonThreadPool, + StaticPool as StaticPool, +) + +__all__ = [ + "Pool", + "reset_commit", + "reset_none", + "reset_rollback", + "clear_managers", + "manage", + "AssertionPool", + "NullPool", + "QueuePool", + "AsyncAdaptedQueuePool", + "FallbackAsyncAdaptedQueuePool", + "SingletonThreadPool", + "StaticPool", +] diff --git a/stubs/SQLAlchemy/sqlalchemy/pool/base.pyi b/stubs/SQLAlchemy/sqlalchemy/pool/base.pyi new file mode 100644 index 0000000..9936b2d --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/pool/base.pyi @@ -0,0 +1,88 @@ +from typing import Any + +from .. import log +from ..util import memoized_property + +reset_rollback: Any +reset_commit: Any +reset_none: Any + +class _ConnDialect: + is_async: bool + def do_rollback(self, dbapi_connection) -> None: ... + def do_commit(self, dbapi_connection) -> None: ... + def do_close(self, dbapi_connection) -> None: ... + def do_ping(self, dbapi_connection) -> None: ... + def get_driver_connection(self, connection): ... + +class _AsyncConnDialect(_ConnDialect): + is_async: bool + +class Pool(log.Identified): + logging_name: Any + echo: Any + def __init__( + self, + creator, + recycle: int = ..., + echo: Any | None = ..., + logging_name: Any | None = ..., + reset_on_return: bool = ..., + events: Any | None = ..., + dialect: Any | None = ..., + pre_ping: bool = ..., + _dispatch: Any | None = ..., + ) -> None: ... + def recreate(self) -> None: ... + def dispose(self) -> None: ... + def connect(self): ... + def status(self) -> None: ... + +class _ConnectionRecord: + finalize_callback: Any + def __init__(self, pool, connect: bool = ...) -> None: ... + fresh: bool + fairy_ref: Any + starttime: Any + dbapi_connection: Any + @property + def driver_connection(self): ... + @property + def connection(self): ... + @connection.setter + def connection(self, value) -> None: ... + @memoized_property + def info(self): ... + @memoized_property + def record_info(self): ... + @classmethod + def checkout(cls, pool): ... + def checkin(self, _fairy_was_created: bool = ...) -> None: ... + @property + def in_use(self): ... + @property + def last_connect_time(self): ... + def close(self) -> None: ... + def invalidate(self, e: Any | None = ..., soft: bool = ...) -> None: ... + def get_connection(self): ... + +class _ConnectionFairy: + dbapi_connection: Any + def __init__(self, dbapi_connection, connection_record, echo) -> None: ... + @property + def driver_connection(self): ... + @property + def connection(self): ... + @connection.setter + def connection(self, value) -> None: ... + @property + def is_valid(self): ... + @memoized_property + def info(self): ... + @property + def record_info(self): ... + def invalidate(self, e: Any | None = ..., soft: bool = ...) -> None: ... + def cursor(self, *args, **kwargs): ... + def __getattr__(self, key): ... + def detach(self) -> None: ... + def close(self) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/pool/dbapi_proxy.pyi b/stubs/SQLAlchemy/sqlalchemy/pool/dbapi_proxy.pyi new file mode 100644 index 0000000..909b78d --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/pool/dbapi_proxy.pyi @@ -0,0 +1,19 @@ +from typing import Any + +proxies: Any + +def manage(module, **params): ... +def clear_managers() -> None: ... + +class _DBProxy: + module: Any + kw: Any + poolclass: Any + pools: Any + def __init__(self, module, poolclass=..., **kw) -> None: ... + def close(self) -> None: ... + def __del__(self) -> None: ... + def __getattr__(self, key): ... + def get_pool(self, *args, **kw): ... + def connect(self, *args, **kw): ... + def dispose(self, *args, **kw) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/pool/events.pyi b/stubs/SQLAlchemy/sqlalchemy/pool/events.pyi new file mode 100644 index 0000000..8a5dde5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/pool/events.pyi @@ -0,0 +1,13 @@ +from .. import event + +class PoolEvents(event.Events): + def connect(self, dbapi_connection, connection_record) -> None: ... + def first_connect(self, dbapi_connection, connection_record) -> None: ... + def checkout(self, dbapi_connection, connection_record, connection_proxy) -> None: ... + def checkin(self, dbapi_connection, connection_record) -> None: ... + def reset(self, dbapi_connection, connection_record) -> None: ... + def invalidate(self, dbapi_connection, connection_record, exception) -> None: ... + def soft_invalidate(self, dbapi_connection, connection_record, exception) -> None: ... + def close(self, dbapi_connection, connection_record) -> None: ... + def detach(self, dbapi_connection, connection_record) -> None: ... + def close_detached(self, dbapi_connection) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/pool/impl.pyi b/stubs/SQLAlchemy/sqlalchemy/pool/impl.pyi new file mode 100644 index 0000000..2646caf --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/pool/impl.pyi @@ -0,0 +1,46 @@ +from typing import Any + +from ..util import memoized_property +from .base import Pool + +class QueuePool(Pool): + def __init__( + self, creator, pool_size: int = ..., max_overflow: int = ..., timeout: float = ..., use_lifo: bool = ..., **kw + ) -> None: ... + def recreate(self): ... + def dispose(self) -> None: ... + def status(self): ... + def size(self): ... + def timeout(self): ... + def checkedin(self): ... + def overflow(self): ... + def checkedout(self): ... + +class AsyncAdaptedQueuePool(QueuePool): ... +class FallbackAsyncAdaptedQueuePool(AsyncAdaptedQueuePool): ... + +class NullPool(Pool): + def status(self): ... + def recreate(self): ... + def dispose(self) -> None: ... + +class SingletonThreadPool(Pool): + size: Any + def __init__(self, creator, pool_size: int = ..., **kw) -> None: ... + def recreate(self): ... + def dispose(self) -> None: ... + def status(self): ... + def connect(self): ... + +class StaticPool(Pool): + @memoized_property + def connection(self): ... + def status(self): ... + def dispose(self) -> None: ... + def recreate(self): ... + +class AssertionPool(Pool): + def __init__(self, *args, **kw) -> None: ... + def status(self): ... + def dispose(self) -> None: ... + def recreate(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/processors.pyi b/stubs/SQLAlchemy/sqlalchemy/processors.pyi new file mode 100644 index 0000000..be304e6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/processors.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def str_to_datetime_processor_factory(regexp, type_): ... +def py_fallback(): ... +def to_unicode_processor_factory(encoding, errors: Any | None = ...): ... +def to_conditional_unicode_processor_factory(encoding, errors: Any | None = ...): ... +def to_decimal_processor_factory(target_class, scale): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/schema.pyi b/stubs/SQLAlchemy/sqlalchemy/schema.pyi new file mode 100644 index 0000000..ef2cc1e --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/schema.pyi @@ -0,0 +1,51 @@ +from .sql.base import SchemaVisitor as SchemaVisitor +from .sql.ddl import ( + DDL as DDL, + AddConstraint as AddConstraint, + CreateColumn as CreateColumn, + CreateIndex as CreateIndex, + CreateSchema as CreateSchema, + CreateSequence as CreateSequence, + CreateTable as CreateTable, + DDLBase as DDLBase, + DDLElement as DDLElement, + DropColumnComment as DropColumnComment, + DropConstraint as DropConstraint, + DropIndex as DropIndex, + DropSchema as DropSchema, + DropSequence as DropSequence, + DropTable as DropTable, + DropTableComment as DropTableComment, + SetColumnComment as SetColumnComment, + SetTableComment as SetTableComment, + _CreateDropBase as _CreateDropBase, + _DDLCompiles as _DDLCompiles, + _DropView as _DropView, + sort_tables as sort_tables, + sort_tables_and_constraints as sort_tables_and_constraints, +) +from .sql.naming import conv as conv +from .sql.schema import ( + BLANK_SCHEMA as BLANK_SCHEMA, + CheckConstraint as CheckConstraint, + Column as Column, + ColumnCollectionConstraint as ColumnCollectionConstraint, + ColumnCollectionMixin as ColumnCollectionMixin, + ColumnDefault as ColumnDefault, + Computed as Computed, + Constraint as Constraint, + DefaultClause as DefaultClause, + DefaultGenerator as DefaultGenerator, + FetchedValue as FetchedValue, + ForeignKey as ForeignKey, + ForeignKeyConstraint as ForeignKeyConstraint, + Identity as Identity, + Index as Index, + MetaData as MetaData, + PrimaryKeyConstraint as PrimaryKeyConstraint, + SchemaItem as SchemaItem, + Sequence as Sequence, + Table as Table, + ThreadLocalMetaData as ThreadLocalMetaData, + UniqueConstraint as UniqueConstraint, +) diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/__init__.pyi new file mode 100644 index 0000000..625094b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/__init__.pyi @@ -0,0 +1,91 @@ +from . import sqltypes as sqltypes +from .base import Executable as Executable +from .compiler import ( + COLLECT_CARTESIAN_PRODUCTS as COLLECT_CARTESIAN_PRODUCTS, + FROM_LINTING as FROM_LINTING, + NO_LINTING as NO_LINTING, + WARN_LINTING as WARN_LINTING, +) +from .expression import ( + LABEL_STYLE_DEFAULT as LABEL_STYLE_DEFAULT, + LABEL_STYLE_DISAMBIGUATE_ONLY as LABEL_STYLE_DISAMBIGUATE_ONLY, + LABEL_STYLE_NONE as LABEL_STYLE_NONE, + LABEL_STYLE_TABLENAME_PLUS_COL as LABEL_STYLE_TABLENAME_PLUS_COL, + Alias as Alias, + ClauseElement as ClauseElement, + ColumnCollection as ColumnCollection, + ColumnElement as ColumnElement, + CompoundSelect as CompoundSelect, + Delete as Delete, + False_ as False_, + FromClause as FromClause, + Insert as Insert, + Join as Join, + LambdaElement as LambdaElement, + Select as Select, + Selectable as Selectable, + StatementLambdaElement as StatementLambdaElement, + Subquery as Subquery, + TableClause as TableClause, + TableSample as TableSample, + True_ as True_, + Update as Update, + Values as Values, + alias as alias, + all_ as all_, + and_ as and_, + any_ as any_, + asc as asc, + between as between, + bindparam as bindparam, + case as case, + cast as cast, + collate as collate, + column as column, + cte as cte, + delete as delete, + desc as desc, + distinct as distinct, + except_ as except_, + except_all as except_all, + exists as exists, + extract as extract, + false as false, + func as func, + funcfilter as funcfilter, + insert as insert, + intersect as intersect, + intersect_all as intersect_all, + join as join, + label as label, + lambda_stmt as lambda_stmt, + lateral as lateral, + literal as literal, + literal_column as literal_column, + modifier as modifier, + not_ as not_, + null as null, + nulls_first as nulls_first, + nulls_last as nulls_last, + nullsfirst as nullsfirst, + nullslast as nullslast, + or_ as or_, + outerjoin as outerjoin, + outparam as outparam, + over as over, + quoted_name as quoted_name, + select as select, + subquery as subquery, + table as table, + tablesample as tablesample, + text as text, + true as true, + tuple_ as tuple_, + type_coerce as type_coerce, + union as union, + union_all as union_all, + update as update, + values as values, + within_group as within_group, +) +from .visitors import ClauseVisitor as ClauseVisitor diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/annotation.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/annotation.pyi new file mode 100644 index 0000000..ead1cc1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/annotation.pyi @@ -0,0 +1,18 @@ +from typing import Any + +EMPTY_ANNOTATIONS: Any + +class SupportsAnnotations: ... +class SupportsCloneAnnotations(SupportsAnnotations): ... +class SupportsWrappingAnnotations(SupportsAnnotations): ... + +class Annotated: + __dict__: Any + def __init__(self, element, values) -> None: ... + def __reduce__(self): ... + def __hash__(self): ... + def __eq__(self, other): ... + @property + def entity_namespace(self): ... + +annotated_classes: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi new file mode 100644 index 0000000..bcfad9f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi @@ -0,0 +1,160 @@ +from _typeshed import Self +from collections.abc import MutableMapping +from typing import Any, ClassVar + +from .. import util +from ..util import HasMemoized, hybridmethod, memoized_property +from . import roles +from .elements import ColumnElement +from .traversals import ( + HasCacheKey as HasCacheKey, + HasCopyInternals as HasCopyInternals, + MemoizedHasCacheKey as MemoizedHasCacheKey, +) +from .visitors import ClauseVisitor + +coercions: Any +elements: Any +type_api: Any +PARSE_AUTOCOMMIT: Any +NO_ARG: Any + +class Immutable: + def unique_params(self, *optionaldict, **kwargs) -> None: ... + def params(self, *optionaldict, **kwargs) -> None: ... + +class SingletonConstant(Immutable): + def __new__(cls, *arg, **kw): ... + +class _DialectArgView(MutableMapping[Any, Any]): + obj: Any + def __init__(self, obj) -> None: ... + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __len__(self): ... + def __iter__(self): ... + +class _DialectArgDict(MutableMapping[Any, Any]): + def __init__(self) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + +class DialectKWArgs: + @classmethod + def argument_for(cls, dialect_name, argument_name, default) -> None: ... + @memoized_property + def dialect_kwargs(self): ... + @property + def kwargs(self): ... + @memoized_property + def dialect_options(self): ... + +class CompileState: + plugins: Any + @classmethod + def create_for_statement(cls, statement, compiler, **kw): ... + statement: Any + def __init__(self, statement, compiler, **kw) -> None: ... + @classmethod + def get_plugin_class(cls, statement): ... + @classmethod + def plugin_for(cls, plugin_name, visit_name): ... + +class Generative(HasMemoized): ... +class InPlaceGenerative(HasMemoized): ... +class HasCompileState(Generative): ... + +class _MetaOptions(type): + def __init__(cls, classname, bases, dict_) -> None: ... + def __add__(self, other): ... + +class Options: + def __init__(self, **kw) -> None: ... + def __add__(self, other): ... + def __eq__(self, other): ... + @classmethod + def isinstance(cls, klass): ... + @hybridmethod + def add_to_element(self, name, value): ... + @classmethod + def safe_merge(cls, other): ... + @classmethod + def from_execution_options(cls, key, attrs, exec_options, statement_exec_options): ... + +class CacheableOptions(Options, HasCacheKey): ... + +class ExecutableOption(HasCopyInternals): + __visit_name__: str + +class Executable(roles.StatementRole, Generative): + supports_execution: bool + is_select: bool + is_update: bool + is_insert: bool + is_text: bool + is_delete: bool + is_dml: bool + def options(self: Self, *options) -> Self: ... + def execution_options(self: Self, **kw) -> Self: ... + def get_execution_options(self): ... + def execute(self, *multiparams, **params): ... + def scalar(self, *multiparams, **params): ... + @property + def bind(self): ... + +class prefix_anon_map(dict[Any, Any]): + def __missing__(self, key): ... + +class SchemaEventTarget: ... + +class SchemaVisitor(ClauseVisitor): + __traverse_options__: Any + +class ColumnCollection: + def __init__(self, columns: Any | None = ...) -> None: ... + def keys(self): ... + def values(self): ... + def items(self): ... + def __bool__(self): ... + def __len__(self): ... + def __iter__(self): ... + def __getitem__(self, key): ... + def __getattr__(self, key): ... + def __contains__(self, key): ... + def compare(self, other): ... + def __eq__(self, other): ... + def get(self, key, default: Any | None = ...): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __setattr__(self, key, obj) -> None: ... + def clear(self) -> None: ... + def remove(self, column) -> None: ... + def update(self, iter_) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] + def add(self, column, key: Any | None = ...) -> None: ... + def contains_column(self, col): ... + def as_immutable(self): ... + def corresponding_column(self, column, require_embedded: bool = ...): ... + +class DedupeColumnCollection(ColumnCollection): + def add(self, column, key: Any | None = ...) -> None: ... + def extend(self, iter_) -> None: ... + def remove(self, column) -> None: ... + def replace(self, column) -> None: ... + +class ImmutableColumnCollection(util.ImmutableContainer, ColumnCollection): + def __init__(self, collection) -> None: ... + add: Any + extend: Any + remove: Any + +class ColumnSet(util.ordered_column_set[ColumnElement[Any]]): + def contains_column(self, col): ... + def extend(self, cols) -> None: ... + def __add__(self, other): ... + def __eq__(self, other): ... + def __hash__(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/coercions.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/coercions.pyi new file mode 100644 index 0000000..79a24e9 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/coercions.pyi @@ -0,0 +1,66 @@ +from typing import Any + +from . import roles + +elements: Any +lambdas: Any +schema: Any +selectable: Any +sqltypes: Any +traversals: Any + +def expect(role, element, apply_propagate_attrs: Any | None = ..., argname: Any | None = ..., post_inspect: bool = ..., **kw): ... +def expect_as_key(role, element, **kw): ... +def expect_col_expression_collection(role, expressions) -> None: ... + +class RoleImpl: + name: Any + def __init__(self, role_class) -> None: ... + +class _Deannotate: ... +class _StringOnly: ... +class _ReturnsStringKey: ... +class _ColumnCoercions: ... +class _NoTextCoercion: ... +class _CoerceLiterals: ... +class LiteralValueImpl(RoleImpl): ... +class _SelectIsNotFrom: ... +class HasCacheKeyImpl(RoleImpl): ... +class ExecutableOptionImpl(RoleImpl): ... +class ExpressionElementImpl(_ColumnCoercions, RoleImpl): ... +class BinaryElementImpl(ExpressionElementImpl, RoleImpl): ... +class InElementImpl(RoleImpl): ... +class OnClauseImpl(_CoerceLiterals, _ColumnCoercions, RoleImpl): ... +class WhereHavingImpl(_CoerceLiterals, _ColumnCoercions, RoleImpl): ... +class StatementOptionImpl(_CoerceLiterals, RoleImpl): ... +class ColumnArgumentImpl(_NoTextCoercion, RoleImpl): ... +class ColumnArgumentOrKeyImpl(_ReturnsStringKey, RoleImpl): ... +class StrAsPlainColumnImpl(_CoerceLiterals, RoleImpl): ... +class ByOfImpl(_CoerceLiterals, _ColumnCoercions, RoleImpl, roles.ByOfRole): ... +class OrderByImpl(ByOfImpl, RoleImpl): ... +class GroupByImpl(ByOfImpl, RoleImpl): ... +class DMLColumnImpl(_ReturnsStringKey, RoleImpl): ... +class ConstExprImpl(RoleImpl): ... +class TruncatedLabelImpl(_StringOnly, RoleImpl): ... +class DDLExpressionImpl(_Deannotate, _CoerceLiterals, RoleImpl): ... +class DDLConstraintColumnImpl(_Deannotate, _ReturnsStringKey, RoleImpl): ... +class DDLReferredColumnImpl(DDLConstraintColumnImpl): ... +class LimitOffsetImpl(RoleImpl): ... +class LabeledColumnExprImpl(ExpressionElementImpl): ... +class ColumnsClauseImpl(_SelectIsNotFrom, _CoerceLiterals, RoleImpl): ... +class ReturnsRowsImpl(RoleImpl): ... +class StatementImpl(_CoerceLiterals, RoleImpl): ... +class SelectStatementImpl(_NoTextCoercion, RoleImpl): ... +class HasCTEImpl(ReturnsRowsImpl): ... +class IsCTEImpl(RoleImpl): ... +class JoinTargetImpl(RoleImpl): ... +class FromClauseImpl(_SelectIsNotFrom, _NoTextCoercion, RoleImpl): ... +class StrictFromClauseImpl(FromClauseImpl): ... +class AnonymizedFromClauseImpl(StrictFromClauseImpl): ... +class DMLTableImpl(_SelectIsNotFrom, _NoTextCoercion, RoleImpl): ... +class DMLSelectImpl(_NoTextCoercion, RoleImpl): ... +class CompoundElementImpl(_NoTextCoercion, RoleImpl): ... + +cls: Any +name: Any +impl: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/compiler.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/compiler.pyi new file mode 100644 index 0000000..f1fb59f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/compiler.pyi @@ -0,0 +1,476 @@ +from typing import Any, NamedTuple + +from ..util import memoized_property +from . import elements + +RESERVED_WORDS: Any +LEGAL_CHARACTERS: Any +LEGAL_CHARACTERS_PLUS_SPACE: Any +ILLEGAL_INITIAL_CHARACTERS: Any +FK_ON_DELETE: Any +FK_ON_UPDATE: Any +FK_INITIALLY: Any +BIND_PARAMS: Any +BIND_PARAMS_ESC: Any +BIND_TEMPLATES: Any +OPERATORS: Any +FUNCTIONS: Any +EXTRACT_MAP: Any +COMPOUND_KEYWORDS: Any +RM_RENDERED_NAME: int +RM_NAME: int +RM_OBJECTS: int +RM_TYPE: int + +class ExpandedState(NamedTuple): + statement: Any + additional_parameters: Any + processors: Any + positiontup: Any + parameter_expansion: Any + +NO_LINTING: Any +COLLECT_CARTESIAN_PRODUCTS: Any +WARN_LINTING: Any +FROM_LINTING: Any + +class FromLinter: + def lint(self, start: Any | None = ...): ... + def warn(self) -> None: ... + +class Compiled: + schema_translate_map: Any + execution_options: Any + compile_state: Any + cache_key: Any + dialect: Any + preparer: Any + statement: Any + can_execute: Any + string: Any + def __init__( + self, dialect, statement, schema_translate_map: Any | None = ..., render_schema_translate: bool = ..., compile_kwargs=... + ) -> None: ... + def visit_unsupported_compilation(self, element, err) -> None: ... + @property + def sql_compiler(self) -> None: ... + def process(self, obj, **kwargs): ... + def construct_params( + self, params: Any | None = ..., extracted_parameters: Any | None = ..., escape_names: bool = ... + ) -> None: ... + @property + def params(self): ... + +class TypeCompiler: + ensure_kwarg: str + dialect: Any + def __init__(self, dialect) -> None: ... + def process(self, type_, **kw): ... + def visit_unsupported_compilation(self, element, err, **kw) -> None: ... + +class _CompileLabel(elements.ColumnElement[Any]): + __visit_name__: str + element: Any + name: Any + def __init__(self, col, name, alt_names=...) -> None: ... + @property + def proxy_set(self): ... + @property + def type(self): ... + def self_group(self, **kw): ... + +class SQLCompiler(Compiled): + extract_map: Any + compound_keywords: Any + isdelete: bool + isinsert: bool + isupdate: bool + isplaintext: bool + returning: Any + returning_precedes_values: bool + render_table_with_column_in_update_from: bool + ansi_bind_rules: bool + insert_single_values_expr: Any + literal_execute_params: Any + post_compile_params: Any + escaped_bind_names: Any + has_out_parameters: bool + insert_prefetch: Any + update_prefetch: Any + postfetch_lastrowid: bool + positiontup: Any + inline: bool + column_keys: Any + cache_key: Any + for_executemany: Any + linting: Any + binds: Any + bind_names: Any + stack: Any + positional: Any + bindtemplate: Any + ctes: Any + label_length: Any + anon_map: Any + truncated_names: Any + def __init__( + self, + dialect, + statement, + cache_key: Any | None = ..., + column_keys: Any | None = ..., + for_executemany: bool = ..., + linting=..., + **kwargs, + ) -> None: ... + @property + def current_executable(self): ... + @property + def prefetch(self): ... + def is_subquery(self): ... + @property + def sql_compiler(self): ... + def construct_params(self, params: Any | None = ..., _group_number: Any | None = ..., _check: bool = ..., extracted_parameters: Any | None = ..., escape_names: bool = ...): ... # type: ignore[override] + @property + def params(self): ... + def default_from(self): ... + def visit_grouping(self, grouping, asfrom: bool = ..., **kwargs): ... + def visit_select_statement_grouping(self, grouping, **kwargs): ... + def visit_label_reference(self, element, within_columns_clause: bool = ..., **kwargs): ... + def visit_textual_label_reference(self, element, within_columns_clause: bool = ..., **kwargs): ... + def visit_label( + self, + label, + add_to_result_map: Any | None = ..., + within_label_clause: bool = ..., + within_columns_clause: bool = ..., + render_label_as_label: Any | None = ..., + result_map_targets=..., + **kw, + ): ... + def visit_lambda_element(self, element, **kw): ... + def visit_column( + self, column, add_to_result_map: Any | None = ..., include_table: bool = ..., result_map_targets=..., **kwargs + ): ... + def visit_collation(self, element, **kw): ... + def visit_fromclause(self, fromclause, **kwargs): ... + def visit_index(self, index, **kwargs): ... + def visit_typeclause(self, typeclause, **kw): ... + def post_process_text(self, text): ... + def escape_literal_column(self, text): ... + def visit_textclause(self, textclause, add_to_result_map: Any | None = ..., **kw): ... + def visit_textual_select(self, taf, compound_index: Any | None = ..., asfrom: bool = ..., **kw): ... + def visit_null(self, expr, **kw): ... + def visit_true(self, expr, **kw): ... + def visit_false(self, expr, **kw): ... + def visit_tuple(self, clauselist, **kw): ... + def visit_clauselist(self, clauselist, **kw): ... + def visit_case(self, clause, **kwargs): ... + def visit_type_coerce(self, type_coerce, **kw): ... + def visit_cast(self, cast, **kwargs): ... + def visit_over(self, over, **kwargs): ... + def visit_withingroup(self, withingroup, **kwargs): ... + def visit_funcfilter(self, funcfilter, **kwargs): ... + def visit_extract(self, extract, **kwargs): ... + def visit_scalar_function_column(self, element, **kw): ... + def visit_function(self, func, add_to_result_map: Any | None = ..., **kwargs): ... + def visit_next_value_func(self, next_value, **kw): ... + def visit_sequence(self, sequence, **kw) -> None: ... + def function_argspec(self, func, **kwargs): ... + compile_state: Any + def visit_compound_select(self, cs, asfrom: bool = ..., compound_index: Any | None = ..., **kwargs): ... + def visit_unary(self, unary, add_to_result_map: Any | None = ..., result_map_targets=..., **kw): ... + def visit_is_true_unary_operator(self, element, operator, **kw): ... + def visit_is_false_unary_operator(self, element, operator, **kw): ... + def visit_not_match_op_binary(self, binary, operator, **kw): ... + def visit_not_in_op_binary(self, binary, operator, **kw): ... + def visit_empty_set_op_expr(self, type_, expand_op): ... + def visit_empty_set_expr(self, element_types) -> None: ... + def visit_binary( + self, + binary, + override_operator: Any | None = ..., + eager_grouping: bool = ..., + from_linter: Any | None = ..., + lateral_from_linter: Any | None = ..., + **kw, + ): ... + def visit_function_as_comparison_op_binary(self, element, operator, **kw): ... + def visit_mod_binary(self, binary, operator, **kw): ... + def visit_custom_op_binary(self, element, operator, **kw): ... + def visit_custom_op_unary_operator(self, element, operator, **kw): ... + def visit_custom_op_unary_modifier(self, element, operator, **kw): ... + def visit_contains_op_binary(self, binary, operator, **kw): ... + def visit_not_contains_op_binary(self, binary, operator, **kw): ... + def visit_startswith_op_binary(self, binary, operator, **kw): ... + def visit_not_startswith_op_binary(self, binary, operator, **kw): ... + def visit_endswith_op_binary(self, binary, operator, **kw): ... + def visit_not_endswith_op_binary(self, binary, operator, **kw): ... + def visit_like_op_binary(self, binary, operator, **kw): ... + def visit_not_like_op_binary(self, binary, operator, **kw): ... + def visit_ilike_op_binary(self, binary, operator, **kw): ... + def visit_not_ilike_op_binary(self, binary, operator, **kw): ... + def visit_between_op_binary(self, binary, operator, **kw): ... + def visit_not_between_op_binary(self, binary, operator, **kw): ... + def visit_regexp_match_op_binary(self, binary, operator, **kw) -> None: ... + def visit_not_regexp_match_op_binary(self, binary, operator, **kw) -> None: ... + def visit_regexp_replace_op_binary(self, binary, operator, **kw) -> None: ... + def visit_bindparam( + self, + bindparam, + within_columns_clause: bool = ..., + literal_binds: bool = ..., + skip_bind_expression: bool = ..., + literal_execute: bool = ..., + render_postcompile: bool = ..., + **kwargs, + ): ... + def render_literal_bindparam(self, bindparam, render_literal_value=..., **kw): ... + def render_literal_value(self, value, type_): ... + def bindparam_string( + self, + name, + positional_names: Any | None = ..., + post_compile: bool = ..., + expanding: bool = ..., + escaped_from: Any | None = ..., + **kw, + ): ... + execution_options: Any + ctes_recursive: bool + def visit_cte( + self, + cte, + asfrom: bool = ..., + ashint: bool = ..., + fromhints: Any | None = ..., + visiting_cte: Any | None = ..., + from_linter: Any | None = ..., + **kwargs, + ): ... + def visit_table_valued_alias(self, element, **kw): ... + def visit_table_valued_column(self, element, **kw): ... + def visit_alias( + self, + alias, + asfrom: bool = ..., + ashint: bool = ..., + iscrud: bool = ..., + fromhints: Any | None = ..., + subquery: bool = ..., + lateral: bool = ..., + enclosing_alias: Any | None = ..., + from_linter: Any | None = ..., + **kwargs, + ): ... + def visit_subquery(self, subquery, **kw): ... + def visit_lateral(self, lateral_, **kw): ... + def visit_tablesample(self, tablesample, asfrom: bool = ..., **kw): ... + def visit_values(self, element, asfrom: bool = ..., from_linter: Any | None = ..., **kw): ... + def get_render_as_alias_suffix(self, alias_name_text): ... + def format_from_hint_text(self, sqltext, table, hint, iscrud): ... + def get_select_hint_text(self, byfroms) -> None: ... + def get_from_hint_text(self, table, text) -> None: ... + def get_crud_hint_text(self, table, text) -> None: ... + def get_statement_hint_text(self, hint_texts): ... + translate_select_structure: Any + def visit_select( + self, + select_stmt, + asfrom: bool = ..., + insert_into: bool = ..., + fromhints: Any | None = ..., + compound_index: Any | None = ..., + select_wraps_for: Any | None = ..., + lateral: bool = ..., + from_linter: Any | None = ..., + **kwargs, + ): ... + def get_cte_preamble(self, recursive): ... + def get_select_precolumns(self, select, **kw): ... + def group_by_clause(self, select, **kw): ... + def order_by_clause(self, select, **kw): ... + def for_update_clause(self, select, **kw): ... + def returning_clause(self, stmt, returning_cols) -> None: ... + def limit_clause(self, select, **kw): ... + def fetch_clause(self, select, **kw): ... + def visit_table( + self, + table, + asfrom: bool = ..., + iscrud: bool = ..., + ashint: bool = ..., + fromhints: Any | None = ..., + use_schema: bool = ..., + from_linter: Any | None = ..., + **kwargs, + ): ... + def visit_join(self, join, asfrom: bool = ..., from_linter: Any | None = ..., **kwargs): ... + def visit_insert(self, insert_stmt, **kw): ... + def update_limit_clause(self, update_stmt) -> None: ... + def update_tables_clause(self, update_stmt, from_table, extra_froms, **kw): ... + def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw) -> None: ... + def visit_update(self, update_stmt, **kw): ... + def delete_extra_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw) -> None: ... + def delete_table_clause(self, delete_stmt, from_table, extra_froms): ... + def visit_delete(self, delete_stmt, **kw): ... + def visit_savepoint(self, savepoint_stmt): ... + def visit_rollback_to_savepoint(self, savepoint_stmt): ... + def visit_release_savepoint(self, savepoint_stmt): ... + +class StrSQLCompiler(SQLCompiler): + def visit_unsupported_compilation(self, element, err, **kw): ... + def visit_getitem_binary(self, binary, operator, **kw): ... + def visit_json_getitem_op_binary(self, binary, operator, **kw): ... + def visit_json_path_getitem_op_binary(self, binary, operator, **kw): ... + def visit_sequence(self, seq, **kw): ... + def returning_clause(self, stmt, returning_cols): ... + def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw): ... + def delete_extra_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw): ... + def visit_empty_set_expr(self, type_): ... + def get_from_hint_text(self, table, text): ... + def visit_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_not_regexp_match_op_binary(self, binary, operator, **kw): ... + def visit_regexp_replace_op_binary(self, binary, operator, **kw): ... + +class DDLCompiler(Compiled): + @memoized_property + def sql_compiler(self): ... + @memoized_property + def type_compiler(self): ... + def construct_params( + self, params: Any | None = ..., extracted_parameters: Any | None = ..., escape_names: bool = ... + ) -> None: ... + def visit_ddl(self, ddl, **kwargs): ... + def visit_create_schema(self, create, **kw): ... + def visit_drop_schema(self, drop, **kw): ... + def visit_create_table(self, create, **kw): ... + def visit_create_column(self, create, first_pk: bool = ..., **kw): ... + def create_table_constraints(self, table, _include_foreign_key_constraints: Any | None = ..., **kw): ... + def visit_drop_table(self, drop, **kw): ... + def visit_drop_view(self, drop, **kw): ... + def visit_create_index(self, create, include_schema: bool = ..., include_table_schema: bool = ..., **kw): ... + def visit_drop_index(self, drop, **kw): ... + def visit_add_constraint(self, create, **kw): ... + def visit_set_table_comment(self, create, **kw): ... + def visit_drop_table_comment(self, drop, **kw): ... + def visit_set_column_comment(self, create, **kw): ... + def visit_drop_column_comment(self, drop, **kw): ... + def get_identity_options(self, identity_options): ... + def visit_create_sequence(self, create, prefix: Any | None = ..., **kw): ... + def visit_drop_sequence(self, drop, **kw): ... + def visit_drop_constraint(self, drop, **kw): ... + def get_column_specification(self, column, **kwargs): ... + def create_table_suffix(self, table): ... + def post_create_table(self, table): ... + def get_column_default_string(self, column): ... + def visit_table_or_column_check_constraint(self, constraint, **kw): ... + def visit_check_constraint(self, constraint, **kw): ... + def visit_column_check_constraint(self, constraint, **kw): ... + def visit_primary_key_constraint(self, constraint, **kw): ... + def visit_foreign_key_constraint(self, constraint, **kw): ... + def define_constraint_remote_table(self, constraint, table, preparer): ... + def visit_unique_constraint(self, constraint, **kw): ... + def define_constraint_cascades(self, constraint): ... + def define_constraint_deferrability(self, constraint): ... + def define_constraint_match(self, constraint): ... + def visit_computed_column(self, generated, **kw): ... + def visit_identity_column(self, identity, **kw): ... + +class GenericTypeCompiler(TypeCompiler): + def visit_FLOAT(self, type_, **kw): ... + def visit_REAL(self, type_, **kw): ... + def visit_NUMERIC(self, type_, **kw): ... + def visit_DECIMAL(self, type_, **kw): ... + def visit_INTEGER(self, type_, **kw): ... + def visit_SMALLINT(self, type_, **kw): ... + def visit_BIGINT(self, type_, **kw): ... + def visit_TIMESTAMP(self, type_, **kw): ... + def visit_DATETIME(self, type_, **kw): ... + def visit_DATE(self, type_, **kw): ... + def visit_TIME(self, type_, **kw): ... + def visit_CLOB(self, type_, **kw): ... + def visit_NCLOB(self, type_, **kw): ... + def visit_CHAR(self, type_, **kw): ... + def visit_NCHAR(self, type_, **kw): ... + def visit_VARCHAR(self, type_, **kw): ... + def visit_NVARCHAR(self, type_, **kw): ... + def visit_TEXT(self, type_, **kw): ... + def visit_BLOB(self, type_, **kw): ... + def visit_BINARY(self, type_, **kw): ... + def visit_VARBINARY(self, type_, **kw): ... + def visit_BOOLEAN(self, type_, **kw): ... + def visit_large_binary(self, type_, **kw): ... + def visit_boolean(self, type_, **kw): ... + def visit_time(self, type_, **kw): ... + def visit_datetime(self, type_, **kw): ... + def visit_date(self, type_, **kw): ... + def visit_big_integer(self, type_, **kw): ... + def visit_small_integer(self, type_, **kw): ... + def visit_integer(self, type_, **kw): ... + def visit_real(self, type_, **kw): ... + def visit_float(self, type_, **kw): ... + def visit_numeric(self, type_, **kw): ... + def visit_string(self, type_, **kw): ... + def visit_unicode(self, type_, **kw): ... + def visit_text(self, type_, **kw): ... + def visit_unicode_text(self, type_, **kw): ... + def visit_enum(self, type_, **kw): ... + def visit_null(self, type_, **kw) -> None: ... + def visit_type_decorator(self, type_, **kw): ... + def visit_user_defined(self, type_, **kw): ... + +class StrSQLTypeCompiler(GenericTypeCompiler): + def process(self, type_, **kw): ... + def __getattr__(self, key): ... + def visit_null(self, type_, **kw): ... + def visit_user_defined(self, type_, **kw): ... + +class IdentifierPreparer: + reserved_words: Any + legal_characters: Any + illegal_initial_characters: Any + schema_for_object: Any + dialect: Any + initial_quote: Any + final_quote: Any + escape_quote: Any + escape_to_quote: Any + omit_schema: Any + quote_case_sensitive_collations: Any + def __init__( + self, + dialect, + initial_quote: str = ..., + final_quote: Any | None = ..., + escape_quote: str = ..., + quote_case_sensitive_collations: bool = ..., + omit_schema: bool = ..., + ) -> None: ... + def validate_sql_phrase(self, element, reg): ... + def quote_identifier(self, value): ... + def quote_schema(self, schema, force: Any | None = ...): ... + def quote(self, ident, force: Any | None = ...): ... + def format_collation(self, collation_name): ... + def format_sequence(self, sequence, use_schema: bool = ...): ... + def format_label(self, label, name: Any | None = ...): ... + def format_alias(self, alias, name: Any | None = ...): ... + def format_savepoint(self, savepoint, name: Any | None = ...): ... + def format_constraint(self, constraint, _alembic_quote: bool = ...): ... + def truncate_and_render_index_name(self, name, _alembic_quote: bool = ...): ... + def truncate_and_render_constraint_name(self, name, _alembic_quote: bool = ...): ... + def format_index(self, index): ... + def format_table(self, table, use_schema: bool = ..., name: Any | None = ...): ... + def format_schema(self, name): ... + def format_label_name(self, name, anon_map: Any | None = ...): ... + def format_column( + self, + column, + use_table: bool = ..., + name: Any | None = ..., + table_name: Any | None = ..., + use_schema: bool = ..., + anon_map: Any | None = ..., + ): ... + def format_table_seq(self, table, use_schema: bool = ...): ... + def unformat_identifiers(self, identifiers): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/crud.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/crud.pyi new file mode 100644 index 0000000..a13be2f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/crud.pyi @@ -0,0 +1,18 @@ +from typing import Any, Generic, TypeVar + +from . import elements +from .operators import ColumnOperators + +_T = TypeVar("_T") + +REQUIRED: Any + +class _multiparam_column(elements.ColumnElement[_T], Generic[_T]): + index: Any + key: Any + original: Any + default: Any + type: Any + def __init__(self, original, index) -> None: ... + def compare(self, other, **kw) -> None: ... + def __eq__(self, other) -> ColumnOperators[_T]: ... # type: ignore[override] diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/ddl.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/ddl.pyi new file mode 100644 index 0000000..4dba7ea --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/ddl.pyi @@ -0,0 +1,139 @@ +from typing import Any + +from . import roles +from .base import Executable, SchemaVisitor +from .elements import ClauseElement + +class _DDLCompiles(ClauseElement): ... + +class DDLElement(roles.DDLRole, Executable, _DDLCompiles): + target: Any + on: Any + dialect: Any + callable_: Any + def execute(self, bind: Any | None = ..., target: Any | None = ...): ... # type: ignore[override] + def against(self, target) -> None: ... + state: Any + def execute_if(self, dialect: Any | None = ..., callable_: Any | None = ..., state: Any | None = ...) -> None: ... + def __call__(self, target, bind, **kw): ... + bind: Any + +class DDL(DDLElement): + __visit_name__: str + statement: Any + context: Any + def __init__(self, statement, context: Any | None = ..., bind: Any | None = ...) -> None: ... + +class _CreateDropBase(DDLElement): + element: Any + bind: Any + if_exists: Any + if_not_exists: Any + def __init__( + self, element, bind: Any | None = ..., if_exists: bool = ..., if_not_exists: bool = ..., _legacy_bind: Any | None = ... + ) -> None: ... + @property + def stringify_dialect(self): ... + +class CreateSchema(_CreateDropBase): + __visit_name__: str + quote: Any + def __init__(self, name, quote: Any | None = ..., **kw) -> None: ... + +class DropSchema(_CreateDropBase): + __visit_name__: str + quote: Any + cascade: Any + def __init__(self, name, quote: Any | None = ..., cascade: bool = ..., **kw) -> None: ... + +class CreateTable(_CreateDropBase): + __visit_name__: str + columns: Any + include_foreign_key_constraints: Any + def __init__( + self, element, bind: Any | None = ..., include_foreign_key_constraints: Any | None = ..., if_not_exists: bool = ... + ) -> None: ... + +class _DropView(_CreateDropBase): + __visit_name__: str + +class CreateColumn(_DDLCompiles): + __visit_name__: str + element: Any + def __init__(self, element) -> None: ... + +class DropTable(_CreateDropBase): + __visit_name__: str + def __init__(self, element, bind: Any | None = ..., if_exists: bool = ...) -> None: ... + +class CreateSequence(_CreateDropBase): + __visit_name__: str + +class DropSequence(_CreateDropBase): + __visit_name__: str + +class CreateIndex(_CreateDropBase): + __visit_name__: str + def __init__(self, element, bind: Any | None = ..., if_not_exists: bool = ...) -> None: ... + +class DropIndex(_CreateDropBase): + __visit_name__: str + def __init__(self, element, bind: Any | None = ..., if_exists: bool = ...) -> None: ... + +class AddConstraint(_CreateDropBase): + __visit_name__: str + def __init__(self, element, *args, **kw) -> None: ... + +class DropConstraint(_CreateDropBase): + __visit_name__: str + cascade: Any + def __init__(self, element, cascade: bool = ..., **kw) -> None: ... + +class SetTableComment(_CreateDropBase): + __visit_name__: str + +class DropTableComment(_CreateDropBase): + __visit_name__: str + +class SetColumnComment(_CreateDropBase): + __visit_name__: str + +class DropColumnComment(_CreateDropBase): + __visit_name__: str + +class DDLBase(SchemaVisitor): + connection: Any + def __init__(self, connection) -> None: ... + +class SchemaGenerator(DDLBase): + checkfirst: Any + tables: Any + preparer: Any + dialect: Any + memo: Any + def __init__(self, dialect, connection, checkfirst: bool = ..., tables: Any | None = ..., **kwargs) -> None: ... + def visit_metadata(self, metadata) -> None: ... + def visit_table( + self, table, create_ok: bool = ..., include_foreign_key_constraints: Any | None = ..., _is_metadata_operation: bool = ... + ) -> None: ... + def visit_foreign_key_constraint(self, constraint) -> None: ... + def visit_sequence(self, sequence, create_ok: bool = ...) -> None: ... + def visit_index(self, index, create_ok: bool = ...) -> None: ... + +class SchemaDropper(DDLBase): + checkfirst: Any + tables: Any + preparer: Any + dialect: Any + memo: Any + def __init__(self, dialect, connection, checkfirst: bool = ..., tables: Any | None = ..., **kwargs) -> None: ... + def visit_metadata(self, metadata): ... + def visit_index(self, index, drop_ok: bool = ...) -> None: ... + def visit_table(self, table, drop_ok: bool = ..., _is_metadata_operation: bool = ..., _ignore_sequences=...) -> None: ... + def visit_foreign_key_constraint(self, constraint) -> None: ... + def visit_sequence(self, sequence, drop_ok: bool = ...) -> None: ... + +def sort_tables(tables, skip_fn: Any | None = ..., extra_dependencies: Any | None = ...): ... +def sort_tables_and_constraints( + tables, filter_fn: Any | None = ..., extra_dependencies: Any | None = ..., _warn_for_cycles: bool = ... +): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/default_comparator.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/default_comparator.pyi new file mode 100644 index 0000000..ac514fd --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/default_comparator.pyi @@ -0,0 +1,3 @@ +from typing import Any + +operator_lookup: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/dml.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/dml.pyi new file mode 100644 index 0000000..ee31b23 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/dml.pyi @@ -0,0 +1,111 @@ +from typing import Any + +from . import roles +from .base import CompileState, DialectKWArgs, Executable, HasCompileState +from .elements import ClauseElement +from .selectable import HasCTE, HasPrefixes, ReturnsRows + +class DMLState(CompileState): + isupdate: bool + isdelete: bool + isinsert: bool + def __init__(self, statement, compiler, **kw) -> None: ... + @property + def dml_table(self): ... + +class InsertDMLState(DMLState): + isinsert: bool + include_table_with_column_exprs: bool + statement: Any + def __init__(self, statement, compiler, **kw) -> None: ... + +class UpdateDMLState(DMLState): + isupdate: bool + include_table_with_column_exprs: bool + statement: Any + is_multitable: Any + def __init__(self, statement, compiler, **kw) -> None: ... + +class DeleteDMLState(DMLState): + isdelete: bool + statement: Any + def __init__(self, statement, compiler, **kw) -> None: ... + +class UpdateBase(roles.DMLRole, HasCTE, HasCompileState, DialectKWArgs, HasPrefixes, ReturnsRows, Executable, ClauseElement): + __visit_name__: str + named_with_column: bool + is_dml: bool + def params(self, *arg, **kw) -> None: ... + def with_dialect_options(self, **opt) -> None: ... + bind: Any + def returning(self, *cols) -> None: ... + @property + def exported_columns(self): ... + def with_hint(self, text, selectable: Any | None = ..., dialect_name: str = ...) -> None: ... + +class ValuesBase(UpdateBase): + __visit_name__: str + select: Any + table: Any + def __init__(self, table, values, prefixes) -> None: ... + def values(self, *args, **kwargs) -> None: ... + def return_defaults(self, *cols) -> None: ... + +class Insert(ValuesBase): + __visit_name__: str + select: Any + include_insert_from_select_defaults: bool + is_insert: bool + def __init__( + self, + table, + values: Any | None = ..., + inline: bool = ..., + bind: Any | None = ..., + prefixes: Any | None = ..., + returning: Any | None = ..., + return_defaults: bool = ..., + **dialect_kw, + ) -> None: ... + def inline(self) -> None: ... + def from_select(self, names, select, include_defaults: bool = ...) -> None: ... + +class DMLWhereBase: + def where(self, *whereclause) -> None: ... + def filter(self, *criteria): ... + def filter_by(self, **kwargs): ... + @property + def whereclause(self): ... + +class Update(DMLWhereBase, ValuesBase): + __visit_name__: str + is_update: bool + def __init__( + self, + table, + whereclause: Any | None = ..., + values: Any | None = ..., + inline: bool = ..., + bind: Any | None = ..., + prefixes: Any | None = ..., + returning: Any | None = ..., + return_defaults: bool = ..., + preserve_parameter_order: bool = ..., + **dialect_kw, + ) -> None: ... + def ordered_values(self, *args) -> None: ... + def inline(self) -> None: ... + +class Delete(DMLWhereBase, UpdateBase): + __visit_name__: str + is_delete: bool + table: Any + def __init__( + self, + table, + whereclause: Any | None = ..., + bind: Any | None = ..., + returning: Any | None = ..., + prefixes: Any | None = ..., + **dialect_kw, + ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi new file mode 100644 index 0000000..4d3f854 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi @@ -0,0 +1,456 @@ +from typing import Any, Generic, TypeVar +from typing_extensions import Literal + +from .. import util +from ..util import HasMemoized, memoized_property +from . import operators, roles +from .annotation import Annotated, SupportsWrappingAnnotations +from .base import Executable, Immutable, SingletonConstant +from .traversals import HasCopyInternals, MemoizedHasCacheKey +from .visitors import Traversible + +_T = TypeVar("_T") + +def collate(expression, collation): ... +def between(expr, lower_bound, upper_bound, symmetric: bool = ...): ... +def literal(value, type_: Any | None = ...): ... +def outparam(key, type_: Any | None = ...): ... +def not_(clause): ... + +class ClauseElement(roles.SQLRole, SupportsWrappingAnnotations, MemoizedHasCacheKey, HasCopyInternals, Traversible): + __visit_name__: str + supports_execution: bool + stringify_dialect: str + bind: Any + description: Any + is_clause_element: bool + is_selectable: bool + @property + def entity_namespace(self) -> None: ... + def unique_params(self, *optionaldict, **kwargs): ... + def params(self, *optionaldict, **kwargs): ... + def compare(self, other, **kw): ... + def self_group(self, against: Any | None = ...): ... + def compile(self, bind: Any | None = ..., dialect: Any | None = ..., **kw): ... + def __invert__(self): ... + def __bool__(self) -> None: ... + __nonzero__: Any + +class ColumnElement( + roles.ColumnArgumentOrKeyRole, + roles.StatementOptionRole, + roles.WhereHavingRole, + roles.BinaryElementRole, + roles.OrderByRole, + roles.ColumnsClauseRole, + roles.LimitOffsetRole, + roles.DMLColumnRole, + roles.DDLConstraintColumnRole, + roles.DDLExpressionRole, + operators.ColumnOperators[_T], + ClauseElement, + Generic[_T], +): + __visit_name__: str + primary_key: bool + foreign_keys: Any + key: Any + def self_group(self, against: Any | None = ...): ... + @memoized_property + def type(self): ... + @HasMemoized.memoized_attribute + def comparator(self): ... + def __getattr__(self, key): ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... + @property + def expression(self): ... + @memoized_property + def base_columns(self): ... + @memoized_property + def proxy_set(self): ... + def shares_lineage(self, othercolumn): ... + def cast(self, type_): ... + def label(self, name): ... + @property + def anon_label(self): ... + @property + def anon_key_label(self): ... + +class WrapsColumnExpression: + @property + def wrapped_column_expression(self) -> None: ... + +class BindParameter(roles.InElementRole, ColumnElement[_T], Generic[_T]): + __visit_name__: str + inherit_cache: bool + key: Any + unique: Any + value: Any + callable: Any + isoutparam: Any + required: Any + expanding: Any + expand_op: Any + literal_execute: Any + type: Any + def __init__( + self, + key, + value=..., + type_: Any | None = ..., + unique: bool = ..., + required=..., + quote: Any | None = ..., + callable_: Any | None = ..., + expanding: bool = ..., + isoutparam: bool = ..., + literal_execute: bool = ..., + _compared_to_operator: Any | None = ..., + _compared_to_type: Any | None = ..., + _is_crud: bool = ..., + ) -> None: ... + @property + def effective_value(self): ... + def render_literal_execute(self): ... + +class TypeClause(ClauseElement): + __visit_name__: str + type: Any + def __init__(self, type_) -> None: ... + +class TextClause( + roles.DDLConstraintColumnRole, + roles.DDLExpressionRole, + roles.StatementOptionRole, + roles.WhereHavingRole, + roles.OrderByRole, + roles.FromClauseRole, + roles.SelectStatementRole, + roles.BinaryElementRole, + roles.InElementRole, + Executable, + ClauseElement, +): + __visit_name__: str + def __and__(self, other): ... + key: Any + text: Any + def __init__(self, text, bind: Any | None = ...): ... + def bindparams(self, *binds, **names_to_values) -> None: ... + def columns(self, *cols, **types): ... + @property + def type(self): ... + @property + def comparator(self): ... + def self_group(self, against: Any | None = ...): ... + +class Null(SingletonConstant, roles.ConstExprRole, ColumnElement[None]): + __visit_name__: str + @memoized_property + def type(self): ... + +class False_(SingletonConstant, roles.ConstExprRole, ColumnElement[Literal[False]]): + __visit_name__: str + @memoized_property + def type(self): ... + +class True_(SingletonConstant, roles.ConstExprRole, ColumnElement[Literal[True]]): + __visit_name__: str + @memoized_property + def type(self): ... + +class ClauseList(roles.InElementRole, roles.OrderByRole, roles.ColumnsClauseRole, roles.DMLColumnRole, ClauseElement): + __visit_name__: str + operator: Any + group: Any + group_contents: Any + clauses: Any + def __init__(self, *clauses, **kwargs) -> None: ... + def __iter__(self): ... + def __len__(self): ... + def append(self, clause) -> None: ... + def self_group(self, against: Any | None = ...): ... + +class BooleanClauseList(ClauseList, ColumnElement[Any]): + __visit_name__: str + inherit_cache: bool + def __init__(self, *arg, **kw) -> None: ... + @classmethod + def and_(cls, *clauses): ... + @classmethod + def or_(cls, *clauses): ... + def self_group(self, against: Any | None = ...): ... + +and_: Any +or_: Any + +class Tuple(ClauseList, ColumnElement[Any]): + __visit_name__: str + type: Any + def __init__(self, *clauses, **kw) -> None: ... + def self_group(self, against: Any | None = ...): ... + +class Case(ColumnElement[Any]): + __visit_name__: str + value: Any + type: Any + whens: Any + else_: Any + def __init__(self, *whens, **kw) -> None: ... + +def literal_column(text, type_: Any | None = ...): ... + +class Cast(WrapsColumnExpression, ColumnElement[Any]): + __visit_name__: str + type: Any + clause: Any + typeclause: Any + def __init__(self, expression, type_) -> None: ... + @property + def wrapped_column_expression(self): ... + +class TypeCoerce(WrapsColumnExpression, ColumnElement[Any]): + __visit_name__: str + type: Any + clause: Any + def __init__(self, expression, type_) -> None: ... + @HasMemoized.memoized_attribute + def typed_expression(self): ... + @property + def wrapped_column_expression(self): ... + def self_group(self, against: Any | None = ...): ... + +class Extract(ColumnElement[Any]): + __visit_name__: str + type: Any + field: Any + expr: Any + def __init__(self, field, expr, **kwargs) -> None: ... + +class _label_reference(ColumnElement[Any]): + __visit_name__: str + element: Any + def __init__(self, element) -> None: ... + +class _textual_label_reference(ColumnElement[Any]): + __visit_name__: str + element: Any + def __init__(self, element) -> None: ... + +class UnaryExpression(ColumnElement[Any]): + __visit_name__: str + operator: Any + modifier: Any + element: Any + type: Any + wraps_column_expression: Any + def __init__( + self, + element, + operator: Any | None = ..., + modifier: Any | None = ..., + type_: Any | None = ..., + wraps_column_expression: bool = ..., + ) -> None: ... + def self_group(self, against: Any | None = ...): ... + +class CollectionAggregate(UnaryExpression): + inherit_cache: bool + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs) -> None: ... + +class AsBoolean(WrapsColumnExpression, UnaryExpression): + inherit_cache: bool + element: Any + type: Any + operator: Any + negate: Any + modifier: Any + wraps_column_expression: bool + def __init__(self, element, operator, negate) -> None: ... + @property + def wrapped_column_expression(self): ... + def self_group(self, against: Any | None = ...): ... + +class BinaryExpression(ColumnElement[Any]): + __visit_name__: str + left: Any + right: Any + operator: Any + type: Any + negate: Any + modifiers: Any + def __init__( + self, left, right, operator, type_: Any | None = ..., negate: Any | None = ..., modifiers: Any | None = ... + ) -> None: ... + def __bool__(self): ... + __nonzero__: Any + @property + def is_comparison(self): ... + def self_group(self, against: Any | None = ...): ... + +class Slice(ColumnElement[Any]): + __visit_name__: str + start: Any + stop: Any + step: Any + type: Any + def __init__(self, start, stop, step, _name: Any | None = ...) -> None: ... + def self_group(self, against: Any | None = ...): ... + +class IndexExpression(BinaryExpression): + inherit_cache: bool + +class GroupedElement(ClauseElement): + __visit_name__: str + def self_group(self, against: Any | None = ...): ... + +class Grouping(GroupedElement, ColumnElement[Any]): + element: Any + type: Any + def __init__(self, element) -> None: ... + def __getattr__(self, attr): ... + +RANGE_UNBOUNDED: Any +RANGE_CURRENT: Any + +class Over(ColumnElement[Any]): + __visit_name__: str + order_by: Any + partition_by: Any + element: Any + range_: Any + rows: Any + def __init__( + self, + element, + partition_by: Any | None = ..., + order_by: Any | None = ..., + range_: Any | None = ..., + rows: Any | None = ..., + ) -> None: ... + def __reduce__(self): ... + @memoized_property + def type(self): ... + +class WithinGroup(ColumnElement[Any]): + __visit_name__: str + order_by: Any + element: Any + def __init__(self, element, *order_by) -> None: ... + def __reduce__(self): ... + def over( + self, partition_by: Any | None = ..., order_by: Any | None = ..., range_: Any | None = ..., rows: Any | None = ... + ): ... + @memoized_property + def type(self): ... + +class FunctionFilter(ColumnElement[Any]): + __visit_name__: str + criterion: Any + func: Any + def __init__(self, func, *criterion) -> None: ... + def filter(self, *criterion): ... + def over( + self, partition_by: Any | None = ..., order_by: Any | None = ..., range_: Any | None = ..., rows: Any | None = ... + ): ... + def self_group(self, against: Any | None = ...): ... + @memoized_property + def type(self): ... + +class Label(roles.LabeledColumnExprRole, ColumnElement[Any]): + __visit_name__: str + name: Any + key: Any + def __init__(self, name, element, type_: Any | None = ...) -> None: ... + def __reduce__(self): ... + @memoized_property + def type(self): ... + @HasMemoized.memoized_attribute + def element(self): ... + def self_group(self, against: Any | None = ...): ... + @property + def primary_key(self): ... + @property + def foreign_keys(self): ... + +class NamedColumn(ColumnElement[Any]): + is_literal: bool + table: Any + @memoized_property + def description(self): ... + +class ColumnClause(roles.DDLReferredColumnRole, roles.LabeledColumnExprRole, roles.StrAsPlainColumnRole, Immutable, NamedColumn): + table: Any + is_literal: bool + __visit_name__: str + onupdate: Any + default: Any + server_default: Any + server_onupdate: Any + key: Any + type: Any + def __init__(self, text, type_: Any | None = ..., is_literal: bool = ..., _selectable: Any | None = ...) -> None: ... + def get_children(self, column_tables: bool = ..., **kw): ... # type: ignore[override] + @property + def entity_namespace(self): ... + +class TableValuedColumn(NamedColumn): + __visit_name__: str + scalar_alias: Any + key: Any + type: Any + def __init__(self, scalar_alias, type_) -> None: ... + +class CollationClause(ColumnElement[Any]): + __visit_name__: str + collation: Any + def __init__(self, collation) -> None: ... + +class _IdentifiedClause(Executable, ClauseElement): + __visit_name__: str + ident: Any + def __init__(self, ident) -> None: ... + +class SavepointClause(_IdentifiedClause): + __visit_name__: str + inherit_cache: bool + +class RollbackToSavepointClause(_IdentifiedClause): + __visit_name__: str + inherit_cache: bool + +class ReleaseSavepointClause(_IdentifiedClause): + __visit_name__: str + inherit_cache: bool + +class quoted_name(util.MemoizedSlots, util.text_type): + quote: Any + def __new__(cls, value, quote): ... + def __reduce__(self): ... + +class AnnotatedColumnElement(Annotated): + def __init__(self, element, values) -> None: ... + @memoized_property + def name(self): ... + @memoized_property + def table(self): ... + @memoized_property + def key(self): ... + @memoized_property + def info(self): ... + +class _truncated_label(quoted_name): + def __new__(cls, value, quote: Any | None = ...): ... + def __reduce__(self): ... + def apply_map(self, map_): ... + +class conv(_truncated_label): ... + +class _anonymous_label(_truncated_label): + @classmethod + def safe_construct(cls, seed, body, enclosing_label: Any | None = ..., sanitize_key: bool = ...): ... + def __add__(self, other): ... + def __radd__(self, other): ... + def apply_map(self, map_): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/events.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/events.pyi new file mode 100644 index 0000000..11765c6 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/events.pyi @@ -0,0 +1,10 @@ +from .. import event + +class DDLEvents(event.Events): + def before_create(self, target, connection, **kw) -> None: ... + def after_create(self, target, connection, **kw) -> None: ... + def before_drop(self, target, connection, **kw) -> None: ... + def after_drop(self, target, connection, **kw) -> None: ... + def before_parent_attach(self, target, parent) -> None: ... + def after_parent_attach(self, target, parent) -> None: ... + def column_reflect(self, inspector, table, column_info) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi new file mode 100644 index 0000000..79df689 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/expression.pyi @@ -0,0 +1,201 @@ +from typing import Any + +from .base import PARSE_AUTOCOMMIT as PARSE_AUTOCOMMIT, ColumnCollection as ColumnCollection, Executable as Executable +from .dml import Delete as Delete, Insert as Insert, Update as Update, UpdateBase as UpdateBase, ValuesBase as ValuesBase +from .elements import ( + BinaryExpression as BinaryExpression, + BindParameter as BindParameter, + BooleanClauseList as BooleanClauseList, + Case as Case, + Cast as Cast, + ClauseElement as ClauseElement, + ClauseList as ClauseList, + CollectionAggregate as CollectionAggregate, + ColumnClause as ColumnClause, + ColumnElement as ColumnElement, + Extract as Extract, + False_ as False_, + FunctionFilter as FunctionFilter, + Grouping as Grouping, + Label as Label, + Null as Null, + Over as Over, + ReleaseSavepointClause as ReleaseSavepointClause, + RollbackToSavepointClause as RollbackToSavepointClause, + SavepointClause as SavepointClause, + TextClause as TextClause, + True_ as True_, + Tuple as Tuple, + TypeClause as TypeClause, + TypeCoerce as TypeCoerce, + UnaryExpression as UnaryExpression, + WithinGroup as WithinGroup, + _truncated_label as _truncated_label, + between as between, + collate as collate, + literal as literal, + literal_column as literal_column, + not_ as not_, + outparam as outparam, + quoted_name as quoted_name, +) +from .functions import Function as Function, FunctionElement as FunctionElement, func as func, modifier as modifier +from .lambdas import LambdaElement as LambdaElement, StatementLambdaElement as StatementLambdaElement, lambda_stmt as lambda_stmt +from .operators import ColumnOperators as ColumnOperators, Operators as Operators, custom_op as custom_op +from .selectable import ( + CTE as CTE, + LABEL_STYLE_DEFAULT as LABEL_STYLE_DEFAULT, + LABEL_STYLE_DISAMBIGUATE_ONLY as LABEL_STYLE_DISAMBIGUATE_ONLY, + LABEL_STYLE_NONE as LABEL_STYLE_NONE, + LABEL_STYLE_TABLENAME_PLUS_COL as LABEL_STYLE_TABLENAME_PLUS_COL, + Alias as Alias, + AliasedReturnsRows as AliasedReturnsRows, + CompoundSelect as CompoundSelect, + Exists as Exists, + FromClause as FromClause, + FromGrouping as FromGrouping, + GenerativeSelect as GenerativeSelect, + HasCTE as HasCTE, + HasPrefixes as HasPrefixes, + HasSuffixes as HasSuffixes, + Join as Join, + Lateral as Lateral, + ReturnsRows as ReturnsRows, + ScalarSelect as ScalarSelect, + Select as Select, + Selectable as Selectable, + SelectBase as SelectBase, + Subquery as Subquery, + TableClause as TableClause, + TableSample as TableSample, + TableValuedAlias as TableValuedAlias, + TextAsFrom as TextAsFrom, + TextualSelect as TextualSelect, + Values as Values, + subquery as subquery, +) +from .traversals import CacheKey as CacheKey +from .visitors import Visitable as Visitable + +__all__ = [ + "Alias", + "AliasedReturnsRows", + "any_", + "all_", + "CacheKey", + "ClauseElement", + "ColumnCollection", + "ColumnElement", + "CompoundSelect", + "Delete", + "FromClause", + "Insert", + "Join", + "Lateral", + "LambdaElement", + "StatementLambdaElement", + "Select", + "Selectable", + "TableClause", + "TableValuedAlias", + "Update", + "Values", + "alias", + "and_", + "asc", + "between", + "bindparam", + "case", + "cast", + "column", + "custom_op", + "cte", + "delete", + "desc", + "distinct", + "except_", + "except_all", + "exists", + "extract", + "func", + "modifier", + "collate", + "insert", + "intersect", + "intersect_all", + "join", + "label", + "lateral", + "lambda_stmt", + "literal", + "literal_column", + "not_", + "null", + "nulls_first", + "nulls_last", + "or_", + "outparam", + "outerjoin", + "over", + "select", + "table", + "text", + "tuple_", + "type_coerce", + "quoted_name", + "union", + "union_all", + "update", + "quoted_name", + "within_group", + "Subquery", + "TableSample", + "tablesample", + "values", +] + +all_: Any +any_: Any +and_: Any +alias: Any +tablesample: Any +lateral: Any +or_: Any +bindparam: Any +select: Any +text: Any +table: Any +column: Any +over: Any +within_group: Any +label: Any +case: Any +cast: Any +cte: Any +values: Any +extract: Any +tuple_: Any +except_: Any +except_all: Any +intersect: Any +intersect_all: Any +union: Any +union_all: Any +exists: Any +nulls_first: Any +nullsfirst: Any +nulls_last: Any +nullslast: Any +asc: Any +desc: Any +distinct: Any +type_coerce: Any +true: Any +false: Any +null: Any +join: Any +outerjoin: Any +insert: Any +update: Any +delete: Any +funcfilter: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/functions.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/functions.pyi new file mode 100644 index 0000000..76058ff --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/functions.pyi @@ -0,0 +1,223 @@ +from typing import Any + +from ..util import HasMemoized +from .base import Executable, Generative +from .elements import BinaryExpression, ColumnElement, NamedColumn +from .selectable import FromClause, TableValuedAlias +from .visitors import TraversibleType + +def register_function(identifier, fn, package: str = ...) -> None: ... + +class FunctionElement(Executable, ColumnElement[Any], FromClause, Generative): # type: ignore[misc] + packagenames: Any + clause_expr: Any + def __init__(self, *clauses, **kwargs) -> None: ... + def scalar_table_valued(self, name, type_: Any | None = ...): ... + def table_valued(self, *expr, **kw): ... + def column_valued(self, name: Any | None = ...): ... + @property + def columns(self): ... + @property + def exported_columns(self): ... + @HasMemoized.memoized_attribute + def clauses(self): ... + def over( + self, partition_by: Any | None = ..., order_by: Any | None = ..., rows: Any | None = ..., range_: Any | None = ... + ): ... + def within_group(self, *order_by): ... + def filter(self, *criterion): ... + def as_comparison(self, left_index, right_index): ... + def within_group_type(self, within_group) -> None: ... + def alias(self, name: str | None = ..., joins_implicitly: bool = ...) -> TableValuedAlias: ... # type: ignore[override] + def select(self): ... + def scalar(self): ... + def execute(self): ... + def self_group(self, against: Any | None = ...): ... + @property + def entity_namespace(self): ... + +class FunctionAsBinary(BinaryExpression): + sql_function: Any + left_index: Any + right_index: Any + operator: Any + type: Any + negate: Any + modifiers: Any + def __init__(self, fn, left_index, right_index) -> None: ... + @property + def left(self): ... + @left.setter + def left(self, value) -> None: ... + @property + def right(self): ... + @right.setter + def right(self, value) -> None: ... + +class ScalarFunctionColumn(NamedColumn): + __visit_name__: str + is_literal: bool + table: Any + fn: Any + name: Any + type: Any + def __init__(self, fn, name, type_: Any | None = ...) -> None: ... + +class _FunctionGenerator: + opts: Any + def __init__(self, **opts) -> None: ... + def __getattr__(self, name): ... + def __call__(self, *c, **kwargs): ... + +func: Any +modifier: Any + +class Function(FunctionElement): + __visit_name__: str + type: Any + packagenames: Any + name: Any + def __init__(self, name, *clauses, **kw) -> None: ... + +class _GenericMeta(TraversibleType): + def __init__(cls, clsname, bases, clsdict) -> None: ... + +class GenericFunction: + name: Any + identifier: Any + coerce_arguments: bool + inherit_cache: bool + packagenames: Any + clause_expr: Any + type: Any + def __init__(self, *args, **kwargs) -> None: ... + +class next_value(GenericFunction): + type: Any + name: str + sequence: Any + def __init__(self, seq, **kw) -> None: ... + def compare(self, other, **kw): ... + +class AnsiFunction(GenericFunction): + inherit_cache: bool + def __init__(self, *args, **kwargs) -> None: ... + +class ReturnTypeFromArgs(GenericFunction): + inherit_cache: bool + def __init__(self, *args, **kwargs) -> None: ... + +class coalesce(ReturnTypeFromArgs): + inherit_cache: bool + +class max(ReturnTypeFromArgs): + inherit_cache: bool + +class min(ReturnTypeFromArgs): + inherit_cache: bool + +class sum(ReturnTypeFromArgs): + inherit_cache: bool + +class now(GenericFunction): + type: Any + inherit_cache: bool + +class concat(GenericFunction): + type: Any + inherit_cache: bool + +class char_length(GenericFunction): + type: Any + inherit_cache: bool + def __init__(self, arg, **kwargs) -> None: ... + +class random(GenericFunction): + inherit_cache: bool + +class count(GenericFunction): + type: Any + inherit_cache: bool + def __init__(self, expression: Any | None = ..., **kwargs) -> None: ... + +class current_date(AnsiFunction): + type: Any + inherit_cache: bool + +class current_time(AnsiFunction): + type: Any + inherit_cache: bool + +class current_timestamp(AnsiFunction): + type: Any + inherit_cache: bool + +class current_user(AnsiFunction): + type: Any + inherit_cache: bool + +class localtime(AnsiFunction): + type: Any + inherit_cache: bool + +class localtimestamp(AnsiFunction): + type: Any + inherit_cache: bool + +class session_user(AnsiFunction): + type: Any + inherit_cache: bool + +class sysdate(AnsiFunction): + type: Any + inherit_cache: bool + +class user(AnsiFunction): + type: Any + inherit_cache: bool + +class array_agg(GenericFunction): + type: Any + inherit_cache: bool + def __init__(self, *args, **kwargs) -> None: ... + +class OrderedSetAgg(GenericFunction): + array_for_multi_clause: bool + inherit_cache: bool + def within_group_type(self, within_group): ... + +class mode(OrderedSetAgg): + inherit_cache: bool + +class percentile_cont(OrderedSetAgg): + array_for_multi_clause: bool + inherit_cache: bool + +class percentile_disc(OrderedSetAgg): + array_for_multi_clause: bool + inherit_cache: bool + +class rank(GenericFunction): + type: Any + inherit_cache: bool + +class dense_rank(GenericFunction): + type: Any + inherit_cache: bool + +class percent_rank(GenericFunction): + type: Any + inherit_cache: bool + +class cume_dist(GenericFunction): + type: Any + inherit_cache: bool + +class cube(GenericFunction): + inherit_cache: bool + +class rollup(GenericFunction): + inherit_cache: bool + +class grouping_sets(GenericFunction): + inherit_cache: bool diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/lambdas.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/lambdas.pyi new file mode 100644 index 0000000..7b2b6e2 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/lambdas.pyi @@ -0,0 +1,115 @@ +from typing import Any, Generic, TypeVar + +from . import elements, roles +from .base import Options +from .operators import ColumnOperators + +_T = TypeVar("_T") + +class LambdaOptions(Options): + enable_tracking: bool + track_closure_variables: bool + track_on: Any + global_track_bound_values: bool + track_bound_values: bool + lambda_cache: Any + +def lambda_stmt( + lmb, + enable_tracking: bool = ..., + track_closure_variables: bool = ..., + track_on: Any | None = ..., + global_track_bound_values: bool = ..., + track_bound_values: bool = ..., + lambda_cache: Any | None = ..., +): ... + +class LambdaElement(elements.ClauseElement): + __visit_name__: str + parent_lambda: Any + fn: Any + role: Any + tracker_key: Any + opts: Any + def __init__(self, fn, role, opts=..., apply_propagate_attrs: Any | None = ...) -> None: ... + def __getattr__(self, key): ... + +class DeferredLambdaElement(LambdaElement): + lambda_args: Any + def __init__(self, fn, role, opts=..., lambda_args=...) -> None: ... + +class StatementLambdaElement(roles.AllowsLambdaRole, LambdaElement): + def __add__(self, other): ... + def add_criteria( + self, + other, + enable_tracking: bool = ..., + track_on: Any | None = ..., + track_closure_variables: bool = ..., + track_bound_values: bool = ..., + ): ... + def spoil(self): ... + +class NullLambdaStatement(roles.AllowsLambdaRole, elements.ClauseElement): + __visit_name__: str + def __init__(self, statement) -> None: ... + def __getattr__(self, key): ... + def __add__(self, other): ... + def add_criteria(self, other, **kw): ... + +class LinkedLambdaElement(StatementLambdaElement): + role: Any + opts: Any + fn: Any + parent_lambda: Any + tracker_key: Any + def __init__(self, fn, parent_lambda, opts) -> None: ... + +class AnalyzedCode: + @classmethod + def get(cls, fn, lambda_element, lambda_kw, **kw): ... + track_bound_values: Any + track_closure_variables: Any + bindparam_trackers: Any + closure_trackers: Any + build_py_wrappers: Any + def __init__(self, fn, lambda_element, opts) -> None: ... + +class NonAnalyzedFunction: + closure_bindparams: Any + bindparam_trackers: Any + expr: Any + def __init__(self, expr) -> None: ... + @property + def expected_expr(self): ... + +class AnalyzedFunction: + analyzed_code: Any + fn: Any + closure_pywrappers: Any + tracker_instrumented_fn: Any + expr: Any + bindparam_trackers: Any + expected_expr: Any + is_sequence: Any + propagate_attrs: Any + closure_bindparams: Any + def __init__(self, analyzed_code, lambda_element, apply_propagate_attrs, fn) -> None: ... + +class PyWrapper(ColumnOperators[_T], Generic[_T]): + fn: Any + track_bound_values: Any + def __init__( + self, fn, name, to_evaluate, closure_index: Any | None = ..., getter: Any | None = ..., track_bound_values: bool = ... + ) -> None: ... + def __call__(self, *arg, **kw): ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... + def __clause_element__(self): ... + def __bool__(self): ... + def __nonzero__(self): ... + def __getattribute__(self, key): ... + def __iter__(self): ... + def __getitem__(self, key) -> ColumnOperators[_T]: ... + +def insp(lmb): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/naming.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/naming.pyi new file mode 100644 index 0000000..50bdacf --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/naming.pyi @@ -0,0 +1,10 @@ +from typing import Any + +from .elements import conv as conv + +class ConventionDict: + const: Any + table: Any + convention: Any + def __init__(self, const, table, convention) -> None: ... + def __getitem__(self, key): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/operators.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/operators.pyi new file mode 100644 index 0000000..2bc4769 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/operators.pyi @@ -0,0 +1,193 @@ +from collections.abc import Container, Iterable +from operator import truediv +from typing import Any, Generic, TypeVar + +_T = TypeVar("_T") + +div = truediv + +class Operators: + def __and__(self, other): ... + def __or__(self, other): ... + def __invert__(self): ... + def op(self, opstring, precedence: int = ..., is_comparison: bool = ..., return_type: Any | None = ...): ... + def bool_op(self, opstring, precedence: int = ...): ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... + +class custom_op: + __name__: str + opstring: Any + precedence: Any + is_comparison: Any + natural_self_precedent: Any + eager_grouping: Any + return_type: Any + def __init__( + self, + opstring, + precedence: int = ..., + is_comparison: bool = ..., + return_type: Any | None = ..., + natural_self_precedent: bool = ..., + eager_grouping: bool = ..., + ) -> None: ... + def __eq__(self, other): ... + def __hash__(self) -> int: ... + def __call__(self, left, right, **kw): ... + +class ColumnOperators(Operators, Generic[_T]): + timetuple: Any + def __lt__(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... + def __le__(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... + def __hash__(self) -> int: ... + def __eq__(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... # type: ignore[override] + def __ne__(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... # type: ignore[override] + def is_distinct_from(self, other) -> ColumnOperators[_T]: ... + def is_not_distinct_from(self, other) -> ColumnOperators[_T]: ... + def isnot_distinct_from(self, other) -> ColumnOperators[_T]: ... + def __gt__(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... + def __ge__(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... + def __neg__(self) -> ColumnOperators[_T]: ... + def __contains__(self, other) -> ColumnOperators[_T]: ... + def __getitem__(self, index: int) -> ColumnOperators[_T]: ... + def __lshift__(self, other) -> ColumnOperators[_T]: ... + def __rshift__(self, other) -> ColumnOperators[_T]: ... + def concat(self, other: _T | ColumnOperators[_T] | None) -> ColumnOperators[_T]: ... + def like(self, other: _T, escape: str | None = ...) -> ColumnOperators[_T]: ... + def ilike(self, other: _T, escape: str | None = ...) -> ColumnOperators[_T]: ... + def in_(self, other: Container[_T] | Iterable[_T]) -> ColumnOperators[_T]: ... + def not_in(self, other: Container[_T] | Iterable[_T]) -> ColumnOperators[_T]: ... + def notin_(self, other: Container[_T] | Iterable[_T]) -> ColumnOperators[_T]: ... + def not_like(self, other: _T, escape: str | None = ...) -> ColumnOperators[_T]: ... + def notlike(self, other: _T, escape: str | None = ...) -> ColumnOperators[_T]: ... + def not_ilike(self, other: _T, escape: str | None = ...) -> ColumnOperators[_T]: ... + def notilike(self, other: _T, escape: str | None = ...) -> ColumnOperators[_T]: ... + def is_(self, other: _T) -> ColumnOperators[_T]: ... + def is_not(self, other: _T) -> ColumnOperators[_T]: ... + def isnot(self, other: _T) -> ColumnOperators[_T]: ... + def startswith(self, other: str, **kwargs) -> ColumnOperators[_T]: ... + def endswith(self, other: str, **kwargs) -> ColumnOperators[_T]: ... + def contains(self, other: str, **kwargs) -> ColumnOperators[_T]: ... + def match(self, other: str, **kwargs) -> ColumnOperators[_T]: ... + def regexp_match(self, pattern, flags: Any | None = ...) -> ColumnOperators[_T]: ... + def regexp_replace(self, pattern, replacement, flags: Any | None = ...) -> ColumnOperators[_T]: ... + def desc(self) -> ColumnOperators[_T]: ... + def asc(self) -> ColumnOperators[_T]: ... + def nulls_first(self) -> ColumnOperators[_T]: ... + def nullsfirst(self) -> ColumnOperators[_T]: ... + def nulls_last(self) -> ColumnOperators[_T]: ... + def nullslast(self) -> ColumnOperators[_T]: ... + def collate(self, collation) -> ColumnOperators[_T]: ... + def __radd__(self, other) -> ColumnOperators[_T]: ... + def __rsub__(self, other) -> ColumnOperators[_T]: ... + def __rmul__(self, other) -> ColumnOperators[_T]: ... + def __rdiv__(self, other) -> ColumnOperators[_T]: ... + def __rmod__(self, other) -> ColumnOperators[_T]: ... + def between(self, cleft, cright, symmetric: bool = ...) -> ColumnOperators[_T]: ... + def distinct(self) -> ColumnOperators[_T]: ... + def any_(self) -> ColumnOperators[_T]: ... + def all_(self) -> ColumnOperators[_T]: ... + def __add__(self, other) -> ColumnOperators[_T]: ... + def __sub__(self, other) -> ColumnOperators[_T]: ... + def __mul__(self, other) -> ColumnOperators[_T]: ... + def __div__(self, other) -> ColumnOperators[_T]: ... + def __mod__(self, other) -> ColumnOperators[_T]: ... + def __truediv__(self, other) -> ColumnOperators[_T]: ... + def __rtruediv__(self, other) -> ColumnOperators[_T]: ... + +def commutative_op(fn): ... +def comparison_op(fn): ... +def from_() -> None: ... +def function_as_comparison_op() -> None: ... +def as_() -> None: ... +def exists() -> None: ... +def is_true(a) -> None: ... + +istrue = is_true + +def is_false(a) -> None: ... + +isfalse = is_false + +def is_distinct_from(a, b): ... +def is_not_distinct_from(a, b): ... + +isnot_distinct_from = is_not_distinct_from + +def is_(a, b): ... +def is_not(a, b): ... + +isnot = is_not + +def collate(a, b): ... +def op(a, opstring, b): ... +def like_op(a, b, escape: Any | None = ...): ... +def not_like_op(a, b, escape: Any | None = ...): ... + +notlike_op = not_like_op + +def ilike_op(a, b, escape: Any | None = ...): ... +def not_ilike_op(a, b, escape: Any | None = ...): ... + +notilike_op = not_ilike_op + +def between_op(a, b, c, symmetric: bool = ...): ... +def not_between_op(a, b, c, symmetric: bool = ...): ... + +notbetween_op = not_between_op + +def in_op(a, b): ... +def not_in_op(a, b): ... + +notin_op = not_in_op + +def distinct_op(a): ... +def any_op(a): ... +def all_op(a): ... +def startswith_op(a, b, escape: Any | None = ..., autoescape: bool = ...): ... +def not_startswith_op(a, b, escape: Any | None = ..., autoescape: bool = ...): ... + +notstartswith_op = not_startswith_op + +def endswith_op(a, b, escape: Any | None = ..., autoescape: bool = ...): ... +def not_endswith_op(a, b, escape: Any | None = ..., autoescape: bool = ...): ... + +notendswith_op = not_endswith_op + +def contains_op(a, b, escape: Any | None = ..., autoescape: bool = ...): ... +def not_contains_op(a, b, escape: Any | None = ..., autoescape: bool = ...): ... + +notcontains_op = not_contains_op + +def match_op(a, b, **kw): ... +def regexp_match_op(a, b, flags: Any | None = ...): ... +def not_regexp_match_op(a, b, flags: Any | None = ...): ... +def regexp_replace_op(a, b, replacement, flags: Any | None = ...): ... +def not_match_op(a, b, **kw): ... + +notmatch_op = not_match_op + +def comma_op(a, b) -> None: ... +def filter_op(a, b) -> None: ... +def concat_op(a, b): ... +def desc_op(a): ... +def asc_op(a): ... +def nulls_first_op(a): ... + +nullsfirst_op = nulls_first_op + +def nulls_last_op(a): ... + +nullslast_op = nulls_last_op + +def json_getitem_op(a, b) -> None: ... +def json_path_getitem_op(a, b) -> None: ... +def is_comparison(op) -> bool: ... +def is_commutative(op) -> bool: ... +def is_ordering_modifier(op) -> bool: ... +def is_natural_self_precedent(op) -> bool: ... +def is_boolean(op) -> bool: ... +def mirror(op): ... +def is_associative(op) -> bool: ... +def is_precedent(operator, against) -> bool: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/roles.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/roles.pyi new file mode 100644 index 0000000..e7c290b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/roles.pyi @@ -0,0 +1,57 @@ +class SQLRole: + allows_lambda: bool + uses_inspection: bool + +class UsesInspection: + uses_inspection: bool + +class AllowsLambdaRole: + allows_lambda: bool + +class HasCacheKeyRole(SQLRole): ... +class ExecutableOptionRole(SQLRole): ... +class LiteralValueRole(SQLRole): ... +class ColumnArgumentRole(SQLRole): ... +class ColumnArgumentOrKeyRole(ColumnArgumentRole): ... +class StrAsPlainColumnRole(ColumnArgumentRole): ... +class ColumnListRole(SQLRole): ... +class TruncatedLabelRole(SQLRole): ... +class ColumnsClauseRole(AllowsLambdaRole, UsesInspection, ColumnListRole): ... +class LimitOffsetRole(SQLRole): ... +class ByOfRole(ColumnListRole): ... +class GroupByRole(AllowsLambdaRole, UsesInspection, ByOfRole): ... +class OrderByRole(AllowsLambdaRole, ByOfRole): ... +class StructuralRole(SQLRole): ... +class StatementOptionRole(StructuralRole): ... +class OnClauseRole(AllowsLambdaRole, StructuralRole): ... +class WhereHavingRole(OnClauseRole): ... +class ExpressionElementRole(SQLRole): ... +class ConstExprRole(ExpressionElementRole): ... +class LabeledColumnExprRole(ExpressionElementRole): ... +class BinaryElementRole(ExpressionElementRole): ... +class InElementRole(SQLRole): ... +class JoinTargetRole(AllowsLambdaRole, UsesInspection, StructuralRole): ... +class FromClauseRole(ColumnsClauseRole, JoinTargetRole): ... + +class StrictFromClauseRole(FromClauseRole): + @property + def description(self) -> None: ... + +class AnonymizedFromClauseRole(StrictFromClauseRole): ... +class ReturnsRowsRole(SQLRole): ... +class StatementRole(SQLRole): ... + +class SelectStatementRole(StatementRole, ReturnsRowsRole): + def subquery(self) -> None: ... + +class HasCTERole(ReturnsRowsRole): ... +class IsCTERole(SQLRole): ... +class CompoundElementRole(AllowsLambdaRole, SQLRole): ... +class DMLRole(StatementRole): ... +class DMLTableRole(FromClauseRole): ... +class DMLColumnRole(SQLRole): ... +class DMLSelectRole(SQLRole): ... +class DDLRole(StatementRole): ... +class DDLExpressionRole(StructuralRole): ... +class DDLConstraintColumnRole(SQLRole): ... +class DDLReferredColumnRole(DDLConstraintColumnRole): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi new file mode 100644 index 0000000..7ecb5c7 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi @@ -0,0 +1,377 @@ +from typing import Any + +from ..util import memoized_property +from . import visitors +from .base import DialectKWArgs, Executable, SchemaEventTarget +from .elements import ColumnClause +from .selectable import TableClause + +RETAIN_SCHEMA: Any +BLANK_SCHEMA: Any +NULL_UNSPECIFIED: Any + +class SchemaItem(SchemaEventTarget, visitors.Visitable): + __visit_name__: str + create_drop_stringify_dialect: str + @memoized_property + def info(self): ... + +class Table(DialectKWArgs, SchemaItem, TableClause): + __visit_name__: str + constraints: Any + indexes: Any + def __new__(cls, *args, **kw): ... + def __init__(self, *args, **kw) -> None: ... + @property + def foreign_key_constraints(self): ... + @property + def key(self): ... + @property + def bind(self): ... + def add_is_dependent_on(self, table) -> None: ... + def append_column(self, column, replace_existing: bool = ...) -> None: ... # type: ignore[override] + def append_constraint(self, constraint) -> None: ... + def exists(self, bind: Any | None = ...): ... + def create(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + def drop(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + def tometadata(self, metadata, schema=..., referred_schema_fn: Any | None = ..., name: Any | None = ...): ... + def to_metadata(self, metadata, schema=..., referred_schema_fn: Any | None = ..., name: Any | None = ...): ... + +class Column(DialectKWArgs, SchemaItem, ColumnClause): + __visit_name__: str + inherit_cache: bool + key: Any + primary_key: Any + nullable: Any + default: Any + server_default: Any + server_onupdate: Any + index: Any + unique: Any + system: Any + doc: Any + onupdate: Any + autoincrement: Any + constraints: Any + foreign_keys: Any + comment: Any + computed: Any + identity: Any + info: Any + def __init__(self, *args, **kwargs) -> None: ... + def references(self, column): ... + def append_foreign_key(self, fk) -> None: ... + def copy(self, **kw): ... + +class ForeignKey(DialectKWArgs, SchemaItem): + __visit_name__: str + constraint: Any + parent: Any + use_alter: Any + name: Any + onupdate: Any + ondelete: Any + deferrable: Any + initially: Any + link_to_name: Any + match: Any + info: Any + def __init__( + self, + column, + _constraint: Any | None = ..., + use_alter: bool = ..., + name: Any | None = ..., + onupdate: Any | None = ..., + ondelete: Any | None = ..., + deferrable: Any | None = ..., + initially: Any | None = ..., + link_to_name: bool = ..., + match: Any | None = ..., + info: Any | None = ..., + _unresolvable: bool = ..., + **dialect_kw, + ) -> None: ... + def copy(self, schema: Any | None = ..., **kw): ... + @property + def target_fullname(self): ... + def references(self, table): ... + def get_referent(self, table): ... + @memoized_property + def column(self): ... + +class DefaultGenerator(Executable, SchemaItem): + __visit_name__: str + is_sequence: bool + is_server_default: bool + column: Any + for_update: Any + def __init__(self, for_update: bool = ...) -> None: ... + def execute(self, bind: Any | None = ...): ... # type: ignore[override] + @property + def bind(self): ... + +class ColumnDefault(DefaultGenerator): + arg: Any + def __init__(self, arg, **kwargs) -> None: ... + @memoized_property + def is_callable(self): ... + @memoized_property + def is_clause_element(self): ... + @memoized_property + def is_scalar(self): ... + +class IdentityOptions: + start: Any + increment: Any + minvalue: Any + maxvalue: Any + nominvalue: Any + nomaxvalue: Any + cycle: Any + cache: Any + order: Any + def __init__( + self, + start: Any | None = ..., + increment: Any | None = ..., + minvalue: Any | None = ..., + maxvalue: Any | None = ..., + nominvalue: Any | None = ..., + nomaxvalue: Any | None = ..., + cycle: Any | None = ..., + cache: Any | None = ..., + order: Any | None = ..., + ) -> None: ... + +class Sequence(IdentityOptions, DefaultGenerator): + __visit_name__: str + is_sequence: bool + name: Any + optional: Any + schema: Any + metadata: Any + data_type: Any + def __init__( + self, + name, + start: Any | None = ..., + increment: Any | None = ..., + minvalue: Any | None = ..., + maxvalue: Any | None = ..., + nominvalue: Any | None = ..., + nomaxvalue: Any | None = ..., + cycle: Any | None = ..., + schema: Any | None = ..., + cache: Any | None = ..., + order: Any | None = ..., + data_type: Any | None = ..., + optional: bool = ..., + quote: Any | None = ..., + metadata: Any | None = ..., + quote_schema: Any | None = ..., + for_update: bool = ..., + ) -> None: ... + @memoized_property + def is_callable(self): ... + @memoized_property + def is_clause_element(self): ... + def next_value(self): ... + @property + def bind(self): ... + def create(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + def drop(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + +class FetchedValue(SchemaEventTarget): + is_server_default: bool + reflected: bool + has_argument: bool + is_clause_element: bool + for_update: Any + def __init__(self, for_update: bool = ...) -> None: ... + +class DefaultClause(FetchedValue): + has_argument: bool + arg: Any + reflected: Any + def __init__(self, arg, for_update: bool = ..., _reflected: bool = ...) -> None: ... + +class Constraint(DialectKWArgs, SchemaItem): + __visit_name__: str + name: Any + deferrable: Any + initially: Any + info: Any + def __init__( + self, + name: Any | None = ..., + deferrable: Any | None = ..., + initially: Any | None = ..., + _create_rule: Any | None = ..., + info: Any | None = ..., + _type_bound: bool = ..., + **dialect_kw, + ) -> None: ... + @property + def table(self): ... + def copy(self, **kw): ... + +class ColumnCollectionMixin: + columns: Any + def __init__(self, *columns, **kw) -> None: ... + +class ColumnCollectionConstraint(ColumnCollectionMixin, Constraint): + def __init__(self, *columns, **kw) -> None: ... + columns: Any + def __contains__(self, x): ... + def copy(self, target_table: Any | None = ..., **kw): ... + def contains_column(self, col): ... + def __iter__(self): ... + def __len__(self): ... + +class CheckConstraint(ColumnCollectionConstraint): + __visit_name__: str + sqltext: Any + def __init__( + self, + sqltext, + name: Any | None = ..., + deferrable: Any | None = ..., + initially: Any | None = ..., + table: Any | None = ..., + info: Any | None = ..., + _create_rule: Any | None = ..., + _autoattach: bool = ..., + _type_bound: bool = ..., + **kw, + ) -> None: ... + @property + def is_column_level(self): ... + def copy(self, target_table: Any | None = ..., **kw): ... + +class ForeignKeyConstraint(ColumnCollectionConstraint): + __visit_name__: str + onupdate: Any + ondelete: Any + link_to_name: Any + use_alter: Any + match: Any + elements: Any + def __init__( + self, + columns, + refcolumns, + name: Any | None = ..., + onupdate: Any | None = ..., + ondelete: Any | None = ..., + deferrable: Any | None = ..., + initially: Any | None = ..., + use_alter: bool = ..., + link_to_name: bool = ..., + match: Any | None = ..., + table: Any | None = ..., + info: Any | None = ..., + **dialect_kw, + ) -> None: ... + columns: Any + @property + def referred_table(self): ... + @property + def column_keys(self): ... + def copy(self, schema: Any | None = ..., target_table: Any | None = ..., **kw): ... # type: ignore[override] + +class PrimaryKeyConstraint(ColumnCollectionConstraint): + __visit_name__: str + def __init__(self, *columns, **kw) -> None: ... + @property + def columns_autoinc_first(self): ... + +class UniqueConstraint(ColumnCollectionConstraint): + __visit_name__: str + +class Index(DialectKWArgs, ColumnCollectionMixin, SchemaItem): + __visit_name__: str + table: Any + name: Any + unique: Any + info: Any + expressions: Any + def __init__(self, name, *expressions, **kw) -> None: ... + @property + def bind(self): ... + def create(self, bind: Any | None = ..., checkfirst: bool = ...): ... + def drop(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + +DEFAULT_NAMING_CONVENTION: Any + +class MetaData(SchemaItem): + __visit_name__: str + tables: Any + schema: Any + naming_convention: Any + info: Any + def __init__( + self, + bind: Any | None = ..., + schema: Any | None = ..., + quote_schema: Any | None = ..., + naming_convention: Any | None = ..., + info: Any | None = ..., + ) -> None: ... + def __contains__(self, table_or_key): ... + def is_bound(self): ... + bind: Any + def clear(self) -> None: ... + def remove(self, table) -> None: ... + @property + def sorted_tables(self): ... + def reflect( + self, + bind: Any | None = ..., + schema: Any | None = ..., + views: bool = ..., + only: Any | None = ..., + extend_existing: bool = ..., + autoload_replace: bool = ..., + resolve_fks: bool = ..., + **dialect_kwargs, + ) -> None: ... + def create_all(self, bind: Any | None = ..., tables: Any | None = ..., checkfirst: bool = ...) -> None: ... + def drop_all(self, bind: Any | None = ..., tables: Any | None = ..., checkfirst: bool = ...) -> None: ... + +class ThreadLocalMetaData(MetaData): + __visit_name__: str + context: Any + def __init__(self) -> None: ... + bind: Any + def is_bound(self): ... + def dispose(self) -> None: ... + +class Computed(FetchedValue, SchemaItem): + __visit_name__: str + sqltext: Any + persisted: Any + column: Any + def __init__(self, sqltext, persisted: Any | None = ...) -> None: ... + def copy(self, target_table: Any | None = ..., **kw): ... + +class Identity(IdentityOptions, FetchedValue, SchemaItem): + __visit_name__: str + always: Any + on_null: Any + column: Any + def __init__( + self, + always: bool = ..., + on_null: Any | None = ..., + start: Any | None = ..., + increment: Any | None = ..., + minvalue: Any | None = ..., + maxvalue: Any | None = ..., + nominvalue: Any | None = ..., + nomaxvalue: Any | None = ..., + cycle: Any | None = ..., + cache: Any | None = ..., + order: Any | None = ..., + ) -> None: ... + def copy(self, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi new file mode 100644 index 0000000..892c532 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi @@ -0,0 +1,419 @@ +from _typeshed import Self +from typing import Any + +from .. import util +from ..util import HasMemoized, memoized_property +from . import roles, traversals, visitors +from .annotation import Annotated, SupportsCloneAnnotations +from .base import CacheableOptions, CompileState, Executable, Generative, HasCompileState, Immutable +from .elements import ( + BindParameter as BindParameter, + BooleanClauseList as BooleanClauseList, + ClauseElement as ClauseElement, + ClauseList as ClauseList, + ColumnClause as ColumnClause, + GroupedElement as GroupedElement, + Grouping as Grouping, + TableValuedColumn as TableValuedColumn, + UnaryExpression as UnaryExpression, + literal_column as literal_column, +) + +class _OffsetLimitParam(BindParameter[Any]): + inherit_cache: bool + +def subquery(alias, *args, **kwargs): ... + +class ReturnsRows(roles.ReturnsRowsRole, ClauseElement): + @property + def selectable(self): ... + @property + def exported_columns(self) -> None: ... + +class Selectable(ReturnsRows): + __visit_name__: str + is_selectable: bool + def lateral(self, name: Any | None = ...): ... + def replace_selectable(self, old, alias): ... + def corresponding_column(self, column, require_embedded: bool = ...): ... + +class HasPrefixes: + def prefix_with(self: Self, *expr, **kw) -> Self: ... + +class HasSuffixes: + def suffix_with(self: Self, *expr, **kw) -> Self: ... + +class HasHints: + def with_statement_hint(self, text, dialect_name: str = ...): ... + def with_hint(self: Self, selectable, text: str, dialect_name: str = ...) -> Self: ... + +class FromClause(roles.AnonymizedFromClauseRole, Selectable): + __visit_name__: str + named_with_column: bool + schema: Any + is_selectable: bool + def select(self, whereclause: Any | None = ..., **kwargs): ... + def join(self, right, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...): ... + def outerjoin(self, right, onclause: Any | None = ..., full: bool = ...): ... + def alias(self, name: Any | None = ..., flat: bool = ...): ... + def table_valued(self): ... + def tablesample(self, sampling, name: Any | None = ..., seed: Any | None = ...): ... + def is_derived_from(self, fromclause): ... + @property + def description(self): ... + @property + def exported_columns(self): ... + @memoized_property + def columns(self): ... + @property + def entity_namespace(self): ... + @memoized_property + def primary_key(self): ... + @memoized_property + def foreign_keys(self): ... + @property + def c(self): ... + +LABEL_STYLE_NONE: Any +LABEL_STYLE_TABLENAME_PLUS_COL: Any +LABEL_STYLE_DISAMBIGUATE_ONLY: Any +LABEL_STYLE_DEFAULT: Any + +class Join(roles.DMLTableRole, FromClause): + __visit_name__: str + left: Any + right: Any + onclause: Any + isouter: Any + full: Any + def __init__(self, left, right, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> None: ... + @property + def description(self): ... + def is_derived_from(self, fromclause): ... + def self_group(self, against: Any | None = ...): ... + def select(self, whereclause: Any | None = ..., **kwargs): ... + @property + def bind(self): ... + def alias(self, name: Any | None = ..., flat: bool = ...): ... + +class NoInit: + def __init__(self, *arg, **kw) -> None: ... + +class AliasedReturnsRows(NoInit, FromClause): + named_with_column: bool + @property + def description(self): ... + @property + def original(self): ... + def is_derived_from(self, fromclause): ... + @property + def bind(self): ... + +class Alias(roles.DMLTableRole, AliasedReturnsRows): + __visit_name__: str + inherit_cache: bool + +class TableValuedAlias(Alias): + __visit_name__: str + @HasMemoized.memoized_attribute + def column(self): ... + def alias(self, name: Any | None = ...): ... # type: ignore[override] + def lateral(self, name: Any | None = ...): ... + def render_derived(self, name: Any | None = ..., with_types: bool = ...): ... + +class Lateral(AliasedReturnsRows): + __visit_name__: str + inherit_cache: bool + +class TableSample(AliasedReturnsRows): + __visit_name__: str + +class CTE(roles.DMLTableRole, roles.IsCTERole, Generative, HasPrefixes, HasSuffixes, AliasedReturnsRows): + __visit_name__: str + def alias(self, name: Any | None = ..., flat: bool = ...): ... + def union(self, *other): ... + def union_all(self, *other): ... + +class HasCTE(roles.HasCTERole): + def add_cte(self, cte) -> None: ... + def cte(self, name: Any | None = ..., recursive: bool = ..., nesting: bool = ...): ... + +class Subquery(AliasedReturnsRows): + __visit_name__: str + inherit_cache: bool + def as_scalar(self): ... + +class FromGrouping(GroupedElement, FromClause): + element: Any + def __init__(self, element) -> None: ... + @property + def columns(self): ... + @property + def primary_key(self): ... + @property + def foreign_keys(self): ... + def is_derived_from(self, element): ... + def alias(self, **kw): ... + +class TableClause(roles.DMLTableRole, Immutable, FromClause): + __visit_name__: str + named_with_column: bool + implicit_returning: bool + name: Any + primary_key: Any + foreign_keys: Any + schema: Any + fullname: Any + def __init__(self, name, *columns, **kw) -> None: ... + @memoized_property + def description(self): ... + def append_column(self, c, **kw) -> None: ... + def insert(self, values: Any | None = ..., inline: bool = ..., **kwargs): ... + def update(self, whereclause: Any | None = ..., values: Any | None = ..., inline: bool = ..., **kwargs): ... + def delete(self, whereclause: Any | None = ..., **kwargs): ... + +class ForUpdateArg(ClauseElement): + def __eq__(self, other): ... + def __ne__(self, other): ... + def __hash__(self): ... + nowait: Any + read: Any + skip_locked: Any + key_share: Any + of: Any + def __init__( + self, nowait: bool = ..., read: bool = ..., of: Any | None = ..., skip_locked: bool = ..., key_share: bool = ... + ) -> None: ... + +class Values(Generative, FromClause): + named_with_column: bool + __visit_name__: str + name: Any + literal_binds: Any + def __init__(self, *columns, **kw) -> None: ... + def alias(self: Self, name: Any | None, **kw) -> Self: ... # type: ignore[override] + def lateral(self: Self, name: Any | None = ...) -> Self: ... + def data(self: Self, values) -> Self: ... + +class SelectBase( + roles.SelectStatementRole, + roles.DMLSelectRole, + roles.CompoundElementRole, + roles.InElementRole, + HasCTE, + Executable, + SupportsCloneAnnotations, + Selectable, +): + is_select: bool + @property + def selected_columns(self) -> None: ... + @property + def exported_columns(self): ... + @property + def c(self): ... + @property + def columns(self): ... + def select(self, *arg, **kw): ... + def as_scalar(self): ... + def exists(self): ... + def scalar_subquery(self): ... + def label(self, name): ... + def lateral(self, name: Any | None = ...): ... + def subquery(self, name: Any | None = ...): ... + def alias(self, name: Any | None = ..., flat: bool = ...): ... + +class SelectStatementGrouping(GroupedElement, SelectBase): + __visit_name__: str + element: Any + def __init__(self, element) -> None: ... + def get_label_style(self): ... + def set_label_style(self, label_style): ... + @property + def select_statement(self): ... + def self_group(self, against: Any | None = ...): ... + @property + def selected_columns(self): ... + +class DeprecatedSelectBaseGenerations: + def append_order_by(self, *clauses) -> None: ... + def append_group_by(self, *clauses) -> None: ... + +class GenerativeSelect(DeprecatedSelectBaseGenerations, SelectBase): + def __init__( + self, + _label_style=..., + use_labels: bool = ..., + limit: Any | None = ..., + offset: Any | None = ..., + order_by: Any | None = ..., + group_by: Any | None = ..., + bind: Any | None = ..., + ) -> None: ... + def with_for_update( + self: Self, nowait: bool = ..., read: bool = ..., of: Any | None = ..., skip_locked: bool = ..., key_share: bool = ... + ) -> Self: ... + def get_label_style(self): ... + def set_label_style(self, style): ... + def apply_labels(self): ... + def limit(self: Self, limit: Any | None) -> Self: ... + def fetch(self: Self, count: Any | None, with_ties: bool = ..., percent: bool = ...) -> Self: ... + def offset(self: Self, offset: Any | None) -> Self: ... + def slice(self: Self, start: Any | None, stop: Any | None) -> Self: ... + def order_by(self: Self, *clauses) -> Self: ... + def group_by(self: Self, *clauses) -> Self: ... + +class CompoundSelectState(CompileState): ... + +class CompoundSelect(HasCompileState, GenerativeSelect): + __visit_name__: str + UNION: Any + UNION_ALL: Any + EXCEPT: Any + EXCEPT_ALL: Any + INTERSECT: Any + INTERSECT_ALL: Any + keyword: Any + selects: Any + def __init__(self, keyword, *selects, **kwargs) -> None: ... + def self_group(self, against: Any | None = ...): ... + def is_derived_from(self, fromclause): ... + @property + def selected_columns(self): ... + @property + def bind(self): ... + @bind.setter + def bind(self, bind) -> None: ... + +class DeprecatedSelectGenerations: + def append_correlation(self, fromclause) -> None: ... + def append_column(self, column) -> None: ... + def append_prefix(self, clause) -> None: ... + def append_whereclause(self, whereclause) -> None: ... + def append_having(self, having) -> None: ... + def append_from(self, fromclause) -> None: ... + +class SelectState(util.MemoizedSlots, CompileState): + class default_select_compile_options(CacheableOptions): ... + statement: Any + from_clauses: Any + froms: Any + columns_plus_names: Any + def __init__(self, statement, compiler, **kw) -> None: ... + @classmethod + def get_column_descriptions(cls, statement) -> None: ... + @classmethod + def from_statement(cls, statement, from_statement) -> None: ... + @classmethod + def get_columns_clause_froms(cls, statement): ... + @classmethod + def determine_last_joined_entity(cls, stmt): ... + @classmethod + def all_selected_columns(cls, statement): ... + +class _SelectFromElements: ... + +class _MemoizedSelectEntities(traversals.HasCacheKey, traversals.HasCopyInternals, visitors.Traversible): + __visit_name__: str + +class Select( + HasPrefixes, HasSuffixes, HasHints, HasCompileState, DeprecatedSelectGenerations, _SelectFromElements, GenerativeSelect +): + __visit_name__: str + @classmethod + def create_legacy_select( + cls, + columns: Any | None = ..., + whereclause: Any | None = ..., + from_obj: Any | None = ..., + distinct: bool = ..., + having: Any | None = ..., + correlate: bool = ..., + prefixes: Any | None = ..., + suffixes: Any | None = ..., + **kwargs, + ): ... + def __init__(self) -> None: ... + def filter(self, *criteria): ... + def filter_by(self, **kwargs): ... + @property + def column_descriptions(self): ... + def from_statement(self, statement): ... + def join(self: Self, target, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ... + def outerjoin_from(self, from_, target, onclause: Any | None = ..., full: bool = ...): ... + def join_from(self: Self, from_, target, onclause: Any | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ... + def outerjoin(self, target, onclause: Any | None = ..., full: bool = ...): ... + def get_final_froms(self): ... + @property + def froms(self): ... + @property + def columns_clause_froms(self): ... + @property + def inner_columns(self): ... + def is_derived_from(self, fromclause): ... + def get_children(self, **kwargs): ... + def add_columns(self: Self, *columns) -> Self: ... + def column(self, column): ... + def reduce_columns(self, only_synonyms: bool = ...): ... + def with_only_columns(self: Self, *columns, **kw) -> Self: ... + @property + def whereclause(self): ... + def where(self: Self, *whereclause) -> Self: ... + def having(self: Self, having) -> Self: ... + def distinct(self: Self, *expr) -> Self: ... + def select_from(self: Self, *froms) -> Self: ... + def correlate(self: Self, *fromclauses) -> Self: ... + def correlate_except(self: Self, *fromclauses) -> Self: ... + @HasMemoized.memoized_attribute + def selected_columns(self): ... + def self_group(self, against: Any | None = ...): ... + def union(self, *other, **kwargs): ... + def union_all(self, *other, **kwargs): ... + def except_(self, *other, **kwargs): ... + def except_all(self, *other, **kwargs): ... + def intersect(self, *other, **kwargs): ... + def intersect_all(self, *other, **kwargs): ... + @property + def bind(self): ... + @bind.setter + def bind(self, bind) -> None: ... + +class ScalarSelect(roles.InElementRole, Generative, Grouping): + inherit_cache: bool + element: Any + type: Any + def __init__(self, element) -> None: ... + @property + def columns(self) -> None: ... + @property + def c(self): ... + def where(self: Self, crit) -> Self: ... + def self_group(self, **kwargs): ... + def correlate(self: Self, *fromclauses) -> Self: ... + def correlate_except(self: Self, *fromclauses) -> Self: ... + +class Exists(UnaryExpression): + inherit_cache: bool + def __init__(self, *args, **kwargs) -> None: ... + def select(self, whereclause: Any | None = ..., **kwargs): ... + def correlate(self, *fromclause): ... + def correlate_except(self, *fromclause): ... + def select_from(self, *froms): ... + def where(self, *clause): ... + +class TextualSelect(SelectBase): + __visit_name__: str + is_text: bool + is_select: bool + element: Any + column_args: Any + positional: Any + def __init__(self, text, columns, positional: bool = ...) -> None: ... + @HasMemoized.memoized_attribute + def selected_columns(self): ... + def bindparams(self: Self, *binds, **bind_as_values) -> Self: ... + +TextAsFrom = TextualSelect + +class AnnotatedFromClause(Annotated): + def __init__(self, element, values) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi new file mode 100644 index 0000000..e45932c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi @@ -0,0 +1,365 @@ +from typing import Any, Generic, TypeVar + +from .base import SchemaEventTarget +from .operators import ColumnOperators +from .traversals import HasCacheKey +from .type_api import ( + Emulated as Emulated, + NativeForEmulated as NativeForEmulated, + TypeDecorator as TypeDecorator, + TypeEngine as TypeEngine, + Variant as Variant, + to_instance as to_instance, +) + +_T = TypeVar("_T") + +class _LookupExpressionAdapter: + class Comparator(TypeEngine.Comparator[Any]): ... + comparator_factory: Any + +class Concatenable: + class Comparator(TypeEngine.Comparator[_T], Generic[_T]): ... + comparator_factory: Any + +class Indexable: + class Comparator(TypeEngine.Comparator[_T], Generic[_T]): + def __getitem__(self, index) -> ColumnOperators[_T]: ... + comparator_factory: Any + +class String(Concatenable, TypeEngine): + __visit_name__: str + RETURNS_UNICODE: Any + RETURNS_BYTES: Any + RETURNS_CONDITIONAL: Any + RETURNS_UNKNOWN: Any + length: Any + collation: Any + def __init__( + self, + length: Any | None = ..., + collation: Any | None = ..., + convert_unicode: bool = ..., + unicode_error: Any | None = ..., + _warn_on_bytestring: bool = ..., + _expect_unicode: bool = ..., + ) -> None: ... + def literal_processor(self, dialect): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + @property + def python_type(self): ... + def get_dbapi_type(self, dbapi): ... + +class Text(String): + __visit_name__: str + +class Unicode(String): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class UnicodeText(Text): + __visit_name__: str + def __init__(self, length: Any | None = ..., **kwargs) -> None: ... + +class Integer(_LookupExpressionAdapter, TypeEngine): + __visit_name__: str + def get_dbapi_type(self, dbapi): ... + @property + def python_type(self): ... + def literal_processor(self, dialect): ... + +class SmallInteger(Integer): + __visit_name__: str + +class BigInteger(Integer): + __visit_name__: str + +class Numeric(_LookupExpressionAdapter, TypeEngine): + __visit_name__: str + precision: Any + scale: Any + decimal_return_scale: Any + asdecimal: Any + def __init__( + self, precision: Any | None = ..., scale: Any | None = ..., decimal_return_scale: Any | None = ..., asdecimal: bool = ... + ) -> None: ... + def get_dbapi_type(self, dbapi): ... + def literal_processor(self, dialect): ... + @property + def python_type(self): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class Float(Numeric): + __visit_name__: str + scale: Any + precision: Any + asdecimal: Any + decimal_return_scale: Any + def __init__(self, precision: Any | None = ..., asdecimal: bool = ..., decimal_return_scale: Any | None = ...) -> None: ... + def result_processor(self, dialect, coltype): ... + +class DateTime(_LookupExpressionAdapter, TypeEngine): + __visit_name__: str + timezone: Any + def __init__(self, timezone: bool = ...) -> None: ... + def get_dbapi_type(self, dbapi): ... + @property + def python_type(self): ... + +class Date(_LookupExpressionAdapter, TypeEngine): + __visit_name__: str + def get_dbapi_type(self, dbapi): ... + @property + def python_type(self): ... + +class Time(_LookupExpressionAdapter, TypeEngine): + __visit_name__: str + timezone: Any + def __init__(self, timezone: bool = ...) -> None: ... + def get_dbapi_type(self, dbapi): ... + @property + def python_type(self): ... + +class _Binary(TypeEngine): + length: Any + def __init__(self, length: Any | None = ...) -> None: ... + def literal_processor(self, dialect): ... + @property + def python_type(self): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + def coerce_compared_value(self, op, value): ... + def get_dbapi_type(self, dbapi): ... + +class LargeBinary(_Binary): + __visit_name__: str + def __init__(self, length: Any | None = ...) -> None: ... + +class SchemaType(SchemaEventTarget): + name: Any + schema: Any + metadata: Any + inherit_schema: Any + def __init__( + self, + name: Any | None = ..., + schema: Any | None = ..., + metadata: Any | None = ..., + inherit_schema: bool = ..., + quote: Any | None = ..., + _create_events: bool = ..., + ) -> None: ... + def copy(self, **kw): ... + def adapt(self, impltype, **kw): ... + @property + def bind(self): ... + def create(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + def drop(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ... + +class Enum(Emulated, String, SchemaType): + __visit_name__: str + def __init__(self, *enums, **kw) -> None: ... + @property + def sort_key_function(self): ... + @property + def native(self): ... + + class Comparator(Concatenable.Comparator[Any]): ... + comparator_factory: Any + def as_generic(self, allow_nulltype: bool = ...): ... + def adapt_to_emulated(self, impltype, **kw): ... + def adapt(self, impltype, **kw): ... + def literal_processor(self, dialect): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + def copy(self, **kw): ... + @property + def python_type(self): ... + +class PickleType(TypeDecorator): + impl: Any + cache_ok: bool + protocol: Any + pickler: Any + comparator: Any + def __init__(self, protocol=..., pickler: Any | None = ..., comparator: Any | None = ..., impl: Any | None = ...) -> None: ... + def __reduce__(self): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + def compare_values(self, x, y): ... + +class Boolean(Emulated, TypeEngine, SchemaType): # type: ignore[misc] + __visit_name__: str + native: bool + create_constraint: Any + name: Any + def __init__(self, create_constraint: bool = ..., name: Any | None = ..., _create_events: bool = ...) -> None: ... + @property + def python_type(self): ... + def literal_processor(self, dialect): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class _AbstractInterval(_LookupExpressionAdapter, TypeEngine): + def coerce_compared_value(self, op, value): ... + +class Interval(Emulated, _AbstractInterval, TypeDecorator): # type: ignore[misc] + impl: Any + epoch: Any + cache_ok: bool + native: Any + second_precision: Any + day_precision: Any + def __init__(self, native: bool = ..., second_precision: Any | None = ..., day_precision: Any | None = ...) -> None: ... + @property + def python_type(self): ... + def adapt_to_emulated(self, impltype, **kw): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class JSON(Indexable, TypeEngine): + __visit_name__: str + hashable: bool + NULL: Any + none_as_null: Any + def __init__(self, none_as_null: bool = ...) -> None: ... + + class JSONElementType(TypeEngine): + def string_bind_processor(self, dialect): ... + def string_literal_processor(self, dialect): ... + def bind_processor(self, dialect): ... + def literal_processor(self, dialect): ... + + class JSONIndexType(JSONElementType): ... + class JSONIntIndexType(JSONIndexType): ... + class JSONStrIndexType(JSONIndexType): ... + class JSONPathType(JSONElementType): ... + + class Comparator(Indexable.Comparator[Any], Concatenable.Comparator[Any]): + def as_boolean(self): ... + def as_string(self): ... + def as_integer(self): ... + def as_float(self): ... + def as_numeric(self, precision, scale, asdecimal: bool = ...): ... + def as_json(self): ... + comparator_factory: Any + @property + def python_type(self): ... + @property # type: ignore[override] + def should_evaluate_none(self): ... + @should_evaluate_none.setter + def should_evaluate_none(self, value) -> None: ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + +class ARRAY(SchemaEventTarget, Indexable, Concatenable, TypeEngine): + __visit_name__: str + zero_indexes: bool + + class Comparator(Indexable.Comparator[_T], Concatenable.Comparator[_T], Generic[_T]): + def contains(self, *arg, **kw) -> ColumnOperators[_T]: ... + def any(self, other, operator: Any | None = ...): ... + def all(self, other, operator: Any | None = ...): ... + comparator_factory: Any + item_type: Any + as_tuple: Any + dimensions: Any + def __init__(self, item_type, as_tuple: bool = ..., dimensions: Any | None = ..., zero_indexes: bool = ...) -> None: ... + @property + def hashable(self): ... + @property + def python_type(self): ... + def compare_values(self, x, y): ... + +class TupleType(TypeEngine): + types: Any + def __init__(self, *types) -> None: ... + def result_processor(self, dialect, coltype) -> None: ... + +class REAL(Float): + __visit_name__: str + +class FLOAT(Float): + __visit_name__: str + +class NUMERIC(Numeric): + __visit_name__: str + +class DECIMAL(Numeric): + __visit_name__: str + +class INTEGER(Integer): + __visit_name__: str + +INT = INTEGER + +class SMALLINT(SmallInteger): + __visit_name__: str + +class BIGINT(BigInteger): + __visit_name__: str + +class TIMESTAMP(DateTime): + __visit_name__: str + def __init__(self, timezone: bool = ...) -> None: ... + def get_dbapi_type(self, dbapi): ... + +class DATETIME(DateTime): + __visit_name__: str + +class DATE(Date): + __visit_name__: str + +class TIME(Time): + __visit_name__: str + +class TEXT(Text): + __visit_name__: str + +class CLOB(Text): + __visit_name__: str + +class VARCHAR(String): + __visit_name__: str + +class NVARCHAR(Unicode): + __visit_name__: str + +class CHAR(String): + __visit_name__: str + +class NCHAR(Unicode): + __visit_name__: str + +class BLOB(LargeBinary): + __visit_name__: str + +class BINARY(_Binary): + __visit_name__: str + +class VARBINARY(_Binary): + __visit_name__: str + +class BOOLEAN(Boolean): + __visit_name__: str + +class NullType(TypeEngine): + __visit_name__: str + def literal_processor(self, dialect): ... + + class Comparator(TypeEngine.Comparator[Any]): ... + comparator_factory: Any + +class TableValueType(HasCacheKey, TypeEngine): + def __init__(self, *elements) -> None: ... + +class MatchType(Boolean): ... + +NULLTYPE: Any +BOOLEANTYPE: Any +STRINGTYPE: Any +INTEGERTYPE: Any +MATCHTYPE: Any +TABLEVALUE: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/traversals.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/traversals.pyi new file mode 100644 index 0000000..4ce0715 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/traversals.pyi @@ -0,0 +1,158 @@ +from typing import Any + +from .. import util +from ..util import HasMemoized +from .visitors import ExtendedInternalTraversal, InternalTraversal + +SKIP_TRAVERSE: Any +COMPARE_FAILED: bool +COMPARE_SUCCEEDED: bool +NO_CACHE: Any +CACHE_IN_PLACE: Any +CALL_GEN_CACHE_KEY: Any +STATIC_CACHE_KEY: Any +PROPAGATE_ATTRS: Any +ANON_NAME: Any + +def compare(obj1, obj2, **kw): ... + +class HasCacheKey: + inherit_cache: Any + +class MemoizedHasCacheKey(HasCacheKey, HasMemoized): ... + +class CacheKey: + def __hash__(self): ... + def to_offline_string(self, statement_cache, statement, parameters): ... + def __eq__(self, other): ... + +class _CacheKey(ExtendedInternalTraversal): + visit_has_cache_key: Any + visit_clauseelement: Any + visit_clauseelement_list: Any + visit_annotations_key: Any + visit_clauseelement_tuple: Any + visit_memoized_select_entities: Any + visit_string: Any + visit_boolean: Any + visit_operator: Any + visit_plain_obj: Any + visit_statement_hint_list: Any + visit_type: Any + visit_anon_name: Any + visit_propagate_attrs: Any + def visit_with_context_options(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_inspectable(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_string_list(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_multi(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_multi_list(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_has_cache_key_tuples(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_has_cache_key_list(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_executable_options(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_inspectable_list(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_clauseelement_tuples(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_fromclause_ordered_set(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_clauseelement_unordered_set(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_named_ddl_element(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_prefix_sequence(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_setup_join_tuple(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_table_hint_list(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_plain_dict(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_dialect_options(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_string_clauseelement_dict(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_string_multi_dict(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_fromclause_canonical_column_collection(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_unknown_structure(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_dml_ordered_values(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_dml_values(self, attrname, obj, parent, anon_map, bindparams): ... + def visit_dml_multi_values(self, attrname, obj, parent, anon_map, bindparams): ... + +class HasCopyInternals: ... + +class _CopyInternals(InternalTraversal): + def visit_clauseelement(self, attrname, parent, element, clone=..., **kw): ... + def visit_clauseelement_list(self, attrname, parent, element, clone=..., **kw): ... + def visit_clauseelement_tuple(self, attrname, parent, element, clone=..., **kw): ... + def visit_executable_options(self, attrname, parent, element, clone=..., **kw): ... + def visit_clauseelement_unordered_set(self, attrname, parent, element, clone=..., **kw): ... + def visit_clauseelement_tuples(self, attrname, parent, element, clone=..., **kw): ... + def visit_string_clauseelement_dict(self, attrname, parent, element, clone=..., **kw): ... + def visit_setup_join_tuple(self, attrname, parent, element, clone=..., **kw): ... + def visit_memoized_select_entities(self, attrname, parent, element, **kw): ... + def visit_dml_ordered_values(self, attrname, parent, element, clone=..., **kw): ... + def visit_dml_values(self, attrname, parent, element, clone=..., **kw): ... + def visit_dml_multi_values(self, attrname, parent, element, clone=..., **kw): ... + def visit_propagate_attrs(self, attrname, parent, element, clone=..., **kw): ... + +class _GetChildren(InternalTraversal): + def visit_has_cache_key(self, element, **kw): ... + def visit_clauseelement(self, element, **kw): ... + def visit_clauseelement_list(self, element, **kw): ... + def visit_clauseelement_tuple(self, element, **kw): ... + def visit_clauseelement_tuples(self, element, **kw): ... + def visit_fromclause_canonical_column_collection(self, element, **kw): ... + def visit_string_clauseelement_dict(self, element, **kw): ... + def visit_fromclause_ordered_set(self, element, **kw): ... + def visit_clauseelement_unordered_set(self, element, **kw): ... + def visit_setup_join_tuple(self, element, **kw) -> None: ... + def visit_memoized_select_entities(self, element, **kw): ... + def visit_dml_ordered_values(self, element, **kw) -> None: ... + def visit_dml_values(self, element, **kw) -> None: ... + def visit_dml_multi_values(self, element, **kw): ... + def visit_propagate_attrs(self, element, **kw): ... + +class anon_map(dict[Any, Any]): + index: int + def __init__(self) -> None: ... + def __missing__(self, key): ... + +class TraversalComparatorStrategy(InternalTraversal, util.MemoizedSlots): + stack: Any + cache: Any + anon_map: Any + def __init__(self) -> None: ... + def compare(self, obj1, obj2, **kw): ... + def compare_inner(self, obj1, obj2, **kw): ... + def visit_has_cache_key(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_propagate_attrs(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_has_cache_key_list(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_executable_options(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_clauseelement(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_fromclause_canonical_column_collection(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_fromclause_derived_column_collection(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_string_clauseelement_dict(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_clauseelement_tuples(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_clauseelement_list(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_clauseelement_tuple(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_clauseelement_unordered_set(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_fromclause_ordered_set(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_string(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_string_list(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_anon_name(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_boolean(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_operator(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_type(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_plain_dict(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_dialect_options(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_annotations_key(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_with_context_options(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_plain_obj(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_named_ddl_element(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_prefix_sequence(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_setup_join_tuple(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_memoized_select_entities(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_table_hint_list(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_statement_hint_list(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_unknown_structure(self, attrname, left_parent, left, right_parent, right, **kw) -> None: ... + def visit_dml_ordered_values(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_dml_values(self, attrname, left_parent, left, right_parent, right, **kw): ... + def visit_dml_multi_values(self, attrname, left_parent, left, right_parent, right, **kw): ... + def compare_clauselist(self, left, right, **kw): ... + def compare_binary(self, left, right, **kw): ... + def compare_bindparam(self, left, right, **kw): ... + +class ColIdentityComparatorStrategy(TraversalComparatorStrategy): + def compare_column_element(self, left, right, use_proxies: bool = ..., equivalents=..., **kw): ... + def compare_column(self, left, right, **kw): ... + def compare_label(self, left, right, **kw): ... + def compare_table(self, left, right, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi new file mode 100644 index 0000000..93d73af --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi @@ -0,0 +1,114 @@ +from typing import Any, Generic, TypeVar + +from .. import util +from . import operators +from .base import SchemaEventTarget +from .visitors import Traversible, TraversibleType + +_T = TypeVar("_T") + +BOOLEANTYPE: Any +INTEGERTYPE: Any +NULLTYPE: Any +STRINGTYPE: Any +MATCHTYPE: Any +INDEXABLE: Any +TABLEVALUE: Any + +class TypeEngine(Traversible): + class Comparator(operators.ColumnOperators[_T], Generic[_T]): + default_comparator: Any + def __clause_element__(self): ... + expr: Any + type: Any + def __init__(self, expr) -> None: ... + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... + def __reduce__(self): ... + hashable: bool + comparator_factory: Any + sort_key_function: Any + should_evaluate_none: bool + def evaluates_none(self): ... + def copy(self, **kw): ... + def compare_against_backend(self, dialect, conn_type) -> None: ... + def copy_value(self, value): ... + def literal_processor(self, dialect) -> None: ... + def bind_processor(self, dialect) -> None: ... + def result_processor(self, dialect, coltype) -> None: ... + def column_expression(self, colexpr) -> None: ... + def bind_expression(self, bindvalue) -> None: ... + def compare_values(self, x, y): ... + def get_dbapi_type(self, dbapi) -> None: ... + @property + def python_type(self) -> None: ... + def with_variant(self, type_, dialect_name): ... + def as_generic(self, allow_nulltype: bool = ...): ... + def dialect_impl(self, dialect): ... + def adapt(self, cls, **kw): ... + def coerce_compared_value(self, op, value): ... + def compile(self, dialect: Any | None = ...): ... + +class VisitableCheckKWArg(util.EnsureKWArgType, TraversibleType): ... + +class ExternalType: + cache_ok: Any + +class UserDefinedType: + __visit_name__: str + ensure_kwarg: str + def coerce_compared_value(self, op, value): ... + +class Emulated: + def adapt_to_emulated(self, impltype, **kw): ... + def adapt(self, impltype, **kw): ... + +class NativeForEmulated: + @classmethod + def adapt_native_to_emulated(cls, impl, **kw): ... + @classmethod + def adapt_emulated_to_native(cls, impl, **kw): ... + +class TypeDecorator(ExternalType, SchemaEventTarget, TypeEngine): + __visit_name__: str + impl: Any + def __init__(self, *args, **kwargs) -> None: ... + coerce_to_is_types: Any + + class Comparator(TypeEngine.Comparator[Any]): + def operate(self, op, *other, **kwargs): ... + def reverse_operate(self, op, other, **kwargs): ... + + @property + def comparator_factory(self): ... + def type_engine(self, dialect): ... + def load_dialect_impl(self, dialect): ... + def __getattr__(self, key): ... + def process_literal_param(self, value, dialect) -> None: ... + def process_bind_param(self, value, dialect) -> None: ... + def process_result_value(self, value, dialect) -> None: ... + def literal_processor(self, dialect): ... + def bind_processor(self, dialect): ... + def result_processor(self, dialect, coltype): ... + def bind_expression(self, bindparam): ... + def column_expression(self, column): ... + def coerce_compared_value(self, op, value): ... + def copy(self, **kw): ... + def get_dbapi_type(self, dbapi): ... + def compare_values(self, x, y): ... + @property + def sort_key_function(self): ... + +class Variant(TypeDecorator): + cache_ok: bool + impl: Any + mapping: Any + def __init__(self, base, mapping) -> None: ... + def coerce_compared_value(self, operator, value): ... + def load_dialect_impl(self, dialect): ... + def with_variant(self, type_, dialect_name): ... + @property + def comparator_factory(self): ... + +def to_instance(typeobj, *arg, **kw): ... +def adapt_type(typeobj, colspecs): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/util.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/util.pyi new file mode 100644 index 0000000..78dd799 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/util.pyi @@ -0,0 +1,103 @@ +from typing import Any + +from . import visitors + +join_condition: Any + +def find_join_source(clauses, join_to): ... +def find_left_clause_that_matches_given(clauses, join_from): ... +def find_left_clause_to_join_from(clauses, join_to, onclause): ... +def visit_binary_product(fn, expr) -> None: ... +def find_tables( + clause, + check_columns: bool = ..., + include_aliases: bool = ..., + include_joins: bool = ..., + include_selects: bool = ..., + include_crud: bool = ..., +): ... +def unwrap_order_by(clause): ... +def unwrap_label_reference(element): ... +def expand_column_list_from_order_by(collist, order_by): ... +def clause_is_present(clause, search): ... +def tables_from_leftmost(clause) -> None: ... +def surface_selectables(clause) -> None: ... +def surface_selectables_only(clause) -> None: ... +def extract_first_column_annotation(column, annotation_name): ... +def selectables_overlap(left, right): ... +def bind_values(clause): ... + +class _repr_base: + max_chars: Any + def trunc(self, value): ... + +class _repr_row(_repr_base): + row: Any + max_chars: Any + def __init__(self, row, max_chars: int = ...) -> None: ... + +class _repr_params(_repr_base): + params: Any + ismulti: Any + batches: Any + max_chars: Any + def __init__(self, params, batches, max_chars: int = ..., ismulti: Any | None = ...) -> None: ... + +def adapt_criterion_to_null(crit, nulls): ... +def splice_joins(left, right, stop_on: Any | None = ...): ... +def reduce_columns(columns, *clauses, **kw): ... +def criterion_as_pairs( + expression, + consider_as_foreign_keys: Any | None = ..., + consider_as_referenced_keys: Any | None = ..., + any_operator: bool = ..., +): ... + +class ClauseAdapter(visitors.ReplacingExternalTraversal): + __traverse_options__: Any + selectable: Any + include_fn: Any + exclude_fn: Any + equivalents: Any + adapt_on_names: Any + adapt_from_selectables: Any + def __init__( + self, + selectable, + equivalents: Any | None = ..., + include_fn: Any | None = ..., + exclude_fn: Any | None = ..., + adapt_on_names: bool = ..., + anonymize_labels: bool = ..., + adapt_from_selectables: Any | None = ..., + ) -> None: ... + def replace(self, col, _include_singleton_constants: bool = ...): ... + +class ColumnAdapter(ClauseAdapter): + columns: Any + adapt_required: Any + allow_label_resolve: Any + def __init__( + self, + selectable, + equivalents: Any | None = ..., + adapt_required: bool = ..., + include_fn: Any | None = ..., + exclude_fn: Any | None = ..., + adapt_on_names: bool = ..., + allow_label_resolve: bool = ..., + anonymize_labels: bool = ..., + adapt_from_selectables: Any | None = ..., + ) -> None: ... + + class _IncludeExcludeMapping: + parent: Any + columns: Any + def __init__(self, parent, columns) -> None: ... + def __getitem__(self, key): ... + + def wrap(self, adapter): ... + def traverse(self, obj): ... + adapt_clause: Any + adapt_list: Any + def adapt_check_present(self, col): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/visitors.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/visitors.pyi new file mode 100644 index 0000000..c3dd447 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/sql/visitors.pyi @@ -0,0 +1,86 @@ +from typing import Any + +class TraversibleType(type): + def __init__(cls, clsname, bases, clsdict) -> None: ... + +class Traversible: + def __class_getitem__(cls, key): ... + def get_children(self, omit_attrs=..., **kw): ... + +class _InternalTraversalType(type): + def __init__(cls, clsname, bases, clsdict) -> None: ... + +class InternalTraversal: + def dispatch(self, visit_symbol): ... + def run_generated_dispatch(self, target, internal_dispatch, generate_dispatcher_name): ... + def generate_dispatch(self, target_cls, internal_dispatch, generate_dispatcher_name): ... + dp_has_cache_key: Any + dp_has_cache_key_list: Any + dp_clauseelement: Any + dp_fromclause_canonical_column_collection: Any + dp_clauseelement_tuples: Any + dp_clauseelement_list: Any + dp_clauseelement_tuple: Any + dp_executable_options: Any + dp_with_context_options: Any + dp_fromclause_ordered_set: Any + dp_string: Any + dp_string_list: Any + dp_anon_name: Any + dp_boolean: Any + dp_operator: Any + dp_type: Any + dp_plain_dict: Any + dp_dialect_options: Any + dp_string_clauseelement_dict: Any + dp_string_multi_dict: Any + dp_annotations_key: Any + dp_plain_obj: Any + dp_named_ddl_element: Any + dp_prefix_sequence: Any + dp_table_hint_list: Any + dp_setup_join_tuple: Any + dp_memoized_select_entities: Any + dp_statement_hint_list: Any + dp_unknown_structure: Any + dp_dml_ordered_values: Any + dp_dml_values: Any + dp_dml_multi_values: Any + dp_propagate_attrs: Any + +class ExtendedInternalTraversal(InternalTraversal): + dp_ignore: Any + dp_inspectable: Any + dp_multi: Any + dp_multi_list: Any + dp_has_cache_key_tuples: Any + dp_inspectable_list: Any + +class ExternalTraversal: + __traverse_options__: Any + def traverse_single(self, obj, **kw): ... + def iterate(self, obj): ... + def traverse(self, obj): ... + @property + def visitor_iterator(self) -> None: ... + def chain(self, visitor): ... + +class CloningExternalTraversal(ExternalTraversal): + def copy_and_process(self, list_): ... + def traverse(self, obj): ... + +class ReplacingExternalTraversal(CloningExternalTraversal): + def replace(self, elem) -> None: ... + def traverse(self, obj): ... + +Visitable = Traversible +VisitableType = TraversibleType +ClauseVisitor = ExternalTraversal +CloningVisitor = CloningExternalTraversal +ReplacingCloningVisitor = ReplacingExternalTraversal + +def iterate(obj, opts=...) -> None: ... +def traverse_using(iterator, obj, visitors): ... +def traverse(obj, opts, visitors): ... +def cloned_traverse(obj, opts, visitors): ... +def replacement_traverse(obj, opts, replace): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/__init__.pyi new file mode 100644 index 0000000..a27e338 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/__init__.pyi @@ -0,0 +1,74 @@ +from . import config as config, mock as mock +from .assertions import ( + AssertsCompiledSQL as AssertsCompiledSQL, + AssertsExecutionResults as AssertsExecutionResults, + ComparesTables as ComparesTables, + assert_raises as assert_raises, + assert_raises_context_ok as assert_raises_context_ok, + assert_raises_message as assert_raises_message, + assert_raises_message_context_ok as assert_raises_message_context_ok, + emits_warning as emits_warning, + emits_warning_on as emits_warning_on, + eq_ as eq_, + eq_ignore_whitespace as eq_ignore_whitespace, + eq_regex as eq_regex, + expect_deprecated as expect_deprecated, + expect_deprecated_20 as expect_deprecated_20, + expect_raises as expect_raises, + expect_raises_message as expect_raises_message, + expect_warnings as expect_warnings, + in_ as in_, + is_ as is_, + is_false as is_false, + is_instance_of as is_instance_of, + is_none as is_none, + is_not as is_not, + is_not_ as is_not_, + is_not_none as is_not_none, + is_true as is_true, + le_ as le_, + ne_ as ne_, + not_in as not_in, + not_in_ as not_in_, + startswith_ as startswith_, + uses_deprecated as uses_deprecated, +) +from .config import ( + async_test as async_test, + combinations as combinations, + combinations_list as combinations_list, + db as db, + fixture as fixture, +) +from .exclusions import ( + db_spec as db_spec, + exclude as exclude, + fails as fails, + fails_if as fails_if, + fails_on as fails_on, + fails_on_everything_except as fails_on_everything_except, + future as future, + only_if as only_if, + only_on as only_on, + skip as skip, + skip_if as skip_if, +) +from .schema import eq_clause_element as eq_clause_element, eq_type_affinity as eq_type_affinity +from .util import ( + adict as adict, + fail as fail, + flag_combinations as flag_combinations, + force_drop_names as force_drop_names, + lambda_combinations as lambda_combinations, + metadata_fixture as metadata_fixture, + provide_metadata as provide_metadata, + resolve_lambda as resolve_lambda, + rowset as rowset, + run_as_contextmanager as run_as_contextmanager, + teardown_events as teardown_events, +) +from .warnings import assert_warnings as assert_warnings, warn_test_suite as warn_test_suite + +def against(*queries): ... + +crashes = skip diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/assertions.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/assertions.pyi new file mode 100644 index 0000000..024be0f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/assertions.pyi @@ -0,0 +1,85 @@ +from typing import Any + +def expect_warnings(*messages, **kw): ... +def expect_warnings_on(db, *messages, **kw) -> None: ... +def emits_warning(*messages): ... +def expect_deprecated(*messages, **kw): ... +def expect_deprecated_20(*messages, **kw): ... +def emits_warning_on(db, *messages): ... +def uses_deprecated(*messages): ... +def global_cleanup_assertions() -> None: ... +def eq_regex(a, b, msg: Any | None = ...) -> None: ... +def eq_(a, b, msg: Any | None = ...) -> None: ... +def ne_(a, b, msg: Any | None = ...) -> None: ... +def le_(a, b, msg: Any | None = ...) -> None: ... +def is_instance_of(a, b, msg: Any | None = ...) -> None: ... +def is_none(a, msg: Any | None = ...) -> None: ... +def is_not_none(a, msg: Any | None = ...) -> None: ... +def is_true(a, msg: Any | None = ...) -> None: ... +def is_false(a, msg: Any | None = ...) -> None: ... +def is_(a, b, msg: Any | None = ...) -> None: ... +def is_not(a, b, msg: Any | None = ...) -> None: ... + +is_not_ = is_not + +def in_(a, b, msg: Any | None = ...) -> None: ... +def not_in(a, b, msg: Any | None = ...) -> None: ... + +not_in_ = not_in + +def startswith_(a, fragment, msg: Any | None = ...) -> None: ... +def eq_ignore_whitespace(a, b, msg: Any | None = ...) -> None: ... +def assert_raises(except_cls, callable_, *args, **kw): ... +def assert_raises_context_ok(except_cls, callable_, *args, **kw): ... +def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): ... +def assert_raises_message_context_ok(except_cls, msg, callable_, *args, **kwargs): ... + +class _ErrorContainer: + error: Any + +def expect_raises(except_cls, check_context: bool = ...): ... +def expect_raises_message(except_cls, msg, check_context: bool = ...): ... + +class AssertsCompiledSQL: + test_statement: Any + supports_execution: Any + def assert_compile( + self, + clause, + result, + params: Any | None = ..., + checkparams: Any | None = ..., + for_executemany: bool = ..., + check_literal_execute: Any | None = ..., + check_post_param: Any | None = ..., + dialect: Any | None = ..., + checkpositional: Any | None = ..., + check_prefetch: Any | None = ..., + use_default_dialect: bool = ..., + allow_dialect_select: bool = ..., + supports_default_values: bool = ..., + supports_default_metavalue: bool = ..., + literal_binds: bool = ..., + render_postcompile: bool = ..., + schema_translate_map: Any | None = ..., + render_schema_translate: bool = ..., + default_schema_name: Any | None = ..., + from_linting: bool = ..., + ): ... + +class ComparesTables: + def assert_tables_equal(self, table, reflected_table, strict_types: bool = ...) -> None: ... + def assert_types_base(self, c1, c2) -> None: ... + +class AssertsExecutionResults: + def assert_result(self, result, class_, *objects) -> None: ... + def assert_list(self, result, class_, list_) -> None: ... + def assert_row(self, class_, rowobj, desc) -> None: ... + def assert_unordered_result(self, result, cls, *expected): ... + def sql_execution_asserter(self, db: Any | None = ...): ... + def assert_sql_execution(self, db, callable_, *rules): ... + def assert_sql(self, db, callable_, rules): ... + def assert_sql_count(self, db, callable_, count) -> None: ... + def assert_multiple_sql_count(self, dbs, callable_, counts): ... + def assert_execution(self, db, *rules) -> None: ... + def assert_statement_count(self, db, count): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/assertsql.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/assertsql.pyi new file mode 100644 index 0000000..7742190 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/assertsql.pyi @@ -0,0 +1,81 @@ +from typing import Any + +class AssertRule: + is_consumed: bool + errormessage: Any + consume_statement: bool + def process_statement(self, execute_observed) -> None: ... + def no_more_statements(self) -> None: ... + +class SQLMatchRule(AssertRule): ... + +class CursorSQL(SQLMatchRule): + statement: Any + params: Any + consume_statement: Any + def __init__(self, statement, params: Any | None = ..., consume_statement: bool = ...) -> None: ... + errormessage: Any + is_consumed: bool + def process_statement(self, execute_observed) -> None: ... + +class CompiledSQL(SQLMatchRule): + statement: Any + params: Any + dialect: Any + def __init__(self, statement, params: Any | None = ..., dialect: str = ...) -> None: ... + is_consumed: bool + errormessage: Any + def process_statement(self, execute_observed) -> None: ... + +class RegexSQL(CompiledSQL): + regex: Any + orig_regex: Any + params: Any + dialect: Any + def __init__(self, regex, params: Any | None = ..., dialect: str = ...) -> None: ... + +class DialectSQL(CompiledSQL): ... + +class CountStatements(AssertRule): + count: Any + def __init__(self, count) -> None: ... + def process_statement(self, execute_observed) -> None: ... + def no_more_statements(self) -> None: ... + +class AllOf(AssertRule): + rules: Any + def __init__(self, *rules) -> None: ... + is_consumed: bool + errormessage: Any + def process_statement(self, execute_observed) -> None: ... + +class EachOf(AssertRule): + rules: Any + def __init__(self, *rules) -> None: ... + errormessage: Any + is_consumed: bool + def process_statement(self, execute_observed) -> None: ... + def no_more_statements(self) -> None: ... + +class Conditional(EachOf): + def __init__(self, condition, rules, else_rules) -> None: ... + +class Or(AllOf): + is_consumed: bool + errormessage: Any + def process_statement(self, execute_observed) -> None: ... + +class SQLExecuteObserved: + context: Any + clauseelement: Any + parameters: Any + statements: Any + def __init__(self, context, clauseelement, multiparams, params) -> None: ... + +class SQLCursorExecuteObserved: ... + +class SQLAsserter: + accumulated: Any + def assert_(self, *rules) -> None: ... + +def assert_engine(engine) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/asyncio.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/asyncio.pyi new file mode 100644 index 0000000..7455e47 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/asyncio.pyi @@ -0,0 +1 @@ +ENABLE_ASYNCIO: bool diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/config.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/config.pyi new file mode 100644 index 0000000..db67aa9 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/config.pyi @@ -0,0 +1,47 @@ +from typing import Any + +requirements: Any +db: Any +db_url: Any +db_opts: Any +file_config: Any +test_schema: Any +test_schema_2: Any +any_async: bool +ident: str + +def combinations(*comb, **kw): ... +def combinations_list(arg_iterable, **kw): ... +def fixture(*arg, **kw): ... +def get_current_test_name(): ... +def mark_base_test_class(): ... + +class Config: + db: Any + db_opts: Any + options: Any + file_config: Any + test_schema: str + test_schema_2: str + is_async: Any + def __init__(self, db, db_opts, options, file_config) -> None: ... + @classmethod + def register(cls, db, db_opts, options, file_config): ... + @classmethod + def set_as_current(cls, config, namespace) -> None: ... + @classmethod + def push_engine(cls, db, namespace) -> None: ... + @classmethod + def push(cls, config, namespace) -> None: ... + @classmethod + def pop(cls, namespace) -> None: ... + @classmethod + def reset(cls, namespace) -> None: ... + @classmethod + def all_configs(cls): ... + @classmethod + def all_dbs(cls) -> None: ... + def skip_test(self, msg) -> None: ... + +def skip_test(msg) -> None: ... +def async_test(fn): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/engines.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/engines.pyi new file mode 100644 index 0000000..a0ce371 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/engines.pyi @@ -0,0 +1,82 @@ +from collections.abc import Mapping +from typing import Any, overload +from typing_extensions import Literal + +from ..engine import Engine +from ..engine.url import URL +from ..ext.asyncio import AsyncEngine + +class ConnectionKiller: + proxy_refs: Any + testing_engines: Any + dbapi_connections: Any + def add_pool(self, pool) -> None: ... + def add_engine(self, engine, scope) -> None: ... + def rollback_all(self) -> None: ... + def checkin_all(self) -> None: ... + def close_all(self) -> None: ... + def prepare_for_drop_tables(self, connection) -> None: ... + def after_test(self) -> None: ... + def after_test_outside_fixtures(self, test) -> None: ... + def stop_test_class_inside_fixtures(self) -> None: ... + def stop_test_class_outside_fixtures(self) -> None: ... + def final_cleanup(self) -> None: ... + def assert_all_closed(self) -> None: ... + +testing_reaper: Any + +def assert_conns_closed(fn, *args, **kw) -> None: ... +def rollback_open_connections(fn, *args, **kw) -> None: ... +def close_first(fn, *args, **kw) -> None: ... +def close_open_connections(fn, *args, **kw) -> None: ... +def all_dialects(exclude: Any | None = ...) -> None: ... + +class ReconnectFixture: + dbapi: Any + connections: Any + is_stopped: bool + def __init__(self, dbapi) -> None: ... + def __getattr__(self, key): ... + def connect(self, *args, **kwargs): ... + def shutdown(self, stop: bool = ...) -> None: ... + def restart(self) -> None: ... + +def reconnecting_engine(url: Any | None = ..., options: Any | None = ...): ... +@overload +def testing_engine( # type: ignore[misc] + url: URL | str | None = ..., + options: Mapping[str, Any] | None = ..., + future: bool | None = ..., + asyncio: Literal[False] = ..., + transfer_staticpool: bool = ..., +) -> Engine: ... +@overload +def testing_engine( + url: URL | str | None = ..., + options: Mapping[str, Any] | None = ..., + future: bool | None = ..., + asyncio: Literal[True] = ..., + transfer_staticpool: bool = ..., +) -> AsyncEngine: ... +def mock_engine(dialect_name: Any | None = ...): ... + +class DBAPIProxyCursor: + engine: Any + connection: Any + cursor: Any + def __init__(self, engine, conn, *args, **kwargs) -> None: ... + def execute(self, stmt, parameters: Any | None = ..., **kw): ... + def executemany(self, stmt, params, **kw): ... + def __iter__(self): ... + def __getattr__(self, key): ... + +class DBAPIProxyConnection: + conn: Any + engine: Any + cursor_cls: Any + def __init__(self, engine, cursor_cls) -> None: ... + def cursor(self, *args, **kwargs): ... + def close(self) -> None: ... + def __getattr__(self, key): ... + +def proxying_engine(conn_cls=..., cursor_cls=...): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/entities.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/entities.pyi new file mode 100644 index 0000000..0afb34e --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/entities.pyi @@ -0,0 +1,9 @@ +class BasicEntity: + def __init__(self, **kw) -> None: ... + +class ComparableMixin: + def __ne__(self, other): ... + def __eq__(self, other): ... + +class ComparableEntity(ComparableMixin, BasicEntity): + def __hash__(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/exclusions.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/exclusions.pyi new file mode 100644 index 0000000..869dcb5 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/exclusions.pyi @@ -0,0 +1,75 @@ +from typing import Any + +def skip_if(predicate, reason: Any | None = ...): ... +def fails_if(predicate, reason: Any | None = ...): ... + +class compound: + fails: Any + skips: Any + tags: Any + def __add__(self, other): ... + def as_skips(self): ... + def add(self, *others): ... + def not_(self): ... + @property + def enabled(self): ... + def enabled_for_config(self, config): ... + def matching_config_reasons(self, config): ... + def include_test(self, include_tags, exclude_tags): ... + def __call__(self, fn): ... + def fail_if(self) -> None: ... + +def requires_tag(tagname): ... +def tags(tagnames): ... +def only_if(predicate, reason: Any | None = ...): ... +def succeeds_if(predicate, reason: Any | None = ...): ... + +class Predicate: + @classmethod + def as_predicate(cls, predicate, description: Any | None = ...): ... + +class BooleanPredicate(Predicate): + value: Any + description: Any + def __init__(self, value, description: Any | None = ...) -> None: ... + def __call__(self, config): ... + +class SpecPredicate(Predicate): + db: Any + op: Any + spec: Any + description: Any + def __init__(self, db, op: Any | None = ..., spec: Any | None = ..., description: Any | None = ...) -> None: ... + def __call__(self, config): ... + +class LambdaPredicate(Predicate): + lambda_: Any + args: Any + kw: Any + description: Any + def __init__(self, lambda_, description: Any | None = ..., args: Any | None = ..., kw: Any | None = ...): ... + def __call__(self, config): ... + +class NotPredicate(Predicate): + predicate: Any + description: Any + def __init__(self, predicate, description: Any | None = ...) -> None: ... + def __call__(self, config): ... + +class OrPredicate(Predicate): + predicates: Any + description: Any + def __init__(self, predicates, description: Any | None = ...) -> None: ... + def __call__(self, config): ... + +def db_spec(*dbs): ... +def open(): ... +def closed(): ... +def fails(reason: Any | None = ...): ... +def future(fn, *arg): ... +def fails_on(db, reason: Any | None = ...): ... +def fails_on_everything_except(*dbs): ... +def skip(db, reason: Any | None = ...): ... +def only_on(dbs, reason: Any | None = ...): ... +def exclude(db, op, spec, reason: Any | None = ...): ... +def against(config, *queries): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/fixtures.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/fixtures.pyi new file mode 100644 index 0000000..58c6be2 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/fixtures.pyi @@ -0,0 +1,83 @@ +from typing import Any + +from . import assertions +from .entities import ComparableEntity as ComparableEntity + +class TestBase: + __requires__: Any + __unsupported_on__: Any + __only_on__: Any + __skip_if__: Any + __leave_connections_for_teardown__: bool + def assert_(self, val, msg: Any | None = ...) -> None: ... + def connection_no_trans(self) -> None: ... + def connection(self) -> None: ... + def registry(self, metadata) -> None: ... + def future_connection(self, future_engine, connection) -> None: ... + def future_engine(self) -> None: ... + def testing_engine(self): ... + def async_testing_engine(self, testing_engine): ... + def metadata(self, request) -> None: ... + def trans_ctx_manager_fixture(self, request, metadata): ... + +class FutureEngineMixin: ... + +class TablesTest(TestBase): + run_setup_bind: str + run_define_tables: str + run_create_tables: str + run_inserts: str + run_deletes: str + run_dispose_bind: Any + bind: Any + tables: Any + other: Any + sequences: Any + @property + def tables_test_metadata(self): ... + @classmethod + def setup_bind(cls): ... + @classmethod + def dispose_bind(cls, bind) -> None: ... + @classmethod + def define_tables(cls, metadata) -> None: ... + @classmethod + def fixtures(cls): ... + @classmethod + def insert_data(cls, connection) -> None: ... + def sql_count_(self, count, fn) -> None: ... + def sql_eq_(self, callable_, statements) -> None: ... + +class NoCache: ... + +class RemovesEvents: + def event_listen(self, target, name, fn, **kw) -> None: ... + +def fixture_session(**kw): ... +def stop_test_class_inside_fixtures(cls) -> None: ... +def after_test() -> None: ... + +class ORMTest(TestBase): ... + +class MappedTest(TablesTest, assertions.AssertsExecutionResults): + run_setup_classes: str + run_setup_mappers: str + classes: Any + @classmethod + def setup_classes(cls) -> None: ... + @classmethod + def setup_mappers(cls) -> None: ... + +class DeclarativeMappedTest(MappedTest): + run_setup_classes: str + run_setup_mappers: str + +class ComputedReflectionFixtureTest(TablesTest): + run_inserts: Any + run_deletes: Any + __backend__: bool + __requires__: Any + regexp: Any + def normalize(self, text): ... + @classmethod + def define_tables(cls, metadata) -> None: ... diff --git a/stdlib/@python2/distutils/command/bdist_wininst.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/mock.pyi similarity index 100% rename from stdlib/@python2/distutils/command/bdist_wininst.pyi rename to stubs/SQLAlchemy/sqlalchemy/testing/mock.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/pickleable.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/pickleable.pyi new file mode 100644 index 0000000..59664bd --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/pickleable.pyi @@ -0,0 +1,62 @@ +from typing import Any + +from . import fixtures + +class User(fixtures.ComparableEntity): ... +class Order(fixtures.ComparableEntity): ... +class Dingaling(fixtures.ComparableEntity): ... +class EmailUser(User): ... +class Address(fixtures.ComparableEntity): ... +class Child1(fixtures.ComparableEntity): ... +class Child2(fixtures.ComparableEntity): ... +class Parent(fixtures.ComparableEntity): ... + +class Screen: + obj: Any + parent: Any + def __init__(self, obj, parent: Any | None = ...) -> None: ... + +class Foo: + data: str + stuff: Any + moredata: Any + def __init__(self, moredata, stuff: str = ...) -> None: ... + __hash__ = object.__hash__ + def __eq__(self, other): ... + +class Bar: + x: Any + y: Any + def __init__(self, x, y) -> None: ... + __hash__ = object.__hash__ + def __eq__(self, other): ... + +class OldSchool: + x: Any + y: Any + def __init__(self, x, y) -> None: ... + def __eq__(self, other): ... + +class OldSchoolWithoutCompare: + x: Any + y: Any + def __init__(self, x, y) -> None: ... + +class BarWithoutCompare: + x: Any + y: Any + def __init__(self, x, y) -> None: ... + +class NotComparable: + data: Any + def __init__(self, data) -> None: ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class BrokenComparable: + data: Any + def __init__(self, data) -> None: ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... diff --git a/stdlib/@python2/pydoc_data/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/__init__.pyi similarity index 100% rename from stdlib/@python2/pydoc_data/__init__.pyi rename to stubs/SQLAlchemy/sqlalchemy/testing/plugin/__init__.pyi diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/plugin/bootstrap.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/bootstrap.pyi new file mode 100644 index 0000000..5c554d0 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/bootstrap.pyi @@ -0,0 +1,6 @@ +from typing import Any + +bootstrap_file: Any +to_bootstrap: Any + +def load_file_as_module(name): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/plugin/plugin_base.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/plugin_base.pyi new file mode 100644 index 0000000..e0cdfbe --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/plugin_base.pyi @@ -0,0 +1,63 @@ +import abc +from typing import Any + +bootstrapped_as_sqlalchemy: bool +log: Any +py3k: Any +ABC = abc.ABC + +fixtures: Any +engines: Any +exclusions: Any +warnings: Any +profiling: Any +provision: Any +assertions: Any +requirements: Any +config: Any +testing: Any +util: Any +file_config: Any +include_tags: Any +exclude_tags: Any +options: Any + +def setup_options(make_option) -> None: ... +def configure_follower(follower_ident) -> None: ... +def memoize_important_follower_config(dict_) -> None: ... +def restore_important_follower_config(dict_) -> None: ... +def read_config() -> None: ... +def pre_begin(opt) -> None: ... +def set_coverage_flag(value) -> None: ... +def post_begin() -> None: ... + +pre_configure: Any +post_configure: Any + +def pre(fn): ... +def post(fn): ... +def want_class(name, cls): ... +def want_method(cls, fn): ... +def generate_sub_tests(cls, module) -> None: ... +def start_test_class_outside_fixtures(cls) -> None: ... +def stop_test_class(cls) -> None: ... +def stop_test_class_outside_fixtures(cls) -> None: ... +def final_process_cleanup() -> None: ... +def before_test(test, test_module_name, test_class, test_name) -> None: ... +def after_test(test) -> None: ... +def after_test_fixtures(test) -> None: ... + +class FixtureFunctions(ABC, metaclass=abc.ABCMeta): + @abc.abstractmethod + def skip_test_exception(self, *arg, **kw): ... + @abc.abstractmethod + def combinations(self, *args, **kw): ... + @abc.abstractmethod + def param_ident(self, *args, **kw): ... + @abc.abstractmethod + def fixture(self, *arg, **kw): ... + def get_current_test_name(self) -> None: ... + @abc.abstractmethod + def mark_base_test_class(self): ... + +def set_fixture_functions(fixture_fn_class) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/plugin/pytestplugin.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/pytestplugin.pyi new file mode 100644 index 0000000..ded604f --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/pytestplugin.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from . import plugin_base + +has_xdist: bool +py2k: Any + +def pytest_addoption(parser) -> None: ... +def pytest_configure(config) -> None: ... + +DUMP_PYANNOTATE: bool + +def collect_types_fixture() -> None: ... +def pytest_sessionstart(session) -> None: ... +def pytest_sessionfinish(session) -> None: ... +def pytest_collection_finish(session): ... +def pytest_configure_node(node) -> None: ... +def pytest_testnodedown(node, error) -> None: ... +def pytest_collection_modifyitems(session, config, items): ... +def pytest_pycollect_makeitem(collector, name, obj): ... +def pytest_runtest_setup(item) -> None: ... +def pytest_runtest_teardown(item, nextitem) -> None: ... +def pytest_runtest_call(item) -> None: ... +def pytest_runtest_logreport(report) -> None: ... +def setup_class_methods(request) -> None: ... +def setup_test_methods(request) -> None: ... +def getargspec(fn): ... + +class PytestFixtureFunctions(plugin_base.FixtureFunctions): + def skip_test_exception(self, *arg, **kw): ... + def mark_base_test_class(self): ... + def combinations(self, *arg_sets, **kw): ... + def param_ident(self, *parameters): ... + def fixture(self, *arg, **kw): ... + def get_current_test_name(self): ... + def async_test(self, fn): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/plugin/reinvent_fixtures_py2k.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/reinvent_fixtures_py2k.pyi new file mode 100644 index 0000000..83f3da8 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/plugin/reinvent_fixtures_py2k.pyi @@ -0,0 +1,6 @@ +def add_fixture(fn, fixture) -> None: ... +def scan_for_fixtures_to_use_for_class(item) -> None: ... +def run_class_fixture_setup(request) -> None: ... +def run_class_fixture_teardown(request) -> None: ... +def run_fn_fixture_setup(request) -> None: ... +def run_fn_fixture_teardown(request) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/profiling.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/profiling.pyi new file mode 100644 index 0000000..ff48b0d --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/profiling.pyi @@ -0,0 +1,20 @@ +from typing import Any + +class ProfileStatsFile: + force_write: Any + write: Any + fname: Any + short_fname: Any + data: Any + dump: Any + sort: Any + def __init__(self, filename, sort: str = ..., dump: Any | None = ...): ... + @property + def platform_key(self): ... + def has_stats(self): ... + def result(self, callcount): ... + def reset_count(self) -> None: ... + def replace(self, callcount) -> None: ... + +def function_call_count(variance: float = ..., times: int = ..., warmup: int = ...): ... +def count_functions(variance: float = ...) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/provision.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/provision.pyi new file mode 100644 index 0000000..a6c4832 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/provision.pyi @@ -0,0 +1,33 @@ +from typing import Any + +log: Any +FOLLOWER_IDENT: Any + +class register: + fns: Any + @classmethod + def init(cls, fn): ... + def for_db(self, *dbnames): ... + def __call__(self, cfg, *arg): ... + +def create_follower_db(follower_ident) -> None: ... +def setup_config(db_url, options, file_config, follower_ident): ... +def drop_follower_db(follower_ident) -> None: ... +def generate_db_urls(db_urls, extra_drivers) -> None: ... +def generate_driver_url(url, driver, query_str): ... +def drop_all_schema_objects_pre_tables(cfg, eng) -> None: ... +def drop_all_schema_objects_post_tables(cfg, eng) -> None: ... +def drop_all_schema_objects(cfg, eng) -> None: ... +def create_db(cfg, eng, ident) -> None: ... +def drop_db(cfg, eng, ident) -> None: ... +def update_db_opts(cfg, db_opts) -> None: ... +def post_configure_engine(url, engine, follower_ident) -> None: ... +def follower_url_from_main(url, ident): ... +def configure_follower(cfg, ident) -> None: ... +def run_reap_dbs(url, ident) -> None: ... +def reap_dbs(idents_file) -> None: ... +def temp_table_keyword_args(cfg, eng) -> None: ... +def prepare_for_drop_tables(config, connection) -> None: ... +def stop_test_class_outside_fixtures(config, db, testcls) -> None: ... +def get_temp_table_name(cfg, eng, base_name): ... +def set_default_schema_on_connection(cfg, dbapi_connection, schema_name) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/requirements.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/requirements.pyi new file mode 100644 index 0000000..5f0a97c --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/requirements.pyi @@ -0,0 +1,381 @@ +class Requirements: ... + +class SuiteRequirements(Requirements): + @property + def create_table(self): ... + @property + def drop_table(self): ... + @property + def table_ddl_if_exists(self): ... + @property + def index_ddl_if_exists(self): ... + @property + def foreign_keys(self): ... + @property + def table_value_constructor(self): ... + @property + def standard_cursor_sql(self): ... + @property + def on_update_cascade(self): ... + @property + def non_updating_cascade(self): ... + @property + def deferrable_fks(self): ... + @property + def on_update_or_deferrable_fks(self): ... + @property + def queue_pool(self): ... + @property + def self_referential_foreign_keys(self): ... + @property + def foreign_key_ddl(self): ... + @property + def named_constraints(self): ... + @property + def implicitly_named_constraints(self): ... + @property + def subqueries(self): ... + @property + def offset(self): ... + @property + def bound_limit_offset(self): ... + @property + def sql_expression_limit_offset(self): ... + @property + def parens_in_union_contained_select_w_limit_offset(self): ... + @property + def parens_in_union_contained_select_wo_limit_offset(self): ... + @property + def boolean_col_expressions(self): ... + @property + def nullable_booleans(self): ... + @property + def nullsordering(self): ... + @property + def standalone_binds(self): ... + @property + def standalone_null_binds_whereclause(self): ... + @property + def intersect(self): ... + @property + def except_(self): ... + @property + def window_functions(self): ... + @property + def ctes(self): ... + @property + def ctes_with_update_delete(self): ... + @property + def ctes_on_dml(self): ... + @property + def autoincrement_insert(self): ... + @property + def fetch_rows_post_commit(self): ... + @property + def group_by_complex_expression(self): ... + @property + def sane_rowcount(self): ... + @property + def sane_multi_rowcount(self): ... + @property + def sane_rowcount_w_returning(self): ... + @property + def empty_inserts(self): ... + @property + def empty_inserts_executemany(self): ... + @property + def insert_from_select(self): ... + @property + def full_returning(self): ... + @property + def insert_executemany_returning(self): ... + @property + def returning(self): ... + @property + def tuple_in(self): ... + @property + def tuple_in_w_empty(self): ... + @property + def duplicate_names_in_cursor_description(self): ... + @property + def denormalized_names(self): ... + @property + def multivalues_inserts(self): ... + @property + def implements_get_lastrowid(self): ... + @property + def emulated_lastrowid(self): ... + @property + def emulated_lastrowid_even_with_sequences(self): ... + @property + def dbapi_lastrowid(self): ... + @property + def views(self): ... + @property + def schemas(self): ... + @property + def cross_schema_fk_reflection(self): ... + @property + def foreign_key_constraint_name_reflection(self): ... + @property + def implicit_default_schema(self): ... + @property + def default_schema_name_switch(self): ... + @property + def server_side_cursors(self): ... + @property + def sequences(self): ... + @property + def no_sequences(self): ... + @property + def sequences_optional(self): ... + @property + def supports_lastrowid(self): ... + @property + def no_lastrowid_support(self): ... + @property + def reflects_pk_names(self): ... + @property + def table_reflection(self): ... + @property + def reflect_tables_no_columns(self): ... + @property + def comment_reflection(self): ... + @property + def view_column_reflection(self): ... + @property + def view_reflection(self): ... + @property + def schema_reflection(self): ... + @property + def primary_key_constraint_reflection(self): ... + @property + def foreign_key_constraint_reflection(self): ... + @property + def foreign_key_constraint_option_reflection_ondelete(self): ... + @property + def fk_constraint_option_reflection_ondelete_restrict(self): ... + @property + def fk_constraint_option_reflection_ondelete_noaction(self): ... + @property + def foreign_key_constraint_option_reflection_onupdate(self): ... + @property + def fk_constraint_option_reflection_onupdate_restrict(self): ... + @property + def temp_table_reflection(self): ... + @property + def temp_table_reflect_indexes(self): ... + @property + def temp_table_names(self): ... + @property + def temporary_tables(self): ... + @property + def temporary_views(self): ... + @property + def index_reflection(self): ... + @property + def index_reflects_included_columns(self): ... + @property + def indexes_with_ascdesc(self): ... + @property + def indexes_with_expressions(self): ... + @property + def unique_constraint_reflection(self): ... + @property + def check_constraint_reflection(self): ... + @property + def duplicate_key_raises_integrity_error(self): ... + @property + def unbounded_varchar(self): ... + @property + def unicode_data(self): ... + @property + def unicode_ddl(self): ... + @property + def symbol_names_w_double_quote(self): ... + @property + def datetime_literals(self): ... + @property + def datetime(self): ... + @property + def datetime_microseconds(self): ... + @property + def timestamp_microseconds(self): ... + @property + def datetime_historic(self): ... + @property + def date(self): ... + @property + def date_coerces_from_datetime(self): ... + @property + def date_historic(self): ... + @property + def time(self): ... + @property + def time_microseconds(self): ... + @property + def binary_comparisons(self): ... + @property + def binary_literals(self): ... + @property + def autocommit(self): ... + @property + def isolation_level(self): ... + def get_isolation_levels(self, config) -> None: ... + @property + def json_type(self): ... + @property + def json_array_indexes(self): ... + @property + def json_index_supplementary_unicode_element(self): ... + @property + def legacy_unconditional_json_extract(self): ... + @property + def precision_numerics_general(self): ... + @property + def precision_numerics_enotation_small(self): ... + @property + def precision_numerics_enotation_large(self): ... + @property + def precision_numerics_many_significant_digits(self): ... + @property + def cast_precision_numerics_many_significant_digits(self): ... + @property + def implicit_decimal_binds(self): ... + @property + def nested_aggregates(self): ... + @property + def recursive_fk_cascade(self): ... + @property + def precision_numerics_retains_significant_digits(self): ... + @property + def infinity_floats(self): ... + @property + def precision_generic_float_type(self): ... + @property + def floats_to_four_decimals(self): ... + @property + def fetch_null_from_numeric(self): ... + @property + def text_type(self): ... + @property + def empty_strings_varchar(self): ... + @property + def empty_strings_text(self): ... + @property + def expressions_against_unbounded_text(self): ... + @property + def selectone(self): ... + @property + def savepoints(self): ... + @property + def two_phase_transactions(self): ... + @property + def update_from(self): ... + @property + def delete_from(self): ... + @property + def update_where_target_in_subquery(self): ... + @property + def mod_operator_as_percent_sign(self): ... + @property + def percent_schema_names(self): ... + @property + def order_by_col_from_union(self): ... + @property + def order_by_label_with_expression(self): ... + @property + def order_by_collation(self): ... + def get_order_by_collation(self, config) -> None: ... + @property + def unicode_connections(self): ... + @property + def graceful_disconnects(self): ... + @property + def independent_connections(self): ... + @property + def skip_mysql_on_windows(self): ... + @property + def ad_hoc_engines(self): ... + @property + def no_windows(self): ... + @property + def timing_intensive(self): ... + @property + def memory_intensive(self): ... + @property + def threading_with_mock(self): ... + @property + def sqlalchemy2_stubs(self): ... + @property + def python2(self): ... + @property + def python3(self): ... + @property + def pep520(self): ... + @property + def insert_order_dicts(self): ... + @property + def python36(self): ... + @property + def python37(self): ... + @property + def dataclasses(self): ... + @property + def python38(self): ... + @property + def cpython(self): ... + @property + def patch_library(self): ... + @property + def non_broken_pickle(self): ... + @property + def predictable_gc(self): ... + @property + def no_coverage(self): ... + @property + def sqlite(self): ... + @property + def cextensions(self): ... + @property + def async_dialect(self): ... + @property + def greenlet(self): ... + @property + def computed_columns(self): ... + @property + def computed_columns_stored(self): ... + @property + def computed_columns_virtual(self): ... + @property + def computed_columns_default_persisted(self): ... + @property + def computed_columns_reflect_persisted(self): ... + @property + def supports_distinct_on(self): ... + @property + def supports_is_distinct_from(self): ... + @property + def identity_columns(self): ... + @property + def identity_columns_standard(self): ... + @property + def regexp_match(self): ... + @property + def regexp_replace(self): ... + @property + def fetch_first(self): ... + @property + def fetch_percent(self): ... + @property + def fetch_ties(self): ... + @property + def fetch_no_order_by(self): ... + @property + def fetch_offset_with_options(self): ... + @property + def fetch_expression(self): ... + @property + def autoincrement_without_sequence(self): ... + @property + def generic_classes(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/schema.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/schema.pyi new file mode 100644 index 0000000..dc8b621 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/schema.pyi @@ -0,0 +1,16 @@ +from typing import Any + +def Table(*args, **kw): ... +def Column(*args, **kw): ... + +class eq_type_affinity: + target: Any + def __init__(self, target) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class eq_clause_element: + target: Any + def __init__(self, target) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/util.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/util.pyi new file mode 100644 index 0000000..e716d83 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/util.pyi @@ -0,0 +1,38 @@ +from typing import Any + +def non_refcount_gc_collect(*args) -> None: ... # only present on Python implementations with non-refcount gc +def gc_collect(generation: int = ...) -> None: ... +def lazy_gc() -> None: ... +def picklers(): ... +def random_choices(population, k: int = ...): ... +def round_decimal(value, prec): ... + +class RandomSet(set[Any]): + def __iter__(self): ... + def pop(self): ... + def union(self, other): ... + def difference(self, other): ... + def intersection(self, other): ... + def copy(self): ... + +def conforms_partial_ordering(tuples, sorted_elements): ... +def all_partial_orderings(tuples, elements): ... +def function_named(fn, name): ... +def run_as_contextmanager(ctx, fn, *arg, **kw): ... +def rowset(results): ... +def fail(msg) -> None: ... +def provide_metadata(fn, *args, **kw): ... +def flag_combinations(*combinations): ... +def lambda_combinations(lambda_arg_sets, **kw): ... +def resolve_lambda(__fn, **kw): ... +def metadata_fixture(ddl: str = ...): ... +def force_drop_names(*names): ... + +class adict(dict[Any, Any]): + def __getattribute__(self, key): ... + def __call__(self, *keys): ... + get_all: Any + +def drop_all_tables_from_metadata(metadata, engine_or_connection) -> None: ... +def drop_all_tables(engine, inspector, schema: Any | None = ..., include_names: Any | None = ...) -> None: ... +def teardown_events(event_cls): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/testing/warnings.pyi b/stubs/SQLAlchemy/sqlalchemy/testing/warnings.pyi new file mode 100644 index 0000000..9aa4255 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/testing/warnings.pyi @@ -0,0 +1,7 @@ +from .. import exc as sa_exc + +class SATestSuiteWarning(sa_exc.SAWarning): ... + +def warn_test_suite(message) -> None: ... +def setup_filters() -> None: ... +def assert_warnings(fn, warning_msgs, regex: bool = ...): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/types.pyi b/stubs/SQLAlchemy/sqlalchemy/types.pyi new file mode 100644 index 0000000..ee45533 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/types.pyi @@ -0,0 +1,106 @@ +from .sql.sqltypes import ( + ARRAY as ARRAY, + BIGINT as BIGINT, + BINARY as BINARY, + BLOB as BLOB, + BOOLEAN as BOOLEAN, + CHAR as CHAR, + CLOB as CLOB, + DATE as DATE, + DATETIME as DATETIME, + DECIMAL as DECIMAL, + FLOAT as FLOAT, + INT as INT, + INTEGER as INTEGER, + JSON as JSON, + NCHAR as NCHAR, + NUMERIC as NUMERIC, + NVARCHAR as NVARCHAR, + REAL as REAL, + SMALLINT as SMALLINT, + TEXT as TEXT, + TIME as TIME, + TIMESTAMP as TIMESTAMP, + VARBINARY as VARBINARY, + VARCHAR as VARCHAR, + BigInteger as BigInteger, + Boolean as Boolean, + Concatenable as Concatenable, + Date as Date, + DateTime as DateTime, + Enum as Enum, + Float as Float, + Indexable as Indexable, + Integer as Integer, + Interval as Interval, + LargeBinary as LargeBinary, + MatchType as MatchType, + NullType as NullType, + Numeric as Numeric, + PickleType as PickleType, + SmallInteger as SmallInteger, + String as String, + Text as Text, + Time as Time, + TupleType as TupleType, + Unicode as Unicode, + UnicodeText as UnicodeText, + _Binary as _Binary, +) +from .sql.type_api import ( + ExternalType as ExternalType, + TypeDecorator as TypeDecorator, + TypeEngine as TypeEngine, + UserDefinedType as UserDefinedType, +) + +__all__ = [ + "TypeEngine", + "TypeDecorator", + "UserDefinedType", + "ExternalType", + "INT", + "CHAR", + "VARCHAR", + "NCHAR", + "NVARCHAR", + "TEXT", + "Text", + "FLOAT", + "NUMERIC", + "REAL", + "DECIMAL", + "TIMESTAMP", + "DATETIME", + "CLOB", + "BLOB", + "BINARY", + "VARBINARY", + "BOOLEAN", + "BIGINT", + "SMALLINT", + "INTEGER", + "DATE", + "TIME", + "TupleType", + "String", + "Integer", + "SmallInteger", + "BigInteger", + "Numeric", + "Float", + "DateTime", + "Date", + "Time", + "LargeBinary", + "Boolean", + "Unicode", + "Concatenable", + "UnicodeText", + "PickleType", + "Interval", + "Enum", + "Indexable", + "ARRAY", + "JSON", +] diff --git a/stubs/SQLAlchemy/sqlalchemy/util/__init__.pyi b/stubs/SQLAlchemy/sqlalchemy/util/__init__.pyi new file mode 100644 index 0000000..d569a66 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/__init__.pyi @@ -0,0 +1,174 @@ +from collections import defaultdict as defaultdict +from contextlib import contextmanager as contextmanager +from functools import partial as partial, update_wrapper as update_wrapper + +from ._collections import ( + EMPTY_DICT as EMPTY_DICT, + EMPTY_SET as EMPTY_SET, + FacadeDict as FacadeDict, + IdentitySet as IdentitySet, + ImmutableContainer as ImmutableContainer, + ImmutableProperties as ImmutableProperties, + LRUCache as LRUCache, + OrderedDict as OrderedDict, + OrderedIdentitySet as OrderedIdentitySet, + OrderedProperties as OrderedProperties, + OrderedSet as OrderedSet, + PopulateDict as PopulateDict, + Properties as Properties, + ScopedRegistry as ScopedRegistry, + ThreadLocalRegistry as ThreadLocalRegistry, + UniqueAppender as UniqueAppender, + WeakPopulateDict as WeakPopulateDict, + WeakSequence as WeakSequence, + coerce_generator_arg as coerce_generator_arg, + coerce_to_immutabledict as coerce_to_immutabledict, + collections_abc as collections_abc, + column_dict as column_dict, + column_set as column_set, + flatten_iterator as flatten_iterator, + has_dupes as has_dupes, + has_intersection as has_intersection, + immutabledict as immutabledict, + ordered_column_set as ordered_column_set, + sort_dictionary as sort_dictionary, + to_column_set as to_column_set, + to_list as to_list, + to_set as to_set, + unique_list as unique_list, + update_copy as update_copy, +) +from ._preloaded import preload_module as preload_module, preloaded as preloaded +from .compat import ( + ABC as ABC, + TYPE_CHECKING as TYPE_CHECKING, + StringIO as StringIO, + arm as arm, + b as b, + b64decode as b64decode, + b64encode as b64encode, + binary_type as binary_type, + binary_types as binary_types, + byte_buffer as byte_buffer, + callable as callable, + cmp as cmp, + cpython as cpython, + dataclass_fields as dataclass_fields, + decode_backslashreplace as decode_backslashreplace, + dottedgetter as dottedgetter, + has_refcount_gc as has_refcount_gc, + inspect_getfullargspec as inspect_getfullargspec, + int_types as int_types, + iterbytes as iterbytes, + itertools_filter as itertools_filter, + itertools_filterfalse as itertools_filterfalse, + local_dataclass_fields as local_dataclass_fields, + namedtuple as namedtuple, + next as next, + nullcontext as nullcontext, + osx as osx, + parse_qsl as parse_qsl, + perf_counter as perf_counter, + pickle as pickle, + print_ as print_, + py2k as py2k, + py3k as py3k, + py37 as py37, + py38 as py38, + py39 as py39, + pypy as pypy, + quote_plus as quote_plus, + raise_ as raise_, + raise_from_cause as raise_from_cause, + reduce as reduce, + reraise as reraise, + string_types as string_types, + text_type as text_type, + threading as threading, + timezone as timezone, + u as u, + ue as ue, + unquote as unquote, + unquote_plus as unquote_plus, + win32 as win32, + with_metaclass as with_metaclass, + zip_longest as zip_longest, +) +from .concurrency import ( + asyncio as asyncio, + await_fallback as await_fallback, + await_only as await_only, + greenlet_spawn as greenlet_spawn, + is_exit_exception as is_exit_exception, +) +from .deprecations import ( + SQLALCHEMY_WARN_20 as SQLALCHEMY_WARN_20, + deprecated as deprecated, + deprecated_20 as deprecated_20, + deprecated_20_cls as deprecated_20_cls, + deprecated_cls as deprecated_cls, + deprecated_params as deprecated_params, + inject_docstring_text as inject_docstring_text, + moved_20 as moved_20, + warn_deprecated as warn_deprecated, + warn_deprecated_20 as warn_deprecated_20, +) +from .langhelpers import ( + EnsureKWArgType as EnsureKWArgType, + HasMemoized as HasMemoized, + MemoizedSlots as MemoizedSlots, + NoneType as NoneType, + PluginLoader as PluginLoader, + add_parameter_text as add_parameter_text, + as_interface as as_interface, + asbool as asbool, + asint as asint, + assert_arg_type as assert_arg_type, + attrsetter as attrsetter, + bool_or_str as bool_or_str, + chop_traceback as chop_traceback, + class_hierarchy as class_hierarchy, + classproperty as classproperty, + clsname_as_plain_name as clsname_as_plain_name, + coerce_kw_type as coerce_kw_type, + constructor_copy as constructor_copy, + constructor_key as constructor_key, + counter as counter, + create_proxy_methods as create_proxy_methods, + decode_slice as decode_slice, + decorator as decorator, + dictlike_iteritems as dictlike_iteritems, + duck_type_collection as duck_type_collection, + ellipses_string as ellipses_string, + format_argspec_init as format_argspec_init, + format_argspec_plus as format_argspec_plus, + generic_repr as generic_repr, + get_callable_argspec as get_callable_argspec, + get_cls_kwargs as get_cls_kwargs, + get_func_kwargs as get_func_kwargs, + getargspec_init as getargspec_init, + has_compiled_ext as has_compiled_ext, + hybridmethod as hybridmethod, + hybridproperty as hybridproperty, + iterate_attributes as iterate_attributes, + map_bits as map_bits, + md5_hex as md5_hex, + memoized_instancemethod as memoized_instancemethod, + memoized_property as memoized_property, + method_is_overridden as method_is_overridden, + methods_equivalent as methods_equivalent, + monkeypatch_proxied_specials as monkeypatch_proxied_specials, + only_once as only_once, + portable_instancemethod as portable_instancemethod, + quoted_token_parser as quoted_token_parser, + safe_reraise as safe_reraise, + set_creation_order as set_creation_order, + string_or_unprintable as string_or_unprintable, + symbol as symbol, + unbound_method_to_callable as unbound_method_to_callable, + walk_subclasses as walk_subclasses, + warn as warn, + warn_exception as warn_exception, + warn_limited as warn_limited, + wrap_callable as wrap_callable, +) diff --git a/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi b/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi new file mode 100644 index 0000000..1a8acae --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi @@ -0,0 +1,218 @@ +import collections.abc +from _typeshed import Self, SupportsKeysAndGetItem +from collections.abc import Callable, Iterable, Iterator, Mapping +from typing import Any, Generic, NoReturn, TypeVar, overload + +from ..cimmutabledict import immutabledict as immutabledict + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") +_S = TypeVar("_S") +_T = TypeVar("_T") + +collections_abc = collections.abc + +EMPTY_SET: frozenset[Any] + +class ImmutableContainer: + def __delitem__(self, *arg: object, **kw: object) -> NoReturn: ... + def __setitem__(self, *arg: object, **kw: object) -> NoReturn: ... + def __setattr__(self, *arg: object, **kw: object) -> NoReturn: ... + +@overload +def coerce_to_immutabledict(d: None) -> immutabledict[Any, Any]: ... +@overload +def coerce_to_immutabledict(d: Mapping[_KT, _VT]) -> immutabledict[_KT, _VT]: ... + +EMPTY_DICT: immutabledict[Any, Any] + +class FacadeDict(ImmutableContainer, dict[Any, Any]): + clear: Any + pop: Any + popitem: Any + setdefault: Any + update: Any + def __new__(cls, *args): ... + def copy(self) -> None: ... # type: ignore[override] + def __reduce__(self): ... + +class Properties(Generic[_T]): + def __init__(self, data: dict[str, _T]) -> None: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T]: ... + def __dir__(self) -> list[str]: ... + def __add__(self, other: Iterable[_S]) -> list[_S | _T]: ... + def __setitem__(self, key: str, obj: _T) -> None: ... + def __getitem__(self, key: str) -> _T: ... + def __delitem__(self, key: str) -> None: ... + def __setattr__(self, key: str, obj: _T) -> None: ... + def __getattr__(self, key: str) -> _T: ... + def __contains__(self, key: str) -> bool: ... + def as_immutable(self) -> ImmutableProperties[_T]: ... + def update(self, value: Iterable[tuple[str, _T]] | SupportsKeysAndGetItem[str, _T]) -> None: ... + @overload + def get(self, key: str) -> _T | None: ... + @overload + def get(self, key: str, default: _S) -> _T | _S: ... + def keys(self) -> list[str]: ... + def values(self) -> list[_T]: ... + def items(self) -> list[tuple[str, _T]]: ... + def has_key(self, key: str) -> bool: ... + def clear(self) -> None: ... + +class OrderedProperties(Properties[_T], Generic[_T]): + def __init__(self) -> None: ... + +class ImmutableProperties(ImmutableContainer, Properties[_T], Generic[_T]): ... + +OrderedDict = dict + +def sort_dictionary(d, key: Any | None = ...): ... + +class OrderedSet(set[_T], Generic[_T]): + @overload + def __init__(self, d: None = ...) -> None: ... + @overload + def __init__(self, d: Iterable[_T]) -> None: ... + def add(self, element: _T) -> None: ... + def remove(self, element: _T) -> None: ... + def insert(self, pos: int, element: _T) -> None: ... + def discard(self, element: _T) -> None: ... + def clear(self) -> None: ... + def __getitem__(self, key: int) -> _T: ... + def __iter__(self) -> Iterator[_T]: ... + def __add__(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... + def update(self: Self, iterable: Iterable[_T]) -> Self: ... # type: ignore[override] + __ior__ = update # type: ignore[assignment] + def union(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... # type: ignore[override] + __or__ = union # type: ignore[assignment] + def intersection(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + __and__ = intersection # type: ignore[assignment] + def symmetric_difference(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... + __xor__ = symmetric_difference # type: ignore[assignment] + def difference(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + __sub__ = difference # type: ignore[assignment] + def intersection_update(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + __iand__ = intersection_update # type: ignore[assignment] + def symmetric_difference_update(self: Self, other: Iterable[_T]) -> Self: ... # type: ignore[override] + __ixor__ = symmetric_difference_update # type: ignore[assignment] + def difference_update(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + __isub__ = difference_update # type: ignore[assignment] + +class IdentitySet: + def __init__(self, iterable: Any | None = ...) -> None: ... + def add(self, value) -> None: ... + def __contains__(self, value): ... + def remove(self, value) -> None: ... + def discard(self, value) -> None: ... + def pop(self): ... + def clear(self) -> None: ... + def __cmp__(self, other) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def issubset(self, iterable): ... + def __le__(self, other): ... + def __lt__(self, other): ... + def issuperset(self, iterable): ... + def __ge__(self, other): ... + def __gt__(self, other): ... + def union(self, iterable): ... + def __or__(self, other): ... + def update(self, iterable) -> None: ... + def __ior__(self, other): ... + def difference(self, iterable): ... + def __sub__(self, other): ... + def difference_update(self, iterable) -> None: ... + def __isub__(self, other): ... + def intersection(self, iterable): ... + def __and__(self, other): ... + def intersection_update(self, iterable) -> None: ... + def __iand__(self, other): ... + def symmetric_difference(self, iterable): ... + def __xor__(self, other): ... + def symmetric_difference_update(self, iterable) -> None: ... + def __ixor__(self, other): ... + def copy(self): ... + __copy__: Any + def __len__(self): ... + def __iter__(self): ... + def __hash__(self): ... + +class WeakSequence: + def __init__(self, __elements=...) -> None: ... + def append(self, item) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __getitem__(self, index): ... + +class OrderedIdentitySet(IdentitySet): + def __init__(self, iterable: Any | None = ...) -> None: ... + +class PopulateDict(dict[Any, Any]): + creator: Any + def __init__(self, creator) -> None: ... + def __missing__(self, key): ... + +class WeakPopulateDict(dict[Any, Any]): + creator: Any + weakself: Any + def __init__(self, creator_method) -> None: ... + def __missing__(self, key): ... + +column_set = set +column_dict = dict +# Ignore Y026, this isn't a type alias. +# We have to do `ordered_column_set = OrderedSet[_T] +# instead of `ordered_column_set = OrderedSet`, +# or pyright complains +ordered_column_set = OrderedSet[_T] # noqa: Y026 + +def unique_list(seq: Iterable[_T], hashfunc: Callable[[_T], Any] | None = ...) -> list[_T]: ... + +class UniqueAppender: + data: Any + def __init__(self, data, via: Any | None = ...) -> None: ... + def append(self, item) -> None: ... + def __iter__(self): ... + +def coerce_generator_arg(arg): ... +def to_list(x, default: Any | None = ...): ... +def has_intersection(set_, iterable): ... +def to_set(x): ... +def to_column_set(x): ... +def update_copy(d, _new: Any | None = ..., **kw): ... +def flatten_iterator(x) -> None: ... + +class LRUCache(dict[Any, Any]): + capacity: Any + threshold: Any + size_alert: Any + def __init__(self, capacity: int = ..., threshold: float = ..., size_alert: Any | None = ...) -> None: ... + def get(self, key, default: Any | None = ...): ... + def __getitem__(self, key): ... + def values(self): ... + def setdefault(self, key, value): ... + def __setitem__(self, key, value) -> None: ... + @property + def size_threshold(self): ... + +class ScopedRegistry: + createfunc: Any + scopefunc: Any + registry: Any + def __init__(self, createfunc, scopefunc) -> None: ... + def __call__(self): ... + def has(self): ... + def set(self, obj) -> None: ... + def clear(self) -> None: ... + +class ThreadLocalRegistry(ScopedRegistry): + createfunc: Any + registry: Any + def __init__(self, createfunc) -> None: ... + def __call__(self): ... + def has(self): ... + def set(self, obj) -> None: ... + def clear(self) -> None: ... + +def has_dupes(sequence, target): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/_compat_py3k.pyi b/stubs/SQLAlchemy/sqlalchemy/util/_compat_py3k.pyi new file mode 100644 index 0000000..d23165b --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/_compat_py3k.pyi @@ -0,0 +1,10 @@ +from typing import Any + +class _AsyncGeneratorContextManager: + gen: Any + __doc__: Any + def __init__(self, func, args, kwds) -> None: ... + async def __aenter__(self): ... + async def __aexit__(self, typ, value, traceback): ... + +def asynccontextmanager(func): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi b/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi new file mode 100644 index 0000000..702ef9e --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi @@ -0,0 +1,27 @@ +import asyncio as asyncio +from collections.abc import Callable, Coroutine +from typing import Any +from typing_extensions import TypeAlias + +from .langhelpers import memoized_property + +_Greenlet: TypeAlias = Any # actually greenlet.greenlet + +def is_exit_exception(e): ... + +class _AsyncIoGreenlet(_Greenlet): + driver: Any + gr_context: Any + def __init__(self, fn, driver) -> None: ... + +def await_only(awaitable: Coroutine[Any, Any, Any]) -> Any: ... +def await_fallback(awaitable: Coroutine[Any, Any, Any]) -> Any: ... +async def greenlet_spawn(fn: Callable[..., Any], *args, _require_await: bool = ..., **kwargs) -> Any: ... + +class AsyncAdaptedLock: + @memoized_property + def mutex(self): ... + def __enter__(self): ... + def __exit__(self, *arg, **kw) -> None: ... + +def get_event_loop(): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/_preloaded.pyi b/stubs/SQLAlchemy/sqlalchemy/util/_preloaded.pyi new file mode 100644 index 0000000..eaabad3 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/_preloaded.pyi @@ -0,0 +1,11 @@ +from typing import Any + +class _ModuleRegistry: + module_registry: Any + prefix: Any + def __init__(self, prefix: str = ...) -> None: ... + def preload_module(self, *deps): ... + def import_prefix(self, path) -> None: ... + +preloaded: Any +preload_module: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/util/compat.pyi b/stubs/SQLAlchemy/sqlalchemy/util/compat.pyi new file mode 100644 index 0000000..cd2df04 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/compat.pyi @@ -0,0 +1,104 @@ +import builtins +import collections +import contextlib +import itertools +import operator +import pickle as pickle +import threading as threading +from abc import ABC as ABC +from datetime import timezone as timezone +from functools import reduce as reduce +from io import BytesIO as BytesIO, StringIO as StringIO +from itertools import zip_longest as zip_longest +from time import perf_counter as perf_counter +from typing import TYPE_CHECKING as TYPE_CHECKING, Any, NamedTuple +from urllib.parse import ( + parse_qsl as parse_qsl, + quote as quote, + quote_plus as quote_plus, + unquote as unquote, + unquote_plus as unquote_plus, +) + +byte_buffer = BytesIO + +py39: Any +py38: Any +py37: Any +py3k: Any +py2k: Any +pypy: Any +cpython: Any +win32: Any +osx: Any +arm: Any +has_refcount_gc: Any +contextmanager = contextlib.contextmanager +dottedgetter = operator.attrgetter +namedtuple = collections.namedtuple # noqa: Y024 +next = builtins.next + +class FullArgSpec(NamedTuple): + args: Any + varargs: Any + varkw: Any + defaults: Any + kwonlyargs: Any + kwonlydefaults: Any + annotations: Any + +class nullcontext: + enter_result: Any + def __init__(self, enter_result: Any | None = ...) -> None: ... + def __enter__(self): ... + def __exit__(self, *excinfo) -> None: ... + +def inspect_getfullargspec(func): ... +def importlib_metadata_get(group): ... + +string_types: tuple[type, ...] +binary_types: tuple[type, ...] +binary_type = bytes +text_type = str +int_types: tuple[type, ...] +iterbytes = iter +long_type = int +itertools_filterfalse = itertools.filterfalse +itertools_filter = filter +itertools_imap = map +exec_: Any +import_: Any +print_: Any + +def b(s): ... +def b64decode(x): ... +def b64encode(x): ... +def decode_backslashreplace(text, encoding): ... +def cmp(a, b): ... +def raise_(exception, with_traceback: Any | None = ..., replace_context: Any | None = ..., from_: bool = ...) -> None: ... +def u(s): ... +def ue(s): ... + +callable = builtins.callable + +def safe_bytestring(text): ... +def inspect_formatargspec( + args, + varargs: Any | None = ..., + varkw: Any | None = ..., + defaults: Any | None = ..., + kwonlyargs=..., + kwonlydefaults=..., + annotations=..., + formatarg=..., + formatvarargs=..., + formatvarkw=..., + formatvalue=..., + formatreturns=..., + formatannotation=..., +): ... +def dataclass_fields(cls): ... +def local_dataclass_fields(cls): ... +def raise_from_cause(exception, exc_info: Any | None = ...) -> None: ... +def reraise(tp, value, tb: Any | None = ..., cause: Any | None = ...) -> None: ... +def with_metaclass(meta, *bases, **kw): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi b/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi new file mode 100644 index 0000000..40fbc57 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from ._compat_py3k import asynccontextmanager as asynccontextmanager +from ._concurrency_py3k import ( + AsyncAdaptedLock as AsyncAdaptedLock, + await_fallback as await_fallback, + await_only as await_only, + greenlet_spawn as greenlet_spawn, + is_exit_exception as is_exit_exception, +) + +have_greenlet: bool +asyncio: Any | None diff --git a/stubs/SQLAlchemy/sqlalchemy/util/deprecations.pyi b/stubs/SQLAlchemy/sqlalchemy/util/deprecations.pyi new file mode 100644 index 0000000..73f7d17 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/deprecations.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from .langhelpers import ( + decorator as decorator, + inject_docstring_text as inject_docstring_text, + inject_param_text as inject_param_text, +) + +SQLALCHEMY_WARN_20: bool + +def warn_deprecated(msg, version, stacklevel: int = ..., code: Any | None = ...) -> None: ... +def warn_deprecated_limited(msg, args, version, stacklevel: int = ..., code: Any | None = ...) -> None: ... +def warn_deprecated_20(msg, stacklevel: int = ..., code: Any | None = ...) -> None: ... +def deprecated_cls(version, message, constructor: str = ...): ... +def deprecated_20_cls(clsname, alternative: Any | None = ..., constructor: str = ..., becomes_legacy: bool = ...): ... +def deprecated( + version, + message: Any | None = ..., + add_deprecation_to_docstring: bool = ..., + warning: Any | None = ..., + enable_warnings: bool = ..., +): ... +def moved_20(message, **kw): ... +def deprecated_20(api_name, alternative: Any | None = ..., becomes_legacy: bool = ..., **kw): ... +def deprecated_params(**specs): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi b/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi new file mode 100644 index 0000000..8a01199 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi @@ -0,0 +1,163 @@ +from _typeshed import Self +from collections.abc import Callable +from typing import Any, Generic, TypeVar, overload + +from . import compat + +_R = TypeVar("_R") + +def md5_hex(x): ... + +class safe_reraise: + warn_only: Any + def __init__(self, warn_only: bool = ...) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, type_, value, traceback) -> None: ... + +def walk_subclasses(cls) -> None: ... +def string_or_unprintable(element): ... +def clsname_as_plain_name(cls): ... +def method_is_overridden(instance_or_cls, against_method): ... +def decode_slice(slc): ... +def map_bits(fn, n) -> None: ... +def decorator(target): ... +def public_factory(target, location, class_location: Any | None = ...): ... + +class PluginLoader: + group: Any + impls: Any + auto_fn: Any + def __init__(self, group, auto_fn: Any | None = ...) -> None: ... + def clear(self) -> None: ... + def load(self, name): ... + def register(self, name, modulepath, objname): ... + +def get_cls_kwargs(cls, _set: Any | None = ...): ... +def get_func_kwargs(func): ... +def get_callable_argspec(fn, no_self: bool = ..., _is_init: bool = ...): ... +def format_argspec_plus(fn, grouped: bool = ...): ... +def format_argspec_init(method, grouped: bool = ...): ... +def create_proxy_methods( + target_cls, target_cls_sphinx_name, proxy_cls_sphinx_name, classmethods=..., methods=..., attributes=... +): ... +def getargspec_init(method): ... +def unbound_method_to_callable(func_or_cls): ... +def generic_repr(obj, additional_kw=..., to_inspect: Any | None = ..., omit_kwarg=...): ... + +class portable_instancemethod: + target: Any + name: Any + kwargs: Any + def __init__(self, meth, kwargs=...) -> None: ... + def __call__(self, *arg, **kw): ... + +def class_hierarchy(cls): ... +def iterate_attributes(cls) -> None: ... +def monkeypatch_proxied_specials( + into_cls, from_cls, skip: Any | None = ..., only: Any | None = ..., name: str = ..., from_instance: Any | None = ... +) -> None: ... +def methods_equivalent(meth1, meth2): ... +def as_interface(obj, cls: Any | None = ..., methods: Any | None = ..., required: Any | None = ...): ... + +class memoized_property(Generic[_R]): + fget: Callable[..., _R] + __doc__: str + __name__: str + def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ... + @overload + def __get__(self: Self, obj: None, cls: object) -> Self: ... + @overload + def __get__(self, obj: object, cls: object) -> _R: ... + @classmethod + def reset(cls, obj: object, name: str) -> None: ... + +def memoized_instancemethod(fn): ... + +class HasMemoized: + class memoized_attribute(Generic[_R]): + fget: Callable[..., _R] + __doc__: str + __name__: str + def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ... + @overload + def __get__(self: Self, obj: None, cls: object) -> Self: ... + @overload + def __get__(self, obj: object, cls: object) -> _R: ... + + @classmethod + def memoized_instancemethod(cls, fn): ... + +class MemoizedSlots: + def __getattr__(self, key): ... + +def asbool(obj): ... +def bool_or_str(*text): ... +def asint(value): ... +def coerce_kw_type(kw, key, type_, flexi_bool: bool = ..., dest: Any | None = ...) -> None: ... +def constructor_key(obj, cls): ... +def constructor_copy(obj, cls, *args, **kw): ... +def counter(): ... +def duck_type_collection(specimen, default: Any | None = ...): ... +def assert_arg_type(arg, argtype, name): ... +def dictlike_iteritems(dictlike): ... + +class classproperty(property): + __doc__: Any + def __init__(self, fget, *arg, **kw) -> None: ... + def __get__(self, self_, cls): ... + +class hybridproperty(Generic[_R]): + func: Callable[..., _R] + clslevel: Callable[..., _R] + def __init__(self, func: Callable[..., _R]) -> None: ... + @overload + def __get__(self, instance: None, owner: Any) -> _R: ... + @overload + def __get__(self, instance: object, owner: object) -> _R: ... + def classlevel(self: Self, func: Callable[..., _R]) -> Self: ... + +class hybridmethod: + func: Any + clslevel: Any + def __init__(self, func) -> None: ... + def __get__(self, instance, owner): ... + def classlevel(self, func): ... + +class _symbol(int): + def __new__(cls, name, doc: Any | None = ..., canonical: Any | None = ...): ... + def __reduce__(self): ... + +class symbol: + symbols: Any + def __new__(cls, name, doc: Any | None = ..., canonical: Any | None = ...): ... + @classmethod + def parse_user_argument(cls, arg, choices, name, resolve_symbol_names: bool = ...): ... + +def set_creation_order(instance) -> None: ... +def warn_exception(func, *args, **kwargs): ... +def ellipses_string(value, len_: int = ...): ... + +class _hash_limit_string(compat.text_type): + def __new__(cls, value, num, args): ... + def __hash__(self): ... + def __eq__(self, other): ... + +def warn(msg, code: Any | None = ...) -> None: ... +def warn_limited(msg, args) -> None: ... +def only_once(fn, retry_on_exception): ... +def chop_traceback(tb, exclude_prefix=..., exclude_suffix=...): ... + +NoneType: Any + +def attrsetter(attrname): ... + +class EnsureKWArgType(type): + def __init__(cls, clsname, bases, clsdict) -> None: ... + +def wrap_callable(wrapper, fn): ... +def quoted_token_parser(value): ... +def add_parameter_text(params, text): ... +def inject_docstring_text(doctext, injecttext, pos): ... +def inject_param_text(doctext, inject_params): ... +def repr_tuple_names(names): ... +def has_compiled_ext(): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/queue.pyi b/stubs/SQLAlchemy/sqlalchemy/util/queue.pyi new file mode 100644 index 0000000..d7b986a --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/queue.pyi @@ -0,0 +1,34 @@ +from typing import Any + +class Empty(Exception): ... +class Full(Exception): ... + +class Queue: + mutex: Any + not_empty: Any + not_full: Any + use_lifo: Any + def __init__(self, maxsize: int = ..., use_lifo: bool = ...) -> None: ... + def qsize(self): ... + def empty(self): ... + def full(self): ... + def put(self, item, block: bool = ..., timeout: Any | None = ...) -> None: ... + def put_nowait(self, item): ... + def get(self, block: bool = ..., timeout: Any | None = ...): ... + def get_nowait(self): ... + +class AsyncAdaptedQueue: + await_: Any + use_lifo: Any + maxsize: Any + def __init__(self, maxsize: int = ..., use_lifo: bool = ...) -> None: ... + def empty(self): ... + def full(self): ... + def qsize(self): ... + def put_nowait(self, item): ... + def put(self, item, block: bool = ..., timeout: Any | None = ...): ... + def get_nowait(self): ... + def get(self, block: bool = ..., timeout: Any | None = ...): ... + +class FallbackAsyncAdaptedQueue(AsyncAdaptedQueue): + await_: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/util/topological.pyi b/stubs/SQLAlchemy/sqlalchemy/util/topological.pyi new file mode 100644 index 0000000..04428e1 --- /dev/null +++ b/stubs/SQLAlchemy/sqlalchemy/util/topological.pyi @@ -0,0 +1,3 @@ +def sort_as_subsets(tuples, allitems) -> None: ... +def sort(tuples, allitems, deterministic_order: bool = ...) -> None: ... +def find_cycles(tuples, allitems): ... diff --git a/stubs/Send2Trash/METADATA.toml b/stubs/Send2Trash/METADATA.toml index 71d7853..690242a 100644 --- a/stubs/Send2Trash/METADATA.toml +++ b/stubs/Send2Trash/METADATA.toml @@ -1 +1 @@ -version = "1.8" +version = "1.8.*" diff --git a/stubs/Send2Trash/send2trash/__init__.pyi b/stubs/Send2Trash/send2trash/__init__.pyi index 5fa3c59..9ff00ba 100644 --- a/stubs/Send2Trash/send2trash/__init__.pyi +++ b/stubs/Send2Trash/send2trash/__init__.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrOrBytesPath +from _typeshed import Incomplete, StrOrBytesPath from typing import Any from .exceptions import TrashPermissionError as TrashPermissionError @@ -7,4 +7,4 @@ from .exceptions import TrashPermissionError as TrashPermissionError def send2trash(paths: list[Any] | StrOrBytesPath) -> None: ... # Marked as incomplete because there are platform-specific plat_foo modules -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/Send2Trash/send2trash/exceptions.pyi b/stubs/Send2Trash/send2trash/exceptions.pyi index 7e2ca98..a263f65 100644 --- a/stubs/Send2Trash/send2trash/exceptions.pyi +++ b/stubs/Send2Trash/send2trash/exceptions.pyi @@ -1,2 +1,5 @@ +from typing import Any + class TrashPermissionError(PermissionError): - def __init__(self, filename) -> None: ... + # Typed the same as `filename` in `PermissionError`: + def __init__(self, filename: Any) -> None: ... diff --git a/stubs/Send2Trash/send2trash/util.pyi b/stubs/Send2Trash/send2trash/util.pyi index e23e382..c89143c 100644 --- a/stubs/Send2Trash/send2trash/util.pyi +++ b/stubs/Send2Trash/send2trash/util.pyi @@ -1 +1,5 @@ -def preprocess_paths(paths): ... +from _typeshed import StrOrBytesPath +from typing import Any + +# Should be consistent with `__init__.py` +def preprocess_paths(paths: list[Any] | StrOrBytesPath) -> list[str | bytes]: ... diff --git a/stubs/Werkzeug/@tests/stubtest_allowlist.txt b/stubs/Werkzeug/@tests/stubtest_allowlist.txt deleted file mode 100644 index 297b167..0000000 --- a/stubs/Werkzeug/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,149 +0,0 @@ -werkzeug.HTTP_STATUS_CODES -werkzeug._compat.BytesIO.readlines -werkzeug._compat.BytesIO.seek -werkzeug._compat.StringIO.seek -werkzeug._compat.StringIO.truncate -werkzeug._compat.fix_tuple_repr -werkzeug._compat.implements_bool -werkzeug._compat.implements_iterator -werkzeug._compat.implements_to_string -werkzeug._compat.native_string_result -werkzeug._compat.try_coerce_native -werkzeug.append_slash_redirect -werkzeug.bind_arguments -werkzeug.check_password_hash -werkzeug.contrib -werkzeug.contrib.atom -werkzeug.contrib.cache -werkzeug.contrib.fixers -werkzeug.contrib.iterio -werkzeug.contrib.jsrouting -werkzeug.contrib.limiter -werkzeug.contrib.lint -werkzeug.contrib.profiler -werkzeug.contrib.securecookie -werkzeug.contrib.sessions -werkzeug.contrib.testtools -werkzeug.contrib.wrappers -werkzeug.cookie_date -werkzeug.create_environ -werkzeug.datastructures.Headers.__delitem__ -werkzeug.datastructures.Headers.pop -werkzeug.datastructures.Headers.setdefault -werkzeug.datastructures.Headers.to_list -werkzeug.datastructures.ImmutableDictMixin.fromkeys -werkzeug.datastructures.ImmutableHeadersMixin.add -werkzeug.datastructures.ImmutableHeadersMixin.pop -werkzeug.debug.DebuggedApplication.__init__ -werkzeug.debug.tbtools.Frame.console -werkzeug.debug.tbtools.Frame.render -werkzeug.debug.tbtools.Frame.sourcelines -werkzeug.debug.tbtools.Line.classes -werkzeug.debug.tbtools.Traceback.exception -werkzeug.debug.tbtools.Traceback.generate_plaintext_traceback -werkzeug.debug.tbtools.Traceback.is_syntax_error -werkzeug.debug.tbtools.Traceback.plaintext -werkzeug.dump_cookie -werkzeug.dump_header -werkzeug.dump_options_header -werkzeug.escape -werkzeug.exceptions.BadRequestKeyError.__init__ -werkzeug.extract_path_info -werkzeug.find_modules -werkzeug.format_string -werkzeug.generate_etag -werkzeug.generate_password_hash -werkzeug.get_current_url -werkzeug.get_host -werkzeug.html -werkzeug.http.dump_age -werkzeug.http.dump_cookie -werkzeug.http.parse_accept_header -werkzeug.http.parse_cache_control_header -werkzeug.http_date -werkzeug.import_string -werkzeug.iri_to_uri -werkzeug.is_entity_header -werkzeug.is_hop_by_hop_header -werkzeug.is_resource_modified -werkzeug.local.LocalProxy.__delslice__ -werkzeug.local.LocalProxy.__dict__ -werkzeug.local.LocalProxy.__setslice__ -werkzeug.local.LocalStack._get__ident_func__ -werkzeug.local.LocalStack._set__ident_func__ -werkzeug.make_line_iter -werkzeug.middleware.proxy_fix.ProxyFix.__init__ -werkzeug.middleware.proxy_fix.ProxyFix.get_remote_addr -werkzeug.middleware.shared_data.SharedDataMiddleware.__call__ -werkzeug.module -werkzeug.parse_accept_header -werkzeug.parse_authorization_header -werkzeug.parse_cache_control_header -werkzeug.parse_cookie -werkzeug.parse_date -werkzeug.parse_dict_header -werkzeug.parse_etags -werkzeug.parse_form_data -werkzeug.parse_list_header -werkzeug.parse_options_header -werkzeug.parse_set_header -werkzeug.parse_www_authenticate_header -werkzeug.peek_path_info -werkzeug.pop_path_info -werkzeug.posixemulation.rename -werkzeug.quote_etag -werkzeug.quote_header_value -werkzeug.redirect -werkzeug.release_local -werkzeug.remove_entity_headers -werkzeug.remove_hop_by_hop_headers -werkzeug.responder -werkzeug.routing.FloatConverter.__init__ -werkzeug.routing.Map.__init__ -werkzeug.routing.MapAdapter.match -werkzeug.routing.NumberConverter.__init__ -werkzeug.routing.RequestRedirect.get_response -werkzeug.routing.RequestSlash -werkzeug.routing.Rule.__init__ -werkzeug.run_wsgi_app -werkzeug.script -werkzeug.secure_filename -werkzeug.serving.select_ip_version -werkzeug.test.Client.set_cookie -werkzeug.test.EnvironBuilder.__init__ -werkzeug.test.File -werkzeug.test_app -werkzeug.unescape -werkzeug.unquote_etag -werkzeug.unquote_header_value -werkzeug.uri_to_iri -werkzeug.url_decode -werkzeug.url_encode -werkzeug.url_fix -werkzeug.url_quote -werkzeug.url_quote_plus -werkzeug.url_unquote -werkzeug.url_unquote_plus -werkzeug.utils.escape -werkzeug.validate_arguments -werkzeug.wrap_file -werkzeug.wrappers.BaseRequest.input_stream -werkzeug.wrappers.BaseRequest.is_multiprocess -werkzeug.wrappers.BaseRequest.is_multithread -werkzeug.wrappers.BaseRequest.is_run_once -werkzeug.wrappers.BaseRequest.max_form_memory_size -werkzeug.wrappers.BaseRequest.method -werkzeug.wrappers.BaseRequest.query_string -werkzeug.wrappers.BaseRequest.remote_user -werkzeug.wrappers.BaseRequest.scheme -werkzeug.wrappers.BaseResponse.freeze -werkzeug.wrappers.CommonResponseDescriptorsMixin.content_encoding -werkzeug.wrappers.CommonResponseDescriptorsMixin.content_length -werkzeug.wrappers.CommonResponseDescriptorsMixin.content_location -werkzeug.wrappers.CommonResponseDescriptorsMixin.content_md5 -werkzeug.wrappers.CommonResponseDescriptorsMixin.content_type -werkzeug.wrappers.CommonResponseDescriptorsMixin.location -werkzeug.wsgi.DispatcherMiddleware -werkzeug.wsgi.ProxyMiddleware -werkzeug.wsgi.SharedDataMiddleware -werkzeug.xhtml diff --git a/stubs/Werkzeug/METADATA.toml b/stubs/Werkzeug/METADATA.toml deleted file mode 100644 index 699e012..0000000 --- a/stubs/Werkzeug/METADATA.toml +++ /dev/null @@ -1,4 +0,0 @@ -version = "1.0" -python2 = true -requires = [] -obsolete_since = "2.0" diff --git a/stubs/Werkzeug/werkzeug/__init__.pyi b/stubs/Werkzeug/werkzeug/__init__.pyi deleted file mode 100644 index 8c351ab..0000000 --- a/stubs/Werkzeug/werkzeug/__init__.pyi +++ /dev/null @@ -1,151 +0,0 @@ -from types import ModuleType -from typing import Any - -from werkzeug import ( - _internal, - datastructures, - debug, - exceptions, - formparser, - http, - local, - security, - serving, - test, - testapp, - urls, - useragents, - utils, - wrappers, - wsgi, -) - -class module(ModuleType): - def __getattr__(self, name): ... - def __dir__(self): ... - -__version__: Any - -run_simple = serving.run_simple -test_app = testapp.test_app -UserAgent = useragents.UserAgent -_easteregg = _internal._easteregg -DebuggedApplication = debug.DebuggedApplication -MultiDict = datastructures.MultiDict -CombinedMultiDict = datastructures.CombinedMultiDict -Headers = datastructures.Headers -EnvironHeaders = datastructures.EnvironHeaders -ImmutableList = datastructures.ImmutableList -ImmutableDict = datastructures.ImmutableDict -ImmutableMultiDict = datastructures.ImmutableMultiDict -TypeConversionDict = datastructures.TypeConversionDict -ImmutableTypeConversionDict = datastructures.ImmutableTypeConversionDict -Accept = datastructures.Accept -MIMEAccept = datastructures.MIMEAccept -CharsetAccept = datastructures.CharsetAccept -LanguageAccept = datastructures.LanguageAccept -RequestCacheControl = datastructures.RequestCacheControl -ResponseCacheControl = datastructures.ResponseCacheControl -ETags = datastructures.ETags -HeaderSet = datastructures.HeaderSet -WWWAuthenticate = datastructures.WWWAuthenticate -Authorization = datastructures.Authorization -FileMultiDict = datastructures.FileMultiDict -CallbackDict = datastructures.CallbackDict -FileStorage = datastructures.FileStorage -OrderedMultiDict = datastructures.OrderedMultiDict -ImmutableOrderedMultiDict = datastructures.ImmutableOrderedMultiDict -escape = utils.escape -environ_property = utils.environ_property -append_slash_redirect = utils.append_slash_redirect -redirect = utils.redirect -cached_property = utils.cached_property -import_string = utils.import_string -dump_cookie = http.dump_cookie -parse_cookie = http.parse_cookie -unescape = utils.unescape -format_string = utils.format_string -find_modules = utils.find_modules -header_property = utils.header_property -html = utils.html -xhtml = utils.xhtml -HTMLBuilder = utils.HTMLBuilder -validate_arguments = utils.validate_arguments -ArgumentValidationError = utils.ArgumentValidationError -bind_arguments = utils.bind_arguments -secure_filename = utils.secure_filename -BaseResponse = wrappers.BaseResponse -BaseRequest = wrappers.BaseRequest -Request = wrappers.Request -Response = wrappers.Response -AcceptMixin = wrappers.AcceptMixin -ETagRequestMixin = wrappers.ETagRequestMixin -ETagResponseMixin = wrappers.ETagResponseMixin -ResponseStreamMixin = wrappers.ResponseStreamMixin -CommonResponseDescriptorsMixin = wrappers.CommonResponseDescriptorsMixin -UserAgentMixin = wrappers.UserAgentMixin -AuthorizationMixin = wrappers.AuthorizationMixin -WWWAuthenticateMixin = wrappers.WWWAuthenticateMixin -CommonRequestDescriptorsMixin = wrappers.CommonRequestDescriptorsMixin -Local = local.Local -LocalManager = local.LocalManager -LocalProxy = local.LocalProxy -LocalStack = local.LocalStack -release_local = local.release_local -generate_password_hash = security.generate_password_hash -check_password_hash = security.check_password_hash -Client = test.Client -EnvironBuilder = test.EnvironBuilder -create_environ = test.create_environ -run_wsgi_app = test.run_wsgi_app -get_current_url = wsgi.get_current_url -get_host = wsgi.get_host -pop_path_info = wsgi.pop_path_info -peek_path_info = wsgi.peek_path_info -SharedDataMiddleware = wsgi.SharedDataMiddleware -DispatcherMiddleware = wsgi.DispatcherMiddleware -ClosingIterator = wsgi.ClosingIterator -FileWrapper = wsgi.FileWrapper -make_line_iter = wsgi.make_line_iter -LimitedStream = wsgi.LimitedStream -responder = wsgi.responder -wrap_file = wsgi.wrap_file -extract_path_info = wsgi.extract_path_info -parse_etags = http.parse_etags -parse_date = http.parse_date -http_date = http.http_date -cookie_date = http.cookie_date -parse_cache_control_header = http.parse_cache_control_header -is_resource_modified = http.is_resource_modified -parse_accept_header = http.parse_accept_header -parse_set_header = http.parse_set_header -quote_etag = http.quote_etag -unquote_etag = http.unquote_etag -generate_etag = http.generate_etag -dump_header = http.dump_header -parse_list_header = http.parse_list_header -parse_dict_header = http.parse_dict_header -parse_authorization_header = http.parse_authorization_header -parse_www_authenticate_header = http.parse_www_authenticate_header -remove_entity_headers = http.remove_entity_headers -is_entity_header = http.is_entity_header -remove_hop_by_hop_headers = http.remove_hop_by_hop_headers -parse_options_header = http.parse_options_header -dump_options_header = http.dump_options_header -is_hop_by_hop_header = http.is_hop_by_hop_header -unquote_header_value = http.unquote_header_value -quote_header_value = http.quote_header_value -HTTP_STATUS_CODES = http.HTTP_STATUS_CODES -url_decode = urls.url_decode -url_encode = urls.url_encode -url_quote = urls.url_quote -url_quote_plus = urls.url_quote_plus -url_unquote = urls.url_unquote -url_unquote_plus = urls.url_unquote_plus -url_fix = urls.url_fix -Href = urls.Href -iri_to_uri = urls.iri_to_uri -uri_to_iri = urls.uri_to_iri -parse_form_data = formparser.parse_form_data -abort = exceptions.Aborter -Aborter = exceptions.Aborter diff --git a/stubs/Werkzeug/werkzeug/_compat.pyi b/stubs/Werkzeug/werkzeug/_compat.pyi deleted file mode 100644 index 788f16f..0000000 --- a/stubs/Werkzeug/werkzeug/_compat.pyi +++ /dev/null @@ -1,53 +0,0 @@ -import sys -from typing import Any, Text - -if sys.version_info >= (3,): - from io import BytesIO as BytesIO, StringIO as StringIO - - NativeStringIO = StringIO -else: - import cStringIO - from StringIO import StringIO as StringIO - - BytesIO = cStringIO.StringIO - NativeStringIO = BytesIO - -PY2: Any -WIN: Any -unichr: Any -text_type: Any -string_types: Any -integer_types: Any -iterkeys: Any -itervalues: Any -iteritems: Any -iterlists: Any -iterlistvalues: Any -int_to_byte: Any -iter_bytes: Any - -def fix_tuple_repr(obj): ... -def implements_iterator(cls): ... -def implements_to_string(cls): ... -def native_string_result(func): ... -def implements_bool(cls): ... - -range_type: Any - -def make_literal_wrapper(reference): ... -def normalize_string_tuple(tup): ... -def try_coerce_native(s): ... - -wsgi_get_bytes: Any - -def wsgi_decoding_dance(s, charset: Text = ..., errors: Text = ...): ... -def wsgi_encoding_dance(s, charset: Text = ..., errors: Text = ...): ... -def to_bytes(x, charset: Text = ..., errors: Text = ...): ... -def to_native(x, charset: Text = ..., errors: Text = ...): ... -def reraise(tp, value, tb: Any | None = ...): ... - -imap: Any -izip: Any -ifilter: Any - -def to_unicode(x, charset: Text = ..., errors: Text = ..., allow_none_charset: bool = ...): ... diff --git a/stubs/Werkzeug/werkzeug/_internal.pyi b/stubs/Werkzeug/werkzeug/_internal.pyi deleted file mode 100644 index 2deec4f..0000000 --- a/stubs/Werkzeug/werkzeug/_internal.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from typing import Any - -class _Missing: - def __reduce__(self): ... - -class _DictAccessorProperty: - read_only: Any - name: Any - default: Any - load_func: Any - dump_func: Any - __doc__: Any - def __init__( - self, - name, - default: Any | None = ..., - load_func: Any | None = ..., - dump_func: Any | None = ..., - read_only: Any | None = ..., - doc: Any | None = ..., - ): ... - def __get__(self, obj, type: Any | None = ...): ... - def __set__(self, obj, value): ... - def __delete__(self, obj): ... - -def _easteregg(app: Any | None = ...): ... diff --git a/stubs/Werkzeug/werkzeug/_reloader.pyi b/stubs/Werkzeug/werkzeug/_reloader.pyi deleted file mode 100644 index 5e9f958..0000000 --- a/stubs/Werkzeug/werkzeug/_reloader.pyi +++ /dev/null @@ -1,29 +0,0 @@ -from typing import Any - -class ReloaderLoop: - name: Any - extra_files: Any - interval: float - def __init__(self, extra_files: Any | None = ..., interval: float = ...): ... - def run(self): ... - def restart_with_reloader(self): ... - def trigger_reload(self, filename): ... - def log_reload(self, filename): ... - -class StatReloaderLoop(ReloaderLoop): - name: Any - def run(self): ... - -class WatchdogReloaderLoop(ReloaderLoop): - observable_paths: Any - name: Any - observer_class: Any - event_handler: Any - should_reload: Any - def __init__(self, *args, **kwargs): ... - def trigger_reload(self, filename): ... - def run(self): ... - -reloader_loops: Any - -def run_with_reloader(main_func, extra_files: Any | None = ..., interval: float = ..., reloader_type: str = ...): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/atom.pyi b/stubs/Werkzeug/werkzeug/contrib/atom.pyi deleted file mode 100644 index 8c73bb9..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/atom.pyi +++ /dev/null @@ -1,50 +0,0 @@ -from typing import Any - -XHTML_NAMESPACE: Any - -def format_iso8601(obj): ... - -class AtomFeed: - default_generator: Any - title: Any - title_type: Any - url: Any - feed_url: Any - id: Any - updated: Any - author: Any - icon: Any - logo: Any - rights: Any - rights_type: Any - subtitle: Any - subtitle_type: Any - generator: Any - links: Any - entries: Any - def __init__(self, title: Any | None = ..., entries: Any | None = ..., **kwargs): ... - def add(self, *args, **kwargs): ... - def generate(self): ... - def to_string(self): ... - def get_response(self): ... - def __call__(self, environ, start_response): ... - -class FeedEntry: - title: Any - title_type: Any - content: Any - content_type: Any - url: Any - id: Any - updated: Any - summary: Any - summary_type: Any - author: Any - published: Any - rights: Any - links: Any - categories: Any - xml_base: Any - def __init__(self, title: Any | None = ..., content: Any | None = ..., feed_url: Any | None = ..., **kwargs): ... - def generate(self): ... - def to_string(self): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/cache.pyi b/stubs/Werkzeug/werkzeug/contrib/cache.pyi deleted file mode 100644 index 9584145..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/cache.pyi +++ /dev/null @@ -1,92 +0,0 @@ -from typing import Any - -class BaseCache: - default_timeout: float - def __init__(self, default_timeout: float = ...): ... - def get(self, key): ... - def delete(self, key): ... - def get_many(self, *keys): ... - def get_dict(self, *keys): ... - def set(self, key, value, timeout: float | None = ...): ... - def add(self, key, value, timeout: float | None = ...): ... - def set_many(self, mapping, timeout: float | None = ...): ... - def delete_many(self, *keys): ... - def has(self, key): ... - def clear(self): ... - def inc(self, key, delta=...): ... - def dec(self, key, delta=...): ... - -class NullCache(BaseCache): ... - -class SimpleCache(BaseCache): - clear: Any - def __init__(self, threshold: int = ..., default_timeout: float = ...): ... - def get(self, key): ... - def set(self, key, value, timeout: float | None = ...): ... - def add(self, key, value, timeout: float | None = ...): ... - def delete(self, key): ... - def has(self, key): ... - -class MemcachedCache(BaseCache): - key_prefix: Any - def __init__(self, servers: Any | None = ..., default_timeout: float = ..., key_prefix: Any | None = ...): ... - def get(self, key): ... - def get_dict(self, *keys): ... - def add(self, key, value, timeout: float | None = ...): ... - def set(self, key, value, timeout: float | None = ...): ... - def get_many(self, *keys): ... - def set_many(self, mapping, timeout: float | None = ...): ... - def delete(self, key): ... - def delete_many(self, *keys): ... - def has(self, key): ... - def clear(self): ... - def inc(self, key, delta=...): ... - def dec(self, key, delta=...): ... - def import_preferred_memcache_lib(self, servers): ... - -GAEMemcachedCache: Any - -class RedisCache(BaseCache): - key_prefix: Any - def __init__( - self, - host: str = ..., - port: int = ..., - password: Any | None = ..., - db: int = ..., - default_timeout: float = ..., - key_prefix: Any | None = ..., - **kwargs, - ): ... - def dump_object(self, value): ... - def load_object(self, value): ... - def get(self, key): ... - def get_many(self, *keys): ... - def set(self, key, value, timeout: float | None = ...): ... - def add(self, key, value, timeout: float | None = ...): ... - def set_many(self, mapping, timeout: float | None = ...): ... - def delete(self, key): ... - def delete_many(self, *keys): ... - def has(self, key): ... - def clear(self): ... - def inc(self, key, delta=...): ... - def dec(self, key, delta=...): ... - -class FileSystemCache(BaseCache): - def __init__(self, cache_dir, threshold: int = ..., default_timeout: float = ..., mode: int = ...): ... - def clear(self): ... - def get(self, key): ... - def add(self, key, value, timeout: float | None = ...): ... - def set(self, key, value, timeout: float | None = ...): ... - def delete(self, key): ... - def has(self, key): ... - -class UWSGICache(BaseCache): - cache: Any - def __init__(self, default_timeout: float = ..., cache: str = ...): ... - def get(self, key): ... - def delete(self, key): ... - def set(self, key, value, timeout: float | None = ...): ... - def add(self, key, value, timeout: float | None = ...): ... - def clear(self): ... - def has(self, key): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/fixers.pyi b/stubs/Werkzeug/werkzeug/contrib/fixers.pyi deleted file mode 100644 index 37097f4..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/fixers.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Any, Iterable, Mapping, Set, Text - -from ..middleware.proxy_fix import ProxyFix as ProxyFix - -class CGIRootFix(object): - app: WSGIApplication - app_root: Text - def __init__(self, app: WSGIApplication, app_root: Text = ...) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... - -class LighttpdCGIRootFix(CGIRootFix): ... - -class PathInfoFromRequestUriFix(object): - app: WSGIApplication - def __init__(self, app: WSGIApplication) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... - -class HeaderRewriterFix(object): - app: WSGIApplication - remove_headers: Set[Text] - add_headers: list[Text] - def __init__( - self, app: WSGIApplication, remove_headers: Iterable[Text] | None = ..., add_headers: Iterable[Text] | None = ... - ) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... - -class InternetExplorerFix(object): - app: WSGIApplication - fix_vary: bool - fix_attach: bool - def __init__(self, app: WSGIApplication, fix_vary: bool = ..., fix_attach: bool = ...) -> None: ... - def fix_headers(self, environ: WSGIEnvironment, headers: Mapping[str, str], status: Any | None = ...) -> None: ... - def run_fixed(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/contrib/iterio.pyi b/stubs/Werkzeug/werkzeug/contrib/iterio.pyi deleted file mode 100644 index 08162fd..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/iterio.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from typing import Any, Text - -greenlet: Any - -class IterIO: - def __new__(cls, obj, sentinel: Text | bytes = ...): ... - def __iter__(self): ... - def tell(self): ... - def isatty(self): ... - def seek(self, pos, mode: int = ...): ... - def truncate(self, size: Any | None = ...): ... - def write(self, s): ... - def writelines(self, list): ... - def read(self, n: int = ...): ... - def readlines(self, sizehint: int = ...): ... - def readline(self, length: Any | None = ...): ... - def flush(self): ... - def __next__(self): ... - -class IterI(IterIO): - sentinel: Any - def __new__(cls, func, sentinel: Text | bytes = ...): ... - closed: Any - def close(self): ... - def write(self, s): ... - def writelines(self, list): ... - def flush(self): ... - -class IterO(IterIO): - sentinel: Any - closed: Any - pos: Any - def __new__(cls, gen, sentinel: Text | bytes = ...): ... - def __iter__(self): ... - def close(self): ... - def seek(self, pos, mode: int = ...): ... - def read(self, n: int = ...): ... - def readline(self, length: Any | None = ...): ... - def readlines(self, sizehint: int = ...): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/jsrouting.pyi b/stubs/Werkzeug/werkzeug/contrib/jsrouting.pyi deleted file mode 100644 index 46f1972..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/jsrouting.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any - -def dumps(*args): ... -def render_template(name_parts, rules, converters): ... -def generate_map(map, name: str = ...): ... -def generate_adapter(adapter, name: str = ..., map_name: str = ...): ... -def js_to_url_function(converter): ... -def NumberConverter_js_to_url(conv): ... - -js_to_url_functions: Any diff --git a/stubs/Werkzeug/werkzeug/contrib/limiter.pyi b/stubs/Werkzeug/werkzeug/contrib/limiter.pyi deleted file mode 100644 index 0734a24..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/limiter.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Any - -class StreamLimitMiddleware: - app: Any - maximum_size: Any - def __init__(self, app, maximum_size=...): ... - def __call__(self, environ, start_response): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/lint.pyi b/stubs/Werkzeug/werkzeug/contrib/lint.pyi deleted file mode 100644 index 9a25daf..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/lint.pyi +++ /dev/null @@ -1 +0,0 @@ -from ..middleware.lint import * diff --git a/stubs/Werkzeug/werkzeug/contrib/profiler.pyi b/stubs/Werkzeug/werkzeug/contrib/profiler.pyi deleted file mode 100644 index eb32ea4..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/profiler.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from _typeshed import SupportsWrite -from typing import AnyStr, Generic, Tuple - -from ..middleware.profiler import * - -class MergeStream(Generic[AnyStr]): - streams: Tuple[SupportsWrite[AnyStr], ...] - def __init__(self, *streams: SupportsWrite[AnyStr]) -> None: ... - def write(self, data: AnyStr) -> None: ... diff --git a/stubs/Werkzeug/werkzeug/contrib/securecookie.pyi b/stubs/Werkzeug/werkzeug/contrib/securecookie.pyi deleted file mode 100644 index 30f27b3..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/securecookie.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from hashlib import sha1 as _default_hash -from hmac import new as hmac -from typing import Any - -from werkzeug.contrib.sessions import ModificationTrackingDict - -class UnquoteError(Exception): ... - -class SecureCookie(ModificationTrackingDict[Any, Any]): - hash_method: Any - serialization_method: Any - quote_base64: Any - secret_key: Any - new: Any - def __init__(self, data: Any | None = ..., secret_key: Any | None = ..., new: bool = ...): ... - @property - def should_save(self): ... - @classmethod - def quote(cls, value): ... - @classmethod - def unquote(cls, value): ... - def serialize(self, expires: Any | None = ...): ... - @classmethod - def unserialize(cls, string, secret_key): ... - @classmethod - def load_cookie(cls, request, key: str = ..., secret_key: Any | None = ...): ... - def save_cookie( - self, - response, - key: str = ..., - expires: Any | None = ..., - session_expires: Any | None = ..., - max_age: Any | None = ..., - path: str = ..., - domain: Any | None = ..., - secure: Any | None = ..., - httponly: bool = ..., - force: bool = ..., - ): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/sessions.pyi b/stubs/Werkzeug/werkzeug/contrib/sessions.pyi deleted file mode 100644 index 2d0bba5..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/sessions.pyi +++ /dev/null @@ -1,77 +0,0 @@ -from typing import Any, Text, TypeVar - -from werkzeug.datastructures import CallbackDict - -_K = TypeVar("_K") -_V = TypeVar("_V") - -def generate_key(salt: Any | None = ...): ... - -class ModificationTrackingDict(CallbackDict[_K, _V]): - modified: Any - def __init__(self, *args, **kwargs): ... - def copy(self): ... - def __copy__(self): ... - -class Session(ModificationTrackingDict[_K, _V]): - sid: Any - new: Any - def __init__(self, data, sid, new: bool = ...): ... - @property - def should_save(self): ... - -class SessionStore: - session_class: Any - def __init__(self, session_class: Any | None = ...): ... - def is_valid_key(self, key): ... - def generate_key(self, salt: Any | None = ...): ... - def new(self): ... - def save(self, session): ... - def save_if_modified(self, session): ... - def delete(self, session): ... - def get(self, sid): ... - -class FilesystemSessionStore(SessionStore): - path: Any - filename_template: str - renew_missing: Any - mode: Any - def __init__( - self, - path: Any | None = ..., - filename_template: Text = ..., - session_class: Any | None = ..., - renew_missing: bool = ..., - mode: int = ..., - ): ... - def get_session_filename(self, sid): ... - def save(self, session): ... - def delete(self, session): ... - def get(self, sid): ... - def list(self): ... - -class SessionMiddleware: - app: Any - store: Any - cookie_name: Any - cookie_age: Any - cookie_expires: Any - cookie_path: Any - cookie_domain: Any - cookie_secure: Any - cookie_httponly: Any - environ_key: Any - def __init__( - self, - app, - store, - cookie_name: str = ..., - cookie_age: Any | None = ..., - cookie_expires: Any | None = ..., - cookie_path: str = ..., - cookie_domain: Any | None = ..., - cookie_secure: Any | None = ..., - cookie_httponly: bool = ..., - environ_key: str = ..., - ): ... - def __call__(self, environ, start_response): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/testtools.pyi b/stubs/Werkzeug/werkzeug/contrib/testtools.pyi deleted file mode 100644 index da0f92d..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/testtools.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from werkzeug.wrappers import Response - -class ContentAccessors: - def xml(self): ... - def lxml(self): ... - def json(self): ... - -class TestResponse(Response, ContentAccessors): ... diff --git a/stubs/Werkzeug/werkzeug/contrib/wrappers.pyi b/stubs/Werkzeug/werkzeug/contrib/wrappers.pyi deleted file mode 100644 index 683eda0..0000000 --- a/stubs/Werkzeug/werkzeug/contrib/wrappers.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Any - -def is_known_charset(charset): ... - -class JSONRequestMixin: - def json(self): ... - -class ProtobufRequestMixin: - protobuf_check_initialization: Any - def parse_protobuf(self, proto_type): ... - -class RoutingArgsRequestMixin: - routing_args: Any - routing_vars: Any - -class ReverseSlashBehaviorRequestMixin: - def path(self): ... - def script_root(self): ... - -class DynamicCharsetRequestMixin: - default_charset: Any - def unknown_charset(self, charset): ... - def charset(self): ... - -class DynamicCharsetResponseMixin: - default_charset: Any - charset: Any diff --git a/stubs/Werkzeug/werkzeug/datastructures.pyi b/stubs/Werkzeug/werkzeug/datastructures.pyi deleted file mode 100644 index bd35c65..0000000 --- a/stubs/Werkzeug/werkzeug/datastructures.pyi +++ /dev/null @@ -1,474 +0,0 @@ -import sys -from _typeshed import SupportsWrite -from typing import ( - IO, - Any, - Callable, - Container, - Dict, - Generic, - Iterable, - Iterator, - List, - Mapping, - MutableSet, - NoReturn, - Text, - Tuple, - Type, - TypeVar, - overload, -) - -if sys.version_info >= (3, 8): - from typing import SupportsIndex -else: - from typing_extensions import SupportsIndex - -_K = TypeVar("_K") -_V = TypeVar("_V") -_R = TypeVar("_R") -_D = TypeVar("_D") - -def is_immutable(self) -> NoReturn: ... -def iter_multi_items(mapping): ... -def native_itermethods(names): ... - -class ImmutableListMixin(Generic[_V]): - def __hash__(self) -> int: ... - def __reduce_ex__(self: _D, protocol) -> Tuple[Type[_D], list[_V]]: ... - def __delitem__(self, key: _V) -> NoReturn: ... - def __iadd__(self, other: Any) -> NoReturn: ... - def __imul__(self, other: Any) -> NoReturn: ... - def __setitem__(self, key: str, value: Any) -> NoReturn: ... - def append(self, item: Any) -> NoReturn: ... - def remove(self, item: Any) -> NoReturn: ... - def extend(self, iterable: Any) -> NoReturn: ... - def insert(self, pos: int, value: Any) -> NoReturn: ... - def pop(self, index: int = ...) -> NoReturn: ... - def reverse(self) -> NoReturn: ... - def sort(self, cmp: Any | None = ..., key: Any | None = ..., reverse: Any | None = ...) -> NoReturn: ... - -class ImmutableList(ImmutableListMixin[_V], List[_V]): ... # type: ignore - -class ImmutableDictMixin(object): - @classmethod - def fromkeys(cls, *args, **kwargs): ... - def __reduce_ex__(self, protocol): ... - def __hash__(self) -> int: ... - def setdefault(self, key, default: Any | None = ...): ... - def update(self, *args, **kwargs): ... - def pop(self, key, default: Any | None = ...): ... - def popitem(self): ... - def __setitem__(self, key, value): ... - def __delitem__(self, key): ... - def clear(self): ... - -class ImmutableMultiDictMixin(ImmutableDictMixin): - def __reduce_ex__(self, protocol): ... - def add(self, key, value): ... - def popitemlist(self): ... - def poplist(self, key): ... - def setlist(self, key, new_list): ... - def setlistdefault(self, key, default_list: Any | None = ...): ... - -class UpdateDictMixin(object): - on_update: Any - def setdefault(self, key, default: Any | None = ...): ... - def pop(self, key, default=...): ... - __setitem__: Any - __delitem__: Any - clear: Any - popitem: Any - update: Any - -class TypeConversionDict(Dict[_K, _V]): - @overload - def get(self, key: _K, *, type: None = ...) -> _V | None: ... - @overload - def get(self, key: _K, default: _D, type: None = ...) -> _V | _D: ... - @overload - def get(self, key: _K, *, type: Callable[[_V], _R]) -> _R | None: ... - @overload - def get(self, key: _K, default: _D, type: Callable[[_V], _R]) -> _R | _D: ... - -class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]): # type: ignore - def copy(self) -> TypeConversionDict[_K, _V]: ... - def __copy__(self) -> ImmutableTypeConversionDict[_K, _V]: ... - -class ViewItems: - def __init__(self, multi_dict, method, repr_name, *a, **kw): ... - def __iter__(self): ... - -class MultiDict(TypeConversionDict[_K, _V]): - def __init__(self, mapping: Any | None = ...): ... - def __getitem__(self, key): ... - def __setitem__(self, key, value): ... - def add(self, key, value): ... - def getlist(self, key, type: Any | None = ...): ... - def setlist(self, key, new_list): ... - def setdefault(self, key, default: Any | None = ...): ... - def setlistdefault(self, key, default_list: Any | None = ...): ... - def items(self, multi: bool = ...): ... - def lists(self): ... - def keys(self): ... - __iter__: Any - def values(self): ... - def listvalues(self): ... - def copy(self): ... - def deepcopy(self, memo: Any | None = ...): ... - def to_dict(self, flat: bool = ...): ... - def update(self, other_dict): ... - def pop(self, key, default=...): ... - def popitem(self): ... - def poplist(self, key): ... - def popitemlist(self): ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... - -class _omd_bucket: - prev: Any - key: Any - value: Any - next: Any - def __init__(self, omd, key, value): ... - def unlink(self, omd): ... - -class OrderedMultiDict(MultiDict[_K, _V]): - def __init__(self, mapping: Any | None = ...): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __reduce_ex__(self, protocol): ... - def __getitem__(self, key): ... - def __setitem__(self, key, value): ... - def __delitem__(self, key): ... - def keys(self): ... - __iter__: Any - def values(self): ... - def items(self, multi: bool = ...): ... - def lists(self): ... - def listvalues(self): ... - def add(self, key, value): ... - def getlist(self, key, type: Any | None = ...): ... - def setlist(self, key, new_list): ... - def setlistdefault(self, key, default_list: Any | None = ...): ... - def update(self, mapping): ... - def poplist(self, key): ... - def pop(self, key, default=...): ... - def popitem(self): ... - def popitemlist(self): ... - -class Headers(object): - def __init__(self, defaults: Any | None = ...): ... - def __getitem__(self, key, _get_mode: bool = ...): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - @overload - def get(self, key: str, *, type: None = ...) -> str | None: ... - @overload - def get(self, key: str, default: _D, type: None = ...) -> str | _D: ... - @overload - def get(self, key: str, *, type: Callable[[str], _R]) -> _R | None: ... - @overload - def get(self, key: str, default: _D, type: Callable[[str], _R]) -> _R | _D: ... - @overload - def get(self, key: str, *, as_bytes: bool) -> Any: ... - @overload - def get(self, key: str, *, type: None, as_bytes: bool) -> Any: ... - @overload - def get(self, key: str, *, type: Callable[[Any], _R], as_bytes: bool) -> _R | None: ... - @overload - def get(self, key: str, default: Any, type: None, as_bytes: bool) -> Any: ... - @overload - def get(self, key: str, default: _D, type: Callable[[Any], _R], as_bytes: bool) -> _R | _D: ... - def getlist(self, key, type: Any | None = ..., as_bytes: bool = ...): ... - def get_all(self, name): ... - def items(self, lower: bool = ...): ... - def keys(self, lower: bool = ...): ... - def values(self): ... - def extend(self, iterable): ... - def __delitem__(self, key: Any) -> None: ... - def remove(self, key): ... - @overload - def pop(self, key: int | None = ...) -> str: ... # default is ignored, using it is an error - @overload - def pop(self, key: str) -> str: ... - @overload - def pop(self, key: str, default: str) -> str: ... - @overload - def pop(self, key: str, default: None) -> str | None: ... - def popitem(self): ... - def __contains__(self, key): ... - has_key: Any - def __iter__(self): ... - def __len__(self): ... - def add(self, _key, _value, **kw): ... - def add_header(self, _key, _value, **_kw): ... - def clear(self): ... - def set(self, _key, _value, **kw): ... - def setdefault(self, key, value): ... - def __setitem__(self, key, value): ... - def to_list(self, charset: Text = ...): ... - def to_wsgi_list(self): ... - def copy(self): ... - def __copy__(self): ... - -class ImmutableHeadersMixin: - def __delitem__(self, key: str) -> None: ... - def __setitem__(self, key, value): ... - set: Any - def add(self, *args, **kwargs): ... - remove: Any - add_header: Any - def extend(self, iterable): ... - def insert(self, pos, value): ... - @overload - def pop(self, key: int | None = ...) -> str: ... # default is ignored, using it is an error - @overload - def pop(self, key: str) -> str: ... - @overload - def pop(self, key: str, default: str) -> str: ... - @overload - def pop(self, key: str, default: None) -> str | None: ... - def popitem(self): ... - def setdefault(self, key, default): ... - -class EnvironHeaders(ImmutableHeadersMixin, Headers): - environ: Any - def __init__(self, environ): ... - def __eq__(self, other): ... - def __getitem__(self, key, _get_mode: bool = ...): ... - def __len__(self): ... - def __iter__(self): ... - def copy(self): ... - -class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore - def __reduce_ex__(self, protocol): ... - dicts: Any - def __init__(self, dicts: Any | None = ...): ... - @classmethod - def fromkeys(cls): ... - def __getitem__(self, key): ... - def get(self, key, default: Any | None = ..., type: Any | None = ...): ... - def getlist(self, key, type: Any | None = ...): ... - def keys(self): ... - __iter__: Any - def items(self, multi: bool = ...): ... - def values(self): ... - def lists(self): ... - def listvalues(self): ... - def copy(self): ... - def to_dict(self, flat: bool = ...): ... - def __len__(self): ... - def __contains__(self, key): ... - has_key: Any - -class FileMultiDict(MultiDict[_K, _V]): - def add_file(self, name, file, filename: Any | None = ..., content_type: Any | None = ...): ... - -class ImmutableDict(ImmutableDictMixin, Dict[_K, _V]): # type: ignore - def copy(self): ... - def __copy__(self): ... - -class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore - def copy(self): ... - def __copy__(self): ... - -class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V]): # type: ignore - def copy(self): ... - def __copy__(self): ... - -class Accept(ImmutableList[Tuple[str, float]]): - provided: bool - def __init__(self, values: None | Accept | Iterable[Tuple[str, float]] = ...) -> None: ... - @overload - def __getitem__(self, key: SupportsIndex) -> Tuple[str, float]: ... - @overload - def __getitem__(self, s: slice) -> list[Tuple[str, float]]: ... - @overload - def __getitem__(self, key: str) -> float: ... - def quality(self, key: str) -> float: ... - def __contains__(self, value: str) -> bool: ... # type: ignore - def index(self, key: str | Tuple[str, float]) -> int: ... # type: ignore - def find(self, key: str | Tuple[str, float]) -> int: ... - def values(self) -> Iterator[str]: ... - def to_header(self) -> str: ... - @overload - def best_match(self, matches: Iterable[str], default: None = ...) -> str | None: ... - @overload - def best_match(self, matches: Iterable[str], default: _D) -> str | _D: ... - @property - def best(self) -> str | None: ... - -class MIMEAccept(Accept): - @property - def accept_html(self) -> bool: ... - @property - def accept_xhtml(self) -> bool: ... - @property - def accept_json(self) -> bool: ... - -class LanguageAccept(Accept): ... -class CharsetAccept(Accept): ... - -def cache_property(key, empty, type): ... - -class _CacheControl(UpdateDictMixin, Dict[str, Any]): - no_cache: Any - no_store: Any - max_age: Any - no_transform: Any - on_update: Any - provided: Any - def __init__(self, values=..., on_update: Any | None = ...): ... - def to_header(self): ... - -class RequestCacheControl(ImmutableDictMixin, _CacheControl): # type: ignore - max_stale: Any - min_fresh: Any - no_transform: Any - only_if_cached: Any - -class ResponseCacheControl(_CacheControl): - public: Any - private: Any - must_revalidate: Any - proxy_revalidate: Any - s_maxage: Any - -class CallbackDict(UpdateDictMixin, Dict[_K, _V]): - on_update: Any - def __init__(self, initial: Any | None = ..., on_update: Any | None = ...): ... - -class HeaderSet(MutableSet[str]): - on_update: Any - def __init__(self, headers: Any | None = ..., on_update: Any | None = ...): ... - def add(self, header): ... - def remove(self, header): ... - def update(self, iterable): ... - def discard(self, header): ... - def find(self, header): ... - def index(self, header): ... - def clear(self): ... - def as_set(self, preserve_casing: bool = ...): ... - def to_header(self): ... - def __getitem__(self, idx): ... - def __delitem__(self, idx): ... - def __setitem__(self, idx, value): ... - def __contains__(self, header): ... - def __len__(self): ... - def __iter__(self): ... - def __nonzero__(self): ... - -class ETags(Container[str], Iterable[str]): - star_tag: Any - def __init__(self, strong_etags: Any | None = ..., weak_etags: Any | None = ..., star_tag: bool = ...): ... - def as_set(self, include_weak: bool = ...): ... - def is_weak(self, etag): ... - def contains_weak(self, etag): ... - def contains(self, etag): ... - def contains_raw(self, etag): ... - def to_header(self): ... - def __call__(self, etag: Any | None = ..., data: Any | None = ..., include_weak: bool = ...): ... - def __bool__(self): ... - __nonzero__: Any - def __iter__(self): ... - def __contains__(self, etag): ... - -class IfRange: - etag: Any - date: Any - def __init__(self, etag: Any | None = ..., date: Any | None = ...): ... - def to_header(self): ... - -class Range: - units: Any - ranges: Any - def __init__(self, units, ranges): ... - def range_for_length(self, length): ... - def make_content_range(self, length): ... - def to_header(self): ... - def to_content_range_header(self, length): ... - -class ContentRange: - on_update: Any - units: str | None - start: Any - stop: Any - length: Any - def __init__(self, units: str | None, start, stop, length: Any | None = ..., on_update: Any | None = ...): ... - def set(self, start, stop, length: Any | None = ..., units: str | None = ...): ... - def unset(self) -> None: ... - def to_header(self): ... - def __nonzero__(self): ... - __bool__: Any - -class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore - type: str - def __init__(self, auth_type: str, data: Mapping[str, Any] | None = ...) -> None: ... - @property - def username(self) -> str | None: ... - @property - def password(self) -> str | None: ... - @property - def realm(self) -> str | None: ... - @property - def nonce(self) -> str | None: ... - @property - def uri(self) -> str | None: ... - @property - def nc(self) -> str | None: ... - @property - def cnonce(self) -> str | None: ... - @property - def response(self) -> str | None: ... - @property - def opaque(self) -> str | None: ... - @property - def qop(self) -> str | None: ... - -class WWWAuthenticate(UpdateDictMixin, Dict[str, Any]): - on_update: Any - def __init__(self, auth_type: Any | None = ..., values: Any | None = ..., on_update: Any | None = ...): ... - def set_basic(self, realm: str = ...): ... - def set_digest(self, realm, nonce, qop=..., opaque: Any | None = ..., algorithm: Any | None = ..., stale: bool = ...): ... - def to_header(self): ... - @staticmethod - def auth_property(name, doc: Any | None = ...): ... - type: Any - realm: Any - domain: Any - nonce: Any - opaque: Any - algorithm: Any - qop: Any - stale: Any - -class FileStorage(object): - name: Text | None - stream: IO[bytes] - filename: Text | None - headers: Headers - def __init__( - self, - stream: IO[bytes] | None = ..., - filename: None | Text | bytes = ..., - name: Text | None = ..., - content_type: Text | None = ..., - content_length: int | None = ..., - headers: Headers | None = ..., - ): ... - @property - def content_type(self) -> Text | None: ... - @property - def content_length(self) -> int: ... - @property - def mimetype(self) -> str: ... - @property - def mimetype_params(self) -> dict[str, str]: ... - def save(self, dst: Text | SupportsWrite[bytes], buffer_size: int = ...): ... - def close(self) -> None: ... - def __nonzero__(self) -> bool: ... - def __bool__(self) -> bool: ... - def __getattr__(self, name: Text) -> Any: ... - def __iter__(self) -> Iterator[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/debug/__init__.pyi b/stubs/Werkzeug/werkzeug/debug/__init__.pyi deleted file mode 100644 index 87a62c3..0000000 --- a/stubs/Werkzeug/werkzeug/debug/__init__.pyi +++ /dev/null @@ -1,51 +0,0 @@ -from typing import Any - -from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response - -PIN_TIME: Any - -def hash_pin(pin): ... -def get_machine_id(): ... - -class _ConsoleFrame: - console: Any - id: Any - def __init__(self, namespace): ... - -def get_pin_and_cookie_name(app): ... - -class DebuggedApplication: - app: Any - evalex: Any - frames: Any - tracebacks: Any - request_key: Any - console_path: Any - console_init_func: Any - show_hidden_frames: Any - secret: Any - pin_logging: Any - pin: Any - def __init__( - self, - app, - evalex: bool = ..., - request_key: str = ..., - console_path: str = ..., - console_init_func: Any | None = ..., - show_hidden_frames: bool = ..., - lodgeit_url: Any | None = ..., - pin_security: bool = ..., - pin_logging: bool = ..., - ): ... - @property - def pin_cookie_name(self): ... - def debug_application(self, environ, start_response): ... - def execute_command(self, request, command, frame): ... - def display_console(self, request): ... - def paste_traceback(self, request, traceback): ... - def get_resource(self, request, filename): ... - def check_pin_trust(self, environ): ... - def pin_auth(self, request): ... - def log_pin_request(self): ... - def __call__(self, environ, start_response): ... diff --git a/stubs/Werkzeug/werkzeug/debug/console.pyi b/stubs/Werkzeug/werkzeug/debug/console.pyi deleted file mode 100644 index e1a1219..0000000 --- a/stubs/Werkzeug/werkzeug/debug/console.pyi +++ /dev/null @@ -1,44 +0,0 @@ -import code -from typing import Any - -class HTMLStringO: - def __init__(self): ... - def isatty(self): ... - def close(self): ... - def flush(self): ... - def seek(self, n, mode: int = ...): ... - def readline(self): ... - def reset(self): ... - def write(self, x): ... - def writelines(self, x): ... - -class ThreadedStream: - @staticmethod - def push(): ... - @staticmethod - def fetch(): ... - @staticmethod - def displayhook(obj): ... - def __setattr__(self, name, value): ... - def __dir__(self): ... - def __getattribute__(self, name): ... - -class _ConsoleLoader: - def __init__(self): ... - def register(self, code, source): ... - def get_source_by_code(self, code): ... - -class _InteractiveConsole(code.InteractiveInterpreter): - globals: Any - more: Any - buffer: Any - def __init__(self, globals, locals): ... - def runsource(self, source): ... - def runcode(self, code): ... - def showtraceback(self): ... - def showsyntaxerror(self, filename: Any | None = ...): ... - def write(self, data): ... - -class Console: - def __init__(self, globals: Any | None = ..., locals: Any | None = ...): ... - def eval(self, code): ... diff --git a/stubs/Werkzeug/werkzeug/debug/repr.pyi b/stubs/Werkzeug/werkzeug/debug/repr.pyi deleted file mode 100644 index 073fd26..0000000 --- a/stubs/Werkzeug/werkzeug/debug/repr.pyi +++ /dev/null @@ -1,33 +0,0 @@ -from typing import Any - -deque: Any -missing: Any -RegexType: Any -HELP_HTML: Any -OBJECT_DUMP_HTML: Any - -def debug_repr(obj): ... -def dump(obj=...): ... - -class _Helper: - def __call__(self, topic: Any | None = ...): ... - -helper: Any - -class DebugReprGenerator: - def __init__(self): ... - list_repr: Any - tuple_repr: Any - set_repr: Any - frozenset_repr: Any - deque_repr: Any - def regex_repr(self, obj): ... - def string_repr(self, obj, limit: int = ...): ... - def dict_repr(self, d, recursive, limit: int = ...): ... - def object_repr(self, obj): ... - def dispatch_repr(self, obj, recursive): ... - def fallback_repr(self): ... - def repr(self, obj): ... - def dump_object(self, obj): ... - def dump_locals(self, d): ... - def render_object_dump(self, items, title, repr: Any | None = ...): ... diff --git a/stubs/Werkzeug/werkzeug/debug/tbtools.pyi b/stubs/Werkzeug/werkzeug/debug/tbtools.pyi deleted file mode 100644 index 45bcf70..0000000 --- a/stubs/Werkzeug/werkzeug/debug/tbtools.pyi +++ /dev/null @@ -1,63 +0,0 @@ -from typing import Any - -UTF8_COOKIE: Any -system_exceptions: Any -HEADER: Any -FOOTER: Any -PAGE_HTML: Any -CONSOLE_HTML: Any -SUMMARY_HTML: Any -FRAME_HTML: Any -SOURCE_LINE_HTML: Any - -def render_console_html(secret, evalex_trusted: bool = ...): ... -def get_current_traceback(ignore_system_exceptions: bool = ..., show_hidden_frames: bool = ..., skip: int = ...): ... - -class Line: - lineno: Any - code: Any - in_frame: Any - current: Any - def __init__(self, lineno, code): ... - def classes(self): ... - def render(self): ... - -class Traceback: - exc_type: Any - exc_value: Any - exception_type: Any - frames: Any - def __init__(self, exc_type, exc_value, tb): ... - def filter_hidden_frames(self): ... - def is_syntax_error(self): ... - def exception(self): ... - def log(self, logfile: Any | None = ...): ... - def paste(self): ... - def render_summary(self, include_title: bool = ...): ... - def render_full(self, evalex: bool = ..., secret: Any | None = ..., evalex_trusted: bool = ...): ... - def generate_plaintext_traceback(self): ... - def plaintext(self): ... - id: Any - -class Frame: - lineno: Any - function_name: Any - locals: Any - globals: Any - filename: Any - module: Any - loader: Any - code: Any - hide: Any - info: Any - def __init__(self, exc_type, exc_value, tb): ... - def render(self): ... - def render_line_context(self): ... - def get_annotated_lines(self): ... - def eval(self, code, mode: str = ...): ... - def sourcelines(self): ... - def get_context_lines(self, context: int = ...): ... - @property - def current_line(self): ... - def console(self): ... - id: Any diff --git a/stubs/Werkzeug/werkzeug/exceptions.pyi b/stubs/Werkzeug/werkzeug/exceptions.pyi deleted file mode 100644 index 53b0a0c..0000000 --- a/stubs/Werkzeug/werkzeug/exceptions.pyi +++ /dev/null @@ -1,180 +0,0 @@ -import datetime -from _typeshed.wsgi import StartResponse, WSGIEnvironment -from typing import Any, Iterable, NoReturn, Protocol, Text, Tuple, Type - -from werkzeug.wrappers import Response - -class _EnvironContainer(Protocol): - @property - def environ(self) -> WSGIEnvironment: ... - -class HTTPException(Exception): - code: int | None - description: Text | None - response: Response | None - def __init__(self, description: Text | None = ..., response: Response | None = ...) -> None: ... - @classmethod - def wrap(cls, exception: Type[Exception], name: str | None = ...) -> Any: ... - @property - def name(self) -> str: ... - def get_description(self, environ: WSGIEnvironment | None = ...) -> Text: ... - def get_body(self, environ: WSGIEnvironment | None = ...) -> Text: ... - def get_headers(self, environ: WSGIEnvironment | None = ...) -> list[Tuple[str, str]]: ... - def get_response(self, environ: WSGIEnvironment | _EnvironContainer | None = ...) -> Response: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... - -default_exceptions: dict[int, Type[HTTPException]] - -class BadRequest(HTTPException): - code: int - description: Text - -class ClientDisconnected(BadRequest): ... -class SecurityError(BadRequest): ... -class BadHost(BadRequest): ... - -class Unauthorized(HTTPException): - code: int - description: Text - www_authenticate: Iterable[object] | None - def __init__( - self, - description: Text | None = ..., - response: Response | None = ..., - www_authenticate: None | Tuple[object, ...] | list[object] | object = ..., - ) -> None: ... - -class Forbidden(HTTPException): - code: int - description: Text - -class NotFound(HTTPException): - code: int - description: Text - -class MethodNotAllowed(HTTPException): - code: int - description: Text - valid_methods: Any - def __init__(self, valid_methods: Any | None = ..., description: Any | None = ...): ... - -class NotAcceptable(HTTPException): - code: int - description: Text - -class RequestTimeout(HTTPException): - code: int - description: Text - -class Conflict(HTTPException): - code: int - description: Text - -class Gone(HTTPException): - code: int - description: Text - -class LengthRequired(HTTPException): - code: int - description: Text - -class PreconditionFailed(HTTPException): - code: int - description: Text - -class RequestEntityTooLarge(HTTPException): - code: int - description: Text - -class RequestURITooLarge(HTTPException): - code: int - description: Text - -class UnsupportedMediaType(HTTPException): - code: int - description: Text - -class RequestedRangeNotSatisfiable(HTTPException): - code: int - description: Text - length: Any - units: str - def __init__(self, length: Any | None = ..., units: str = ..., description: Any | None = ...): ... - -class ExpectationFailed(HTTPException): - code: int - description: Text - -class ImATeapot(HTTPException): - code: int - description: Text - -class UnprocessableEntity(HTTPException): - code: int - description: Text - -class Locked(HTTPException): - code: int - description: Text - -class FailedDependency(HTTPException): - code: int - description: Text - -class PreconditionRequired(HTTPException): - code: int - description: Text - -class _RetryAfter(HTTPException): - retry_after: None | int | datetime.datetime - def __init__( - self, description: Text | None = ..., response: Response | None = ..., retry_after: None | int | datetime.datetime = ... - ) -> None: ... - -class TooManyRequests(_RetryAfter): - code: int - description: Text - -class RequestHeaderFieldsTooLarge(HTTPException): - code: int - description: Text - -class UnavailableForLegalReasons(HTTPException): - code: int - description: Text - -class InternalServerError(HTTPException): - def __init__( - self, description: Text | None = ..., response: Response | None = ..., original_exception: Exception | None = ... - ) -> None: ... - code: int - description: Text - -class NotImplemented(HTTPException): - code: int - description: Text - -class BadGateway(HTTPException): - code: int - description: Text - -class ServiceUnavailable(_RetryAfter): - code: int - description: Text - -class GatewayTimeout(HTTPException): - code: int - description: Text - -class HTTPVersionNotSupported(HTTPException): - code: int - description: Text - -class Aborter: - mapping: Any - def __init__(self, mapping: Any | None = ..., extra: Any | None = ...) -> None: ... - def __call__(self, code: int | Response, *args: Any, **kwargs: Any) -> NoReturn: ... - -def abort(status: int | Response, *args: Any, **kwargs: Any) -> NoReturn: ... - -class BadRequestKeyError(BadRequest, KeyError): ... diff --git a/stubs/Werkzeug/werkzeug/filesystem.pyi b/stubs/Werkzeug/werkzeug/filesystem.pyi deleted file mode 100644 index 58695fa..0000000 --- a/stubs/Werkzeug/werkzeug/filesystem.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Any - -has_likely_buggy_unicode_filesystem: Any - -class BrokenFilesystemWarning(RuntimeWarning, UnicodeWarning): ... - -def get_filesystem_encoding(): ... diff --git a/stubs/Werkzeug/werkzeug/formparser.pyi b/stubs/Werkzeug/werkzeug/formparser.pyi deleted file mode 100644 index 1820a12..0000000 --- a/stubs/Werkzeug/werkzeug/formparser.pyi +++ /dev/null @@ -1,87 +0,0 @@ -from _typeshed.wsgi import WSGIEnvironment -from typing import IO, Any, Callable, Generator, Iterable, Mapping, NoReturn, Optional, Protocol, Text, Tuple, TypeVar - -from .datastructures import Headers - -_Dict = Any -_ParseFunc = Callable[[IO[bytes], str, Optional[int], Mapping[str, str]], Tuple[IO[bytes], _Dict, _Dict]] - -_F = TypeVar("_F", bound=Callable[..., Any]) - -class _StreamFactory(Protocol): - def __call__( - self, total_content_length: int | None, filename: str, content_type: str, content_length: int | None = ... - ) -> IO[bytes]: ... - -def default_stream_factory( - total_content_length: int | None, filename: str, content_type: str, content_length: int | None = ... -) -> IO[bytes]: ... -def parse_form_data( - environ: WSGIEnvironment, - stream_factory: _StreamFactory | None = ..., - charset: Text = ..., - errors: Text = ..., - max_form_memory_size: int | None = ..., - max_content_length: int | None = ..., - cls: Callable[[], _Dict] | None = ..., - silent: bool = ..., -) -> Tuple[IO[bytes], _Dict, _Dict]: ... -def exhaust_stream(f: _F) -> _F: ... - -class FormDataParser(object): - stream_factory: _StreamFactory - charset: Text - errors: Text - max_form_memory_size: int | None - max_content_length: int | None - cls: Callable[[], _Dict] - silent: bool - def __init__( - self, - stream_factory: _StreamFactory | None = ..., - charset: Text = ..., - errors: Text = ..., - max_form_memory_size: int | None = ..., - max_content_length: int | None = ..., - cls: Callable[[], _Dict] | None = ..., - silent: bool = ..., - ) -> None: ... - def get_parse_func(self, mimetype: str, options: Any) -> _ParseFunc | None: ... - def parse_from_environ(self, environ: WSGIEnvironment) -> Tuple[IO[bytes], _Dict, _Dict]: ... - def parse( - self, stream: IO[bytes], mimetype: Text, content_length: int | None, options: Mapping[str, str] | None = ... - ) -> Tuple[IO[bytes], _Dict, _Dict]: ... - parse_functions: dict[Text, _ParseFunc] - -def is_valid_multipart_boundary(boundary: str) -> bool: ... -def parse_multipart_headers(iterable: Iterable[Text | bytes]) -> Headers: ... - -class MultiPartParser(object): - charset: Text - errors: Text - max_form_memory_size: int | None - stream_factory: _StreamFactory - cls: Callable[[], _Dict] - buffer_size: int - def __init__( - self, - stream_factory: _StreamFactory | None = ..., - charset: Text = ..., - errors: Text = ..., - max_form_memory_size: int | None = ..., - cls: Callable[[], _Dict] | None = ..., - buffer_size: int = ..., - ) -> None: ... - def fail(self, message: Text) -> NoReturn: ... - def get_part_encoding(self, headers: Mapping[str, str]) -> str | None: ... - def get_part_charset(self, headers: Mapping[str, str]) -> Text: ... - def start_file_streaming( - self, filename: Text | bytes, headers: Mapping[str, str], total_content_length: int | None - ) -> Tuple[Text, IO[bytes]]: ... - def in_memory_threshold_reached(self, bytes: Any) -> NoReturn: ... - def validate_boundary(self, boundary: str | None) -> None: ... - def parse_lines( - self, file: Any, boundary: bytes, content_length: int, cap_at_buffer: bool = ... - ) -> Generator[Tuple[str, Any], None, None]: ... - def parse_parts(self, file: Any, boundary: bytes, content_length: int) -> Generator[Tuple[str, Any], None, None]: ... - def parse(self, file: Any, boundary: bytes, content_length: int) -> Tuple[_Dict, _Dict]: ... diff --git a/stubs/Werkzeug/werkzeug/http.pyi b/stubs/Werkzeug/werkzeug/http.pyi deleted file mode 100644 index 187b2a5..0000000 --- a/stubs/Werkzeug/werkzeug/http.pyi +++ /dev/null @@ -1,120 +0,0 @@ -import sys -from _typeshed.wsgi import WSGIEnvironment -from datetime import datetime, timedelta -from typing import Any, Callable, Iterable, Mapping, SupportsInt, Text, Tuple, Type, TypeVar, Union, overload - -from .datastructures import ( - Accept, - Authorization, - ContentRange, - ETags, - Headers, - HeaderSet, - IfRange, - Range, - RequestCacheControl, - TypeConversionDict, - WWWAuthenticate, -) - -if sys.version_info >= (3, 0): - _Str = str - _ToBytes = Union[bytes, bytearray, memoryview, str] - _ETagData = Union[bytes, bytearray, memoryview] -else: - _Str = TypeVar("_Str", str, unicode) - _ToBytes = Union[bytes, bytearray, buffer, unicode] - _ETagData = Union[str, unicode, bytearray, buffer, memoryview] - -_T = TypeVar("_T") -_U = TypeVar("_U") - -HTTP_STATUS_CODES: dict[int, str] - -def wsgi_to_bytes(data: bytes | Text) -> bytes: ... -def bytes_to_wsgi(data: bytes) -> str: ... -def quote_header_value(value: Any, extra_chars: str = ..., allow_token: bool = ...) -> str: ... -def unquote_header_value(value: _Str, is_filename: bool = ...) -> _Str: ... -def dump_options_header(header: _Str | None, options: Mapping[_Str, Any]) -> _Str: ... -def dump_header(iterable: Iterable[Any] | dict[_Str, Any], allow_token: bool = ...) -> _Str: ... -def parse_list_header(value: _Str) -> list[_Str]: ... -@overload -def parse_dict_header(value: bytes | Text) -> dict[Text, Text | None]: ... -@overload -def parse_dict_header(value: bytes | Text, cls: Type[_T]) -> _T: ... -@overload -def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, dict[str, str | None]]: ... -@overload -def parse_options_header(value: _Str) -> Tuple[_Str, dict[_Str, _Str | None]]: ... - -# actually returns Tuple[_Str, dict[_Str, _Str | None], ...] -@overload -def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]: ... -@overload -def parse_accept_header(value: Text | None) -> Accept: ... -@overload -def parse_accept_header(value: _Str | None, cls: Callable[[list[Tuple[str, float]] | None], _T]) -> _T: ... -@overload -def parse_cache_control_header( - value: None | bytes | Text, on_update: Callable[[RequestCacheControl], Any] | None = ... -) -> RequestCacheControl: ... -@overload -def parse_cache_control_header( - value: None | bytes | Text, on_update: _T, cls: Callable[[dict[Text, Text | None], _T], _U] -) -> _U: ... -@overload -def parse_cache_control_header(value: None | bytes | Text, *, cls: Callable[[dict[Text, Text | None], None], _U]) -> _U: ... -def parse_set_header(value: Text, on_update: Callable[[HeaderSet], Any] | None = ...) -> HeaderSet: ... -def parse_authorization_header(value: None | bytes | Text) -> Authorization | None: ... -def parse_www_authenticate_header( - value: None | bytes | Text, on_update: Callable[[WWWAuthenticate], Any] | None = ... -) -> WWWAuthenticate: ... -def parse_if_range_header(value: Text | None) -> IfRange: ... -def parse_range_header(value: Text | None, make_inclusive: bool = ...) -> Range | None: ... -def parse_content_range_header( - value: Text | None, on_update: Callable[[ContentRange], Any] | None = ... -) -> ContentRange | None: ... -def quote_etag(etag: _Str, weak: bool = ...) -> _Str: ... -def unquote_etag(etag: _Str | None) -> Tuple[_Str | None, _Str | None]: ... -def parse_etags(value: Text | None) -> ETags: ... -def generate_etag(data: _ETagData) -> str: ... -def parse_date(value: str | None) -> datetime | None: ... -def cookie_date(expires: None | float | datetime = ...) -> str: ... -def http_date(timestamp: None | float | datetime = ...) -> str: ... -def parse_age(value: SupportsInt | None = ...) -> timedelta | None: ... -def dump_age(age: None | timedelta | SupportsInt) -> str | None: ... -def is_resource_modified( - environ: WSGIEnvironment, - etag: Text | None = ..., - data: _ETagData | None = ..., - last_modified: None | Text | datetime = ..., - ignore_if_range: bool = ..., -) -> bool: ... -def remove_entity_headers(headers: list[Tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ... -def remove_hop_by_hop_headers(headers: list[Tuple[Text, Text]] | Headers) -> None: ... -def is_entity_header(header: Text) -> bool: ... -def is_hop_by_hop_header(header: Text) -> bool: ... -@overload -def parse_cookie( - header: None | WSGIEnvironment | Text | bytes, charset: Text = ..., errors: Text = ... -) -> TypeConversionDict[Any, Any]: ... -@overload -def parse_cookie( - header: None | WSGIEnvironment | Text | bytes, - charset: Text = ..., - errors: Text = ..., - cls: Callable[[Iterable[Tuple[Text, Text]]], _T] | None = ..., -) -> _T: ... -def dump_cookie( - key: _ToBytes, - value: _ToBytes = ..., - max_age: None | float | timedelta = ..., - expires: None | Text | float | datetime = ..., - path: None | Tuple[Any, ...] | str | bytes = ..., - domain: None | str | bytes = ..., - secure: bool = ..., - httponly: bool = ..., - charset: Text = ..., - sync_expires: bool = ..., -) -> str: ... -def is_byte_range_valid(start: int | None, stop: int | None, length: int | None) -> bool: ... diff --git a/stubs/Werkzeug/werkzeug/local.pyi b/stubs/Werkzeug/werkzeug/local.pyi deleted file mode 100644 index 11d133b..0000000 --- a/stubs/Werkzeug/werkzeug/local.pyi +++ /dev/null @@ -1,100 +0,0 @@ -from typing import Any - -def release_local(local): ... - -class Local: - def __init__(self): ... - def __iter__(self): ... - def __call__(self, proxy): ... - def __release_local__(self): ... - def __getattr__(self, name): ... - def __setattr__(self, name, value): ... - def __delattr__(self, name): ... - -class LocalStack: - def __init__(self): ... - def __release_local__(self): ... - def _get__ident_func__(self): ... - def _set__ident_func__(self, value): ... - __ident_func__: Any - def __call__(self): ... - def push(self, obj): ... - def pop(self): ... - @property - def top(self): ... - -class LocalManager: - locals: Any - ident_func: Any - def __init__(self, locals: Any | None = ..., ident_func: Any | None = ...): ... - def get_ident(self): ... - def cleanup(self): ... - def make_middleware(self, app): ... - def middleware(self, func): ... - -class LocalProxy: - def __init__(self, local, name: Any | None = ...): ... - @property - def __dict__(self): ... - def __bool__(self): ... - def __unicode__(self): ... - def __dir__(self): ... - def __getattr__(self, name): ... - def __setitem__(self, key, value): ... - def __delitem__(self, key): ... - __getslice__: Any - def __setslice__(self, i, j, seq): ... - def __delslice__(self, i, j): ... - __setattr__: Any - __delattr__: Any - __lt__: Any - __le__: Any - __eq__: Any - __ne__: Any - __gt__: Any - __ge__: Any - __cmp__: Any - __hash__: Any - __call__: Any - __len__: Any - __getitem__: Any - __iter__: Any - __contains__: Any - __add__: Any - __sub__: Any - __mul__: Any - __floordiv__: Any - __mod__: Any - __divmod__: Any - __pow__: Any - __lshift__: Any - __rshift__: Any - __and__: Any - __xor__: Any - __or__: Any - __div__: Any - __truediv__: Any - __neg__: Any - __pos__: Any - __abs__: Any - __invert__: Any - __complex__: Any - __int__: Any - __long__: Any - __float__: Any - __oct__: Any - __hex__: Any - __index__: Any - __coerce__: Any - __enter__: Any - __exit__: Any - __radd__: Any - __rsub__: Any - __rmul__: Any - __rdiv__: Any - __rtruediv__: Any - __rfloordiv__: Any - __rmod__: Any - __rdivmod__: Any - __copy__: Any - __deepcopy__: Any diff --git a/stubs/Werkzeug/werkzeug/middleware/dispatcher.pyi b/stubs/Werkzeug/werkzeug/middleware/dispatcher.pyi deleted file mode 100644 index 1b8a28a..0000000 --- a/stubs/Werkzeug/werkzeug/middleware/dispatcher.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Iterable, Mapping, Text - -class DispatcherMiddleware(object): - app: WSGIApplication - mounts: Mapping[Text, WSGIApplication] - def __init__(self, app: WSGIApplication, mounts: Mapping[Text, WSGIApplication] | None = ...) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi b/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi deleted file mode 100644 index 0285b67..0000000 --- a/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Any, Iterable, Mapping, MutableMapping, Text - -_Opts = Mapping[Text, Any] -_MutableOpts = MutableMapping[Text, Any] - -class ProxyMiddleware(object): - app: WSGIApplication - targets: dict[Text, _MutableOpts] - def __init__( - self, app: WSGIApplication, targets: Mapping[Text, _MutableOpts], chunk_size: int = ..., timeout: int = ... - ) -> None: ... - def proxy_to(self, opts: _Opts, path: Text, prefix: Text) -> WSGIApplication: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/lint.pyi b/stubs/Werkzeug/werkzeug/middleware/lint.pyi deleted file mode 100644 index f308b2f..0000000 --- a/stubs/Werkzeug/werkzeug/middleware/lint.pyi +++ /dev/null @@ -1,62 +0,0 @@ -import sys -from _typeshed import SupportsWrite -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Any, Iterable, Iterator, Mapping, Protocol, Tuple - -from ..datastructures import Headers - -class WSGIWarning(Warning): ... -class HTTPWarning(Warning): ... - -def check_string(context: str, obj: object, stacklevel: int = ...) -> None: ... - -class _SupportsReadEtc(Protocol): - def read(self, __size: int = ...) -> bytes: ... - def readline(self, __size: int = ...) -> bytes: ... - def __iter__(self) -> Iterator[bytes]: ... - def close(self) -> Any: ... - -class InputStream(object): - def __init__(self, stream: _SupportsReadEtc) -> None: ... - def read(self, __size: int = ...) -> bytes: ... - def readline(self, __size: int = ...) -> bytes: ... - def __iter__(self) -> Iterator[bytes]: ... - def close(self) -> None: ... - -class _SupportsWriteEtc(Protocol): - def write(self, __s: str) -> Any: ... - def flush(self) -> Any: ... - def close(self) -> Any: ... - -class ErrorStream(object): - def __init__(self, stream: _SupportsWriteEtc) -> None: ... - def write(self, s: str) -> None: ... - def flush(self) -> None: ... - def writelines(self, seq: Iterable[str]) -> None: ... - def close(self) -> None: ... - -class GuardedWrite(object): - def __init__(self, write: SupportsWrite[str], chunks: list[int]) -> None: ... - def __call__(self, s: str) -> None: ... - -class GuardedIterator(object): - closed: bool - headers_set: bool - chunks: list[int] - def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: list[int]) -> None: ... - def __iter__(self) -> GuardedIterator: ... - if sys.version_info >= (3, 0): - def __next__(self) -> str: ... - else: - def next(self) -> str: ... - def close(self) -> None: ... - -class LintMiddleware(object): - def __init__(self, app: WSGIApplication) -> None: ... - def check_environ(self, environ: WSGIEnvironment) -> None: ... - def check_start_response( - self, status: str, headers: list[Tuple[str, str]], exc_info: Tuple[Any, ...] | None - ) -> Tuple[int, Headers]: ... - def check_headers(self, headers: Mapping[str, str]) -> None: ... - def check_iterator(self, app_iter: Iterable[bytes]) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> GuardedIterator: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/profiler.pyi b/stubs/Werkzeug/werkzeug/middleware/profiler.pyi deleted file mode 100644 index 10b073d..0000000 --- a/stubs/Werkzeug/werkzeug/middleware/profiler.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import IO, Iterable, Text, Tuple - -class ProfilerMiddleware(object): - def __init__( - self, - app: WSGIApplication, - stream: IO[str] = ..., - sort_by: Tuple[Text, Text] = ..., - restrictions: Iterable[str | float] = ..., - profile_dir: Text | None = ..., - filename_format: Text = ..., - ) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/proxy_fix.pyi b/stubs/Werkzeug/werkzeug/middleware/proxy_fix.pyi deleted file mode 100644 index 3d166e6..0000000 --- a/stubs/Werkzeug/werkzeug/middleware/proxy_fix.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Iterable - -class ProxyFix(object): - app: WSGIApplication - x_for: int - x_proto: int - x_host: int - x_port: int - x_prefix: int - num_proxies: int - def __init__( - self, - app: WSGIApplication, - num_proxies: int | None = ..., - x_for: int = ..., - x_proto: int = ..., - x_host: int = ..., - x_port: int = ..., - x_prefix: int = ..., - ) -> None: ... - def get_remote_addr(self, forwarded_for: Iterable[str]) -> str | None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi b/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi deleted file mode 100644 index 46ad687..0000000 --- a/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi +++ /dev/null @@ -1,29 +0,0 @@ -import datetime -from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import IO, Callable, Iterable, Mapping, Optional, Text, Tuple, Union - -_V = Union[Tuple[Text, Text], Text] - -_Opener = Callable[[], Tuple[IO[bytes], datetime.datetime, int]] -_Loader = Callable[[Optional[Text]], Union[Tuple[None, None], Tuple[Text, _Opener]]] - -class SharedDataMiddleware(object): - app: WSGIApplication - exports: list[Tuple[Text, _Loader]] - cache: bool - cache_timeout: float - def __init__( - self, - app: WSGIApplication, - exports: Mapping[Text, _V] | Iterable[Tuple[Text, _V]], - disallow: Text | None = ..., - cache: bool = ..., - cache_timeout: float = ..., - fallback_mimetype: Text = ..., - ) -> None: ... - def is_allowed(self, filename: Text) -> bool: ... - def get_file_loader(self, filename: Text) -> _Loader: ... - def get_package_loader(self, package: Text, package_path: Text) -> _Loader: ... - def get_directory_loader(self, directory: Text) -> _Loader: ... - def generate_etag(self, mtime: datetime.datetime, file_size: int, real_filename: Text | bytes) -> str: ... - def __call__(self, environment: WSGIEnvironment, start_response: StartResponse) -> WSGIApplication: ... diff --git a/stubs/Werkzeug/werkzeug/posixemulation.pyi b/stubs/Werkzeug/werkzeug/posixemulation.pyi deleted file mode 100644 index 334cb3d..0000000 --- a/stubs/Werkzeug/werkzeug/posixemulation.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Any - -from ._compat import to_unicode as to_unicode -from .filesystem import get_filesystem_encoding as get_filesystem_encoding - -can_rename_open_file: Any - -def rename(src, dst): ... diff --git a/stubs/Werkzeug/werkzeug/routing.pyi b/stubs/Werkzeug/werkzeug/routing.pyi deleted file mode 100644 index 51bd183..0000000 --- a/stubs/Werkzeug/werkzeug/routing.pyi +++ /dev/null @@ -1,219 +0,0 @@ -from typing import Any, Text - -from werkzeug.exceptions import HTTPException - -def parse_converter_args(argstr): ... -def parse_rule(rule): ... - -class RoutingException(Exception): ... - -class RequestRedirect(HTTPException, RoutingException): - code: Any - new_url: Any - def __init__(self, new_url): ... - def get_response(self, environ): ... - -class RequestSlash(RoutingException): ... - -class RequestAliasRedirect(RoutingException): - matched_values: Any - def __init__(self, matched_values): ... - -class BuildError(RoutingException, LookupError): - endpoint: Any - values: Any - method: Any - adapter: MapAdapter | None - def __init__(self, endpoint, values, method, adapter: MapAdapter | None = ...) -> None: ... - @property - def suggested(self) -> Rule | None: ... - def closest_rule(self, adapter: MapAdapter | None) -> Rule | None: ... - -class ValidationError(ValueError): ... - -class RuleFactory: - def get_rules(self, map): ... - -class Subdomain(RuleFactory): - subdomain: Any - rules: Any - def __init__(self, subdomain, rules): ... - def get_rules(self, map): ... - -class Submount(RuleFactory): - path: Any - rules: Any - def __init__(self, path, rules): ... - def get_rules(self, map): ... - -class EndpointPrefix(RuleFactory): - prefix: Any - rules: Any - def __init__(self, prefix, rules): ... - def get_rules(self, map): ... - -class RuleTemplate: - rules: Any - def __init__(self, rules): ... - def __call__(self, *args, **kwargs): ... - -class RuleTemplateFactory(RuleFactory): - rules: Any - context: Any - def __init__(self, rules, context): ... - def get_rules(self, map): ... - -class Rule(RuleFactory): - rule: Any - is_leaf: Any - map: Any - strict_slashes: Any - subdomain: Any - host: Any - defaults: Any - build_only: Any - alias: Any - methods: Any - endpoint: Any - redirect_to: Any - arguments: Any - def __init__( - self, - string, - defaults: Any | None = ..., - subdomain: Any | None = ..., - methods: Any | None = ..., - build_only: bool = ..., - endpoint: Any | None = ..., - strict_slashes: Any | None = ..., - redirect_to: Any | None = ..., - alias: bool = ..., - host: Any | None = ..., - ): ... - def empty(self): ... - def get_empty_kwargs(self): ... - def get_rules(self, map): ... - def refresh(self): ... - def bind(self, map, rebind: bool = ...): ... - def get_converter(self, variable_name, converter_name, args, kwargs): ... - def compile(self): ... - def match(self, path, method: Any | None = ...): ... - def build(self, values, append_unknown: bool = ...): ... - def provides_defaults_for(self, rule): ... - def suitable_for(self, values, method: Any | None = ...): ... - def match_compare_key(self): ... - def build_compare_key(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - -class BaseConverter: - regex: Any - weight: Any - map: Any - def __init__(self, map): ... - def to_python(self, value): ... - def to_url(self, value) -> str: ... - -class UnicodeConverter(BaseConverter): - regex: Any - def __init__(self, map, minlength: int = ..., maxlength: Any | None = ..., length: Any | None = ...): ... - -class AnyConverter(BaseConverter): - regex: Any - def __init__(self, map, *items): ... - -class PathConverter(BaseConverter): - regex: Any - weight: Any - -class NumberConverter(BaseConverter): - weight: Any - fixed_digits: Any - min: Any - max: Any - def __init__(self, map, fixed_digits: int = ..., min: Any | None = ..., max: Any | None = ...): ... - def to_python(self, value): ... - def to_url(self, value) -> str: ... - -class IntegerConverter(NumberConverter): - regex: Any - num_convert: Any - -class FloatConverter(NumberConverter): - regex: Any - num_convert: Any - def __init__(self, map, min: Any | None = ..., max: Any | None = ...): ... - -class UUIDConverter(BaseConverter): - regex: Any - def to_python(self, value): ... - def to_url(self, value) -> str: ... - -DEFAULT_CONVERTERS: Any - -class Map: - default_converters: Any - default_subdomain: Any - charset: Text - encoding_errors: Text - strict_slashes: Any - redirect_defaults: Any - host_matching: Any - converters: Any - sort_parameters: Any - sort_key: Any - def __init__( - self, - rules: Any | None = ..., - default_subdomain: str = ..., - charset: Text = ..., - strict_slashes: bool = ..., - redirect_defaults: bool = ..., - converters: Any | None = ..., - sort_parameters: bool = ..., - sort_key: Any | None = ..., - encoding_errors: Text = ..., - host_matching: bool = ..., - ): ... - def is_endpoint_expecting(self, endpoint, *arguments): ... - def iter_rules(self, endpoint: Any | None = ...): ... - def add(self, rulefactory): ... - def bind( - self, - server_name, - script_name: Any | None = ..., - subdomain: Any | None = ..., - url_scheme: str = ..., - default_method: str = ..., - path_info: Any | None = ..., - query_args: Any | None = ..., - ): ... - def bind_to_environ(self, environ, server_name: Any | None = ..., subdomain: Any | None = ...): ... - def update(self): ... - -class MapAdapter: - map: Any - server_name: Any - script_name: Any - subdomain: Any - url_scheme: Any - path_info: Any - default_method: Any - query_args: Any - def __init__( - self, map, server_name, script_name, subdomain, url_scheme, path_info, default_method, query_args: Any | None = ... - ): ... - def dispatch(self, view_func, path_info: Any | None = ..., method: Any | None = ..., catch_http_exceptions: bool = ...): ... - def match( - self, path_info: Any | None = ..., method: Any | None = ..., return_rule: bool = ..., query_args: Any | None = ... - ): ... - def test(self, path_info: Any | None = ..., method: Any | None = ...): ... - def allowed_methods(self, path_info: Any | None = ...): ... - def get_host(self, domain_part): ... - def get_default_redirect(self, rule, method, values, query_args): ... - def encode_query_args(self, query_args): ... - def make_redirect_url(self, path_info, query_args: Any | None = ..., domain_part: Any | None = ...): ... - def make_alias_redirect_url(self, path, endpoint, values, method, query_args): ... - def build( - self, endpoint, values: Any | None = ..., method: Any | None = ..., force_external: bool = ..., append_unknown: bool = ... - ): ... diff --git a/stubs/Werkzeug/werkzeug/script.pyi b/stubs/Werkzeug/werkzeug/script.pyi deleted file mode 100644 index 697be67..0000000 --- a/stubs/Werkzeug/werkzeug/script.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from typing import Any - -argument_types: Any -converters: Any - -def run(namespace: Any | None = ..., action_prefix: str = ..., args: Any | None = ...): ... -def fail(message, code: int = ...): ... -def find_actions(namespace, action_prefix): ... -def print_usage(actions): ... -def analyse_action(func): ... -def make_shell(init_func: Any | None = ..., banner: Any | None = ..., use_ipython: bool = ...): ... -def make_runserver( - app_factory, - hostname: str = ..., - port: int = ..., - use_reloader: bool = ..., - use_debugger: bool = ..., - use_evalex: bool = ..., - threaded: bool = ..., - processes: int = ..., - static_files: Any | None = ..., - extra_files: Any | None = ..., - ssl_context: Any | None = ..., -): ... diff --git a/stubs/Werkzeug/werkzeug/security.pyi b/stubs/Werkzeug/werkzeug/security.pyi deleted file mode 100644 index 7e9e907..0000000 --- a/stubs/Werkzeug/werkzeug/security.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any - -SALT_CHARS: Any -DEFAULT_PBKDF2_ITERATIONS: Any - -def pbkdf2_hex(data, salt, iterations=..., keylen: Any | None = ..., hashfunc: Any | None = ...): ... -def pbkdf2_bin(data, salt, iterations=..., keylen: Any | None = ..., hashfunc: Any | None = ...): ... -def safe_str_cmp(a, b): ... -def gen_salt(length): ... -def generate_password_hash(password, method: str = ..., salt_length: int = ...): ... -def check_password_hash(pwhash, password): ... -def safe_join(directory, filename): ... diff --git a/stubs/Werkzeug/werkzeug/serving.pyi b/stubs/Werkzeug/werkzeug/serving.pyi deleted file mode 100644 index b27ae56..0000000 --- a/stubs/Werkzeug/werkzeug/serving.pyi +++ /dev/null @@ -1,140 +0,0 @@ -import sys -from typing import Any - -if sys.version_info >= (3, 0): - from http.server import BaseHTTPRequestHandler, HTTPServer - from socketserver import ThreadingMixIn -else: - from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer - from SocketServer import ThreadingMixIn - -if sys.platform == "win32": - class ForkingMixIn(object): ... - -else: - if sys.version_info >= (3, 0): - from socketserver import ForkingMixIn as ForkingMixIn - else: - from SocketServer import ForkingMixIn as ForkingMixIn - -class _SslDummy: - def __getattr__(self, name): ... - -ssl: Any -LISTEN_QUEUE: Any -can_open_by_fd: Any - -class WSGIRequestHandler(BaseHTTPRequestHandler): - @property - def server_version(self): ... - def make_environ(self): ... - environ: Any - close_connection: Any - def run_wsgi(self): ... - def handle(self): ... - def initiate_shutdown(self): ... - def connection_dropped(self, error, environ: Any | None = ...): ... - raw_requestline: Any - def handle_one_request(self): ... - def send_response(self, code, message: Any | None = ...): ... - def version_string(self): ... - def address_string(self): ... - def port_integer(self): ... - def log_request(self, code: object = ..., size: object = ...) -> None: ... - def log_error(self, *args): ... - def log_message(self, format, *args): ... - def log(self, type, message, *args): ... - -BaseRequestHandler: Any - -def generate_adhoc_ssl_pair(cn: Any | None = ...): ... -def make_ssl_devcert(base_path, host: Any | None = ..., cn: Any | None = ...): ... -def generate_adhoc_ssl_context(): ... -def load_ssl_context(cert_file, pkey_file: Any | None = ..., protocol: Any | None = ...): ... - -class _SSLContext: - def __init__(self, protocol): ... - def load_cert_chain(self, certfile, keyfile: Any | None = ..., password: Any | None = ...): ... - def wrap_socket(self, sock, **kwargs): ... - -def is_ssl_error(error: Any | None = ...): ... -def select_ip_version(host, port): ... - -class BaseWSGIServer(HTTPServer): - multithread: Any - multiprocess: Any - request_queue_size: Any - address_family: Any - app: Any - passthrough_errors: Any - shutdown_signal: Any - host: Any - port: Any - socket: Any - server_address: Any - ssl_context: Any - def __init__( - self, - host, - port, - app, - handler: Any | None = ..., - passthrough_errors: bool = ..., - ssl_context: Any | None = ..., - fd: Any | None = ..., - ): ... - def log(self, type, message, *args): ... - def serve_forever(self): ... - def handle_error(self, request, client_address): ... - def get_request(self): ... - -class ThreadedWSGIServer(ThreadingMixIn, BaseWSGIServer): - multithread: Any - daemon_threads: Any - -class ForkingWSGIServer(ForkingMixIn, BaseWSGIServer): - multiprocess: Any - max_children: Any - def __init__( - self, - host, - port, - app, - processes: int = ..., - handler: Any | None = ..., - passthrough_errors: bool = ..., - ssl_context: Any | None = ..., - fd: Any | None = ..., - ): ... - -def make_server( - host: Any | None = ..., - port: Any | None = ..., - app: Any | None = ..., - threaded: bool = ..., - processes: int = ..., - request_handler: Any | None = ..., - passthrough_errors: bool = ..., - ssl_context: Any | None = ..., - fd: Any | None = ..., -): ... -def is_running_from_reloader(): ... -def run_simple( - hostname, - port, - application, - use_reloader: bool = ..., - use_debugger: bool = ..., - use_evalex: bool = ..., - extra_files: Any | None = ..., - reloader_interval: int = ..., - reloader_type: str = ..., - threaded: bool = ..., - processes: int = ..., - request_handler: Any | None = ..., - static_files: Any | None = ..., - passthrough_errors: bool = ..., - ssl_context: Any | None = ..., -): ... -def run_with_reloader(*args, **kwargs): ... -def main(): ... diff --git a/stubs/Werkzeug/werkzeug/test.pyi b/stubs/Werkzeug/werkzeug/test.pyi deleted file mode 100644 index 79b93fb..0000000 --- a/stubs/Werkzeug/werkzeug/test.pyi +++ /dev/null @@ -1,169 +0,0 @@ -import sys -from _typeshed.wsgi import WSGIEnvironment -from typing import Any, Generic, Text, Tuple, Type, TypeVar, overload -from typing_extensions import Literal - -if sys.version_info >= (3, 0): - from http.cookiejar import CookieJar - from urllib.request import Request as U2Request -else: - from cookielib import CookieJar - from urllib2 import Request as U2Request - -def stream_encode_multipart(values, use_tempfile: int = ..., threshold=..., boundary: Any | None = ..., charset: Text = ...): ... -def encode_multipart(values, boundary: Any | None = ..., charset: Text = ...): ... -def File(fd, filename: Any | None = ..., mimetype: Any | None = ...): ... - -class _TestCookieHeaders: - headers: Any - def __init__(self, headers): ... - def getheaders(self, name): ... - def get_all(self, name, default: Any | None = ...): ... - -class _TestCookieResponse: - headers: Any - def __init__(self, headers): ... - def info(self): ... - -class _TestCookieJar(CookieJar): - def inject_wsgi(self, environ): ... - def extract_wsgi(self, environ, headers): ... - -class EnvironBuilder: - server_protocol: Any - wsgi_version: Any - request_class: Any - charset: Text - path: Any - base_url: Any - query_string: Any - args: Any - method: Any - headers: Any - content_type: Any - errors_stream: Any - multithread: Any - multiprocess: Any - run_once: Any - environ_base: Any - environ_overrides: Any - input_stream: Any - content_length: Any - closed: Any - def __init__( - self, - path: str = ..., - base_url: Any | None = ..., - query_string: Any | None = ..., - method: str = ..., - input_stream: Any | None = ..., - content_type: Any | None = ..., - content_length: Any | None = ..., - errors_stream: Any | None = ..., - multithread: bool = ..., - multiprocess: bool = ..., - run_once: bool = ..., - headers: Any | None = ..., - data: Any | None = ..., - environ_base: Any | None = ..., - environ_overrides: Any | None = ..., - charset: Text = ..., - ): ... - form: Any - files: Any - @property - def server_name(self) -> str: ... - @property - def server_port(self) -> int: ... - def __del__(self) -> None: ... - def close(self) -> None: ... - def get_environ(self) -> WSGIEnvironment: ... - def get_request(self, cls: Any | None = ...): ... - -class ClientRedirectError(Exception): ... - -# Response type for the client below. -# By default _R is Tuple[Iterable[Any], Text | int, datastructures.Headers] -_R = TypeVar("_R") - -class Client(Generic[_R]): - application: Any - response_wrapper: Type[_R] | None - cookie_jar: Any - allow_subdomain_redirects: Any - def __init__( - self, application, response_wrapper: Type[_R] | None = ..., use_cookies: bool = ..., allow_subdomain_redirects: bool = ... - ): ... - def set_cookie( - self, - server_name, - key, - value: str = ..., - max_age: Any | None = ..., - expires: Any | None = ..., - path: str = ..., - domain: Any | None = ..., - secure: Any | None = ..., - httponly: bool = ..., - charset: Text = ..., - ): ... - def delete_cookie(self, server_name, key, path: str = ..., domain: Any | None = ...): ... - def run_wsgi_app(self, environ, buffered: bool = ...): ... - def resolve_redirect(self, response, new_location, environ, buffered: bool = ...): ... - @overload - def open(self, *args, as_tuple: Literal[True], **kwargs) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def open(self, *args, as_tuple: Literal[False] = ..., **kwargs) -> _R: ... - @overload - def open(self, *args, as_tuple: bool, **kwargs) -> Any: ... - @overload - def get(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def get(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def get(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def patch(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def patch(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def patch(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def post(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def post(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def post(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def head(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def head(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def head(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def put(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def put(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def put(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def delete(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def delete(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def delete(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def options(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def options(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def options(self, *args, as_tuple: bool, **kw) -> Any: ... - @overload - def trace(self, *args, as_tuple: Literal[True], **kw) -> Tuple[WSGIEnvironment, _R]: ... - @overload - def trace(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ... - @overload - def trace(self, *args, as_tuple: bool, **kw) -> Any: ... - -def create_environ(*args, **kwargs): ... -def run_wsgi_app(app, environ, buffered: bool = ...): ... diff --git a/stubs/Werkzeug/werkzeug/testapp.pyi b/stubs/Werkzeug/werkzeug/testapp.pyi deleted file mode 100644 index a074482..0000000 --- a/stubs/Werkzeug/werkzeug/testapp.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any - -from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response - -logo: Any -TEMPLATE: Any - -def iter_sys_path(): ... -def render_testapp(req): ... -def test_app(environ, start_response): ... diff --git a/stubs/Werkzeug/werkzeug/urls.pyi b/stubs/Werkzeug/werkzeug/urls.pyi deleted file mode 100644 index 62f4d37..0000000 --- a/stubs/Werkzeug/werkzeug/urls.pyi +++ /dev/null @@ -1,94 +0,0 @@ -from typing import Any, NamedTuple, Text - -class _URLTuple(NamedTuple): - scheme: Any - netloc: Any - path: Any - query: Any - fragment: Any - -class BaseURL(_URLTuple): - def replace(self, **kwargs): ... - @property - def host(self): ... - @property - def ascii_host(self): ... - @property - def port(self): ... - @property - def auth(self): ... - @property - def username(self): ... - @property - def raw_username(self): ... - @property - def password(self): ... - @property - def raw_password(self): ... - def decode_query(self, *args, **kwargs): ... - def join(self, *args, **kwargs): ... - def to_url(self): ... - def decode_netloc(self): ... - def to_uri_tuple(self): ... - def to_iri_tuple(self): ... - def get_file_location(self, pathformat: Any | None = ...): ... - -class URL(BaseURL): - def encode_netloc(self): ... - def encode(self, charset: Text = ..., errors: Text = ...): ... - -class BytesURL(BaseURL): - def encode_netloc(self): ... - def decode(self, charset: Text = ..., errors: Text = ...): ... - -def url_parse(url, scheme: Any | None = ..., allow_fragments: bool = ...): ... -def url_quote(string, charset: Text = ..., errors: Text = ..., safe: str = ..., unsafe: str = ...): ... -def url_quote_plus(string, charset: Text = ..., errors: Text = ..., safe: str = ...): ... -def url_unparse(components): ... -def url_unquote(string, charset: Text = ..., errors: Text = ..., unsafe: str = ...): ... -def url_unquote_plus(s, charset: Text = ..., errors: Text = ...): ... -def url_fix(s, charset: Text = ...): ... -def uri_to_iri(uri, charset: Text = ..., errors: Text = ...): ... -def iri_to_uri(iri, charset: Text = ..., errors: Text = ..., safe_conversion: bool = ...): ... -def url_decode( - s, - charset: Text = ..., - decode_keys: bool = ..., - include_empty: bool = ..., - errors: Text = ..., - separator: str = ..., - cls: Any | None = ..., -): ... -def url_decode_stream( - stream, - charset: Text = ..., - decode_keys: bool = ..., - include_empty: bool = ..., - errors: Text = ..., - separator: str = ..., - cls: Any | None = ..., - limit: Any | None = ..., - return_iterator: bool = ..., -): ... -def url_encode( - obj, charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., key: Any | None = ..., separator: bytes = ... -): ... -def url_encode_stream( - obj, - stream: Any | None = ..., - charset: Text = ..., - encode_keys: bool = ..., - sort: bool = ..., - key: Any | None = ..., - separator: bytes = ..., -): ... -def url_join(base, url, allow_fragments: bool = ...): ... - -class Href: - base: Any - charset: Text - sort: Any - key: Any - def __init__(self, base: str = ..., charset: Text = ..., sort: bool = ..., key: Any | None = ...): ... - def __getattr__(self, name): ... - def __call__(self, *path, **query): ... diff --git a/stubs/Werkzeug/werkzeug/useragents.pyi b/stubs/Werkzeug/werkzeug/useragents.pyi deleted file mode 100644 index 7020670..0000000 --- a/stubs/Werkzeug/werkzeug/useragents.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any - -class UserAgentParser: - platforms: Any - browsers: Any - def __init__(self): ... - def __call__(self, user_agent): ... - -class UserAgent: - string: Any - platform: str | None - browser: str | None - version: str | None - language: str | None - def __init__(self, environ_or_string): ... - def to_header(self): ... - def __nonzero__(self): ... - __bool__: Any diff --git a/stubs/Werkzeug/werkzeug/utils.pyi b/stubs/Werkzeug/werkzeug/utils.pyi deleted file mode 100644 index 5b4f507..0000000 --- a/stubs/Werkzeug/werkzeug/utils.pyi +++ /dev/null @@ -1,59 +0,0 @@ -from typing import Any, Text, Type, TypeVar, overload - -from werkzeug._internal import _DictAccessorProperty -from werkzeug.wrappers import Response - -class cached_property(property): - __name__: Any - __module__: Any - __doc__: Any - func: Any - def __init__(self, func, name: Any | None = ..., doc: Any | None = ...): ... - def __set__(self, obj, value): ... - def __get__(self, obj, type: Any | None = ...): ... - -class environ_property(_DictAccessorProperty): - read_only: Any - def lookup(self, obj): ... - -class header_property(_DictAccessorProperty): - def lookup(self, obj): ... - -class HTMLBuilder: - def __init__(self, dialect): ... - def __call__(self, s): ... - def __getattr__(self, tag): ... - -html: Any -xhtml: Any - -def get_content_type(mimetype, charset): ... -def format_string(string, context): ... -def secure_filename(filename: Text) -> Text: ... -def escape(s, quote: Any | None = ...): ... -def unescape(s): ... - -# 'redirect' returns a werkzeug Response, unless you give it -# another Response type to use instead. -_RC = TypeVar("_RC", bound=Response) - -@overload -def redirect(location: str, code: int = ..., Response: None = ...) -> Response: ... -@overload -def redirect(location: str, code: int = ..., Response: Type[_RC] = ...) -> _RC: ... -def append_slash_redirect(environ, code: int = ...): ... -def import_string(import_name, silent: bool = ...): ... -def find_modules(import_path, include_packages: bool = ..., recursive: bool = ...): ... -def validate_arguments(func, args, kwargs, drop_extra: bool = ...): ... -def bind_arguments(func, args, kwargs): ... - -class ArgumentValidationError(ValueError): - missing: Any - extra: Any - extra_positional: Any - def __init__(self, missing: Any | None = ..., extra: Any | None = ..., extra_positional: Any | None = ...): ... - -class ImportStringError(ImportError): - import_name: Any - exception: Any - def __init__(self, import_name, exception): ... diff --git a/stubs/Werkzeug/werkzeug/wrappers.pyi b/stubs/Werkzeug/werkzeug/wrappers.pyi deleted file mode 100644 index ef11750..0000000 --- a/stubs/Werkzeug/werkzeug/wrappers.pyi +++ /dev/null @@ -1,274 +0,0 @@ -from _typeshed.wsgi import InputStream, WSGIEnvironment -from datetime import datetime, timedelta -from typing import Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence, Text, Tuple, Type, TypeVar, overload -from typing_extensions import Literal - -from .datastructures import ( - Accept, - Authorization, - CharsetAccept, - CombinedMultiDict, - EnvironHeaders, - Headers, - HeaderSet, - ImmutableMultiDict, - ImmutableTypeConversionDict, - LanguageAccept, - MIMEAccept, - MultiDict, -) -from .useragents import UserAgent - -class BaseRequest: - charset: str - encoding_errors: str - max_content_length: int | None - max_form_memory_size: int - parameter_storage_class: Type[Any] - list_storage_class: Type[Any] - dict_storage_class: Type[Any] - form_data_parser_class: Type[Any] - trusted_hosts: Sequence[Text] | None - disable_data_descriptor: Any - environ: WSGIEnvironment = ... - shallow: Any - def __init__(self, environ: WSGIEnvironment, populate_request: bool = ..., shallow: bool = ...) -> None: ... - @property - def url_charset(self) -> str: ... - @classmethod - def from_values(cls, *args, **kwargs) -> BaseRequest: ... - @classmethod - def application(cls, f): ... - @property - def want_form_data_parsed(self): ... - def make_form_data_parser(self): ... - def close(self) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, tb): ... - @property - def stream(self) -> InputStream: ... - input_stream: InputStream - args: ImmutableMultiDict[Any, Any] - @property - def data(self) -> bytes: ... - @overload - def get_data(self, cache: bool = ..., as_text: Literal[False] = ..., parse_form_data: bool = ...) -> bytes: ... - @overload - def get_data(self, cache: bool, as_text: Literal[True], parse_form_data: bool = ...) -> Text: ... - @overload - def get_data(self, *, as_text: Literal[True], parse_form_data: bool = ...) -> Text: ... - @overload - def get_data(self, cache: bool, as_text: bool, parse_form_data: bool = ...) -> Any: ... - @overload - def get_data(self, *, as_text: bool, parse_form_data: bool = ...) -> Any: ... - form: ImmutableMultiDict[Any, Any] - values: CombinedMultiDict[Any, Any] - files: MultiDict[Any, Any] - @property - def cookies(self) -> ImmutableTypeConversionDict[str, str]: ... - headers: EnvironHeaders - path: Text - full_path: Text - script_root: Text - url: Text - base_url: Text - url_root: Text - host_url: Text - host: Text - query_string: bytes - method: Text - @property - def access_route(self) -> Sequence[str]: ... - @property - def remote_addr(self) -> str: ... - remote_user: Text - scheme: str - is_xhr: bool - is_secure: bool - is_multithread: bool - is_multiprocess: bool - is_run_once: bool - -_OnCloseT = TypeVar("_OnCloseT", bound=Callable[[], Any]) -_SelfT = TypeVar("_SelfT", bound=BaseResponse) - -class BaseResponse: - charset: str - default_status: int - default_mimetype: str | None - implicit_sequence_conversion: bool - autocorrect_location_header: bool - automatically_set_content_length: bool - headers: Headers - status_code: int - status: str - direct_passthrough: bool - response: Iterable[bytes] - def __init__( - self, - response: str | bytes | bytearray | Iterable[str] | Iterable[bytes] | None = ..., - status: Text | int | None = ..., - headers: Headers | Mapping[Text, Text] | Sequence[Tuple[Text, Text]] | None = ..., - mimetype: Text | None = ..., - content_type: Text | None = ..., - direct_passthrough: bool = ..., - ) -> None: ... - def call_on_close(self, func: _OnCloseT) -> _OnCloseT: ... - @classmethod - def force_type(cls: Type[_SelfT], response: object, environ: WSGIEnvironment | None = ...) -> _SelfT: ... - @classmethod - def from_app(cls: Type[_SelfT], app: Any, environ: WSGIEnvironment, buffered: bool = ...) -> _SelfT: ... - @overload - def get_data(self, as_text: Literal[False] = ...) -> bytes: ... - @overload - def get_data(self, as_text: Literal[True]) -> Text: ... - @overload - def get_data(self, as_text: bool) -> Any: ... - def set_data(self, value: bytes | Text) -> None: ... - data: Any - def calculate_content_length(self) -> int | None: ... - def make_sequence(self) -> None: ... - def iter_encoded(self) -> Iterator[bytes]: ... - def set_cookie( - self, - key: str, - value: str | bytes = ..., - max_age: float | timedelta | None = ..., - expires: int | datetime | None = ..., - path: str = ..., - domain: str | None = ..., - secure: bool = ..., - httponly: bool = ..., - samesite: str | None = ..., - ) -> None: ... - def delete_cookie(self, key, path: str = ..., domain: Any | None = ...): ... - @property - def is_streamed(self) -> bool: ... - @property - def is_sequence(self) -> bool: ... - def close(self) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, tb): ... - # The no_etag argument if fictional, but required for compatibility with - # ETagResponseMixin - def freeze(self, no_etag: bool = ...) -> None: ... - def get_wsgi_headers(self, environ): ... - def get_app_iter(self, environ): ... - def get_wsgi_response(self, environ): ... - def __call__(self, environ, start_response): ... - -class AcceptMixin(object): - @property - def accept_mimetypes(self) -> MIMEAccept: ... - @property - def accept_charsets(self) -> CharsetAccept: ... - @property - def accept_encodings(self) -> Accept: ... - @property - def accept_languages(self) -> LanguageAccept: ... - -class ETagRequestMixin: - @property - def cache_control(self): ... - @property - def if_match(self): ... - @property - def if_none_match(self): ... - @property - def if_modified_since(self): ... - @property - def if_unmodified_since(self): ... - @property - def if_range(self): ... - @property - def range(self): ... - -class UserAgentMixin: - @property - def user_agent(self) -> UserAgent: ... - -class AuthorizationMixin: - @property - def authorization(self) -> Authorization | None: ... - -class StreamOnlyMixin: - disable_data_descriptor: Any - want_form_data_parsed: Any - -class ETagResponseMixin: - @property - def cache_control(self): ... - status_code: Any - def make_conditional(self, request_or_environ, accept_ranges: bool = ..., complete_length: Any | None = ...): ... - def add_etag(self, overwrite: bool = ..., weak: bool = ...): ... - def set_etag(self, etag, weak: bool = ...): ... - def get_etag(self): ... - def freeze(self, no_etag: bool = ...) -> None: ... - accept_ranges: Any - content_range: Any - -class ResponseStream: - mode: Any - response: Any - closed: Any - def __init__(self, response): ... - def write(self, value): ... - def writelines(self, seq): ... - def close(self): ... - def flush(self): ... - def isatty(self): ... - @property - def encoding(self): ... - -class ResponseStreamMixin: - @property - def stream(self) -> ResponseStream: ... - -class CommonRequestDescriptorsMixin: - @property - def content_type(self) -> str | None: ... - @property - def content_length(self) -> int | None: ... - @property - def content_encoding(self) -> str | None: ... - @property - def content_md5(self) -> str | None: ... - @property - def referrer(self) -> str | None: ... - @property - def date(self) -> datetime | None: ... - @property - def max_forwards(self) -> int | None: ... - @property - def mimetype(self) -> str: ... - @property - def mimetype_params(self) -> Mapping[str, str]: ... - @property - def pragma(self) -> HeaderSet: ... - -class CommonResponseDescriptorsMixin: - mimetype: str | None = ... - @property - def mimetype_params(self) -> MutableMapping[str, str]: ... - location: str | None = ... - age: Any = ... # get: datetime.timedelta | None - content_type: str | None = ... - content_length: int | None = ... - content_location: str | None = ... - content_encoding: str | None = ... - content_md5: str | None = ... - date: Any = ... # get: datetime.datetime | None - expires: Any = ... # get: datetime.datetime | None - last_modified: Any = ... # get: datetime.datetime | None - retry_after: Any = ... # get: datetime.datetime | None - vary: str | None = ... - content_language: str | None = ... - allow: str | None = ... - -class WWWAuthenticateMixin: - @property - def www_authenticate(self): ... - -class Request(BaseRequest, AcceptMixin, ETagRequestMixin, UserAgentMixin, AuthorizationMixin, CommonRequestDescriptorsMixin): ... -class PlainRequest(StreamOnlyMixin, Request): ... -class Response(BaseResponse, ETagResponseMixin, ResponseStreamMixin, CommonResponseDescriptorsMixin, WWWAuthenticateMixin): ... diff --git a/stubs/Werkzeug/werkzeug/wsgi.pyi b/stubs/Werkzeug/werkzeug/wsgi.pyi deleted file mode 100644 index a0bf5ab..0000000 --- a/stubs/Werkzeug/werkzeug/wsgi.pyi +++ /dev/null @@ -1,74 +0,0 @@ -from _typeshed import SupportsRead -from _typeshed.wsgi import InputStream, WSGIEnvironment -from typing import Any, Iterable, Text - -from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware -from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware -from .middleware.shared_data import SharedDataMiddleware as SharedDataMiddleware - -def responder(f): ... -def get_current_url( - environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ..., trusted_hosts: Any | None = ... -): ... -def host_is_trusted(hostname, trusted_list): ... -def get_host(environ, trusted_hosts: Any | None = ...): ... -def get_content_length(environ: WSGIEnvironment) -> int | None: ... -def get_input_stream(environ: WSGIEnvironment, safe_fallback: bool = ...) -> InputStream: ... -def get_query_string(environ): ... -def get_path_info(environ, charset: Text = ..., errors: Text = ...): ... -def get_script_name(environ, charset: Text = ..., errors: Text = ...): ... -def pop_path_info(environ, charset: Text = ..., errors: Text = ...): ... -def peek_path_info(environ, charset: Text = ..., errors: Text = ...): ... -def extract_path_info( - environ_or_baseurl, path_or_url, charset: Text = ..., errors: Text = ..., collapse_http_schemes: bool = ... -): ... - -class ClosingIterator: - def __init__(self, iterable, callbacks: Any | None = ...): ... - def __iter__(self): ... - def __next__(self): ... - def close(self): ... - -def wrap_file(environ: WSGIEnvironment, file: SupportsRead[bytes], buffer_size: int = ...) -> Iterable[bytes]: ... - -class FileWrapper: - file: SupportsRead[bytes] - buffer_size: int - def __init__(self, file: SupportsRead[bytes], buffer_size: int = ...) -> None: ... - def close(self) -> None: ... - def seekable(self) -> bool: ... - def seek(self, offset: int, whence: int = ...) -> None: ... - def tell(self) -> int | None: ... - def __iter__(self) -> FileWrapper: ... - def __next__(self) -> bytes: ... - -class _RangeWrapper: - iterable: Any - byte_range: Any - start_byte: Any - end_byte: Any - read_length: Any - seekable: Any - end_reached: Any - def __init__(self, iterable, start_byte: int = ..., byte_range: Any | None = ...): ... - def __iter__(self): ... - def __next__(self): ... - def close(self): ... - -def make_line_iter(stream, limit: Any | None = ..., buffer_size=..., cap_at_buffer: bool = ...): ... -def make_chunk_iter(stream, separator, limit: Any | None = ..., buffer_size=..., cap_at_buffer: bool = ...): ... - -class LimitedStream: - limit: Any - def __init__(self, stream, limit): ... - def __iter__(self): ... - @property - def is_exhausted(self): ... - def on_exhausted(self): ... - def on_disconnect(self): ... - def exhaust(self, chunk_size=...): ... - def read(self, size: Any | None = ...): ... - def readline(self, size: Any | None = ...): ... - def readlines(self, size: Any | None = ...): ... - def tell(self): ... - def __next__(self): ... diff --git a/stubs/aiofiles/@tests/stubtest_allowlist.txt b/stubs/aiofiles/@tests/stubtest_allowlist.txt index 0a5668c..d715b3f 100644 --- a/stubs/aiofiles/@tests/stubtest_allowlist.txt +++ b/stubs/aiofiles/@tests/stubtest_allowlist.txt @@ -1,3 +1,8 @@ +# Some arguments only exist on FreeBSD and MacOS +aiofiles.os.sendfile + +# These all delegate using *args,**kwargs, but stubs use signature of +# method they are being delegated to. aiofiles.threadpool.binary.AsyncBufferedIOBase.close aiofiles.threadpool.binary.AsyncBufferedIOBase.detach aiofiles.threadpool.binary.AsyncBufferedIOBase.fileno @@ -25,3 +30,30 @@ aiofiles.threadpool.text.AsyncTextIOWrapper.readable aiofiles.threadpool.text.AsyncTextIOWrapper.seekable aiofiles.threadpool.text.AsyncTextIOWrapper.tell aiofiles.threadpool.text.AsyncTextIOWrapper.writable + +# These functions get the wrong signature from functools.wraps() +aiofiles.os.stat +aiofiles.os.rename +aiofiles.os.replace +aiofiles.os.remove +aiofiles.os.mkdir +aiofiles.os.makedirs +aiofiles.os.rmdir +aiofiles.os.removedirs +aiofiles.ospath.exists +aiofiles.ospath.isfile +aiofiles.ospath.isdir +aiofiles.ospath.getsize +aiofiles.ospath.getmtime +aiofiles.ospath.getatime +aiofiles.ospath.getctime +aiofiles.ospath.samefile +aiofiles.ospath.sameopenfile + +# Same issues as above +aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.fileno +aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.flush +aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.isatty +aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.rollover +aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.tell +aiofiles.tempfile.temptypes.AsyncTemporaryDirectory.cleanup diff --git a/stubs/aiofiles/METADATA.toml b/stubs/aiofiles/METADATA.toml index 40f3c61..130d4fc 100644 --- a/stubs/aiofiles/METADATA.toml +++ b/stubs/aiofiles/METADATA.toml @@ -1,2 +1 @@ -version = "0.1" -requires = [] +version = "22.1.*" diff --git a/stubs/aiofiles/aiofiles/__init__.pyi b/stubs/aiofiles/aiofiles/__init__.pyi index 2bbbc29..468393c 100644 --- a/stubs/aiofiles/aiofiles/__init__.pyi +++ b/stubs/aiofiles/aiofiles/__init__.pyi @@ -1 +1,2 @@ +from . import tempfile as tempfile from .threadpool import open as open diff --git a/stubs/aiofiles/aiofiles/base.pyi b/stubs/aiofiles/aiofiles/base.pyi index 3859bc5..8919031 100644 --- a/stubs/aiofiles/aiofiles/base.pyi +++ b/stubs/aiofiles/aiofiles/base.pyi @@ -1,6 +1,7 @@ from _typeshed import Self +from collections.abc import Coroutine, Generator, Iterator from types import CodeType, FrameType, TracebackType, coroutine -from typing import Any, Coroutine, Generator, Generic, Iterator, Type, TypeVar +from typing import Any, Generic, TypeVar _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) @@ -15,7 +16,7 @@ class AsyncBase(Generic[_T]): class AiofilesContextManager(Generic[_T_co, _T_contra, _V_co]): def __init__(self, coro: Coroutine[_T_co, _T_contra, _V_co]) -> None: ... def send(self, value: _T_contra) -> _T_co: ... - def throw(self, typ: Type[BaseException], val: BaseException | object = ..., tb: TracebackType | None = ...) -> _T_co: ... + def throw(self, typ: type[BaseException], val: BaseException | object = ..., tb: TracebackType | None = ...) -> _T_co: ... def close(self) -> None: ... @property def gi_frame(self) -> FrameType: ... @@ -30,5 +31,5 @@ class AiofilesContextManager(Generic[_T_co, _T_contra, _V_co]): async def __anext__(self) -> _V_co: ... async def __aenter__(self) -> _V_co: ... async def __aexit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... diff --git a/stubs/aiofiles/aiofiles/os.pyi b/stubs/aiofiles/aiofiles/os.pyi index b48884c..98881cd 100644 --- a/stubs/aiofiles/aiofiles/os.pyi +++ b/stubs/aiofiles/aiofiles/os.pyi @@ -1,28 +1,72 @@ import sys from _typeshed import StrOrBytesPath +from asyncio.events import AbstractEventLoop +from collections.abc import Sequence from os import stat_result -from typing import Sequence, Union, overload +from typing import Any, overload +from typing_extensions import TypeAlias -_FdOrAnyPath = Union[int, StrOrBytesPath] +from . import ospath -async def stat(path: _FdOrAnyPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> stat_result: ... +path = ospath + +_FdOrAnyPath: TypeAlias = int | StrOrBytesPath + +async def stat( + path: _FdOrAnyPath, + *, + dir_fd: int | None = ..., + follow_symlinks: bool = ..., + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> stat_result: ... async def rename( - src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = ..., dst_dir_fd: int | None = ... + src: StrOrBytesPath, + dst: StrOrBytesPath, + *, + src_dir_fd: int | None = ..., + dst_dir_fd: int | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> None: ... +async def replace( + src: StrOrBytesPath, + dst: StrOrBytesPath, + *, + src_dir_fd: int | None = ..., + dst_dir_fd: int | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> None: ... +async def remove( + path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def mkdir( + path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... ) -> None: ... -async def remove(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... -async def mkdir(path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ...) -> None: ... -async def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... +async def makedirs( + name: StrOrBytesPath, mode: int = ..., exist_ok: bool = ..., *, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def rmdir( + path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def removedirs(name: StrOrBytesPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> None: ... if sys.platform != "win32": @overload - async def sendfile(__out_fd: int, __in_fd: int, offset: int | None, count: int) -> int: ... + async def sendfile( + out_fd: int, in_fd: int, offset: int | None, count: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ... + ) -> int: ... @overload async def sendfile( - __out_fd: int, - __in_fd: int, + out_fd: int, + in_fd: int, offset: int, count: int, headers: Sequence[bytes] = ..., trailers: Sequence[bytes] = ..., flags: int = ..., - ) -> int: ... + *, + loop: AbstractEventLoop | None = ..., + executor: Any = ..., + ) -> int: ... # FreeBSD and Mac OS X only diff --git a/stubs/aiofiles/aiofiles/ospath.pyi b/stubs/aiofiles/aiofiles/ospath.pyi new file mode 100644 index 0000000..4b5735c --- /dev/null +++ b/stubs/aiofiles/aiofiles/ospath.pyi @@ -0,0 +1,15 @@ +from _typeshed import StrOrBytesPath +from asyncio.events import AbstractEventLoop +from typing import Any + +async def exists(path: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def isfile(path: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def isdir(s: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def getsize(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> int: ... +async def getmtime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... +async def getatime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... +async def getctime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... +async def samefile( + f1: StrOrBytesPath | int, f2: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> bool: ... +async def sameopenfile(fp1: int, fp2: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... diff --git a/stubs/aiofiles/aiofiles/tempfile/__init__.pyi b/stubs/aiofiles/aiofiles/tempfile/__init__.pyi new file mode 100644 index 0000000..95af3e1 --- /dev/null +++ b/stubs/aiofiles/aiofiles/tempfile/__init__.pyi @@ -0,0 +1,260 @@ +from _typeshed import ( + BytesPath, + Incomplete, + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, + StrOrBytesPath, + StrPath, +) +from asyncio import AbstractEventLoop +from typing import AnyStr, TypeVar, overload +from typing_extensions import Literal + +from ..base import AiofilesContextManager +from ..threadpool.binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO +from ..threadpool.text import AsyncTextIOWrapper +from .temptypes import AsyncTemporaryDirectory + +_T_co = TypeVar("_T_co", covariant=True) +_V_co = TypeVar("_V_co", covariant=True) +_T_contra = TypeVar("_T_contra", contravariant=True) + +# Text mode: always returns AsyncTextIOWrapper +@overload +def NamedTemporaryFile( + mode: OpenTextMode, + buffering: int = ..., + encoding: str | None = ..., + newline: str | None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + delete: bool = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... + +# Unbuffered binary: returns a FileIO +@overload +def NamedTemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + delete: bool = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncFileIO]: ... + +# Buffered binary reading/updating: AsyncBufferedReader +@overload +def NamedTemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = ..., + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + delete: bool = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... + +# Buffered binary writing: AsyncBufferedIOBase +@overload +def NamedTemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + delete: bool = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... + +# Text mode: always returns AsyncTextIOWrapper +@overload +def TemporaryFile( + mode: OpenTextMode, + buffering: int = ..., + encoding: str | None = ..., + newline: str | None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... + +# Unbuffered binary: returns a FileIO +@overload +def TemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncFileIO]: ... + +# Buffered binary reading/updating: AsyncBufferedReader +@overload +def TemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = ..., + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... + +# Buffered binary writing: AsyncBufferedIOBase +@overload +def TemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... + +# Text mode: always returns AsyncTextIOWrapper +@overload +def SpooledTemporaryFile( + max_size: int = ..., + *, + mode: OpenTextMode, + buffering: int = ..., + encoding: str | None = ..., + newline: str | None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... +@overload +def SpooledTemporaryFile( + max_size: int, + mode: OpenTextMode, + buffering: int = ..., + encoding: str | None = ..., + newline: str | None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... + +# Unbuffered binary: returns a FileIO +@overload +def SpooledTemporaryFile( + max_size: int = ..., + mode: OpenBinaryMode = ..., + *, + buffering: Literal[0], + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncFileIO]: ... +@overload +def SpooledTemporaryFile( + max_size: int, + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncFileIO]: ... + +# Buffered binary reading/updating: AsyncBufferedReader +@overload +def SpooledTemporaryFile( + max_size: int = ..., + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = ..., + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... + +# Buffered binary writing: AsyncBufferedIOBase +@overload +def SpooledTemporaryFile( + max_size: int = ..., + *, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... +@overload +def SpooledTemporaryFile( + max_size: int, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + newline: None = ..., + suffix: AnyStr | None = ..., + prefix: AnyStr | None = ..., + dir: StrOrBytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... +@overload +def TemporaryDirectory( + suffix: str | None = ..., + prefix: str | None = ..., + dir: StrPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManagerTempDir[None, None, AsyncTemporaryDirectory]: ... +@overload +def TemporaryDirectory( + suffix: bytes | None = ..., + prefix: bytes | None = ..., + dir: BytesPath | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Incomplete | None = ..., +) -> AiofilesContextManagerTempDir[None, None, AsyncTemporaryDirectory]: ... + +class AiofilesContextManagerTempDir(AiofilesContextManager[_T_co, _T_contra, _V_co]): + async def __aenter__(self) -> Incomplete: ... diff --git a/stubs/aiofiles/aiofiles/tempfile/temptypes.pyi b/stubs/aiofiles/aiofiles/tempfile/temptypes.pyi new file mode 100644 index 0000000..61fdfb6 --- /dev/null +++ b/stubs/aiofiles/aiofiles/tempfile/temptypes.pyi @@ -0,0 +1,51 @@ +from _typeshed import Incomplete +from asyncio import AbstractEventLoop +from collections.abc import Generator, Iterable +from tempfile import TemporaryDirectory, _BytesMode +from types import coroutine as coroutine +from typing import TypeVar + +from ..base import AsyncBase as AsyncBase +from ..threadpool.utils import ( + cond_delegate_to_executor as cond_delegate_to_executor, + delegate_to_executor as delegate_to_executor, + proxy_property_directly as proxy_property_directly, +) + +_T = TypeVar("_T") + +class AsyncSpooledTemporaryFile(AsyncBase[_T]): + def fileno(self) -> Generator[Incomplete, Incomplete, Incomplete]: ... + def rollover(self) -> Generator[Incomplete, Incomplete, Incomplete]: ... + async def flush(self) -> None: ... + async def isatty(self) -> bool: ... + # All must return `AnyStr`: + async def read(self, __n: int = ...) -> Incomplete: ... + async def readline(self, __limit: int | None = ...) -> Incomplete: ... + async def readlines(self, __hint: int = ...) -> list[Incomplete]: ... + # --- + async def seek(self, offset: int, whence: int = ...) -> int: ... + async def tell(self) -> int: ... + async def truncate(self, size: int | None = ...) -> None: ... + @property + def closed(self) -> bool: ... + @property + def encoding(self) -> str: ... + @property + def mode(self) -> _BytesMode: ... + @property + def name(self) -> str: ... + @property + def newlines(self) -> str: ... + # Both should work with `AnyStr`, like in `tempfile`: + async def write(self, s: Incomplete) -> int: ... + async def writelines(self, iterable: Iterable[Incomplete]) -> None: ... + +class AsyncTemporaryDirectory: + async def cleanup(self) -> None: ... + @property + def name(self) -> Incomplete: ... # should be `AnyStr` + def __init__( + self, file: TemporaryDirectory[Incomplete], loop: AbstractEventLoop | None, executor: Incomplete | None + ) -> None: ... + async def close(self) -> None: ... diff --git a/stubs/aiofiles/aiofiles/threadpool/__init__.pyi b/stubs/aiofiles/aiofiles/threadpool/__init__.pyi index a43b5ab..92d126d 100644 --- a/stubs/aiofiles/aiofiles/threadpool/__init__.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/__init__.pyi @@ -7,15 +7,16 @@ from _typeshed import ( StrOrBytesPath, ) from asyncio import AbstractEventLoop -from typing import Any, Callable, Union, overload -from typing_extensions import Literal +from collections.abc import Callable +from typing import Any, overload +from typing_extensions import Literal, TypeAlias from ..base import AiofilesContextManager from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, _UnknownAsyncBinaryIO from .text import AsyncTextIOWrapper -_OpenFile = Union[StrOrBytesPath, int] -_Opener = Callable[[str, int], int] +_OpenFile: TypeAlias = StrOrBytesPath | int +_Opener: TypeAlias = Callable[[str, int], int] # Text mode: always returns AsyncTextIOWrapper @overload @@ -86,7 +87,7 @@ def open( def open( file: _OpenFile, mode: OpenBinaryMode, - buffering: int, + buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ..., diff --git a/stubs/aiofiles/aiofiles/threadpool/binary.pyi b/stubs/aiofiles/aiofiles/threadpool/binary.pyi index 27bfd7c..2f77300 100644 --- a/stubs/aiofiles/aiofiles/threadpool/binary.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/binary.pyi @@ -1,6 +1,6 @@ from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer +from collections.abc import Iterable from io import FileIO -from typing import Iterable from ..base import AsyncBase diff --git a/stubs/aiofiles/aiofiles/threadpool/text.pyi b/stubs/aiofiles/aiofiles/threadpool/text.pyi index fd2a901..4712e34 100644 --- a/stubs/aiofiles/aiofiles/threadpool/text.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/text.pyi @@ -1,5 +1,6 @@ from _typeshed import StrOrBytesPath -from typing import BinaryIO, Iterable, Tuple +from collections.abc import Iterable +from typing import BinaryIO from ..base import AsyncBase @@ -31,7 +32,7 @@ class AsyncTextIOWrapper(AsyncBase[str]): @property def line_buffering(self) -> bool: ... @property - def newlines(self) -> str | Tuple[str, ...] | None: ... + def newlines(self) -> str | tuple[str, ...] | None: ... @property def name(self) -> StrOrBytesPath | int: ... @property diff --git a/stubs/aiofiles/aiofiles/threadpool/utils.pyi b/stubs/aiofiles/aiofiles/threadpool/utils.pyi new file mode 100644 index 0000000..afff76d --- /dev/null +++ b/stubs/aiofiles/aiofiles/threadpool/utils.pyi @@ -0,0 +1,11 @@ +from collections.abc import Callable +from types import coroutine as coroutine +from typing import TypeVar + +_T = TypeVar("_T", bound=type) + +# All these function actually mutate the given type: +def delegate_to_executor(*attrs: str) -> Callable[[_T], _T]: ... +def proxy_method_directly(*attrs: str) -> Callable[[_T], _T]: ... +def proxy_property_directly(*attrs: str) -> Callable[[_T], _T]: ... +def cond_delegate_to_executor(*attrs: str) -> Callable[[_T], _T]: ... diff --git a/stubs/annoy/METADATA.toml b/stubs/annoy/METADATA.toml index d84fa99..a5db24b 100644 --- a/stubs/annoy/METADATA.toml +++ b/stubs/annoy/METADATA.toml @@ -1,2 +1,5 @@ -version = "1.17" +version = "1.17.*" requires = [] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/annoy/annoy/__init__.pyi b/stubs/annoy/annoy/__init__.pyi index 87ecc5c..8a1ced3 100644 --- a/stubs/annoy/annoy/__init__.pyi +++ b/stubs/annoy/annoy/__init__.pyi @@ -1,44 +1,5 @@ -from _typeshed import SupportsLenAndGetItem -from typing import overload -from typing_extensions import Literal +from typing_extensions import TypeAlias -_Vector = SupportsLenAndGetItem[float] +from .annoylib import Annoy -class AnnoyIndex: - f: int - def __init__(self, f: int, metric: Literal["angular", "euclidean", "manhattan", "hamming", "dot"]) -> None: ... - def load(self, fn: str, prefault: bool = ...) -> Literal[True]: ... - def save(self, fn: str, prefault: bool = ...) -> Literal[True]: ... - @overload - def get_nns_by_item(self, i: int, n: int, search_k: int = ..., include_distances: Literal[False] = ...) -> list[int]: ... - @overload - def get_nns_by_item( - self, i: int, n: int, search_k: int, include_distances: Literal[True] - ) -> tuple[list[int], list[float]]: ... - @overload - def get_nns_by_item( - self, i: int, n: int, search_k: int = ..., *, include_distances: Literal[True] - ) -> tuple[list[int], list[float]]: ... - @overload - def get_nns_by_vector( - self, vector: _Vector, n: int, search_k: int = ..., include_distances: Literal[False] = ... - ) -> list[int]: ... - @overload - def get_nns_by_vector( - self, vector: _Vector, n: int, search_k: int, include_distances: Literal[True] - ) -> tuple[list[int], list[float]]: ... - @overload - def get_nns_by_vector( - self, vector: _Vector, n: int, search_k: int = ..., *, include_distances: Literal[True] - ) -> tuple[list[int], list[float]]: ... - def get_item_vector(self, __i: int) -> list[float]: ... - def add_item(self, i: int, vector: _Vector) -> None: ... - def on_disk_build(self, fn: str) -> Literal[True]: ... - def build(self, n_trees: int, n_jobs: int = ...) -> Literal[True]: ... - def unbuild(self) -> Literal[True]: ... - def unload(self) -> Literal[True]: ... - def get_distance(self, __i: int, __j: int) -> float: ... - def get_n_items(self) -> int: ... - def get_n_trees(self) -> int: ... - def verbose(self, __v: bool) -> Literal[True]: ... - def set_seed(self, __s: int) -> None: ... +AnnoyIndex: TypeAlias = Annoy diff --git a/stubs/annoy/annoy/annoylib.pyi b/stubs/annoy/annoy/annoylib.pyi new file mode 100644 index 0000000..cae6dd2 --- /dev/null +++ b/stubs/annoy/annoy/annoylib.pyi @@ -0,0 +1,44 @@ +from _typeshed import SupportsLenAndGetItem +from typing import overload +from typing_extensions import Literal, TypeAlias + +_Vector: TypeAlias = SupportsLenAndGetItem[float] + +class Annoy: + f: int + def __init__(self, f: int, metric: Literal["angular", "euclidean", "manhattan", "hamming", "dot"]) -> None: ... + def load(self, fn: str, prefault: bool = ...) -> Literal[True]: ... + def save(self, fn: str, prefault: bool = ...) -> Literal[True]: ... + @overload + def get_nns_by_item(self, i: int, n: int, search_k: int = ..., include_distances: Literal[False] = ...) -> list[int]: ... + @overload + def get_nns_by_item( + self, i: int, n: int, search_k: int, include_distances: Literal[True] + ) -> tuple[list[int], list[float]]: ... + @overload + def get_nns_by_item( + self, i: int, n: int, search_k: int = ..., *, include_distances: Literal[True] + ) -> tuple[list[int], list[float]]: ... + @overload + def get_nns_by_vector( + self, vector: _Vector, n: int, search_k: int = ..., include_distances: Literal[False] = ... + ) -> list[int]: ... + @overload + def get_nns_by_vector( + self, vector: _Vector, n: int, search_k: int, include_distances: Literal[True] + ) -> tuple[list[int], list[float]]: ... + @overload + def get_nns_by_vector( + self, vector: _Vector, n: int, search_k: int = ..., *, include_distances: Literal[True] + ) -> tuple[list[int], list[float]]: ... + def get_item_vector(self, __i: int) -> list[float]: ... + def add_item(self, i: int, vector: _Vector) -> None: ... + def on_disk_build(self, fn: str) -> Literal[True]: ... + def build(self, n_trees: int, n_jobs: int = ...) -> Literal[True]: ... + def unbuild(self) -> Literal[True]: ... + def unload(self) -> Literal[True]: ... + def get_distance(self, __i: int, __j: int) -> float: ... + def get_n_items(self) -> int: ... + def get_n_trees(self) -> int: ... + def verbose(self, __v: bool) -> Literal[True]: ... + def set_seed(self, __s: int) -> None: ... diff --git a/stubs/appdirs/METADATA.toml b/stubs/appdirs/METADATA.toml index 46f5153..3a60aff 100644 --- a/stubs/appdirs/METADATA.toml +++ b/stubs/appdirs/METADATA.toml @@ -1 +1,4 @@ -version = "1.4" +version = "1.4.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/atomicwrites/@tests/stubtest_allowlist.txt b/stubs/atomicwrites/@tests/stubtest_allowlist.txt deleted file mode 100644 index 3bf9df3..0000000 --- a/stubs/atomicwrites/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1 +0,0 @@ -atomicwrites.AtomicWriter.get_fileobject diff --git a/stubs/atomicwrites/METADATA.toml b/stubs/atomicwrites/METADATA.toml deleted file mode 100644 index fe057a0..0000000 --- a/stubs/atomicwrites/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "1.4" -python2 = true diff --git a/stubs/atomicwrites/atomicwrites/__init__.pyi b/stubs/atomicwrites/atomicwrites/__init__.pyi deleted file mode 100644 index 388ac27..0000000 --- a/stubs/atomicwrites/atomicwrites/__init__.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from _typeshed import StrOrBytesPath -from typing import IO, Any, AnyStr, Callable, ContextManager, Text, Type - -def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ... -def move_atomic(src: AnyStr, dst: AnyStr) -> None: ... - -class AtomicWriter(object): - def __init__(self, path: StrOrBytesPath, mode: Text = ..., overwrite: bool = ...) -> None: ... - def open(self) -> ContextManager[IO[Any]]: ... - def _open(self, get_fileobject: Callable[..., IO[AnyStr]]) -> ContextManager[IO[AnyStr]]: ... - def get_fileobject(self, dir: StrOrBytesPath | None = ..., **kwargs: Any) -> IO[Any]: ... - def sync(self, f: IO[Any]) -> None: ... - def commit(self, f: IO[Any]) -> None: ... - def rollback(self, f: IO[Any]) -> None: ... - -def atomic_write(path: StrOrBytesPath, writer_cls: Type[AtomicWriter] = ..., **cls_kwargs: object) -> ContextManager[IO[Any]]: ... diff --git a/stubs/aws-xray-sdk/METADATA.toml b/stubs/aws-xray-sdk/METADATA.toml index 62802ab..4e51482 100644 --- a/stubs/aws-xray-sdk/METADATA.toml +++ b/stubs/aws-xray-sdk/METADATA.toml @@ -1 +1 @@ -version = "2.8" +version = "2.10.*" diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi index 490baa4..ba1d9b0 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from typing import Any log: Any @@ -12,7 +13,7 @@ class TraceHeader: self, root: str | None = ..., parent: str | None = ..., sampled: bool | None = ..., data: dict[str, Any] | None = ... ) -> None: ... @classmethod - def from_header_str(cls, header): ... + def from_header_str(cls: type[Self], header) -> Self: ... def to_header_str(self): ... @property def root(self): ... diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/patcher.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/patcher.pyi index 49a46c7..e0c0957 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/patcher.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/patcher.pyi @@ -1,5 +1,6 @@ +from collections.abc import Iterable from logging import Logger -from typing import Any, Iterable +from typing import Any from aws_xray_sdk import global_sdk_config as global_sdk_config diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi index f1c47af..7cfbf5b 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi @@ -1,6 +1,7 @@ import time +from collections.abc import Callable, Iterable from logging import Logger -from typing import Any, Callable, Iterable +from typing import Any from aws_xray_sdk import global_sdk_config as global_sdk_config from aws_xray_sdk.version import VERSION as VERSION @@ -18,8 +19,8 @@ from .models.dummy_entities import DummySegment as DummySegment, DummySubsegment from .models.segment import Segment as Segment, SegmentContextManager as SegmentContextManager from .models.subsegment import Subsegment as Subsegment, SubsegmentContextManager as SubsegmentContextManager from .plugins.utils import get_plugin_modules as get_plugin_modules -from .sampling.local.sampler import LocalSampler as LocalSampler -from .sampling.sampler import DefaultSampler as DefaultSampler +from .sampling.local.sampler import LocalSampler +from .sampling.sampler import DefaultSampler from .streaming.default_streaming import DefaultStreaming as DefaultStreaming from .utils import stacktrace as stacktrace from .utils.compat import string_types as string_types @@ -76,7 +77,7 @@ class AWSXRayRecorder: kwargs: dict[str, Any], name: str, namespace: str, - meta_processor: Callable[..., Any], + meta_processor: Callable[..., object], ) -> Any: ... @property def enabled(self) -> bool: ... diff --git a/stubs/babel/METADATA.toml b/stubs/babel/METADATA.toml index d8484dc..cdd01b1 100644 --- a/stubs/babel/METADATA.toml +++ b/stubs/babel/METADATA.toml @@ -1 +1,2 @@ -version = "2.9" \ No newline at end of file +version = "2.11.*" +requires = ["types-pytz"] diff --git a/stubs/babel/babel/_compat.pyi b/stubs/babel/babel/_compat.pyi deleted file mode 100644 index 6247814..0000000 --- a/stubs/babel/babel/_compat.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import Any - -PY2: Any -text_type = str -string_types: Any -integer_types: Any -text_to_native: Any -unichr = chr -iterkeys: Any -itervalues: Any -iteritems: Any -izip = zip -imap = map -range_type = range -cmp: Any -array_tobytes: Any -number_types: Any - -def force_text(s, encoding: str = ..., errors: str = ...): ... diff --git a/stubs/babel/babel/core.pyi b/stubs/babel/babel/core.pyi index 9c274f7..c969492 100644 --- a/stubs/babel/babel/core.pyi +++ b/stubs/babel/babel/core.pyi @@ -1,110 +1,149 @@ -from typing import Any +from collections.abc import Iterable, Mapping +from typing import Any, overload +from typing_extensions import Literal, TypeAlias + +from babel.localedata import LocaleDataDict +from babel.plural import PluralRule class UnknownLocaleError(Exception): - identifier: Any - def __init__(self, identifier) -> None: ... + identifier: str + def __init__(self, identifier: str) -> None: ... class Locale: - language: Any - territory: Any - script: Any - variant: Any - def __init__(self, language, territory: Any | None = ..., script: Any | None = ..., variant: Any | None = ...) -> None: ... + language: str + territory: str | None + script: str | None + variant: str | None + def __init__( + self, language: str, territory: str | None = ..., script: str | None = ..., variant: str | None = ... + ) -> None: ... + @classmethod + def default(cls, category: str | None = ..., aliases: Mapping[str, str] = ...) -> Locale: ... @classmethod - def default(cls, category: Any | None = ..., aliases=...): ... + def negotiate( + cls, preferred: Iterable[str], available: Iterable[str], sep: str = ..., aliases: Mapping[str, str] = ... + ) -> Locale | None: ... + @overload @classmethod - def negotiate(cls, preferred, available, sep: str = ..., aliases=...): ... + def parse(cls, identifier: None, sep: str = ..., resolve_likely_subtags: bool = ...) -> None: ... + @overload @classmethod - def parse(cls, identifier, sep: str = ..., resolve_likely_subtags: bool = ...): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __hash__(self): ... - def get_display_name(self, locale: Any | None = ...): ... - display_name: Any - def get_language_name(self, locale: Any | None = ...): ... - language_name: Any - def get_territory_name(self, locale: Any | None = ...): ... - territory_name: Any - def get_script_name(self, locale: Any | None = ...): ... - script_name: Any + def parse(cls, identifier: str | Locale, sep: str = ..., resolve_likely_subtags: bool = ...) -> Locale: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + def get_display_name(self, locale: Locale | str | None = ...) -> str | None: ... + @property + def display_name(self) -> str | None: ... + def get_language_name(self, locale: Locale | str | None = ...) -> str | None: ... + @property + def language_name(self) -> str | None: ... + def get_territory_name(self, locale: Locale | str | None = ...) -> str | None: ... @property - def english_name(self): ... + def territory_name(self) -> str | None: ... + def get_script_name(self, locale: Locale | str | None = ...) -> str | None: ... @property - def languages(self): ... + def script_name(self) -> str | None: ... @property - def scripts(self): ... + def english_name(self) -> str | None: ... @property - def territories(self): ... + def languages(self) -> LocaleDataDict: ... @property - def variants(self): ... + def scripts(self) -> LocaleDataDict: ... @property - def currencies(self): ... + def territories(self) -> LocaleDataDict: ... @property - def currency_symbols(self): ... + def variants(self) -> LocaleDataDict: ... @property - def number_symbols(self): ... + def currencies(self) -> LocaleDataDict: ... @property - def decimal_formats(self): ... + def currency_symbols(self) -> LocaleDataDict: ... @property - def currency_formats(self): ... + def number_symbols(self) -> LocaleDataDict: ... @property - def percent_formats(self): ... + def decimal_formats(self) -> LocaleDataDict: ... @property - def scientific_formats(self): ... + def compact_decimal_formats(self) -> LocaleDataDict: ... @property - def periods(self): ... + def currency_formats(self) -> LocaleDataDict: ... @property - def day_periods(self): ... + def percent_formats(self) -> LocaleDataDict: ... @property - def day_period_rules(self): ... + def scientific_formats(self) -> LocaleDataDict: ... @property - def days(self): ... + def periods(self) -> LocaleDataDict: ... @property - def months(self): ... + def day_periods(self) -> LocaleDataDict: ... @property - def quarters(self): ... + def day_period_rules(self) -> LocaleDataDict: ... @property - def eras(self): ... + def days(self) -> LocaleDataDict: ... @property - def time_zones(self): ... + def months(self) -> LocaleDataDict: ... @property - def meta_zones(self): ... + def quarters(self) -> LocaleDataDict: ... @property - def zone_formats(self): ... + def eras(self) -> LocaleDataDict: ... @property - def first_week_day(self): ... + def time_zones(self) -> LocaleDataDict: ... @property - def weekend_start(self): ... + def meta_zones(self) -> LocaleDataDict: ... @property - def weekend_end(self): ... + def zone_formats(self) -> LocaleDataDict: ... @property - def min_week_days(self): ... + def first_week_day(self) -> int: ... @property - def date_formats(self): ... + def weekend_start(self) -> int: ... @property - def time_formats(self): ... + def weekend_end(self) -> int: ... @property - def datetime_formats(self): ... + def min_week_days(self) -> int: ... @property - def datetime_skeletons(self): ... + def date_formats(self) -> LocaleDataDict: ... @property - def interval_formats(self): ... + def time_formats(self) -> LocaleDataDict: ... @property - def plural_form(self): ... + def datetime_formats(self) -> LocaleDataDict: ... @property - def list_patterns(self): ... + def datetime_skeletons(self) -> LocaleDataDict: ... @property - def ordinal_form(self): ... + def interval_formats(self) -> LocaleDataDict: ... @property - def measurement_systems(self): ... + def plural_form(self) -> PluralRule: ... @property - def character_order(self): ... + def list_patterns(self) -> LocaleDataDict: ... @property - def text_direction(self): ... + def ordinal_form(self) -> PluralRule: ... @property - def unit_display_names(self): ... + def measurement_systems(self) -> LocaleDataDict: ... + @property + def character_order(self) -> str: ... + @property + def text_direction(self) -> str: ... + @property + def unit_display_names(self) -> LocaleDataDict: ... + +def default_locale(category: str | None = ..., aliases: Mapping[str, str] = ...) -> str | None: ... +def negotiate_locale( + preferred: Iterable[str], available: Iterable[str], sep: str = ..., aliases: Mapping[str, str] = ... +) -> str | None: ... +def parse_locale(identifier: str, sep: str = ...) -> tuple[str, str | None, str | None, str | None]: ... +def get_locale_identifier(tup: tuple[str, str | None, str | None, str | None], sep: str = ...) -> str: ... +def get_global(key: _GLOBAL_KEY) -> Mapping[str, Any]: ... -def default_locale(category: Any | None = ..., aliases=...): ... -def negotiate_locale(preferred, available, sep: str = ..., aliases=...): ... -def parse_locale(identifier, sep: str = ...): ... -def get_locale_identifier(tup, sep: str = ...): ... +_GLOBAL_KEY: TypeAlias = Literal[ + "all_currencies", + "currency_fractions", + "language_aliases", + "likely_subtags", + "parent_exceptions", + "script_aliases", + "territory_aliases", + "territory_currencies", + "territory_languages", + "territory_zones", + "variant_aliases", + "windows_zone_mapping", + "zone_aliases", + "zone_territories", +] diff --git a/stubs/babel/babel/dates.pyi b/stubs/babel/babel/dates.pyi index 29b3f8a..7812c4c 100644 --- a/stubs/babel/babel/dates.pyi +++ b/stubs/babel/babel/dates.pyi @@ -1,30 +1,100 @@ -from datetime import date, datetime, time -from typing import Any +from datetime import date, datetime, time, timedelta, tzinfo +from typing import Any, overload +from typing_extensions import Literal, TypeAlias -NO_INHERITANCE_MARKER: str -LC_TIME: Any -date_ = date -datetime_ = datetime -time_ = time +from babel.core import Locale +from babel.util import LOCALTZ as LOCALTZ, UTC as UTC +from pytz import BaseTzInfo + +# The module contents here are organized the same way they are in the API documentation at +# http://babel.pocoo.org/en/latest/api/dates.html + +# Date and Time Formatting +_Instant: TypeAlias = date | time | datetime | float | None +_PredefinedTimeFormat: TypeAlias = Literal["full", "long", "medium", "short"] + +def format_datetime( + datetime: _Instant = ..., format: _PredefinedTimeFormat | str = ..., tzinfo: tzinfo | None = ..., locale: str | Locale = ... +) -> str: ... +def format_date( + date: date | datetime | None = ..., format: _PredefinedTimeFormat | str = ..., locale: str | Locale = ... +) -> str: ... +def format_time( + time: time | datetime | float | None = ..., + format: _PredefinedTimeFormat | str = ..., + tzinfo: tzinfo | None = ..., + locale: str | Locale = ..., +) -> str: ... +def format_timedelta( + delta: timedelta | int, + granularity: Literal["year", "month", "week", "day", "hour", "minute", "second"] = ..., + threshold: float = ..., + add_direction: bool = ..., + format: Literal["narrow", "short", "medium", "long"] = ..., + locale: str | Locale = ..., +) -> str: ... +def format_skeleton( + skeleton: str, datetime: _Instant = ..., tzinfo: tzinfo | None = ..., fuzzy: bool = ..., locale: str | Locale = ... +) -> str: ... +def format_interval( + start: _Instant, + end: _Instant, + skeleton: str | None = ..., + tzinfo: tzinfo | None = ..., + fuzzy: bool = ..., + locale: str | Locale = ..., +) -> str: ... + +# Timezone Functionality +@overload +def get_timezone(zone: str | BaseTzInfo | None = ...) -> BaseTzInfo: ... +@overload +def get_timezone(zone: tzinfo) -> tzinfo: ... +def get_timezone_gmt( + datetime: _Instant = ..., + width: Literal["long", "short", "iso8601", "iso8601_short"] = ..., + locale: str | Locale = ..., + return_z: bool = ..., +) -> str: ... + +_DtOrTzinfo: TypeAlias = datetime | tzinfo | str | int | time | None + +def get_timezone_location(dt_or_tzinfo: _DtOrTzinfo = ..., locale: str | Locale = ..., return_city: bool = ...) -> str: ... +def get_timezone_name( + dt_or_tzinfo: _DtOrTzinfo = ..., + width: Literal["long", "short"] = ..., + uncommon: bool = ..., + locale: str | Locale = ..., + zone_variant: Literal["generic", "daylight", "standard"] | None = ..., + return_zone: bool = ..., +) -> str: ... -def get_timezone(zone: Any | None = ...): ... -def get_next_timezone_transition(zone: Any | None = ..., dt: Any | None = ...): ... +# Note: While Babel accepts any tzinfo for the most part, the get_next_timeout_transition() +# function requires a tzinfo that is produced by get_timezone()/pytz AND has DST info. +# The typing here will help you with the first requirement, but will not protect against +# pytz tzinfo's without DST info, like what you get from get_timezone("UTC") for instance. +def get_next_timezone_transition(zone: BaseTzInfo | None = ..., dt: _Instant = ...) -> TimezoneTransition: ... class TimezoneTransition: - activates: Any - from_tzinfo: Any - to_tzinfo: Any - reference_date: Any - def __init__(self, activates, from_tzinfo, to_tzinfo, reference_date: Any | None = ...) -> None: ... + # This class itself is not included in the documentation, yet it is mentioned by name. + # See https://github.com/python-babel/babel/issues/823 + activates: datetime + from_tzinfo: tzinfo + to_tzinfo: tzinfo + reference_date: datetime | None + def __init__( + self, activates: datetime, from_tzinfo: tzinfo, to_tzinfo: tzinfo, reference_date: datetime | None = ... + ) -> None: ... @property - def from_tz(self): ... + def from_tz(self) -> str: ... @property - def to_tz(self): ... + def to_tz(self) -> str: ... @property - def from_offset(self): ... + def from_offset(self) -> int: ... @property - def to_offset(self): ... + def to_offset(self) -> int: ... +# Data Access def get_period_names(width: str = ..., context: str = ..., locale=...): ... def get_day_names(width: str = ..., context: str = ..., locale=...): ... def get_month_names(width: str = ..., context: str = ..., locale=...): ... @@ -33,36 +103,27 @@ def get_era_names(width: str = ..., locale=...): ... def get_date_format(format: str = ..., locale=...): ... def get_datetime_format(format: str = ..., locale=...): ... def get_time_format(format: str = ..., locale=...): ... -def get_timezone_gmt(datetime: Any | None = ..., width: str = ..., locale=..., return_z: bool = ...): ... -def get_timezone_location(dt_or_tzinfo: Any | None = ..., locale=..., return_city: bool = ...): ... -def get_timezone_name( - dt_or_tzinfo: Any | None = ..., - width: str = ..., - uncommon: bool = ..., - locale=..., - zone_variant: Any | None = ..., - return_zone: bool = ..., -): ... -def format_date(date: Any | None = ..., format: str = ..., locale=...): ... -def format_datetime(datetime: Any | None = ..., format: str = ..., tzinfo: Any | None = ..., locale=...): ... -def format_time(time: Any | None = ..., format: str = ..., tzinfo: Any | None = ..., locale=...): ... -def format_skeleton(skeleton, datetime: Any | None = ..., tzinfo: Any | None = ..., fuzzy: bool = ..., locale=...): ... + +# Basic Parsing +def parse_date(string, locale=..., format: str = ...): ... +def parse_time(string, locale=..., format: str = ...): ... +def parse_pattern(pattern): ... + +# Undocumented +NO_INHERITANCE_MARKER: str +LC_TIME: Any +date_ = date +datetime_ = datetime +time_ = time TIMEDELTA_UNITS: Any -def format_timedelta( - delta, granularity: str = ..., threshold: float = ..., add_direction: bool = ..., format: str = ..., locale=... -): ... -def format_interval(start, end, skeleton: Any | None = ..., tzinfo: Any | None = ..., fuzzy: bool = ..., locale=...): ... def get_period_id(time, tzinfo: Any | None = ..., type: Any | None = ..., locale=...): ... -def parse_date(string, locale=...): ... -def parse_time(string, locale=...): ... class DateTimePattern: pattern: Any format: Any def __init__(self, pattern, format) -> None: ... - def __unicode__(self): ... def __mod__(self, other): ... def apply(self, datetime, locale): ... @@ -80,7 +141,7 @@ class DateTimeFormat: def format_weekday(self, char: str = ..., num: int = ...): ... def format_day_of_year(self, num): ... def format_day_of_week_in_month(self): ... - def format_period(self, char): ... + def format_period(self, char, num): ... def format_frac_seconds(self, num): ... def format_milliseconds_in_day(self, num): ... def format_timezone(self, char, num): ... @@ -91,7 +152,6 @@ class DateTimeFormat: PATTERN_CHARS: Any PATTERN_CHAR_ORDER: str -def parse_pattern(pattern): ... def tokenize_pattern(pattern): ... def untokenize_pattern(tokens): ... def split_interval_pattern(pattern): ... diff --git a/stubs/babel/babel/localedata.pyi b/stubs/babel/babel/localedata.pyi index eaff52c..c3d1ce0 100644 --- a/stubs/babel/babel/localedata.pyi +++ b/stubs/babel/babel/localedata.pyi @@ -1,4 +1,4 @@ -import collections.abc as _abc +from collections.abc import MutableMapping from typing import Any def normalize_locale(name): ... @@ -13,7 +13,7 @@ class Alias: def __init__(self, keys) -> None: ... def resolve(self, data): ... -class LocaleDataDict(_abc.MutableMapping): +class LocaleDataDict(MutableMapping[Any, Any]): base: Any def __init__(self, data, base: Any | None = ...) -> None: ... def __len__(self): ... diff --git a/stubs/babel/babel/messages/catalog.pyi b/stubs/babel/babel/messages/catalog.pyi index 7a51975..2ed4dae 100644 --- a/stubs/babel/babel/messages/catalog.pyi +++ b/stubs/babel/babel/messages/catalog.pyi @@ -70,7 +70,8 @@ class Catalog: charset: Any | None = ..., fuzzy: bool = ..., ) -> None: ... - locale_identifier: Any + @property + def locale_identifier(self): ... header_comment: Any mime_headers: Any @property diff --git a/stubs/babel/babel/messages/extract.pyi b/stubs/babel/babel/messages/extract.pyi index 6a761a2..5e7127f 100644 --- a/stubs/babel/babel/messages/extract.pyi +++ b/stubs/babel/babel/messages/extract.pyi @@ -1,3 +1,4 @@ +from collections.abc import Callable from typing import Any GROUP_NAME: str @@ -13,6 +14,7 @@ def extract_from_dir( comment_tags=..., callback: Any | None = ..., strip_comment_tags: bool = ..., + directory_filter: Callable[[str], bool] | None = ..., ) -> None: ... def check_and_call_extract_file( filepath, method_map, options_map, callback, keywords, comment_tags, strip_comment_tags, dirpath: Any | None = ... diff --git a/stubs/babel/babel/messages/frontend.pyi b/stubs/babel/babel/messages/frontend.pyi index a3e99c8..46e8662 100644 --- a/stubs/babel/babel/messages/frontend.pyi +++ b/stubs/babel/babel/messages/frontend.pyi @@ -2,8 +2,6 @@ import abc from distutils.cmd import Command as _Command from typing import Any -po_file_read_mode: Any - def listify_value(arg, split: Any | None = ...): ... class Command(_Command, metaclass=abc.ABCMeta): diff --git a/stubs/babel/babel/messages/plurals.pyi b/stubs/babel/babel/messages/plurals.pyi index 0f9ac94..9f87c98 100644 --- a/stubs/babel/babel/messages/plurals.pyi +++ b/stubs/babel/babel/messages/plurals.pyi @@ -1,12 +1,15 @@ -from typing import Any, Tuple +from typing import Any LC_CTYPE: Any PLURALS: Any DEFAULT_PLURAL: Any -class _PluralTuple(Tuple[int, str]): - num_plurals: Any - plural_expr: Any - plural_forms: Any +class _PluralTuple(tuple[int, str]): + @property + def num_plurals(self) -> int: ... + @property + def plural_expr(self) -> str: ... + @property + def plural_forms(self) -> str: ... def get_plural(locale=...): ... diff --git a/stubs/babel/babel/messages/pofile.pyi b/stubs/babel/babel/messages/pofile.pyi index 29b4511..6fdccac 100644 --- a/stubs/babel/babel/messages/pofile.pyi +++ b/stubs/babel/babel/messages/pofile.pyi @@ -13,8 +13,7 @@ class _NormalizedString: def __init__(self, *args) -> None: ... def append(self, s) -> None: ... def denormalize(self): ... - def __nonzero__(self): ... - __bool__: Any + def __bool__(self) -> bool: ... def __cmp__(self, other): ... def __gt__(self, other): ... def __lt__(self, other): ... diff --git a/stubs/babel/babel/numbers.pyi b/stubs/babel/babel/numbers.pyi index c4b27a5..eeb1eec 100644 --- a/stubs/babel/babel/numbers.pyi +++ b/stubs/babel/babel/numbers.pyi @@ -1,94 +1,124 @@ -from typing import Any +import decimal +from datetime import date +from re import Pattern +from typing_extensions import Literal + +from babel.core import Locale long = int -LC_NUMERIC: Any +LC_NUMERIC: str | None class UnknownCurrencyError(Exception): - identifier: Any - def __init__(self, identifier) -> None: ... + identifier: str + def __init__(self, identifier: str) -> None: ... -def list_currencies(locale: Any | None = ...): ... -def validate_currency(currency, locale: Any | None = ...) -> None: ... -def is_currency(currency, locale: Any | None = ...): ... -def normalize_currency(currency, locale: Any | None = ...): ... -def get_currency_name(currency, count: Any | None = ..., locale=...): ... -def get_currency_symbol(currency, locale=...): ... -def get_currency_precision(currency): ... -def get_currency_unit_pattern(currency, count: Any | None = ..., locale=...): ... +def list_currencies(locale: Locale | str | None = ...) -> set[str]: ... +def validate_currency(currency: str, locale: Locale | str | None = ...) -> None: ... +def is_currency(currency: str, locale: Locale | str | None = ...) -> bool: ... +def normalize_currency(currency: str, locale: Locale | str | None = ...) -> str | None: ... +def get_currency_name(currency: str, count: float | decimal.Decimal | None = ..., locale: Locale | str | None = ...) -> str: ... +def get_currency_symbol(currency: str, locale: Locale | str | None = ...) -> str: ... +def get_currency_precision(currency: str) -> int: ... +def get_currency_unit_pattern(currency: str, count: float | None = ..., locale: Locale | str | None = ...) -> str: ... def get_territory_currencies( - territory, - start_date: Any | None = ..., - end_date: Any | None = ..., + territory: str, + start_date: date | None = ..., + end_date: date | None = ..., tender: bool = ..., non_tender: bool = ..., include_details: bool = ..., -): ... -def get_decimal_symbol(locale=...): ... -def get_plus_sign_symbol(locale=...): ... -def get_minus_sign_symbol(locale=...): ... -def get_exponential_symbol(locale=...): ... -def get_group_symbol(locale=...): ... -def format_number(number, locale=...): ... -def get_decimal_precision(number): ... -def get_decimal_quantum(precision): ... +) -> list[str]: ... +def get_decimal_symbol(locale: Locale | str | None = ...) -> str: ... +def get_plus_sign_symbol(locale: Locale | str | None = ...) -> str: ... +def get_minus_sign_symbol(locale: Locale | str | None = ...) -> str: ... +def get_exponential_symbol(locale: Locale | str | None = ...) -> str: ... +def get_group_symbol(locale: Locale | str | None = ...) -> str: ... +def format_number(number: float | decimal.Decimal, locale: Locale | str | None = ...) -> str: ... +def get_decimal_precision(number: decimal.Decimal) -> int: ... +def get_decimal_quantum(precision: int | decimal.Decimal) -> decimal.Decimal: ... def format_decimal( - number, format: Any | None = ..., locale=..., decimal_quantization: bool = ..., group_separator: bool = ... + number: float | decimal.Decimal, + format: str | None = ..., + locale: Locale | str | None = ..., + decimal_quantization: bool = ..., + group_separator: bool = ..., ): ... +def format_compact_decimal( + number: float, *, format_type: Literal["short", "long"] = ..., locale: Locale | str | None = ..., fraction_digits: int = ... +) -> str: ... class UnknownCurrencyFormatError(KeyError): ... def format_currency( - number, - currency, - format: Any | None = ..., - locale=..., + number: float | decimal.Decimal, + currency: str, + format: str | None = ..., + locale: Locale | str | None = ..., currency_digits: bool = ..., - format_type: str = ..., + format_type: Literal["name", "standard", "accounting"] = ..., decimal_quantization: bool = ..., group_separator: bool = ..., -): ... +) -> str: ... def format_percent( - number, format: Any | None = ..., locale=..., decimal_quantization: bool = ..., group_separator: bool = ... -): ... -def format_scientific(number, format: Any | None = ..., locale=..., decimal_quantization: bool = ...): ... + number: float | decimal.Decimal, + format: str | None = ..., + locale: Locale | str | None = ..., + decimal_quantization: bool = ..., + group_separator: bool = ..., +) -> str: ... +def format_scientific( + number: float | decimal.Decimal, format: str | None = ..., locale: Locale | str | None = ..., decimal_quantization: bool = ... +) -> str: ... class NumberFormatError(ValueError): - suggestions: Any - def __init__(self, message, suggestions: Any | None = ...) -> None: ... + suggestions: str | None + def __init__(self, message: str, suggestions: str | None = ...) -> None: ... -def parse_number(string, locale=...): ... -def parse_decimal(string, locale=..., strict: bool = ...): ... +def parse_number(string: str, locale: Locale | str | None = ...) -> int: ... +def parse_decimal(string: str, locale: Locale | str | None = ..., strict: bool = ...) -> decimal.Decimal: ... PREFIX_END: str NUMBER_TOKEN: str -PREFIX_PATTERN: Any -NUMBER_PATTERN: Any +PREFIX_PATTERN: str +NUMBER_PATTERN: str SUFFIX_PATTERN: str -number_re: Any +number_re: Pattern[str] -def parse_grouping(p): ... -def parse_pattern(pattern): ... +def parse_grouping(p: str) -> tuple[int, int]: ... +def parse_pattern(pattern: NumberPattern | str) -> NumberPattern: ... class NumberPattern: - pattern: Any - prefix: Any - suffix: Any - grouping: Any - int_prec: Any - frac_prec: Any - exp_prec: Any - exp_plus: Any - scale: Any - def __init__(self, pattern, prefix, suffix, grouping, int_prec, frac_prec, exp_prec, exp_plus) -> None: ... - def compute_scale(self): ... - def scientific_notation_elements(self, value, locale): ... + pattern: str + prefix: tuple[str, str] + suffix: tuple[str, str] + grouping: tuple[int, int] + int_prec: tuple[int, int] + frac_prec: tuple[int, int] + exp_prec: tuple[int, int] | None + exp_plus: bool | None + scale: Literal[0, 2, 3] + def __init__( + self, + pattern: str, + prefix: tuple[str, str], + suffix: tuple[str, str], + grouping: tuple[int, int], + int_prec: tuple[int, int], + frac_prec: tuple[int, int], + exp_prec: tuple[int, int] | None, + exp_plus: bool | None, + ) -> None: ... + def compute_scale(self) -> Literal[0, 2, 3]: ... + def scientific_notation_elements( + self, value: decimal.Decimal, locale: Locale | str | None + ) -> tuple[decimal.Decimal, int, str]: ... def apply( self, - value, - locale, - currency: Any | None = ..., + value: float | decimal.Decimal, + locale: Locale | str | None, + currency: str | None = ..., currency_digits: bool = ..., decimal_quantization: bool = ..., - force_frac: Any | None = ..., + force_frac: int | None = ..., group_separator: bool = ..., - ): ... + ) -> str: ... diff --git a/stubs/babel/babel/plural.pyi b/stubs/babel/babel/plural.pyi index ba142e1..5a22caa 100644 --- a/stubs/babel/babel/plural.pyi +++ b/stubs/babel/babel/plural.pyi @@ -9,7 +9,8 @@ class PluralRule: def parse(cls, rules): ... @property def rules(self): ... - tags: Any + @property + def tags(self): ... def __call__(self, n): ... def to_javascript(rule): ... diff --git a/stubs/babel/babel/support.pyi b/stubs/babel/babel/support.pyi index 3755073..b1a2ece 100644 --- a/stubs/babel/babel/support.pyi +++ b/stubs/babel/babel/support.pyi @@ -20,11 +20,10 @@ class LazyProxy: @property def value(self): ... def __contains__(self, key): ... - def __nonzero__(self): ... + def __bool__(self) -> bool: ... def __dir__(self): ... def __iter__(self): ... def __len__(self): ... - def __unicode__(self): ... def __add__(self, other): ... def __radd__(self, other): ... def __mod__(self, other): ... @@ -44,8 +43,8 @@ class LazyProxy: def __delitem__(self, key) -> None: ... def __getitem__(self, key): ... def __setitem__(self, key, value) -> None: ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... + def __copy__(self) -> LazyProxy: ... + def __deepcopy__(self, memo: Any) -> LazyProxy: ... class NullTranslations(gettext.NullTranslations): DEFAULT_DOMAIN: Any diff --git a/stubs/babel/babel/util.pyi b/stubs/babel/babel/util.pyi index 8788030..48b6720 100644 --- a/stubs/babel/babel/util.pyi +++ b/stubs/babel/babel/util.pyi @@ -4,6 +4,7 @@ from datetime import tzinfo from typing import Any from babel import localtime as localtime +from pytz import BaseTzInfo missing: Any @@ -32,8 +33,8 @@ class FixedOffsetTimezone(tzinfo): def tzname(self, dt): ... def dst(self, dt): ... -UTC: Any -LOCALTZ: Any +UTC: BaseTzInfo +LOCALTZ: BaseTzInfo get_localzone = localtime.get_localzone STDOFFSET: Any DSTOFFSET: Any diff --git a/stubs/backports.ssl_match_hostname/METADATA.toml b/stubs/backports.ssl_match_hostname/METADATA.toml index 9509ba1..e48ee2d 100644 --- a/stubs/backports.ssl_match_hostname/METADATA.toml +++ b/stubs/backports.ssl_match_hostname/METADATA.toml @@ -1,2 +1,4 @@ -version = "3.7" -python2 = true +version = "3.7.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/backports.ssl_match_hostname/backports/__init__.pyi b/stubs/backports.ssl_match_hostname/backports/__init__.pyi index cb0474f..8a93ba9 100644 --- a/stubs/backports.ssl_match_hostname/backports/__init__.pyi +++ b/stubs/backports.ssl_match_hostname/backports/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any +from _typeshed import Incomplete # Explicitly mark this package as incomplete. -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/backports.ssl_match_hostname/backports/ssl_match_hostname/__init__.pyi b/stubs/backports.ssl_match_hostname/backports/ssl_match_hostname/__init__.pyi index c219980..37b7bc6 100644 --- a/stubs/backports.ssl_match_hostname/backports/ssl_match_hostname/__init__.pyi +++ b/stubs/backports.ssl_match_hostname/backports/ssl_match_hostname/__init__.pyi @@ -1,3 +1,5 @@ +from ssl import _PeerCertRetDictType + class CertificateError(ValueError): ... -def match_hostname(cert, hostname): ... +def match_hostname(cert: _PeerCertRetDictType, hostname: str) -> None: ... diff --git a/stubs/backports_abc/@tests/stubtest_allowlist.txt b/stubs/backports_abc/@tests/stubtest_allowlist.txt deleted file mode 100644 index bc072c4..0000000 --- a/stubs/backports_abc/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1 +0,0 @@ -backports_abc.isawaitable diff --git a/stubs/backports_abc/METADATA.toml b/stubs/backports_abc/METADATA.toml deleted file mode 100644 index 255b449..0000000 --- a/stubs/backports_abc/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "0.5" -python2 = true diff --git a/stubs/backports_abc/backports_abc.pyi b/stubs/backports_abc/backports_abc.pyi deleted file mode 100644 index b48ae33..0000000 --- a/stubs/backports_abc/backports_abc.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Any - -def mk_gen(): ... -def mk_awaitable(): ... -def mk_coroutine(): ... - -Generator: Any -Awaitable: Any -Coroutine: Any - -def isawaitable(obj): ... - -PATCHED: Any - -def patch(patch_inspect: bool = ...): ... diff --git a/stubs/beautifulsoup4/@tests/requirements-stubtest.txt b/stubs/beautifulsoup4/@tests/requirements-stubtest.txt deleted file mode 100644 index 5ed6cb7..0000000 --- a/stubs/beautifulsoup4/@tests/requirements-stubtest.txt +++ /dev/null @@ -1,2 +0,0 @@ -html5lib -lxml diff --git a/stubs/beautifulsoup4/METADATA.toml b/stubs/beautifulsoup4/METADATA.toml index d09b6f9..5c2d0f1 100644 --- a/stubs/beautifulsoup4/METADATA.toml +++ b/stubs/beautifulsoup4/METADATA.toml @@ -1 +1,4 @@ -version = "4.10" +version = "4.11.*" + +[tool.stubtest] +extras = ["lxml", "html5lib"] diff --git a/stubs/beautifulsoup4/bs4/__init__.pyi b/stubs/beautifulsoup4/bs4/__init__.pyi index d975dfc..adbecc0 100644 --- a/stubs/beautifulsoup4/bs4/__init__.pyi +++ b/stubs/beautifulsoup4/bs4/__init__.pyi @@ -1,8 +1,23 @@ from _typeshed import Self, SupportsRead -from typing import Any, Sequence, Type +from collections.abc import Sequence +from typing import Any -from .builder import TreeBuilder -from .element import PageElement, SoupStrainer, Tag +from .builder import ParserRejectedMarkup as ParserRejectedMarkup, TreeBuilder, XMLParsedAsHTMLWarning as XMLParsedAsHTMLWarning +from .element import ( + CData as CData, + Comment as Comment, + Declaration as Declaration, + Doctype as Doctype, + NavigableString as NavigableString, + PageElement as PageElement, + ProcessingInstruction as ProcessingInstruction, + ResultSet as ResultSet, + Script as Script, + SoupStrainer as SoupStrainer, + Stylesheet as Stylesheet, + Tag as Tag, + TemplateString as TemplateString, +) from .formatter import Formatter class GuessedAtParserWarning(UserWarning): ... @@ -23,11 +38,11 @@ class BeautifulSoup(Tag): self, markup: str | bytes | SupportsRead[str] | SupportsRead[bytes] = ..., features: str | Sequence[str] | None = ..., - builder: TreeBuilder | Type[TreeBuilder] | None = ..., + builder: TreeBuilder | type[TreeBuilder] | None = ..., parse_only: SoupStrainer | None = ..., from_encoding: str | None = ..., exclude_encodings: Sequence[str] | None = ..., - element_classes: dict[Type[PageElement], Type[Any]] | None = ..., + element_classes: dict[type[PageElement], type[Any]] | None = ..., **kwargs, ) -> None: ... def __copy__(self: Self) -> Self: ... @@ -57,10 +72,21 @@ class BeautifulSoup(Tag): def pushTag(self, tag) -> None: ... def endData(self, containerClass: Any | None = ...) -> None: ... def object_was_parsed(self, o, parent: Any | None = ..., most_recent_element: Any | None = ...) -> None: ... - def handle_starttag(self, name, namespace, nsprefix, attrs, sourceline: Any | None = ..., sourcepos: Any | None = ...): ... + def handle_starttag( + self, + name, + namespace, + nsprefix, + attrs, + sourceline: Any | None = ..., + sourcepos: Any | None = ..., + namespaces: dict[str, str] | None = ..., + ): ... def handle_endtag(self, name, nsprefix: Any | None = ...) -> None: ... def handle_data(self, data) -> None: ... - def decode(self, pretty_print: bool = ..., eventual_encoding: str = ..., formatter: str | Formatter = ...): ... # type: ignore # missing some arguments + def decode( # type: ignore[override] + self, pretty_print: bool = ..., eventual_encoding: str = ..., formatter: str | Formatter = ... + ): ... # missing some arguments class BeautifulStoneSoup(BeautifulSoup): ... class StopParsing(Exception): ... diff --git a/stubs/beautifulsoup4/bs4/builder/__init__.pyi b/stubs/beautifulsoup4/bs4/builder/__init__.pyi index daa6a97..13c8a48 100644 --- a/stubs/beautifulsoup4/bs4/builder/__init__.pyi +++ b/stubs/beautifulsoup4/bs4/builder/__init__.pyi @@ -64,3 +64,5 @@ class HTMLTreeBuilder(TreeBuilder): class ParserRejectedMarkup(Exception): def __init__(self, message_or_exception) -> None: ... + +class XMLParsedAsHTMLWarning(UserWarning): ... diff --git a/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi b/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi index 990d450..5fa502b 100644 --- a/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi +++ b/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi @@ -7,7 +7,7 @@ class HTML5TreeBuilder(HTMLTreeBuilder): features: Any TRACKS_LINE_NUMBERS: bool user_specified_encoding: Any - def prepare_markup( # type: ignore # user_specified_encoding doesn't have a default + def prepare_markup( # type: ignore[override] # user_specified_encoding doesn't have a default self, markup, user_specified_encoding, document_declared_encoding: Any | None = ..., exclude_encodings: Any | None = ... ) -> None: ... def feed(self, markup) -> None: ... @@ -15,7 +15,7 @@ class HTML5TreeBuilder(HTMLTreeBuilder): def create_treebuilder(self, namespaceHTMLElements): ... def test_fragment_to_document(self, fragment): ... -class TreeBuilderForHtml5lib(Any): # type: ignore # html5lib.treebuilders.base.TreeBuilder +class TreeBuilderForHtml5lib(Any): # html5lib.treebuilders.base.TreeBuilder soup: Any parser: Any store_line_numbers: Any @@ -42,7 +42,7 @@ class AttrList: def __getitem__(self, name): ... def __contains__(self, name): ... -class Element(Any): # type: ignore # html5lib.treebuilders.base.Node +class Element(Any): # html5lib.treebuilders.base.Node element: Any soup: Any namespace: Any @@ -58,7 +58,8 @@ class Element(Any): # type: ignore # html5lib.treebuilders.base.Node def cloneNode(self): ... def hasContent(self): ... def getNameTuple(self): ... - nameTuple: Any + @property + def nameTuple(self): ... class TextNode(Element): element: Any diff --git a/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi b/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi index c990e78..bca74d7 100644 --- a/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi +++ b/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi @@ -11,7 +11,7 @@ class BeautifulSoupHTMLParser(HTMLParser): on_duplicate_attribute: Any already_closed_empty_element: Any def __init__(self, *args, **kwargs) -> None: ... - def error(self, msg) -> None: ... + def error(self, msg: str) -> None: ... def handle_startendtag(self, name, attrs) -> None: ... def handle_starttag(self, name, attrs, handle_empty_element: bool = ...) -> None: ... def handle_endtag(self, name, check_already_closed: bool = ...) -> None: ... diff --git a/stubs/beautifulsoup4/bs4/builder/_lxml.pyi b/stubs/beautifulsoup4/bs4/builder/_lxml.pyi index 4928489..b206067 100644 --- a/stubs/beautifulsoup4/bs4/builder/_lxml.pyi +++ b/stubs/beautifulsoup4/bs4/builder/_lxml.pyi @@ -19,7 +19,7 @@ class LXMLTreeBuilderForXML(TreeBuilder): soup: Any nsmaps: Any def __init__(self, parser: Any | None = ..., empty_element_tags: Any | None = ..., **kwargs) -> None: ... - def prepare_markup( # type: ignore # the order of the parameters is different + def prepare_markup( # type: ignore[override] # the order of the parameters is different self, markup, user_specified_encoding: Any | None = ..., diff --git a/stubs/beautifulsoup4/bs4/dammit.pyi b/stubs/beautifulsoup4/bs4/dammit.pyi index 97df5bf..87c3b2b 100644 --- a/stubs/beautifulsoup4/bs4/dammit.pyi +++ b/stubs/beautifulsoup4/bs4/dammit.pyi @@ -1,10 +1,8 @@ from collections.abc import Iterable, Iterator from logging import Logger -from typing import Any, Tuple +from typing import Any from typing_extensions import Literal -chardet_type: Any - def chardet_dammit(s): ... xml_encoding: str @@ -77,7 +75,7 @@ class UnicodeDammit: @property def declared_html_encoding(self) -> str | None: ... def find_codec(self, charset: str) -> str | None: ... - MS_CHARS: dict[bytes, str | Tuple[str, ...]] + MS_CHARS: dict[bytes, str | tuple[str, ...]] MS_CHARS_TO_ASCII: dict[bytes, str] WINDOWS_1252_TO_UTF8: dict[int, bytes] MULTIBYTE_MARKERS_AND_SIZES: list[tuple[int, int, int]] diff --git a/stubs/beautifulsoup4/bs4/element.pyi b/stubs/beautifulsoup4/bs4/element.pyi index 70ee36b..d327d42 100644 --- a/stubs/beautifulsoup4/bs4/element.pyi +++ b/stubs/beautifulsoup4/bs4/element.pyi @@ -1,37 +1,37 @@ from _typeshed import Self -from collections.abc import Iterator -from typing import Any, Callable, Generic, Iterable, List, Mapping, Pattern, Set, Tuple, Type, TypeVar, Union, overload +from collections.abc import Callable, Iterable, Iterator +from re import Pattern +from typing import Any, Generic, TypeVar, overload +from typing_extensions import TypeAlias from . import BeautifulSoup from .builder import TreeBuilder from .formatter import Formatter, _EntitySubstitution DEFAULT_OUTPUT_ENCODING: str -PY3K: bool nonwhitespace_re: Pattern[str] whitespace_re: Pattern[str] -PYTHON_SPECIFIC_ENCODINGS: Set[str] +PYTHON_SPECIFIC_ENCODINGS: set[str] class NamespacedAttribute(str): - def __new__(cls: Type[Self], prefix: str, name: str | None = ..., namespace: str | None = ...) -> Self: ... + def __new__(cls: type[Self], prefix: str, name: str | None = ..., namespace: str | None = ...) -> Self: ... class AttributeValueWithCharsetSubstitution(str): ... class CharsetMetaAttributeValue(AttributeValueWithCharsetSubstitution): def __new__(cls, original_value): ... - def encode(self, encoding: str) -> str: ... # type: ignore # incompatible with str + def encode(self, encoding: str) -> str: ... # type: ignore[override] # incompatible with str class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution): CHARSET_RE: Pattern[str] def __new__(cls, original_value): ... - def encode(self, encoding: str) -> str: ... # type: ignore # incompatible with str + def encode(self, encoding: str) -> str: ... # type: ignore[override] # incompatible with str _PageElementT = TypeVar("_PageElementT", bound=PageElement) -# The wrapping Union[] can be removed once mypy fully supports | in type aliases. -_SimpleStrainable = Union[str, bool, None, bytes, Pattern[str], Callable[[str], bool], Callable[[Tag], bool]] -_Strainable = Union[_SimpleStrainable, Iterable[_SimpleStrainable]] -_SimpleNormalizedStrainable = Union[str, bool, None, Pattern[str], Callable[[str], bool], Callable[[Tag], bool]] -_NormalizedStrainable = Union[_SimpleNormalizedStrainable, Iterable[_SimpleNormalizedStrainable]] +_SimpleStrainable: TypeAlias = str | bool | None | bytes | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool] +_Strainable: TypeAlias = _SimpleStrainable | Iterable[_SimpleStrainable] +_SimpleNormalizedStrainable: TypeAlias = str | bool | None | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool] +_NormalizedStrainable: TypeAlias = _SimpleNormalizedStrainable | Iterable[_SimpleNormalizedStrainable] class PageElement: parent: Tag | None @@ -53,7 +53,7 @@ class PageElement: previousSibling: PageElement | None @property def stripped_strings(self) -> Iterator[str]: ... - def get_text(self, separator: str = ..., strip: bool = ..., types: Tuple[Type[NavigableString], ...] = ...) -> str: ... + def get_text(self, separator: str = ..., strip: bool = ..., types: tuple[type[NavigableString], ...] = ...) -> str: ... getText = get_text @property def text(self) -> str: ... @@ -73,7 +73,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., **kwargs: _Strainable, ) -> Tag | NavigableString | None: ... findNext = find_next @@ -81,7 +81,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., limit: int | None = ..., **kwargs: _Strainable, ) -> ResultSet[PageElement]: ... @@ -90,7 +90,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., **kwargs: _Strainable, ) -> Tag | NavigableString | None: ... findNextSibling = find_next_sibling @@ -98,7 +98,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., limit: int | None = ..., **kwargs: _Strainable, ) -> ResultSet[PageElement]: ... @@ -108,7 +108,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., **kwargs: _Strainable, ) -> Tag | NavigableString | None: ... findPrevious = find_previous @@ -116,7 +116,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., limit: int | None = ..., **kwargs: _Strainable, ) -> ResultSet[PageElement]: ... @@ -126,7 +126,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., **kwargs: _Strainable, ) -> Tag | NavigableString | None: ... findPreviousSibling = find_previous_sibling @@ -134,7 +134,7 @@ class PageElement: self, name: _Strainable | SoupStrainer | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., limit: int | None = ..., **kwargs: _Strainable, ) -> ResultSet[PageElement]: ... @@ -182,7 +182,7 @@ class NavigableString(str, PageElement): PREFIX: str SUFFIX: str known_xml: bool | None - def __new__(cls: Type[Self], value: str | bytes) -> Self: ... + def __new__(cls: type[Self], value: str | bytes) -> Self: ... def __copy__(self: Self) -> Self: ... def __getnewargs__(self) -> tuple[str]: ... def output_ready(self, formatter: Formatter | str | None = ...) -> str: ... @@ -227,15 +227,15 @@ class Script(NavigableString): ... class TemplateString(NavigableString): ... class Tag(PageElement): - parser_class: Type[BeautifulSoup] | None + parser_class: type[BeautifulSoup] | None name: str namespace: str | None prefix: str | None sourceline: int | None sourcepos: int | None known_xml: bool | None - attrs: Mapping[str, str] - contents: List[PageElement] + attrs: dict[str, str] + contents: list[PageElement] hidden: bool can_be_empty_element: bool | None cdata_list_attributes: list[str] | None @@ -247,7 +247,7 @@ class Tag(PageElement): name: str | None = ..., namespace: str | None = ..., prefix: str | None = ..., - attrs: Mapping[str, str] | None = ..., + attrs: dict[str, str] | None = ..., parent: Tag | None = ..., previous: PageElement | None = ..., is_xml: bool | None = ..., @@ -256,18 +256,20 @@ class Tag(PageElement): can_be_empty_element: bool | None = ..., cdata_list_attributes: list[str] | None = ..., preserve_whitespace_tags: list[str] | None = ..., - interesting_string_types: Type[NavigableString] | Tuple[Type[NavigableString], ...] | None = ..., + interesting_string_types: type[NavigableString] | tuple[type[NavigableString], ...] | None = ..., + namespaces: dict[str, str] | None = ..., ) -> None: ... - parserClass: Type[BeautifulSoup] | None + parserClass: type[BeautifulSoup] | None def __copy__(self: Self) -> Self: ... @property def is_empty_element(self) -> bool: ... - isSelfClosing = is_empty_element + @property + def isSelfClosing(self) -> bool: ... @property def string(self) -> str | None: ... @string.setter def string(self, string: str) -> None: ... - DEFAULT_INTERESTING_STRING_TYPES: Tuple[Type[NavigableString], ...] + DEFAULT_INTERESTING_STRING_TYPES: tuple[type[NavigableString], ...] @property def strings(self) -> Iterable[str]: ... def decompose(self) -> None: ... @@ -279,7 +281,7 @@ class Tag(PageElement): def has_attr(self, key: str) -> bool: ... def __hash__(self) -> int: ... def __getitem__(self, key: str) -> str | list[str]: ... - def __iter__(self) -> Iterable[PageElement]: ... + def __iter__(self) -> Iterator[PageElement]: ... def __len__(self) -> int: ... def __contains__(self, x: object) -> bool: ... def __bool__(self) -> bool: ... @@ -307,7 +309,7 @@ class Tag(PageElement): name: _Strainable | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., recursive: bool = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., **kwargs: _Strainable, ) -> Tag | NavigableString | None: ... findChild = find @@ -316,7 +318,7 @@ class Tag(PageElement): name: _Strainable | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., recursive: bool = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., limit: int | None = ..., **kwargs: _Strainable, ) -> ResultSet[Any]: ... @@ -327,8 +329,18 @@ class Tag(PageElement): def children(self) -> Iterable[PageElement]: ... @property def descendants(self) -> Iterable[PageElement]: ... - def select_one(self, selector: str, namespaces: Any | None = ..., **kwargs) -> Tag | None: ... - def select(self, selector: str, namespaces: Any | None = ..., limit: int | None = ..., **kwargs) -> ResultSet[Tag]: ... + def select_one( + self, selector: str, namespaces: Any | None = ..., *, flags: int = ..., custom: dict[str, str] | None = ... + ) -> Tag | None: ... + def select( + self, + selector: str, + namespaces: Any | None = ..., + limit: int | None = ..., + *, + flags: int = ..., + custom: dict[str, str] | None = ..., + ) -> ResultSet[Tag]: ... def childGenerator(self) -> Iterable[PageElement]: ... def recursiveChildGenerator(self) -> Iterable[PageElement]: ... def has_key(self, key: str) -> bool: ... @@ -336,18 +348,21 @@ class Tag(PageElement): class SoupStrainer: name: _NormalizedStrainable attrs: dict[str, _NormalizedStrainable] - text: _NormalizedStrainable + string: _NormalizedStrainable def __init__( self, name: _Strainable | None = ..., attrs: dict[str, _Strainable] | _Strainable = ..., - text: _Strainable | None = ..., + string: _Strainable | None = ..., **kwargs: _Strainable, ) -> None: ... def search_tag(self, markup_name: Tag | str | None = ..., markup_attrs=...): ... searchTag = search_tag def search(self, markup: PageElement | Iterable[PageElement]): ... -class ResultSet(Generic[_PageElementT], List[_PageElementT]): +class ResultSet(list[_PageElementT], Generic[_PageElementT]): source: SoupStrainer - def __init__(self, source: SoupStrainer, result: Iterable[_PageElementT] = ...) -> None: ... + @overload + def __init__(self, source: SoupStrainer) -> None: ... + @overload + def __init__(self, source: SoupStrainer, result: Iterable[_PageElementT]) -> None: ... diff --git a/stubs/beautifulsoup4/bs4/formatter.pyi b/stubs/beautifulsoup4/bs4/formatter.pyi index 4250419..bfbba82 100644 --- a/stubs/beautifulsoup4/bs4/formatter.pyi +++ b/stubs/beautifulsoup4/bs4/formatter.pyi @@ -1,8 +1,9 @@ -from typing import Callable +from collections.abc import Callable +from typing_extensions import TypeAlias from .dammit import EntitySubstitution as EntitySubstitution -_EntitySubstitution = Callable[[str], str] +_EntitySubstitution: TypeAlias = Callable[[str], str] class Formatter(EntitySubstitution): HTML: str @@ -20,6 +21,7 @@ class Formatter(EntitySubstitution): void_element_close_prefix: str = ..., cdata_containing_tags: list[str] | None = ..., empty_attributes_are_booleans: bool = ..., + indent: int = ..., ) -> None: ... def substitute(self, ns: str) -> str: ... def attribute_value(self, value: str) -> str: ... diff --git a/stubs/bleach/@tests/stubtest_allowlist.txt b/stubs/bleach/@tests/stubtest_allowlist.txt index 6189077..c3ff453 100644 --- a/stubs/bleach/@tests/stubtest_allowlist.txt +++ b/stubs/bleach/@tests/stubtest_allowlist.txt @@ -1 +1,2 @@ +bleach.css_sanitizer # Requires tinycss2 to be installed bleach.html5lib_shim.* diff --git a/stubs/bleach/METADATA.toml b/stubs/bleach/METADATA.toml index 71ef530..c98db63 100644 --- a/stubs/bleach/METADATA.toml +++ b/stubs/bleach/METADATA.toml @@ -1 +1 @@ -version = "4.1" +version = "5.0.*" diff --git a/stubs/bleach/bleach/__init__.pyi b/stubs/bleach/bleach/__init__.pyi index 202979e..94186a5 100644 --- a/stubs/bleach/bleach/__init__.pyi +++ b/stubs/bleach/bleach/__init__.pyi @@ -1,11 +1,10 @@ from collections.abc import Container, Iterable -from typing import Any -from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback -from bleach.sanitizer import ( +from .css_sanitizer import CSSSanitizer +from .linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback +from .sanitizer import ( ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES, ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS, - ALLOWED_STYLES as ALLOWED_STYLES, ALLOWED_TAGS as ALLOWED_TAGS, Cleaner as Cleaner, _Attributes, @@ -15,16 +14,15 @@ __all__ = ["clean", "linkify"] __releasedate__: str __version__: str -VERSION: Any # packaging.version.Version def clean( text: str, tags: Container[str] = ..., attributes: _Attributes = ..., - styles: Container[str] = ..., protocols: Container[str] = ..., strip: bool = ..., strip_comments: bool = ..., + css_sanitizer: CSSSanitizer | None = ..., ) -> str: ... def linkify( text: str, callbacks: Iterable[_Callback] = ..., skip_tags: Container[str] | None = ..., parse_email: bool = ... diff --git a/stubs/bleach/bleach/callbacks.pyi b/stubs/bleach/bleach/callbacks.pyi index de8a14d..4fe9723 100644 --- a/stubs/bleach/bleach/callbacks.pyi +++ b/stubs/bleach/bleach/callbacks.pyi @@ -1,7 +1,8 @@ from collections.abc import MutableMapping from typing import Any +from typing_extensions import TypeAlias -_Attrs = MutableMapping[Any, str] +_Attrs: TypeAlias = MutableMapping[Any, str] def nofollow(attrs: _Attrs, new: bool = ...) -> _Attrs: ... def target_blank(attrs: _Attrs, new: bool = ...) -> _Attrs: ... diff --git a/stubs/bleach/bleach/css_sanitizer.pyi b/stubs/bleach/bleach/css_sanitizer.pyi new file mode 100644 index 0000000..5e3c6f2 --- /dev/null +++ b/stubs/bleach/bleach/css_sanitizer.pyi @@ -0,0 +1,11 @@ +from collections.abc import Container + +ALLOWED_CSS_PROPERTIES: frozenset[str] +ALLOWED_SVG_PROPERTIES: frozenset[str] + +class CSSSanitizer: + allowed_css_properties: Container[str] + allowed_svg_properties: Container[str] + + def __init__(self, allowed_css_properties: Container[str] = ..., allowed_svg_properties: Container[str] = ...) -> None: ... + def sanitize_css(self, style: str) -> str: ... diff --git a/stubs/bleach/bleach/html5lib_shim.pyi b/stubs/bleach/bleach/html5lib_shim.pyi index 3d69fc0..bfe7e9c 100644 --- a/stubs/bleach/bleach/html5lib_shim.pyi +++ b/stubs/bleach/bleach/html5lib_shim.pyi @@ -1,17 +1,17 @@ +from _typeshed import Incomplete from collections.abc import Generator, Iterable -from typing import Any -class HTMLParser(object): # actually html5lib.HTMLParser - def __getattr__(self, __name: str) -> Any: ... # incomplete +class HTMLParser: # actually html5lib.HTMLParser + def __getattr__(self, __name: str) -> Incomplete: ... -class Filter(object): # actually html5lib.filters.base.Filter - def __getattr__(self, __name: str) -> Any: ... # incomplete +class Filter: # actually html5lib.filters.base.Filter + def __getattr__(self, __name: str) -> Incomplete: ... -class SanitizerFilter(object): # actually html5lib.filters.sanitizer.Filter - def __getattr__(self, __name: str) -> Any: ... # incomplete +class SanitizerFilter: # actually html5lib.filters.sanitizer.Filter + def __getattr__(self, __name: str) -> Incomplete: ... -class HTMLSerializer(object): # actually html5lib.serializer.HTMLSerializer - def __getattr__(self, __name: str) -> Any: ... # incomplete +class HTMLSerializer: # actually html5lib.serializer.HTMLSerializer + def __getattr__(self, __name: str) -> Incomplete: ... class BleachHTMLParser(HTMLParser): tags: list[str] | None @@ -24,4 +24,4 @@ class BleachHTMLSerializer(HTMLSerializer): def escape_base_amp(self, stoken: str) -> Generator[str, None, None]: ... def serialize(self, treewalker, encoding: str | None = ...) -> Generator[str, None, None]: ... -def __getattr__(__name: str) -> Any: ... # incomplete +def __getattr__(__name: str) -> Incomplete: ... diff --git a/stubs/bleach/bleach/linkifier.pyi b/stubs/bleach/bleach/linkifier.pyi index 05a6728..594b5b3 100644 --- a/stubs/bleach/bleach/linkifier.pyi +++ b/stubs/bleach/bleach/linkifier.pyi @@ -1,9 +1,12 @@ +from _typeshed import Incomplete from collections.abc import Container, Iterable, MutableMapping -from typing import Any, Pattern, Protocol +from re import Pattern +from typing import Any, Protocol +from typing_extensions import TypeAlias from .html5lib_shim import Filter -_Attrs = MutableMapping[Any, str] +_Attrs: TypeAlias = MutableMapping[Any, str] class _Callback(Protocol): def __call__(self, attrs: _Attrs, new: bool = ...) -> _Attrs: ... @@ -21,7 +24,7 @@ def build_email_re(tlds: Iterable[str] = ...) -> Pattern[str]: ... EMAIL_RE: Pattern[str] -class Linker(object): +class Linker: def __init__( self, callbacks: Iterable[_Callback] = ..., @@ -42,4 +45,4 @@ class LinkifyFilter(Filter): def __init__( self, source, callbacks=..., skip_tags: Container[str] | None = ..., parse_email: bool = ..., url_re=..., email_re=... ) -> None: ... - def __getattr__(self, item: str) -> Any: ... # incomplete + def __getattr__(self, item: str) -> Incomplete: ... diff --git a/stubs/bleach/bleach/sanitizer.pyi b/stubs/bleach/bleach/sanitizer.pyi index 0966af2..810b613 100644 --- a/stubs/bleach/bleach/sanitizer.pyi +++ b/stubs/bleach/bleach/sanitizer.pyi @@ -1,11 +1,13 @@ from collections.abc import Callable, Container, Iterable -from typing import Any, Dict, List, Pattern, Union +from re import Pattern +from typing import Any +from typing_extensions import TypeAlias +from .css_sanitizer import CSSSanitizer from .html5lib_shim import BleachHTMLParser, BleachHTMLSerializer, SanitizerFilter ALLOWED_TAGS: list[str] ALLOWED_ATTRIBUTES: dict[str, list[str]] -ALLOWED_STYLES: list[str] ALLOWED_PROTOCOLS: list[str] INVISIBLE_CHARACTERS: str @@ -13,16 +15,16 @@ INVISIBLE_CHARACTERS_RE: Pattern[str] INVISIBLE_REPLACEMENT_CHAR: str # A html5lib Filter class -_Filter = Any +_Filter: TypeAlias = Any -class Cleaner(object): +class Cleaner: tags: Container[str] attributes: _Attributes - styles: Container[str] protocols: Container[str] strip: bool strip_comments: bool filters: Iterable[_Filter] + css_sanitizer: CSSSanitizer | None parser: BleachHTMLParser walker: Any serializer: BleachHTMLSerializer @@ -30,17 +32,17 @@ class Cleaner(object): self, tags: Container[str] = ..., attributes: _Attributes = ..., - styles: Container[str] = ..., protocols: Container[str] = ..., strip: bool = ..., strip_comments: bool = ..., filters: Iterable[_Filter] | None = ..., + css_sanitizer: CSSSanitizer | None = ..., ) -> None: ... def clean(self, text: str) -> str: ... -_AttributeFilter = Callable[[str, str, str], bool] -_AttributeDict = Union[Dict[str, Union[List[str], _AttributeFilter]], Dict[str, List[str]], Dict[str, _AttributeFilter]] -_Attributes = Union[_AttributeFilter, _AttributeDict, List[str]] +_AttributeFilter: TypeAlias = Callable[[str, str, str], bool] +_AttributeDict: TypeAlias = dict[str, list[str] | _AttributeFilter] | dict[str, list[str]] | dict[str, _AttributeFilter] +_Attributes: TypeAlias = _AttributeFilter | _AttributeDict | list[str] def attribute_filter_factory(attributes: _Attributes) -> _AttributeFilter: ... @@ -51,9 +53,12 @@ class BleachSanitizerFilter(SanitizerFilter): def __init__( self, source, + allowed_elements: Container[str] = ..., attributes: _Attributes = ..., + allowed_protocols: Container[str] = ..., strip_disallowed_elements: bool = ..., strip_html_comments: bool = ..., + css_sanitizer: CSSSanitizer | None = ..., **kwargs, ) -> None: ... def sanitize_stream(self, token_iterator): ... diff --git a/stubs/bleach/bleach/utils.pyi b/stubs/bleach/bleach/utils.pyi deleted file mode 100644 index 1eff440..0000000 --- a/stubs/bleach/bleach/utils.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from collections import OrderedDict -from collections.abc import Mapping -from typing import Any, overload - -@overload -def alphabetize_attributes(attrs: None) -> None: ... -@overload -def alphabetize_attributes(attrs: Mapping[Any, str]) -> OrderedDict[Any, str]: ... diff --git a/stubs/boto/METADATA.toml b/stubs/boto/METADATA.toml index bc50117..ec10613 100644 --- a/stubs/boto/METADATA.toml +++ b/stubs/boto/METADATA.toml @@ -1,3 +1,2 @@ -version = "2.49" -python2 = true -requires = ["types-six"] +version = "2.49.*" +requires = [] diff --git a/stubs/boto/boto/__init__.pyi b/stubs/boto/boto/__init__.pyi index 775be7c..d8a1dab 100644 --- a/stubs/boto/boto/__init__.pyi +++ b/stubs/boto/boto/__init__.pyi @@ -1,5 +1,6 @@ import logging -from typing import Any, Text +from _typeshed import Incomplete +from typing import Any from .s3.connection import S3Connection @@ -23,7 +24,7 @@ perflog: Any def set_file_logger(name, filepath, level: Any = ..., format_string: Any | None = ...): ... def set_stream_logger(name, level: Any = ..., format_string: Any | None = ...): ... def connect_sqs(aws_access_key_id: Any | None = ..., aws_secret_access_key: Any | None = ..., **kwargs): ... -def connect_s3(aws_access_key_id: Text | None = ..., aws_secret_access_key: Text | None = ..., **kwargs) -> S3Connection: ... +def connect_s3(aws_access_key_id: str | None = ..., aws_secret_access_key: str | None = ..., **kwargs) -> S3Connection: ... def connect_gs(gs_access_key_id: Any | None = ..., gs_secret_access_key: Any | None = ..., **kwargs): ... def connect_ec2(aws_access_key_id: Any | None = ..., aws_secret_access_key: Any | None = ..., **kwargs): ... def connect_elb(aws_access_key_id: Any | None = ..., aws_secret_access_key: Any | None = ..., **kwargs): ... @@ -102,4 +103,4 @@ def storage_uri( def storage_uri_for_key(key): ... # Explicitly mark this package as incomplete. -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/boto/boto/compat.pyi b/stubs/boto/boto/compat.pyi index f9e10d6..5f6e4cc 100644 --- a/stubs/boto/boto/compat.pyi +++ b/stubs/boto/boto/compat.pyi @@ -1,20 +1,8 @@ -import sys +from base64 import encodebytes as encodebytes from typing import Any -if sys.version_info >= (3,): - from base64 import encodebytes as encodebytes -else: - from base64 import encodestring - - encodebytes = encodestring - expanduser: Any - -if sys.version_info >= (3, 0): - StandardError = Exception -else: - from __builtin__ import StandardError as StandardError - +StandardError = Exception long_type: Any unquote_str: Any parse_qs_safe: Any diff --git a/stubs/boto/boto/connection.pyi b/stubs/boto/boto/connection.pyi index c47f741..135ff91 100644 --- a/stubs/boto/boto/connection.pyi +++ b/stubs/boto/boto/connection.pyi @@ -1,7 +1,6 @@ +import http.client from typing import Any -from six.moves import http_client - HAVE_HTTPS_CONNECTION: bool ON_APP_ENGINE: Any PORTS_BY_SECURITY: Any @@ -40,7 +39,7 @@ class HTTPRequest: def __init__(self, method, protocol, host, port, path, auth_path, params, headers, body) -> None: ... def authorize(self, connection, **kwargs): ... -class HTTPResponse(http_client.HTTPResponse): +class HTTPResponse(http.client.HTTPResponse): def __init__(self, *args, **kwargs) -> None: ... def read(self, amt: Any | None = ...): ... @@ -91,12 +90,14 @@ class AWSAuthConnection: def aws_access_key_id(self): ... @property def gs_access_key_id(self) -> Any: ... - access_key: Any + @property + def access_key(self): ... @property def aws_secret_access_key(self): ... @property def gs_secret_access_key(self): ... - secret_key: Any + @property + def secret_key(self): ... @property def profile_name(self): ... def get_path(self, path: str = ...): ... @@ -166,7 +167,9 @@ class AWSQueryConnection(AWSAuthConnection): provider: str = ..., ) -> None: ... def get_utf8_value(self, value): ... - def make_request(self, action, params: Any | None = ..., path: str = ..., verb: str = ..., *args, **kwargs): ... # type: ignore # https://github.com/python/mypy/issues/1237 + def make_request( # type: ignore[override] + self, action, params: Any | None = ..., path: str = ..., verb: str = ..., *args, **kwargs + ): ... def build_list_params(self, params, items, label): ... def build_complex_list_params(self, params, items, label, names): ... def get_list(self, action, params, markers, path: str = ..., parent: Any | None = ..., verb: str = ...): ... diff --git a/stubs/boto/boto/ec2/__init__.pyi b/stubs/boto/boto/ec2/__init__.pyi index d44f942..e21a2bf 100644 --- a/stubs/boto/boto/ec2/__init__.pyi +++ b/stubs/boto/boto/ec2/__init__.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from typing import Any RegionData: Any @@ -7,4 +8,4 @@ def connect_to_region(region_name, **kw_params): ... def get_region(region_name, **kw_params): ... # Explicitly mark this package as incomplete. -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/boto/boto/kms/layer1.pyi b/stubs/boto/boto/kms/layer1.pyi index e275523..ed34447 100644 --- a/stubs/boto/boto/kms/layer1.pyi +++ b/stubs/boto/boto/kms/layer1.pyi @@ -1,4 +1,5 @@ -from typing import Any, Mapping, Type +from collections.abc import Mapping +from typing import Any from boto.connection import AWSQueryConnection @@ -8,7 +9,7 @@ class KMSConnection(AWSQueryConnection): DefaultRegionEndpoint: str ServiceName: str TargetPrefix: str - ResponseError: Type[Exception] + ResponseError: type[Exception] region: Any def __init__(self, **kwargs) -> None: ... def create_alias(self, alias_name: str, target_key_id: str) -> dict[str, Any] | None: ... diff --git a/stubs/boto/boto/s3/__init__.pyi b/stubs/boto/boto/s3/__init__.pyi index fa74795..c2ceb4b 100644 --- a/stubs/boto/boto/s3/__init__.pyi +++ b/stubs/boto/boto/s3/__init__.pyi @@ -1,5 +1,3 @@ -from typing import Text, Type - from boto.connection import AWSAuthConnection from boto.regioninfo import RegionInfo @@ -8,11 +6,11 @@ from .connection import S3Connection class S3RegionInfo(RegionInfo): def connect( self, - name: Text | None = ..., + name: str | None = ..., endpoint: str | None = ..., - connection_cls: Type[AWSAuthConnection] | None = ..., + connection_cls: type[AWSAuthConnection] | None = ..., **kw_params, ) -> S3Connection: ... def regions() -> list[S3RegionInfo]: ... -def connect_to_region(region_name: Text, **kw_params): ... +def connect_to_region(region_name: str, **kw_params): ... diff --git a/stubs/boto/boto/s3/acl.pyi b/stubs/boto/boto/s3/acl.pyi index 55966a1..218f7ea 100644 --- a/stubs/boto/boto/s3/acl.pyi +++ b/stubs/boto/boto/s3/acl.pyi @@ -1,4 +1,4 @@ -from typing import Any, Text +from typing import Any from .connection import S3Connection from .user import User @@ -11,8 +11,8 @@ class Policy: acl: ACL def __init__(self, parent: Any | None = ...) -> None: ... owner: User - def startElement(self, name: Text, attrs: dict[str, Any], connection: S3Connection) -> None | User | ACL: ... - def endElement(self, name: Text, value: Any, connection: S3Connection) -> None: ... + def startElement(self, name: str, attrs: dict[str, Any], connection: S3Connection) -> None | User | ACL: ... + def endElement(self, name: str, value: Any, connection: S3Connection) -> None: ... def to_xml(self) -> str: ... class ACL: @@ -20,29 +20,29 @@ class ACL: grants: list[Grant] def __init__(self, policy: Policy | None = ...) -> None: ... def add_grant(self, grant: Grant) -> None: ... - def add_email_grant(self, permission: Text, email_address: Text) -> None: ... - def add_user_grant(self, permission: Text, user_id: Text, display_name: Text | None = ...) -> None: ... + def add_email_grant(self, permission: str, email_address: str) -> None: ... + def add_user_grant(self, permission: str, user_id: str, display_name: str | None = ...) -> None: ... def startElement(self, name, attrs, connection): ... - def endElement(self, name: Text, value: Any, connection: S3Connection) -> None: ... + def endElement(self, name: str, value: Any, connection: S3Connection) -> None: ... def to_xml(self) -> str: ... class Grant: - NameSpace: Text - permission: Text - id: Text - display_name: Text - uri: Text - email_address: Text - type: Text + NameSpace: str + permission: str + id: str + display_name: str + uri: str + email_address: str + type: str def __init__( self, - permission: Text | None = ..., - type: Text | None = ..., - id: Text | None = ..., - display_name: Text | None = ..., - uri: Text | None = ..., - email_address: Text | None = ..., + permission: str | None = ..., + type: str | None = ..., + id: str | None = ..., + display_name: str | None = ..., + uri: str | None = ..., + email_address: str | None = ..., ) -> None: ... def startElement(self, name, attrs, connection): ... - def endElement(self, name: Text, value: Any, connection: S3Connection) -> None: ... + def endElement(self, name: str, value: Any, connection: S3Connection) -> None: ... def to_xml(self) -> str: ... diff --git a/stubs/boto/boto/s3/bucket.pyi b/stubs/boto/boto/s3/bucket.pyi index 741772f..45b0d55 100644 --- a/stubs/boto/boto/s3/bucket.pyi +++ b/stubs/boto/boto/s3/bucket.pyi @@ -1,4 +1,4 @@ -from typing import Any, Text, Type +from typing import Any from .bucketlistresultset import BucketListResultSet from .connection import S3Connection @@ -7,7 +7,7 @@ from .key import Key class S3WebsiteEndpointTranslate: trans_region: dict[str, str] @classmethod - def translate_region(cls, reg: Text) -> str: ... + def translate_region(cls, reg: str) -> str: ... S3Permissions: list[str] @@ -17,31 +17,31 @@ class Bucket: VersioningBody: str VersionRE: str MFADeleteRE: str - name: Text + name: str connection: S3Connection - key_class: Type[Key] - def __init__(self, connection: S3Connection | None = ..., name: Text | None = ..., key_class: Type[Key] = ...) -> None: ... + key_class: type[Key] + def __init__(self, connection: S3Connection | None = ..., name: str | None = ..., key_class: type[Key] = ...) -> None: ... def __iter__(self): ... def __contains__(self, key_name) -> bool: ... def startElement(self, name, attrs, connection): ... creation_date: Any def endElement(self, name, value, connection): ... def set_key_class(self, key_class): ... - def lookup(self, key_name, headers: dict[Text, Text] | None = ...): ... + def lookup(self, key_name, headers: dict[str, str] | None = ...): ... def get_key( self, key_name, - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., version_id: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., validate: bool = ..., ) -> Key: ... def list( self, - prefix: Text = ..., - delimiter: Text = ..., - marker: Text = ..., - headers: dict[Text, Text] | None = ..., + prefix: str = ..., + delimiter: str = ..., + marker: str = ..., + headers: dict[str, str] | None = ..., encoding_type: Any | None = ..., ) -> BucketListResultSet: ... def list_versions( @@ -50,34 +50,34 @@ class Bucket: delimiter: str = ..., key_marker: str = ..., version_id_marker: str = ..., - headers: dict[Text, Text] | None = ..., - encoding_type: Text | None = ..., + headers: dict[str, str] | None = ..., + encoding_type: str | None = ..., ) -> BucketListResultSet: ... def list_multipart_uploads( self, key_marker: str = ..., upload_id_marker: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., encoding_type: Any | None = ..., ): ... def validate_kwarg_names(self, kwargs, names): ... - def get_all_keys(self, headers: dict[Text, Text] | None = ..., **params): ... - def get_all_versions(self, headers: dict[Text, Text] | None = ..., **params): ... + def get_all_keys(self, headers: dict[str, str] | None = ..., **params): ... + def get_all_versions(self, headers: dict[str, str] | None = ..., **params): ... def validate_get_all_versions_params(self, params): ... - def get_all_multipart_uploads(self, headers: dict[Text, Text] | None = ..., **params): ... + def get_all_multipart_uploads(self, headers: dict[str, str] | None = ..., **params): ... def new_key(self, key_name: Any | None = ...): ... def generate_url( self, expires_in, method: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., force_http: bool = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., expires_in_absolute: bool = ..., ): ... - def delete_keys(self, keys, quiet: bool = ..., mfa_token: Any | None = ..., headers: dict[Text, Text] | None = ...): ... + def delete_keys(self, keys, quiet: bool = ..., mfa_token: Any | None = ..., headers: dict[str, str] | None = ...): ... def delete_key( - self, key_name, headers: dict[Text, Text] | None = ..., version_id: Any | None = ..., mfa_token: Any | None = ... + self, key_name, headers: dict[str, str] | None = ..., version_id: Any | None = ..., mfa_token: Any | None = ... ): ... def copy_key( self, @@ -89,90 +89,90 @@ class Bucket: storage_class: str = ..., preserve_acl: bool = ..., encrypt_key: bool = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., query_args: Any | None = ..., ): ... def set_canned_acl( - self, acl_str, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ... + self, acl_str, key_name: str = ..., headers: dict[str, str] | None = ..., version_id: Any | None = ... ): ... - def get_xml_acl(self, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ...): ... + def get_xml_acl(self, key_name: str = ..., headers: dict[str, str] | None = ..., version_id: Any | None = ...): ... def set_xml_acl( self, acl_str, key_name: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., version_id: Any | None = ..., query_args: str = ..., ): ... - def set_acl(self, acl_or_str, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ...): ... - def get_acl(self, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ...): ... + def set_acl(self, acl_or_str, key_name: str = ..., headers: dict[str, str] | None = ..., version_id: Any | None = ...): ... + def get_acl(self, key_name: str = ..., headers: dict[str, str] | None = ..., version_id: Any | None = ...): ... def set_subresource( - self, subresource, value, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ... + self, subresource, value, key_name: str = ..., headers: dict[str, str] | None = ..., version_id: Any | None = ... ): ... def get_subresource( - self, subresource, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ... + self, subresource, key_name: str = ..., headers: dict[str, str] | None = ..., version_id: Any | None = ... ): ... - def make_public(self, recursive: bool = ..., headers: dict[Text, Text] | None = ...): ... - def add_email_grant(self, permission, email_address, recursive: bool = ..., headers: dict[Text, Text] | None = ...): ... + def make_public(self, recursive: bool = ..., headers: dict[str, str] | None = ...): ... + def add_email_grant(self, permission, email_address, recursive: bool = ..., headers: dict[str, str] | None = ...): ... def add_user_grant( - self, permission, user_id, recursive: bool = ..., headers: dict[Text, Text] | None = ..., display_name: Any | None = ... + self, permission, user_id, recursive: bool = ..., headers: dict[str, str] | None = ..., display_name: Any | None = ... ): ... - def list_grants(self, headers: dict[Text, Text] | None = ...): ... + def list_grants(self, headers: dict[str, str] | None = ...): ... def get_location(self): ... - def set_xml_logging(self, logging_str, headers: dict[Text, Text] | None = ...): ... + def set_xml_logging(self, logging_str, headers: dict[str, str] | None = ...): ... def enable_logging( - self, target_bucket, target_prefix: str = ..., grants: Any | None = ..., headers: dict[Text, Text] | None = ... + self, target_bucket, target_prefix: str = ..., grants: Any | None = ..., headers: dict[str, str] | None = ... ): ... - def disable_logging(self, headers: dict[Text, Text] | None = ...): ... - def get_logging_status(self, headers: dict[Text, Text] | None = ...): ... - def set_as_logging_target(self, headers: dict[Text, Text] | None = ...): ... - def get_request_payment(self, headers: dict[Text, Text] | None = ...): ... - def set_request_payment(self, payer: str = ..., headers: dict[Text, Text] | None = ...): ... + def disable_logging(self, headers: dict[str, str] | None = ...): ... + def get_logging_status(self, headers: dict[str, str] | None = ...): ... + def set_as_logging_target(self, headers: dict[str, str] | None = ...): ... + def get_request_payment(self, headers: dict[str, str] | None = ...): ... + def set_request_payment(self, payer: str = ..., headers: dict[str, str] | None = ...): ... def configure_versioning( - self, versioning, mfa_delete: bool = ..., mfa_token: Any | None = ..., headers: dict[Text, Text] | None = ... + self, versioning, mfa_delete: bool = ..., mfa_token: Any | None = ..., headers: dict[str, str] | None = ... ): ... - def get_versioning_status(self, headers: dict[Text, Text] | None = ...): ... - def configure_lifecycle(self, lifecycle_config, headers: dict[Text, Text] | None = ...): ... - def get_lifecycle_config(self, headers: dict[Text, Text] | None = ...): ... - def delete_lifecycle_configuration(self, headers: dict[Text, Text] | None = ...): ... + def get_versioning_status(self, headers: dict[str, str] | None = ...): ... + def configure_lifecycle(self, lifecycle_config, headers: dict[str, str] | None = ...): ... + def get_lifecycle_config(self, headers: dict[str, str] | None = ...): ... + def delete_lifecycle_configuration(self, headers: dict[str, str] | None = ...): ... def configure_website( self, suffix: Any | None = ..., error_key: Any | None = ..., redirect_all_requests_to: Any | None = ..., routing_rules: Any | None = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., ): ... - def set_website_configuration(self, config, headers: dict[Text, Text] | None = ...): ... - def set_website_configuration_xml(self, xml, headers: dict[Text, Text] | None = ...): ... - def get_website_configuration(self, headers: dict[Text, Text] | None = ...): ... - def get_website_configuration_obj(self, headers: dict[Text, Text] | None = ...): ... - def get_website_configuration_with_xml(self, headers: dict[Text, Text] | None = ...): ... - def get_website_configuration_xml(self, headers: dict[Text, Text] | None = ...): ... - def delete_website_configuration(self, headers: dict[Text, Text] | None = ...): ... + def set_website_configuration(self, config, headers: dict[str, str] | None = ...): ... + def set_website_configuration_xml(self, xml, headers: dict[str, str] | None = ...): ... + def get_website_configuration(self, headers: dict[str, str] | None = ...): ... + def get_website_configuration_obj(self, headers: dict[str, str] | None = ...): ... + def get_website_configuration_with_xml(self, headers: dict[str, str] | None = ...): ... + def get_website_configuration_xml(self, headers: dict[str, str] | None = ...): ... + def delete_website_configuration(self, headers: dict[str, str] | None = ...): ... def get_website_endpoint(self): ... - def get_policy(self, headers: dict[Text, Text] | None = ...): ... - def set_policy(self, policy, headers: dict[Text, Text] | None = ...): ... - def delete_policy(self, headers: dict[Text, Text] | None = ...): ... - def set_cors_xml(self, cors_xml, headers: dict[Text, Text] | None = ...): ... - def set_cors(self, cors_config, headers: dict[Text, Text] | None = ...): ... - def get_cors_xml(self, headers: dict[Text, Text] | None = ...): ... - def get_cors(self, headers: dict[Text, Text] | None = ...): ... - def delete_cors(self, headers: dict[Text, Text] | None = ...): ... + def get_policy(self, headers: dict[str, str] | None = ...): ... + def set_policy(self, policy, headers: dict[str, str] | None = ...): ... + def delete_policy(self, headers: dict[str, str] | None = ...): ... + def set_cors_xml(self, cors_xml, headers: dict[str, str] | None = ...): ... + def set_cors(self, cors_config, headers: dict[str, str] | None = ...): ... + def get_cors_xml(self, headers: dict[str, str] | None = ...): ... + def get_cors(self, headers: dict[str, str] | None = ...): ... + def delete_cors(self, headers: dict[str, str] | None = ...): ... def initiate_multipart_upload( self, key_name, - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., reduced_redundancy: bool = ..., metadata: Any | None = ..., encrypt_key: bool = ..., policy: Any | None = ..., ): ... - def complete_multipart_upload(self, key_name, upload_id, xml_body, headers: dict[Text, Text] | None = ...): ... - def cancel_multipart_upload(self, key_name, upload_id, headers: dict[Text, Text] | None = ...): ... - def delete(self, headers: dict[Text, Text] | None = ...): ... + def complete_multipart_upload(self, key_name, upload_id, xml_body, headers: dict[str, str] | None = ...): ... + def cancel_multipart_upload(self, key_name, upload_id, headers: dict[str, str] | None = ...): ... + def delete(self, headers: dict[str, str] | None = ...): ... def get_tags(self): ... def get_xml_tags(self): ... - def set_xml_tags(self, tag_str, headers: dict[Text, Text] | None = ..., query_args: str = ...): ... - def set_tags(self, tags, headers: dict[Text, Text] | None = ...): ... - def delete_tags(self, headers: dict[Text, Text] | None = ...): ... + def set_xml_tags(self, tag_str, headers: dict[str, str] | None = ..., query_args: str = ...): ... + def set_tags(self, tags, headers: dict[str, str] | None = ...): ... + def delete_tags(self, headers: dict[str, str] | None = ...): ... diff --git a/stubs/boto/boto/s3/bucketlistresultset.pyi b/stubs/boto/boto/s3/bucketlistresultset.pyi index e327ac4..258af6c 100644 --- a/stubs/boto/boto/s3/bucketlistresultset.pyi +++ b/stubs/boto/boto/s3/bucketlistresultset.pyi @@ -1,4 +1,5 @@ -from typing import Any, Iterable, Iterator +from collections.abc import Iterable, Iterator +from typing import Any from .key import Key diff --git a/stubs/boto/boto/s3/connection.pyi b/stubs/boto/boto/s3/connection.pyi index 96b8d0d..286b1c7 100644 --- a/stubs/boto/boto/s3/connection.pyi +++ b/stubs/boto/boto/s3/connection.pyi @@ -1,4 +1,4 @@ -from typing import Any, Text, Type +from typing import Any from boto.connection import AWSAuthConnection from boto.exception import BotoClientError @@ -48,7 +48,7 @@ class S3Connection(AWSAuthConnection): DefaultCallingFormat: Any QueryString: str calling_format: Any - bucket_class: Type[Bucket] + bucket_class: type[Bucket] anon: Any def __init__( self, @@ -66,7 +66,7 @@ class S3Connection(AWSAuthConnection): calling_format: Any = ..., path: str = ..., provider: str = ..., - bucket_class: Type[Bucket] = ..., + bucket_class: type[Bucket] = ..., security_token: Any | None = ..., suppress_consec_slashes: bool = ..., anon: bool = ..., @@ -75,7 +75,7 @@ class S3Connection(AWSAuthConnection): ) -> None: ... def __iter__(self): ... def __contains__(self, bucket_name): ... - def set_bucket_class(self, bucket_class: Type[Bucket]) -> None: ... + def set_bucket_class(self, bucket_class: type[Bucket]) -> None: ... def build_post_policy(self, expiration_time, conditions): ... def build_post_form_args( self, @@ -97,9 +97,9 @@ class S3Connection(AWSAuthConnection): method, bucket: str = ..., key: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., force_http: bool = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., version_id: Any | None = ..., iso_date: Any | None = ..., ): ... @@ -109,20 +109,31 @@ class S3Connection(AWSAuthConnection): method, bucket: str = ..., key: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., query_auth: bool = ..., force_http: bool = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., expires_in_absolute: bool = ..., version_id: Any | None = ..., ): ... - def get_all_buckets(self, headers: dict[Text, Text] | None = ...): ... - def get_canonical_user_id(self, headers: dict[Text, Text] | None = ...): ... - def get_bucket(self, bucket_name: Text, validate: bool = ..., headers: dict[Text, Text] | None = ...) -> Bucket: ... - def head_bucket(self, bucket_name, headers: dict[Text, Text] | None = ...): ... - def lookup(self, bucket_name, validate: bool = ..., headers: dict[Text, Text] | None = ...): ... - def create_bucket( - self, bucket_name, headers: dict[Text, Text] | None = ..., location: Any = ..., policy: Any | None = ... + def get_all_buckets(self, headers: dict[str, str] | None = ...): ... + def get_canonical_user_id(self, headers: dict[str, str] | None = ...): ... + def get_bucket(self, bucket_name: str, validate: bool = ..., headers: dict[str, str] | None = ...) -> Bucket: ... + def head_bucket(self, bucket_name, headers: dict[str, str] | None = ...): ... + def lookup(self, bucket_name, validate: bool = ..., headers: dict[str, str] | None = ...): ... + def create_bucket(self, bucket_name, headers: dict[str, str] | None = ..., location: Any = ..., policy: Any | None = ...): ... + def delete_bucket(self, bucket, headers: dict[str, str] | None = ...): ... + def make_request( # type: ignore[override] + self, + method, + bucket: str = ..., + key: str = ..., + headers: Any | None = ..., + data: str = ..., + query_args: Any | None = ..., + sender: Any | None = ..., + override_num_retries: Any | None = ..., + retry_handler: Any | None = ..., + *args, + **kwargs, ): ... - def delete_bucket(self, bucket, headers: dict[Text, Text] | None = ...): ... - def make_request(self, method, bucket: str = ..., key: str = ..., headers: Any | None = ..., data: str = ..., query_args: Any | None = ..., sender: Any | None = ..., override_num_retries: Any | None = ..., retry_handler: Any | None = ..., *args, **kwargs): ... # type: ignore # https://github.com/python/mypy/issues/1237 diff --git a/stubs/boto/boto/s3/cors.pyi b/stubs/boto/boto/s3/cors.pyi index f31e612..125587f 100644 --- a/stubs/boto/boto/s3/cors.pyi +++ b/stubs/boto/boto/s3/cors.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any class CORSRule: allowed_method: Any @@ -20,7 +20,7 @@ class CORSRule: def endElement(self, name, value, connection): ... def to_xml(self) -> str: ... -class CORSConfiguration(List[CORSRule]): +class CORSConfiguration(list[CORSRule]): def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self) -> str: ... diff --git a/stubs/boto/boto/s3/key.pyi b/stubs/boto/boto/s3/key.pyi index 1a8b365..539f071 100644 --- a/stubs/boto/boto/s3/key.pyi +++ b/stubs/boto/boto/s3/key.pyi @@ -1,4 +1,5 @@ -from typing import Any, Callable, Text, overload +from collections.abc import Callable +from typing import Any, overload class Key: DefaultContentType: str @@ -45,16 +46,16 @@ class Key: def handle_addl_headers(self, headers): ... def open_read( self, - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., query_args: str = ..., override_num_retries: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., ): ... - def open_write(self, headers: dict[Text, Text] | None = ..., override_num_retries: Any | None = ...): ... + def open_write(self, headers: dict[str, str] | None = ..., override_num_retries: Any | None = ...): ... def open( self, mode: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., query_args: Any | None = ..., override_num_retries: Any | None = ..., ): ... @@ -76,27 +77,27 @@ class Key: ): ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... - def exists(self, headers: dict[Text, Text] | None = ...): ... - def delete(self, headers: dict[Text, Text] | None = ...): ... + def exists(self, headers: dict[str, str] | None = ...): ... + def delete(self, headers: dict[str, str] | None = ...): ... def get_metadata(self, name): ... def set_metadata(self, name, value): ... def update_metadata(self, d): ... - def set_acl(self, acl_str, headers: dict[Text, Text] | None = ...): ... - def get_acl(self, headers: dict[Text, Text] | None = ...): ... - def get_xml_acl(self, headers: dict[Text, Text] | None = ...): ... - def set_xml_acl(self, acl_str, headers: dict[Text, Text] | None = ...): ... - def set_canned_acl(self, acl_str, headers: dict[Text, Text] | None = ...): ... + def set_acl(self, acl_str, headers: dict[str, str] | None = ...): ... + def get_acl(self, headers: dict[str, str] | None = ...): ... + def get_xml_acl(self, headers: dict[str, str] | None = ...): ... + def set_xml_acl(self, acl_str, headers: dict[str, str] | None = ...): ... + def set_canned_acl(self, acl_str, headers: dict[str, str] | None = ...): ... def get_redirect(self): ... - def set_redirect(self, redirect_location, headers: dict[Text, Text] | None = ...): ... - def make_public(self, headers: dict[Text, Text] | None = ...): ... + def set_redirect(self, redirect_location, headers: dict[str, str] | None = ...): ... + def make_public(self, headers: dict[str, str] | None = ...): ... def generate_url( self, expires_in, method: str = ..., - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., query_auth: bool = ..., force_http: bool = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., expires_in_absolute: bool = ..., version_id: Any | None = ..., policy: Any | None = ..., @@ -106,8 +107,8 @@ class Key: def send_file( self, fp, - headers: dict[Text, Text] | None = ..., - cb: Callable[[int, int], Any] | None = ..., + headers: dict[str, str] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., query_args: Any | None = ..., chunked_transfer: bool = ..., @@ -118,9 +119,9 @@ class Key: def set_contents_from_stream( self, fp, - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., replace: bool = ..., - cb: Callable[[int, int], Any] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., policy: Any | None = ..., reduced_redundancy: bool = ..., @@ -130,9 +131,9 @@ class Key: def set_contents_from_file( self, fp, - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., replace: bool = ..., - cb: Callable[[int, int], Any] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., policy: Any | None = ..., md5: Any | None = ..., @@ -145,9 +146,9 @@ class Key: def set_contents_from_filename( self, filename, - headers: dict[Text, Text] | None = ..., + headers: dict[str, str] | None = ..., replace: bool = ..., - cb: Callable[[int, int], Any] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., policy: Any | None = ..., md5: Any | None = ..., @@ -156,10 +157,10 @@ class Key: ): ... def set_contents_from_string( self, - string_data: Text | bytes, - headers: dict[Text, Text] | None = ..., + string_data: str | bytes, + headers: dict[str, str] | None = ..., replace: bool = ..., - cb: Callable[[int, int], Any] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., policy: Any | None = ..., md5: Any | None = ..., @@ -169,63 +170,63 @@ class Key: def get_file( self, fp, - headers: dict[Text, Text] | None = ..., - cb: Callable[[int, int], Any] | None = ..., + headers: dict[str, str] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., override_num_retries: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., ): ... def get_torrent_file( - self, fp, headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ... + self, fp, headers: dict[str, str] | None = ..., cb: Callable[[int, int], object] | None = ..., num_cb: int = ... ): ... def get_contents_to_file( self, fp, - headers: dict[Text, Text] | None = ..., - cb: Callable[[int, int], Any] | None = ..., + headers: dict[str, str] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., res_download_handler: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., ): ... def get_contents_to_filename( self, filename, - headers: dict[Text, Text] | None = ..., - cb: Callable[[int, int], Any] | None = ..., + headers: dict[str, str] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., res_download_handler: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., ): ... @overload def get_contents_as_string( self, - headers: dict[Text, Text] | None = ..., - cb: Callable[[int, int], Any] | None = ..., + headers: dict[str, str] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., encoding: None = ..., ) -> bytes: ... @overload def get_contents_as_string( self, - headers: dict[Text, Text] | None = ..., - cb: Callable[[int, int], Any] | None = ..., + headers: dict[str, str] | None = ..., + cb: Callable[[int, int], object] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., - response_headers: dict[Text, Text] | None = ..., + response_headers: dict[str, str] | None = ..., *, - encoding: Text, - ) -> Text: ... - def add_email_grant(self, permission, email_address, headers: dict[Text, Text] | None = ...): ... - def add_user_grant(self, permission, user_id, headers: dict[Text, Text] | None = ..., display_name: Any | None = ...): ... - def set_remote_metadata(self, metadata_plus, metadata_minus, preserve_acl, headers: dict[Text, Text] | None = ...): ... - def restore(self, days, headers: dict[Text, Text] | None = ...): ... + encoding: str, + ) -> str: ... + def add_email_grant(self, permission, email_address, headers: dict[str, str] | None = ...): ... + def add_user_grant(self, permission, user_id, headers: dict[str, str] | None = ..., display_name: Any | None = ...): ... + def set_remote_metadata(self, metadata_plus, metadata_minus, preserve_acl, headers: dict[str, str] | None = ...): ... + def restore(self, days, headers: dict[str, str] | None = ...): ... diff --git a/stubs/boto/boto/s3/lifecycle.pyi b/stubs/boto/boto/s3/lifecycle.pyi index bf750bb..7919bad 100644 --- a/stubs/boto/boto/s3/lifecycle.pyi +++ b/stubs/boto/boto/s3/lifecycle.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any class Rule: id: Any @@ -33,7 +33,7 @@ class Transition: def __init__(self, days: Any | None = ..., date: Any | None = ..., storage_class: Any | None = ...) -> None: ... def to_xml(self): ... -class Transitions(List[Transition]): +class Transitions(list[Transition]): transition_properties: int current_transition_property: int temp_days: Any @@ -51,7 +51,7 @@ class Transitions(List[Transition]): @property def storage_class(self): ... -class Lifecycle(List[Rule]): +class Lifecycle(list[Rule]): def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self): ... diff --git a/stubs/boto/boto/s3/tagging.pyi b/stubs/boto/boto/s3/tagging.pyi index ad1bcf8..98a954d 100644 --- a/stubs/boto/boto/s3/tagging.pyi +++ b/stubs/boto/boto/s3/tagging.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any class Tag: key: Any @@ -9,13 +9,13 @@ class Tag: def to_xml(self): ... def __eq__(self, other): ... -class TagSet(List[Tag]): +class TagSet(list[Tag]): def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def add_tag(self, key, value): ... def to_xml(self): ... -class Tags(List[TagSet]): +class Tags(list[TagSet]): def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self): ... diff --git a/stubs/boto/boto/s3/website.pyi b/stubs/boto/boto/s3/website.pyi index 186afdf..e913f6d 100644 --- a/stubs/boto/boto/s3/website.pyi +++ b/stubs/boto/boto/s3/website.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any def tag(key, value): ... @@ -33,7 +33,7 @@ class RedirectLocation(_XMLKeyValue): def __init__(self, hostname: Any | None = ..., protocol: Any | None = ...) -> None: ... def to_xml(self): ... -class RoutingRules(List[RoutingRule]): +class RoutingRules(list[RoutingRule]): def add_rule(self, rule: RoutingRule) -> RoutingRules: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... diff --git a/stubs/boto/boto/utils.pyi b/stubs/boto/boto/utils.pyi index c454909..f9ce83d 100644 --- a/stubs/boto/boto/utils.pyi +++ b/stubs/boto/boto/utils.pyi @@ -1,46 +1,27 @@ import datetime +import io import logging.handlers import subprocess -import sys import time -from typing import IO, Any, Callable, ContextManager, Dict, Iterable, Mapping, Sequence, Tuple, Type, TypeVar +from collections.abc import Callable, Iterable, Mapping, Sequence +from contextlib import AbstractContextManager +from email.message import Message +from hashlib import _Hash +from typing import IO, Any, TypeVar +from typing_extensions import TypeAlias import boto.connection _KT = TypeVar("_KT") _VT = TypeVar("_VT") -if sys.version_info >= (3,): - # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO - import io +_Provider: TypeAlias = Any # TODO replace this with boto.provider.Provider once stubs exist +_LockType: TypeAlias = Any # TODO replace this with _thread.LockType once stubs exist - _StringIO = io.StringIO - - from hashlib import _Hash - - _HashType = _Hash - - from email.message import Message as _Message -else: - # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO - import StringIO - - _StringIO = StringIO.StringIO[Any] - - from hashlib import _hash - - _HashType = _hash - - # TODO use email.message.Message once stubs exist - _Message = Any - -_Provider = Any # TODO replace this with boto.provider.Provider once stubs exist -_LockType = Any # TODO replace this with _thread.LockType once stubs exist - -JSONDecodeError: Type[ValueError] +JSONDecodeError: type[ValueError] qsa_of_interest: list[str] -def unquote_v(nv: str) -> str | Tuple[str, str]: ... +def unquote_v(nv: str) -> str | tuple[str, str]: ... def canonical_string( method: str, path: str, headers: Mapping[str, str | None], expires: int | None = ..., provider: _Provider | None = ... ) -> str: ... @@ -50,7 +31,7 @@ def merge_meta( def get_aws_metadata(headers: Mapping[str, str], provider: _Provider | None = ...) -> Mapping[str, str]: ... def retry_url(url: str, retry_on_404: bool = ..., num_retries: int = ..., timeout: int | None = ...) -> str: ... -class LazyLoadMetadata(Dict[_KT, _VT]): +class LazyLoadMetadata(dict[_KT, _VT]): def __init__(self, url: str, num_retries: int, timeout: int | None = ...) -> None: ... def get_instance_metadata( @@ -68,10 +49,10 @@ ISO8601_MS: str RFC1123: str LOCALE_LOCK: _LockType -def setlocale(name: str | Tuple[str, str]) -> ContextManager[str]: ... +def setlocale(name: str | tuple[str, str]) -> AbstractContextManager[str]: ... def get_ts(ts: time.struct_time | None = ...) -> str: ... def parse_ts(ts: str) -> datetime.datetime: ... -def find_class(module_name: str, class_name: str | None = ...) -> Type[Any] | None: ... +def find_class(module_name: str, class_name: str | None = ...) -> type[Any] | None: ... def update_dme(username: str, password: str, dme_id: str, ip_address: str) -> str: ... def fetch_file( uri: str, file: IO[str] | None = ..., username: str | None = ..., password: str | None = ... @@ -80,7 +61,7 @@ def fetch_file( class ShellCommand: exit_code: int command: subprocess._CMD - log_fp: _StringIO + log_fp: io.StringIO wait: bool fail_fast: bool def __init__( @@ -101,7 +82,7 @@ class AuthSMTPHandler(logging.handlers.SMTPHandler): self, mailhost: str, username: str, password: str, fromaddr: str, toaddrs: Sequence[str], subject: str ) -> None: ... -class LRUCache(Dict[_KT, _VT]): +class LRUCache(dict[_KT, _VT]): class _Item: previous: LRUCache._Item | None next: LRUCache._Item | None @@ -115,14 +96,14 @@ class LRUCache(Dict[_KT, _VT]): def __init__(self, capacity: int) -> None: ... # This exists to work around Password.str's name shadowing the str type -_str = str +_Str: TypeAlias = str class Password: - hashfunc: Callable[[bytes], _HashType] - str: _str | None - def __init__(self, str: _str | None = ..., hashfunc: Callable[[bytes], _HashType] | None = ...) -> None: ... - def set(self, value: bytes | _str) -> None: ... - def __eq__(self, other: Any) -> bool: ... + hashfunc: Callable[[bytes], _Hash] + str: _Str | None + def __init__(self, str: _Str | None = ..., hashfunc: Callable[[bytes], _Hash] | None = ...) -> None: ... + def set(self, value: bytes | _Str) -> None: ... + def __eq__(self, other: _Str | bytes | None) -> bool: ... # type: ignore[override] def __len__(self) -> int: ... def notify( @@ -130,18 +111,18 @@ def notify( body: str | None = ..., html_body: Sequence[str] | str | None = ..., to_string: str | None = ..., - attachments: Iterable[_Message] | None = ..., + attachments: Iterable[Message] | None = ..., append_instance_id: bool = ..., ) -> None: ... def get_utf8_value(value: str) -> bytes: ... def mklist(value: Any) -> list[Any]: ... def pythonize_name(name: str) -> str: ... def write_mime_multipart( - content: list[Tuple[str, str]], compress: bool = ..., deftype: str = ..., delimiter: str = ... + content: list[tuple[str, str]], compress: bool = ..., deftype: str = ..., delimiter: str = ... ) -> str: ... def guess_mime_type(content: str, deftype: str) -> str: ... -def compute_md5(fp: IO[Any], buf_size: int = ..., size: int | None = ...) -> Tuple[str, str, int]: ... -def compute_hash(fp: IO[Any], buf_size: int = ..., size: int | None = ..., hash_algorithm: Any = ...) -> Tuple[str, str, int]: ... +def compute_md5(fp: IO[Any], buf_size: int = ..., size: int | None = ...) -> tuple[str, str, int]: ... +def compute_hash(fp: IO[Any], buf_size: int = ..., size: int | None = ..., hash_algorithm: Any = ...) -> tuple[str, str, int]: ... def find_matching_headers(name: str, headers: Mapping[str, str | None]) -> list[str]: ... def merge_headers_by_name(name: str, headers: Mapping[str, str | None]) -> str: ... diff --git a/stubs/braintree/@tests/stubtest_allowlist.txt b/stubs/braintree/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..f40932c --- /dev/null +++ b/stubs/braintree/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +.*\.AttributeGetter.__repr__ # has an extra argument, but also a million things inherit from it diff --git a/stubs/braintree/METADATA.toml b/stubs/braintree/METADATA.toml index 4ede6a0..1c7b94b 100644 --- a/stubs/braintree/METADATA.toml +++ b/stubs/braintree/METADATA.toml @@ -1 +1 @@ -version = "4.11" +version = "4.17.*" diff --git a/stubs/braintree/braintree/credit_card.pyi b/stubs/braintree/braintree/credit_card.pyi index f6a3738..e685003 100644 --- a/stubs/braintree/braintree/credit_card.pyi +++ b/stubs/braintree/braintree/credit_card.pyi @@ -25,9 +25,11 @@ class CreditCard(Resource): Switch: str Visa: str Unknown: str + class CustomerLocation: International: str US: str + class CardTypeIndicator: Yes: str No: str diff --git a/stubs/braintree/braintree/dispute.pyi b/stubs/braintree/braintree/dispute.pyi index 64a87eb..edda8a9 100644 --- a/stubs/braintree/braintree/dispute.pyi +++ b/stubs/braintree/braintree/dispute.pyi @@ -17,6 +17,7 @@ class Dispute(AttributeGetter): Open: str Won: str Lost: str + class Reason: CancelledRecurringTransaction: str CreditNotProcessed: str @@ -29,10 +30,12 @@ class Dispute(AttributeGetter): ProductUnsatisfactory: str Retrieval: str TransactionAmountDiffers: str + class Kind: Chargeback: str PreArbitration: str Retrieval: str + class ChargebackProtectionLevel: Effortless: str Standard: str diff --git a/stubs/braintree/braintree/error_codes.pyi b/stubs/braintree/braintree/error_codes.pyi index 147f54d..9945211 100644 --- a/stubs/braintree/braintree/error_codes.pyi +++ b/stubs/braintree/braintree/error_codes.pyi @@ -29,6 +29,7 @@ class ErrorCodes: StreetAddressIsRequired: str StreetAddressIsTooLong: str TooManyAddressesPerCustomer: str + class ApplePay: ApplePayCardsAreNotAccepted: str CustomerIdIsRequiredForVaulting: str @@ -52,6 +53,7 @@ class ErrorCodes: InvalidToken: str PrivateKeyMismatch: str KeyMismatchStoringCertificate: str + class AuthorizationFingerprint: MissingFingerprint: str InvalidFormat: str @@ -60,6 +62,7 @@ class ErrorCodes: InvalidPublicKey: str InvalidSignature: str OptionsNotAllowedWithoutCustomer: str + class ClientToken: MakeDefaultRequiresCustomerId: str VerifyCardRequiresCustomerId: str @@ -68,6 +71,7 @@ class ErrorCodes: ProxyMerchantDoesNotExist: str UnsupportedVersion: str MerchantAccountDoesNotExist: str + class CreditCard: BillingAddressConflict: str BillingAddressFormatIsInvalid: str @@ -113,6 +117,7 @@ class ErrorCodes: VerificationNotSupportedOnThisMerchantAccount: str VerificationAccountTypeIsInvald: str VerificationAccountTypeNotSupported: str + class Options: UpdateExistingTokenIsInvalid: str UpdateExistingTokenNotAllowed: str @@ -124,6 +129,7 @@ class ErrorCodes: VerificationMerchantAccountIsForbidden: str VerificationMerchantAccountIsSuspended: str VerificationMerchantAccountCannotBeSubMerchantAccount: str + class Customer: CompanyIsTooLong: str CustomFieldIsInvalid: str @@ -145,6 +151,7 @@ class ErrorCodes: WebsiteIsInvalid: str WebsiteFormatIsInvalid: str WebsiteIsTooLong: str + class Descriptor: DynamicDescriptorsDisabled: str InternationalNameFormatIsInvalid: str @@ -152,6 +159,7 @@ class ErrorCodes: NameFormatIsInvalid: str PhoneFormatIsInvalid: str UrlFormatIsInvalid: str + class Dispute: CanOnlyAddEvidenceToOpenDispute: str CanOnlyRemoveEvidenceFromOpenDispute: str @@ -175,6 +183,7 @@ class ErrorCodes: RecurringTransactionEvidenceMissingDate: str RecurringTransactionEvidenceMissingARN: str ValidEvidenceRequiredToFinalize: str + class DocumentUpload: KindIsInvalid: str FileIsTooLarge: str @@ -182,6 +191,7 @@ class ErrorCodes: FileIsMalformedOrEncrypted: str FileIsTooLong: str FileIsEmpty: str + class Merchant: CountryCannotBeBlank: str CountryCodeAlpha2IsInvalid: str @@ -203,6 +213,7 @@ class ErrorCodes: CurrencyIsInvalid: str NoMerchantAccounts: str MerchantAccountExistsForId: str + class MerchantAccount: IdFormatIsInvalid: str IdIsInUse: str @@ -221,6 +232,7 @@ class ErrorCodes: DeclinedFailedKYC: str DeclinedSsnInvalid: str DeclinedSsnMatchesDeceased: str + class ApplicantDetails: AccountNumberIsRequired: str CompanyNameIsInvalid: str @@ -247,6 +259,7 @@ class ErrorCodes: EmailAddressIsRequired: str AccountNumberIsInvalid: str TaxIdMustBeBlank: str + class Address: LocalityIsRequired: str PostalCodeIsInvalid: str @@ -255,6 +268,7 @@ class ErrorCodes: StreetAddressIsInvalid: str StreetAddressIsRequired: str RegionIsInvalid: str + class Individual: FirstNameIsRequired: str LastNameIsRequired: str @@ -266,6 +280,7 @@ class ErrorCodes: PhoneIsInvalid: str DateOfBirthIsInvalid: str EmailAddressIsRequired: str + class Address: StreetAddressIsRequired: str LocalityIsRequired: str @@ -274,6 +289,7 @@ class ErrorCodes: StreetAddressIsInvalid: str PostalCodeIsInvalid: str RegionIsInvalid: str + class Business: DbaNameIsInvalid: str LegalNameIsInvalid: str @@ -281,10 +297,12 @@ class ErrorCodes: TaxIdIsInvalid: str TaxIdIsRequiredWithLegalName: str TaxIdMustBeBlank: str + class Address: StreetAddressIsInvalid: str PostalCodeIsInvalid: str RegionIsInvalid: str + class Funding: RoutingNumberIsRequired: str AccountNumberIsRequired: str @@ -296,12 +314,14 @@ class ErrorCodes: EmailAddressIsRequired: str MobilePhoneIsInvalid: str MobilePhoneIsRequired: str + class OAuth: InvalidGrant: str InvalidCredentials: str InvalidScope: str InvalidRequest: str UnsupportedGrantType: str + class Verification: ThreeDSecureAuthenticationIdIsInvalid: str ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication: str @@ -313,6 +333,7 @@ class ErrorCodes: MerchantAccountDoesNotSupport3DSecure: str MerchantAcountDoesNotMatch3DSecureMerchantAccount: str AmountDoesNotMatch3DSecureAmount: str + class ThreeDSecurePassThru: EciFlagIsRequired: str EciFlagIsInvalid: str @@ -322,6 +343,7 @@ class ErrorCodes: AuthenticationResponseIsInvalid: str DirectoryResponseIsInvalid: str CavvAlgorithmIsInvalid: str + class Options: AmountCannotBeNegative: str AmountFormatIsInvalid: str @@ -333,6 +355,7 @@ class ErrorCodes: MerchantAccountCannotBeSubMerchantAccount: str AccountTypeIsInvalid: str AccountTypeNotSupported: str + class PaymentMethod: CannotForwardPaymentMethodType: str PaymentMethodParamsAreRequired: str @@ -348,8 +371,10 @@ class ErrorCodes: CannotHaveFundingSourceWithoutAccessToken: str InvalidFundingSourceSelection: str CannotUpdatePayPalAccountUsingPaymentMethodNonce: str + class Options: UsBankAccountVerificationMethodIsInvalid: str + class PayPalAccount: CannotHaveBothAccessTokenAndConsentCode: str CannotVaultOneTimeUsePayPalAccount: str @@ -362,10 +387,12 @@ class ErrorCodes: PaymentMethodNonceLocked: str PaymentMethodNonceUnknown: str TokenIsInUse: str + class SettlementBatchSummary: CustomFieldIsInvalid: str SettlementDateIsInvalid: str SettlementDateIsRequired: str + class SEPAMandate: TypeIsRequired: str IBANInvalidCharacter: str @@ -377,10 +404,12 @@ class ErrorCodes: BillingAddressConflict: str BillingAddressIdIsInvalid: str TypeIsInvalid: str + class EuropeBankAccount: BICIsRequired: str IBANIsRequired: str AccountHolderNameIsRequired: str + class Subscription: BillingDayOfMonthCannotBeUpdated: str BillingDayOfMonthIsInvalid: str @@ -422,6 +451,7 @@ class ErrorCodes: TrialDurationFormatIsInvalid: str TrialDurationIsRequired: str TrialDurationUnitIsInvalid: str + class Modification: AmountCannotBeBlank: str AmountIsInvalid: str @@ -444,6 +474,7 @@ class ErrorCodes: QuantityIsInvalid: str QuantityMustBeGreaterThanZero: str IdToRemoveIsInvalid: str + class Transaction: AdjustmentAmountMustBeGreaterThanZero: str AmountCannotBeNegative: str @@ -586,24 +617,30 @@ class ErrorCodes: UnsupportedVoiceAuthorization: str UsBankAccountNonceMustBePlaidVerified: str UsBankAccountNotVerified: str + class ExternalVault: StatusIsInvalid: str StatusWithPreviousNetworkTransactionIdIsInvalid: str CardTypeIsInvalid: str PreviousNetworkTransactionIdIsInvalid: str + class Options: SubmitForSettlementIsRequiredForCloning: str SubmitForSettlementIsRequiredForPayPalUnilateral: str UseBillingForShippingDisabled: str VaultIsDisabled: str + class PayPal: CustomFieldTooLong: str + class CreditCard: AccountTypeIsInvalid: str AccountTypeNotSupported: str AccountTypeDebitDoesNotSupportAuths: str + class Industry: IndustryTypeIsInvalid: str + class Lodging: EmptyData: str FolioNumberIsInvalid: str @@ -621,6 +658,7 @@ class ErrorCodes: AdvancedDepositIndicatorIsInvalid: str FireSafetyIndicatorIsInvalid: str PropertyPhoneIsInvalid: str + class TravelCruise: EmptyData: str UnknownDataField: str @@ -628,6 +666,7 @@ class ErrorCodes: DepartureDateIsInvalid: str LodgingCheckInDateIsInvalid: str LodgingCheckOutDateIsInvalid: str + class TravelFlight: EmptyData: str UnknownDataField: str @@ -648,6 +687,7 @@ class ErrorCodes: TicketNumberIsTooLong: str LegsExpected: str TooManyLegs: str + class Leg: class TravelFlight: ArrivalAirportCodeIsTooLong: str @@ -670,6 +710,7 @@ class ErrorCodes: TaxAmountFormatIsInvalid: str TaxAmountIsTooLarge: str TicketNumberIsTooLong: str + class AdditionalCharge: KindIsInvalid: str KindMustBeUnique: str @@ -677,6 +718,7 @@ class ErrorCodes: AmountFormatIsInvalid: str AmountIsTooLarge: str AmountIsRequired: str + class LineItem: CommodityCodeIsTooLong: str DescriptionIsTooLong: str @@ -706,6 +748,7 @@ class ErrorCodes: TaxAmountFormatIsInvalid: str TaxAmountIsTooLarge: str TaxAmountCannotBeNegative: str + class UsBankAccountVerification: NotConfirmable: str MustBeMicroTransfersVerification: str @@ -713,6 +756,7 @@ class ErrorCodes: TooManyConfirmationAttempts: str UnableToConfirmDepositAmounts: str InvalidDepositAmounts: str + class RiskData: CustomerBrowserIsTooLong: str CustomerDeviceIdIsTooLong: str diff --git a/stubs/braintree/braintree/merchant_account/merchant_account.pyi b/stubs/braintree/braintree/merchant_account/merchant_account.pyi index 4bdb762..44729c2 100644 --- a/stubs/braintree/braintree/merchant_account/merchant_account.pyi +++ b/stubs/braintree/braintree/merchant_account/merchant_account.pyi @@ -13,6 +13,7 @@ class MerchantAccount(Resource): Active: str Pending: str Suspended: str + class FundingDestination: Bank: str Email: str diff --git a/stubs/braintree/braintree/risk_data.pyi b/stubs/braintree/braintree/risk_data.pyi index b0b1c61..68f5de0 100644 --- a/stubs/braintree/braintree/risk_data.pyi +++ b/stubs/braintree/braintree/risk_data.pyi @@ -1,3 +1,6 @@ +from _typeshed import Incomplete + from braintree.attribute_getter import AttributeGetter as AttributeGetter -class RiskData(AttributeGetter): ... +class RiskData(AttributeGetter): + def __init__(self, attributes: Incomplete) -> None: ... diff --git a/stubs/braintree/braintree/search.pyi b/stubs/braintree/braintree/search.pyi index a9449ff..14257a8 100644 --- a/stubs/braintree/braintree/search.pyi +++ b/stubs/braintree/braintree/search.pyi @@ -6,9 +6,11 @@ class Search: def __init__(self, name) -> None: ... def __eq__(self, value): ... def is_equal(self, value): ... + class EqualityNodeBuilder(IsNodeBuilder): def __ne__(self, value): ... def is_not_equal(self, value): ... + class KeyValueNodeBuilder: name: Any def __init__(self, name) -> None: ... @@ -16,28 +18,35 @@ class Search: def is_equal(self, value): ... def __ne__(self, value): ... def is_not_equal(self, value): ... + class PartialMatchNodeBuilder(EqualityNodeBuilder): def starts_with(self, value): ... def ends_with(self, value): ... + class EndsWithNodeBuilder: name: Any def __init__(self, name) -> None: ... def ends_with(self, value): ... + class TextNodeBuilder(PartialMatchNodeBuilder): def contains(self, value): ... + class Node: name: Any dict: Any def __init__(self, name, dict) -> None: ... def to_param(self): ... + class MultipleValueNodeBuilder: name: Any whitelist: Any def __init__(self, name, whitelist=...) -> None: ... def in_list(self, *values): ... def __eq__(self, value): ... + class MultipleValueOrTextNodeBuilder(TextNodeBuilder, MultipleValueNodeBuilder): def __init__(self, name, whitelist=...) -> None: ... + class RangeNodeBuilder: name: Any def __init__(self, name) -> None: ... diff --git a/stubs/braintree/braintree/subscription.pyi b/stubs/braintree/braintree/subscription.pyi index 33aa2bc..7819c09 100644 --- a/stubs/braintree/braintree/subscription.pyi +++ b/stubs/braintree/braintree/subscription.pyi @@ -17,10 +17,12 @@ class Subscription(Resource): class TrialDurationUnit: Day: str Month: str + class Source: Api: str ControlPanel: str Recurring: str + class Status: Active: str Canceled: str diff --git a/stubs/braintree/braintree/transaction.pyi b/stubs/braintree/braintree/transaction.pyi index 59cee2f..c89b670 100644 --- a/stubs/braintree/braintree/transaction.pyi +++ b/stubs/braintree/braintree/transaction.pyi @@ -40,6 +40,7 @@ class Transaction(Resource): class CreatedUsing: FullInformation: str Token: str + class GatewayRejectionReason: ApplicationIncomplete: str Avs: str @@ -50,16 +51,19 @@ class Transaction(Resource): RiskThreshold: str ThreeDSecure: str TokenIssuance: str + class Source: Api: str ControlPanel: str Recurring: str + class EscrowStatus: HoldPending: str Held: str ReleasePending: str Released: str Refunded: str + class Status: AuthorizationExpired: str Authorized: str @@ -75,13 +79,16 @@ class Transaction(Resource): Settling: str SubmittedForSettlement: str Voided: str + class Type: Credit: str Sale: str + class IndustryType: Lodging: str TravelAndCruise: str TravelAndFlight: str + class AdditionalCharge: Restaurant: str GiftShop: str diff --git a/stubs/braintree/braintree/us_bank_account_verification.pyi b/stubs/braintree/braintree/us_bank_account_verification.pyi index cf4bd42..517d5ec 100644 --- a/stubs/braintree/braintree/us_bank_account_verification.pyi +++ b/stubs/braintree/braintree/us_bank_account_verification.pyi @@ -11,6 +11,7 @@ class UsBankAccountVerification(AttributeGetter): Unrecognized: str Verified: str Pending: str + class VerificationMethod: NetworkCheck: str IndependentCheck: str diff --git a/stubs/cachetools/@tests/stubtest_allowlist.txt b/stubs/cachetools/@tests/stubtest_allowlist.txt index 878cbad..077ad45 100644 --- a/stubs/cachetools/@tests/stubtest_allowlist.txt +++ b/stubs/cachetools/@tests/stubtest_allowlist.txt @@ -1,2 +1,22 @@ cachetools.Cache.get -cachetools.cache.Cache.get + +# stubs omit defaulted arguments that are meant to be optimizations, not provided by user +cachetools.FIFOCache.__delitem__ +cachetools.FIFOCache.__setitem__ +cachetools.LFUCache.__delitem__ +cachetools.LFUCache.__getitem__ +cachetools.LFUCache.__setitem__ +cachetools.LRUCache.__delitem__ +cachetools.LRUCache.__getitem__ +cachetools.LRUCache.__setitem__ +cachetools.MRUCache.__delitem__ +cachetools.MRUCache.__getitem__ +cachetools.MRUCache.__setitem__ +cachetools.TLRUCache.__delitem__ +cachetools.TLRUCache.__getitem__ +cachetools.TLRUCache.__setitem__ +cachetools.TTLCache.__delitem__ +cachetools.TTLCache.__getitem__ +cachetools.TTLCache.__setitem__ +cachetools._TimedCache.__len__ +cachetools._TimedCache.__repr__ diff --git a/stubs/cachetools/METADATA.toml b/stubs/cachetools/METADATA.toml index de72097..afc1fcf 100644 --- a/stubs/cachetools/METADATA.toml +++ b/stubs/cachetools/METADATA.toml @@ -1 +1,4 @@ -version = "4.2" +version = "5.2.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/cachetools/cachetools/__init__.pyi b/stubs/cachetools/cachetools/__init__.pyi index 927aa8f..eea24f3 100644 --- a/stubs/cachetools/cachetools/__init__.pyi +++ b/stubs/cachetools/cachetools/__init__.pyi @@ -1,17 +1,31 @@ from _typeshed import IdentityFunction -from collections.abc import Iterator, Sequence -from typing import Any, Callable, ContextManager, Generic, MutableMapping, TypeVar +from collections.abc import Callable, Iterator, MutableMapping, Sequence +from contextlib import AbstractContextManager +from typing import Any, Generic, TypeVar, overload + +__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "MRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod") +__version__: str _KT = TypeVar("_KT") _VT = TypeVar("_VT") +_T = TypeVar("_T") class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]): - def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ... + @overload + def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float]) -> None: ... + @overload + def __init__(self, maxsize: float, getsizeof: None = ...) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... def __delitem__(self, key: _KT) -> None: ... + def __missing__(self, key: _KT) -> _VT: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... + @overload # type: ignore[override] + def pop(self, key: _KT) -> _VT: ... + @overload + def pop(self, key: _KT, default: _VT | _T) -> _VT | _T: ... + def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ... @property def maxsize(self) -> float: ... @property @@ -19,40 +33,74 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]): @staticmethod def getsizeof(value: _VT) -> float: ... -class FIFOCache(Cache[_KT, _VT]): - def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ... +class FIFOCache(Cache[_KT, _VT]): ... +class LFUCache(Cache[_KT, _VT]): ... +class LRUCache(Cache[_KT, _VT]): ... +class MRUCache(Cache[_KT, _VT]): ... -class LFUCache(Cache[_KT, _VT]): - def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ... +class RRCache(Cache[_KT, _VT]): + @overload + def __init__(self, maxsize: float, choice: None = ..., getsizeof: None = ...) -> None: ... + @overload + def __init__(self, maxsize: float, *, getsizeof: Callable[[_VT], float]) -> None: ... + @overload + def __init__(self, maxsize: float, choice: None, getsizeof: Callable[[_VT], float]) -> None: ... + @overload + def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: None = ...) -> None: ... + @overload + def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: Callable[[_VT], float]) -> None: ... + @property + def choice(self) -> Callable[[Sequence[_KT]], _KT]: ... -class LRUCache(Cache[_KT, _VT]): - def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ... +class _TimedCache(Cache[_KT, _VT]): + @overload + def __init__(self, maxsize: float, timer: Callable[[], float] = ..., getsizeof: None = ...) -> None: ... + @overload + def __init__(self, maxsize: float, timer: Callable[[], float], getsizeof: Callable[[_VT], float]) -> None: ... + @overload + def __init__(self, maxsize: float, timer: Callable[[], float] = ..., *, getsizeof: Callable[[_VT], float]) -> None: ... + @property + def currsize(self) -> float: ... -class MRUCache(Cache[_KT, _VT]): - def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ... + class _Timer: + def __init__(self, timer: Callable[[], float]) -> None: ... + def __call__(self) -> float: ... + def __enter__(self) -> float: ... + def __exit__(self, *exc: object) -> None: ... -class RRCache(Cache[_KT, _VT]): + @property + def timer(self) -> _Timer: ... + +class TTLCache(_TimedCache[_KT, _VT]): + @overload + def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: None = ...) -> None: ... + @overload + def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float], getsizeof: Callable[[_VT], float]) -> None: ... + @overload def __init__( - self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT] | None = ..., getsizeof: Callable[[_VT], float] | None = ... + self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., *, getsizeof: Callable[[_VT], float] ) -> None: ... @property - def choice(self) -> Callable[[Sequence[_KT]], _KT]: ... + def ttl(self) -> float: ... + def expire(self, time: float | None = ...) -> None: ... -class TTLCache(Cache[_KT, _VT]): +class TLRUCache(_TimedCache[_KT, _VT]): def __init__( - self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: Callable[[_VT], float] | None = ... + self, + maxsize: float, + ttu: Callable[[_KT, _VT, float], float], + timer: Callable[[], float] = ..., + getsizeof: Callable[[_VT], float] | None = ..., ) -> None: ... @property - def currsize(self) -> float: ... - @property - def timer(self) -> Callable[[], float]: ... - @property - def ttl(self) -> float: ... + def ttu(self) -> Callable[[_KT, _VT, float], float]: ... def expire(self, time: float | None = ...) -> None: ... def cached( - cache: MutableMapping[_KT, Any] | None, key: Callable[..., _KT] = ..., lock: ContextManager[Any] | None = ... + cache: MutableMapping[_KT, Any] | None, key: Callable[..., _KT] = ..., lock: AbstractContextManager[Any] | None = ... ) -> IdentityFunction: ... def cachedmethod( - cache: Callable[[Any], MutableMapping[_KT, Any] | None], key: Callable[..., _KT] = ..., lock: ContextManager[Any] | None = ... + cache: Callable[[Any], MutableMapping[_KT, Any] | None], + key: Callable[..., _KT] = ..., + lock: Callable[[Any], AbstractContextManager[Any]] | None = ..., ) -> IdentityFunction: ... diff --git a/stubs/cachetools/cachetools/cache.pyi b/stubs/cachetools/cachetools/cache.pyi deleted file mode 100644 index a9bd3f7..0000000 --- a/stubs/cachetools/cachetools/cache.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import Cache as Cache diff --git a/stubs/cachetools/cachetools/fifo.pyi b/stubs/cachetools/cachetools/fifo.pyi deleted file mode 100644 index c6b386a..0000000 --- a/stubs/cachetools/cachetools/fifo.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import FIFOCache as FIFOCache diff --git a/stubs/cachetools/cachetools/func.pyi b/stubs/cachetools/cachetools/func.pyi index d081d51..4d22384 100644 --- a/stubs/cachetools/cachetools/func.pyi +++ b/stubs/cachetools/cachetools/func.pyi @@ -1,13 +1,17 @@ from _typeshed import IdentityFunction -from typing import Callable, Sequence, TypeVar +from collections.abc import Callable, Sequence +from typing import TypeVar +__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "mru_cache", "rr_cache", "ttl_cache") _T = TypeVar("_T") -def fifo_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ... -def lfu_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ... -def lru_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ... -def mru_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ... -def rr_cache(maxsize: float = ..., choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = ...) -> IdentityFunction: ... +def fifo_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ... +def lfu_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ... +def lru_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ... +def mru_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ... +def rr_cache( + maxsize: float | None = ..., choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = ... +) -> IdentityFunction: ... def ttl_cache( - maxsize: float = ..., ttl: float = ..., timer: Callable[[], float] = ..., typed: bool = ... + maxsize: float | None = ..., ttl: float = ..., timer: Callable[[], float] = ..., typed: bool = ... ) -> IdentityFunction: ... diff --git a/stubs/cachetools/cachetools/keys.pyi b/stubs/cachetools/cachetools/keys.pyi index 9effbe6..497bc18 100644 --- a/stubs/cachetools/cachetools/keys.pyi +++ b/stubs/cachetools/cachetools/keys.pyi @@ -1,4 +1,7 @@ -from typing import Hashable, Tuple +from collections.abc import Hashable -def hashkey(*args: Hashable, **kwargs: Hashable) -> Tuple[Hashable, ...]: ... -def typedkey(*args: Hashable, **kwargs: Hashable) -> Tuple[Hashable, ...]: ... +__all__ = ("hashkey", "methodkey", "typedkey") + +def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... +def methodkey(self: object, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... +def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... diff --git a/stubs/cachetools/cachetools/lfu.pyi b/stubs/cachetools/cachetools/lfu.pyi deleted file mode 100644 index 9951e65..0000000 --- a/stubs/cachetools/cachetools/lfu.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import LFUCache as LFUCache diff --git a/stubs/cachetools/cachetools/lru.pyi b/stubs/cachetools/cachetools/lru.pyi deleted file mode 100644 index 4ea2d64..0000000 --- a/stubs/cachetools/cachetools/lru.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import LRUCache as LRUCache diff --git a/stubs/cachetools/cachetools/mru.pyi b/stubs/cachetools/cachetools/mru.pyi deleted file mode 100644 index b345f52..0000000 --- a/stubs/cachetools/cachetools/mru.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import MRUCache as MRUCache diff --git a/stubs/cachetools/cachetools/rr.pyi b/stubs/cachetools/cachetools/rr.pyi deleted file mode 100644 index 18e2098..0000000 --- a/stubs/cachetools/cachetools/rr.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import RRCache as RRCache diff --git a/stubs/cachetools/cachetools/ttl.pyi b/stubs/cachetools/cachetools/ttl.pyi deleted file mode 100644 index aee0585..0000000 --- a/stubs/cachetools/cachetools/ttl.pyi +++ /dev/null @@ -1,2 +0,0 @@ -# this module is deprecated -from . import TTLCache as TTLCache diff --git a/stubs/caldav/@tests/stubtest_allowlist.txt b/stubs/caldav/@tests/stubtest_allowlist.txt index 4520447..293f7da 100644 --- a/stubs/caldav/@tests/stubtest_allowlist.txt +++ b/stubs/caldav/@tests/stubtest_allowlist.txt @@ -4,7 +4,7 @@ caldav.DAVClient.principal caldav.davclient.DAVClient.calendar caldav.davclient.DAVClient.principal -# Initialized in class, but immediatly overwritten in __init__ +# Initialized in class, but immediately overwritten in __init__ caldav.DAVClient.url caldav.davclient.DAVClient.url caldav.davclient.DAVResponse.headers diff --git a/stubs/caldav/METADATA.toml b/stubs/caldav/METADATA.toml index 50463ee..7da23f6 100644 --- a/stubs/caldav/METADATA.toml +++ b/stubs/caldav/METADATA.toml @@ -1,3 +1,3 @@ -version = "0.8" +version = "0.10.*" # also types-lxml and types-icalendar when those stubs are added requires = ["types-requests", "types-vobject"] diff --git a/stubs/caldav/caldav/davclient.pyi b/stubs/caldav/caldav/davclient.pyi index 6689f23..ab99a10 100644 --- a/stubs/caldav/caldav/davclient.pyi +++ b/stubs/caldav/caldav/davclient.pyi @@ -1,15 +1,18 @@ +from _typeshed import Self from collections.abc import Iterable, Mapping from typing import Any +from typing_extensions import TypeAlias from urllib.parse import ParseResult, SplitResult from requests.auth import AuthBase from requests.models import Response +from requests.sessions import _Timeout from requests.structures import CaseInsensitiveDict from .lib.url import URL from .objects import Calendar, DAVObject, Principal -_Element = Any # actually lxml.etree._Element +_Element: TypeAlias = Any # actually lxml.etree._Element class DAVResponse: reason: str @@ -33,6 +36,7 @@ class DAVClient: username: str | None password: str | None auth: AuthBase | None + timeout: _Timeout | None ssl_verify_cert: bool | str ssl_cert: str | tuple[str, str] | None def __init__( @@ -42,9 +46,12 @@ class DAVClient: username: str | None = ..., password: str | None = ..., auth: AuthBase | None = ..., + timeout: _Timeout | None = ..., ssl_verify_cert: bool | str = ..., ssl_cert: str | tuple[str, str] | None = ..., ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... def principal(self, *, url: str | ParseResult | SplitResult | URL | None = ...) -> Principal: ... def calendar( self, diff --git a/stubs/caldav/caldav/elements/base.pyi b/stubs/caldav/caldav/elements/base.pyi index c418e0c..264c1c7 100644 --- a/stubs/caldav/caldav/elements/base.pyi +++ b/stubs/caldav/caldav/elements/base.pyi @@ -1,8 +1,9 @@ from _typeshed import Self from collections.abc import Iterable from typing import Any, ClassVar +from typing_extensions import TypeAlias -_Element = Any # actually lxml.etree._Element +_Element: TypeAlias = Any # actually lxml.etree._Element class BaseElement: tag: ClassVar[str | None] diff --git a/stubs/caldav/caldav/lib/error.pyi b/stubs/caldav/caldav/lib/error.pyi index 7e3ed16..66de08c 100644 --- a/stubs/caldav/caldav/lib/error.pyi +++ b/stubs/caldav/caldav/lib/error.pyi @@ -1,14 +1,13 @@ -from typing import Any, Type - def assert_(condition: object) -> None: ... ERR_FRAGMENT: str -class AuthorizationError(Exception): - url: Any +class DAVError(Exception): + url: str | None reason: str + def __init__(self, url: str | None = ..., reason: str | None = ...) -> None: ... -class DAVError(Exception): ... +class AuthorizationError(DAVError): ... class PropsetError(DAVError): ... class ProppatchError(DAVError): ... class PropfindError(DAVError): ... @@ -19,6 +18,6 @@ class PutError(DAVError): ... class DeleteError(DAVError): ... class NotFoundError(DAVError): ... class ConsistencyError(DAVError): ... -class ReponseError(DAVError): ... +class ResponseError(DAVError): ... -exception_by_method: dict[str, Type[DAVError]] +exception_by_method: dict[str, type[DAVError]] diff --git a/stubs/caldav/caldav/objects.pyi b/stubs/caldav/caldav/objects.pyi index 6f2f94f..c877890 100644 --- a/stubs/caldav/caldav/objects.pyi +++ b/stubs/caldav/caldav/objects.pyi @@ -1,19 +1,20 @@ import datetime -from _typeshed import Self -from collections.abc import Iterable, Iterator, Mapping -from typing import Any, Type, TypeVar, overload -from typing_extensions import Literal +from _typeshed import Incomplete, Self +from collections.abc import Iterable, Iterator, Mapping, Sequence +from typing import Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias from urllib.parse import ParseResult, SplitResult from vobject.base import VBase from .davclient import DAVClient -from .elements.cdav import CompFilter, ScheduleInboxURL, ScheduleOutboxURL +from .elements.cdav import CalendarQuery, CompFilter, ScheduleInboxURL, ScheduleOutboxURL from .lib.url import URL _CC = TypeVar("_CC", bound=CalendarObjectResource) - -_vCalAddress = Any # actually icalendar.vCalAddress +# Actually "type[Todo] | type[Event] | type[Journal]", but mypy doesn't like that. +_CompClass: TypeAlias = type[CalendarObjectResource] +_VCalAddress: TypeAlias = Any # actually icalendar.vCalAddress class DAVObject: id: str | None @@ -58,7 +59,7 @@ class Principal(DAVObject): self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Any | None = ... ) -> Calendar: ... def calendar(self, name: str | None = ..., cal_id: str | None = ...) -> Calendar: ... - def get_vcal_address(self) -> _vCalAddress: ... + def get_vcal_address(self) -> _VCalAddress: ... calendar_home_set: CalendarSet # can also be set to anything URL.objectify() accepts def freebusy_request(self, dtstart, dtend, attendees): ... def calendar_user_address_set(self) -> list[str]: ... @@ -68,9 +69,11 @@ class Principal(DAVObject): class Calendar(DAVObject): def get_supported_components(self) -> list[Any]: ... def save_with_invites(self, ical: str, attendees, **attendeeoptions) -> None: ... - def save_event(self, ical: str, no_overwrite: bool = ..., no_create: bool = ...) -> Event: ... - def save_todo(self, ical: str, no_overwrite: bool = ..., no_create: bool = ...) -> Todo: ... - def save_journal(self, ical: str, no_overwrite: bool = ..., no_create: bool = ...) -> Journal: ... + def save_event(self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Any) -> Event: ... + def save_todo(self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Any) -> Todo: ... + def save_journal( + self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Any + ) -> Journal: ... add_event = save_event add_todo = save_todo add_journal = save_journal @@ -89,23 +92,77 @@ class Calendar(DAVObject): end: datetime.datetime | None = ..., compfilter: Literal["VEVENT"] = ..., expand: bool | Literal["maybe"] = ..., + verify_expand: bool = ..., ) -> list[Event]: ... @overload def date_search( - self, start: datetime.datetime, *, compfilter: None, expand: bool | Literal["maybe"] = ... + self, start: datetime.datetime, *, compfilter: None, expand: bool | Literal["maybe"] = ..., verify_expand: bool = ... ) -> list[CalendarObjectResource]: ... @overload def date_search( - self, start: datetime.datetime, end: datetime.datetime | None, compfilter: None, expand: bool | Literal["maybe"] = ... + self, + start: datetime.datetime, + end: datetime.datetime | None, + compfilter: None, + expand: bool | Literal["maybe"] = ..., + verify_expand: bool = ..., ) -> list[CalendarObjectResource]: ... @overload - def search(self, xml, comp_class: None = ...) -> list[CalendarObjectResource]: ... + def search( + self, + xml: None = ..., + comp_class: None = ..., + todo: bool | None = ..., + include_completed: bool = ..., + sort_keys: Sequence[str] = ..., + **kwargs, + ) -> list[CalendarObjectResource]: ... @overload - def search(self, xml, comp_class: Type[_CC]) -> list[_CC]: ... + def search( + self, + xml, + comp_class: type[_CC], + todo: bool | None = ..., + include_completed: bool = ..., + sort_keys: Sequence[str] = ..., + **kwargs, + ) -> list[_CC]: ... + @overload + def search( + self, + *, + comp_class: type[_CC], + todo: bool | None = ..., + include_completed: bool = ..., + sort_keys: Sequence[str] = ..., + **kwargs, + ) -> list[_CC]: ... + def build_search_xml_query( + self, + comp_class: _CompClass | None = ..., + todo: bool | None = ..., + ignore_completed1: bool | None = ..., + ignore_completed2: bool | None = ..., + ignore_completed3: bool | None = ..., + event: bool | None = ..., + category: Incomplete | None = ..., + class_: Incomplete | None = ..., + filters: list[Incomplete] | None = ..., + expand: bool | None = ..., + start: datetime.datetime | None = ..., + end: datetime.datetime | None = ..., + *, + uid=..., + summary=..., + comment=..., + description=..., + location=..., + status=..., + ) -> tuple[CalendarQuery, _CompClass]: ... def freebusy_request(self, start: datetime.datetime, end: datetime.datetime) -> FreeBusy: ... def todos(self, sort_keys: Iterable[str] = ..., include_completed: bool = ..., sort_key: str | None = ...) -> list[Todo]: ... def event_by_url(self, href, data: Any | None = ...) -> Event: ... - def object_by_uid(self, uid: str, comp_filter: CompFilter | None = ...) -> Event: ... + def object_by_uid(self, uid: str, comp_filter: CompFilter | None = ..., comp_class: _CompClass | None = ...) -> Event: ... def todo_by_uid(self, uid: str) -> CalendarObjectResource: ... def event_by_uid(self, uid: str) -> CalendarObjectResource: ... def journal_by_uid(self, uid: str) -> CalendarObjectResource: ... @@ -158,7 +215,12 @@ class CalendarObjectResource(DAVObject): def load(self: Self) -> Self: ... def change_attendee_status(self, attendee: Any | None = ..., **kwargs) -> None: ... def save( - self: Self, no_overwrite: bool = ..., no_create: bool = ..., obj_type: Any | None = ..., if_schedule_tag_match: bool = ... + self: Self, + no_overwrite: bool = ..., + no_create: bool = ..., + obj_type: str | None = ..., + increase_seqno: bool = ..., + if_schedule_tag_match: bool = ..., ) -> Self: ... data: Any vobject_instance: VBase @@ -172,4 +234,9 @@ class FreeBusy(CalendarObjectResource): def __init__(self, parent, data, url: str | ParseResult | SplitResult | URL | None = ..., id: Any | None = ...) -> None: ... class Todo(CalendarObjectResource): - def complete(self, completion_timestamp: datetime.datetime | None = ...) -> None: ... + def complete( + self, + completion_timestamp: datetime.datetime | None = ..., + handle_rrule: bool = ..., + rrule_mode: Literal["safe", "this_and_future"] = ..., + ) -> None: ... diff --git a/stubs/certifi/METADATA.toml b/stubs/certifi/METADATA.toml index 3f3b249..a6f1f0a 100644 --- a/stubs/certifi/METADATA.toml +++ b/stubs/certifi/METADATA.toml @@ -1,2 +1,2 @@ -version = "2020.4" -python2 = true +version = "2021.10.8" +obsolete_since = "2022.5.18.1" diff --git a/stubs/cffi/@tests/stubtest_allowlist.txt b/stubs/cffi/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..8884550 --- /dev/null +++ b/stubs/cffi/@tests/stubtest_allowlist.txt @@ -0,0 +1,14 @@ +# technically exists on all OSs, but crashes on all but windows +cffi.(api.)?FFI.getwinerror + +# added dynamically and not detected by stubtest +cffi.(api.)?FFI.CData +cffi.(api.)?FFI.CType +cffi.(api.)?FFI.buffer + +# Exists at runtime, but missing from stubs +cffi.vengine_cpy.__warningregistry__ + +# Unnecessary re-exports +cffi.cparser.COMMON_TYPES +cffi.verifier.__version_verifier_modules__ \ No newline at end of file diff --git a/stubs/cffi/METADATA.toml b/stubs/cffi/METADATA.toml new file mode 100644 index 0000000..0857c78 --- /dev/null +++ b/stubs/cffi/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.15.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/cffi/_cffi_backend.pyi b/stubs/cffi/_cffi_backend.pyi new file mode 100644 index 0000000..31dd329 --- /dev/null +++ b/stubs/cffi/_cffi_backend.pyi @@ -0,0 +1,265 @@ +import sys +import types +from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer +from collections.abc import Callable, Hashable +from typing import Any, ClassVar, Protocol, TypeVar, overload +from typing_extensions import Literal, TypeAlias, final + +_T = TypeVar("_T") + +class _Allocator(Protocol): + def __call__(self, cdecl: str | CType, init: Any = ...) -> _CDataBase: ... + +__version__: str + +FFI_CDECL: int +FFI_DEFAULT_ABI: int +RTLD_GLOBAL: int +RTLD_LAZY: int +RTLD_LOCAL: int +RTLD_NOW: int +if sys.platform != "win32": + RTLD_DEEPBIND: int + RTLD_NODELETE: int + RTLD_NOLOAD: int + +@final +class CField: + bitshift: Incomplete + bitsize: Incomplete + flags: Incomplete + offset: Incomplete + type: Incomplete + +@final +class CLibrary: + def close_lib(self, *args, **kwargs): ... + def load_function(self, *args, **kwargs): ... + def read_variable(self, *args, **kwargs): ... + def write_variable(self, *args, **kwargs): ... + +@final +class CType: + abi: Incomplete + args: Incomplete + cname: Incomplete + elements: Incomplete + ellipsis: Incomplete + fields: Incomplete + item: Incomplete + kind: Incomplete + length: Incomplete + relements: Incomplete + result: Incomplete + def __dir__(self): ... + +@final +class Lib: + def __dir__(self): ... + +@final +class _CDataBase: + __name__: ClassVar[str] + def __add__(self, other): ... + def __bool__(self): ... + def __call__(self, *args, **kwargs): ... + def __complex__(self): ... + def __delitem__(self, other): ... + def __dir__(self): ... + def __enter__(self): ... + def __eq__(self, other): ... + def __exit__(self, type, value, traceback): ... + def __float__(self): ... + def __ge__(self, other): ... + def __getitem__(self, index): ... + def __gt__(self, other): ... + def __hash__(self): ... + def __int__(self): ... + def __iter__(self): ... + def __le__(self, other): ... + def __len__(self): ... + def __lt__(self, other): ... + def __ne__(self, other): ... + def __radd__(self, other): ... + def __rsub__(self, other): ... + def __setitem__(self, index, object): ... + def __sub__(self, other): ... + +@final +class buffer: + __hash__: ClassVar[None] # type: ignore[assignment] + def __init__(self, *args, **kwargs) -> None: ... + def __delitem__(self, other): ... + def __eq__(self, other): ... + def __ge__(self, other): ... + def __getitem__(self, index): ... + def __gt__(self, other): ... + def __le__(self, other): ... + def __len__(self): ... + def __lt__(self, other): ... + def __ne__(self, other): ... + def __setitem__(self, index, object): ... + +# These aliases are to work around pyright complaints. +# Pyright doesn't like it when a class object is defined as an alias +# of a global object with the same name. +_tmp_CType = CType +_tmp_buffer = buffer + +class FFI: + CData: TypeAlias = _CDataBase + CType: TypeAlias = _tmp_CType + buffer: TypeAlias = _tmp_buffer # noqa: Y042 + + class error(Exception): ... + NULL: ClassVar[CData] + RTLD_GLOBAL: ClassVar[int] + RTLD_LAZY: ClassVar[int] + RTLD_LOCAL: ClassVar[int] + RTLD_NOW: ClassVar[int] + if sys.platform != "win32": + RTLD_DEEPBIND: ClassVar[int] + RTLD_NODELETE: ClassVar[int] + RTLD_NOLOAD: ClassVar[int] + + errno: int + + def __init__( + self, + module_name: str = ..., + _version: int = ..., + _types: str = ..., + _globals: tuple[str | int, ...] = ..., + _struct_unions: tuple[tuple[str, ...], ...] = ..., + _enums: tuple[str, ...] = ..., + _typenames: tuple[str, ...] = ..., + _includes: tuple[FFI, ...] = ..., + ) -> None: ... + @overload + def addressof(self, __cdata: CData, *field_or_index: str | int) -> CData: ... + @overload + def addressof(self, __library: Lib, __name: str) -> CData: ... + def alignof(self, __cdecl: str | CType | CData) -> int: ... + @overload + def callback( + self, + cdecl: str | CType, + python_callable: None = ..., + error: Any = ..., + onerror: Callable[[Exception, Any, Any], None] | None = ..., + ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + @overload + def callback( + self, + cdecl: str | CType, + python_callable: Callable[..., _T], + error: Any = ..., + onerror: Callable[[Exception, Any, Any], None] | None = ..., + ) -> Callable[..., _T]: ... + def cast(self, cdecl: str | CType, value: CData) -> CData: ... + def def_extern( + self, name: str = ..., error: Any = ..., onerror: Callable[[Exception, Any, types.TracebackType], Any] = ... + ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def dlclose(self, __lib: Lib) -> None: ... + if sys.platform == "win32": + def dlopen(self, __libpath: str | CData, __flags: int = ...) -> Lib: ... + else: + def dlopen(self, __libpath: str | CData | None = ..., __flags: int = ...) -> Lib: ... + + @overload + def from_buffer(self, cdecl: ReadableBuffer, require_writable: Literal[False] = ...) -> CData: ... + @overload + def from_buffer(self, cdecl: WriteableBuffer, require_writable: Literal[True]) -> CData: ... + @overload + def from_buffer(self, cdecl: str | CType, python_buffer: ReadableBuffer, require_writable: Literal[False] = ...) -> CData: ... + @overload + def from_buffer(self, cdecl: str | CType, python_buffer: WriteableBuffer, require_writable: Literal[True]) -> CData: ... + def from_handle(self, __x: CData) -> Any: ... + @overload + def gc(self, cdata: CData, destructor: Callable[[CData], Any], size: int = ...) -> CData: ... + @overload + def gc(self, cdata: CData, destructor: None, size: int = ...) -> None: ... + def getctype(self, cdecl: str | CType, replace_with: str = ...) -> str: ... + if sys.platform == "win32": + def getwinerror(self, code: int = ...) -> tuple[int, str]: ... + + def init_once(self, func: Callable[[], Any], tag: Hashable) -> Any: ... + def integer_const(self, name: str) -> int: ... + def list_types(self) -> tuple[list[str], list[str], list[str]]: ... + def memmove(self, dest: CData | WriteableBuffer, src: CData | ReadableBuffer, n: int) -> None: ... + def new(self, cdecl: str | CType, init: Any = ...) -> CData: ... + @overload + def new_allocator(self, alloc: None = ..., free: None = ..., should_clear_after_alloc: bool = ...) -> _Allocator: ... + @overload + def new_allocator( + self, alloc: Callable[[int], CData], free: None = ..., should_clear_after_alloc: bool = ... + ) -> _Allocator: ... + @overload + def new_allocator( + self, alloc: Callable[[int], CData], free: Callable[[CData], Any], should_clear_after_alloc: bool = ... + ) -> _Allocator: ... + def new_handle(self, __x: Any) -> CData: ... + def offsetof(self, __cdecl: str | CType, __field_or_index: str | int, *__fields_or_indexes: str | int) -> int: ... + def release(self, __cdata: CData) -> None: ... + def sizeof(self, __cdecl: str | CType | CData) -> int: ... + def string(self, cdata: CData, maxlen: int) -> bytes | str: ... + def typeof(self, cdecl: str | CData) -> CType: ... + def unpack(self, cdata: CData, length: int) -> bytes | str | list[Any]: ... + +def alignof(__cdecl: CType) -> int: ... +def callback( + __cdecl: CType, + __python_callable: Callable[..., _T], + __error: Any = ..., + __onerror: Callable[[Exception, Any, Any], None] | None = ..., +) -> Callable[..., _T]: ... +def cast(__cdecl: CType, __value: _CDataBase) -> _CDataBase: ... +def complete_struct_or_union( + __cdecl: CType, + __fields: list[tuple[str, CType, int, int]], + __ignored: Any, + __total_size: int, + __total_alignment: int, + __sflags: int, + __pack: int, +) -> None: ... +@overload +def from_buffer(__cdecl: CType, __python_buffer: ReadableBuffer, require_writable: Literal[False] = ...) -> _CDataBase: ... +@overload +def from_buffer(__cdecl: CType, __python_buffer: WriteableBuffer, require_writable: Literal[True]) -> _CDataBase: ... +def from_handle(__x: _CDataBase) -> Any: ... +@overload +def gcp(cdata: _CDataBase, destructor: Callable[[_CDataBase], Any], size: int = ...) -> _CDataBase: ... +@overload +def gcp(cdata: _CDataBase, destructor: None, size: int = ...) -> None: ... +def get_errno() -> int: ... +def getcname(__cdecl: CType, __replace_with: str) -> str: ... + +if sys.platform == "win32": + def getwinerror(code: int = ...) -> tuple[int, str]: ... + +if sys.platform == "win32": + def load_library(__libpath: str | _CDataBase, __flags: int = ...) -> CLibrary: ... + +else: + def load_library(__libpath: str | _CDataBase | None = ..., __flags: int = ...) -> CLibrary: ... + +def memmove(dest: _CDataBase | WriteableBuffer, src: _CDataBase | ReadableBuffer, n: int) -> None: ... +def new_array_type(__cdecl: CType, __length: int | None) -> CType: ... +def new_enum_type(__name: str, __enumerators: tuple[str, ...], __enumvalues: tuple[Any, ...], __basetype: CType) -> CType: ... +def new_function_type(__args: tuple[CType, ...], __result: CType, __ellipsis: int, __abi: int) -> CType: ... +def new_pointer_type(__cdecl: CType) -> CType: ... +def new_primitive_type(__name: str) -> CType: ... +def new_struct_type(__name: str) -> CType: ... +def new_union_type(__name: str) -> CType: ... +def new_void_type() -> CType: ... +def newp(__cdecl: CType, __init: Any = ...) -> _CDataBase: ... +def newp_handle(__cdecl: CType, __x: Any) -> _CDataBase: ... +def rawaddressof(__cdecl: CType, __cdata: _CDataBase, __offset: int) -> _CDataBase: ... +def release(__cdata: _CDataBase) -> None: ... +def set_errno(__errno: int) -> None: ... +def sizeof(__cdecl: CType | _CDataBase) -> int: ... +def string(cdata: _CDataBase, maxlen: int) -> bytes | str: ... +def typeof(__cdata: _CDataBase) -> CType: ... +def typeoffsetof(__cdecl: CType, __fieldname: str | int, __following: bool = ...) -> tuple[CType, int]: ... +def unpack(cdata: _CDataBase, length: int) -> bytes | str | list[Any]: ... diff --git a/stubs/cffi/cffi/__init__.pyi b/stubs/cffi/cffi/__init__.pyi new file mode 100644 index 0000000..851066f --- /dev/null +++ b/stubs/cffi/cffi/__init__.pyi @@ -0,0 +1,11 @@ +from .api import FFI as FFI +from .error import ( + CDefError as CDefError, + FFIError as FFIError, + VerificationError as VerificationError, + VerificationMissing as VerificationMissing, +) + +__version__: str +__version_info__: tuple[int, int, int] +__version_verifier_modules__: str diff --git a/stubs/cffi/cffi/api.pyi b/stubs/cffi/cffi/api.pyi new file mode 100644 index 0000000..751f7d1 --- /dev/null +++ b/stubs/cffi/cffi/api.pyi @@ -0,0 +1,95 @@ +import distutils.core +import sys +import types +from _typeshed import ReadableBuffer, WriteableBuffer +from collections.abc import Callable, Hashable +from typing import Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias + +import _cffi_backend + +_T = TypeVar("_T") + +basestring: TypeAlias = str # noqa: Y042 + +class FFI: + CData: TypeAlias = _cffi_backend._CDataBase + CType: TypeAlias = _cffi_backend.CType + buffer: TypeAlias = _cffi_backend.buffer # noqa: Y042 + + BVoidP: CType + BCharA: CType + NULL: CType + errno: int + + def __init__(self, backend: types.ModuleType | None = ...) -> None: ... + def cdef(self, csource: str, override: bool = ..., packed: bool = ..., pack: int | None = ...) -> None: ... + def embedding_api(self, csource: str, packed: bool = ..., pack: bool | int | None = ...) -> None: ... + def dlopen(self, name: str, flags: int = ...) -> _cffi_backend.Lib: ... + def dlclose(self, lib: _cffi_backend.Lib) -> None: ... + def typeof(self, cdecl: str | CData | types.BuiltinFunctionType | types.FunctionType) -> CType: ... + def sizeof(self, cdecl: str | CData) -> int: ... + def alignof(self, cdecl: str | CData) -> int: ... + def offsetof(self, cdecl: str | CData, *fields_or_indexes: str | int) -> int: ... + def new(self, cdecl: str | CType, init: Any | None = ...) -> CData: ... + def new_allocator( + self, + alloc: Callable[[int], CData] | None = ..., + free: Callable[[CData], Any] | None = ..., + should_clear_after_alloc: bool = ..., + ) -> _cffi_backend._Allocator: ... + def cast(self, cdecl: str | CType, source: CData) -> CData: ... + def string(self, cdata: CData, maxlen: int = ...) -> bytes | str: ... + def unpack(self, cdata: CData, length: int) -> bytes | str | list[Any]: ... + @overload + def from_buffer(self, cdecl: ReadableBuffer, require_writable: Literal[False] = ...) -> CData: ... + @overload + def from_buffer(self, cdecl: WriteableBuffer, require_writable: Literal[True]) -> CData: ... + @overload + def from_buffer(self, cdecl: str, python_buffer: ReadableBuffer, require_writable: Literal[False] = ...) -> CData: ... + @overload + def from_buffer(self, cdecl: str, python_buffer: WriteableBuffer, require_writable: Literal[True]) -> CData: ... + def memmove(self, dest: CData | WriteableBuffer, src: CData | ReadableBuffer, n: int) -> None: ... + @overload + def callback( + self, + cdecl: str | CType, + python_callable: None = ..., + error: Any = ..., + onerror: Callable[[Exception, Any, Any], None] | None = ..., + ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + @overload + def callback( + self, + cdecl: str | CType, + python_callable: Callable[..., _T], + error: Any = ..., + onerror: Callable[[Exception, Any, Any], None] | None = ..., + ) -> Callable[..., _T]: ... + def getctype(self, cdecl: str | CType, replace_with: str = ...) -> str: ... + @overload + def gc(self, cdata: CData, destructor: Callable[[CData], Any], size: int = ...) -> CData: ... + @overload + def gc(self, cdata: CData, destructor: None, size: int = ...) -> None: ... + def verify(self, source: str = ..., tmpdir: str | None = ..., **kwargs: Any) -> _cffi_backend.Lib: ... + if sys.platform == "win32": + def getwinerror(self, code: int = ...) -> tuple[int, str] | None: ... + + def addressof(self, cdata: CData, *fields_or_indexes: str | int) -> CData: ... + def include(self, ffi_to_include: FFI) -> None: ... + def new_handle(self, x: Any) -> CData: ... + def from_handle(self, x: CData) -> Any: ... + def release(self, x: CData) -> None: ... + def set_unicode(self, enabled_flag: bool) -> None: ... + def set_source(self, module_name: str, source: str, source_extension: str = ..., **kwds: Any) -> None: ... + def set_source_pkgconfig( + self, module_name: str, pkgconfig_libs: list[str], source: str, source_extension: str = ..., **kwds: Any + ) -> None: ... + def distutils_extension(self, tmpdir: str = ..., verbose: bool = ...) -> distutils.core.Extension: ... + def emit_c_code(self, filename: str) -> None: ... + def emit_python_code(self, filename: str) -> None: ... + def compile(self, tmpdir: str = ..., verbose: int = ..., target: str | None = ..., debug: bool | None = ...) -> str: ... + def init_once(self, func: Callable[[], Any], tag: Hashable) -> Any: ... + def embedding_init_code(self, pysource: str) -> None: ... + def def_extern(self, *args: Any, **kwds: Any) -> None: ... + def list_types(self) -> tuple[list[str], list[str], list[str]]: ... diff --git a/stubs/cffi/cffi/backend_ctypes.pyi b/stubs/cffi/cffi/backend_ctypes.pyi new file mode 100644 index 0000000..d202d87 --- /dev/null +++ b/stubs/cffi/cffi/backend_ctypes.pyi @@ -0,0 +1,79 @@ +from _typeshed import Incomplete + +unicode = str +long = int +xrange = range +bytechr: Incomplete + +class CTypesType(type): ... + +class CTypesData: + __metaclass__: Incomplete + __name__: str + def __init__(self, *args) -> None: ... + def __iter__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __hash__(self): ... + def __repr__(self, c_name: str | None = ...): ... + +class CTypesGenericPrimitive(CTypesData): + def __hash__(self): ... + +class CTypesGenericArray(CTypesData): + def __iter__(self): ... + +class CTypesGenericPtr(CTypesData): + kind: str + def __nonzero__(self): ... + def __bool__(self) -> bool: ... + +class CTypesBaseStructOrUnion(CTypesData): ... + +class CTypesBackend: + PRIMITIVE_TYPES: Incomplete + RTLD_LAZY: int + RTLD_NOW: int + RTLD_GLOBAL: Incomplete + RTLD_LOCAL: Incomplete + def __init__(self) -> None: ... + ffi: Incomplete + def set_ffi(self, ffi) -> None: ... + def load_library(self, path, flags: int = ...): ... + def new_void_type(self): ... + def new_primitive_type(self, name): ... + def new_pointer_type(self, BItem): ... + def new_array_type(self, CTypesPtr, length): ... + def new_struct_type(self, name): ... + def new_union_type(self, name): ... + def complete_struct_or_union( + self, CTypesStructOrUnion, fields, tp, totalsize: int = ..., totalalignment: int = ..., sflags: int = ..., pack: int = ... + ): ... + def new_function_type(self, BArgs, BResult, has_varargs): ... + def new_enum_type(self, name, enumerators, enumvalues, CTypesInt): ... + def get_errno(self): ... + def set_errno(self, value) -> None: ... + def string(self, b, maxlen: int = ...): ... + def buffer(self, bptr, size: int = ...) -> None: ... + def sizeof(self, cdata_or_BType): ... + def alignof(self, BType): ... + def newp(self, BType, source): ... + def cast(self, BType, source): ... + def callback(self, BType, source, error, onerror): ... + def gcp(self, cdata, destructor, size: int = ...): ... + typeof: Incomplete + def getcname(self, BType, replace_with): ... + def typeoffsetof(self, BType, fieldname, num: int = ...): ... + def rawaddressof(self, BTypePtr, cdata, offset: Incomplete | None = ...): ... + +class CTypesLibrary: + backend: Incomplete + cdll: Incomplete + def __init__(self, backend, cdll) -> None: ... + def load_function(self, BType, name): ... + def read_variable(self, BType, name): ... + def write_variable(self, BType, name, value) -> None: ... diff --git a/stubs/cffi/cffi/cffi_opcode.pyi b/stubs/cffi/cffi/cffi_opcode.pyi new file mode 100644 index 0000000..364a080 --- /dev/null +++ b/stubs/cffi/cffi/cffi_opcode.pyi @@ -0,0 +1,92 @@ +from _typeshed import Incomplete + +class CffiOp: + op: Incomplete + arg: Incomplete + def __init__(self, op, arg) -> None: ... + def as_c_expr(self): ... + def as_python_bytes(self): ... + +def format_four_bytes(num): ... + +OP_PRIMITIVE: int +OP_POINTER: int +OP_ARRAY: int +OP_OPEN_ARRAY: int +OP_STRUCT_UNION: int +OP_ENUM: int +OP_FUNCTION: int +OP_FUNCTION_END: int +OP_NOOP: int +OP_BITFIELD: int +OP_TYPENAME: int +OP_CPYTHON_BLTN_V: int +OP_CPYTHON_BLTN_N: int +OP_CPYTHON_BLTN_O: int +OP_CONSTANT: int +OP_CONSTANT_INT: int +OP_GLOBAL_VAR: int +OP_DLOPEN_FUNC: int +OP_DLOPEN_CONST: int +OP_GLOBAL_VAR_F: int +OP_EXTERN_PYTHON: int +PRIM_VOID: int +PRIM_BOOL: int +PRIM_CHAR: int +PRIM_SCHAR: int +PRIM_UCHAR: int +PRIM_SHORT: int +PRIM_USHORT: int +PRIM_INT: int +PRIM_UINT: int +PRIM_LONG: int +PRIM_ULONG: int +PRIM_LONGLONG: int +PRIM_ULONGLONG: int +PRIM_FLOAT: int +PRIM_DOUBLE: int +PRIM_LONGDOUBLE: int +PRIM_WCHAR: int +PRIM_INT8: int +PRIM_UINT8: int +PRIM_INT16: int +PRIM_UINT16: int +PRIM_INT32: int +PRIM_UINT32: int +PRIM_INT64: int +PRIM_UINT64: int +PRIM_INTPTR: int +PRIM_UINTPTR: int +PRIM_PTRDIFF: int +PRIM_SIZE: int +PRIM_SSIZE: int +PRIM_INT_LEAST8: int +PRIM_UINT_LEAST8: int +PRIM_INT_LEAST16: int +PRIM_UINT_LEAST16: int +PRIM_INT_LEAST32: int +PRIM_UINT_LEAST32: int +PRIM_INT_LEAST64: int +PRIM_UINT_LEAST64: int +PRIM_INT_FAST8: int +PRIM_UINT_FAST8: int +PRIM_INT_FAST16: int +PRIM_UINT_FAST16: int +PRIM_INT_FAST32: int +PRIM_UINT_FAST32: int +PRIM_INT_FAST64: int +PRIM_UINT_FAST64: int +PRIM_INTMAX: int +PRIM_UINTMAX: int +PRIM_FLOATCOMPLEX: int +PRIM_DOUBLECOMPLEX: int +PRIM_CHAR16: int +PRIM_CHAR32: int +PRIMITIVE_TO_INDEX: Incomplete +F_UNION: int +F_CHECK_FIELDS: int +F_PACKED: int +F_EXTERNAL: int +F_OPAQUE: int +G_FLAGS: Incomplete +CLASS_NAME: Incomplete diff --git a/stubs/cffi/cffi/commontypes.pyi b/stubs/cffi/cffi/commontypes.pyi new file mode 100644 index 0000000..fe9e35e --- /dev/null +++ b/stubs/cffi/cffi/commontypes.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete + +COMMON_TYPES: Incomplete + +def resolve_common_type(parser, commontype): ... +def win_common_types(): ... diff --git a/stubs/cffi/cffi/cparser.pyi b/stubs/cffi/cffi/cparser.pyi new file mode 100644 index 0000000..8fcab85 --- /dev/null +++ b/stubs/cffi/cffi/cparser.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete + +lock: Incomplete +CDEF_SOURCE_STRING: str + +class Parser: + def __init__(self) -> None: ... + def convert_pycparser_error(self, e, csource) -> None: ... + def parse( + self, csource, override: bool = ..., packed: bool = ..., pack: Incomplete | None = ..., dllexport: bool = ... + ) -> None: ... + def parse_type(self, cdecl): ... + def parse_type_and_quals(self, cdecl): ... + def include(self, other) -> None: ... diff --git a/stubs/cffi/cffi/error.pyi b/stubs/cffi/cffi/error.pyi new file mode 100644 index 0000000..a71f17e --- /dev/null +++ b/stubs/cffi/cffi/error.pyi @@ -0,0 +1,14 @@ +class FFIError(Exception): + __module__: str + +class CDefError(Exception): + __module__: str + +class VerificationError(Exception): + __module__: str + +class VerificationMissing(Exception): + __module__: str + +class PkgConfigError(Exception): + __module__: str diff --git a/stubs/cffi/cffi/ffiplatform.pyi b/stubs/cffi/cffi/ffiplatform.pyi new file mode 100644 index 0000000..d96b755 --- /dev/null +++ b/stubs/cffi/cffi/ffiplatform.pyi @@ -0,0 +1,11 @@ +from _typeshed import Incomplete + +LIST_OF_FILE_NAMES: Incomplete + +def get_extension(srcfilename, modname, sources=..., **kwds): ... +def compile(tmpdir, ext, compiler_verbose: int = ..., debug: Incomplete | None = ...): ... +def maybe_relative_path(path): ... + +int_or_long = int + +def flatten(x): ... diff --git a/stubs/cffi/cffi/lock.pyi b/stubs/cffi/cffi/lock.pyi new file mode 100644 index 0000000..fc8393a --- /dev/null +++ b/stubs/cffi/cffi/lock.pyi @@ -0,0 +1 @@ +from _thread import allocate_lock as allocate_lock diff --git a/stubs/cffi/cffi/model.pyi b/stubs/cffi/cffi/model.pyi new file mode 100644 index 0000000..8e19158 --- /dev/null +++ b/stubs/cffi/cffi/model.pyi @@ -0,0 +1,162 @@ +from _typeshed import Incomplete +from collections.abc import Generator + +from .error import CDefError as CDefError, VerificationError as VerificationError, VerificationMissing as VerificationMissing +from .lock import allocate_lock as allocate_lock + +Q_CONST: int +Q_RESTRICT: int +Q_VOLATILE: int + +def qualify(quals, replace_with): ... + +class BaseTypeByIdentity: + is_array_type: bool + is_raw_function: bool + def get_c_name(self, replace_with: str = ..., context: str = ..., quals: int = ...): ... + def has_c_name(self): ... + def is_integer_type(self): ... + def get_cached_btype(self, ffi, finishlist, can_delay: bool = ...): ... + +class BaseType(BaseTypeByIdentity): + def __eq__(self, other): ... + def __ne__(self, other): ... + def __hash__(self): ... + +class VoidType(BaseType): + c_name_with_marker: str + def __init__(self) -> None: ... + def build_backend_type(self, ffi, finishlist): ... + +void_type: Incomplete + +class BasePrimitiveType(BaseType): + def is_complex_type(self): ... + +class PrimitiveType(BasePrimitiveType): + ALL_PRIMITIVE_TYPES: Incomplete + name: Incomplete + c_name_with_marker: Incomplete + def __init__(self, name) -> None: ... + def is_char_type(self): ... + def is_integer_type(self): ... + def is_float_type(self): ... + def is_complex_type(self): ... + def build_backend_type(self, ffi, finishlist): ... + +class UnknownIntegerType(BasePrimitiveType): + name: Incomplete + c_name_with_marker: Incomplete + def __init__(self, name) -> None: ... + def is_integer_type(self): ... + def build_backend_type(self, ffi, finishlist) -> None: ... + +class UnknownFloatType(BasePrimitiveType): + name: Incomplete + c_name_with_marker: Incomplete + def __init__(self, name) -> None: ... + def build_backend_type(self, ffi, finishlist) -> None: ... + +class BaseFunctionType(BaseType): + args: Incomplete + result: Incomplete + ellipsis: Incomplete + abi: Incomplete + c_name_with_marker: Incomplete + def __init__(self, args, result, ellipsis, abi: Incomplete | None = ...) -> None: ... + +class RawFunctionType(BaseFunctionType): + is_raw_function: bool + def build_backend_type(self, ffi, finishlist) -> None: ... + def as_function_pointer(self): ... + +class FunctionPtrType(BaseFunctionType): + def build_backend_type(self, ffi, finishlist): ... + def as_raw_function(self): ... + +class PointerType(BaseType): + totype: Incomplete + quals: Incomplete + c_name_with_marker: Incomplete + def __init__(self, totype, quals: int = ...) -> None: ... + def build_backend_type(self, ffi, finishlist): ... + +voidp_type: Incomplete + +def ConstPointerType(totype): ... + +const_voidp_type: Incomplete + +class NamedPointerType(PointerType): + name: Incomplete + c_name_with_marker: Incomplete + def __init__(self, totype, name, quals: int = ...) -> None: ... + +class ArrayType(BaseType): + is_array_type: bool + item: Incomplete + length: Incomplete + c_name_with_marker: Incomplete + def __init__(self, item, length) -> None: ... + def length_is_unknown(self): ... + def resolve_length(self, newlength): ... + def build_backend_type(self, ffi, finishlist): ... + +char_array_type: Incomplete + +class StructOrUnionOrEnum(BaseTypeByIdentity): + forcename: Incomplete + c_name_with_marker: Incomplete + def build_c_name_with_marker(self) -> None: ... + def force_the_name(self, forcename) -> None: ... + def get_official_name(self): ... + +class StructOrUnion(StructOrUnionOrEnum): + fixedlayout: Incomplete + completed: int + partial: bool + packed: int + name: Incomplete + fldnames: Incomplete + fldtypes: Incomplete + fldbitsize: Incomplete + fldquals: Incomplete + def __init__(self, name, fldnames, fldtypes, fldbitsize, fldquals: Incomplete | None = ...) -> None: ... + def anonymous_struct_fields(self) -> Generator[Incomplete, None, None]: ... + def enumfields(self, expand_anonymous_struct_union: bool = ...) -> Generator[Incomplete, None, None]: ... + def force_flatten(self) -> None: ... + def get_cached_btype(self, ffi, finishlist, can_delay: bool = ...): ... + def finish_backend_type(self, ffi, finishlist) -> None: ... + def check_not_partial(self) -> None: ... + def build_backend_type(self, ffi, finishlist): ... + +class StructType(StructOrUnion): + kind: str + +class UnionType(StructOrUnion): + kind: str + +class EnumType(StructOrUnionOrEnum): + kind: str + partial: bool + partial_resolved: bool + name: Incomplete + enumerators: Incomplete + enumvalues: Incomplete + baseinttype: Incomplete + def __init__(self, name, enumerators, enumvalues, baseinttype: Incomplete | None = ...) -> None: ... + forcename: Incomplete + def force_the_name(self, forcename) -> None: ... + def check_not_partial(self) -> None: ... + def build_backend_type(self, ffi, finishlist): ... + def build_baseinttype(self, ffi, finishlist): ... + +def unknown_type(name, structname: Incomplete | None = ...): ... +def unknown_ptr_type(name, structname: Incomplete | None = ...): ... + +global_lock: Incomplete + +def get_typecache(backend): ... +def global_cache(srctype, ffi, funcname, *args, **kwds): ... +def pointer_cache(ffi, BType): ... +def attach_exception_info(e, name) -> None: ... diff --git a/stubs/cffi/cffi/pkgconfig.pyi b/stubs/cffi/cffi/pkgconfig.pyi new file mode 100644 index 0000000..bb53098 --- /dev/null +++ b/stubs/cffi/cffi/pkgconfig.pyi @@ -0,0 +1,3 @@ +def merge_flags(cfg1, cfg2): ... +def call(libname, flag, encoding=...): ... +def flags_from_pkgconfig(libs): ... diff --git a/stubs/cffi/cffi/recompiler.pyi b/stubs/cffi/cffi/recompiler.pyi new file mode 100644 index 0000000..ee17f6b --- /dev/null +++ b/stubs/cffi/cffi/recompiler.pyi @@ -0,0 +1,94 @@ +import io +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +from .cffi_opcode import * + +VERSION_BASE: int +VERSION_EMBEDDED: int +VERSION_CHAR16CHAR32: int +USE_LIMITED_API: Incomplete + +class GlobalExpr: + name: Incomplete + address: Incomplete + type_op: Incomplete + size: Incomplete + check_value: Incomplete + def __init__(self, name, address, type_op, size: int = ..., check_value: int = ...) -> None: ... + def as_c_expr(self): ... + def as_python_expr(self): ... + +class FieldExpr: + name: Incomplete + field_offset: Incomplete + field_size: Incomplete + fbitsize: Incomplete + field_type_op: Incomplete + def __init__(self, name, field_offset, field_size, fbitsize, field_type_op) -> None: ... + def as_c_expr(self): ... + def as_python_expr(self) -> None: ... + def as_field_python_expr(self): ... + +class StructUnionExpr: + name: Incomplete + type_index: Incomplete + flags: Incomplete + size: Incomplete + alignment: Incomplete + comment: Incomplete + first_field_index: Incomplete + c_fields: Incomplete + def __init__(self, name, type_index, flags, size, alignment, comment, first_field_index, c_fields) -> None: ... + def as_c_expr(self): ... + def as_python_expr(self): ... + +class EnumExpr: + name: Incomplete + type_index: Incomplete + size: Incomplete + signed: Incomplete + allenums: Incomplete + def __init__(self, name, type_index, size, signed, allenums) -> None: ... + def as_c_expr(self): ... + def as_python_expr(self): ... + +class TypenameExpr: + name: Incomplete + type_index: Incomplete + def __init__(self, name, type_index) -> None: ... + def as_c_expr(self): ... + def as_python_expr(self): ... + +class Recompiler: + ffi: Incomplete + module_name: Incomplete + target_is_python: Incomplete + def __init__(self, ffi, module_name, target_is_python: bool = ...) -> None: ... + def needs_version(self, ver) -> None: ... + cffi_types: Incomplete + def collect_type_table(self): ... + ALL_STEPS: Incomplete + def collect_step_tables(self): ... + def write_source_to_f(self, f, preamble) -> None: ... + def write_c_source_to_f(self, f, preamble) -> None: ... + def write_py_source_to_f(self, f) -> None: ... + +NativeIO: TypeAlias = io.StringIO + +def make_c_source(ffi, module_name, preamble, target_c_file, verbose: bool = ...): ... +def make_py_source(ffi, module_name, target_py_file, verbose: bool = ...): ... +def recompile( + ffi, + module_name, + preamble, + tmpdir: str = ..., + call_c_compiler: bool = ..., + c_file: Incomplete | None = ..., + source_extension: str = ..., + extradir: Incomplete | None = ..., + compiler_verbose: int = ..., + target: Incomplete | None = ..., + debug: Incomplete | None = ..., + **kwds, +): ... diff --git a/stubs/cffi/cffi/setuptools_ext.pyi b/stubs/cffi/cffi/setuptools_ext.pyi new file mode 100644 index 0000000..beb5885 --- /dev/null +++ b/stubs/cffi/cffi/setuptools_ext.pyi @@ -0,0 +1,6 @@ +basestring = str + +def error(msg) -> None: ... +def execfile(filename, glob) -> None: ... +def add_cffi_module(dist, mod_spec) -> None: ... +def cffi_modules(dist, attr, value) -> None: ... diff --git a/stubs/cffi/cffi/vengine_cpy.pyi b/stubs/cffi/cffi/vengine_cpy.pyi new file mode 100644 index 0000000..dea9f16 --- /dev/null +++ b/stubs/cffi/cffi/vengine_cpy.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +class VCPythonEngine: + verifier: Incomplete + ffi: Incomplete + def __init__(self, verifier) -> None: ... + def patch_extension_kwds(self, kwds) -> None: ... + def find_module(self, module_name, path, so_suffixes): ... + def collect_types(self) -> None: ... + def write_source_to_f(self) -> None: ... + def load_library(self, flags: Incomplete | None = ...): ... + +cffimod_header: str diff --git a/stubs/cffi/cffi/vengine_gen.pyi b/stubs/cffi/cffi/vengine_gen.pyi new file mode 100644 index 0000000..d447709 --- /dev/null +++ b/stubs/cffi/cffi/vengine_gen.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete + +class VGenericEngine: + verifier: Incomplete + ffi: Incomplete + export_symbols: Incomplete + def __init__(self, verifier) -> None: ... + def patch_extension_kwds(self, kwds) -> None: ... + def find_module(self, module_name, path, so_suffixes): ... + def collect_types(self) -> None: ... + def write_source_to_f(self) -> None: ... + def load_library(self, flags: int = ...): ... + +cffimod_header: str diff --git a/stubs/cffi/cffi/verifier.pyi b/stubs/cffi/cffi/verifier.pyi new file mode 100644 index 0000000..3b9e558 --- /dev/null +++ b/stubs/cffi/cffi/verifier.pyi @@ -0,0 +1,39 @@ +import io +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +NativeIO: TypeAlias = io.StringIO + +class Verifier: + ffi: Incomplete + preamble: Incomplete + flags: Incomplete + kwds: Incomplete + tmpdir: Incomplete + sourcefilename: Incomplete + modulefilename: Incomplete + ext_package: Incomplete + def __init__( + self, + ffi, + preamble, + tmpdir: Incomplete | None = ..., + modulename: Incomplete | None = ..., + ext_package: Incomplete | None = ..., + tag: str = ..., + force_generic_engine: bool = ..., + source_extension: str = ..., + flags: Incomplete | None = ..., + relative_to: Incomplete | None = ..., + **kwds, + ) -> None: ... + def write_source(self, file: Incomplete | None = ...) -> None: ... + def compile_module(self) -> None: ... + def load_library(self): ... + def get_module_name(self): ... + def get_extension(self): ... + def generates_python_module(self): ... + def make_relative_to(self, kwds, relative_to): ... + +def set_tmpdir(dirname) -> None: ... +def cleanup_tmpdir(tmpdir: Incomplete | None = ..., keep_so: bool = ...) -> None: ... diff --git a/stubs/characteristic/METADATA.toml b/stubs/characteristic/METADATA.toml deleted file mode 100644 index f14c99e..0000000 --- a/stubs/characteristic/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "14.3" -python2 = true diff --git a/stubs/characteristic/characteristic/__init__.pyi b/stubs/characteristic/characteristic/__init__.pyi deleted file mode 100644 index 08056c3..0000000 --- a/stubs/characteristic/characteristic/__init__.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from typing import Any, AnyStr, Callable, Sequence, Type, TypeVar - -def with_repr(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ... -def with_cmp(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ... -def with_init(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ... -def immutable(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ... -def strip_leading_underscores(attribute_name: AnyStr) -> AnyStr: ... - -NOTHING = Any - -_T = TypeVar("_T") - -def attributes( - attrs: Sequence[AnyStr | Attribute], - apply_with_cmp: bool = ..., - apply_with_init: bool = ..., - apply_with_repr: bool = ..., - apply_immutable: bool = ..., - store_attributes: Callable[[type, Attribute], Any] | None = ..., - **kw: dict[Any, Any] | None, -) -> Callable[[Type[_T]], Type[_T]]: ... - -class Attribute: - def __init__( - self, - name: AnyStr, - exclude_from_cmp: bool = ..., - exclude_from_init: bool = ..., - exclude_from_repr: bool = ..., - exclude_from_immutable: bool = ..., - default_value: Any = ..., - default_factory: Callable[[None], Any] | None = ..., - instance_of: Any | None = ..., - init_aliaser: Callable[[AnyStr], AnyStr] | None = ..., - ) -> None: ... diff --git a/stubs/chardet/METADATA.toml b/stubs/chardet/METADATA.toml index f52bb86..c98db63 100644 --- a/stubs/chardet/METADATA.toml +++ b/stubs/chardet/METADATA.toml @@ -1,3 +1 @@ -version = "4.0" -python2 = true -requires = [] +version = "5.0.*" diff --git a/stubs/chardet/chardet/__init__.pyi b/stubs/chardet/chardet/__init__.pyi index 54e48f5..0ab1624 100644 --- a/stubs/chardet/chardet/__init__.pyi +++ b/stubs/chardet/chardet/__init__.pyi @@ -1,26 +1,21 @@ import sys -from typing import Any, Tuple -from .universaldetector import UniversalDetector as UniversalDetector - -def __getattr__(name: str) -> Any: ... # incomplete +from .universaldetector import UniversalDetector as UniversalDetector, _FinalResultType, _IntermediateResultType +from .version import VERSION as VERSION, __version__ as __version__ if sys.version_info >= (3, 8): from typing import TypedDict else: from typing_extensions import TypedDict -class _LangModelType(TypedDict): - char_to_order_map: Tuple[int, ...] - precedence_matrix: Tuple[int, ...] +# unused in this module, but imported in multiple submodules +class _LangModelType(TypedDict): # noqa: Y049 + char_to_order_map: tuple[int, ...] + precedence_matrix: tuple[int, ...] typical_positive_ratio: float keep_english_letter: bool charset_name: str language: str -class _SMModelType(TypedDict): - class_table: Tuple[int, ...] - class_factor: int - state_table: Tuple[int, ...] - char_len_table: Tuple[int, ...] - name: str +def detect(byte_str: bytes | bytearray) -> _FinalResultType: ... +def detect_all(byte_str: bytes | bytearray, ignore_threshold: bool = ...) -> list[_IntermediateResultType]: ... diff --git a/stubs/chardet/chardet/enums.pyi b/stubs/chardet/chardet/enums.pyi index 08116f1..71c9e10 100644 --- a/stubs/chardet/chardet/enums.pyi +++ b/stubs/chardet/chardet/enums.pyi @@ -1,9 +1,9 @@ -class InputState(object): +class InputState: PURE_ASCII: int ESC_ASCII: int HIGH_BYTE: int -class LanguageFilter(object): +class LanguageFilter: CHINESE_SIMPLIFIED: int CHINESE_TRADITIONAL: int JAPANESE: int @@ -13,17 +13,17 @@ class LanguageFilter(object): CHINESE: int CJK: int -class ProbingState(object): +class ProbingState: DETECTING: int FOUND_IT: int NOT_ME: int -class MachineState(object): +class MachineState: START: int ERROR: int ITS_ME: int -class SequenceLikelihood(object): +class SequenceLikelihood: NEGATIVE: int UNLIKELY: int LIKELY: int @@ -31,7 +31,7 @@ class SequenceLikelihood(object): @classmethod def get_num_categories(cls) -> int: ... -class CharacterCategory(object): +class CharacterCategory: UNDEFINED: int LINE_BREAK: int SYMBOL: int diff --git a/stubs/chardet/chardet/langbulgarianmodel.pyi b/stubs/chardet/chardet/langbulgarianmodel.pyi index de07cfa..07344de 100644 --- a/stubs/chardet/chardet/langbulgarianmodel.pyi +++ b/stubs/chardet/chardet/langbulgarianmodel.pyi @@ -1,9 +1,7 @@ -from typing import Tuple - from . import _LangModelType -Latin5_BulgarianCharToOrderMap: Tuple[int, ...] -win1251BulgarianCharToOrderMap: Tuple[int, ...] -BulgarianLangModel: Tuple[int, ...] +Latin5_BulgarianCharToOrderMap: tuple[int, ...] +win1251BulgarianCharToOrderMap: tuple[int, ...] +BulgarianLangModel: tuple[int, ...] Latin5BulgarianModel: _LangModelType Win1251BulgarianModel: _LangModelType diff --git a/stubs/chardet/chardet/langcyrillicmodel.pyi b/stubs/chardet/chardet/langcyrillicmodel.pyi index 40a7044..22e7c52 100644 --- a/stubs/chardet/chardet/langcyrillicmodel.pyi +++ b/stubs/chardet/chardet/langcyrillicmodel.pyi @@ -1,14 +1,12 @@ -from typing import Tuple - from . import _LangModelType -KOI8R_char_to_order_map: Tuple[int, ...] -win1251_char_to_order_map: Tuple[int, ...] -latin5_char_to_order_map: Tuple[int, ...] -macCyrillic_char_to_order_map: Tuple[int, ...] -IBM855_char_to_order_map: Tuple[int, ...] -IBM866_char_to_order_map: Tuple[int, ...] -RussianLangModel: Tuple[int, ...] +KOI8R_char_to_order_map: tuple[int, ...] +win1251_char_to_order_map: tuple[int, ...] +latin5_char_to_order_map: tuple[int, ...] +macCyrillic_char_to_order_map: tuple[int, ...] +IBM855_char_to_order_map: tuple[int, ...] +IBM866_char_to_order_map: tuple[int, ...] +RussianLangModel: tuple[int, ...] Koi8rModel: _LangModelType Win1251CyrillicModel: _LangModelType Latin5CyrillicModel: _LangModelType diff --git a/stubs/chardet/chardet/langgreekmodel.pyi b/stubs/chardet/chardet/langgreekmodel.pyi index f0fa3e8..ceee125 100644 --- a/stubs/chardet/chardet/langgreekmodel.pyi +++ b/stubs/chardet/chardet/langgreekmodel.pyi @@ -1,9 +1,7 @@ -from typing import Tuple - from . import _LangModelType -Latin7_char_to_order_map: Tuple[int, ...] -win1253_char_to_order_map: Tuple[int, ...] -GreekLangModel: Tuple[int, ...] +Latin7_char_to_order_map: tuple[int, ...] +win1253_char_to_order_map: tuple[int, ...] +GreekLangModel: tuple[int, ...] Latin7GreekModel: _LangModelType Win1253GreekModel: _LangModelType diff --git a/stubs/chardet/chardet/langhebrewmodel.pyi b/stubs/chardet/chardet/langhebrewmodel.pyi index 08bfbc9..a17e10d 100644 --- a/stubs/chardet/chardet/langhebrewmodel.pyi +++ b/stubs/chardet/chardet/langhebrewmodel.pyi @@ -1,7 +1,5 @@ -from typing import Tuple - from . import _LangModelType -WIN1255_CHAR_TO_ORDER_MAP: Tuple[int, ...] -HEBREW_LANG_MODEL: Tuple[int, ...] +WIN1255_CHAR_TO_ORDER_MAP: tuple[int, ...] +HEBREW_LANG_MODEL: tuple[int, ...] Win1255HebrewModel: _LangModelType diff --git a/stubs/chardet/chardet/langhungarianmodel.pyi b/stubs/chardet/chardet/langhungarianmodel.pyi index 01e4a44..498c7da 100644 --- a/stubs/chardet/chardet/langhungarianmodel.pyi +++ b/stubs/chardet/chardet/langhungarianmodel.pyi @@ -1,9 +1,7 @@ -from typing import Tuple - from . import _LangModelType -Latin2_HungarianCharToOrderMap: Tuple[int, ...] -win1250HungarianCharToOrderMap: Tuple[int, ...] -HungarianLangModel: Tuple[int, ...] +Latin2_HungarianCharToOrderMap: tuple[int, ...] +win1250HungarianCharToOrderMap: tuple[int, ...] +HungarianLangModel: tuple[int, ...] Latin2HungarianModel: _LangModelType Win1250HungarianModel: _LangModelType diff --git a/stubs/chardet/chardet/langthaimodel.pyi b/stubs/chardet/chardet/langthaimodel.pyi index 93149e7..eee2356 100644 --- a/stubs/chardet/chardet/langthaimodel.pyi +++ b/stubs/chardet/chardet/langthaimodel.pyi @@ -1,7 +1,5 @@ -from typing import Tuple - from . import _LangModelType -TIS620CharToOrderMap: Tuple[int, ...] -ThaiLangModel: Tuple[int, ...] +TIS620CharToOrderMap: tuple[int, ...] +ThaiLangModel: tuple[int, ...] TIS620ThaiModel: _LangModelType diff --git a/stubs/chardet/chardet/langturkishmodel.pyi b/stubs/chardet/chardet/langturkishmodel.pyi index 65b1bdc..6686f26 100644 --- a/stubs/chardet/chardet/langturkishmodel.pyi +++ b/stubs/chardet/chardet/langturkishmodel.pyi @@ -1,7 +1,5 @@ -from typing import Tuple - from . import _LangModelType -Latin5_TurkishCharToOrderMap: Tuple[int, ...] -TurkishLangModel: Tuple[int, ...] +Latin5_TurkishCharToOrderMap: tuple[int, ...] +TurkishLangModel: tuple[int, ...] Latin5TurkishModel: _LangModelType diff --git a/stubs/chardet/chardet/universaldetector.pyi b/stubs/chardet/chardet/universaldetector.pyi index 372a4fe..a721160 100644 --- a/stubs/chardet/chardet/universaldetector.pyi +++ b/stubs/chardet/chardet/universaldetector.pyi @@ -1,5 +1,5 @@ from logging import Logger -from typing import Pattern +from re import Pattern from typing_extensions import TypedDict class _FinalResultType(TypedDict): @@ -12,7 +12,7 @@ class _IntermediateResultType(TypedDict): confidence: float language: str | None -class UniversalDetector(object): +class UniversalDetector: MINIMUM_THRESHOLD: float HIGH_BYTE_DETECTOR: Pattern[bytes] ESC_DETECTOR: Pattern[bytes] diff --git a/stubs/chevron/@tests/stubtest_allowlist.txt b/stubs/chevron/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..c8e15f3 --- /dev/null +++ b/stubs/chevron/@tests/stubtest_allowlist.txt @@ -0,0 +1,3 @@ +# These are re-exports which we consider an implementation detail: +chevron.main.version +chevron.renderer.linesep diff --git a/stubs/chevron/METADATA.toml b/stubs/chevron/METADATA.toml new file mode 100755 index 0000000..4e3c6df --- /dev/null +++ b/stubs/chevron/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.14.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/chevron/chevron/__init__.pyi b/stubs/chevron/chevron/__init__.pyi new file mode 100755 index 0000000..4728097 --- /dev/null +++ b/stubs/chevron/chevron/__init__.pyi @@ -0,0 +1,5 @@ +from .main import cli_main as cli_main, main as main +from .renderer import render as render +from .tokenizer import ChevronError as ChevronError + +__all__ = ["main", "render", "cli_main", "ChevronError"] diff --git a/stubs/chevron/chevron/main.pyi b/stubs/chevron/chevron/main.pyi new file mode 100755 index 0000000..99a589d --- /dev/null +++ b/stubs/chevron/chevron/main.pyi @@ -0,0 +1,8 @@ +from _typeshed import StrOrBytesPath +from typing import Any +from typing_extensions import TypeAlias + +_OpenFile: TypeAlias = StrOrBytesPath | int + +def main(template: _OpenFile, data: _OpenFile | None = ..., **kwargs: Any) -> str: ... +def cli_main() -> None: ... diff --git a/stubs/chevron/chevron/metadata.pyi b/stubs/chevron/chevron/metadata.pyi new file mode 100755 index 0000000..c2ee2ca --- /dev/null +++ b/stubs/chevron/chevron/metadata.pyi @@ -0,0 +1 @@ +version: str diff --git a/stubs/chevron/chevron/renderer.pyi b/stubs/chevron/chevron/renderer.pyi new file mode 100755 index 0000000..1ae8065 --- /dev/null +++ b/stubs/chevron/chevron/renderer.pyi @@ -0,0 +1,21 @@ +from _typeshed import StrPath, SupportsRead +from collections.abc import MutableSequence, Sequence +from typing import Any +from typing_extensions import Literal + +g_token_cache: dict[str, list[tuple[str, str]]] # undocumented +python3: Literal[True] + +def unicode(x: str, y: str) -> str: ... +def render( + template: SupportsRead[str] | str | Sequence[tuple[str, str]] = ..., + data: dict[str, Any] = ..., + partials_path: StrPath | None = ..., + partials_ext: str = ..., + partials_dict: dict[str, str] = ..., + padding: str = ..., + def_ldel: str | None = ..., + def_rdel: str | None = ..., + scopes: MutableSequence[int] | None = ..., + warn: bool = ..., +) -> str: ... diff --git a/stubs/chevron/chevron/tokenizer.pyi b/stubs/chevron/chevron/tokenizer.pyi new file mode 100755 index 0000000..b34ed1c --- /dev/null +++ b/stubs/chevron/chevron/tokenizer.pyi @@ -0,0 +1,11 @@ +from collections.abc import Iterator + +class ChevronError(SyntaxError): ... + +def grab_literal(template: str, l_del: str | None) -> tuple[str, str]: ... # undocumented +def l_sa_check(template: str, literal: str, is_standalone: bool) -> bool | None: ... # undocumented +def r_sa_check(template: str, tag_type: str, is_standalone: bool) -> bool: ... # undocumented +def parse_tag(template: str, l_del: str | None, r_del: str | None) -> tuple[tuple[str, str], str]: ... # undocumented +def tokenize( + template: str, def_ldel: str | None = ..., def_rdel: str | None = ... +) -> Iterator[tuple[str, str]]: ... # undocumented diff --git a/stubs/click-spinner/METADATA.toml b/stubs/click-spinner/METADATA.toml index e43ccaa..a8dd8c6 100644 --- a/stubs/click-spinner/METADATA.toml +++ b/stubs/click-spinner/METADATA.toml @@ -1,3 +1,4 @@ -version = "0.1" -python2 = true -requires = [] +version = "0.1.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/click-spinner/click_spinner/__init__.pyi b/stubs/click-spinner/click_spinner/__init__.pyi index 5ec098e..444a4c6 100644 --- a/stubs/click-spinner/click_spinner/__init__.pyi +++ b/stubs/click-spinner/click_spinner/__init__.pyi @@ -1,7 +1,9 @@ import threading +from _typeshed import Self +from collections.abc import Iterator from types import TracebackType -from typing import Iterator, Type -from typing_extensions import Literal, Protocol +from typing import Protocol +from typing_extensions import Literal __version__: str @@ -10,7 +12,7 @@ class _Stream(Protocol): def flush(self) -> None: ... def write(self, s: str) -> int: ... -class Spinner(object): +class Spinner: spinner_cycle: Iterator[str] disable: bool beep: bool @@ -22,9 +24,9 @@ class Spinner(object): def start(self) -> None: ... def stop(self) -> None: ... def init_spin(self) -> None: ... - def __enter__(self) -> Spinner: ... + def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> Literal[False]: ... def spinner(beep: bool, disable: bool, force: bool, stream: _Stream) -> Spinner: ... diff --git a/stubs/click-spinner/click_spinner/_version.pyi b/stubs/click-spinner/click_spinner/_version.pyi new file mode 100644 index 0000000..feb0b16 --- /dev/null +++ b/stubs/click-spinner/click_spinner/_version.pyi @@ -0,0 +1,5 @@ +from typing import Any + +version_json: str + +def get_versions() -> dict[str, Any]: ... diff --git a/stubs/click/@tests/stubtest_allowlist.txt b/stubs/click/@tests/stubtest_allowlist.txt deleted file mode 100644 index 6ef3ddd..0000000 --- a/stubs/click/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,19 +0,0 @@ -click.Argument.__init__ -click.Context.__init__ -click.Parameter.__init__ -click._termui_impl.ProgressBar.__init__ -click.command -click.core.Argument.__init__ -click.core.Context.__init__ -click.core.Parameter.__init__ -click.decorators.command -click.decorators.group -click.decorators.pass_context -click.decorators.pass_obj -click.group -click.pass_context -click.pass_obj -click.secho -click.termui._build_prompt -click.termui.secho -click.testing.clickpkg diff --git a/stubs/click/METADATA.toml b/stubs/click/METADATA.toml deleted file mode 100644 index 7b08802..0000000 --- a/stubs/click/METADATA.toml +++ /dev/null @@ -1,3 +0,0 @@ -version = "7.1" -python2 = true -obsolete_since = "8.0" diff --git a/stubs/click/README.md b/stubs/click/README.md deleted file mode 100644 index aec5fa9..0000000 --- a/stubs/click/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# click 7.0 - -`__init__.pyi` is almost a copy of `click/__init__.py`. It's a shortcut module -anyway in the actual sources so it works well with minimal changes. - -The types are pretty complete but they were created mostly for public API use -so some internal modules (`_compat`) or functions (`core._bashcomplete`) are -deliberately missing. If you feel the need to add those, pull requests accepted. - -Speaking of pull requests, it would be great if the option decorators informed -the type checker on what types the command callback should accept. diff --git a/stubs/click/click/__init__.pyi b/stubs/click/click/__init__.pyi deleted file mode 100644 index b588e6c..0000000 --- a/stubs/click/click/__init__.pyi +++ /dev/null @@ -1,84 +0,0 @@ -from .core import ( - Argument as Argument, - BaseCommand as BaseCommand, - Command as Command, - CommandCollection as CommandCollection, - Context as Context, - Group as Group, - MultiCommand as MultiCommand, - Option as Option, - Parameter as Parameter, -) -from .decorators import ( - argument as argument, - command as command, - confirmation_option as confirmation_option, - group as group, - help_option as help_option, - make_pass_decorator as make_pass_decorator, - option as option, - pass_context as pass_context, - pass_obj as pass_obj, - password_option as password_option, - version_option as version_option, -) -from .exceptions import ( - Abort as Abort, - BadArgumentUsage as BadArgumentUsage, - BadOptionUsage as BadOptionUsage, - BadParameter as BadParameter, - ClickException as ClickException, - FileError as FileError, - MissingParameter as MissingParameter, - NoSuchOption as NoSuchOption, - UsageError as UsageError, -) -from .formatting import HelpFormatter as HelpFormatter, wrap_text as wrap_text -from .globals import get_current_context as get_current_context -from .parser import OptionParser as OptionParser -from .termui import ( - clear as clear, - confirm as confirm, - echo_via_pager as echo_via_pager, - edit as edit, - get_terminal_size as get_terminal_size, - getchar as getchar, - launch as launch, - pause as pause, - progressbar as progressbar, - prompt as prompt, - secho as secho, - style as style, - unstyle as unstyle, -) -from .types import ( - BOOL as BOOL, - FLOAT as FLOAT, - INT as INT, - STRING as STRING, - UNPROCESSED as UNPROCESSED, - UUID as UUID, - Choice as Choice, - DateTime as DateTime, - File as File, - FloatRange as FloatRange, - IntRange as IntRange, - ParamType as ParamType, - Path as Path, - Tuple as Tuple, -) -from .utils import ( - echo as echo, - format_filename as format_filename, - get_app_dir as get_app_dir, - get_binary_stream as get_binary_stream, - get_os_args as get_os_args, - get_text_stream as get_text_stream, - open_file as open_file, -) - -# Controls if click should emit the warning about the use of unicode -# literals. -disable_unicode_literals_warning: bool - -__version__: str diff --git a/stubs/click/click/_termui_impl.pyi b/stubs/click/click/_termui_impl.pyi deleted file mode 100644 index 9e37329..0000000 --- a/stubs/click/click/_termui_impl.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from types import TracebackType -from typing import Generic, Type, TypeVar - -_T = TypeVar("_T") - -class ProgressBar(Generic[_T]): - def update(self, n_steps: int) -> None: ... - def finish(self) -> None: ... - def __enter__(self) -> ProgressBar[_T]: ... - def __exit__( - self, exctype: Type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None - ) -> None: ... - def __iter__(self) -> ProgressBar[_T]: ... - def next(self) -> _T: ... - def __next__(self) -> _T: ... - length: int | None - label: str diff --git a/stubs/click/click/core.pyi b/stubs/click/click/core.pyi deleted file mode 100644 index b19e8ae..0000000 --- a/stubs/click/click/core.pyi +++ /dev/null @@ -1,272 +0,0 @@ -from typing import Any, Callable, ContextManager, Iterable, Mapping, NoReturn, Optional, Sequence, Set, Tuple, TypeVar, Union - -from click.formatting import HelpFormatter -from click.parser import OptionParser - -_CC = TypeVar("_CC", bound=Callable[[], Any]) - -def invoke_param_callback( - callback: Callable[[Context, Parameter, str | None], Any], ctx: Context, param: Parameter, value: str | None -) -> Any: ... -def augment_usage_errors(ctx: Context, param: Parameter | None = ...) -> ContextManager[None]: ... -def iter_params_for_processing( - invocation_order: Sequence[Parameter], declaration_order: Iterable[Parameter] -) -> Iterable[Parameter]: ... - -class Context: - parent: Context | None - command: Command - info_name: str | None - params: dict[Any, Any] - args: list[str] - protected_args: list[str] - obj: Any - default_map: Mapping[str, Any] | None - invoked_subcommand: str | None - terminal_width: int | None - max_content_width: int | None - allow_extra_args: bool - allow_interspersed_args: bool - ignore_unknown_options: bool - help_option_names: list[str] - token_normalize_func: Callable[[str], str] | None - resilient_parsing: bool - auto_envvar_prefix: str | None - color: bool | None - _meta: dict[str, Any] - _close_callbacks: list[Any] - _depth: int - def __init__( - self, - command: Command, - parent: Context | None = ..., - info_name: str | None = ..., - obj: Any | None = ..., - auto_envvar_prefix: str | None = ..., - default_map: Mapping[str, Any] | None = ..., - terminal_width: int | None = ..., - max_content_width: int | None = ..., - resilient_parsing: bool = ..., - allow_extra_args: bool | None = ..., - allow_interspersed_args: bool | None = ..., - ignore_unknown_options: bool | None = ..., - help_option_names: list[str] | None = ..., - token_normalize_func: Callable[[str], str] | None = ..., - color: bool | None = ..., - ) -> None: ... - @property - def meta(self) -> dict[str, Any]: ... - @property - def command_path(self) -> str: ... - def scope(self, cleanup: bool = ...) -> ContextManager[Context]: ... - def make_formatter(self) -> HelpFormatter: ... - def call_on_close(self, f: _CC) -> _CC: ... - def close(self) -> None: ... - def find_root(self) -> Context: ... - def find_object(self, object_type: type) -> Any: ... - def ensure_object(self, object_type: type) -> Any: ... - def lookup_default(self, name: str) -> Any: ... - def fail(self, message: str) -> NoReturn: ... - def abort(self) -> NoReturn: ... - def exit(self, code: int | str = ...) -> NoReturn: ... - def get_usage(self) -> str: ... - def get_help(self) -> str: ... - def invoke(self, callback: Command | Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... - def forward(self, callback: Command | Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... - -class BaseCommand: - allow_extra_args: bool - allow_interspersed_args: bool - ignore_unknown_options: bool - name: str - context_settings: dict[Any, Any] - def __init__(self, name: str, context_settings: dict[Any, Any] | None = ...) -> None: ... - def get_usage(self, ctx: Context) -> str: ... - def get_help(self, ctx: Context) -> str: ... - def make_context(self, info_name: str, args: list[str], parent: Context | None = ..., **extra: Any) -> Context: ... - def parse_args(self, ctx: Context, args: list[str]) -> list[str]: ... - def invoke(self, ctx: Context) -> Any: ... - def main( - self, - args: list[str] | None = ..., - prog_name: str | None = ..., - complete_var: str | None = ..., - standalone_mode: bool = ..., - **extra: Any, - ) -> Any: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - -class Command(BaseCommand): - callback: Callable[..., Any] | None - params: list[Parameter] - help: str | None - epilog: str | None - short_help: str | None - options_metavar: str - add_help_option: bool - no_args_is_help: bool - hidden: bool - deprecated: bool - def __init__( - self, - name: str, - context_settings: dict[Any, Any] | None = ..., - callback: Callable[..., Any] | None = ..., - params: list[Parameter] | None = ..., - help: str | None = ..., - epilog: str | None = ..., - short_help: str | None = ..., - options_metavar: str = ..., - add_help_option: bool = ..., - no_args_is_help: bool = ..., - hidden: bool = ..., - deprecated: bool = ..., - ) -> None: ... - def get_params(self, ctx: Context) -> list[Parameter]: ... - def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def collect_usage_pieces(self, ctx: Context) -> list[str]: ... - def get_help_option_names(self, ctx: Context) -> Set[str]: ... - def get_help_option(self, ctx: Context) -> Option | None: ... - def make_parser(self, ctx: Context) -> OptionParser: ... - def get_short_help_str(self, limit: int = ...) -> str: ... - def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: ... - -_T = TypeVar("_T") -_F = TypeVar("_F", bound=Callable[..., Any]) - -class MultiCommand(Command): - no_args_is_help: bool - invoke_without_command: bool - subcommand_metavar: str - chain: bool - result_callback: Callable[..., Any] - def __init__( - self, - name: str | None = ..., - invoke_without_command: bool = ..., - no_args_is_help: bool | None = ..., - subcommand_metavar: str | None = ..., - chain: bool = ..., - result_callback: Callable[..., Any] | None = ..., - **attrs: Any, - ) -> None: ... - def resultcallback(self, replace: bool = ...) -> Callable[[_F], _F]: ... - def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def resolve_command(self, ctx: Context, args: list[str]) -> Tuple[str, Command, list[str]]: ... - def get_command(self, ctx: Context, cmd_name: str) -> Command | None: ... - def list_commands(self, ctx: Context) -> Iterable[str]: ... - -class Group(MultiCommand): - commands: dict[str, Command] - def __init__(self, name: str | None = ..., commands: dict[str, Command] | None = ..., **attrs: Any) -> None: ... - def add_command(self, cmd: Command, name: str | None = ...) -> None: ... - def command(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Command]: ... - def group(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Group]: ... - -class CommandCollection(MultiCommand): - sources: list[MultiCommand] - def __init__(self, name: str | None = ..., sources: list[MultiCommand] | None = ..., **attrs: Any) -> None: ... - def add_source(self, multi_cmd: MultiCommand) -> None: ... - -class _ParamType: - name: str - is_composite: bool - envvar_list_splitter: str | None - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> Any: ... - def get_metavar(self, param: Parameter) -> str: ... - def get_missing_message(self, param: Parameter) -> str: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> Any: ... - def split_envvar_value(self, rv: str) -> list[str]: ... - def fail(self, message: str, param: Parameter | None = ..., ctx: Context | None = ...) -> NoReturn: ... - -# This type is here to resolve https://github.com/python/mypy/issues/5275 -_ConvertibleType = Union[ - type, _ParamType, Tuple[Union[type, _ParamType], ...], Callable[[str], Any], Callable[[Optional[str]], Any] -] - -class Parameter: - param_type_name: str - name: str - opts: list[str] - secondary_opts: list[str] - type: _ParamType - required: bool - callback: Callable[[Context, Parameter, str], Any] | None - nargs: int - multiple: bool - expose_value: bool - default: Any - is_eager: bool - metavar: str | None - envvar: str | list[str] | None - def __init__( - self, - param_decls: Iterable[str] | None = ..., - type: _ConvertibleType | None = ..., - required: bool = ..., - default: Any | None = ..., - callback: Callable[[Context, Parameter, str], Any] | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., - ) -> None: ... - @property - def human_readable_name(self) -> str: ... - def make_metavar(self) -> str: ... - def get_default(self, ctx: Context) -> Any: ... - def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: ... - def consume_value(self, ctx: Context, opts: dict[str, Any]) -> Any: ... - def type_cast_value(self, ctx: Context, value: Any) -> Any: ... - def process_value(self, ctx: Context, value: Any) -> Any: ... - def value_is_missing(self, value: Any) -> bool: ... - def full_process_value(self, ctx: Context, value: Any) -> Any: ... - def resolve_envvar_value(self, ctx: Context) -> str: ... - def value_from_envvar(self, ctx: Context) -> str | list[str]: ... - def handle_parse_result(self, ctx: Context, opts: dict[str, Any], args: list[str]) -> Tuple[Any, list[str]]: ... - def get_help_record(self, ctx: Context) -> Tuple[str, str]: ... - def get_usage_pieces(self, ctx: Context) -> list[str]: ... - def get_error_hint(self, ctx: Context) -> str: ... - -class Option(Parameter): - prompt: str # sic - confirmation_prompt: bool - hide_input: bool - is_flag: bool - flag_value: Any - is_bool_flag: bool - count: bool - multiple: bool - allow_from_autoenv: bool - help: str | None - hidden: bool - show_default: bool - show_choices: bool - show_envvar: bool - def __init__( - self, - param_decls: Iterable[str] | None = ..., - show_default: bool = ..., - prompt: bool | str = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool | None = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _ConvertibleType | None = ..., - help: str | None = ..., - hidden: bool = ..., - show_choices: bool = ..., - show_envvar: bool = ..., - **attrs: Any, - ) -> None: ... - def prompt_for_value(self, ctx: Context) -> Any: ... - -class Argument(Parameter): - def __init__(self, param_decls: Iterable[str] | None = ..., required: bool | None = ..., **attrs: Any) -> None: ... diff --git a/stubs/click/click/decorators.pyi b/stubs/click/click/decorators.pyi deleted file mode 100644 index 2401e06..0000000 --- a/stubs/click/click/decorators.pyi +++ /dev/null @@ -1,292 +0,0 @@ -from _typeshed import IdentityFunction -from distutils.version import Version -from typing import Any, Callable, Iterable, Text, Tuple, Type, TypeVar, Union, overload - -from click.core import Argument, Command, Context, Group, Option, Parameter, _ConvertibleType - -_T = TypeVar("_T") -_F = TypeVar("_F", bound=Callable[..., Any]) - -_Callback = Callable[[Context, Union[Option, Parameter], Any], Any] - -def pass_context(__f: _T) -> _T: ... -def pass_obj(__f: _T) -> _T: ... -def make_pass_decorator(object_type: type, ensure: bool = ...) -> IdentityFunction: ... - -# NOTE: Decorators below have **attrs converted to concrete constructor -# arguments from core.pyi to help with type checking. - -def command( - name: str | None = ..., - cls: Type[Command] | None = ..., - # Command - context_settings: dict[Any, Any] | None = ..., - help: str | None = ..., - epilog: str | None = ..., - short_help: str | None = ..., - options_metavar: str = ..., - add_help_option: bool = ..., - no_args_is_help: bool = ..., - hidden: bool = ..., - deprecated: bool = ..., -) -> Callable[[Callable[..., Any]], Command]: ... - -# This inherits attrs from Group, MultiCommand and Command. - -def group( - name: str | None = ..., - cls: Type[Command] = ..., - # Group - commands: dict[str, Command] | None = ..., - # MultiCommand - invoke_without_command: bool = ..., - no_args_is_help: bool | None = ..., - subcommand_metavar: str | None = ..., - chain: bool = ..., - result_callback: Callable[..., Any] | None = ..., - # Command - help: str | None = ..., - epilog: str | None = ..., - short_help: str | None = ..., - options_metavar: str = ..., - add_help_option: bool = ..., - hidden: bool = ..., - deprecated: bool = ..., - # User-defined - **kwargs: Any, -) -> Callable[[Callable[..., Any]], Group]: ... -def argument( - *param_decls: Text, - cls: Type[Argument] = ..., - # Argument - required: bool | None = ..., - # Parameter - type: _ConvertibleType | None = ..., - default: Any | None = ..., - callback: _Callback | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., - autocompletion: Callable[[Context, list[str], str], Iterable[str | Tuple[str, str]]] | None = ..., -) -> IdentityFunction: ... -@overload -def option( - *param_decls: Text, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool | None = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _ConvertibleType | None = ..., - help: Text | None = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - required: bool = ..., - callback: _Callback | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., - # User-defined - **kwargs: Any, -) -> IdentityFunction: ... -@overload -def option( - *param_decls: str, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool | None = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _T = ..., - help: str | None = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - required: bool = ..., - callback: Callable[[Context, Option | Parameter, bool | int | str], _T] | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., - # User-defined - **kwargs: Any, -) -> IdentityFunction: ... -@overload -def option( - *param_decls: str, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool | None = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: Type[str] = ..., - help: str | None = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - required: bool = ..., - callback: Callable[[Context, Option | Parameter, str], Any] = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., - # User-defined - **kwargs: Any, -) -> IdentityFunction: ... -@overload -def option( - *param_decls: str, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool | None = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: Type[int] = ..., - help: str | None = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - required: bool = ..., - callback: Callable[[Context, Option | Parameter, int], Any] = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., - # User-defined - **kwargs: Any, -) -> IdentityFunction: ... -def confirmation_option( - *param_decls: str, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _ConvertibleType | None = ..., - help: str = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - callback: _Callback | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., -) -> IdentityFunction: ... -def password_option( - *param_decls: str, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool | None = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _ConvertibleType | None = ..., - help: str | None = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - callback: _Callback | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., -) -> IdentityFunction: ... -def version_option( - version: str | Version | None = ..., - *param_decls: str, - cls: Type[Option] = ..., - # Option - prog_name: str | None = ..., - message: str | None = ..., - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _ConvertibleType | None = ..., - help: str = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - callback: _Callback | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., -) -> IdentityFunction: ... -def help_option( - *param_decls: str, - cls: Type[Option] = ..., - # Option - show_default: bool | Text = ..., - prompt: bool | Text = ..., - confirmation_prompt: bool = ..., - hide_input: bool = ..., - is_flag: bool = ..., - flag_value: Any | None = ..., - multiple: bool = ..., - count: bool = ..., - allow_from_autoenv: bool = ..., - type: _ConvertibleType | None = ..., - help: str = ..., - show_choices: bool = ..., - # Parameter - default: Any | None = ..., - callback: _Callback | None = ..., - nargs: int | None = ..., - metavar: str | None = ..., - expose_value: bool = ..., - is_eager: bool = ..., - envvar: str | list[str] | None = ..., -) -> IdentityFunction: ... diff --git a/stubs/click/click/exceptions.pyi b/stubs/click/click/exceptions.pyi deleted file mode 100644 index fa1a2c3..0000000 --- a/stubs/click/click/exceptions.pyi +++ /dev/null @@ -1,59 +0,0 @@ -from typing import IO, Any - -from click.core import Command, Context, Parameter - -class ClickException(Exception): - exit_code: int - message: str - def __init__(self, message: str) -> None: ... - def format_message(self) -> str: ... - def show(self, file: Any | None = ...) -> None: ... - -class UsageError(ClickException): - ctx: Context | None - cmd: Command | None - def __init__(self, message: str, ctx: Context | None = ...) -> None: ... - def show(self, file: IO[Any] | None = ...) -> None: ... - -class BadParameter(UsageError): - param: Parameter | None - param_hint: str | None - def __init__( - self, message: str, ctx: Context | None = ..., param: Parameter | None = ..., param_hint: str | None = ... - ) -> None: ... - -class MissingParameter(BadParameter): - param_type: str # valid values: 'parameter', 'option', 'argument' - def __init__( - self, - message: str | None = ..., - ctx: Context | None = ..., - param: Parameter | None = ..., - param_hint: str | None = ..., - param_type: str | None = ..., - ) -> None: ... - -class NoSuchOption(UsageError): - option_name: str - possibilities: list[str] | None - def __init__( - self, option_name: str, message: str | None = ..., possibilities: list[str] | None = ..., ctx: Context | None = ... - ) -> None: ... - -class BadOptionUsage(UsageError): - option_name: str - def __init__(self, option_name: str, message: str, ctx: Context | None = ...) -> None: ... - -class BadArgumentUsage(UsageError): - def __init__(self, message: str, ctx: Context | None = ...) -> None: ... - -class FileError(ClickException): - ui_filename: str - filename: str - def __init__(self, filename: str, hint: str | None = ...) -> None: ... - -class Abort(RuntimeError): ... - -class Exit(RuntimeError): - exit_code: int - def __init__(self, code: int = ...) -> None: ... diff --git a/stubs/click/click/formatting.pyi b/stubs/click/click/formatting.pyi deleted file mode 100644 index 08c607a..0000000 --- a/stubs/click/click/formatting.pyi +++ /dev/null @@ -1,29 +0,0 @@ -from typing import ContextManager, Generator, Iterable, Tuple - -FORCED_WIDTH: int | None - -def measure_table(rows: Iterable[Iterable[str]]) -> Tuple[int, ...]: ... -def iter_rows(rows: Iterable[Iterable[str]], col_count: int) -> Generator[Tuple[str, ...], None, None]: ... -def wrap_text( - text: str, width: int = ..., initial_indent: str = ..., subsequent_indent: str = ..., preserve_paragraphs: bool = ... -) -> str: ... - -class HelpFormatter: - indent_increment: int - width: int | None - current_indent: int - buffer: list[str] - def __init__(self, indent_increment: int = ..., width: int | None = ..., max_width: int | None = ...) -> None: ... - def write(self, string: str) -> None: ... - def indent(self) -> None: ... - def dedent(self) -> None: ... - def write_usage(self, prog: str, args: str = ..., prefix: str = ...) -> None: ... - def write_heading(self, heading: str) -> None: ... - def write_paragraph(self) -> None: ... - def write_text(self, text: str) -> None: ... - def write_dl(self, rows: Iterable[Iterable[str]], col_max: int = ..., col_spacing: int = ...) -> None: ... - def section(self, name: str) -> ContextManager[None]: ... - def indentation(self) -> ContextManager[None]: ... - def getvalue(self) -> str: ... - -def join_options(options: list[str]) -> Tuple[str, bool]: ... diff --git a/stubs/click/click/globals.pyi b/stubs/click/click/globals.pyi deleted file mode 100644 index bdf2599..0000000 --- a/stubs/click/click/globals.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from click.core import Context - -def get_current_context(silent: bool = ...) -> Context: ... -def push_context(ctx: Context) -> None: ... -def pop_context() -> None: ... -def resolve_color_default(color: bool | None = ...) -> bool | None: ... diff --git a/stubs/click/click/parser.pyi b/stubs/click/click/parser.pyi deleted file mode 100644 index 7032401..0000000 --- a/stubs/click/click/parser.pyi +++ /dev/null @@ -1,65 +0,0 @@ -from typing import Any, Iterable, Set, Tuple - -from click.core import Context - -def _unpack_args(args: Iterable[str], nargs_spec: Iterable[int]) -> Tuple[Tuple[Tuple[str, ...] | None, ...], list[str]]: ... -def split_opt(opt: str) -> Tuple[str, str]: ... -def normalize_opt(opt: str, ctx: Context) -> str: ... -def split_arg_string(string: str) -> list[str]: ... - -class Option: - dest: str - action: str - nargs: int - const: Any - obj: Any - prefixes: Set[str] - _short_opts: list[str] - _long_opts: list[str] - def __init__( - self, - opts: Iterable[str], - dest: str, - action: str | None = ..., - nargs: int = ..., - const: Any | None = ..., - obj: Any | None = ..., - ) -> None: ... - @property - def takes_value(self) -> bool: ... - def process(self, value: Any, state: ParsingState) -> None: ... - -class Argument: - dest: str - nargs: int - obj: Any - def __init__(self, dest: str, nargs: int = ..., obj: Any | None = ...) -> None: ... - def process(self, value: Any, state: ParsingState) -> None: ... - -class ParsingState: - opts: dict[str, Any] - largs: list[str] - rargs: list[str] - order: list[Any] - def __init__(self, rargs: list[str]) -> None: ... - -class OptionParser: - ctx: Context | None - allow_interspersed_args: bool - ignore_unknown_options: bool - _short_opt: dict[str, Option] - _long_opt: dict[str, Option] - _opt_prefixes: Set[str] - _args: list[Argument] - def __init__(self, ctx: Context | None = ...) -> None: ... - def add_option( - self, - opts: Iterable[str], - dest: str, - action: str | None = ..., - nargs: int = ..., - const: Any | None = ..., - obj: Any | None = ..., - ) -> None: ... - def add_argument(self, dest: str, nargs: int = ..., obj: Any | None = ...) -> None: ... - def parse_args(self, args: list[str]) -> Tuple[dict[str, Any], list[str], list[Any]]: ... diff --git a/stubs/click/click/termui.pyi b/stubs/click/click/termui.pyi deleted file mode 100644 index 8345c47..0000000 --- a/stubs/click/click/termui.pyi +++ /dev/null @@ -1,104 +0,0 @@ -from typing import IO, Any, Callable, Generator, Iterable, Text, Tuple, TypeVar, overload - -from click._termui_impl import ProgressBar as _ProgressBar -from click.core import _ConvertibleType - -def hidden_prompt_func(prompt: str) -> str: ... -def _build_prompt(text: str, suffix: str, show_default: bool = ..., default: str | None = ...) -> str: ... -def prompt( - text: str, - default: str | None = ..., - hide_input: bool = ..., - confirmation_prompt: bool = ..., - type: _ConvertibleType | None = ..., - value_proc: Callable[[str | None], Any] | None = ..., - prompt_suffix: str = ..., - show_default: bool = ..., - err: bool = ..., - show_choices: bool = ..., -) -> Any: ... -def confirm( - text: str, default: bool = ..., abort: bool = ..., prompt_suffix: str = ..., show_default: bool = ..., err: bool = ... -) -> bool: ... -def get_terminal_size() -> Tuple[int, int]: ... -def echo_via_pager( - text_or_generator: str | Iterable[str] | Callable[[], Generator[str, None, None]], color: bool | None = ... -) -> None: ... - -_T = TypeVar("_T") - -@overload -def progressbar( - iterable: Iterable[_T], - length: int | None = ..., - label: str | None = ..., - show_eta: bool = ..., - show_percent: bool | None = ..., - show_pos: bool = ..., - item_show_func: Callable[[_T], str] | None = ..., - fill_char: str = ..., - empty_char: str = ..., - bar_template: str = ..., - info_sep: str = ..., - width: int = ..., - file: IO[Any] | None = ..., - color: bool | None = ..., -) -> _ProgressBar[_T]: ... -@overload -def progressbar( - iterable: None = ..., - length: int | None = ..., - label: str | None = ..., - show_eta: bool = ..., - show_percent: bool | None = ..., - show_pos: bool = ..., - item_show_func: Callable[[Any], str] | None = ..., - fill_char: str = ..., - empty_char: str = ..., - bar_template: str = ..., - info_sep: str = ..., - width: int = ..., - file: IO[Any] | None = ..., - color: bool | None = ..., -) -> _ProgressBar[int]: ... -def clear() -> None: ... -def style( - text: Text, - fg: Text | None = ..., - bg: Text | None = ..., - bold: bool | None = ..., - dim: bool | None = ..., - underline: bool | None = ..., - blink: bool | None = ..., - reverse: bool | None = ..., - reset: bool = ..., -) -> str: ... -def unstyle(text: Text) -> str: ... - -# Styling options copied from style() for nicer type checking. -def secho( - message: str | None = ..., - file: IO[Any] | None = ..., - nl: bool = ..., - err: bool = ..., - color: bool | None = ..., - fg: str | None = ..., - bg: str | None = ..., - bold: bool | None = ..., - dim: bool | None = ..., - underline: bool | None = ..., - blink: bool | None = ..., - reverse: bool | None = ..., - reset: bool = ..., -) -> None: ... -def edit( - text: str | None = ..., - editor: str | None = ..., - env: str | None = ..., - require_save: bool = ..., - extension: str = ..., - filename: str | None = ..., -) -> str: ... -def launch(url: str, wait: bool = ..., locate: bool = ...) -> int: ... -def getchar(echo: bool = ...) -> Text: ... -def pause(info: str = ..., err: bool = ...) -> None: ... diff --git a/stubs/click/click/testing.pyi b/stubs/click/click/testing.pyi deleted file mode 100644 index d83881b..0000000 --- a/stubs/click/click/testing.pyi +++ /dev/null @@ -1,65 +0,0 @@ -import io -from typing import IO, Any, BinaryIO, ContextManager, Iterable, Mapping, Text, Tuple -from typing_extensions import Literal - -from .core import BaseCommand - -clickpkg: Any - -class EchoingStdin: - def __init__(self, input: BinaryIO, output: BinaryIO) -> None: ... - def __getattr__(self, x: str) -> Any: ... - def read(self, n: int = ...) -> bytes: ... - def readline(self, n: int = ...) -> bytes: ... - def readlines(self) -> list[bytes]: ... - def __iter__(self) -> Iterable[bytes]: ... - -def make_input_stream(input: bytes | Text | IO[Any] | None, charset: Text) -> BinaryIO: ... - -class Result: - runner: CliRunner - exit_code: int - exception: Any - exc_info: Any | None - stdout_bytes: bytes - stderr_bytes: bytes - def __init__( - self, - runner: CliRunner, - stdout_bytes: bytes, - stderr_bytes: bytes, - exit_code: int, - exception: Any, - exc_info: Any | None = ..., - ) -> None: ... - @property - def output(self) -> Text: ... - @property - def stdout(self) -> Text: ... - @property - def stderr(self) -> Text: ... - -class CliRunner: - charset: str - env: Mapping[str, str] - echo_stdin: bool - mix_stderr: bool - def __init__( - self, charset: Text | None = ..., env: Mapping[str, str] | None = ..., echo_stdin: bool = ..., mix_stderr: bool = ... - ) -> None: ... - def get_default_prog_name(self, cli: BaseCommand) -> str: ... - def make_env(self, overrides: Mapping[str, str] | None = ...) -> dict[str, str]: ... - def isolation( - self, input: bytes | Text | IO[Any] | None = ..., env: Mapping[str, str] | None = ..., color: bool = ... - ) -> ContextManager[Tuple[io.BytesIO, io.BytesIO | Literal[False]]]: ... - def invoke( - self, - cli: BaseCommand, - args: str | Iterable[str] | None = ..., - input: bytes | Text | IO[Any] | None = ..., - env: Mapping[str, str] | None = ..., - catch_exceptions: bool = ..., - color: bool = ..., - **extra: Any, - ) -> Result: ... - def isolated_filesystem(self) -> ContextManager[str]: ... diff --git a/stubs/click/click/types.pyi b/stubs/click/click/types.pyi deleted file mode 100644 index f1e9b9c..0000000 --- a/stubs/click/click/types.pyi +++ /dev/null @@ -1,125 +0,0 @@ -import datetime -import uuid -from typing import IO, Any, Callable, Generic, Iterable, Optional, Sequence, Text, Tuple as _PyTuple, Type, TypeVar, Union - -from click.core import Context, Parameter, _ConvertibleType, _ParamType - -ParamType = _ParamType - -class BoolParamType(ParamType): - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> bool: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> bool: ... - -class CompositeParamType(ParamType): - arity: int - -class Choice(ParamType): - choices: Iterable[str] - case_sensitive: bool - def __init__(self, choices: Iterable[str], case_sensitive: bool = ...) -> None: ... - -class DateTime(ParamType): - formats: Sequence[str] - def __init__(self, formats: Sequence[str] | None = ...) -> None: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> datetime.datetime: ... - -class FloatParamType(ParamType): - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> float: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> float: ... - -class FloatRange(FloatParamType): - min: float | None - max: float | None - clamp: bool - def __init__(self, min: float | None = ..., max: float | None = ..., clamp: bool = ...) -> None: ... - -class File(ParamType): - mode: str - encoding: str | None - errors: str | None - lazy: bool | None - atomic: bool - def __init__( - self, - mode: Text = ..., - encoding: str | None = ..., - errors: str | None = ..., - lazy: bool | None = ..., - atomic: bool | None = ..., - ) -> None: ... - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> IO[Any]: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> IO[Any]: ... - def resolve_lazy_flag(self, value: str) -> bool: ... - -_F = TypeVar("_F") # result of the function -_Func = Callable[[Optional[str]], _F] - -class FuncParamType(ParamType, Generic[_F]): - func: _Func[_F] - def __init__(self, func: _Func[_F]) -> None: ... - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> _F: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> _F: ... - -class IntParamType(ParamType): - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> int: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> int: ... - -class IntRange(IntParamType): - min: int | None - max: int | None - clamp: bool - def __init__(self, min: int | None = ..., max: int | None = ..., clamp: bool = ...) -> None: ... - -_PathType = TypeVar("_PathType", str, bytes) -_PathTypeBound = Union[Type[str], Type[bytes]] - -class Path(ParamType): - exists: bool - file_okay: bool - dir_okay: bool - writable: bool - readable: bool - resolve_path: bool - allow_dash: bool - type: _PathTypeBound | None - def __init__( - self, - exists: bool = ..., - file_okay: bool = ..., - dir_okay: bool = ..., - writable: bool = ..., - readable: bool = ..., - resolve_path: bool = ..., - allow_dash: bool = ..., - path_type: Type[_PathType] | None = ..., - ) -> None: ... - def coerce_path_result(self, rv: str | bytes) -> _PathType: ... - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> _PathType: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> _PathType: ... - -class StringParamType(ParamType): - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> str: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> str: ... - -class Tuple(CompositeParamType): - types: list[ParamType] - def __init__(self, types: Iterable[Any]) -> None: ... - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> Tuple: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> Tuple: ... - -class UnprocessedParamType(ParamType): ... - -class UUIDParameterType(ParamType): - def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> uuid.UUID: ... - def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> uuid.UUID: ... - -def convert_type(ty: _ConvertibleType | None, default: Any | None = ...) -> ParamType: ... - -# parameter type shortcuts - -BOOL: BoolParamType -FLOAT: FloatParamType -INT: IntParamType -STRING: StringParamType -UNPROCESSED: UnprocessedParamType -UUID: UUIDParameterType diff --git a/stubs/click/click/utils.pyi b/stubs/click/click/utils.pyi deleted file mode 100644 index f97dd8e..0000000 --- a/stubs/click/click/utils.pyi +++ /dev/null @@ -1,48 +0,0 @@ -from types import TracebackType -from typing import IO, Any, AnyStr, Generic, Iterator, Text, Type, TypeVar - -_T = TypeVar("_T") - -def _posixify(name: str) -> str: ... -def safecall(func: _T) -> _T: ... -def make_str(value: Any) -> str: ... -def make_default_short_help(help: str, max_length: int = ...) -> str: ... - -class LazyFile(object): - name: str - mode: str - encoding: str | None - errors: str - atomic: bool - def __init__( - self, filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., atomic: bool = ... - ) -> None: ... - def open(self) -> IO[Any]: ... - def close(self) -> None: ... - def close_intelligently(self) -> None: ... - def __enter__(self) -> LazyFile: ... - def __exit__( - self, exctype: Type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None - ) -> None: ... - def __iter__(self) -> Iterator[Any]: ... - -class KeepOpenFile(Generic[AnyStr]): - _file: IO[AnyStr] - def __init__(self, file: IO[AnyStr]) -> None: ... - def __enter__(self) -> KeepOpenFile[AnyStr]: ... - def __exit__( - self, exctype: Type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None - ) -> None: ... - def __iter__(self) -> Iterator[AnyStr]: ... - -def echo( - message: object = ..., file: IO[Text] | None = ..., nl: bool = ..., err: bool = ..., color: bool | None = ... -) -> None: ... -def get_binary_stream(name: str) -> IO[bytes]: ... -def get_text_stream(name: str, encoding: str | None = ..., errors: str = ...) -> IO[str]: ... -def open_file( - filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., lazy: bool = ..., atomic: bool = ... -) -> Any: ... # really IO | LazyFile | KeepOpenFile -def get_os_args() -> list[str]: ... -def format_filename(filename: str, shorten: bool = ...) -> str: ... -def get_app_dir(app_name: str, roaming: bool = ..., force_posix: bool = ...) -> str: ... diff --git a/stubs/colorama/@tests/stubtest_allowlist.txt b/stubs/colorama/@tests/stubtest_allowlist.txt index e78dac9..e6c8d6c 100644 --- a/stubs/colorama/@tests/stubtest_allowlist.txt +++ b/stubs/colorama/@tests/stubtest_allowlist.txt @@ -1,3 +1,4 @@ +# These are defined as ints, but later are converted to strings via magic: colorama.ansi.AnsiBack.BLACK colorama.ansi.AnsiBack.BLUE colorama.ansi.AnsiBack.CYAN @@ -36,5 +37,20 @@ colorama.ansi.AnsiStyle.BRIGHT colorama.ansi.AnsiStyle.DIM colorama.ansi.AnsiStyle.NORMAL colorama.ansi.AnsiStyle.RESET_ALL + +# These are defined as None, but on initialization are set to correct values: colorama.initialise.wrapped_stderr colorama.initialise.wrapped_stdout + +# These are re-exports that are implementation detail: +colorama.ansitowin32.BEL +colorama.ansitowin32.windll +colorama.winterm.get_osfhandle + +# These are only available on Windows: +colorama.winterm.WinColor +colorama.winterm.WinStyle +colorama.winterm.WinTerm + +# Not planning on writing stubs for tests: +colorama.tests.* diff --git a/stubs/colorama/METADATA.toml b/stubs/colorama/METADATA.toml index 337e55f..de6579f 100644 --- a/stubs/colorama/METADATA.toml +++ b/stubs/colorama/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.4" -python2 = true \ No newline at end of file +version = "0.4.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/colorama/colorama/ansitowin32.pyi b/stubs/colorama/colorama/ansitowin32.pyi index 117fe8f..f406f2e 100644 --- a/stubs/colorama/colorama/ansitowin32.pyi +++ b/stubs/colorama/colorama/ansitowin32.pyi @@ -1,6 +1,10 @@ import sys from _typeshed import SupportsWrite -from typing import Any, Callable, Dict, Optional, Pattern, Sequence, TextIO, Tuple, Union +from collections.abc import Callable, Sequence +from re import Pattern +from types import TracebackType +from typing import Any, TextIO +from typing_extensions import TypeAlias if sys.platform == "win32": from .winterm import WinTerm @@ -13,14 +17,16 @@ class StreamWrapper: def __init__(self, wrapped: TextIO, converter: SupportsWrite[str]) -> None: ... def __getattr__(self, name: str) -> Any: ... def __enter__(self, *args: object, **kwargs: object) -> TextIO: ... - def __exit__(self, *args: Any, **kwargs: Any) -> None: ... + def __exit__( + self, __t: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None, **kwargs: Any + ) -> None: ... def write(self, text: str) -> None: ... def isatty(self) -> bool: ... @property def closed(self) -> bool: ... -_WinTermCall = Callable[[Optional[int], bool, bool], None] -_WinTermCallDict = Dict[int, Union[Tuple[_WinTermCall], Tuple[_WinTermCall, int], Tuple[_WinTermCall, int, bool]]] +_WinTermCall: TypeAlias = Callable[[int | None, bool, bool], None] +_WinTermCallDict: TypeAlias = dict[int, tuple[_WinTermCall] | tuple[_WinTermCall, int] | tuple[_WinTermCall, int, bool]] class AnsiToWin32: ANSI_CSI_RE: Pattern[str] = ... @@ -40,6 +46,7 @@ class AnsiToWin32: def write_and_convert(self, text: str) -> None: ... def write_plain_text(self, text: str, start: int, end: int) -> None: ... def convert_ansi(self, paramstring: str, command: str) -> None: ... - def extract_params(self, command: str, paramstring: str) -> Tuple[int, ...]: ... + def extract_params(self, command: str, paramstring: str) -> tuple[int, ...]: ... def call_win32(self, command: str, params: Sequence[int]) -> None: ... def convert_osc(self, text: str) -> str: ... + def flush(self) -> None: ... diff --git a/stubs/colorama/colorama/initialise.pyi b/stubs/colorama/colorama/initialise.pyi index f76f826..b607956 100644 --- a/stubs/colorama/colorama/initialise.pyi +++ b/stubs/colorama/colorama/initialise.pyi @@ -1,4 +1,5 @@ -from typing import Any, ContextManager, TextIO +from contextlib import AbstractContextManager +from typing import Any, TextIO from .ansitowin32 import StreamWrapper @@ -7,12 +8,14 @@ orig_stderr: TextIO | None wrapped_stdout: TextIO | StreamWrapper wrapped_stderr: TextIO | StreamWrapper atexit_done: bool +fixed_windows_console: bool def reset_all() -> None: ... def init(autoreset: bool = ..., convert: bool | None = ..., strip: bool | None = ..., wrap: bool = ...) -> None: ... def deinit() -> None: ... -def colorama_text(*args: Any, **kwargs: Any) -> ContextManager[None]: ... +def colorama_text(*args: Any, **kwargs: Any) -> AbstractContextManager[None]: ... def reinit() -> None: ... def wrap_stream( stream: TextIO, convert: bool | None, strip: bool | None, autoreset: bool, wrap: bool ) -> TextIO | StreamWrapper: ... +def just_fix_windows_console() -> None: ... diff --git a/stubs/colorama/colorama/win32.pyi b/stubs/colorama/colorama/win32.pyi index 37e6a0b..59d1601 100644 --- a/stubs/colorama/colorama/win32.pyi +++ b/stubs/colorama/colorama/win32.pyi @@ -1,22 +1,23 @@ import sys -from typing import Callable +from collections.abc import Callable from typing_extensions import Literal STDOUT: Literal[-11] STDERR: Literal[-12] +ENABLE_VIRTUAL_TERMINAL_PROCESSING: int if sys.platform == "win32": from ctypes import LibraryLoader, Structure, WinDLL, wintypes windll: LibraryLoader[WinDLL] COORD = wintypes._COORD + class CONSOLE_SCREEN_BUFFER_INFO(Structure): dwSize: COORD dwCursorPosition: COORD wAttributes: wintypes.WORD srWindow: wintypes.SMALL_RECT dwMaximumWindowSize: COORD - def __str__(self) -> str: ... def winapi_test() -> bool: ... def GetConsoleScreenBufferInfo(stream_id: int = ...) -> CONSOLE_SCREEN_BUFFER_INFO: ... def SetConsoleTextAttribute(stream_id: int, attrs: wintypes.WORD) -> wintypes.BOOL: ... diff --git a/stubs/colorama/colorama/winterm.pyi b/stubs/colorama/colorama/winterm.pyi index a827463..7740ad7 100644 --- a/stubs/colorama/colorama/winterm.pyi +++ b/stubs/colorama/colorama/winterm.pyi @@ -3,6 +3,7 @@ import sys if sys.platform == "win32": from . import win32 + class WinColor: BLACK: int = ... BLUE: int = ... @@ -12,10 +13,12 @@ if sys.platform == "win32": MAGENTA: int = ... YELLOW: int = ... GREY: int = ... + class WinStyle: NORMAL: int = ... BRIGHT: int = ... BRIGHT_BACKGROUND: int = ... + class WinTerm: def __init__(self) -> None: ... def get_attrs(self) -> int: ... @@ -31,3 +34,5 @@ if sys.platform == "win32": def erase_screen(self, mode: int = ..., on_stderr: bool = ...) -> None: ... def erase_line(self, mode: int = ..., on_stderr: bool = ...) -> None: ... def set_title(self, title: str) -> None: ... + +def enable_vt_processing(fd: int) -> bool: ... diff --git a/stubs/commonmark/METADATA.toml b/stubs/commonmark/METADATA.toml index 16fd217..51e869b 100644 --- a/stubs/commonmark/METADATA.toml +++ b/stubs/commonmark/METADATA.toml @@ -1 +1 @@ -version = "0.9" +version = "0.9.*" diff --git a/stubs/console-menu/METADATA.toml b/stubs/console-menu/METADATA.toml new file mode 100644 index 0000000..161ee7a --- /dev/null +++ b/stubs/console-menu/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.7.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/console-menu/consolemenu/__init__.pyi b/stubs/console-menu/consolemenu/__init__.pyi new file mode 100644 index 0000000..8bc6c6c --- /dev/null +++ b/stubs/console-menu/consolemenu/__init__.pyi @@ -0,0 +1,6 @@ +from . import items as items +from .console_menu import ConsoleMenu as ConsoleMenu, Screen as Screen, clear_terminal as clear_terminal +from .menu_formatter import MenuFormatBuilder as MenuFormatBuilder +from .multiselect_menu import MultiSelectMenu as MultiSelectMenu +from .prompt_utils import PromptUtils as PromptUtils +from .selection_menu import SelectionMenu as SelectionMenu diff --git a/stubs/console-menu/consolemenu/console_menu.pyi b/stubs/console-menu/consolemenu/console_menu.pyi new file mode 100644 index 0000000..0d70171 --- /dev/null +++ b/stubs/console-menu/consolemenu/console_menu.pyi @@ -0,0 +1,87 @@ +from collections.abc import Callable + +from consolemenu.menu_formatter import MenuFormatBuilder as MenuFormatBuilder +from consolemenu.screen import Screen as Screen + +class ConsoleMenu: + currently_active_menu: ConsoleMenu | None + screen: Screen + clear_screen_before_render: bool + formatter: MenuFormatBuilder + title: str | Callable[[], str] | None + subtitle: str | Callable[[], str] | None + prologue_text: str | Callable[[], str] | None + epilogue_text: str | Callable[[], str] | None + highlight: None + normal: None + show_exit_option: bool + items: list[MenuItem] + parent: ConsoleMenu | None + exit_item: ExitItem + current_option: int + selected_option: int + returned_value: object | None + should_exit: bool + previous_active_menu: ConsoleMenu | None + def __init__( + self, + title: str | Callable[[], str] | None = ..., + subtitle: str | Callable[[], str] | None = ..., + screen: Screen | None = ..., + formatter: MenuFormatBuilder | None = ..., + prologue_text: str | Callable[[], str] | None = ..., + epilogue_text: str | Callable[[], str] | None = ..., + clear_screen: bool = ..., + show_exit_option: bool = ..., + exit_option_text: str = ..., + ) -> None: ... + @property + def current_item(self) -> MenuItem | None: ... + @property + def selected_item(self) -> MenuItem | None: ... + def append_item(self, item: MenuItem) -> None: ... + def remove_item(self, item: MenuItem) -> bool: ... + def add_exit(self) -> bool: ... + def remove_exit(self) -> bool: ... + def is_selected_item_exit(self) -> bool: ... + def start(self, show_exit_option: bool | None = ...) -> None: ... + def show(self, show_exit_option: bool | None = ...) -> None: ... + def draw(self) -> None: ... + def is_running(self) -> bool: ... + def wait_for_start(self, timeout: float | None = ...) -> bool: ... + def is_alive(self) -> bool: ... + def pause(self) -> None: ... + def resume(self) -> None: ... + def join(self, timeout: float | None = ...) -> None: ... + def get_input(self) -> int: ... + def process_user_input(self) -> int | None: ... + def go_to(self, option: int) -> None: ... + def go_down(self) -> None: ... + def go_up(self) -> None: ... + def select(self) -> None: ... + def exit(self) -> None: ... + def clear_screen(self) -> None: ... + def get_title(self) -> str: ... + def get_subtitle(self) -> str: ... + def get_prologue_text(self) -> str: ... + def get_epilogue_text(self) -> str: ... + +class MenuItem: + text: str + menu: ConsoleMenu | None + should_exit: bool + index_item_separator: str + def __init__(self, text: str | Callable[[], str], menu: ConsoleMenu | None = ..., should_exit: bool = ...) -> None: ... + def show(self, index: int) -> str: ... + def set_up(self) -> None: ... + def action(self) -> None: ... + def clean_up(self) -> None: ... + def get_return(self) -> object: ... + def __eq__(self, o: MenuItem) -> bool: ... # type: ignore[override] + def get_text(self) -> str: ... + +class ExitItem(MenuItem): + def __init__(self, text: str | Callable[[], str] = ..., menu: ConsoleMenu | None = ...) -> None: ... + def show(self, index: int, available_width: None = ...) -> str: ... + +def clear_terminal() -> None: ... diff --git a/stubs/console-menu/consolemenu/format/__init__.pyi b/stubs/console-menu/consolemenu/format/__init__.pyi new file mode 100644 index 0000000..f43b6c5 --- /dev/null +++ b/stubs/console-menu/consolemenu/format/__init__.pyi @@ -0,0 +1,14 @@ +from .menu_borders import ( + AsciiBorderStyle as AsciiBorderStyle, + DoubleLineBorderStyle as DoubleLineBorderStyle, + DoubleLineOuterLightInnerBorderStyle as DoubleLineOuterLightInnerBorderStyle, + HeavyBorderStyle as HeavyBorderStyle, + HeavyOuterLightInnerBorderStyle as HeavyOuterLightInnerBorderStyle, + LightBorderStyle as LightBorderStyle, + MenuBorderStyle as MenuBorderStyle, + MenuBorderStyleFactory as MenuBorderStyleFactory, + MenuBorderStyleType as MenuBorderStyleType, +) +from .menu_margins import MenuMargins as MenuMargins +from .menu_padding import MenuPadding as MenuPadding +from .menu_style import MenuStyle as MenuStyle diff --git a/stubs/console-menu/consolemenu/format/menu_borders.pyi b/stubs/console-menu/consolemenu/format/menu_borders.pyi new file mode 100644 index 0000000..9710b4a --- /dev/null +++ b/stubs/console-menu/consolemenu/format/menu_borders.pyi @@ -0,0 +1,194 @@ +import logging + +class MenuBorderStyle: + @property + def bottom_left_corner(self) -> str: ... + @property + def bottom_right_corner(self) -> str: ... + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + @property + def top_left_corner(self) -> str: ... + @property + def top_right_corner(self) -> str: ... + +class AsciiBorderStyle(MenuBorderStyle): + @property + def bottom_left_corner(self) -> str: ... + @property + def bottom_right_corner(self) -> str: ... + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + @property + def top_left_corner(self) -> str: ... + @property + def top_right_corner(self) -> str: ... + +class LightBorderStyle(MenuBorderStyle): + @property + def bottom_left_corner(self) -> str: ... + @property + def bottom_right_corner(self) -> str: ... + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + @property + def top_left_corner(self) -> str: ... + @property + def top_right_corner(self) -> str: ... + +class HeavyBorderStyle(MenuBorderStyle): + @property + def bottom_left_corner(self) -> str: ... + @property + def bottom_right_corner(self) -> str: ... + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + @property + def top_left_corner(self) -> str: ... + @property + def top_right_corner(self) -> str: ... + +class HeavyOuterLightInnerBorderStyle(HeavyBorderStyle): + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + +class DoubleLineBorderStyle(MenuBorderStyle): + @property + def bottom_left_corner(self) -> str: ... + @property + def bottom_right_corner(self) -> str: ... + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + @property + def top_left_corner(self) -> str: ... + @property + def top_right_corner(self) -> str: ... + +class DoubleLineOuterLightInnerBorderStyle(DoubleLineBorderStyle): + @property + def inner_horizontal(self) -> str: ... + @property + def inner_vertical(self) -> str: ... + @property + def intersection(self) -> str: ... + @property + def outer_horizontal_inner_down(self) -> str: ... + @property + def outer_horizontal_inner_up(self) -> str: ... + @property + def outer_vertical_inner_left(self) -> str: ... + @property + def outer_vertical_inner_right(self) -> str: ... + +class MenuBorderStyleType: + ASCII_BORDER: int + LIGHT_BORDER: int + HEAVY_BORDER: int + DOUBLE_LINE_BORDER: int + HEAVY_OUTER_LIGHT_INNER_BORDER: int + DOUBLE_LINE_OUTER_LIGHT_INNER_BORDER: int + +class MenuBorderStyleFactory: + logger: logging.Logger + def __init__(self) -> None: ... + def create_border(self, border_style_type: MenuBorderStyleType) -> MenuBorderStyle: ... + def create_ascii_border(self) -> AsciiBorderStyle: ... + def create_light_border(self) -> LightBorderStyle: ... + def create_heavy_border(self) -> HeavyBorderStyle: ... + def create_heavy_outer_light_inner_border(self) -> HeavyOuterLightInnerBorderStyle: ... + def create_doubleline_border(self) -> DoubleLineBorderStyle: ... + def create_doubleline_outer_light_inner_border(self) -> DoubleLineOuterLightInnerBorderStyle: ... + @staticmethod + def is_win_python35_or_earlier() -> bool: ... diff --git a/stubs/console-menu/consolemenu/format/menu_margins.pyi b/stubs/console-menu/consolemenu/format/menu_margins.pyi new file mode 100644 index 0000000..f37b333 --- /dev/null +++ b/stubs/console-menu/consolemenu/format/menu_margins.pyi @@ -0,0 +1,18 @@ +class MenuMargins: + def __init__(self, top: int = ..., left: int = ..., bottom: int = ..., right: int = ...) -> None: ... + @property + def left(self) -> int: ... + @left.setter + def left(self, left: int) -> None: ... + @property + def right(self) -> int: ... + @right.setter + def right(self, right: int) -> None: ... + @property + def top(self) -> int: ... + @top.setter + def top(self, top: int) -> None: ... + @property + def bottom(self) -> int: ... + @bottom.setter + def bottom(self, bottom: int) -> None: ... diff --git a/stubs/console-menu/consolemenu/format/menu_padding.pyi b/stubs/console-menu/consolemenu/format/menu_padding.pyi new file mode 100644 index 0000000..46855b2 --- /dev/null +++ b/stubs/console-menu/consolemenu/format/menu_padding.pyi @@ -0,0 +1,18 @@ +class MenuPadding: + def __init__(self, top: int = ..., left: int = ..., bottom: int = ..., right: int = ...) -> None: ... + @property + def left(self) -> int: ... + @left.setter + def left(self, left: int) -> None: ... + @property + def right(self) -> int: ... + @right.setter + def right(self, right: int) -> None: ... + @property + def top(self) -> int: ... + @top.setter + def top(self, top: int) -> None: ... + @property + def bottom(self) -> int: ... + @bottom.setter + def bottom(self, bottom: int) -> None: ... diff --git a/stubs/console-menu/consolemenu/format/menu_style.pyi b/stubs/console-menu/consolemenu/format/menu_style.pyi new file mode 100644 index 0000000..e7e3c11 --- /dev/null +++ b/stubs/console-menu/consolemenu/format/menu_style.pyi @@ -0,0 +1,29 @@ +from consolemenu.format.menu_borders import MenuBorderStyle as MenuBorderStyle, MenuBorderStyleFactory as MenuBorderStyleFactory +from consolemenu.format.menu_margins import MenuMargins as MenuMargins +from consolemenu.format.menu_padding import MenuPadding as MenuPadding + +class MenuStyle: + def __init__( + self, + margins: MenuMargins | None = ..., + padding: MenuPadding | None = ..., + border_style: MenuBorderStyle | None = ..., + border_style_type: int | None = ..., + border_style_factory: MenuBorderStyleFactory | None = ..., + ) -> None: ... + @property + def margins(self) -> MenuMargins: ... + @margins.setter + def margins(self, margins: MenuMargins) -> None: ... + @property + def padding(self) -> MenuPadding: ... + @padding.setter + def padding(self, padding: MenuPadding) -> None: ... + @property + def border_style(self) -> MenuBorderStyle: ... + @border_style.setter + def border_style(self, border_style: MenuBorderStyle) -> None: ... + @property + def border_style_factory(self) -> MenuBorderStyleFactory: ... + @border_style_factory.setter + def border_style_factory(self, border_style_factory: MenuBorderStyleFactory) -> None: ... diff --git a/stubs/console-menu/consolemenu/items/__init__.pyi b/stubs/console-menu/consolemenu/items/__init__.pyi new file mode 100644 index 0000000..570ff3f --- /dev/null +++ b/stubs/console-menu/consolemenu/items/__init__.pyi @@ -0,0 +1,6 @@ +from ..console_menu import ExitItem as ExitItem, MenuItem as MenuItem +from .command_item import CommandItem as CommandItem +from .external_item import ExternalItem as ExternalItem +from .function_item import FunctionItem as FunctionItem +from .selection_item import SelectionItem as SelectionItem +from .submenu_item import SubmenuItem as SubmenuItem diff --git a/stubs/console-menu/consolemenu/items/command_item.pyi b/stubs/console-menu/consolemenu/items/command_item.pyi new file mode 100644 index 0000000..f44003f --- /dev/null +++ b/stubs/console-menu/consolemenu/items/command_item.pyi @@ -0,0 +1,12 @@ +from consolemenu.console_menu import ConsoleMenu +from consolemenu.items import ExternalItem as ExternalItem + +class CommandItem(ExternalItem): + command: str + arguments: list[str] + exit_status: int | None + def __init__( + self, text: str, command: str, arguments: list[str] | None = ..., menu: ConsoleMenu | None = ..., should_exit: bool = ... + ) -> None: ... + def action(self) -> None: ... + def get_return(self) -> int: ... diff --git a/stubs/console-menu/consolemenu/items/external_item.pyi b/stubs/console-menu/consolemenu/items/external_item.pyi new file mode 100644 index 0000000..33cf83a --- /dev/null +++ b/stubs/console-menu/consolemenu/items/external_item.pyi @@ -0,0 +1,5 @@ +from consolemenu.items import MenuItem as MenuItem + +class ExternalItem(MenuItem): + def set_up(self) -> None: ... + def clean_up(self) -> None: ... diff --git a/stubs/console-menu/consolemenu/items/function_item.pyi b/stubs/console-menu/consolemenu/items/function_item.pyi new file mode 100644 index 0000000..1907785 --- /dev/null +++ b/stubs/console-menu/consolemenu/items/function_item.pyi @@ -0,0 +1,23 @@ +from collections.abc import Callable, Mapping, Sequence +from typing import Any + +from consolemenu.console_menu import ConsoleMenu +from consolemenu.items import ExternalItem as ExternalItem + +class FunctionItem(ExternalItem): + function: Callable[..., Any] + args: Sequence[Any] + kwargs: Mapping[str, Any] + return_value: Any | None + def __init__( + self, + text: str, + function: Callable[..., Any], + args: Sequence[Any] | None = ..., + kwargs: Mapping[str, Any] | None = ..., + menu: ConsoleMenu | None = ..., + should_exit: bool = ..., + ) -> None: ... + def action(self) -> None: ... + def clean_up(self) -> None: ... + def get_return(self) -> Any | None: ... diff --git a/stubs/console-menu/consolemenu/items/selection_item.pyi b/stubs/console-menu/consolemenu/items/selection_item.pyi new file mode 100644 index 0000000..0767880 --- /dev/null +++ b/stubs/console-menu/consolemenu/items/selection_item.pyi @@ -0,0 +1,9 @@ +from collections.abc import Callable + +from consolemenu.console_menu import ConsoleMenu +from consolemenu.items import MenuItem as MenuItem + +class SelectionItem(MenuItem): + index: int + def __init__(self, text: str | Callable[[], str], index: int, menu: ConsoleMenu | None = ...) -> None: ... + def get_return(self) -> int: ... diff --git a/stubs/console-menu/consolemenu/items/submenu_item.pyi b/stubs/console-menu/consolemenu/items/submenu_item.pyi new file mode 100644 index 0000000..f1d8c61 --- /dev/null +++ b/stubs/console-menu/consolemenu/items/submenu_item.pyi @@ -0,0 +1,17 @@ +from collections.abc import Callable + +from consolemenu.console_menu import ConsoleMenu +from consolemenu.items import MenuItem as MenuItem + +class SubmenuItem(MenuItem): + submenu: ConsoleMenu + def __init__( + self, text: str | Callable[[], str], submenu: ConsoleMenu, menu: ConsoleMenu | None = ..., should_exit: bool = ... + ) -> None: ... + menu: ConsoleMenu + def set_menu(self, menu: ConsoleMenu) -> None: ... + def set_up(self) -> None: ... + def action(self) -> None: ... + def clean_up(self) -> None: ... + def get_return(self) -> object: ... + def get_submenu(self) -> ConsoleMenu: ... diff --git a/stubs/console-menu/consolemenu/menu_component.pyi b/stubs/console-menu/consolemenu/menu_component.pyi new file mode 100644 index 0000000..6514836 --- /dev/null +++ b/stubs/console-menu/consolemenu/menu_component.pyi @@ -0,0 +1,99 @@ +from collections.abc import Generator + +from consolemenu.console_menu import MenuItem +from consolemenu.format import MenuBorderStyle, MenuMargins, MenuPadding, MenuStyle as MenuStyle + +def ansilen(s: str) -> int: ... + +class Dimension: + width: int + height: int + def __init__(self, width: int = ..., height: int = ..., dimension: Dimension | None = ...) -> None: ... + +class MenuComponent: + def __init__(self, menu_style: MenuStyle, max_dimension: Dimension | None = ...) -> None: ... + @property + def max_dimension(self) -> Dimension: ... + @property + def style(self) -> MenuStyle: ... + @property + def margins(self) -> MenuMargins: ... + @property + def padding(self) -> MenuPadding: ... + @property + def border_style(self) -> MenuBorderStyle: ... + def calculate_border_width(self) -> int: ... + def calculate_content_width(self) -> int: ... + def generate(self) -> Generator[str, None, None]: ... + def inner_horizontals(self) -> str: ... + def inner_horizontal_border(self) -> str: ... + def outer_horizontals(self) -> str: ... + def outer_horizontal_border_bottom(self) -> str: ... + def outer_horizontal_border_top(self) -> str: ... + def row(self, content: str = ..., align: str = ..., indent_len: int = ...) -> str: ... + +class MenuHeader(MenuComponent): + title: str + title_align: str + subtitle: str + subtitle_align: str + show_bottom_border: bool + def __init__( + self, + menu_style: MenuStyle, + max_dimension: Dimension | None = ..., + title: str | None = ..., + title_align: str = ..., + subtitle: str | None = ..., + subtitle_align: str = ..., + show_bottom_border: bool = ..., + ) -> None: ... + def generate(self) -> Generator[str, None, None]: ... + +class MenuTextSection(MenuComponent): + text: str + text_align: str + show_top_border: bool + show_bottom_border: bool + def __init__( + self, + menu_style: MenuStyle, + max_dimension: Dimension | None = ..., + text: str | None = ..., + text_align: str = ..., + show_top_border: bool = ..., + show_bottom_border: bool = ..., + ) -> None: ... + def generate(self) -> Generator[str, None, None]: ... + +class MenuItemsSection(MenuComponent): + items_align: str + def __init__( + self, + menu_style: MenuStyle, + max_dimension: Dimension | None = ..., + items: list[MenuItem] | None = ..., + items_align: str = ..., + ) -> None: ... + @property + def items(self) -> list[MenuItem]: ... + @items.setter + def items(self, items: list[MenuItem]) -> None: ... + @property + def items_with_bottom_border(self) -> list[str]: ... + @property + def items_with_top_border(self) -> list[str]: ... + def show_item_bottom_border(self, item_text: str, flag: bool) -> None: ... + def show_item_top_border(self, item_text: str, flag: bool) -> None: ... + def generate(self) -> Generator[str, None, None]: ... + +class MenuFooter(MenuComponent): + def generate(self) -> Generator[str, None, None]: ... + +class MenuPrompt(MenuComponent): + def __init__(self, menu_style: MenuStyle, max_dimension: Dimension | None = ..., prompt_string: str = ...) -> None: ... + @property + def prompt(self) -> str: ... + @prompt.setter + def prompt(self, prompt: str) -> None: ... + def generate(self) -> Generator[str, None, None]: ... diff --git a/stubs/console-menu/consolemenu/menu_formatter.pyi b/stubs/console-menu/consolemenu/menu_formatter.pyi new file mode 100644 index 0000000..cfd09a6 --- /dev/null +++ b/stubs/console-menu/consolemenu/menu_formatter.pyi @@ -0,0 +1,55 @@ +from consolemenu.console_menu import MenuItem +from consolemenu.format import MenuBorderStyleType +from consolemenu.format.menu_borders import MenuBorderStyle as MenuBorderStyle, MenuBorderStyleFactory as MenuBorderStyleFactory +from consolemenu.format.menu_style import MenuStyle as MenuStyle +from consolemenu.menu_component import ( + Dimension as Dimension, + MenuFooter as MenuFooter, + MenuHeader as MenuHeader, + MenuItemsSection as MenuItemsSection, + MenuPrompt as MenuPrompt, + MenuTextSection as MenuTextSection, +) + +class MenuFormatBuilder: + def __init__(self, max_dimension: Dimension | None = ...) -> None: ... + def set_border_style(self, border_style: MenuBorderStyle) -> MenuFormatBuilder: ... + def set_border_style_type(self, border_style_type: MenuBorderStyleType) -> MenuFormatBuilder: ... + def set_border_style_factory(self, border_style_factory: MenuBorderStyleFactory) -> MenuFormatBuilder: ... + def set_bottom_margin(self, bottom_margin: int) -> MenuFormatBuilder: ... + def set_left_margin(self, left_margin: int) -> MenuFormatBuilder: ... + def set_right_margin(self, right_margin: int) -> MenuFormatBuilder: ... + def set_top_margin(self, top_margin: int) -> MenuFormatBuilder: ... + def set_title_align(self, align: str = ...) -> MenuFormatBuilder: ... + def set_subtitle_align(self, align: str = ...) -> MenuFormatBuilder: ... + def set_header_left_padding(self, x: int) -> MenuFormatBuilder: ... + def set_header_right_padding(self, x: int) -> MenuFormatBuilder: ... + def set_header_bottom_padding(self, x: int) -> MenuFormatBuilder: ... + def set_header_top_padding(self, x: int) -> MenuFormatBuilder: ... + def show_header_bottom_border(self, flag: bool) -> MenuFormatBuilder: ... + def set_footer_left_padding(self, x: int) -> MenuFormatBuilder: ... + def set_footer_right_padding(self, x: int) -> MenuFormatBuilder: ... + def set_footer_bottom_padding(self, x: int) -> MenuFormatBuilder: ... + def set_footer_top_padding(self, x: int) -> MenuFormatBuilder: ... + def set_items_left_padding(self, x: int) -> MenuFormatBuilder: ... + def set_items_right_padding(self, x: int) -> MenuFormatBuilder: ... + def set_items_bottom_padding(self, x: int) -> MenuFormatBuilder: ... + def set_items_top_padding(self, x: int) -> MenuFormatBuilder: ... + def show_item_bottom_border(self, item_text: str, flag: bool) -> MenuFormatBuilder: ... + def show_item_top_border(self, item_text: str, flag: bool) -> MenuFormatBuilder: ... + def set_prologue_text_align(self, align: str = ...) -> MenuFormatBuilder: ... + def show_prologue_top_border(self, flag: bool) -> MenuFormatBuilder: ... + def show_prologue_bottom_border(self, flag: bool) -> MenuFormatBuilder: ... + def set_epilogue_text_align(self, align: str = ...) -> MenuFormatBuilder: ... + def show_epilogue_top_border(self, flag: bool) -> MenuFormatBuilder: ... + def show_epilogue_bottom_border(self, flag: bool) -> MenuFormatBuilder: ... + def set_prompt(self, prompt: MenuPrompt) -> MenuFormatBuilder: ... + def clear_data(self) -> None: ... + def format( + self, + title: str | None = ..., + subtitle: str | None = ..., + prologue_text: str | None = ..., + epilogue_text: str | None = ..., + items: list[MenuItem] | None = ..., + ) -> str: ... diff --git a/stubs/console-menu/consolemenu/multiselect_menu.pyi b/stubs/console-menu/consolemenu/multiselect_menu.pyi new file mode 100644 index 0000000..06e2a5e --- /dev/null +++ b/stubs/console-menu/consolemenu/multiselect_menu.pyi @@ -0,0 +1,22 @@ +from consolemenu import ConsoleMenu as ConsoleMenu +from consolemenu.console_menu import MenuItem +from consolemenu.items import SubmenuItem as SubmenuItem +from consolemenu.menu_formatter import MenuFormatBuilder + +class MultiSelectMenu(ConsoleMenu): + ack_item_completion: bool + def __init__( + self, + title: str | None = ..., + subtitle: str | None = ..., + formatter: MenuFormatBuilder | None = ..., + prologue_text: str | None = ..., + epilogue_text: str | None = ..., + ack_item_completion: bool = ..., + show_exit_option: bool = ..., + exit_option_text: str = ..., + clear_screen: bool = ..., + ) -> None: ... + def append_item(self, item: MenuItem) -> None: ... + current_option: int + def process_user_input(self) -> None: ... diff --git a/stubs/console-menu/consolemenu/prompt_utils.pyi b/stubs/console-menu/consolemenu/prompt_utils.pyi new file mode 100644 index 0000000..507d716 --- /dev/null +++ b/stubs/console-menu/consolemenu/prompt_utils.pyi @@ -0,0 +1,47 @@ +from collections.abc import Iterable, Sequence +from typing import Any, NamedTuple + +from consolemenu.screen import Screen +from consolemenu.validators.base import BaseValidator + +class InputResult(NamedTuple): + input_string: str + validation_result: bool + +class PromptFormatter: + @staticmethod + def format_prompt( + prompt: str | None = ..., + default: str | None = ..., + enable_quit: bool = ..., + quit_string: str = ..., + quit_message: str = ..., + ) -> str: ... + +class PromptUtils: + def __init__(self, screen: Screen, prompt_formatter: PromptFormatter | None = ...) -> None: ... + @property + def screen(self) -> Screen: ... + def clear(self) -> None: ... + def confirm_answer(self, answer: str, message: str | None = ...) -> bool: ... + def enter_to_continue(self, message: str | None = ...) -> None: ... + def input( + self, + prompt: str | None = ..., + default: str | None = ..., + validators: Iterable[BaseValidator] | None = ..., + enable_quit: bool = ..., + quit_string: str = ..., + quit_message: str = ..., + ) -> InputResult: ... + def input_password(self, message: str | None = ...) -> str: ... + def printf(self, *args: Any) -> None: ... + def println(self, *args: Any) -> None: ... + def prompt_and_confirm_password(self, message: str) -> str: ... + def prompt_for_bilateral_choice(self, prompt: str, option1: str, option2: str) -> str: ... + def prompt_for_trilateral_choice(self, prompt: str, option1: str, option2: str, option3: str) -> str: ... + def prompt_for_yes_or_no(self, prompt: str) -> bool: ... + def prompt_for_numbered_choice(self, choices: Sequence[str], title: str | None = ..., prompt: str = ...) -> int: ... + def validate_input(self, input_string: str, validators: BaseValidator) -> bool: ... + +class UserQuit(Exception): ... diff --git a/stubs/console-menu/consolemenu/screen.pyi b/stubs/console-menu/consolemenu/screen.pyi new file mode 100644 index 0000000..712823c --- /dev/null +++ b/stubs/console-menu/consolemenu/screen.pyi @@ -0,0 +1,17 @@ +from typing import Any + +class Screen: + def __init__(self) -> None: ... + @property + def screen_height(self) -> int: ... + @property + def screen_width(self) -> int: ... + @staticmethod + def clear() -> None: ... + @staticmethod + def flush() -> None: ... + def input(self, prompt: str = ...) -> str: ... + @staticmethod + def printf(*args: Any) -> None: ... + @staticmethod + def println(*args: Any) -> None: ... diff --git a/stubs/console-menu/consolemenu/selection_menu.pyi b/stubs/console-menu/consolemenu/selection_menu.pyi new file mode 100644 index 0000000..4735cb8 --- /dev/null +++ b/stubs/console-menu/consolemenu/selection_menu.pyi @@ -0,0 +1,31 @@ +from collections.abc import Iterable + +from consolemenu import ConsoleMenu as ConsoleMenu +from consolemenu.items import SelectionItem as SelectionItem +from consolemenu.menu_formatter import MenuFormatBuilder +from consolemenu.screen import Screen + +class SelectionMenu(ConsoleMenu): + def __init__( + self, + strings: Iterable[str], + title: str | None = ..., + subtitle: str | None = ..., + screen: Screen | None = ..., + formatter: MenuFormatBuilder | None = ..., + prologue_text: str | None = ..., + epilogue_text: str | None = ..., + show_exit_option: bool = ..., + exit_option_text: str = ..., + clear_screen: bool = ..., + ) -> None: ... + @classmethod + def get_selection( + cls, + strings: Iterable[str], + title: str = ..., + subtitle: str | None = ..., + show_exit_option: bool = ..., + _menu: ConsoleMenu | None = ..., + ) -> int: ... + def append_string(self, string: str) -> None: ... diff --git a/stdlib/@python2/wsgiref/__init__.pyi b/stubs/console-menu/consolemenu/validators/__init__.pyi similarity index 100% rename from stdlib/@python2/wsgiref/__init__.pyi rename to stubs/console-menu/consolemenu/validators/__init__.pyi diff --git a/stubs/console-menu/consolemenu/validators/base.pyi b/stubs/console-menu/consolemenu/validators/base.pyi new file mode 100644 index 0000000..eaea5c8 --- /dev/null +++ b/stubs/console-menu/consolemenu/validators/base.pyi @@ -0,0 +1,11 @@ +import abc +from abc import abstractmethod +from logging import Logger + +class InvalidValidator(Exception): ... + +class BaseValidator(metaclass=abc.ABCMeta): + log: Logger + def __init__(self) -> None: ... + @abstractmethod + def validate(self, input_string: str) -> bool: ... diff --git a/stubs/console-menu/consolemenu/validators/regex.pyi b/stubs/console-menu/consolemenu/validators/regex.pyi new file mode 100644 index 0000000..fdadc44 --- /dev/null +++ b/stubs/console-menu/consolemenu/validators/regex.pyi @@ -0,0 +1,7 @@ +from consolemenu.validators.base import BaseValidator as BaseValidator + +class RegexValidator(BaseValidator): + def __init__(self, pattern: str) -> None: ... + @property + def pattern(self) -> str: ... + def validate(self, input_string: str) -> bool: ... diff --git a/stubs/console-menu/consolemenu/validators/url.pyi b/stubs/console-menu/consolemenu/validators/url.pyi new file mode 100644 index 0000000..d9e92bb --- /dev/null +++ b/stubs/console-menu/consolemenu/validators/url.pyi @@ -0,0 +1,5 @@ +from consolemenu.validators.base import BaseValidator as BaseValidator + +class UrlValidator(BaseValidator): + def __init__(self) -> None: ... + def validate(self, input_string: str) -> bool: ... diff --git a/stdlib/@python2/distutils/command/build.pyi b/stubs/console-menu/consolemenu/version.pyi similarity index 100% rename from stdlib/@python2/distutils/command/build.pyi rename to stubs/console-menu/consolemenu/version.pyi diff --git a/stubs/contextvars/METADATA.toml b/stubs/contextvars/METADATA.toml index 5f15410..35b6250 100644 --- a/stubs/contextvars/METADATA.toml +++ b/stubs/contextvars/METADATA.toml @@ -1 +1,4 @@ -version = "0.1" +version = "2.4" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/contextvars/contextvars.pyi b/stubs/contextvars/contextvars.pyi index 429d203..044d8a4 100644 --- a/stubs/contextvars/contextvars.pyi +++ b/stubs/contextvars/contextvars.pyi @@ -1,13 +1,20 @@ import sys -from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar +from collections.abc import Callable, Iterator, Mapping +from typing import Any, ClassVar, Generic, TypeVar, overload +from typing_extensions import ParamSpec, final if sys.version_info >= (3, 9): from types import GenericAlias _T = TypeVar("_T") +_P = ParamSpec("_P") +@final class ContextVar(Generic[_T]): - def __init__(self, name: str, *, default: _T = ...) -> None: ... + @overload + def __init__(self, name: str) -> None: ... + @overload + def __init__(self, name: str, *, default: _T) -> None: ... @property def name(self) -> str: ... def get(self, default: _T = ...) -> _T: ... @@ -16,6 +23,7 @@ class ContextVar(Generic[_T]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... +@final class Token(Generic[_T]): @property def var(self) -> ContextVar[_T]: ... @@ -29,10 +37,11 @@ def copy_context() -> Context: ... # It doesn't make sense to make this generic, because for most Contexts each ContextVar will have # a different value. +@final class Context(Mapping[ContextVar[Any], Any]): def __init__(self) -> None: ... - def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ... + def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... def copy(self) -> Context: ... - def __getitem__(self, key: ContextVar[Any]) -> Any: ... + def __getitem__(self, __key: ContextVar[_T]) -> _T: ... def __iter__(self) -> Iterator[ContextVar[Any]]: ... def __len__(self) -> int: ... diff --git a/stubs/croniter/@tests/stubtest_allowlist.txt b/stubs/croniter/@tests/stubtest_allowlist.txt index 98ef855..2895f0a 100644 --- a/stubs/croniter/@tests/stubtest_allowlist.txt +++ b/stubs/croniter/@tests/stubtest_allowlist.txt @@ -1,6 +1,10 @@ -croniter.CroniterError -croniter.croniter.__next__ -croniter.croniter.expand -croniter.croniter.get_next -croniter.croniter.is_valid -croniter.croniter.next +# missing from stub +croniter.croniter.EXPANDERS +croniter.croniter.HashExpander +croniter.croniter.VALID_LEN_EXPRESSION +croniter.croniter.hash_expression_re +croniter.croniter.only_int_re +croniter.croniter.special_weekday_re +croniter.croniter.star_or_int_re +croniter.croniter.step_search_re +croniter.croniter.timedelta_to_seconds \ No newline at end of file diff --git a/stubs/croniter/METADATA.toml b/stubs/croniter/METADATA.toml index f339dc7..47610a9 100644 --- a/stubs/croniter/METADATA.toml +++ b/stubs/croniter/METADATA.toml @@ -1,2 +1,4 @@ -version = "1.0" -python2 = true +version = "1.3.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/croniter/croniter.pyi b/stubs/croniter/croniter.pyi deleted file mode 100644 index 22cd88b..0000000 --- a/stubs/croniter/croniter.pyi +++ /dev/null @@ -1,50 +0,0 @@ -import datetime -from typing import Any, Iterator, Text, Tuple, Type, TypeVar, Union - -_RetType = Union[Type[float], Type[datetime.datetime]] -_SelfT = TypeVar("_SelfT", bound=croniter) - -class CroniterError(ValueError): ... -class CroniterBadCronError(CroniterError): ... -class CroniterBadDateError(CroniterError): ... -class CroniterNotAlphaError(CroniterError): ... - -class croniter(Iterator[Any]): - MONTHS_IN_YEAR: int - RANGES: Tuple[Tuple[int, int], ...] - DAYS: Tuple[int, ...] - ALPHACONV: Tuple[dict[str, Any], ...] - LOWMAP: Tuple[dict[int, Any], ...] - bad_length: str - tzinfo: datetime.tzinfo | None - cur: float - expanded: list[list[str]] - start_time: float - dst_start_time: float - nth_weekday_of_month: dict[str, Any] - def __init__( - self, - expr_format: Text, - start_time: float | datetime.datetime | None = ..., - ret_type: _RetType | None = ..., - day_or: bool = ..., - max_years_between_matches: int | None = ..., - is_prev: bool = ..., - hash_id: str | bytes | None = ..., # unicode not accepted on python 2 - ) -> None: ... - # Most return value depend on ret_type, which can be passed in both as a method argument and as - # a constructor argument. - def get_next(self, ret_type: _RetType | None = ...) -> Any: ... - def get_prev(self, ret_type: _RetType | None = ...) -> Any: ... - def get_current(self, ret_type: _RetType | None = ...) -> Any: ... - def __iter__(self: _SelfT) -> _SelfT: ... - def __next__(self, ret_type: _RetType | None = ...) -> Any: ... - def next(self, ret_type: _RetType | None = ...) -> Any: ... - def all_next(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... - def all_prev(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... - def iter(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... - def is_leap(self, year: int) -> bool: ... - @classmethod - def expand(cls, expr_format: Text) -> Tuple[list[list[str]], dict[str, Any]]: ... - @classmethod - def is_valid(cls, expression: Text) -> bool: ... diff --git a/stubs/croniter/croniter/__init__.pyi b/stubs/croniter/croniter/__init__.pyi new file mode 100644 index 0000000..c88524c --- /dev/null +++ b/stubs/croniter/croniter/__init__.pyi @@ -0,0 +1,10 @@ +from .croniter import ( + CroniterBadCronError as CroniterBadCronError, + CroniterBadDateError as CroniterBadDateError, + CroniterBadTypeRangeError as CroniterBadTypeRangeError, + CroniterNotAlphaError as CroniterNotAlphaError, + CroniterUnsupportedSyntaxError as CroniterUnsupportedSyntaxError, + croniter as croniter, + croniter_range as croniter_range, + datetime_to_timestamp as datetime_to_timestamp, +) diff --git a/stubs/croniter/croniter/croniter.pyi b/stubs/croniter/croniter/croniter.pyi new file mode 100644 index 0000000..69c22e9 --- /dev/null +++ b/stubs/croniter/croniter/croniter.pyi @@ -0,0 +1,85 @@ +import datetime +from _typeshed import Self +from collections.abc import Iterator +from typing import Any +from typing_extensions import Literal, TypeAlias + +_RetType: TypeAlias = type[float | datetime.datetime] + +class CroniterError(ValueError): ... +class CroniterBadTypeRangeError(TypeError): ... +class CroniterBadCronError(CroniterError): ... +class CroniterUnsupportedSyntaxError(CroniterBadCronError): ... +class CroniterBadDateError(CroniterError): ... +class CroniterNotAlphaError(CroniterError): ... + +def datetime_to_timestamp(d: datetime.datetime) -> float: ... + +class croniter(Iterator[Any]): + MONTHS_IN_YEAR: Literal[12] + RANGES: tuple[tuple[int, int], ...] + DAYS: tuple[ + Literal[31], + Literal[28], + Literal[31], + Literal[30], + Literal[31], + Literal[30], + Literal[31], + Literal[31], + Literal[30], + Literal[31], + Literal[30], + Literal[31], + ] + ALPHACONV: tuple[dict[str, Any], ...] + LOWMAP: tuple[dict[int, Any], ...] + LEN_MEANS_ALL: tuple[int, ...] + bad_length: str + tzinfo: datetime.tzinfo | None + cur: float + expanded: list[list[str]] + start_time: float + dst_start_time: float + nth_weekday_of_month: dict[str, Any] + def __init__( + self, + expr_format: str, + start_time: float | datetime.datetime | None = ..., + ret_type: _RetType | None = ..., + day_or: bool = ..., + max_years_between_matches: int | None = ..., + is_prev: bool = ..., + hash_id: str | bytes | None = ..., + ) -> None: ... + # Most return value depend on ret_type, which can be passed in both as a method argument and as + # a constructor argument. + def get_next(self, ret_type: _RetType | None = ..., start_time: float | datetime.datetime | None = ...) -> Any: ... + def get_prev(self, ret_type: _RetType | None = ...) -> Any: ... + def get_current(self, ret_type: _RetType | None = ...) -> Any: ... + def set_current(self, start_time: float | datetime.datetime | None, force: bool = ...) -> float: ... + def __iter__(self: Self) -> Self: ... + def next( + self, ret_type: _RetType | None = ..., start_time: float | datetime.datetime | None = ..., is_prev: bool | None = ... + ) -> Any: ... + __next__ = next + def all_next(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... + def all_prev(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... + def iter(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... + def is_leap(self, year: int) -> bool: ... + @classmethod + def expand(cls, expr_format: str, hash_id: str | bytes | None = ...) -> tuple[list[list[str]], dict[str, Any]]: ... + @classmethod + def is_valid(cls, expression: str, hash_id: str | bytes | None = ...) -> bool: ... + @classmethod + def match(cls, cron_expression: str, testdate: float | datetime.datetime | None, day_or: bool = ...) -> bool: ... + +def croniter_range( + start: float | datetime.datetime, + stop: float | datetime.datetime, + expr_format: str, + ret_type: _RetType | None = ..., + day_or: bool = ..., + exclude_ends: bool = ..., + _croniter: type[croniter] | None = ..., +) -> Iterator[Any]: ... diff --git a/stubs/cryptography/@tests/stubtest_allowlist.txt b/stubs/cryptography/@tests/stubtest_allowlist.txt index 9eb68be..30c5be3 100644 --- a/stubs/cryptography/@tests/stubtest_allowlist.txt +++ b/stubs/cryptography/@tests/stubtest_allowlist.txt @@ -8,18 +8,13 @@ cryptography.hazmat.backends.interfaces.DHBackend.dh_parameters_supported cryptography.hazmat.backends.interfaces.HMACBackend.cmac_algorithm_supported cryptography.hazmat.bindings.openssl.binding.Binding.init_static_locks cryptography.hazmat.primitives.asymmetric.dh.DHParameterNumbers.__init__ -cryptography.hazmat.primitives.asymmetric.dsa.AsymmetricVerificationContext -cryptography.hazmat.primitives.asymmetric.ec.AsymmetricVerificationContext -cryptography.hazmat.primitives.asymmetric.rsa.AsymmetricVerificationContext cryptography.hazmat.primitives.ciphers.aead.AESCCM.__init__ -cryptography.hazmat.primitives.ciphers.modes.GCM.__init__ cryptography.hazmat.primitives.cmac.CMAC.__init__ cryptography.hazmat.primitives.hashes.BLAKE2b.__init__ cryptography.hazmat.primitives.hashes.BLAKE2s.__init__ cryptography.hazmat.primitives.hashes.Hash.__init__ cryptography.hazmat.primitives.hmac.HMAC.__init__ cryptography.hazmat.primitives.hmac.HMAC.update -cryptography.hazmat.primitives.serialization.pkcs12.serialize_key_and_certificates cryptography.hazmat.primitives.serialization.pkcs7.PKCS7SignatureBuilder.__init__ cryptography.x509.CertificateBuilder.public_key cryptography.x509.CertificateBuilder.serial_number @@ -29,6 +24,7 @@ cryptography.x509.CertificateRevocationListBuilder.last_update cryptography.x509.CertificateRevocationListBuilder.next_update cryptography.x509.CertificateSigningRequestBuilder.__init__ cryptography.x509.Extension.__init__ +cryptography.x509.ExtensionType.oid # is a property at runtime, but a different descriptor on subclasses, easier just to pretend it's writeable cryptography.x509.Extensions.__init__ cryptography.x509.NameAttribute.__init__ cryptography.x509.OCSPExtensionOID diff --git a/stubs/cryptography/METADATA.toml b/stubs/cryptography/METADATA.toml index a1932bb..6376d4c 100644 --- a/stubs/cryptography/METADATA.toml +++ b/stubs/cryptography/METADATA.toml @@ -1,4 +1,2 @@ -version = "3.3" -python2 = true -requires = ["types-enum34", "types-ipaddress"] +version = "3.3.*" obsolete_since = "3.4.4" diff --git a/stubs/cryptography/cryptography/fernet.pyi b/stubs/cryptography/cryptography/fernet.pyi index 2eb1e18..e42a0c5 100644 --- a/stubs/cryptography/cryptography/fernet.pyi +++ b/stubs/cryptography/cryptography/fernet.pyi @@ -1,9 +1,7 @@ -from typing import Text - class InvalidToken(Exception): ... -class Fernet(object): - def __init__(self, key: bytes | Text) -> None: ... +class Fernet: + def __init__(self, key: bytes | str) -> None: ... def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ... # decrypt_at_time accepts None ttl at runtime but it's an implementtion detail and it doesn't really # make sense for the client code to use it like that, so the parameter is typed as int as opposed to @@ -15,7 +13,7 @@ class Fernet(object): @classmethod def generate_key(cls) -> bytes: ... -class MultiFernet(object): +class MultiFernet: def __init__(self, fernets: list[Fernet]) -> None: ... def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ... # See a note above on the typing of the ttl parameter. diff --git a/stubs/cryptography/cryptography/hazmat/__init__.pyi b/stubs/cryptography/cryptography/hazmat/__init__.pyi index e27843e..0f6820f 100644 --- a/stubs/cryptography/cryptography/hazmat/__init__.pyi +++ b/stubs/cryptography/cryptography/hazmat/__init__.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/cryptography/cryptography/hazmat/backends/__init__.pyi b/stubs/cryptography/cryptography/hazmat/backends/__init__.pyi index d452202..5f152aa 100644 --- a/stubs/cryptography/cryptography/hazmat/backends/__init__.pyi +++ b/stubs/cryptography/cryptography/hazmat/backends/__init__.pyi @@ -1,6 +1,7 @@ +from _typeshed import Incomplete from typing import Any def default_backend() -> Any: ... # TODO: add some backends -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/cryptography/cryptography/hazmat/bindings/openssl/binding.pyi b/stubs/cryptography/cryptography/hazmat/bindings/openssl/binding.pyi index 51c967b..6b6c6e8 100644 --- a/stubs/cryptography/cryptography/hazmat/bindings/openssl/binding.pyi +++ b/stubs/cryptography/cryptography/hazmat/bindings/openssl/binding.pyi @@ -1,6 +1,6 @@ from typing import Any -class Binding(object): +class Binding: ffi: Any | None lib: Any | None def init_static_locks(self) -> None: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/__init__.pyi b/stubs/cryptography/cryptography/hazmat/primitives/__init__.pyi index e27843e..0f6820f 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/__init__.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/__init__.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/__init__.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/__init__.pyi index e27843e..0f6820f 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/__init__.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/__init__.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi index 7846f75..6b2b0ae 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi @@ -19,7 +19,7 @@ class DHParameters(metaclass=ABCMeta): DHParametersWithSerialization = DHParameters -class DHParameterNumbers(object): +class DHParameterNumbers: @property def p(self) -> int: ... @property @@ -30,7 +30,8 @@ class DHParameterNumbers(object): def parameters(self, backend: DHBackend | None = ...) -> DHParameters: ... class DHPrivateKey(metaclass=ABCMeta): - key_size: int + @property + def key_size(self) -> int: ... @abstractmethod def exchange(self, peer_public_key: DHPublicKey) -> bytes: ... @abstractmethod @@ -46,7 +47,7 @@ class DHPrivateKeyWithSerialization(DHPrivateKey): @abstractmethod def private_numbers(self) -> DHPrivateNumbers: ... -class DHPrivateNumbers(object): +class DHPrivateNumbers: @property def public_numbers(self) -> DHPublicNumbers: ... @property @@ -67,7 +68,7 @@ class DHPublicKey(metaclass=ABCMeta): DHPublicKeyWithSerialization = DHPublicKey -class DHPublicNumbers(object): +class DHPublicNumbers: @property def parameter_numbers(self) -> DHParameterNumbers: ... @property diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dsa.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dsa.pyi index db9f191..364376c 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dsa.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dsa.pyi @@ -14,7 +14,7 @@ class DSAParametersWithNumbers(DSAParameters): @abstractmethod def parameter_numbers(self) -> DSAParameterNumbers: ... -class DSAParameterNumbers(object): +class DSAParameterNumbers: @property def p(self) -> int: ... @property @@ -43,7 +43,7 @@ class DSAPrivateKeyWithSerialization(DSAPrivateKey): @abstractmethod def private_numbers(self) -> DSAPrivateNumbers: ... -class DSAPrivateNumbers(object): +class DSAPrivateNumbers: @property def x(self) -> int: ... @property @@ -65,7 +65,7 @@ class DSAPublicKey(metaclass=ABCMeta): DSAPublicKeyWithSerialization = DSAPublicKey -class DSAPublicNumbers(object): +class DSAPublicNumbers: @property def y(self) -> int: ... @property diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ec.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ec.pyi index 33fb4cb..fb6e745 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ec.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ec.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from abc import ABCMeta, abstractmethod from typing import ClassVar @@ -92,7 +93,7 @@ class SECT571R1(EllipticCurve): key_size: int = ... name: str = ... -class EllipticCurveOID(object): +class EllipticCurveOID: SECP192R1: ClassVar[ObjectIdentifier] SECP224R1: ClassVar[ObjectIdentifier] SECP256K1: ClassVar[ObjectIdentifier] @@ -135,7 +136,7 @@ class EllipticCurvePrivateKeyWithSerialization(EllipticCurvePrivateKey): @abstractmethod def private_numbers(self) -> EllipticCurvePrivateNumbers: ... -class EllipticCurvePrivateNumbers(object): +class EllipticCurvePrivateNumbers: @property def private_value(self) -> int: ... @property @@ -165,7 +166,7 @@ class EllipticCurvePublicKey(metaclass=ABCMeta): EllipticCurvePublicKeyWithSerialization = EllipticCurvePublicKey -class EllipticCurvePublicNumbers(object): +class EllipticCurvePublicNumbers: @property def curve(self) -> EllipticCurve: ... @property @@ -174,7 +175,7 @@ class EllipticCurvePublicNumbers(object): def y(self) -> int: ... def __init__(self, x: int, y: int, curve: EllipticCurve) -> None: ... @classmethod - def from_encoded_point(cls, curve: EllipticCurve, data: bytes) -> EllipticCurvePublicNumbers: ... + def from_encoded_point(cls: type[Self], curve: EllipticCurve, data: bytes) -> Self: ... def public_key(self, backend: EllipticCurveBackend | None = ...) -> EllipticCurvePublicKey: ... class EllipticCurveSignatureAlgorithm(metaclass=ABCMeta): @@ -182,7 +183,7 @@ class EllipticCurveSignatureAlgorithm(metaclass=ABCMeta): @abstractmethod def algorithm(self) -> HashAlgorithm | Prehashed: ... -class ECDH(object): ... +class ECDH: ... class ECDSA(EllipticCurveSignatureAlgorithm): def __init__(self, algorithm: HashAlgorithm | Prehashed): ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/padding.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/padding.pyi index bb1781c..b2d70c5 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/padding.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/padding.pyi @@ -8,7 +8,7 @@ class AsymmetricPadding(metaclass=ABCMeta): @abstractmethod def name(self) -> str: ... -class MGF1(object): +class MGF1: def __init__(self, algorithm: HashAlgorithm) -> None: ... class OAEP(AsymmetricPadding): diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/rsa.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/rsa.pyi index 3b5f0ca..2fe8886 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/rsa.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/rsa.pyi @@ -1,5 +1,4 @@ from abc import ABCMeta, abstractmethod -from typing import Tuple from cryptography.hazmat.backends.interfaces import RSABackend from cryptography.hazmat.primitives.asymmetric import AsymmetricVerificationContext @@ -52,9 +51,9 @@ def generate_private_key( def rsa_crt_iqmp(p: int, q: int) -> int: ... def rsa_crt_dmp1(private_exponent: int, p: int) -> int: ... def rsa_crt_dmq1(private_exponent: int, q: int) -> int: ... -def rsa_recover_prime_factors(n: int, e: int, d: int) -> Tuple[int, int]: ... +def rsa_recover_prime_factors(n: int, e: int, d: int) -> tuple[int, int]: ... -class RSAPrivateNumbers(object): +class RSAPrivateNumbers: def __init__(self, p: int, q: int, d: int, dmp1: int, dmq1: int, iqmp: int, public_numbers: RSAPublicNumbers) -> None: ... @property def p(self) -> int: ... @@ -72,7 +71,7 @@ class RSAPrivateNumbers(object): def public_numbers(self) -> RSAPublicNumbers: ... def private_key(self, backend: RSABackend | None = ...) -> RSAPrivateKey: ... -class RSAPublicNumbers(object): +class RSAPublicNumbers: def __init__(self, e: int, n: int) -> None: ... @property def e(self) -> int: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi index 5bd9f53..4e5feda 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi @@ -1,12 +1,11 @@ -from typing import Tuple - from cryptography.hazmat.primitives.hashes import HashAlgorithm -def decode_dss_signature(signature: bytes) -> Tuple[int, int]: ... +def decode_dss_signature(signature: bytes) -> tuple[int, int]: ... def encode_dss_signature(r: int, s: int) -> bytes: ... -class Prehashed(object): +class Prehashed: _algorithm: HashAlgorithm # undocumented _digest_size: int # undocumented def __init__(self, algorithm: HashAlgorithm) -> None: ... - digest_size: int + @property + def digest_size(self) -> int: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/__init__.pyi b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/__init__.pyi index f75a32c..c69bde2 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/__init__.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/__init__.pyi @@ -21,7 +21,7 @@ class BlockCipherAlgorithm(metaclass=ABCMeta): @abstractmethod def block_size(self) -> int: ... -class Cipher(object): +class Cipher: def __init__(self, algorithm: CipherAlgorithm, mode: Mode | None, backend: CipherBackend | None = ...) -> None: ... def decryptor(self) -> CipherContext: ... def encryptor(self) -> CipherContext: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/aead.pyi b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/aead.pyi index c6552a2..909f701 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/aead.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/aead.pyi @@ -1,18 +1,18 @@ -class AESCCM(object): +class AESCCM: def __init__(self, key: bytes, tag_length: int | None) -> None: ... def decrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ... def encrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ... @classmethod def generate_key(cls, bit_length: int) -> bytes: ... -class AESGCM(object): +class AESGCM: def __init__(self, key: bytes) -> None: ... def decrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ... def encrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ... @classmethod def generate_key(cls, bit_length: int) -> bytes: ... -class ChaCha20Poly1305(object): +class ChaCha20Poly1305: def __init__(self, key: bytes) -> None: ... def decrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ... def encrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/algorithms.pyi b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/algorithms.pyi index 78e44b2..466c70b 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/algorithms.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/algorithms.pyi @@ -1,5 +1,3 @@ -from typing import FrozenSet - from cryptography.hazmat.primitives.ciphers import BlockCipherAlgorithm, CipherAlgorithm from cryptography.hazmat.primitives.ciphers.modes import ModeWithNonce @@ -7,7 +5,7 @@ class AES(BlockCipherAlgorithm, CipherAlgorithm): def __init__(self, key: bytes) -> None: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... @property def key_size(self) -> int: ... @@ -16,7 +14,7 @@ class ARC4(CipherAlgorithm): @property def key_size(self) -> int: ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... class Blowfish(BlockCipherAlgorithm, CipherAlgorithm): def __init__(self, key: bytes) -> None: ... @@ -24,7 +22,7 @@ class Blowfish(BlockCipherAlgorithm, CipherAlgorithm): def key_size(self) -> int: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... class Camellia(BlockCipherAlgorithm, CipherAlgorithm): def __init__(self, key: bytes) -> None: ... @@ -32,7 +30,7 @@ class Camellia(BlockCipherAlgorithm, CipherAlgorithm): def key_size(self) -> int: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... class CAST5(BlockCipherAlgorithm, CipherAlgorithm): def __init__(self, key: bytes) -> None: ... @@ -40,14 +38,14 @@ class CAST5(BlockCipherAlgorithm, CipherAlgorithm): def key_size(self) -> int: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... class ChaCha20(CipherAlgorithm, ModeWithNonce): def __init__(self, key: bytes, nonce: bytes) -> None: ... @property def key_size(self) -> int: ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... @property def nonce(self) -> bytes: ... @@ -57,7 +55,7 @@ class IDEA(CipherAlgorithm): def key_size(self) -> int: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... class SEED(BlockCipherAlgorithm, CipherAlgorithm): def __init__(self, key: bytes) -> None: ... @@ -65,7 +63,7 @@ class SEED(BlockCipherAlgorithm, CipherAlgorithm): def key_size(self) -> int: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... class TripleDES(BlockCipherAlgorithm, CipherAlgorithm): def __init__(self, key: bytes) -> None: ... @@ -73,4 +71,4 @@ class TripleDES(BlockCipherAlgorithm, CipherAlgorithm): def key_size(self) -> int: ... block_size: int = ... name: str = ... - key_sizes: FrozenSet[int] = ... + key_sizes: frozenset[int] = ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/modes.pyi b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/modes.pyi index e01d200..b99d7a8 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/ciphers/modes.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/ciphers/modes.pyi @@ -67,7 +67,7 @@ class ECB(Mode): def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ... class GCM(Mode, ModeWithInitializationVector, ModeWithAuthenticationTag): - def __init__(self, initialization_vector: bytes, tag: bytes | None, min_tag_length: int | None) -> None: ... + def __init__(self, initialization_vector: bytes, tag: bytes | None = ..., min_tag_length: int | None = ...) -> None: ... @property def initialization_vector(self) -> bytes: ... @property diff --git a/stubs/cryptography/cryptography/hazmat/primitives/cmac.pyi b/stubs/cryptography/cryptography/hazmat/primitives/cmac.pyi index ae05822..4be367a 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/cmac.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/cmac.pyi @@ -1,7 +1,7 @@ from cryptography.hazmat.backends.interfaces import CMACBackend from cryptography.hazmat.primitives.ciphers import BlockCipherAlgorithm -class CMAC(object): +class CMAC: def __init__(self, algorithm: BlockCipherAlgorithm, backend: CMACBackend | None = ...) -> None: ... def copy(self) -> CMAC: ... def finalize(self) -> bytes: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi b/stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi index 6e4828a..ce4fc08 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi @@ -2,12 +2,17 @@ from abc import ABCMeta, abstractmethod from cryptography.hazmat.backends.interfaces import HashBackend +# These are actually abstractproperties on HashAlgorithm, +# but let's not worry too much about that. class HashAlgorithm(metaclass=ABCMeta): - digest_size: int - name: str + @property + def digest_size(self) -> int: ... + @property + def name(self) -> str: ... class HashContext(metaclass=ABCMeta): - algorithm: HashAlgorithm + @property + def algorithm(self) -> HashAlgorithm: ... @abstractmethod def copy(self) -> HashContext: ... @abstractmethod diff --git a/stubs/cryptography/cryptography/hazmat/primitives/hmac.pyi b/stubs/cryptography/cryptography/hazmat/primitives/hmac.pyi index 102ec39..768a9ec 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/hmac.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/hmac.pyi @@ -1,7 +1,7 @@ from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives.hashes import HashAlgorithm -class HMAC(object): +class HMAC: def __init__(self, key: bytes, algorithm: HashAlgorithm, backend: HMACBackend | None = ...) -> None: ... def copy(self) -> HMAC: ... def finalize(self) -> bytes: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/padding.pyi b/stubs/cryptography/cryptography/hazmat/primitives/padding.pyi index 7a9d5a8..fd5a2b1 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/padding.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/padding.pyi @@ -6,12 +6,12 @@ class PaddingContext(metaclass=ABCMeta): @abstractmethod def update(self, data: bytes) -> bytes: ... -class ANSIX923(object): +class ANSIX923: def __init__(self, block_size: int) -> None: ... def padder(self) -> PaddingContext: ... def unpadder(self) -> PaddingContext: ... -class PKCS7(object): +class PKCS7: def __init__(self, block_size: int) -> None: ... def padder(self) -> PaddingContext: ... def unpadder(self) -> PaddingContext: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/poly1305.pyi b/stubs/cryptography/cryptography/hazmat/primitives/poly1305.pyi index 886f670..a854709 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/poly1305.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/poly1305.pyi @@ -1,4 +1,4 @@ -class Poly1305(object): +class Poly1305: def __init__(self, key: bytes) -> None: ... def finalize(self) -> bytes: ... @classmethod diff --git a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi index 40b555b..f40dd73 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi @@ -1,4 +1,4 @@ -from typing import Any, Tuple +from typing import Any from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKeyWithSerialization from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKeyWithSerialization @@ -8,11 +8,11 @@ from cryptography.x509 import Certificate def load_key_and_certificates( data: bytes, password: bytes | None, backend: Any | None = ... -) -> Tuple[Any | None, Certificate | None, list[Certificate]]: ... +) -> tuple[Any | None, Certificate | None, list[Certificate]]: ... def serialize_key_and_certificates( name: bytes, key: RSAPrivateKeyWithSerialization | EllipticCurvePrivateKeyWithSerialization | DSAPrivateKeyWithSerialization, cert: Certificate | None, cas: list[Certificate] | None, - enc: KeySerializationEncryption, + encryption_algorithm: KeySerializationEncryption, ) -> bytes: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi index c403282..3bf5678 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi @@ -1,5 +1,6 @@ +from collections.abc import Iterable from enum import Enum -from typing import Any, Iterable +from typing import Any from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey diff --git a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi index 2cb4530..1c0272c 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi @@ -1,7 +1,7 @@ from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives.hashes import HashAlgorithm -class HOTP(object): +class HOTP: def __init__( self, key: bytes, length: int, algorithm: HashAlgorithm, backend: HMACBackend | None = ..., enforce_key_length: bool = ... ): ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi index f6ba23e..37c4c0e 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi @@ -1,7 +1,7 @@ from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives.hashes import HashAlgorithm -class TOTP(object): +class TOTP: def __init__( self, key: bytes, diff --git a/stubs/cryptography/cryptography/x509/__init__.pyi b/stubs/cryptography/cryptography/x509/__init__.pyi index be3b7bd..49596a8 100644 --- a/stubs/cryptography/cryptography/x509/__init__.pyi +++ b/stubs/cryptography/cryptography/x509/__init__.pyi @@ -1,8 +1,10 @@ import datetime +from _typeshed import Incomplete, Self from abc import ABCMeta, abstractmethod +from collections.abc import Generator, Iterable, Sequence from enum import Enum from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network -from typing import Any, ClassVar, Generator, Generic, Iterable, Sequence, Text, Type, TypeVar +from typing import Any, ClassVar, Generic, TypeVar from cryptography.hazmat.backends.interfaces import X509Backend from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey @@ -13,16 +15,17 @@ from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPubl from cryptography.hazmat.primitives.hashes import HashAlgorithm from cryptography.hazmat.primitives.serialization import Encoding -class ObjectIdentifier(object): - dotted_string: str +class ObjectIdentifier: + @property + def dotted_string(self) -> str: ... def __init__(self, dotted_string: str) -> None: ... -class CRLEntryExtensionOID(object): +class CRLEntryExtensionOID: CERTIFICATE_ISSUER: ClassVar[ObjectIdentifier] CRL_REASON: ClassVar[ObjectIdentifier] INVALIDITY_DATE: ClassVar[ObjectIdentifier] -class ExtensionOID(object): +class ExtensionOID: AUTHORITY_INFORMATION_ACCESS: ClassVar[ObjectIdentifier] AUTHORITY_KEY_IDENTIFIER: ClassVar[ObjectIdentifier] BASIC_CONSTRAINTS: ClassVar[ObjectIdentifier] @@ -48,7 +51,7 @@ class ExtensionOID(object): SUBJECT_KEY_IDENTIFIER: ClassVar[ObjectIdentifier] TLS_FEATURE: ClassVar[ObjectIdentifier] -class NameOID(object): +class NameOID: BUSINESS_CATEGORY: ClassVar[ObjectIdentifier] COMMON_NAME: ClassVar[ObjectIdentifier] COUNTRY_NAME: ClassVar[ObjectIdentifier] @@ -74,10 +77,10 @@ class NameOID(object): USER_ID: ClassVar[ObjectIdentifier] X500_UNIQUE_IDENTIFIER: ClassVar[ObjectIdentifier] -class OCSPExtensionOID(object): +class OCSPExtensionOID: NONCE: ClassVar[ObjectIdentifier] -class SignatureAlgorithmOID(object): +class SignatureAlgorithmOID: DSA_WITH_SHA1: ClassVar[ObjectIdentifier] DSA_WITH_SHA224: ClassVar[ObjectIdentifier] DSA_WITH_SHA256: ClassVar[ObjectIdentifier] @@ -96,7 +99,7 @@ class SignatureAlgorithmOID(object): RSA_WITH_SHA384: ClassVar[ObjectIdentifier] RSA_WITH_SHA512: ClassVar[ObjectIdentifier] -class ExtendedKeyUsageOID(object): +class ExtendedKeyUsageOID: SERVER_AUTH: ClassVar[ObjectIdentifier] CLIENT_AUTH: ClassVar[ObjectIdentifier] CODE_SIGNING: ClassVar[ObjectIdentifier] @@ -105,20 +108,23 @@ class ExtendedKeyUsageOID(object): OCSP_SIGNING: ClassVar[ObjectIdentifier] ANY_EXTENDED_KEY_USAGE: ClassVar[ObjectIdentifier] -class NameAttribute(object): - oid: ObjectIdentifier - value: Text - def __init__(self, oid: ObjectIdentifier, value: Text) -> None: ... +class NameAttribute: + @property + def oid(self) -> ObjectIdentifier: ... + @property + def value(self) -> str: ... + def __init__(self, oid: ObjectIdentifier, value: str) -> None: ... def rfc4514_string(self) -> str: ... -class RelativeDistinguishedName(object): +class RelativeDistinguishedName: def __init__(self, attributes: list[NameAttribute]) -> None: ... def __iter__(self) -> Generator[NameAttribute, None, None]: ... def get_attributes_for_oid(self, oid: ObjectIdentifier) -> list[NameAttribute]: ... def rfc4514_string(self) -> str: ... -class Name(object): - rdns: list[RelativeDistinguishedName] +class Name: + @property + def rdns(self) -> list[RelativeDistinguishedName]: ... def __init__(self, attributes: Sequence[NameAttribute | RelativeDistinguishedName]) -> None: ... def __iter__(self) -> Generator[NameAttribute, None, None]: ... def __len__(self) -> int: ... @@ -130,26 +136,43 @@ class Version(Enum): v1: int v3: int +# These are actually abstractproperties on Certificate, +# but let's not worry too much about that class Certificate(metaclass=ABCMeta): - extensions: Extensions - issuer: Name - not_valid_after: datetime.datetime - not_valid_before: datetime.datetime - serial_number: int - signature: bytes - signature_algorithm_oid: ObjectIdentifier - signature_hash_algorithm: HashAlgorithm - tbs_certificate_bytes: bytes - subject: Name - version: Version + @property + def extensions(self) -> Extensions: ... + @property + def issuer(self) -> Name: ... + @property + def not_valid_after(self) -> datetime.datetime: ... + @property + def not_valid_before(self) -> datetime.datetime: ... + @property + def serial_number(self) -> int: ... + @property + def signature(self) -> bytes: ... + @property + def signature_algorithm_oid(self) -> ObjectIdentifier: ... + @property + def signature_hash_algorithm(self) -> HashAlgorithm: ... + @property + def tbs_certificate_bytes(self) -> bytes: ... + @property + def subject(self) -> Name: ... + @property + def version(self) -> Version: ... @abstractmethod def fingerprint(self, algorithm: HashAlgorithm) -> bytes: ... @abstractmethod def public_bytes(self, encoding: Encoding) -> bytes: ... @abstractmethod def public_key(self) -> DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey: ... + @abstractmethod + def __eq__(self, __other: object) -> bool: ... + @abstractmethod + def __ne__(self, __other: object) -> bool: ... -class CertificateBuilder(object): +class CertificateBuilder: def __init__( self, issuer_name: Name | None = ..., @@ -177,14 +200,22 @@ class CertificateBuilder(object): def subject_name(self, name: Name) -> CertificateBuilder: ... class CertificateRevocationList(metaclass=ABCMeta): - extensions: Extensions - issuer: Name - last_update: datetime.datetime - next_update: datetime.datetime - signature: bytes - signature_algorithm_oid: ObjectIdentifier - signature_hash_algorithm: HashAlgorithm - tbs_certlist_bytes: bytes + @property + def extensions(self) -> Extensions: ... + @property + def issuer(self) -> Name: ... + @property + def last_update(self) -> datetime.datetime: ... + @property + def next_update(self) -> datetime.datetime: ... + @property + def signature(self) -> bytes: ... + @property + def signature_algorithm_oid(self) -> ObjectIdentifier: ... + @property + def signature_hash_algorithm(self) -> HashAlgorithm: ... + @property + def tbs_certlist_bytes(self) -> bytes: ... @abstractmethod def fingerprint(self, algorithm: HashAlgorithm) -> bytes: ... @abstractmethod @@ -195,8 +226,12 @@ class CertificateRevocationList(metaclass=ABCMeta): ) -> bool: ... @abstractmethod def public_bytes(self, encoding: Encoding) -> bytes: ... + @abstractmethod + def __eq__(self, __other: object) -> bool: ... + @abstractmethod + def __ne__(self, __other: object) -> bool: ... -class CertificateRevocationListBuilder(object): +class CertificateRevocationListBuilder: def add_extension(self, extension: ExtensionType, critical: bool) -> CertificateRevocationListBuilder: ... def add_revoked_certificate(self, revoked_certificate: RevokedCertificate) -> CertificateRevocationListBuilder: ... def issuer_name(self, name: Name) -> CertificateRevocationListBuilder: ... @@ -210,19 +245,30 @@ class CertificateRevocationListBuilder(object): ) -> CertificateRevocationList: ... class CertificateSigningRequest(metaclass=ABCMeta): - extensions: Extensions - is_signature_valid: bool - signature: bytes - signature_algorithm_oid: ObjectIdentifier - signature_hash_algorithm: HashAlgorithm - subject: Name - tbs_certrequest_bytes: bytes + @property + def extensions(self) -> Extensions: ... + @property + def is_signature_valid(self) -> bool: ... + @property + def signature(self) -> bytes: ... + @property + def signature_algorithm_oid(self) -> ObjectIdentifier: ... + @property + def signature_hash_algorithm(self) -> HashAlgorithm: ... + @property + def subject(self) -> Name: ... + @property + def tbs_certrequest_bytes(self) -> bytes: ... @abstractmethod def public_bytes(self, encoding: Encoding) -> bytes: ... @abstractmethod def public_key(self) -> DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey: ... + @abstractmethod + def __eq__(self, __other: object) -> bool: ... + @abstractmethod + def __ne__(self, __other: object) -> bool: ... -class CertificateSigningRequestBuilder(object): +class CertificateSigningRequestBuilder: def add_extension(self, extension: ExtensionType, critical: bool) -> CertificateSigningRequestBuilder: ... def subject_name(self, name: Name) -> CertificateSigningRequestBuilder: ... def sign( @@ -233,11 +279,14 @@ class CertificateSigningRequestBuilder(object): ) -> CertificateSigningRequest: ... class RevokedCertificate(metaclass=ABCMeta): - extensions: Extensions - revocation_date: datetime.datetime - serial_number: int + @property + def extensions(self) -> Extensions: ... + @property + def revocation_date(self) -> datetime.datetime: ... + @property + def serial_number(self) -> int: ... -class RevokedCertificateBuilder(object): +class RevokedCertificateBuilder: def add_extension(self, extension: ExtensionType, critical: bool) -> RevokedCertificateBuilder: ... def build(self, backend: X509Backend | None = ...) -> RevokedCertificate: ... def revocation_date(self, time: datetime.datetime) -> RevokedCertificateBuilder: ... @@ -246,54 +295,66 @@ class RevokedCertificateBuilder(object): # General Name Classes class GeneralName(metaclass=ABCMeta): - value: Any + @property + def value(self): ... class DirectoryName(GeneralName): - value: Name + @property + def value(self) -> Name: ... def __init__(self, value: Name) -> None: ... class DNSName(GeneralName): - value: Text - def __init__(self, value: Text) -> None: ... + @property + def value(self) -> str: ... + def __init__(self, value: str) -> None: ... class IPAddress(GeneralName): - value: IPv4Address | IPv6Address | IPv4Network | IPv6Network + @property + def value(self) -> IPv4Address | IPv6Address | IPv4Network | IPv6Network: ... def __init__(self, value: IPv4Address | IPv6Address | IPv4Network | IPv6Network) -> None: ... class OtherName(GeneralName): - type_id: ObjectIdentifier - value: bytes + @property + def type_id(self) -> ObjectIdentifier: ... + @property + def value(self) -> bytes: ... def __init__(self, type_id: ObjectIdentifier, value: bytes) -> None: ... class RegisteredID(GeneralName): - value: ObjectIdentifier + @property + def value(self) -> ObjectIdentifier: ... def __init__(self, value: ObjectIdentifier) -> None: ... class RFC822Name(GeneralName): - value: Text - def __init__(self, value: Text) -> None: ... + @property + def value(self) -> str: ... + def __init__(self, value: str) -> None: ... class UniformResourceIdentifier(GeneralName): - value: Text - def __init__(self, value: Text) -> None: ... + @property + def value(self) -> str: ... + def __init__(self, value: str) -> None: ... # X.509 Extensions class ExtensionType(metaclass=ABCMeta): oid: ObjectIdentifier -_T = TypeVar("_T", bound="ExtensionType") +_T = TypeVar("_T", bound=ExtensionType) class Extension(Generic[_T]): - critical: bool - oid: ObjectIdentifier - value: _T + @property + def critical(self) -> bool: ... + @property + def oid(self) -> ObjectIdentifier: ... + @property + def value(self) -> _T: ... -class Extensions(object): +class Extensions: def __init__(self, general_names: list[Extension[Any]]) -> None: ... def __iter__(self) -> Generator[Extension[Any], None, None]: ... def get_extension_for_oid(self, oid: ObjectIdentifier) -> Extension[Any]: ... - def get_extension_for_class(self, extclass: Type[_T]) -> Extension[_T]: ... + def get_extension_for_class(self, extclass: type[_T]) -> Extension[_T]: ... class DuplicateExtension(Exception): oid: ObjectIdentifier @@ -306,12 +367,12 @@ class ExtensionNotFound(Exception): class IssuerAlternativeName(ExtensionType): def __init__(self, general_names: list[GeneralName]) -> None: ... def __iter__(self) -> Generator[GeneralName, None, None]: ... - def get_values_for_type(self, type: Type[GeneralName]) -> list[Any]: ... + def get_values_for_type(self, type: type[GeneralName]) -> list[Any]: ... class SubjectAlternativeName(ExtensionType): def __init__(self, general_names: list[GeneralName]) -> None: ... def __iter__(self) -> Generator[GeneralName, None, None]: ... - def get_values_for_type(self, type: Type[GeneralName]) -> list[Any]: ... + def get_values_for_type(self, type: type[GeneralName]) -> list[Any]: ... class AuthorityKeyIdentifier(ExtensionType): @property @@ -325,10 +386,10 @@ class AuthorityKeyIdentifier(ExtensionType): ) -> None: ... @classmethod def from_issuer_public_key( - cls, public_key: RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey | Ed25519PublicKey | Ed448PublicKey - ) -> AuthorityKeyIdentifier: ... + cls: type[Self], public_key: RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey | Ed25519PublicKey | Ed448PublicKey + ) -> Self: ... @classmethod - def from_issuer_subject_key_identifier(cls, ski: SubjectKeyIdentifier) -> AuthorityKeyIdentifier: ... + def from_issuer_subject_key_identifier(cls: type[Self], ski: SubjectKeyIdentifier) -> Self: ... class SubjectKeyIdentifier(ExtensionType): @property @@ -336,8 +397,8 @@ class SubjectKeyIdentifier(ExtensionType): def __init__(self, digest: bytes) -> None: ... @classmethod def from_public_key( - cls, public_key: RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey | Ed25519PublicKey | Ed448PublicKey - ) -> SubjectKeyIdentifier: ... + cls: type[Self], public_key: RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey | Ed25519PublicKey | Ed448PublicKey + ) -> Self: ... class AccessDescription: @property @@ -406,6 +467,8 @@ class ExtendedKeyUsage(ExtensionType): class UnrecognizedExtension(ExtensionType): @property def value(self) -> bytes: ... + @property + def oid(self) -> ObjectIdentifier: ... # type: ignore[override] def __init__(self, oid: ObjectIdentifier, value: bytes) -> None: ... def load_der_x509_certificate(data: bytes, backend: X509Backend | None = ...) -> Certificate: ... @@ -414,4 +477,4 @@ def load_der_x509_crl(data: bytes, backend: X509Backend | None = ...) -> Certifi def load_pem_x509_crl(data: bytes, backend: X509Backend | None = ...) -> CertificateRevocationList: ... def load_der_x509_csr(data: bytes, backend: X509Backend | None = ...) -> CertificateSigningRequest: ... def load_pem_x509_csr(data: bytes, backend: X509Backend | None = ...) -> CertificateSigningRequest: ... -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/cryptography/cryptography/x509/extensions.pyi b/stubs/cryptography/cryptography/x509/extensions.pyi index a9b2ad0..207f3bb 100644 --- a/stubs/cryptography/cryptography/x509/extensions.pyi +++ b/stubs/cryptography/cryptography/x509/extensions.pyi @@ -1,22 +1,26 @@ -from typing import Any, Iterator +from collections.abc import Iterator from cryptography.x509 import GeneralName, ObjectIdentifier class Extension: - value: Any = ... + @property + def value(self): ... class GeneralNames: def __iter__(self) -> Iterator[GeneralName]: ... class DistributionPoint: - full_name: GeneralNames = ... + @property + def full_name(self) -> GeneralNames: ... class CRLDistributionPoints: def __iter__(self) -> Iterator[DistributionPoint]: ... class AccessDescription: - access_method: ObjectIdentifier = ... - access_location: GeneralName = ... + @property + def access_method(self) -> ObjectIdentifier: ... + @property + def access_location(self) -> GeneralName: ... class AuthorityInformationAccess: def __iter__(self) -> Iterator[AccessDescription]: ... diff --git a/stubs/cryptography/cryptography/x509/oid.pyi b/stubs/cryptography/cryptography/x509/oid.pyi index 2ca14b9..43dd1e2 100644 --- a/stubs/cryptography/cryptography/x509/oid.pyi +++ b/stubs/cryptography/cryptography/x509/oid.pyi @@ -99,6 +99,5 @@ class CertificatePoliciesOID: CPS_USER_NOTICE: ObjectIdentifier = ... ANY_POLICY: ObjectIdentifier = ... -_OID_NAMES: dict[ObjectIdentifier, str] = ... - -_SIG_OIDS_TO_HASH: dict[ObjectIdentifier, HashAlgorithm | None] = ... +_OID_NAMES: dict[ObjectIdentifier, str] +_SIG_OIDS_TO_HASH: dict[ObjectIdentifier, HashAlgorithm | None] diff --git a/stubs/dataclasses/@tests/stubtest_allowlist.txt b/stubs/dataclasses/@tests/stubtest_allowlist.txt deleted file mode 100644 index 4026758..0000000 --- a/stubs/dataclasses/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,5 +0,0 @@ -dataclasses.Field.__init__ -dataclasses.InitVar.__init__ -dataclasses.dataclass -dataclasses.field -dataclasses.replace diff --git a/stubs/dataclasses/METADATA.toml b/stubs/dataclasses/METADATA.toml deleted file mode 100644 index 5f15410..0000000 --- a/stubs/dataclasses/METADATA.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.1" diff --git a/stubs/dataclasses/dataclasses.pyi b/stubs/dataclasses/dataclasses.pyi deleted file mode 100644 index 871ccab..0000000 --- a/stubs/dataclasses/dataclasses.pyi +++ /dev/null @@ -1,91 +0,0 @@ -import sys -from typing import Any, Callable, Generic, Iterable, Mapping, Tuple, Type, TypeVar, overload - -if sys.version_info >= (3, 9): - from types import GenericAlias - -_T = TypeVar("_T") - -class _MISSING_TYPE: ... - -MISSING: _MISSING_TYPE - -@overload -def asdict(obj: Any) -> dict[str, Any]: ... -@overload -def asdict(obj: Any, *, dict_factory: Callable[[list[Tuple[str, Any]]], _T]) -> _T: ... -@overload -def astuple(obj: Any) -> Tuple[Any, ...]: ... -@overload -def astuple(obj: Any, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ... -@overload -def dataclass(_cls: Type[_T]) -> Type[_T]: ... -@overload -def dataclass(_cls: None) -> Callable[[Type[_T]], Type[_T]]: ... -@overload -def dataclass( - *, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ... -) -> Callable[[Type[_T]], Type[_T]]: ... - -class Field(Generic[_T]): - name: str - type: Type[_T] - default: _T - default_factory: Callable[[], _T] - repr: bool - hash: bool | None - init: bool - compare: bool - metadata: Mapping[str, Any] - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... - -# NOTE: Actual return type is 'Field[_T]', but we want to help type checkers -# to understand the magic that happens at runtime. -@overload # `default` and `default_factory` are optional and mutually exclusive. -def field( - *, - default: _T, - init: bool = ..., - repr: bool = ..., - hash: bool | None = ..., - compare: bool = ..., - metadata: Mapping[str, Any] | None = ..., -) -> _T: ... -@overload -def field( - *, - default_factory: Callable[[], _T], - init: bool = ..., - repr: bool = ..., - hash: bool | None = ..., - compare: bool = ..., - metadata: Mapping[str, Any] | None = ..., -) -> _T: ... -@overload -def field( - *, init: bool = ..., repr: bool = ..., hash: bool | None = ..., compare: bool = ..., metadata: Mapping[str, Any] | None = ... -) -> Any: ... -def fields(class_or_instance: Any) -> Tuple[Field[Any], ...]: ... -def is_dataclass(obj: Any) -> bool: ... - -class FrozenInstanceError(AttributeError): ... - -class InitVar(Generic[_T]): - if sys.version_info >= (3, 9): - def __class_getitem__(cls, type: Any) -> GenericAlias: ... - -def make_dataclass( - cls_name: str, - fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]], - *, - bases: Tuple[type, ...] = ..., - namespace: dict[str, Any] | None = ..., - init: bool = ..., - repr: bool = ..., - eq: bool = ..., - order: bool = ..., - unsafe_hash: bool = ..., - frozen: bool = ..., -) -> type: ... -def replace(obj: _T, **changes: Any) -> _T: ... diff --git a/stubs/dateparser/METADATA.toml b/stubs/dateparser/METADATA.toml index 346c93f..c9f594b 100644 --- a/stubs/dateparser/METADATA.toml +++ b/stubs/dateparser/METADATA.toml @@ -1 +1 @@ -version = "1.0" +version = "1.1.*" diff --git a/stubs/dateparser/dateparser/__init__.pyi b/stubs/dateparser/dateparser/__init__.pyi index 2a137ef..b649b36 100644 --- a/stubs/dateparser/dateparser/__init__.pyi +++ b/stubs/dateparser/dateparser/__init__.pyi @@ -1,20 +1,14 @@ import datetime -import sys -from typing import Set, Tuple +from typing_extensions import Literal, TypeAlias, TypedDict -from dateparser.date import DateDataParser - -if sys.version_info >= (3, 8): - from typing import Literal, TypedDict -else: - from typing_extensions import Literal, TypedDict +from .date import DateDataParser, _DetectLanguagesFunction __version__: str _default_parser: DateDataParser -_Part = Literal["day", "month", "year"] -_ParserKind = Literal["timestamp", "relative-time", "custom-formats", "absolute-time", "no-spaces-time"] +_Part: TypeAlias = Literal["day", "month", "year"] +_ParserKind: TypeAlias = Literal["timestamp", "relative-time", "custom-formats", "absolute-time", "no-spaces-time"] class _Settings(TypedDict, total=False): DATE_ORDER: str @@ -34,9 +28,10 @@ class _Settings(TypedDict, total=False): def parse( date_string: str, - date_formats: list[str] | Tuple[str] | Set[str] | None = ..., - languages: list[str] | Tuple[str] | Set[str] | None = ..., - locales: list[str] | Tuple[str] | Set[str] | None = ..., + date_formats: list[str] | tuple[str, ...] | set[str] | None = ..., + languages: list[str] | tuple[str, ...] | set[str] | None = ..., + locales: list[str] | tuple[str, ...] | set[str] | None = ..., region: str | None = ..., settings: _Settings | None = ..., + detect_languages_function: _DetectLanguagesFunction | None = ..., ) -> datetime.datetime | None: ... diff --git a/stubs/dateparser/dateparser/conf.pyi b/stubs/dateparser/dateparser/conf.pyi index 30d86dc..7b816d9 100644 --- a/stubs/dateparser/dateparser/conf.pyi +++ b/stubs/dateparser/dateparser/conf.pyi @@ -1,7 +1,8 @@ +from _typeshed import Self from typing import Any class Settings: - def __new__(cls, *args, **kw) -> Settings: ... + def __new__(cls: type[Self], *args, **kw) -> Self: ... def __init__(self, settings: Any | None = ...) -> None: ... @classmethod def get_key(cls, settings: Any | None = ...): ... diff --git a/stubs/dateparser/dateparser/date.pyi b/stubs/dateparser/dateparser/date.pyi index cc5118d..961da4f 100644 --- a/stubs/dateparser/dateparser/date.pyi +++ b/stubs/dateparser/dateparser/date.pyi @@ -1,22 +1,18 @@ import collections -import sys -from _typeshed import Self as Self +from collections.abc import Callable, Iterable, Iterator from datetime import datetime -from typing import ClassVar, Iterable, Iterator, Type, overload +from re import Pattern +from typing import ClassVar, overload +from typing_extensions import Literal, TypeAlias from dateparser import _Settings from dateparser.conf import Settings from dateparser.languages.loader import LocaleDataLoader from dateparser.languages.locale import Locale -if sys.version_info >= (3, 8): - from re import Pattern - from typing import Literal -else: - from typing import Pattern - from typing_extensions import Literal +_DetectLanguagesFunction: TypeAlias = Callable[[str, float], list[str]] +_Period: TypeAlias = Literal["time", "day", "week", "month", "year"] -_Period = Literal["time", "day", "week", "month", "year"] APOSTROPHE_LOOK_ALIKE_CHARS: list[str] RE_NBSP: Pattern[str] RE_SPACES: Pattern[str] @@ -33,18 +29,18 @@ def sanitize_spaces(date_string: str) -> str: ... def date_range(begin, end, **kwargs) -> None: ... def get_intersecting_periods(low, high, period: str = ...) -> None: ... def sanitize_date(date_string: str) -> str: ... -def get_date_from_timestamp(date_string: str, settings: Settings) -> datetime | None: ... +def get_date_from_timestamp(date_string: str, settings: Settings, negative: bool = ...) -> datetime | None: ... def parse_with_formats(date_string: str, date_formats: Iterable[str], settings: Settings) -> DateData: ... class _DateLocaleParser: locale: Locale date_string: str - date_formats: list[str] | tuple[str] | set[str] | None + date_formats: list[str] | tuple[str, ...] | set[str] | None def __init__( self, locale: Locale, date_string: str, - date_formats: list[str] | tuple[str] | set[str] | None, + date_formats: list[str] | tuple[str, ...] | set[str] | None, settings: Settings | None = ..., ) -> None: ... @classmethod @@ -52,7 +48,7 @@ class _DateLocaleParser: cls, locale: Locale, date_string: str, - date_formats: list[str] | tuple[str] | set[str] | None = ..., + date_formats: list[str] | tuple[str, ...] | set[str] | None = ..., settings: Settings | None = ..., ) -> DateData: ... def _parse(self) -> DateData | None: ... @@ -90,21 +86,23 @@ class DateDataParser: try_previous_locales: bool use_given_order: bool languages: list[str] | None - locales: list[str] | tuple[str] | set[str] | None + locales: list[str] | tuple[str, ...] | set[str] | None region: str + detect_languages_function: _DetectLanguagesFunction | None previous_locales: collections.OrderedDict[Locale, None] def __init__( self, - languages: list[str] | tuple[str] | set[str] | None = ..., - locales: list[str] | tuple[str] | set[str] | None = ..., + languages: list[str] | tuple[str, ...] | set[str] | None = ..., + locales: list[str] | tuple[str, ...] | set[str] | None = ..., region: str | None = ..., try_previous_locales: bool = ..., use_given_order: bool = ..., settings: _Settings | None = ..., + detect_languages_function: _DetectLanguagesFunction | None = ..., ) -> None: ... - def get_date_data(self, date_string: str, date_formats: list[str] | tuple[str] | set[str] | None = ...) -> DateData: ... - def get_date_tuple(self, date_string: str, date_formats: list[str] | tuple[str] | set[str] | None = ...): ... + def get_date_data(self, date_string: str, date_formats: list[str] | tuple[str, ...] | set[str] | None = ...) -> DateData: ... + def get_date_tuple(self, date_string: str, date_formats: list[str] | tuple[str, ...] | set[str] | None = ...): ... def _get_applicable_locales(self, date_string: str) -> Iterator[Locale]: ... def _is_applicable_locale(self, locale: Locale, date_string: str) -> bool: ... @classmethod - def _get_locale_loader(cls: Type[DateDataParser]) -> LocaleDataLoader: ... + def _get_locale_loader(cls: type[DateDataParser]) -> LocaleDataLoader: ... diff --git a/stubs/dateparser/dateparser/languages/loader.pyi b/stubs/dateparser/dateparser/languages/loader.pyi index 431979b..87e532b 100644 --- a/stubs/dateparser/dateparser/languages/loader.pyi +++ b/stubs/dateparser/dateparser/languages/loader.pyi @@ -1,5 +1,6 @@ from collections import OrderedDict -from typing import Any, Iterator, List +from collections.abc import Iterator +from typing import Any from .locale import Locale @@ -8,16 +9,16 @@ LOCALE_SPLIT_PATTERN: Any class LocaleDataLoader: def get_locale_map( self, - languages: List[str] | None = ..., - locales: List[str] | None = ..., + languages: list[str] | None = ..., + locales: list[str] | None = ..., region: str | None = ..., use_given_order: bool = ..., allow_conflicting_locales: bool = ..., - ) -> OrderedDict[str, List[Any] | str | int]: ... + ) -> OrderedDict[str, list[Any] | str | int]: ... def get_locales( self, - languages: List[str] | None = ..., - locales: List[str] | None = ..., + languages: list[str] | None = ..., + locales: list[str] | None = ..., region: str | None = ..., use_given_order: bool = ..., allow_conflicting_locales: bool = ..., diff --git a/stubs/dateparser/dateparser/languages/locale.pyi b/stubs/dateparser/dateparser/languages/locale.pyi index 1c91e26..2a06040 100644 --- a/stubs/dateparser/dateparser/languages/locale.pyi +++ b/stubs/dateparser/dateparser/languages/locale.pyi @@ -1,12 +1,7 @@ -import sys +from re import Pattern from dateparser.conf import Settings -if sys.version_info >= (3, 8): - from re import Pattern -else: - from typing import Pattern - DIGIT_GROUP_PATTERN: Pattern[str] NUMERAL_PATTERN: Pattern[str] diff --git a/stubs/dateparser/dateparser/parser.pyi b/stubs/dateparser/dateparser/parser.pyi index de87e8e..42512a5 100644 --- a/stubs/dateparser/dateparser/parser.pyi +++ b/stubs/dateparser/dateparser/parser.pyi @@ -1,3 +1,4 @@ +import datetime from typing import Any NSP_COMPATIBLE: Any @@ -41,7 +42,7 @@ class _parser: ordered_num_directives: Any def __init__(self, tokens, settings): ... @classmethod - def parse(cls, datestring, settings): ... + def parse(cls, datestring, settings, tz: datetime.tzinfo | None = ...): ... class tokenizer: digits: str diff --git a/stubs/dateparser/dateparser/search/__init__.pyi b/stubs/dateparser/dateparser/search/__init__.pyi index e75ed92..b9b1d3e 100644 --- a/stubs/dateparser/dateparser/search/__init__.pyi +++ b/stubs/dateparser/dateparser/search/__init__.pyi @@ -1,23 +1,23 @@ -import sys +from collections.abc import Mapping, Set as AbstractSet from datetime import datetime -from typing import Any, List, Mapping, Set, Tuple, overload +from typing import Any, overload +from typing_extensions import Literal -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal +from ..date import _DetectLanguagesFunction @overload def search_dates( text: str, - languages: List[str] | Tuple[str] | Set[str] | None, + languages: list[str] | tuple[str, ...] | AbstractSet[str] | None, settings: Mapping[Any, Any] | None, add_detected_language: Literal[True], -) -> List[Tuple[str, datetime, str]]: ... + detect_languages_function: _DetectLanguagesFunction | None = ..., +) -> list[tuple[str, datetime, str]]: ... @overload def search_dates( text: str, - languages: List[str] | Tuple[str] | Set[str] | None = ..., + languages: list[str] | tuple[str, ...] | AbstractSet[str] | None = ..., settings: Mapping[Any, Any] | None = ..., add_detected_language: Literal[False] = ..., -) -> List[Tuple[str, datetime]]: ... + detect_languages_function: _DetectLanguagesFunction | None = ..., +) -> list[tuple[str, datetime]]: ... diff --git a/stubs/dateparser/dateparser/search/search.pyi b/stubs/dateparser/dateparser/search/search.pyi index 67e6e95..d0efac4 100644 --- a/stubs/dateparser/dateparser/search/search.pyi +++ b/stubs/dateparser/dateparser/search/search.pyi @@ -1,5 +1,7 @@ from typing import Any +from ..date import _DetectLanguagesFunction + RELATIVE_REG: Any def date_is_relative(translation): ... @@ -25,5 +27,13 @@ class DateSearchWithDetection: search: Any def __init__(self) -> None: ... language_detector: Any - def detect_language(self, text, languages): ... - def search_dates(self, text, languages: Any | None = ..., settings: Any | None = ...): ... + def detect_language( + self, text, languages, settings: Any | None = ..., detect_languages_function: _DetectLanguagesFunction | None = ... + ): ... + def search_dates( + self, + text, + languages: Any | None = ..., + settings: Any | None = ..., + detect_languages_function: _DetectLanguagesFunction | None = ..., + ): ... diff --git a/stubs/dateparser/dateparser/utils/__init__.pyi b/stubs/dateparser/dateparser/utils/__init__.pyi index 8b979d0..769e865 100644 --- a/stubs/dateparser/dateparser/utils/__init__.pyi +++ b/stubs/dateparser/dateparser/utils/__init__.pyi @@ -1,11 +1,12 @@ from collections import OrderedDict -from typing import Any, List, Mapping +from collections.abc import Mapping +from typing import Any def strip_braces(date_string: str) -> str: ... def normalize_unicode(string: str, form: str = ...) -> str: ... def combine_dicts( primary_dict: Mapping[Any, Any], supplementary_dict: Mapping[Any, Any] -) -> OrderedDict[str, str | List[Any]]: ... +) -> OrderedDict[str, str | list[Any]]: ... def find_date_separator(format) -> Any: ... def localize_timezone(date_time, tz_string): ... def apply_tzdatabase_timezone(date_time, pytz_string): ... diff --git a/stubs/decorator/METADATA.toml b/stubs/decorator/METADATA.toml index 31f638b..4c67f14 100644 --- a/stubs/decorator/METADATA.toml +++ b/stubs/decorator/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.1" -python2 = true +version = "5.1.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/decorator/decorator.pyi b/stubs/decorator/decorator.pyi index 0d50a54..36ac420 100644 --- a/stubs/decorator/decorator.pyi +++ b/stubs/decorator/decorator.pyi @@ -1,77 +1,64 @@ -import sys -from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, Tuple, TypeVar +from builtins import dict as _dict # alias to avoid conflicts with attribute name +from collections.abc import Callable, Iterator +from contextlib import _GeneratorContextManager +from inspect import Signature, getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction +from re import Pattern +from typing import Any, TypeVar +from typing_extensions import ParamSpec _C = TypeVar("_C", bound=Callable[..., Any]) _Func = TypeVar("_Func", bound=Callable[..., Any]) _T = TypeVar("_T") +_P = ParamSpec("_P") def get_init(cls: type) -> None: ... -if sys.version_info >= (3,): - from inspect import getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction -else: - class FullArgSpec(NamedTuple): - args: list[str] - varargs: str | None - varkw: str | None - defaults: Tuple[Any, ...] - kwonlyargs: list[str] - kwonlydefaults: dict[str, Any] - annotations: dict[str, Any] - def iscoroutinefunction(f: Callable[..., Any]) -> bool: ... - def getfullargspec(func: Any) -> FullArgSpec: ... - -if sys.version_info >= (3, 2): - from contextlib import _GeneratorContextManager -else: - from contextlib import GeneratorContextManager as _GeneratorContextManager - DEF: Pattern[str] -_dict = dict # conflicts with attribute name - -class FunctionMaker(object): - args: list[Text] - varargs: Text | None - varkw: Text | None - defaults: Tuple[Any, ...] - kwonlyargs: list[Text] - kwonlydefaults: Text | None - shortsignature: Text | None - name: Text - doc: Text | None - module: Text | None - annotations: _dict[Text, Any] - signature: Text - dict: _dict[Text, Any] +class FunctionMaker: + args: list[str] + varargs: str | None + varkw: str | None + defaults: tuple[Any, ...] + kwonlyargs: list[str] + kwonlydefaults: str | None + shortsignature: str | None + name: str + doc: str | None + module: str | None + annotations: _dict[str, Any] + signature: str + dict: _dict[str, Any] def __init__( self, func: Callable[..., Any] | None = ..., - name: Text | None = ..., - signature: Text | None = ..., - defaults: Tuple[Any, ...] | None = ..., - doc: Text | None = ..., - module: Text | None = ..., - funcdict: _dict[Text, Any] | None = ..., + name: str | None = ..., + signature: str | None = ..., + defaults: tuple[Any, ...] | None = ..., + doc: str | None = ..., + module: str | None = ..., + funcdict: _dict[str, Any] | None = ..., ) -> None: ... def update(self, func: Any, **kw: Any) -> None: ... def make( - self, src_templ: Text, evaldict: _dict[Text, Any] | None = ..., addsource: bool = ..., **attrs: Any + self, src_templ: str, evaldict: _dict[str, Any] | None = ..., addsource: bool = ..., **attrs: Any ) -> Callable[..., Any]: ... @classmethod def create( cls, obj: Any, - body: Text, - evaldict: _dict[Text, Any], - defaults: Tuple[Any, ...] | None = ..., - doc: Text | None = ..., - module: Text | None = ..., + body: str, + evaldict: _dict[str, Any], + defaults: tuple[Any, ...] | None = ..., + doc: str | None = ..., + module: str | None = ..., addsource: bool = ..., **attrs: Any, ) -> Callable[..., Any]: ... +def fix(args: tuple[Any, ...], kwargs: dict[str, Any], sig: Signature) -> tuple[tuple[Any, ...], dict[str, Any]]: ... def decorate(func: _Func, caller: Callable[..., Any], extras: Any = ...) -> _Func: ... +def decoratorx(caller: Callable[..., Any]) -> Callable[..., Any]: ... def decorator( caller: Callable[..., Any], _func: Callable[..., Any] | None = ... ) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ... @@ -79,5 +66,6 @@ def decorator( class ContextManager(_GeneratorContextManager[_T]): def __call__(self, func: _C) -> _C: ... -def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ... +def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, ContextManager[_T]]: ... +def append(a: type, vancestors: list[type]) -> None: ... def dispatch_on(*dispatch_args: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ... diff --git a/stubs/dj-database-url/METADATA.toml b/stubs/dj-database-url/METADATA.toml new file mode 100644 index 0000000..516f11f --- /dev/null +++ b/stubs/dj-database-url/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/dj-database-url/dj_database_url.pyi b/stubs/dj-database-url/dj_database_url.pyi new file mode 100644 index 0000000..5a39aa9 --- /dev/null +++ b/stubs/dj-database-url/dj_database_url.pyi @@ -0,0 +1,27 @@ +from typing import Any +from typing_extensions import TypedDict + +DJANGO_VERSION: tuple[str | int, ...] | None # None if django is not installed +DEFAULT_ENV: str +SCHEMES: dict[str, str] + +# From https://docs.djangoproject.com/en/4.0/ref/settings/#databases +class _DBConfig(TypedDict, total=False): + ATOMIC_REQUESTS: bool + AUTOCOMMIT: bool + CONN_MAX_AGE: int + DISABLE_SERVER_SIDE_CURSORS: bool + ENGINE: str + HOST: str + NAME: str + OPTIONS: dict[str, Any] | None + PASSWORD: str + PORT: str + TEST: dict[str, Any] + TIME_ZONE: str + USER: str + +def parse(url: str, engine: str | None = ..., conn_max_age: int = ..., ssl_require: bool = ...) -> _DBConfig: ... +def config( + env: str = ..., default: str | None = ..., engine: str | None = ..., conn_max_age: int = ..., ssl_require: bool = ... +) -> _DBConfig: ... diff --git a/stubs/docopt/METADATA.toml b/stubs/docopt/METADATA.toml index c7567c2..a95bee1 100644 --- a/stubs/docopt/METADATA.toml +++ b/stubs/docopt/METADATA.toml @@ -1,3 +1,4 @@ -# Prior to v0.6, docopt() had only 3 optional args -version = "0.6" -python2 = true \ No newline at end of file +version = "0.6.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/docopt/docopt.pyi b/stubs/docopt/docopt.pyi index 7f7bba6..570e661 100644 --- a/stubs/docopt/docopt.pyi +++ b/stubs/docopt/docopt.pyi @@ -1,9 +1,12 @@ -from typing import Any, Iterable, Union +from collections.abc import Iterable +from typing import Any +from typing_extensions import TypeAlias __version__: str -_Argv = Union[Iterable[str], str] +_Argv: TypeAlias = Iterable[str] | str +def printable_usage(doc: str) -> str: ... def docopt( doc: str, argv: _Argv | None = ..., help: bool = ..., version: Any | None = ..., options_first: bool = ... ) -> dict[str, Any]: ... # Really should be dict[str, str | bool] diff --git a/stubs/docutils/@tests/stubtest_allowlist.txt b/stubs/docutils/@tests/stubtest_allowlist.txt index a6aa9c5..e822937 100644 --- a/stubs/docutils/@tests/stubtest_allowlist.txt +++ b/stubs/docutils/@tests/stubtest_allowlist.txt @@ -4,7 +4,20 @@ docutils.frontend.ConfigParser.read docutils.frontend.OptionParser.__getattr__ docutils.io.FileOutput.__getattr__ docutils.io.FileOutput.__init__ -docutils.io.Input.__getattr__ docutils.io.Input.__init__ +docutils.languages.LanguageImporter.__getattr__ +docutils.nodes.Element.__getattr__ +docutils.nodes.NodeVisitor.__getattr__ +docutils.nodes.document.__getattr__ +docutils.nodes.document.__init__ docutils.parsers.rst.Directive.__getattr__ -docutils.parsers.rst.nodes +docutils.transforms.Transform.__getattr__ +docutils.transforms.Transformer.__getattr__ +docutils.utils.Reporter.__getattr__ +docutils.parsers.recommonmark_wrapper + +# the constructor appears to be mostly internal API, public API users are meant to use docutils.utils.new_reporter instead +docutils.utils.Reporter.__init__ + +# these methods take a rawsource parameter that has been deprecated and is completely ignored, so we omit it from the stub +docutils.nodes.Text.__new__ diff --git a/stubs/docutils/METADATA.toml b/stubs/docutils/METADATA.toml index b3849f7..d2a449c 100644 --- a/stubs/docutils/METADATA.toml +++ b/stubs/docutils/METADATA.toml @@ -1 +1 @@ -version = "0.17" +version = "0.19.*" diff --git a/stubs/docutils/docutils/__init__.pyi b/stubs/docutils/docutils/__init__.pyi index d4477b9..cfa9914 100644 --- a/stubs/docutils/docutils/__init__.pyi +++ b/stubs/docutils/docutils/__init__.pyi @@ -1,4 +1,5 @@ -from typing import Any, ClassVar, NamedTuple, Tuple +from _typeshed import Self +from typing import Any, ClassVar, NamedTuple __docformat__: str __version__: str @@ -13,8 +14,14 @@ class _VersionInfo(NamedTuple): class VersionInfo(_VersionInfo): def __new__( - cls, major: int = ..., minor: int = ..., micro: int = ..., releaselevel: str = ..., serial: int = ..., release: bool = ... - ) -> VersionInfo: ... + cls: type[Self], + major: int = ..., + minor: int = ..., + micro: int = ..., + releaselevel: str = ..., + serial: int = ..., + release: bool = ..., + ) -> Self: ... __version_info__: VersionInfo __version_details__: str @@ -23,19 +30,19 @@ class ApplicationError(Exception): ... class DataError(ApplicationError): ... class SettingsSpec: - settings_spec: ClassVar[Tuple[Any, ...]] + settings_spec: ClassVar[tuple[Any, ...]] settings_defaults: ClassVar[dict[Any, Any] | None] settings_default_overrides: ClassVar[dict[Any, Any] | None] - relative_path_settings: ClassVar[Tuple[Any, ...]] + relative_path_settings: ClassVar[tuple[Any, ...]] config_section: ClassVar[str | None] - config_section_dependencies: ClassVar[Tuple[str, ...] | None] + config_section_dependencies: ClassVar[tuple[str, ...] | None] class TransformSpec: def get_transforms(self) -> list[Any]: ... - default_transforms: ClassVar[Tuple[Any, ...]] + default_transforms: ClassVar[tuple[Any, ...]] unknown_reference_resolvers: ClassVar[list[Any]] class Component(SettingsSpec, TransformSpec): component_type: ClassVar[str | None] - supported: ClassVar[Tuple[str, ...]] + supported: ClassVar[tuple[str, ...]] def supports(self, format: str) -> bool: ... diff --git a/stubs/docutils/docutils/core.pyi b/stubs/docutils/docutils/core.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/core.pyi +++ b/stubs/docutils/docutils/core.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/examples.pyi b/stubs/docutils/docutils/examples.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/examples.pyi +++ b/stubs/docutils/docutils/examples.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/frontend.pyi b/stubs/docutils/docutils/frontend.pyi index c32dc44..7a65948 100644 --- a/stubs/docutils/docutils/frontend.pyi +++ b/stubs/docutils/docutils/frontend.pyi @@ -1,7 +1,8 @@ import optparse +from _typeshed import Incomplete from collections.abc import Iterable, Mapping from configparser import RawConfigParser -from typing import Any, ClassVar, Tuple, Type +from typing import Any, ClassVar from docutils import SettingsSpec from docutils.parsers import Parser @@ -45,7 +46,7 @@ def validate_smartquotes_locales( ) -> list[tuple[str, str]]: ... def make_paths_absolute(pathdict, keys, base_path: Any | None = ...) -> None: ... def make_one_path_absolute(base_path, path) -> str: ... -def filter_settings_spec(settings_spec, *exclude, **replace) -> Tuple[Any, ...]: ... +def filter_settings_spec(settings_spec, *exclude, **replace) -> tuple[Any, ...]: ... class Values(optparse.Values): def update(self, other_dict, option_parser) -> None: ... @@ -64,15 +65,15 @@ class OptionParser(optparse.OptionParser, SettingsSpec): version_template: ClassVar[str] def __init__( self, - components: Iterable[Type[Parser]] = ..., + components: Iterable[type[Parser]] = ..., defaults: Mapping[str, Any] | None = ..., read_config_files: bool | None = ..., *args, **kwargs, ) -> None: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class ConfigParser(RawConfigParser): - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class ConfigDeprecationWarning(DeprecationWarning): ... diff --git a/stubs/docutils/docutils/io.pyi b/stubs/docutils/docutils/io.pyi index b8d4751..f81129c 100644 --- a/stubs/docutils/docutils/io.pyi +++ b/stubs/docutils/docutils/io.pyi @@ -1,5 +1,14 @@ -from _typeshed import OpenBinaryModeReading, OpenBinaryModeWriting, OpenTextModeReading, OpenTextModeWriting +from _typeshed import ( + Incomplete, + OpenBinaryModeReading, + OpenBinaryModeWriting, + OpenTextModeReading, + OpenTextModeWriting, + SupportsWrite, +) +from re import Pattern from typing import Any, ClassVar +from typing_extensions import Literal from docutils import TransformSpec @@ -9,12 +18,17 @@ class InputError(IOError): ... class OutputError(IOError): ... def check_encoding(stream: Any, encoding: str) -> bool | None: ... +def error_string(err: BaseException) -> str: ... class Input(TransformSpec): component_type: ClassVar[str] default_source_path: ClassVar[str | None] def read(self) -> Any: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def decode(self, data: str | bytes) -> str: ... + coding_slug: ClassVar[Pattern[bytes]] + byte_order_marks: ClassVar[tuple[tuple[bytes, str], ...]] + def determine_encoding_from_data(self, data: str | bytes) -> str | None: ... + def isatty(self) -> bool: ... class Output(TransformSpec): component_type: ClassVar[str] @@ -29,6 +43,18 @@ class Output(TransformSpec): def write(self, data: str) -> Any: ... # returns bytes or str def encode(self, data: str) -> Any: ... # returns bytes or str +class ErrorOutput: + def __init__( + self, + destination: str | SupportsWrite[str] | SupportsWrite[bytes] | Literal[False] | None = ..., + encoding: str | None = ..., + encoding_errors: str = ..., + decoding_errors: str = ..., + ) -> None: ... + def write(self, data: str | bytes | Exception) -> None: ... + def close(self) -> None: ... + def isatty(self) -> bool: ... + class FileInput(Input): def __init__( self, @@ -39,12 +65,13 @@ class FileInput(Input): autoclose: bool = ..., mode: OpenTextModeReading | OpenBinaryModeReading = ..., ) -> None: ... + def read(self) -> str: ... def readlines(self) -> list[str]: ... def close(self) -> None: ... class FileOutput(Output): mode: ClassVar[OpenTextModeWriting | OpenBinaryModeWriting] - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class BinaryFileOutput(FileOutput): ... diff --git a/stubs/docutils/docutils/languages/__init__.pyi b/stubs/docutils/docutils/languages/__init__.pyi index 964e6fa..3638be1 100644 --- a/stubs/docutils/docutils/languages/__init__.pyi +++ b/stubs/docutils/docutils/languages/__init__.pyi @@ -1,3 +1,15 @@ -from typing import Any +from _typeshed import Incomplete +from typing import Protocol -def __getattr__(name: str) -> Any: ... # incomplete +from docutils.utils import Reporter + +class _LanguageModule(Protocol): + labels: dict[str, str] + author_separators: list[str] + bibliographic_fields: list[str] + +class LanguageImporter: + def __call__(self, language_code: str, reporter: Reporter | None = ...) -> _LanguageModule: ... + def __getattr__(self, __name: str) -> Incomplete: ... + +get_language: LanguageImporter diff --git a/stubs/docutils/docutils/nodes.pyi b/stubs/docutils/docutils/nodes.pyi index 964e6fa..5281bdc 100644 --- a/stubs/docutils/docutils/nodes.pyi +++ b/stubs/docutils/docutils/nodes.pyi @@ -1,3 +1,137 @@ -from typing import Any +import xml.dom.minidom +from _typeshed import Incomplete, Self +from abc import abstractmethod +from collections.abc import Callable, Generator, Iterable, Sequence +from typing import Any, ClassVar, Protocol, TypeVar, overload +from typing_extensions import Literal -def __getattr__(name: str) -> Any: ... # incomplete +from docutils.transforms import Transformer + +_N = TypeVar("_N", bound=Node) + +class _DomModule(Protocol): + Document: type[xml.dom.minidom.Document] + +class Node: + # children is initialized by the subclasses + children: Sequence[Node] + parent: Node | None + source: str | None + line: int | None + document: document | None + def __bool__(self) -> Literal[True]: ... + def asdom(self, dom: _DomModule | None = ...) -> xml.dom.minidom.Element: ... + # While docutils documents the Node class to be abstract it does not + # actually use the ABCMeta metaclass. We still set @abstractmethod here + # (although it's not used in the docutils implementation) because it + # makes Mypy reject Node() with "Cannot instantiate abstract class". + @abstractmethod + def copy(self: Self) -> Self: ... + @abstractmethod + def deepcopy(self: Self) -> Self: ... + @abstractmethod + def pformat(self, indent: str = ..., level: int = ...) -> str: ... + @abstractmethod + def astext(self) -> str: ... + def setup_child(self, child: Node) -> None: ... + def walk(self, visitor: NodeVisitor) -> bool: ... + def walkabout(self, visitor: NodeVisitor) -> bool: ... + @overload + def findall( + self, condition: type[_N], include_self: bool = ..., descend: bool = ..., siblings: bool = ..., ascend: bool = ... + ) -> Generator[_N, None, None]: ... + @overload + def findall( + self, + condition: Callable[[Node], bool] | None = ..., + include_self: bool = ..., + descend: bool = ..., + siblings: bool = ..., + ascend: bool = ..., + ) -> Generator[Node, None, None]: ... + @overload + def traverse( + self, condition: type[_N], include_self: bool = ..., descend: bool = ..., siblings: bool = ..., ascend: bool = ... + ) -> list[_N]: ... + @overload + def traverse( + self, + condition: Callable[[Node], bool] | None = ..., + include_self: bool = ..., + descend: bool = ..., + siblings: bool = ..., + ascend: bool = ..., + ) -> list[Node]: ... + @overload + def next_node( + self, condition: type[_N], include_self: bool = ..., descend: bool = ..., siblings: bool = ..., ascend: bool = ... + ) -> _N: ... + @overload + def next_node( + self, + condition: Callable[[Node], bool] | None = ..., + include_self: bool = ..., + descend: bool = ..., + siblings: bool = ..., + ascend: bool = ..., + ) -> Node: ... + def previous_sibling(self) -> Node | None: ... + +class Element(Node): + children: list[Node] + def __init__(self, rawsource: str = ..., *children: Node, **attributes): ... + def __len__(self) -> int: ... + def __contains__(self, key: str | Node) -> bool: ... + @overload + def __getitem__(self, key: str) -> Any: ... + @overload + def __getitem__(self, key: int) -> Node: ... + @overload + def __getitem__(self, key: slice) -> list[Node]: ... + @overload + def __setitem__(self, key: str, item: Any) -> None: ... + @overload + def __setitem__(self, key: int, item: Node) -> None: ... + @overload + def __setitem__(self, key: slice, item: Iterable[Node]) -> None: ... + def __delitem__(self, key: str | int | slice) -> None: ... + def __add__(self, other: list[Node]) -> list[Node]: ... + def __radd__(self, other: list[Node]) -> list[Node]: ... + def __iadd__(self: Self, other: Node | Iterable[Node]) -> Self: ... + def copy(self: Self) -> Self: ... + def deepcopy(self: Self) -> Self: ... + def pformat(self, indent: str = ..., level: int = ...) -> str: ... + def astext(self) -> str: ... + def __getattr__(self, __name: str) -> Incomplete: ... + +class Text(Node, str): + tagname: ClassVar[str] + children: tuple[()] + + # we omit the rawsource parameter because it has been deprecated and is ignored + def __new__(cls: type[Self], data: str) -> Self: ... + def __init__(self, data: str) -> None: ... + def shortrepr(self, maxlen: int = ...) -> str: ... + def copy(self: Self) -> Self: ... + def deepcopy(self: Self) -> Self: ... + def pformat(self, indent: str = ..., level: int = ...) -> str: ... + def astext(self) -> str: ... + def rstrip(self, chars: str | None = ...) -> str: ... + def lstrip(self, chars: str | None = ...) -> str: ... + +class Structural: ... +class Root: ... + +class document(Root, Structural, Element): + transformer: Transformer + def copy(self: Self) -> Self: ... + def deepcopy(self: Self) -> Self: ... + def pformat(self, indent: str = ..., level: int = ...) -> str: ... + def astext(self) -> str: ... + def __getattr__(self, __name: str) -> Incomplete: ... + +class NodeVisitor: + def __init__(self, document: document): ... + def __getattr__(self, __name: str) -> Incomplete: ... + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/__init__.pyi b/stubs/docutils/docutils/parsers/__init__.pyi index a77c183..0468330 100644 --- a/stubs/docutils/docutils/parsers/__init__.pyi +++ b/stubs/docutils/docutils/parsers/__init__.pyi @@ -1,16 +1,17 @@ -from typing import Any, ClassVar, Type +from typing import Any, ClassVar from docutils import Component +from docutils.nodes import document as _document class Parser(Component): component_type: ClassVar[str] config_section: ClassVar[str] inputstring: Any # defined after call to setup_parse() document: Any # defined after call to setup_parse() - def parse(self, inputstring: str, document) -> None: ... - def setup_parse(self, inputstring: str, document) -> None: ... + def parse(self, inputstring: str, document: _document) -> None: ... + def setup_parse(self, inputstring: str, document: _document) -> None: ... def finish_parse(self) -> None: ... _parser_aliases: dict[str, str] -def get_parser_class(parser_name: str) -> Type[Parser]: ... +def get_parser_class(parser_name: str) -> type[Parser]: ... diff --git a/stubs/docutils/docutils/parsers/null.pyi b/stubs/docutils/docutils/parsers/null.pyi index 1d36291..edc9773 100644 --- a/stubs/docutils/docutils/parsers/null.pyi +++ b/stubs/docutils/docutils/parsers/null.pyi @@ -1,6 +1,6 @@ -from typing import ClassVar, Tuple +from typing import ClassVar from docutils import parsers class Parser(parsers.Parser): - config_section_dependencies: ClassVar[Tuple[str, ...]] + config_section_dependencies: ClassVar[tuple[str, ...]] diff --git a/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi b/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi +++ b/stubs/docutils/docutils/parsers/recommonmark_wrapper.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/__init__.pyi b/stubs/docutils/docutils/parsers/rst/__init__.pyi index f605176..d6f2339 100644 --- a/stubs/docutils/docutils/parsers/rst/__init__.pyi +++ b/stubs/docutils/docutils/parsers/rst/__init__.pyi @@ -1,11 +1,12 @@ -from typing import Any, ClassVar, Tuple +from _typeshed import Incomplete +from typing import Any, ClassVar from typing_extensions import Literal from docutils import parsers from docutils.parsers.rst import states class Parser(parsers.Parser): - config_section_dependencies: ClassVar[Tuple[str, ...]] + config_section_dependencies: ClassVar[tuple[str, ...]] initial_state: Literal["Body", "RFC2822Body"] state_classes: Any inliner: Any @@ -29,6 +30,6 @@ class Directive: state: states.RSTState, state_machine: states.RSTStateMachine, ) -> None: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... def convert_directive_function(directive_fn): ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/__init__.pyi b/stubs/docutils/docutils/parsers/rst/directives/__init__.pyi new file mode 100644 index 0000000..5ffbcf7 --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/__init__.pyi @@ -0,0 +1,12 @@ +from _typeshed import Incomplete + +from docutils.languages import _LanguageModule +from docutils.nodes import document +from docutils.parsers.rst import Directive +from docutils.utils import SystemMessage + +def register_directive(name: str, directive: type[Directive]) -> None: ... +def directive( + directive_name: str, language_module: _LanguageModule, document: document +) -> tuple[type[Directive] | None, list[SystemMessage]]: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/admonitions.pyi b/stubs/docutils/docutils/parsers/rst/directives/admonitions.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/admonitions.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/body.pyi b/stubs/docutils/docutils/parsers/rst/directives/body.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/body.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/html.pyi b/stubs/docutils/docutils/parsers/rst/directives/html.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/html.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/images.pyi b/stubs/docutils/docutils/parsers/rst/directives/images.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/images.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/misc.pyi b/stubs/docutils/docutils/parsers/rst/directives/misc.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/misc.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/parts.pyi b/stubs/docutils/docutils/parsers/rst/directives/parts.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/parts.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/references.pyi b/stubs/docutils/docutils/parsers/rst/directives/references.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/references.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/directives/tables.pyi b/stubs/docutils/docutils/parsers/rst/directives/tables.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/parsers/rst/directives/tables.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/nodes.pyi b/stubs/docutils/docutils/parsers/rst/nodes.pyi deleted file mode 100644 index 964e6fa..0000000 --- a/stubs/docutils/docutils/parsers/rst/nodes.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... # incomplete diff --git a/stubs/docutils/docutils/parsers/rst/roles.pyi b/stubs/docutils/docutils/parsers/rst/roles.pyi index 2c3d65b..59580d6 100644 --- a/stubs/docutils/docutils/parsers/rst/roles.pyi +++ b/stubs/docutils/docutils/parsers/rst/roles.pyi @@ -1,12 +1,20 @@ -from typing import Any, Callable, Dict, List, Tuple +from _typeshed import Incomplete +from collections.abc import Callable +from typing import Any +from typing_extensions import TypeAlias import docutils.nodes import docutils.parsers.rst.states +from docutils.languages import _LanguageModule +from docutils.utils import Reporter, SystemMessage -_RoleFn = Callable[ - [str, str, str, int, docutils.parsers.rst.states.Inliner, Dict[str, Any], List[str]], - Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]], +_RoleFn: TypeAlias = Callable[ + [str, str, str, int, docutils.parsers.rst.states.Inliner, dict[str, Any], list[str]], + tuple[list[docutils.nodes.reference], list[docutils.nodes.reference]], ] def register_local_role(name: str, role_fn: _RoleFn) -> None: ... -def __getattr__(name: str) -> Any: ... # incomplete +def role( + role_name: str, language_module: _LanguageModule, lineno: int, reporter: Reporter +) -> tuple[_RoleFn | None, list[SystemMessage]]: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/parsers/rst/states.pyi b/stubs/docutils/docutils/parsers/rst/states.pyi index a7f1069..1ef7be9 100644 --- a/stubs/docutils/docutils/parsers/rst/states.pyi +++ b/stubs/docutils/docutils/parsers/rst/states.pyi @@ -1,6 +1,6 @@ -from typing import Any +from _typeshed import Incomplete class Inliner: def __init__(self) -> None: ... -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/readers/__init__.pyi b/stubs/docutils/docutils/readers/__init__.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/readers/__init__.pyi +++ b/stubs/docutils/docutils/readers/__init__.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/readers/doctree.pyi b/stubs/docutils/docutils/readers/doctree.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/readers/doctree.pyi +++ b/stubs/docutils/docutils/readers/doctree.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/readers/pep.pyi b/stubs/docutils/docutils/readers/pep.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/readers/pep.pyi +++ b/stubs/docutils/docutils/readers/pep.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/readers/standalone.pyi b/stubs/docutils/docutils/readers/standalone.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/readers/standalone.pyi +++ b/stubs/docutils/docutils/readers/standalone.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/statemachine.pyi b/stubs/docutils/docutils/statemachine.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/statemachine.pyi +++ b/stubs/docutils/docutils/statemachine.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/transforms/__init__.pyi b/stubs/docutils/docutils/transforms/__init__.pyi index 964e6fa..1fdb00b 100644 --- a/stubs/docutils/docutils/transforms/__init__.pyi +++ b/stubs/docutils/docutils/transforms/__init__.pyi @@ -1,3 +1,14 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +from docutils.nodes import Node, document + +class Transform: + def __init__(self, document: document, startnode: Node | None = ...): ... + def __getattr__(self, __name: str) -> Incomplete: ... + +class Transformer: + def __init__(self, document: document): ... + def add_transform(self, transform_class: type[Transform], priority: int | None = ..., **kwargs) -> None: ... + def __getattr__(self, __name: str) -> Incomplete: ... + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/utils/__init__.pyi b/stubs/docutils/docutils/utils/__init__.pyi index 189352a..8c3733d 100644 --- a/stubs/docutils/docutils/utils/__init__.pyi +++ b/stubs/docutils/docutils/utils/__init__.pyi @@ -1,9 +1,12 @@ +import optparse +from _typeshed import Incomplete +from builtins import list as _list # alias to avoid name clashes with fields named list from collections.abc import Iterable -from typing import Any +from typing_extensions import Literal, TypeAlias +from docutils import ApplicationError from docutils.io import FileOutput - -_list = list +from docutils.nodes import document class DependencyList: list: _list[str] @@ -13,4 +16,24 @@ class DependencyList: def add(self, *filenames: str) -> None: ... def close(self) -> None: ... -def __getattr__(name: str) -> Any: ... # incomplete +_SystemMessageLevel: TypeAlias = Literal[0, 1, 2, 3, 4] + +class Reporter: + DEBUG_LEVEL: Literal[0] + INFO_LEVEL: Literal[1] + WARNING_LEVEL: Literal[2] + ERROR_LEVEL: Literal[3] + SEVERE_LEVEL: Literal[4] + + source: str + report_level: _SystemMessageLevel + halt_level: _SystemMessageLevel + def __getattr__(self, __name: str) -> Incomplete: ... + +class SystemMessage(ApplicationError): + level: _SystemMessageLevel + def __init__(self, system_message: object, level: _SystemMessageLevel): ... + +def new_reporter(source_path: str, settings: optparse.Values) -> Reporter: ... +def new_document(source_path: str, settings: optparse.Values | None = ...) -> document: ... +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/__init__.pyi b/stubs/docutils/docutils/writers/__init__.pyi index 964e6fa..0f6820f 100644 --- a/stubs/docutils/docutils/writers/__init__.pyi +++ b/stubs/docutils/docutils/writers/__init__.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/docutils_xml.pyi b/stubs/docutils/docutils/writers/docutils_xml.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/docutils_xml.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/html4css1.pyi b/stubs/docutils/docutils/writers/html4css1.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/html4css1.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/html5_polyglot.pyi b/stubs/docutils/docutils/writers/html5_polyglot.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/html5_polyglot.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/latex2e.pyi b/stubs/docutils/docutils/writers/latex2e.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/latex2e.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/manpage.pyi b/stubs/docutils/docutils/writers/manpage.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/manpage.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/null.pyi b/stubs/docutils/docutils/writers/null.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/null.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/odf_odt.pyi b/stubs/docutils/docutils/writers/odf_odt.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/odf_odt.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/pep_html.pyi b/stubs/docutils/docutils/writers/pep_html.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/pep_html.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/pseudoxml.pyi b/stubs/docutils/docutils/writers/pseudoxml.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/pseudoxml.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/s5_html.pyi b/stubs/docutils/docutils/writers/s5_html.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/s5_html.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/docutils/docutils/writers/xetex.pyi b/stubs/docutils/docutils/writers/xetex.pyi new file mode 100644 index 0000000..0f6820f --- /dev/null +++ b/stubs/docutils/docutils/writers/xetex.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/editdistance/METADATA.toml b/stubs/editdistance/METADATA.toml index c0ca287..f3aa6e4 100644 --- a/stubs/editdistance/METADATA.toml +++ b/stubs/editdistance/METADATA.toml @@ -1 +1,5 @@ -version = "0.5" +version = "0.6.*" + +[tool.stubtest] +ignore_missing_stub = false + diff --git a/stubs/editdistance/editdistance.pyi b/stubs/editdistance/editdistance.pyi deleted file mode 100644 index 082b0ac..0000000 --- a/stubs/editdistance/editdistance.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import Hashable, Iterable - -def eval(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ... -def distance(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ... diff --git a/stubs/editdistance/editdistance/__init__.pyi b/stubs/editdistance/editdistance/__init__.pyi new file mode 100644 index 0000000..3608849 --- /dev/null +++ b/stubs/editdistance/editdistance/__init__.pyi @@ -0,0 +1,4 @@ +from collections.abc import Hashable, Iterable + +def eval(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ... +def distance(a: Iterable[Hashable], b: Iterable[Hashable]) -> int: ... diff --git a/stubs/editdistance/editdistance/bycython.pyi b/stubs/editdistance/editdistance/bycython.pyi new file mode 100644 index 0000000..8ce7202 --- /dev/null +++ b/stubs/editdistance/editdistance/bycython.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete + +def eval(*args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + +__test__: dict[Incomplete, Incomplete] diff --git a/stubs/emoji/METADATA.toml b/stubs/emoji/METADATA.toml index 5511205..0c3e41f 100644 --- a/stubs/emoji/METADATA.toml +++ b/stubs/emoji/METADATA.toml @@ -1,2 +1,5 @@ -version = "1.2" -python2 = true +version = "2.1.*" +obsolete_since = "2.2.0" # Released on 2022-10-31 + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/emoji/emoji/__init__.pyi b/stubs/emoji/emoji/__init__.pyi index 0fe8cbc..d81dfe6 100644 --- a/stubs/emoji/emoji/__init__.pyi +++ b/stubs/emoji/emoji/__init__.pyi @@ -1,19 +1,30 @@ from .core import ( demojize as demojize, + distinct_emoji_list as distinct_emoji_list, emoji_count as emoji_count, - emoji_lis as emoji_lis, + emoji_list as emoji_list, emojize as emojize, - get_emoji_regexp as get_emoji_regexp, -) -from .unicode_codes import ( - EMOJI_ALIAS_UNICODE_ENGLISH as EMOJI_ALIAS_UNICODE_ENGLISH, - EMOJI_UNICODE_ENGLISH as EMOJI_UNICODE_ENGLISH, - EMOJI_UNICODE_ITALIAN as EMOJI_UNICODE_ITALIAN, - EMOJI_UNICODE_PORTUGUESE as EMOJI_UNICODE_PORTUGUESE, - EMOJI_UNICODE_SPANISH as EMOJI_UNICODE_SPANISH, - UNICODE_EMOJI_ALIAS_ENGLISH as UNICODE_EMOJI_ALIAS_ENGLISH, - UNICODE_EMOJI_ENGLISH as UNICODE_EMOJI_ENGLISH, - UNICODE_EMOJI_ITALIAN as UNICODE_EMOJI_ITALIAN, - UNICODE_EMOJI_PORTUGUESE as UNICODE_EMOJI_PORTUGUESE, - UNICODE_EMOJI_SPANISH as UNICODE_EMOJI_SPANISH, + is_emoji as is_emoji, + replace_emoji as replace_emoji, + version as version, ) +from .unicode_codes import EMOJI_DATA, LANGUAGES, STATUS + +__all__ = [ + "emojize", + "demojize", + "emoji_count", + "emoji_list", + "distinct_emoji_list", + "replace_emoji", + "version", + "is_emoji", + "EMOJI_DATA", + "STATUS", + "LANGUAGES", +] +__version__: str +__author__: str +__email__: str +__source__: str +__license__: str diff --git a/stubs/emoji/emoji/core.pyi b/stubs/emoji/emoji/core.pyi index 96b04d0..498586d 100644 --- a/stubs/emoji/emoji/core.pyi +++ b/stubs/emoji/emoji/core.pyi @@ -1,17 +1,31 @@ -from typing import Pattern, Text, Tuple -from typing_extensions import Literal +from collections.abc import Callable +from typing_extensions import Literal, TypedDict _DEFAULT_DELIMITER: str +class _EmojiListReturn(TypedDict): + emoji: str + match_start: int + match_end: int + def emojize( string: str, - use_aliases: bool = ..., - delimiters: Tuple[str, str] = ..., + delimiters: tuple[str, str] = ..., variant: Literal["text_type", "emoji_type", None] = ..., language: str = ..., + version: float | None = ..., + handle_version: str | Callable[[str, dict[str, str]], str] | None = ..., +) -> str: ... +def demojize( + string: str, + delimiters: tuple[str, str] = ..., + language: str = ..., + version: float | None = ..., + handle_version: str | Callable[[str, dict[str, str]], str] | None = ..., ) -> str: ... -def demojize(string: str, use_aliases: bool = ..., delimiters: Tuple[str, str] = ..., language: str = ...) -> str: ... -def get_emoji_regexp(language: str = ...) -> Pattern[Text]: ... -def emoji_lis(string: str, language: str = ...) -> list[dict[str, int | str]]: ... -def distinct_emoji_lis(string: str) -> list[str]: ... -def emoji_count(string: str) -> int: ... +def replace_emoji(string: str, replace: str | Callable[[str, dict[str, str]], str] = ..., version: float = ...) -> str: ... +def emoji_list(string: str) -> list[_EmojiListReturn]: ... +def distinct_emoji_list(string: str) -> list[str]: ... +def emoji_count(string: str, unique: bool = ...) -> int: ... +def version(string: str) -> float: ... +def is_emoji(string: str) -> bool: ... diff --git a/stubs/emoji/emoji/unicode_codes/__init__.pyi b/stubs/emoji/emoji/unicode_codes/__init__.pyi index 3dcd4dd..9e698a6 100644 --- a/stubs/emoji/emoji/unicode_codes/__init__.pyi +++ b/stubs/emoji/emoji/unicode_codes/__init__.pyi @@ -1,14 +1,6 @@ -from typing import Text +from .data_dict import * -from .en import ( - EMOJI_ALIAS_UNICODE_ENGLISH as EMOJI_ALIAS_UNICODE_ENGLISH, - EMOJI_UNICODE_ENGLISH as EMOJI_UNICODE_ENGLISH, - UNICODE_EMOJI_ALIAS_ENGLISH as UNICODE_EMOJI_ALIAS_ENGLISH, - UNICODE_EMOJI_ENGLISH as UNICODE_EMOJI_ENGLISH, -) -from .es import EMOJI_UNICODE_SPANISH as EMOJI_UNICODE_SPANISH, UNICODE_EMOJI_SPANISH as UNICODE_EMOJI_SPANISH -from .it import EMOJI_UNICODE_ITALIAN as EMOJI_UNICODE_ITALIAN, UNICODE_EMOJI_ITALIAN as UNICODE_EMOJI_ITALIAN -from .pt import EMOJI_UNICODE_PORTUGUESE as EMOJI_UNICODE_PORTUGUESE, UNICODE_EMOJI_PORTUGUESE as UNICODE_EMOJI_PORTUGUESE +__all__ = ["get_emoji_unicode_dict", "get_aliases_unicode_dict", "EMOJI_DATA", "STATUS", "LANGUAGES"] -EMOJI_UNICODE: dict[str, dict[Text, Text]] -UNICODE_EMOJI: dict[str, dict[Text, Text]] +def get_emoji_unicode_dict(lang: str) -> dict[str, str]: ... +def get_aliases_unicode_dict() -> dict[str, str]: ... diff --git a/stubs/emoji/emoji/unicode_codes/data_dict.pyi b/stubs/emoji/emoji/unicode_codes/data_dict.pyi new file mode 100644 index 0000000..ffbd89d --- /dev/null +++ b/stubs/emoji/emoji/unicode_codes/data_dict.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete + +__all__ = ["EMOJI_DATA", "STATUS", "LANGUAGES"] +STATUS: dict[str, int] +LANGUAGES: list[str] +EMOJI_DATA: dict[str, dict[str, Incomplete]] diff --git a/stubs/emoji/emoji/unicode_codes/en.pyi b/stubs/emoji/emoji/unicode_codes/en.pyi deleted file mode 100644 index c9f5842..0000000 --- a/stubs/emoji/emoji/unicode_codes/en.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import Text - -EMOJI_ALIAS_UNICODE_ENGLISH: dict[Text, Text] -EMOJI_UNICODE_ENGLISH: dict[Text, Text] -UNICODE_EMOJI_ENGLISH: dict[Text, Text] -UNICODE_EMOJI_ALIAS_ENGLISH: dict[Text, Text] diff --git a/stubs/emoji/emoji/unicode_codes/es.pyi b/stubs/emoji/emoji/unicode_codes/es.pyi deleted file mode 100644 index f16505b..0000000 --- a/stubs/emoji/emoji/unicode_codes/es.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import Text - -EMOJI_UNICODE_SPANISH: dict[Text, Text] -UNICODE_EMOJI_SPANISH: dict[Text, Text] diff --git a/stubs/emoji/emoji/unicode_codes/it.pyi b/stubs/emoji/emoji/unicode_codes/it.pyi deleted file mode 100644 index 1edefd2..0000000 --- a/stubs/emoji/emoji/unicode_codes/it.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import Text - -EMOJI_UNICODE_ITALIAN: dict[Text, Text] -UNICODE_EMOJI_ITALIAN: dict[Text, Text] diff --git a/stubs/emoji/emoji/unicode_codes/pt.pyi b/stubs/emoji/emoji/unicode_codes/pt.pyi deleted file mode 100644 index ef94454..0000000 --- a/stubs/emoji/emoji/unicode_codes/pt.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from typing import Text - -EMOJI_UNICODE_PORTUGUESE: dict[Text, Text] -UNICODE_EMOJI_PORTUGUESE: dict[Text, Text] diff --git a/stubs/entrypoints/@tests/stubtest_allowlist.txt b/stubs/entrypoints/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..7bfaa84 --- /dev/null +++ b/stubs/entrypoints/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +# staticmethod weirdness: +entrypoints.CaseSensitiveConfigParser.optionxform diff --git a/stubs/entrypoints/METADATA.toml b/stubs/entrypoints/METADATA.toml index 378b109..de6579f 100644 --- a/stubs/entrypoints/METADATA.toml +++ b/stubs/entrypoints/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.3" -python2 = true +version = "0.4.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/entrypoints/entrypoints.pyi b/stubs/entrypoints/entrypoints.pyi index 444d6cb..ce9eb78 100644 --- a/stubs/entrypoints/entrypoints.pyi +++ b/stubs/entrypoints/entrypoints.pyi @@ -1,57 +1,53 @@ import sys from _typeshed import Self -from typing import Any, Dict, Iterator, List, Sequence, Text, Tuple, Type - -if sys.version_info >= (3, 0): - from configparser import ConfigParser -else: - from ConfigParser import ConfigParser +from collections.abc import Iterator, Sequence +from configparser import ConfigParser +from typing import Any if sys.version_info >= (3, 8): from re import Pattern else: - from typing import Pattern + from re import Pattern -entry_point_pattern: Pattern[Text] -file_in_zip_pattern: Pattern[Text] +entry_point_pattern: Pattern[str] +file_in_zip_pattern: Pattern[str] class BadEntryPoint(Exception): - epstr: Text - def __init__(self, epstr: Text) -> None: ... + epstr: str + def __init__(self, epstr: str) -> None: ... @staticmethod def err_to_warnings() -> Iterator[None]: ... class NoSuchEntryPoint(Exception): - group: Text - name: Text - def __init__(self, group: Text, name: Text) -> None: ... + group: str + name: str + def __init__(self, group: str, name: str) -> None: ... + +class CaseSensitiveConfigParser(ConfigParser): ... class EntryPoint: - name: Text - module_name: Text - object_name: Text - extras: Sequence[Text] | None + name: str + module_name: str + object_name: str + extras: Sequence[str] | None distro: Distribution | None def __init__( - self, - name: Text, - module_name: Text, - object_name: Text, - extras: Sequence[Text] | None = ..., - distro: Distribution | None = ..., + self, name: str, module_name: str, object_name: str, extras: Sequence[str] | None = ..., distro: Distribution | None = ... ) -> None: ... def load(self) -> Any: ... @classmethod - def from_string(cls: Type[Self], epstr: Text, name: Text, distro: Distribution | None = ...) -> Self: ... + def from_string(cls: type[Self], epstr: str, name: str, distro: Distribution | None = ...) -> Self: ... class Distribution: - name: Text - version: Text - def __init__(self, name: Text, version: Text) -> None: ... + name: str + version: str + def __init__(self, name: str, version: str) -> None: ... + @classmethod + def from_name_version(cls: type[Self], name: str) -> Self: ... def iter_files_distros( - path: Sequence[Text] | None = ..., repeated_distro: Text = ... -) -> Iterator[Tuple[ConfigParser, Distribution | None]]: ... -def get_single(group: Text, name: Text, path: Sequence[Text] | None = ...) -> EntryPoint: ... -def get_group_named(group: Text, path: Sequence[Text] | None = ...) -> Dict[str, EntryPoint]: ... -def get_group_all(group: Text, path: Sequence[Text] | None = ...) -> List[EntryPoint]: ... + path: Sequence[str] | None = ..., repeated_distro: str = ... +) -> Iterator[tuple[ConfigParser, Distribution | None]]: ... +def get_single(group: str, name: str, path: Sequence[str] | None = ...) -> EntryPoint: ... +def get_group_named(group: str, path: Sequence[str] | None = ...) -> dict[str, EntryPoint]: ... +def get_group_all(group: str, path: Sequence[str] | None = ...) -> list[EntryPoint]: ... diff --git a/stubs/enum34/@python2/enum.pyi b/stubs/enum34/@python2/enum.pyi deleted file mode 100644 index 4bc061d..0000000 --- a/stubs/enum34/@python2/enum.pyi +++ /dev/null @@ -1,73 +0,0 @@ -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/stubs/enum34/METADATA.toml b/stubs/enum34/METADATA.toml deleted file mode 100644 index cf311fd..0000000 --- a/stubs/enum34/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "1.1" -python2 = true diff --git a/stubs/filelock/METADATA.toml b/stubs/filelock/METADATA.toml deleted file mode 100644 index ffc5a1c..0000000 --- a/stubs/filelock/METADATA.toml +++ /dev/null @@ -1 +0,0 @@ -version = "3.2" diff --git a/stubs/filelock/filelock/__init__.pyi b/stubs/filelock/filelock/__init__.pyi deleted file mode 100644 index e10860f..0000000 --- a/stubs/filelock/filelock/__init__.pyi +++ /dev/null @@ -1,51 +0,0 @@ -import sys -from types import TracebackType -from typing import Type - -class Timeout(TimeoutError): - def __init__(self, lock_file: str) -> None: ... - def __str__(self) -> str: ... - -class _Acquire_ReturnProxy: - def __init__(self, lock: str) -> None: ... - def __enter__(self) -> str: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, traceback: TracebackType | None - ) -> None: ... - -class BaseFileLock: - def __init__(self, lock_file: str, timeout: float | int | str = ...) -> None: ... - @property - def lock_file(self) -> str: ... - @property - def timeout(self) -> float: ... - @timeout.setter - def timeout(self, value: int | str | float) -> None: ... # type: ignore - @property - def is_locked(self) -> bool: ... - def acquire(self, timeout: float | None = ..., poll_intervall: float = ...) -> _Acquire_ReturnProxy: ... - def release(self, force: bool = ...) -> None: ... - def __enter__(self) -> BaseFileLock: ... - def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - -class WindowsFileLock(BaseFileLock): - def _acquire(self) -> None: ... - def _release(self) -> None: ... - -class UnixFileLock(BaseFileLock): - def _acquire(self) -> None: ... - def _release(self) -> None: ... - -class SoftFileLock(BaseFileLock): - def _acquire(self) -> None: ... - def _release(self) -> None: ... - -if sys.platform == "win32": - FileLock = WindowsFileLock -elif sys.platform == "linux" or sys.platform == "darwin": - FileLock = UnixFileLock -else: - FileLock = SoftFileLock diff --git a/stubs/first/METADATA.toml b/stubs/first/METADATA.toml index 0f01cc4..424bb5b 100644 --- a/stubs/first/METADATA.toml +++ b/stubs/first/METADATA.toml @@ -1,2 +1,4 @@ -version = "2.0" -python2 = true +version = "2.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/first/first.pyi b/stubs/first/first.pyi index 2306d52..03997de 100644 --- a/stubs/first/first.pyi +++ b/stubs/first/first.pyi @@ -1,8 +1,12 @@ -from typing import Any, Callable, Iterable, TypeVar, overload +from collections.abc import Callable, Iterable +from typing import Any, TypeVar, overload _T = TypeVar("_T") _S = TypeVar("_S") +__license__: str +__title__: str + @overload def first(iterable: Iterable[_T]) -> _T | None: ... @overload diff --git a/stubs/flake8-2020/METADATA.toml b/stubs/flake8-2020/METADATA.toml new file mode 100644 index 0000000..b32ddc5 --- /dev/null +++ b/stubs/flake8-2020/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.7.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/flake8-2020/flake8_2020.pyi b/stubs/flake8-2020/flake8_2020.pyi new file mode 100644 index 0000000..7af7c26 --- /dev/null +++ b/stubs/flake8-2020/flake8_2020.pyi @@ -0,0 +1,26 @@ +# flake8-2020 has type annotations, but PEP 561 states: +# This PEP does not support distributing typing information as part of module-only distributions or single-file modules within namespace packages. +# Therefore typeshed is the best place. + +import ast +from collections.abc import Generator +from typing import Any, ClassVar + +YTT101: str +YTT102: str +YTT103: str +YTT201: str +YTT202: str +YTT203: str +YTT204: str +YTT301: str +YTT302: str +YTT303: str + +class Visitor(ast.NodeVisitor): ... + +class Plugin: + name: ClassVar[str] + version: ClassVar[str] + def __init__(self, tree: ast.AST) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... diff --git a/stubs/flake8-bugbear/@tests/stubtest_allowlist.txt b/stubs/flake8-bugbear/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..82f0690 --- /dev/null +++ b/stubs/flake8-bugbear/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +bugbear.BugBearChecker.__getattr__ diff --git a/stubs/flake8-bugbear/METADATA.toml b/stubs/flake8-bugbear/METADATA.toml new file mode 100644 index 0000000..ac55ed8 --- /dev/null +++ b/stubs/flake8-bugbear/METADATA.toml @@ -0,0 +1 @@ +version = "22.10.27" diff --git a/stubs/flake8-bugbear/bugbear.pyi b/stubs/flake8-bugbear/bugbear.pyi new file mode 100644 index 0000000..d0b61fa --- /dev/null +++ b/stubs/flake8-bugbear/bugbear.pyi @@ -0,0 +1,29 @@ +import argparse +import ast +from _typeshed import Incomplete +from collections.abc import Sequence +from typing import Any + +class BugBearChecker: + name: str + version: str + tree: ast.AST | None + filename: str + lines: Sequence[str] | None + max_line_length: int + visitor: ast.NodeVisitor + options: argparse.Namespace | None + def run(self) -> None: ... + @staticmethod + def add_options(optmanager: Any) -> None: ... + def __init__( + self, + tree: ast.AST | None = ..., + filename: str = ..., + lines: Sequence[str] | None = ..., + max_line_length: int = ..., + options: argparse.Namespace | None = ..., + ) -> None: ... + def __getattr__(self, name: str) -> Incomplete: ... # incomplete (other attributes are normally not accessed) + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/flake8-builtins/METADATA.toml b/stubs/flake8-builtins/METADATA.toml new file mode 100644 index 0000000..58bc383 --- /dev/null +++ b/stubs/flake8-builtins/METADATA.toml @@ -0,0 +1 @@ +version = "2.0.*" diff --git a/stubs/flake8-builtins/flake8_builtins.pyi b/stubs/flake8-builtins/flake8_builtins.pyi new file mode 100644 index 0000000..c6aa608 --- /dev/null +++ b/stubs/flake8-builtins/flake8_builtins.pyi @@ -0,0 +1,12 @@ +import ast +from _typeshed import Incomplete +from collections.abc import Generator +from typing import Any, ClassVar + +class BuiltinsChecker: + name: ClassVar[str] + version: ClassVar[str] + def __init__(self, tree: ast.AST, filename: str) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... + +def __getattr__(name: str) -> Incomplete: ... # incomplete (other attributes are normally not accessed) diff --git a/stubs/flake8-docstrings/METADATA.toml b/stubs/flake8-docstrings/METADATA.toml new file mode 100644 index 0000000..6cf9fae --- /dev/null +++ b/stubs/flake8-docstrings/METADATA.toml @@ -0,0 +1 @@ +version = "1.6.*" diff --git a/stubs/flake8-docstrings/flake8_docstrings.pyi b/stubs/flake8-docstrings/flake8_docstrings.pyi new file mode 100644 index 0000000..49d96ed --- /dev/null +++ b/stubs/flake8-docstrings/flake8_docstrings.pyi @@ -0,0 +1,21 @@ +import argparse +import ast +from _typeshed import Incomplete +from collections.abc import Generator, Iterable +from typing import Any, ClassVar + +class pep257Checker: + name: ClassVar[str] + version: ClassVar[str] + tree: ast.AST + filename: str + checker: Any + source: str + def __init__(self, tree: ast.AST, filename: str, lines: Iterable[str]) -> None: ... + @classmethod + def add_options(cls, parser: Any) -> None: ... + @classmethod + def parse_options(cls, options: argparse.Namespace) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... + +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/flake8-plugin-utils/@tests/stubtest_allowlist.txt b/stubs/flake8-plugin-utils/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..c458a54 --- /dev/null +++ b/stubs/flake8-plugin-utils/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +flake8_plugin_utils +flake8_plugin_utils.plugin +flake8_plugin_utils.utils +flake8_plugin_utils.utils.assertions +flake8_plugin_utils.utils.constants +flake8_plugin_utils.utils.equiv_nodes diff --git a/stubs/flake8-plugin-utils/METADATA.toml b/stubs/flake8-plugin-utils/METADATA.toml new file mode 100644 index 0000000..3ea1839 --- /dev/null +++ b/stubs/flake8-plugin-utils/METADATA.toml @@ -0,0 +1 @@ +version = "1.3.*" diff --git a/stubs/flake8-plugin-utils/flake8_plugin_utils/__init__.pyi b/stubs/flake8-plugin-utils/flake8_plugin_utils/__init__.pyi new file mode 100644 index 0000000..0c3f4bc --- /dev/null +++ b/stubs/flake8-plugin-utils/flake8_plugin_utils/__init__.pyi @@ -0,0 +1,9 @@ +from .plugin import Error as Error, Plugin as Plugin, Visitor as Visitor +from .utils import ( + assert_error as assert_error, + assert_not_error as assert_not_error, + check_equivalent_nodes as check_equivalent_nodes, + is_false as is_false, + is_none as is_none, + is_true as is_true, +) diff --git a/stubs/flake8-plugin-utils/flake8_plugin_utils/plugin.pyi b/stubs/flake8-plugin-utils/flake8_plugin_utils/plugin.pyi new file mode 100644 index 0000000..6949ec2 --- /dev/null +++ b/stubs/flake8-plugin-utils/flake8_plugin_utils/plugin.pyi @@ -0,0 +1,41 @@ +import argparse +import ast +from collections.abc import Iterable, Iterator +from typing import Any, Generic, TypeVar, overload +from typing_extensions import TypeAlias + +FLAKE8_ERROR: TypeAlias = tuple[int, int, str, type[Any]] +TConfig = TypeVar("TConfig") # noqa: Y001 # Name of the TypeVar matches the name at runtime + +class Error: + code: str + message: str + lineno: int + col_offset: int + def __init__(self, lineno: int, col_offset: int, **kwargs: Any) -> None: ... + @classmethod + def formatted_message(cls, **kwargs: Any) -> str: ... + +class Visitor(ast.NodeVisitor, Generic[TConfig]): + errors: list[Error] + @overload + def __init__(self, config: None = ...) -> None: ... + @overload + def __init__(self, config: TConfig) -> None: ... + @property + def config(self) -> TConfig: ... + def error_from_node(self, error: type[Error], node: ast.AST, **kwargs: Any) -> None: ... + +class Plugin(Generic[TConfig]): + name: str + version: str + visitors: list[type[Visitor[TConfig]]] + config: TConfig + def __init__(self, tree: ast.AST) -> None: ... + def run(self) -> Iterable[FLAKE8_ERROR]: ... + @classmethod + def parse_options(cls, option_manager: Any, options: argparse.Namespace, args: list[str]) -> None: ... + @classmethod + def parse_options_to_config(cls, option_manager: Any, options: argparse.Namespace, args: list[str]) -> TConfig | None: ... + @classmethod + def test_config(cls, config: TConfig) -> Iterator[None]: ... diff --git a/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/__init__.pyi b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/__init__.pyi new file mode 100644 index 0000000..095dbe4 --- /dev/null +++ b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/__init__.pyi @@ -0,0 +1,3 @@ +from .assertions import assert_error as assert_error, assert_not_error as assert_not_error +from .constants import is_false as is_false, is_none as is_none, is_true as is_true +from .equiv_nodes import check_equivalent_nodes as check_equivalent_nodes diff --git a/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/assertions.pyi b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/assertions.pyi new file mode 100644 index 0000000..d030a52 --- /dev/null +++ b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/assertions.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from ..plugin import Error as Error, TConfig as TConfig, Visitor as Visitor + +def assert_error( + visitor_cls: type[Visitor[TConfig]], src: str, expected: type[Error], config: TConfig | None = ..., **kwargs: Any +) -> None: ... +def assert_not_error(visitor_cls: type[Visitor[TConfig]], src: str, config: TConfig | None = ...) -> None: ... diff --git a/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/constants.pyi b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/constants.pyi new file mode 100644 index 0000000..8503693 --- /dev/null +++ b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/constants.pyi @@ -0,0 +1,5 @@ +import ast + +def is_none(node: ast.AST) -> bool: ... +def is_false(node: ast.AST) -> bool: ... +def is_true(node: ast.AST) -> bool: ... diff --git a/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/equiv_nodes.pyi b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/equiv_nodes.pyi new file mode 100644 index 0000000..641945b --- /dev/null +++ b/stubs/flake8-plugin-utils/flake8_plugin_utils/utils/equiv_nodes.pyi @@ -0,0 +1,3 @@ +import ast + +def check_equivalent_nodes(node1: ast.AST, node2: ast.AST) -> bool: ... diff --git a/stubs/flake8-rst-docstrings/METADATA.toml b/stubs/flake8-rst-docstrings/METADATA.toml new file mode 100644 index 0000000..a42da25 --- /dev/null +++ b/stubs/flake8-rst-docstrings/METADATA.toml @@ -0,0 +1 @@ +version = "0.2.*" diff --git a/stubs/flake8-rst-docstrings/flake8_rst_docstrings.pyi b/stubs/flake8-rst-docstrings/flake8_rst_docstrings.pyi new file mode 100644 index 0000000..1ccdb3d --- /dev/null +++ b/stubs/flake8-rst-docstrings/flake8_rst_docstrings.pyi @@ -0,0 +1,34 @@ +import ast +from argparse import Namespace +from collections.abc import Container, Generator +from typing import Any + +rst_prefix: str +rst_fail_load: int +rst_fail_lint: int +code_mapping_info: dict[str, int] +code_mapping_warning: dict[str, int] +code_mapping_error: dict[str, int] +code_mapping_severe: dict[str, int] +code_mappings_by_level: dict[int, dict[str, int]] + +def code_mapping( + level: int, + msg: str, + extra_directives: Container[str], + extra_roles: Container[str], + extra_substitutions: Container[str], + default: int = ..., +) -> int: ... + +class reStructuredTextChecker: + name: str + version: str + tree: ast.AST + filename: str + def __init__(self, tree: ast.AST, filename: str = ...) -> None: ... + @classmethod + def add_options(cls, parser: Any) -> None: ... + @classmethod + def parse_options(cls, options: Namespace) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[reStructuredTextChecker]], None, None]: ... diff --git a/stubs/flake8-simplify/METADATA.toml b/stubs/flake8-simplify/METADATA.toml new file mode 100644 index 0000000..d2a449c --- /dev/null +++ b/stubs/flake8-simplify/METADATA.toml @@ -0,0 +1 @@ +version = "0.19.*" diff --git a/stubs/flake8-simplify/flake8_simplify/__init__.pyi b/stubs/flake8-simplify/flake8_simplify/__init__.pyi new file mode 100644 index 0000000..c1831fa --- /dev/null +++ b/stubs/flake8-simplify/flake8_simplify/__init__.pyi @@ -0,0 +1,9 @@ +import ast +from collections.abc import Generator +from typing import Any, ClassVar + +class Plugin: + name: ClassVar[str] + version: ClassVar[str] + def __init__(self, tree: ast.AST) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... diff --git a/stubs/flake8-typing-imports/METADATA.toml b/stubs/flake8-typing-imports/METADATA.toml new file mode 100644 index 0000000..ae0d807 --- /dev/null +++ b/stubs/flake8-typing-imports/METADATA.toml @@ -0,0 +1 @@ +version = "1.14.*" diff --git a/stubs/flake8-typing-imports/flake8_typing_imports.pyi b/stubs/flake8-typing-imports/flake8_typing_imports.pyi new file mode 100644 index 0000000..9321254 --- /dev/null +++ b/stubs/flake8-typing-imports/flake8_typing_imports.pyi @@ -0,0 +1,17 @@ +import argparse +import ast +from _typeshed import Incomplete +from collections.abc import Generator +from typing import Any, ClassVar + +class Plugin: + name: ClassVar[str] + version: ClassVar[str] + @staticmethod + def add_options(option_manager: Any) -> None: ... + @classmethod + def parse_options(cls, options: argparse.Namespace) -> None: ... + def __init__(self, tree: ast.AST) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... + +def __getattr__(name: str) -> Incomplete: ... # incomplete (other attributes are normally not accessed) diff --git a/stubs/fpdf2/@tests/stubtest_allowlist.txt b/stubs/fpdf2/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..93cb313 --- /dev/null +++ b/stubs/fpdf2/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +# The "dest" argument is unused and will be removed. +fpdf.FPDF.output +fpdf.fpdf.FPDF.output + +# Unnecessary re-export from codecs +fpdf.syntax.BOM_UTF16_BE \ No newline at end of file diff --git a/stubs/fpdf2/METADATA.toml b/stubs/fpdf2/METADATA.toml new file mode 100644 index 0000000..87fbf5c --- /dev/null +++ b/stubs/fpdf2/METADATA.toml @@ -0,0 +1,5 @@ +version = "2.5.*" +requires = ["types-Pillow"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/fpdf2/fpdf/__init__.pyi b/stubs/fpdf2/fpdf/__init__.pyi new file mode 100644 index 0000000..28e11ff --- /dev/null +++ b/stubs/fpdf2/fpdf/__init__.pyi @@ -0,0 +1,28 @@ +from pathlib import Path + +from .enums import XPos as XPos, YPos as YPos +from .fpdf import FPDF as FPDF, TitleStyle as TitleStyle +from .html import HTML2FPDF as HTML2FPDF, HTMLMixin as HTMLMixin +from .prefs import ViewerPreferences as ViewerPreferences +from .template import FlexTemplate as FlexTemplate, Template as Template + +__license__: str +__version__: str +FPDF_VERSION: str +FPDF_FONT_DIR: Path + +__all__ = [ + "__version__", + "__license__", + "FPDF", + "XPos", + "YPos", + "Template", + "FlexTemplate", + "TitleStyle", + "ViewerPreferences", + "HTMLMixin", + "HTML2FPDF", + "FPDF_VERSION", + "FPDF_FONT_DIR", +] diff --git a/stubs/fpdf2/fpdf/actions.pyi b/stubs/fpdf2/fpdf/actions.pyi new file mode 100644 index 0000000..4ade277 --- /dev/null +++ b/stubs/fpdf2/fpdf/actions.pyi @@ -0,0 +1,30 @@ +from _typeshed import Incomplete +from abc import ABC + +from .syntax import PDFObject + +class Action(ABC): + next: PDFObject | str | None + def __init__(self, next_action: PDFObject | str | None = ...) -> None: ... + def dict_as_string(self, key_values: dict[str, Incomplete] | None = ...) -> str: ... + +class NamedAction(Action): + action_name: Incomplete + def __init__(self, action_name, next_action: PDFObject | str | None = ...) -> None: ... + def dict_as_string(self) -> str: ... # type: ignore[override] + +class GoToAction(Action): + dest: Incomplete + def __init__(self, dest, next_action: PDFObject | str | None = ...) -> None: ... + def dict_as_string(self) -> str: ... # type: ignore[override] + +class GoToRemoteAction(Action): + file: Incomplete + dest: Incomplete + def __init__(self, file, dest, next_action: PDFObject | str | None = ...) -> None: ... + def dict_as_string(self) -> str: ... # type: ignore[override] + +class LaunchAction(Action): + file: Incomplete + def __init__(self, file, next_action: PDFObject | str | None = ...) -> None: ... + def dict_as_string(self) -> str: ... # type: ignore[override] diff --git a/stubs/fpdf2/fpdf/deprecation.pyi b/stubs/fpdf2/fpdf/deprecation.pyi new file mode 100644 index 0000000..044aa1c --- /dev/null +++ b/stubs/fpdf2/fpdf/deprecation.pyi @@ -0,0 +1,5 @@ +from types import ModuleType + +class WarnOnDeprecatedModuleAttributes(ModuleType): + def __getattr__(self, name): ... + def __setattr__(self, name, value) -> None: ... diff --git a/stubs/fpdf2/fpdf/drawing.pyi b/stubs/fpdf2/fpdf/drawing.pyi new file mode 100644 index 0000000..a29ae22 --- /dev/null +++ b/stubs/fpdf2/fpdf/drawing.pyi @@ -0,0 +1,398 @@ +import decimal +from _typeshed import Incomplete, Self +from collections import OrderedDict +from collections.abc import Callable, Generator, Iterator +from contextlib import contextmanager +from re import Pattern +from typing import Any, ClassVar, NamedTuple, TypeVar +from typing_extensions import TypeAlias + +from .syntax import Name, Raw + +__pdoc__: dict[str, bool] + +_CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) + +def force_nodocument(item: _CallableT) -> _CallableT: ... +def force_document(item: _CallableT) -> _CallableT: ... + +Number: TypeAlias = int | float | decimal.Decimal +NumberClass: tuple[type, ...] +WHITESPACE: frozenset[str] +EOL_CHARS: frozenset[str] +DELIMITERS: frozenset[str] +STR_ESC: Pattern[str] +STR_ESC_MAP: dict[str, str] + +class GraphicsStateDictRegistry(OrderedDict[Raw, Name]): + def register_style(self, style: GraphicsStyle) -> Name | None: ... + +def number_to_str(number) -> str: ... +def render_pdf_primitive(primitive) -> Raw: ... + +class DeviceRGB: + OPERATOR: str + def __new__(cls, r, g, b, a: Incomplete | None = ...): ... + @property + def colors(self): ... + def pdf_repr(self) -> str: ... + +class DeviceGray: + OPERATOR: str + def __new__(cls, g, a: Incomplete | None = ...): ... + @property + def colors(self): ... + def pdf_repr(self) -> str: ... + +class DeviceCMYK: + OPERATOR: str + def __new__(cls, c, m, y, k, a: Incomplete | None = ...): ... + @property + def colors(self): ... + def pdf_repr(self) -> str: ... + +def rgb8(r, g, b, a: Incomplete | None = ...) -> DeviceRGB: ... +def gray8(g, a: Incomplete | None = ...) -> DeviceGray: ... +def cmyk8(c, m, y, k, a: Incomplete | None = ...) -> DeviceCMYK: ... +def color_from_hex_string(hexstr) -> DeviceRGB: ... +def color_from_rgb_string(rgbstr) -> DeviceRGB: ... + +class Point(NamedTuple): + x: Number + y: Number + def render(self): ... + def dot(self, other): ... + def angle(self, other): ... + def mag(self): ... + def __add__(self, other): ... + def __sub__(self, other): ... + def __neg__(self): ... + def __mul__(self, other): ... + def __rmul__(self, other): ... + def __truediv__(self, other): ... + def __floordiv__(self, other): ... + def __matmul__(self, other): ... + +class Transform(NamedTuple): + a: Number + b: Number + c: Number + d: Number + e: Number + f: Number + @classmethod + def identity(cls): ... + @classmethod + def translation(cls, x, y): ... + @classmethod + def scaling(cls, x, y: Incomplete | None = ...): ... + @classmethod + def rotation(cls, theta): ... + @classmethod + def rotation_d(cls, theta_d): ... + @classmethod + def shearing(cls, x, y: Incomplete | None = ...): ... + def translate(self, x, y): ... + def scale(self, x, y: Incomplete | None = ...): ... + def rotate(self, theta): ... + def rotate_d(self, theta_d): ... + def shear(self, x, y: Incomplete | None = ...): ... + def about(self, x, y): ... + def __mul__(self, other): ... + def __rmul__(self, other): ... + def __matmul__(self, other): ... + def render(self, last_item): ... + +class GraphicsStyle: + INHERIT: ClassVar[Incomplete] + MERGE_PROPERTIES: ClassVar[tuple[str, ...]] + TRANSPARENCY_KEYS: ClassVar[tuple[Name, ...]] + PDF_STYLE_KEYS: ClassVar[tuple[Name, ...]] + @classmethod + def merge(cls, parent, child): ... + def __init__(self) -> None: ... + def __deepcopy__(self: Self, memo) -> Self: ... + @property + def allow_transparency(self): ... + @allow_transparency.setter + def allow_transparency(self, new): ... + @property + def paint_rule(self): ... + @paint_rule.setter + def paint_rule(self, new) -> None: ... + @property + def auto_close(self): ... + @auto_close.setter + def auto_close(self, new) -> None: ... + @property + def intersection_rule(self): ... + @intersection_rule.setter + def intersection_rule(self, new) -> None: ... + @property + def fill_color(self): ... + @fill_color.setter + def fill_color(self, color) -> None: ... + @property + def fill_opacity(self): ... + @fill_opacity.setter + def fill_opacity(self, new) -> None: ... + @property + def stroke_color(self): ... + @stroke_color.setter + def stroke_color(self, color) -> None: ... + @property + def stroke_opacity(self): ... + @stroke_opacity.setter + def stroke_opacity(self, new) -> None: ... + @property + def blend_mode(self): ... + @blend_mode.setter + def blend_mode(self, value) -> None: ... + @property + def stroke_width(self): ... + @stroke_width.setter + def stroke_width(self, width) -> None: ... + @property + def stroke_cap_style(self): ... + @stroke_cap_style.setter + def stroke_cap_style(self, value) -> None: ... + @property + def stroke_join_style(self): ... + @stroke_join_style.setter + def stroke_join_style(self, value) -> None: ... + @property + def stroke_miter_limit(self): ... + @stroke_miter_limit.setter + def stroke_miter_limit(self, value) -> None: ... + @property + def stroke_dash_pattern(self): ... + @stroke_dash_pattern.setter + def stroke_dash_pattern(self, value) -> None: ... + @property + def stroke_dash_phase(self): ... + @stroke_dash_phase.setter + def stroke_dash_phase(self, value): ... + def to_pdf_dict(self): ... + def resolve_paint_rule(self): ... + +class Move(NamedTuple): + pt: Point + @property + def end_point(self): ... + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeMove(NamedTuple): + pt: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class Line(NamedTuple): + pt: Point + @property + def end_point(self): ... + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeLine(NamedTuple): + pt: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class HorizontalLine(NamedTuple): + x: Number + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeHorizontalLine(NamedTuple): + x: Number + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class VerticalLine(NamedTuple): + y: Number + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeVerticalLine(NamedTuple): + y: Number + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class BezierCurve(NamedTuple): + c1: Point + c2: Point + end: Point + @property + def end_point(self): ... + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeBezierCurve(NamedTuple): + c1: Point + c2: Point + end: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class QuadraticBezierCurve(NamedTuple): + ctrl: Point + end: Point + @property + def end_point(self): ... + def to_cubic_curve(self, start_point): ... + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeQuadraticBezierCurve(NamedTuple): + ctrl: Point + end: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class Arc(NamedTuple): + radii: Point + rotation: Number + large: bool + sweep: bool + end: Point + @staticmethod + def subdivde_sweep(sweep_angle) -> Generator[Incomplete, None, None]: ... + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RelativeArc(NamedTuple): + radii: Point + rotation: Number + large: bool + sweep: bool + end: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class Rectangle(NamedTuple): + org: Point + size: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class RoundedRectangle(NamedTuple): + org: Point + size: Point + corner_radii: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class Ellipse(NamedTuple): + radii: Point + center: Point + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class ImplicitClose(NamedTuple): + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class Close(NamedTuple): + def render(self, gsd_registry, style, last_item, initial_point): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class DrawingContext: + def __init__(self) -> None: ... + def add_item(self, item, _copy: bool = ...) -> None: ... + def render(self, gsd_registry, first_point, scale, height, starting_style): ... + def render_debug(self, gsd_registry, first_point, scale, height, starting_style, debug_stream): ... + +class PaintedPath: + def __init__(self, x: int = ..., y: int = ...) -> None: ... + def __deepcopy__(self: Self, memo) -> Self: ... + @property + def style(self): ... + @property + def transform(self): ... + @transform.setter + def transform(self, tf) -> None: ... + @property + def auto_close(self): ... + @auto_close.setter + def auto_close(self, should) -> None: ... + @property + def paint_rule(self): ... + @paint_rule.setter + def paint_rule(self, style) -> None: ... + @property + def clipping_path(self): ... + @clipping_path.setter + def clipping_path(self, new_clipath) -> None: ... + @contextmanager + def transform_group(self: Self, transform) -> Iterator[Self]: ... + def add_path_element(self, item, _copy: bool = ...) -> None: ... + def rectangle(self: Self, x, y, w, h, rx: int = ..., ry: int = ...) -> Self: ... + def circle(self: Self, cx, cy, r) -> Self: ... + def ellipse(self: Self, cx, cy, rx, ry) -> Self: ... + def move_to(self: Self, x, y) -> Self: ... + def move_relative(self: Self, x, y) -> Self: ... + def line_to(self: Self, x, y) -> Self: ... + def line_relative(self: Self, dx, dy) -> Self: ... + def horizontal_line_to(self: Self, x) -> Self: ... + def horizontal_line_relative(self: Self, dx) -> Self: ... + def vertical_line_to(self: Self, y) -> Self: ... + def vertical_line_relative(self: Self, dy) -> Self: ... + def curve_to(self: Self, x1, y1, x2, y2, x3, y3) -> Self: ... + def curve_relative(self: Self, dx1, dy1, dx2, dy2, dx3, dy3) -> Self: ... + def quadratic_curve_to(self: Self, x1, y1, x2, y2) -> Self: ... + def quadratic_curve_relative(self: Self, dx1, dy1, dx2, dy2) -> Self: ... + def arc_to(self: Self, rx, ry, rotation, large_arc, positive_sweep, x, y) -> Self: ... + def arc_relative(self: Self, rx, ry, rotation, large_arc, positive_sweep, dx, dy) -> Self: ... + def close(self) -> None: ... + def render( + self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = ..., pfx: Incomplete | None = ... + ): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class ClippingPath(PaintedPath): + paint_rule: Incomplete + def __init__(self, x: int = ..., y: int = ...) -> None: ... + def render( + self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = ..., pfx: Incomplete | None = ... + ): ... + def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... + +class GraphicsContext: + style: GraphicsStyle + path_items: list[Incomplete] + def __init__(self) -> None: ... + def __deepcopy__(self: Self, memo) -> Self: ... + @property + def transform(self) -> Transform | None: ... + @transform.setter + def transform(self, tf) -> None: ... + @property + def clipping_path(self) -> ClippingPath | None: ... + @clipping_path.setter + def clipping_path(self, new_clipath) -> None: ... + def add_item(self, item, _copy: bool = ...) -> None: ... + def merge(self, other_context) -> None: ... + def build_render_list( + self, + gsd_registry, + style, + last_item, + initial_point, + debug_stream: Incomplete | None = ..., + pfx: Incomplete | None = ..., + _push_stack: bool = ..., + ): ... + def render( + self, + gsd_registry, + style: DrawingContext, + last_item, + initial_point, + debug_stream: Incomplete | None = ..., + pfx: Incomplete | None = ..., + _push_stack: bool = ..., + ): ... + def render_debug( + self, gsd_registry, style: DrawingContext, last_item, initial_point, debug_stream, pfx, _push_stack: bool = ... + ): ... diff --git a/stubs/fpdf2/fpdf/enums.pyi b/stubs/fpdf2/fpdf/enums.pyi new file mode 100644 index 0000000..af7729b --- /dev/null +++ b/stubs/fpdf2/fpdf/enums.pyi @@ -0,0 +1,191 @@ +from _typeshed import Incomplete, Self +from enum import Enum, Flag, IntEnum + +from .syntax import Name + +class DocumentState(IntEnum): + UNINITIALIZED: int + READY: int + GENERATING_PAGE: int + CLOSED: int + +class SignatureFlag(IntEnum): + SIGNATURES_EXIST: int + APPEND_ONLY: int + +class CoerciveEnum(Enum): + @classmethod + def coerce(cls: type[Self], value: Self | str) -> Self: ... + +class CoerciveIntEnum(IntEnum): + @classmethod + def coerce(cls: type[Self], value: Self | str | int) -> Self: ... + +class CharVPos(CoerciveEnum): + SUP: str + SUB: str + NOM: str + DENOM: str + LINE: str + +class Align(CoerciveEnum): + C: str + X: str + L: str + R: str + J: str + +class RenderStyle(CoerciveEnum): + D: str + F: str + DF: str + @property + def operator(self) -> str: ... + @property + def is_draw(self) -> bool: ... + @property + def is_fill(self) -> bool: ... + +class TextMode(CoerciveIntEnum): + FILL: int + STROKE: int + FILL_STROKE: int + INVISIBLE: int + FILL_CLIP: int + STROKE_CLIP: int + FILL_STROKE_CLIP: int + CLIP: int + +class XPos(CoerciveEnum): + LEFT: str + RIGHT: str + START: str + END: str + WCONT: str + CENTER: str + LMARGIN: str + RMARGIN: str + +class YPos(CoerciveEnum): + TOP: str + LAST: str + NEXT: str + TMARGIN: str + BMARGIN: str + +class PageLayout(CoerciveEnum): + SINGLE_PAGE: Name + ONE_COLUMN: Name + TWO_COLUMN_LEFT: Name + TWO_COLUMN_RIGHT: Name + TWO_PAGE_LEFT: Name + TWO_PAGE_RIGHT: Name + +class PageMode(CoerciveEnum): + USE_NONE: Name + USE_OUTLINES: Name + USE_THUMBS: Name + FULL_SCREEN: Name + USE_OC: Name + USE_ATTACHMENTS: Name + +class TextMarkupType(CoerciveEnum): + HIGHLIGHT: Name + UNDERLINE: Name + SQUIGGLY: Name + STRIKE_OUT: Name + +class BlendMode(CoerciveEnum): + NORMAL: Name + MULTIPLY: Name + SCREEN: Name + OVERLAY: Name + DARKEN: Name + LIGHTEN: Name + COLOR_DODGE: Name + COLOR_BURN: Name + HARD_LIGHT: Name + SOFT_LIGHT: Name + DIFFERENCE: Name + EXCLUSION: Name + HUE: Name + SATURATION: Name + COLOR: Name + LUMINOSITY: Name + +class AnnotationFlag(CoerciveIntEnum): + INVISIBLE: int + HIDDEN: int + PRINT: int + NO_ZOOM: int + NO_ROTATE: int + NO_VIEW: int + READ_ONLY: int + LOCKED: int + TOGGLE_NO_VIEW: int + LOCKED_CONTENTS: int + +class AnnotationName(CoerciveEnum): + NOTE: Name + COMMENT: Name + HELP: Name + PARAGRAPH: Name + NEW_PARAGRAPH: Name + INSERT: Name + +class FileAttachmentAnnotationName(CoerciveEnum): + PUSH_PIN: Name + GRAPH_PUSH_PIN: Name + PAPERCLIP_TAG: Name + +class IntersectionRule(CoerciveEnum): + NONZERO: str + EVENODD: str + +class PathPaintRule(CoerciveEnum): + STROKE: str + FILL_NONZERO: str + FILL_EVENODD: str + STROKE_FILL_NONZERO: str + STROKE_FILL_EVENODD: str + DONT_PAINT: str + AUTO: str + +class ClippingPathIntersectionRule(CoerciveEnum): + NONZERO: str + EVENODD: str + +class StrokeCapStyle(CoerciveIntEnum): + BUTT: int + ROUND: int + SQUARE: int + +class StrokeJoinStyle(CoerciveIntEnum): + MITER: int + ROUND: int + BEVEL: int + +class PDFStyleKeys(Enum): + FILL_ALPHA: Name + BLEND_MODE: Name + STROKE_ALPHA: Name + STROKE_ADJUSTMENT: Name + STROKE_WIDTH: Name + STROKE_CAP_STYLE: Name + STROKE_JOIN_STYLE: Name + STROKE_MITER_LIMIT: Name + STROKE_DASH_PATTERN: Name + +class Corner(CoerciveEnum): + TOP_RIGHT: str + TOP_LEFT: str + BOTTOM_RIGHT: str + BOTTOM_LEFT: str + +class FontDescriptorFlags(Flag): + FIXED_PITCH: int + SYMBOLIC: int + ITALIC: int + FORCE_BOLD: int + +__pdoc__: Incomplete diff --git a/stubs/fpdf2/fpdf/errors.pyi b/stubs/fpdf2/fpdf/errors.pyi new file mode 100644 index 0000000..c417166 --- /dev/null +++ b/stubs/fpdf2/fpdf/errors.pyi @@ -0,0 +1,12 @@ +from typing import Any + +class FPDFException(Exception): ... + +class FPDFPageFormatException(FPDFException): + argument: Any + unknown: Any + one: Any + def __init__(self, argument, unknown: bool = ..., one: bool = ...) -> None: ... + +class FPDFUnicodeEncodingException(FPDFException): + def __init__(self, text_index, character, font_name) -> None: ... diff --git a/stubs/fpdf2/fpdf/fonts.pyi b/stubs/fpdf2/fpdf/fonts.pyi new file mode 100644 index 0000000..5a894ff --- /dev/null +++ b/stubs/fpdf2/fpdf/fonts.pyi @@ -0,0 +1,4 @@ +from typing import Any + +courier: Any +fpdf_charwidths: Any diff --git a/stubs/fpdf2/fpdf/fpdf.pyi b/stubs/fpdf2/fpdf/fpdf.pyi new file mode 100644 index 0000000..a06186b --- /dev/null +++ b/stubs/fpdf2/fpdf/fpdf.pyi @@ -0,0 +1,513 @@ +import datetime +from _typeshed import Incomplete, StrPath +from collections import defaultdict +from collections.abc import Callable, Iterable, Sequence +from contextlib import _GeneratorContextManager +from enum import IntEnum +from io import BytesIO +from typing import Any, ClassVar, NamedTuple, overload +from typing_extensions import Literal, TypeAlias + +from PIL import Image + +from .actions import Action +from .drawing import DrawingContext, PaintedPath +from .enums import ( + Align, + AnnotationFlag, + AnnotationName, + Corner, + FileAttachmentAnnotationName, + PageLayout, + PathPaintRule, + RenderStyle, + TextMarkupType, + TextMode as TextMode, + XPos as XPos, + YPos as YPos, +) +from .recorder import FPDFRecorder +from .syntax import DestinationXYZ +from .util import _Unit + +__all__ = ["FPDF", "XPos", "YPos", "get_page_format", "TextMode", "TitleStyle", "PAGE_FORMATS"] + +_Orientation: TypeAlias = Literal["", "portrait", "p", "P", "landscape", "l", "L"] +_Format: TypeAlias = Literal["", "a3", "A3", "a4", "A4", "a5", "A5", "letter", "Letter", "legal", "Legal"] +_FontStyle: TypeAlias = Literal["", "B", "I"] +_FontStyles: TypeAlias = Literal["", "B", "I", "U", "BU", "UB", "BI", "IB", "IU", "UI", "BIU", "BUI", "IBU", "IUB", "UBI", "UIB"] +PAGE_FORMATS: dict[_Format, tuple[float, float]] + +class DocumentState(IntEnum): + UNINITIALIZED: int + READY: int + GENERATING_PAGE: int + CLOSED: int + +class Annotation(NamedTuple): + type: str + x: int + y: int + width: int + height: int + flags: tuple[AnnotationFlag, ...] = ... + contents: str | None = ... + link: str | int | None = ... + alt_text: str | None = ... + action: Action | None = ... + color: int | None = ... + modification_time: datetime.datetime | None = ... + title: str | None = ... + quad_points: Sequence[int] | None = ... + page: int | None = ... + border_width: int = ... + name: AnnotationName | None = ... + ink_list: tuple[int, ...] = ... + embedded_file_name: str | None = ... + field_type: str | None = ... + value: str | None = ... + def serialize(self, fpdf) -> str: ... + +class EmbeddedFile(NamedTuple): + basename: str + bytes: bytes + desc: str = ... + creation_date: datetime.datetime | None = ... + modification_date: datetime.datetime | None = ... + compress: bool = ... + checksum: bool = ... + def file_spec(self, embedded_file_ref) -> str: ... + +class TitleStyle(NamedTuple): + font_family: str | None = ... + font_style: str | None = ... + font_size_pt: int | None = ... + color: int | tuple[int, int, int] | None = ... + underline: bool = ... + t_margin: int | None = ... + l_margin: int | None = ... + b_margin: int | None = ... + +class ToCPlaceholder(NamedTuple): + render_function: Callable[[FPDF, Any], object] + start_page: int + y: int + pages: int = ... + +class SubsetMap: + def __init__(self, identities: list[int]) -> None: ... + def pick(self, unicode: int) -> int: ... + def dict(self) -> dict[int, int]: ... + +def get_page_format(format: _Format | tuple[float, float], k: float | None = ...) -> tuple[float, float]: ... + +# TODO: TypedDicts +_Page: TypeAlias = dict[str, Any] +_Font: TypeAlias = dict[str, Any] +_FontFile: TypeAlias = dict[str, Any] +_Image: TypeAlias = dict[str, Any] + +class FPDF: + MARKDOWN_BOLD_MARKER: ClassVar[str] + MARKDOWN_ITALICS_MARKER: ClassVar[str] + MARKDOWN_UNDERLINE_MARKER: ClassVar[str] + offsets: dict[int, int] + page: int + n: int + buffer: bytearray + pages: dict[int, _Page] + state: DocumentState + fonts: dict[str, _Font] + font_files: dict[str, _FontFile] + diffs: dict[int, int] + images: dict[str, _Image] + annots: defaultdict[int, list[Annotation]] + links: dict[int, DestinationXYZ] + embedded_files: list[Incomplete] + embedded_files_per_pdf_ref: dict[Incomplete, Incomplete] + in_footer: int + lasth: int + current_font: _Font + font_family: str + font_style: str + font_stretching: float + char_spacing: float + underline: bool + str_alias_nb_pages: str + draw_color: str + fill_color: str + text_color: str + page_background: Incomplete | None + angle: int + xmp_metadata: str | None + image_filter: str + page_duration: int + page_transition: Incomplete | None + struct_builder: Incomplete + section_title_styles: Incomplete + core_fonts: Incomplete + core_fonts_encoding: str + font_aliases: Incomplete + k: float + def_orientation: Incomplete + font_size: float + c_margin: float + line_width: float + dw_pt: float + dh_pt: float + pdf_version: str + + x: float + y: float + + # Set during call to _set_orientation(), called from __init__(). + cur_orientation: Literal["P", "L"] + w_pt: float + h_pt: float + w: float + h: float + def __init__( + self, + orientation: _Orientation = ..., + unit: _Unit | float = ..., + format: _Format | tuple[float, float] = ..., + font_cache_dir: Literal["DEPRECATED"] = ..., + ) -> None: ... + @property + def font_size_pt(self) -> float: ... + @property + def is_ttf_font(self) -> bool: ... + @property + def page_mode(self): ... + @property + def epw(self) -> float: ... + @property + def eph(self) -> float: ... + @property + def pages_count(self) -> int: ... + def set_margin(self, margin: float) -> None: ... + def set_margins(self, left: float, top: float, right: float = ...) -> None: ... + l_margin: float + def set_left_margin(self, margin: float) -> None: ... + t_margin: float + def set_top_margin(self, margin: float) -> None: ... + r_margin: float + def set_right_margin(self, margin: float) -> None: ... + auto_page_break: bool + b_margin: float + page_break_trigger: float + def set_auto_page_break(self, auto: bool, margin: float = ...) -> None: ... + zoom_mode: Literal["fullpage", "fullwidth", "real", "default"] | float + page_layout: PageLayout | None + def set_display_mode( + self, + zoom: Literal["fullpage", "fullwidth", "real", "default"] | float, + layout: Literal["single", "continuous", "two", "default"] = ..., + ) -> None: ... + compress: bool + def set_compression(self, compress: bool) -> None: ... + title: str + def set_title(self, title: str) -> None: ... + lang: str + def set_lang(self, lang: str) -> None: ... + subject: str + def set_subject(self, subject: str) -> None: ... + author: str + def set_author(self, author: str) -> None: ... + keywords: str + def set_keywords(self, keywords: str) -> None: ... + creator: str + def set_creator(self, creator: str) -> None: ... + producer: str + def set_producer(self, producer: str) -> None: ... + creation_date: datetime.datetime | bool | None + def set_creation_date(self, date: datetime.datetime | bool | None = ...) -> None: ... + def set_xmp_metadata(self, xmp_metadata: str) -> None: ... + def set_doc_option(self, opt: str, value: str) -> None: ... + def set_image_filter(self, image_filter: str) -> None: ... + def alias_nb_pages(self, alias: str = ...) -> None: ... + def open(self) -> None: ... + def close(self) -> None: ... + def add_page( + self, + orientation: _Orientation = ..., + format: _Format | tuple[float, float] = ..., + same: bool = ..., + duration: int = ..., + transition: Incomplete | None = ..., + ) -> None: ... + def header(self) -> None: ... + def footer(self) -> None: ... + def page_no(self) -> int: ... + def set_draw_color(self, r: int, g: int = ..., b: int = ...) -> None: ... + def set_fill_color(self, r: int, g: int = ..., b: int = ...) -> None: ... + def set_text_color(self, r: int, g: int = ..., b: int = ...) -> None: ... + def get_string_width(self, s: str, normalized: bool = ..., markdown: bool = ...) -> float: ... + def set_line_width(self, width: float) -> None: ... + def set_page_background(self, background) -> None: ... + def drawing_context(self, debug_stream: Incomplete | None = ...) -> _GeneratorContextManager[DrawingContext]: ... + def new_path( + self, x: float = ..., y: float = ..., paint_rule: PathPaintRule = ..., debug_stream: Incomplete | None = ... + ) -> _GeneratorContextManager[PaintedPath]: ... + def draw_path(self, path: PaintedPath, debug_stream: Incomplete | None = ...) -> None: ... + def set_dash_pattern(self, dash: float = ..., gap: float = ..., phase: float = ...) -> None: ... + def line(self, x1: float, y1: float, x2: float, y2: float) -> None: ... + def polyline( + self, point_list: list[tuple[float, float]], fill: bool = ..., polygon: bool = ..., style: RenderStyle | str | None = ... + ) -> None: ... + def polygon(self, point_list: list[tuple[float, float]], fill: bool = ..., style: RenderStyle | str | None = ...) -> None: ... + def dashed_line(self, x1, y1, x2, y2, dash_length: int = ..., space_length: int = ...) -> None: ... + def rect( + self, + x: float, + y: float, + w: float, + h: float, + style: RenderStyle | str | None = ..., + round_corners: tuple[str, ...] | tuple[Corner, ...] | bool = ..., + corner_radius: float = ..., + ) -> None: ... + def ellipse(self, x: float, y: float, w: float, h: float, style: RenderStyle | str | None = ...) -> None: ... + def circle(self, x: float, y: float, r, style: RenderStyle | str | None = ...) -> None: ... + def regular_polygon( + self, + x: float, + y: float, + numSides: int, + polyWidth: float, + rotateDegrees: float = ..., + style: RenderStyle | str | None = ..., + ): ... + def star( + self, + x: float, + y: float, + r_in: float, + r_out: float, + corners: int, + rotate_degrees: float = ..., + style: RenderStyle | str | None = ..., + ): ... + def arc( + self, + x: float, + y: float, + a: float, + start_angle: float, + end_angle: float, + b: float | None = ..., + inclination: float = ..., + clockwise: bool = ..., + start_from_center: bool = ..., + end_at_center: bool = ..., + style: RenderStyle | str | None = ..., + ) -> None: ... + def solid_arc( + self, + x: float, + y: float, + a: float, + start_angle: float, + end_angle: float, + b: float | None = ..., + inclination: float = ..., + clockwise: bool = ..., + style: RenderStyle | str | None = ..., + ) -> None: ... + def add_font( + self, family: str, style: _FontStyle = ..., fname: str | None = ..., uni: bool | Literal["DEPRECATED"] = ... + ) -> None: ... + def set_font(self, family: str | None = ..., style: _FontStyles = ..., size: int = ...) -> None: ... + def set_font_size(self, size: float) -> None: ... + def set_char_spacing(self, spacing: float) -> None: ... + def set_stretching(self, stretching: float) -> None: ... + def add_link(self) -> int: ... + def set_link(self, link, y: int = ..., x: int = ..., page: int = ..., zoom: float | Literal["null"] = ...) -> None: ... + def link( + self, x: float, y: float, w: float, h: float, link: str | int, alt_text: str | None = ..., border_width: int = ... + ) -> Annotation: ... + def embed_file( + self, + file_path: StrPath | None = ..., + bytes: bytes | None = ..., + basename: str | None = ..., + modification_date: datetime.datetime | None = ..., + *, + creation_date: datetime.datetime | None = ..., + desc: str = ..., + compress: bool = ..., + checksum: bool = ..., + ) -> str: ... + def file_attachment_annotation( + self, + file_path: StrPath, + x: float, + y: float, + w: float = ..., + h: float = ..., + name: FileAttachmentAnnotationName | str | None = ..., + flags: Iterable[AnnotationFlag | str] = ..., + *, + bytes: bytes | None = ..., + basename: str | None = ..., + creation_date: datetime.datetime | None = ..., + modification_date: datetime.datetime | None = ..., + desc: str = ..., + compress: bool = ..., + checksum: bool = ..., + ) -> Annotation: ... + def text_annotation( + self, + x: float, + y: float, + text: str, + w: float = ..., + h: float = ..., + name: AnnotationName | str | None = ..., + flags: tuple[AnnotationFlag, ...] | tuple[str, ...] = ..., + ) -> None: ... + def add_action(self, action, x: float, y: float, w: float, h: float) -> None: ... + def highlight( + self, + text: str, + title: str = ..., + type: TextMarkupType | str = ..., + color: tuple[float, float, float] = ..., + modification_time: datetime.datetime | None = ..., + ) -> _GeneratorContextManager[None]: ... + add_highlight = highlight + def add_text_markup_annotation( + self, + type: str, + text: str, + quad_points: Sequence[int], + title: str = ..., + color: tuple[float, float, float] = ..., + modification_time: datetime.datetime | None = ..., + page: int | None = ..., + ) -> Annotation: ... + def ink_annotation( + self, + coords: Iterable[Incomplete], + contents: str = ..., + title: str = ..., + color: Sequence[float] = ..., + border_width: int = ..., + ) -> Annotation: ... + def text(self, x: float, y: float, txt: str = ...) -> None: ... + def rotate(self, angle: float, x: float | None = ..., y: float | None = ...) -> None: ... + def rotation(self, angle: float, x: float | None = ..., y: float | None = ...) -> _GeneratorContextManager[None]: ... + def local_context( + self, + font_family: Incomplete | None = ..., + font_style: Incomplete | None = ..., + font_size: Incomplete | None = ..., + line_width: Incomplete | None = ..., + draw_color: Incomplete | None = ..., + fill_color: Incomplete | None = ..., + text_color: Incomplete | None = ..., + dash_pattern: Incomplete | None = ..., + **kwargs, + ) -> _GeneratorContextManager[None]: ... + @property + def accept_page_break(self) -> bool: ... + def cell( + self, + w: float | None = ..., + h: float | None = ..., + txt: str = ..., + border: bool | Literal[0, 1] | str = ..., + ln: int | Literal["DEPRECATED"] = ..., + align: str | Align = ..., + fill: bool = ..., + link: str = ..., + center: bool | Literal["DEPRECATED"] = ..., + markdown: bool = ..., + new_x: XPos | str = ..., + new_y: YPos | str = ..., + ) -> bool: ... + def will_page_break(self, height: float) -> bool: ... + def multi_cell( + self, + w: float, + h: float | None = ..., + txt: str = ..., + border: bool | Literal[0, 1] | str = ..., + align: str | Align = ..., + fill: bool = ..., + split_only: bool = ..., + link: str | int = ..., + ln: int | Literal["DEPRECATED"] = ..., + max_line_height: float | None = ..., + markdown: bool = ..., + print_sh: bool = ..., + new_x: XPos | str = ..., + new_y: YPos | str = ..., + ): ... + def write(self, h: float | None = ..., txt: str = ..., link: str = ..., print_sh: bool = ...) -> None: ... + def image( + self, + name: str | Image.Image | BytesIO | StrPath, + x: float | None = ..., + y: float | None = ..., + w: float = ..., + h: float = ..., + type: str = ..., + link: str = ..., + title: str | None = ..., + alt_text: str | None = ..., + ) -> _Image: ... + def ln(self, h: float | None = ...) -> None: ... + def get_x(self) -> float: ... + def set_x(self, x: float) -> None: ... + def get_y(self) -> float: ... + def set_y(self, y: float) -> None: ... + def set_xy(self, x: float, y: float) -> None: ... + @overload + def output(self, name: Literal[""] = ...) -> bytearray: ... # type: ignore[misc] + @overload + def output(self, name: str) -> None: ... + def normalize_text(self, txt: str) -> str: ... + def sign_pkcs12( + self, + pkcs_filepath: str, + password: bytes | None = ..., + hashalgo: str = ..., + contact_info: str | None = ..., + location: str | None = ..., + signing_time: datetime.datetime | None = ..., + reason: str | None = ..., + flags: tuple[AnnotationFlag, ...] = ..., + ) -> None: ... + def sign( + self, + key, + cert, + extra_certs: Sequence[Incomplete] = ..., + hashalgo: str = ..., + contact_info: str | None = ..., + location: str | None = ..., + signing_time: datetime.datetime | None = ..., + reason: str | None = ..., + flags: tuple[AnnotationFlag, ...] = ..., + ) -> None: ... + def file_id(self) -> str: ... + def interleaved2of5(self, txt, x: float, y: float, w: float = ..., h: float = ...) -> None: ... + def code39(self, txt, x: float, y: float, w: float = ..., h: float = ...) -> None: ... + def rect_clip(self, x: float, y: float, w: float, h: float) -> _GeneratorContextManager[None]: ... + def elliptic_clip(self, x: float, y: float, w: float, h: float) -> _GeneratorContextManager[None]: ... + def round_clip(self, x: float, y: float, r: float) -> _GeneratorContextManager[None]: ... + def unbreakable(self) -> _GeneratorContextManager[FPDFRecorder]: ... + def offset_rendering(self) -> _GeneratorContextManager[FPDFRecorder]: ... + def insert_toc_placeholder(self, render_toc_function, pages: int = ...) -> None: ... + def set_section_title_styles( + self, + level0: TitleStyle, + level1: TitleStyle | None = ..., + level2: TitleStyle | None = ..., + level3: TitleStyle | None = ..., + level4: TitleStyle | None = ..., + level5: TitleStyle | None = ..., + level6: TitleStyle | None = ..., + ) -> None: ... + def start_section(self, name: str, level: int = ...) -> None: ... diff --git a/stubs/fpdf2/fpdf/graphics_state.pyi b/stubs/fpdf2/fpdf/graphics_state.pyi new file mode 100644 index 0000000..35466d3 --- /dev/null +++ b/stubs/fpdf2/fpdf/graphics_state.pyi @@ -0,0 +1,101 @@ +from typing import ClassVar + +from .drawing import DeviceGray + +class GraphicsStateMixin: + DEFAULT_DRAW_COLOR: ClassVar[DeviceGray] + DEFAULT_FILL_COLOR: ClassVar[DeviceGray] + DEFAULT_TEXT_COLOR: ClassVar[DeviceGray] + def __init__(self, *args, **kwargs) -> None: ... + @property + def draw_color(self): ... + @draw_color.setter + def draw_color(self, v) -> None: ... + @property + def fill_color(self): ... + @fill_color.setter + def fill_color(self, v) -> None: ... + @property + def text_color(self): ... + @text_color.setter + def text_color(self, v) -> None: ... + @property + def underline(self): ... + @underline.setter + def underline(self, v) -> None: ... + @property + def font_style(self): ... + @font_style.setter + def font_style(self, v) -> None: ... + @property + def font_stretching(self): ... + @font_stretching.setter + def font_stretching(self, v) -> None: ... + @property + def char_spacing(self): ... + @char_spacing.setter + def char_spacing(self, v) -> None: ... + @property + def font_family(self): ... + @font_family.setter + def font_family(self, v) -> None: ... + @property + def font_size_pt(self): ... + @font_size_pt.setter + def font_size_pt(self, v) -> None: ... + @property + def font_size(self): ... + @font_size.setter + def font_size(self, v) -> None: ... + @property + def current_font(self): ... + @current_font.setter + def current_font(self, v) -> None: ... + @property + def dash_pattern(self): ... + @dash_pattern.setter + def dash_pattern(self, v) -> None: ... + @property + def line_width(self): ... + @line_width.setter + def line_width(self, v) -> None: ... + @property + def text_mode(self): ... + @text_mode.setter + def text_mode(self, v) -> None: ... + @property + def char_vpos(self): ... + @char_vpos.setter + def char_vpos(self, v) -> None: ... + @property + def sub_scale(self): ... + @sub_scale.setter + def sub_scale(self, v) -> None: ... + @property + def sup_scale(self): ... + @sup_scale.setter + def sup_scale(self, v) -> None: ... + @property + def nom_scale(self): ... + @nom_scale.setter + def nom_scale(self, v) -> None: ... + @property + def denom_scale(self): ... + @denom_scale.setter + def denom_scale(self, v) -> None: ... + @property + def sub_lift(self): ... + @sub_lift.setter + def sub_lift(self, v) -> None: ... + @property + def sup_lift(self): ... + @sup_lift.setter + def sup_lift(self, v) -> None: ... + @property + def nom_lift(self): ... + @nom_lift.setter + def nom_lift(self, v) -> None: ... + @property + def denom_lift(self): ... + @denom_lift.setter + def denom_lift(self, v) -> None: ... diff --git a/stubs/fpdf2/fpdf/html.pyi b/stubs/fpdf2/fpdf/html.pyi new file mode 100644 index 0000000..fd9fe97 --- /dev/null +++ b/stubs/fpdf2/fpdf/html.pyi @@ -0,0 +1,80 @@ +from html.parser import HTMLParser +from typing import Any + +__author__: str +__copyright__: str +__license__: str + +LOGGER: Any +BULLET_WIN1252: str +DEFAULT_HEADING_SIZES: Any +COLOR_DICT: Any + +def px2mm(px): ... +def color_as_decimal(color: str = ...): ... + +class HTML2FPDF(HTMLParser): + pdf: Any + image_map: Any + li_tag_indent: Any + table_line_separators: Any + ul_bullet_char: Any + style: Any + href: str + align: str + page_links: Any + font_stack: Any + indent: int + bullet: Any + font_size: Any + font_color: Any + table: Any + table_col_width: Any + table_col_index: Any + td: Any + th: Any + tr: Any + thead: Any + tfoot: Any + tr_index: Any + theader: Any + tfooter: Any + theader_out: bool + table_row_height: int + heading_level: Any + heading_sizes: Any + heading_above: float + heading_below: float + def __init__( + self, + pdf, + image_map: Any | None = ..., + li_tag_indent: int = ..., + table_line_separators: bool = ..., + ul_bullet_char=..., + heading_sizes: Any | None = ..., + **_, + ): ... + def width2unit(self, length): ... + def handle_data(self, data) -> None: ... + def box_shadow(self, w, h, bgcolor) -> None: ... + def output_table_header(self) -> None: ... + tfooter_out: bool + def output_table_footer(self) -> None: ... + def output_table_sep(self) -> None: ... + font_face: Any + table_offset: Any + def handle_starttag(self, tag, attrs) -> None: ... + tbody: Any + def handle_endtag(self, tag) -> None: ... + h: Any + def set_font(self, face: Any | None = ..., size: Any | None = ...) -> None: ... + def set_style(self, tag: Any | None = ..., enable: bool = ...) -> None: ... + def set_text_color(self, r: Any | None = ..., g: int = ..., b: int = ...) -> None: ... + def put_link(self, txt) -> None: ... + def render_toc(self, pdf, outline) -> None: ... + def error(self, message: str) -> None: ... + +class HTMLMixin: + HTML2FPDF_CLASS: Any + def write_html(self, text, *args, **kwargs) -> None: ... diff --git a/stubs/fpdf2/fpdf/image_parsing.pyi b/stubs/fpdf2/fpdf/image_parsing.pyi new file mode 100644 index 0000000..586aad2 --- /dev/null +++ b/stubs/fpdf2/fpdf/image_parsing.pyi @@ -0,0 +1,11 @@ +from typing import Any +from typing_extensions import Literal, TypeAlias + +_ImageFilter: TypeAlias = Literal["AUTO", "FlateDecode", "DCTDecode", "JPXDecode"] + +SUPPORTED_IMAGE_FILTERS: tuple[_ImageFilter, ...] + +def load_image(filename): ... + +# Returned dict could be typed as a TypedDict. +def get_img_info(img, image_filter: _ImageFilter = ..., dims: Any | None = ...) -> dict[str, Any]: ... diff --git a/stubs/fpdf2/fpdf/line_break.pyi b/stubs/fpdf2/fpdf/line_break.pyi new file mode 100644 index 0000000..9793b3e --- /dev/null +++ b/stubs/fpdf2/fpdf/line_break.pyi @@ -0,0 +1,112 @@ +from _typeshed import Incomplete +from collections.abc import Sequence +from typing import NamedTuple + +SOFT_HYPHEN: str +HYPHEN: str +SPACE: str +NEWLINE: str + +class Fragment: + characters: list[str] + graphics_state: dict[str, Incomplete] + k: float + def __init__(self, characters: list[str] | str, graphics_state: dict[str, Incomplete], k: float) -> None: ... + @property + def font(self): ... + @font.setter + def font(self, v) -> None: ... + @property + def is_ttf_font(self): ... + @property + def font_style(self): ... + @property + def font_family(self): ... + @property + def font_size_pt(self): ... + @property + def font_size(self): ... + @property + def font_stretching(self): ... + @property + def char_spacing(self): ... + @property + def text_mode(self): ... + @property + def underline(self): ... + @property + def draw_color(self): ... + @property + def fill_color(self): ... + @property + def text_color(self): ... + @property + def line_width(self): ... + @property + def char_vpos(self): ... + @property + def lift(self): ... + @property + def string(self): ... + def trim(self, index: int): ... + def __eq__(self, other: Fragment) -> bool: ... # type: ignore[override] + def get_width(self, start: int = ..., end: int | None = ..., chars: str | None = ..., initial_cs: bool = ...): ... + def get_character_width(self, character: str, print_sh: bool = ..., initial_cs: bool = ...): ... + +class TextLine(NamedTuple): + fragments: tuple[Incomplete, ...] + text_width: float + number_of_spaces: int + justify: bool + trailing_nl: bool = ... + +class SpaceHint(NamedTuple): + original_fragment_index: int + original_character_index: int + current_line_fragment_index: int + current_line_character_index: int + line_width: float + number_of_spaces: int + +class HyphenHint(NamedTuple): + original_fragment_index: int + original_character_index: int + current_line_fragment_index: int + current_line_character_index: int + line_width: float + number_of_spaces: int + curchar: str + curchar_width: float + graphics_state: dict[str, Incomplete] + k: float + +class CurrentLine: + print_sh: Incomplete + fragments: Incomplete + width: int + number_of_spaces: int + space_break_hint: Incomplete + hyphen_break_hint: Incomplete + def __init__(self, print_sh: bool = ...) -> None: ... + def add_character( + self, + character: str, + character_width: float, + graphics_state: dict[str, Incomplete], + k: float, + original_fragment_index: int, + original_character_index: int, + ): ... + def manual_break(self, justify: bool = ..., trailing_nl: bool = ...): ... + def automatic_break_possible(self): ... + def automatic_break(self, justify: bool): ... + +class MultiLineBreak: + styled_text_fragments: Incomplete + justify: Incomplete + print_sh: Incomplete + fragment_index: int + character_index: int + idx_last_forced_break: Incomplete + def __init__(self, styled_text_fragments: Sequence[Fragment], justify: bool = ..., print_sh: bool = ...) -> None: ... + def get_line_of_given_width(self, maximum_width: float, wordsplit: bool = ...): ... diff --git a/stubs/fpdf2/fpdf/outline.pyi b/stubs/fpdf2/fpdf/outline.pyi new file mode 100644 index 0000000..e5abc85 --- /dev/null +++ b/stubs/fpdf2/fpdf/outline.pyi @@ -0,0 +1,35 @@ +from _typeshed import Incomplete +from typing import Any, NamedTuple + +from .structure_tree import StructElem +from .syntax import Destination, PDFObject + +class OutlineSection(NamedTuple): + name: str + level: str + page_number: int + dest: Destination + struct_elem: StructElem | None = ... + +class OutlineItemDictionary(PDFObject): + title: str + parent: Any | None + prev: Any | None + next: Any | None + first: Any | None + last: Any | None + count: int + dest: str | None + struct_elem: StructElem | None + def __init__(self, title: str, dest: str | None = ..., struct_elem: StructElem | None = ..., **kwargs) -> None: ... + +class OutlineDictionary(PDFObject): + type: str + first: Any | None + last: Any | None + count: int + def __init__(self, **kwargs) -> None: ... + +def serialize_outline(sections, first_object_id: int = ..., fpdf: Any | None = ...): ... +def build_outline(sections, first_object_id, fpdf) -> tuple[Incomplete, Incomplete]: ... +def outline_as_str(outline, outline_items, fpdf) -> str: ... diff --git a/stubs/fpdf2/fpdf/prefs.pyi b/stubs/fpdf2/fpdf/prefs.pyi new file mode 100644 index 0000000..2ec95cd --- /dev/null +++ b/stubs/fpdf2/fpdf/prefs.pyi @@ -0,0 +1,24 @@ +from .enums import PageMode + +class ViewerPreferences: + hide_toolbar: bool + hide_menubar: bool + hide_window_u_i: bool + fit_window: bool + center_window: bool + display_doc_title: bool + def __init__( + self, + hide_toolbar: bool = ..., + hide_menubar: bool = ..., + hide_window_u_i: bool = ..., + fit_window: bool = ..., + center_window: bool = ..., + display_doc_title: bool = ..., + non_full_screen_page_mode: PageMode | str = ..., + ) -> None: ... + @property + def non_full_screen_page_mode(self): ... + @non_full_screen_page_mode.setter + def non_full_screen_page_mode(self, page_mode) -> None: ... + def serialize(self): ... diff --git a/stubs/fpdf2/fpdf/recorder.pyi b/stubs/fpdf2/fpdf/recorder.pyi new file mode 100644 index 0000000..6401da5 --- /dev/null +++ b/stubs/fpdf2/fpdf/recorder.pyi @@ -0,0 +1,13 @@ +from typing import Any + +class FPDFRecorder: + pdf: Any + accept_page_break: bool + def __init__(self, pdf, accept_page_break: bool = ...) -> None: ... + def __getattr__(self, name): ... + def rewind(self) -> None: ... + def replay(self) -> None: ... + +class CallRecorder: + def __init__(self, func, calls) -> None: ... + def __call__(self, *args, **kwargs): ... diff --git a/stubs/fpdf2/fpdf/sign.pyi b/stubs/fpdf2/fpdf/sign.pyi new file mode 100644 index 0000000..e6878ea --- /dev/null +++ b/stubs/fpdf2/fpdf/sign.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +class Signature: + type: str + filter: str + sub_filter: str + contact_info: Incomplete | None + location: Incomplete | None + m: Incomplete | None + reason: Incomplete | None + byte_range: str + contents: str + def __init__( + self, + contact_info: Incomplete | None = ..., + location: Incomplete | None = ..., + m: Incomplete | None = ..., + reason: Incomplete | None = ..., + ) -> None: ... + def serialize(self): ... + +def sign_content(signer, buffer, key, cert, extra_certs, hashalgo, sign_time): ... diff --git a/stubs/fpdf2/fpdf/structure_tree.pyi b/stubs/fpdf2/fpdf/structure_tree.pyi new file mode 100644 index 0000000..b8bc849 --- /dev/null +++ b/stubs/fpdf2/fpdf/structure_tree.pyi @@ -0,0 +1,52 @@ +from typing import Any, NamedTuple + +from .syntax import PDFObject + +class MarkedContent(NamedTuple): + page_object_id: int + struct_parents_id: int + struct_type: str + mcid: int | None = ... + title: str | None = ... + alt_text: str | None = ... + +class NumberTree(PDFObject): + nums: Any + def __init__(self, **kwargs) -> None: ... + def serialize(self, fpdf: Any | None = ..., obj_dict: Any | None = ...): ... + +class StructTreeRoot(PDFObject): + type: str + parent_tree: Any + k: Any + def __init__(self, **kwargs) -> None: ... + +class StructElem(PDFObject): + type: str + s: Any + p: Any + k: Any + pg: Any + t: Any + alt: Any + def __init__( + self, + struct_type: str, + parent: PDFObject, + kids: list[int] | list[StructElem], + page: PDFObject | None = ..., + title: str | None = ..., + alt: str | None = ..., + **kwargs, + ) -> None: ... + +class StructureTreeBuilder: + struct_tree_root: Any + doc_struct_elem: Any + struct_elem_per_mc: Any + def __init__(self) -> None: ... + def add_marked_content(self, marked_content) -> None: ... + def next_mcid_for_page(self, page_object_id): ... + def empty(self): ... + def serialize(self, first_object_id: int = ..., fpdf: Any | None = ...): ... + def assign_ids(self, n): ... diff --git a/stubs/fpdf2/fpdf/svg.pyi b/stubs/fpdf2/fpdf/svg.pyi new file mode 100644 index 0000000..7cf39a3 --- /dev/null +++ b/stubs/fpdf2/fpdf/svg.pyi @@ -0,0 +1,111 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from re import Pattern +from typing import NamedTuple + +from .drawing import Point + +__pdoc__: dict[str, bool] + +def force_nodocument(item): ... + +NUMBER_SPLIT: Pattern[str] +TRANSFORM_GETTER: Pattern[str] + +class Percent(float): ... + +unit_splitter: Pattern[str] +relative_length_units: set[str] +absolute_length_units: dict[str, int] +angle_units: dict[str, float] + +def resolve_length(length_str, default_unit: str = ...): ... +def resolve_angle(angle_str, default_unit: str = ...): ... +def xmlns(space, name): ... +def xmlns_lookup(space, *names): ... + +shape_tags: Incomplete + +def svgcolor(colorstr): ... +def convert_stroke_width(incoming): ... +def convert_miterlimit(incoming): ... +def clamp_float(min_val, max_val): ... +def inheritable(value, converter=...): ... +def optional(value, converter=...): ... + +svg_attr_map: dict[str, Callable[[Incomplete], tuple[str, Incomplete]]] + +def parse_style(svg_element) -> None: ... +def apply_styles(stylable, svg_element) -> None: ... + +class ShapeBuilder: + @staticmethod + def new_path(tag): ... + @classmethod + def rect(cls, tag): ... + @classmethod + def circle(cls, tag): ... + @classmethod + def ellipse(cls, tag): ... + @classmethod + def line(cls, tag): ... + @classmethod + def polyline(cls, tag): ... + @classmethod + def polygon(cls, tag): ... + +def convert_transforms(tfstr): ... + +class SVGSmoothCubicCurve(NamedTuple): + c2: Point + end: Point + @classmethod + def from_path_points(cls, path, c2x, c2y, ex, ey): ... + def render(self, path_gsds, style, last_item, initial_point): ... + def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ... + +class SVGRelativeSmoothCubicCurve(NamedTuple): + c2: Point + end: Point + @classmethod + def from_path_points(cls, path, c2x, c2y, ex, ey): ... + def render(self, path_gsds, style, last_item, initial_point): ... + def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ... + +class SVGSmoothQuadraticCurve(NamedTuple): + end: Point + @classmethod + def from_path_points(cls, path, ex, ey): ... + def render(self, path_gsds, style, last_item, initial_point): ... + def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ... + +class SVGRelativeSmoothQuadraticCurve(NamedTuple): + end: Point + @classmethod + def from_path_points(cls, path, ex, ey): ... + def render(self, path_gsds, style, last_item, initial_point): ... + def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ... + +def svg_path_converter(pdf_path, svg_path) -> None: ... + +class SVGObject: + @classmethod + def from_file(cls, filename, *args, encoding: str = ..., **kwargs): ... + cross_references: Incomplete + def __init__(self, svg_text) -> None: ... + preserve_ar: Incomplete + width: Incomplete + height: Incomplete + viewbox: Incomplete + def extract_shape_info(self, root_tag) -> None: ... + base_group: Incomplete + def convert_graphics(self, root_tag) -> None: ... + def transform_to_page_viewport(self, pdf, align_viewbox: bool = ...): ... + def transform_to_rect_viewport(self, scale, width, height, align_viewbox: bool = ..., ignore_svg_top_attrs: bool = ...): ... + def draw_to_page( + self, pdf, x: Incomplete | None = ..., y: Incomplete | None = ..., debug_stream: Incomplete | None = ... + ) -> None: ... + def handle_defs(self, defs) -> None: ... + def build_xref(self, xref): ... + def build_group(self, group, pdf_group: Incomplete | None = ...): ... + def build_path(self, path): ... diff --git a/stubs/fpdf2/fpdf/syntax.pyi b/stubs/fpdf2/fpdf/syntax.pyi new file mode 100644 index 0000000..f3a32f0 --- /dev/null +++ b/stubs/fpdf2/fpdf/syntax.pyi @@ -0,0 +1,58 @@ +from _typeshed import Incomplete, SupportsItems +from abc import ABC +from re import Pattern +from typing import Any, ClassVar +from typing_extensions import Literal + +def clear_empty_fields(d): ... +def create_dictionary_string( + dict_, + open_dict: str = ..., + close_dict: str = ..., + field_join: str = ..., + key_value_join: str = ..., + has_empty_fields: bool = ..., +): ... +def create_list_string(list_): ... +def iobj_ref(n): ... +def create_stream(stream): ... + +class PDFObject: + def __init__(self, id: Any | None = ...) -> None: ... + @property + def id(self): ... + @id.setter + def id(self, n) -> None: ... + @property + def ref(self): ... + def serialize(self, fpdf: Any | None = ..., obj_dict: Any | None = ...): ... + +def build_obj_dict(key_values: SupportsItems[str, Incomplete]) -> dict[str, str]: ... +def camel_case(snake_case: str) -> str: ... + +class PDFString(str): + USE_HEX_ENCODING: ClassVar[bool] + def serialize(self): ... + +class PDFArray(list[Any]): + def serialize(self): ... + +class Destination(ABC): + def as_str(self, pdf: Any | None = ...) -> None: ... + +class DestinationXYZ(Destination): + page: int + x: float + y: float + zoom: float | Literal["null"] + page_as_obj_id: bool + def __init__( + self, page: int, x: float = ..., y: float = ..., zoom: float | Literal["null"] = ..., page_as_obj_id: bool = ... + ) -> None: ... + def as_str(self, pdf: Any | None = ...): ... + +class Raw(str): ... + +class Name(str): + NAME_ESC: ClassVar[Pattern[bytes]] + def pdf_repr(self) -> str: ... diff --git a/stubs/fpdf2/fpdf/template.pyi b/stubs/fpdf2/fpdf/template.pyi new file mode 100644 index 0000000..589483f --- /dev/null +++ b/stubs/fpdf2/fpdf/template.pyi @@ -0,0 +1,39 @@ +from typing import Any + +__author__: str +__copyright__: str +__license__: str + +class FlexTemplate: + pdf: Any + splitting_pdf: Any + handlers: Any + texts: Any + def __init__(self, pdf, elements: Any | None = ...) -> None: ... + elements: Any + keys: Any + def load_elements(self, elements) -> None: ... + def parse_csv(self, infile, delimiter: str = ..., decimal_sep: str = ..., encoding: Any | None = ...): ... + def __setitem__(self, name, value) -> None: ... + set: Any + def __contains__(self, name): ... + def __getitem__(self, name): ... + def split_multicell(self, text, element_name): ... + def render(self, offsetx: float = ..., offsety: float = ..., rotate: float = ..., scale: float = ...): ... + +class Template(FlexTemplate): + def __init__( + self, + infile: Any | None = ..., + elements: Any | None = ..., + format: str = ..., + orientation: str = ..., + unit: str = ..., + title: str = ..., + author: str = ..., + subject: str = ..., + creator: str = ..., + keywords: str = ..., + ) -> None: ... + def add_page(self) -> None: ... + def render(self, outfile: Any | None = ..., dest: Any | None = ...) -> None: ... # type: ignore[override] diff --git a/stubs/fpdf2/fpdf/transitions.pyi b/stubs/fpdf2/fpdf/transitions.pyi new file mode 100644 index 0000000..c1d6922 --- /dev/null +++ b/stubs/fpdf2/fpdf/transitions.pyi @@ -0,0 +1,58 @@ +from abc import ABC +from typing import Any + +class Transition(ABC): + def dict_as_string(self) -> None: ... + +class SplitTransition(Transition): + dimension: Any + direction: Any + def __init__(self, dimension, direction) -> None: ... + def dict_as_string(self): ... + +class BlindsTransition(Transition): + dimension: Any + def __init__(self, dimension) -> None: ... + def dict_as_string(self): ... + +class BoxTransition(Transition): + direction: Any + def __init__(self, direction) -> None: ... + def dict_as_string(self): ... + +class WipeTransition(Transition): + direction: Any + def __init__(self, direction) -> None: ... + def dict_as_string(self): ... + +class DissolveTransition(Transition): + def dict_as_string(self): ... + +class GlitterTransition(Transition): + direction: Any + def __init__(self, direction) -> None: ... + def dict_as_string(self): ... + +class FlyTransition(Transition): + dimension: Any + direction: Any + def __init__(self, dimension, direction: Any | None = ...) -> None: ... + def dict_as_string(self): ... + +class PushTransition(Transition): + direction: Any + def __init__(self, direction) -> None: ... + def dict_as_string(self): ... + +class CoverTransition(Transition): + direction: Any + def __init__(self, direction) -> None: ... + def dict_as_string(self): ... + +class UncoverTransition(Transition): + direction: Any + def __init__(self, direction) -> None: ... + def dict_as_string(self): ... + +class FadeTransition(Transition): + def dict_as_string(self): ... diff --git a/stubs/fpdf2/fpdf/util.pyi b/stubs/fpdf2/fpdf/util.pyi new file mode 100644 index 0000000..f28df21 --- /dev/null +++ b/stubs/fpdf2/fpdf/util.pyi @@ -0,0 +1,20 @@ +import datetime +from collections.abc import Iterable +from typing import Any +from typing_extensions import Literal, TypeAlias + +_Unit: TypeAlias = Literal["pt", "mm", "cm", "in"] + +def object_id_for_page(page: int) -> int: ... +def format_date(date: datetime.datetime, with_tz: bool = ...) -> str: ... +def enclose_in_parens(s: str) -> str: ... +def escape_parens(s): ... +def b(s): ... +def get_scale_factor(unit: _Unit | float) -> float: ... +def convert_unit( + # to_convert has a recursive type + to_convert: float | Iterable[float | Iterable[Any]], + old_unit: str | float, + new_unit: str | float, +) -> float | tuple[float, ...]: ... +def dochecks() -> None: ... diff --git a/stubs/freezegun/@tests/stubtest_allowlist.txt b/stubs/freezegun/@tests/stubtest_allowlist.txt deleted file mode 100644 index 57a574d..0000000 --- a/stubs/freezegun/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,3 +0,0 @@ -freezegun.api._freeze_time.__init__ -freezegun.api.freeze_time -freezegun.freeze_time diff --git a/stubs/freezegun/METADATA.toml b/stubs/freezegun/METADATA.toml deleted file mode 100644 index bad265e..0000000 --- a/stubs/freezegun/METADATA.toml +++ /dev/null @@ -1 +0,0 @@ -version = "1.1" diff --git a/stubs/freezegun/freezegun/__init__.pyi b/stubs/freezegun/freezegun/__init__.pyi deleted file mode 100644 index 1de0916..0000000 --- a/stubs/freezegun/freezegun/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -from .api import freeze_time as freeze_time diff --git a/stubs/freezegun/freezegun/api.pyi b/stubs/freezegun/freezegun/api.pyi deleted file mode 100644 index df10e56..0000000 --- a/stubs/freezegun/freezegun/api.pyi +++ /dev/null @@ -1,57 +0,0 @@ -from collections.abc import Awaitable, Callable, Iterator, Sequence -from datetime import date, datetime, timedelta -from numbers import Real -from typing import Any, Type, TypeVar, Union, overload - -_T = TypeVar("_T") -_Freezable = Union[str, datetime, date, timedelta] - -class TickingDateTimeFactory(object): - def __init__(self, time_to_freeze: datetime, start: datetime) -> None: ... - def __call__(self) -> datetime: ... - -class FrozenDateTimeFactory(object): - def __init__(self, time_to_freeze: datetime) -> None: ... - def __call__(self) -> datetime: ... - def tick(self, delta: float | Real | timedelta = ...) -> None: ... - def move_to(self, target_datetime: _Freezable | None) -> None: ... - -class StepTickTimeFactory(object): - def __init__(self, time_to_freeze: datetime, step_width: float) -> None: ... - def __call__(self) -> datetime: ... - def tick(self, delta: timedelta | None = ...) -> None: ... - def update_step_width(self, step_width: float) -> None: ... - def move_to(self, target_datetime: _Freezable | None) -> None: ... - -class _freeze_time: - def __init__( - self, - time_to_freeze_str: _Freezable | None, - tz_offset: float, - ignore: Sequence[str], - tick: bool, - as_arg: bool, - auto_tick_seconds: float, - ) -> None: ... - @overload - def __call__(self, func: Type[_T]) -> Type[_T]: ... - @overload - def __call__(self, func: Callable[..., Awaitable[_T]]) -> Callable[..., Awaitable[_T]]: ... - @overload - def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ... - def __enter__(self) -> Any: ... - def __exit__(self, *args: Any) -> None: ... - def start(self) -> Any: ... - def stop(self) -> None: ... - def decorate_class(self, klass: Type[_T]) -> _T: ... - def decorate_coroutine(self, coroutine: _T) -> _T: ... - def decorate_callable(self, func: Callable[..., _T]) -> Callable[..., _T]: ... - -def freeze_time( - time_to_freeze: _Freezable | Callable[..., _Freezable] | Iterator[_Freezable] | None = ..., - tz_offset: float | None = ..., - ignore: Sequence[str] | None = ..., - tick: bool | None = ..., - as_arg: bool | None = ..., - auto_tick_seconds: float | None = ..., -) -> _freeze_time: ... diff --git a/stubs/frozendict/@tests/stubtest_allowlist.txt b/stubs/frozendict/@tests/stubtest_allowlist.txt deleted file mode 100644 index 8941c26..0000000 --- a/stubs/frozendict/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,5 +0,0 @@ -frozendict.FrozenOrderedDict -frozendict.frozendict.__hash__ -frozendict.frozendict.__new__ -frozendict.frozendict.__repr__ -frozendict.frozendict.copy diff --git a/stubs/frozendict/METADATA.toml b/stubs/frozendict/METADATA.toml deleted file mode 100644 index 5f15410..0000000 --- a/stubs/frozendict/METADATA.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.1" diff --git a/stubs/frozendict/frozendict.pyi b/stubs/frozendict/frozendict.pyi deleted file mode 100644 index 99ce6b8..0000000 --- a/stubs/frozendict/frozendict.pyi +++ /dev/null @@ -1,27 +0,0 @@ -import collections -from typing import Any, Generic, Iterable, Iterator, Mapping, Tuple, Type, TypeVar, overload - -_S = TypeVar("_S") -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") - -class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]): - - dict_cls: Type[dict[Any, Any]] = ... - @overload - def __init__(self, **kwargs: _VT) -> None: ... - @overload - def __init__(self, mapping: Mapping[_KT, _VT]) -> None: ... - @overload - def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... - def __getitem__(self, key: _KT) -> _VT: ... - def __contains__(self, key: object) -> bool: ... - def copy(self: _S, **add_or_replace: _VT) -> _S: ... - def __iter__(self) -> Iterator[_KT]: ... - def __len__(self) -> int: ... - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - -class FrozenOrderedDict(frozendict[_KT, _VT]): - - dict_cls: Type[collections.OrderedDict[Any, Any]] = ... diff --git a/stubs/futures/@python2/concurrent/futures/__init__.pyi b/stubs/futures/@python2/concurrent/futures/__init__.pyi deleted file mode 100644 index 1f93f02..0000000 --- a/stubs/futures/@python2/concurrent/futures/__init__.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from ._base import ( - ALL_COMPLETED as ALL_COMPLETED, - FIRST_COMPLETED as FIRST_COMPLETED, - FIRST_EXCEPTION as FIRST_EXCEPTION, - CancelledError as CancelledError, - Executor as Executor, - Future as Future, - TimeoutError as TimeoutError, - as_completed as as_completed, - wait as wait, -) -from .process import ProcessPoolExecutor as ProcessPoolExecutor -from .thread import ThreadPoolExecutor as ThreadPoolExecutor diff --git a/stubs/futures/@python2/concurrent/futures/_base.pyi b/stubs/futures/@python2/concurrent/futures/_base.pyi deleted file mode 100644 index 40a9862..0000000 --- a/stubs/futures/@python2/concurrent/futures/_base.pyi +++ /dev/null @@ -1,92 +0,0 @@ -import threading -from abc import abstractmethod -from logging import Logger -from types import TracebackType -from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Optional, Protocol, Set, Tuple, TypeVar - -FIRST_COMPLETED: str -FIRST_EXCEPTION: str -ALL_COMPLETED: str -PENDING: str -RUNNING: str -CANCELLED: str -CANCELLED_AND_NOTIFIED: str -FINISHED: str -LOGGER: Logger - -class Error(Exception): ... -class CancelledError(Error): ... -class TimeoutError(Error): ... - -_T = TypeVar("_T") - -_T_co = TypeVar("_T_co", covariant=True) - -# Copied over Collection implementation as it does not exist in Python 2 and <3.6. -# Also to solve pytype issues with _Collection. -class _Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]): - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... - -class Future(Generic[_T]): - def __init__(self) -> None: ... - def cancel(self) -> bool: ... - def cancelled(self) -> bool: ... - def running(self) -> bool: ... - def done(self) -> bool: ... - def add_done_callback(self, fn: Callable[[Future[_T]], Any]) -> None: ... - def result(self, timeout: Optional[float] = ...) -> _T: ... - def set_running_or_notify_cancel(self) -> bool: ... - def set_result(self, result: _T) -> None: ... - def exception(self, timeout: Optional[float] = ...) -> Any: ... - def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ... - def set_exception(self, exception: Any) -> None: ... - def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ... - -class Executor: - def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... - def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ... - def shutdown(self, wait: bool = ...) -> None: ... - def __enter__(self: _T) -> _T: ... - def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ... - -def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ... -def wait( - fs: _Collection[Future[_T]], timeout: Optional[float] = ..., return_when: str = ... -) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ... - -class _Waiter: - event: threading.Event - finished_futures: List[Future[Any]] - def __init__(self) -> None: ... - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... - -class _AsCompletedWaiter(_Waiter): - lock: threading.Lock - def __init__(self) -> None: ... - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... - -class _FirstCompletedWaiter(_Waiter): - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... - -class _AllCompletedWaiter(_Waiter): - num_pending_calls: int - stop_on_exception: bool - lock: threading.Lock - def __init__(self, num_pending_calls: int, stop_on_exception: bool) -> None: ... - def add_result(self, future: Future[Any]) -> None: ... - def add_exception(self, future: Future[Any]) -> None: ... - def add_cancelled(self, future: Future[Any]) -> None: ... - -class _AcquireFutures: - futures: Iterable[Future[Any]] - def __init__(self, futures: Iterable[Future[Any]]) -> None: ... - def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... diff --git a/stubs/futures/@python2/concurrent/futures/process.pyi b/stubs/futures/@python2/concurrent/futures/process.pyi deleted file mode 100644 index d56902c..0000000 --- a/stubs/futures/@python2/concurrent/futures/process.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Any, Optional - -from ._base import Executor - -EXTRA_QUEUED_CALLS: Any - -class ProcessPoolExecutor(Executor): - def __init__(self, max_workers: Optional[int] = ...) -> None: ... diff --git a/stubs/futures/@python2/concurrent/futures/thread.pyi b/stubs/futures/@python2/concurrent/futures/thread.pyi deleted file mode 100644 index 6e272f3..0000000 --- a/stubs/futures/@python2/concurrent/futures/thread.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Callable, Generic, Iterable, Mapping, Optional, TypeVar - -from ._base import Executor, Future - -_S = TypeVar("_S") - -class ThreadPoolExecutor(Executor): - def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ... - -class _WorkItem(Generic[_S]): - future: Future[_S] - fn: Callable[..., _S] - args: Iterable[Any] - kwargs: Mapping[str, Any] - def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ... - def run(self) -> None: ... diff --git a/stubs/futures/METADATA.toml b/stubs/futures/METADATA.toml deleted file mode 100644 index 31383cd..0000000 --- a/stubs/futures/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "3.3" -python2 = true diff --git a/stubs/gdb/METADATA.toml b/stubs/gdb/METADATA.toml new file mode 100644 index 0000000..67395fb --- /dev/null +++ b/stubs/gdb/METADATA.toml @@ -0,0 +1,13 @@ +version = "12.1.*" +extra_description = """\ + Type hints for GDB's \ + [Python API](https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html). \ + Note that this API is available only when running Python scripts under GDB: \ + is is not possible to install the `gdb` package separately, for instance \ + using `pip`.\ +""" + +[tool.stubtest] +# Since the "gdb" Python package is available only inside GDB, it is not +# possible to install it through pip, so stub tests cannot install it. +skip = true diff --git a/stubs/gdb/gdb/__init__.pyi b/stubs/gdb/gdb/__init__.pyi new file mode 100644 index 0000000..4fe071d --- /dev/null +++ b/stubs/gdb/gdb/__init__.pyi @@ -0,0 +1,698 @@ +# The GDB Python API is implemented in C, so the type hints below were made +# reading the documentation +# (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html). + +import _typeshed +from collections.abc import Callable, Iterator, Sequence +from contextlib import AbstractContextManager +from typing import Protocol, overload +from typing_extensions import TypeAlias + +import gdb.types + +# The following submodules are automatically imported +from . import events as events, printing as printing, prompt as prompt, types as types + +# Basic + +PYTHONDIR: str + +STDOUT: int +STDERR: int +STDLOG: int + +def execute(command: str, from_tty: bool = ..., to_string: bool = ...) -> str | None: ... +def breakpoints() -> Sequence[Breakpoint]: ... +def rbreak(regex: str, minsyms: bool = ..., throttle: int = ..., symtabs: Iterator[Symtab] = ...) -> list[Breakpoint]: ... +def parameter(__parameter: str) -> bool | int | str | None: ... +def set_parameter(name: str, value: bool | int | str | None) -> None: ... +def with_parameter(name: str, value: bool | int | str | None) -> AbstractContextManager[None]: ... +def history(__number: int) -> Value: ... +def add_history(__value: Value) -> int: ... +def history_count() -> int: ... +def convenience_variable(__name: str) -> Value | None: ... +def set_convenience_variable(__name: str, __value: _ValueOrNative | None) -> None: ... +def parse_and_eval(__expression: str) -> Value: ... +def find_pc_line(pc: int | Value) -> Symtab_and_line: ... +def post_event(__event: Callable[[], object]) -> None: ... +def write(string: str, stream: int = ...) -> None: ... +def flush(stream: int = ...) -> None: ... +def target_charset() -> str: ... +def target_wide_charset() -> str: ... +def host_charset() -> str: ... +def solib_name(address: int) -> str | None: ... +def decode_line(__expression: str = ...) -> tuple[str | None, tuple[Symtab_and_line, ...] | None]: ... +def prompt_hook(current_prompt: str) -> str: ... +def architecture_names() -> list[str]: ... +def connections() -> list[TargetConnection]: ... + +# Exceptions + +class error(RuntimeError): ... +class MemoryError(error): ... +class GdbError(Exception): ... + +# Values + +_ValueOrNative: TypeAlias = bool | float | str | Value +_ValueOrInt: TypeAlias = Value | int + +class Value: + + address: Value + is_optimized_out: bool + type: Type + dynamic_type: Type + is_lazy: bool + + def __index__(self) -> int: ... + def __int__(self) -> int: ... + def __float__(self) -> float: ... + def __add__(self, other: _ValueOrInt) -> Value: ... + def __sub__(self, other: _ValueOrInt) -> Value: ... + def __mul__(self, other: _ValueOrInt) -> Value: ... + def __truediv__(self, other: _ValueOrInt) -> Value: ... + def __mod__(self, other: _ValueOrInt) -> Value: ... + def __and__(self, other: _ValueOrInt) -> Value: ... + def __or__(self, other: _ValueOrInt) -> Value: ... + def __xor__(self, other: _ValueOrInt) -> Value: ... + def __lshift__(self, other: _ValueOrInt) -> Value: ... + def __rshift__(self, other: _ValueOrInt) -> Value: ... + def __getitem__(self, key: int | str | Field) -> Value: ... + def __call__(self, *args: _ValueOrNative) -> Value: ... + def __init__(self, val: _ValueOrNative) -> None: ... + def cast(self, type: Type) -> Value: ... + def dereference(self) -> Value: ... + def referenced_value(self) -> Value: ... + def reference_value(self) -> Value: ... + def const_value(self) -> Value: ... + def dynamic_cast(self, type: Type) -> Value: ... + def reinterpret_cast(self, type: Type) -> Value: ... + def format_string( + self, + raw: bool = ..., + pretty_arrays: bool = ..., + pretty_structs: bool = ..., + array_indexes: bool = ..., + symbols: bool = ..., + unions: bool = ..., + address: bool = ..., + deref_refs: bool = ..., + actual_objects: bool = ..., + static_members: bool = ..., + max_elements: int = ..., + max_depth: int = ..., + repeat_threshold: int = ..., + format: str = ..., + ) -> str: ... + def string(self, encoding: str = ..., errors: str = ..., length: int = ...) -> str: ... + def lazy_string(self, encoding: str = ..., length: int = ...) -> LazyString: ... + def fetch_lazy(self) -> None: ... + +# Types + +def lookup_type(name: str, block: Block = ...) -> Type: ... + +class Type: + + alignof: int + code: int + dynamic: bool + name: str + sizeof: int + tag: str | None + objfile: Objfile | None + + def fields(self) -> list[Field]: ... + def array(self, n1: int | Value, n2: int | Value = ...) -> Type: ... + def vector(self, n1: int, n2: int = ...) -> Type: ... + def const(self) -> Type: ... + def volatile(self) -> Type: ... + def unqualified(self) -> Type: ... + def range(self) -> tuple[int, int]: ... + def reference(self) -> Type: ... + def pointer(self) -> Type: ... + def strip_typedefs(self) -> Type: ... + def target(self) -> Type: ... + def template_argument(self, n: int, block: Block = ...) -> Type: ... + def optimized_out(self) -> Value: ... + +class Field: + + bitpos: int + enumval: int + name: str | None + artificial: bool + is_base_class: bool + bitsize: int + type: Type + parent_type: Type + +TYPE_CODE_PTR: int +TYPE_CODE_ARRAY: int +TYPE_CODE_STRUCT: int +TYPE_CODE_UNION: int +TYPE_CODE_ENUM: int +TYPE_CODE_FLAGS: int +TYPE_CODE_FUNC: int +TYPE_CODE_INT: int +TYPE_CODE_FLT: int +TYPE_CODE_VOID: int +TYPE_CODE_SET: int +TYPE_CODE_RANGE: int +TYPE_CODE_STRING: int +TYPE_CODE_BITSTRING: int +TYPE_CODE_ERROR: int +TYPE_CODE_METHOD: int +TYPE_CODE_METHODPTR: int +TYPE_CODE_MEMBERPTR: int +TYPE_CODE_REF: int +TYPE_CODE_RVALUE_REF: int +TYPE_CODE_CHAR: int +TYPE_CODE_BOOL: int +TYPE_CODE_COMPLEX: int +TYPE_CODE_TYPEDEF: int +TYPE_CODE_NAMESPACE: int +TYPE_CODE_DECFLOAT: int +TYPE_CODE_INTERNAL_FUNCTION: int + +# Pretty Printing + +class _PrettyPrinter(Protocol): + # TODO: The "children" and "display_hint" methods are optional for + # pretty-printers. Unfortunately, there is no such thing as an optional + # method in the type system at the moment. + # + # def children(self) -> Iterator[tuple[str, _ValueOrNative]]: ... + # def display_hint(self) -> str | None: ... + def to_string(self) -> str | LazyString: ... + +_PrettyPrinterLookupFunction: TypeAlias = Callable[[Value], _PrettyPrinter | None] + +def default_visualizer(__value: Value) -> _PrettyPrinter | None: ... + +# Selecting Pretty-Printers + +pretty_printers: list[_PrettyPrinterLookupFunction] + +# Filtering Frames + +class _FrameFilter(Protocol): + + name: str + enabled: bool + priority: int + + def filter(self, iterator: Iterator[_FrameDecorator]) -> Iterator[_FrameDecorator]: ... + +# Decorating Frames + +class _SymValueWrapper(Protocol): + def symbol(self) -> Symbol | str: ... + def value(self) -> _ValueOrNative | None: ... + +class _FrameDecorator(Protocol): + def elided(self) -> Iterator[Frame] | None: ... + def function(self) -> str | None: ... + def address(self) -> int | None: ... + def filename(self) -> str | None: ... + def line(self) -> int | None: ... + def frame_args(self) -> Iterator[_SymValueWrapper] | None: ... + def frame_locals(self) -> Iterator[_SymValueWrapper] | None: ... + def inferior_frame(self) -> Frame: ... + +# Unwinding Frames + +class PendingFrame: + def read_register(self, __reg: str | RegisterDescriptor | int) -> Value: ... + def create_unwind_info(self, __frame_id: object) -> UnwindInfo: ... + def architecture(self) -> Architecture: ... + def level(self) -> int: ... + +class UnwindInfo: + def add_saved_register(self, __reg: str | RegisterDescriptor | int, __value: Value) -> None: ... + +class Unwinder: + name: str + enabled: bool + + def __call__(self, pending_frame: Frame) -> UnwindInfo | None: ... + +# Xmethods: the API is defined in the "xmethod" module + +# Inferiors + +def inferiors() -> tuple[Inferior, ...]: ... +def selected_inferior() -> Inferior: ... + +_BufferType: TypeAlias = _typeshed.ReadableBuffer + +class Inferior: + num: int + connection_num: int + pid: int + was_attached: bool + progspace: Progspace + + def is_valid(self) -> bool: ... + def threads(self) -> tuple[InferiorThread, ...]: ... + def architecture(self) -> Architecture: ... + def read_memory(self, address: _ValueOrInt, length: int) -> memoryview: ... + def write_memory(self, address: _ValueOrInt, buffer: _BufferType, length: int = ...) -> memoryview: ... + def search_memory(self, address: _ValueOrInt, length: int, pattern: _BufferType) -> int | None: ... + def thread_from_handle(self, handle: Value) -> InferiorThread: ... + +# Threads + +def selected_thread() -> InferiorThread: ... + +class InferiorThread: + name: str | None + num: int + global_num: int + ptid: tuple[int, int, int] + inferior: Inferior + + def is_valid(self) -> bool: ... + def switch(self) -> None: ... + def is_stopped(self) -> bool: ... + def is_running(self) -> bool: ... + def is_exited(self) -> bool: ... + def handle(self) -> bytes: ... + +# Recordings + +def start_recording(__method: str = ..., __format: str = ...) -> Record: ... +def current_recording() -> Record | None: ... +def stop_recording() -> None: ... + +class Record: + method: str + format: str | None + begin: Instruction + end: Instruction + replay_position: Instruction | None + instruction_history: list[Instruction] + function_call_history: list[RecordFunctionSegment] + + def goto(self, __instruction: Instruction) -> None: ... + +class Instruction: + pc: int + data: memoryview + decoded: str + size: int + +class RecordInstruction(Instruction): + number: int + sal: Symtab_and_line | None + is_speculative: bool + +class RecordGap(Instruction): + number: int + error_code: int + error_string: str + +class RecordFunctionSegment: + number: int + symbol: Symbol | None + level: int | None + instructions: list[RecordInstruction | RecordGap] + up: RecordFunctionSegment | None + prev: RecordFunctionSegment | None + next: RecordFunctionSegment | None + +# CLI Commands + +class Command: + def __init__(self, name: str, command_class: int, completer_class: int = ..., prefix: bool = ...) -> None: ... + def dont_repeat(self) -> None: ... + def invoke(self, argument: str, from_tty: bool) -> None: ... + def complete(self, text: str, word: str) -> object: ... + +def string_to_argv(__argv: str) -> list[str]: ... + +COMMAND_NONE: int +COMMAND_RUNNING: int +COMMAND_DATA: int +COMMAND_STACK: int +COMMAND_FILES: int +COMMAND_SUPPORT: int +COMMAND_STATUS: int +COMMAND_BREAKPOINTS: int +COMMAND_TRACEPOINTS: int +COMMAND_TUI: int +COMMAND_USER: int +COMMAND_OBSCURE: int +COMMAND_MAINTENANCE: int + +COMPLETE_NONE: int +COMPLETE_FILENAME: int +COMPLETE_LOCATION: int +COMPLETE_COMMAND: int +COMPLETE_SYMBOL: int +COMPLETE_EXPRESSION: int + +# GDB/MI Commands + +class MICommand: + name: str + installed: bool + + def __init__(self, name: str) -> None: ... + def invoke(self, arguments: list[str]) -> dict[str, object] | None: ... + +# Parameters + +class Parameter: + set_doc: str + show_doc: str + value: object + + def __init__(self, name: str, command_class: int, parameter_class: int, enum_sequence: Sequence[str] = ...) -> None: ... + def get_set_string(self) -> str: ... + def get_show_string(self, svalue: str) -> str: ... + +PARAM_BOOLEAN: int +PARAM_AUTO_BOOLEAN: int +PARAM_UINTEGER: int +PARAM_INTEGER: int +PARAM_STRING: int +PARAM_STRING_NOESCAPE: int +PARAM_OPTIONAL_FILENAME: int +PARAM_FILENAME: int +PARAM_ZINTEGER: int +PARAM_ZUINTEGER: int +PARAM_ZUINTEGER_UNLIMITED: int +PARAM_ENUM: int + +# Convenience functions + +class Function: + def __init__(self, name: str) -> None: ... + def invoke(self, *args: Value) -> _ValueOrNative: ... + +# Progspaces + +def current_progspace() -> Progspace | None: ... +def progspaces() -> Sequence[Progspace]: ... + +class Progspace: + filename: str + pretty_printers: list[_PrettyPrinterLookupFunction] + type_printers: list[gdb.types._TypePrinter] + frame_filters: list[_FrameFilter] + + def block_for_pc(self, __pc: int) -> Block | None: ... + def find_pc_line(self, __pc: int) -> Symtab_and_line: ... + def is_valid(self) -> bool: ... + def objfiles(self) -> Sequence[Objfile]: ... + def solib_name(self, __address: int) -> str | None: ... + +# Objfiles + +def current_objfile() -> Objfile | None: ... +def objfiles() -> list[Objfile]: ... +def lookup_objfile(name: str, by_build_id: bool = ...) -> Objfile | None: ... + +class Objfile: + filename: str | None + username: str | None + owner: Objfile | None + build_id: str | None + progspace: Progspace + pretty_printers: list[_PrettyPrinterLookupFunction] + type_printers: list[gdb.types._TypePrinter] + frame_filters: list[_FrameFilter] + + def is_valid(self) -> bool: ... + def add_separate_debug_file(self, file: str) -> None: ... + def lookup_global_symbol(self, name: str, domain: int = ...) -> Symbol | None: ... + def lookup_static_method(self, name: str, domain: int = ...) -> Symbol | None: ... + +# Frames + +def selected_frame() -> Frame: ... +def newest_frame() -> Frame: ... +def frame_stop_reason_string(__code: int) -> str: ... +def invalidate_cached_frames() -> None: ... + +NORMAL_FRAME: int +INLINE_FRAME: int +TAILCALL_FRAME: int +SIGTRAMP_FRAME: int +ARCH_FRAME: int +SENTINEL_FRAME: int + +FRAME_UNWIND_NO_REASON: int +FRAME_UNWIND_NULL_ID: int +FRAME_UNWIND_OUTERMOST: int +FRAME_UNWIND_UNAVAILABLE: int +FRAME_UNWIND_INNER_ID: int +FRAME_UNWIND_SAME_ID: int +FRAME_UNWIND_NO_SAVED_PC: int +FRAME_UNWIND_MEMORY_ERROR: int +FRAME_UNWIND_FIRST_ERROR: int + +class Frame: + def is_valid(self) -> bool: ... + def name(self) -> str | None: ... + def architecture(self) -> Architecture: ... + def type(self) -> int: ... + def unwind_stop_reason(self) -> int: ... + def pc(self) -> Value: ... + def block(self) -> Block: ... + def function(self) -> Symbol: ... + def older(self) -> Frame | None: ... + def newer(self) -> Frame | None: ... + def find_sal(self) -> Symtab_and_line: ... + def read_register(self, __register: str | RegisterDescriptor | int) -> Value: ... + def read_var(self, __variable: str | Symbol, block: Block | None = ...) -> Value: ... + def select(self) -> None: ... + def level(self) -> int: ... + +# Blocks + +def block_for_pc(pc: int) -> Block | None: ... + +class Block: + start: int + end: int + function: Symbol | None + superblock: Block | None + global_block: Block + static_block: Block | None + is_global: bool + is_static: bool + + def is_valid(self) -> bool: ... + +# Symbols + +def lookup_symbol(name: str, block: Block | None = ..., domain: int = ...) -> tuple[Symbol | None, bool]: ... +def lookup_global_symbol(name: str, domain: int = ...) -> Symbol | None: ... +def lookup_static_symbol(name: str, domain: int = ...) -> Symbol | None: ... +def lookup_static_symbols(name: str, domain: int = ...) -> list[Symbol]: ... + +class Symbol: + + type: Type | None + symtab: Symtab + line: int + name: str + linkage_name: str + print_name: str + addr_class: int + needs_frame: bool + is_argument: bool + is_constant: bool + is_function: bool + is_variable: bool + + def is_valid(self) -> bool: ... + def value(self, __frame: Frame = ...) -> Value: ... + +SYMBOL_UNDEF_DOMAIN: int +SYMBOL_VAR_DOMAIN: int +SYMBOL_STRUCT_DOMAIN: int +SYMBOL_LABEL_DOMAIN: int +SYMBOL_MODULE_DOMAIN: int +SYMBOL_COMMON_BLOCK_DOMAIN: int + +SYMBOL_LOC_UNDEF: int +SYMBOL_LOC_CONST: int +SYMBOL_LOC_STATIC: int +SYMBOL_LOC_REGISTER: int +SYMBOL_LOC_ARG: int +SYMBOL_LOC_REF_ARG: int +SYMBOL_LOC_REGPARM_ADDR: int +SYMBOL_LOC_LOCAL: int +SYMBOL_LOC_TYPEDEF: int +SYMBOL_LOC_LABEL: int +SYMBOL_LOC_BLOCK: int +SYMBOL_LOC_CONST_BYTES: int +SYMBOL_LOC_UNRESOLVED: int +SYMBOL_LOC_OPTIMIZED_OUT: int +SYMBOL_LOC_COMPUTED: int +SYMBOL_LOC_COMMON_BLOCK: int + +# Symbol tables + +class Symtab_and_line: + + symtab: Symtab + pc: int + last: int + line: int + + def is_valid(self) -> bool: ... + +class Symtab: + + filename: str + objfile: Objfile + producer: str + + def is_valid(self) -> bool: ... + def fullname(self) -> str: ... + def global_block(self) -> Block: ... + def static_block(self) -> Block: ... + def linetable(self) -> LineTable: ... + +# Line Tables + +class LineTableEntry: + line: int + pc: int + +class LineTable(Iterator[LineTableEntry]): + def __iter__(self: _typeshed.Self) -> _typeshed.Self: ... + def __next__(self) -> LineTableEntry: ... + def line(self, __line: int) -> tuple[LineTableEntry, ...]: ... + def has_line(self, __line: int) -> bool: ... + def source_lnes(self) -> list[int]: ... + +# Breakpoints + +class Breakpoint: + @overload + def __init__( + self, spec: str, type: int = ..., wp_class: int = ..., internal: bool = ..., temporary: bool = ..., qualified: bool = ... + ) -> None: ... + @overload + def __init__( + self, + source: str = ..., + function: str = ..., + label: str = ..., + line: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... + def stop(self) -> bool: ... + def is_valid(self) -> bool: ... + def delete(self) -> None: ... + + enabled: bool + silent: bool + pending: bool + thread: int | None + task: str | None + ignore_count: int + number: int + type: int + visible: bool + temporary: bool + hit_count: int + location: str | None + expression: str | None + condition: str | None + commands: str | None + +BP_BREAKPOINT: int +BP_HARDWARE_BREAKPOINT: int +BP_WATCHPOINT: int +BP_HARDWARE_WATCHPOINT: int +BP_READ_WATCHPOINT: int +BP_ACCESS_WATCHPOINT: int +BP_CATCHPOINT: int + +WP_READ: int +WP_WRITE: int +WP_ACCESS: int + +# Finish Breakpoints + +class FinishBreakpoint(Breakpoint): + return_value: Value | None + + def __init__(self, frame: Frame = ..., internal: bool = ...) -> None: ... + def out_of_scope(self) -> None: ... + +# Lazy strings + +class LazyString: + def value(self) -> Value: ... + + address: Value + length: int + encoding: str + type: Type + +# Architectures + +class Architecture: + def name(self) -> str: ... + def disassemble(self, start_pc: int, end_pc: int = ..., count: int = ...) -> list[dict[str, object]]: ... + def integer_type(self, size: int, signed: bool = ...) -> Type: ... + def registers(self, reggroup: str = ...) -> RegisterDescriptorIterator: ... + def register_groups(self) -> RegisterGroupsIterator: ... + +# Registers + +class RegisterDescriptor: + name: str + +class RegisterDescriptorIterator(Iterator[RegisterDescriptor]): + def __next__(self) -> RegisterDescriptor: ... + def find(self, name: str) -> RegisterDescriptor | None: ... + +class RegisterGroup: + name: str + +class RegisterGroupsIterator(Iterator[RegisterGroup]): + def __next__(self) -> RegisterGroup: ... + +# Connections + +class TargetConnection: + def is_valid(self) -> bool: ... + + num: int + type: str + description: str + details: str | None + +class RemoteTargetConnection(TargetConnection): + def send_packet(self, packet: str | bytes) -> bytes: ... + +# TUI Windows + +def register_window_type(name: str, factory: Callable[[TuiWindow], _Window]) -> None: ... + +class TuiWindow: + width: int + height: int + title: str + + def is_valid(self) -> bool: ... + def erase(self) -> None: ... + def write(self, __string: str, __full_window: bool = ...) -> None: ... + +class _Window(Protocol): + def close(self) -> None: ... + def render(self) -> None: ... + def hscroll(self, num: int) -> None: ... + def vscroll(self, num: int) -> None: ... + def click(self, x: int, y: int, button: int) -> None: ... diff --git a/stubs/gdb/gdb/events.pyi b/stubs/gdb/gdb/events.pyi new file mode 100644 index 0000000..72d4fc5 --- /dev/null +++ b/stubs/gdb/gdb/events.pyi @@ -0,0 +1,131 @@ +from collections.abc import Callable, Sequence + +import gdb + +class ThreadEvent: + inferior_thread: gdb.InferiorThread + +class ContinueEvent(ThreadEvent): ... + +class ContinueEventRegistry: + def connect(self, __object: Callable[[ContinueEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[ContinueEvent], object]) -> None: ... + +cont: ContinueEventRegistry + +class ExitedEvent: + exit_code: int + inferior: gdb.Inferior + +class ExitedEventRegistry: + def connect(self, __object: Callable[[ExitedEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[ExitedEvent], object]) -> None: ... + +exited: ExitedEventRegistry + +class StopEvent(ThreadEvent): + stop_signal: str + +class BreakpointEvent(StopEvent): + breakpoints: Sequence[gdb.Breakpoint] + breakpoint: gdb.Breakpoint + +class StopEventRegistry: + def connect(self, __object: Callable[[StopEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[StopEvent], object]) -> None: ... + +stop: StopEventRegistry + +class NewObjFileEvent: + new_objfile: gdb.Objfile + +class NewObjFileEventRegistry: + def connect(self, __object: Callable[[NewObjFileEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[NewObjFileEvent], object]) -> None: ... + +new_objfile: NewObjFileEventRegistry + +class ClearObjFilesEvent: + progspace: gdb.Progspace + +class ClearObjFilesEventRegistry: + def connect(self, __object: Callable[[ClearObjFilesEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[ClearObjFilesEvent], object]) -> None: ... + +clear_objfiles: ClearObjFilesEventRegistry + +class InferiorCallEvent: ... + +class InferiorCallPreEvent(InferiorCallEvent): + ptid: gdb.InferiorThread + address: gdb.Value + +class InferiorCallPostEvent(InferiorCallEvent): + ptid: gdb.InferiorThread + address: gdb.Value + +class InferiorCallEventRegistry: + def connect(self, __object: Callable[[InferiorCallEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[InferiorCallEvent], object]) -> None: ... + +inferior_call: InferiorCallEventRegistry + +class MemoryChangedEvent: + address: gdb.Value + length: int + +class MemoryChangedEventRegistry: + def connect(self, __object: Callable[[MemoryChangedEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[MemoryChangedEvent], object]) -> None: ... + +memory_changed: MemoryChangedEventRegistry + +class RegisterChangedEvent: + frame: gdb.Frame + regnum: str + +class RegisterChangedEventRegistry: + def connect(self, __object: Callable[[RegisterChangedEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[RegisterChangedEvent], object]) -> None: ... + +register_changed: RegisterChangedEventRegistry + +class BreakpointEventRegistry: + def connect(self, __object: Callable[[gdb.Breakpoint], object]) -> None: ... + def disconnect(self, __object: Callable[[gdb.Breakpoint], object]) -> None: ... + +breakpoint_created: BreakpointEventRegistry +breakpoint_modified: BreakpointEventRegistry +breakpoint_deleted: BreakpointEventRegistry + +class BeforePromptEventRegistry: + def connect(self, __object: Callable[[], object]) -> None: ... + def disconnect(self, __object: Callable[[], object]) -> None: ... + +before_prompt: BeforePromptEventRegistry + +class NewInferiorEvent: + inferior: gdb.Inferior + +class NewInferiorEventRegistry: + def connect(self, __object: Callable[[NewInferiorEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[NewInferiorEvent], object]) -> None: ... + +new_inferior: NewInferiorEventRegistry + +class InferiorDeletedEvent: + inferior: gdb.Inferior + +class InferiorDeletedEventRegistry: + def connect(self, __object: Callable[[InferiorDeletedEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[InferiorDeletedEvent], object]) -> None: ... + +inferior_deleted: InferiorDeletedEventRegistry + +class NewThreadEvent(ThreadEvent): ... + +class NewThreadEventRegistry: + def connect(self, __object: Callable[[NewThreadEvent], object]) -> None: ... + def disconnect(self, __object: Callable[[NewThreadEvent], object]) -> None: ... + +new_thread: NewThreadEventRegistry diff --git a/stubs/gdb/gdb/printing.pyi b/stubs/gdb/gdb/printing.pyi new file mode 100644 index 0000000..97cb7be --- /dev/null +++ b/stubs/gdb/gdb/printing.pyi @@ -0,0 +1,29 @@ +from collections.abc import Iterable + +import gdb +from gdb import _PrettyPrinterLookupFunction + +class PrettyPrinter: + + name: str + subprinters: list[SubPrettyPrinter] + enabled: bool + + def __init__(self, name: str, subprinters: Iterable[SubPrettyPrinter] | None = ...) -> None: ... + def __call__(self, val: gdb.Value) -> gdb._PrettyPrinter | None: ... + +class SubPrettyPrinter: + + name: str + enabled: bool + + def __init__(self, name: str) -> None: ... + +class RegexpCollectionPrettyPrinter(PrettyPrinter): + def __init__(self, name: str) -> None: ... + def add_printer(self, name: str, regexp: str, gen_printer: _PrettyPrinterLookupFunction) -> None: ... + +class FlagEnumerationPrinter(PrettyPrinter): + def __init__(self, enum_type: str) -> None: ... + +def register_pretty_printer(obj: gdb.Objfile | gdb.Progspace | None, printer: PrettyPrinter, replace: bool = ...) -> None: ... diff --git a/stubs/gdb/gdb/prompt.pyi b/stubs/gdb/gdb/prompt.pyi new file mode 100644 index 0000000..ed14e75 --- /dev/null +++ b/stubs/gdb/gdb/prompt.pyi @@ -0,0 +1 @@ +def substitute_prompt(string: str) -> str: ... diff --git a/stubs/gdb/gdb/types.pyi b/stubs/gdb/gdb/types.pyi new file mode 100644 index 0000000..b39b9d8 --- /dev/null +++ b/stubs/gdb/gdb/types.pyi @@ -0,0 +1,24 @@ +from collections.abc import Iterator +from typing import Protocol + +import gdb + +def get_basic_type(type_: gdb.Type) -> gdb.Type: ... +def has_field(type_: gdb.Type, field: str) -> bool: ... +def make_enum_dict(type_: gdb.Type) -> dict[str, int]: ... +def deep_items(type_: gdb.Type) -> Iterator[tuple[str, gdb.Field]]: ... +def get_type_recognizers() -> list[_TypeRecognizer]: ... +def apply_type_recognizers(recognizers: list[_TypeRecognizer], type_obj: gdb.Type) -> str | None: ... +def register_type_printer(locus: gdb.Objfile | gdb.Progspace | None, printer: _TypePrinter) -> None: ... + +class _TypePrinter(Protocol): + enabled: bool + name: str + + def instantiate(self) -> _TypeRecognizer | None: ... + +class _TypeRecognizer(Protocol): + def recognize(self, __type: gdb.Type) -> str | None: ... + +class TypePrinter: + def __init__(self, name: str) -> None: ... diff --git a/stubs/gdb/gdb/unwinder.pyi b/stubs/gdb/gdb/unwinder.pyi new file mode 100644 index 0000000..1f3279f --- /dev/null +++ b/stubs/gdb/gdb/unwinder.pyi @@ -0,0 +1,3 @@ +import gdb + +def register_unwinder(locus: gdb.Objfile | gdb.Progspace | None, unwinder: gdb.Unwinder, replace: bool = ...) -> None: ... diff --git a/stubs/gdb/gdb/xmethod.pyi b/stubs/gdb/gdb/xmethod.pyi new file mode 100644 index 0000000..cab42ae --- /dev/null +++ b/stubs/gdb/gdb/xmethod.pyi @@ -0,0 +1,34 @@ +from collections.abc import Sequence +from typing import Protocol + +import gdb + +def register_xmethod_matcher( + locus: gdb.Objfile | gdb.Progspace | None, matcher: _XMethodMatcher, replace: bool = ... +) -> None: ... + +class _XMethod(Protocol): + name: str + enabled: bool + +class XMethod: + name: str + enabled: bool + + def __init__(self, name: str) -> None: ... + +class _XMethodWorker(Protocol): + def get_arg_types(self) -> Sequence[gdb.Type]: ... + def get_result_type(self, *args: gdb.Value) -> gdb.Type: ... + def __call__(self, *args: gdb.Value) -> object: ... + +class XMethodWorker: ... + +class _XMethodMatcher(Protocol): + enabled: bool + methods: list[_XMethod] + + def __init__(self, name: str) -> None: ... + def match(self, class_type: gdb.Type, method_name: str) -> _XMethodWorker: ... + +class XMethodMatcher: ... diff --git a/stubs/google-cloud-ndb/@tests/requirements-stubtest.txt b/stubs/google-cloud-ndb/@tests/requirements-stubtest.txt new file mode 100644 index 0000000..ca9dfdb --- /dev/null +++ b/stubs/google-cloud-ndb/@tests/requirements-stubtest.txt @@ -0,0 +1 @@ +protobuf==3.20.2 diff --git a/stubs/google-cloud-ndb/@tests/stubtest_allowlist.txt b/stubs/google-cloud-ndb/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..a67cb1a --- /dev/null +++ b/stubs/google-cloud-ndb/@tests/stubtest_allowlist.txt @@ -0,0 +1,4 @@ +# inconsistency of signatures between stub and implementation (cls vs self) +google.cloud.ndb.ModelAdapter.__new__ +google.cloud.ndb.metadata.EntityGroup.__new__ +google.cloud.ndb.model.ModelAdapter.__new__ diff --git a/stubs/google-cloud-ndb/METADATA.toml b/stubs/google-cloud-ndb/METADATA.toml new file mode 100644 index 0000000..ea08a7b --- /dev/null +++ b/stubs/google-cloud-ndb/METADATA.toml @@ -0,0 +1,2 @@ +version = "1.11.*" +requires = [] diff --git a/stdlib/@python2/xml/etree/__init__.pyi b/stubs/google-cloud-ndb/google/__init__.pyi similarity index 100% rename from stdlib/@python2/xml/etree/__init__.pyi rename to stubs/google-cloud-ndb/google/__init__.pyi diff --git a/stubs/Werkzeug/werkzeug/contrib/__init__.pyi b/stubs/google-cloud-ndb/google/cloud/__init__.pyi similarity index 100% rename from stubs/Werkzeug/werkzeug/contrib/__init__.pyi rename to stubs/google-cloud-ndb/google/cloud/__init__.pyi diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/__init__.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/__init__.pyi new file mode 100644 index 0000000..3fb429e --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/__init__.pyi @@ -0,0 +1,109 @@ +from google.cloud.ndb._datastore_api import EVENTUAL as EVENTUAL, EVENTUAL_CONSISTENCY as EVENTUAL_CONSISTENCY, STRONG as STRONG +from google.cloud.ndb._datastore_query import Cursor as Cursor, QueryIterator as QueryIterator +from google.cloud.ndb._transaction import ( + in_transaction as in_transaction, + non_transactional as non_transactional, + transaction as transaction, + transaction_async as transaction_async, + transactional as transactional, + transactional_async as transactional_async, + transactional_tasklet as transactional_tasklet, +) +from google.cloud.ndb.client import Client as Client +from google.cloud.ndb.context import ( + AutoBatcher as AutoBatcher, + Context as Context, + ContextOptions as ContextOptions, + TransactionOptions as TransactionOptions, + get_context as get_context, + get_toplevel_context as get_toplevel_context, +) +from google.cloud.ndb.global_cache import GlobalCache as GlobalCache, MemcacheCache as MemcacheCache, RedisCache as RedisCache +from google.cloud.ndb.key import Key as Key +from google.cloud.ndb.model import ( + BadProjectionError as BadProjectionError, + BlobKey as BlobKey, + BlobKeyProperty as BlobKeyProperty, + BlobProperty as BlobProperty, + BooleanProperty as BooleanProperty, + ComputedProperty as ComputedProperty, + ComputedPropertyError as ComputedPropertyError, + DateProperty as DateProperty, + DateTimeProperty as DateTimeProperty, + Expando as Expando, + FloatProperty as FloatProperty, + GenericProperty as GenericProperty, + GeoPt as GeoPt, + GeoPtProperty as GeoPtProperty, + Index as Index, + IndexProperty as IndexProperty, + IndexState as IndexState, + IntegerProperty as IntegerProperty, + InvalidPropertyError as InvalidPropertyError, + JsonProperty as JsonProperty, + KeyProperty as KeyProperty, + KindError as KindError, + LocalStructuredProperty as LocalStructuredProperty, + MetaModel as MetaModel, + Model as Model, + ModelAdapter as ModelAdapter, + ModelAttribute as ModelAttribute, + ModelKey as ModelKey, + PickleProperty as PickleProperty, + Property as Property, + ReadonlyPropertyError as ReadonlyPropertyError, + Rollback as Rollback, + StringProperty as StringProperty, + StructuredProperty as StructuredProperty, + TextProperty as TextProperty, + TimeProperty as TimeProperty, + UnprojectedPropertyError as UnprojectedPropertyError, + User as User, + UserNotFoundError as UserNotFoundError, + UserProperty as UserProperty, + delete_multi as delete_multi, + delete_multi_async as delete_multi_async, + get_indexes as get_indexes, + get_indexes_async as get_indexes_async, + get_multi as get_multi, + get_multi_async as get_multi_async, + make_connection as make_connection, + put_multi as put_multi, + put_multi_async as put_multi_async, +) +from google.cloud.ndb.polymodel import PolyModel as PolyModel +from google.cloud.ndb.query import ( + AND as AND, + OR as OR, + ConjunctionNode as ConjunctionNode, + DisjunctionNode as DisjunctionNode, + FalseNode as FalseNode, + FilterNode as FilterNode, + Node as Node, + Parameter as Parameter, + ParameterizedFunction as ParameterizedFunction, + ParameterizedThing as ParameterizedThing, + ParameterNode as ParameterNode, + PostFilterNode as PostFilterNode, + Query as Query, + QueryOptions as QueryOptions, + RepeatedStructuredPropertyPredicate as RepeatedStructuredPropertyPredicate, + gql as gql, +) +from google.cloud.ndb.tasklets import ( + Future as Future, + QueueFuture as QueueFuture, + ReducingFuture as ReducingFuture, + Return as Return, + SerialQueueFuture as SerialQueueFuture, + add_flow_exception as add_flow_exception, + make_context as make_context, + make_default_context as make_default_context, + set_context as set_context, + sleep as sleep, + synctasklet as synctasklet, + tasklet as tasklet, + toplevel as toplevel, + wait_all as wait_all, + wait_any as wait_any, +) diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_batch.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_batch.pyi new file mode 100644 index 0000000..0f50383 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_batch.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def get_batch(batch_cls, options: Any | None = ...): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_cache.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_cache.pyi new file mode 100644 index 0000000..e54eb54 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_cache.pyi @@ -0,0 +1,72 @@ +from typing import Any + +from google.cloud.ndb import tasklets as tasklets + +class ContextCache: + def get_and_validate(self, key): ... + +class _GlobalCacheBatch: + def full(self): ... + def idle_callback(self) -> None: ... + def done_callback(self, cache_call) -> None: ... + def make_call(self) -> None: ... + def future_info(self, key) -> None: ... + +global_get: Any + +class _GlobalCacheGetBatch(_GlobalCacheBatch): + todo: Any + keys: Any + def __init__(self, ignore_options) -> None: ... + def add(self, key): ... + def done_callback(self, cache_call) -> None: ... + def make_call(self): ... + def future_info(self, key): ... + +def global_set(key, value, expires: Any | None = ..., read: bool = ...): ... + +class _GlobalCacheSetBatch(_GlobalCacheBatch): + expires: Any + todo: object + futures: object + def __init__(self, options) -> None: ... + def done_callback(self, cache_call) -> None: ... + def add(self, key, value): ... + def make_call(self): ... + def future_info(self, key, value): ... + +class _GlobalCacheSetIfNotExistsBatch(_GlobalCacheSetBatch): + def add(self, key, value): ... + def make_call(self): ... + def future_info(self, key, value): ... + +global_delete: Any + +class _GlobalCacheDeleteBatch(_GlobalCacheBatch): + keys: Any + futures: Any + def __init__(self, ignore_options) -> None: ... + def add(self, key): ... + def make_call(self): ... + def future_info(self, key): ... + +global_watch: Any + +class _GlobalCacheWatchBatch(_GlobalCacheDeleteBatch): + def make_call(self): ... + def future_info(self, key, value): ... + +def global_unwatch(key): ... + +class _GlobalCacheUnwatchBatch(_GlobalCacheDeleteBatch): + def make_call(self): ... + def future_info(self, key): ... + +global_compare_and_swap: Any + +class _GlobalCacheCompareAndSwapBatch(_GlobalCacheSetBatch): + def make_call(self): ... + def future_info(self, key, value): ... + +def is_locked_value(value): ... +def global_cache_key(key): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_datastore_api.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_datastore_api.pyi new file mode 100644 index 0000000..67b9641 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_datastore_api.pyi @@ -0,0 +1,5 @@ +from typing_extensions import Literal + +EVENTUAL: Literal[2] +EVENTUAL_CONSISTENCY: Literal[2] +STRONG: Literal[1] diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_datastore_query.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_datastore_query.pyi new file mode 100644 index 0000000..c199db4 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_datastore_query.pyi @@ -0,0 +1,22 @@ +from typing import Any + +class QueryIterator: + def __iter__(self): ... + def has_next(self) -> None: ... + def has_next_async(self) -> None: ... + def probably_has_next(self) -> None: ... + def next(self) -> None: ... + def cursor_before(self) -> None: ... + def cursor_after(self) -> None: ... + def index_list(self) -> None: ... + +class Cursor: + @classmethod + def from_websafe_string(cls, urlsafe): ... + cursor: Any + def __init__(self, cursor: Any | None = ..., urlsafe: Any | None = ...) -> None: ... + def to_websafe_string(self): ... + def urlsafe(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __hash__(self): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_eventloop.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_eventloop.pyi new file mode 100644 index 0000000..2c80cd3 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_eventloop.pyi @@ -0,0 +1,26 @@ +from typing import Any, NamedTuple + +class _Event(NamedTuple): + when: Any + callback: Any + args: Any + kwargs: Any + +class EventLoop: + current: Any + idlers: Any + inactive: int + queue: Any + rpcs: Any + rpc_results: Any + def __init__(self) -> None: ... + def clear(self) -> None: ... + def insort_event_right(self, event) -> None: ... + def call_soon(self, callback, *args, **kwargs) -> None: ... + def queue_call(self, delay, callback, *args, **kwargs) -> None: ... + def queue_rpc(self, rpc, callback) -> None: ... + def add_idle(self, callback, *args, **kwargs) -> None: ... + def run_idle(self): ... + def run0(self): ... + def run1(self): ... + def run(self) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_options.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_options.pyi new file mode 100644 index 0000000..bcdbe6d --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_options.pyi @@ -0,0 +1,15 @@ +from typing import Any + +class Options: + @classmethod + def options(cls, wrapped, _disambiguate_from_model_properties: bool = ...): ... + @classmethod + def slots(cls): ... + def __init__(self, config: Any | None = ..., **kwargs) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def copy(self, **kwargs): ... + def items(self) -> None: ... + +class ReadOptions(Options): + def __init__(self, config: Any | None = ..., **kwargs) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/_transaction.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/_transaction.pyi new file mode 100644 index 0000000..c3dc5a4 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/_transaction.pyi @@ -0,0 +1,18 @@ +from typing import Any + +def in_transaction(): ... +def transaction( + callback, retries=..., read_only: bool = ..., join: bool = ..., xg: bool = ..., propagation: Any | None = ... +): ... +def transaction_async( + callback, retries=..., read_only: bool = ..., join: bool = ..., xg: bool = ..., propagation: Any | None = ... +): ... +def transaction_async_( + callback, retries=..., read_only: bool = ..., join: bool = ..., xg: bool = ..., propagation: Any | None = ... +): ... +def transactional(retries=..., read_only: bool = ..., join: bool = ..., xg: bool = ..., propagation: Any | None = ...): ... +def transactional_async(retries=..., read_only: bool = ..., join: bool = ..., xg: bool = ..., propagation: Any | None = ...): ... +def transactional_tasklet( + retries=..., read_only: bool = ..., join: bool = ..., xg: bool = ..., propagation: Any | None = ... +): ... +def non_transactional(allow_existing: bool = ...): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/blobstore.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/blobstore.pyi new file mode 100644 index 0000000..acb002a --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/blobstore.pyi @@ -0,0 +1,65 @@ +from typing import Any + +from google.cloud.ndb import model + +BlobKey: Any +BLOB_INFO_KIND: str +BLOB_MIGRATION_KIND: str +BLOB_KEY_HEADER: str +BLOB_RANGE_HEADER: str +MAX_BLOB_FETCH_SIZE: int +UPLOAD_INFO_CREATION_HEADER: str +BlobKeyProperty = model.BlobKeyProperty + +class BlobFetchSizeTooLargeError: + def __init__(self, *args, **kwargs) -> None: ... + +class BlobInfo: + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def get(cls, *args, **kwargs) -> None: ... + @classmethod + def get_async(cls, *args, **kwargs) -> None: ... + @classmethod + def get_multi(cls, *args, **kwargs) -> None: ... + @classmethod + def get_multi_async(cls, *args, **kwargs) -> None: ... + +class BlobInfoParseError: + def __init__(self, *args, **kwargs) -> None: ... + +class BlobNotFoundError: + def __init__(self, *args, **kwargs) -> None: ... + +class BlobReader: + def __init__(self, *args, **kwargs) -> None: ... + +def create_upload_url(*args, **kwargs) -> None: ... +def create_upload_url_async(*args, **kwargs) -> None: ... + +class DataIndexOutOfRangeError: + def __init__(self, *args, **kwargs) -> None: ... + +def delete(*args, **kwargs) -> None: ... +def delete_async(*args, **kwargs) -> None: ... +def delete_multi(*args, **kwargs) -> None: ... +def delete_multi_async(*args, **kwargs) -> None: ... + +class Error: + def __init__(self, *args, **kwargs) -> None: ... + +def fetch_data(*args, **kwargs) -> None: ... +def fetch_data_async(*args, **kwargs) -> None: ... + +get: Any +get_async: Any +get_multi: Any +get_multi_async: Any + +class InternalError: + def __init__(self, *args, **kwargs) -> None: ... + +def parse_blob_info(*args, **kwargs) -> None: ... + +class PermissionDeniedError: + def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/client.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/client.pyi new file mode 100644 index 0000000..207673e --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/client.pyi @@ -0,0 +1,21 @@ +from typing import Any + +DATASTORE_API_HOST: Any + +class Client: + SCOPE: Any + namespace: Any + host: Any + client_info: Any + secure: Any + stub: Any + def __init__(self, project: Any | None = ..., namespace: Any | None = ..., credentials: Any | None = ...) -> None: ... + def context( + self, + namespace=..., + cache_policy: Any | None = ..., + global_cache: Any | None = ..., + global_cache_policy: Any | None = ..., + global_cache_timeout_policy: Any | None = ..., + legacy_data: bool = ..., + ) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi new file mode 100644 index 0000000..3f54d9a --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/context.pyi @@ -0,0 +1,109 @@ +from collections.abc import Callable +from typing import Any, NamedTuple + +from google.cloud.ndb import Key, exceptions as exceptions + +class _LocalState: + def __init__(self) -> None: ... + @property + def context(self): ... + @context.setter + def context(self, value) -> None: ... + @property + def toplevel_context(self): ... + @toplevel_context.setter + def toplevel_context(self, value) -> None: ... + +def get_context(raise_context_error: bool = ...): ... +def get_toplevel_context(raise_context_error: bool = ...): ... + +class _ContextTuple(NamedTuple): + id: Any + client: Any + namespace: Any + eventloop: Any + batches: Any + commit_batches: Any + transaction: Any + cache: Any + global_cache: Any + on_commit_callbacks: Any + transaction_complete_callbacks: Any + legacy_data: Any + +class _Context(_ContextTuple): + def __new__( + cls, + client, + id: Any | None = ..., + namespace=..., + eventloop: Any | None = ..., + batches: Any | None = ..., + commit_batches: Any | None = ..., + transaction: Any | None = ..., + cache: Any | None = ..., + cache_policy: Any | None = ..., + global_cache: Any | None = ..., + global_cache_policy: Callable[[Key], bool] | None = ..., + global_cache_timeout_policy: Any | None = ..., + datastore_policy: Any | None = ..., + on_commit_callbacks: Any | None = ..., + transaction_complete_callbacks: Any | None = ..., + legacy_data: bool = ..., + retry: Any | None = ..., + rpc_time: Any | None = ..., + wait_time: Any | None = ..., + ): ... + def new(self, **kwargs): ... + rpc_time: int + wait_time: int + def use(self) -> None: ... + +class Context(_Context): + def clear_cache(self) -> None: ... + def flush(self) -> None: ... + def get_namespace(self): ... + def get_cache_policy(self): ... + def get_datastore_policy(self) -> None: ... + def get_global_cache_policy(self): ... + get_memcache_policy: Any + def get_global_cache_timeout_policy(self): ... + get_memcache_timeout_policy: Any + cache_policy: Any + def set_cache_policy(self, policy): ... + datastore_policy: Any + def set_datastore_policy(self, policy): ... + global_cache_policy: Any + def set_global_cache_policy(self, policy): ... + set_memcache_policy: Any + global_cache_timeout_policy: Any + def set_global_cache_timeout_policy(self, policy): ... + set_memcache_timeout_policy: Any + def get_retry_state(self): ... + def set_retry_state(self, state) -> None: ... + def clear_retry_state(self) -> None: ... + def call_on_commit(self, callback) -> None: ... + def in_transaction(self): ... + def in_retry(self): ... + def memcache_add(self, *args, **kwargs) -> None: ... + def memcache_cas(self, *args, **kwargs) -> None: ... + def memcache_decr(self, *args, **kwargs) -> None: ... + def memcache_delete(self, *args, **kwargs) -> None: ... + def memcache_get(self, *args, **kwargs) -> None: ... + def memcache_gets(self, *args, **kwargs) -> None: ... + def memcache_incr(self, *args, **kwargs) -> None: ... + def memcache_replace(self, *args, **kwargs) -> None: ... + def memcache_set(self, *args, **kwargs) -> None: ... + def urlfetch(self, *args, **kwargs) -> None: ... + +class ContextOptions: + def __init__(self, *args, **kwargs) -> None: ... + +class TransactionOptions: + NESTED: int + MANDATORY: int + ALLOWED: int + INDEPENDENT: int + +class AutoBatcher: + def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/django_middleware.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/django_middleware.pyi new file mode 100644 index 0000000..8d4c846 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/django_middleware.pyi @@ -0,0 +1,2 @@ +class NdbDjangoMiddleware: + def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/exceptions.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/exceptions.pyi new file mode 100644 index 0000000..ab5a3a0 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/exceptions.pyi @@ -0,0 +1,22 @@ +from typing import Any + +class Error(Exception): ... + +class ContextError(Error): + def __init__(self) -> None: ... + +class BadValueError(Error): ... +class BadArgumentError(Error): ... +class BadRequestError(Error): ... +class Rollback(Error): ... +class BadQueryError(Error): ... + +class BadFilterError(Error): + filter: Any + def __init__(self, filter) -> None: ... + +class NoLongerImplementedError(NotImplementedError): + def __init__(self) -> None: ... + +class Cancelled(Error): ... +class NestedRetryException(Error): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi new file mode 100644 index 0000000..5bc4170 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi @@ -0,0 +1,78 @@ +import abc +from _typeshed import Self +from typing import Any + +ConnectionError: Any + +class GlobalCache(metaclass=abc.ABCMeta): + __metaclass__: Any + transient_errors: Any + strict_read: bool + strict_write: bool + @abc.abstractmethod + def get(self, keys): ... + @abc.abstractmethod + def set(self, items, expires: Any | None = ...): ... + @abc.abstractmethod + def delete(self, keys): ... + @abc.abstractmethod + def watch(self, items): ... + @abc.abstractmethod + def unwatch(self, keys): ... + @abc.abstractmethod + def compare_and_swap(self, items, expires: Any | None = ...): ... + @abc.abstractmethod + def clear(self): ... + +class _InProcessGlobalCache(GlobalCache): + cache: Any + def __init__(self) -> None: ... + def get(self, keys): ... + def set(self, items, expires: Any | None = ...) -> None: ... + def delete(self, keys) -> None: ... + def watch(self, items) -> None: ... + def unwatch(self, keys) -> None: ... + def compare_and_swap(self, items, expires: Any | None = ...): ... + def clear(self) -> None: ... + +class RedisCache(GlobalCache): + transient_errors: Any + @classmethod + def from_environment(cls: type[Self], strict_read: bool = ..., strict_write: bool = ...) -> Self: ... + redis: Any + strict_read: Any + strict_write: Any + def __init__(self, redis, strict_read: bool = ..., strict_write: bool = ...) -> None: ... + @property + def pipes(self): ... + def get(self, keys): ... + def set(self, items, expires: Any | None = ...) -> None: ... + def delete(self, keys) -> None: ... + def watch(self, items) -> None: ... + def unwatch(self, keys) -> None: ... + def compare_and_swap(self, items, expires: Any | None = ...): ... + def clear(self) -> None: ... + +class MemcacheCache(GlobalCache): + class KeyNotSet(Exception): + key: Any + def __init__(self, key) -> None: ... + def __eq__(self, other): ... + transient_errors: Any + @classmethod + def from_environment( + cls: type[Self], max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ... + ) -> Self: ... + client: Any + strict_read: Any + strict_write: Any + def __init__(self, client, strict_read: bool = ..., strict_write: bool = ...) -> None: ... + @property + def caskeys(self): ... + def get(self, keys): ... + def set(self, items, expires: Any | None = ...): ... + def delete(self, keys) -> None: ... + def watch(self, items) -> None: ... + def unwatch(self, keys) -> None: ... + def compare_and_swap(self, items, expires: Any | None = ...): ... + def clear(self) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/key.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/key.pyi new file mode 100644 index 0000000..6a9896e --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/key.pyi @@ -0,0 +1,98 @@ +from typing import Any + +UNDEFINED: Any + +class Key: + def __new__(cls, *path_args, **kwargs): ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __lt__(self, other): ... + def __le__(self, other): ... + def __gt__(self, other): ... + def __ge__(self, other): ... + def __getnewargs__(self): ... + def parent(self): ... + def root(self): ... + def namespace(self): ... + def project(self): ... + app: Any + def id(self): ... + def string_id(self): ... + def integer_id(self): ... + def pairs(self): ... + def flat(self): ... + def kind(self): ... + def reference(self): ... + def serialized(self): ... + def urlsafe(self): ... + def to_legacy_urlsafe(self, location_prefix): ... + def get( + self, + read_consistency: Any | None = ..., + read_policy: Any | None = ..., + transaction: Any | None = ..., + retries: Any | None = ..., + timeout: Any | None = ..., + deadline: Any | None = ..., + use_cache: Any | None = ..., + use_global_cache: Any | None = ..., + use_datastore: Any | None = ..., + global_cache_timeout: Any | None = ..., + use_memcache: Any | None = ..., + memcache_timeout: Any | None = ..., + max_memcache_items: Any | None = ..., + force_writes: Any | None = ..., + _options: Any | None = ..., + ): ... + def get_async( + self, + read_consistency: Any | None = ..., + read_policy: Any | None = ..., + transaction: Any | None = ..., + retries: Any | None = ..., + timeout: Any | None = ..., + deadline: Any | None = ..., + use_cache: Any | None = ..., + use_global_cache: Any | None = ..., + use_datastore: Any | None = ..., + global_cache_timeout: Any | None = ..., + use_memcache: Any | None = ..., + memcache_timeout: Any | None = ..., + max_memcache_items: Any | None = ..., + force_writes: Any | None = ..., + _options: Any | None = ..., + ): ... + def delete( + self, + retries: Any | None = ..., + timeout: Any | None = ..., + deadline: Any | None = ..., + use_cache: Any | None = ..., + use_global_cache: Any | None = ..., + use_datastore: Any | None = ..., + global_cache_timeout: Any | None = ..., + use_memcache: Any | None = ..., + memcache_timeout: Any | None = ..., + max_memcache_items: Any | None = ..., + force_writes: Any | None = ..., + _options: Any | None = ..., + ): ... + def delete_async( + self, + retries: Any | None = ..., + timeout: Any | None = ..., + deadline: Any | None = ..., + use_cache: Any | None = ..., + use_global_cache: Any | None = ..., + use_datastore: Any | None = ..., + global_cache_timeout: Any | None = ..., + use_memcache: Any | None = ..., + memcache_timeout: Any | None = ..., + max_memcache_items: Any | None = ..., + force_writes: Any | None = ..., + _options: Any | None = ..., + ): ... + @classmethod + def from_old_key(cls, old_key) -> None: ... + def to_old_key(self) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/metadata.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/metadata.pyi new file mode 100644 index 0000000..6c8d339 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/metadata.pyi @@ -0,0 +1,51 @@ +from typing import Any + +from google.cloud.ndb import model + +class _BaseMetadata(model.Model): + KIND_NAME: str + def __new__(cls, *args, **kwargs): ... + +class Namespace(_BaseMetadata): + KIND_NAME: str + EMPTY_NAMESPACE_ID: int + @property + def namespace_name(self): ... + @classmethod + def key_for_namespace(cls, namespace): ... + @classmethod + def key_to_namespace(cls, key): ... + +class Kind(_BaseMetadata): + KIND_NAME: str + @property + def kind_name(self): ... + @classmethod + def key_for_kind(cls, kind): ... + @classmethod + def key_to_kind(cls, key): ... + +class Property(_BaseMetadata): + KIND_NAME: str + @property + def property_name(self): ... + @property + def kind_name(self): ... + property_representation: Any + @classmethod + def key_for_kind(cls, kind): ... + @classmethod + def key_for_property(cls, kind, property): ... + @classmethod + def key_to_kind(cls, key): ... + @classmethod + def key_to_property(cls, key): ... + +class EntityGroup: + def __new__(cls, *args, **kwargs): ... + +def get_entity_group_version(*args, **kwargs) -> None: ... +def get_kinds(start: Any | None = ..., end: Any | None = ...): ... +def get_namespaces(start: Any | None = ..., end: Any | None = ...): ... +def get_properties_of_kind(kind, start: Any | None = ..., end: Any | None = ...): ... +def get_representations_of_kind(kind, start: Any | None = ..., end: Any | None = ...): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi new file mode 100644 index 0000000..2f77041 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi @@ -0,0 +1,508 @@ +import datetime +from _typeshed import Self +from collections.abc import Callable, Iterable, Sequence +from typing import Any, NoReturn +from typing_extensions import Literal, TypeAlias + +from google.cloud.ndb import exceptions, key as key_module, query as query_module, tasklets as tasklets_module + +Key = key_module.Key +Rollback = exceptions.Rollback +BlobKey: object +GeoPt: object + +class KindError(exceptions.BadValueError): ... +class InvalidPropertyError(exceptions.Error): ... + +BadProjectionError = InvalidPropertyError + +class UnprojectedPropertyError(exceptions.Error): ... +class ReadonlyPropertyError(exceptions.Error): ... +class ComputedPropertyError(ReadonlyPropertyError): ... +class UserNotFoundError(exceptions.Error): ... + +class _NotEqualMixin: + def __ne__(self, other: object) -> bool: ... + +_Direction: TypeAlias = Literal["asc", "desc"] + +class IndexProperty(_NotEqualMixin): + def __new__(cls: type[Self], name: str, direction: _Direction) -> Self: ... + @property + def name(self) -> str: ... + @property + def direction(self) -> _Direction: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + +class Index(_NotEqualMixin): + def __new__(cls: type[Self], kind: str, properties: list[IndexProperty], ancestor: bool) -> Self: ... + @property + def kind(self) -> str: ... + @property + def properties(self) -> list[IndexProperty]: ... + @property + def ancestor(self) -> bool: ... + def __eq__(self, other) -> bool: ... + def __hash__(self) -> int: ... + +class IndexState(_NotEqualMixin): + def __new__(cls, definition, state, id): ... + @property + def definition(self): ... + @property + def state(self): ... + @property + def id(self): ... + def __eq__(self, other) -> bool: ... + def __hash__(self) -> int: ... + +class ModelAdapter: + # This actually returns NoReturn, but mypy can't handle that + def __new__(cls: type[Self], *args, **kwargs) -> Self: ... + +def make_connection(*args, **kwargs) -> NoReturn: ... + +class ModelAttribute: ... + +class _BaseValue(_NotEqualMixin): + b_val: object = ... + def __init__(self, b_val) -> None: ... + def __eq__(self, other) -> bool: ... + def __hash__(self) -> int: ... + +class Property(ModelAttribute): + def __init__( + self, + name: str | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + required: bool | None = ..., + default: object | None = ..., + choices: Iterable[object] | None = ..., + validator: Callable[[Property, Any], object] | None = ..., + verbose_name: str | None = ..., + write_empty_list: bool | None = ..., + ) -> None: ... + def __eq__(self, value: object) -> query_module.FilterNode: ... # type: ignore[override] + def __ne__(self, value: object) -> query_module.FilterNode: ... # type: ignore[override] + def __lt__(self, value: object) -> query_module.FilterNode: ... + def __le__(self, value: object) -> query_module.FilterNode: ... + def __gt__(self, value: object) -> query_module.FilterNode: ... + def __ge__(self, value: object) -> query_module.FilterNode: ... + def IN(self, value: Iterable[object]) -> query_module.DisjunctionNode | query_module.FilterNode | query_module.FalseNode: ... + def __neg__(self) -> query_module.PropertyOrder: ... + def __pos__(self) -> query_module.PropertyOrder: ... + def __set__(self, entity: Model, value: object) -> None: ... + def __delete__(self, entity: Model) -> None: ... + +class ModelKey(Property): + def __init__(self) -> None: ... + def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> key_module.Key | list[key_module.Key] | None: ... + +class BooleanProperty(Property): + def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> bool | list[bool] | None: ... + +class IntegerProperty(Property): + def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> int | list[int] | None: ... + +class FloatProperty(Property): + def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> float | list[float] | None: ... + +class _CompressedValue(bytes): + z_val: bytes = ... + def __init__(self, z_val: bytes) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> NoReturn: ... + +class BlobProperty(Property): + def __init__( + self, + name: str | None = ..., + compressed: bool | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + required: bool | None = ..., + default: bytes | None = ..., + choices: Iterable[bytes] | None = ..., + validator: Callable[[Property, Any], object] | None = ..., + verbose_name: str | None = ..., + write_empty_list: bool | None = ..., + ) -> None: ... + def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> bytes | list[bytes] | None: ... + +class CompressedTextProperty(BlobProperty): + def __init__(self, *args, **kwargs) -> None: ... + +class TextProperty(Property): + def __new__(cls, *args, **kwargs): ... + def __init__(self, *args, **kwargs) -> None: ... + def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> str | list[str] | None: ... + +class StringProperty(TextProperty): + def __init__(self, *args, **kwargs) -> None: ... + +class GeoPtProperty(Property): ... +class PickleProperty(BlobProperty): ... + +class JsonProperty(BlobProperty): + def __init__( + self, + name: str | None = ..., + compressed: bool | None = ..., + json_type: type | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + required: bool | None = ..., + default: object | None = ..., + choices: Iterable[object] | None = ..., + validator: Callable[[Property, Any], object] | None = ..., + verbose_name: str | None = ..., + write_empty_list: bool | None = ..., + ) -> None: ... + +class User: + def __init__(self, email: str | None = ..., _auth_domain: str | None = ..., _user_id: str | None = ...) -> None: ... + def nickname(self) -> str: ... + def email(self): ... + def user_id(self) -> str | None: ... + def auth_domain(self) -> str: ... + def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: object) -> bool: ... + +class UserProperty(Property): + def __init__( + self, + name: str | None = ..., + auto_current_user: bool | None = ..., + auto_current_user_add: bool | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + required: bool | None = ..., + default: bytes | None = ..., + choices: Iterable[bytes] | None = ..., + validator: Callable[[Property, Any], object] | None = ..., + verbose_name: str | None = ..., + write_empty_list: bool | None = ..., + ) -> None: ... + +class KeyProperty(Property): + def __init__( + self, + name: str | None = ..., + kind: type[Model] | str | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + required: bool | None = ..., + default: key_module.Key | None = ..., + choices: Iterable[key_module.Key] | None = ..., + validator: Callable[[Property, key_module.Key], key_module.Key] | None = ..., + verbose_name: str | None = ..., + write_empty_list: bool | None = ..., + ) -> None: ... + +class BlobKeyProperty(Property): ... + +class DateTimeProperty(Property): + def __init__( + self, + name: str | None = ..., + auto_now: bool | None = ..., + auto_now_add: bool | None = ..., + tzinfo: datetime.tzinfo | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + required: bool | None = ..., + default: datetime.datetime | None = ..., + choices: Iterable[datetime.datetime] | None = ..., + validator: Callable[[Property, Any], object] | None = ..., + verbose_name: str | None = ..., + write_empty_list: bool | None = ..., + ) -> None: ... + +class DateProperty(DateTimeProperty): ... +class TimeProperty(DateTimeProperty): ... + +class StructuredProperty(Property): + def __init__(self, model_class: type, name: str | None = ..., **kwargs) -> None: ... + def __getattr__(self, attrname): ... + def IN(self, value: Iterable[object]) -> query_module.DisjunctionNode | query_module.FalseNode: ... + +class LocalStructuredProperty(BlobProperty): + def __init__(self, model_class: type[Model], **kwargs) -> None: ... + +class GenericProperty(Property): + def __init__(self, name: str | None = ..., compressed: bool = ..., **kwargs) -> None: ... + +class ComputedProperty(GenericProperty): + def __init__( + self, + func: Callable[[Model], object], + name: str | None = ..., + indexed: bool | None = ..., + repeated: bool | None = ..., + verbose_name: str | None = ..., + ) -> None: ... + +class MetaModel(type): + def __init__(cls, name: str, bases, classdict) -> None: ... + +class Model(_NotEqualMixin, metaclass=MetaModel): + key: ModelKey = ... + def __init__(_self, **kwargs) -> None: ... + def __hash__(self) -> NoReturn: ... + def __eq__(self, other: object) -> bool: ... + @classmethod + def gql(cls: type[Model], query_string: str, *args, **kwargs) -> query_module.Query: ... + def put(self, **kwargs): ... + def put_async(self, **kwargs) -> tasklets_module.Future: ... + @classmethod + def query(cls: type[Model], *args, **kwargs) -> query_module.Query: ... + @classmethod + def allocate_ids( + cls: type[Model], + size: int | None = ..., + max: int | None = ..., + parent: key_module.Key | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options=..., + ) -> tuple[key_module.Key, key_module.Key]: ... + @classmethod + def allocate_ids_async( + cls: type[Model], + size: int | None = ..., + max: int | None = ..., + parent: key_module.Key | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options=..., + ) -> tasklets_module.Future: ... + @classmethod + def get_by_id( + cls: type[Model], + id: int | str | None, + parent: key_module.Key | None = ..., + namespace: str | None = ..., + project: str | None = ..., + app: str | None = ..., + read_consistency: Literal["EVENTUAL"] | None = ..., + read_policy: Literal["EVENTUAL"] | None = ..., + transaction: bytes | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options=..., + ) -> Model | None: ... + @classmethod + def get_by_id_async( + cls: type[Model], + id: int | str, + parent: key_module.Key | None = ..., + namespace: str | None = ..., + project: str | None = ..., + app: str | None = ..., + read_consistency: Literal["EVENTUAL"] | None = ..., + read_policy: Literal["EVENTUAL"] | None = ..., + transaction: bytes | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options=..., + ) -> tasklets_module.Future: ... + @classmethod + def get_or_insert( + cls: type[Model], + _name: str, + parent: key_module.Key | None = ..., + namespace: str | None = ..., + project: str | None = ..., + app: str | None = ..., + read_consistency: Literal["EVENTUAL"] | None = ..., + read_policy: Literal["EVENTUAL"] | None = ..., + transaction: bytes | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options=..., + **kw_model_args, + ) -> Model: ... + @classmethod + def get_or_insert_async( + cls: type[Model], + _name: str, + parent: key_module.Key | None = ..., + namespace: str | None = ..., + project: str | None = ..., + app: str | None = ..., + read_consistency: Literal["EVENTUAL"] | None = ..., + read_policy: Literal["EVENTUAL"] | None = ..., + transaction: bytes | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options=..., + **kw_model_args, + ) -> tasklets_module.Future: ... + def populate(self, **kwargs) -> None: ... + def has_complete_key(self) -> bool: ... + def to_dict( + self, + include: list[object] | tuple[object, object] | set[object] | None = ..., + exclude: list[object] | tuple[object, object] | set[object] | None = ..., + ): ... + +class Expando(Model): + def __getattr__(self, name: str): ... + def __setattr__(self, name: str, value) -> None: ... + def __delattr__(self, name: str) -> None: ... + +def get_multi_async( + keys: Sequence[type[key_module.Key]], + read_consistency: Literal["EVENTUAL"] | None = ..., + read_policy: Literal["EVENTUAL"] | None = ..., + transaction: bytes | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options: object | None = ..., +) -> list[type[tasklets_module.Future]]: ... +def get_multi( + keys: Sequence[type[key_module.Key]], + read_consistency: Literal["EVENTUAL"] | None = ..., + read_policy: Literal["EVENTUAL"] | None = ..., + transaction: bytes | None = ..., + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options: object | None = ..., +) -> list[type[Model] | None]: ... +def put_multi_async( + entities: list[type[Model]], + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options: object | None = ..., +) -> list[tasklets_module.Future]: ... +def put_multi( + entities: list[Model], + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options: object | None = ..., +) -> list[key_module.Key]: ... +def delete_multi_async( + keys: list[key_module.Key], + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options: object | None = ..., +) -> list[tasklets_module.Future]: ... +def delete_multi( + keys: Sequence[key_module.Key], + retries: int | None = ..., + timeout: float | None = ..., + deadline: float | None = ..., + use_cache: bool | None = ..., + use_global_cache: bool | None = ..., + global_cache_timeout: int | None = ..., + use_datastore: bool | None = ..., + use_memcache: bool | None = ..., + memcache_timeout: int | None = ..., + max_memcache_items: int | None = ..., + force_writes: bool | None = ..., + _options: object | None = ..., +) -> list[None]: ... +def get_indexes_async(**options: object) -> NoReturn: ... +def get_indexes(**options: object) -> NoReturn: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/msgprop.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/msgprop.pyi new file mode 100644 index 0000000..2bb3e67 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/msgprop.pyi @@ -0,0 +1,5 @@ +class EnumProperty: + def __init__(self, *args, **kwargs) -> None: ... + +class MessageProperty: + def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/polymodel.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/polymodel.pyi new file mode 100644 index 0000000..43cabd2 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/polymodel.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from google.cloud.ndb import model + +class _ClassKeyProperty(model.StringProperty): + def __init__(self, name=..., indexed: bool = ...) -> None: ... + +class PolyModel(model.Model): + class_: Any diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/query.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/query.pyi new file mode 100644 index 0000000..6ca3d6f --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/query.pyi @@ -0,0 +1,146 @@ +from typing import Any + +from google.cloud.ndb import _options + +class PropertyOrder: + name: Any + reverse: Any + def __init__(self, name, reverse: bool = ...) -> None: ... + def __neg__(self): ... + +class RepeatedStructuredPropertyPredicate: + name: Any + match_keys: Any + match_values: Any + def __init__(self, name, match_keys, entity_pb) -> None: ... + def __call__(self, entity_pb): ... + +class ParameterizedThing: + def __eq__(self, other): ... + def __ne__(self, other): ... + +class Parameter(ParameterizedThing): + def __init__(self, key) -> None: ... + def __eq__(self, other): ... + @property + def key(self): ... + def resolve(self, bindings, used): ... + +class ParameterizedFunction(ParameterizedThing): + func: Any + values: Any + def __init__(self, func, values) -> None: ... + def __eq__(self, other): ... + def is_parameterized(self): ... + def resolve(self, bindings, used): ... + +class Node: + def __new__(cls): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __le__(self, unused_other): ... + def __lt__(self, unused_other): ... + def __ge__(self, unused_other): ... + def __gt__(self, unused_other): ... + def resolve(self, bindings, used): ... + +class FalseNode(Node): + def __eq__(self, other): ... + +class ParameterNode(Node): + def __new__(cls, prop, op, param): ... + def __getnewargs__(self): ... + def __eq__(self, other): ... + def resolve(self, bindings, used): ... + +class FilterNode(Node): + def __new__(cls, name, opsymbol, value): ... + def __getnewargs__(self): ... + def __eq__(self, other): ... + +class PostFilterNode(Node): + def __new__(cls, predicate): ... + def __getnewargs__(self): ... + def __eq__(self, other): ... + +class _BooleanClauses: + name: Any + combine_or: Any + or_parts: Any + def __init__(self, name, combine_or) -> None: ... + def add_node(self, node) -> None: ... + +class ConjunctionNode(Node): + def __new__(cls, *nodes): ... + def __getnewargs__(self): ... + def __iter__(self): ... + def __eq__(self, other): ... + def resolve(self, bindings, used): ... + +class DisjunctionNode(Node): + def __new__(cls, *nodes): ... + def __getnewargs__(self): ... + def __iter__(self): ... + def __eq__(self, other): ... + def resolve(self, bindings, used): ... + +AND = ConjunctionNode +OR = DisjunctionNode + +class QueryOptions(_options.ReadOptions): + project: Any + namespace: Any + def __init__(self, config: Any | None = ..., context: Any | None = ..., **kwargs) -> None: ... + +class Query: + default_options: Any + kind: Any + ancestor: Any + filters: Any + order_by: Any + project: Any + namespace: Any + limit: Any + offset: Any + keys_only: Any + projection: Any + distinct_on: Any + def __init__( + self, + kind: Any | None = ..., + filters: Any | None = ..., + ancestor: Any | None = ..., + order_by: Any | None = ..., + orders: Any | None = ..., + project: Any | None = ..., + app: Any | None = ..., + namespace: Any | None = ..., + projection: Any | None = ..., + distinct_on: Any | None = ..., + group_by: Any | None = ..., + limit: Any | None = ..., + offset: Any | None = ..., + keys_only: Any | None = ..., + default_options: Any | None = ..., + ) -> None: ... + @property + def is_distinct(self): ... + def filter(self, *filters): ... + def order(self, *props): ... + def analyze(self): ... + def bind(self, *positional, **keyword): ... + def fetch(self, limit: Any | None = ..., **kwargs): ... + def fetch_async(self, limit: Any | None = ..., **kwargs): ... + def run_to_queue(self, queue, conn, options: Any | None = ..., dsquery: Any | None = ...) -> None: ... + def iter(self, **kwargs): ... + __iter__: Any + def map(self, callback, **kwargs): ... + def map_async(self, callback, **kwargs) -> None: ... + def get(self, **kwargs): ... + def get_async(self, **kwargs) -> None: ... + def count(self, limit: Any | None = ..., **kwargs): ... + def count_async(self, limit: Any | None = ..., **kwargs): ... + def fetch_page(self, page_size, **kwargs): ... + def fetch_page_async(self, page_size, **kwargs) -> None: ... + +def gql(query_string: str, *args: Any, **kwds: Any) -> Query: ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/stats.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/stats.pyi new file mode 100644 index 0000000..1ffa02f --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/stats.pyi @@ -0,0 +1,102 @@ +from typing import Any + +from google.cloud.ndb import model + +class BaseStatistic(model.Model): + STORED_KIND_NAME: str + bytes: Any + count: Any + timestamp: Any + +class BaseKindStatistic(BaseStatistic): + STORED_KIND_NAME: str + kind_name: Any + entity_bytes: Any + +class GlobalStat(BaseStatistic): + STORED_KIND_NAME: str + entity_bytes: Any + builtin_index_bytes: Any + builtin_index_count: Any + composite_index_bytes: Any + composite_index_count: Any + +class NamespaceStat(BaseStatistic): + STORED_KIND_NAME: str + subject_namespace: Any + entity_bytes: Any + builtin_index_bytes: Any + builtin_index_count: Any + composite_index_bytes: Any + composite_index_count: Any + +class KindStat(BaseKindStatistic): + STORED_KIND_NAME: str + builtin_index_bytes: Any + builtin_index_count: Any + composite_index_bytes: Any + composite_index_count: Any + +class KindRootEntityStat(BaseKindStatistic): + STORED_KIND_NAME: str + +class KindNonRootEntityStat(BaseKindStatistic): + STORED_KIND_NAME: str + +class PropertyTypeStat(BaseStatistic): + STORED_KIND_NAME: str + property_type: Any + entity_bytes: Any + builtin_index_bytes: Any + builtin_index_count: Any + +class KindPropertyTypeStat(BaseKindStatistic): + STORED_KIND_NAME: str + property_type: Any + builtin_index_bytes: Any + builtin_index_count: Any + +class KindPropertyNameStat(BaseKindStatistic): + STORED_KIND_NAME: str + property_name: Any + builtin_index_bytes: Any + builtin_index_count: Any + +class KindPropertyNamePropertyTypeStat(BaseKindStatistic): + STORED_KIND_NAME: str + property_type: Any + property_name: Any + builtin_index_bytes: Any + builtin_index_count: Any + +class KindCompositeIndexStat(BaseStatistic): + STORED_KIND_NAME: str + index_id: Any + kind_name: Any + +class NamespaceGlobalStat(GlobalStat): + STORED_KIND_NAME: str + +class NamespaceKindStat(KindStat): + STORED_KIND_NAME: str + +class NamespaceKindRootEntityStat(KindRootEntityStat): + STORED_KIND_NAME: str + +class NamespaceKindNonRootEntityStat(KindNonRootEntityStat): + STORED_KIND_NAME: str + +class NamespacePropertyTypeStat(PropertyTypeStat): + STORED_KIND_NAME: str + +class NamespaceKindPropertyTypeStat(KindPropertyTypeStat): + STORED_KIND_NAME: str + +class NamespaceKindPropertyNameStat(KindPropertyNameStat): + STORED_KIND_NAME: str + +class NamespaceKindPropertyNamePropertyTypeStat(KindPropertyNamePropertyTypeStat): + STORED_KIND_NAME: str + +class NamespaceKindCompositeIndexStat(KindCompositeIndexStat): + STORED_KIND_NAME: str diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/tasklets.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/tasklets.pyi new file mode 100644 index 0000000..4d9f34d --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/tasklets.pyi @@ -0,0 +1,58 @@ +from typing import Any + +class Future: + info: Any + def __init__(self, info: str = ...) -> None: ... + def done(self): ... + def running(self): ... + def wait(self) -> None: ... + def check_success(self) -> None: ... + def set_result(self, result) -> None: ... + def set_exception(self, exception) -> None: ... + def result(self): ... + get_result: Any + def exception(self): ... + get_exception: Any + def get_traceback(self): ... + def add_done_callback(self, callback) -> None: ... + def cancel(self) -> None: ... + def cancelled(self): ... + @staticmethod + def wait_any(futures): ... + @staticmethod + def wait_all(futures): ... + +class _TaskletFuture(Future): + generator: Any + context: Any + waiting_on: Any + def __init__(self, generator, context, info: str = ...) -> None: ... + def cancel(self) -> None: ... + +class _MultiFuture(Future): + def __init__(self, dependencies) -> None: ... + def cancel(self) -> None: ... + +def tasklet(wrapped): ... +def wait_any(futures): ... +def wait_all(futures) -> None: ... + +class Return(Exception): ... + +def sleep(seconds): ... +def add_flow_exception(*args, **kwargs) -> None: ... +def make_context(*args, **kwargs) -> None: ... +def make_default_context(*args, **kwargs) -> None: ... + +class QueueFuture: + def __init__(self, *args, **kwargs) -> None: ... + +class ReducingFuture: + def __init__(self, *args, **kwargs) -> None: ... + +class SerialQueueFuture: + def __init__(self, *args, **kwargs) -> None: ... + +def set_context(*args, **kwargs) -> None: ... +def synctasklet(wrapped): ... +def toplevel(wrapped): ... diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/utils.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/utils.pyi new file mode 100644 index 0000000..3ddb960 --- /dev/null +++ b/stubs/google-cloud-ndb/google/cloud/ndb/utils.pyi @@ -0,0 +1,28 @@ +import threading +from typing import Any + +TRUTHY_STRINGS: Any + +def asbool(value): ... + +DEBUG: Any + +def code_info(*args, **kwargs) -> None: ... +def decorator(*args, **kwargs) -> None: ... +def frame_info(*args, **kwargs) -> None: ... +def func_info(*args, **kwargs) -> None: ... +def gen_info(*args, **kwargs) -> None: ... +def get_stack(*args, **kwargs) -> None: ... +def logging_debug(log, message, *args, **kwargs) -> None: ... + +class keyword_only: + defaults: Any + def __init__(self, **kwargs) -> None: ... + def __call__(self, wrapped): ... + +def positional(max_pos_args): ... + +threading_local = threading.local + +def tweak_logging(*args, **kwargs) -> None: ... +def wrapping(*args, **kwargs) -> None: ... diff --git a/stubs/hdbcli/@tests/stubtest_allowlist.txt b/stubs/hdbcli/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..bb91851 --- /dev/null +++ b/stubs/hdbcli/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +# Are set to `None` by default, initialized later: +hdbcli.dbapi.Error.errorcode +hdbcli.dbapi.Error.errortext +hdbcli.dbapi.Warning.errorcode +hdbcli.dbapi.Warning.errortext +hdbcli.dbapi.ExecuteManyErrorEntry.rownumber diff --git a/stubs/hdbcli/METADATA.toml b/stubs/hdbcli/METADATA.toml new file mode 100644 index 0000000..60f63b3 --- /dev/null +++ b/stubs/hdbcli/METADATA.toml @@ -0,0 +1,4 @@ +version = "2.14.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/hdbcli/hdbcli/__init__.pyi b/stubs/hdbcli/hdbcli/__init__.pyi new file mode 100644 index 0000000..af0d55b --- /dev/null +++ b/stubs/hdbcli/hdbcli/__init__.pyi @@ -0,0 +1,3 @@ +from . import dbapi as dbapi + +__version__: str diff --git a/stubs/hdbcli/hdbcli/dbapi.pyi b/stubs/hdbcli/hdbcli/dbapi.pyi new file mode 100644 index 0000000..51216e8 --- /dev/null +++ b/stubs/hdbcli/hdbcli/dbapi.pyi @@ -0,0 +1,136 @@ +import decimal +from _typeshed import Incomplete, ReadableBuffer +from collections.abc import Sequence +from datetime import date, datetime, time +from types import TracebackType +from typing import Any, overload +from typing_extensions import Literal, TypeAlias + +from .resultrow import ResultRow + +apilevel: str +threadsafety: int +paramstyle: tuple[str, ...] +connect = Connection + +class Connection: + def __init__( + self, + address: str, + port: int, + username: str, + password: str, + autocommit: bool = ..., + packetsize: int | None = ..., + userkey: str | None = ..., + *, + sessionvariables: dict[str, str] | None = ..., + forcebulkfetch: bool | None = ..., + ) -> None: ... + def cancel(self) -> bool: ... + def close(self) -> None: ... + def commit(self) -> None: ... + def cursor(self) -> Cursor: ... + def getaddress(self) -> str: ... + def getautocommit(self) -> bool: ... + def getclientinfo(self, key: str = ...) -> str | dict[str, str]: ... + def getproperty(self, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def isconnected(self) -> bool: ... + def rollback(self) -> None: ... + def setautocommit(self, auto: bool = ...) -> None: ... + def setclientinfo(self, key: str, value: str | None = ...) -> None: ... + +class LOB: + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def close(self) -> bool: ... + def find(self, object: str, length: int, position: int = ...) -> int: ... + def read(self, size: int = ..., position: int = ...) -> str | bytes: ... + def write(self, object: str | bytes) -> int: ... + +_Parameters: TypeAlias = Sequence[tuple[Any, ...]] + +class Cursor: + description: tuple[tuple[Any, ...], ...] + rowcount: int + statementhash: str | None + connection: Connection + arraysize: int + refreshts: Incomplete + maxage: int + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __enter__(self) -> Incomplete: ... + def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... + def callproc(self, procname: str, parameters: tuple[Any, ...] = ..., overview: bool = ...) -> tuple[Any, ...]: ... + def close(self) -> None: ... + def description_ext(self) -> Sequence[tuple[Any, ...]]: ... + def execute(self, operation: str, parameters: tuple[Any, ...]) -> bool: ... + def executemany(self, operation: str, parameters: _Parameters) -> Any: ... + def executemanyprepared(self, parameters: _Parameters) -> Any: ... + def executeprepared(self, parameters: _Parameters = ...) -> Any: ... + def fetchone(self, uselob: bool = ...) -> ResultRow | None: ... + def fetchall(self) -> list[ResultRow]: ... + def fetchmany(self, size: int | None = ...) -> list[ResultRow]: ... + def getrowsaffectedcounts(self) -> tuple[Any, ...]: ... + def getpacketsize(self) -> int: ... + def get_resultset_holdability(self) -> int: ... + def getwarning(self) -> Warning | None: ... + def haswarning(self) -> bool: ... + def clearwarning(self) -> None: ... + def has_result_set(self) -> bool: ... + def nextset(self) -> None: ... + def parameter_description(self) -> tuple[str, ...]: ... + @overload + def prepare(self, operation: str, newcursor: Literal[True]) -> Cursor: ... + @overload + def prepare(self, operation: str, newcursor: Literal[False]) -> Any: ... + def print_message(self, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def parsenamedquery(self, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... + def scroll(self, value: int, mode: Literal["absolute", "relative"] = ...) -> None: ... + def server_cpu_time(self) -> int: ... + def server_memory_usage(self) -> int: ... + def server_processing_time(self) -> int: ... + def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ... + def setfetchsize(self, value: int) -> None: ... + def setquerytimeout(self, value: int) -> None: ... + def setpacketsize(self, value: int) -> None: ... + def set_resultset_holdability(self, holdability: int) -> None: ... + def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ... + +class Warning(Exception): + errorcode: int + errortext: str + +class Error(Exception): + errorcode: int + errortext: str + +class DatabaseError(Error): ... +class OperationalError(DatabaseError): ... +class ProgrammingError(DatabaseError): ... +class IntegrityError(DatabaseError): ... +class InterfaceError(Error): ... +class InternalError(DatabaseError): ... +class DataError(DatabaseError): ... +class NotSupportedError(DatabaseError): ... + +class ExecuteManyError(Error): + errors: Incomplete + +class ExecuteManyErrorEntry(Error): + rownumber: int + +def Date(year: int, month: int, day: int) -> date: ... +def Time(hour: int, minute: int, second: int, millisecond: int = ...) -> time: ... +def Timestamp(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int = ...) -> datetime: ... +def DateFromTicks(ticks: float) -> date: ... +def TimeFromTicks(ticks: float) -> time: ... +def TimestampFromTicks(ticks: float) -> datetime: ... +def Binary(data: ReadableBuffer) -> memoryview: ... + +Decimal = decimal.Decimal + +NUMBER: type[int] | type[float] | type[complex] +DATETIME: type[date] | type[time] | type[datetime] +STRING = str +BINARY = memoryview +ROWID = int diff --git a/stubs/hdbcli/hdbcli/resultrow.pyi b/stubs/hdbcli/hdbcli/resultrow.pyi new file mode 100644 index 0000000..cf0ee12 --- /dev/null +++ b/stubs/hdbcli/hdbcli/resultrow.pyi @@ -0,0 +1,6 @@ +from typing import Any + +class ResultRow: + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + column_names: tuple[str, ...] + column_values: tuple[Any, ...] diff --git a/stubs/html5lib/@tests/requirements-stubtest.txt b/stubs/html5lib/@tests/requirements-stubtest.txt deleted file mode 100644 index 0bf46c1..0000000 --- a/stubs/html5lib/@tests/requirements-stubtest.txt +++ /dev/null @@ -1,2 +0,0 @@ -genshi -lxml diff --git a/stubs/html5lib/@tests/stubtest_allowlist.txt b/stubs/html5lib/@tests/stubtest_allowlist.txt deleted file mode 100644 index fe34158..0000000 --- a/stubs/html5lib/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Misnamed first argument in implementation -html5lib._inputstream.EncodingBytes.__new__ diff --git a/stubs/html5lib/METADATA.toml b/stubs/html5lib/METADATA.toml index bad265e..ed85687 100644 --- a/stubs/html5lib/METADATA.toml +++ b/stubs/html5lib/METADATA.toml @@ -1 +1,4 @@ -version = "1.1" +version = "1.1.*" + +[tool.stubtest] +extras = ["all"] diff --git a/stubs/html5lib/html5lib/_inputstream.pyi b/stubs/html5lib/html5lib/_inputstream.pyi index ad08d35..0f58422 100644 --- a/stubs/html5lib/html5lib/_inputstream.pyi +++ b/stubs/html5lib/html5lib/_inputstream.pyi @@ -72,7 +72,7 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream): def detectEncodingMeta(self): ... class EncodingBytes(bytes): - def __new__(cls, value): ... + def __new__(self, value): ... def __init__(self, value) -> None: ... def __iter__(self): ... def __next__(self): ... @@ -82,7 +82,8 @@ class EncodingBytes(bytes): def getPosition(self): ... position: Any def getCurrentByte(self): ... - currentByte: Any + @property + def currentByte(self): ... def skip(self, chars=...): ... def skipUntil(self, chars): ... def matchBytes(self, bytes): ... diff --git a/stubs/html5lib/html5lib/_tokenizer.pyi b/stubs/html5lib/html5lib/_tokenizer.pyi index cf62e2c..22c4716 100644 --- a/stubs/html5lib/html5lib/_tokenizer.pyi +++ b/stubs/html5lib/html5lib/_tokenizer.pyi @@ -1,12 +1,7 @@ -import sys -from collections import OrderedDict -from typing import Any, Dict +from typing import Any entitiesTrie: Any -if sys.version_info >= (3, 7): - attributeMap = Dict[Any, Any] -else: - attributeMap = OrderedDict[Any, Any] +attributeMap = dict class HTMLTokenizer: stream: Any diff --git a/stubs/html5lib/html5lib/_utils.pyi b/stubs/html5lib/html5lib/_utils.pyi index c6f85f5..1ea9743 100644 --- a/stubs/html5lib/html5lib/_utils.pyi +++ b/stubs/html5lib/html5lib/_utils.pyi @@ -1,9 +1,9 @@ from collections.abc import Mapping -from typing import Any, Dict +from typing import Any supports_lone_surrogates: bool -class MethodDispatcher(Dict[Any, Any]): +class MethodDispatcher(dict[Any, Any]): default: Any def __init__(self, items=...) -> None: ... def __getitem__(self, key): ... diff --git a/stubs/html5lib/html5lib/treebuilders/base.pyi b/stubs/html5lib/html5lib/treebuilders/base.pyi index 12e89bb..8c73d52 100644 --- a/stubs/html5lib/html5lib/treebuilders/base.pyi +++ b/stubs/html5lib/html5lib/treebuilders/base.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any Marker: Any listElementsMap: Any @@ -18,7 +18,7 @@ class Node: def cloneNode(self) -> None: ... def hasContent(self) -> None: ... -class ActiveFormattingElements(List[Any]): +class ActiveFormattingElements(list[Any]): def append(self, node) -> None: ... def nodesEqual(self, node1, node2): ... diff --git a/stubs/html5lib/html5lib/treebuilders/etree_lxml.pyi b/stubs/html5lib/html5lib/treebuilders/etree_lxml.pyi index 1016b90..9a16c49 100644 --- a/stubs/html5lib/html5lib/treebuilders/etree_lxml.pyi +++ b/stubs/html5lib/html5lib/treebuilders/etree_lxml.pyi @@ -15,7 +15,8 @@ class DocumentType: class Document: def __init__(self) -> None: ... def appendChild(self, element) -> None: ... - childNodes: Any + @property + def childNodes(self): ... def testSerializer(element): ... def tostring(element): ... diff --git a/stubs/httplib2/METADATA.toml b/stubs/httplib2/METADATA.toml index 7918a43..e22598a 100644 --- a/stubs/httplib2/METADATA.toml +++ b/stubs/httplib2/METADATA.toml @@ -1 +1 @@ -version = "0.19" +version = "0.21.*" diff --git a/stubs/httplib2/httplib2/__init__.pyi b/stubs/httplib2/httplib2/__init__.pyi index 7813440..10249a1 100644 --- a/stubs/httplib2/httplib2/__init__.pyi +++ b/stubs/httplib2/httplib2/__init__.pyi @@ -1,12 +1,10 @@ import http.client +from _typeshed import Self from collections.abc import Generator -from typing import Any, Dict, TypeVar +from typing import Any from .error import * -# Should use _typeshed.Self when google/pytype#952 is fixed. -Self = TypeVar("Self") # noqa Y001 - __author__: str __copyright__: str __contributors__: list[str] @@ -79,8 +77,8 @@ class Credentials: def iter(self, domain) -> Generator[tuple[str, str], None, None]: ... class KeyCerts(Credentials): - def add(self, key, cert, domain, password) -> None: ... # type: ignore - def iter(self, domain) -> Generator[tuple[str, str, str], None, None]: ... # type: ignore + def add(self, key, cert, domain, password) -> None: ... # type: ignore[override] + def iter(self, domain) -> Generator[tuple[str, str, str], None, None]: ... # type: ignore[override] class AllHosts: ... @@ -175,7 +173,7 @@ class Http: connection_type: Any | None = ..., ): ... -class Response(Dict[str, Any]): +class Response(dict[str, Any]): fromcache: bool version: int status: int diff --git a/stubs/humanfriendly/METADATA.toml b/stubs/humanfriendly/METADATA.toml index 27a0042..5ed8ec6 100644 --- a/stubs/humanfriendly/METADATA.toml +++ b/stubs/humanfriendly/METADATA.toml @@ -1 +1 @@ -version = "9.2" +version = "10.0.*" diff --git a/stubs/humanfriendly/humanfriendly/__init__.pyi b/stubs/humanfriendly/humanfriendly/__init__.pyi index 1e68777..f906c2f 100644 --- a/stubs/humanfriendly/humanfriendly/__init__.pyi +++ b/stubs/humanfriendly/humanfriendly/__init__.pyi @@ -1,32 +1,35 @@ +import datetime +from re import Pattern +from types import TracebackType from typing import Any, NamedTuple class SizeUnit(NamedTuple): - divider: Any - symbol: Any - name: Any + divider: int + symbol: str + name: str class CombinedUnit(NamedTuple): - decimal: Any - binary: Any + decimal: SizeUnit + binary: SizeUnit disk_size_units: Any length_size_units: Any time_units: Any -def coerce_boolean(value): ... -def coerce_pattern(value, flags: int = ...): ... -def coerce_seconds(value): ... -def format_size(num_bytes, keep_width: bool = ..., binary: bool = ...): ... -def parse_size(size, binary: bool = ...): ... -def format_length(num_metres, keep_width: bool = ...): ... -def parse_length(length): ... -def format_number(number, num_decimals: int = ...): ... -def round_number(count, keep_width: bool = ...): ... -def format_timespan(num_seconds, detailed: bool = ..., max_units: int = ...): ... -def parse_timespan(timespan): ... -def parse_date(datestring): ... -def format_path(pathname): ... -def parse_path(pathname): ... +def coerce_boolean(value: object) -> bool: ... +def coerce_pattern(value: str | Pattern[str], flags: int = ...) -> Pattern[str]: ... +def coerce_seconds(value: float | datetime.timedelta) -> float: ... +def format_size(num_bytes: float, keep_width: bool = ..., binary: bool = ...) -> str: ... +def parse_size(size: str, binary: bool = ...) -> int: ... +def format_length(num_metres: float, keep_width: bool = ...) -> str: ... +def parse_length(length: str) -> float: ... +def format_number(number: float, num_decimals: int = ...) -> str: ... +def round_number(count: float, keep_width: bool = ...) -> str: ... +def format_timespan(num_seconds: float | datetime.timedelta, detailed: bool = ..., max_units: int = ...) -> str: ... +def parse_timespan(timespan: str) -> float: ... +def parse_date(datestring: str) -> tuple[int, int, int, int, int, int]: ... +def format_path(pathname: str) -> str: ... +def parse_path(pathname: str) -> str: ... class Timer: monotonic: bool @@ -35,8 +38,13 @@ class Timer: total_time: float def __init__(self, start_time: Any | None = ..., resumable: bool = ...) -> None: ... def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... - def sleep(self, seconds) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None = ..., + exc_value: BaseException | None = ..., + traceback: TracebackType | None = ..., + ) -> None: ... + def sleep(self, seconds: float) -> None: ... @property def elapsed_time(self): ... @property diff --git a/stubs/humanfriendly/humanfriendly/case.pyi b/stubs/humanfriendly/humanfriendly/case.pyi index b3e2767..57aea27 100644 --- a/stubs/humanfriendly/humanfriendly/case.pyi +++ b/stubs/humanfriendly/humanfriendly/case.pyi @@ -1,9 +1,12 @@ -import collections -from typing import Any +from collections import OrderedDict +from typing import Any, Generic, TypeVar from humanfriendly.compat import unicode -class CaseInsensitiveDict(collections.OrderedDict): +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + +class CaseInsensitiveDict(OrderedDict[_KT, _VT], Generic[_KT, _VT]): def __init__(self, other: Any | None = ..., **kw) -> None: ... def coerce_key(self, key): ... @classmethod @@ -11,7 +14,7 @@ class CaseInsensitiveDict(collections.OrderedDict): def get(self, key, default: Any | None = ...): ... def pop(self, key, default: Any | None = ...): ... def setdefault(self, key, default: Any | None = ...): ... - def update(self, other: Any | None = ..., **kw) -> None: ... # type: ignore + def update(self, other: Any | None = ..., **kw) -> None: ... # type: ignore[override] def __contains__(self, key): ... def __delitem__(self, key): ... def __getitem__(self, key): ... diff --git a/stubs/humanfriendly/humanfriendly/compat.pyi b/stubs/humanfriendly/humanfriendly/compat.pyi index 431dc34..c0f1971 100644 --- a/stubs/humanfriendly/humanfriendly/compat.pyi +++ b/stubs/humanfriendly/humanfriendly/compat.pyi @@ -1,20 +1,10 @@ -import sys +from html.parser import HTMLParser as HTMLParser +from io import StringIO as StringIO -if sys.version_info >= (3, 0): - unicode = str - unichr = chr - basestring = str - interactive_prompt = input - from html.parser import HTMLParser as HTMLParser - from io import StringIO as StringIO -else: - unicode = unicode - unichr = unichr - basestring = basestring - interactive_prompt = raw_input - from StringIO import StringIO as StringIO - - from HTMLParser import HTMLParser as HTMLParser +unicode = str +unichr = chr +basestring = str +interactive_prompt = input def coerce_string(value): ... def is_string(value): ... diff --git a/stubs/humanfriendly/humanfriendly/terminal/spinners.pyi b/stubs/humanfriendly/humanfriendly/terminal/spinners.pyi index 091ac7c..d0b7d5c 100644 --- a/stubs/humanfriendly/humanfriendly/terminal/spinners.pyi +++ b/stubs/humanfriendly/humanfriendly/terminal/spinners.pyi @@ -1,3 +1,4 @@ +from types import TracebackType from typing import Any GLYPHS: Any @@ -18,7 +19,12 @@ class Spinner: def sleep(self) -> None: ... def clear(self) -> None: ... def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None = ..., + exc_value: BaseException | None = ..., + traceback: TracebackType | None = ..., + ) -> None: ... class AutomaticSpinner: label: Any @@ -27,4 +33,9 @@ class AutomaticSpinner: subprocess: Any def __init__(self, label, show_time: bool = ...) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None = ..., + exc_value: BaseException | None = ..., + traceback: TracebackType | None = ..., + ) -> None: ... diff --git a/stubs/humanfriendly/humanfriendly/testing.pyi b/stubs/humanfriendly/humanfriendly/testing.pyi index 8da7c31..f3f9fa8 100644 --- a/stubs/humanfriendly/humanfriendly/testing.pyi +++ b/stubs/humanfriendly/humanfriendly/testing.pyi @@ -1,4 +1,5 @@ import unittest +from types import TracebackType from typing import Any from humanfriendly.compat import StringIO @@ -14,7 +15,12 @@ class CallableTimedOut(Exception): ... class ContextManager: def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None = ..., + exc_value: BaseException | None = ..., + traceback: TracebackType | None = ..., + ) -> None: ... class PatchedAttribute(ContextManager): object_to_patch: Any @@ -23,7 +29,6 @@ class PatchedAttribute(ContextManager): original_value: Any def __init__(self, obj, name, value) -> None: ... def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... class PatchedItem(ContextManager): object_to_patch: Any @@ -32,27 +37,23 @@ class PatchedItem(ContextManager): original_value: Any def __init__(self, obj, item, value) -> None: ... def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... class TemporaryDirectory(ContextManager): mkdtemp_options: Any temporary_directory: Any def __init__(self, **options) -> None: ... def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... class MockedHomeDirectory(PatchedItem, TemporaryDirectory): def __init__(self) -> None: ... patched_value: Any def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... class CustomSearchPath(PatchedItem, TemporaryDirectory): isolated_search_path: Any def __init__(self, isolated: bool = ...) -> None: ... patched_value: Any def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... @property def current_search_path(self): ... @@ -72,7 +73,6 @@ class CaptureOutput(ContextManager): patched_attributes: Any def __init__(self, merged: bool = ..., input: str = ..., enabled: bool = ...) -> None: ... def __enter__(self): ... - def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ... def get_lines(self): ... def get_text(self): ... def getvalue(self): ... diff --git a/stubs/invoke/@tests/test_cases/check_task.py b/stubs/invoke/@tests/test_cases/check_task.py new file mode 100644 index 0000000..6ad7b8c --- /dev/null +++ b/stubs/invoke/@tests/test_cases/check_task.py @@ -0,0 +1,17 @@ +# pyright: reportUnnecessaryTypeIgnoreComment=true + +from invoke import Context, task + +# =========================================== +# This snippet is a regression test for #8936 +# =========================================== + + +@task +def docker_build(context: Context) -> None: + pass + + +@task(docker_build) +def docker_push(context: Context) -> None: + pass diff --git a/stubs/invoke/METADATA.toml b/stubs/invoke/METADATA.toml new file mode 100644 index 0000000..ef79660 --- /dev/null +++ b/stubs/invoke/METADATA.toml @@ -0,0 +1 @@ +version = "1.7.*" diff --git a/stubs/invoke/invoke/__init__.pyi b/stubs/invoke/invoke/__init__.pyi new file mode 100644 index 0000000..6bf0e8a --- /dev/null +++ b/stubs/invoke/invoke/__init__.pyi @@ -0,0 +1,37 @@ +from typing import Any + +from .collection import Collection as Collection +from .config import Config as Config +from .context import Context as Context, MockContext as MockContext +from .exceptions import ( + AmbiguousEnvVar as AmbiguousEnvVar, + AuthFailure as AuthFailure, + CollectionNotFound as CollectionNotFound, + CommandTimedOut as CommandTimedOut, + Exit as Exit, + Failure as Failure, + ParseError as ParseError, + PlatformError as PlatformError, + ResponseNotAccepted as ResponseNotAccepted, + SubprocessPipeError as SubprocessPipeError, + ThreadException as ThreadException, + UncastableEnvVar as UncastableEnvVar, + UnexpectedExit as UnexpectedExit, + UnknownFileType as UnknownFileType, + UnpicklableConfigMember as UnpicklableConfigMember, + WatcherError as WatcherError, +) +from .executor import Executor as Executor +from .loader import FilesystemLoader as FilesystemLoader +from .parser import Argument as Argument, Parser as Parser, ParserContext as ParserContext, ParseResult as ParseResult +from .program import Program as Program +from .runners import Local as Local, Promise as Promise, Result as Result, Runner as Runner +from .tasks import Call as Call, Task as Task, call as call, task as task +from .terminals import pty_size as pty_size +from .watchers import FailingResponder as FailingResponder, Responder as Responder, StreamWatcher as StreamWatcher + +__version_info__: tuple[int, int, int] +__version__: str + +def run(command: str, **kwargs: Any) -> Result: ... +def sudo(command: str, **kwargs: Any) -> Result: ... diff --git a/stubs/invoke/invoke/collection.pyi b/stubs/invoke/invoke/collection.pyi new file mode 100644 index 0000000..415b0bf --- /dev/null +++ b/stubs/invoke/invoke/collection.pyi @@ -0,0 +1,24 @@ +from typing import Any + +class Collection: + tasks: Any + collections: Any + default: str | None + name: str | None + loaded_from: Any + auto_dash_names: bool + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def from_module(cls, module, name=..., config=..., loaded_from=..., auto_dash_names=...): ... + def add_task(self, task, name=..., aliases=..., default=...) -> None: ... + def add_collection(self, coll, name=..., default=...) -> None: ... + def subcollection_from_path(self, path): ... + def task_with_config(self, name): ... + def to_contexts(self, ignore_unknown_help: bool | None = ...): ... + def subtask_name(self, collection_name, task_name): ... + def transform(self, name): ... + @property + def task_names(self): ... + def configuration(self, taskpath=...): ... + def configure(self, options) -> None: ... + def serialized(self): ... diff --git a/stubs/Werkzeug/werkzeug/middleware/__init__.pyi b/stubs/invoke/invoke/completion/__init__.pyi similarity index 100% rename from stubs/Werkzeug/werkzeug/middleware/__init__.pyi rename to stubs/invoke/invoke/completion/__init__.pyi diff --git a/stubs/invoke/invoke/completion/complete.pyi b/stubs/invoke/invoke/completion/complete.pyi new file mode 100644 index 0000000..58661e8 --- /dev/null +++ b/stubs/invoke/invoke/completion/complete.pyi @@ -0,0 +1,11 @@ +from collections.abc import Iterable, Sequence +from typing import NoReturn + +from ..collection import Collection +from ..parser import Parser, ParserContext, ParseResult + +def complete( + names: Iterable[str], core: ParseResult, initial_context: ParserContext, collection: Collection, parser: Parser +) -> NoReturn: ... +def print_task_names(collection: Collection) -> None: ... +def print_completion_script(shell: str, names: Sequence[str]) -> None: ... diff --git a/stubs/invoke/invoke/config.pyi b/stubs/invoke/invoke/config.pyi new file mode 100644 index 0000000..2659a6b --- /dev/null +++ b/stubs/invoke/invoke/config.pyi @@ -0,0 +1,60 @@ +from typing import Any, ClassVar + +def load_source(name: str, path: str) -> dict[str, Any]: ... + +class DataProxy: + @classmethod + def from_data(cls, data, root=..., keypath=...): ... + def __getattr__(self, key): ... + def __setattr__(self, key, value) -> None: ... + def __iter__(self): ... + def __eq__(self, other): ... + __hash__: ClassVar[None] # type: ignore[assignment] + def __len__(self): ... + def __setitem__(self, key, value) -> None: ... + def __getitem__(self, key): ... + def __contains__(self, key): ... + def __delitem__(self, key) -> None: ... + def __delattr__(self, name) -> None: ... + def clear(self) -> None: ... + def pop(self, *args): ... + def popitem(self): ... + def setdefault(self, *args): ... + def update(self, *args, **kwargs) -> None: ... + +class Config(DataProxy): + prefix: str + file_prefix: Any + env_prefix: Any + @staticmethod + def global_defaults(): ... + def __init__( + self, + overrides=..., + defaults=..., + system_prefix=..., + user_prefix=..., + project_location=..., + runtime_path=..., + lazy: bool = ..., + ) -> None: ... + def load_base_conf_files(self) -> None: ... + def load_defaults(self, data, merge: bool = ...) -> None: ... + def load_overrides(self, data, merge: bool = ...) -> None: ... + def load_system(self, merge: bool = ...) -> None: ... + def load_user(self, merge: bool = ...) -> None: ... + def load_project(self, merge: bool = ...) -> None: ... + def set_runtime_path(self, path) -> None: ... + def load_runtime(self, merge: bool = ...) -> None: ... + def load_shell_env(self) -> None: ... + def load_collection(self, data, merge: bool = ...) -> None: ... + def set_project_location(self, path) -> None: ... + def merge(self) -> None: ... + def clone(self, into=...): ... + +class AmbiguousMergeError(ValueError): ... + +def merge_dicts(base, updates): ... +def copy_dict(source): ... +def excise(dict_, keypath) -> None: ... +def obliterate(base, deletions) -> None: ... diff --git a/stubs/invoke/invoke/context.pyi b/stubs/invoke/invoke/context.pyi new file mode 100644 index 0000000..b8013b1 --- /dev/null +++ b/stubs/invoke/invoke/context.pyi @@ -0,0 +1,22 @@ +from contextlib import AbstractContextManager + +from .config import Config, DataProxy + +class Context(DataProxy): + def __init__(self, config: Config | None = ...) -> None: ... + @property + def config(self) -> Config: ... + @config.setter + def config(self, value: Config) -> None: ... + def run(self, command: str, **kwargs): ... + def sudo(self, command: str, *, password: str = ..., user: str = ..., **kwargs): ... + def prefix(self, command: str) -> AbstractContextManager[None]: ... + @property + def cwd(self) -> str: ... + def cd(self, path: str) -> AbstractContextManager[None]: ... + +class MockContext(Context): + def __init__(self, config: Config | None = ..., **kwargs) -> None: ... + def run(self, command: str, *args, **kwargs): ... + def sudo(self, command: str, *args, **kwargs): ... + def set_result_for(self, attname, command, result) -> None: ... diff --git a/stubs/invoke/invoke/env.pyi b/stubs/invoke/invoke/env.pyi new file mode 100644 index 0000000..b7feeb4 --- /dev/null +++ b/stubs/invoke/invoke/env.pyi @@ -0,0 +1,6 @@ +from typing import Any + +class Environment: + data: dict[str, Any] + def __init__(self, config: dict[str, Any], prefix: str) -> None: ... + def load(self) -> dict[str, Any]: ... diff --git a/stubs/invoke/invoke/exceptions.pyi b/stubs/invoke/invoke/exceptions.pyi new file mode 100644 index 0000000..437cbc9 --- /dev/null +++ b/stubs/invoke/invoke/exceptions.pyi @@ -0,0 +1,47 @@ +from typing import Any + +class CollectionNotFound(Exception): + name: Any + start: Any + def __init__(self, name, start) -> None: ... + +class Failure(Exception): + result: Any + reason: Any + def __init__(self, result, reason=...) -> None: ... + def streams_for_display(self): ... + +class UnexpectedExit(Failure): ... + +class CommandTimedOut(Failure): + timeout: Any + def __init__(self, result, timeout) -> None: ... + +class AuthFailure(Failure): + result: Any + prompt: Any + def __init__(self, result, prompt) -> None: ... + +class ParseError(Exception): + context: Any + def __init__(self, msg, context=...) -> None: ... + +class Exit(Exception): + message: Any + def __init__(self, message=..., code=...) -> None: ... + @property + def code(self): ... + +class PlatformError(Exception): ... +class AmbiguousEnvVar(Exception): ... +class UncastableEnvVar(Exception): ... +class UnknownFileType(Exception): ... +class UnpicklableConfigMember(Exception): ... + +class ThreadException(Exception): + exceptions: Any + def __init__(self, exceptions) -> None: ... + +class WatcherError(Exception): ... +class ResponseNotAccepted(WatcherError): ... +class SubprocessPipeError(Exception): ... diff --git a/stubs/invoke/invoke/executor.pyi b/stubs/invoke/invoke/executor.pyi new file mode 100644 index 0000000..fc9b6c1 --- /dev/null +++ b/stubs/invoke/invoke/executor.pyi @@ -0,0 +1,17 @@ +from collections.abc import Iterable +from typing import Any + +from .collection import Collection +from .config import Config +from .parser import ParserContext, ParseResult +from .tasks import Call, Task + +class Executor: + collection: Collection + config: Config + core: ParseResult | None + def __init__(self, collection: Collection, config: Config | None = ..., core: ParseResult | None = ...) -> None: ... + def execute(self, *tasks: str | tuple[str, dict[str, Any]] | ParserContext) -> dict[Task[..., Any], Any]: ... + def normalize(self, tasks: Iterable[str | tuple[str, dict[str, Any]] | ParserContext]): ... + def dedupe(self, calls: Iterable[Call]) -> list[Call]: ... + def expand_calls(self, calls: Iterable[Call | Task[..., Any]]) -> list[Call]: ... diff --git a/stubs/invoke/invoke/loader.pyi b/stubs/invoke/invoke/loader.pyi new file mode 100644 index 0000000..b339d5d --- /dev/null +++ b/stubs/invoke/invoke/loader.pyi @@ -0,0 +1,15 @@ +from types import ModuleType +from typing import IO, Any + +from . import Config + +class Loader: + config: Config + def __init__(self, config: Config | None = ...) -> None: ... + def find(self, name: str) -> tuple[str, IO[Any], str, tuple[str, str, int]]: ... + def load(self, name: str | None = ...) -> tuple[ModuleType, str]: ... + +class FilesystemLoader(Loader): + def __init__(self, start: str | None = ..., **kwargs: Any) -> None: ... + @property + def start(self) -> str: ... diff --git a/stubs/invoke/invoke/main.pyi b/stubs/invoke/invoke/main.pyi new file mode 100644 index 0000000..d05ea64 --- /dev/null +++ b/stubs/invoke/invoke/main.pyi @@ -0,0 +1,3 @@ +from . import Program + +program: Program diff --git a/stubs/invoke/invoke/parser/__init__.pyi b/stubs/invoke/invoke/parser/__init__.pyi new file mode 100644 index 0000000..86a5339 --- /dev/null +++ b/stubs/invoke/invoke/parser/__init__.pyi @@ -0,0 +1,3 @@ +from .argument import Argument as Argument +from .context import ParserContext as ParserContext, to_flag as to_flag, translate_underscores as translate_underscores +from .parser import * diff --git a/stubs/invoke/invoke/parser/argument.pyi b/stubs/invoke/invoke/parser/argument.pyi new file mode 100644 index 0000000..1fd2182 --- /dev/null +++ b/stubs/invoke/invoke/parser/argument.pyi @@ -0,0 +1,37 @@ +from typing import Any + +class Argument: + names: Any + kind: Any + raw_value: Any + default: Any + help: Any + positional: Any + optional: Any + incrementable: Any + attr_name: Any + def __init__( + self, + name=..., + names=..., + kind=..., + default=..., + help=..., + positional: bool = ..., + optional: bool = ..., + incrementable: bool = ..., + attr_name=..., + ) -> None: ... + @property + def name(self): ... + @property + def nicknames(self): ... + @property + def takes_value(self): ... + @property + def value(self): ... + @value.setter + def value(self, arg) -> None: ... + def set_value(self, value, cast: bool = ...): ... + @property + def got_value(self): ... diff --git a/stubs/invoke/invoke/parser/context.pyi b/stubs/invoke/invoke/parser/context.pyi new file mode 100644 index 0000000..80cc56a --- /dev/null +++ b/stubs/invoke/invoke/parser/context.pyi @@ -0,0 +1,24 @@ +from typing import Any + +def translate_underscores(name: str) -> str: ... +def to_flag(name: str) -> str: ... +def sort_candidate(arg): ... +def flag_key(x): ... + +class ParserContext: + args: Any + positional_args: Any + flags: Any + inverse_flags: Any + name: Any + aliases: Any + def __init__(self, name=..., aliases=..., args=...) -> None: ... + def add_arg(self, *args, **kwargs) -> None: ... + @property + def missing_positional_args(self): ... + @property + def as_kwargs(self): ... + def names_for(self, flag): ... + def help_for(self, flag): ... + def help_tuples(self): ... + def flag_names(self): ... diff --git a/stubs/invoke/invoke/parser/parser.pyi b/stubs/invoke/invoke/parser/parser.pyi new file mode 100644 index 0000000..2f836db --- /dev/null +++ b/stubs/invoke/invoke/parser/parser.pyi @@ -0,0 +1,42 @@ +from typing import Any + +from .context import ParserContext + +def is_flag(value: str) -> bool: ... +def is_long_flag(value: str) -> bool: ... + +class Parser: + initial: Any + contexts: Any + ignore_unknown: Any + def __init__(self, contexts=..., initial=..., ignore_unknown: bool = ...) -> None: ... + def parse_argv(self, argv): ... + +class ParseMachine: + initial_state: str + def changing_state(self, from_, to) -> None: ... + ignore_unknown: Any + initial: Any + flag: Any + flag_got_value: bool + result: Any + contexts: Any + def __init__(self, initial, contexts, ignore_unknown) -> None: ... + @property + def waiting_for_flag_value(self): ... + def handle(self, token) -> None: ... + def store_only(self, token) -> None: ... + def complete_context(self) -> None: ... + context: Any + def switch_to_context(self, name) -> None: ... + def complete_flag(self) -> None: ... + def check_ambiguity(self, value): ... + def switch_to_flag(self, flag, inverse: bool = ...) -> None: ... + def see_value(self, value) -> None: ... + def see_positional_arg(self, value) -> None: ... + def error(self, msg) -> None: ... + +class ParseResult(list[ParserContext]): + remainder: str + unparsed: Any + def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/invoke/invoke/program.pyi b/stubs/invoke/invoke/program.pyi new file mode 100644 index 0000000..2804582 --- /dev/null +++ b/stubs/invoke/invoke/program.pyi @@ -0,0 +1,71 @@ +from typing import Any + +class Program: + def core_args(self): ... + def task_args(self): ... + leading_indent_width: int + leading_indent: str + indent_width: int + indent: str + col_padding: int + version: Any + namespace: Any + argv: Any + loader_class: Any + executor_class: Any + config_class: Any + def __init__( + self, + version=..., + namespace=..., + name=..., + binary=..., + loader_class=..., + executor_class=..., + config_class=..., + binary_names=..., + ) -> None: ... + config: Any + def create_config(self) -> None: ... + def update_config(self, merge: bool = ...) -> None: ... + def run(self, argv=..., exit: bool = ...) -> None: ... + def parse_core(self, argv) -> None: ... + collection: Any + list_root: Any + list_depth: Any + list_format: str + scoped_collection: Any + def parse_collection(self) -> None: ... + def parse_cleanup(self) -> None: ... + def no_tasks_given(self) -> None: ... + def execute(self) -> None: ... + def normalize_argv(self, argv) -> None: ... + @property + def name(self): ... + @property + def called_as(self): ... + @property + def binary(self): ... + @property + def binary_names(self): ... + @property + def args(self): ... + @property + def initial_context(self): ... + def print_version(self) -> None: ... + def print_help(self) -> None: ... + core: Any + def parse_core_args(self) -> None: ... + def load_collection(self) -> None: ... + parser: Any + core_via_tasks: Any + tasks: Any + def parse_tasks(self) -> None: ... + def print_task_help(self, name) -> None: ... + def list_tasks(self) -> None: ... + def list_flat(self) -> None: ... + def list_nested(self) -> None: ... + def list_json(self) -> None: ... + def task_list_opener(self, extra: str = ...): ... + def display_with_columns(self, pairs, extra: str = ...) -> None: ... + def print_columns(self, tuples) -> None: ... diff --git a/stubs/invoke/invoke/runners.pyi b/stubs/invoke/invoke/runners.pyi new file mode 100644 index 0000000..063b76b --- /dev/null +++ b/stubs/invoke/invoke/runners.pyi @@ -0,0 +1,202 @@ +from collections.abc import Iterable, Mapping +from typing import Any, TextIO, overload +from typing_extensions import Literal, TypeAlias + +from .watchers import StreamWatcher + +_Hide: TypeAlias = Literal[None, True, False, "out", "stdout", "err", "stderr", "both"] + +class Runner: + read_chunk_size: int + input_sleep: float + context: Any + program_finished: Any + warned_about_pty_fallback: bool + watchers: Any + def __init__(self, context) -> None: ... + # If disown is True (default=False), returns None + @overload + def run( + self, + command: str, + *, + asynchronous: bool = ..., + disown: Literal[True], + dry: bool = ..., + echo: bool = ..., + echo_format: str = ..., + echo_stdin: bool | None = ..., + encoding: str = ..., + err_stream: TextIO | None = ..., + env: Mapping[str, str] = ..., + fallback: bool = ..., + hide: _Hide = ..., + in_stream: TextIO | None | bool = ..., + out_stream: TextIO | None = ..., + pty: bool = ..., + replace_env: bool = ..., + shell: str = ..., + timeout: float | None = ..., + warn: bool = ..., + watchers: Iterable[StreamWatcher] = ..., + ) -> None: ... + # If disown is False (the default), and asynchronous is True (default=False) returns Promise + @overload + def run( + self, + command: str, + *, + asynchronous: Literal[True], + disown: Literal[False] = ..., + dry: bool = ..., + echo: bool = ..., + echo_format: str = ..., + echo_stdin: bool | None = ..., + encoding: str = ..., + err_stream: TextIO | None = ..., + env: Mapping[str, str] = ..., + fallback: bool = ..., + hide: _Hide = ..., + in_stream: TextIO | None | bool = ..., + out_stream: TextIO | None = ..., + pty: bool = ..., + replace_env: bool = ..., + shell: str = ..., + timeout: float | None = ..., + warn: bool = ..., + watchers: Iterable[StreamWatcher] = ..., + ) -> Promise: ... + # If disown and asynchronous are both False (the defaults), returns Result + @overload + def run( + self, + command: str, + *, + asynchronous: Literal[False] = ..., + disown: Literal[False] = ..., + dry: bool = ..., + echo: bool = ..., + echo_format: str = ..., + echo_stdin: bool | None = ..., + encoding: str = ..., + err_stream: TextIO | None = ..., + env: Mapping[str, str] = ..., + fallback: bool = ..., + hide: _Hide = ..., + in_stream: TextIO | None | bool = ..., + out_stream: TextIO | None = ..., + pty: bool = ..., + replace_env: bool = ..., + shell: str = ..., + timeout: float | None = ..., + warn: bool = ..., + watchers: Iterable[StreamWatcher] = ..., + ) -> Result: ... + # Fallback overload: return Any + @overload + def run( + self, + command: str, + *, + asynchronous: bool, + disown: bool, + dry: bool = ..., + echo: bool = ..., + echo_format: str = ..., + echo_stdin: bool | None = ..., + encoding: str = ..., + err_stream: TextIO | None = ..., + env: Mapping[str, str] = ..., + fallback: bool = ..., + hide: _Hide = ..., + in_stream: TextIO | None | bool = ..., + out_stream: TextIO | None = ..., + pty: bool = ..., + replace_env: bool = ..., + shell: str = ..., + timeout: float | None = ..., + warn: bool = ..., + watchers: Iterable[StreamWatcher] = ..., + ) -> Any: ... + def echo(self, command) -> None: ... + def make_promise(self): ... + def create_io_threads(self): ... + def generate_result(self, **kwargs): ... + def read_proc_output(self, reader) -> None: ... + def write_our_output(self, stream, string) -> None: ... + def handle_stdout(self, buffer_, hide, output) -> None: ... + def handle_stderr(self, buffer_, hide, output) -> None: ... + def read_our_stdin(self, input_): ... + def handle_stdin(self, input_, output, echo) -> None: ... + def should_echo_stdin(self, input_, output): ... + def respond(self, buffer_) -> None: ... + def generate_env(self, env, replace_env): ... + def should_use_pty(self, pty, fallback): ... + @property + def has_dead_threads(self): ... + def wait(self) -> None: ... + def write_proc_stdin(self, data) -> None: ... + def decode(self, data): ... + @property + def process_is_finished(self) -> None: ... + def start(self, command, shell, env) -> None: ... + def start_timer(self, timeout) -> None: ... + def read_proc_stdout(self, num_bytes) -> None: ... + def read_proc_stderr(self, num_bytes) -> None: ... + def close_proc_stdin(self) -> None: ... + def default_encoding(self): ... + def send_interrupt(self, interrupt) -> None: ... + def returncode(self) -> None: ... + def stop(self) -> None: ... + def stop_timer(self) -> None: ... + def kill(self) -> None: ... + @property + def timed_out(self): ... + +class Local(Runner): + status: Any + def __init__(self, context) -> None: ... + def should_use_pty(self, pty: bool = ..., fallback: bool = ...): ... + process: Any + +class Result: + stdout: str + stderr: str + encoding: str + command: str + shell: Any + env: dict[str, Any] + exited: int + pty: bool + hide: tuple[Literal["stdout", "stderr"], ...] + def __init__( + self, + stdout: str = ..., + stderr: str = ..., + encoding: str | None = ..., + command: str = ..., + shell: str = ..., + env=..., + exited: int = ..., + pty: bool = ..., + hide: tuple[Literal["stdout", "stderr"], ...] = ..., + ) -> None: ... + @property + def return_code(self) -> int: ... + def __nonzero__(self) -> bool: ... + def __bool__(self) -> bool: ... + @property + def ok(self) -> bool: ... + @property + def failed(self) -> bool: ... + def tail(self, stream: Literal["stderr", "stdout"], count: int = ...) -> str: ... + +class Promise(Result): + runner: Any + def __init__(self, runner) -> None: ... + def join(self): ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_value, traceback) -> None: ... + +def normalize_hide(val, out_stream=..., err_stream=...): ... +def default_encoding() -> str: ... diff --git a/stubs/invoke/invoke/tasks.pyi b/stubs/invoke/invoke/tasks.pyi new file mode 100644 index 0000000..720d2bd --- /dev/null +++ b/stubs/invoke/invoke/tasks.pyi @@ -0,0 +1,117 @@ +from _typeshed import Self +from collections.abc import Callable, Iterable +from typing import Any, Generic, TypeVar, overload +from typing_extensions import ParamSpec + +from .config import Config +from .context import Context +from .parser import Argument + +_P = ParamSpec("_P") +_R_co = TypeVar("_R_co", covariant=True) +_TaskT = TypeVar("_TaskT", bound=Task[..., Any]) + +NO_DEFAULT: object + +class Task(Generic[_P, _R_co]): + body: Callable[_P, _R_co] + __doc__: str | None + __name__: str + __module__: str + aliases: tuple[str, ...] + is_default: bool + positional: Iterable[str] + optional: Iterable[str] + iterable: Iterable[str] + incrementable: Iterable[str] + auto_shortflags: bool + help: dict[str, str] + pre: Iterable[Task[..., Any]] + post: Iterable[Task[..., Any]] + times_called: int + autoprint: bool + def __init__( + self, + body: Callable[..., Any], + name: str | None = ..., + aliases: tuple[str, ...] = ..., + positional: Iterable[str] | None = ..., + optional: Iterable[str] = ..., + default: bool = ..., + auto_shortflags: bool = ..., + help: dict[str, str] | None = ..., + pre: Iterable[Task[..., Any]] | None = ..., + post: Iterable[Task[..., Any]] | None = ..., + autoprint: bool = ..., + iterable: Iterable[str] | None = ..., + incrementable: Iterable[str] | None = ..., + ) -> None: ... + @property + def name(self): ... + def __eq__(self, other: Task) -> bool: ... # type: ignore[override] + def __hash__(self) -> int: ... + def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ... + @property + def called(self) -> bool: ... + def argspec(self, body): ... + def fill_implicit_positionals(self, positional: Iterable[str] | None) -> Iterable[str]: ... + def arg_opts(self, name: str, default: Any, taken_names: Iterable[str]) -> dict[str, Any]: ... + def get_arguments(self, ignore_unknown_help: bool | None = ...) -> list[Argument]: ... + +@overload +def task( + *args: Task[..., Any], + name: str | None = ..., + aliases: tuple[str, ...] = ..., + positional: Iterable[str] | None = ..., + optional: Iterable[str] = ..., + default: bool = ..., + auto_shortflags: bool = ..., + help: dict[str, str] | None = ..., + pre: list[Task[..., Any]] | None = ..., + post: list[Task[..., Any]] | None = ..., + autoprint: bool = ..., + iterable: Iterable[str] | None = ..., + incrementable: Iterable[str] | None = ..., +) -> Callable[[Callable[_P, _R_co]], Task[_P, _R_co]]: ... +@overload +def task( + *args: Task[..., Any], + name: str | None = ..., + aliases: tuple[str, ...] = ..., + positional: Iterable[str] | None = ..., + optional: Iterable[str] = ..., + default: bool = ..., + auto_shortflags: bool = ..., + help: dict[str, str] | None = ..., + pre: list[Task[..., Any]] | None = ..., + post: list[Task[..., Any]] | None = ..., + autoprint: bool = ..., + iterable: Iterable[str] | None = ..., + incrementable: Iterable[str] | None = ..., + klass: type[_TaskT], +) -> Callable[[Callable[..., Any]], _TaskT]: ... +@overload +def task(__func: Callable[_P, _R_co]) -> Task[_P, _R_co]: ... + +class Call: + task: Task[..., Any] + called_as: str | None + args: tuple[Any, ...] + kwargs: dict[str, Any] + def __init__( + self, + task: Task[..., Any], + called_as: str | None = ..., + args: tuple[Any, ...] | None = ..., + kwargs: dict[str, Any] | None = ..., + ) -> None: ... + def __getattr__(self, name: str) -> Any: ... + def __deepcopy__(self: Self, memo: Any) -> Self: ... + def __eq__(self, other: Call) -> bool: ... # type: ignore[override] + def make_context(self, config: Config) -> Context: ... + def clone_data(self): ... + # TODO use overload + def clone(self, into: type[Call] | None = ..., with_: dict[str, Any] | None = ...) -> Call: ... + +def call(task: Task[..., Any], *args: Any, **kwargs: Any) -> Call: ... diff --git a/stubs/invoke/invoke/terminals.pyi b/stubs/invoke/invoke/terminals.pyi new file mode 100644 index 0000000..6119540 --- /dev/null +++ b/stubs/invoke/invoke/terminals.pyi @@ -0,0 +1,12 @@ +from contextlib import AbstractContextManager +from io import TextIOWrapper +from typing import Any + +WINDOWS: bool + +def pty_size() -> tuple[int, int]: ... +def stdin_is_foregrounded_tty(stream: Any) -> bool: ... +def cbreak_already_set(stream: TextIOWrapper) -> bool: ... +def character_buffered(stream: TextIOWrapper) -> AbstractContextManager[None]: ... +def ready_for_reading(input_: TextIOWrapper) -> bool: ... +def bytes_to_read(input_: TextIOWrapper) -> int: ... diff --git a/stubs/invoke/invoke/util.pyi b/stubs/invoke/invoke/util.pyi new file mode 100644 index 0000000..d010b60 --- /dev/null +++ b/stubs/invoke/invoke/util.pyi @@ -0,0 +1,40 @@ +import threading +from collections.abc import Callable, Iterable, Mapping +from contextlib import AbstractContextManager +from logging import Logger +from types import TracebackType +from typing import Any, NamedTuple + +LOG_FORMAT: str + +def enable_logging() -> None: ... + +log: Logger + +def task_name_sort_key(name: str) -> tuple[list[str], str]: ... +def cd(where: str) -> AbstractContextManager[None]: ... +def has_fileno(stream) -> bool: ... +def isatty(stream) -> bool: ... +def encode_output(string: str, encoding: str) -> str: ... +def helpline(obj: Callable[..., object]) -> str | None: ... + +class ExceptionHandlingThread(threading.Thread): + def __init__( + self, + *, + group: None = ..., + target: Callable[..., object] | None = ..., + name: str | None = ..., + args: Iterable[Any] = ..., + kwargs: Mapping[str, Any] | None = ..., + daemon: bool | None = ..., + ) -> None: ... + def exception(self) -> ExceptionWrapper | None: ... + @property + def is_dead(self) -> bool: ... + +class ExceptionWrapper(NamedTuple): + kwargs: Any + type: type[BaseException] + value: BaseException + traceback: TracebackType diff --git a/stubs/invoke/invoke/watchers.pyi b/stubs/invoke/invoke/watchers.pyi new file mode 100644 index 0000000..35e3cb5 --- /dev/null +++ b/stubs/invoke/invoke/watchers.pyi @@ -0,0 +1,20 @@ +import threading +from collections.abc import Iterable + +class StreamWatcher(threading.local): + def submit(self, stream) -> Iterable[str]: ... + +class Responder(StreamWatcher): + pattern: str + response: str + index: int + def __init__(self, pattern: str, response: str) -> None: ... + def pattern_matches(self, stream: str, pattern: str, index_attr: str) -> Iterable[str]: ... + def submit(self, stream: str) -> Iterable[str]: ... + +class FailingResponder(Responder): + sentinel: str + failure_index: int + tried: bool + def __init__(self, pattern: str, response: str, sentinel: str) -> None: ... + def submit(self, stream: str) -> Iterable[str]: ... diff --git a/stubs/ipaddress/@python2/ipaddress.pyi b/stubs/ipaddress/@python2/ipaddress.pyi deleted file mode 100644 index 5d0c7dd..0000000 --- a/stubs/ipaddress/@python2/ipaddress.pyi +++ /dev/null @@ -1,148 +0,0 @@ -from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Text, Tuple, TypeVar, overload - -# Undocumented length constants -IPV4LENGTH: int -IPV6LENGTH: int - -_A = TypeVar("_A", IPv4Address, IPv6Address) -_N = TypeVar("_N", IPv4Network, IPv6Network) -_T = TypeVar("_T") - -def ip_address(address: object) -> Any: ... # morally Union[IPv4Address, IPv6Address] -def ip_network(address: object, strict: bool = ...) -> Any: ... # morally Union[IPv4Network, IPv6Network] -def ip_interface(address: object) -> Any: ... # morally Union[IPv4Interface, IPv6Interface] - -class _IPAddressBase: - def __eq__(self, other: Any) -> bool: ... - def __ge__(self: _T, other: _T) -> bool: ... - def __gt__(self: _T, other: _T) -> bool: ... - def __le__(self: _T, other: _T) -> bool: ... - def __lt__(self: _T, other: _T) -> bool: ... - def __ne__(self, other: Any) -> bool: ... - @property - def compressed(self) -> Text: ... - @property - def exploded(self) -> Text: ... - @property - def reverse_pointer(self) -> Text: ... - @property - def version(self) -> int: ... - -class _BaseAddress(_IPAddressBase, SupportsInt): - def __init__(self, address: object) -> None: ... - def __add__(self: _T, other: int) -> _T: ... - def __hash__(self) -> int: ... - def __int__(self) -> int: ... - def __sub__(self: _T, other: int) -> _T: ... - @property - def is_global(self) -> bool: ... - @property - def is_link_local(self) -> bool: ... - @property - def is_loopback(self) -> bool: ... - @property - def is_multicast(self) -> bool: ... - @property - def is_private(self) -> bool: ... - @property - def is_reserved(self) -> bool: ... - @property - def is_unspecified(self) -> bool: ... - @property - def max_prefixlen(self) -> int: ... - @property - def packed(self) -> bytes: ... - -class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]): - network_address: _A - netmask: _A - def __init__(self, address: object, strict: bool = ...) -> None: ... - def __contains__(self, other: Any) -> bool: ... - def __getitem__(self, n: int) -> _A: ... - def __iter__(self) -> Iterator[_A]: ... - def address_exclude(self: _T, other: _T) -> Iterator[_T]: ... - @property - def broadcast_address(self) -> _A: ... - def compare_networks(self: _T, other: _T) -> int: ... - def hosts(self) -> Iterator[_A]: ... - @property - def is_global(self) -> bool: ... - @property - def is_link_local(self) -> bool: ... - @property - def is_loopback(self) -> bool: ... - @property - def is_multicast(self) -> bool: ... - @property - def is_private(self) -> bool: ... - @property - def is_reserved(self) -> bool: ... - @property - def is_unspecified(self) -> bool: ... - @property - def max_prefixlen(self) -> int: ... - @property - def num_addresses(self) -> int: ... - def overlaps(self, other: _BaseNetwork[_A]) -> bool: ... - @property - def prefixlen(self) -> int: ... - def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ... - def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ... - @property - def with_hostmask(self) -> Text: ... - @property - def with_netmask(self) -> Text: ... - @property - def with_prefixlen(self) -> Text: ... - @property - def hostmask(self) -> _A: ... - -class _BaseInterface(_BaseAddress, Generic[_A, _N]): - hostmask: _A - netmask: _A - network: _N - @property - def ip(self) -> _A: ... - @property - def with_hostmask(self) -> Text: ... - @property - def with_netmask(self) -> Text: ... - @property - def with_prefixlen(self) -> Text: ... - -class IPv4Address(_BaseAddress): ... -class IPv4Network(_BaseNetwork[IPv4Address]): ... -class IPv4Interface(IPv4Address, _BaseInterface[IPv4Address, IPv4Network]): ... - -class IPv6Address(_BaseAddress): - @property - def ipv4_mapped(self) -> Optional[IPv4Address]: ... - @property - def is_site_local(self) -> bool: ... - @property - def sixtofour(self) -> Optional[IPv4Address]: ... - @property - def teredo(self) -> Optional[Tuple[IPv4Address, IPv4Address]]: ... - -class IPv6Network(_BaseNetwork[IPv6Address]): - @property - def is_site_local(self) -> bool: ... - -class IPv6Interface(IPv6Address, _BaseInterface[IPv6Address, IPv6Network]): ... - -def v4_int_to_packed(address: int) -> bytes: ... -def v6_int_to_packed(address: int) -> bytes: ... -@overload -def summarize_address_range(first: IPv4Address, last: IPv4Address) -> Iterator[IPv4Network]: ... -@overload -def summarize_address_range(first: IPv6Address, last: IPv6Address) -> Iterator[IPv6Network]: ... -def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: ... -@overload -def get_mixed_type_key(obj: _A) -> Tuple[int, _A]: ... -@overload -def get_mixed_type_key(obj: IPv4Network) -> Tuple[int, IPv4Address, IPv4Address]: ... -@overload -def get_mixed_type_key(obj: IPv6Network) -> Tuple[int, IPv6Address, IPv6Address]: ... - -class AddressValueError(ValueError): ... -class NetmaskValueError(ValueError): ... diff --git a/stubs/ipaddress/METADATA.toml b/stubs/ipaddress/METADATA.toml deleted file mode 100644 index f339dc7..0000000 --- a/stubs/ipaddress/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "1.0" -python2 = true diff --git a/stubs/itsdangerous/@tests/stubtest_allowlist.txt b/stubs/itsdangerous/@tests/stubtest_allowlist.txt deleted file mode 100644 index c3bfa03..0000000 --- a/stubs/itsdangerous/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,8 +0,0 @@ -itsdangerous.BadData.message -itsdangerous.JSONWebSignatureSerializer.__init__ -itsdangerous.JSONWebSignatureSerializer.make_signer -itsdangerous.Serializer.__init__ -itsdangerous.SigningAlgorithm -itsdangerous.TimedJSONWebSignatureSerializer.__init__ -itsdangerous.TimedSerializer.loads -itsdangerous.TimedSerializer.loads_unsafe diff --git a/stubs/itsdangerous/METADATA.toml b/stubs/itsdangerous/METADATA.toml deleted file mode 100644 index 2266533..0000000 --- a/stubs/itsdangerous/METADATA.toml +++ /dev/null @@ -1,3 +0,0 @@ -version = "1.1" -python2 = true -obsolete_since = "2.0" diff --git a/stubs/itsdangerous/itsdangerous.pyi b/stubs/itsdangerous/itsdangerous.pyi deleted file mode 100644 index 17e1ba1..0000000 --- a/stubs/itsdangerous/itsdangerous.pyi +++ /dev/null @@ -1,174 +0,0 @@ -from datetime import datetime -from typing import IO, Any, Callable, Generator, Mapping, MutableMapping, Text, Tuple - -_serializer = Any # must be an object that has "dumps" and "loads" attributes (e.g. the json module) - -def want_bytes(s: Text | bytes, encoding: Text = ..., errors: Text = ...) -> bytes: ... - -class BadData(Exception): - message: str - def __init__(self, message: str) -> None: ... - -class BadPayload(BadData): - original_error: Exception | None - def __init__(self, message: str, original_error: Exception | None = ...) -> None: ... - -class BadSignature(BadData): - payload: Any | None - def __init__(self, message: str, payload: Any | None = ...) -> None: ... - -class BadTimeSignature(BadSignature): - date_signed: int | None - def __init__(self, message: str, payload: Any | None = ..., date_signed: int | None = ...) -> None: ... - -class BadHeader(BadSignature): - header: Any - original_error: Any - def __init__( - self, message: str, payload: Any | None = ..., header: Any | None = ..., original_error: Any | None = ... - ) -> None: ... - -class SignatureExpired(BadTimeSignature): ... - -def base64_encode(string: Text | bytes) -> bytes: ... -def base64_decode(string: Text | bytes) -> bytes: ... - -class SigningAlgorithm(object): - def get_signature(self, key: bytes, value: bytes) -> bytes: ... - def verify_signature(self, key: bytes, value: bytes, sig: bytes) -> bool: ... - -class NoneAlgorithm(SigningAlgorithm): - def get_signature(self, key: bytes, value: bytes) -> bytes: ... - -class HMACAlgorithm(SigningAlgorithm): - default_digest_method: Callable[..., Any] - digest_method: Callable[..., Any] - def __init__(self, digest_method: Callable[..., Any] | None = ...) -> None: ... - def get_signature(self, key: bytes, value: bytes) -> bytes: ... - -class Signer(object): - default_digest_method: Callable[..., Any] = ... - default_key_derivation: str = ... - - secret_key: bytes - sep: bytes - salt: Text | bytes - key_derivation: str - digest_method: Callable[..., Any] - algorithm: SigningAlgorithm - def __init__( - self, - secret_key: Text | bytes, - salt: Text | bytes | None = ..., - sep: Text | bytes | None = ..., - key_derivation: str | None = ..., - digest_method: Callable[..., Any] | None = ..., - algorithm: SigningAlgorithm | None = ..., - ) -> None: ... - def derive_key(self) -> bytes: ... - def get_signature(self, value: Text | bytes) -> bytes: ... - def sign(self, value: Text | bytes) -> bytes: ... - def verify_signature(self, value: bytes, sig: Text | bytes) -> bool: ... - def unsign(self, signed_value: Text | bytes) -> bytes: ... - def validate(self, signed_value: Text | bytes) -> bool: ... - -class TimestampSigner(Signer): - def get_timestamp(self) -> int: ... - def timestamp_to_datetime(self, ts: float) -> datetime: ... - def sign(self, value: Text | bytes) -> bytes: ... - def unsign( - self, value: Text | bytes, max_age: int | None = ..., return_timestamp: bool = ... - ) -> Any: ... # morally -> bytes | Tuple[bytes, datetime] - def validate(self, signed_value: Text | bytes, max_age: int | None = ...) -> bool: ... - -class Serializer(object): - default_serializer: _serializer = ... - default_signer: Callable[..., Signer] = ... - - secret_key: bytes - salt: bytes - serializer: _serializer - is_text_serializer: bool - signer: Callable[..., Signer] - signer_kwargs: MutableMapping[str, Any] - def __init__( - self, - secret_key: Text | bytes, - salt: Text | bytes | None = ..., - serializer: _serializer | None = ..., - signer: Callable[..., Signer] | None = ..., - signer_kwargs: MutableMapping[str, Any] | None = ..., - ) -> None: ... - def load_payload(self, payload: bytes, serializer: _serializer | None = ...) -> Any: ... - def dump_payload(self, obj: Any) -> bytes: ... - def make_signer(self, salt: Text | bytes | None = ...) -> Signer: ... - def iter_unsigners(self, salt: Text | bytes | None = ...) -> Generator[Any, None, None]: ... - def dumps(self, obj: Any, salt: Text | bytes | None = ...) -> Any: ... # morally -> str | bytes - def dump(self, obj: Any, f: IO[Any], salt: Text | bytes | None = ...) -> None: ... - def loads(self, s: Text | bytes, salt: Text | bytes | None = ...) -> Any: ... - def load(self, f: IO[Any], salt: Text | bytes | None = ...) -> Any: ... - def loads_unsafe(self, s: Text | bytes, salt: Text | bytes | None = ...) -> Tuple[bool, Any | None]: ... - def load_unsafe(self, f: IO[Any], salt: Text | bytes | None = ...) -> Tuple[bool, Any | None]: ... - -class TimedSerializer(Serializer): - def loads( - self, s: Text | bytes, salt: Text | bytes | None = ..., max_age: int | None = ..., return_timestamp: bool = ... - ) -> Any: ... # morally -> Any | Tuple[Any, datetime] - def loads_unsafe(self, s: Text | bytes, salt: Text | bytes | None = ..., max_age: int | None = ...) -> Tuple[bool, Any]: ... - -class JSONWebSignatureSerializer(Serializer): - jws_algorithms: MutableMapping[Text, SigningAlgorithm] = ... - default_algorithm: Text = ... - default_serializer: Any = ... - - algorithm_name: Text - algorithm: SigningAlgorithm - def __init__( - self, - secret_key: Text | bytes, - salt: Text | bytes | None = ..., - serializer: _serializer | None = ..., - signer: Callable[..., Signer] | None = ..., - signer_kwargs: MutableMapping[str, Any] | None = ..., - algorithm_name: Text | None = ..., - ) -> None: ... - def load_payload( - self, payload: Text | bytes, serializer: _serializer | None = ..., return_header: bool = ... - ) -> Any: ... # morally -> Any | Tuple[Any, MutableMapping[str, Any]] - def dump_payload(self, header: Mapping[str, Any], obj: Any) -> bytes: ... # type: ignore - def make_algorithm(self, algorithm_name: Text) -> SigningAlgorithm: ... - def make_signer(self, salt: Text | bytes | None = ..., algorithm: SigningAlgorithm = ...) -> Signer: ... - def make_header(self, header_fields: Mapping[str, Any] | None) -> MutableMapping[str, Any]: ... - def dumps(self, obj: Any, salt: Text | bytes | None = ..., header_fields: Mapping[str, Any] | None = ...) -> bytes: ... - def loads( - self, s: Text | bytes, salt: Text | bytes | None = ..., return_header: bool = ... - ) -> Any: ... # morally -> Any | Tuple[Any, MutableMapping[str, Any]] - def loads_unsafe(self, s: Text | bytes, salt: Text | bytes | None = ..., return_header: bool = ...) -> Tuple[bool, Any]: ... - -class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer): - DEFAULT_EXPIRES_IN: int = ... - expires_in: int - def __init__( - self, - secret_key: Text | bytes, - expires_in: int | None = ..., - salt: Text | bytes | None = ..., - serializer: _serializer | None = ..., - signer: Callable[..., Signer] | None = ..., - signer_kwargs: MutableMapping[str, Any] | None = ..., - algorithm_name: Text | None = ..., - ) -> None: ... - def make_header(self, header_fields: Mapping[str, Any] | None) -> MutableMapping[str, Any]: ... - def loads( - self, s: Text | bytes, salt: Text | bytes | None = ..., return_header: bool = ... - ) -> Any: ... # morally -> Any | Tuple[Any, MutableMapping[str, Any]] - def get_issue_date(self, header: Mapping[str, Any]) -> datetime | None: ... - def now(self) -> int: ... - -class _URLSafeSerializerMixin(object): - default_serializer: _serializer = ... - def load_payload(self, payload: bytes, serializer: _serializer | None = ...) -> Any: ... - def dump_payload(self, obj: Any) -> bytes: ... - -class URLSafeSerializer(_URLSafeSerializerMixin, Serializer): ... -class URLSafeTimedSerializer(_URLSafeSerializerMixin, TimedSerializer): ... diff --git a/stubs/jmespath/METADATA.toml b/stubs/jmespath/METADATA.toml index 3d8655e..516f11f 100644 --- a/stubs/jmespath/METADATA.toml +++ b/stubs/jmespath/METADATA.toml @@ -1 +1,4 @@ -version = "0.10" +version = "1.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/jmespath/jmespath/__init__.pyi b/stubs/jmespath/jmespath/__init__.pyi index 4f40ec7..23077fb 100644 --- a/stubs/jmespath/jmespath/__init__.pyi +++ b/stubs/jmespath/jmespath/__init__.pyi @@ -3,5 +3,5 @@ from typing import Any from jmespath import parser as parser from jmespath.visitor import Options as Options -def compile(expression): ... -def search(expression, data, options: Any | None = ...): ... +def compile(expression: str) -> parser.ParsedResult: ... +def search(expression: str, data: Any, options: Any | None = ...) -> Any: ... diff --git a/stubs/jmespath/jmespath/compat.pyi b/stubs/jmespath/jmespath/compat.pyi new file mode 100644 index 0000000..fdafd15 --- /dev/null +++ b/stubs/jmespath/jmespath/compat.pyi @@ -0,0 +1,10 @@ +from _typeshed import Incomplete +from collections.abc import Generator +from itertools import zip_longest as zip_longest + +text_type = str +string_type = str + +def with_str_method(cls): ... +def with_repr_method(cls): ... +def get_methods(cls) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/jmespath/jmespath/functions.pyi b/stubs/jmespath/jmespath/functions.pyi index b64e9ec..e1916f9 100644 --- a/stubs/jmespath/jmespath/functions.pyi +++ b/stubs/jmespath/jmespath/functions.pyi @@ -1,9 +1,17 @@ -from typing import Any +from collections.abc import Callable +from typing import Any, TypeVar +from typing_extensions import NotRequired, TypedDict -TYPES_MAP: Any -REVERSE_TYPES_MAP: Any +TYPES_MAP: dict[str, str] +REVERSE_TYPES_MAP: dict[str, tuple[str, ...]] -def signature(*arguments): ... +class _Signature(TypedDict): + types: list[str] + variadic: NotRequired[bool] + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def signature(*arguments: _Signature) -> Callable[[_F], _F]: ... class FunctionRegistry(type): def __init__(cls, name, bases, attrs) -> None: ... diff --git a/stubs/jsonschema/@tests/stubtest_allowlist.txt b/stubs/jsonschema/@tests/stubtest_allowlist.txt deleted file mode 100644 index 5f66c81..0000000 --- a/stubs/jsonschema/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,13 +0,0 @@ -jsonschema._format.is_css21_color -jsonschema._format.is_css3_color -jsonschema._format.is_css_color_code -jsonschema._format.is_datetime -jsonschema._format.is_idn_host_name -jsonschema._format.is_iri -jsonschema._format.is_iri_reference -jsonschema._format.is_json_pointer -jsonschema._format.is_relative_json_pointer -jsonschema._format.is_time -jsonschema._format.is_uri -jsonschema._format.is_uri_reference -jsonschema._format.is_uri_template diff --git a/stubs/jsonschema/METADATA.toml b/stubs/jsonschema/METADATA.toml index ffc5a1c..051bc8b 100644 --- a/stubs/jsonschema/METADATA.toml +++ b/stubs/jsonschema/METADATA.toml @@ -1 +1,4 @@ -version = "3.2" +version = "4.17.*" + +[tool.stubtest] +extras = ["format"] diff --git a/stubs/jsonschema/jsonschema/__init__.pyi b/stubs/jsonschema/jsonschema/__init__.pyi index 87b8e96..dcb925b 100644 --- a/stubs/jsonschema/jsonschema/__init__.pyi +++ b/stubs/jsonschema/jsonschema/__init__.pyi @@ -4,6 +4,8 @@ from jsonschema._format import ( draft4_format_checker as draft4_format_checker, draft6_format_checker as draft6_format_checker, draft7_format_checker as draft7_format_checker, + draft201909_format_checker as draft201909_format_checker, + draft202012_format_checker as draft202012_format_checker, ) from jsonschema._types import TypeChecker as TypeChecker from jsonschema.exceptions import ( @@ -13,11 +15,14 @@ from jsonschema.exceptions import ( SchemaError as SchemaError, ValidationError as ValidationError, ) +from jsonschema.protocols import Validator as Validator from jsonschema.validators import ( Draft3Validator as Draft3Validator, Draft4Validator as Draft4Validator, Draft6Validator as Draft6Validator, Draft7Validator as Draft7Validator, + Draft201909Validator as Draft201909Validator, + Draft202012Validator as Draft202012Validator, RefResolver as RefResolver, validate as validate, ) diff --git a/stubs/jsonschema/jsonschema/_format.pyi b/stubs/jsonschema/jsonschema/_format.pyi index fdab126..2f3df1b 100644 --- a/stubs/jsonschema/jsonschema/_format.pyi +++ b/stubs/jsonschema/jsonschema/_format.pyi @@ -1,35 +1,50 @@ -from typing import Any +from collections.abc import Callable, Iterable +from typing import TypeVar, Union +from typing_extensions import TypeAlias + +_FormatCheckCallable: TypeAlias = Callable[[object], bool] +_F = TypeVar("_F", bound=_FormatCheckCallable) +_RaisesType: TypeAlias = Union[type[Exception], tuple[type[Exception], ...]] class FormatChecker: - checkers: Any - def __init__(self, formats: Any | None = ...) -> None: ... - def checks(self, format, raises=...): ... - cls_checks: Any - def check(self, instance, format) -> None: ... - def conforms(self, instance, format): ... + checkers: dict[str, tuple[_FormatCheckCallable, _RaisesType]] + + def __init__(self, formats: Iterable[str] | None = ...) -> None: ... + def checks(self, format: str, raises: _RaisesType = ...) -> Callable[[_F], _F]: ... + @classmethod + def cls_checks(cls, format: str, raises: _RaisesType = ...) -> Callable[[_F], _F]: ... + def check(self, instance: object, format: str) -> None: ... + def conforms(self, instance: object, format: str) -> bool: ... + +draft3_format_checker: FormatChecker +draft4_format_checker: FormatChecker +draft6_format_checker: FormatChecker +draft7_format_checker: FormatChecker +draft201909_format_checker: FormatChecker +draft202012_format_checker: FormatChecker + +def is_email(instance: object) -> bool: ... +def is_ipv4(instance: object) -> bool: ... +def is_ipv6(instance: object) -> bool: ... -draft3_format_checker: Any -draft4_format_checker: Any -draft6_format_checker: Any -draft7_format_checker: Any +# is_host_name is only defined if fqdn is installed. +def is_host_name(instance: object) -> bool: ... +def is_idn_host_name(instance: object) -> bool: ... +def is_uri(instance: object) -> bool: ... +def is_uri_reference(instance: object) -> bool: ... +def is_iri(instance: object) -> bool: ... +def is_iri_reference(instance: object) -> bool: ... +def is_datetime(instance: object) -> bool: ... +def is_time(instance: object) -> bool: ... +def is_regex(instance: object) -> bool: ... +def is_date(instance: object) -> bool: ... +def is_draft3_time(instance: object) -> bool: ... +def is_css_color_code(instance: object) -> bool: ... +def is_css21_color(instance: object) -> bool: ... +def is_json_pointer(instance: object) -> bool: ... +def is_relative_json_pointer(instance: object) -> bool: ... +def is_uri_template(instance: object) -> bool: ... -def is_email(instance): ... -def is_ipv4(instance): ... -def is_ipv6(instance): ... -def is_host_name(instance): ... -def is_idn_host_name(instance): ... -def is_uri(instance): ... -def is_uri_reference(instance): ... -def is_iri(instance): ... -def is_iri_reference(instance): ... -def is_datetime(instance): ... -def is_time(instance): ... -def is_regex(instance): ... -def is_date(instance): ... -def is_draft3_time(instance): ... -def is_css_color_code(instance): ... -def is_css21_color(instance): ... -def is_css3_color(instance): ... -def is_json_pointer(instance): ... -def is_relative_json_pointer(instance): ... -def is_uri_template(instance, template_validator=...): ... +# is_duration is only defined if isoduration is installed. +def is_duration(instance: object) -> bool: ... +def is_uuid(instance: object) -> bool: ... diff --git a/stubs/jsonschema/jsonschema/_legacy_validators.pyi b/stubs/jsonschema/jsonschema/_legacy_validators.pyi index 40e6189..783d3e5 100644 --- a/stubs/jsonschema/jsonschema/_legacy_validators.pyi +++ b/stubs/jsonschema/jsonschema/_legacy_validators.pyi @@ -1,8 +1,16 @@ +from collections.abc import ItemsView +from typing import Any + +def ignore_ref_siblings(schema) -> list[tuple[str, Any]] | ItemsView[str, Any]: ... def dependencies_draft3(validator, dependencies, instance, schema) -> None: ... +def dependencies_draft4_draft6_draft7(validator, dependencies, instance, schema) -> None: ... def disallow_draft3(validator, disallow, instance, schema) -> None: ... def extends_draft3(validator, extends, instance, schema) -> None: ... def items_draft3_draft4(validator, items, instance, schema) -> None: ... +def items_draft6_draft7_draft201909(validator, items, instance, schema) -> None: ... def minimum_draft3_draft4(validator, minimum, instance, schema) -> None: ... def maximum_draft3_draft4(validator, maximum, instance, schema) -> None: ... def properties_draft3(validator, properties, instance, schema) -> None: ... def type_draft3(validator, types, instance, schema) -> None: ... +def contains_draft6_draft7(validator, contains, instance, schema) -> None: ... +def recursiveRef(validator, recursiveRef, instance, schema) -> None: ... diff --git a/stubs/jsonschema/jsonschema/_reflect.pyi b/stubs/jsonschema/jsonschema/_reflect.pyi deleted file mode 100644 index a19c6f9..0000000 --- a/stubs/jsonschema/jsonschema/_reflect.pyi +++ /dev/null @@ -1,7 +0,0 @@ -class _NoModuleFound(Exception): ... -class InvalidName(ValueError): ... -class ModuleNotFound(InvalidName): ... -class ObjectNotFound(InvalidName): ... - -def reraise(exception, traceback) -> None: ... -def namedAny(name): ... diff --git a/stubs/jsonschema/jsonschema/_types.pyi b/stubs/jsonschema/jsonschema/_types.pyi index efbe6ba..2a3641d 100644 --- a/stubs/jsonschema/jsonschema/_types.pyi +++ b/stubs/jsonschema/jsonschema/_types.pyi @@ -1,26 +1,24 @@ -from typing import Any +from collections.abc import Callable, Iterable, Mapping -def is_array(checker, instance): ... -def is_bool(checker, instance): ... -def is_integer(checker, instance): ... -def is_null(checker, instance): ... -def is_number(checker, instance): ... -def is_object(checker, instance): ... -def is_string(checker, instance): ... -def is_any(checker, instance): ... +def is_array(checker, instance) -> bool: ... +def is_bool(checker, instance) -> bool: ... +def is_integer(checker, instance) -> bool: ... +def is_null(checker, instance) -> bool: ... +def is_number(checker, instance) -> bool: ... +def is_object(checker, instance) -> bool: ... +def is_string(checker, instance) -> bool: ... +def is_any(checker, instance) -> bool: ... class TypeChecker: - def is_type(self, instance, type): ... - def redefine(self, type, fn): ... - def redefine_many(self, definitions=...): ... - def remove(self, *types): ... - def __init__(self, type_checkers=...) -> None: ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __gt__(self, other): ... - def __ge__(self, other): ... + def __init__(self, type_checkers: Mapping[str, Callable[[object], bool]] = ...) -> None: ... + def is_type(self, instance, type: str) -> bool: ... + def redefine(self, type: str, fn: Callable[..., bool]) -> TypeChecker: ... + def redefine_many(self, definitions=...) -> TypeChecker: ... + def remove(self, *types: Iterable[str]) -> TypeChecker: ... -draft3_type_checker: Any -draft4_type_checker: Any -draft6_type_checker: Any -draft7_type_checker: Any +draft3_type_checker: TypeChecker +draft4_type_checker: TypeChecker +draft6_type_checker: TypeChecker +draft7_type_checker: TypeChecker +draft201909_type_checker: TypeChecker +draft202012_type_checker: TypeChecker diff --git a/stubs/jsonschema/jsonschema/_utils.pyi b/stubs/jsonschema/jsonschema/_utils.pyi index 596ec64..7e5720e 100644 --- a/stubs/jsonschema/jsonschema/_utils.pyi +++ b/stubs/jsonschema/jsonschema/_utils.pyi @@ -1,25 +1,26 @@ -from typing import Any, MutableMapping +from _typeshed import SupportsKeysAndGetItem +from collections.abc import Generator, Iterable, Iterator, Mapping, MutableMapping, Sized +from typing import Any -class URIDict(MutableMapping[Any, Any]): - def normalize(self, uri): ... - store: Any - def __init__(self, *args, **kwargs) -> None: ... - def __getitem__(self, uri): ... - def __setitem__(self, uri, value) -> None: ... - def __delitem__(self, uri) -> None: ... - def __iter__(self): ... - def __len__(self): ... +class URIDict(MutableMapping[str, str]): + def normalize(self, uri: str) -> str: ... + store: dict[str, str] + def __init__(self, __m: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]], **kwargs: str) -> None: ... + def __getitem__(self, uri: str) -> str: ... + def __setitem__(self, uri: str, value: str) -> None: ... + def __delitem__(self, uri: str) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... class Unset: ... def load_schema(name): ... -def indent(string, times: int = ...): ... -def format_as_index(indices): ... -def find_additional_properties(instance, schema) -> None: ... -def extras_msg(extras): ... -def types_msg(instance, types): ... -def flatten(suitable_for_isinstance): ... -def ensure_list(thing): ... -def equal(one, two): ... +def format_as_index(container: str, indices) -> str: ... +def find_additional_properties(instance: Iterable[Any], schema: Mapping[Any, Any]) -> Generator[Any, None, None]: ... +def extras_msg(extras: Iterable[Any] | Sized) -> str: ... +def ensure_list(thing) -> list[Any]: ... +def equal(one, two) -> bool: ... def unbool(element, true=..., false=...): ... -def uniq(container): ... +def uniq(container) -> bool: ... +def find_evaluated_item_indexes_by_schema(validator, instance, schema) -> list[Any]: ... +def find_evaluated_property_keys_by_schema(validator, instance, schema) -> list[Any]: ... diff --git a/stubs/jsonschema/jsonschema/_validators.pyi b/stubs/jsonschema/jsonschema/_validators.pyi index 8afcc3c..f6daf12 100644 --- a/stubs/jsonschema/jsonschema/_validators.pyi +++ b/stubs/jsonschema/jsonschema/_validators.pyi @@ -17,9 +17,11 @@ def pattern(validator, patrn, instance, schema) -> None: ... def format(validator, format, instance, schema) -> None: ... def minLength(validator, mL, instance, schema) -> None: ... def maxLength(validator, mL, instance, schema) -> None: ... -def dependencies(validator, dependencies, instance, schema) -> None: ... +def dependentRequired(validator, dependentRequired, instance, schema) -> None: ... +def dependentSchemas(validator, dependentSchemas, instance, schema) -> None: ... def enum(validator, enums, instance, schema) -> None: ... def ref(validator, ref, instance, schema) -> None: ... +def dynamicRef(validator, dynamicRef, instance, schema) -> None: ... def type(validator, types, instance, schema) -> None: ... def properties(validator, properties, instance, schema) -> None: ... def required(validator, required, instance, schema) -> None: ... @@ -30,3 +32,6 @@ def anyOf(validator, anyOf, instance, schema) -> None: ... def oneOf(validator, oneOf, instance, schema) -> None: ... def not_(validator, not_schema, instance, schema) -> None: ... def if_(validator, if_schema, instance, schema) -> None: ... +def unevaluatedItems(validator, unevaluatedItems, instance, schema) -> None: ... +def unevaluatedProperties(validator, unevaluatedProperties, instance, schema) -> None: ... +def prefixItems(validator, prefixItems, instance, schema) -> None: ... diff --git a/stubs/jsonschema/jsonschema/cli.pyi b/stubs/jsonschema/jsonschema/cli.pyi index 1ccff3f..85c3bd7 100644 --- a/stubs/jsonschema/jsonschema/cli.pyi +++ b/stubs/jsonschema/jsonschema/cli.pyi @@ -1,10 +1,32 @@ from typing import Any -from jsonschema._reflect import namedAny as namedAny -from jsonschema.validators import validator_for as validator_for +class _CannotLoadFile(Exception): ... + +class _Outputter: + def __init__(self, formatter, stdout, stderr): ... + @classmethod + def from_arguments(cls, arguments, stdout, stderr): ... + def load(self, path): ... + def filenotfound_error(self, **kwargs) -> None: ... + def parsing_error(self, **kwargs) -> None: ... + def validation_error(self, **kwargs) -> None: ... + def validation_success(self, **kwargs) -> None: ... + +class _PrettyFormatter: + def filenotfound_error(self, path, exc_info): ... + def parsing_error(self, path, exc_info): ... + def validation_error(self, instance_path, error): ... + def validation_success(self, instance_path): ... + +class _PlainFormatter: + def __init__(self, error_format): ... + def filenotfound_error(self, path, exc_info): ... + def parsing_error(self, path, exc_info): ... + def validation_error(self, instance_path, error): ... + def validation_success(self, instance_path): ... parser: Any def parse_args(args): ... def main(args=...) -> None: ... -def run(arguments, stdout=..., stderr=...): ... +def run(arguments, stdout=..., stderr=..., stdin=...): ... diff --git a/stubs/jsonschema/jsonschema/exceptions.pyi b/stubs/jsonschema/jsonschema/exceptions.pyi index 078d44b..bec519b 100644 --- a/stubs/jsonschema/jsonschema/exceptions.pyi +++ b/stubs/jsonschema/jsonschema/exceptions.pyi @@ -1,67 +1,76 @@ +from _typeshed import Self, SupportsRichComparison +from collections import deque +from collections.abc import Callable, Container, Iterable, Sequence from typing import Any +from typing_extensions import TypeAlias -WEAK_MATCHES: Any -STRONG_MATCHES: Any +from jsonschema import _utils, protocols +from jsonschema._types import TypeChecker + +_RelevanceFuncType: TypeAlias = Callable[[ValidationError], SupportsRichComparison] + +WEAK_MATCHES: frozenset[str] +STRONG_MATCHES: frozenset[str] class _Error(Exception): - message: Any - path: Any - schema_path: Any - context: Any - cause: Any - validator: Any + message: str + path: deque[str | int] + relative_path: deque[str | int] + schema_path: deque[str | int] + relative_schema_path: deque[str | int] + context: list[ValidationError] | None + cause: Exception | None + validator: protocols.Validator | None validator_value: Any instance: Any schema: Any - parent: Any + parent: _Error | None def __init__( self, - message, - validator=..., - path=..., + message: str, + validator: _utils.Unset | None | protocols.Validator = ..., + path: Sequence[str | int] = ..., cause: Any | None = ..., - context=..., + context: Sequence[ValidationError] = ..., validator_value=..., - instance=..., - schema=..., - schema_path=..., - parent: Any | None = ..., + instance: Any = ..., + schema: Any = ..., + schema_path: Sequence[str | int] = ..., + parent: _Error | None = ..., + type_checker: _utils.Unset | TypeChecker = ..., ) -> None: ... - def __unicode__(self): ... @classmethod - def create_from(cls, other): ... + def create_from(cls: type[Self], other: _Error) -> Self: ... + @property + def absolute_path(self) -> Sequence[str | int]: ... @property - def absolute_path(self): ... + def absolute_schema_path(self) -> Sequence[str | int]: ... @property - def absolute_schema_path(self): ... + def json_path(self) -> str: ... + # TODO: this type could be made more precise using TypedDict to + # enumerate the types of the members + def _contents(self) -> dict[str, Any]: ... class ValidationError(_Error): ... class SchemaError(_Error): ... class RefResolutionError(Exception): - def __init__(self, cause) -> None: ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __gt__(self, other): ... - def __ge__(self, other): ... + def __init__(self, cause: str) -> None: ... class UndefinedTypeCheck(Exception): type: Any def __init__(self, type) -> None: ... - def __unicode__(self): ... class UnknownType(Exception): type: Any instance: Any schema: Any def __init__(self, type, instance, schema) -> None: ... - def __unicode__(self): ... class FormatError(Exception): message: Any cause: Any def __init__(self, message, cause: Any | None = ...) -> None: ... - def __unicode__(self): ... class ErrorTree: errors: Any @@ -74,8 +83,8 @@ class ErrorTree: @property def total_errors(self): ... -def by_relevance(weak=..., strong=...): ... +def by_relevance(weak: Container[str] = ..., strong: Container[str] = ...) -> _RelevanceFuncType: ... -relevance: Any +relevance: _RelevanceFuncType -def best_match(errors, key=...): ... +def best_match(errors: Iterable[ValidationError], key: _RelevanceFuncType = ...): ... diff --git a/stubs/jsonschema/jsonschema/protocols.pyi b/stubs/jsonschema/jsonschema/protocols.pyi new file mode 100644 index 0000000..10e03da --- /dev/null +++ b/stubs/jsonschema/jsonschema/protocols.pyi @@ -0,0 +1,24 @@ +from collections.abc import Iterator +from typing import Any, ClassVar, Protocol + +from jsonschema._format import FormatChecker +from jsonschema._types import TypeChecker +from jsonschema.exceptions import ValidationError +from jsonschema.validators import RefResolver + +class Validator(Protocol): + META_SCHEMA: ClassVar[dict[Any, Any]] + VALIDATORS: ClassVar[dict[Any, Any]] + TYPE_CHECKER: ClassVar[TypeChecker] + FORMAT_CHECKER: ClassVar[FormatChecker] + schema: dict[Any, Any] | bool + def __init__( + self, schema: dict[Any, Any] | bool, resolver: RefResolver | None = ..., format_checker: FormatChecker | None = ... + ) -> None: ... + @classmethod + def check_schema(cls, schema: dict[Any, Any]) -> None: ... + def is_type(self, instance: Any, type: str) -> bool: ... + def is_valid(self, instance: dict[Any, Any]) -> bool: ... + def iter_errors(self, instance: dict[Any, Any]) -> Iterator[ValidationError]: ... + def validate(self, instance: dict[Any, Any]) -> None: ... + def evolve(self, **kwargs) -> Validator: ... diff --git a/stubs/jsonschema/jsonschema/validators.pyi b/stubs/jsonschema/jsonschema/validators.pyi index b9a078e..5ffc02c 100644 --- a/stubs/jsonschema/jsonschema/validators.pyi +++ b/stubs/jsonschema/jsonschema/validators.pyi @@ -1,62 +1,100 @@ -from typing import Any +from _typeshed import Incomplete, SupportsKeysAndGetItem +from collections.abc import Callable, Generator, Iterable, Iterator, Mapping +from contextlib import contextmanager +from typing import Any, ClassVar +from typing_extensions import TypeAlias -from jsonschema import exceptions as exceptions -from jsonschema.exceptions import ErrorTree as ErrorTree +from ._format import FormatChecker +from ._types import TypeChecker +from ._utils import Unset, URIDict +from .exceptions import ValidationError -class _DontDoThat(Exception): ... +# these type aliases do not exist at runtime, they're only defined here in the stub +_JsonObject: TypeAlias = Mapping[str, Any] +_JsonValue: TypeAlias = _JsonObject | list[Any] | str | int | float | bool | None +_ValidatorCallback: TypeAlias = Callable[[Any, Any, _JsonValue, _JsonObject], Iterator[ValidationError]] -validators: Any -meta_schemas: Any +_Schema: TypeAlias = Mapping[str, Any] -def validates(version): ... - -class _DefaultTypesDeprecatingMetaClass(type): - DEFAULT_TYPES: Any +# This class does not exist at runtime. Compatible classes are created at +# runtime by create(). +class _Validator: + VALIDATORS: ClassVar[dict[Any, Any]] + META_SCHEMA: ClassVar[dict[Any, Any]] + TYPE_CHECKER: ClassVar[Any] + FORMAT_CHECKER: ClassVar[Any] + @staticmethod + def ID_OF(schema: _Schema) -> str: ... + schema: _Schema + resolver: Any + format_checker: Any + evolve: Any + def __init__(self, schema: _Schema, resolver: Any | None = ..., format_checker: Any | None = ...) -> None: ... + @classmethod + def check_schema(cls, schema: _Schema, format_checker: FormatChecker | Unset = ...) -> None: ... + def iter_errors(self, instance, _schema: _Schema | None = ...) -> Generator[Any, None, None]: ... + def descend( + self, instance, schema: _Schema, path: Any | None = ..., schema_path: Any | None = ... + ) -> Generator[Any, None, None]: ... + def validate(self, *args, **kwargs) -> None: ... + def is_type(self, instance, type): ... + def is_valid(self, instance, _schema: _Schema | None = ...) -> bool: ... +def validates(version: str) -> Callable[..., Any]: ... def create( - meta_schema, - validators=..., + meta_schema: _Schema, + validators: Mapping[str, _ValidatorCallback] | tuple[()] = ..., version: Any | None = ..., - default_types: Any | None = ..., - type_checker: Any | None = ..., - id_of=..., + type_checker: TypeChecker = ..., + format_checker: FormatChecker = ..., + id_of: Callable[[_Schema], str] = ..., + applicable_validators: Callable[[_Schema], Iterable[tuple[str, _ValidatorCallback]]] = ..., +) -> type[_Validator]: ... +def extend( + validator, validators=..., version: Any | None = ..., type_checker: Any | None = ..., format_checker: Any | None = ... ): ... -def extend(validator, validators=..., version: Any | None = ..., type_checker: Any | None = ...): ... -Draft3Validator: Any -Draft4Validator: Any -Draft6Validator: Any -Draft7Validator: Any +# At runtime these are fields that are assigned the return values of create() calls. +class Draft3Validator(_Validator): ... +class Draft4Validator(_Validator): ... +class Draft6Validator(_Validator): ... +class Draft7Validator(_Validator): ... +class Draft201909Validator(_Validator): ... +class Draft202012Validator(_Validator): ... + +_Handler: TypeAlias = Callable[[str], Any] class RefResolver: - referrer: Any + referrer: dict[str, Any] cache_remote: Any - handlers: Any - store: Any + handlers: dict[str, _Handler] + store: URIDict def __init__( self, - base_uri, - referrer, - store=..., + base_uri: str, + referrer: dict[str, Any], + store: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]] = ..., cache_remote: bool = ..., - handlers=..., + handlers: SupportsKeysAndGetItem[str, _Handler] | Iterable[tuple[str, _Handler]] = ..., urljoin_cache: Any | None = ..., remote_cache: Any | None = ..., ) -> None: ... @classmethod - def from_schema(cls, schema, id_of=..., *args, **kwargs): ... + def from_schema(cls, schema: _Schema, id_of=..., *args, **kwargs): ... def push_scope(self, scope) -> None: ... def pop_scope(self) -> None: ... @property def resolution_scope(self): ... @property def base_uri(self): ... - def in_scope(self, scope) -> None: ... - def resolving(self, ref) -> None: ... + @contextmanager + def in_scope(self, scope) -> Generator[None, None, None]: ... + @contextmanager + def resolving(self, ref) -> Generator[Incomplete, None, None]: ... def resolve(self, ref): ... def resolve_from_url(self, url): ... def resolve_fragment(self, document, fragment): ... def resolve_remote(self, uri): ... -def validate(instance, schema, cls: Any | None = ..., *args, **kwargs) -> None: ... -def validator_for(schema, default=...): ... +def validate(instance: object, schema: _Schema, cls: type[_Validator] | None = ..., *args: Any, **kwargs: Any) -> None: ... +def validator_for(schema: _Schema | bool, default=...): ... diff --git a/stubs/keyboard/@tests/stubtest_allowlist.txt b/stubs/keyboard/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..d8684a1 --- /dev/null +++ b/stubs/keyboard/@tests/stubtest_allowlist.txt @@ -0,0 +1,8 @@ +# scan_code *should* never be None in real use. This is also according to docs. +keyboard.KeyboardEvent.scan_code +keyboard._keyboard_event.KeyboardEvent.scan_code +# Defaults don't align with possible values +keyboard.mouse.on_button +keyboard.mouse.wait +# TODO: Should this be allowlisted? +keyboard.__main__ diff --git a/stubs/keyboard/METADATA.toml b/stubs/keyboard/METADATA.toml new file mode 100644 index 0000000..18912b6 --- /dev/null +++ b/stubs/keyboard/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.13.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/keyboard/keyboard/__init__.pyi b/stubs/keyboard/keyboard/__init__.pyi new file mode 100644 index 0000000..bfc19bc --- /dev/null +++ b/stubs/keyboard/keyboard/__init__.pyi @@ -0,0 +1,114 @@ +from collections.abc import Callable, Generator, Iterable, Sequence +from queue import Queue +from threading import Event as _UninterruptibleEvent +from typing import Optional +from typing_extensions import TypeAlias + +from ._canonical_names import all_modifiers as all_modifiers, sided_modifiers as sided_modifiers +from ._keyboard_event import KEY_DOWN as KEY_DOWN, KEY_UP as KEY_UP, KeyboardEvent as KeyboardEvent + +_Key: TypeAlias = int | str +_ScanCodeList: TypeAlias = list[int] | tuple[int, ...] +_ParseableHotkey: TypeAlias = _Key | list[int | _ScanCodeList] | tuple[int | _ScanCodeList, ...] +_Callback: TypeAlias = Callable[[KeyboardEvent], Optional[bool]] | Callable[[], Optional[bool]] +# mypy doesn't support PEP 646's TypeVarTuple yet: https://github.com/python/mypy/issues/12280 +# _Ts = TypeVarTuple("_Ts") +_Ts: TypeAlias = tuple[object, ...] + +version: str + +class _Event(_UninterruptibleEvent): + def wait(self) -> None: ... # type: ignore[override] # Actual implementation + +def is_modifier(key: _Key | None) -> bool: ... +def key_to_scan_codes(key: _ParseableHotkey, error_if_missing: bool = ...) -> tuple[int, ...]: ... +def parse_hotkey(hotkey: _ParseableHotkey) -> tuple[tuple[tuple[int, ...], ...], ...]: ... +def send(hotkey: _ParseableHotkey, do_press: bool = ..., do_release: bool = ...) -> None: ... + +press_and_release = send + +def press(hotkey: _ParseableHotkey) -> None: ... +def release(hotkey: _ParseableHotkey) -> None: ... + +# is_pressed cannot check multi-step hotkeys, so not using _ParseableHotkey + +def is_pressed(hotkey: _Key | _ScanCodeList) -> bool: ... +def call_later(fn: Callable[..., None], args: _Ts = ..., delay: float = ...) -> None: ... +def hook(callback: _Callback, suppress: bool = ..., on_remove: Callable[[], None] = ...) -> Callable[[], None]: ... +def on_press(callback: _Callback, suppress: bool = ...) -> Callable[[], None]: ... +def on_release(callback: _Callback, suppress: bool = ...) -> Callable[[], None]: ... +def hook_key(key: _ParseableHotkey, callback: _Callback, suppress: bool = ...) -> Callable[[], None]: ... +def on_press_key(key: _ParseableHotkey, callback: _Callback, suppress: bool = ...) -> Callable[[], None]: ... +def on_release_key(key: _ParseableHotkey, callback: _Callback, suppress: bool = ...) -> Callable[[], None]: ... +def unhook(remove: _Callback) -> None: ... + +unhook_key = unhook + +def unhook_all() -> None: ... +def block_key(key: _ParseableHotkey) -> Callable[[], None]: ... + +unblock_key = unhook_key + +def remap_key(src: _ParseableHotkey, dst: _ParseableHotkey) -> Callable[[], None]: ... + +unremap_key = unhook_key + +def parse_hotkey_combinations(hotkey: _ParseableHotkey) -> tuple[tuple[tuple[int, ...], ...], ...]: ... +def add_hotkey( + hotkey: _ParseableHotkey, + callback: Callable[..., bool | None], + args: _Ts = ..., + suppress: bool = ..., + timeout: float = ..., + trigger_on_release: bool = ..., +) -> Callable[[], None]: ... + +register_hotkey = add_hotkey + +def remove_hotkey(hotkey_or_callback: _ParseableHotkey | _Callback) -> None: ... + +unregister_hotkey = remove_hotkey +clear_hotkey = remove_hotkey + +def unhook_all_hotkeys() -> None: ... + +unregister_all_hotkeys = unhook_all_hotkeys +remove_all_hotkeys = unhook_all_hotkeys +clear_all_hotkeys = unhook_all_hotkeys + +def remap_hotkey( + src: _ParseableHotkey, dst: _ParseableHotkey, suppress: bool = ..., trigger_on_release: bool = ... +) -> Callable[[], None]: ... + +unremap_hotkey = remove_hotkey + +def stash_state() -> list[int]: ... +def restore_state(scan_codes: Iterable[int]) -> None: ... +def restore_modifiers(scan_codes: Iterable[int]) -> None: ... +def write(text: str, delay: float = ..., restore_state_after: bool = ..., exact: bool | None = ...) -> None: ... +def wait(hotkey: _ParseableHotkey | None = ..., suppress: bool = ..., trigger_on_release: bool = ...) -> None: ... +def get_hotkey_name(names: Iterable[str] | None = ...) -> str: ... +def read_event(suppress: bool = ...) -> KeyboardEvent: ... +def read_key(suppress: bool = ...) -> _Key: ... +def read_hotkey(suppress: bool = ...) -> str: ... +def get_typed_strings(events: Iterable[KeyboardEvent], allow_backspace: bool = ...) -> Generator[str, None, None]: ... +def start_recording( + recorded_events_queue: Queue[KeyboardEvent] | None = ..., +) -> tuple[Queue[KeyboardEvent], Callable[[], None]]: ... +def stop_recording() -> list[KeyboardEvent]: ... +def record(until: str = ..., suppress: bool = ..., trigger_on_release: bool = ...) -> list[KeyboardEvent]: ... +def play(events: Iterable[KeyboardEvent], speed_factor: float = ...) -> None: ... + +replay = play + +def add_word_listener( + word: str, callback: _Callback, triggers: Sequence[str] = ..., match_suffix: bool = ..., timeout: float = ... +) -> Callable[[], None]: ... +def remove_word_listener(word_or_handler: str | _Callback) -> None: ... +def add_abbreviation( + source_text: str, replacement_text: str, match_suffix: bool = ..., timeout: float = ... +) -> Callable[[], None]: ... + +register_word_listener = add_word_listener +register_abbreviation = add_abbreviation +remove_abbreviation = remove_word_listener diff --git a/stubs/keyboard/keyboard/_canonical_names.pyi b/stubs/keyboard/keyboard/_canonical_names.pyi new file mode 100644 index 0000000..8a0c3a0 --- /dev/null +++ b/stubs/keyboard/keyboard/_canonical_names.pyi @@ -0,0 +1,5 @@ +canonical_names: dict[str, str] +sided_modifiers: set[str] +all_modifiers: set[str] + +def normalize_name(name: str) -> str: ... diff --git a/stubs/keyboard/keyboard/_generic.pyi b/stubs/keyboard/keyboard/_generic.pyi new file mode 100644 index 0000000..21f74b9 --- /dev/null +++ b/stubs/keyboard/keyboard/_generic.pyi @@ -0,0 +1,24 @@ +from collections.abc import Callable +from queue import Queue +from threading import Lock, Thread +from typing import ClassVar +from typing_extensions import Literal, TypeAlias + +from ._keyboard_event import KeyboardEvent +from ._mouse_event import _MouseEvent + +_Event: TypeAlias = KeyboardEvent | _MouseEvent + +class GenericListener: + lock: ClassVar[Lock] + handlers: list[Callable[[_Event], bool | None]] + listening: bool + queue: Queue[_Event] + listening_thread: Thread | None + processing_thread: Thread | None + def invoke_handlers(self, event: _Event) -> Literal[1] | None: ... + def start_if_necessary(self) -> None: ... + def pre_process_event(self, event: _Event) -> None: ... + def process(self) -> None: ... + def add_handler(self, handler: Callable[[_Event], bool | None]) -> None: ... + def remove_handler(self, handler: Callable[[_Event], bool | None]) -> None: ... diff --git a/stubs/keyboard/keyboard/_keyboard_event.pyi b/stubs/keyboard/keyboard/_keyboard_event.pyi new file mode 100644 index 0000000..9c511fd --- /dev/null +++ b/stubs/keyboard/keyboard/_keyboard_event.pyi @@ -0,0 +1,28 @@ +from typing_extensions import Literal + +from ._canonical_names import canonical_names as canonical_names, normalize_name as normalize_name + +KEY_DOWN: Literal["down"] +KEY_UP: Literal["up"] + +class KeyboardEvent: + event_type: Literal["down", "up"] | None + scan_code: int + name: str | None + time: float | None + device: str | None + modifiers: tuple[str, ...] | None + is_keypad: bool | None + + def __init__( + self, + event_type: Literal["down", "up"] | None, + scan_code: int, + name: str | None = ..., + time: float | None = ..., + device: str | None = ..., + modifiers: tuple[str, ...] | None = ..., + is_keypad: bool | None = ..., + ) -> None: ... + def to_json(self, ensure_ascii: bool = ...) -> str: ... + def __eq__(self, other: object) -> bool: ... diff --git a/stubs/keyboard/keyboard/_mouse_event.pyi b/stubs/keyboard/keyboard/_mouse_event.pyi new file mode 100644 index 0000000..479fe4c --- /dev/null +++ b/stubs/keyboard/keyboard/_mouse_event.pyi @@ -0,0 +1,43 @@ +import sys +from typing import NamedTuple +from typing_extensions import Literal, TypeAlias + +_MouseEvent: TypeAlias = ButtonEvent | WheelEvent | MoveEvent # noqa: Y047 # Used outside + +LEFT: Literal["left"] +RIGHT: Literal["right"] +MIDDLE: Literal["middle"] +X: Literal["x"] +X2: Literal["x2"] + +UP: Literal["up"] +DOWN: Literal["down"] +DOUBLE: Literal["double"] +WHEEL: Literal["wheel"] + +VERTICAL: Literal["vertical"] +HORIZONTAL: Literal["horizontal"] + +if sys.platform == "linux" or sys.platform == "win32": + _MouseButton: TypeAlias = Literal["left", "right", "middle", "x", "x2"] +else: + _MouseButton: TypeAlias = Literal["left", "right", "middle"] + +if sys.platform == "win32": + _MouseEventType: TypeAlias = Literal["up", "down", "double", "wheel"] +else: + _MouseEventType: TypeAlias = Literal["up", "down"] + +class ButtonEvent(NamedTuple): + event_type: _MouseEventType + button: _MouseButton + time: float + +class WheelEvent(NamedTuple): + delta: int + time: float + +class MoveEvent(NamedTuple): + x: int + y: int + time: float diff --git a/stubs/keyboard/keyboard/mouse.pyi b/stubs/keyboard/keyboard/mouse.pyi new file mode 100644 index 0000000..48a10d2 --- /dev/null +++ b/stubs/keyboard/keyboard/mouse.pyi @@ -0,0 +1,78 @@ +import sys +from collections.abc import Callable, Iterable +from ctypes import c_long +from typing import SupportsInt, TypeVar +from typing_extensions import Literal, TypeAlias + +from ._generic import GenericListener as _GenericListener +from ._mouse_event import ( + DOUBLE as DOUBLE, + DOWN as DOWN, + LEFT as LEFT, + MIDDLE as MIDDLE, + RIGHT as RIGHT, + UP as UP, + X2 as X2, + ButtonEvent as ButtonEvent, + MoveEvent as MoveEvent, + WheelEvent as WheelEvent, + X as X, + _MouseButton, + _MouseEvent, + _MouseEventType, +) + +# mypy doesn't support PEP 646's TypeVarTuple yet: https://github.com/python/mypy/issues/12280 +# _Ts = TypeVarTuple("_Ts") +_Ts: TypeAlias = tuple[object, ...] +_Callback: TypeAlias = Callable[[_MouseEvent], bool | None] +_C = TypeVar("_C", bound=_Callback) + +class _MouseListener(_GenericListener): + def init(self) -> None: ... + def pre_process_event( # type: ignore[override] # Mouse specific events and return + self, event: _MouseEvent + ) -> Literal[True]: ... + def listen(self) -> None: ... + +def is_pressed(button: _MouseButton = ...) -> bool: ... +def press(button: _MouseButton = ...) -> None: ... +def release(button: _MouseButton = ...) -> None: ... +def click(button: _MouseButton = ...) -> None: ... +def double_click(button: _MouseButton = ...) -> None: ... +def right_click() -> None: ... +def wheel(delta: int = ...) -> None: ... +def move(x: SupportsInt, y: SupportsInt, absolute: bool = ..., duration: float = ...) -> None: ... +def drag(start_x: int, start_y: int, end_x: int, end_y: int, absolute: bool = ..., duration: float = ...) -> None: ... +def on_button( + callback: Callable[..., None], + args: _Ts = ..., + buttons: list[_MouseButton] | tuple[_MouseButton, ...] | _MouseButton = ..., + types: list[_MouseEventType] | tuple[_MouseEventType, ...] | _MouseEventType = ..., +) -> _Callback: ... +def on_click(callback: Callable[..., None], args: _Ts = ...) -> _Callback: ... +def on_double_click(callback: Callable[..., None], args: _Ts = ...) -> _Callback: ... +def on_right_click(callback: Callable[..., None], args: _Ts = ...) -> _Callback: ... +def on_middle_click(callback: Callable[..., None], args: _Ts = ...) -> _Callback: ... +def wait(button: _MouseButton = ..., target_types: tuple[_MouseEventType] = ...) -> None: ... + +if sys.platform == "win32": + def get_position() -> tuple[c_long, c_long]: ... + +else: + def get_position() -> tuple[int, int]: ... + +def hook(callback: _C) -> _C: ... +def unhook(callback: _Callback) -> None: ... +def unhook_all() -> None: ... +def record(button: _MouseButton = ..., target_types: tuple[_MouseEventType] = ...) -> _MouseEvent: ... +def play( + events: Iterable[_MouseEvent], + speed_factor: float = ..., + include_clicks: bool = ..., + include_moves: bool = ..., + include_wheel: bool = ..., +) -> None: ... + +replay = play +hold = press diff --git a/stubs/ldap3/@tests/stubtest_allowlist.txt b/stubs/ldap3/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..71eb99d --- /dev/null +++ b/stubs/ldap3/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +ldap3.protocol.sasl.kerberos # requires gssapi package to import diff --git a/stubs/ldap3/METADATA.toml b/stubs/ldap3/METADATA.toml new file mode 100644 index 0000000..77ff570 --- /dev/null +++ b/stubs/ldap3/METADATA.toml @@ -0,0 +1,2 @@ +version = "2.9.*" +requires = [] # requires types-pyasn1 (not available yet) diff --git a/stubs/ldap3/ldap3/__init__.pyi b/stubs/ldap3/ldap3/__init__.pyi new file mode 100644 index 0000000..4e9d2ef --- /dev/null +++ b/stubs/ldap3/ldap3/__init__.pyi @@ -0,0 +1,104 @@ +from typing import Any +from typing_extensions import Literal + +from .abstract.attrDef import AttrDef as AttrDef +from .abstract.attribute import ( + Attribute as Attribute, + OperationalAttribute as OperationalAttribute, + WritableAttribute as WritableAttribute, +) +from .abstract.cursor import Reader as Reader, Writer as Writer +from .abstract.entry import Entry as Entry, WritableEntry as WritableEntry +from .abstract.objectDef import ObjectDef as ObjectDef +from .core.connection import Connection as Connection +from .core.pooling import ServerPool as ServerPool +from .core.rdns import ReverseDnsSetting as ReverseDnsSetting +from .core.server import Server as Server +from .core.tls import Tls as Tls +from .protocol.rfc4512 import DsaInfo as DsaInfo, SchemaInfo as SchemaInfo +from .utils.config import get_config_parameter as get_config_parameter, set_config_parameter as set_config_parameter +from .version import __description__ as __description__, __status__ as __status__, __url__ as __url__ + +ANONYMOUS: Literal["ANONYMOUS"] +SIMPLE: Literal["SIMPLE"] +SASL: Literal["SASL"] +NTLM: Literal["NTLM"] + +EXTERNAL: Literal["EXTERNAL"] +DIGEST_MD5: Literal["DIGEST-MD5"] +KERBEROS: Literal["GSSAPI"] +GSSAPI: Literal["GSSAPI"] +PLAIN: Literal["PLAIN"] + +AUTO_BIND_DEFAULT: Literal["DEFAULT"] +AUTO_BIND_NONE: Literal["NONE"] +AUTO_BIND_NO_TLS: Literal["NO_TLS"] +AUTO_BIND_TLS_BEFORE_BIND: Literal["TLS_BEFORE_BIND"] +AUTO_BIND_TLS_AFTER_BIND: Literal["TLS_AFTER_BIND"] + +IP_SYSTEM_DEFAULT: Literal["IP_SYSTEM_DEFAULT"] +IP_V4_ONLY: Literal["IP_V4_ONLY"] +IP_V6_ONLY: Literal["IP_V6_ONLY"] +IP_V4_PREFERRED: Literal["IP_V4_PREFERRED"] +IP_V6_PREFERRED: Literal["IP_V6_PREFERRED"] + +BASE: Literal["BASE"] +LEVEL: Literal["LEVEL"] +SUBTREE: Literal["SUBTREE"] + +DEREF_NEVER: Literal["NEVER"] +DEREF_SEARCH: Literal["SEARCH"] +DEREF_BASE: Literal["FINDING_BASE"] +DEREF_ALWAYS: Literal["ALWAYS"] + +ALL_ATTRIBUTES: Literal["*"] +NO_ATTRIBUTES: Literal["1.1"] +ALL_OPERATIONAL_ATTRIBUTES: Literal["+"] + +MODIFY_ADD: Literal["MODIFY_ADD"] +MODIFY_DELETE: Literal["MODIFY_DELETE"] +MODIFY_REPLACE: Literal["MODIFY_REPLACE"] +MODIFY_INCREMENT: Literal["MODIFY_INCREMENT"] + +SYNC: Literal["SYNC"] +SAFE_SYNC: Literal["SAFE_SYNC"] +SAFE_RESTARTABLE: Literal["SAFE_RESTARTABLE"] +ASYNC: Literal["ASYNC"] +LDIF: Literal["LDIF"] +RESTARTABLE: Literal["RESTARTABLE"] +REUSABLE: Literal["REUSABLE"] +MOCK_SYNC: Literal["MOCK_SYNC"] +MOCK_ASYNC: Literal["MOCK_ASYNC"] +ASYNC_STREAM: Literal["ASYNC_STREAM"] + +NONE: Literal["NO_INFO"] +DSA: Literal["DSA"] +SCHEMA: Literal["SCHEMA"] +ALL: Literal["ALL"] + +OFFLINE_EDIR_8_8_8: Literal["EDIR_8_8_8"] +OFFLINE_EDIR_9_1_4: Literal["EDIR_9_1_4"] +OFFLINE_AD_2012_R2: Literal["AD_2012_R2"] +OFFLINE_SLAPD_2_4: Literal["SLAPD_2_4"] +OFFLINE_DS389_1_3_3: Literal["DS389_1_3_3"] + +FIRST: Literal["FIRST"] +ROUND_ROBIN: Literal["ROUND_ROBIN"] +RANDOM: Literal["RANDOM"] + +HASHED_NONE: Literal["PLAIN"] +HASHED_SHA: Literal["SHA"] +HASHED_SHA256: Literal["SHA256"] +HASHED_SHA384: Literal["SHA384"] +HASHED_SHA512: Literal["SHA512"] +HASHED_MD5: Literal["MD5"] +HASHED_SALTED_SHA: Literal["SALTED_SHA"] +HASHED_SALTED_SHA256: Literal["SALTED_SHA256"] +HASHED_SALTED_SHA384: Literal["SALTED_SHA384"] +HASHED_SALTED_SHA512: Literal["SALTED_SHA512"] +HASHED_SALTED_MD5: Literal["SALTED_MD5"] + +NUMERIC_TYPES: tuple[type[Any], ...] +INTEGER_TYPES: tuple[type[Any], ...] +STRING_TYPES: tuple[type[Any], ...] +SEQUENCE_TYPES: tuple[type[Any], ...] diff --git a/stubs/ldap3/ldap3/abstract/__init__.pyi b/stubs/ldap3/ldap3/abstract/__init__.pyi new file mode 100644 index 0000000..5c2b1bd --- /dev/null +++ b/stubs/ldap3/ldap3/abstract/__init__.pyi @@ -0,0 +1,15 @@ +from typing import Any + +STATUS_INIT: str +STATUS_VIRTUAL: str +STATUS_MANDATORY_MISSING: str +STATUS_READ: str +STATUS_WRITABLE: str +STATUS_PENDING_CHANGES: str +STATUS_COMMITTED: str +STATUS_READY_FOR_DELETION: str +STATUS_READY_FOR_MOVING: str +STATUS_READY_FOR_RENAMING: str +STATUS_DELETED: str +STATUSES: Any +INITIAL_STATUSES: Any diff --git a/stubs/ldap3/ldap3/abstract/attrDef.pyi b/stubs/ldap3/ldap3/abstract/attrDef.pyi new file mode 100644 index 0000000..9802623 --- /dev/null +++ b/stubs/ldap3/ldap3/abstract/attrDef.pyi @@ -0,0 +1,33 @@ +from typing import Any + +class AttrDef: + name: Any + key: Any + validate: Any + pre_query: Any + post_query: Any + default: Any + dereference_dn: Any + description: Any + mandatory: Any + single_value: Any + oid_info: Any + other_names: Any + def __init__( + self, + name, + key: Any | None = ..., + validate: Any | None = ..., + pre_query: Any | None = ..., + post_query: Any | None = ..., + default=..., + dereference_dn: Any | None = ..., + description: Any | None = ..., + mandatory: bool = ..., + single_value: Any | None = ..., + alias: Any | None = ..., + ) -> None: ... + def __eq__(self, other): ... + def __lt__(self, other): ... + def __hash__(self): ... + def __setattr__(self, key, value) -> None: ... diff --git a/stubs/ldap3/ldap3/abstract/attribute.pyi b/stubs/ldap3/ldap3/abstract/attribute.pyi new file mode 100644 index 0000000..d5ed793 --- /dev/null +++ b/stubs/ldap3/ldap3/abstract/attribute.pyi @@ -0,0 +1,34 @@ +from typing import Any + +class Attribute: + key: Any + definition: Any + values: Any + raw_values: Any + response: Any + entry: Any + cursor: Any + other_names: Any + def __init__(self, attr_def, entry, cursor) -> None: ... + def __len__(self): ... + def __iter__(self): ... + def __getitem__(self, item): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + @property + def value(self): ... + +class OperationalAttribute(Attribute): ... + +class WritableAttribute(Attribute): + def __iadd__(self, other): ... + def __isub__(self, other): ... + def add(self, values) -> None: ... + def set(self, values) -> None: ... + def delete(self, values) -> None: ... + def remove(self) -> None: ... + def discard(self) -> None: ... + @property + def virtual(self): ... + @property + def changes(self): ... diff --git a/stubs/ldap3/ldap3/abstract/cursor.pyi b/stubs/ldap3/ldap3/abstract/cursor.pyi new file mode 100644 index 0000000..ee27126 --- /dev/null +++ b/stubs/ldap3/ldap3/abstract/cursor.pyi @@ -0,0 +1,102 @@ +from typing import Any, NamedTuple + +class Operation(NamedTuple): + request: Any + result: Any + response: Any + +class Cursor: + connection: Any + get_operational_attributes: Any + definition: Any + attributes: Any + controls: Any + execution_time: Any + entries: Any + schema: Any + def __init__( + self, + connection, + object_def, + get_operational_attributes: bool = ..., + attributes: Any | None = ..., + controls: Any | None = ..., + auxiliary_class: Any | None = ..., + ) -> None: ... + def __iter__(self): ... + def __getitem__(self, item): ... + def __len__(self): ... + def __bool__(self): ... + def match_dn(self, dn): ... + def match(self, attributes, value): ... + def remove(self, entry) -> None: ... + @property + def operations(self): ... + @property + def errors(self): ... + @property + def failed(self): ... + +class Reader(Cursor): + entry_class: Any + attribute_class: Any + entry_initial_status: Any + sub_tree: Any + base: Any + dereference_aliases: Any + validated_query: Any + query_filter: Any + def __init__( + self, + connection, + object_def, + base, + query: str = ..., + components_in_and: bool = ..., + sub_tree: bool = ..., + get_operational_attributes: bool = ..., + attributes: Any | None = ..., + controls: Any | None = ..., + auxiliary_class: Any | None = ..., + ) -> None: ... + @property + def query(self): ... + @query.setter + def query(self, value) -> None: ... + @property + def components_in_and(self): ... + @components_in_and.setter + def components_in_and(self, value) -> None: ... + def clear(self) -> None: ... + execution_time: Any + entries: Any + def reset(self) -> None: ... + def search(self, attributes: Any | None = ...): ... + def search_object(self, entry_dn: Any | None = ..., attributes: Any | None = ...): ... + def search_level(self, attributes: Any | None = ...): ... + def search_subtree(self, attributes: Any | None = ...): ... + def search_paged(self, paged_size, paged_criticality: bool = ..., generator: bool = ..., attributes: Any | None = ...): ... + +class Writer(Cursor): + entry_class: Any + attribute_class: Any + entry_initial_status: Any + @staticmethod + def from_cursor(cursor, connection: Any | None = ..., object_def: Any | None = ..., custom_validator: Any | None = ...): ... + @staticmethod + def from_response(connection, object_def, response: Any | None = ...): ... + dereference_aliases: Any + def __init__( + self, + connection, + object_def, + get_operational_attributes: bool = ..., + attributes: Any | None = ..., + controls: Any | None = ..., + auxiliary_class: Any | None = ..., + ) -> None: ... + execution_time: Any + def commit(self, refresh: bool = ...): ... + def discard(self) -> None: ... + def new(self, dn): ... + def refresh_entry(self, entry, tries: int = ..., seconds: int = ...): ... diff --git a/stubs/ldap3/ldap3/abstract/entry.pyi b/stubs/ldap3/ldap3/abstract/entry.pyi new file mode 100644 index 0000000..b7392e2 --- /dev/null +++ b/stubs/ldap3/ldap3/abstract/entry.pyi @@ -0,0 +1,83 @@ +from typing import Any + +class EntryState: + dn: Any + status: Any + attributes: Any + raw_attributes: Any + response: Any + cursor: Any + origin: Any + read_time: Any + changes: Any + definition: Any + def __init__(self, dn, cursor) -> None: ... + def set_status(self, status) -> None: ... + @property + def entry_raw_attributes(self): ... + +class EntryBase: + def __init__(self, dn, cursor) -> None: ... + def __iter__(self): ... + def __contains__(self, item): ... + def __getattr__(self, item): ... + def __setattr__(self, item, value) -> None: ... + def __getitem__(self, item): ... + def __eq__(self, other): ... + def __lt__(self, other): ... + @property + def entry_dn(self): ... + @property + def entry_cursor(self): ... + @property + def entry_status(self): ... + @property + def entry_definition(self): ... + @property + def entry_raw_attributes(self): ... + def entry_raw_attribute(self, name): ... + @property + def entry_mandatory_attributes(self): ... + @property + def entry_attributes(self): ... + @property + def entry_attributes_as_dict(self): ... + @property + def entry_read_time(self): ... + def entry_to_json( + self, + raw: bool = ..., + indent: int = ..., + sort: bool = ..., + stream: Any | None = ..., + checked_attributes: bool = ..., + include_empty: bool = ..., + ): ... + def entry_to_ldif( + self, all_base64: bool = ..., line_separator: Any | None = ..., sort_order: Any | None = ..., stream: Any | None = ... + ): ... + +class Entry(EntryBase): + def entry_writable( + self, + object_def: Any | None = ..., + writer_cursor: Any | None = ..., + attributes: Any | None = ..., + custom_validator: Any | None = ..., + auxiliary_class: Any | None = ..., + ): ... + +class WritableEntry(EntryBase): + def __setitem__(self, key, value) -> None: ... + def __setattr__(self, item, value) -> None: ... + def __getattr__(self, item): ... + @property + def entry_virtual_attributes(self): ... + def entry_commit_changes(self, refresh: bool = ..., controls: Any | None = ..., clear_history: bool = ...): ... + def entry_discard_changes(self) -> None: ... + def entry_delete(self) -> None: ... + def entry_refresh(self, tries: int = ..., seconds: int = ...): ... + def entry_move(self, destination_dn) -> None: ... + def entry_rename(self, new_name) -> None: ... + @property + def entry_changes(self): ... diff --git a/stubs/ldap3/ldap3/abstract/objectDef.pyi b/stubs/ldap3/ldap3/abstract/objectDef.pyi new file mode 100644 index 0000000..3193179 --- /dev/null +++ b/stubs/ldap3/ldap3/abstract/objectDef.pyi @@ -0,0 +1,23 @@ +from typing import Any + +class ObjectDef: + def __init__( + self, + object_class: Any | None = ..., + schema: Any | None = ..., + custom_validator: Any | None = ..., + auxiliary_class: Any | None = ..., + ) -> None: ... + def __getitem__(self, item): ... + def __getattr__(self, item): ... + def __setattr__(self, key, value) -> None: ... + def __iadd__(self, other): ... + def __isub__(self, other): ... + def __iter__(self): ... + def __len__(self): ... + def __bool__(self): ... + def __contains__(self, item): ... + def add_from_schema(self, attribute_name, mandatory: bool = ...) -> None: ... + def add_attribute(self, definition: Any | None = ...) -> None: ... + def remove_attribute(self, item) -> None: ... + def clear_attributes(self) -> None: ... diff --git a/stubs/futures/@python2/concurrent/__init__.pyi b/stubs/ldap3/ldap3/core/__init__.pyi similarity index 100% rename from stubs/futures/@python2/concurrent/__init__.pyi rename to stubs/ldap3/ldap3/core/__init__.pyi diff --git a/stubs/ldap3/ldap3/core/connection.pyi b/stubs/ldap3/ldap3/core/connection.pyi new file mode 100644 index 0000000..11a4ecd --- /dev/null +++ b/stubs/ldap3/ldap3/core/connection.pyi @@ -0,0 +1,185 @@ +from _collections_abc import Generator, dict_keys +from _typeshed import Self +from types import TracebackType +from typing import Any +from typing_extensions import Literal, TypeAlias + +from .pooling import ServerPool +from .server import Server + +SASL_AVAILABLE_MECHANISMS: Any +CLIENT_STRATEGIES: Any + +_ServerSequence: TypeAlias = ( + set[Server] | list[Server] | tuple[Server, ...] | Generator[Server, None, None] | dict_keys[Server, Any] +) + +class Connection: + connection_lock: Any + last_error: str + strategy_type: Any + user: Any + password: Any + authentication: Any + version: Any + auto_referrals: Any + request: Any + response: Any | None + result: Any + bound: bool + listening: bool + closed: bool + auto_bind: Any + sasl_mechanism: Any + sasl_credentials: Any + socket: Any + tls_started: bool + sasl_in_progress: bool + read_only: Any + lazy: Any + pool_name: Any + pool_size: int | None + cred_store: Any + pool_lifetime: Any + pool_keepalive: Any + starting_tls: bool + check_names: Any + raise_exceptions: Any + auto_range: Any + extend: Any + fast_decoder: Any + receive_timeout: Any + empty_attributes: Any + use_referral_cache: Any + auto_escape: Any + auto_encode: Any + source_address: Any + source_port_list: Any + server_pool: Any | None + server: Any + strategy: Any + send: Any + open: Any + get_response: Any + post_send_single_response: Any + post_send_search: Any + def __init__( + self, + server: Server | str | _ServerSequence | ServerPool, + user: str | None = ..., + password: str | None = ..., + auto_bind: Literal["DEFAULT", "NONE", "NO_TLS", "TLS_BEFORE_BIND", "TLS_AFTER_BIND"] = ..., + version: int = ..., + authentication: Literal["ANONYMOUS", "SIMPLE", "SASL", "NTLM"] | None = ..., + client_strategy: Literal[ + "SYNC", + "SAFE_RESTARTABLE", + "SAFE_SYNC", + "ASYNC", + "LDIF", + "RESTARTABLE", + "REUSABLE", + "MOCK_SYNC", + "MOCK_ASYNC", + "ASYNC_STREAM", + ] = ..., + auto_referrals: bool = ..., + auto_range: bool = ..., + sasl_mechanism: str | None = ..., + sasl_credentials: Any | None = ..., + check_names: bool = ..., + collect_usage: bool = ..., + read_only: bool = ..., + lazy: bool = ..., + raise_exceptions: bool = ..., + pool_name: str | None = ..., + pool_size: int | None = ..., + pool_lifetime: int | None = ..., + cred_store: Any | None = ..., + fast_decoder: bool = ..., + receive_timeout: Any | None = ..., + return_empty_attributes: bool = ..., + use_referral_cache: bool = ..., + auto_escape: bool = ..., + auto_encode: bool = ..., + pool_keepalive: Any | None = ..., + source_address: str | None = ..., + source_port: int | None = ..., + source_port_list: Any | None = ..., + ) -> None: ... + def repr_with_sensitive_data_stripped(self): ... + @property + def stream(self): ... + @stream.setter + def stream(self, value) -> None: ... + @property + def usage(self): ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> Literal[False] | None: ... + def bind(self, read_server_info: bool = ..., controls: Any | None = ...): ... + def rebind( + self, + user: Any | None = ..., + password: Any | None = ..., + authentication: Any | None = ..., + sasl_mechanism: Any | None = ..., + sasl_credentials: Any | None = ..., + read_server_info: bool = ..., + controls: Any | None = ..., + ): ... + def unbind(self, controls: Any | None = ...): ... + def search( + self, + search_base: str, + search_filter: str, + search_scope: Literal["BASE", "LEVEL", "SUBTREE"] = ..., + dereference_aliases: Literal["NEVER", "SEARCH", "FINDING_BASE", "ALWAYS"] = ..., + attributes: Any | None = ..., + size_limit: int = ..., + time_limit: int = ..., + types_only: bool = ..., + get_operational_attributes: bool = ..., + controls: Any | None = ..., + paged_size: int | None = ..., + paged_criticality: bool = ..., + paged_cookie: str | bytes | None = ..., + auto_escape: bool | None = ..., + ): ... + def compare(self, dn, attribute, value, controls: Any | None = ...): ... + def add(self, dn, object_class: Any | None = ..., attributes: Any | None = ..., controls: Any | None = ...): ... + def delete(self, dn, controls: Any | None = ...): ... + def modify(self, dn, changes, controls: Any | None = ...): ... + def modify_dn( + self, dn, relative_dn, delete_old_dn: bool = ..., new_superior: Any | None = ..., controls: Any | None = ... + ): ... + def abandon(self, message_id, controls: Any | None = ...): ... + def extended( + self, request_name, request_value: Any | None = ..., controls: Any | None = ..., no_encode: Any | None = ... + ): ... + def start_tls(self, read_server_info: bool = ...): ... + def do_sasl_bind(self, controls): ... + def do_ntlm_bind(self, controls): ... + def refresh_server_info(self) -> None: ... + def response_to_ldif( + self, + search_result: Any | None = ..., + all_base64: bool = ..., + line_separator: Any | None = ..., + sort_order: Any | None = ..., + stream: Any | None = ..., + ): ... + def response_to_json( + self, + raw: bool = ..., + search_result: Any | None = ..., + indent: int = ..., + sort: bool = ..., + stream: Any | None = ..., + checked_attributes: bool = ..., + include_empty: bool = ..., + ): ... + def response_to_file(self, target, raw: bool = ..., indent: int = ..., sort: bool = ...) -> None: ... + @property + def entries(self): ... diff --git a/stubs/ldap3/ldap3/core/exceptions.pyi b/stubs/ldap3/ldap3/core/exceptions.pyi new file mode 100644 index 0000000..3958f7c --- /dev/null +++ b/stubs/ldap3/ldap3/core/exceptions.pyi @@ -0,0 +1,145 @@ +import socket +from _typeshed import Self +from typing import Any + +class LDAPException(Exception): ... + +class LDAPOperationResult(LDAPException): + def __new__( + cls: type[Self], + result: Any | None = ..., + description: Any | None = ..., + dn: Any | None = ..., + message: Any | None = ..., + response_type: Any | None = ..., + response: Any | None = ..., + ) -> Self: ... + result: Any + description: Any + dn: Any + message: Any + type: Any + response: Any + def __init__( + self, + result: Any | None = ..., + description: Any | None = ..., + dn: Any | None = ..., + message: Any | None = ..., + response_type: Any | None = ..., + response: Any | None = ..., + ) -> None: ... + +class LDAPOperationsErrorResult(LDAPOperationResult): ... +class LDAPProtocolErrorResult(LDAPOperationResult): ... +class LDAPTimeLimitExceededResult(LDAPOperationResult): ... +class LDAPSizeLimitExceededResult(LDAPOperationResult): ... +class LDAPAuthMethodNotSupportedResult(LDAPOperationResult): ... +class LDAPStrongerAuthRequiredResult(LDAPOperationResult): ... +class LDAPReferralResult(LDAPOperationResult): ... +class LDAPAdminLimitExceededResult(LDAPOperationResult): ... +class LDAPUnavailableCriticalExtensionResult(LDAPOperationResult): ... +class LDAPConfidentialityRequiredResult(LDAPOperationResult): ... +class LDAPSASLBindInProgressResult(LDAPOperationResult): ... +class LDAPNoSuchAttributeResult(LDAPOperationResult): ... +class LDAPUndefinedAttributeTypeResult(LDAPOperationResult): ... +class LDAPInappropriateMatchingResult(LDAPOperationResult): ... +class LDAPConstraintViolationResult(LDAPOperationResult): ... +class LDAPAttributeOrValueExistsResult(LDAPOperationResult): ... +class LDAPInvalidAttributeSyntaxResult(LDAPOperationResult): ... +class LDAPNoSuchObjectResult(LDAPOperationResult): ... +class LDAPAliasProblemResult(LDAPOperationResult): ... +class LDAPInvalidDNSyntaxResult(LDAPOperationResult): ... +class LDAPAliasDereferencingProblemResult(LDAPOperationResult): ... +class LDAPInappropriateAuthenticationResult(LDAPOperationResult): ... +class LDAPInvalidCredentialsResult(LDAPOperationResult): ... +class LDAPInsufficientAccessRightsResult(LDAPOperationResult): ... +class LDAPBusyResult(LDAPOperationResult): ... +class LDAPUnavailableResult(LDAPOperationResult): ... +class LDAPUnwillingToPerformResult(LDAPOperationResult): ... +class LDAPLoopDetectedResult(LDAPOperationResult): ... +class LDAPNamingViolationResult(LDAPOperationResult): ... +class LDAPObjectClassViolationResult(LDAPOperationResult): ... +class LDAPNotAllowedOnNotLeafResult(LDAPOperationResult): ... +class LDAPNotAllowedOnRDNResult(LDAPOperationResult): ... +class LDAPEntryAlreadyExistsResult(LDAPOperationResult): ... +class LDAPObjectClassModsProhibitedResult(LDAPOperationResult): ... +class LDAPAffectMultipleDSASResult(LDAPOperationResult): ... +class LDAPOtherResult(LDAPOperationResult): ... +class LDAPLCUPResourcesExhaustedResult(LDAPOperationResult): ... +class LDAPLCUPSecurityViolationResult(LDAPOperationResult): ... +class LDAPLCUPInvalidDataResult(LDAPOperationResult): ... +class LDAPLCUPUnsupportedSchemeResult(LDAPOperationResult): ... +class LDAPLCUPReloadRequiredResult(LDAPOperationResult): ... +class LDAPCanceledResult(LDAPOperationResult): ... +class LDAPNoSuchOperationResult(LDAPOperationResult): ... +class LDAPTooLateResult(LDAPOperationResult): ... +class LDAPCannotCancelResult(LDAPOperationResult): ... +class LDAPAssertionFailedResult(LDAPOperationResult): ... +class LDAPAuthorizationDeniedResult(LDAPOperationResult): ... +class LDAPESyncRefreshRequiredResult(LDAPOperationResult): ... + +exception_table: Any + +class LDAPExceptionError(LDAPException): ... +class LDAPConfigurationError(LDAPExceptionError): ... +class LDAPUnknownStrategyError(LDAPConfigurationError): ... +class LDAPUnknownAuthenticationMethodError(LDAPConfigurationError): ... +class LDAPSSLConfigurationError(LDAPConfigurationError): ... +class LDAPDefinitionError(LDAPConfigurationError): ... +class LDAPPackageUnavailableError(LDAPConfigurationError, ImportError): ... +class LDAPConfigurationParameterError(LDAPConfigurationError): ... +class LDAPKeyError(LDAPExceptionError, KeyError, AttributeError): ... +class LDAPObjectError(LDAPExceptionError, ValueError): ... +class LDAPAttributeError(LDAPExceptionError, ValueError, TypeError): ... +class LDAPCursorError(LDAPExceptionError): ... +class LDAPCursorAttributeError(LDAPCursorError, AttributeError): ... +class LDAPObjectDereferenceError(LDAPExceptionError): ... +class LDAPSSLNotSupportedError(LDAPExceptionError, ImportError): ... +class LDAPInvalidTlsSpecificationError(LDAPExceptionError): ... +class LDAPInvalidHashAlgorithmError(LDAPExceptionError, ValueError): ... +class LDAPSignatureVerificationFailedError(LDAPExceptionError): ... +class LDAPBindError(LDAPExceptionError): ... +class LDAPInvalidServerError(LDAPExceptionError): ... +class LDAPSASLMechanismNotSupportedError(LDAPExceptionError): ... +class LDAPConnectionIsReadOnlyError(LDAPExceptionError): ... +class LDAPChangeError(LDAPExceptionError, ValueError): ... +class LDAPServerPoolError(LDAPExceptionError): ... +class LDAPServerPoolExhaustedError(LDAPExceptionError): ... +class LDAPInvalidPortError(LDAPExceptionError): ... +class LDAPStartTLSError(LDAPExceptionError): ... +class LDAPCertificateError(LDAPExceptionError): ... +class LDAPUserNameNotAllowedError(LDAPExceptionError): ... +class LDAPUserNameIsMandatoryError(LDAPExceptionError): ... +class LDAPPasswordIsMandatoryError(LDAPExceptionError): ... +class LDAPInvalidFilterError(LDAPExceptionError): ... +class LDAPInvalidScopeError(LDAPExceptionError, ValueError): ... +class LDAPInvalidDereferenceAliasesError(LDAPExceptionError, ValueError): ... +class LDAPInvalidValueError(LDAPExceptionError, ValueError): ... +class LDAPControlError(LDAPExceptionError, ValueError): ... +class LDAPExtensionError(LDAPExceptionError, ValueError): ... +class LDAPLDIFError(LDAPExceptionError): ... +class LDAPSchemaError(LDAPExceptionError): ... +class LDAPSASLPrepError(LDAPExceptionError): ... +class LDAPSASLBindInProgressError(LDAPExceptionError): ... +class LDAPMetricsError(LDAPExceptionError): ... +class LDAPObjectClassError(LDAPExceptionError): ... +class LDAPInvalidDnError(LDAPExceptionError): ... +class LDAPResponseTimeoutError(LDAPExceptionError): ... +class LDAPTransactionError(LDAPExceptionError): ... +class LDAPInfoError(LDAPExceptionError): ... +class LDAPCommunicationError(LDAPExceptionError): ... +class LDAPSocketOpenError(LDAPCommunicationError): ... +class LDAPSocketCloseError(LDAPCommunicationError): ... +class LDAPSocketReceiveError(LDAPCommunicationError, socket.error): ... +class LDAPSocketSendError(LDAPCommunicationError, socket.error): ... +class LDAPSessionTerminatedByServerError(LDAPCommunicationError): ... +class LDAPUnknownResponseError(LDAPCommunicationError): ... +class LDAPUnknownRequestError(LDAPCommunicationError): ... +class LDAPReferralError(LDAPCommunicationError): ... +class LDAPConnectionPoolNameIsMandatoryError(LDAPExceptionError): ... +class LDAPConnectionPoolNotStartedError(LDAPExceptionError): ... +class LDAPMaximumRetriesError(LDAPExceptionError): ... + +def communication_exception_factory(exc_to_raise, exc): ... +def start_tls_exception_factory(exc): ... diff --git a/stubs/ldap3/ldap3/core/pooling.pyi b/stubs/ldap3/ldap3/core/pooling.pyi new file mode 100644 index 0000000..088c73e --- /dev/null +++ b/stubs/ldap3/ldap3/core/pooling.pyi @@ -0,0 +1,42 @@ +from typing import Any + +POOLING_STRATEGIES: Any + +class ServerState: + server: Any + last_checked_time: Any + available: Any + def __init__(self, server, last_checked_time, available) -> None: ... + +class ServerPoolState: + server_states: Any + strategy: Any + server_pool: Any + last_used_server: int + initialize_time: Any + def __init__(self, server_pool) -> None: ... + def refresh(self) -> None: ... + def get_current_server(self): ... + def get_server(self): ... + def find_active_random_server(self): ... + def find_active_server(self, starting): ... + def __len__(self): ... + +class ServerPool: + servers: Any + pool_states: Any + active: Any + exhaust: Any + single: Any + strategy: Any + def __init__( + self, servers: Any | None = ..., pool_strategy=..., active: bool = ..., exhaust: bool = ..., single_state: bool = ... + ) -> None: ... + def __len__(self): ... + def __getitem__(self, item): ... + def __iter__(self): ... + def add(self, servers) -> None: ... + def remove(self, server) -> None: ... + def initialize(self, connection) -> None: ... + def get_server(self, connection): ... + def get_current_server(self, connection): ... diff --git a/stubs/ldap3/ldap3/core/rdns.pyi b/stubs/ldap3/ldap3/core/rdns.pyi new file mode 100644 index 0000000..e712f80 --- /dev/null +++ b/stubs/ldap3/ldap3/core/rdns.pyi @@ -0,0 +1,12 @@ +from typing import Any + +class ReverseDnsSetting: + OFF: Any + REQUIRE_RESOLVE_ALL_ADDRESSES: Any + REQUIRE_RESOLVE_IP_ADDRESSES_ONLY: Any + OPTIONAL_RESOLVE_ALL_ADDRESSES: Any + OPTIONAL_RESOLVE_IP_ADDRESSES_ONLY: Any + SUPPORTED_VALUES: Any + +def get_hostname_by_addr(addr, success_required: bool = ...): ... +def is_ip_addr(addr): ... diff --git a/stubs/ldap3/ldap3/core/results.pyi b/stubs/ldap3/ldap3/core/results.pyi new file mode 100644 index 0000000..a2772bd --- /dev/null +++ b/stubs/ldap3/ldap3/core/results.pyi @@ -0,0 +1,56 @@ +from typing import Any + +RESULT_SUCCESS: int +RESULT_OPERATIONS_ERROR: int +RESULT_PROTOCOL_ERROR: int +RESULT_TIME_LIMIT_EXCEEDED: int +RESULT_SIZE_LIMIT_EXCEEDED: int +RESULT_COMPARE_FALSE: int +RESULT_COMPARE_TRUE: int +RESULT_AUTH_METHOD_NOT_SUPPORTED: int +RESULT_STRONGER_AUTH_REQUIRED: int +RESULT_RESERVED: int +RESULT_REFERRAL: int +RESULT_ADMIN_LIMIT_EXCEEDED: int +RESULT_UNAVAILABLE_CRITICAL_EXTENSION: int +RESULT_CONFIDENTIALITY_REQUIRED: int +RESULT_SASL_BIND_IN_PROGRESS: int +RESULT_NO_SUCH_ATTRIBUTE: int +RESULT_UNDEFINED_ATTRIBUTE_TYPE: int +RESULT_INAPPROPRIATE_MATCHING: int +RESULT_CONSTRAINT_VIOLATION: int +RESULT_ATTRIBUTE_OR_VALUE_EXISTS: int +RESULT_INVALID_ATTRIBUTE_SYNTAX: int +RESULT_NO_SUCH_OBJECT: int +RESULT_ALIAS_PROBLEM: int +RESULT_INVALID_DN_SYNTAX: int +RESULT_ALIAS_DEREFERENCING_PROBLEM: int +RESULT_INAPPROPRIATE_AUTHENTICATION: int +RESULT_INVALID_CREDENTIALS: int +RESULT_INSUFFICIENT_ACCESS_RIGHTS: int +RESULT_BUSY: int +RESULT_UNAVAILABLE: int +RESULT_UNWILLING_TO_PERFORM: int +RESULT_LOOP_DETECTED: int +RESULT_NAMING_VIOLATION: int +RESULT_OBJECT_CLASS_VIOLATION: int +RESULT_NOT_ALLOWED_ON_NON_LEAF: int +RESULT_NOT_ALLOWED_ON_RDN: int +RESULT_ENTRY_ALREADY_EXISTS: int +RESULT_OBJECT_CLASS_MODS_PROHIBITED: int +RESULT_AFFECT_MULTIPLE_DSAS: int +RESULT_OTHER: int +RESULT_LCUP_RESOURCES_EXHAUSTED: int +RESULT_LCUP_SECURITY_VIOLATION: int +RESULT_LCUP_INVALID_DATA: int +RESULT_LCUP_UNSUPPORTED_SCHEME: int +RESULT_LCUP_RELOAD_REQUIRED: int +RESULT_CANCELED: int +RESULT_NO_SUCH_OPERATION: int +RESULT_TOO_LATE: int +RESULT_CANNOT_CANCEL: int +RESULT_ASSERTION_FAILED: int +RESULT_AUTHORIZATION_DENIED: int +RESULT_E_SYNC_REFRESH_REQUIRED: int +RESULT_CODES: Any +DO_NOT_RAISE_EXCEPTIONS: Any diff --git a/stubs/ldap3/ldap3/core/server.pyi b/stubs/ldap3/ldap3/core/server.pyi new file mode 100644 index 0000000..9594d6b --- /dev/null +++ b/stubs/ldap3/ldap3/core/server.pyi @@ -0,0 +1,67 @@ +import sys +from typing import Any +from typing_extensions import Literal + +if sys.platform != "win32": + from socket import AF_UNIX as AF_UNIX + +unix_socket_available: bool + +class Server: + ipc: bool + host: Any + port: Any + allowed_referral_hosts: Any + ssl: Any + tls: Any + name: Any + get_info: Any + dit_lock: Any + custom_formatter: Any + custom_validator: Any + current_address: Any + connect_timeout: Any + mode: Any + def __init__( + self, + host: str, + port: int | None = ..., + use_ssl: bool = ..., + allowed_referral_hosts: Any | None = ..., + get_info: Literal["NO_INFO", "DSA", "SCHEMA", "ALL"] = ..., + tls: Any | None = ..., + formatter: Any | None = ..., + connect_timeout: Any | None = ..., + mode: Literal["IP_SYSTEM_DEFAULT", "IP_V4_ONLY", "IP_V6_ONLY", "IP_V4_PREFERRED", "IP_V6_PREFERRED"] = ..., + validator: Any | None = ..., + ) -> None: ... + @property + def address_info(self): ... + def update_availability(self, address, available) -> None: ... + def reset_availability(self) -> None: ... + def check_availability( + self, source_address: Any | None = ..., source_port: Any | None = ..., source_port_list: Any | None = ... + ): ... + @staticmethod + def next_message_id(): ... + def get_info_from_server(self, connection) -> None: ... + def attach_dsa_info(self, dsa_info: Any | None = ...) -> None: ... + def attach_schema_info(self, dsa_schema: Any | None = ...) -> None: ... + @property + def info(self): ... + @property + def schema(self): ... + @staticmethod + def from_definition( + host, + dsa_info, + dsa_schema, + port: Any | None = ..., + use_ssl: bool = ..., + formatter: Any | None = ..., + validator: Any | None = ..., + ): ... + def candidate_addresses(self): ... + def has_control(self, control): ... + def has_extension(self, extension): ... + def has_feature(self, feature): ... diff --git a/stubs/ldap3/ldap3/core/timezone.pyi b/stubs/ldap3/ldap3/core/timezone.pyi new file mode 100644 index 0000000..c6c52b3 --- /dev/null +++ b/stubs/ldap3/ldap3/core/timezone.pyi @@ -0,0 +1,11 @@ +from datetime import tzinfo +from typing import Any + +class OffsetTzInfo(tzinfo): + offset: Any + name: Any + def __init__(self, offset, name) -> None: ... + def utcoffset(self, dt): ... + def tzname(self, dt): ... + def dst(self, dt): ... + def __getinitargs__(self): ... diff --git a/stubs/ldap3/ldap3/core/tls.pyi b/stubs/ldap3/ldap3/core/tls.pyi new file mode 100644 index 0000000..c776f7f --- /dev/null +++ b/stubs/ldap3/ldap3/core/tls.pyi @@ -0,0 +1,36 @@ +from typing import Any + +use_ssl_context: bool + +class Tls: + ssl_options: Any + validate: Any + ca_certs_file: Any + ca_certs_path: Any + ca_certs_data: Any + private_key_password: Any + version: Any + private_key_file: Any + certificate_file: Any + valid_names: Any + ciphers: Any + sni: Any + def __init__( + self, + local_private_key_file: Any | None = ..., + local_certificate_file: Any | None = ..., + validate=..., + version: Any | None = ..., + ssl_options: Any | None = ..., + ca_certs_file: Any | None = ..., + valid_names: Any | None = ..., + ca_certs_path: Any | None = ..., + ca_certs_data: Any | None = ..., + local_private_key_password: Any | None = ..., + ciphers: Any | None = ..., + sni: Any | None = ..., + ) -> None: ... + def wrap_socket(self, connection, do_handshake: bool = ...) -> None: ... + def start_tls(self, connection): ... + +def check_hostname(sock, server_name, additional_names) -> None: ... diff --git a/stubs/ldap3/ldap3/core/usage.pyi b/stubs/ldap3/ldap3/core/usage.pyi new file mode 100644 index 0000000..ccb805b --- /dev/null +++ b/stubs/ldap3/ldap3/core/usage.pyi @@ -0,0 +1,41 @@ +from typing import Any + +class ConnectionUsage: + open_sockets: int + closed_sockets: int + wrapped_sockets: int + bytes_transmitted: int + bytes_received: int + messages_transmitted: int + messages_received: int + operations: int + abandon_operations: int + add_operations: int + bind_operations: int + compare_operations: int + delete_operations: int + extended_operations: int + modify_operations: int + modify_dn_operations: int + search_operations: int + unbind_operations: int + referrals_received: int + referrals_followed: int + referrals_connections: int + restartable_failures: int + restartable_successes: int + servers_from_pool: int + def reset(self) -> None: ... + initial_connection_start_time: Any + open_socket_start_time: Any + connection_stop_time: Any + last_transmitted_time: Any + last_received_time: Any + def __init__(self) -> None: ... + def __iadd__(self, other): ... + def update_transmitted_message(self, message, length) -> None: ... + def update_received_message(self, length) -> None: ... + def start(self, reset: bool = ...) -> None: ... + def stop(self) -> None: ... + @property + def elapsed_time(self): ... diff --git a/stubs/ldap3/ldap3/extend/__init__.pyi b/stubs/ldap3/ldap3/extend/__init__.pyi new file mode 100644 index 0000000..61ca6f4 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/__init__.pyi @@ -0,0 +1,105 @@ +from typing import Any + +class ExtendedOperationContainer: + def __init__(self, connection) -> None: ... + +class StandardExtendedOperations(ExtendedOperationContainer): + def who_am_i(self, controls: Any | None = ...): ... + def modify_password( + self, + user: Any | None = ..., + old_password: Any | None = ..., + new_password: Any | None = ..., + hash_algorithm: Any | None = ..., + salt: Any | None = ..., + controls: Any | None = ..., + ): ... + def paged_search( + self, + search_base, + search_filter, + search_scope=..., + dereference_aliases=..., + attributes: Any | None = ..., + size_limit: int = ..., + time_limit: int = ..., + types_only: bool = ..., + get_operational_attributes: bool = ..., + controls: Any | None = ..., + paged_size: int = ..., + paged_criticality: bool = ..., + generator: bool = ..., + ): ... + def persistent_search( + self, + search_base: str = ..., + search_filter: str = ..., + search_scope=..., + dereference_aliases=..., + attributes=..., + size_limit: int = ..., + time_limit: int = ..., + controls: Any | None = ..., + changes_only: bool = ..., + show_additions: bool = ..., + show_deletions: bool = ..., + show_modifications: bool = ..., + show_dn_modifications: bool = ..., + notifications: bool = ..., + streaming: bool = ..., + callback: Any | None = ..., + ): ... + def funnel_search( + self, + search_base: str = ..., + search_filter: str = ..., + search_scope=..., + dereference_aliases=..., + attributes=..., + size_limit: int = ..., + time_limit: int = ..., + controls: Any | None = ..., + streaming: bool = ..., + callback: Any | None = ..., + ): ... + +class NovellExtendedOperations(ExtendedOperationContainer): + def get_bind_dn(self, controls: Any | None = ...): ... + def get_universal_password(self, user, controls: Any | None = ...): ... + def set_universal_password(self, user, new_password: Any | None = ..., controls: Any | None = ...): ... + def list_replicas(self, server_dn, controls: Any | None = ...): ... + def partition_entry_count(self, partition_dn, controls: Any | None = ...): ... + def replica_info(self, server_dn, partition_dn, controls: Any | None = ...): ... + def start_transaction(self, controls: Any | None = ...): ... + def end_transaction(self, commit: bool = ..., controls: Any | None = ...): ... + def add_members_to_groups(self, members, groups, fix: bool = ..., transaction: bool = ...): ... + def remove_members_from_groups(self, members, groups, fix: bool = ..., transaction: bool = ...): ... + def check_groups_memberships(self, members, groups, fix: bool = ..., transaction: bool = ...): ... + +class MicrosoftExtendedOperations(ExtendedOperationContainer): + def dir_sync( + self, + sync_base, + sync_filter: str = ..., + attributes=..., + cookie: Any | None = ..., + object_security: bool = ..., + ancestors_first: bool = ..., + public_data_only: bool = ..., + incremental_values: bool = ..., + max_length: int = ..., + hex_guid: bool = ..., + ): ... + def modify_password(self, user, new_password, old_password: Any | None = ..., controls: Any | None = ...): ... + def unlock_account(self, user): ... + def add_members_to_groups(self, members, groups, fix: bool = ...): ... + def remove_members_from_groups(self, members, groups, fix: bool = ...): ... + def persistent_search( + self, search_base: str = ..., search_scope=..., attributes=..., streaming: bool = ..., callback: Any | None = ... + ): ... + +class ExtendedOperationsRoot(ExtendedOperationContainer): + standard: Any + novell: Any + microsoft: Any + def __init__(self, connection) -> None: ... diff --git a/stubs/requests/requests/packages/urllib3/contrib/__init__.pyi b/stubs/ldap3/ldap3/extend/microsoft/__init__.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/contrib/__init__.pyi rename to stubs/ldap3/ldap3/extend/microsoft/__init__.pyi diff --git a/stubs/ldap3/ldap3/extend/microsoft/addMembersToGroups.pyi b/stubs/ldap3/ldap3/extend/microsoft/addMembersToGroups.pyi new file mode 100644 index 0000000..486d084 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/microsoft/addMembersToGroups.pyi @@ -0,0 +1 @@ +def ad_add_members_to_groups(connection, members_dn, groups_dn, fix: bool = ..., raise_error: bool = ...): ... diff --git a/stubs/ldap3/ldap3/extend/microsoft/dirSync.pyi b/stubs/ldap3/ldap3/extend/microsoft/dirSync.pyi new file mode 100644 index 0000000..68acbfc --- /dev/null +++ b/stubs/ldap3/ldap3/extend/microsoft/dirSync.pyi @@ -0,0 +1,30 @@ +from typing import Any + +class DirSync: + connection: Any + base: Any + filter: Any + attributes: Any + cookie: Any + object_security: Any + ancestors_first: Any + public_data_only: Any + incremental_values: Any + max_length: Any + hex_guid: Any + more_results: bool + def __init__( + self, + connection, + sync_base, + sync_filter, + attributes, + cookie, + object_security, + ancestors_first, + public_data_only, + incremental_values, + max_length, + hex_guid, + ) -> None: ... + def loop(self): ... diff --git a/stubs/ldap3/ldap3/extend/microsoft/modifyPassword.pyi b/stubs/ldap3/ldap3/extend/microsoft/modifyPassword.pyi new file mode 100644 index 0000000..5b3d27a --- /dev/null +++ b/stubs/ldap3/ldap3/extend/microsoft/modifyPassword.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def ad_modify_password(connection, user_dn, new_password, old_password, controls: Any | None = ...): ... diff --git a/stubs/ldap3/ldap3/extend/microsoft/persistentSearch.pyi b/stubs/ldap3/ldap3/extend/microsoft/persistentSearch.pyi new file mode 100644 index 0000000..95fca82 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/microsoft/persistentSearch.pyi @@ -0,0 +1,15 @@ +from typing import Any + +class ADPersistentSearch: + connection: Any + message_id: Any + base: Any + scope: Any + attributes: Any + controls: Any + filter: str + def __init__(self, connection, search_base, search_scope, attributes, streaming, callback) -> None: ... + def start(self) -> None: ... + def stop(self, unbind: bool = ...) -> None: ... + def next(self, block: bool = ..., timeout: Any | None = ...): ... + def funnel(self, block: bool = ..., timeout: Any | None = ...) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/microsoft/removeMembersFromGroups.pyi b/stubs/ldap3/ldap3/extend/microsoft/removeMembersFromGroups.pyi new file mode 100644 index 0000000..915fb9d --- /dev/null +++ b/stubs/ldap3/ldap3/extend/microsoft/removeMembersFromGroups.pyi @@ -0,0 +1 @@ +def ad_remove_members_from_groups(connection, members_dn, groups_dn, fix, raise_error: bool = ...): ... diff --git a/stubs/ldap3/ldap3/extend/microsoft/unlockAccount.pyi b/stubs/ldap3/ldap3/extend/microsoft/unlockAccount.pyi new file mode 100644 index 0000000..8423780 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/microsoft/unlockAccount.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def ad_unlock_account(connection, user_dn, controls: Any | None = ...): ... diff --git a/stubs/requests/requests/packages/urllib3/packages/__init__.pyi b/stubs/ldap3/ldap3/extend/novell/__init__.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/packages/__init__.pyi rename to stubs/ldap3/ldap3/extend/novell/__init__.pyi diff --git a/stubs/ldap3/ldap3/extend/novell/addMembersToGroups.pyi b/stubs/ldap3/ldap3/extend/novell/addMembersToGroups.pyi new file mode 100644 index 0000000..5ba4cab --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/addMembersToGroups.pyi @@ -0,0 +1 @@ +def edir_add_members_to_groups(connection, members_dn, groups_dn, fix, transaction): ... diff --git a/stubs/ldap3/ldap3/extend/novell/checkGroupsMemberships.pyi b/stubs/ldap3/ldap3/extend/novell/checkGroupsMemberships.pyi new file mode 100644 index 0000000..551636c --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/checkGroupsMemberships.pyi @@ -0,0 +1 @@ +def edir_check_groups_memberships(connection, members_dn, groups_dn, fix, transaction): ... diff --git a/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi b/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi new file mode 100644 index 0000000..f0e8c58 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class EndTransaction(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + asn1_spec: Any + def config(self) -> None: ... + def __init__(self, connection, commit: bool = ..., controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... + response_value: Any + def set_response(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi new file mode 100644 index 0000000..4c194ce --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class GetBindDn(ExtendedOperation): + request_name: str + response_name: str + response_attribute: str + asn1_spec: Any + def config(self) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi new file mode 100644 index 0000000..0c7b6e7 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class ListReplicas(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + asn1_spec: Any + response_attribute: str + def config(self) -> None: ... + def __init__(self, connection, server_dn, controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi b/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi new file mode 100644 index 0000000..59d0f1c --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class NmasGetUniversalPassword(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + asn1_spec: Any + response_attribute: str + def config(self) -> None: ... + def __init__(self, connection, user, controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi b/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi new file mode 100644 index 0000000..a35b984 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class NmasSetUniversalPassword(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + asn1_spec: Any + response_attribute: str + def config(self) -> None: ... + def __init__(self, connection, user, new_password, controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi b/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi new file mode 100644 index 0000000..a912798 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from ..operation import ExtendedOperation + +class PartitionEntryCount(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + response_attribute: str + def config(self) -> None: ... + def __init__(self, connection, partition_dn, controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/removeMembersFromGroups.pyi b/stubs/ldap3/ldap3/extend/novell/removeMembersFromGroups.pyi new file mode 100644 index 0000000..91a3223 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/removeMembersFromGroups.pyi @@ -0,0 +1 @@ +def edir_remove_members_from_groups(connection, members_dn, groups_dn, fix, transaction): ... diff --git a/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi b/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi new file mode 100644 index 0000000..6a43580 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from ..operation import ExtendedOperation + +class ReplicaInfo(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + response_attribute: str + def config(self) -> None: ... + def __init__(self, connection, server_dn, partition_dn, controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi b/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi new file mode 100644 index 0000000..74dd78c --- /dev/null +++ b/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class StartTransaction(ExtendedOperation): + request_name: str + response_name: str + request_value: Any + asn1_spec: Any + def config(self) -> None: ... + def __init__(self, connection, controls: Any | None = ...) -> None: ... + def populate_result(self) -> None: ... + response_value: Any + def set_response(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/operation.pyi b/stubs/ldap3/ldap3/extend/operation.pyi new file mode 100644 index 0000000..4b14b4b --- /dev/null +++ b/stubs/ldap3/ldap3/extend/operation.pyi @@ -0,0 +1,19 @@ +from typing import Any + +class ExtendedOperation: + connection: Any + decoded_response: Any + result: Any + asn1_spec: Any + request_name: Any + response_name: Any + request_value: Any + response_value: Any + response_attribute: Any + controls: Any + def __init__(self, connection, controls: Any | None = ...) -> None: ... + def send(self): ... + def populate_result(self) -> None: ... + def decode_response(self, response: Any | None = ...) -> None: ... + def set_response(self) -> None: ... + def config(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/standard/PagedSearch.pyi b/stubs/ldap3/ldap3/extend/standard/PagedSearch.pyi new file mode 100644 index 0000000..741f7c5 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/standard/PagedSearch.pyi @@ -0,0 +1,32 @@ +from typing import Any + +def paged_search_generator( + connection, + search_base, + search_filter, + search_scope=..., + dereference_aliases=..., + attributes: Any | None = ..., + size_limit: int = ..., + time_limit: int = ..., + types_only: bool = ..., + get_operational_attributes: bool = ..., + controls: Any | None = ..., + paged_size: int = ..., + paged_criticality: bool = ..., +) -> None: ... +def paged_search_accumulator( + connection, + search_base, + search_filter, + search_scope=..., + dereference_aliases=..., + attributes: Any | None = ..., + size_limit: int = ..., + time_limit: int = ..., + types_only: bool = ..., + get_operational_attributes: bool = ..., + controls: Any | None = ..., + paged_size: int = ..., + paged_criticality: bool = ..., +): ... diff --git a/stubs/ldap3/ldap3/extend/standard/PersistentSearch.pyi b/stubs/ldap3/ldap3/extend/standard/PersistentSearch.pyi new file mode 100644 index 0000000..3af402e --- /dev/null +++ b/stubs/ldap3/ldap3/extend/standard/PersistentSearch.pyi @@ -0,0 +1,36 @@ +from typing import Any + +class PersistentSearch: + connection: Any + changes_only: Any + notifications: Any + message_id: Any + base: Any + filter: Any + scope: Any + dereference_aliases: Any + attributes: Any + size_limit: Any + time_limit: Any + controls: Any + def __init__( + self, + connection, + search_base, + search_filter, + search_scope, + dereference_aliases, + attributes, + size_limit, + time_limit, + controls, + changes_only, + events_type, + notifications, + streaming, + callback, + ) -> None: ... + def start(self) -> None: ... + def stop(self, unbind: bool = ...) -> None: ... + def next(self, block: bool = ..., timeout: Any | None = ...): ... + def funnel(self, block: bool = ..., timeout: Any | None = ...) -> None: ... diff --git a/stubs/selenium/selenium/__init__.pyi b/stubs/ldap3/ldap3/extend/standard/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/__init__.pyi rename to stubs/ldap3/ldap3/extend/standard/__init__.pyi diff --git a/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi b/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi new file mode 100644 index 0000000..5df4b6d --- /dev/null +++ b/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from ...extend.operation import ExtendedOperation + +class ModifyPassword(ExtendedOperation): + request_name: str + request_value: Any + asn1_spec: Any + response_attribute: str + def config(self) -> None: ... + def __init__( + self, + connection, + user: Any | None = ..., + old_password: Any | None = ..., + new_password: Any | None = ..., + hash_algorithm: Any | None = ..., + salt: Any | None = ..., + controls: Any | None = ..., + ) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/standard/whoAmI.pyi b/stubs/ldap3/ldap3/extend/standard/whoAmI.pyi new file mode 100644 index 0000000..e61b175 --- /dev/null +++ b/stubs/ldap3/ldap3/extend/standard/whoAmI.pyi @@ -0,0 +1,7 @@ +from ...extend.operation import ExtendedOperation + +class WhoAmI(ExtendedOperation): + request_name: str + response_attribute: str + def config(self) -> None: ... + def populate_result(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/android/__init__.pyi b/stubs/ldap3/ldap3/operation/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/android/__init__.pyi rename to stubs/ldap3/ldap3/operation/__init__.pyi diff --git a/stubs/ldap3/ldap3/operation/abandon.pyi b/stubs/ldap3/ldap3/operation/abandon.pyi new file mode 100644 index 0000000..2413c21 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/abandon.pyi @@ -0,0 +1,2 @@ +def abandon_operation(msg_id): ... +def abandon_request_to_dict(request): ... diff --git a/stubs/ldap3/ldap3/operation/add.pyi b/stubs/ldap3/ldap3/operation/add.pyi new file mode 100644 index 0000000..59d87ba --- /dev/null +++ b/stubs/ldap3/ldap3/operation/add.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def add_operation( + dn, attributes, auto_encode, schema: Any | None = ..., validator: Any | None = ..., check_names: bool = ... +): ... +def add_request_to_dict(request): ... +def add_response_to_dict(response): ... diff --git a/stubs/ldap3/ldap3/operation/bind.pyi b/stubs/ldap3/ldap3/operation/bind.pyi new file mode 100644 index 0000000..5079a87 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/bind.pyi @@ -0,0 +1,23 @@ +from typing import Any + +def bind_operation( + version, + authentication, + name: str = ..., + password: Any | None = ..., + sasl_mechanism: Any | None = ..., + sasl_credentials: Any | None = ..., + auto_encode: bool = ..., +): ... +def bind_request_to_dict(request): ... +def bind_response_operation( + result_code, + matched_dn: str = ..., + diagnostic_message: str = ..., + referral: Any | None = ..., + server_sasl_credentials: Any | None = ..., +): ... +def bind_response_to_dict(response): ... +def sicily_bind_response_to_dict(response): ... +def bind_response_to_dict_fast(response): ... +def sicily_bind_response_to_dict_fast(response): ... diff --git a/stubs/ldap3/ldap3/operation/compare.pyi b/stubs/ldap3/ldap3/operation/compare.pyi new file mode 100644 index 0000000..4b12d35 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/compare.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def compare_operation( + dn, attribute, value, auto_encode, schema: Any | None = ..., validator: Any | None = ..., check_names: bool = ... +): ... +def compare_request_to_dict(request): ... +def compare_response_to_dict(response): ... diff --git a/stubs/ldap3/ldap3/operation/delete.pyi b/stubs/ldap3/ldap3/operation/delete.pyi new file mode 100644 index 0000000..618c8f4 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/delete.pyi @@ -0,0 +1,3 @@ +def delete_operation(dn): ... +def delete_request_to_dict(request): ... +def delete_response_to_dict(response): ... diff --git a/stubs/ldap3/ldap3/operation/extended.pyi b/stubs/ldap3/ldap3/operation/extended.pyi new file mode 100644 index 0000000..2cc46be --- /dev/null +++ b/stubs/ldap3/ldap3/operation/extended.pyi @@ -0,0 +1,8 @@ +from typing import Any + +def extended_operation(request_name, request_value: Any | None = ..., no_encode: Any | None = ...): ... +def extended_request_to_dict(request): ... +def extended_response_to_dict(response): ... +def intermediate_response_to_dict(response): ... +def extended_response_to_dict_fast(response): ... +def intermediate_response_to_dict_fast(response): ... diff --git a/stubs/ldap3/ldap3/operation/modify.pyi b/stubs/ldap3/ldap3/operation/modify.pyi new file mode 100644 index 0000000..8700499 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/modify.pyi @@ -0,0 +1,9 @@ +from typing import Any + +change_table: Any + +def modify_operation( + dn, changes, auto_encode, schema: Any | None = ..., validator: Any | None = ..., check_names: bool = ... +): ... +def modify_request_to_dict(request): ... +def modify_response_to_dict(response): ... diff --git a/stubs/ldap3/ldap3/operation/modifyDn.pyi b/stubs/ldap3/ldap3/operation/modifyDn.pyi new file mode 100644 index 0000000..db754b8 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/modifyDn.pyi @@ -0,0 +1,5 @@ +from typing import Any + +def modify_dn_operation(dn, new_relative_dn, delete_old_rdn: bool = ..., new_superior: Any | None = ...): ... +def modify_dn_request_to_dict(request): ... +def modify_dn_response_to_dict(response): ... diff --git a/stubs/ldap3/ldap3/operation/search.pyi b/stubs/ldap3/ldap3/operation/search.pyi new file mode 100644 index 0000000..a929e13 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/search.pyi @@ -0,0 +1,65 @@ +from typing import Any + +ROOT: int +AND: int +OR: int +NOT: int +MATCH_APPROX: int +MATCH_GREATER_OR_EQUAL: int +MATCH_LESS_OR_EQUAL: int +MATCH_EXTENSIBLE: int +MATCH_PRESENT: int +MATCH_SUBSTRING: int +MATCH_EQUAL: int +SEARCH_OPEN: int +SEARCH_OPEN_OR_CLOSE: int +SEARCH_MATCH_OR_CLOSE: int +SEARCH_MATCH_OR_CONTROL: int + +class FilterNode: + tag: Any + parent: Any + assertion: Any + elements: Any + def __init__(self, tag: Any | None = ..., assertion: Any | None = ...) -> None: ... + def __str__(self, pos: int = ...) -> str: ... + def __repr__(self, pos: int = ...) -> str: ... + def append(self, filter_node): ... + +def evaluate_match(match, schema, auto_escape, auto_encode, validator, check_names): ... +def parse_filter(search_filter, schema, auto_escape, auto_encode, validator, check_names): ... +def compile_filter(filter_node): ... +def build_attribute_selection(attribute_list, schema): ... +def search_operation( + search_base, + search_filter, + search_scope, + dereference_aliases, + attributes, + size_limit, + time_limit, + types_only, + auto_escape, + auto_encode, + schema: Any | None = ..., + validator: Any | None = ..., + check_names: bool = ..., +): ... +def decode_vals(vals): ... +def decode_vals_fast(vals): ... +def attributes_to_dict(attribute_list): ... +def attributes_to_dict_fast(attribute_list): ... +def decode_raw_vals(vals): ... +def decode_raw_vals_fast(vals): ... +def raw_attributes_to_dict(attribute_list): ... +def raw_attributes_to_dict_fast(attribute_list): ... +def checked_attributes_to_dict(attribute_list, schema: Any | None = ..., custom_formatter: Any | None = ...): ... +def checked_attributes_to_dict_fast(attribute_list, schema: Any | None = ..., custom_formatter: Any | None = ...): ... +def matching_rule_assertion_to_string(matching_rule_assertion): ... +def filter_to_string(filter_object): ... +def search_request_to_dict(request): ... +def search_result_entry_response_to_dict(response, schema, custom_formatter, check_names): ... +def search_result_done_response_to_dict(response): ... +def search_result_reference_response_to_dict(response): ... +def search_result_entry_response_to_dict_fast(response, schema, custom_formatter, check_names): ... +def search_result_reference_response_to_dict_fast(response): ... diff --git a/stubs/ldap3/ldap3/operation/unbind.pyi b/stubs/ldap3/ldap3/operation/unbind.pyi new file mode 100644 index 0000000..0c66a79 --- /dev/null +++ b/stubs/ldap3/ldap3/operation/unbind.pyi @@ -0,0 +1 @@ +def unbind_operation(): ... diff --git a/stubs/selenium/selenium/webdriver/blackberry/__init__.pyi b/stubs/ldap3/ldap3/protocol/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/blackberry/__init__.pyi rename to stubs/ldap3/ldap3/protocol/__init__.pyi diff --git a/stubs/ldap3/ldap3/protocol/controls.pyi b/stubs/ldap3/ldap3/protocol/controls.pyi new file mode 100644 index 0000000..7c67b9f --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/controls.pyi @@ -0,0 +1 @@ +def build_control(oid, criticality, value, encode_control_value: bool = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/convert.pyi b/stubs/ldap3/ldap3/protocol/convert.pyi new file mode 100644 index 0000000..4bf4baf --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/convert.pyi @@ -0,0 +1,22 @@ +from typing import Any + +def to_str_or_normalized_unicode(val): ... +def attribute_to_dict(attribute): ... +def attributes_to_dict(attributes): ... +def referrals_to_list(referrals): ... +def search_refs_to_list(search_refs): ... +def search_refs_to_list_fast(search_refs): ... +def sasl_to_dict(sasl): ... +def authentication_choice_to_dict(authentication_choice): ... +def partial_attribute_to_dict(modification): ... +def change_to_dict(change): ... +def changes_to_list(changes): ... +def attributes_to_list(attributes): ... +def ava_to_dict(ava): ... +def substring_to_dict(substring): ... +def prepare_changes_for_request(changes): ... +def build_controls_list(controls): ... +def validate_assertion_value(schema, name, value, auto_escape, auto_encode, validator, check_names): ... +def validate_attribute_value(schema, name, value, auto_encode, validator: Any | None = ..., check_names: bool = ...): ... +def prepare_filter_for_sending(raw_string): ... +def prepare_for_sending(raw_string): ... diff --git a/stubs/selenium/selenium/webdriver/chrome/__init__.pyi b/stubs/ldap3/ldap3/protocol/formatters/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/chrome/__init__.pyi rename to stubs/ldap3/ldap3/protocol/formatters/__init__.pyi diff --git a/stubs/ldap3/ldap3/protocol/formatters/formatters.pyi b/stubs/ldap3/ldap3/protocol/formatters/formatters.pyi new file mode 100644 index 0000000..69c4e1a --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/formatters/formatters.pyi @@ -0,0 +1,16 @@ +from typing import Any + +def format_unicode(raw_value): ... +def format_integer(raw_value): ... +def format_binary(raw_value): ... +def format_uuid(raw_value): ... +def format_uuid_le(raw_value): ... +def format_boolean(raw_value): ... +def format_ad_timestamp(raw_value): ... + +time_format: Any + +def format_time(raw_value): ... +def format_ad_timedelta(raw_value): ... +def format_time_with_0_year(raw_value): ... +def format_sid(raw_value): ... diff --git a/stubs/ldap3/ldap3/protocol/formatters/standard.pyi b/stubs/ldap3/ldap3/protocol/formatters/standard.pyi new file mode 100644 index 0000000..f85dd64 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/formatters/standard.pyi @@ -0,0 +1,7 @@ +from typing import Any + +standard_formatter: Any + +def find_attribute_helpers(attr_type, name, custom_formatter): ... +def format_attribute_values(schema, name, values, custom_formatter): ... +def find_attribute_validator(schema, name, custom_validator): ... diff --git a/stubs/ldap3/ldap3/protocol/formatters/validators.pyi b/stubs/ldap3/ldap3/protocol/formatters/validators.pyi new file mode 100644 index 0000000..b49eee6 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/formatters/validators.pyi @@ -0,0 +1,16 @@ +def check_backslash(value): ... +def check_type(input_value, value_type): ... +def always_valid(input_value): ... +def validate_generic_single_value(input_value): ... +def validate_zero_and_minus_one_and_positive_int(input_value): ... +def validate_integer(input_value): ... +def validate_bytes(input_value): ... +def validate_boolean(input_value): ... +def validate_time_with_0_year(input_value): ... +def validate_time(input_value): ... +def validate_ad_timestamp(input_value): ... +def validate_ad_timedelta(input_value): ... +def validate_guid(input_value): ... +def validate_uuid(input_value): ... +def validate_uuid_le(input_value): ... +def validate_sid(input_value): ... diff --git a/stubs/ldap3/ldap3/protocol/microsoft.pyi b/stubs/ldap3/ldap3/protocol/microsoft.pyi new file mode 100644 index 0000000..2200343 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/microsoft.pyi @@ -0,0 +1,28 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.type.univ import Sequence +_Sequence: TypeAlias = Any + +class SicilyBindResponse(_Sequence): + tagSet: Any + componentType: Any + +class DirSyncControlRequestValue(_Sequence): + componentType: Any + +class DirSyncControlResponseValue(_Sequence): + componentType: Any + +class SdFlags(_Sequence): + componentType: Any + +class ExtendedDN(_Sequence): + componentType: Any + +def dir_sync_control(criticality, object_security, ancestors_first, public_data_only, incremental_values, max_length, cookie): ... +def extended_dn_control(criticality: bool = ..., hex_format: bool = ...): ... +def show_deleted_control(criticality: bool = ...): ... +def security_descriptor_control(criticality: bool = ..., sdflags: int = ...): ... +def persistent_search_control(criticality: bool = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/novell.pyi b/stubs/ldap3/ldap3/protocol/novell.pyi new file mode 100644 index 0000000..60c5c91 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/novell.pyi @@ -0,0 +1,73 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.type.univ import Integer, OctetString, Sequence, SequenceOf +_Integer: TypeAlias = Any +_OctetString: TypeAlias = Any +_Sequence: TypeAlias = Any +_SequenceOf: TypeAlias = Any + +NMAS_LDAP_EXT_VERSION: int + +class Identity(_OctetString): + encoding: str + +class LDAPDN(_OctetString): + tagSet: Any + encoding: str + +class Password(_OctetString): + tagSet: Any + encoding: str + +class LDAPOID(_OctetString): + tagSet: Any + encoding: str + +class GroupCookie(_Integer): + tagSet: Any + +class NmasVer(_Integer): + tagSet: Any + +class Error(_Integer): + tagSet: Any + +class NmasGetUniversalPasswordRequestValue(_Sequence): + componentType: Any + +class NmasGetUniversalPasswordResponseValue(_Sequence): + componentType: Any + +class NmasSetUniversalPasswordRequestValue(_Sequence): + componentType: Any + +class NmasSetUniversalPasswordResponseValue(_Sequence): + componentType: Any + +class ReplicaList(_SequenceOf): + componentType: Any + +class ReplicaInfoRequestValue(_Sequence): + tagSet: Any + componentType: Any + +class ReplicaInfoResponseValue(_Sequence): + tagSet: Any + componentType: Any + +class CreateGroupTypeRequestValue(_Sequence): + componentType: Any + +class CreateGroupTypeResponseValue(_Sequence): + componentType: Any + +class EndGroupTypeRequestValue(_Sequence): + componentType: Any + +class EndGroupTypeResponseValue(_Sequence): + componentType: Any + +class GroupingControlValue(_Sequence): + componentType: Any diff --git a/stubs/ldap3/ldap3/protocol/oid.pyi b/stubs/ldap3/ldap3/protocol/oid.pyi new file mode 100644 index 0000000..77efdda --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/oid.pyi @@ -0,0 +1,29 @@ +from typing import Any + +OID_CONTROL: str +OID_EXTENSION: str +OID_FEATURE: str +OID_UNSOLICITED_NOTICE: str +OID_ATTRIBUTE_TYPE: str +OID_DIT_CONTENT_RULE: str +OID_LDAP_URL_EXTENSION: str +OID_FAMILY: str +OID_MATCHING_RULE: str +OID_NAME_FORM: str +OID_OBJECT_CLASS: str +OID_ADMINISTRATIVE_ROLE: str +OID_LDAP_SYNTAX: str +CLASS_STRUCTURAL: str +CLASS_ABSTRACT: str +CLASS_AUXILIARY: str +ATTRIBUTE_USER_APPLICATION: str +ATTRIBUTE_DIRECTORY_OPERATION: str +ATTRIBUTE_DISTRIBUTED_OPERATION: str +ATTRIBUTE_DSA_OPERATION: str + +def constant_to_oid_kind(oid_kind): ... +def decode_oids(sequence): ... +def decode_syntax(syntax): ... +def oid_to_string(oid): ... + +Oids: Any diff --git a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi new file mode 100644 index 0000000..3d19c08 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi @@ -0,0 +1,18 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.type.univ import Enumerated, Sequence +_Enumerated: TypeAlias = Any +_Sequence: TypeAlias = Any + +class PersistentSearchControl(_Sequence): + componentType: Any + +class ChangeType(_Enumerated): + namedValues: Any + +class EntryChangeNotificationControl(_Sequence): + componentType: Any + +def persistent_search_control(change_types, changes_only: bool = ..., return_ecs: bool = ..., criticality: bool = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc2696.pyi b/stubs/ldap3/ldap3/protocol/rfc2696.pyi new file mode 100644 index 0000000..c131194 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/rfc2696.pyi @@ -0,0 +1,22 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.type.univ import Integer, OctetString, Sequence +_Integer: TypeAlias = Any +_OctetString: TypeAlias = Any +_Sequence: TypeAlias = Any + +MAXINT: Any +rangeInt0ToMaxConstraint: Any + +class Integer0ToMax(_Integer): + subtypeSpec: Any + +class Size(Integer0ToMax): ... +class Cookie(_OctetString): ... + +class RealSearchControlValue(_Sequence): + componentType: Any + +def paged_search_control(criticality: bool = ..., size: int = ..., cookie: Any | None = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc2849.pyi b/stubs/ldap3/ldap3/protocol/rfc2849.pyi new file mode 100644 index 0000000..b589bc5 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/rfc2849.pyi @@ -0,0 +1,18 @@ +from typing import Any + +conf_ldif_line_length: Any + +def safe_ldif_string(bytes_value): ... +def add_controls(controls, all_base64): ... +def add_attributes(attributes, all_base64): ... +def sort_ldif_lines(lines, sort_order): ... +def search_response_to_ldif(entries, all_base64, sort_order: Any | None = ...): ... +def add_request_to_ldif(entry, all_base64, sort_order: Any | None = ...): ... +def delete_request_to_ldif(entry, all_base64, sort_order: Any | None = ...): ... +def modify_request_to_ldif(entry, all_base64, sort_order: Any | None = ...): ... +def modify_dn_request_to_ldif(entry, all_base64, sort_order: Any | None = ...): ... +def operation_to_ldif(operation_type, entries, all_base64: bool = ..., sort_order: Any | None = ...): ... +def add_ldif_header(ldif_lines): ... +def ldif_sort(line, sort_order): ... +def decode_persistent_search_control(change): ... +def persistent_search_response_to_ldif(change): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc3062.pyi b/stubs/ldap3/ldap3/protocol/rfc3062.pyi new file mode 100644 index 0000000..7076147 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/rfc3062.pyi @@ -0,0 +1,29 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.type.univ import OctetString, Sequence +_OctetString: TypeAlias = Any +_Sequence: TypeAlias = Any + +class UserIdentity(_OctetString): + tagSet: Any + encoding: str + +class OldPasswd(_OctetString): + tagSet: Any + encoding: str + +class NewPasswd(_OctetString): + tagSet: Any + encoding: str + +class GenPasswd(_OctetString): + tagSet: Any + encoding: str + +class PasswdModifyRequestValue(_Sequence): + componentType: Any + +class PasswdModifyResponseValue(_Sequence): + componentType: Any diff --git a/stubs/ldap3/ldap3/protocol/rfc4511.pyi b/stubs/ldap3/ldap3/protocol/rfc4511.pyi new file mode 100644 index 0000000..070910a --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/rfc4511.pyi @@ -0,0 +1,323 @@ +from typing import Any as _Any + +# Enable when pyasn1 gets stubs: +# from pyasn1.type.univ import Boolean, Choice, Enumerated, Integer, Null, OctetString, Sequence, SequenceOf, SetOf +Boolean = _Any +Choice = _Any +Enumerated = _Any +Integer = _Any +Null = _Any +OctetString = _Any +Sequence = _Any +SequenceOf = _Any +SetOf = _Any + +LDAP_MAX_INT: int +MAXINT: _Any +rangeInt0ToMaxConstraint: _Any +rangeInt1To127Constraint: _Any +size1ToMaxConstraint: _Any +responseValueConstraint: _Any +numericOIDConstraint: _Any +distinguishedNameConstraint: _Any +nameComponentConstraint: _Any +attributeDescriptionConstraint: _Any +uriConstraint: _Any +attributeSelectorConstraint: _Any + +class Integer0ToMax(Integer): + subtypeSpec: _Any + +class LDAPString(OctetString): + encoding: str + +class MessageID(Integer0ToMax): ... +class LDAPOID(OctetString): ... +class LDAPDN(LDAPString): ... +class RelativeLDAPDN(LDAPString): ... +class AttributeDescription(LDAPString): ... + +class AttributeValue(OctetString): + encoding: str + +class AssertionValue(OctetString): + encoding: str + +class AttributeValueAssertion(Sequence): + componentType: _Any + +class MatchingRuleId(LDAPString): ... + +class Vals(SetOf): + componentType: _Any + +class ValsAtLeast1(SetOf): + componentType: _Any + subtypeSpec: _Any + +class PartialAttribute(Sequence): + componentType: _Any + +class Attribute(Sequence): + componentType: _Any + +class AttributeList(SequenceOf): + componentType: _Any + +class Simple(OctetString): + tagSet: _Any + encoding: str + +class Credentials(OctetString): + encoding: str + +class SaslCredentials(Sequence): + tagSet: _Any + componentType: _Any + +class SicilyPackageDiscovery(OctetString): + tagSet: _Any + encoding: str + +class SicilyNegotiate(OctetString): + tagSet: _Any + encoding: str + +class SicilyResponse(OctetString): + tagSet: _Any + encoding: str + +class AuthenticationChoice(Choice): + componentType: _Any + +class Version(Integer): + subtypeSpec: _Any + +class ResultCode(Enumerated): + namedValues: _Any + subTypeSpec: _Any + +class URI(LDAPString): ... + +class Referral(SequenceOf): + tagSet: _Any + componentType: _Any + +class ServerSaslCreds(OctetString): + tagSet: _Any + encoding: str + +class LDAPResult(Sequence): + componentType: _Any + +class Criticality(Boolean): + defaultValue: bool + +class ControlValue(OctetString): + encoding: str + +class Control(Sequence): + componentType: _Any + +class Controls(SequenceOf): + tagSet: _Any + componentType: _Any + +class Scope(Enumerated): + namedValues: _Any + +class DerefAliases(Enumerated): + namedValues: _Any + +class TypesOnly(Boolean): ... +class Selector(LDAPString): ... + +class AttributeSelection(SequenceOf): + componentType: _Any + +class MatchingRule(MatchingRuleId): + tagSet: _Any + +class Type(AttributeDescription): + tagSet: _Any + +class MatchValue(AssertionValue): + tagSet: _Any + +class DnAttributes(Boolean): + tagSet: _Any + defaultValue: _Any + +class MatchingRuleAssertion(Sequence): + componentType: _Any + +class Initial(AssertionValue): + tagSet: _Any + +class Any(AssertionValue): + tagSet: _Any + +class Final(AssertionValue): + tagSet: _Any + +class Substring(Choice): + componentType: _Any + +class Substrings(SequenceOf): + subtypeSpec: _Any + componentType: _Any + +class SubstringFilter(Sequence): + tagSet: _Any + componentType: _Any + +class And(SetOf): + tagSet: _Any + subtypeSpec: _Any + +class Or(SetOf): + tagSet: _Any + subtypeSpec: _Any + +class Not(Choice): ... + +class EqualityMatch(AttributeValueAssertion): + tagSet: _Any + +class GreaterOrEqual(AttributeValueAssertion): + tagSet: _Any + +class LessOrEqual(AttributeValueAssertion): + tagSet: _Any + +class Present(AttributeDescription): + tagSet: _Any + +class ApproxMatch(AttributeValueAssertion): + tagSet: _Any + +class ExtensibleMatch(MatchingRuleAssertion): + tagSet: _Any + +class Filter(Choice): + componentType: _Any + +class PartialAttributeList(SequenceOf): + componentType: _Any + +class Operation(Enumerated): + namedValues: _Any + +class Change(Sequence): + componentType: _Any + +class Changes(SequenceOf): + componentType: _Any + +class DeleteOldRDN(Boolean): ... + +class NewSuperior(LDAPDN): + tagSet: _Any + +class RequestName(LDAPOID): + tagSet: _Any + +class RequestValue(OctetString): + tagSet: _Any + encoding: str + +class ResponseName(LDAPOID): + tagSet: _Any + +class ResponseValue(OctetString): + tagSet: _Any + encoding: str + +class IntermediateResponseName(LDAPOID): + tagSet: _Any + +class IntermediateResponseValue(OctetString): + tagSet: _Any + encoding: str + +class BindRequest(Sequence): + tagSet: _Any + componentType: _Any + +class BindResponse(Sequence): + tagSet: _Any + componentType: _Any + +class UnbindRequest(Null): + tagSet: _Any + +class SearchRequest(Sequence): + tagSet: _Any + componentType: _Any + +class SearchResultReference(SequenceOf): + tagSet: _Any + subtypeSpec: _Any + componentType: _Any + +class SearchResultEntry(Sequence): + tagSet: _Any + componentType: _Any + +class SearchResultDone(LDAPResult): + tagSet: _Any + +class ModifyRequest(Sequence): + tagSet: _Any + componentType: _Any + +class ModifyResponse(LDAPResult): + tagSet: _Any + +class AddRequest(Sequence): + tagSet: _Any + componentType: _Any + +class AddResponse(LDAPResult): + tagSet: _Any + +class DelRequest(LDAPDN): + tagSet: _Any + +class DelResponse(LDAPResult): + tagSet: _Any + +class ModifyDNRequest(Sequence): + tagSet: _Any + componentType: _Any + +class ModifyDNResponse(LDAPResult): + tagSet: _Any + +class CompareRequest(Sequence): + tagSet: _Any + componentType: _Any + +class CompareResponse(LDAPResult): + tagSet: _Any + +class AbandonRequest(MessageID): + tagSet: _Any + +class ExtendedRequest(Sequence): + tagSet: _Any + componentType: _Any + +class ExtendedResponse(Sequence): + tagSet: _Any + componentType: _Any + +class IntermediateResponse(Sequence): + tagSet: _Any + componentType: _Any + +class ProtocolOp(Choice): + componentType: _Any + +class LDAPMessage(Sequence): + componentType: _Any diff --git a/stubs/ldap3/ldap3/protocol/rfc4512.pyi b/stubs/ldap3/ldap3/protocol/rfc4512.pyi new file mode 100644 index 0000000..816dfeb --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/rfc4512.pyi @@ -0,0 +1,218 @@ +from typing import Any + +def constant_to_class_kind(value): ... +def constant_to_attribute_usage(value): ... +def attribute_usage_to_constant(value): ... +def quoted_string_to_list(quoted_string): ... +def oids_string_to_list(oid_string): ... +def extension_to_tuple(extension_string): ... +def list_to_string(list_object): ... + +class BaseServerInfo: + raw: Any + def __init__(self, raw_attributes) -> None: ... + @classmethod + def from_json(cls, json_definition, schema: Any | None = ..., custom_formatter: Any | None = ...): ... + @classmethod + def from_file(cls, target, schema: Any | None = ..., custom_formatter: Any | None = ...): ... + def to_file(self, target, indent: int = ..., sort: bool = ...) -> None: ... + def to_json(self, indent: int = ..., sort: bool = ...): ... + +class DsaInfo(BaseServerInfo): + alt_servers: Any + naming_contexts: Any + supported_controls: Any + supported_extensions: Any + supported_features: Any + supported_ldap_versions: Any + supported_sasl_mechanisms: Any + vendor_name: Any + vendor_version: Any + schema_entry: Any + other: Any + def __init__(self, attributes, raw_attributes) -> None: ... + +class SchemaInfo(BaseServerInfo): + schema_entry: Any + create_time_stamp: Any + modify_time_stamp: Any + attribute_types: Any + object_classes: Any + matching_rules: Any + matching_rule_uses: Any + dit_content_rules: Any + dit_structure_rules: Any + name_forms: Any + ldap_syntaxes: Any + other: Any + def __init__(self, schema_entry, attributes, raw_attributes) -> None: ... + def is_valid(self): ... + +class BaseObjectInfo: + oid: Any + name: Any + description: Any + obsolete: Any + extensions: Any + experimental: Any + raw_definition: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + @property + def oid_info(self): ... + @classmethod + def from_definition(cls, definitions): ... + +class MatchingRuleInfo(BaseObjectInfo): + syntax: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + syntax: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class MatchingRuleUseInfo(BaseObjectInfo): + apply_to: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + apply_to: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class ObjectClassInfo(BaseObjectInfo): + superior: Any + kind: Any + must_contain: Any + may_contain: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + superior: Any | None = ..., + kind: Any | None = ..., + must_contain: Any | None = ..., + may_contain: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class AttributeTypeInfo(BaseObjectInfo): + superior: Any + equality: Any + ordering: Any + substring: Any + syntax: Any + min_length: Any + single_value: Any + collective: Any + no_user_modification: Any + usage: Any + mandatory_in: Any + optional_in: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + superior: Any | None = ..., + equality: Any | None = ..., + ordering: Any | None = ..., + substring: Any | None = ..., + syntax: Any | None = ..., + min_length: Any | None = ..., + single_value: bool = ..., + collective: bool = ..., + no_user_modification: bool = ..., + usage: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class LdapSyntaxInfo(BaseObjectInfo): + def __init__( + self, + oid: Any | None = ..., + description: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class DitContentRuleInfo(BaseObjectInfo): + auxiliary_classes: Any + must_contain: Any + may_contain: Any + not_contains: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + auxiliary_classes: Any | None = ..., + must_contain: Any | None = ..., + may_contain: Any | None = ..., + not_contains: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class DitStructureRuleInfo(BaseObjectInfo): + superior: Any + name_form: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + name_form: Any | None = ..., + superior: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... + +class NameFormInfo(BaseObjectInfo): + object_class: Any + must_contain: Any + may_contain: Any + def __init__( + self, + oid: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + obsolete: bool = ..., + object_class: Any | None = ..., + must_contain: Any | None = ..., + may_contain: Any | None = ..., + extensions: Any | None = ..., + experimental: Any | None = ..., + definition: Any | None = ..., + ) -> None: ... diff --git a/stubs/ldap3/ldap3/protocol/rfc4527.pyi b/stubs/ldap3/ldap3/protocol/rfc4527.pyi new file mode 100644 index 0000000..eacc393 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/rfc4527.pyi @@ -0,0 +1,2 @@ +def pre_read_control(attributes, criticality: bool = ...): ... +def post_read_control(attributes, criticality: bool = ...): ... diff --git a/stubs/selenium/selenium/webdriver/common/__init__.pyi b/stubs/ldap3/ldap3/protocol/sasl/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/common/__init__.pyi rename to stubs/ldap3/ldap3/protocol/sasl/__init__.pyi diff --git a/stubs/ldap3/ldap3/protocol/sasl/digestMd5.pyi b/stubs/ldap3/ldap3/protocol/sasl/digestMd5.pyi new file mode 100644 index 0000000..433416f --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/sasl/digestMd5.pyi @@ -0,0 +1,9 @@ +STATE_KEY: int +STATE_VALUE: int + +def md5_h(value): ... +def md5_kd(k, s): ... +def md5_hex(value): ... +def md5_hmac(k, s): ... +def sasl_digest_md5(connection, controls): ... +def decode_directives(directives_string): ... diff --git a/stubs/ldap3/ldap3/protocol/sasl/external.pyi b/stubs/ldap3/ldap3/protocol/sasl/external.pyi new file mode 100644 index 0000000..8403ee7 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/sasl/external.pyi @@ -0,0 +1 @@ +def sasl_external(connection, controls): ... diff --git a/stubs/ldap3/ldap3/protocol/sasl/kerberos.pyi b/stubs/ldap3/ldap3/protocol/sasl/kerberos.pyi new file mode 100644 index 0000000..7a795b2 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/sasl/kerberos.pyi @@ -0,0 +1,8 @@ +posix_gssapi_unavailable: bool +windows_gssapi_unavailable: bool +NO_SECURITY_LAYER: int +INTEGRITY_PROTECTION: int +CONFIDENTIALITY_PROTECTION: int + +def get_channel_bindings(ssl_socket): ... +def sasl_gssapi(connection, controls): ... diff --git a/stubs/ldap3/ldap3/protocol/sasl/plain.pyi b/stubs/ldap3/ldap3/protocol/sasl/plain.pyi new file mode 100644 index 0000000..5be879c --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/sasl/plain.pyi @@ -0,0 +1 @@ +def sasl_plain(connection, controls): ... diff --git a/stubs/ldap3/ldap3/protocol/sasl/sasl.pyi b/stubs/ldap3/ldap3/protocol/sasl/sasl.pyi new file mode 100644 index 0000000..564c26a --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/sasl/sasl.pyi @@ -0,0 +1,5 @@ +def sasl_prep(data): ... +def validate_simple_password(password, accept_empty: bool = ...): ... +def abort_sasl_negotiation(connection, controls): ... +def send_sasl_negotiation(connection, controls, payload): ... +def random_hex_string(size): ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/__init__.pyi b/stubs/ldap3/ldap3/protocol/schemas/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/common/actions/__init__.pyi rename to stubs/ldap3/ldap3/protocol/schemas/__init__.pyi diff --git a/stubs/ldap3/ldap3/protocol/schemas/ad2012R2.pyi b/stubs/ldap3/ldap3/protocol/schemas/ad2012R2.pyi new file mode 100644 index 0000000..3f48429 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/schemas/ad2012R2.pyi @@ -0,0 +1,2 @@ +ad_2012_r2_schema: str +ad_2012_r2_dsa_info: str diff --git a/stubs/ldap3/ldap3/protocol/schemas/ds389.pyi b/stubs/ldap3/ldap3/protocol/schemas/ds389.pyi new file mode 100644 index 0000000..4d90cdc --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/schemas/ds389.pyi @@ -0,0 +1,2 @@ +ds389_1_3_3_schema: str +ds389_1_3_3_dsa_info: str diff --git a/stubs/ldap3/ldap3/protocol/schemas/edir888.pyi b/stubs/ldap3/ldap3/protocol/schemas/edir888.pyi new file mode 100644 index 0000000..5b982a4 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/schemas/edir888.pyi @@ -0,0 +1,2 @@ +edir_8_8_8_schema: str +edir_8_8_8_dsa_info: str diff --git a/stubs/ldap3/ldap3/protocol/schemas/edir914.pyi b/stubs/ldap3/ldap3/protocol/schemas/edir914.pyi new file mode 100644 index 0000000..d7c9cf6 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/schemas/edir914.pyi @@ -0,0 +1,2 @@ +edir_9_1_4_schema: str +edir_9_1_4_dsa_info: str diff --git a/stubs/ldap3/ldap3/protocol/schemas/slapd24.pyi b/stubs/ldap3/ldap3/protocol/schemas/slapd24.pyi new file mode 100644 index 0000000..c080d08 --- /dev/null +++ b/stubs/ldap3/ldap3/protocol/schemas/slapd24.pyi @@ -0,0 +1,2 @@ +slapd_2_4_schema: str +slapd_2_4_dsa_info: str diff --git a/stubs/selenium/selenium/webdriver/common/html5/__init__.pyi b/stubs/ldap3/ldap3/strategy/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/common/html5/__init__.pyi rename to stubs/ldap3/ldap3/strategy/__init__.pyi diff --git a/stubs/ldap3/ldap3/strategy/asyncStream.pyi b/stubs/ldap3/ldap3/strategy/asyncStream.pyi new file mode 100644 index 0000000..b0ed1b4 --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/asyncStream.pyi @@ -0,0 +1,18 @@ +from typing import Any + +from ..strategy.asynchronous import AsyncStrategy + +class AsyncStreamStrategy(AsyncStrategy): + can_stream: bool + line_separator: Any + all_base64: bool + stream: Any + order: Any + persistent_search_message_id: Any + streaming: bool + callback: Any + events: Any + def __init__(self, ldap_connection) -> None: ... + def accumulate_stream(self, message_id, change) -> None: ... + def get_stream(self): ... + def set_stream(self, value) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/asynchronous.pyi b/stubs/ldap3/ldap3/strategy/asynchronous.pyi new file mode 100644 index 0000000..ecc746f --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/asynchronous.pyi @@ -0,0 +1,27 @@ +from threading import Thread +from typing import Any + +from ..strategy.base import BaseStrategy + +class AsyncStrategy(BaseStrategy): + class ReceiverSocketThread(Thread): + connection: Any + socket_size: Any + def __init__(self, ldap_connection) -> None: ... + def run(self) -> None: ... + sync: bool + no_real_dsa: bool + pooled: bool + can_stream: bool + receiver: Any + async_lock: Any + event_lock: Any + def __init__(self, ldap_connection) -> None: ... + def open(self, reset_usage: bool = ..., read_server_info: bool = ...) -> None: ... + def close(self) -> None: ... + def set_event_for_message(self, message_id) -> None: ... + def post_send_search(self, message_id): ... + def post_send_single_response(self, message_id): ... + def receiving(self) -> None: ... + def get_stream(self) -> None: ... + def set_stream(self, value) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/base.pyi b/stubs/ldap3/ldap3/strategy/base.pyi new file mode 100644 index 0000000..4c7a07a --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/base.pyi @@ -0,0 +1,42 @@ +from typing import Any + +unix_socket_available: bool +SESSION_TERMINATED_BY_SERVER: str +TRANSACTION_ERROR: str +RESPONSE_COMPLETE: str + +class BaseStrategy: + connection: Any + sync: Any + no_real_dsa: Any + pooled: Any + can_stream: Any + referral_cache: Any + thread_safe: bool + def __init__(self, ldap_connection) -> None: ... + def open(self, reset_usage: bool = ..., read_server_info: bool = ...) -> None: ... + def close(self) -> None: ... + def send(self, message_type, request, controls: Any | None = ...): ... + def get_response(self, message_id, timeout: Any | None = ..., get_request: bool = ...): ... + @staticmethod + def compute_ldap_message_size(data): ... + def decode_response(self, ldap_message): ... + def decode_response_fast(self, ldap_message): ... + @staticmethod + def decode_control(control): ... + @staticmethod + def decode_control_fast(control, from_server: bool = ...): ... + @staticmethod + def decode_request(message_type, component, controls: Any | None = ...): ... + def valid_referral_list(self, referrals): ... + def do_next_range_search(self, request, response, attr_name): ... + def do_search_on_auto_range(self, request, response): ... + def create_referral_connection(self, referrals): ... + def do_operation_on_referral(self, request, referrals): ... + def sending(self, ldap_message) -> None: ... + def receiving(self) -> None: ... + def post_send_single_response(self, message_id) -> None: ... + def post_send_search(self, message_id) -> None: ... + def get_stream(self) -> None: ... + def set_stream(self, value) -> None: ... + def unbind_referral_cache(self) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/ldifProducer.pyi b/stubs/ldap3/ldap3/strategy/ldifProducer.pyi new file mode 100644 index 0000000..7ac55a3 --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/ldifProducer.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from .base import BaseStrategy + +class LdifProducerStrategy(BaseStrategy): + sync: bool + no_real_dsa: bool + pooled: bool + can_stream: bool + line_separator: Any + all_base64: bool + stream: Any + order: Any + def __init__(self, ldap_connection) -> None: ... + def receiving(self) -> None: ... + def send(self, message_type, request, controls: Any | None = ...): ... + def post_send_single_response(self, message_id): ... + def post_send_search(self, message_id) -> None: ... + def accumulate_stream(self, fragment) -> None: ... + def get_stream(self): ... + def set_stream(self, value) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/mockAsync.pyi b/stubs/ldap3/ldap3/strategy/mockAsync.pyi new file mode 100644 index 0000000..2acd747 --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/mockAsync.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from .asynchronous import AsyncStrategy +from .mockBase import MockBaseStrategy + +class MockAsyncStrategy(MockBaseStrategy, AsyncStrategy): + def __init__(self, ldap_connection) -> None: ... + def post_send_search(self, payload): ... + bound: Any + def post_send_single_response(self, payload): ... + def get_response(self, message_id, timeout: Any | None = ..., get_request: bool = ...): ... diff --git a/stubs/ldap3/ldap3/strategy/mockBase.pyi b/stubs/ldap3/ldap3/strategy/mockBase.pyi new file mode 100644 index 0000000..c4b0c34 --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/mockBase.pyi @@ -0,0 +1,37 @@ +from typing import Any + +SEARCH_CONTROLS: Any +SERVER_ENCODING: str + +def random_cookie(): ... + +class PagedSearchSet: + size: Any + response: Any + cookie: Any + sent: int + done: bool + def __init__(self, response, size, criticality) -> None: ... + def next(self, size: Any | None = ...): ... + +class MockBaseStrategy: + entries: Any + no_real_dsa: bool + bound: Any + custom_validators: Any + operational_attributes: Any + def __init__(self) -> None: ... + def add_entry(self, dn, attributes, validate: bool = ...): ... + def remove_entry(self, dn): ... + def entries_from_json(self, json_entry_file) -> None: ... + def mock_bind(self, request_message, controls): ... + def mock_delete(self, request_message, controls): ... + def mock_add(self, request_message, controls): ... + def mock_compare(self, request_message, controls): ... + def mock_modify_dn(self, request_message, controls): ... + def mock_modify(self, request_message, controls): ... + def mock_search(self, request_message, controls): ... + def mock_extended(self, request_message, controls): ... + def evaluate_filter_node(self, node, candidates): ... + def equal(self, dn, attribute_type, value_to_check): ... + def send(self, message_type, request, controls: Any | None = ...): ... diff --git a/stubs/ldap3/ldap3/strategy/mockSync.pyi b/stubs/ldap3/ldap3/strategy/mockSync.pyi new file mode 100644 index 0000000..dcfd12d --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/mockSync.pyi @@ -0,0 +1,10 @@ +from typing import Any + +from .mockBase import MockBaseStrategy +from .sync import SyncStrategy + +class MockSyncStrategy(MockBaseStrategy, SyncStrategy): + def __init__(self, ldap_connection) -> None: ... + def post_send_search(self, payload): ... + bound: Any + def post_send_single_response(self, payload): ... diff --git a/stubs/ldap3/ldap3/strategy/restartable.pyi b/stubs/ldap3/ldap3/strategy/restartable.pyi new file mode 100644 index 0000000..d38804e --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/restartable.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from .sync import SyncStrategy + +class RestartableStrategy(SyncStrategy): + sync: bool + no_real_dsa: bool + pooled: bool + can_stream: bool + restartable_sleep_time: Any + restartable_tries: Any + exception_history: Any + def __init__(self, ldap_connection) -> None: ... + def open(self, reset_usage: bool = ..., read_server_info: bool = ...) -> None: ... + def send(self, message_type, request, controls: Any | None = ...): ... + def post_send_single_response(self, message_id): ... + def post_send_search(self, message_id): ... + def get_stream(self) -> None: ... + def set_stream(self, value) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/reusable.pyi b/stubs/ldap3/ldap3/strategy/reusable.pyi new file mode 100644 index 0000000..2203fdf --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/reusable.pyi @@ -0,0 +1,74 @@ +from threading import Thread +from typing import Any + +from .base import BaseStrategy + +TERMINATE_REUSABLE: str +BOGUS_BIND: int +BOGUS_UNBIND: int +BOGUS_EXTENDED: int +BOGUS_ABANDON: int + +class ReusableStrategy(BaseStrategy): + pools: Any + def receiving(self) -> None: ... + def get_stream(self) -> None: ... + def set_stream(self, value) -> None: ... + + class ConnectionPool: + def __new__(cls, connection): ... + name: Any + master_connection: Any + workers: Any + pool_size: Any + lifetime: Any + keepalive: Any + request_queue: Any + open_pool: bool + bind_pool: bool + tls_pool: bool + counter: int + terminated_usage: Any + terminated: bool + pool_lock: Any + started: bool + def __init__(self, connection) -> None: ... + def get_info_from_server(self) -> None: ... + def rebind_pool(self) -> None: ... + def start_pool(self): ... + def create_pool(self) -> None: ... + def terminate_pool(self) -> None: ... + + class PooledConnectionThread(Thread): + daemon: bool + worker: Any + master_connection: Any + def __init__(self, worker, master_connection) -> None: ... + def run(self) -> None: ... + + class PooledConnectionWorker: + master_connection: Any + request_queue: Any + running: bool + busy: bool + get_info_from_server: bool + connection: Any + creation_time: Any + task_counter: int + thread: Any + worker_lock: Any + def __init__(self, connection, request_queue) -> None: ... + def new_connection(self) -> None: ... + sync: bool + no_real_dsa: bool + pooled: bool + can_stream: bool + pool: Any + def __init__(self, ldap_connection) -> None: ... + def open(self, reset_usage: bool = ..., read_server_info: bool = ...) -> None: ... + def terminate(self) -> None: ... + def send(self, message_type, request, controls: Any | None = ...): ... + def validate_bind(self, controls): ... + def get_response(self, counter, timeout: Any | None = ..., get_request: bool = ...): ... + def post_send_single_response(self, counter): ... + def post_send_search(self, counter): ... diff --git a/stubs/ldap3/ldap3/strategy/safeRestartable.pyi b/stubs/ldap3/ldap3/strategy/safeRestartable.pyi new file mode 100644 index 0000000..b52aa5a --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/safeRestartable.pyi @@ -0,0 +1,5 @@ +from .restartable import RestartableStrategy + +class SafeRestartableStrategy(RestartableStrategy): + thread_safe: bool + def __init__(self, ldap_connection) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/safeSync.pyi b/stubs/ldap3/ldap3/strategy/safeSync.pyi new file mode 100644 index 0000000..2b8b513 --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/safeSync.pyi @@ -0,0 +1,5 @@ +from .sync import SyncStrategy + +class SafeSyncStrategy(SyncStrategy): + thread_safe: bool + def __init__(self, ldap_connection) -> None: ... diff --git a/stubs/ldap3/ldap3/strategy/sync.pyi b/stubs/ldap3/ldap3/strategy/sync.pyi new file mode 100644 index 0000000..a1a8460 --- /dev/null +++ b/stubs/ldap3/ldap3/strategy/sync.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from ..strategy.base import BaseStrategy + +LDAP_MESSAGE_TEMPLATE: Any + +class SyncStrategy(BaseStrategy): + sync: bool + no_real_dsa: bool + pooled: bool + can_stream: bool + socket_size: Any + def __init__(self, ldap_connection) -> None: ... + def open(self, reset_usage: bool = ..., read_server_info: bool = ...) -> None: ... + def receiving(self): ... + def post_send_single_response(self, message_id): ... + def post_send_search(self, message_id): ... + def set_stream(self, value) -> None: ... + def get_stream(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/edge/__init__.pyi b/stubs/ldap3/ldap3/utils/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/edge/__init__.pyi rename to stubs/ldap3/ldap3/utils/__init__.pyi diff --git a/stubs/ldap3/ldap3/utils/asn1.pyi b/stubs/ldap3/ldap3/utils/asn1.pyi new file mode 100644 index 0000000..6af8d2c --- /dev/null +++ b/stubs/ldap3/ldap3/utils/asn1.pyi @@ -0,0 +1,37 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.codec.ber.encoder import AbstractItemEncoder +_AbstractItemEncoder: TypeAlias = Any + +CLASSES: Any + +class LDAPBooleanEncoder(_AbstractItemEncoder): + supportIndefLenMode: bool + # Requires pyasn1 > 0.3.7 + def encodeValue(self, value, asn1Spec, encodeFun, **options): ... + +customTagMap: Any +customTypeMap: Any + +def compute_ber_size(data): ... +def decode_message_fast(message): ... +def decode_sequence(message, start, stop, context_decoders: Any | None = ...): ... +def decode_integer(message, start, stop, context_decoders: Any | None = ...): ... +def decode_octet_string(message, start, stop, context_decoders: Any | None = ...): ... +def decode_boolean(message, start, stop, context_decoders: Any | None = ...): ... +def decode_bind_response(message, start, stop, context_decoders: Any | None = ...): ... +def decode_extended_response(message, start, stop, context_decoders: Any | None = ...): ... +def decode_intermediate_response(message, start, stop, context_decoders: Any | None = ...): ... +def decode_controls(message, start, stop, context_decoders: Any | None = ...): ... +def ldap_result_to_dict_fast(response): ... +def get_byte(x): ... +def get_bytes(x): ... + +DECODERS: Any +BIND_RESPONSE_CONTEXT: Any +EXTENDED_RESPONSE_CONTEXT: Any +INTERMEDIATE_RESPONSE_CONTEXT: Any +LDAP_MESSAGE_CONTEXT: Any +CONTROLS_CONTEXT: Any diff --git a/stubs/ldap3/ldap3/utils/ciDict.pyi b/stubs/ldap3/ldap3/utils/ciDict.pyi new file mode 100644 index 0000000..2564fc6 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/ciDict.pyi @@ -0,0 +1,29 @@ +from collections.abc import MutableMapping +from typing import Any, Generic, TypeVar + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + +class CaseInsensitiveDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): + def __init__(self, other: Any | None = ..., **kwargs) -> None: ... + def __contains__(self, item): ... + def __delitem__(self, key) -> None: ... + def __setitem__(self, key, item) -> None: ... + def __getitem__(self, key): ... + def __iter__(self): ... + def __len__(self): ... + def keys(self): ... + def values(self): ... + def items(self): ... + def __eq__(self, other): ... + def copy(self): ... + +class CaseInsensitiveWithAliasDict(CaseInsensitiveDict[_KT, _VT], Generic[_KT, _VT]): + def __init__(self, other: Any | None = ..., **kwargs) -> None: ... + def aliases(self): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def set_alias(self, key, alias, ignore_duplicates: bool = ...) -> None: ... + def remove_alias(self, alias) -> None: ... + def __getitem__(self, key): ... + def copy(self): ... diff --git a/stubs/ldap3/ldap3/utils/config.pyi b/stubs/ldap3/ldap3/utils/config.pyi new file mode 100644 index 0000000..80971d5 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/config.pyi @@ -0,0 +1,6 @@ +from typing import Any + +PARAMETERS: Any + +def get_config_parameter(parameter): ... +def set_config_parameter(parameter, value) -> None: ... diff --git a/stubs/ldap3/ldap3/utils/conv.pyi b/stubs/ldap3/ldap3/utils/conv.pyi new file mode 100644 index 0000000..280e208 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/conv.pyi @@ -0,0 +1,14 @@ +from typing import Any + +def to_unicode(obj: float | bytes | str, encoding: str | None = ..., from_server: bool = ...) -> str: ... +def to_raw(obj, encoding: str = ...): ... +def escape_filter_chars(text: float | bytes | str, encoding: str | None = ...) -> str: ... +def unescape_filter_chars(text, encoding: Any | None = ...): ... +def escape_bytes(bytes_value: str | bytes) -> str: ... +def prepare_for_stream(value): ... +def json_encode_b64(obj): ... +def check_json_dict(json_dict) -> None: ... +def json_hook(obj): ... +def format_json(obj, iso_format: bool = ...): ... +def is_filter_escaped(text): ... +def ldap_escape_to_bytes(text): ... diff --git a/stubs/ldap3/ldap3/utils/dn.pyi b/stubs/ldap3/ldap3/utils/dn.pyi new file mode 100644 index 0000000..dab0cdf --- /dev/null +++ b/stubs/ldap3/ldap3/utils/dn.pyi @@ -0,0 +1,11 @@ +STATE_ANY: int +STATE_ESCAPE: int +STATE_ESCAPE_HEX: int + +def to_dn( + iterator, decompose: bool = ..., remove_space: bool = ..., space_around_equal: bool = ..., separate_rdn: bool = ... +): ... +def parse_dn(dn, escape: bool = ..., strip: bool = ...): ... +def safe_dn(dn, decompose: bool = ..., reverse: bool = ...): ... +def safe_rdn(dn, decompose: bool = ...): ... +def escape_rdn(rdn: str) -> str: ... diff --git a/stubs/ldap3/ldap3/utils/hashed.pyi b/stubs/ldap3/ldap3/utils/hashed.pyi new file mode 100644 index 0000000..74734cc --- /dev/null +++ b/stubs/ldap3/ldap3/utils/hashed.pyi @@ -0,0 +1,6 @@ +from typing import Any + +algorithms_table: Any +salted_table: Any + +def hashed(algorithm, value, salt: Any | None = ..., raw: bool = ..., encoding: str = ...): ... diff --git a/stubs/ldap3/ldap3/utils/log.pyi b/stubs/ldap3/ldap3/utils/log.pyi new file mode 100644 index 0000000..a5c47f7 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/log.pyi @@ -0,0 +1,25 @@ +from logging import NullHandler as NullHandler +from typing import Any + +OFF: int +ERROR: int +BASIC: int +PROTOCOL: int +NETWORK: int +EXTENDED: int +DETAIL_LEVELS: Any + +def get_detail_level_name(level_name): ... +def log(detail, message, *args) -> None: ... +def log_enabled(detail): ... +def set_library_log_hide_sensitive_data(hide: bool = ...) -> None: ... +def get_library_log_hide_sensitive_data(): ... +def set_library_log_activation_level(logging_level) -> None: ... +def get_library_log_activation_lavel(): ... +def set_library_log_max_line_length(length) -> None: ... +def get_library_log_max_line_length(): ... +def set_library_log_detail_level(detail) -> None: ... +def get_library_log_detail_level(): ... +def format_ldap_message(message, prefix): ... + +logger: Any diff --git a/stubs/ldap3/ldap3/utils/ntlm.pyi b/stubs/ldap3/ldap3/utils/ntlm.pyi new file mode 100644 index 0000000..6e122f3 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/ntlm.pyi @@ -0,0 +1,117 @@ +from typing import Any + +oem_encoding: Any +NTLM_SIGNATURE: bytes +NTLM_MESSAGE_TYPE_NTLM_NEGOTIATE: int +NTLM_MESSAGE_TYPE_NTLM_CHALLENGE: int +NTLM_MESSAGE_TYPE_NTLM_AUTHENTICATE: int +FLAG_NEGOTIATE_56: int +FLAG_NEGOTIATE_KEY_EXCH: int +FLAG_NEGOTIATE_128: int +FLAG_NEGOTIATE_VERSION: int +FLAG_NEGOTIATE_TARGET_INFO: int +FLAG_REQUEST_NOT_NT_SESSION_KEY: int +FLAG_NEGOTIATE_IDENTIFY: int +FLAG_NEGOTIATE_EXTENDED_SESSIONSECURITY: int +FLAG_TARGET_TYPE_SERVER: int +FLAG_TARGET_TYPE_DOMAIN: int +FLAG_NEGOTIATE_ALWAYS_SIGN: int +FLAG_NEGOTIATE_OEM_WORKSTATION_SUPPLIED: int +FLAG_NEGOTIATE_OEM_DOMAIN_SUPPLIED: int +FLAG_NEGOTIATE_ANONYMOUS: int +FLAG_NEGOTIATE_NTLM: int +FLAG_NEGOTIATE_LM_KEY: int +FLAG_NEGOTIATE_DATAGRAM: int +FLAG_NEGOTIATE_SEAL: int +FLAG_NEGOTIATE_SIGN: int +FLAG_REQUEST_TARGET: int +FLAG_NEGOTIATE_OEM: int +FLAG_NEGOTIATE_UNICODE: int +FLAG_TYPES: Any +AV_END_OF_LIST: int +AV_NETBIOS_COMPUTER_NAME: int +AV_NETBIOS_DOMAIN_NAME: int +AV_DNS_COMPUTER_NAME: int +AV_DNS_DOMAIN_NAME: int +AV_DNS_TREE_NAME: int +AV_FLAGS: int +AV_TIMESTAMP: int +AV_SINGLE_HOST_DATA: int +AV_TARGET_NAME: int +AV_CHANNEL_BINDINGS: int +AV_TYPES: Any +AV_FLAG_CONSTRAINED: int +AV_FLAG_INTEGRITY: int +AV_FLAG_TARGET_SPN_UNTRUSTED: int +AV_FLAG_TYPES: Any + +def pack_windows_version(debug: bool = ...): ... +def unpack_windows_version(version_message): ... + +class NtlmClient: + client_config_flags: int + exported_session_key: Any + negotiated_flags: Any + user_name: Any + user_domain: Any + no_lm_response_ntlm_v1: Any + client_blocked: bool + client_block_exceptions: Any + client_require_128_bit_encryption: Any + max_life_time: Any + client_signing_key: Any + client_sealing_key: Any + sequence_number: Any + server_sealing_key: Any + server_signing_key: Any + integrity: bool + replay_detect: bool + sequence_detect: bool + confidentiality: bool + datagram: bool + identity: bool + client_supplied_target_name: Any + client_channel_binding_unhashed: Any + unverified_target_name: Any + server_challenge: Any + server_target_name: Any + server_target_info: Any + server_version: Any + server_av_netbios_computer_name: Any + server_av_netbios_domain_name: Any + server_av_dns_computer_name: Any + server_av_dns_domain_name: Any + server_av_dns_forest_name: Any + server_av_target_name: Any + server_av_flags: Any + server_av_timestamp: Any + server_av_single_host_data: Any + server_av_channel_bindings: Any + server_av_flag_constrained: Any + server_av_flag_integrity: Any + server_av_flag_target_spn_untrusted: Any + current_encoding: Any + client_challenge: Any + server_target_info_raw: Any + def __init__(self, domain, user_name, password) -> None: ... + def get_client_flag(self, flag): ... + def get_negotiated_flag(self, flag): ... + def get_server_av_flag(self, flag): ... + def set_client_flag(self, flags) -> None: ... + def reset_client_flags(self) -> None: ... + def unset_client_flag(self, flags) -> None: ... + def create_negotiate_message(self): ... + def parse_challenge_message(self, message): ... + def create_authenticate_message(self): ... + @staticmethod + def pack_field(value, offset): ... + @staticmethod + def unpack_field(field_message): ... + @staticmethod + def unpack_av_info(info): ... + @staticmethod + def pack_av_info(avs): ... + @staticmethod + def pack_windows_timestamp(): ... + def compute_nt_response(self): ... + def ntowf_v2(self): ... diff --git a/stubs/ldap3/ldap3/utils/port_validators.pyi b/stubs/ldap3/ldap3/utils/port_validators.pyi new file mode 100644 index 0000000..c120f02 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/port_validators.pyi @@ -0,0 +1,2 @@ +def check_port(port): ... +def check_port_and_port_list(port, port_list): ... diff --git a/stubs/ldap3/ldap3/utils/repr.pyi b/stubs/ldap3/ldap3/utils/repr.pyi new file mode 100644 index 0000000..f2c58e2 --- /dev/null +++ b/stubs/ldap3/ldap3/utils/repr.pyi @@ -0,0 +1,5 @@ +from typing import Any + +repr_encoding: Any + +def to_stdout_encoding(value): ... diff --git a/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi b/stubs/ldap3/ldap3/utils/tls_backport.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi rename to stubs/ldap3/ldap3/utils/tls_backport.pyi diff --git a/stubs/ldap3/ldap3/utils/uri.pyi b/stubs/ldap3/ldap3/utils/uri.pyi new file mode 100644 index 0000000..45ea8bb --- /dev/null +++ b/stubs/ldap3/ldap3/utils/uri.pyi @@ -0,0 +1 @@ +def parse_uri(uri): ... diff --git a/stubs/ldap3/ldap3/version.pyi b/stubs/ldap3/ldap3/version.pyi new file mode 100644 index 0000000..50be840 --- /dev/null +++ b/stubs/ldap3/ldap3/version.pyi @@ -0,0 +1,3 @@ +__url__: str +__description__: str +__status__: str diff --git a/stubs/mock/@tests/stubtest_allowlist.txt b/stubs/mock/@tests/stubtest_allowlist.txt index 625ddb3..fea9da9 100644 --- a/stubs/mock/@tests/stubtest_allowlist.txt +++ b/stubs/mock/@tests/stubtest_allowlist.txt @@ -2,3 +2,12 @@ mock.NonCallableMock.__new__ mock.patch mock.mock.NonCallableMock.__new__ mock.mock.patch + +# Methods with a first argument that's not called "self" +mock.mock.AsyncMockMixin.assert_any_await +mock.mock.AsyncMockMixin.assert_awaited +mock.mock.AsyncMockMixin.assert_awaited_once +mock.mock.AsyncMockMixin.assert_awaited_once_with +mock.mock.AsyncMockMixin.assert_awaited_with +mock.mock.AsyncMockMixin.assert_has_awaits +mock.mock.AsyncMockMixin.assert_not_awaited diff --git a/stubs/mock/METADATA.toml b/stubs/mock/METADATA.toml index 3db9f3e..1ebdb51 100644 --- a/stubs/mock/METADATA.toml +++ b/stubs/mock/METADATA.toml @@ -1 +1,4 @@ -version = "4.0" +version = "4.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/mock/mock/__init__.pyi b/stubs/mock/mock/__init__.pyi index e97abe8..9b47e22 100644 --- a/stubs/mock/mock/__init__.pyi +++ b/stubs/mock/mock/__init__.pyi @@ -1,5 +1,3 @@ -from typing import Tuple - from .mock import * -version_info: Tuple[int, int, int] +version_info: tuple[int, int, int] diff --git a/stubs/mock/mock/backports.pyi b/stubs/mock/mock/backports.pyi new file mode 100644 index 0000000..3984dd8 --- /dev/null +++ b/stubs/mock/mock/backports.pyi @@ -0,0 +1,11 @@ +import sys + +if sys.version_info >= (3, 8): + from asyncio import iscoroutinefunction as iscoroutinefunction + from unittest import IsolatedAsyncioTestCase as IsolatedAsyncioTestCase +else: + import unittest + + class IsolatedAsyncioTestCase(unittest.TestCase): ... + # It is a typeguard, but its signature is to complex to duplicate. + def iscoroutinefunction(obj: object) -> bool: ... diff --git a/stubs/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index 47d0730..4506dbb 100644 --- a/stubs/mock/mock/mock.pyi +++ b/stubs/mock/mock/mock.pyi @@ -1,12 +1,17 @@ -from collections.abc import Callable, Mapping, Sequence -from typing import Any, Generic, List, Tuple, Type, TypeVar, overload +from _typeshed import Self +from collections.abc import Awaitable, Callable, Mapping, Sequence +from contextlib import AbstractContextManager +from types import TracebackType +from typing import Any, Generic, TypeVar, overload +from typing_extensions import Literal _F = TypeVar("_F", bound=Callable[..., Any]) +_AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]]) _T = TypeVar("_T") -_TT = TypeVar("_TT", bound=Type[Any]) +_TT = TypeVar("_TT", bound=type[Any]) _R = TypeVar("_R") -__all__ = [ +__all__ = ( "Mock", "MagicMock", "patch", @@ -22,64 +27,55 @@ __all__ = [ "mock_open", "PropertyMock", "seal", -] +) __version__: str FILTER_DIR: Any -class _slotted: ... - -class _SentinelObject: - name: Any - def __init__(self, name: Any) -> None: ... - -class _Sentinel: - def __init__(self) -> None: ... - def __getattr__(self, name: str) -> Any: ... - sentinel: Any DEFAULT: Any -class _Call(Tuple[Any, ...]): +class _Call(tuple[Any, ...]): def __new__( - cls, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ... - ) -> Any: ... + cls: type[Self], + value: Any = ..., + name: Any | None = ..., + parent: Any | None = ..., + two: bool = ..., + from_kall: bool = ..., + ) -> Self: ... name: Any parent: Any from_kall: Any def __init__( self, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ... ) -> None: ... - def __eq__(self, other: Any) -> bool: ... - __ne__: Any + def __eq__(self, other: object) -> bool: ... + def __ne__(self, __other: object) -> bool: ... def __call__(self, *args: Any, **kwargs: Any) -> _Call: ... - def __getattr__(self, attr: Any) -> Any: ... - def count(self, *args: Any, **kwargs: Any) -> Any: ... - def index(self, *args: Any, **kwargs: Any) -> Any: ... - def call_list(self) -> Any: ... + def __getattr__(self, attr: str) -> Any: ... + @property + def args(self) -> tuple[Any, ...]: ... + @property + def kwargs(self) -> dict[str, Any]: ... + def call_list(self) -> _CallList: ... call: _Call -class _CallList(List[_Call]): +class _CallList(list[_Call]): def __contains__(self, value: Any) -> bool: ... -class _MockIter: - obj: Any - def __init__(self, obj: Any) -> None: ... - def __iter__(self) -> Any: ... - def __next__(self) -> Any: ... - class Base: def __init__(self, *args: Any, **kwargs: Any) -> None: ... -class NonCallableMock(Base, Any): # type: ignore - def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ... +class NonCallableMock(Base, Any): + def __new__(__cls: type[Self], *args: Any, **kw: Any) -> Self: ... def __init__( self, - spec: list[str] | object | Type[object] | None = ..., + spec: list[str] | object | type[object] | None = ..., wraps: Any | None = ..., name: str | None = ..., - spec_set: list[str] | object | Type[object] | None = ..., + spec_set: list[str] | object | type[object] | None = ..., parent: NonCallableMock | None = ..., _spec_state: Any | None = ..., _new_name: str = ..., @@ -113,7 +109,7 @@ class NonCallableMock(Base, Any): # type: ignore call_args_list: _CallList mock_calls: _CallList def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ... - def _call_matcher(self, _call: Tuple[_Call, ...]) -> _Call: ... + def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call: ... def _get_child_mock(self, **kw: Any) -> NonCallableMock: ... class CallableMixin(Base): @@ -149,23 +145,6 @@ class _patch(Generic[_T]): autospec: Any kwargs: Mapping[str, Any] additional_patchers: Any - @overload - def __init__( - self: _patch[MagicMock | AsyncMock], - getter: Callable[[], Any], - attribute: str, - *, - spec: Any | None, - create: bool, - spec_set: Any | None, - autospec: Any | None, - new_callable: Any | None, - kwargs: Mapping[str, Any], - ) -> None: ... - # This overload also covers the case, where new==DEFAULT. In this case, self is _patch[Any]. - # Ideally we'd be able to add an overload for it so that self is _patch[MagicMock], - # but that's impossible with the current type system. - @overload def __init__( self: _patch[_T], getter: Callable[[], Any], @@ -182,12 +161,18 @@ class _patch(Generic[_T]): def __call__(self, func: Callable[..., _R]) -> Callable[..., _R]: ... def decorate_class(self, klass: _TT) -> _TT: ... def decorate_callable(self, func: _F) -> _F: ... + def decorate_async_callable(self, func: _AF) -> _AF: ... + def decoration_helper( + self, patched: Any, args: tuple[Any, ...], keywargs: dict[str, Any] + ) -> AbstractContextManager[tuple[tuple[Any, ...], dict[str, Any]]]: ... def get_original(self) -> tuple[Any, bool]: ... target: Any temp_original: Any is_local: bool def __enter__(self) -> _T: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> None: ... def start(self) -> _T: ... def stop(self) -> None: ... @@ -199,15 +184,15 @@ class _patch_dict: def __call__(self, f: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, *args: Any) -> Any: ... + def __exit__(self, *args: object) -> Any: ... start: Any stop: Any class _patcher: TEST_PREFIX: str - dict: Type[_patch_dict] + dict: type[_patch_dict] @overload - def __call__( # type: ignore + def __call__( # type: ignore[misc] self, target: Any, *, @@ -234,7 +219,7 @@ class _patcher: **kwargs: Any, ) -> _patch[_T]: ... @overload - def object( # type: ignore + def object( # type: ignore[misc] self, target: Any, attribute: str, @@ -251,7 +236,7 @@ class _patcher: self, target: Any, attribute: str, - new: _T = ..., + new: _T, spec: Any | None = ..., create: bool = ..., spec_set: Any | None = ..., @@ -284,7 +269,6 @@ class MagicMock(MagicMixin, Mock): class AsyncMockMixin(Base): def __init__(self, *args: Any, **kwargs: Any) -> None: ... - async def _execute_mock_call(self, *args: Any, **kwargs: Any) -> Any: ... def assert_awaited(self) -> None: ... def assert_awaited_once(self) -> None: ... def assert_awaited_with(self, *args: Any, **kwargs: Any) -> None: ... @@ -302,17 +286,16 @@ class AsyncMagicMixin(MagicMixin): class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ... -class MagicProxy: - name: Any +class MagicProxy(Base): + name: str parent: Any - def __init__(self, name: Any, parent: Any) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def __init__(self, name: str, parent: Any) -> None: ... def create_mock(self) -> Any: ... def __get__(self, obj: Any, _type: Any | None = ...) -> Any: ... class _ANY: - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... + def __eq__(self, other: object) -> Literal[True]: ... + def __ne__(self, other: object) -> Literal[False]: ... ANY: Any @@ -339,6 +322,8 @@ class _SpecState: def mock_open(mock: Any | None = ..., read_data: Any = ...) -> Any: ... -PropertyMock = Any +class PropertyMock(Mock): + def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ... + def __set__(self, obj: Any, value: Any) -> None: ... def seal(mock: Any) -> None: ... diff --git a/stubs/mypy-extensions/METADATA.toml b/stubs/mypy-extensions/METADATA.toml index 8732c02..de6579f 100644 --- a/stubs/mypy-extensions/METADATA.toml +++ b/stubs/mypy-extensions/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.4" -python2 = true +version = "0.4.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/mypy-extensions/mypy_extensions.pyi b/stubs/mypy-extensions/mypy_extensions.pyi index fc6de37..4754794 100644 --- a/stubs/mypy-extensions/mypy_extensions.pyi +++ b/stubs/mypy-extensions/mypy_extensions.pyi @@ -1,46 +1,70 @@ import abc import sys -from typing import Any, Callable, Generic, ItemsView, KeysView, Mapping, Type, TypeVar, Union, ValuesView +from _collections_abc import dict_items, dict_keys, dict_values +from _typeshed import IdentityFunction, Self +from collections.abc import Mapping +from typing import Any, ClassVar, Generic, TypeVar, overload, type_check_only +from typing_extensions import Never _T = TypeVar("_T") _U = TypeVar("_U") # Internal mypy fallback type for all typed dicts (does not exist at runtime) +# N.B. Keep this mostly in sync with typing(_extensions)._TypedDict +@type_check_only class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): - def copy(self: _T) -> _T: ... - # Using NoReturn so that only calls using mypy plugin hook that specialize the signature + __total__: ClassVar[bool] + # Unlike typing(_extensions).TypedDict, + # subclasses of mypy_extensions.TypedDict do NOT have the __required_keys__ and __optional_keys__ ClassVars + def copy(self: Self) -> Self: ... + # Using Never so that only calls using mypy plugin hook that specialize the signature # can go through. - def setdefault(self, k: NoReturn, default: object) -> object: ... + def setdefault(self, k: Never, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore - def update(self: _T, __m: _T) -> None: ... - if sys.version_info >= (3, 0): - def items(self) -> ItemsView[str, object]: ... - def keys(self) -> KeysView[str]: ... - def values(self) -> ValuesView[object]: ... - else: - def has_key(self, k: str) -> bool: ... - def viewitems(self) -> ItemsView[str, object]: ... - def viewkeys(self) -> KeysView[str]: ... - def viewvalues(self) -> ValuesView[object]: ... - def __delitem__(self, k: NoReturn) -> None: ... + def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] + def update(self: Self, __m: Self) -> None: ... + def items(self) -> dict_items[str, object]: ... + def keys(self) -> dict_keys[str, object]: ... + def values(self) -> dict_values[str, object]: ... + def __delitem__(self, k: Never) -> None: ... + if sys.version_info >= (3, 9): + def __or__(self: Self, __other: Self) -> Self: ... + def __ior__(self: Self, __other: Self) -> Self: ... -def TypedDict(typename: str, fields: dict[str, Type[Any]], total: bool = ...) -> Type[dict[str, Any]]: ... -def Arg(type: _T = ..., name: str | None = ...) -> _T: ... -def DefaultArg(type: _T = ..., name: str | None = ...) -> _T: ... -def NamedArg(type: _T = ..., name: str | None = ...) -> _T: ... -def DefaultNamedArg(type: _T = ..., name: str | None = ...) -> _T: ... -def VarArg(type: _T = ...) -> _T: ... -def KwArg(type: _T = ...) -> _T: ... +def TypedDict(typename: str, fields: dict[str, type[Any]], total: bool = ...) -> type[dict[str, Any]]: ... +@overload +def Arg(type: _T, name: str | None = ...) -> _T: ... +@overload +def Arg(*, name: str | None = ...) -> Any: ... +@overload +def DefaultArg(type: _T, name: str | None = ...) -> _T: ... +@overload +def DefaultArg(*, name: str | None = ...) -> Any: ... +@overload +def NamedArg(type: _T, name: str | None = ...) -> _T: ... +@overload +def NamedArg(*, name: str | None = ...) -> Any: ... +@overload +def DefaultNamedArg(type: _T, name: str | None = ...) -> _T: ... +@overload +def DefaultNamedArg(*, name: str | None = ...) -> Any: ... +@overload +def VarArg(type: _T) -> _T: ... +@overload +def VarArg() -> Any: ... +@overload +def KwArg(type: _T) -> _T: ... +@overload +def KwArg() -> Any: ... # Return type that indicates a function does not return. -# This type is equivalent to the None type, but the no-op Union is necessary to -# distinguish the None type from the None value. -NoReturn = Union[None] # Deprecated: Use typing.NoReturn instead. +# Deprecated: Use typing.NoReturn instead. +class NoReturn: ... -# This is intended as a class decorator, but mypy rejects abstract classes -# when a Type[_T] is expected, so we can't give it the type we want -def trait(cls: Any) -> Any: ... -def mypyc_attr(*attrs: str, **kwattrs: object) -> Callable[[_T], _T]: ... +# This is consistent with implementation. Usage intends for this as +# a class decorator, but mypy does not support type[_T] for abstract +# classes until this issue is resolved, https://github.com/python/mypy/issues/4717. +def trait(cls: _T) -> _T: ... +def mypyc_attr(*attrs: str, **kwattrs: object) -> IdentityFunction: ... class FlexibleAlias(Generic[_T, _U]): ... diff --git a/stubs/mysqlclient/@tests/stubtest_allowlist.txt b/stubs/mysqlclient/@tests/stubtest_allowlist.txt index 1e7b85b..fbc91ac 100644 --- a/stubs/mysqlclient/@tests/stubtest_allowlist.txt +++ b/stubs/mysqlclient/@tests/stubtest_allowlist.txt @@ -1,8 +1 @@ MySQLdb.Connection -MySQLdb.connections -MySQLdb.constants.CLIENT -MySQLdb.constants.CR -MySQLdb.constants.ER -MySQLdb.constants.FLAG -MySQLdb.converters -MySQLdb.cursors diff --git a/stubs/mysqlclient/METADATA.toml b/stubs/mysqlclient/METADATA.toml index be8be53..ec7ff4c 100644 --- a/stubs/mysqlclient/METADATA.toml +++ b/stubs/mysqlclient/METADATA.toml @@ -1 +1,4 @@ -version = "2.0" \ No newline at end of file +version = "2.1.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/mysqlclient/MySQLdb/__init__.pyi b/stubs/mysqlclient/MySQLdb/__init__.pyi index 88d6eb2..87fbcf2 100644 --- a/stubs/mysqlclient/MySQLdb/__init__.pyi +++ b/stubs/mysqlclient/MySQLdb/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, FrozenSet +from typing import Any from MySQLdb import connections as connections, constants as constants, converters as converters, cursors as cursors from MySQLdb._mysql import ( @@ -14,8 +14,6 @@ from MySQLdb._mysql import ( ProgrammingError as ProgrammingError, Warning as Warning, debug as debug, - escape as escape, - escape_string as escape_string, get_client_info as get_client_info, string_literal as string_literal, ) @@ -35,7 +33,7 @@ threadsafety: int apilevel: str paramstyle: str -class DBAPISet(FrozenSet[Any]): +class DBAPISet(frozenset[Any]): def __eq__(self, other): ... STRING: Any diff --git a/stubs/mysqlclient/MySQLdb/_mysql.pyi b/stubs/mysqlclient/MySQLdb/_mysql.pyi index 690e346..1fba3f1 100644 --- a/stubs/mysqlclient/MySQLdb/_mysql.pyi +++ b/stubs/mysqlclient/MySQLdb/_mysql.pyi @@ -1,9 +1,9 @@ import builtins -from typing import Any, Tuple +from typing import Any import MySQLdb._exceptions -version_info: Tuple[Any, ...] +version_info: tuple[Any, ...] class DataError(MySQLdb._exceptions.DatabaseError): ... class DatabaseError(MySQLdb._exceptions.Error): ... @@ -63,8 +63,8 @@ class connection: def thread_id(self, *args, **kwargs) -> Any: ... def use_result(self, *args, **kwargs) -> Any: ... def warning_count(self, *args, **kwargs) -> Any: ... - def __delattr__(self, name) -> Any: ... - def __setattr__(self, name, value) -> Any: ... + def __delattr__(self, __name) -> Any: ... + def __setattr__(self, __name, __value) -> Any: ... class result: converter: Any @@ -76,8 +76,8 @@ class result: def field_flags(self, *args, **kwargs) -> Any: ... def num_fields(self, *args, **kwargs) -> Any: ... def num_rows(self, *args, **kwargs) -> Any: ... - def __delattr__(self, name) -> Any: ... - def __setattr__(self, name, value) -> Any: ... + def __delattr__(self, __name) -> Any: ... + def __setattr__(self, __name, __value) -> Any: ... def connect(*args, **kwargs) -> Any: ... def debug(*args, **kwargs) -> Any: ... diff --git a/stubs/mysqlclient/MySQLdb/connections.pyi b/stubs/mysqlclient/MySQLdb/connections.pyi index 93bc84a..c03fcc5 100644 --- a/stubs/mysqlclient/MySQLdb/connections.pyi +++ b/stubs/mysqlclient/MySQLdb/connections.pyi @@ -1,6 +1,8 @@ +from _typeshed import Self +from types import TracebackType from typing import Any -from . import _mysql, cursors as cursors +from . import _mysql, cursors from ._exceptions import ( DatabaseError as DatabaseError, DataError as DataError, @@ -19,16 +21,18 @@ re_numeric_part: Any def numeric_part(s): ... class Connection(_mysql.connection): - default_cursor: Any - cursorclass: Any + default_cursor: type[cursors.Cursor] + cursorclass: type[cursors.BaseCursor] encoders: Any encoding: str messages: Any - def __init__(self, *args, **kwargs): ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, traceback) -> None: ... - def autocommit(self, on) -> None: ... - def cursor(self, cursorclass: Any | None = ...): ... + def __init__(self, *args, **kwargs) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + def autocommit(self, on: bool) -> None: ... + def cursor(self, cursorclass: type[cursors.BaseCursor] | None = ...): ... def query(self, query) -> None: ... def literal(self, o): ... def begin(self) -> None: ... @@ -36,13 +40,13 @@ class Connection(_mysql.connection): def set_character_set(self, charset) -> None: ... def set_sql_mode(self, sql_mode) -> None: ... def show_warnings(self): ... - Warning: Any - Error: Any - InterfaceError: Any - DatabaseError: Any - DataError: Any - OperationalError: Any - IntegrityError: Any - InternalError: Any - ProgrammingError: Any - NotSupportedError: Any + Warning: type[BaseException] + Error: type[BaseException] + InterfaceError: type[BaseException] + DatabaseError: type[BaseException] + DataError: type[BaseException] + OperationalError: type[BaseException] + IntegrityError: type[BaseException] + InternalError: type[BaseException] + ProgrammingError: type[BaseException] + NotSupportedError: type[BaseException] diff --git a/stubs/mysqlclient/MySQLdb/release.pyi b/stubs/mysqlclient/MySQLdb/release.pyi index 99069a2..a78eb9f 100644 --- a/stubs/mysqlclient/MySQLdb/release.pyi +++ b/stubs/mysqlclient/MySQLdb/release.pyi @@ -1,3 +1 @@ -from typing import Any - -version_info: Any +version_info: tuple[int, int, int, str, int] diff --git a/stubs/mysqlclient/MySQLdb/times.pyi b/stubs/mysqlclient/MySQLdb/times.pyi index 339617f..ecca1ad 100644 --- a/stubs/mysqlclient/MySQLdb/times.pyi +++ b/stubs/mysqlclient/MySQLdb/times.pyi @@ -9,18 +9,18 @@ Timestamp = datetime DateTimeDeltaType = timedelta DateTimeType = datetime -def DateFromTicks(ticks): ... -def TimeFromTicks(ticks): ... -def TimestampFromTicks(ticks): ... +def DateFromTicks(ticks: float | None) -> date: ... +def TimeFromTicks(ticks: float | None) -> time: ... +def TimestampFromTicks(ticks: float | None) -> datetime: ... format_TIME = str format_DATE = str -def format_TIMEDELTA(v): ... -def format_TIMESTAMP(d): ... -def DateTime_or_None(s): ... -def TimeDelta_or_None(s): ... -def Time_or_None(s): ... -def Date_or_None(s): ... -def DateTime2literal(d, c): ... -def DateTimeDelta2literal(d, c): ... +def format_TIMEDELTA(v: timedelta) -> str: ... +def format_TIMESTAMP(d: datetime) -> str: ... +def DateTime_or_None(s: str) -> datetime | None: ... +def TimeDelta_or_None(s: str) -> timedelta | None: ... +def Time_or_None(s: str) -> time | None: ... +def Date_or_None(s: str) -> date | None: ... +def DateTime2literal(d: datetime, c: object) -> str: ... +def DateTimeDelta2literal(d: datetime, c: object) -> str: ... diff --git a/stubs/oauthlib/METADATA.toml b/stubs/oauthlib/METADATA.toml index f958670..38c9468 100644 --- a/stubs/oauthlib/METADATA.toml +++ b/stubs/oauthlib/METADATA.toml @@ -1 +1 @@ -version = "3.1" +version = "3.2.*" diff --git a/stubs/oauthlib/oauthlib/common.pyi b/stubs/oauthlib/oauthlib/common.pyi index bdd7655..622e9e3 100644 --- a/stubs/oauthlib/oauthlib/common.pyi +++ b/stubs/oauthlib/oauthlib/common.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any UNICODE_ASCII_CHARACTER_SET: str CLIENT_ID_CHARACTER_SET: str @@ -28,7 +28,7 @@ def add_params_to_uri(uri, params, fragment: bool = ...): ... def safe_string_equals(a, b): ... def to_unicode(data, encoding: str = ...): ... -class CaseInsensitiveDict(Dict[Any, Any]): +class CaseInsensitiveDict(dict[Any, Any]): proxy: Any def __init__(self, data) -> None: ... def __contains__(self, k): ... diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/backend_application.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/backend_application.pyi index 97ce019..f3c64ec 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/backend_application.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/backend_application.pyi @@ -4,4 +4,4 @@ from .base import Client as Client class BackendApplicationClient(Client): grant_type: str - def prepare_request_body(self, body: str = ..., scope: Any | None = ..., include_client_id: bool = ..., **kwargs): ... # type: ignore + def prepare_request_body(self, body: str = ..., scope: Any | None = ..., include_client_id: bool = ..., **kwargs): ... # type: ignore[override] diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/base.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/base.pyi index 1000f33..7ccbc66 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/base.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/base.pyi @@ -21,6 +21,9 @@ class Client: redirect_url: Any code: Any expires_in: Any + code_verifier: str + code_challenge: str + code_challenge_method: str def __init__( self, client_id, @@ -35,6 +38,9 @@ class Client: state: Any | None = ..., redirect_url: Any | None = ..., state_generator=..., + code_verifier: str | None = ..., + code_challenge: str | None = ..., + code_challenge_method: str | None = ..., **kwargs, ) -> None: ... @property @@ -71,5 +77,7 @@ class Client: ): ... def parse_request_body_response(self, body, scope: Any | None = ..., **kwargs): ... def prepare_refresh_body(self, body: str = ..., refresh_token: Any | None = ..., scope: Any | None = ..., **kwargs): ... + def create_code_verifier(self, length: int) -> str: ... + def create_code_challenge(self, code_verifier: str, code_challenge_method: str | None = ...) -> str: ... def populate_code_attributes(self, response) -> None: ... def populate_token_attributes(self, response) -> None: ... diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/legacy_application.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/legacy_application.pyi index 2ed10bc..b7f6927 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/legacy_application.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/legacy_application.pyi @@ -5,6 +5,6 @@ from .base import Client as Client class LegacyApplicationClient(Client): grant_type: str def __init__(self, client_id, **kwargs) -> None: ... - def prepare_request_body( # type: ignore + def prepare_request_body( # type: ignore[override] self, username, password, body: str = ..., scope: Any | None = ..., include_client_id: bool = ..., **kwargs ): ... diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/mobile_application.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/mobile_application.pyi index 3b27f1d..fa9d338 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/mobile_application.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/mobile_application.pyi @@ -4,8 +4,8 @@ from .base import Client as Client class MobileApplicationClient(Client): response_type: str - def prepare_request_uri( # type: ignore + def prepare_request_uri( # type: ignore[override] self, uri, redirect_uri: Any | None = ..., scope: Any | None = ..., state: Any | None = ..., **kwargs ): ... token: Any - def parse_request_uri_response(self, uri, state: Any | None = ..., scope: Any | None = ...): ... # type: ignore + def parse_request_uri_response(self, uri, state: Any | None = ..., scope: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/service_application.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/service_application.pyi index d0f70cd..9a8d357 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/service_application.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/service_application.pyi @@ -17,7 +17,7 @@ class ServiceApplicationClient(Client): audience: Any | None = ..., **kwargs, ) -> None: ... - def prepare_request_body( # type: ignore + def prepare_request_body( # type: ignore[override] self, private_key: Any | None = ..., subject: Any | None = ..., diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/web_application.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/web_application.pyi index 5effe8c..68bf975 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/web_application.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/clients/web_application.pyi @@ -6,10 +6,23 @@ class WebApplicationClient(Client): grant_type: str code: Any def __init__(self, client_id, code: Any | None = ..., **kwargs) -> None: ... - def prepare_request_uri( # type: ignore - self, uri, redirect_uri: Any | None = ..., scope: Any | None = ..., state: Any | None = ..., **kwargs + def prepare_request_uri( # type: ignore[override] + self, + uri, + redirect_uri: Any | None = ..., + scope: Any | None = ..., + state: Any | None = ..., + code_challenge: str | None = ..., + code_challenge_method: str | None = ..., + **kwargs, ): ... - def prepare_request_body( # type: ignore - self, code: Any | None = ..., redirect_uri: Any | None = ..., body: str = ..., include_client_id: bool = ..., **kwargs + def prepare_request_body( # type: ignore[override] + self, + code: Any | None = ..., + redirect_uri: Any | None = ..., + body: str = ..., + include_client_id: bool = ..., + code_verifier: str | None = ..., + **kwargs, ): ... - def parse_request_uri_response(self, uri, state: Any | None = ...): ... # type: ignore + def parse_request_uri_response(self, uri, state: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/parameters.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/parameters.pyi index 2bc064f..ddbec10 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/parameters.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/parameters.pyi @@ -1,9 +1,19 @@ from typing import Any def prepare_grant_uri( - uri, client_id, response_type, redirect_uri: Any | None = ..., scope: Any | None = ..., state: Any | None = ..., **kwargs + uri, + client_id, + response_type, + redirect_uri: Any | None = ..., + scope: Any | None = ..., + state: Any | None = ..., + code_challenge: str | None = ..., + code_challenge_method: str | None = ..., + **kwargs, +): ... +def prepare_token_request( + grant_type, body: str = ..., include_client_id: bool = ..., code_verifier: str | None = ..., **kwargs ): ... -def prepare_token_request(grant_type, body: str = ..., include_client_id: bool = ..., **kwargs): ... def prepare_token_revocation_request( url, token, token_type_hint: str = ..., callback: Any | None = ..., body: str = ..., **kwargs ): ... diff --git a/stubs/oauthlib/oauthlib/oauth2/rfc6749/tokens.pyi b/stubs/oauthlib/oauthlib/oauth2/rfc6749/tokens.pyi index c11b07b..d4901f5 100644 --- a/stubs/oauthlib/oauthlib/oauth2/rfc6749/tokens.pyi +++ b/stubs/oauthlib/oauthlib/oauth2/rfc6749/tokens.pyi @@ -1,6 +1,6 @@ -from typing import Any, Dict +from typing import Any -class OAuth2Token(Dict[Any, Any]): +class OAuth2Token(dict[Any, Any]): def __init__(self, params, old_scope: Any | None = ...) -> None: ... @property def scope_changed(self): ... diff --git a/stubs/openpyxl/@tests/stubtest_allowlist.txt b/stubs/openpyxl/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..e72809b --- /dev/null +++ b/stubs/openpyxl/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +# "cls" argument has wrong name in implementation. +openpyxl.descriptors.slots.AutoSlotProperties.__new__ diff --git a/stubs/openpyxl/METADATA.toml b/stubs/openpyxl/METADATA.toml new file mode 100644 index 0000000..4a8e90c --- /dev/null +++ b/stubs/openpyxl/METADATA.toml @@ -0,0 +1 @@ +version = "3.0.*" diff --git a/stubs/openpyxl/openpyxl/__init__.pyi b/stubs/openpyxl/openpyxl/__init__.pyi new file mode 100644 index 0000000..686516d --- /dev/null +++ b/stubs/openpyxl/openpyxl/__init__.pyi @@ -0,0 +1,13 @@ +from openpyxl.compat.numbers import NUMPY as NUMPY +from openpyxl.reader.excel import load_workbook as load_workbook +from openpyxl.workbook import Workbook as Workbook +from openpyxl.xml import DEFUSEDXML as DEFUSEDXML, LXML as LXML + +from ._constants import ( + __author__ as __author__, + __author_email__ as __author_email__, + __license__ as __license__, + __maintainer_email__ as __maintainer_email__, + __url__ as __url__, + __version__ as __version__, +) diff --git a/stubs/openpyxl/openpyxl/_constants.pyi b/stubs/openpyxl/openpyxl/_constants.pyi new file mode 100644 index 0000000..ed593cc --- /dev/null +++ b/stubs/openpyxl/openpyxl/_constants.pyi @@ -0,0 +1,7 @@ +__author__: str +__author_email__: str +__license__: str +__maintainer_email__: str +__url__: str +__version__: str +__python__: str diff --git a/stubs/openpyxl/openpyxl/cell/__init__.pyi b/stubs/openpyxl/openpyxl/cell/__init__.pyi new file mode 100644 index 0000000..cc5d82b --- /dev/null +++ b/stubs/openpyxl/openpyxl/cell/__init__.pyi @@ -0,0 +1,2 @@ +from .cell import Cell as Cell, MergedCell as MergedCell, WriteOnlyCell as WriteOnlyCell +from .read_only import ReadOnlyCell as ReadOnlyCell diff --git a/stubs/openpyxl/openpyxl/cell/_writer.pyi b/stubs/openpyxl/openpyxl/cell/_writer.pyi new file mode 100644 index 0000000..ef2dc33 --- /dev/null +++ b/stubs/openpyxl/openpyxl/cell/_writer.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def etree_write_cell(xf, worksheet, cell, styled: Any | None = ...) -> None: ... +def lxml_write_cell(xf, worksheet, cell, styled: bool = ...) -> None: ... + +write_cell = lxml_write_cell +write_cell = etree_write_cell diff --git a/stubs/openpyxl/openpyxl/cell/cell.pyi b/stubs/openpyxl/openpyxl/cell/cell.pyi new file mode 100644 index 0000000..b8a8950 --- /dev/null +++ b/stubs/openpyxl/openpyxl/cell/cell.pyi @@ -0,0 +1,73 @@ +from typing import Any + +from openpyxl.styles.styleable import StyleableObject + +__docformat__: str +TIME_TYPES: Any +TIME_FORMATS: Any +STRING_TYPES: Any +KNOWN_TYPES: Any +ILLEGAL_CHARACTERS_RE: Any +ERROR_CODES: Any +TYPE_STRING: str +TYPE_FORMULA: str +TYPE_NUMERIC: str +TYPE_BOOL: str +TYPE_NULL: str +TYPE_INLINE: str +TYPE_ERROR: str +TYPE_FORMULA_CACHE_STRING: str +VALID_TYPES: Any + +def get_type(t, value): ... +def get_time_format(t): ... + +class Cell(StyleableObject): + row: Any + column: Any + data_type: str + def __init__( + self, worksheet, row: Any | None = ..., column: Any | None = ..., value: Any | None = ..., style_array: Any | None = ... + ) -> None: ... + @property + def coordinate(self): ... + @property + def col_idx(self): ... + @property + def column_letter(self): ... + @property + def encoding(self): ... + @property + def base_date(self): ... + def check_string(self, value): ... + def check_error(self, value): ... + @property + def value(self): ... + @value.setter + def value(self, value) -> None: ... + @property + def internal_value(self): ... + @property + def hyperlink(self): ... + @hyperlink.setter + def hyperlink(self, val) -> None: ... + @property + def is_date(self): ... + def offset(self, row: int = ..., column: int = ...): ... + @property + def comment(self): ... + @comment.setter + def comment(self, value) -> None: ... + +class MergedCell(StyleableObject): + data_type: str + comment: Any + hyperlink: Any + row: Any + column: Any + def __init__(self, worksheet, row: Any | None = ..., column: Any | None = ...) -> None: ... + @property + def coordinate(self): ... + value: Any + +def WriteOnlyCell(ws: Any | None = ..., value: Any | None = ...): ... diff --git a/stubs/openpyxl/openpyxl/cell/read_only.pyi b/stubs/openpyxl/openpyxl/cell/read_only.pyi new file mode 100644 index 0000000..1bd41de --- /dev/null +++ b/stubs/openpyxl/openpyxl/cell/read_only.pyi @@ -0,0 +1,51 @@ +from typing import Any + +class ReadOnlyCell: + parent: Any + row: Any + column: Any + data_type: Any + def __init__(self, sheet, row, column, value, data_type: str = ..., style_id: int = ...) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + # defined twice in the implementation + @property + def coordinate(self): ... + @property + def column_letter(self): ... + @property + def style_array(self): ... + @property + def has_style(self): ... + @property + def number_format(self): ... + @property + def font(self): ... + @property + def fill(self): ... + @property + def border(self): ... + @property + def alignment(self): ... + @property + def protection(self): ... + @property + def is_date(self): ... + @property + def internal_value(self): ... + @property + def value(self): ... + @value.setter + def value(self, value) -> None: ... + +class EmptyCell: + value: Any + is_date: bool + font: Any + border: Any + fill: Any + number_format: Any + alignment: Any + data_type: str + +EMPTY_CELL: Any diff --git a/stubs/openpyxl/openpyxl/cell/text.pyi b/stubs/openpyxl/openpyxl/cell/text.pyi new file mode 100644 index 0000000..aa65e80 --- /dev/null +++ b/stubs/openpyxl/openpyxl/cell/text.pyi @@ -0,0 +1,80 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable +from openpyxl.styles.fonts import Font + +class PhoneticProperties(Serialisable): + tagname: str + fontId: Any + type: Any + alignment: Any + def __init__(self, fontId: Any | None = ..., type: Any | None = ..., alignment: Any | None = ...) -> None: ... + +class PhoneticText(Serialisable): + tagname: str + sb: Any + eb: Any + t: Any + text: Any + def __init__(self, sb: Any | None = ..., eb: Any | None = ..., t: Any | None = ...) -> None: ... + +class InlineFont(Font): + tagname: str + rFont: Any + charset: Any + family: Any + b: Any + i: Any + strike: Any + outline: Any + shadow: Any + condense: Any + extend: Any + color: Any + sz: Any + u: Any + vertAlign: Any + scheme: Any + __elements__: Any + def __init__( + self, + rFont: Any | None = ..., + charset: Any | None = ..., + family: Any | None = ..., + b: Any | None = ..., + i: Any | None = ..., + strike: Any | None = ..., + outline: Any | None = ..., + shadow: Any | None = ..., + condense: Any | None = ..., + extend: Any | None = ..., + color: Any | None = ..., + sz: Any | None = ..., + u: Any | None = ..., + vertAlign: Any | None = ..., + scheme: Any | None = ..., + ) -> None: ... + +class RichText(Serialisable): + tagname: str + rPr: Any + font: Any + t: Any + text: Any + __elements__: Any + def __init__(self, rPr: Any | None = ..., t: Any | None = ...) -> None: ... + +class Text(Serialisable): + tagname: str + t: Any + plain: Any + r: Any + formatted: Any + rPh: Any + phonetic: Any + phoneticPr: Any + PhoneticProperties: Any + __elements__: Any + def __init__(self, t: Any | None = ..., r=..., rPh=..., phoneticPr: Any | None = ...) -> None: ... + @property + def content(self): ... diff --git a/stubs/openpyxl/openpyxl/chart/_3d.pyi b/stubs/openpyxl/openpyxl/chart/_3d.pyi new file mode 100644 index 0000000..3d2eeb4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/_3d.pyi @@ -0,0 +1,50 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class View3D(Serialisable): + tagname: str + rotX: Any + x_rotation: Any + hPercent: Any + height_percent: Any + rotY: Any + y_rotation: Any + depthPercent: Any + rAngAx: Any + right_angle_axes: Any + perspective: Any + extLst: Any + __elements__: Any + def __init__( + self, + rotX: int = ..., + hPercent: Any | None = ..., + rotY: int = ..., + depthPercent: Any | None = ..., + rAngAx: bool = ..., + perspective: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Surface(Serialisable): + tagname: str + thickness: Any + spPr: Any + graphicalProperties: Any + pictureOptions: Any + extLst: Any + __elements__: Any + def __init__( + self, thickness: Any | None = ..., spPr: Any | None = ..., pictureOptions: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class _3DBase(Serialisable): + tagname: str + view3D: Any + floor: Any + sideWall: Any + backWall: Any + def __init__( + self, view3D: Any | None = ..., floor: Any | None = ..., sideWall: Any | None = ..., backWall: Any | None = ... + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/__init__.pyi b/stubs/openpyxl/openpyxl/chart/__init__.pyi new file mode 100644 index 0000000..e0d73d1 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/__init__.pyi @@ -0,0 +1,15 @@ +from .area_chart import AreaChart as AreaChart, AreaChart3D as AreaChart3D +from .bar_chart import BarChart as BarChart, BarChart3D as BarChart3D +from .bubble_chart import BubbleChart as BubbleChart +from .line_chart import LineChart as LineChart, LineChart3D as LineChart3D +from .pie_chart import ( + DoughnutChart as DoughnutChart, + PieChart as PieChart, + PieChart3D as PieChart3D, + ProjectedPieChart as ProjectedPieChart, +) +from .radar_chart import RadarChart as RadarChart +from .reference import Reference as Reference +from .scatter_chart import ScatterChart as ScatterChart +from .stock_chart import StockChart as StockChart +from .surface_chart import SurfaceChart as SurfaceChart, SurfaceChart3D as SurfaceChart3D diff --git a/stubs/openpyxl/openpyxl/chart/_chart.pyi b/stubs/openpyxl/openpyxl/chart/_chart.pyi new file mode 100644 index 0000000..ac306aa --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/_chart.pyi @@ -0,0 +1,44 @@ +from abc import abstractmethod +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class AxId(Serialisable): # type: ignore[misc] + val: Any + def __init__(self, val) -> None: ... + +def PlotArea(): ... + +class ChartBase(Serialisable): + legend: Any + layout: Any + roundedCorners: Any + axId: Any + visible_cells_only: Any + display_blanks: Any + ser: Any + series: Any + title: Any + anchor: str + width: int + height: float + style: Any + mime_type: str + graphical_properties: Any + __elements__: Any + plot_area: Any + pivotSource: Any + pivotFormats: Any + idx_base: int + def __init__(self, axId=..., **kw) -> None: ... + def __hash__(self): ... + def __iadd__(self, other): ... + def to_tree(self, namespace: Any | None = ..., tagname: Any | None = ..., idx: Any | None = ...): ... # type: ignore[override] + def set_categories(self, labels) -> None: ... + def add_data(self, data, from_rows: bool = ..., titles_from_data: bool = ...) -> None: ... + def append(self, value) -> None: ... + @property + def path(self): ... + @property + @abstractmethod + def tagname(self) -> str: ... diff --git a/stubs/openpyxl/openpyxl/chart/area_chart.pyi b/stubs/openpyxl/openpyxl/chart/area_chart.pyi new file mode 100644 index 0000000..8e70dd7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/area_chart.pyi @@ -0,0 +1,46 @@ +from abc import abstractmethod +from typing import Any + +from ._chart import ChartBase + +class _AreaChartBase(ChartBase): + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + dropLines: Any + __elements__: Any + def __init__( + self, grouping: str = ..., varyColors: Any | None = ..., ser=..., dLbls: Any | None = ..., dropLines: Any | None = ... + ) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class AreaChart(_AreaChartBase): + tagname: str + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dropLines: Any + x_axis: Any + y_axis: Any + extLst: Any + __elements__: Any + def __init__(self, axId: Any | None = ..., extLst: Any | None = ..., **kw) -> None: ... + +class AreaChart3D(AreaChart): + tagname: str + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dropLines: Any + gapDepth: Any + x_axis: Any + y_axis: Any + z_axis: Any + __elements__: Any + def __init__(self, gapDepth: Any | None = ..., **kw) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/axis.pyi b/stubs/openpyxl/openpyxl/chart/axis.pyi new file mode 100644 index 0000000..ffdbc6a --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/axis.pyi @@ -0,0 +1,234 @@ +from abc import abstractmethod +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ChartLines(Serialisable): + tagname: str + spPr: Any + graphicalProperties: Any + def __init__(self, spPr: Any | None = ...) -> None: ... + +class Scaling(Serialisable): + tagname: str + logBase: Any + orientation: Any + max: Any + min: Any + extLst: Any + __elements__: Any + def __init__( + self, + logBase: Any | None = ..., + orientation: str = ..., + max: Any | None = ..., + min: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class _BaseAxis(Serialisable): + axId: Any + scaling: Any + delete: Any + axPos: Any + majorGridlines: Any + minorGridlines: Any + title: Any + numFmt: Any + number_format: Any + majorTickMark: Any + minorTickMark: Any + tickLblPos: Any + spPr: Any + graphicalProperties: Any + txPr: Any + textProperties: Any + crossAx: Any + crosses: Any + crossesAt: Any + __elements__: Any + def __init__( + self, + axId: Any | None = ..., + scaling: Any | None = ..., + delete: Any | None = ..., + axPos: str = ..., + majorGridlines: Any | None = ..., + minorGridlines: Any | None = ..., + title: Any | None = ..., + numFmt: Any | None = ..., + majorTickMark: Any | None = ..., + minorTickMark: Any | None = ..., + tickLblPos: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + crossAx: Any | None = ..., + crosses: Any | None = ..., + crossesAt: Any | None = ..., + ) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class DisplayUnitsLabel(Serialisable): + tagname: str + layout: Any + tx: Any + text: Any + spPr: Any + graphicalProperties: Any + txPr: Any + textPropertes: Any + __elements__: Any + def __init__( + self, layout: Any | None = ..., tx: Any | None = ..., spPr: Any | None = ..., txPr: Any | None = ... + ) -> None: ... + +class DisplayUnitsLabelList(Serialisable): + tagname: str + custUnit: Any + builtInUnit: Any + dispUnitsLbl: Any + extLst: Any + __elements__: Any + def __init__( + self, custUnit: Any | None = ..., builtInUnit: Any | None = ..., dispUnitsLbl: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class NumericAxis(_BaseAxis): + tagname: str + axId: Any + scaling: Any + delete: Any + axPos: Any + majorGridlines: Any + minorGridlines: Any + title: Any + numFmt: Any + majorTickMark: Any + minorTickMark: Any + tickLblPos: Any + spPr: Any + txPr: Any + crossAx: Any + crosses: Any + crossesAt: Any + crossBetween: Any + majorUnit: Any + minorUnit: Any + dispUnits: Any + extLst: Any + __elements__: Any + def __init__( + self, + crossBetween: Any | None = ..., + majorUnit: Any | None = ..., + minorUnit: Any | None = ..., + dispUnits: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... + @classmethod + def from_tree(cls, node): ... + +class TextAxis(_BaseAxis): + tagname: str + axId: Any + scaling: Any + delete: Any + axPos: Any + majorGridlines: Any + minorGridlines: Any + title: Any + numFmt: Any + majorTickMark: Any + minorTickMark: Any + tickLblPos: Any + spPr: Any + txPr: Any + crossAx: Any + crosses: Any + crossesAt: Any + auto: Any + lblAlgn: Any + lblOffset: Any + tickLblSkip: Any + tickMarkSkip: Any + noMultiLvlLbl: Any + extLst: Any + __elements__: Any + def __init__( + self, + auto: Any | None = ..., + lblAlgn: Any | None = ..., + lblOffset: int = ..., + tickLblSkip: Any | None = ..., + tickMarkSkip: Any | None = ..., + noMultiLvlLbl: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... + +class DateAxis(TextAxis): + tagname: str + axId: Any + scaling: Any + delete: Any + axPos: Any + majorGridlines: Any + minorGridlines: Any + title: Any + numFmt: Any + majorTickMark: Any + minorTickMark: Any + tickLblPos: Any + spPr: Any + txPr: Any + crossAx: Any + crosses: Any + crossesAt: Any + auto: Any + lblOffset: Any + baseTimeUnit: Any + majorUnit: Any + majorTimeUnit: Any + minorUnit: Any + minorTimeUnit: Any + extLst: Any + __elements__: Any + def __init__( + self, + auto: Any | None = ..., + lblOffset: Any | None = ..., + baseTimeUnit: Any | None = ..., + majorUnit: Any | None = ..., + majorTimeUnit: Any | None = ..., + minorUnit: Any | None = ..., + minorTimeUnit: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... + +class SeriesAxis(_BaseAxis): + tagname: str + axId: Any + scaling: Any + delete: Any + axPos: Any + majorGridlines: Any + minorGridlines: Any + title: Any + numFmt: Any + majorTickMark: Any + minorTickMark: Any + tickLblPos: Any + spPr: Any + txPr: Any + crossAx: Any + crosses: Any + crossesAt: Any + tickLblSkip: Any + tickMarkSkip: Any + extLst: Any + __elements__: Any + def __init__(self, tickLblSkip: Any | None = ..., tickMarkSkip: Any | None = ..., extLst: Any | None = ..., **kw) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/bar_chart.pyi b/stubs/openpyxl/openpyxl/chart/bar_chart.pyi new file mode 100644 index 0000000..d48fc86 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/bar_chart.pyi @@ -0,0 +1,70 @@ +from abc import abstractmethod +from typing import Any + +from ._3d import _3DBase +from ._chart import ChartBase + +class _BarChartBase(ChartBase): + barDir: Any + type: Any + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + __elements__: Any + def __init__( + self, barDir: str = ..., grouping: str = ..., varyColors: Any | None = ..., ser=..., dLbls: Any | None = ..., **kw + ) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class BarChart(_BarChartBase): + tagname: str + barDir: Any + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + gapWidth: Any + overlap: Any + serLines: Any + extLst: Any + x_axis: Any + y_axis: Any + __elements__: Any + legend: Any + def __init__( + self, gapWidth: int = ..., overlap: Any | None = ..., serLines: Any | None = ..., extLst: Any | None = ..., **kw + ) -> None: ... + +class BarChart3D(_BarChartBase, _3DBase): + tagname: str + barDir: Any + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + view3D: Any + floor: Any + sideWall: Any + backWall: Any + gapWidth: Any + gapDepth: Any + shape: Any + serLines: Any + extLst: Any + x_axis: Any + y_axis: Any + z_axis: Any + __elements__: Any + def __init__( + self, + gapWidth: int = ..., + gapDepth: int = ..., + shape: Any | None = ..., + serLines: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/bubble_chart.pyi b/stubs/openpyxl/openpyxl/chart/bubble_chart.pyi new file mode 100644 index 0000000..16b74ea --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/bubble_chart.pyi @@ -0,0 +1,30 @@ +from typing import Any + +from ._chart import ChartBase + +class BubbleChart(ChartBase): + tagname: str + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + bubble3D: Any + bubbleScale: Any + showNegBubbles: Any + sizeRepresents: Any + extLst: Any + x_axis: Any + y_axis: Any + __elements__: Any + def __init__( + self, + varyColors: Any | None = ..., + ser=..., + dLbls: Any | None = ..., + bubble3D: Any | None = ..., + bubbleScale: Any | None = ..., + showNegBubbles: Any | None = ..., + sizeRepresents: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/chartspace.pyi b/stubs/openpyxl/openpyxl/chart/chartspace.pyi new file mode 100644 index 0000000..0d4d44d --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/chartspace.pyi @@ -0,0 +1,97 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ChartContainer(Serialisable): + tagname: str + title: Any + autoTitleDeleted: Any + pivotFmts: Any + view3D: Any + floor: Any + sideWall: Any + backWall: Any + plotArea: Any + legend: Any + plotVisOnly: Any + dispBlanksAs: Any + showDLblsOverMax: Any + extLst: Any + __elements__: Any + def __init__( + self, + title: Any | None = ..., + autoTitleDeleted: Any | None = ..., + pivotFmts=..., + view3D: Any | None = ..., + floor: Any | None = ..., + sideWall: Any | None = ..., + backWall: Any | None = ..., + plotArea: Any | None = ..., + legend: Any | None = ..., + plotVisOnly: bool = ..., + dispBlanksAs: str = ..., + showDLblsOverMax: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Protection(Serialisable): + tagname: str + chartObject: Any + data: Any + formatting: Any + selection: Any + userInterface: Any + __elements__: Any + def __init__( + self, + chartObject: Any | None = ..., + data: Any | None = ..., + formatting: Any | None = ..., + selection: Any | None = ..., + userInterface: Any | None = ..., + ) -> None: ... + +class ExternalData(Serialisable): + tagname: str + autoUpdate: Any + id: Any + def __init__(self, autoUpdate: Any | None = ..., id: Any | None = ...) -> None: ... + +class ChartSpace(Serialisable): + tagname: str + date1904: Any + lang: Any + roundedCorners: Any + style: Any + clrMapOvr: Any + pivotSource: Any + protection: Any + chart: Any + spPr: Any + graphicalProperties: Any + txPr: Any + textProperties: Any + externalData: Any + printSettings: Any + userShapes: Any + extLst: Any + __elements__: Any + def __init__( + self, + date1904: Any | None = ..., + lang: Any | None = ..., + roundedCorners: Any | None = ..., + style: Any | None = ..., + clrMapOvr: Any | None = ..., + pivotSource: Any | None = ..., + protection: Any | None = ..., + chart: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + externalData: Any | None = ..., + printSettings: Any | None = ..., + userShapes: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ..., namespace: Any | None = ...): ... diff --git a/stubs/openpyxl/openpyxl/chart/data_source.pyi b/stubs/openpyxl/openpyxl/chart/data_source.pyi new file mode 100644 index 0000000..d927a58 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/data_source.pyi @@ -0,0 +1,101 @@ +from typing import Any + +from openpyxl.descriptors.nested import NestedText +from openpyxl.descriptors.serialisable import Serialisable + +class NumFmt(Serialisable): # type: ignore[misc] + formatCode: Any + sourceLinked: Any + def __init__(self, formatCode: Any | None = ..., sourceLinked: bool = ...) -> None: ... + +class NumberValueDescriptor(NestedText): + allow_none: bool + expected_type: Any + def __set__(self, instance, value) -> None: ... + +class NumVal(Serialisable): # type: ignore[misc] + idx: Any + formatCode: Any + v: Any + def __init__(self, idx: Any | None = ..., formatCode: Any | None = ..., v: Any | None = ...) -> None: ... + +class NumData(Serialisable): # type: ignore[misc] + formatCode: Any + ptCount: Any + pt: Any + extLst: Any + __elements__: Any + def __init__(self, formatCode: Any | None = ..., ptCount: Any | None = ..., pt=..., extLst: Any | None = ...) -> None: ... + +class NumRef(Serialisable): # type: ignore[misc] + f: Any + ref: Any + numCache: Any + extLst: Any + __elements__: Any + def __init__(self, f: Any | None = ..., numCache: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class StrVal(Serialisable): + tagname: str + idx: Any + v: Any + def __init__(self, idx: int = ..., v: Any | None = ...) -> None: ... + +class StrData(Serialisable): + tagname: str + ptCount: Any + pt: Any + extLst: Any + __elements__: Any + def __init__(self, ptCount: Any | None = ..., pt=..., extLst: Any | None = ...) -> None: ... + +class StrRef(Serialisable): + tagname: str + f: Any + strCache: Any + extLst: Any + __elements__: Any + def __init__(self, f: Any | None = ..., strCache: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class NumDataSource(Serialisable): # type: ignore[misc] + numRef: Any + numLit: Any + def __init__(self, numRef: Any | None = ..., numLit: Any | None = ...) -> None: ... + +class Level(Serialisable): + tagname: str + pt: Any + __elements__: Any + def __init__(self, pt=...) -> None: ... + +class MultiLevelStrData(Serialisable): + tagname: str + ptCount: Any + lvl: Any + extLst: Any + __elements__: Any + def __init__(self, ptCount: Any | None = ..., lvl=..., extLst: Any | None = ...) -> None: ... + +class MultiLevelStrRef(Serialisable): + tagname: str + f: Any + multiLvlStrCache: Any + extLst: Any + __elements__: Any + def __init__(self, f: Any | None = ..., multiLvlStrCache: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class AxDataSource(Serialisable): + tagname: str + numRef: Any + numLit: Any + strRef: Any + strLit: Any + multiLvlStrRef: Any + def __init__( + self, + numRef: Any | None = ..., + numLit: Any | None = ..., + strRef: Any | None = ..., + strLit: Any | None = ..., + multiLvlStrRef: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/descriptors.pyi b/stubs/openpyxl/openpyxl/chart/descriptors.pyi new file mode 100644 index 0000000..7b86609 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/descriptors.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from openpyxl.descriptors import Typed +from openpyxl.descriptors.nested import NestedMinMax + +class NestedGapAmount(NestedMinMax): + allow_none: bool + min: int + max: int + +class NestedOverlap(NestedMinMax): + allow_none: bool + min: int + max: int + +class NumberFormatDescriptor(Typed): + expected_type: Any + allow_none: bool + def __set__(self, instance, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/error_bar.pyi b/stubs/openpyxl/openpyxl/chart/error_bar.pyi new file mode 100644 index 0000000..211ca69 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/error_bar.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ErrorBars(Serialisable): + tagname: str + errDir: Any + direction: Any + errBarType: Any + style: Any + errValType: Any + size: Any + noEndCap: Any + plus: Any + minus: Any + val: Any + spPr: Any + graphicalProperties: Any + extLst: Any + __elements__: Any + def __init__( + self, + errDir: Any | None = ..., + errBarType: str = ..., + errValType: str = ..., + noEndCap: Any | None = ..., + plus: Any | None = ..., + minus: Any | None = ..., + val: Any | None = ..., + spPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/label.pyi b/stubs/openpyxl/openpyxl/chart/label.pyi new file mode 100644 index 0000000..e6e58b6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/label.pyi @@ -0,0 +1,81 @@ +from abc import abstractmethod +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable as Serialisable + +class _DataLabelBase(Serialisable): + numFmt: Any + spPr: Any + graphicalProperties: Any + txPr: Any + textProperties: Any + dLblPos: Any + position: Any + showLegendKey: Any + showVal: Any + showCatName: Any + showSerName: Any + showPercent: Any + showBubbleSize: Any + showLeaderLines: Any + separator: Any + extLst: Any + __elements__: Any + def __init__( + self, + numFmt: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + dLblPos: Any | None = ..., + showLegendKey: Any | None = ..., + showVal: Any | None = ..., + showCatName: Any | None = ..., + showSerName: Any | None = ..., + showPercent: Any | None = ..., + showBubbleSize: Any | None = ..., + showLeaderLines: Any | None = ..., + separator: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class DataLabel(_DataLabelBase): + tagname: str + idx: Any + numFmt: Any + spPr: Any + txPr: Any + dLblPos: Any + showLegendKey: Any + showVal: Any + showCatName: Any + showSerName: Any + showPercent: Any + showBubbleSize: Any + showLeaderLines: Any + separator: Any + extLst: Any + __elements__: Any + def __init__(self, idx: int = ..., **kw) -> None: ... + +class DataLabelList(_DataLabelBase): + tagname: str + dLbl: Any + delete: Any + numFmt: Any + spPr: Any + txPr: Any + dLblPos: Any + showLegendKey: Any + showVal: Any + showCatName: Any + showSerName: Any + showPercent: Any + showBubbleSize: Any + showLeaderLines: Any + separator: Any + extLst: Any + __elements__: Any + def __init__(self, dLbl=..., delete: Any | None = ..., **kw) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/layout.pyi b/stubs/openpyxl/openpyxl/chart/layout.pyi new file mode 100644 index 0000000..c7ef17f --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/layout.pyi @@ -0,0 +1,39 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ManualLayout(Serialisable): + tagname: str + layoutTarget: Any + xMode: Any + yMode: Any + wMode: Any + hMode: Any + x: Any + y: Any + w: Any + width: Any + h: Any + height: Any + extLst: Any + __elements__: Any + def __init__( + self, + layoutTarget: Any | None = ..., + xMode: Any | None = ..., + yMode: Any | None = ..., + wMode: str = ..., + hMode: str = ..., + x: Any | None = ..., + y: Any | None = ..., + w: Any | None = ..., + h: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Layout(Serialisable): + tagname: str + manualLayout: Any + extLst: Any + __elements__: Any + def __init__(self, manualLayout: Any | None = ..., extLst: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/legend.pyi b/stubs/openpyxl/openpyxl/chart/legend.pyi new file mode 100644 index 0000000..66bf483 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/legend.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class LegendEntry(Serialisable): + tagname: str + idx: Any + delete: Any + txPr: Any + extLst: Any + __elements__: Any + def __init__(self, idx: int = ..., delete: bool = ..., txPr: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class Legend(Serialisable): + tagname: str + legendPos: Any + position: Any + legendEntry: Any + layout: Any + overlay: Any + spPr: Any + graphicalProperties: Any + txPr: Any + textProperties: Any + extLst: Any + __elements__: Any + def __init__( + self, + legendPos: str = ..., + legendEntry=..., + layout: Any | None = ..., + overlay: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/line_chart.pyi b/stubs/openpyxl/openpyxl/chart/line_chart.pyi new file mode 100644 index 0000000..9d2b8e8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/line_chart.pyi @@ -0,0 +1,77 @@ +from abc import abstractmethod +from typing import Any + +from ._chart import ChartBase + +class _LineChartBase(ChartBase): + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + dropLines: Any + __elements__: Any + def __init__( + self, + grouping: str = ..., + varyColors: Any | None = ..., + ser=..., + dLbls: Any | None = ..., + dropLines: Any | None = ..., + **kw, + ) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class LineChart(_LineChartBase): + tagname: str + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dropLines: Any + hiLowLines: Any + upDownBars: Any + marker: Any + smooth: Any + extLst: Any + x_axis: Any + y_axis: Any + __elements__: Any + def __init__( + self, + hiLowLines: Any | None = ..., + upDownBars: Any | None = ..., + marker: Any | None = ..., + smooth: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... + +class LineChart3D(_LineChartBase): + tagname: str + grouping: Any + varyColors: Any + ser: Any + dLbls: Any + dropLines: Any + gapDepth: Any + hiLowLines: Any + upDownBars: Any + marker: Any + smooth: Any + extLst: Any + x_axis: Any + y_axis: Any + z_axis: Any + __elements__: Any + def __init__( + self, + gapDepth: Any | None = ..., + hiLowLines: Any | None = ..., + upDownBars: Any | None = ..., + marker: Any | None = ..., + smooth: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/marker.pyi b/stubs/openpyxl/openpyxl/chart/marker.pyi new file mode 100644 index 0000000..7719174 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/marker.pyi @@ -0,0 +1,39 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Marker(Serialisable): + tagname: str + symbol: Any + size: Any + spPr: Any + graphicalProperties: Any + extLst: Any + __elements__: Any + def __init__( + self, symbol: Any | None = ..., size: Any | None = ..., spPr: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class DataPoint(Serialisable): + tagname: str + idx: Any + invertIfNegative: Any + marker: Any + bubble3D: Any + explosion: Any + spPr: Any + graphicalProperties: Any + pictureOptions: Any + extLst: Any + __elements__: Any + def __init__( + self, + idx: Any | None = ..., + invertIfNegative: Any | None = ..., + marker: Any | None = ..., + bubble3D: Any | None = ..., + explosion: Any | None = ..., + spPr: Any | None = ..., + pictureOptions: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/picture.pyi b/stubs/openpyxl/openpyxl/chart/picture.pyi new file mode 100644 index 0000000..1f0ed1a --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/picture.pyi @@ -0,0 +1,20 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class PictureOptions(Serialisable): + tagname: str + applyToFront: Any + applyToSides: Any + applyToEnd: Any + pictureFormat: Any + pictureStackUnit: Any + __elements__: Any + def __init__( + self, + applyToFront: Any | None = ..., + applyToSides: Any | None = ..., + applyToEnd: Any | None = ..., + pictureFormat: Any | None = ..., + pictureStackUnit: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/pie_chart.pyi b/stubs/openpyxl/openpyxl/chart/pie_chart.pyi new file mode 100644 index 0000000..8b640c7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/pie_chart.pyi @@ -0,0 +1,81 @@ +from abc import abstractmethod +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +from ._chart import ChartBase + +class _PieChartBase(ChartBase): + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + __elements__: Any + def __init__(self, varyColors: bool = ..., ser=..., dLbls: Any | None = ...) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class PieChart(_PieChartBase): + tagname: str + varyColors: Any + ser: Any + dLbls: Any + firstSliceAng: Any + extLst: Any + __elements__: Any + def __init__(self, firstSliceAng: int = ..., extLst: Any | None = ..., **kw) -> None: ... + +class PieChart3D(_PieChartBase): + tagname: str + varyColors: Any + ser: Any + dLbls: Any + extLst: Any + __elements__: Any + +class DoughnutChart(_PieChartBase): + tagname: str + varyColors: Any + ser: Any + dLbls: Any + firstSliceAng: Any + holeSize: Any + extLst: Any + __elements__: Any + def __init__(self, firstSliceAng: int = ..., holeSize: int = ..., extLst: Any | None = ..., **kw) -> None: ... + +class CustomSplit(Serialisable): + tagname: str + secondPiePt: Any + __elements__: Any + def __init__(self, secondPiePt=...) -> None: ... + +class ProjectedPieChart(_PieChartBase): + tagname: str + varyColors: Any + ser: Any + dLbls: Any + ofPieType: Any + type: Any + gapWidth: Any + splitType: Any + splitPos: Any + custSplit: Any + secondPieSize: Any + serLines: Any + join_lines: Any + extLst: Any + __elements__: Any + def __init__( + self, + ofPieType: str = ..., + gapWidth: Any | None = ..., + splitType: str = ..., + splitPos: Any | None = ..., + custSplit: Any | None = ..., + secondPieSize: int = ..., + serLines: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/pivot.pyi b/stubs/openpyxl/openpyxl/chart/pivot.pyi new file mode 100644 index 0000000..6411afd --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/pivot.pyi @@ -0,0 +1,33 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class PivotSource(Serialisable): + tagname: str + name: Any + fmtId: Any + extLst: Any + __elements__: Any + def __init__(self, name: Any | None = ..., fmtId: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class PivotFormat(Serialisable): + tagname: str + idx: Any + spPr: Any + graphicalProperties: Any + txPr: Any + TextBody: Any + marker: Any + dLbl: Any + DataLabel: Any + extLst: Any + __elements__: Any + def __init__( + self, + idx: int = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + marker: Any | None = ..., + dLbl: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/plotarea.pyi b/stubs/openpyxl/openpyxl/chart/plotarea.pyi new file mode 100644 index 0000000..8fdb375 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/plotarea.pyi @@ -0,0 +1,66 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class DataTable(Serialisable): + tagname: str + showHorzBorder: Any + showVertBorder: Any + showOutline: Any + showKeys: Any + spPr: Any + graphicalProperties: Any + txPr: Any + extLst: Any + __elements__: Any + def __init__( + self, + showHorzBorder: Any | None = ..., + showVertBorder: Any | None = ..., + showOutline: Any | None = ..., + showKeys: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class PlotArea(Serialisable): + tagname: str + layout: Any + dTable: Any + spPr: Any + graphicalProperties: Any + extLst: Any + areaChart: Any + area3DChart: Any + lineChart: Any + line3DChart: Any + stockChart: Any + radarChart: Any + scatterChart: Any + pieChart: Any + pie3DChart: Any + doughnutChart: Any + barChart: Any + bar3DChart: Any + ofPieChart: Any + surfaceChart: Any + surface3DChart: Any + bubbleChart: Any + valAx: Any + catAx: Any + dateAx: Any + serAx: Any + __elements__: Any + def __init__( + self, + layout: Any | None = ..., + dTable: Any | None = ..., + spPr: Any | None = ..., + _charts=..., + _axes=..., + extLst: Any | None = ..., + ) -> None: ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ..., namespace: Any | None = ...): ... + @classmethod + def from_tree(cls, node): ... diff --git a/stubs/openpyxl/openpyxl/chart/print_settings.pyi b/stubs/openpyxl/openpyxl/chart/print_settings.pyi new file mode 100644 index 0000000..eb2facd --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/print_settings.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class PageMargins(Serialisable): + tagname: str + l: Any + left: Any + r: Any + right: Any + t: Any + top: Any + b: Any + bottom: Any + header: Any + footer: Any + def __init__( + self, l: float = ..., r: float = ..., t: int = ..., b: int = ..., header: float = ..., footer: float = ... + ) -> None: ... + +class PrintSettings(Serialisable): + tagname: str + headerFooter: Any + pageMargins: Any + pageSetup: Any + __elements__: Any + def __init__(self, headerFooter: Any | None = ..., pageMargins: Any | None = ..., pageSetup: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/radar_chart.pyi b/stubs/openpyxl/openpyxl/chart/radar_chart.pyi new file mode 100644 index 0000000..bab1694 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/radar_chart.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from ._chart import ChartBase + +class RadarChart(ChartBase): + tagname: str + radarStyle: Any + type: Any + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + extLst: Any + x_axis: Any + y_axis: Any + __elements__: Any + def __init__( + self, + radarStyle: str = ..., + varyColors: Any | None = ..., + ser=..., + dLbls: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/reader.pyi b/stubs/openpyxl/openpyxl/chart/reader.pyi new file mode 100644 index 0000000..0e58541 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/reader.pyi @@ -0,0 +1 @@ +def read_chart(chartspace): ... diff --git a/stubs/openpyxl/openpyxl/chart/reference.pyi b/stubs/openpyxl/openpyxl/chart/reference.pyi new file mode 100644 index 0000000..fe2e8b8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/reference.pyi @@ -0,0 +1,34 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.descriptors import Strict + +class DummyWorksheet: + title: Any + def __init__(self, title) -> None: ... + +class Reference(Strict): + min_row: Any + max_row: Any + min_col: Any + max_col: Any + range_string: Any + worksheet: Any + def __init__( + self, + worksheet: Any | None = ..., + min_col: Any | None = ..., + min_row: Any | None = ..., + max_col: Any | None = ..., + max_row: Any | None = ..., + range_string: Any | None = ..., + ) -> None: ... + def __len__(self): ... + def __eq__(self, other): ... + @property + def rows(self) -> Generator[Any, None, None]: ... + @property + def cols(self) -> Generator[Any, None, None]: ... + def pop(self): ... + @property + def sheetname(self): ... diff --git a/stubs/openpyxl/openpyxl/chart/scatter_chart.pyi b/stubs/openpyxl/openpyxl/chart/scatter_chart.pyi new file mode 100644 index 0000000..73de332 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/scatter_chart.pyi @@ -0,0 +1,24 @@ +from typing import Any + +from ._chart import ChartBase as ChartBase + +class ScatterChart(ChartBase): + tagname: str + scatterStyle: Any + varyColors: Any + ser: Any + dLbls: Any + dataLabels: Any + extLst: Any + x_axis: Any + y_axis: Any + __elements__: Any + def __init__( + self, + scatterStyle: Any | None = ..., + varyColors: Any | None = ..., + ser=..., + dLbls: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/series.pyi b/stubs/openpyxl/openpyxl/chart/series.pyi new file mode 100644 index 0000000..44265de --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/series.pyi @@ -0,0 +1,86 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +attribute_mapping: Any + +class SeriesLabel(Serialisable): + tagname: str + strRef: Any + v: Any + value: Any + __elements__: Any + def __init__(self, strRef: Any | None = ..., v: Any | None = ...) -> None: ... + +class Series(Serialisable): + tagname: str + idx: Any + order: Any + tx: Any + title: Any + spPr: Any + graphicalProperties: Any + pictureOptions: Any + dPt: Any + data_points: Any + dLbls: Any + labels: Any + trendline: Any + errBars: Any + cat: Any + identifiers: Any + val: Any + extLst: Any + invertIfNegative: Any + shape: Any + xVal: Any + yVal: Any + bubbleSize: Any + zVal: Any + bubble3D: Any + marker: Any + smooth: Any + explosion: Any + __elements__: Any + def __init__( + self, + idx: int = ..., + order: int = ..., + tx: Any | None = ..., + spPr: Any | None = ..., + pictureOptions: Any | None = ..., + dPt=..., + dLbls: Any | None = ..., + trendline: Any | None = ..., + errBars: Any | None = ..., + cat: Any | None = ..., + val: Any | None = ..., + invertIfNegative: Any | None = ..., + shape: Any | None = ..., + xVal: Any | None = ..., + yVal: Any | None = ..., + bubbleSize: Any | None = ..., + bubble3D: Any | None = ..., + marker: Any | None = ..., + smooth: Any | None = ..., + explosion: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ...): ... # type: ignore[override] + +class XYSeries(Series): + idx: Any + order: Any + tx: Any + spPr: Any + dPt: Any + dLbls: Any + trendline: Any + errBars: Any + xVal: Any + yVal: Any + invertIfNegative: Any + bubbleSize: Any + bubble3D: Any + marker: Any + smooth: Any diff --git a/stubs/openpyxl/openpyxl/chart/series_factory.pyi b/stubs/openpyxl/openpyxl/chart/series_factory.pyi new file mode 100644 index 0000000..989d0e4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/series_factory.pyi @@ -0,0 +1,5 @@ +from typing import Any + +def SeriesFactory( + values, xvalues: Any | None = ..., zvalues: Any | None = ..., title: Any | None = ..., title_from_data: bool = ... +): ... diff --git a/stubs/openpyxl/openpyxl/chart/shapes.pyi b/stubs/openpyxl/openpyxl/chart/shapes.pyi new file mode 100644 index 0000000..f78177f --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/shapes.pyi @@ -0,0 +1,37 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class GraphicalProperties(Serialisable): + tagname: str + bwMode: Any + xfrm: Any + transform: Any + custGeom: Any + prstGeom: Any + noFill: Any + solidFill: Any + gradFill: Any + pattFill: Any + ln: Any + line: Any + scene3d: Any + sp3d: Any + shape3D: Any + extLst: Any + __elements__: Any + def __init__( + self, + bwMode: Any | None = ..., + xfrm: Any | None = ..., + noFill: Any | None = ..., + solidFill: Any | None = ..., + gradFill: Any | None = ..., + pattFill: Any | None = ..., + ln: Any | None = ..., + scene3d: Any | None = ..., + custGeom: Any | None = ..., + prstGeom: Any | None = ..., + sp3d: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/stock_chart.pyi b/stubs/openpyxl/openpyxl/chart/stock_chart.pyi new file mode 100644 index 0000000..ad5c6a0 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/stock_chart.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from ._chart import ChartBase + +class StockChart(ChartBase): + tagname: str + ser: Any + dLbls: Any + dataLabels: Any + dropLines: Any + hiLowLines: Any + upDownBars: Any + extLst: Any + x_axis: Any + y_axis: Any + __elements__: Any + def __init__( + self, + ser=..., + dLbls: Any | None = ..., + dropLines: Any | None = ..., + hiLowLines: Any | None = ..., + upDownBars: Any | None = ..., + extLst: Any | None = ..., + **kw, + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/surface_chart.pyi b/stubs/openpyxl/openpyxl/chart/surface_chart.pyi new file mode 100644 index 0000000..15d52a8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/surface_chart.pyi @@ -0,0 +1,52 @@ +from abc import abstractmethod +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +from ._3d import _3DBase +from ._chart import ChartBase + +class BandFormat(Serialisable): + tagname: str + idx: Any + spPr: Any + graphicalProperties: Any + __elements__: Any + def __init__(self, idx: int = ..., spPr: Any | None = ...) -> None: ... + +class BandFormatList(Serialisable): + tagname: str + bandFmt: Any + __elements__: Any + def __init__(self, bandFmt=...) -> None: ... + +class _SurfaceChartBase(ChartBase): + wireframe: Any + ser: Any + bandFmts: Any + __elements__: Any + def __init__(self, wireframe: Any | None = ..., ser=..., bandFmts: Any | None = ..., **kw) -> None: ... + @property + @abstractmethod + def tagname(self) -> str: ... + +class SurfaceChart3D(_SurfaceChartBase, _3DBase): + tagname: str + wireframe: Any + ser: Any + bandFmts: Any + extLst: Any + x_axis: Any + y_axis: Any + z_axis: Any + __elements__: Any + def __init__(self, **kw) -> None: ... + +class SurfaceChart(SurfaceChart3D): + tagname: str + wireframe: Any + ser: Any + bandFmts: Any + extLst: Any + __elements__: Any + def __init__(self, **kw) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/text.pyi b/stubs/openpyxl/openpyxl/chart/text.pyi new file mode 100644 index 0000000..210064d --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/text.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class RichText(Serialisable): + tagname: str + bodyPr: Any + properties: Any + lstStyle: Any + p: Any + paragraphs: Any + __elements__: Any + def __init__(self, bodyPr: Any | None = ..., lstStyle: Any | None = ..., p: Any | None = ...) -> None: ... + +class Text(Serialisable): + tagname: str + strRef: Any + rich: Any + __elements__: Any + def __init__(self, strRef: Any | None = ..., rich: Any | None = ...) -> None: ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ..., namespace: Any | None = ...): ... diff --git a/stubs/openpyxl/openpyxl/chart/title.pyi b/stubs/openpyxl/openpyxl/chart/title.pyi new file mode 100644 index 0000000..9b04958 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/title.pyi @@ -0,0 +1,33 @@ +from typing import Any + +from openpyxl.descriptors import Typed +from openpyxl.descriptors.serialisable import Serialisable + +class Title(Serialisable): + tagname: str + tx: Any + text: Any + layout: Any + overlay: Any + spPr: Any + graphicalProperties: Any + txPr: Any + body: Any + extLst: Any + __elements__: Any + def __init__( + self, + tx: Any | None = ..., + layout: Any | None = ..., + overlay: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +def title_maker(text): ... + +class TitleDescriptor(Typed): + expected_type: Any + allow_none: bool + def __set__(self, instance, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/trendline.pyi b/stubs/openpyxl/openpyxl/chart/trendline.pyi new file mode 100644 index 0000000..b313a08 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/trendline.pyi @@ -0,0 +1,56 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class TrendlineLabel(Serialisable): + tagname: str + layout: Any + tx: Any + numFmt: Any + spPr: Any + graphicalProperties: Any + txPr: Any + textProperties: Any + extLst: Any + __elements__: Any + def __init__( + self, + layout: Any | None = ..., + tx: Any | None = ..., + numFmt: Any | None = ..., + spPr: Any | None = ..., + txPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Trendline(Serialisable): + tagname: str + name: Any + spPr: Any + graphicalProperties: Any + trendlineType: Any + order: Any + period: Any + forward: Any + backward: Any + intercept: Any + dispRSqr: Any + dispEq: Any + trendlineLbl: Any + extLst: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + spPr: Any | None = ..., + trendlineType: str = ..., + order: Any | None = ..., + period: Any | None = ..., + forward: Any | None = ..., + backward: Any | None = ..., + intercept: Any | None = ..., + dispRSqr: Any | None = ..., + dispEq: Any | None = ..., + trendlineLbl: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chart/updown_bars.pyi b/stubs/openpyxl/openpyxl/chart/updown_bars.pyi new file mode 100644 index 0000000..ecf885e --- /dev/null +++ b/stubs/openpyxl/openpyxl/chart/updown_bars.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class UpDownBars(Serialisable): + tagname: str + gapWidth: Any + upBars: Any + downBars: Any + extLst: Any + __elements__: Any + def __init__( + self, gapWidth: int = ..., upBars: Any | None = ..., downBars: Any | None = ..., extLst: Any | None = ... + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/__init__.pyi b/stubs/openpyxl/openpyxl/chartsheet/__init__.pyi new file mode 100644 index 0000000..59dba6f --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/__init__.pyi @@ -0,0 +1 @@ +from .chartsheet import Chartsheet as Chartsheet diff --git a/stubs/openpyxl/openpyxl/chartsheet/chartsheet.pyi b/stubs/openpyxl/openpyxl/chartsheet/chartsheet.pyi new file mode 100644 index 0000000..547e907 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/chartsheet.pyi @@ -0,0 +1,44 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable +from openpyxl.workbook.child import _WorkbookChild + +class Chartsheet(_WorkbookChild, Serialisable): + tagname: str + mime_type: str + sheetPr: Any + sheetViews: Any + sheetProtection: Any + customSheetViews: Any + pageMargins: Any + pageSetup: Any + drawing: Any + drawingHF: Any + picture: Any + webPublishItems: Any + extLst: Any + sheet_state: Any + headerFooter: Any + HeaderFooter: Any + __elements__: Any + __attrs__: Any + def __init__( + self, + sheetPr: Any | None = ..., + sheetViews: Any | None = ..., + sheetProtection: Any | None = ..., + customSheetViews: Any | None = ..., + pageMargins: Any | None = ..., + pageSetup: Any | None = ..., + headerFooter: Any | None = ..., + drawing: Any | None = ..., + drawingHF: Any | None = ..., + picture: Any | None = ..., + webPublishItems: Any | None = ..., + extLst: Any | None = ..., + parent: Any | None = ..., + title: str = ..., + sheet_state: str = ..., + ) -> None: ... + def add_chart(self, chart) -> None: ... + def to_tree(self): ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/custom.pyi b/stubs/openpyxl/openpyxl/chartsheet/custom.pyi new file mode 100644 index 0000000..6111d56 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/custom.pyi @@ -0,0 +1,30 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class CustomChartsheetView(Serialisable): + tagname: str + guid: Any + scale: Any + state: Any + zoomToFit: Any + pageMargins: Any + pageSetup: Any + headerFooter: Any + __elements__: Any + def __init__( + self, + guid: Any | None = ..., + scale: Any | None = ..., + state: str = ..., + zoomToFit: Any | None = ..., + pageMargins: Any | None = ..., + pageSetup: Any | None = ..., + headerFooter: Any | None = ..., + ) -> None: ... + +class CustomChartsheetViews(Serialisable): + tagname: str + customSheetView: Any + __elements__: Any + def __init__(self, customSheetView: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/properties.pyi b/stubs/openpyxl/openpyxl/chartsheet/properties.pyi new file mode 100644 index 0000000..bc93525 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/properties.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable as Serialisable + +class ChartsheetProperties(Serialisable): + tagname: str + published: Any + codeName: Any + tabColor: Any + __elements__: Any + def __init__(self, published: Any | None = ..., codeName: Any | None = ..., tabColor: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/protection.pyi b/stubs/openpyxl/openpyxl/chartsheet/protection.pyi new file mode 100644 index 0000000..0a8c3a7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/protection.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable +from openpyxl.worksheet.protection import _Protected + +class ChartsheetProtection(Serialisable, _Protected): + tagname: str + algorithmName: Any + hashValue: Any + saltValue: Any + spinCount: Any + content: Any + objects: Any + __attrs__: Any + password: Any + def __init__( + self, + content: Any | None = ..., + objects: Any | None = ..., + hashValue: Any | None = ..., + spinCount: Any | None = ..., + saltValue: Any | None = ..., + algorithmName: Any | None = ..., + password: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/publish.pyi b/stubs/openpyxl/openpyxl/chartsheet/publish.pyi new file mode 100644 index 0000000..a581881 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/publish.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class WebPublishItem(Serialisable): + tagname: str + id: Any + divId: Any + sourceType: Any + sourceRef: Any + sourceObject: Any + destinationFile: Any + title: Any + autoRepublish: Any + def __init__( + self, + id: Any | None = ..., + divId: Any | None = ..., + sourceType: Any | None = ..., + sourceRef: Any | None = ..., + sourceObject: Any | None = ..., + destinationFile: Any | None = ..., + title: Any | None = ..., + autoRepublish: Any | None = ..., + ) -> None: ... + +class WebPublishItems(Serialisable): + tagname: str + count: Any + webPublishItem: Any + __elements__: Any + def __init__(self, count: Any | None = ..., webPublishItem: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/relation.pyi b/stubs/openpyxl/openpyxl/chartsheet/relation.pyi new file mode 100644 index 0000000..a5c61a3 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/relation.pyi @@ -0,0 +1,69 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class SheetBackgroundPicture(Serialisable): + tagname: str + id: Any + def __init__(self, id) -> None: ... + +class DrawingHF(Serialisable): + id: Any + lho: Any + leftHeaderOddPages: Any + lhe: Any + leftHeaderEvenPages: Any + lhf: Any + leftHeaderFirstPage: Any + cho: Any + centerHeaderOddPages: Any + che: Any + centerHeaderEvenPages: Any + chf: Any + centerHeaderFirstPage: Any + rho: Any + rightHeaderOddPages: Any + rhe: Any + rightHeaderEvenPages: Any + rhf: Any + rightHeaderFirstPage: Any + lfo: Any + leftFooterOddPages: Any + lfe: Any + leftFooterEvenPages: Any + lff: Any + leftFooterFirstPage: Any + cfo: Any + centerFooterOddPages: Any + cfe: Any + centerFooterEvenPages: Any + cff: Any + centerFooterFirstPage: Any + rfo: Any + rightFooterOddPages: Any + rfe: Any + rightFooterEvenPages: Any + rff: Any + rightFooterFirstPage: Any + def __init__( + self, + id: Any | None = ..., + lho: Any | None = ..., + lhe: Any | None = ..., + lhf: Any | None = ..., + cho: Any | None = ..., + che: Any | None = ..., + chf: Any | None = ..., + rho: Any | None = ..., + rhe: Any | None = ..., + rhf: Any | None = ..., + lfo: Any | None = ..., + lfe: Any | None = ..., + lff: Any | None = ..., + cfo: Any | None = ..., + cfe: Any | None = ..., + cff: Any | None = ..., + rfo: Any | None = ..., + rfe: Any | None = ..., + rff: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/chartsheet/views.pyi b/stubs/openpyxl/openpyxl/chartsheet/views.pyi new file mode 100644 index 0000000..9c092e8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/chartsheet/views.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ChartsheetView(Serialisable): + tagname: str + tabSelected: Any + zoomScale: Any + workbookViewId: Any + zoomToFit: Any + extLst: Any + __elements__: Any + def __init__( + self, + tabSelected: Any | None = ..., + zoomScale: Any | None = ..., + workbookViewId: int = ..., + zoomToFit: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class ChartsheetViewList(Serialisable): + tagname: str + sheetView: Any + extLst: Any + __elements__: Any + def __init__(self, sheetView: Any | None = ..., extLst: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/comments/__init__.pyi b/stubs/openpyxl/openpyxl/comments/__init__.pyi new file mode 100644 index 0000000..86ce8fc --- /dev/null +++ b/stubs/openpyxl/openpyxl/comments/__init__.pyi @@ -0,0 +1 @@ +from .comments import Comment as Comment diff --git a/stubs/openpyxl/openpyxl/comments/author.pyi b/stubs/openpyxl/openpyxl/comments/author.pyi new file mode 100644 index 0000000..b3aec7c --- /dev/null +++ b/stubs/openpyxl/openpyxl/comments/author.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class AuthorList(Serialisable): + tagname: str + author: Any + authors: Any + def __init__(self, author=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi b/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi new file mode 100644 index 0000000..e9eafa5 --- /dev/null +++ b/stubs/openpyxl/openpyxl/comments/comment_sheet.pyi @@ -0,0 +1,88 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Properties(Serialisable): + locked: Any + defaultSize: Any + disabled: Any + uiObject: Any + autoFill: Any + autoLine: Any + altText: Any + textHAlign: Any + textVAlign: Any + lockText: Any + justLastX: Any + autoScale: Any + rowHidden: Any + colHidden: Any + __elements__: Any + anchor: Any + def __init__( + self, + locked: Any | None = ..., + defaultSize: Any | None = ..., + _print: Any | None = ..., + disabled: Any | None = ..., + uiObject: Any | None = ..., + autoFill: Any | None = ..., + autoLine: Any | None = ..., + altText: Any | None = ..., + textHAlign: Any | None = ..., + textVAlign: Any | None = ..., + lockText: Any | None = ..., + justLastX: Any | None = ..., + autoScale: Any | None = ..., + rowHidden: Any | None = ..., + colHidden: Any | None = ..., + anchor: Any | None = ..., + ) -> None: ... + +class CommentRecord(Serialisable): + tagname: str + ref: Any + authorId: Any + guid: Any + shapeId: Any + text: Any + commentPr: Any + author: Any + __elements__: Any + __attrs__: Any + height: Any + width: Any + def __init__( + self, + ref: str = ..., + authorId: int = ..., + guid: Any | None = ..., + shapeId: int = ..., + text: Any | None = ..., + commentPr: Any | None = ..., + author: Any | None = ..., + height: int = ..., + width: int = ..., + ) -> None: ... + @classmethod + def from_cell(cls, cell): ... + @property + def content(self): ... + +class CommentSheet(Serialisable): + tagname: str + authors: Any + commentList: Any + extLst: Any + mime_type: str + __elements__: Any + def __init__(self, authors: Any | None = ..., commentList: Any | None = ..., extLst: Any | None = ...) -> None: ... + def to_tree(self): ... + @property + def comments(self) -> Generator[Any, None, None]: ... + @classmethod + def from_comments(cls, comments): ... + def write_shapes(self, vml: Any | None = ...): ... + @property + def path(self): ... diff --git a/stubs/openpyxl/openpyxl/comments/comments.pyi b/stubs/openpyxl/openpyxl/comments/comments.pyi new file mode 100644 index 0000000..60ec5e7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/comments/comments.pyi @@ -0,0 +1,18 @@ +from typing import Any + +class Comment: + content: Any + author: Any + height: Any + width: Any + def __init__(self, text, author, height: int = ..., width: int = ...) -> None: ... + @property + def parent(self): ... + def __eq__(self, other): ... + def __copy__(self): ... + def bind(self, cell) -> None: ... + def unbind(self) -> None: ... + @property + def text(self): ... + @text.setter + def text(self, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/comments/shape_writer.pyi b/stubs/openpyxl/openpyxl/comments/shape_writer.pyi new file mode 100644 index 0000000..db8b913 --- /dev/null +++ b/stubs/openpyxl/openpyxl/comments/shape_writer.pyi @@ -0,0 +1,14 @@ +from typing import Any + +vmlns: str +officens: str +excelns: str + +class ShapeWriter: + vml: Any + vml_path: Any + comments: Any + def __init__(self, comments) -> None: ... + def add_comment_shapetype(self, root) -> None: ... + def add_comment_shape(self, root, idx, coord, height, width) -> None: ... + def write(self, root): ... diff --git a/stubs/openpyxl/openpyxl/compat/__init__.pyi b/stubs/openpyxl/openpyxl/compat/__init__.pyi new file mode 100644 index 0000000..c2ebdac --- /dev/null +++ b/stubs/openpyxl/openpyxl/compat/__init__.pyi @@ -0,0 +1,10 @@ +from typing import Any + +from .numbers import NUMERIC_TYPES as NUMERIC_TYPES +from .strings import safe_string as safe_string + +class DummyCode: ... + +string_types: Any + +def deprecated(reason): ... diff --git a/stubs/openpyxl/openpyxl/compat/abc.pyi b/stubs/openpyxl/openpyxl/compat/abc.pyi new file mode 100644 index 0000000..5beda93 --- /dev/null +++ b/stubs/openpyxl/openpyxl/compat/abc.pyi @@ -0,0 +1 @@ +from abc import ABC as ABC diff --git a/stubs/openpyxl/openpyxl/compat/numbers.pyi b/stubs/openpyxl/openpyxl/compat/numbers.pyi new file mode 100644 index 0000000..e0bf070 --- /dev/null +++ b/stubs/openpyxl/openpyxl/compat/numbers.pyi @@ -0,0 +1,4 @@ +from typing import Any + +NUMERIC_TYPES: Any +NUMPY: bool diff --git a/stubs/openpyxl/openpyxl/compat/product.pyi b/stubs/openpyxl/openpyxl/compat/product.pyi new file mode 100644 index 0000000..60e7b29 --- /dev/null +++ b/stubs/openpyxl/openpyxl/compat/product.pyi @@ -0,0 +1,3 @@ +def product(sequence): ... + +prod = product diff --git a/stubs/openpyxl/openpyxl/compat/singleton.pyi b/stubs/openpyxl/openpyxl/compat/singleton.pyi new file mode 100644 index 0000000..65403a6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/compat/singleton.pyi @@ -0,0 +1,7 @@ +class Singleton(type): + def __init__(self, *args, **kw) -> None: ... + def __call__(self, *args, **kw): ... + +class Cached(type): + def __init__(self, *args, **kw) -> None: ... + def __call__(self, *args): ... diff --git a/stubs/openpyxl/openpyxl/compat/strings.pyi b/stubs/openpyxl/openpyxl/compat/strings.pyi new file mode 100644 index 0000000..0ab4f75 --- /dev/null +++ b/stubs/openpyxl/openpyxl/compat/strings.pyi @@ -0,0 +1,5 @@ +from typing import Any + +VER: Any + +def safe_string(value): ... diff --git a/stubs/openpyxl/openpyxl/descriptors/__init__.pyi b/stubs/openpyxl/openpyxl/descriptors/__init__.pyi new file mode 100644 index 0000000..bf85233 --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/__init__.pyi @@ -0,0 +1,11 @@ +from .base import * +from .sequence import Sequence as Sequence + +class MetaStrict(type): + def __new__(cls, clsname, bases, methods): ... + +class MetaSerialisable(type): + def __new__(cls, clsname, bases, methods): ... + +class Strict(metaclass=MetaStrict): ... +class _Serialiasable(metaclass=MetaSerialisable): ... diff --git a/stubs/openpyxl/openpyxl/descriptors/base.pyi b/stubs/openpyxl/openpyxl/descriptors/base.pyi new file mode 100644 index 0000000..2728212 --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/base.pyi @@ -0,0 +1,85 @@ +from typing import Any + +class Descriptor: + name: Any + def __init__(self, name: Any | None = ..., **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class Typed(Descriptor): + expected_type: Any + allow_none: bool + nested: bool + __doc__: Any + def __init__(self, *args, **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class Convertible(Typed): + def __set__(self, instance, value) -> None: ... + +class Max(Convertible): + expected_type: Any + allow_none: bool + def __init__(self, **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class Min(Convertible): + expected_type: Any + allow_none: bool + def __init__(self, **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class MinMax(Min, Max): ... + +class Set(Descriptor): + __doc__: Any + def __init__(self, name: Any | None = ..., **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class NoneSet(Set): + def __init__(self, name: Any | None = ..., **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class Integer(Convertible): + expected_type: Any + +class Float(Convertible): + expected_type: Any + +class Bool(Convertible): + expected_type: Any + def __set__(self, instance, value) -> None: ... + +class String(Typed): + expected_type: Any + +class Text(String, Convertible): ... + +class ASCII(Typed): + expected_type: Any + +class Tuple(Typed): + expected_type: Any + +class Length(Descriptor): + def __init__(self, name: Any | None = ..., **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class Default(Typed): + def __init__(self, name: Any | None = ..., **kw) -> None: ... + def __call__(self): ... + +class Alias(Descriptor): + alias: Any + def __init__(self, alias) -> None: ... + def __set__(self, instance, value) -> None: ... + def __get__(self, instance, cls): ... + +class MatchPattern(Descriptor): + allow_none: bool + test_pattern: Any + def __init__(self, name: Any | None = ..., **kw) -> None: ... + def __set__(self, instance, value) -> None: ... + +class DateTime(Typed): + expected_type: Any + def __set__(self, instance, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/descriptors/excel.pyi b/stubs/openpyxl/openpyxl/descriptors/excel.pyi new file mode 100644 index 0000000..15bd45f --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/excel.pyi @@ -0,0 +1,46 @@ +from typing import Any + +from . import Integer, MatchPattern, MinMax, String +from .serialisable import Serialisable + +class HexBinary(MatchPattern): + pattern: str + +class UniversalMeasure(MatchPattern): + pattern: str + +class TextPoint(MinMax): + expected_type: Any + min: int + max: int + +Coordinate = Integer + +class Percentage(MinMax): + pattern: str + min: int + max: int + def __set__(self, instance, value) -> None: ... + +class Extension(Serialisable): + uri: Any + def __init__(self, uri: Any | None = ...) -> None: ... + +class ExtensionList(Serialisable): + ext: Any + def __init__(self, ext=...) -> None: ... + +class Relation(String): + namespace: Any + allow_none: bool + +class Base64Binary(MatchPattern): + pattern: str + +class Guid(MatchPattern): + pattern: str + +class CellRange(MatchPattern): + pattern: str + allow_none: bool + def __set__(self, instance, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/descriptors/namespace.pyi b/stubs/openpyxl/openpyxl/descriptors/namespace.pyi new file mode 100644 index 0000000..33f2eac --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/namespace.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def namespaced(obj, tagname, namespace: Any | None = ...): ... diff --git a/stubs/openpyxl/openpyxl/descriptors/nested.pyi b/stubs/openpyxl/openpyxl/descriptors/nested.pyi new file mode 100644 index 0000000..d63cfdb --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/nested.pyi @@ -0,0 +1,31 @@ +from typing import Any + +from .base import Bool, Convertible, Descriptor, Float, Integer, MinMax, NoneSet, Set, String + +class Nested(Descriptor): + nested: bool + attribute: str + def __set__(self, instance, value) -> None: ... + def from_tree(self, node): ... + def to_tree(self, tagname: Any | None = ..., value: Any | None = ..., namespace: Any | None = ...): ... + +class NestedValue(Nested, Convertible): ... + +class NestedText(NestedValue): + def from_tree(self, node): ... + def to_tree(self, tagname: Any | None = ..., value: Any | None = ..., namespace: Any | None = ...): ... + +class NestedFloat(NestedValue, Float): ... +class NestedInteger(NestedValue, Integer): ... +class NestedString(NestedValue, String): ... + +class NestedBool(NestedValue, Bool): + def from_tree(self, node): ... + +class NestedNoneSet(Nested, NoneSet): ... +class NestedSet(Nested, Set): ... +class NestedMinMax(Nested, MinMax): ... + +class EmptyTag(Nested, Bool): + def from_tree(self, node): ... + def to_tree(self, tagname: Any | None = ..., value: Any | None = ..., namespace: Any | None = ...): ... diff --git a/stubs/openpyxl/openpyxl/descriptors/sequence.pyi b/stubs/openpyxl/openpyxl/descriptors/sequence.pyi new file mode 100644 index 0000000..730fb20 --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/sequence.pyi @@ -0,0 +1,33 @@ +from collections.abc import Generator +from typing import Any + +from .base import Alias, Descriptor + +class Sequence(Descriptor): + expected_type: Any + seq_types: Any + idx_base: int + unique: bool + def __set__(self, instance, seq) -> None: ... + def to_tree(self, tagname, obj, namespace: Any | None = ...) -> Generator[Any, None, None]: ... + +class ValueSequence(Sequence): + attribute: str + def to_tree(self, tagname, obj, namespace: Any | None = ...) -> Generator[Any, None, None]: ... + def from_tree(self, node): ... + +class NestedSequence(Sequence): + count: bool + def to_tree(self, tagname, obj, namespace: Any | None = ...): ... + def from_tree(self, node): ... + +class MultiSequence(Sequence): + def __set__(self, instance, seq) -> None: ... + def to_tree(self, tagname, obj, namespace: Any | None = ...) -> Generator[Any, None, None]: ... + +class MultiSequencePart(Alias): + expected_type: Any + store: Any + def __init__(self, expected_type, store) -> None: ... + def __set__(self, instance, value) -> None: ... + def __get__(self, instance, cls): ... diff --git a/stubs/openpyxl/openpyxl/descriptors/serialisable.pyi b/stubs/openpyxl/openpyxl/descriptors/serialisable.pyi new file mode 100644 index 0000000..4df5378 --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/serialisable.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from . import _Serialiasable + +KEYWORDS: Any +seq_types: Any + +class Serialisable(_Serialiasable): + __attrs__: Any + __nested__: Any + __elements__: Any + __namespaced__: Any + idx_base: int + @property + # TODO: needs overrides in many sub-classes + # @abstractmethod + def tagname(self) -> str: ... + namespace: Any + @classmethod + def from_tree(cls, node): ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ..., namespace: Any | None = ...): ... + def __iter__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __hash__(self): ... + def __add__(self, other): ... + def __copy__(self): ... diff --git a/stubs/openpyxl/openpyxl/descriptors/slots.pyi b/stubs/openpyxl/openpyxl/descriptors/slots.pyi new file mode 100644 index 0000000..87f6a07 --- /dev/null +++ b/stubs/openpyxl/openpyxl/descriptors/slots.pyi @@ -0,0 +1,2 @@ +class AutoSlotProperties(type): + def __new__(cls, classname, bases, dictionary): ... diff --git a/stubs/openpyxl/openpyxl/drawing/__init__.pyi b/stubs/openpyxl/openpyxl/drawing/__init__.pyi new file mode 100644 index 0000000..a41cad0 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/__init__.pyi @@ -0,0 +1 @@ +from .drawing import Drawing as Drawing diff --git a/stubs/openpyxl/openpyxl/drawing/colors.pyi b/stubs/openpyxl/openpyxl/drawing/colors.pyi new file mode 100644 index 0000000..2af9bc6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/colors.pyi @@ -0,0 +1,216 @@ +from typing import Any + +from openpyxl.descriptors import Typed +from openpyxl.descriptors.serialisable import Serialisable + +PRESET_COLORS: Any +SCHEME_COLORS: Any + +class Transform(Serialisable): ... + +class SystemColor(Serialisable): + tagname: str + namespace: Any + tint: Any + shade: Any + comp: Any + inv: Any + gray: Any + alpha: Any + alphaOff: Any + alphaMod: Any + hue: Any + hueOff: Any + hueMod: Any + sat: Any + satOff: Any + satMod: Any + lum: Any + lumOff: Any + lumMod: Any + red: Any + redOff: Any + redMod: Any + green: Any + greenOff: Any + greenMod: Any + blue: Any + blueOff: Any + blueMod: Any + gamma: Any + invGamma: Any + val: Any + lastClr: Any + __elements__: Any + def __init__( + self, + val: str = ..., + lastClr: Any | None = ..., + tint: Any | None = ..., + shade: Any | None = ..., + comp: Any | None = ..., + inv: Any | None = ..., + gray: Any | None = ..., + alpha: Any | None = ..., + alphaOff: Any | None = ..., + alphaMod: Any | None = ..., + hue: Any | None = ..., + hueOff: Any | None = ..., + hueMod: Any | None = ..., + sat: Any | None = ..., + satOff: Any | None = ..., + satMod: Any | None = ..., + lum: Any | None = ..., + lumOff: Any | None = ..., + lumMod: Any | None = ..., + red: Any | None = ..., + redOff: Any | None = ..., + redMod: Any | None = ..., + green: Any | None = ..., + greenOff: Any | None = ..., + greenMod: Any | None = ..., + blue: Any | None = ..., + blueOff: Any | None = ..., + blueMod: Any | None = ..., + gamma: Any | None = ..., + invGamma: Any | None = ..., + ) -> None: ... + +class HSLColor(Serialisable): + tagname: str + hue: Any + sat: Any + lum: Any + def __init__(self, hue: Any | None = ..., sat: Any | None = ..., lum: Any | None = ...) -> None: ... + +class RGBPercent(Serialisable): + tagname: str + r: Any + g: Any + b: Any + def __init__(self, r: Any | None = ..., g: Any | None = ..., b: Any | None = ...) -> None: ... + +class SchemeColor(Serialisable): + tagname: str + namespace: Any + tint: Any + shade: Any + comp: Any + inv: Any + gray: Any + alpha: Any + alphaOff: Any + alphaMod: Any + hue: Any + hueOff: Any + hueMod: Any + sat: Any + satOff: Any + satMod: Any + lum: Any + lumOff: Any + lumMod: Any + red: Any + redOff: Any + redMod: Any + green: Any + greenOff: Any + greenMod: Any + blue: Any + blueOff: Any + blueMod: Any + gamma: Any + invGamma: Any + val: Any + __elements__: Any + def __init__( + self, + tint: Any | None = ..., + shade: Any | None = ..., + comp: Any | None = ..., + inv: Any | None = ..., + gray: Any | None = ..., + alpha: Any | None = ..., + alphaOff: Any | None = ..., + alphaMod: Any | None = ..., + hue: Any | None = ..., + hueOff: Any | None = ..., + hueMod: Any | None = ..., + sat: Any | None = ..., + satOff: Any | None = ..., + satMod: Any | None = ..., + lum: Any | None = ..., + lumOff: Any | None = ..., + lumMod: Any | None = ..., + red: Any | None = ..., + redOff: Any | None = ..., + redMod: Any | None = ..., + green: Any | None = ..., + greenOff: Any | None = ..., + greenMod: Any | None = ..., + blue: Any | None = ..., + blueOff: Any | None = ..., + blueMod: Any | None = ..., + gamma: Any | None = ..., + invGamma: Any | None = ..., + val: Any | None = ..., + ) -> None: ... + +class ColorChoice(Serialisable): + tagname: str + namespace: Any + scrgbClr: Any + RGBPercent: Any + srgbClr: Any + RGB: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__( + self, + scrgbClr: Any | None = ..., + srgbClr: Any | None = ..., + hslClr: Any | None = ..., + sysClr: Any | None = ..., + schemeClr: Any | None = ..., + prstClr: Any | None = ..., + ) -> None: ... + +class ColorMapping(Serialisable): + tagname: str + bg1: Any + tx1: Any + bg2: Any + tx2: Any + accent1: Any + accent2: Any + accent3: Any + accent4: Any + accent5: Any + accent6: Any + hlink: Any + folHlink: Any + extLst: Any + def __init__( + self, + bg1: str = ..., + tx1: str = ..., + bg2: str = ..., + tx2: str = ..., + accent1: str = ..., + accent2: str = ..., + accent3: str = ..., + accent4: str = ..., + accent5: str = ..., + accent6: str = ..., + hlink: str = ..., + folHlink: str = ..., + extLst: Any | None = ..., + ) -> None: ... + +class ColorChoiceDescriptor(Typed): + expected_type: Any + allow_none: bool + def __set__(self, instance, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/connector.pyi b/stubs/openpyxl/openpyxl/drawing/connector.pyi new file mode 100644 index 0000000..3b3e8a4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/connector.pyi @@ -0,0 +1,72 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Connection(Serialisable): + id: Any + idx: Any + def __init__(self, id: Any | None = ..., idx: Any | None = ...) -> None: ... + +class ConnectorLocking(Serialisable): + extLst: Any + def __init__(self, extLst: Any | None = ...) -> None: ... + +class NonVisualConnectorProperties(Serialisable): + cxnSpLocks: Any + stCxn: Any + endCxn: Any + extLst: Any + def __init__( + self, cxnSpLocks: Any | None = ..., stCxn: Any | None = ..., endCxn: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class ConnectorNonVisual(Serialisable): + cNvPr: Any + cNvCxnSpPr: Any + __elements__: Any + def __init__(self, cNvPr: Any | None = ..., cNvCxnSpPr: Any | None = ...) -> None: ... + +class ConnectorShape(Serialisable): + tagname: str + nvCxnSpPr: Any + spPr: Any + style: Any + macro: Any + fPublished: Any + def __init__( + self, + nvCxnSpPr: Any | None = ..., + spPr: Any | None = ..., + style: Any | None = ..., + macro: Any | None = ..., + fPublished: Any | None = ..., + ) -> None: ... + +class ShapeMeta(Serialisable): + tagname: str + cNvPr: Any + cNvSpPr: Any + def __init__(self, cNvPr: Any | None = ..., cNvSpPr: Any | None = ...) -> None: ... + +class Shape(Serialisable): + macro: Any + textlink: Any + fPublished: Any + fLocksText: Any + nvSpPr: Any + meta: Any + spPr: Any + graphicalProperties: Any + style: Any + txBody: Any + def __init__( + self, + macro: Any | None = ..., + textlink: Any | None = ..., + fPublished: Any | None = ..., + fLocksText: Any | None = ..., + nvSpPr: Any | None = ..., + spPr: Any | None = ..., + style: Any | None = ..., + txBody: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/drawing.pyi b/stubs/openpyxl/openpyxl/drawing/drawing.pyi new file mode 100644 index 0000000..10f90e2 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/drawing.pyi @@ -0,0 +1,27 @@ +from typing import Any + +class Drawing: + count: int + name: str + description: str + coordinates: Any + left: int + top: int + resize_proportional: bool + rotation: int + anchortype: str + anchorcol: int + anchorrow: int + def __init__(self) -> None: ... + @property + def width(self): ... + @width.setter + def width(self, w) -> None: ... + @property + def height(self): ... + @height.setter + def height(self, h) -> None: ... + def set_dimension(self, w: int = ..., h: int = ...) -> None: ... + def get_emu_dimensions(self): ... + @property + def anchor(self): ... diff --git a/stubs/openpyxl/openpyxl/drawing/effect.pyi b/stubs/openpyxl/openpyxl/drawing/effect.pyi new file mode 100644 index 0000000..d81f968 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/effect.pyi @@ -0,0 +1,202 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +from .colors import ColorChoice + +class TintEffect(Serialisable): + tagname: str + hue: Any + amt: Any + def __init__(self, hue: int = ..., amt: int = ...) -> None: ... + +class LuminanceEffect(Serialisable): + tagname: str + bright: Any + contrast: Any + def __init__(self, bright: int = ..., contrast: int = ...) -> None: ... + +class HSLEffect(Serialisable): + hue: Any + sat: Any + lum: Any + def __init__(self, hue: Any | None = ..., sat: Any | None = ..., lum: Any | None = ...) -> None: ... + +class GrayscaleEffect(Serialisable): + tagname: str + +class FillOverlayEffect(Serialisable): + blend: Any + def __init__(self, blend: Any | None = ...) -> None: ... + +class DuotoneEffect(Serialisable): ... +class ColorReplaceEffect(Serialisable): ... +class Color(Serialisable): ... + +class ColorChangeEffect(Serialisable): + useA: Any + clrFrom: Any + clrTo: Any + def __init__(self, useA: Any | None = ..., clrFrom: Any | None = ..., clrTo: Any | None = ...) -> None: ... + +class BlurEffect(Serialisable): + rad: Any + grow: Any + def __init__(self, rad: Any | None = ..., grow: Any | None = ...) -> None: ... + +class BiLevelEffect(Serialisable): + thresh: Any + def __init__(self, thresh: Any | None = ...) -> None: ... + +class AlphaReplaceEffect(Serialisable): + a: Any + def __init__(self, a: Any | None = ...) -> None: ... + +class AlphaModulateFixedEffect(Serialisable): + amt: Any + def __init__(self, amt: Any | None = ...) -> None: ... + +class EffectContainer(Serialisable): + type: Any + name: Any + def __init__(self, type: Any | None = ..., name: Any | None = ...) -> None: ... + +class AlphaModulateEffect(Serialisable): + cont: Any + def __init__(self, cont: Any | None = ...) -> None: ... + +class AlphaInverseEffect(Serialisable): ... +class AlphaFloorEffect(Serialisable): ... +class AlphaCeilingEffect(Serialisable): ... + +class AlphaBiLevelEffect(Serialisable): + thresh: Any + def __init__(self, thresh: Any | None = ...) -> None: ... + +class GlowEffect(ColorChoice): + rad: Any + scrgbClr: Any + srgbClr: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__(self, rad: Any | None = ..., **kw) -> None: ... + +class InnerShadowEffect(ColorChoice): + blurRad: Any + dist: Any + dir: Any + scrgbClr: Any + srgbClr: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__(self, blurRad: Any | None = ..., dist: Any | None = ..., dir: Any | None = ..., **kw) -> None: ... + +class OuterShadow(ColorChoice): + tagname: str + blurRad: Any + dist: Any + dir: Any + sx: Any + sy: Any + kx: Any + ky: Any + algn: Any + rotWithShape: Any + scrgbClr: Any + srgbClr: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__( + self, + blurRad: Any | None = ..., + dist: Any | None = ..., + dir: Any | None = ..., + sx: Any | None = ..., + sy: Any | None = ..., + kx: Any | None = ..., + ky: Any | None = ..., + algn: Any | None = ..., + rotWithShape: Any | None = ..., + **kw, + ) -> None: ... + +class PresetShadowEffect(ColorChoice): + prst: Any + dist: Any + dir: Any + scrgbClr: Any + srgbClr: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__(self, prst: Any | None = ..., dist: Any | None = ..., dir: Any | None = ..., **kw) -> None: ... + +class ReflectionEffect(Serialisable): + blurRad: Any + stA: Any + stPos: Any + endA: Any + endPos: Any + dist: Any + dir: Any + fadeDir: Any + sx: Any + sy: Any + kx: Any + ky: Any + algn: Any + rotWithShape: Any + def __init__( + self, + blurRad: Any | None = ..., + stA: Any | None = ..., + stPos: Any | None = ..., + endA: Any | None = ..., + endPos: Any | None = ..., + dist: Any | None = ..., + dir: Any | None = ..., + fadeDir: Any | None = ..., + sx: Any | None = ..., + sy: Any | None = ..., + kx: Any | None = ..., + ky: Any | None = ..., + algn: Any | None = ..., + rotWithShape: Any | None = ..., + ) -> None: ... + +class SoftEdgesEffect(Serialisable): + rad: Any + def __init__(self, rad: Any | None = ...) -> None: ... + +class EffectList(Serialisable): + blur: Any + fillOverlay: Any + glow: Any + innerShdw: Any + outerShdw: Any + prstShdw: Any + reflection: Any + softEdge: Any + __elements__: Any + def __init__( + self, + blur: Any | None = ..., + fillOverlay: Any | None = ..., + glow: Any | None = ..., + innerShdw: Any | None = ..., + outerShdw: Any | None = ..., + prstShdw: Any | None = ..., + reflection: Any | None = ..., + softEdge: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/fill.pyi b/stubs/openpyxl/openpyxl/drawing/fill.pyi new file mode 100644 index 0000000..6dbc40d --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/fill.pyi @@ -0,0 +1,221 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class PatternFillProperties(Serialisable): + tagname: str + namespace: Any + prst: Any + preset: Any + fgClr: Any + foreground: Any + bgClr: Any + background: Any + __elements__: Any + def __init__(self, prst: Any | None = ..., fgClr: Any | None = ..., bgClr: Any | None = ...) -> None: ... + +class RelativeRect(Serialisable): + tagname: str + namespace: Any + l: Any + left: Any + t: Any + top: Any + r: Any + right: Any + b: Any + bottom: Any + def __init__(self, l: Any | None = ..., t: Any | None = ..., r: Any | None = ..., b: Any | None = ...) -> None: ... + +class StretchInfoProperties(Serialisable): + tagname: str + namespace: Any + fillRect: Any + def __init__(self, fillRect=...) -> None: ... + +class GradientStop(Serialisable): + tagname: str + namespace: Any + pos: Any + scrgbClr: Any + RGBPercent: Any + srgbClr: Any + RGB: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__( + self, + pos: Any | None = ..., + scrgbClr: Any | None = ..., + srgbClr: Any | None = ..., + hslClr: Any | None = ..., + sysClr: Any | None = ..., + schemeClr: Any | None = ..., + prstClr: Any | None = ..., + ) -> None: ... + +class LinearShadeProperties(Serialisable): + tagname: str + namespace: Any + ang: Any + scaled: Any + def __init__(self, ang: Any | None = ..., scaled: Any | None = ...) -> None: ... + +class PathShadeProperties(Serialisable): + tagname: str + namespace: Any + path: Any + fillToRect: Any + def __init__(self, path: Any | None = ..., fillToRect: Any | None = ...) -> None: ... + +class GradientFillProperties(Serialisable): + tagname: str + namespace: Any + flip: Any + rotWithShape: Any + gsLst: Any + stop_list: Any + lin: Any + linear: Any + path: Any + tileRect: Any + __elements__: Any + def __init__( + self, + flip: Any | None = ..., + rotWithShape: Any | None = ..., + gsLst=..., + lin: Any | None = ..., + path: Any | None = ..., + tileRect: Any | None = ..., + ) -> None: ... + +class SolidColorFillProperties(Serialisable): + tagname: str + scrgbClr: Any + RGBPercent: Any + srgbClr: Any + RGB: Any + hslClr: Any + sysClr: Any + schemeClr: Any + prstClr: Any + __elements__: Any + def __init__( + self, + scrgbClr: Any | None = ..., + srgbClr: Any | None = ..., + hslClr: Any | None = ..., + sysClr: Any | None = ..., + schemeClr: Any | None = ..., + prstClr: Any | None = ..., + ) -> None: ... + +class Blip(Serialisable): + tagname: str + namespace: Any + cstate: Any + embed: Any + link: Any + noGrp: Any + noSelect: Any + noRot: Any + noChangeAspect: Any + noMove: Any + noResize: Any + noEditPoints: Any + noAdjustHandles: Any + noChangeArrowheads: Any + noChangeShapeType: Any + extLst: Any + alphaBiLevel: Any + alphaCeiling: Any + alphaFloor: Any + alphaInv: Any + alphaMod: Any + alphaModFix: Any + alphaRepl: Any + biLevel: Any + blur: Any + clrChange: Any + clrRepl: Any + duotone: Any + fillOverlay: Any + grayscl: Any + hsl: Any + lum: Any + tint: Any + __elements__: Any + def __init__( + self, + cstate: Any | None = ..., + embed: Any | None = ..., + link: Any | None = ..., + noGrp: Any | None = ..., + noSelect: Any | None = ..., + noRot: Any | None = ..., + noChangeAspect: Any | None = ..., + noMove: Any | None = ..., + noResize: Any | None = ..., + noEditPoints: Any | None = ..., + noAdjustHandles: Any | None = ..., + noChangeArrowheads: Any | None = ..., + noChangeShapeType: Any | None = ..., + extLst: Any | None = ..., + alphaBiLevel: Any | None = ..., + alphaCeiling: Any | None = ..., + alphaFloor: Any | None = ..., + alphaInv: Any | None = ..., + alphaMod: Any | None = ..., + alphaModFix: Any | None = ..., + alphaRepl: Any | None = ..., + biLevel: Any | None = ..., + blur: Any | None = ..., + clrChange: Any | None = ..., + clrRepl: Any | None = ..., + duotone: Any | None = ..., + fillOverlay: Any | None = ..., + grayscl: Any | None = ..., + hsl: Any | None = ..., + lum: Any | None = ..., + tint: Any | None = ..., + ) -> None: ... + +class TileInfoProperties(Serialisable): + tx: Any + ty: Any + sx: Any + sy: Any + flip: Any + algn: Any + def __init__( + self, + tx: Any | None = ..., + ty: Any | None = ..., + sx: Any | None = ..., + sy: Any | None = ..., + flip: Any | None = ..., + algn: Any | None = ..., + ) -> None: ... + +class BlipFillProperties(Serialisable): + tagname: str + dpi: Any + rotWithShape: Any + blip: Any + srcRect: Any + tile: Any + stretch: Any + __elements__: Any + def __init__( + self, + dpi: Any | None = ..., + rotWithShape: Any | None = ..., + blip: Any | None = ..., + tile: Any | None = ..., + stretch=..., + srcRect: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/geometry.pyi b/stubs/openpyxl/openpyxl/drawing/geometry.pyi new file mode 100644 index 0000000..8515b2e --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/geometry.pyi @@ -0,0 +1,239 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Point2D(Serialisable): + tagname: str + namespace: Any + x: Any + y: Any + def __init__(self, x: Any | None = ..., y: Any | None = ...) -> None: ... + +class PositiveSize2D(Serialisable): + tagname: str + namespace: Any + cx: Any + width: Any + cy: Any + height: Any + def __init__(self, cx: Any | None = ..., cy: Any | None = ...) -> None: ... + +class Transform2D(Serialisable): + tagname: str + namespace: Any + rot: Any + flipH: Any + flipV: Any + off: Any + ext: Any + chOff: Any + chExt: Any + __elements__: Any + def __init__( + self, + rot: Any | None = ..., + flipH: Any | None = ..., + flipV: Any | None = ..., + off: Any | None = ..., + ext: Any | None = ..., + chOff: Any | None = ..., + chExt: Any | None = ..., + ) -> None: ... + +class GroupTransform2D(Serialisable): + tagname: str + namespace: Any + rot: Any + flipH: Any + flipV: Any + off: Any + ext: Any + chOff: Any + chExt: Any + __elements__: Any + def __init__( + self, + rot: int = ..., + flipH: Any | None = ..., + flipV: Any | None = ..., + off: Any | None = ..., + ext: Any | None = ..., + chOff: Any | None = ..., + chExt: Any | None = ..., + ) -> None: ... + +class SphereCoords(Serialisable): + tagname: str + lat: Any + lon: Any + rev: Any + def __init__(self, lat: Any | None = ..., lon: Any | None = ..., rev: Any | None = ...) -> None: ... + +class Camera(Serialisable): + tagname: str + prst: Any + fov: Any + zoom: Any + rot: Any + def __init__(self, prst: Any | None = ..., fov: Any | None = ..., zoom: Any | None = ..., rot: Any | None = ...) -> None: ... + +class LightRig(Serialisable): + tagname: str + rig: Any + dir: Any + rot: Any + def __init__(self, rig: Any | None = ..., dir: Any | None = ..., rot: Any | None = ...) -> None: ... + +class Vector3D(Serialisable): + tagname: str + dx: Any + dy: Any + dz: Any + def __init__(self, dx: Any | None = ..., dy: Any | None = ..., dz: Any | None = ...) -> None: ... + +class Point3D(Serialisable): + tagname: str + x: Any + y: Any + z: Any + def __init__(self, x: Any | None = ..., y: Any | None = ..., z: Any | None = ...) -> None: ... + +class Backdrop(Serialisable): + anchor: Any + norm: Any + up: Any + extLst: Any + def __init__( + self, anchor: Any | None = ..., norm: Any | None = ..., up: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class Scene3D(Serialisable): + camera: Any + lightRig: Any + backdrop: Any + extLst: Any + def __init__( + self, camera: Any | None = ..., lightRig: Any | None = ..., backdrop: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class Bevel(Serialisable): + tagname: str + w: Any + h: Any + prst: Any + def __init__(self, w: Any | None = ..., h: Any | None = ..., prst: Any | None = ...) -> None: ... + +class Shape3D(Serialisable): + namespace: Any + z: Any + extrusionH: Any + contourW: Any + prstMaterial: Any + bevelT: Any + bevelB: Any + extrusionClr: Any + contourClr: Any + extLst: Any + def __init__( + self, + z: Any | None = ..., + extrusionH: Any | None = ..., + contourW: Any | None = ..., + prstMaterial: Any | None = ..., + bevelT: Any | None = ..., + bevelB: Any | None = ..., + extrusionClr: Any | None = ..., + contourClr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Path2D(Serialisable): + w: Any + h: Any + fill: Any + stroke: Any + extrusionOk: Any + def __init__( + self, + w: Any | None = ..., + h: Any | None = ..., + fill: Any | None = ..., + stroke: Any | None = ..., + extrusionOk: Any | None = ..., + ) -> None: ... + +class Path2DList(Serialisable): + path: Any + def __init__(self, path: Any | None = ...) -> None: ... + +class GeomRect(Serialisable): + l: Any + t: Any + r: Any + b: Any + def __init__(self, l: Any | None = ..., t: Any | None = ..., r: Any | None = ..., b: Any | None = ...) -> None: ... + +class AdjPoint2D(Serialisable): + x: Any + y: Any + def __init__(self, x: Any | None = ..., y: Any | None = ...) -> None: ... + +class ConnectionSite(Serialisable): + ang: Any + pos: Any + def __init__(self, ang: Any | None = ..., pos: Any | None = ...) -> None: ... + +class ConnectionSiteList(Serialisable): + cxn: Any + def __init__(self, cxn: Any | None = ...) -> None: ... + +class AdjustHandleList(Serialisable): ... + +class GeomGuide(Serialisable): + name: Any + fmla: Any + def __init__(self, name: Any | None = ..., fmla: Any | None = ...) -> None: ... + +class GeomGuideList(Serialisable): + gd: Any + def __init__(self, gd: Any | None = ...) -> None: ... + +class CustomGeometry2D(Serialisable): + avLst: Any + gdLst: Any + ahLst: Any + cxnLst: Any + pathLst: Any + rect: Any + def __init__( + self, + avLst: Any | None = ..., + gdLst: Any | None = ..., + ahLst: Any | None = ..., + cxnLst: Any | None = ..., + rect: Any | None = ..., + pathLst: Any | None = ..., + ) -> None: ... + +class PresetGeometry2D(Serialisable): + namespace: Any + prst: Any + avLst: Any + def __init__(self, prst: Any | None = ..., avLst: Any | None = ...) -> None: ... + +class FontReference(Serialisable): + idx: Any + def __init__(self, idx: Any | None = ...) -> None: ... + +class StyleMatrixReference(Serialisable): + idx: Any + def __init__(self, idx: Any | None = ...) -> None: ... + +class ShapeStyle(Serialisable): + lnRef: Any + fillRef: Any + effectRef: Any + fontRef: Any + def __init__( + self, lnRef: Any | None = ..., fillRef: Any | None = ..., effectRef: Any | None = ..., fontRef: Any | None = ... + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/graphic.pyi b/stubs/openpyxl/openpyxl/drawing/graphic.pyi new file mode 100644 index 0000000..4f75f06 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/graphic.pyi @@ -0,0 +1,74 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class GraphicFrameLocking(Serialisable): + noGrp: Any + noDrilldown: Any + noSelect: Any + noChangeAspect: Any + noMove: Any + noResize: Any + extLst: Any + def __init__( + self, + noGrp: Any | None = ..., + noDrilldown: Any | None = ..., + noSelect: Any | None = ..., + noChangeAspect: Any | None = ..., + noMove: Any | None = ..., + noResize: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class NonVisualGraphicFrameProperties(Serialisable): + tagname: str + graphicFrameLocks: Any + extLst: Any + def __init__(self, graphicFrameLocks: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class NonVisualGraphicFrame(Serialisable): + tagname: str + cNvPr: Any + cNvGraphicFramePr: Any + __elements__: Any + def __init__(self, cNvPr: Any | None = ..., cNvGraphicFramePr: Any | None = ...) -> None: ... + +class GraphicData(Serialisable): + tagname: str + namespace: Any + uri: Any + chart: Any + def __init__(self, uri=..., chart: Any | None = ...) -> None: ... + +class GraphicObject(Serialisable): + tagname: str + namespace: Any + graphicData: Any + def __init__(self, graphicData: Any | None = ...) -> None: ... + +class GraphicFrame(Serialisable): + tagname: str + nvGraphicFramePr: Any + xfrm: Any + graphic: Any + macro: Any + fPublished: Any + __elements__: Any + def __init__( + self, + nvGraphicFramePr: Any | None = ..., + xfrm: Any | None = ..., + graphic: Any | None = ..., + macro: Any | None = ..., + fPublished: Any | None = ..., + ) -> None: ... + +class GroupShape(Serialisable): + nvGrpSpPr: Any + nonVisualProperties: Any + grpSpPr: Any + visualProperties: Any + pic: Any + __elements__: Any + def __init__(self, nvGrpSpPr: Any | None = ..., grpSpPr: Any | None = ..., pic: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/image.pyi b/stubs/openpyxl/openpyxl/drawing/image.pyi new file mode 100644 index 0000000..c1d8009 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/image.pyi @@ -0,0 +1,9 @@ +from typing import Any + +class Image: + anchor: str + ref: Any + format: Any + def __init__(self, img) -> None: ... + @property + def path(self): ... diff --git a/stubs/openpyxl/openpyxl/drawing/line.pyi b/stubs/openpyxl/openpyxl/drawing/line.pyi new file mode 100644 index 0000000..dd2c539 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/line.pyi @@ -0,0 +1,66 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class LineEndProperties(Serialisable): + tagname: str + namespace: Any + type: Any + w: Any + len: Any + def __init__(self, type: Any | None = ..., w: Any | None = ..., len: Any | None = ...) -> None: ... + +class DashStop(Serialisable): + tagname: str + namespace: Any + d: Any + length: Any + sp: Any + space: Any + def __init__(self, d: int = ..., sp: int = ...) -> None: ... + +class DashStopList(Serialisable): + ds: Any + def __init__(self, ds: Any | None = ...) -> None: ... + +class LineProperties(Serialisable): + tagname: str + namespace: Any + w: Any + width: Any + cap: Any + cmpd: Any + algn: Any + noFill: Any + solidFill: Any + gradFill: Any + pattFill: Any + prstDash: Any + dashStyle: Any + custDash: Any + round: Any + bevel: Any + miter: Any + headEnd: Any + tailEnd: Any + extLst: Any + __elements__: Any + def __init__( + self, + w: Any | None = ..., + cap: Any | None = ..., + cmpd: Any | None = ..., + algn: Any | None = ..., + noFill: Any | None = ..., + solidFill: Any | None = ..., + gradFill: Any | None = ..., + pattFill: Any | None = ..., + prstDash: Any | None = ..., + custDash: Any | None = ..., + round: Any | None = ..., + bevel: Any | None = ..., + miter: Any | None = ..., + headEnd: Any | None = ..., + tailEnd: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/picture.pyi b/stubs/openpyxl/openpyxl/drawing/picture.pyi new file mode 100644 index 0000000..1ff1db8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/picture.pyi @@ -0,0 +1,70 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class PictureLocking(Serialisable): + tagname: str + namespace: Any + noCrop: Any + noGrp: Any + noSelect: Any + noRot: Any + noChangeAspect: Any + noMove: Any + noResize: Any + noEditPoints: Any + noAdjustHandles: Any + noChangeArrowheads: Any + noChangeShapeType: Any + extLst: Any + __elements__: Any + def __init__( + self, + noCrop: Any | None = ..., + noGrp: Any | None = ..., + noSelect: Any | None = ..., + noRot: Any | None = ..., + noChangeAspect: Any | None = ..., + noMove: Any | None = ..., + noResize: Any | None = ..., + noEditPoints: Any | None = ..., + noAdjustHandles: Any | None = ..., + noChangeArrowheads: Any | None = ..., + noChangeShapeType: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class NonVisualPictureProperties(Serialisable): + tagname: str + preferRelativeResize: Any + picLocks: Any + extLst: Any + __elements__: Any + def __init__(self, preferRelativeResize: Any | None = ..., picLocks: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class PictureNonVisual(Serialisable): + tagname: str + cNvPr: Any + cNvPicPr: Any + __elements__: Any + def __init__(self, cNvPr: Any | None = ..., cNvPicPr: Any | None = ...) -> None: ... + +class PictureFrame(Serialisable): + tagname: str + macro: Any + fPublished: Any + nvPicPr: Any + blipFill: Any + spPr: Any + graphicalProperties: Any + style: Any + __elements__: Any + def __init__( + self, + macro: Any | None = ..., + fPublished: Any | None = ..., + nvPicPr: Any | None = ..., + blipFill: Any | None = ..., + spPr: Any | None = ..., + style: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/properties.pyi b/stubs/openpyxl/openpyxl/drawing/properties.pyi new file mode 100644 index 0000000..f0782a4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/properties.pyi @@ -0,0 +1,91 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class GroupShapeProperties(Serialisable): + tagname: str + bwMode: Any + xfrm: Any + scene3d: Any + extLst: Any + def __init__( + self, bwMode: Any | None = ..., xfrm: Any | None = ..., scene3d: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class GroupLocking(Serialisable): + tagname: str + namespace: Any + noGrp: Any + noUngrp: Any + noSelect: Any + noRot: Any + noChangeAspect: Any + noMove: Any + noResize: Any + noChangeArrowheads: Any + noEditPoints: Any + noAdjustHandles: Any + noChangeShapeType: Any + extLst: Any + __elements__: Any + def __init__( + self, + noGrp: Any | None = ..., + noUngrp: Any | None = ..., + noSelect: Any | None = ..., + noRot: Any | None = ..., + noChangeAspect: Any | None = ..., + noChangeArrowheads: Any | None = ..., + noMove: Any | None = ..., + noResize: Any | None = ..., + noEditPoints: Any | None = ..., + noAdjustHandles: Any | None = ..., + noChangeShapeType: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class NonVisualGroupDrawingShapeProps(Serialisable): + tagname: str + grpSpLocks: Any + extLst: Any + __elements__: Any + def __init__(self, grpSpLocks: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class NonVisualDrawingShapeProps(Serialisable): + tagname: str + spLocks: Any + txBax: Any + extLst: Any + __elements__: Any + txBox: Any + def __init__(self, spLocks: Any | None = ..., txBox: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class NonVisualDrawingProps(Serialisable): + tagname: str + id: Any + name: Any + descr: Any + hidden: Any + title: Any + hlinkClick: Any + hlinkHover: Any + extLst: Any + __elements__: Any + def __init__( + self, + id: Any | None = ..., + name: Any | None = ..., + descr: Any | None = ..., + hidden: Any | None = ..., + title: Any | None = ..., + hlinkClick: Any | None = ..., + hlinkHover: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class NonVisualGroupShape(Serialisable): + tagname: str + cNvPr: Any + cNvGrpSpPr: Any + __elements__: Any + def __init__(self, cNvPr: Any | None = ..., cNvGrpSpPr: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/relation.pyi b/stubs/openpyxl/openpyxl/drawing/relation.pyi new file mode 100644 index 0000000..69079ce --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/relation.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ChartRelation(Serialisable): + tagname: str + namespace: Any + id: Any + def __init__(self, id) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/spreadsheet_drawing.pyi b/stubs/openpyxl/openpyxl/drawing/spreadsheet_drawing.pyi new file mode 100644 index 0000000..1f96318 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/spreadsheet_drawing.pyi @@ -0,0 +1,96 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class AnchorClientData(Serialisable): + fLocksWithSheet: Any + fPrintsWithSheet: Any + def __init__(self, fLocksWithSheet: Any | None = ..., fPrintsWithSheet: Any | None = ...) -> None: ... + +class AnchorMarker(Serialisable): + tagname: str + col: Any + colOff: Any + row: Any + rowOff: Any + def __init__(self, col: int = ..., colOff: int = ..., row: int = ..., rowOff: int = ...) -> None: ... + +class _AnchorBase(Serialisable): + sp: Any + shape: Any + grpSp: Any + groupShape: Any + graphicFrame: Any + cxnSp: Any + connectionShape: Any + pic: Any + contentPart: Any + clientData: Any + __elements__: Any + def __init__( + self, + clientData: Any | None = ..., + sp: Any | None = ..., + grpSp: Any | None = ..., + graphicFrame: Any | None = ..., + cxnSp: Any | None = ..., + pic: Any | None = ..., + contentPart: Any | None = ..., + ) -> None: ... + +class AbsoluteAnchor(_AnchorBase): + tagname: str + pos: Any + ext: Any + sp: Any + grpSp: Any + graphicFrame: Any + cxnSp: Any + pic: Any + contentPart: Any + clientData: Any + __elements__: Any + def __init__(self, pos: Any | None = ..., ext: Any | None = ..., **kw) -> None: ... + +class OneCellAnchor(_AnchorBase): + tagname: str + ext: Any + sp: Any + grpSp: Any + graphicFrame: Any + cxnSp: Any + pic: Any + contentPart: Any + clientData: Any + __elements__: Any + def __init__(self, _from: Any | None = ..., ext: Any | None = ..., **kw) -> None: ... + +class TwoCellAnchor(_AnchorBase): + tagname: str + editAs: Any + to: Any + sp: Any + grpSp: Any + graphicFrame: Any + cxnSp: Any + pic: Any + contentPart: Any + clientData: Any + __elements__: Any + def __init__(self, editAs: Any | None = ..., _from: Any | None = ..., to: Any | None = ..., **kw) -> None: ... + +class SpreadsheetDrawing(Serialisable): + tagname: str + mime_type: str + PartName: str + twoCellAnchor: Any + oneCellAnchor: Any + absoluteAnchor: Any + __elements__: Any + charts: Any + images: Any + def __init__(self, twoCellAnchor=..., oneCellAnchor=..., absoluteAnchor=...) -> None: ... + def __hash__(self): ... + def __bool__(self): ... + @property + def path(self): ... diff --git a/stubs/openpyxl/openpyxl/drawing/text.pyi b/stubs/openpyxl/openpyxl/drawing/text.pyi new file mode 100644 index 0000000..86a7b04 --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/text.pyi @@ -0,0 +1,377 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class EmbeddedWAVAudioFile(Serialisable): # type: ignore[misc] + name: Any + def __init__(self, name: Any | None = ...) -> None: ... + +class Hyperlink(Serialisable): + tagname: str + namespace: Any + invalidUrl: Any + action: Any + tgtFrame: Any + tooltip: Any + history: Any + highlightClick: Any + endSnd: Any + snd: Any + extLst: Any + id: Any + __elements__: Any + def __init__( + self, + invalidUrl: Any | None = ..., + action: Any | None = ..., + tgtFrame: Any | None = ..., + tooltip: Any | None = ..., + history: Any | None = ..., + highlightClick: Any | None = ..., + endSnd: Any | None = ..., + snd: Any | None = ..., + extLst: Any | None = ..., + id: Any | None = ..., + ) -> None: ... + +class Font(Serialisable): + tagname: str + namespace: Any + typeface: Any + panose: Any + pitchFamily: Any + charset: Any + def __init__( + self, typeface: Any | None = ..., panose: Any | None = ..., pitchFamily: Any | None = ..., charset: Any | None = ... + ) -> None: ... + +class CharacterProperties(Serialisable): + tagname: str + namespace: Any + kumimoji: Any + lang: Any + altLang: Any + sz: Any + b: Any + i: Any + u: Any + strike: Any + kern: Any + cap: Any + spc: Any + normalizeH: Any + baseline: Any + noProof: Any + dirty: Any + err: Any + smtClean: Any + smtId: Any + bmk: Any + ln: Any + highlight: Any + latin: Any + ea: Any + cs: Any + sym: Any + hlinkClick: Any + hlinkMouseOver: Any + rtl: Any + extLst: Any + noFill: Any + solidFill: Any + gradFill: Any + blipFill: Any + pattFill: Any + grpFill: Any + effectLst: Any + effectDag: Any + uLnTx: Any + uLn: Any + uFillTx: Any + uFill: Any + __elements__: Any + def __init__( + self, + kumimoji: Any | None = ..., + lang: Any | None = ..., + altLang: Any | None = ..., + sz: Any | None = ..., + b: Any | None = ..., + i: Any | None = ..., + u: Any | None = ..., + strike: Any | None = ..., + kern: Any | None = ..., + cap: Any | None = ..., + spc: Any | None = ..., + normalizeH: Any | None = ..., + baseline: Any | None = ..., + noProof: Any | None = ..., + dirty: Any | None = ..., + err: Any | None = ..., + smtClean: Any | None = ..., + smtId: Any | None = ..., + bmk: Any | None = ..., + ln: Any | None = ..., + highlight: Any | None = ..., + latin: Any | None = ..., + ea: Any | None = ..., + cs: Any | None = ..., + sym: Any | None = ..., + hlinkClick: Any | None = ..., + hlinkMouseOver: Any | None = ..., + rtl: Any | None = ..., + extLst: Any | None = ..., + noFill: Any | None = ..., + solidFill: Any | None = ..., + gradFill: Any | None = ..., + blipFill: Any | None = ..., + pattFill: Any | None = ..., + grpFill: Any | None = ..., + effectLst: Any | None = ..., + effectDag: Any | None = ..., + uLnTx: Any | None = ..., + uLn: Any | None = ..., + uFillTx: Any | None = ..., + uFill: Any | None = ..., + ) -> None: ... + +class TabStop(Serialisable): # type: ignore[misc] + pos: Any + algn: Any + def __init__(self, pos: Any | None = ..., algn: Any | None = ...) -> None: ... + +class TabStopList(Serialisable): # type: ignore[misc] + tab: Any + def __init__(self, tab: Any | None = ...) -> None: ... + +class Spacing(Serialisable): + spcPct: Any + spcPts: Any + __elements__: Any + def __init__(self, spcPct: Any | None = ..., spcPts: Any | None = ...) -> None: ... + +class AutonumberBullet(Serialisable): + type: Any + startAt: Any + def __init__(self, type: Any | None = ..., startAt: Any | None = ...) -> None: ... + +class ParagraphProperties(Serialisable): + tagname: str + namespace: Any + marL: Any + marR: Any + lvl: Any + indent: Any + algn: Any + defTabSz: Any + rtl: Any + eaLnBrk: Any + fontAlgn: Any + latinLnBrk: Any + hangingPunct: Any + lnSpc: Any + spcBef: Any + spcAft: Any + tabLst: Any + defRPr: Any + extLst: Any + buClrTx: Any + buClr: Any + buSzTx: Any + buSzPct: Any + buSzPts: Any + buFontTx: Any + buFont: Any + buNone: Any + buAutoNum: Any + buChar: Any + buBlip: Any + __elements__: Any + def __init__( + self, + marL: Any | None = ..., + marR: Any | None = ..., + lvl: Any | None = ..., + indent: Any | None = ..., + algn: Any | None = ..., + defTabSz: Any | None = ..., + rtl: Any | None = ..., + eaLnBrk: Any | None = ..., + fontAlgn: Any | None = ..., + latinLnBrk: Any | None = ..., + hangingPunct: Any | None = ..., + lnSpc: Any | None = ..., + spcBef: Any | None = ..., + spcAft: Any | None = ..., + tabLst: Any | None = ..., + defRPr: Any | None = ..., + extLst: Any | None = ..., + buClrTx: Any | None = ..., + buClr: Any | None = ..., + buSzTx: Any | None = ..., + buSzPct: Any | None = ..., + buSzPts: Any | None = ..., + buFontTx: Any | None = ..., + buFont: Any | None = ..., + buNone: Any | None = ..., + buAutoNum: Any | None = ..., + buChar: Any | None = ..., + buBlip: Any | None = ..., + ) -> None: ... + +class ListStyle(Serialisable): + tagname: str + namespace: Any + defPPr: Any + lvl1pPr: Any + lvl2pPr: Any + lvl3pPr: Any + lvl4pPr: Any + lvl5pPr: Any + lvl6pPr: Any + lvl7pPr: Any + lvl8pPr: Any + lvl9pPr: Any + extLst: Any + __elements__: Any + def __init__( + self, + defPPr: Any | None = ..., + lvl1pPr: Any | None = ..., + lvl2pPr: Any | None = ..., + lvl3pPr: Any | None = ..., + lvl4pPr: Any | None = ..., + lvl5pPr: Any | None = ..., + lvl6pPr: Any | None = ..., + lvl7pPr: Any | None = ..., + lvl8pPr: Any | None = ..., + lvl9pPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class RegularTextRun(Serialisable): + tagname: str + namespace: Any + rPr: Any + properties: Any + t: Any + value: Any + __elements__: Any + def __init__(self, rPr: Any | None = ..., t: str = ...) -> None: ... + +class LineBreak(Serialisable): + tagname: str + namespace: Any + rPr: Any + __elements__: Any + def __init__(self, rPr: Any | None = ...) -> None: ... + +class TextField(Serialisable): + id: Any + type: Any + rPr: Any + pPr: Any + t: Any + __elements__: Any + def __init__( + self, id: Any | None = ..., type: Any | None = ..., rPr: Any | None = ..., pPr: Any | None = ..., t: Any | None = ... + ) -> None: ... + +class Paragraph(Serialisable): + tagname: str + namespace: Any + pPr: Any + properties: Any + endParaRPr: Any + r: Any + text: Any + br: Any + fld: Any + __elements__: Any + def __init__( + self, + pPr: Any | None = ..., + endParaRPr: Any | None = ..., + r: Any | None = ..., + br: Any | None = ..., + fld: Any | None = ..., + ) -> None: ... + +class GeomGuide(Serialisable): + name: Any + fmla: Any + def __init__(self, name: Any | None = ..., fmla: Any | None = ...) -> None: ... + +class GeomGuideList(Serialisable): + gd: Any + def __init__(self, gd: Any | None = ...) -> None: ... + +class PresetTextShape(Serialisable): + prst: Any + avLst: Any + def __init__(self, prst: Any | None = ..., avLst: Any | None = ...) -> None: ... + +class TextNormalAutofit(Serialisable): + fontScale: Any + lnSpcReduction: Any + def __init__(self, fontScale: Any | None = ..., lnSpcReduction: Any | None = ...) -> None: ... + +class RichTextProperties(Serialisable): + tagname: str + namespace: Any + rot: Any + spcFirstLastPara: Any + vertOverflow: Any + horzOverflow: Any + vert: Any + wrap: Any + lIns: Any + tIns: Any + rIns: Any + bIns: Any + numCol: Any + spcCol: Any + rtlCol: Any + fromWordArt: Any + anchor: Any + anchorCtr: Any + forceAA: Any + upright: Any + compatLnSpc: Any + prstTxWarp: Any + scene3d: Any + extLst: Any + noAutofit: Any + normAutofit: Any + spAutoFit: Any + flatTx: Any + __elements__: Any + def __init__( + self, + rot: Any | None = ..., + spcFirstLastPara: Any | None = ..., + vertOverflow: Any | None = ..., + horzOverflow: Any | None = ..., + vert: Any | None = ..., + wrap: Any | None = ..., + lIns: Any | None = ..., + tIns: Any | None = ..., + rIns: Any | None = ..., + bIns: Any | None = ..., + numCol: Any | None = ..., + spcCol: Any | None = ..., + rtlCol: Any | None = ..., + fromWordArt: Any | None = ..., + anchor: Any | None = ..., + anchorCtr: Any | None = ..., + forceAA: Any | None = ..., + upright: Any | None = ..., + compatLnSpc: Any | None = ..., + prstTxWarp: Any | None = ..., + scene3d: Any | None = ..., + extLst: Any | None = ..., + noAutofit: Any | None = ..., + normAutofit: Any | None = ..., + spAutoFit: Any | None = ..., + flatTx: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/drawing/xdr.pyi b/stubs/openpyxl/openpyxl/drawing/xdr.pyi new file mode 100644 index 0000000..d54d0cc --- /dev/null +++ b/stubs/openpyxl/openpyxl/drawing/xdr.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from .geometry import Point2D, PositiveSize2D, Transform2D + +class XDRPoint2D(Point2D): + namespace: Any + x: Any + y: Any + +class XDRPositiveSize2D(PositiveSize2D): + namespace: Any + cx: Any + cy: Any + +class XDRTransform2D(Transform2D): + namespace: Any + rot: Any + flipH: Any + flipV: Any + off: Any + ext: Any + chOff: Any + chExt: Any diff --git a/stubs/openpyxl/openpyxl/formatting/__init__.pyi b/stubs/openpyxl/openpyxl/formatting/__init__.pyi new file mode 100644 index 0000000..c4e04ce --- /dev/null +++ b/stubs/openpyxl/openpyxl/formatting/__init__.pyi @@ -0,0 +1 @@ +from .rule import Rule as Rule diff --git a/stubs/openpyxl/openpyxl/formatting/formatting.pyi b/stubs/openpyxl/openpyxl/formatting/formatting.pyi new file mode 100644 index 0000000..e9328cb --- /dev/null +++ b/stubs/openpyxl/openpyxl/formatting/formatting.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ConditionalFormatting(Serialisable): + tagname: str + sqref: Any + cells: Any + pivot: Any + cfRule: Any + rules: Any + def __init__(self, sqref=..., pivot: Any | None = ..., cfRule=..., extLst: Any | None = ...) -> None: ... + def __eq__(self, other): ... + def __hash__(self): ... + def __contains__(self, coord): ... + +class ConditionalFormattingList: + max_priority: int + def __init__(self) -> None: ... + def add(self, range_string, cfRule) -> None: ... + def __bool__(self): ... + def __len__(self): ... + def __iter__(self): ... + def __getitem__(self, key): ... + def __delitem__(self, key) -> None: ... + def __setitem__(self, key, rule) -> None: ... diff --git a/stubs/openpyxl/openpyxl/formatting/rule.pyi b/stubs/openpyxl/openpyxl/formatting/rule.pyi new file mode 100644 index 0000000..92b4ea8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/formatting/rule.pyi @@ -0,0 +1,152 @@ +from typing import Any + +from openpyxl.descriptors import Float +from openpyxl.descriptors.serialisable import Serialisable + +class ValueDescriptor(Float): + expected_type: Any + def __set__(self, instance, value) -> None: ... + +class FormatObject(Serialisable): + tagname: str + type: Any + val: Any + gte: Any + extLst: Any + __elements__: Any + def __init__(self, type, val: Any | None = ..., gte: Any | None = ..., extLst: Any | None = ...) -> None: ... + +class RuleType(Serialisable): # type: ignore[misc] + cfvo: Any + +class IconSet(RuleType): + tagname: str + iconSet: Any + showValue: Any + percent: Any + reverse: Any + __elements__: Any + cfvo: Any + def __init__( + self, + iconSet: Any | None = ..., + showValue: Any | None = ..., + percent: Any | None = ..., + reverse: Any | None = ..., + cfvo: Any | None = ..., + ) -> None: ... + +class DataBar(RuleType): + tagname: str + minLength: Any + maxLength: Any + showValue: Any + color: Any + __elements__: Any + cfvo: Any + def __init__( + self, + minLength: Any | None = ..., + maxLength: Any | None = ..., + showValue: Any | None = ..., + cfvo: Any | None = ..., + color: Any | None = ..., + ) -> None: ... + +class ColorScale(RuleType): + tagname: str + color: Any + __elements__: Any + cfvo: Any + def __init__(self, cfvo: Any | None = ..., color: Any | None = ...) -> None: ... + +class Rule(Serialisable): + tagname: str + type: Any + dxfId: Any + priority: Any + stopIfTrue: Any + aboveAverage: Any + percent: Any + bottom: Any + operator: Any + text: Any + timePeriod: Any + rank: Any + stdDev: Any + equalAverage: Any + formula: Any + colorScale: Any + dataBar: Any + iconSet: Any + extLst: Any + dxf: Any + __elements__: Any + __attrs__: Any + def __init__( + self, + type, + dxfId: Any | None = ..., + priority: int = ..., + stopIfTrue: Any | None = ..., + aboveAverage: Any | None = ..., + percent: Any | None = ..., + bottom: Any | None = ..., + operator: Any | None = ..., + text: Any | None = ..., + timePeriod: Any | None = ..., + rank: Any | None = ..., + stdDev: Any | None = ..., + equalAverage: Any | None = ..., + formula=..., + colorScale: Any | None = ..., + dataBar: Any | None = ..., + iconSet: Any | None = ..., + extLst: Any | None = ..., + dxf: Any | None = ..., + ) -> None: ... + +def ColorScaleRule( + start_type: Any | None = ..., + start_value: Any | None = ..., + start_color: Any | None = ..., + mid_type: Any | None = ..., + mid_value: Any | None = ..., + mid_color: Any | None = ..., + end_type: Any | None = ..., + end_value: Any | None = ..., + end_color: Any | None = ..., +): ... +def FormulaRule( + formula: Any | None = ..., + stopIfTrue: Any | None = ..., + font: Any | None = ..., + border: Any | None = ..., + fill: Any | None = ..., +): ... +def CellIsRule( + operator: Any | None = ..., + formula: Any | None = ..., + stopIfTrue: Any | None = ..., + font: Any | None = ..., + border: Any | None = ..., + fill: Any | None = ..., +): ... +def IconSetRule( + icon_style: Any | None = ..., + type: Any | None = ..., + values: Any | None = ..., + showValue: Any | None = ..., + percent: Any | None = ..., + reverse: Any | None = ..., +): ... +def DataBarRule( + start_type: Any | None = ..., + start_value: Any | None = ..., + end_type: Any | None = ..., + end_value: Any | None = ..., + color: Any | None = ..., + showValue: Any | None = ..., + minLength: Any | None = ..., + maxLength: Any | None = ..., +): ... diff --git a/stubs/openpyxl/openpyxl/formula/__init__.pyi b/stubs/openpyxl/openpyxl/formula/__init__.pyi new file mode 100644 index 0000000..c2decb3 --- /dev/null +++ b/stubs/openpyxl/openpyxl/formula/__init__.pyi @@ -0,0 +1 @@ +from .tokenizer import Tokenizer as Tokenizer diff --git a/stubs/openpyxl/openpyxl/formula/tokenizer.pyi b/stubs/openpyxl/openpyxl/formula/tokenizer.pyi new file mode 100644 index 0000000..355e48e --- /dev/null +++ b/stubs/openpyxl/openpyxl/formula/tokenizer.pyi @@ -0,0 +1,52 @@ +from typing import Any + +class TokenizerError(Exception): ... + +class Tokenizer: + SN_RE: Any + WSPACE_RE: Any + STRING_REGEXES: Any + ERROR_CODES: Any + TOKEN_ENDERS: str + formula: Any + items: Any + token_stack: Any + offset: int + token: Any + def __init__(self, formula) -> None: ... + def check_scientific_notation(self): ... + def assert_empty_token(self, can_follow=...) -> None: ... + def save_token(self) -> None: ... + def render(self): ... + +class Token: + LITERAL: str + OPERAND: str + FUNC: str + ARRAY: str + PAREN: str + SEP: str + OP_PRE: str + OP_IN: str + OP_POST: str + WSPACE: str + value: Any + type: Any + subtype: Any + def __init__(self, value, type_, subtype: str = ...) -> None: ... + TEXT: str + NUMBER: str + LOGICAL: str + ERROR: str + RANGE: str + @classmethod + def make_operand(cls, value): ... + OPEN: str + CLOSE: str + @classmethod + def make_subexp(cls, value, func: bool = ...): ... + def get_closer(self): ... + ARG: str + ROW: str + @classmethod + def make_separator(cls, value): ... diff --git a/stubs/openpyxl/openpyxl/formula/translate.pyi b/stubs/openpyxl/openpyxl/formula/translate.pyi new file mode 100644 index 0000000..0729715 --- /dev/null +++ b/stubs/openpyxl/openpyxl/formula/translate.pyi @@ -0,0 +1,20 @@ +from typing import Any + +class TranslatorError(Exception): ... + +class Translator: + tokenizer: Any + def __init__(self, formula, origin) -> None: ... + def get_tokens(self): ... + ROW_RANGE_RE: Any + COL_RANGE_RE: Any + CELL_REF_RE: Any + @staticmethod + def translate_row(row_str, rdelta): ... + @staticmethod + def translate_col(col_str, cdelta): ... + @staticmethod + def strip_ws_name(range_str): ... + @classmethod + def translate_range(cls, range_str, rdelta, cdelta): ... + def translate_formula(self, dest: Any | None = ..., row_delta: int = ..., col_delta: int = ...): ... diff --git a/stubs/selenium/selenium/webdriver/firefox/__init__.pyi b/stubs/openpyxl/openpyxl/packaging/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/firefox/__init__.pyi rename to stubs/openpyxl/openpyxl/packaging/__init__.pyi diff --git a/stubs/openpyxl/openpyxl/packaging/core.pyi b/stubs/openpyxl/openpyxl/packaging/core.pyi new file mode 100644 index 0000000..824260e --- /dev/null +++ b/stubs/openpyxl/openpyxl/packaging/core.pyi @@ -0,0 +1,51 @@ +from typing import Any + +from openpyxl.descriptors import DateTime +from openpyxl.descriptors.nested import NestedText +from openpyxl.descriptors.serialisable import Serialisable + +class NestedDateTime(DateTime, NestedText): + expected_type: Any + def to_tree(self, tagname: Any | None = ..., value: Any | None = ..., namespace: Any | None = ...): ... + +class QualifiedDateTime(NestedDateTime): + def to_tree(self, tagname: Any | None = ..., value: Any | None = ..., namespace: Any | None = ...): ... + +class DocumentProperties(Serialisable): + tagname: str + namespace: Any + category: Any + contentStatus: Any + keywords: Any + lastModifiedBy: Any + lastPrinted: Any + revision: Any + version: Any + last_modified_by: Any + subject: Any + title: Any + creator: Any + description: Any + identifier: Any + language: Any + created: Any + modified: Any + __elements__: Any + def __init__( + self, + category: Any | None = ..., + contentStatus: Any | None = ..., + keywords: Any | None = ..., + lastModifiedBy: Any | None = ..., + lastPrinted: Any | None = ..., + revision: Any | None = ..., + version: Any | None = ..., + created=..., + creator: str = ..., + description: Any | None = ..., + identifier: Any | None = ..., + language: Any | None = ..., + modified=..., + subject: Any | None = ..., + title: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/packaging/extended.pyi b/stubs/openpyxl/openpyxl/packaging/extended.pyi new file mode 100644 index 0000000..72312b0 --- /dev/null +++ b/stubs/openpyxl/openpyxl/packaging/extended.pyi @@ -0,0 +1,79 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +def get_version(): ... + +class DigSigBlob(Serialisable): # type: ignore[misc] + __elements__: Any + __attrs__: Any + +class VectorLpstr(Serialisable): # type: ignore[misc] + __elements__: Any + __attrs__: Any + +class VectorVariant(Serialisable): # type: ignore[misc] + __elements__: Any + __attrs__: Any + +class ExtendedProperties(Serialisable): + tagname: str + Template: Any + Manager: Any + Company: Any + Pages: Any + Words: Any + Characters: Any + PresentationFormat: Any + Lines: Any + Paragraphs: Any + Slides: Any + Notes: Any + TotalTime: Any + HiddenSlides: Any + MMClips: Any + ScaleCrop: Any + HeadingPairs: Any + TitlesOfParts: Any + LinksUpToDate: Any + CharactersWithSpaces: Any + SharedDoc: Any + HyperlinkBase: Any + HLinks: Any + HyperlinksChanged: Any + DigSig: Any + Application: Any + AppVersion: Any + DocSecurity: Any + __elements__: Any + def __init__( + self, + Template: Any | None = ..., + Manager: Any | None = ..., + Company: Any | None = ..., + Pages: Any | None = ..., + Words: Any | None = ..., + Characters: Any | None = ..., + PresentationFormat: Any | None = ..., + Lines: Any | None = ..., + Paragraphs: Any | None = ..., + Slides: Any | None = ..., + Notes: Any | None = ..., + TotalTime: Any | None = ..., + HiddenSlides: Any | None = ..., + MMClips: Any | None = ..., + ScaleCrop: Any | None = ..., + HeadingPairs: Any | None = ..., + TitlesOfParts: Any | None = ..., + LinksUpToDate: Any | None = ..., + CharactersWithSpaces: Any | None = ..., + SharedDoc: Any | None = ..., + HyperlinkBase: Any | None = ..., + HLinks: Any | None = ..., + HyperlinksChanged: Any | None = ..., + DigSig: Any | None = ..., + Application: str = ..., + AppVersion: Any | None = ..., + DocSecurity: Any | None = ..., + ) -> None: ... + def to_tree(self): ... diff --git a/stubs/openpyxl/openpyxl/packaging/interface.pyi b/stubs/openpyxl/openpyxl/packaging/interface.pyi new file mode 100644 index 0000000..d000905 --- /dev/null +++ b/stubs/openpyxl/openpyxl/packaging/interface.pyi @@ -0,0 +1,6 @@ +from abc import ABC, ABCMeta, abstractmethod + +class ISerialisableFile(ABC, metaclass=ABCMeta): + @property + @abstractmethod + def id(self): ... diff --git a/stubs/openpyxl/openpyxl/packaging/manifest.pyi b/stubs/openpyxl/openpyxl/packaging/manifest.pyi new file mode 100644 index 0000000..404d7ca --- /dev/null +++ b/stubs/openpyxl/openpyxl/packaging/manifest.pyi @@ -0,0 +1,38 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +mimetypes: Any + +class FileExtension(Serialisable): + tagname: str + Extension: Any + ContentType: Any + def __init__(self, Extension, ContentType) -> None: ... + +class Override(Serialisable): + tagname: str + PartName: Any + ContentType: Any + def __init__(self, PartName, ContentType) -> None: ... + +DEFAULT_TYPES: Any +DEFAULT_OVERRIDE: Any + +class Manifest(Serialisable): + tagname: str + Default: Any + Override: Any + path: str + __elements__: Any + def __init__(self, Default=..., Override=...) -> None: ... + @property + def filenames(self): ... + @property + def extensions(self): ... + def to_tree(self): ... + def __contains__(self, content_type): ... + def find(self, content_type): ... + def findall(self, content_type) -> Generator[Any, None, None]: ... + def append(self, obj) -> None: ... diff --git a/stubs/openpyxl/openpyxl/packaging/relationship.pyi b/stubs/openpyxl/openpyxl/packaging/relationship.pyi new file mode 100644 index 0000000..437c1e2 --- /dev/null +++ b/stubs/openpyxl/openpyxl/packaging/relationship.pyi @@ -0,0 +1,36 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Relationship(Serialisable): + tagname: str + Type: Any + Target: Any + target: Any + TargetMode: Any + Id: Any + id: Any + def __init__( + self, + Id: Any | None = ..., + Type: Any | None = ..., + type: Any | None = ..., + Target: Any | None = ..., + TargetMode: Any | None = ..., + ) -> None: ... + +class RelationshipList(Serialisable): + tagname: str + Relationship: Any + def __init__(self, Relationship=...) -> None: ... + def append(self, value) -> None: ... + def __len__(self): ... + def __bool__(self): ... + def find(self, content_type) -> Generator[Any, None, None]: ... + def __getitem__(self, key): ... + def to_tree(self): ... + +def get_rels_path(path): ... +def get_dependents(archive, filename): ... +def get_rel(archive, deps, id: Any | None = ..., cls: Any | None = ...): ... diff --git a/stubs/openpyxl/openpyxl/packaging/workbook.pyi b/stubs/openpyxl/openpyxl/packaging/workbook.pyi new file mode 100644 index 0000000..d095602 --- /dev/null +++ b/stubs/openpyxl/openpyxl/packaging/workbook.pyi @@ -0,0 +1,86 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class FileRecoveryProperties(Serialisable): + tagname: str + autoRecover: Any + crashSave: Any + dataExtractLoad: Any + repairLoad: Any + def __init__( + self, + autoRecover: Any | None = ..., + crashSave: Any | None = ..., + dataExtractLoad: Any | None = ..., + repairLoad: Any | None = ..., + ) -> None: ... + +class ChildSheet(Serialisable): + tagname: str + name: Any + sheetId: Any + state: Any + id: Any + def __init__(self, name: Any | None = ..., sheetId: Any | None = ..., state: str = ..., id: Any | None = ...) -> None: ... + +class PivotCache(Serialisable): + tagname: str + cacheId: Any + id: Any + def __init__(self, cacheId: Any | None = ..., id: Any | None = ...) -> None: ... + +class WorkbookPackage(Serialisable): + tagname: str + conformance: Any + fileVersion: Any + fileSharing: Any + workbookPr: Any + properties: Any + workbookProtection: Any + bookViews: Any + sheets: Any + functionGroups: Any + externalReferences: Any + definedNames: Any + calcPr: Any + oleSize: Any + customWorkbookViews: Any + pivotCaches: Any + smartTagPr: Any + smartTagTypes: Any + webPublishing: Any + fileRecoveryPr: Any + webPublishObjects: Any + extLst: Any + Ignorable: Any + __elements__: Any + def __init__( + self, + conformance: Any | None = ..., + fileVersion: Any | None = ..., + fileSharing: Any | None = ..., + workbookPr: Any | None = ..., + workbookProtection: Any | None = ..., + bookViews=..., + sheets=..., + functionGroups: Any | None = ..., + externalReferences=..., + definedNames: Any | None = ..., + calcPr: Any | None = ..., + oleSize: Any | None = ..., + customWorkbookViews=..., + pivotCaches=..., + smartTagPr: Any | None = ..., + smartTagTypes: Any | None = ..., + webPublishing: Any | None = ..., + fileRecoveryPr: Any | None = ..., + webPublishObjects: Any | None = ..., + extLst: Any | None = ..., + Ignorable: Any | None = ..., + ) -> None: ... + def to_tree(self): ... + @property + def active(self): ... + @property + def pivot_caches(self): ... diff --git a/stubs/selenium/selenium/webdriver/ie/__init__.pyi b/stubs/openpyxl/openpyxl/pivot/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/ie/__init__.pyi rename to stubs/openpyxl/openpyxl/pivot/__init__.pyi diff --git a/stubs/openpyxl/openpyxl/pivot/cache.pyi b/stubs/openpyxl/openpyxl/pivot/cache.pyi new file mode 100644 index 0000000..080c29e --- /dev/null +++ b/stubs/openpyxl/openpyxl/pivot/cache.pyi @@ -0,0 +1,583 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class MeasureDimensionMap(Serialisable): + tagname: str + measureGroup: Any + dimension: Any + def __init__(self, measureGroup: Any | None = ..., dimension: Any | None = ...) -> None: ... + +class MeasureGroup(Serialisable): + tagname: str + name: Any + caption: Any + def __init__(self, name: Any | None = ..., caption: Any | None = ...) -> None: ... + +class PivotDimension(Serialisable): + tagname: str + measure: Any + name: Any + uniqueName: Any + caption: Any + def __init__( + self, measure: Any | None = ..., name: Any | None = ..., uniqueName: Any | None = ..., caption: Any | None = ... + ) -> None: ... + +class CalculatedMember(Serialisable): + tagname: str + name: Any + mdx: Any + memberName: Any + hierarchy: Any + parent: Any + solveOrder: Any + set: Any + extLst: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + mdx: Any | None = ..., + memberName: Any | None = ..., + hierarchy: Any | None = ..., + parent: Any | None = ..., + solveOrder: Any | None = ..., + set: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class CalculatedItem(Serialisable): + tagname: str + field: Any + formula: Any + pivotArea: Any + extLst: Any + __elements__: Any + def __init__( + self, field: Any | None = ..., formula: Any | None = ..., pivotArea: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class ServerFormat(Serialisable): + tagname: str + culture: Any + format: Any + def __init__(self, culture: Any | None = ..., format: Any | None = ...) -> None: ... + +class ServerFormatList(Serialisable): + tagname: str + serverFormat: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., serverFormat: Any | None = ...) -> None: ... + @property + def count(self): ... + +class Query(Serialisable): + tagname: str + mdx: Any + tpls: Any + __elements__: Any + def __init__(self, mdx: Any | None = ..., tpls: Any | None = ...) -> None: ... + +class QueryCache(Serialisable): + tagname: str + count: Any + query: Any + __elements__: Any + def __init__(self, count: Any | None = ..., query: Any | None = ...) -> None: ... + +class OLAPSet(Serialisable): + tagname: str + count: Any + maxRank: Any + setDefinition: Any + sortType: Any + queryFailed: Any + tpls: Any + sortByTuple: Any + __elements__: Any + def __init__( + self, + count: Any | None = ..., + maxRank: Any | None = ..., + setDefinition: Any | None = ..., + sortType: Any | None = ..., + queryFailed: Any | None = ..., + tpls: Any | None = ..., + sortByTuple: Any | None = ..., + ) -> None: ... + +class OLAPSets(Serialisable): # type: ignore[misc] + count: Any + set: Any + __elements__: Any + def __init__(self, count: Any | None = ..., set: Any | None = ...) -> None: ... + +class PCDSDTCEntries(Serialisable): + tagname: str + count: Any + m: Any + n: Any + e: Any + s: Any + __elements__: Any + def __init__( + self, count: Any | None = ..., m: Any | None = ..., n: Any | None = ..., e: Any | None = ..., s: Any | None = ... + ) -> None: ... + +class TupleCache(Serialisable): + tagname: str + entries: Any + sets: Any + queryCache: Any + serverFormats: Any + extLst: Any + __elements__: Any + def __init__( + self, + entries: Any | None = ..., + sets: Any | None = ..., + queryCache: Any | None = ..., + serverFormats: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class PCDKPI(Serialisable): + tagname: str + uniqueName: Any + caption: Any + displayFolder: Any + measureGroup: Any + parent: Any + value: Any + goal: Any + status: Any + trend: Any + weight: Any + time: Any + def __init__( + self, + uniqueName: Any | None = ..., + caption: Any | None = ..., + displayFolder: Any | None = ..., + measureGroup: Any | None = ..., + parent: Any | None = ..., + value: Any | None = ..., + goal: Any | None = ..., + status: Any | None = ..., + trend: Any | None = ..., + weight: Any | None = ..., + time: Any | None = ..., + ) -> None: ... + +class GroupMember(Serialisable): + tagname: str + uniqueName: Any + group: Any + def __init__(self, uniqueName: Any | None = ..., group: Any | None = ...) -> None: ... + +class GroupMembers(Serialisable): # type: ignore[misc] + count: Any + groupMember: Any + __elements__: Any + def __init__(self, count: Any | None = ..., groupMember: Any | None = ...) -> None: ... + +class LevelGroup(Serialisable): + tagname: str + name: Any + uniqueName: Any + caption: Any + uniqueParent: Any + id: Any + groupMembers: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + uniqueName: Any | None = ..., + caption: Any | None = ..., + uniqueParent: Any | None = ..., + id: Any | None = ..., + groupMembers: Any | None = ..., + ) -> None: ... + +class Groups(Serialisable): + tagname: str + count: Any + group: Any + __elements__: Any + def __init__(self, count: Any | None = ..., group: Any | None = ...) -> None: ... + +class GroupLevel(Serialisable): + tagname: str + uniqueName: Any + caption: Any + user: Any + customRollUp: Any + groups: Any + extLst: Any + __elements__: Any + def __init__( + self, + uniqueName: Any | None = ..., + caption: Any | None = ..., + user: Any | None = ..., + customRollUp: Any | None = ..., + groups: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class GroupLevels(Serialisable): # type: ignore[misc] + count: Any + groupLevel: Any + __elements__: Any + def __init__(self, count: Any | None = ..., groupLevel: Any | None = ...) -> None: ... + +class FieldUsage(Serialisable): + tagname: str + x: Any + def __init__(self, x: Any | None = ...) -> None: ... + +class FieldsUsage(Serialisable): # type: ignore[misc] + count: Any + fieldUsage: Any + __elements__: Any + def __init__(self, count: Any | None = ..., fieldUsage: Any | None = ...) -> None: ... + +class CacheHierarchy(Serialisable): + tagname: str + uniqueName: Any + caption: Any + measure: Any + set: Any + parentSet: Any + iconSet: Any + attribute: Any + time: Any + keyAttribute: Any + defaultMemberUniqueName: Any + allUniqueName: Any + allCaption: Any + dimensionUniqueName: Any + displayFolder: Any + measureGroup: Any + measures: Any + count: Any + oneField: Any + memberValueDatatype: Any + unbalanced: Any + unbalancedGroup: Any + hidden: Any + fieldsUsage: Any + groupLevels: Any + extLst: Any + __elements__: Any + def __init__( + self, + uniqueName: str = ..., + caption: Any | None = ..., + measure: Any | None = ..., + set: Any | None = ..., + parentSet: Any | None = ..., + iconSet: int = ..., + attribute: Any | None = ..., + time: Any | None = ..., + keyAttribute: Any | None = ..., + defaultMemberUniqueName: Any | None = ..., + allUniqueName: Any | None = ..., + allCaption: Any | None = ..., + dimensionUniqueName: Any | None = ..., + displayFolder: Any | None = ..., + measureGroup: Any | None = ..., + measures: Any | None = ..., + count: Any | None = ..., + oneField: Any | None = ..., + memberValueDatatype: Any | None = ..., + unbalanced: Any | None = ..., + unbalancedGroup: Any | None = ..., + hidden: Any | None = ..., + fieldsUsage: Any | None = ..., + groupLevels: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class GroupItems(Serialisable): + tagname: str + m: Any + n: Any + b: Any + e: Any + s: Any + d: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., m=..., n=..., b=..., e=..., s=..., d=...) -> None: ... + @property + def count(self): ... + +class DiscretePr(Serialisable): + tagname: str + count: Any + x: Any + __elements__: Any + def __init__(self, count: Any | None = ..., x: Any | None = ...) -> None: ... + +class RangePr(Serialisable): + tagname: str + autoStart: Any + autoEnd: Any + groupBy: Any + startNum: Any + endNum: Any + startDate: Any + endDate: Any + groupInterval: Any + def __init__( + self, + autoStart: bool = ..., + autoEnd: bool = ..., + groupBy: str = ..., + startNum: Any | None = ..., + endNum: Any | None = ..., + startDate: Any | None = ..., + endDate: Any | None = ..., + groupInterval: int = ..., + ) -> None: ... + +class FieldGroup(Serialisable): + tagname: str + par: Any + base: Any + rangePr: Any + discretePr: Any + groupItems: Any + __elements__: Any + def __init__( + self, + par: Any | None = ..., + base: Any | None = ..., + rangePr: Any | None = ..., + discretePr: Any | None = ..., + groupItems: Any | None = ..., + ) -> None: ... + +class SharedItems(Serialisable): + tagname: str + m: Any + n: Any + b: Any + e: Any + s: Any + d: Any + containsSemiMixedTypes: Any + containsNonDate: Any + containsDate: Any + containsString: Any + containsBlank: Any + containsMixedTypes: Any + containsNumber: Any + containsInteger: Any + minValue: Any + maxValue: Any + minDate: Any + maxDate: Any + longText: Any + __attrs__: Any + def __init__( + self, + _fields=..., + containsSemiMixedTypes: Any | None = ..., + containsNonDate: Any | None = ..., + containsDate: Any | None = ..., + containsString: Any | None = ..., + containsBlank: Any | None = ..., + containsMixedTypes: Any | None = ..., + containsNumber: Any | None = ..., + containsInteger: Any | None = ..., + minValue: Any | None = ..., + maxValue: Any | None = ..., + minDate: Any | None = ..., + maxDate: Any | None = ..., + count: Any | None = ..., + longText: Any | None = ..., + ) -> None: ... + @property + def count(self): ... + +class CacheField(Serialisable): + tagname: str + sharedItems: Any + fieldGroup: Any + mpMap: Any + extLst: Any + name: Any + caption: Any + propertyName: Any + serverField: Any + uniqueList: Any + numFmtId: Any + formula: Any + sqlType: Any + hierarchy: Any + level: Any + databaseField: Any + mappingCount: Any + memberPropertyField: Any + __elements__: Any + def __init__( + self, + sharedItems: Any | None = ..., + fieldGroup: Any | None = ..., + mpMap: Any | None = ..., + extLst: Any | None = ..., + name: Any | None = ..., + caption: Any | None = ..., + propertyName: Any | None = ..., + serverField: Any | None = ..., + uniqueList: bool = ..., + numFmtId: Any | None = ..., + formula: Any | None = ..., + sqlType: int = ..., + hierarchy: int = ..., + level: int = ..., + databaseField: bool = ..., + mappingCount: Any | None = ..., + memberPropertyField: Any | None = ..., + ) -> None: ... + +class RangeSet(Serialisable): + tagname: str + i1: Any + i2: Any + i3: Any + i4: Any + ref: Any + name: Any + sheet: Any + def __init__( + self, + i1: Any | None = ..., + i2: Any | None = ..., + i3: Any | None = ..., + i4: Any | None = ..., + ref: Any | None = ..., + name: Any | None = ..., + sheet: Any | None = ..., + ) -> None: ... + +class PageItem(Serialisable): + tagname: str + name: Any + def __init__(self, name: Any | None = ...) -> None: ... + +class Page(Serialisable): + tagname: str + pageItem: Any + __elements__: Any + def __init__(self, count: Any | None = ..., pageItem: Any | None = ...) -> None: ... + @property + def count(self): ... + +class Consolidation(Serialisable): + tagname: str + autoPage: Any + pages: Any + rangeSets: Any + __elements__: Any + def __init__(self, autoPage: Any | None = ..., pages=..., rangeSets=...) -> None: ... + +class WorksheetSource(Serialisable): + tagname: str + ref: Any + name: Any + sheet: Any + def __init__(self, ref: Any | None = ..., name: Any | None = ..., sheet: Any | None = ...) -> None: ... + +class CacheSource(Serialisable): + tagname: str + type: Any + connectionId: Any + worksheetSource: Any + consolidation: Any + extLst: Any + __elements__: Any + def __init__( + self, + type: Any | None = ..., + connectionId: Any | None = ..., + worksheetSource: Any | None = ..., + consolidation: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class CacheDefinition(Serialisable): + mime_type: str + rel_type: str + records: Any + tagname: str + invalid: Any + saveData: Any + refreshOnLoad: Any + optimizeMemory: Any + enableRefresh: Any + refreshedBy: Any + refreshedDate: Any + refreshedDateIso: Any + backgroundQuery: Any + missingItemsLimit: Any + createdVersion: Any + refreshedVersion: Any + minRefreshableVersion: Any + recordCount: Any + upgradeOnRefresh: Any + tupleCache: Any + supportSubquery: Any + supportAdvancedDrill: Any + cacheSource: Any + cacheFields: Any + cacheHierarchies: Any + kpis: Any + calculatedItems: Any + calculatedMembers: Any + dimensions: Any + measureGroups: Any + maps: Any + extLst: Any + id: Any + __elements__: Any + def __init__( + self, + invalid: Any | None = ..., + saveData: Any | None = ..., + refreshOnLoad: Any | None = ..., + optimizeMemory: Any | None = ..., + enableRefresh: Any | None = ..., + refreshedBy: Any | None = ..., + refreshedDate: Any | None = ..., + refreshedDateIso: Any | None = ..., + backgroundQuery: Any | None = ..., + missingItemsLimit: Any | None = ..., + createdVersion: Any | None = ..., + refreshedVersion: Any | None = ..., + minRefreshableVersion: Any | None = ..., + recordCount: Any | None = ..., + upgradeOnRefresh: Any | None = ..., + tupleCache: Any | None = ..., + supportSubquery: Any | None = ..., + supportAdvancedDrill: Any | None = ..., + cacheSource: Any | None = ..., + cacheFields=..., + cacheHierarchies=..., + kpis=..., + calculatedItems=..., + calculatedMembers=..., + dimensions=..., + measureGroups=..., + maps=..., + extLst: Any | None = ..., + id: Any | None = ..., + ) -> None: ... + def to_tree(self): ... + @property + def path(self): ... diff --git a/stubs/openpyxl/openpyxl/pivot/fields.pyi b/stubs/openpyxl/openpyxl/pivot/fields.pyi new file mode 100644 index 0000000..a2e29fc --- /dev/null +++ b/stubs/openpyxl/openpyxl/pivot/fields.pyi @@ -0,0 +1,180 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Index(Serialisable): + tagname: str + v: Any + def __init__(self, v: int = ...) -> None: ... + +class Tuple(Serialisable): # type: ignore[misc] + fld: Any + hier: Any + item: Any + def __init__(self, fld: Any | None = ..., hier: Any | None = ..., item: Any | None = ...) -> None: ... + +class TupleList(Serialisable): # type: ignore[misc] + c: Any + tpl: Any + __elements__: Any + def __init__(self, c: Any | None = ..., tpl: Any | None = ...) -> None: ... + +class Missing(Serialisable): + tagname: str + tpls: Any + x: Any + u: Any + f: Any + c: Any + cp: Any + bc: Any + fc: Any + i: Any + un: Any + st: Any + b: Any + __elements__: Any + def __init__( + self, + tpls=..., + x=..., + u: Any | None = ..., + f: Any | None = ..., + c: Any | None = ..., + cp: Any | None = ..., + _in: Any | None = ..., + bc: Any | None = ..., + fc: Any | None = ..., + i: Any | None = ..., + un: Any | None = ..., + st: Any | None = ..., + b: Any | None = ..., + ) -> None: ... + +class Number(Serialisable): + tagname: str + tpls: Any + x: Any + v: Any + u: Any + f: Any + c: Any + cp: Any + bc: Any + fc: Any + i: Any + un: Any + st: Any + b: Any + __elements__: Any + def __init__( + self, + tpls=..., + x=..., + v: Any | None = ..., + u: Any | None = ..., + f: Any | None = ..., + c: Any | None = ..., + cp: Any | None = ..., + _in: Any | None = ..., + bc: Any | None = ..., + fc: Any | None = ..., + i: Any | None = ..., + un: Any | None = ..., + st: Any | None = ..., + b: Any | None = ..., + ) -> None: ... + +class Error(Serialisable): + tagname: str + tpls: Any + x: Any + v: Any + u: Any + f: Any + c: Any + cp: Any + bc: Any + fc: Any + i: Any + un: Any + st: Any + b: Any + __elements__: Any + def __init__( + self, + tpls: Any | None = ..., + x=..., + v: Any | None = ..., + u: Any | None = ..., + f: Any | None = ..., + c: Any | None = ..., + cp: Any | None = ..., + _in: Any | None = ..., + bc: Any | None = ..., + fc: Any | None = ..., + i: Any | None = ..., + un: Any | None = ..., + st: Any | None = ..., + b: Any | None = ..., + ) -> None: ... + +class Boolean(Serialisable): + tagname: str + x: Any + v: Any + u: Any + f: Any + c: Any + cp: Any + __elements__: Any + def __init__( + self, x=..., v: Any | None = ..., u: Any | None = ..., f: Any | None = ..., c: Any | None = ..., cp: Any | None = ... + ) -> None: ... + +class Text(Serialisable): + tagname: str + tpls: Any + x: Any + v: Any + u: Any + f: Any + c: Any + cp: Any + bc: Any + fc: Any + i: Any + un: Any + st: Any + b: Any + __elements__: Any + def __init__( + self, + tpls=..., + x=..., + v: Any | None = ..., + u: Any | None = ..., + f: Any | None = ..., + c: Any | None = ..., + cp: Any | None = ..., + _in: Any | None = ..., + bc: Any | None = ..., + fc: Any | None = ..., + i: Any | None = ..., + un: Any | None = ..., + st: Any | None = ..., + b: Any | None = ..., + ) -> None: ... + +class DateTimeField(Serialisable): + tagname: str + x: Any + v: Any + u: Any + f: Any + c: Any + cp: Any + __elements__: Any + def __init__( + self, x=..., v: Any | None = ..., u: Any | None = ..., f: Any | None = ..., c: Any | None = ..., cp: Any | None = ... + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/pivot/record.pyi b/stubs/openpyxl/openpyxl/pivot/record.pyi new file mode 100644 index 0000000..a10544c --- /dev/null +++ b/stubs/openpyxl/openpyxl/pivot/record.pyi @@ -0,0 +1,39 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Record(Serialisable): + tagname: str + m: Any + n: Any + b: Any + e: Any + s: Any + d: Any + x: Any + def __init__( + self, + _fields=..., + m: Any | None = ..., + n: Any | None = ..., + b: Any | None = ..., + e: Any | None = ..., + s: Any | None = ..., + d: Any | None = ..., + x: Any | None = ..., + ) -> None: ... + +class RecordList(Serialisable): + mime_type: str + rel_type: str + tagname: str + r: Any + extLst: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., r=..., extLst: Any | None = ...) -> None: ... + @property + def count(self): ... + def to_tree(self): ... + @property + def path(self): ... diff --git a/stubs/openpyxl/openpyxl/pivot/table.pyi b/stubs/openpyxl/openpyxl/pivot/table.pyi new file mode 100644 index 0000000..93d313c --- /dev/null +++ b/stubs/openpyxl/openpyxl/pivot/table.pyi @@ -0,0 +1,672 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class HierarchyUsage(Serialisable): + tagname: str + hierarchyUsage: Any + def __init__(self, hierarchyUsage: Any | None = ...) -> None: ... + +class ColHierarchiesUsage(Serialisable): + tagname: str + colHierarchyUsage: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., colHierarchyUsage=...) -> None: ... + @property + def count(self): ... + +class RowHierarchiesUsage(Serialisable): + tagname: str + rowHierarchyUsage: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., rowHierarchyUsage=...) -> None: ... + @property + def count(self): ... + +class PivotFilter(Serialisable): + tagname: str + fld: Any + mpFld: Any + type: Any + evalOrder: Any + id: Any + iMeasureHier: Any + iMeasureFld: Any + name: Any + description: Any + stringValue1: Any + stringValue2: Any + autoFilter: Any + extLst: Any + __elements__: Any + def __init__( + self, + fld: Any | None = ..., + mpFld: Any | None = ..., + type: Any | None = ..., + evalOrder: Any | None = ..., + id: Any | None = ..., + iMeasureHier: Any | None = ..., + iMeasureFld: Any | None = ..., + name: Any | None = ..., + description: Any | None = ..., + stringValue1: Any | None = ..., + stringValue2: Any | None = ..., + autoFilter: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class PivotFilters(Serialisable): # type: ignore[misc] + count: Any + filter: Any + __elements__: Any + def __init__(self, count: Any | None = ..., filter: Any | None = ...) -> None: ... + +class PivotTableStyle(Serialisable): + tagname: str + name: Any + showRowHeaders: Any + showColHeaders: Any + showRowStripes: Any + showColStripes: Any + showLastColumn: Any + def __init__( + self, + name: Any | None = ..., + showRowHeaders: Any | None = ..., + showColHeaders: Any | None = ..., + showRowStripes: Any | None = ..., + showColStripes: Any | None = ..., + showLastColumn: Any | None = ..., + ) -> None: ... + +class MemberList(Serialisable): + tagname: str + level: Any + member: Any + __elements__: Any + def __init__(self, count: Any | None = ..., level: Any | None = ..., member=...) -> None: ... + @property + def count(self): ... + +class MemberProperty(Serialisable): + tagname: str + name: Any + showCell: Any + showTip: Any + showAsCaption: Any + nameLen: Any + pPos: Any + pLen: Any + level: Any + field: Any + def __init__( + self, + name: Any | None = ..., + showCell: Any | None = ..., + showTip: Any | None = ..., + showAsCaption: Any | None = ..., + nameLen: Any | None = ..., + pPos: Any | None = ..., + pLen: Any | None = ..., + level: Any | None = ..., + field: Any | None = ..., + ) -> None: ... + +class PivotHierarchy(Serialisable): + tagname: str + outline: Any + multipleItemSelectionAllowed: Any + subtotalTop: Any + showInFieldList: Any + dragToRow: Any + dragToCol: Any + dragToPage: Any + dragToData: Any + dragOff: Any + includeNewItemsInFilter: Any + caption: Any + mps: Any + members: Any + extLst: Any + __elements__: Any + def __init__( + self, + outline: Any | None = ..., + multipleItemSelectionAllowed: Any | None = ..., + subtotalTop: Any | None = ..., + showInFieldList: Any | None = ..., + dragToRow: Any | None = ..., + dragToCol: Any | None = ..., + dragToPage: Any | None = ..., + dragToData: Any | None = ..., + dragOff: Any | None = ..., + includeNewItemsInFilter: Any | None = ..., + caption: Any | None = ..., + mps=..., + members: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Reference(Serialisable): + tagname: str + field: Any + selected: Any + byPosition: Any + relative: Any + defaultSubtotal: Any + sumSubtotal: Any + countASubtotal: Any + avgSubtotal: Any + maxSubtotal: Any + minSubtotal: Any + productSubtotal: Any + countSubtotal: Any + stdDevSubtotal: Any + stdDevPSubtotal: Any + varSubtotal: Any + varPSubtotal: Any + x: Any + extLst: Any + __elements__: Any + def __init__( + self, + field: Any | None = ..., + count: Any | None = ..., + selected: Any | None = ..., + byPosition: Any | None = ..., + relative: Any | None = ..., + defaultSubtotal: Any | None = ..., + sumSubtotal: Any | None = ..., + countASubtotal: Any | None = ..., + avgSubtotal: Any | None = ..., + maxSubtotal: Any | None = ..., + minSubtotal: Any | None = ..., + productSubtotal: Any | None = ..., + countSubtotal: Any | None = ..., + stdDevSubtotal: Any | None = ..., + stdDevPSubtotal: Any | None = ..., + varSubtotal: Any | None = ..., + varPSubtotal: Any | None = ..., + x: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + @property + def count(self): ... + +class PivotArea(Serialisable): + tagname: str + references: Any + extLst: Any + field: Any + type: Any + dataOnly: Any + labelOnly: Any + grandRow: Any + grandCol: Any + cacheIndex: Any + outline: Any + offset: Any + collapsedLevelsAreSubtotals: Any + axis: Any + fieldPosition: Any + __elements__: Any + def __init__( + self, + references=..., + extLst: Any | None = ..., + field: Any | None = ..., + type: str = ..., + dataOnly: bool = ..., + labelOnly: Any | None = ..., + grandRow: Any | None = ..., + grandCol: Any | None = ..., + cacheIndex: Any | None = ..., + outline: bool = ..., + offset: Any | None = ..., + collapsedLevelsAreSubtotals: Any | None = ..., + axis: Any | None = ..., + fieldPosition: Any | None = ..., + ) -> None: ... + +class ChartFormat(Serialisable): + tagname: str + chart: Any + format: Any + series: Any + pivotArea: Any + __elements__: Any + def __init__( + self, chart: Any | None = ..., format: Any | None = ..., series: Any | None = ..., pivotArea: Any | None = ... + ) -> None: ... + +class ConditionalFormat(Serialisable): + tagname: str + scope: Any + type: Any + priority: Any + pivotAreas: Any + extLst: Any + __elements__: Any + def __init__( + self, + scope: Any | None = ..., + type: Any | None = ..., + priority: Any | None = ..., + pivotAreas=..., + extLst: Any | None = ..., + ) -> None: ... + +class Format(Serialisable): + tagname: str + action: Any + dxfId: Any + pivotArea: Any + extLst: Any + __elements__: Any + def __init__( + self, action: str = ..., dxfId: Any | None = ..., pivotArea: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + +class DataField(Serialisable): + tagname: str + name: Any + fld: Any + subtotal: Any + showDataAs: Any + baseField: Any + baseItem: Any + numFmtId: Any + extLst: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + fld: Any | None = ..., + subtotal: str = ..., + showDataAs: str = ..., + baseField: int = ..., + baseItem: int = ..., + numFmtId: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class PageField(Serialisable): + tagname: str + fld: Any + item: Any + hier: Any + name: Any + cap: Any + extLst: Any + __elements__: Any + def __init__( + self, + fld: Any | None = ..., + item: Any | None = ..., + hier: Any | None = ..., + name: Any | None = ..., + cap: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class RowColItem(Serialisable): + tagname: str + t: Any + r: Any + i: Any + x: Any + __elements__: Any + def __init__(self, t: str = ..., r: int = ..., i: int = ..., x=...) -> None: ... + +class RowColField(Serialisable): + tagname: str + x: Any + def __init__(self, x: Any | None = ...) -> None: ... + +class AutoSortScope(Serialisable): # type: ignore[misc] + pivotArea: Any + __elements__: Any + def __init__(self, pivotArea: Any | None = ...) -> None: ... + +class FieldItem(Serialisable): + tagname: str + n: Any + t: Any + h: Any + s: Any + sd: Any + f: Any + m: Any + c: Any + x: Any + d: Any + e: Any + def __init__( + self, + n: Any | None = ..., + t: str = ..., + h: Any | None = ..., + s: Any | None = ..., + sd: bool = ..., + f: Any | None = ..., + m: Any | None = ..., + c: Any | None = ..., + x: Any | None = ..., + d: Any | None = ..., + e: Any | None = ..., + ) -> None: ... + +class PivotField(Serialisable): + tagname: str + items: Any + autoSortScope: Any + extLst: Any + name: Any + axis: Any + dataField: Any + subtotalCaption: Any + showDropDowns: Any + hiddenLevel: Any + uniqueMemberProperty: Any + compact: Any + allDrilled: Any + numFmtId: Any + outline: Any + subtotalTop: Any + dragToRow: Any + dragToCol: Any + multipleItemSelectionAllowed: Any + dragToPage: Any + dragToData: Any + dragOff: Any + showAll: Any + insertBlankRow: Any + serverField: Any + insertPageBreak: Any + autoShow: Any + topAutoShow: Any + hideNewItems: Any + measureFilter: Any + includeNewItemsInFilter: Any + itemPageCount: Any + sortType: Any + dataSourceSort: Any + nonAutoSortDefault: Any + rankBy: Any + defaultSubtotal: Any + sumSubtotal: Any + countASubtotal: Any + avgSubtotal: Any + maxSubtotal: Any + minSubtotal: Any + productSubtotal: Any + countSubtotal: Any + stdDevSubtotal: Any + stdDevPSubtotal: Any + varSubtotal: Any + varPSubtotal: Any + showPropCell: Any + showPropTip: Any + showPropAsCaption: Any + defaultAttributeDrillState: Any + __elements__: Any + def __init__( + self, + items=..., + autoSortScope: Any | None = ..., + name: Any | None = ..., + axis: Any | None = ..., + dataField: Any | None = ..., + subtotalCaption: Any | None = ..., + showDropDowns: bool = ..., + hiddenLevel: Any | None = ..., + uniqueMemberProperty: Any | None = ..., + compact: bool = ..., + allDrilled: Any | None = ..., + numFmtId: Any | None = ..., + outline: bool = ..., + subtotalTop: bool = ..., + dragToRow: bool = ..., + dragToCol: bool = ..., + multipleItemSelectionAllowed: Any | None = ..., + dragToPage: bool = ..., + dragToData: bool = ..., + dragOff: bool = ..., + showAll: bool = ..., + insertBlankRow: Any | None = ..., + serverField: Any | None = ..., + insertPageBreak: Any | None = ..., + autoShow: Any | None = ..., + topAutoShow: bool = ..., + hideNewItems: Any | None = ..., + measureFilter: Any | None = ..., + includeNewItemsInFilter: Any | None = ..., + itemPageCount: int = ..., + sortType: str = ..., + dataSourceSort: Any | None = ..., + nonAutoSortDefault: Any | None = ..., + rankBy: Any | None = ..., + defaultSubtotal: bool = ..., + sumSubtotal: Any | None = ..., + countASubtotal: Any | None = ..., + avgSubtotal: Any | None = ..., + maxSubtotal: Any | None = ..., + minSubtotal: Any | None = ..., + productSubtotal: Any | None = ..., + countSubtotal: Any | None = ..., + stdDevSubtotal: Any | None = ..., + stdDevPSubtotal: Any | None = ..., + varSubtotal: Any | None = ..., + varPSubtotal: Any | None = ..., + showPropCell: Any | None = ..., + showPropTip: Any | None = ..., + showPropAsCaption: Any | None = ..., + defaultAttributeDrillState: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class Location(Serialisable): + tagname: str + ref: Any + firstHeaderRow: Any + firstDataRow: Any + firstDataCol: Any + rowPageCount: Any + colPageCount: Any + def __init__( + self, + ref: Any | None = ..., + firstHeaderRow: Any | None = ..., + firstDataRow: Any | None = ..., + firstDataCol: Any | None = ..., + rowPageCount: Any | None = ..., + colPageCount: Any | None = ..., + ) -> None: ... + +class TableDefinition(Serialisable): + mime_type: str + rel_type: str + tagname: str + cache: Any + name: Any + cacheId: Any + dataOnRows: Any + dataPosition: Any + dataCaption: Any + grandTotalCaption: Any + errorCaption: Any + showError: Any + missingCaption: Any + showMissing: Any + pageStyle: Any + pivotTableStyle: Any + vacatedStyle: Any + tag: Any + updatedVersion: Any + minRefreshableVersion: Any + asteriskTotals: Any + showItems: Any + editData: Any + disableFieldList: Any + showCalcMbrs: Any + visualTotals: Any + showMultipleLabel: Any + showDataDropDown: Any + showDrill: Any + printDrill: Any + showMemberPropertyTips: Any + showDataTips: Any + enableWizard: Any + enableDrill: Any + enableFieldProperties: Any + preserveFormatting: Any + useAutoFormatting: Any + pageWrap: Any + pageOverThenDown: Any + subtotalHiddenItems: Any + rowGrandTotals: Any + colGrandTotals: Any + fieldPrintTitles: Any + itemPrintTitles: Any + mergeItem: Any + showDropZones: Any + createdVersion: Any + indent: Any + showEmptyRow: Any + showEmptyCol: Any + showHeaders: Any + compact: Any + outline: Any + outlineData: Any + compactData: Any + published: Any + gridDropZones: Any + immersive: Any + multipleFieldFilters: Any + chartFormat: Any + rowHeaderCaption: Any + colHeaderCaption: Any + fieldListSortAscending: Any + mdxSubqueries: Any + customListSort: Any + autoFormatId: Any + applyNumberFormats: Any + applyBorderFormats: Any + applyFontFormats: Any + applyPatternFormats: Any + applyAlignmentFormats: Any + applyWidthHeightFormats: Any + location: Any + pivotFields: Any + rowFields: Any + rowItems: Any + colFields: Any + colItems: Any + pageFields: Any + dataFields: Any + formats: Any + conditionalFormats: Any + chartFormats: Any + pivotHierarchies: Any + pivotTableStyleInfo: Any + filters: Any + rowHierarchiesUsage: Any + colHierarchiesUsage: Any + extLst: Any + id: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + cacheId: Any | None = ..., + dataOnRows: bool = ..., + dataPosition: Any | None = ..., + dataCaption: Any | None = ..., + grandTotalCaption: Any | None = ..., + errorCaption: Any | None = ..., + showError: bool = ..., + missingCaption: Any | None = ..., + showMissing: bool = ..., + pageStyle: Any | None = ..., + pivotTableStyle: Any | None = ..., + vacatedStyle: Any | None = ..., + tag: Any | None = ..., + updatedVersion: int = ..., + minRefreshableVersion: int = ..., + asteriskTotals: bool = ..., + showItems: bool = ..., + editData: bool = ..., + disableFieldList: bool = ..., + showCalcMbrs: bool = ..., + visualTotals: bool = ..., + showMultipleLabel: bool = ..., + showDataDropDown: bool = ..., + showDrill: bool = ..., + printDrill: bool = ..., + showMemberPropertyTips: bool = ..., + showDataTips: bool = ..., + enableWizard: bool = ..., + enableDrill: bool = ..., + enableFieldProperties: bool = ..., + preserveFormatting: bool = ..., + useAutoFormatting: bool = ..., + pageWrap: int = ..., + pageOverThenDown: bool = ..., + subtotalHiddenItems: bool = ..., + rowGrandTotals: bool = ..., + colGrandTotals: bool = ..., + fieldPrintTitles: bool = ..., + itemPrintTitles: bool = ..., + mergeItem: bool = ..., + showDropZones: bool = ..., + createdVersion: int = ..., + indent: int = ..., + showEmptyRow: bool = ..., + showEmptyCol: bool = ..., + showHeaders: bool = ..., + compact: bool = ..., + outline: bool = ..., + outlineData: bool = ..., + compactData: bool = ..., + published: bool = ..., + gridDropZones: bool = ..., + immersive: bool = ..., + multipleFieldFilters: Any | None = ..., + chartFormat: int = ..., + rowHeaderCaption: Any | None = ..., + colHeaderCaption: Any | None = ..., + fieldListSortAscending: Any | None = ..., + mdxSubqueries: Any | None = ..., + customListSort: Any | None = ..., + autoFormatId: Any | None = ..., + applyNumberFormats: bool = ..., + applyBorderFormats: bool = ..., + applyFontFormats: bool = ..., + applyPatternFormats: bool = ..., + applyAlignmentFormats: bool = ..., + applyWidthHeightFormats: bool = ..., + location: Any | None = ..., + pivotFields=..., + rowFields=..., + rowItems=..., + colFields=..., + colItems=..., + pageFields=..., + dataFields=..., + formats=..., + conditionalFormats=..., + chartFormats=..., + pivotHierarchies=..., + pivotTableStyleInfo: Any | None = ..., + filters=..., + rowHierarchiesUsage: Any | None = ..., + colHierarchiesUsage: Any | None = ..., + extLst: Any | None = ..., + id: Any | None = ..., + ) -> None: ... + def to_tree(self): ... + @property + def path(self): ... diff --git a/stubs/selenium/selenium/webdriver/opera/__init__.pyi b/stubs/openpyxl/openpyxl/reader/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/opera/__init__.pyi rename to stubs/openpyxl/openpyxl/reader/__init__.pyi diff --git a/stubs/openpyxl/openpyxl/reader/drawings.pyi b/stubs/openpyxl/openpyxl/reader/drawings.pyi new file mode 100644 index 0000000..4334877 --- /dev/null +++ b/stubs/openpyxl/openpyxl/reader/drawings.pyi @@ -0,0 +1 @@ +def find_images(archive, path): ... diff --git a/stubs/openpyxl/openpyxl/reader/excel.pyi b/stubs/openpyxl/openpyxl/reader/excel.pyi new file mode 100644 index 0000000..c70d2e8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/reader/excel.pyi @@ -0,0 +1,26 @@ +from typing import Any + +SUPPORTED_FORMATS: Any + +class ExcelReader: + archive: Any + valid_files: Any + read_only: Any + keep_vba: Any + data_only: Any + keep_links: Any + shared_strings: Any + def __init__(self, fn, read_only: bool = ..., keep_vba=..., data_only: bool = ..., keep_links: bool = ...) -> None: ... + package: Any + def read_manifest(self) -> None: ... + def read_strings(self) -> None: ... + parser: Any + wb: Any + def read_workbook(self) -> None: ... + def read_properties(self) -> None: ... + def read_theme(self) -> None: ... + def read_chartsheet(self, sheet, rel) -> None: ... + def read_worksheets(self) -> None: ... + def read(self) -> None: ... + +def load_workbook(filename, read_only: bool = ..., keep_vba=..., data_only: bool = ..., keep_links: bool = ...): ... diff --git a/stubs/openpyxl/openpyxl/reader/strings.pyi b/stubs/openpyxl/openpyxl/reader/strings.pyi new file mode 100644 index 0000000..932a8b6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/reader/strings.pyi @@ -0,0 +1 @@ +def read_string_table(xml_source): ... diff --git a/stubs/openpyxl/openpyxl/reader/workbook.pyi b/stubs/openpyxl/openpyxl/reader/workbook.pyi new file mode 100644 index 0000000..4b1bde6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/reader/workbook.pyi @@ -0,0 +1,18 @@ +from collections.abc import Generator +from typing import Any + +class WorkbookParser: + archive: Any + workbook_part_name: Any + wb: Any + keep_links: Any + sheets: Any + def __init__(self, archive, workbook_part_name, keep_links: bool = ...) -> None: ... + @property + def rels(self): ... + caches: Any + def parse(self) -> None: ... + def find_sheets(self) -> Generator[Any, None, None]: ... + def assign_names(self) -> None: ... + @property + def pivot_caches(self): ... diff --git a/stubs/openpyxl/openpyxl/styles/__init__.pyi b/stubs/openpyxl/openpyxl/styles/__init__.pyi new file mode 100644 index 0000000..946d3a3 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/__init__.pyi @@ -0,0 +1,8 @@ +from .alignment import Alignment as Alignment +from .borders import Border as Border, Side as Side +from .colors import Color as Color +from .fills import Fill as Fill, GradientFill as GradientFill, PatternFill as PatternFill +from .fonts import DEFAULT_FONT as DEFAULT_FONT, Font as Font +from .named_styles import NamedStyle as NamedStyle +from .numbers import NumberFormatDescriptor as NumberFormatDescriptor, is_builtin as is_builtin, is_date_format as is_date_format +from .protection import Protection as Protection diff --git a/stubs/openpyxl/openpyxl/styles/alignment.pyi b/stubs/openpyxl/openpyxl/styles/alignment.pyi new file mode 100644 index 0000000..adcc6ae --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/alignment.pyi @@ -0,0 +1,39 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +horizontal_alignments: Any +vertical_aligments: Any + +class Alignment(Serialisable): + tagname: str + __fields__: Any + horizontal: Any + vertical: Any + textRotation: Any + text_rotation: Any + wrapText: Any + wrap_text: Any + shrinkToFit: Any + shrink_to_fit: Any + indent: Any + relativeIndent: Any + justifyLastLine: Any + readingOrder: Any + def __init__( + self, + horizontal: Any | None = ..., + vertical: Any | None = ..., + textRotation: int = ..., + wrapText: Any | None = ..., + shrinkToFit: Any | None = ..., + indent: int = ..., + relativeIndent: int = ..., + justifyLastLine: Any | None = ..., + readingOrder: int = ..., + text_rotation: Any | None = ..., + wrap_text: Any | None = ..., + shrink_to_fit: Any | None = ..., + mergeCell: Any | None = ..., + ) -> None: ... + def __iter__(self): ... diff --git a/stubs/openpyxl/openpyxl/styles/borders.pyi b/stubs/openpyxl/openpyxl/styles/borders.pyi new file mode 100644 index 0000000..d5d36e3 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/borders.pyi @@ -0,0 +1,62 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +BORDER_NONE: Any +BORDER_DASHDOT: str +BORDER_DASHDOTDOT: str +BORDER_DASHED: str +BORDER_DOTTED: str +BORDER_DOUBLE: str +BORDER_HAIR: str +BORDER_MEDIUM: str +BORDER_MEDIUMDASHDOT: str +BORDER_MEDIUMDASHDOTDOT: str +BORDER_MEDIUMDASHED: str +BORDER_SLANTDASHDOT: str +BORDER_THICK: str +BORDER_THIN: str + +class Side(Serialisable): # type: ignore[misc] + __fields__: Any + color: Any + style: Any + border_style: Any + def __init__(self, style: Any | None = ..., color: Any | None = ..., border_style: Any | None = ...) -> None: ... + +class Border(Serialisable): + tagname: str + __fields__: Any + __elements__: Any + start: Any + end: Any + left: Any + right: Any + top: Any + bottom: Any + diagonal: Any + vertical: Any + horizontal: Any + outline: Any + diagonalUp: Any + diagonalDown: Any + diagonal_direction: Any + def __init__( + self, + left: Any | None = ..., + right: Any | None = ..., + top: Any | None = ..., + bottom: Any | None = ..., + diagonal: Any | None = ..., + diagonal_direction: Any | None = ..., + vertical: Any | None = ..., + horizontal: Any | None = ..., + diagonalUp: bool = ..., + diagonalDown: bool = ..., + outline: bool = ..., + start: Any | None = ..., + end: Any | None = ..., + ) -> None: ... + def __iter__(self): ... + +DEFAULT_BORDER: Any diff --git a/stubs/openpyxl/openpyxl/styles/builtins.pyi b/stubs/openpyxl/openpyxl/styles/builtins.pyi new file mode 100644 index 0000000..9253fb7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/builtins.pyi @@ -0,0 +1,53 @@ +from typing import Any + +normal: str +comma: str +comma_0: str +currency: str +currency_0: str +percent: str +hyperlink: str +followed_hyperlink: str +title: str +headline_1: str +headline_2: str +headline_3: str +headline_4: str +good: str +bad: str +neutral: str +input: str +output: str +calculation: str +linked_cell: str +check_cell: str +warning: str +note: str +explanatory: str +total: str +accent_1: str +accent_1_20: str +accent_1_40: str +accent_1_60: str +accent_2: str +accent_2_20: str +accent_2_40: str +accent_2_60: str +accent_3: str +accent_3_20: str +accent_3_40: str +accent_3_60: str +accent_4: str +accent_4_20: str +accent_4_40: str +accent_4_60: str +accent_5: str +accent_5_20: str +accent_5_40: str +accent_5_60: str +accent_6: str +accent_6_20: str +accent_6_40: str +accent_6_60: str +pandas_highlight: str +styles: Any diff --git a/stubs/openpyxl/openpyxl/styles/cell_style.pyi b/stubs/openpyxl/openpyxl/styles/cell_style.pyi new file mode 100644 index 0000000..b44a750 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/cell_style.pyi @@ -0,0 +1,88 @@ +from array import array +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ArrayDescriptor: + key: Any + def __init__(self, key) -> None: ... + def __get__(self, instance, cls): ... + def __set__(self, instance, value) -> None: ... + +class StyleArray(array[Any]): + tagname: str + fontId: Any + fillId: Any + borderId: Any + numFmtId: Any + protectionId: Any + alignmentId: Any + pivotButton: Any + quotePrefix: Any + xfId: Any + def __new__(cls, args=...): ... + def __hash__(self): ... + def __copy__(self): ... + def __deepcopy__(self, memo): ... + +class CellStyle(Serialisable): + tagname: str + numFmtId: Any + fontId: Any + fillId: Any + borderId: Any + xfId: Any + quotePrefix: Any + pivotButton: Any + applyNumberFormat: Any + applyFont: Any + applyFill: Any + applyBorder: Any + # Overwritten by properties below + # applyAlignment: Bool + # applyProtection: Bool + alignment: Any + protection: Any + extLst: Any + __elements__: Any + __attrs__: Any + def __init__( + self, + numFmtId: int = ..., + fontId: int = ..., + fillId: int = ..., + borderId: int = ..., + xfId: Any | None = ..., + quotePrefix: Any | None = ..., + pivotButton: Any | None = ..., + applyNumberFormat: Any | None = ..., + applyFont: Any | None = ..., + applyFill: Any | None = ..., + applyBorder: Any | None = ..., + applyAlignment: Any | None = ..., + applyProtection: Any | None = ..., + alignment: Any | None = ..., + protection: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + def to_array(self): ... + @classmethod + def from_array(cls, style): ... + @property + def applyProtection(self): ... + @property + def applyAlignment(self): ... + +class CellStyleList(Serialisable): + tagname: str + __attrs__: Any + # Overwritten by property below + # count: Integer + xf: Any + alignment: Any + protection: Any + __elements__: Any + def __init__(self, count: Any | None = ..., xf=...) -> None: ... + @property + def count(self): ... + def __getitem__(self, idx): ... diff --git a/stubs/openpyxl/openpyxl/styles/colors.pyi b/stubs/openpyxl/openpyxl/styles/colors.pyi new file mode 100644 index 0000000..3f311d4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/colors.pyi @@ -0,0 +1,60 @@ +from typing import Any + +from openpyxl.descriptors import Typed +from openpyxl.descriptors.serialisable import Serialisable + +COLOR_INDEX: Any +BLACK: Any +WHITE: Any +BLUE: Any +aRGB_REGEX: Any + +class RGB(Typed): + expected_type: Any + def __set__(self, instance, value) -> None: ... + +class Color(Serialisable): + tagname: str + rgb: Any + indexed: Any + auto: Any + theme: Any + tint: Any + type: Any + def __init__( + self, + rgb=..., + indexed: Any | None = ..., + auto: Any | None = ..., + theme: Any | None = ..., + tint: float = ..., + index: Any | None = ..., + type: str = ..., + ) -> None: ... + @property + def value(self): ... + @value.setter + def value(self, value) -> None: ... + def __iter__(self): ... + @property + def index(self): ... + def __add__(self, other): ... + +class ColorDescriptor(Typed): + expected_type: Any + def __set__(self, instance, value) -> None: ... + +class RgbColor(Serialisable): + tagname: str + rgb: Any + def __init__(self, rgb: Any | None = ...) -> None: ... + +class ColorList(Serialisable): + tagname: str + indexedColors: Any + mruColors: Any + __elements__: Any + def __init__(self, indexedColors=..., mruColors=...) -> None: ... + def __bool__(self): ... + @property + def index(self): ... diff --git a/stubs/openpyxl/openpyxl/styles/differential.pyi b/stubs/openpyxl/openpyxl/styles/differential.pyi new file mode 100644 index 0000000..2c6c9b5 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/differential.pyi @@ -0,0 +1,37 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class DifferentialStyle(Serialisable): + tagname: str + __elements__: Any + font: Any + numFmt: Any + fill: Any + alignment: Any + border: Any + protection: Any + extLst: Any + def __init__( + self, + font: Any | None = ..., + numFmt: Any | None = ..., + fill: Any | None = ..., + alignment: Any | None = ..., + border: Any | None = ..., + protection: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class DifferentialStyleList(Serialisable): + tagname: str + dxf: Any + styles: Any + __attrs__: Any + def __init__(self, dxf=..., count: Any | None = ...) -> None: ... + def append(self, dxf) -> None: ... + def add(self, dxf): ... + def __bool__(self): ... + def __getitem__(self, idx): ... + @property + def count(self): ... diff --git a/stubs/openpyxl/openpyxl/styles/fills.pyi b/stubs/openpyxl/openpyxl/styles/fills.pyi new file mode 100644 index 0000000..f3fdda5 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/fills.pyi @@ -0,0 +1,79 @@ +from typing import Any + +from openpyxl.descriptors import Sequence +from openpyxl.descriptors.serialisable import Serialisable + +FILL_NONE: str +FILL_SOLID: str +FILL_PATTERN_DARKDOWN: str +FILL_PATTERN_DARKGRAY: str +FILL_PATTERN_DARKGRID: str +FILL_PATTERN_DARKHORIZONTAL: str +FILL_PATTERN_DARKTRELLIS: str +FILL_PATTERN_DARKUP: str +FILL_PATTERN_DARKVERTICAL: str +FILL_PATTERN_GRAY0625: str +FILL_PATTERN_GRAY125: str +FILL_PATTERN_LIGHTDOWN: str +FILL_PATTERN_LIGHTGRAY: str +FILL_PATTERN_LIGHTGRID: str +FILL_PATTERN_LIGHTHORIZONTAL: str +FILL_PATTERN_LIGHTTRELLIS: str +FILL_PATTERN_LIGHTUP: str +FILL_PATTERN_LIGHTVERTICAL: str +FILL_PATTERN_MEDIUMGRAY: str +fills: Any + +class Fill(Serialisable): + tagname: str + @classmethod + def from_tree(cls, el): ... + +class PatternFill(Fill): + tagname: str + __elements__: Any + patternType: Any + fill_type: Any + fgColor: Any + start_color: Any + bgColor: Any + end_color: Any + def __init__( + self, + patternType: Any | None = ..., + fgColor=..., + bgColor=..., + fill_type: Any | None = ..., + start_color: Any | None = ..., + end_color: Any | None = ..., + ) -> None: ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ...): ... # type: ignore[override] + +DEFAULT_EMPTY_FILL: Any +DEFAULT_GRAY_FILL: Any + +class Stop(Serialisable): + tagname: str + position: Any + color: Any + def __init__(self, color, position) -> None: ... + +class StopList(Sequence): + expected_type: Any + def __set__(self, obj, values) -> None: ... + +class GradientFill(Fill): + tagname: str + type: Any + fill_type: Any + degree: Any + left: Any + right: Any + top: Any + bottom: Any + stop: Any + def __init__( + self, type: str = ..., degree: int = ..., left: int = ..., right: int = ..., top: int = ..., bottom: int = ..., stop=... + ) -> None: ... + def __iter__(self): ... + def to_tree(self, tagname: Any | None = ..., namespace: Any | None = ..., idx: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/openpyxl/openpyxl/styles/fonts.pyi b/stubs/openpyxl/openpyxl/styles/fonts.pyi new file mode 100644 index 0000000..9c8bf29 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/fonts.pyi @@ -0,0 +1,58 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Font(Serialisable): + UNDERLINE_DOUBLE: str + UNDERLINE_DOUBLE_ACCOUNTING: str + UNDERLINE_SINGLE: str + UNDERLINE_SINGLE_ACCOUNTING: str + name: Any + charset: Any + family: Any + sz: Any + size: Any + b: Any + bold: Any + i: Any + italic: Any + strike: Any + strikethrough: Any + outline: Any + shadow: Any + condense: Any + extend: Any + u: Any + underline: Any + vertAlign: Any + color: Any + scheme: Any + tagname: str + __elements__: Any + def __init__( + self, + name: Any | None = ..., + sz: Any | None = ..., + b: Any | None = ..., + i: Any | None = ..., + charset: Any | None = ..., + u: Any | None = ..., + strike: Any | None = ..., + color: Any | None = ..., + scheme: Any | None = ..., + family: Any | None = ..., + size: Any | None = ..., + bold: Any | None = ..., + italic: Any | None = ..., + strikethrough: Any | None = ..., + underline: Any | None = ..., + vertAlign: Any | None = ..., + outline: Any | None = ..., + shadow: Any | None = ..., + condense: Any | None = ..., + extend: Any | None = ..., + ) -> None: ... + @classmethod + def from_tree(cls, node): ... + +DEFAULT_FONT: Any diff --git a/stubs/openpyxl/openpyxl/styles/named_styles.pyi b/stubs/openpyxl/openpyxl/styles/named_styles.pyi new file mode 100644 index 0000000..b6d6f06 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/named_styles.pyi @@ -0,0 +1,76 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class NamedStyle(Serialisable): # type: ignore[misc] + font: Any + fill: Any + border: Any + alignment: Any + number_format: Any + protection: Any + builtinId: Any + hidden: Any + # Overwritten by property below + # xfId: Integer + name: Any + def __init__( + self, + name: str = ..., + font=..., + fill=..., + border=..., + alignment=..., + number_format: Any | None = ..., + protection=..., + builtinId: Any | None = ..., + hidden: bool = ..., + xfId: Any | None = ..., + ) -> None: ... + def __setattr__(self, attr, value) -> None: ... + def __iter__(self): ... + @property + def xfId(self): ... + def bind(self, wb) -> None: ... + def as_tuple(self): ... + def as_xf(self): ... + def as_name(self): ... + +class NamedStyleList(list[Any]): + @property + def names(self): ... + def __getitem__(self, key): ... + def append(self, style) -> None: ... + +class _NamedCellStyle(Serialisable): + tagname: str + name: Any + xfId: Any + builtinId: Any + iLevel: Any + hidden: Any + customBuiltin: Any + extLst: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + xfId: Any | None = ..., + builtinId: Any | None = ..., + iLevel: Any | None = ..., + hidden: Any | None = ..., + customBuiltin: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class _NamedCellStyleList(Serialisable): + tagname: str + # Overwritten by property below + # count: Integer + cellStyle: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., cellStyle=...) -> None: ... + @property + def count(self): ... + @property + def names(self): ... diff --git a/stubs/openpyxl/openpyxl/styles/numbers.pyi b/stubs/openpyxl/openpyxl/styles/numbers.pyi new file mode 100644 index 0000000..421720d --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/numbers.pyi @@ -0,0 +1,73 @@ +from typing import Any + +from openpyxl.descriptors import String +from openpyxl.descriptors.serialisable import Serialisable + +BUILTIN_FORMATS: Any +BUILTIN_FORMATS_MAX_SIZE: int +BUILTIN_FORMATS_REVERSE: Any +FORMAT_GENERAL: Any +FORMAT_TEXT: Any +FORMAT_NUMBER: Any +FORMAT_NUMBER_00: Any +FORMAT_NUMBER_COMMA_SEPARATED1: Any +FORMAT_NUMBER_COMMA_SEPARATED2: str +FORMAT_PERCENTAGE: Any +FORMAT_PERCENTAGE_00: Any +FORMAT_DATE_YYYYMMDD2: str +FORMAT_DATE_YYMMDD: str +FORMAT_DATE_DDMMYY: str +FORMAT_DATE_DMYSLASH: str +FORMAT_DATE_DMYMINUS: str +FORMAT_DATE_DMMINUS: str +FORMAT_DATE_MYMINUS: str +FORMAT_DATE_XLSX14: Any +FORMAT_DATE_XLSX15: Any +FORMAT_DATE_XLSX16: Any +FORMAT_DATE_XLSX17: Any +FORMAT_DATE_XLSX22: Any +FORMAT_DATE_DATETIME: str +FORMAT_DATE_TIME1: Any +FORMAT_DATE_TIME2: Any +FORMAT_DATE_TIME3: Any +FORMAT_DATE_TIME4: Any +FORMAT_DATE_TIME5: Any +FORMAT_DATE_TIME6: Any +FORMAT_DATE_TIME7: str +FORMAT_DATE_TIME8: str +FORMAT_DATE_TIMEDELTA: str +FORMAT_DATE_YYMMDDSLASH: str +FORMAT_CURRENCY_USD_SIMPLE: str +FORMAT_CURRENCY_USD: str +FORMAT_CURRENCY_EUR_SIMPLE: str +COLORS: str +LITERAL_GROUP: str +LOCALE_GROUP: str +STRIP_RE: Any +TIMEDELTA_RE: Any + +def is_date_format(fmt): ... +def is_timedelta_format(fmt): ... +def is_datetime(fmt): ... +def is_builtin(fmt): ... +def builtin_format_code(index): ... +def builtin_format_id(fmt): ... + +class NumberFormatDescriptor(String): + def __set__(self, instance, value) -> None: ... + +class NumberFormat(Serialisable): # type: ignore[misc] + numFmtId: Any + formatCode: Any + def __init__(self, numFmtId: Any | None = ..., formatCode: Any | None = ...) -> None: ... + +class NumberFormatList(Serialisable): # type: ignore[misc] + # Overwritten by property below + # count: Integer + numFmt: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., numFmt=...) -> None: ... + @property + def count(self): ... + def __getitem__(self, idx): ... diff --git a/stubs/openpyxl/openpyxl/styles/protection.pyi b/stubs/openpyxl/openpyxl/styles/protection.pyi new file mode 100644 index 0000000..df22903 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/protection.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Protection(Serialisable): + tagname: str + locked: Any + hidden: Any + def __init__(self, locked: bool = ..., hidden: bool = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/styles/proxy.pyi b/stubs/openpyxl/openpyxl/styles/proxy.pyi new file mode 100644 index 0000000..b8e13b0 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/proxy.pyi @@ -0,0 +1,9 @@ +class StyleProxy: + def __init__(self, target) -> None: ... + def __getattr__(self, attr): ... + def __setattr__(self, attr, value) -> None: ... + def __copy__(self): ... + def __add__(self, other): ... + def copy(self, **kw): ... + def __eq__(self, other): ... + def __ne__(self, other): ... diff --git a/stubs/openpyxl/openpyxl/styles/styleable.pyi b/stubs/openpyxl/openpyxl/styles/styleable.pyi new file mode 100644 index 0000000..45929c7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/styleable.pyi @@ -0,0 +1,44 @@ +from typing import Any +from warnings import warn as warn + +class StyleDescriptor: + collection: Any + key: Any + def __init__(self, collection, key) -> None: ... + def __set__(self, instance, value) -> None: ... + def __get__(self, instance, cls): ... + +class NumberFormatDescriptor: + key: str + collection: str + def __set__(self, instance, value) -> None: ... + def __get__(self, instance, cls): ... + +class NamedStyleDescriptor: + key: str + collection: str + def __set__(self, instance, value) -> None: ... + def __get__(self, instance, cls): ... + +class StyleArrayDescriptor: + key: Any + def __init__(self, key) -> None: ... + def __set__(self, instance, value) -> None: ... + def __get__(self, instance, cls): ... + +class StyleableObject: + font: Any + fill: Any + border: Any + number_format: Any + protection: Any + alignment: Any + style: Any + quotePrefix: Any + pivotButton: Any + parent: Any + def __init__(self, sheet, style_array: Any | None = ...) -> None: ... + @property + def style_id(self): ... + @property + def has_style(self): ... diff --git a/stubs/openpyxl/openpyxl/styles/stylesheet.pyi b/stubs/openpyxl/openpyxl/styles/stylesheet.pyi new file mode 100644 index 0000000..c7a44bd --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/stylesheet.pyi @@ -0,0 +1,45 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Stylesheet(Serialisable): + tagname: str + numFmts: Any + fonts: Any + fills: Any + borders: Any + cellStyleXfs: Any + cellXfs: Any + cellStyles: Any + dxfs: Any + tableStyles: Any + colors: Any + extLst: Any + __elements__: Any + number_formats: Any + cell_styles: Any + alignments: Any + protections: Any + named_styles: Any + def __init__( + self, + numFmts: Any | None = ..., + fonts=..., + fills=..., + borders=..., + cellStyleXfs: Any | None = ..., + cellXfs: Any | None = ..., + cellStyles: Any | None = ..., + dxfs=..., + tableStyles: Any | None = ..., + colors: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + @classmethod + def from_tree(cls, node): ... + @property + def custom_formats(self): ... + def to_tree(self, tagname: Any | None = ..., idx: Any | None = ..., namespace: Any | None = ...): ... + +def apply_stylesheet(archive, wb): ... +def write_stylesheet(wb): ... diff --git a/stubs/openpyxl/openpyxl/styles/table.pyi b/stubs/openpyxl/openpyxl/styles/table.pyi new file mode 100644 index 0000000..3290701 --- /dev/null +++ b/stubs/openpyxl/openpyxl/styles/table.pyi @@ -0,0 +1,40 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class TableStyleElement(Serialisable): + tagname: str + type: Any + size: Any + dxfId: Any + def __init__(self, type: Any | None = ..., size: Any | None = ..., dxfId: Any | None = ...) -> None: ... + +class TableStyle(Serialisable): + tagname: str + name: Any + pivot: Any + table: Any + count: Any + tableStyleElement: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + pivot: Any | None = ..., + table: Any | None = ..., + count: Any | None = ..., + tableStyleElement=..., + ) -> None: ... + +class TableStyleList(Serialisable): + tagname: str + defaultTableStyle: Any + defaultPivotStyle: Any + tableStyle: Any + __elements__: Any + __attrs__: Any + def __init__( + self, count: Any | None = ..., defaultTableStyle: str = ..., defaultPivotStyle: str = ..., tableStyle=... + ) -> None: ... + @property + def count(self): ... diff --git a/stubs/openpyxl/openpyxl/utils/__init__.pyi b/stubs/openpyxl/openpyxl/utils/__init__.pyi new file mode 100644 index 0000000..ba45939 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/__init__.pyi @@ -0,0 +1,13 @@ +from .cell import ( + absolute_coordinate as absolute_coordinate, + cols_from_range as cols_from_range, + column_index_from_string as column_index_from_string, + coordinate_to_tuple as coordinate_to_tuple, + get_column_interval as get_column_interval, + get_column_letter as get_column_letter, + quote_sheetname as quote_sheetname, + range_boundaries as range_boundaries, + range_to_tuple as range_to_tuple, + rows_from_range as rows_from_range, +) +from .formulas import FORMULAE as FORMULAE diff --git a/stubs/openpyxl/openpyxl/utils/bound_dictionary.pyi b/stubs/openpyxl/openpyxl/utils/bound_dictionary.pyi new file mode 100644 index 0000000..2edc1a8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/bound_dictionary.pyi @@ -0,0 +1,7 @@ +from collections import defaultdict +from typing import Any + +class BoundDictionary(defaultdict[Any, Any]): + reference: Any + def __init__(self, reference: Any | None = ..., *args, **kw) -> None: ... + def __getitem__(self, key): ... diff --git a/stubs/openpyxl/openpyxl/utils/cell.pyi b/stubs/openpyxl/openpyxl/utils/cell.pyi new file mode 100644 index 0000000..6fc91f1 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/cell.pyi @@ -0,0 +1,25 @@ +from collections.abc import Generator +from typing import Any + +COORD_RE: Any +COL_RANGE: str +ROW_RANGE: str +RANGE_EXPR: str +ABSOLUTE_RE: Any +SHEET_TITLE: str +SHEETRANGE_RE: Any + +def get_column_interval(start: str | int, end: str | int) -> list[str]: ... +def coordinate_from_string(coord_string: str) -> tuple[str, int]: ... +def absolute_coordinate(coord_string: str) -> str: ... + +col: Any + +def get_column_letter(idx: int) -> str: ... +def column_index_from_string(str_col: str) -> int: ... +def range_boundaries(range_string: str) -> tuple[int, int, int, int]: ... +def rows_from_range(range_string) -> Generator[Any, None, None]: ... +def cols_from_range(range_string) -> Generator[Any, None, None]: ... +def coordinate_to_tuple(coordinate: str) -> tuple[int, int]: ... +def range_to_tuple(range_string: str) -> tuple[str, tuple[int, int, int, int]]: ... +def quote_sheetname(sheetname: str) -> str: ... diff --git a/stubs/openpyxl/openpyxl/utils/dataframe.pyi b/stubs/openpyxl/openpyxl/utils/dataframe.pyi new file mode 100644 index 0000000..1f5dd0c --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/dataframe.pyi @@ -0,0 +1,5 @@ +from collections.abc import Generator +from typing import Any + +def dataframe_to_rows(df, index: bool = ..., header: bool = ...) -> Generator[Any, None, None]: ... +def expand_index(index, header: bool = ...) -> Generator[Any, None, None]: ... diff --git a/stubs/openpyxl/openpyxl/utils/datetime.pyi b/stubs/openpyxl/openpyxl/utils/datetime.pyi new file mode 100644 index 0000000..f407d19 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/datetime.pyi @@ -0,0 +1,19 @@ +from typing import Any + +MAC_EPOCH: Any +WINDOWS_EPOCH: Any +# The following two constants are defined twice in the implementation. +CALENDAR_WINDOWS_1900 = WINDOWS_EPOCH # noqa: F821 +CALENDAR_MAC_1904 = MAC_EPOCH # noqa: F821 +SECS_PER_DAY: int +ISO_FORMAT: str +ISO_REGEX: Any +ISO_DURATION: Any + +def to_ISO8601(dt): ... +def from_ISO8601(formatted_string): ... +def to_excel(dt, epoch=...): ... +def from_excel(value, epoch=..., timedelta: bool = ...): ... +def time_to_days(value): ... +def timedelta_to_days(value): ... +def days_to_time(value): ... diff --git a/stubs/openpyxl/openpyxl/utils/escape.pyi b/stubs/openpyxl/openpyxl/utils/escape.pyi new file mode 100644 index 0000000..3e182f4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/escape.pyi @@ -0,0 +1,2 @@ +def escape(value): ... +def unescape(value): ... diff --git a/stubs/openpyxl/openpyxl/utils/exceptions.pyi b/stubs/openpyxl/openpyxl/utils/exceptions.pyi new file mode 100644 index 0000000..5e9ebea --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/exceptions.pyi @@ -0,0 +1,7 @@ +class CellCoordinatesException(Exception): ... +class IllegalCharacterError(Exception): ... +class NamedRangeException(Exception): ... +class SheetTitleException(Exception): ... +class InvalidFileException(Exception): ... +class ReadOnlyWorkbookException(Exception): ... +class WorkbookAlreadySaved(Exception): ... diff --git a/stubs/openpyxl/openpyxl/utils/formulas.pyi b/stubs/openpyxl/openpyxl/utils/formulas.pyi new file mode 100644 index 0000000..55742aa --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/formulas.pyi @@ -0,0 +1,3 @@ +from typing import Any + +FORMULAE: Any diff --git a/stubs/openpyxl/openpyxl/utils/indexed_list.pyi b/stubs/openpyxl/openpyxl/utils/indexed_list.pyi new file mode 100644 index 0000000..43c4516 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/indexed_list.pyi @@ -0,0 +1,9 @@ +from typing import Any + +class IndexedList(list[Any]): + clean: bool + def __init__(self, iterable: Any | None = ...) -> None: ... + def __contains__(self, value): ... + def index(self, value): ... + def append(self, value) -> None: ... + def add(self, value): ... diff --git a/stubs/openpyxl/openpyxl/utils/inference.pyi b/stubs/openpyxl/openpyxl/utils/inference.pyi new file mode 100644 index 0000000..6eb88af --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/inference.pyi @@ -0,0 +1,9 @@ +from typing import Any + +PERCENT_REGEX: Any +TIME_REGEX: Any +NUMBER_REGEX: Any + +def cast_numeric(value): ... +def cast_percentage(value): ... +def cast_time(value): ... diff --git a/stubs/openpyxl/openpyxl/utils/protection.pyi b/stubs/openpyxl/openpyxl/utils/protection.pyi new file mode 100644 index 0000000..28eb69b --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/protection.pyi @@ -0,0 +1 @@ +def hash_password(plaintext_password: str = ...): ... diff --git a/stubs/openpyxl/openpyxl/utils/units.pyi b/stubs/openpyxl/openpyxl/utils/units.pyi new file mode 100644 index 0000000..9f81dd7 --- /dev/null +++ b/stubs/openpyxl/openpyxl/utils/units.pyi @@ -0,0 +1,24 @@ +from typing import Any + +DEFAULT_ROW_HEIGHT: float +BASE_COL_WIDTH: int +DEFAULT_COLUMN_WIDTH: Any +DEFAULT_LEFT_MARGIN: float +DEFAULT_TOP_MARGIN: float +DEFAULT_HEADER: float + +def inch_to_dxa(value): ... +def dxa_to_inch(value): ... +def dxa_to_cm(value): ... +def cm_to_dxa(value): ... +def pixels_to_EMU(value): ... +def EMU_to_pixels(value): ... +def cm_to_EMU(value): ... +def EMU_to_cm(value): ... +def inch_to_EMU(value): ... +def EMU_to_inch(value): ... +def pixels_to_points(value, dpi: int = ...): ... +def points_to_pixels(value, dpi: int = ...): ... +def degrees_to_angle(value): ... +def angle_to_degrees(value): ... +def short_color(color): ... diff --git a/stubs/openpyxl/openpyxl/workbook/__init__.pyi b/stubs/openpyxl/openpyxl/workbook/__init__.pyi new file mode 100644 index 0000000..af0aa0b --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/__init__.pyi @@ -0,0 +1 @@ +from .workbook import Workbook as Workbook diff --git a/stubs/openpyxl/openpyxl/workbook/_writer.pyi b/stubs/openpyxl/openpyxl/workbook/_writer.pyi new file mode 100644 index 0000000..5b2c00b --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/_writer.pyi @@ -0,0 +1,18 @@ +from typing import Any + +def get_active_sheet(wb): ... + +class WorkbookWriter: + wb: Any + rels: Any + package: Any + def __init__(self, wb) -> None: ... + def write_properties(self) -> None: ... + def write_worksheets(self) -> None: ... + def write_refs(self) -> None: ... + def write_names(self) -> None: ... + def write_pivots(self) -> None: ... + def write_views(self) -> None: ... + def write(self): ... + def write_rels(self): ... + def write_root_rels(self): ... diff --git a/stubs/openpyxl/openpyxl/workbook/child.pyi b/stubs/openpyxl/openpyxl/workbook/child.pyi new file mode 100644 index 0000000..2c924f1 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/child.pyi @@ -0,0 +1,43 @@ +from typing import Any + +INVALID_TITLE_REGEX: Any + +def avoid_duplicate_name(names, value): ... + +class _WorkbookChild: + HeaderFooter: Any + def __init__(self, parent: Any | None = ..., title: Any | None = ...) -> None: ... + @property + def parent(self): ... + @property + def encoding(self): ... + @property + def title(self): ... + @title.setter + def title(self, value) -> None: ... + @property + def oddHeader(self): ... + @oddHeader.setter + def oddHeader(self, value) -> None: ... + @property + def oddFooter(self): ... + @oddFooter.setter + def oddFooter(self, value) -> None: ... + @property + def evenHeader(self): ... + @evenHeader.setter + def evenHeader(self, value) -> None: ... + @property + def evenFooter(self): ... + @evenFooter.setter + def evenFooter(self, value) -> None: ... + @property + def firstHeader(self): ... + @firstHeader.setter + def firstHeader(self, value) -> None: ... + @property + def firstFooter(self): ... + @firstFooter.setter + def firstFooter(self, value) -> None: ... + @property + def path(self): ... diff --git a/stubs/openpyxl/openpyxl/workbook/defined_name.pyi b/stubs/openpyxl/openpyxl/workbook/defined_name.pyi new file mode 100644 index 0000000..f4e2a78 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/defined_name.pyi @@ -0,0 +1,73 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +RESERVED: Any +RESERVED_REGEX: Any +COL_RANGE: str +COL_RANGE_RE: Any +ROW_RANGE: str +ROW_RANGE_RE: Any +TITLES_REGEX: Any + +class DefinedName(Serialisable): + tagname: str + name: Any + comment: Any + customMenu: Any + description: Any + help: Any + statusBar: Any + localSheetId: Any + hidden: Any + function: Any + vbProcedure: Any + xlm: Any + functionGroupId: Any + shortcutKey: Any + publishToServer: Any + workbookParameter: Any + attr_text: Any + value: Any + def __init__( + self, + name: Any | None = ..., + comment: Any | None = ..., + customMenu: Any | None = ..., + description: Any | None = ..., + help: Any | None = ..., + statusBar: Any | None = ..., + localSheetId: Any | None = ..., + hidden: Any | None = ..., + function: Any | None = ..., + vbProcedure: Any | None = ..., + xlm: Any | None = ..., + functionGroupId: Any | None = ..., + shortcutKey: Any | None = ..., + publishToServer: Any | None = ..., + workbookParameter: Any | None = ..., + attr_text: Any | None = ..., + ) -> None: ... + @property + def type(self): ... + @property + def destinations(self) -> Generator[Any, None, None]: ... + @property + def is_reserved(self): ... + @property + def is_external(self): ... + def __iter__(self): ... + +class DefinedNameList(Serialisable): + tagname: str + definedName: Any + def __init__(self, definedName=...) -> None: ... + def append(self, defn) -> None: ... + def __len__(self): ... + def __contains__(self, name): ... + def __getitem__(self, name): ... + def get(self, name, scope: Any | None = ...): ... + def __delitem__(self, name) -> None: ... + def delete(self, name, scope: Any | None = ...): ... + def localnames(self, scope): ... diff --git a/stubs/openpyxl/openpyxl/workbook/external_link/__init__.pyi b/stubs/openpyxl/openpyxl/workbook/external_link/__init__.pyi new file mode 100644 index 0000000..37ef937 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/external_link/__init__.pyi @@ -0,0 +1 @@ +from .external import ExternalLink as ExternalLink diff --git a/stubs/openpyxl/openpyxl/workbook/external_link/external.pyi b/stubs/openpyxl/openpyxl/workbook/external_link/external.pyi new file mode 100644 index 0000000..3e5e7c8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/external_link/external.pyi @@ -0,0 +1,66 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ExternalCell(Serialisable): # type: ignore[misc] + r: Any + t: Any + vm: Any + v: Any + def __init__(self, r: Any | None = ..., t: Any | None = ..., vm: Any | None = ..., v: Any | None = ...) -> None: ... + +class ExternalRow(Serialisable): # type: ignore[misc] + r: Any + cell: Any + __elements__: Any + def __init__(self, r=..., cell: Any | None = ...) -> None: ... + +class ExternalSheetData(Serialisable): # type: ignore[misc] + sheetId: Any + refreshError: Any + row: Any + __elements__: Any + def __init__(self, sheetId: Any | None = ..., refreshError: Any | None = ..., row=...) -> None: ... + +class ExternalSheetDataSet(Serialisable): # type: ignore[misc] + sheetData: Any + __elements__: Any + def __init__(self, sheetData: Any | None = ...) -> None: ... + +class ExternalSheetNames(Serialisable): # type: ignore[misc] + sheetName: Any + __elements__: Any + def __init__(self, sheetName=...) -> None: ... + +class ExternalDefinedName(Serialisable): + tagname: str + name: Any + refersTo: Any + sheetId: Any + def __init__(self, name: Any | None = ..., refersTo: Any | None = ..., sheetId: Any | None = ...) -> None: ... + +class ExternalBook(Serialisable): + tagname: str + sheetNames: Any + definedNames: Any + sheetDataSet: Any + id: Any + __elements__: Any + def __init__( + self, sheetNames: Any | None = ..., definedNames=..., sheetDataSet: Any | None = ..., id: Any | None = ... + ) -> None: ... + +class ExternalLink(Serialisable): + tagname: str + mime_type: str + externalBook: Any + file_link: Any + __elements__: Any + def __init__( + self, externalBook: Any | None = ..., ddeLink: Any | None = ..., oleLink: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + def to_tree(self): ... + @property + def path(self): ... + +def read_external_link(archive, book_path): ... diff --git a/stubs/openpyxl/openpyxl/workbook/external_reference.pyi b/stubs/openpyxl/openpyxl/workbook/external_reference.pyi new file mode 100644 index 0000000..141dafe --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/external_reference.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ExternalReference(Serialisable): + tagname: str + id: Any + def __init__(self, id) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/function_group.pyi b/stubs/openpyxl/openpyxl/workbook/function_group.pyi new file mode 100644 index 0000000..7ebcf0c --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/function_group.pyi @@ -0,0 +1,15 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class FunctionGroup(Serialisable): + tagname: str + name: Any + def __init__(self, name: Any | None = ...) -> None: ... + +class FunctionGroupList(Serialisable): + tagname: str + builtInGroupCount: Any + functionGroup: Any + __elements__: Any + def __init__(self, builtInGroupCount: int = ..., functionGroup=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/properties.pyi b/stubs/openpyxl/openpyxl/workbook/properties.pyi new file mode 100644 index 0000000..1ada057 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/properties.pyi @@ -0,0 +1,95 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class WorkbookProperties(Serialisable): + tagname: str + date1904: Any + dateCompatibility: Any + showObjects: Any + showBorderUnselectedTables: Any + filterPrivacy: Any + promptedSolutions: Any + showInkAnnotation: Any + backupFile: Any + saveExternalLinkValues: Any + updateLinks: Any + codeName: Any + hidePivotFieldList: Any + showPivotChartFilter: Any + allowRefreshQuery: Any + publishItems: Any + checkCompatibility: Any + autoCompressPictures: Any + refreshAllConnections: Any + defaultThemeVersion: Any + def __init__( + self, + date1904: Any | None = ..., + dateCompatibility: Any | None = ..., + showObjects: Any | None = ..., + showBorderUnselectedTables: Any | None = ..., + filterPrivacy: Any | None = ..., + promptedSolutions: Any | None = ..., + showInkAnnotation: Any | None = ..., + backupFile: Any | None = ..., + saveExternalLinkValues: Any | None = ..., + updateLinks: Any | None = ..., + codeName: Any | None = ..., + hidePivotFieldList: Any | None = ..., + showPivotChartFilter: Any | None = ..., + allowRefreshQuery: Any | None = ..., + publishItems: Any | None = ..., + checkCompatibility: Any | None = ..., + autoCompressPictures: Any | None = ..., + refreshAllConnections: Any | None = ..., + defaultThemeVersion: Any | None = ..., + ) -> None: ... + +class CalcProperties(Serialisable): + tagname: str + calcId: Any + calcMode: Any + fullCalcOnLoad: Any + refMode: Any + iterate: Any + iterateCount: Any + iterateDelta: Any + fullPrecision: Any + calcCompleted: Any + calcOnSave: Any + concurrentCalc: Any + concurrentManualCount: Any + forceFullCalc: Any + def __init__( + self, + calcId: int = ..., + calcMode: Any | None = ..., + fullCalcOnLoad: bool = ..., + refMode: Any | None = ..., + iterate: Any | None = ..., + iterateCount: Any | None = ..., + iterateDelta: Any | None = ..., + fullPrecision: Any | None = ..., + calcCompleted: Any | None = ..., + calcOnSave: Any | None = ..., + concurrentCalc: Any | None = ..., + concurrentManualCount: Any | None = ..., + forceFullCalc: Any | None = ..., + ) -> None: ... + +class FileVersion(Serialisable): + tagname: str + appName: Any + lastEdited: Any + lowestEdited: Any + rupBuild: Any + codeName: Any + def __init__( + self, + appName: Any | None = ..., + lastEdited: Any | None = ..., + lowestEdited: Any | None = ..., + rupBuild: Any | None = ..., + codeName: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/protection.pyi b/stubs/openpyxl/openpyxl/workbook/protection.pyi new file mode 100644 index 0000000..9d53fd6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/protection.pyi @@ -0,0 +1,77 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class WorkbookProtection(Serialisable): + tagname: str + workbook_password: Any + workbookPasswordCharacterSet: Any + revision_password: Any + revisionsPasswordCharacterSet: Any + lockStructure: Any + lock_structure: Any + lockWindows: Any + lock_windows: Any + lockRevision: Any + lock_revision: Any + revisionsAlgorithmName: Any + revisionsHashValue: Any + revisionsSaltValue: Any + revisionsSpinCount: Any + workbookAlgorithmName: Any + workbookHashValue: Any + workbookSaltValue: Any + workbookSpinCount: Any + __attrs__: Any + def __init__( + self, + workbookPassword: Any | None = ..., + workbookPasswordCharacterSet: Any | None = ..., + revisionsPassword: Any | None = ..., + revisionsPasswordCharacterSet: Any | None = ..., + lockStructure: Any | None = ..., + lockWindows: Any | None = ..., + lockRevision: Any | None = ..., + revisionsAlgorithmName: Any | None = ..., + revisionsHashValue: Any | None = ..., + revisionsSaltValue: Any | None = ..., + revisionsSpinCount: Any | None = ..., + workbookAlgorithmName: Any | None = ..., + workbookHashValue: Any | None = ..., + workbookSaltValue: Any | None = ..., + workbookSpinCount: Any | None = ..., + ) -> None: ... + def set_workbook_password(self, value: str = ..., already_hashed: bool = ...) -> None: ... + @property + def workbookPassword(self): ... + @workbookPassword.setter + def workbookPassword(self, value) -> None: ... + def set_revisions_password(self, value: str = ..., already_hashed: bool = ...) -> None: ... + @property + def revisionsPassword(self): ... + @revisionsPassword.setter + def revisionsPassword(self, value) -> None: ... + @classmethod + def from_tree(cls, node): ... + +DocumentSecurity = WorkbookProtection + +class FileSharing(Serialisable): + tagname: str + readOnlyRecommended: Any + userName: Any + reservationPassword: Any + algorithmName: Any + hashValue: Any + saltValue: Any + spinCount: Any + def __init__( + self, + readOnlyRecommended: Any | None = ..., + userName: Any | None = ..., + reservationPassword: Any | None = ..., + algorithmName: Any | None = ..., + hashValue: Any | None = ..., + saltValue: Any | None = ..., + spinCount: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/smart_tags.pyi b/stubs/openpyxl/openpyxl/workbook/smart_tags.pyi new file mode 100644 index 0000000..a538386 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/smart_tags.pyi @@ -0,0 +1,22 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class SmartTag(Serialisable): + tagname: str + namespaceUri: Any + name: Any + url: Any + def __init__(self, namespaceUri: Any | None = ..., name: Any | None = ..., url: Any | None = ...) -> None: ... + +class SmartTagList(Serialisable): + tagname: str + smartTagType: Any + __elements__: Any + def __init__(self, smartTagType=...) -> None: ... + +class SmartTagProperties(Serialisable): + tagname: str + embed: Any + show: Any + def __init__(self, embed: Any | None = ..., show: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/views.pyi b/stubs/openpyxl/openpyxl/workbook/views.pyi new file mode 100644 index 0000000..e22514d --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/views.pyi @@ -0,0 +1,95 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class BookView(Serialisable): + tagname: str + visibility: Any + minimized: Any + showHorizontalScroll: Any + showVerticalScroll: Any + showSheetTabs: Any + xWindow: Any + yWindow: Any + windowWidth: Any + windowHeight: Any + tabRatio: Any + firstSheet: Any + activeTab: Any + autoFilterDateGrouping: Any + extLst: Any + __elements__: Any + def __init__( + self, + visibility: str = ..., + minimized: bool = ..., + showHorizontalScroll: bool = ..., + showVerticalScroll: bool = ..., + showSheetTabs: bool = ..., + xWindow: Any | None = ..., + yWindow: Any | None = ..., + windowWidth: Any | None = ..., + windowHeight: Any | None = ..., + tabRatio: int = ..., + firstSheet: int = ..., + activeTab: int = ..., + autoFilterDateGrouping: bool = ..., + extLst: Any | None = ..., + ) -> None: ... + +class CustomWorkbookView(Serialisable): + tagname: str + name: Any + guid: Any + autoUpdate: Any + mergeInterval: Any + changesSavedWin: Any + onlySync: Any + personalView: Any + includePrintSettings: Any + includeHiddenRowCol: Any + maximized: Any + minimized: Any + showHorizontalScroll: Any + showVerticalScroll: Any + showSheetTabs: Any + xWindow: Any + yWindow: Any + windowWidth: Any + windowHeight: Any + tabRatio: Any + activeSheetId: Any + showFormulaBar: Any + showStatusbar: Any + showComments: Any + showObjects: Any + extLst: Any + __elements__: Any + def __init__( + self, + name: Any | None = ..., + guid: Any | None = ..., + autoUpdate: Any | None = ..., + mergeInterval: Any | None = ..., + changesSavedWin: Any | None = ..., + onlySync: Any | None = ..., + personalView: Any | None = ..., + includePrintSettings: Any | None = ..., + includeHiddenRowCol: Any | None = ..., + maximized: Any | None = ..., + minimized: Any | None = ..., + showHorizontalScroll: Any | None = ..., + showVerticalScroll: Any | None = ..., + showSheetTabs: Any | None = ..., + xWindow: Any | None = ..., + yWindow: Any | None = ..., + windowWidth: Any | None = ..., + windowHeight: Any | None = ..., + tabRatio: Any | None = ..., + activeSheetId: Any | None = ..., + showFormulaBar: Any | None = ..., + showStatusbar: Any | None = ..., + showComments: str = ..., + showObjects: str = ..., + extLst: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/web.pyi b/stubs/openpyxl/openpyxl/workbook/web.pyi new file mode 100644 index 0000000..2aff3d6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/web.pyi @@ -0,0 +1,55 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class WebPublishObject(Serialisable): + tagname: str + id: Any + divId: Any + sourceObject: Any + destinationFile: Any + title: Any + autoRepublish: Any + def __init__( + self, + id: Any | None = ..., + divId: Any | None = ..., + sourceObject: Any | None = ..., + destinationFile: Any | None = ..., + title: Any | None = ..., + autoRepublish: Any | None = ..., + ) -> None: ... + +class WebPublishObjectList(Serialisable): + tagname: str + # Overwritten by property below + # count: Integer + webPublishObject: Any + __elements__: Any + def __init__(self, count: Any | None = ..., webPublishObject=...) -> None: ... + @property + def count(self): ... + +class WebPublishing(Serialisable): + tagname: str + css: Any + thicket: Any + longFileNames: Any + vml: Any + allowPng: Any + targetScreenSize: Any + dpi: Any + codePage: Any + characterSet: Any + def __init__( + self, + css: Any | None = ..., + thicket: Any | None = ..., + longFileNames: Any | None = ..., + vml: Any | None = ..., + allowPng: Any | None = ..., + targetScreenSize: str = ..., + dpi: Any | None = ..., + codePage: Any | None = ..., + characterSet: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/workbook/workbook.pyi b/stubs/openpyxl/openpyxl/workbook/workbook.pyi new file mode 100644 index 0000000..0ce9d9b --- /dev/null +++ b/stubs/openpyxl/openpyxl/workbook/workbook.pyi @@ -0,0 +1,71 @@ +from typing import Any + +INTEGER_TYPES: Any + +class Workbook: + template: bool + path: str + defined_names: Any + properties: Any + security: Any + shared_strings: Any + loaded_theme: Any + vba_archive: Any + is_template: bool + code_name: Any + encoding: str + iso_dates: Any + rels: Any + calculation: Any + views: Any + def __init__(self, write_only: bool = ..., iso_dates: bool = ...) -> None: ... + @property + def epoch(self): ... + @epoch.setter + def epoch(self, value) -> None: ... + @property + def read_only(self): ... + @property + def data_only(self): ... + @property + def write_only(self): ... + @property + def excel_base_date(self): ... + @property + def active(self): ... + @active.setter + def active(self, value) -> None: ... + def create_sheet(self, title: Any | None = ..., index: Any | None = ...): ... + def move_sheet(self, sheet, offset: int = ...) -> None: ... + def remove(self, worksheet) -> None: ... + def remove_sheet(self, worksheet) -> None: ... + def create_chartsheet(self, title: Any | None = ..., index: Any | None = ...): ... + def get_sheet_by_name(self, name): ... + def __contains__(self, key): ... + def index(self, worksheet): ... + def get_index(self, worksheet): ... + def __getitem__(self, key): ... + def __delitem__(self, key) -> None: ... + def __iter__(self): ... + def get_sheet_names(self): ... + @property + def worksheets(self): ... + @property + def chartsheets(self): ... + @property + def sheetnames(self): ... + def create_named_range(self, name, worksheet: Any | None = ..., value: Any | None = ..., scope: Any | None = ...) -> None: ... + def add_named_style(self, style) -> None: ... + @property + def named_styles(self): ... + def get_named_ranges(self): ... + def add_named_range(self, named_range) -> None: ... + def get_named_range(self, name): ... + def remove_named_range(self, named_range) -> None: ... + @property + def mime_type(self): ... + def save(self, filename) -> None: ... + @property + def style_names(self): ... + def copy_worksheet(self, from_worksheet): ... + def close(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/phantomjs/__init__.pyi b/stubs/openpyxl/openpyxl/worksheet/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/phantomjs/__init__.pyi rename to stubs/openpyxl/openpyxl/worksheet/__init__.pyi diff --git a/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi b/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi new file mode 100644 index 0000000..256a4bc --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi @@ -0,0 +1,27 @@ +from typing import Any + +def read_dimension(source): ... + +class ReadOnlyWorksheet: + cell: Any + iter_rows: Any + @property + def values(self): ... + @property + def rows(self): ... + __getitem__: Any + __iter__: Any + parent: Any + title: Any + sheet_state: str + def __init__(self, parent_workbook, title, worksheet_path, shared_strings) -> None: ... + def calculate_dimension(self, force: bool = ...): ... + def reset_dimensions(self) -> None: ... + @property + def min_row(self): ... + @property + def max_row(self): ... + @property + def min_column(self): ... + @property + def max_column(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/_reader.pyi b/stubs/openpyxl/openpyxl/worksheet/_reader.pyi new file mode 100644 index 0000000..a12256d --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/_reader.pyi @@ -0,0 +1,88 @@ +from collections.abc import Generator +from typing import Any + +CELL_TAG: Any +VALUE_TAG: Any +FORMULA_TAG: Any +MERGE_TAG: Any +INLINE_STRING: Any +COL_TAG: Any +ROW_TAG: Any +CF_TAG: Any +LEGACY_TAG: Any +PROT_TAG: Any +EXT_TAG: Any +HYPERLINK_TAG: Any +TABLE_TAG: Any +PRINT_TAG: Any +MARGINS_TAG: Any +PAGE_TAG: Any +HEADER_TAG: Any +FILTER_TAG: Any +VALIDATION_TAG: Any +PROPERTIES_TAG: Any +VIEWS_TAG: Any +FORMAT_TAG: Any +ROW_BREAK_TAG: Any +COL_BREAK_TAG: Any +SCENARIOS_TAG: Any +DATA_TAG: Any +DIMENSION_TAG: Any +CUSTOM_VIEWS_TAG: Any + +class WorkSheetParser: + min_row: Any + epoch: Any + source: Any + shared_strings: Any + data_only: Any + shared_formulae: Any + array_formulae: Any + row_counter: int + tables: Any + date_formats: Any + timedelta_formats: Any + row_dimensions: Any + column_dimensions: Any + number_formats: Any + keep_vba: bool + hyperlinks: Any + formatting: Any + legacy_drawing: Any + merged_cells: Any + row_breaks: Any + col_breaks: Any + def __init__( + self, src, shared_strings, data_only: bool = ..., epoch=..., date_formats=..., timedelta_formats=... + ) -> None: ... + def parse(self) -> Generator[Any, None, None]: ... + def parse_dimensions(self): ... + col_counter: Any + def parse_cell(self, element): ... + def parse_formula(self, element): ... + def parse_column_dimensions(self, col) -> None: ... + def parse_row(self, row): ... + def parse_formatting(self, element) -> None: ... + protection: Any + def parse_sheet_protection(self, element) -> None: ... + def parse_extensions(self, element) -> None: ... + def parse_legacy(self, element) -> None: ... + def parse_row_breaks(self, element) -> None: ... + def parse_col_breaks(self, element) -> None: ... + def parse_custom_views(self, element) -> None: ... + +class WorksheetReader: + ws: Any + parser: Any + tables: Any + def __init__(self, ws, xml_source, shared_strings, data_only) -> None: ... + def bind_cells(self) -> None: ... + def bind_formatting(self) -> None: ... + def bind_tables(self) -> None: ... + def bind_merged_cells(self) -> None: ... + def bind_hyperlinks(self) -> None: ... + def normalize_merged_cell_link(self, coord): ... + def bind_col_dimensions(self) -> None: ... + def bind_row_dimensions(self) -> None: ... + def bind_properties(self) -> None: ... + def bind_all(self) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi b/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi new file mode 100644 index 0000000..c89ed90 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/_write_only.pyi @@ -0,0 +1,24 @@ +from typing import Any + +from openpyxl.workbook.child import _WorkbookChild + +class WriteOnlyWorksheet(_WorkbookChild): + mime_type: Any + add_chart: Any + add_image: Any + add_table: Any + @property + def tables(self): ... + @property + def print_titles(self): ... + print_title_cols: Any + print_title_rows: Any + freeze_panes: Any + print_area: Any + @property + def sheet_view(self): ... + def __init__(self, parent, title) -> None: ... + @property + def closed(self): ... + def close(self) -> None: ... + def append(self, row) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/_writer.pyi b/stubs/openpyxl/openpyxl/worksheet/_writer.pyi new file mode 100644 index 0000000..0c41382 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/_writer.pyi @@ -0,0 +1,43 @@ +from collections.abc import Generator +from typing import Any + +ALL_TEMP_FILES: Any + +def create_temporary_file(suffix: str = ...): ... + +class WorksheetWriter: + ws: Any + out: Any + xf: Any + def __init__(self, ws, out: Any | None = ...) -> None: ... + def write_properties(self) -> None: ... + def write_dimensions(self) -> None: ... + def write_format(self) -> None: ... + def write_views(self) -> None: ... + def write_cols(self) -> None: ... + def write_top(self) -> None: ... + def rows(self): ... + def write_rows(self) -> None: ... + def write_row(self, xf, row, row_idx) -> None: ... + def write_protection(self) -> None: ... + def write_scenarios(self) -> None: ... + def write_filter(self) -> None: ... + def write_sort(self) -> None: ... + def write_merged_cells(self) -> None: ... + def write_formatting(self) -> None: ... + def write_validations(self) -> None: ... + def write_hyperlinks(self) -> None: ... + def write_print(self) -> None: ... + def write_margins(self) -> None: ... + def write_page(self) -> None: ... + def write_header(self) -> None: ... + def write_breaks(self) -> None: ... + def write_drawings(self) -> None: ... + def write_legacy(self) -> None: ... + def write_tables(self) -> None: ... + def get_stream(self) -> Generator[Any, Any, None]: ... + def write_tail(self) -> None: ... + def write(self) -> None: ... + def close(self) -> None: ... + def read(self): ... + def cleanup(self) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi b/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi new file mode 100644 index 0000000..0074cfd --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/cell_range.pyi @@ -0,0 +1,73 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.descriptors import Strict +from openpyxl.descriptors.serialisable import Serialisable + +class CellRange(Serialisable): # type: ignore[misc] + min_col: Any + min_row: Any + max_col: Any + max_row: Any + title: Any + def __init__( + self, + range_string: Any | None = ..., + min_col: Any | None = ..., + min_row: Any | None = ..., + max_col: Any | None = ..., + max_row: Any | None = ..., + title: Any | None = ..., + ) -> None: ... + @property + def bounds(self): ... + @property + def coord(self): ... + @property + def rows(self) -> Generator[Any, None, None]: ... + @property + def cols(self) -> Generator[Any, None, None]: ... + @property + def cells(self): ... + def __copy__(self): ... + def shift(self, col_shift: int = ..., row_shift: int = ...) -> None: ... + def __ne__(self, other): ... + def __eq__(self, other): ... + def issubset(self, other): ... + __le__: Any + def __lt__(self, other): ... + def issuperset(self, other): ... + __ge__: Any + def __contains__(self, coord): ... + def __gt__(self, other): ... + def isdisjoint(self, other): ... + def intersection(self, other): ... + __and__: Any + def union(self, other): ... + __or__: Any + def __iter__(self): ... + def expand(self, right: int = ..., down: int = ..., left: int = ..., up: int = ...) -> None: ... + def shrink(self, right: int = ..., bottom: int = ..., left: int = ..., top: int = ...) -> None: ... + @property + def size(self): ... + @property + def top(self): ... + @property + def bottom(self): ... + @property + def left(self): ... + @property + def right(self): ... + +class MultiCellRange(Strict): + ranges: Any + def __init__(self, ranges=...) -> None: ... + def __contains__(self, coord): ... + def add(self, coord) -> None: ... + def __iadd__(self, coord): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __bool__(self): ... + def remove(self, coord) -> None: ... + def __iter__(self): ... + def __copy__(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/cell_watch.pyi b/stubs/openpyxl/openpyxl/worksheet/cell_watch.pyi new file mode 100644 index 0000000..bddfaa2 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/cell_watch.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class CellWatch(Serialisable): + tagname: str + r: Any + def __init__(self, r: Any | None = ...) -> None: ... + +class CellWatches(Serialisable): + tagname: str + cellWatch: Any + __elements__: Any + def __init__(self, cellWatch=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/controls.pyi b/stubs/openpyxl/openpyxl/worksheet/controls.pyi new file mode 100644 index 0000000..dac0a45 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/controls.pyi @@ -0,0 +1,55 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ControlProperty(Serialisable): + tagname: str + anchor: Any + locked: Any + defaultSize: Any + disabled: Any + recalcAlways: Any + uiObject: Any + autoFill: Any + autoLine: Any + autoPict: Any + macro: Any + altText: Any + linkedCell: Any + listFillRange: Any + cf: Any + id: Any + __elements__: Any + def __init__( + self, + anchor: Any | None = ..., + locked: bool = ..., + defaultSize: bool = ..., + _print: bool = ..., + disabled: bool = ..., + recalcAlways: bool = ..., + uiObject: bool = ..., + autoFill: bool = ..., + autoLine: bool = ..., + autoPict: bool = ..., + macro: Any | None = ..., + altText: Any | None = ..., + linkedCell: Any | None = ..., + listFillRange: Any | None = ..., + cf: str = ..., + id: Any | None = ..., + ) -> None: ... + +class Control(Serialisable): + tagname: str + controlPr: Any + shapeId: Any + name: Any + __elements__: Any + def __init__(self, controlPr: Any | None = ..., shapeId: Any | None = ..., name: Any | None = ...) -> None: ... + +class Controls(Serialisable): + tagname: str + control: Any + __elements__: Any + def __init__(self, control=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/copier.pyi b/stubs/openpyxl/openpyxl/worksheet/copier.pyi new file mode 100644 index 0000000..728ea63 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/copier.pyi @@ -0,0 +1,7 @@ +from typing import Any + +class WorksheetCopy: + source: Any + target: Any + def __init__(self, source_worksheet, target_worksheet) -> None: ... + def copy_worksheet(self) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/custom.pyi b/stubs/openpyxl/openpyxl/worksheet/custom.pyi new file mode 100644 index 0000000..2e7007c --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/custom.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class CustomProperty(Serialisable): + tagname: str + name: Any + def __init__(self, name: Any | None = ...) -> None: ... + +class CustomProperties(Serialisable): + tagname: str + customPr: Any + __elements__: Any + def __init__(self, customPr=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi b/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi new file mode 100644 index 0000000..2250aba --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi @@ -0,0 +1,72 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +def collapse_cell_addresses(cells, input_ranges=...): ... +def expand_cell_ranges(range_string): ... + +class DataValidation(Serialisable): + tagname: str + sqref: Any + cells: Any + ranges: Any + showErrorMessage: Any + showDropDown: Any + hide_drop_down: Any + showInputMessage: Any + allowBlank: Any + allow_blank: Any + errorTitle: Any + error: Any + promptTitle: Any + prompt: Any + formula1: Any + formula2: Any + type: Any + errorStyle: Any + imeMode: Any + operator: Any + validation_type: Any + def __init__( + self, + type: Any | None = ..., + formula1: Any | None = ..., + formula2: Any | None = ..., + showErrorMessage: bool = ..., + showInputMessage: bool = ..., + showDropDown: Any | None = ..., + allowBlank: Any | None = ..., + sqref=..., + promptTitle: Any | None = ..., + errorStyle: Any | None = ..., + error: Any | None = ..., + prompt: Any | None = ..., + errorTitle: Any | None = ..., + imeMode: Any | None = ..., + operator: Any | None = ..., + allow_blank: Any | None = ..., + ) -> None: ... + def add(self, cell) -> None: ... + def __contains__(self, cell): ... + +class DataValidationList(Serialisable): + tagname: str + disablePrompts: Any + xWindow: Any + yWindow: Any + dataValidation: Any + __elements__: Any + __attrs__: Any + def __init__( + self, + disablePrompts: Any | None = ..., + xWindow: Any | None = ..., + yWindow: Any | None = ..., + count: Any | None = ..., + dataValidation=..., + ) -> None: ... + @property + def count(self): ... + def __len__(self): ... + def append(self, dv) -> None: ... + def to_tree(self, tagname: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi b/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi new file mode 100644 index 0000000..72a8343 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi @@ -0,0 +1,123 @@ +from typing import Any + +from openpyxl.descriptors import Strict +from openpyxl.descriptors.serialisable import Serialisable +from openpyxl.styles.styleable import StyleableObject +from openpyxl.utils.bound_dictionary import BoundDictionary + +class Dimension(Strict, StyleableObject): + __fields__: Any + index: Any + hidden: Any + outlineLevel: Any + outline_level: Any + collapsed: Any + style: Any + def __init__( + self, index, hidden, outlineLevel, collapsed, worksheet, visible: bool = ..., style: Any | None = ... + ) -> None: ... + def __iter__(self): ... + def __copy__(self): ... + +class RowDimension(Dimension): + __fields__: Any + r: Any + s: Any + ht: Any + height: Any + thickBot: Any + thickTop: Any + def __init__( + self, + worksheet, + index: int = ..., + ht: Any | None = ..., + customHeight: Any | None = ..., + s: Any | None = ..., + customFormat: Any | None = ..., + hidden: bool = ..., + outlineLevel: int = ..., + outline_level: Any | None = ..., + collapsed: bool = ..., + visible: Any | None = ..., + height: Any | None = ..., + r: Any | None = ..., + spans: Any | None = ..., + thickBot: Any | None = ..., + thickTop: Any | None = ..., + **kw, + ) -> None: ... + @property + def customFormat(self): ... + @property + def customHeight(self): ... + +class ColumnDimension(Dimension): + width: Any + bestFit: Any + auto_size: Any + index: Any + min: Any + max: Any + collapsed: Any + __fields__: Any + def __init__( + self, + worksheet, + index: str = ..., + width=..., + bestFit: bool = ..., + hidden: bool = ..., + outlineLevel: int = ..., + outline_level: Any | None = ..., + collapsed: bool = ..., + style: Any | None = ..., + min: Any | None = ..., + max: Any | None = ..., + customWidth: bool = ..., + visible: Any | None = ..., + auto_size: Any | None = ..., + ) -> None: ... + @property + def customWidth(self): ... + def reindex(self) -> None: ... + def to_tree(self): ... + +class DimensionHolder(BoundDictionary): + worksheet: Any + max_outline: Any + default_factory: Any + def __init__(self, worksheet, reference: str = ..., default_factory: Any | None = ...) -> None: ... + def group(self, start, end: Any | None = ..., outline_level: int = ..., hidden: bool = ...) -> None: ... + def to_tree(self): ... + +class SheetFormatProperties(Serialisable): + tagname: str + baseColWidth: Any + defaultColWidth: Any + defaultRowHeight: Any + customHeight: Any + zeroHeight: Any + thickTop: Any + thickBottom: Any + outlineLevelRow: Any + outlineLevelCol: Any + def __init__( + self, + baseColWidth: int = ..., + defaultColWidth: Any | None = ..., + defaultRowHeight: int = ..., + customHeight: Any | None = ..., + zeroHeight: Any | None = ..., + thickTop: Any | None = ..., + thickBottom: Any | None = ..., + outlineLevelRow: Any | None = ..., + outlineLevelCol: Any | None = ..., + ) -> None: ... + +class SheetDimension(Serialisable): + tagname: str + ref: Any + def __init__(self, ref: Any | None = ...) -> None: ... + @property + def boundaries(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/drawing.pyi b/stubs/openpyxl/openpyxl/worksheet/drawing.pyi new file mode 100644 index 0000000..4974b43 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/drawing.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Drawing(Serialisable): + tagname: str + id: Any + def __init__(self, id: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/errors.pyi b/stubs/openpyxl/openpyxl/worksheet/errors.pyi new file mode 100644 index 0000000..0403543 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/errors.pyi @@ -0,0 +1,47 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Extension(Serialisable): + tagname: str + uri: Any + def __init__(self, uri: Any | None = ...) -> None: ... + +class ExtensionList(Serialisable): + tagname: str + ext: Any + __elements__: Any + def __init__(self, ext=...) -> None: ... + +class IgnoredError(Serialisable): + tagname: str + sqref: Any + evalError: Any + twoDigitTextYear: Any + numberStoredAsText: Any + formula: Any + formulaRange: Any + unlockedFormula: Any + emptyCellReference: Any + listDataValidation: Any + calculatedColumn: Any + def __init__( + self, + sqref: Any | None = ..., + evalError: bool = ..., + twoDigitTextYear: bool = ..., + numberStoredAsText: bool = ..., + formula: bool = ..., + formulaRange: bool = ..., + unlockedFormula: bool = ..., + emptyCellReference: bool = ..., + listDataValidation: bool = ..., + calculatedColumn: bool = ..., + ) -> None: ... + +class IgnoredErrors(Serialisable): + tagname: str + ignoredError: Any + extLst: Any + __elements__: Any + def __init__(self, ignoredError=..., extLst: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/filters.pyi b/stubs/openpyxl/openpyxl/worksheet/filters.pyi new file mode 100644 index 0000000..77a45c1 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/filters.pyi @@ -0,0 +1,166 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class SortCondition(Serialisable): + tagname: str + descending: Any + sortBy: Any + ref: Any + customList: Any + dxfId: Any + iconSet: Any + iconId: Any + def __init__( + self, + ref: Any | None = ..., + descending: Any | None = ..., + sortBy: Any | None = ..., + customList: Any | None = ..., + dxfId: Any | None = ..., + iconSet: Any | None = ..., + iconId: Any | None = ..., + ) -> None: ... + +class SortState(Serialisable): + tagname: str + columnSort: Any + caseSensitive: Any + sortMethod: Any + ref: Any + sortCondition: Any + extLst: Any + __elements__: Any + def __init__( + self, + columnSort: Any | None = ..., + caseSensitive: Any | None = ..., + sortMethod: Any | None = ..., + ref: Any | None = ..., + sortCondition=..., + extLst: Any | None = ..., + ) -> None: ... + def __bool__(self): ... + +class IconFilter(Serialisable): + tagname: str + iconSet: Any + iconId: Any + def __init__(self, iconSet: Any | None = ..., iconId: Any | None = ...) -> None: ... + +class ColorFilter(Serialisable): + tagname: str + dxfId: Any + cellColor: Any + def __init__(self, dxfId: Any | None = ..., cellColor: Any | None = ...) -> None: ... + +class DynamicFilter(Serialisable): + tagname: str + type: Any + val: Any + valIso: Any + maxVal: Any + maxValIso: Any + def __init__( + self, + type: Any | None = ..., + val: Any | None = ..., + valIso: Any | None = ..., + maxVal: Any | None = ..., + maxValIso: Any | None = ..., + ) -> None: ... + +class CustomFilter(Serialisable): + tagname: str + operator: Any + val: Any + def __init__(self, operator: Any | None = ..., val: Any | None = ...) -> None: ... + +class CustomFilters(Serialisable): + tagname: str + customFilter: Any + __elements__: Any + def __init__(self, _and: Any | None = ..., customFilter=...) -> None: ... + +class Top10(Serialisable): + tagname: str + top: Any + percent: Any + val: Any + filterVal: Any + def __init__( + self, top: Any | None = ..., percent: Any | None = ..., val: Any | None = ..., filterVal: Any | None = ... + ) -> None: ... + +class DateGroupItem(Serialisable): + tagname: str + year: Any + month: Any + day: Any + hour: Any + minute: Any + second: Any + dateTimeGrouping: Any + def __init__( + self, + year: Any | None = ..., + month: Any | None = ..., + day: Any | None = ..., + hour: Any | None = ..., + minute: Any | None = ..., + second: Any | None = ..., + dateTimeGrouping: Any | None = ..., + ) -> None: ... + +class Filters(Serialisable): + tagname: str + blank: Any + calendarType: Any + filter: Any + dateGroupItem: Any + __elements__: Any + def __init__(self, blank: Any | None = ..., calendarType: Any | None = ..., filter=..., dateGroupItem=...) -> None: ... + +class FilterColumn(Serialisable): + tagname: str + colId: Any + col_id: Any + hiddenButton: Any + showButton: Any + filters: Any + top10: Any + customFilters: Any + dynamicFilter: Any + colorFilter: Any + iconFilter: Any + extLst: Any + __elements__: Any + def __init__( + self, + colId: Any | None = ..., + hiddenButton: Any | None = ..., + showButton: Any | None = ..., + filters: Any | None = ..., + top10: Any | None = ..., + customFilters: Any | None = ..., + dynamicFilter: Any | None = ..., + colorFilter: Any | None = ..., + iconFilter: Any | None = ..., + extLst: Any | None = ..., + blank: Any | None = ..., + vals: Any | None = ..., + ) -> None: ... + +class AutoFilter(Serialisable): + tagname: str + ref: Any + filterColumn: Any + sortState: Any + extLst: Any + __elements__: Any + def __init__( + self, ref: Any | None = ..., filterColumn=..., sortState: Any | None = ..., extLst: Any | None = ... + ) -> None: ... + def __bool__(self): ... + def add_filter_column(self, col_id, vals, blank: bool = ...) -> None: ... + def add_sort_condition(self, ref, descending: bool = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/header_footer.pyi b/stubs/openpyxl/openpyxl/worksheet/header_footer.pyi new file mode 100644 index 0000000..3f09bbd --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/header_footer.pyi @@ -0,0 +1,61 @@ +from typing import Any + +from openpyxl.descriptors import Strict +from openpyxl.descriptors.serialisable import Serialisable + +FONT_PATTERN: str +COLOR_PATTERN: str +SIZE_REGEX: str +FORMAT_REGEX: Any + +class _HeaderFooterPart(Strict): + text: Any + font: Any + size: Any + RGB: str + color: Any + def __init__( + self, text: Any | None = ..., font: Any | None = ..., size: Any | None = ..., color: Any | None = ... + ) -> None: ... + def __bool__(self): ... + @classmethod + def from_str(cls, text): ... + +class HeaderFooterItem(Strict): + left: Any + center: Any + centre: Any + right: Any + def __init__(self, left: Any | None = ..., right: Any | None = ..., center: Any | None = ...) -> None: ... + def __bool__(self): ... + def to_tree(self, tagname): ... + @classmethod + def from_tree(cls, node): ... + +class HeaderFooter(Serialisable): + tagname: str + differentOddEven: Any + differentFirst: Any + scaleWithDoc: Any + alignWithMargins: Any + oddHeader: Any + oddFooter: Any + evenHeader: Any + evenFooter: Any + firstHeader: Any + firstFooter: Any + __elements__: Any + def __init__( + self, + differentOddEven: Any | None = ..., + differentFirst: Any | None = ..., + scaleWithDoc: Any | None = ..., + alignWithMargins: Any | None = ..., + oddHeader: Any | None = ..., + oddFooter: Any | None = ..., + evenHeader: Any | None = ..., + evenFooter: Any | None = ..., + firstHeader: Any | None = ..., + firstFooter: Any | None = ..., + ) -> None: ... + def __bool__(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi b/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi new file mode 100644 index 0000000..3ec7b5b --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi @@ -0,0 +1,30 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Hyperlink(Serialisable): + tagname: str + ref: Any + location: Any + tooltip: Any + display: Any + id: Any + target: Any + __attrs__: Any + def __init__( + self, + ref: Any | None = ..., + location: Any | None = ..., + tooltip: Any | None = ..., + display: Any | None = ..., + id: Any | None = ..., + target: Any | None = ..., + ) -> None: ... + +class HyperlinkList(Serialisable): + tagname: str + hyperlink: Any + def __init__(self, hyperlink=...) -> None: ... + def __bool__(self): ... + def __len__(self): ... + def append(self, value) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/merge.pyi b/stubs/openpyxl/openpyxl/worksheet/merge.pyi new file mode 100644 index 0000000..ed70a5e --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/merge.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +from .cell_range import CellRange + +class MergeCell(CellRange): + tagname: str + @property + def ref(self): ... + __attrs__: Any + def __init__(self, ref: Any | None = ...) -> None: ... + def __copy__(self): ... + +class MergeCells(Serialisable): + tagname: str + # Overwritten by property below + # count: Integer + mergeCell: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., mergeCell=...) -> None: ... + @property + def count(self): ... + +class MergedCellRange(CellRange): + ws: Any + start_cell: Any + def __init__(self, worksheet, coord) -> None: ... + def format(self) -> None: ... + def __contains__(self, coord): ... + def __copy__(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/ole.pyi b/stubs/openpyxl/openpyxl/worksheet/ole.pyi new file mode 100644 index 0000000..04270d8 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/ole.pyi @@ -0,0 +1,75 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class ObjectAnchor(Serialisable): + tagname: str + to: Any + moveWithCells: Any + sizeWithCells: Any + z_order: Any + def __init__( + self, + _from: Any | None = ..., + to: Any | None = ..., + moveWithCells: bool = ..., + sizeWithCells: bool = ..., + z_order: Any | None = ..., + ) -> None: ... + +class ObjectPr(Serialisable): + tagname: str + anchor: Any + locked: Any + defaultSize: Any + disabled: Any + uiObject: Any + autoFill: Any + autoLine: Any + autoPict: Any + macro: Any + altText: Any + dde: Any + __elements__: Any + def __init__( + self, + anchor: Any | None = ..., + locked: bool = ..., + defaultSize: bool = ..., + _print: bool = ..., + disabled: bool = ..., + uiObject: bool = ..., + autoFill: bool = ..., + autoLine: bool = ..., + autoPict: bool = ..., + macro: Any | None = ..., + altText: Any | None = ..., + dde: bool = ..., + ) -> None: ... + +class OleObject(Serialisable): + tagname: str + objectPr: Any + progId: Any + dvAspect: Any + link: Any + oleUpdate: Any + autoLoad: Any + shapeId: Any + __elements__: Any + def __init__( + self, + objectPr: Any | None = ..., + progId: Any | None = ..., + dvAspect: str = ..., + link: Any | None = ..., + oleUpdate: Any | None = ..., + autoLoad: bool = ..., + shapeId: Any | None = ..., + ) -> None: ... + +class OleObjects(Serialisable): + tagname: str + oleObject: Any + __elements__: Any + def __init__(self, oleObject=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/page.pyi b/stubs/openpyxl/openpyxl/worksheet/page.pyi new file mode 100644 index 0000000..19b0f0a --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/page.pyi @@ -0,0 +1,90 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class PrintPageSetup(Serialisable): + tagname: str + orientation: Any + paperSize: Any + scale: Any + fitToHeight: Any + fitToWidth: Any + firstPageNumber: Any + useFirstPageNumber: Any + paperHeight: Any + paperWidth: Any + pageOrder: Any + usePrinterDefaults: Any + blackAndWhite: Any + draft: Any + cellComments: Any + errors: Any + horizontalDpi: Any + verticalDpi: Any + copies: Any + id: Any + def __init__( + self, + worksheet: Any | None = ..., + orientation: Any | None = ..., + paperSize: Any | None = ..., + scale: Any | None = ..., + fitToHeight: Any | None = ..., + fitToWidth: Any | None = ..., + firstPageNumber: Any | None = ..., + useFirstPageNumber: Any | None = ..., + paperHeight: Any | None = ..., + paperWidth: Any | None = ..., + pageOrder: Any | None = ..., + usePrinterDefaults: Any | None = ..., + blackAndWhite: Any | None = ..., + draft: Any | None = ..., + cellComments: Any | None = ..., + errors: Any | None = ..., + horizontalDpi: Any | None = ..., + verticalDpi: Any | None = ..., + copies: Any | None = ..., + id: Any | None = ..., + ) -> None: ... + def __bool__(self): ... + @property + def sheet_properties(self): ... + @property + def fitToPage(self): ... + @fitToPage.setter + def fitToPage(self, value) -> None: ... + @property + def autoPageBreaks(self): ... + @autoPageBreaks.setter + def autoPageBreaks(self, value) -> None: ... + @classmethod + def from_tree(cls, node): ... + +class PrintOptions(Serialisable): + tagname: str + horizontalCentered: Any + verticalCentered: Any + headings: Any + gridLines: Any + gridLinesSet: Any + def __init__( + self, + horizontalCentered: Any | None = ..., + verticalCentered: Any | None = ..., + headings: Any | None = ..., + gridLines: Any | None = ..., + gridLinesSet: Any | None = ..., + ) -> None: ... + def __bool__(self): ... + +class PageMargins(Serialisable): + tagname: str + left: Any + right: Any + top: Any + bottom: Any + header: Any + footer: Any + def __init__( + self, left: float = ..., right: float = ..., top: int = ..., bottom: int = ..., header: float = ..., footer: float = ... + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/pagebreak.pyi b/stubs/openpyxl/openpyxl/worksheet/pagebreak.pyi new file mode 100644 index 0000000..4fdcaa2 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/pagebreak.pyi @@ -0,0 +1,40 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Break(Serialisable): + tagname: str + id: Any + min: Any + max: Any + man: Any + pt: Any + def __init__(self, id: int = ..., min: int = ..., max: int = ..., man: bool = ..., pt: Any | None = ...) -> None: ... + +class RowBreak(Serialisable): + tagname: str + # Overwritten by properties below + # count: Integer + # manualBreakCount: Integer + brk: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., manualBreakCount: Any | None = ..., brk=...) -> None: ... + def __bool__(self): ... + def __len__(self): ... + @property + def count(self): ... + @property + def manualBreakCount(self): ... + def append(self, brk: Any | None = ...) -> None: ... + +PageBreak = RowBreak + +class ColBreak(RowBreak): + tagname: str + @property + def count(self): ... + @property + def manualBreakCount(self): ... + brk: Any + __attrs__: Any diff --git a/stubs/openpyxl/openpyxl/worksheet/picture.pyi b/stubs/openpyxl/openpyxl/worksheet/picture.pyi new file mode 100644 index 0000000..71b3f13 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/picture.pyi @@ -0,0 +1,4 @@ +from openpyxl.descriptors.serialisable import Serialisable + +class SheetBackgroundPicture(Serialisable): + tagname: str diff --git a/stubs/openpyxl/openpyxl/worksheet/properties.pyi b/stubs/openpyxl/openpyxl/worksheet/properties.pyi new file mode 100644 index 0000000..1b9f0a5 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/properties.pyi @@ -0,0 +1,54 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Outline(Serialisable): + tagname: str + applyStyles: Any + summaryBelow: Any + summaryRight: Any + showOutlineSymbols: Any + def __init__( + self, + applyStyles: Any | None = ..., + summaryBelow: Any | None = ..., + summaryRight: Any | None = ..., + showOutlineSymbols: Any | None = ..., + ) -> None: ... + +class PageSetupProperties(Serialisable): + tagname: str + autoPageBreaks: Any + fitToPage: Any + def __init__(self, autoPageBreaks: Any | None = ..., fitToPage: Any | None = ...) -> None: ... + +class WorksheetProperties(Serialisable): + tagname: str + codeName: Any + enableFormatConditionsCalculation: Any + filterMode: Any + published: Any + syncHorizontal: Any + syncRef: Any + syncVertical: Any + transitionEvaluation: Any + transitionEntry: Any + tabColor: Any + outlinePr: Any + pageSetUpPr: Any + __elements__: Any + def __init__( + self, + codeName: Any | None = ..., + enableFormatConditionsCalculation: Any | None = ..., + filterMode: Any | None = ..., + published: Any | None = ..., + syncHorizontal: Any | None = ..., + syncRef: Any | None = ..., + syncVertical: Any | None = ..., + transitionEvaluation: Any | None = ..., + transitionEntry: Any | None = ..., + tabColor: Any | None = ..., + outlinePr: Any | None = ..., + pageSetUpPr: Any | None = ..., + ) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/protection.pyi b/stubs/openpyxl/openpyxl/worksheet/protection.pyi new file mode 100644 index 0000000..e164629 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/protection.pyi @@ -0,0 +1,64 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class _Protected: + def set_password(self, value: str = ..., already_hashed: bool = ...) -> None: ... + @property + def password(self): ... + @password.setter + def password(self, value) -> None: ... + +class SheetProtection(Serialisable, _Protected): + tagname: str + sheet: Any + enabled: Any + objects: Any + scenarios: Any + formatCells: Any + formatColumns: Any + formatRows: Any + insertColumns: Any + insertRows: Any + insertHyperlinks: Any + deleteColumns: Any + deleteRows: Any + selectLockedCells: Any + selectUnlockedCells: Any + sort: Any + autoFilter: Any + pivotTables: Any + saltValue: Any + spinCount: Any + algorithmName: Any + hashValue: Any + __attrs__: Any + password: Any + def __init__( + self, + sheet: bool = ..., + objects: bool = ..., + scenarios: bool = ..., + formatCells: bool = ..., + formatRows: bool = ..., + formatColumns: bool = ..., + insertColumns: bool = ..., + insertRows: bool = ..., + insertHyperlinks: bool = ..., + deleteColumns: bool = ..., + deleteRows: bool = ..., + selectLockedCells: bool = ..., + selectUnlockedCells: bool = ..., + sort: bool = ..., + autoFilter: bool = ..., + pivotTables: bool = ..., + password: Any | None = ..., + algorithmName: Any | None = ..., + saltValue: Any | None = ..., + spinCount: Any | None = ..., + hashValue: Any | None = ..., + ) -> None: ... + def set_password(self, value: str = ..., already_hashed: bool = ...) -> None: ... + def enable(self) -> None: ... + def disable(self) -> None: ... + def __bool__(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/related.pyi b/stubs/openpyxl/openpyxl/worksheet/related.pyi new file mode 100644 index 0000000..c0926c6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/related.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Related(Serialisable): # type: ignore[misc] + id: Any + def __init__(self, id: Any | None = ...) -> None: ... + def to_tree(self, tagname, idx: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/openpyxl/openpyxl/worksheet/scenario.pyi b/stubs/openpyxl/openpyxl/worksheet/scenario.pyi new file mode 100644 index 0000000..83286c1 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/scenario.pyi @@ -0,0 +1,48 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class InputCells(Serialisable): + tagname: str + r: Any + deleted: Any + undone: Any + val: Any + numFmtId: Any + def __init__( + self, r: Any | None = ..., deleted: bool = ..., undone: bool = ..., val: Any | None = ..., numFmtId: Any | None = ... + ) -> None: ... + +class Scenario(Serialisable): + tagname: str + inputCells: Any + name: Any + locked: Any + hidden: Any + user: Any + comment: Any + __elements__: Any + __attrs__: Any + def __init__( + self, + inputCells=..., + name: Any | None = ..., + locked: bool = ..., + hidden: bool = ..., + count: Any | None = ..., + user: Any | None = ..., + comment: Any | None = ..., + ) -> None: ... + @property + def count(self): ... + +class ScenarioList(Serialisable): + tagname: str + scenario: Any + current: Any + show: Any + sqref: Any + __elements__: Any + def __init__(self, scenario=..., current: Any | None = ..., show: Any | None = ..., sqref: Any | None = ...) -> None: ... + def append(self, scenario) -> None: ... + def __bool__(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi b/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi new file mode 100644 index 0000000..386ff51 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/smart_tag.pyi @@ -0,0 +1,31 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class CellSmartTagPr(Serialisable): + tagname: str + key: Any + val: Any + def __init__(self, key: Any | None = ..., val: Any | None = ...) -> None: ... + +class CellSmartTag(Serialisable): + tagname: str + cellSmartTagPr: Any + type: Any + deleted: Any + xmlBased: Any + __elements__: Any + def __init__(self, cellSmartTagPr=..., type: Any | None = ..., deleted: bool = ..., xmlBased: bool = ...) -> None: ... + +class CellSmartTags(Serialisable): + tagname: str + cellSmartTag: Any + r: Any + __elements__: Any + def __init__(self, cellSmartTag=..., r: Any | None = ...) -> None: ... + +class SmartTags(Serialisable): + tagname: str + cellSmartTags: Any + __elements__: Any + def __init__(self, cellSmartTags=...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/table.pyi b/stubs/openpyxl/openpyxl/worksheet/table.pyi new file mode 100644 index 0000000..ce808f1 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/table.pyi @@ -0,0 +1,177 @@ +from typing import Any + +from openpyxl.descriptors import String +from openpyxl.descriptors.serialisable import Serialisable + +TABLESTYLES: Any +PIVOTSTYLES: Any + +class TableStyleInfo(Serialisable): + tagname: str + name: Any + showFirstColumn: Any + showLastColumn: Any + showRowStripes: Any + showColumnStripes: Any + def __init__( + self, + name: Any | None = ..., + showFirstColumn: Any | None = ..., + showLastColumn: Any | None = ..., + showRowStripes: Any | None = ..., + showColumnStripes: Any | None = ..., + ) -> None: ... + +class XMLColumnProps(Serialisable): + tagname: str + mapId: Any + xpath: Any + denormalized: Any + xmlDataType: Any + extLst: Any + __elements__: Any + def __init__( + self, + mapId: Any | None = ..., + xpath: Any | None = ..., + denormalized: Any | None = ..., + xmlDataType: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + +class TableFormula(Serialisable): + tagname: str + array: Any + attr_text: Any + text: Any + def __init__(self, array: Any | None = ..., attr_text: Any | None = ...) -> None: ... + +class TableColumn(Serialisable): + tagname: str + id: Any + uniqueName: Any + name: Any + totalsRowFunction: Any + totalsRowLabel: Any + queryTableFieldId: Any + headerRowDxfId: Any + dataDxfId: Any + totalsRowDxfId: Any + headerRowCellStyle: Any + dataCellStyle: Any + totalsRowCellStyle: Any + calculatedColumnFormula: Any + totalsRowFormula: Any + xmlColumnPr: Any + extLst: Any + __elements__: Any + def __init__( + self, + id: Any | None = ..., + uniqueName: Any | None = ..., + name: Any | None = ..., + totalsRowFunction: Any | None = ..., + totalsRowLabel: Any | None = ..., + queryTableFieldId: Any | None = ..., + headerRowDxfId: Any | None = ..., + dataDxfId: Any | None = ..., + totalsRowDxfId: Any | None = ..., + headerRowCellStyle: Any | None = ..., + dataCellStyle: Any | None = ..., + totalsRowCellStyle: Any | None = ..., + calculatedColumnFormula: Any | None = ..., + totalsRowFormula: Any | None = ..., + xmlColumnPr: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + def __iter__(self): ... + @classmethod + def from_tree(cls, node): ... + +class TableNameDescriptor(String): + def __set__(self, instance, value) -> None: ... + +class Table(Serialisable): + mime_type: str + tagname: str + id: Any + name: Any + displayName: Any + comment: Any + ref: Any + tableType: Any + headerRowCount: Any + insertRow: Any + insertRowShift: Any + totalsRowCount: Any + totalsRowShown: Any + published: Any + headerRowDxfId: Any + dataDxfId: Any + totalsRowDxfId: Any + headerRowBorderDxfId: Any + tableBorderDxfId: Any + totalsRowBorderDxfId: Any + headerRowCellStyle: Any + dataCellStyle: Any + totalsRowCellStyle: Any + connectionId: Any + autoFilter: Any + sortState: Any + tableColumns: Any + tableStyleInfo: Any + extLst: Any + __elements__: Any + def __init__( + self, + id: int = ..., + displayName: Any | None = ..., + ref: Any | None = ..., + name: Any | None = ..., + comment: Any | None = ..., + tableType: Any | None = ..., + headerRowCount: int = ..., + insertRow: Any | None = ..., + insertRowShift: Any | None = ..., + totalsRowCount: Any | None = ..., + totalsRowShown: Any | None = ..., + published: Any | None = ..., + headerRowDxfId: Any | None = ..., + dataDxfId: Any | None = ..., + totalsRowDxfId: Any | None = ..., + headerRowBorderDxfId: Any | None = ..., + tableBorderDxfId: Any | None = ..., + totalsRowBorderDxfId: Any | None = ..., + headerRowCellStyle: Any | None = ..., + dataCellStyle: Any | None = ..., + totalsRowCellStyle: Any | None = ..., + connectionId: Any | None = ..., + autoFilter: Any | None = ..., + sortState: Any | None = ..., + tableColumns=..., + tableStyleInfo: Any | None = ..., + extLst: Any | None = ..., + ) -> None: ... + def to_tree(self): ... + @property + def path(self): ... + @property + def column_names(self): ... + +class TablePartList(Serialisable): + tagname: str + # Overwritten by property below + # count: Integer + tablePart: Any + __elements__: Any + __attrs__: Any + def __init__(self, count: Any | None = ..., tablePart=...) -> None: ... + def append(self, part) -> None: ... + @property + def count(self): ... + def __bool__(self): ... + +class TableList(dict[Any, Any]): + def add(self, table) -> None: ... + def get(self, name: Any | None = ..., table_range: Any | None = ...): ... + def items(self): ... diff --git a/stubs/openpyxl/openpyxl/worksheet/views.pyi b/stubs/openpyxl/openpyxl/worksheet/views.pyi new file mode 100644 index 0000000..a4234e4 --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/views.pyi @@ -0,0 +1,84 @@ +from typing import Any + +from openpyxl.descriptors.serialisable import Serialisable + +class Pane(Serialisable): # type: ignore[misc] + xSplit: Any + ySplit: Any + topLeftCell: Any + activePane: Any + state: Any + def __init__( + self, + xSplit: Any | None = ..., + ySplit: Any | None = ..., + topLeftCell: Any | None = ..., + activePane: str = ..., + state: str = ..., + ) -> None: ... + +class Selection(Serialisable): # type: ignore[misc] + pane: Any + activeCell: Any + activeCellId: Any + sqref: Any + def __init__( + self, pane: Any | None = ..., activeCell: str = ..., activeCellId: Any | None = ..., sqref: str = ... + ) -> None: ... + +class SheetView(Serialisable): + tagname: str + windowProtection: Any + showFormulas: Any + showGridLines: Any + showRowColHeaders: Any + showZeros: Any + rightToLeft: Any + tabSelected: Any + showRuler: Any + showOutlineSymbols: Any + defaultGridColor: Any + showWhiteSpace: Any + view: Any + topLeftCell: Any + colorId: Any + zoomScale: Any + zoomScaleNormal: Any + zoomScaleSheetLayoutView: Any + zoomScalePageLayoutView: Any + zoomToFit: Any + workbookViewId: Any + selection: Any + pane: Any + def __init__( + self, + windowProtection: Any | None = ..., + showFormulas: Any | None = ..., + showGridLines: Any | None = ..., + showRowColHeaders: Any | None = ..., + showZeros: Any | None = ..., + rightToLeft: Any | None = ..., + tabSelected: Any | None = ..., + showRuler: Any | None = ..., + showOutlineSymbols: Any | None = ..., + defaultGridColor: Any | None = ..., + showWhiteSpace: Any | None = ..., + view: Any | None = ..., + topLeftCell: Any | None = ..., + colorId: Any | None = ..., + zoomScale: Any | None = ..., + zoomScaleNormal: Any | None = ..., + zoomScaleSheetLayoutView: Any | None = ..., + zoomScalePageLayoutView: Any | None = ..., + zoomToFit: Any | None = ..., + workbookViewId: int = ..., + selection: Any | None = ..., + pane: Any | None = ..., + ) -> None: ... + +class SheetViewList(Serialisable): + tagname: str + sheetView: Any + extLst: Any + __elements__: Any + def __init__(self, sheetView: Any | None = ..., extLst: Any | None = ...) -> None: ... diff --git a/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi b/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi new file mode 100644 index 0000000..615fd2a --- /dev/null +++ b/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi @@ -0,0 +1,129 @@ +from collections.abc import Generator +from typing import Any + +from openpyxl.workbook.child import _WorkbookChild + +class Worksheet(_WorkbookChild): + mime_type: str + BREAK_NONE: int + BREAK_ROW: int + BREAK_COLUMN: int + SHEETSTATE_VISIBLE: str + SHEETSTATE_HIDDEN: str + SHEETSTATE_VERYHIDDEN: str + PAPERSIZE_LETTER: str + PAPERSIZE_LETTER_SMALL: str + PAPERSIZE_TABLOID: str + PAPERSIZE_LEDGER: str + PAPERSIZE_LEGAL: str + PAPERSIZE_STATEMENT: str + PAPERSIZE_EXECUTIVE: str + PAPERSIZE_A3: str + PAPERSIZE_A4: str + PAPERSIZE_A4_SMALL: str + PAPERSIZE_A5: str + ORIENTATION_PORTRAIT: str + ORIENTATION_LANDSCAPE: str + def __init__(self, parent, title: Any | None = ...) -> None: ... + @property + def sheet_view(self): ... + @property + def selected_cell(self): ... + @property + def active_cell(self): ... + @property + def page_breaks(self): ... + @property + def show_gridlines(self): ... + @property + def show_summary_below(self): ... + @property + def show_summary_right(self): ... + @property + def freeze_panes(self): ... + @freeze_panes.setter + def freeze_panes(self, topLeftCell: Any | None = ...) -> None: ... + def cell(self, row, column, value: Any | None = ...): ... + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def __iter__(self): ... + def __delitem__(self, key) -> None: ... + @property + def min_row(self): ... + @property + def max_row(self): ... + @property + def min_column(self): ... + @property + def max_column(self): ... + def calculate_dimension(self): ... + @property + def dimensions(self): ... + def iter_rows( + self, + min_row: Any | None = ..., + max_row: Any | None = ..., + min_col: Any | None = ..., + max_col: Any | None = ..., + values_only: bool = ..., + ): ... + @property + def rows(self): ... + @property + def values(self) -> Generator[Any, None, None]: ... + def iter_cols( + self, + min_col: Any | None = ..., + max_col: Any | None = ..., + min_row: Any | None = ..., + max_row: Any | None = ..., + values_only: bool = ..., + ): ... + @property + def columns(self): ... + def set_printer_settings(self, paper_size, orientation) -> None: ... + def add_data_validation(self, data_validation) -> None: ... + def add_chart(self, chart, anchor: Any | None = ...) -> None: ... + def add_image(self, img, anchor: Any | None = ...) -> None: ... + def add_table(self, table) -> None: ... + @property + def tables(self): ... + def add_pivot(self, pivot) -> None: ... + def merge_cells( + self, + range_string: Any | None = ..., + start_row: Any | None = ..., + start_column: Any | None = ..., + end_row: Any | None = ..., + end_column: Any | None = ..., + ) -> None: ... + @property + def merged_cell_ranges(self): ... + def unmerge_cells( + self, + range_string: Any | None = ..., + start_row: Any | None = ..., + start_column: Any | None = ..., + end_row: Any | None = ..., + end_column: Any | None = ..., + ) -> None: ... + def append(self, iterable) -> None: ... + def insert_rows(self, idx, amount: int = ...) -> None: ... + def insert_cols(self, idx, amount: int = ...) -> None: ... + def delete_rows(self, idx, amount: int = ...) -> None: ... + def delete_cols(self, idx, amount: int = ...) -> None: ... + def move_range(self, cell_range, rows: int = ..., cols: int = ..., translate: bool = ...) -> None: ... + @property + def print_title_rows(self): ... + @print_title_rows.setter + def print_title_rows(self, rows) -> None: ... + @property + def print_title_cols(self): ... + @print_title_cols.setter + def print_title_cols(self, cols) -> None: ... + @property + def print_titles(self): ... + @property + def print_area(self): ... + @print_area.setter + def print_area(self, value) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/remote/__init__.pyi b/stubs/openpyxl/openpyxl/writer/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/remote/__init__.pyi rename to stubs/openpyxl/openpyxl/writer/__init__.pyi diff --git a/stubs/openpyxl/openpyxl/writer/excel.pyi b/stubs/openpyxl/openpyxl/writer/excel.pyi new file mode 100644 index 0000000..57e9d2a --- /dev/null +++ b/stubs/openpyxl/openpyxl/writer/excel.pyi @@ -0,0 +1,13 @@ +from typing import Any + +class ExcelWriter: + workbook: Any + manifest: Any + vba_modified: Any + def __init__(self, workbook, archive) -> None: ... + def write_data(self) -> None: ... + def write_worksheet(self, ws) -> None: ... + def save(self) -> None: ... + +def save_workbook(workbook, filename): ... +def save_virtual_workbook(workbook): ... diff --git a/stubs/openpyxl/openpyxl/writer/theme.pyi b/stubs/openpyxl/openpyxl/writer/theme.pyi new file mode 100644 index 0000000..079c7d6 --- /dev/null +++ b/stubs/openpyxl/openpyxl/writer/theme.pyi @@ -0,0 +1,3 @@ +theme_xml: str + +def write_theme(): ... diff --git a/stubs/openpyxl/openpyxl/xml/__init__.pyi b/stubs/openpyxl/openpyxl/xml/__init__.pyi new file mode 100644 index 0000000..c074aaf --- /dev/null +++ b/stubs/openpyxl/openpyxl/xml/__init__.pyi @@ -0,0 +1,11 @@ +from typing import Any + +def lxml_available(): ... +def lxml_env_set(): ... + +LXML: Any + +def defusedxml_available(): ... +def defusedxml_env_set(): ... + +DEFUSEDXML: Any diff --git a/stubs/openpyxl/openpyxl/xml/constants.pyi b/stubs/openpyxl/openpyxl/xml/constants.pyi new file mode 100644 index 0000000..9380e86 --- /dev/null +++ b/stubs/openpyxl/openpyxl/xml/constants.pyi @@ -0,0 +1,74 @@ +from typing import Any + +MIN_ROW: int +MIN_COLUMN: int +MAX_COLUMN: int +MAX_ROW: int +PACKAGE_PROPS: str +PACKAGE_XL: str +PACKAGE_RELS: str +PACKAGE_THEME: Any +PACKAGE_WORKSHEETS: Any +PACKAGE_CHARTSHEETS: Any +PACKAGE_DRAWINGS: Any +PACKAGE_CHARTS: Any +PACKAGE_IMAGES: Any +PACKAGE_WORKSHEET_RELS: Any +PACKAGE_CHARTSHEETS_RELS: Any +PACKAGE_PIVOT_TABLE: Any +PACKAGE_PIVOT_CACHE: Any +ARC_CONTENT_TYPES: str +ARC_ROOT_RELS: Any +ARC_WORKBOOK_RELS: Any +ARC_CORE: Any +ARC_APP: Any +ARC_WORKBOOK: Any +ARC_STYLE: Any +ARC_THEME: Any +ARC_SHARED_STRINGS: Any +ARC_CUSTOM_UI: str +XML_NS: str +DCORE_NS: str +DCTERMS_NS: str +DCTERMS_PREFIX: str +DOC_NS: str +REL_NS: Any +COMMENTS_NS: Any +IMAGE_NS: Any +VML_NS: Any +VTYPES_NS: Any +XPROPS_NS: Any +EXTERNAL_LINK_NS: Any +PKG_NS: str +PKG_REL_NS: Any +COREPROPS_NS: Any +CONTYPES_NS: Any +XSI_NS: str +SHEET_MAIN_NS: str +CHART_NS: str +DRAWING_NS: str +SHEET_DRAWING_NS: str +CHART_DRAWING_NS: str +CUSTOMUI_NS: str +NAMESPACES: Any +WORKBOOK_MACRO: str +WORKBOOK: str +SPREADSHEET: str +SHARED_STRINGS: Any +EXTERNAL_LINK: Any +WORKSHEET_TYPE: Any +COMMENTS_TYPE: Any +STYLES_TYPE: Any +CHARTSHEET_TYPE: Any +DRAWING_TYPE: str +CHART_TYPE: str +CHARTSHAPE_TYPE: str +THEME_TYPE: str +XLTM: Any +XLSM: Any +XLTX: Any +XLSX: Any +EXT_TYPES: Any +CTRL: str +ACTIVEX: str +VBA: str diff --git a/stubs/openpyxl/openpyxl/xml/functions.pyi b/stubs/openpyxl/openpyxl/xml/functions.pyi new file mode 100644 index 0000000..9c34b83 --- /dev/null +++ b/stubs/openpyxl/openpyxl/xml/functions.pyi @@ -0,0 +1,6 @@ +from typing import Any + +NS_REGEX: Any + +def localname(node): ... +def whitespace(node) -> None: ... diff --git a/stubs/opentracing/@tests/stubtest_allowlist.txt b/stubs/opentracing/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..7c96a34 --- /dev/null +++ b/stubs/opentracing/@tests/stubtest_allowlist.txt @@ -0,0 +1,4 @@ +opentracing.harness.api_check +opentracing.harness.scope_check +opentracing.scope_managers.gevent +opentracing.scope_managers.tornado diff --git a/stubs/opentracing/METADATA.toml b/stubs/opentracing/METADATA.toml new file mode 100644 index 0000000..bcb78f1 --- /dev/null +++ b/stubs/opentracing/METADATA.toml @@ -0,0 +1 @@ +version = "2.4.*" diff --git a/stubs/opentracing/opentracing/__init__.pyi b/stubs/opentracing/opentracing/__init__.pyi new file mode 100644 index 0000000..69d6e6b --- /dev/null +++ b/stubs/opentracing/opentracing/__init__.pyi @@ -0,0 +1,24 @@ +from .propagation import ( + Format as Format, + InvalidCarrierException as InvalidCarrierException, + SpanContextCorruptedException as SpanContextCorruptedException, + UnsupportedFormatException as UnsupportedFormatException, +) +from .scope import Scope as Scope +from .scope_manager import ScopeManager as ScopeManager +from .span import Span as Span, SpanContext as SpanContext +from .tracer import ( + Reference as Reference, + ReferenceType as ReferenceType, + Tracer as Tracer, + child_of as child_of, + follows_from as follows_from, + start_child_span as start_child_span, +) + +tracer: Tracer +is_tracer_registered: bool + +def global_tracer() -> Tracer: ... +def set_global_tracer(value: Tracer) -> None: ... +def is_global_tracer_registered() -> bool: ... diff --git a/stubs/selenium/selenium/webdriver/safari/__init__.pyi b/stubs/opentracing/opentracing/ext/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/safari/__init__.pyi rename to stubs/opentracing/opentracing/ext/__init__.pyi diff --git a/stubs/opentracing/opentracing/ext/tags.pyi b/stubs/opentracing/opentracing/ext/tags.pyi new file mode 100644 index 0000000..08687e5 --- /dev/null +++ b/stubs/opentracing/opentracing/ext/tags.pyi @@ -0,0 +1 @@ +from ..tags import * diff --git a/stubs/selenium/selenium/webdriver/support/__init__.pyi b/stubs/opentracing/opentracing/harness/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/support/__init__.pyi rename to stubs/opentracing/opentracing/harness/__init__.pyi diff --git a/stubs/opentracing/opentracing/harness/api_check.pyi b/stubs/opentracing/opentracing/harness/api_check.pyi new file mode 100644 index 0000000..dcc9734 --- /dev/null +++ b/stubs/opentracing/opentracing/harness/api_check.pyi @@ -0,0 +1,34 @@ +from opentracing.span import Span + +from ..tracer import Tracer + +class APICompatibilityCheckMixin: + def tracer(self) -> Tracer: ... + def check_baggage_values(self) -> bool: ... + def check_scope_manager(self) -> bool: ... + def is_parent(self, parent: Span, span: Span) -> bool: ... + def test_active_span(self) -> None: ... + def test_start_active_span(self) -> None: ... + def test_start_active_span_parent(self) -> None: ... + def test_start_active_span_ignore_active_span(self) -> None: ... + def test_start_active_span_not_finish_on_close(self) -> None: ... + def test_start_active_span_finish_on_close(self) -> None: ... + def test_start_active_span_default_finish_on_close(self) -> None: ... + def test_start_span(self) -> None: ... + def test_start_span_propagation(self) -> None: ... + def test_start_span_propagation_ignore_active_span(self) -> None: ... + def test_start_span_with_parent(self) -> None: ... + def test_start_child_span(self) -> None: ... + def test_set_operation_name(self) -> None: ... + def test_span_as_context_manager(self) -> None: ... + def test_span_tag_value_types(self) -> None: ... + def test_span_tags_with_chaining(self) -> None: ... + def test_span_logs(self) -> None: ... + def test_span_baggage(self) -> None: ... + def test_context_baggage(self) -> None: ... + def test_text_propagation(self) -> None: ... + def test_binary_propagation(self) -> None: ... + def test_mandatory_formats(self) -> None: ... + def test_unknown_format(self) -> None: ... + def test_tracer_start_active_span_scope(self) -> None: ... + def test_tracer_start_span_scope(self) -> None: ... diff --git a/stubs/opentracing/opentracing/harness/scope_check.pyi b/stubs/opentracing/opentracing/harness/scope_check.pyi new file mode 100644 index 0000000..10b5ce1 --- /dev/null +++ b/stubs/opentracing/opentracing/harness/scope_check.pyi @@ -0,0 +1,15 @@ +from collections.abc import Callable + +from ..scope_manager import ScopeManager + +class ScopeCompatibilityCheckMixin: + def scope_manager(self) -> ScopeManager: ... + def run_test(self, test_fn: Callable[[], object]) -> None: ... + def test_missing_active_external(self) -> None: ... + def test_missing_active(self) -> None: ... + def test_activate(self) -> None: ... + def test_activate_external(self) -> None: ... + def test_activate_finish_on_close(self) -> None: ... + def test_activate_nested(self) -> None: ... + def test_activate_finish_on_close_nested(self) -> None: ... + def test_close_wrong_order(self) -> None: ... diff --git a/stubs/opentracing/opentracing/logs.pyi b/stubs/opentracing/opentracing/logs.pyi new file mode 100644 index 0000000..15cda68 --- /dev/null +++ b/stubs/opentracing/opentracing/logs.pyi @@ -0,0 +1,5 @@ +ERROR_KIND: str +ERROR_OBJECT: str +EVENT: str +MESSAGE: str +STACK: str diff --git a/stubs/opentracing/opentracing/mocktracer/__init__.pyi b/stubs/opentracing/opentracing/mocktracer/__init__.pyi new file mode 100644 index 0000000..85fa2ac --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/__init__.pyi @@ -0,0 +1,2 @@ +from .propagator import Propagator as Propagator +from .tracer import MockTracer as MockTracer diff --git a/stubs/opentracing/opentracing/mocktracer/binary_propagator.pyi b/stubs/opentracing/opentracing/mocktracer/binary_propagator.pyi new file mode 100644 index 0000000..33f94f4 --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/binary_propagator.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from .context import SpanContext +from .propagator import Propagator + +class BinaryPropagator(Propagator): + def inject(self, span_context: SpanContext, carrier: dict[Any, Any]) -> None: ... + def extract(self, carrier: dict[Any, Any]) -> SpanContext: ... diff --git a/stubs/opentracing/opentracing/mocktracer/context.pyi b/stubs/opentracing/opentracing/mocktracer/context.pyi new file mode 100644 index 0000000..ef8ed92 --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/context.pyi @@ -0,0 +1,11 @@ +from _typeshed import Self + +import opentracing + +class SpanContext(opentracing.SpanContext): + trace_id: int | None + span_id: int | None + def __init__(self, trace_id: int | None = ..., span_id: int | None = ..., baggage: dict[str, str] | None = ...) -> None: ... + @property + def baggage(self) -> dict[str, str]: ... + def with_baggage_item(self: Self, key: str, value: str) -> Self: ... diff --git a/stubs/opentracing/opentracing/mocktracer/propagator.pyi b/stubs/opentracing/opentracing/mocktracer/propagator.pyi new file mode 100644 index 0000000..0a2ffb4 --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/propagator.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from .context import SpanContext + +class Propagator: + def inject(self, span_context: SpanContext, carrier: dict[Any, Any]) -> None: ... + def extract(self, carrier: dict[Any, Any]) -> SpanContext: ... diff --git a/stubs/opentracing/opentracing/mocktracer/span.pyi b/stubs/opentracing/opentracing/mocktracer/span.pyi new file mode 100644 index 0000000..a54b4d6 --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/span.pyi @@ -0,0 +1,38 @@ +from _typeshed import Self +from typing import Any + +from ..span import Span +from ..tracer import Tracer +from .context import SpanContext +from .tracer import MockTracer + +class MockSpan(Span): + operation_name: str | None + start_time: Any + parent_id: int | None + tags: dict[str, Any] + finish_time: float + finished: bool + logs: list[LogData] + def __init__( + self, + tracer: Tracer, + operation_name: str | None = ..., + context: SpanContext | None = ..., + parent_id: int | None = ..., + tags: dict[str, Any] | None = ..., + start_time: float | None = ..., + ) -> None: ... + @property + def tracer(self) -> MockTracer: ... + @property + def context(self) -> SpanContext: ... + def set_operation_name(self: Self, operation_name: str) -> Self: ... + def set_tag(self: Self, key: str, value: str | bool | float) -> Self: ... + def log_kv(self: Self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ... + def set_baggage_item(self: Self, key: str, value: str) -> Self: ... + +class LogData: + key_values: dict[str, Any] + timestamp: float | None + def __init__(self, key_values: dict[str, Any], timestamp: float | None = ...) -> None: ... diff --git a/stubs/opentracing/opentracing/mocktracer/text_propagator.pyi b/stubs/opentracing/opentracing/mocktracer/text_propagator.pyi new file mode 100644 index 0000000..d828fe2 --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/text_propagator.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from .context import SpanContext +from .propagator import Propagator + +prefix_tracer_state: str +prefix_baggage: str +field_name_trace_id: str +field_name_span_id: str +field_count: int + +class TextPropagator(Propagator): + def inject(self, span_context: SpanContext, carrier: dict[Any, Any]) -> None: ... + def extract(self, carrier: dict[Any, Any]) -> SpanContext: ... diff --git a/stubs/opentracing/opentracing/mocktracer/tracer.pyi b/stubs/opentracing/opentracing/mocktracer/tracer.pyi new file mode 100644 index 0000000..9336c1a --- /dev/null +++ b/stubs/opentracing/opentracing/mocktracer/tracer.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from ..scope_manager import ScopeManager +from ..span import Span +from ..tracer import Reference, Tracer +from .context import SpanContext +from .propagator import Propagator +from .span import MockSpan + +class MockTracer(Tracer): + def __init__(self, scope_manager: ScopeManager | None = ...) -> None: ... + @property + def active_span(self) -> MockSpan | None: ... + def register_propagator(self, format: str, propagator: Propagator) -> None: ... + def finished_spans(self) -> list[MockSpan]: ... + def reset(self) -> None: ... + def start_span( # type: ignore[override] + self, + operation_name: str | None = ..., + child_of: Span | SpanContext | None = ..., + references: list[Reference] | None = ..., + tags: dict[Any, Any] | None = ..., + start_time: float | None = ..., + ignore_active_span: bool = ..., + ) -> MockSpan: ... + def extract(self, format: str, carrier: dict[Any, Any]) -> SpanContext: ... diff --git a/stubs/opentracing/opentracing/propagation.pyi b/stubs/opentracing/opentracing/propagation.pyi new file mode 100644 index 0000000..81307c6 --- /dev/null +++ b/stubs/opentracing/opentracing/propagation.pyi @@ -0,0 +1,8 @@ +class UnsupportedFormatException(Exception): ... +class InvalidCarrierException(Exception): ... +class SpanContextCorruptedException(Exception): ... + +class Format: + BINARY: str + TEXT_MAP: str + HTTP_HEADERS: str diff --git a/stubs/opentracing/opentracing/scope.pyi b/stubs/opentracing/opentracing/scope.pyi new file mode 100644 index 0000000..d3ed839 --- /dev/null +++ b/stubs/opentracing/opentracing/scope.pyi @@ -0,0 +1,17 @@ +from _typeshed import Self +from types import TracebackType + +from .scope_manager import ScopeManager +from .span import Span + +class Scope: + def __init__(self, manager: ScopeManager, span: Span) -> None: ... + @property + def span(self) -> Span: ... + @property + def manager(self) -> ScopeManager: ... + def close(self) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... diff --git a/stubs/opentracing/opentracing/scope_manager.pyi b/stubs/opentracing/opentracing/scope_manager.pyi new file mode 100644 index 0000000..cd07475 --- /dev/null +++ b/stubs/opentracing/opentracing/scope_manager.pyi @@ -0,0 +1,8 @@ +from .scope import Scope +from .span import Span + +class ScopeManager: + def __init__(self) -> None: ... + def activate(self, span: Span, finish_on_close: bool) -> Scope: ... + @property + def active(self) -> Scope | None: ... diff --git a/stubs/opentracing/opentracing/scope_managers/__init__.pyi b/stubs/opentracing/opentracing/scope_managers/__init__.pyi new file mode 100644 index 0000000..2b0f720 --- /dev/null +++ b/stubs/opentracing/opentracing/scope_managers/__init__.pyi @@ -0,0 +1,9 @@ +from ..scope import Scope +from ..scope_manager import ScopeManager +from ..span import Span + +class ThreadLocalScopeManager(ScopeManager): + def __init__(self) -> None: ... + def activate(self, span: Span, finish_on_close: bool) -> Scope: ... + @property + def active(self) -> Scope: ... diff --git a/stubs/opentracing/opentracing/scope_managers/asyncio.pyi b/stubs/opentracing/opentracing/scope_managers/asyncio.pyi new file mode 100644 index 0000000..4b96d78 --- /dev/null +++ b/stubs/opentracing/opentracing/scope_managers/asyncio.pyi @@ -0,0 +1,8 @@ +from ..scope import Scope +from ..scope_managers import ThreadLocalScopeManager +from ..span import Span + +class AsyncioScopeManager(ThreadLocalScopeManager): + def activate(self, span: Span, finish_on_close: bool) -> Scope: ... + @property + def active(self) -> Scope: ... diff --git a/stubs/opentracing/opentracing/scope_managers/constants.pyi b/stubs/opentracing/opentracing/scope_managers/constants.pyi new file mode 100644 index 0000000..0a79198 --- /dev/null +++ b/stubs/opentracing/opentracing/scope_managers/constants.pyi @@ -0,0 +1 @@ +ACTIVE_ATTR: str diff --git a/stubs/opentracing/opentracing/scope_managers/contextvars.pyi b/stubs/opentracing/opentracing/scope_managers/contextvars.pyi new file mode 100644 index 0000000..990045e --- /dev/null +++ b/stubs/opentracing/opentracing/scope_managers/contextvars.pyi @@ -0,0 +1,10 @@ +from ..scope import Scope +from ..scope_manager import ScopeManager +from ..span import Span + +class ContextVarsScopeManager(ScopeManager): + def activate(self, span: Span, finish_on_close: bool) -> Scope: ... + @property + def active(self) -> Scope: ... + +def no_parent_scope() -> None: ... diff --git a/stubs/opentracing/opentracing/scope_managers/gevent.pyi b/stubs/opentracing/opentracing/scope_managers/gevent.pyi new file mode 100644 index 0000000..6b835cd --- /dev/null +++ b/stubs/opentracing/opentracing/scope_managers/gevent.pyi @@ -0,0 +1,8 @@ +from ..scope import Scope +from ..scope_manager import ScopeManager +from ..span import Span + +class GeventScopeManager(ScopeManager): + def activate(self, span: Span, finish_on_close: bool) -> Scope: ... + @property + def active(self) -> Scope: ... diff --git a/stubs/opentracing/opentracing/scope_managers/tornado.pyi b/stubs/opentracing/opentracing/scope_managers/tornado.pyi new file mode 100644 index 0000000..59b1cab --- /dev/null +++ b/stubs/opentracing/opentracing/scope_managers/tornado.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from ..scope import Scope +from ..scope_managers import ThreadLocalScopeManager +from ..span import Span + +class TornadoScopeManager(ThreadLocalScopeManager): + def activate(self, span: Span, finish_on_close: bool) -> Scope: ... + @property + def active(self) -> Scope: ... + +class ThreadSafeStackContext: + contexts: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +def tracer_stack_context() -> ThreadSafeStackContext: ... diff --git a/stubs/opentracing/opentracing/span.pyi b/stubs/opentracing/opentracing/span.pyi new file mode 100644 index 0000000..d4ccb20 --- /dev/null +++ b/stubs/opentracing/opentracing/span.pyi @@ -0,0 +1,29 @@ +from _typeshed import Self +from types import TracebackType +from typing import Any + +from .tracer import Tracer + +class SpanContext: + EMPTY_BAGGAGE: dict[str, str] + @property + def baggage(self) -> dict[str, str]: ... + +class Span: + def __init__(self, tracer: Tracer, context: SpanContext) -> None: ... + @property + def context(self) -> SpanContext: ... + @property + def tracer(self) -> Tracer: ... + def set_operation_name(self: Self, operation_name: str) -> Self: ... + def finish(self, finish_time: float | None = ...) -> None: ... + def set_tag(self: Self, key: str, value: str | bool | float) -> Self: ... + def log_kv(self: Self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ... + def set_baggage_item(self: Self, key: str, value: str) -> Self: ... + def get_baggage_item(self, key: str) -> str | None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + def log_event(self: Self, event: Any, payload: Any | None = ...) -> Self: ... + def log(self: Self, **kwargs: Any) -> Self: ... diff --git a/stubs/opentracing/opentracing/tags.pyi b/stubs/opentracing/opentracing/tags.pyi new file mode 100644 index 0000000..c48c210 --- /dev/null +++ b/stubs/opentracing/opentracing/tags.pyi @@ -0,0 +1,23 @@ +SPAN_KIND: str +SPAN_KIND_RPC_CLIENT: str +SPAN_KIND_RPC_SERVER: str +SPAN_KIND_CONSUMER: str +SPAN_KIND_PRODUCER: str +SERVICE: str +ERROR: str +COMPONENT: str +SAMPLING_PRIORITY: str +PEER_SERVICE: str +PEER_HOSTNAME: str +PEER_ADDRESS: str +PEER_HOST_IPV4: str +PEER_HOST_IPV6: str +PEER_PORT: str +HTTP_URL: str +HTTP_METHOD: str +HTTP_STATUS_CODE: str +DATABASE_INSTANCE: str +DATABASE_STATEMENT: str +DATABASE_TYPE: str +DATABASE_USER: str +MESSAGE_BUS_DESTINATION: str diff --git a/stubs/opentracing/opentracing/tracer.pyi b/stubs/opentracing/opentracing/tracer.pyi new file mode 100644 index 0000000..6dcc47c --- /dev/null +++ b/stubs/opentracing/opentracing/tracer.pyi @@ -0,0 +1,47 @@ +from typing import Any, NamedTuple + +from .scope import Scope +from .scope_manager import ScopeManager +from .span import Span, SpanContext + +class Tracer: + def __init__(self, scope_manager: ScopeManager | None = ...) -> None: ... + @property + def scope_manager(self) -> ScopeManager: ... + @property + def active_span(self) -> Span | None: ... + def start_active_span( + self, + operation_name: str, + child_of: Span | SpanContext | None = ..., + references: list[Reference] | None = ..., + tags: dict[Any, Any] | None = ..., + start_time: float | None = ..., + ignore_active_span: bool = ..., + finish_on_close: bool = ..., + ) -> Scope: ... + def start_span( + self, + operation_name: str | None = ..., + child_of: Span | SpanContext | None = ..., + references: list[Reference] | None = ..., + tags: dict[Any, Any] | None = ..., + start_time: float | None = ..., + ignore_active_span: bool = ..., + ) -> Span: ... + def inject(self, span_context: SpanContext, format: str, carrier: dict[Any, Any]) -> None: ... + def extract(self, format: str, carrier: dict[Any, Any]) -> SpanContext: ... + +class ReferenceType: + CHILD_OF: str + FOLLOWS_FROM: str + +class Reference(NamedTuple): + type: str + referenced_context: SpanContext | None + +def child_of(referenced_context: SpanContext | None = ...) -> Reference: ... +def follows_from(referenced_context: SpanContext | None = ...) -> Reference: ... +def start_child_span( + parent_span: Span, operation_name: str, tags: dict[Any, Any] | None = ..., start_time: float | None = ... +) -> Span: ... diff --git a/stubs/orjson/METADATA.toml b/stubs/orjson/METADATA.toml deleted file mode 100644 index f67b2ab..0000000 --- a/stubs/orjson/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "3.6" -obsolete_since = "3.6.1" diff --git a/stubs/orjson/orjson.pyi b/stubs/orjson/orjson.pyi deleted file mode 100644 index 0c1293d..0000000 --- a/stubs/orjson/orjson.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from collections.abc import Callable -from typing import Any - -__version__: str - -def dumps(__obj: Any, default: Callable[[Any], Any] | None = ..., option: int | None = ...) -> bytes: ... -def loads(__obj: bytes | str) -> Any: ... - -class JSONDecodeError(ValueError): ... -class JSONEncodeError(TypeError): ... - -OPT_APPEND_NEWLINE: int -OPT_INDENT_2: int -OPT_NAIVE_UTC: int -OPT_NON_STR_KEYS: int -OPT_OMIT_MICROSECONDS: int -OPT_PASSTHROUGH_DATACLASS: int -OPT_PASSTHROUGH_DATETIME: int -OPT_PASSTHROUGH_SUBCLASS: int -OPT_SERIALIZE_DATACLASS: int -OPT_SERIALIZE_NUMPY: int -OPT_SERIALIZE_UUID: int -OPT_SORT_KEYS: int -OPT_STRICT_INTEGER: int -OPT_UTC_Z: int diff --git a/stubs/paho-mqtt/METADATA.toml b/stubs/paho-mqtt/METADATA.toml new file mode 100644 index 0000000..6d7acb9 --- /dev/null +++ b/stubs/paho-mqtt/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.6.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/selenium/selenium/webdriver/webkitgtk/__init__.pyi b/stubs/paho-mqtt/paho/__init__.pyi similarity index 100% rename from stubs/selenium/selenium/webdriver/webkitgtk/__init__.pyi rename to stubs/paho-mqtt/paho/__init__.pyi diff --git a/stubs/paho-mqtt/paho/mqtt/__init__.pyi b/stubs/paho-mqtt/paho/mqtt/__init__.pyi new file mode 100644 index 0000000..ce4f3fb --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/__init__.pyi @@ -0,0 +1 @@ +class MQTTException(Exception): ... diff --git a/stubs/paho-mqtt/paho/mqtt/client.pyi b/stubs/paho-mqtt/paho/mqtt/client.pyi new file mode 100644 index 0000000..e2b0a82 --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/client.pyi @@ -0,0 +1,320 @@ +import logging +import socket as _socket +import ssl as _ssl +import time +import types +from collections.abc import Callable +from typing import Any, Optional, TypeVar +from typing_extensions import TypeAlias + +from .matcher import MQTTMatcher as MQTTMatcher +from .properties import Properties as Properties +from .reasoncodes import ReasonCodes as ReasonCodes +from .subscribeoptions import SubscribeOptions as SubscribeOptions + +ssl: types.ModuleType | None +socks: types.ModuleType | None +time_func = time.monotonic +HAVE_DNS: bool +EAGAIN: int | Any +MQTTv31: int +MQTTv311: int +MQTTv5: int +unicode = str +basestring = str +CONNECT: int +CONNACK: int +PUBLISH: int +PUBACK: int +PUBREC: int +PUBREL: int +PUBCOMP: int +SUBSCRIBE: int +SUBACK: int +UNSUBSCRIBE: int +UNSUBACK: int +PINGREQ: int +PINGRESP: int +DISCONNECT: int +AUTH: int +MQTT_LOG_INFO: int +MQTT_LOG_NOTICE: int +MQTT_LOG_WARNING: int +MQTT_LOG_ERR: int +MQTT_LOG_DEBUG: int +LOGGING_LEVEL: dict[int, int] +CONNACK_ACCEPTED: int +CONNACK_REFUSED_PROTOCOL_VERSION: int +CONNACK_REFUSED_IDENTIFIER_REJECTED: int +CONNACK_REFUSED_SERVER_UNAVAILABLE: int +CONNACK_REFUSED_BAD_USERNAME_PASSWORD: int +CONNACK_REFUSED_NOT_AUTHORIZED: int +mqtt_cs_new: int +mqtt_cs_connected: int +mqtt_cs_disconnecting: int +mqtt_cs_connect_async: int +mqtt_ms_invalid: int +mqtt_ms_publish: int +mqtt_ms_wait_for_puback: int +mqtt_ms_wait_for_pubrec: int +mqtt_ms_resend_pubrel: int +mqtt_ms_wait_for_pubrel: int +mqtt_ms_resend_pubcomp: int +mqtt_ms_wait_for_pubcomp: int +mqtt_ms_send_pubrec: int +mqtt_ms_queued: int +MQTT_ERR_AGAIN: int +MQTT_ERR_SUCCESS: int +MQTT_ERR_NOMEM: int +MQTT_ERR_PROTOCOL: int +MQTT_ERR_INVAL: int +MQTT_ERR_NO_CONN: int +MQTT_ERR_CONN_REFUSED: int +MQTT_ERR_NOT_FOUND: int +MQTT_ERR_CONN_LOST: int +MQTT_ERR_TLS: int +MQTT_ERR_PAYLOAD_SIZE: int +MQTT_ERR_NOT_SUPPORTED: int +MQTT_ERR_AUTH: int +MQTT_ERR_ACL_DENIED: int +MQTT_ERR_UNKNOWN: int +MQTT_ERR_ERRNO: int +MQTT_ERR_QUEUE_SIZE: int +MQTT_ERR_KEEPALIVE: int +MQTT_CLIENT: int +MQTT_BRIDGE: int +MQTT_CLEAN_START_FIRST_ONLY: int +sockpair_data: bytes +_UserData: TypeAlias = Any +_Socket: TypeAlias = _socket.socket | _ssl.SSLSocket | Any +_Payload: TypeAlias = str | bytes | bytearray | float +_ExtraHeader: TypeAlias = dict[str, str] | Callable[[dict[str, str]], dict[str, str]] +_OnLog: TypeAlias = Callable[[Client, _UserData, int, str], object] +_OnConnect: TypeAlias = Callable[[Client, _UserData, dict[str, int], int], object] +_OnConnectV5: TypeAlias = Callable[[Client, _UserData, dict[str, int], ReasonCodes, Optional[Properties]], object] +_TOnConnect = TypeVar("_TOnConnect", _OnConnect, _OnConnectV5) +_OnConnectFail: TypeAlias = Callable[[Client, _UserData], object] +_OnSubscribe: TypeAlias = Callable[[Client, _UserData, int, tuple[int]], object] +_OnSubscribeV5: TypeAlias = Callable[[Client, _UserData, int, list[ReasonCodes], Properties], object] +_TOnSubscribe = TypeVar("_TOnSubscribe", _OnSubscribe, _OnSubscribeV5) +_OnMessage: TypeAlias = Callable[[Client, _UserData, MQTTMessage], object] +_OnPublish: TypeAlias = Callable[[Client, _UserData, int], object] +_OnUnsubscribe: TypeAlias = Callable[[Client, _UserData, int], object] +_OnUnsubscribeV5: TypeAlias = Callable[[Client, _UserData, int, Properties, list[ReasonCodes] | ReasonCodes], object] +_TOnUnsubscribe = TypeVar("_TOnUnsubscribe", _OnUnsubscribe, _OnUnsubscribeV5) +_OnDisconnect: TypeAlias = Callable[[Client, _UserData, int], object] +_OnDisconnectV5: TypeAlias = Callable[[Client, _UserData, Optional[ReasonCodes], Optional[Properties]], object] +_TOnDisconnect = TypeVar("_TOnDisconnect", _OnDisconnect, _OnDisconnectV5) +_OnSocket: TypeAlias = Callable[[Client, _UserData, _Socket | WebsocketWrapper | None], object] + +class WebsocketConnectionError(ValueError): ... + +def error_string(mqtt_errno: int) -> str: ... +def connack_string(connack_code: int) -> str: ... +def base62(num: int, base: str = ..., padding: int = ...) -> str: ... +def topic_matches_sub(sub: str, topic: str) -> bool: ... + +class MQTTMessageInfo: + mid: int + rc: int + def __init__(self, mid: int) -> None: ... + def __iter__(self) -> MQTTMessageInfo: ... + def __next__(self) -> int: ... + def next(self) -> int: ... + def __getitem__(self, index: int) -> int: ... + def wait_for_publish(self, timeout: float | None = ...) -> None: ... + def is_published(self) -> bool: ... + +class MQTTMessage: + timestamp: int + state: int + dup: bool + mid: int + payload: bytes | bytearray + qos: int + retain: bool + info: MQTTMessageInfo + properties: Properties | None + def __init__(self, mid: int = ..., topic: bytes | bytearray = ...) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + @property + def topic(self) -> str: ... + @topic.setter + def topic(self, value: bytes | bytearray) -> None: ... + +class Client: + suppress_exceptions: bool + def __init__( + self, + client_id: str | None = ..., + clean_session: bool | None = ..., + userdata: _UserData | None = ..., + protocol: int = ..., + transport: str = ..., + reconnect_on_failure: bool = ..., + ) -> None: ... + def __del__(self) -> None: ... + def reinitialise(self, client_id: str = ..., clean_session: bool = ..., userdata: _UserData | None = ...) -> None: ... + def ws_set_options(self, path: str = ..., headers: _ExtraHeader | None = ...) -> None: ... + def tls_set_context(self, context: _ssl.SSLContext | None = ...) -> None: ... + def tls_set( + self, + ca_certs: str | None = ..., + certfile: str | None = ..., + keyfile: str | None = ..., + cert_reqs: _ssl.VerifyMode | None = ..., + tls_version: _ssl._SSLMethod | None = ..., + ciphers: str | None = ..., + keyfile_password: _ssl._PasswordType | None = ..., + ) -> None: ... + def tls_insecure_set(self, value: bool) -> None: ... + def proxy_set(self, **proxy_args: Any) -> None: ... + def enable_logger(self, logger: logging.Logger | None = ...) -> None: ... + def disable_logger(self) -> None: ... + def connect( + self, + host: str, + port: int = ..., + keepalive: int = ..., + bind_address: str = ..., + bind_port: int = ..., + clean_start: int = ..., + properties: Properties | None = ..., + ) -> int: ... + def connect_srv( + self, + domain: str | None = ..., + keepalive: int = ..., + bind_address: str = ..., + clean_start: int = ..., + properties: Properties | None = ..., + ) -> int: ... + def connect_async( + self, + host: str, + port: int = ..., + keepalive: int = ..., + bind_address: str = ..., + bind_port: int = ..., + clean_start: int = ..., + properties: Properties | None = ..., + ) -> None: ... + def reconnect_delay_set(self, min_delay: int = ..., max_delay: int = ...) -> None: ... + def reconnect(self) -> int: ... + def loop(self, timeout: float = ..., max_packets: int = ...) -> int: ... + def publish( + self, topic: str, payload: _Payload | None = ..., qos: int = ..., retain: bool = ..., properties: Properties | None = ... + ) -> MQTTMessageInfo: ... + def username_pw_set(self, username: str, password: str | bytes | bytearray | None = ...) -> None: ... + def enable_bridge_mode(self) -> None: ... + def is_connected(self) -> bool: ... + def disconnect(self, reasoncode: ReasonCodes | None = ..., properties: Properties | None = ...) -> int: ... + def subscribe( + self, + topic: str | tuple[str, SubscribeOptions] | list[tuple[str, SubscribeOptions]] | list[tuple[str, int]], + qos: int = ..., + options: SubscribeOptions | None = ..., + properties: Properties | None = ..., + ) -> tuple[int, int]: ... + def unsubscribe(self, topic: str | list[str], properties: Properties | None = ...) -> tuple[int, int]: ... + def loop_read(self, max_packets: int = ...) -> int: ... + def loop_write(self, max_packets: int = ...) -> int: ... + def want_write(self) -> bool: ... + def loop_misc(self) -> int: ... + def max_inflight_messages_set(self, inflight: int) -> None: ... + def max_queued_messages_set(self, queue_size: int) -> Client: ... + def message_retry_set(self, retry: object) -> None: ... + def user_data_set(self, userdata: _UserData) -> None: ... + def will_set( + self, topic: str, payload: _Payload | None = ..., qos: int = ..., retain: bool = ..., properties: Properties | None = ... + ) -> None: ... + def will_clear(self) -> None: ... + def socket(self) -> _Socket | WebsocketWrapper: ... + def loop_forever(self, timeout: float = ..., max_packets: int = ..., retry_first_connection: bool = ...) -> int: ... + def loop_start(self) -> int | None: ... + def loop_stop(self, force: bool = ...) -> int | None: ... + @property + def on_log(self) -> _OnLog | None: ... + @on_log.setter + def on_log(self, func: _OnLog | None) -> None: ... + def log_callback(self) -> Callable[[_OnLog], _OnLog]: ... + @property + def on_connect(self) -> _OnConnect | _OnConnectV5 | None: ... + @on_connect.setter + def on_connect(self, func: _OnConnect | _OnConnectV5 | None) -> None: ... + def connect_callback(self) -> Callable[[_TOnConnect], _TOnConnect]: ... + @property + def on_connect_fail(self) -> _OnConnectFail | None: ... + @on_connect_fail.setter + def on_connect_fail(self, func: _OnConnectFail | None) -> None: ... + def connect_fail_callback(self) -> Callable[[_OnConnectFail], _OnConnectFail]: ... + @property + def on_subscribe(self) -> _OnSubscribe | _OnSubscribeV5 | None: ... + @on_subscribe.setter + def on_subscribe(self, func: _OnSubscribe | _OnSubscribeV5 | None) -> None: ... + def subscribe_callback(self) -> Callable[[_TOnSubscribe], _TOnSubscribe]: ... + @property + def on_message(self) -> _OnMessage | None: ... + @on_message.setter + def on_message(self, func: _OnMessage | None) -> None: ... + def message_callback(self) -> Callable[[_OnMessage], _OnMessage]: ... + @property + def on_publish(self) -> _OnPublish | None: ... + @on_publish.setter + def on_publish(self, func: _OnPublish | None) -> None: ... + def publish_callback(self) -> Callable[[_OnPublish], _OnPublish]: ... + @property + def on_unsubscribe(self) -> _OnUnsubscribe | _OnUnsubscribeV5 | None: ... + @on_unsubscribe.setter + def on_unsubscribe(self, func: _OnUnsubscribe | _OnUnsubscribeV5 | None) -> None: ... + def unsubscribe_callback(self) -> Callable[[_TOnUnsubscribe], _TOnUnsubscribe]: ... + @property + def on_disconnect(self) -> _OnDisconnect | _OnDisconnectV5 | None: ... + @on_disconnect.setter + def on_disconnect(self, func: _OnDisconnect | _OnDisconnectV5 | None) -> None: ... + def disconnect_callback(self) -> Callable[[_TOnDisconnect], _TOnDisconnect]: ... + @property + def on_socket_open(self) -> _OnSocket | None: ... + @on_socket_open.setter + def on_socket_open(self, func: _OnSocket | None) -> None: ... + def socket_open_callback(self) -> Callable[[_OnSocket], _OnSocket]: ... + @property + def on_socket_close(self) -> _OnSocket | None: ... + @on_socket_close.setter + def on_socket_close(self, func: _OnSocket | None) -> None: ... + def socket_close_callback(self) -> Callable[[_OnSocket], _OnSocket]: ... + @property + def on_socket_register_write(self) -> _OnSocket | None: ... + @on_socket_register_write.setter + def on_socket_register_write(self, func: _OnSocket | None) -> None: ... + def socket_register_write_callback(self) -> Callable[[_OnSocket], _OnSocket]: ... + @property + def on_socket_unregister_write(self) -> _OnSocket | None: ... + @on_socket_unregister_write.setter + def on_socket_unregister_write(self, func: _OnSocket | None) -> None: ... + def socket_unregister_write_callback(self) -> Callable[[_OnSocket], _OnSocket]: ... + def message_callback_add(self, sub: str, callback: _OnMessage) -> None: ... + def topic_callback(self, sub: str) -> Callable[[_OnMessage], _OnMessage]: ... + def message_callback_remove(self, sub: str) -> None: ... + +class WebsocketWrapper: + OPCODE_CONTINUATION: int + OPCODE_TEXT: int + OPCODE_BINARY: int + OPCODE_CONNCLOSE: int + OPCODE_PING: int + OPCODE_PONG: int + connected: bool + def __init__( + self, socket: _Socket, host: str, port: int, is_ssl: bool, path: str, extra_headers: _ExtraHeader | None + ) -> None: ... + def __del__(self) -> None: ... + def recv(self, length: int) -> bytes | bytearray | None: ... + def read(self, length: int) -> bytes | bytearray | None: ... + def send(self, data: bytes | bytearray) -> int: ... + def write(self, data: bytes | bytearray) -> int: ... + def close(self) -> None: ... + def fileno(self) -> int: ... + def pending(self) -> int: ... + def setblocking(self, flag: bool) -> None: ... diff --git a/stubs/paho-mqtt/paho/mqtt/matcher.pyi b/stubs/paho-mqtt/paho/mqtt/matcher.pyi new file mode 100644 index 0000000..549ac1b --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/matcher.pyi @@ -0,0 +1,11 @@ +from collections.abc import Generator +from typing import Any + +class MQTTMatcher: + class Node: ... + + def __init__(self) -> None: ... + def __setitem__(self, key: str, value: Any) -> None: ... + def __getitem__(self, key: str) -> Any: ... + def __delitem__(self, key: str) -> None: ... + def iter_match(self, topic: str) -> Generator[Any, None, None]: ... diff --git a/stubs/paho-mqtt/paho/mqtt/packettypes.pyi b/stubs/paho-mqtt/paho/mqtt/packettypes.pyi new file mode 100644 index 0000000..2fe5644 --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/packettypes.pyi @@ -0,0 +1,19 @@ +class PacketTypes: + indexes: range + CONNECT: int + CONNACK: int + PUBLISH: int + PUBACK: int + PUBREC: int + PUBREL: int + PUBCOMP: int + SUBSCRIBE: int + SUBACK: int + UNSUBSCRIBE: int + UNSUBACK: int + PINGREQ: int + PINGRESP: int + DISCONNECT: int + AUTH: int + WILLMESSAGE: int + Names: list[str] diff --git a/stubs/paho-mqtt/paho/mqtt/properties.pyi b/stubs/paho-mqtt/paho/mqtt/properties.pyi new file mode 100644 index 0000000..174a6a0 --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/properties.pyi @@ -0,0 +1,38 @@ +from typing import Any + +from . import MQTTException as MQTTException + +class MalformedPacket(MQTTException): ... + +def writeInt16(length: int) -> bytearray: ... +def readInt16(buf: bytes) -> int: ... +def writeInt32(length: int) -> bytearray: ... +def readInt32(buf: bytes) -> int: ... +def writeUTF(data: str | bytes) -> bytearray: ... +def readUTF(buffer: bytes, maxlen: int) -> tuple[str, int]: ... +def writeBytes(buffer: bytes) -> bytearray: ... +def readBytes(buffer: bytes) -> tuple[bytes, int]: ... + +class VariableByteIntegers: + @staticmethod + def encode(x: int) -> bytes: ... + @staticmethod + def decode(buffer: bytes) -> tuple[int, int]: ... + +class Properties: + packetType: int + types: list[str] + names: dict[str, int] + properties: dict[int, tuple[int, list[int]]] + def __init__(self, packetType: int) -> None: ... + def allowsMultiple(self, compressedName: str) -> bool: ... + def getIdentFromName(self, compressedName: str) -> int: ... + def __setattr__(self, name: str, value: Any) -> None: ... + def json(self) -> dict[str, Any]: ... + def isEmpty(self) -> bool: ... + def clear(self) -> None: ... + def writeProperty(self, identifier: int, type: int, value: Any) -> bytes: ... + def pack(self) -> bytes: ... + def readProperty(self, buffer: bytes, type: int, propslen: int) -> Any: ... + def getNameFromIdent(self, identifier: int) -> str | None: ... + def unpack(self, buffer: bytes) -> tuple[Properties, int]: ... diff --git a/stubs/paho-mqtt/paho/mqtt/publish.pyi b/stubs/paho-mqtt/paho/mqtt/publish.pyi new file mode 100644 index 0000000..af14023 --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/publish.pyi @@ -0,0 +1,62 @@ +import ssl +from collections.abc import Iterable +from typing_extensions import NotRequired, TypeAlias, TypedDict + +_Payload: TypeAlias = str | bytes | bytearray | float + +class _Msg(TypedDict): + topic: str + payload: NotRequired[_Payload | None] + qos: NotRequired[int] + retain: NotRequired[int] + +class _Auth(TypedDict): + username: str + password: NotRequired[str] + +class _TLS(TypedDict): + ca_certs: str + certfile: NotRequired[str] + keyfile: NotRequired[str] + tls_version: NotRequired[ssl._SSLMethod] + ciphers: NotRequired[str] + insecure: NotRequired[str] + cert_reqs: NotRequired[ssl.VerifyMode] + keyfile_password: NotRequired[ssl._PasswordType] + +class _Proxy(TypedDict): + proxy_type: int + proxy_addr: str + proxy_rdns: NotRequired[bool] + proxy_username: NotRequired[str] + proxy_passwor: NotRequired[str] + +def multiple( + msgs: Iterable[_Msg], + hostname: str = ..., + port: int = ..., + client_id: str = ..., + keepalive: int = ..., + will: _Msg | None = ..., + auth: _Auth | None = ..., + tls: _TLS | None = ..., + protocol: int = ..., + transport: str = ..., + proxy_args: _Proxy | None = ..., +) -> None: ... +def single( + topic: str, + payload: _Payload | None = ..., + qos: int | None = ..., + retain: bool | None = ..., + hostname: str = ..., + port: int = ..., + client_id: str = ..., + keepalive: int = ..., + will: _Msg | None = ..., + auth: _Auth | None = ..., + tls: _TLS | None = ..., + protocol: int = ..., + transport: str = ..., + proxy_args: _Proxy | None = ..., +) -> None: ... diff --git a/stubs/paho-mqtt/paho/mqtt/reasoncodes.pyi b/stubs/paho-mqtt/paho/mqtt/reasoncodes.pyi new file mode 100644 index 0000000..3a3b20f --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/reasoncodes.pyi @@ -0,0 +1,13 @@ +class ReasonCodes: + packetType: int + names: dict[int, dict[str, list[int]]] + value: int + def __init__(self, packetType: int, aName: str = ..., identifier: int = ...) -> None: ... + def __getName__(self, packetType: int, identifier: int) -> str: ... + def getId(self, name: str) -> int: ... + def set(self, name: str) -> None: ... + def unpack(self, buffer: bytearray) -> int: ... + def getName(self) -> str: ... + def __eq__(self, other: object) -> bool: ... + def json(self) -> str: ... + def pack(self) -> bytearray: ... diff --git a/stubs/paho-mqtt/paho/mqtt/subscribe.pyi b/stubs/paho-mqtt/paho/mqtt/subscribe.pyi new file mode 100644 index 0000000..a9a7e00 --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/subscribe.pyi @@ -0,0 +1,39 @@ +from collections.abc import Callable + +from .client import Client, MQTTMessage, _UserData +from .publish import _TLS, _Auth, _Msg, _Proxy + +def callback( + callback: Callable[[Client, _UserData, MQTTMessage], None], + topics: list[str], + qos: int = ..., + userdata: _UserData | None = ..., + hostname: str = ..., + port: int = ..., + client_id: str = ..., + keepalive: int = ..., + will: _Msg | None = ..., + auth: _Auth | None = ..., + tls: _TLS | None = ..., + protocol: int = ..., + transport: str = ..., + clean_session: bool = ..., + proxy_args: _Proxy | None = ..., +) -> None: ... +def simple( + topics: str | list[str], + qos: int = ..., + msg_count: int = ..., + retained: bool = ..., + hostname: str = ..., + port: int = ..., + client_id: str = ..., + keepalive: int = ..., + will: _Msg | None = ..., + auth: _Auth | None = ..., + tls: _TLS | None = ..., + protocol: int = ..., + transport: str = ..., + clean_session: bool = ..., + proxy_args: _Proxy | None = ..., +) -> list[MQTTMessage] | MQTTMessage: ... diff --git a/stubs/paho-mqtt/paho/mqtt/subscribeoptions.pyi b/stubs/paho-mqtt/paho/mqtt/subscribeoptions.pyi new file mode 100644 index 0000000..4d9c585 --- /dev/null +++ b/stubs/paho-mqtt/paho/mqtt/subscribeoptions.pyi @@ -0,0 +1,25 @@ +from typing import Any +from typing_extensions import TypedDict + +from . import MQTTException as MQTTException + +class _SubscribeOptionsJson(TypedDict): + QoS: int + noLocal: bool + retainAsPublished: bool + retainHandling: int + +class SubscribeOptions: + RETAIN_SEND_ON_SUBSCRIBE: int + RETAIN_SEND_IF_NEW_SUB: int + RETAIN_DO_NOT_SEND: int + names: list[str] + Qos: int + noLocal: bool + retainAsPublished: bool + retainHandling: int + def __init__(self, qos: int = ..., noLocal: bool = ..., retainAsPublished: bool = ..., retainHandling: int = ...) -> None: ... + def __setattr__(self, name: str, value: Any) -> None: ... + def pack(self) -> bytes: ... + def unpack(self, buffer: bytes | bytearray) -> int: ... + def json(self) -> _SubscribeOptionsJson: ... diff --git a/stubs/paramiko/@tests/stubtest_allowlist.txt b/stubs/paramiko/@tests/stubtest_allowlist.txt index 34b27e5..3b8d828 100644 --- a/stubs/paramiko/@tests/stubtest_allowlist.txt +++ b/stubs/paramiko/@tests/stubtest_allowlist.txt @@ -3,25 +3,11 @@ paramiko.Transport.open_x11_channel paramiko.Transport.send_ignore paramiko.Transport.start_server paramiko._winapi -paramiko.py3compat.builtins.bytearray.pop -paramiko.py3compat.builtins.bytearray.remove -paramiko.py3compat.builtins.classmethod.__get__ -paramiko.py3compat.builtins.copyright -paramiko.py3compat.builtins.credits -paramiko.py3compat.builtins.dict.get -paramiko.py3compat.builtins.ellipsis -paramiko.py3compat.builtins.exit -paramiko.py3compat.builtins.function -paramiko.py3compat.builtins.help -paramiko.py3compat.builtins.license -paramiko.py3compat.builtins.memoryview.__contains__ -paramiko.py3compat.builtins.memoryview.__iter__ -paramiko.py3compat.builtins.memoryview.cast -paramiko.py3compat.builtins.object.__init__ -paramiko.py3compat.builtins.property.__get__ -paramiko.py3compat.builtins.quit -paramiko.py3compat.builtins.staticmethod.__get__ paramiko.py3compat.input +paramiko.py3compat.BytesIO.readlines +paramiko.py3compat.BytesIO.seek +paramiko.py3compat.StringIO.seek +paramiko.py3compat.StringIO.truncate paramiko.sftp_server.SFTPServer.__init__ paramiko.transport.Transport.open_x11_channel paramiko.transport.Transport.send_ignore diff --git a/stubs/paramiko/METADATA.toml b/stubs/paramiko/METADATA.toml index 5438db0..932f3f6 100644 --- a/stubs/paramiko/METADATA.toml +++ b/stubs/paramiko/METADATA.toml @@ -1,3 +1,2 @@ -version = "2.7" -python2 = true +version = "2.11.*" requires = ["types-cryptography"] diff --git a/stubs/paramiko/paramiko/__init__.pyi b/stubs/paramiko/paramiko/__init__.pyi index f3e67d0..6d9c20f 100644 --- a/stubs/paramiko/paramiko/__init__.pyi +++ b/stubs/paramiko/paramiko/__init__.pyi @@ -8,7 +8,7 @@ from paramiko.client import ( WarningPolicy as WarningPolicy, ) from paramiko.common import io_sleep as io_sleep -from paramiko.config import SSHConfig as SSHConfig +from paramiko.config import SSHConfig as SSHConfig, SSHConfigDict as SSHConfigDict from paramiko.dsskey import DSSKey as DSSKey from paramiko.ecdsakey import ECDSAKey as ECDSAKey from paramiko.ed25519key import Ed25519Key as Ed25519Key @@ -31,11 +31,16 @@ from paramiko.ssh_exception import ( BadAuthenticationType as BadAuthenticationType, BadHostKeyException as BadHostKeyException, ChannelException as ChannelException, + ConfigParseError as ConfigParseError, + CouldNotCanonicalize as CouldNotCanonicalize, PasswordRequiredException as PasswordRequiredException, ProxyCommandFailure as ProxyCommandFailure, SSHException as SSHException, ) from paramiko.transport import SecurityOptions as SecurityOptions, Transport as Transport +__author__: str +__license__: str + # Names in __all__ with no definition: # util diff --git a/stubs/paramiko/paramiko/_version.pyi b/stubs/paramiko/paramiko/_version.pyi index e75b914..8faa8a2 100644 --- a/stubs/paramiko/paramiko/_version.pyi +++ b/stubs/paramiko/paramiko/_version.pyi @@ -1,3 +1,2 @@ -from typing import Tuple - -__version_info__: Tuple[int, int, int] +__version_info__: tuple[int, int, int] +__version__: str diff --git a/stubs/paramiko/paramiko/_winapi.pyi b/stubs/paramiko/paramiko/_winapi.pyi index 92517ba..7bf5558 100644 --- a/stubs/paramiko/paramiko/_winapi.pyi +++ b/stubs/paramiko/paramiko/_winapi.pyi @@ -1,19 +1,20 @@ import builtins import ctypes import sys +from _typeshed import Self from types import TracebackType -from typing import Any, Type, TypeVar +from typing import Any if sys.platform == "win32": - - _T = TypeVar("_T") def format_system_message(errno: int) -> str | None: ... + class WindowsError(builtins.WindowsError): def __init__(self, value: int | None = ...) -> None: ... @property def message(self) -> str: ... @property def code(self) -> int: ... + def handle_nonzero_success(result: int) -> None: ... GMEM_MOVEABLE: int GlobalAlloc: Any @@ -24,6 +25,7 @@ if sys.platform == "win32": MapViewOfFile: Any UnmapViewOfFile: Any RtlMoveMemory: Any + class MemoryMap: name: str length: int @@ -32,12 +34,12 @@ if sys.platform == "win32": filemap: Any = ... view: Any = ... def __init__(self, name: str, length: int, security_attributes: Any | None = ...) -> None: ... - def __enter__(self: _T) -> _T: ... + def __enter__(self: Self) -> Self: ... def seek(self, pos: int) -> None: ... def write(self, msg: bytes) -> None: ... def read(self, n: int) -> bytes: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, tb: TracebackType | None + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, tb: TracebackType | None ) -> None: ... READ_CONTROL: int STANDARD_RIGHTS_REQUIRED: int @@ -62,15 +64,20 @@ if sys.platform == "win32": POLICY_READ: int POLICY_WRITE: int POLICY_EXECUTE: int + class TokenAccess: TOKEN_QUERY: int + class TokenInformationClass: TokenUser: int + class TOKEN_USER(ctypes.Structure): num: int + class SECURITY_DESCRIPTOR(ctypes.Structure): SECURITY_DESCRIPTOR_CONTROL: Any REVISION: int + class SECURITY_ATTRIBUTES(ctypes.Structure): nLength: int lpSecurityDescriptor: Any @@ -79,6 +86,7 @@ if sys.platform == "win32": def descriptor(self) -> Any: ... @descriptor.setter def descriptor(self, value: Any) -> None: ... + def GetTokenInformation(token: Any, information_class: Any) -> Any: ... def OpenProcessToken(proc_handle: Any, access: Any) -> Any: ... def get_current_user() -> TOKEN_USER: ... diff --git a/stubs/paramiko/paramiko/agent.pyi b/stubs/paramiko/paramiko/agent.pyi index 768b49b..a8a8c53 100644 --- a/stubs/paramiko/paramiko/agent.pyi +++ b/stubs/paramiko/paramiko/agent.pyi @@ -1,6 +1,6 @@ from socket import _RetAddress, socket from threading import Thread -from typing import Protocol, Tuple +from typing import Protocol from paramiko.channel import Channel from paramiko.message import Message @@ -18,7 +18,7 @@ SSH2_AGENT_SIGN_RESPONSE: int class AgentSSH: def __init__(self) -> None: ... - def get_keys(self) -> Tuple[AgentKey, ...]: ... + def get_keys(self) -> tuple[AgentKey, ...]: ... class AgentProxyThread(Thread): def __init__(self, agent: _AgentProxy) -> None: ... @@ -26,11 +26,11 @@ class AgentProxyThread(Thread): class AgentLocalProxy(AgentProxyThread): def __init__(self, agent: AgentServerProxy) -> None: ... - def get_connection(self) -> Tuple[socket, _RetAddress]: ... + def get_connection(self) -> tuple[socket, _RetAddress]: ... class AgentRemoteProxy(AgentProxyThread): def __init__(self, agent: AgentClientProxy, chan: Channel) -> None: ... - def get_connection(self) -> Tuple[socket, _RetAddress]: ... + def get_connection(self) -> tuple[socket, _RetAddress]: ... class AgentClientProxy: thread: Thread @@ -64,4 +64,4 @@ class AgentKey(PKey): def __init__(self, agent: AgentSSH, blob: bytes) -> None: ... def asbytes(self) -> bytes: ... def get_name(self) -> str: ... - def sign_ssh_data(self, data: bytes) -> Message: ... + def sign_ssh_data(self, data: bytes, algorithm: str | None = ...) -> Message: ... diff --git a/stubs/paramiko/paramiko/auth_handler.pyi b/stubs/paramiko/paramiko/auth_handler.pyi index 6c41262..d82d27e 100644 --- a/stubs/paramiko/paramiko/auth_handler.pyi +++ b/stubs/paramiko/paramiko/auth_handler.pyi @@ -1,11 +1,12 @@ +from collections.abc import Callable from threading import Event -from typing import Callable, List, Tuple +from typing_extensions import TypeAlias from paramiko.pkey import PKey from paramiko.ssh_gss import _SSH_GSSAuth from paramiko.transport import Transport -_InteractiveCallback = Callable[[str, str, List[Tuple[str, bool]]], List[str]] +_InteractiveCallback: TypeAlias = Callable[[str, str, list[tuple[str, bool]]], list[str]] class AuthHandler: transport: Transport diff --git a/stubs/paramiko/paramiko/ber.pyi b/stubs/paramiko/paramiko/ber.pyi index 906dd25..831ef1e 100644 --- a/stubs/paramiko/paramiko/ber.pyi +++ b/stubs/paramiko/paramiko/ber.pyi @@ -1,4 +1,5 @@ -from typing import Any, Iterable +from collections.abc import Iterable +from typing import Any class BERException(Exception): ... diff --git a/stubs/paramiko/paramiko/buffered_pipe.pyi b/stubs/paramiko/paramiko/buffered_pipe.pyi index 795c49c..7a67602 100644 --- a/stubs/paramiko/paramiko/buffered_pipe.pyi +++ b/stubs/paramiko/paramiko/buffered_pipe.pyi @@ -1,16 +1,14 @@ from threading import Event -from typing import Generic, Text, TypeVar - -_T = TypeVar("_T", Text, bytes) +from typing import AnyStr, Generic class PipeTimeout(IOError): ... -class BufferedPipe(Generic[_T]): +class BufferedPipe(Generic[AnyStr]): def __init__(self) -> None: ... def set_event(self, event: Event) -> None: ... - def feed(self, data: _T) -> None: ... + def feed(self, data: AnyStr) -> None: ... def read_ready(self) -> bool: ... - def read(self, nbytes: int, timeout: float | None = ...) -> _T: ... - def empty(self) -> _T: ... + def read(self, nbytes: int, timeout: float | None = ...) -> AnyStr: ... + def empty(self) -> AnyStr: ... def close(self) -> None: ... def __len__(self) -> int: ... diff --git a/stubs/paramiko/paramiko/channel.pyi b/stubs/paramiko/paramiko/channel.pyi index 47aacde..f88d5c7 100644 --- a/stubs/paramiko/paramiko/channel.pyi +++ b/stubs/paramiko/paramiko/channel.pyi @@ -1,6 +1,8 @@ +from collections.abc import Callable, Mapping from logging import Logger from threading import Condition, Event, Lock -from typing import Any, Callable, Mapping, Tuple, TypeVar +from typing import Any, TypeVar +from typing_extensions import Literal from paramiko.buffered_pipe import BufferedPipe from paramiko.file import BufferedFile @@ -41,26 +43,26 @@ class Channel(ClosingContextManager): def __init__(self, chanid: int) -> None: ... def __del__(self) -> None: ... def get_pty( - self, term: str = ..., width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ... + self, term: str | bytes = ..., width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ... ) -> None: ... def invoke_shell(self) -> None: ... - def exec_command(self, command: str) -> None: ... - def invoke_subsystem(self, subsystem: str) -> None: ... + def exec_command(self, command: str | bytes) -> None: ... + def invoke_subsystem(self, subsystem: str | bytes) -> None: ... def resize_pty(self, width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ...) -> None: ... - def update_environment(self, environment: Mapping[str, str]) -> None: ... - def set_environment_variable(self, name: str, value: str) -> None: ... + def update_environment(self, environment: Mapping[str | bytes, str | bytes]) -> None: ... + def set_environment_variable(self, name: str | bytes, value: str | bytes) -> None: ... def exit_status_ready(self) -> bool: ... def recv_exit_status(self) -> int: ... def send_exit_status(self, status: int) -> None: ... def request_x11( self, screen_number: int = ..., - auth_protocol: str | None = ..., - auth_cookie: str | None = ..., + auth_protocol: str | bytes | None = ..., + auth_cookie: str | bytes | None = ..., single_connection: bool = ..., - handler: Callable[[Channel, Tuple[str, int]], None] | None = ..., + handler: Callable[[Channel, tuple[str, int]], object] | None = ..., ) -> bytes: ... - def request_forward_agent(self, handler: Callable[[Channel], None]) -> bool: ... + def request_forward_agent(self, handler: Callable[[Channel], object]) -> bool: ... def get_transport(self) -> Transport: ... def set_name(self, name: str) -> None: ... def get_name(self) -> str: ... @@ -68,7 +70,7 @@ class Channel(ClosingContextManager): def set_combine_stderr(self, combine: bool) -> bool: ... def settimeout(self, timeout: float | None) -> None: ... def gettimeout(self) -> float | None: ... - def setblocking(self, blocking: bool) -> None: ... + def setblocking(self, blocking: bool | Literal[0, 1]) -> None: ... def getpeername(self) -> str: ... def close(self) -> None: ... def recv_ready(self) -> bool: ... diff --git a/stubs/paramiko/paramiko/client.pyi b/stubs/paramiko/paramiko/client.pyi index c43eaa8..103c50b 100644 --- a/stubs/paramiko/paramiko/client.pyi +++ b/stubs/paramiko/paramiko/client.pyi @@ -1,5 +1,5 @@ -from socket import socket -from typing import Iterable, Mapping, NoReturn, Tuple, Type +from collections.abc import Iterable, Mapping +from typing import NoReturn from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile from paramiko.hostkeys import HostKeys @@ -8,6 +8,8 @@ from paramiko.sftp_client import SFTPClient from paramiko.transport import Transport from paramiko.util import ClosingContextManager +from .transport import _SocketLike + class SSHClient(ClosingContextManager): def __init__(self) -> None: ... def load_system_host_keys(self, filename: str | None = ...) -> None: ... @@ -15,7 +17,7 @@ class SSHClient(ClosingContextManager): def save_host_keys(self, filename: str) -> None: ... def get_host_keys(self) -> HostKeys: ... def set_log_channel(self, name: str) -> None: ... - def set_missing_host_key_policy(self, policy: Type[MissingHostKeyPolicy] | MissingHostKeyPolicy) -> None: ... + def set_missing_host_key_policy(self, policy: type[MissingHostKeyPolicy] | MissingHostKeyPolicy) -> None: ... def connect( self, hostname: str, @@ -28,7 +30,7 @@ class SSHClient(ClosingContextManager): allow_agent: bool = ..., look_for_keys: bool = ..., compress: bool = ..., - sock: socket | None = ..., + sock: _SocketLike | None = ..., gss_auth: bool = ..., gss_kex: bool = ..., gss_deleg_creds: bool = ..., @@ -47,7 +49,7 @@ class SSHClient(ClosingContextManager): timeout: float | None = ..., get_pty: bool = ..., environment: dict[str, str] | None = ..., - ) -> Tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ... + ) -> tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ... def invoke_shell( self, term: str = ..., diff --git a/stubs/paramiko/paramiko/common.pyi b/stubs/paramiko/paramiko/common.pyi index 26c09d4..3900ce0 100644 --- a/stubs/paramiko/paramiko/common.pyi +++ b/stubs/paramiko/paramiko/common.pyi @@ -1,5 +1,5 @@ -import sys -from typing import Protocol, Text, Union +from typing import Protocol +from typing_extensions import TypeAlias MSG_DISCONNECT: int MSG_IGNORE: int @@ -99,17 +99,13 @@ max_byte: bytes cr_byte: bytes linefeed_byte: bytes crlf: bytes -if sys.version_info >= (3, 0): - cr_byte_value: int - linefeed_byte_value: int -else: - cr_byte_value: bytes - linefeed_byte_value: bytes +cr_byte_value: int +linefeed_byte_value: int class _SupportsAsBytes(Protocol): def asbytes(self) -> bytes: ... -_LikeBytes = Union[bytes, Text, _SupportsAsBytes] +_LikeBytes: TypeAlias = bytes | str | _SupportsAsBytes def asbytes(s: _LikeBytes) -> bytes: ... diff --git a/stubs/paramiko/paramiko/config.pyi b/stubs/paramiko/paramiko/config.pyi index 74b6c26..3e100ed 100644 --- a/stubs/paramiko/paramiko/config.pyi +++ b/stubs/paramiko/paramiko/config.pyi @@ -1,4 +1,7 @@ -from typing import IO, Any, Dict, Iterable, Pattern, Set +from _typeshed import Self +from collections.abc import Iterable +from re import Pattern +from typing import IO, Any from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize @@ -9,15 +12,15 @@ class SSHConfig: TOKENS_BY_CONFIG_KEY: dict[str, list[str]] def __init__(self) -> None: ... @classmethod - def from_text(cls, text: str) -> SSHConfig: ... + def from_text(cls: type[Self], text: str) -> Self: ... @classmethod - def from_path(cls, path: str) -> SSHConfig: ... + def from_path(cls: type[Self], path: str) -> Self: ... @classmethod - def from_file(cls, flo: IO[str]) -> SSHConfig: ... + def from_file(cls: type[Self], flo: IO[str]) -> Self: ... def parse(self, file_obj: IO[str]) -> None: ... def lookup(self, hostname: str) -> SSHConfigDict: ... def canonicalize(self, hostname: str, options: SSHConfigDict, domains: Iterable[str]) -> str: ... - def get_hostnames(self) -> Set[str]: ... + def get_hostnames(self) -> set[str]: ... class LazyFqdn: fqdn: str | None @@ -25,7 +28,7 @@ class LazyFqdn: host: str | None def __init__(self, config: SSHConfigDict, host: str | None = ...) -> None: ... -class SSHConfigDict(Dict[str, str]): +class SSHConfigDict(dict[str, str]): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def as_bool(self, key: str) -> bool: ... def as_int(self, key: str) -> int: ... diff --git a/stubs/paramiko/paramiko/dsskey.pyi b/stubs/paramiko/paramiko/dsskey.pyi index b687655..f98c69f 100644 --- a/stubs/paramiko/paramiko/dsskey.pyi +++ b/stubs/paramiko/paramiko/dsskey.pyi @@ -1,4 +1,5 @@ -from typing import IO, Any, Callable, Tuple +from collections.abc import Callable +from typing import IO from paramiko.message import Message from paramiko.pkey import PKey @@ -17,7 +18,7 @@ class DSSKey(PKey): data: bytes | None = ..., filename: str | None = ..., password: str | None = ..., - vals: Tuple[int, int, int, int] | None = ..., + vals: tuple[int, int, int, int] | None = ..., file_obj: IO[str] | None = ..., ) -> None: ... def asbytes(self) -> bytes: ... @@ -25,9 +26,9 @@ class DSSKey(PKey): def get_name(self) -> str: ... def get_bits(self) -> int: ... def can_sign(self) -> bool: ... - def sign_ssh_data(self, data: bytes) -> Message: ... + def sign_ssh_data(self, data: bytes, algorithm: str | None = ...) -> Message: ... def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ... def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ... @staticmethod - def generate(bits: int = ..., progress_func: Callable[..., Any] | None = ...) -> DSSKey: ... + def generate(bits: int = ..., progress_func: Callable[..., object] | None = ...) -> DSSKey: ... diff --git a/stubs/paramiko/paramiko/ecdsakey.pyi b/stubs/paramiko/paramiko/ecdsakey.pyi index b442356..e5ff63c 100644 --- a/stubs/paramiko/paramiko/ecdsakey.pyi +++ b/stubs/paramiko/paramiko/ecdsakey.pyi @@ -1,4 +1,5 @@ -from typing import IO, Any, Callable, Sequence, Tuple, Type +from collections.abc import Callable, Sequence +from typing import IO, Any from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey from cryptography.hazmat.primitives.hashes import HashAlgorithm @@ -9,15 +10,15 @@ class _ECDSACurve: nist_name: str key_length: int key_format_identifier: str - hash_object: Type[HashAlgorithm] - curve_class: Type[EllipticCurve] - def __init__(self, curve_class: Type[EllipticCurve], nist_name: str) -> None: ... + hash_object: type[HashAlgorithm] + curve_class: type[EllipticCurve] + def __init__(self, curve_class: type[EllipticCurve], nist_name: str) -> None: ... class _ECDSACurveSet: ecdsa_curves: Sequence[_ECDSACurve] def __init__(self, ecdsa_curves: Sequence[_ECDSACurve]) -> None: ... def get_key_format_identifier_list(self) -> list[str]: ... - def get_by_curve_class(self, curve_class: Type[Any]) -> _ECDSACurve | None: ... + def get_by_curve_class(self, curve_class: type[Any]) -> _ECDSACurve | None: ... def get_by_key_format_identifier(self, key_format_identifier: str) -> _ECDSACurve | None: ... def get_by_key_length(self, key_length: int) -> _ECDSACurve | None: ... @@ -32,7 +33,7 @@ class ECDSAKey(PKey): data: bytes | None = ..., filename: str | None = ..., password: str | None = ..., - vals: Tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey] | None = ..., + vals: tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey] | None = ..., file_obj: IO[str] | None = ..., validate_point: bool = ..., ) -> None: ... @@ -43,11 +44,11 @@ class ECDSAKey(PKey): def get_name(self) -> str: ... def get_bits(self) -> int: ... def can_sign(self) -> bool: ... - def sign_ssh_data(self, data: bytes) -> Message: ... + def sign_ssh_data(self, data: bytes, algorithm: str | None = ...) -> Message: ... def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ... def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ... @classmethod def generate( - cls, curve: EllipticCurve = ..., progress_func: Callable[..., Any] | None = ..., bits: int | None = ... + cls, curve: EllipticCurve = ..., progress_func: Callable[..., object] | None = ..., bits: int | None = ... ) -> ECDSAKey: ... diff --git a/stubs/paramiko/paramiko/ed25519key.pyi b/stubs/paramiko/paramiko/ed25519key.pyi index 1f57ba2..43de9aa 100644 --- a/stubs/paramiko/paramiko/ed25519key.pyi +++ b/stubs/paramiko/paramiko/ed25519key.pyi @@ -18,5 +18,5 @@ class Ed25519Key(PKey): def get_name(self) -> str: ... def get_bits(self) -> int: ... def can_sign(self) -> bool: ... - def sign_ssh_data(self, data: bytes) -> Message: ... + def sign_ssh_data(self, data: bytes, algorithm: str | None = ...) -> Message: ... def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... diff --git a/stubs/paramiko/paramiko/file.pyi b/stubs/paramiko/paramiko/file.pyi index dbf35fc..e84863c 100644 --- a/stubs/paramiko/paramiko/file.pyi +++ b/stubs/paramiko/paramiko/file.pyi @@ -1,4 +1,5 @@ -from typing import Any, AnyStr, Generic, Iterable, Tuple +from collections.abc import Iterable +from typing import Any, AnyStr, Generic from paramiko.util import ClosingContextManager @@ -15,7 +16,7 @@ class BufferedFile(ClosingContextManager, Generic[AnyStr]): FLAG_LINE_BUFFERED: int FLAG_UNIVERSAL_NEWLINE: int - newlines: None | AnyStr | Tuple[AnyStr, ...] + newlines: None | AnyStr | tuple[AnyStr, ...] def __init__(self) -> None: ... def __del__(self) -> None: ... def __iter__(self) -> BufferedFile[Any]: ... diff --git a/stubs/paramiko/paramiko/hostkeys.pyi b/stubs/paramiko/paramiko/hostkeys.pyi index c099ac7..96d9d48 100644 --- a/stubs/paramiko/paramiko/hostkeys.pyi +++ b/stubs/paramiko/paramiko/hostkeys.pyi @@ -1,4 +1,5 @@ -from typing import Iterator, Mapping, MutableMapping +from _typeshed import Self +from collections.abc import Iterator, Mapping, MutableMapping from paramiko.pkey import PKey @@ -10,7 +11,7 @@ class _SubDict(MutableMapping[str, PKey]): def __delitem__(self, key: str) -> None: ... def __getitem__(self, key: str) -> PKey: ... def __setitem__(self, key: str, val: PKey) -> None: ... - def keys(self) -> list[str]: ... # type: ignore + def keys(self) -> list[str]: ... # type: ignore[override] class HostKeys(MutableMapping[str, _SubDict]): def __init__(self, filename: str | None = ...) -> None: ... @@ -25,8 +26,8 @@ class HostKeys(MutableMapping[str, _SubDict]): def __getitem__(self, key: str) -> _SubDict: ... def __delitem__(self, key: str) -> None: ... def __setitem__(self, hostname: str, entry: Mapping[str, PKey]) -> None: ... - def keys(self) -> list[str]: ... # type: ignore - def values(self) -> list[_SubDict]: ... # type: ignore + def keys(self) -> list[str]: ... # type: ignore[override] + def values(self) -> list[_SubDict]: ... # type: ignore[override] @staticmethod def hash_host(hostname: str, salt: str | None = ...) -> str: ... @@ -37,9 +38,9 @@ class InvalidHostKey(Exception): class HostKeyEntry: valid: bool - hostnames: str + hostnames: list[str] key: PKey def __init__(self, hostnames: list[str] | None = ..., key: PKey | None = ...) -> None: ... @classmethod - def from_line(cls, line: str, lineno: int | None = ...) -> HostKeyEntry | None: ... + def from_line(cls: type[Self], line: str, lineno: int | None = ...) -> Self | None: ... def to_line(self) -> str | None: ... diff --git a/stubs/paramiko/paramiko/kex_curve25519.pyi b/stubs/paramiko/paramiko/kex_curve25519.pyi index c2811dd..be33b1a 100644 --- a/stubs/paramiko/paramiko/kex_curve25519.pyi +++ b/stubs/paramiko/paramiko/kex_curve25519.pyi @@ -1,16 +1,11 @@ -import sys -from _typeshed import ReadableBuffer as ReadableBuffer -from typing import Callable +from _typeshed import ReadableBuffer +from collections.abc import Callable +from hashlib import _Hash from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey from paramiko.message import Message from paramiko.transport import Transport -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - c_MSG_KEXECDH_INIT: bytes c_MSG_KEXECDH_REPLY: bytes diff --git a/stubs/paramiko/paramiko/kex_ecdh_nist.pyi b/stubs/paramiko/paramiko/kex_ecdh_nist.pyi index aec8d91..3178b18 100644 --- a/stubs/paramiko/paramiko/kex_ecdh_nist.pyi +++ b/stubs/paramiko/paramiko/kex_ecdh_nist.pyi @@ -1,16 +1,11 @@ -import sys from _typeshed import ReadableBuffer -from typing import Callable +from collections.abc import Callable +from hashlib import _Hash from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey from paramiko.message import Message from paramiko.transport import Transport -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - c_MSG_KEXECDH_INIT: bytes c_MSG_KEXECDH_REPLY: bytes diff --git a/stubs/paramiko/paramiko/kex_gex.pyi b/stubs/paramiko/paramiko/kex_gex.pyi index a47717e..d65259a 100644 --- a/stubs/paramiko/paramiko/kex_gex.pyi +++ b/stubs/paramiko/paramiko/kex_gex.pyi @@ -1,15 +1,10 @@ -import sys from _typeshed import ReadableBuffer -from typing import Callable +from collections.abc import Callable +from hashlib import _Hash from paramiko.message import Message from paramiko.transport import Transport -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - c_MSG_KEXDH_GEX_REQUEST_OLD: bytes c_MSG_KEXDH_GEX_GROUP: bytes c_MSG_KEXDH_GEX_INIT: bytes diff --git a/stubs/paramiko/paramiko/kex_group1.pyi b/stubs/paramiko/paramiko/kex_group1.pyi index 8b6ae88..8ff0292 100644 --- a/stubs/paramiko/paramiko/kex_group1.pyi +++ b/stubs/paramiko/paramiko/kex_group1.pyi @@ -1,15 +1,10 @@ -import sys from _typeshed import ReadableBuffer -from typing import Callable +from collections.abc import Callable +from hashlib import _Hash from paramiko.message import Message from paramiko.transport import Transport -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - c_MSG_KEXDH_INIT: bytes c_MSG_KEXDH_REPLY: bytes b7fffffffffffffff: bytes diff --git a/stubs/paramiko/paramiko/kex_group14.pyi b/stubs/paramiko/paramiko/kex_group14.pyi index 276f9e5..a4704af 100644 --- a/stubs/paramiko/paramiko/kex_group14.pyi +++ b/stubs/paramiko/paramiko/kex_group14.pyi @@ -1,14 +1,9 @@ -import sys from _typeshed import ReadableBuffer -from typing import Callable +from collections.abc import Callable +from hashlib import _Hash from paramiko.kex_group1 import KexGroup1 as KexGroup1 -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - class KexGroup14(KexGroup1): P: int G: int diff --git a/stubs/paramiko/paramiko/kex_group16.pyi b/stubs/paramiko/paramiko/kex_group16.pyi index d85490c..37f29bb 100644 --- a/stubs/paramiko/paramiko/kex_group16.pyi +++ b/stubs/paramiko/paramiko/kex_group16.pyi @@ -1,14 +1,9 @@ -import sys from _typeshed import ReadableBuffer -from typing import Callable +from collections.abc import Callable +from hashlib import _Hash from paramiko.kex_group1 import KexGroup1 as KexGroup1 -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - class KexGroup16SHA512(KexGroup1): name: str P: int diff --git a/stubs/paramiko/paramiko/message.pyi b/stubs/paramiko/paramiko/message.pyi index e4fd1df..0a69bb8 100644 --- a/stubs/paramiko/paramiko/message.pyi +++ b/stubs/paramiko/paramiko/message.pyi @@ -1,15 +1,9 @@ -import sys -from typing import Any, Iterable, Text +from collections.abc import Iterable +from io import BytesIO +from typing import Any from .common import _LikeBytes -if sys.version_info >= (3, 0): - from io import BytesIO -else: - from StringIO import StringIO - - BytesIO = StringIO[bytes] - class Message: big_int: int packet: BytesIO @@ -27,7 +21,7 @@ class Message: def get_int64(self) -> int: ... def get_mpint(self) -> int: ... def get_string(self) -> bytes: ... - def get_text(self) -> Text: ... + def get_text(self) -> str: ... def get_binary(self) -> bytes: ... def get_list(self) -> list[str]: ... def add_bytes(self, b: bytes) -> Message: ... diff --git a/stubs/paramiko/paramiko/packet.pyi b/stubs/paramiko/paramiko/packet.pyi index ffbf10e..f7e62d8 100644 --- a/stubs/paramiko/paramiko/packet.pyi +++ b/stubs/paramiko/paramiko/packet.pyi @@ -1,17 +1,13 @@ -import sys +from collections.abc import Callable +from hashlib import _Hash from logging import Logger from socket import socket -from typing import Any, Callable, Tuple +from typing import Any from cryptography.hazmat.primitives.ciphers import Cipher from paramiko.compress import ZlibCompressor, ZlibDecompressor from paramiko.message import Message -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - def compute_hmac(key: bytes, message: bytes, digest_class: _Hash) -> bytes: ... class NeedRekeyException(Exception): ... @@ -48,7 +44,7 @@ class Packetizer: def get_mac_size_in(self) -> int: ... def get_mac_size_out(self) -> int: ... def need_rekey(self) -> bool: ... - def set_keepalive(self, interval: int, callback: Callable[[], None]) -> None: ... + def set_keepalive(self, interval: int, callback: Callable[[], object]) -> None: ... def read_timer(self) -> None: ... def start_handshake(self, timeout: float) -> None: ... def handshake_timed_out(self) -> bool: ... @@ -57,4 +53,4 @@ class Packetizer: def write_all(self, out: bytes) -> None: ... def readline(self, timeout: float) -> str: ... def send_message(self, data: Message) -> None: ... - def read_message(self) -> Tuple[int, Message]: ... + def read_message(self) -> tuple[int, Message]: ... diff --git a/stubs/paramiko/paramiko/pipe.pyi b/stubs/paramiko/paramiko/pipe.pyi index 92bf86f..e9b1635 100644 --- a/stubs/paramiko/paramiko/pipe.pyi +++ b/stubs/paramiko/paramiko/pipe.pyi @@ -1,4 +1,4 @@ -from typing import Protocol, Tuple +from typing import Protocol class _BasePipe(Protocol): def clear(self) -> None: ... @@ -11,7 +11,7 @@ class _Pipe(_BasePipe, Protocol): def make_pipe() -> _Pipe: ... -class PosixPipe(object): +class PosixPipe: def __init__(self) -> None: ... def close(self) -> None: ... def fileno(self) -> int: ... @@ -19,7 +19,7 @@ class PosixPipe(object): def set(self) -> None: ... def set_forever(self) -> None: ... -class WindowsPipe(object): +class WindowsPipe: def __init__(self) -> None: ... def close(self) -> None: ... def fileno(self) -> int: ... @@ -32,4 +32,4 @@ class OrPipe: def set(self) -> None: ... def clear(self) -> None: ... -def make_or_pipe(pipe: _Pipe) -> Tuple[OrPipe, OrPipe]: ... +def make_or_pipe(pipe: _Pipe) -> tuple[OrPipe, OrPipe]: ... diff --git a/stubs/paramiko/paramiko/pkey.pyi b/stubs/paramiko/paramiko/pkey.pyi index 4990501..6dd72d5 100644 --- a/stubs/paramiko/paramiko/pkey.pyi +++ b/stubs/paramiko/paramiko/pkey.pyi @@ -1,13 +1,13 @@ -from typing import IO, Pattern, Type, TypeVar +from _typeshed import Self +from re import Pattern +from typing import IO from paramiko.message import Message -OPENSSH_AUTH_MAGIC: bytes = ... +OPENSSH_AUTH_MAGIC: bytes def _unpad_openssh(data: bytes) -> bytes: ... -_PK = TypeVar("_PK", bound=PKey) - class PKey: public_blob: PublicBlob | None BEGIN_TAG: Pattern[str] @@ -21,12 +21,12 @@ class PKey: def can_sign(self) -> bool: ... def get_fingerprint(self) -> bytes: ... def get_base64(self) -> str: ... - def sign_ssh_data(self, data: bytes) -> Message: ... + def sign_ssh_data(self, data: bytes, algorithm: str | None = ...) -> Message: ... def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... @classmethod - def from_private_key_file(cls: Type[_PK], filename: str, password: str | None = ...) -> _PK: ... + def from_private_key_file(cls: type[Self], filename: str, password: str | None = ...) -> Self: ... @classmethod - def from_private_key(cls: Type[_PK], file_obj: IO[str], password: str | None = ...) -> _PK: ... + def from_private_key(cls: type[Self], file_obj: IO[str], password: str | None = ...) -> Self: ... def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ... def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ... def load_certificate(self, value: Message | str) -> None: ... @@ -37,10 +37,10 @@ class PublicBlob: comment: str def __init__(self, type_: str, blob: bytes, comment: str | None = ...) -> None: ... @classmethod - def from_file(cls, filename: str) -> PublicBlob: ... + def from_file(cls: type[Self], filename: str) -> Self: ... @classmethod - def from_string(cls, string: str) -> PublicBlob: ... + def from_string(cls: type[Self], string: str) -> Self: ... @classmethod - def from_message(cls, message: Message) -> PublicBlob: ... + def from_message(cls: type[Self], message: Message) -> Self: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... diff --git a/stubs/paramiko/paramiko/primes.pyi b/stubs/paramiko/paramiko/primes.pyi index efc7485..3d7cccd 100644 --- a/stubs/paramiko/paramiko/primes.pyi +++ b/stubs/paramiko/paramiko/primes.pyi @@ -1,8 +1,6 @@ -from typing import Tuple - class ModulusPack: - pack: dict[int, list[Tuple[int, int]]] - discarded: list[Tuple[int, str]] + pack: dict[int, list[tuple[int, int]]] + discarded: list[tuple[int, str]] def __init__(self) -> None: ... def read_file(self, filename: str) -> None: ... - def get_modulus(self, min: int, prefer: int, max: int) -> Tuple[int, int]: ... + def get_modulus(self, min: int, prefer: int, max: int) -> tuple[int, int]: ... diff --git a/stubs/paramiko/paramiko/py3compat.pyi b/stubs/paramiko/paramiko/py3compat.pyi index b41a04f..9f64106 100644 --- a/stubs/paramiko/paramiko/py3compat.pyi +++ b/stubs/paramiko/paramiko/py3compat.pyi @@ -1,40 +1,29 @@ -import sys -from typing import Any, Iterable, Sequence, Text, Type, TypeVar +import builtins as builtins +from collections.abc import Iterable, Sequence +from io import BytesIO as BytesIO, StringIO as StringIO +from typing import Any, TypeVar _T = TypeVar("_T") PY2: bool -string_types: Type[Any] | Sequence[Type[Any]] -text_type: Type[Any] | Sequence[Type[Any]] -bytes_types: Type[Any] | Sequence[Type[Any]] -integer_types: Type[Any] | Sequence[Type[Any]] +string_types: type[Any] | Sequence[type[Any]] +text_type: type[Any] | Sequence[type[Any]] +bytes_types: type[Any] | Sequence[type[Any]] +integer_types: type[Any] | Sequence[type[Any]] long = int def input(prompt: Any) -> str: ... def decodebytes(s: bytes) -> bytes: ... def encodebytes(s: bytes) -> bytes: ... -if sys.version_info >= (3, 0): - import builtins as builtins - import io - - StringIO = io.StringIO - BytesIO = io.BytesIO -else: - import __builtin__ as builtins - import cStringIO - - StringIO = cStringIO.StringIO - BytesIO = StringIO - bytes = builtins.bytes def byte_ord(c: int | str) -> int: ... def byte_chr(c: int) -> bytes: ... def byte_mask(c: int, mask: int) -> bytes: ... def b(s: bytes | str, encoding: str = ...) -> bytes: ... -def u(s: bytes | str, encoding: str = ...) -> Text: ... +def u(s: bytes | str, encoding: str = ...) -> str: ... def b2s(s: bytes | str) -> str: ... def is_callable(c: Any) -> bool: ... def next(c: Iterable[_T]) -> _T: ... diff --git a/stubs/paramiko/paramiko/rsakey.pyi b/stubs/paramiko/paramiko/rsakey.pyi index 7c76e60..477ac32 100644 --- a/stubs/paramiko/paramiko/rsakey.pyi +++ b/stubs/paramiko/paramiko/rsakey.pyi @@ -1,4 +1,5 @@ -from typing import IO, Any, Callable +from collections.abc import Callable +from typing import IO from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey, RSAPublicNumbers from paramiko.message import Message @@ -25,9 +26,9 @@ class RSAKey(PKey): def get_name(self) -> str: ... def get_bits(self) -> int: ... def can_sign(self) -> bool: ... - def sign_ssh_data(self, data: bytes) -> Message: ... + def sign_ssh_data(self, data: bytes, algorithm: str = ...) -> Message: ... # type: ignore[override] def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ... def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ... @staticmethod - def generate(bits: int, progress_func: Callable[..., Any] | None = ...) -> RSAKey: ... + def generate(bits: int, progress_func: Callable[..., object] | None = ...) -> RSAKey: ... diff --git a/stubs/paramiko/paramiko/server.pyi b/stubs/paramiko/paramiko/server.pyi index 1b18ec5..5bc25c3 100644 --- a/stubs/paramiko/paramiko/server.pyi +++ b/stubs/paramiko/paramiko/server.pyi @@ -1,5 +1,4 @@ import threading -from typing import Any, Tuple from paramiko.channel import Channel from paramiko.message import Message @@ -19,9 +18,9 @@ class ServerInterface: def enable_auth_gssapi(self) -> bool: ... def check_port_forward_request(self, address: str, port: int) -> int: ... def cancel_port_forward_request(self, address: str, port: int) -> None: ... - def check_global_request(self, kind: str, msg: Message) -> bool | Tuple[Any, ...]: ... + def check_global_request(self, kind: str, msg: Message) -> bool | tuple[bool | int | str, ...]: ... def check_channel_pty_request( - self, channel: Channel, term: str, width: int, height: int, pixelwidth: int, pixelheight: int, modes: str + self, channel: Channel, term: bytes, width: int, height: int, pixelwidth: int, pixelheight: int, modes: bytes ) -> bool: ... def check_channel_shell_request(self, channel: Channel) -> bool: ... def check_channel_exec_request(self, channel: Channel, command: bytes) -> bool: ... @@ -33,15 +32,15 @@ class ServerInterface: self, channel: Channel, single_connection: bool, auth_protocol: str, auth_cookie: bytes, screen_number: int ) -> bool: ... def check_channel_forward_agent_request(self, channel: Channel) -> bool: ... - def check_channel_direct_tcpip_request(self, chanid: int, origin: Tuple[str, int], destination: Tuple[str, int]) -> int: ... - def check_channel_env_request(self, channel: Channel, name: str, value: str) -> bool: ... - def get_banner(self) -> Tuple[str | None, str | None]: ... + def check_channel_direct_tcpip_request(self, chanid: int, origin: tuple[str, int], destination: tuple[str, int]) -> int: ... + def check_channel_env_request(self, channel: Channel, name: bytes, value: bytes) -> bool: ... + def get_banner(self) -> tuple[str | None, str | None]: ... class InteractiveQuery: name: str instructions: str - prompts: list[Tuple[str, bool]] - def __init__(self, name: str = ..., instructions: str = ..., *prompts: str | Tuple[str, bool]) -> None: ... + prompts: list[tuple[str, bool]] + def __init__(self, name: str = ..., instructions: str = ..., *prompts: str | tuple[str, bool]) -> None: ... def add_prompt(self, prompt: str, echo: bool = ...) -> None: ... class SubsystemHandler(threading.Thread): diff --git a/stubs/paramiko/paramiko/sftp_attr.pyi b/stubs/paramiko/paramiko/sftp_attr.pyi index 361e4f0..3a397ff 100644 --- a/stubs/paramiko/paramiko/sftp_attr.pyi +++ b/stubs/paramiko/paramiko/sftp_attr.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from os import stat_result class SFTPAttributes: @@ -17,5 +18,5 @@ class SFTPAttributes: attr: dict[str, str] def __init__(self) -> None: ... @classmethod - def from_stat(cls, obj: stat_result, filename: str | None = ...) -> SFTPAttributes: ... + def from_stat(cls: type[Self], obj: stat_result, filename: str | None = ...) -> Self: ... def asbytes(self) -> bytes: ... diff --git a/stubs/paramiko/paramiko/sftp_client.pyi b/stubs/paramiko/paramiko/sftp_client.pyi index a8f7b65..ebaa92c 100644 --- a/stubs/paramiko/paramiko/sftp_client.pyi +++ b/stubs/paramiko/paramiko/sftp_client.pyi @@ -1,5 +1,8 @@ +from _typeshed import Self +from collections.abc import Callable, Iterator from logging import Logger -from typing import IO, Any, Callable, Iterator, Text, Tuple +from typing import IO +from typing_extensions import TypeAlias from paramiko.channel import Channel from paramiko.sftp import BaseSFTP @@ -8,7 +11,7 @@ from paramiko.sftp_file import SFTPFile from paramiko.transport import Transport from paramiko.util import ClosingContextManager -_Callback = Callable[[int, int], Any] +_Callback: TypeAlias = Callable[[int, int], object] b_slash: bytes @@ -20,39 +23,41 @@ class SFTPClient(BaseSFTP, ClosingContextManager): def __init__(self, sock: Channel) -> None: ... @classmethod def from_transport( - cls, t: Transport, window_size: int | None = ..., max_packet_size: int | None = ... - ) -> SFTPClient | None: ... + cls: type[Self], t: Transport, window_size: int | None = ..., max_packet_size: int | None = ... + ) -> Self | None: ... def close(self) -> None: ... def get_channel(self) -> Channel | None: ... def listdir(self, path: str = ...) -> list[str]: ... def listdir_attr(self, path: str = ...) -> list[SFTPAttributes]: ... - def listdir_iter(self, path: bytes | Text = ..., read_aheads: int = ...) -> Iterator[SFTPAttributes]: ... - def open(self, filename: bytes | Text, mode: str = ..., bufsize: int = ...) -> SFTPFile: ... + def listdir_iter(self, path: bytes | str = ..., read_aheads: int = ...) -> Iterator[SFTPAttributes]: ... + def open(self, filename: bytes | str, mode: str = ..., bufsize: int = ...) -> SFTPFile: ... file = open - def remove(self, path: bytes | Text) -> None: ... + def remove(self, path: bytes | str) -> None: ... unlink = remove - def rename(self, oldpath: bytes | Text, newpath: bytes | Text) -> None: ... - def posix_rename(self, oldpath: bytes | Text, newpath: bytes | Text) -> None: ... - def mkdir(self, path: bytes | Text, mode: int = ...) -> None: ... - def rmdir(self, path: bytes | Text) -> None: ... - def stat(self, path: bytes | Text) -> SFTPAttributes: ... - def lstat(self, path: bytes | Text) -> SFTPAttributes: ... - def symlink(self, source: bytes | Text, dest: bytes | Text) -> None: ... - def chmod(self, path: bytes | Text, mode: int) -> None: ... - def chown(self, path: bytes | Text, uid: int, gid: int) -> None: ... - def utime(self, path: bytes | Text, times: Tuple[float, float] | None) -> None: ... - def truncate(self, path: bytes | Text, size: int) -> None: ... - def readlink(self, path: bytes | Text) -> Text | None: ... - def normalize(self, path: bytes | Text) -> Text: ... - def chdir(self, path: None | bytes | Text = ...) -> None: ... - def getcwd(self) -> Text | None: ... + def rename(self, oldpath: bytes | str, newpath: bytes | str) -> None: ... + def posix_rename(self, oldpath: bytes | str, newpath: bytes | str) -> None: ... + def mkdir(self, path: bytes | str, mode: int = ...) -> None: ... + def rmdir(self, path: bytes | str) -> None: ... + def stat(self, path: bytes | str) -> SFTPAttributes: ... + def lstat(self, path: bytes | str) -> SFTPAttributes: ... + def symlink(self, source: bytes | str, dest: bytes | str) -> None: ... + def chmod(self, path: bytes | str, mode: int) -> None: ... + def chown(self, path: bytes | str, uid: int, gid: int) -> None: ... + def utime(self, path: bytes | str, times: tuple[float, float] | None) -> None: ... + def truncate(self, path: bytes | str, size: int) -> None: ... + def readlink(self, path: bytes | str) -> str | None: ... + def normalize(self, path: bytes | str) -> str: ... + def chdir(self, path: None | bytes | str = ...) -> None: ... + def getcwd(self) -> str | None: ... def putfo( - self, fl: IO[bytes], remotepath: bytes | Text, file_size: int = ..., callback: _Callback | None = ..., confirm: bool = ... + self, fl: IO[bytes], remotepath: bytes | str, file_size: int = ..., callback: _Callback | None = ..., confirm: bool = ... ) -> SFTPAttributes: ... def put( - self, localpath: bytes | Text, remotepath: bytes | Text, callback: _Callback | None = ..., confirm: bool = ... + self, localpath: bytes | str, remotepath: bytes | str, callback: _Callback | None = ..., confirm: bool = ... ) -> SFTPAttributes: ... - def getfo(self, remotepath: bytes | Text, fl: IO[bytes], callback: _Callback | None = ...) -> int: ... - def get(self, remotepath: bytes | Text, localpath: bytes | Text, callback: _Callback | None = ...) -> None: ... + def getfo(self, remotepath: bytes | str, fl: IO[bytes], callback: _Callback | None = ..., prefetch: bool = ...) -> int: ... + def get( + self, remotepath: bytes | str, localpath: bytes | str, callback: _Callback | None = ..., prefetch: bool = ... + ) -> None: ... class SFTP(SFTPClient): ... diff --git a/stubs/paramiko/paramiko/sftp_file.pyi b/stubs/paramiko/paramiko/sftp_file.pyi index d335c14..50415d1 100644 --- a/stubs/paramiko/paramiko/sftp_file.pyi +++ b/stubs/paramiko/paramiko/sftp_file.pyi @@ -1,4 +1,5 @@ -from typing import Any, Iterator, Sequence, Tuple +from collections.abc import Iterator, Sequence +from typing import Any from paramiko.file import BufferedFile from paramiko.sftp_attr import SFTPAttributes @@ -21,9 +22,9 @@ class SFTPFile(BufferedFile[Any]): def stat(self) -> SFTPAttributes: ... def chmod(self, mode: int) -> None: ... def chown(self, uid: int, gid: int) -> None: ... - def utime(self, times: Tuple[float, float] | None) -> None: ... + def utime(self, times: tuple[float, float] | None) -> None: ... def truncate(self, size: int) -> None: ... def check(self, hash_algorithm: str, offset: int = ..., length: int = ..., block_size: int = ...) -> bytes: ... def set_pipelined(self, pipelined: bool = ...) -> None: ... def prefetch(self, file_size: int | None = ...) -> None: ... - def readv(self, chunks: Sequence[Tuple[int, int]]) -> Iterator[bytes]: ... + def readv(self, chunks: Sequence[tuple[int, int]]) -> Iterator[bytes]: ... diff --git a/stubs/paramiko/paramiko/sftp_server.pyi b/stubs/paramiko/paramiko/sftp_server.pyi index 6193ea1..8e8ddde 100644 --- a/stubs/paramiko/paramiko/sftp_server.pyi +++ b/stubs/paramiko/paramiko/sftp_server.pyi @@ -1,5 +1,5 @@ from logging import Logger -from typing import Any, Type +from typing import Any from paramiko.channel import Channel from paramiko.server import ServerInterface, SubsystemHandler @@ -18,7 +18,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): server: SFTPServerInterface sock: Channel | None def __init__( - self, channel: Channel, name: str, server: ServerInterface, sftp_si: Type[SFTPServerInterface], *largs: Any, **kwargs: Any + self, channel: Channel, name: str, server: ServerInterface, sftp_si: type[SFTPServerInterface], *largs: Any, **kwargs: Any ) -> None: ... def start_subsystem(self, name: str, transport: Transport, channel: Channel) -> None: ... def finish_subsystem(self) -> None: ... diff --git a/stubs/paramiko/paramiko/ssh_exception.pyi b/stubs/paramiko/paramiko/ssh_exception.pyi index e75afb2..9f617e0 100644 --- a/stubs/paramiko/paramiko/ssh_exception.pyi +++ b/stubs/paramiko/paramiko/ssh_exception.pyi @@ -1,5 +1,5 @@ import socket -from typing import Mapping, Tuple +from collections.abc import Mapping from paramiko.pkey import PKey @@ -33,9 +33,9 @@ class ProxyCommandFailure(SSHException): def __init__(self, command: str, error: str) -> None: ... class NoValidConnectionsError(socket.error): - errors: Mapping[Tuple[str, int] | Tuple[str, int, int, int], Exception] - def __init__(self, errors: Mapping[Tuple[str, int] | Tuple[str, int, int, int], Exception]) -> None: ... - def __reduce__(self) -> Tuple[type, Tuple[Mapping[Tuple[str, int] | Tuple[str, int, int, int], Exception]]]: ... + errors: Mapping[tuple[str, int] | tuple[str, int, int, int], Exception] + def __init__(self, errors: Mapping[tuple[str, int] | tuple[str, int, int, int], Exception]) -> None: ... + def __reduce__(self) -> tuple[type, tuple[Mapping[tuple[str, int] | tuple[str, int, int, int], Exception]]]: ... class CouldNotCanonicalize(SSHException): ... class ConfigParseError(SSHException): ... diff --git a/stubs/paramiko/paramiko/ssh_gss.pyi b/stubs/paramiko/paramiko/ssh_gss.pyi index aed5ae7..9c0d8ba 100644 --- a/stubs/paramiko/paramiko/ssh_gss.pyi +++ b/stubs/paramiko/paramiko/ssh_gss.pyi @@ -1,7 +1,7 @@ -from typing import Any, Tuple, Type +from typing import Any GSS_AUTH_AVAILABLE: bool -GSS_EXCEPTIONS: Tuple[Type[Exception], ...] +GSS_EXCEPTIONS: tuple[type[Exception], ...] def GSSAuth(auth_method: str, gss_deleg_creds: bool = ...) -> _SSH_GSSAuth: ... diff --git a/stubs/paramiko/paramiko/transport.pyi b/stubs/paramiko/paramiko/transport.pyi index d496233..efaacd9 100644 --- a/stubs/paramiko/paramiko/transport.pyi +++ b/stubs/paramiko/paramiko/transport.pyi @@ -1,8 +1,10 @@ +from collections.abc import Callable, Iterable, Sequence from logging import Logger from socket import socket from threading import Condition, Event, Lock, Thread from types import ModuleType -from typing import Any, Callable, Iterable, Protocol, Sequence, Tuple, Type +from typing import Any, Protocol +from typing_extensions import TypeAlias from paramiko.auth_handler import AuthHandler, _InteractiveCallback from paramiko.channel import Channel @@ -14,7 +16,8 @@ from paramiko.sftp_client import SFTPClient from paramiko.ssh_gss import _SSH_GSSAuth from paramiko.util import ClosingContextManager -_Addr = Tuple[str, int] +_Addr: TypeAlias = tuple[str, int] +_SocketLike: TypeAlias = str | _Addr | socket | Channel class _KexEngine(Protocol): def start_kex(self) -> None: ... @@ -23,7 +26,7 @@ class _KexEngine(Protocol): class Transport(Thread, ClosingContextManager): active: bool hostname: str | None - sock: socket + sock: socket | Channel packetizer: Packetizer local_version: str remote_version: str @@ -67,16 +70,17 @@ class Transport(Thread, ClosingContextManager): server_key_dict: dict[str, PKey] server_accepts: list[Channel] server_accept_cv: Condition - subsystem_table: dict[str, Tuple[Type[SubsystemHandler], Tuple[Any, ...], dict[str, Any]]] + subsystem_table: dict[str, tuple[type[SubsystemHandler], tuple[Any, ...], dict[str, Any]]] sys: ModuleType def __init__( self, - sock: str | Tuple[str, int] | socket, + sock: _SocketLike, default_window_size: int = ..., default_max_packet_size: int = ..., gss_kex: bool = ..., gss_deleg_creds: bool = ..., disabled_algorithms: dict[str, Iterable[str]] | None = ..., + server_sig_algs: bool = ..., ) -> None: ... @property def preferred_ciphers(self) -> Sequence[str]: ... @@ -116,7 +120,7 @@ class Transport(Thread, ClosingContextManager): timeout: float | None = ..., ) -> Channel: ... def request_port_forward( - self, address: str, port: int, handler: Callable[[Channel, _Addr, _Addr], None] | None = ... + self, address: str, port: int, handler: Callable[[Channel, _Addr, _Addr], object] | None = ... ) -> int: ... def cancel_port_forward(self, address: str, port: int) -> None: ... def open_sftp_client(self) -> SFTPClient | None: ... @@ -138,7 +142,7 @@ class Transport(Thread, ClosingContextManager): gss_trust_dns: bool = ..., ) -> None: ... def get_exception(self) -> Exception | None: ... - def set_subsystem_handler(self, name: str, handler: Type[SubsystemHandler], *larg: Any, **kwarg: Any) -> None: ... + def set_subsystem_handler(self, name: str, handler: type[SubsystemHandler], *larg: Any, **kwarg: Any) -> None: ... def is_authenticated(self) -> bool: ... def get_username(self) -> str | None: ... def get_banner(self) -> bytes | None: ... @@ -156,7 +160,7 @@ class Transport(Thread, ClosingContextManager): def set_hexdump(self, hexdump: bool) -> None: ... def get_hexdump(self) -> bool: ... def use_compression(self, compress: bool = ...) -> None: ... - def getpeername(self) -> Tuple[str, int]: ... + def getpeername(self) -> tuple[str, int]: ... def stop_thread(self) -> None: ... def run(self) -> None: ... diff --git a/stubs/paramiko/paramiko/util.pyi b/stubs/paramiko/paramiko/util.pyi index 05bd5c7..3abe7d3 100644 --- a/stubs/paramiko/paramiko/util.pyi +++ b/stubs/paramiko/paramiko/util.pyi @@ -1,21 +1,17 @@ -import sys +from _typeshed import Self +from collections.abc import Callable +from hashlib import _Hash from logging import Logger, LogRecord from types import TracebackType -from typing import IO, AnyStr, Callable, Protocol, Type, TypeVar +from typing import IO, AnyStr, Protocol, TypeVar from paramiko.config import SSHConfig, SSHConfigDict from paramiko.hostkeys import HostKeys -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - class SupportsClose(Protocol): def close(self) -> None: ... _T = TypeVar("_T") -_TC = TypeVar("_TC", bound=SupportsClose) def inflate_long(s: bytes, always_positive: bool = ...) -> int: ... @@ -28,7 +24,7 @@ def format_binary_line(data: bytes) -> str: ... def safe_string(s: bytes) -> bytes: ... def bit_length(n: int) -> int: ... def tb_strings() -> list[str]: ... -def generate_key_bytes(hash_alg: Type[_Hash], salt: bytes, key: bytes | str, nbytes: int) -> bytes: ... +def generate_key_bytes(hash_alg: type[_Hash], salt: bytes, key: bytes | str, nbytes: int) -> bytes: ... def load_host_keys(filename: str) -> HostKeys: ... def parse_ssh_config(file_obj: IO[str]) -> SSHConfig: ... def lookup_ssh_host_config(hostname: str, config: SSHConfig) -> SSHConfigDict: ... @@ -44,9 +40,9 @@ def retry_on_signal(function: Callable[[], _T]) -> _T: ... def constant_time_bytes_eq(a: AnyStr, b: AnyStr) -> bool: ... class ClosingContextManager: - def __enter__(self: _TC) -> _TC: ... + def __enter__(self: Self) -> Self: ... def __exit__( - self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... def clamp_value(minimum: int, val: int, maximum: int) -> int: ... diff --git a/stubs/paramiko/paramiko/win_openssh.pyi b/stubs/paramiko/paramiko/win_openssh.pyi new file mode 100644 index 0000000..bc74d4c --- /dev/null +++ b/stubs/paramiko/paramiko/win_openssh.pyi @@ -0,0 +1,12 @@ +import sys + +if sys.platform == "win32": + PIPE_NAME: str + + def can_talk_to_agent() -> bool: ... + + class OpenSSHAgentConnection: + def __init__(self) -> None: ... + def send(self, data: bytes) -> int: ... + def recv(self, n: int) -> bytes: ... + def close(self) -> None: ... diff --git a/stubs/paramiko/paramiko/win_pageant.pyi b/stubs/paramiko/paramiko/win_pageant.pyi index ed62937..9c8dba6 100644 --- a/stubs/paramiko/paramiko/win_pageant.pyi +++ b/stubs/paramiko/paramiko/win_pageant.pyi @@ -1,12 +1,17 @@ import ctypes import sys +from typing_extensions import Literal, TypeAlias if sys.platform == "win32": win32con_WM_COPYDATA: int - def can_talk_to_agent(): ... + def can_talk_to_agent() -> bool: ... + + ULONG_PTR: TypeAlias = ctypes.c_uint64 | ctypes.c_uint32 + class COPYDATASTRUCT(ctypes.Structure): ... + class PageantConnection: def __init__(self) -> None: ... def send(self, data: bytes) -> None: ... - def recv(self, n: int) -> bytes: ... + def recv(self, n: int) -> Literal[""] | bytes: ... def close(self) -> None: ... diff --git a/stubs/parsimonious/@tests/stubtest_allowlist.txt b/stubs/parsimonious/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..b96ebbf --- /dev/null +++ b/stubs/parsimonious/@tests/stubtest_allowlist.txt @@ -0,0 +1,11 @@ +parsimonious.nodes.RuleDecoratorMeta.__new__ + +# Re-export: +parsimonious.nodes.version_info + +# Magic: +parsimonious.adhoc_expression + +# Tests are shipped with the source, we ignore it: +parsimonious.tests +parsimonious\.tests\..* diff --git a/stubs/parsimonious/METADATA.toml b/stubs/parsimonious/METADATA.toml new file mode 100644 index 0000000..e7377c3 --- /dev/null +++ b/stubs/parsimonious/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.10.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/parsimonious/parsimonious/__init__.pyi b/stubs/parsimonious/parsimonious/__init__.pyi new file mode 100644 index 0000000..31f99b4 --- /dev/null +++ b/stubs/parsimonious/parsimonious/__init__.pyi @@ -0,0 +1,8 @@ +from parsimonious.exceptions import ( + BadGrammar as BadGrammar, + IncompleteParseError as IncompleteParseError, + ParseError as ParseError, + UndefinedLabel as UndefinedLabel, +) +from parsimonious.grammar import Grammar as Grammar, TokenGrammar as TokenGrammar +from parsimonious.nodes import NodeVisitor as NodeVisitor, VisitationError as VisitationError, rule as rule diff --git a/stubs/parsimonious/parsimonious/exceptions.pyi b/stubs/parsimonious/parsimonious/exceptions.pyi new file mode 100644 index 0000000..9401ce5 --- /dev/null +++ b/stubs/parsimonious/parsimonious/exceptions.pyi @@ -0,0 +1,25 @@ +from parsimonious.expressions import Expression +from parsimonious.grammar import LazyReference +from parsimonious.nodes import Node +from parsimonious.utils import StrAndRepr + +class ParseError(StrAndRepr, Exception): + text: str + pos: int + expr: Expression | None + def __init__(self, text: str, pos: int = ..., expr: Expression | None = ...) -> None: ... + def line(self) -> int: ... + def column(self) -> int: ... + +class LeftRecursionError(ParseError): ... +class IncompleteParseError(ParseError): ... + +class VisitationError(Exception): + original_class: type[BaseException] + def __init__(self, exc: BaseException, exc_class: type[BaseException], node: Node) -> None: ... + +class BadGrammar(StrAndRepr, Exception): ... + +class UndefinedLabel(BadGrammar): + label: LazyReference + def __init__(self, label: LazyReference) -> None: ... diff --git a/stubs/parsimonious/parsimonious/expressions.pyi b/stubs/parsimonious/parsimonious/expressions.pyi new file mode 100644 index 0000000..fdc50b0 --- /dev/null +++ b/stubs/parsimonious/parsimonious/expressions.pyi @@ -0,0 +1,77 @@ +import collections.abc +from _typeshed import Self +from collections.abc import Callable, Mapping +from re import Pattern +from typing import Any, Union +from typing_extensions import TypeAlias + +from parsimonious.exceptions import ParseError +from parsimonious.grammar import Grammar +from parsimonious.nodes import Node +from parsimonious.utils import StrAndRepr + +_CALLABLE_RETURN_TYPE: TypeAlias = Union[int, tuple[int, list[Node]], Node, None] +_CALLABLE_TYPE: TypeAlias = ( + Callable[[str, int], _CALLABLE_RETURN_TYPE] + | Callable[[str, int, Mapping[tuple[int, int], Node], ParseError, Grammar], _CALLABLE_RETURN_TYPE] +) + +def is_callable(value: object) -> bool: ... +def expression(callable: _CALLABLE_TYPE, rule_name: str, grammar: Grammar) -> Expression: ... + +IN_PROGRESS: object + +class Expression(StrAndRepr): + name: str + identity_tuple: tuple[str] + def __init__(self, name: str = ...) -> None: ... + def resolve_refs(self: Self, rule_map: Mapping[str, Expression]) -> Self: ... + def parse(self, text: str, pos: int = ...) -> Node: ... + def match(self, text: str, pos: int = ...) -> Node: ... + def match_core(self, text: str, pos: int, cache: Mapping[tuple[int, int], Node], error: ParseError) -> Node: ... + def as_rule(self) -> str: ... + +class Literal(Expression): + literal: str + identity_tuple: tuple[str, str] # type: ignore[assignment] + def __init__(self, literal: str, name: str = ...) -> None: ... + +class TokenMatcher(Literal): ... + +class Regex(Expression): + re: Pattern[str] + identity_tuple: tuple[str, Pattern[str]] # type: ignore[assignment] + def __init__( + self, + pattern: str, + name: str = ..., + ignore_case: bool = ..., + locale: bool = ..., + multiline: bool = ..., + dot_all: bool = ..., + unicode: bool = ..., + verbose: bool = ..., + ascii: bool = ..., + ) -> None: ... + +class Compound(Expression): + members: collections.abc.Sequence[Expression] + def __init__(self, *members: Expression, **kwargs: Any) -> None: ... + +class Sequence(Compound): ... +class OneOf(Compound): ... + +class Lookahead(Compound): + negativity: bool + def __init__(self, member: Expression, *, negative: bool = ..., **kwargs: Any) -> None: ... + +def Not(term: Expression) -> Lookahead: ... + +class Quantifier(Compound): + min: int + max: float + def __init__(self, member: Expression, *, min: int = ..., max: float = ..., name: str = ..., **kwargs: Any) -> None: ... + +def ZeroOrMore(member: Expression, name: str = ...) -> Quantifier: ... +def OneOrMore(member: Expression, name: str = ..., min: int = ...) -> Quantifier: ... +def Optional(member: Expression, name: str = ...) -> Quantifier: ... diff --git a/stubs/parsimonious/parsimonious/grammar.pyi b/stubs/parsimonious/parsimonious/grammar.pyi new file mode 100644 index 0000000..f686df3 --- /dev/null +++ b/stubs/parsimonious/parsimonious/grammar.pyi @@ -0,0 +1,57 @@ +import collections.abc +from collections import OrderedDict +from collections.abc import Callable, Mapping +from typing import Any, NoReturn + +from parsimonious.expressions import _CALLABLE_TYPE, Expression, Literal, Lookahead, OneOf, Regex, Sequence, TokenMatcher +from parsimonious.nodes import Node, NodeVisitor + +class Grammar(OrderedDict[str, Expression]): + default_rule: Expression | Any + def __init__(self, rules: str = ..., **more_rules: Expression | _CALLABLE_TYPE) -> None: ... + def default(self, rule_name: str) -> Grammar: ... + def parse(self, text: str, pos: int = ...) -> Node: ... + def match(self, text: str, pos: int = ...) -> Node: ... + +class TokenGrammar(Grammar): ... +class BootstrappingGrammar(Grammar): ... + +rule_syntax: str + +class LazyReference(str): + name: str + def resolve_refs(self, rule_map: Mapping[str, Expression | LazyReference]) -> Expression: ... + +class RuleVisitor(NodeVisitor): + quantifier_classes: dict[str, type[Expression]] + visit_expression: Callable[[RuleVisitor, Node, collections.abc.Sequence[Any]], Any] + visit_term: Callable[[RuleVisitor, Node, collections.abc.Sequence[Any]], Any] + visit_atom: Callable[[RuleVisitor, Node, collections.abc.Sequence[Any]], Any] + custom_rules: dict[str, Expression] + def __init__(self, custom_rules: Mapping[str, Expression] | None = ...) -> None: ... + def visit_parenthesized(self, node: Node, parenthesized: collections.abc.Sequence[Any]) -> Expression: ... + def visit_quantifier(self, node: Node, quantifier: collections.abc.Sequence[Any]) -> Node: ... + def visit_quantified(self, node: Node, quantified: collections.abc.Sequence[Any]) -> Expression: ... + def visit_lookahead_term(self, node: Node, lookahead_term: collections.abc.Sequence[Any]) -> Lookahead: ... + def visit_not_term(self, node: Node, not_term: collections.abc.Sequence[Any]) -> Lookahead: ... + def visit_rule(self, node: Node, rule: collections.abc.Sequence[Any]) -> Expression: ... + def visit_sequence(self, node: Node, sequence: collections.abc.Sequence[Any]) -> Sequence: ... + def visit_ored(self, node: Node, ored: collections.abc.Sequence[Any]) -> OneOf: ... + def visit_or_term(self, node: Node, or_term: collections.abc.Sequence[Any]) -> Expression: ... + def visit_label(self, node: Node, label: collections.abc.Sequence[Any]) -> str: ... + def visit_reference(self, node: Node, reference: collections.abc.Sequence[Any]) -> LazyReference: ... + def visit_regex(self, node: Node, regex: collections.abc.Sequence[Any]) -> Regex: ... + def visit_spaceless_literal(self, spaceless_literal: Node, visited_children: collections.abc.Sequence[Any]) -> Literal: ... + def visit_literal(self, node: Node, literal: collections.abc.Sequence[Any]) -> Literal: ... + def generic_visit(self, node: Node, visited_children: collections.abc.Sequence[Any]) -> collections.abc.Sequence[Any] | Node: ... # type: ignore[override] + def visit_rules( + self, node: Node, rules_list: collections.abc.Sequence[Any] + ) -> tuple[OrderedDict[str, Expression], Expression | None]: ... + +class TokenRuleVisitor(RuleVisitor): + def visit_spaceless_literal( + self, spaceless_literal: Node, visited_children: collections.abc.Sequence[Any] + ) -> TokenMatcher: ... + def visit_regex(self, node: Node, regex: collections.abc.Sequence[Any]) -> NoReturn: ... + +rule_grammar: Grammar diff --git a/stubs/parsimonious/parsimonious/nodes.pyi b/stubs/parsimonious/parsimonious/nodes.pyi new file mode 100644 index 0000000..cffd155 --- /dev/null +++ b/stubs/parsimonious/parsimonious/nodes.pyi @@ -0,0 +1,40 @@ +from collections.abc import Callable, Iterator, Sequence +from re import Match +from typing import Any, NoReturn, TypeVar + +from parsimonious.exceptions import VisitationError as VisitationError +from parsimonious.expressions import Expression +from parsimonious.grammar import Grammar + +class Node: + expr: Expression + full_text: str + start: int + end: int + children: Sequence[Node] + def __init__(self, expr: Expression, full_text: str, start: int, end: int, children: Sequence[Node] | None = ...) -> None: ... + @property + def expr_name(self) -> str: ... + def __iter__(self) -> Iterator[Node]: ... + @property + def text(self) -> str: ... + def prettily(self, error: Node | None = ...) -> str: ... + def __repr__(self, top_level: bool = ...) -> str: ... + +class RegexNode(Node): + match: Match[str] + +class RuleDecoratorMeta(type): ... + +class NodeVisitor(metaclass=RuleDecoratorMeta): + grammar: Grammar | Any + unwrapped_exceptions: tuple[type[BaseException], ...] + def visit(self, node: Node) -> Any: ... + def generic_visit(self, node: Node, visited_children: Sequence[Any]) -> NoReturn: ... + def parse(self, text: str, pos: int = ...) -> Node: ... + def match(self, text: str, pos: int = ...) -> Node: ... + def lift_child(self, node: Node, children: Sequence[Any]) -> Any: ... + +_CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) + +def rule(rule_string: str) -> Callable[[_CallableT], _CallableT]: ... diff --git a/stubs/parsimonious/parsimonious/utils.pyi b/stubs/parsimonious/parsimonious/utils.pyi new file mode 100644 index 0000000..eea5d11 --- /dev/null +++ b/stubs/parsimonious/parsimonious/utils.pyi @@ -0,0 +1,10 @@ +import ast +from typing import Any + +class StrAndRepr: ... + +def evaluate_string(string: str | ast.AST) -> Any: ... + +class Token(StrAndRepr): + type: str + def __init__(self, type: str) -> None: ... diff --git a/stubs/passlib/@tests/stubtest_allowlist.txt b/stubs/passlib/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..42d21cc --- /dev/null +++ b/stubs/passlib/@tests/stubtest_allowlist.txt @@ -0,0 +1,36 @@ +# proxy module that uses some import magic incompatible with stubtest +passlib.hash + +# django unsupported in stubs +passlib.ext.django.models + +# uses @memoized_property at runtime, but @property in the stubs +passlib.crypto.digest.HashInfo.supported +passlib.crypto.digest.HashInfo.supported_by_fastpbkdf2 +passlib.crypto.digest.HashInfo.supported_by_hashlib_pbkdf2 +passlib.pwd.PhraseGenerator.symbol_count +passlib.pwd.SequenceGenerator.entropy +passlib.pwd.SequenceGenerator.entropy_per_symbol +passlib.pwd.SequenceGenerator.symbol_count +passlib.pwd.WordGenerator.symbol_count +passlib.totp.TotpMatch.cache_seconds +passlib.totp.TotpMatch.cache_time +passlib.totp.TotpMatch.expected_counter +passlib.totp.TotpMatch.expire_time +passlib.totp.TotpMatch.skipped +passlib.totp.TotpToken.expire_time +passlib.totp.TotpToken.start_time + +# "hybrid" method that can be called on an instance or class +passlib.totp.TOTP.normalize_token + +# import problem +passlib.utils.compat._ordered_dict + +# initialized to None, but set by concrete sub-classes +passlib.handlers.pbkdf2.Pbkdf2DigestHandler.default_rounds +passlib.utils.handlers.GenericHandler.setting_kwds + +# set to None on class level, but initialized in __init__ +passlib.utils.handlers.HasManyIdents.ident +passlib.utils.handlers.HasRounds.rounds diff --git a/stubs/passlib/METADATA.toml b/stubs/passlib/METADATA.toml new file mode 100644 index 0000000..ef79660 --- /dev/null +++ b/stubs/passlib/METADATA.toml @@ -0,0 +1 @@ +version = "1.7.*" diff --git a/stdlib/@python2/distutils/command/build_clib.pyi b/stubs/passlib/passlib/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/build_clib.pyi rename to stubs/passlib/passlib/__init__.pyi diff --git a/stubs/passlib/passlib/apache.pyi b/stubs/passlib/passlib/apache.pyi new file mode 100644 index 0000000..ce97a39 --- /dev/null +++ b/stubs/passlib/passlib/apache.pyi @@ -0,0 +1,58 @@ +from typing import Any + +class _CommonFile: + encoding: Any + return_unicode: Any + autosave: bool + @classmethod + def from_string(cls, data, **kwds): ... + @classmethod + def from_path(cls, path, **kwds): ... + def __init__( + self, + path: Any | None = ..., + new: bool = ..., + autoload: bool = ..., + autosave: bool = ..., + encoding: str = ..., + return_unicode=..., + ) -> None: ... + @property + def path(self): ... + @path.setter + def path(self, value) -> None: ... + @property + def mtime(self): ... + def load_if_changed(self): ... + def load(self, path: Any | None = ..., force: bool = ...): ... + def load_string(self, data) -> None: ... + def save(self, path: Any | None = ...) -> None: ... + def to_string(self): ... + +class HtpasswdFile(_CommonFile): + context: Any + def __init__(self, path: Any | None = ..., default_scheme: Any | None = ..., context=..., **kwds) -> None: ... + def users(self): ... + def set_password(self, user, password): ... + def update(self, user, password): ... + def get_hash(self, user): ... + def set_hash(self, user, hash): ... + def find(self, user): ... + def delete(self, user): ... + def check_password(self, user, password): ... + def verify(self, user, password): ... + +class HtdigestFile(_CommonFile): + default_realm: Any + def __init__(self, path: Any | None = ..., default_realm: Any | None = ..., **kwds) -> None: ... + def realms(self): ... + def users(self, realm: Any | None = ...): ... + def set_password(self, user, realm: Any | None = ..., password=...): ... + def update(self, user, realm, password): ... + def get_hash(self, user, realm: Any | None = ...): ... + def set_hash(self, user, realm: Any | None = ..., hash=...): ... + def find(self, user, realm): ... + def delete(self, user, realm: Any | None = ...): ... + def delete_realm(self, realm): ... + def check_password(self, user, realm: Any | None = ..., password=...): ... + def verify(self, user, realm, password): ... diff --git a/stubs/passlib/passlib/apps.pyi b/stubs/passlib/passlib/apps.pyi new file mode 100644 index 0000000..2b87ba4 --- /dev/null +++ b/stubs/passlib/passlib/apps.pyi @@ -0,0 +1,35 @@ +from .context import CryptContext + +__all__ = [ + "custom_app_context", + "django_context", + "ldap_context", + "ldap_nocrypt_context", + "mysql_context", + "mysql4_context", + "mysql3_context", + "phpass_context", + "phpbb3_context", + "postgres_context", +] + +master_context: CryptContext +custom_app_context: CryptContext +django10_context: CryptContext +django14_context: CryptContext +django16_context: CryptContext +django110_context: CryptContext +django21_context: CryptContext +django_context = django21_context # noqa: F821 +std_ldap_schemes: list[str] +ldap_nocrypt_context: CryptContext +ldap_context: CryptContext +mysql3_context: CryptContext +mysql4_context: CryptContext +mysql_context = mysql4_context # noqa: F821 +postgres_context: CryptContext +phpass_context: CryptContext +phpbb3_context: CryptContext +roundup10_context: CryptContext +roundup15_context: CryptContext +roundup_context = roundup15_context # noqa: F821 diff --git a/stubs/passlib/passlib/context.pyi b/stubs/passlib/passlib/context.pyi new file mode 100644 index 0000000..23e84fc --- /dev/null +++ b/stubs/passlib/passlib/context.pyi @@ -0,0 +1,82 @@ +from _typeshed import Self, StrOrBytesPath, SupportsItems +from typing import Any + +class CryptPolicy: + @classmethod + def from_path(cls, path, section: str = ..., encoding: str = ...): ... + @classmethod + def from_string(cls, source, section: str = ..., encoding: str = ...): ... + @classmethod + def from_source(cls, source, _warn: bool = ...): ... + @classmethod + def from_sources(cls, sources, _warn: bool = ...): ... + def replace(self, *args, **kwds): ... + def __init__(self, *args, **kwds) -> None: ... + def has_schemes(self): ... + def iter_handlers(self): ... + def schemes(self, resolve: bool = ...): ... + def get_handler(self, name: Any | None = ..., category: Any | None = ..., required: bool = ...): ... + def get_min_verify_time(self, category: Any | None = ...): ... + def get_options(self, name, category: Any | None = ...): ... + def handler_is_deprecated(self, name, category: Any | None = ...): ... + def iter_config(self, ini: bool = ..., resolve: bool = ...): ... + def to_dict(self, resolve: bool = ...): ... + def to_file(self, stream, section: str = ...) -> None: ... + def to_string(self, section: str = ..., encoding: Any | None = ...): ... + +class CryptContext: + @classmethod + def from_string(cls: type[Self], source: str | bytes, section: str = ..., encoding: str = ...) -> Self: ... + @classmethod + def from_path(cls: type[Self], path: StrOrBytesPath, section: str = ..., encoding: str = ...) -> Self: ... + def copy(self, **kwds: Any) -> CryptContext: ... + def using(self, **kwds: Any) -> CryptContext: ... + def replace(self, **kwds): ... + def __init__(self, schemes: Any | None = ..., policy=..., _autoload: bool = ..., **kwds) -> None: ... + policy: CryptPolicy + def load_path(self, path: StrOrBytesPath, update: bool = ..., section: str = ..., encoding: str = ...) -> None: ... + def load( + self, + source: str | bytes | SupportsItems[str, Any] | CryptContext, + update: bool = ..., + section: str = ..., + encoding: str = ..., + ) -> None: ... + def update(self, *args: Any, **kwds: Any) -> None: ... + def schemes(self, resolve: bool = ..., category: Any | None = ..., unconfigured: bool = ...): ... + def default_scheme(self, category: Any | None = ..., resolve: bool = ..., unconfigured: bool = ...): ... + def handler(self, scheme: Any | None = ..., category: Any | None = ..., unconfigured: bool = ...): ... + @property + def context_kwds(self): ... + def to_dict(self, resolve: bool = ...) -> dict[str, Any]: ... + def to_string(self, section: str = ...) -> str: ... + mvt_estimate_max_samples: int + mvt_estimate_min_samples: int + mvt_estimate_max_time: int + mvt_estimate_resolution: float + harden_verify: Any + min_verify_time: int + def reset_min_verify_time(self) -> None: ... + def needs_update( + self, hash: str | bytes, scheme: str | None = ..., category: str | None = ..., secret: str | bytes | None = ... + ) -> bool: ... + def hash_needs_update(self, hash, scheme: Any | None = ..., category: Any | None = ...): ... + def genconfig(self, scheme: Any | None = ..., category: Any | None = ..., **settings): ... + def genhash(self, secret, config, scheme: Any | None = ..., category: Any | None = ..., **kwds): ... + def identify(self, hash, category: Any | None = ..., resolve: bool = ..., required: bool = ..., unconfigured: bool = ...): ... + def hash(self, secret: str | bytes, scheme: str | None = ..., category: str | None = ..., **kwds: Any) -> str: ... + def encrypt(self, *args, **kwds): ... + def verify( + self, secret: str | bytes, hash: str | bytes | None, scheme: str | None = ..., category: str | None = ..., **kwds: Any + ) -> bool: ... + def verify_and_update( + self, secret: str | bytes, hash: str | bytes | None, scheme: str | None = ..., category: str | None = ..., **kwds: Any + ) -> tuple[bool, str | None]: ... + def dummy_verify(self, elapsed: int = ...): ... + def is_enabled(self, hash: str | bytes) -> bool: ... + def disable(self, hash: str | bytes | None = ...) -> str: ... + def enable(self, hash: str | bytes) -> str: ... + +class LazyCryptContext(CryptContext): + def __init__(self, schemes: Any | None = ..., **kwds) -> None: ... + def __getattribute__(self, attr: str) -> Any: ... diff --git a/stdlib/@python2/distutils/command/build_ext.pyi b/stubs/passlib/passlib/crypto/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/build_ext.pyi rename to stubs/passlib/passlib/crypto/__init__.pyi diff --git a/stubs/passlib/passlib/crypto/_blowfish/__init__.pyi b/stubs/passlib/passlib/crypto/_blowfish/__init__.pyi new file mode 100644 index 0000000..093b06f --- /dev/null +++ b/stubs/passlib/passlib/crypto/_blowfish/__init__.pyi @@ -0,0 +1,3 @@ +from passlib.crypto._blowfish.unrolled import BlowfishEngine as BlowfishEngine + +def raw_bcrypt(password, ident, salt, log_rounds): ... diff --git a/stubs/passlib/passlib/crypto/_blowfish/_gen_files.pyi b/stubs/passlib/passlib/crypto/_blowfish/_gen_files.pyi new file mode 100644 index 0000000..fe0d788 --- /dev/null +++ b/stubs/passlib/passlib/crypto/_blowfish/_gen_files.pyi @@ -0,0 +1,11 @@ +from typing import Any + +def varlist(name, count): ... +def indent_block(block, padding): ... + +BFSTR: Any + +def render_encipher(write, indent: int = ...) -> None: ... +def write_encipher_function(write, indent: int = ...) -> None: ... +def write_expand_function(write, indent: int = ...) -> None: ... +def main() -> None: ... diff --git a/stubs/passlib/passlib/crypto/_blowfish/base.pyi b/stubs/passlib/passlib/crypto/_blowfish/base.pyi new file mode 100644 index 0000000..8ad01d7 --- /dev/null +++ b/stubs/passlib/passlib/crypto/_blowfish/base.pyi @@ -0,0 +1,13 @@ +from typing import Any + +class BlowfishEngine: + P: Any + S: Any + def __init__(self) -> None: ... + @staticmethod + def key_to_words(data, size: int = ...): ... + def encipher(self, l, r): ... + def expand(self, key_words) -> None: ... + def eks_salted_expand(self, key_words, salt_words) -> None: ... + def eks_repeated_expand(self, key_words, salt_words, rounds) -> None: ... + def repeat_encipher(self, l, r, count): ... diff --git a/stubs/passlib/passlib/crypto/_blowfish/unrolled.pyi b/stubs/passlib/passlib/crypto/_blowfish/unrolled.pyi new file mode 100644 index 0000000..f0ad547 --- /dev/null +++ b/stubs/passlib/passlib/crypto/_blowfish/unrolled.pyi @@ -0,0 +1,5 @@ +from passlib.crypto._blowfish.base import BlowfishEngine as _BlowfishEngine + +class BlowfishEngine(_BlowfishEngine): + def encipher(self, l, r): ... + def expand(self, key_words) -> None: ... diff --git a/stubs/passlib/passlib/crypto/_md4.pyi b/stubs/passlib/passlib/crypto/_md4.pyi new file mode 100644 index 0000000..781fe3f --- /dev/null +++ b/stubs/passlib/passlib/crypto/_md4.pyi @@ -0,0 +1,12 @@ +from typing import Any + +class md4: + name: str + digest_size: int + digestsize: int + block_size: int + def __init__(self, content: Any | None = ...) -> None: ... + def update(self, content) -> None: ... + def copy(self): ... + def digest(self): ... + def hexdigest(self): ... diff --git a/stubs/passlib/passlib/crypto/des.pyi b/stubs/passlib/passlib/crypto/des.pyi new file mode 100644 index 0000000..4d342d8 --- /dev/null +++ b/stubs/passlib/passlib/crypto/des.pyi @@ -0,0 +1,5 @@ +__all__ = ["expand_des_key", "des_encrypt_block"] + +def expand_des_key(key): ... +def des_encrypt_block(key, input, salt: int = ..., rounds: int = ...): ... +def des_encrypt_int_block(key, input, salt: int = ..., rounds: int = ...): ... diff --git a/stubs/passlib/passlib/crypto/digest.pyi b/stubs/passlib/passlib/crypto/digest.pyi new file mode 100644 index 0000000..5cbf489 --- /dev/null +++ b/stubs/passlib/passlib/crypto/digest.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from passlib.utils import SequenceMixin + +def lookup_hash(digest, return_unknown: bool = ..., required: bool = ...): ... +def norm_hash_name(name, format: str = ...): ... + +class HashInfo(SequenceMixin): + name: Any + iana_name: Any + aliases: Any + const: Any + digest_size: Any + block_size: Any + error_text: Any + unknown: bool + def __init__(self, const, names, required: bool = ...) -> None: ... + @property + def supported(self): ... + @property + def supported_by_fastpbkdf2(self): ... + @property + def supported_by_hashlib_pbkdf2(self): ... + +def compile_hmac(digest, key, multipart: bool = ...): ... +def pbkdf1(digest, secret, salt, rounds, keylen: Any | None = ...): ... +def pbkdf2_hmac(digest, secret, salt, rounds, keylen: Any | None = ...): ... diff --git a/stubs/passlib/passlib/crypto/scrypt/__init__.pyi b/stubs/passlib/passlib/crypto/scrypt/__init__.pyi new file mode 100644 index 0000000..88c74fe --- /dev/null +++ b/stubs/passlib/passlib/crypto/scrypt/__init__.pyi @@ -0,0 +1,2 @@ +def validate(n, r, p): ... +def scrypt(secret, salt, n, r, p: int = ..., keylen: int = ...): ... diff --git a/stubs/passlib/passlib/crypto/scrypt/_builtin.pyi b/stubs/passlib/passlib/crypto/scrypt/_builtin.pyi new file mode 100644 index 0000000..d7fa686 --- /dev/null +++ b/stubs/passlib/passlib/crypto/scrypt/_builtin.pyi @@ -0,0 +1,19 @@ +from collections.abc import Generator +from typing import Any + +class ScryptEngine: + n: int + r: int + p: int + smix_bytes: int + iv_bytes: int + bmix_len: int + bmix_half_len: int + bmix_struct: Any + integerify: Any + @classmethod + def execute(cls, secret, salt, n, r, p, keylen): ... + def __init__(self, n, r, p): ... + def run(self, secret, salt, keylen): ... + def smix(self, input) -> Generator[None, None, Any]: ... + def bmix(self, source, target) -> None: ... diff --git a/stubs/passlib/passlib/crypto/scrypt/_gen_files.pyi b/stubs/passlib/passlib/crypto/scrypt/_gen_files.pyi new file mode 100644 index 0000000..7e7363e --- /dev/null +++ b/stubs/passlib/passlib/crypto/scrypt/_gen_files.pyi @@ -0,0 +1 @@ +def main() -> None: ... diff --git a/stubs/passlib/passlib/crypto/scrypt/_salsa.pyi b/stubs/passlib/passlib/crypto/scrypt/_salsa.pyi new file mode 100644 index 0000000..d5ead63 --- /dev/null +++ b/stubs/passlib/passlib/crypto/scrypt/_salsa.pyi @@ -0,0 +1 @@ +def salsa20(input): ... diff --git a/stubs/passlib/passlib/exc.pyi b/stubs/passlib/passlib/exc.pyi new file mode 100644 index 0000000..7c9f1c4 --- /dev/null +++ b/stubs/passlib/passlib/exc.pyi @@ -0,0 +1,55 @@ +from typing import Any + +class UnknownBackendError(ValueError): + hasher: Any + backend: Any + def __init__(self, hasher, backend) -> None: ... + +class MissingBackendError(RuntimeError): ... +class InternalBackendError(RuntimeError): ... +class PasswordValueError(ValueError): ... + +class PasswordSizeError(PasswordValueError): + max_size: Any + def __init__(self, max_size, msg: Any | None = ...) -> None: ... + +class PasswordTruncateError(PasswordSizeError): + def __init__(self, cls, msg: Any | None = ...) -> None: ... + +class PasslibSecurityError(RuntimeError): ... + +class TokenError(ValueError): + def __init__(self, msg: Any | None = ..., *args, **kwds) -> None: ... + +class MalformedTokenError(TokenError): ... +class InvalidTokenError(TokenError): ... + +class UsedTokenError(TokenError): + expire_time: Any + def __init__(self, *args, **kwds) -> None: ... + +class UnknownHashError(ValueError): + value: Any + message: Any + def __init__(self, message: Any | None = ..., value: Any | None = ...) -> None: ... + +class PasslibWarning(UserWarning): ... +class PasslibConfigWarning(PasslibWarning): ... +class PasslibHashWarning(PasslibWarning): ... +class PasslibRuntimeWarning(PasslibWarning): ... +class PasslibSecurityWarning(PasslibWarning): ... + +def type_name(value): ... +def ExpectedTypeError(value, expected, param): ... +def ExpectedStringError(value, param): ... +def MissingDigestError(handler: Any | None = ...): ... +def NullPasswordError(handler: Any | None = ...): ... +def InvalidHashError(handler: Any | None = ...): ... +def MalformedHashError(handler: Any | None = ..., reason: Any | None = ...): ... +def ZeroPaddedRoundsError(handler: Any | None = ...): ... +def ChecksumSizeError(handler, raw: bool = ...): ... + +ENABLE_DEBUG_ONLY_REPR: bool + +def debug_only_repr(value, param: str = ...): ... +def CryptBackendError(handler, config, hash, source: str = ...) -> None: ... diff --git a/stdlib/@python2/distutils/command/build_scripts.pyi b/stubs/passlib/passlib/ext/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/build_scripts.pyi rename to stubs/passlib/passlib/ext/__init__.pyi diff --git a/stdlib/@python2/distutils/command/check.pyi b/stubs/passlib/passlib/ext/django/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/check.pyi rename to stubs/passlib/passlib/ext/django/__init__.pyi diff --git a/stubs/passlib/passlib/ext/django/models.pyi b/stubs/passlib/passlib/ext/django/models.pyi new file mode 100644 index 0000000..2fd1d21 --- /dev/null +++ b/stubs/passlib/passlib/ext/django/models.pyi @@ -0,0 +1,3 @@ +from typing import Any + +password_context: Any diff --git a/stubs/passlib/passlib/ext/django/utils.pyi b/stubs/passlib/passlib/ext/django/utils.pyi new file mode 100644 index 0000000..20c629d --- /dev/null +++ b/stubs/passlib/passlib/ext/django/utils.pyi @@ -0,0 +1,55 @@ +from typing import Any + +__all__ = ["DJANGO_VERSION", "MIN_DJANGO_VERSION", "get_preset_config", "quirks"] + +DJANGO_VERSION: tuple[Any, ...] +MIN_DJANGO_VERSION: tuple[int, int] + +class quirks: + none_causes_check_password_error: Any + empty_is_usable_password: Any + invalid_is_usable_password: Any + +def get_preset_config(name): ... + +class DjangoTranslator: + context: Any + def __init__(self, context: Any | None = ..., **kwds) -> None: ... + def reset_hashers(self) -> None: ... + def passlib_to_django_name(self, passlib_name): ... + def passlib_to_django(self, passlib_hasher, cached: bool = ...): ... + def django_to_passlib_name(self, django_name): ... + def django_to_passlib(self, django_name, cached: bool = ...): ... + def resolve_django_hasher(self, django_name, cached: bool = ...): ... + +class DjangoContextAdapter(DjangoTranslator): + context: Any + is_password_usable: Any + enabled: bool + patched: bool + log: Any + def __init__(self, context: Any | None = ..., get_user_category: Any | None = ..., **kwds) -> None: ... + def reset_hashers(self) -> None: ... + def get_hashers(self): ... + def get_hasher(self, algorithm: str = ...): ... + def identify_hasher(self, encoded): ... + def make_password(self, password, salt: Any | None = ..., hasher: str = ...): ... + def check_password(self, password, encoded, setter: Any | None = ..., preferred: str = ...): ... + def user_check_password(self, user, password): ... + def user_set_password(self, user, password) -> None: ... + def get_user_category(self, user): ... + HASHERS_PATH: str + MODELS_PATH: str + USER_CLASS_PATH: Any + FORMS_PATH: str + patch_locations: Any + def install_patch(self): ... + def remove_patch(self): ... + def load_model(self) -> None: ... + +class ProxyProperty: + attr: Any + def __init__(self, attr) -> None: ... + def __get__(self, obj, cls): ... + def __set__(self, obj, value) -> None: ... + def __delete__(self, obj) -> None: ... diff --git a/stdlib/@python2/distutils/command/clean.pyi b/stubs/passlib/passlib/handlers/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/clean.pyi rename to stubs/passlib/passlib/handlers/__init__.pyi diff --git a/stubs/passlib/passlib/handlers/argon2.pyi b/stubs/passlib/passlib/handlers/argon2.pyi new file mode 100644 index 0000000..69f7dd9 --- /dev/null +++ b/stubs/passlib/passlib/handlers/argon2.pyi @@ -0,0 +1,84 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class _DummyCffiHasher: + time_cost: int + memory_cost: int + parallelism: int + salt_len: int + hash_len: int + +class _Argon2Common( # type: ignore[misc] + uh.SubclassBackendMixin, uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler +): + name: ClassVar[str] + checksum_size: ClassVar[int] + default_salt_size: ClassVar[int] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + max_parallelism: ClassVar[int] + max_version: ClassVar[int] + min_desired_version: ClassVar[int | None] + min_memory_cost: ClassVar[int] + max_threads: ClassVar[int] + pure_use_threads: ClassVar[bool] + def type_values(cls): ... + type: str + parallelism: int + version: int + memory_cost: int + @property + def type_d(self): ... + data: Any + @classmethod + def using( # type: ignore[override] + cls, + type: Any | None = ..., + memory_cost: Any | None = ..., + salt_len: Any | None = ..., + time_cost: Any | None = ..., + digest_size: Any | None = ..., + checksum_size: Any | None = ..., + hash_len: Any | None = ..., + max_threads: Any | None = ..., + **kwds, + ): ... + @classmethod + def identify(cls, hash): ... + @classmethod + def from_string(cls, hash): ... + def __init__( + self, + type: Any | None = ..., + type_d: bool = ..., + version: Any | None = ..., + memory_cost: Any | None = ..., + data: Any | None = ..., + **kwds, + ) -> None: ... + +class _NoBackend(_Argon2Common): + @classmethod + def hash(cls, secret): ... + @classmethod + def verify(cls, secret, hash): ... + @classmethod + def genhash(cls, secret, config): ... + +class _CffiBackend(_Argon2Common): + @classmethod + def hash(cls, secret): ... + @classmethod + def verify(cls, secret, hash): ... + @classmethod + def genhash(cls, secret, config): ... + +class _PureBackend(_Argon2Common): ... + +class argon2(_NoBackend, _Argon2Common): # type: ignore[misc] + backends: ClassVar[tuple[str, ...]] diff --git a/stubs/passlib/passlib/handlers/bcrypt.pyi b/stubs/passlib/passlib/handlers/bcrypt.pyi new file mode 100644 index 0000000..1823586 --- /dev/null +++ b/stubs/passlib/passlib/handlers/bcrypt.pyi @@ -0,0 +1,54 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + default_ident: ClassVar[str] + ident_values: ClassVar[tuple[str, ...]] + ident_aliases: ClassVar[dict[str, str]] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + final_salt_chars: ClassVar[str] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + truncate_size: ClassVar[int | None] + @classmethod + def from_string(cls, hash): ... + @classmethod + def needs_update(cls, hash, **kwds): ... + @classmethod + def normhash(cls, hash): ... + +class _NoBackend(_BcryptCommon): ... +class _BcryptBackend(_BcryptCommon): ... +class _BcryptorBackend(_BcryptCommon): ... +class _PyBcryptBackend(_BcryptCommon): ... +class _OsCryptBackend(_BcryptCommon): ... +class _BuiltinBackend(_BcryptCommon): ... + +class bcrypt(_NoBackend, _BcryptCommon): # type: ignore[misc] + backends: ClassVar[tuple[str, ...]] + +class _wrapped_bcrypt(bcrypt): + truncate_size: ClassVar[None] + +class bcrypt_sha256(_wrapped_bcrypt): + name: ClassVar[str] + ident_values: ClassVar[tuple[str, ...]] + ident_aliases: ClassVar[dict[str, str]] + default_ident: ClassVar[str] + version: ClassVar[int] + @classmethod + def using(cls, version: Any | None = ..., **kwds): ... # type: ignore[override] + prefix: Any + @classmethod + def identify(cls, hash): ... + @classmethod + def from_string(cls, hash): ... + def __init__(self, version: Any | None = ..., **kwds) -> None: ... diff --git a/stubs/passlib/passlib/handlers/cisco.pyi b/stubs/passlib/passlib/handlers/cisco.pyi new file mode 100644 index 0000000..2820a67 --- /dev/null +++ b/stubs/passlib/passlib/handlers/cisco.pyi @@ -0,0 +1,27 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +class cisco_pix(uh.HasUserContext, uh.StaticHandler): + name: ClassVar[str] + truncate_size: ClassVar[int] + truncate_error: ClassVar[bool] + truncate_verify_reject: ClassVar[bool] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + +class cisco_asa(cisco_pix): ... + +class cisco_type7(uh.GenericHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + min_salt_value: ClassVar[int] + max_salt_value: ClassVar[int] + @classmethod + def using(cls, salt: int | None = ..., **kwds): ... # type: ignore[override] + @classmethod + def from_string(cls, hash): ... + salt: int + def __init__(self, salt: int | None = ..., **kwds) -> None: ... + @classmethod + def decode(cls, hash, encoding: str = ...): ... diff --git a/stubs/passlib/passlib/handlers/des_crypt.pyi b/stubs/passlib/passlib/handlers/des_crypt.pyi new file mode 100644 index 0000000..a8a10ab --- /dev/null +++ b/stubs/passlib/passlib/handlers/des_crypt.pyi @@ -0,0 +1,52 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +class des_crypt(uh.TruncateMixin, uh.HasManyBackends, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + truncate_size: ClassVar[int] + @classmethod + def from_string(cls, hash): ... + backends: ClassVar[tuple[str, ...]] + +class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + @classmethod + def from_string(cls, hash): ... + @classmethod + def using(cls, **kwds): ... + backends: ClassVar[tuple[str, ...]] + +class bigcrypt(uh.HasSalt, uh.GenericHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + @classmethod + def from_string(cls, hash): ... + +class crypt16(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + truncate_size: ClassVar[int] + @classmethod + def from_string(cls, hash): ... diff --git a/stubs/passlib/passlib/handlers/digests.pyi b/stubs/passlib/passlib/handlers/digests.pyi new file mode 100644 index 0000000..a0c9f7e --- /dev/null +++ b/stubs/passlib/passlib/handlers/digests.pyi @@ -0,0 +1,29 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class HexDigestHash(uh.StaticHandler): + checksum_chars: ClassVar[str] + supported: ClassVar[bool] + +def create_hex_hash(digest, module=..., django_name: Any | None = ..., required: bool = ...): ... + +hex_md4: Any +hex_md5: Any +hex_sha1: Any +hex_sha256: Any +hex_sha512: Any + +class htdigest(uh.MinimalHandler): + name: ClassVar[str] + default_encoding: ClassVar[str] + @classmethod + def hash(cls, secret, user, realm, encoding: Any | None = ...): ... # type: ignore[override] + @classmethod + def verify(cls, secret, hash, user, realm, encoding: str = ...): ... # type: ignore[override] + @classmethod + def identify(cls, hash): ... + @classmethod + def genconfig(cls): ... + @classmethod + def genhash(cls, secret, config, user, realm, encoding: Any | None = ...): ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/django.pyi b/stubs/passlib/passlib/handlers/django.pyi new file mode 100644 index 0000000..2996700 --- /dev/null +++ b/stubs/passlib/passlib/handlers/django.pyi @@ -0,0 +1,81 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh +from passlib.handlers.bcrypt import _wrapped_bcrypt +from passlib.ifc import DisabledHash + +class DjangoSaltedHash(uh.HasSalt, uh.GenericHandler): + default_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + checksum_chars: ClassVar[str] + @classmethod + def from_string(cls, hash): ... + +class DjangoVariableHash(uh.HasRounds, DjangoSaltedHash): # type: ignore[misc] + min_rounds: ClassVar[int] + @classmethod + def from_string(cls, hash): ... + +class django_salted_sha1(DjangoSaltedHash): + name: ClassVar[str] + django_name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + +class django_salted_md5(DjangoSaltedHash): + name: ClassVar[str] + django_name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + +django_bcrypt: Any + +class django_bcrypt_sha256(_wrapped_bcrypt): + name: ClassVar[str] + django_name: ClassVar[str] + django_prefix: ClassVar[str] + @classmethod + def identify(cls, hash): ... + @classmethod + def from_string(cls, hash): ... + +class django_pbkdf2_sha256(DjangoVariableHash): + name: ClassVar[str] + django_name: ClassVar[str] + ident: ClassVar[str] + min_salt_size: ClassVar[int] + max_rounds: ClassVar[int] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + default_rounds: ClassVar[int] + +class django_pbkdf2_sha1(django_pbkdf2_sha256): + name: ClassVar[str] + django_name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_rounds: ClassVar[int] + +django_argon2: Any + +class django_des_crypt(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + django_name: ClassVar[str] + ident: ClassVar[str] + checksum_chars: ClassVar[str] + salt_chars: ClassVar[str] + checksum_size: ClassVar[int] + min_salt_size: ClassVar[int] + default_salt_size: ClassVar[int] + truncate_size: ClassVar[int] + use_duplicate_salt: bool + @classmethod + def from_string(cls, hash): ... + +class django_disabled(DisabledHash, uh.StaticHandler): + name: ClassVar[str] + suffix_length: ClassVar[int] + @classmethod + def identify(cls, hash: str | bytes) -> bool: ... + @classmethod + def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/fshp.pyi b/stubs/passlib/passlib/handlers/fshp.pyi new file mode 100644 index 0000000..373a44a --- /dev/null +++ b/stubs/passlib/passlib/handlers/fshp.pyi @@ -0,0 +1,26 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_chars: ClassVar[str] + ident: ClassVar[str] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[None] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + default_variant: ClassVar[int] + @classmethod + def using(cls, variant: int | str | bytes | None = ..., **kwds): ... # type: ignore[override] + variant: int | None + use_defaults: Any + def __init__(self, variant: int | str | bytes | None = ..., **kwds) -> None: ... + @property + def checksum_alg(self): ... + @property + def checksum_size(self): ... + @classmethod + def from_string(cls, hash): ... diff --git a/stubs/passlib/passlib/handlers/ldap_digests.pyi b/stubs/passlib/passlib/handlers/ldap_digests.pyi new file mode 100644 index 0000000..a37b5a8 --- /dev/null +++ b/stubs/passlib/passlib/handlers/ldap_digests.pyi @@ -0,0 +1,81 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh +from passlib.handlers.misc import plaintext +from passlib.utils.handlers import PrefixWrapper + +__all__ = [ + "ldap_plaintext", + "ldap_md5", + "ldap_sha1", + "ldap_salted_md5", + "ldap_salted_sha1", + "ldap_salted_sha256", + "ldap_salted_sha512", + "ldap_des_crypt", + "ldap_bsdi_crypt", + "ldap_md5_crypt", + "ldap_sha1_crypt", + "ldap_bcrypt", + "ldap_sha256_crypt", + "ldap_sha512_crypt", +] + +class _Base64DigestHelper(uh.StaticHandler): + ident: ClassVar[str | None] + checksum_chars: ClassVar[str] + +class _SaltedBase64DigestHelper(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): + checksum_chars: ClassVar[str] + ident: ClassVar[str | None] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_salt_size: ClassVar[int] + @classmethod + def from_string(cls, hash): ... + +class ldap_md5(_Base64DigestHelper): + name: ClassVar[str] + ident: ClassVar[str] + +class ldap_sha1(_Base64DigestHelper): + name: ClassVar[str] + ident: ClassVar[str] + +class ldap_salted_md5(_SaltedBase64DigestHelper): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + +class ldap_salted_sha1(_SaltedBase64DigestHelper): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + +class ldap_salted_sha256(_SaltedBase64DigestHelper): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_salt_size: ClassVar[int] + +class ldap_salted_sha512(_SaltedBase64DigestHelper): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_salt_size: ClassVar[int] + +class ldap_plaintext(plaintext): + name: ClassVar[str] + @classmethod + def genconfig(cls): ... + @classmethod + def identify(cls, hash): ... + +# Dynamically created +ldap_sha512_crypt: PrefixWrapper +ldap_sha256_crypt: PrefixWrapper +ldap_sha1_crypt: PrefixWrapper +ldap_bcrypt: PrefixWrapper +ldap_md5_crypt: PrefixWrapper +ldap_bsdi_crypt: PrefixWrapper +ldap_des_crypt: PrefixWrapper diff --git a/stubs/passlib/passlib/handlers/md5_crypt.pyi b/stubs/passlib/passlib/handlers/md5_crypt.pyi new file mode 100644 index 0000000..53bf4af --- /dev/null +++ b/stubs/passlib/passlib/handlers/md5_crypt.pyi @@ -0,0 +1,20 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +class _MD5_Common(uh.HasSalt, uh.GenericHandler): + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + @classmethod + def from_string(cls, hash): ... + +class md5_crypt(uh.HasManyBackends, _MD5_Common): + name: ClassVar[str] + ident: ClassVar[str] + backends: ClassVar[tuple[str, ...]] + +class apr_md5_crypt(_MD5_Common): + name: ClassVar[str] + ident: ClassVar[str] diff --git a/stubs/passlib/passlib/handlers/misc.pyi b/stubs/passlib/passlib/handlers/misc.pyi new file mode 100644 index 0000000..4e15391 --- /dev/null +++ b/stubs/passlib/passlib/handlers/misc.pyi @@ -0,0 +1,45 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh +from passlib.ifc import DisabledHash + +class unix_fallback(DisabledHash, uh.StaticHandler): + name: ClassVar[str] + @classmethod + def identify(cls, hash: str | bytes) -> bool: ... + enable_wildcard: Any + def __init__(self, enable_wildcard: bool = ..., **kwds) -> None: ... + @classmethod + def verify(cls, secret: str | bytes, hash: str | bytes, enable_wildcard: bool = ...): ... # type: ignore[override] + +class unix_disabled(DisabledHash, uh.MinimalHandler): + name: ClassVar[str] + default_marker: ClassVar[str] + @classmethod + def using(cls, marker: Any | None = ..., **kwds): ... # type: ignore[override] + @classmethod + def identify(cls, hash: str | bytes) -> bool: ... + @classmethod + def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] + @classmethod + def hash(cls, secret: str | bytes, **kwds) -> str: ... + @classmethod + def genhash(cls, secret: str | bytes, config, marker: Any | None = ...): ... # type: ignore[override] + @classmethod + def disable(cls, hash: str | bytes | None = ...) -> str: ... + @classmethod + def enable(cls, hash: str | bytes) -> str: ... + +class plaintext(uh.MinimalHandler): + name: ClassVar[str] + default_encoding: ClassVar[str] + @classmethod + def identify(cls, hash: str | bytes): ... + @classmethod + def hash(cls, secret: str | bytes, encoding: Any | None = ...): ... # type: ignore[override] + @classmethod + def verify(cls, secret: str | bytes, hash: str | bytes, encoding: str | None = ...): ... # type: ignore[override] + @classmethod + def genconfig(cls): ... + @classmethod + def genhash(cls, secret, config, encoding: str | None = ...): ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/mssql.pyi b/stubs/passlib/passlib/handlers/mssql.pyi new file mode 100644 index 0000000..3bf6fc4 --- /dev/null +++ b/stubs/passlib/passlib/handlers/mssql.pyi @@ -0,0 +1,21 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): + name: ClassVar[str] + checksum_size: ClassVar[int] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + @classmethod + def from_string(cls, hash): ... + @classmethod + def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] + +class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): + name: ClassVar[str] + checksum_size: ClassVar[int] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + @classmethod + def from_string(cls, hash): ... diff --git a/stubs/passlib/passlib/handlers/mysql.pyi b/stubs/passlib/passlib/handlers/mysql.pyi new file mode 100644 index 0000000..ae08bdb --- /dev/null +++ b/stubs/passlib/passlib/handlers/mysql.pyi @@ -0,0 +1,15 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +__all__ = ["mysql323"] + +class mysql323(uh.StaticHandler): + name: ClassVar[str] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + +class mysql41(uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] diff --git a/stubs/passlib/passlib/handlers/oracle.pyi b/stubs/passlib/passlib/handlers/oracle.pyi new file mode 100644 index 0000000..6b9931e --- /dev/null +++ b/stubs/passlib/passlib/handlers/oracle.pyi @@ -0,0 +1,20 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +__all__: list[str] = [] + +class oracle10(uh.HasUserContext, uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + +class oracle11(uh.HasSalt, uh.GenericHandler): + name: ClassVar[str] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + @classmethod + def from_string(cls, hash): ... diff --git a/stubs/passlib/passlib/handlers/pbkdf2.pyi b/stubs/passlib/passlib/handlers/pbkdf2.pyi new file mode 100644 index 0000000..c28854b --- /dev/null +++ b/stubs/passlib/passlib/handlers/pbkdf2.pyi @@ -0,0 +1,89 @@ +from _typeshed import Self +from typing import ClassVar + +import passlib.utils.handlers as uh +from passlib.utils.handlers import PrefixWrapper + +class Pbkdf2DigestHandler(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] + checksum_chars: ClassVar[str] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + @classmethod + def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + +# dynamically created by create_pbkdf2_hash() +class pbkdf2_sha1(Pbkdf2DigestHandler): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + encoded_checksum_size: ClassVar[int] + +# dynamically created by create_pbkdf2_hash() +class pbkdf2_sha256(Pbkdf2DigestHandler): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + encoded_checksum_size: ClassVar[int] + +# dynamically created by create_pbkdf2_hash() +class pbkdf2_sha512(Pbkdf2DigestHandler): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + encoded_checksum_size: ClassVar[int] + +ldap_pbkdf2_sha1: PrefixWrapper +ldap_pbkdf2_sha256: PrefixWrapper +ldap_pbkdf2_sha512: PrefixWrapper + +class cta_pbkdf2_sha1(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + @classmethod + def from_string(cls, hash): ... + +class dlitz_pbkdf2_sha1(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + ident: ClassVar[str] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + @classmethod + def from_string(cls, hash): ... + +class atlassian_pbkdf2_sha1(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + @classmethod + def from_string(cls, hash): ... + +class grub_pbkdf2_sha512(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + @classmethod + def from_string(cls, hash): ... diff --git a/stubs/passlib/passlib/handlers/phpass.pyi b/stubs/passlib/passlib/handlers/phpass.pyi new file mode 100644 index 0000000..93a24ed --- /dev/null +++ b/stubs/passlib/passlib/handlers/phpass.pyi @@ -0,0 +1,20 @@ +from _typeshed import Self +from typing import ClassVar + +import passlib.utils.handlers as uh + +class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_chars: ClassVar[str] + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + default_ident: ClassVar[str] + ident_values: ClassVar[tuple[str, ...]] + ident_aliases: ClassVar[dict[str, str]] + @classmethod + def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/postgres.pyi b/stubs/passlib/passlib/handlers/postgres.pyi new file mode 100644 index 0000000..99a515e --- /dev/null +++ b/stubs/passlib/passlib/handlers/postgres.pyi @@ -0,0 +1,8 @@ +from typing import ClassVar + +import passlib.utils.handlers as uh + +class postgres_md5(uh.HasUserContext, uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] diff --git a/stubs/passlib/passlib/handlers/roundup.pyi b/stubs/passlib/passlib/handlers/roundup.pyi new file mode 100644 index 0000000..53ca720 --- /dev/null +++ b/stubs/passlib/passlib/handlers/roundup.pyi @@ -0,0 +1,5 @@ +from typing import Any + +roundup_plaintext: Any +ldap_hex_md5: Any +ldap_hex_sha1: Any diff --git a/stubs/passlib/passlib/handlers/scram.pyi b/stubs/passlib/passlib/handlers/scram.pyi new file mode 100644 index 0000000..b553914 --- /dev/null +++ b/stubs/passlib/passlib/handlers/scram.pyi @@ -0,0 +1,28 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + ident: ClassVar[str] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + default_algs: ClassVar[list[str]] + algs: Any | None + @classmethod + def extract_digest_info(cls, hash, alg): ... + @classmethod + def extract_digest_algs(cls, hash, format: str = ...): ... + @classmethod + def derive_digest(cls, password, salt, rounds, alg): ... + @classmethod + def from_string(cls, hash): ... + @classmethod + def using(cls, default_algs: Any | None = ..., algs: Any | None = ..., **kwds): ... # type: ignore[override] + def __init__(self, algs: Any | None = ..., **kwds) -> None: ... + @classmethod + def verify(cls, secret, hash, full: bool = ...): ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/scrypt.pyi b/stubs/passlib/passlib/handlers/scrypt.pyi new file mode 100644 index 0000000..80b0156 --- /dev/null +++ b/stubs/passlib/passlib/handlers/scrypt.pyi @@ -0,0 +1,32 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class scrypt(uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.HasManyIdents, uh.GenericHandler): # type: ignore[misc] + backends: ClassVar[tuple[str, ...]] + name: ClassVar[str] + checksum_size: ClassVar[int] + default_ident: ClassVar[str] + ident_values: ClassVar[tuple[str, ...]] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + parallelism: int + block_size: int + @classmethod + def using(cls, block_size: Any | None = ..., **kwds): ... # type: ignore[override] + @classmethod + def from_string(cls, hash): ... + @classmethod + def parse(cls, hash): ... + def to_string(self): ... + def __init__(self, block_size: Any | None = ..., **kwds) -> None: ... + @classmethod + def get_backend(cls): ... + @classmethod + def has_backend(cls, name: str = ...): ... + @classmethod + def set_backend(cls, name: str = ..., dryrun: bool = ...) -> None: ... diff --git a/stubs/passlib/passlib/handlers/sha1_crypt.pyi b/stubs/passlib/passlib/handlers/sha1_crypt.pyi new file mode 100644 index 0000000..601f616 --- /dev/null +++ b/stubs/passlib/passlib/handlers/sha1_crypt.pyi @@ -0,0 +1,23 @@ +from _typeshed import Self +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +log: Any + +class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + checksum_chars: ClassVar[str] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + @classmethod + def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def to_string(self, config: bool = ...) -> str: ... + backends: ClassVar[tuple[str, ...]] diff --git a/stubs/passlib/passlib/handlers/sha2_crypt.pyi b/stubs/passlib/passlib/handlers/sha2_crypt.pyi new file mode 100644 index 0000000..849d7f6 --- /dev/null +++ b/stubs/passlib/passlib/handlers/sha2_crypt.pyi @@ -0,0 +1,29 @@ +from _typeshed import Self +from typing import ClassVar + +import passlib.utils.handlers as uh + +class _SHA2_Common(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + checksum_chars: ClassVar[str] + max_salt_size: ClassVar[int] + salt_chars: ClassVar[str] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + implicit_rounds: bool + def __init__(self, implicit_rounds: bool | None = ..., **kwds) -> None: ... + @classmethod + def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + backends: ClassVar[tuple[str, ...]] + +class sha256_crypt(_SHA2_Common): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_rounds: ClassVar[int] + +class sha512_crypt(_SHA2_Common): + name: ClassVar[str] + ident: ClassVar[str] + checksum_size: ClassVar[int] + default_rounds: ClassVar[int] diff --git a/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi b/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi new file mode 100644 index 0000000..9436095 --- /dev/null +++ b/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi @@ -0,0 +1,24 @@ +from _typeshed import Self +from typing import ClassVar + +import passlib.utils.handlers as uh + +class sun_md5_crypt(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + default_salt_size: ClassVar[int] + max_salt_size: ClassVar[int | None] + salt_chars: ClassVar[str] + default_rounds: ClassVar[int] + min_rounds: ClassVar[int] + max_rounds: ClassVar[int] + rounds_cost: ClassVar[str] + ident_values: ClassVar[tuple[str, ...]] + bare_salt: bool + def __init__(self, bare_salt: bool = ..., **kwds) -> None: ... + @classmethod + def identify(cls, hash): ... + @classmethod + def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def to_string(self, _withchk: bool = ...) -> str: ... diff --git a/stubs/passlib/passlib/handlers/windows.pyi b/stubs/passlib/passlib/handlers/windows.pyi new file mode 100644 index 0000000..05db84f --- /dev/null +++ b/stubs/passlib/passlib/handlers/windows.pyi @@ -0,0 +1,36 @@ +from typing import Any, ClassVar + +import passlib.utils.handlers as uh + +class lmhash(uh.TruncateMixin, uh.HasEncodingContext, uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + truncate_size: ClassVar[int] + @classmethod + def raw(cls, secret, encoding: Any | None = ...): ... + +class nthash(uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + @classmethod + def raw(cls, secret): ... + @classmethod + def raw_nthash(cls, secret, hex: bool = ...): ... + +bsd_nthash: Any + +class msdcc(uh.HasUserContext, uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + @classmethod + def raw(cls, secret, user): ... + +class msdcc2(uh.HasUserContext, uh.StaticHandler): + name: ClassVar[str] + checksum_chars: ClassVar[str] + checksum_size: ClassVar[int] + @classmethod + def raw(cls, secret, user): ... diff --git a/stubs/passlib/passlib/hash.pyi b/stubs/passlib/passlib/hash.pyi new file mode 100644 index 0000000..b71311a --- /dev/null +++ b/stubs/passlib/passlib/hash.pyi @@ -0,0 +1,75 @@ +from passlib.handlers.argon2 import argon2 as argon2 +from passlib.handlers.bcrypt import bcrypt as bcrypt, bcrypt_sha256 as bcrypt_sha256 +from passlib.handlers.cisco import cisco_asa as cisco_asa, cisco_pix as cisco_pix, cisco_type7 as cisco_type7 +from passlib.handlers.des_crypt import bigcrypt as bigcrypt, bsdi_crypt as bsdi_crypt, crypt16 as crypt16, des_crypt as des_crypt +from passlib.handlers.digests import ( + hex_md4 as hex_md4, + hex_md5 as hex_md5, + hex_sha1 as hex_sha1, + hex_sha256 as hex_sha256, + hex_sha512 as hex_sha512, + htdigest as htdigest, +) +from passlib.handlers.django import ( + django_bcrypt as django_bcrypt, + django_bcrypt_sha256 as django_bcrypt_sha256, + django_des_crypt as django_des_crypt, + django_disabled as django_disabled, + django_pbkdf2_sha1 as django_pbkdf2_sha1, + django_pbkdf2_sha256 as django_pbkdf2_sha256, + django_salted_md5 as django_salted_md5, + django_salted_sha1 as django_salted_sha1, +) +from passlib.handlers.fshp import fshp as fshp +from passlib.handlers.ldap_digests import ( + ldap_bcrypt as ldap_bcrypt, + ldap_bsdi_crypt as ldap_bsdi_crypt, + ldap_des_crypt as ldap_des_crypt, + ldap_md5 as ldap_md5, + ldap_md5_crypt as ldap_md5_crypt, + ldap_plaintext as ldap_plaintext, + ldap_salted_md5 as ldap_salted_md5, + ldap_salted_sha1 as ldap_salted_sha1, + ldap_salted_sha256 as ldap_salted_sha256, + ldap_salted_sha512 as ldap_salted_sha512, + ldap_sha1 as ldap_sha1, + ldap_sha1_crypt as ldap_sha1_crypt, + ldap_sha256_crypt as ldap_sha256_crypt, + ldap_sha512_crypt as ldap_sha512_crypt, +) +from passlib.handlers.md5_crypt import apr_md5_crypt as apr_md5_crypt, md5_crypt as md5_crypt +from passlib.handlers.misc import plaintext as plaintext, unix_disabled as unix_disabled, unix_fallback as unix_fallback +from passlib.handlers.mssql import mssql2000 as mssql2000, mssql2005 as mssql2005 +from passlib.handlers.mysql import mysql41 as mysql41, mysql323 as mysql323 +from passlib.handlers.oracle import oracle10 as oracle10, oracle11 as oracle11 +from passlib.handlers.pbkdf2 import ( + atlassian_pbkdf2_sha1 as atlassian_pbkdf2_sha1, + cta_pbkdf2_sha1 as cta_pbkdf2_sha1, + dlitz_pbkdf2_sha1 as dlitz_pbkdf2_sha1, + grub_pbkdf2_sha512 as grub_pbkdf2_sha512, + ldap_pbkdf2_sha1 as ldap_pbkdf2_sha1, + ldap_pbkdf2_sha256 as ldap_pbkdf2_sha256, + ldap_pbkdf2_sha512 as ldap_pbkdf2_sha512, + pbkdf2_sha1 as pbkdf2_sha1, + pbkdf2_sha256 as pbkdf2_sha256, + pbkdf2_sha512 as pbkdf2_sha512, +) +from passlib.handlers.phpass import phpass as phpass +from passlib.handlers.postgres import postgres_md5 as postgres_md5 +from passlib.handlers.roundup import ( + ldap_hex_md5 as ldap_hex_md5, + ldap_hex_sha1 as ldap_hex_sha1, + roundup_plaintext as roundup_plaintext, +) +from passlib.handlers.scram import scram as scram +from passlib.handlers.scrypt import scrypt as scrypt +from passlib.handlers.sha1_crypt import sha1_crypt as sha1_crypt +from passlib.handlers.sha2_crypt import sha256_crypt as sha256_crypt, sha512_crypt as sha512_crypt +from passlib.handlers.sun_md5_crypt import sun_md5_crypt as sun_md5_crypt +from passlib.handlers.windows import ( + bsd_nthash as bsd_nthash, + lmhash as lmhash, + msdcc as msdcc, + msdcc2 as msdcc2, + nthash as nthash, +) diff --git a/stubs/passlib/passlib/hosts.pyi b/stubs/passlib/passlib/hosts.pyi new file mode 100644 index 0000000..6c4040d --- /dev/null +++ b/stubs/passlib/passlib/hosts.pyi @@ -0,0 +1,8 @@ +from typing import Any + +linux_context: Any +linux2_context: Any +freebsd_context: Any +openbsd_context: Any +netbsd_context: Any +host_context: Any diff --git a/stubs/passlib/passlib/ifc.pyi b/stubs/passlib/passlib/ifc.pyi new file mode 100644 index 0000000..7f477cf --- /dev/null +++ b/stubs/passlib/passlib/ifc.pyi @@ -0,0 +1,38 @@ +from _typeshed import Self +from abc import ABCMeta, abstractmethod +from typing import Any, ClassVar +from typing_extensions import Literal + +class PasswordHash(metaclass=ABCMeta): + is_disabled: ClassVar[bool] + truncate_size: ClassVar[int | None] + truncate_error: ClassVar[bool] + truncate_verify_reject: ClassVar[bool] + @classmethod + @abstractmethod + def hash(cls, secret: str | bytes, **setting_and_context_kwds) -> str: ... + @classmethod + def encrypt(cls, secret: str | bytes, **kwds) -> str: ... + @classmethod + @abstractmethod + def verify(cls, secret: str | bytes, hash: str | bytes, **context_kwds): ... + @classmethod + @abstractmethod + def using(cls: type[Self], relaxed: bool = ..., **kwds: Any) -> type[Self]: ... + @classmethod + def needs_update(cls, hash: str, secret: str | bytes | None = ...) -> bool: ... + @classmethod + @abstractmethod + def identify(cls, hash: str | bytes) -> bool: ... + @classmethod + def genconfig(cls, **setting_kwds: Any) -> str: ... + @classmethod + def genhash(cls, secret: str | bytes, config: str, **context: Any) -> str: ... + deprecated: bool + +class DisabledHash(PasswordHash, metaclass=ABCMeta): + is_disabled: ClassVar[Literal[True]] + @classmethod + def disable(cls, hash: str | None = ...) -> str: ... + @classmethod + def enable(cls, hash: str) -> str: ... diff --git a/stubs/passlib/passlib/pwd.pyi b/stubs/passlib/passlib/pwd.pyi new file mode 100644 index 0000000..618a80e --- /dev/null +++ b/stubs/passlib/passlib/pwd.pyi @@ -0,0 +1,55 @@ +from abc import abstractmethod +from collections.abc import MutableMapping +from typing import Any + +class SequenceGenerator: + length: Any + requested_entropy: str + rng: Any + @property + @abstractmethod + def symbol_count(self) -> int: ... + def __init__(self, entropy: Any | None = ..., length: Any | None = ..., rng: Any | None = ..., **kwds) -> None: ... + @property + def entropy_per_symbol(self) -> float: ... + @property + def entropy(self) -> float: ... + def __next__(self) -> None: ... + def __call__(self, returns: Any | None = ...): ... + def __iter__(self): ... + +default_charsets: Any + +class WordGenerator(SequenceGenerator): + charset: str + chars: Any + def __init__(self, chars: Any | None = ..., charset: Any | None = ..., **kwds) -> None: ... + @property + def symbol_count(self): ... + def __next__(self): ... + +def genword(entropy: Any | None = ..., length: Any | None = ..., returns: Any | None = ..., **kwds): ... + +class WordsetDict(MutableMapping[Any, Any]): + paths: Any + def __init__(self, *args, **kwds) -> None: ... + def __getitem__(self, key): ... + def set_path(self, key, path) -> None: ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __iter__(self): ... + def __len__(self): ... + def __contains__(self, key): ... + +default_wordsets: Any + +class PhraseGenerator(SequenceGenerator): + wordset: str + words: Any + sep: str + def __init__(self, wordset: Any | None = ..., words: Any | None = ..., sep: Any | None = ..., **kwds) -> None: ... + @property + def symbol_count(self): ... + def __next__(self): ... + +def genphrase(entropy: Any | None = ..., length: Any | None = ..., returns: Any | None = ..., **kwds): ... diff --git a/stubs/passlib/passlib/registry.pyi b/stubs/passlib/passlib/registry.pyi new file mode 100644 index 0000000..18341cf --- /dev/null +++ b/stubs/passlib/passlib/registry.pyi @@ -0,0 +1,13 @@ +from typing import Any + +class _PasslibRegistryProxy: + __name__: str + __package__: Any + def __getattr__(self, attr): ... + def __setattr__(self, attr, value) -> None: ... + def __dir__(self): ... + +def register_crypt_handler_path(name, path) -> None: ... +def register_crypt_handler(handler, force: bool = ..., _attr: Any | None = ...) -> None: ... +def get_crypt_handler(name, default=...): ... +def list_crypt_handlers(loaded_only: bool = ...): ... diff --git a/stubs/passlib/passlib/totp.pyi b/stubs/passlib/passlib/totp.pyi new file mode 100644 index 0000000..0f91602 --- /dev/null +++ b/stubs/passlib/passlib/totp.pyi @@ -0,0 +1,127 @@ +from typing import Any + +from passlib.exc import ( + InvalidTokenError as InvalidTokenError, + MalformedTokenError as MalformedTokenError, + TokenError as TokenError, + UsedTokenError as UsedTokenError, +) +from passlib.utils import SequenceMixin + +class AppWallet: + salt_size: int + encrypt_cost: int + default_tag: Any + def __init__( + self, + secrets: Any | None = ..., + default_tag: Any | None = ..., + encrypt_cost: Any | None = ..., + secrets_path: Any | None = ..., + ) -> None: ... + @property + def has_secrets(self): ... + def get_secret(self, tag): ... + def encrypt_key(self, key): ... + def decrypt_key(self, enckey): ... + +class TOTP: + min_json_version: int + json_version: int + wallet: Any + now: Any + digits: int + alg: str + label: Any + issuer: Any + period: int + changed: bool + @classmethod + def using( + cls, + digits: Any | None = ..., + alg: Any | None = ..., + period: Any | None = ..., + issuer: Any | None = ..., + wallet: Any | None = ..., + now: Any | None = ..., + **kwds, + ): ... + @classmethod + def new(cls, **kwds): ... + def __init__( + self, + key: Any | None = ..., + format: str = ..., + new: bool = ..., + digits: Any | None = ..., + alg: Any | None = ..., + size: Any | None = ..., + period: Any | None = ..., + label: Any | None = ..., + issuer: Any | None = ..., + changed: bool = ..., + **kwds, + ) -> None: ... + @property + def key(self): ... + @key.setter + def key(self, value) -> None: ... + @property + def encrypted_key(self): ... + @encrypted_key.setter + def encrypted_key(self, value) -> None: ... + @property + def hex_key(self): ... + @property + def base32_key(self): ... + def pretty_key(self, format: str = ..., sep: str = ...): ... + @classmethod + def normalize_time(cls, time): ... + def normalize_token(self_or_cls, token): ... + def generate(self, time: Any | None = ...): ... + @classmethod + def verify(cls, token, source, **kwds): ... + def match(self, token, time: Any | None = ..., window: int = ..., skew: int = ..., last_counter: Any | None = ...): ... + @classmethod + def from_source(cls, source): ... + @classmethod + def from_uri(cls, uri): ... + def to_uri(self, label: Any | None = ..., issuer: Any | None = ...): ... + @classmethod + def from_json(cls, source): ... + def to_json(self, encrypt: Any | None = ...): ... + @classmethod + def from_dict(cls, source): ... + def to_dict(self, encrypt: Any | None = ...): ... + +class TotpToken(SequenceMixin): + totp: Any + token: Any + counter: Any + def __init__(self, totp, token, counter) -> None: ... + @property + def start_time(self): ... + @property + def expire_time(self): ... + @property + def remaining(self): ... + @property + def valid(self): ... + +class TotpMatch(SequenceMixin): + totp: Any + counter: int + time: int + window: int + def __init__(self, totp, counter, time, window: int = ...) -> None: ... + @property + def expected_counter(self): ... + @property + def skipped(self): ... + @property + def expire_time(self): ... + @property + def cache_seconds(self): ... + @property + def cache_time(self): ... diff --git a/stubs/passlib/passlib/utils/__init__.pyi b/stubs/passlib/passlib/utils/__init__.pyi new file mode 100644 index 0000000..e3905e5 --- /dev/null +++ b/stubs/passlib/passlib/utils/__init__.pyi @@ -0,0 +1,74 @@ +import timeit +from collections.abc import Generator +from hmac import compare_digest +from typing import Any + +from passlib.utils.compat import JYTHON as JYTHON + +__all__ = [ + "JYTHON", + "sys_bits", + "unix_crypt_schemes", + "rounds_cost_values", + "consteq", + "saslprep", + "xor_bytes", + "render_bytes", + "is_same_codec", + "is_ascii_safe", + "to_bytes", + "to_unicode", + "to_native_str", + "has_crypt", + "test_crypt", + "safe_crypt", + "tick", + "rng", + "getrandbytes", + "getrandstr", + "generate_password", + "is_crypt_handler", + "is_crypt_context", + "has_rounds_info", + "has_salt_info", +] + +sys_bits: Any +unix_crypt_schemes: list[str] +rounds_cost_values: Any + +class SequenceMixin: + def __getitem__(self, idx): ... + def __iter__(self): ... + def __len__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +consteq = compare_digest + +def str_consteq(left, right): ... +def saslprep(source, param: str = ...): ... +def render_bytes(source, *args): ... +def xor_bytes(left, right): ... +def is_same_codec(left, right): ... +def is_ascii_safe(source): ... +def to_bytes(source, encoding: str = ..., param: str = ..., source_encoding: Any | None = ...): ... +def to_unicode(source, encoding: str = ..., param: str = ...): ... +def to_native_str(source, encoding: str = ..., param: str = ...): ... + +has_crypt: bool + +def safe_crypt(secret, hash) -> None: ... +def test_crypt(secret, hash): ... + +timer = timeit.default_timer +tick = timer +rng: Any + +def getrandbytes(rng, count) -> Generator[None, None, Any]: ... +def getrandstr(rng, charset, count) -> Generator[None, None, Any]: ... +def generate_password(size: int = ..., charset=...): ... +def is_crypt_handler(obj): ... +def is_crypt_context(obj): ... +def has_rounds_info(handler): ... +def has_salt_info(handler): ... diff --git a/stubs/passlib/passlib/utils/binary.pyi b/stubs/passlib/passlib/utils/binary.pyi new file mode 100644 index 0000000..a606660 --- /dev/null +++ b/stubs/passlib/passlib/utils/binary.pyi @@ -0,0 +1,50 @@ +from typing import Any + +BASE64_CHARS: Any +AB64_CHARS: Any +HASH64_CHARS: Any +BCRYPT_CHARS: Any +PADDED_BASE64_CHARS: Any +HEX_CHARS: Any +UPPER_HEX_CHARS: Any +LOWER_HEX_CHARS: Any +ALL_BYTE_VALUES: Any + +def compile_byte_translation(mapping, source: Any | None = ...): ... +def b64s_encode(data): ... +def b64s_decode(data): ... +def ab64_encode(data): ... +def ab64_decode(data): ... +def b32encode(source): ... +def b32decode(source): ... + +class Base64Engine: + bytemap: Any + big: Any + def __init__(self, charmap, big: bool = ...) -> None: ... + @property + def charmap(self): ... + def encode_bytes(self, source): ... + def decode_bytes(self, source): ... + def check_repair_unused(self, source): ... + def repair_unused(self, source): ... + def encode_transposed_bytes(self, source, offsets): ... + def decode_transposed_bytes(self, source, offsets): ... + def decode_int6(self, source): ... + def decode_int12(self, source): ... + def decode_int24(self, source): ... + def decode_int30(self, source): ... + def decode_int64(self, source): ... + def encode_int6(self, value): ... + def encode_int12(self, value): ... + def encode_int24(self, value): ... + def encode_int30(self, value): ... + def encode_int64(self, value): ... + +class LazyBase64Engine(Base64Engine): + def __init__(self, *args, **kwds) -> None: ... + def __getattribute__(self, attr): ... + +h64: Any +h64big: Any +bcrypt64: Any diff --git a/stubs/passlib/passlib/utils/compat/__init__.pyi b/stubs/passlib/passlib/utils/compat/__init__.pyi new file mode 100644 index 0000000..808c7f8 --- /dev/null +++ b/stubs/passlib/passlib/utils/compat/__init__.pyi @@ -0,0 +1,8 @@ +from typing_extensions import Literal + +PY2: Literal[False] +PY3: Literal[True] +PY26: Literal[False] +JYTHON: bool +PYPY: bool +PYSTON: bool diff --git a/stubs/passlib/passlib/utils/compat/_ordered_dict.pyi b/stubs/passlib/passlib/utils/compat/_ordered_dict.pyi new file mode 100644 index 0000000..ca867ec --- /dev/null +++ b/stubs/passlib/passlib/utils/compat/_ordered_dict.pyi @@ -0,0 +1,26 @@ +from collections.abc import Generator +from typing import Any + +class OrderedDict(dict[Any, Any]): + def __init__(self, *args, **kwds) -> None: ... + def __setitem__(self, key, value, dict_setitem=...) -> None: ... + def __delitem__(self, key, dict_delitem=...) -> None: ... + def __iter__(self): ... + def __reversed__(self) -> Generator[Any, None, None]: ... + def clear(self) -> None: ... + def popitem(self, last: bool = ...): ... + def keys(self): ... + def values(self): ... + def items(self): ... + def iterkeys(self): ... + def itervalues(self) -> Generator[Any, None, None]: ... + def iteritems(self) -> Generator[Any, None, None]: ... + def update(*args, **kwds) -> None: ... # type: ignore[override] + def pop(self, key, default=...): ... + def setdefault(self, key, default: Any | None = ...): ... + def __reduce__(self): ... + def copy(self): ... + @classmethod + def fromkeys(cls, iterable, value: Any | None = ...): ... + def __eq__(self, other): ... + def __ne__(self, other): ... diff --git a/stubs/passlib/passlib/utils/decor.pyi b/stubs/passlib/passlib/utils/decor.pyi new file mode 100644 index 0000000..c5f5762 --- /dev/null +++ b/stubs/passlib/passlib/utils/decor.pyi @@ -0,0 +1,41 @@ +from typing import Any + +class classproperty: + im_func: Any + def __init__(self, func) -> None: ... + def __get__(self, obj, cls): ... + @property + def __func__(self): ... + +class hybrid_method: + func: Any + def __init__(self, func) -> None: ... + def __get__(self, obj, cls): ... + +def memoize_single_value(func): ... + +class memoized_property: + __func__: Any + __name__: Any + __doc__: Any + def __init__(self, func) -> None: ... + def __get__(self, obj, cls): ... + def clear_cache(self, obj) -> None: ... + def peek_cache(self, obj, default: Any | None = ...): ... + +def deprecated_function( + msg: Any | None = ..., + deprecated: Any | None = ..., + removed: Any | None = ..., + updoc: bool = ..., + replacement: Any | None = ..., + _is_method: bool = ..., + func_module: Any | None = ..., +): ... +def deprecated_method( + msg: Any | None = ..., + deprecated: Any | None = ..., + removed: Any | None = ..., + updoc: bool = ..., + replacement: Any | None = ..., +): ... diff --git a/stubs/passlib/passlib/utils/des.pyi b/stubs/passlib/passlib/utils/des.pyi new file mode 100644 index 0000000..fe9982f --- /dev/null +++ b/stubs/passlib/passlib/utils/des.pyi @@ -0,0 +1,8 @@ +from passlib.crypto.des import ( + des_encrypt_block as des_encrypt_block, + des_encrypt_int_block as des_encrypt_int_block, + expand_des_key as expand_des_key, +) +from passlib.utils.decor import deprecated_function as deprecated_function + +def mdes_encrypt_int_block(key, input, salt: int = ..., rounds: int = ...): ... diff --git a/stubs/passlib/passlib/utils/handlers.pyi b/stubs/passlib/passlib/utils/handlers.pyi new file mode 100644 index 0000000..8314b2b --- /dev/null +++ b/stubs/passlib/passlib/utils/handlers.pyi @@ -0,0 +1,171 @@ +import abc +from _typeshed import Self +from typing import Any, ClassVar + +from passlib.ifc import PasswordHash +from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS + +H64_CHARS = HASH64_CHARS +B64_CHARS = BASE64_CHARS +PADDED_B64_CHARS = PADDED_BASE64_CHARS +UC_HEX_CHARS = UPPER_HEX_CHARS +LC_HEX_CHARS = LOWER_HEX_CHARS + +def parse_mc2(hash, prefix, sep=..., handler: Any | None = ...): ... +def parse_mc3(hash, prefix, sep=..., rounds_base: int = ..., default_rounds: Any | None = ..., handler: Any | None = ...): ... +def render_mc2(ident, salt, checksum, sep=...): ... +def render_mc3(ident, rounds, salt, checksum, sep=..., rounds_base: int = ...): ... + +class MinimalHandler(PasswordHash, metaclass=abc.ABCMeta): + @classmethod + def using(cls: Self, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override] + +class TruncateMixin(MinimalHandler, metaclass=abc.ABCMeta): + truncate_error: ClassVar[bool] + truncate_verify_reject: ClassVar[bool] + @classmethod + def using(cls: type[Self], truncate_error: object = ..., *, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override] + +class GenericHandler(MinimalHandler): + setting_kwds: ClassVar[tuple[str, ...]] + context_kwds: ClassVar[tuple[str, ...]] + ident: ClassVar[str | None] + checksum_size: ClassVar[int | None] + checksum_chars: ClassVar[str | None] + checksum: str | None + use_defaults: bool + def __init__(self, checksum: str | None = ..., use_defaults: bool = ...) -> None: ... + @classmethod + def identify(cls, hash: str | bytes) -> bool: ... + @classmethod + def from_string(cls: type[Self], hash: str | bytes, **context: Any) -> Self: ... + def to_string(self) -> str: ... + @classmethod + def hash(cls, secret: str | bytes, **kwds: Any) -> str: ... + @classmethod + def verify(cls, secret: str | bytes, hash: str | bytes, **context: Any) -> bool: ... + @classmethod + def genconfig(cls, **kwds: Any) -> str: ... + @classmethod + def genhash(cls, secret: str | bytes, config: str, **context: Any) -> str: ... + @classmethod + def needs_update(cls, hash: str | bytes, secret: str | bytes | None = ..., **kwds: Any) -> bool: ... + @classmethod + def parsehash(cls, hash: str | bytes, checksum: bool = ..., sanitize: bool = ...) -> dict[str, Any]: ... + @classmethod + def bitsize(cls, **kwds: Any) -> dict[str, Any]: ... + +class StaticHandler(GenericHandler): + setting_kwds: ClassVar[tuple[str, ...]] + +class HasEncodingContext(GenericHandler): + default_encoding: ClassVar[str] + encoding: str + def __init__(self, encoding: str | None = ..., **kwds) -> None: ... + +class HasUserContext(GenericHandler): + user: Any | None + def __init__(self, user: Any | None = ..., **kwds) -> None: ... + @classmethod + def hash(cls, secret, user: Any | None = ..., **context): ... + @classmethod + def verify(cls, secret, hash, user: Any | None = ..., **context): ... + @classmethod + def genhash(cls, secret, config, user: Any | None = ..., **context): ... + +class HasRawChecksum(GenericHandler): ... + +class HasManyIdents(GenericHandler): + default_ident: ClassVar[str | None] + ident_values: ClassVar[tuple[str, ...] | None] + ident_aliases: ClassVar[dict[str, str] | None] + ident: str # type: ignore[misc] + @classmethod + def using(cls, default_ident: Any | None = ..., ident: Any | None = ..., **kwds): ... # type: ignore[override] + def __init__(self, ident: Any | None = ..., **kwds) -> None: ... + +class HasSalt(GenericHandler): + min_salt_size: ClassVar[int] + max_salt_size: ClassVar[int | None] + salt_chars: ClassVar[str | None] + default_salt_size: ClassVar[int | None] + default_salt_chars: ClassVar[str | None] + salt: str | bytes | None + @classmethod + def using(cls, default_salt_size: int | None = ..., salt_size: int | None = ..., salt: str | bytes | None = ..., **kwds): ... # type: ignore[override] + def __init__(self, salt: str | bytes | None = ..., **kwds) -> None: ... + @classmethod + def bitsize(cls, salt_size: int | None = ..., **kwds): ... + +class HasRawSalt(HasSalt): + salt_chars: ClassVar[bytes] # type: ignore[assignment] + +class HasRounds(GenericHandler): + min_rounds: ClassVar[int] + max_rounds: ClassVar[int | None] + rounds_cost: ClassVar[str] + using_rounds_kwds: ClassVar[tuple[str, ...]] + min_desired_rounds: ClassVar[int | None] + max_desired_rounds: ClassVar[int | None] + default_rounds: ClassVar[int | None] + vary_rounds: ClassVar[Any | None] + rounds: int + @classmethod + def using( # type: ignore[override] + cls, + min_desired_rounds: Any | None = ..., + max_desired_rounds: Any | None = ..., + default_rounds: Any | None = ..., + vary_rounds: Any | None = ..., + min_rounds: Any | None = ..., + max_rounds: Any | None = ..., + rounds: Any | None = ..., + **kwds, + ): ... + def __init__(self, rounds: Any | None = ..., **kwds) -> None: ... + @classmethod + def bitsize(cls, rounds: Any | None = ..., vary_rounds: float = ..., **kwds): ... + +class ParallelismMixin(GenericHandler): + parallelism: int + @classmethod + def using(cls, parallelism: Any | None = ..., **kwds): ... # type: ignore[override] + def __init__(self, parallelism: Any | None = ..., **kwds) -> None: ... + +class BackendMixin(PasswordHash, metaclass=abc.ABCMeta): + backends: ClassVar[tuple[str, ...] | None] + @classmethod + def get_backend(cls): ... + @classmethod + def has_backend(cls, name: str = ...) -> bool: ... + @classmethod + def set_backend(cls, name: str = ..., dryrun: bool = ...): ... + +class SubclassBackendMixin(BackendMixin, metaclass=abc.ABCMeta): ... +class HasManyBackends(BackendMixin, GenericHandler): ... + +class PrefixWrapper: + name: Any + prefix: Any + orig_prefix: Any + __doc__: Any + def __init__( + self, name, wrapped, prefix=..., orig_prefix=..., lazy: bool = ..., doc: Any | None = ..., ident: Any | None = ... + ) -> None: ... + @property + def wrapped(self): ... + @property + def ident(self): ... + @property + def ident_values(self): ... + def __dir__(self): ... + def __getattr__(self, attr): ... + def __setattr__(self, attr, value): ... + def using(self, **kwds): ... + def needs_update(self, hash, **kwds): ... + def identify(self, hash): ... + def genconfig(self, **kwds): ... + def genhash(self, secret, config, **kwds): ... + def encrypt(self, secret, **kwds): ... + def hash(self, secret, **kwds): ... + def verify(self, secret, hash, **kwds): ... diff --git a/stubs/passlib/passlib/utils/md4.pyi b/stubs/passlib/passlib/utils/md4.pyi new file mode 100644 index 0000000..a316e0c --- /dev/null +++ b/stubs/passlib/passlib/utils/md4.pyi @@ -0,0 +1,3 @@ +from typing import Any + +md4: Any diff --git a/stubs/passlib/passlib/utils/pbkdf2.pyi b/stubs/passlib/passlib/utils/pbkdf2.pyi new file mode 100644 index 0000000..bfc9f2f --- /dev/null +++ b/stubs/passlib/passlib/utils/pbkdf2.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from passlib.crypto.digest import norm_hash_name as norm_hash_name + +def get_prf(name): ... +def pbkdf1(secret, salt, rounds, keylen: Any | None = ..., hash: str = ...): ... +def pbkdf2(secret, salt, rounds, keylen: Any | None = ..., prf: str = ...): ... diff --git a/stubs/passlib/passlib/win32.pyi b/stubs/passlib/passlib/win32.pyi new file mode 100644 index 0000000..07d54a7 --- /dev/null +++ b/stubs/passlib/passlib/win32.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from passlib.hash import nthash as nthash + +raw_nthash: Any + +def raw_lmhash(secret, encoding: str = ..., hex: bool = ...): ... diff --git a/stubs/passpy/@tests/stubtest_allowlist.txt b/stubs/passpy/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..f7e53b6 --- /dev/null +++ b/stubs/passpy/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +passpy.__main__ + +# Uses `git` dependency: +passpy.git +# Uses `gpg` dependency: +passpy.gpg diff --git a/stubs/passpy/METADATA.toml b/stubs/passpy/METADATA.toml new file mode 100644 index 0000000..516f11f --- /dev/null +++ b/stubs/passpy/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/passpy/passpy/__init__.pyi b/stubs/passpy/passpy/__init__.pyi new file mode 100644 index 0000000..98430cc --- /dev/null +++ b/stubs/passpy/passpy/__init__.pyi @@ -0,0 +1,5 @@ +from .exceptions import RecursiveCopyMoveError as RecursiveCopyMoveError, StoreNotInitialisedError as StoreNotInitialisedError +from .store import Store as Store +from .util import gen_password as gen_password + +VERSION: str diff --git a/stubs/passpy/passpy/exceptions.pyi b/stubs/passpy/passpy/exceptions.pyi new file mode 100644 index 0000000..f3a532d --- /dev/null +++ b/stubs/passpy/passpy/exceptions.pyi @@ -0,0 +1,2 @@ +class StoreNotInitialisedError(FileNotFoundError): ... +class RecursiveCopyMoveError(OSError): ... diff --git a/stubs/passpy/passpy/store.pyi b/stubs/passpy/passpy/store.pyi new file mode 100644 index 0000000..07a9fcc --- /dev/null +++ b/stubs/passpy/passpy/store.pyi @@ -0,0 +1,31 @@ +from _typeshed import StrPath +from collections.abc import Iterator +from re import Match + +class Store: + def __init__( + self, + gpg_bin: str = ..., + git_bin: str = ..., + store_dir: str = ..., + use_agent: bool = ..., + interactive: bool = ..., + verbose: bool = ..., + ) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def is_init(self) -> bool: ... + def init_store(self, gpg_ids: None | str | list[str], path: StrPath | None = ...) -> None: ... + def init_git(self) -> None: ... + def git(self, method: str, *args: object, **kwargs: object) -> None: ... + def get_key(self, path: StrPath | None) -> str | None: ... + def set_key(self, path: StrPath | None, key_data: str, force: bool = ...) -> None: ... + def remove_path(self, path: StrPath, recursive: bool = ..., force: bool = ...) -> None: ... + def gen_key( + self, path: StrPath | None, length: int, symbols: bool = ..., force: bool = ..., inplace: bool = ... + ) -> str | None: ... + def copy_path(self, old_path: StrPath, new_path: StrPath, force: bool = ...) -> None: ... + def move_path(self, old_path: StrPath, new_path: StrPath, force: bool = ...) -> None: ... + def list_dir(self, path: StrPath) -> tuple[list[str], list[str]]: ... + def iter_dir(self, path: StrPath) -> Iterator[str]: ... + def find(self, names: None | str | list[str]) -> list[str]: ... + def search(self, term: str) -> dict[str, list[tuple[str, Match[str]]]]: ... diff --git a/stubs/passpy/passpy/util.pyi b/stubs/passpy/passpy/util.pyi new file mode 100644 index 0000000..4c10cde --- /dev/null +++ b/stubs/passpy/passpy/util.pyi @@ -0,0 +1,13 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +_C = TypeVar("_C", bound=Callable[..., Any]) + +# Technically, the first argument of `_C` must be `Store`, +# but for now we leave it simple: +def initialised(func: _C) -> _C: ... +def trap(path_index: str | int) -> Callable[[_C], _C]: ... +def gen_password(length: int, symbols: bool = ...) -> str: ... +def copy_move( + src: str, dst: str, force: bool = ..., move: bool = ..., interactive: bool = ..., verbose: bool = ... +) -> str | None: ... diff --git a/stubs/peewee/@tests/stubtest_allowlist.txt b/stubs/peewee/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..9847706 --- /dev/null +++ b/stubs/peewee/@tests/stubtest_allowlist.txt @@ -0,0 +1,25 @@ +peewee.DQ.__invert__ +peewee.DateField.day +peewee.DateField.month +peewee.DateField.year +peewee.DateTimeField.day +peewee.DateTimeField.hour +peewee.DateTimeField.minute +peewee.DateTimeField.month +peewee.DateTimeField.second +peewee.DateTimeField.year +peewee.Model.insert +peewee.Model.replace +peewee.Model.update +peewee.TimeField.hour +peewee.TimeField.minute +peewee.TimeField.second +peewee.TimestampField.day +peewee.TimestampField.hour +peewee.TimestampField.minute +peewee.TimestampField.month +peewee.TimestampField.second +peewee.TimestampField.year +peewee.Window.as_groups +peewee.Window.as_range +peewee.Window.as_rows diff --git a/stubs/peewee/METADATA.toml b/stubs/peewee/METADATA.toml new file mode 100644 index 0000000..c9e5a64 --- /dev/null +++ b/stubs/peewee/METADATA.toml @@ -0,0 +1,4 @@ +version = "3.15.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/peewee/peewee.pyi b/stubs/peewee/peewee.pyi new file mode 100644 index 0000000..1d9addb --- /dev/null +++ b/stubs/peewee/peewee.pyi @@ -0,0 +1,1769 @@ +import itertools +import logging +import threading +from _typeshed import Incomplete +from collections.abc import Generator +from typing import NamedTuple + +class NullHandler(logging.Handler): + def emit(self, record) -> None: ... + +text_type = str +bytes_type = bytes +buffer_type = memoryview +basestring = str +long = int +izip_longest = itertools.zip_longest + +class attrdict(dict[Incomplete, Incomplete]): + def __getattr__(self, attr): ... + def __setattr__(self, attr, value) -> None: ... + def __iadd__(self, rhs): ... + def __add__(self, rhs): ... + +OP: Incomplete +DJANGO_MAP: Incomplete +JOIN: Incomplete + +def chunked(it, n) -> Generator[Incomplete, None, None]: ... + +class _callable_context_manager: + def __call__(self, fn): ... + +class Proxy: + def __init__(self) -> None: ... + obj: Incomplete + def initialize(self, obj) -> None: ... + def attach_callback(self, callback): ... + def passthrough(method): ... + __enter__: Incomplete + __exit__: Incomplete + def __getattr__(self, attr): ... + def __setattr__(self, attr, value): ... + +class DatabaseProxy(Proxy): + def connection_context(self): ... + def atomic(self, *args, **kwargs): ... + def manual_commit(self): ... + def transaction(self, *args, **kwargs): ... + def savepoint(self): ... + +class ModelDescriptor: ... + +class AliasManager: + def __init__(self) -> None: ... + @property + def mapping(self): ... + def add(self, source): ... + def get(self, source, any_depth: bool = ...): ... + def __getitem__(self, source): ... + def __setitem__(self, source, alias) -> None: ... + def push(self) -> None: ... + def pop(self) -> None: ... + +class State: + def __new__(cls, scope=..., parentheses: bool = ..., **kwargs): ... + def __call__(self, scope: Incomplete | None = ..., parentheses: Incomplete | None = ..., **kwargs): ... + def __getattr__(self, attr_name): ... + +class Context: + stack: Incomplete + alias_manager: Incomplete + state: Incomplete + def __init__(self, **settings) -> None: ... + def as_new(self): ... + def column_sort_key(self, item): ... + @property + def scope(self): ... + @property + def parentheses(self): ... + @property + def subquery(self): ... + def __call__(self, **overrides): ... + scope_normal: Incomplete + scope_source: Incomplete + scope_values: Incomplete + scope_cte: Incomplete + scope_column: Incomplete + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + def push_alias(self) -> Generator[None, None, None]: ... + def sql(self, obj): ... + def literal(self, keyword): ... + def value(self, value, converter: Incomplete | None = ..., add_param: bool = ...): ... + def __sql__(self, ctx): ... + def parse(self, node): ... + def query(self): ... + +class Node: + def clone(self): ... + def __sql__(self, ctx) -> None: ... + @staticmethod + def copy(method): ... + def coerce(self, _coerce: bool = ...): ... + def is_alias(self): ... + def unwrap(self): ... + +class ColumnFactory: + node: Incomplete + def __init__(self, node) -> None: ... + def __getattr__(self, attr): ... + +class _DynamicColumn: + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + +class _ExplicitColumn: + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + +class Source(Node): + c: Incomplete + def __init__(self, alias: Incomplete | None = ...) -> None: ... + def alias(self, name) -> None: ... + def select(self, *columns): ... + def join(self, dest, join_type=..., on: Incomplete | None = ...): ... + def left_outer_join(self, dest, on: Incomplete | None = ...): ... + def cte(self, name, recursive: bool = ..., columns: Incomplete | None = ..., materialized: Incomplete | None = ...): ... + def get_sort_key(self, ctx): ... + def apply_alias(self, ctx): ... + def apply_column(self, ctx): ... + +class _HashableSource: + def __init__(self, *args, **kwargs) -> None: ... + def alias(self, name) -> None: ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + __lt__: Incomplete + __le__: Incomplete + __gt__: Incomplete + __ge__: Incomplete + +class BaseTable(Source): + __and__: Incomplete + __add__: Incomplete + __sub__: Incomplete + __or__: Incomplete + __mul__: Incomplete + __rand__: Incomplete + __radd__: Incomplete + __rsub__: Incomplete + __ror__: Incomplete + __rmul__: Incomplete + +class _BoundTableContext(_callable_context_manager): + table: Incomplete + database: Incomplete + def __init__(self, table, database) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class Table(_HashableSource, BaseTable): + __name__: Incomplete + c: Incomplete + primary_key: Incomplete + def __init__( + self, + name, + columns: Incomplete | None = ..., + primary_key: Incomplete | None = ..., + schema: Incomplete | None = ..., + alias: Incomplete | None = ..., + _model: Incomplete | None = ..., + _database: Incomplete | None = ..., + ) -> None: ... + def clone(self): ... + def bind(self, database: Incomplete | None = ...): ... + def bind_ctx(self, database: Incomplete | None = ...): ... + def select(self, *columns): ... + def insert(self, insert: Incomplete | None = ..., columns: Incomplete | None = ..., **kwargs): ... + def replace(self, insert: Incomplete | None = ..., columns: Incomplete | None = ..., **kwargs): ... + def update(self, update: Incomplete | None = ..., **kwargs): ... + def delete(self): ... + def __sql__(self, ctx): ... + +class Join(BaseTable): + lhs: Incomplete + rhs: Incomplete + join_type: Incomplete + def __init__(self, lhs, rhs, join_type=..., on: Incomplete | None = ..., alias: Incomplete | None = ...) -> None: ... + def on(self, predicate): ... + def __sql__(self, ctx): ... + +class ValuesList(_HashableSource, BaseTable): + def __init__(self, values, columns: Incomplete | None = ..., alias: Incomplete | None = ...) -> None: ... + def columns(self, *names) -> None: ... + def __sql__(self, ctx): ... + +class CTE(_HashableSource, Source): + def __init__( + self, name, query, recursive: bool = ..., columns: Incomplete | None = ..., materialized: Incomplete | None = ... + ) -> None: ... + def select_from(self, *columns): ... + def union_all(self, rhs): ... + __add__: Incomplete + def union(self, rhs): ... + __or__: Incomplete + def __sql__(self, ctx): ... + +class ColumnBase(Node): + def converter(self, converter: Incomplete | None = ...) -> None: ... + def alias(self, alias): ... + def unalias(self): ... + def bind_to(self, dest): ... + def cast(self, as_type): ... + def asc(self, collation: Incomplete | None = ..., nulls: Incomplete | None = ...): ... + __pos__: Incomplete + def desc(self, collation: Incomplete | None = ..., nulls: Incomplete | None = ...): ... + __neg__: Incomplete + def __invert__(self): ... + __and__: Incomplete + __or__: Incomplete + __add__: Incomplete + __sub__: Incomplete + __mul__: Incomplete + __div__: Incomplete + __truediv__: Incomplete + __xor__: Incomplete + __radd__: Incomplete + __rsub__: Incomplete + __rmul__: Incomplete + __rdiv__: Incomplete + __rtruediv__: Incomplete + __rand__: Incomplete + __ror__: Incomplete + __rxor__: Incomplete + def __eq__(self, rhs): ... + def __ne__(self, rhs): ... + __lt__: Incomplete + __le__: Incomplete + __gt__: Incomplete + __ge__: Incomplete + __lshift__: Incomplete + __rshift__: Incomplete + __mod__: Incomplete + __pow__: Incomplete + like: Incomplete + ilike: Incomplete + bin_and: Incomplete + bin_or: Incomplete + in_: Incomplete + not_in: Incomplete + def is_null(self, is_null: bool = ...): ... + def contains(self, rhs): ... + def startswith(self, rhs): ... + def endswith(self, rhs): ... + def between(self, lo, hi): ... + def concat(self, rhs): ... + def regexp(self, rhs): ... + def iregexp(self, rhs): ... + def __getitem__(self, item): ... + __iter__: Incomplete + def distinct(self): ... + def collate(self, collation): ... + def get_sort_key(self, ctx): ... + +class Column(ColumnBase): + source: Incomplete + name: Incomplete + def __init__(self, source, name) -> None: ... + def get_sort_key(self, ctx): ... + def __hash__(self): ... + def __sql__(self, ctx): ... + +class WrappedNode(ColumnBase): + node: Incomplete + def __init__(self, node) -> None: ... + def is_alias(self): ... + def unwrap(self): ... + +class EntityFactory: + node: Incomplete + def __init__(self, node) -> None: ... + def __getattr__(self, attr): ... + +class _DynamicEntity: + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + +class Alias(WrappedNode): + c: Incomplete + def __init__(self, node, alias) -> None: ... + def __hash__(self): ... + @property + def name(self): ... + @name.setter + def name(self, value) -> None: ... + def alias(self, alias: Incomplete | None = ...): ... + def unalias(self): ... + def is_alias(self): ... + def __sql__(self, ctx): ... + +class BindTo(WrappedNode): + dest: Incomplete + def __init__(self, node, dest) -> None: ... + def __sql__(self, ctx): ... + +class Negated(WrappedNode): + def __invert__(self): ... + def __sql__(self, ctx): ... + +class BitwiseMixin: + def __and__(self, other): ... + def __or__(self, other): ... + def __sub__(self, other): ... + def __invert__(self): ... + +class BitwiseNegated(BitwiseMixin, WrappedNode): + def __invert__(self): ... + def __sql__(self, ctx): ... + +class Value(ColumnBase): + value: Incomplete + converter: Incomplete + multi: Incomplete + values: Incomplete + def __init__(self, value, converter: Incomplete | None = ..., unpack: bool = ...) -> None: ... + def __sql__(self, ctx): ... + +class ValueLiterals(WrappedNode): + def __sql__(self, ctx): ... + +def AsIs(value): ... + +class Cast(WrappedNode): + def __init__(self, node, cast) -> None: ... + def __sql__(self, ctx): ... + +class Ordering(WrappedNode): + direction: Incomplete + collation: Incomplete + nulls: Incomplete + def __init__(self, node, direction, collation: Incomplete | None = ..., nulls: Incomplete | None = ...) -> None: ... + def collate(self, collation: Incomplete | None = ...): ... + def __sql__(self, ctx): ... + +class Expression(ColumnBase): + lhs: Incomplete + op: Incomplete + rhs: Incomplete + flat: Incomplete + def __init__(self, lhs, op, rhs, flat: bool = ...) -> None: ... + def __sql__(self, ctx): ... + +class StringExpression(Expression): + def __add__(self, rhs): ... + def __radd__(self, lhs): ... + +class Entity(ColumnBase): + def __init__(self, *path) -> None: ... + def __getattr__(self, attr): ... + def get_sort_key(self, ctx): ... + def __hash__(self): ... + def __sql__(self, ctx): ... + +class SQL(ColumnBase): + sql: Incomplete + params: Incomplete + def __init__(self, sql, params: Incomplete | None = ...) -> None: ... + def __sql__(self, ctx): ... + +def Check(constraint, name: Incomplete | None = ...): ... + +class Function(ColumnBase): + name: Incomplete + arguments: Incomplete + def __init__(self, name, arguments, coerce: bool = ..., python_value: Incomplete | None = ...) -> None: ... + def __getattr__(self, attr): ... + def filter(self, where: Incomplete | None = ...) -> None: ... + def order_by(self, *ordering) -> None: ... + def python_value(self, func: Incomplete | None = ...) -> None: ... + def over( + self, + partition_by: Incomplete | None = ..., + order_by: Incomplete | None = ..., + start: Incomplete | None = ..., + end: Incomplete | None = ..., + frame_type: Incomplete | None = ..., + window: Incomplete | None = ..., + exclude: Incomplete | None = ..., + ): ... + def __sql__(self, ctx): ... + +fn: Incomplete + +class Window(Node): + CURRENT_ROW: Incomplete + GROUP: Incomplete + TIES: Incomplete + NO_OTHERS: Incomplete + GROUPS: str + RANGE: str + ROWS: str + partition_by: Incomplete + order_by: Incomplete + start: Incomplete + end: Incomplete + frame_type: Incomplete + def __init__( + self, + partition_by: Incomplete | None = ..., + order_by: Incomplete | None = ..., + start: Incomplete | None = ..., + end: Incomplete | None = ..., + frame_type: Incomplete | None = ..., + extends: Incomplete | None = ..., + exclude: Incomplete | None = ..., + alias: Incomplete | None = ..., + _inline: bool = ..., + ) -> None: ... + def alias(self, alias: Incomplete | None = ...): ... + def as_range(self) -> None: ... + def as_rows(self) -> None: ... + def as_groups(self) -> None: ... + def extends(self, window: Incomplete | None = ...) -> None: ... + def exclude(self, frame_exclusion: Incomplete | None = ...) -> None: ... + @staticmethod + def following(value: Incomplete | None = ...): ... + @staticmethod + def preceding(value: Incomplete | None = ...): ... + def __sql__(self, ctx): ... + +class WindowAlias(Node): + window: Incomplete + def __init__(self, window) -> None: ... + def alias(self, window_alias): ... + def __sql__(self, ctx): ... + +class ForUpdate(Node): + def __init__(self, expr, of: Incomplete | None = ..., nowait: Incomplete | None = ...) -> None: ... + def __sql__(self, ctx): ... + +def Case(predicate, expression_tuples, default: Incomplete | None = ...): ... + +class NodeList(ColumnBase): + nodes: Incomplete + glue: Incomplete + parens: Incomplete + def __init__(self, nodes, glue: str = ..., parens: bool = ...) -> None: ... + def __sql__(self, ctx): ... + +class _Namespace(Node): + def __init__(self, name) -> None: ... + def __getattr__(self, attr): ... + __getitem__: Incomplete + +class NamespaceAttribute(ColumnBase): + def __init__(self, namespace, attribute) -> None: ... + def __sql__(self, ctx): ... + +EXCLUDED: Incomplete + +class DQ(ColumnBase): + query: Incomplete + def __init__(self, **query) -> None: ... + def __invert__(self) -> None: ... + def clone(self): ... + +Tuple: Incomplete + +class QualifiedNames(WrappedNode): + def __sql__(self, ctx): ... + +class OnConflict(Node): + def __init__( + self, + action: Incomplete | None = ..., + update: Incomplete | None = ..., + preserve: Incomplete | None = ..., + where: Incomplete | None = ..., + conflict_target: Incomplete | None = ..., + conflict_where: Incomplete | None = ..., + conflict_constraint: Incomplete | None = ..., + ) -> None: ... + def get_conflict_statement(self, ctx, query): ... + def get_conflict_update(self, ctx, query): ... + def preserve(self, *columns) -> None: ... + def update(self, _data: Incomplete | None = ..., **kwargs) -> None: ... + def where(self, *expressions) -> None: ... + def conflict_target(self, *constraints) -> None: ... + def conflict_where(self, *expressions) -> None: ... + def conflict_constraint(self, constraint) -> None: ... + +class BaseQuery(Node): + default_row_type: Incomplete + def __init__(self, _database: Incomplete | None = ..., **kwargs) -> None: ... + def bind(self, database: Incomplete | None = ...): ... + def clone(self): ... + def dicts(self, as_dict: bool = ...): ... + def tuples(self, as_tuple: bool = ...): ... + def namedtuples(self, as_namedtuple: bool = ...): ... + def objects(self, constructor: Incomplete | None = ...): ... + def __sql__(self, ctx) -> None: ... + def sql(self): ... + def execute(self, database): ... + def iterator(self, database: Incomplete | None = ...): ... + def __iter__(self): ... + def __getitem__(self, value): ... + def __len__(self): ... + +class RawQuery(BaseQuery): + def __init__(self, sql: Incomplete | None = ..., params: Incomplete | None = ..., **kwargs) -> None: ... + def __sql__(self, ctx): ... + +class Query(BaseQuery): + def __init__( + self, + where: Incomplete | None = ..., + order_by: Incomplete | None = ..., + limit: Incomplete | None = ..., + offset: Incomplete | None = ..., + **kwargs, + ) -> None: ... + def with_cte(self, *cte_list) -> None: ... + def where(self, *expressions) -> None: ... + def orwhere(self, *expressions) -> None: ... + def order_by(self, *values) -> None: ... + def order_by_extend(self, *values) -> None: ... + def limit(self, value: Incomplete | None = ...) -> None: ... + def offset(self, value: Incomplete | None = ...) -> None: ... + def paginate(self, page, paginate_by: int = ...) -> None: ... + def __sql__(self, ctx): ... + +class SelectQuery(Query): + union_all: Incomplete + __add__: Incomplete + union: Incomplete + __or__: Incomplete + intersect: Incomplete + __and__: Incomplete + except_: Incomplete + __sub__: Incomplete + __radd__: Incomplete + __ror__: Incomplete + __rand__: Incomplete + __rsub__: Incomplete + def select_from(self, *columns): ... + +class SelectBase(_HashableSource, Source, SelectQuery): + def peek(self, database, n: int = ...): ... + def first(self, database, n: int = ...): ... + def scalar(self, database, as_tuple: bool = ..., as_dict: bool = ...): ... + def scalars(self, database) -> Generator[Incomplete, None, None]: ... + def count(self, database, clear_limit: bool = ...): ... + def exists(self, database): ... + def get(self, database): ... + +class CompoundSelectQuery(SelectBase): + lhs: Incomplete + op: Incomplete + rhs: Incomplete + def __init__(self, lhs, op, rhs) -> None: ... + def exists(self, database): ... + def __sql__(self, ctx): ... + +class Select(SelectBase): + def __init__( + self, + from_list: Incomplete | None = ..., + columns: Incomplete | None = ..., + group_by: Incomplete | None = ..., + having: Incomplete | None = ..., + distinct: Incomplete | None = ..., + windows: Incomplete | None = ..., + for_update: Incomplete | None = ..., + for_update_of: Incomplete | None = ..., + nowait: Incomplete | None = ..., + lateral: Incomplete | None = ..., + **kwargs, + ) -> None: ... + def clone(self): ... + def columns(self, *columns, **kwargs) -> None: ... + select: Incomplete + def select_extend(self, *columns) -> None: ... + @property + def selected_columns(self): ... + @selected_columns.setter + def selected_columns(self, value) -> None: ... + def from_(self, *sources) -> None: ... + def join(self, dest, join_type=..., on: Incomplete | None = ...) -> None: ... + def left_outer_join(self, dest, on: Incomplete | None = ...): ... + def group_by(self, *columns) -> None: ... + def group_by_extend(self, *values): ... + def having(self, *expressions) -> None: ... + def distinct(self, *columns) -> None: ... + def window(self, *windows) -> None: ... + def for_update(self, for_update: bool = ..., of: Incomplete | None = ..., nowait: Incomplete | None = ...) -> None: ... + def lateral(self, lateral: bool = ...) -> None: ... + def __sql_selection__(self, ctx, is_subquery: bool = ...): ... + def __sql__(self, ctx): ... + +class _WriteQuery(Query): + table: Incomplete + def __init__(self, table, returning: Incomplete | None = ..., **kwargs) -> None: ... + def cte(self, name, recursive: bool = ..., columns: Incomplete | None = ..., materialized: Incomplete | None = ...): ... + def returning(self, *returning) -> None: ... + def apply_returning(self, ctx): ... + def execute_returning(self, database): ... + def handle_result(self, database, cursor): ... + def __sql__(self, ctx): ... + +class Update(_WriteQuery): + def __init__(self, table, update: Incomplete | None = ..., **kwargs) -> None: ... + def from_(self, *sources) -> None: ... + def __sql__(self, ctx): ... + +class Insert(_WriteQuery): + SIMPLE: int + QUERY: int + MULTI: int + + class DefaultValuesException(Exception): ... + + def __init__( + self, + table, + insert: Incomplete | None = ..., + columns: Incomplete | None = ..., + on_conflict: Incomplete | None = ..., + **kwargs, + ) -> None: ... + def where(self, *expressions) -> None: ... + def as_rowcount(self, _as_rowcount: bool = ...) -> None: ... + def on_conflict_ignore(self, ignore: bool = ...) -> None: ... + def on_conflict_replace(self, replace: bool = ...) -> None: ... + def on_conflict(self, *args, **kwargs) -> None: ... + def get_default_data(self): ... + def get_default_columns(self): ... + def __sql__(self, ctx): ... + def handle_result(self, database, cursor): ... + +class Delete(_WriteQuery): + def __sql__(self, ctx): ... + +class Index(Node): + def __init__( + self, + name, + table, + expressions, + unique: bool = ..., + safe: bool = ..., + where: Incomplete | None = ..., + using: Incomplete | None = ..., + ) -> None: ... + def safe(self, _safe: bool = ...) -> None: ... + def where(self, *expressions) -> None: ... + def using(self, _using: Incomplete | None = ...) -> None: ... + def __sql__(self, ctx): ... + +class ModelIndex(Index): + def __init__( + self, + model, + fields, + unique: bool = ..., + safe: bool = ..., + where: Incomplete | None = ..., + using: Incomplete | None = ..., + name: Incomplete | None = ..., + ) -> None: ... + +class PeeweeException(Exception): + def __init__(self, *args) -> None: ... + +class ImproperlyConfigured(PeeweeException): ... +class DatabaseError(PeeweeException): ... +class DataError(DatabaseError): ... +class IntegrityError(DatabaseError): ... +class InterfaceError(PeeweeException): ... +class InternalError(DatabaseError): ... +class NotSupportedError(DatabaseError): ... +class OperationalError(DatabaseError): ... +class ProgrammingError(DatabaseError): ... + +class ExceptionWrapper: + exceptions: Incomplete + def __init__(self, exceptions) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_value, traceback) -> None: ... + +class IndexMetadata(NamedTuple): + name: Incomplete + sql: Incomplete + columns: Incomplete + unique: Incomplete + table: Incomplete + +class ColumnMetadata(NamedTuple): + name: Incomplete + data_type: Incomplete + null: Incomplete + primary_key: Incomplete + table: Incomplete + default: Incomplete + +class ForeignKeyMetadata(NamedTuple): + column: Incomplete + dest_table: Incomplete + dest_column: Incomplete + table: Incomplete + +class ViewMetadata(NamedTuple): + name: Incomplete + sql: Incomplete + +class _ConnectionState: + def __init__(self, **kwargs) -> None: ... + closed: bool + conn: Incomplete + ctx: Incomplete + transactions: Incomplete + def reset(self) -> None: ... + def set_connection(self, conn) -> None: ... + +class _ConnectionLocal(_ConnectionState, threading.local): ... + +class _NoopLock: + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class ConnectionContext(_callable_context_manager): + db: Incomplete + def __init__(self, db) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class Database(_callable_context_manager): + context_class: Incomplete + field_types: Incomplete + operations: Incomplete + param: str + quote: str + server_version: Incomplete + commit_select: bool + compound_select_parentheses: Incomplete + for_update: bool + index_schema_prefix: bool + index_using_precedes_table: bool + limit_max: Incomplete + nulls_ordering: bool + returning_clause: bool + safe_create_index: bool + safe_drop_index: bool + sequences: bool + truncate_table: bool + autoconnect: Incomplete + autorollback: Incomplete + thread_safe: Incomplete + connect_params: Incomplete + def __init__( + self, + database, + thread_safe: bool = ..., + autorollback: bool = ..., + field_types: Incomplete | None = ..., + operations: Incomplete | None = ..., + autocommit: Incomplete | None = ..., + autoconnect: bool = ..., + **kwargs, + ) -> None: ... + database: Incomplete + deferred: Incomplete + def init(self, database, **kwargs) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + def connection_context(self): ... + def connect(self, reuse_if_open: bool = ...): ... + def close(self): ... + def is_closed(self): ... + def is_connection_usable(self): ... + def connection(self): ... + def cursor(self, commit: Incomplete | None = ...): ... + def execute_sql(self, sql, params: Incomplete | None = ..., commit=...): ... + def execute(self, query, commit=..., **context_options): ... + def get_context_options(self): ... + def get_sql_context(self, **context_options): ... + def conflict_statement(self, on_conflict, query) -> None: ... + def conflict_update(self, on_conflict, query) -> None: ... + def last_insert_id(self, cursor, query_type: Incomplete | None = ...): ... + def rows_affected(self, cursor): ... + def default_values_insert(self, ctx): ... + def session_start(self): ... + def session_commit(self): ... + def session_rollback(self): ... + def in_transaction(self): ... + def push_transaction(self, transaction) -> None: ... + def pop_transaction(self): ... + def transaction_depth(self): ... + def top_transaction(self): ... + def atomic(self, *args, **kwargs): ... + def manual_commit(self): ... + def transaction(self, *args, **kwargs): ... + def savepoint(self): ... + def begin(self) -> None: ... + def commit(self): ... + def rollback(self): ... + def batch_commit(self, it, n) -> Generator[Incomplete, None, None]: ... + def table_exists(self, table_name, schema: Incomplete | None = ...): ... + def get_tables(self, schema: Incomplete | None = ...) -> None: ... + def get_indexes(self, table, schema: Incomplete | None = ...) -> None: ... + def get_columns(self, table, schema: Incomplete | None = ...) -> None: ... + def get_primary_keys(self, table, schema: Incomplete | None = ...) -> None: ... + def get_foreign_keys(self, table, schema: Incomplete | None = ...) -> None: ... + def sequence_exists(self, seq) -> None: ... + def create_tables(self, models, **options) -> None: ... + def drop_tables(self, models, **kwargs) -> None: ... + def extract_date(self, date_part, date_field) -> None: ... + def truncate_date(self, date_part, date_field) -> None: ... + def to_timestamp(self, date_field) -> None: ... + def from_timestamp(self, date_field) -> None: ... + def random(self): ... + def bind(self, models, bind_refs: bool = ..., bind_backrefs: bool = ...) -> None: ... + def bind_ctx(self, models, bind_refs: bool = ..., bind_backrefs: bool = ...): ... + def get_noop_select(self, ctx): ... + +class SqliteDatabase(Database): + field_types: Incomplete + operations: Incomplete + index_schema_prefix: bool + limit_max: int + server_version: Incomplete + truncate_table: bool + nulls_ordering: Incomplete + def __init__(self, database, *args, **kwargs) -> None: ... + returning_clause: Incomplete + def init( + self, database, pragmas: Incomplete | None = ..., timeout: int = ..., returning_clause: Incomplete | None = ..., **kwargs + ) -> None: ... + def pragma(self, key, value=..., permanent: bool = ..., schema: Incomplete | None = ...): ... + cache_size: Incomplete + foreign_keys: Incomplete + journal_mode: Incomplete + journal_size_limit: Incomplete + mmap_size: Incomplete + page_size: Incomplete + read_uncommitted: Incomplete + synchronous: Incomplete + wal_autocheckpoint: Incomplete + application_id: Incomplete + user_version: Incomplete + data_version: Incomplete + @property + def timeout(self): ... + @timeout.setter + def timeout(self, seconds) -> None: ... + def register_aggregate(self, klass, name: Incomplete | None = ..., num_params: int = ...) -> None: ... + def aggregate(self, name: Incomplete | None = ..., num_params: int = ...): ... + def register_collation(self, fn, name: Incomplete | None = ...): ... + def collation(self, name: Incomplete | None = ...): ... + def register_function(self, fn, name: Incomplete | None = ..., num_params: int = ...) -> None: ... + def func(self, name: Incomplete | None = ..., num_params: int = ...): ... + def register_window_function(self, klass, name: Incomplete | None = ..., num_params: int = ...) -> None: ... + def window_function(self, name: Incomplete | None = ..., num_params: int = ...): ... + def register_table_function(self, klass, name: Incomplete | None = ...) -> None: ... + def table_function(self, name: Incomplete | None = ...): ... + def unregister_aggregate(self, name) -> None: ... + def unregister_collation(self, name) -> None: ... + def unregister_function(self, name) -> None: ... + def unregister_window_function(self, name) -> None: ... + def unregister_table_function(self, name): ... + def load_extension(self, extension) -> None: ... + def unload_extension(self, extension) -> None: ... + def attach(self, filename, name): ... + def detach(self, name): ... + def last_insert_id(self, cursor, query_type: Incomplete | None = ...): ... + def rows_affected(self, cursor): ... + def begin(self, lock_type: Incomplete | None = ...) -> None: ... + def get_tables(self, schema: Incomplete | None = ...): ... + def get_views(self, schema: Incomplete | None = ...): ... + def get_indexes(self, table, schema: Incomplete | None = ...): ... + def get_columns(self, table, schema: Incomplete | None = ...): ... + def get_primary_keys(self, table, schema: Incomplete | None = ...): ... + def get_foreign_keys(self, table, schema: Incomplete | None = ...): ... + def get_binary_type(self): ... + def conflict_statement(self, on_conflict, query): ... + def conflict_update(self, oc, query): ... + def extract_date(self, date_part, date_field): ... + def truncate_date(self, date_part, date_field): ... + def to_timestamp(self, date_field): ... + def from_timestamp(self, date_field): ... + +class PostgresqlDatabase(Database): + field_types: Incomplete + operations: Incomplete + param: str + commit_select: bool + compound_select_parentheses: Incomplete + for_update: bool + nulls_ordering: bool + returning_clause: bool + safe_create_index: bool + sequences: bool + def init( + self, + database, + register_unicode: bool = ..., + encoding: Incomplete | None = ..., + isolation_level: Incomplete | None = ..., + **kwargs, + ) -> None: ... + def is_connection_usable(self): ... + def last_insert_id(self, cursor, query_type: Incomplete | None = ...): ... + def rows_affected(self, cursor): ... + def get_tables(self, schema: Incomplete | None = ...): ... + def get_views(self, schema: Incomplete | None = ...): ... + def get_indexes(self, table, schema: Incomplete | None = ...): ... + def get_columns(self, table, schema: Incomplete | None = ...): ... + def get_primary_keys(self, table, schema: Incomplete | None = ...): ... + def get_foreign_keys(self, table, schema: Incomplete | None = ...): ... + def sequence_exists(self, sequence): ... + def get_binary_type(self): ... + def conflict_statement(self, on_conflict, query) -> None: ... + def conflict_update(self, oc, query): ... + def extract_date(self, date_part, date_field): ... + def truncate_date(self, date_part, date_field): ... + def to_timestamp(self, date_field): ... + def from_timestamp(self, date_field): ... + def get_noop_select(self, ctx): ... + def set_time_zone(self, timezone) -> None: ... + +class MySQLDatabase(Database): + field_types: Incomplete + operations: Incomplete + param: str + quote: str + commit_select: bool + compound_select_parentheses: Incomplete + for_update: bool + index_using_precedes_table: bool + limit_max: Incomplete + safe_create_index: bool + safe_drop_index: bool + sql_mode: str + def init(self, database, **kwargs) -> None: ... + def is_connection_usable(self): ... + def default_values_insert(self, ctx): ... + def get_tables(self, schema: Incomplete | None = ...): ... + def get_views(self, schema: Incomplete | None = ...): ... + def get_indexes(self, table, schema: Incomplete | None = ...): ... + def get_columns(self, table, schema: Incomplete | None = ...): ... + def get_primary_keys(self, table, schema: Incomplete | None = ...): ... + def get_foreign_keys(self, table, schema: Incomplete | None = ...): ... + def get_binary_type(self): ... + def conflict_statement(self, on_conflict, query): ... + def conflict_update(self, on_conflict, query): ... + def extract_date(self, date_part, date_field): ... + def truncate_date(self, date_part, date_field): ... + def to_timestamp(self, date_field): ... + def from_timestamp(self, date_field): ... + def random(self): ... + def get_noop_select(self, ctx): ... + +class _manual(_callable_context_manager): + db: Incomplete + def __init__(self, db) -> None: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class _atomic(_callable_context_manager): + db: Incomplete + def __init__(self, db, *args, **kwargs) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb): ... + +class _transaction(_callable_context_manager): + db: Incomplete + def __init__(self, db, *args, **kwargs) -> None: ... + def commit(self, begin: bool = ...) -> None: ... + def rollback(self, begin: bool = ...) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class _savepoint(_callable_context_manager): + db: Incomplete + sid: Incomplete + quoted_sid: Incomplete + def __init__(self, db, sid: Incomplete | None = ...) -> None: ... + def commit(self, begin: bool = ...) -> None: ... + def rollback(self) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class CursorWrapper: + cursor: Incomplete + count: int + index: int + initialized: bool + populated: bool + row_cache: Incomplete + def __init__(self, cursor) -> None: ... + def __iter__(self): ... + def __getitem__(self, item): ... + def __len__(self): ... + def initialize(self) -> None: ... + def iterate(self, cache: bool = ...): ... + def process_row(self, row): ... + def iterator(self) -> Generator[Incomplete, None, None]: ... + def fill_cache(self, n: int = ...) -> None: ... + +class DictCursorWrapper(CursorWrapper): + initialize: Incomplete + process_row: Incomplete + +class NamedTupleCursorWrapper(CursorWrapper): + tuple_class: Incomplete + def initialize(self) -> None: ... + def process_row(self, row): ... + +class ObjectCursorWrapper(DictCursorWrapper): + constructor: Incomplete + def __init__(self, cursor, constructor) -> None: ... + def process_row(self, row): ... + +class ResultIterator: + cursor_wrapper: Incomplete + index: int + def __init__(self, cursor_wrapper) -> None: ... + def __iter__(self): ... + def next(self): ... + __next__: Incomplete + +class FieldAccessor: + model: Incomplete + field: Incomplete + name: Incomplete + def __init__(self, model, field, name) -> None: ... + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + def __set__(self, instance, value) -> None: ... + +class ForeignKeyAccessor(FieldAccessor): + rel_model: Incomplete + def __init__(self, model, field, name) -> None: ... + def get_rel_instance(self, instance): ... + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + def __set__(self, instance, obj) -> None: ... + +class BackrefAccessor: + field: Incomplete + model: Incomplete + rel_model: Incomplete + def __init__(self, field) -> None: ... + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + +class ObjectIdAccessor: + field: Incomplete + def __init__(self, field) -> None: ... + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + def __set__(self, instance, value) -> None: ... + +class Field(ColumnBase): + accessor_class: Incomplete + auto_increment: bool + default_index_type: Incomplete + field_type: str + unpack: bool + null: Incomplete + index: Incomplete + unique: Incomplete + column_name: Incomplete + default: Incomplete + primary_key: Incomplete + constraints: Incomplete + sequence: Incomplete + collation: Incomplete + unindexed: Incomplete + choices: Incomplete + help_text: Incomplete + verbose_name: Incomplete + index_type: Incomplete + def __init__( + self, + null: bool = ..., + index: bool = ..., + unique: bool = ..., + column_name: Incomplete | None = ..., + default: Incomplete | None = ..., + primary_key: bool = ..., + constraints: Incomplete | None = ..., + sequence: Incomplete | None = ..., + collation: Incomplete | None = ..., + unindexed: bool = ..., + choices: Incomplete | None = ..., + help_text: Incomplete | None = ..., + verbose_name: Incomplete | None = ..., + index_type: Incomplete | None = ..., + db_column: Incomplete | None = ..., + _hidden: bool = ..., + ) -> None: ... + def __hash__(self): ... + model: Incomplete + name: Incomplete + def bind(self, model, name, set_attribute: bool = ...) -> None: ... + @property + def column(self): ... + def adapt(self, value): ... + def db_value(self, value): ... + def python_value(self, value): ... + def to_value(self, value): ... + def get_sort_key(self, ctx): ... + def __sql__(self, ctx): ... + def get_modifiers(self) -> None: ... + def ddl_datatype(self, ctx): ... + def ddl(self, ctx): ... + +class AnyField(Field): + field_type: str + +class IntegerField(Field): + field_type: str + def adapt(self, value): ... + +class BigIntegerField(IntegerField): + field_type: str + +class SmallIntegerField(IntegerField): + field_type: str + +class AutoField(IntegerField): + auto_increment: bool + field_type: str + def __init__(self, *args, **kwargs) -> None: ... + +class BigAutoField(AutoField): + field_type: str + +class IdentityField(AutoField): + field_type: str + def __init__(self, generate_always: bool = ..., **kwargs) -> None: ... + +class PrimaryKeyField(AutoField): + def __init__(self, *args, **kwargs) -> None: ... + +class FloatField(Field): + field_type: str + def adapt(self, value): ... + +class DoubleField(FloatField): + field_type: str + +class DecimalField(Field): + field_type: str + max_digits: Incomplete + decimal_places: Incomplete + auto_round: Incomplete + rounding: Incomplete + def __init__( + self, + max_digits: int = ..., + decimal_places: int = ..., + auto_round: bool = ..., + rounding: Incomplete | None = ..., + *args, + **kwargs, + ) -> None: ... + def get_modifiers(self): ... + def db_value(self, value): ... + def python_value(self, value): ... + +class _StringField(Field): + def adapt(self, value): ... + def __add__(self, other): ... + def __radd__(self, other): ... + +class CharField(_StringField): + field_type: str + max_length: Incomplete + def __init__(self, max_length: int = ..., *args, **kwargs) -> None: ... + def get_modifiers(self): ... + +class FixedCharField(CharField): + field_type: str + def python_value(self, value): ... + +class TextField(_StringField): + field_type: str + +class BlobField(Field): + field_type: str + def bind(self, model, name, set_attribute: bool = ...): ... + def db_value(self, value): ... + +class BitField(BitwiseMixin, BigIntegerField): + def __init__(self, *args, **kwargs) -> None: ... + def flag(self, value: Incomplete | None = ...): ... + +class BigBitFieldData: + instance: Incomplete + name: Incomplete + def __init__(self, instance, name) -> None: ... + def set_bit(self, idx) -> None: ... + def clear_bit(self, idx) -> None: ... + def toggle_bit(self, idx): ... + def is_set(self, idx): ... + +class BigBitFieldAccessor(FieldAccessor): + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + def __set__(self, instance, value) -> None: ... + +class BigBitField(BlobField): + accessor_class: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def db_value(self, value): ... + +class UUIDField(Field): + field_type: str + def db_value(self, value): ... + def python_value(self, value): ... + +class BinaryUUIDField(BlobField): + field_type: str + def db_value(self, value): ... + def python_value(self, value): ... + +class _BaseFormattedField(Field): + formats: Incomplete + def __init__(self, formats: Incomplete | None = ..., *args, **kwargs) -> None: ... + +class DateTimeField(_BaseFormattedField): + field_type: str + formats: Incomplete + def adapt(self, value): ... + def to_timestamp(self): ... + def truncate(self, part): ... + year: Incomplete + month: Incomplete + day: Incomplete + hour: Incomplete + minute: Incomplete + second: Incomplete + +class DateField(_BaseFormattedField): + field_type: str + formats: Incomplete + def adapt(self, value): ... + def to_timestamp(self): ... + def truncate(self, part): ... + year: Incomplete + month: Incomplete + day: Incomplete + +class TimeField(_BaseFormattedField): + field_type: str + formats: Incomplete + def adapt(self, value): ... + hour: Incomplete + minute: Incomplete + second: Incomplete + +class TimestampField(BigIntegerField): + valid_resolutions: Incomplete + resolution: Incomplete + ticks_to_microsecond: Incomplete + utc: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def local_to_utc(self, dt): ... + def utc_to_local(self, dt): ... + def get_timestamp(self, value): ... + def db_value(self, value): ... + def python_value(self, value): ... + def from_timestamp(self): ... + year: Incomplete + month: Incomplete + day: Incomplete + hour: Incomplete + minute: Incomplete + second: Incomplete + +class IPField(BigIntegerField): + def db_value(self, val): ... + def python_value(self, val): ... + +class BooleanField(Field): + field_type: str + adapt: Incomplete + +class BareField(Field): + adapt: Incomplete + def __init__(self, adapt: Incomplete | None = ..., *args, **kwargs) -> None: ... + def ddl_datatype(self, ctx) -> None: ... + +class ForeignKeyField(Field): + accessor_class: Incomplete + backref_accessor_class: Incomplete + rel_model: Incomplete + rel_field: Incomplete + declared_backref: Incomplete + backref: Incomplete + on_delete: Incomplete + on_update: Incomplete + deferrable: Incomplete + deferred: Incomplete + object_id_name: Incomplete + lazy_load: Incomplete + constraint_name: Incomplete + def __init__( + self, + model, + field: Incomplete | None = ..., + backref: Incomplete | None = ..., + on_delete: Incomplete | None = ..., + on_update: Incomplete | None = ..., + deferrable: Incomplete | None = ..., + _deferred: Incomplete | None = ..., + rel_model: Incomplete | None = ..., + to_field: Incomplete | None = ..., + object_id_name: Incomplete | None = ..., + lazy_load: bool = ..., + constraint_name: Incomplete | None = ..., + related_name: Incomplete | None = ..., + *args, + **kwargs, + ) -> None: ... + @property + def field_type(self): ... + def get_modifiers(self): ... + def adapt(self, value): ... + def db_value(self, value): ... + def python_value(self, value): ... + column_name: Incomplete + safe_name: Incomplete + def bind(self, model, name, set_attribute: bool = ...) -> None: ... + def foreign_key_constraint(self): ... + def __getattr__(self, attr): ... + +class DeferredForeignKey(Field): + field_kwargs: Incomplete + rel_model_name: Incomplete + def __init__(self, rel_model_name, **kwargs) -> None: ... + __hash__: Incomplete + def __deepcopy__(self, memo: Incomplete | None = ...): ... + def set_model(self, rel_model) -> None: ... + @staticmethod + def resolve(model_cls) -> None: ... + +class DeferredThroughModel: + def __init__(self) -> None: ... + def set_field(self, model, field, name) -> None: ... + def set_model(self, through_model) -> None: ... + +class MetaField(Field): + column_name: Incomplete + default: Incomplete + model: Incomplete + name: Incomplete + primary_key: bool + +class ManyToManyFieldAccessor(FieldAccessor): + model: Incomplete + rel_model: Incomplete + through_model: Incomplete + src_fk: Incomplete + dest_fk: Incomplete + def __init__(self, model, field, name) -> None: ... + def __get__(self, instance, instance_type: Incomplete | None = ..., force_query: bool = ...): ... + def __set__(self, instance, value) -> None: ... + +class ManyToManyField(MetaField): + accessor_class: Incomplete + rel_model: Incomplete + backref: Incomplete + def __init__( + self, + model, + backref: Incomplete | None = ..., + through_model: Incomplete | None = ..., + on_delete: Incomplete | None = ..., + on_update: Incomplete | None = ..., + _is_backref: bool = ..., + ) -> None: ... + def bind(self, model, name, set_attribute: bool = ...) -> None: ... + def get_models(self): ... + @property + def through_model(self): ... + @through_model.setter + def through_model(self, value) -> None: ... + def get_through_model(self): ... + +class VirtualField(MetaField): + field_class: Incomplete + field_instance: Incomplete + def __init__(self, field_class: Incomplete | None = ..., *args, **kwargs) -> None: ... + def db_value(self, value): ... + def python_value(self, value): ... + model: Incomplete + column_name: Incomplete + def bind(self, model, name, set_attribute: bool = ...) -> None: ... + +class CompositeKey(MetaField): + sequence: Incomplete + field_names: Incomplete + def __init__(self, *field_names) -> None: ... + @property + def safe_field_names(self): ... + def __get__(self, instance, instance_type: Incomplete | None = ...): ... + def __set__(self, instance, value) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __hash__(self): ... + def __sql__(self, ctx): ... + model: Incomplete + column_name: Incomplete + def bind(self, model, name, set_attribute: bool = ...) -> None: ... + +class _SortedFieldList: + def __init__(self) -> None: ... + def __getitem__(self, i): ... + def __iter__(self): ... + def __contains__(self, item): ... + def index(self, field): ... + def insert(self, item) -> None: ... + def remove(self, item) -> None: ... + +class SchemaManager: + model: Incomplete + context_options: Incomplete + def __init__(self, model, database: Incomplete | None = ..., **context_options) -> None: ... + @property + def database(self): ... + @database.setter + def database(self, value) -> None: ... + def create_table(self, safe: bool = ..., **options) -> None: ... + def create_table_as(self, table_name, query, safe: bool = ..., **meta) -> None: ... + def drop_table(self, safe: bool = ..., **options) -> None: ... + def truncate_table(self, restart_identity: bool = ..., cascade: bool = ...) -> None: ... + def create_indexes(self, safe: bool = ...) -> None: ... + def drop_indexes(self, safe: bool = ...) -> None: ... + def create_sequence(self, field) -> None: ... + def drop_sequence(self, field) -> None: ... + def create_foreign_key(self, field) -> None: ... + def create_sequences(self) -> None: ... + def create_all(self, safe: bool = ..., **table_options) -> None: ... + def drop_sequences(self) -> None: ... + def drop_all(self, safe: bool = ..., drop_sequences: bool = ..., **options) -> None: ... + +class Metadata: + model: Incomplete + database: Incomplete + fields: Incomplete + columns: Incomplete + combined: Incomplete + sorted_fields: Incomplete + sorted_field_names: Incomplete + defaults: Incomplete + name: Incomplete + table_function: Incomplete + legacy_table_names: Incomplete + table_name: Incomplete + indexes: Incomplete + constraints: Incomplete + primary_key: Incomplete + composite_key: Incomplete + only_save_dirty: Incomplete + depends_on: Incomplete + table_settings: Incomplete + without_rowid: Incomplete + strict_tables: Incomplete + temporary: Incomplete + refs: Incomplete + backrefs: Incomplete + model_refs: Incomplete + model_backrefs: Incomplete + manytomany: Incomplete + options: Incomplete + def __init__( + self, + model, + database: Incomplete | None = ..., + table_name: Incomplete | None = ..., + indexes: Incomplete | None = ..., + primary_key: Incomplete | None = ..., + constraints: Incomplete | None = ..., + schema: Incomplete | None = ..., + only_save_dirty: bool = ..., + depends_on: Incomplete | None = ..., + options: Incomplete | None = ..., + db_table: Incomplete | None = ..., + table_function: Incomplete | None = ..., + table_settings: Incomplete | None = ..., + without_rowid: bool = ..., + temporary: bool = ..., + strict_tables: Incomplete | None = ..., + legacy_table_names: bool = ..., + **kwargs, + ) -> None: ... + def make_table_name(self): ... + def model_graph(self, refs: bool = ..., backrefs: bool = ..., depth_first: bool = ...): ... + def add_ref(self, field) -> None: ... + def remove_ref(self, field) -> None: ... + def add_manytomany(self, field) -> None: ... + def remove_manytomany(self, field) -> None: ... + @property + def table(self): ... + @table.deleter + def table(self) -> None: ... + @property + def schema(self): ... + @schema.setter + def schema(self, value) -> None: ... + @property + def entity(self): ... + def get_rel_for_model(self, model): ... + def add_field(self, field_name, field, set_attribute: bool = ...) -> None: ... + def remove_field(self, field_name) -> None: ... + auto_increment: Incomplete + def set_primary_key(self, name, field) -> None: ... + def get_primary_keys(self): ... + def get_default_dict(self): ... + def fields_to_index(self): ... + def set_database(self, database) -> None: ... + def set_table_name(self, table_name) -> None: ... + +class SubclassAwareMetadata(Metadata): + models: Incomplete + def __init__(self, model, *args, **kwargs) -> None: ... + def map_models(self, fn) -> None: ... + +class DoesNotExist(Exception): ... + +class ModelBase(type): + inheritable: Incomplete + def __new__(cls, name, bases, attrs): ... + def __iter__(self): ... + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __contains__(self, key): ... + def __len__(self): ... + def __bool__(self): ... + __nonzero__: Incomplete + def __sql__(self, ctx): ... + +class _BoundModelsContext(_callable_context_manager): + models: Incomplete + database: Incomplete + bind_refs: Incomplete + bind_backrefs: Incomplete + def __init__(self, models, database, bind_refs, bind_backrefs) -> None: ... + def __enter__(self): ... + def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... + +class Model: + __data__: Incomplete + __rel__: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def validate_model(cls) -> None: ... + @classmethod + def alias(cls, alias: Incomplete | None = ...): ... + @classmethod + def select(cls, *fields): ... + @classmethod + def update(cls, __data: Incomplete | None = ..., **update): ... + @classmethod + def insert(cls, __data: Incomplete | None = ..., **insert): ... + @classmethod + def insert_many(cls, rows, fields: Incomplete | None = ...): ... + @classmethod + def insert_from(cls, query, fields): ... + @classmethod + def replace(cls, __data: Incomplete | None = ..., **insert): ... + @classmethod + def replace_many(cls, rows, fields: Incomplete | None = ...): ... + @classmethod + def raw(cls, sql, *params): ... + @classmethod + def delete(cls): ... + @classmethod + def create(cls, **query): ... + @classmethod + def bulk_create(cls, model_list, batch_size: Incomplete | None = ...) -> None: ... + @classmethod + def bulk_update(cls, model_list, fields, batch_size: Incomplete | None = ...): ... + @classmethod + def noop(cls): ... + @classmethod + def get(cls, *query, **filters): ... + @classmethod + def get_or_none(cls, *query, **filters): ... + @classmethod + def get_by_id(cls, pk): ... + @classmethod + def set_by_id(cls, key, value): ... + @classmethod + def delete_by_id(cls, pk): ... + @classmethod + def get_or_create(cls, **kwargs): ... + @classmethod + def filter(cls, *dq_nodes, **filters): ... + def get_id(self): ... + def save(self, force_insert: bool = ..., only: Incomplete | None = ...): ... + def is_dirty(self): ... + @property + def dirty_fields(self): ... + def dependencies(self, search_nullable: bool = ...) -> Generator[Incomplete, None, None]: ... + def delete_instance(self, recursive: bool = ..., delete_nullable: bool = ...): ... + def __hash__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __sql__(self, ctx): ... + @classmethod + def bind(cls, database, bind_refs: bool = ..., bind_backrefs: bool = ..., _exclude: Incomplete | None = ...): ... + @classmethod + def bind_ctx(cls, database, bind_refs: bool = ..., bind_backrefs: bool = ...): ... + @classmethod + def table_exists(cls): ... + @classmethod + def create_table(cls, safe: bool = ..., **options) -> None: ... + @classmethod + def drop_table(cls, safe: bool = ..., drop_sequences: bool = ..., **options) -> None: ... + @classmethod + def truncate_table(cls, **options) -> None: ... + @classmethod + def index(cls, *fields, **kwargs): ... + @classmethod + def add_index(cls, *fields, **kwargs) -> None: ... + +class ModelAlias(Node): + def __init__(self, model, alias: Incomplete | None = ...) -> None: ... + def __getattr__(self, attr): ... + def __setattr__(self, attr, value) -> None: ... + def get_field_aliases(self): ... + def select(self, *selection): ... + def __call__(self, **kwargs): ... + def __sql__(self, ctx): ... + +class FieldAlias(Field): + source: Incomplete + model: Incomplete + field: Incomplete + def __init__(self, source, field) -> None: ... + @classmethod + def create(cls, source, field): ... + def clone(self): ... + def adapt(self, value): ... + def python_value(self, value): ... + def db_value(self, value): ... + def __getattr__(self, attr): ... + def __sql__(self, ctx): ... + +class _ModelQueryHelper: + default_row_type: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def objects(self, constructor: Incomplete | None = ...) -> None: ... + +class ModelRaw(_ModelQueryHelper, RawQuery): + model: Incomplete + def __init__(self, model, sql, params, **kwargs) -> None: ... + def get(self): ... + +class BaseModelSelect(_ModelQueryHelper): + def union_all(self, rhs): ... + __add__: Incomplete + def union(self, rhs): ... + __or__: Incomplete + def intersect(self, rhs): ... + __and__: Incomplete + def except_(self, rhs): ... + __sub__: Incomplete + def __iter__(self): ... + def prefetch(self, *subqueries): ... + def get(self, database: Incomplete | None = ...): ... + def get_or_none(self, database: Incomplete | None = ...): ... + def group_by(self, *columns) -> None: ... + +class ModelCompoundSelectQuery(BaseModelSelect, CompoundSelectQuery): + model: Incomplete + def __init__(self, model, *args, **kwargs) -> None: ... + +class ModelSelect(BaseModelSelect, Select): + model: Incomplete + def __init__(self, model, fields_or_models, is_default: bool = ...) -> None: ... + def clone(self): ... + def select(self, *fields_or_models): ... + def select_extend(self, *columns): ... + def switch(self, ctx: Incomplete | None = ...): ... + def join( + self, dest, join_type=..., on: Incomplete | None = ..., src: Incomplete | None = ..., attr: Incomplete | None = ... + ) -> None: ... + def left_outer_join(self, dest, on: Incomplete | None = ..., src: Incomplete | None = ..., attr: Incomplete | None = ...): ... + def join_from(self, src, dest, join_type=..., on: Incomplete | None = ..., attr: Incomplete | None = ...): ... + def ensure_join(self, lm, rm, on: Incomplete | None = ..., **join_kwargs): ... + def convert_dict_to_node(self, qdict): ... + def filter(self, *args, **kwargs): ... + def create_table(self, name, safe: bool = ..., **meta): ... + def __sql_selection__(self, ctx, is_subquery: bool = ...): ... + +class NoopModelSelect(ModelSelect): + def __sql__(self, ctx): ... + +class _ModelWriteQueryHelper(_ModelQueryHelper): + model: Incomplete + def __init__(self, model, *args, **kwargs) -> None: ... + def returning(self, *returning): ... + +class ModelUpdate(_ModelWriteQueryHelper, Update): ... + +class ModelInsert(_ModelWriteQueryHelper, Insert): + default_row_type: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def returning(self, *returning): ... + def get_default_data(self): ... + def get_default_columns(self): ... + +class ModelDelete(_ModelWriteQueryHelper, Delete): ... + +class ManyToManyQuery(ModelSelect): + def __init__(self, instance, accessor, rel, *args, **kwargs) -> None: ... + def add(self, value, clear_existing: bool = ...) -> None: ... + def remove(self, value): ... + def clear(self): ... + +class BaseModelCursorWrapper(DictCursorWrapper): + model: Incomplete + select: Incomplete + def __init__(self, cursor, model, columns) -> None: ... + initialize: Incomplete + def process_row(self, row) -> None: ... + +class ModelDictCursorWrapper(BaseModelCursorWrapper): + def process_row(self, row): ... + +class ModelTupleCursorWrapper(ModelDictCursorWrapper): + constructor: Incomplete + def process_row(self, row): ... + +class ModelNamedTupleCursorWrapper(ModelTupleCursorWrapper): + tuple_class: Incomplete + constructor: Incomplete + def initialize(self): ... + +class ModelObjectCursorWrapper(ModelDictCursorWrapper): + constructor: Incomplete + is_model: Incomplete + def __init__(self, cursor, model, select, constructor) -> None: ... + def process_row(self, row): ... + +class ModelCursorWrapper(BaseModelCursorWrapper): + from_list: Incomplete + joins: Incomplete + def __init__(self, cursor, model, select, from_list, joins) -> None: ... + key_to_constructor: Incomplete + src_is_dest: Incomplete + src_to_dest: Incomplete + column_keys: Incomplete + def initialize(self) -> None: ... + def process_row(self, row): ... + +class PrefetchQuery: + def __new__( + cls, + query, + fields: Incomplete | None = ..., + is_backref: Incomplete | None = ..., + rel_models: Incomplete | None = ..., + field_to_name: Incomplete | None = ..., + model: Incomplete | None = ..., + ): ... + def populate_instance(self, instance, id_map) -> None: ... + def store_instance(self, instance, id_map) -> None: ... + +def prefetch(sq, *subqueries): ... diff --git a/stubs/pep8-naming/@tests/stubtest_allowlist.txt b/stubs/pep8-naming/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..0cceda8 --- /dev/null +++ b/stubs/pep8-naming/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +pep8ext_naming.NamingChecker.__getattr__ +pep8ext_naming.NamingChecker.parse_options diff --git a/stubs/pep8-naming/METADATA.toml b/stubs/pep8-naming/METADATA.toml new file mode 100644 index 0000000..9f7bb49 --- /dev/null +++ b/stubs/pep8-naming/METADATA.toml @@ -0,0 +1 @@ +version = "0.13.*" diff --git a/stubs/pep8-naming/pep8ext_naming.pyi b/stubs/pep8-naming/pep8ext_naming.pyi new file mode 100644 index 0000000..d159071 --- /dev/null +++ b/stubs/pep8-naming/pep8ext_naming.pyi @@ -0,0 +1,31 @@ +import ast +from _typeshed import Incomplete +from argparse import Namespace +from collections.abc import Generator, Iterable +from typing import Any + +__version__: str + +PYTHON_VERSION: tuple[int, int, int] +CLASS_METHODS: frozenset[str] +METACLASS_BASES: frozenset[str] +METHOD_CONTAINER_NODES: set[ast.AST] + +class NamingChecker: + name: str + version: str + visitors: Any + decorator_to_type: Any + ignore_names: frozenset[str] + parents: Any + def __init__(self, tree: ast.AST, filename: str) -> None: ... + @classmethod + def add_options(cls, parser: Any) -> None: ... + @classmethod + def parse_options(cls, option: Namespace) -> None: ... + def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]: ... + def tag_class_functions(self, cls_node: ast.ClassDef) -> None: ... + def set_function_nodes_types(self, nodes: Iterable[ast.AST], ismetaclass: bool, late_decoration: dict[str, str]) -> None: ... + def __getattr__(self, name: str) -> Incomplete: ... # incomplete (other attributes are normally not accessed) + +def __getattr__(name: str) -> Incomplete: ... # incomplete (other attributes are normally not accessed) diff --git a/stubs/playsound/METADATA.toml b/stubs/playsound/METADATA.toml new file mode 100644 index 0000000..47610a9 --- /dev/null +++ b/stubs/playsound/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.3.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/playsound/playsound.pyi b/stubs/playsound/playsound.pyi new file mode 100644 index 0000000..cd6c1aa --- /dev/null +++ b/stubs/playsound/playsound.pyi @@ -0,0 +1,5 @@ +import pathlib + +class PlaysoundException(Exception): ... + +def playsound(sound: str | pathlib.Path, block: bool = ...) -> None: ... diff --git a/stubs/polib/METADATA.toml b/stubs/polib/METADATA.toml index cf311fd..c9f594b 100644 --- a/stubs/polib/METADATA.toml +++ b/stubs/polib/METADATA.toml @@ -1,2 +1 @@ -version = "1.1" -python2 = true +version = "1.1.*" diff --git a/stubs/polib/polib.pyi b/stubs/polib/polib.pyi index e98a0b9..034db58 100644 --- a/stubs/polib/polib.pyi +++ b/stubs/polib/polib.pyi @@ -1,10 +1,11 @@ import textwrap -from typing import IO, Any, Callable, Generic, List, Text, Tuple, Type, TypeVar, overload +from collections.abc import Callable +from typing import IO, Any, Generic, TypeVar, overload from typing_extensions import SupportsIndex -_TB = TypeVar("_TB", bound="_BaseEntry") -_TP = TypeVar("_TP", bound="POFile") -_TM = TypeVar("_TM", bound="MOFile") +_TB = TypeVar("_TB", bound=_BaseEntry) +_TP = TypeVar("_TP", bound=POFile) +_TM = TypeVar("_TM", bound=MOFile) default_encoding: str @@ -12,40 +13,40 @@ default_encoding: str # encoding: str # check_for_duplicates: bool @overload -def pofile(pofile: Text, *, klass: Type[_TP], **kwargs: Any) -> _TP: ... +def pofile(pofile: str, *, klass: type[_TP], **kwargs: Any) -> _TP: ... @overload -def pofile(pofile: Text, **kwargs: Any) -> POFile: ... +def pofile(pofile: str, **kwargs: Any) -> POFile: ... @overload -def mofile(mofile: Text, *, klass: Type[_TM], **kwargs: Any) -> _TM: ... +def mofile(mofile: str, *, klass: type[_TM], **kwargs: Any) -> _TM: ... @overload -def mofile(mofile: Text, **kwargs: Any) -> MOFile: ... -def detect_encoding(file: bytes | Text, binary_mode: bool = ...) -> str: ... -def escape(st: Text) -> Text: ... -def unescape(st: Text) -> Text: ... +def mofile(mofile: str, **kwargs: Any) -> MOFile: ... +def detect_encoding(file: bytes | str, binary_mode: bool = ...) -> str: ... +def escape(st: str) -> str: ... +def unescape(st: str) -> str: ... -class _BaseFile(List[_TB]): - fpath: Text +class _BaseFile(list[_TB]): + fpath: str wrapwidth: int - encoding: Text + encoding: str check_for_duplicates: bool - header: Text - metadata: dict[Text, Text] + header: str + metadata: dict[str, str] metadata_is_fuzzy: bool def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __unicode__(self) -> Text: ... - def __contains__(self, entry: _TB) -> bool: ... # type: ignore # AttributeError otherwise + def __unicode__(self) -> str: ... + def __contains__(self, entry: _TB) -> bool: ... # type: ignore[override] # AttributeError otherwise def __eq__(self, other: object) -> bool: ... def append(self, entry: _TB) -> None: ... def insert(self, index: SupportsIndex, entry: _TB) -> None: ... def metadata_as_entry(self) -> POEntry: ... - def save(self, fpath: Text | None = ..., repr_method: str = ...) -> None: ... - def find(self, st: Text, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ... - def ordered_metadata(self) -> list[tuple[Text, Text]]: ... + def save(self, fpath: str | None = ..., repr_method: str = ...) -> None: ... + def find(self, st: str, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ... + def ordered_metadata(self) -> list[tuple[str, str]]: ... def to_binary(self) -> bytes: ... class POFile(_BaseFile[POEntry]): - def __unicode__(self) -> Text: ... - def save_as_mofile(self, fpath: Text) -> None: ... + def __unicode__(self) -> str: ... + def save_as_mofile(self, fpath: str) -> None: ... def percent_translated(self) -> int: ... def translated_entries(self) -> list[POEntry]: ... def untranslated_entries(self) -> list[POEntry]: ... @@ -60,73 +61,73 @@ class MOFile(_BaseFile[MOEntry]): version: int def __init__(self, *args: Any, **kwargs: Any) -> None: ... def save_as_pofile(self, fpath: str) -> None: ... - def save(self, fpath: Text | None = ...) -> None: ... # type: ignore # binary file does not allow argument repr_method + def save(self, fpath: str | None = ...) -> None: ... # type: ignore[override] # binary file does not allow argument repr_method def percent_translated(self) -> int: ... def translated_entries(self) -> list[MOEntry]: ... def untranslated_entries(self) -> list[MOEntry]: ... def fuzzy_entries(self) -> list[MOEntry]: ... def obsolete_entries(self) -> list[MOEntry]: ... -class _BaseEntry(object): - msgid: Text - msgstr: Text - msgid_plural: Text - msgstr_plural: list[Text] - msgctxt: Text +class _BaseEntry: + msgid: str + msgstr: str + msgid_plural: str + msgstr_plural: list[str] + msgctxt: str obsolete: bool encoding: str def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __unicode__(self, wrapwidth: int = ...) -> Text: ... + def __unicode__(self, wrapwidth: int = ...) -> str: ... def __eq__(self, other: object) -> bool: ... class POEntry(_BaseEntry): - comment: Text - tcomment: Text - occurrences: list[Tuple[str, int]] - flags: list[Text] - previous_msgctxt: Text | None - previous_msgid: Text | None - previous_msgid_plural: Text | None + comment: str + tcomment: str + occurrences: list[tuple[str, int]] + flags: list[str] + previous_msgctxt: str | None + previous_msgid: str | None + previous_msgid_plural: str | None linenum: int | None def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __unicode__(self, wrapwidth: int = ...) -> Text: ... + def __unicode__(self, wrapwidth: int = ...) -> str: ... def __cmp__(self, other: POEntry) -> int: ... def __gt__(self, other: POEntry) -> bool: ... def __lt__(self, other: POEntry) -> bool: ... def __ge__(self, other: POEntry) -> bool: ... def __le__(self, other: POEntry) -> bool: ... - def __eq__(self, other: Any) -> bool: ... - def __ne__(self, other: Any) -> bool: ... + def __eq__(self, other: POEntry) -> bool: ... # type: ignore[override] + def __ne__(self, other: POEntry) -> bool: ... # type: ignore[override] def translated(self) -> bool: ... def merge(self, other: POEntry) -> None: ... @property def fuzzy(self) -> bool: ... @property - def msgid_with_context(self) -> Text: ... + def msgid_with_context(self) -> str: ... def __hash__(self) -> int: ... class MOEntry(_BaseEntry): - comment: Text - tcomment: Text - occurrences: list[Tuple[str, int]] - flags: list[Text] - previous_msgctxt: Text | None - previous_msgid: Text | None - previous_msgid_plural: Text | None + comment: str + tcomment: str + occurrences: list[tuple[str, int]] + flags: list[str] + previous_msgctxt: str | None + previous_msgid: str | None + previous_msgid_plural: str | None def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __hash__(self) -> int: ... class _POFileParser(Generic[_TP]): - fhandle: IO[Text] + fhandle: IO[str] instance: _TP - transitions: dict[Tuple[str, str], Tuple[Callable[[], bool], str]] + transitions: dict[tuple[str, str], tuple[Callable[[], bool], str]] current_line: int current_entry: POEntry current_state: str current_token: str | None msgstr_index: int entry_obsolete: int - def __init__(self, pofile: Text, *args: Any, **kwargs: Any) -> None: ... + def __init__(self, pofile: str, *args: Any, **kwargs: Any) -> None: ... def parse(self) -> _TP: ... def add(self, symbol: str, states: list[str], next_state: str) -> None: ... def process(self, symbol: str) -> None: ... @@ -148,7 +149,7 @@ class _POFileParser(Generic[_TP]): class _MOFileParser(Generic[_TM]): fhandle: IO[bytes] instance: _TM - def __init__(self, mofile: Text, *args: Any, **kwargs: Any) -> None: ... + def __init__(self, mofile: str, *args: Any, **kwargs: Any) -> None: ... def __del__(self) -> None: ... def parse(self) -> _TM: ... diff --git a/stubs/prettytable/METADATA.toml b/stubs/prettytable/METADATA.toml index 5647aa0..ff9007e 100644 --- a/stubs/prettytable/METADATA.toml +++ b/stubs/prettytable/METADATA.toml @@ -1 +1,5 @@ -version = "2.1" +version = "3.4.*" +obsolete_since = "3.5.0" # Released on 2022-10-28 + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/prettytable/prettytable/__init__.pyi b/stubs/prettytable/prettytable/__init__.pyi index c6eedb4..f66d036 100644 --- a/stubs/prettytable/prettytable/__init__.pyi +++ b/stubs/prettytable/prettytable/__init__.pyi @@ -1,6 +1,7 @@ from .prettytable import ( ALL as ALL, DEFAULT as DEFAULT, + DOUBLE_BORDER as DOUBLE_BORDER, FRAME as FRAME, HEADER as HEADER, MARKDOWN as MARKDOWN, @@ -9,6 +10,7 @@ from .prettytable import ( ORGMODE as ORGMODE, PLAIN_COLUMNS as PLAIN_COLUMNS, RANDOM as RANDOM, + SINGLE_BORDER as SINGLE_BORDER, PrettyTable as PrettyTable, TableHandler as TableHandler, from_csv as from_csv, diff --git a/stubs/prettytable/prettytable/colortable.pyi b/stubs/prettytable/prettytable/colortable.pyi new file mode 100644 index 0000000..8d9bfba --- /dev/null +++ b/stubs/prettytable/prettytable/colortable.pyi @@ -0,0 +1,43 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from typing import ClassVar + +from .prettytable import PrettyTable + +RESET_CODE: str + +init: Callable[[], object] + +class Theme: + default_color: str + vertical_char: str + vertical_color: str + horizontal_char: str + horizontal_color: str + junction_char: str + junction_color: str + def __init__( + self, + default_color: str = ..., + vertical_char: str = ..., + vertical_color: str = ..., + horizontal_char: str = ..., + horizontal_color: str = ..., + junction_char: str = ..., + junction_color: str = ..., + ) -> None: ... + # The following method is broken in upstream code. + def format_code(s: str) -> str: ... # type: ignore[misc] + +class Themes: + DEFAULT: ClassVar[Theme] + OCEAN: ClassVar[Theme] + +class ColorTable(PrettyTable): + def __init__(self, field_names: Incomplete | None = ..., **kwargs) -> None: ... + @property + def theme(self) -> Theme: ... + @theme.setter + def theme(self, value: Theme): ... + def update_theme(self) -> None: ... + def get_string(self, **kwargs) -> str: ... diff --git a/stubs/prettytable/prettytable/prettytable.pyi b/stubs/prettytable/prettytable/prettytable.pyi index 71eb2a3..3e7d2ae 100644 --- a/stubs/prettytable/prettytable/prettytable.pyi +++ b/stubs/prettytable/prettytable/prettytable.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from html.parser import HTMLParser from typing import Any @@ -11,6 +12,9 @@ PLAIN_COLUMNS: int MARKDOWN: int ORGMODE: int RANDOM: int +SINGLE_BORDER: int +DOUBLE_BORDER: int +BASE_ALIGN_VALUE: str class PrettyTable: encoding: Any @@ -141,6 +145,62 @@ class PrettyTable: def oldsortslice(self): ... @oldsortslice.setter def oldsortslice(self, val) -> None: ... + @property + def bottom_junction_char(self): ... + @bottom_junction_char.setter + def bottom_junction_char(self, val) -> None: ... + @property + def bottom_left_junction_char(self): ... + @bottom_left_junction_char.setter + def bottom_left_junction_char(self, val) -> None: ... + @property + def bottom_right_junction_char(self): ... + @bottom_right_junction_char.setter + def bottom_right_junction_char(self, val) -> None: ... + @property + def custom_format(self): ... + @custom_format.setter + def custom_format(self, val) -> None: ... + @property + def horizontal_align_char(self): ... + @horizontal_align_char.setter + def horizontal_align_char(self, val) -> None: ... + @property + def left_junction_char(self): ... + @left_junction_char.setter + def left_junction_char(self, val) -> None: ... + @property + def none_format(self): ... + @none_format.setter + def none_format(self, val) -> None: ... + @property + def preserve_internal_border(self): ... + @preserve_internal_border.setter + def preserve_internal_border(self, val) -> None: ... + @property + def right_junction_char(self): ... + @right_junction_char.setter + def right_junction_char(self, val) -> None: ... + @property + def top_junction_char(self): ... + @top_junction_char.setter + def top_junction_char(self, val) -> None: ... + @property + def top_left_junction_char(self): ... + @top_left_junction_char.setter + def top_left_junction_char(self, val) -> None: ... + @property + def top_right_junction_char(self): ... + @top_right_junction_char.setter + def top_right_junction_char(self, val) -> None: ... + @property + def xhtml(self) -> bool: ... + @xhtml.setter + def xhtml(self, val: bool) -> None: ... + @property + def rows(self) -> list[Incomplete]: ... + def add_autoindex(self, fieldname: str = ...): ... + def get_latex_string(self, **kwargs) -> str: ... def set_style(self, style) -> None: ... def add_rows(self, rows) -> None: ... def add_row(self, row) -> None: ... @@ -150,11 +210,11 @@ class PrettyTable: def clear_rows(self) -> None: ... def clear(self) -> None: ... def copy(self): ... - def get_string(self, **kwargs): ... - def paginate(self, page_length: int = ..., **kwargs): ... - def get_csv_string(self, **kwargs): ... - def get_json_string(self, **kwargs): ... - def get_html_string(self, **kwargs): ... + def get_string(self, **kwargs) -> str: ... + def paginate(self, page_length: int = ..., line_break: str = ..., **kwargs): ... + def get_csv_string(self, **kwargs) -> str: ... + def get_json_string(self, **kwargs) -> str: ... + def get_html_string(self, **kwargs) -> str: ... def from_csv(fp, field_names: Any | None = ..., **kwargs): ... def from_db_cursor(cursor, **kwargs): ... diff --git a/stubs/protobuf/@tests/stubtest_allowlist.txt b/stubs/protobuf/@tests/stubtest_allowlist.txt index a535e4b..5c4b55b 100644 --- a/stubs/protobuf/@tests/stubtest_allowlist.txt +++ b/stubs/protobuf/@tests/stubtest_allowlist.txt @@ -1,181 +1,35 @@ -google.protobuf.__version__ -google.protobuf.any_pb2.Any.__init__ -google.protobuf.api_pb2.Api.__init__ -google.protobuf.api_pb2.Method.__init__ -google.protobuf.api_pb2.Mixin.__init__ -google.protobuf.compiler.plugin_pb2.CodeGeneratorRequest.__init__ -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.FEATURE_NONE -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.FEATURE_PROTO3_OPTIONAL -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.Feature -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.File.__init__ -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse._Feature -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse._FeatureEnumTypeWrapper -google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.__init__ -google.protobuf.compiler.plugin_pb2.Version.__init__ -google.protobuf.descriptor.Descriptor.__new__ -google.protobuf.descriptor.FieldDescriptor.__init__ -google.protobuf.descriptor.FieldDescriptor.__new__ -google.protobuf.descriptor.ServiceDescriptor.__new__ -google.protobuf.descriptor._NestedDescriptorBase.GetTopLevelContainingType -google.protobuf.descriptor_pb2.DescriptorProto.ExtensionRange.__init__ -google.protobuf.descriptor_pb2.DescriptorProto.ReservedRange.__init__ -google.protobuf.descriptor_pb2.DescriptorProto.__init__ -google.protobuf.descriptor_pb2.EnumDescriptorProto.EnumReservedRange.__init__ -google.protobuf.descriptor_pb2.EnumDescriptorProto.__init__ -google.protobuf.descriptor_pb2.EnumOptions.__init__ -google.protobuf.descriptor_pb2.EnumValueDescriptorProto.__init__ -google.protobuf.descriptor_pb2.EnumValueOptions.__init__ -google.protobuf.descriptor_pb2.ExtensionRangeOptions.__init__ -google.protobuf.descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL -google.protobuf.descriptor_pb2.FieldDescriptorProto.LABEL_REPEATED -google.protobuf.descriptor_pb2.FieldDescriptorProto.LABEL_REQUIRED -google.protobuf.descriptor_pb2.FieldDescriptorProto.Label -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_BOOL -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_BYTES -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_DOUBLE -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_ENUM -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_FIXED32 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_FIXED64 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_FLOAT -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_GROUP -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_INT32 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_INT64 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_MESSAGE -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_SFIXED32 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_SFIXED64 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_SINT32 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_SINT64 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_STRING -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_UINT32 -google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_UINT64 -google.protobuf.descriptor_pb2.FieldDescriptorProto.Type -google.protobuf.descriptor_pb2.FieldDescriptorProto._Label -google.protobuf.descriptor_pb2.FieldDescriptorProto._LabelEnumTypeWrapper -google.protobuf.descriptor_pb2.FieldDescriptorProto._Type -google.protobuf.descriptor_pb2.FieldDescriptorProto._TypeEnumTypeWrapper -google.protobuf.descriptor_pb2.FieldDescriptorProto.__init__ -google.protobuf.descriptor_pb2.FieldOptions.CORD -google.protobuf.descriptor_pb2.FieldOptions.CType -google.protobuf.descriptor_pb2.FieldOptions.JSType -google.protobuf.descriptor_pb2.FieldOptions.JS_NORMAL -google.protobuf.descriptor_pb2.FieldOptions.JS_NUMBER -google.protobuf.descriptor_pb2.FieldOptions.JS_STRING -google.protobuf.descriptor_pb2.FieldOptions.STRING -google.protobuf.descriptor_pb2.FieldOptions.STRING_PIECE -google.protobuf.descriptor_pb2.FieldOptions._CType -google.protobuf.descriptor_pb2.FieldOptions._CTypeEnumTypeWrapper -google.protobuf.descriptor_pb2.FieldOptions._JSType -google.protobuf.descriptor_pb2.FieldOptions._JSTypeEnumTypeWrapper -google.protobuf.descriptor_pb2.FieldOptions.__init__ -google.protobuf.descriptor_pb2.FileDescriptorProto.__init__ -google.protobuf.descriptor_pb2.FileDescriptorSet.__init__ -google.protobuf.descriptor_pb2.FileOptions.CODE_SIZE -google.protobuf.descriptor_pb2.FileOptions.LITE_RUNTIME -google.protobuf.descriptor_pb2.FileOptions.OptimizeMode -google.protobuf.descriptor_pb2.FileOptions.SPEED -google.protobuf.descriptor_pb2.FileOptions._OptimizeMode -google.protobuf.descriptor_pb2.FileOptions._OptimizeModeEnumTypeWrapper -google.protobuf.descriptor_pb2.FileOptions.__init__ -google.protobuf.descriptor_pb2.GeneratedCodeInfo.Annotation.__init__ -google.protobuf.descriptor_pb2.GeneratedCodeInfo.__init__ -google.protobuf.descriptor_pb2.MessageOptions.__init__ -google.protobuf.descriptor_pb2.MethodDescriptorProto.__init__ -google.protobuf.descriptor_pb2.MethodOptions.IDEMPOTENCY_UNKNOWN -google.protobuf.descriptor_pb2.MethodOptions.IDEMPOTENT -google.protobuf.descriptor_pb2.MethodOptions.IdempotencyLevel -google.protobuf.descriptor_pb2.MethodOptions.NO_SIDE_EFFECTS -google.protobuf.descriptor_pb2.MethodOptions._IdempotencyLevel -google.protobuf.descriptor_pb2.MethodOptions._IdempotencyLevelEnumTypeWrapper -google.protobuf.descriptor_pb2.MethodOptions.__init__ -google.protobuf.descriptor_pb2.OneofDescriptorProto.__init__ -google.protobuf.descriptor_pb2.OneofOptions.__init__ -google.protobuf.descriptor_pb2.ServiceDescriptorProto.__init__ -google.protobuf.descriptor_pb2.ServiceOptions.__init__ -google.protobuf.descriptor_pb2.SourceCodeInfo.Location.__init__ -google.protobuf.descriptor_pb2.SourceCodeInfo.__init__ -google.protobuf.descriptor_pb2.UninterpretedOption.NamePart.__init__ -google.protobuf.descriptor_pb2.UninterpretedOption.__init__ -google.protobuf.duration_pb2.Duration.__init__ -google.protobuf.empty_pb2.Empty.__init__ -google.protobuf.field_mask_pb2.FieldMask.__init__ -google.protobuf.internal.containers.BaseContainer.sort -google.protobuf.internal.containers.Mapping -google.protobuf.internal.containers.MessageMap.__init__ -google.protobuf.internal.containers.MessageMap.get -google.protobuf.internal.containers.RepeatedCompositeFieldContainer.__init__ -google.protobuf.internal.containers.RepeatedScalarFieldContainer.__init__ -google.protobuf.internal.containers.ScalarMap.__init__ -google.protobuf.internal.containers.ScalarMap.get -google.protobuf.internal.decoder.BytesDecoder -google.protobuf.internal.decoder.EnumDecoder -google.protobuf.internal.decoder.MessageSetItemDecoder -google.protobuf.internal.decoder.StringDecoder -google.protobuf.internal.encoder.MapSizer +# Generated pb2 methods diverge for a variety of reasons. They are tested +# carefully in mypy-protobuf which internally runs stubtest. Skip those here. +google.protobuf\..*_pb2\..* + +# While Message and Descriptor are both defined with a null DESCRIPTOR, +# subclasses of Message and instances of EnumTypeWrapper require this value to +# be set, and since these type stubs are intended for use with protoc-generated +# python it's more accurate to make them non-nullable. google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper.DESCRIPTOR -google.protobuf.internal.python_message.GeneratedProtocolMessageType.__init__ -google.protobuf.internal.python_message.GeneratedProtocolMessageType.__new__ -google.protobuf.internal.well_known_types.Any.Pack -google.protobuf.internal.well_known_types.Error -google.protobuf.internal.well_known_types.ParseError google.protobuf.message.Message.DESCRIPTOR + +# Exists at runtime, but via a __getitem__/__setitem__ hack +# See https://github.com/protocolbuffers/protobuf/blob/3ea30d80847cd9561db570ae7f673afc15523545/python/google/protobuf/message.py#L67 google.protobuf.message.Message.Extensions -google.protobuf.message.Message.FromString + +# These are typed as (self, **kwargs) at runtime as thin wrapper functions +# around the underlying true typing. We prefer the true typing +google.protobuf.internal.containers.BaseContainer.sort google.protobuf.message.Message.SerializePartialToString google.protobuf.message.Message.SerializeToString -google.protobuf.message.Message.__init__ -google.protobuf.service.Service.GetDescriptor -google.protobuf.source_context_pb2.SourceContext.__init__ -google.protobuf.struct_pb2.ListValue.__init__ -google.protobuf.struct_pb2.NULL_VALUE -google.protobuf.struct_pb2.NullValue -google.protobuf.struct_pb2.Struct.FieldsEntry.__init__ -google.protobuf.struct_pb2.Struct.__init__ -google.protobuf.struct_pb2.Value.__init__ google.protobuf.text_format.MessageToBytes -google.protobuf.timestamp_pb2.Timestamp.__init__ -google.protobuf.type_pb2.Enum.__init__ -google.protobuf.type_pb2.EnumValue.__init__ -google.protobuf.type_pb2.Field.CARDINALITY_OPTIONAL -google.protobuf.type_pb2.Field.CARDINALITY_REPEATED -google.protobuf.type_pb2.Field.CARDINALITY_REQUIRED -google.protobuf.type_pb2.Field.CARDINALITY_UNKNOWN -google.protobuf.type_pb2.Field.Cardinality -google.protobuf.type_pb2.Field.Kind -google.protobuf.type_pb2.Field.TYPE_BOOL -google.protobuf.type_pb2.Field.TYPE_BYTES -google.protobuf.type_pb2.Field.TYPE_DOUBLE -google.protobuf.type_pb2.Field.TYPE_ENUM -google.protobuf.type_pb2.Field.TYPE_FIXED32 -google.protobuf.type_pb2.Field.TYPE_FIXED64 -google.protobuf.type_pb2.Field.TYPE_FLOAT -google.protobuf.type_pb2.Field.TYPE_GROUP -google.protobuf.type_pb2.Field.TYPE_INT32 -google.protobuf.type_pb2.Field.TYPE_INT64 -google.protobuf.type_pb2.Field.TYPE_MESSAGE -google.protobuf.type_pb2.Field.TYPE_SFIXED32 -google.protobuf.type_pb2.Field.TYPE_SFIXED64 -google.protobuf.type_pb2.Field.TYPE_SINT32 -google.protobuf.type_pb2.Field.TYPE_SINT64 -google.protobuf.type_pb2.Field.TYPE_STRING -google.protobuf.type_pb2.Field.TYPE_UINT32 -google.protobuf.type_pb2.Field.TYPE_UINT64 -google.protobuf.type_pb2.Field.TYPE_UNKNOWN -google.protobuf.type_pb2.Field._Cardinality -google.protobuf.type_pb2.Field._CardinalityEnumTypeWrapper -google.protobuf.type_pb2.Field._Kind -google.protobuf.type_pb2.Field._KindEnumTypeWrapper -google.protobuf.type_pb2.Field.__init__ -google.protobuf.type_pb2.Option.__init__ -google.protobuf.type_pb2.SYNTAX_PROTO2 -google.protobuf.type_pb2.SYNTAX_PROTO3 -google.protobuf.type_pb2.Syntax -google.protobuf.type_pb2.Type.__init__ -google.protobuf.wrappers_pb2.BoolValue.__init__ -google.protobuf.wrappers_pb2.BytesValue.__init__ -google.protobuf.wrappers_pb2.DoubleValue.__init__ -google.protobuf.wrappers_pb2.FloatValue.__init__ -google.protobuf.wrappers_pb2.Int32Value.__init__ -google.protobuf.wrappers_pb2.Int64Value.__init__ -google.protobuf.wrappers_pb2.StringValue.__init__ -google.protobuf.wrappers_pb2.UInt32Value.__init__ -google.protobuf.wrappers_pb2.UInt64Value.__init__ + +# Stubbed as static method, but actually exists as a property that's +# a function. Typeshed's typing is more useful +google.protobuf.service.Service.GetDescriptor + +# These are deliberately omitted in the stub. +# The classes can't be constructed directly anyway, +# so the signatures of their constructors are somewhat irrelevant. +google.protobuf.descriptor.Descriptor.__new__ +google.protobuf.descriptor.ServiceDescriptor.__new__ + +# Set to None at runtime - which doesn't match the Sequence base class. +# It's a hack - just allow it. +google.protobuf.internal.containers.BaseContainer.__hash__ diff --git a/stubs/protobuf/METADATA.toml b/stubs/protobuf/METADATA.toml index 01e9270..06628e4 100644 --- a/stubs/protobuf/METADATA.toml +++ b/stubs/protobuf/METADATA.toml @@ -1,4 +1,2 @@ -version = "3.17" -python2 = true -requires = ["types-futures"] -extra_description = "Generated with aid from mypy-protobuf v2.8" +version = "3.20.*" +extra_description = "Generated with aid from mypy-protobuf v3.4.0" diff --git a/stubs/protobuf/google/protobuf/__init__.pyi b/stubs/protobuf/google/protobuf/__init__.pyi index aae1f93..bda5b5a 100644 --- a/stubs/protobuf/google/protobuf/__init__.pyi +++ b/stubs/protobuf/google/protobuf/__init__.pyi @@ -1 +1 @@ -__version__: bytes +__version__: str diff --git a/stubs/protobuf/google/protobuf/any_pb2.pyi b/stubs/protobuf/google/protobuf/any_pb2.pyi index 063c3b2..398a9ab 100644 --- a/stubs/protobuf/google/protobuf/any_pb2.pyi +++ b/stubs/protobuf/google/protobuf/any_pb2.pyi @@ -1,136 +1,176 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins import google.protobuf.descriptor import google.protobuf.internal.well_known_types import google.protobuf.message -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -# `Any` contains an arbitrary serialized protocol buffer message along with a -# URL that describes the type of the serialized message. -# -# Protobuf library provides support to pack/unpack Any values in the form -# of utility functions or additional generated methods of the Any type. -# -# Example 1: Pack and unpack a message in C++. -# -# Foo foo = ...; -# Any any; -# any.PackFrom(foo); -# ... -# if (any.UnpackTo(&foo)) { -# ... -# } -# -# Example 2: Pack and unpack a message in Java. -# -# Foo foo = ...; -# Any any = Any.pack(foo); -# ... -# if (any.is(Foo.class)) { -# foo = any.unpack(Foo.class); -# } -# -# Example 3: Pack and unpack a message in Python. -# -# foo = Foo(...) -# any = Any() -# any.Pack(foo) -# ... -# if any.Is(Foo.DESCRIPTOR): -# any.Unpack(foo) -# ... -# -# Example 4: Pack and unpack a message in Go -# -# foo := &pb.Foo{...} -# any, err := anypb.New(foo) -# if err != nil { -# ... -# } -# ... -# foo := &pb.Foo{} -# if err := any.UnmarshalTo(foo); err != nil { -# ... -# } -# -# The pack methods provided by protobuf library will by default use -# 'type.googleapis.com/full.type.name' as the type URL and the unpack -# methods only use the fully qualified type name after the last '/' -# in the type URL, for example "foo.bar.com/x/y.z" will yield type -# name "y.z". -# -# -# JSON -# ==== -# The JSON representation of an `Any` value uses the regular -# representation of the deserialized, embedded message, with an -# additional field `@type` which contains the type URL. Example: -# -# package google.profile; -# message Person { -# string first_name = 1; -# string last_name = 2; -# } -# -# { -# "@type": "type.googleapis.com/google.profile.Person", -# "firstName": , -# "lastName": -# } -# -# If the embedded message type is well-known and has a custom JSON -# representation, that representation will be embedded adding a field -# `value` which holds the custom JSON in addition to the `@type` -# field. Example (for message [google.protobuf.Duration][]): -# -# { -# "@type": "type.googleapis.com/google.protobuf.Duration", -# "value": "1.212s" -# } +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final class Any(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Any): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """`Any` contains an arbitrary serialized protocol buffer message along with a + URL that describes the type of the serialized message. + + Protobuf library provides support to pack/unpack Any values in the form + of utility functions or additional generated methods of the Any type. + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + 'type.googleapis.com/full.type.name' as the type URL and the unpack + methods only use the fully qualified type name after the last '/' + in the type URL, for example "foo.bar.com/x/y.z" will yield type + name "y.z". + + + JSON + + The JSON representation of an `Any` value uses the regular + representation of the deserialized, embedded message, with an + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + representation, that representation will be embedded adding a field + `value` which holds the custom JSON in addition to the `@type` + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + TYPE_URL_FIELD_NUMBER: builtins.int VALUE_FIELD_NUMBER: builtins.int - # A URL/resource name that uniquely identifies the type of the serialized - # protocol buffer message. This string must contain at least - # one "/" character. The last segment of the URL's path must represent - # the fully qualified name of the type (as in - # `path/google.protobuf.Duration`). The name should be in a canonical form - # (e.g., leading "." is not accepted). - # - # In practice, teams usually precompile into the binary all types that they - # expect it to use in the context of Any. However, for URLs which use the - # scheme `http`, `https`, or no scheme, one can optionally set up a type - # server that maps type URLs to message definitions as follows: - # - # * If no scheme is provided, `https` is assumed. - # * An HTTP GET on the URL must yield a [google.protobuf.Type][] - # value in binary format, or produce an error. - # * Applications are allowed to cache lookup results based on the - # URL, or have them precompiled into a binary to avoid any - # lookup. Therefore, binary compatibility needs to be preserved - # on changes to types. (Use versioned type names to manage - # breaking changes.) - # - # Note: this functionality is not currently available in the official - # protobuf release, and it is not used for type URLs beginning with - # type.googleapis.com. - # - # Schemes other than `http`, `https` (or the empty scheme) might be - # used with implementation specific semantics. - type_url: typing.Text = ... - # Must be a valid serialized protocol buffer of the above specified type. - value: builtins.bytes = ... - def __init__(self, + type_url: builtins.str + """A URL/resource name that uniquely identifies the type of the serialized + protocol buffer message. This string must contain at least + one "/" character. The last segment of the URL's path must represent + the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a canonical form + (e.g., leading "." is not accepted). + + In practice, teams usually precompile into the binary all types that they + expect it to use in the context of Any. However, for URLs which use the + scheme `http`, `https`, or no scheme, one can optionally set up a type + server that maps type URLs to message definitions as follows: + + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the official + protobuf release, and it is not used for type URLs beginning with + type.googleapis.com. + + Schemes other than `http`, `https` (or the empty scheme) might be + used with implementation specific semantics. + """ + value: builtins.bytes + """Must be a valid serialized protocol buffer of the above specified type.""" + def __init__( + self, *, - type_url : typing.Text = ..., - value : builtins.bytes = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"type_url",b"type_url",u"value",b"value"]) -> None: ... + type_url: builtins.str | None = ..., + value: builtins.bytes | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["type_url", b"type_url", "value", b"value"]) -> None: ... + global___Any = Any diff --git a/stubs/protobuf/google/protobuf/api_pb2.pyi b/stubs/protobuf/google/protobuf/api_pb2.pyi index 10d183c..4cedb0d 100644 --- a/stubs/protobuf/google/protobuf/api_pb2.pyi +++ b/stubs/protobuf/google/protobuf/api_pb2.pyi @@ -1,29 +1,67 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins +import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.message import google.protobuf.source_context_pb2 import google.protobuf.type_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -# Api is a light-weight descriptor for an API Interface. -# -# Interfaces are also described as "protocol buffer services" in some contexts, -# such as by the "service" keyword in a .proto file, but they are different -# from API Services, which represent a concrete implementation of an interface -# as opposed to simply a description of methods and bindings. They are also -# sometimes simply referred to as "APIs" in other contexts, such as the name of -# this message itself. See https://cloud.google.com/apis/design/glossary for -# detailed terminology. +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final class Api(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Api is a light-weight descriptor for an API Interface. + + Interfaces are also described as "protocol buffer services" in some contexts, + such as by the "service" keyword in a .proto file, but they are different + from API Services, which represent a concrete implementation of an interface + as opposed to simply a description of methods and bindings. They are also + sometimes simply referred to as "APIs" in other contexts, such as the name of + this message itself. See https://cloud.google.com/apis/design/glossary for + detailed terminology. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int METHODS_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int @@ -31,61 +69,69 @@ class Api(google.protobuf.message.Message): SOURCE_CONTEXT_FIELD_NUMBER: builtins.int MIXINS_FIELD_NUMBER: builtins.int SYNTAX_FIELD_NUMBER: builtins.int - # The fully qualified name of this interface, including package name - # followed by the interface's simple name. - name: typing.Text = ... - # The methods of this interface, in unspecified order. + name: builtins.str + """The fully qualified name of this interface, including package name + followed by the interface's simple name. + """ @property - def methods(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Method]: ... - # Any metadata attached to the interface. + def methods(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Method]: + """The methods of this interface, in unspecified order.""" @property - def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.type_pb2.Option]: ... - # A version string for this interface. If specified, must have the form - # `major-version.minor-version`, as in `1.10`. If the minor version is - # omitted, it defaults to zero. If the entire version field is empty, the - # major version is derived from the package name, as outlined below. If the - # field is not empty, the version in the package name will be verified to be - # consistent with what is provided here. - # - # The versioning schema uses [semantic - # versioning](http://semver.org) where the major version number - # indicates a breaking change and the minor version an additive, - # non-breaking change. Both version numbers are signals to users - # what to expect from different versions, and should be carefully - # chosen based on the product plan. - # - # The major version is also reflected in the package name of the - # interface, which must end in `v`, as in - # `google.feature.v1`. For major versions 0 and 1, the suffix can - # be omitted. Zero major versions must only be used for - # experimental, non-GA interfaces. - version: typing.Text = ... - # Source context for the protocol buffer service represented by this - # message. + def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.type_pb2.Option]: + """Any metadata attached to the interface.""" + version: builtins.str + """A version string for this interface. If specified, must have the form + `major-version.minor-version`, as in `1.10`. If the minor version is + omitted, it defaults to zero. If the entire version field is empty, the + major version is derived from the package name, as outlined below. If the + field is not empty, the version in the package name will be verified to be + consistent with what is provided here. + + The versioning schema uses [semantic + versioning](http://semver.org) where the major version number + indicates a breaking change and the minor version an additive, + non-breaking change. Both version numbers are signals to users + what to expect from different versions, and should be carefully + chosen based on the product plan. + + The major version is also reflected in the package name of the + interface, which must end in `v`, as in + `google.feature.v1`. For major versions 0 and 1, the suffix can + be omitted. Zero major versions must only be used for + experimental, non-GA interfaces. + """ @property - def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: ... - # Included interfaces. See [Mixin][]. + def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: + """Source context for the protocol buffer service represented by this + message. + """ @property - def mixins(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Mixin]: ... - # The source syntax of the service. - syntax: google.protobuf.type_pb2.Syntax.V = ... - def __init__(self, + def mixins(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Mixin]: + """Included interfaces. See [Mixin][].""" + syntax: google.protobuf.type_pb2.Syntax.ValueType + """The source syntax of the service.""" + def __init__( + self, *, - name : typing.Text = ..., - methods : typing.Optional[typing.Iterable[global___Method]] = ..., - options : typing.Optional[typing.Iterable[google.protobuf.type_pb2.Option]] = ..., - version : typing.Text = ..., - source_context : typing.Optional[google.protobuf.source_context_pb2.SourceContext] = ..., - mixins : typing.Optional[typing.Iterable[global___Mixin]] = ..., - syntax : google.protobuf.type_pb2.Syntax.V = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"source_context",b"source_context"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"methods",b"methods",u"mixins",b"mixins",u"name",b"name",u"options",b"options",u"source_context",b"source_context",u"syntax",b"syntax",u"version",b"version"]) -> None: ... + name: builtins.str | None = ..., + methods: collections.abc.Iterable[global___Method] | None = ..., + options: collections.abc.Iterable[google.protobuf.type_pb2.Option] | None = ..., + version: builtins.str | None = ..., + source_context: google.protobuf.source_context_pb2.SourceContext | None = ..., + mixins: collections.abc.Iterable[global___Mixin] | None = ..., + syntax: google.protobuf.type_pb2.Syntax.ValueType | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["source_context", b"source_context"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["methods", b"methods", "mixins", b"mixins", "name", b"name", "options", b"options", "source_context", b"source_context", "syntax", b"syntax", "version", b"version"]) -> None: ... + global___Api = Api -# Method represents a method of an API interface. +@typing_extensions.final class Method(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Method represents a method of an API interface.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int REQUEST_TYPE_URL_FIELD_NUMBER: builtins.int REQUEST_STREAMING_FIELD_NUMBER: builtins.int @@ -93,125 +139,134 @@ class Method(google.protobuf.message.Message): RESPONSE_STREAMING_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int SYNTAX_FIELD_NUMBER: builtins.int - # The simple name of this method. - name: typing.Text = ... - # A URL of the input message type. - request_type_url: typing.Text = ... - # If true, the request is streamed. - request_streaming: builtins.bool = ... - # The URL of the output message type. - response_type_url: typing.Text = ... - # If true, the response is streamed. - response_streaming: builtins.bool = ... - # Any metadata attached to the method. + name: builtins.str + """The simple name of this method.""" + request_type_url: builtins.str + """A URL of the input message type.""" + request_streaming: builtins.bool + """If true, the request is streamed.""" + response_type_url: builtins.str + """The URL of the output message type.""" + response_streaming: builtins.bool + """If true, the response is streamed.""" @property - def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.type_pb2.Option]: ... - # The source syntax of this method. - syntax: google.protobuf.type_pb2.Syntax.V = ... - def __init__(self, + def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.type_pb2.Option]: + """Any metadata attached to the method.""" + syntax: google.protobuf.type_pb2.Syntax.ValueType + """The source syntax of this method.""" + def __init__( + self, *, - name : typing.Text = ..., - request_type_url : typing.Text = ..., - request_streaming : builtins.bool = ..., - response_type_url : typing.Text = ..., - response_streaming : builtins.bool = ..., - options : typing.Optional[typing.Iterable[google.protobuf.type_pb2.Option]] = ..., - syntax : google.protobuf.type_pb2.Syntax.V = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options",u"request_streaming",b"request_streaming",u"request_type_url",b"request_type_url",u"response_streaming",b"response_streaming",u"response_type_url",b"response_type_url",u"syntax",b"syntax"]) -> None: ... + name: builtins.str | None = ..., + request_type_url: builtins.str | None = ..., + request_streaming: builtins.bool | None = ..., + response_type_url: builtins.str | None = ..., + response_streaming: builtins.bool | None = ..., + options: collections.abc.Iterable[google.protobuf.type_pb2.Option] | None = ..., + syntax: google.protobuf.type_pb2.Syntax.ValueType | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options", "request_streaming", b"request_streaming", "request_type_url", b"request_type_url", "response_streaming", b"response_streaming", "response_type_url", b"response_type_url", "syntax", b"syntax"]) -> None: ... + global___Method = Method -# Declares an API Interface to be included in this interface. The including -# interface must redeclare all the methods from the included interface, but -# documentation and options are inherited as follows: -# -# - If after comment and whitespace stripping, the documentation -# string of the redeclared method is empty, it will be inherited -# from the original method. -# -# - Each annotation belonging to the service config (http, -# visibility) which is not set in the redeclared method will be -# inherited. -# -# - If an http annotation is inherited, the path pattern will be -# modified as follows. Any version prefix will be replaced by the -# version of the including interface plus the [root][] path if -# specified. -# -# Example of a simple mixin: -# -# package google.acl.v1; -# service AccessControl { -# // Get the underlying ACL object. -# rpc GetAcl(GetAclRequest) returns (Acl) { -# option (google.api.http).get = "/v1/{resource=**}:getAcl"; -# } -# } -# -# package google.storage.v2; -# service Storage { -# rpc GetAcl(GetAclRequest) returns (Acl); -# -# // Get a data record. -# rpc GetData(GetDataRequest) returns (Data) { -# option (google.api.http).get = "/v2/{resource=**}"; -# } -# } -# -# Example of a mixin configuration: -# -# apis: -# - name: google.storage.v2.Storage -# mixins: -# - name: google.acl.v1.AccessControl -# -# The mixin construct implies that all methods in `AccessControl` are -# also declared with same name and request/response types in -# `Storage`. A documentation generator or annotation processor will -# see the effective `Storage.GetAcl` method after inheriting -# documentation and annotations as follows: -# -# service Storage { -# // Get the underlying ACL object. -# rpc GetAcl(GetAclRequest) returns (Acl) { -# option (google.api.http).get = "/v2/{resource=**}:getAcl"; -# } -# ... -# } -# -# Note how the version in the path pattern changed from `v1` to `v2`. -# -# If the `root` field in the mixin is specified, it should be a -# relative path under which inherited HTTP paths are placed. Example: -# -# apis: -# - name: google.storage.v2.Storage -# mixins: -# - name: google.acl.v1.AccessControl -# root: acls -# -# This implies the following inherited HTTP annotation: -# -# service Storage { -# // Get the underlying ACL object. -# rpc GetAcl(GetAclRequest) returns (Acl) { -# option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; -# } -# ... -# } +@typing_extensions.final class Mixin(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Declares an API Interface to be included in this interface. The including + interface must redeclare all the methods from the included interface, but + documentation and options are inherited as follows: + + - If after comment and whitespace stripping, the documentation + string of the redeclared method is empty, it will be inherited + from the original method. + + - Each annotation belonging to the service config (http, + visibility) which is not set in the redeclared method will be + inherited. + + - If an http annotation is inherited, the path pattern will be + modified as follows. Any version prefix will be replaced by the + version of the including interface plus the [root][] path if + specified. + + Example of a simple mixin: + + package google.acl.v1; + service AccessControl { + // Get the underlying ACL object. + rpc GetAcl(GetAclRequest) returns (Acl) { + option (google.api.http).get = "/v1/{resource=**}:getAcl"; + } + } + + package google.storage.v2; + service Storage { + rpc GetAcl(GetAclRequest) returns (Acl); + + // Get a data record. + rpc GetData(GetDataRequest) returns (Data) { + option (google.api.http).get = "/v2/{resource=**}"; + } + } + + Example of a mixin configuration: + + apis: + - name: google.storage.v2.Storage + mixins: + - name: google.acl.v1.AccessControl + + The mixin construct implies that all methods in `AccessControl` are + also declared with same name and request/response types in + `Storage`. A documentation generator or annotation processor will + see the effective `Storage.GetAcl` method after inheriting + documentation and annotations as follows: + + service Storage { + // Get the underlying ACL object. + rpc GetAcl(GetAclRequest) returns (Acl) { + option (google.api.http).get = "/v2/{resource=**}:getAcl"; + } + ... + } + + Note how the version in the path pattern changed from `v1` to `v2`. + + If the `root` field in the mixin is specified, it should be a + relative path under which inherited HTTP paths are placed. Example: + + apis: + - name: google.storage.v2.Storage + mixins: + - name: google.acl.v1.AccessControl + root: acls + + This implies the following inherited HTTP annotation: + + service Storage { + // Get the underlying ACL object. + rpc GetAcl(GetAclRequest) returns (Acl) { + option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; + } + ... + } + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int ROOT_FIELD_NUMBER: builtins.int - # The fully qualified name of the interface which is included. - name: typing.Text = ... - # If non-empty specifies a path under which inherited HTTP paths - # are rooted. - root: typing.Text = ... - def __init__(self, + name: builtins.str + """The fully qualified name of the interface which is included.""" + root: builtins.str + """If non-empty specifies a path under which inherited HTTP paths + are rooted. + """ + def __init__( + self, *, - name : typing.Text = ..., - root : typing.Text = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"root",b"root"]) -> None: ... + name: builtins.str | None = ..., + root: builtins.str | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "root", b"root"]) -> None: ... + global___Mixin = Mixin diff --git a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi index 012d895..2c54ee2 100644 --- a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi +++ b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi @@ -1,199 +1,249 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Author: kenton@google.com (Kenton Varda) + +WARNING: The plugin interface is currently EXPERIMENTAL and is subject to + change. + +protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is +just a program that reads a CodeGeneratorRequest from stdin and writes a +CodeGeneratorResponse to stdout. + +Plugins written using C++ can use google/protobuf/compiler/plugin.h instead +of dealing with the raw protocol defined here. + +A plugin executable needs only to be placed somewhere in the path. The +plugin should be named "protoc-gen-$NAME", and will then be used when the +flag "--${NAME}_out" is passed to protoc. """ import builtins +import collections.abc import google.protobuf.descriptor import google.protobuf.descriptor_pb2 import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.message +import sys import typing -import typing_extensions -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions -# The version number of protocol compiler. +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final class Version(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """The version number of protocol compiler.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + MAJOR_FIELD_NUMBER: builtins.int MINOR_FIELD_NUMBER: builtins.int PATCH_FIELD_NUMBER: builtins.int SUFFIX_FIELD_NUMBER: builtins.int - major: builtins.int = ... - minor: builtins.int = ... - patch: builtins.int = ... - # A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - # be empty for mainline stable releases. - suffix: typing.Text = ... - def __init__(self, + major: builtins.int + minor: builtins.int + patch: builtins.int + suffix: builtins.str + """A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + be empty for mainline stable releases. + """ + def __init__( + self, *, - major : typing.Optional[builtins.int] = ..., - minor : typing.Optional[builtins.int] = ..., - patch : typing.Optional[builtins.int] = ..., - suffix : typing.Optional[typing.Text] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"major",b"major",u"minor",b"minor",u"patch",b"patch",u"suffix",b"suffix"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"major",b"major",u"minor",b"minor",u"patch",b"patch",u"suffix",b"suffix"]) -> None: ... + major: builtins.int | None = ..., + minor: builtins.int | None = ..., + patch: builtins.int | None = ..., + suffix: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["major", b"major", "minor", b"minor", "patch", b"patch", "suffix", b"suffix"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["major", b"major", "minor", b"minor", "patch", b"patch", "suffix", b"suffix"]) -> None: ... + global___Version = Version -# An encoded CodeGeneratorRequest is written to the plugin's stdin. +@typing_extensions.final class CodeGeneratorRequest(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """An encoded CodeGeneratorRequest is written to the plugin's stdin.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + FILE_TO_GENERATE_FIELD_NUMBER: builtins.int PARAMETER_FIELD_NUMBER: builtins.int PROTO_FILE_FIELD_NUMBER: builtins.int COMPILER_VERSION_FIELD_NUMBER: builtins.int - # The .proto files that were explicitly listed on the command-line. The - # code generator should generate code only for these files. Each file's - # descriptor will be included in proto_file, below. @property - def file_to_generate(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - # The generator parameter passed on the command-line. - parameter: typing.Text = ... - # FileDescriptorProtos for all files in files_to_generate and everything - # they import. The files will appear in topological order, so each file - # appears before any file that imports it. - # - # protoc guarantees that all proto_files will be written after - # the fields above, even though this is not technically guaranteed by the - # protobuf wire format. This theoretically could allow a plugin to stream - # in the FileDescriptorProtos and handle them one by one rather than read - # the entire set into memory at once. However, as of this writing, this - # is not similarly optimized on protoc's end -- it will store all fields in - # memory at once before sending them to the plugin. - # - # Type names of fields and extensions in the FileDescriptorProto are always - # fully qualified. + def file_to_generate(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: + """The .proto files that were explicitly listed on the command-line. The + code generator should generate code only for these files. Each file's + descriptor will be included in proto_file, below. + """ + parameter: builtins.str + """The generator parameter passed on the command-line.""" @property - def proto_file(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.descriptor_pb2.FileDescriptorProto]: ... - # The version number of protocol compiler. + def proto_file(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.descriptor_pb2.FileDescriptorProto]: + """FileDescriptorProtos for all files in files_to_generate and everything + they import. The files will appear in topological order, so each file + appears before any file that imports it. + + protoc guarantees that all proto_files will be written after + the fields above, even though this is not technically guaranteed by the + protobuf wire format. This theoretically could allow a plugin to stream + in the FileDescriptorProtos and handle them one by one rather than read + the entire set into memory at once. However, as of this writing, this + is not similarly optimized on protoc's end -- it will store all fields in + memory at once before sending them to the plugin. + + Type names of fields and extensions in the FileDescriptorProto are always + fully qualified. + """ @property - def compiler_version(self) -> global___Version: ... - def __init__(self, + def compiler_version(self) -> global___Version: + """The version number of protocol compiler.""" + def __init__( + self, *, - file_to_generate : typing.Optional[typing.Iterable[typing.Text]] = ..., - parameter : typing.Optional[typing.Text] = ..., - proto_file : typing.Optional[typing.Iterable[google.protobuf.descriptor_pb2.FileDescriptorProto]] = ..., - compiler_version : typing.Optional[global___Version] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"compiler_version",b"compiler_version",u"parameter",b"parameter"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"compiler_version",b"compiler_version",u"file_to_generate",b"file_to_generate",u"parameter",b"parameter",u"proto_file",b"proto_file"]) -> None: ... + file_to_generate: collections.abc.Iterable[builtins.str] | None = ..., + parameter: builtins.str | None = ..., + proto_file: collections.abc.Iterable[google.protobuf.descriptor_pb2.FileDescriptorProto] | None = ..., + compiler_version: global___Version | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["compiler_version", b"compiler_version", "parameter", b"parameter"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["compiler_version", b"compiler_version", "file_to_generate", b"file_to_generate", "parameter", b"parameter", "proto_file", b"proto_file"]) -> None: ... + global___CodeGeneratorRequest = CodeGeneratorRequest -# The plugin writes an encoded CodeGeneratorResponse to stdout. +@typing_extensions.final class CodeGeneratorResponse(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - # Sync with code_generator.h. - class Feature(_Feature, metaclass=_FeatureEnumTypeWrapper): - pass + """The plugin writes an encoded CodeGeneratorResponse to stdout.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + class _Feature: - V = typing.NewType('V', builtins.int) - class _FeatureEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Feature.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - FEATURE_NONE = CodeGeneratorResponse.Feature.V(0) - FEATURE_PROTO3_OPTIONAL = CodeGeneratorResponse.Feature.V(1) + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _FeatureEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[CodeGeneratorResponse._Feature.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + FEATURE_NONE: CodeGeneratorResponse._Feature.ValueType # 0 + FEATURE_PROTO3_OPTIONAL: CodeGeneratorResponse._Feature.ValueType # 1 + + class Feature(_Feature, metaclass=_FeatureEnumTypeWrapper): + """Sync with code_generator.h.""" - FEATURE_NONE = CodeGeneratorResponse.Feature.V(0) - FEATURE_PROTO3_OPTIONAL = CodeGeneratorResponse.Feature.V(1) + FEATURE_NONE: CodeGeneratorResponse.Feature.ValueType # 0 + FEATURE_PROTO3_OPTIONAL: CodeGeneratorResponse.Feature.ValueType # 1 - # Represents a single generated file. + @typing_extensions.final class File(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Represents a single generated file.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int INSERTION_POINT_FIELD_NUMBER: builtins.int CONTENT_FIELD_NUMBER: builtins.int GENERATED_CODE_INFO_FIELD_NUMBER: builtins.int - # The file name, relative to the output directory. The name must not - # contain "." or ".." components and must be relative, not be absolute (so, - # the file cannot lie outside the output directory). "/" must be used as - # the path separator, not "\". - # - # If the name is omitted, the content will be appended to the previous - # file. This allows the generator to break large files into small chunks, - # and allows the generated text to be streamed back to protoc so that large - # files need not reside completely in memory at one time. Note that as of - # this writing protoc does not optimize for this -- it will read the entire - # CodeGeneratorResponse before writing files to disk. - name: typing.Text = ... - # If non-empty, indicates that the named file should already exist, and the - # content here is to be inserted into that file at a defined insertion - # point. This feature allows a code generator to extend the output - # produced by another code generator. The original generator may provide - # insertion points by placing special annotations in the file that look - # like: - # @@protoc_insertion_point(NAME) - # The annotation can have arbitrary text before and after it on the line, - # which allows it to be placed in a comment. NAME should be replaced with - # an identifier naming the point -- this is what other generators will use - # as the insertion_point. Code inserted at this point will be placed - # immediately above the line containing the insertion point (thus multiple - # insertions to the same point will come out in the order they were added). - # The double-@ is intended to make it unlikely that the generated code - # could contain things that look like insertion points by accident. - # - # For example, the C++ code generator places the following line in the - # .pb.h files that it generates: - # // @@protoc_insertion_point(namespace_scope) - # This line appears within the scope of the file's package namespace, but - # outside of any particular class. Another plugin can then specify the - # insertion_point "namespace_scope" to generate additional classes or - # other declarations that should be placed in this scope. - # - # Note that if the line containing the insertion point begins with - # whitespace, the same whitespace will be added to every line of the - # inserted text. This is useful for languages like Python, where - # indentation matters. In these languages, the insertion point comment - # should be indented the same amount as any inserted code will need to be - # in order to work correctly in that context. - # - # The code generator that generates the initial file and the one which - # inserts into it must both run as part of a single invocation of protoc. - # Code generators are executed in the order in which they appear on the - # command line. - # - # If |insertion_point| is present, |name| must also be present. - insertion_point: typing.Text = ... - # The file contents. - content: typing.Text = ... - # Information describing the file content being inserted. If an insertion - # point is used, this information will be appropriately offset and inserted - # into the code generation metadata for the generated files. + name: builtins.str + """The file name, relative to the output directory. The name must not + contain "." or ".." components and must be relative, not be absolute (so, + the file cannot lie outside the output directory). "/" must be used as + the path separator, not "\\". + + If the name is omitted, the content will be appended to the previous + file. This allows the generator to break large files into small chunks, + and allows the generated text to be streamed back to protoc so that large + files need not reside completely in memory at one time. Note that as of + this writing protoc does not optimize for this -- it will read the entire + CodeGeneratorResponse before writing files to disk. + """ + insertion_point: builtins.str + """If non-empty, indicates that the named file should already exist, and the + content here is to be inserted into that file at a defined insertion + point. This feature allows a code generator to extend the output + produced by another code generator. The original generator may provide + insertion points by placing special annotations in the file that look + like: + @@protoc_insertion_point(NAME) + The annotation can have arbitrary text before and after it on the line, + which allows it to be placed in a comment. NAME should be replaced with + an identifier naming the point -- this is what other generators will use + as the insertion_point. Code inserted at this point will be placed + immediately above the line containing the insertion point (thus multiple + insertions to the same point will come out in the order they were added). + The double-@ is intended to make it unlikely that the generated code + could contain things that look like insertion points by accident. + + For example, the C++ code generator places the following line in the + .pb.h files that it generates: + // @@protoc_insertion_point(namespace_scope) + This line appears within the scope of the file's package namespace, but + outside of any particular class. Another plugin can then specify the + insertion_point "namespace_scope" to generate additional classes or + other declarations that should be placed in this scope. + + Note that if the line containing the insertion point begins with + whitespace, the same whitespace will be added to every line of the + inserted text. This is useful for languages like Python, where + indentation matters. In these languages, the insertion point comment + should be indented the same amount as any inserted code will need to be + in order to work correctly in that context. + + The code generator that generates the initial file and the one which + inserts into it must both run as part of a single invocation of protoc. + Code generators are executed in the order in which they appear on the + command line. + + If |insertion_point| is present, |name| must also be present. + """ + content: builtins.str + """The file contents.""" @property - def generated_code_info(self) -> google.protobuf.descriptor_pb2.GeneratedCodeInfo: ... - def __init__(self, + def generated_code_info(self) -> google.protobuf.descriptor_pb2.GeneratedCodeInfo: + """Information describing the file content being inserted. If an insertion + point is used, this information will be appropriately offset and inserted + into the code generation metadata for the generated files. + """ + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - insertion_point : typing.Optional[typing.Text] = ..., - content : typing.Optional[typing.Text] = ..., - generated_code_info : typing.Optional[google.protobuf.descriptor_pb2.GeneratedCodeInfo] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"content",b"content",u"generated_code_info",b"generated_code_info",u"insertion_point",b"insertion_point",u"name",b"name"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"content",b"content",u"generated_code_info",b"generated_code_info",u"insertion_point",b"insertion_point",u"name",b"name"]) -> None: ... + name: builtins.str | None = ..., + insertion_point: builtins.str | None = ..., + content: builtins.str | None = ..., + generated_code_info: google.protobuf.descriptor_pb2.GeneratedCodeInfo | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["content", b"content", "generated_code_info", b"generated_code_info", "insertion_point", b"insertion_point", "name", b"name"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["content", b"content", "generated_code_info", b"generated_code_info", "insertion_point", b"insertion_point", "name", b"name"]) -> None: ... ERROR_FIELD_NUMBER: builtins.int SUPPORTED_FEATURES_FIELD_NUMBER: builtins.int FILE_FIELD_NUMBER: builtins.int - # Error message. If non-empty, code generation failed. The plugin process - # should exit with status code zero even if it reports an error in this way. - # - # This should be used to indicate errors in .proto files which prevent the - # code generator from generating correct code. Errors which indicate a - # problem in protoc itself -- such as the input CodeGeneratorRequest being - # unparseable -- should be reported by writing a message to stderr and - # exiting with a non-zero status code. - error: typing.Text = ... - # A bitmask of supported features that the code generator supports. - # This is a bitwise "or" of values from the Feature enum. - supported_features: builtins.int = ... + error: builtins.str + """Error message. If non-empty, code generation failed. The plugin process + should exit with status code zero even if it reports an error in this way. + + This should be used to indicate errors in .proto files which prevent the + code generator from generating correct code. Errors which indicate a + problem in protoc itself -- such as the input CodeGeneratorRequest being + unparseable -- should be reported by writing a message to stderr and + exiting with a non-zero status code. + """ + supported_features: builtins.int + """A bitmask of supported features that the code generator supports. + This is a bitwise "or" of values from the Feature enum. + """ @property def file(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___CodeGeneratorResponse.File]: ... - def __init__(self, + def __init__( + self, *, - error : typing.Optional[typing.Text] = ..., - supported_features : typing.Optional[builtins.int] = ..., - file : typing.Optional[typing.Iterable[global___CodeGeneratorResponse.File]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"error",b"error",u"supported_features",b"supported_features"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"error",b"error",u"file",b"file",u"supported_features",b"supported_features"]) -> None: ... + error: builtins.str | None = ..., + supported_features: builtins.int | None = ..., + file: collections.abc.Iterable[global___CodeGeneratorResponse.File] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["error", b"error", "supported_features", b"supported_features"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["error", b"error", "file", b"file", "supported_features", b"supported_features"]) -> None: ... + global___CodeGeneratorResponse = CodeGeneratorResponse diff --git a/stubs/protobuf/google/protobuf/descriptor.pyi b/stubs/protobuf/google/protobuf/descriptor.pyi index f79fa77..6b2ee31 100644 --- a/stubs/protobuf/google/protobuf/descriptor.pyi +++ b/stubs/protobuf/google/protobuf/descriptor.pyi @@ -42,31 +42,9 @@ class _NestedDescriptorBase(DescriptorBase): serialized_end=..., serialized_options=..., ) -> None: ... - def GetTopLevelContainingType(self): ... def CopyToProto(self, proto): ... class Descriptor(_NestedDescriptorBase): - def __new__( - cls, - name, - full_name, - filename, - containing_type, - fields, - nested_types, - enum_types, - extensions, - options=..., - serialized_options=..., - is_extendable=..., - extension_ranges=..., - oneofs=..., - file=..., - serialized_start=..., - serialized_end=..., - syntax=..., - create_key=..., - ): ... fields: Any fields_by_number: Any fields_by_name: Any @@ -84,25 +62,25 @@ class Descriptor(_NestedDescriptorBase): syntax: Any def __init__( self, - name, - full_name, - filename, - containing_type, - fields, - nested_types, - enum_types, - extensions, - options=..., - serialized_options=..., - is_extendable=..., - extension_ranges=..., - oneofs=..., - file=..., - serialized_start=..., - serialized_end=..., - syntax=..., - create_key=..., - ) -> None: ... + name: str, + full_name: str, + filename: Any, + containing_type: Descriptor | None, + fields: list[FieldDescriptor], + nested_types: list[FieldDescriptor], + enum_types: list[EnumDescriptor], + extensions: list[FieldDescriptor], + options: Any | None = ..., + serialized_options: Any | None = ..., + is_extendable: bool | None = ..., + extension_ranges: Any | None = ..., + oneofs: list[OneofDescriptor] | None = ..., + file: FileDescriptor | None = ..., + serialized_start: Any | None = ..., + serialized_end: Any | None = ..., + syntax: str | None = ..., + create_key: Any | None = ..., + ): ... def EnumValueName(self, enum, value): ... def CopyToProto(self, proto): ... def GetOptions(self) -> MessageOptions: ... @@ -162,9 +140,10 @@ class FieldDescriptor(DescriptorBase): extension_scope, options=..., serialized_options=..., - file=..., has_default_value=..., containing_oneof=..., + json_name=..., + file=..., create_key=..., ): ... name: Any @@ -199,9 +178,10 @@ class FieldDescriptor(DescriptorBase): extension_scope, options=..., serialized_options=..., - file=..., has_default_value=..., containing_oneof=..., + json_name=..., + file=..., create_key=..., ) -> None: ... @staticmethod @@ -265,35 +245,22 @@ class OneofDescriptor: def GetOptions(self) -> OneofOptions: ... class ServiceDescriptor(_NestedDescriptorBase): - def __new__( - cls, - name, - full_name, - index, - methods, - options=..., - serialized_options=..., - file=..., - serialized_start=..., - serialized_end=..., - create_key=..., - ): ... index: Any methods: Any methods_by_name: Any def __init__( self, - name, - full_name, - index, - methods, - options=..., - serialized_options=..., - file=..., - serialized_start=..., - serialized_end=..., - create_key=..., - ) -> None: ... + name: str, + full_name: str, + index: int, + methods: list[MethodDescriptor], + options: ServiceOptions | None = ..., + serialized_options: Any | None = ..., + file: FileDescriptor | None = ..., + serialized_start: Any | None = ..., + serialized_end: Any | None = ..., + create_key: Any | None = ..., + ): ... def FindMethodByName(self, name): ... def CopyToProto(self, proto): ... def GetOptions(self) -> ServiceOptions: ... @@ -307,6 +274,8 @@ class MethodDescriptor(DescriptorBase): containing_service, input_type, output_type, + client_streaming=..., + server_streaming=..., options=..., serialized_options=..., create_key=..., @@ -317,6 +286,8 @@ class MethodDescriptor(DescriptorBase): containing_service: Any input_type: Any output_type: Any + client_streaming: bool + server_streaming: bool def __init__( self, name, @@ -325,6 +296,8 @@ class MethodDescriptor(DescriptorBase): containing_service, input_type, output_type, + client_streaming=..., + server_streaming=..., options=..., serialized_options=..., create_key=..., diff --git a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi index 2a8a5b1..e37479b 100644 --- a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +++ b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi @@ -1,34 +1,56 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Author: kenton@google.com (Kenton Varda) + Based on original Protocol Buffers design by + Sanjay Ghemawat, Jeff Dean, and others. + +The messages in this file describe the definitions found in .proto files. +A valid .proto file can be translated directly to a FileDescriptorProto +without any other information (e.g. without reading its imports). """ import builtins +import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.message +import sys import typing -import typing_extensions -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -# The protocol compiler can output a FileDescriptorSet containing the .proto -# files it parses. +@typing_extensions.final class FileDescriptorSet(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """The protocol compiler can output a FileDescriptorSet containing the .proto + files it parses. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + FILE_FIELD_NUMBER: builtins.int @property def file(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___FileDescriptorProto]: ... - def __init__(self, + def __init__( + self, *, - file : typing.Optional[typing.Iterable[global___FileDescriptorProto]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"file",b"file"]) -> None: ... + file: collections.abc.Iterable[global___FileDescriptorProto] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["file", b"file"]) -> None: ... + global___FileDescriptorSet = FileDescriptorSet -# Describes a complete .proto file. +@typing_extensions.final class FileDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes a complete .proto file.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int PACKAGE_FIELD_NUMBER: builtins.int DEPENDENCY_FIELD_NUMBER: builtins.int @@ -41,23 +63,24 @@ class FileDescriptorProto(google.protobuf.message.Message): OPTIONS_FIELD_NUMBER: builtins.int SOURCE_CODE_INFO_FIELD_NUMBER: builtins.int SYNTAX_FIELD_NUMBER: builtins.int - # file name, relative to root of source tree - name: typing.Text = ... - # e.g. "foo", "foo.bar", etc. - package: typing.Text = ... - # Names of files imported by this file. + name: builtins.str + """file name, relative to root of source tree""" + package: builtins.str + """e.g. "foo", "foo.bar", etc.""" @property - def dependency(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - # Indexes of the public imported files in the dependency list above. + def dependency(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: + """Names of files imported by this file.""" @property - def public_dependency(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... - # Indexes of the weak imported files in the dependency list. - # For Google-internal migration only. Do not use. + def public_dependency(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """Indexes of the public imported files in the dependency list above.""" @property - def weak_dependency(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... - # All top-level definitions in this file. + def weak_dependency(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """Indexes of the weak imported files in the dependency list. + For Google-internal migration only. Do not use. + """ @property - def message_type(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___DescriptorProto]: ... + def message_type(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___DescriptorProto]: + """All top-level definitions in this file.""" @property def enum_type(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnumDescriptorProto]: ... @property @@ -66,75 +89,90 @@ class FileDescriptorProto(google.protobuf.message.Message): def extension(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___FieldDescriptorProto]: ... @property def options(self) -> global___FileOptions: ... - # This field contains optional information about the original source code. - # You may safely remove this entire field without harming runtime - # functionality of the descriptors -- the information is needed only by - # development tools. @property - def source_code_info(self) -> global___SourceCodeInfo: ... - # The syntax of the proto file. - # The supported values are "proto2" and "proto3". - syntax: typing.Text = ... - def __init__(self, + def source_code_info(self) -> global___SourceCodeInfo: + """This field contains optional information about the original source code. + You may safely remove this entire field without harming runtime + functionality of the descriptors -- the information is needed only by + development tools. + """ + syntax: builtins.str + """The syntax of the proto file. + The supported values are "proto2" and "proto3". + """ + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - package : typing.Optional[typing.Text] = ..., - dependency : typing.Optional[typing.Iterable[typing.Text]] = ..., - public_dependency : typing.Optional[typing.Iterable[builtins.int]] = ..., - weak_dependency : typing.Optional[typing.Iterable[builtins.int]] = ..., - message_type : typing.Optional[typing.Iterable[global___DescriptorProto]] = ..., - enum_type : typing.Optional[typing.Iterable[global___EnumDescriptorProto]] = ..., - service : typing.Optional[typing.Iterable[global___ServiceDescriptorProto]] = ..., - extension : typing.Optional[typing.Iterable[global___FieldDescriptorProto]] = ..., - options : typing.Optional[global___FileOptions] = ..., - source_code_info : typing.Optional[global___SourceCodeInfo] = ..., - syntax : typing.Optional[typing.Text] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options",u"package",b"package",u"source_code_info",b"source_code_info",u"syntax",b"syntax"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"dependency",b"dependency",u"enum_type",b"enum_type",u"extension",b"extension",u"message_type",b"message_type",u"name",b"name",u"options",b"options",u"package",b"package",u"public_dependency",b"public_dependency",u"service",b"service",u"source_code_info",b"source_code_info",u"syntax",b"syntax",u"weak_dependency",b"weak_dependency"]) -> None: ... + name: builtins.str | None = ..., + package: builtins.str | None = ..., + dependency: collections.abc.Iterable[builtins.str] | None = ..., + public_dependency: collections.abc.Iterable[builtins.int] | None = ..., + weak_dependency: collections.abc.Iterable[builtins.int] | None = ..., + message_type: collections.abc.Iterable[global___DescriptorProto] | None = ..., + enum_type: collections.abc.Iterable[global___EnumDescriptorProto] | None = ..., + service: collections.abc.Iterable[global___ServiceDescriptorProto] | None = ..., + extension: collections.abc.Iterable[global___FieldDescriptorProto] | None = ..., + options: global___FileOptions | None = ..., + source_code_info: global___SourceCodeInfo | None = ..., + syntax: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options", "package", b"package", "source_code_info", b"source_code_info", "syntax", b"syntax"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["dependency", b"dependency", "enum_type", b"enum_type", "extension", b"extension", "message_type", b"message_type", "name", b"name", "options", b"options", "package", b"package", "public_dependency", b"public_dependency", "service", b"service", "source_code_info", b"source_code_info", "syntax", b"syntax", "weak_dependency", b"weak_dependency"]) -> None: ... + global___FileDescriptorProto = FileDescriptorProto -# Describes a message type. +@typing_extensions.final class DescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes a message type.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + @typing_extensions.final class ExtensionRange(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + START_FIELD_NUMBER: builtins.int END_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int - # Inclusive. - start: builtins.int = ... - # Exclusive. - end: builtins.int = ... + start: builtins.int + """Inclusive.""" + end: builtins.int + """Exclusive.""" @property def options(self) -> global___ExtensionRangeOptions: ... - def __init__(self, + def __init__( + self, *, - start : typing.Optional[builtins.int] = ..., - end : typing.Optional[builtins.int] = ..., - options : typing.Optional[global___ExtensionRangeOptions] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"end",b"end",u"options",b"options",u"start",b"start"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"end",b"end",u"options",b"options",u"start",b"start"]) -> None: ... - - # Range of reserved tag numbers. Reserved tag numbers may not be used by - # fields or extension ranges in the same message. Reserved ranges may - # not overlap. + start: builtins.int | None = ..., + end: builtins.int | None = ..., + options: global___ExtensionRangeOptions | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["end", b"end", "options", b"options", "start", b"start"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["end", b"end", "options", b"options", "start", b"start"]) -> None: ... + + @typing_extensions.final class ReservedRange(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Range of reserved tag numbers. Reserved tag numbers may not be used by + fields or extension ranges in the same message. Reserved ranges may + not overlap. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + START_FIELD_NUMBER: builtins.int END_FIELD_NUMBER: builtins.int - # Inclusive. - start: builtins.int = ... - # Exclusive. - end: builtins.int = ... - def __init__(self, + start: builtins.int + """Inclusive.""" + end: builtins.int + """Exclusive.""" + def __init__( + self, *, - start : typing.Optional[builtins.int] = ..., - end : typing.Optional[builtins.int] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"end",b"end",u"start",b"start"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"end",b"end",u"start",b"start"]) -> None: ... + start: builtins.int | None = ..., + end: builtins.int | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["end", b"end", "start", b"start"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["end", b"end", "start", b"start"]) -> None: ... NAME_FIELD_NUMBER: builtins.int FIELD_FIELD_NUMBER: builtins.int @@ -146,7 +184,7 @@ class DescriptorProto(google.protobuf.message.Message): OPTIONS_FIELD_NUMBER: builtins.int RESERVED_RANGE_FIELD_NUMBER: builtins.int RESERVED_NAME_FIELD_NUMBER: builtins.int - name: typing.Text = ... + name: builtins.str @property def field(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___FieldDescriptorProto]: ... @property @@ -163,130 +201,150 @@ class DescriptorProto(google.protobuf.message.Message): def options(self) -> global___MessageOptions: ... @property def reserved_range(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___DescriptorProto.ReservedRange]: ... - # Reserved field names, which may not be used by fields in the same message. - # A given name may only be reserved once. @property - def reserved_name(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - def __init__(self, + def reserved_name(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: + """Reserved field names, which may not be used by fields in the same message. + A given name may only be reserved once. + """ + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - field : typing.Optional[typing.Iterable[global___FieldDescriptorProto]] = ..., - extension : typing.Optional[typing.Iterable[global___FieldDescriptorProto]] = ..., - nested_type : typing.Optional[typing.Iterable[global___DescriptorProto]] = ..., - enum_type : typing.Optional[typing.Iterable[global___EnumDescriptorProto]] = ..., - extension_range : typing.Optional[typing.Iterable[global___DescriptorProto.ExtensionRange]] = ..., - oneof_decl : typing.Optional[typing.Iterable[global___OneofDescriptorProto]] = ..., - options : typing.Optional[global___MessageOptions] = ..., - reserved_range : typing.Optional[typing.Iterable[global___DescriptorProto.ReservedRange]] = ..., - reserved_name : typing.Optional[typing.Iterable[typing.Text]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"enum_type",b"enum_type",u"extension",b"extension",u"extension_range",b"extension_range",u"field",b"field",u"name",b"name",u"nested_type",b"nested_type",u"oneof_decl",b"oneof_decl",u"options",b"options",u"reserved_name",b"reserved_name",u"reserved_range",b"reserved_range"]) -> None: ... + name: builtins.str | None = ..., + field: collections.abc.Iterable[global___FieldDescriptorProto] | None = ..., + extension: collections.abc.Iterable[global___FieldDescriptorProto] | None = ..., + nested_type: collections.abc.Iterable[global___DescriptorProto] | None = ..., + enum_type: collections.abc.Iterable[global___EnumDescriptorProto] | None = ..., + extension_range: collections.abc.Iterable[global___DescriptorProto.ExtensionRange] | None = ..., + oneof_decl: collections.abc.Iterable[global___OneofDescriptorProto] | None = ..., + options: global___MessageOptions | None = ..., + reserved_range: collections.abc.Iterable[global___DescriptorProto.ReservedRange] | None = ..., + reserved_name: collections.abc.Iterable[builtins.str] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["enum_type", b"enum_type", "extension", b"extension", "extension_range", b"extension_range", "field", b"field", "name", b"name", "nested_type", b"nested_type", "oneof_decl", b"oneof_decl", "options", b"options", "reserved_name", b"reserved_name", "reserved_range", b"reserved_range"]) -> None: ... + global___DescriptorProto = DescriptorProto +@typing_extensions.final class ExtensionRangeOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # The parser stores options it doesn't recognize here. See above. @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___ExtensionRangeOptions = ExtensionRangeOptions -# Describes a field within a message. +@typing_extensions.final class FieldDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class Type(_Type, metaclass=_TypeEnumTypeWrapper): - pass + """Describes a field within a message.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + class _Type: - V = typing.NewType('V', builtins.int) - class _TypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Type.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # 0 is reserved for errors. - # Order is weird for historical reasons. - TYPE_DOUBLE = FieldDescriptorProto.Type.V(1) - TYPE_FLOAT = FieldDescriptorProto.Type.V(2) - # Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - # negative values are likely. - TYPE_INT64 = FieldDescriptorProto.Type.V(3) - TYPE_UINT64 = FieldDescriptorProto.Type.V(4) - # Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - # negative values are likely. - TYPE_INT32 = FieldDescriptorProto.Type.V(5) - TYPE_FIXED64 = FieldDescriptorProto.Type.V(6) - TYPE_FIXED32 = FieldDescriptorProto.Type.V(7) - TYPE_BOOL = FieldDescriptorProto.Type.V(8) - TYPE_STRING = FieldDescriptorProto.Type.V(9) - # Tag-delimited aggregate. - # Group type is deprecated and not supported in proto3. However, Proto3 - # implementations should still be able to parse the group wire format and - # treat group fields as unknown fields. - TYPE_GROUP = FieldDescriptorProto.Type.V(10) - # Length-delimited aggregate. - TYPE_MESSAGE = FieldDescriptorProto.Type.V(11) - # New in version 2. - TYPE_BYTES = FieldDescriptorProto.Type.V(12) - TYPE_UINT32 = FieldDescriptorProto.Type.V(13) - TYPE_ENUM = FieldDescriptorProto.Type.V(14) - TYPE_SFIXED32 = FieldDescriptorProto.Type.V(15) - TYPE_SFIXED64 = FieldDescriptorProto.Type.V(16) - # Uses ZigZag encoding. - TYPE_SINT32 = FieldDescriptorProto.Type.V(17) - # Uses ZigZag encoding. - TYPE_SINT64 = FieldDescriptorProto.Type.V(18) - - # 0 is reserved for errors. - # Order is weird for historical reasons. - TYPE_DOUBLE = FieldDescriptorProto.Type.V(1) - TYPE_FLOAT = FieldDescriptorProto.Type.V(2) - # Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - # negative values are likely. - TYPE_INT64 = FieldDescriptorProto.Type.V(3) - TYPE_UINT64 = FieldDescriptorProto.Type.V(4) - # Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - # negative values are likely. - TYPE_INT32 = FieldDescriptorProto.Type.V(5) - TYPE_FIXED64 = FieldDescriptorProto.Type.V(6) - TYPE_FIXED32 = FieldDescriptorProto.Type.V(7) - TYPE_BOOL = FieldDescriptorProto.Type.V(8) - TYPE_STRING = FieldDescriptorProto.Type.V(9) - # Tag-delimited aggregate. - # Group type is deprecated and not supported in proto3. However, Proto3 - # implementations should still be able to parse the group wire format and - # treat group fields as unknown fields. - TYPE_GROUP = FieldDescriptorProto.Type.V(10) - # Length-delimited aggregate. - TYPE_MESSAGE = FieldDescriptorProto.Type.V(11) - # New in version 2. - TYPE_BYTES = FieldDescriptorProto.Type.V(12) - TYPE_UINT32 = FieldDescriptorProto.Type.V(13) - TYPE_ENUM = FieldDescriptorProto.Type.V(14) - TYPE_SFIXED32 = FieldDescriptorProto.Type.V(15) - TYPE_SFIXED64 = FieldDescriptorProto.Type.V(16) - # Uses ZigZag encoding. - TYPE_SINT32 = FieldDescriptorProto.Type.V(17) - # Uses ZigZag encoding. - TYPE_SINT64 = FieldDescriptorProto.Type.V(18) - - class Label(_Label, metaclass=_LabelEnumTypeWrapper): - pass + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _TypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[FieldDescriptorProto._Type.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + TYPE_DOUBLE: FieldDescriptorProto._Type.ValueType # 1 + """0 is reserved for errors. + Order is weird for historical reasons. + """ + TYPE_FLOAT: FieldDescriptorProto._Type.ValueType # 2 + TYPE_INT64: FieldDescriptorProto._Type.ValueType # 3 + """Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + negative values are likely. + """ + TYPE_UINT64: FieldDescriptorProto._Type.ValueType # 4 + TYPE_INT32: FieldDescriptorProto._Type.ValueType # 5 + """Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + negative values are likely. + """ + TYPE_FIXED64: FieldDescriptorProto._Type.ValueType # 6 + TYPE_FIXED32: FieldDescriptorProto._Type.ValueType # 7 + TYPE_BOOL: FieldDescriptorProto._Type.ValueType # 8 + TYPE_STRING: FieldDescriptorProto._Type.ValueType # 9 + TYPE_GROUP: FieldDescriptorProto._Type.ValueType # 10 + """Tag-delimited aggregate. + Group type is deprecated and not supported in proto3. However, Proto3 + implementations should still be able to parse the group wire format and + treat group fields as unknown fields. + """ + TYPE_MESSAGE: FieldDescriptorProto._Type.ValueType # 11 + """Length-delimited aggregate.""" + TYPE_BYTES: FieldDescriptorProto._Type.ValueType # 12 + """New in version 2.""" + TYPE_UINT32: FieldDescriptorProto._Type.ValueType # 13 + TYPE_ENUM: FieldDescriptorProto._Type.ValueType # 14 + TYPE_SFIXED32: FieldDescriptorProto._Type.ValueType # 15 + TYPE_SFIXED64: FieldDescriptorProto._Type.ValueType # 16 + TYPE_SINT32: FieldDescriptorProto._Type.ValueType # 17 + """Uses ZigZag encoding.""" + TYPE_SINT64: FieldDescriptorProto._Type.ValueType # 18 + """Uses ZigZag encoding.""" + + class Type(_Type, metaclass=_TypeEnumTypeWrapper): ... + TYPE_DOUBLE: FieldDescriptorProto.Type.ValueType # 1 + """0 is reserved for errors. + Order is weird for historical reasons. + """ + TYPE_FLOAT: FieldDescriptorProto.Type.ValueType # 2 + TYPE_INT64: FieldDescriptorProto.Type.ValueType # 3 + """Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + negative values are likely. + """ + TYPE_UINT64: FieldDescriptorProto.Type.ValueType # 4 + TYPE_INT32: FieldDescriptorProto.Type.ValueType # 5 + """Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + negative values are likely. + """ + TYPE_FIXED64: FieldDescriptorProto.Type.ValueType # 6 + TYPE_FIXED32: FieldDescriptorProto.Type.ValueType # 7 + TYPE_BOOL: FieldDescriptorProto.Type.ValueType # 8 + TYPE_STRING: FieldDescriptorProto.Type.ValueType # 9 + TYPE_GROUP: FieldDescriptorProto.Type.ValueType # 10 + """Tag-delimited aggregate. + Group type is deprecated and not supported in proto3. However, Proto3 + implementations should still be able to parse the group wire format and + treat group fields as unknown fields. + """ + TYPE_MESSAGE: FieldDescriptorProto.Type.ValueType # 11 + """Length-delimited aggregate.""" + TYPE_BYTES: FieldDescriptorProto.Type.ValueType # 12 + """New in version 2.""" + TYPE_UINT32: FieldDescriptorProto.Type.ValueType # 13 + TYPE_ENUM: FieldDescriptorProto.Type.ValueType # 14 + TYPE_SFIXED32: FieldDescriptorProto.Type.ValueType # 15 + TYPE_SFIXED64: FieldDescriptorProto.Type.ValueType # 16 + TYPE_SINT32: FieldDescriptorProto.Type.ValueType # 17 + """Uses ZigZag encoding.""" + TYPE_SINT64: FieldDescriptorProto.Type.ValueType # 18 + """Uses ZigZag encoding.""" + class _Label: - V = typing.NewType('V', builtins.int) - class _LabelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Label.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # 0 is reserved for errors - LABEL_OPTIONAL = FieldDescriptorProto.Label.V(1) - LABEL_REQUIRED = FieldDescriptorProto.Label.V(2) - LABEL_REPEATED = FieldDescriptorProto.Label.V(3) - - # 0 is reserved for errors - LABEL_OPTIONAL = FieldDescriptorProto.Label.V(1) - LABEL_REQUIRED = FieldDescriptorProto.Label.V(2) - LABEL_REPEATED = FieldDescriptorProto.Label.V(3) + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _LabelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[FieldDescriptorProto._Label.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + LABEL_OPTIONAL: FieldDescriptorProto._Label.ValueType # 1 + """0 is reserved for errors""" + LABEL_REQUIRED: FieldDescriptorProto._Label.ValueType # 2 + LABEL_REPEATED: FieldDescriptorProto._Label.ValueType # 3 + + class Label(_Label, metaclass=_LabelEnumTypeWrapper): ... + LABEL_OPTIONAL: FieldDescriptorProto.Label.ValueType # 1 + """0 is reserved for errors""" + LABEL_REQUIRED: FieldDescriptorProto.Label.ValueType # 2 + LABEL_REPEATED: FieldDescriptorProto.Label.ValueType # 3 NAME_FIELD_NUMBER: builtins.int NUMBER_FIELD_NUMBER: builtins.int @@ -299,280 +357,325 @@ class FieldDescriptorProto(google.protobuf.message.Message): JSON_NAME_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int PROTO3_OPTIONAL_FIELD_NUMBER: builtins.int - name: typing.Text = ... - number: builtins.int = ... - label: global___FieldDescriptorProto.Label.V = ... - # If type_name is set, this need not be set. If both this and type_name - # are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - type: global___FieldDescriptorProto.Type.V = ... - # For message and enum types, this is the name of the type. If the name - # starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - # rules are used to find the type (i.e. first the nested types within this - # message are searched, then within the parent, on up to the root - # namespace). - type_name: typing.Text = ... - # For extensions, this is the name of the type being extended. It is - # resolved in the same manner as type_name. - extendee: typing.Text = ... - # For numeric types, contains the original text representation of the value. - # For booleans, "true" or "false". - # For strings, contains the default text contents (not escaped in any way). - # For bytes, contains the C escaped value. All bytes >= 128 are escaped. - # TODO(kenton): Base-64 encode? - default_value: typing.Text = ... - # If set, gives the index of a oneof in the containing type's oneof_decl - # list. This field is a member of that oneof. - oneof_index: builtins.int = ... - # JSON name of this field. The value is set by protocol compiler. If the - # user has set a "json_name" option on this field, that option's value - # will be used. Otherwise, it's deduced from the field's name by converting - # it to camelCase. - json_name: typing.Text = ... + name: builtins.str + number: builtins.int + label: global___FieldDescriptorProto.Label.ValueType + type: global___FieldDescriptorProto.Type.ValueType + """If type_name is set, this need not be set. If both this and type_name + are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + """ + type_name: builtins.str + """For message and enum types, this is the name of the type. If the name + starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + rules are used to find the type (i.e. first the nested types within this + message are searched, then within the parent, on up to the root + namespace). + """ + extendee: builtins.str + """For extensions, this is the name of the type being extended. It is + resolved in the same manner as type_name. + """ + default_value: builtins.str + """For numeric types, contains the original text representation of the value. + For booleans, "true" or "false". + For strings, contains the default text contents (not escaped in any way). + For bytes, contains the C escaped value. All bytes >= 128 are escaped. + """ + oneof_index: builtins.int + """If set, gives the index of a oneof in the containing type's oneof_decl + list. This field is a member of that oneof. + """ + json_name: builtins.str + """JSON name of this field. The value is set by protocol compiler. If the + user has set a "json_name" option on this field, that option's value + will be used. Otherwise, it's deduced from the field's name by converting + it to camelCase. + """ @property def options(self) -> global___FieldOptions: ... - # If true, this is a proto3 "optional". When a proto3 field is optional, it - # tracks presence regardless of field type. - # - # When proto3_optional is true, this field must be belong to a oneof to - # signal to old proto3 clients that presence is tracked for this field. This - # oneof is known as a "synthetic" oneof, and this field must be its sole - # member (each proto3 optional field gets its own synthetic oneof). Synthetic - # oneofs exist in the descriptor only, and do not generate any API. Synthetic - # oneofs must be ordered after all "real" oneofs. - # - # For message fields, proto3_optional doesn't create any semantic change, - # since non-repeated message fields always track presence. However it still - # indicates the semantic detail of whether the user wrote "optional" or not. - # This can be useful for round-tripping the .proto file. For consistency we - # give message fields a synthetic oneof also, even though it is not required - # to track presence. This is especially important because the parser can't - # tell if a field is a message or an enum, so it must always create a - # synthetic oneof. - # - # Proto2 optional fields do not set this flag, because they already indicate - # optional with `LABEL_OPTIONAL`. - proto3_optional: builtins.bool = ... - def __init__(self, + proto3_optional: builtins.bool + """If true, this is a proto3 "optional". When a proto3 field is optional, it + tracks presence regardless of field type. + + When proto3_optional is true, this field must be belong to a oneof to + signal to old proto3 clients that presence is tracked for this field. This + oneof is known as a "synthetic" oneof, and this field must be its sole + member (each proto3 optional field gets its own synthetic oneof). Synthetic + oneofs exist in the descriptor only, and do not generate any API. Synthetic + oneofs must be ordered after all "real" oneofs. + + For message fields, proto3_optional doesn't create any semantic change, + since non-repeated message fields always track presence. However it still + indicates the semantic detail of whether the user wrote "optional" or not. + This can be useful for round-tripping the .proto file. For consistency we + give message fields a synthetic oneof also, even though it is not required + to track presence. This is especially important because the parser can't + tell if a field is a message or an enum, so it must always create a + synthetic oneof. + + Proto2 optional fields do not set this flag, because they already indicate + optional with `LABEL_OPTIONAL`. + """ + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - number : typing.Optional[builtins.int] = ..., - label : typing.Optional[global___FieldDescriptorProto.Label.V] = ..., - type : typing.Optional[global___FieldDescriptorProto.Type.V] = ..., - type_name : typing.Optional[typing.Text] = ..., - extendee : typing.Optional[typing.Text] = ..., - default_value : typing.Optional[typing.Text] = ..., - oneof_index : typing.Optional[builtins.int] = ..., - json_name : typing.Optional[typing.Text] = ..., - options : typing.Optional[global___FieldOptions] = ..., - proto3_optional : typing.Optional[builtins.bool] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"default_value",b"default_value",u"extendee",b"extendee",u"json_name",b"json_name",u"label",b"label",u"name",b"name",u"number",b"number",u"oneof_index",b"oneof_index",u"options",b"options",u"proto3_optional",b"proto3_optional",u"type",b"type",u"type_name",b"type_name"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"default_value",b"default_value",u"extendee",b"extendee",u"json_name",b"json_name",u"label",b"label",u"name",b"name",u"number",b"number",u"oneof_index",b"oneof_index",u"options",b"options",u"proto3_optional",b"proto3_optional",u"type",b"type",u"type_name",b"type_name"]) -> None: ... + name: builtins.str | None = ..., + number: builtins.int | None = ..., + label: global___FieldDescriptorProto.Label.ValueType | None = ..., + type: global___FieldDescriptorProto.Type.ValueType | None = ..., + type_name: builtins.str | None = ..., + extendee: builtins.str | None = ..., + default_value: builtins.str | None = ..., + oneof_index: builtins.int | None = ..., + json_name: builtins.str | None = ..., + options: global___FieldOptions | None = ..., + proto3_optional: builtins.bool | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["default_value", b"default_value", "extendee", b"extendee", "json_name", b"json_name", "label", b"label", "name", b"name", "number", b"number", "oneof_index", b"oneof_index", "options", b"options", "proto3_optional", b"proto3_optional", "type", b"type", "type_name", b"type_name"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["default_value", b"default_value", "extendee", b"extendee", "json_name", b"json_name", "label", b"label", "name", b"name", "number", b"number", "oneof_index", b"oneof_index", "options", b"options", "proto3_optional", b"proto3_optional", "type", b"type", "type_name", b"type_name"]) -> None: ... + global___FieldDescriptorProto = FieldDescriptorProto -# Describes a oneof. +@typing_extensions.final class OneofDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes a oneof.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int - name: typing.Text = ... + name: builtins.str @property def options(self) -> global___OneofOptions: ... - def __init__(self, + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - options : typing.Optional[global___OneofOptions] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options"]) -> None: ... + name: builtins.str | None = ..., + options: global___OneofOptions | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options"]) -> None: ... + global___OneofDescriptorProto = OneofDescriptorProto -# Describes an enum type. +@typing_extensions.final class EnumDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - # Range of reserved numeric values. Reserved values may not be used by - # entries in the same enum. Reserved ranges may not overlap. - # - # Note that this is distinct from DescriptorProto.ReservedRange in that it - # is inclusive such that it can appropriately represent the entire int32 - # domain. + """Describes an enum type.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + @typing_extensions.final class EnumReservedRange(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Range of reserved numeric values. Reserved values may not be used by + entries in the same enum. Reserved ranges may not overlap. + + Note that this is distinct from DescriptorProto.ReservedRange in that it + is inclusive such that it can appropriately represent the entire int32 + domain. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + START_FIELD_NUMBER: builtins.int END_FIELD_NUMBER: builtins.int - # Inclusive. - start: builtins.int = ... - # Inclusive. - end: builtins.int = ... - def __init__(self, + start: builtins.int + """Inclusive.""" + end: builtins.int + """Inclusive.""" + def __init__( + self, *, - start : typing.Optional[builtins.int] = ..., - end : typing.Optional[builtins.int] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"end",b"end",u"start",b"start"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"end",b"end",u"start",b"start"]) -> None: ... + start: builtins.int | None = ..., + end: builtins.int | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["end", b"end", "start", b"start"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["end", b"end", "start", b"start"]) -> None: ... NAME_FIELD_NUMBER: builtins.int VALUE_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int RESERVED_RANGE_FIELD_NUMBER: builtins.int RESERVED_NAME_FIELD_NUMBER: builtins.int - name: typing.Text = ... + name: builtins.str @property def value(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnumValueDescriptorProto]: ... @property def options(self) -> global___EnumOptions: ... - # Range of reserved numeric values. Reserved numeric values may not be used - # by enum values in the same enum declaration. Reserved ranges may not - # overlap. @property - def reserved_range(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnumDescriptorProto.EnumReservedRange]: ... - # Reserved enum value names, which may not be reused. A given name may only - # be reserved once. + def reserved_range(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnumDescriptorProto.EnumReservedRange]: + """Range of reserved numeric values. Reserved numeric values may not be used + by enum values in the same enum declaration. Reserved ranges may not + overlap. + """ @property - def reserved_name(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - def __init__(self, + def reserved_name(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: + """Reserved enum value names, which may not be reused. A given name may only + be reserved once. + """ + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - value : typing.Optional[typing.Iterable[global___EnumValueDescriptorProto]] = ..., - options : typing.Optional[global___EnumOptions] = ..., - reserved_range : typing.Optional[typing.Iterable[global___EnumDescriptorProto.EnumReservedRange]] = ..., - reserved_name : typing.Optional[typing.Iterable[typing.Text]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options",u"reserved_name",b"reserved_name",u"reserved_range",b"reserved_range",u"value",b"value"]) -> None: ... + name: builtins.str | None = ..., + value: collections.abc.Iterable[global___EnumValueDescriptorProto] | None = ..., + options: global___EnumOptions | None = ..., + reserved_range: collections.abc.Iterable[global___EnumDescriptorProto.EnumReservedRange] | None = ..., + reserved_name: collections.abc.Iterable[builtins.str] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options", "reserved_name", b"reserved_name", "reserved_range", b"reserved_range", "value", b"value"]) -> None: ... + global___EnumDescriptorProto = EnumDescriptorProto -# Describes a value within an enum. +@typing_extensions.final class EnumValueDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes a value within an enum.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int NUMBER_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int - name: typing.Text = ... - number: builtins.int = ... + name: builtins.str + number: builtins.int @property def options(self) -> global___EnumValueOptions: ... - def __init__(self, + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - number : typing.Optional[builtins.int] = ..., - options : typing.Optional[global___EnumValueOptions] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"name",b"name",u"number",b"number",u"options",b"options"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"number",b"number",u"options",b"options"]) -> None: ... + name: builtins.str | None = ..., + number: builtins.int | None = ..., + options: global___EnumValueOptions | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["name", b"name", "number", b"number", "options", b"options"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "number", b"number", "options", b"options"]) -> None: ... + global___EnumValueDescriptorProto = EnumValueDescriptorProto -# Describes a service. +@typing_extensions.final class ServiceDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes a service.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int METHOD_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int - name: typing.Text = ... + name: builtins.str @property def method(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MethodDescriptorProto]: ... @property def options(self) -> global___ServiceOptions: ... - def __init__(self, + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - method : typing.Optional[typing.Iterable[global___MethodDescriptorProto]] = ..., - options : typing.Optional[global___ServiceOptions] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"method",b"method",u"name",b"name",u"options",b"options"]) -> None: ... + name: builtins.str | None = ..., + method: collections.abc.Iterable[global___MethodDescriptorProto] | None = ..., + options: global___ServiceOptions | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["name", b"name", "options", b"options"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["method", b"method", "name", b"name", "options", b"options"]) -> None: ... + global___ServiceDescriptorProto = ServiceDescriptorProto -# Describes a method of a service. +@typing_extensions.final class MethodDescriptorProto(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes a method of a service.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int INPUT_TYPE_FIELD_NUMBER: builtins.int OUTPUT_TYPE_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int CLIENT_STREAMING_FIELD_NUMBER: builtins.int SERVER_STREAMING_FIELD_NUMBER: builtins.int - name: typing.Text = ... - # Input and output type names. These are resolved in the same way as - # FieldDescriptorProto.type_name, but must refer to a message type. - input_type: typing.Text = ... - output_type: typing.Text = ... + name: builtins.str + input_type: builtins.str + """Input and output type names. These are resolved in the same way as + FieldDescriptorProto.type_name, but must refer to a message type. + """ + output_type: builtins.str @property def options(self) -> global___MethodOptions: ... - # Identifies if client streams multiple client messages - client_streaming: builtins.bool = ... - # Identifies if server streams multiple server messages - server_streaming: builtins.bool = ... - def __init__(self, + client_streaming: builtins.bool + """Identifies if client streams multiple client messages""" + server_streaming: builtins.bool + """Identifies if server streams multiple server messages""" + def __init__( + self, *, - name : typing.Optional[typing.Text] = ..., - input_type : typing.Optional[typing.Text] = ..., - output_type : typing.Optional[typing.Text] = ..., - options : typing.Optional[global___MethodOptions] = ..., - client_streaming : typing.Optional[builtins.bool] = ..., - server_streaming : typing.Optional[builtins.bool] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"client_streaming",b"client_streaming",u"input_type",b"input_type",u"name",b"name",u"options",b"options",u"output_type",b"output_type",u"server_streaming",b"server_streaming"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"client_streaming",b"client_streaming",u"input_type",b"input_type",u"name",b"name",u"options",b"options",u"output_type",b"output_type",u"server_streaming",b"server_streaming"]) -> None: ... -global___MethodDescriptorProto = MethodDescriptorProto + name: builtins.str | None = ..., + input_type: builtins.str | None = ..., + output_type: builtins.str | None = ..., + options: global___MethodOptions | None = ..., + client_streaming: builtins.bool | None = ..., + server_streaming: builtins.bool | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["client_streaming", b"client_streaming", "input_type", b"input_type", "name", b"name", "options", b"options", "output_type", b"output_type", "server_streaming", b"server_streaming"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["client_streaming", b"client_streaming", "input_type", b"input_type", "name", b"name", "options", b"options", "output_type", b"output_type", "server_streaming", b"server_streaming"]) -> None: ... -# =================================================================== -# Options - -# Each of the definitions above may have "options" attached. These are -# just annotations which may cause code to be generated slightly differently -# or may contain hints for code that manipulates protocol messages. -# -# Clients may define custom options as extensions of the *Options messages. -# These extensions may not yet be known at parsing time, so the parser cannot -# store the values in them. Instead it stores them in a field in the *Options -# message called uninterpreted_option. This field must have the same name -# across all *Options messages. We then use this field to populate the -# extensions when we build a descriptor, at which point all protos have been -# parsed and so all extensions are known. -# -# Extension numbers for custom options may be chosen as follows: -# * For options which will only be used within a single application or -# organization, or for experimental options, use field numbers 50000 -# through 99999. It is up to you to ensure that you do not use the -# same number for multiple options. -# * For options which will be published and used publicly by multiple -# independent entities, e-mail protobuf-global-extension-registry@google.com -# to reserve extension numbers. Simply provide your project name (e.g. -# Objective-C plugin) and your project website (if available) -- there's no -# need to explain how you intend to use them. Usually you only need one -# extension number. You can declare multiple options with only one extension -# number by putting them in a sub-message. See the Custom Options section of -# the docs for examples: -# https://developers.google.com/protocol-buffers/docs/proto#options -# If this turns out to be popular, a web service will be set up -# to automatically assign option numbers. +global___MethodDescriptorProto = MethodDescriptorProto +@typing_extensions.final class FileOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - # Generated classes can be optimized for speed or code size. - class OptimizeMode(_OptimizeMode, metaclass=_OptimizeModeEnumTypeWrapper): - pass + """Each of the definitions above may have "options" attached. These are + just annotations which may cause code to be generated slightly differently + or may contain hints for code that manipulates protocol messages. + + Clients may define custom options as extensions of the *Options messages. + These extensions may not yet be known at parsing time, so the parser cannot + store the values in them. Instead it stores them in a field in the *Options + message called uninterpreted_option. This field must have the same name + across all *Options messages. We then use this field to populate the + extensions when we build a descriptor, at which point all protos have been + parsed and so all extensions are known. + + Extension numbers for custom options may be chosen as follows: + * For options which will only be used within a single application or + organization, or for experimental options, use field numbers 50000 + through 99999. It is up to you to ensure that you do not use the + same number for multiple options. + * For options which will be published and used publicly by multiple + independent entities, e-mail protobuf-global-extension-registry@google.com + to reserve extension numbers. Simply provide your project name (e.g. + Objective-C plugin) and your project website (if available) -- there's no + need to explain how you intend to use them. Usually you only need one + extension number. You can declare multiple options with only one extension + number by putting them in a sub-message. See the Custom Options section of + the docs for examples: + https://developers.google.com/protocol-buffers/docs/proto#options + If this turns out to be popular, a web service will be set up + to automatically assign option numbers. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + class _OptimizeMode: - V = typing.NewType('V', builtins.int) - class _OptimizeModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_OptimizeMode.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # Generate complete code for parsing, serialization, - SPEED = FileOptions.OptimizeMode.V(1) - # etc. - # Use ReflectionOps to implement these methods. - CODE_SIZE = FileOptions.OptimizeMode.V(2) - # Generate code using MessageLite and the lite runtime. - LITE_RUNTIME = FileOptions.OptimizeMode.V(3) - - # Generate complete code for parsing, serialization, - SPEED = FileOptions.OptimizeMode.V(1) - # etc. - # Use ReflectionOps to implement these methods. - CODE_SIZE = FileOptions.OptimizeMode.V(2) - # Generate code using MessageLite and the lite runtime. - LITE_RUNTIME = FileOptions.OptimizeMode.V(3) + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _OptimizeModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[FileOptions._OptimizeMode.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + SPEED: FileOptions._OptimizeMode.ValueType # 1 + """Generate complete code for parsing, serialization,""" + CODE_SIZE: FileOptions._OptimizeMode.ValueType # 2 + """etc. + Use ReflectionOps to implement these methods. + """ + LITE_RUNTIME: FileOptions._OptimizeMode.ValueType # 3 + """Generate code using MessageLite and the lite runtime.""" + + class OptimizeMode(_OptimizeMode, metaclass=_OptimizeModeEnumTypeWrapper): + """Generated classes can be optimized for speed or code size.""" + + SPEED: FileOptions.OptimizeMode.ValueType # 1 + """Generate complete code for parsing, serialization,""" + CODE_SIZE: FileOptions.OptimizeMode.ValueType # 2 + """etc. + Use ReflectionOps to implement these methods. + """ + LITE_RUNTIME: FileOptions.OptimizeMode.ValueType # 3 + """Generate code using MessageLite and the lite runtime.""" JAVA_PACKAGE_FIELD_NUMBER: builtins.int JAVA_OUTER_CLASSNAME_FIELD_NUMBER: builtins.int @@ -595,474 +698,560 @@ class FileOptions(google.protobuf.message.Message): PHP_METADATA_NAMESPACE_FIELD_NUMBER: builtins.int RUBY_PACKAGE_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # Sets the Java package where classes generated from this .proto will be - # placed. By default, the proto package is used, but this is often - # inappropriate because proto packages do not normally start with backwards - # domain names. - java_package: typing.Text = ... - # Controls the name of the wrapper Java class generated for the .proto file. - # That class will always contain the .proto file's getDescriptor() method as - # well as any top-level extensions defined in the .proto file. - # If java_multiple_files is disabled, then all the other classes from the - # .proto file will be nested inside the single wrapper outer class. - java_outer_classname: typing.Text = ... - # If enabled, then the Java code generator will generate a separate .java - # file for each top-level message, enum, and service defined in the .proto - # file. Thus, these types will *not* be nested inside the wrapper class - # named by java_outer_classname. However, the wrapper class will still be - # generated to contain the file's getDescriptor() method as well as any - # top-level extensions defined in the file. - java_multiple_files: builtins.bool = ... - # This option does nothing. - java_generate_equals_and_hash: builtins.bool = ... - # If set true, then the Java2 code generator will generate code that - # throws an exception whenever an attempt is made to assign a non-UTF-8 - # byte sequence to a string field. - # Message reflection will do the same. - # However, an extension field still accepts non-UTF-8 byte sequences. - # This option has no effect on when used with the lite runtime. - java_string_check_utf8: builtins.bool = ... - optimize_for: global___FileOptions.OptimizeMode.V = ... - # Sets the Go package where structs generated from this .proto will be - # placed. If omitted, the Go package will be derived from the following: - # - The basename of the package import path, if provided. - # - Otherwise, the package statement in the .proto file, if present. - # - Otherwise, the basename of the .proto file, without extension. - go_package: typing.Text = ... - # Should generic services be generated in each language? "Generic" services - # are not specific to any particular RPC system. They are generated by the - # main code generators in each language (without additional plugins). - # Generic services were the only kind of service generation supported by - # early versions of google.protobuf. - # - # Generic services are now considered deprecated in favor of using plugins - # that generate code specific to your particular RPC system. Therefore, - # these default to false. Old code which depends on generic services should - # explicitly set them to true. - cc_generic_services: builtins.bool = ... - java_generic_services: builtins.bool = ... - py_generic_services: builtins.bool = ... - php_generic_services: builtins.bool = ... - # Is this file deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for everything in the file, or it will be completely ignored; in the very - # least, this is a formalization for deprecating files. - deprecated: builtins.bool = ... - # Enables the use of arenas for the proto messages in this file. This applies - # only to generated classes for C++. - cc_enable_arenas: builtins.bool = ... - # Sets the objective c class prefix which is prepended to all objective c - # generated classes from this .proto. There is no default. - objc_class_prefix: typing.Text = ... - # Namespace for generated classes; defaults to the package. - csharp_namespace: typing.Text = ... - # By default Swift generators will take the proto package and CamelCase it - # replacing '.' with underscore and use that to prefix the types/symbols - # defined. When this options is provided, they will use this value instead - # to prefix the types/symbols defined. - swift_prefix: typing.Text = ... - # Sets the php class prefix which is prepended to all php generated classes - # from this .proto. Default is empty. - php_class_prefix: typing.Text = ... - # Use this option to change the namespace of php generated classes. Default - # is empty. When this option is empty, the package name will be used for - # determining the namespace. - php_namespace: typing.Text = ... - # Use this option to change the namespace of php generated metadata classes. - # Default is empty. When this option is empty, the proto file name will be - # used for determining the namespace. - php_metadata_namespace: typing.Text = ... - # Use this option to change the package of ruby generated classes. Default - # is empty. When this option is not set, the package name will be used for - # determining the ruby package. - ruby_package: typing.Text = ... - # The parser stores options it doesn't recognize here. - # See the documentation for the "Options" section above. + java_package: builtins.str + """Sets the Java package where classes generated from this .proto will be + placed. By default, the proto package is used, but this is often + inappropriate because proto packages do not normally start with backwards + domain names. + """ + java_outer_classname: builtins.str + """Controls the name of the wrapper Java class generated for the .proto file. + That class will always contain the .proto file's getDescriptor() method as + well as any top-level extensions defined in the .proto file. + If java_multiple_files is disabled, then all the other classes from the + .proto file will be nested inside the single wrapper outer class. + """ + java_multiple_files: builtins.bool + """If enabled, then the Java code generator will generate a separate .java + file for each top-level message, enum, and service defined in the .proto + file. Thus, these types will *not* be nested inside the wrapper class + named by java_outer_classname. However, the wrapper class will still be + generated to contain the file's getDescriptor() method as well as any + top-level extensions defined in the file. + """ + java_generate_equals_and_hash: builtins.bool + """This option does nothing.""" + java_string_check_utf8: builtins.bool + """If set true, then the Java2 code generator will generate code that + throws an exception whenever an attempt is made to assign a non-UTF-8 + byte sequence to a string field. + Message reflection will do the same. + However, an extension field still accepts non-UTF-8 byte sequences. + This option has no effect on when used with the lite runtime. + """ + optimize_for: global___FileOptions.OptimizeMode.ValueType + go_package: builtins.str + """Sets the Go package where structs generated from this .proto will be + placed. If omitted, the Go package will be derived from the following: + - The basename of the package import path, if provided. + - Otherwise, the package statement in the .proto file, if present. + - Otherwise, the basename of the .proto file, without extension. + """ + cc_generic_services: builtins.bool + """Should generic services be generated in each language? "Generic" services + are not specific to any particular RPC system. They are generated by the + main code generators in each language (without additional plugins). + Generic services were the only kind of service generation supported by + early versions of google.protobuf. + + Generic services are now considered deprecated in favor of using plugins + that generate code specific to your particular RPC system. Therefore, + these default to false. Old code which depends on generic services should + explicitly set them to true. + """ + java_generic_services: builtins.bool + py_generic_services: builtins.bool + php_generic_services: builtins.bool + deprecated: builtins.bool + """Is this file deprecated? + Depending on the target platform, this can emit Deprecated annotations + for everything in the file, or it will be completely ignored; in the very + least, this is a formalization for deprecating files. + """ + cc_enable_arenas: builtins.bool + """Enables the use of arenas for the proto messages in this file. This applies + only to generated classes for C++. + """ + objc_class_prefix: builtins.str + """Sets the objective c class prefix which is prepended to all objective c + generated classes from this .proto. There is no default. + """ + csharp_namespace: builtins.str + """Namespace for generated classes; defaults to the package.""" + swift_prefix: builtins.str + """By default Swift generators will take the proto package and CamelCase it + replacing '.' with underscore and use that to prefix the types/symbols + defined. When this options is provided, they will use this value instead + to prefix the types/symbols defined. + """ + php_class_prefix: builtins.str + """Sets the php class prefix which is prepended to all php generated classes + from this .proto. Default is empty. + """ + php_namespace: builtins.str + """Use this option to change the namespace of php generated classes. Default + is empty. When this option is empty, the package name will be used for + determining the namespace. + """ + php_metadata_namespace: builtins.str + """Use this option to change the namespace of php generated metadata classes. + Default is empty. When this option is empty, the proto file name will be + used for determining the namespace. + """ + ruby_package: builtins.str + """Use this option to change the package of ruby generated classes. Default + is empty. When this option is not set, the package name will be used for + determining the ruby package. + """ @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. + See the documentation for the "Options" section above. + """ + def __init__( + self, *, - java_package : typing.Optional[typing.Text] = ..., - java_outer_classname : typing.Optional[typing.Text] = ..., - java_multiple_files : typing.Optional[builtins.bool] = ..., - java_generate_equals_and_hash : typing.Optional[builtins.bool] = ..., - java_string_check_utf8 : typing.Optional[builtins.bool] = ..., - optimize_for : typing.Optional[global___FileOptions.OptimizeMode.V] = ..., - go_package : typing.Optional[typing.Text] = ..., - cc_generic_services : typing.Optional[builtins.bool] = ..., - java_generic_services : typing.Optional[builtins.bool] = ..., - py_generic_services : typing.Optional[builtins.bool] = ..., - php_generic_services : typing.Optional[builtins.bool] = ..., - deprecated : typing.Optional[builtins.bool] = ..., - cc_enable_arenas : typing.Optional[builtins.bool] = ..., - objc_class_prefix : typing.Optional[typing.Text] = ..., - csharp_namespace : typing.Optional[typing.Text] = ..., - swift_prefix : typing.Optional[typing.Text] = ..., - php_class_prefix : typing.Optional[typing.Text] = ..., - php_namespace : typing.Optional[typing.Text] = ..., - php_metadata_namespace : typing.Optional[typing.Text] = ..., - ruby_package : typing.Optional[typing.Text] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"cc_enable_arenas",b"cc_enable_arenas",u"cc_generic_services",b"cc_generic_services",u"csharp_namespace",b"csharp_namespace",u"deprecated",b"deprecated",u"go_package",b"go_package",u"java_generate_equals_and_hash",b"java_generate_equals_and_hash",u"java_generic_services",b"java_generic_services",u"java_multiple_files",b"java_multiple_files",u"java_outer_classname",b"java_outer_classname",u"java_package",b"java_package",u"java_string_check_utf8",b"java_string_check_utf8",u"objc_class_prefix",b"objc_class_prefix",u"optimize_for",b"optimize_for",u"php_class_prefix",b"php_class_prefix",u"php_generic_services",b"php_generic_services",u"php_metadata_namespace",b"php_metadata_namespace",u"php_namespace",b"php_namespace",u"py_generic_services",b"py_generic_services",u"ruby_package",b"ruby_package",u"swift_prefix",b"swift_prefix"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"cc_enable_arenas",b"cc_enable_arenas",u"cc_generic_services",b"cc_generic_services",u"csharp_namespace",b"csharp_namespace",u"deprecated",b"deprecated",u"go_package",b"go_package",u"java_generate_equals_and_hash",b"java_generate_equals_and_hash",u"java_generic_services",b"java_generic_services",u"java_multiple_files",b"java_multiple_files",u"java_outer_classname",b"java_outer_classname",u"java_package",b"java_package",u"java_string_check_utf8",b"java_string_check_utf8",u"objc_class_prefix",b"objc_class_prefix",u"optimize_for",b"optimize_for",u"php_class_prefix",b"php_class_prefix",u"php_generic_services",b"php_generic_services",u"php_metadata_namespace",b"php_metadata_namespace",u"php_namespace",b"php_namespace",u"py_generic_services",b"py_generic_services",u"ruby_package",b"ruby_package",u"swift_prefix",b"swift_prefix",u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + java_package: builtins.str | None = ..., + java_outer_classname: builtins.str | None = ..., + java_multiple_files: builtins.bool | None = ..., + java_generate_equals_and_hash: builtins.bool | None = ..., + java_string_check_utf8: builtins.bool | None = ..., + optimize_for: global___FileOptions.OptimizeMode.ValueType | None = ..., + go_package: builtins.str | None = ..., + cc_generic_services: builtins.bool | None = ..., + java_generic_services: builtins.bool | None = ..., + py_generic_services: builtins.bool | None = ..., + php_generic_services: builtins.bool | None = ..., + deprecated: builtins.bool | None = ..., + cc_enable_arenas: builtins.bool | None = ..., + objc_class_prefix: builtins.str | None = ..., + csharp_namespace: builtins.str | None = ..., + swift_prefix: builtins.str | None = ..., + php_class_prefix: builtins.str | None = ..., + php_namespace: builtins.str | None = ..., + php_metadata_namespace: builtins.str | None = ..., + ruby_package: builtins.str | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["cc_enable_arenas", b"cc_enable_arenas", "cc_generic_services", b"cc_generic_services", "csharp_namespace", b"csharp_namespace", "deprecated", b"deprecated", "go_package", b"go_package", "java_generate_equals_and_hash", b"java_generate_equals_and_hash", "java_generic_services", b"java_generic_services", "java_multiple_files", b"java_multiple_files", "java_outer_classname", b"java_outer_classname", "java_package", b"java_package", "java_string_check_utf8", b"java_string_check_utf8", "objc_class_prefix", b"objc_class_prefix", "optimize_for", b"optimize_for", "php_class_prefix", b"php_class_prefix", "php_generic_services", b"php_generic_services", "php_metadata_namespace", b"php_metadata_namespace", "php_namespace", b"php_namespace", "py_generic_services", b"py_generic_services", "ruby_package", b"ruby_package", "swift_prefix", b"swift_prefix"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["cc_enable_arenas", b"cc_enable_arenas", "cc_generic_services", b"cc_generic_services", "csharp_namespace", b"csharp_namespace", "deprecated", b"deprecated", "go_package", b"go_package", "java_generate_equals_and_hash", b"java_generate_equals_and_hash", "java_generic_services", b"java_generic_services", "java_multiple_files", b"java_multiple_files", "java_outer_classname", b"java_outer_classname", "java_package", b"java_package", "java_string_check_utf8", b"java_string_check_utf8", "objc_class_prefix", b"objc_class_prefix", "optimize_for", b"optimize_for", "php_class_prefix", b"php_class_prefix", "php_generic_services", b"php_generic_services", "php_metadata_namespace", b"php_metadata_namespace", "php_namespace", b"php_namespace", "py_generic_services", b"py_generic_services", "ruby_package", b"ruby_package", "swift_prefix", b"swift_prefix", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___FileOptions = FileOptions +@typing_extensions.final class MessageOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + MESSAGE_SET_WIRE_FORMAT_FIELD_NUMBER: builtins.int NO_STANDARD_DESCRIPTOR_ACCESSOR_FIELD_NUMBER: builtins.int DEPRECATED_FIELD_NUMBER: builtins.int MAP_ENTRY_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # Set true to use the old proto1 MessageSet wire format for extensions. - # This is provided for backwards-compatibility with the MessageSet wire - # format. You should not use this for any other reason: It's less - # efficient, has fewer features, and is more complicated. - # - # The message must be defined exactly as follows: - # message Foo { - # option message_set_wire_format = true; - # extensions 4 to max; - # } - # Note that the message cannot have any defined fields; MessageSets only - # have extensions. - # - # All extensions of your type must be singular messages; e.g. they cannot - # be int32s, enums, or repeated messages. - # - # Because this is an option, the above two restrictions are not enforced by - # the protocol compiler. - message_set_wire_format: builtins.bool = ... - # Disables the generation of the standard "descriptor()" accessor, which can - # conflict with a field of the same name. This is meant to make migration - # from proto1 easier; new code should avoid fields named "descriptor". - no_standard_descriptor_accessor: builtins.bool = ... - # Is this message deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for the message, or it will be completely ignored; in the very least, - # this is a formalization for deprecating messages. - deprecated: builtins.bool = ... - # Whether the message is an automatically generated map entry type for the - # maps field. - # - # For maps fields: - # map map_field = 1; - # The parsed descriptor looks like: - # message MapFieldEntry { - # option map_entry = true; - # optional KeyType key = 1; - # optional ValueType value = 2; - # } - # repeated MapFieldEntry map_field = 1; - # - # Implementations may choose not to generate the map_entry=true message, but - # use a native map in the target language to hold the keys and values. - # The reflection APIs in such implementations still need to work as - # if the field is a repeated message field. - # - # NOTE: Do not set the option in .proto files. Always use the maps syntax - # instead. The option should only be implicitly set by the proto compiler - # parser. - map_entry: builtins.bool = ... - # The parser stores options it doesn't recognize here. See above. + message_set_wire_format: builtins.bool + """Set true to use the old proto1 MessageSet wire format for extensions. + This is provided for backwards-compatibility with the MessageSet wire + format. You should not use this for any other reason: It's less + efficient, has fewer features, and is more complicated. + + The message must be defined exactly as follows: + message Foo { + option message_set_wire_format = true; + extensions 4 to max; + } + Note that the message cannot have any defined fields; MessageSets only + have extensions. + + All extensions of your type must be singular messages; e.g. they cannot + be int32s, enums, or repeated messages. + + Because this is an option, the above two restrictions are not enforced by + the protocol compiler. + """ + no_standard_descriptor_accessor: builtins.bool + """Disables the generation of the standard "descriptor()" accessor, which can + conflict with a field of the same name. This is meant to make migration + from proto1 easier; new code should avoid fields named "descriptor". + """ + deprecated: builtins.bool + """Is this message deprecated? + Depending on the target platform, this can emit Deprecated annotations + for the message, or it will be completely ignored; in the very least, + this is a formalization for deprecating messages. + """ + map_entry: builtins.bool + """Whether the message is an automatically generated map entry type for the + maps field. + + For maps fields: + map map_field = 1; + The parsed descriptor looks like: + message MapFieldEntry { + option map_entry = true; + optional KeyType key = 1; + optional ValueType value = 2; + } + repeated MapFieldEntry map_field = 1; + + Implementations may choose not to generate the map_entry=true message, but + use a native map in the target language to hold the keys and values. + The reflection APIs in such implementations still need to work as + if the field is a repeated message field. + + NOTE: Do not set the option in .proto files. Always use the maps syntax + instead. The option should only be implicitly set by the proto compiler + parser. + """ @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - message_set_wire_format : typing.Optional[builtins.bool] = ..., - no_standard_descriptor_accessor : typing.Optional[builtins.bool] = ..., - deprecated : typing.Optional[builtins.bool] = ..., - map_entry : typing.Optional[builtins.bool] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated",u"map_entry",b"map_entry",u"message_set_wire_format",b"message_set_wire_format",u"no_standard_descriptor_accessor",b"no_standard_descriptor_accessor"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated",u"map_entry",b"map_entry",u"message_set_wire_format",b"message_set_wire_format",u"no_standard_descriptor_accessor",b"no_standard_descriptor_accessor",u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + message_set_wire_format: builtins.bool | None = ..., + no_standard_descriptor_accessor: builtins.bool | None = ..., + deprecated: builtins.bool | None = ..., + map_entry: builtins.bool | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated", "map_entry", b"map_entry", "message_set_wire_format", b"message_set_wire_format", "no_standard_descriptor_accessor", b"no_standard_descriptor_accessor"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated", "map_entry", b"map_entry", "message_set_wire_format", b"message_set_wire_format", "no_standard_descriptor_accessor", b"no_standard_descriptor_accessor", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___MessageOptions = MessageOptions +@typing_extensions.final class FieldOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class CType(_CType, metaclass=_CTypeEnumTypeWrapper): - pass + DESCRIPTOR: google.protobuf.descriptor.Descriptor + class _CType: - V = typing.NewType('V', builtins.int) - class _CTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_CType.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # Default mode. - STRING = FieldOptions.CType.V(0) - CORD = FieldOptions.CType.V(1) - STRING_PIECE = FieldOptions.CType.V(2) - - # Default mode. - STRING = FieldOptions.CType.V(0) - CORD = FieldOptions.CType.V(1) - STRING_PIECE = FieldOptions.CType.V(2) - - class JSType(_JSType, metaclass=_JSTypeEnumTypeWrapper): - pass + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _CTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[FieldOptions._CType.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + STRING: FieldOptions._CType.ValueType # 0 + """Default mode.""" + CORD: FieldOptions._CType.ValueType # 1 + STRING_PIECE: FieldOptions._CType.ValueType # 2 + + class CType(_CType, metaclass=_CTypeEnumTypeWrapper): ... + STRING: FieldOptions.CType.ValueType # 0 + """Default mode.""" + CORD: FieldOptions.CType.ValueType # 1 + STRING_PIECE: FieldOptions.CType.ValueType # 2 + class _JSType: - V = typing.NewType('V', builtins.int) - class _JSTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_JSType.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # Use the default type. - JS_NORMAL = FieldOptions.JSType.V(0) - # Use JavaScript strings. - JS_STRING = FieldOptions.JSType.V(1) - # Use JavaScript numbers. - JS_NUMBER = FieldOptions.JSType.V(2) - - # Use the default type. - JS_NORMAL = FieldOptions.JSType.V(0) - # Use JavaScript strings. - JS_STRING = FieldOptions.JSType.V(1) - # Use JavaScript numbers. - JS_NUMBER = FieldOptions.JSType.V(2) + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _JSTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[FieldOptions._JSType.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + JS_NORMAL: FieldOptions._JSType.ValueType # 0 + """Use the default type.""" + JS_STRING: FieldOptions._JSType.ValueType # 1 + """Use JavaScript strings.""" + JS_NUMBER: FieldOptions._JSType.ValueType # 2 + """Use JavaScript numbers.""" + + class JSType(_JSType, metaclass=_JSTypeEnumTypeWrapper): ... + JS_NORMAL: FieldOptions.JSType.ValueType # 0 + """Use the default type.""" + JS_STRING: FieldOptions.JSType.ValueType # 1 + """Use JavaScript strings.""" + JS_NUMBER: FieldOptions.JSType.ValueType # 2 + """Use JavaScript numbers.""" CTYPE_FIELD_NUMBER: builtins.int PACKED_FIELD_NUMBER: builtins.int JSTYPE_FIELD_NUMBER: builtins.int LAZY_FIELD_NUMBER: builtins.int + UNVERIFIED_LAZY_FIELD_NUMBER: builtins.int DEPRECATED_FIELD_NUMBER: builtins.int WEAK_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # The ctype option instructs the C++ code generator to use a different - # representation of the field than it normally would. See the specific - # options below. This option is not yet implemented in the open source - # release -- sorry, we'll try to include it in a future version! - ctype: global___FieldOptions.CType.V = ... - # The packed option can be enabled for repeated primitive fields to enable - # a more efficient representation on the wire. Rather than repeatedly - # writing the tag and type for each element, the entire array is encoded as - # a single length-delimited blob. In proto3, only explicit setting it to - # false will avoid using packed encoding. - packed: builtins.bool = ... - # The jstype option determines the JavaScript type used for values of the - # field. The option is permitted only for 64 bit integral and fixed types - # (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - # is represented as JavaScript string, which avoids loss of precision that - # can happen when a large value is converted to a floating point JavaScript. - # Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - # use the JavaScript "number" type. The behavior of the default option - # JS_NORMAL is implementation dependent. - # - # This option is an enum to permit additional types to be added, e.g. - # goog.math.Integer. - jstype: global___FieldOptions.JSType.V = ... - # Should this field be parsed lazily? Lazy applies only to message-type - # fields. It means that when the outer message is initially parsed, the - # inner message's contents will not be parsed but instead stored in encoded - # form. The inner message will actually be parsed when it is first accessed. - # - # This is only a hint. Implementations are free to choose whether to use - # eager or lazy parsing regardless of the value of this option. However, - # setting this option true suggests that the protocol author believes that - # using lazy parsing on this field is worth the additional bookkeeping - # overhead typically needed to implement it. - # - # This option does not affect the public interface of any generated code; - # all method signatures remain the same. Furthermore, thread-safety of the - # interface is not affected by this option; const methods remain safe to - # call from multiple threads concurrently, while non-const methods continue - # to require exclusive access. - # - # - # Note that implementations may choose not to check required fields within - # a lazy sub-message. That is, calling IsInitialized() on the outer message - # may return true even if the inner message has missing required fields. - # This is necessary because otherwise the inner message would have to be - # parsed in order to perform the check, defeating the purpose of lazy - # parsing. An implementation which chooses not to check required fields - # must be consistent about it. That is, for any particular sub-message, the - # implementation must either *always* check its required fields, or *never* - # check its required fields, regardless of whether or not the message has - # been parsed. - lazy: builtins.bool = ... - # Is this field deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for accessors, or it will be completely ignored; in the very least, this - # is a formalization for deprecating fields. - deprecated: builtins.bool = ... - # For Google-internal migration only. Do not use. - weak: builtins.bool = ... - # The parser stores options it doesn't recognize here. See above. + ctype: global___FieldOptions.CType.ValueType + """The ctype option instructs the C++ code generator to use a different + representation of the field than it normally would. See the specific + options below. This option is not yet implemented in the open source + release -- sorry, we'll try to include it in a future version! + """ + packed: builtins.bool + """The packed option can be enabled for repeated primitive fields to enable + a more efficient representation on the wire. Rather than repeatedly + writing the tag and type for each element, the entire array is encoded as + a single length-delimited blob. In proto3, only explicit setting it to + false will avoid using packed encoding. + """ + jstype: global___FieldOptions.JSType.ValueType + """The jstype option determines the JavaScript type used for values of the + field. The option is permitted only for 64 bit integral and fixed types + (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + is represented as JavaScript string, which avoids loss of precision that + can happen when a large value is converted to a floating point JavaScript. + Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + use the JavaScript "number" type. The behavior of the default option + JS_NORMAL is implementation dependent. + + This option is an enum to permit additional types to be added, e.g. + goog.math.Integer. + """ + lazy: builtins.bool + """Should this field be parsed lazily? Lazy applies only to message-type + fields. It means that when the outer message is initially parsed, the + inner message's contents will not be parsed but instead stored in encoded + form. The inner message will actually be parsed when it is first accessed. + + This is only a hint. Implementations are free to choose whether to use + eager or lazy parsing regardless of the value of this option. However, + setting this option true suggests that the protocol author believes that + using lazy parsing on this field is worth the additional bookkeeping + overhead typically needed to implement it. + + This option does not affect the public interface of any generated code; + all method signatures remain the same. Furthermore, thread-safety of the + interface is not affected by this option; const methods remain safe to + call from multiple threads concurrently, while non-const methods continue + to require exclusive access. + + + Note that implementations may choose not to check required fields within + a lazy sub-message. That is, calling IsInitialized() on the outer message + may return true even if the inner message has missing required fields. + This is necessary because otherwise the inner message would have to be + parsed in order to perform the check, defeating the purpose of lazy + parsing. An implementation which chooses not to check required fields + must be consistent about it. That is, for any particular sub-message, the + implementation must either *always* check its required fields, or *never* + check its required fields, regardless of whether or not the message has + been parsed. + + As of 2021, lazy does no correctness checks on the byte stream during + parsing. This may lead to crashes if and when an invalid byte stream is + finally parsed upon access. + + TODO(b/211906113): Enable validation on lazy fields. + """ + unverified_lazy: builtins.bool + """unverified_lazy does no correctness checks on the byte stream. This should + only be used where lazy with verification is prohibitive for performance + reasons. + """ + deprecated: builtins.bool + """Is this field deprecated? + Depending on the target platform, this can emit Deprecated annotations + for accessors, or it will be completely ignored; in the very least, this + is a formalization for deprecating fields. + """ + weak: builtins.bool + """For Google-internal migration only. Do not use.""" @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - ctype : typing.Optional[global___FieldOptions.CType.V] = ..., - packed : typing.Optional[builtins.bool] = ..., - jstype : typing.Optional[global___FieldOptions.JSType.V] = ..., - lazy : typing.Optional[builtins.bool] = ..., - deprecated : typing.Optional[builtins.bool] = ..., - weak : typing.Optional[builtins.bool] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"ctype",b"ctype",u"deprecated",b"deprecated",u"jstype",b"jstype",u"lazy",b"lazy",u"packed",b"packed",u"weak",b"weak"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"ctype",b"ctype",u"deprecated",b"deprecated",u"jstype",b"jstype",u"lazy",b"lazy",u"packed",b"packed",u"uninterpreted_option",b"uninterpreted_option",u"weak",b"weak"]) -> None: ... + ctype: global___FieldOptions.CType.ValueType | None = ..., + packed: builtins.bool | None = ..., + jstype: global___FieldOptions.JSType.ValueType | None = ..., + lazy: builtins.bool | None = ..., + unverified_lazy: builtins.bool | None = ..., + deprecated: builtins.bool | None = ..., + weak: builtins.bool | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["ctype", b"ctype", "deprecated", b"deprecated", "jstype", b"jstype", "lazy", b"lazy", "packed", b"packed", "unverified_lazy", b"unverified_lazy", "weak", b"weak"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["ctype", b"ctype", "deprecated", b"deprecated", "jstype", b"jstype", "lazy", b"lazy", "packed", b"packed", "uninterpreted_option", b"uninterpreted_option", "unverified_lazy", b"unverified_lazy", "weak", b"weak"]) -> None: ... + global___FieldOptions = FieldOptions +@typing_extensions.final class OneofOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # The parser stores options it doesn't recognize here. See above. @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___OneofOptions = OneofOptions +@typing_extensions.final class EnumOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + ALLOW_ALIAS_FIELD_NUMBER: builtins.int DEPRECATED_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # Set this option to true to allow mapping different tag names to the same - # value. - allow_alias: builtins.bool = ... - # Is this enum deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for the enum, or it will be completely ignored; in the very least, this - # is a formalization for deprecating enums. - deprecated: builtins.bool = ... - # The parser stores options it doesn't recognize here. See above. + allow_alias: builtins.bool + """Set this option to true to allow mapping different tag names to the same + value. + """ + deprecated: builtins.bool + """Is this enum deprecated? + Depending on the target platform, this can emit Deprecated annotations + for the enum, or it will be completely ignored; in the very least, this + is a formalization for deprecating enums. + """ @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - allow_alias : typing.Optional[builtins.bool] = ..., - deprecated : typing.Optional[builtins.bool] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"allow_alias",b"allow_alias",u"deprecated",b"deprecated"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"allow_alias",b"allow_alias",u"deprecated",b"deprecated",u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + allow_alias: builtins.bool | None = ..., + deprecated: builtins.bool | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["allow_alias", b"allow_alias", "deprecated", b"deprecated"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["allow_alias", b"allow_alias", "deprecated", b"deprecated", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___EnumOptions = EnumOptions +@typing_extensions.final class EnumValueOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + DEPRECATED_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # Is this enum value deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for the enum value, or it will be completely ignored; in the very least, - # this is a formalization for deprecating enum values. - deprecated: builtins.bool = ... - # The parser stores options it doesn't recognize here. See above. + deprecated: builtins.bool + """Is this enum value deprecated? + Depending on the target platform, this can emit Deprecated annotations + for the enum value, or it will be completely ignored; in the very least, + this is a formalization for deprecating enum values. + """ @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - deprecated : typing.Optional[builtins.bool] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated",u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + deprecated: builtins.bool | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___EnumValueOptions = EnumValueOptions +@typing_extensions.final class ServiceOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + DEPRECATED_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # Note: Field numbers 1 through 32 are reserved for Google's internal RPC - # framework. We apologize for hoarding these numbers to ourselves, but - # we were already using them long before we decided to release Protocol - # Buffers. - - # Is this service deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for the service, or it will be completely ignored; in the very least, - # this is a formalization for deprecating services. - deprecated: builtins.bool = ... - # The parser stores options it doesn't recognize here. See above. + deprecated: builtins.bool + """Note: Field numbers 1 through 32 are reserved for Google's internal RPC + framework. We apologize for hoarding these numbers to ourselves, but + we were already using them long before we decided to release Protocol + Buffers. + + Is this service deprecated? + Depending on the target platform, this can emit Deprecated annotations + for the service, or it will be completely ignored; in the very least, + this is a formalization for deprecating services. + """ @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - deprecated : typing.Optional[builtins.bool] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated",u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + deprecated: builtins.bool | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___ServiceOptions = ServiceOptions +@typing_extensions.final class MethodOptions(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - # Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - # or neither? HTTP based RPC implementation may choose GET verb for safe - # methods, and PUT verb for idempotent methods instead of the default POST. - class IdempotencyLevel(_IdempotencyLevel, metaclass=_IdempotencyLevelEnumTypeWrapper): - pass + DESCRIPTOR: google.protobuf.descriptor.Descriptor + class _IdempotencyLevel: - V = typing.NewType('V', builtins.int) - class _IdempotencyLevelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_IdempotencyLevel.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - IDEMPOTENCY_UNKNOWN = MethodOptions.IdempotencyLevel.V(0) - # implies idempotent - NO_SIDE_EFFECTS = MethodOptions.IdempotencyLevel.V(1) - # idempotent, but may have side effects - IDEMPOTENT = MethodOptions.IdempotencyLevel.V(2) - - IDEMPOTENCY_UNKNOWN = MethodOptions.IdempotencyLevel.V(0) - # implies idempotent - NO_SIDE_EFFECTS = MethodOptions.IdempotencyLevel.V(1) - # idempotent, but may have side effects - IDEMPOTENT = MethodOptions.IdempotencyLevel.V(2) + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _IdempotencyLevelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[MethodOptions._IdempotencyLevel.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + IDEMPOTENCY_UNKNOWN: MethodOptions._IdempotencyLevel.ValueType # 0 + NO_SIDE_EFFECTS: MethodOptions._IdempotencyLevel.ValueType # 1 + """implies idempotent""" + IDEMPOTENT: MethodOptions._IdempotencyLevel.ValueType # 2 + """idempotent, but may have side effects""" + + class IdempotencyLevel(_IdempotencyLevel, metaclass=_IdempotencyLevelEnumTypeWrapper): + """Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + or neither? HTTP based RPC implementation may choose GET verb for safe + methods, and PUT verb for idempotent methods instead of the default POST. + """ + + IDEMPOTENCY_UNKNOWN: MethodOptions.IdempotencyLevel.ValueType # 0 + NO_SIDE_EFFECTS: MethodOptions.IdempotencyLevel.ValueType # 1 + """implies idempotent""" + IDEMPOTENT: MethodOptions.IdempotencyLevel.ValueType # 2 + """idempotent, but may have side effects""" DEPRECATED_FIELD_NUMBER: builtins.int IDEMPOTENCY_LEVEL_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int - # Note: Field numbers 1 through 32 are reserved for Google's internal RPC - # framework. We apologize for hoarding these numbers to ourselves, but - # we were already using them long before we decided to release Protocol - # Buffers. - - # Is this method deprecated? - # Depending on the target platform, this can emit Deprecated annotations - # for the method, or it will be completely ignored; in the very least, - # this is a formalization for deprecating methods. - deprecated: builtins.bool = ... - idempotency_level: global___MethodOptions.IdempotencyLevel.V = ... - # The parser stores options it doesn't recognize here. See above. + deprecated: builtins.bool + """Note: Field numbers 1 through 32 are reserved for Google's internal RPC + framework. We apologize for hoarding these numbers to ourselves, but + we were already using them long before we decided to release Protocol + Buffers. + + Is this method deprecated? + Depending on the target platform, this can emit Deprecated annotations + for the method, or it will be completely ignored; in the very least, + this is a formalization for deprecating methods. + """ + idempotency_level: global___MethodOptions.IdempotencyLevel.ValueType @property - def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: ... - def __init__(self, + def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: + """The parser stores options it doesn't recognize here. See above.""" + def __init__( + self, *, - deprecated : typing.Optional[builtins.bool] = ..., - idempotency_level : typing.Optional[global___MethodOptions.IdempotencyLevel.V] = ..., - uninterpreted_option : typing.Optional[typing.Iterable[global___UninterpretedOption]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated",u"idempotency_level",b"idempotency_level"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"deprecated",b"deprecated",u"idempotency_level",b"idempotency_level",u"uninterpreted_option",b"uninterpreted_option"]) -> None: ... + deprecated: builtins.bool | None = ..., + idempotency_level: global___MethodOptions.IdempotencyLevel.ValueType | None = ..., + uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated", "idempotency_level", b"idempotency_level"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["deprecated", b"deprecated", "idempotency_level", b"idempotency_level", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + global___MethodOptions = MethodOptions -# A message representing a option the parser does not recognize. This only -# appears in options protos created by the compiler::Parser class. -# DescriptorPool resolves these when building Descriptor objects. Therefore, -# options protos in descriptor objects (e.g. returned by Descriptor::options(), -# or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -# in them. +@typing_extensions.final class UninterpretedOption(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - # The name of the uninterpreted option. Each string represents a segment in - # a dot-separated name. is_extension is true iff a segment represents an - # extension (denoted with parentheses in options specs in .proto files). - # E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - # "foo.(bar.baz).qux". + """A message representing a option the parser does not recognize. This only + appears in options protos created by the compiler::Parser class. + DescriptorPool resolves these when building Descriptor objects. Therefore, + options protos in descriptor objects (e.g. returned by Descriptor::options(), + or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + in them. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + @typing_extensions.final class NamePart(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """The name of the uninterpreted option. Each string represents a segment in + a dot-separated name. is_extension is true iff a segment represents an + extension (denoted with parentheses in options specs in .proto files). + E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + "foo.(bar.baz).moo". + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_PART_FIELD_NUMBER: builtins.int IS_EXTENSION_FIELD_NUMBER: builtins.int - name_part: typing.Text = ... - is_extension: builtins.bool = ... - def __init__(self, + name_part: builtins.str + is_extension: builtins.bool + def __init__( + self, *, - name_part : typing.Optional[typing.Text] = ..., - is_extension : typing.Optional[builtins.bool] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"is_extension",b"is_extension",u"name_part",b"name_part"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"is_extension",b"is_extension",u"name_part",b"name_part"]) -> None: ... + name_part: builtins.str | None = ..., + is_extension: builtins.bool | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["is_extension", b"is_extension", "name_part", b"name_part"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["is_extension", b"is_extension", "name_part", b"name_part"]) -> None: ... NAME_FIELD_NUMBER: builtins.int IDENTIFIER_VALUE_FIELD_NUMBER: builtins.int @@ -1073,231 +1262,260 @@ class UninterpretedOption(google.protobuf.message.Message): AGGREGATE_VALUE_FIELD_NUMBER: builtins.int @property def name(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption.NamePart]: ... - # The value of the uninterpreted option, in whatever type the tokenizer - # identified it as during parsing. Exactly one of these should be set. - identifier_value: typing.Text = ... - positive_int_value: builtins.int = ... - negative_int_value: builtins.int = ... - double_value: builtins.float = ... - string_value: builtins.bytes = ... - aggregate_value: typing.Text = ... - def __init__(self, + identifier_value: builtins.str + """The value of the uninterpreted option, in whatever type the tokenizer + identified it as during parsing. Exactly one of these should be set. + """ + positive_int_value: builtins.int + negative_int_value: builtins.int + double_value: builtins.float + string_value: builtins.bytes + aggregate_value: builtins.str + def __init__( + self, *, - name : typing.Optional[typing.Iterable[global___UninterpretedOption.NamePart]] = ..., - identifier_value : typing.Optional[typing.Text] = ..., - positive_int_value : typing.Optional[builtins.int] = ..., - negative_int_value : typing.Optional[builtins.int] = ..., - double_value : typing.Optional[builtins.float] = ..., - string_value : typing.Optional[builtins.bytes] = ..., - aggregate_value : typing.Optional[typing.Text] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"aggregate_value",b"aggregate_value",u"double_value",b"double_value",u"identifier_value",b"identifier_value",u"negative_int_value",b"negative_int_value",u"positive_int_value",b"positive_int_value",u"string_value",b"string_value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"aggregate_value",b"aggregate_value",u"double_value",b"double_value",u"identifier_value",b"identifier_value",u"name",b"name",u"negative_int_value",b"negative_int_value",u"positive_int_value",b"positive_int_value",u"string_value",b"string_value"]) -> None: ... -global___UninterpretedOption = UninterpretedOption + name: collections.abc.Iterable[global___UninterpretedOption.NamePart] | None = ..., + identifier_value: builtins.str | None = ..., + positive_int_value: builtins.int | None = ..., + negative_int_value: builtins.int | None = ..., + double_value: builtins.float | None = ..., + string_value: builtins.bytes | None = ..., + aggregate_value: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["aggregate_value", b"aggregate_value", "double_value", b"double_value", "identifier_value", b"identifier_value", "negative_int_value", b"negative_int_value", "positive_int_value", b"positive_int_value", "string_value", b"string_value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["aggregate_value", b"aggregate_value", "double_value", b"double_value", "identifier_value", b"identifier_value", "name", b"name", "negative_int_value", b"negative_int_value", "positive_int_value", b"positive_int_value", "string_value", b"string_value"]) -> None: ... -# =================================================================== -# Optional source code info +global___UninterpretedOption = UninterpretedOption -# Encapsulates information about the original source file from which a -# FileDescriptorProto was generated. +@typing_extensions.final class SourceCodeInfo(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """=================================================================== + Optional source code info + + Encapsulates information about the original source file from which a + FileDescriptorProto was generated. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + @typing_extensions.final class Location(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + PATH_FIELD_NUMBER: builtins.int SPAN_FIELD_NUMBER: builtins.int LEADING_COMMENTS_FIELD_NUMBER: builtins.int TRAILING_COMMENTS_FIELD_NUMBER: builtins.int LEADING_DETACHED_COMMENTS_FIELD_NUMBER: builtins.int - # Identifies which part of the FileDescriptorProto was defined at this - # location. - # - # Each element is a field number or an index. They form a path from - # the root FileDescriptorProto to the place where the definition. For - # example, this path: - # [ 4, 3, 2, 7, 1 ] - # refers to: - # file.message_type(3) // 4, 3 - # .field(7) // 2, 7 - # .name() // 1 - # This is because FileDescriptorProto.message_type has field number 4: - # repeated DescriptorProto message_type = 4; - # and DescriptorProto.field has field number 2: - # repeated FieldDescriptorProto field = 2; - # and FieldDescriptorProto.name has field number 1: - # optional string name = 1; - # - # Thus, the above path gives the location of a field name. If we removed - # the last element: - # [ 4, 3, 2, 7 ] - # this path refers to the whole field declaration (from the beginning - # of the label to the terminating semicolon). @property - def path(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... - # Always has exactly three or four elements: start line, start column, - # end line (optional, otherwise assumed same as start line), end column. - # These are packed into a single field for efficiency. Note that line - # and column numbers are zero-based -- typically you will want to add - # 1 to each before displaying to a user. + def path(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """Identifies which part of the FileDescriptorProto was defined at this + location. + + Each element is a field number or an index. They form a path from + the root FileDescriptorProto to the place where the definition occurs. + For example, this path: + [ 4, 3, 2, 7, 1 ] + refers to: + file.message_type(3) // 4, 3 + .field(7) // 2, 7 + .name() // 1 + This is because FileDescriptorProto.message_type has field number 4: + repeated DescriptorProto message_type = 4; + and DescriptorProto.field has field number 2: + repeated FieldDescriptorProto field = 2; + and FieldDescriptorProto.name has field number 1: + optional string name = 1; + + Thus, the above path gives the location of a field name. If we removed + the last element: + [ 4, 3, 2, 7 ] + this path refers to the whole field declaration (from the beginning + of the label to the terminating semicolon). + """ @property - def span(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... - # If this SourceCodeInfo represents a complete declaration, these are any - # comments appearing before and after the declaration which appear to be - # attached to the declaration. - # - # A series of line comments appearing on consecutive lines, with no other - # tokens appearing on those lines, will be treated as a single comment. - # - # leading_detached_comments will keep paragraphs of comments that appear - # before (but not connected to) the current element. Each paragraph, - # separated by empty lines, will be one comment element in the repeated - # field. - # - # Only the comment content is provided; comment markers (e.g. //) are - # stripped out. For block comments, leading whitespace and an asterisk - # will be stripped from the beginning of each line other than the first. - # Newlines are included in the output. - # - # Examples: - # - # optional int32 foo = 1; // Comment attached to foo. - # // Comment attached to bar. - # optional int32 bar = 2; - # - # optional string baz = 3; - # // Comment attached to baz. - # // Another line attached to baz. - # - # // Comment attached to qux. - # // - # // Another line attached to qux. - # optional double qux = 4; - # - # // Detached comment for corge. This is not leading or trailing comments - # // to qux or corge because there are blank lines separating it from - # // both. - # - # // Detached comment for corge paragraph 2. - # - # optional string corge = 5; - # /* Block comment attached - # * to corge. Leading asterisks - # * will be removed. */ - # /* Block comment attached to - # * grault. */ - # optional int32 grault = 6; - # - # // ignored detached comments. - leading_comments: typing.Text = ... - trailing_comments: typing.Text = ... + def span(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """Always has exactly three or four elements: start line, start column, + end line (optional, otherwise assumed same as start line), end column. + These are packed into a single field for efficiency. Note that line + and column numbers are zero-based -- typically you will want to add + 1 to each before displaying to a user. + """ + leading_comments: builtins.str + """If this SourceCodeInfo represents a complete declaration, these are any + comments appearing before and after the declaration which appear to be + attached to the declaration. + + A series of line comments appearing on consecutive lines, with no other + tokens appearing on those lines, will be treated as a single comment. + + leading_detached_comments will keep paragraphs of comments that appear + before (but not connected to) the current element. Each paragraph, + separated by empty lines, will be one comment element in the repeated + field. + + Only the comment content is provided; comment markers (e.g. //) are + stripped out. For block comments, leading whitespace and an asterisk + will be stripped from the beginning of each line other than the first. + Newlines are included in the output. + + Examples: + + optional int32 foo = 1; // Comment attached to foo. + // Comment attached to bar. + optional int32 bar = 2; + + optional string baz = 3; + // Comment attached to baz. + // Another line attached to baz. + + // Comment attached to moo. + // + // Another line attached to moo. + optional double moo = 4; + + // Detached comment for corge. This is not leading or trailing comments + // to moo or corge because there are blank lines separating it from + // both. + + // Detached comment for corge paragraph 2. + + optional string corge = 5; + /* Block comment attached + * to corge. Leading asterisks + * will be removed. */ + /* Block comment attached to + * grault. */ + optional int32 grault = 6; + + // ignored detached comments. + """ + trailing_comments: builtins.str @property - def leading_detached_comments(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - def __init__(self, + def leading_detached_comments(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ... + def __init__( + self, *, - path : typing.Optional[typing.Iterable[builtins.int]] = ..., - span : typing.Optional[typing.Iterable[builtins.int]] = ..., - leading_comments : typing.Optional[typing.Text] = ..., - trailing_comments : typing.Optional[typing.Text] = ..., - leading_detached_comments : typing.Optional[typing.Iterable[typing.Text]] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"leading_comments",b"leading_comments",u"trailing_comments",b"trailing_comments"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"leading_comments",b"leading_comments",u"leading_detached_comments",b"leading_detached_comments",u"path",b"path",u"span",b"span",u"trailing_comments",b"trailing_comments"]) -> None: ... + path: collections.abc.Iterable[builtins.int] | None = ..., + span: collections.abc.Iterable[builtins.int] | None = ..., + leading_comments: builtins.str | None = ..., + trailing_comments: builtins.str | None = ..., + leading_detached_comments: collections.abc.Iterable[builtins.str] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["leading_comments", b"leading_comments", "trailing_comments", b"trailing_comments"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["leading_comments", b"leading_comments", "leading_detached_comments", b"leading_detached_comments", "path", b"path", "span", b"span", "trailing_comments", b"trailing_comments"]) -> None: ... LOCATION_FIELD_NUMBER: builtins.int - # A Location identifies a piece of source code in a .proto file which - # corresponds to a particular definition. This information is intended - # to be useful to IDEs, code indexers, documentation generators, and similar - # tools. - # - # For example, say we have a file like: - # message Foo { - # optional string foo = 1; - # } - # Let's look at just the field definition: - # optional string foo = 1; - # ^ ^^ ^^ ^ ^^^ - # a bc de f ghi - # We have the following locations: - # span path represents - # [a,i) [ 4, 0, 2, 0 ] The whole field definition. - # [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - # [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - # [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - # [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - # - # Notes: - # - A location may refer to a repeated field itself (i.e. not to any - # particular index within it). This is used whenever a set of elements are - # logically enclosed in a single code segment. For example, an entire - # extend block (possibly containing multiple extension definitions) will - # have an outer location whose path refers to the "extensions" repeated - # field without an index. - # - Multiple locations may have the same path. This happens when a single - # logical declaration is spread out across multiple places. The most - # obvious example is the "extend" block again -- there may be multiple - # extend blocks in the same scope, each of which will have the same path. - # - A location's span is not always a subset of its parent's span. For - # example, the "extendee" of an extension declaration appears at the - # beginning of the "extend" block and is shared by all extensions within - # the block. - # - Just because a location's span is a subset of some other location's span - # does not mean that it is a descendant. For example, a "group" defines - # both a type and a field in a single declaration. Thus, the locations - # corresponding to the type and field and their components will overlap. - # - Code which tries to interpret locations should probably be designed to - # ignore those that it doesn't understand, as more types of locations could - # be recorded in the future. @property - def location(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SourceCodeInfo.Location]: ... - def __init__(self, + def location(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SourceCodeInfo.Location]: + """A Location identifies a piece of source code in a .proto file which + corresponds to a particular definition. This information is intended + to be useful to IDEs, code indexers, documentation generators, and similar + tools. + + For example, say we have a file like: + message Foo { + optional string foo = 1; + } + Let's look at just the field definition: + optional string foo = 1; + ^ ^^ ^^ ^ ^^^ + a bc de f ghi + We have the following locations: + span path represents + [a,i) [ 4, 0, 2, 0 ] The whole field definition. + [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + + Notes: + - A location may refer to a repeated field itself (i.e. not to any + particular index within it). This is used whenever a set of elements are + logically enclosed in a single code segment. For example, an entire + extend block (possibly containing multiple extension definitions) will + have an outer location whose path refers to the "extensions" repeated + field without an index. + - Multiple locations may have the same path. This happens when a single + logical declaration is spread out across multiple places. The most + obvious example is the "extend" block again -- there may be multiple + extend blocks in the same scope, each of which will have the same path. + - A location's span is not always a subset of its parent's span. For + example, the "extendee" of an extension declaration appears at the + beginning of the "extend" block and is shared by all extensions within + the block. + - Just because a location's span is a subset of some other location's span + does not mean that it is a descendant. For example, a "group" defines + both a type and a field in a single declaration. Thus, the locations + corresponding to the type and field and their components will overlap. + - Code which tries to interpret locations should probably be designed to + ignore those that it doesn't understand, as more types of locations could + be recorded in the future. + """ + def __init__( + self, *, - location : typing.Optional[typing.Iterable[global___SourceCodeInfo.Location]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"location",b"location"]) -> None: ... + location: collections.abc.Iterable[global___SourceCodeInfo.Location] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["location", b"location"]) -> None: ... + global___SourceCodeInfo = SourceCodeInfo -# Describes the relationship between generated code and its original source -# file. A GeneratedCodeInfo message is associated with only one generated -# source file, but may contain references to different source .proto files. +@typing_extensions.final class GeneratedCodeInfo(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Describes the relationship between generated code and its original source + file. A GeneratedCodeInfo message is associated with only one generated + source file, but may contain references to different source .proto files. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + @typing_extensions.final class Annotation(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + PATH_FIELD_NUMBER: builtins.int SOURCE_FILE_FIELD_NUMBER: builtins.int BEGIN_FIELD_NUMBER: builtins.int END_FIELD_NUMBER: builtins.int - # Identifies the element in the original source .proto file. This field - # is formatted the same as SourceCodeInfo.Location.path. @property - def path(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... - # Identifies the filesystem path to the original source .proto. - source_file: typing.Text = ... - # Identifies the starting offset in bytes in the generated code - # that relates to the identified object. - begin: builtins.int = ... - # Identifies the ending offset in bytes in the generated code that - # relates to the identified offset. The end offset should be one past - # the last relevant byte (so the length of the text = end - begin). - end: builtins.int = ... - def __init__(self, + def path(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """Identifies the element in the original source .proto file. This field + is formatted the same as SourceCodeInfo.Location.path. + """ + source_file: builtins.str + """Identifies the filesystem path to the original source .proto.""" + begin: builtins.int + """Identifies the starting offset in bytes in the generated code + that relates to the identified object. + """ + end: builtins.int + """Identifies the ending offset in bytes in the generated code that + relates to the identified offset. The end offset should be one past + the last relevant byte (so the length of the text = end - begin). + """ + def __init__( + self, *, - path : typing.Optional[typing.Iterable[builtins.int]] = ..., - source_file : typing.Optional[typing.Text] = ..., - begin : typing.Optional[builtins.int] = ..., - end : typing.Optional[builtins.int] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"begin",b"begin",u"end",b"end",u"source_file",b"source_file"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"begin",b"begin",u"end",b"end",u"path",b"path",u"source_file",b"source_file"]) -> None: ... + path: collections.abc.Iterable[builtins.int] | None = ..., + source_file: builtins.str | None = ..., + begin: builtins.int | None = ..., + end: builtins.int | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["begin", b"begin", "end", b"end", "source_file", b"source_file"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["begin", b"begin", "end", b"end", "path", b"path", "source_file", b"source_file"]) -> None: ... ANNOTATION_FIELD_NUMBER: builtins.int - # An Annotation connects some span of text in generated code to an element - # of its generating .proto file. @property - def annotation(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GeneratedCodeInfo.Annotation]: ... - def __init__(self, + def annotation(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GeneratedCodeInfo.Annotation]: + """An Annotation connects some span of text in generated code to an element + of its generating .proto file. + """ + def __init__( + self, *, - annotation : typing.Optional[typing.Iterable[global___GeneratedCodeInfo.Annotation]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"annotation",b"annotation"]) -> None: ... + annotation: collections.abc.Iterable[global___GeneratedCodeInfo.Annotation] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["annotation", b"annotation"]) -> None: ... + global___GeneratedCodeInfo = GeneratedCodeInfo diff --git a/stubs/protobuf/google/protobuf/descriptor_pool.pyi b/stubs/protobuf/google/protobuf/descriptor_pool.pyi index aabe9d9..f1ecee7 100644 --- a/stubs/protobuf/google/protobuf/descriptor_pool.pyi +++ b/stubs/protobuf/google/protobuf/descriptor_pool.pyi @@ -1,8 +1,8 @@ -from typing import Any, Optional +from typing import Any class DescriptorPool: - def __new__(cls, descriptor_db: Optional[Any] = ...): ... - def __init__(self, descriptor_db: Optional[Any] = ...) -> None: ... + def __new__(cls, descriptor_db: Any | None = ...): ... + def __init__(self, descriptor_db: Any | None = ...) -> None: ... def Add(self, file_desc_proto): ... def AddSerializedFile(self, serialized_file_desc_proto): ... def AddDescriptor(self, desc): ... diff --git a/stubs/protobuf/google/protobuf/duration_pb2.pyi b/stubs/protobuf/google/protobuf/duration_pb2.pyi index c5773fd..d8f7931 100644 --- a/stubs/protobuf/google/protobuf/duration_pb2.pyi +++ b/stubs/protobuf/google/protobuf/duration_pb2.pyi @@ -1,92 +1,134 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins import google.protobuf.descriptor import google.protobuf.internal.well_known_types import google.protobuf.message -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -# A Duration represents a signed, fixed-length span of time represented -# as a count of seconds and fractions of seconds at nanosecond -# resolution. It is independent of any calendar and concepts like "day" -# or "month". It is related to Timestamp in that the difference between -# two Timestamp values is a Duration and it can be added or subtracted -# from a Timestamp. Range is approximately +-10,000 years. -# -# # Examples -# -# Example 1: Compute Duration from two Timestamps in pseudo code. -# -# Timestamp start = ...; -# Timestamp end = ...; -# Duration duration = ...; -# -# duration.seconds = end.seconds - start.seconds; -# duration.nanos = end.nanos - start.nanos; -# -# if (duration.seconds < 0 && duration.nanos > 0) { -# duration.seconds += 1; -# duration.nanos -= 1000000000; -# } else if (duration.seconds > 0 && duration.nanos < 0) { -# duration.seconds -= 1; -# duration.nanos += 1000000000; -# } -# -# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -# -# Timestamp start = ...; -# Duration duration = ...; -# Timestamp end = ...; -# -# end.seconds = start.seconds + duration.seconds; -# end.nanos = start.nanos + duration.nanos; -# -# if (end.nanos < 0) { -# end.seconds -= 1; -# end.nanos += 1000000000; -# } else if (end.nanos >= 1000000000) { -# end.seconds += 1; -# end.nanos -= 1000000000; -# } -# -# Example 3: Compute Duration from datetime.timedelta in Python. -# -# td = datetime.timedelta(days=3, minutes=10) -# duration = Duration() -# duration.FromTimedelta(td) -# -# # JSON Mapping -# -# In JSON format, the Duration type is encoded as a string rather than an -# object, where the string ends in the suffix "s" (indicating seconds) and -# is preceded by the number of seconds, with nanoseconds expressed as -# fractional seconds. For example, 3 seconds with 0 nanoseconds should be -# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should -# be expressed in JSON format as "3.000000001s", and 3 seconds and 1 -# microsecond should be expressed in JSON format as "3.000001s". +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final class Duration(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Duration): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """A Duration represents a signed, fixed-length span of time represented + as a count of seconds and fractions of seconds at nanosecond + resolution. It is independent of any calendar and concepts like "day" + or "month". It is related to Timestamp in that the difference between + two Timestamp values is a Duration and it can be added or subtracted + from a Timestamp. Range is approximately +-10,000 years. + + # Examples + + Example 1: Compute Duration from two Timestamps in pseudo code. + + Timestamp start = ...; + Timestamp end = ...; + Duration duration = ...; + + duration.seconds = end.seconds - start.seconds; + duration.nanos = end.nanos - start.nanos; + + if (duration.seconds < 0 && duration.nanos > 0) { + duration.seconds += 1; + duration.nanos -= 1000000000; + } else if (duration.seconds > 0 && duration.nanos < 0) { + duration.seconds -= 1; + duration.nanos += 1000000000; + } + + Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + + Timestamp start = ...; + Duration duration = ...; + Timestamp end = ...; + + end.seconds = start.seconds + duration.seconds; + end.nanos = start.nanos + duration.nanos; + + if (end.nanos < 0) { + end.seconds -= 1; + end.nanos += 1000000000; + } else if (end.nanos >= 1000000000) { + end.seconds += 1; + end.nanos -= 1000000000; + } + + Example 3: Compute Duration from datetime.timedelta in Python. + + td = datetime.timedelta(days=3, minutes=10) + duration = Duration() + duration.FromTimedelta(td) + + # JSON Mapping + + In JSON format, the Duration type is encoded as a string rather than an + object, where the string ends in the suffix "s" (indicating seconds) and + is preceded by the number of seconds, with nanoseconds expressed as + fractional seconds. For example, 3 seconds with 0 nanoseconds should be + encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + microsecond should be expressed in JSON format as "3.000001s". + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + SECONDS_FIELD_NUMBER: builtins.int NANOS_FIELD_NUMBER: builtins.int - # Signed seconds of the span of time. Must be from -315,576,000,000 - # to +315,576,000,000 inclusive. Note: these bounds are computed from: - # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - seconds: builtins.int = ... - # Signed fractions of a second at nanosecond resolution of the span - # of time. Durations less than one second are represented with a 0 - # `seconds` field and a positive or negative `nanos` field. For durations - # of one second or more, a non-zero value for the `nanos` field must be - # of the same sign as the `seconds` field. Must be from -999,999,999 - # to +999,999,999 inclusive. - nanos: builtins.int = ... - def __init__(self, + seconds: builtins.int + """Signed seconds of the span of time. Must be from -315,576,000,000 + to +315,576,000,000 inclusive. Note: these bounds are computed from: + 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + """ + nanos: builtins.int + """Signed fractions of a second at nanosecond resolution of the span + of time. Durations less than one second are represented with a 0 + `seconds` field and a positive or negative `nanos` field. For durations + of one second or more, a non-zero value for the `nanos` field must be + of the same sign as the `seconds` field. Must be from -999,999,999 + to +999,999,999 inclusive. + """ + def __init__( + self, *, - seconds : builtins.int = ..., - nanos : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"nanos",b"nanos",u"seconds",b"seconds"]) -> None: ... + seconds: builtins.int | None = ..., + nanos: builtins.int | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["nanos", b"nanos", "seconds", b"seconds"]) -> None: ... + global___Duration = Duration diff --git a/stubs/protobuf/google/protobuf/empty_pb2.pyi b/stubs/protobuf/google/protobuf/empty_pb2.pyi index 1d916e9..22ef26b 100644 --- a/stubs/protobuf/google/protobuf/empty_pb2.pyi +++ b/stubs/protobuf/google/protobuf/empty_pb2.pyi @@ -1,23 +1,62 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import google.protobuf.descriptor import google.protobuf.message +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -# A generic empty message that you can re-use to avoid defining duplicated -# empty messages in your APIs. A typical example is to use it as the request -# or the response type of an API method. For instance: -# -# service Foo { -# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -# } -# -# The JSON representation for `Empty` is empty JSON object `{}`. +@typing_extensions.final class Empty(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - def __init__(self, - ) -> None: ... + """A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use it as the request + or the response type of an API method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + def __init__( + self, + ) -> None: ... + global___Empty = Empty diff --git a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi index efa622a..1721c1b 100644 --- a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi +++ b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi @@ -1,225 +1,265 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins +import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.internal.well_known_types import google.protobuf.message -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -# `FieldMask` represents a set of symbolic field paths, for example: -# -# paths: "f.a" -# paths: "f.b.d" -# -# Here `f` represents a field in some root message, `a` and `b` -# fields in the message found in `f`, and `d` a field found in the -# message in `f.b`. -# -# Field masks are used to specify a subset of fields that should be -# returned by a get operation or modified by an update operation. -# Field masks also have a custom JSON encoding (see below). -# -# # Field Masks in Projections -# -# When used in the context of a projection, a response message or -# sub-message is filtered by the API to only contain those fields as -# specified in the mask. For example, if the mask in the previous -# example is applied to a response message as follows: -# -# f { -# a : 22 -# b { -# d : 1 -# x : 2 -# } -# y : 13 -# } -# z: 8 -# -# The result will not contain specific values for fields x,y and z -# (their value will be set to the default, and omitted in proto text -# output): -# -# -# f { -# a : 22 -# b { -# d : 1 -# } -# } -# -# A repeated field is not allowed except at the last position of a -# paths string. -# -# If a FieldMask object is not present in a get operation, the -# operation applies to all fields (as if a FieldMask of all fields -# had been specified). -# -# Note that a field mask does not necessarily apply to the -# top-level response message. In case of a REST get operation, the -# field mask applies directly to the response, but in case of a REST -# list operation, the mask instead applies to each individual message -# in the returned resource list. In case of a REST custom method, -# other definitions may be used. Where the mask applies will be -# clearly documented together with its declaration in the API. In -# any case, the effect on the returned resource/resources is required -# behavior for APIs. -# -# # Field Masks in Update Operations -# -# A field mask in update operations specifies which fields of the -# targeted resource are going to be updated. The API is required -# to only change the values of the fields as specified in the mask -# and leave the others untouched. If a resource is passed in to -# describe the updated values, the API ignores the values of all -# fields not covered by the mask. -# -# If a repeated field is specified for an update operation, new values will -# be appended to the existing repeated field in the target resource. Note that -# a repeated field is only allowed in the last position of a `paths` string. -# -# If a sub-message is specified in the last position of the field mask for an -# update operation, then new value will be merged into the existing sub-message -# in the target resource. -# -# For example, given the target message: -# -# f { -# b { -# d: 1 -# x: 2 -# } -# c: [1] -# } -# -# And an update message: -# -# f { -# b { -# d: 10 -# } -# c: [2] -# } -# -# then if the field mask is: -# -# paths: ["f.b", "f.c"] -# -# then the result will be: -# -# f { -# b { -# d: 10 -# x: 2 -# } -# c: [1, 2] -# } -# -# An implementation may provide options to override this default behavior for -# repeated and message fields. -# -# In order to reset a field's value to the default, the field must -# be in the mask and set to the default value in the provided resource. -# Hence, in order to reset all fields of a resource, provide a default -# instance of the resource and set all fields in the mask, or do -# not provide a mask as described below. -# -# If a field mask is not present on update, the operation applies to -# all fields (as if a field mask of all fields has been specified). -# Note that in the presence of schema evolution, this may mean that -# fields the client does not know and has therefore not filled into -# the request will be reset to their default. If this is unwanted -# behavior, a specific service may require a client to always specify -# a field mask, producing an error if not. -# -# As with get operations, the location of the resource which -# describes the updated values in the request message depends on the -# operation kind. In any case, the effect of the field mask is -# required to be honored by the API. -# -# ## Considerations for HTTP REST -# -# The HTTP kind of an update operation which uses a field mask must -# be set to PATCH instead of PUT in order to satisfy HTTP semantics -# (PUT must only be used for full updates). -# -# # JSON Encoding of Field Masks -# -# In JSON, a field mask is encoded as a single string where paths are -# separated by a comma. Fields name in each path are converted -# to/from lower-camel naming conventions. -# -# As an example, consider the following message declarations: -# -# message Profile { -# User user = 1; -# Photo photo = 2; -# } -# message User { -# string display_name = 1; -# string address = 2; -# } -# -# In proto a field mask for `Profile` may look as such: -# -# mask { -# paths: "user.display_name" -# paths: "photo" -# } -# -# In JSON, the same mask is represented as below: -# -# { -# mask: "user.displayName,photo" -# } -# -# # Field Masks and Oneof Fields -# -# Field masks treat fields in oneofs just as regular fields. Consider the -# following message: -# -# message SampleMessage { -# oneof test_oneof { -# string name = 4; -# SubMessage sub_message = 9; -# } -# } -# -# The field mask can be: -# -# mask { -# paths: "name" -# } -# -# Or: -# -# mask { -# paths: "sub_message" -# } -# -# Note that oneof type names ("test_oneof" in this case) cannot be used in -# paths. -# -# ## Field Mask Verification -# -# The implementation of any API method which has a FieldMask type field in the -# request should verify the included field paths, and return an -# `INVALID_ARGUMENT` error if any path is unmappable. +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final class FieldMask(google.protobuf.message.Message, google.protobuf.internal.well_known_types.FieldMask): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """`FieldMask` represents a set of symbolic field paths, for example: + + paths: "f.a" + paths: "f.b.d" + + Here `f` represents a field in some root message, `a` and `b` + fields in the message found in `f`, and `d` a field found in the + message in `f.b`. + + Field masks are used to specify a subset of fields that should be + returned by a get operation or modified by an update operation. + Field masks also have a custom JSON encoding (see below). + + # Field Masks in Projections + + When used in the context of a projection, a response message or + sub-message is filtered by the API to only contain those fields as + specified in the mask. For example, if the mask in the previous + example is applied to a response message as follows: + + f { + a : 22 + b { + d : 1 + x : 2 + } + y : 13 + } + z: 8 + + The result will not contain specific values for fields x,y and z + (their value will be set to the default, and omitted in proto text + output): + + + f { + a : 22 + b { + d : 1 + } + } + + A repeated field is not allowed except at the last position of a + paths string. + + If a FieldMask object is not present in a get operation, the + operation applies to all fields (as if a FieldMask of all fields + had been specified). + + Note that a field mask does not necessarily apply to the + top-level response message. In case of a REST get operation, the + field mask applies directly to the response, but in case of a REST + list operation, the mask instead applies to each individual message + in the returned resource list. In case of a REST custom method, + other definitions may be used. Where the mask applies will be + clearly documented together with its declaration in the API. In + any case, the effect on the returned resource/resources is required + behavior for APIs. + + # Field Masks in Update Operations + + A field mask in update operations specifies which fields of the + targeted resource are going to be updated. The API is required + to only change the values of the fields as specified in the mask + and leave the others untouched. If a resource is passed in to + describe the updated values, the API ignores the values of all + fields not covered by the mask. + + If a repeated field is specified for an update operation, new values will + be appended to the existing repeated field in the target resource. Note that + a repeated field is only allowed in the last position of a `paths` string. + + If a sub-message is specified in the last position of the field mask for an + update operation, then new value will be merged into the existing sub-message + in the target resource. + + For example, given the target message: + + f { + b { + d: 1 + x: 2 + } + c: [1] + } + + And an update message: + + f { + b { + d: 10 + } + c: [2] + } + + then if the field mask is: + + paths: ["f.b", "f.c"] + + then the result will be: + + f { + b { + d: 10 + x: 2 + } + c: [1, 2] + } + + An implementation may provide options to override this default behavior for + repeated and message fields. + + In order to reset a field's value to the default, the field must + be in the mask and set to the default value in the provided resource. + Hence, in order to reset all fields of a resource, provide a default + instance of the resource and set all fields in the mask, or do + not provide a mask as described below. + + If a field mask is not present on update, the operation applies to + all fields (as if a field mask of all fields has been specified). + Note that in the presence of schema evolution, this may mean that + fields the client does not know and has therefore not filled into + the request will be reset to their default. If this is unwanted + behavior, a specific service may require a client to always specify + a field mask, producing an error if not. + + As with get operations, the location of the resource which + describes the updated values in the request message depends on the + operation kind. In any case, the effect of the field mask is + required to be honored by the API. + + ## Considerations for HTTP REST + + The HTTP kind of an update operation which uses a field mask must + be set to PATCH instead of PUT in order to satisfy HTTP semantics + (PUT must only be used for full updates). + + # JSON Encoding of Field Masks + + In JSON, a field mask is encoded as a single string where paths are + separated by a comma. Fields name in each path are converted + to/from lower-camel naming conventions. + + As an example, consider the following message declarations: + + message Profile { + User user = 1; + Photo photo = 2; + } + message User { + string display_name = 1; + string address = 2; + } + + In proto a field mask for `Profile` may look as such: + + mask { + paths: "user.display_name" + paths: "photo" + } + + In JSON, the same mask is represented as below: + + { + mask: "user.displayName,photo" + } + + # Field Masks and Oneof Fields + + Field masks treat fields in oneofs just as regular fields. Consider the + following message: + + message SampleMessage { + oneof test_oneof { + string name = 4; + SubMessage sub_message = 9; + } + } + + The field mask can be: + + mask { + paths: "name" + } + + Or: + + mask { + paths: "sub_message" + } + + Note that oneof type names ("test_oneof" in this case) cannot be used in + paths. + + ## Field Mask Verification + + The implementation of any API method which has a FieldMask type field in the + request should verify the included field paths, and return an + `INVALID_ARGUMENT` error if any path is unmappable. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + PATHS_FIELD_NUMBER: builtins.int - # The set of field mask paths. @property - def paths(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - def __init__(self, + def paths(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: + """The set of field mask paths.""" + def __init__( + self, *, - paths : typing.Optional[typing.Iterable[typing.Text]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"paths",b"paths"]) -> None: ... + paths: collections.abc.Iterable[builtins.str] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["paths", b"paths"]) -> None: ... + global___FieldMask = FieldMask diff --git a/stubs/protobuf/google/protobuf/internal/api_implementation.pyi b/stubs/protobuf/google/protobuf/internal/api_implementation.pyi new file mode 100644 index 0000000..4940124 --- /dev/null +++ b/stubs/protobuf/google/protobuf/internal/api_implementation.pyi @@ -0,0 +1,3 @@ +def Type() -> str: ... +def Version() -> int: ... +def IsPythonDefaultSerializationDeterministic() -> bool: ... diff --git a/stubs/protobuf/google/protobuf/internal/containers.pyi b/stubs/protobuf/google/protobuf/internal/containers.pyi index 5e54051..ff2baea 100644 --- a/stubs/protobuf/google/protobuf/internal/containers.pyi +++ b/stubs/protobuf/google/protobuf/internal/containers.pyi @@ -1,27 +1,16 @@ -from typing import ( - Any, - Callable, - Iterable, - Iterator, - List, - Mapping as Mapping, - MutableMapping as MutableMapping, - Optional, - Sequence, - Text, - TypeVar, - Union, - overload, -) +from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence +from typing import Any, TypeVar, overload +from typing_extensions import SupportsIndex from google.protobuf.descriptor import Descriptor from google.protobuf.internal.message_listener import MessageListener from google.protobuf.internal.python_message import GeneratedProtocolMessageType +from google.protobuf.internal.type_checkers import _ValueChecker from google.protobuf.message import Message _T = TypeVar("_T") -_K = TypeVar("_K", bound=Union[bool, int, Text]) -_ScalarV = TypeVar("_ScalarV", bound=Union[bool, int, float, Text, bytes]) +_K = TypeVar("_K", bound=bool | int | str) +_ScalarV = TypeVar("_ScalarV", bound=bool | float | str | bytes) _MessageV = TypeVar("_MessageV", bound=Message) _M = TypeVar("_M") @@ -30,18 +19,17 @@ class BaseContainer(Sequence[_T]): def __len__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __hash__(self) -> int: ... - def __repr__(self) -> str: ... - def sort(self, *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> None: ... + def sort(self, *, key: Callable[[_T], Any] | None = ..., reverse: bool = ...) -> None: ... @overload - def __getitem__(self, key: int) -> _T: ... + def __getitem__(self, key: SupportsIndex) -> _T: ... @overload - def __getitem__(self, key: slice) -> List[_T]: ... + def __getitem__(self, key: slice) -> list[_T]: ... class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]): - def __init__(self, message_listener: MessageListener, message_descriptor: Descriptor) -> None: ... + def __init__(self, message_listener: MessageListener, type_checker: _ValueChecker[_ScalarV]) -> None: ... def append(self, value: _ScalarV) -> None: ... def insert(self, key: int, value: _ScalarV) -> None: ... - def extend(self, elem_seq: Optional[Iterable[_ScalarV]]) -> None: ... + def extend(self, elem_seq: Iterable[_ScalarV] | None) -> None: ... def MergeFrom(self: _M, other: _M) -> None: ... def remove(self, elem: _ScalarV) -> None: ... def pop(self, key: int = ...) -> _ScalarV: ... @@ -49,14 +37,11 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]): def __setitem__(self, key: int, value: _ScalarV) -> None: ... @overload def __setitem__(self, key: slice, value: Iterable[_ScalarV]) -> None: ... - def __getslice__(self, start: int, stop: int) -> List[_ScalarV]: ... - def __setslice__(self, start: int, stop: int, values: Iterable[_ScalarV]) -> None: ... - def __delitem__(self, key: Union[int, slice]) -> None: ... - def __delslice__(self, start: int, stop: int) -> None: ... + def __delitem__(self, key: int | slice) -> None: ... def __eq__(self, other: object) -> bool: ... class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]): - def __init__(self, message_listener: MessageListener, type_checker: Any) -> None: ... + def __init__(self, message_listener: MessageListener, message_descriptor: Descriptor) -> None: ... def add(self, **kwargs: Any) -> _MessageV: ... def append(self, value: _MessageV) -> None: ... def insert(self, key: int, value: _MessageV) -> None: ... @@ -64,29 +49,49 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]): def MergeFrom(self: _M, other: _M) -> None: ... def remove(self, elem: _MessageV) -> None: ... def pop(self, key: int = ...) -> _MessageV: ... - def __getslice__(self, start: int, stop: int) -> List[_MessageV]: ... - def __delitem__(self, key: Union[int, slice]) -> None: ... - def __delslice__(self, start: int, stop: int) -> None: ... + def __delitem__(self, key: int | slice) -> None: ... def __eq__(self, other: object) -> bool: ... class ScalarMap(MutableMapping[_K, _ScalarV]): + def __init__( + self, + message_listener: MessageListener, + key_checker: _ValueChecker[_K], + value_checker: _ValueChecker[_ScalarV], + entry_descriptor: Descriptor, + ) -> None: ... def __setitem__(self, k: _K, v: _ScalarV) -> None: ... def __delitem__(self, v: _K) -> None: ... def __getitem__(self, k: _K) -> _ScalarV: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_K]: ... def __eq__(self, other: object) -> bool: ... + @overload + def get(self, key: _K, default: None = ...) -> _ScalarV: ... + @overload + def get(self, key: _K, default: _ScalarV | _T) -> _ScalarV | _T: ... def MergeFrom(self: _M, other: _M): ... def InvalidateIterators(self) -> None: ... def GetEntryClass(self) -> GeneratedProtocolMessageType: ... class MessageMap(MutableMapping[_K, _MessageV]): + def __init__( + self, + message_listener: MessageListener, + message_descriptor: Descriptor, + key_checker: _ValueChecker[_K], + entry_descriptor: Descriptor, + ) -> None: ... def __setitem__(self, k: _K, v: _MessageV) -> None: ... def __delitem__(self, v: _K) -> None: ... def __getitem__(self, k: _K) -> _MessageV: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_K]: ... def __eq__(self, other: object) -> bool: ... + @overload + def get(self, key: _K, default: None = ...) -> _MessageV: ... + @overload + def get(self, key: _K, default: _MessageV | _T) -> _MessageV | _T: ... def get_or_create(self, key: _K) -> _MessageV: ... def MergeFrom(self: _M, other: _M): ... def InvalidateIterators(self) -> None: ... diff --git a/stubs/protobuf/google/protobuf/internal/decoder.pyi b/stubs/protobuf/google/protobuf/internal/decoder.pyi index 24774ee..41a5003 100644 --- a/stubs/protobuf/google/protobuf/internal/decoder.pyi +++ b/stubs/protobuf/google/protobuf/internal/decoder.pyi @@ -1,30 +1,63 @@ +from collections.abc import Callable from typing import Any +from typing_extensions import TypeAlias + +from google.protobuf.descriptor import Descriptor, FieldDescriptor +from google.protobuf.message import Message + +_Decoder: TypeAlias = Callable[[str, int, int, Message, dict[FieldDescriptor, Any]], int] +_NewDefault: TypeAlias = Callable[[Message], Message] def ReadTag(buffer, pos): ... -def EnumDecoder(field_number, is_repeated, is_packed, key, new_default): ... - -Int32Decoder: Any -Int64Decoder: Any -UInt32Decoder: Any -UInt64Decoder: Any -SInt32Decoder: Any -SInt64Decoder: Any -Fixed32Decoder: Any -Fixed64Decoder: Any -SFixed32Decoder: Any -SFixed64Decoder: Any -FloatDecoder: Any -DoubleDecoder: Any -BoolDecoder: Any - -def StringDecoder(field_number, is_repeated, is_packed, key, new_default): ... -def BytesDecoder(field_number, is_repeated, is_packed, key, new_default): ... -def GroupDecoder(field_number, is_repeated, is_packed, key, new_default): ... -def MessageDecoder(field_number, is_repeated, is_packed, key, new_default): ... - -MESSAGE_SET_ITEM_TAG: Any - -def MessageSetItemDecoder(extensions_by_number): ... -def MapDecoder(field_descriptor, new_default, is_message_map): ... + +Int32Decoder: _Decoder +Int64Decoder: _Decoder +UInt32Decoder: _Decoder +UInt64Decoder: _Decoder +SInt32Decoder: _Decoder +SInt64Decoder: _Decoder +Fixed32Decoder: _Decoder +Fixed64Decoder: _Decoder +SFixed32Decoder: _Decoder +SFixed64Decoder: _Decoder +FloatDecoder: _Decoder +DoubleDecoder: _Decoder +BoolDecoder: _Decoder + +def EnumDecoder( + field_number: int, + is_repeated: bool, + is_packed: bool, + key: FieldDescriptor, + new_default: _NewDefault, + clear_if_default: bool = ..., +) -> _Decoder: ... +def StringDecoder( + field_number: int, + is_repeated: bool, + is_packed: bool, + key: FieldDescriptor, + new_default: _NewDefault, + clear_if_default: bool = ..., +) -> _Decoder: ... +def BytesDecoder( + field_number: int, + is_repeated: bool, + is_packed: bool, + key: FieldDescriptor, + new_default: _NewDefault, + clear_if_default: bool = ..., +) -> _Decoder: ... +def GroupDecoder( + field_number: int, is_repeated: bool, is_packed: bool, key: FieldDescriptor, new_default: _NewDefault +) -> _Decoder: ... +def MessageDecoder( + field_number: int, is_repeated: bool, is_packed: bool, key: FieldDescriptor, new_default: _NewDefault +) -> _Decoder: ... + +MESSAGE_SET_ITEM_TAG: bytes + +def MessageSetItemDecoder(descriptor: Descriptor) -> _Decoder: ... +def MapDecoder(field_descriptor, new_default, is_message_map) -> _Decoder: ... SkipField: Any diff --git a/stubs/protobuf/google/protobuf/internal/encoder.pyi b/stubs/protobuf/google/protobuf/internal/encoder.pyi index 7a7923f..278478e 100644 --- a/stubs/protobuf/google/protobuf/internal/encoder.pyi +++ b/stubs/protobuf/google/protobuf/internal/encoder.pyi @@ -1,34 +1,41 @@ -from typing import Any +from collections.abc import Callable +from typing_extensions import TypeAlias -Int32Sizer: Any -UInt32Sizer: Any -SInt32Sizer: Any -Fixed32Sizer: Any -Fixed64Sizer: Any -BoolSizer: Any +from google.protobuf.descriptor import FieldDescriptor -def StringSizer(field_number, is_repeated, is_packed): ... -def BytesSizer(field_number, is_repeated, is_packed): ... -def GroupSizer(field_number, is_repeated, is_packed): ... -def MessageSizer(field_number, is_repeated, is_packed): ... -def MessageSetItemSizer(field_number): ... -def MapSizer(field_descriptor): ... -def TagBytes(field_number, wire_type): ... +_Sizer: TypeAlias = Callable[[int, bool, bool], int] -Int32Encoder: Any -UInt32Encoder: Any -SInt32Encoder: Any -Fixed32Encoder: Any -Fixed64Encoder: Any -SFixed32Encoder: Any -SFixed64Encoder: Any -FloatEncoder: Any -DoubleEncoder: Any +Int32Sizer: _Sizer +UInt32Sizer: _Sizer +SInt32Sizer: _Sizer +Fixed32Sizer: _Sizer +Fixed64Sizer: _Sizer +BoolSizer: _Sizer -def BoolEncoder(field_number, is_repeated, is_packed): ... -def StringEncoder(field_number, is_repeated, is_packed): ... -def BytesEncoder(field_number, is_repeated, is_packed): ... -def GroupEncoder(field_number, is_repeated, is_packed): ... -def MessageEncoder(field_number, is_repeated, is_packed): ... -def MessageSetItemEncoder(field_number): ... -def MapEncoder(field_descriptor): ... +def StringSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ... +def BytesSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ... +def GroupSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ... +def MessageSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ... +def MessageSetItemSizer(field_number: int) -> _Sizer: ... +def MapSizer(field_descriptor: FieldDescriptor, is_message_map: bool) -> _Sizer: ... +def TagBytes(field_number: int, wire_type: int) -> bytes: ... + +_Encoder: TypeAlias = Callable[[Callable[[bytes], int], bytes, bool], int] + +Int32Encoder: _Encoder +UInt32Encoder: _Encoder +SInt32Encoder: _Encoder +Fixed32Encoder: _Encoder +Fixed64Encoder: _Encoder +SFixed32Encoder: _Encoder +SFixed64Encoder: _Encoder +FloatEncoder: _Encoder +DoubleEncoder: _Encoder + +def BoolEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ... +def StringEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ... +def BytesEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ... +def GroupEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ... +def MessageEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ... +def MessageSetItemEncoder(field_number: int) -> _Encoder: ... +def MapEncoder(field_descriptor: FieldDescriptor) -> _Encoder: ... diff --git a/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi b/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi index f85bb54..18da7c2 100644 --- a/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi +++ b/stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi @@ -1,4 +1,4 @@ -from typing import Generic, List, Text, Tuple, TypeVar +from typing import Generic, TypeVar from google.protobuf.descriptor import EnumDescriptor @@ -10,9 +10,9 @@ class _EnumTypeWrapper(Generic[_V]): DESCRIPTOR: EnumDescriptor def __init__(self, enum_type: EnumDescriptor) -> None: ... def Name(self, number: _V) -> str: ... - def Value(self, name: Text | bytes) -> _V: ... - def keys(self) -> List[str]: ... - def values(self) -> List[_V]: ... - def items(self) -> List[Tuple[str, _V]]: ... + def Value(self, name: str | bytes) -> _V: ... + def keys(self) -> list[str]: ... + def values(self) -> list[_V]: ... + def items(self) -> list[tuple[str, _V]]: ... class EnumTypeWrapper(_EnumTypeWrapper[int]): ... diff --git a/stubs/protobuf/google/protobuf/internal/extension_dict.pyi b/stubs/protobuf/google/protobuf/internal/extension_dict.pyi index 486e367..ecf56a3 100644 --- a/stubs/protobuf/google/protobuf/internal/extension_dict.pyi +++ b/stubs/protobuf/google/protobuf/internal/extension_dict.pyi @@ -1,4 +1,5 @@ -from typing import Any, Generic, Iterator, Text, TypeVar, Union +from collections.abc import Iterator +from typing import Any, Generic, TypeVar from google.protobuf.descriptor import FieldDescriptor from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer @@ -7,7 +8,7 @@ from google.protobuf.message import Message _ContainerMessageT = TypeVar("_ContainerMessageT", bound=Message) _ExtenderMessageT = TypeVar( "_ExtenderMessageT", - bound=Union[Message, RepeatedScalarFieldContainer[Any], RepeatedCompositeFieldContainer[Any], bool, int, float, Text, bytes], + bound=Message | RepeatedScalarFieldContainer[Any] | RepeatedCompositeFieldContainer[Any] | bool | float | str | bytes, ) class _ExtensionFieldDescriptor(FieldDescriptor, Generic[_ContainerMessageT, _ExtenderMessageT]): ... diff --git a/stubs/protobuf/google/protobuf/internal/message_listener.pyi b/stubs/protobuf/google/protobuf/internal/message_listener.pyi index e8d33a5..01c3be0 100644 --- a/stubs/protobuf/google/protobuf/internal/message_listener.pyi +++ b/stubs/protobuf/google/protobuf/internal/message_listener.pyi @@ -1,4 +1,4 @@ -class MessageListener(object): +class MessageListener: def Modified(self) -> None: ... class NullMessageListener(MessageListener): diff --git a/stubs/protobuf/google/protobuf/internal/python_message.pyi b/stubs/protobuf/google/protobuf/internal/python_message.pyi index 538d70b..0395ff6 100644 --- a/stubs/protobuf/google/protobuf/internal/python_message.pyi +++ b/stubs/protobuf/google/protobuf/internal/python_message.pyi @@ -1 +1,3 @@ -class GeneratedProtocolMessageType(type): ... +class GeneratedProtocolMessageType(type): + def __new__(cls, name, bases, dictionary): ... + def __init__(cls, name, bases, dictionary): ... diff --git a/stubs/protobuf/google/protobuf/internal/type_checkers.pyi b/stubs/protobuf/google/protobuf/internal/type_checkers.pyi new file mode 100644 index 0000000..fbcc35e --- /dev/null +++ b/stubs/protobuf/google/protobuf/internal/type_checkers.pyi @@ -0,0 +1,15 @@ +from typing import Generic, Protocol, TypeVar + +_T = TypeVar("_T") + +class _ValueChecker(Protocol[_T]): + def CheckValue(self, proposed_value: _T) -> _T: ... + def DefaultValue(self) -> _T: ... + +class TypeChecker(Generic[_T]): + def __init__(self, *acceptable_types: _T): ... + def CheckValue(self, proposed_value: _T) -> _T: ... + +class TypeCheckerWithDefault(TypeChecker[_T]): + def __init__(self, default_value: _T, *acceptable_types: _T): ... + def DefaultValue(self) -> _T: ... diff --git a/stubs/protobuf/google/protobuf/internal/well_known_types.pyi b/stubs/protobuf/google/protobuf/internal/well_known_types.pyi index 6b6b95a..c198cde 100644 --- a/stubs/protobuf/google/protobuf/internal/well_known_types.pyi +++ b/stubs/protobuf/google/protobuf/internal/well_known_types.pyi @@ -1,13 +1,10 @@ -from datetime import datetime, timedelta -from typing import Any as tAny, Dict, Optional, Type - -class Error(Exception): ... -class ParseError(Error): ... +from datetime import datetime, timedelta, tzinfo +from typing import Any as tAny class Any: type_url: tAny = ... value: tAny = ... - def Pack(self, msg: tAny, type_url_prefix: bytes = ..., deterministic: Optional[tAny] = ...) -> None: ... + def Pack(self, msg: tAny, type_url_prefix: str = ..., deterministic: tAny | None = ...) -> None: ... def Unpack(self, msg: tAny): ... def TypeName(self): ... def Is(self, descriptor: tAny): ... @@ -26,7 +23,7 @@ class Timestamp: def FromMicroseconds(self, micros: int) -> None: ... def FromMilliseconds(self, millis: int) -> None: ... def FromSeconds(self, seconds: int) -> None: ... - def ToDatetime(self) -> datetime: ... + def ToDatetime(self, tzinfo: tzinfo | None = ...) -> datetime: ... def FromDatetime(self, dt: datetime) -> None: ... class Duration: @@ -58,7 +55,7 @@ class FieldMask: ) -> None: ... class _FieldMaskTree: - def __init__(self, field_mask: Optional[tAny] = ...) -> None: ... + def __init__(self, field_mask: tAny | None = ...) -> None: ... def MergeFromFieldMask(self, field_mask: tAny) -> None: ... def AddPath(self, path: tAny): ... def ToFieldMask(self, field_mask: tAny) -> None: ... @@ -91,4 +88,4 @@ class ListValue: def add_struct(self): ... def add_list(self): ... -WKTBASES: Dict[str, Type[tAny]] +WKTBASES: dict[str, type[tAny]] diff --git a/stubs/protobuf/google/protobuf/json_format.pyi b/stubs/protobuf/google/protobuf/json_format.pyi index 75fda13..62ad1ba 100644 --- a/stubs/protobuf/google/protobuf/json_format.pyi +++ b/stubs/protobuf/google/protobuf/json_format.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, Text, TypeVar, Union +from typing import Any, TypeVar from google.protobuf.descriptor_pool import DescriptorPool from google.protobuf.message import Message @@ -13,26 +13,32 @@ def MessageToJson( message: Message, including_default_value_fields: bool = ..., preserving_proto_field_name: bool = ..., - indent: int = ..., + indent: int | None = ..., sort_keys: bool = ..., use_integers_for_enums: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., - float_precision: Optional[int] = ..., + descriptor_pool: DescriptorPool | None = ..., + float_precision: int | None = ..., + ensure_ascii: bool = ..., ) -> str: ... def MessageToDict( message: Message, including_default_value_fields: bool = ..., preserving_proto_field_name: bool = ..., use_integers_for_enums: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., - float_precision: Optional[int] = ..., -) -> Dict[Text, Any]: ... + descriptor_pool: DescriptorPool | None = ..., + float_precision: int | None = ..., +) -> dict[str, Any]: ... def Parse( - text: Union[bytes, Text], + text: bytes | str, message: _MessageT, ignore_unknown_fields: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., + max_recursion_depth: int = ..., ) -> _MessageT: ... def ParseDict( - js_dict: Any, message: _MessageT, ignore_unknown_fields: bool = ..., descriptor_pool: Optional[DescriptorPool] = ... + js_dict: Any, + message: _MessageT, + ignore_unknown_fields: bool = ..., + descriptor_pool: DescriptorPool | None = ..., + max_recursion_depth: int = ..., ) -> _MessageT: ... diff --git a/stubs/protobuf/google/protobuf/message.pyi b/stubs/protobuf/google/protobuf/message.pyi index 8d63932..8a90d7c 100644 --- a/stubs/protobuf/google/protobuf/message.pyi +++ b/stubs/protobuf/google/protobuf/message.pyi @@ -1,5 +1,6 @@ -import sys -from typing import Any, ByteString, Sequence, Tuple, Type, TypeVar, Union +from _typeshed import Self +from collections.abc import Sequence +from typing import Any, TypeVar from .descriptor import Descriptor, FieldDescriptor from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor @@ -10,33 +11,30 @@ class EncodeError(Error): ... _M = TypeVar("_M", bound=Message) # message type (of self) -if sys.version_info >= (3, 0): - _Serialized = ByteString -else: - _Serialized = Union[bytes, buffer, unicode] - class Message: DESCRIPTOR: Descriptor - def __deepcopy__(self, memo=...): ... + def __deepcopy__(self: Self, memo: Any = ...) -> Self: ... def __eq__(self, other_msg): ... def __ne__(self, other_msg): ... - def MergeFrom(self: _M, other_msg: _M) -> None: ... - def CopyFrom(self: _M, other_msg: _M) -> None: ... + def MergeFrom(self: Self, other_msg: Self) -> None: ... + def CopyFrom(self: Self, other_msg: Self) -> None: ... def Clear(self) -> None: ... def SetInParent(self) -> None: ... def IsInitialized(self) -> bool: ... - def MergeFromString(self, serialized: _Serialized) -> int: ... - def ParseFromString(self, serialized: _Serialized) -> int: ... + def MergeFromString(self, serialized: bytes) -> int: ... + def ParseFromString(self, serialized: bytes) -> int: ... def SerializeToString(self, deterministic: bool = ...) -> bytes: ... def SerializePartialToString(self, deterministic: bool = ...) -> bytes: ... - def ListFields(self) -> Sequence[Tuple[FieldDescriptor, Any]]: ... + def ListFields(self) -> Sequence[tuple[FieldDescriptor, Any]]: ... + # The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `HasExtension` & `ClearExtension` def HasExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> bool: ... def ClearExtension(self: _M, extension_handle: _ExtensionFieldDescriptor[_M, Any]) -> None: ... - def ByteSize(self) -> int: ... - @classmethod - def FromString(cls: Type[_M], s: _Serialized) -> _M: ... + # The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `Extensions` @property def Extensions(self: _M) -> _ExtensionDict[_M]: ... + def ByteSize(self) -> int: ... + @classmethod + def FromString(cls: type[Self], s: bytes) -> Self: ... # Intentionally left out typing on these three methods, because they are # stringly typed and it is not useful to call them on a Message directly. # We prefer more specific typing on individual subclasses of Message @@ -45,4 +43,4 @@ class Message: def ClearField(self, field_name: Any) -> None: ... def WhichOneof(self, oneof_group: Any) -> Any: ... # TODO: check kwargs - def __init__(self, **kwargs) -> None: ... + def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/protobuf/google/protobuf/message_factory.pyi b/stubs/protobuf/google/protobuf/message_factory.pyi index d8a42d3..5493ea8 100644 --- a/stubs/protobuf/google/protobuf/message_factory.pyi +++ b/stubs/protobuf/google/protobuf/message_factory.pyi @@ -1,4 +1,5 @@ -from typing import Any, Dict, Iterable, Optional, Type +from collections.abc import Iterable +from typing import Any from google.protobuf.descriptor import Descriptor from google.protobuf.descriptor_pb2 import FileDescriptorProto @@ -7,8 +8,8 @@ from google.protobuf.message import Message class MessageFactory: pool: Any - def __init__(self, pool: Optional[DescriptorPool] = ...) -> None: ... - def GetPrototype(self, descriptor: Descriptor) -> Type[Message]: ... - def GetMessages(self, files: Iterable[str]) -> Dict[str, Type[Message]]: ... + def __init__(self, pool: DescriptorPool | None = ...) -> None: ... + def GetPrototype(self, descriptor: Descriptor) -> type[Message]: ... + def GetMessages(self, files: Iterable[str]) -> dict[str, type[Message]]: ... -def GetMessages(file_protos: Iterable[FileDescriptorProto]) -> Dict[str, Type[Message]]: ... +def GetMessages(file_protos: Iterable[FileDescriptorProto]) -> dict[str, type[Message]]: ... diff --git a/stubs/protobuf/google/protobuf/reflection.pyi b/stubs/protobuf/google/protobuf/reflection.pyi index 3ca5055..4bfbd2f 100644 --- a/stubs/protobuf/google/protobuf/reflection.pyi +++ b/stubs/protobuf/google/protobuf/reflection.pyi @@ -1,6 +1,6 @@ class GeneratedProtocolMessageType(type): def __new__(cls, name, bases, dictionary): ... - def __init__(self, name, bases, dictionary) -> None: ... + def __init__(__self, name, bases, dictionary) -> None: ... def ParseMessage(descriptor, byte_str): ... def MakeClass(descriptor): ... diff --git a/stubs/protobuf/google/protobuf/service.pyi b/stubs/protobuf/google/protobuf/service.pyi index 4874d53..1123b61 100644 --- a/stubs/protobuf/google/protobuf/service.pyi +++ b/stubs/protobuf/google/protobuf/service.pyi @@ -1,5 +1,5 @@ +from collections.abc import Callable from concurrent.futures import Future -from typing import Callable, Optional, Text, Type from google.protobuf.descriptor import MethodDescriptor, ServiceDescriptor from google.protobuf.message import Message @@ -14,17 +14,17 @@ class Service: method_descriptor: MethodDescriptor, rpc_controller: RpcController, request: Message, - done: Optional[Callable[[Message], None]], - ) -> Optional[Future[Message]]: ... - def GetRequestClass(self, method_descriptor: MethodDescriptor) -> Type[Message]: ... - def GetResponseClass(self, method_descriptor: MethodDescriptor) -> Type[Message]: ... + done: Callable[[Message], None] | None, + ) -> Future[Message] | None: ... + def GetRequestClass(self, method_descriptor: MethodDescriptor) -> type[Message]: ... + def GetResponseClass(self, method_descriptor: MethodDescriptor) -> type[Message]: ... class RpcController: def Reset(self) -> None: ... def Failed(self) -> bool: ... - def ErrorText(self) -> Optional[Text]: ... + def ErrorText(self) -> str | None: ... def StartCancel(self) -> None: ... - def SetFailed(self, reason: Text) -> None: ... + def SetFailed(self, reason: str) -> None: ... def IsCanceled(self) -> bool: ... def NotifyOnCancel(self, callback: Callable[[], None]) -> None: ... @@ -34,6 +34,6 @@ class RpcChannel: method_descriptor: MethodDescriptor, rpc_controller: RpcController, request: Message, - response_class: Type[Message], - done: Optional[Callable[[Message], None]], - ) -> Optional[Future[Message]]: ... + response_class: type[Message], + done: Callable[[Message], None] | None, + ) -> Future[Message] | None: ... diff --git a/stubs/protobuf/google/protobuf/source_context_pb2.pyi b/stubs/protobuf/google/protobuf/source_context_pb2.pyi index 07e1a4c..cb4fb57 100644 --- a/stubs/protobuf/google/protobuf/source_context_pb2.pyi +++ b/stubs/protobuf/google/protobuf/source_context_pb2.pyi @@ -1,26 +1,66 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins import google.protobuf.descriptor import google.protobuf.message -import typing -import typing_extensions +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -# `SourceContext` represents information about the source of a -# protobuf element, like the file in which it is defined. +@typing_extensions.final class SourceContext(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """`SourceContext` represents information about the source of a + protobuf element, like the file in which it is defined. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + FILE_NAME_FIELD_NUMBER: builtins.int - # The path-qualified name of the .proto file that contained the associated - # protobuf element. For example: `"google/protobuf/source_context.proto"`. - file_name: typing.Text = ... - def __init__(self, + file_name: builtins.str + """The path-qualified name of the .proto file that contained the associated + protobuf element. For example: `"google/protobuf/source_context.proto"`. + """ + def __init__( + self, *, - file_name : typing.Text = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"file_name",b"file_name"]) -> None: ... + file_name: builtins.str | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["file_name", b"file_name"]) -> None: ... + global___SourceContext = SourceContext diff --git a/stubs/protobuf/google/protobuf/struct_pb2.pyi b/stubs/protobuf/google/protobuf/struct_pb2.pyi index d6f93a3..bf2771e 100644 --- a/stubs/protobuf/google/protobuf/struct_pb2.pyi +++ b/stubs/protobuf/google/protobuf/struct_pb2.pyi @@ -1,126 +1,184 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins +import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.internal.well_known_types import google.protobuf.message +import sys import typing -import typing_extensions -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -# `NullValue` is a singleton enumeration to represent the null value for the -# `Value` type union. -# -# The JSON representation for `NullValue` is JSON `null`. -class NullValue(_NullValue, metaclass=_NullValueEnumTypeWrapper): - pass class _NullValue: - V = typing.NewType('V', builtins.int) -class _NullValueEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_NullValue.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # Null value. - NULL_VALUE = NullValue.V(0) - -# Null value. -NULL_VALUE = NullValue.V(0) -global___NullValue = NullValue + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + +class _NullValueEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_NullValue.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + NULL_VALUE: _NullValue.ValueType # 0 + """Null value.""" +class NullValue(_NullValue, metaclass=_NullValueEnumTypeWrapper): + """`NullValue` is a singleton enumeration to represent the null value for the + `Value` type union. + + The JSON representation for `NullValue` is JSON `null`. + """ + +NULL_VALUE: NullValue.ValueType # 0 +"""Null value.""" +global___NullValue = NullValue -# `Struct` represents a structured data value, consisting of fields -# which map to dynamically typed values. In some languages, `Struct` -# might be supported by a native representation. For example, in -# scripting languages like JS a struct is represented as an -# object. The details of that representation are described together -# with the proto support for the language. -# -# The JSON representation for `Struct` is JSON object. +@typing_extensions.final class Struct(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Struct): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """`Struct` represents a structured data value, consisting of fields + which map to dynamically typed values. In some languages, `Struct` + might be supported by a native representation. For example, in + scripting languages like JS a struct is represented as an + object. The details of that representation are described together + with the proto support for the language. + + The JSON representation for `Struct` is JSON object. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + @typing_extensions.final class FieldsEntry(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + DESCRIPTOR: google.protobuf.descriptor.Descriptor + KEY_FIELD_NUMBER: builtins.int VALUE_FIELD_NUMBER: builtins.int - key: typing.Text = ... + key: builtins.str @property def value(self) -> global___Value: ... - def __init__(self, + def __init__( + self, *, - key : typing.Text = ..., - value : typing.Optional[global___Value] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"key",b"key",u"value",b"value"]) -> None: ... + key: builtins.str | None = ..., + value: global___Value | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... FIELDS_FIELD_NUMBER: builtins.int - # Unordered map of dynamically typed values. @property - def fields(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, global___Value]: ... - def __init__(self, + def fields(self) -> google.protobuf.internal.containers.MessageMap[builtins.str, global___Value]: + """Unordered map of dynamically typed values.""" + def __init__( + self, *, - fields : typing.Optional[typing.Mapping[typing.Text, global___Value]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"fields",b"fields"]) -> None: ... + fields: collections.abc.Mapping[builtins.str, global___Value] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["fields", b"fields"]) -> None: ... + global___Struct = Struct -# `Value` represents a dynamically typed value which can be either -# null, a number, a string, a boolean, a recursive struct value, or a -# list of values. A producer of value is expected to set one of that -# variants, absence of any variant indicates an error. -# -# The JSON representation for `Value` is JSON value. +@typing_extensions.final class Value(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """`Value` represents a dynamically typed value which can be either + null, a number, a string, a boolean, a recursive struct value, or a + list of values. A producer of value is expected to set one of these + variants. Absence of any variant indicates an error. + + The JSON representation for `Value` is JSON value. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NULL_VALUE_FIELD_NUMBER: builtins.int NUMBER_VALUE_FIELD_NUMBER: builtins.int STRING_VALUE_FIELD_NUMBER: builtins.int BOOL_VALUE_FIELD_NUMBER: builtins.int STRUCT_VALUE_FIELD_NUMBER: builtins.int LIST_VALUE_FIELD_NUMBER: builtins.int - # Represents a null value. - null_value: global___NullValue.V = ... - # Represents a double value. - number_value: builtins.float = ... - # Represents a string value. - string_value: typing.Text = ... - # Represents a boolean value. - bool_value: builtins.bool = ... - # Represents a structured value. + null_value: global___NullValue.ValueType + """Represents a null value.""" + number_value: builtins.float + """Represents a double value.""" + string_value: builtins.str + """Represents a string value.""" + bool_value: builtins.bool + """Represents a boolean value.""" @property - def struct_value(self) -> global___Struct: ... - # Represents a repeated `Value`. + def struct_value(self) -> global___Struct: + """Represents a structured value.""" @property - def list_value(self) -> global___ListValue: ... - def __init__(self, + def list_value(self) -> global___ListValue: + """Represents a repeated `Value`.""" + def __init__( + self, *, - null_value : global___NullValue.V = ..., - number_value : builtins.float = ..., - string_value : typing.Text = ..., - bool_value : builtins.bool = ..., - struct_value : typing.Optional[global___Struct] = ..., - list_value : typing.Optional[global___ListValue] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"bool_value",b"bool_value",u"kind",b"kind",u"list_value",b"list_value",u"null_value",b"null_value",u"number_value",b"number_value",u"string_value",b"string_value",u"struct_value",b"struct_value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"bool_value",b"bool_value",u"kind",b"kind",u"list_value",b"list_value",u"null_value",b"null_value",u"number_value",b"number_value",u"string_value",b"string_value",u"struct_value",b"struct_value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal[u"kind",b"kind"]) -> typing.Optional[typing_extensions.Literal["null_value","number_value","string_value","bool_value","struct_value","list_value"]]: ... + null_value: global___NullValue.ValueType | None = ..., + number_value: builtins.float | None = ..., + string_value: builtins.str | None = ..., + bool_value: builtins.bool | None = ..., + struct_value: global___Struct | None = ..., + list_value: global___ListValue | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["bool_value", b"bool_value", "kind", b"kind", "list_value", b"list_value", "null_value", b"null_value", "number_value", b"number_value", "string_value", b"string_value", "struct_value", b"struct_value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["bool_value", b"bool_value", "kind", b"kind", "list_value", b"list_value", "null_value", b"null_value", "number_value", b"number_value", "string_value", b"string_value", "struct_value", b"struct_value"]) -> None: ... + def WhichOneof(self, oneof_group: typing_extensions.Literal["kind", b"kind"]) -> typing_extensions.Literal["null_value", "number_value", "string_value", "bool_value", "struct_value", "list_value"] | None: ... + global___Value = Value -# `ListValue` is a wrapper around a repeated field of values. -# -# The JSON representation for `ListValue` is JSON array. +@typing_extensions.final class ListValue(google.protobuf.message.Message, google.protobuf.internal.well_known_types.ListValue): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """`ListValue` is a wrapper around a repeated field of values. + + The JSON representation for `ListValue` is JSON array. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUES_FIELD_NUMBER: builtins.int - # Repeated field of dynamically typed values. @property - def values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Value]: ... - def __init__(self, + def values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Value]: + """Repeated field of dynamically typed values.""" + def __init__( + self, *, - values : typing.Optional[typing.Iterable[global___Value]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"values",b"values"]) -> None: ... + values: collections.abc.Iterable[global___Value] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["values", b"values"]) -> None: ... + global___ListValue = ListValue diff --git a/stubs/protobuf/google/protobuf/symbol_database.pyi b/stubs/protobuf/google/protobuf/symbol_database.pyi index 09e32e9..828138d 100644 --- a/stubs/protobuf/google/protobuf/symbol_database.pyi +++ b/stubs/protobuf/google/protobuf/symbol_database.pyi @@ -1,16 +1,16 @@ -from typing import Dict, Iterable, Type, Union +from collections.abc import Iterable from google.protobuf.descriptor import Descriptor, EnumDescriptor, FileDescriptor, ServiceDescriptor from google.protobuf.message import Message from google.protobuf.message_factory import MessageFactory class SymbolDatabase(MessageFactory): - def RegisterMessage(self, message: Union[Type[Message], Message]) -> Union[Type[Message], Message]: ... + def RegisterMessage(self, message: type[Message] | Message) -> type[Message] | Message: ... def RegisterMessageDescriptor(self, message_descriptor: Descriptor) -> None: ... def RegisterEnumDescriptor(self, enum_descriptor: EnumDescriptor) -> EnumDescriptor: ... def RegisterServiceDescriptor(self, service_descriptor: ServiceDescriptor) -> None: ... def RegisterFileDescriptor(self, file_descriptor: FileDescriptor) -> None: ... - def GetSymbol(self, symbol: str) -> Type[Message]: ... - def GetMessages(self, files: Iterable[str]) -> Dict[str, Type[Message]]: ... + def GetSymbol(self, symbol: str) -> type[Message]: ... + def GetMessages(self, files: Iterable[str]) -> dict[str, type[Message]]: ... def Default(): ... diff --git a/stubs/protobuf/google/protobuf/text_format.pyi b/stubs/protobuf/google/protobuf/text_format.pyi index 7fe57b6..3cd2459 100644 --- a/stubs/protobuf/google/protobuf/text_format.pyi +++ b/stubs/protobuf/google/protobuf/text_format.pyi @@ -1,30 +1,28 @@ -import sys from _typeshed import SupportsWrite -from typing import Any, Callable, Iterable, Optional, Text, Tuple, TypeVar, Union +from collections.abc import Callable, Iterable +from typing import Any, TypeVar +from typing_extensions import TypeAlias from .descriptor import FieldDescriptor from .descriptor_pool import DescriptorPool from .message import Message -if sys.version_info < (3, 0): - long = int - _M = TypeVar("_M", bound=Message) # message type (of self) class Error(Exception): ... class ParseError(Error): - def __init__(self, message: Optional[str] = ..., line: Optional[int] = ..., column: Optional[int] = ...) -> None: ... - def GetLine(self) -> Optional[int]: ... - def GetColumn(self) -> Optional[int]: ... + def __init__(self, message: str | None = ..., line: int | None = ..., column: int | None = ...) -> None: ... + def GetLine(self) -> int | None: ... + def GetColumn(self) -> int | None: ... class TextWriter: def __init__(self, as_utf8: bool) -> None: ... - def write(self, val: Text) -> int: ... + def write(self, val: str) -> int: ... def getvalue(self) -> str: ... def close(self) -> None: ... -_MessageFormatter = Callable[[Message, int, bool], Optional[Text]] +_MessageFormatter: TypeAlias = Callable[[Message, int, bool], str | None] def MessageToString( message: Message, @@ -33,12 +31,12 @@ def MessageToString( use_short_repeated_primitives: bool = ..., pointy_brackets: bool = ..., use_index_order: bool = ..., - float_format: Optional[str] = ..., - double_format: Optional[str] = ..., + float_format: str | None = ..., + double_format: str | None = ..., use_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., indent: int = ..., - message_formatter: Optional[_MessageFormatter] = ..., + message_formatter: _MessageFormatter | None = ..., print_unknown_fields: bool = ..., force_colon: bool = ..., ) -> str: ... @@ -49,10 +47,10 @@ def MessageToBytes( use_short_repeated_primitives: bool = ..., pointy_brackets: bool = ..., use_index_order: bool = ..., - float_format: Optional[str] = ..., - double_format: Optional[str] = ..., + float_format: str | None = ..., + double_format: str | None = ..., use_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., indent: int = ..., message_formatter: _MessageFormatter = ..., print_unknown_fields: bool = ..., @@ -67,11 +65,11 @@ def PrintMessage( use_short_repeated_primitives: bool = ..., pointy_brackets: bool = ..., use_index_order: bool = ..., - float_format: Optional[str] = ..., - double_format: Optional[str] = ..., + float_format: str | None = ..., + double_format: str | None = ..., use_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., - message_formatter: Optional[_MessageFormatter] = ..., + descriptor_pool: DescriptorPool | None = ..., + message_formatter: _MessageFormatter | None = ..., print_unknown_fields: bool = ..., force_colon: bool = ..., ) -> None: ... @@ -85,9 +83,9 @@ def PrintField( use_short_repeated_primitives: bool = ..., pointy_brackets: bool = ..., use_index_order: bool = ..., - float_format: Optional[str] = ..., - double_format: Optional[str] = ..., - message_formatter: Optional[_MessageFormatter] = ..., + float_format: str | None = ..., + double_format: str | None = ..., + message_formatter: _MessageFormatter | None = ..., print_unknown_fields: bool = ..., force_colon: bool = ..., ) -> None: ... @@ -101,9 +99,9 @@ def PrintFieldValue( use_short_repeated_primitives: bool = ..., pointy_brackets: bool = ..., use_index_order: bool = ..., - float_format: Optional[str] = ..., - double_format: Optional[str] = ..., - message_formatter: Optional[_MessageFormatter] = ..., + float_format: str | None = ..., + double_format: str | None = ..., + message_formatter: _MessageFormatter | None = ..., print_unknown_fields: bool = ..., force_colon: bool = ..., ) -> None: ... @@ -116,11 +114,11 @@ class _Printer: use_short_repeated_primitives: bool = ... pointy_brackets: bool = ... use_index_order: bool = ... - float_format: Optional[str] = ... - double_format: Optional[str] = ... + float_format: str | None = ... + double_format: str | None = ... use_field_number: bool = ... - descriptor_pool: Optional[DescriptorPool] = ... - message_formatter: Optional[_MessageFormatter] = ... + descriptor_pool: DescriptorPool | None = ... + message_formatter: _MessageFormatter | None = ... print_unknown_fields: bool = ... force_colon: bool = ... def __init__( @@ -132,11 +130,11 @@ class _Printer: use_short_repeated_primitives: bool = ..., pointy_brackets: bool = ..., use_index_order: bool = ..., - float_format: Optional[str] = ..., - double_format: Optional[str] = ..., + float_format: str | None = ..., + double_format: str | None = ..., use_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., - message_formatter: Optional[_MessageFormatter] = ..., + descriptor_pool: DescriptorPool | None = ..., + message_formatter: _MessageFormatter | None = ..., print_unknown_fields: bool = ..., force_colon: bool = ..., ) -> None: ... @@ -145,46 +143,46 @@ class _Printer: def PrintFieldValue(self, field: FieldDescriptor, value: Any) -> None: ... def Parse( - text: Union[Text, bytes], + text: str | bytes, message: _M, allow_unknown_extension: bool = ..., allow_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., allow_unknown_field: bool = ..., ) -> _M: ... def Merge( - text: Union[Text, bytes], + text: str | bytes, message: _M, allow_unknown_extension: bool = ..., allow_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., allow_unknown_field: bool = ..., ) -> _M: ... def MergeLines( - lines: Iterable[Union[Text, bytes]], + lines: Iterable[str | bytes], message: _M, allow_unknown_extension: bool = ..., allow_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., allow_unknown_field: bool = ..., ) -> _M: ... class _Parser: allow_unknown_extension: bool = ... allow_field_number: bool = ... - descriptor_pool: Optional[DescriptorPool] = ... + descriptor_pool: DescriptorPool | None = ... allow_unknown_field: bool = ... def __init__( self, allow_unknown_extension: bool = ..., allow_field_number: bool = ..., - descriptor_pool: Optional[DescriptorPool] = ..., + descriptor_pool: DescriptorPool | None = ..., allow_unknown_field: bool = ..., ) -> None: ... - def ParseLines(self, lines: Iterable[Union[Text, bytes]], message: _M) -> _M: ... - def MergeLines(self, lines: Iterable[Union[Text, bytes]], message: _M) -> _M: ... + def ParseLines(self, lines: Iterable[str | bytes], message: _M) -> _M: ... + def MergeLines(self, lines: Iterable[str | bytes], message: _M) -> _M: ... -_ParseError = ParseError +_ParseError: TypeAlias = ParseError class Tokenizer: token: str = ... @@ -194,18 +192,18 @@ class Tokenizer: def TryConsume(self, token: str) -> bool: ... def Consume(self, token: str) -> None: ... def ConsumeComment(self) -> str: ... - def ConsumeCommentOrTrailingComment(self) -> Tuple[bool, str]: ... + def ConsumeCommentOrTrailingComment(self) -> tuple[bool, str]: ... def TryConsumeIdentifier(self) -> bool: ... def ConsumeIdentifier(self) -> str: ... def TryConsumeIdentifierOrNumber(self) -> bool: ... def ConsumeIdentifierOrNumber(self) -> str: ... def TryConsumeInteger(self) -> bool: ... - def ConsumeInteger(self, is_long: bool = ...) -> int: ... + def ConsumeInteger(self) -> int: ... def TryConsumeFloat(self) -> bool: ... def ConsumeFloat(self) -> float: ... def ConsumeBool(self) -> bool: ... def TryConsumeByteString(self) -> bool: ... - def ConsumeString(self) -> Text: ... + def ConsumeString(self) -> str: ... def ConsumeByteString(self) -> bytes: ... def ConsumeEnum(self, field: FieldDescriptor) -> int: ... def ParseErrorPreviousToken(self, message: Message) -> _ParseError: ... diff --git a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi index 2eb9533..b8f5b63 100644 --- a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi +++ b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi @@ -1,123 +1,165 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins import google.protobuf.descriptor import google.protobuf.internal.well_known_types import google.protobuf.message -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -# A Timestamp represents a point in time independent of any time zone or local -# calendar, encoded as a count of seconds and fractions of seconds at -# nanosecond resolution. The count is relative to an epoch at UTC midnight on -# January 1, 1970, in the proleptic Gregorian calendar which extends the -# Gregorian calendar backwards to year one. -# -# All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -# second table is needed for interpretation, using a [24-hour linear -# smear](https://developers.google.com/time/smear). -# -# The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -# restricting to that range, we ensure that we can convert to and from [RFC -# 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -# -# # Examples -# -# Example 1: Compute Timestamp from POSIX `time()`. -# -# Timestamp timestamp; -# timestamp.set_seconds(time(NULL)); -# timestamp.set_nanos(0); -# -# Example 2: Compute Timestamp from POSIX `gettimeofday()`. -# -# struct timeval tv; -# gettimeofday(&tv, NULL); -# -# Timestamp timestamp; -# timestamp.set_seconds(tv.tv_sec); -# timestamp.set_nanos(tv.tv_usec * 1000); -# -# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -# -# FILETIME ft; -# GetSystemTimeAsFileTime(&ft); -# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -# -# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -# Timestamp timestamp; -# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -# -# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -# -# long millis = System.currentTimeMillis(); -# -# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -# .setNanos((int) ((millis % 1000) * 1000000)).build(); -# -# -# Example 5: Compute Timestamp from Java `Instant.now()`. -# -# Instant now = Instant.now(); -# -# Timestamp timestamp = -# Timestamp.newBuilder().setSeconds(now.getEpochSecond()) -# .setNanos(now.getNano()).build(); -# -# -# Example 6: Compute Timestamp from current time in Python. -# -# timestamp = Timestamp() -# timestamp.GetCurrentTime() -# -# # JSON Mapping -# -# In JSON format, the Timestamp type is encoded as a string in the -# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -# format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -# where {year} is always expressed using four digits while {month}, {day}, -# {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -# is required. A proto3 JSON serializer should always use UTC (as indicated by -# "Z") when printing the Timestamp type and a proto3 JSON parser should be -# able to accept both UTC and other timezones (as indicated by an offset). -# -# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -# 01:30 UTC on January 15, 2017. -# -# In JavaScript, one can convert a Date object to this format using the -# standard -# [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) -# method. In Python, a standard `datetime.datetime` object can be converted -# to this format using -# [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with -# the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -# the Joda Time's [`ISODateTimeFormat.dateTime()`]( -# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D -# ) to obtain a formatter capable of generating timestamps in this format. +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final class Timestamp(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Timestamp): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """A Timestamp represents a point in time independent of any time zone or local + calendar, encoded as a count of seconds and fractions of seconds at + nanosecond resolution. The count is relative to an epoch at UTC midnight on + January 1, 1970, in the proleptic Gregorian calendar which extends the + Gregorian calendar backwards to year one. + + All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + second table is needed for interpretation, using a [24-hour linear + smear](https://developers.google.com/time/smear). + + The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + restricting to that range, we ensure that we can convert to and from [RFC + 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + + # Examples + + Example 1: Compute Timestamp from POSIX `time()`. + + Timestamp timestamp; + timestamp.set_seconds(time(NULL)); + timestamp.set_nanos(0); + + Example 2: Compute Timestamp from POSIX `gettimeofday()`. + + struct timeval tv; + gettimeofday(&tv, NULL); + + Timestamp timestamp; + timestamp.set_seconds(tv.tv_sec); + timestamp.set_nanos(tv.tv_usec * 1000); + + Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + + FILETIME ft; + GetSystemTimeAsFileTime(&ft); + UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + + // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + Timestamp timestamp; + timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + + Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + + long millis = System.currentTimeMillis(); + + Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + .setNanos((int) ((millis % 1000) * 1000000)).build(); + + + Example 5: Compute Timestamp from Java `Instant.now()`. + + Instant now = Instant.now(); + + Timestamp timestamp = + Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + .setNanos(now.getNano()).build(); + + + Example 6: Compute Timestamp from current time in Python. + + timestamp = Timestamp() + timestamp.GetCurrentTime() + + # JSON Mapping + + In JSON format, the Timestamp type is encoded as a string in the + [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + where {year} is always expressed using four digits while {month}, {day}, + {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + is required. A proto3 JSON serializer should always use UTC (as indicated by + "Z") when printing the Timestamp type and a proto3 JSON parser should be + able to accept both UTC and other timezones (as indicated by an offset). + + For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + 01:30 UTC on January 15, 2017. + + In JavaScript, one can convert a Date object to this format using the + standard + [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + method. In Python, a standard `datetime.datetime` object can be converted + to this format using + [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + the Joda Time's [`ISODateTimeFormat.dateTime()`]( + http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + ) to obtain a formatter capable of generating timestamps in this format. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + SECONDS_FIELD_NUMBER: builtins.int NANOS_FIELD_NUMBER: builtins.int - # Represents seconds of UTC time since Unix epoch - # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - # 9999-12-31T23:59:59Z inclusive. - seconds: builtins.int = ... - # Non-negative fractions of a second at nanosecond resolution. Negative - # second values with fractions must still have non-negative nanos values - # that count forward in time. Must be from 0 to 999,999,999 - # inclusive. - nanos: builtins.int = ... - def __init__(self, + seconds: builtins.int + """Represents seconds of UTC time since Unix epoch + 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + 9999-12-31T23:59:59Z inclusive. + """ + nanos: builtins.int + """Non-negative fractions of a second at nanosecond resolution. Negative + second values with fractions must still have non-negative nanos values + that count forward in time. Must be from 0 to 999,999,999 + inclusive. + """ + def __init__( + self, *, - seconds : builtins.int = ..., - nanos : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"nanos",b"nanos",u"seconds",b"seconds"]) -> None: ... + seconds: builtins.int | None = ..., + nanos: builtins.int | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["nanos", b"nanos", "seconds", b"seconds"]) -> None: ... + global___Timestamp = Timestamp diff --git a/stubs/protobuf/google/protobuf/type_pb2.pyi b/stubs/protobuf/google/protobuf/type_pb2.pyi index 399cb4b..5071cdf 100644 --- a/stubs/protobuf/google/protobuf/type_pb2.pyi +++ b/stubs/protobuf/google/protobuf/type_pb2.pyi @@ -1,188 +1,236 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +https://developers.google.com/protocol-buffers/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import builtins +import collections.abc import google.protobuf.any_pb2 import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.message import google.protobuf.source_context_pb2 +import sys import typing -import typing_extensions -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -# The syntax in which a protocol buffer element is defined. -class Syntax(_Syntax, metaclass=_SyntaxEnumTypeWrapper): - pass class _Syntax: - V = typing.NewType('V', builtins.int) -class _SyntaxEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Syntax.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # Syntax `proto2`. - SYNTAX_PROTO2 = Syntax.V(0) - # Syntax `proto3`. - SYNTAX_PROTO3 = Syntax.V(1) - -# Syntax `proto2`. -SYNTAX_PROTO2 = Syntax.V(0) -# Syntax `proto3`. -SYNTAX_PROTO3 = Syntax.V(1) -global___Syntax = Syntax + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + +class _SyntaxEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Syntax.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + SYNTAX_PROTO2: _Syntax.ValueType # 0 + """Syntax `proto2`.""" + SYNTAX_PROTO3: _Syntax.ValueType # 1 + """Syntax `proto3`.""" + +class Syntax(_Syntax, metaclass=_SyntaxEnumTypeWrapper): + """The syntax in which a protocol buffer element is defined.""" +SYNTAX_PROTO2: Syntax.ValueType # 0 +"""Syntax `proto2`.""" +SYNTAX_PROTO3: Syntax.ValueType # 1 +"""Syntax `proto3`.""" +global___Syntax = Syntax -# A protocol buffer message type. +@typing_extensions.final class Type(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """A protocol buffer message type.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int FIELDS_FIELD_NUMBER: builtins.int ONEOFS_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int SOURCE_CONTEXT_FIELD_NUMBER: builtins.int SYNTAX_FIELD_NUMBER: builtins.int - # The fully qualified message name. - name: typing.Text = ... - # The list of fields. + name: builtins.str + """The fully qualified message name.""" @property - def fields(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Field]: ... - # The list of types appearing in `oneof` definitions in this type. + def fields(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Field]: + """The list of fields.""" @property - def oneofs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ... - # The protocol buffer options. + def oneofs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: + """The list of types appearing in `oneof` definitions in this type.""" @property - def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: ... - # The source context. + def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: + """The protocol buffer options.""" @property - def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: ... - # The source syntax. - syntax: global___Syntax.V = ... - def __init__(self, + def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: + """The source context.""" + syntax: global___Syntax.ValueType + """The source syntax.""" + def __init__( + self, *, - name : typing.Text = ..., - fields : typing.Optional[typing.Iterable[global___Field]] = ..., - oneofs : typing.Optional[typing.Iterable[typing.Text]] = ..., - options : typing.Optional[typing.Iterable[global___Option]] = ..., - source_context : typing.Optional[google.protobuf.source_context_pb2.SourceContext] = ..., - syntax : global___Syntax.V = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"source_context",b"source_context"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"fields",b"fields",u"name",b"name",u"oneofs",b"oneofs",u"options",b"options",u"source_context",b"source_context",u"syntax",b"syntax"]) -> None: ... + name: builtins.str | None = ..., + fields: collections.abc.Iterable[global___Field] | None = ..., + oneofs: collections.abc.Iterable[builtins.str] | None = ..., + options: collections.abc.Iterable[global___Option] | None = ..., + source_context: google.protobuf.source_context_pb2.SourceContext | None = ..., + syntax: global___Syntax.ValueType | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["source_context", b"source_context"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["fields", b"fields", "name", b"name", "oneofs", b"oneofs", "options", b"options", "source_context", b"source_context", "syntax", b"syntax"]) -> None: ... + global___Type = Type -# A single field of a message type. +@typing_extensions.final class Field(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - # Basic field types. - class Kind(_Kind, metaclass=_KindEnumTypeWrapper): - pass + """A single field of a message type.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + class _Kind: - V = typing.NewType('V', builtins.int) - class _KindEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Kind.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # Field type unknown. - TYPE_UNKNOWN = Field.Kind.V(0) - # Field type double. - TYPE_DOUBLE = Field.Kind.V(1) - # Field type float. - TYPE_FLOAT = Field.Kind.V(2) - # Field type int64. - TYPE_INT64 = Field.Kind.V(3) - # Field type uint64. - TYPE_UINT64 = Field.Kind.V(4) - # Field type int32. - TYPE_INT32 = Field.Kind.V(5) - # Field type fixed64. - TYPE_FIXED64 = Field.Kind.V(6) - # Field type fixed32. - TYPE_FIXED32 = Field.Kind.V(7) - # Field type bool. - TYPE_BOOL = Field.Kind.V(8) - # Field type string. - TYPE_STRING = Field.Kind.V(9) - # Field type group. Proto2 syntax only, and deprecated. - TYPE_GROUP = Field.Kind.V(10) - # Field type message. - TYPE_MESSAGE = Field.Kind.V(11) - # Field type bytes. - TYPE_BYTES = Field.Kind.V(12) - # Field type uint32. - TYPE_UINT32 = Field.Kind.V(13) - # Field type enum. - TYPE_ENUM = Field.Kind.V(14) - # Field type sfixed32. - TYPE_SFIXED32 = Field.Kind.V(15) - # Field type sfixed64. - TYPE_SFIXED64 = Field.Kind.V(16) - # Field type sint32. - TYPE_SINT32 = Field.Kind.V(17) - # Field type sint64. - TYPE_SINT64 = Field.Kind.V(18) - - # Field type unknown. - TYPE_UNKNOWN = Field.Kind.V(0) - # Field type double. - TYPE_DOUBLE = Field.Kind.V(1) - # Field type float. - TYPE_FLOAT = Field.Kind.V(2) - # Field type int64. - TYPE_INT64 = Field.Kind.V(3) - # Field type uint64. - TYPE_UINT64 = Field.Kind.V(4) - # Field type int32. - TYPE_INT32 = Field.Kind.V(5) - # Field type fixed64. - TYPE_FIXED64 = Field.Kind.V(6) - # Field type fixed32. - TYPE_FIXED32 = Field.Kind.V(7) - # Field type bool. - TYPE_BOOL = Field.Kind.V(8) - # Field type string. - TYPE_STRING = Field.Kind.V(9) - # Field type group. Proto2 syntax only, and deprecated. - TYPE_GROUP = Field.Kind.V(10) - # Field type message. - TYPE_MESSAGE = Field.Kind.V(11) - # Field type bytes. - TYPE_BYTES = Field.Kind.V(12) - # Field type uint32. - TYPE_UINT32 = Field.Kind.V(13) - # Field type enum. - TYPE_ENUM = Field.Kind.V(14) - # Field type sfixed32. - TYPE_SFIXED32 = Field.Kind.V(15) - # Field type sfixed64. - TYPE_SFIXED64 = Field.Kind.V(16) - # Field type sint32. - TYPE_SINT32 = Field.Kind.V(17) - # Field type sint64. - TYPE_SINT64 = Field.Kind.V(18) - - # Whether a field is optional, required, or repeated. - class Cardinality(_Cardinality, metaclass=_CardinalityEnumTypeWrapper): - pass + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _KindEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Field._Kind.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + TYPE_UNKNOWN: Field._Kind.ValueType # 0 + """Field type unknown.""" + TYPE_DOUBLE: Field._Kind.ValueType # 1 + """Field type double.""" + TYPE_FLOAT: Field._Kind.ValueType # 2 + """Field type float.""" + TYPE_INT64: Field._Kind.ValueType # 3 + """Field type int64.""" + TYPE_UINT64: Field._Kind.ValueType # 4 + """Field type uint64.""" + TYPE_INT32: Field._Kind.ValueType # 5 + """Field type int32.""" + TYPE_FIXED64: Field._Kind.ValueType # 6 + """Field type fixed64.""" + TYPE_FIXED32: Field._Kind.ValueType # 7 + """Field type fixed32.""" + TYPE_BOOL: Field._Kind.ValueType # 8 + """Field type bool.""" + TYPE_STRING: Field._Kind.ValueType # 9 + """Field type string.""" + TYPE_GROUP: Field._Kind.ValueType # 10 + """Field type group. Proto2 syntax only, and deprecated.""" + TYPE_MESSAGE: Field._Kind.ValueType # 11 + """Field type message.""" + TYPE_BYTES: Field._Kind.ValueType # 12 + """Field type bytes.""" + TYPE_UINT32: Field._Kind.ValueType # 13 + """Field type uint32.""" + TYPE_ENUM: Field._Kind.ValueType # 14 + """Field type enum.""" + TYPE_SFIXED32: Field._Kind.ValueType # 15 + """Field type sfixed32.""" + TYPE_SFIXED64: Field._Kind.ValueType # 16 + """Field type sfixed64.""" + TYPE_SINT32: Field._Kind.ValueType # 17 + """Field type sint32.""" + TYPE_SINT64: Field._Kind.ValueType # 18 + """Field type sint64.""" + + class Kind(_Kind, metaclass=_KindEnumTypeWrapper): + """Basic field types.""" + + TYPE_UNKNOWN: Field.Kind.ValueType # 0 + """Field type unknown.""" + TYPE_DOUBLE: Field.Kind.ValueType # 1 + """Field type double.""" + TYPE_FLOAT: Field.Kind.ValueType # 2 + """Field type float.""" + TYPE_INT64: Field.Kind.ValueType # 3 + """Field type int64.""" + TYPE_UINT64: Field.Kind.ValueType # 4 + """Field type uint64.""" + TYPE_INT32: Field.Kind.ValueType # 5 + """Field type int32.""" + TYPE_FIXED64: Field.Kind.ValueType # 6 + """Field type fixed64.""" + TYPE_FIXED32: Field.Kind.ValueType # 7 + """Field type fixed32.""" + TYPE_BOOL: Field.Kind.ValueType # 8 + """Field type bool.""" + TYPE_STRING: Field.Kind.ValueType # 9 + """Field type string.""" + TYPE_GROUP: Field.Kind.ValueType # 10 + """Field type group. Proto2 syntax only, and deprecated.""" + TYPE_MESSAGE: Field.Kind.ValueType # 11 + """Field type message.""" + TYPE_BYTES: Field.Kind.ValueType # 12 + """Field type bytes.""" + TYPE_UINT32: Field.Kind.ValueType # 13 + """Field type uint32.""" + TYPE_ENUM: Field.Kind.ValueType # 14 + """Field type enum.""" + TYPE_SFIXED32: Field.Kind.ValueType # 15 + """Field type sfixed32.""" + TYPE_SFIXED64: Field.Kind.ValueType # 16 + """Field type sfixed64.""" + TYPE_SINT32: Field.Kind.ValueType # 17 + """Field type sint32.""" + TYPE_SINT64: Field.Kind.ValueType # 18 + """Field type sint64.""" + class _Cardinality: - V = typing.NewType('V', builtins.int) - class _CardinalityEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Cardinality.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - # For fields with unknown cardinality. - CARDINALITY_UNKNOWN = Field.Cardinality.V(0) - # For optional fields. - CARDINALITY_OPTIONAL = Field.Cardinality.V(1) - # For required fields. Proto2 syntax only. - CARDINALITY_REQUIRED = Field.Cardinality.V(2) - # For repeated fields. - CARDINALITY_REPEATED = Field.Cardinality.V(3) - - # For fields with unknown cardinality. - CARDINALITY_UNKNOWN = Field.Cardinality.V(0) - # For optional fields. - CARDINALITY_OPTIONAL = Field.Cardinality.V(1) - # For required fields. Proto2 syntax only. - CARDINALITY_REQUIRED = Field.Cardinality.V(2) - # For repeated fields. - CARDINALITY_REPEATED = Field.Cardinality.V(3) + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _CardinalityEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Field._Cardinality.ValueType], builtins.type): # noqa: F821 + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + CARDINALITY_UNKNOWN: Field._Cardinality.ValueType # 0 + """For fields with unknown cardinality.""" + CARDINALITY_OPTIONAL: Field._Cardinality.ValueType # 1 + """For optional fields.""" + CARDINALITY_REQUIRED: Field._Cardinality.ValueType # 2 + """For required fields. Proto2 syntax only.""" + CARDINALITY_REPEATED: Field._Cardinality.ValueType # 3 + """For repeated fields.""" + + class Cardinality(_Cardinality, metaclass=_CardinalityEnumTypeWrapper): + """Whether a field is optional, required, or repeated.""" + + CARDINALITY_UNKNOWN: Field.Cardinality.ValueType # 0 + """For fields with unknown cardinality.""" + CARDINALITY_OPTIONAL: Field.Cardinality.ValueType # 1 + """For optional fields.""" + CARDINALITY_REQUIRED: Field.Cardinality.ValueType # 2 + """For required fields. Proto2 syntax only.""" + CARDINALITY_REPEATED: Field.Cardinality.ValueType # 3 + """For repeated fields.""" KIND_FIELD_NUMBER: builtins.int CARDINALITY_FIELD_NUMBER: builtins.int @@ -194,122 +242,144 @@ class Field(google.protobuf.message.Message): OPTIONS_FIELD_NUMBER: builtins.int JSON_NAME_FIELD_NUMBER: builtins.int DEFAULT_VALUE_FIELD_NUMBER: builtins.int - # The field type. - kind: global___Field.Kind.V = ... - # The field cardinality. - cardinality: global___Field.Cardinality.V = ... - # The field number. - number: builtins.int = ... - # The field name. - name: typing.Text = ... - # The field type URL, without the scheme, for message or enumeration - # types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. - type_url: typing.Text = ... - # The index of the field type in `Type.oneofs`, for message or enumeration - # types. The first type has index 1; zero means the type is not in the list. - oneof_index: builtins.int = ... - # Whether to use alternative packed wire representation. - packed: builtins.bool = ... - # The protocol buffer options. + kind: global___Field.Kind.ValueType + """The field type.""" + cardinality: global___Field.Cardinality.ValueType + """The field cardinality.""" + number: builtins.int + """The field number.""" + name: builtins.str + """The field name.""" + type_url: builtins.str + """The field type URL, without the scheme, for message or enumeration + types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + """ + oneof_index: builtins.int + """The index of the field type in `Type.oneofs`, for message or enumeration + types. The first type has index 1; zero means the type is not in the list. + """ + packed: builtins.bool + """Whether to use alternative packed wire representation.""" @property - def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: ... - # The field JSON name. - json_name: typing.Text = ... - # The string value of the default value of this field. Proto2 syntax only. - default_value: typing.Text = ... - def __init__(self, + def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: + """The protocol buffer options.""" + json_name: builtins.str + """The field JSON name.""" + default_value: builtins.str + """The string value of the default value of this field. Proto2 syntax only.""" + def __init__( + self, *, - kind : global___Field.Kind.V = ..., - cardinality : global___Field.Cardinality.V = ..., - number : builtins.int = ..., - name : typing.Text = ..., - type_url : typing.Text = ..., - oneof_index : builtins.int = ..., - packed : builtins.bool = ..., - options : typing.Optional[typing.Iterable[global___Option]] = ..., - json_name : typing.Text = ..., - default_value : typing.Text = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"cardinality",b"cardinality",u"default_value",b"default_value",u"json_name",b"json_name",u"kind",b"kind",u"name",b"name",u"number",b"number",u"oneof_index",b"oneof_index",u"options",b"options",u"packed",b"packed",u"type_url",b"type_url"]) -> None: ... + kind: global___Field.Kind.ValueType | None = ..., + cardinality: global___Field.Cardinality.ValueType | None = ..., + number: builtins.int | None = ..., + name: builtins.str | None = ..., + type_url: builtins.str | None = ..., + oneof_index: builtins.int | None = ..., + packed: builtins.bool | None = ..., + options: collections.abc.Iterable[global___Option] | None = ..., + json_name: builtins.str | None = ..., + default_value: builtins.str | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["cardinality", b"cardinality", "default_value", b"default_value", "json_name", b"json_name", "kind", b"kind", "name", b"name", "number", b"number", "oneof_index", b"oneof_index", "options", b"options", "packed", b"packed", "type_url", b"type_url"]) -> None: ... + global___Field = Field -# Enum type definition. +@typing_extensions.final class Enum(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Enum type definition.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int ENUMVALUE_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int SOURCE_CONTEXT_FIELD_NUMBER: builtins.int SYNTAX_FIELD_NUMBER: builtins.int - # Enum type name. - name: typing.Text = ... - # Enum value definitions. + name: builtins.str + """Enum type name.""" @property - def enumvalue(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnumValue]: ... - # Protocol buffer options. + def enumvalue(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnumValue]: + """Enum value definitions.""" @property - def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: ... - # The source context. + def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: + """Protocol buffer options.""" @property - def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: ... - # The source syntax. - syntax: global___Syntax.V = ... - def __init__(self, + def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: + """The source context.""" + syntax: global___Syntax.ValueType + """The source syntax.""" + def __init__( + self, *, - name : typing.Text = ..., - enumvalue : typing.Optional[typing.Iterable[global___EnumValue]] = ..., - options : typing.Optional[typing.Iterable[global___Option]] = ..., - source_context : typing.Optional[google.protobuf.source_context_pb2.SourceContext] = ..., - syntax : global___Syntax.V = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"source_context",b"source_context"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"enumvalue",b"enumvalue",u"name",b"name",u"options",b"options",u"source_context",b"source_context",u"syntax",b"syntax"]) -> None: ... + name: builtins.str | None = ..., + enumvalue: collections.abc.Iterable[global___EnumValue] | None = ..., + options: collections.abc.Iterable[global___Option] | None = ..., + source_context: google.protobuf.source_context_pb2.SourceContext | None = ..., + syntax: global___Syntax.ValueType | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["source_context", b"source_context"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["enumvalue", b"enumvalue", "name", b"name", "options", b"options", "source_context", b"source_context", "syntax", b"syntax"]) -> None: ... + global___Enum = Enum -# Enum value definition. +@typing_extensions.final class EnumValue(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Enum value definition.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int NUMBER_FIELD_NUMBER: builtins.int OPTIONS_FIELD_NUMBER: builtins.int - # Enum value name. - name: typing.Text = ... - # Enum value number. - number: builtins.int = ... - # Protocol buffer options. + name: builtins.str + """Enum value name.""" + number: builtins.int + """Enum value number.""" @property - def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: ... - def __init__(self, + def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Option]: + """Protocol buffer options.""" + def __init__( + self, *, - name : typing.Text = ..., - number : builtins.int = ..., - options : typing.Optional[typing.Iterable[global___Option]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"number",b"number",u"options",b"options"]) -> None: ... + name: builtins.str | None = ..., + number: builtins.int | None = ..., + options: collections.abc.Iterable[global___Option] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "number", b"number", "options", b"options"]) -> None: ... + global___EnumValue = EnumValue -# A protocol buffer option, which can be attached to a message, field, -# enumeration, etc. +@typing_extensions.final class Option(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """A protocol buffer option, which can be attached to a message, field, + enumeration, etc. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + NAME_FIELD_NUMBER: builtins.int VALUE_FIELD_NUMBER: builtins.int - # The option's name. For protobuf built-in options (options defined in - # descriptor.proto), this is the short name. For example, `"map_entry"`. - # For custom options, it should be the fully-qualified name. For example, - # `"google.api.http"`. - name: typing.Text = ... - # The option's value packed in an Any message. If the value is a primitive, - # the corresponding wrapper type defined in google/protobuf/wrappers.proto - # should be used. If the value is an enum, it should be stored as an int32 - # value using the google.protobuf.Int32Value type. + name: builtins.str + """The option's name. For protobuf built-in options (options defined in + descriptor.proto), this is the short name. For example, `"map_entry"`. + For custom options, it should be the fully-qualified name. For example, + `"google.api.http"`. + """ @property - def value(self) -> google.protobuf.any_pb2.Any: ... - def __init__(self, + def value(self) -> google.protobuf.any_pb2.Any: + """The option's value packed in an Any message. If the value is a primitive, + the corresponding wrapper type defined in google/protobuf/wrappers.proto + should be used. If the value is an enum, it should be stored as an int32 + value using the google.protobuf.Int32Value type. + """ + def __init__( + self, *, - name : typing.Text = ..., - value : typing.Optional[google.protobuf.any_pb2.Any] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"value",b"value"]) -> None: ... + name: builtins.str | None = ..., + value: google.protobuf.any_pb2.Any | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "value", b"value"]) -> None: ... + global___Option = Option diff --git a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi index 52e4f50..201b925 100644 --- a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi +++ b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi @@ -1,146 +1,213 @@ """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file +Wrappers for primitive (non-message) types. These types are useful +for embedding primitives in the `google.protobuf.Any` type and for places +where we need to distinguish between the absence of a primitive +typed field and its default value. + +These wrappers have no meaningful use within repeated fields as they lack +the ability to detect presence on individual elements. +These wrappers have no meaningful use within a map or a oneof since +individual entries of a map or fields of a oneof can already detect presence. """ import builtins import google.protobuf.descriptor import google.protobuf.message -import typing -import typing_extensions +import sys + +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -# Wrapper message for `double`. -# -# The JSON representation for `DoubleValue` is JSON number. +@typing_extensions.final class DoubleValue(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `double`. + + The JSON representation for `DoubleValue` is JSON number. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The double value. - value: builtins.float = ... - def __init__(self, + value: builtins.float + """The double value.""" + def __init__( + self, *, - value : builtins.float = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.float | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___DoubleValue = DoubleValue -# Wrapper message for `float`. -# -# The JSON representation for `FloatValue` is JSON number. +@typing_extensions.final class FloatValue(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `float`. + + The JSON representation for `FloatValue` is JSON number. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The float value. - value: builtins.float = ... - def __init__(self, + value: builtins.float + """The float value.""" + def __init__( + self, *, - value : builtins.float = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.float | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___FloatValue = FloatValue -# Wrapper message for `int64`. -# -# The JSON representation for `Int64Value` is JSON string. +@typing_extensions.final class Int64Value(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `int64`. + + The JSON representation for `Int64Value` is JSON string. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The int64 value. - value: builtins.int = ... - def __init__(self, + value: builtins.int + """The int64 value.""" + def __init__( + self, *, - value : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.int | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___Int64Value = Int64Value -# Wrapper message for `uint64`. -# -# The JSON representation for `UInt64Value` is JSON string. +@typing_extensions.final class UInt64Value(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `uint64`. + + The JSON representation for `UInt64Value` is JSON string. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The uint64 value. - value: builtins.int = ... - def __init__(self, + value: builtins.int + """The uint64 value.""" + def __init__( + self, *, - value : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.int | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___UInt64Value = UInt64Value -# Wrapper message for `int32`. -# -# The JSON representation for `Int32Value` is JSON number. +@typing_extensions.final class Int32Value(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `int32`. + + The JSON representation for `Int32Value` is JSON number. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The int32 value. - value: builtins.int = ... - def __init__(self, + value: builtins.int + """The int32 value.""" + def __init__( + self, *, - value : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.int | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___Int32Value = Int32Value -# Wrapper message for `uint32`. -# -# The JSON representation for `UInt32Value` is JSON number. +@typing_extensions.final class UInt32Value(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `uint32`. + + The JSON representation for `UInt32Value` is JSON number. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The uint32 value. - value: builtins.int = ... - def __init__(self, + value: builtins.int + """The uint32 value.""" + def __init__( + self, *, - value : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.int | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___UInt32Value = UInt32Value -# Wrapper message for `bool`. -# -# The JSON representation for `BoolValue` is JSON `true` and `false`. +@typing_extensions.final class BoolValue(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `bool`. + + The JSON representation for `BoolValue` is JSON `true` and `false`. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The bool value. - value: builtins.bool = ... - def __init__(self, + value: builtins.bool + """The bool value.""" + def __init__( + self, *, - value : builtins.bool = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.bool | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___BoolValue = BoolValue -# Wrapper message for `string`. -# -# The JSON representation for `StringValue` is JSON string. +@typing_extensions.final class StringValue(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `string`. + + The JSON representation for `StringValue` is JSON string. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The string value. - value: typing.Text = ... - def __init__(self, + value: builtins.str + """The string value.""" + def __init__( + self, *, - value : typing.Text = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.str | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___StringValue = StringValue -# Wrapper message for `bytes`. -# -# The JSON representation for `BytesValue` is JSON string. +@typing_extensions.final class BytesValue(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... + """Wrapper message for `bytes`. + + The JSON representation for `BytesValue` is JSON string. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + VALUE_FIELD_NUMBER: builtins.int - # The bytes value. - value: builtins.bytes = ... - def __init__(self, + value: builtins.bytes + """The bytes value.""" + def __init__( + self, *, - value : builtins.bytes = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal[u"value",b"value"]) -> None: ... + value: builtins.bytes | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["value", b"value"]) -> None: ... + global___BytesValue = BytesValue diff --git a/stubs/psutil/METADATA.toml b/stubs/psutil/METADATA.toml index 0948fc5..96a1afa 100644 --- a/stubs/psutil/METADATA.toml +++ b/stubs/psutil/METADATA.toml @@ -1 +1 @@ -version = "5.8" +version = "5.9.*" diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index fd471cb..2ffb546 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -1,5 +1,9 @@ import sys -from typing import Any, Callable, ContextManager, Iterable, Iterator, Tuple, TypeVar +from _typeshed import Self +from collections.abc import Callable, Iterable, Iterator +from contextlib import AbstractContextManager +from typing import Any, overload +from typing_extensions import Literal, TypeAlias from ._common import ( AIX as AIX, @@ -98,14 +102,15 @@ if sys.platform == "win32": ) if sys.platform == "linux": - from ._pslinux import pfullmem, pmem + from ._pslinux import pfullmem, pmem, svmem elif sys.platform == "darwin": - from ._psosx import pfullmem, pmem + from ._psosx import pfullmem, pmem, svmem elif sys.platform == "win32": - from ._pswindows import pfullmem, pmem + from ._pswindows import pfullmem, pmem, svmem else: - pmem = Any - pfullmem = Any + class pmem(Any): ... + class pfullmem(Any): ... + class svmem(Any): ... if sys.platform == "linux": PROCFS_PATH: str @@ -114,6 +119,23 @@ version_info: tuple[int, int, int] __version__: str __author__: str +_Status: TypeAlias = Literal[ + "running", + "sleeping", + "disk-sleep", + "stopped", + "tracing-stop", + "zombie", + "dead", + "wake-kill", + "waking", + "idle", + "locked", + "waiting", + "suspended", + "parked", +] + class Process: def __init__(self, pid: int | None = ...) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -121,9 +143,9 @@ class Process: def __hash__(self) -> int: ... @property def pid(self) -> int: ... - def oneshot(self) -> ContextManager[None]: ... + def oneshot(self) -> AbstractContextManager[None]: ... def as_dict( - self, attrs: list[str] | Tuple[str, ...] | set[str] | frozenset[str] | None = ..., ad_value: Any | None = ... + self, attrs: list[str] | tuple[str, ...] | set[str] | frozenset[str] | None = ..., ad_value: Any | None = ... ) -> dict[str, Any]: ... def parent(self) -> Process: ... def parents(self) -> list[Process]: ... @@ -132,7 +154,7 @@ class Process: def name(self) -> str: ... def exe(self) -> str: ... def cmdline(self) -> list[str]: ... - def status(self) -> int: ... + def status(self) -> _Status: ... def username(self) -> str: ... def create_time(self) -> float: ... def cwd(self) -> str: ... @@ -151,9 +173,11 @@ class Process: def cpu_affinity(self, cpus: list[int] | None = ...) -> list[int] | None: ... if sys.platform == "linux": def cpu_num(self) -> int: ... + def environ(self) -> dict[str, str]: ... if sys.platform == "win32": def num_handles(self) -> int: ... + def num_ctx_switches(self) -> pctxsw: ... def num_threads(self) -> int: ... def threads(self) -> list[pthread]: ... @@ -166,6 +190,7 @@ class Process: def memory_percent(self, memtype: str = ...) -> float: ... if sys.platform != "darwin": def memory_maps(self, grouped: bool = ...): ... + def open_files(self) -> list[popenfile]: ... def connections(self, kind: str = ...) -> list[pconn]: ... def send_signal(self, sig: int) -> None: ... @@ -175,21 +200,19 @@ class Process: def kill(self) -> None: ... def wait(self, timeout: int | None = ...) -> int: ... -_Popen = TypeVar("_Popen", bound="Popen") - class Popen(Process): def __init__(self, *args, **kwargs) -> None: ... - def __enter__(self: _Popen) -> _Popen: ... + def __enter__(self: Self) -> Self: ... def __exit__(self, *args, **kwargs) -> None: ... def __getattribute__(self, name: str) -> Any: ... def pids() -> list[int]: ... def pid_exists(pid: int) -> bool: ... def process_iter( - attrs: list[str] | Tuple[str, ...] | set[str] | frozenset[str] | None = ..., ad_value: Any | None = ... + attrs: list[str] | tuple[str, ...] | set[str] | frozenset[str] | None = ..., ad_value: Any | None = ... ) -> Iterator[Process]: ... def wait_procs( - procs: Iterable[Process], timeout: float | None = ..., callback: Callable[[Process], Any] | None = ... + procs: Iterable[Process], timeout: float | None = ..., callback: Callable[[Process], object] | None = ... ) -> tuple[list[Process], list[Process]]: ... def cpu_count(logical: bool = ...) -> int: ... def cpu_times(percpu: bool = ...): ... @@ -198,12 +221,18 @@ def cpu_times_percent(interval: float | None = ..., percpu: bool = ...): ... def cpu_stats() -> scpustats: ... def cpu_freq(percpu: bool = ...) -> scpufreq: ... def getloadavg() -> tuple[float, float, float]: ... -def virtual_memory(): ... +def virtual_memory() -> svmem: ... def swap_memory() -> sswap: ... def disk_usage(path: str) -> sdiskusage: ... def disk_partitions(all: bool = ...) -> list[sdiskpart]: ... -def disk_io_counters(perdisk: bool = ..., nowrap: bool = ...) -> sdiskio: ... -def net_io_counters(pernic: bool = ..., nowrap: bool = ...) -> snetio: ... +@overload +def disk_io_counters(perdisk: Literal[False] = ..., nowrap: bool = ...) -> sdiskio | None: ... +@overload +def disk_io_counters(perdisk: Literal[True], nowrap: bool = ...) -> dict[str, sdiskio]: ... +@overload +def net_io_counters(pernic: Literal[False] = ..., nowrap: bool = ...) -> snetio: ... +@overload +def net_io_counters(pernic: Literal[True], nowrap: bool = ...) -> dict[str, snetio]: ... def net_connections(kind: str = ...) -> list[sconn]: ... def net_if_addrs() -> dict[str, list[snicaddr]]: ... def net_if_stats() -> dict[str, snicstats]: ... diff --git a/stubs/psutil/psutil/_common.pyi b/stubs/psutil/psutil/_common.pyi index 22b08bd..ecc5698 100644 --- a/stubs/psutil/psutil/_common.pyi +++ b/stubs/psutil/psutil/_common.pyi @@ -1,7 +1,9 @@ import enum from _typeshed import StrOrBytesPath, SupportsWrite +from collections.abc import Callable from socket import AddressFamily, SocketKind -from typing import Any, Callable, NamedTuple, TypeVar, overload +from typing import Any, NamedTuple, TypeVar, overload +from typing_extensions import Literal POSIX: bool WINDOWS: bool @@ -14,20 +16,22 @@ NETBSD: bool BSD: bool SUNOS: bool AIX: bool -STATUS_RUNNING: str -STATUS_SLEEPING: str -STATUS_DISK_SLEEP: str -STATUS_STOPPED: str -STATUS_TRACING_STOP: str -STATUS_ZOMBIE: str -STATUS_DEAD: str -STATUS_WAKE_KILL: str -STATUS_WAKING: str -STATUS_IDLE: str -STATUS_LOCKED: str -STATUS_WAITING: str -STATUS_SUSPENDED: str -STATUS_PARKED: str + +STATUS_RUNNING: Literal["running"] +STATUS_SLEEPING: Literal["sleeping"] +STATUS_DISK_SLEEP: Literal["disk-sleep"] +STATUS_STOPPED: Literal["stopped"] +STATUS_TRACING_STOP: Literal["tracing-stop"] +STATUS_ZOMBIE: Literal["zombie"] +STATUS_DEAD: Literal["dead"] +STATUS_WAKE_KILL: Literal["wake-kill"] +STATUS_WAKING: Literal["waking"] +STATUS_IDLE: Literal["idle"] +STATUS_LOCKED: Literal["locked"] +STATUS_WAITING: Literal["waiting"] +STATUS_SUSPENDED: Literal["suspended"] +STATUS_PARKED: Literal["parked"] + CONN_ESTABLISHED: str CONN_SYN_SENT: str CONN_SYN_RECV: str @@ -110,8 +114,8 @@ class sconn(NamedTuple): fd: int family: AddressFamily type: SocketKind - laddr: str - raddr: str + laddr: addr | tuple[()] + raddr: addr | tuple[()] status: str pid: int @@ -127,6 +131,7 @@ class snicstats(NamedTuple): duplex: int speed: int mtu: int + flags: str class scpustats(NamedTuple): ctx_switches: int diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi index de3d5f2..326025c 100644 --- a/stubs/psutil/psutil/_psbsd.pyi +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -1,4 +1,5 @@ -from typing import Any, ContextManager, NamedTuple +from contextlib import AbstractContextManager +from typing import Any, NamedTuple from ._common import ( FREEBSD as FREEBSD, @@ -25,17 +26,17 @@ HAS_PROC_NUM_FDS: Any kinfo_proc_map: Any class svmem(NamedTuple): - total: Any - available: Any - percent: Any - used: Any - free: Any - active: Any - inactive: Any - buffers: Any - cached: Any - shared: Any - wired: Any + total: int + available: int + percent: float + used: int + free: int + active: int + inactive: int + buffers: int + cached: int + shared: int + wired: int class scputimes(NamedTuple): user: Any @@ -84,12 +85,12 @@ class sdiskio(NamedTuple): write_time: Any busy_time: Any -def virtual_memory(): ... +def virtual_memory() -> svmem: ... def swap_memory(): ... def cpu_times(): ... def per_cpu_times(): ... def cpu_count_logical(): ... -def cpu_count_physical(): ... +def cpu_count_cores() -> int | None: ... def cpu_stats(): ... def disk_partitions(all: bool = ...): ... @@ -109,7 +110,7 @@ def pids(): ... def pid_exists(pid): ... def is_zombie(pid): ... def wrap_exceptions(fun): ... -def wrap_exceptions_procfs(inst) -> ContextManager[None]: ... +def wrap_exceptions_procfs(inst) -> AbstractContextManager[None]: ... class Process: pid: Any @@ -140,12 +141,14 @@ class Process: def status(self): ... def io_counters(self): ... def cwd(self): ... + class nt_mmap_grouped(NamedTuple): path: Any rss: Any private: Any ref_count: Any shadow_count: Any + class nt_mmap_ext(NamedTuple): addr: Any perms: Any diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi index 6794cfb..77efae1 100644 --- a/stubs/psutil/psutil/_pslinux.pyi +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -17,13 +17,11 @@ from ._common import ( __extra__all__: Any POWER_SUPPLY_PATH: str -HAS_SMAPS: Any HAS_PROC_IO_PRIORITY: Any HAS_CPU_AFFINITY: Any CLOCK_TICKS: Any PAGESIZE: Any BOOT_TIME: Any -BIGFILE_BUFFERING: Any LITTLE_ENDIAN: Any DISK_SECTOR_SIZE: int AF_LINK: Any @@ -43,17 +41,17 @@ PROC_STATUSES: Any TCP_STATUSES: Any class svmem(NamedTuple): - total: Any - available: Any - percent: Any - used: Any - free: Any - active: Any - inactive: Any - buffers: Any - cached: Any - shared: Any - slab: Any + total: int + available: int + percent: float + used: int + free: int + active: int + inactive: int + buffers: int + cached: int + shared: int + slab: int class sdiskio(NamedTuple): read_count: Any @@ -118,18 +116,17 @@ def readlink(path): ... def file_flags_to_mode(flags): ... def is_storage_device(name): ... def set_scputimes_ntuple(procfs_path) -> None: ... -def cat(fname, fallback=..., binary: bool = ...): ... scputimes: Any prlimit: Any def calculate_avail_vmem(mems): ... -def virtual_memory(): ... +def virtual_memory() -> svmem: ... def swap_memory(): ... def cpu_times(): ... def per_cpu_times(): ... def cpu_count_logical(): ... -def cpu_count_physical(): ... +def cpu_count_cores() -> int | None: ... def cpu_stats(): ... def cpu_freq(): ... @@ -184,7 +181,7 @@ class Process: def wait(self, timeout: Any | None = ...): ... def create_time(self): ... def memory_info(self): ... - def memory_full_info(self, _private_re=..., _pss_re=..., _swap_re=...): ... + def memory_full_info(self): ... def memory_maps(self): ... def cwd(self): ... def num_ctx_switches(self, _ctxsw_re=...): ... diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index 7b09c46..9afe121 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -1,4 +1,4 @@ -from typing import Any, ContextManager, NamedTuple +from typing import Any, NamedTuple from ._common import ( AccessDenied as AccessDenied, @@ -26,14 +26,14 @@ class scputimes(NamedTuple): idle: Any class svmem(NamedTuple): - total: Any - available: Any - percent: Any - used: Any - free: Any - active: Any - inactive: Any - wired: Any + total: int + available: int + percent: float + used: int + free: int + active: int + inactive: int + wired: int class pmem(NamedTuple): rss: Any @@ -43,12 +43,12 @@ class pmem(NamedTuple): pfullmem: Any -def virtual_memory(): ... +def virtual_memory() -> svmem: ... def swap_memory(): ... def cpu_times(): ... def per_cpu_times(): ... def cpu_count_logical(): ... -def cpu_count_physical(): ... +def cpu_count_cores() -> int | None: ... def cpu_stats(): ... def cpu_freq(): ... @@ -71,7 +71,6 @@ pid_exists: Any def is_zombie(pid): ... def wrap_exceptions(fun): ... -def catch_zombie(proc) -> ContextManager[None]: ... class Process: pid: Any diff --git a/stubs/psutil/psutil/_psutil_linux.pyi b/stubs/psutil/psutil/_psutil_linux.pyi index 949d6a7..4902db4 100644 --- a/stubs/psutil/psutil/_psutil_linux.pyi +++ b/stubs/psutil/psutil/_psutil_linux.pyi @@ -12,5 +12,4 @@ def proc_cpu_affinity_get(*args, **kwargs) -> Any: ... def proc_cpu_affinity_set(*args, **kwargs) -> Any: ... def proc_ioprio_get(*args, **kwargs) -> Any: ... def proc_ioprio_set(*args, **kwargs) -> Any: ... -def set_testing(*args, **kwargs) -> Any: ... def users(*args, **kwargs) -> Any: ... diff --git a/stubs/psutil/psutil/_psutil_windows.pyi b/stubs/psutil/psutil/_psutil_windows.pyi index 964e6fa..0f6820f 100644 --- a/stubs/psutil/psutil/_psutil_windows.pyi +++ b/stubs/psutil/psutil/_psutil_windows.pyi @@ -1,3 +1,3 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/psutil/psutil/_pswindows.pyi b/stubs/psutil/psutil/_pswindows.pyi index 6d39f0e..5abcc18 100644 --- a/stubs/psutil/psutil/_pswindows.pyi +++ b/stubs/psutil/psutil/_pswindows.pyi @@ -1,4 +1,5 @@ import enum +from collections.abc import Iterable from typing import Any, NamedTuple from ._common import ( @@ -62,11 +63,11 @@ class scputimes(NamedTuple): dpc: Any class svmem(NamedTuple): - total: Any - available: Any - percent: Any - used: Any - free: Any + total: int + available: int + percent: float + used: int + free: int class pmem(NamedTuple): rss: Any @@ -101,7 +102,7 @@ class pio(NamedTuple): def convert_dos_path(s): ... def py2_strencode(s): ... def getpagesize(): ... -def virtual_memory(): ... +def virtual_memory() -> svmem: ... def swap_memory(): ... disk_io_counters: Any @@ -111,7 +112,7 @@ def disk_partitions(all): ... def cpu_times(): ... def per_cpu_times(): ... def cpu_count_logical(): ... -def cpu_count_physical(): ... +def cpu_count_cores() -> int | None: ... def cpu_stats(): ... def cpu_freq(): ... def getloadavg(): ... @@ -122,7 +123,7 @@ def net_if_addrs(): ... def sensors_battery(): ... def boot_time(): ... def users(): ... -def win_service_iter() -> None: ... +def win_service_iter() -> Iterable[WindowsService]: ... def win_service_get(name): ... class WindowsService: diff --git a/stubs/psycopg2/@tests/stubtest_allowlist.txt b/stubs/psycopg2/@tests/stubtest_allowlist.txt index ea36bb0..0a93eae 100644 --- a/stubs/psycopg2/@tests/stubtest_allowlist.txt +++ b/stubs/psycopg2/@tests/stubtest_allowlist.txt @@ -1,2 +1,5 @@ psycopg2.connection psycopg2.cursor +psycopg2.pool.AbstractConnectionPool.closeall +psycopg2.pool.AbstractConnectionPool.getconn +psycopg2.pool.AbstractConnectionPool.putconn diff --git a/stubs/psycopg2/METADATA.toml b/stubs/psycopg2/METADATA.toml index d8484dc..0009f38 100644 --- a/stubs/psycopg2/METADATA.toml +++ b/stubs/psycopg2/METADATA.toml @@ -1 +1 @@ -version = "2.9" \ No newline at end of file +version = "2.9.*" \ No newline at end of file diff --git a/stubs/psycopg2/psycopg2/__init__.pyi b/stubs/psycopg2/psycopg2/__init__.pyi index d1165cd..5c02777 100644 --- a/stubs/psycopg2/psycopg2/__init__.pyi +++ b/stubs/psycopg2/psycopg2/__init__.pyi @@ -1,4 +1,5 @@ -from typing import Any +from collections.abc import Callable +from typing import Any, TypeVar, overload # connection and cursor not available at runtime from psycopg2._psycopg import ( @@ -32,6 +33,18 @@ from psycopg2._psycopg import ( threadsafety as threadsafety, ) +_T_conn = TypeVar("_T_conn", bound=connection) + +@overload +def connect(dsn: str, connection_factory: Callable[..., _T_conn], cursor_factory: None = ..., **kwargs: Any) -> _T_conn: ... +@overload +def connect( + dsn: str | None = ..., *, connection_factory: Callable[..., _T_conn], cursor_factory: None = ..., **kwargs: Any +) -> _T_conn: ... +@overload def connect( - dsn: Any | None = ..., connection_factory: Any | None = ..., cursor_factory: Any | None = ..., **kwargs + dsn: str | None = ..., + connection_factory: Callable[..., connection] | None = ..., + cursor_factory: Callable[..., cursor] | None = ..., + **kwargs: Any, ) -> connection: ... diff --git a/stubs/psycopg2/psycopg2/_psycopg.pyi b/stubs/psycopg2/psycopg2/_psycopg.pyi index 79c74d4..abe74a9 100644 --- a/stubs/psycopg2/psycopg2/_psycopg.pyi +++ b/stubs/psycopg2/psycopg2/_psycopg.pyi @@ -1,7 +1,14 @@ -from typing import Any, Tuple, overload +from _typeshed import Self +from collections.abc import Callable, Iterable, Mapping, Sequence +from types import TracebackType +from typing import Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias import psycopg2 import psycopg2.extensions +from psycopg2.sql import Composable + +_Vars: TypeAlias = Sequence[Any] | Mapping[str, Any] | None BINARY: Any BINARYARRAY: Any @@ -61,6 +68,52 @@ threadsafety: int __libpq_version__: int +class cursor: + arraysize: int + binary_types: Any + closed: Any + connection: Any + description: Any + itersize: Any + lastrowid: Any + name: Any + pgresult_ptr: Any + query: Any + row_factory: Any + rowcount: int + rownumber: int + scrollable: bool | None + statusmessage: Any + string_types: Any + typecaster: Any + tzinfo_factory: Any + withhold: bool + def __init__(self, conn: connection, name: str | bytes | None = ...) -> None: ... + def callproc(self, procname, parameters=...): ... + def cast(self, oid, s): ... + def close(self): ... + def copy_expert(self, sql: str | bytes | Composable, file, size=...): ... + def copy_from(self, file, table, sep=..., null=..., size=..., columns=...): ... + def copy_to(self, file, table, sep=..., null=..., columns=...): ... + def execute(self, query: str | bytes | Composable, vars: _Vars = ...) -> None: ... + def executemany(self, query: str | bytes | Composable, vars_list: Iterable[_Vars]) -> None: ... + def fetchall(self) -> list[tuple[Any, ...]]: ... + def fetchmany(self, size: int | None = ...) -> list[tuple[Any, ...]]: ... + def fetchone(self) -> tuple[Any, ...] | None: ... + def mogrify(self, *args, **kwargs): ... + def nextset(self): ... + def scroll(self, value, mode=...): ... + def setinputsizes(self, sizes): ... + def setoutputsize(self, size, column=...): ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> tuple[Any, ...]: ... + +_Cursor: TypeAlias = cursor + class AsIs: adapted: Any def __init__(self, *args, **kwargs) -> None: ... @@ -92,39 +145,75 @@ class Column: table_oid: Any type_code: Any def __init__(self, *args, **kwargs) -> None: ... - def __eq__(self, other): ... - def __ge__(self, other): ... - def __getitem__(self, index): ... + def __eq__(self, __other): ... + def __ge__(self, __other): ... + def __getitem__(self, __index): ... def __getstate__(self): ... - def __gt__(self, other): ... - def __le__(self, other): ... + def __gt__(self, __other): ... + def __le__(self, __other): ... def __len__(self): ... - def __lt__(self, other): ... - def __ne__(self, other): ... + def __lt__(self, __other): ... + def __ne__(self, __other): ... def __setstate__(self, state): ... class ConnectionInfo: - backend_pid: Any - dbname: Any - dsn_parameters: Any - error_message: Any - host: Any - needs_password: Any - options: Any - password: Any - port: Any - protocol_version: Any - server_version: Any - socket: Any - ssl_attribute_names: Any - ssl_in_use: Any - status: Any - transaction_status: Any - used_password: Any - user: Any + # Note: the following properties can be None if their corresponding libpq function + # returns NULL. They're not annotated as such, because this is very unlikely in + # practice---the psycopg2 docs [1] don't even mention this as a possibility! + # + # - db_name + # - user + # - password + # - host + # - port + # - options + # + # (To prove this, one needs to inspect the psycopg2 source code [2], plus the + # documentation [3] and source code [4] of the corresponding libpq calls.) + # + # [1]: https://www.psycopg.org/docs/extensions.html#psycopg2.extensions.ConnectionInfo + # [2]: https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L52 and below + # [3]: https://www.postgresql.org/docs/current/libpq-status.html + # [4]: https://github.com/postgres/postgres/blob/b39838889e76274b107935fa8e8951baf0e8b31b/src/interfaces/libpq/fe-connect.c#L6754 and below + @property + def backend_pid(self) -> int: ... + @property + def dbname(self) -> str: ... + @property + def dsn_parameters(self) -> dict[str, str]: ... + @property + def error_message(self) -> str | None: ... + @property + def host(self) -> str: ... + @property + def needs_password(self) -> bool: ... + @property + def options(self) -> str: ... + @property + def password(self) -> str: ... + @property + def port(self) -> int: ... + @property + def protocol_version(self) -> int: ... + @property + def server_version(self) -> int: ... + @property + def socket(self) -> int: ... + @property + def ssl_attribute_names(self) -> list[str]: ... + @property + def ssl_in_use(self) -> bool: ... + @property + def status(self) -> int: ... + @property + def transaction_status(self) -> int: ... + @property + def used_password(self) -> bool: ... + @property + def user(self) -> str: ... def __init__(self, *args, **kwargs) -> None: ... - def parameter_status(self, *args, **kwargs): ... - def ssl_attribute(self, *args, **kwargs): ... + def parameter_status(self, name: str) -> str | None: ... + def ssl_attribute(self, name: str) -> str | None: ... class DataError(psycopg2.DatabaseError): ... class DatabaseError(psycopg2.Error): ... @@ -136,31 +225,31 @@ class Decimal: def __conform__(self, *args, **kwargs): ... class Diagnostics: - column_name: Any - constraint_name: Any - context: Any - datatype_name: Any - internal_position: Any - internal_query: Any - message_detail: Any - message_hint: Any - message_primary: Any - schema_name: Any - severity: Any - severity_nonlocalized: Any - source_file: Any - source_function: Any - source_line: Any - sqlstate: Any - statement_position: Any - table_name: Any - def __init__(self, *args, **kwargs) -> None: ... + column_name: str | None + constraint_name: str | None + context: str | None + datatype_name: str | None + internal_position: str | None + internal_query: str | None + message_detail: str | None + message_hint: str | None + message_primary: str | None + schema_name: str | None + severity: str | None + severity_nonlocalized: str | None + source_file: str | None + source_function: str | None + source_line: str | None + sqlstate: str | None + statement_position: str | None + table_name: str | None + def __init__(self, __err: Error) -> None: ... class Error(Exception): - cursor: Any - diag: Any - pgcode: Any - pgerror: Any + cursor: _Cursor | None + diag: Diagnostics + pgcode: str | None + pgerror: str | None def __init__(self, *args, **kwargs) -> None: ... def __reduce__(self): ... def __setstate__(self, state): ... @@ -202,15 +291,15 @@ class Notify: payload: Any pid: Any def __init__(self, *args, **kwargs) -> None: ... - def __eq__(self, other): ... - def __ge__(self, other): ... - def __getitem__(self, index): ... - def __gt__(self, other): ... + def __eq__(self, __other): ... + def __ge__(self, __other): ... + def __getitem__(self, __index): ... + def __gt__(self, __other): ... def __hash__(self): ... - def __le__(self, other): ... + def __le__(self, __other): ... def __len__(self): ... - def __lt__(self, other): ... - def __ne__(self, other): ... + def __lt__(self, __other): ... + def __ne__(self, __other): ... class OperationalError(psycopg2.DatabaseError): ... class ProgrammingError(psycopg2.DatabaseError): ... @@ -234,7 +323,7 @@ class ReplicationConnection(psycopg2.extensions.connection): set_session: Any def __init__(self, *args, **kwargs) -> None: ... -class ReplicationCursor(psycopg2.extensions.cursor): +class ReplicationCursor(cursor): feedback_timestamp: Any io_timestamp: Any wal_end: Any @@ -265,10 +354,10 @@ class Xid: prepared: Any def __init__(self, *args, **kwargs) -> None: ... def from_string(self, *args, **kwargs): ... - def __getitem__(self, index): ... + def __getitem__(self, __index): ... def __len__(self): ... -_cursor = cursor +_T_cur = TypeVar("_T_cur", bound=cursor) class connection: DataError: Any @@ -281,96 +370,100 @@ class connection: OperationalError: Any ProgrammingError: Any Warning: Any - async_: Any - autocommit: Any - binary_types: Any - closed: Any - cursor_factory: Any - deferrable: Any - dsn: Any - encoding: Any - info: Any - isolation_level: Any - notices: Any - notifies: Any - pgconn_ptr: Any - protocol_version: Any - readonly: Any - server_version: Any - status: Any - string_types: Any - def __init__(self, *args, **kwargs) -> None: ... - def cancel(self, *args, **kwargs): ... - def close(self, *args, **kwargs): ... - def commit(self, *args, **kwargs): ... + @property + def async_(self) -> int: ... + autocommit: bool + @property + def binary_types(self) -> Any: ... + @property + def closed(self) -> int: ... + cursor_factory: Callable[..., _Cursor] + @property + def dsn(self) -> str: ... + @property + def encoding(self) -> str: ... + @property + def info(self) -> ConnectionInfo: ... + @property + def isolation_level(self) -> int | None: ... + @isolation_level.setter + def isolation_level(self, __value: str | bytes | int | None) -> None: ... + notices: list[Any] + notifies: list[Any] + @property + def pgconn_ptr(self) -> int | None: ... + @property + def protocol_version(self) -> int: ... + @property + def deferrable(self) -> bool | None: ... + @deferrable.setter + def deferrable(self, __value: Literal["default"] | bool | None) -> None: ... + @property + def readonly(self) -> bool | None: ... + @readonly.setter + def readonly(self, __value: Literal["default"] | bool | None) -> None: ... + @property + def server_version(self) -> int: ... + @property + def status(self) -> int: ... + @property + def string_types(self) -> Any: ... + # Really it's dsn: str, async: int = ..., async_: int = ..., but + # that would be a syntax error. + def __init__(self, dsn: str, *, async_: int = ...) -> None: ... + def cancel(self) -> None: ... + def close(self) -> None: ... + def commit(self) -> None: ... @overload - def cursor(self) -> _cursor: ... + def cursor(self, name: str | bytes | None = ..., *, withhold: bool = ..., scrollable: bool | None = ...) -> _Cursor: ... @overload - def cursor(self, name=..., cursor_factory: Any = ..., withhold=...) -> Any: ... - def fileno(self, *args, **kwargs): ... - def get_backend_pid(self, *args, **kwargs): ... - def get_dsn_parameters(self, *args, **kwargs): ... - def get_native_connection(self, *args, **kwargs): ... - def get_parameter_status(self, parameter): ... - def get_transaction_status(self): ... - def isexecuting(self, *args, **kwargs): ... - def lobject(self, oid=..., mode=..., new_oid=..., new_file=..., lobject_factory=...): ... - def poll(self, *args, **kwargs): ... - def reset(self): ... - def rollback(self): ... - def set_client_encoding(self, encoding): ... - def set_isolation_level(self, level): ... - def set_session(self, *args, **kwargs): ... - def tpc_begin(self, xid): ... - def tpc_commit(self, *args, **kwargs): ... - def tpc_prepare(self): ... - def tpc_recover(self): ... - def tpc_rollback(self, *args, **kwargs): ... - def xid(self, format_id, gtrid, bqual): ... - def __enter__(self): ... - def __exit__(self, type, value, traceback): ... - -class cursor: - arraysize: int - binary_types: Any - closed: Any - connection: Any - description: Any - itersize: Any - lastrowid: Any - name: Any - pgresult_ptr: Any - query: Any - row_factory: Any - rowcount: int - rownumber: int - scrollable: Any - statusmessage: Any - string_types: Any - typecaster: Any - tzinfo_factory: Any - withhold: Any - def __init__(self, *args, **kwargs) -> None: ... - def callproc(self, procname, parameters=...): ... - def cast(self, oid, s): ... - def close(self): ... - def copy_expert(self, sql, file, size=...): ... - def copy_from(self, file, table, sep=..., null=..., size=..., columns=...): ... - def copy_to(self, file, table, sep=..., null=..., columns=...): ... - def execute(self, query, vars=...): ... - def executemany(self, query, vars_list): ... - def fetchall(self) -> list[Tuple[Any, ...]]: ... - def fetchmany(self, size=...) -> list[Tuple[Any, ...]]: ... - def fetchone(self) -> Tuple[Any, ...] | Any: ... - def mogrify(self, *args, **kwargs): ... - def nextset(self): ... - def scroll(self, value, mode=...): ... - def setinputsizes(self, sizes): ... - def setoutputsize(self, size, column=...): ... - def __enter__(self): ... - def __exit__(self, type, value, traceback): ... - def __iter__(self): ... - def __next__(self): ... + def cursor( + self, + name: str | bytes | None = ..., + *, + cursor_factory: Callable[..., _T_cur], + withhold: bool = ..., + scrollable: bool | None = ..., + ) -> _T_cur: ... + @overload + def cursor( + self, name: str | bytes | None, cursor_factory: Callable[..., _T_cur], withhold: bool = ..., scrollable: bool | None = ... + ) -> _T_cur: ... + def fileno(self) -> int: ... + def get_backend_pid(self) -> int: ... + def get_dsn_parameters(self) -> dict[str, str]: ... + def get_native_connection(self): ... + def get_parameter_status(self, parameter: str) -> str | None: ... + def get_transaction_status(self) -> int: ... + def isexecuting(self) -> bool: ... + def lobject( + self, + oid: int = ..., + mode: str | None = ..., + new_oid: int = ..., + new_file: str | None = ..., + lobject_factory: type[lobject] = ..., + ) -> lobject: ... + def poll(self) -> int: ... + def reset(self) -> None: ... + def rollback(self) -> None: ... + def set_client_encoding(self, encoding: str) -> None: ... + def set_isolation_level(self, level: int | None) -> None: ... + def set_session( + self, + isolation_level: str | bytes | int | None = ..., + readonly: bool | Literal["default", b"default"] | None = ..., + deferrable: bool | Literal["default", b"default"] | None = ..., + autocommit: bool = ..., + ) -> None: ... + def tpc_begin(self, xid: str | bytes | Xid) -> None: ... + def tpc_commit(self, __xid: str | bytes | Xid = ...) -> None: ... + def tpc_prepare(self) -> None: ... + def tpc_recover(self) -> list[Xid]: ... + def tpc_rollback(self, __xid: str | bytes | Xid = ...) -> None: ... + def xid(self, format_id, gtrid, bqual) -> Xid: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, __type: object, __name: object, __tb: object) -> None: ... class lobject: closed: Any @@ -403,7 +496,7 @@ def get_wait_callback(*args, **kwargs): ... def libpq_version(*args, **kwargs): ... def new_array_type(oids, name, baseobj): ... def new_type(oids, name, castobj): ... -def parse_dsn(*args, **kwargs): ... +def parse_dsn(dsn: str | bytes) -> dict[str, Any]: ... def quote_ident(*args, **kwargs): ... def register_type(*args, **kwargs): ... def set_wait_callback(_none): ... diff --git a/stubs/psycopg2/psycopg2/_range.pyi b/stubs/psycopg2/psycopg2/_range.pyi index fa60fd1..05b22d8 100644 --- a/stubs/psycopg2/psycopg2/_range.pyi +++ b/stubs/psycopg2/psycopg2/_range.pyi @@ -18,7 +18,6 @@ class Range: def upper_inc(self): ... def __contains__(self, x): ... def __bool__(self): ... - def __nonzero__(self): ... def __eq__(self, other): ... def __ne__(self, other): ... def __hash__(self): ... diff --git a/stubs/psycopg2/psycopg2/errors.pyi b/stubs/psycopg2/psycopg2/errors.pyi index d3793b8..bf7d357 100644 --- a/stubs/psycopg2/psycopg2/errors.pyi +++ b/stubs/psycopg2/psycopg2/errors.pyi @@ -1,17 +1,4 @@ -from typing import Any - -class Error: - def __init__(self, *args, **kwargs): ... - args: Any - cursor: Any - diag: Any - pgcode: Any - pgerror: Any - with_traceback: Any - -class Warning: - args: Any - with_traceback: Any +from psycopg2._psycopg import Error as Error, Warning as Warning class DatabaseError(Error): ... class InterfaceError(Error): ... diff --git a/stubs/psycopg2/psycopg2/extras.pyi b/stubs/psycopg2/psycopg2/extras.pyi index 364de1a..8037e3c 100644 --- a/stubs/psycopg2/psycopg2/extras.pyi +++ b/stubs/psycopg2/psycopg2/extras.pyi @@ -1,5 +1,6 @@ from collections import OrderedDict -from typing import Any, List +from collections.abc import Callable +from typing import Any, NamedTuple, TypeVar, overload from psycopg2._ipaddress import register_ipaddress as register_ipaddress from psycopg2._json import ( @@ -28,24 +29,39 @@ from psycopg2._range import ( from .extensions import connection as _connection, cursor as _cursor, quote_ident as quote_ident +_T_cur = TypeVar("_T_cur", bound=_cursor) + class DictCursorBase(_cursor): - row_factory: Any def __init__(self, *args, **kwargs) -> None: ... - def fetchone(self): ... - def fetchmany(self, size: Any | None = ...): ... - def fetchall(self): ... - def __iter__(self): ... class DictConnection(_connection): - def cursor(self, *args, **kwargs): ... + @overload + def cursor(self, name: str | bytes | None = ..., *, withhold: bool = ..., scrollable: bool | None = ...) -> DictCursor: ... + @overload + def cursor( + self, + name: str | bytes | None = ..., + *, + cursor_factory: Callable[..., _T_cur], + withhold: bool = ..., + scrollable: bool | None = ..., + ) -> _T_cur: ... + @overload + def cursor( + self, name: str | bytes | None, cursor_factory: Callable[..., _T_cur], withhold: bool = ..., scrollable: bool | None = ... + ) -> _T_cur: ... class DictCursor(DictCursorBase): def __init__(self, *args, **kwargs) -> None: ... index: Any def execute(self, query, vars: Any | None = ...): ... def callproc(self, procname, vars: Any | None = ...): ... + def fetchone(self) -> DictRow | None: ... # type: ignore[override] + def fetchmany(self, size: int | None = ...) -> list[DictRow]: ... # type: ignore[override] + def fetchall(self) -> list[DictRow]: ... # type: ignore[override] + def __next__(self) -> DictRow: ... # type: ignore[override] -class DictRow(List[Any]): +class DictRow(list[Any]): def __init__(self, cursor) -> None: ... def __getitem__(self, x): ... def __setitem__(self, x, v) -> None: ... @@ -58,20 +74,56 @@ class DictRow(List[Any]): def __reduce__(self): ... class RealDictConnection(_connection): - def cursor(self, *args, **kwargs): ... + @overload + def cursor( + self, name: str | bytes | None = ..., *, withhold: bool = ..., scrollable: bool | None = ... + ) -> RealDictCursor: ... + @overload + def cursor( + self, + name: str | bytes | None = ..., + *, + cursor_factory: Callable[..., _T_cur], + withhold: bool = ..., + scrollable: bool | None = ..., + ) -> _T_cur: ... + @overload + def cursor( + self, name: str | bytes | None, cursor_factory: Callable[..., _T_cur], withhold: bool = ..., scrollable: bool | None = ... + ) -> _T_cur: ... class RealDictCursor(DictCursorBase): def __init__(self, *args, **kwargs) -> None: ... column_mapping: Any def execute(self, query, vars: Any | None = ...): ... def callproc(self, procname, vars: Any | None = ...): ... + def fetchone(self) -> RealDictRow | None: ... # type: ignore[override] + def fetchmany(self, size: int | None = ...) -> list[RealDictRow]: ... # type: ignore[override] + def fetchall(self) -> list[RealDictRow]: ... # type: ignore[override] + def __next__(self) -> RealDictRow: ... # type: ignore[override] class RealDictRow(OrderedDict[Any, Any]): def __init__(self, *args, **kwargs) -> None: ... def __setitem__(self, key, value) -> None: ... class NamedTupleConnection(_connection): - def cursor(self, *args, **kwargs): ... + @overload + def cursor( + self, name: str | bytes | None = ..., *, withhold: bool = ..., scrollable: bool | None = ... + ) -> NamedTupleCursor: ... + @overload + def cursor( + self, + name: str | bytes | None = ..., + *, + cursor_factory: Callable[..., _T_cur], + withhold: bool = ..., + scrollable: bool | None = ..., + ) -> _T_cur: ... + @overload + def cursor( + self, name: str | bytes | None, cursor_factory: Callable[..., _T_cur], withhold: bool = ..., scrollable: bool | None = ... + ) -> _T_cur: ... class NamedTupleCursor(_cursor): Record: Any @@ -79,10 +131,10 @@ class NamedTupleCursor(_cursor): def execute(self, query, vars: Any | None = ...): ... def executemany(self, query, vars): ... def callproc(self, procname, vars: Any | None = ...): ... - def fetchone(self): ... - def fetchmany(self, size: Any | None = ...): ... - def fetchall(self): ... - def __iter__(self): ... + def fetchone(self) -> NamedTuple | None: ... # type: ignore[override] + def fetchmany(self, size: int | None = ...) -> list[NamedTuple]: ... # type: ignore[override] + def fetchall(self) -> list[NamedTuple]: ... # type: ignore[override] + def __next__(self) -> NamedTuple: ... # type: ignore[override] class LoggingConnection(_connection): log: Any diff --git a/stubs/psycopg2/psycopg2/pool.pyi b/stubs/psycopg2/psycopg2/pool.pyi index b3aee45..6bcf1b6 100644 --- a/stubs/psycopg2/psycopg2/pool.pyi +++ b/stubs/psycopg2/psycopg2/pool.pyi @@ -9,14 +9,15 @@ class AbstractConnectionPool: maxconn: Any closed: bool def __init__(self, minconn, maxconn, *args, **kwargs) -> None: ... + # getconn, putconn and closeall are officially documented as methods of the + # abstract base class, but in reality, they only exist on the children classes + def getconn(self, key: Any | None = ...): ... + def putconn(self, conn: Any, key: Any | None = ..., close: bool = ...) -> None: ... + def closeall(self) -> None: ... -class SimpleConnectionPool(AbstractConnectionPool): - getconn: Any - putconn: Any - closeall: Any +class SimpleConnectionPool(AbstractConnectionPool): ... class ThreadedConnectionPool(AbstractConnectionPool): - def __init__(self, minconn, maxconn, *args, **kwargs) -> None: ... - def getconn(self, key: Any | None = ...): ... + # This subclass has a default value for conn which doesn't exist + # in the SimpleConnectionPool class, nor in the documentation def putconn(self, conn: Any | None = ..., key: Any | None = ..., close: bool = ...) -> None: ... - def closeall(self) -> None: ... diff --git a/stubs/psycopg2/psycopg2/sql.pyi b/stubs/psycopg2/psycopg2/sql.pyi index be30d72..17cada9 100644 --- a/stubs/psycopg2/psycopg2/sql.pyi +++ b/stubs/psycopg2/psycopg2/sql.pyi @@ -1,48 +1,49 @@ +from collections.abc import Iterator from typing import Any class Composable: def __init__(self, wrapped) -> None: ... - def as_string(self, context) -> None: ... - def __add__(self, other): ... - def __mul__(self, n): ... - def __eq__(self, other): ... - def __ne__(self, other): ... + def as_string(self, context) -> str: ... + def __add__(self, other) -> Composed: ... + def __mul__(self, n) -> Composed: ... + def __eq__(self, other) -> bool: ... + def __ne__(self, other) -> bool: ... class Composed(Composable): def __init__(self, seq) -> None: ... @property - def seq(self): ... - def as_string(self, context): ... - def __iter__(self): ... - def __add__(self, other): ... - def join(self, joiner): ... + def seq(self) -> list[Composable]: ... + def as_string(self, context) -> str: ... + def __iter__(self) -> Iterator[Composable]: ... + def __add__(self, other) -> Composed: ... + def join(self, joiner) -> Composed: ... class SQL(Composable): def __init__(self, string) -> None: ... @property - def string(self): ... - def as_string(self, context): ... - def format(self, *args, **kwargs): ... - def join(self, seq): ... + def string(self) -> str: ... + def as_string(self, context) -> str: ... + def format(self, *args, **kwargs) -> Composed: ... + def join(self, seq) -> Composed: ... class Identifier(Composable): def __init__(self, *strings) -> None: ... @property - def strings(self): ... + def strings(self) -> tuple[str, ...]: ... @property - def string(self): ... - def as_string(self, context): ... + def string(self) -> str: ... + def as_string(self, context) -> str: ... class Literal(Composable): @property def wrapped(self): ... - def as_string(self, context): ... + def as_string(self, context) -> str: ... class Placeholder(Composable): def __init__(self, name: Any | None = ...) -> None: ... @property - def name(self): ... - def as_string(self, context): ... + def name(self) -> str | None: ... + def as_string(self, context) -> str: ... NULL: Any DEFAULT: Any diff --git a/stubs/pyOpenSSL/METADATA.toml b/stubs/pyOpenSSL/METADATA.toml index 098d93d..2c3509e 100644 --- a/stubs/pyOpenSSL/METADATA.toml +++ b/stubs/pyOpenSSL/METADATA.toml @@ -1,3 +1,2 @@ -version = "20.0" -python2 = true +version = "22.1.*" requires = ["types-cryptography"] diff --git a/stubs/pyOpenSSL/OpenSSL/SSL.pyi b/stubs/pyOpenSSL/OpenSSL/SSL.pyi index 13b618a..7754145 100644 --- a/stubs/pyOpenSSL/OpenSSL/SSL.pyi +++ b/stubs/pyOpenSSL/OpenSSL/SSL.pyi @@ -1,7 +1,10 @@ import socket -from typing import Any, Callable, Sequence +from _socket import _Address, _RetAddress +from _typeshed import Incomplete, ReadableBuffer +from collections.abc import Callable, MutableSequence, Sequence +from typing import Any, TypeVar -from OpenSSL.crypto import X509, PKey +from OpenSSL.crypto import X509, PKey, X509Name OPENSSL_VERSION_NUMBER: int SSLEAY_VERSION: int @@ -13,24 +16,20 @@ SSLEAY_BUILT_ON: int SENT_SHUTDOWN: int RECEIVED_SHUTDOWN: int -SSLv2_METHOD: int -SSLv3_METHOD: int SSLv23_METHOD: int TLSv1_METHOD: int TLSv1_1_METHOD: int TLSv1_2_METHOD: int -# To be added in pyOpenSSL 21 +TLS_METHOD: int +TLS_SERVER_METHOD: int +TLS_CLIENT_METHOD: int -# TLS_METHOD: int -# TLS_SERVER_METHOD: int -# TLS_CLIENT_METHOD: int - -# SSL3_VERSION: int -# TLS1_VERSION: int -# TLS1_1_VERSION: int -# TLS1_2_VERSION: int -# TLS1_3_VERSION: int +SSL3_VERSION: int +TLS1_VERSION: int +TLS1_1_VERSION: int +TLS1_2_VERSION: int +TLS1_3_VERSION: int OP_NO_SSLv2: int OP_NO_SSLv3: int @@ -113,38 +112,78 @@ class SysCallError(Error): ... def SSLeay_version(type: int) -> str: ... -class Session(object): ... +class Session: ... -class Connection(object): - def __getattr__(self, name: str) -> Any: ... # incomplete +class Connection: + def __getattr__(self, name: str) -> Any: ... # takes attributes from `self._socket` def __init__(self, context: Context, socket: socket.socket | None = ...) -> None: ... + def get_context(self) -> Context: ... + def set_context(self, context: Context) -> None: ... + def get_servername(self) -> bytes | None: ... + def set_tlsext_host_name(self, name: bytes) -> None: ... + def pending(self) -> int: ... + def send(self, buf: ReadableBuffer | str, flags: int = ...) -> int: ... + write = send + def sendall(self, buf: ReadableBuffer | str, flags: int = ...) -> int: ... + def recv(self, bufsiz: int, flags: int | None = ...) -> bytes: ... + read = recv + def recv_into(self, buffer: MutableSequence[int], nbytes: int | None = ..., flags: int | None = ...) -> int: ... def connect(self, addr: str | bytes | Sequence[str | int]) -> None: ... + def connect_ex(self, addr: _Address | bytes) -> int: ... + def accept(self) -> tuple[Connection, _RetAddress]: ... + def shutdown(self) -> bool: ... def do_handshake(self) -> None: ... - def get_peer_certificate(self) -> X509: ... - def set_tlsext_host_name(self, name: bytes) -> None: ... + def get_certificate(self) -> X509 | None: ... + def get_peer_certificate(self) -> X509 | None: ... + def get_peer_cert_chain(self) -> list[X509] | None: ... + def get_verified_chain(self) -> list[X509] | None: ... def bio_read(self, bufsiz: int) -> bytes: ... def bio_write(self, buf: bytes) -> int: ... - def recv(self, bufsiz: int, flags: int | None = ...) -> bytes: ... - def sendall(self, buf: bytes, flags: int = ...) -> int: ... + def bio_shutdown(self) -> None: ... + def renegotiate(self) -> bool: ... + def renegotiate_pending(self) -> bool: ... + def total_renegotiations(self) -> int: ... def set_accept_state(self) -> None: ... def set_connect_state(self) -> None: ... - def get_peer_cert_chain(self) -> list[X509]: ... - def get_alpn_proto_negotiated(self) -> bytes: ... + def get_client_ca_list(self) -> list[X509Name]: ... + def get_cipher_list(self) -> list[str]: ... def get_cipher_name(self) -> str | None: ... + def get_cipher_bits(self) -> int | None: ... + def get_cipher_version(self) -> str | None: ... def get_protocol_version_name(self) -> str: ... + def get_protocol_version(self) -> int: ... def get_shutdown(self) -> int: ... + def set_shutdown(self, state: int) -> None: ... + def get_state_string(self) -> bytes: ... + def server_random(self) -> bytes | None: ... + def client_random(self) -> bytes | None: ... + def master_key(self) -> bytes | None: ... + def export_keying_material( + self, label: Incomplete, olen: Incomplete, context: Incomplete = ... + ) -> Incomplete: ... # TODO: type, see RFC-5705 def get_app_data(self) -> Any: ... def set_app_data(self, data: Any) -> None: ... + def sock_shutdown(self, __how: int) -> None: ... # alias to `_socket.socket.shutdown` + def want_read(self) -> bool: ... + def want_write(self) -> bool: ... + def get_session(self) -> Session | None: ... + def set_session(self, session: Session) -> None: ... + def get_finished(self) -> bytes | None: ... + def get_peer_finished(self) -> bytes | None: ... + def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ... + def get_alpn_proto_negotiated(self) -> bytes: ... + def request_ocsp(self) -> None: ... + +_T = TypeVar("_T") -class Context(object): - def __getattr__(self, name: str) -> Any: ... # incomplete +class Context: + def __getattr__(self, name: str) -> Incomplete: ... def __init__(self, method: int) -> None: ... def load_verify_locations(self, cafile: str | None, capath: str | None = ...) -> None: ... def set_options(self, options: int) -> None: ... def set_verify(self, mode: int, callback: Callable[[Connection, X509, int, int, int], bool] | None = ...) -> None: ... - # will be added in pyOpenSSL 21 - # def set_min_proto_version(self, version: int) -> None: ... - # def set_max_proto_version(self, version: int) -> None: ... + def set_min_proto_version(self, version: int) -> None: ... + def set_max_proto_version(self, version: int) -> None: ... def use_certificate_chain_file(self, certfile: str | bytes) -> None: ... def use_certificate_file(self, certfile: str | bytes, filetype: int = ...) -> None: ... def use_certificate(self, cert: X509) -> None: ... @@ -152,6 +191,10 @@ class Context(object): def use_privatekey(self, pkey: PKey) -> None: ... def add_extra_chain_cert(self, certobj: X509) -> None: ... def set_cipher_list(self, cipher_list: bytes) -> None: ... - def set_keylog_callback(self, callback: Callable[[Connection, bytes], None]) -> None: ... + def set_keylog_callback(self, callback: Callable[[Connection, bytes], object]) -> None: ... def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ... def set_alpn_select_callback(self, callback: Callable[[Connection, list[bytes]], bytes]) -> None: ... + def set_ocsp_server_callback(self, callback: Callable[[Connection, _T | None], bytes], data: _T | None = ...) -> None: ... + def set_ocsp_client_callback( + self, callback: Callable[[Connection, bytes, _T | None], bool], data: _T | None = ... + ) -> None: ... diff --git a/stubs/pyOpenSSL/OpenSSL/crypto.pyi b/stubs/pyOpenSSL/OpenSSL/crypto.pyi index ed0cda5..f9e1fea 100644 --- a/stubs/pyOpenSSL/OpenSSL/crypto.pyi +++ b/stubs/pyOpenSSL/OpenSSL/crypto.pyi @@ -1,11 +1,14 @@ +from _typeshed import StrOrBytesPath +from collections.abc import Callable, Iterable, Sequence from datetime import datetime -from typing import Any, Callable, Iterable, Sequence, Set, Text, Tuple, Union +from typing import Any +from typing_extensions import TypeAlias from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey from cryptography.x509 import Certificate, CertificateRevocationList, CertificateSigningRequest -_Key = Union[DSAPrivateKey, DSAPublicKey, RSAPrivateKey, RSAPublicKey] +_Key: TypeAlias = DSAPrivateKey | DSAPublicKey | RSAPrivateKey | RSAPublicKey FILETYPE_PEM: int FILETYPE_ASN1: int @@ -30,28 +33,28 @@ class PKey: def type(self) -> int: ... class X509Name: - countryName: Text - C: Text - stateOrProvinceName: Text - ST: Text - localityName: Text - L: Text - organizationName: Text - O: Text - organizationalUnitName: Text - OU: Text - commonName: Text - CN: Text - emailAddress: Text + countryName: str + C: str + stateOrProvinceName: str + ST: str + localityName: str + L: str + organizationName: str + O: str + organizationalUnitName: str + OU: str + commonName: str + CN: str + emailAddress: str def __init__(self, name: X509Name) -> None: ... def der(self) -> bytes: ... - def get_components(self) -> list[Tuple[bytes, bytes]]: ... + def get_components(self) -> list[tuple[bytes, bytes]]: ... def hash(self) -> int: ... class X509: def __init__(self) -> None: ... def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ... - def digest(self, digest_name: bytes) -> bytes: ... + def digest(self, digest_name: str) -> bytes: ... @classmethod def from_cryptography(cls, crypto_cert: Certificate) -> X509: ... def get_extension(self, index: int) -> X509Extension: ... @@ -74,7 +77,7 @@ class X509: def set_serial_number(self, serial: int) -> None: ... def set_subject(self, subject: X509Name) -> None: ... def set_version(self, version: int) -> None: ... - def sign(self, pkey: PKey, digest: Text | bytes) -> None: ... + def sign(self, pkey: PKey, digest: str) -> None: ... def subject_name_hash(self) -> bytes: ... def to_cryptography(self) -> Certificate: ... @@ -89,7 +92,7 @@ class X509Req: def get_version(self) -> int: ... def set_pubkey(self, pkey: PKey) -> None: ... def set_version(self, version: int) -> None: ... - def sign(self, pkey: PKey, digest: Text | bytes) -> None: ... + def sign(self, pkey: PKey, digest: str) -> None: ... def to_cryptography(self) -> CertificateSigningRequest: ... def verify(self, pkey: PKey) -> bool: ... @@ -118,7 +121,7 @@ class CRL: @classmethod def from_cryptography(cls, crypto_crl: CertificateRevocationList) -> CRL: ... def get_issuer(self) -> X509Name: ... - def get_revoked(self) -> Tuple[Revoked, ...]: ... + def get_revoked(self) -> tuple[Revoked, ...]: ... def set_lastUpdate(self, when: bytes) -> None: ... def set_nextUpdate(self, when: bytes) -> None: ... def set_version(self, version: int) -> None: ... @@ -129,7 +132,7 @@ class X509Store: def __init__(self) -> None: ... def add_cert(self, cert: X509) -> None: ... def add_crl(self, crl: CRL) -> None: ... - def load_locations(self, cafile: Text | bytes, capath: Text | bytes | None = ...) -> None: ... + def load_locations(self, cafile: StrOrBytesPath, capath: StrOrBytesPath | None = ...) -> None: ... def set_flags(self, flags: int) -> None: ... def set_time(self, vfy_time: datetime) -> None: ... @@ -140,8 +143,9 @@ class X509StoreContext: def verify_certificate(self) -> None: ... class X509StoreContextError(Exception): + errors: list[Any] certificate: X509 - def __init__(self, message: Text | bytes, certificate: X509) -> None: ... + def __init__(self, message: str, errors: list[Any], certificate: X509) -> None: ... class X509StoreFlags: CRL_CHECK: int @@ -157,7 +161,7 @@ class X509StoreFlags: CB_ISSUER_CHECK: int class PKCS7: - def get_type_name(self) -> Text: ... + def get_type_name(self) -> str: ... def type_is_data(self) -> bool: ... def type_is_enveloped(self) -> bool: ... def type_is_signed(self) -> bool: ... @@ -166,7 +170,7 @@ class PKCS7: class PKCS12: def __init__(self) -> None: ... def export(self, passphrase: bytes | None = ..., iter: int = ..., maciter: int = ...) -> bytes: ... - def get_ca_certificates(self) -> Tuple[X509, ...]: ... + def get_ca_certificates(self) -> tuple[X509, ...]: ... def get_certificate(self) -> X509: ... def get_friendlyname(self) -> bytes | None: ... def get_privatekey(self) -> PKey: ... @@ -180,24 +184,24 @@ class NetscapeSPKI: def b64_encode(self) -> bytes: ... def get_pubkey(self) -> PKey: ... def set_pubkey(self, pkey: PKey) -> None: ... - def sign(self, pkey: PKey, digest: bytes) -> None: ... + def sign(self, pkey: PKey, digest: str) -> None: ... def verify(self, key: PKey) -> bool: ... -def get_elliptic_curves() -> Set[_EllipticCurve]: ... -def get_elliptic_curve(name: Text) -> _EllipticCurve: ... +def get_elliptic_curves() -> set[_EllipticCurve]: ... +def get_elliptic_curve(name: str) -> _EllipticCurve: ... def dump_certificate(type: int, cert: X509) -> bytes: ... def load_certificate(type: int, buffer: bytes) -> X509: ... def dump_certificate_request(type: int, req: X509Req) -> bytes: ... def load_certificate_request(type: int, buffer: bytes) -> X509Req: ... def dump_privatekey( - type: int, pkey: PKey, cipher: bytes | None = ..., passphrase: bytes | Callable[[], bytes] | None = ... + type: int, pkey: PKey, cipher: str | None = ..., passphrase: bytes | Callable[[], bytes] | None = ... ) -> bytes: ... -def load_privatekey(type: int, buffer: Text | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ... +def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ... def dump_publickey(type: int, pkey: PKey) -> bytes: ... -def load_publickey(type: int, buffer: Text | bytes) -> PKey: ... +def load_publickey(type: int, buffer: str | bytes) -> PKey: ... def dump_crl(type: int, crl: CRL) -> bytes: ... -def load_crl(type: int, buffer: Text | bytes) -> CRL: ... -def load_pkcs7_data(type: int, buffer: Text | bytes) -> PKCS7: ... -def load_pkcs12(buffer: Text | bytes, passphrase: bytes | None = ...) -> PKCS12: ... -def sign(pkey: PKey, data: Text | bytes, digest: Text | bytes) -> bytes: ... -def verify(cert: X509, signature: bytes, data: Text | bytes, digest: Text | bytes) -> None: ... +def load_crl(type: int, buffer: str | bytes) -> CRL: ... +def load_pkcs7_data(type: int, buffer: str | bytes) -> PKCS7: ... +def load_pkcs12(buffer: str | bytes, passphrase: bytes | None = ...) -> PKCS12: ... +def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes: ... +def verify(cert: X509, signature: bytes, data: str | bytes, digest: str) -> None: ... diff --git a/stubs/pyOpenSSL/OpenSSL/rand.pyi b/stubs/pyOpenSSL/OpenSSL/rand.pyi new file mode 100644 index 0000000..30a76ee --- /dev/null +++ b/stubs/pyOpenSSL/OpenSSL/rand.pyi @@ -0,0 +1,4 @@ +from typing_extensions import Literal + +def add(buffer: bytes, entropy: int) -> None: ... +def status() -> Literal[0, 1]: ... diff --git a/stubs/pyOpenSSL/OpenSSL/version.pyi b/stubs/pyOpenSSL/OpenSSL/version.pyi new file mode 100644 index 0000000..c57554e --- /dev/null +++ b/stubs/pyOpenSSL/OpenSSL/version.pyi @@ -0,0 +1,9 @@ +__version__: str + +__title__: str +__uri__: str +__summary__: str +__author__: str +__email__: str +__license__: str +__copyright__: str diff --git a/stubs/pyRFC3339/METADATA.toml b/stubs/pyRFC3339/METADATA.toml index 5f15410..bad265e 100644 --- a/stubs/pyRFC3339/METADATA.toml +++ b/stubs/pyRFC3339/METADATA.toml @@ -1 +1 @@ -version = "0.1" +version = "1.1" diff --git a/stubs/pyaudio/@tests/stubtest_allowlist.txt b/stubs/pyaudio/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..ceb8f4a --- /dev/null +++ b/stubs/pyaudio/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +pyaudio.PaMacCoreStreamInfo +pyaudio.paMacCoreStreamInfo diff --git a/stubs/pyaudio/METADATA.toml b/stubs/pyaudio/METADATA.toml index 0291bda..a259cca 100644 --- a/stubs/pyaudio/METADATA.toml +++ b/stubs/pyaudio/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.2" -python2 = true +version = "0.2.*" + +[tool.stubtest] +apt_dependencies = ["portaudio19-dev"] diff --git a/stubs/pyaudio/pyaudio.pyi b/stubs/pyaudio/pyaudio.pyi index 6849056..d773029 100644 --- a/stubs/pyaudio/pyaudio.pyi +++ b/stubs/pyaudio/pyaudio.pyi @@ -1,76 +1,76 @@ -from typing import Callable, Mapping, Optional, Sequence, Tuple, Union -from typing_extensions import Final +from collections.abc import Callable, Mapping, Sequence +from typing_extensions import Final, TypeAlias -paFloat32: Final[int] = ... -paInt32: Final[int] = ... -paInt24: Final[int] = ... -paInt16: Final[int] = ... -paInt8: Final[int] = ... -paUInt8: Final[int] = ... -paCustomFormat: Final[int] = ... +paFloat32: Final[int] +paInt32: Final[int] +paInt24: Final[int] +paInt16: Final[int] +paInt8: Final[int] +paUInt8: Final[int] +paCustomFormat: Final[int] -paInDevelopment: Final[int] = ... -paDirectSound: Final[int] = ... -paMME: Final[int] = ... -paASIO: Final[int] = ... -paSoundManager: Final[int] = ... -paCoreAudio: Final[int] = ... -paOSS: Final[int] = ... -paALSA: Final[int] = ... -paAL: Final[int] = ... -paBeOS: Final[int] = ... -paWDMKS: Final[int] = ... -paJACK: Final[int] = ... -paWASAPI: Final[int] = ... -paNoDevice: Final[int] = ... +paInDevelopment: Final[int] +paDirectSound: Final[int] +paMME: Final[int] +paASIO: Final[int] +paSoundManager: Final[int] +paCoreAudio: Final[int] +paOSS: Final[int] +paALSA: Final[int] +paAL: Final[int] +paBeOS: Final[int] +paWDMKS: Final[int] +paJACK: Final[int] +paWASAPI: Final[int] +paNoDevice: Final[int] -paNoError: Final[int] = ... -paNotInitialized: Final[int] = ... -paUnanticipatedHostError: Final[int] = ... -paInvalidChannelCount: Final[int] = ... -paInvalidSampleRate: Final[int] = ... -paInvalidDevice: Final[int] = ... -paInvalidFlag: Final[int] = ... -paSampleFormatNotSupported: Final[int] = ... -paBadIODeviceCombination: Final[int] = ... -paInsufficientMemory: Final[int] = ... -paBufferTooBig: Final[int] = ... -paBufferTooSmall: Final[int] = ... -paNullCallback: Final[int] = ... -paBadStreamPtr: Final[int] = ... -paTimedOut: Final[int] = ... -paInternalError: Final[int] = ... -paDeviceUnavailable: Final[int] = ... -paIncompatibleHostApiSpecificStreamInfo: Final[int] = ... -paStreamIsStopped: Final[int] = ... -paStreamIsNotStopped: Final[int] = ... -paInputOverflowed: Final[int] = ... -paOutputUnderflowed: Final[int] = ... -paHostApiNotFound: Final[int] = ... -paInvalidHostApi: Final[int] = ... -paCanNotReadFromACallbackStream: Final[int] = ... -paCanNotWriteToACallbackStream: Final[int] = ... -paCanNotReadFromAnOutputOnlyStream: Final[int] = ... -paCanNotWriteToAnInputOnlyStream: Final[int] = ... -paIncompatibleStreamHostApi: Final[int] = ... +paNoError: Final[int] +paNotInitialized: Final[int] +paUnanticipatedHostError: Final[int] +paInvalidChannelCount: Final[int] +paInvalidSampleRate: Final[int] +paInvalidDevice: Final[int] +paInvalidFlag: Final[int] +paSampleFormatNotSupported: Final[int] +paBadIODeviceCombination: Final[int] +paInsufficientMemory: Final[int] +paBufferTooBig: Final[int] +paBufferTooSmall: Final[int] +paNullCallback: Final[int] +paBadStreamPtr: Final[int] +paTimedOut: Final[int] +paInternalError: Final[int] +paDeviceUnavailable: Final[int] +paIncompatibleHostApiSpecificStreamInfo: Final[int] +paStreamIsStopped: Final[int] +paStreamIsNotStopped: Final[int] +paInputOverflowed: Final[int] +paOutputUnderflowed: Final[int] +paHostApiNotFound: Final[int] +paInvalidHostApi: Final[int] +paCanNotReadFromACallbackStream: Final[int] +paCanNotWriteToACallbackStream: Final[int] +paCanNotReadFromAnOutputOnlyStream: Final[int] +paCanNotWriteToAnInputOnlyStream: Final[int] +paIncompatibleStreamHostApi: Final[int] -paContinue: Final[int] = ... -paComplete: Final[int] = ... -paAbort: Final[int] = ... +paContinue: Final[int] +paComplete: Final[int] +paAbort: Final[int] -paInputUnderflow: Final[int] = ... -paInputOverflow: Final[int] = ... -paOutputUnderflow: Final[int] = ... -paOutputOverflow: Final[int] = ... -paPrimingOutput: Final[int] = ... +paInputUnderflow: Final[int] +paInputOverflow: Final[int] +paOutputUnderflow: Final[int] +paOutputOverflow: Final[int] +paPrimingOutput: Final[int] paMacCoreStreamInfo: PaMacCoreStreamInfo # Auxiliary types -_ChannelMap = Sequence[int] -_PaHostApiInfo = Mapping[str, Union[str, int]] -_PaDeviceInfo = Mapping[str, Union[str, int, float]] -_StreamCallback = Callable[[Optional[bytes], int, Mapping[str, float], int], Tuple[Optional[bytes], int]] +_ChannelMap: TypeAlias = Sequence[int] +_PaHostApiInfo: TypeAlias = Mapping[str, str | int] +_PaDeviceInfo: TypeAlias = Mapping[str, str | float] +_StreamCallback: TypeAlias = Callable[[bytes | None, int, Mapping[str, float], int], tuple[bytes | None, int]] def get_format_from_width(width: int, unsigned: bool = ...) -> int: ... def get_portaudio_version() -> int: ... diff --git a/stubs/pycurl/@tests/stubtest_allowlist.txt b/stubs/pycurl/@tests/stubtest_allowlist.txt index d4ba5cd..4f56e2f 100644 --- a/stubs/pycurl/@tests/stubtest_allowlist.txt +++ b/stubs/pycurl/@tests/stubtest_allowlist.txt @@ -1 +1 @@ -pycurl +pycurl.VERSION_FIRST diff --git a/stubs/pycurl/METADATA.toml b/stubs/pycurl/METADATA.toml index 31f638b..575cf22 100644 --- a/stubs/pycurl/METADATA.toml +++ b/stubs/pycurl/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.1" -python2 = true +version = "7.45.*" + +[tool.stubtest] +apt_dependencies = ["libcurl4-openssl-dev"] diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index dc17860..2815eb9 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -1,6 +1,5 @@ -# TODO(MichalPokorny): more precise types - -from typing import Any, Text, Tuple +from typing import Any +from typing_extensions import final GLOBAL_ACK_EINTR: int GLOBAL_ALL: int @@ -14,17 +13,18 @@ def global_cleanup() -> None: ... version: str -def version_info() -> Tuple[int, str, int, str, int, str, int, str, Tuple[str, ...], Any, int, Any]: ... +def version_info() -> tuple[int, str, int, str, int, str, int, str, tuple[str, ...], Any, int, Any]: ... class error(Exception): ... -class Curl(object): +@final +class Curl: def close(self) -> None: ... def setopt(self, option: int, value: Any) -> None: ... def setopt_string(self, option: int, value: str) -> None: ... def perform(self) -> None: ... def perform_rb(self) -> bytes: ... - def perform_rs(self) -> Text: ... + def perform_rs(self) -> str: ... def getinfo(self, info: Any) -> Any: ... def getinfo_raw(self, info: Any) -> Any: ... def reset(self) -> None: ... @@ -34,17 +34,20 @@ class Curl(object): # TODO(MichalPokorny): wat? USERPWD: int -class CurlMulti(object): +@final +class CurlMulti: def close(self) -> None: ... def add_handle(self, obj: Curl) -> None: ... def remove_handle(self, obj: Curl) -> None: ... - def perform(self) -> Tuple[Any, int]: ... - def fdset(self) -> Tuple[list[Any], list[Any], list[Any]]: ... + def setopt(self, option: int, value: Any) -> None: ... + def perform(self) -> tuple[Any, int]: ... + def fdset(self) -> tuple[list[Any], list[Any], list[Any]]: ... def select(self, timeout: float = ...) -> int: ... - def info_read(self, max_objects: int = ...) -> Tuple[int, list[Any], list[Any]]: ... - def socket_action(self, sockfd: int, ev_bitmask: int) -> Tuple[int, int]: ... + def info_read(self, max_objects: int = ...) -> tuple[int, list[Any], list[Any]]: ... + def socket_action(self, sockfd: int, ev_bitmask: int) -> tuple[int, int]: ... -class CurlShare(object): +@final +class CurlShare: def close(self) -> None: ... def setopt(self, option: int, value: Any) -> Any: ... diff --git a/stubs/pyfarmhash/METADATA.toml b/stubs/pyfarmhash/METADATA.toml index 7c96902..67a2d5d 100644 --- a/stubs/pyfarmhash/METADATA.toml +++ b/stubs/pyfarmhash/METADATA.toml @@ -1 +1,4 @@ -version = "0.2" +version = "0.3.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/pyflakes/@tests/stubtest_allowlist.txt b/stubs/pyflakes/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..4b8726c --- /dev/null +++ b/stubs/pyflakes/@tests/stubtest_allowlist.txt @@ -0,0 +1,25 @@ +# These all have class-level defaults that differ from the instance attributes +pyflakes.messages.CommentAnnotationSyntaxError.message_args +pyflakes.messages.DuplicateArgument.message_args +pyflakes.messages.ForwardAnnotationSyntaxError.message_args +pyflakes.messages.FutureFeatureNotDefined.message_args +pyflakes.messages.ImportShadowedByLoopVar.message_args +pyflakes.messages.ImportStarUsage.message_args +pyflakes.messages.ImportStarUsed.message_args +pyflakes.messages.MultiValueRepeatedKeyLiteral.message_args +pyflakes.messages.MultiValueRepeatedKeyVariable.message_args +pyflakes.messages.PercentFormatExtraNamedArguments.message_args +pyflakes.messages.PercentFormatInvalidFormat.message_args +pyflakes.messages.PercentFormatMissingArgument.message_args +pyflakes.messages.PercentFormatPositionalCountMismatch.message_args +pyflakes.messages.PercentFormatUnsupportedFormatCharacter.message_args +pyflakes.messages.RedefinedWhileUnused.message_args +pyflakes.messages.StringDotFormatExtraNamedArguments.message_args +pyflakes.messages.StringDotFormatExtraPositionalArguments.message_args +pyflakes.messages.StringDotFormatInvalidFormat.message_args +pyflakes.messages.StringDotFormatMissingArgument.message_args +pyflakes.messages.UndefinedExport.message_args +pyflakes.messages.UndefinedLocal.message_args +pyflakes.messages.UndefinedName.message_args +pyflakes.messages.UnusedImport.message_args +pyflakes.messages.UnusedVariable.message_args diff --git a/stubs/pyflakes/METADATA.toml b/stubs/pyflakes/METADATA.toml new file mode 100644 index 0000000..43ea039 --- /dev/null +++ b/stubs/pyflakes/METADATA.toml @@ -0,0 +1 @@ +version = "2.5.*" diff --git a/stubs/pyflakes/pyflakes/__init__.pyi b/stubs/pyflakes/pyflakes/__init__.pyi new file mode 100644 index 0000000..bda5b5a --- /dev/null +++ b/stubs/pyflakes/pyflakes/__init__.pyi @@ -0,0 +1 @@ +__version__: str diff --git a/stubs/pyflakes/pyflakes/api.pyi b/stubs/pyflakes/pyflakes/api.pyi new file mode 100644 index 0000000..945a7a3 --- /dev/null +++ b/stubs/pyflakes/pyflakes/api.pyi @@ -0,0 +1,16 @@ +from collections.abc import Iterable, Iterator, Sequence +from re import Pattern +from typing import Any + +from pyflakes.reporter import Reporter + +__all__ = ["check", "checkPath", "checkRecursive", "iterSourceCode", "main"] + +PYTHON_SHEBANG_REGEX: Pattern[bytes] + +def check(codeString: str, filename: str, reporter: Reporter | None = ...) -> int: ... +def checkPath(filename, reporter: Reporter | None = ...) -> int: ... +def isPythonFile(filename) -> bool: ... +def iterSourceCode(paths: Iterable[Any]) -> Iterator[Any]: ... +def checkRecursive(paths: Iterable[Any], reporter: Reporter) -> int: ... +def main(prog: str | None = ..., args: Sequence[Any] | None = ...) -> None: ... diff --git a/stubs/pyflakes/pyflakes/checker.pyi b/stubs/pyflakes/pyflakes/checker.pyi new file mode 100644 index 0000000..4ed3242 --- /dev/null +++ b/stubs/pyflakes/pyflakes/checker.pyi @@ -0,0 +1,348 @@ +import ast +import sys +from collections.abc import Callable, Iterable, Iterator +from re import Pattern +from tokenize import TokenInfo +from typing import Any, ClassVar, TypeVar, overload +from typing_extensions import Literal, ParamSpec, TypeAlias + +from pyflakes.messages import Message + +_AnyFunction: TypeAlias = Callable[..., Any] +_F = TypeVar("_F", bound=_AnyFunction) +_P = ParamSpec("_P") +_T = TypeVar("_T") + +PY38_PLUS: bool +PYPY: bool + +def getAlternatives(n: ast.If | ast.Try) -> list[ast.AST]: ... + +FOR_TYPES: tuple[type[ast.For], type[ast.AsyncFor]] +TYPE_COMMENT_RE: Pattern[str] +ASCII_NON_ALNUM: str +TYPE_IGNORE_RE: Pattern[str] +TYPE_FUNC_RE: Pattern[str] +MAPPING_KEY_RE: Pattern[str] +CONVERSION_FLAG_RE: Pattern[str] +WIDTH_RE: Pattern[str] +PRECISION_RE: Pattern[str] +LENGTH_RE: Pattern[str] +VALID_CONVERSIONS: frozenset[str] + +_FormatType: TypeAlias = tuple[str | None, str | None, str | None, str | None, str] +_PercentFormat: TypeAlias = tuple[str, _FormatType | None] + +def parse_percent_format(s: str) -> tuple[_PercentFormat, ...]: ... + +class _FieldsOrder(dict[type[ast.AST], tuple[str, ...]]): + def __missing__(self, node_class: type[ast.AST]) -> tuple[str, ...]: ... + +def counter(items: Iterable[_T]) -> dict[_T, int]: ... + +_OmitType: TypeAlias = str | tuple[str, ...] | None + +def iter_child_nodes(node: ast.AST, omit: _OmitType = ..., _fields_order: _FieldsOrder = ...) -> Iterator[ast.AST]: ... +@overload +def convert_to_value(item: ast.Str) -> str: ... # type: ignore[misc] +@overload +def convert_to_value(item: ast.Bytes) -> bytes: ... # type: ignore[misc] +@overload +def convert_to_value(item: ast.Tuple) -> tuple[Any, ...]: ... # type: ignore[misc] +@overload +def convert_to_value(item: ast.Name | ast.NameConstant) -> Any: ... +@overload +def convert_to_value(item: ast.AST) -> UnhandledKeyType: ... +def is_notimplemented_name_node(node: object) -> bool: ... + +class Binding: + name: str + source: ast.AST | None + used: Literal[False] | tuple[Any, ast.AST] + def __init__(self, name: str, source: ast.AST | None) -> None: ... + def redefines(self, other: Binding) -> bool: ... + +class Definition(Binding): ... + +class Builtin(Definition): + def __init__(self, name: str) -> None: ... + +class UnhandledKeyType: ... + +class VariableKey: + name: str + def __init__(self, item: ast.Name) -> None: ... + def __eq__(self, compare: object) -> bool: ... + def __hash__(self) -> int: ... + +class Importation(Definition): + fullName: str + redefined: list[Any] + def __init__(self, name: str, source: ast.AST | None, full_name: str | None = ...) -> None: ... + @property + def source_statement(self) -> str: ... + +class SubmoduleImportation(Importation): + def __init__(self, name: str, source: ast.Import | None) -> None: ... + +class ImportationFrom(Importation): + module: str + real_name: str + def __init__(self, name: str, source: ast.AST, module: str, real_name: str | None = ...) -> None: ... + +class StarImportation(Importation): + def __init__(self, name: str, source: ast.AST) -> None: ... + +class FutureImportation(ImportationFrom): + used: tuple[Any, ast.AST] + def __init__(self, name: str, source: ast.AST, scope) -> None: ... + +class Argument(Binding): ... +class Assignment(Binding): ... + +class Annotation(Binding): + def redefines(self, other: Binding) -> Literal[False]: ... + +class FunctionDefinition(Definition): ... +class ClassDefinition(Definition): ... + +class ExportBinding(Binding): + names: list[str] + def __init__(self, name: str, source: ast.AST, scope: Scope) -> None: ... + +class Scope(dict[str, Binding]): + importStarred: bool + +class ClassScope(Scope): ... + +class FunctionScope(Scope): + usesLocals: bool + alwaysUsed: ClassVar[set[str]] + globals: set[str] + returnValue: Any + isGenerator: bool + def __init__(self) -> None: ... + def unusedAssignments(self) -> Iterator[tuple[str, Binding]]: ... + +class GeneratorScope(Scope): ... +class ModuleScope(Scope): ... +class DoctestScope(ModuleScope): ... + +class DummyNode: + lineno: int + col_offset: int + def __init__(self, lineno: int, col_offset: int) -> None: ... + +class DetectClassScopedMagic: + names: list[str] + +def getNodeName(node: ast.AST) -> str: ... + +TYPING_MODULES: frozenset[Literal["typing", "typing_extensions"]] + +def is_typing_overload(value: Binding, scope_stack) -> bool: ... + +class AnnotationState: + NONE: ClassVar[Literal[0]] + STRING: ClassVar[Literal[1]] + BARE: ClassVar[Literal[2]] + +def in_annotation(func: _F) -> _F: ... +def in_string_annotation(func: _F) -> _F: ... +def make_tokens(code: str | bytes) -> tuple[TokenInfo, ...]: ... + +if sys.version_info >= (3, 8): + _NamedExpr: TypeAlias = ast.NamedExpr +else: + _NamedExpr: TypeAlias = Any + +if sys.version_info >= (3, 10): + _Match: TypeAlias = ast.Match + _MatchCase: TypeAlias = ast.match_case + _MatchValue: TypeAlias = ast.MatchValue + _MatchSingleton: TypeAlias = ast.MatchSingleton + _MatchSequence: TypeAlias = ast.MatchSequence + _MatchStar: TypeAlias = ast.MatchStar + _MatchMapping: TypeAlias = ast.MatchMapping + _MatchClass: TypeAlias = ast.MatchClass + _MatchAs: TypeAlias = ast.MatchAs + _MatchOr: TypeAlias = ast.MatchOr +else: + _Match: TypeAlias = Any + _MatchCase: TypeAlias = Any + _MatchValue: TypeAlias = Any + _MatchSingleton: TypeAlias = Any + _MatchSequence: TypeAlias = Any + _MatchStar: TypeAlias = Any + _MatchMapping: TypeAlias = Any + _MatchClass: TypeAlias = Any + _MatchAs: TypeAlias = Any + _MatchOr: TypeAlias = Any + +class Checker: + nodeDepth: int + offset: tuple[int, int] | None + builtIns: set[str] + deadScopes: list[Any] + messages: list[Any] + filename: str + withDoctest: bool + scopeStack: list[Scope] + exceptHandlers: list[Any] + root: ast.AST + def __init__( + self, + tree: ast.AST, + filename: str = ..., + builtins: Iterable[str] | None = ..., + withDoctest: bool = ..., + file_tokens: tuple[Any, ...] = ..., + ) -> None: ... + def deferFunction(self, callable: _AnyFunction) -> None: ... + def deferAssignment(self, callable: _AnyFunction) -> None: ... + def runDeferred(self, deferred: _AnyFunction) -> None: ... + @property + def futuresAllowed(self) -> bool: ... + @futuresAllowed.setter + def futuresAllowed(self, value: Literal[False]) -> None: ... + @property + def annotationsFutureEnabled(self) -> bool: ... + @annotationsFutureEnabled.setter + def annotationsFutureEnabled(self, value: Literal[True]) -> None: ... + @property + def scope(self) -> Scope: ... + def popScope(self) -> None: ... + def checkDeadScopes(self) -> None: ... + def pushScope(self, scopeClass: type[Scope] = ...) -> None: ... + def report(self, messageClass: Callable[_P, Message], *args: _P.args, **kwargs: _P.kwargs) -> None: ... + def getParent(self, node: ast.AST) -> ast.AST: ... + def getCommonAncestor(self, lnode: ast.AST, rnode: ast.AST, stop: ast.AST) -> ast.AST: ... + def descendantOf(self, node: ast.AST, ancestors: ast.AST, stop: ast.AST) -> bool: ... + def getScopeNode(self, node: ast.AST) -> ast.AST | None: ... + def differentForks(self, lnode: ast.AST, rnode: ast.AST) -> bool: ... + def addBinding(self, node: ast.AST, value: Binding) -> None: ... + def getNodeHandler(self, node_class: type[ast.AST]): ... + def handleNodeLoad(self, node: ast.AST) -> None: ... + def handleNodeStore(self, node: ast.AST) -> None: ... + def handleNodeDelete(self, node: ast.AST) -> None: ... + def handleChildren(self, tree: ast.AST, omit: _OmitType = ...) -> None: ... + def isLiteralTupleUnpacking(self, node: ast.AST) -> bool | None: ... + def isDocstring(self, node: ast.AST) -> bool: ... + def getDocstring(self, node: ast.AST) -> tuple[str, int] | tuple[None, None]: ... + def handleNode(self, node: ast.AST | None, parent) -> None: ... + def handleDoctests(self, node: ast.AST) -> None: ... + def handleStringAnnotation(self, s: str, node: ast.AST, ref_lineno: int, ref_col_offset: int, err: type[Message]) -> None: ... + def handleAnnotation(self, annotation: ast.AST, node: ast.AST) -> None: ... + def ignore(self, node: ast.AST) -> None: ... + def DELETE(self, tree: ast.Delete, omit: _OmitType = ...) -> None: ... + def FOR(self, tree: ast.For, omit: _OmitType = ...) -> None: ... + def ASYNCFOR(self, tree: ast.AsyncFor, omit: _OmitType = ...) -> None: ... + def WHILE(self, tree: ast.While, omit: _OmitType = ...) -> None: ... + def WITH(self, tree: ast.With, omit: _OmitType = ...) -> None: ... + def WITHITEM(self, tree: ast.AST, omit: _OmitType = ...) -> None: ... + def ASYNCWITH(self, tree: ast.AsyncWith, omit: _OmitType = ...) -> None: ... + def EXPR(self, tree: ast.AST, omit: _OmitType = ...) -> None: ... + def ASSIGN(self, tree: ast.Assign, omit: _OmitType = ...) -> None: ... + def PASS(self, node: ast.AST) -> None: ... + def BOOLOP(self, tree: ast.BoolOp, omit: _OmitType = ...) -> None: ... + def UNARYOP(self, tree: ast.UnaryOp, omit: _OmitType = ...) -> None: ... + def SET(self, tree: ast.Set, omit: _OmitType = ...) -> None: ... + def ATTRIBUTE(self, tree: ast.Attribute, omit: _OmitType = ...) -> None: ... + def STARRED(self, tree: ast.Starred, omit: _OmitType = ...) -> None: ... + def NAMECONSTANT(self, tree: ast.NameConstant, omit: _OmitType = ...) -> None: ... + def NAMEDEXPR(self, tree: _NamedExpr, omit: _OmitType = ...) -> None: ... + def SUBSCRIPT(self, node: ast.Subscript) -> None: ... + def CALL(self, node: ast.Call) -> None: ... + def BINOP(self, node: ast.BinOp) -> None: ... + def CONSTANT(self, node: ast.Constant) -> None: ... + if sys.version_info < (3, 8): + def NUM(self, node: ast.Num) -> None: ... + def BYTES(self, node: ast.Bytes) -> None: ... + def ELLIPSIS(self, node: ast.Ellipsis) -> None: ... + + def STR(self, node: ast.Str) -> None: ... + def SLICE(self, tree: ast.Slice, omit: _OmitType = ...) -> None: ... + def EXTSLICE(self, tree: ast.ExtSlice, omit: _OmitType = ...) -> None: ... + def INDEX(self, tree: ast.Index, omit: _OmitType = ...) -> None: ... + def LOAD(self, node: ast.Load) -> None: ... + def STORE(self, node: ast.Store) -> None: ... + def DEL(self, node: ast.Del) -> None: ... + def AUGLOAD(self, node: ast.AugLoad) -> None: ... + def AUGSTORE(self, node: ast.AugStore) -> None: ... + def PARAM(self, node: ast.Param) -> None: ... + def AND(self, node: ast.And) -> None: ... + def OR(self, node: ast.Or) -> None: ... + def ADD(self, node: ast.Add) -> None: ... + def SUB(self, node: ast.Sub) -> None: ... + def MULT(self, node: ast.Mult) -> None: ... + def DIV(self, node: ast.Div) -> None: ... + def MOD(self, node: ast.Mod) -> None: ... + def POW(self, node: ast.Pow) -> None: ... + def LSHIFT(self, node: ast.LShift) -> None: ... + def RSHIFT(self, node: ast.RShift) -> None: ... + def BITOR(self, node: ast.BitOr) -> None: ... + def BITXOR(self, node: ast.BitXor) -> None: ... + def BITAND(self, node: ast.BitAnd) -> None: ... + def FLOORDIV(self, node: ast.FloorDiv) -> None: ... + def INVERT(self, node: ast.Invert) -> None: ... + def NOT(self, node: ast.Not) -> None: ... + def UADD(self, node: ast.UAdd) -> None: ... + def USUB(self, node: ast.USub) -> None: ... + def EQ(self, node: ast.Eq) -> None: ... + def NOTEQ(self, node: ast.NotEq) -> None: ... + def LT(self, node: ast.Lt) -> None: ... + def LTE(self, node: ast.LtE) -> None: ... + def GT(self, node: ast.Gt) -> None: ... + def GTE(self, node: ast.GtE) -> None: ... + def IS(self, node: ast.Is) -> None: ... + def ISNOT(self, node: ast.IsNot) -> None: ... + def IN(self, node: ast.In) -> None: ... + def NOTIN(self, node: ast.NotIn) -> None: ... + def MATMULT(self, node: ast.MatMult) -> None: ... + def RAISE(self, node: ast.Raise) -> None: ... + def COMPREHENSION(self, tree: ast.comprehension, omit: _OmitType = ...) -> None: ... + def KEYWORD(self, tree: ast.keyword, omit: _OmitType = ...) -> None: ... + def FORMATTEDVALUE(self, tree: ast.FormattedValue, omit: _OmitType = ...) -> None: ... + def JOINEDSTR(self, node: ast.AST) -> None: ... + def DICT(self, node: ast.Dict) -> None: ... + def IF(self, node: ast.If) -> None: ... + def IFEXP(self, node: ast.If) -> None: ... + def ASSERT(self, node: ast.Assert) -> None: ... + def GLOBAL(self, node: ast.Global) -> None: ... + def NONLOCAL(self, node: ast.Nonlocal) -> None: ... + def GENERATOREXP(self, node: ast.GeneratorExp) -> None: ... + def LISTCOMP(self, node: ast.ListComp) -> None: ... + def DICTCOMP(self, node: ast.DictComp) -> None: ... + def SETCOMP(self, node: ast.SetComp) -> None: ... + def NAME(self, node: ast.Name) -> None: ... + def CONTINUE(self, node: ast.Continue) -> None: ... + def BREAK(self, node: ast.Break) -> None: ... + def RETURN(self, node: ast.Return) -> None: ... + def YIELD(self, node: ast.Yield) -> None: ... + def AWAIT(self, node: ast.Await) -> None: ... + def YIELDFROM(self, node: ast.YieldFrom) -> None: ... + def FUNCTIONDEF(self, node: ast.FunctionDef) -> None: ... + def ASYNCFUNCTIONDEF(self, node: ast.AsyncFunctionDef) -> None: ... + def LAMBDA(self, node: ast.Lambda) -> None: ... + def ARGUMENTS(self, node: ast.arguments) -> None: ... + def ARG(self, node: ast.arg) -> None: ... + def CLASSDEF(self, node: ast.ClassDef): ... + def AUGASSIGN(self, node: ast.AugAssign) -> None: ... + def TUPLE(self, node: ast.Tuple) -> None: ... + def LIST(self, node: ast.List) -> None: ... + def IMPORT(self, node: ast.Import) -> None: ... + def IMPORTFROM(self, node: ast.ImportFrom) -> None: ... + def TRY(self, node: ast.Try) -> None: ... + def EXCEPTHANDLER(self, node: ast.ExceptHandler) -> None: ... + def ANNASSIGN(self, node: ast.AnnAssign) -> None: ... + def COMPARE(self, node: ast.Compare) -> None: ... + def MATCH(self, tree: _Match, omit: _OmitType = ...) -> None: ... + def MATCH_CASE(self, tree: _MatchCase, omit: _OmitType = ...) -> None: ... + def MATCHCLASS(self, tree: _MatchClass, omit: _OmitType = ...) -> None: ... + def MATCHOR(self, tree: _MatchOr, omit: _OmitType = ...) -> None: ... + def MATCHSEQUENCE(self, tree: _MatchSequence, omit: _OmitType = ...) -> None: ... + def MATCHSINGLETON(self, tree: _MatchSingleton, omit: _OmitType = ...) -> None: ... + def MATCHVALUE(self, tree: _MatchValue, omit: _OmitType = ...) -> None: ... + def MATCHAS(self, node: _MatchAs) -> None: ... + def MATCHMAPPING(self, node: _MatchMapping) -> None: ... + def MATCHSTAR(self, node: _MatchStar) -> None: ... diff --git a/stubs/pyflakes/pyflakes/messages.pyi b/stubs/pyflakes/pyflakes/messages.pyi new file mode 100644 index 0000000..e4d6eba --- /dev/null +++ b/stubs/pyflakes/pyflakes/messages.pyi @@ -0,0 +1,144 @@ +import ast +from typing import Any, ClassVar + +class Message: + message: ClassVar[str] + message_args: tuple[Any, ...] + filename: Any + lineno: int + col: int + def __init__(self, filename, loc: ast.AST) -> None: ... + +class UnusedImport(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, name) -> None: ... + +class RedefinedWhileUnused(Message): + message_args: tuple[Any, int] + def __init__(self, filename, loc: ast.AST, name, orig_loc: ast.AST) -> None: ... + +class ImportShadowedByLoopVar(Message): + message_args: tuple[Any, int] + def __init__(self, filename, loc: ast.AST, name, orig_loc: ast.AST) -> None: ... + +class ImportStarNotPermitted(Message): + message_args: Any + def __init__(self, filename, loc, modname) -> None: ... + +class ImportStarUsed(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, modname) -> None: ... + +class ImportStarUsage(Message): + message_args: tuple[Any, Any] + def __init__(self, filename, loc: ast.AST, name, from_list) -> None: ... + +class UndefinedName(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, name) -> None: ... + +class DoctestSyntaxError(Message): + message_args: tuple[()] + def __init__(self, filename, loc: ast.AST, position: tuple[int, int] | None = ...) -> None: ... + +class UndefinedExport(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, name) -> None: ... + +class UndefinedLocal(Message): + default: ClassVar[str] + builtin: ClassVar[str] + message_args: tuple[Any, int] + def __init__(self, filename, loc: ast.AST, name, orig_loc: ast.AST) -> None: ... + +class DuplicateArgument(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, name) -> None: ... + +class MultiValueRepeatedKeyLiteral(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, key) -> None: ... + +class MultiValueRepeatedKeyVariable(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, key) -> None: ... + +class LateFutureImport(Message): + message_args: tuple[()] + def __init__(self, filename, loc: ast.AST) -> None: ... + +class FutureFeatureNotDefined(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, name) -> None: ... + +class UnusedVariable(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, names) -> None: ... + +class ReturnOutsideFunction(Message): ... +class YieldOutsideFunction(Message): ... +class ContinueOutsideLoop(Message): ... +class BreakOutsideLoop(Message): ... +class ContinueInFinally(Message): ... +class DefaultExceptNotLast(Message): ... +class TwoStarredExpressions(Message): ... +class TooManyExpressionsInStarredAssignment(Message): ... +class IfTuple(Message): ... +class AssertTuple(Message): ... + +class ForwardAnnotationSyntaxError(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, annotation) -> None: ... + +class CommentAnnotationSyntaxError(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, annotation) -> None: ... + +class RaiseNotImplemented(Message): ... +class InvalidPrintSyntax(Message): ... +class IsLiteral(Message): ... +class FStringMissingPlaceholders(Message): ... + +class StringDotFormatExtraPositionalArguments(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, extra_positions) -> None: ... + +class StringDotFormatExtraNamedArguments(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, extra_keywords) -> None: ... + +class StringDotFormatMissingArgument(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, missing_arguments) -> None: ... + +class StringDotFormatMixingAutomatic(Message): ... + +class StringDotFormatInvalidFormat(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, error) -> None: ... + +class PercentFormatInvalidFormat(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, error) -> None: ... + +class PercentFormatMixedPositionalAndNamed(Message): ... + +class PercentFormatUnsupportedFormatCharacter(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, c) -> None: ... + +class PercentFormatPositionalCountMismatch(Message): + message_args: tuple[int, int] + def __init__(self, filename, loc: ast.AST, n_placeholders: int, n_substitutions: int) -> None: ... + +class PercentFormatExtraNamedArguments(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, extra_keywords) -> None: ... + +class PercentFormatMissingArgument(Message): + message_args: tuple[Any] + def __init__(self, filename, loc: ast.AST, missing_arguments) -> None: ... + +class PercentFormatExpectedMapping(Message): ... +class PercentFormatExpectedSequence(Message): ... +class PercentFormatStarRequiresSequence(Message): ... diff --git a/stubs/pyflakes/pyflakes/reporter.pyi b/stubs/pyflakes/pyflakes/reporter.pyi new file mode 100644 index 0000000..5b15ee9 --- /dev/null +++ b/stubs/pyflakes/pyflakes/reporter.pyi @@ -0,0 +1,5 @@ +class Reporter: + def __init__(self, warningStream, errorStream) -> None: ... + def unexpectedError(self, filename, msg) -> None: ... + def syntaxError(self, filename, msg, lineno, offset, text) -> None: ... + def flake(self, message) -> None: ... diff --git a/stubs/pyinstaller/@tests/stubtest_allowlist.txt b/stubs/pyinstaller/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..7d14fec --- /dev/null +++ b/stubs/pyinstaller/@tests/stubtest_allowlist.txt @@ -0,0 +1,41 @@ +# fake module, only exists once the app is frozen +pyi_splash + +# Undocumented and clearly not meant to be exposed +PyInstaller.__main__.generate_parser +PyInstaller.__main__.run_build +PyInstaller.__main__.run_makespec +PyInstaller.utils.hooks.conda.lib_dir + +# A mix of modules meant to be private, and shallow incomplete type references for other modules +PyInstaller.building.* +PyInstaller.depend.analysis.* +PyInstaller.isolated._parent.* + +# Most modules are not meant to be used, yet are not marked as private +PyInstaller.archive.* +PyInstaller.config +PyInstaller.configure +PyInstaller.depend.bindepend +PyInstaller.depend.bytecode +PyInstaller.depend.dylib +PyInstaller.depend.imphook +PyInstaller.depend.utils +PyInstaller.exceptions +PyInstaller.hooks.* +PyInstaller.lib.* +PyInstaller.loader.* +PyInstaller.log +PyInstaller.utils.cliutils.* +PyInstaller.utils.conftest +PyInstaller.utils.git +PyInstaller.utils.hooks.django +PyInstaller.utils.hooks.gi +PyInstaller.utils.hooks.qt +PyInstaller.utils.hooks.subproc.* +PyInstaller.utils.hooks.tcl_tk +PyInstaller.utils.misc +PyInstaller.utils.osx +PyInstaller.utils.run_tests +PyInstaller.utils.tests +PyInstaller.utils.win32.* diff --git a/stubs/pyinstaller/METADATA.toml b/stubs/pyinstaller/METADATA.toml new file mode 100644 index 0000000..4a5c581 --- /dev/null +++ b/stubs/pyinstaller/METADATA.toml @@ -0,0 +1,5 @@ +version = "5.6.*" +requires = ["types-setuptools"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/pyinstaller/PyInstaller/__init__.pyi b/stubs/pyinstaller/PyInstaller/__init__.pyi new file mode 100644 index 0000000..2aa6f67 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/__init__.pyi @@ -0,0 +1,11 @@ +from typing_extensions import LiteralString + +from PyInstaller import compat as compat + +__all__ = ("HOMEPATH", "PLATFORM", "__version__", "DEFAULT_DISTPATH", "DEFAULT_SPECPATH", "DEFAULT_WORKPATH") +__version__: str +HOMEPATH: str +DEFAULT_SPECPATH: str +DEFAULT_DISTPATH: str +DEFAULT_WORKPATH: str +PLATFORM: LiteralString diff --git a/stubs/pyinstaller/PyInstaller/__main__.pyi b/stubs/pyinstaller/PyInstaller/__main__.pyi new file mode 100644 index 0000000..3e4b32e --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/__main__.pyi @@ -0,0 +1,11 @@ +# https://pyinstaller.org/en/stable/usage.html#running-pyinstaller-from-python-code +from _typeshed import SupportsKeysAndGetItem +from collections.abc import Iterable +from typing_extensions import TypeAlias + +# Used to update PyInstaller.config.CONF +_PyIConfig: TypeAlias = ( + SupportsKeysAndGetItem[str, bool | str | list[str] | None] | Iterable[tuple[str, bool | str | list[str] | None]] +) + +def run(pyi_args: Iterable[str] | None = ..., pyi_config: _PyIConfig | None = ...) -> None: ... diff --git a/stdlib/@python2/distutils/command/install_data.pyi b/stubs/pyinstaller/PyInstaller/building/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/install_data.pyi rename to stubs/pyinstaller/PyInstaller/building/__init__.pyi diff --git a/stubs/pyinstaller/PyInstaller/building/build_main.pyi b/stubs/pyinstaller/PyInstaller/building/build_main.pyi new file mode 100644 index 0000000..81fb89f --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/building/build_main.pyi @@ -0,0 +1,29 @@ +# Referenced in: https://pyinstaller.org/en/stable/hooks.html?highlight=get_hook_config#PyInstaller.utils.hooks.get_hook_config +# Not to be imported during runtime, but is the type reference for hooks and analysis configuration + +from _typeshed import Incomplete, StrPath +from collections.abc import Iterable +from typing import Any + +from PyInstaller.building.datastruct import Target + +class Analysis(Target): + # https://pyinstaller.org/en/stable/hooks-config.html#hook-configuration-options + hooksconfig: dict[str, dict[str, object]] + def __init__( + self, + scripts: Iterable[StrPath], + pathex: Incomplete | None = ..., + binaries: Incomplete | None = ..., + datas: Incomplete | None = ..., + hiddenimports: Incomplete | None = ..., + hookspath: Incomplete | None = ..., + hooksconfig: dict[str, dict[str, Any]] | None = ..., + excludes: Incomplete | None = ..., + runtime_hooks: Incomplete | None = ..., + cipher: Incomplete | None = ..., + win_no_prefer_redirects: bool = ..., + win_private_assemblies: bool = ..., + noarchive: bool = ..., + module_collection_mode: Incomplete | None = ..., + ) -> None: ... diff --git a/stubs/pyinstaller/PyInstaller/building/datastruct.pyi b/stubs/pyinstaller/PyInstaller/building/datastruct.pyi new file mode 100644 index 0000000..4edcd58 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/building/datastruct.pyi @@ -0,0 +1,30 @@ +# https://pyinstaller.org/en/stable/advanced-topics.html#the-toc-and-tree-classes +from collections.abc import Iterable, Sequence +from typing import ClassVar +from typing_extensions import Literal, LiteralString, SupportsIndex, TypeAlias + +_TypeCode: TypeAlias = Literal["DATA", "BINARY", "EXTENSION", "OPTION"] +_TOCTuple: TypeAlias = tuple[str, str | None, _TypeCode | None] + +class TOC(list[_TOCTuple]): + filenames: set[str] + def __init__(self, initlist: Iterable[_TOCTuple] | None = ...) -> None: ... + def append(self, entry: _TOCTuple) -> None: ... + def insert(self, pos: SupportsIndex, entry: _TOCTuple) -> None: ... + def extend(self, other: Iterable[_TOCTuple]) -> None: ... + +class Target: + invcnum: ClassVar[int] + tocfilename: LiteralString + tocbasename: LiteralString + dependencies: TOC + +class Tree(Target, TOC): + root: str | None + prefix: str | None + excludes: Sequence[str] + typecode: _TypeCode + def __init__( + self, root: str | None = ..., prefix: str | None = ..., excludes: Sequence[str] | None = ..., typecode: _TypeCode = ... + ) -> None: ... + def assemble(self) -> None: ... diff --git a/stubs/pyinstaller/PyInstaller/compat.pyi b/stubs/pyinstaller/PyInstaller/compat.pyi new file mode 100644 index 0000000..758caa1 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/compat.pyi @@ -0,0 +1,82 @@ +# https://pyinstaller.org/en/stable/hooks.html#module-PyInstaller.compat +from _typeshed import FileDescriptor, GenericPath, StrOrBytesPath +from collections.abc import Iterable +from types import ModuleType +from typing import AnyStr, overload +from typing_extensions import Literal, TypeAlias + +_OpenFile: TypeAlias = StrOrBytesPath | FileDescriptor + +is_64bits: bool +is_py35: bool +is_py36: bool +is_py37: bool +is_py38: bool +is_py39: bool +is_py310: bool +is_py311: bool +is_win: bool +is_win_10: bool +is_win_wine: bool +is_cygwin: bool +is_darwin: bool +is_linux: bool +is_solar: bool +is_aix: bool +is_freebsd: bool +is_openbsd: bool +is_hpux: bool +is_unix: bool +is_musl: bool +is_macos_11_compat: bool +is_macos_11_native: bool +is_macos_11: bool +PYDYLIB_NAMES: set[str] +base_prefix: str +is_venv: bool +is_virtualenv: bool +is_conda: bool +is_pure_conda: bool +python_executable: str +is_ms_app_store: bool +BYTECODE_MAGIC: bytes +EXTENSION_SUFFIXES: list[str] +ALL_SUFFIXES: list[str] + +architecture: Literal["64bit", "n32bit", "32bit"] +system: Literal["Cygwin", "Linux", "Darwin", "Java", "Windows"] +machine: Literal["sw_64", "loongarch64", "arm", "intel", "ppc", "mips", "riscv", "s390x", "unknown", None] + +def is_wine_dll(filename: _OpenFile) -> bool: ... +@overload +def getenv(name: str, default: str) -> str: ... +@overload +def getenv(name: str, default: None = ...) -> str | None: ... +def setenv(name: str, value: str) -> None: ... +def unsetenv(name: str) -> None: ... +def exec_command( + *cmdargs: str, encoding: str | None = ..., raise_enoent: bool | None = ..., **kwargs: int | bool | Iterable[int] | None +) -> str: ... +def exec_command_rc(*cmdargs: str, **kwargs: float | bool | Iterable[int] | None) -> int: ... +def exec_command_stdout( + *command_args: str, encoding: str | None = ..., **kwargs: float | str | bytes | bool | Iterable[int] | None +) -> str: ... +def exec_command_all( + *cmdargs: str, encoding: str | None = ..., **kwargs: int | bool | Iterable[int] | None +) -> tuple[int, str, str]: ... +def exec_python(*args: str, **kwargs: str | None) -> str: ... +def exec_python_rc(*args: str, **kwargs: str | None) -> int: ... +def expand_path(path: GenericPath[AnyStr]) -> AnyStr: ... +def getsitepackages(prefixes: Iterable[str] | None = ...) -> list[str]: ... +def importlib_load_source(name: str, pathname: str) -> ModuleType: ... + +PY3_BASE_MODULES: set[str] +PURE_PYTHON_MODULE_TYPES: set[str] +SPECIAL_MODULE_TYPES: set[str] +BINARY_MODULE_TYPES: set[str] +VALID_MODULE_TYPES: set[str] +BAD_MODULE_TYPES: set[str] +ALL_MODULE_TYPES: set[str] +MODULE_TYPES_TO_TOC_DICT: dict[str, str] + +def check_requirements() -> None: ... diff --git a/stdlib/@python2/distutils/command/install_headers.pyi b/stubs/pyinstaller/PyInstaller/depend/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/install_headers.pyi rename to stubs/pyinstaller/PyInstaller/depend/__init__.pyi diff --git a/stubs/pyinstaller/PyInstaller/depend/analysis.pyi b/stubs/pyinstaller/PyInstaller/depend/analysis.pyi new file mode 100644 index 0000000..4e1682d --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/depend/analysis.pyi @@ -0,0 +1,27 @@ +# https://pyinstaller.org/en/stable/hooks.html#the-pre-safe-import-module-psim-api-method + +# The documentation explicitely mentions that "Normally you do not need to know about the module-graph." +# However, some PyiModuleGraph typed class attributes are still documented as existing in imphookapi. +from _typeshed import Incomplete, StrPath, SupportsKeysAndGetItem +from collections.abc import Iterable +from typing_extensions import TypeAlias + +from PyInstaller.lib.modulegraph.modulegraph import Alias, Node + +_LazyNode: TypeAlias = Iterable[Node] | Iterable[str] | Alias | None +# from altgraph.Graph import Graph +_Graph: TypeAlias = Incomplete + +class PyiModuleGraph: # incomplete + def __init__( + self, + pyi_homepath: str, + user_hook_dirs: Iterable[StrPath] = ..., + excludes: Iterable[str] = ..., + *, + path: Iterable[str] | None = ..., + replace_paths: Iterable[tuple[StrPath, StrPath]] = ..., + implies: SupportsKeysAndGetItem[str, _LazyNode] | Iterable[tuple[str, _LazyNode]] = ..., + graph: _Graph | None = ..., + debug: int = ..., + ) -> None: ... diff --git a/stubs/pyinstaller/PyInstaller/depend/imphookapi.pyi b/stubs/pyinstaller/PyInstaller/depend/imphookapi.pyi new file mode 100644 index 0000000..268ee36 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/depend/imphookapi.pyi @@ -0,0 +1,70 @@ +# https://pyinstaller.org/en/stable/hooks-config.html#adding-an-option-to-the-hook `hook_api` is a PostGraphAPI +# Nothing in this module is meant to be initialized externally. +# Instances are exposed through hooks during build. + +from _typeshed import StrOrBytesPath +from collections.abc import Generator, Iterable +from typing import Any +from typing_extensions import Literal + +from PyInstaller.building.build_main import Analysis +from PyInstaller.building.datastruct import TOC +from PyInstaller.depend.analysis import PyiModuleGraph +from PyInstaller.lib.modulegraph.modulegraph import Package + +# https://pyinstaller.org/en/stable/hooks.html#the-pre-safe-import-module-psim-api-method +class PreSafeImportModuleAPI: + module_basename: str + module_name: str + def __init__( + self, module_graph: PyiModuleGraph, module_basename: str, module_name: str, parent_package: Package | None + ) -> None: ... + @property + def module_graph(self) -> PyiModuleGraph: ... + @property + def parent_package(self) -> Package | None: ... + def add_runtime_module(self, module_name: str) -> None: ... + def add_runtime_package(self, package_name: str) -> None: ... + def add_alias_module(self, real_module_name: str, alias_module_name: str) -> None: ... + def append_package_path(self, directory: str) -> None: ... + +# https://pyinstaller.org/en/stable/hooks.html#the-pre-find-module-path-pfmp-api-method +class PreFindModulePathAPI: + search_dirs: Iterable[StrOrBytesPath] + def __init__(self, module_graph: PyiModuleGraph, module_name: str, search_dirs: Iterable[StrOrBytesPath]) -> None: ... + @property + def module_graph(self) -> PyiModuleGraph: ... + @property + def module_name(self) -> str: ... + +# https://pyinstaller.org/en/stable/hooks.html#the-hook-hook-api-function +class PostGraphAPI: + module_graph: PyiModuleGraph + module: Package + def __init__(self, module_name: str, module_graph: PyiModuleGraph, analysis: Analysis) -> None: ... + @property + def __file__(self) -> str: ... + @property + def __path__(self) -> tuple[str, ...] | None: ... + @property + def __name__(self) -> str: ... + # Compiled code. See stdlib.builtins.compile + @property + def co(self) -> Any: ... + @property + def analysis(self) -> Analysis: ... + @property + def name(self) -> str: ... + @property + def graph(self) -> PyiModuleGraph: ... + @property + def node(self) -> Package: ... + @property + def imports(self) -> Generator[Package, None, None]: ... + def add_imports(self, *module_names: str) -> None: ... + def del_imports(self, *module_names: str) -> None: ... + def add_binaries(self, list_of_tuples: TOC | Iterable[tuple[StrOrBytesPath, StrOrBytesPath]]) -> None: ... + def add_datas(self, list_of_tuples: TOC | Iterable[tuple[StrOrBytesPath, StrOrBytesPath]]) -> None: ... + def set_module_collection_mode( + self, name: str | None, mode: Literal["pyz", "pyc", "py", "pyz+py", "py+pyz", None] + ) -> None: ... diff --git a/stubs/pyinstaller/PyInstaller/isolated/__init__.pyi b/stubs/pyinstaller/PyInstaller/isolated/__init__.pyi new file mode 100644 index 0000000..6f084bf --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/isolated/__init__.pyi @@ -0,0 +1,2 @@ +# https://pyinstaller.org/en/stable/hooks.html#module-PyInstaller.isolated +from PyInstaller.isolated._parent import Python as Python, call as call, decorate as decorate diff --git a/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi b/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi new file mode 100644 index 0000000..ea9ee60 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi @@ -0,0 +1,19 @@ +from _typeshed import Self +from collections.abc import Callable +from types import TracebackType +from typing import TypeVar +from typing_extensions import ParamSpec + +_AC = TypeVar("_AC", bound=Callable[..., object]) +_R = TypeVar("_R") +_P = ParamSpec("_P") + +class Python: + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + def call(self, function: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... + +def call(function: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... +def decorate(function: _AC) -> _AC: ... diff --git a/stdlib/@python2/distutils/command/install_lib.pyi b/stubs/pyinstaller/PyInstaller/lib/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/install_lib.pyi rename to stubs/pyinstaller/PyInstaller/lib/__init__.pyi diff --git a/stdlib/@python2/distutils/command/install_scripts.pyi b/stubs/pyinstaller/PyInstaller/lib/modulegraph/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/install_scripts.pyi rename to stubs/pyinstaller/PyInstaller/lib/modulegraph/__init__.pyi diff --git a/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi b/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi new file mode 100644 index 0000000..ef9cfc5 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi @@ -0,0 +1,42 @@ +from typing import Any, Protocol + +class _SupportsGraphident(Protocol): + graphident: str + +# TODO: For typing purposes, once #5768 is complete, it'll be easier to use the modulegraph package directly. + +# code, filename and packagepath are always initialized to None. But they can be given a value later. +class Node: + # Compiled code. See stdlib.builtins.compile + code: Any | None + filename: str | None + graphident: str + identifier: str + packagepath: str | None + def __init__(self, identifier: str) -> None: ... + def is_global_attr(self, attr_name: str) -> bool: ... + def is_submodule(self, submodule_basename: str) -> bool: ... + def add_global_attr(self, attr_name: str) -> None: ... + def add_global_attrs_from_module(self, target_module: Node) -> None: ... + def add_submodule(self, submodule_basename: str, submodule_node: Node) -> None: ... + def get_submodule(self, submodule_basename: str) -> Node: ... + def get_submodule_or_none(self, submodule_basename: str) -> Node | None: ... + def remove_global_attr_if_found(self, attr_name: str) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __lt__(self, other: _SupportsGraphident) -> bool: ... + def __le__(self, other: _SupportsGraphident) -> bool: ... + def __gt__(self, other: _SupportsGraphident) -> bool: ... + def __ge__(self, other: _SupportsGraphident) -> bool: ... + def infoTuple(self) -> tuple[str]: ... + +class Alias(str): ... + +class BaseModule(Node): + filename: str + packagepath: str + def __init__(self, name: str, filename: str | None = ..., path: str | None = ...) -> None: ... + # Returns a tuple of length 0, 1, 2, or 3 + def infoTuple(self) -> tuple[str, ...]: ... # type: ignore[override] + +class Package(BaseModule): ... diff --git a/stdlib/@python2/distutils/command/register.pyi b/stubs/pyinstaller/PyInstaller/utils/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/register.pyi rename to stubs/pyinstaller/PyInstaller/utils/__init__.pyi diff --git a/stubs/pyinstaller/PyInstaller/utils/hooks/__init__.pyi b/stubs/pyinstaller/PyInstaller/utils/hooks/__init__.pyi new file mode 100644 index 0000000..28d27b5 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/utils/hooks/__init__.pyi @@ -0,0 +1,85 @@ +# https://pyinstaller.org/en/stable/hooks.html + +from _typeshed import StrOrBytesPath, StrPath, SupportsKeysAndGetItem +from collections.abc import Callable, Iterable, Mapping +from typing import Any +from typing_extensions import Literal, TypeAlias + +import pkg_resources +from PyInstaller import HOMEPATH as HOMEPATH +from PyInstaller.depend.imphookapi import PostGraphAPI +from PyInstaller.utils.hooks import conda +from PyInstaller.utils.hooks.win32 import get_pywin32_module_file_attribute as get_pywin32_module_file_attribute + +conda_support = conda + +_Environ: TypeAlias = SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]] | Mapping[str, str] + +PY_IGNORE_EXTENSIONS: set[str] +hook_variables: dict[str, str] + +def exec_statement(statement: str) -> str | int: ... +def exec_statement_rc(statement: str) -> str | int: ... +def exec_script(script_filename: StrOrBytesPath, *args: str, env: _Environ | None = ...) -> str | int: ... +def exec_script_rc(script_filename: StrOrBytesPath, *args: str, env: _Environ | None = ...) -> str | int: ... +def eval_statement(statement: str) -> Any | Literal[""]: ... +def eval_script(script_filename: StrOrBytesPath, *args: str, env: _Environ | None = ...) -> Any | Literal[""]: ... +def get_pyextension_imports(module_name: str) -> list[str]: ... +def get_homebrew_path(formula: str = ...) -> str | None: ... +def remove_prefix(string: str, prefix: str) -> str: ... +def remove_suffix(string: str, suffix: str) -> str: ... +def remove_file_extension(filename: str) -> str: ... +def can_import_module(module_name: str) -> bool: ... +def get_module_attribute(module_name: str, attr_name: str) -> Any: ... +def get_module_file_attribute(package: str) -> str | None: ... +def is_module_satisfies( + requirements: Iterable[str] | pkg_resources.Requirement, + version: str | pkg_resources.Distribution | None = ..., + version_attr: str = ..., +) -> bool: ... +def is_package(module_name: str) -> bool: ... +def get_all_package_paths(package: str) -> list[str]: ... +def package_base_path(package_path: str, package: str) -> str: ... +def get_package_paths(package: str) -> tuple[str, str]: ... +def collect_submodules( + package: str, filter: Callable[[str], bool] = ..., on_error: Literal["ignore", "warn once", "warn", "raise"] = ... +) -> list[str]: ... +def is_module_or_submodule(name: str, mod_or_submod: str) -> bool: ... + +PY_DYLIB_PATTERNS: list[str] + +def collect_dynamic_libs(package: str, destdir: object = ...) -> list[tuple[str, str]]: ... +def collect_data_files( + package: str, + include_py_files: bool = ..., + subdir: StrPath | None = ..., + excludes: Iterable[str] | None = ..., + includes: Iterable[str] | None = ..., +) -> list[tuple[str, str]]: ... +def collect_system_data_files( + path: str, destdir: StrPath | None = ..., include_py_files: bool = ... +) -> list[tuple[str, str]]: ... +def copy_metadata(package_name: str, recursive: bool = ...) -> list[tuple[str, str]]: ... +def get_installer(module: str) -> str | None: ... +def requirements_for_package(package_name: str) -> list[str]: ... +def collect_all( + package_name: str, + include_py_files: bool = ..., + filter_submodules: Callable[[str], bool] | None = ..., + exclude_datas: Iterable[str] | None = ..., + include_datas: Iterable[str] | None = ..., + on_error: Literal["ignore", "warn once", "warn", "raise"] = ..., +) -> tuple[list[tuple[str, str]], list[tuple[str, str]], list[str]]: ... +def collect_entry_point(name: str) -> tuple[tuple[str, str], list[str]]: ... +def get_hook_config(hook_api: PostGraphAPI, module_name: str, key: str) -> None: ... +def include_or_exclude_file( + filename: StrOrBytesPath, + include_list: Iterable[StrOrBytesPath] | None = ..., + exclude_list: Iterable[StrOrBytesPath] | None = ..., +) -> bool: ... +def collect_delvewheel_libs_directory( + package_name: str, + libdir_name: StrPath | None = ..., + datas: list[tuple[str, str]] | None = ..., + binaries: list[tuple[str, str]] | None = ..., +) -> tuple[list[tuple[str, str]], list[tuple[str, str]]]: ... diff --git a/stubs/pyinstaller/PyInstaller/utils/hooks/conda.pyi b/stubs/pyinstaller/PyInstaller/utils/hooks/conda.pyi new file mode 100644 index 0000000..6801203 --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/utils/hooks/conda.pyi @@ -0,0 +1,53 @@ +# https://pyinstaller.org/en/stable/hooks.html?highlight=conda_support#module-PyInstaller.utils.hooks.conda + +import sys +from _typeshed import StrOrBytesPath +from collections.abc import Iterable +from pathlib import Path +from typing import Any +from typing_extensions import TypeAlias, TypedDict + +if sys.version_info >= (3, 8): + from importlib.metadata import PackagePath as _PackagePath +else: + _PackagePath: TypeAlias = Any + +CONDA_ROOT: Path +CONDA_META_DIR: Path +PYTHONPATH_PREFIXES: list[Path] + +class _RawDict(TypedDict): + name: str + version: str + files: list[StrOrBytesPath] + depends: list[str] + +class Distribution: + raw: _RawDict + name: str + version: str + files: list[PackagePath] + dependencies: list[str] + packages: list[str] + def __init__(self, json_path: str) -> None: ... + @classmethod + def from_name(cls, name: str) -> Distribution: ... + @classmethod + def from_package_name(cls, name: str) -> Distribution: ... + +# distribution and package_distribution are meant to be used and are not internal helpers +distribution = Distribution.from_name +package_distribution = Distribution.from_package_name + +class PackagePath(_PackagePath): + def locate(self) -> Path: ... + +def walk_dependency_tree(initial: str, excludes: Iterable[str] | None = ...) -> dict[str, Distribution]: ... +def requires(name: str, strip_versions: bool = ...) -> list[str]: ... +def files(name: str, dependencies: bool = ..., excludes: Iterable[str] | None = ...) -> list[PackagePath]: ... +def collect_dynamic_libs( + name: str, dest: str = ..., dependencies: bool = ..., excludes: Iterable[str] | None = ... +) -> list[tuple[str, str]]: ... + +distributions: dict[str, Distribution] +distributions_by_package: dict[str | None, Distribution] diff --git a/stubs/pyinstaller/PyInstaller/utils/hooks/win32.pyi b/stubs/pyinstaller/PyInstaller/utils/hooks/win32.pyi new file mode 100644 index 0000000..105eb1f --- /dev/null +++ b/stubs/pyinstaller/PyInstaller/utils/hooks/win32.pyi @@ -0,0 +1,3 @@ +__all__ = ("get_pywin32_module_file_attribute",) + +def get_pywin32_module_file_attribute(module_name: str) -> str | int: ... diff --git a/stubs/pyinstaller/pyi_splash/__init__.pyi b/stubs/pyinstaller/pyi_splash/__init__.pyi new file mode 100644 index 0000000..3973142 --- /dev/null +++ b/stubs/pyinstaller/pyi_splash/__init__.pyi @@ -0,0 +1,12 @@ +# Referenced in: https://pyinstaller.org/en/stable/advanced-topics.html#module-pyi_splash +# Source: https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/fake-modules/pyi_splash.py +from typing_extensions import Literal + +__all__ = ["CLOSE_CONNECTION", "FLUSH_CHARACTER", "is_alive", "close", "update_text"] + +def is_alive() -> bool: ... +def update_text(msg: str) -> None: ... +def close() -> None: ... + +CLOSE_CONNECTION: Literal[b"\x04"] +FLUSH_CHARACTER: Literal[b"\r"] diff --git a/stubs/pynput/@tests/stubtest_allowlist.txt b/stubs/pynput/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..b7f3db6 --- /dev/null +++ b/stubs/pynput/@tests/stubtest_allowlist.txt @@ -0,0 +1,7 @@ +# These __init__ methods have *args, **kwargs arguments on some platforms, but not others +pynput.keyboard.Controller.__init__ +pynput.mouse.Controller.__init__ +# stubtest issues with non-`type` metaclasses, see https://github.com/python/mypy/issues/13316 +pynput.keyboard.Controller._Key +pynput.keyboard._base.Controller._Key +pynput.keyboard._dummy.Controller._Key diff --git a/stubs/pynput/METADATA.toml b/stubs/pynput/METADATA.toml new file mode 100644 index 0000000..ef79660 --- /dev/null +++ b/stubs/pynput/METADATA.toml @@ -0,0 +1 @@ +version = "1.7.*" diff --git a/stubs/pynput/pynput/__init__.pyi b/stubs/pynput/pynput/__init__.pyi new file mode 100644 index 0000000..1b92738 --- /dev/null +++ b/stubs/pynput/pynput/__init__.pyi @@ -0,0 +1 @@ +from . import keyboard as keyboard, mouse as mouse diff --git a/stubs/pynput/pynput/_info.pyi b/stubs/pynput/pynput/_info.pyi new file mode 100644 index 0000000..e6655bd --- /dev/null +++ b/stubs/pynput/pynput/_info.pyi @@ -0,0 +1,2 @@ +__author__: str +__version__: tuple[int, int, int] diff --git a/stubs/pynput/pynput/_util.pyi b/stubs/pynput/pynput/_util.pyi new file mode 100644 index 0000000..4202bcb --- /dev/null +++ b/stubs/pynput/pynput/_util.pyi @@ -0,0 +1,72 @@ +import sys +import threading +from _typeshed import Self +from collections.abc import Callable +from queue import Queue +from types import ModuleType, TracebackType +from typing import Any, ClassVar, Generic, TypeVar +from typing_extensions import ParamSpec, TypedDict + +_T = TypeVar("_T") +_AbstractListener_T = TypeVar("_AbstractListener_T", bound=AbstractListener) +_P = ParamSpec("_P") + +class _RESOLUTIONS(TypedDict): + darwin: str + uinput: str + xorg: str + +RESOLUTIONS: _RESOLUTIONS + +def backend(package: str) -> ModuleType: ... +def prefix(base: type | tuple[type | tuple[Any, ...], ...], cls: type) -> str | None: ... + +class AbstractListener(threading.Thread): + class StopException(Exception): ... + _HANDLED_EXCEPTIONS: ClassVar[tuple[type | tuple[Any, ...], ...]] # undocumented + _suppress: bool # undocumented + _running: bool # undocumented + _thread: threading.Thread # undocumented + _condition: threading.Condition # undocumented + _ready: bool # undocumented + _queue: Queue[sys._OptExcInfo | None] # undocumented + daemon: bool + def __init__(self, suppress: bool = ..., **kwargs: Callable[..., bool | None] | None) -> None: ... + @property + def suppress(self) -> bool: ... + @property + def running(self) -> bool: ... + def stop(self) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + def wait(self) -> None: ... + def run(self) -> None: ... + @classmethod + def _emitter(cls, f: Callable[_P, _T]) -> Callable[_P, _T]: ... # undocumented + def _mark_ready(self) -> None: ... # undocumented + def _run(self) -> None: ... # undocumented + def _stop_platform(self) -> None: ... # undocumented + def join(self, *args: Any) -> None: ... + +class Events(Generic[_T, _AbstractListener_T]): + _Listener: type[_AbstractListener_T] | None # undocumented + + class Event: + def __eq__(self, other: object) -> bool: ... + _event_queue: Queue[_T] # undocumented + _sentinel: object # undocumented + _listener: _AbstractListener_T # undocumented + start: Callable[[], None] + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> _T: ... + def get(self, timeout: float | None = ...) -> _T | None: ... + def _event_mapper(self, event: Callable[_P, object]) -> Callable[_P, None]: ... + +class NotifierMixin: ... diff --git a/stubs/pynput/pynput/keyboard/__init__.pyi b/stubs/pynput/pynput/keyboard/__init__.pyi new file mode 100644 index 0000000..7add854 --- /dev/null +++ b/stubs/pynput/pynput/keyboard/__init__.pyi @@ -0,0 +1,30 @@ +from _typeshed import SupportsItems +from collections.abc import Callable +from typing import Any + +from pynput import _util + +from ._base import Controller as Controller, Key as Key, KeyCode as KeyCode, Listener as Listener + +class Events(_util.Events[Any, Listener]): + class Press(_util.Events.Event): + key: Key | KeyCode | None + def __init__(self, key: Key | KeyCode | None) -> None: ... + + class Release(_util.Events.Event): + key: Key | KeyCode | None + def __init__(self, key: Key | KeyCode | None) -> None: ... + + def __init__(self) -> None: ... + def __next__(self) -> Press | Release: ... + def get(self, timeout: float | None = ...) -> Press | Release | None: ... + +class HotKey: + def __init__(self, keys: list[KeyCode], on_activate: Callable[[], object]) -> None: ... + @staticmethod + def parse(keys: str) -> list[KeyCode]: ... + def press(self, key: Key | KeyCode) -> None: ... + def release(self, key: Key | KeyCode) -> None: ... + +class GlobalHotKeys(Listener): + def __init__(self, hotkeys: SupportsItems[str, Callable[[], None]], *args: Any, **kwargs: Any) -> None: ... diff --git a/stubs/pynput/pynput/keyboard/_base.pyi b/stubs/pynput/pynput/keyboard/_base.pyi new file mode 100644 index 0000000..d930c66 --- /dev/null +++ b/stubs/pynput/pynput/keyboard/_base.pyi @@ -0,0 +1,122 @@ +import contextlib +import enum +from _typeshed import Self +from collections.abc import Callable, Iterable, Iterator +from typing import Any, ClassVar + +from pynput._util import AbstractListener + +class KeyCode: + _PLATFORM_EXTENSIONS: ClassVar[Iterable[str]] # undocumented + vk: int | None + char: str | None + is_dead: bool | None + combining: str | None + def __init__(self, vk: str | None = ..., char: str | None = ..., is_dead: bool = ..., **kwargs: str) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + def join(self: Self, key: Self) -> Self: ... + @classmethod + def from_vk(cls: type[Self], vk: int, **kwargs: Any) -> Self: ... + @classmethod + def from_char(cls: type[Self], char: str, **kwargs: Any) -> Self: ... + @classmethod + def from_dead(cls: type[Self], char: str, **kwargs: Any) -> Self: ... + +class Key(enum.Enum): + alt: int + alt_l: int + alt_r: int + alt_gr: int + backspace: int + caps_lock: int + cmd: int + cmd_l: int + cmd_r: int + ctrl: int + ctrl_l: int + ctrl_r: int + delete: int + down: int + end: int + enter: int + esc: int + f1: int + f2: int + f3: int + f4: int + f5: int + f6: int + f7: int + f8: int + f9: int + f10: int + f11: int + f12: int + f13: int + f14: int + f15: int + f16: int + f17: int + f18: int + f19: int + f20: int + home: int + left: int + page_down: int + page_up: int + right: int + shift: int + shift_l: int + shift_r: int + space: int + tab: int + up: int + media_play_pause: int + media_volume_mute: int + media_volume_down: int + media_volume_up: int + media_previous: int + media_next: int + insert: int + menu: int + num_lock: int + pause: int + print_screen: int + scroll_lock: int + +class Controller: + _KeyCode: ClassVar[type[KeyCode]] # undocumented + _Key: ClassVar[type[Key]] # undocumented + + class InvalidKeyException(Exception): ... + class InvalidCharacterException(Exception): ... + + def __init__(self) -> None: ... + def press(self, key: str | Key | KeyCode) -> None: ... + def release(self, key: str | Key | KeyCode) -> None: ... + def tap(self, key: str | Key | KeyCode) -> None: ... + def touch(self, key: str | Key | KeyCode, is_press: bool) -> None: ... + @contextlib.contextmanager + def pressed(self, *args: str | Key | KeyCode) -> Iterator[None]: ... + def type(self, string: str) -> None: ... + @property + def modifiers(self) -> contextlib.AbstractContextManager[Iterator[set[Key]]]: ... + @property + def alt_pressed(self) -> bool: ... + @property + def alt_gr_pressed(self) -> bool: ... + @property + def ctrl_pressed(self) -> bool: ... + @property + def shift_pressed(self) -> bool: ... + +class Listener(AbstractListener): + def __init__( + self, + on_press: Callable[[Key | KeyCode | None], None] | None = ..., + on_release: Callable[[Key | KeyCode | None], None] | None = ..., + suppress: bool = ..., + **kwargs: Any, + ) -> None: ... + def canonical(self, key: Key | KeyCode) -> Key | KeyCode: ... diff --git a/stubs/pynput/pynput/keyboard/_dummy.pyi b/stubs/pynput/pynput/keyboard/_dummy.pyi new file mode 100644 index 0000000..f49ca47 --- /dev/null +++ b/stubs/pynput/pynput/keyboard/_dummy.pyi @@ -0,0 +1 @@ +from ._base import Controller as Controller, Key as Key, KeyCode as KeyCode, Listener as Listener diff --git a/stubs/pynput/pynput/mouse/__init__.pyi b/stubs/pynput/pynput/mouse/__init__.pyi new file mode 100644 index 0000000..ad9546c --- /dev/null +++ b/stubs/pynput/pynput/mouse/__init__.pyi @@ -0,0 +1,29 @@ +from typing import Any + +from pynput import _util + +from ._base import Button as Button, Controller as Controller, Listener as Listener + +class Events(_util.Events[Any, Listener]): + class Move(_util.Events.Event): + x: int + y: int + def __init__(self, x: int, y: int) -> None: ... + + class Click(_util.Events.Event): + x: int + y: int + button: Button + pressed: bool + def __init__(self, x: int, y: int, button: Button, pressed: bool) -> None: ... + + class Scroll(_util.Events.Event): + x: int + y: int + dx: int + dy: int + def __init__(self, x: int, y: int, dx: int, dy: int) -> None: ... + + def __init__(self) -> None: ... + def __next__(self) -> Move | Click | Scroll: ... + def get(self, timeout: float | None = ...) -> Move | Click | Scroll | None: ... diff --git a/stubs/pynput/pynput/mouse/_base.pyi b/stubs/pynput/pynput/mouse/_base.pyi new file mode 100644 index 0000000..181dea5 --- /dev/null +++ b/stubs/pynput/pynput/mouse/_base.pyi @@ -0,0 +1,39 @@ +import enum +from _typeshed import Self +from collections.abc import Callable +from types import TracebackType +from typing import Any + +from pynput._util import AbstractListener + +class Button(enum.Enum): + unknown: int + left: int + middle: int + right: int + +class Controller: + def __init__(self) -> None: ... + @property + def position(self) -> tuple[int, int]: ... + @position.setter + def position(self, position: tuple[int, int]) -> None: ... + def scroll(self, dx: int, dy: int) -> None: ... + def press(self, button: Button) -> None: ... + def release(self, button: Button) -> None: ... + def move(self, dx: int, dy: int) -> None: ... + def click(self, button: Button, count: int = ...) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + +class Listener(AbstractListener): + def __init__( + self, + on_move: Callable[[int, int], bool | None] | None = ..., + on_click: Callable[[int, int, Button, bool], bool | None] | None = ..., + on_scroll: Callable[[int, int, int, int], bool | None] | None = ..., + suppress: bool = ..., + **kwargs: Any, + ) -> None: ... diff --git a/stubs/pynput/pynput/mouse/_dummy.pyi b/stubs/pynput/pynput/mouse/_dummy.pyi new file mode 100644 index 0000000..c799f58 --- /dev/null +++ b/stubs/pynput/pynput/mouse/_dummy.pyi @@ -0,0 +1 @@ +from ._base import Button as Button, Controller as Controller, Listener as Listener diff --git a/stubs/pysftp/METADATA.toml b/stubs/pysftp/METADATA.toml index c9b2e2d..383daa2 100644 --- a/stubs/pysftp/METADATA.toml +++ b/stubs/pysftp/METADATA.toml @@ -1,3 +1,5 @@ -version = "0.2" -python2 = true +version = "0.2.*" requires = ["types-paramiko"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/pysftp/pysftp/__init__.pyi b/stubs/pysftp/pysftp/__init__.pyi index d706213..89d52ea 100644 --- a/stubs/pysftp/pysftp/__init__.pyi +++ b/stubs/pysftp/pysftp/__init__.pyi @@ -1,7 +1,10 @@ +from _typeshed import Self +from collections.abc import Callable, Sequence +from contextlib import AbstractContextManager from stat import S_IMODE as S_IMODE from types import TracebackType -from typing import IO, Any, Callable, ContextManager, Sequence, Text, Tuple, Type, Union -from typing_extensions import Literal +from typing import IO +from typing_extensions import Literal, TypeAlias import paramiko from paramiko import AuthenticationException as AuthenticationException @@ -30,8 +33,8 @@ class CnOpts: def __init__(self, knownhosts: str | None = ...) -> None: ... def get_hostkey(self, host: str) -> paramiko.PKey: ... -_Callback = Callable[[int, int], Any] -_Path = Union[Text, bytes] +_Callback: TypeAlias = Callable[[int, int], object] +_Path: TypeAlias = str | bytes class Connection: def __init__( @@ -74,7 +77,7 @@ class Connection: confirm: bool = ..., ) -> paramiko.SFTPAttributes: ... def execute(self, command: str) -> list[str]: ... - def cd(self, remotepath: _Path | None = ...) -> ContextManager[None]: ... # noqa: F811 + def cd(self, remotepath: _Path | None = ...) -> AbstractContextManager[None]: ... # noqa: F811 def chdir(self, remotepath: _Path) -> None: ... def cwd(self, remotepath: _Path) -> None: ... def chmod(self, remotepath: _Path, mode: int = ...) -> None: ... @@ -106,9 +109,9 @@ class Connection: @property def sftp_client(self) -> paramiko.SFTPClient: ... @property - def active_ciphers(self) -> Tuple[str, str]: ... + def active_ciphers(self) -> tuple[str, str]: ... @property - def active_compression(self) -> Tuple[str, str]: ... + def active_compression(self) -> tuple[str, str]: ... @property def security_options(self) -> paramiko.SecurityOptions: ... @property @@ -120,7 +123,7 @@ class Connection: @property def remote_server_key(self) -> paramiko.PKey: ... def __del__(self) -> None: ... - def __enter__(self) -> "Connection": ... + def __enter__(self: Self) -> Self: ... def __exit__( - self, etype: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + self, etype: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/pysftp/pysftp/helpers.pyi b/stubs/pysftp/pysftp/helpers.pyi index c1e0138..f792cd3 100644 --- a/stubs/pysftp/pysftp/helpers.pyi +++ b/stubs/pysftp/pysftp/helpers.pyi @@ -1,4 +1,6 @@ -from typing import Callable, ContextManager, Iterator +from collections.abc import Callable, Iterator +from contextlib import AbstractContextManager +from typing_extensions import TypeAlias def known_hosts() -> str: ... def st_mode_to_int(val: int) -> int: ... @@ -25,9 +27,9 @@ def path_advance(thepath: str, sep: str = ...) -> Iterator[str]: ... def path_retreat(thepath: str, sep: str = ...) -> Iterator[str]: ... def reparent(newparent: str, oldpath: str) -> str: ... -_PathCallback = Callable[[str], None] +_PathCallback: TypeAlias = Callable[[str], object] def walktree( localpath: str, fcallback: _PathCallback, dcallback: _PathCallback, ucallback: _PathCallback, recurse: bool = ... ) -> None: ... -def cd(localpath: str | None = ...) -> ContextManager[None]: ... +def cd(localpath: str | None = ...) -> AbstractContextManager[None]: ... diff --git a/stubs/pytest-lazy-fixture/METADATA.toml b/stubs/pytest-lazy-fixture/METADATA.toml index 22cbe4e..03031f1 100644 --- a/stubs/pytest-lazy-fixture/METADATA.toml +++ b/stubs/pytest-lazy-fixture/METADATA.toml @@ -1 +1 @@ -version = "0.6" +version = "0.6.*" diff --git a/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi b/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi index b5cc420..2cc83b5 100644 --- a/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +++ b/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi @@ -1,4 +1,6 @@ -from typing import Any, Iterable, overload +from _typeshed import Incomplete +from collections.abc import Iterable +from typing import Any, overload class LazyFixture: name: str @@ -11,4 +13,4 @@ def lazy_fixture(names: str) -> LazyFixture: ... def lazy_fixture(names: Iterable[str]) -> list[LazyFixture] | Any: ... def is_lazy_fixture(val: Any) -> bool: ... def pytest_configure() -> None: ... -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/python-crontab/@tests/stubtest_allowlist.txt b/stubs/python-crontab/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..b0c2ba7 --- /dev/null +++ b/stubs/python-crontab/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +# Re-export: +crontabs.X_OK diff --git a/stubs/python-crontab/METADATA.toml b/stubs/python-crontab/METADATA.toml new file mode 100644 index 0000000..67d74ec --- /dev/null +++ b/stubs/python-crontab/METADATA.toml @@ -0,0 +1,4 @@ +version = "2.6.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/python-crontab/cronlog.pyi b/stubs/python-crontab/cronlog.pyi new file mode 100644 index 0000000..91cee9b --- /dev/null +++ b/stubs/python-crontab/cronlog.pyi @@ -0,0 +1,34 @@ +from _typeshed import Self, StrOrBytesPath +from codecs import StreamReaderWriter +from collections.abc import Generator, Iterator +from types import TracebackType +from typing_extensions import Literal + +PY3: Literal[True] +MATCHER: str + +class LogReader: + filename: StrOrBytesPath + mass: int + size: int + read: int + pipe: StreamReaderWriter | None + def __init__(self, filename: StrOrBytesPath, mass: int = ...) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, error_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def readlines(self, until: int = ...) -> Generator[tuple[int, str], None, None]: ... + +class CronLog(LogReader): + user: str | None + def __init__(self, filename: StrOrBytesPath = ..., user: str | None = ...) -> None: ... + def for_program(self, command: str) -> ProgramLog: ... + def __iter__(self) -> dict[str, str | None]: ... # type: ignore[override] + +class ProgramLog: + log: CronLog + command: str + def __init__(self, log: CronLog, command: str) -> None: ... + def __iter__(self) -> dict[str, str | None]: ... diff --git a/stubs/python-crontab/crontab.pyi b/stubs/python-crontab/crontab.pyi new file mode 100644 index 0000000..8331a5b --- /dev/null +++ b/stubs/python-crontab/crontab.pyi @@ -0,0 +1,233 @@ +import re +import subprocess +from _typeshed import Incomplete, Self +from collections import OrderedDict +from collections.abc import Callable, Generator +from logging import Logger +from types import TracebackType +from typing import Any + +__pkgname__: str +ITEMREX: re.Pattern[str] +SPECREX: re.Pattern[str] +DEVNULL: str +WEEK_ENUM: list[str] +MONTH_ENUM: list[str | None] +SPECIALS: dict[str, str] +SPECIAL_IGNORE: list[str] +S_INFO: list[dict[str, Any]] +PY3: bool +WINOS: bool +POSIX: bool +SYSTEMV: bool +ZERO_PAD: bool +LOG: Logger +CRON_COMMAND: str +SHELL: str +current_user: Callable[[], str | None] + +def open_pipe(cmd: str, *args: str, **flags) -> subprocess.Popen[Any]: ... + +class CronTab: + lines: Incomplete + crons: Incomplete + filen: Incomplete + cron_command: Incomplete + env: Incomplete + root: bool + intab: Incomplete + def __init__( + self, + user: bool | str | None = ..., + tab: Incomplete | None = ..., + tabfile: Incomplete | None = ..., + log: Incomplete | None = ..., + ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + @property + def log(self): ... + @property + def user(self) -> str | None: ... + @property + def user_opt(self): ... + def read(self, filename: Incomplete | None = ...) -> None: ... + def append(self, item, line: str = ..., read: bool = ...) -> None: ... + def write(self, filename: Incomplete | None = ..., user: Incomplete | None = ..., errors: bool = ...) -> None: ... + def write_to_user(self, user: bool = ...): ... + def run_pending(self, **kwargs) -> Generator[Incomplete, None, None]: ... + def run_scheduler(self, timeout: int = ..., **kwargs) -> Generator[Incomplete, None, None]: ... + def render(self, errors: bool = ..., specials: bool = ...): ... + def new(self, command: str = ..., comment: str = ..., user: Incomplete | None = ..., pre_comment: bool = ...) -> CronItem: ... + def find_command(self, command) -> Generator[Incomplete, None, None]: ... + def find_comment(self, comment) -> Generator[Incomplete, None, None]: ... + def find_time(self, *args) -> Generator[Incomplete, None, None]: ... + @property + def commands(self) -> Generator[Incomplete, None, None]: ... + @property + def comments(self) -> Generator[Incomplete, None, None]: ... + def remove_all(self, *args, **kwargs): ... + def remove(self, *items): ... + def __iter__(self): ... + def __getitem__(self, i): ... + def __unicode__(self) -> str: ... + def __len__(self) -> int: ... + +class CronItem: + cron: Incomplete + user: Incomplete + valid: bool + enabled: bool + special: bool + comment: Incomplete + command: Incomplete + last_run: Incomplete + env: Incomplete + pre_comment: bool + marker: Incomplete + stdin: Incomplete + slices: Incomplete + def __init__( + self, command: str = ..., comment: str = ..., user: Incomplete | None = ..., pre_comment: bool = ... + ) -> None: ... + def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... + @classmethod + def from_line(cls: type[Self], line: str, user: Incomplete | None = ..., cron: Incomplete | None = ...) -> Self: ... + def delete(self) -> None: ... + def set_command(self, cmd: str, parse_stdin: bool = ...) -> None: ... + def set_comment(self, cmt: str, pre_comment: bool = ...) -> None: ... + def parse(self, line) -> None: ... + def enable(self, enabled: bool = ...) -> bool: ... + def is_enabled(self) -> bool: ... + def is_valid(self) -> bool: ... + def render(self, specials: bool = ...) -> str: ... + def every_reboot(self): ... + def every(self, unit: int = ...): ... + def setall(self, *args: Any): ... + def clear(self): ... + def frequency(self, year: Incomplete | None = ...): ... + def frequency_per_year(self, year: Incomplete | None = ...): ... + def frequency_per_day(self): ... + def frequency_per_hour(self): ... + def run_pending(self, now: Incomplete | None = ...): ... + def run(self): ... + def schedule(self, date_from: Incomplete | None = ...): ... + def description(self, **kw: Any): ... + @property + def log(self): ... + @property + def minute(self): ... + @property + def minutes(self): ... + @property + def hour(self): ... + @property + def hours(self): ... + @property + def day(self): ... + @property + def dom(self): ... + @property + def month(self): ... + @property + def months(self): ... + @property + def dow(self): ... + def __len__(self) -> int: ... + def __getitem__(self, key: str): ... + def __lt__(self, value): ... + def __gt__(self, value): ... + def __unicode__(self) -> str: ... + +class Every: + slices: Incomplete + unit: Incomplete + def __init__(self, item, units) -> None: ... + def set_attr(self, target: int) -> Callable[[], None]: ... + def year(self) -> None: ... + +class CronSlices(list[CronSlice]): + special: Incomplete + def __init__(self, *args: Any) -> None: ... + def is_self_valid(self, *args: Any) -> bool: ... + @classmethod + def is_valid(cls, *args: Any) -> bool: ... + def setall(self, *slices) -> None: ... + def clean_render(self) -> str: ... + def render(self, specials: bool = ...) -> str: ... + def clear(self) -> None: ... + def frequency(self, year: Incomplete | None = ...): ... + def frequency_per_year(self, year: Incomplete | None = ...): ... + def frequency_per_day(self): ... + def frequency_per_hour(self): ... + def __eq__(self, arg: object) -> bool: ... + +class SundayError(KeyError): ... + +class Also: + obj: Incomplete + def __init__(self, obj) -> None: ... + def every(self, *a): ... + def on(self, *a): ... + def during(self, *a): ... + +class CronSlice: + min: Incomplete + max: Incomplete + name: Incomplete + enum: Incomplete + parts: Incomplete + def __init__(self, info, value: Incomplete | None = ...) -> None: ... + def __hash__(self) -> int: ... + def parse(self, value) -> None: ... + def render(self, resolve: bool = ..., specials: bool = ...): ... + def __eq__(self, arg: object) -> bool: ... + def __unicode__(self) -> str: ... + def every(self, n_value, also: bool = ...): ... + def on(self, *n_value, **opts): ... + def during(self, vfrom, vto, also: bool = ...): ... + @property + def also(self): ... + def clear(self) -> None: ... + def get_range(self, *vrange): ... + def __iter__(self): ... + def __len__(self) -> int: ... + def parse_value(self, val, sunday: Incomplete | None = ...): ... + +def get_cronvalue(value, enums): ... + +class CronValue: + text: Incomplete + value: Incomplete + def __init__(self, value, enums) -> None: ... + def __lt__(self, value): ... + def __int__(self) -> int: ... + +class CronRange: + dangling: Incomplete + slice: Incomplete + cron: Incomplete + seq: int + def __init__(self, vslice, *vrange) -> None: ... + vfrom: Incomplete + vto: Incomplete + def parse(self, value) -> None: ... + def all(self) -> None: ... + def render(self, resolve: bool = ...): ... + def range(self): ... + def every(self, value) -> None: ... + def __lt__(self, value): ... + def __gt__(self, value): ... + def __int__(self) -> int: ... + def __unicode__(self) -> str: ... + +class OrderedVariableList(OrderedDict[Incomplete, Incomplete]): + job: Incomplete + def __init__(self, *args: Any, **kw: Any) -> None: ... + @property + def previous(self): ... + def all(self): ... + def __getitem__(self, key): ... diff --git a/stubs/python-crontab/crontabs.pyi b/stubs/python-crontab/crontabs.pyi new file mode 100644 index 0000000..2d446e0 --- /dev/null +++ b/stubs/python-crontab/crontabs.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from crontab import CronTab + +class UserSpool(list[CronTab]): + def __init__(self, loc: str, tabs: CronTabs | None = ...) -> None: ... + def listdir(self, loc: str) -> list[str]: ... + def get_owner(self, path: str) -> str: ... + def generate(self, loc: str, username: str) -> CronTab: ... + +class SystemTab(list[CronTab]): + def __init__(self, loc: str, tabs: CronTabs | None = ...) -> None: ... + +class AnaCronTab(list[CronTab]): + def __init__(self, loc: str, tabs: CronTabs | None = ...) -> None: ... + def add(self, loc: str, item: str, anajob) -> CronTab: ... + +KNOWN_LOCATIONS: list[tuple[UserSpool | SystemTab | AnaCronTab, str]] + +class CronTabs(list[UserSpool | SystemTab | AnaCronTab]): + def __new__(cls, *args: Any, **kw: Any): ... + def __init__(self) -> None: ... + def add(self, cls: type[UserSpool | SystemTab | AnaCronTab], *args: Any) -> None: ... + @property + def all(self) -> CronTab: ... diff --git a/stubs/python-dateutil/METADATA.toml b/stubs/python-dateutil/METADATA.toml index 1985499..fa0e835 100644 --- a/stubs/python-dateutil/METADATA.toml +++ b/stubs/python-dateutil/METADATA.toml @@ -1,3 +1 @@ -version = "2.8" -python2 = true -requires = [] +version = "2.8.*" diff --git a/stubs/python-dateutil/dateutil/_common.pyi b/stubs/python-dateutil/dateutil/_common.pyi index a437f85..081bebe 100644 --- a/stubs/python-dateutil/dateutil/_common.pyi +++ b/stubs/python-dateutil/dateutil/_common.pyi @@ -1,12 +1,9 @@ -from typing import TypeVar +from _typeshed import Self -_T = TypeVar("_T") - -class weekday(object): +class weekday: def __init__(self, weekday: int, n: int | None = ...) -> None: ... - def __call__(self: _T, n: int) -> _T: ... + def __call__(self: Self, n: int) -> Self: ... def __eq__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... def __hash__(self) -> int: ... weekday: int n: int diff --git a/stubs/python-dateutil/dateutil/parser/__init__.pyi b/stubs/python-dateutil/dateutil/parser/__init__.pyi index af88c8b..58b24e3 100644 --- a/stubs/python-dateutil/dateutil/parser/__init__.pyi +++ b/stubs/python-dateutil/dateutil/parser/__init__.pyi @@ -1,39 +1,41 @@ +from collections.abc import Mapping from datetime import datetime, tzinfo -from typing import IO, Any, Mapping, Text, Tuple, Union +from typing import IO, Any +from typing_extensions import TypeAlias from .isoparser import isoparse as isoparse, isoparser as isoparser -_FileOrStr = Union[bytes, Text, IO[str], IO[Any]] +_FileOrStr: TypeAlias = bytes | str | IO[str] | IO[Any] -class parserinfo(object): +class parserinfo: JUMP: list[str] - WEEKDAYS: list[Tuple[str, str]] - MONTHS: list[Tuple[str, str]] - HMS: list[Tuple[str, str, str]] - AMPM: list[Tuple[str, str]] + WEEKDAYS: list[tuple[str, ...]] + MONTHS: list[tuple[str, ...]] + HMS: list[tuple[str, str, str]] + AMPM: list[tuple[str, str]] UTCZONE: list[str] PERTAIN: list[str] TZOFFSET: dict[str, int] def __init__(self, dayfirst: bool = ..., yearfirst: bool = ...) -> None: ... - def jump(self, name: Text) -> bool: ... - def weekday(self, name: Text) -> int | None: ... - def month(self, name: Text) -> int | None: ... - def hms(self, name: Text) -> int | None: ... - def ampm(self, name: Text) -> int | None: ... - def pertain(self, name: Text) -> bool: ... - def utczone(self, name: Text) -> bool: ... - def tzoffset(self, name: Text) -> int | None: ... + def jump(self, name: str) -> bool: ... + def weekday(self, name: str) -> int | None: ... + def month(self, name: str) -> int | None: ... + def hms(self, name: str) -> int | None: ... + def ampm(self, name: str) -> int | None: ... + def pertain(self, name: str) -> bool: ... + def utczone(self, name: str) -> bool: ... + def tzoffset(self, name: str) -> int | None: ... def convertyear(self, year: int) -> int: ... def validate(self, res: datetime) -> bool: ... -class parser(object): +class parser: def __init__(self, info: parserinfo | None = ...) -> None: ... def parse( self, timestr: _FileOrStr, default: datetime | None = ..., ignoretz: bool = ..., - tzinfos: Mapping[Text, tzinfo] | None = ..., + tzinfos: Mapping[str, tzinfo] | None = ..., **kwargs: Any, ) -> datetime: ... diff --git a/stubs/python-dateutil/dateutil/parser/isoparser.pyi b/stubs/python-dateutil/dateutil/parser/isoparser.pyi index ed24582..4cc8671 100644 --- a/stubs/python-dateutil/dateutil/parser/isoparser.pyi +++ b/stubs/python-dateutil/dateutil/parser/isoparser.pyi @@ -1,12 +1,12 @@ from _typeshed import SupportsRead from datetime import date, datetime, time, tzinfo -from typing import Text, Union +from typing_extensions import TypeAlias -_Readable = SupportsRead[Union[Text, bytes]] -_TakesAscii = Union[Text, bytes, _Readable] +_Readable: TypeAlias = SupportsRead[str | bytes] +_TakesAscii: TypeAlias = str | bytes | _Readable class isoparser: - def __init__(self, sep: Text | bytes | None = ...): ... + def __init__(self, sep: str | bytes | None = ...): ... def isoparse(self, dt_str: _TakesAscii) -> datetime: ... def parse_isodate(self, datestr: _TakesAscii) -> date: ... def parse_isotime(self, timestr: _TakesAscii) -> time: ... diff --git a/stubs/python-dateutil/dateutil/relativedelta.pyi b/stubs/python-dateutil/dateutil/relativedelta.pyi index ec2adea..20f7c68 100644 --- a/stubs/python-dateutil/dateutil/relativedelta.pyi +++ b/stubs/python-dateutil/dateutil/relativedelta.pyi @@ -1,12 +1,15 @@ +from _typeshed import Self from datetime import date, datetime, timedelta from typing import SupportsFloat, TypeVar, overload +from typing_extensions import TypeAlias from ._common import weekday +# We need the extra "Self" TypeVar to avoid overlapping __add__/__radd__ complaints from mypy _SelfT = TypeVar("_SelfT", bound=relativedelta) _DateT = TypeVar("_DateT", date, datetime) # Work around attribute and type having the same name. -_weekday = weekday +_Weekday: TypeAlias = weekday MO: weekday TU: weekday @@ -16,7 +19,7 @@ FR: weekday SA: weekday SU: weekday -class relativedelta(object): +class relativedelta: years: int months: int days: int @@ -27,7 +30,7 @@ class relativedelta(object): microseconds: int year: int | None month: int | None - weekday: _weekday | None + weekday: _Weekday | None day: int | None hour: int | None minute: int | None @@ -49,7 +52,7 @@ class relativedelta(object): year: int | None = ..., month: int | None = ..., day: int | None = ..., - weekday: int | _weekday | None = ..., + weekday: int | _Weekday | None = ..., yearday: int | None = ..., nlyearday: int | None = ..., hour: int | None = ..., @@ -61,37 +64,36 @@ class relativedelta(object): def weeks(self) -> int: ... @weeks.setter def weeks(self, value: int) -> None: ... - def normalized(self: _SelfT) -> _SelfT: ... + def normalized(self: Self) -> Self: ... # TODO: use Union when mypy will handle it properly in overloaded operator # methods (#2129, #1442, #1264 in mypy) @overload - def __add__(self: _SelfT, other: relativedelta) -> _SelfT: ... + def __add__(self: _SelfT, other: relativedelta) -> _SelfT: ... # noqa: Y019 @overload - def __add__(self: _SelfT, other: timedelta) -> _SelfT: ... + def __add__(self: _SelfT, other: timedelta) -> _SelfT: ... # noqa: Y019 @overload def __add__(self, other: _DateT) -> _DateT: ... @overload - def __radd__(self: _SelfT, other: relativedelta) -> _SelfT: ... + def __radd__(self: _SelfT, other: relativedelta) -> _SelfT: ... # noqa: Y019 @overload - def __radd__(self: _SelfT, other: timedelta) -> _SelfT: ... + def __radd__(self: _SelfT, other: timedelta) -> _SelfT: ... # noqa: Y019 @overload def __radd__(self, other: _DateT) -> _DateT: ... @overload - def __rsub__(self: _SelfT, other: relativedelta) -> _SelfT: ... + def __rsub__(self: Self, other: relativedelta) -> Self: ... @overload - def __rsub__(self: _SelfT, other: timedelta) -> _SelfT: ... + def __rsub__(self: Self, other: timedelta) -> Self: ... @overload def __rsub__(self, other: _DateT) -> _DateT: ... - def __sub__(self: _SelfT, other: relativedelta) -> _SelfT: ... - def __neg__(self: _SelfT) -> _SelfT: ... + def __sub__(self: Self, other: relativedelta) -> Self: ... + def __neg__(self: Self) -> Self: ... def __bool__(self) -> bool: ... def __nonzero__(self) -> bool: ... - def __mul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ... - def __rmul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ... + def __mul__(self: Self, other: SupportsFloat) -> Self: ... + def __rmul__(self: Self, other: SupportsFloat) -> Self: ... 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: ... - def __repr__(self) -> str: ... - def __abs__(self: _SelfT) -> _SelfT: ... + def __div__(self: Self, other: SupportsFloat) -> Self: ... + def __truediv__(self: Self, other: SupportsFloat) -> Self: ... + def __abs__(self: Self) -> Self: ... def __hash__(self) -> int: ... diff --git a/stubs/python-dateutil/dateutil/rrule.pyi b/stubs/python-dateutil/dateutil/rrule.pyi index d928c8d..7acf764 100644 --- a/stubs/python-dateutil/dateutil/rrule.pyi +++ b/stubs/python-dateutil/dateutil/rrule.pyi @@ -1,5 +1,7 @@ import datetime -from typing import Any, Iterable +from collections.abc import Iterable +from typing import Any +from typing_extensions import TypeAlias from ._common import weekday as weekdaybase @@ -13,6 +15,7 @@ SECONDLY: int class weekday(weekdaybase): ... +weekdays: tuple[weekday, weekday, weekday, weekday, weekday, weekday, weekday] MO: weekday TU: weekday WE: weekday @@ -81,6 +84,8 @@ class _iterinfo: def mtimeset(self, hour, minute, second): ... def stimeset(self, hour, minute, second): ... +_RRule: TypeAlias = rrule + class rruleset(rrulebase): class _genitem: dt: Any = ... @@ -93,13 +98,14 @@ class rruleset(rrulebase): def __gt__(self, other): ... def __eq__(self, other): ... def __ne__(self, other): ... + def __init__(self, cache: bool = ...) -> None: ... - def rrule(self, rrule): ... + def rrule(self, rrule: _RRule): ... def rdate(self, rdate): ... def exrule(self, exrule): ... def exdate(self, exdate): ... class _rrulestr: - def __call__(self, s, **kwargs): ... + def __call__(self, s, **kwargs) -> rrule | rruleset: ... rrulestr: _rrulestr diff --git a/stubs/python-dateutil/dateutil/tz/_common.pyi b/stubs/python-dateutil/dateutil/tz/_common.pyi index 807789f..c9e6ba5 100644 --- a/stubs/python-dateutil/dateutil/tz/_common.pyi +++ b/stubs/python-dateutil/dateutil/tz/_common.pyi @@ -1,5 +1,6 @@ +import abc from datetime import datetime, timedelta, tzinfo -from typing import Any +from typing import ClassVar def tzname_in_python2(namefunc): ... def enfold(dt: datetime, fold: int = ...): ... @@ -8,7 +9,10 @@ class _DatetimeWithFold(datetime): @property def fold(self): ... -class _tzinfo(tzinfo): +# Doesn't actually have ABCMeta as the metaclass at runtime, +# but mypy complains if we don't have it in the stub. +# See discussion in #8908 +class _tzinfo(tzinfo, metaclass=abc.ABCMeta): def is_ambiguous(self, dt: datetime) -> bool: ... def fromutc(self, dt: datetime) -> datetime: ... @@ -19,6 +23,6 @@ class tzrangebase(_tzinfo): def tzname(self, dt: datetime | None) -> str: ... def fromutc(self, dt: datetime) -> datetime: ... def is_ambiguous(self, dt: datetime) -> bool: ... - __hash__: Any + __hash__: ClassVar[None] # type: ignore[assignment] def __ne__(self, other): ... - __reduce__: Any + __reduce__ = object.__reduce__ diff --git a/stubs/python-dateutil/dateutil/tz/tz.pyi b/stubs/python-dateutil/dateutil/tz/tz.pyi index 6e26442..dfafcdd 100644 --- a/stubs/python-dateutil/dateutil/tz/tz.pyi +++ b/stubs/python-dateutil/dateutil/tz/tz.pyi @@ -1,10 +1,11 @@ import datetime -from typing import IO, Any, Text, Tuple, Union +from typing import Any, ClassVar, Protocol, TypeVar +from typing_extensions import Literal from ..relativedelta import relativedelta from ._common import _tzinfo as _tzinfo, enfold as enfold, tzname_in_python2 as tzname_in_python2, tzrangebase as tzrangebase -_FileObj = Union[str, Text, IO[str], IO[Text]] +_DT = TypeVar("_DT", bound=datetime.datetime) ZERO: datetime.timedelta EPOCH: datetime.datetime @@ -15,10 +16,11 @@ class tzutc(datetime.tzinfo): def dst(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ... def tzname(self, dt: datetime.datetime | None) -> str: ... def is_ambiguous(self, dt: datetime.datetime | None) -> bool: ... + def fromutc(self, dt: _DT) -> _DT: ... def __eq__(self, other): ... - __hash__: Any + __hash__: ClassVar[None] # type: ignore[assignment] def __ne__(self, other): ... - __reduce__: Any + __reduce__ = object.__reduce__ class tzoffset(datetime.tzinfo): def __init__(self, name, offset) -> None: ... @@ -26,10 +28,11 @@ class tzoffset(datetime.tzinfo): def dst(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ... def is_ambiguous(self, dt: datetime.datetime | None) -> bool: ... def tzname(self, dt: datetime.datetime | None) -> str: ... + def fromutc(self, dt: _DT) -> _DT: ... def __eq__(self, other): ... - __hash__: Any + __hash__: ClassVar[None] # type: ignore[assignment] def __ne__(self, other): ... - __reduce__: Any + __reduce__ = object.__reduce__ @classmethod def instance(cls, name, offset) -> tzoffset: ... @@ -40,24 +43,30 @@ class tzlocal(_tzinfo): def tzname(self, dt: datetime.datetime | None) -> str: ... def is_ambiguous(self, dt: datetime.datetime | None) -> bool: ... def __eq__(self, other): ... - __hash__: Any + __hash__: ClassVar[None] # type: ignore[assignment] def __ne__(self, other): ... - __reduce__: Any + __reduce__ = object.__reduce__ class _ttinfo: def __init__(self) -> None: ... def __eq__(self, other): ... - __hash__: Any + __hash__: ClassVar[None] # type: ignore[assignment] def __ne__(self, other): ... +class _TZFileReader(Protocol): + # optional attribute: + # name: str + def read(self, __size: int) -> bytes: ... + def seek(self, __target: int, __whence: Literal[1]) -> object: ... + class tzfile(_tzinfo): - def __init__(self, fileobj: _FileObj, filename: Text | None = ...) -> None: ... + def __init__(self, fileobj: str | _TZFileReader, filename: str | None = ...) -> None: ... def is_ambiguous(self, dt: datetime.datetime | None, idx: int | None = ...) -> bool: ... def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ... def dst(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ... def tzname(self, dt: datetime.datetime | None) -> str: ... def __eq__(self, other): ... - __hash__: Any + __hash__: ClassVar[None] # type: ignore[assignment] def __ne__(self, other): ... def __reduce__(self): ... def __reduce_ex__(self, protocol): ... @@ -66,24 +75,29 @@ class tzrange(tzrangebase): hasdst: bool def __init__( self, - stdabbr: Text, + stdabbr: str, stdoffset: int | datetime.timedelta | None = ..., - dstabbr: Text | None = ..., + dstabbr: str | None = ..., dstoffset: int | datetime.timedelta | None = ..., start: relativedelta | None = ..., end: relativedelta | None = ..., ) -> None: ... - def transitions(self, year: int) -> Tuple[datetime.datetime, datetime.datetime]: ... + def transitions(self, year: int) -> tuple[datetime.datetime, datetime.datetime]: ... def __eq__(self, other): ... class tzstr(tzrange): hasdst: bool - def __init__(self, s: bytes | _FileObj, posix_offset: bool = ...) -> None: ... + def __init__(self, s: str, posix_offset: bool = ...) -> None: ... @classmethod def instance(cls, name, offset) -> tzoffset: ... +class _ICalReader(Protocol): + # optional attribute: + # name: str + def read(self) -> str: ... + class tzical: - def __init__(self, fileobj: _FileObj) -> None: ... + def __init__(self, fileobj: str | _ICalReader) -> None: ... def keys(self): ... def get(self, tzid: Any | None = ...): ... @@ -95,7 +109,7 @@ def datetime_ambiguous(dt: datetime.datetime, tz: datetime.tzinfo | None = ...) def resolve_imaginary(dt: datetime.datetime) -> datetime.datetime: ... class _GetTZ: - def __call__(self, name: Text | None = ...) -> datetime.tzinfo | None: ... - def nocache(self, name: Text | None) -> datetime.tzinfo | None: ... + def __call__(self, name: str | None = ...) -> datetime.tzinfo | None: ... + def nocache(self, name: str | None) -> datetime.tzinfo | None: ... gettz: _GetTZ diff --git a/stubs/python-gflags/METADATA.toml b/stubs/python-gflags/METADATA.toml index 5bba18d..47a34df 100644 --- a/stubs/python-gflags/METADATA.toml +++ b/stubs/python-gflags/METADATA.toml @@ -1,2 +1,4 @@ -version = "3.1" -python2 = true +version = "3.1.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/python-gflags/gflags.pyi b/stubs/python-gflags/gflags.pyi index bc67493..84da386 100644 --- a/stubs/python-gflags/gflags.pyi +++ b/stubs/python-gflags/gflags.pyi @@ -1,5 +1,6 @@ +from collections.abc import Callable, Iterable, Iterator, Sequence from types import ModuleType -from typing import IO, Any, Callable, Iterable, Sequence, Text +from typing import IO, Any class Error(Exception): ... @@ -34,7 +35,6 @@ def doc_to_help(doc: str) -> str: ... DocToHelp = doc_to_help class FlagValues: - def __init__(self) -> None: ... def UseGnuGetOpt(self, use_gnu_getopt: bool = ...) -> None: ... def is_gnu_getopt(self) -> bool: ... IsGnuGetOpt = is_gnu_getopt @@ -63,14 +63,13 @@ class FlagValues: SetDefault = set_default def __contains__(self, name: str) -> bool: ... has_key = __contains__ - def __iter__(self) -> Iterable[str]: ... + def __iter__(self) -> Iterator[str]: ... def __call__(self, argv: list[str], known_only: bool = ...) -> list[str]: ... def reset(self) -> None: ... Reset = reset def RegisteredFlags(self) -> list[str]: ... def flag_values_dict(self) -> dict[str, Any]: ... FlagValuesDict = flag_values_dict - def __str__(self) -> str: ... def GetHelp(self, prefix: str = ...) -> str: ... def module_help(self, module: ModuleType | str) -> str: ... ModuleHelp = module_help @@ -101,11 +100,11 @@ class Flag: value: Any help: str short_name: str - boolean = False - present = False + boolean: bool + present: bool parser: ArgumentParser serializer: ArgumentSerializer - allow_override = False + allow_override: bool def __init__( self, parser: ArgumentParser, @@ -124,7 +123,7 @@ class Flag: def Type(self) -> str: ... def WriteInfoInXMLFormat(self, outfile: IO[str], module_name: str, is_key: bool = ..., indent: str = ...) -> None: ... -class ArgumentParser(object): +class ArgumentParser: syntactic_help: str # TODO what is this def parse(self, argument: Any) -> Any: ... @@ -134,7 +133,7 @@ class ArgumentParser(object): def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str) -> None: ... class ArgumentSerializer: - def Serialize(self, value: Any) -> Text: ... + def Serialize(self, value: Any) -> str: ... class ListSerializer(ArgumentSerializer): def __init__(self, list_sep: str) -> None: ... diff --git a/stubs/python-jose/@tests/stubtest_allowlist.txt b/stubs/python-jose/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..efd6e0e --- /dev/null +++ b/stubs/python-jose/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +jose.backends.cryptography_backend +jose.backends.CryptographyAESKey +jose.backends.CryptographyECKey +jose.backends.CryptographyHMACKey +jose.backends.CryptographyRSAKey +jose.backends.ECDSAECKey diff --git a/stubs/python-jose/METADATA.toml b/stubs/python-jose/METADATA.toml new file mode 100644 index 0000000..ade9241 --- /dev/null +++ b/stubs/python-jose/METADATA.toml @@ -0,0 +1,5 @@ +version = "3.3.*" +requires = [] # excluding pyasn1, pyrsa, cryptography until typing is available + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/python-jose/jose/__init__.pyi b/stubs/python-jose/jose/__init__.pyi new file mode 100644 index 0000000..dcd21e1 --- /dev/null +++ b/stubs/python-jose/jose/__init__.pyi @@ -0,0 +1,11 @@ +from .exceptions import ( + ExpiredSignatureError as ExpiredSignatureError, + JOSEError as JOSEError, + JWSError as JWSError, + JWTError as JWTError, +) + +__version__: str +__author__: str +__license__: str +__copyright__: str diff --git a/stubs/python-jose/jose/backends/__init__.pyi b/stubs/python-jose/jose/backends/__init__.pyi new file mode 100644 index 0000000..4ce1c43 --- /dev/null +++ b/stubs/python-jose/jose/backends/__init__.pyi @@ -0,0 +1,21 @@ +from collections.abc import Callable + +from .base import DIRKey as DIRKey +from .cryptography_backend import ( + CryptographyAESKey as CryptographyAESKey, + CryptographyECKey as CryptographyECKey, + CryptographyHMACKey as CryptographyHMACKey, + CryptographyRSAKey as CryptographyRSAKey, +) +from .ecdsa_backend import ECDSAECKey as ECDSAECKey +from .native import HMACKey as NativeHMACKey +from .rsa_backend import RSAKey as BackendRSAKey + +# python-jose relies on importing from cryptography_backend +# then falling back on other imports +# these are all the potential options +AESKey: type[CryptographyAESKey] | None +HMACKey: type[CryptographyHMACKey] | type[NativeHMACKey] +RSAKey: type[CryptographyRSAKey] | type[BackendRSAKey] | None +ECKey: type[CryptographyECKey] | type[ECDSAECKey] +get_random_bytes: Callable[[int], bytes] diff --git a/stubs/python-jose/jose/backends/_asn1.pyi b/stubs/python-jose/jose/backends/_asn1.pyi new file mode 100644 index 0000000..0c01c08 --- /dev/null +++ b/stubs/python-jose/jose/backends/_asn1.pyi @@ -0,0 +1,22 @@ +from typing import Any +from typing_extensions import TypeAlias + +# Enable when pyasn1 gets stubs: +# from pyasn1.type import univ +_Sequence: TypeAlias = Any + +RSA_ENCRYPTION_ASN1_OID: str + +class RsaAlgorithmIdentifier(_Sequence): + componentType: Any + +class PKCS8PrivateKey(_Sequence): + componentType: Any + +class PublicKeyInfo(_Sequence): + componentType: Any + +def rsa_private_key_pkcs8_to_pkcs1(pkcs8_key): ... +def rsa_private_key_pkcs1_to_pkcs8(pkcs1_key): ... +def rsa_public_key_pkcs1_to_pkcs8(pkcs1_key): ... +def rsa_public_key_pkcs8_to_pkcs1(pkcs8_key): ... diff --git a/stubs/python-jose/jose/backends/base.pyi b/stubs/python-jose/jose/backends/base.pyi new file mode 100644 index 0000000..ea7f34f --- /dev/null +++ b/stubs/python-jose/jose/backends/base.pyi @@ -0,0 +1,23 @@ +from _typeshed import Self +from typing import Any + +class Key: + # Enable when we can use stubs from installed dependencies, + # as `key` can be of type cryptography.x509.base.Certificate: + # from cryptography.x509 import Certificate + def __init__(self, key, algorithm) -> None: ... + def sign(self, msg: bytes) -> bytes: ... + def verify(self, msg: bytes, sig: bytes) -> bool: ... + def public_key(self: Self) -> Self: ... + def to_pem(self) -> bytes: ... + def to_dict(self) -> dict[str, Any]: ... + def encrypt(self, plain_text: str | bytes, aad: bytes | None = ...) -> tuple[bytes, bytes, bytes | None]: ... + def decrypt( + self, cipher_text: str | bytes, iv: str | bytes | None = ..., aad: bytes | None = ..., tag: bytes | None = ... + ) -> bytes: ... + def wrap_key(self, key_data: bytes) -> bytes: ... + def unwrap_key(self, wrapped_key: bytes) -> bytes: ... + +class DIRKey(Key): + def __init__(self, key_data: str | bytes, algorithm: str) -> None: ... + def to_dict(self) -> dict[str, Any]: ... diff --git a/stubs/python-jose/jose/backends/cryptography_backend.pyi b/stubs/python-jose/jose/backends/cryptography_backend.pyi new file mode 100644 index 0000000..4454988 --- /dev/null +++ b/stubs/python-jose/jose/backends/cryptography_backend.pyi @@ -0,0 +1,66 @@ +from typing import Any + +from .base import Key + +def get_random_bytes(num_bytes: int) -> bytes: ... + +# Enable when we can use stubs from installed dependencies: +# from cryptography.hazmat import backends +class CryptographyECKey(Key): + SHA256: Any + SHA384: Any + SHA512: Any + hash_alg: Any + cryptography_backend: Any + prepared_key: Any + def __init__(self, key, algorithm, cryptography_backend=...) -> None: ... + def sign(self, msg): ... + def verify(self, msg, sig): ... + def is_public(self): ... + def public_key(self): ... + def to_pem(self): ... + def to_dict(self): ... + +class CryptographyRSAKey(Key): + SHA256: Any + SHA384: Any + SHA512: Any + RSA1_5: Any + RSA_OAEP: Any + RSA_OAEP_256: Any + hash_alg: Any + padding: Any + cryptography_backend: Any + prepared_key: Any + def __init__(self, key, algorithm, cryptography_backend=...) -> None: ... + def sign(self, msg): ... + def verify(self, msg, sig): ... + def is_public(self): ... + def public_key(self): ... + def to_pem(self, pem_format: str = ...): ... + def to_dict(self): ... + def wrap_key(self, key_data): ... + def unwrap_key(self, wrapped_key): ... + +class CryptographyAESKey(Key): + KEY_128: Any + KEY_192: Any + KEY_256: Any + KEY_384: Any + KEY_512: Any + AES_KW_ALGS: Any + MODES: Any + def __init__(self, key, algorithm) -> None: ... + def to_dict(self): ... + def encrypt(self, plain_text, aad: Any | None = ...): ... + def decrypt(self, cipher_text, iv: Any | None = ..., aad: Any | None = ..., tag: Any | None = ...): ... + def wrap_key(self, key_data): ... + def unwrap_key(self, wrapped_key): ... + +class CryptographyHMACKey(Key): + ALG_MAP: Any + prepared_key: Any + def __init__(self, key, algorithm) -> None: ... + def to_dict(self): ... + def sign(self, msg): ... + def verify(self, msg, sig): ... diff --git a/stubs/python-jose/jose/backends/ecdsa_backend.pyi b/stubs/python-jose/jose/backends/ecdsa_backend.pyi new file mode 100644 index 0000000..9a78fb3 --- /dev/null +++ b/stubs/python-jose/jose/backends/ecdsa_backend.pyi @@ -0,0 +1,25 @@ +from _typeshed import Self +from collections.abc import Callable +from hashlib import _Hash +from typing import Any + +from .base import Key + +# Enable when we can use stubs from installed dependencies: +# from ecdsa.curves import Curve +class ECDSAECKey(Key): + SHA256: Callable[[bytes], _Hash] + SHA384: Callable[[bytes], _Hash] + SHA512: Callable[[bytes], _Hash] + CURVE_MAP: Any + CURVE_NAMES: Any + hash_alg: Any + curve: Any + prepared_key: Any + def __init__(self, key, algorithm) -> None: ... + def sign(self, msg): ... + def verify(self, msg, sig): ... + def is_public(self) -> bool: ... + def public_key(self: Self) -> Self: ... + def to_pem(self): ... + def to_dict(self) -> dict[str, Any]: ... diff --git a/stubs/python-jose/jose/backends/native.pyi b/stubs/python-jose/jose/backends/native.pyi new file mode 100644 index 0000000..8c1626b --- /dev/null +++ b/stubs/python-jose/jose/backends/native.pyi @@ -0,0 +1,21 @@ +from _typeshed import ReadableBuffer +from collections.abc import Callable +from hashlib import _Hash +from typing import Any + +from .base import Key + +def get_random_bytes(num_bytes: int) -> bytes: ... + +class HMACKey(Key): + HASHES: dict[str, Callable[[bytes], _Hash]] + prepared_key: bytes + def __init__( + self, + # explicitly checks for key_data as dict instance, instead of a Mapping + key: str | bytes | dict[str, Any], + algorithm: str, + ) -> None: ... + def sign(self, msg: ReadableBuffer | None) -> bytes: ... + def verify(self, msg: ReadableBuffer | None, sig: str | bytes) -> bool: ... + def to_dict(self) -> dict[str, Any]: ... diff --git a/stubs/python-jose/jose/backends/rsa_backend.pyi b/stubs/python-jose/jose/backends/rsa_backend.pyi new file mode 100644 index 0000000..cb04422 --- /dev/null +++ b/stubs/python-jose/jose/backends/rsa_backend.pyi @@ -0,0 +1,27 @@ +from _typeshed import Self +from typing import Any + +from .base import Key + +LEGACY_INVALID_PKCS8_RSA_HEADER: bytes +ASN1_SEQUENCE_ID: bytes +RSA_ENCRYPTION_ASN1_OID: str + +# Enable when we can use stubs from installed dependencies: +# from rsa import PublicKey +def pem_to_spki(pem, fmt: str = ...): ... + +class RSAKey(Key): + SHA256: str + SHA384: str + SHA512: str + hash_alg: str + def __init__(self, key, algorithm) -> None: ... + def sign(self, msg: bytes) -> bytes: ... + def verify(self, msg: bytes, sig: bytes) -> bool: ... + def is_public(self) -> bool: ... + def public_key(self: Self) -> Self: ... + def to_pem(self, pem_format: str = ...) -> bytes: ... + def to_dict(self) -> dict[str, Any]: ... + def wrap_key(self, key_data: bytes) -> bytes: ... + def unwrap_key(self, wrapped_key: bytes) -> bytes: ... diff --git a/stubs/python-jose/jose/constants.pyi b/stubs/python-jose/jose/constants.pyi new file mode 100644 index 0000000..209a905 --- /dev/null +++ b/stubs/python-jose/jose/constants.pyi @@ -0,0 +1,72 @@ +from collections.abc import Callable, Mapping +from hashlib import _Hash + +from .backends.base import Key + +class Algorithms: + NONE: str + HS256: str + HS384: str + HS512: str + RS256: str + RS384: str + RS512: str + ES256: str + ES384: str + ES512: str + A128CBC_HS256: str + A192CBC_HS384: str + A256CBC_HS512: str + A128GCM: str + A192GCM: str + A256GCM: str + A128CBC: str + A192CBC: str + A256CBC: str + DIR: str + RSA1_5: str + RSA_OAEP: str + RSA_OAEP_256: str + A128KW: str + A192KW: str + A256KW: str + ECDH_ES: str + ECDH_ES_A128KW: str + ECDH_ES_A192KW: str + ECDH_ES_A256KW: str + A128GCMKW: str + A192GCMKW: str + A256GCMKW: str + PBES2_HS256_A128KW: str + PBES2_HS384_A192KW: str + PBES2_HS512_A256KW: str + DEF: str + HMAC: set[str] + RSA_DS: set[str] + RSA_KW: set[str] + RSA: set[str] + EC_DS: set[str] + EC_KW: set[str] + EC: set[str] + AES_PSEUDO: set[str] + AES_JWE_ENC: set[str] + AES_ENC: set[str] + AES_KW: set[str] + AEC_GCM_KW: set[str] + AES: set[str] + PBES2_KW: set[str] + HMAC_AUTH_TAG: set[str] + GCM: set[str] + SUPPORTED: set[str] + ALL: set[str] + HASHES: Mapping[str, Callable[[bytes], _Hash]] + KEYS: Mapping[str, type[Key]] + +ALGORITHMS: Algorithms + +class Zips: + DEF: str + NONE: None + SUPPORTED: set[str | None] + +ZIPS: Zips diff --git a/stubs/python-jose/jose/exceptions.pyi b/stubs/python-jose/jose/exceptions.pyi new file mode 100644 index 0000000..d7ab217 --- /dev/null +++ b/stubs/python-jose/jose/exceptions.pyi @@ -0,0 +1,12 @@ +class JOSEError(Exception): ... +class JWSError(JOSEError): ... +class JWSSignatureError(JWSError): ... +class JWSAlgorithmError(JWSError): ... +class JWTError(JOSEError): ... +class JWTClaimsError(JWTError): ... +class ExpiredSignatureError(JWTError): ... +class JWKError(JOSEError): ... +class JWEError(JOSEError): ... +class JWEParseError(JWEError): ... +class JWEInvalidAuth(JWEError): ... +class JWEAlgorithmUnsupportedError(JWEError): ... diff --git a/stubs/python-jose/jose/jwe.pyi b/stubs/python-jose/jose/jwe.pyi new file mode 100644 index 0000000..82368e0 --- /dev/null +++ b/stubs/python-jose/jose/jwe.pyi @@ -0,0 +1,22 @@ +from typing import Any + +from .backends.base import Key + +def encrypt( + plaintext: str | bytes, + # Internally it's passed down to jwk.construct(), which explicitly checks for + # key as dict instance, instead of a Mapping + key: str | bytes | dict[str, Any] | Key, + encryption: str = ..., + algorithm: str = ..., + zip: str | None = ..., + cty: str | None = ..., + kid: str | None = ..., +) -> bytes: ... +def decrypt( + jwe_str: str | bytes, + # Internally it's passed down to jwk.construct(), which explicitly checks for + # key as dict instance, instead of a Mapping + key: str | bytes | dict[str, Any] | Key, +) -> bytes | None: ... +def get_unverified_header(jwe_str: str | bytes | None) -> dict[str, Any]: ... diff --git a/stubs/python-jose/jose/jwk.pyi b/stubs/python-jose/jose/jwk.pyi new file mode 100644 index 0000000..c8113d1 --- /dev/null +++ b/stubs/python-jose/jose/jwk.pyi @@ -0,0 +1,13 @@ +from typing import Any +from typing_extensions import Literal + +from .backends import AESKey as AESKey, ECKey as ECKey, HMACKey as HMACKey, RSAKey as RSAKey +from .backends.base import DIRKey as DIRKey, Key + +def get_key(algorithm: str) -> type[Key] | None: ... +def register_key(algorithm: str, key_class: type[Key]) -> Literal[True]: ... +def construct( + # explicitly checks for key_data as dict instance, instead of a Mapping + key_data: str | bytes | dict[str, Any] | Key, + algorithm: str | None = ..., +) -> Key: ... diff --git a/stubs/python-jose/jose/jws.pyi b/stubs/python-jose/jose/jws.pyi new file mode 100644 index 0000000..c8783f9 --- /dev/null +++ b/stubs/python-jose/jose/jws.pyi @@ -0,0 +1,24 @@ +from collections.abc import Container, Mapping +from typing import Any + +from .backends.base import Key + +def sign( + payload: bytes | Mapping[str, Any], + # Internally it's passed down to jwk.construct(), which explicitly checks for + # key as dict instance, instead of a Mapping + key: str | bytes | dict[str, Any] | Key, + headers: Mapping[str, Any] | None = ..., + algorithm: str = ..., +) -> str: ... +def verify( + token: str | bytes, + key: str | bytes | Mapping[str, Any] | Key, + # Callers of this function, like jwt.decode(), and functions called internally, + # like jws._verify_signature(), use and accept algorithms=None + algorithms: str | Container[str] | None, + verify: bool = ..., +) -> bytes: ... +def get_unverified_header(token: str) -> dict[str, Any]: ... +def get_unverified_headers(token: str) -> dict[str, Any]: ... +def get_unverified_claims(token: str) -> str: ... diff --git a/stubs/python-jose/jose/jwt.pyi b/stubs/python-jose/jose/jwt.pyi new file mode 100644 index 0000000..3c95771 --- /dev/null +++ b/stubs/python-jose/jose/jwt.pyi @@ -0,0 +1,26 @@ +from collections.abc import Container, Iterable, Mapping, MutableMapping +from typing import Any + +from .backends.base import Key + +def encode( + claims: MutableMapping[str, Any], + # Internally it calls jws.sign() that expects a key dict instance instead of Mapping + key: str | bytes | dict[str, Any] | Key, + algorithm: str = ..., + headers: Mapping[str, Any] | None = ..., + access_token: str | None = ..., +) -> str: ... +def decode( + token: str | bytes, + key: str | bytes | Mapping[str, Any] | Key, + algorithms: str | Container[str] | None = ..., + options: Mapping[str, Any] | None = ..., + audience: str | None = ..., + issuer: str | Iterable[str] | None = ..., + subject: str | None = ..., + access_token: str | None = ..., +) -> dict[str, Any]: ... +def get_unverified_header(token: str) -> dict[str, Any]: ... +def get_unverified_headers(token: str) -> dict[str, Any]: ... +def get_unverified_claims(token: str) -> dict[str, Any]: ... diff --git a/stubs/python-jose/jose/utils.pyi b/stubs/python-jose/jose/utils.pyi new file mode 100644 index 0000000..de0a015 --- /dev/null +++ b/stubs/python-jose/jose/utils.pyi @@ -0,0 +1,14 @@ +from collections.abc import Callable, Iterable +from datetime import timedelta +from hashlib import _Hash +from typing import Any + +def long_to_bytes(n: int, blocksize: int | None = ...) -> bytes: ... +def long_to_base64(data: int, size: int | None = ...) -> bytes: ... +def int_arr_to_long(arr: Iterable[Any]) -> int: ... +def base64_to_long(data: str | bytes) -> int: ... +def calculate_at_hash(access_token: str, hash_alg: Callable[[bytes], _Hash]) -> str: ... +def base64url_decode(input: bytes) -> bytes: ... +def base64url_encode(input: bytes) -> bytes: ... +def timedelta_total_seconds(delta: timedelta) -> int: ... +def ensure_binary(s: str | bytes) -> bytes: ... diff --git a/stubs/python-nmap/METADATA.toml b/stubs/python-nmap/METADATA.toml index 9d5d312..7431acf 100644 --- a/stubs/python-nmap/METADATA.toml +++ b/stubs/python-nmap/METADATA.toml @@ -1,3 +1 @@ -version = "0.6" -python2 = true -requires = [] +version = "0.7.*" diff --git a/stubs/python-nmap/nmap/nmap.pyi b/stubs/python-nmap/nmap/nmap.pyi index c28623d..4b7aa05 100644 --- a/stubs/python-nmap/nmap/nmap.pyi +++ b/stubs/python-nmap/nmap/nmap.pyi @@ -1,8 +1,9 @@ -from typing import Any, Callable, Dict, Iterable, Iterator, Text, Tuple, TypeVar -from typing_extensions import TypedDict +from collections.abc import Callable, Iterable, Iterator +from typing import Any, TypeVar +from typing_extensions import TypeAlias, TypedDict _T = TypeVar("_T") -_Callback = Callable[[str, _Result], Any] +_Callback: TypeAlias = Callable[[str, _Result], object] class _Result(TypedDict): nmap: _ResultNmap @@ -49,13 +50,13 @@ class _ResultHostPort(TypedDict): __last_modification__: str -class PortScanner(object): +class PortScanner: def __init__(self, nmap_search_path: Iterable[str] = ...) -> None: ... - def get_nmap_last_output(self) -> Text: ... - def nmap_version(self) -> Tuple[int, int]: ... + def get_nmap_last_output(self) -> str: ... + def nmap_version(self) -> tuple[int, int]: ... def listscan(self, hosts: str = ...) -> list[str]: ... def scan( - self, hosts: Text = ..., ports: Text | None = ..., arguments: Text = ..., sudo: bool = ..., timeout: int = ... + self, hosts: str = ..., ports: str | None = ..., arguments: str = ..., sudo: bool = ..., timeout: int = ... ) -> _Result: ... def analyse_nmap_xml_scan( self, @@ -64,7 +65,7 @@ class PortScanner(object): nmap_err_keep_trace: str = ..., nmap_warn_keep_trace: str = ..., ) -> _Result: ... - def __getitem__(self, host: Text) -> PortScannerHostDict: ... + def __getitem__(self, host: str) -> PortScannerHostDict: ... def all_hosts(self) -> list[str]: ... def command_line(self) -> str: ... def scaninfo(self) -> _ResultNmapInfo: ... @@ -73,17 +74,17 @@ class PortScanner(object): def csv(self) -> str: ... def __scan_progressive__( - self: object, hosts: Text, ports: Text, arguments: Text, callback: _Callback | None, sudo: bool, timeout: int + self: object, hosts: str, ports: str, arguments: str, callback: _Callback | None, sudo: bool, timeout: int ) -> None: ... -class PortScannerAsync(object): +class PortScannerAsync: def __init__(self) -> None: ... def __del__(self) -> None: ... def scan( self, - hosts: Text = ..., - ports: Text | None = ..., - arguments: Text = ..., + hosts: str = ..., + ports: str | None = ..., + arguments: str = ..., callback: _Callback | None = ..., sudo: bool = ..., timeout: int = ..., @@ -94,14 +95,14 @@ class PortScannerAsync(object): class PortScannerYield(PortScannerAsync): def __init__(self) -> None: ... - def scan( # type: ignore + def scan( # type: ignore[override] self, hosts: str = ..., ports: str | None = ..., arguments: str = ..., sudo: bool = ..., timeout: int = ... - ) -> Iterator[Tuple[str, _Result]]: ... + ) -> Iterator[tuple[str, _Result]]: ... def stop(self) -> None: ... def wait(self, timeout: int | None = ...) -> None: ... - def still_scanning(self) -> None: ... # type: ignore + def still_scanning(self) -> None: ... # type: ignore[override] -class PortScannerHostDict(Dict[str, Any]): +class PortScannerHostDict(dict[str, Any]): def hostnames(self) -> list[_ResultHostNames]: ... def hostname(self) -> str: ... def state(self) -> str: ... diff --git a/stubs/python-slugify/METADATA.toml b/stubs/python-slugify/METADATA.toml index 210c760..b18b5e4 100644 --- a/stubs/python-slugify/METADATA.toml +++ b/stubs/python-slugify/METADATA.toml @@ -1 +1 @@ -version = "5.0" +version = "6.1.*" diff --git a/stubs/python-slugify/slugify/slugify.pyi b/stubs/python-slugify/slugify/slugify.pyi index 1a3ef13..ce2276c 100644 --- a/stubs/python-slugify/slugify/slugify.pyi +++ b/stubs/python-slugify/slugify/slugify.pyi @@ -1,4 +1,4 @@ -from typing import Iterable +from collections.abc import Iterable def smart_truncate( string: str, max_length: int = ..., word_boundary: bool = ..., separator: str = ..., save_order: bool = ... @@ -16,4 +16,5 @@ def slugify( regex_pattern: str | None = ..., lowercase: bool = ..., replacements: Iterable[Iterable[str]] = ..., + allow_unicode: bool = ..., ) -> str: ... diff --git a/stubs/python-slugify/slugify/special.pyi b/stubs/python-slugify/slugify/special.pyi index 05e0761..2d1da58 100644 --- a/stubs/python-slugify/slugify/special.pyi +++ b/stubs/python-slugify/slugify/special.pyi @@ -1,8 +1,8 @@ -from typing import Sequence, Tuple +from collections.abc import Sequence -def add_uppercase_char(char_list: Sequence[Tuple[str, str]]) -> Sequence[Tuple[str, str]]: ... +def add_uppercase_char(char_list: Sequence[tuple[str, str]]) -> Sequence[tuple[str, str]]: ... -CYRILLIC: Sequence[Tuple[str, str]] -GERMAN: Sequence[Tuple[str, str]] -GREEK: Sequence[Tuple[str, str]] -PRE_TRANSLATIONS: Sequence[Tuple[str, str]] +CYRILLIC: Sequence[tuple[str, str]] +GERMAN: Sequence[tuple[str, str]] +GREEK: Sequence[tuple[str, str]] +PRE_TRANSLATIONS: Sequence[tuple[str, str]] diff --git a/stubs/pytz/@tests/stubtest_allowlist.txt b/stubs/pytz/@tests/stubtest_allowlist.txt index c6fbfed..c25eb82 100644 --- a/stubs/pytz/@tests/stubtest_allowlist.txt +++ b/stubs/pytz/@tests/stubtest_allowlist.txt @@ -1,4 +1,5 @@ +# "Abstract" methods, see the .pyi file for more details. pytz.BaseTzInfo.localize pytz.BaseTzInfo.normalize -pytz.BaseTzInfo.zone -pytz.FixedOffset +pytz.tzinfo.BaseTzInfo.localize +pytz.tzinfo.BaseTzInfo.normalize diff --git a/stubs/pytz/METADATA.toml b/stubs/pytz/METADATA.toml index a9c4347..007dea1 100644 --- a/stubs/pytz/METADATA.toml +++ b/stubs/pytz/METADATA.toml @@ -1,2 +1,4 @@ -version = "2021.1" -python2 = true +version = "2022.6" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/pytz/pytz/__init__.pyi b/stubs/pytz/pytz/__init__.pyi index f9dd0e1..6a2f148 100644 --- a/stubs/pytz/pytz/__init__.pyi +++ b/stubs/pytz/pytz/__init__.pyi @@ -1,41 +1,43 @@ import datetime -from typing import Mapping, Set - -class BaseTzInfo(datetime.tzinfo): - zone: str = ... +from collections.abc import Mapping +from typing import ClassVar + +from .exceptions import ( + AmbiguousTimeError as AmbiguousTimeError, + InvalidTimeError as InvalidTimeError, + NonExistentTimeError as NonExistentTimeError, + UnknownTimeZoneError as UnknownTimeZoneError, +) +from .tzinfo import BaseTzInfo as BaseTzInfo, DstTzInfo, StaticTzInfo + +# Actually named UTC and then masked with a singleton with the same name +class _UTCclass(BaseTzInfo): def localize(self, dt: datetime.datetime, is_dst: bool | None = ...) -> datetime.datetime: ... def normalize(self, dt: datetime.datetime) -> datetime.datetime: ... - -class _UTCclass(BaseTzInfo): def tzname(self, dt: datetime.datetime | None) -> str: ... def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta: ... def dst(self, dt: datetime.datetime | None) -> datetime.timedelta: ... -class _StaticTzInfo(BaseTzInfo): - def tzname(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> str: ... - def utcoffset(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta: ... - def dst(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta: ... - -class _DstTzInfo(BaseTzInfo): - def tzname(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> str: ... - def utcoffset(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta | None: ... - def dst(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta | None: ... - -class UnknownTimeZoneError(KeyError): ... -class InvalidTimeError(Exception): ... -class AmbiguousTimeError(InvalidTimeError): ... -class NonExistentTimeError(InvalidTimeError): ... - utc: _UTCclass UTC: _UTCclass -def timezone(zone: str) -> _UTCclass | _StaticTzInfo | _DstTzInfo: ... -def FixedOffset(offset: int) -> _UTCclass | datetime.tzinfo: ... +def timezone(zone: str) -> _UTCclass | StaticTzInfo | DstTzInfo: ... + +class _FixedOffset(datetime.tzinfo): + zone: ClassVar[None] + def __init__(self, minutes: int) -> None: ... + def utcoffset(self, dt: object) -> datetime.timedelta | None: ... + def dst(self, dt: object) -> datetime.timedelta: ... + def tzname(self, dt: object) -> None: ... + def localize(self, dt: datetime.datetime, is_dst: bool = ...) -> datetime.datetime: ... + def normalize(self, dt: datetime.datetime, is_dst: bool = ...) -> datetime.datetime: ... + +def FixedOffset(offset: int, _tzinfos: dict[int, _FixedOffset] = ...) -> _UTCclass | _FixedOffset: ... all_timezones: list[str] -all_timezones_set: Set[str] +all_timezones_set: set[str] common_timezones: list[str] -common_timezones_set: Set[str] +common_timezones_set: set[str] country_timezones: Mapping[str, list[str]] country_names: Mapping[str, str] ZERO: datetime.timedelta diff --git a/stubs/pytz/pytz/exceptions.pyi b/stubs/pytz/pytz/exceptions.pyi new file mode 100644 index 0000000..1880e44 --- /dev/null +++ b/stubs/pytz/pytz/exceptions.pyi @@ -0,0 +1,7 @@ +__all__ = ["UnknownTimeZoneError", "InvalidTimeError", "AmbiguousTimeError", "NonExistentTimeError"] + +class Error(Exception): ... +class UnknownTimeZoneError(KeyError, Error): ... +class InvalidTimeError(Error): ... +class AmbiguousTimeError(InvalidTimeError): ... +class NonExistentTimeError(InvalidTimeError): ... diff --git a/stubs/pytz/pytz/lazy.pyi b/stubs/pytz/pytz/lazy.pyi new file mode 100644 index 0000000..84a7d2e --- /dev/null +++ b/stubs/pytz/pytz/lazy.pyi @@ -0,0 +1,17 @@ +from _typeshed import Incomplete +from collections.abc import Iterator, Mapping as DictMixin + +class LazyDict(DictMixin[str, Incomplete]): + data: dict[str, Incomplete] | None + def __getitem__(self, key: str) -> Incomplete: ... + def __contains__(self, key: object) -> bool: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + +class LazyList(list[Incomplete]): + # does not return `Self` type: + def __new__(cls, fill_iter: Incomplete | None = ...) -> LazyList: ... # noqa: Y034 + +class LazySet(set[Incomplete]): + # does not return `Self` type: + def __new__(cls, fill_iter: Incomplete | None = ...) -> LazySet: ... # noqa: Y034 diff --git a/stubs/pytz/pytz/reference.pyi b/stubs/pytz/pytz/reference.pyi new file mode 100644 index 0000000..cf9ceee --- /dev/null +++ b/stubs/pytz/pytz/reference.pyi @@ -0,0 +1,38 @@ +import datetime + +from pytz import UTC as UTC + +class FixedOffset(datetime.tzinfo): + def __init__(self, offset: float, name: str) -> None: ... + def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta: ... + def tzname(self, dt: datetime.datetime | None) -> str: ... + def dst(self, dt: datetime.datetime | None) -> datetime.timedelta: ... + +STDOFFSET: datetime.timedelta +DSTOFFSET: datetime.timedelta + +class LocalTimezone(datetime.tzinfo): + def utcoffset(self, dt: datetime.datetime) -> datetime.timedelta: ... # type: ignore[override] + def dst(self, dt: datetime.datetime) -> datetime.timedelta: ... # type: ignore[override] + def tzname(self, dt: datetime.datetime) -> str: ... # type: ignore[override] + +Local: LocalTimezone +DSTSTART: datetime.datetime +DSTEND: datetime.datetime + +def first_sunday_on_or_after(dt: datetime.datetime) -> datetime.datetime: ... + +class USTimeZone(datetime.tzinfo): + stdoffset: datetime.timedelta + reprname: str + stdname: str + dstname: str + def __init__(self, hours: float, reprname: str, stdname: str, dstname: str) -> None: ... + def tzname(self, dt: datetime.datetime | None) -> str: ... + def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta: ... + def dst(self, dt: datetime.datetime | None) -> datetime.timedelta: ... + +Eastern: USTimeZone +Central: USTimeZone +Mountain: USTimeZone +Pacific: USTimeZone diff --git a/stubs/pytz/pytz/tzfile.pyi b/stubs/pytz/pytz/tzfile.pyi new file mode 100644 index 0000000..db28b75 --- /dev/null +++ b/stubs/pytz/pytz/tzfile.pyi @@ -0,0 +1,5 @@ +from typing import IO + +from pytz.tzinfo import DstTzInfo + +def build_tzinfo(zone: str, fp: IO[bytes]) -> DstTzInfo: ... diff --git a/stubs/pytz/pytz/tzinfo.pyi b/stubs/pytz/pytz/tzinfo.pyi new file mode 100644 index 0000000..a744a7a --- /dev/null +++ b/stubs/pytz/pytz/tzinfo.pyi @@ -0,0 +1,39 @@ +import datetime +from abc import abstractmethod +from typing import Any, overload + +class BaseTzInfo(datetime.tzinfo): + zone: str | None # Actually None but should be set on concrete subclasses + # The following abstract methods don't exist in the implementation, but + # are implemented by all sub-classes. + @abstractmethod + def localize(self, dt: datetime.datetime) -> datetime.datetime: ... + @abstractmethod + def normalize(self, dt: datetime.datetime) -> datetime.datetime: ... + @abstractmethod + def tzname(self, dt: datetime.datetime | None) -> str: ... + @abstractmethod + def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ... + @abstractmethod + def dst(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ... + +class StaticTzInfo(BaseTzInfo): + def fromutc(self, dt: datetime.datetime) -> datetime.datetime: ... + def localize(self, dt: datetime.datetime, is_dst: bool | None = ...) -> datetime.datetime: ... + def normalize(self, dt: datetime.datetime, is_dst: bool | None = ...) -> datetime.datetime: ... + def tzname(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> str: ... + def utcoffset(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta: ... + def dst(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta: ... + +class DstTzInfo(BaseTzInfo): + def __init__(self, _inf: Any = ..., _tzinfos: Any = ...) -> None: ... + def fromutc(self, dt: datetime.datetime) -> datetime.datetime: ... + def localize(self, dt: datetime.datetime, is_dst: bool | None = ...) -> datetime.datetime: ... + def normalize(self, dt: datetime.datetime) -> datetime.datetime: ... + def tzname(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> str: ... + # https://github.com/python/mypy/issues/12379 + @overload # type: ignore[override] + def utcoffset(self, dt: None, is_dst: bool | None = ...) -> None: ... + @overload + def utcoffset(self, dt: datetime.datetime, is_dst: bool | None = ...) -> datetime.timedelta: ... + def dst(self, dt: datetime.datetime | None, is_dst: bool | None = ...) -> datetime.timedelta | None: ... diff --git a/stubs/pyvmomi/METADATA.toml b/stubs/pyvmomi/METADATA.toml index 9af5725..8c3fa4d 100644 --- a/stubs/pyvmomi/METADATA.toml +++ b/stubs/pyvmomi/METADATA.toml @@ -1,3 +1 @@ -version = "7.0" -python2 = true -requires = ["types-enum34"] +version = "7.0.*" diff --git a/stubs/pyvmomi/pyVmomi/vim/__init__.pyi b/stubs/pyvmomi/pyVmomi/vim/__init__.pyi index a06b018..4a243eb 100644 --- a/stubs/pyvmomi/pyVmomi/vim/__init__.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/__init__.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from datetime import datetime from enum import Enum from typing import Any @@ -7,7 +8,7 @@ from .event import EventManager from .option import OptionManager from .view import ViewManager -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... class ManagedObject: ... @@ -15,7 +16,7 @@ class ManagedEntity(ManagedObject): _moId: str obj: None name: str - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class ServiceInstanceContent: setting: OptionManager @@ -24,36 +25,39 @@ class ServiceInstanceContent: viewManager: ViewManager perfManager: PerformanceManager eventManager: EventManager - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class ServiceInstance: content: ServiceInstanceContent def CurrentTime(self) -> datetime: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class PerformanceManager: class MetricId: counterId: int instance: str - def __init__(self, counterId: int, instance: str): ... + def __init__(self, counterId: int, instance: str) -> None: ... + class PerfCounterInfo: key: int groupInfo: Any nameInfo: Any rollupType: Any - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... + class QuerySpec: entity: ManagedEntity metricId: list[PerformanceManager.MetricId] intervalId: int maxSample: int startTime: datetime - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... + class EntityMetricBase: entity: ManagedEntity def QueryPerfCounterByLevel(self, collection_level: int) -> list[PerformanceManager.PerfCounterInfo]: ... def QueryPerf(self, querySpec: list[PerformanceManager.QuerySpec]) -> list[PerformanceManager.EntityMetricBase]: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... class ClusterComputeResource(ManagedEntity): ... class ComputeResource(ManagedEntity): ... diff --git a/stubs/pyvmomi/pyVmomi/vim/event.pyi b/stubs/pyvmomi/pyVmomi/vim/event.pyi index 4a422e3..92bb939 100644 --- a/stubs/pyvmomi/pyVmomi/vim/event.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/event.pyi @@ -1,14 +1,14 @@ +from _typeshed import Incomplete from datetime import datetime -from typing import Any -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... class Event: createdTime: datetime class EventFilterSpec: class ByTime: - def __init__(self, beginTime: datetime): ... + def __init__(self, beginTime: datetime) -> None: ... time: EventFilterSpec.ByTime class EventManager: diff --git a/stubs/pyvmomi/pyVmomi/vim/fault.pyi b/stubs/pyvmomi/pyVmomi/vim/fault.pyi index 80a1dac..35be404 100644 --- a/stubs/pyvmomi/pyVmomi/vim/fault.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/fault.pyi @@ -1,6 +1,6 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... class InvalidName(Exception): ... class RestrictedByAdministrator(Exception): ... diff --git a/stubs/pyvmomi/pyVmomi/vim/option.pyi b/stubs/pyvmomi/pyVmomi/vim/option.pyi index da6e053..0c7b592 100644 --- a/stubs/pyvmomi/pyVmomi/vim/option.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/option.pyi @@ -1,9 +1,11 @@ +from _typeshed import Incomplete from typing import Any -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... class OptionManager: def QueryOptions(self, name: str) -> list[OptionValue]: ... class OptionValue: value: Any + key: str diff --git a/stubs/pyvmomi/pyVmomi/vim/view.pyi b/stubs/pyvmomi/pyVmomi/vim/view.pyi index c00ad51..dbb397b 100644 --- a/stubs/pyvmomi/pyVmomi/vim/view.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/view.pyi @@ -1,8 +1,8 @@ -from typing import Any, Type +from _typeshed import Incomplete from pyVmomi.vim import ManagedEntity -def __getattr__(name: str) -> Any: ... # incomplete +def __getattr__(name: str) -> Incomplete: ... class ContainerView: def Destroy(self) -> None: ... @@ -12,4 +12,4 @@ class ViewManager: # but in practice it seems to be `list[Type[ManagedEntity]]` # Source: https://pubs.vmware.com/vi-sdk/visdk250/ReferenceGuide/vim.view.ViewManager.html @staticmethod - def CreateContainerView(container: ManagedEntity, type: list[Type[ManagedEntity]], recursive: bool) -> ContainerView: ... + def CreateContainerView(container: ManagedEntity, type: list[type[ManagedEntity]], recursive: bool) -> ContainerView: ... diff --git a/stubs/pyvmomi/pyVmomi/vmodl/__init__.pyi b/stubs/pyvmomi/pyVmomi/vmodl/__init__.pyi index 9aff822..cf469c1 100644 --- a/stubs/pyvmomi/pyVmomi/vmodl/__init__.pyi +++ b/stubs/pyvmomi/pyVmomi/vmodl/__init__.pyi @@ -1,6 +1,27 @@ from typing import Any +from .fault import * +from .query import * + +class DynamicData: ... + class DynamicProperty: def __init__(self, *, name: str = ..., val: Any = ...) -> None: ... name: str val: Any + +class ManagedObject: ... + +class KeyAnyValue(DynamicData): + key: str + value: Any + +class LocalizableMessage(DynamicData): + key: str + arg: list[KeyAnyValue] | None + message: str | None + +class MethodFault(DynamicData, Exception): + msg: str | None + faultCause: MethodFault | None + faultMessage: list[LocalizableMessage] | None diff --git a/stubs/pyvmomi/pyVmomi/vmodl/fault.pyi b/stubs/pyvmomi/pyVmomi/vmodl/fault.pyi index 3876a51..8aac5d5 100644 --- a/stubs/pyvmomi/pyVmomi/vmodl/fault.pyi +++ b/stubs/pyvmomi/pyVmomi/vmodl/fault.pyi @@ -1,5 +1,10 @@ -from typing import Any +from _typeshed import Incomplete -def __getattr__(name: str) -> Any: ... # incomplete +from pyVmomi.vmodl import ManagedObject + +def __getattr__(name: str) -> Incomplete: ... class InvalidArgument(Exception): ... + +class ManagedObjectNotFound(Exception): + obj: ManagedObject diff --git a/stubs/pyvmomi/pyVmomi/vmodl/query.pyi b/stubs/pyvmomi/pyVmomi/vmodl/query.pyi index 89f2769..d9c464c 100644 --- a/stubs/pyvmomi/pyVmomi/vmodl/query.pyi +++ b/stubs/pyvmomi/pyVmomi/vmodl/query.pyi @@ -1,4 +1,5 @@ -from typing import Any, Type +from _typeshed import Incomplete +from typing import Any from pyVmomi.vim import ManagedEntity from pyVmomi.vim.view import ContainerView @@ -6,21 +7,24 @@ from pyVmomi.vmodl import DynamicProperty class PropertyCollector: class PropertySpec: - def __init__(self, *, all: bool = ..., type: Type[ManagedEntity] = ..., pathSet: list[str] = ...) -> None: ... + def __init__(self, *, all: bool = ..., type: type[ManagedEntity] = ..., pathSet: list[str] = ...) -> None: ... all: bool - type: Type[ManagedEntity] + type: type[ManagedEntity] pathSet: list[str] + class TraversalSpec: def __init__( - self, *, path: str = ..., skip: bool = ..., type: Type[ContainerView] = ..., **kwargs: Any # incomplete + self, *, path: str = ..., skip: bool = ..., type: type[ContainerView] = ..., **kwargs: Incomplete ) -> None: ... path: str skip: bool - type: Type[ContainerView] - def __getattr__(self, name: str) -> Any: ... # incomplete + type: type[ContainerView] + def __getattr__(self, name: str) -> Incomplete: ... + class RetrieveOptions: - def __init__(self, *, maxObjects: int) -> None: ... - maxObjects: int + def __init__(self, *, maxObjects: int | None = ...) -> None: ... + maxObjects: int | None + class ObjectSpec: def __init__( self, *, skip: bool = ..., selectSet: list[PropertyCollector.TraversalSpec] = ..., obj: Any = ... @@ -28,24 +32,25 @@ class PropertyCollector: skip: bool selectSet: list[PropertyCollector.TraversalSpec] obj: Any + class FilterSpec: def __init__( self, *, propSet: list[PropertyCollector.PropertySpec] = ..., objectSet: list[PropertyCollector.ObjectSpec] = ..., - **kwargs: Any, # incomplete + **kwargs: Incomplete, ) -> None: ... propSet: list[PropertyCollector.PropertySpec] objectSet: list[PropertyCollector.ObjectSpec] - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... + class ObjectContent: - def __init__( - self, *, obj: ManagedEntity = ..., propSet: list[DynamicProperty] = ..., **kwargs: Any # incomplete - ) -> None: ... + def __init__(self, *, obj: ManagedEntity = ..., propSet: list[DynamicProperty] = ..., **kwargs: Incomplete) -> None: ... obj: ManagedEntity propSet: list[DynamicProperty] - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... + class RetrieveResult: def __init__(self, *, objects: list[PropertyCollector.ObjectContent] = ..., token: str | None = ...) -> None: ... objects: list[PropertyCollector.ObjectContent] @@ -54,4 +59,4 @@ class PropertyCollector: self, specSet: list[PropertyCollector.FilterSpec], options: PropertyCollector.RetrieveOptions ) -> PropertyCollector.RetrieveResult: ... def ContinueRetrievePropertiesEx(self, token: str) -> PropertyCollector.RetrieveResult: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def __getattr__(self, name: str) -> Incomplete: ... diff --git a/stubs/pywin32/@tests/stubtest_allowlist.txt b/stubs/pywin32/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..20fe051 --- /dev/null +++ b/stubs/pywin32/@tests/stubtest_allowlist.txt @@ -0,0 +1,75 @@ +# Not available at runtime. Contains type definitions that are otherwise not exposed +_win32typing +win32com(ext)?.mapi._exchdapi +win32._wincerapi +# PyWin tool / debugger +pythonwin.pywin.* +win32com.client.combrowse +win32com.client.tlbrowse +# Utilities to generate python bindings +win32com.client.build +win32com.client.CLSIDToClass +win32com.client.connect +# Necessary for mypy to not throw AssertionError +win32com.client.dynamic.* +win32com.client.gencache +win32com.client.genpy +win32com.client.makepy +win32com.client.selecttlb +win32com.client.util +win32com.makegw.* +# COM object servers scripts +win32com.server.factory +win32com.server.localserver +win32com.server.register +win32com.servers.* +# Active X Scripts +win32com(ext)?.axscript.client.framework +win32com(ext)?.axscript.client.pyscript_rexec +# Necessary for mypy to not fail +win32com(ext)?.axscript.client.pyscript.* +win32com(ext)?.axscript.client.scriptdispatch +# Other scripts +isapi.install +win32.scripts.* +win32.lib.netbios +win32.lib.sspi +win32.lib.win32pdhutil +win32.lib.win32rcparser +win32.lib.win32serviceutil +win32.lib.win32traceutil +win32.lib.verstamp +# Demos, tests and debugging +win32.lib.pywin32_testutil +win32.lib.rasutil +win32com.demos.* +win32com.servers.test_pycomtest +win32com.test.* +win32com(ext)?.axdebug.codecontainer +win32com(ext)?.axdebug.dump +win32com(ext)?.axdebug.debugger +win32com(ext)?.axscript.client.pydumper +win32com(ext)?.directsound.test.* +# Deprecated and obsolete +pythoncom.MakeIID +pythoncom.MakeTime +win32.lib.dbi +win32.lib.win32pdhquery.Query.addperfcounter +# Deprecated and makes a buffer of random junk. Use something like `b"\x00" * bufferSize` instead +win32.win32gui.PyMakeBuffer +# Also a script +win32.lib.regcheck +# failed to import, ImportError: DLL load failed while importing axdebug: The specified module could not be found. +# https://github.com/python/mypy/issues/13822 +win32com.axdebug.axdebug +win32com(ext)?.axdebug.adb +win32com(ext)?.axdebug.codecontainer +# failed to import, SystemError: CoInternetCreateSecurityManager() method: bad call flags +win32com(ext)?.internet.internet +# failed to import, ModuleNotFoundError: No module named '...' +win32com(ext)?.axdebug.contexts +win32com(ext)?.axdebug.debugger +win32com(ext)?.axdebug.documents +win32com(ext)?.axdebug.expressions +win32com(ext)?.axdebug.stackframe +win32com(ext)?.axscript.client.debug diff --git a/stubs/pywin32/METADATA.toml b/stubs/pywin32/METADATA.toml new file mode 100644 index 0000000..667c0ad --- /dev/null +++ b/stubs/pywin32/METADATA.toml @@ -0,0 +1,9 @@ +version = "304.*" +[tool.stubtest] +# The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI. +# See #8660 +skip = true +# This crashes stubtest. It should be fixed in next mypy update +# (keeping it since we currently skip the stub anyway) +# https://github.com/python/mypy/issues/13822 +ignore_missing_stub = false diff --git a/stubs/pywin32/_win32typing.pyi b/stubs/pywin32/_win32typing.pyi new file mode 100644 index 0000000..63ccbb0 --- /dev/null +++ b/stubs/pywin32/_win32typing.pyi @@ -0,0 +1,6083 @@ +# Not available at runtime. Contains type definitions that are otherwise not exposed and not part of a specific module. +from _typeshed import Incomplete +from typing_extensions import final + +class ArgNotFound: ... +class PyOleEmpty: ... +class PyOleMissing: ... +class PyOleNothing: ... + +class PyDSCAPSType: + @property + def dwFlags(self): ... + @property + def dwFreeHw3DAllBuffers(self): ... + @property + def dwFreeHw3DStaticBuffers(self): ... + @property + def dwFreeHw3DStreamingBuffers(self): ... + @property + def dwFreeHwMemBytes(self): ... + @property + def dwFreeHwMixingAllBuffers(self): ... + @property + def dwFreeHwMixingStaticBuffers(self): ... + @property + def dwFreeHwMixingStreamingBuffers(self): ... + @property + def dwMaxContigFreeHwMemBytes(self): ... + @property + def dwMaxHw3DAllBuffers(self): ... + @property + def dwMaxHw3DStaticBuffers(self): ... + @property + def dwMaxHw3DStreamingBuffers(self): ... + @property + def dwMaxHwMixingAllBuffers(self): ... + @property + def dwMaxHwMixingStaticBuffers(self): ... + @property + def dwMaxHwMixingStreamingBuffers(self): ... + @property + def dwMaxSecondarySampleRate(self): ... + @property + def dwMinSecondarySampleRate(self): ... + @property + def dwPlayCpuOverheadSwBuffers(self): ... + @property + def dwPrimaryBuffers(self): ... + @property + def dwTotalHwMemBytes(self): ... + @property + def dwUnlockTransferRateHwBuffers(self): ... + +class PyDSCBCAPSType: + @property + def dwBufferBytes(self): ... + @property + def dwFlags(self): ... + +class PyDSCCAPSType: + @property + def dwChannels(self): ... + @property + def dwFlags(self): ... + @property + def dwFormats(self): ... + +@final +class PyNCB: + @property + def Bufflen(self): ... + @property + def Callname(self): ... + @property + def Cmd_cplt(self): ... + @property + def Command(self): ... + @property + def Event(self): ... + @property + def Lana_num(self): ... + @property + def Lsn(self): ... + @property + def Name(self): ... + @property + def Num(self): ... + @property + def Post(self): ... + def Reset(self, *args, **kwargs): ... # incomplete + @property + def Retcode(self): ... + @property + def Rto(self): ... + @property + def Sto(self): ... + +class COMMTIMEOUTS: ... +class CopyProgressRoutine: ... + +class DOCINFO: + @property + def DocName(self) -> str: ... + @property + def Output(self) -> str: ... + @property + def DataType(self) -> str: ... + @property + def Type(self): ... + +class ExportCallback: ... + +class FORM_INFO_1: + @property + def Flags(self): ... + @property + def Name(self) -> str: ... + @property + def Size(self): ... + @property + def ImageableArea(self): ... + +class ImportCallback: ... +class LARGE_INTEGER: ... + +class NCB: + @property + def Command(self): ... + @property + def Retcode(self): ... + @property + def Lsn(self): ... + @property + def Num(self): ... + @property + def Bufflen(self): ... + @property + def Callname(self) -> str: ... + @property + def Name(self) -> str: ... + @property + def Rto(self) -> str: ... + @property + def Sto(self) -> str: ... + @property + def Lana_num(self): ... + @property + def Cmd_cplt(self): ... + @property + def Event(self): ... + @property + def Post(self): ... + +class PRINTER_DEFAULTS: + @property + def pDatatype(self) -> str: ... + @property + def pDevMode(self) -> PyDEVMODE: ... + @property + def DesiredAccess(self): ... + +class PyACL: + def Initialize(self) -> None: ... + def IsValid(self) -> bool: ... + def AddAccessAllowedAce(self, revision, access, sid: PySID, access1, sid1) -> None: ... + def AddAccessAllowedAceEx(self, revision, aceflags, access, sid: PySID) -> None: ... + def AddAccessAllowedObjectAce( + self, AceRevision, AceFlags, AccessMask, ObjectTypeGuid: PyIID, InheritedObjectTypeGuid: PyIID, sid: PySID + ) -> None: ... + def AddAccessDeniedAce(self, revision, access, sid: PySID, access1, sid1) -> None: ... + def AddAccessDeniedAceEx(self, revision, aceflags, access, sid: PySID) -> None: ... + def AddMandatoryAce(self, AceRevision, AceFlags, MandatoryPolicy, LabelSid: PySID) -> None: ... + def AddAuditAccessAce(self, dwAceRevision, dwAccessMask, sid: PySID, bAuditSuccess, bAuditFailure) -> None: ... + def AddAuditAccessAceEx(self, dwAceRevision, AceFlags, dwAccessMask, sid: PySID, bAuditSuccess, bAuditFailure) -> None: ... + def AddAuditAccessObjectAce( + self, + dwAceRevision, + AceFlags, + dwAccessMask, + ObjectTypeGuid: PyIID, + InheritedObjectTypeGuid: PyIID, + sid: PySID, + bAuditSuccess, + bAuditFailure, + ) -> None: ... + def GetAclSize(self): ... + def GetAclRevision(self): ... + def GetAceCount(self): ... + def GetAce(self, index): ... + def DeleteAce(self, index) -> None: ... + def GetEffectiveRightsFromAcl(self, trustee: PyTRUSTEE): ... + def GetAuditedPermissionsFromAcl(self, trustee: PyTRUSTEE) -> tuple[Incomplete, Incomplete]: ... + +class PyBITMAP: + @property + def bmType(self) -> int: ... + @property + def bmWidth(self) -> int: ... + @property + def bmHeight(self) -> int: ... + @property + def bmWidthBytes(self) -> int: ... + @property + def bmPlanes(self) -> int: ... + +class PyBLENDFUNCTION: ... +class PyCEHANDLE: ... + +class PyCERTSTORE: + @property + def HCERTSTORE(self): ... + def CertCloseStore(self, Flags: int = ...) -> None: ... + def CertControlStore(self, Flags, CtrlType, CtrlPara: int) -> None: ... + def CertEnumCertificatesInStore(self) -> list[PyCERT_CONTEXT]: ... + def CertEnumCTLsInStore(self) -> list[PyCTL_CONTEXT]: ... + def CertSaveStore(self, MsgAndCertEncodingType, SaveAs, SaveTo, SaveToPara: str | int, Flags=...) -> None: ... + def CertAddEncodedCertificateToStore(self, CertEncodingType, CertEncoded, AddDisposition) -> PyCERT_CONTEXT: ... + def CertAddCertificateContextToStore(self, CertContext: PyCERT_CONTEXT, AddDisposition) -> PyCERT_CONTEXT: ... + def CertAddCertificateLinkToStore(self, CertContext: PyCERT_CONTEXT, AddDisposition) -> PyCERT_CONTEXT: ... + def CertAddCTLContextToStore(self, CtlContext: PyCTL_CONTEXT, AddDisposition) -> PyCTL_CONTEXT: ... + def CertAddCTLLinkToStore(self, CtlContext: PyCTL_CONTEXT, AddDisposition) -> PyCTL_CONTEXT: ... + def CertAddStoreToCollection(self, SiblingStore: PyCERTSTORE, UpdateFlag: int = ..., Priority: int = ...) -> None: ... + def CertRemoveStoreFromCollection(self, SiblingStore: PyCERTSTORE) -> None: ... + def PFXExportCertStoreEx(self, Flags, Password: Incomplete | None = ...): ... + +class PyCERT_ALT_NAME_ENTRY: ... +class PyCERT_ALT_NAME_INFO: ... + +class PyCERT_AUTHORITY_KEY_ID_INFO: + @property + def KeyId(self): ... + @property + def CertIssuer(self): ... + @property + def CertSerialNumber(self): ... + +class PyCERT_BASIC_CONSTRAINTS2_INFO: + @property + def fCA(self): ... + @property + def fPathLenConstraint(self): ... + @property + def PathLenConstraint(self): ... + +class PyCERT_BASIC_CONSTRAINTS_INFO: + @property + def SubjectType(self) -> PyCRYPT_BIT_BLOB: ... + @property + def fPathLenConstraint(self): ... + @property + def PathLenConstraint(self): ... + @property + def SubtreesConstraint(self): ... + +class PyCERT_CONTEXT: + @property + def HANDLE(self): ... + @property + def CertStore(self) -> PyCERTSTORE: ... + @property + def CertEncoded(self): ... + @property + def CertEncodingType(self): ... + @property + def Version(self): ... + @property + def Subject(self) -> str: ... + @property + def Issuer(self) -> str: ... + @property + def NotBefore(self) -> PyTime: ... + @property + def NotAfter(self) -> PyTime: ... + @property + def SignatureAlgorithm(self): ... + @property + def Extension(self) -> tuple[PyCERT_EXTENSION, ...]: ... + @property + def SubjectPublicKeyInfo(self) -> PyCERT_PUBLIC_KEY_INFO: ... + @property + def SerialNumber(self): ... + def CertFreeCertificateContext(self) -> None: ... + def CertEnumCertificateContextProperties(self) -> list[Incomplete]: ... + def CryptAcquireCertificatePrivateKey(self, Flags: int = ...) -> tuple[Incomplete, PyCRYPTPROV]: ... + def CertGetIntendedKeyUsage(self): ... + def CertGetEnhancedKeyUsage(self, Flags: int = ...): ... + def CertSerializeCertificateStoreElement(self, Flags: int = ...) -> str: ... + def CertVerifySubjectCertificateContext(self, Issuer: PyCERT_CONTEXT, Flags): ... + def CertDeleteCertificateFromStore(self) -> None: ... + def CertGetCertificateContextProperty(self, PropId): ... + def CertSetCertificateContextProperty(self, PropId, Data, Flags: int = ...) -> None: ... + +class PyCERT_EXTENSION: + @property + def ObjId(self): ... + @property + def Critical(self): ... + @property + def Value(self): ... + +class PyCERT_KEY_ATTRIBUTES_INFO: + @property + def KeyId(self): ... + @property + def IntendedKeyUsage(self) -> PyCRYPT_BIT_BLOB: ... + @property + def PrivateKeyUsagePeriod(self): ... + +class PyCERT_NAME_INFO: ... +class PyCERT_NAME_VALUE: ... +class PyCERT_OTHER_NAME: ... + +class PyCERT_POLICY_INFO: + @property + def PolicyIdentifier(self): ... + @property + def PolicyQualifier(self): ... + +class PyCERT_PUBLIC_KEY_INFO: + @property + def Algorithm(self) -> PyCRYPT_ALGORITHM_IDENTIFIER: ... + @property + def PublicKey(self) -> PyCRYPT_BIT_BLOB: ... + +class PyCOMSTAT: + @property + def cbInQue(self) -> int: ... + @property + def cbOutQue(self) -> int: ... + @property + def fCtsHold(self) -> int: ... + @property + def fDsrHold(self) -> int: ... + @property + def fRlsdHold(self) -> int: ... + @property + def fXoffHold(self) -> int: ... + @property + def fXoffSent(self) -> int: ... + @property + def fEof(self) -> int: ... + @property + def fTxim(self) -> int: ... + @property + def fReserved(self) -> int: ... + +@final +class PyCOORD: + @property + def X(self): ... + @property + def Y(self): ... + +class PyCREDENTIAL: + @property + def Flags(self): ... + @property + def Type(self): ... + @property + def TargetName(self) -> str: ... + @property + def Comment(self) -> str: ... + @property + def LastWritten(self) -> PyTime: ... + @property + def CredentialBlob(self) -> str: ... + @property + def Persist(self): ... + @property + def Attributes(self): ... + @property + def TargetAlias(self) -> str: ... + @property + def UserName(self) -> str: ... + +class PyCREDENTIAL_ATTRIBUTE: + @property + def Keyword(self) -> str: ... + @property + def Flags(self): ... + @property + def Value(self): ... + +class PyCREDENTIAL_TARGET_INFORMATION: + @property + def TargetName(self) -> str: ... + @property + def NetbiosServerName(self) -> str: ... + @property + def DnsServerName(self) -> str: ... + @property + def NetbiosDomainName(self) -> str: ... + @property + def DnsDomainName(self) -> str: ... + @property + def DnsTreeName(self) -> str: ... + @property + def PackageName(self) -> str: ... + @property + def Flags(self): ... + @property + def CredTypes(self) -> tuple[Incomplete, ...]: ... + +class PyCREDUI_INFO: + @property + def Parent(self) -> int: ... + @property + def MessageText(self) -> str: ... + @property + def CaptionText(self) -> str: ... + @property + def Banner(self) -> int: ... + +class PyCRYPTHASH: + def CryptDestroyHash(self) -> None: ... + def CryptDuplicateHash(self, Flags: int = ...) -> PyCRYPTHASH: ... + def CryptHashData(self, Data: str, Flags: int = ...) -> None: ... + def CryptHashSessionKey(self, Key: PyCRYPTKEY, Flags: int = ...) -> None: ... + def CryptSignHash(self, KeySpec, Flags: int = ...) -> str: ... + def CryptVerifySignature(self, Signature: str, PubKey: PyCRYPTKEY, Flags: int = ...) -> None: ... + def CryptGetHashParam(self, Param, Flags: int = ...): ... + +class PyCRYPTKEY: + @property + def HCRYPTPROV(self): ... + @property + def HCRYPTKEY(self): ... + def CryptDestroyKey(self) -> None: ... + def CryptExportKey(self, ExpKey: PyCRYPTKEY, BlobType, Flags: int = ...): ... + def CryptGetKeyParam(self, Param, Flags: int = ...): ... + def CryptDuplicateKey(self, Reserved: int = ..., Flags: int = ...) -> PyCRYPTKEY: ... + def CryptEncrypt(self, Final, Data, Hash: PyCRYPTHASH | None = ..., Flags: int = ...): ... + def CryptDecrypt(self, Final, Data, Hash: PyCRYPTHASH | None = ..., Flags: int = ...): ... + +class PyCRYPTMSG: + @property + def HCRYPTMSG(self): ... + def CryptMsgClose(self) -> None: ... + +class PyCRYPTPROTECT_PROMPTSTRUCT: ... + +class PyCRYPTPROV: + def CryptReleaseContext(self, Flags: int = ...) -> None: ... + def CryptGenKey(self, Algid, Flags, KeyLen: int = ...) -> PyCRYPTKEY: ... + def CryptGetProvParam(self, Param, Flags: int = ...) -> None: ... + def CryptGetUserKey(self, KeySpec) -> PyCRYPTKEY: ... + def CryptGenRandom(self, Len, SeedData: str | None = ...) -> str: ... + def CryptCreateHash(self, Algid, Key: PyCRYPTKEY | None = ..., Flags: int = ...) -> PyCRYPTHASH: ... + def CryptImportKey(self, Data, PubKey: PyCRYPTKEY | None = ..., Flags: int = ...) -> PyCRYPTKEY: ... + def CryptExportPublicKeyInfo(self, KeySpec, CertEncodingType) -> PyCERT_PUBLIC_KEY_INFO: ... + def CryptImportPublicKeyInfo(self, Info, CertEncodingType) -> PyCRYPTKEY: ... + +class PyCRYPT_ALGORITHM_IDENTIFIER: + @property + def ObjId(self): ... + @property + def Parameters(self): ... + +class PyCRYPT_ATTRIBUTE: + @property + def ObjId(self): ... + @property + def Value(self) -> tuple[Incomplete, ...]: ... + +class PyCRYPT_BIT_BLOB: + @property + def Data(self): ... + @property + def UnusedBits(self): ... + +class PyCRYPT_DECRYPT_MESSAGE_PARA: + @property + def CertStores(self) -> tuple[Incomplete, ...]: ... + @property + def MsgAndCertEncodingType(self): ... + @property + def Flags(self): ... + +class PyCRYPT_ENCRYPT_MESSAGE_PARA: + @property + def ContentEncryptionAlgorithm(self) -> PyCRYPT_ALGORITHM_IDENTIFIER: ... + @property + def CryptProv(self) -> PyCRYPTPROV: ... + @property + def EncryptionAuxInfo(self): ... + @property + def Flags(self): ... + @property + def InnerContentType(self): ... + @property + def MsgEncodingType(self): ... + +class PyCRYPT_SIGN_MESSAGE_PARA: + @property + def SigningCert(self) -> PyCERT_CONTEXT: ... + @property + def HashAlgorithm(self) -> PyCRYPT_ALGORITHM_IDENTIFIER: ... + @property + def HashAuxInfo(self): ... + @property + def MsgCert(self) -> tuple[PyCERT_CONTEXT, ...]: ... + @property + def MsgCrl(self) -> tuple[Incomplete, ...]: ... + @property + def AuthAttr(self) -> tuple[PyCRYPT_ATTRIBUTE, ...]: ... + @property + def UnauthAttr(self) -> tuple[PyCRYPT_ATTRIBUTE, ...]: ... + @property + def Flags(self): ... + @property + def InnerContentType(self): ... + @property + def MsgEncodingType(self): ... + +class PyCRYPT_VERIFY_MESSAGE_PARA: + @property + def MsgAndCertEncodingType(self): ... + @property + def CryptProv(self) -> PyCRYPTPROV: ... + @property + def PyGetSignerCertificate(self): ... + @property + def GetArg(self): ... + +class PyCTL_CONTEXT: + @property + def HCTL_CONTEXT(self): ... + def CertFreeCTLContext(self) -> None: ... + def CertEnumCTLContextProperties(self) -> tuple[Incomplete, ...]: ... + def CertEnumSubjectInSortedCTL(self) -> tuple[tuple[Incomplete, Incomplete], ...]: ... + def CertDeleteCTLFromStore(self) -> None: ... + def CertSerializeCTLStoreElement(self, Flags: int = ...) -> str: ... + +class PyCTL_USAGE: ... + +@final +class PyConsoleScreenBuffer: + def SetConsoleActiveScreenBuffer(self) -> None: ... + def GetConsoleCursorInfo(self) -> tuple[Incomplete, Incomplete]: ... + def SetConsoleCursorInfo(self, Size, Visible) -> None: ... + def GetConsoleMode(self): ... + def SetConsoleMode(self, Mode) -> None: ... + def ReadConsole(self, NumberOfCharsToRead): ... + def WriteConsole(self, Buffer): ... + def FlushConsoleInputBuffer(self) -> None: ... + def SetConsoleTextAttribute(self, Attributes) -> None: ... + def SetConsoleCursorPosition(self, CursorPosition: PyCOORD) -> None: ... + def SetConsoleScreenBufferSize(self, Size: PyCOORD) -> None: ... + def SetConsoleWindowInfo(self, Absolute, ConsoleWindow: PySMALL_RECT) -> None: ... + def GetConsoleScreenBufferInfo(self): ... + def GetLargestConsoleWindowSize(self) -> PyCOORD: ... + def FillConsoleOutputAttribute(self, Attribute, Length, WriteCoord: PyCOORD): ... + def FillConsoleOutputCharacter(self, Character, Length, WriteCoord: PyCOORD): ... + def ReadConsoleOutputCharacter(self, Length, ReadCoord: PyCOORD) -> str: ... + def ReadConsoleOutputAttribute(self, Length, ReadCoord: PyCOORD) -> tuple[Incomplete, ...]: ... + def WriteConsoleOutputCharacter(self, Characters, WriteCoord: PyCOORD): ... + def WriteConsoleOutputAttribute(self, Attributes: tuple[Incomplete, ...], WriteCoord: PyCOORD): ... + def ScrollConsoleScreenBuffer( + self, ScrollRectangle: PySMALL_RECT, ClipRectangle: PySMALL_RECT, DestinationOrigin: PyCOORD, FillCharacter, FillAttribute + ) -> None: ... + def GetCurrentConsoleFont(self, MaximumWindow: bool = ...) -> tuple[Incomplete, PyCOORD]: ... + def GetConsoleFontSize(self, Font) -> PyCOORD: ... + def SetConsoleFont(self, Font) -> None: ... + def SetStdHandle(self, StdHandle) -> None: ... + def SetConsoleDisplayMode(self, Flags, NewScreenBufferDimensions: PyCOORD) -> None: ... + def WriteConsoleInput(self, Buffer: tuple[PyINPUT_RECORD, ...]): ... + def ReadConsoleInput(self, Length) -> tuple[PyINPUT_RECORD, ...]: ... + def PeekConsoleInput(self, Length) -> tuple[PyINPUT_RECORD, ...]: ... + def GetNumberOfConsoleInputEvents(self): ... + def Close(self, *args, **kwargs): ... # incomplete + def Detach(self, *args, **kwargs): ... # incomplete + +class PyCredHandle: + def Detach(self): ... + def FreeCredentialsHandle(self) -> None: ... + def QueryCredentialsAttributes(self, Attribute) -> None: ... + +class PyCtxtHandle: + def Detach(self): ... + def CompleteAuthToken(self, Token: PySecBufferDesc) -> None: ... + def QueryContextAttributes(self, Attribute) -> None: ... + def DeleteSecurityContext(self) -> None: ... + def QuerySecurityContextToken(self): ... + def MakeSignature(self, fqop, Message: PySecBufferDesc, MessageSeqNo) -> None: ... + def VerifySignature(self, Message: PySecBufferDesc, MessageSeqNo) -> None: ... + def EncryptMessage(self, fqop, Message: PySecBufferDesc, MessageSeqNo) -> None: ... + def DecryptMessage(self, Message: PySecBufferDesc, MessageSeqNo) -> None: ... + def ImpersonateSecurityContext(self) -> None: ... + def RevertSecurityContext(self) -> None: ... + +class PyDCB: + @property + def BaudRate(self) -> int: ... + @property + def wReserved(self) -> int: ... + @property + def XonLim(self) -> int: ... + @property + def XoffLim(self) -> int: ... + @property + def ByteSize(self) -> int: ... + @property + def Parity(self) -> int: ... + @property + def StopBits(self) -> int: ... + @property + def XonChar(self) -> str: ... + @property + def XoffChar(self) -> str: ... + @property + def ErrorChar(self) -> str: ... + @property + def EofChar(self) -> str: ... + @property + def EvtChar(self) -> str: ... + @property + def wReserved1(self) -> int: ... + @property + def fBinary(self) -> int: ... + @property + def fParity(self) -> int: ... + @property + def fOutxCtsFlow(self) -> int: ... + @property + def fOutxDsrFlow(self) -> int: ... + @property + def fDtrControl(self) -> int: ... + @property + def fDsrSensitivity(self) -> int: ... + @property + def fTXContinueOnXoff(self) -> int: ... + @property + def fOutX(self) -> int: ... + @property + def fInX(self) -> int: ... + @property + def fErrorChar(self) -> int: ... + @property + def fNull(self) -> int: ... + @property + def fRtsControl(self) -> int: ... + @property + def fAbortOnError(self) -> int: ... + @property + def fDummy2(self) -> int: ... + +class PyDEVMODE: + @property + def SpecVersion(self) -> int: ... + @property + def DriverVersion(self) -> int: ... + @property + def Size(self) -> int: ... + @property + def DriverExtra(self) -> int: ... + @property + def Fields(self) -> int: ... + @property + def Orientation(self) -> int: ... + @property + def PaperSize(self) -> int: ... + @property + def PaperLength(self) -> int: ... + @property + def PaperWidth(self) -> int: ... + @property + def Position_x(self) -> int: ... + @property + def Position_y(self) -> int: ... + @property + def DisplayOrientation(self) -> int: ... + @property + def DisplayFixedOutput(self) -> int: ... + @property + def Scale(self) -> int: ... + @property + def Copies(self) -> int: ... + @property + def DefaultSource(self) -> int: ... + @property + def PrintQuality(self) -> int: ... + @property + def Color(self) -> int: ... + @property + def Duplex(self) -> int: ... + @property + def YResolution(self) -> int: ... + @property + def TTOption(self) -> int: ... + @property + def Collate(self) -> int: ... + @property + def LogPixels(self) -> int: ... + @property + def BitsPerPel(self) -> int: ... + @property + def PelsWidth(self) -> int: ... + @property + def PelsHeight(self) -> int: ... + @property + def DisplayFlags(self) -> int: ... + @property + def DisplayFrequency(self) -> int: ... + @property + def ICMMethod(self) -> int: ... + @property + def ICMIntent(self) -> int: ... + @property + def MediaType(self) -> int: ... + @property + def DitherType(self) -> int: ... + @property + def Reserved1(self) -> int: ... + @property + def Reserved2(self) -> int: ... + @property + def Nup(self) -> int: ... + @property + def PanningWidth(self) -> int: ... + @property + def PanningHeight(self) -> int: ... + @property + def DeviceName(self) -> str: ... + @property + def FormName(self) -> str: ... + @property + def DriverData(self) -> Incomplete | None: ... + def Clear(self) -> None: ... + +class PyDEVMODEW: + @property + def SpecVersion(self) -> int: ... + @property + def DriverVersion(self) -> int: ... + @property + def Size(self) -> int: ... + @property + def DriverExtra(self) -> int: ... + @property + def Fields(self) -> int: ... + @property + def Orientation(self) -> int: ... + @property + def PaperSize(self) -> int: ... + @property + def PaperLength(self) -> int: ... + @property + def PaperWidth(self) -> int: ... + @property + def Position_x(self) -> int: ... + @property + def Position_y(self) -> int: ... + @property + def DisplayOrientation(self) -> int: ... + @property + def DisplayFixedOutput(self) -> int: ... + @property + def Scale(self) -> int: ... + @property + def Copies(self) -> int: ... + @property + def DefaultSource(self) -> int: ... + @property + def PrintQuality(self) -> int: ... + @property + def Color(self) -> int: ... + @property + def Duplex(self) -> int: ... + @property + def YResolution(self) -> int: ... + @property + def TTOption(self) -> int: ... + @property + def Collate(self) -> int: ... + @property + def LogPixels(self) -> int: ... + @property + def BitsPerPel(self) -> int: ... + @property + def PelsWidth(self) -> int: ... + @property + def PelsHeight(self) -> int: ... + @property + def DisplayFlags(self) -> int: ... + @property + def DisplayFrequency(self) -> int: ... + @property + def ICMMethod(self) -> int: ... + @property + def ICMIntent(self) -> int: ... + @property + def MediaType(self) -> int: ... + @property + def DitherType(self) -> int: ... + @property + def Reserved1(self) -> int: ... + @property + def Reserved2(self) -> int: ... + @property + def Nup(self) -> int: ... + @property + def PanningWidth(self) -> int: ... + @property + def PanningHeight(self) -> int: ... + @property + def DeviceName(self) -> str: ... + @property + def FormName(self) -> str: ... + @property + def DriverData(self) -> Incomplete | None: ... + +class PyDISPLAY_DEVICE: + @property + def Size(self) -> int: ... + @property + def DeviceName(self) -> str: ... + @property + def DeviceString(self) -> str: ... + @property + def StateFlags(self) -> int: ... + @property + def DeviceID(self) -> str: ... + @property + def DeviceKey(self) -> str: ... + def Clear(self) -> None: ... + +class PyDLGITEMTEMPLATE: ... +class PyDLGTEMPLATE: ... +class PyDS_HANDLE: ... +class PyDS_NAME_RESULT_ITEM: ... + +class PyDateTime: + def Format(self): ... + +class PyDialogTemplate: ... +class PyEVTLOG_HANDLE: ... +class PyEVT_HANDLE: ... +class PyEVT_RPC_LOGIN: ... + +class PyEventLogRecord: + @property + def Reserved(self) -> int: ... + @property + def RecordNumber(self) -> int: ... + @property + def TimeGenerated(self) -> PyTime: ... + @property + def TimeWritten(self) -> PyTime: ... + @property + def EventID(self) -> int: ... + @property + def EventType(self) -> int: ... + @property + def EventCategory(self) -> int: ... + @property + def ReservedFlags(self) -> int: ... + @property + def ClosingRecordNumber(self) -> int: ... + @property + def SourceName(self) -> str: ... + @property + def StringInserts(self) -> tuple[str, ...]: ... + @property + def Sid(self) -> PySID: ... + @property + def Data(self) -> str: ... + @property + def ComputerName(self) -> str: ... + +class PyGROUP_INFO_0: + @property + def name(self) -> str: ... + +class PyGROUP_INFO_1: + @property + def name(self) -> str: ... + @property + def comment(self) -> str: ... + +class PyGROUP_INFO_1002: + @property + def comment(self) -> str: ... + +class PyGROUP_INFO_1005: + @property + def attributes(self): ... + +class PyGROUP_INFO_2: + @property + def name(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def group_id(self): ... + @property + def attributes(self): ... + +class PyGROUP_USERS_INFO_0: + @property + def name(self) -> str: ... + +class PyGROUP_USERS_INFO_1: + @property + def name(self) -> str: ... + @property + def attributes(self): ... + +class PyGdiHANDLE: ... +class PyGetSignerCertificate: ... + +class PyHANDLE: + @property + def handle(self) -> int: ... + def Close(self) -> None: ... + def close(self) -> None: ... + def Detach(self): ... + +@final +class PyHDESK: + def SetThreadDesktop(self) -> None: ... + def EnumDesktopWindows(self) -> tuple[int, ...]: ... + def SwitchDesktop(self) -> None: ... + def CloseDesktop(self) -> None: ... + def Detach(self, *args, **kwargs): ... # incomplete + +class PyHDEVNOTIFY: ... + +class PyHHNTRACK: + @property + def action(self): ... + @property + def hdr(self): ... + @property + def curUrl(self) -> str: ... + @property + def winType(self): ... + +class PyHHN_NOTIFY: + @property + def hdr(self): ... + @property + def url(self) -> str: ... + +class PyHH_AKLINK: + @property + def indexOnFail(self): ... + @property + def keywords(self) -> str: ... + @property + def url(self) -> str: ... + @property + def msgText(self) -> str: ... + @property + def msgTitle(self) -> str: ... + @property + def window(self) -> str: ... + +class PyHH_FTS_QUERY: + @property + def uniCodeStrings(self): ... + @property + def proximity(self): ... + @property + def stemmedSearch(self): ... + @property + def titleOnly(self): ... + @property + def execute(self): ... + @property + def searchQuery(self) -> str: ... + +class PyHH_POPUP: + @property + def hinst(self): ... + @property + def idString(self): ... + @property + def clrForeground(self): ... + @property + def clrBackground(self): ... + @property + def text(self) -> str: ... + @property + def font(self) -> str: ... + @property + def pt(self): ... + @property + def margins(self): ... + +class PyHH_WINTYPE: + @property + def uniCodeStrings(self): ... + @property + def validMembers(self): ... + @property + def winProperties(self): ... + @property + def styles(self): ... + @property + def exStyles(self): ... + @property + def showState(self): ... + @property + def hwndHelp(self): ... + @property + def hwndCaller(self): ... + @property + def hwndToolBar(self): ... + @property + def hwndNavigation(self): ... + @property + def hwndHTML(self): ... + @property + def navWidth(self): ... + @property + def toolBarFlags(self): ... + @property + def notExpanded(self): ... + @property + def curNavType(self): ... + @property + def idNotify(self): ... + @property + def typeName(self) -> str: ... + @property + def caption(self) -> str: ... + @property + def windowPos(self): ... + @property + def HTMLPos(self): ... + @property + def toc(self) -> str: ... + @property + def index(self) -> str: ... + @property + def file(self) -> str: ... + @property + def home(self) -> str: ... + @property + def jump1(self) -> str: ... + @property + def jump2(self) -> str: ... + @property + def urlJump1(self) -> str: ... + @property + def urlJump2(self) -> str: ... + +class PyHINTERNET: ... +class PyHKEY: ... +class PyHTHEME: ... + +@final +class PyHWINSTA: + def EnumDesktops(self) -> tuple[Incomplete, ...]: ... + def SetProcessWindowStation(self) -> None: ... + def CloseWindowStation(self) -> None: ... + def Detach(self, *args, **kwargs): ... # incomplete + +class PyICONINFO: ... +class PyIID: ... + +@final +class PyINPUT_RECORD: + @property + def EventType(self): ... + @property + def KeyDown(self): ... + @property + def RepeatCount(self): ... + @property + def VirtualKeyCode(self): ... + @property + def VirtualScanCode(self): ... + @property + def Char(self) -> str: ... + @property + def ControlKeyState(self): ... + @property + def ButtonState(self): ... + @property + def EventFlags(self): ... + @property + def MousePosition(self) -> PyCOORD: ... + @property + def Size(self) -> PyCOORD: ... + @property + def SetFocus(self): ... + @property + def CommandId(self): ... + +class PyLOCALGROUP_INFO_0: + @property + def name(self) -> str: ... + +class PyLOCALGROUP_INFO_1: + @property + def name(self) -> str: ... + @property + def comment(self) -> str: ... + +class PyLOCALGROUP_INFO_1002: + @property + def comment(self) -> str: ... + +class PyLOCALGROUP_MEMBERS_INFO_0: + @property + def sid(self) -> PySID: ... + +class PyLOCALGROUP_MEMBERS_INFO_1: + @property + def sid(self) -> PySID: ... + @property + def sidusage(self): ... + @property + def name(self) -> str: ... + +class PyLOCALGROUP_MEMBERS_INFO_2: + @property + def sid(self) -> PySID: ... + @property + def sidusage(self): ... + @property + def domainandname(self) -> str: ... + +class PyLOCALGROUP_MEMBERS_INFO_3: + @property + def domainandname(self) -> str: ... + +class PyLOGBRUSH: + @property + def Style(self): ... + @property + def Color(self): ... + @property + def Hatch(self) -> int: ... + +class PyLOGFONT: + @property + def lfHeight(self) -> int: ... + @property + def lfWidth(self) -> int: ... + @property + def lfEscapement(self) -> int: ... + @property + def lfOrientation(self) -> int: ... + @property + def lfWeight(self) -> int: ... + @property + def lfItalic(self) -> int: ... + @property + def lfUnderline(self) -> int: ... + @property + def lfStrikeOut(self) -> int: ... + @property + def lfCharSet(self) -> int: ... + @property + def lfOutPrecision(self) -> int: ... + @property + def lfClipPrecision(self) -> int: ... + @property + def lfQuality(self) -> int: ... + @property + def lfPitchAndFamily(self) -> int: ... + @property + def lfFaceName(self) -> str: ... + +class PyLSA_HANDLE: ... +class PyLUID_AND_ATTRIBUTES: ... +class PyLsaLogon_HANDLE: ... +class PyMSG: ... + +@final +class PyNETRESOURCE: + @property + def dwScope(self) -> int: ... + @property + def dwType(self) -> int: ... + @property + def dwDisplayType(self) -> int: ... + @property + def dwUsage(self) -> int: ... + @property + def lpComment(self): ... + @property + def lpLocalName(self): ... + @property + def lpProvider(self): ... + @property + def lpRemoteName(self): ... + +class PyNET_VALIDATE_AUTHENTICATION_INPUT_ARG: ... +class PyNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG: ... +class PyNET_VALIDATE_PERSISTED_FIELDS: ... + +class PyNMHDR: + @property + def hwndFrom(self): ... + @property + def idFrom(self): ... + @property + def code(self): ... + +class PyNOTIFYICONDATA: ... + +class PyOVERLAPPED: + @property + def Offset(self) -> int: ... + @property + def OffsetHigh(self) -> int: ... + @property + def object(self): ... + @property + def dword(self): ... + @property + def hEvent(self) -> int: ... + @property + def Internal(self) -> int: ... + @property + def InternalHigh(self) -> int: ... + +class PyOVERLAPPEDReadBuffer: ... + +class PyPERF_COUNTER_DEFINITION: + @property + def DefaultScale(self) -> int: ... + @property + def DetailLevel(self) -> int: ... + @property + def CounterType(self) -> int: ... + @property + def CounterNameTitleIndex(self) -> int: ... + @property + def CounterHelpTitleIndex(self) -> int: ... + def Increment(self) -> None: ... + def Decrement(self) -> None: ... + def Set(self) -> None: ... + def Get(self) -> None: ... + +class PyPERF_OBJECT_TYPE: + @property + def ObjectNameTitleIndex(self) -> int: ... + @property + def ObjectHelpTitleIndex(self) -> int: ... + @property + def DefaultCounterIndex(self) -> int: ... + def Close(self) -> None: ... + +class PyPOINT: ... + +class PyPROFILEINFO: + @property + def UserName(self) -> str: ... + @property + def Flags(self): ... + @property + def ProfilePath(self) -> str: ... + @property + def DefaultPath(self) -> str: ... + @property + def ServerName(self) -> str: ... + @property + def PolicyPath(self) -> str: ... + @property + def Profile(self) -> PyHKEY: ... + +class PyPerfMonManager: + def Close(self) -> None: ... + +class PyPrinterHANDLE: ... +class PyRECT: ... +class PyResourceId: ... +class PySCROLLINFO: ... +class PySC_HANDLE: ... + +class PySECURITY_ATTRIBUTES: + @property + def bInheritHandle(self): ... + @property + def SECURITY_DESCRIPTOR(self) -> PySECURITY_DESCRIPTOR: ... + +class PySECURITY_DESCRIPTOR: + def Initialize(self) -> None: ... + def GetSecurityDescriptorOwner(self) -> PySID: ... + def GetSecurityDescriptorDacl(self) -> PyACL: ... + def GetSecurityDescriptorSacl(self) -> PyACL: ... + def GetSecurityDescriptorControl(self) -> tuple[Incomplete, Incomplete]: ... + def SetSecurityDescriptorOwner(self, sid: PySID, bOwnerDefaulted) -> None: ... + def SetSecurityDescriptorGroup(self, sid: PySID, bOwnerDefaulted): ... + def SetSecurityDescriptorSacl(self, bSaclPresent, SACL: PyACL, bSaclDefaulted) -> None: ... + def IsValid(self) -> bool: ... + def GetLength(self) -> None: ... + def IsSelfRelative(self) -> bool: ... + def SetSecurityDescriptorControl(self, ControlBitsOfInterest, ControlBitsToSet) -> None: ... + +class PySERVER_INFO_100: + @property + def platform_id(self): ... + @property + def name(self) -> str: ... + +class PySERVER_INFO_101: + @property + def platform_id(self): ... + @property + def name(self) -> str: ... + @property + def version_major(self): ... + @property + def version_minor(self): ... + @property + def type(self): ... + @property + def comment(self) -> str: ... + +class PySERVER_INFO_102: + @property + def platform_id(self): ... + @property + def name(self) -> str: ... + @property + def version_major(self): ... + @property + def version_minor(self): ... + @property + def type(self): ... + @property + def comment(self) -> str: ... + @property + def users(self): ... + @property + def disc(self): ... + @property + def hidden(self): ... + @property + def announce(self): ... + @property + def anndelta(self): ... + @property + def userpath(self) -> str: ... + +class PySERVER_INFO_402: + @property + def ulist_mtime(self): ... + @property + def glist_mtime(self): ... + @property + def alist_mtime(self): ... + @property + def security(self): ... + @property + def numadmin(self): ... + @property + def lanmask(self): ... + @property + def guestacct(self) -> str: ... + @property + def chdevs(self): ... + @property + def chdevq(self): ... + @property + def chdevjobs(self): ... + @property + def connections(self): ... + @property + def shares(self): ... + @property + def openfiles(self): ... + @property + def sessopens(self): ... + @property + def sessvcs(self): ... + @property + def sessreqs(self): ... + @property + def opensearch(self): ... + @property + def activelocks(self): ... + @property + def numreqbuf(self): ... + @property + def sizreqbuf(self): ... + @property + def numbigbuf(self): ... + @property + def numfiletasks(self): ... + @property + def alertsched(self): ... + @property + def erroralert(self): ... + @property + def logonalert(self): ... + @property + def accessalert(self): ... + @property + def diskalert(self): ... + @property + def netioalert(self): ... + @property + def maxauditsz(self): ... + @property + def srvheuristics(self) -> str: ... + +class PySERVER_INFO_403: + @property + def ulist_mtime(self): ... + @property + def glist_mtime(self): ... + @property + def alist_mtime(self): ... + @property + def security(self): ... + @property + def numadmin(self): ... + @property + def lanmask(self): ... + @property + def guestacct(self) -> str: ... + @property + def chdevs(self): ... + @property + def chdevq(self): ... + @property + def chdevjobs(self): ... + @property + def connections(self): ... + @property + def shares(self): ... + @property + def openfiles(self): ... + @property + def sessopens(self): ... + @property + def sessvcs(self): ... + @property + def sessreqs(self): ... + @property + def opensearch(self): ... + @property + def activelocks(self): ... + @property + def numreqbuf(self): ... + @property + def sizreqbuf(self): ... + @property + def numbigbuf(self): ... + @property + def numfiletasks(self): ... + @property + def alertsched(self): ... + @property + def erroralert(self): ... + @property + def logonalert(self): ... + @property + def accessalert(self): ... + @property + def diskalert(self): ... + @property + def netioalert(self): ... + @property + def maxauditsz(self): ... + @property + def srvheuristics(self) -> str: ... + @property + def auditedevents(self): ... + @property + def autoprofile(self): ... + @property + def autopath(self) -> str: ... + +class PySERVER_INFO_502: + @property + def sessopens(self): ... + @property + def sessvcs(self): ... + @property + def opensearch(self): ... + @property + def sizreqbuf(self): ... + @property + def initworkitems(self): ... + @property + def maxworkitems(self): ... + @property + def rawworkitems(self): ... + @property + def irpstacksize(self): ... + @property + def maxrawbuflen(self): ... + @property + def sessusers(self): ... + @property + def sessconns(self): ... + @property + def maxpagedmemoryusage(self): ... + @property + def maxnonpagedmemoryusage(self): ... + @property + def enableforcedlogoff(self): ... + @property + def timesource(self): ... + @property + def acceptdownlevelapis(self): ... + @property + def lmannounce(self): ... + +class PySERVER_INFO_503: + @property + def sessopens(self): ... + @property + def sessvcs(self): ... + @property + def opensearch(self): ... + @property + def sizreqbuf(self): ... + @property + def initworkitems(self): ... + @property + def maxworkitems(self): ... + @property + def rawworkitems(self): ... + @property + def irpstacksize(self): ... + @property + def maxrawbuflen(self): ... + @property + def sessusers(self): ... + @property + def sessconns(self): ... + @property + def maxpagedmemoryusage(self): ... + @property + def maxnonpagedmemoryusage(self): ... + @property + def enableforcedlogoff(self): ... + @property + def timesource(self): ... + @property + def acceptdownlevelapis(self): ... + @property + def lmannounce(self): ... + @property + def domain(self) -> str: ... + @property + def maxkeepsearch(self): ... + @property + def scavtimeout(self): ... + @property + def minrcvqueue(self): ... + @property + def minfreeworkitems(self): ... + @property + def xactmemsize(self): ... + @property + def threadpriority(self): ... + @property + def maxmpxct(self): ... + @property + def oplockbreakwait(self): ... + @property + def oplockbreakresponsewait(self): ... + @property + def enableoplocks(self): ... + @property + def enablefcbopens(self): ... + @property + def enableraw(self): ... + @property + def enablesharednetdrives(self): ... + @property + def minfreeconnections(self): ... + @property + def maxfreeconnections(self): ... + +class PySHARE_INFO_0: + @property + def netname(self) -> str: ... + +class PySHARE_INFO_1: + @property + def netname(self) -> str: ... + @property + def type(self): ... + @property + def remark(self) -> str: ... + +class PySHARE_INFO_2: + @property + def netname(self) -> str: ... + @property + def type(self): ... + @property + def remark(self) -> str: ... + @property + def permissions(self): ... + @property + def max_uses(self): ... + @property + def current_uses(self): ... + @property + def path(self) -> str: ... + @property + def passwd(self) -> str: ... + +class PySHARE_INFO_501: + @property + def netname(self) -> str: ... + @property + def type(self): ... + @property + def remark(self) -> str: ... + @property + def flags(self): ... + +class PySHARE_INFO_502: + @property + def netname(self) -> str: ... + @property + def type(self): ... + @property + def remark(self) -> str: ... + @property + def permissions(self): ... + @property + def max_uses(self): ... + @property + def current_uses(self): ... + @property + def path(self) -> str: ... + @property + def passwd(self) -> str: ... + @property + def reserved(self): ... + @property + def security_descriptor(self) -> PySECURITY_DESCRIPTOR: ... + +class PySID: + def Initialize(self, idAuthority, numSubauthorities) -> None: ... + def IsValid(self) -> bool: ... + def SetSubAuthority(self, index, val) -> None: ... + def GetLength(self): ... + def GetSubAuthorityCount(self): ... + def GetSubAuthority(self): ... + def GetSidIdentifierAuthority(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... + +class PySID_AND_ATTRIBUTES: ... +class PySIZE: ... + +@final +class PySMALL_RECT: + @property + def Left(self): ... + @property + def Top(self): ... + @property + def Right(self): ... + @property + def Bottom(self): ... + +class PySTARTUPINFO: + @property + def dwX(self) -> int: ... + @property + def dwY(self) -> int: ... + @property + def dwXSize(self) -> int: ... + @property + def dwYSize(self) -> int: ... + @property + def dwXCountChars(self) -> int: ... + @property + def dwYCountChars(self) -> int: ... + @property + def dwFillAttribute(self) -> int: ... + @property + def dwFlags(self) -> int: ... + @property + def wShowWindow(self) -> int: ... + @property + def hStdInput(self) -> int: ... + @property + def hStdOutput(self) -> int: ... + @property + def hStdError(self) -> int: ... + @property + def lpDesktop(self) -> str: ... + @property + def lpTitle(self) -> str: ... + +class PySecBuffer: + @property + def BufferType(self): ... + @property + def Buffer(self) -> str: ... + @property + def BufferSize(self): ... + @property + def MaxBufferSize(self): ... + def Clear(self) -> None: ... + +class PySecBufferDesc: + Version: Incomplete + def append(self, buffer) -> None: ... + +class PyTOKEN_GROUPS: ... +class PyTOKEN_PRIVILEGES: ... + +class PyTRIVERTEX: + @property + def x(self): ... + @property + def y(self): ... + @property + def Red(self): ... + @property + def Green(self): ... + @property + def Blue(self): ... + @property + def Alpha(self): ... + +class PyTRUSTEE: + @property + def TrusteeForm(self): ... + @property + def TrusteeType(self): ... + @property + def Identifier(self): ... + @property + def MultipleTrustee(self): ... + @property + def MultipleTrusteeOperation(self): ... + +class PyTS_HANDLE: ... + +class PyTime: + @property + def year(self): ... + @property + def month(self): ... + @property + def weekday(self): ... + @property + def day(self): ... + @property + def hour(self): ... + @property + def minute(self): ... + @property + def second(self): ... + @property + def msec(self): ... + def Format(self, _format: str) -> str: ... + +class PyUSER_INFO_0: + @property + def name(self) -> str: ... + +class PyUSER_INFO_1: + @property + def name(self) -> str: ... + @property + def password(self) -> str: ... + @property + def password_age(self): ... + @property + def priv(self): ... + @property + def home_dir(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def flags(self): ... + @property + def script_path(self) -> str: ... + +class PyUSER_INFO_10: + @property + def name(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def usr_comment(self) -> str: ... + @property + def full_name(self) -> str: ... + +class PyUSER_INFO_1003: + @property + def password(self) -> str: ... + +class PyUSER_INFO_1005: + @property + def priv(self): ... + +class PyUSER_INFO_1006: + @property + def home_dir(self) -> str: ... + +class PyUSER_INFO_1007: + @property + def comment(self) -> str: ... + +class PyUSER_INFO_1008: + @property + def flags(self): ... + +class PyUSER_INFO_1009: + @property + def script_path(self) -> str: ... + +class PyUSER_INFO_1010: + @property + def auth_flags(self): ... + +class PyUSER_INFO_1011: + @property + def full_name(self) -> str: ... + +class PyUSER_INFO_11: + @property + def name(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def usr_comment(self) -> str: ... + @property + def full_name(self) -> str: ... + @property + def priv(self): ... + @property + def auth_flags(self): ... + @property + def password_age(self): ... + @property + def home_dir(self) -> str: ... + @property + def parms(self) -> str: ... + @property + def last_logon(self): ... + @property + def last_logoff(self): ... + @property + def bad_pw_count(self): ... + @property + def num_logons(self): ... + @property + def logon_server(self) -> str: ... + @property + def country_code(self): ... + @property + def workstations(self) -> str: ... + @property + def max_storage(self): ... + @property + def units_per_week(self): ... + @property + def logon_hours(self) -> str: ... + @property + def code_page(self): ... + +class PyUSER_INFO_2: + @property + def name(self) -> str: ... + @property + def password(self) -> str: ... + @property + def password_age(self): ... + @property + def priv(self): ... + @property + def home_dir(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def flags(self): ... + @property + def script_path(self) -> str: ... + @property + def auth_flags(self): ... + @property + def full_name(self) -> str: ... + @property + def usr_comment(self) -> str: ... + @property + def parms(self) -> str: ... + @property + def workstations(self) -> str: ... + @property + def last_logon(self): ... + @property + def last_logoff(self): ... + @property + def acct_expires(self): ... + @property + def max_storage(self): ... + @property + def units_per_week(self): ... + @property + def logon_hours(self) -> str: ... + @property + def bad_pw_count(self): ... + @property + def num_logons(self): ... + @property + def logon_server(self) -> str: ... + @property + def country_code(self): ... + @property + def code_page(self): ... + +class PyUSER_INFO_20: + @property + def name(self) -> str: ... + @property + def full_name(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def flags(self): ... + @property + def user_id(self): ... + +class PyUSER_INFO_3: + @property + def name(self) -> str: ... + @property + def password(self) -> str: ... + @property + def password_age(self): ... + @property + def priv(self): ... + @property + def home_dir(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def flags(self): ... + @property + def script_path(self) -> str: ... + @property + def auth_flags(self): ... + @property + def full_name(self) -> str: ... + @property + def usr_comment(self) -> str: ... + @property + def parms(self) -> str: ... + @property + def workstations(self) -> str: ... + @property + def last_logon(self): ... + @property + def last_logoff(self): ... + @property + def acct_expires(self): ... + @property + def max_storage(self): ... + @property + def units_per_week(self): ... + @property + def logon_hours(self) -> str: ... + @property + def bad_pw_count(self): ... + @property + def num_logons(self): ... + @property + def logon_server(self) -> str: ... + @property + def country_code(self): ... + @property + def code_page(self): ... + @property + def user_id(self): ... + @property + def primary_group_id(self): ... + @property + def profile(self) -> str: ... + @property + def home_dir_drive(self) -> str: ... + @property + def password_expired(self): ... + +class PyUSER_INFO_4: + @property + def name(self) -> str: ... + @property + def password(self) -> str: ... + @property + def password_age(self): ... + @property + def priv(self): ... + @property + def home_dir(self) -> str: ... + @property + def comment(self) -> str: ... + @property + def flags(self): ... + @property + def script_path(self) -> str: ... + @property + def auth_flags(self): ... + @property + def full_name(self) -> str: ... + @property + def usr_comment(self) -> str: ... + @property + def parms(self) -> str: ... + @property + def workstations(self) -> str: ... + @property + def last_logon(self): ... + @property + def last_logoff(self): ... + @property + def acct_expires(self): ... + @property + def max_storage(self): ... + @property + def units_per_week(self): ... + @property + def logon_hours(self) -> str: ... + @property + def bad_pw_count(self): ... + @property + def num_logons(self): ... + @property + def logon_server(self) -> str: ... + @property + def country_code(self): ... + @property + def code_page(self): ... + @property + def user_sid(self) -> PySID: ... + @property + def primary_group_id(self): ... + @property + def profile(self) -> str: ... + @property + def home_dir_drive(self) -> str: ... + @property + def password_expired(self): ... + +class PyUSER_MODALS_INFO_0: + @property + def min_passwd_len(self): ... + @property + def max_passwd_age(self): ... + @property + def min_passwd_age(self): ... + @property + def force_logoff(self): ... + @property + def password_hist_len(self): ... + +class PyUSER_MODALS_INFO_1: + @property + def role(self): ... + @property + def primary(self) -> str: ... + +class PyUSER_MODALS_INFO_2: + @property + def domain_name(self) -> str: ... + @property + def domain_id(self) -> PySID: ... + +class PyUSER_MODALS_INFO_3: + @property + def lockout_duration(self): ... + @property + def lockout_observation_window(self): ... + @property + def usrmod3_lockout_threshold(self): ... + +class PyUSE_INFO_0: + @property + def local(self) -> str: ... + @property + def remote(self) -> str: ... + +class PyUSE_INFO_1: + @property + def local(self) -> str: ... + @property + def remote(self) -> str: ... + @property + def password(self) -> str: ... + @property + def status(self): ... + @property + def asg_type(self): ... + @property + def refcount(self): ... + @property + def usecount(self): ... + +class PyUSE_INFO_2: + @property + def local(self) -> str: ... + @property + def remote(self) -> str: ... + @property + def password(self) -> str: ... + @property + def status(self): ... + @property + def asg_type(self): ... + @property + def refcount(self): ... + @property + def usecount(self): ... + @property + def username(self) -> str: ... + @property + def domainname(self) -> str: ... + +class PyUSE_INFO_3: + @property + def local(self) -> str: ... + @property + def remote(self) -> str: ... + @property + def password(self) -> str: ... + @property + def status(self): ... + @property + def asg_type(self): ... + @property + def refcount(self): ... + @property + def usecount(self): ... + @property + def username(self) -> str: ... + @property + def domainname(self) -> str: ... + @property + def flags(self): ... + +class PyUnicode: ... +class PyUrlCacheHANDLE: ... + +class PyWAVEFORMATEX: + @property + def wFormatTag(self) -> int: ... + @property + def nChannels(self) -> int: ... + @property + def nSamplesPerSec(self) -> int: ... + @property + def nAvgBytesPerSec(self) -> int: ... + @property + def nBlockAlign(self) -> int: ... + @property + def wBitsPerSample(self) -> int: ... + +class PyWINHTTP_AUTOPROXY_OPTIONS: ... +class PyWINHTTP_PROXY_INFO: ... + +class PyWKSTA_INFO_100: + @property + def platform_id(self): ... + @property + def computername(self) -> str: ... + @property + def langroup(self) -> str: ... + @property + def ver_major(self): ... + @property + def ver_minor(self): ... + +class PyWKSTA_INFO_101: + @property + def platform_id(self): ... + @property + def computername(self) -> str: ... + @property + def langroup(self) -> str: ... + @property + def ver_major(self): ... + @property + def ver_minor(self): ... + @property + def lanroot(self) -> str: ... + +class PyWKSTA_INFO_102: + @property + def platform_id(self): ... + @property + def computername(self) -> str: ... + @property + def langroup(self) -> str: ... + @property + def ver_major(self): ... + @property + def ver_minor(self): ... + @property + def lanroot(self) -> str: ... + @property + def logged_on_users(self): ... + +class PyWKSTA_INFO_302: + @property + def char_wait(self): ... + @property + def collection_time(self): ... + @property + def maximum_collection_count(self): ... + @property + def keep_conn(self): ... + @property + def keep_search(self): ... + @property + def max_cmds(self): ... + @property + def num_work_buf(self): ... + @property + def siz_work_buf(self): ... + @property + def max_wrk_cache(self): ... + @property + def siz_error(self): ... + @property + def num_alerts(self): ... + @property + def num_services(self): ... + @property + def errlog_sz(self): ... + @property + def print_buf_time(self): ... + @property + def num_char_buf(self): ... + @property + def siz_char_buf(self): ... + @property + def wrk_heuristics(self) -> str: ... + @property + def mailslots(self): ... + @property + def num_dgram_buf(self): ... + +class PyWKSTA_INFO_402: + @property + def char_wait(self): ... + @property + def collection_time(self): ... + @property + def maximum_collection_count(self) -> str: ... + @property + def keep_conn(self): ... + @property + def keep_search(self): ... + @property + def max_cmds(self): ... + @property + def num_work_buf(self): ... + @property + def siz_work_buf(self): ... + @property + def max_wrk_cache(self): ... + @property + def sess_timeout(self): ... + @property + def siz_error(self): ... + @property + def num_alerts(self): ... + @property + def num_services(self): ... + @property + def errlog_sz(self): ... + @property + def print_buf_time(self): ... + @property + def num_char_buf(self): ... + @property + def siz_char_buf(self): ... + @property + def mailslots(self): ... + @property + def num_dgram_buf(self): ... + @property + def max_threads(self): ... + +class PyWKSTA_INFO_502: + @property + def char_wait(self): ... + @property + def collection_time(self): ... + @property + def maximum_collection_count(self): ... + @property + def keep_conn(self): ... + @property + def max_cmds(self): ... + @property + def max_wrk_cache(self): ... + @property + def siz_char_buf(self): ... + @property + def lock_quota(self): ... + @property + def lock_increment(self): ... + @property + def lock_maximum(self): ... + @property + def pipe_increment(self): ... + @property + def pipe_maximum(self): ... + @property + def cache_file_timeout(self): ... + @property + def dormant_file_limit(self): ... + @property + def read_ahead_throughput(self): ... + @property + def num_mailslot_buffers(self): ... + @property + def num_srv_announce_buffers(self): ... + @property + def max_illegal_datagram_events(self): ... + @property + def illegal_datagram_event_reset_frequency(self): ... + @property + def log_election_packets(self): ... + @property + def use_opportunistic_locking(self): ... + @property + def use_unlock_behind(self): ... + @property + def use_close_behind(self): ... + @property + def buf_named_pipes(self): ... + @property + def use_lock_read_unlock(self): ... + @property + def utilize_nt_caching(self): ... + @property + def use_raw_read(self): ... + @property + def use_raw_write(self): ... + @property + def use_write_raw_data(self): ... + @property + def use_encryption(self): ... + @property + def buf_files_deny_write(self): ... + @property + def buf_read_only_files(self): ... + @property + def force_core_create_mode(self): ... + @property + def use_512_byte_max_transfer(self): ... + +class PyWKSTA_TRANSPORT_INFO_0: + @property + def quality_of_service(self): ... + @property + def number_of_vcs(self): ... + @property + def transport_name(self) -> str: ... + @property + def transport_address(self) -> str: ... + @property + def wan_ish(self): ... + +class PyWKSTA_USER_INFO_0: + @property + def username(self) -> str: ... + +class PyWKSTA_USER_INFO_1: + @property + def username(self) -> str: ... + @property + def logon_domain(self) -> str: ... + @property + def oth_domains(self) -> str: ... + @property + def logon_server(self) -> str: ... + +class PyWNDCLASS: + @property + def style(self) -> int: ... + @property + def cbWndExtra(self) -> int: ... + @property + def hInstance(self) -> int: ... + @property + def hIcon(self) -> int: ... + @property + def hCursor(self) -> int: ... + @property + def hbrBackground(self) -> int: ... + @property + def lpszMenuName(self) -> str: ... + @property + def lpszClassName(self) -> str: ... + @property + def lpfnWndProc(self): ... + def SetDialogProc(self) -> None: ... + +class PyXFORM: + @property + def M11(self) -> float: ... + @property + def M12(self) -> float: ... + @property + def M21(self) -> float: ... + @property + def M22(self) -> float: ... + @property + def Dx(self) -> float: ... + @property + def Dy(self) -> float: ... + +class Pymmapfile: + def close(self) -> None: ... + def find(self, needle, start): ... + def flush(self, offset: int = ..., size: int = ...) -> None: ... + def move(self, dest, src, count) -> None: ... + def read(self, num_bytes): ... + def read_byte(self): ... + def read_line(self): ... + def resize(self, MaximumSize, FileOffset: int = ..., NumberOfBytesToMap: int = ...) -> None: ... + def seek(self, dist, how: int = ...) -> None: ... + def size(self): ... + def tell(self): ... + def write(self, data) -> None: ... + def write_byte(self, char) -> None: ... + +class RASDIALEXTENSIONS: + @property + def dwfOptions(self) -> int: ... + @property + def hwndParent(self) -> int: ... + @property + def reserved(self) -> int: ... + @property + def reserved1(self) -> int: ... + @property + def RasEapInfo(self): ... + +class RASDIALPARAMS: ... + +class SC_ACTION: + @property + def Type(self): ... + @property + def Delay(self): ... + +class SERVICE_FAILURE_ACTIONS: + @property + def ResetPeriod(self): ... + @property + def RebootMsg(self) -> str: ... + @property + def Command(self) -> str: ... + @property + def Actions(self): ... + +class SERVICE_STATUS: ... +class TRACKMOUSEEVENT: ... +class ULARGE_INTEGER: ... +class WIN32_FIND_DATA: ... +class com_error: ... + +class connection: + def setautocommit(self, c) -> None: ... + def commit(self) -> None: ... + def rollback(self) -> None: ... + def cursor(self) -> None: ... + def close(self) -> None: ... + +class cursor: + def close(self) -> None: ... + def execute(self, sql: str, arg): ... + def fetchone(self): ... + def fetchmany(self) -> list[Incomplete]: ... + def fetchall(self) -> list[Incomplete]: ... + def setinputsizes(self) -> None: ... + def setoutputsize(self) -> None: ... + +class error(Exception): ... + +class COMPONENT: + @property + def ID(self): ... + @property + def ComponentType(self): ... + @property + def Checked(self): ... + @property + def fDirty(self): ... + @property + def NoScroll(self): ... + @property + def Pos(self): ... + @property + def FriendlyName(self): ... + @property + def Source(self): ... + @property + def SubscribedURL(self): ... + @property + def CurItemState(self): ... + @property + def Original(self): ... + @property + def Restored(self): ... + @property + def Size(self): ... + +class COMPONENTSOPT: + @property + def EnableComponents(self): ... + @property + def ActiveDesktop(self): ... + @property + def Size(self): ... + +class COMPPOS: + @property + def Left(self): ... + @property + def Top(self): ... + @property + def Width(self): ... + @property + def Height(self): ... + @property + def Index(self): ... + @property + def CanResize(self): ... + @property + def CanResizeX(self): ... + @property + def CanResizeY(self): ... + @property + def PreferredLeftPercent(self): ... + @property + def PreferredTopPercent(self): ... + @property + def Size(self): ... + +class COMPSTATEINFO: + @property + def Left(self): ... + @property + def Top(self): ... + @property + def Width(self): ... + @property + def Height(self): ... + @property + def dwItemState(self): ... + @property + def Size(self): ... + +class DEFCONTENTMENU: ... +class ELEMDESC: ... + +class EXP_DARWIN_LINK: + @property + def Signature(self): ... + @property + def DarwinID(self): ... + @property + def wDarwinID(self): ... + @property + def Size(self): ... + +class EXP_SPECIAL_FOLDER: + @property + def Signature(self): ... + @property + def idSpecialFolder(self): ... + @property + def Offset(self): ... + @property + def Size(self): ... + +class EXP_SZ_LINK: + @property + def Signature(self): ... + @property + def Target(self): ... + @property + def wTarget(self): ... + @property + def Size(self): ... + +class FUNCDESC: + @property + def memid(self) -> int: ... + @property + def scodeArray(self) -> tuple[Incomplete, ...]: ... + @property + def args(self) -> tuple[ELEMDESC, ...]: ... + @property + def funckind(self): ... + @property + def invkind(self): ... + @property + def callconv(self): ... + @property + def cParamsOpt(self): ... + @property + def oVft(self): ... + @property + def rettype(self) -> ELEMDESC: ... + @property + def wFuncFlags(self): ... + +class IDLDESC: ... +class MAPIINIT_0: ... + +class NT_CONSOLE_PROPS: + @property + def Signature(self): ... + @property + def FillAttribute(self): ... + @property + def PopupFillAttribute(self): ... + @property + def ScreenBufferSize(self) -> tuple[Incomplete, Incomplete]: ... + @property + def WindowSize(self) -> tuple[Incomplete, Incomplete]: ... + @property + def WindowOrigin(self) -> tuple[Incomplete, Incomplete]: ... + @property + def nFont(self): ... + @property + def InputBufferSize(self): ... + @property + def FontSize(self) -> tuple[Incomplete, Incomplete]: ... + @property + def FontFamily(self): ... + @property + def FontWeight(self): ... + @property + def FaceName(self): ... + @property + def CursorSize(self): ... + @property + def FullScreen(self): ... + @property + def QuickEdit(self): ... + @property + def InsertMode(self): ... + @property + def AutoPosition(self): ... + @property + def HistoryBufferSize(self): ... + @property + def NumberOfHistoryBuffers(self): ... + @property + def HistoryNoDup(self): ... + @property + def ColorTable(self): ... + @property + def Size(self): ... + +class NT_FE_CONSOLE_PROPS: + @property + def Signature(self): ... + @property + def CodePage(self): ... + @property + def Size(self): ... + +class PROPSPEC: ... +class PyADSVALUE: ... + +class PyADS_ATTR_INFO: + @property + def AttrName(self): ... + @property + def ControlCode(self) -> int: ... + @property + def ADsType(self) -> int: ... + @property + def Values(self) -> list[Incomplete]: ... + +class PyADS_OBJECT_INFO: + @property + def RDN(self): ... + @property + def ObjectDN(self): ... + @property + def ParentDN(self): ... + @property + def ClassName(self): ... + +class PyADS_SEARCHPREF_INFO: ... + +class PyBIND_OPTS: + @property + def Flags(self): ... + @property + def Mode(self): ... + @property + def TickCountDeadline(self): ... + @property + def cbStruct(self): ... + +class PyCMINVOKECOMMANDINFO: ... + +class PyDSBCAPS: + @property + def dwFlags(self) -> int: ... + @property + def dwUnlockTransferRate(self) -> int: ... + @property + def dwBufferBytes(self): ... + @property + def dwPlayCpuOverhead(self): ... + +class PyDSBUFFERDESC: + @property + def dwFlags(self) -> int: ... + @property + def dwBufferBytes(self) -> int: ... + @property + def lpwfxFormat(self): ... + +class PyDSCAPS: + @property + def dwFlags(self) -> int: ... + @property + def dwMinSecondarySampleRate(self) -> int: ... + @property + def dwMaxSecondarySampleRate(self) -> int: ... + @property + def dwPrimaryBuffers(self) -> int: ... + @property + def dwMaxHwMixingAllBuffers(self) -> int: ... + @property + def dwMaxHwMixingStaticBuffers(self) -> int: ... + @property + def dwMaxHwMixingStreamingBuffers(self) -> int: ... + @property + def dwFreeHwMixingAllBuffers(self) -> int: ... + @property + def dwFreeHwMixingStaticBuffers(self) -> int: ... + @property + def dwFreeHwMixingStreamingBuffers(self) -> int: ... + @property + def dwMaxHw3DAllBuffers(self) -> int: ... + @property + def dwMaxHw3DStaticBuffers(self) -> int: ... + @property + def dwMaxHw3DStreamingBuffers(self) -> int: ... + @property + def dwFreeHw3DAllBuffers(self) -> int: ... + @property + def dwFreeHw3DStaticBuffers(self) -> int: ... + @property + def dwFreeHw3DStreamingBuffers(self) -> int: ... + @property + def dwTotalHwMemBytes(self) -> int: ... + @property + def dwFreeHwMemBytes(self) -> int: ... + @property + def dwMaxContigFreeHwMemBytes(self) -> int: ... + @property + def dwUnlockTransferRateHwBuffers(self) -> int: ... + @property + def dwPlayCpuOverheadSwBuffers(self) -> int: ... + +class PyDSCBCAPS: + @property + def dwFlags(self) -> int: ... + @property + def dwBufferBytes(self) -> int: ... + +class PyDSCBUFFERDESC: + @property + def dwFlags(self) -> int: ... + @property + def dwBufferBytes(self) -> int: ... + @property + def lpwfxFormat(self): ... + +class PyDSCCAPS: + @property + def dwFlags(self) -> int: ... + @property + def dwFormats(self) -> int: ... + @property + def dwChannels(self) -> int: ... + +class PyDSOP_FILTER_FLAGS: + @property + def uplevel(self) -> PyDSOP_UPLEVEL_FILTER_FLAGS: ... + @property + def downlevel(self): ... + +class PyDSOP_SCOPE_INIT_INFO: + @property + def type(self): ... + @property + def scope(self): ... + @property + def hr(self): ... + @property + def dcName(self) -> str: ... + @property + def filterFlags(self) -> PyDSOP_FILTER_FLAGS: ... + +class PyDSOP_SCOPE_INIT_INFOs: + def __new__(cls, size): ... + +class PyDSOP_UPLEVEL_FILTER_FLAGS: + @property + def bothModes(self): ... + @property + def mixedModeOnly(self): ... + @property + def nativeModeOnly(self): ... + +class PyFORMATETC: ... + +class PyGFileOperationProgressSink: + def StartOperations(self) -> None: ... + def FinishOperations(self, Result) -> None: ... + def PreRenameItem(self, Flags, Item: PyIShellItem, NewName) -> None: ... + def PostRenameItem(self, Flags, Item: PyIShellItem, NewName, hrRename, NewlyCreated: PyIShellItem) -> None: ... + def PreMoveItem(self, Flags, Item: PyIShellItem, DestinationFolder: PyIShellItem, NewName) -> None: ... + def PostMoveItem( + self, Flags, Item: PyIShellItem, DestinationFolder: PyIShellItem, NewName, hrMove, NewlyCreated: PyIShellItem + ) -> None: ... + def PreCopyItem(self, Flags, Item: PyIShellItem, DestinationFolder: PyIShellItem, NewName) -> None: ... + def PostCopyItem( + self, Flags, Item: PyIShellItem, DestinationFolder: PyIShellItem, NewName, hrCopy, NewlyCreated: PyIShellItem + ) -> None: ... + def PreDeleteItem(self, Flags, Item: PyIShellItem) -> None: ... + def PostDeleteItem(self, Flags, Item: PyIShellItem, hrDelete, NewlyCreated: PyIShellItem) -> None: ... + def PreNewItem(self, Flags, DestinationFolder: PyIShellItem, NewName) -> None: ... + def PostNewItem( + self, Flags, DestinationFolder: PyIShellItem, NewName, TemplateName, FileAttributes, hrNew, NewItem: PyIShellItem + ) -> None: ... + def UpdateProgress(self, WorkTotal, WorkSoFar) -> None: ... + def ResetTimer(self) -> None: ... + def PauseTimer(self) -> None: ... + def ResumeTimer(self) -> None: ... + +class PyGSecurityInformation: + def GetObjectInformation(self) -> SI_OBJECT_INFO: ... + def GetSecurity(self, RequestedInformation, Default) -> PySECURITY_DESCRIPTOR: ... + def SetSecurity(self, SecurityInformation, SecurityDescriptor: PySECURITY_DESCRIPTOR) -> None: ... + def GetAccessRights(self, ObjectType: PyIID, Flags) -> tuple[SI_ACCESS, Incomplete]: ... + def MapGeneric(self, ObjectType: PyIID, AceFlags, Mask): ... + def GetInheritTypes(self) -> tuple[SI_INHERIT_TYPE, ...]: ... + def PropertySheetPageCallback(self, hwnd: int, Msg, Page) -> None: ... + +class PyIADesktopP2: + def UpdateAllDesktopSubscriptions(self) -> None: ... + +class PyIADs: + @property + def ADsPath(self) -> str: ... + @property + def AdsPath(self) -> str: ... + @property + def Class(self) -> str: ... + @property + def GUID(self) -> str: ... + @property + def Name(self) -> str: ... + @property + def Parent(self) -> str: ... + @property + def Schema(self) -> str: ... + def GetInfo(self) -> None: ... + def SetInfo(self) -> None: ... + def Get(self, prop: str): ... + def Put(self, _property: str, val) -> None: ... + def get(self, prop: str): ... + def put(self, _property: str, val) -> None: ... + +class PyIADsContainer: + def GetObject(self, _class: str, relativeName: str) -> PyIDispatch: ... + def get_Count(self): ... + def get_Filter(self): ... + def put_Filter(self, val) -> None: ... + def get_Hints(self): ... + def put_Hints(self, val) -> None: ... + +class PyIADsUser: + def get_AccountDisabled(self): ... + def put_AccountDisabled(self, val) -> None: ... + def get_AccountExpirationDate(self): ... + def put_AccountExpirationDate(self, val: PyTime) -> None: ... + def get_BadLoginAddress(self): ... + def get_BadLoginCount(self): ... + def get_Department(self): ... + def put_Department(self, val) -> None: ... + def get_Description(self): ... + def put_Description(self, val) -> None: ... + def get_Division(self): ... + def put_Division(self, val) -> None: ... + def get_EmailAddress(self): ... + def put_EmailAddress(self, val) -> None: ... + def get_EmployeeID(self): ... + def put_EmployeeID(self, val) -> None: ... + def get_FirstName(self): ... + def put_FirstName(self, val) -> None: ... + def get_FullName(self): ... + def put_FullName(self, val) -> None: ... + def get_HomeDirectory(self): ... + def put_HomeDirectory(self, val) -> None: ... + def get_HomePage(self): ... + def put_HomePage(self, val) -> None: ... + def get_LoginScript(self): ... + def put_LoginScript(self, val) -> None: ... + def SetPassword(self, val) -> None: ... + def ChangePassword(self, oldval, newval) -> None: ... + +class PyIActiveDesktop: + def ApplyChanges(self, Flags) -> None: ... + def GetWallpaper(self, cchWallpaper, Reserved: int = ...): ... + def SetWallpaper(self, Wallpaper, Reserved: int = ...) -> None: ... + def GetWallpaperOptions(self, Reserved: int = ...): ... + def SetWallpaperOptions(self, Style, Reserved: int = ...) -> None: ... + def GetPattern(self, cchPattern: int = ..., Reserved: int = ...) -> None: ... + def SetPattern(self, Pattern, Reserved: int = ...) -> None: ... + def GetDesktopItemOptions(self): ... + def SetDesktopItemOptions(self, comp, Reserved: int = ...) -> None: ... + def AddDesktopItem(self, comp, Reserved: int = ...) -> None: ... + def AddDesktopItemWithUI(self, hwnd: int, comp, Flags) -> None: ... + def ModifyDesktopItem(self, comp, Flags) -> None: ... + def RemoveDesktopItem(self, comp, Reserved: int = ...) -> None: ... + def GetDesktopItemCount(self) -> None: ... + def GetDesktopItem(self, Component, Reserved: int = ...): ... + def GetDesktopItemByID(self, ID, reserved: int = ...): ... + def GenerateDesktopItemHtml(self, FileName, comp, Reserved: int = ...) -> None: ... + def AddUrl(self, hwnd: int, Source, comp, Flags) -> None: ... + def GetDesktopItemBySource(self, Source, Reserved: int = ...): ... + +class PyIActiveDesktopP: + def SetSafeMode(self, Flags) -> None: ... + +class PyIActiveScriptDebug: + def GetScriptTextAttributes(self, pstrCode: str, pstrDelimiter: str, dwFlags) -> tuple[Incomplete, ...]: ... + def GetScriptletTextAttributes(self, pstrCode: str, pstrDelimiter: str, dwFlags) -> None: ... + def EnumCodeContextsOfPosition(self, dwSourceContext, uCharacterOffset, uNumChars) -> None: ... + +class PyIActiveScriptError: + def GetExceptionInfo(self) -> None: ... + def GetSourcePosition(self) -> None: ... + def GetSourceLineText(self) -> None: ... + +class PyIActiveScriptErrorDebug: + def GetDocumentContext(self) -> None: ... + def GetStackFrame(self) -> None: ... + +class PyIActiveScriptParseProcedure: + def ParseProcedureText( + self, + pstrCode, + pstrFormalParams, + pstrProcedureName, + pstrItemName, + punkContext: PyIUnknown, + pstrDelimiter, + dwSourceContextCookie, + ulStartingLineNumber, + dwFlags, + ) -> None: ... + +class PyIActiveScriptSite: + def GetLCID(self): ... + def GetItemInfo(self): ... + def GetDocVersionString(self): ... + def OnStateChange(self): ... + def OnEnterScript(self): ... + def OnLeaveScript(self): ... + def OnScriptError(self): ... + def OnScriptTerminate(self): ... + +class PyIActiveScriptSiteDebug: + def GetDocumentContextFromPosition(self, dwSourceContext, uCharacterOffset, uNumChars) -> None: ... + def GetApplication(self) -> None: ... + def GetRootApplicationNode(self) -> None: ... + def OnScriptErrorDebug(self) -> tuple[Incomplete, Incomplete]: ... + +class PyIAddrBook: + def ResolveName(self, uiParm, flags, entryTitle: str, ADRlist) -> None: ... + def OpenEntry(self, entryId: str, iid: PyIID, flags): ... + def CompareEntryIDs(self, entryId: str, entryId1: str, flags: int = ...): ... + +class PyIApplicationDebugger: + def QueryAlive(self) -> None: ... + def CreateInstanceAtDebugger(self, rclsid: PyIID, pUnkOuter: PyIUnknown, dwClsContext, riid: PyIID) -> None: ... + def onDebugOutput(self, pstr) -> None: ... + def onHandleBreakPoint(self, prpt: PyIRemoteDebugApplicationThread, br, pError) -> None: ... + def onClose(self) -> None: ... + def onDebuggerEvent(self, guid: PyIID, uUnknown: PyIUnknown) -> None: ... + +class PyIApplicationDestinations: + def SetAppID(self, AppID) -> None: ... + def RemoveDestination(self, punk: PyIUnknown) -> None: ... + def RemoveAllDestinations(self) -> None: ... + +class PyIApplicationDocumentlists: + def SetAppID(self, AppID) -> None: ... + def Getlist(self, listType, riid: PyIID, ItemsDesired: int = ...) -> PyIEnumObjects: ... + +class PyIAsyncOperation: + def SetAsyncMode(self, fDoOpAsync) -> None: ... + def GetAsyncMode(self): ... + def StartOperation(self, pbcReserved: PyIBindCtx) -> None: ... + def InOperation(self) -> None: ... + def EndOperation(self, hResult, pbcReserved: PyIBindCtx, dwEffects) -> None: ... + +class PyIAttach: + def GetLastError(self, hr, flags): ... + +class PyIBindCtx: + def GetRunningObjectTable(self) -> PyIRunningObjectTable: ... + def GetBindOptions(self) -> PyBIND_OPTS: ... + def SetBindOptions(self, bindopts) -> None: ... + def RegisterObjectParam(self, Key: str, punk: PyIUnknown) -> None: ... + def RevokeObjectParam(self, Key: str) -> None: ... + def GetObjectParam(self, Key: str) -> PyIUnknown: ... + def EnumObjectParam(self) -> PyIEnumString: ... + +class PyIBrowserFrameOptions: + def GetFrameOptions(self, dwMask) -> None: ... + +class PyICancelMethodCalls: + def Cancel(self, Seconds) -> None: ... + def TestCancel(self): ... + +class PyICatInformation: + def EnumCategories(self, lcid: int = ...) -> PyIEnumCATEGORYINFO: ... + def GetCategoryDesc(self, lcid: int = ...) -> str: ... + def EnumClassesOfCategories( + self, listIIdImplemented: list[PyIID] | None = ..., listIIdRequired: Incomplete | None = ... + ) -> PyIEnumGUID: ... + +class PyICatRegister: + def RegisterCategories(self, arg: list[tuple[PyIID, Incomplete, str]]) -> None: ... + def UnRegisterCategories(self, arg: list[PyIID]) -> None: ... + def RegisterClassImplCategories(self, clsid: PyIID, arg: list[PyIID]) -> None: ... + def UnRegisterClassImplCategories(self, clsid: PyIID, arg: list[PyIID]) -> None: ... + def RegisterClassReqCategories(self, clsid: PyIID, arg: list[PyIID]) -> None: ... + def UnRegisterClassReqCategories(self, clsid: PyIID, arg: list[PyIID]) -> None: ... + +class PyICategoryProvider: + def CanCategorizeOnSCID(self, pscid) -> None: ... + def GetDefaultCategory(self) -> None: ... + def GetCategoryForSCID(self, pscid) -> None: ... + def EnumCategories(self) -> None: ... + def GetCategoryName(self, guid: PyIID) -> None: ... + def CreateCategory(self, guid: PyIID, riid: PyIID) -> None: ... + +class PyIClassFactory: + def CreateInstance(self, outerUnknown: PyIUnknown, iid: PyIID) -> PyIUnknown: ... + def LockServer(self, bInc) -> None: ... + +class PyIClientSecurity: + def QueryBlanket(self, Proxy: PyIUnknown): ... + def SetBlanket( + self, Proxy: PyIUnknown, AuthnSvc, AuthzSvc, ServerPrincipalName: str, AuthnLevel, ImpLevel, AuthInfo, Capabilities + ) -> None: ... + def CopyProxy(self, Proxy: PyIUnknown) -> PyIUnknown: ... + +class PyIColumnProvider: + def Initialize(self, psci) -> None: ... + def GetColumnInfo(self, dwIndex) -> None: ... + def GetItemData(self, pscid, pscd) -> None: ... + +class PyIConnectionPoint: + def GetConnectionInterface(self) -> PyIID: ... + def GetConnectionPointContainer(self) -> PyIConnectionPointContainer: ... + def Advise(self, unk: PyIUnknown): ... + def Unadvise(self, cookie) -> None: ... + def EnumConnections(self) -> PyIEnumConnections: ... + +class PyIConnectionPointContainer: + def EnumConnectionPoints(self) -> PyIEnumConnectionPoints: ... + def FindConnectionPoint(self, iid: PyIID) -> PyIConnectionPoint: ... + +class PyIContext: + def SetProperty(self, rpolicyId: PyIID, flags, pUnk: PyIUnknown) -> None: ... + def RemoveProperty(self, rPolicyId: PyIID) -> None: ... + def GetProperty(self, rGuid: PyIID) -> tuple[Incomplete, PyIUnknown]: ... + def EnumContextProps(self) -> PyIEnumContextProps: ... + +class PyIContextMenu: + def QueryContextMenu(self, hmenu: int, indexMenu, idCmdFirst, idCmdLast, uFlags): ... + def InvokeCommand(self, pici: PyCMINVOKECOMMANDINFO) -> None: ... + def GetCommandString(self, idCmd, uType, cchMax: int = ...): ... + +class PyICopyHookA: + def CopyCallback(self, hwnd: int, wFunc, wFlags, srcFile: str, srcAttribs, destFile: str, destAttribs) -> None: ... + +class PyICopyHookW: + def CopyCallback(self, hwnd: int, wFunc, wFlags, srcFile: str, srcAttribs, destFile: str, destAttribs) -> None: ... + +class PyICreateTypeInfo: + def SetGuid(self, guid: PyIID) -> None: ... + def SetTypeFlags(self, uTypeFlags) -> None: ... + def SetDocString(self, pStrDoc) -> None: ... + def SetHelpContext(self, dwHelpContext) -> None: ... + def SetVersion(self, wMajorVerNum, wMinorVerNum) -> None: ... + def AddRefTypeInfo(self, pTInfo: PyITypeInfo) -> None: ... + def AddFuncDesc(self, index) -> None: ... + def AddImplType(self, index, hRefType) -> None: ... + def SetImplTypeFlags(self, index, implTypeFlags) -> None: ... + def SetAlignment(self, cbAlignment) -> None: ... + def SetSchema(self, pStrSchema) -> None: ... + def AddVarDesc(self, index) -> None: ... + def SetFuncAndParamNames(self, index, rgszNames: tuple[Incomplete, ...]) -> None: ... + def SetVarName(self, index, szName) -> None: ... + def SetTypeDescAlias(self) -> None: ... + def DefineFuncAsDllEntry(self, index, szDllName, szProcName) -> None: ... + def SetFuncDocString(self, index, szDocString) -> None: ... + def SetVarDocString(self, index, szDocString) -> None: ... + def SetFuncHelpContext(self, index, dwHelpContext) -> None: ... + def SetVarHelpContext(self, index, dwHelpContext) -> None: ... + def SetMops(self, index, bstrMops) -> None: ... + def LayOut(self) -> None: ... + +class PyICreateTypeLib: + def CreateTypeInfo(self, szName) -> None: ... + def SetName(self, szName) -> None: ... + def SetVersion(self, wMajorVerNum, wMinorVerNum) -> None: ... + def SetGuid(self, guid: PyIID) -> None: ... + def SetDocString(self, szDoc) -> None: ... + def SetHelpFileName(self, szHelpFileName) -> None: ... + def SetHelpContext(self, dwHelpContext) -> None: ... + def SetLcid(self) -> None: ... + def SetLibFlags(self, uLibFlags) -> None: ... + def SaveAllChanges(self) -> None: ... + +class PyICreateTypeLib2: + def CreateTypeInfo(self, szName) -> None: ... + def SetName(self, szName) -> None: ... + def SetVersion(self, wMajorVerNum, wMinorVerNum) -> None: ... + def SetGuid(self, guid: PyIID) -> None: ... + def SetDocString(self, szDoc) -> None: ... + def SetHelpFileName(self, szHelpFileName) -> None: ... + def SetHelpContext(self, dwHelpContext) -> None: ... + def SetLcid(self) -> None: ... + def SetLibFlags(self, uLibFlags) -> None: ... + def SaveAllChanges(self) -> None: ... + +class PyICurrentItem: ... + +class PyICustomDestinationlist: + def SetAppID(self, AppID) -> None: ... + def Beginlist(self, riid: PyIID) -> tuple[Incomplete, PyIObjectArray]: ... + def AppendCategory(self, Category, Items: PyIObjectArray) -> None: ... + def AppendKnownCategory(self, Category) -> None: ... + def AddUserTasks(self, Items: PyIObjectArray) -> None: ... + def Commitlist(self) -> None: ... + def GetRemovedDestinations(self, riid: PyIID) -> PyIObjectArray: ... + def Deletelist(self, AppID: Incomplete | None = ...) -> None: ... + def Abortlist(self) -> None: ... + +class PyIDL: ... + +class PyIDataObject: + def GetData(self, pformatetcIn: PyFORMATETC) -> PySTGMEDIUM: ... + def GetDataHere(self, pformatetcIn: PyFORMATETC) -> PySTGMEDIUM: ... + def QueryGetData(self, pformatetc: PyFORMATETC) -> None: ... + def GetCanonicalFormatEtc(self, pformatectIn: PyFORMATETC) -> PyFORMATETC: ... + def SetData(self, pformatetc: PyFORMATETC, pmedium: PySTGMEDIUM, fRelease) -> None: ... + def EnumFormatEtc(self, dwDirection) -> PyIEnumFORMATETC: ... + def DAdvise(self, pformatetc: PyFORMATETC, advf, pAdvSink): ... + def DUnadvise(self, dwConnection) -> None: ... + def EnumDAdvise(self): ... + +class PyIDebugApplication: + def SetName(self, pstrName) -> None: ... + def StepOutComplete(self) -> None: ... + def DebugOutput(self, pstr) -> None: ... + def StartDebugSession(self) -> None: ... + def HandleBreakPoint(self, br): ... + def Close(self) -> None: ... + def GetBreakFlags(self): ... + def GetCurrentThread(self) -> PyIDebugApplicationThread: ... + def CreateAsyncDebugOperation(self, psdo: PyIDebugSyncOperation) -> None: ... + def AddStackFrameSniffer(self, pdsfs: PyIDebugStackFrameSniffer): ... + def RemoveStackFrameSniffer(self, dwCookie) -> None: ... + def QueryCurrentThreadIsDebuggerThread(self) -> None: ... + def SynchronousCallInDebuggerThread(self, pptc, dwParam1, dwParam2, dwParam3) -> None: ... + def CreateApplicationNode(self) -> PyIDebugApplicationNode: ... + def FireDebuggerEvent(self, guid, unknown: PyIUnknown) -> None: ... + def HandleRuntimeError(self, pErrorDebug: PyIActiveScriptErrorDebug, pScriptSite: PyIActiveScriptSite) -> None: ... + def FCanJitDebug(self) -> None: ... + def FIsAutoJitDebugEnabled(self) -> None: ... + def AddGlobalExpressionContextProvider(self, pdsfs: PyIProvideExpressionContexts) -> None: ... + def RemoveGlobalExpressionContextProvider(self, dwCookie) -> None: ... + +class PyIDebugApplicationNode: + def EnumChildren(self) -> None: ... + def GetParent(self) -> PyIDebugApplicationNode: ... + def SetDocumentProvider(self, pddp: PyIDebugDocumentProvider) -> None: ... + def Close(self) -> None: ... + def Attach(self, pdanParent: PyIDebugApplicationNode) -> None: ... + def Detach(self) -> None: ... + +class PyIDebugApplicationNodeEvents: + def onAddChild(self, prddpChild: PyIDebugApplicationNode) -> None: ... + def onRemoveChild(self, prddpChild: PyIDebugApplicationNode) -> None: ... + def onDetach(self) -> None: ... + def onAttach(self, prddpParent: PyIDebugApplicationNode) -> None: ... + +class PyIDebugApplicationThread: + def SynchronousCallIntoThread(self, pstcb, dwParam1, dwParam2, dwParam3) -> None: ... + def QueryIsCurrentThread(self) -> None: ... + def QueryIsDebuggerThread(self) -> None: ... + +class PyIDebugCodeContext: + def GetDocumentContext(self) -> None: ... + def SetBreakPoint(self, bps) -> None: ... + +class PyIDebugDocument: ... + +class PyIDebugDocumentContext: + def GetDocument(self) -> None: ... + def EnumCodeContexts(self) -> None: ... + +class PyIDebugDocumentHelper: + def Init(self, pda: PyIDebugApplication, pszShortName, pszLongName, docAttr) -> None: ... + def Attach(self, pddhParent: PyIDebugDocumentHelper) -> None: ... + def Detach(self) -> None: ... + def AddUnicodeText(self, pszText) -> None: ... + def AddDBCSText(self) -> None: ... + def SetDebugDocumentHost(self, pddh: PyIDebugDocumentHost) -> None: ... + def AddDeferredText(self, cChars, dwTextStartCookie) -> None: ... + def DefineScriptBlock(self, ulCharOffset, cChars, pas, fScriptlet) -> None: ... + def SetDefaultTextAttr(self, staTextAttr) -> None: ... + def SetTextAttributes(self, ulCharOffset, obAttr) -> None: ... + def SetLongName(self, pszLongName) -> None: ... + def SetShortName(self, pszShortName) -> None: ... + def SetDocumentAttr(self, pszAttributes) -> None: ... + def GetDebugApplicationNode(self) -> None: ... + def GetScriptBlockInfo(self, dwSourceContext) -> None: ... + def CreateDebugDocumentContext(self, iCharPos, cChars) -> None: ... + def BringDocumentToTop(self) -> None: ... + def BringDocumentContextToTop(self, pddc: PyIDebugDocumentContext) -> None: ... + +class PyIDebugDocumentHost: + def GetDeferredText(self, dwTextStartCookie, cMaxChars) -> None: ... + def GetScriptTextAttributes(self, pstrCode, pstrDelimiter, dwFlags) -> None: ... + def OnCreateDocumentContext(self) -> None: ... + def GetPathName(self) -> None: ... + def GetFileName(self) -> None: ... + def NotifyChanged(self) -> None: ... + +class PyIDebugDocumentInfo: + def GetName(self) -> None: ... + def GetDocumentClassId(self) -> PyIID: ... + +class PyIDebugDocumentProvider: + def GetDocument(self) -> PyIDebugDocument: ... + +class PyIDebugDocumentText: + def GetDocumentAttributes(self) -> None: ... + def GetSize(self) -> None: ... + def GetPositionOfLine(self, cLineNumber) -> None: ... + def GetLineOfPosition(self, cCharacterPosition) -> None: ... + def GetText(self, cCharacterPosition, cMaxChars, bWantAttr: int = ...) -> None: ... + def GetPositionOfContext(self, psc: PyIDebugDocumentContext) -> None: ... + def GetContextOfPosition(self, cCharacterPosition, cNumChars) -> None: ... + +class PyIDebugDocumentTextAuthor: + def InsertText(self, cCharacterPosition, cNumToInsert, pcharText) -> None: ... + def RemoveText(self, cCharacterPosition, cNumToRemove) -> None: ... + def ReplaceText(self, cCharacterPosition, cNumToReplace, pcharText) -> None: ... + +class PyIDebugDocumentTextEvents: + def onDestroy(self) -> None: ... + def onInsertText(self, cCharacterPosition, cNumToInsert) -> None: ... + def onRemoveText(self, cCharacterPosition, cNumToRemove) -> None: ... + def onReplaceText(self, cCharacterPosition, cNumToReplace) -> None: ... + def onUpdateTextAttributes(self, cCharacterPosition, cNumToUpdate) -> None: ... + def onUpdateDocumentAttributes(self, textdocattr) -> None: ... + +class PyIDebugDocumentTextExternalAuthor: + def GetPathName(self) -> None: ... + def GetFileName(self) -> None: ... + def NotifyChanged(self) -> None: ... + +class PyIDebugExpression: + def Start(self, pdecb: PyIDebugExpressionCallBack) -> None: ... + def Abort(self) -> None: ... + def QueryIsComplete(self) -> None: ... + def GetResultAsString(self) -> None: ... + def GetResultAsDebugProperties(self) -> None: ... + +class PyIDebugExpressionCallBack: + def onComplete(self) -> None: ... + +class PyIDebugExpressionContext: + def ParseLanguageText(self, pstrCode, nRadix, pstrDelimiter, dwFlags) -> None: ... + def GetLanguageInfo(self) -> None: ... + +class PyIDebugProperty: + def GetPropertyInfo(self, dwFieldSpec, nRadix) -> None: ... + def GetExtendedInfo(self) -> None: ... + def SetValueAsString(self, pszValue, nRadix) -> None: ... + def EnumMembers(self, dwFieldSpec, nRadix, refiid: PyIID) -> None: ... + def GetParent(self) -> None: ... + +class PyIDebugSessionProvider: + def StartDebugSession(self, pda: PyIRemoteDebugApplication) -> None: ... + +class PyIDebugStackFrame: + def GetCodeContext(self) -> None: ... + def GetDescriptionString(self, fLong): ... + def GetLanguageString(self, fLong): ... + def GetThread(self) -> PyIDebugApplicationThread: ... + +class PyIDebugStackFrameSniffer: + def EnumStackFrames(self) -> None: ... + +class PyIDebugStackFrameSnifferEx: + def EnumStackFramesEx(self) -> None: ... + +class PyIDebugSyncOperation: + def GetTargetThread(self) -> None: ... + def Execute(self) -> None: ... + def InProgressAbort(self) -> None: ... + +class PyIDefaultExtractIconInit: + def SetFlags(self, uFlags) -> None: ... + def SetKey(self, hkey: PyHKEY) -> None: ... + def SetNormalIcon(self, pszFile, iIcon) -> None: ... + def SetOpenIcon(self, pszFile, iIcon) -> None: ... + def SetShortcutIcon(self, pszFile, iIcon) -> None: ... + def SetDefaultIcon(self, pszFile, iIcon) -> None: ... + +class PyIDirectSound: + def Initialize(self, guid: PyIID) -> None: ... + def SetCooperativeLevel(self, hwnd: int, level) -> None: ... + def CreateSoundBuffer(self, lpDSCBufferDesc: PyDSCBUFFERDESC, unk: Incomplete | None = ...) -> None: ... + def GetCaps(self) -> None: ... + def Compact(self) -> None: ... + +class PyIDirectSoundBuffer: + def Initialize(self) -> None: ... + def GetStatus(self) -> None: ... + def GetCaps(self) -> None: ... + def Restore(self) -> None: ... + def GetCurrentPosition(self) -> None: ... + def Play(self) -> None: ... + def SetCurrentPosition(self) -> None: ... + def Stop(self) -> None: ... + def GetFrequency(self) -> None: ... + def GetPan(self) -> None: ... + def GetVolume(self) -> None: ... + def SetFrequency(self) -> None: ... + def SetPan(self) -> None: ... + def SetVolume(self) -> None: ... + +class PyIDirectSoundCapture: + def Initialize(self) -> None: ... + def GetCaps(self) -> None: ... + +class PyIDirectSoundCaptureBuffer: + def Initialize(self) -> None: ... + def GetStatus(self) -> None: ... + def GetCurrentPosition(self) -> None: ... + def Stop(self) -> None: ... + +class PyIDirectSoundNotify: ... + +class PyIDirectoryObject: + def GetObjectInformation(self) -> PyADS_OBJECT_INFO: ... + def GetObjectAttributes(self, names: tuple[str, ...]) -> tuple[PyADS_ATTR_INFO, ...]: ... + def SetObjectAttributes(self, attrs: tuple[PyADS_ATTR_INFO, ...]): ... + def CreateDSObject(self, rdn: str, attrs: tuple[PyADS_ATTR_INFO, ...]) -> PyIDispatch: ... + def DeleteDSObject(self, rdn: str) -> None: ... + +class PyIDirectorySearch: + def SetSearchPreference(self, prefs) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def ExecuteSearch(self, _filter: str, attrNames: list[str]): ... + def GetNextRow(self, handle): ... + def GetFirstRow(self, handle): ... + def GetPreviousRow(self, handle): ... + def CloseSearchHandle(self, handle) -> None: ... + def AdandonSearch(self, handle) -> None: ... + def GetColumn(self, handle, name: str) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def GetNextColumnName(self) -> None: ... + +class PyIDispatch: + def Invoke(self, dispid, lcid, flags, bResultWanted, arg: tuple[Incomplete, ...]): ... + def InvokeTypes( + self, dispid, lcid, wFlags, resultTypeDesc, typeDescs: tuple[Incomplete, ...], args: tuple[Incomplete, ...] + ): ... + def GetIDsOfNames(self, name: str, arg) -> tuple[Incomplete, Incomplete]: ... + def GetTypeInfo(self, locale, index: int = ...) -> PyITypeInfo: ... + def GetTypeInfoCount(self): ... + +class PyIDispatchEx: + def GetDispID(self, name: str, fdex): ... + def InvokeEx( + self, + dispid, + lcid, + flags, + args: list[Incomplete], + types: list[Incomplete] | None = ..., + returnDesc: int = ..., + serviceProvider: PyIServiceProvider | None = ..., + ): ... + def DeleteMemberByName(self, name: str, fdex) -> None: ... + def DeleteMemberByDispID(self, dispid) -> None: ... + def GetMemberProperties(self, dispid, fdex): ... + def GetMemberName(self, dispid): ... + def GetNextDispID(self, fdex, dispid): ... + +class PyIDisplayItem: ... + +class PyIDocHostUIHandler: + def ShowContextMenu( + self, dwID, pt: tuple[Incomplete, Incomplete], pcmdtReserved: PyIUnknown, pdispReserved: PyIDispatch + ) -> None: ... + def GetHostInfo(self) -> None: ... + def ShowUI( + self, + dwID, + pActiveObject: PyIOleInPlaceActiveObject, + pCommandTarget: PyIOleCommandTarget, + pFrame: PyIOleInPlaceFrame, + pDoc: PyIOleInPlaceUIWindow, + ) -> None: ... + def HideUI(self) -> None: ... + def UpdateUI(self) -> None: ... + def EnableModeless(self, fEnable) -> None: ... + def OnDocWindowActivate(self, fActivate) -> None: ... + def OnFrameWindowActivate(self, fActivate) -> None: ... + def ResizeBorder( + self, prcBorder: tuple[Incomplete, Incomplete, Incomplete, Incomplete], pUIWindow: PyIOleInPlaceUIWindow, fRameWindow + ) -> None: ... + def TranslateAccelerator(self, lpMsg, pguidCmdGroup: PyIID, nCmdID) -> None: ... + def GetOptionKeyPath(self, dw) -> None: ... + def GetDropTarget(self, pDropTarget: PyIDropTarget) -> None: ... + def GetExternal(self) -> None: ... + def TranslateUrl(self, dwTranslate, pchURLIn) -> None: ... + def FilterDataObject(self, pDO: PyIDataObject) -> None: ... + +class PyIDropSource: + def QueryContinueDrag(self, fEscapePressed, grfKeyState) -> None: ... + def GiveFeedback(self, dwEffect) -> None: ... + +class PyIDropTarget: + def DragEnter(self, pDataObj: PyIDataObject, grfKeyState, pt: tuple[Incomplete, Incomplete], pdwEffect): ... + def DragOver(self, grfKeyState, pt: tuple[Incomplete, Incomplete], pdwEffect): ... + def DragLeave(self) -> None: ... + def Drop(self, pDataObj: PyIDataObject, grfKeyState, pt: tuple[Incomplete, Incomplete], dwEffect): ... + +class PyIDropTargetHelper: + def DragEnter(self, hwnd: int, pDataObj: PyIDataObject, pt: tuple[Incomplete, Incomplete], dwEffect) -> None: ... + def DragOver(self, hwnd: int, pt: tuple[Incomplete, Incomplete], pdwEffect) -> None: ... + def DragLeave(self) -> None: ... + def Drop(self, pDataObj: PyIDataObject, pt: tuple[Incomplete, Incomplete], dwEffect) -> None: ... + +class PyIDsObjectPicker: + def Initialize( + self, targetComputer: str, scopeInfos: PyDSOP_SCOPE_INIT_INFOs, options: int = ..., attrNames: list[str] | None = ... + ) -> None: ... + def InvokeDialog(self, hwnd: int) -> PyIDataObject: ... + +class PyIEmptyVolumeCache: ... +class PyIEmptyVolumeCache2: ... + +class PyIEmptyVolumeCacheCallBack: + def ScanProgress(self, dwlSpaceUsed, dwFlags, pcwszStatus) -> None: ... + def PurgeProgress(self, dwlSpaceFreed, spaceFreed, spaceToFree, flags, status) -> None: ... + +class PyIEnumCATEGORYINFO: + def Next(self, num: int = ...) -> tuple[tuple[PyIID, Incomplete, str], ...]: ... + def Skip(self, num) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumCATEGORYINFO: ... + +class PyIEnumConnectionPoints: + def Next(self, num: int = ...) -> tuple[PyIConnectionPoint, ...]: ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumConnectionPoints: ... + +class PyIEnumConnections: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumConnections: ... + +class PyIEnumContextProps: + def Next(self, num: int = ...) -> tuple[tuple[PyIID, Incomplete, PyIUnknown], ...]: ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumContextProps: ... + +class PyIEnumDebugApplicationNodes: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumDebugApplicationNodes: ... + +class PyIEnumDebugCodeContexts: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumDebugCodeContexts: ... + +class PyIEnumDebugExpressionContexts: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumDebugExpressionContexts: ... + +class PyIEnumDebugPropertyInfo: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumDebugPropertyInfo: ... + def GetCount(self): ... + +class PyIEnumDebugStackFrames: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumDebugStackFrames: ... + +class PyIEnumExplorerCommand: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumExplorerCommand: ... + +class PyIEnumFORMATETC: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumFORMATETC: ... + +class PyIEnumGUID: + def Next(self, num: int = ...) -> tuple[PyIID, ...]: ... + def Skip(self, num) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumGUID: ... + +class PyIEnumIDlist: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumIDlist: ... + +class PyIEnumMoniker: + def Next(self, num: int = ...) -> PyIMoniker: ... + def Skip(self, num) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumMoniker: ... + +class PyIEnumObjects: + def Next(self, riid: PyIID, num: int = ...) -> tuple[PyIUnknown, ...]: ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumObjects: ... + +class PyIEnumRemoteDebugApplicationThreads: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumRemoteDebugApplicationThreads: ... + +class PyIEnumRemoteDebugApplications: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumRemoteDebugApplications: ... + +class PyIEnumResources: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumResources: ... + +class PyIEnumSTATPROPSETSTG: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumSTATPROPSETSTG: ... + +class PyIEnumSTATPROPSTG: + def Next(self, num: int = ...): ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumSTATPROPSTG: ... + +class PyIEnumSTATSTG: + def Next(self, num: int = ...) -> tuple[STATSTG, ...]: ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumSTATSTG: ... + +class PyIEnumShellItems: + def Next(self, num: int = ...) -> tuple[PyIShellItem, ...]: ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumShellItems: ... + +class PyIEnumString: + def Next(self, num: int = ...) -> tuple[str, ...]: ... + def Skip(self) -> None: ... + def Reset(self) -> None: ... + def Clone(self) -> PyIEnumString: ... + +class PyIErrorLog: + def AddError(self, propName: str, excepInfo: Incomplete | None = ...) -> None: ... + +class PyIExplorerBrowser: + def Initialize(self, hwndParent, prc: PyRECT, pfs) -> None: ... + def Destroy(self) -> None: ... + def SetRect(self, hdwp, rcBrowser: PyRECT) -> int: ... + def SetPropertyBag(self, PropertyBag) -> None: ... + def SetEmptyText(self, EmptyText) -> None: ... + def SetFolderSettings(self, pfs) -> None: ... + def Advise(self, psbe: PyIExplorerBrowserEvents): ... + def Unadvise(self, dwCookie) -> None: ... + def SetOptions(self, dwFlag) -> None: ... + def GetOptions(self): ... + def BrowseToIDlist(self, pidl, uFlags) -> None: ... + def BrowseToObject(self, punk: PyIUnknown, uFlags) -> None: ... + def FillFromObject(self, punk: PyIUnknown, dwFlags) -> None: ... + def RemoveAll(self) -> None: ... + def GetCurrentView(self, riid: PyIID) -> PyIUnknown: ... + +class PyIExplorerBrowserEvents: + def OnNavigationPending(self, pidlFolder) -> None: ... + def OnViewCreated(self, psv: PyIShellView) -> None: ... + def OnNavigationComplete(self, pidlFolder) -> None: ... + def OnNavigationFailed(self, pidlFolder) -> None: ... + +class PyIExplorerCommand: + def GetTitle(self, psiItemArray: PyIShellItemArray): ... + def GetIcon(self, psiItemArray: PyIShellItemArray): ... + def GetToolTip(self, psiItemArray: PyIShellItemArray): ... + def GetCanonicalName(self) -> PyIID: ... + def GetState(self, psiItemArray: PyIShellItemArray, fOkToBeSlow): ... + def Invoke(self, psiItemArray: PyIShellItemArray, pbc: PyIBindCtx) -> None: ... + def GetFlags(self): ... + def EnumSubCommands(self) -> PyIEnumExplorerCommand: ... + +class PyIExplorerCommandProvider: ... +class PyIExplorerPaneVisibility: ... + +class PyIExternalConnection: + def AddConnection(self, extconn, reserved: int = ...): ... + def ReleaseConnection(self, extconn, reserved, fLastReleaseCloses): ... + +class PyIExtractIcon: + def Extract(self, pszFile, nIconIndex, nIconSize) -> None: ... + def GetIconLocation(self, uFlags, cchMax) -> None: ... + +class PyIExtractIconW: + def Extract(self, pszFile, nIconIndex, nIconSize) -> None: ... + def GetIconLocation(self, uFlags, cchMax) -> None: ... + +class PyIExtractImage: + def GetLocation(self, dwPriority, size: tuple[Incomplete, Incomplete], dwRecClrDepth, pdwFlags) -> None: ... + def Extract(self) -> None: ... + +class PyIFileOperation: + def Advise(self, Sink: PyGFileOperationProgressSink): ... + def Unadvise(self, Cookie) -> None: ... + def SetOperationFlags(self, OperationFlags) -> None: ... + def SetProgressMessage(self, Message) -> None: ... + def SetProgressDialog(self, popd) -> None: ... + def SetProperties(self, proparray: PyIPropertyChangeArray) -> None: ... + def SetOwnerWindow(self, Owner: int) -> None: ... + def ApplyPropertiesToItem(self, Item: PyIShellItem) -> None: ... + def ApplyPropertiesToItems(self, Items: PyIUnknown) -> None: ... + def RenameItem(self, Item: PyIShellItem, NewName, Sink: PyGFileOperationProgressSink | None = ...) -> None: ... + def RenameItems(self, pUnkItems: PyIUnknown, NewName) -> None: ... + def MoveItem( + self, + Item: PyIShellItem, + DestinationFolder: PyIShellItem, + pszNewName: Incomplete | None = ..., + Sink: PyGFileOperationProgressSink | None = ..., + ) -> None: ... + def MoveItems(self, Items: PyIUnknown, DestinationFolder: PyIShellItem) -> None: ... + def CopyItem( + self, + Item: PyIShellItem, + DestinationFolder: PyIShellItem, + CopyName: Incomplete | None = ..., + Sink: PyGFileOperationProgressSink | None = ..., + ) -> None: ... + def CopyItems(self, Items: PyIUnknown, DestinationFolder: PyIShellItem) -> None: ... + def DeleteItem(self, Item: PyIShellItem, Sink: PyGFileOperationProgressSink | None = ...) -> None: ... + def DeleteItems(self, Items: PyIUnknown) -> None: ... + def NewItem( + self, + DestinationFolder: PyIShellItem, + FileAttributes, + Name, + TemplateName: Incomplete | None = ..., + Sink: PyGFileOperationProgressSink | None = ..., + ) -> None: ... + def PerformOperations(self) -> None: ... + def GetAnyOperationsAborted(self): ... + +class PyIIdentityName: ... + +class PyIInitializeWithFile: + def Initialize(self, FilePath, Mode) -> None: ... + +class PyIInitializeWithStream: + def Initialize(self, Stream: PyIStream, Mode) -> None: ... + +class PyIInputObject: + def TranslateAccelerator(self, pmsg) -> None: ... + def UIActivate(self, uState) -> None: ... + def HasFocusIO(self) -> None: ... + +class PyIInternetBindInfo: + def GetBindInfo(self) -> None: ... + def GetBindString(self) -> None: ... + +class PyIInternetPriority: + def SetPriority(self, nPriority) -> None: ... + def GetPriority(self) -> None: ... + +class PyIInternetProtocol: + def Read(self, cb) -> None: ... + def Seek(self, dlibMove: LARGE_INTEGER, dwOrigin) -> None: ... + def LockRequest(self, dwOptions) -> None: ... + def UnlockRequest(self) -> None: ... + +class PyIInternetProtocolInfo: + def ParseUrl(self, pwzUrl, ParseAction, dwParseFlags, cchResult, dwReserved) -> None: ... + def CombineUrl(self, pwzBaseUrl, pwzRelativeUrl, dwCombineFlags, cchResult, dwReserved) -> None: ... + def CompareUrl(self, pwzUrl1, pwzUrl2, dwCompareFlags) -> None: ... + def QueryInfo(self, pwzUrl, OueryOption, dwQueryFlags, cbBuffer, dwReserved): ... + +class PyIInternetProtocolRoot: + def Start(self, szUrl, pOIProtSink: PyIInternetProtocolSink, pOIBindInfo: PyIInternetBindInfo, grfPI, dwReserved) -> None: ... + def Continue(self) -> None: ... + def Abort(self, hrReason, dwOptions) -> None: ... + def Terminate(self, dwOptions) -> None: ... + def Suspend(self) -> None: ... + def Resume(self) -> None: ... + +class PyIInternetProtocolSink: + def Switch(self) -> None: ... + def ReportProgress(self, ulStatusCode, szStatusText) -> None: ... + def ReportData(self, grfBSCF, ulProgress, ulProgressMax) -> None: ... + def ReportResult(self, hrResult, dwError, szResult) -> None: ... + +class PyIInternetSecurityManager: + def SetSecuritySite(self, pSite) -> None: ... + def GetSecuritySite(self) -> None: ... + def MapUrlToZone(self, pwszUrl, dwFlags) -> None: ... + def GetSecurityId(self, pwszUrl, pcbSecurityId) -> None: ... + def ProcessUrlAction(self, pwszUrl, dwAction, context, dwFlags) -> None: ... + def SetZoneMapping(self, dwZone, lpszPattern, dwFlags) -> None: ... + def GetZoneMappings(self, dwZone, dwFlags) -> None: ... + +class PyIKnownFolder: + def GetId(self) -> PyIID: ... + def GetCategory(self): ... + def GetShellItem(self, riid: PyIID, Flags: int = ...) -> PyIShellItem: ... + def GetPath(self, Flags: int = ...): ... + def SetPath(self, Flags, Path) -> None: ... + def GetIDlist(self, Flags) -> PyIDL: ... + def GetFolderType(self) -> PyIID: ... + def GetRedirectionCapabilities(self): ... + def GetFolderDefinition(self): ... + +class PyIKnownFolderManager: + def FolderIdFromCsidl(self, Csidl) -> PyIID: ... + def FolderIdToCsidl(self, _id: PyIID): ... + def GetFolderIds(self) -> tuple[PyIID, ...]: ... + def GetFolder(self, _id: PyIID) -> PyIKnownFolder: ... + def GetFolderByName(self, Name) -> PyIKnownFolder: ... + def RegisterFolder(self, _id: PyIID, Definition) -> None: ... + def UnregisterFolder(self, _id: PyIID) -> None: ... + def FindFolderFromPath(self, Path, Mode) -> PyIKnownFolder: ... + def FindFolderFromIDlist(self, pidl: PyIDL) -> PyIKnownFolder: ... + def Redirect(self, _id: PyIID, hwnd: int, flags, TargetPath, Exclusion: tuple[PyIID, ...]) -> None: ... + +class PyILockBytes: + def ReadAt(self, ulOffset: ULARGE_INTEGER, cb) -> str: ... + def WriteAt(self, ulOffset: ULARGE_INTEGER, data: str): ... + def Flush(self) -> None: ... + def SetSize(self, cb: ULARGE_INTEGER) -> None: ... + def LockRegion(self, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType) -> None: ... + def UnlockRegion(self, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType) -> None: ... + def Stat(self, grfStatFlag) -> STATSTG: ... + +class PyIMAPIContainer: + def OpenEntry(self, entryId: str, iid: PyIID, flags): ... + def GetContentsTable(self, flags) -> PyIMAPITable: ... + def GetHierarchyTable(self, flags) -> PyIMAPITable: ... + +class PyIMAPIFolder: + def GetLastError(self, hr, flags): ... + def CreateFolder( + self, folderType, folderName: str, folderComment: str | None = ..., iid: PyIID | None = ..., flags=... + ) -> PyIMAPIFolder: ... + def CreateMessage(self, iid: PyIID, flags) -> PyIMessage: ... + def CopyMessages(self, msgs: PySBinaryArray, iid: PyIID, folder: PyIMAPIFolder, ulUIParam, progress, flags): ... + def DeleteFolder(self, entryId: str, uiParam, progress) -> None: ... + def DeleteMessages(self, msgs: PySBinaryArray, uiParam, progress, flags): ... + def EmptyFolder(self, uiParam, progress, flags): ... + def SetReadFlags(self, msgs: PySBinaryArray, uiParam, progress, flag) -> None: ... + +class PyIMAPIProp: + def GetProps(self, proplist: PySPropTagArray, flags: int = ...) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def DeleteProps(self, proplist: PySPropTagArray, wantProblems: bool = ...) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def SetProps( + self, proplist: tuple[Incomplete, Incomplete], wantProblems: bool = ... + ) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def CopyTo( + self, + IIDExcludelist: tuple[Incomplete, Incomplete], + propTags: PySPropTagArray, + uiParam, + progress, + resultIID: PyIID, + dest: PyIMAPIProp, + flags, + wantProblems: bool = ..., + ) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def CopyProps( + self, propTags: PySPropTagArray, uiParam, progress, resultIID: PyIID, dest: PyIMAPIProp, flags, wantProblems: bool = ... + ) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def OpenProperty(self, propTag, iid: PyIID, interfaceOptions, flags) -> PyIUnknown: ... + def GetIDsFromNames(self, nameIds: PyMAPINAMEIDArray, flags: int = ...) -> PySPropTagArray: ... + def GetNamesFromIDs( + self, propTags: PySPropTagArray, propSetGuid: PyIID | None = ..., flags=... + ) -> tuple[Incomplete, PySPropTagArray, PyMAPINAMEIDArray]: ... + def GetLastError(self, hr, flags): ... + def SaveChanges(self, flags) -> None: ... + def GetProplist(self, flags) -> PySPropTagArray: ... + +class PyIMAPISession: + def OpenEntry(self, entryId: str, iid: PyIID, flags): ... + def OpenMsgStore(self, uiParam, entryId: str, iid: PyIID, flags) -> PyIUnknown: ... + def QueryIdentity(self) -> str: ... + def Advise(self, entryId: str, mask, sink): ... + def Unadvise(self, connection) -> None: ... + def CompareEntryIDs(self, entryId: str, entryId1: str, flags: int = ...): ... + def GetLastError(self, hr, flags): ... + def GetMsgStoresTable(self, flags) -> PyIMAPITable: ... + def GetStatusTable(self, flags) -> PyIMAPITable: ... + def Logoff(self, uiParm, flags, reserved) -> None: ... + def OpenAddressBook(self, uiParm, iid: PyIID, flags) -> PyIAddrBook: ... + def OpenProfileSection(self, iidSection: PyIID, iid: PyIID, flags): ... + def AdminServices(self, flags: int = ...) -> PyIMsgServiceAdmin: ... + +class PyIMAPIStatus: + def ChangePassword(self, oldPassword, newPassword, ulFlags) -> None: ... + def SettingsDialog(self, ulUIParam, ulFlags) -> None: ... + def ValidateState(self, ulUIParam, ulFlags) -> None: ... + def FlushQueues(self, ulUIParam, transport: str, ulFlags) -> None: ... + +class PyIMAPITable: + def GetLastError(self, hr, flags): ... + def Advise(self, eventMask, adviseSink): ... + def SeekRow(self, bookmark, rowCount): ... + def SeekRowApprox(self, numerator, denominator) -> None: ... + def GetRowCount(self, flags): ... + def QueryRows(self, rowCount, flags): ... + def SetColumns(self, propTags, flags) -> None: ... + def GetStatus(self) -> None: ... + def QueryPosition(self) -> None: ... + def QueryColumns(self, flags): ... + def Abort(self) -> None: ... + def FreeBookmark(self, bookmark) -> None: ... + def CreateBookmark(self): ... + def Restrict(self, restriction: PySRestriction, flags) -> None: ... + def FindRow(self, restriction: PySRestriction, bookmarkOrigin, flags) -> None: ... + def SortTable(self, sortOrderSet: PySSortOrderSet, flags) -> None: ... + def Unadvise(self, handle) -> None: ... + +class PyIMachineDebugManager: + def AddApplication(self, pda: PyIRemoteDebugApplication) -> None: ... + def RemoveApplication(self, dwAppCookie) -> None: ... + def EnumApplications(self) -> None: ... + +class PyIMachineDebugManagerEvents: + def onAddApplication(self, pda: PyIRemoteDebugApplication, dwAppCookie) -> None: ... + def onRemoveApplication(self, pda: PyIRemoteDebugApplication, dwAppCookie) -> None: ... + +class PyIMessage: + def SetReadFlag(self, flag) -> None: ... + def GetAttachmentTable(self, flags) -> PyIMAPITable: ... + def OpenAttach(self, attachmentNum, interface: PyIID, flags) -> PyIAttach: ... + def CreateAttach(self, interface: PyIID, flags) -> tuple[Incomplete, PyIAttach]: ... + def DeleteAttach(self, attachmentNum, ulUIParam, interface, flags) -> None: ... + def ModifyRecipients(self, flags, mods) -> None: ... + def GetRecipientTable(self, flags) -> PyIMAPITable: ... + def SubmitMessage(self, flags) -> None: ... + +class PyIMoniker: + def BindToObject(self, bindCtx: PyIBindCtx, moniker: PyIMoniker, iidResult) -> PyIUnknown: ... + def BindToStorage(self, bindCtx: PyIBindCtx, moniker: PyIMoniker, iidResult) -> PyIUnknown: ... + def GetDisplayName(self, bindCtx: PyIBindCtx, moniker: PyIMoniker) -> str: ... + def ComposeWith(self, mkRight: PyIMoniker, fOnlyIfNotGeneric) -> PyIMoniker: ... + def Enum(self, fForward: bool = ...) -> PyIEnumMoniker: ... + def IsEqual(self, other: PyIMoniker) -> bool: ... + def IsSystemMoniker(self) -> bool: ... + def Hash(self): ... + +class PyIMsgServiceAdmin: + def GetLastError(self, hr, flags): ... + def CreateMsgService(self, serviceName: str, displayName: str, flags, uiParam: int = ...) -> None: ... + def ConfigureMsgService(self, iid: PyIID, ulUIParam, ulFlags, arg: list[Incomplete]) -> None: ... + def GetMsgServiceTable(self, flags) -> PyIMAPITable: ... + def GetProviderTable(self, flags) -> PyIMAPITable: ... + def DeleteMsgService(self, uuid: PyIID) -> None: ... + def RenameMsgService(self, uuid: PyIID, flags, newName: str) -> None: ... + def OpenProfileSection(self, uuid: PyIID, iid: PyIID, flags): ... + def AdminProviders(self, uuid: PyIID, flags): ... + +class PyIMsgStore: + def OpenEntry(self, entryId: str, iid: PyIID, flags): ... + def GetReceiveFolder(self, messageClass: str | None = ..., flags: int = ...) -> tuple[PyIID, str]: ... + def GetReceiveFolderTable(self, flags) -> PyIMAPITable: ... + def CompareEntryIDs(self, entryId: str, entryId1: str, flags: int = ...): ... + def GetLastError(self, hr, flags): ... + def AbortSubmit(self, entryId: str, flags: int = ...): ... + def Advise(self, entryId: str, eventMask, adviseSink) -> None: ... + def Unadvise(self, connection) -> None: ... + +class PyINameSpaceTreeControl: + def Initialize(self, hwndParent, prc: tuple[Incomplete, Incomplete, Incomplete, Incomplete], nsctsFlags) -> None: ... + def TreeAdvise(self, punk: PyIUnknown) -> None: ... + def TreeUnadvise(self, dwCookie) -> None: ... + def AppendRoot(self, psiRoot: PyIShellItem, grfEnumFlags, grfRootStyle, pif) -> None: ... + def InsertRoot(self, iIndex, psiRoot: PyIShellItem, grfEnumFlags, grfRootStyle, pif) -> None: ... + def RemoveRoot(self, psiRoot: PyIShellItem) -> None: ... + def RemoveAllRoots(self) -> None: ... + def GetRootItems(self) -> None: ... + def SetItemState(self, psi: PyIShellItem, nstcisMask, nstcisFlags) -> None: ... + def GetItemState(self, psi: PyIShellItem, nstcisMask) -> None: ... + def GetSelectedItems(self) -> None: ... + def GetItemCustomState(self, psi: PyIShellItem) -> None: ... + def SetItemCustomState(self, psi: PyIShellItem, iStateNumber) -> None: ... + def EnsureItemVisible(self, psi: PyIShellItem) -> None: ... + def SetTheme(self, pszTheme) -> None: ... + def GetNextItem(self, psi: PyIShellItem, nstcgi) -> None: ... + def HitTest(self, pt: tuple[Incomplete, Incomplete]) -> None: ... + def GetItemRect(self) -> None: ... + def CollapseAll(self) -> None: ... + +class PyINamedPropertyStore: + def GetNamedValue(self, Name) -> PyPROPVARIANT: ... + def SetNamedValue(self, propvar) -> None: ... + def GetNameCount(self): ... + def GetNameAt(self, Index): ... + +class PyIObjectArray: + def GetCount(self): ... + def GetAt(self, Index, riid: PyIID) -> PyIUnknown: ... + +class PyIObjectCollection: + def AddObject(self, punk: PyIUnknown) -> None: ... + def AddFromArray(self, Source: PyIObjectArray) -> None: ... + def RemoveObjectAt(self, Index) -> None: ... + def Clear(self) -> None: ... + +class PyIObjectWithPropertyKey: + def SetPropertyKey(self, key: PyPROPERTYKEY) -> None: ... + def GetPropertyKey(self) -> PyPROPERTYKEY: ... + +class PyIObjectWithSite: + def SetSite(self, pUnkSite) -> None: ... + def GetSite(self, riid: PyIID) -> None: ... + +class PyIOleClientSite: + def SaveObject(self) -> None: ... + def GetMoniker(self, dwAssign, dwWhichMoniker) -> None: ... + def GetContainer(self) -> None: ... + def ShowObject(self) -> None: ... + def OnShowWindow(self, fShow) -> None: ... + def RequestNewObjectLayout(self) -> None: ... + +class PyIOleCommandTarget: + def QueryStatus(self) -> None: ... + def Exec(self) -> None: ... + +class PyIOleControl: + def GetControlInfo(self) -> None: ... + def OnMnemonic(self, msg) -> None: ... + def OnAmbientPropertyChange(self, dispID) -> None: ... + def FreezeEvents(self, bFreeze) -> None: ... + +class PyIOleControlSite: + def OnControlInfoChanged(self) -> None: ... + def LockInPlaceActive(self, fLock) -> None: ... + def GetExtendedControl(self) -> None: ... + def TransformCoords( + self, PtlHimetric: tuple[Incomplete, Incomplete], pPtfContainer: tuple[float, float], dwFlags + ) -> None: ... + def TranslateAccelerator(self, pMsg: PyMSG, grfModifiers) -> None: ... + def OnFocus(self, fGotFocus) -> None: ... + def ShowPropertyFrame(self) -> None: ... + +class PyIOleInPlaceActiveObject: + def TranslateAccelerator(self, lpmsg: PyMSG) -> None: ... + def OnFrameWindowActivate(self, fActivate) -> None: ... + def OnDocWindowActivate(self, fActivate) -> None: ... + def ResizeBorder( + self, rcBorder: tuple[Incomplete, Incomplete, Incomplete, Incomplete], pUIWindow: PyIOleInPlaceUIWindow, fFrameWindow + ) -> None: ... + def EnableModeless(self, fEnable) -> None: ... + +class PyIOleInPlaceFrame: + def InsertMenus(self, hmenuShared, menuWidths: PyOLEMENUGROUPWIDTHS) -> None: ... + def SetMenu(self, hmenuShared, holemenu, hwndActiveObject) -> None: ... + def RemoveMenus(self, hmenuShared) -> None: ... + def SetStatusText(self, pszStatusText) -> None: ... + def EnableModeless(self, fEnable) -> None: ... + def TranslateAccelerator(self, lpmsg: PyMSG, wID) -> None: ... + +class PyIOleInPlaceObject: + def InPlaceDeactivate(self) -> None: ... + def UIDeactivate(self) -> None: ... + def SetObjectRects(self) -> None: ... + def ReactivateAndUndo(self) -> None: ... + +class PyIOleInPlaceSite: + def CanInPlaceActivate(self) -> None: ... + def OnInPlaceActivate(self) -> None: ... + def OnUIActivate(self) -> None: ... + def GetWindowContext(self) -> None: ... + def Scroll(self) -> None: ... + def OnUIDeactivate(self, fUndoable) -> None: ... + def OnInPlaceDeactivate(self) -> None: ... + def DiscardUndoState(self) -> None: ... + def DeactivateAndUndo(self) -> None: ... + def OnPosRectChange(self) -> None: ... + +class PyIOleInPlaceSiteEx: + def OnInPlaceActivateEx(self, dwFlags) -> None: ... + def OnInPlaceDeactivateEx(self, fNoRedraw) -> None: ... + def RequestUIActivate(self) -> None: ... + +class PyIOleInPlaceSiteWindowless: + def CanWindowlessActivate(self) -> None: ... + def GetCapture(self) -> None: ... + def SetCapture(self, fCapture) -> None: ... + def GetFocus(self) -> None: ... + def SetFocus(self, fFocus) -> None: ... + def GetDC(self, grfFlags, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def ReleaseDC(self, hDC) -> None: ... + def InvalidateRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], fErase) -> None: ... + def InvalidateRgn(self, hRgn, fErase) -> None: ... + def ScrollRect(self, dx, dy) -> None: ... + def AdjustRect(self) -> None: ... + def OnDefWindowMessage(self, msg, wParam, lParam) -> None: ... + +class PyIOleInPlaceUIWindow: + def GetBorder(self) -> None: ... + def RequestBorderSpace(self, borderwidths: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def SetBorderSpace(self, borderwidths: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def SetActiveObject(self, pActiveObject: PyIOleInPlaceActiveObject, pszObjName) -> None: ... + +class PyIOleObject: + def SetClientSite(self, pClientSite: PyIOleClientSite) -> None: ... + def GetClientSite(self) -> None: ... + def SetHostNames(self, szContainerApp, szContainerObj) -> None: ... + def Close(self, dwSaveOption) -> None: ... + def SetMoniker(self, dwWhichMoniker, pmk: PyIMoniker) -> None: ... + def GetMoniker(self, dwAssign, dwWhichMoniker) -> None: ... + def InitFromData(self, pDataObject: PyIDataObject, fCreation, dwReserved) -> None: ... + def GetClipboardData(self, dwReserved) -> None: ... + def DoVerb( + self, + iVerb, + msg: PyMSG, + pActiveSite: PyIOleClientSite, + lindex, + hwndParent, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + ) -> None: ... + def EnumVerbs(self) -> None: ... + def Update(self) -> None: ... + def IsUpToDate(self) -> bool: ... + def GetUserClassID(self) -> None: ... + def GetUserType(self, dwFormOfType) -> None: ... + def SetExtent(self, dwDrawAspect, size: tuple[Incomplete, Incomplete]) -> None: ... + def GetExtent(self, dwDrawAspect, size: tuple[Incomplete, Incomplete]) -> None: ... + def Advise(self, pAdvSink) -> None: ... + def Unadvise(self, dwConnection) -> None: ... + def EnumAdvise(self) -> None: ... + def GetMiscStatus(self, dwAspect) -> None: ... + def SetColorScheme(self) -> None: ... + +class PyIOleWindow: + def GetWindow(self) -> None: ... + def ContextSensitiveHelp(self, fEnterMode) -> None: ... + +class PyIPersist: + def GetClassID(self) -> PyIID: ... + +class PyIPersistFile: + def IsDirty(self) -> bool: ... + def Load(self, FileName, Mode) -> None: ... + def Save(self, FileName, fRemember) -> None: ... + def SaveCompleted(self, FileName) -> None: ... + def GetCurFile(self): ... + +class PyIPersistFolder: + def Initialize(self, pidl: PyIDL) -> None: ... + +class PyIPersistFolder2: + def GetCurFolder(self) -> None: ... + +class PyIPersistPropertyBag: + def InitNew(self) -> None: ... + def Load(self, bag: PyIPropertyBag, log: PyIErrorLog | None = ...) -> None: ... + def Save(self, bag: PyIPropertyBag, clearDirty, saveProperties) -> None: ... + +class PyIPersistSerializedPropStorage: + def SetFlags(self, flags) -> None: ... + def SetPropertyStorage(self, ps) -> None: ... + def GetPropertyStorage(self): ... + +class PyIPersistStorage: + def IsDirty(self) -> bool: ... + def InitNew(self, PyIStorage: PyIStorage) -> None: ... + def Load(self, storage: PyIStorage) -> None: ... + def Save(self, PyIStorage: PyIStorage, _int) -> None: ... + def SaveCompleted(self, PyIStorage: PyIStorage) -> None: ... + def HandsOffStorage(self) -> None: ... + +class PyIPersistStream: + def IsDirty(self) -> bool: ... + def Load(self, stream: PyIStream) -> None: ... + def Save(self, stream: PyIStream, bClearDirty) -> None: ... + def GetSizeMax(self) -> ULARGE_INTEGER: ... + +class PyIPersistStreamInit: + def InitNew(self) -> None: ... + +class PyIProcessDebugManager: + def CreateApplication(self) -> None: ... + def GetDefaultApplication(self) -> None: ... + def AddApplication(self, pda: PyIDebugApplication) -> None: ... + def RemoveApplication(self, dwAppCookie) -> None: ... + def CreateDebugDocumentHelper(self, unkOuter) -> None: ... + +class PyIProfAdmin: + def GetLastError(self, hr, flags): ... + def CreateProfile(self, oldProfileName: str, Password: str, uiParam: int = ..., flags: int = ...) -> None: ... + def DeleteProfile(self, oldProfileName: str, flags: int = ...) -> None: ... + def CopyProfile(self, oldProfileName: str, Password: str, newProfileName: str, uiParam: int = ..., flags=...) -> None: ... + def RenameProfile(self, oldProfileName: str, Password: str, newProfileName: str, uiParam: int = ..., flags=...) -> None: ... + def SetDefaultProfile(self, profileName: str, flags: int = ...) -> None: ... + def AdminServices(self, profileName: str, Password: str | None = ..., uiParam: int = ..., flags=...) -> PyIProfAdmin: ... + +class PyIPropertyBag: + def Read(self, propName, propType, errorLog: PyIErrorLog | None = ...): ... + def Write(self, propName, value) -> None: ... + +class PyIPropertyChange: + def ApplyToPropVariant(self, OrigVal: PyPROPVARIANT) -> PyPROPVARIANT: ... + +class PyIPropertyChangeArray: + def GetCount(self): ... + def GetAt(self, Index, riid: PyIID) -> PyIPropertyChange: ... + def InsertAt(self, Index, PropChange: PyIPropertyChange) -> None: ... + def Append(self, PropChange: PyIPropertyChange) -> None: ... + def AppendOrReplace(self, PropChange: PyIPropertyChange) -> None: ... + def RemoveAt(self, Index) -> None: ... + def IsKeyInArray(self, key: PyPROPERTYKEY) -> bool: ... + +class PyIPropertyDescription: + def GetPropertyKey(self) -> PyPROPERTYKEY: ... + def GetCanonicalName(self): ... + def GetPropertyType(self): ... + def GetDisplayName(self): ... + def GetEditInvitation(self): ... + def GetTypeFlags(self, mask): ... + def GetViewFlags(self): ... + def GetDefaultColumnWidth(self): ... + def GetDisplayType(self): ... + def GetColumnState(self): ... + def GetGroupingRange(self): ... + def GetRelativeDescriptionType(self): ... + def GetRelativeDescription(self, var1: PyPROPVARIANT, var2: PyPROPVARIANT) -> tuple[Incomplete, Incomplete]: ... + def GetSortDescription(self): ... + def GetSortDescriptionLabel(self, Descending): ... + def GetAggregationType(self): ... + def GetConditionType(self) -> tuple[Incomplete, Incomplete]: ... + def GetEnumTypelist(self, riid: PyIID) -> PyIPropertyEnumTypelist: ... + def CoerceToCanonicalValue(self, Value: PyPROPVARIANT): ... + def FormatForDisplay(self, Value: PyPROPVARIANT, Flags): ... + def IsValueCanonical(self, Value) -> bool: ... + +class PyIPropertyDescriptionAliasInfo: + def GetSortByAlias(self, riid: PyIID) -> PyIPropertyDescription: ... + def GetAdditionalSortByAliases(self, riid: PyIID) -> PyIPropertyDescriptionlist: ... + +class PyIPropertyDescriptionlist: + def GetCount(self): ... + def GetAt(self, Elem, riid: PyIID) -> PyIPropertyDescription: ... + +class PyIPropertyDescriptionSearchInfo: + def GetSearchInfoFlags(self): ... + def GetColumnIndexType(self): ... + def GetProjectionString(self): ... + def GetMaxSize(self): ... + +class PyIPropertyEnumType: + def GetEnumType(self): ... + def GetValue(self) -> PyPROPVARIANT: ... + def GetRangeMinValue(self) -> PyPROPVARIANT: ... + def GetRangeSetValue(self) -> PyPROPVARIANT: ... + def GetDisplayText(self) -> None: ... + +class PyIPropertyEnumTypelist: + def GetCount(self): ... + def GetAt(self, itype, riid: PyIID) -> PyIPropertyEnumType: ... + def FindMatchingIndex(self, Cmp: PyPROPVARIANT): ... + +class PyIPropertySetStorage: + def Create(self, fmtid: PyIID, clsid: PyIID, Flags, Mode) -> PyIPropertyStorage: ... + def Open(self, fmtid: PyIID, Mode) -> PyIPropertyStorage: ... + def Delete(self, fmtid: PyIID) -> None: ... + def Enum(self) -> PyIEnumSTATPROPSETSTG: ... + +class PyIPropertyStorage: + def ReadMultiple(self, props: tuple[PROPSPEC, ...]) -> tuple[Incomplete, ...]: ... + def WriteMultiple(self, props: tuple[PROPSPEC, ...], values: tuple[Incomplete, ...], propidNameFirst: int = ...) -> None: ... + def DeleteMultiple(self, props: tuple[PROPSPEC, ...]) -> None: ... + def ReadPropertyNames(self, props: tuple[Incomplete, ...]) -> tuple[Incomplete, ...]: ... + def WritePropertyNames(self, props: tuple[Incomplete, ...], names: tuple[str, ...]) -> None: ... + def DeletePropertyNames(self, props: tuple[Incomplete, ...]) -> None: ... + def Commit(self, CommitFlags) -> None: ... + def Revert(self) -> None: ... + def Enum(self) -> PyIEnumSTATPROPSTG: ... + def SetTimes(self, ctime: PyTime, atime: PyTime, mtime: PyTime) -> None: ... + def SetClass(self, clsid: PyIID) -> None: ... + def Stat(self): ... + +class PyIPropertyStore: + def GetCount(self): ... + def GetAt(self, iProp) -> PyPROPERTYKEY: ... + def GetValue(self, Key: PyPROPERTYKEY) -> PyPROPVARIANT: ... + def SetValue(self, Key: PyPROPERTYKEY, Value: PyPROPVARIANT) -> None: ... + def Commit(self) -> None: ... + +class PyIPropertyStoreCache: + def GetState(self, key: PyPROPERTYKEY): ... + def GetValueAndState(self, key: PyPROPERTYKEY) -> tuple[PyPROPVARIANT, Incomplete]: ... + def SetState(self, key: PyPROPERTYKEY, state) -> None: ... + def SetValueAndState(self, key: PyPROPERTYKEY, value: PyPROPVARIANT, state) -> None: ... + +class PyIPropertyStoreCapabilities: + def IsPropertyWritable(self, key: PyPROPERTYKEY) -> bool: ... + +class PyIPropertySystem: + def GetPropertyDescription(self, Key: PyPROPERTYKEY, riid: PyIID) -> PyIPropertyDescription: ... + def GetPropertyDescriptionByName(self, CanonicalName, riid: PyIID) -> PyIPropertyDescription: ... + def GetPropertyDescriptionlistFromString(self, Proplist, riid: PyIID) -> PyIPropertyDescriptionlist: ... + def EnumeratePropertyDescriptions(self, Filter, riid: PyIID) -> PyIPropertyDescriptionlist: ... + def FormatForDisplay(self, Key: PyPROPERTYKEY, Value: PyPROPVARIANT, Flags): ... + def RegisterPropertySchema(self, Path) -> None: ... + def UnregisterPropertySchema(self, Path) -> None: ... + def RefreshPropertySchema(self) -> None: ... + +class PyIProvideClassInfo: + def GetClassInfo(self) -> PyITypeInfo: ... + +class PyIProvideClassInfo2: + def GetGUID(self, flags) -> PyIID: ... + +class PyIProvideExpressionContexts: + def EnumExpressionContexts(self) -> None: ... + +class PyIProvideTaskPage: + def GetPage(self, tpType, PersistChanges) -> None: ... + +class PyIQueryAssociations: + def Init(self, flags, assoc: str, hkeyProgId: PyHKEY | None = ..., hwnd: int | None = ...) -> None: ... + def GetKey(self, flags, assocKey, arg: str): ... + def GetString(self, flags, assocStr, arg: str): ... + +class PyIRelatedItem: + def GetItemIDlist(self) -> PyIDL: ... + def GetItem(self) -> PyIShellItem: ... + +class PyIRemoteDebugApplication: + def ResumeFromBreakPoint(self, prptFocus: PyIRemoteDebugApplicationThread, bra, era) -> None: ... + def CauseBreak(self) -> None: ... + def ConnectDebugger(self, pad: PyIApplicationDebugger) -> None: ... + def DisconnectDebugger(self) -> None: ... + def GetDebugger(self) -> PyIApplicationDebugger: ... + def CreateInstanceAtApplication(self, rclsid: PyIID, pUnkOuter: PyIUnknown, dwClsContext, riid: PyIID) -> PyIUnknown: ... + def QueryAlive(self) -> None: ... + def EnumThreads(self) -> PyIEnumRemoteDebugApplicationThreads: ... + def GetName(self) -> None: ... + def GetRootNode(self) -> PyIDebugApplicationNode: ... + def EnumGlobalExpressionContexts(self): ... + +class PyIRemoteDebugApplicationEvents: + def OnConnectDebugger(self, pad: PyIApplicationDebugger) -> None: ... + def OnDisconnectDebugger(self) -> None: ... + def OnSetName(self, pstrName) -> None: ... + def OnDebugOutput(self, pstr) -> None: ... + def OnClose(self) -> None: ... + def OnEnterBreakPoint(self, prdat: PyIRemoteDebugApplicationThread) -> None: ... + def OnLeaveBreakPoint(self, prdat: PyIRemoteDebugApplicationThread) -> None: ... + def OnCreateThread(self, prdat: PyIRemoteDebugApplicationThread) -> None: ... + def OnDestroyThread(self, prdat: PyIRemoteDebugApplicationThread) -> None: ... + def OnBreakFlagChange(self, abf, prdatSteppingThread: PyIRemoteDebugApplicationThread) -> None: ... + +class PyIRemoteDebugApplicationThread: + def GetSystemThreadId(self) -> None: ... + def GetApplication(self) -> None: ... + def EnumStackFrames(self) -> None: ... + def GetDescription(self) -> None: ... + def SetNextStatement(self, pStackFrame: PyIDebugStackFrame, pCodeContext: PyIDebugCodeContext) -> None: ... + def GetState(self) -> None: ... + def Suspend(self) -> None: ... + def Resume(self) -> None: ... + def GetSuspendCount(self) -> None: ... + +class PyIRunningObjectTable: + def Register(self): ... + def Revoke(self): ... + def IsRunning(self, objectName: PyIMoniker) -> bool: ... + def GetObject(self, objectName: PyIMoniker) -> PyIUnknown: ... + def EnumRunning(self) -> PyIEnumMoniker: ... + +class PyIScheduledWorkItem: + def CreateTrigger(self) -> tuple[Incomplete, PyITaskTrigger]: ... + def DeleteTrigger(self, Trigger) -> None: ... + def GetTriggerCount(self): ... + def GetTrigger(self, iTrigger) -> PyITaskTrigger: ... + def GetTriggerString(self): ... + def GetRunTimes(self, Count, Begin: PyTime, End: PyTime) -> tuple[PyTime, Incomplete, Incomplete, Incomplete]: ... + def GetNextRunTime(self) -> PyTime: ... + def SetIdleWait(self, wIdleMinutes, wDeadlineMinutes) -> None: ... + def GetIdleWait(self) -> tuple[Incomplete, Incomplete]: ... + def Run(self) -> None: ... + def Terminate(self) -> None: ... + def EditWorkItem(self, hParent: int, dwReserved) -> None: ... + def GetMostRecentRunTime(self) -> PyTime: ... + def GetStatus(self): ... + def GetExitCode(self) -> tuple[Incomplete, Incomplete]: ... + def SetComment(self, Comment) -> None: ... + def GetComment(self) -> str: ... + def SetCreator(self, Creator) -> None: ... + def GetCreator(self) -> None: ... + def SetWorkItemData(self, Data: str) -> None: ... + def GetWorkItemData(self) -> str: ... + def SetErrorRetryCount(self, wRetryCount) -> None: ... + def GetErrorRetryCount(self) -> None: ... + def SetErrorRetryInterval(self, RetryInterval) -> None: ... + def GetErrorRetryInterval(self) -> None: ... + def SetFlags(self, dwFlags) -> None: ... + def GetFlags(self): ... + def SetAccountInformation(self, AccountName, Password) -> None: ... + def GetAccountInformation(self): ... + +class PyIServerSecurity: + def QueryBlanket(self, Capabilities: int = ...): ... + def ImpersonateClient(self) -> None: ... + def RevertToSelf(self) -> None: ... + def IsImpersonating(self) -> bool: ... + +class PyIServiceProvider: + def QueryService(self, clsid: PyIID, iid: PyIID) -> PyIUnknown: ... + +class PyIShellBrowser: + def InsertMenusSB(self, hmenuShared: int, lpMenuWidths: PyOLEMENUGROUPWIDTHS) -> PyOLEMENUGROUPWIDTHS: ... + def SetMenuSB(self, hmenuShared: int, holemenuRes: int, hwndActiveObject: int) -> None: ... + def RemoveMenusSB(self, hmenuShared: int) -> None: ... + def SetStatusTextSB(self, pszStatusText) -> None: ... + def EnableModelessSB(self, fEnable) -> None: ... + def TranslateAcceleratorSB(self, pmsg: PyMSG, wID) -> None: ... + def BrowseObject(self, pidl: PyIDL, wFlags) -> None: ... + def GetViewStateStream(self, grfMode) -> PyIStream: ... + def GetControlWindow(self, _id) -> None: ... + def SendControlMsg(self, _id, uMsg, wParam, lParam): ... + def QueryActiveShellView(self) -> PyIShellView: ... + def OnViewWindowActive(self, pshv: PyIShellView) -> None: ... + def SetToolbarItems(self, lpButtons, uFlags) -> None: ... + +class PyIShellExtInit: + def Initialize(self, pFolder: PyIDL, pDataObject: PyIDataObject, hkey: int) -> None: ... + +class PyIShellFolder: + def ParseDisplayName(self, hwndOwner: int, pbc: PyIBindCtx, DisplayName, Attributes: int = ...): ... + def EnumObjects(self, grfFlags, hwndOwner: int | None = ...) -> PyIEnumIDlist: ... + def BindToObject(self, pidl: PyIDL, pbc: PyIBindCtx, riid: PyIID) -> PyIShellFolder: ... + def BindToStorage(self, pidl: PyIDL, pbc: PyIBindCtx, riid: PyIID): ... + def CompareIDs(self, lparam, pidl1: PyIDL, pidl2: PyIDL): ... + def CreateViewObject(self, hwndOwner, riid: PyIID) -> PyIShellView: ... + def GetAttributesOf(self, pidl: tuple[PyIDL, ...], rgfInOut): ... + def GetUIObjectOf( + self, hwndOwner: int, pidl: tuple[PyIDL, ...], riid: PyIID, iidout: PyIID, Reserved=... + ) -> tuple[Incomplete, PyIUnknown]: ... + def GetDisplayNameOf(self, pidl: PyIDL, uFlags): ... + def SetNameOf(self, hwndOwner, pidl: PyIDL, Name, Flags) -> PyIDL: ... + +class PyIShellFolder2: + def GetDefaultSearchGUID(self, pguid: PyIID) -> PyIID: ... + def EnumSearches(self): ... + def GetDefaultColumn(self) -> tuple[Incomplete, Incomplete]: ... + def GetDefaultColumnState(self, iColumn): ... + def GetDetailsEx(self, pidl: PyIDL, pscid): ... + def GetDetailsOf(self, pidl: PyIDL, iColumn) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def MapColumnToSCID(self, Column): ... + +class PyIShellIcon: + def GetIconOf(self, pidl: PyIDL) -> None: ... + +class PyIShellIconOverlay: + def GetOverlayIndex(self, pidl: PyIDL) -> None: ... + def GetOverlayIconIndex(self, pidl: PyIDL) -> None: ... + +class PyIShellIconOverlayIdentifier: + def IsMemberOf(self, path: str, attrib) -> bool: ... + def GetOverlayInfo(self) -> tuple[str, Incomplete, Incomplete]: ... + def GetPriority(self): ... + +class PyIShellIconOverlayManager: + def GetFileOverlayInfo(self, path, attrib, flags): ... + def GetReservedOverlayInfo(self, path, attrib, flags, ireservedID) -> None: ... + def RefreshOverlayImages(self, flags) -> None: ... + def LoadNonloadedOverlayIdentifiers(self) -> None: ... + def OverlayIndexFromImageIndex(self, iImage, fAdd) -> None: ... + +class PyIShellItem: + def BindToHandler(self, pbc: PyIBindCtx, bhid: PyIID, riid: PyIID): ... + def GetParent(self) -> PyIShellItem: ... + def GetDisplayName(self, sigdnName): ... + def GetAttributes(self, Mask): ... + def Compare(self, psi: PyIShellItem, hint): ... + +class PyIShellItem2: + def GetPropertyStore(self, Flags, riid: PyIID) -> PyIPropertyStore: ... + def GetPropertyStoreForKeys(self, Keys: tuple[Incomplete, ...], Flags, riid: PyIID) -> PyIPropertyStore: ... + def GetPropertyStoreWithCreateObject(self, Flags, CreateObject: PyIUnknown, riid: PyIID) -> PyIPropertyStore: ... + def GetPropertyDescriptionlist(self, Type: PyPROPERTYKEY, riid: PyIID) -> PyIPropertyDescriptionlist: ... + def Update(self, BindCtx: Incomplete | None = ...) -> None: ... + def GetProperty(self, key: PyPROPERTYKEY): ... + def GetCLSID(self, key: PyPROPERTYKEY) -> PyIID: ... + def GetFileTime(self, key: PyPROPERTYKEY) -> PyTime: ... + def GetInt32(self, key: PyPROPERTYKEY): ... + def GetString(self, key: PyPROPERTYKEY): ... + def GetUInt32(self, key: PyPROPERTYKEY): ... + def GetUInt64(self, key: PyPROPERTYKEY): ... + def GetBool(self, key: PyPROPERTYKEY): ... + +class PyIShellItemArray: + def BindToHandler(self, pbc: PyIBindCtx, rbhid: PyIID, riid: PyIID): ... + def GetPropertyStore(self, flags, riid: PyIID) -> PyIPropertyStore: ... + def GetPropertyDescriptionlist(self, Type: PyPROPERTYKEY, riid: PyIID) -> PyIPropertyDescriptionlist: ... + def GetAttributes(self, AttribFlags, Mask): ... + def GetCount(self): ... + def GetItemAt(self, dwIndex) -> PyIShellItem: ... + def EnumItems(self) -> PyIEnumShellItems: ... + +class PyIShellItemResources: + def GetAttributes(self) -> None: ... + def GetSize(self): ... + def GetTimes(self) -> None: ... + def SetTimes(self, pftCreation: PyTime, pftWrite: PyTime, pftAccess: PyTime) -> None: ... + def GetResourceDescription(self, pcsir: PySHELL_ITEM_RESOURCE) -> None: ... + def EnumResources(self) -> PyIEnumResources: ... + def SupportsResource(self, pcsir: PySHELL_ITEM_RESOURCE): ... + def OpenResource(self, pcsir: PySHELL_ITEM_RESOURCE, riid: PyIID) -> PyIUnknown: ... + def CreateResource(self, sir: PySHELL_ITEM_RESOURCE, riid: PyIID): ... + def MarkForDelete(self) -> None: ... + +class PyIShellLibrary: + def LoadLibraryFromItem(self, Library: PyIShellItem, Mode) -> None: ... + def LoadLibraryFromKnownFolder(self, Library: PyIID, Mode) -> None: ... + def AddFolder(self, Location: PyIShellItem) -> None: ... + def RemoveFolder(self, Location: PyIShellItem) -> None: ... + def GetFolders(self, Filter, riid: PyIID) -> PyIShellItemArray: ... + def ResolveFolder(self, FolderToResolve: PyIShellItem, Timeout, riid: PyIID) -> PyIShellItem: ... + def GetDefaultSaveFolder(self, Type, riid: PyIID) -> PyIShellItem: ... + def SetDefaultSaveFolder(self, Type, SaveFolder: PyIShellItem) -> None: ... + def GetOptions(self): ... + def SetOptions(self, Mask, Options) -> None: ... + def GetFolderType(self) -> PyIID: ... + def SetFolderType(self, Type: PyIID) -> None: ... + def GetIcon(self): ... + def SetIcon(self, Icon) -> None: ... + def Commit(self) -> None: ... + def Save(self, FolderToSaveIn: PyIShellItem, LibraryName, Flags) -> PyIShellItem: ... + def SaveInKnownFolder(self, FolderToSaveIn: PyIID, LibraryName, Flags) -> PyIShellItem: ... + +class PyIShellLink: + def GetPath(self, fFlags, cchMaxPath) -> tuple[Incomplete, WIN32_FIND_DATA]: ... + def GetIDlist(self) -> PyIDL: ... + def SetIDlist(self, pidl: PyIDL) -> None: ... + def GetDescription(self, cchMaxName: int = ...): ... + def SetDescription(self, Name) -> None: ... + def GetWorkingDirectory(self, cchMaxName: int = ...): ... + def SetWorkingDirectory(self, Dir) -> None: ... + def GetArguments(self, cchMaxName: int = ...): ... + def SetArguments(self, args) -> None: ... + def GetHotkey(self): ... + def SetHotkey(self, wHotkey) -> None: ... + def GetShowCmd(self): ... + def SetShowCmd(self, iShowCmd) -> None: ... + def GetIconLocation(self, cchMaxPath): ... + def SetIconLocation(self, iconPath: str, iIcon) -> None: ... + def SetRelativePath(self, relPath: str, reserved: int = ...) -> None: ... + def Resolve(self, hwnd: int, fFlags) -> None: ... + def SetPath(self, path: str) -> None: ... + +class PyIShellLinkDatalist: + def AddDataBlock(self, DataBlock) -> None: ... + def CopyDataBlock(self, Sig): ... + def GetFlags(self): ... + def RemoveDataBlock(self, Sig) -> None: ... + def SetFlags(self, Flags) -> None: ... + +class PyIShellView: + def TranslateAccelerator(self, pmsg): ... + def EnableModeless(self, fEnable) -> None: ... + def UIActivate(self, uState) -> None: ... + def Refresh(self) -> None: ... + def CreateViewWindow( + self, + psvPrevious: PyIShellView, + pfs: tuple[Incomplete, Incomplete], + psb: PyIShellBrowser, + prcView: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + ): ... + def DestroyViewWindow(self) -> None: ... + def GetCurrentInfo(self): ... + def SaveViewState(self) -> None: ... + def SelectItem(self, pidlItem: PyIDL, uFlags) -> None: ... + def GetItemObject(self, uItem, riid: PyIID) -> PyIUnknown: ... + +class PyISpecifyPropertyPages: + def GetPages(self) -> None: ... + +class PyIStorage: + def CreateStream(self, Name, Mode, reserved1: int = ..., reserved2: int = ...) -> PyIStream: ... + def OpenStream(self, Name, reserved1, Mode, reserved2: int = ...) -> PyIStream: ... + def CreateStorage(self, Name, Mode, StgFmt, reserved2: int = ...) -> PyIStorage: ... + def OpenStorage(self, Name, Priority: PyIStorage, Mode, snbExclude, reserved=...) -> PyIStorage: ... + def CopyTo(self, rgiidExclude: tuple[Incomplete, Incomplete], snbExclude, stgDest: PyIStorage) -> None: ... + def MoveElementTo(self, Name, stgDest: PyIStorage, NewName, Flags) -> None: ... + def Commit(self, grfCommitFlags) -> None: ... + def Revert(self) -> None: ... + def EnumElements(self, reserved1: int = ..., reserved2: Incomplete | None = ..., reserved3: int = ...) -> PyIEnumSTATSTG: ... + def DestroyElement(self, name: str) -> None: ... + def RenameElement(self, OldName, NewName) -> None: ... + def SetElementTimes(self, name, ctime: PyTime, atime: PyTime, mtime: PyTime) -> None: ... + def SetClass(self, clsid: PyIID) -> None: ... + def SetStateBits(self, grfStateBits, grfMask) -> None: ... + def Stat(self, grfStatFlag) -> STATSTG: ... + +class PyIStream: + def Read(self, numBytes) -> str: ... + def read(self, numBytes) -> str: ... + def Write(self, data: str) -> None: ... + def write(self, data: str) -> None: ... + def Seek(self, offset, origin) -> ULARGE_INTEGER: ... + def SetSize(self, newSize: ULARGE_INTEGER) -> None: ... + def CopyTo(self, stream: PyIStream, cb: ULARGE_INTEGER) -> ULARGE_INTEGER: ... + def Commit(self, flags) -> None: ... + def Revert(self) -> None: ... + def LockRegion(self, offset: ULARGE_INTEGER, cb: ULARGE_INTEGER, lockType) -> None: ... + def UnLockRegion(self, offset: ULARGE_INTEGER, cb: ULARGE_INTEGER, lockType) -> None: ... + def Clone(self) -> PyIStream: ... + def Stat(self, grfStatFlag: int = ...) -> STATSTG: ... + +class PyITask: + def SetApplicationName(self, ApplicationName) -> None: ... + def GetApplicationName(self): ... + def SetParameters(self, Parameters) -> None: ... + def GetParameters(self): ... + def SetWorkingDirectory(self, WorkingDirectory) -> None: ... + def GetWorkingDirectory(self): ... + def SetPriority(self, Priority) -> None: ... + def GetPriority(self): ... + def SetTaskFlags(self, dwFlags) -> None: ... + def GetTaskFlags(self): ... + def SetMaxRunTime(self, MaxRunTimeMS) -> None: ... + def GetMaxRunTime(self): ... + +class PyITaskScheduler: + def SetTargetComputer(self, Computer) -> None: ... + def GetTargetComputer(self): ... + def Enum(self) -> tuple[str, ...]: ... + def Activate(self, Name, riid: PyIID) -> PyITask: ... + def Delete(self, TaskName) -> None: ... + def NewWorkItem(self, TaskName, rclsid: PyIID, riid: PyIID) -> PyITask: ... + def AddWorkItem(self, TaskName, WorkItem: PyITask) -> None: ... + def IsOfType(self, Name, riid: PyIID) -> bool: ... + +class PyITaskTrigger: + def SetTrigger(self, Trigger: PyTASK_TRIGGER) -> None: ... + def GetTrigger(self) -> PyTASK_TRIGGER: ... + def GetTriggerString(self) -> str: ... + +class PyITaskbarlist: + def HrInit(self) -> None: ... + def AddTab(self, hwnd: int) -> None: ... + def DeleteTab(self, hwnd: int) -> None: ... + def ActivateTab(self, hwnd: int) -> None: ... + def SetActiveAlt(self, hwnd: int) -> None: ... + +class PyITransferAdviseSink: + def UpdateProgress(self, SizeCurrent, SizeTotal, FilesCurrent, FilesTotal, FoldersCurrent, FoldersTotal) -> None: ... + def UpdateTransferState(self, State) -> None: ... + def ConfirmOverwrite(self, Source: PyIShellItem, DestParent: PyIShellItem, Name): ... + def ConfirmEncryptionLoss(self, Source: PyIShellItem): ... + def FileFailure(self, Item: PyIShellItem, ItemName, Error) -> tuple[Incomplete, Incomplete]: ... + def SubStreamFailure(self, Item: PyIShellItem, StreamName, Error): ... + def PropertyFailure(self, Item: PyIShellItem, key: PyPROPERTYKEY, Error): ... + +class PyITransferDestination: + def Advise(self, Sink: PyITransferAdviseSink): ... + def Unadvise(self, Cookie) -> None: ... + def CreateItem( + self, Name, Attributes, Size, Flags, riidItem: PyIID, riidResources: PyIID + ) -> tuple[Incomplete, Incomplete, Incomplete]: ... + +class PyITransferMediumItem: ... + +class PyITransferSource: + def Advise(self, Sink: PyITransferAdviseSink): ... + def Unadvise(self, Cookie) -> None: ... + def SetProperties(self, proparray: PyIPropertyChangeArray) -> None: ... + def OpenItem(self, Item: PyIShellItem, flags, riid: PyIID) -> tuple[Incomplete, PyIShellItemResources]: ... + def MoveItem(self, Item: PyIShellItem, ParentDst: PyIShellItem, NameDst, flags) -> tuple[Incomplete, PyIShellItem]: ... + def RecycleItem(self, Source: PyIShellItem, ParentDest: PyIShellItem, flags) -> tuple[Incomplete, PyIShellItem]: ... + def RemoveItem(self, Source: PyIShellItem, flags): ... + def RenameItem(self, Source: PyIShellItem, NewName, flags) -> tuple[Incomplete, PyIShellItem]: ... + def LinkItem(self, Source: PyIShellItem, ParentDest: PyIShellItem, NewName, flags) -> tuple[Incomplete, PyIShellItem]: ... + def ApplyPropertiesToItem(self, Source: PyIShellItem) -> PyIShellItem: ... + def GetDefaultDestinationName(self, Source: PyIShellItem, ParentDest: PyIShellItem): ... + def EnterFolder(self, ChildFolderDest: PyIShellItem): ... + def LeaveFolder(self, ChildFolderDest: PyIShellItem): ... + +class PyITypeComp: + def Bind(self, szName: str, wflags: int = ...): ... + def BindType(self, szName: str): ... + +class PyITypeInfo: + def GetContainingTypeLib(self) -> tuple[PyITypeLib, Incomplete]: ... + def GetDocumentation(self, memberId) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetFuncDesc(self, memberId) -> FUNCDESC: ... + def GetImplTypeFlags(self, index): ... + def GetIDsOfNames(self): ... + def GetNames(self, memberId): ... + def GetTypeAttr(self) -> TYPEATTR: ... + def GetRefTypeInfo(self, hRefType) -> PyITypeInfo: ... + def GetRefTypeOfImplType(self, hRefType): ... + def GetVarDesc(self, memberId) -> VARDESC: ... + def GetTypeComp(self) -> PyITypeComp: ... + +class PyITypeLib: + def GetDocumentation(self, index): ... + def GetLibAttr(self) -> TLIBATTR: ... + def GetTypeComp(self) -> PyITypeComp: ... + def GetTypeInfo(self, index) -> PyITypeInfo: ... + def GetTypeInfoCount(self): ... + def GetTypeInfoOfGuid(self, iid: PyIID) -> PyITypeInfo: ... + def GetTypeInfoType(self, index): ... + +class PyIUniformResourceLocator: + def GetURL(self): ... + def SetURL(self, URL, InFlags: int = ...) -> None: ... + def InvokeCommand(self, Verb, Flags: int = ..., hwndParent: int = ...): ... + +class PyIUnknown: + def QueryInterface(self, iid, useIID: Incomplete | None = ...) -> PyIUnknown: ... + +class PyIViewObject: + def Draw( + self, + dwDrawAspect, + lindex, + aspectFlags, + hdcTargetDev, + hdcDraw, + arg: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + arg1: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + funcContinue, + obContinue, + ) -> None: ... + def GetColorSet(self, dwDrawAspect, lindex, aspectFlags, hicTargetDev) -> None: ... + def Freeze(self, dwDrawAspect, lindex, aspectFlags) -> None: ... + def Unfreeze(self, dwFreeze) -> None: ... + def SetAdvise(self, aspects, advf, pAdvSink) -> None: ... + def GetAdvise(self) -> None: ... + +class PyIViewObject2: + def GetExtent(self, dwDrawAspect, lindex, targetDevice) -> None: ... + +class PyMAPINAMEIDArray: ... +class PyOLEMENUGROUPWIDTHS: ... +class PyPROPERTYKEY: ... + +@final +class PyPROPVARIANT: + @property + def vt(self): ... + def GetValue(self): ... + def ToString(self): ... + def ChangeType(self, Type, Flags: int = ...) -> PyPROPVARIANT: ... + +class PySAndRestriction: ... +class PySBinaryArray: ... +class PySBitMaskRestriction: ... +class PySContentRestriction: ... +class PySExistRestriction: ... +class PySHELL_ITEM_RESOURCE: ... +class PySNotRestriction: ... +class PySOrRestriction: ... +class PySPropTagArray: ... +class PySPropValue: ... +class PySPropValueArray: ... +class PySPropertyRestriction: ... +class PySRestriction: ... +class PySRow: ... +class PySRowSet: ... +class PySSortOrderItem: ... +class PySSortOrderSet: ... + +class PySTGMEDIUM: + @property + def tymed(self): ... + @property + def data(self): ... + @property + def data_handle(self): ... + def set(self, tymed, data) -> None: ... + +class PyTASK_TRIGGER: ... +class RTF_WCSINFO: ... +class SHFILEINFO: ... +class SHFILEOPSTRUCT: ... +class SI_ACCESS: ... +class SI_INHERIT_TYPE: ... +class SI_OBJECT_INFO: ... +class STATSTG: ... +class TLIBATTR: ... + +class TYPEATTR: + @property + def iid(self) -> PyIID: ... + @property + def lcid(self): ... + @property + def memidConstructor(self): ... + @property + def memidDestructor(self): ... + @property + def cbSizeInstance(self): ... + @property + def typekind(self): ... + @property + def cFuncs(self): ... + @property + def cVars(self): ... + @property + def cImplTypes(self): ... + @property + def cbSizeVft(self): ... + @property + def cbAlignment(self): ... + @property + def wTypeFlags(self): ... + @property + def wMajorVerNum(self): ... + @property + def wMinorVerNum(self): ... + @property + def tdescAlias(self) -> TYPEDESC: ... + @property + def idldeskType(self) -> IDLDESC: ... + +class TYPEDESC: ... + +class VARDESC: + @property + def memid(self): ... + @property + def value(self): ... + @property + def elemdescVar(self) -> ELEMDESC: ... + @property + def varFlags(self): ... + @property + def varkind(self): ... + +class CHARFORMAT: ... +class CREATESTRUCT: ... +class LV_COLUMN: ... +class LV_ITEM: ... +class PARAFORMAT: ... +class PyAssocCObject: ... + +class PyAssocObject: + def AttachObject(self) -> None: ... + def GetAttachedObject(self): ... + +class PyCBitmap: + def CreateCompatibleBitmap(self, dc: PyCDC, width, height) -> None: ... + def GetSize(self) -> tuple[Incomplete, Incomplete]: ... + def GetHandle(self) -> PyGdiHANDLE: ... + def LoadBitmap(self, idRes, obDLL: PyDLL | None = ...) -> None: ... + def LoadBitmapFile(self, fileObject) -> None: ... + def LoadPPMFile(self, fileObject, cols, rows) -> None: ... + def Paint( + self, + dcObject: PyCDC, + arg: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + arg1: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + ) -> None: ... + def GetInfo(self): ... + def GetBitmapBits(self, asString: int = ...) -> str: ... + def SaveBitmapFile(self, dcObject: PyCDC, Filename: str): ... + +class PyCBrush: + def CreateSolidBrush(self) -> None: ... + def GetSafeHandle(self): ... + +class PyCButton: + def CreateWindow( + self, caption: str, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id + ) -> None: ... + def GetBitmap(self): ... + def SetBitmap(self, hBitmap: int = ...): ... + def GetCheck(self): ... + def SetCheck(self, idCheck) -> None: ... + def GetState(self): ... + def SetState(self, bHighlight): ... + def GetButtonStyle(self): ... + def SetButtonStyle(self, style, bRedraw: int = ...): ... + +class PyCCmdTarget: + def BeginWaitCursor(self) -> None: ... + def EndWaitCursor(self) -> None: ... + def HookCommand(self, obHandler, _id): ... + def HookCommandUpdate(self, obHandler, _id): ... + def HookOleEvent(self): ... + def HookNotify(self, obHandler, _id): ... + def RestoreWaitCursor(self) -> None: ... + +class PyCCmdUI: + @property + def m_nIndex(self): ... + @property + def m_nID(self): ... + @property + def m_pMenu(self) -> PyCMenu: ... + @property + def m_pSubMenu(self) -> PyCMenu: ... + def Enable(self, bEnable: int = ...) -> None: ... + def SetCheck(self, state: int = ...) -> None: ... + def SetRadio(self, bOn: int = ...) -> None: ... + def SetText(self, text: str) -> None: ... + def ContinueRouting(self) -> None: ... + +class PyCColorDialog: + def GetColor(self): ... + def DoModal(self): ... + def GetSavedCustomColors(self): ... + def SetCurrentColor(self, color) -> None: ... + def SetCustomColors(self) -> None: ... + def GetCustomColors(self) -> tuple[Incomplete, ...]: ... + +class PyCComboBox: + def AddString(self, _object): ... + def DeleteString(self, pos): ... + def Dir(self, attr, wild: str): ... + def GetCount(self): ... + def GetCurSel(self): ... + def GetEditSel(self): ... + def GetExtendedUI(self): ... + def GetItemData(self, item): ... + def GetItemValue(self, item): ... + def GetLBText(self, index) -> str: ... + def GetLBTextLen(self, index): ... + def InsertString(self, pos, _object): ... + def LimitText(self, _max): ... + def ResetContent(self) -> None: ... + def SelectString(self, after, string: str) -> None: ... + def SetCurSel(self, index) -> None: ... + def SetEditSel(self, start, end) -> None: ... + def SetExtendedUI(self, bExtended: int = ...) -> None: ... + def SetItemData(self, item, Data): ... + def SetItemValue(self, item, data): ... + def ShowDropDown(self, bShowIt: int = ...) -> None: ... + +class PyCCommonDialog: ... +class PyCControl: ... + +class PyCControlBar: + @property + def dockSite(self) -> PyCFrameWnd: ... + @property + def dockBar(self) -> PyCWnd: ... + @property + def dockContext(self) -> PyCDockContext: ... + @property + def dwStyle(self): ... + @property + def dwDockStyle(self): ... + def CalcDynamicLayout(self, length, dwMode): ... + def CalcFixedLayout(self, bStretch, bHorz): ... + def EnableDocking(self, style) -> None: ... + def EraseNonClient(self) -> None: ... + def GetBarStyle(self): ... + def GetCount(self): ... + def GetDockingFrame(self) -> PyCFrameWnd: ... + def IsFloating(self) -> bool: ... + def SetBarStyle(self, style) -> None: ... + def ShowWindow(self): ... + +class PyCCtrlView: + def OnCommand(self, wparam, lparam) -> None: ... + +class PyCDC: + def AbortDoc(self) -> None: ... + def Arc( + self, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + pointStart: tuple[Incomplete, Incomplete], + pointEnd: tuple[Incomplete, Incomplete], + ) -> None: ... + def BeginPath(self) -> None: ... + def BitBlt( + self, + destPos: tuple[Incomplete, Incomplete], + size: tuple[Incomplete, Incomplete], + dc: PyCDC, + srcPos: tuple[Incomplete, Incomplete], + rop, + ) -> None: ... + def Chord( + self, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + pointStart: tuple[Incomplete, Incomplete], + pointEnd: tuple[Incomplete, Incomplete], + ) -> None: ... + def CreateCompatibleDC(self, dcFrom: PyCDC | None = ...) -> PyCDC: ... + def CreatePrinterDC(self, printerName: str | None = ...) -> None: ... + def DeleteDC(self) -> None: ... + def DPtoLP(self, point: tuple[Incomplete, Incomplete], x, y) -> tuple[Incomplete, Incomplete]: ... + def Draw3dRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], colorTopLeft, colorBotRight) -> None: ... + def DrawFocusRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def DrawFrameControl(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], typ, state) -> None: ... + def DrawIcon(self, point: tuple[Incomplete, Incomplete], hIcon: int) -> None: ... + def DrawText( + self, s: str, _tuple: tuple[Incomplete, Incomplete, Incomplete, Incomplete], _format + ) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def Ellipse(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def EndDoc(self) -> None: ... + def EndPage(self) -> None: ... + def EndPath(self) -> None: ... + def ExtTextOut( + self, + _int, + _int1, + _int2, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + string, + _tuple: tuple[tuple[Incomplete, Incomplete], ...], + ) -> None: ... + def FillPath(self) -> None: ... + def FillRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], brush: PyCBrush) -> None: ... + def FillSolidRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], color) -> None: ... + def FrameRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], brush: PyCBrush) -> None: ... + def GetBrushOrg(self) -> tuple[Incomplete, Incomplete]: ... + def GetClipBox(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetCurrentPosition(self) -> tuple[Incomplete, Incomplete]: ... + def GetDeviceCaps(self, index): ... + def GetHandleAttrib(self): ... + def GetHandleOutput(self): ... + def GetMapMode(self): ... + def GetNearestColor(self, color): ... + def GetPixel(self, x, y) -> None: ... + def GetSafeHdc(self): ... + def GetTextExtent(self, text: str) -> tuple[Incomplete, Incomplete]: ... + def GetTextExtentPoint(self, text: str) -> tuple[Incomplete, Incomplete]: ... + def GetTextFace(self) -> str: ... + def GetTextMetrics(self): ... + def GetViewportExt(self) -> tuple[Incomplete, Incomplete]: ... + def GetViewportOrg(self) -> tuple[Incomplete, Incomplete]: ... + def GetWindowExt(self) -> tuple[Incomplete, Incomplete]: ... + def GetWindowOrg(self) -> tuple[Incomplete, Incomplete]: ... + def IntersectClipRect(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def IsPrinting(self) -> bool: ... + def LineTo(self, point: tuple[Incomplete, Incomplete], x, y) -> None: ... + def LPtoDP(self, point: tuple[Incomplete, Incomplete], x, y) -> tuple[Incomplete, Incomplete]: ... + def MoveTo(self, point: tuple[Incomplete, Incomplete], x, y) -> tuple[Incomplete, Incomplete]: ... + def OffsetWindowOrg(self, arg: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def OffsetViewportOrg(self, arg: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def PatBlt(self, destPos: tuple[Incomplete, Incomplete], size: tuple[Incomplete, Incomplete], rop) -> None: ... + def Pie(self, x1, y1, x2, y2, x3, y3, x4, y4) -> None: ... + def PolyBezier(self) -> None: ... + def Polygon(self) -> None: ... + def Polyline(self, points: list[tuple[Incomplete, Incomplete]]) -> None: ... + def RealizePalette(self): ... + def Rectangle(self): ... + def RectVisible(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete]): ... + def RestoreDC(self, saved) -> None: ... + def SaveDC(self): ... + def ScaleWindowExt(self) -> tuple[Incomplete, Incomplete]: ... + def ScaleViewportExt(self) -> tuple[Incomplete, Incomplete]: ... + def SelectClipRgn(self): ... + def SelectObject(self, ob): ... + def SetBkColor(self, color): ... + def SetBkMode(self, mode): ... + def SetBrushOrg(self, point: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def SetGraphicsMode(self, mode): ... + def SetMapMode(self, newMode): ... + def SetPixel(self, x, y, color) -> None: ... + def SetPolyFillMode(self, point: tuple[Incomplete, Incomplete]): ... + def SetROP2(self, mode): ... + def SetTextAlign(self, newFlags): ... + def SetTextColor(self, color): ... + def SetWindowExt(self, size: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def SetWindowOrg(self, arg: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def SetViewportExt(self, size: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def SetViewportOrg(self, arg: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... + def SetWorldTransform(self): ... + def StartDoc(self, docName: str, outputFile: str) -> None: ... + def StartPage(self) -> None: ... + def StretchBlt( + self, + destPos: tuple[Incomplete, Incomplete], + size: tuple[Incomplete, Incomplete], + dc: PyCDC, + srcPos: tuple[Incomplete, Incomplete], + size1: tuple[Incomplete, Incomplete], + rop, + ) -> None: ... + def StrokeAndFillPath(self) -> None: ... + def StrokePath(self) -> None: ... + def TextOut(self, _int, _int1, string) -> None: ... + +class PyCDialog: + def CreateWindow(self, obParent: PyCWnd | None = ...) -> None: ... + def DoModal(self): ... + def EndDialog(self, result) -> None: ... + def GotoDlgCtrl(self, control: PyCWnd) -> None: ... + def MapDialogRect( + self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete] + ) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def OnCancel(self) -> None: ... + def OnOK(self) -> None: ... + def OnInitDialog(self): ... + +class PyCDialogBar: + def CreateWindow(self, parent: PyCWnd, template: PyResourceId, style, _id) -> None: ... + +class PyCDocTemplate: + def DoCreateDoc(self, fileName: str | None = ...) -> PyCDocument: ... + def FindOpenDocument(self, fileName: str) -> PyCDocument: ... + def GetDocString(self, docIndex) -> str: ... + def GetDocumentlist(self): ... + def GetResourceID(self) -> None: ... + def GetSharedMenu(self) -> PyCMenu: ... + def InitialUpdateFrame( + self, frame: PyCFrameWnd | None = ..., doc: PyCDocument | None = ..., bMakeVisible: int = ... + ) -> None: ... + def SetContainerInfo(self, _id) -> None: ... + def SetDocStrings(self, docStrings: str) -> None: ... + def OpenDocumentFile(self, filename: str, bMakeVisible: int = ...) -> None: ... + +class PyCDockContext: + @property + def ptLast(self) -> tuple[Incomplete, Incomplete]: ... + @property + def rectLast(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + @property + def sizeLast(self) -> tuple[Incomplete, Incomplete]: ... + @property + def bDitherLast(self): ... + @property + def rectDragHorz(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + @property + def rectDragVert(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + @property + def rectFrameDragHorz(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + @property + def rectFrameDragVert(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + @property + def dwDockStyle(self): ... + @property + def dwOverDockStyle(self): ... + @property + def dwStyle(self): ... + @property + def bFlip(self): ... + @property + def bForceFrame(self): ... + @property + def bDragging(self): ... + @property + def nHitTest(self): ... + @property + def uMRUDockID(self): ... + @property + def rectMRUDockPos(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + @property + def dwMRUFloatStyle(self): ... + @property + def ptMRUFloatPos(self) -> tuple[Incomplete, Incomplete]: ... + def EndDrag(self): ... + def StartDrag(self, pt: tuple[Incomplete, Incomplete]): ... + def EndResize(self): ... + def StartResize(self, hittest, pt: tuple[Incomplete, Incomplete]): ... + def ToggleDocking(self): ... + +class PyCDocument: + def DeleteContents(self) -> None: ... + def DoSave(self, fileName: str, bReplace: int = ...) -> None: ... + def DoFileSave(self) -> None: ... + def GetDocTemplate(self) -> PyCDocTemplate: ... + def GetAllViews(self) -> list[Incomplete]: ... + def GetFirstView(self) -> PyCView: ... + def GetPathName(self) -> str: ... + def GetTitle(self) -> str: ... + def IsModified(self) -> bool: ... + def OnChangedViewlist(self) -> None: ... + def OnCloseDocument(self) -> None: ... + def OnNewDocument(self) -> None: ... + def OnOpenDocument(self, pathName: str) -> None: ... + def OnSaveDocument(self, pathName: str) -> None: ... + def SetModifiedFlag(self, bModified: int = ...) -> None: ... + def SaveModified(self): ... + def SetPathName(self, path: str) -> None: ... + def SetTitle(self, title: str) -> None: ... + def UpdateAllViews(self, sender: PyCView, hint: Incomplete | None = ...) -> None: ... + +class PyCEdit: + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id) -> None: ... + def Clear(self): ... + def Copy(self) -> None: ... + def Cut(self) -> None: ... + def FmtLines(self, bAddEOL): ... + def GetFirstVisibleLine(self): ... + def GetSel(self) -> tuple[Incomplete, Incomplete]: ... + def GetLine(self, lineNo): ... + def GetLineCount(self): ... + def LimitText(self, nChars: int = ...) -> None: ... + def LineFromChar(self, charNo: int = ...): ... + def LineIndex(self, lineNo: int = ...): ... + def LineScroll(self, nLines, nChars: int = ...): ... + def Paste(self) -> None: ... + def ReplaceSel(self, text: str) -> None: ... + def SetReadOnly(self, bReadOnly: int = ...) -> None: ... + def SetSel(self, start, end, arg, bNoScroll1, bNoScroll: int = ...) -> None: ... + +class PyCEditView: + def IsModified(self) -> bool: ... + def LoadFile(self, fileName: str) -> None: ... + def SetModifiedFlag(self, bModified: int = ...) -> None: ... + def GetEditCtrl(self): ... + def PreCreateWindow(self, createStruct): ... + def SaveFile(self, fileName: str) -> None: ... + def OnCommand(self, wparam, lparam) -> None: ... + +class PyCFileDialog: + def GetPathName(self) -> str: ... + def GetFileName(self) -> str: ... + def GetFileExt(self) -> str: ... + def GetFileTitle(self) -> str: ... + def GetPathNames(self) -> str: ... + def GetReadOnlyPref(self): ... + def SetOFNTitle(self, title: str) -> None: ... + def SetOFNInitialDir(self, title: str) -> None: ... + +class PyCFont: + def GetSafeHandle(self): ... + +class PyCFontDialog: + def DoModal(self): ... + def GetCurrentFont(self): ... + def GetCharFormat(self): ... + def GetColor(self): ... + def GetFaceName(self) -> str: ... + def GetStyleName(self) -> str: ... + def GetSize(self): ... + def GetWeight(self): ... + def IsStrikeOut(self) -> bool: ... + def IsUnderline(self) -> bool: ... + def IsBold(self) -> bool: ... + def IsItalic(self) -> bool: ... + +class PyCFormView: + def OnCommand(self, wparam, lparam) -> None: ... + +class PyCFrameWnd: + def BeginModalState(self) -> None: ... + def CreateWindow( + self, + wndClass: str, + title: str, + style, + PyCWnd, + menuId, + styleEx, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete] | None = ..., + createContext: Incomplete | None = ..., + ): ... + def EndModalState(self) -> None: ... + def DockControlBar( + self, controlBar: PyCControlBar, arg: tuple[Incomplete, Incomplete, Incomplete, Incomplete], dockBarId: int = ... + ) -> None: ... + def EnableDocking(self, style) -> None: ... + def FloatControlBar(self, controlBar: PyCControlBar, arg: tuple[Incomplete, Incomplete], style) -> None: ... + def GetActiveDocument(self) -> PyCDocument: ... + def GetControlBar(self, _id) -> PyCControlBar: ... + def GetMessageString(self, _id) -> str: ... + def GetMessageBar(self) -> PyCWnd: ... + def IsTracking(self) -> bool: ... + def InModalState(self): ... + def LoadAccelTable(self, _id: PyResourceId) -> None: ... + def LoadFrame( + self, idResource, style: int = ..., wndParent: PyCWnd | None = ..., context: Incomplete | None = ... + ) -> None: ... + def LoadBarState(self, profileName: str) -> None: ... + def PreCreateWindow(self, createStruct): ... + def SaveBarState(self, profileName: str) -> None: ... + def ShowControlBar(self, controlBar: PyCControlBar, bShow, bDelay) -> None: ... + def RecalcLayout(self, bNotify: int = ...) -> None: ... + def GetActiveView(self) -> PyCView: ... + def OnBarCheck(self, _id): ... + def OnUpdateControlBarMenu(self, cmdUI: PyCCmdUI): ... + def SetActiveView(self, view: PyCView, bNotify: int = ...) -> None: ... + +class PyCGdiObject: ... + +class PyCImagelist: + def Add(self, arg: tuple[Incomplete, Incomplete], bitmap, color, hIcon): ... + def Destroy(self) -> None: ... + def DeleteImagelist(self) -> None: ... + def GetBkColor(self): ... + def GetSafeHandle(self): ... + def GetImageCount(self): ... + def GetImageInfo(self, index): ... + def SetBkColor(self, color) -> None: ... + +class PyClistBox: + def AddString(self, _object): ... + def DeleteString(self, pos): ... + def Dir(self, attr, wild: str): ... + def GetCaretIndex(self): ... + def GetCount(self): ... + def GetCurSel(self): ... + def GetItemData(self, item): ... + def GetItemValue(self, item): ... + def GetSel(self, index): ... + def GetSelCount(self): ... + def GetSelItems(self): ... + def GetSelTextItems(self): ... + def GetTopIndex(self): ... + def GetText(self, index) -> str: ... + def GetTextLen(self, index): ... + def InsertString(self, pos, _object): ... + def ResetContent(self) -> None: ... + def SetCaretIndex(self, index, bScroll: int = ...) -> None: ... + def SelectString(self, after, string: str) -> None: ... + def SelItemRange(self, bSel, start, end) -> None: ... + def SetCurSel(self, index) -> None: ... + def SetItemData(self, item, Data): ... + def SetItemValue(self, item, data): ... + def SetSel(self, index, bSel: int = ...) -> None: ... + def SetTabStops(self, eachTabStop, tabStops) -> None: ... + def SetTopIndex(self, index) -> None: ... + +class PyClistCtrl: + def Arrange(self, code) -> None: ... + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], PyCWnd, _id) -> None: ... + def DeleteAllItems(self) -> None: ... + def DeleteItem(self, item) -> None: ... + def GetTextColor(self): ... + def SetTextColor(self, color) -> None: ... + def GetBkColor(self): ... + def SetBkColor(self, color) -> None: ... + def GetItem(self, item, sub) -> LV_ITEM: ... + def GetItemCount(self): ... + def GetItemRect(self, item, bTextOnly) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetEditControl(self) -> PyCEdit: ... + def EditLabel(self, item) -> PyCEdit: ... + def EnsureVisible(self, item, bPartialOK): ... + def CreateDragImage(self, item) -> tuple[PyCImagelist, Incomplete, Incomplete]: ... + def GetImagelist(self, nImagelist) -> PyCImagelist: ... + def GetNextItem(self, item, flags): ... + def InsertColumn(self, colNo, item: LV_COLUMN): ... + def InsertItem(self, item: LV_ITEM, item1, text, image, item2, text1): ... + def SetImagelist(self, imagelist: PyCImagelist, imageType): ... + def GetColumn(self, column) -> LV_COLUMN: ... + def GetTextBkColor(self): ... + def SetTextBkColor(self, color) -> None: ... + def GetTopIndex(self): ... + def GetCountPerPage(self): ... + def GetSelectedCount(self): ... + def SetItem(self, item: LV_ITEM): ... + def SetItemState(self, item, state, mask): ... + def GetItemState(self, item, mask): ... + def SetItemData(self, item, Data): ... + def GetItemData(self, item): ... + def SetItemCount(self, count) -> None: ... + def SetItemText(self, item, sub, text: str): ... + def GetItemText(self, item, sub): ... + def RedrawItems(self, first, first1): ... + def Update(self, item) -> None: ... + def SetColumn(self, colNo, item: LV_COLUMN): ... + def DeleteColumn(self, first): ... + def GetColumnWidth(self, first): ... + def SetColumnWidth(self, first, first1): ... + def GetStringWidth(self, first): ... + def HitTest(self, arg) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def GetItemPosition(self, item) -> tuple[Incomplete, Incomplete]: ... + +class PyClistView: + def PreCreateWindow(self, createStruct): ... + def GetlistCtrl(self) -> PyClistCtrl: ... + def OnCommand(self, wparam, lparam) -> None: ... + +class PyCMDIChildWnd: + def ActivateFrame(self, cmdShow: int = ...) -> None: ... + def CreateWindow( + self, + wndClass: str, + title: str, + style, + PyCWnd, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete] | None = ..., + createContext: Incomplete | None = ..., + ): ... + def GetMDIFrame(self) -> None: ... + def MDIActivate(self, cmdShow: int = ...) -> None: ... + def PreCreateWindow(self, createStruct): ... + def PreTranslateMessage(self) -> None: ... + def OnCommand(self, wparam, lparam) -> None: ... + def OnClose(self) -> None: ... + +class PyCMDIFrameWnd: + def GetMDIClient(self) -> PyCMDIFrameWnd: ... + def MDIGetActive(self) -> tuple[PyCMDIChildWnd, Incomplete]: ... + def MDIActivate(self, window: PyCWnd) -> PyCMDIFrameWnd: ... + def MDINext(self, fNext: int = ...) -> None: ... + def PreCreateWindow(self, createStruct): ... + def PreTranslateMessage(self) -> None: ... + def OnCommand(self, wparam, lparam) -> None: ... + def OnContextHelp(self): ... + def OnClose(self) -> None: ... + +class PyCMenu: + def AppendMenu(self, flags, _id: int = ..., value: str | None = ...) -> None: ... + def DeleteMenu(self, _id, flags) -> str: ... + def EnableMenuItem(self, _id, flags): ... + def GetMenuItemCount(self): ... + def GetMenuItemID(self, pos): ... + def GetMenuString(self, _id, arg) -> str: ... + def GetSubMenu(self, pos) -> PyCMenu: ... + def InsertMenu(self, pos, flags, _id: PyCMenu | int = ..., value: str | None = ...) -> None: ... + def ModifyMenu(self, pos, flags, _id: int = ..., value: str | None = ...) -> None: ... + def TrackPopupMenu(self, arg: tuple[Incomplete, Incomplete], arg1, arg2: PyCWnd) -> None: ... + +class PyCOleClientItem: + def CreateNewItem(self) -> None: ... + def Close(self) -> None: ... + def DoVerb(self) -> None: ... + def Draw(self) -> None: ... + def GetActiveView(self) -> PyCView: ... + def GetDocument(self) -> PyCDocument: ... + def GetInPlaceWindow(self) -> PyCWnd: ... + def GetItemState(self) -> None: ... + def GetObject(self) -> PyIUnknown: ... + def GetStorage(self) -> None: ... + def OnActivate(self) -> None: ... + def OnChange(self) -> None: ... + def OnChangeItemPosition(self): ... + def OnDeactivateUI(self): ... + def Run(self) -> None: ... + def SetItemRects(self) -> None: ... + +class PyCOleDialog: ... + +class PyCOleDocument: + def EnableCompoundFile(self, bEnable: int = ...) -> None: ... + def GetStartPosition(self): ... + def GetNextItem(self, pos) -> tuple[Incomplete, PyCOleClientItem]: ... + def GetInPlaceActiveItem(self, wnd: PyCWnd) -> PyCOleClientItem: ... + +class PyCOleInsertDialog: + def GetClassID(self): ... + def GetSelectionType(self): ... + def GetPathName(self): ... + +class PyCPrintDialog: ... + +class PyCPrintInfo: + def DocObject(self) -> None: ... + def GetDwFlags(self) -> None: ... + def SetDwFlags(self) -> None: ... + def GetDocOffsetPage(self) -> None: ... + def SetDocOffsetPage(self) -> None: ... + def SetPrintDialog(self) -> None: ... + def GetDirect(self) -> None: ... + def SetDirect(self) -> None: ... + def GetPreview(self) -> None: ... + def SetPreview(self) -> None: ... + def GetContinuePrinting(self) -> None: ... + def SetContinuePrinting(self) -> None: ... + def GetCurPage(self) -> None: ... + def SetCurPage(self) -> None: ... + def GetNumPreviewPages(self) -> None: ... + def SetNumPreviewPages(self) -> None: ... + def GetUserData(self) -> None: ... + def SetUserData(self) -> None: ... + def GetDraw(self) -> None: ... + def SetDraw(self) -> None: ... + def GetPageDesc(self) -> None: ... + def SetPageDesc(self) -> None: ... + def GetMinPage(self) -> None: ... + def SetMinPage(self) -> None: ... + def GetMaxPage(self) -> None: ... + def SetMaxPage(self) -> None: ... + def GetOffsetPage(self) -> None: ... + def GetFromPage(self) -> None: ... + def GetToPage(self) -> None: ... + def SetHDC(self, hdc) -> None: ... + def CreatePrinterDC(self) -> None: ... + def DoModal(self) -> None: ... + def GetCopies(self) -> None: ... + def GetDefaults(self) -> None: ... + def FreeDefaults(self) -> None: ... + def GetDeviceName(self) -> None: ... + def GetDriverName(self) -> None: ... + def GetDlgFromPage(self) -> None: ... + def GetDlgToPage(self) -> None: ... + def GetPortName(self) -> None: ... + def GetPrinterDC(self) -> None: ... + def PrintAll(self) -> None: ... + def PrintCollate(self) -> None: ... + def PrintRange(self) -> None: ... + def PrintSelection(self) -> None: ... + def GetHDC(self) -> None: ... + def GetFlags(self) -> None: ... + def SetFlags(self) -> None: ... + def SetFromPage(self) -> None: ... + def SetToPage(self) -> None: ... + def GetPRINTDLGMinPage(self) -> None: ... + def SetPRINTDLGMinPage(self) -> None: ... + def GetPRINTDLGCopies(self) -> None: ... + def SetPRINTDLGCopies(self) -> None: ... + +class PyCProgressCtrl: + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id) -> None: ... + def SetRange(self, nLower: int = ..., nUpper: int = ...) -> None: ... + def SetPos(self, nPos: int = ...): ... + def OffsetPos(self, nPos: int = ...): ... + def SetStep(self, nStep: int = ...): ... + def StepIt(self): ... + +class PyCPropertyPage: + def CancelToClose(self) -> None: ... + def OnCancel(self) -> None: ... + def OnOK(self) -> None: ... + def OnApply(self) -> None: ... + def OnReset(self) -> None: ... + def OnQueryCancel(self) -> None: ... + def OnWizardBack(self) -> None: ... + def OnWizardNext(self) -> None: ... + def OnWizardFinish(self) -> None: ... + def OnSetActive(self): ... + def OnKillActive(self): ... + def SetModified(self, bChanged: int = ...) -> None: ... + def SetPSPBit(self, bitMask, bitValue) -> None: ... + +class PyCPropertySheet: + def AddPage(self, page: PyCPropertyPage) -> None: ... + def CreateWindow(self, style, exStyle, parent: PyCWnd | None = ...) -> None: ... + def DoModal(self): ... + def EnableStackedTabs(self, stacked) -> PyCPropertyPage: ... + def EndDialog(self, result) -> None: ... + def GetActiveIndex(self): ... + def GetActivePage(self) -> PyCPropertyPage: ... + def GetPage(self, pageNo) -> PyCPropertyPage: ... + def GetPageIndex(self, page: PyCPropertyPage): ... + def GetPageCount(self): ... + def GetTabCtrl(self) -> PyCTabCtrl: ... + def OnInitDialog(self): ... + def PressButton(self, button) -> None: ... + def RemovePage(self, offset, page) -> None: ... + def SetActivePage(self, page: PyCPropertyPage) -> None: ... + def SetTitle(self, title: str) -> None: ... + def SetFinishText(self, text: str) -> None: ... + def SetWizardMode(self) -> None: ... + def SetWizardButtons(self, flags) -> None: ... + def SetPSHBit(self, bitMask, bitValue) -> None: ... + +class PyCRect: ... +class PyCRgn: ... + +class PyCRichEditCtrl: + def Clear(self): ... + def Copy(self) -> None: ... + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id) -> None: ... + def Cut(self) -> None: ... + def FindText(self, charPos) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def GetCharPos(self, charPos): ... + def GetDefaultCharFormat(self): ... + def GetEventMask(self): ... + def GetSelectionCharFormat(self): ... + def GetFirstVisibleLine(self): ... + def GetParaFormat(self): ... + def GetSel(self) -> tuple[Incomplete, Incomplete]: ... + def GetSelText(self) -> str: ... + def GetTextLength(self): ... + def GetLine(self, lineNo): ... + def GetModify(self): ... + def GetLineCount(self): ... + def LimitText(self, nChars: int = ...) -> None: ... + def LineFromChar(self, charNo: int = ...): ... + def LineIndex(self, lineNo: int = ...): ... + def LineScroll(self, nLines, nChars: int = ...): ... + def Paste(self) -> None: ... + def ReplaceSel(self, text: str) -> None: ... + def SetBackgroundColor(self, bSysColor, cr: int = ...): ... + def SetDefaultCharFormat(self, charFormat) -> None: ... + def SetEventMask(self, eventMask): ... + def SetSelectionCharFormat(self, charFormat) -> None: ... + def SetModify(self, modified: int = ...) -> None: ... + def SetOptions(self, op, flags) -> None: ... + def SetParaFormat(self, paraFormat): ... + def SetReadOnly(self, bReadOnly: int = ...) -> None: ... + def SetSel(self, start, end, arg) -> None: ... + def SetSelAndCharFormat(self, charFormat) -> None: ... + def SetTargetDevice(self, dc: PyCDC, lineWidth) -> None: ... + def StreamIn(self, _format, method) -> tuple[Incomplete, Incomplete]: ... + def StreamOut(self, _format, method) -> tuple[Incomplete, Incomplete]: ... + +class PyCRichEditDoc: + def OnCloseDocument(self) -> None: ... + +class PyCRichEditDocTemplate: + def DoCreateRichEditDoc(self, fileName: str | None = ...) -> PyCRichEditDoc: ... + +class PyCRichEditView: + def GetRichEditCtrl(self) -> PyCRichEditCtrl: ... + def SetWordWrap(self, wordWrap): ... + def WrapChanged(self): ... + def SaveTextFile(self, FileName): ... + +class PyCScrollView: + def GetDeviceScrollPosition(self) -> tuple[Incomplete, Incomplete]: ... + def GetDC(self) -> PyCDC: ... + def GetScrollPosition(self) -> tuple[Incomplete, Incomplete]: ... + def GetTotalSize(self) -> tuple[Incomplete, Incomplete]: ... + def OnCommand(self, wparam, lparam) -> None: ... + def ResizeParentToFit(self, bShrinkOnly: int = ...): ... + def SetScaleToFitSize(self, size: tuple[Incomplete, Incomplete]) -> None: ... + def ScrollToPosition(self, position: tuple[Incomplete, Incomplete]) -> None: ... + def SetScrollSizes( + self, + mapMode, + sizeTotal: tuple[Incomplete, Incomplete], + arg: tuple[Incomplete, Incomplete], + arg1: tuple[Incomplete, Incomplete], + ) -> None: ... + def UpdateBars(self) -> None: ... + +class PyCSliderCtrl: + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id) -> None: ... + def GetLineSize(self): ... + def SetLineSize(self, nLineSize: int = ...): ... + def GetPageSize(self): ... + def SetPageSize(self, nPageSize: int = ...): ... + def GetRangeMax(self): ... + def GetRangeMin(self): ... + def GetRange(self): ... + def SetRange(self, nRangeMin: int = ..., nRangeMax: int = ..., bRedraw: int = ...): ... + def GetSelection(self): ... + def SetSelection(self, nRangeMin: int = ..., nRangeMax: int = ...): ... + def GetChannelRect(self): ... + def GetThumbRect(self): ... + def GetPos(self): ... + def SetPos(self, nPos: int = ...): ... + def GetNumTics(self): ... + def GetTicArray(self): ... + def GetTic(self, nTic: int = ...): ... + def GetTicPos(self, nTic: int = ...): ... + def SetTic(self, nTic: int = ...): ... + def SetTicFreq(self, nFreq: int = ...): ... + def ClearSel(self, bRedraw: int = ...): ... + def VerifyPos(self): ... + def ClearTics(self, bRedraw: int = ...): ... + +class PyCSpinButtonCtrl: + def GetPos(self): ... + def SetPos(self, pos): ... + def SetRange(self): ... + def SetRange32(self): ... + +class PyCSplitterWnd: + def GetPane(self, row, col) -> PyCWnd: ... + def CreateView(self, view: PyCView, row, col, arg: tuple[Incomplete, Incomplete]) -> None: ... + def CreateStatic(self, parent, rows, cols, style, _id) -> None: ... + def SetColumnInfo(self, column, ideal, _min) -> None: ... + def SetRowInfo(self, row, ideal, _min) -> None: ... + def IdFromRowCol(self, row, col) -> None: ... + def DoKeyboardSplit(self): ... + +class PyCStatusBar: + def GetPaneInfo(self, index) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def GetStatusBarCtrl(self) -> PyCStatusBarCtrl: ... + def SetIndicators(self, indicators) -> None: ... + def SetPaneInfo(self, index, _id, style, width) -> None: ... + +class PyCStatusBarCtrl: + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id) -> None: ... + def GetBorders(self) -> tuple[Incomplete, Incomplete, Incomplete]: ... + def GetParts(self, nParts): ... + def GetRect(self, nPane) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetText(self, nPane): ... + def GetTextAttr(self, nPane): ... + def GetTextLength(self, nPane): ... + def SetMinHeight(self, nHeight) -> None: ... + def SetParts(self, coord) -> None: ... + def SetText(self, text: str, nPane, nType) -> None: ... + def SetTipText(self, nPane, text: str) -> None: ... + +class PyCTabCtrl: + def GetCurSel(self): ... + def GetItemCountl(self): ... + def SetCurSel(self, index): ... + +class PyCToolBar: + def GetButtonStyle(self, index) -> None: ... + def GetButtonText(self, index) -> str: ... + def GetItemID(self, index) -> None: ... + def SetButtonInfo(self, index, ID, style, imageIx) -> None: ... + def GetToolBarCtrl(self) -> PyCToolBarCtrl: ... + def LoadBitmap(self, _id: PyResourceId) -> None: ... + def LoadToolBar(self, _id: PyResourceId) -> None: ... + def SetBarStyle(self, style) -> None: ... + def SetBitmap(self, hBitmap) -> None: ... + def SetButtons(self, buttons, numButtons) -> None: ... + def SetButtonStyle(self, index, style) -> None: ... + def SetHeight(self, height) -> None: ... + def SetSizes(self, sizeButton: tuple[Incomplete, Incomplete], sizeButton1: tuple[Incomplete, Incomplete]) -> None: ... + +class PyCToolBarCtrl: + def AddBitmap(self, numButtons, bitmap): ... + def AddButtons(self): ... + def AddStrings(self, strings): ... + def AutoSize(self) -> None: ... + def CheckButton(self, nID, bCheck: int = ...): ... + def CommandToIndex(self, nID): ... + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], parent: PyCWnd, _id) -> None: ... + def Customize(self) -> None: ... + def DeleteButton(self, nID) -> None: ... + def EnableButton(self, nID, bEnable: int = ...) -> None: ... + def GetBitmapFlags(self): ... + def GetButton(self, nID): ... + def GetButtonCount(self): ... + def GetItemRect(self, nID) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetRows(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def HideButton(self, nID, bEnable: int = ...) -> None: ... + def Indeterminate(self, nID, bEnable: int = ...) -> None: ... + def InsertButton(self, nID, button: PyCToolBarCtrl): ... + def IsButtonChecked(self, nID) -> bool: ... + def IsButtonEnabled(self, nID) -> bool: ... + def IsButtonHidden(self, nID) -> bool: ... + def IsButtonIndeterminate(self, nID) -> bool: ... + def IsButtonPressed(self, nID) -> bool: ... + def PressButton(self, nID, bEnable: int = ...) -> None: ... + def SetBitmapSize(self, width1, height1, width: int = ..., height: int = ...) -> None: ... + def SetButtonSize(self, width1, height1, width: int = ..., height: int = ...) -> None: ... + def SetCmdID(self, nIndex, nID) -> None: ... + def SetRows(self, nRows, bLarger) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + +class PyCToolTipCtrl: + def CreateWindow(self, parent: PyCWnd, style) -> None: ... + def UpdateTipText(self, text: str, wnd: PyCWnd, _id) -> None: ... + def AddTool( + self, wnd: PyCWnd, text: str, _id, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete] | None = ... + ) -> None: ... + def SetMaxTipWidth(self, width): ... + +class PyCTreeCtrl: + def CreateWindow(self, style, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], PyCWnd, _id) -> None: ... + def GetCount(self): ... + def GetIndent(self): ... + def SetIndent(self, indent) -> None: ... + def GetImagelist(self, nImagelist) -> PyCImagelist: ... + def SetImagelist(self, imagelist: PyCImagelist, imageType): ... + def GetNextItem(self, item, code): ... + def ItemHasChildren(self, item): ... + def GetChildItem(self, item): ... + def GetNextSiblingItem(self, item): ... + def GetPrevSiblingItem(self, item): ... + def GetParentItem(self, item): ... + def GetFirstVisibleItem(self): ... + def GetNextVisibleItem(self, item): ... + def GetSelectedItem(self): ... + def GetDropHilightItem(self): ... + def GetRootItem(self): ... + def GetToolTips(self): ... + def GetItem(self, item, arg) -> TV_ITEM: ... + def SetItem(self, item: TV_ITEM): ... + def GetItemState(self, item, stateMask) -> tuple[Incomplete, Incomplete]: ... + def SetItemState(self, item, state, stateMask) -> None: ... + def GetItemImage(self, item) -> tuple[Incomplete, Incomplete]: ... + def SetItemImage(self, item, iImage, iSelectedImage) -> None: ... + def SetItemText(self, item, text: str): ... + def GetItemText(self, item): ... + def GetItemData(self, item): ... + def SetItemData(self, item, Data): ... + def GetItemRect(self, item, bTextOnly) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetEditControl(self) -> PyCEdit: ... + def GetVisibleCount(self): ... + def InsertItem( + self, + hParent, + hInsertAfter, + item: TV_ITEM, + mask, + text, + image, + selectedImage, + state, + stateMask, + lParam, + parent, + parent1, + text1, + image1, + selectedImage1, + parent2, + insertAfter, + text2, + parent3, + parent4, + ): ... + def DeleteItem(self, item) -> None: ... + def DeleteAllItems(self): ... + def Expand(self, item, code) -> None: ... + def Select(self, item, code) -> None: ... + def SelectItem(self, item) -> None: ... + def SelectDropTarget(self, item) -> None: ... + def SelectSetFirstVisible(self, item) -> None: ... + def EditLabel(self, item) -> PyCEdit: ... + def CreateDragImage(self, item) -> PyCImagelist: ... + def SortChildren(self, item) -> None: ... + def EnsureVisible(self, item): ... + def HitTest(self, arg) -> tuple[Incomplete, Incomplete]: ... + +class PyCTreeView: + def PreCreateWindow(self, createStruct): ... + def GetTreeCtrl(self) -> PyCTreeCtrl: ... + def OnCommand(self, wparam, lparam) -> None: ... + +class PyCView: + def CreateWindow(self, parent: PyCWnd, arg, arg1, arg2: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... + def GetDocument(self) -> PyCDocument: ... + def OnActivateView(self, activate, activateView: PyCView, DeactivateView: PyCView): ... + def OnInitialUpdate(self) -> None: ... + def OnMouseActivate(self, wnd: PyCWnd, hittest, message): ... + def PreCreateWindow(self, createStruct): ... + def OnFilePrint(self) -> None: ... + def DoPreparePrinting(self): ... + def OnBeginPrinting(self) -> None: ... + def OnEndPrinting(self) -> None: ... + +class PyCWinApp: + def AddDocTemplate(self, template: PyCDocTemplate) -> None: ... + def FindOpenDocument(self, fileName: str) -> PyCDocument: ... + def GetDocTemplatelist(self) -> list[Incomplete]: ... + def InitDlgInstance(self, dialog: PyCDialog) -> None: ... + def LoadCursor(self, cursorId: PyResourceId): ... + def LoadStandardCursor(self, cursorId: PyResourceId): ... + def LoadOEMCursor(self, cursorId): ... + def LoadIcon(self, idResource): ... + def LoadStandardIcon(self, resourceName: PyResourceId): ... + def OpenDocumentFile(self, fileName: str) -> None: ... + def OnFileNew(self) -> None: ... + def OnFileOpen(self) -> None: ... + def RemoveDocTemplate(self, template: PyCDocTemplate) -> None: ... + def Run(self): ... + def IsInproc(self) -> bool: ... + +class PyCWinThread: + def CreateThread(self) -> None: ... + def PumpIdle(self) -> None: ... + def PumpMessages(self) -> None: ... + def Run(self): ... + def SetMainFrame(self, mainFrame: PyCWnd) -> None: ... + def SetThreadPriority(self, priority: PyCWnd) -> None: ... + +class PyCWnd: + def ActivateFrame(self, cmdShow) -> None: ... + def BringWindowToTop(self) -> None: ... + def BeginPaint(self) -> tuple[PyCDC, Incomplete]: ... + def CalcWindowRect( + self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], nAdjustType + ) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def CenterWindow(self, altwin: PyCWnd | None = ...) -> None: ... + def CheckRadioButton(self, idFirst, idLast, idCheck) -> None: ... + def ChildWindowFromPoint(self, x, y, flag: int = ...) -> PyCWnd: ... + def ClientToScreen( + self, point: tuple[Incomplete, Incomplete], rect + ) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... + def CreateWindow( + self, + classId: str, + windowName: str, + style, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + parent: PyCWnd, + _id, + context: Incomplete | None = ..., + ) -> None: ... + def CreateWindowEx( + self, + styleEx, + classId: str, + windowName: str, + style, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + parent: PyCWnd, + _id, + createStruct1, + createStruct: CREATESTRUCT | None = ..., + ) -> None: ... + def DefWindowProc(self, message, idLast, idCheck): ... + def DestroyWindow(self) -> None: ... + def DlgDirlist(self, defPath: str, idlistbox, idStaticPath, fileType) -> None: ... + def DlgDirlistComboBox(self) -> None: ... + def DlgDirSelect(self, idlistbox) -> str: ... + def DlgDirSelectComboBox(self, idlistbox) -> str: ... + def DragAcceptFiles(self, bAccept: int = ...) -> None: ... + def DrawMenuBar(self) -> None: ... + def EnableWindow(self, bEnable: int = ...): ... + def EndModalLoop(self, result) -> None: ... + def EndPaint(self, paintStruct) -> None: ... + def GetCheckedRadioButton(self, idFirst, idLast): ... + def GetClientRect(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetDC(self) -> PyCDC: ... + def GetDCEx(self) -> PyCDC: ... + def GetDlgCtrlID(self): ... + def GetDlgItem(self, idControl) -> PyCWnd: ... + def GetDlgItemInt(self, idControl, bUnsigned: int = ...): ... + def GetDlgItemText(self, idControl) -> str: ... + def GetLastActivePopup(self) -> PyCWnd: ... + def GetMenu(self) -> PyCMenu: ... + def GetParent(self) -> PyCWnd: ... + def GetParentFrame(self) -> PyCWnd: ... + def GetSafeHwnd(self): ... + def GetScrollInfo(self, nBar, mask): ... + def GetScrollPos(self, nBar): ... + def GetStyle(self): ... + def GetExStyle(self): ... + def GetSystemMenu(self) -> PyCMenu: ... + def GetTopLevelFrame(self) -> PyCWnd: ... + def GetTopLevelOwner(self) -> PyCWnd: ... + def GetTopLevelParent(self) -> PyCWnd: ... + def GetTopWindow(self) -> PyCWnd: ... + def GetWindow(self, _type) -> PyCWnd: ... + def GetWindowDC(self) -> PyCDC: ... + def GetWindowPlacement(self): ... + def GetWindowRect(self) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... + def GetWindowText(self) -> str: ... + def HideCaret(self) -> None: ... + def HookAllKeyStrokes(self, obHandler) -> None: ... + def HookKeyStroke(self, obHandler, ch): ... + def HookMessage(self, obHandler, message): ... + def InvalidateRect(self, arg: tuple[Incomplete, Incomplete, Incomplete, Incomplete], bErase: int = ...) -> None: ... + def InvalidateRgn(self, region: PyCRgn, bErase: int = ...) -> None: ... + def IsChild(self, obWnd: PyCWnd) -> bool: ... + def IsDlgButtonChecked(self, idCtl) -> bool: ... + def IsIconic(self) -> bool: ... + def IsZoomed(self) -> bool: ... + def IsWindow(self) -> bool: ... + def IsWindowVisible(self) -> bool: ... + def KillTimer(self): ... + def LockWindowUpdate(self) -> None: ... + def MapWindowPoints(self, wnd: PyCWnd, points: list[tuple[Incomplete, Incomplete]]) -> None: ... + def MouseCaptured(self): ... + def MessageBox(self, message: str, arg, title: str | None = ...) -> None: ... + def ModifyStyle(self, remove, add, flags: int = ...): ... + def ModifyStyleEx(self, remove, add, flags: int = ...): ... + def MoveWindow(self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], bRepaint: int = ...) -> None: ... + def OnClose(self): ... + def OnCtlColor(self, dc: PyCDC, control, _type): ... + def OnEraseBkgnd(self, dc: PyCDC): ... + def OnNcHitTest(self, arg: tuple[Incomplete, Incomplete]): ... + def OnPaint(self): ... + def OnQueryDragIcon(self): ... + def OnQueryNewPalette(self): ... + def OnSetCursor(self, wnd: PyCWnd, hittest, message): ... + def OnMouseActivate(self, wnd: PyCWnd, hittest, message): ... + def OnWndMsg(self, msg, wParam, lParam) -> tuple[Incomplete, Incomplete]: ... + def PreCreateWindow(self, createStruct): ... + def PumpWaitingMessages(self, firstMsg, lastMsg) -> None: ... + def RedrawWindow( + self, _object: PyCRgn, flags, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete] | None = ... + ) -> None: ... + def ReleaseCapture(self) -> None: ... + def ReleaseDC(self, dc: PyCDC) -> None: ... + def RepositionBars(self, idFirst, idLast, idLeftOver) -> None: ... + def RunModalLoop(self, flags): ... + def PostMessage(self, idMessage, wParam: int = ..., lParam: int = ...) -> None: ... + def SendMessageToDescendants(self, idMessage, wParam: int = ..., lParam: int = ..., bDeep: int = ...) -> None: ... + def SendMessage(self, idMessage, idMessage1, ob, wParam: int = ..., lParam: int = ...) -> None: ... + def SetActiveWindow(self) -> PyCWnd: ... + def SetForegroundWindow(self) -> None: ... + def SetWindowPos(self, hWndInsertAfter, position: tuple[Incomplete, Incomplete, Incomplete, Incomplete], flags) -> None: ... + def ScreenToClient( + self, rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete], pnt + ) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... + def SetCapture(self) -> None: ... + def SetDlgItemText(self, idControl, text: str) -> None: ... + def SetFocus(self) -> None: ... + def SetFont(self, font: PyCFont, bRedraw: int = ...) -> None: ... + def SetIcon(self): ... + def SetMenu(self, menuObj: PyCMenu) -> None: ... + def SetRedraw(self, bState: int = ...) -> None: ... + def SetScrollPos(self, nBar, nPos, redraw: int = ...): ... + def SetScrollInfo(self, nBar, ScrollInfo, redraw: int = ...): ... + def SetTimer(self, idEvent, elapse): ... + def SetWindowPlacement(self, placement) -> None: ... + def SetWindowText(self, text: str) -> None: ... + def ShowCaret(self) -> None: ... + def ShowScrollBar(self, nBar, bShow: int = ...) -> None: ... + def ShowWindow(self, arg): ... + def UnLockWindowUpdate(self) -> None: ... + def UpdateData(self, bSaveAndValidate: int = ...): ... + def UpdateDialogControls(self, pTarget: PyCCmdTarget, disableIfNoHandler): ... + def UpdateWindow(self) -> None: ... + +class PyDDEConv: + def ConnectTo(self, service: str, topic: str) -> None: ... + def Connected(self) -> None: ... + def Exec(self, Cmd: str) -> None: ... + def Request(self) -> None: ... + def Poke(self) -> None: ... + +class PyDDEServer: + def AddTopic(self, topic: PyDDETopic) -> None: ... + def Create(self, name: str, filterFlags: int = ...) -> None: ... + def Destroy(self) -> None: ... + def GetLastError(self): ... + def Shutdown(self) -> None: ... + +class PyDDEStringItem: + def SetData(self, data: str) -> None: ... + +class PyDDETopic: + def AddItem(self, item) -> None: ... + def Destroy(self) -> None: ... + +class PyDLL: + def GetFileName(self) -> str: ... + def AttachToMFC(self) -> None: ... + +class SCROLLINFO: ... +class TV_ITEM: ... + +class EXTENSION_CONTROL_BLOCK: + @property + def Version(self) -> int: ... + @property + def TotalBytes(self): ... + @property + def AvailableBytes(self): ... + @property + def HttpStatusCode(self): ... + @property + def Method(self): ... + @property + def ConnID(self): ... + @property + def QueryString(self): ... + @property + def PathInfo(self): ... + @property + def PathTranslated(self): ... + @property + def AvailableData(self): ... + @property + def ContentType(self): ... + @property + def LogData(self): ... + def WriteClient(self, data: str, reserved: int = ...): ... + def GetServerVariable(self, variable: str, default) -> str: ... + def ReadClient(self, nbytes) -> str: ... + def SendResponseHeaders(self, reply: str, headers: str, keepAlive: bool = ...) -> None: ... + def SetFlushFlag(self, flag) -> None: ... + def TransmitFile(self, callback, param, hFile, statusCode: str, BytesToWrite, Offset, head: str, tail: str, flags): ... + def MapURLToPath(self) -> None: ... + def DoneWithSession(self, status) -> None: ... + def Redirect(self, url: str) -> None: ... + def IsKeepAlive(self) -> bool: ... + def GetAnonymousToken(self, metabase_path: str): ... + def GetImpersonationToken(self): ... + def IsKeepConn(self) -> bool: ... + def ExecURL(self, url: str, method: str, clientHeaders: str, info, entity, flags): ... + def GetExecURLStatus(self): ... + def IOCompletion(self, func, arg: Incomplete | None = ...): ... + def ReportUnhealthy(self, reason: str | None = ...): ... + def IOCallback(self, ecb: EXTENSION_CONTROL_BLOCK, arg, cbIO, dwError): ... + +class HSE_VERSION_INFO: + @property + def ExtensionDesc(self) -> str: ... + +class HTTP_FILTER_AUTHENT: + @property + def User(self) -> str: ... + @property + def Password(self) -> str: ... + +class HTTP_FILTER_CONTEXT: + @property + def Revision(self): ... + @property + def fIsSecurePort(self): ... + @property + def NotificationType(self): ... + @property + def FilterContext(self): ... + def GetData(self): ... + def GetServerVariable(self, variable: str, default) -> str: ... + def WriteClient(self, data: str, reserverd: int = ...) -> None: ... + def AddResponseHeaders(self, data: str, reserverd: int = ...) -> None: ... + def SendResponseHeader(self, status: str, header: str) -> None: ... + def DisableNotifications(self, flags) -> None: ... + +class HTTP_FILTER_LOG: + @property + def ClientHostName(self) -> str: ... + @property + def ClientUserName(self) -> str: ... + @property + def ServerName(self) -> str: ... + @property + def Operation(self) -> str: ... + @property + def Target(self) -> str: ... + @property + def Parameters(self) -> str: ... + @property + def HttpStatus(self): ... + +class HTTP_FILTER_PREPROC_HEADERS: + def GetHeader(self, header: str, default) -> str: ... + def SetHeader(self, name: str, val: str) -> None: ... + def AddHeader(self) -> None: ... + +class HTTP_FILTER_RAW_DATA: + @property + def InData(self) -> str: ... + +class HTTP_FILTER_URL_MAP: + @property + def URL(self) -> str: ... + @property + def PhysicalPath(self) -> str: ... + +class HTTP_FILTER_VERSION: + @property + def ServerFilterVersion(self): ... + @property + def FilterVersion(self): ... + @property + def Flags(self): ... + @property + def FilterDesc(self) -> str: ... diff --git a/stubs/pywin32/afxres.pyi b/stubs/pywin32/afxres.pyi new file mode 100644 index 0000000..0d3239c --- /dev/null +++ b/stubs/pywin32/afxres.pyi @@ -0,0 +1 @@ +from win32.lib.afxres import * diff --git a/stubs/pywin32/commctrl.pyi b/stubs/pywin32/commctrl.pyi new file mode 100644 index 0000000..603c570 --- /dev/null +++ b/stubs/pywin32/commctrl.pyi @@ -0,0 +1 @@ +from win32.lib.commctrl import * diff --git a/stubs/pywin32/dde.pyi b/stubs/pywin32/dde.pyi new file mode 100644 index 0000000..90a5be0 --- /dev/null +++ b/stubs/pywin32/dde.pyi @@ -0,0 +1 @@ +from pythonwin.dde import * diff --git a/stubs/pywin32/isapi/__init__.pyi b/stubs/pywin32/isapi/__init__.pyi new file mode 100644 index 0000000..87815a6 --- /dev/null +++ b/stubs/pywin32/isapi/__init__.pyi @@ -0,0 +1,11 @@ +from _typeshed import Incomplete + +class ISAPIError(Exception): + errno: Incomplete + strerror: Incomplete + funcname: Incomplete + def __init__(self, errno, strerror: Incomplete | None = ..., funcname: Incomplete | None = ...) -> None: ... + +class FilterError(ISAPIError): ... +class ExtensionError(ISAPIError): ... +class InternalReloadException(Exception): ... diff --git a/stubs/pywin32/isapi/isapicon.pyi b/stubs/pywin32/isapi/isapicon.pyi new file mode 100644 index 0000000..33dc5d6 --- /dev/null +++ b/stubs/pywin32/isapi/isapicon.pyi @@ -0,0 +1,86 @@ +from _typeshed import Incomplete + +HTTP_CONTINUE: int +HTTP_SWITCHING_PROTOCOLS: int +HTTP_PROCESSING: int +HTTP_OK: int +HTTP_CREATED: int +HTTP_ACCEPTED: int +HTTP_NON_AUTHORITATIVE: int +HTTP_NO_CONTENT: int +HTTP_RESET_CONTENT: int +HTTP_PARTIAL_CONTENT: int +HTTP_MULTI_STATUS: int +HTTP_MULTIPLE_CHOICES: int +HTTP_MOVED_PERMANENTLY: int +HTTP_MOVED_TEMPORARILY: int +HTTP_SEE_OTHER: int +HTTP_NOT_MODIFIED: int +HTTP_USE_PROXY: int +HTTP_TEMPORARY_REDIRECT: int +HTTP_BAD_REQUEST: int +HTTP_UNAUTHORIZED: int +HTTP_PAYMENT_REQUIRED: int +HTTP_FORBIDDEN: int +HTTP_NOT_FOUND: int +HTTP_METHOD_NOT_ALLOWED: int +HTTP_NOT_ACCEPTABLE: int +HTTP_PROXY_AUTHENTICATION_REQUIRED: int +HTTP_REQUEST_TIME_OUT: int +HTTP_CONFLICT: int +HTTP_GONE: int +HTTP_LENGTH_REQUIRED: int +HTTP_PRECONDITION_FAILED: int +HTTP_REQUEST_ENTITY_TOO_LARGE: int +HTTP_REQUEST_URI_TOO_LARGE: int +HTTP_UNSUPPORTED_MEDIA_TYPE: int +HTTP_RANGE_NOT_SATISFIABLE: int +HTTP_EXPECTATION_FAILED: int +HTTP_UNPROCESSABLE_ENTITY: int +HTTP_INTERNAL_SERVER_ERROR: int +HTTP_NOT_IMPLEMENTED: int +HTTP_BAD_GATEWAY: int +HTTP_SERVICE_UNAVAILABLE: int +HTTP_GATEWAY_TIME_OUT: int +HTTP_VERSION_NOT_SUPPORTED: int +HTTP_VARIANT_ALSO_VARIES: int +HSE_STATUS_SUCCESS: int +HSE_STATUS_SUCCESS_AND_KEEP_CONN: int +HSE_STATUS_PENDING: int +HSE_STATUS_ERROR: int +SF_NOTIFY_SECURE_PORT: int +SF_NOTIFY_NONSECURE_PORT: int +SF_NOTIFY_READ_RAW_DATA: int +SF_NOTIFY_PREPROC_HEADERS: int +SF_NOTIFY_AUTHENTICATION: int +SF_NOTIFY_URL_MAP: int +SF_NOTIFY_ACCESS_DENIED: int +SF_NOTIFY_SEND_RESPONSE: int +SF_NOTIFY_SEND_RAW_DATA: int +SF_NOTIFY_LOG: int +SF_NOTIFY_END_OF_REQUEST: int +SF_NOTIFY_END_OF_NET_SESSION: int +SF_NOTIFY_ORDER_HIGH: int +SF_NOTIFY_ORDER_MEDIUM: int +SF_NOTIFY_ORDER_LOW: int +SF_NOTIFY_ORDER_DEFAULT: int +SF_NOTIFY_ORDER_MASK: Incomplete +SF_STATUS_REQ_FINISHED: int +SF_STATUS_REQ_FINISHED_KEEP_CONN: Incomplete +SF_STATUS_REQ_NEXT_NOTIFICATION: Incomplete +SF_STATUS_REQ_HANDLED_NOTIFICATION: Incomplete +SF_STATUS_REQ_ERROR: Incomplete +SF_STATUS_REQ_READ_NEXT: Incomplete +HSE_IO_SYNC: int +HSE_IO_ASYNC: int +HSE_IO_DISCONNECT_AFTER_SEND: int +HSE_IO_SEND_HEADERS: int +HSE_IO_NODELAY: int +HSE_IO_FINAL_SEND: int +HSE_IO_CACHE_RESPONSE: int +HSE_EXEC_URL_NO_HEADERS: int +HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR: int +HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE: int +HSE_EXEC_URL_DISABLE_CUSTOM_ERROR: int +HSE_EXEC_URL_SSI_CMD: int +HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE: int diff --git a/stubs/pywin32/isapi/simple.pyi b/stubs/pywin32/isapi/simple.pyi new file mode 100644 index 0000000..7e9bc1b --- /dev/null +++ b/stubs/pywin32/isapi/simple.pyi @@ -0,0 +1,12 @@ +from _typeshed import Incomplete + +class SimpleExtension: + def GetExtensionVersion(self, vi) -> None: ... + def HttpExtensionProc(self, control_block) -> None: ... + def TerminateExtension(self, status) -> None: ... + +class SimpleFilter: + filter_flags: Incomplete + def GetFilterVersion(self, fv) -> None: ... + def HttpFilterProc(self, fc) -> None: ... + def TerminateFilter(self, status) -> None: ... diff --git a/stubs/pywin32/isapi/threaded_extension.pyi b/stubs/pywin32/isapi/threaded_extension.pyi new file mode 100644 index 0000000..502351d --- /dev/null +++ b/stubs/pywin32/isapi/threaded_extension.pyi @@ -0,0 +1,29 @@ +import threading +from _typeshed import Incomplete + +import isapi.simple +from isapi import ExtensionError as ExtensionError, isapicon as isapicon +from win32event import INFINITE as INFINITE + +ISAPI_REQUEST: int +ISAPI_SHUTDOWN: int + +class WorkerThread(threading.Thread): + running: bool + io_req_port: Incomplete + extension: Incomplete + def __init__(self, extension, io_req_port) -> None: ... + def call_handler(self, cblock) -> None: ... + +class ThreadPoolExtension(isapi.simple.SimpleExtension): + max_workers: int + worker_shutdown_wait: int + workers: Incomplete + dispatch_map: Incomplete + io_req_port: Incomplete + def GetExtensionVersion(self, vi) -> None: ... + def HttpExtensionProc(self, control_block): ... + def TerminateExtension(self, status) -> None: ... + def DispatchConnection(self, errCode, bytes, key, overlapped) -> None: ... + def Dispatch(self, ecb) -> None: ... + def HandleDispatchError(self, ecb) -> None: ... diff --git a/stubs/pywin32/mmapfile.pyi b/stubs/pywin32/mmapfile.pyi new file mode 100644 index 0000000..0b18e76 --- /dev/null +++ b/stubs/pywin32/mmapfile.pyi @@ -0,0 +1 @@ +from win32.mmapfile import * diff --git a/stubs/pywin32/mmsystem.pyi b/stubs/pywin32/mmsystem.pyi new file mode 100644 index 0000000..600475d --- /dev/null +++ b/stubs/pywin32/mmsystem.pyi @@ -0,0 +1 @@ +from win32.lib.mmsystem import * diff --git a/stubs/pywin32/ntsecuritycon.pyi b/stubs/pywin32/ntsecuritycon.pyi new file mode 100644 index 0000000..0b23754 --- /dev/null +++ b/stubs/pywin32/ntsecuritycon.pyi @@ -0,0 +1 @@ +from win32.lib.ntsecuritycon import * diff --git a/stubs/pywin32/odbc.pyi b/stubs/pywin32/odbc.pyi new file mode 100644 index 0000000..4671d86 --- /dev/null +++ b/stubs/pywin32/odbc.pyi @@ -0,0 +1 @@ +from win32.odbc import * diff --git a/stubs/pywin32/perfmon.pyi b/stubs/pywin32/perfmon.pyi new file mode 100644 index 0000000..eae890e --- /dev/null +++ b/stubs/pywin32/perfmon.pyi @@ -0,0 +1 @@ +from win32.perfmon import * diff --git a/stubs/pywin32/pythoncom.pyi b/stubs/pywin32/pythoncom.pyi new file mode 100644 index 0000000..690581b --- /dev/null +++ b/stubs/pywin32/pythoncom.pyi @@ -0,0 +1,468 @@ +# Can't generate with stubgen because: +# "Critical error during semantic analysis: mypy: can't decode file '.venv\Lib\site-packages\pywin32_system32\pythoncom39.dll': 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte" +# https://github.com/python/mypy/issues/13822 +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +import _win32typing +from win32.lib.pywintypes import com_error as com_error + +error: TypeAlias = com_error # noqa: Y042 + +def CoCreateFreeThreadedMarshaler(unk: _win32typing.PyIUnknown) -> _win32typing.PyIUnknown: ... +def CoCreateInstanceEx( + clsid: _win32typing.PyIID, + unkOuter: _win32typing.PyIUnknown, + context, + serverInfo: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + iids: list[_win32typing.PyIID], +) -> _win32typing.PyIUnknown: ... +def CoCreateInstance( + clsid: _win32typing.PyIID, unkOuter: _win32typing.PyIUnknown, context, iid: _win32typing.PyIID +) -> _win32typing.PyIUnknown: ... +def CoFreeUnusedLibraries() -> None: ... +def CoInitialize() -> None: ... +def CoInitializeEx(flags) -> None: ... +def CoInitializeSecurity( + sd: _win32typing.PySECURITY_DESCRIPTOR, authSvc, reserved1, authnLevel, impLevel, authInfo, capabilities, reserved2 +) -> None: ... +def CoGetInterfaceAndReleaseStream(stream: _win32typing.PyIStream, iid: _win32typing.PyIID) -> _win32typing.PyIUnknown: ... +def CoMarshalInterThreadInterfaceInStream(iid: _win32typing.PyIID, unk: _win32typing.PyIUnknown) -> _win32typing.PyIStream: ... +def CoMarshalInterface( + Stm: _win32typing.PyIStream, riid: _win32typing.PyIID, Unk: _win32typing.PyIUnknown, DestContext, flags +) -> None: ... +def CoUnmarshalInterface(Stm: _win32typing.PyIStream, riid: _win32typing.PyIID): ... +def CoReleaseMarshalData(Stm: _win32typing.PyIStream) -> None: ... +def CoGetObject(name: str, iid: _win32typing.PyIID, bindOpts: Incomplete | None = ...) -> _win32typing.PyIUnknown: ... +def CoUninitialize() -> None: ... +def CoRegisterClassObject(iid: _win32typing.PyIID, factory: _win32typing.PyIUnknown, context, flags): ... +def CoResumeClassObjects() -> None: ... +def CoRevokeClassObject(reg) -> None: ... +def CoTreatAsClass(clsidold: _win32typing.PyIID, clsidnew: _win32typing.PyIID) -> None: ... +def CoWaitForMultipleHandles(Flags, Timeout, Handles: list[int]): ... +def Connect(cls) -> _win32typing.PyIDispatch: ... +def CreateGuid() -> _win32typing.PyIID: ... +def CreateBindCtx() -> _win32typing.PyIBindCtx: ... +def CreateFileMoniker(filename: str) -> _win32typing.PyIMoniker: ... +def CreateItemMoniker(delim: str, item: str) -> _win32typing.PyIMoniker: ... +def CreatePointerMoniker(IUnknown: _win32typing.PyIUnknown) -> _win32typing.PyIMoniker: ... +def CreateTypeLib(): ... +def CreateTypeLib2(): ... +def CreateStreamOnHGlobal(hGlobal: int | None = ..., DeleteOnRelease: bool = ...) -> _win32typing.PyIStream: ... +def CreateILockBytesOnHGlobal(hGlobal: int | None = ..., DeleteOnRelease: bool = ...) -> _win32typing.PyILockBytes: ... +def EnableQuitMessage(threadId) -> None: ... +def FUNCDESC() -> _win32typing.FUNCDESC: ... +def GetActiveObject(cls) -> _win32typing.PyIUnknown: ... +def GetClassFile(fileName) -> _win32typing.PyIID: ... +def GetFacilityString(scode) -> str: ... +def GetRecordFromGuids( + iid: _win32typing.PyIID, verMajor, verMinor, lcid, infoIID: _win32typing.PyIID, data: Incomplete | None = ... +): ... +def GetRecordFromTypeInfo(TypeInfo: _win32typing.PyITypeInfo): ... +def GetRunningObjectTable(reserved: int = ...) -> _win32typing.PyIRunningObjectTable: ... +def GetScodeString(scode) -> str: ... +def GetScodeRangeString(scode) -> str: ... +def GetSeverityString(scode) -> str: ... +def IsGatewayRegistered(__iid: _win32typing.PyIID | None) -> int: ... +def LoadRegTypeLib(iid: _win32typing.PyIID, versionMajor, versionMinor, lcid) -> _win32typing.PyITypeLib: ... +def LoadTypeLib(libFileName: str) -> _win32typing.PyITypeLib: ... +def MakePyFactory(iid: _win32typing.PyIID) -> _win32typing.PyIClassFactory: ... +def MkParseDisplayName( + displayName: str, bindCtx: _win32typing.PyIBindCtx | None = ... +) -> tuple[_win32typing.PyIMoniker, Incomplete, _win32typing.PyIBindCtx]: ... +def New(cls) -> _win32typing.PyIDispatch: ... +def ObjectFromAddress(address, iid: _win32typing.PyIID) -> _win32typing.PyIUnknown: ... +def ObjectFromLresult(lresult, iid: _win32typing.PyIID, wparm) -> _win32typing.PyIUnknown: ... +def OleInitialize() -> None: ... +def OleGetClipboard() -> _win32typing.PyIDataObject: ... +def OleFlushClipboard() -> None: ... +def OleIsCurrentClipboard(dataObj: _win32typing.PyIDataObject): ... +def OleSetClipboard(dataObj: _win32typing.PyIDataObject) -> None: ... +def OleLoadFromStream(stream: _win32typing.PyIStream, iid: _win32typing.PyIID) -> None: ... +def OleSaveToStream(persist: _win32typing.PyIPersistStream, stream: _win32typing.PyIStream) -> None: ... +def OleLoad(storage: _win32typing.PyIStorage, iid: _win32typing.PyIID, site: _win32typing.PyIOleClientSite) -> None: ... +def ProgIDFromCLSID(clsid) -> str: ... +def PumpWaitingMessages(): ... +def PumpMessages() -> None: ... +def QueryPathOfRegTypeLib(iid: _win32typing.PyIID, versionMajor, versionMinor, lcid) -> str: ... +def ReadClassStg(storage: _win32typing.PyIStorage) -> _win32typing.PyIID: ... +def ReadClassStm(Stm: _win32typing.PyIStream) -> _win32typing.PyIID: ... +def RegisterTypeLib(typelib: _win32typing.PyITypeLib, fullPath: str, lcid, helpDir: str | None = ...) -> None: ... +def UnRegisterTypeLib(iid: _win32typing.PyIID, versionMajor, versionMinor, lcid, syskind) -> str: ... +def RegisterActiveObject(obUnknown: _win32typing.PyIUnknown, clsid: _win32typing.PyIID, flags): ... +def RevokeActiveObject(handle) -> None: ... +def RegisterDragDrop(hwnd: int, dropTarget: _win32typing.PyIDropTarget) -> None: ... +def RevokeDragDrop(hwnd: int) -> None: ... +def DoDragDrop() -> None: ... +def StgCreateDocfile(name: str, mode, reserved: int = ...) -> _win32typing.PyIStorage: ... +def StgCreateDocfileOnILockBytes(lockBytes: _win32typing.PyILockBytes, mode, reserved=...) -> _win32typing.PyIStorage: ... +def StgOpenStorageOnILockBytes( + lockBytes: _win32typing.PyILockBytes, + stgPriority: _win32typing.PyIStorage, + snbExclude: Incomplete | None = ..., + reserved: int = ..., +) -> _win32typing.PyIStorage: ... +def StgIsStorageFile(name: str): ... +def STGMEDIUM() -> _win32typing.PySTGMEDIUM: ... +def StgOpenStorage( + name: str, other: _win32typing.PyIStorage, mode, snbExclude: Incomplete | None = ..., reserved=... +) -> _win32typing.PyIStorage: ... +def StgOpenStorageEx( + Name: str, Mode, stgfmt, Attrs, riid: _win32typing.PyIID, StgOptions: Incomplete | None = ... +) -> _win32typing.PyIStorage: ... +def StgCreateStorageEx( + Name: str, + Mode, + stgfmt, + Attrs, + riid: _win32typing.PyIID, + StgOptions: Incomplete | None = ..., + SecurityDescriptor: _win32typing.PySECURITY_DESCRIPTOR | None = ..., +) -> _win32typing.PyIStorage: ... +def TYPEATTR() -> _win32typing.TYPEATTR: ... +def VARDESC() -> _win32typing.VARDESC: ... +def WrapObject(ob, gatewayIID: _win32typing.PyIID, interfaceIID: _win32typing.PyIID) -> _win32typing.PyIUnknown: ... +def WriteClassStg(storage: _win32typing.PyIStorage, iid: _win32typing.PyIID) -> None: ... +def WriteClassStm(Stm: _win32typing.PyIStream, clsid: _win32typing.PyIID) -> None: ... +def UnwrapObject(ob: _win32typing.PyIUnknown) -> _win32typing.PyIDispatch: ... +def FmtIdToPropStgName(fmtid: _win32typing.PyIID): ... +def PropStgNameToFmtId(Name: str) -> _win32typing.PyIID: ... +def CoGetCallContext(riid: _win32typing.PyIID) -> _win32typing.PyIServerSecurity: ... +def CoGetObjectContext(riid: _win32typing.PyIID) -> _win32typing.PyIContext: ... +def CoGetCancelObject(riid: _win32typing.PyIID, ThreadID: int = ...) -> _win32typing.PyICancelMethodCalls: ... +def CoSetCancelObject(Unk: _win32typing.PyIUnknown) -> None: ... +def CoEnableCallCancellation() -> None: ... +def CoDisableCallCancellation() -> None: ... + +ACTIVEOBJECT_STRONG: int +ACTIVEOBJECT_WEAK: int +ArgNotFound: _win32typing.ArgNotFound +CLSCTX_ALL: int +CLSCTX_INPROC: int +CLSCTX_INPROC_HANDLER: int +CLSCTX_INPROC_SERVER: int +CLSCTX_LOCAL_SERVER: int +CLSCTX_REMOTE_SERVER: int +CLSCTX_SERVER: int +CLSID_DCOMAccessControl: _win32typing.PyIID +CLSID_StdComponentCategoriesMgr: _win32typing.PyIID +CLSID_StdGlobalInterfaceTable: _win32typing.PyIID +COINIT_APARTMENTTHREADED: int +COINIT_DISABLE_OLE1DDE: int +COINIT_MULTITHREADED: int +COINIT_SPEED_OVER_MEMORY: int +COWAIT_ALERTABLE: int +COWAIT_WAITALL: int + +def CreateURLMonikerEx(*args, **kwargs): ... # incomplete + +DATADIR_GET: int +DATADIR_SET: int +DESCKIND_FUNCDESC: int +DESCKIND_VARDESC: int +DISPATCH_METHOD: int +DISPATCH_PROPERTYGET: int +DISPATCH_PROPERTYPUT: int +DISPATCH_PROPERTYPUTREF: int +DISPID_COLLECT: int +DISPID_CONSTRUCTOR: int +DISPID_DESTRUCTOR: int +DISPID_EVALUATE: int +DISPID_NEWENUM: int +DISPID_PROPERTYPUT: int +DISPID_STARTENUM: int +DISPID_THIS: int +DISPID_UNKNOWN: int +DISPID_VALUE: int +DVASPECT_CONTENT: int +DVASPECT_DOCPRINT: int +DVASPECT_ICON: int +DVASPECT_THUMBNAIL: int +EOAC_ACCESS_CONTROL: int +EOAC_ANY_AUTHORITY: int +EOAC_APPID: int +EOAC_AUTO_IMPERSONATE: int +EOAC_DEFAULT: int +EOAC_DISABLE_AAA: int +EOAC_DYNAMIC: int +EOAC_DYNAMIC_CLOAKING: int +EOAC_MAKE_FULLSIC: int +EOAC_MUTUAL_AUTH: int +EOAC_NONE: int +EOAC_NO_CUSTOM_MARSHAL: int +EOAC_REQUIRE_FULLSIC: int +EOAC_SECURE_REFS: int +EOAC_STATIC_CLOAKING: int +EXTCONN_CALLABLE: int +EXTCONN_STRONG: int +EXTCONN_WEAK: int +Empty: _win32typing.PyOleEmpty +FMTID_DocSummaryInformation: _win32typing.PyIID +FMTID_SummaryInformation: _win32typing.PyIID +FMTID_UserDefinedProperties: _win32typing.PyIID +FUNCFLAG_FBINDABLE: int +FUNCFLAG_FDEFAULTBIND: int +FUNCFLAG_FDISPLAYBIND: int +FUNCFLAG_FHIDDEN: int +FUNCFLAG_FREQUESTEDIT: int +FUNCFLAG_FRESTRICTED: int +FUNCFLAG_FSOURCE: int +FUNCFLAG_FUSESGETLASTERROR: int +FUNC_DISPATCH: int +FUNC_NONVIRTUAL: int +FUNC_PUREVIRTUAL: int +FUNC_STATIC: int +FUNC_VIRTUAL: int +IDLFLAG_FIN: int +IDLFLAG_FLCID: int +IDLFLAG_FOUT: int +IDLFLAG_FRETVAL: int +IDLFLAG_NONE: int +IID_IBindCtx: _win32typing.PyIID +IID_ICancelMethodCalls: _win32typing.PyIID +IID_ICatInformation: _win32typing.PyIID +IID_ICatRegister: _win32typing.PyIID +IID_IClassFactory: _win32typing.PyIID +IID_IClientSecurity: _win32typing.PyIID +IID_IConnectionPoint: _win32typing.PyIID +IID_IConnectionPointContainer: _win32typing.PyIID +IID_IContext: _win32typing.PyIID +IID_ICreateTypeInfo: _win32typing.PyIID +IID_ICreateTypeLib: _win32typing.PyIID +IID_ICreateTypeLib2: _win32typing.PyIID +IID_IDataObject: _win32typing.PyIID +IID_IDispatch: _win32typing.PyIID +IID_IDispatchEx: _win32typing.PyIID +IID_IDropSource: _win32typing.PyIID +IID_IDropTarget: _win32typing.PyIID +IID_IEnumCATEGORYINFO: _win32typing.PyIID +IID_IEnumConnectionPoints: _win32typing.PyIID +IID_IEnumConnections: _win32typing.PyIID +IID_IEnumContextProps: _win32typing.PyIID +IID_IEnumFORMATETC: _win32typing.PyIID +IID_IEnumGUID: _win32typing.PyIID +IID_IEnumMoniker: _win32typing.PyIID +IID_IEnumSTATPROPSETSTG: _win32typing.PyIID +IID_IEnumSTATPROPSTG: _win32typing.PyIID +IID_IEnumSTATSTG: _win32typing.PyIID +IID_IEnumString: _win32typing.PyIID +IID_IEnumVARIANT: _win32typing.PyIID +IID_IErrorLog: _win32typing.PyIID +IID_IExternalConnection: _win32typing.PyIID +IID_IGlobalInterfaceTable: _win32typing.PyIID +IID_ILockBytes: _win32typing.PyIID +IID_IMarshal: _win32typing.PyIID +IID_IMoniker: _win32typing.PyIID +IID_IOleWindow: _win32typing.PyIID +IID_IPersist: _win32typing.PyIID +IID_IPersistFile: _win32typing.PyIID +IID_IPersistPropertyBag: _win32typing.PyIID +IID_IPersistStorage: _win32typing.PyIID +IID_IPersistStream: _win32typing.PyIID +IID_IPersistStreamInit: _win32typing.PyIID +IID_IPropertyBag: _win32typing.PyIID +IID_IPropertySetStorage: _win32typing.PyIID +IID_IPropertyStorage: _win32typing.PyIID +IID_IProvideClassInfo: _win32typing.PyIID +IID_IProvideClassInfo2: _win32typing.PyIID +IID_IRunningObjectTable: _win32typing.PyIID +IID_IServerSecurity: _win32typing.PyIID +IID_IServiceProvider: _win32typing.PyIID +IID_IStdMarshalInfo: _win32typing.PyIID +IID_IStorage: _win32typing.PyIID +IID_IStream: _win32typing.PyIID +IID_ITypeComp: _win32typing.PyIID +IID_ITypeInfo: _win32typing.PyIID +IID_ITypeLib: _win32typing.PyIID +IID_IUnknown: _win32typing.PyIID +IID_NULL: _win32typing.PyIID +IID_StdOle: _win32typing.PyIID +IMPLTYPEFLAG_FDEFAULT: int +IMPLTYPEFLAG_FRESTRICTED: int +IMPLTYPEFLAG_FSOURCE: int +INVOKE_FUNC: int +INVOKE_PROPERTYGET: int +INVOKE_PROPERTYPUT: int +INVOKE_PROPERTYPUTREF: int +InterfaceNames: dict[str, _win32typing.PyIID] +MKSYS_ANTIMONIKER: int +MKSYS_CLASSMONIKER: int +MKSYS_FILEMONIKER: int +MKSYS_GENERICCOMPOSITE: int +MKSYS_ITEMMONIKER: int +MKSYS_NONE: int +MKSYS_POINTERMONIKER: int +MSHCTX_DIFFERENTMACHINE: int +MSHCTX_INPROC: int +MSHCTX_LOCAL: int +MSHCTX_NOSHAREDMEM: int +MSHLFLAGS_NOPING: int +MSHLFLAGS_NORMAL: int +MSHLFLAGS_TABLESTRONG: int +MSHLFLAGS_TABLEWEAK: int +Missing: _win32typing.PyOleMissing +Nothing: _win32typing.PyOleNothing +PARAMFLAG_FHASDEFAULT: int +PARAMFLAG_FIN: int +PARAMFLAG_FLCID: int +PARAMFLAG_FOPT: int +PARAMFLAG_FOUT: int +PARAMFLAG_FRETVAL: int +PARAMFLAG_NONE: int +REGCLS_MULTIPLEUSE: int +REGCLS_MULTI_SEPARATE: int +REGCLS_SINGLEUSE: int +REGCLS_SUSPENDED: int +ROTFLAGS_ALLOWANYCLIENT: int +ROTFLAGS_REGISTRATIONKEEPSALIVE: int +RPC_C_AUTHN_DCE_PRIVATE: int +RPC_C_AUTHN_DCE_PUBLIC: int +RPC_C_AUTHN_DEC_PUBLIC: int +RPC_C_AUTHN_DEFAULT: int +RPC_C_AUTHN_DPA: int +RPC_C_AUTHN_GSS_KERBEROS: int +RPC_C_AUTHN_GSS_NEGOTIATE: int +RPC_C_AUTHN_GSS_SCHANNEL: int +RPC_C_AUTHN_LEVEL_CALL: int +RPC_C_AUTHN_LEVEL_CONNECT: int +RPC_C_AUTHN_LEVEL_DEFAULT: int +RPC_C_AUTHN_LEVEL_NONE: int +RPC_C_AUTHN_LEVEL_PKT: int +RPC_C_AUTHN_LEVEL_PKT_INTEGRITY: int +RPC_C_AUTHN_LEVEL_PKT_PRIVACY: int +RPC_C_AUTHN_MQ: int +RPC_C_AUTHN_MSN: int +RPC_C_AUTHN_NONE: int +RPC_C_AUTHN_WINNT: int +RPC_C_AUTHZ_DCE: int +RPC_C_AUTHZ_DEFAULT: int +RPC_C_AUTHZ_NAME: int +RPC_C_AUTHZ_NONE: int +RPC_C_IMP_LEVEL_ANONYMOUS: int +RPC_C_IMP_LEVEL_DEFAULT: int +RPC_C_IMP_LEVEL_DELEGATE: int +RPC_C_IMP_LEVEL_IDENTIFY: int +RPC_C_IMP_LEVEL_IMPERSONATE: int +STDOLE2_LCID: int +STDOLE2_MAJORVERNUM: int +STDOLE2_MINORVERNUM: int +STDOLE_LCID: int +STDOLE_MAJORVERNUM: int +STDOLE_MINORVERNUM: int +STREAM_SEEK_CUR: int +STREAM_SEEK_END: int +STREAM_SEEK_SET: int +SYS_MAC: int +SYS_WIN16: int +SYS_WIN32: int +ServerInterfaces: dict[_win32typing.PyIID, bytes] +TKIND_ALIAS: int +TKIND_COCLASS: int +TKIND_DISPATCH: int +TKIND_ENUM: int +TKIND_INTERFACE: int +TKIND_MODULE: int +TKIND_RECORD: int +TKIND_UNION: int +TYMED_ENHMF: int +TYMED_FILE: int +TYMED_GDI: int +TYMED_HGLOBAL: int +TYMED_ISTORAGE: int +TYMED_ISTREAM: int +TYMED_MFPICT: int +TYMED_NULL: int +TYPEFLAG_FAGGREGATABLE: int +TYPEFLAG_FAPPOBJECT: int +TYPEFLAG_FCANCREATE: int +TYPEFLAG_FCONTROL: int +TYPEFLAG_FDISPATCHABLE: int +TYPEFLAG_FDUAL: int +TYPEFLAG_FHIDDEN: int +TYPEFLAG_FLICENSED: int +TYPEFLAG_FNONEXTENSIBLE: int +TYPEFLAG_FOLEAUTOMATION: int +TYPEFLAG_FPREDECLID: int +TYPEFLAG_FREPLACEABLE: int +TYPEFLAG_FRESTRICTED: int +TYPEFLAG_FREVERSEBIND: int +TypeIIDs: dict[_win32typing.PyIID, type] +URL_MK_LEGACY: int +URL_MK_UNIFORM: int +VARFLAG_FREADONLY: int +VAR_CONST: int +VAR_DISPATCH: int +VAR_PERINSTANCE: int +VAR_STATIC: int +VT_ARRAY: int +VT_BLOB: int +VT_BLOB_OBJECT: int +VT_BOOL: int +VT_BSTR: int +VT_BSTR_BLOB: int +VT_BYREF: int +VT_CARRAY: int +VT_CF: int +VT_CLSID: int +VT_CY: int +VT_DATE: int +VT_DECIMAL: int +VT_DISPATCH: int +VT_EMPTY: int +VT_ERROR: int +VT_FILETIME: int +VT_HRESULT: int +VT_I1: int +VT_I2: int +VT_I4: int +VT_I8: int +VT_ILLEGAL: int +VT_ILLEGALMASKED: int +VT_INT: int +VT_LPSTR: int +VT_LPWSTR: int +VT_NULL: int +VT_PTR: int +VT_R4: int +VT_R8: int +VT_RECORD: int +VT_RESERVED: int +VT_SAFEARRAY: int +VT_STORAGE: int +VT_STORED_OBJECT: int +VT_STREAM: int +VT_STREAMED_OBJECT: int +VT_TYPEMASK: int +VT_UI1: int +VT_UI2: int +VT_UI4: int +VT_UI8: int +VT_UINT: int +VT_UNKNOWN: int +VT_USERDEFINED: int +VT_VARIANT: int +VT_VECTOR: int +VT_VOID: int + +def connect(*args, **kwargs): ... # incomplete + +dcom: int +fdexNameCaseInsensitive: int +fdexNameCaseSensitive: int +fdexNameEnsure: int +fdexNameImplicit: int +fdexPropCanCall: int +fdexPropCanConstruct: int +fdexPropCanGet: int +fdexPropCanPut: int +fdexPropCanPutRef: int +fdexPropCanSourceEvents: int +fdexPropCannotCall: int +fdexPropCannotConstruct: int +fdexPropCannotGet: int +fdexPropCannotPut: int +fdexPropCannotPutRef: int +fdexPropCannotSourceEvents: int +fdexPropDynamicType: int +fdexPropNoSideEffects: int +frozen: int diff --git a/stdlib/@python2/distutils/command/sdist.pyi b/stubs/pywin32/pythonwin/__init__.pyi similarity index 100% rename from stdlib/@python2/distutils/command/sdist.pyi rename to stubs/pywin32/pythonwin/__init__.pyi diff --git a/stubs/pywin32/pythonwin/dde.pyi b/stubs/pywin32/pythonwin/dde.pyi new file mode 100644 index 0000000..ac041d3 --- /dev/null +++ b/stubs/pywin32/pythonwin/dde.pyi @@ -0,0 +1,33 @@ +# Can't generate with stubgen because: +# "ImportError: This must be an MFC application - try 'import win32ui' first" +APPCLASS_MONITOR: int +APPCLASS_STANDARD: int +APPCMD_CLIENTONLY: int +APPCMD_FILTERINITS: int +CBF_FAIL_ADVISES: int +CBF_FAIL_ALLSVRXACTIONS: int +CBF_FAIL_CONNECTIONS: int +CBF_FAIL_EXECUTES: int +CBF_FAIL_POKES: int +CBF_FAIL_REQUESTS: int +CBF_FAIL_SELFCONNECTIONS: int +CBF_SKIP_ALLNOTIFICATIONS: int +CBF_SKIP_CONNECT_CONFIRMS: int +CBF_SKIP_DISCONNECTS: int +CBF_SKIP_REGISTRATIONS: int + +def CreateConversation(*args, **kwargs): ... # incomplete +def CreateServer(*args, **kwargs): ... # incomplete +def CreateServerSystemTopic(*args, **kwargs): ... # incomplete +def CreateStringItem(*args, **kwargs): ... # incomplete +def CreateTopic(*args, **kwargs): ... # incomplete + +MF_CALLBACKS: int +MF_CONV: int +MF_ERRORS: int +MF_HSZ_INFO: int +MF_LINKS: int +MF_POSTMSGS: int +MF_SENDMSGS: int + +class error(Exception): ... diff --git a/stubs/pywin32/pythonwin/win32ui.pyi b/stubs/pywin32/pythonwin/win32ui.pyi new file mode 100644 index 0000000..61c3e6c --- /dev/null +++ b/stubs/pywin32/pythonwin/win32ui.pyi @@ -0,0 +1,369 @@ +from _typeshed import Incomplete + +import _win32typing + +class error(Exception): ... + +def ComparePath(path1: str, path2: str): ... +def CreateMDIFrame() -> _win32typing.PyCMDIFrameWnd: ... +def CreateMDIChild() -> _win32typing.PyCMDIChildWnd: ... +def CreateBitmap() -> _win32typing.PyCBitmap: ... +def CreateBitmapFromHandle(): ... +def CreateBrush() -> _win32typing.PyCBrush: ... +def CreateButton() -> _win32typing.PyCButton: ... +def CreateColorDialog( + initColor: int = ..., flags: int = ..., parent: _win32typing.PyCWnd | None = ... +) -> _win32typing.PyCColorDialog: ... +def CreateControl( + classId: str, + windowName: str, + style, + rect: tuple[Incomplete, Incomplete, Incomplete, Incomplete], + parent: _win32typing.PyCWnd, + _id, + bStorage, + obPersist: Incomplete | None = ..., + licKey: str | None = ..., +) -> _win32typing.PyCWnd: ... +def CreateControlBar() -> _win32typing.PyCControlBar: ... +def CreateCtrlView(doc: _win32typing.PyCDocument, className: str, style: int = ...) -> _win32typing.PyCCtrlView: ... +def CreateDC() -> None: ... +def CreateDCFromHandle(hwnd: int) -> _win32typing.PyCDC: ... +def CreateDialog(idRes, dll: _win32typing.PyDLL | None = ...) -> _win32typing.PyCDialog: ... +def CreateDialogBar() -> _win32typing.PyCDialogBar: ... +def CreateDialogIndirect(oblist) -> _win32typing.PyCDialog: ... +def CreatePrintDialog( + idRes, bPrintSetupOnly, dwFlags, parent: _win32typing.PyCWnd | None = ..., dll: _win32typing.PyDLL | None = ... +) -> _win32typing.PyCPrintDialog: ... +def CreateDocTemplate(idRes) -> _win32typing.PyCDocTemplate: ... +def CreateEdit() -> _win32typing.PyCEdit: ... +def CreateFileDialog( + bFileOpen, + arg, + defExt: str | None = ..., + fileName: str | None = ..., + _filter: str | None = ..., + parent: _win32typing.PyCWnd | None = ..., +) -> _win32typing.PyCFileDialog: ... +def CreateFontDialog( + arg, font: Incomplete | None = ..., dcPrinter: _win32typing.PyCDC | None = ..., parent: _win32typing.PyCWnd | None = ... +) -> _win32typing.PyCFontDialog: ... +def CreateFormView(doc: _win32typing.PyCDocument, Template) -> _win32typing.PyCFormView: ... +def CreateFrame(): ... +def CreateTreeCtrl() -> _win32typing.PyCTreeCtrl: ... +def CreateTreeView(doc: _win32typing.PyCDocument) -> _win32typing.PyCTreeView: ... +def CreatePalette(lp): ... +def CreatePopupMenu() -> _win32typing.PyCMenu: ... +def CreateMenu() -> _win32typing.PyCMenu: ... +def CreatePen(style, width, color): ... +def CreateProgressCtrl() -> _win32typing.PyCProgressCtrl: ... +def CreatePropertyPage(resource: _win32typing.PyResourceId, caption: int = ...) -> _win32typing.PyCPropertyPage: ... +def CreatePropertyPageIndirect(resourcelist: _win32typing.PyDialogTemplate, caption=...) -> _win32typing.PyCPropertyPage: ... +def CreatePropertySheet( + caption: _win32typing.PyResourceId, parent: _win32typing.PyCWnd | None = ..., select=... +) -> _win32typing.PyCPropertySheet: ... +def CreateRgn() -> _win32typing.PyCRgn: ... +def CreateRichEditCtrl() -> _win32typing.PyCRichEditCtrl: ... +def CreateRichEditDocTemplate(idRes) -> _win32typing.PyCRichEditDocTemplate: ... +def CreateRichEditView(doc: _win32typing.PyCDocument | None = ...) -> _win32typing.PyCRichEditView: ... +def CreateSliderCtrl() -> _win32typing.PyCSliderCtrl: ... +def CreateSplitter() -> _win32typing.PyCSplitterWnd: ... +def CreateStatusBar(parent: _win32typing.PyCWnd, arg, arg1, ctrlStype=...) -> _win32typing.PyCStatusBar: ... +def CreateStatusBarCtrl() -> _win32typing.PyCStatusBarCtrl: ... +def CreateFont(properties) -> _win32typing.PyCFont: ... +def CreateToolBar(parent: _win32typing.PyCWnd, style, arg) -> _win32typing.PyCToolBar: ... +def CreateToolBarCtrl() -> _win32typing.PyCToolBarCtrl: ... +def CreateToolTipCtrl() -> _win32typing.PyCToolTipCtrl: ... +def CreateThread() -> _win32typing.PyCWinThread: ... +def CreateView(doc: _win32typing.PyCDocument) -> _win32typing.PyCScrollView: ... +def CreateEditView(doc: _win32typing.PyCDocument) -> _win32typing.PyCEditView: ... +def CreateDebuggerThread() -> None: ... +def CreateWindowFromHandle(hwnd: int) -> _win32typing.PyCWnd: ... +def CreateWnd() -> _win32typing.PyCWnd: ... +def DestroyDebuggerThread() -> None: ... +def DoWaitCursor(code) -> None: ... +def DisplayTraceback() -> None: ... +def Enable3dControls(): ... +def FindWindow(className: str, windowName: str) -> _win32typing.PyCWnd: ... +def FindWindowEx( + parentWindow: _win32typing.PyCWnd, childAfter: _win32typing.PyCWnd, className: str, windowName: str +) -> _win32typing.PyCWnd: ... +def FullPath(path: str) -> str: ... +def GetActiveWindow() -> _win32typing.PyCWnd: ... +def GetApp() -> _win32typing.PyCWinApp: ... +def GetAppName(): ... +def GetAppRegistryKey() -> None: ... +def GetBytes(address, size) -> str: ... +def GetCommandLine() -> str: ... +def GetDeviceCaps(hdc, index): ... +def GetFileTitle(fileName: str) -> str: ... +def GetFocus() -> _win32typing.PyCWnd: ... +def GetForegroundWindow() -> _win32typing.PyCWnd: ... +def GetHalftoneBrush() -> _win32typing.PyCBrush: ... +def GetInitialStateRequest(): ... +def GetMainFrame() -> _win32typing.PyCWnd: ... +def GetName() -> str: ... +def GetProfileFileName() -> str: ... +def GetProfileVal(section: str, entry: str, defValue: str) -> str: ... +def GetResource() -> _win32typing.PyDLL: ... +def GetThread() -> _win32typing.PyCWinApp: ... +def GetType(): ... +def InitRichEdit() -> str: ... +def InstallCallbackCaller(): ... +def IsDebug() -> int: ... +def IsWin32s() -> int: ... +def IsObject(__o: object) -> bool: ... +def LoadDialogResource(idRes, dll: _win32typing.PyDLL | None = ...): ... +def LoadLibrary(fileName: str) -> _win32typing.PyDLL: ... +def LoadMenu(_id, dll: _win32typing.PyDLL | None = ...) -> _win32typing.PyCMenu: ... +def LoadStdProfileSettings(maxFiles) -> None: ... +def LoadString(stringId) -> str: ... +def MessageBox(message: str, arg, title: str | None = ...): ... +def OutputDebugString(msg: str) -> None: ... +def EnableControlContainer(): ... +def PrintTraceback(tb, output) -> None: ... +def PumpWaitingMessages(firstMessage, lastMessage): ... +def RegisterWndClass(style, hCursor: int = ..., hBrush: int = ..., hIcon=...) -> str: ... +def RemoveRecentFile(index: int = ...) -> None: ... +def SetAppHelpPath(): ... +def SetAppName(appName: str): ... +def SetCurrentInstanceHandle(newVal): ... +def SetCurrentResourceHandle(newVal): ... +def SetDialogBkColor(arg, arg1): ... +def SetProfileFileName(filename: str) -> None: ... +def SetRegistryKey(key: str) -> None: ... +def SetResource(dll) -> _win32typing.PyDLL: ... +def SetStatusText(msg: str, bForce: int = ...) -> None: ... +def StartDebuggerPump() -> None: ... +def StopDebuggerPump() -> None: ... +def TranslateMessage(): ... +def TranslateVirtualKey(vk) -> str: ... +def WinHelp(arg, data: str) -> None: ... +def WriteProfileVal(section: str, entry: str, value: str) -> None: ... +def AddToRecentFileList(*args, **kwargs): ... # incomplete +def CreateImageList(*args, **kwargs): ... # incomplete +def CreateListCtrl(*args, **kwargs): ... # incomplete +def CreateListView(*args, **kwargs): ... # incomplete +def CreateRectRgn(*args, **kwargs): ... # incomplete +def GetRecentFileList(*args, **kwargs): ... # incomplete +def OutputDebug(*args, **kwargs): ... # incomplete + +AFX_IDW_PANE_FIRST: int +AFX_IDW_PANE_LAST: int +AFX_WS_DEFAULT_VIEW: int +CDocTemplate_Confidence_maybeAttemptForeign: int +CDocTemplate_Confidence_maybeAttemptNative: int +CDocTemplate_Confidence_noAttempt: int +CDocTemplate_Confidence_yesAlreadyOpen: int +CDocTemplate_Confidence_yesAttemptForeign: int +CDocTemplate_Confidence_yesAttemptNative: int +CDocTemplate_docName: int +CDocTemplate_fileNewName: int +CDocTemplate_filterExt: int +CDocTemplate_filterName: int +CDocTemplate_regFileTypeId: int +CDocTemplate_regFileTypeName: int +CDocTemplate_windowTitle: int +CRichEditView_WrapNone: int +CRichEditView_WrapToTargetDevice: int +CRichEditView_WrapToWindow: int +debug: int +FWS_ADDTOTITLE: int +FWS_PREFIXTITLE: int +FWS_SNAPTOBARS: int +ID_APP_ABOUT: int +ID_APP_EXIT: int +ID_EDIT_CLEAR: int +ID_EDIT_CLEAR_ALL: int +ID_EDIT_COPY: int +ID_EDIT_CUT: int +ID_EDIT_FIND: int +ID_EDIT_GOTO_LINE: int +ID_EDIT_PASTE: int +ID_EDIT_REDO: int +ID_EDIT_REPEAT: int +ID_EDIT_REPLACE: int +ID_EDIT_SELECT_ALL: int +ID_EDIT_SELECT_BLOCK: int +ID_EDIT_UNDO: int +ID_FILE_CHECK: int +ID_FILE_CLOSE: int +ID_FILE_IMPORT: int +ID_FILE_LOCATE: int +ID_FILE_MRU_FILE1: int +ID_FILE_MRU_FILE2: int +ID_FILE_MRU_FILE3: int +ID_FILE_MRU_FILE4: int +ID_FILE_NEW: int +ID_FILE_OPEN: int +ID_FILE_PAGE_SETUP: int +ID_FILE_PRINT: int +ID_FILE_PRINT_PREVIEW: int +ID_FILE_PRINT_SETUP: int +ID_FILE_RUN: int +ID_FILE_SAVE: int +ID_FILE_SAVE_ALL: int +ID_FILE_SAVE_AS: int +ID_HELP_GUI_REF: int +ID_HELP_OTHER: int +ID_HELP_PYTHON: int +ID_INDICATOR_COLNUM: int +ID_INDICATOR_LINENUM: int +ID_NEXT_PANE: int +ID_PREV_PANE: int +ID_SEPARATOR: int +ID_VIEW_BROWSE: int +ID_VIEW_EOL: int +ID_VIEW_FIXED_FONT: int +ID_VIEW_FOLD_COLLAPSE: int +ID_VIEW_FOLD_COLLAPSE_ALL: int +ID_VIEW_FOLD_EXPAND: int +ID_VIEW_FOLD_EXPAND_ALL: int +ID_VIEW_INDENTATIONGUIDES: int +ID_VIEW_INTERACTIVE: int +ID_VIEW_OPTIONS: int +ID_VIEW_RIGHT_EDGE: int +ID_VIEW_STATUS_BAR: int +ID_VIEW_TOOLBAR: int +ID_VIEW_TOOLBAR_DBG: int +ID_VIEW_WHITESPACE: int +ID_WINDOW_ARRANGE: int +ID_WINDOW_CASCADE: int +ID_WINDOW_NEW: int +ID_WINDOW_SPLIT: int +ID_WINDOW_TILE_HORZ: int +ID_WINDOW_TILE_VERT: int +IDB_BROWSER_HIER: int +IDB_DEBUGGER_HIER: int +IDB_HIERFOLDERS: int +IDC_ABOUT_VERSION: int +IDC_AUTO_RELOAD: int +IDC_AUTOCOMPLETE: int +IDC_BUTTON1: int +IDC_BUTTON2: int +IDC_BUTTON3: int +IDC_BUTTON4: int +IDC_CALLTIPS: int +IDC_CHECK1: int +IDC_CHECK2: int +IDC_CHECK3: int +IDC_COMBO1: int +IDC_COMBO2: int +IDC_EDIT1: int +IDC_EDIT2: int +IDC_EDIT3: int +IDC_EDIT4: int +IDC_EDIT_TABS: int +IDC_INDENT_SIZE: int +IDC_KEYBOARD_CONFIG: int +IDC_PROMPT1: int +IDC_PROMPT2: int +IDC_PROMPT3: int +IDC_PROMPT4: int +IDC_PROMPT_TABS: int +IDC_RADIO1: int +IDC_RADIO2: int +IDC_RIGHTEDGE_COLUMN: int +IDC_RIGHTEDGE_DEFINE: int +IDC_RIGHTEDGE_ENABLE: int +IDC_RIGHTEDGE_SAMPLE: int +IDC_SPIN1: int +IDC_SPIN2: int +IDC_SPIN3: int +IDC_TAB_SIZE: int +IDC_USE_SMART_TABS: int +IDC_USE_TABS: int +IDC_VIEW_WHITESPACE: int +IDC_VSS_INTEGRATE: int +IDD_ABOUTBOX: int +IDD_DUMMYPROPPAGE: int +IDD_GENERAL_STATUS: int +IDD_LARGE_EDIT: int +IDD_PP_DEBUGGER: int +IDD_PP_EDITOR: int +IDD_PP_FORMAT: int +IDD_PP_IDE: int +IDD_PP_TABS: int +IDD_PP_TOOLMENU: int +IDD_PROPDEMO1: int +IDD_PROPDEMO2: int +IDD_RUN_SCRIPT: int +IDD_SET_TABSTOPS: int +IDD_SIMPLE_INPUT: int +IDD_TREE: int +IDD_TREE_MB: int +IDR_CNTR_INPLACE: int +IDR_DEBUGGER: int +IDR_MAINFRAME: int +IDR_PYTHONCONTYPE: int +IDR_PYTHONTYPE: int +IDR_PYTHONTYPE_CNTR_IP: int +IDR_TEXTTYPE: int +LM_COMMIT: int +LM_HORZ: int +LM_HORZDOCK: int +LM_LENGTHY: int +LM_MRUWIDTH: int +LM_STRETCH: int +LM_VERTDOCK: int +MFS_4THICKFRAME: int +MFS_BLOCKSYSMENU: int +MFS_MOVEFRAME: int +MFS_SYNCACTIVE: int +MFS_THICKFRAME: int +PD_ALLPAGES: int +PD_COLLATE: int +PD_DISABLEPRINTTOFILE: int +PD_ENABLEPRINTHOOK: int +PD_ENABLEPRINTTEMPLATE: int +PD_ENABLEPRINTTEMPLATEHANDLE: int +PD_ENABLESETUPHOOK: int +PD_ENABLESETUPTEMPLATE: int +PD_ENABLESETUPTEMPLATEHANDLE: int +PD_HIDEPRINTTOFILE: int +PD_NONETWORKBUTTON: int +PD_NOPAGENUMS: int +PD_NOSELECTION: int +PD_NOWARNING: int +PD_PAGENUMS: int +PD_PRINTSETUP: int +PD_PRINTTOFILE: int +PD_RETURNDC: int +PD_RETURNDEFAULT: int +PD_RETURNIC: int +PD_SELECTION: int +PD_SHOWHELP: int +PD_USEDEVMODECOPIES: int +PD_USEDEVMODECOPIESANDCOLLATE: int +PSWIZB_BACK: int +PSWIZB_DISABLEDFINISH: int +PSWIZB_FINISH: int +PSWIZB_NEXT: int +IDC_DBG_ADD: int +IDC_DBG_BREAKPOINTS: int +IDC_DBG_CLEAR: int +IDC_DBG_CLOSE: int +IDC_DBG_GO: int +IDC_DBG_STACK: int +IDC_DBG_STEP: int +IDC_DBG_STEPOUT: int +IDC_DBG_STEPOVER: int +IDC_DBG_WATCH: int +IDC_EDITOR_COLOR: int +IDC_FOLD_ENABLE: int +IDC_FOLD_ON_OPEN: int +IDC_FOLD_SHOW_LINES: int +IDC_LIST1: int +IDC_MARGIN_FOLD: int +IDC_MARGIN_LINENUMBER: int +IDC_MARGIN_MARKER: int +IDC_TABTIMMY_BG: int +IDC_TABTIMMY_IND: int +IDC_TABTIMMY_NONE: int +IDC_VIEW_EOL: int +IDC_VIEW_INDENTATIONGUIDES: int +ID_VIEW_FOLD_TOPLEVEL: int +UNICODE: int +copyright: str +dllhandle: int +types: dict[str, type] diff --git a/stubs/pywin32/pythonwin/win32uiole.pyi b/stubs/pywin32/pythonwin/win32uiole.pyi new file mode 100644 index 0000000..5d30d75 --- /dev/null +++ b/stubs/pywin32/pythonwin/win32uiole.pyi @@ -0,0 +1,25 @@ +import _win32typing + +def AfxOleInit(enabled) -> None: ... +def CreateInsertDialog() -> _win32typing.PyCOleInsertDialog: ... +def CreateOleClientItem() -> _win32typing.PyCOleClientItem: ... +def CreateOleDocument(template: _win32typing.PyCDocTemplate, fileName: str | None = ...) -> _win32typing.PyCOleDocument: ... +def DaoGetEngine() -> _win32typing.PyIDispatch: ... +def GetIDispatchForWindow() -> _win32typing.PyIDispatch: ... +def OleGetUserCtrl(): ... +def OleSetUserCtrl(bUserCtrl): ... +def SetMessagePendingDelay(delay) -> None: ... +def EnableNotRespondingDialog(enabled) -> None: ... +def EnableBusyDialog(*args, **kwargs): ... # incomplete + +COleClientItem_activeState: int +COleClientItem_activeUIState: int +COleClientItem_emptyState: int +COleClientItem_loadedState: int +COleClientItem_openState: int +OLE_CHANGED: int +OLE_CHANGED_ASPECT: int +OLE_CHANGED_STATE: int +OLE_CLOSED: int +OLE_RENAMED: int +OLE_SAVED: int diff --git a/stubs/pywin32/pywintypes.pyi b/stubs/pywin32/pywintypes.pyi new file mode 100644 index 0000000..64c9f84 --- /dev/null +++ b/stubs/pywin32/pywintypes.pyi @@ -0,0 +1 @@ +from win32.lib.pywintypes import * diff --git a/stubs/pywin32/regutil.pyi b/stubs/pywin32/regutil.pyi new file mode 100644 index 0000000..ef4d7a4 --- /dev/null +++ b/stubs/pywin32/regutil.pyi @@ -0,0 +1 @@ +from win32.lib.regutil import * diff --git a/stubs/pywin32/servicemanager.pyi b/stubs/pywin32/servicemanager.pyi new file mode 100644 index 0000000..91dbd28 --- /dev/null +++ b/stubs/pywin32/servicemanager.pyi @@ -0,0 +1 @@ +from win32.servicemanager import * diff --git a/stubs/pywin32/sspicon.pyi b/stubs/pywin32/sspicon.pyi new file mode 100644 index 0000000..0618e19 --- /dev/null +++ b/stubs/pywin32/sspicon.pyi @@ -0,0 +1 @@ +from win32.lib.sspicon import * diff --git a/stubs/pywin32/timer.pyi b/stubs/pywin32/timer.pyi new file mode 100644 index 0000000..d3d2801 --- /dev/null +++ b/stubs/pywin32/timer.pyi @@ -0,0 +1 @@ +from win32.timer import * diff --git a/stubs/pywin32/win2kras.pyi b/stubs/pywin32/win2kras.pyi new file mode 100644 index 0000000..e9b1266 --- /dev/null +++ b/stubs/pywin32/win2kras.pyi @@ -0,0 +1 @@ +from win32.lib.win2kras import * diff --git a/stub-uploader/scripts/__init__.py b/stubs/pywin32/win32/__init__.pyi similarity index 100% rename from stub-uploader/scripts/__init__.py rename to stubs/pywin32/win32/__init__.pyi diff --git a/stubs/pywin32/win32/_wincerapi.pyi b/stubs/pywin32/win32/_wincerapi.pyi new file mode 100644 index 0000000..a33e7d6 --- /dev/null +++ b/stubs/pywin32/win32/_wincerapi.pyi @@ -0,0 +1,71 @@ +from _typeshed import Incomplete + +import _win32typing + +def CeRapiInit() -> None: ... +def CeRapiUninit() -> None: ... +def CreateProcess( + appName: str, + commandLine: str, + processAttributes: _win32typing.PySECURITY_ATTRIBUTES, + threadAttributes: _win32typing.PySECURITY_ATTRIBUTES, + bInheritHandles, + dwCreationFlags, + newEnvironment, + currentDirectory: str, + startupinfo: _win32typing.PySTARTUPINFO, +) -> tuple[int, int, Incomplete, Incomplete]: ... +def CeRapiInitEx(): ... +def CeCopyFile(_from: str, to: str, bFailIfExists) -> None: ... +def CeCheckPassword(password: str) -> None: ... +def CeCreateFile( + fileName: str, + desiredAccess, + shareMode, + attributes: _win32typing.PySECURITY_ATTRIBUTES, + creationDisposition, + flagsAndAttributes, + hTemplateFile: int, +) -> _win32typing.PyCEHANDLE: ... +def CeDeleteFile(fileName: str) -> None: ... +def CeMoveFile(existingFileName: str, newFileName: str) -> None: ... +def CeCreateDirectory(name: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... +def CeRemoveDirectory(lpPathName: str) -> None: ... +def CeGetTempPath() -> str: ... +def CeGetSystemInfo(): ... +def CeGetDesktopDeviceCaps(): ... +def CeGetSystemMetrics(): ... +def CeGetSpecialFolderPath() -> str: ... +def CeGetStoreInformation() -> tuple[Incomplete, Incomplete]: ... +def CeGetSystemPowerStatusEx(): ... +def CeSHCreateShortcut() -> None: ... +def CeSHGetShortcutTarget(): ... +def CeGetVersionEx() -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, str]: ... +def CeGlobalMemoryStatus(): ... +def FindFiles(fileSpec: str): ... +def CeGetFileAttributes(fileName: str): ... +def CeSetFileAttributes(filename: str, newAttributes) -> None: ... +def CeGetFileSize(): ... +def CeReadFile(hFile: int, bufSize) -> str: ... +def WriteFile(hFile: int, data: str) -> tuple[Incomplete, Incomplete]: ... + +CSIDL_BITBUCKET = ... +CSIDL_COMMON_DESKTOPDIRECTORY = ... +CSIDL_COMMON_PROGRAMS = ... +CSIDL_COMMON_STARTMENU = ... +CSIDL_COMMON_STARTUP = ... +CSIDL_CONTROLS = ... +CSIDL_DESKTOP = ... +CSIDL_DESKTOPDIRECTORY = ... +CSIDL_DRIVES = ... +CSIDL_FONTS = ... +CSIDL_NETHOOD = ... +CSIDL_NETWORK = ... +CSIDL_PERSONAL = ... +CSIDL_PRINTERS = ... +CSIDL_PROGRAMS = ... +CSIDL_RECENT = ... +CSIDL_SENDTO = ... +CSIDL_STARTMENU = ... +CSIDL_STARTUP = ... +CSIDL_TEMPLATES = ... diff --git a/stubs/Pillow/PIL/__main__.pyi b/stubs/pywin32/win32/lib/__init__.pyi similarity index 100% rename from stubs/Pillow/PIL/__main__.pyi rename to stubs/pywin32/win32/lib/__init__.pyi diff --git a/stubs/pywin32/win32/lib/afxres.pyi b/stubs/pywin32/win32/lib/afxres.pyi new file mode 100644 index 0000000..58a2086 --- /dev/null +++ b/stubs/pywin32/win32/lib/afxres.pyi @@ -0,0 +1,499 @@ +from _typeshed import Incomplete + +TCS_MULTILINE: int +CBRS_ALIGN_LEFT: int +CBRS_ALIGN_TOP: int +CBRS_ALIGN_RIGHT: int +CBRS_ALIGN_BOTTOM: int +CBRS_ALIGN_ANY: int +CBRS_BORDER_LEFT: int +CBRS_BORDER_TOP: int +CBRS_BORDER_RIGHT: int +CBRS_BORDER_BOTTOM: int +CBRS_BORDER_ANY: int +CBRS_TOOLTIPS: int +CBRS_FLYBY: int +CBRS_FLOAT_MULTI: int +CBRS_BORDER_3D: int +CBRS_HIDE_INPLACE: int +CBRS_SIZE_DYNAMIC: int +CBRS_SIZE_FIXED: int +CBRS_FLOATING: int +CBRS_GRIPPER: int +CBRS_ORIENT_HORZ: Incomplete +CBRS_ORIENT_VERT: Incomplete +CBRS_ORIENT_ANY: Incomplete +CBRS_ALL: int +CBRS_NOALIGN: int +CBRS_LEFT: Incomplete +CBRS_TOP: Incomplete +CBRS_RIGHT: Incomplete +CBRS_BOTTOM: Incomplete +SBPS_NORMAL: int +SBPS_NOBORDERS: int +SBPS_POPOUT: int +SBPS_OWNERDRAW: int +SBPS_DISABLED: int +SBPS_STRETCH: int +ID_INDICATOR_EXT: int +ID_INDICATOR_CAPS: int +ID_INDICATOR_NUM: int +ID_INDICATOR_SCRL: int +ID_INDICATOR_OVR: int +ID_INDICATOR_REC: int +ID_INDICATOR_KANA: int +ID_SEPARATOR: int +AFX_IDW_CONTROLBAR_FIRST: int +AFX_IDW_CONTROLBAR_LAST: int +AFX_IDW_TOOLBAR: int +AFX_IDW_STATUS_BAR: int +AFX_IDW_PREVIEW_BAR: int +AFX_IDW_RESIZE_BAR: int +AFX_IDW_DOCKBAR_TOP: int +AFX_IDW_DOCKBAR_LEFT: int +AFX_IDW_DOCKBAR_RIGHT: int +AFX_IDW_DOCKBAR_BOTTOM: int +AFX_IDW_DOCKBAR_FLOAT: int + +def AFX_CONTROLBAR_MASK(nIDC): ... + +AFX_IDW_PANE_FIRST: int +AFX_IDW_PANE_LAST: int +AFX_IDW_HSCROLL_FIRST: int +AFX_IDW_VSCROLL_FIRST: int +AFX_IDW_SIZE_BOX: int +AFX_IDW_PANE_SAVE: int +AFX_IDS_APP_TITLE: int +AFX_IDS_IDLEMESSAGE: int +AFX_IDS_HELPMODEMESSAGE: int +AFX_IDS_APP_TITLE_EMBEDDING: int +AFX_IDS_COMPANY_NAME: int +AFX_IDS_OBJ_TITLE_INPLACE: int +ID_FILE_NEW: int +ID_FILE_OPEN: int +ID_FILE_CLOSE: int +ID_FILE_SAVE: int +ID_FILE_SAVE_AS: int +ID_FILE_PAGE_SETUP: int +ID_FILE_PRINT_SETUP: int +ID_FILE_PRINT: int +ID_FILE_PRINT_DIRECT: int +ID_FILE_PRINT_PREVIEW: int +ID_FILE_UPDATE: int +ID_FILE_SAVE_COPY_AS: int +ID_FILE_SEND_MAIL: int +ID_FILE_MRU_FIRST: int +ID_FILE_MRU_FILE1: int +ID_FILE_MRU_FILE2: int +ID_FILE_MRU_FILE3: int +ID_FILE_MRU_FILE4: int +ID_FILE_MRU_FILE5: int +ID_FILE_MRU_FILE6: int +ID_FILE_MRU_FILE7: int +ID_FILE_MRU_FILE8: int +ID_FILE_MRU_FILE9: int +ID_FILE_MRU_FILE10: int +ID_FILE_MRU_FILE11: int +ID_FILE_MRU_FILE12: int +ID_FILE_MRU_FILE13: int +ID_FILE_MRU_FILE14: int +ID_FILE_MRU_FILE15: int +ID_FILE_MRU_FILE16: int +ID_FILE_MRU_LAST: int +ID_EDIT_CLEAR: int +ID_EDIT_CLEAR_ALL: int +ID_EDIT_COPY: int +ID_EDIT_CUT: int +ID_EDIT_FIND: int +ID_EDIT_PASTE: int +ID_EDIT_PASTE_LINK: int +ID_EDIT_PASTE_SPECIAL: int +ID_EDIT_REPEAT: int +ID_EDIT_REPLACE: int +ID_EDIT_SELECT_ALL: int +ID_EDIT_UNDO: int +ID_EDIT_REDO: int +ID_WINDOW_NEW: int +ID_WINDOW_ARRANGE: int +ID_WINDOW_CASCADE: int +ID_WINDOW_TILE_HORZ: int +ID_WINDOW_TILE_VERT: int +ID_WINDOW_SPLIT: int +AFX_IDM_WINDOW_FIRST: int +AFX_IDM_WINDOW_LAST: int +AFX_IDM_FIRST_MDICHILD: int +ID_APP_ABOUT: int +ID_APP_EXIT: int +ID_HELP_INDEX: int +ID_HELP_FINDER: int +ID_HELP_USING: int +ID_CONTEXT_HELP: int +ID_HELP: int +ID_DEFAULT_HELP: int +ID_NEXT_PANE: int +ID_PREV_PANE: int +ID_FORMAT_FONT: int +ID_OLE_INSERT_NEW: int +ID_OLE_EDIT_LINKS: int +ID_OLE_EDIT_CONVERT: int +ID_OLE_EDIT_CHANGE_ICON: int +ID_OLE_EDIT_PROPERTIES: int +ID_OLE_VERB_FIRST: int +ID_OLE_VERB_LAST: int +AFX_ID_PREVIEW_CLOSE: int +AFX_ID_PREVIEW_NUMPAGE: int +AFX_ID_PREVIEW_NEXT: int +AFX_ID_PREVIEW_PREV: int +AFX_ID_PREVIEW_PRINT: int +AFX_ID_PREVIEW_ZOOMIN: int +AFX_ID_PREVIEW_ZOOMOUT: int +ID_VIEW_TOOLBAR: int +ID_VIEW_STATUS_BAR: int +ID_RECORD_FIRST: int +ID_RECORD_LAST: int +ID_RECORD_NEXT: int +ID_RECORD_PREV: int +IDC_STATIC: int +AFX_IDS_SCFIRST: int +AFX_IDS_SCSIZE: int +AFX_IDS_SCMOVE: int +AFX_IDS_SCMINIMIZE: int +AFX_IDS_SCMAXIMIZE: int +AFX_IDS_SCNEXTWINDOW: int +AFX_IDS_SCPREVWINDOW: int +AFX_IDS_SCCLOSE: int +AFX_IDS_SCRESTORE: int +AFX_IDS_SCTASKLIST: int +AFX_IDS_MDICHILD: int +AFX_IDS_DESKACCESSORY: int +AFX_IDS_OPENFILE: int +AFX_IDS_SAVEFILE: int +AFX_IDS_ALLFILTER: int +AFX_IDS_UNTITLED: int +AFX_IDS_SAVEFILECOPY: int +AFX_IDS_PREVIEW_CLOSE: int +AFX_IDS_UNNAMED_FILE: int +AFX_IDS_ABOUT: int +AFX_IDS_HIDE: int +AFX_IDP_NO_ERROR_AVAILABLE: int +AFX_IDS_NOT_SUPPORTED_EXCEPTION: int +AFX_IDS_RESOURCE_EXCEPTION: int +AFX_IDS_MEMORY_EXCEPTION: int +AFX_IDS_USER_EXCEPTION: int +AFX_IDS_PRINTONPORT: int +AFX_IDS_ONEPAGE: int +AFX_IDS_TWOPAGE: int +AFX_IDS_PRINTPAGENUM: int +AFX_IDS_PREVIEWPAGEDESC: int +AFX_IDS_PRINTDEFAULTEXT: int +AFX_IDS_PRINTDEFAULT: int +AFX_IDS_PRINTFILTER: int +AFX_IDS_PRINTCAPTION: int +AFX_IDS_PRINTTOFILE: int +AFX_IDS_OBJECT_MENUITEM: int +AFX_IDS_EDIT_VERB: int +AFX_IDS_ACTIVATE_VERB: int +AFX_IDS_CHANGE_LINK: int +AFX_IDS_AUTO: int +AFX_IDS_MANUAL: int +AFX_IDS_FROZEN: int +AFX_IDS_ALL_FILES: int +AFX_IDS_SAVE_MENU: int +AFX_IDS_UPDATE_MENU: int +AFX_IDS_SAVE_AS_MENU: int +AFX_IDS_SAVE_COPY_AS_MENU: int +AFX_IDS_EXIT_MENU: int +AFX_IDS_UPDATING_ITEMS: int +AFX_IDS_METAFILE_FORMAT: int +AFX_IDS_DIB_FORMAT: int +AFX_IDS_BITMAP_FORMAT: int +AFX_IDS_LINKSOURCE_FORMAT: int +AFX_IDS_EMBED_FORMAT: int +AFX_IDS_PASTELINKEDTYPE: int +AFX_IDS_UNKNOWNTYPE: int +AFX_IDS_RTF_FORMAT: int +AFX_IDS_TEXT_FORMAT: int +AFX_IDS_INVALID_CURRENCY: int +AFX_IDS_INVALID_DATETIME: int +AFX_IDS_INVALID_DATETIMESPAN: int +AFX_IDP_INVALID_FILENAME: int +AFX_IDP_FAILED_TO_OPEN_DOC: int +AFX_IDP_FAILED_TO_SAVE_DOC: int +AFX_IDP_ASK_TO_SAVE: int +AFX_IDP_FAILED_TO_CREATE_DOC: int +AFX_IDP_FILE_TOO_LARGE: int +AFX_IDP_FAILED_TO_START_PRINT: int +AFX_IDP_FAILED_TO_LAUNCH_HELP: int +AFX_IDP_INTERNAL_FAILURE: int +AFX_IDP_COMMAND_FAILURE: int +AFX_IDP_FAILED_MEMORY_ALLOC: int +AFX_IDP_PARSE_INT: int +AFX_IDP_PARSE_REAL: int +AFX_IDP_PARSE_INT_RANGE: int +AFX_IDP_PARSE_REAL_RANGE: int +AFX_IDP_PARSE_STRING_SIZE: int +AFX_IDP_PARSE_RADIO_BUTTON: int +AFX_IDP_PARSE_BYTE: int +AFX_IDP_PARSE_UINT: int +AFX_IDP_PARSE_DATETIME: int +AFX_IDP_PARSE_CURRENCY: int +AFX_IDP_FAILED_INVALID_FORMAT: int +AFX_IDP_FAILED_INVALID_PATH: int +AFX_IDP_FAILED_DISK_FULL: int +AFX_IDP_FAILED_ACCESS_READ: int +AFX_IDP_FAILED_ACCESS_WRITE: int +AFX_IDP_FAILED_IO_ERROR_READ: int +AFX_IDP_FAILED_IO_ERROR_WRITE: int +AFX_IDP_STATIC_OBJECT: int +AFX_IDP_FAILED_TO_CONNECT: int +AFX_IDP_SERVER_BUSY: int +AFX_IDP_BAD_VERB: int +AFX_IDP_FAILED_TO_NOTIFY: int +AFX_IDP_FAILED_TO_LAUNCH: int +AFX_IDP_ASK_TO_UPDATE: int +AFX_IDP_FAILED_TO_UPDATE: int +AFX_IDP_FAILED_TO_REGISTER: int +AFX_IDP_FAILED_TO_AUTO_REGISTER: int +AFX_IDP_FAILED_TO_CONVERT: int +AFX_IDP_GET_NOT_SUPPORTED: int +AFX_IDP_SET_NOT_SUPPORTED: int +AFX_IDP_ASK_TO_DISCARD: int +AFX_IDP_FAILED_TO_CREATE: int +AFX_IDP_FAILED_MAPI_LOAD: int +AFX_IDP_INVALID_MAPI_DLL: int +AFX_IDP_FAILED_MAPI_SEND: int +AFX_IDP_FILE_NONE: int +AFX_IDP_FILE_GENERIC: int +AFX_IDP_FILE_NOT_FOUND: int +AFX_IDP_FILE_BAD_PATH: int +AFX_IDP_FILE_TOO_MANY_OPEN: int +AFX_IDP_FILE_ACCESS_DENIED: int +AFX_IDP_FILE_INVALID_FILE: int +AFX_IDP_FILE_REMOVE_CURRENT: int +AFX_IDP_FILE_DIR_FULL: int +AFX_IDP_FILE_BAD_SEEK: int +AFX_IDP_FILE_HARD_IO: int +AFX_IDP_FILE_SHARING: int +AFX_IDP_FILE_LOCKING: int +AFX_IDP_FILE_DISKFULL: int +AFX_IDP_FILE_EOF: int +AFX_IDP_ARCH_NONE: int +AFX_IDP_ARCH_GENERIC: int +AFX_IDP_ARCH_READONLY: int +AFX_IDP_ARCH_ENDOFFILE: int +AFX_IDP_ARCH_WRITEONLY: int +AFX_IDP_ARCH_BADINDEX: int +AFX_IDP_ARCH_BADCLASS: int +AFX_IDP_ARCH_BADSCHEMA: int +AFX_IDS_OCC_SCALEUNITS_PIXELS: int +AFX_IDS_STATUS_FONT: int +AFX_IDS_TOOLTIP_FONT: int +AFX_IDS_UNICODE_FONT: int +AFX_IDS_MINI_FONT: int +AFX_IDP_SQL_FIRST: int +AFX_IDP_SQL_CONNECT_FAIL: int +AFX_IDP_SQL_RECORDSET_FORWARD_ONLY: int +AFX_IDP_SQL_EMPTY_COLUMN_LIST: int +AFX_IDP_SQL_FIELD_SCHEMA_MISMATCH: int +AFX_IDP_SQL_ILLEGAL_MODE: int +AFX_IDP_SQL_MULTIPLE_ROWS_AFFECTED: int +AFX_IDP_SQL_NO_CURRENT_RECORD: int +AFX_IDP_SQL_NO_ROWS_AFFECTED: int +AFX_IDP_SQL_RECORDSET_READONLY: int +AFX_IDP_SQL_SQL_NO_TOTAL: int +AFX_IDP_SQL_ODBC_LOAD_FAILED: int +AFX_IDP_SQL_DYNASET_NOT_SUPPORTED: int +AFX_IDP_SQL_SNAPSHOT_NOT_SUPPORTED: int +AFX_IDP_SQL_API_CONFORMANCE: int +AFX_IDP_SQL_SQL_CONFORMANCE: int +AFX_IDP_SQL_NO_DATA_FOUND: int +AFX_IDP_SQL_ROW_UPDATE_NOT_SUPPORTED: int +AFX_IDP_SQL_ODBC_V2_REQUIRED: int +AFX_IDP_SQL_NO_POSITIONED_UPDATES: int +AFX_IDP_SQL_LOCK_MODE_NOT_SUPPORTED: int +AFX_IDP_SQL_DATA_TRUNCATED: int +AFX_IDP_SQL_ROW_FETCH: int +AFX_IDP_SQL_INCORRECT_ODBC: int +AFX_IDP_SQL_UPDATE_DELETE_FAILED: int +AFX_IDP_SQL_DYNAMIC_CURSOR_NOT_SUPPORTED: int +AFX_IDP_DAO_FIRST: int +AFX_IDP_DAO_ENGINE_INITIALIZATION: int +AFX_IDP_DAO_DFX_BIND: int +AFX_IDP_DAO_OBJECT_NOT_OPEN: int +AFX_IDP_DAO_ROWTOOSHORT: int +AFX_IDP_DAO_BADBINDINFO: int +AFX_IDP_DAO_COLUMNUNAVAILABLE: int +AFX_IDC_LISTBOX: int +AFX_IDC_CHANGE: int +AFX_IDC_PRINT_DOCNAME: int +AFX_IDC_PRINT_PRINTERNAME: int +AFX_IDC_PRINT_PORTNAME: int +AFX_IDC_PRINT_PAGENUM: int +ID_APPLY_NOW: int +ID_WIZBACK: int +ID_WIZNEXT: int +ID_WIZFINISH: int +AFX_IDC_TAB_CONTROL: int +AFX_IDD_FILEOPEN: int +AFX_IDD_FILESAVE: int +AFX_IDD_FONT: int +AFX_IDD_COLOR: int +AFX_IDD_PRINT: int +AFX_IDD_PRINTSETUP: int +AFX_IDD_FIND: int +AFX_IDD_REPLACE: int +AFX_IDD_NEWTYPEDLG: int +AFX_IDD_PRINTDLG: int +AFX_IDD_PREVIEW_TOOLBAR: int +AFX_IDD_PREVIEW_SHORTTOOLBAR: int +AFX_IDD_INSERTOBJECT: int +AFX_IDD_CHANGEICON: int +AFX_IDD_CONVERT: int +AFX_IDD_PASTESPECIAL: int +AFX_IDD_EDITLINKS: int +AFX_IDD_FILEBROWSE: int +AFX_IDD_BUSY: int +AFX_IDD_OBJECTPROPERTIES: int +AFX_IDD_CHANGESOURCE: int +AFX_IDC_CONTEXTHELP: int +AFX_IDC_MAGNIFY: int +AFX_IDC_SMALLARROWS: int +AFX_IDC_HSPLITBAR: int +AFX_IDC_VSPLITBAR: int +AFX_IDC_NODROPCRSR: int +AFX_IDC_TRACKNWSE: int +AFX_IDC_TRACKNESW: int +AFX_IDC_TRACKNS: int +AFX_IDC_TRACKWE: int +AFX_IDC_TRACK4WAY: int +AFX_IDC_MOVE4WAY: int +AFX_IDB_MINIFRAME_MENU: int +AFX_IDB_CHECKLISTBOX_NT: int +AFX_IDB_CHECKLISTBOX_95: int +AFX_IDR_PREVIEW_ACCEL: int +AFX_IDI_STD_MDIFRAME: int +AFX_IDI_STD_FRAME: int +AFX_IDC_FONTPROP: int +AFX_IDC_FONTNAMES: int +AFX_IDC_FONTSTYLES: int +AFX_IDC_FONTSIZES: int +AFX_IDC_STRIKEOUT: int +AFX_IDC_UNDERLINE: int +AFX_IDC_SAMPLEBOX: int +AFX_IDC_COLOR_BLACK: int +AFX_IDC_COLOR_WHITE: int +AFX_IDC_COLOR_RED: int +AFX_IDC_COLOR_GREEN: int +AFX_IDC_COLOR_BLUE: int +AFX_IDC_COLOR_YELLOW: int +AFX_IDC_COLOR_MAGENTA: int +AFX_IDC_COLOR_CYAN: int +AFX_IDC_COLOR_GRAY: int +AFX_IDC_COLOR_LIGHTGRAY: int +AFX_IDC_COLOR_DARKRED: int +AFX_IDC_COLOR_DARKGREEN: int +AFX_IDC_COLOR_DARKBLUE: int +AFX_IDC_COLOR_LIGHTBROWN: int +AFX_IDC_COLOR_DARKMAGENTA: int +AFX_IDC_COLOR_DARKCYAN: int +AFX_IDC_COLORPROP: int +AFX_IDC_SYSTEMCOLORS: int +AFX_IDC_PROPNAME: int +AFX_IDC_PICTURE: int +AFX_IDC_BROWSE: int +AFX_IDC_CLEAR: int +AFX_IDD_PROPPAGE_COLOR: int +AFX_IDD_PROPPAGE_FONT: int +AFX_IDD_PROPPAGE_PICTURE: int +AFX_IDB_TRUETYPE: int +AFX_IDS_PROPPAGE_UNKNOWN: int +AFX_IDS_COLOR_DESKTOP: int +AFX_IDS_COLOR_APPWORKSPACE: int +AFX_IDS_COLOR_WNDBACKGND: int +AFX_IDS_COLOR_WNDTEXT: int +AFX_IDS_COLOR_MENUBAR: int +AFX_IDS_COLOR_MENUTEXT: int +AFX_IDS_COLOR_ACTIVEBAR: int +AFX_IDS_COLOR_INACTIVEBAR: int +AFX_IDS_COLOR_ACTIVETEXT: int +AFX_IDS_COLOR_INACTIVETEXT: int +AFX_IDS_COLOR_ACTIVEBORDER: int +AFX_IDS_COLOR_INACTIVEBORDER: int +AFX_IDS_COLOR_WNDFRAME: int +AFX_IDS_COLOR_SCROLLBARS: int +AFX_IDS_COLOR_BTNFACE: int +AFX_IDS_COLOR_BTNSHADOW: int +AFX_IDS_COLOR_BTNTEXT: int +AFX_IDS_COLOR_BTNHIGHLIGHT: int +AFX_IDS_COLOR_DISABLEDTEXT: int +AFX_IDS_COLOR_HIGHLIGHT: int +AFX_IDS_COLOR_HIGHLIGHTTEXT: int +AFX_IDS_REGULAR: int +AFX_IDS_BOLD: int +AFX_IDS_ITALIC: int +AFX_IDS_BOLDITALIC: int +AFX_IDS_SAMPLETEXT: int +AFX_IDS_DISPLAYSTRING_FONT: int +AFX_IDS_DISPLAYSTRING_COLOR: int +AFX_IDS_DISPLAYSTRING_PICTURE: int +AFX_IDS_PICTUREFILTER: int +AFX_IDS_PICTYPE_UNKNOWN: int +AFX_IDS_PICTYPE_NONE: int +AFX_IDS_PICTYPE_BITMAP: int +AFX_IDS_PICTYPE_METAFILE: int +AFX_IDS_PICTYPE_ICON: int +AFX_IDS_COLOR_PPG: int +AFX_IDS_COLOR_PPG_CAPTION: int +AFX_IDS_FONT_PPG: int +AFX_IDS_FONT_PPG_CAPTION: int +AFX_IDS_PICTURE_PPG: int +AFX_IDS_PICTURE_PPG_CAPTION: int +AFX_IDS_PICTUREBROWSETITLE: int +AFX_IDS_BORDERSTYLE_0: int +AFX_IDS_BORDERSTYLE_1: int +AFX_IDS_VERB_EDIT: int +AFX_IDS_VERB_PROPERTIES: int +AFX_IDP_PICTURECANTOPEN: int +AFX_IDP_PICTURECANTLOAD: int +AFX_IDP_PICTURETOOLARGE: int +AFX_IDP_PICTUREREADFAILED: int +AFX_IDP_E_ILLEGALFUNCTIONCALL: int +AFX_IDP_E_OVERFLOW: int +AFX_IDP_E_OUTOFMEMORY: int +AFX_IDP_E_DIVISIONBYZERO: int +AFX_IDP_E_OUTOFSTRINGSPACE: int +AFX_IDP_E_OUTOFSTACKSPACE: int +AFX_IDP_E_BADFILENAMEORNUMBER: int +AFX_IDP_E_FILENOTFOUND: int +AFX_IDP_E_BADFILEMODE: int +AFX_IDP_E_FILEALREADYOPEN: int +AFX_IDP_E_DEVICEIOERROR: int +AFX_IDP_E_FILEALREADYEXISTS: int +AFX_IDP_E_BADRECORDLENGTH: int +AFX_IDP_E_DISKFULL: int +AFX_IDP_E_BADRECORDNUMBER: int +AFX_IDP_E_BADFILENAME: int +AFX_IDP_E_TOOMANYFILES: int +AFX_IDP_E_DEVICEUNAVAILABLE: int +AFX_IDP_E_PERMISSIONDENIED: int +AFX_IDP_E_DISKNOTREADY: int +AFX_IDP_E_PATHFILEACCESSERROR: int +AFX_IDP_E_PATHNOTFOUND: int +AFX_IDP_E_INVALIDPATTERNSTRING: int +AFX_IDP_E_INVALIDUSEOFNULL: int +AFX_IDP_E_INVALIDFILEFORMAT: int +AFX_IDP_E_INVALIDPROPERTYVALUE: int +AFX_IDP_E_INVALIDPROPERTYARRAYINDEX: int +AFX_IDP_E_SETNOTSUPPORTEDATRUNTIME: int +AFX_IDP_E_SETNOTSUPPORTED: int +AFX_IDP_E_NEEDPROPERTYARRAYINDEX: int +AFX_IDP_E_SETNOTPERMITTED: int +AFX_IDP_E_GETNOTSUPPORTEDATRUNTIME: int +AFX_IDP_E_GETNOTSUPPORTED: int +AFX_IDP_E_PROPERTYNOTFOUND: int +AFX_IDP_E_INVALIDCLIPBOARDFORMAT: int +AFX_IDP_E_INVALIDPICTURE: int +AFX_IDP_E_PRINTERERROR: int +AFX_IDP_E_CANTSAVEFILETOTEMP: int +AFX_IDP_E_SEARCHTEXTNOTFOUND: int +AFX_IDP_E_REPLACEMENTSTOOLONG: int diff --git a/stubs/pywin32/win32/lib/commctrl.pyi b/stubs/pywin32/win32/lib/commctrl.pyi new file mode 100644 index 0000000..d1e76bc --- /dev/null +++ b/stubs/pywin32/win32/lib/commctrl.pyi @@ -0,0 +1,1522 @@ +from _typeshed import Incomplete + +WM_USER: int +ICC_LISTVIEW_CLASSES: int +ICC_TREEVIEW_CLASSES: int +ICC_BAR_CLASSES: int +ICC_TAB_CLASSES: int +ICC_UPDOWN_CLASS: int +ICC_PROGRESS_CLASS: int +ICC_HOTKEY_CLASS: int +ICC_ANIMATE_CLASS: int +ICC_WIN95_CLASSES: int +ICC_DATE_CLASSES: int +ICC_USEREX_CLASSES: int +ICC_COOL_CLASSES: int +ICC_INTERNET_CLASSES: int +ICC_PAGESCROLLER_CLASS: int +ICC_NATIVEFNTCTL_CLASS: int +ODT_HEADER: int +ODT_TAB: int +ODT_LISTVIEW: int +PY_0U: int +NM_FIRST: int +NM_LAST: Incomplete +LVN_FIRST: Incomplete +LVN_LAST: Incomplete +HDN_FIRST: Incomplete +HDN_LAST: Incomplete +TVN_FIRST: Incomplete +TVN_LAST: Incomplete +TTN_FIRST: Incomplete +TTN_LAST: Incomplete +TCN_FIRST: Incomplete +TCN_LAST: Incomplete +CDN_FIRST: Incomplete +CDN_LAST: Incomplete +TBN_FIRST: Incomplete +TBN_LAST: Incomplete +UDN_FIRST: Incomplete +UDN_LAST: Incomplete +MCN_FIRST: Incomplete +MCN_LAST: Incomplete +DTN_FIRST: Incomplete +DTN_LAST: Incomplete +CBEN_FIRST: Incomplete +CBEN_LAST: Incomplete +RBN_FIRST: Incomplete +RBN_LAST: Incomplete +IPN_FIRST: Incomplete +IPN_LAST: Incomplete +SBN_FIRST: Incomplete +SBN_LAST: Incomplete +PGN_FIRST: Incomplete +PGN_LAST: Incomplete +LVM_FIRST: int +TV_FIRST: int +HDM_FIRST: int +TCM_FIRST: int +PGM_FIRST: int +CCM_FIRST: int +CCM_SETBKCOLOR: Incomplete +CCM_SETCOLORSCHEME: Incomplete +CCM_GETCOLORSCHEME: Incomplete +CCM_GETDROPTARGET: Incomplete +CCM_SETUNICODEFORMAT: Incomplete +CCM_GETUNICODEFORMAT: Incomplete +INFOTIPSIZE: int +NM_OUTOFMEMORY: Incomplete +NM_CLICK: Incomplete +NM_DBLCLK: Incomplete +NM_RETURN: Incomplete +NM_RCLICK: Incomplete +NM_RDBLCLK: Incomplete +NM_SETFOCUS: Incomplete +NM_KILLFOCUS: Incomplete +NM_CUSTOMDRAW: Incomplete +NM_HOVER: Incomplete +NM_NCHITTEST: Incomplete +NM_KEYDOWN: Incomplete +NM_RELEASEDCAPTURE: Incomplete +NM_SETCURSOR: Incomplete +NM_CHAR: Incomplete +MSGF_COMMCTRL_BEGINDRAG: int +MSGF_COMMCTRL_SIZEHEADER: int +MSGF_COMMCTRL_DRAGSELECT: int +MSGF_COMMCTRL_TOOLBARCUST: int +CDRF_DODEFAULT: int +CDRF_NEWFONT: int +CDRF_SKIPDEFAULT: int +CDRF_NOTIFYPOSTPAINT: int +CDRF_NOTIFYITEMDRAW: int +CDRF_NOTIFYSUBITEMDRAW: int +CDRF_NOTIFYPOSTERASE: int +CDDS_PREPAINT: int +CDDS_POSTPAINT: int +CDDS_PREERASE: int +CDDS_POSTERASE: int +CDDS_ITEM: int +CDDS_ITEMPREPAINT: Incomplete +CDDS_ITEMPOSTPAINT: Incomplete +CDDS_ITEMPREERASE: Incomplete +CDDS_ITEMPOSTERASE: Incomplete +CDDS_SUBITEM: int +CDIS_SELECTED: int +CDIS_GRAYED: int +CDIS_DISABLED: int +CDIS_CHECKED: int +CDIS_FOCUS: int +CDIS_DEFAULT: int +CDIS_HOT: int +CDIS_MARKED: int +CDIS_INDETERMINATE: int +CLR_NONE: int +CLR_DEFAULT: int +ILC_MASK: int +ILC_COLOR: int +ILC_COLORDDB: int +ILC_COLOR4: int +ILC_COLOR8: int +ILC_COLOR16: int +ILC_COLOR24: int +ILC_COLOR32: int +ILC_PALETTE: int +ILD_NORMAL: int +ILD_TRANSPARENT: int +ILD_MASK: int +ILD_IMAGE: int +ILD_ROP: int +ILD_BLEND25: int +ILD_BLEND50: int +ILD_OVERLAYMASK: int +ILD_SELECTED: int +ILD_FOCUS: int +ILD_BLEND: int +CLR_HILIGHT: int +ILCF_MOVE: int +ILCF_SWAP: int +WC_HEADERA: str +WC_HEADER: str +HDS_HORZ: int +HDS_BUTTONS: int +HDS_HOTTRACK: int +HDS_HIDDEN: int +HDS_DRAGDROP: int +HDS_FULLDRAG: int +HDI_WIDTH: int +HDI_HEIGHT: int +HDI_TEXT: int +HDI_FORMAT: int +HDI_LPARAM: int +HDI_BITMAP: int +HDI_IMAGE: int +HDI_DI_SETITEM: int +HDI_ORDER: int +HDF_LEFT: int +HDF_RIGHT: int +HDF_CENTER: int +HDF_JUSTIFYMASK: int +HDF_RTLREADING: int +HDF_OWNERDRAW: int +HDF_STRING: int +HDF_BITMAP: int +HDF_BITMAP_ON_RIGHT: int +HDF_IMAGE: int +HDM_GETITEMCOUNT: Incomplete +HDM_INSERTITEMA: Incomplete +HDM_INSERTITEMW: Incomplete +HDM_INSERTITEM: Incomplete +HDM_DELETEITEM: Incomplete +HDM_GETITEMA: Incomplete +HDM_GETITEMW: Incomplete +HDM_GETITEM: Incomplete +HDM_SETITEMA: Incomplete +HDM_SETITEMW: Incomplete +HDM_SETITEM: Incomplete +HDM_LAYOUT: Incomplete +HHT_NOWHERE: int +HHT_ONHEADER: int +HHT_ONDIVIDER: int +HHT_ONDIVOPEN: int +HHT_ABOVE: int +HHT_BELOW: int +HHT_TORIGHT: int +HHT_TOLEFT: int +HDM_HITTEST: Incomplete +HDM_GETITEMRECT: Incomplete +HDM_SETIMAGELIST: Incomplete +HDM_GETIMAGELIST: Incomplete +HDM_ORDERTOINDEX: Incomplete +HDM_CREATEDRAGIMAGE: Incomplete +HDM_GETORDERARRAY: Incomplete +HDM_SETORDERARRAY: Incomplete +HDM_SETHOTDIVIDER: Incomplete +HDM_SETUNICODEFORMAT: Incomplete +HDM_GETUNICODEFORMAT: Incomplete +HDN_ITEMCHANGINGA: Incomplete +HDN_ITEMCHANGINGW: Incomplete +HDN_ITEMCHANGEDA: Incomplete +HDN_ITEMCHANGEDW: Incomplete +HDN_ITEMCLICKA: Incomplete +HDN_ITEMCLICKW: Incomplete +HDN_ITEMDBLCLICKA: Incomplete +HDN_ITEMDBLCLICKW: Incomplete +HDN_DIVIDERDBLCLICKA: Incomplete +HDN_DIVIDERDBLCLICKW: Incomplete +HDN_BEGINTRACKA: Incomplete +HDN_BEGINTRACKW: Incomplete +HDN_ENDTRACKA: Incomplete +HDN_ENDTRACKW: Incomplete +HDN_TRACKA: Incomplete +HDN_TRACKW: Incomplete +HDN_GETDISPINFOA: Incomplete +HDN_GETDISPINFOW: Incomplete +HDN_BEGINDRAG: Incomplete +HDN_ENDDRAG: Incomplete +HDN_ITEMCHANGING: Incomplete +HDN_ITEMCHANGED: Incomplete +HDN_ITEMCLICK: Incomplete +HDN_ITEMDBLCLICK: Incomplete +HDN_DIVIDERDBLCLICK: Incomplete +HDN_BEGINTRACK: Incomplete +HDN_ENDTRACK: Incomplete +HDN_TRACK: Incomplete +HDN_GETDISPINFO: Incomplete +TOOLBARCLASSNAMEA: str +TOOLBARCLASSNAME: str +CMB_MASKED: int +TBSTATE_CHECKED: int +TBSTATE_PRESSED: int +TBSTATE_ENABLED: int +TBSTATE_HIDDEN: int +TBSTATE_INDETERMINATE: int +TBSTATE_WRAP: int +TBSTATE_ELLIPSES: int +TBSTATE_MARKED: int +TBSTYLE_BUTTON: int +TBSTYLE_SEP: int +TBSTYLE_CHECK: int +TBSTYLE_GROUP: int +TBSTYLE_CHECKGROUP: Incomplete +TBSTYLE_DROPDOWN: int +TBSTYLE_AUTOSIZE: int +TBSTYLE_NOPREFIX: int +TBSTYLE_TOOLTIPS: int +TBSTYLE_WRAPABLE: int +TBSTYLE_ALTDRAG: int +TBSTYLE_FLAT: int +TBSTYLE_LIST: int +TBSTYLE_CUSTOMERASE: int +TBSTYLE_REGISTERDROP: int +TBSTYLE_TRANSPARENT: int +TBSTYLE_EX_DRAWDDARROWS: int +BTNS_BUTTON: int +BTNS_SEP: int +BTNS_CHECK: int +BTNS_GROUP: int +BTNS_CHECKGROUP: Incomplete +BTNS_DROPDOWN: int +BTNS_AUTOSIZE: int +BTNS_NOPREFIX: int +BTNS_SHOWTEXT: int +BTNS_WHOLEDROPDOWN: int +TBCDRF_NOEDGES: int +TBCDRF_HILITEHOTTRACK: int +TBCDRF_NOOFFSET: int +TBCDRF_NOMARK: int +TBCDRF_NOETCHEDEFFECT: int +TB_ENABLEBUTTON: Incomplete +TB_CHECKBUTTON: Incomplete +TB_PRESSBUTTON: Incomplete +TB_HIDEBUTTON: Incomplete +TB_INDETERMINATE: Incomplete +TB_MARKBUTTON: Incomplete +TB_ISBUTTONENABLED: Incomplete +TB_ISBUTTONCHECKED: Incomplete +TB_ISBUTTONPRESSED: Incomplete +TB_ISBUTTONHIDDEN: Incomplete +TB_ISBUTTONINDETERMINATE: Incomplete +TB_ISBUTTONHIGHLIGHTED: Incomplete +TB_SETSTATE: Incomplete +TB_GETSTATE: Incomplete +TB_ADDBITMAP: Incomplete +HINST_COMMCTRL: int +IDB_STD_SMALL_COLOR: int +IDB_STD_LARGE_COLOR: int +IDB_VIEW_SMALL_COLOR: int +IDB_VIEW_LARGE_COLOR: int +IDB_HIST_SMALL_COLOR: int +IDB_HIST_LARGE_COLOR: int +STD_CUT: int +STD_COPY: int +STD_PASTE: int +STD_UNDO: int +STD_REDOW: int +STD_DELETE: int +STD_FILENEW: int +STD_FILEOPEN: int +STD_FILESAVE: int +STD_PRINTPRE: int +STD_PROPERTIES: int +STD_HELP: int +STD_FIND: int +STD_REPLACE: int +STD_PRINT: int +VIEW_LARGEICONS: int +VIEW_SMALLICONS: int +VIEW_LIST: int +VIEW_DETAILS: int +VIEW_SORTNAME: int +VIEW_SORTSIZE: int +VIEW_SORTDATE: int +VIEW_SORTTYPE: int +VIEW_PARENTFOLDER: int +VIEW_NETCONNECT: int +VIEW_NETDISCONNECT: int +VIEW_NEWFOLDER: int +VIEW_VIEWMENU: int +HIST_BACK: int +HIST_FORWARD: int +HIST_FAVORITES: int +HIST_ADDTOFAVORITES: int +HIST_VIEWTREE: int +TB_ADDBUTTONSA: Incomplete +TB_INSERTBUTTONA: Incomplete +TB_ADDBUTTONS: Incomplete +TB_INSERTBUTTON: Incomplete +TB_DELETEBUTTON: Incomplete +TB_GETBUTTON: Incomplete +TB_BUTTONCOUNT: Incomplete +TB_COMMANDTOINDEX: Incomplete +TB_SAVERESTOREA: Incomplete +TB_SAVERESTOREW: Incomplete +TB_CUSTOMIZE: Incomplete +TB_ADDSTRINGA: Incomplete +TB_ADDSTRINGW: Incomplete +TB_GETITEMRECT: Incomplete +TB_BUTTONSTRUCTSIZE: Incomplete +TB_SETBUTTONSIZE: Incomplete +TB_SETBITMAPSIZE: Incomplete +TB_AUTOSIZE: Incomplete +TB_GETTOOLTIPS: Incomplete +TB_SETTOOLTIPS: Incomplete +TB_SETPARENT: Incomplete +TB_SETROWS: Incomplete +TB_GETROWS: Incomplete +TB_SETCMDID: Incomplete +TB_CHANGEBITMAP: Incomplete +TB_GETBITMAP: Incomplete +TB_GETBUTTONTEXTA: Incomplete +TB_GETBUTTONTEXTW: Incomplete +TB_REPLACEBITMAP: Incomplete +TB_SETINDENT: Incomplete +TB_SETIMAGELIST: Incomplete +TB_GETIMAGELIST: Incomplete +TB_LOADIMAGES: Incomplete +TB_GETRECT: Incomplete +TB_SETHOTIMAGELIST: Incomplete +TB_GETHOTIMAGELIST: Incomplete +TB_SETDISABLEDIMAGELIST: Incomplete +TB_GETDISABLEDIMAGELIST: Incomplete +TB_SETSTYLE: Incomplete +TB_GETSTYLE: Incomplete +TB_GETBUTTONSIZE: Incomplete +TB_SETBUTTONWIDTH: Incomplete +TB_SETMAXTEXTROWS: Incomplete +TB_GETTEXTROWS: Incomplete +TB_GETBUTTONTEXT: Incomplete +TB_SAVERESTORE: Incomplete +TB_ADDSTRING: Incomplete +TB_GETOBJECT: Incomplete +TB_GETHOTITEM: Incomplete +TB_SETHOTITEM: Incomplete +TB_SETANCHORHIGHLIGHT: Incomplete +TB_GETANCHORHIGHLIGHT: Incomplete +TB_MAPACCELERATORA: Incomplete +TBIMHT_AFTER: int +TBIMHT_BACKGROUND: int +TB_GETINSERTMARK: Incomplete +TB_SETINSERTMARK: Incomplete +TB_INSERTMARKHITTEST: Incomplete +TB_MOVEBUTTON: Incomplete +TB_GETMAXSIZE: Incomplete +TB_SETEXTENDEDSTYLE: Incomplete +TB_GETEXTENDEDSTYLE: Incomplete +TB_GETPADDING: Incomplete +TB_SETPADDING: Incomplete +TB_SETINSERTMARKCOLOR: Incomplete +TB_GETINSERTMARKCOLOR: Incomplete +TB_SETCOLORSCHEME: Incomplete +TB_GETCOLORSCHEME: Incomplete +TB_SETUNICODEFORMAT: Incomplete +TB_GETUNICODEFORMAT: Incomplete +TB_MAPACCELERATORW: Incomplete +TB_MAPACCELERATOR: Incomplete +TBBF_LARGE: int +TB_GETBITMAPFLAGS: Incomplete +TBIF_IMAGE: int +TBIF_TEXT: int +TBIF_STATE: int +TBIF_STYLE: int +TBIF_LPARAM: int +TBIF_COMMAND: int +TBIF_SIZE: int +TB_GETBUTTONINFOW: Incomplete +TB_SETBUTTONINFOW: Incomplete +TB_GETBUTTONINFOA: Incomplete +TB_SETBUTTONINFOA: Incomplete +TB_INSERTBUTTONW: Incomplete +TB_ADDBUTTONSW: Incomplete +TB_HITTEST: Incomplete +TB_SETDRAWTEXTFLAGS: Incomplete +TBN_GETBUTTONINFOA: Incomplete +TBN_GETBUTTONINFOW: Incomplete +TBN_BEGINDRAG: Incomplete +TBN_ENDDRAG: Incomplete +TBN_BEGINADJUST: Incomplete +TBN_ENDADJUST: Incomplete +TBN_RESET: Incomplete +TBN_QUERYINSERT: Incomplete +TBN_QUERYDELETE: Incomplete +TBN_TOOLBARCHANGE: Incomplete +TBN_CUSTHELP: Incomplete +TBN_DROPDOWN: Incomplete +TBN_GETOBJECT: Incomplete +HICF_OTHER: int +HICF_MOUSE: int +HICF_ARROWKEYS: int +HICF_ACCELERATOR: int +HICF_DUPACCEL: int +HICF_ENTERING: int +HICF_LEAVING: int +HICF_RESELECT: int +TBN_HOTITEMCHANGE: Incomplete +TBN_DRAGOUT: Incomplete +TBN_DELETINGBUTTON: Incomplete +TBN_GETDISPINFOA: Incomplete +TBN_GETDISPINFOW: Incomplete +TBN_GETINFOTIPA: Incomplete +TBN_GETINFOTIPW: Incomplete +TBN_GETINFOTIP: Incomplete +TBNF_IMAGE: int +TBNF_TEXT: int +TBNF_DI_SETITEM: int +TBN_GETDISPINFO: Incomplete +TBDDRET_DEFAULT: int +TBDDRET_NODEFAULT: int +TBDDRET_TREATPRESSED: int +TBN_GETBUTTONINFO: Incomplete +REBARCLASSNAMEA: str +REBARCLASSNAME: str +RBIM_IMAGELIST: int +RBS_TOOLTIPS: int +RBS_VARHEIGHT: int +RBS_BANDBORDERS: int +RBS_FIXEDORDER: int +RBS_REGISTERDROP: int +RBS_AUTOSIZE: int +RBS_VERTICALGRIPPER: int +RBS_DBLCLKTOGGLE: int +RBBS_BREAK: int +RBBS_FIXEDSIZE: int +RBBS_CHILDEDGE: int +RBBS_HIDDEN: int +RBBS_NOVERT: int +RBBS_FIXEDBMP: int +RBBS_VARIABLEHEIGHT: int +RBBS_GRIPPERALWAYS: int +RBBS_NOGRIPPER: int +RBBIM_STYLE: int +RBBIM_COLORS: int +RBBIM_TEXT: int +RBBIM_IMAGE: int +RBBIM_CHILD: int +RBBIM_CHILDSIZE: int +RBBIM_SIZE: int +RBBIM_BACKGROUND: int +RBBIM_ID: int +RBBIM_IDEALSIZE: int +RBBIM_LPARAM: int +RB_INSERTBANDA: Incomplete +RB_DELETEBAND: Incomplete +RB_GETBARINFO: Incomplete +RB_SETBARINFO: Incomplete +RB_SETBANDINFOA: Incomplete +RB_SETPARENT: Incomplete +RB_HITTEST: Incomplete +RB_GETRECT: Incomplete +RB_INSERTBANDW: Incomplete +RB_SETBANDINFOW: Incomplete +RB_GETBANDCOUNT: Incomplete +RB_GETROWCOUNT: Incomplete +RB_GETROWHEIGHT: Incomplete +RB_IDTOINDEX: Incomplete +RB_GETTOOLTIPS: Incomplete +RB_SETTOOLTIPS: Incomplete +RB_SETBKCOLOR: Incomplete +RB_GETBKCOLOR: Incomplete +RB_SETTEXTCOLOR: Incomplete +RB_GETTEXTCOLOR: Incomplete +RB_SIZETORECT: Incomplete +RB_SETCOLORSCHEME: Incomplete +RB_GETCOLORSCHEME: Incomplete +RB_INSERTBAND: Incomplete +RB_SETBANDINFO: Incomplete +RB_BEGINDRAG: Incomplete +RB_ENDDRAG: Incomplete +RB_DRAGMOVE: Incomplete +RB_GETBARHEIGHT: Incomplete +RB_GETBANDINFOW: Incomplete +RB_GETBANDINFOA: Incomplete +RB_GETBANDINFO: Incomplete +RB_MINIMIZEBAND: Incomplete +RB_MAXIMIZEBAND: Incomplete +RB_GETDROPTARGET: Incomplete +RB_GETBANDBORDERS: Incomplete +RB_SHOWBAND: Incomplete +RB_SETPALETTE: Incomplete +RB_GETPALETTE: Incomplete +RB_MOVEBAND: Incomplete +RB_SETUNICODEFORMAT: Incomplete +RB_GETUNICODEFORMAT: Incomplete +RBN_HEIGHTCHANGE: Incomplete +RBN_GETOBJECT: Incomplete +RBN_LAYOUTCHANGED: Incomplete +RBN_AUTOSIZE: Incomplete +RBN_BEGINDRAG: Incomplete +RBN_ENDDRAG: Incomplete +RBN_DELETINGBAND: Incomplete +RBN_DELETEDBAND: Incomplete +RBN_CHILDSIZE: Incomplete +RBNM_ID: int +RBNM_STYLE: int +RBNM_LPARAM: int +RBHT_NOWHERE: int +RBHT_CAPTION: int +RBHT_CLIENT: int +RBHT_GRABBER: int +TOOLTIPS_CLASSA: str +TOOLTIPS_CLASS: str +TTS_ALWAYSTIP: int +TTS_NOPREFIX: int +TTF_IDISHWND: int +TTF_CENTERTIP: int +TTF_RTLREADING: int +TTF_SUBCLASS: int +TTF_TRACK: int +TTF_ABSOLUTE: int +TTF_TRANSPARENT: int +TTF_DI_SETITEM: int +TTDT_AUTOMATIC: int +TTDT_RESHOW: int +TTDT_AUTOPOP: int +TTDT_INITIAL: int +TTM_ACTIVATE: Incomplete +TTM_SETDELAYTIME: Incomplete +TTM_ADDTOOLA: Incomplete +TTM_ADDTOOLW: Incomplete +TTM_DELTOOLA: Incomplete +TTM_DELTOOLW: Incomplete +TTM_NEWTOOLRECTA: Incomplete +TTM_NEWTOOLRECTW: Incomplete +TTM_RELAYEVENT: Incomplete +TTM_GETTOOLINFOA: Incomplete +TTM_GETTOOLINFOW: Incomplete +TTM_SETTOOLINFOA: Incomplete +TTM_SETTOOLINFOW: Incomplete +TTM_HITTESTA: Incomplete +TTM_HITTESTW: Incomplete +TTM_GETTEXTA: Incomplete +TTM_GETTEXTW: Incomplete +TTM_UPDATETIPTEXTA: Incomplete +TTM_UPDATETIPTEXTW: Incomplete +TTM_GETTOOLCOUNT: Incomplete +TTM_ENUMTOOLSA: Incomplete +TTM_ENUMTOOLSW: Incomplete +TTM_GETCURRENTTOOLA: Incomplete +TTM_GETCURRENTTOOLW: Incomplete +TTM_WINDOWFROMPOINT: Incomplete +TTM_TRACKACTIVATE: Incomplete +TTM_TRACKPOSITION: Incomplete +TTM_SETTIPBKCOLOR: Incomplete +TTM_SETTIPTEXTCOLOR: Incomplete +TTM_GETDELAYTIME: Incomplete +TTM_GETTIPBKCOLOR: Incomplete +TTM_GETTIPTEXTCOLOR: Incomplete +TTM_SETMAXTIPWIDTH: Incomplete +TTM_GETMAXTIPWIDTH: Incomplete +TTM_SETMARGIN: Incomplete +TTM_GETMARGIN: Incomplete +TTM_POP: Incomplete +TTM_UPDATE: Incomplete +TTM_ADDTOOL: Incomplete +TTM_DELTOOL: Incomplete +TTM_NEWTOOLRECT: Incomplete +TTM_GETTOOLINFO: Incomplete +TTM_SETTOOLINFO: Incomplete +TTM_HITTEST: Incomplete +TTM_GETTEXT: Incomplete +TTM_UPDATETIPTEXT: Incomplete +TTM_ENUMTOOLS: Incomplete +TTM_GETCURRENTTOOL: Incomplete +TTN_GETDISPINFOA: Incomplete +TTN_GETDISPINFOW: Incomplete +TTN_SHOW: Incomplete +TTN_POP: Incomplete +TTN_GETDISPINFO: Incomplete +TTN_NEEDTEXT: Incomplete +TTN_NEEDTEXTA: Incomplete +TTN_NEEDTEXTW: Incomplete +SBARS_SIZEGRIP: int +SBARS_TOOLTIPS: int +STATUSCLASSNAMEA: str +STATUSCLASSNAME: str +SB_SETTEXTA: Incomplete +SB_SETTEXTW: Incomplete +SB_GETTEXTA: Incomplete +SB_GETTEXTW: Incomplete +SB_GETTEXTLENGTHA: Incomplete +SB_GETTEXTLENGTHW: Incomplete +SB_GETTEXT: Incomplete +SB_SETTEXT: Incomplete +SB_GETTEXTLENGTH: Incomplete +SB_SETPARTS: Incomplete +SB_GETPARTS: Incomplete +SB_GETBORDERS: Incomplete +SB_SETMINHEIGHT: Incomplete +SB_SIMPLE: Incomplete +SB_GETRECT: Incomplete +SB_ISSIMPLE: Incomplete +SB_SETICON: Incomplete +SB_SETTIPTEXTA: Incomplete +SB_SETTIPTEXTW: Incomplete +SB_GETTIPTEXTA: Incomplete +SB_GETTIPTEXTW: Incomplete +SB_GETICON: Incomplete +SB_SETTIPTEXT: Incomplete +SB_GETTIPTEXT: Incomplete +SB_SETUNICODEFORMAT: Incomplete +SB_GETUNICODEFORMAT: Incomplete +SBT_OWNERDRAW: int +SBT_NOBORDERS: int +SBT_POPOUT: int +SBT_RTLREADING: int +SBT_NOTABPARSING: int +SBT_TOOLTIPS: int +SB_SETBKCOLOR: Incomplete +SBN_SIMPLEMODECHANGE: Incomplete +TRACKBAR_CLASSA: str +TRACKBAR_CLASS: str +TBS_AUTOTICKS: int +TBS_VERT: int +TBS_HORZ: int +TBS_TOP: int +TBS_BOTTOM: int +TBS_LEFT: int +TBS_RIGHT: int +TBS_BOTH: int +TBS_NOTICKS: int +TBS_ENABLESELRANGE: int +TBS_FIXEDLENGTH: int +TBS_NOTHUMB: int +TBS_TOOLTIPS: int +TBM_GETPOS: int +TBM_GETRANGEMIN: Incomplete +TBM_GETRANGEMAX: Incomplete +TBM_GETTIC: Incomplete +TBM_SETTIC: Incomplete +TBM_SETPOS: Incomplete +TBM_SETRANGE: Incomplete +TBM_SETRANGEMIN: Incomplete +TBM_SETRANGEMAX: Incomplete +TBM_CLEARTICS: Incomplete +TBM_SETSEL: Incomplete +TBM_SETSELSTART: Incomplete +TBM_SETSELEND: Incomplete +TBM_GETPTICS: Incomplete +TBM_GETTICPOS: Incomplete +TBM_GETNUMTICS: Incomplete +TBM_GETSELSTART: Incomplete +TBM_GETSELEND: Incomplete +TBM_CLEARSEL: Incomplete +TBM_SETTICFREQ: Incomplete +TBM_SETPAGESIZE: Incomplete +TBM_GETPAGESIZE: Incomplete +TBM_SETLINESIZE: Incomplete +TBM_GETLINESIZE: Incomplete +TBM_GETTHUMBRECT: Incomplete +TBM_GETCHANNELRECT: Incomplete +TBM_SETTHUMBLENGTH: Incomplete +TBM_GETTHUMBLENGTH: Incomplete +TBM_SETTOOLTIPS: Incomplete +TBM_GETTOOLTIPS: Incomplete +TBM_SETTIPSIDE: Incomplete +TBTS_TOP: int +TBTS_LEFT: int +TBTS_BOTTOM: int +TBTS_RIGHT: int +TBM_SETBUDDY: Incomplete +TBM_GETBUDDY: Incomplete +TBM_SETUNICODEFORMAT: Incomplete +TBM_GETUNICODEFORMAT: Incomplete +TB_LINEUP: int +TB_LINEDOWN: int +TB_PAGEUP: int +TB_PAGEDOWN: int +TB_THUMBPOSITION: int +TB_THUMBTRACK: int +TB_TOP: int +TB_BOTTOM: int +TB_ENDTRACK: int +TBCD_TICS: int +TBCD_THUMB: int +TBCD_CHANNEL: int +DL_BEGINDRAG: Incomplete +DL_DRAGGING: Incomplete +DL_DROPPED: Incomplete +DL_CANCELDRAG: Incomplete +DL_CURSORSET: int +DL_STOPCURSOR: int +DL_COPYCURSOR: int +DL_MOVECURSOR: int +DRAGLISTMSGSTRING: str +UPDOWN_CLASSA: str +UPDOWN_CLASS: str +UD_MAXVAL: int +UD_MINVAL: Incomplete +UDS_WRAP: int +UDS_SETBUDDYINT: int +UDS_ALIGNRIGHT: int +UDS_ALIGNLEFT: int +UDS_AUTOBUDDY: int +UDS_ARROWKEYS: int +UDS_HORZ: int +UDS_NOTHOUSANDS: int +UDS_HOTTRACK: int +UDM_SETRANGE: Incomplete +UDM_GETRANGE: Incomplete +UDM_SETPOS: Incomplete +UDM_GETPOS: Incomplete +UDM_SETBUDDY: Incomplete +UDM_GETBUDDY: Incomplete +UDM_SETACCEL: Incomplete +UDM_GETACCEL: Incomplete +UDM_SETBASE: Incomplete +UDM_GETBASE: Incomplete +UDM_SETRANGE32: Incomplete +UDM_GETRANGE32: Incomplete +UDM_SETUNICODEFORMAT: Incomplete +UDM_GETUNICODEFORMAT: Incomplete +UDN_DELTAPOS: Incomplete +PROGRESS_CLASSA: str +PROGRESS_CLASS: str +PBS_SMOOTH: int +PBS_VERTICAL: int +PBM_SETRANGE: Incomplete +PBM_SETPOS: Incomplete +PBM_DELTAPOS: Incomplete +PBM_SETSTEP: Incomplete +PBM_STEPIT: Incomplete +PBM_SETRANGE32: Incomplete +PBM_GETRANGE: Incomplete +PBM_GETPOS: Incomplete +PBM_SETBARCOLOR: Incomplete +PBM_SETBKCOLOR: Incomplete +HOTKEYF_SHIFT: int +HOTKEYF_CONTROL: int +HOTKEYF_ALT: int +HOTKEYF_EXT: int +HKCOMB_NONE: int +HKCOMB_S: int +HKCOMB_C: int +HKCOMB_A: int +HKCOMB_SC: int +HKCOMB_SA: int +HKCOMB_CA: int +HKCOMB_SCA: int +HKM_SETHOTKEY: Incomplete +HKM_GETHOTKEY: Incomplete +HKM_SETRULES: Incomplete +HOTKEY_CLASSA: str +HOTKEY_CLASS: str +CCS_TOP: int +CCS_NOMOVEY: int +CCS_BOTTOM: int +CCS_NORESIZE: int +CCS_NOPARENTALIGN: int +CCS_ADJUSTABLE: int +CCS_NODIVIDER: int +CCS_VERT: int +CCS_LEFT: Incomplete +CCS_RIGHT: Incomplete +CCS_NOMOVEX: Incomplete +WC_LISTVIEWA: str +WC_LISTVIEW: str +LVS_ICON: int +LVS_REPORT: int +LVS_SMALLICON: int +LVS_LIST: int +LVS_TYPEMASK: int +LVS_SINGLESEL: int +LVS_SHOWSELALWAYS: int +LVS_SORTASCENDING: int +LVS_SORTDESCENDING: int +LVS_SHAREIMAGELISTS: int +LVS_NOLABELWRAP: int +LVS_AUTOARRANGE: int +LVS_EDITLABELS: int +LVS_OWNERDATA: int +LVS_NOSCROLL: int +LVS_TYPESTYLEMASK: int +LVS_ALIGNTOP: int +LVS_ALIGNLEFT: int +LVS_ALIGNMASK: int +LVS_OWNERDRAWFIXED: int +LVS_NOCOLUMNHEADER: int +LVS_NOSORTHEADER: int +LVM_SETUNICODEFORMAT: Incomplete +LVM_GETUNICODEFORMAT: Incomplete +LVM_GETBKCOLOR: Incomplete +LVM_SETBKCOLOR: Incomplete +LVM_GETIMAGELIST: Incomplete +LVSIL_NORMAL: int +LVSIL_SMALL: int +LVSIL_STATE: int +LVM_SETIMAGELIST: Incomplete +LVM_GETITEMCOUNT: Incomplete +LVIF_TEXT: int +LVIF_IMAGE: int +LVIF_PARAM: int +LVIF_STATE: int +LVIF_INDENT: int +LVIF_NORECOMPUTE: int +LVIS_FOCUSED: int +LVIS_SELECTED: int +LVIS_CUT: int +LVIS_DROPHILITED: int +LVIS_ACTIVATING: int +LVIS_OVERLAYMASK: int +LVIS_STATEIMAGEMASK: int +I_INDENTCALLBACK: int +LPSTR_TEXTCALLBACKA: int +LPSTR_TEXTCALLBACK: int +I_IMAGECALLBACK: int +LVM_GETITEMA: Incomplete +LVM_GETITEMW: Incomplete +LVM_GETITEM: Incomplete +LVM_SETITEMA: Incomplete +LVM_SETITEMW: Incomplete +LVM_SETITEM: Incomplete +LVM_INSERTITEMA: Incomplete +LVM_INSERTITEMW: Incomplete +LVM_INSERTITEM: Incomplete +LVM_DELETEITEM: Incomplete +LVM_DELETEALLITEMS: Incomplete +LVM_GETCALLBACKMASK: Incomplete +LVM_SETCALLBACKMASK: Incomplete +LVNI_ALL: int +LVNI_FOCUSED: int +LVNI_SELECTED: int +LVNI_CUT: int +LVNI_DROPHILITED: int +LVNI_ABOVE: int +LVNI_BELOW: int +LVNI_TOLEFT: int +LVNI_TORIGHT: int +LVM_GETNEXTITEM: Incomplete +LVFI_PARAM: int +LVFI_STRING: int +LVFI_PARTIAL: int +LVFI_WRAP: int +LVFI_NEARESTXY: int +LVM_FINDITEMA: Incomplete +LVM_FINDITEMW: Incomplete +LVM_FINDITEM: Incomplete +LVIR_BOUNDS: int +LVIR_ICON: int +LVIR_LABEL: int +LVIR_SELECTBOUNDS: int +LVM_GETITEMRECT: Incomplete +LVM_SETITEMPOSITION: Incomplete +LVM_GETITEMPOSITION: Incomplete +LVM_GETSTRINGWIDTHA: Incomplete +LVM_GETSTRINGWIDTHW: Incomplete +LVM_GETSTRINGWIDTH: Incomplete +LVHT_NOWHERE: int +LVHT_ONITEMICON: int +LVHT_ONITEMLABEL: int +LVHT_ONITEMSTATEICON: int +LVHT_ONITEM: Incomplete +LVHT_ABOVE: int +LVHT_BELOW: int +LVHT_TORIGHT: int +LVHT_TOLEFT: int +LVM_HITTEST: Incomplete +LVM_ENSUREVISIBLE: Incomplete +LVM_SCROLL: Incomplete +LVM_REDRAWITEMS: Incomplete +LVA_DEFAULT: int +LVA_ALIGNLEFT: int +LVA_ALIGNTOP: int +LVA_SNAPTOGRID: int +LVM_ARRANGE: Incomplete +LVM_EDITLABELA: Incomplete +LVM_EDITLABELW: Incomplete +LVM_EDITLABEL: Incomplete +LVM_GETEDITCONTROL: Incomplete +LVCF_FMT: int +LVCF_WIDTH: int +LVCF_TEXT: int +LVCF_SUBITEM: int +LVCF_IMAGE: int +LVCF_ORDER: int +LVCFMT_LEFT: int +LVCFMT_RIGHT: int +LVCFMT_CENTER: int +LVCFMT_JUSTIFYMASK: int +LVCFMT_IMAGE: int +LVCFMT_BITMAP_ON_RIGHT: int +LVCFMT_COL_HAS_IMAGES: int +LVM_GETCOLUMNA: Incomplete +LVM_GETCOLUMNW: Incomplete +LVM_GETCOLUMN: Incomplete +LVM_SETCOLUMNA: Incomplete +LVM_SETCOLUMNW: Incomplete +LVM_SETCOLUMN: Incomplete +LVM_INSERTCOLUMNA: Incomplete +LVM_INSERTCOLUMNW: Incomplete +LVM_INSERTCOLUMN: Incomplete +LVM_DELETECOLUMN: Incomplete +LVM_GETCOLUMNWIDTH: Incomplete +LVSCW_AUTOSIZE: int +LVSCW_AUTOSIZE_USEHEADER: int +LVM_SETCOLUMNWIDTH: Incomplete +LVM_GETHEADER: Incomplete +LVM_CREATEDRAGIMAGE: Incomplete +LVM_GETVIEWRECT: Incomplete +LVM_GETTEXTCOLOR: Incomplete +LVM_SETTEXTCOLOR: Incomplete +LVM_GETTEXTBKCOLOR: Incomplete +LVM_SETTEXTBKCOLOR: Incomplete +LVM_GETTOPINDEX: Incomplete +LVM_GETCOUNTPERPAGE: Incomplete +LVM_GETORIGIN: Incomplete +LVM_UPDATE: Incomplete +LVM_SETITEMSTATE: Incomplete +LVM_GETITEMSTATE: Incomplete +LVM_GETITEMTEXTA: Incomplete +LVM_GETITEMTEXTW: Incomplete +LVM_GETITEMTEXT: Incomplete +LVM_SETITEMTEXTA: Incomplete +LVM_SETITEMTEXTW: Incomplete +LVM_SETITEMTEXT: Incomplete +LVSICF_NOINVALIDATEALL: int +LVSICF_NOSCROLL: int +LVM_SETITEMCOUNT: Incomplete +LVM_SORTITEMS: Incomplete +LVM_SETITEMPOSITION32: Incomplete +LVM_GETSELECTEDCOUNT: Incomplete +LVM_GETITEMSPACING: Incomplete +LVM_GETISEARCHSTRINGA: Incomplete +LVM_GETISEARCHSTRINGW: Incomplete +LVM_GETISEARCHSTRING: Incomplete +LVM_SETICONSPACING: Incomplete +LVM_SETEXTENDEDLISTVIEWSTYLE: Incomplete +LVM_GETEXTENDEDLISTVIEWSTYLE: Incomplete +LVS_EX_GRIDLINES: int +LVS_EX_SUBITEMIMAGES: int +LVS_EX_CHECKBOXES: int +LVS_EX_TRACKSELECT: int +LVS_EX_HEADERDRAGDROP: int +LVS_EX_FULLROWSELECT: int +LVS_EX_ONECLICKACTIVATE: int +LVS_EX_TWOCLICKACTIVATE: int +LVS_EX_FLATSB: int +LVS_EX_REGIONAL: int +LVS_EX_INFOTIP: int +LVS_EX_UNDERLINEHOT: int +LVS_EX_UNDERLINECOLD: int +LVS_EX_MULTIWORKAREAS: int +LVM_GETSUBITEMRECT: Incomplete +LVM_SUBITEMHITTEST: Incomplete +LVM_SETCOLUMNORDERARRAY: Incomplete +LVM_GETCOLUMNORDERARRAY: Incomplete +LVM_SETHOTITEM: Incomplete +LVM_GETHOTITEM: Incomplete +LVM_SETHOTCURSOR: Incomplete +LVM_GETHOTCURSOR: Incomplete +LVM_APPROXIMATEVIEWRECT: Incomplete +LV_MAX_WORKAREAS: int +LVM_SETWORKAREAS: Incomplete +LVM_GETWORKAREAS: Incomplete +LVM_GETNUMBEROFWORKAREAS: Incomplete +LVM_GETSELECTIONMARK: Incomplete +LVM_SETSELECTIONMARK: Incomplete +LVM_SETHOVERTIME: Incomplete +LVM_GETHOVERTIME: Incomplete +LVM_SETTOOLTIPS: Incomplete +LVM_GETTOOLTIPS: Incomplete +LVBKIF_SOURCE_NONE: int +LVBKIF_SOURCE_HBITMAP: int +LVBKIF_SOURCE_URL: int +LVBKIF_SOURCE_MASK: int +LVBKIF_STYLE_NORMAL: int +LVBKIF_STYLE_TILE: int +LVBKIF_STYLE_MASK: int +LVM_SETBKIMAGEA: Incomplete +LVM_SETBKIMAGEW: Incomplete +LVM_GETBKIMAGEA: Incomplete +LVM_GETBKIMAGEW: Incomplete +LVKF_ALT: int +LVKF_CONTROL: int +LVKF_SHIFT: int +LVN_ITEMCHANGING: Incomplete +LVN_ITEMCHANGED: Incomplete +LVN_INSERTITEM: Incomplete +LVN_DELETEITEM: Incomplete +LVN_DELETEALLITEMS: Incomplete +LVN_BEGINLABELEDITA: Incomplete +LVN_BEGINLABELEDITW: Incomplete +LVN_ENDLABELEDITA: Incomplete +LVN_ENDLABELEDITW: Incomplete +LVN_COLUMNCLICK: Incomplete +LVN_BEGINDRAG: Incomplete +LVN_BEGINRDRAG: Incomplete +LVN_ODCACHEHINT: Incomplete +LVN_ODFINDITEMA: Incomplete +LVN_ODFINDITEMW: Incomplete +LVN_ITEMACTIVATE: Incomplete +LVN_ODSTATECHANGED: Incomplete +LVN_ODFINDITEM: Incomplete +LVN_HOTTRACK: Incomplete +LVN_GETDISPINFOA: Incomplete +LVN_GETDISPINFOW: Incomplete +LVN_SETDISPINFOA: Incomplete +LVN_SETDISPINFOW: Incomplete +LVN_BEGINLABELEDIT: Incomplete +LVN_ENDLABELEDIT: Incomplete +LVN_GETDISPINFO: Incomplete +LVN_SETDISPINFO: Incomplete +LVIF_DI_SETITEM: int +LVN_KEYDOWN: Incomplete +LVN_MARQUEEBEGIN: Incomplete +LVGIT_UNFOLDED: int +LVN_GETINFOTIPA: Incomplete +LVN_GETINFOTIPW: Incomplete +LVN_GETINFOTIP: Incomplete +WC_TREEVIEWA: str +WC_TREEVIEW: str +TVS_HASBUTTONS: int +TVS_HASLINES: int +TVS_LINESATROOT: int +TVS_EDITLABELS: int +TVS_DISABLEDRAGDROP: int +TVS_SHOWSELALWAYS: int +TVS_RTLREADING: int +TVS_NOTOOLTIPS: int +TVS_CHECKBOXES: int +TVS_TRACKSELECT: int +TVS_SINGLEEXPAND: int +TVS_INFOTIP: int +TVS_FULLROWSELECT: int +TVS_NOSCROLL: int +TVS_NONEVENHEIGHT: int +TVIF_TEXT: int +TVIF_IMAGE: int +TVIF_PARAM: int +TVIF_STATE: int +TVIF_HANDLE: int +TVIF_SELECTEDIMAGE: int +TVIF_CHILDREN: int +TVIF_INTEGRAL: int +TVIS_SELECTED: int +TVIS_CUT: int +TVIS_DROPHILITED: int +TVIS_BOLD: int +TVIS_EXPANDED: int +TVIS_EXPANDEDONCE: int +TVIS_EXPANDPARTIAL: int +TVIS_OVERLAYMASK: int +TVIS_STATEIMAGEMASK: int +TVIS_USERMASK: int +I_CHILDRENCALLBACK: int +TVI_ROOT: int +TVI_FIRST: int +TVI_LAST: int +TVI_SORT: int +TVM_INSERTITEMA: Incomplete +TVM_INSERTITEMW: Incomplete +TVM_INSERTITEM: Incomplete +TVM_DELETEITEM: Incomplete +TVM_EXPAND: Incomplete +TVE_COLLAPSE: int +TVE_EXPAND: int +TVE_TOGGLE: int +TVE_EXPANDPARTIAL: int +TVE_COLLAPSERESET: int +TVM_GETITEMRECT: Incomplete +TVM_GETCOUNT: Incomplete +TVM_GETINDENT: Incomplete +TVM_SETINDENT: Incomplete +TVM_GETIMAGELIST: Incomplete +TVSIL_NORMAL: int +TVSIL_STATE: int +TVM_SETIMAGELIST: Incomplete +TVM_GETNEXTITEM: Incomplete +TVGN_ROOT: int +TVGN_NEXT: int +TVGN_PREVIOUS: int +TVGN_PARENT: int +TVGN_CHILD: int +TVGN_FIRSTVISIBLE: int +TVGN_NEXTVISIBLE: int +TVGN_PREVIOUSVISIBLE: int +TVGN_DROPHILITE: int +TVGN_CARET: int +TVGN_LASTVISIBLE: int +TVM_SELECTITEM: Incomplete +TVM_GETITEMA: Incomplete +TVM_GETITEMW: Incomplete +TVM_GETITEM: Incomplete +TVM_SETITEMA: Incomplete +TVM_SETITEMW: Incomplete +TVM_SETITEM: Incomplete +TVM_EDITLABELA: Incomplete +TVM_EDITLABELW: Incomplete +TVM_EDITLABEL: Incomplete +TVM_GETEDITCONTROL: Incomplete +TVM_GETVISIBLECOUNT: Incomplete +TVM_HITTEST: Incomplete +TVHT_NOWHERE: int +TVHT_ONITEMICON: int +TVHT_ONITEMLABEL: int +TVHT_ONITEMINDENT: int +TVHT_ONITEMBUTTON: int +TVHT_ONITEMRIGHT: int +TVHT_ONITEMSTATEICON: int +TVHT_ABOVE: int +TVHT_BELOW: int +TVHT_TORIGHT: int +TVHT_TOLEFT: int +TVHT_ONITEM: Incomplete +TVM_CREATEDRAGIMAGE: Incomplete +TVM_SORTCHILDREN: Incomplete +TVM_ENSUREVISIBLE: Incomplete +TVM_SORTCHILDRENCB: Incomplete +TVM_ENDEDITLABELNOW: Incomplete +TVM_GETISEARCHSTRINGA: Incomplete +TVM_GETISEARCHSTRINGW: Incomplete +TVM_GETISEARCHSTRING: Incomplete +TVM_SETTOOLTIPS: Incomplete +TVM_GETTOOLTIPS: Incomplete +TVM_SETINSERTMARK: Incomplete +TVM_SETUNICODEFORMAT: Incomplete +TVM_GETUNICODEFORMAT: Incomplete +TVM_SETITEMHEIGHT: Incomplete +TVM_GETITEMHEIGHT: Incomplete +TVM_SETBKCOLOR: Incomplete +TVM_SETTEXTCOLOR: Incomplete +TVM_GETBKCOLOR: Incomplete +TVM_GETTEXTCOLOR: Incomplete +TVM_SETSCROLLTIME: Incomplete +TVM_GETSCROLLTIME: Incomplete +TVM_SETINSERTMARKCOLOR: Incomplete +TVM_GETINSERTMARKCOLOR: Incomplete +TVN_SELCHANGINGA: Incomplete +TVN_SELCHANGINGW: Incomplete +TVN_SELCHANGEDA: Incomplete +TVN_SELCHANGEDW: Incomplete +TVC_UNKNOWN: int +TVC_BYMOUSE: int +TVC_BYKEYBOARD: int +TVN_GETDISPINFOA: Incomplete +TVN_GETDISPINFOW: Incomplete +TVN_SETDISPINFOA: Incomplete +TVN_SETDISPINFOW: Incomplete +TVIF_DI_SETITEM: int +TVN_ITEMEXPANDINGA: Incomplete +TVN_ITEMEXPANDINGW: Incomplete +TVN_ITEMEXPANDEDA: Incomplete +TVN_ITEMEXPANDEDW: Incomplete +TVN_BEGINDRAGA: Incomplete +TVN_BEGINDRAGW: Incomplete +TVN_BEGINRDRAGA: Incomplete +TVN_BEGINRDRAGW: Incomplete +TVN_DELETEITEMA: Incomplete +TVN_DELETEITEMW: Incomplete +TVN_BEGINLABELEDITA: Incomplete +TVN_BEGINLABELEDITW: Incomplete +TVN_ENDLABELEDITA: Incomplete +TVN_ENDLABELEDITW: Incomplete +TVN_KEYDOWN: Incomplete +TVN_GETINFOTIPA: Incomplete +TVN_GETINFOTIPW: Incomplete +TVN_SINGLEEXPAND: Incomplete +TVN_SELCHANGING: Incomplete +TVN_SELCHANGED: Incomplete +TVN_GETDISPINFO: Incomplete +TVN_SETDISPINFO: Incomplete +TVN_ITEMEXPANDING: Incomplete +TVN_ITEMEXPANDED: Incomplete +TVN_BEGINDRAG: Incomplete +TVN_BEGINRDRAG: Incomplete +TVN_DELETEITEM: Incomplete +TVN_BEGINLABELEDIT: Incomplete +TVN_ENDLABELEDIT: Incomplete +TVN_GETINFOTIP: Incomplete +TVCDRF_NOIMAGES: int +WC_COMBOBOXEXA: str +WC_COMBOBOXEX: str +CBEIF_TEXT: int +CBEIF_IMAGE: int +CBEIF_SELECTEDIMAGE: int +CBEIF_OVERLAY: int +CBEIF_INDENT: int +CBEIF_LPARAM: int +CBEIF_DI_SETITEM: int +CBEM_INSERTITEMA: Incomplete +CBEM_SETIMAGELIST: Incomplete +CBEM_GETIMAGELIST: Incomplete +CBEM_GETITEMA: Incomplete +CBEM_SETITEMA: Incomplete +CBEM_GETCOMBOCONTROL: Incomplete +CBEM_GETEDITCONTROL: Incomplete +CBEM_SETEXSTYLE: Incomplete +CBEM_SETEXTENDEDSTYLE: Incomplete +CBEM_GETEXSTYLE: Incomplete +CBEM_GETEXTENDEDSTYLE: Incomplete +CBEM_SETUNICODEFORMAT: Incomplete +CBEM_GETUNICODEFORMAT: Incomplete +CBEM_HASEDITCHANGED: Incomplete +CBEM_INSERTITEMW: Incomplete +CBEM_SETITEMW: Incomplete +CBEM_GETITEMW: Incomplete +CBEM_INSERTITEM: Incomplete +CBEM_SETITEM: Incomplete +CBEM_GETITEM: Incomplete +CBES_EX_NOEDITIMAGE: int +CBES_EX_NOEDITIMAGEINDENT: int +CBES_EX_PATHWORDBREAKPROC: int +CBES_EX_NOSIZELIMIT: int +CBES_EX_CASESENSITIVE: int +CBEN_GETDISPINFO: Incomplete +CBEN_GETDISPINFOA: Incomplete +CBEN_INSERTITEM: Incomplete +CBEN_DELETEITEM: Incomplete +CBEN_BEGINEDIT: Incomplete +CBEN_ENDEDITA: Incomplete +CBEN_ENDEDITW: Incomplete +CBEN_GETDISPINFOW: Incomplete +CBEN_DRAGBEGINA: Incomplete +CBEN_DRAGBEGINW: Incomplete +CBEN_DRAGBEGIN: Incomplete +CBEN_ENDEDIT: Incomplete +CBENF_KILLFOCUS: int +CBENF_RETURN: int +CBENF_ESCAPE: int +CBENF_DROPDOWN: int +CBEMAXSTRLEN: int +WC_TABCONTROLA: str +WC_TABCONTROL: str +TCS_SCROLLOPPOSITE: int +TCS_BOTTOM: int +TCS_RIGHT: int +TCS_MULTISELECT: int +TCS_FLATBUTTONS: int +TCS_FORCEICONLEFT: int +TCS_FORCELABELLEFT: int +TCS_HOTTRACK: int +TCS_VERTICAL: int +TCS_TABS: int +TCS_BUTTONS: int +TCS_SINGLELINE: int +TCS_MULTILINE: int +TCS_RIGHTJUSTIFY: int +TCS_FIXEDWIDTH: int +TCS_RAGGEDRIGHT: int +TCS_FOCUSONBUTTONDOWN: int +TCS_OWNERDRAWFIXED: int +TCS_TOOLTIPS: int +TCS_FOCUSNEVER: int +TCS_EX_FLATSEPARATORS: int +TCS_EX_REGISTERDROP: int +TCM_GETIMAGELIST: Incomplete +TCM_SETIMAGELIST: Incomplete +TCM_GETITEMCOUNT: Incomplete +TCIF_TEXT: int +TCIF_IMAGE: int +TCIF_RTLREADING: int +TCIF_PARAM: int +TCIF_STATE: int +TCIS_BUTTONPRESSED: int +TCIS_HIGHLIGHTED: int +TCM_GETITEMA: Incomplete +TCM_GETITEMW: Incomplete +TCM_GETITEM: Incomplete +TCM_SETITEMA: Incomplete +TCM_SETITEMW: Incomplete +TCM_SETITEM: Incomplete +TCM_INSERTITEMA: Incomplete +TCM_INSERTITEMW: Incomplete +TCM_INSERTITEM: Incomplete +TCM_DELETEITEM: Incomplete +TCM_DELETEALLITEMS: Incomplete +TCM_GETITEMRECT: Incomplete +TCM_GETCURSEL: Incomplete +TCM_SETCURSEL: Incomplete +TCHT_NOWHERE: int +TCHT_ONITEMICON: int +TCHT_ONITEMLABEL: int +TCHT_ONITEM: Incomplete +TCM_HITTEST: Incomplete +TCM_SETITEMEXTRA: Incomplete +TCM_ADJUSTRECT: Incomplete +TCM_SETITEMSIZE: Incomplete +TCM_REMOVEIMAGE: Incomplete +TCM_SETPADDING: Incomplete +TCM_GETROWCOUNT: Incomplete +TCM_GETTOOLTIPS: Incomplete +TCM_SETTOOLTIPS: Incomplete +TCM_GETCURFOCUS: Incomplete +TCM_SETCURFOCUS: Incomplete +TCM_SETMINTABWIDTH: Incomplete +TCM_DESELECTALL: Incomplete +TCM_HIGHLIGHTITEM: Incomplete +TCM_SETEXTENDEDSTYLE: Incomplete +TCM_GETEXTENDEDSTYLE: Incomplete +TCM_SETUNICODEFORMAT: Incomplete +TCM_GETUNICODEFORMAT: Incomplete +TCN_KEYDOWN: Incomplete +ANIMATE_CLASSA: str +ANIMATE_CLASS: str +ACS_CENTER: int +ACS_TRANSPARENT: int +ACS_AUTOPLAY: int +ACS_TIMER: int +ACM_OPENA: Incomplete +ACM_OPENW: Incomplete +ACM_OPEN: Incomplete +ACM_PLAY: Incomplete +ACM_STOP: Incomplete +ACN_START: int +ACN_STOP: int +MONTHCAL_CLASSA: str +MONTHCAL_CLASS: str +MCM_FIRST: int +MCM_GETCURSEL: Incomplete +MCM_SETCURSEL: Incomplete +MCM_GETMAXSELCOUNT: Incomplete +MCM_SETMAXSELCOUNT: Incomplete +MCM_GETSELRANGE: Incomplete +MCM_SETSELRANGE: Incomplete +MCM_GETMONTHRANGE: Incomplete +MCM_SETDAYSTATE: Incomplete +MCM_GETMINREQRECT: Incomplete +MCM_SETCOLOR: Incomplete +MCM_GETCOLOR: Incomplete +MCSC_BACKGROUND: int +MCSC_TEXT: int +MCSC_TITLEBK: int +MCSC_TITLETEXT: int +MCSC_MONTHBK: int +MCSC_TRAILINGTEXT: int +MCM_SETTODAY: Incomplete +MCM_GETTODAY: Incomplete +MCM_HITTEST: Incomplete +MCHT_TITLE: int +MCHT_CALENDAR: int +MCHT_TODAYLINK: int +MCHT_NEXT: int +MCHT_PREV: int +MCHT_NOWHERE: int +MCHT_TITLEBK: int +MCHT_TITLEMONTH: Incomplete +MCHT_TITLEYEAR: Incomplete +MCHT_TITLEBTNNEXT: Incomplete +MCHT_TITLEBTNPREV: Incomplete +MCHT_CALENDARBK: int +MCHT_CALENDARDATE: Incomplete +MCHT_CALENDARDATENEXT: Incomplete +MCHT_CALENDARDATEPREV: Incomplete +MCHT_CALENDARDAY: Incomplete +MCHT_CALENDARWEEKNUM: Incomplete +MCM_SETFIRSTDAYOFWEEK: Incomplete +MCM_GETFIRSTDAYOFWEEK: Incomplete +MCM_GETRANGE: Incomplete +MCM_SETRANGE: Incomplete +MCM_GETMONTHDELTA: Incomplete +MCM_SETMONTHDELTA: Incomplete +MCM_GETMAXTODAYWIDTH: Incomplete +MCM_SETUNICODEFORMAT: Incomplete +MCM_GETUNICODEFORMAT: Incomplete +MCN_SELCHANGE: Incomplete +MCN_GETDAYSTATE: Incomplete +MCN_SELECT: Incomplete +MCS_DAYSTATE: int +MCS_MULTISELECT: int +MCS_WEEKNUMBERS: int +MCS_NOTODAYCIRCLE: int +MCS_NOTODAY: int +GMR_VISIBLE: int +GMR_DAYSTATE: int +DATETIMEPICK_CLASSA: str +DATETIMEPICK_CLASS: str +DTM_FIRST: int +DTM_GETSYSTEMTIME: Incomplete +DTM_SETSYSTEMTIME: Incomplete +DTM_GETRANGE: Incomplete +DTM_SETRANGE: Incomplete +DTM_SETFORMATA: Incomplete +DTM_SETFORMATW: Incomplete +DTM_SETFORMAT: Incomplete +DTM_SETMCCOLOR: Incomplete +DTM_GETMCCOLOR: Incomplete +DTM_GETMONTHCAL: Incomplete +DTM_SETMCFONT: Incomplete +DTM_GETMCFONT: Incomplete +DTS_UPDOWN: int +DTS_SHOWNONE: int +DTS_SHORTDATEFORMAT: int +DTS_LONGDATEFORMAT: int +DTS_TIMEFORMAT: int +DTS_APPCANPARSE: int +DTS_RIGHTALIGN: int +DTN_DATETIMECHANGE: Incomplete +DTN_USERSTRINGA: Incomplete +DTN_USERSTRINGW: Incomplete +DTN_USERSTRING: Incomplete +DTN_WMKEYDOWNA: Incomplete +DTN_WMKEYDOWNW: Incomplete +DTN_WMKEYDOWN: Incomplete +DTN_FORMATA: Incomplete +DTN_FORMATW: Incomplete +DTN_FORMAT: Incomplete +DTN_FORMATQUERYA: Incomplete +DTN_FORMATQUERYW: Incomplete +DTN_FORMATQUERY: Incomplete +DTN_DROPDOWN: Incomplete +DTN_CLOSEUP: Incomplete +GDTR_MIN: int +GDTR_MAX: int +GDT_ERROR: int +GDT_VALID: int +GDT_NONE: int +IPM_CLEARADDRESS: Incomplete +IPM_SETADDRESS: Incomplete +IPM_GETADDRESS: Incomplete +IPM_SETRANGE: Incomplete +IPM_SETFOCUS: Incomplete +IPM_ISBLANK: Incomplete +WC_IPADDRESSA: str +WC_IPADDRESS: str +IPN_FIELDCHANGED: Incomplete +WC_PAGESCROLLERA: str +WC_PAGESCROLLER: str +PGS_VERT: int +PGS_HORZ: int +PGS_AUTOSCROLL: int +PGS_DRAGNDROP: int +PGF_INVISIBLE: int +PGF_NORMAL: int +PGF_GRAYED: int +PGF_DEPRESSED: int +PGF_HOT: int +PGB_TOPORLEFT: int +PGB_BOTTOMORRIGHT: int +PGM_SETCHILD: Incomplete +PGM_RECALCSIZE: Incomplete +PGM_FORWARDMOUSE: Incomplete +PGM_SETBKCOLOR: Incomplete +PGM_GETBKCOLOR: Incomplete +PGM_SETBORDER: Incomplete +PGM_GETBORDER: Incomplete +PGM_SETPOS: Incomplete +PGM_GETPOS: Incomplete +PGM_SETBUTTONSIZE: Incomplete +PGM_GETBUTTONSIZE: Incomplete +PGM_GETBUTTONSTATE: Incomplete +PGM_GETDROPTARGET: Incomplete +PGN_SCROLL: Incomplete +PGF_SCROLLUP: int +PGF_SCROLLDOWN: int +PGF_SCROLLLEFT: int +PGF_SCROLLRIGHT: int +PGK_SHIFT: int +PGK_CONTROL: int +PGK_MENU: int +PGN_CALCSIZE: Incomplete +PGF_CALCWIDTH: int +PGF_CALCHEIGHT: int +WC_NATIVEFONTCTLA: str +WC_NATIVEFONTCTL: str +NFS_EDIT: int +NFS_STATIC: int +NFS_LISTCOMBO: int +NFS_BUTTON: int +NFS_ALL: int +WM_MOUSEHOVER: int +WM_MOUSELEAVE: int +TME_HOVER: int +TME_LEAVE: int +TME_QUERY: int +TME_CANCEL: int +HOVER_DEFAULT: int +WSB_PROP_CYVSCROLL: int +WSB_PROP_CXHSCROLL: int +WSB_PROP_CYHSCROLL: int +WSB_PROP_CXVSCROLL: int +WSB_PROP_CXHTHUMB: int +WSB_PROP_CYVTHUMB: int +WSB_PROP_VBKGCOLOR: int +WSB_PROP_HBKGCOLOR: int +WSB_PROP_VSTYLE: int +WSB_PROP_HSTYLE: int +WSB_PROP_WINSTYLE: int +WSB_PROP_PALETTE: int +WSB_PROP_MASK: int +FSB_FLAT_MODE: int +FSB_ENCARTA_MODE: int +FSB_REGULAR_MODE: int + +def INDEXTOOVERLAYMASK(i): ... +def INDEXTOSTATEIMAGEMASK(i): ... diff --git a/stubs/pywin32/win32/lib/mmsystem.pyi b/stubs/pywin32/win32/lib/mmsystem.pyi new file mode 100644 index 0000000..6670475 --- /dev/null +++ b/stubs/pywin32/win32/lib/mmsystem.pyi @@ -0,0 +1,858 @@ +from _typeshed import Incomplete + +MAXPNAMELEN: int +MAXERRORLENGTH: int +MAX_JOYSTICKOEMVXDNAME: int +MM_MICROSOFT: int +MM_MIDI_MAPPER: int +MM_WAVE_MAPPER: int +MM_SNDBLST_MIDIOUT: int +MM_SNDBLST_MIDIIN: int +MM_SNDBLST_SYNTH: int +MM_SNDBLST_WAVEOUT: int +MM_SNDBLST_WAVEIN: int +MM_ADLIB: int +MM_MPU401_MIDIOUT: int +MM_MPU401_MIDIIN: int +MM_PC_JOYSTICK: int +TIME_MS: int +TIME_SAMPLES: int +TIME_BYTES: int +TIME_SMPTE: int +TIME_MIDI: int +TIME_TICKS: int +MM_JOY1MOVE: int +MM_JOY2MOVE: int +MM_JOY1ZMOVE: int +MM_JOY2ZMOVE: int +MM_JOY1BUTTONDOWN: int +MM_JOY2BUTTONDOWN: int +MM_JOY1BUTTONUP: int +MM_JOY2BUTTONUP: int +MM_MCINOTIFY: int +MM_WOM_OPEN: int +MM_WOM_CLOSE: int +MM_WOM_DONE: int +MM_WIM_OPEN: int +MM_WIM_CLOSE: int +MM_WIM_DATA: int +MM_MIM_OPEN: int +MM_MIM_CLOSE: int +MM_MIM_DATA: int +MM_MIM_LONGDATA: int +MM_MIM_ERROR: int +MM_MIM_LONGERROR: int +MM_MOM_OPEN: int +MM_MOM_CLOSE: int +MM_MOM_DONE: int +MM_STREAM_OPEN: int +MM_STREAM_CLOSE: int +MM_STREAM_DONE: int +MM_STREAM_ERROR: int +MM_MOM_POSITIONCB: int +MM_MIM_MOREDATA: int +MM_MIXM_LINE_CHANGE: int +MM_MIXM_CONTROL_CHANGE: int +MMSYSERR_BASE: int +WAVERR_BASE: int +MIDIERR_BASE: int +TIMERR_BASE: int +JOYERR_BASE: int +MCIERR_BASE: int +MIXERR_BASE: int +MCI_STRING_OFFSET: int +MCI_VD_OFFSET: int +MCI_CD_OFFSET: int +MCI_WAVE_OFFSET: int +MCI_SEQ_OFFSET: int +MMSYSERR_NOERROR: int +MMSYSERR_ERROR: Incomplete +MMSYSERR_BADDEVICEID: Incomplete +MMSYSERR_NOTENABLED: Incomplete +MMSYSERR_ALLOCATED: Incomplete +MMSYSERR_INVALHANDLE: Incomplete +MMSYSERR_NODRIVER: Incomplete +MMSYSERR_NOMEM: Incomplete +MMSYSERR_NOTSUPPORTED: Incomplete +MMSYSERR_BADERRNUM: Incomplete +MMSYSERR_INVALFLAG: Incomplete +MMSYSERR_INVALPARAM: Incomplete +MMSYSERR_HANDLEBUSY: Incomplete +MMSYSERR_INVALIDALIAS: Incomplete +MMSYSERR_BADDB: Incomplete +MMSYSERR_KEYNOTFOUND: Incomplete +MMSYSERR_READERROR: Incomplete +MMSYSERR_WRITEERROR: Incomplete +MMSYSERR_DELETEERROR: Incomplete +MMSYSERR_VALNOTFOUND: Incomplete +MMSYSERR_NODRIVERCB: Incomplete +MMSYSERR_LASTERROR: Incomplete +DRV_LOAD: int +DRV_ENABLE: int +DRV_OPEN: int +DRV_CLOSE: int +DRV_DISABLE: int +DRV_FREE: int +DRV_CONFIGURE: int +DRV_QUERYCONFIGURE: int +DRV_INSTALL: int +DRV_REMOVE: int +DRV_EXITSESSION: int +DRV_POWER: int +DRV_RESERVED: int +DRV_USER: int +DRVCNF_CANCEL: int +DRVCNF_OK: int +DRVCNF_RESTART: int +DRV_CANCEL: int +DRV_OK: int +DRV_RESTART: int +DRV_MCI_FIRST: int +DRV_MCI_LAST: Incomplete +CALLBACK_TYPEMASK: int +CALLBACK_NULL: int +CALLBACK_WINDOW: int +CALLBACK_TASK: int +CALLBACK_FUNCTION: int +CALLBACK_THREAD: int +CALLBACK_EVENT: int +SND_SYNC: int +SND_ASYNC: int +SND_NODEFAULT: int +SND_MEMORY: int +SND_LOOP: int +SND_NOSTOP: int +SND_NOWAIT: int +SND_ALIAS: int +SND_ALIAS_ID: int +SND_FILENAME: int +SND_RESOURCE: int +SND_PURGE: int +SND_APPLICATION: int +SND_ALIAS_START: int +WAVERR_BADFORMAT: Incomplete +WAVERR_STILLPLAYING: Incomplete +WAVERR_UNPREPARED: Incomplete +WAVERR_SYNC: Incomplete +WAVERR_LASTERROR: Incomplete +WOM_OPEN: int +WOM_CLOSE: int +WOM_DONE: int +WIM_OPEN: int +WIM_CLOSE: int +WIM_DATA: int +WAVE_MAPPER: int +WAVE_FORMAT_QUERY: int +WAVE_ALLOWSYNC: int +WAVE_MAPPED: int +WAVE_FORMAT_DIRECT: int +WAVE_FORMAT_DIRECT_QUERY: Incomplete +WHDR_DONE: int +WHDR_PREPARED: int +WHDR_BEGINLOOP: int +WHDR_ENDLOOP: int +WHDR_INQUEUE: int +WAVECAPS_PITCH: int +WAVECAPS_PLAYBACKRATE: int +WAVECAPS_VOLUME: int +WAVECAPS_LRVOLUME: int +WAVECAPS_SYNC: int +WAVECAPS_SAMPLEACCURATE: int +WAVECAPS_DIRECTSOUND: int +WAVE_INVALIDFORMAT: int +WAVE_FORMAT_1M08: int +WAVE_FORMAT_1S08: int +WAVE_FORMAT_1M16: int +WAVE_FORMAT_1S16: int +WAVE_FORMAT_2M08: int +WAVE_FORMAT_2S08: int +WAVE_FORMAT_2M16: int +WAVE_FORMAT_2S16: int +WAVE_FORMAT_4M08: int +WAVE_FORMAT_4S08: int +WAVE_FORMAT_4M16: int +WAVE_FORMAT_4S16: int +WAVE_FORMAT_PCM: int +WAVE_FORMAT_IEEE_FLOAT: int +MIDIERR_UNPREPARED: Incomplete +MIDIERR_STILLPLAYING: Incomplete +MIDIERR_NOMAP: Incomplete +MIDIERR_NOTREADY: Incomplete +MIDIERR_NODEVICE: Incomplete +MIDIERR_INVALIDSETUP: Incomplete +MIDIERR_BADOPENMODE: Incomplete +MIDIERR_DONT_CONTINUE: Incomplete +MIDIERR_LASTERROR: Incomplete +MIDIPATCHSIZE: int +MIM_OPEN: int +MIM_CLOSE: int +MIM_DATA: int +MIM_LONGDATA: int +MIM_ERROR: int +MIM_LONGERROR: int +MOM_OPEN: int +MOM_CLOSE: int +MOM_DONE: int +MIM_MOREDATA: int +MOM_POSITIONCB: int +MIDI_IO_STATUS: int +MIDI_CACHE_ALL: int +MIDI_CACHE_BESTFIT: int +MIDI_CACHE_QUERY: int +MIDI_UNCACHE: int +MOD_MIDIPORT: int +MOD_SYNTH: int +MOD_SQSYNTH: int +MOD_FMSYNTH: int +MOD_MAPPER: int +MIDICAPS_VOLUME: int +MIDICAPS_LRVOLUME: int +MIDICAPS_CACHE: int +MIDICAPS_STREAM: int +MHDR_DONE: int +MHDR_PREPARED: int +MHDR_INQUEUE: int +MHDR_ISSTRM: int +MEVT_F_SHORT: int +MEVT_F_LONG: int +MEVT_F_CALLBACK: int + +def MEVT_EVENTTYPE(x): ... +def MEVT_EVENTPARM(x): ... + +MIDISTRM_ERROR: int +MIDIPROP_SET: int +MIDIPROP_GET: int +MIDIPROP_TIMEDIV: int +MIDIPROP_TEMPO: int +AUXCAPS_CDAUDIO: int +AUXCAPS_AUXIN: int +AUXCAPS_VOLUME: int +AUXCAPS_LRVOLUME: int +MIXER_SHORT_NAME_CHARS: int +MIXER_LONG_NAME_CHARS: int +MIXERR_INVALLINE: Incomplete +MIXERR_INVALCONTROL: Incomplete +MIXERR_INVALVALUE: Incomplete +MIXERR_LASTERROR: Incomplete +MIXER_OBJECTF_HANDLE: int +MIXER_OBJECTF_MIXER: int +MIXER_OBJECTF_HMIXER: Incomplete +MIXER_OBJECTF_WAVEOUT: int +MIXER_OBJECTF_HWAVEOUT: Incomplete +MIXER_OBJECTF_WAVEIN: int +MIXER_OBJECTF_HWAVEIN: Incomplete +MIXER_OBJECTF_MIDIOUT: int +MIXER_OBJECTF_HMIDIOUT: Incomplete +MIXER_OBJECTF_MIDIIN: int +MIXER_OBJECTF_HMIDIIN: Incomplete +MIXER_OBJECTF_AUX: int +MIXERLINE_LINEF_ACTIVE: int +MIXERLINE_LINEF_DISCONNECTED: int +MIXERLINE_LINEF_SOURCE: int +MIXERLINE_COMPONENTTYPE_DST_FIRST: int +MIXERLINE_COMPONENTTYPE_DST_UNDEFINED: Incomplete +MIXERLINE_COMPONENTTYPE_DST_DIGITAL: Incomplete +MIXERLINE_COMPONENTTYPE_DST_LINE: Incomplete +MIXERLINE_COMPONENTTYPE_DST_MONITOR: Incomplete +MIXERLINE_COMPONENTTYPE_DST_SPEAKERS: Incomplete +MIXERLINE_COMPONENTTYPE_DST_HEADPHONES: Incomplete +MIXERLINE_COMPONENTTYPE_DST_TELEPHONE: Incomplete +MIXERLINE_COMPONENTTYPE_DST_WAVEIN: Incomplete +MIXERLINE_COMPONENTTYPE_DST_VOICEIN: Incomplete +MIXERLINE_COMPONENTTYPE_DST_LAST: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_FIRST: int +MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_DIGITAL: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_LINE: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_ANALOG: Incomplete +MIXERLINE_COMPONENTTYPE_SRC_LAST: Incomplete +MIXERLINE_TARGETTYPE_UNDEFINED: int +MIXERLINE_TARGETTYPE_WAVEOUT: int +MIXERLINE_TARGETTYPE_WAVEIN: int +MIXERLINE_TARGETTYPE_MIDIOUT: int +MIXERLINE_TARGETTYPE_MIDIIN: int +MIXERLINE_TARGETTYPE_AUX: int +MIXER_GETLINEINFOF_DESTINATION: int +MIXER_GETLINEINFOF_SOURCE: int +MIXER_GETLINEINFOF_LINEID: int +MIXER_GETLINEINFOF_COMPONENTTYPE: int +MIXER_GETLINEINFOF_TARGETTYPE: int +MIXER_GETLINEINFOF_QUERYMASK: int +MIXERCONTROL_CONTROLF_UNIFORM: int +MIXERCONTROL_CONTROLF_MULTIPLE: int +MIXERCONTROL_CONTROLF_DISABLED: int +MIXERCONTROL_CT_CLASS_MASK: int +MIXERCONTROL_CT_CLASS_CUSTOM: int +MIXERCONTROL_CT_CLASS_METER: int +MIXERCONTROL_CT_CLASS_SWITCH: int +MIXERCONTROL_CT_CLASS_NUMBER: int +MIXERCONTROL_CT_CLASS_SLIDER: int +MIXERCONTROL_CT_CLASS_FADER: int +MIXERCONTROL_CT_CLASS_TIME: int +MIXERCONTROL_CT_CLASS_LIST: int +MIXERCONTROL_CT_SUBCLASS_MASK: int +MIXERCONTROL_CT_SC_SWITCH_BOOLEAN: int +MIXERCONTROL_CT_SC_SWITCH_BUTTON: int +MIXERCONTROL_CT_SC_METER_POLLED: int +MIXERCONTROL_CT_SC_TIME_MICROSECS: int +MIXERCONTROL_CT_SC_TIME_MILLISECS: int +MIXERCONTROL_CT_SC_LIST_SINGLE: int +MIXERCONTROL_CT_SC_LIST_MULTIPLE: int +MIXERCONTROL_CT_UNITS_MASK: int +MIXERCONTROL_CT_UNITS_CUSTOM: int +MIXERCONTROL_CT_UNITS_BOOLEAN: int +MIXERCONTROL_CT_UNITS_SIGNED: int +MIXERCONTROL_CT_UNITS_UNSIGNED: int +MIXERCONTROL_CT_UNITS_DECIBELS: int +MIXERCONTROL_CT_UNITS_PERCENT: int +MIXERCONTROL_CONTROLTYPE_CUSTOM: Incomplete +MIXERCONTROL_CONTROLTYPE_BOOLEANMETER: Incomplete +MIXERCONTROL_CONTROLTYPE_SIGNEDMETER: Incomplete +MIXERCONTROL_CONTROLTYPE_PEAKMETER: Incomplete +MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER: Incomplete +MIXERCONTROL_CONTROLTYPE_BOOLEAN: Incomplete +MIXERCONTROL_CONTROLTYPE_ONOFF: Incomplete +MIXERCONTROL_CONTROLTYPE_MUTE: Incomplete +MIXERCONTROL_CONTROLTYPE_MONO: Incomplete +MIXERCONTROL_CONTROLTYPE_LOUDNESS: Incomplete +MIXERCONTROL_CONTROLTYPE_STEREOENH: Incomplete +MIXERCONTROL_CONTROLTYPE_BUTTON: Incomplete +MIXERCONTROL_CONTROLTYPE_DECIBELS: Incomplete +MIXERCONTROL_CONTROLTYPE_SIGNED: Incomplete +MIXERCONTROL_CONTROLTYPE_UNSIGNED: Incomplete +MIXERCONTROL_CONTROLTYPE_PERCENT: Incomplete +MIXERCONTROL_CONTROLTYPE_SLIDER: Incomplete +MIXERCONTROL_CONTROLTYPE_PAN: Incomplete +MIXERCONTROL_CONTROLTYPE_QSOUNDPAN: Incomplete +MIXERCONTROL_CONTROLTYPE_FADER: Incomplete +MIXERCONTROL_CONTROLTYPE_VOLUME: Incomplete +MIXERCONTROL_CONTROLTYPE_BASS: Incomplete +MIXERCONTROL_CONTROLTYPE_TREBLE: Incomplete +MIXERCONTROL_CONTROLTYPE_EQUALIZER: Incomplete +MIXERCONTROL_CONTROLTYPE_SINGLESELECT: Incomplete +MIXERCONTROL_CONTROLTYPE_MUX: Incomplete +MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT: Incomplete +MIXERCONTROL_CONTROLTYPE_MIXER: Incomplete +MIXERCONTROL_CONTROLTYPE_MICROTIME: Incomplete +MIXERCONTROL_CONTROLTYPE_MILLITIME: Incomplete +MIXER_GETLINECONTROLSF_ALL: int +MIXER_GETLINECONTROLSF_ONEBYID: int +MIXER_GETLINECONTROLSF_ONEBYTYPE: int +MIXER_GETLINECONTROLSF_QUERYMASK: int +MIXER_GETCONTROLDETAILSF_VALUE: int +MIXER_GETCONTROLDETAILSF_LISTTEXT: int +MIXER_GETCONTROLDETAILSF_QUERYMASK: int +MIXER_SETCONTROLDETAILSF_VALUE: int +MIXER_SETCONTROLDETAILSF_CUSTOM: int +MIXER_SETCONTROLDETAILSF_QUERYMASK: int +TIMERR_NOERROR: int +TIMERR_NOCANDO: Incomplete +TIMERR_STRUCT: Incomplete +TIME_ONESHOT: int +TIME_PERIODIC: int +TIME_CALLBACK_FUNCTION: int +TIME_CALLBACK_EVENT_SET: int +TIME_CALLBACK_EVENT_PULSE: int +JOYERR_NOERROR: int +JOYERR_PARMS: Incomplete +JOYERR_NOCANDO: Incomplete +JOYERR_UNPLUGGED: Incomplete +JOY_BUTTON1: int +JOY_BUTTON2: int +JOY_BUTTON3: int +JOY_BUTTON4: int +JOY_BUTTON1CHG: int +JOY_BUTTON2CHG: int +JOY_BUTTON3CHG: int +JOY_BUTTON4CHG: int +JOY_BUTTON5: int +JOY_BUTTON6: int +JOY_BUTTON7: int +JOY_BUTTON8: int +JOY_BUTTON9: int +JOY_BUTTON10: int +JOY_BUTTON11: int +JOY_BUTTON12: int +JOY_BUTTON13: int +JOY_BUTTON14: int +JOY_BUTTON15: int +JOY_BUTTON16: int +JOY_BUTTON17: int +JOY_BUTTON18: int +JOY_BUTTON19: int +JOY_BUTTON20: int +JOY_BUTTON21: int +JOY_BUTTON22: int +JOY_BUTTON23: int +JOY_BUTTON24: int +JOY_BUTTON25: int +JOY_BUTTON26: int +JOY_BUTTON27: int +JOY_BUTTON28: int +JOY_BUTTON29: int +JOY_BUTTON30: int +JOY_BUTTON31: int +JOY_BUTTON32: int +JOY_POVFORWARD: int +JOY_POVRIGHT: int +JOY_POVBACKWARD: int +JOY_POVLEFT: int +JOY_RETURNX: int +JOY_RETURNY: int +JOY_RETURNZ: int +JOY_RETURNR: int +JOY_RETURNU: int +JOY_RETURNV: int +JOY_RETURNPOV: int +JOY_RETURNBUTTONS: int +JOY_RETURNRAWDATA: int +JOY_RETURNPOVCTS: int +JOY_RETURNCENTERED: int +JOY_USEDEADZONE: int +JOY_RETURNALL: Incomplete +JOY_CAL_READALWAYS: int +JOY_CAL_READXYONLY: int +JOY_CAL_READ3: int +JOY_CAL_READ4: int +JOY_CAL_READXONLY: int +JOY_CAL_READYONLY: int +JOY_CAL_READ5: int +JOY_CAL_READ6: int +JOY_CAL_READZONLY: int +JOY_CAL_READRONLY: int +JOY_CAL_READUONLY: int +JOY_CAL_READVONLY: int +JOYSTICKID1: int +JOYSTICKID2: int +JOYCAPS_HASZ: int +JOYCAPS_HASR: int +JOYCAPS_HASU: int +JOYCAPS_HASV: int +JOYCAPS_HASPOV: int +JOYCAPS_POV4DIR: int +JOYCAPS_POVCTS: int +MMIOERR_BASE: int +MMIOERR_FILENOTFOUND: Incomplete +MMIOERR_OUTOFMEMORY: Incomplete +MMIOERR_CANNOTOPEN: Incomplete +MMIOERR_CANNOTCLOSE: Incomplete +MMIOERR_CANNOTREAD: Incomplete +MMIOERR_CANNOTWRITE: Incomplete +MMIOERR_CANNOTSEEK: Incomplete +MMIOERR_CANNOTEXPAND: Incomplete +MMIOERR_CHUNKNOTFOUND: Incomplete +MMIOERR_UNBUFFERED: Incomplete +MMIOERR_PATHNOTFOUND: Incomplete +MMIOERR_ACCESSDENIED: Incomplete +MMIOERR_SHARINGVIOLATION: Incomplete +MMIOERR_NETWORKERROR: Incomplete +MMIOERR_TOOMANYOPENFILES: Incomplete +MMIOERR_INVALIDFILE: Incomplete +CFSEPCHAR: Incomplete +MMIO_RWMODE: int +MMIO_SHAREMODE: int +MMIO_CREATE: int +MMIO_PARSE: int +MMIO_DELETE: int +MMIO_EXIST: int +MMIO_ALLOCBUF: int +MMIO_GETTEMP: int +MMIO_DIRTY: int +MMIO_READ: int +MMIO_WRITE: int +MMIO_READWRITE: int +MMIO_COMPAT: int +MMIO_EXCLUSIVE: int +MMIO_DENYWRITE: int +MMIO_DENYREAD: int +MMIO_DENYNONE: int +MMIO_FHOPEN: int +MMIO_EMPTYBUF: int +MMIO_TOUPPER: int +MMIO_INSTALLPROC: int +MMIO_GLOBALPROC: int +MMIO_REMOVEPROC: int +MMIO_UNICODEPROC: int +MMIO_FINDPROC: int +MMIO_FINDCHUNK: int +MMIO_FINDRIFF: int +MMIO_FINDLIST: int +MMIO_CREATERIFF: int +MMIO_CREATELIST: int +MMIOM_READ: int +MMIOM_WRITE: int +MMIOM_SEEK: int +MMIOM_OPEN: int +MMIOM_CLOSE: int +MMIOM_WRITEFLUSH: int +MMIOM_RENAME: int +MMIOM_USER: int +SEEK_SET: int +SEEK_CUR: int +SEEK_END: int +MMIO_DEFAULTBUFFER: int +MCIERR_INVALID_DEVICE_ID: Incomplete +MCIERR_UNRECOGNIZED_KEYWORD: Incomplete +MCIERR_UNRECOGNIZED_COMMAND: Incomplete +MCIERR_HARDWARE: Incomplete +MCIERR_INVALID_DEVICE_NAME: Incomplete +MCIERR_OUT_OF_MEMORY: Incomplete +MCIERR_DEVICE_OPEN: Incomplete +MCIERR_CANNOT_LOAD_DRIVER: Incomplete +MCIERR_MISSING_COMMAND_STRING: Incomplete +MCIERR_PARAM_OVERFLOW: Incomplete +MCIERR_MISSING_STRING_ARGUMENT: Incomplete +MCIERR_BAD_INTEGER: Incomplete +MCIERR_PARSER_INTERNAL: Incomplete +MCIERR_DRIVER_INTERNAL: Incomplete +MCIERR_MISSING_PARAMETER: Incomplete +MCIERR_UNSUPPORTED_FUNCTION: Incomplete +MCIERR_FILE_NOT_FOUND: Incomplete +MCIERR_DEVICE_NOT_READY: Incomplete +MCIERR_INTERNAL: Incomplete +MCIERR_DRIVER: Incomplete +MCIERR_CANNOT_USE_ALL: Incomplete +MCIERR_MULTIPLE: Incomplete +MCIERR_EXTENSION_NOT_FOUND: Incomplete +MCIERR_OUTOFRANGE: Incomplete +MCIERR_FLAGS_NOT_COMPATIBLE: Incomplete +MCIERR_FILE_NOT_SAVED: Incomplete +MCIERR_DEVICE_TYPE_REQUIRED: Incomplete +MCIERR_DEVICE_LOCKED: Incomplete +MCIERR_DUPLICATE_ALIAS: Incomplete +MCIERR_BAD_CONSTANT: Incomplete +MCIERR_MUST_USE_SHAREABLE: Incomplete +MCIERR_MISSING_DEVICE_NAME: Incomplete +MCIERR_BAD_TIME_FORMAT: Incomplete +MCIERR_NO_CLOSING_QUOTE: Incomplete +MCIERR_DUPLICATE_FLAGS: Incomplete +MCIERR_INVALID_FILE: Incomplete +MCIERR_NULL_PARAMETER_BLOCK: Incomplete +MCIERR_UNNAMED_RESOURCE: Incomplete +MCIERR_NEW_REQUIRES_ALIAS: Incomplete +MCIERR_NOTIFY_ON_AUTO_OPEN: Incomplete +MCIERR_NO_ELEMENT_ALLOWED: Incomplete +MCIERR_NONAPPLICABLE_FUNCTION: Incomplete +MCIERR_ILLEGAL_FOR_AUTO_OPEN: Incomplete +MCIERR_FILENAME_REQUIRED: Incomplete +MCIERR_EXTRA_CHARACTERS: Incomplete +MCIERR_DEVICE_NOT_INSTALLED: Incomplete +MCIERR_GET_CD: Incomplete +MCIERR_SET_CD: Incomplete +MCIERR_SET_DRIVE: Incomplete +MCIERR_DEVICE_LENGTH: Incomplete +MCIERR_DEVICE_ORD_LENGTH: Incomplete +MCIERR_NO_INTEGER: Incomplete +MCIERR_WAVE_OUTPUTSINUSE: Incomplete +MCIERR_WAVE_SETOUTPUTINUSE: Incomplete +MCIERR_WAVE_INPUTSINUSE: Incomplete +MCIERR_WAVE_SETINPUTINUSE: Incomplete +MCIERR_WAVE_OUTPUTUNSPECIFIED: Incomplete +MCIERR_WAVE_INPUTUNSPECIFIED: Incomplete +MCIERR_WAVE_OUTPUTSUNSUITABLE: Incomplete +MCIERR_WAVE_SETOUTPUTUNSUITABLE: Incomplete +MCIERR_WAVE_INPUTSUNSUITABLE: Incomplete +MCIERR_WAVE_SETINPUTUNSUITABLE: Incomplete +MCIERR_SEQ_DIV_INCOMPATIBLE: Incomplete +MCIERR_SEQ_PORT_INUSE: Incomplete +MCIERR_SEQ_PORT_NONEXISTENT: Incomplete +MCIERR_SEQ_PORT_MAPNODEVICE: Incomplete +MCIERR_SEQ_PORT_MISCERROR: Incomplete +MCIERR_SEQ_TIMER: Incomplete +MCIERR_SEQ_PORTUNSPECIFIED: Incomplete +MCIERR_SEQ_NOMIDIPRESENT: Incomplete +MCIERR_NO_WINDOW: Incomplete +MCIERR_CREATEWINDOW: Incomplete +MCIERR_FILE_READ: Incomplete +MCIERR_FILE_WRITE: Incomplete +MCIERR_NO_IDENTITY: Incomplete +MCIERR_CUSTOM_DRIVER_BASE: Incomplete +MCI_FIRST: int +MCI_OPEN: int +MCI_CLOSE: int +MCI_ESCAPE: int +MCI_PLAY: int +MCI_SEEK: int +MCI_STOP: int +MCI_PAUSE: int +MCI_INFO: int +MCI_GETDEVCAPS: int +MCI_SPIN: int +MCI_SET: int +MCI_STEP: int +MCI_RECORD: int +MCI_SYSINFO: int +MCI_BREAK: int +MCI_SAVE: int +MCI_STATUS: int +MCI_CUE: int +MCI_REALIZE: int +MCI_WINDOW: int +MCI_PUT: int +MCI_WHERE: int +MCI_FREEZE: int +MCI_UNFREEZE: int +MCI_LOAD: int +MCI_CUT: int +MCI_COPY: int +MCI_PASTE: int +MCI_UPDATE: int +MCI_RESUME: int +MCI_DELETE: int +MCI_USER_MESSAGES: Incomplete +MCI_LAST: int +MCI_DEVTYPE_VCR: int +MCI_DEVTYPE_VIDEODISC: int +MCI_DEVTYPE_OVERLAY: int +MCI_DEVTYPE_CD_AUDIO: int +MCI_DEVTYPE_DAT: int +MCI_DEVTYPE_SCANNER: int +MCI_DEVTYPE_ANIMATION: int +MCI_DEVTYPE_DIGITAL_VIDEO: int +MCI_DEVTYPE_OTHER: int +MCI_DEVTYPE_WAVEFORM_AUDIO: int +MCI_DEVTYPE_SEQUENCER: int +MCI_DEVTYPE_FIRST: int +MCI_DEVTYPE_LAST: int +MCI_DEVTYPE_FIRST_USER: int +MCI_MODE_NOT_READY: Incomplete +MCI_MODE_STOP: Incomplete +MCI_MODE_PLAY: Incomplete +MCI_MODE_RECORD: Incomplete +MCI_MODE_SEEK: Incomplete +MCI_MODE_PAUSE: Incomplete +MCI_MODE_OPEN: Incomplete +MCI_FORMAT_MILLISECONDS: int +MCI_FORMAT_HMS: int +MCI_FORMAT_MSF: int +MCI_FORMAT_FRAMES: int +MCI_FORMAT_SMPTE_24: int +MCI_FORMAT_SMPTE_25: int +MCI_FORMAT_SMPTE_30: int +MCI_FORMAT_SMPTE_30DROP: int +MCI_FORMAT_BYTES: int +MCI_FORMAT_SAMPLES: int +MCI_FORMAT_TMSF: int + +def MCI_MSF_MINUTE(msf): ... +def MCI_MSF_SECOND(msf): ... +def MCI_MSF_FRAME(msf): ... +def MCI_TMSF_TRACK(tmsf): ... +def MCI_TMSF_MINUTE(tmsf): ... +def MCI_TMSF_SECOND(tmsf): ... +def MCI_TMSF_FRAME(tmsf): ... +def MCI_HMS_HOUR(hms): ... +def MCI_HMS_MINUTE(hms): ... +def MCI_HMS_SECOND(hms): ... + +MCI_NOTIFY_SUCCESSFUL: int +MCI_NOTIFY_SUPERSEDED: int +MCI_NOTIFY_ABORTED: int +MCI_NOTIFY_FAILURE: int +MCI_NOTIFY: int +MCI_WAIT: int +MCI_FROM: int +MCI_TO: int +MCI_TRACK: int +MCI_OPEN_SHAREABLE: int +MCI_OPEN_ELEMENT: int +MCI_OPEN_ALIAS: int +MCI_OPEN_ELEMENT_ID: int +MCI_OPEN_TYPE_ID: int +MCI_OPEN_TYPE: int +MCI_SEEK_TO_START: int +MCI_SEEK_TO_END: int +MCI_STATUS_ITEM: int +MCI_STATUS_START: int +MCI_STATUS_LENGTH: int +MCI_STATUS_POSITION: int +MCI_STATUS_NUMBER_OF_TRACKS: int +MCI_STATUS_MODE: int +MCI_STATUS_MEDIA_PRESENT: int +MCI_STATUS_TIME_FORMAT: int +MCI_STATUS_READY: int +MCI_STATUS_CURRENT_TRACK: int +MCI_INFO_PRODUCT: int +MCI_INFO_FILE: int +MCI_INFO_MEDIA_UPC: int +MCI_INFO_MEDIA_IDENTITY: int +MCI_INFO_NAME: int +MCI_INFO_COPYRIGHT: int +MCI_GETDEVCAPS_ITEM: int +MCI_GETDEVCAPS_CAN_RECORD: int +MCI_GETDEVCAPS_HAS_AUDIO: int +MCI_GETDEVCAPS_HAS_VIDEO: int +MCI_GETDEVCAPS_DEVICE_TYPE: int +MCI_GETDEVCAPS_USES_FILES: int +MCI_GETDEVCAPS_COMPOUND_DEVICE: int +MCI_GETDEVCAPS_CAN_EJECT: int +MCI_GETDEVCAPS_CAN_PLAY: int +MCI_GETDEVCAPS_CAN_SAVE: int +MCI_SYSINFO_QUANTITY: int +MCI_SYSINFO_OPEN: int +MCI_SYSINFO_NAME: int +MCI_SYSINFO_INSTALLNAME: int +MCI_SET_DOOR_OPEN: int +MCI_SET_DOOR_CLOSED: int +MCI_SET_TIME_FORMAT: int +MCI_SET_AUDIO: int +MCI_SET_VIDEO: int +MCI_SET_ON: int +MCI_SET_OFF: int +MCI_SET_AUDIO_ALL: int +MCI_SET_AUDIO_LEFT: int +MCI_SET_AUDIO_RIGHT: int +MCI_BREAK_KEY: int +MCI_BREAK_HWND: int +MCI_BREAK_OFF: int +MCI_RECORD_INSERT: int +MCI_RECORD_OVERWRITE: int +MCI_SAVE_FILE: int +MCI_LOAD_FILE: int +MCI_VD_MODE_PARK: Incomplete +MCI_VD_MEDIA_CLV: Incomplete +MCI_VD_MEDIA_CAV: Incomplete +MCI_VD_MEDIA_OTHER: Incomplete +MCI_VD_FORMAT_TRACK: int +MCI_VD_PLAY_REVERSE: int +MCI_VD_PLAY_FAST: int +MCI_VD_PLAY_SPEED: int +MCI_VD_PLAY_SCAN: int +MCI_VD_PLAY_SLOW: int +MCI_VD_SEEK_REVERSE: int +MCI_VD_STATUS_SPEED: int +MCI_VD_STATUS_FORWARD: int +MCI_VD_STATUS_MEDIA_TYPE: int +MCI_VD_STATUS_SIDE: int +MCI_VD_STATUS_DISC_SIZE: int +MCI_VD_GETDEVCAPS_CLV: int +MCI_VD_GETDEVCAPS_CAV: int +MCI_VD_SPIN_UP: int +MCI_VD_SPIN_DOWN: int +MCI_VD_GETDEVCAPS_CAN_REVERSE: int +MCI_VD_GETDEVCAPS_FAST_RATE: int +MCI_VD_GETDEVCAPS_SLOW_RATE: int +MCI_VD_GETDEVCAPS_NORMAL_RATE: int +MCI_VD_STEP_FRAMES: int +MCI_VD_STEP_REVERSE: int +MCI_VD_ESCAPE_STRING: int +MCI_CDA_STATUS_TYPE_TRACK: int +MCI_CDA_TRACK_AUDIO: Incomplete +MCI_CDA_TRACK_OTHER: Incomplete +MCI_WAVE_PCM: Incomplete +MCI_WAVE_MAPPER: Incomplete +MCI_WAVE_OPEN_BUFFER: int +MCI_WAVE_SET_FORMATTAG: int +MCI_WAVE_SET_CHANNELS: int +MCI_WAVE_SET_SAMPLESPERSEC: int +MCI_WAVE_SET_AVGBYTESPERSEC: int +MCI_WAVE_SET_BLOCKALIGN: int +MCI_WAVE_SET_BITSPERSAMPLE: int +MCI_WAVE_INPUT: int +MCI_WAVE_OUTPUT: int +MCI_WAVE_STATUS_FORMATTAG: int +MCI_WAVE_STATUS_CHANNELS: int +MCI_WAVE_STATUS_SAMPLESPERSEC: int +MCI_WAVE_STATUS_AVGBYTESPERSEC: int +MCI_WAVE_STATUS_BLOCKALIGN: int +MCI_WAVE_STATUS_BITSPERSAMPLE: int +MCI_WAVE_STATUS_LEVEL: int +MCI_WAVE_SET_ANYINPUT: int +MCI_WAVE_SET_ANYOUTPUT: int +MCI_WAVE_GETDEVCAPS_INPUTS: int +MCI_WAVE_GETDEVCAPS_OUTPUTS: int +MCI_SEQ_DIV_PPQN: Incomplete +MCI_SEQ_DIV_SMPTE_24: Incomplete +MCI_SEQ_DIV_SMPTE_25: Incomplete +MCI_SEQ_DIV_SMPTE_30DROP: Incomplete +MCI_SEQ_DIV_SMPTE_30: Incomplete +MCI_SEQ_FORMAT_SONGPTR: int +MCI_SEQ_FILE: int +MCI_SEQ_MIDI: int +MCI_SEQ_SMPTE: int +MCI_SEQ_NONE: int +MCI_SEQ_MAPPER: int +MCI_SEQ_STATUS_TEMPO: int +MCI_SEQ_STATUS_PORT: int +MCI_SEQ_STATUS_SLAVE: int +MCI_SEQ_STATUS_MASTER: int +MCI_SEQ_STATUS_OFFSET: int +MCI_SEQ_STATUS_DIVTYPE: int +MCI_SEQ_STATUS_NAME: int +MCI_SEQ_STATUS_COPYRIGHT: int +MCI_SEQ_SET_TEMPO: int +MCI_SEQ_SET_PORT: int +MCI_SEQ_SET_SLAVE: int +MCI_SEQ_SET_MASTER: int +MCI_SEQ_SET_OFFSET: int +MCI_ANIM_OPEN_WS: int +MCI_ANIM_OPEN_PARENT: int +MCI_ANIM_OPEN_NOSTATIC: int +MCI_ANIM_PLAY_SPEED: int +MCI_ANIM_PLAY_REVERSE: int +MCI_ANIM_PLAY_FAST: int +MCI_ANIM_PLAY_SLOW: int +MCI_ANIM_PLAY_SCAN: int +MCI_ANIM_STEP_REVERSE: int +MCI_ANIM_STEP_FRAMES: int +MCI_ANIM_STATUS_SPEED: int +MCI_ANIM_STATUS_FORWARD: int +MCI_ANIM_STATUS_HWND: int +MCI_ANIM_STATUS_HPAL: int +MCI_ANIM_STATUS_STRETCH: int +MCI_ANIM_INFO_TEXT: int +MCI_ANIM_GETDEVCAPS_CAN_REVERSE: int +MCI_ANIM_GETDEVCAPS_FAST_RATE: int +MCI_ANIM_GETDEVCAPS_SLOW_RATE: int +MCI_ANIM_GETDEVCAPS_NORMAL_RATE: int +MCI_ANIM_GETDEVCAPS_PALETTES: int +MCI_ANIM_GETDEVCAPS_CAN_STRETCH: int +MCI_ANIM_GETDEVCAPS_MAX_WINDOWS: int +MCI_ANIM_REALIZE_NORM: int +MCI_ANIM_REALIZE_BKGD: int +MCI_ANIM_WINDOW_HWND: int +MCI_ANIM_WINDOW_STATE: int +MCI_ANIM_WINDOW_TEXT: int +MCI_ANIM_WINDOW_ENABLE_STRETCH: int +MCI_ANIM_WINDOW_DISABLE_STRETCH: int +MCI_ANIM_WINDOW_DEFAULT: int +MCI_ANIM_RECT: int +MCI_ANIM_PUT_SOURCE: int +MCI_ANIM_PUT_DESTINATION: int +MCI_ANIM_WHERE_SOURCE: int +MCI_ANIM_WHERE_DESTINATION: int +MCI_ANIM_UPDATE_HDC: int +MCI_OVLY_OPEN_WS: int +MCI_OVLY_OPEN_PARENT: int +MCI_OVLY_STATUS_HWND: int +MCI_OVLY_STATUS_STRETCH: int +MCI_OVLY_INFO_TEXT: int +MCI_OVLY_GETDEVCAPS_CAN_STRETCH: int +MCI_OVLY_GETDEVCAPS_CAN_FREEZE: int +MCI_OVLY_GETDEVCAPS_MAX_WINDOWS: int +MCI_OVLY_WINDOW_HWND: int +MCI_OVLY_WINDOW_STATE: int +MCI_OVLY_WINDOW_TEXT: int +MCI_OVLY_WINDOW_ENABLE_STRETCH: int +MCI_OVLY_WINDOW_DISABLE_STRETCH: int +MCI_OVLY_WINDOW_DEFAULT: int +MCI_OVLY_RECT: int +MCI_OVLY_PUT_SOURCE: int +MCI_OVLY_PUT_DESTINATION: int +MCI_OVLY_PUT_FRAME: int +MCI_OVLY_PUT_VIDEO: int +MCI_OVLY_WHERE_SOURCE: int +MCI_OVLY_WHERE_DESTINATION: int +MCI_OVLY_WHERE_FRAME: int +MCI_OVLY_WHERE_VIDEO: int +SELECTDIB: int + +def DIBINDEX(n): ... diff --git a/stubs/pywin32/win32/lib/ntsecuritycon.pyi b/stubs/pywin32/win32/lib/ntsecuritycon.pyi new file mode 100644 index 0000000..4dc485f --- /dev/null +++ b/stubs/pywin32/win32/lib/ntsecuritycon.pyi @@ -0,0 +1,550 @@ +DELETE: int +READ_CONTROL: int +WRITE_DAC: int +WRITE_OWNER: int +SYNCHRONIZE: int +STANDARD_RIGHTS_REQUIRED: int +STANDARD_RIGHTS_READ: int +STANDARD_RIGHTS_WRITE: int +STANDARD_RIGHTS_EXECUTE: int +STANDARD_RIGHTS_ALL: int +SPECIFIC_RIGHTS_ALL: int +ACCESS_SYSTEM_SECURITY: int +MAXIMUM_ALLOWED: int +GENERIC_READ: int +GENERIC_WRITE: int +GENERIC_EXECUTE: int +GENERIC_ALL: int +FILE_READ_DATA: int +FILE_WRITE_DATA: int +FILE_ADD_FILE: int +FILE_APPEND_DATA: int +FILE_ADD_SUBDIRECTORY: int +FILE_CREATE_PIPE_INSTANCE: int +FILE_READ_EA: int +FILE_WRITE_EA: int +FILE_EXECUTE: int +FILE_TRAVERSE: int +FILE_DELETE_CHILD: int +FILE_READ_ATTRIBUTES: int +FILE_WRITE_ATTRIBUTES: int +FILE_ALL_ACCESS: int +FILE_GENERIC_READ: int +FILE_GENERIC_WRITE: int +FILE_GENERIC_EXECUTE: int +SECURITY_NULL_SID_AUTHORITY = (0, 0, 0, 0, 0, 0) +SECURITY_WORLD_SID_AUTHORITY = (0, 0, 0, 0, 0, 1) +SECURITY_LOCAL_SID_AUTHORITY = (0, 0, 0, 0, 0, 2) +SECURITY_CREATOR_SID_AUTHORITY = (0, 0, 0, 0, 0, 3) +SECURITY_NON_UNIQUE_AUTHORITY = (0, 0, 0, 0, 0, 4) +SECURITY_RESOURCE_MANAGER_AUTHORITY = (0, 0, 0, 0, 0, 9) +SECURITY_NULL_RID: int +SECURITY_WORLD_RID: int +SECURITY_LOCAL_RID: int +SECURITY_CREATOR_OWNER_RID: int +SECURITY_CREATOR_GROUP_RID: int +SECURITY_CREATOR_OWNER_SERVER_RID: int +SECURITY_CREATOR_GROUP_SERVER_RID: int +SECURITY_CREATOR_OWNER_RIGHTS_RID: int +SECURITY_NT_AUTHORITY = (0, 0, 0, 0, 0, 5) +SECURITY_DIALUP_RID: int +SECURITY_NETWORK_RID: int +SECURITY_BATCH_RID: int +SECURITY_INTERACTIVE_RID: int +SECURITY_SERVICE_RID: int +SECURITY_ANONYMOUS_LOGON_RID: int +SECURITY_PROXY_RID: int +SECURITY_SERVER_LOGON_RID: int +SECURITY_LOGON_IDS_RID: int +SECURITY_LOGON_IDS_RID_COUNT: int +SECURITY_LOCAL_SYSTEM_RID: int +SECURITY_NT_NON_UNIQUE: int +SECURITY_BUILTIN_DOMAIN_RID: int +DOMAIN_USER_RID_ADMIN: int +DOMAIN_USER_RID_GUEST: int +DOMAIN_USER_RID_KRBTGT: int +DOMAIN_USER_RID_MAX: int +DOMAIN_GROUP_RID_ADMINS: int +DOMAIN_GROUP_RID_USERS: int +DOMAIN_GROUP_RID_GUESTS: int +DOMAIN_GROUP_RID_COMPUTERS: int +DOMAIN_GROUP_RID_CONTROLLERS: int +DOMAIN_GROUP_RID_CERT_ADMINS: int +DOMAIN_GROUP_RID_SCHEMA_ADMINS: int +DOMAIN_GROUP_RID_ENTERPRISE_ADMINS: int +DOMAIN_GROUP_RID_POLICY_ADMINS: int +DOMAIN_GROUP_RID_READONLY_CONTROLLERS: int +DOMAIN_ALIAS_RID_ADMINS: int +DOMAIN_ALIAS_RID_USERS: int +DOMAIN_ALIAS_RID_GUESTS: int +DOMAIN_ALIAS_RID_POWER_USERS: int +DOMAIN_ALIAS_RID_ACCOUNT_OPS: int +DOMAIN_ALIAS_RID_SYSTEM_OPS: int +DOMAIN_ALIAS_RID_PRINT_OPS: int +DOMAIN_ALIAS_RID_BACKUP_OPS: int +DOMAIN_ALIAS_RID_REPLICATOR: int +DOMAIN_ALIAS_RID_RAS_SERVERS: int +DOMAIN_ALIAS_RID_PREW2KCOMPACCESS: int +DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS: int +DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS: int +DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS: int +DOMAIN_ALIAS_RID_MONITORING_USERS: int +DOMAIN_ALIAS_RID_LOGGING_USERS: int +DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS: int +DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS: int +DOMAIN_ALIAS_RID_DCOM_USERS: int +DOMAIN_ALIAS_RID_IUSERS: int +DOMAIN_ALIAS_RID_CRYPTO_OPERATORS: int +DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP: int +DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP: int +DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP: int +SECURITY_MANDATORY_LABEL_AUTHORITY = (0, 0, 0, 0, 0, 16) +SECURITY_MANDATORY_UNTRUSTED_RID: int +SECURITY_MANDATORY_LOW_RID: int +SECURITY_MANDATORY_MEDIUM_RID: int +SECURITY_MANDATORY_HIGH_RID: int +SECURITY_MANDATORY_SYSTEM_RID: int +SECURITY_MANDATORY_PROTECTED_PROCESS_RID: int +SECURITY_MANDATORY_MAXIMUM_USER_RID: int +SYSTEM_LUID = (999, 0) +ANONYMOUS_LOGON_LUID = (998, 0) +LOCALSERVICE_LUID = (997, 0) +NETWORKSERVICE_LUID = (996, 0) +IUSER_LUID = (995, 0) +SE_GROUP_MANDATORY: int +SE_GROUP_ENABLED_BY_DEFAULT: int +SE_GROUP_ENABLED: int +SE_GROUP_OWNER: int +SE_GROUP_USE_FOR_DENY_ONLY: int +SE_GROUP_INTEGRITY: int +SE_GROUP_INTEGRITY_ENABLED: int +SE_GROUP_RESOURCE: int +SE_GROUP_LOGON_ID: int +ACCESS_MIN_MS_ACE_TYPE: int +ACCESS_ALLOWED_ACE_TYPE: int +ACCESS_DENIED_ACE_TYPE: int +SYSTEM_AUDIT_ACE_TYPE: int +SYSTEM_ALARM_ACE_TYPE: int +ACCESS_MAX_MS_V2_ACE_TYPE: int +ACCESS_ALLOWED_COMPOUND_ACE_TYPE: int +ACCESS_MAX_MS_V3_ACE_TYPE: int +ACCESS_MIN_MS_OBJECT_ACE_TYPE: int +ACCESS_ALLOWED_OBJECT_ACE_TYPE: int +ACCESS_DENIED_OBJECT_ACE_TYPE: int +SYSTEM_AUDIT_OBJECT_ACE_TYPE: int +SYSTEM_ALARM_OBJECT_ACE_TYPE: int +ACCESS_MAX_MS_OBJECT_ACE_TYPE: int +ACCESS_MAX_MS_V4_ACE_TYPE: int +ACCESS_MAX_MS_ACE_TYPE: int +ACCESS_ALLOWED_CALLBACK_ACE_TYPE: int +ACCESS_DENIED_CALLBACK_ACE_TYPE: int +ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE: int +ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE: int +SYSTEM_AUDIT_CALLBACK_ACE_TYPE: int +SYSTEM_ALARM_CALLBACK_ACE_TYPE: int +SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE: int +SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE: int +SYSTEM_MANDATORY_LABEL_ACE_TYPE: int +ACCESS_MAX_MS_V5_ACE_TYPE: int +OBJECT_INHERIT_ACE: int +CONTAINER_INHERIT_ACE: int +NO_PROPAGATE_INHERIT_ACE: int +INHERIT_ONLY_ACE: int +VALID_INHERIT_FLAGS: int +SUCCESSFUL_ACCESS_ACE_FLAG: int +FAILED_ACCESS_ACE_FLAG: int +SE_OWNER_DEFAULTED: int +SE_GROUP_DEFAULTED: int +SE_DACL_PRESENT: int +SE_DACL_DEFAULTED: int +SE_SACL_PRESENT: int +SE_SACL_DEFAULTED: int +SE_SELF_RELATIVE: int +SE_PRIVILEGE_ENABLED_BY_DEFAULT: int +SE_PRIVILEGE_ENABLED: int +SE_PRIVILEGE_USED_FOR_ACCESS: int +PRIVILEGE_SET_ALL_NECESSARY: int +SE_CREATE_TOKEN_NAME: str +SE_ASSIGNPRIMARYTOKEN_NAME: str +SE_LOCK_MEMORY_NAME: str +SE_INCREASE_QUOTA_NAME: str +SE_UNSOLICITED_INPUT_NAME: str +SE_MACHINE_ACCOUNT_NAME: str +SE_TCB_NAME: str +SE_SECURITY_NAME: str +SE_TAKE_OWNERSHIP_NAME: str +SE_LOAD_DRIVER_NAME: str +SE_SYSTEM_PROFILE_NAME: str +SE_SYSTEMTIME_NAME: str +SE_PROF_SINGLE_PROCESS_NAME: str +SE_INC_BASE_PRIORITY_NAME: str +SE_CREATE_PAGEFILE_NAME: str +SE_CREATE_PERMANENT_NAME: str +SE_BACKUP_NAME: str +SE_RESTORE_NAME: str +SE_SHUTDOWN_NAME: str +SE_DEBUG_NAME: str +SE_AUDIT_NAME: str +SE_SYSTEM_ENVIRONMENT_NAME: str +SE_CHANGE_NOTIFY_NAME: str +SE_REMOTE_SHUTDOWN_NAME: str +SecurityAnonymous: int +SecurityIdentification: int +SecurityImpersonation: int +SecurityDelegation: int +SECURITY_MAX_IMPERSONATION_LEVEL: int +DEFAULT_IMPERSONATION_LEVEL: int +TOKEN_ASSIGN_PRIMARY: int +TOKEN_DUPLICATE: int +TOKEN_IMPERSONATE: int +TOKEN_QUERY: int +TOKEN_QUERY_SOURCE: int +TOKEN_ADJUST_PRIVILEGES: int +TOKEN_ADJUST_GROUPS: int +TOKEN_ADJUST_DEFAULT: int +TOKEN_ALL_ACCESS: int +TOKEN_READ: int +TOKEN_WRITE: int +TOKEN_EXECUTE: int +SidTypeUser: int +SidTypeGroup: int +SidTypeDomain: int +SidTypeAlias: int +SidTypeWellKnownGroup: int +SidTypeDeletedAccount: int +SidTypeInvalid: int +SidTypeUnknown: int +SidTypeComputer: int +SidTypeLabel: int +TokenPrimary: int +TokenImpersonation: int +TokenUser: int +TokenGroups: int +TokenPrivileges: int +TokenOwner: int +TokenPrimaryGroup: int +TokenDefaultDacl: int +TokenSource: int +TokenType: int +TokenImpersonationLevel: int +TokenStatistics: int +TokenRestrictedSids: int +TokenSessionId: int +TokenGroupsAndPrivileges: int +TokenSessionReference: int +TokenSandBoxInert: int +TokenAuditPolicy: int +TokenOrigin: int +TokenElevationType: int +TokenLinkedToken: int +TokenElevation: int +TokenHasRestrictions: int +TokenAccessInformation: int +TokenVirtualizationAllowed: int +TokenVirtualizationEnabled: int +TokenIntegrityLevel: int +TokenUIAccess: int +TokenMandatoryPolicy: int +TokenLogonSid: int +DS_BEHAVIOR_WIN2000: int +DS_BEHAVIOR_WIN2003_WITH_MIXED_DOMAINS: int +DS_BEHAVIOR_WIN2003: int +DS_SYNCED_EVENT_NAME: str +ACTRL_DS_OPEN: int +ACTRL_DS_CREATE_CHILD: int +ACTRL_DS_DELETE_CHILD: int +ACTRL_DS_SELF: int +ACTRL_DS_READ_PROP: int +ACTRL_DS_WRITE_PROP: int +ACTRL_DS_DELETE_TREE: int +ACTRL_DS_CONTROL_ACCESS: int +NTDSAPI_BIND_ALLOW_DELEGATION: int +DS_REPSYNC_ASYNCHRONOUS_OPERATION: int +DS_REPSYNC_WRITEABLE: int +DS_REPSYNC_PERIODIC: int +DS_REPSYNC_INTERSITE_MESSAGING: int +DS_REPSYNC_ALL_SOURCES: int +DS_REPSYNC_FULL: int +DS_REPSYNC_URGENT: int +DS_REPSYNC_NO_DISCARD: int +DS_REPSYNC_FORCE: int +DS_REPSYNC_ADD_REFERENCE: int +DS_REPSYNC_NEVER_COMPLETED: int +DS_REPSYNC_TWO_WAY: int +DS_REPSYNC_NEVER_NOTIFY: int +DS_REPSYNC_INITIAL: int +DS_REPSYNC_USE_COMPRESSION: int +DS_REPSYNC_ABANDONED: int +DS_REPSYNC_INITIAL_IN_PROGRESS: int +DS_REPSYNC_PARTIAL_ATTRIBUTE_SET: int +DS_REPSYNC_REQUEUE: int +DS_REPSYNC_NOTIFICATION: int +DS_REPSYNC_ASYNCHRONOUS_REPLICA: int +DS_REPSYNC_CRITICAL: int +DS_REPSYNC_FULL_IN_PROGRESS: int +DS_REPSYNC_PREEMPTED: int +DS_REPADD_ASYNCHRONOUS_OPERATION: int +DS_REPADD_WRITEABLE: int +DS_REPADD_INITIAL: int +DS_REPADD_PERIODIC: int +DS_REPADD_INTERSITE_MESSAGING: int +DS_REPADD_ASYNCHRONOUS_REPLICA: int +DS_REPADD_DISABLE_NOTIFICATION: int +DS_REPADD_DISABLE_PERIODIC: int +DS_REPADD_USE_COMPRESSION: int +DS_REPADD_NEVER_NOTIFY: int +DS_REPADD_TWO_WAY: int +DS_REPADD_CRITICAL: int +DS_REPDEL_ASYNCHRONOUS_OPERATION: int +DS_REPDEL_WRITEABLE: int +DS_REPDEL_INTERSITE_MESSAGING: int +DS_REPDEL_IGNORE_ERRORS: int +DS_REPDEL_LOCAL_ONLY: int +DS_REPDEL_NO_SOURCE: int +DS_REPDEL_REF_OK: int +DS_REPMOD_ASYNCHRONOUS_OPERATION: int +DS_REPMOD_WRITEABLE: int +DS_REPMOD_UPDATE_FLAGS: int +DS_REPMOD_UPDATE_ADDRESS: int +DS_REPMOD_UPDATE_SCHEDULE: int +DS_REPMOD_UPDATE_RESULT: int +DS_REPMOD_UPDATE_TRANSPORT: int +DS_REPUPD_ASYNCHRONOUS_OPERATION: int +DS_REPUPD_WRITEABLE: int +DS_REPUPD_ADD_REFERENCE: int +DS_REPUPD_DELETE_REFERENCE: int +DS_INSTANCETYPE_IS_NC_HEAD: int +DS_INSTANCETYPE_NC_IS_WRITEABLE: int +DS_INSTANCETYPE_NC_COMING: int +DS_INSTANCETYPE_NC_GOING: int +NTDSDSA_OPT_IS_GC: int +NTDSDSA_OPT_DISABLE_INBOUND_REPL: int +NTDSDSA_OPT_DISABLE_OUTBOUND_REPL: int +NTDSDSA_OPT_DISABLE_NTDSCONN_XLATE: int +NTDSCONN_OPT_IS_GENERATED: int +NTDSCONN_OPT_TWOWAY_SYNC: int +NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT: int +NTDSCONN_OPT_USE_NOTIFY: int +NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION: int +NTDSCONN_OPT_USER_OWNED_SCHEDULE: int +NTDSCONN_KCC_NO_REASON: int +NTDSCONN_KCC_GC_TOPOLOGY: int +NTDSCONN_KCC_RING_TOPOLOGY: int +NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY: int +NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY: int +NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY: int +NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY: int +NTDSCONN_KCC_INTERSITE_TOPOLOGY: int +NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY: int +NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY: int +NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY: int +FRSCONN_PRIORITY_MASK: int +FRSCONN_MAX_PRIORITY: int +NTDSCONN_OPT_IGNORE_SCHEDULE_MASK: int +NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLED: int +NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLED: int +NTDSSETTINGS_OPT_IS_TOPL_MIN_HOPS_DISABLED: int +NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED: int +NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLED: int +NTDSSETTINGS_OPT_IS_GROUP_CACHING_ENABLED: int +NTDSSETTINGS_OPT_FORCE_KCC_WHISTLER_BEHAVIOR: int +NTDSSETTINGS_OPT_FORCE_KCC_W2K_ELECTION: int +NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED: int +NTDSSETTINGS_OPT_IS_SCHEDULE_HASHING_ENABLED: int +NTDSSETTINGS_OPT_IS_REDUNDANT_SERVER_TOPOLOGY_ENABLED: int +NTDSSETTINGS_DEFAULT_SERVER_REDUNDANCY: int +NTDSTRANSPORT_OPT_IGNORE_SCHEDULES: int +NTDSTRANSPORT_OPT_BRIDGES_REQUIRED: int +NTDSSITECONN_OPT_USE_NOTIFY: int +NTDSSITECONN_OPT_TWOWAY_SYNC: int +NTDSSITECONN_OPT_DISABLE_COMPRESSION: int +NTDSSITELINK_OPT_USE_NOTIFY: int +NTDSSITELINK_OPT_TWOWAY_SYNC: int +NTDSSITELINK_OPT_DISABLE_COMPRESSION: int +GUID_USERS_CONTAINER_A: str +GUID_COMPUTRS_CONTAINER_A: str +GUID_SYSTEMS_CONTAINER_A: str +GUID_DOMAIN_CONTROLLERS_CONTAINER_A: str +GUID_INFRASTRUCTURE_CONTAINER_A: str +GUID_DELETED_OBJECTS_CONTAINER_A: str +GUID_LOSTANDFOUND_CONTAINER_A: str +GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_A: str +GUID_PROGRAM_DATA_CONTAINER_A: str +GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_A: str +GUID_NTDS_QUOTAS_CONTAINER_A: str +GUID_USERS_CONTAINER_BYTE: str +GUID_COMPUTRS_CONTAINER_BYTE: str +GUID_SYSTEMS_CONTAINER_BYTE: str +GUID_DOMAIN_CONTROLLERS_CONTAINER_BYTE: str +GUID_INFRASTRUCTURE_CONTAINER_BYTE: str +GUID_DELETED_OBJECTS_CONTAINER_BYTE: str +GUID_LOSTANDFOUND_CONTAINER_BYTE: str +GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_BYTE: str +GUID_PROGRAM_DATA_CONTAINER_BYTE: str +GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_BYTE: str +GUID_NTDS_QUOTAS_CONTAINER_BYTE: str +DS_REPSYNCALL_NO_OPTIONS: int +DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE: int +DS_REPSYNCALL_SYNC_ADJACENT_SERVERS_ONLY: int +DS_REPSYNCALL_ID_SERVERS_BY_DN: int +DS_REPSYNCALL_DO_NOT_SYNC: int +DS_REPSYNCALL_SKIP_INITIAL_CHECK: int +DS_REPSYNCALL_PUSH_CHANGES_OUTWARD: int +DS_REPSYNCALL_CROSS_SITE_BOUNDARIES: int +DS_ROLE_SCHEMA_OWNER: int +DS_ROLE_DOMAIN_OWNER: int +DS_ROLE_PDC_OWNER: int +DS_ROLE_RID_OWNER: int +DS_ROLE_INFRASTRUCTURE_OWNER: int +DS_SCHEMA_GUID_NOT_FOUND: int +DS_SCHEMA_GUID_ATTR: int +DS_SCHEMA_GUID_ATTR_SET: int +DS_SCHEMA_GUID_CLASS: int +DS_SCHEMA_GUID_CONTROL_RIGHT: int +DS_KCC_FLAG_ASYNC_OP: int +DS_KCC_FLAG_DAMPED: int +DS_EXIST_ADVISORY_MODE: int +DS_REPL_INFO_FLAG_IMPROVE_LINKED_ATTRS: int +DS_REPL_NBR_WRITEABLE: int +DS_REPL_NBR_SYNC_ON_STARTUP: int +DS_REPL_NBR_DO_SCHEDULED_SYNCS: int +DS_REPL_NBR_USE_ASYNC_INTERSITE_TRANSPORT: int +DS_REPL_NBR_TWO_WAY_SYNC: int +DS_REPL_NBR_RETURN_OBJECT_PARENTS: int +DS_REPL_NBR_FULL_SYNC_IN_PROGRESS: int +DS_REPL_NBR_FULL_SYNC_NEXT_PACKET: int +DS_REPL_NBR_NEVER_SYNCED: int +DS_REPL_NBR_PREEMPTED: int +DS_REPL_NBR_IGNORE_CHANGE_NOTIFICATIONS: int +DS_REPL_NBR_DISABLE_SCHEDULED_SYNC: int +DS_REPL_NBR_COMPRESS_CHANGES: int +DS_REPL_NBR_NO_CHANGE_NOTIFICATIONS: int +DS_REPL_NBR_PARTIAL_ATTRIBUTE_SET: int +DS_REPL_NBR_MODIFIABLE_MASK: int +DS_UNKNOWN_NAME: int +DS_FQDN_1779_NAME: int +DS_NT4_ACCOUNT_NAME: int +DS_DISPLAY_NAME: int +DS_UNIQUE_ID_NAME: int +DS_CANONICAL_NAME: int +DS_USER_PRINCIPAL_NAME: int +DS_CANONICAL_NAME_EX: int +DS_SERVICE_PRINCIPAL_NAME: int +DS_SID_OR_SID_HISTORY_NAME: int +DS_DNS_DOMAIN_NAME: int +DS_DOMAIN_SIMPLE_NAME: int +DS_ENTERPRISE_SIMPLE_NAME: int +DS_NAME_NO_FLAGS: int +DS_NAME_FLAG_SYNTACTICAL_ONLY: int +DS_NAME_FLAG_EVAL_AT_DC: int +DS_NAME_FLAG_GCVERIFY: int +DS_NAME_FLAG_TRUST_REFERRAL: int +DS_NAME_NO_ERROR: int +DS_NAME_ERROR_RESOLVING: int +DS_NAME_ERROR_NOT_FOUND: int +DS_NAME_ERROR_NOT_UNIQUE: int +DS_NAME_ERROR_NO_MAPPING: int +DS_NAME_ERROR_DOMAIN_ONLY: int +DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: int +DS_NAME_ERROR_TRUST_REFERRAL: int +DS_SPN_DNS_HOST: int +DS_SPN_DN_HOST: int +DS_SPN_NB_HOST: int +DS_SPN_DOMAIN: int +DS_SPN_NB_DOMAIN: int +DS_SPN_SERVICE: int +DS_SPN_ADD_SPN_OP: int +DS_SPN_REPLACE_SPN_OP: int +DS_SPN_DELETE_SPN_OP: int +DS_FORCE_REDISCOVERY: int +DS_DIRECTORY_SERVICE_REQUIRED: int +DS_DIRECTORY_SERVICE_PREFERRED: int +DS_GC_SERVER_REQUIRED: int +DS_PDC_REQUIRED: int +DS_BACKGROUND_ONLY: int +DS_IP_REQUIRED: int +DS_KDC_REQUIRED: int +DS_TIMESERV_REQUIRED: int +DS_WRITABLE_REQUIRED: int +DS_GOOD_TIMESERV_PREFERRED: int +DS_AVOID_SELF: int +DS_ONLY_LDAP_NEEDED: int +DS_IS_FLAT_NAME: int +DS_IS_DNS_NAME: int +DS_RETURN_DNS_NAME: int +DS_RETURN_FLAT_NAME: int +DSGETDC_VALID_FLAGS: int +DS_INET_ADDRESS: int +DS_NETBIOS_ADDRESS: int +DS_PDC_FLAG: int +DS_GC_FLAG: int +DS_LDAP_FLAG: int +DS_DS_FLAG: int +DS_KDC_FLAG: int +DS_TIMESERV_FLAG: int +DS_CLOSEST_FLAG: int +DS_WRITABLE_FLAG: int +DS_GOOD_TIMESERV_FLAG: int +DS_NDNC_FLAG: int +DS_PING_FLAGS: int +DS_DNS_CONTROLLER_FLAG: int +DS_DNS_DOMAIN_FLAG: int +DS_DNS_FOREST_FLAG: int +DS_DOMAIN_IN_FOREST: int +DS_DOMAIN_DIRECT_OUTBOUND: int +DS_DOMAIN_TREE_ROOT: int +DS_DOMAIN_PRIMARY: int +DS_DOMAIN_NATIVE_MODE: int +DS_DOMAIN_DIRECT_INBOUND: int +DS_DOMAIN_VALID_FLAGS: int +DS_GFTI_UPDATE_TDO: int +DS_GFTI_VALID_FLAGS: int +DS_ONLY_DO_SITE_NAME: int +DS_NOTIFY_AFTER_SITE_RECORDS: int +DS_OPEN_VALID_OPTION_FLAGS: int +DS_OPEN_VALID_FLAGS: int +SI_EDIT_PERMS: int +SI_EDIT_OWNER: int +SI_EDIT_AUDITS: int +SI_CONTAINER: int +SI_READONLY: int +SI_ADVANCED: int +SI_RESET: int +SI_OWNER_READONLY: int +SI_EDIT_PROPERTIES: int +SI_OWNER_RECURSE: int +SI_NO_ACL_PROTECT: int +SI_NO_TREE_APPLY: int +SI_PAGE_TITLE: int +SI_SERVER_IS_DC: int +SI_RESET_DACL_TREE: int +SI_RESET_SACL_TREE: int +SI_OBJECT_GUID: int +SI_EDIT_EFFECTIVE: int +SI_RESET_DACL: int +SI_RESET_SACL: int +SI_RESET_OWNER: int +SI_NO_ADDITIONAL_PERMISSION: int +SI_MAY_WRITE: int +SI_EDIT_ALL: int +SI_AUDITS_ELEVATION_REQUIRED: int +SI_VIEW_ONLY: int +SI_OWNER_ELEVATION_REQUIRED: int +SI_PERMS_ELEVATION_REQUIRED: int +SI_ACCESS_SPECIFIC: int +SI_ACCESS_GENERAL: int +SI_ACCESS_CONTAINER: int +SI_ACCESS_PROPERTY: int +SI_PAGE_PERM: int +SI_PAGE_ADVPERM: int +SI_PAGE_AUDIT: int +SI_PAGE_OWNER: int +SI_PAGE_EFFECTIVE: int +PSPCB_SI_INITDIALOG: int +ACTRL_DS_LIST: int +ACTRL_DS_LIST_OBJECT: int +CFSTR_ACLUI_SID_INFO_LIST: str +DS_LIST_ACCOUNT_OBJECT_FOR_SERVER: int +DS_LIST_DNS_HOST_NAME_FOR_SERVER: int +DS_LIST_DSA_OBJECT_FOR_SERVER: int +FILE_LIST_DIRECTORY: int diff --git a/stubs/pywin32/win32/lib/pywintypes.pyi b/stubs/pywin32/win32/lib/pywintypes.pyi new file mode 100644 index 0000000..2327c10 --- /dev/null +++ b/stubs/pywin32/win32/lib/pywintypes.pyi @@ -0,0 +1,30 @@ +# Can't generate with stubgen because: +# "KeyError: 'pywintypes'" +from _typeshed import Incomplete +from typing_extensions import Literal + +import _win32typing + +class error(Exception): ... +class com_error(Exception): ... + +def DosDateTimeToTime() -> _win32typing.PyTime: ... +def Unicode() -> str: ... +def UnicodeFromRaw(_str: str) -> str: ... +def IsTextUnicode(_str: str, flags) -> tuple[Incomplete, Incomplete]: ... +def OVERLAPPED() -> _win32typing.PyOVERLAPPED: ... +def IID(iidString: str, is_bytes: bool = ...) -> _win32typing.PyIID: ... +def Time(timeRepr) -> _win32typing.PyTime: ... +def CreateGuid() -> _win32typing.PyIID: ... +def ACL(bufSize: int = ...) -> _win32typing.PyACL: ... +def SID(buffer, idAuthority, subAuthorities, bufSize=...) -> _win32typing.PySID: ... +def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ... +def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... +def HANDLE() -> int: ... +def HKEY() -> _win32typing.PyHKEY: ... +def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ... + +FALSE: Literal[False] +TRUE: Literal[True] + +def TimeStamp(*args, **kwargs): ... # incomplete diff --git a/stubs/pywin32/win32/lib/regutil.pyi b/stubs/pywin32/win32/lib/regutil.pyi new file mode 100644 index 0000000..73aeee4 --- /dev/null +++ b/stubs/pywin32/win32/lib/regutil.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete + +error: str +CLSIDPyFile: str +RegistryIDPyFile: str +RegistryIDPycFile: str + +def BuildDefaultPythonKey(): ... +def GetRootKey(): ... +def GetRegistryDefaultValue(subkey, rootkey: Incomplete | None = ...): ... +def SetRegistryDefaultValue(subKey, value, rootkey: Incomplete | None = ...) -> None: ... +def GetAppPathsKey(): ... +def RegisterPythonExe(exeFullPath, exeAlias: Incomplete | None = ..., exeAppPath: Incomplete | None = ...) -> None: ... +def GetRegisteredExe(exeAlias): ... +def UnregisterPythonExe(exeAlias) -> None: ... +def RegisterNamedPath(name, path) -> None: ... +def UnregisterNamedPath(name) -> None: ... +def GetRegisteredNamedPath(name): ... +def RegisterModule(modName, modPath) -> None: ... +def UnregisterModule(modName) -> None: ... +def GetRegisteredHelpFile(helpDesc): ... +def RegisterHelpFile(helpFile, helpPath, helpDesc: Incomplete | None = ..., bCheckFile: int = ...) -> None: ... +def UnregisterHelpFile(helpFile, helpDesc: Incomplete | None = ...) -> None: ... +def RegisterCoreDLL(coredllName: Incomplete | None = ...) -> None: ... +def RegisterFileExtensions(defPyIcon, defPycIcon, runCommand) -> None: ... +def RegisterShellCommand(shellCommand, exeCommand, shellUserCommand: Incomplete | None = ...) -> None: ... +def RegisterDDECommand(shellCommand, ddeApp, ddeTopic, ddeCommand) -> None: ... diff --git a/stubs/pywin32/win32/lib/sspicon.pyi b/stubs/pywin32/win32/lib/sspicon.pyi new file mode 100644 index 0000000..978a437 --- /dev/null +++ b/stubs/pywin32/win32/lib/sspicon.pyi @@ -0,0 +1,457 @@ +ISSP_LEVEL: int +ISSP_MODE: int + +def SEC_SUCCESS(Status: int) -> bool: ... + +SECPKG_FLAG_INTEGRITY: int +SECPKG_FLAG_PRIVACY: int +SECPKG_FLAG_TOKEN_ONLY: int +SECPKG_FLAG_DATAGRAM: int +SECPKG_FLAG_CONNECTION: int +SECPKG_FLAG_MULTI_REQUIRED: int +SECPKG_FLAG_CLIENT_ONLY: int +SECPKG_FLAG_EXTENDED_ERROR: int +SECPKG_FLAG_IMPERSONATION: int +SECPKG_FLAG_ACCEPT_WIN32_NAME: int +SECPKG_FLAG_STREAM: int +SECPKG_FLAG_NEGOTIABLE: int +SECPKG_FLAG_GSS_COMPATIBLE: int +SECPKG_FLAG_LOGON: int +SECPKG_FLAG_ASCII_BUFFERS: int +SECPKG_FLAG_FRAGMENT: int +SECPKG_FLAG_MUTUAL_AUTH: int +SECPKG_FLAG_DELEGATION: int +SECPKG_FLAG_READONLY_WITH_CHECKSUM: int +SECPKG_ID_NONE: int +SECBUFFER_VERSION: int +SECBUFFER_EMPTY: int +SECBUFFER_DATA: int +SECBUFFER_TOKEN: int +SECBUFFER_PKG_PARAMS: int +SECBUFFER_MISSING: int +SECBUFFER_EXTRA: int +SECBUFFER_STREAM_TRAILER: int +SECBUFFER_STREAM_HEADER: int +SECBUFFER_NEGOTIATION_INFO: int +SECBUFFER_PADDING: int +SECBUFFER_STREAM: int +SECBUFFER_TARGET: int +SECBUFFER_CHANNEL_BINDINGS: int +SECBUFFER_ATTRMASK: int +SECBUFFER_READONLY: int +SECBUFFER_READONLY_WITH_CHECKSUM: int +SECBUFFER_RESERVED: int +SECURITY_NATIVE_DREP: int +SECURITY_NETWORK_DREP: int +SECPKG_CRED_INBOUND: int +SECPKG_CRED_OUTBOUND: int +SECPKG_CRED_BOTH: int +SECPKG_CRED_DEFAULT: int +SECPKG_CRED_RESERVED: int +ISC_REQ_DELEGATE: int +ISC_REQ_MUTUAL_AUTH: int +ISC_REQ_REPLAY_DETECT: int +ISC_REQ_SEQUENCE_DETECT: int +ISC_REQ_CONFIDENTIALITY: int +ISC_REQ_USE_SESSION_KEY: int +ISC_REQ_PROMPT_FOR_CREDS: int +ISC_REQ_USE_SUPPLIED_CREDS: int +ISC_REQ_ALLOCATE_MEMORY: int +ISC_REQ_USE_DCE_STYLE: int +ISC_REQ_DATAGRAM: int +ISC_REQ_CONNECTION: int +ISC_REQ_CALL_LEVEL: int +ISC_REQ_FRAGMENT_SUPPLIED: int +ISC_REQ_EXTENDED_ERROR: int +ISC_REQ_STREAM: int +ISC_REQ_INTEGRITY: int +ISC_REQ_IDENTIFY: int +ISC_REQ_NULL_SESSION: int +ISC_REQ_MANUAL_CRED_VALIDATION: int +ISC_REQ_RESERVED1: int +ISC_REQ_FRAGMENT_TO_FIT: int +ISC_REQ_HTTP: int +ISC_RET_DELEGATE: int +ISC_RET_MUTUAL_AUTH: int +ISC_RET_REPLAY_DETECT: int +ISC_RET_SEQUENCE_DETECT: int +ISC_RET_CONFIDENTIALITY: int +ISC_RET_USE_SESSION_KEY: int +ISC_RET_USED_COLLECTED_CREDS: int +ISC_RET_USED_SUPPLIED_CREDS: int +ISC_RET_ALLOCATED_MEMORY: int +ISC_RET_USED_DCE_STYLE: int +ISC_RET_DATAGRAM: int +ISC_RET_CONNECTION: int +ISC_RET_INTERMEDIATE_RETURN: int +ISC_RET_CALL_LEVEL: int +ISC_RET_EXTENDED_ERROR: int +ISC_RET_STREAM: int +ISC_RET_INTEGRITY: int +ISC_RET_IDENTIFY: int +ISC_RET_NULL_SESSION: int +ISC_RET_MANUAL_CRED_VALIDATION: int +ISC_RET_RESERVED1: int +ISC_RET_FRAGMENT_ONLY: int +ASC_REQ_DELEGATE: int +ASC_REQ_MUTUAL_AUTH: int +ASC_REQ_REPLAY_DETECT: int +ASC_REQ_SEQUENCE_DETECT: int +ASC_REQ_CONFIDENTIALITY: int +ASC_REQ_USE_SESSION_KEY: int +ASC_REQ_ALLOCATE_MEMORY: int +ASC_REQ_USE_DCE_STYLE: int +ASC_REQ_DATAGRAM: int +ASC_REQ_CONNECTION: int +ASC_REQ_CALL_LEVEL: int +ASC_REQ_EXTENDED_ERROR: int +ASC_REQ_STREAM: int +ASC_REQ_INTEGRITY: int +ASC_REQ_LICENSING: int +ASC_REQ_IDENTIFY: int +ASC_REQ_ALLOW_NULL_SESSION: int +ASC_REQ_ALLOW_NON_USER_LOGONS: int +ASC_REQ_ALLOW_CONTEXT_REPLAY: int +ASC_REQ_FRAGMENT_TO_FIT: int +ASC_REQ_FRAGMENT_SUPPLIED: int +ASC_REQ_NO_TOKEN: int +ASC_RET_DELEGATE: int +ASC_RET_MUTUAL_AUTH: int +ASC_RET_REPLAY_DETECT: int +ASC_RET_SEQUENCE_DETECT: int +ASC_RET_CONFIDENTIALITY: int +ASC_RET_USE_SESSION_KEY: int +ASC_RET_ALLOCATED_MEMORY: int +ASC_RET_USED_DCE_STYLE: int +ASC_RET_DATAGRAM: int +ASC_RET_CONNECTION: int +ASC_RET_CALL_LEVEL: int +ASC_RET_THIRD_LEG_FAILED: int +ASC_RET_EXTENDED_ERROR: int +ASC_RET_STREAM: int +ASC_RET_INTEGRITY: int +ASC_RET_LICENSING: int +ASC_RET_IDENTIFY: int +ASC_RET_NULL_SESSION: int +ASC_RET_ALLOW_NON_USER_LOGONS: int +ASC_RET_ALLOW_CONTEXT_REPLAY: int +ASC_RET_FRAGMENT_ONLY: int +SECPKG_CRED_ATTR_NAMES: int +SECPKG_ATTR_SIZES: int +SECPKG_ATTR_NAMES: int +SECPKG_ATTR_LIFESPAN: int +SECPKG_ATTR_DCE_INFO: int +SECPKG_ATTR_STREAM_SIZES: int +SECPKG_ATTR_KEY_INFO: int +SECPKG_ATTR_AUTHORITY: int +SECPKG_ATTR_PROTO_INFO: int +SECPKG_ATTR_PASSWORD_EXPIRY: int +SECPKG_ATTR_SESSION_KEY: int +SECPKG_ATTR_PACKAGE_INFO: int +SECPKG_ATTR_USER_FLAGS: int +SECPKG_ATTR_NEGOTIATION_INFO: int +SECPKG_ATTR_NATIVE_NAMES: int +SECPKG_ATTR_FLAGS: int +SECPKG_ATTR_USE_VALIDATED: int +SECPKG_ATTR_CREDENTIAL_NAME: int +SECPKG_ATTR_TARGET_INFORMATION: int +SECPKG_ATTR_ACCESS_TOKEN: int +SECPKG_ATTR_TARGET: int +SECPKG_ATTR_AUTHENTICATION_ID: int +SECPKG_ATTR_REMOTE_CERT_CONTEXT: int +SECPKG_ATTR_LOCAL_CERT_CONTEXT: int +SECPKG_ATTR_ROOT_STORE: int +SECPKG_ATTR_SUPPORTED_ALGS: int +SECPKG_ATTR_CIPHER_STRENGTHS: int +SECPKG_ATTR_SUPPORTED_PROTOCOLS: int +SECPKG_ATTR_CONNECTION_INFO: int +SECPKG_ATTR_EAP_KEY_BLOCK: int +SECPKG_ATTR_MAPPED_CRED_ATTR: int +SECPKG_ATTR_SESSION_INFO: int +SECPKG_ATTR_APP_DATA: int +SECPKG_NEGOTIATION_COMPLETE: int +SECPKG_NEGOTIATION_OPTIMISTIC: int +SECPKG_NEGOTIATION_IN_PROGRESS: int +SECPKG_NEGOTIATION_DIRECT: int +SECPKG_NEGOTIATION_TRY_MULTICRED: int +SECPKG_CONTEXT_EXPORT_RESET_NEW: int +SECPKG_CONTEXT_EXPORT_DELETE_OLD: int +SECQOP_WRAP_NO_ENCRYPT: int +SECURITY_ENTRYPOINT_ANSIW: str +SECURITY_ENTRYPOINT_ANSIA: str +SECURITY_ENTRYPOINT16: str +SECURITY_ENTRYPOINT: str +SECURITY_ENTRYPOINT_ANSI: str +SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION: int +SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2: int +SASL_OPTION_SEND_SIZE: int +SASL_OPTION_RECV_SIZE: int +SASL_OPTION_AUTHZ_STRING: int +SASL_OPTION_AUTHZ_PROCESSING: int +SEC_WINNT_AUTH_IDENTITY_ANSI: int +SEC_WINNT_AUTH_IDENTITY_UNICODE: int +SEC_WINNT_AUTH_IDENTITY_VERSION: int +SEC_WINNT_AUTH_IDENTITY_MARSHALLED: int +SEC_WINNT_AUTH_IDENTITY_ONLY: int +SECPKG_OPTIONS_TYPE_UNKNOWN: int +SECPKG_OPTIONS_TYPE_LSA: int +SECPKG_OPTIONS_TYPE_SSPI: int +SECPKG_OPTIONS_PERMANENT: int +SEC_E_INSUFFICIENT_MEMORY: int +SEC_E_INVALID_HANDLE: int +SEC_E_UNSUPPORTED_FUNCTION: int +SEC_E_TARGET_UNKNOWN: int +SEC_E_INTERNAL_ERROR: int +SEC_E_SECPKG_NOT_FOUND: int +SEC_E_NOT_OWNER: int +SEC_E_CANNOT_INSTALL: int +SEC_E_INVALID_TOKEN: int +SEC_E_CANNOT_PACK: int +SEC_E_QOP_NOT_SUPPORTED: int +SEC_E_NO_IMPERSONATION: int +SEC_E_LOGON_DENIED: int +SEC_E_UNKNOWN_CREDENTIALS: int +SEC_E_NO_CREDENTIALS: int +SEC_E_MESSAGE_ALTERED: int +SEC_E_OUT_OF_SEQUENCE: int +SEC_E_NO_AUTHENTICATING_AUTHORITY: int +SEC_I_CONTINUE_NEEDED: int +SEC_I_COMPLETE_NEEDED: int +SEC_I_COMPLETE_AND_CONTINUE: int +SEC_I_LOCAL_LOGON: int +SEC_E_BAD_PKGID: int +SEC_E_CONTEXT_EXPIRED: int +SEC_I_CONTEXT_EXPIRED: int +SEC_E_BUFFER_TOO_SMALL: int +SEC_I_RENEGOTIATE: int +SEC_E_WRONG_PRINCIPAL: int +SEC_I_NO_LSA_CONTEXT: int +SEC_E_TIME_SKEW: int +SEC_E_UNTRUSTED_ROOT: int +SEC_E_ILLEGAL_MESSAGE: int +SEC_E_CERT_UNKNOWN: int +SEC_E_CERT_EXPIRED: int +SEC_E_ENCRYPT_FAILURE: int +SEC_E_DECRYPT_FAILURE: int +SEC_E_ALGORITHM_MISMATCH: int +SEC_E_SECURITY_QOS_FAILED: int +SEC_E_UNFINISHED_CONTEXT_DELETED: int +SEC_E_NO_TGT_REPLY: int +SEC_E_NO_IP_ADDRESSES: int +SEC_E_WRONG_CREDENTIAL_HANDLE: int +SEC_E_CRYPTO_SYSTEM_INVALID: int +SEC_E_MAX_REFERRALS_EXCEEDED: int +SEC_E_MUST_BE_KDC: int +SEC_E_STRONG_CRYPTO_NOT_SUPPORTED: int +SEC_E_TOO_MANY_PRINCIPALS: int +SEC_E_NO_PA_DATA: int +SEC_E_PKINIT_NAME_MISMATCH: int +SEC_E_SMARTCARD_LOGON_REQUIRED: int +SEC_E_SHUTDOWN_IN_PROGRESS: int +SEC_E_KDC_INVALID_REQUEST: int +SEC_E_KDC_UNABLE_TO_REFER: int +SEC_E_KDC_UNKNOWN_ETYPE: int +SEC_E_UNSUPPORTED_PREAUTH: int +SEC_E_DELEGATION_REQUIRED: int +SEC_E_BAD_BINDINGS: int +SEC_E_MULTIPLE_ACCOUNTS: int +SEC_E_NO_KERB_KEY: int +ERROR_IPSEC_QM_POLICY_EXISTS: int +ERROR_IPSEC_QM_POLICY_NOT_FOUND: int +ERROR_IPSEC_QM_POLICY_IN_USE: int +ERROR_IPSEC_MM_POLICY_EXISTS: int +ERROR_IPSEC_MM_POLICY_NOT_FOUND: int +ERROR_IPSEC_MM_POLICY_IN_USE: int +ERROR_IPSEC_MM_FILTER_EXISTS: int +ERROR_IPSEC_MM_FILTER_NOT_FOUND: int +ERROR_IPSEC_TRANSPORT_FILTER_EXISTS: int +ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND: int +ERROR_IPSEC_MM_AUTH_EXISTS: int +ERROR_IPSEC_MM_AUTH_NOT_FOUND: int +ERROR_IPSEC_MM_AUTH_IN_USE: int +ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND: int +ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND: int +ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND: int +ERROR_IPSEC_TUNNEL_FILTER_EXISTS: int +ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND: int +ERROR_IPSEC_MM_FILTER_PENDING_DELETION: int +ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION: int +ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION: int +ERROR_IPSEC_MM_POLICY_PENDING_DELETION: int +ERROR_IPSEC_MM_AUTH_PENDING_DELETION: int +ERROR_IPSEC_QM_POLICY_PENDING_DELETION: int +WARNING_IPSEC_MM_POLICY_PRUNED: int +WARNING_IPSEC_QM_POLICY_PRUNED: int +ERROR_IPSEC_IKE_NEG_STATUS_BEGIN: int +ERROR_IPSEC_IKE_AUTH_FAIL: int +ERROR_IPSEC_IKE_ATTRIB_FAIL: int +ERROR_IPSEC_IKE_NEGOTIATION_PENDING: int +ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR: int +ERROR_IPSEC_IKE_TIMED_OUT: int +ERROR_IPSEC_IKE_NO_CERT: int +ERROR_IPSEC_IKE_SA_DELETED: int +ERROR_IPSEC_IKE_SA_REAPED: int +ERROR_IPSEC_IKE_MM_ACQUIRE_DROP: int +ERROR_IPSEC_IKE_QM_ACQUIRE_DROP: int +ERROR_IPSEC_IKE_QUEUE_DROP_MM: int +ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM: int +ERROR_IPSEC_IKE_DROP_NO_RESPONSE: int +ERROR_IPSEC_IKE_MM_DELAY_DROP: int +ERROR_IPSEC_IKE_QM_DELAY_DROP: int +ERROR_IPSEC_IKE_ERROR: int +ERROR_IPSEC_IKE_CRL_FAILED: int +ERROR_IPSEC_IKE_INVALID_KEY_USAGE: int +ERROR_IPSEC_IKE_INVALID_CERT_TYPE: int +ERROR_IPSEC_IKE_NO_PRIVATE_KEY: int +ERROR_IPSEC_IKE_DH_FAIL: int +ERROR_IPSEC_IKE_INVALID_HEADER: int +ERROR_IPSEC_IKE_NO_POLICY: int +ERROR_IPSEC_IKE_INVALID_SIGNATURE: int +ERROR_IPSEC_IKE_KERBEROS_ERROR: int +ERROR_IPSEC_IKE_NO_PUBLIC_KEY: int +ERROR_IPSEC_IKE_PROCESS_ERR: int +ERROR_IPSEC_IKE_PROCESS_ERR_SA: int +ERROR_IPSEC_IKE_PROCESS_ERR_PROP: int +ERROR_IPSEC_IKE_PROCESS_ERR_TRANS: int +ERROR_IPSEC_IKE_PROCESS_ERR_KE: int +ERROR_IPSEC_IKE_PROCESS_ERR_ID: int +ERROR_IPSEC_IKE_PROCESS_ERR_CERT: int +ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ: int +ERROR_IPSEC_IKE_PROCESS_ERR_HASH: int +ERROR_IPSEC_IKE_PROCESS_ERR_SIG: int +ERROR_IPSEC_IKE_PROCESS_ERR_NONCE: int +ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY: int +ERROR_IPSEC_IKE_PROCESS_ERR_DELETE: int +ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR: int +ERROR_IPSEC_IKE_INVALID_PAYLOAD: int +ERROR_IPSEC_IKE_LOAD_SOFT_SA: int +ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN: int +ERROR_IPSEC_IKE_INVALID_COOKIE: int +ERROR_IPSEC_IKE_NO_PEER_CERT: int +ERROR_IPSEC_IKE_PEER_CRL_FAILED: int +ERROR_IPSEC_IKE_POLICY_CHANGE: int +ERROR_IPSEC_IKE_NO_MM_POLICY: int +ERROR_IPSEC_IKE_NOTCBPRIV: int +ERROR_IPSEC_IKE_SECLOADFAIL: int +ERROR_IPSEC_IKE_FAILSSPINIT: int +ERROR_IPSEC_IKE_FAILQUERYSSP: int +ERROR_IPSEC_IKE_SRVACQFAIL: int +ERROR_IPSEC_IKE_SRVQUERYCRED: int +ERROR_IPSEC_IKE_GETSPIFAIL: int +ERROR_IPSEC_IKE_INVALID_FILTER: int +ERROR_IPSEC_IKE_OUT_OF_MEMORY: int +ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED: int +ERROR_IPSEC_IKE_INVALID_POLICY: int +ERROR_IPSEC_IKE_UNKNOWN_DOI: int +ERROR_IPSEC_IKE_INVALID_SITUATION: int +ERROR_IPSEC_IKE_DH_FAILURE: int +ERROR_IPSEC_IKE_INVALID_GROUP: int +ERROR_IPSEC_IKE_ENCRYPT: int +ERROR_IPSEC_IKE_DECRYPT: int +ERROR_IPSEC_IKE_POLICY_MATCH: int +ERROR_IPSEC_IKE_UNSUPPORTED_ID: int +ERROR_IPSEC_IKE_INVALID_HASH: int +ERROR_IPSEC_IKE_INVALID_HASH_ALG: int +ERROR_IPSEC_IKE_INVALID_HASH_SIZE: int +ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG: int +ERROR_IPSEC_IKE_INVALID_AUTH_ALG: int +ERROR_IPSEC_IKE_INVALID_SIG: int +ERROR_IPSEC_IKE_LOAD_FAILED: int +ERROR_IPSEC_IKE_RPC_DELETE: int +ERROR_IPSEC_IKE_BENIGN_REINIT: int +ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY: int +ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN: int +ERROR_IPSEC_IKE_MM_LIMIT: int +ERROR_IPSEC_IKE_NEGOTIATION_DISABLED: int +ERROR_IPSEC_IKE_NEG_STATUS_END: int +CRYPT_E_MSG_ERROR: int +CRYPT_E_UNKNOWN_ALGO: int +CRYPT_E_OID_FORMAT: int +CRYPT_E_INVALID_MSG_TYPE: int +CRYPT_E_UNEXPECTED_ENCODING: int +CRYPT_E_AUTH_ATTR_MISSING: int +CRYPT_E_HASH_VALUE: int +CRYPT_E_INVALID_INDEX: int +CRYPT_E_ALREADY_DECRYPTED: int +CRYPT_E_NOT_DECRYPTED: int +CRYPT_E_RECIPIENT_NOT_FOUND: int +CRYPT_E_CONTROL_TYPE: int +CRYPT_E_ISSUER_SERIALNUMBER: int +CRYPT_E_SIGNER_NOT_FOUND: int +CRYPT_E_ATTRIBUTES_MISSING: int +CRYPT_E_STREAM_MSG_NOT_READY: int +CRYPT_E_STREAM_INSUFFICIENT_DATA: int +CRYPT_I_NEW_PROTECTION_REQUIRED: int +CRYPT_E_BAD_LEN: int +CRYPT_E_BAD_ENCODE: int +CRYPT_E_FILE_ERROR: int +CRYPT_E_NOT_FOUND: int +CRYPT_E_EXISTS: int +CRYPT_E_NO_PROVIDER: int +CRYPT_E_SELF_SIGNED: int +CRYPT_E_DELETED_PREV: int +CRYPT_E_NO_MATCH: int +CRYPT_E_UNEXPECTED_MSG_TYPE: int +CRYPT_E_NO_KEY_PROPERTY: int +CRYPT_E_NO_DECRYPT_CERT: int +CRYPT_E_BAD_MSG: int +CRYPT_E_NO_SIGNER: int +CRYPT_E_PENDING_CLOSE: int +CRYPT_E_REVOKED: int +CRYPT_E_NO_REVOCATION_DLL: int +CRYPT_E_NO_REVOCATION_CHECK: int +CRYPT_E_REVOCATION_OFFLINE: int +CRYPT_E_NOT_IN_REVOCATION_DATABASE: int +CRYPT_E_INVALID_NUMERIC_STRING: int +CRYPT_E_INVALID_PRINTABLE_STRING: int +CRYPT_E_INVALID_IA5_STRING: int +CRYPT_E_INVALID_X500_STRING: int +CRYPT_E_NOT_CHAR_STRING: int +CRYPT_E_FILERESIZED: int +CRYPT_E_SECURITY_SETTINGS: int +CRYPT_E_NO_VERIFY_USAGE_DLL: int +CRYPT_E_NO_VERIFY_USAGE_CHECK: int +CRYPT_E_VERIFY_USAGE_OFFLINE: int +CRYPT_E_NOT_IN_CTL: int +CRYPT_E_NO_TRUSTED_SIGNER: int +CRYPT_E_MISSING_PUBKEY_PARA: int +CRYPT_E_OSS_ERROR: int +KerbDebugRequestMessage: int +KerbQueryTicketCacheMessage: int +KerbChangeMachinePasswordMessage: int +KerbVerifyPacMessage: int +KerbRetrieveTicketMessage: int +KerbUpdateAddressesMessage: int +KerbPurgeTicketCacheMessage: int +KerbChangePasswordMessage: int +KerbRetrieveEncodedTicketMessage: int +KerbDecryptDataMessage: int +KerbAddBindingCacheEntryMessage: int +KerbSetPasswordMessage: int +KerbSetPasswordExMessage: int +KerbVerifyCredentialsMessage: int +KerbQueryTicketCacheExMessage: int +KerbPurgeTicketCacheExMessage: int +KerbRefreshSmartcardCredentialsMessage: int +KerbAddExtraCredentialsMessage: int +KerbQuerySupplementalCredentialsMessage: int +MsV1_0Lm20ChallengeRequest: int +MsV1_0Lm20GetChallengeResponse: int +MsV1_0EnumerateUsers: int +MsV1_0GetUserInfo: int +MsV1_0ReLogonUsers: int +MsV1_0ChangePassword: int +MsV1_0ChangeCachedPassword: int +MsV1_0GenericPassthrough: int +MsV1_0CacheLogon: int +MsV1_0SubAuth: int +MsV1_0DeriveCredential: int +MsV1_0CacheLookup: int +MsV1_0SetProcessOption: int +SEC_E_OK: int +SECBUFFER_MECHLIST: int +SECBUFFER_MECHLIST_SIGNATURE: int +SECPKG_ATTR_ISSUER_LIST_EX: int +SEC_E_INCOMPLETE_CREDENTIALS: int +SEC_E_INCOMPLETE_MESSAGE: int +SEC_I_INCOMPLETE_CREDENTIALS: int diff --git a/stubs/pywin32/win32/lib/win2kras.pyi b/stubs/pywin32/win32/lib/win2kras.pyi new file mode 100644 index 0000000..b766e47 --- /dev/null +++ b/stubs/pywin32/win32/lib/win2kras.pyi @@ -0,0 +1,34 @@ +RASEAPF_Logon: int +RASEAPF_NonInteractive: int +RASEAPF_Preview: int + +def GetEapUserIdentity(*args, **kwargs): ... # incomplete + +RASCS_AllDevicesConnected: int +RASCS_AuthAck: int +RASCS_AuthCallback: int +RASCS_AuthChangePassword: int +RASCS_AuthLinkSpeed: int +RASCS_AuthNotify: int +RASCS_AuthProject: int +RASCS_AuthRetry: int +RASCS_Authenticate: int +RASCS_Authenticated: int +RASCS_CallbackComplete: int +RASCS_CallbackSetByCaller: int +RASCS_ConnectDevice: int +RASCS_Connected: int +RASCS_DeviceConnected: int +RASCS_Disconnected: int +RASCS_Interactive: int +RASCS_LogonNetwork: int +RASCS_OpenPort: int +RASCS_PasswordExpired: int +RASCS_PortOpened: int +RASCS_PrepareForCallback: int +RASCS_Projected: int +RASCS_ReAuthenticate: int +RASCS_RetryAuthentication: int +RASCS_StartAuthentication: int +RASCS_WaitForCallback: int +RASCS_WaitForModemReset: int diff --git a/stubs/pywin32/win32/lib/win32con.pyi b/stubs/pywin32/win32/lib/win32con.pyi new file mode 100644 index 0000000..b5f256e --- /dev/null +++ b/stubs/pywin32/win32/lib/win32con.pyi @@ -0,0 +1,4778 @@ +WINVER: int +WM_USER: int +PY_0U: int +OFN_READONLY: int +OFN_OVERWRITEPROMPT: int +OFN_HIDEREADONLY: int +OFN_NOCHANGEDIR: int +OFN_SHOWHELP: int +OFN_ENABLEHOOK: int +OFN_ENABLETEMPLATE: int +OFN_ENABLETEMPLATEHANDLE: int +OFN_NOVALIDATE: int +OFN_ALLOWMULTISELECT: int +OFN_EXTENSIONDIFFERENT: int +OFN_PATHMUSTEXIST: int +OFN_FILEMUSTEXIST: int +OFN_CREATEPROMPT: int +OFN_SHAREAWARE: int +OFN_NOREADONLYRETURN: int +OFN_NOTESTFILECREATE: int +OFN_NONETWORKBUTTON: int +OFN_NOLONGNAMES: int +OFN_EXPLORER: int +OFN_NODEREFERENCELINKS: int +OFN_LONGNAMES: int +OFN_ENABLEINCLUDENOTIFY: int +OFN_ENABLESIZING: int +OFN_DONTADDTORECENT: int +OFN_FORCESHOWHIDDEN: int +OFN_EX_NOPLACESBAR: int +OFN_SHAREFALLTHROUGH: int +OFN_SHARENOWARN: int +OFN_SHAREWARN: int +CDN_FIRST: int +CDN_LAST: int +CDN_INITDONE: int +CDN_SELCHANGE: int +CDN_FOLDERCHANGE: int +CDN_SHAREVIOLATION: int +CDN_HELP: int +CDN_FILEOK: int +CDN_TYPECHANGE: int +CDN_INCLUDEITEM: int +CDM_FIRST: int +CDM_LAST: int +CDM_GETSPEC: int +CDM_GETFILEPATH: int +CDM_GETFOLDERPATH: int +CDM_SETCONTROLTEXT: int +CDM_HIDECONTROL: int +CDM_SETDEFEXT: int +CC_RGBINIT: int +CC_FULLOPEN: int +CC_PREVENTFULLOPEN: int +CC_SHOWHELP: int +CC_ENABLEHOOK: int +CC_ENABLETEMPLATE: int +CC_ENABLETEMPLATEHANDLE: int +CC_SOLIDCOLOR: int +CC_ANYCOLOR: int +FR_DOWN: int +FR_WHOLEWORD: int +FR_MATCHCASE: int +FR_FINDNEXT: int +FR_REPLACE: int +FR_REPLACEALL: int +FR_DIALOGTERM: int +FR_SHOWHELP: int +FR_ENABLEHOOK: int +FR_ENABLETEMPLATE: int +FR_NOUPDOWN: int +FR_NOMATCHCASE: int +FR_NOWHOLEWORD: int +FR_ENABLETEMPLATEHANDLE: int +FR_HIDEUPDOWN: int +FR_HIDEMATCHCASE: int +FR_HIDEWHOLEWORD: int +CF_SCREENFONTS: int +CF_PRINTERFONTS: int +CF_BOTH: int +CF_SHOWHELP: int +CF_ENABLEHOOK: int +CF_ENABLETEMPLATE: int +CF_ENABLETEMPLATEHANDLE: int +CF_INITTOLOGFONTSTRUCT: int +CF_USESTYLE: int +CF_EFFECTS: int +CF_APPLY: int +CF_ANSIONLY: int +CF_SCRIPTSONLY: int +CF_NOVECTORFONTS: int +CF_NOOEMFONTS: int +CF_NOSIMULATIONS: int +CF_LIMITSIZE: int +CF_FIXEDPITCHONLY: int +CF_WYSIWYG: int +CF_FORCEFONTEXIST: int +CF_SCALABLEONLY: int +CF_TTONLY: int +CF_NOFACESEL: int +CF_NOSTYLESEL: int +CF_NOSIZESEL: int +CF_SELECTSCRIPT: int +CF_NOSCRIPTSEL: int +CF_NOVERTFONTS: int +SIMULATED_FONTTYPE: int +PRINTER_FONTTYPE: int +SCREEN_FONTTYPE: int +BOLD_FONTTYPE: int +ITALIC_FONTTYPE: int +REGULAR_FONTTYPE: int +OPENTYPE_FONTTYPE: int +TYPE1_FONTTYPE: int +DSIG_FONTTYPE: int +WM_CHOOSEFONT_GETLOGFONT: int +WM_CHOOSEFONT_SETLOGFONT: int +WM_CHOOSEFONT_SETFLAGS: int +LBSELCHSTRINGA: str +SHAREVISTRINGA: str +FILEOKSTRINGA: str +COLOROKSTRINGA: str +SETRGBSTRINGA: str +HELPMSGSTRINGA: str +FINDMSGSTRINGA: str +LBSELCHSTRING: str +SHAREVISTRING: str +FILEOKSTRING: str +COLOROKSTRING: str +SETRGBSTRING: str +HELPMSGSTRING: str +FINDMSGSTRING: str +CD_LBSELNOITEMS: int +CD_LBSELCHANGE: int +CD_LBSELSUB: int +CD_LBSELADD: int +PD_ALLPAGES: int +PD_SELECTION: int +PD_PAGENUMS: int +PD_NOSELECTION: int +PD_NOPAGENUMS: int +PD_COLLATE: int +PD_PRINTTOFILE: int +PD_PRINTSETUP: int +PD_NOWARNING: int +PD_RETURNDC: int +PD_RETURNIC: int +PD_RETURNDEFAULT: int +PD_SHOWHELP: int +PD_ENABLEPRINTHOOK: int +PD_ENABLESETUPHOOK: int +PD_ENABLEPRINTTEMPLATE: int +PD_ENABLESETUPTEMPLATE: int +PD_ENABLEPRINTTEMPLATEHANDLE: int +PD_ENABLESETUPTEMPLATEHANDLE: int +PD_USEDEVMODECOPIES: int +PD_DISABLEPRINTTOFILE: int +PD_HIDEPRINTTOFILE: int +PD_NONETWORKBUTTON: int +DN_DEFAULTPRN: int +WM_PSD_PAGESETUPDLG: int +WM_PSD_FULLPAGERECT: int +WM_PSD_MINMARGINRECT: int +WM_PSD_MARGINRECT: int +WM_PSD_GREEKTEXTRECT: int +WM_PSD_ENVSTAMPRECT: int +WM_PSD_YAFULLPAGERECT: int +PSD_DEFAULTMINMARGINS: int +PSD_INWININIINTLMEASURE: int +PSD_MINMARGINS: int +PSD_MARGINS: int +PSD_INTHOUSANDTHSOFINCHES: int +PSD_INHUNDREDTHSOFMILLIMETERS: int +PSD_DISABLEMARGINS: int +PSD_DISABLEPRINTER: int +PSD_NOWARNING: int +PSD_DISABLEORIENTATION: int +PSD_RETURNDEFAULT: int +PSD_DISABLEPAPER: int +PSD_SHOWHELP: int +PSD_ENABLEPAGESETUPHOOK: int +PSD_ENABLEPAGESETUPTEMPLATE: int +PSD_ENABLEPAGESETUPTEMPLATEHANDLE: int +PSD_ENABLEPAGEPAINTHOOK: int +PSD_DISABLEPAGEPAINTING: int +PSD_NONETWORKBUTTON: int +HKEY_CLASSES_ROOT: int +HKEY_CURRENT_USER: int +HKEY_LOCAL_MACHINE: int +HKEY_USERS: int +HKEY_PERFORMANCE_DATA: int +HKEY_CURRENT_CONFIG: int +HKEY_DYN_DATA: int +HKEY_PERFORMANCE_TEXT: int +HKEY_PERFORMANCE_NLSTEXT: int +HWND_BROADCAST: int +HWND_DESKTOP: int +HWND_TOP: int +HWND_BOTTOM: int +HWND_TOPMOST: int +HWND_NOTOPMOST: int +HWND_MESSAGE: int +SM_CXSCREEN: int +SM_CYSCREEN: int +SM_CXVSCROLL: int +SM_CYHSCROLL: int +SM_CYCAPTION: int +SM_CXBORDER: int +SM_CYBORDER: int +SM_CXDLGFRAME: int +SM_CYDLGFRAME: int +SM_CYVTHUMB: int +SM_CXHTHUMB: int +SM_CXICON: int +SM_CYICON: int +SM_CXCURSOR: int +SM_CYCURSOR: int +SM_CYMENU: int +SM_CXFULLSCREEN: int +SM_CYFULLSCREEN: int +SM_CYKANJIWINDOW: int +SM_MOUSEPRESENT: int +SM_CYVSCROLL: int +SM_CXHSCROLL: int +SM_DEBUG: int +SM_SWAPBUTTON: int +SM_RESERVED1: int +SM_RESERVED2: int +SM_RESERVED3: int +SM_RESERVED4: int +SM_CXMIN: int +SM_CYMIN: int +SM_CXSIZE: int +SM_CYSIZE: int +SM_CXFRAME: int +SM_CYFRAME: int +SM_CXMINTRACK: int +SM_CYMINTRACK: int +SM_CXDOUBLECLK: int +SM_CYDOUBLECLK: int +SM_CXICONSPACING: int +SM_CYICONSPACING: int +SM_MENUDROPALIGNMENT: int +SM_PENWINDOWS: int +SM_DBCSENABLED: int +SM_CMOUSEBUTTONS: int +SM_CXFIXEDFRAME: int +SM_CYFIXEDFRAME: int +SM_CXSIZEFRAME: int +SM_CYSIZEFRAME: int +SM_SECURE: int +SM_CXEDGE: int +SM_CYEDGE: int +SM_CXMINSPACING: int +SM_CYMINSPACING: int +SM_CXSMICON: int +SM_CYSMICON: int +SM_CYSMCAPTION: int +SM_CXSMSIZE: int +SM_CYSMSIZE: int +SM_CXMENUSIZE: int +SM_CYMENUSIZE: int +SM_ARRANGE: int +SM_CXMINIMIZED: int +SM_CYMINIMIZED: int +SM_CXMAXTRACK: int +SM_CYMAXTRACK: int +SM_CXMAXIMIZED: int +SM_CYMAXIMIZED: int +SM_NETWORK: int +SM_CLEANBOOT: int +SM_CXDRAG: int +SM_CYDRAG: int +SM_SHOWSOUNDS: int +SM_CXMENUCHECK: int +SM_CYMENUCHECK: int +SM_SLOWMACHINE: int +SM_MIDEASTENABLED: int +SM_MOUSEWHEELPRESENT: int +SM_XVIRTUALSCREEN: int +SM_YVIRTUALSCREEN: int +SM_CXVIRTUALSCREEN: int +SM_CYVIRTUALSCREEN: int +SM_CMONITORS: int +SM_SAMEDISPLAYFORMAT: int +SM_CMETRICS: int +MNC_IGNORE: int +MNC_CLOSE: int +MNC_EXECUTE: int +MNC_SELECT: int +MNS_NOCHECK: int +MNS_MODELESS: int +MNS_DRAGDROP: int +MNS_AUTODISMISS: int +MNS_NOTIFYBYPOS: int +MNS_CHECKORBMP: int +MIM_MAXHEIGHT: int +MIM_BACKGROUND: int +MIM_HELPID: int +MIM_MENUDATA: int +MIM_STYLE: int +MIM_APPLYTOSUBMENUS: int +MND_CONTINUE: int +MND_ENDMENU: int +MNGOF_GAP: int +MNGO_NOINTERFACE: int +MNGO_NOERROR: int +MIIM_STATE: int +MIIM_ID: int +MIIM_SUBMENU: int +MIIM_CHECKMARKS: int +MIIM_TYPE: int +MIIM_DATA: int +MIIM_STRING: int +MIIM_BITMAP: int +MIIM_FTYPE: int +HBMMENU_CALLBACK: int +HBMMENU_SYSTEM: int +HBMMENU_MBAR_RESTORE: int +HBMMENU_MBAR_MINIMIZE: int +HBMMENU_MBAR_CLOSE: int +HBMMENU_MBAR_CLOSE_D: int +HBMMENU_MBAR_MINIMIZE_D: int +HBMMENU_POPUP_CLOSE: int +HBMMENU_POPUP_RESTORE: int +HBMMENU_POPUP_MAXIMIZE: int +HBMMENU_POPUP_MINIMIZE: int +GMDI_USEDISABLED: int +GMDI_GOINTOPOPUPS: int +TPM_LEFTBUTTON: int +TPM_RIGHTBUTTON: int +TPM_LEFTALIGN: int +TPM_CENTERALIGN: int +TPM_RIGHTALIGN: int +TPM_TOPALIGN: int +TPM_VCENTERALIGN: int +TPM_BOTTOMALIGN: int +TPM_HORIZONTAL: int +TPM_VERTICAL: int +TPM_NONOTIFY: int +TPM_RETURNCMD: int +TPM_RECURSE: int +DOF_EXECUTABLE: int +DOF_DOCUMENT: int +DOF_DIRECTORY: int +DOF_MULTIPLE: int +DOF_PROGMAN: int +DOF_SHELLDATA: int +DO_DROPFILE: int +DO_PRINTFILE: int +DT_TOP: int +DT_LEFT: int +DT_CENTER: int +DT_RIGHT: int +DT_VCENTER: int +DT_BOTTOM: int +DT_WORDBREAK: int +DT_SINGLELINE: int +DT_EXPANDTABS: int +DT_TABSTOP: int +DT_NOCLIP: int +DT_EXTERNALLEADING: int +DT_CALCRECT: int +DT_NOPREFIX: int +DT_INTERNAL: int +DT_EDITCONTROL: int +DT_PATH_ELLIPSIS: int +DT_END_ELLIPSIS: int +DT_MODIFYSTRING: int +DT_RTLREADING: int +DT_WORD_ELLIPSIS: int +DST_COMPLEX: int +DST_TEXT: int +DST_PREFIXTEXT: int +DST_ICON: int +DST_BITMAP: int +DSS_NORMAL: int +DSS_UNION: int +DSS_DISABLED: int +DSS_MONO: int +DSS_RIGHT: int +DCX_WINDOW: int +DCX_CACHE: int +DCX_NORESETATTRS: int +DCX_CLIPCHILDREN: int +DCX_CLIPSIBLINGS: int +DCX_PARENTCLIP: int +DCX_EXCLUDERGN: int +DCX_INTERSECTRGN: int +DCX_EXCLUDEUPDATE: int +DCX_INTERSECTUPDATE: int +DCX_LOCKWINDOWUPDATE: int +DCX_VALIDATE: int +CUDR_NORMAL: int +CUDR_NOSNAPTOGRID: int +CUDR_NORESOLVEPOSITIONS: int +CUDR_NOCLOSEGAPS: int +CUDR_NEGATIVECOORDS: int +CUDR_NOPRIMARY: int +RDW_INVALIDATE: int +RDW_INTERNALPAINT: int +RDW_ERASE: int +RDW_VALIDATE: int +RDW_NOINTERNALPAINT: int +RDW_NOERASE: int +RDW_NOCHILDREN: int +RDW_ALLCHILDREN: int +RDW_UPDATENOW: int +RDW_ERASENOW: int +RDW_FRAME: int +RDW_NOFRAME: int +SW_SCROLLCHILDREN: int +SW_INVALIDATE: int +SW_ERASE: int +SW_SMOOTHSCROLL: int +ESB_ENABLE_BOTH: int +ESB_DISABLE_BOTH: int +ESB_DISABLE_LEFT: int +ESB_DISABLE_RIGHT: int +ESB_DISABLE_UP: int +ESB_DISABLE_DOWN: int +ESB_DISABLE_LTUP: int +ESB_DISABLE_RTDN: int +HELPINFO_WINDOW: int +HELPINFO_MENUITEM: int +MB_OK: int +MB_OKCANCEL: int +MB_ABORTRETRYIGNORE: int +MB_YESNOCANCEL: int +MB_YESNO: int +MB_RETRYCANCEL: int +MB_ICONHAND: int +MB_ICONQUESTION: int +MB_ICONEXCLAMATION: int +MB_ICONASTERISK: int +MB_ICONWARNING: int +MB_ICONERROR: int +MB_ICONINFORMATION: int +MB_ICONSTOP: int +MB_DEFBUTTON1: int +MB_DEFBUTTON2: int +MB_DEFBUTTON3: int +MB_DEFBUTTON4: int +MB_APPLMODAL: int +MB_SYSTEMMODAL: int +MB_TASKMODAL: int +MB_HELP: int +MB_NOFOCUS: int +MB_SETFOREGROUND: int +MB_DEFAULT_DESKTOP_ONLY: int +MB_TOPMOST: int +MB_RIGHT: int +MB_RTLREADING: int +MB_SERVICE_NOTIFICATION: int +MB_TYPEMASK: int +MB_USERICON: int +MB_ICONMASK: int +MB_DEFMASK: int +MB_MODEMASK: int +MB_MISCMASK: int +CWP_ALL: int +CWP_SKIPINVISIBLE: int +CWP_SKIPDISABLED: int +CWP_SKIPTRANSPARENT: int +CTLCOLOR_MSGBOX: int +CTLCOLOR_EDIT: int +CTLCOLOR_BTN: int +CTLCOLOR_DLG: int +CTLCOLOR_SCROLLBAR: int +CTLCOLOR_STATIC: int +CTLCOLOR_MAX: int +COLOR_SCROLLBAR: int +COLOR_BACKGROUND: int +COLOR_ACTIVECAPTION: int +COLOR_INACTIVECAPTION: int +COLOR_MENU: int +COLOR_WINDOW: int +COLOR_WINDOWFRAME: int +COLOR_MENUTEXT: int +COLOR_WINDOWTEXT: int +COLOR_CAPTIONTEXT: int +COLOR_ACTIVEBORDER: int +COLOR_INACTIVEBORDER: int +COLOR_APPWORKSPACE: int +COLOR_HIGHLIGHT: int +COLOR_HIGHLIGHTTEXT: int +COLOR_BTNFACE: int +COLOR_BTNSHADOW: int +COLOR_GRAYTEXT: int +COLOR_BTNTEXT: int +COLOR_INACTIVECAPTIONTEXT: int +COLOR_BTNHIGHLIGHT: int +COLOR_3DDKSHADOW: int +COLOR_3DLIGHT: int +COLOR_INFOTEXT: int +COLOR_INFOBK: int +COLOR_HOTLIGHT: int +COLOR_GRADIENTACTIVECAPTION: int +COLOR_GRADIENTINACTIVECAPTION: int +COLOR_DESKTOP: int +COLOR_3DFACE: int +COLOR_3DSHADOW: int +COLOR_3DHIGHLIGHT: int +COLOR_3DHILIGHT: int +COLOR_BTNHILIGHT: int +GW_HWNDFIRST: int +GW_HWNDLAST: int +GW_HWNDNEXT: int +GW_HWNDPREV: int +GW_OWNER: int +GW_CHILD: int +GW_ENABLEDPOPUP: int +GW_MAX: int +MF_INSERT: int +MF_CHANGE: int +MF_APPEND: int +MF_DELETE: int +MF_REMOVE: int +MF_BYCOMMAND: int +MF_BYPOSITION: int +MF_SEPARATOR: int +MF_ENABLED: int +MF_GRAYED: int +MF_DISABLED: int +MF_UNCHECKED: int +MF_CHECKED: int +MF_USECHECKBITMAPS: int +MF_STRING: int +MF_BITMAP: int +MF_OWNERDRAW: int +MF_POPUP: int +MF_MENUBARBREAK: int +MF_MENUBREAK: int +MF_UNHILITE: int +MF_HILITE: int +MF_DEFAULT: int +MF_SYSMENU: int +MF_HELP: int +MF_RIGHTJUSTIFY: int +MF_MOUSESELECT: int +MF_END: int +MFT_STRING: int +MFT_BITMAP: int +MFT_MENUBARBREAK: int +MFT_MENUBREAK: int +MFT_OWNERDRAW: int +MFT_RADIOCHECK: int +MFT_SEPARATOR: int +MFT_RIGHTORDER: int +MFT_RIGHTJUSTIFY: int +MFS_GRAYED: int +MFS_DISABLED: int +MFS_CHECKED: int +MFS_HILITE: int +MFS_ENABLED: int +MFS_UNCHECKED: int +MFS_UNHILITE: int +MFS_DEFAULT: int +MFS_MASK: int +MFS_HOTTRACKDRAWN: int +MFS_CACHEDBMP: int +MFS_BOTTOMGAPDROP: int +MFS_TOPGAPDROP: int +MFS_GAPDROP: int +SC_SIZE: int +SC_MOVE: int +SC_MINIMIZE: int +SC_MAXIMIZE: int +SC_NEXTWINDOW: int +SC_PREVWINDOW: int +SC_CLOSE: int +SC_VSCROLL: int +SC_HSCROLL: int +SC_MOUSEMENU: int +SC_KEYMENU: int +SC_ARRANGE: int +SC_RESTORE: int +SC_SCREENSAVE: int +SC_HOTKEY: int +SC_DEFAULT: int +SC_MONITORPOWER: int +SC_CONTEXTHELP: int +SC_SEPARATOR: int +SC_ICON: int +SC_ZOOM: int +IDC_ARROW: int +IDC_IBEAM: int +IDC_WAIT: int +IDC_CROSS: int +IDC_UPARROW: int +IDC_SIZE: int +IDC_ICON: int +IDC_SIZENWSE: int +IDC_SIZENESW: int +IDC_SIZEWE: int +IDC_SIZENS: int +IDC_SIZEALL: int +IDC_NO: int +IDC_HAND: int +IDC_APPSTARTING: int +IDC_HELP: int +IMAGE_BITMAP: int +IMAGE_ICON: int +IMAGE_CURSOR: int +IMAGE_ENHMETAFILE: int +LR_DEFAULTCOLOR: int +LR_MONOCHROME: int +LR_COLOR: int +LR_COPYRETURNORG: int +LR_COPYDELETEORG: int +LR_LOADFROMFILE: int +LR_LOADTRANSPARENT: int +LR_DEFAULTSIZE: int +LR_LOADREALSIZE: int +LR_LOADMAP3DCOLORS: int +LR_CREATEDIBSECTION: int +LR_COPYFROMRESOURCE: int +LR_SHARED: int +DI_MASK: int +DI_IMAGE: int +DI_NORMAL: int +DI_COMPAT: int +DI_DEFAULTSIZE: int +RES_ICON: int +RES_CURSOR: int +OBM_CLOSE: int +OBM_UPARROW: int +OBM_DNARROW: int +OBM_RGARROW: int +OBM_LFARROW: int +OBM_REDUCE: int +OBM_ZOOM: int +OBM_RESTORE: int +OBM_REDUCED: int +OBM_ZOOMD: int +OBM_RESTORED: int +OBM_UPARROWD: int +OBM_DNARROWD: int +OBM_RGARROWD: int +OBM_LFARROWD: int +OBM_MNARROW: int +OBM_COMBO: int +OBM_UPARROWI: int +OBM_DNARROWI: int +OBM_RGARROWI: int +OBM_LFARROWI: int +OBM_OLD_CLOSE: int +OBM_SIZE: int +OBM_OLD_UPARROW: int +OBM_OLD_DNARROW: int +OBM_OLD_RGARROW: int +OBM_OLD_LFARROW: int +OBM_BTSIZE: int +OBM_CHECK: int +OBM_CHECKBOXES: int +OBM_BTNCORNERS: int +OBM_OLD_REDUCE: int +OBM_OLD_ZOOM: int +OBM_OLD_RESTORE: int +OCR_NORMAL: int +OCR_IBEAM: int +OCR_WAIT: int +OCR_CROSS: int +OCR_UP: int +OCR_SIZE: int +OCR_ICON: int +OCR_SIZENWSE: int +OCR_SIZENESW: int +OCR_SIZEWE: int +OCR_SIZENS: int +OCR_SIZEALL: int +OCR_ICOCUR: int +OCR_NO: int +OCR_HAND: int +OCR_APPSTARTING: int +OIC_SAMPLE: int +OIC_HAND: int +OIC_QUES: int +OIC_BANG: int +OIC_NOTE: int +OIC_WINLOGO: int +OIC_WARNING: int +OIC_ERROR: int +OIC_INFORMATION: int +ORD_LANGDRIVER: int +IDI_APPLICATION: int +IDI_HAND: int +IDI_QUESTION: int +IDI_EXCLAMATION: int +IDI_ASTERISK: int +IDI_WINLOGO: int +IDI_WARNING: int +IDI_ERROR: int +IDI_INFORMATION: int +IDOK: int +IDCANCEL: int +IDABORT: int +IDRETRY: int +IDIGNORE: int +IDYES: int +IDNO: int +IDCLOSE: int +IDHELP: int +ES_LEFT: int +ES_CENTER: int +ES_RIGHT: int +ES_MULTILINE: int +ES_UPPERCASE: int +ES_LOWERCASE: int +ES_PASSWORD: int +ES_AUTOVSCROLL: int +ES_AUTOHSCROLL: int +ES_NOHIDESEL: int +ES_OEMCONVERT: int +ES_READONLY: int +ES_WANTRETURN: int +ES_NUMBER: int +EN_SETFOCUS: int +EN_KILLFOCUS: int +EN_CHANGE: int +EN_UPDATE: int +EN_ERRSPACE: int +EN_MAXTEXT: int +EN_HSCROLL: int +EN_VSCROLL: int +EC_LEFTMARGIN: int +EC_RIGHTMARGIN: int +EC_USEFONTINFO: int +EMSIS_COMPOSITIONSTRING: int +EIMES_GETCOMPSTRATONCE: int +EIMES_CANCELCOMPSTRINFOCUS: int +EIMES_COMPLETECOMPSTRKILLFOCUS: int +EM_GETSEL: int +EM_SETSEL: int +EM_GETRECT: int +EM_SETRECT: int +EM_SETRECTNP: int +EM_SCROLL: int +EM_LINESCROLL: int +EM_SCROLLCARET: int +EM_GETMODIFY: int +EM_SETMODIFY: int +EM_GETLINECOUNT: int +EM_LINEINDEX: int +EM_SETHANDLE: int +EM_GETHANDLE: int +EM_GETTHUMB: int +EM_LINELENGTH: int +EM_REPLACESEL: int +EM_GETLINE: int +EM_LIMITTEXT: int +EM_CANUNDO: int +EM_UNDO: int +EM_FMTLINES: int +EM_LINEFROMCHAR: int +EM_SETTABSTOPS: int +EM_SETPASSWORDCHAR: int +EM_EMPTYUNDOBUFFER: int +EM_GETFIRSTVISIBLELINE: int +EM_SETREADONLY: int +EM_SETWORDBREAKPROC: int +EM_GETWORDBREAKPROC: int +EM_GETPASSWORDCHAR: int +EM_SETMARGINS: int +EM_GETMARGINS: int +EM_SETLIMITTEXT: int +EM_GETLIMITTEXT: int +EM_POSFROMCHAR: int +EM_CHARFROMPOS: int +EM_SETIMESTATUS: int +EM_GETIMESTATUS: int +WB_LEFT: int +WB_RIGHT: int +WB_ISDELIMITER: int +BS_PUSHBUTTON: int +BS_DEFPUSHBUTTON: int +BS_CHECKBOX: int +BS_AUTOCHECKBOX: int +BS_RADIOBUTTON: int +BS_3STATE: int +BS_AUTO3STATE: int +BS_GROUPBOX: int +BS_USERBUTTON: int +BS_AUTORADIOBUTTON: int +BS_OWNERDRAW: int +BS_LEFTTEXT: int +BS_TEXT: int +BS_ICON: int +BS_BITMAP: int +BS_LEFT: int +BS_RIGHT: int +BS_CENTER: int +BS_TOP: int +BS_BOTTOM: int +BS_VCENTER: int +BS_PUSHLIKE: int +BS_MULTILINE: int +BS_NOTIFY: int +BS_FLAT: int +BS_RIGHTBUTTON: int +BN_CLICKED: int +BN_PAINT: int +BN_HILITE: int +BN_UNHILITE: int +BN_DISABLE: int +BN_DOUBLECLICKED: int +BN_PUSHED: int +BN_UNPUSHED: int +BN_DBLCLK: int +BN_SETFOCUS: int +BN_KILLFOCUS: int +BM_GETCHECK: int +BM_SETCHECK: int +BM_GETSTATE: int +BM_SETSTATE: int +BM_SETSTYLE: int +BM_CLICK: int +BM_GETIMAGE: int +BM_SETIMAGE: int +BST_UNCHECKED: int +BST_CHECKED: int +BST_INDETERMINATE: int +BST_PUSHED: int +BST_FOCUS: int +SS_LEFT: int +SS_CENTER: int +SS_RIGHT: int +SS_ICON: int +SS_BLACKRECT: int +SS_GRAYRECT: int +SS_WHITERECT: int +SS_BLACKFRAME: int +SS_GRAYFRAME: int +SS_WHITEFRAME: int +SS_USERITEM: int +SS_SIMPLE: int +SS_LEFTNOWORDWRAP: int +SS_BITMAP: int +SS_OWNERDRAW: int +SS_ENHMETAFILE: int +SS_ETCHEDHORZ: int +SS_ETCHEDVERT: int +SS_ETCHEDFRAME: int +SS_TYPEMASK: int +SS_NOPREFIX: int +SS_NOTIFY: int +SS_CENTERIMAGE: int +SS_RIGHTJUST: int +SS_REALSIZEIMAGE: int +SS_SUNKEN: int +SS_ENDELLIPSIS: int +SS_PATHELLIPSIS: int +SS_WORDELLIPSIS: int +SS_ELLIPSISMASK: int +STM_SETICON: int +STM_GETICON: int +STM_SETIMAGE: int +STM_GETIMAGE: int +STN_CLICKED: int +STN_DBLCLK: int +STN_ENABLE: int +STN_DISABLE: int +STM_MSGMAX: int +DWL_MSGRESULT: int +DWL_DLGPROC: int +DWL_USER: int +DDL_READWRITE: int +DDL_READONLY: int +DDL_HIDDEN: int +DDL_SYSTEM: int +DDL_DIRECTORY: int +DDL_ARCHIVE: int +DDL_POSTMSGS: int +DDL_DRIVES: int +DDL_EXCLUSIVE: int +RT_CURSOR: int +RT_BITMAP: int +RT_ICON: int +RT_MENU: int +RT_DIALOG: int +RT_STRING: int +RT_FONTDIR: int +RT_FONT: int +RT_ACCELERATOR: int +RT_RCDATA: int +RT_MESSAGETABLE: int +DIFFERENCE: int +RT_GROUP_CURSOR: int +RT_GROUP_ICON: int +RT_VERSION: int +RT_DLGINCLUDE: int +RT_PLUGPLAY: int +RT_VXD: int +RT_ANICURSOR: int +RT_ANIICON: int +RT_HTML: int +SB_HORZ: int +SB_VERT: int +SB_CTL: int +SB_BOTH: int +SB_LINEUP: int +SB_LINELEFT: int +SB_LINEDOWN: int +SB_LINERIGHT: int +SB_PAGEUP: int +SB_PAGELEFT: int +SB_PAGEDOWN: int +SB_PAGERIGHT: int +SB_THUMBPOSITION: int +SB_THUMBTRACK: int +SB_TOP: int +SB_LEFT: int +SB_BOTTOM: int +SB_RIGHT: int +SB_ENDSCROLL: int +SW_HIDE: int +SW_SHOWNORMAL: int +SW_NORMAL: int +SW_SHOWMINIMIZED: int +SW_SHOWMAXIMIZED: int +SW_MAXIMIZE: int +SW_SHOWNOACTIVATE: int +SW_SHOW: int +SW_MINIMIZE: int +SW_SHOWMINNOACTIVE: int +SW_SHOWNA: int +SW_RESTORE: int +SW_SHOWDEFAULT: int +SW_FORCEMINIMIZE: int +SW_MAX: int +HIDE_WINDOW: int +SHOW_OPENWINDOW: int +SHOW_ICONWINDOW: int +SHOW_FULLSCREEN: int +SHOW_OPENNOACTIVATE: int +SW_PARENTCLOSING: int +SW_OTHERZOOM: int +SW_PARENTOPENING: int +SW_OTHERUNZOOM: int +AW_HOR_POSITIVE: int +AW_HOR_NEGATIVE: int +AW_VER_POSITIVE: int +AW_VER_NEGATIVE: int +AW_CENTER: int +AW_HIDE: int +AW_ACTIVATE: int +AW_SLIDE: int +AW_BLEND: int +KF_EXTENDED: int +KF_DLGMODE: int +KF_MENUMODE: int +KF_ALTDOWN: int +KF_REPEAT: int +KF_UP: int +VK_LBUTTON: int +VK_RBUTTON: int +VK_CANCEL: int +VK_MBUTTON: int +VK_BACK: int +VK_TAB: int +VK_CLEAR: int +VK_RETURN: int +VK_SHIFT: int +VK_CONTROL: int +VK_MENU: int +VK_PAUSE: int +VK_CAPITAL: int +VK_KANA: int +VK_HANGEUL: int +VK_HANGUL: int +VK_JUNJA: int +VK_FINAL: int +VK_HANJA: int +VK_KANJI: int +VK_ESCAPE: int +VK_CONVERT: int +VK_NONCONVERT: int +VK_ACCEPT: int +VK_MODECHANGE: int +VK_SPACE: int +VK_PRIOR: int +VK_NEXT: int +VK_END: int +VK_HOME: int +VK_LEFT: int +VK_UP: int +VK_RIGHT: int +VK_DOWN: int +VK_SELECT: int +VK_PRINT: int +VK_EXECUTE: int +VK_SNAPSHOT: int +VK_INSERT: int +VK_DELETE: int +VK_HELP: int +VK_LWIN: int +VK_RWIN: int +VK_APPS: int +VK_NUMPAD0: int +VK_NUMPAD1: int +VK_NUMPAD2: int +VK_NUMPAD3: int +VK_NUMPAD4: int +VK_NUMPAD5: int +VK_NUMPAD6: int +VK_NUMPAD7: int +VK_NUMPAD8: int +VK_NUMPAD9: int +VK_MULTIPLY: int +VK_ADD: int +VK_SEPARATOR: int +VK_SUBTRACT: int +VK_DECIMAL: int +VK_DIVIDE: int +VK_F1: int +VK_F2: int +VK_F3: int +VK_F4: int +VK_F5: int +VK_F6: int +VK_F7: int +VK_F8: int +VK_F9: int +VK_F10: int +VK_F11: int +VK_F12: int +VK_F13: int +VK_F14: int +VK_F15: int +VK_F16: int +VK_F17: int +VK_F18: int +VK_F19: int +VK_F20: int +VK_F21: int +VK_F22: int +VK_F23: int +VK_F24: int +VK_NUMLOCK: int +VK_SCROLL: int +VK_LSHIFT: int +VK_RSHIFT: int +VK_LCONTROL: int +VK_RCONTROL: int +VK_LMENU: int +VK_RMENU: int +VK_PROCESSKEY: int +VK_ATTN: int +VK_CRSEL: int +VK_EXSEL: int +VK_EREOF: int +VK_PLAY: int +VK_ZOOM: int +VK_NONAME: int +VK_PA1: int +VK_OEM_CLEAR: int +MOUSEEVENTF_XDOWN: int +MOUSEEVENTF_XUP: int +MOUSEEVENTF_WHEEL: int +VK_XBUTTON1: int +VK_XBUTTON2: int +VK_VOLUME_MUTE: int +VK_VOLUME_DOWN: int +VK_VOLUME_UP: int +VK_MEDIA_NEXT_TRACK: int +VK_MEDIA_PREV_TRACK: int +VK_MEDIA_PLAY_PAUSE: int +VK_BROWSER_BACK: int +VK_BROWSER_FORWARD: int +WH_MIN: int +WH_MSGFILTER: int +WH_JOURNALRECORD: int +WH_JOURNALPLAYBACK: int +WH_KEYBOARD: int +WH_GETMESSAGE: int +WH_CALLWNDPROC: int +WH_CBT: int +WH_SYSMSGFILTER: int +WH_MOUSE: int +WH_HARDWARE: int +WH_DEBUG: int +WH_SHELL: int +WH_FOREGROUNDIDLE: int +WH_CALLWNDPROCRET: int +WH_KEYBOARD_LL: int +WH_MOUSE_LL: int +WH_MAX: int +WH_MINHOOK: int +WH_MAXHOOK: int +HC_ACTION: int +HC_GETNEXT: int +HC_SKIP: int +HC_NOREMOVE: int +HC_NOREM: int +HC_SYSMODALON: int +HC_SYSMODALOFF: int +HCBT_MOVESIZE: int +HCBT_MINMAX: int +HCBT_QS: int +HCBT_CREATEWND: int +HCBT_DESTROYWND: int +HCBT_ACTIVATE: int +HCBT_CLICKSKIPPED: int +HCBT_KEYSKIPPED: int +HCBT_SYSCOMMAND: int +HCBT_SETFOCUS: int +MSGF_DIALOGBOX: int +MSGF_MESSAGEBOX: int +MSGF_MENU: int +MSGF_SCROLLBAR: int +MSGF_NEXTWINDOW: int +MSGF_MAX: int +MSGF_USER: int +HSHELL_WINDOWCREATED: int +HSHELL_WINDOWDESTROYED: int +HSHELL_ACTIVATESHELLWINDOW: int +HSHELL_WINDOWACTIVATED: int +HSHELL_GETMINRECT: int +HSHELL_REDRAW: int +HSHELL_TASKMAN: int +HSHELL_LANGUAGE: int +HSHELL_ACCESSIBILITYSTATE: int +ACCESS_STICKYKEYS: int +ACCESS_FILTERKEYS: int +ACCESS_MOUSEKEYS: int +LLKHF_EXTENDED: int +LLKHF_INJECTED: int +LLKHF_ALTDOWN: int +LLKHF_UP: int +LLKHF_LOWER_IL_INJECTED: int +LLMHF_INJECTED: int +LLMHF_LOWER_IL_INJECTED: int +HKL_PREV: int +HKL_NEXT: int +KLF_ACTIVATE: int +KLF_SUBSTITUTE_OK: int +KLF_UNLOADPREVIOUS: int +KLF_REORDER: int +KLF_REPLACELANG: int +KLF_NOTELLSHELL: int +KLF_SETFORPROCESS: int +KL_NAMELENGTH: int +DESKTOP_READOBJECTS: int +DESKTOP_CREATEWINDOW: int +DESKTOP_CREATEMENU: int +DESKTOP_HOOKCONTROL: int +DESKTOP_JOURNALRECORD: int +DESKTOP_JOURNALPLAYBACK: int +DESKTOP_ENUMERATE: int +DESKTOP_WRITEOBJECTS: int +DESKTOP_SWITCHDESKTOP: int +DF_ALLOWOTHERACCOUNTHOOK: int +WINSTA_ENUMDESKTOPS: int +WINSTA_READATTRIBUTES: int +WINSTA_ACCESSCLIPBOARD: int +WINSTA_CREATEDESKTOP: int +WINSTA_WRITEATTRIBUTES: int +WINSTA_ACCESSGLOBALATOMS: int +WINSTA_EXITWINDOWS: int +WINSTA_ENUMERATE: int +WINSTA_READSCREEN: int +WSF_VISIBLE: int +UOI_FLAGS: int +UOI_NAME: int +UOI_TYPE: int +UOI_USER_SID: int +GWL_WNDPROC: int +GWL_HINSTANCE: int +GWL_HWNDPARENT: int +GWL_STYLE: int +GWL_EXSTYLE: int +GWL_USERDATA: int +GWL_ID: int +GCL_MENUNAME: int +GCL_HBRBACKGROUND: int +GCL_HCURSOR: int +GCL_HICON: int +GCL_HMODULE: int +GCL_CBWNDEXTRA: int +GCL_CBCLSEXTRA: int +GCL_WNDPROC: int +GCL_STYLE: int +GCW_ATOM: int +GCL_HICONSM: int +WM_NULL: int +WM_CREATE: int +WM_DESTROY: int +WM_MOVE: int +WM_SIZE: int +WM_ACTIVATE: int +WA_INACTIVE: int +WA_ACTIVE: int +WA_CLICKACTIVE: int +WM_SETFOCUS: int +WM_KILLFOCUS: int +WM_ENABLE: int +WM_SETREDRAW: int +WM_SETTEXT: int +WM_GETTEXT: int +WM_GETTEXTLENGTH: int +WM_PAINT: int +WM_CLOSE: int +WM_QUERYENDSESSION: int +WM_QUIT: int +WM_QUERYOPEN: int +WM_ERASEBKGND: int +WM_SYSCOLORCHANGE: int +WM_ENDSESSION: int +WM_SHOWWINDOW: int +WM_WININICHANGE: int +WM_SETTINGCHANGE: int +WM_DEVMODECHANGE: int +WM_ACTIVATEAPP: int +WM_FONTCHANGE: int +WM_TIMECHANGE: int +WM_CANCELMODE: int +WM_SETCURSOR: int +WM_MOUSEACTIVATE: int +WM_CHILDACTIVATE: int +WM_QUEUESYNC: int +WM_GETMINMAXINFO: int +WM_PAINTICON: int +WM_ICONERASEBKGND: int +WM_NEXTDLGCTL: int +WM_SPOOLERSTATUS: int +WM_DRAWITEM: int +WM_MEASUREITEM: int +WM_DELETEITEM: int +WM_VKEYTOITEM: int +WM_CHARTOITEM: int +WM_SETFONT: int +WM_GETFONT: int +WM_SETHOTKEY: int +WM_GETHOTKEY: int +WM_QUERYDRAGICON: int +WM_COMPAREITEM: int +WM_GETOBJECT: int +WM_COMPACTING: int +WM_COMMNOTIFY: int +WM_WINDOWPOSCHANGING: int +WM_WINDOWPOSCHANGED: int +WM_POWER: int +PWR_OK: int +PWR_FAIL: int +PWR_SUSPENDREQUEST: int +PWR_SUSPENDRESUME: int +PWR_CRITICALRESUME: int +WM_COPYDATA: int +WM_CANCELJOURNAL: int +WM_NOTIFY: int +WM_INPUTLANGCHANGEREQUEST: int +WM_INPUTLANGCHANGE: int +WM_TCARD: int +WM_HELP: int +WM_USERCHANGED: int +WM_NOTIFYFORMAT: int +NFR_ANSI: int +NFR_UNICODE: int +NF_QUERY: int +NF_REQUERY: int +WM_CONTEXTMENU: int +WM_STYLECHANGING: int +WM_STYLECHANGED: int +WM_DISPLAYCHANGE: int +WM_GETICON: int +WM_SETICON: int +WM_NCCREATE: int +WM_NCDESTROY: int +WM_NCCALCSIZE: int +WM_NCHITTEST: int +WM_NCPAINT: int +WM_NCACTIVATE: int +WM_GETDLGCODE: int +WM_SYNCPAINT: int +WM_NCMOUSEMOVE: int +WM_NCLBUTTONDOWN: int +WM_NCLBUTTONUP: int +WM_NCLBUTTONDBLCLK: int +WM_NCRBUTTONDOWN: int +WM_NCRBUTTONUP: int +WM_NCRBUTTONDBLCLK: int +WM_NCMBUTTONDOWN: int +WM_NCMBUTTONUP: int +WM_NCMBUTTONDBLCLK: int +WM_KEYFIRST: int +WM_KEYDOWN: int +WM_KEYUP: int +WM_CHAR: int +WM_DEADCHAR: int +WM_SYSKEYDOWN: int +WM_SYSKEYUP: int +WM_SYSCHAR: int +WM_SYSDEADCHAR: int +WM_KEYLAST: int +WM_IME_STARTCOMPOSITION: int +WM_IME_ENDCOMPOSITION: int +WM_IME_COMPOSITION: int +WM_IME_KEYLAST: int +WM_INITDIALOG: int +WM_COMMAND: int +WM_SYSCOMMAND: int +WM_TIMER: int +WM_HSCROLL: int +WM_VSCROLL: int +WM_INITMENU: int +WM_INITMENUPOPUP: int +WM_MENUSELECT: int +WM_MENUCHAR: int +WM_ENTERIDLE: int +WM_MENURBUTTONUP: int +WM_MENUDRAG: int +WM_MENUGETOBJECT: int +WM_UNINITMENUPOPUP: int +WM_MENUCOMMAND: int +WM_CTLCOLORMSGBOX: int +WM_CTLCOLOREDIT: int +WM_CTLCOLORBTN: int +WM_CTLCOLORDLG: int +WM_CTLCOLORSCROLLBAR: int +WM_CTLCOLORSTATIC: int +WM_MOUSEFIRST: int +WM_MOUSEMOVE: int +WM_LBUTTONDOWN: int +WM_LBUTTONUP: int +WM_LBUTTONDBLCLK: int +WM_RBUTTONDOWN: int +WM_RBUTTONUP: int +WM_RBUTTONDBLCLK: int +WM_MBUTTONDOWN: int +WM_MBUTTONUP: int +WM_MBUTTONDBLCLK: int +WM_MOUSEWHEEL: int +WM_MOUSELAST: int +WHEEL_DELTA: int +WHEEL_PAGESCROLL: int +WM_PARENTNOTIFY: int +MENULOOP_WINDOW: int +MENULOOP_POPUP: int +WM_ENTERMENULOOP: int +WM_EXITMENULOOP: int +WM_NEXTMENU: int +WM_SIZING: int +WM_CAPTURECHANGED: int +WM_MOVING: int +WM_POWERBROADCAST: int +PBT_APMQUERYSUSPEND: int +PBT_APMQUERYSTANDBY: int +PBT_APMQUERYSUSPENDFAILED: int +PBT_APMQUERYSTANDBYFAILED: int +PBT_APMSUSPEND: int +PBT_APMSTANDBY: int +PBT_APMRESUMECRITICAL: int +PBT_APMRESUMESUSPEND: int +PBT_APMRESUMESTANDBY: int +PBTF_APMRESUMEFROMFAILURE: int +PBT_APMBATTERYLOW: int +PBT_APMPOWERSTATUSCHANGE: int +PBT_APMOEMEVENT: int +PBT_APMRESUMEAUTOMATIC: int +WM_DEVICECHANGE: int +WM_MDICREATE: int +WM_MDIDESTROY: int +WM_MDIACTIVATE: int +WM_MDIRESTORE: int +WM_MDINEXT: int +WM_MDIMAXIMIZE: int +WM_MDITILE: int +WM_MDICASCADE: int +WM_MDIICONARRANGE: int +WM_MDIGETACTIVE: int +WM_MDISETMENU: int +WM_ENTERSIZEMOVE: int +WM_EXITSIZEMOVE: int +WM_DROPFILES: int +WM_MDIREFRESHMENU: int +WM_IME_SETCONTEXT: int +WM_IME_NOTIFY: int +WM_IME_CONTROL: int +WM_IME_COMPOSITIONFULL: int +WM_IME_SELECT: int +WM_IME_CHAR: int +WM_IME_REQUEST: int +WM_IME_KEYDOWN: int +WM_IME_KEYUP: int +WM_MOUSEHOVER: int +WM_MOUSELEAVE: int +WM_CUT: int +WM_COPY: int +WM_PASTE: int +WM_CLEAR: int +WM_UNDO: int +WM_RENDERFORMAT: int +WM_RENDERALLFORMATS: int +WM_DESTROYCLIPBOARD: int +WM_DRAWCLIPBOARD: int +WM_PAINTCLIPBOARD: int +WM_VSCROLLCLIPBOARD: int +WM_SIZECLIPBOARD: int +WM_ASKCBFORMATNAME: int +WM_CHANGECBCHAIN: int +WM_HSCROLLCLIPBOARD: int +WM_QUERYNEWPALETTE: int +WM_PALETTEISCHANGING: int +WM_PALETTECHANGED: int +WM_HOTKEY: int +WM_PRINT: int +WM_PRINTCLIENT: int +WM_HANDHELDFIRST: int +WM_HANDHELDLAST: int +WM_AFXFIRST: int +WM_AFXLAST: int +WM_PENWINFIRST: int +WM_PENWINLAST: int +WM_APP: int +WMSZ_LEFT: int +WMSZ_RIGHT: int +WMSZ_TOP: int +WMSZ_TOPLEFT: int +WMSZ_TOPRIGHT: int +WMSZ_BOTTOM: int +WMSZ_BOTTOMLEFT: int +WMSZ_BOTTOMRIGHT: int +HTERROR: int +HTTRANSPARENT: int +HTNOWHERE: int +HTCLIENT: int +HTCAPTION: int +HTSYSMENU: int +HTGROWBOX: int +HTSIZE: int +HTMENU: int +HTHSCROLL: int +HTVSCROLL: int +HTMINBUTTON: int +HTMAXBUTTON: int +HTLEFT: int +HTRIGHT: int +HTTOP: int +HTTOPLEFT: int +HTTOPRIGHT: int +HTBOTTOM: int +HTBOTTOMLEFT: int +HTBOTTOMRIGHT: int +HTBORDER: int +HTREDUCE: int +HTZOOM: int +HTSIZEFIRST: int +HTSIZELAST: int +HTOBJECT: int +HTCLOSE: int +HTHELP: int +SMTO_NORMAL: int +SMTO_BLOCK: int +SMTO_ABORTIFHUNG: int +SMTO_NOTIMEOUTIFNOTHUNG: int +MA_ACTIVATE: int +MA_ACTIVATEANDEAT: int +MA_NOACTIVATE: int +MA_NOACTIVATEANDEAT: int +ICON_SMALL: int +ICON_BIG: int +SIZE_RESTORED: int +SIZE_MINIMIZED: int +SIZE_MAXIMIZED: int +SIZE_MAXSHOW: int +SIZE_MAXHIDE: int +SIZENORMAL: int +SIZEICONIC: int +SIZEFULLSCREEN: int +SIZEZOOMSHOW: int +SIZEZOOMHIDE: int +WVR_ALIGNTOP: int +WVR_ALIGNLEFT: int +WVR_ALIGNBOTTOM: int +WVR_ALIGNRIGHT: int +WVR_HREDRAW: int +WVR_VREDRAW: int +WVR_REDRAW: int +WVR_VALIDRECTS: int +MK_LBUTTON: int +MK_RBUTTON: int +MK_SHIFT: int +MK_CONTROL: int +MK_MBUTTON: int +TME_HOVER: int +TME_LEAVE: int +TME_QUERY: int +TME_CANCEL: int +HOVER_DEFAULT: int +WS_OVERLAPPED: int +WS_POPUP: int +WS_CHILD: int +WS_MINIMIZE: int +WS_VISIBLE: int +WS_DISABLED: int +WS_CLIPSIBLINGS: int +WS_CLIPCHILDREN: int +WS_MAXIMIZE: int +WS_CAPTION: int +WS_BORDER: int +WS_DLGFRAME: int +WS_VSCROLL: int +WS_HSCROLL: int +WS_SYSMENU: int +WS_THICKFRAME: int +WS_GROUP: int +WS_TABSTOP: int +WS_MINIMIZEBOX: int +WS_MAXIMIZEBOX: int +WS_TILED: int +WS_ICONIC: int +WS_SIZEBOX: int +WS_OVERLAPPEDWINDOW: int +WS_POPUPWINDOW: int +WS_CHILDWINDOW: int +WS_TILEDWINDOW: int +WS_EX_DLGMODALFRAME: int +WS_EX_NOPARENTNOTIFY: int +WS_EX_TOPMOST: int +WS_EX_ACCEPTFILES: int +WS_EX_TRANSPARENT: int +WS_EX_MDICHILD: int +WS_EX_TOOLWINDOW: int +WS_EX_WINDOWEDGE: int +WS_EX_CLIENTEDGE: int +WS_EX_CONTEXTHELP: int +WS_EX_RIGHT: int +WS_EX_LEFT: int +WS_EX_RTLREADING: int +WS_EX_LTRREADING: int +WS_EX_LEFTSCROLLBAR: int +WS_EX_RIGHTSCROLLBAR: int +WS_EX_CONTROLPARENT: int +WS_EX_STATICEDGE: int +WS_EX_APPWINDOW: int +WS_EX_OVERLAPPEDWINDOW: int +WS_EX_PALETTEWINDOW: int +WS_EX_LAYERED: int +WS_EX_NOINHERITLAYOUT: int +WS_EX_LAYOUTRTL: int +WS_EX_COMPOSITED: int +WS_EX_NOACTIVATE: int +CS_VREDRAW: int +CS_HREDRAW: int +CS_DBLCLKS: int +CS_OWNDC: int +CS_CLASSDC: int +CS_PARENTDC: int +CS_NOCLOSE: int +CS_SAVEBITS: int +CS_BYTEALIGNCLIENT: int +CS_BYTEALIGNWINDOW: int +CS_GLOBALCLASS: int +CS_IME: int +PRF_CHECKVISIBLE: int +PRF_NONCLIENT: int +PRF_CLIENT: int +PRF_ERASEBKGND: int +PRF_CHILDREN: int +PRF_OWNED: int +BDR_RAISEDOUTER: int +BDR_SUNKENOUTER: int +BDR_RAISEDINNER: int +BDR_SUNKENINNER: int +BDR_OUTER: int +BDR_INNER: int +EDGE_RAISED: int +EDGE_SUNKEN: int +EDGE_ETCHED: int +EDGE_BUMP: int +ISMEX_NOSEND: int +ISMEX_SEND: int +ISMEX_NOTIFY: int +ISMEX_CALLBACK: int +ISMEX_REPLIED: int +CW_USEDEFAULT: int +FLASHW_STOP: int +FLASHW_CAPTION: int +FLASHW_TRAY: int +FLASHW_ALL: int +FLASHW_TIMER: int +FLASHW_TIMERNOFG: int +DS_ABSALIGN: int +DS_SYSMODAL: int +DS_LOCALEDIT: int +DS_SETFONT: int +DS_MODALFRAME: int +DS_NOIDLEMSG: int +DS_SETFOREGROUND: int +DS_3DLOOK: int +DS_FIXEDSYS: int +DS_NOFAILCREATE: int +DS_CONTROL: int +DS_CENTER: int +DS_CENTERMOUSE: int +DS_CONTEXTHELP: int +DM_GETDEFID: int +DM_SETDEFID: int +DM_REPOSITION: int +DC_HASDEFID: int +DLGC_WANTARROWS: int +DLGC_WANTTAB: int +DLGC_WANTALLKEYS: int +DLGC_WANTMESSAGE: int +DLGC_HASSETSEL: int +DLGC_DEFPUSHBUTTON: int +DLGC_UNDEFPUSHBUTTON: int +DLGC_RADIOBUTTON: int +DLGC_WANTCHARS: int +DLGC_STATIC: int +DLGC_BUTTON: int +LB_CTLCODE: int +LB_OKAY: int +LB_ERR: int +LB_ERRSPACE: int +LBN_ERRSPACE: int +LBN_SELCHANGE: int +LBN_DBLCLK: int +LBN_SELCANCEL: int +LBN_SETFOCUS: int +LBN_KILLFOCUS: int +LB_ADDSTRING: int +LB_INSERTSTRING: int +LB_DELETESTRING: int +LB_SELITEMRANGEEX: int +LB_RESETCONTENT: int +LB_SETSEL: int +LB_SETCURSEL: int +LB_GETSEL: int +LB_GETCURSEL: int +LB_GETTEXT: int +LB_GETTEXTLEN: int +LB_GETCOUNT: int +LB_SELECTSTRING: int +LB_DIR: int +LB_GETTOPINDEX: int +LB_FINDSTRING: int +LB_GETSELCOUNT: int +LB_GETSELITEMS: int +LB_SETTABSTOPS: int +LB_GETHORIZONTALEXTENT: int +LB_SETHORIZONTALEXTENT: int +LB_SETCOLUMNWIDTH: int +LB_ADDFILE: int +LB_SETTOPINDEX: int +LB_GETITEMRECT: int +LB_GETITEMDATA: int +LB_SETITEMDATA: int +LB_SELITEMRANGE: int +LB_SETANCHORINDEX: int +LB_GETANCHORINDEX: int +LB_SETCARETINDEX: int +LB_GETCARETINDEX: int +LB_SETITEMHEIGHT: int +LB_GETITEMHEIGHT: int +LB_FINDSTRINGEXACT: int +LB_SETLOCALE: int +LB_GETLOCALE: int +LB_SETCOUNT: int +LB_INITSTORAGE: int +LB_ITEMFROMPOINT: int +LB_MSGMAX: int +LBS_NOTIFY: int +LBS_SORT: int +LBS_NOREDRAW: int +LBS_MULTIPLESEL: int +LBS_OWNERDRAWFIXED: int +LBS_OWNERDRAWVARIABLE: int +LBS_HASSTRINGS: int +LBS_USETABSTOPS: int +LBS_NOINTEGRALHEIGHT: int +LBS_MULTICOLUMN: int +LBS_WANTKEYBOARDINPUT: int +LBS_EXTENDEDSEL: int +LBS_DISABLENOSCROLL: int +LBS_NODATA: int +LBS_NOSEL: int +LBS_STANDARD: int +CB_OKAY: int +CB_ERR: int +CB_ERRSPACE: int +CBN_ERRSPACE: int +CBN_SELCHANGE: int +CBN_DBLCLK: int +CBN_SETFOCUS: int +CBN_KILLFOCUS: int +CBN_EDITCHANGE: int +CBN_EDITUPDATE: int +CBN_DROPDOWN: int +CBN_CLOSEUP: int +CBN_SELENDOK: int +CBN_SELENDCANCEL: int +CBS_SIMPLE: int +CBS_DROPDOWN: int +CBS_OWNERDRAWFIXED: int +CBS_OWNERDRAWVARIABLE: int +CBS_AUTOHSCROLL: int +CBS_OEMCONVERT: int +CBS_SORT: int +CBS_HASSTRINGS: int +CBS_NOINTEGRALHEIGHT: int +CBS_DISABLENOSCROLL: int +CBS_UPPERCASE: int +CBS_LOWERCASE: int +CB_GETEDITSEL: int +CB_LIMITTEXT: int +CB_SETEDITSEL: int +CB_ADDSTRING: int +CB_DELETESTRING: int +CB_DIR: int +CB_GETCOUNT: int +CB_GETCURSEL: int +CB_GETLBTEXT: int +CB_GETLBTEXTLEN: int +CB_INSERTSTRING: int +CB_RESETCONTENT: int +CB_FINDSTRING: int +CB_SELECTSTRING: int +CB_SETCURSEL: int +CB_SHOWDROPDOWN: int +CB_GETITEMDATA: int +CB_SETITEMDATA: int +CB_GETDROPPEDCONTROLRECT: int +CB_SETITEMHEIGHT: int +CB_GETITEMHEIGHT: int +CB_SETEXTENDEDUI: int +CB_GETEXTENDEDUI: int +CB_GETDROPPEDSTATE: int +CB_FINDSTRINGEXACT: int +CB_SETLOCALE: int +CB_GETLOCALE: int +CB_GETTOPINDEX: int +CB_SETTOPINDEX: int +CB_GETHORIZONTALEXTENT: int +CB_SETHORIZONTALEXTENT: int +CB_GETDROPPEDWIDTH: int +CB_SETDROPPEDWIDTH: int +CB_INITSTORAGE: int +CB_MSGMAX: int +SBS_HORZ: int +SBS_VERT: int +SBS_TOPALIGN: int +SBS_LEFTALIGN: int +SBS_BOTTOMALIGN: int +SBS_RIGHTALIGN: int +SBS_SIZEBOXTOPLEFTALIGN: int +SBS_SIZEBOXBOTTOMRIGHTALIGN: int +SBS_SIZEBOX: int +SBS_SIZEGRIP: int +SBM_SETPOS: int +SBM_GETPOS: int +SBM_SETRANGE: int +SBM_SETRANGEREDRAW: int +SBM_GETRANGE: int +SBM_ENABLE_ARROWS: int +SBM_SETSCROLLINFO: int +SBM_GETSCROLLINFO: int +SIF_RANGE: int +SIF_PAGE: int +SIF_POS: int +SIF_DISABLENOSCROLL: int +SIF_TRACKPOS: int +SIF_ALL: int +MDIS_ALLCHILDSTYLES: int +MDITILE_VERTICAL: int +MDITILE_HORIZONTAL: int +MDITILE_SKIPDISABLED: int +IMC_GETCANDIDATEPOS: int +IMC_SETCANDIDATEPOS: int +IMC_GETCOMPOSITIONFONT: int +IMC_SETCOMPOSITIONFONT: int +IMC_GETCOMPOSITIONWINDOW: int +IMC_SETCOMPOSITIONWINDOW: int +IMC_GETSTATUSWINDOWPOS: int +IMC_SETSTATUSWINDOWPOS: int +IMC_CLOSESTATUSWINDOW: int +IMC_OPENSTATUSWINDOW: int +DELETE: int +READ_CONTROL: int +WRITE_DAC: int +WRITE_OWNER: int +SYNCHRONIZE: int +STANDARD_RIGHTS_REQUIRED: int +STANDARD_RIGHTS_READ: int +STANDARD_RIGHTS_WRITE: int +STANDARD_RIGHTS_EXECUTE: int +STANDARD_RIGHTS_ALL: int +SPECIFIC_RIGHTS_ALL: int +ACCESS_SYSTEM_SECURITY: int +MAXIMUM_ALLOWED: int +GENERIC_READ: int +GENERIC_WRITE: int +GENERIC_EXECUTE: int +GENERIC_ALL: int +SERVICE_KERNEL_DRIVER: int +SERVICE_FILE_SYSTEM_DRIVER: int +SERVICE_ADAPTER: int +SERVICE_RECOGNIZER_DRIVER: int +SERVICE_DRIVER: int +SERVICE_WIN32_OWN_PROCESS: int +SERVICE_WIN32_SHARE_PROCESS: int +SERVICE_WIN32: int +SERVICE_INTERACTIVE_PROCESS: int +SERVICE_TYPE_ALL: int +SERVICE_BOOT_START: int +SERVICE_SYSTEM_START: int +SERVICE_AUTO_START: int +SERVICE_DEMAND_START: int +SERVICE_DISABLED: int +SERVICE_ERROR_IGNORE: int +SERVICE_ERROR_NORMAL: int +SERVICE_ERROR_SEVERE: int +SERVICE_ERROR_CRITICAL: int +TAPE_ERASE_SHORT: int +TAPE_ERASE_LONG: int +TAPE_LOAD: int +TAPE_UNLOAD: int +TAPE_TENSION: int +TAPE_LOCK: int +TAPE_UNLOCK: int +TAPE_FORMAT: int +TAPE_SETMARKS: int +TAPE_FILEMARKS: int +TAPE_SHORT_FILEMARKS: int +TAPE_LONG_FILEMARKS: int +TAPE_ABSOLUTE_POSITION: int +TAPE_LOGICAL_POSITION: int +TAPE_PSEUDO_LOGICAL_POSITION: int +TAPE_REWIND: int +TAPE_ABSOLUTE_BLOCK: int +TAPE_LOGICAL_BLOCK: int +TAPE_PSEUDO_LOGICAL_BLOCK: int +TAPE_SPACE_END_OF_DATA: int +TAPE_SPACE_RELATIVE_BLOCKS: int +TAPE_SPACE_FILEMARKS: int +TAPE_SPACE_SEQUENTIAL_FMKS: int +TAPE_SPACE_SETMARKS: int +TAPE_SPACE_SEQUENTIAL_SMKS: int +TAPE_DRIVE_FIXED: int +TAPE_DRIVE_SELECT: int +TAPE_DRIVE_INITIATOR: int +TAPE_DRIVE_ERASE_SHORT: int +TAPE_DRIVE_ERASE_LONG: int +TAPE_DRIVE_ERASE_BOP_ONLY: int +TAPE_DRIVE_ERASE_IMMEDIATE: int +TAPE_DRIVE_TAPE_CAPACITY: int +TAPE_DRIVE_TAPE_REMAINING: int +TAPE_DRIVE_FIXED_BLOCK: int +TAPE_DRIVE_VARIABLE_BLOCK: int +TAPE_DRIVE_WRITE_PROTECT: int +TAPE_DRIVE_EOT_WZ_SIZE: int +TAPE_DRIVE_ECC: int +TAPE_DRIVE_COMPRESSION: int +TAPE_DRIVE_PADDING: int +TAPE_DRIVE_REPORT_SMKS: int +TAPE_DRIVE_GET_ABSOLUTE_BLK: int +TAPE_DRIVE_GET_LOGICAL_BLK: int +TAPE_DRIVE_SET_EOT_WZ_SIZE: int +TAPE_DRIVE_LOAD_UNLOAD: int +TAPE_DRIVE_TENSION: int +TAPE_DRIVE_LOCK_UNLOCK: int +TAPE_DRIVE_REWIND_IMMEDIATE: int +TAPE_DRIVE_SET_BLOCK_SIZE: int +TAPE_DRIVE_LOAD_UNLD_IMMED: int +TAPE_DRIVE_TENSION_IMMED: int +TAPE_DRIVE_LOCK_UNLK_IMMED: int +TAPE_DRIVE_SET_ECC: int +TAPE_DRIVE_SET_COMPRESSION: int +TAPE_DRIVE_SET_PADDING: int +TAPE_DRIVE_SET_REPORT_SMKS: int +TAPE_DRIVE_ABSOLUTE_BLK: int +TAPE_DRIVE_ABS_BLK_IMMED: int +TAPE_DRIVE_LOGICAL_BLK: int +TAPE_DRIVE_LOG_BLK_IMMED: int +TAPE_DRIVE_END_OF_DATA: int +TAPE_DRIVE_RELATIVE_BLKS: int +TAPE_DRIVE_FILEMARKS: int +TAPE_DRIVE_SEQUENTIAL_FMKS: int +TAPE_DRIVE_SETMARKS: int +TAPE_DRIVE_SEQUENTIAL_SMKS: int +TAPE_DRIVE_REVERSE_POSITION: int +TAPE_DRIVE_SPACE_IMMEDIATE: int +TAPE_DRIVE_WRITE_SETMARKS: int +TAPE_DRIVE_WRITE_FILEMARKS: int +TAPE_DRIVE_WRITE_SHORT_FMKS: int +TAPE_DRIVE_WRITE_LONG_FMKS: int +TAPE_DRIVE_WRITE_MARK_IMMED: int +TAPE_DRIVE_FORMAT: int +TAPE_DRIVE_FORMAT_IMMEDIATE: int +TAPE_FIXED_PARTITIONS: int +TAPE_SELECT_PARTITIONS: int +TAPE_INITIATOR_PARTITIONS: int +APPLICATION_ERROR_MASK: int +ERROR_SEVERITY_SUCCESS: int +ERROR_SEVERITY_INFORMATIONAL: int +ERROR_SEVERITY_WARNING: int +ERROR_SEVERITY_ERROR: int +MINCHAR: int +MAXCHAR: int +MINSHORT: int +MAXSHORT: int +MINLONG: int +MAXLONG: int +MAXBYTE: int +MAXWORD: int +MAXDWORD: int +LANG_NEUTRAL: int +LANG_BULGARIAN: int +LANG_CHINESE: int +LANG_CROATIAN: int +LANG_CZECH: int +LANG_DANISH: int +LANG_DUTCH: int +LANG_ENGLISH: int +LANG_FINNISH: int +LANG_FRENCH: int +LANG_GERMAN: int +LANG_GREEK: int +LANG_HUNGARIAN: int +LANG_ICELANDIC: int +LANG_ITALIAN: int +LANG_JAPANESE: int +LANG_KOREAN: int +LANG_NORWEGIAN: int +LANG_POLISH: int +LANG_PORTUGUESE: int +LANG_ROMANIAN: int +LANG_RUSSIAN: int +LANG_SLOVAK: int +LANG_SLOVENIAN: int +LANG_SPANISH: int +LANG_SWEDISH: int +LANG_TURKISH: int +SUBLANG_NEUTRAL: int +SUBLANG_DEFAULT: int +SUBLANG_SYS_DEFAULT: int +SUBLANG_CHINESE_TRADITIONAL: int +SUBLANG_CHINESE_SIMPLIFIED: int +SUBLANG_CHINESE_HONGKONG: int +SUBLANG_CHINESE_SINGAPORE: int +SUBLANG_DUTCH: int +SUBLANG_DUTCH_BELGIAN: int +SUBLANG_ENGLISH_US: int +SUBLANG_ENGLISH_UK: int +SUBLANG_ENGLISH_AUS: int +SUBLANG_ENGLISH_CAN: int +SUBLANG_ENGLISH_NZ: int +SUBLANG_ENGLISH_EIRE: int +SUBLANG_FRENCH: int +SUBLANG_FRENCH_BELGIAN: int +SUBLANG_FRENCH_CANADIAN: int +SUBLANG_FRENCH_SWISS: int +SUBLANG_GERMAN: int +SUBLANG_GERMAN_SWISS: int +SUBLANG_GERMAN_AUSTRIAN: int +SUBLANG_ITALIAN: int +SUBLANG_ITALIAN_SWISS: int +SUBLANG_NORWEGIAN_BOKMAL: int +SUBLANG_NORWEGIAN_NYNORSK: int +SUBLANG_PORTUGUESE: int +SUBLANG_PORTUGUESE_BRAZILIAN: int +SUBLANG_SPANISH: int +SUBLANG_SPANISH_MEXICAN: int +SUBLANG_SPANISH_MODERN: int +SORT_DEFAULT: int +SORT_JAPANESE_XJIS: int +SORT_JAPANESE_UNICODE: int +SORT_CHINESE_BIG5: int +SORT_CHINESE_UNICODE: int +SORT_KOREAN_KSC: int +SORT_KOREAN_UNICODE: int + +def PRIMARYLANGID(lgid: int) -> int: ... +def SUBLANGID(lgid: int) -> int: ... + +NLS_VALID_LOCALE_MASK: int +CONTEXT_PORTABLE_32BIT: int +CONTEXT_ALPHA: int +SIZE_OF_80387_REGISTERS: int +CONTEXT_CONTROL: int +CONTEXT_FLOATING_POINT: int +CONTEXT_INTEGER: int +CONTEXT_FULL: int +PROCESS_TERMINATE: int +PROCESS_CREATE_THREAD: int +PROCESS_VM_OPERATION: int +PROCESS_VM_READ: int +PROCESS_VM_WRITE: int +PROCESS_DUP_HANDLE: int +PROCESS_CREATE_PROCESS: int +PROCESS_SET_QUOTA: int +PROCESS_SET_INFORMATION: int +PROCESS_QUERY_INFORMATION: int +PROCESS_SUSPEND_RESUME: int +PROCESS_QUERY_LIMITED_INFORMATION: int +PROCESS_SET_LIMITED_INFORMATION: int +PROCESS_ALL_ACCESS: int +THREAD_TERMINATE: int +THREAD_SUSPEND_RESUME: int +THREAD_GET_CONTEXT: int +THREAD_SET_CONTEXT: int +THREAD_SET_INFORMATION: int +THREAD_QUERY_INFORMATION: int +THREAD_SET_THREAD_TOKEN: int +THREAD_IMPERSONATE: int +THREAD_DIRECT_IMPERSONATION: int +THREAD_SET_LIMITED_INFORMATION: int +THREAD_QUERY_LIMITED_INFORMATION: int +THREAD_RESUME: int +TLS_MINIMUM_AVAILABLE: int +EVENT_MODIFY_STATE: int +MUTANT_QUERY_STATE: int +SEMAPHORE_MODIFY_STATE: int +TIME_ZONE_ID_UNKNOWN: int +TIME_ZONE_ID_STANDARD: int +TIME_ZONE_ID_DAYLIGHT: int +PROCESSOR_INTEL_386: int +PROCESSOR_INTEL_486: int +PROCESSOR_INTEL_PENTIUM: int +PROCESSOR_INTEL_860: int +PROCESSOR_MIPS_R2000: int +PROCESSOR_MIPS_R3000: int +PROCESSOR_MIPS_R4000: int +PROCESSOR_ALPHA_21064: int +PROCESSOR_PPC_601: int +PROCESSOR_PPC_603: int +PROCESSOR_PPC_604: int +PROCESSOR_PPC_620: int +SECTION_QUERY: int +SECTION_MAP_WRITE: int +SECTION_MAP_READ: int +SECTION_MAP_EXECUTE: int +SECTION_EXTEND_SIZE: int +PAGE_NOACCESS: int +PAGE_READONLY: int +PAGE_READWRITE: int +PAGE_WRITECOPY: int +PAGE_EXECUTE: int +PAGE_EXECUTE_READ: int +PAGE_EXECUTE_READWRITE: int +PAGE_EXECUTE_WRITECOPY: int +PAGE_GUARD: int +PAGE_NOCACHE: int +MEM_COMMIT: int +MEM_RESERVE: int +MEM_DECOMMIT: int +MEM_RELEASE: int +MEM_FREE: int +MEM_PRIVATE: int +MEM_MAPPED: int +MEM_TOP_DOWN: int +SEC_FILE: int +SEC_IMAGE: int +SEC_RESERVE: int +SEC_COMMIT: int +SEC_NOCACHE: int +MEM_IMAGE: int +FILE_SHARE_READ: int +FILE_SHARE_WRITE: int +FILE_SHARE_DELETE: int +FILE_ATTRIBUTE_READONLY: int +FILE_ATTRIBUTE_HIDDEN: int +FILE_ATTRIBUTE_SYSTEM: int +FILE_ATTRIBUTE_DIRECTORY: int +FILE_ATTRIBUTE_ARCHIVE: int +FILE_ATTRIBUTE_DEVICE: int +FILE_ATTRIBUTE_NORMAL: int +FILE_ATTRIBUTE_TEMPORARY: int +FILE_ATTRIBUTE_SPARSE_FILE: int +FILE_ATTRIBUTE_REPARSE_POINT: int +FILE_ATTRIBUTE_COMPRESSED: int +FILE_ATTRIBUTE_OFFLINE: int +FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: int +FILE_ATTRIBUTE_ENCRYPTED: int +FILE_ATTRIBUTE_VIRTUAL: int +FILE_ATTRIBUTE_ATOMIC_WRITE: int +FILE_ATTRIBUTE_XACTION_WRITE: int +FILE_NOTIFY_CHANGE_FILE_NAME: int +FILE_NOTIFY_CHANGE_DIR_NAME: int +FILE_NOTIFY_CHANGE_ATTRIBUTES: int +FILE_NOTIFY_CHANGE_SIZE: int +FILE_NOTIFY_CHANGE_LAST_WRITE: int +FILE_NOTIFY_CHANGE_SECURITY: int +FILE_CASE_SENSITIVE_SEARCH: int +FILE_CASE_PRESERVED_NAMES: int +FILE_UNICODE_ON_DISK: int +FILE_PERSISTENT_ACLS: int +FILE_FILE_COMPRESSION: int +FILE_VOLUME_IS_COMPRESSED: int +IO_COMPLETION_MODIFY_STATE: int +DUPLICATE_CLOSE_SOURCE: int +DUPLICATE_SAME_ACCESS: int +SID_MAX_SUB_AUTHORITIES: int +SECURITY_NULL_RID: int +SECURITY_WORLD_RID: int +SECURITY_LOCAL_RID: int +SECURITY_CREATOR_OWNER_RID: int +SECURITY_CREATOR_GROUP_RID: int +SECURITY_DIALUP_RID: int +SECURITY_NETWORK_RID: int +SECURITY_BATCH_RID: int +SECURITY_INTERACTIVE_RID: int +SECURITY_SERVICE_RID: int +SECURITY_ANONYMOUS_LOGON_RID: int +SECURITY_LOGON_IDS_RID: int +SECURITY_LOGON_IDS_RID_COUNT: int +SECURITY_LOCAL_SYSTEM_RID: int +SECURITY_NT_NON_UNIQUE: int +SECURITY_BUILTIN_DOMAIN_RID: int +DOMAIN_USER_RID_ADMIN: int +DOMAIN_USER_RID_GUEST: int +DOMAIN_GROUP_RID_ADMINS: int +DOMAIN_GROUP_RID_USERS: int +DOMAIN_GROUP_RID_GUESTS: int +DOMAIN_ALIAS_RID_ADMINS: int +DOMAIN_ALIAS_RID_USERS: int +DOMAIN_ALIAS_RID_GUESTS: int +DOMAIN_ALIAS_RID_POWER_USERS: int +DOMAIN_ALIAS_RID_ACCOUNT_OPS: int +DOMAIN_ALIAS_RID_SYSTEM_OPS: int +DOMAIN_ALIAS_RID_PRINT_OPS: int +DOMAIN_ALIAS_RID_BACKUP_OPS: int +DOMAIN_ALIAS_RID_REPLICATOR: int +SE_GROUP_MANDATORY: int +SE_GROUP_ENABLED_BY_DEFAULT: int +SE_GROUP_ENABLED: int +SE_GROUP_OWNER: int +SE_GROUP_LOGON_ID: int +ACL_REVISION: int +ACL_REVISION1: int +ACL_REVISION2: int +ACCESS_ALLOWED_ACE_TYPE: int +ACCESS_DENIED_ACE_TYPE: int +SYSTEM_AUDIT_ACE_TYPE: int +SYSTEM_ALARM_ACE_TYPE: int +OBJECT_INHERIT_ACE: int +CONTAINER_INHERIT_ACE: int +NO_PROPAGATE_INHERIT_ACE: int +INHERIT_ONLY_ACE: int +VALID_INHERIT_FLAGS: int +SUCCESSFUL_ACCESS_ACE_FLAG: int +FAILED_ACCESS_ACE_FLAG: int +SECURITY_DESCRIPTOR_REVISION: int +SECURITY_DESCRIPTOR_REVISION1: int +SECURITY_DESCRIPTOR_MIN_LENGTH: int +SE_OWNER_DEFAULTED: int +SE_GROUP_DEFAULTED: int +SE_DACL_PRESENT: int +SE_DACL_DEFAULTED: int +SE_SACL_PRESENT: int +SE_SACL_DEFAULTED: int +SE_SELF_RELATIVE: int +SE_PRIVILEGE_ENABLED_BY_DEFAULT: int +SE_PRIVILEGE_ENABLED: int +SE_PRIVILEGE_USED_FOR_ACCESS: int +PRIVILEGE_SET_ALL_NECESSARY: int +SE_CREATE_TOKEN_NAME: str +SE_ASSIGNPRIMARYTOKEN_NAME: str +SE_LOCK_MEMORY_NAME: str +SE_INCREASE_QUOTA_NAME: str +SE_UNSOLICITED_INPUT_NAME: str +SE_MACHINE_ACCOUNT_NAME: str +SE_TCB_NAME: str +SE_SECURITY_NAME: str +SE_TAKE_OWNERSHIP_NAME: str +SE_LOAD_DRIVER_NAME: str +SE_SYSTEM_PROFILE_NAME: str +SE_SYSTEMTIME_NAME: str +SE_PROF_SINGLE_PROCESS_NAME: str +SE_INC_BASE_PRIORITY_NAME: str +SE_CREATE_PAGEFILE_NAME: str +SE_CREATE_PERMANENT_NAME: str +SE_BACKUP_NAME: str +SE_RESTORE_NAME: str +SE_SHUTDOWN_NAME: str +SE_DEBUG_NAME: str +SE_AUDIT_NAME: str +SE_SYSTEM_ENVIRONMENT_NAME: str +SE_CHANGE_NOTIFY_NAME: str +SE_REMOTE_SHUTDOWN_NAME: str +TOKEN_ASSIGN_PRIMARY: int +TOKEN_DUPLICATE: int +TOKEN_IMPERSONATE: int +TOKEN_QUERY: int +TOKEN_QUERY_SOURCE: int +TOKEN_ADJUST_PRIVILEGES: int +TOKEN_ADJUST_GROUPS: int +TOKEN_ADJUST_DEFAULT: int +TOKEN_ALL_ACCESS: int +TOKEN_READ: int +TOKEN_WRITE: int +TOKEN_EXECUTE: int +TOKEN_SOURCE_LENGTH: int +KEY_QUERY_VALUE: int +KEY_SET_VALUE: int +KEY_CREATE_SUB_KEY: int +KEY_ENUMERATE_SUB_KEYS: int +KEY_NOTIFY: int +KEY_CREATE_LINK: int +KEY_WOW64_32KEY: int +KEY_WOW64_64KEY: int +KEY_WOW64_RES: int +KEY_READ: int +KEY_WRITE: int +KEY_EXECUTE: int +KEY_ALL_ACCESS: int +REG_NOTIFY_CHANGE_ATTRIBUTES: int +REG_NOTIFY_CHANGE_SECURITY: int +REG_NONE: int +REG_SZ: int +REG_EXPAND_SZ: int +REG_BINARY: int +REG_DWORD: int +REG_DWORD_LITTLE_ENDIAN: int +REG_DWORD_BIG_ENDIAN: int +REG_LINK: int +REG_MULTI_SZ: int +REG_FULL_RESOURCE_DESCRIPTOR: int +REG_QWORD: int +REG_QWORD_LITTLE_ENDIAN: int +NULL: int +HEAP_NO_SERIALIZE: int +HEAP_GROWABLE: int +HEAP_GENERATE_EXCEPTIONS: int +HEAP_ZERO_MEMORY: int +HEAP_REALLOC_IN_PLACE_ONLY: int +HEAP_TAIL_CHECKING_ENABLED: int +HEAP_FREE_CHECKING_ENABLED: int +HEAP_DISABLE_COALESCE_ON_FREE: int +IS_TEXT_UNICODE_ASCII16: int +IS_TEXT_UNICODE_REVERSE_ASCII16: int +IS_TEXT_UNICODE_STATISTICS: int +IS_TEXT_UNICODE_REVERSE_STATISTICS: int +IS_TEXT_UNICODE_CONTROLS: int +IS_TEXT_UNICODE_REVERSE_CONTROLS: int +IS_TEXT_UNICODE_SIGNATURE: int +IS_TEXT_UNICODE_REVERSE_SIGNATURE: int +IS_TEXT_UNICODE_ILLEGAL_CHARS: int +IS_TEXT_UNICODE_ODD_LENGTH: int +IS_TEXT_UNICODE_DBCS_LEADBYTE: int +IS_TEXT_UNICODE_NULL_BYTES: int +IS_TEXT_UNICODE_UNICODE_MASK: int +IS_TEXT_UNICODE_REVERSE_MASK: int +IS_TEXT_UNICODE_NOT_UNICODE_MASK: int +IS_TEXT_UNICODE_NOT_ASCII_MASK: int +COMPRESSION_FORMAT_NONE: int +COMPRESSION_FORMAT_DEFAULT: int +COMPRESSION_FORMAT_LZNT1: int +COMPRESSION_ENGINE_STANDARD: int +COMPRESSION_ENGINE_MAXIMUM: int +MESSAGE_RESOURCE_UNICODE: int +RTL_CRITSECT_TYPE: int +RTL_RESOURCE_TYPE: int +DLL_PROCESS_ATTACH: int +DLL_THREAD_ATTACH: int +DLL_THREAD_DETACH: int +DLL_PROCESS_DETACH: int +EVENTLOG_SEQUENTIAL_READ: int +EVENTLOG_SEEK_READ: int +EVENTLOG_FORWARDS_READ: int +EVENTLOG_BACKWARDS_READ: int +EVENTLOG_SUCCESS: int +EVENTLOG_ERROR_TYPE: int +EVENTLOG_WARNING_TYPE: int +EVENTLOG_INFORMATION_TYPE: int +EVENTLOG_AUDIT_SUCCESS: int +EVENTLOG_AUDIT_FAILURE: int +EVENTLOG_START_PAIRED_EVENT: int +EVENTLOG_END_PAIRED_EVENT: int +EVENTLOG_END_ALL_PAIRED_EVENTS: int +EVENTLOG_PAIRED_EVENT_ACTIVE: int +EVENTLOG_PAIRED_EVENT_INACTIVE: int +OWNER_SECURITY_INFORMATION: int +GROUP_SECURITY_INFORMATION: int +DACL_SECURITY_INFORMATION: int +SACL_SECURITY_INFORMATION: int +IMAGE_SIZEOF_FILE_HEADER: int +IMAGE_FILE_MACHINE_UNKNOWN: int +IMAGE_NUMBEROF_DIRECTORY_ENTRIES: int +IMAGE_SIZEOF_ROM_OPTIONAL_HEADER: int +IMAGE_SIZEOF_STD_OPTIONAL_HEADER: int +IMAGE_SIZEOF_NT_OPTIONAL_HEADER: int +IMAGE_NT_OPTIONAL_HDR_MAGIC: int +IMAGE_ROM_OPTIONAL_HDR_MAGIC: int +IMAGE_SIZEOF_SHORT_NAME: int +IMAGE_SIZEOF_SECTION_HEADER: int +IMAGE_SIZEOF_SYMBOL: int +IMAGE_SYM_CLASS_NULL: int +IMAGE_SYM_CLASS_AUTOMATIC: int +IMAGE_SYM_CLASS_EXTERNAL: int +IMAGE_SYM_CLASS_STATIC: int +IMAGE_SYM_CLASS_REGISTER: int +IMAGE_SYM_CLASS_EXTERNAL_DEF: int +IMAGE_SYM_CLASS_LABEL: int +IMAGE_SYM_CLASS_UNDEFINED_LABEL: int +IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: int +IMAGE_SYM_CLASS_ARGUMENT: int +IMAGE_SYM_CLASS_STRUCT_TAG: int +IMAGE_SYM_CLASS_MEMBER_OF_UNION: int +IMAGE_SYM_CLASS_UNION_TAG: int +IMAGE_SYM_CLASS_TYPE_DEFINITION: int +IMAGE_SYM_CLASS_UNDEFINED_STATIC: int +IMAGE_SYM_CLASS_ENUM_TAG: int +IMAGE_SYM_CLASS_MEMBER_OF_ENUM: int +IMAGE_SYM_CLASS_REGISTER_PARAM: int +IMAGE_SYM_CLASS_BIT_FIELD: int +IMAGE_SYM_CLASS_BLOCK: int +IMAGE_SYM_CLASS_FUNCTION: int +IMAGE_SYM_CLASS_END_OF_STRUCT: int +IMAGE_SYM_CLASS_FILE: int +IMAGE_SYM_CLASS_SECTION: int +IMAGE_SYM_CLASS_WEAK_EXTERNAL: int +N_BTMASK: int +N_TMASK: int +N_TMASK1: int +N_TMASK2: int +N_BTSHFT: int +N_TSHIFT: int +IMAGE_SIZEOF_AUX_SYMBOL: int +IMAGE_COMDAT_SELECT_NODUPLICATES: int +IMAGE_COMDAT_SELECT_ANY: int +IMAGE_COMDAT_SELECT_SAME_SIZE: int +IMAGE_COMDAT_SELECT_EXACT_MATCH: int +IMAGE_COMDAT_SELECT_ASSOCIATIVE: int +IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY: int +IMAGE_WEAK_EXTERN_SEARCH_LIBRARY: int +IMAGE_WEAK_EXTERN_SEARCH_ALIAS: int +IMAGE_SIZEOF_RELOCATION: int +IMAGE_REL_I386_SECTION: int +IMAGE_REL_I386_SECREL: int +IMAGE_REL_MIPS_REFHALF: int +IMAGE_REL_MIPS_REFWORD: int +IMAGE_REL_MIPS_JMPADDR: int +IMAGE_REL_MIPS_REFHI: int +IMAGE_REL_MIPS_REFLO: int +IMAGE_REL_MIPS_GPREL: int +IMAGE_REL_MIPS_LITERAL: int +IMAGE_REL_MIPS_SECTION: int +IMAGE_REL_MIPS_SECREL: int +IMAGE_REL_MIPS_REFWORDNB: int +IMAGE_REL_MIPS_PAIR: int +IMAGE_REL_ALPHA_ABSOLUTE: int +IMAGE_REL_ALPHA_REFLONG: int +IMAGE_REL_ALPHA_REFQUAD: int +IMAGE_REL_ALPHA_GPREL32: int +IMAGE_REL_ALPHA_LITERAL: int +IMAGE_REL_ALPHA_LITUSE: int +IMAGE_REL_ALPHA_GPDISP: int +IMAGE_REL_ALPHA_BRADDR: int +IMAGE_REL_ALPHA_HINT: int +IMAGE_REL_ALPHA_INLINE_REFLONG: int +IMAGE_REL_ALPHA_REFHI: int +IMAGE_REL_ALPHA_REFLO: int +IMAGE_REL_ALPHA_PAIR: int +IMAGE_REL_ALPHA_MATCH: int +IMAGE_REL_ALPHA_SECTION: int +IMAGE_REL_ALPHA_SECREL: int +IMAGE_REL_ALPHA_REFLONGNB: int +IMAGE_SIZEOF_BASE_RELOCATION: int +IMAGE_REL_BASED_ABSOLUTE: int +IMAGE_REL_BASED_HIGH: int +IMAGE_REL_BASED_LOW: int +IMAGE_REL_BASED_HIGHLOW: int +IMAGE_REL_BASED_HIGHADJ: int +IMAGE_REL_BASED_MIPS_JMPADDR: int +IMAGE_SIZEOF_LINENUMBER: int +IMAGE_ARCHIVE_START_SIZE: int +IMAGE_ARCHIVE_START: str +IMAGE_ARCHIVE_END: str +IMAGE_ARCHIVE_PAD: str +IMAGE_ARCHIVE_LINKER_MEMBER: str +IMAGE_ARCHIVE_LONGNAMES_MEMBER: str +IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR: int +IMAGE_ORDINAL_FLAG: int + +def IMAGE_SNAP_BY_ORDINAL(Ordinal: int) -> bool: ... +def IMAGE_ORDINAL(Ordinal: int) -> int: ... + +IMAGE_RESOURCE_NAME_IS_STRING: int +IMAGE_RESOURCE_DATA_IS_DIRECTORY: int +IMAGE_DEBUG_TYPE_UNKNOWN: int +IMAGE_DEBUG_TYPE_COFF: int +IMAGE_DEBUG_TYPE_CODEVIEW: int +IMAGE_DEBUG_TYPE_FPO: int +IMAGE_DEBUG_TYPE_MISC: int +IMAGE_DEBUG_TYPE_EXCEPTION: int +IMAGE_DEBUG_TYPE_FIXUP: int +IMAGE_DEBUG_TYPE_OMAP_TO_SRC: int +IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: int +FRAME_FPO: int +FRAME_TRAP: int +FRAME_TSS: int +SIZEOF_RFPO_DATA: int +IMAGE_DEBUG_MISC_EXENAME: int +IMAGE_SEPARATE_DEBUG_SIGNATURE: int +NEWFRAME: int +ABORTDOC: int +NEXTBAND: int +SETCOLORTABLE: int +GETCOLORTABLE: int +FLUSHOUTPUT: int +DRAFTMODE: int +QUERYESCSUPPORT: int +SETABORTPROC: int +STARTDOC: int +ENDDOC: int +GETPHYSPAGESIZE: int +GETPRINTINGOFFSET: int +GETSCALINGFACTOR: int +MFCOMMENT: int +GETPENWIDTH: int +SETCOPYCOUNT: int +SELECTPAPERSOURCE: int +DEVICEDATA: int +PASSTHROUGH: int +GETTECHNOLGY: int +GETTECHNOLOGY: int +SETLINECAP: int +SETLINEJOIN: int +SETMITERLIMIT: int +BANDINFO: int +DRAWPATTERNRECT: int +GETVECTORPENSIZE: int +GETVECTORBRUSHSIZE: int +ENABLEDUPLEX: int +GETSETPAPERBINS: int +GETSETPRINTORIENT: int +ENUMPAPERBINS: int +SETDIBSCALING: int +EPSPRINTING: int +ENUMPAPERMETRICS: int +GETSETPAPERMETRICS: int +POSTSCRIPT_DATA: int +POSTSCRIPT_IGNORE: int +MOUSETRAILS: int +GETDEVICEUNITS: int +GETEXTENDEDTEXTMETRICS: int +GETEXTENTTABLE: int +GETPAIRKERNTABLE: int +GETTRACKKERNTABLE: int +EXTTEXTOUT: int +GETFACENAME: int +DOWNLOADFACE: int +ENABLERELATIVEWIDTHS: int +ENABLEPAIRKERNING: int +SETKERNTRACK: int +SETALLJUSTVALUES: int +SETCHARSET: int +STRETCHBLT: int +GETSETSCREENPARAMS: int +BEGIN_PATH: int +CLIP_TO_PATH: int +END_PATH: int +EXT_DEVICE_CAPS: int +RESTORE_CTM: int +SAVE_CTM: int +SET_ARC_DIRECTION: int +SET_BACKGROUND_COLOR: int +SET_POLY_MODE: int +SET_SCREEN_ANGLE: int +SET_SPREAD: int +TRANSFORM_CTM: int +SET_CLIP_BOX: int +SET_BOUNDS: int +SET_MIRROR_MODE: int +OPENCHANNEL: int +DOWNLOADHEADER: int +CLOSECHANNEL: int +POSTSCRIPT_PASSTHROUGH: int +ENCAPSULATED_POSTSCRIPT: int +SP_NOTREPORTED: int +SP_ERROR: int +SP_APPABORT: int +SP_USERABORT: int +SP_OUTOFDISK: int +SP_OUTOFMEMORY: int +PR_JOBSTATUS: int +OBJ_PEN: int +OBJ_BRUSH: int +OBJ_DC: int +OBJ_METADC: int +OBJ_PAL: int +OBJ_FONT: int +OBJ_BITMAP: int +OBJ_REGION: int +OBJ_METAFILE: int +OBJ_MEMDC: int +OBJ_EXTPEN: int +OBJ_ENHMETADC: int +OBJ_ENHMETAFILE: int +OBJ_COLORSPACE: int +MWT_IDENTITY: int +MWT_LEFTMULTIPLY: int +MWT_RIGHTMULTIPLY: int +MWT_MIN: int +MWT_MAX: int +BI_RGB: int +BI_RLE8: int +BI_RLE4: int +BI_BITFIELDS: int +TMPF_FIXED_PITCH: int +TMPF_VECTOR: int +TMPF_DEVICE: int +TMPF_TRUETYPE: int +NTM_REGULAR: int +NTM_BOLD: int +NTM_ITALIC: int +LF_FACESIZE: int +LF_FULLFACESIZE: int +OUT_DEFAULT_PRECIS: int +OUT_STRING_PRECIS: int +OUT_CHARACTER_PRECIS: int +OUT_STROKE_PRECIS: int +OUT_TT_PRECIS: int +OUT_DEVICE_PRECIS: int +OUT_RASTER_PRECIS: int +OUT_TT_ONLY_PRECIS: int +OUT_OUTLINE_PRECIS: int +CLIP_DEFAULT_PRECIS: int +CLIP_CHARACTER_PRECIS: int +CLIP_STROKE_PRECIS: int +CLIP_MASK: int +CLIP_LH_ANGLES: int +CLIP_TT_ALWAYS: int +CLIP_EMBEDDED: int +DEFAULT_QUALITY: int +DRAFT_QUALITY: int +PROOF_QUALITY: int +NONANTIALIASED_QUALITY: int +ANTIALIASED_QUALITY: int +CLEARTYPE_QUALITY: int +CLEARTYPE_NATURAL_QUALITY: int +DEFAULT_PITCH: int +FIXED_PITCH: int +VARIABLE_PITCH: int +ANSI_CHARSET: int +DEFAULT_CHARSET: int +SYMBOL_CHARSET: int +SHIFTJIS_CHARSET: int +HANGEUL_CHARSET: int +CHINESEBIG5_CHARSET: int +OEM_CHARSET: int +JOHAB_CHARSET: int +HEBREW_CHARSET: int +ARABIC_CHARSET: int +GREEK_CHARSET: int +TURKISH_CHARSET: int +VIETNAMESE_CHARSET: int +THAI_CHARSET: int +EASTEUROPE_CHARSET: int +RUSSIAN_CHARSET: int +MAC_CHARSET: int +BALTIC_CHARSET: int +FF_DONTCARE: int +FF_ROMAN: int +FF_SWISS: int +FF_MODERN: int +FF_SCRIPT: int +FF_DECORATIVE: int +FW_DONTCARE: int +FW_THIN: int +FW_EXTRALIGHT: int +FW_LIGHT: int +FW_NORMAL: int +FW_MEDIUM: int +FW_SEMIBOLD: int +FW_BOLD: int +FW_EXTRABOLD: int +FW_HEAVY: int +FW_ULTRALIGHT: int +FW_REGULAR: int +FW_DEMIBOLD: int +FW_ULTRABOLD: int +FW_BLACK: int +BS_SOLID: int +BS_NULL: int +BS_HOLLOW: int +BS_HATCHED: int +BS_PATTERN: int +BS_INDEXED: int +BS_DIBPATTERN: int +BS_DIBPATTERNPT: int +BS_PATTERN8X8: int +BS_DIBPATTERN8X8: int +HS_HORIZONTAL: int +HS_VERTICAL: int +HS_FDIAGONAL: int +HS_BDIAGONAL: int +HS_CROSS: int +HS_DIAGCROSS: int +HS_FDIAGONAL1: int +HS_BDIAGONAL1: int +HS_SOLID: int +HS_DENSE1: int +HS_DENSE2: int +HS_DENSE3: int +HS_DENSE4: int +HS_DENSE5: int +HS_DENSE6: int +HS_DENSE7: int +HS_DENSE8: int +HS_NOSHADE: int +HS_HALFTONE: int +HS_SOLIDCLR: int +HS_DITHEREDCLR: int +HS_SOLIDTEXTCLR: int +HS_DITHEREDTEXTCLR: int +HS_SOLIDBKCLR: int +HS_DITHEREDBKCLR: int +HS_API_MAX: int +PS_SOLID: int +PS_DASH: int +PS_DOT: int +PS_DASHDOT: int +PS_DASHDOTDOT: int +PS_NULL: int +PS_INSIDEFRAME: int +PS_USERSTYLE: int +PS_ALTERNATE: int +PS_STYLE_MASK: int +PS_ENDCAP_ROUND: int +PS_ENDCAP_SQUARE: int +PS_ENDCAP_FLAT: int +PS_ENDCAP_MASK: int +PS_JOIN_ROUND: int +PS_JOIN_BEVEL: int +PS_JOIN_MITER: int +PS_JOIN_MASK: int +PS_COSMETIC: int +PS_GEOMETRIC: int +PS_TYPE_MASK: int +AD_COUNTERCLOCKWISE: int +AD_CLOCKWISE: int +DRIVERVERSION: int +TECHNOLOGY: int +HORZSIZE: int +VERTSIZE: int +HORZRES: int +VERTRES: int +BITSPIXEL: int +PLANES: int +NUMBRUSHES: int +NUMPENS: int +NUMMARKERS: int +NUMFONTS: int +NUMCOLORS: int +PDEVICESIZE: int +CURVECAPS: int +LINECAPS: int +POLYGONALCAPS: int +TEXTCAPS: int +CLIPCAPS: int +RASTERCAPS: int +ASPECTX: int +ASPECTY: int +ASPECTXY: int +LOGPIXELSX: int +LOGPIXELSY: int +SIZEPALETTE: int +NUMRESERVED: int +COLORRES: int +PHYSICALWIDTH: int +PHYSICALHEIGHT: int +PHYSICALOFFSETX: int +PHYSICALOFFSETY: int +SCALINGFACTORX: int +SCALINGFACTORY: int +VREFRESH: int +DESKTOPVERTRES: int +DESKTOPHORZRES: int +BLTALIGNMENT: int +SHADEBLENDCAPS: int +COLORMGMTCAPS: int +DT_PLOTTER: int +DT_RASDISPLAY: int +DT_RASPRINTER: int +DT_RASCAMERA: int +DT_CHARSTREAM: int +DT_METAFILE: int +DT_DISPFILE: int +CC_NONE: int +CC_CIRCLES: int +CC_PIE: int +CC_CHORD: int +CC_ELLIPSES: int +CC_WIDE: int +CC_STYLED: int +CC_WIDESTYLED: int +CC_INTERIORS: int +CC_ROUNDRECT: int +LC_NONE: int +LC_POLYLINE: int +LC_MARKER: int +LC_POLYMARKER: int +LC_WIDE: int +LC_STYLED: int +LC_WIDESTYLED: int +LC_INTERIORS: int +PC_NONE: int +PC_POLYGON: int +PC_RECTANGLE: int +PC_WINDPOLYGON: int +PC_TRAPEZOID: int +PC_SCANLINE: int +PC_WIDE: int +PC_STYLED: int +PC_WIDESTYLED: int +PC_INTERIORS: int +CP_NONE: int +CP_RECTANGLE: int +CP_REGION: int +TC_OP_CHARACTER: int +TC_OP_STROKE: int +TC_CP_STROKE: int +TC_CR_90: int +TC_CR_ANY: int +TC_SF_X_YINDEP: int +TC_SA_DOUBLE: int +TC_SA_INTEGER: int +TC_SA_CONTIN: int +TC_EA_DOUBLE: int +TC_IA_ABLE: int +TC_UA_ABLE: int +TC_SO_ABLE: int +TC_RA_ABLE: int +TC_VA_ABLE: int +TC_RESERVED: int +TC_SCROLLBLT: int +RC_BITBLT: int +RC_BANDING: int +RC_SCALING: int +RC_BITMAP64: int +RC_GDI20_OUTPUT: int +RC_GDI20_STATE: int +RC_SAVEBITMAP: int +RC_DI_BITMAP: int +RC_PALETTE: int +RC_DIBTODEV: int +RC_BIGFONT: int +RC_STRETCHBLT: int +RC_FLOODFILL: int +RC_STRETCHDIB: int +RC_OP_DX_OUTPUT: int +RC_DEVBITS: int +DIB_RGB_COLORS: int +DIB_PAL_COLORS: int +DIB_PAL_INDICES: int +DIB_PAL_PHYSINDICES: int +DIB_PAL_LOGINDICES: int +SYSPAL_ERROR: int +SYSPAL_STATIC: int +SYSPAL_NOSTATIC: int +CBM_CREATEDIB: int +CBM_INIT: int +FLOODFILLBORDER: int +FLOODFILLSURFACE: int +CCHDEVICENAME: int +CCHFORMNAME: int +DM_SPECVERSION: int +DM_ORIENTATION: int +DM_PAPERSIZE: int +DM_PAPERLENGTH: int +DM_PAPERWIDTH: int +DM_SCALE: int +DM_POSITION: int +DM_NUP: int +DM_DISPLAYORIENTATION: int +DM_COPIES: int +DM_DEFAULTSOURCE: int +DM_PRINTQUALITY: int +DM_COLOR: int +DM_DUPLEX: int +DM_YRESOLUTION: int +DM_TTOPTION: int +DM_COLLATE: int +DM_FORMNAME: int +DM_LOGPIXELS: int +DM_BITSPERPEL: int +DM_PELSWIDTH: int +DM_PELSHEIGHT: int +DM_DISPLAYFLAGS: int +DM_DISPLAYFREQUENCY: int +DM_ICMMETHOD: int +DM_ICMINTENT: int +DM_MEDIATYPE: int +DM_DITHERTYPE: int +DM_PANNINGWIDTH: int +DM_PANNINGHEIGHT: int +DM_DISPLAYFIXEDOUTPUT: int +DMORIENT_PORTRAIT: int +DMORIENT_LANDSCAPE: int +DMDO_DEFAULT: int +DMDO_90: int +DMDO_180: int +DMDO_270: int +DMDFO_DEFAULT: int +DMDFO_STRETCH: int +DMDFO_CENTER: int +DMPAPER_LETTER: int +DMPAPER_LETTERSMALL: int +DMPAPER_TABLOID: int +DMPAPER_LEDGER: int +DMPAPER_LEGAL: int +DMPAPER_STATEMENT: int +DMPAPER_EXECUTIVE: int +DMPAPER_A3: int +DMPAPER_A4: int +DMPAPER_A4SMALL: int +DMPAPER_A5: int +DMPAPER_B4: int +DMPAPER_B5: int +DMPAPER_FOLIO: int +DMPAPER_QUARTO: int +DMPAPER_10X14: int +DMPAPER_11X17: int +DMPAPER_NOTE: int +DMPAPER_ENV_9: int +DMPAPER_ENV_10: int +DMPAPER_ENV_11: int +DMPAPER_ENV_12: int +DMPAPER_ENV_14: int +DMPAPER_CSHEET: int +DMPAPER_DSHEET: int +DMPAPER_ESHEET: int +DMPAPER_ENV_DL: int +DMPAPER_ENV_C5: int +DMPAPER_ENV_C3: int +DMPAPER_ENV_C4: int +DMPAPER_ENV_C6: int +DMPAPER_ENV_C65: int +DMPAPER_ENV_B4: int +DMPAPER_ENV_B5: int +DMPAPER_ENV_B6: int +DMPAPER_ENV_ITALY: int +DMPAPER_ENV_MONARCH: int +DMPAPER_ENV_PERSONAL: int +DMPAPER_FANFOLD_US: int +DMPAPER_FANFOLD_STD_GERMAN: int +DMPAPER_FANFOLD_LGL_GERMAN: int +DMPAPER_ISO_B4: int +DMPAPER_JAPANESE_POSTCARD: int +DMPAPER_9X11: int +DMPAPER_10X11: int +DMPAPER_15X11: int +DMPAPER_ENV_INVITE: int +DMPAPER_RESERVED_48: int +DMPAPER_RESERVED_49: int +DMPAPER_LETTER_EXTRA: int +DMPAPER_LEGAL_EXTRA: int +DMPAPER_TABLOID_EXTRA: int +DMPAPER_A4_EXTRA: int +DMPAPER_LETTER_TRANSVERSE: int +DMPAPER_A4_TRANSVERSE: int +DMPAPER_LETTER_EXTRA_TRANSVERSE: int +DMPAPER_A_PLUS: int +DMPAPER_B_PLUS: int +DMPAPER_LETTER_PLUS: int +DMPAPER_A4_PLUS: int +DMPAPER_A5_TRANSVERSE: int +DMPAPER_B5_TRANSVERSE: int +DMPAPER_A3_EXTRA: int +DMPAPER_A5_EXTRA: int +DMPAPER_B5_EXTRA: int +DMPAPER_A2: int +DMPAPER_A3_TRANSVERSE: int +DMPAPER_A3_EXTRA_TRANSVERSE: int +DMPAPER_DBL_JAPANESE_POSTCARD: int +DMPAPER_A6: int +DMPAPER_JENV_KAKU2: int +DMPAPER_JENV_KAKU3: int +DMPAPER_JENV_CHOU3: int +DMPAPER_JENV_CHOU4: int +DMPAPER_LETTER_ROTATED: int +DMPAPER_A3_ROTATED: int +DMPAPER_A4_ROTATED: int +DMPAPER_A5_ROTATED: int +DMPAPER_B4_JIS_ROTATED: int +DMPAPER_B5_JIS_ROTATED: int +DMPAPER_JAPANESE_POSTCARD_ROTATED: int +DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED: int +DMPAPER_A6_ROTATED: int +DMPAPER_JENV_KAKU2_ROTATED: int +DMPAPER_JENV_KAKU3_ROTATED: int +DMPAPER_JENV_CHOU3_ROTATED: int +DMPAPER_JENV_CHOU4_ROTATED: int +DMPAPER_B6_JIS: int +DMPAPER_B6_JIS_ROTATED: int +DMPAPER_12X11: int +DMPAPER_JENV_YOU4: int +DMPAPER_JENV_YOU4_ROTATED: int +DMPAPER_P16K: int +DMPAPER_P32K: int +DMPAPER_P32KBIG: int +DMPAPER_PENV_1: int +DMPAPER_PENV_2: int +DMPAPER_PENV_3: int +DMPAPER_PENV_4: int +DMPAPER_PENV_5: int +DMPAPER_PENV_6: int +DMPAPER_PENV_7: int +DMPAPER_PENV_8: int +DMPAPER_PENV_9: int +DMPAPER_PENV_10: int +DMPAPER_P16K_ROTATED: int +DMPAPER_P32K_ROTATED: int +DMPAPER_P32KBIG_ROTATED: int +DMPAPER_PENV_1_ROTATED: int +DMPAPER_PENV_2_ROTATED: int +DMPAPER_PENV_3_ROTATED: int +DMPAPER_PENV_4_ROTATED: int +DMPAPER_PENV_5_ROTATED: int +DMPAPER_PENV_6_ROTATED: int +DMPAPER_PENV_7_ROTATED: int +DMPAPER_PENV_8_ROTATED: int +DMPAPER_PENV_9_ROTATED: int +DMPAPER_PENV_10_ROTATED: int +DMPAPER_LAST: int +DMPAPER_USER: int +DMBIN_UPPER: int +DMBIN_ONLYONE: int +DMBIN_LOWER: int +DMBIN_MIDDLE: int +DMBIN_MANUAL: int +DMBIN_ENVELOPE: int +DMBIN_ENVMANUAL: int +DMBIN_AUTO: int +DMBIN_TRACTOR: int +DMBIN_SMALLFMT: int +DMBIN_LARGEFMT: int +DMBIN_LARGECAPACITY: int +DMBIN_CASSETTE: int +DMBIN_FORMSOURCE: int +DMBIN_LAST: int +DMBIN_USER: int +DMRES_DRAFT: int +DMRES_LOW: int +DMRES_MEDIUM: int +DMRES_HIGH: int +DMCOLOR_MONOCHROME: int +DMCOLOR_COLOR: int +DMDUP_SIMPLEX: int +DMDUP_VERTICAL: int +DMDUP_HORIZONTAL: int +DMTT_BITMAP: int +DMTT_DOWNLOAD: int +DMTT_SUBDEV: int +DMTT_DOWNLOAD_OUTLINE: int +DMCOLLATE_FALSE: int +DMCOLLATE_TRUE: int +DM_GRAYSCALE: int +DM_INTERLACED: int +DMICMMETHOD_NONE: int +DMICMMETHOD_SYSTEM: int +DMICMMETHOD_DRIVER: int +DMICMMETHOD_DEVICE: int +DMICMMETHOD_USER: int +DMICM_SATURATE: int +DMICM_CONTRAST: int +DMICM_COLORIMETRIC: int +DMICM_ABS_COLORIMETRIC: int +DMICM_USER: int +DMMEDIA_STANDARD: int +DMMEDIA_TRANSPARENCY: int +DMMEDIA_GLOSSY: int +DMMEDIA_USER: int +DMDITHER_NONE: int +DMDITHER_COARSE: int +DMDITHER_FINE: int +DMDITHER_LINEART: int +DMDITHER_ERRORDIFFUSION: int +DMDITHER_RESERVED6: int +DMDITHER_RESERVED7: int +DMDITHER_RESERVED8: int +DMDITHER_RESERVED9: int +DMDITHER_GRAYSCALE: int +DMDITHER_USER: int +DMNUP_SYSTEM: int +DMNUP_ONEUP: int +FEATURESETTING_NUP: int +FEATURESETTING_OUTPUT: int +FEATURESETTING_PSLEVEL: int +FEATURESETTING_CUSTPAPER: int +FEATURESETTING_MIRROR: int +FEATURESETTING_NEGATIVE: int +FEATURESETTING_PROTOCOL: int +FEATURESETTING_PRIVATE_BEGIN: int +FEATURESETTING_PRIVATE_END: int +RDH_RECTANGLES: int +GGO_METRICS: int +GGO_BITMAP: int +GGO_NATIVE: int +TT_POLYGON_TYPE: int +TT_PRIM_LINE: int +TT_PRIM_QSPLINE: int +TT_AVAILABLE: int +TT_ENABLED: int +DM_UPDATE: int +DM_COPY: int +DM_PROMPT: int +DM_MODIFY: int +DM_IN_BUFFER: int +DM_IN_PROMPT: int +DM_OUT_BUFFER: int +DM_OUT_DEFAULT: int +DISPLAY_DEVICE_ATTACHED_TO_DESKTOP: int +DISPLAY_DEVICE_MULTI_DRIVER: int +DISPLAY_DEVICE_PRIMARY_DEVICE: int +DISPLAY_DEVICE_MIRRORING_DRIVER: int +DISPLAY_DEVICE_VGA_COMPATIBLE: int +DISPLAY_DEVICE_REMOVABLE: int +DISPLAY_DEVICE_MODESPRUNED: int +DISPLAY_DEVICE_REMOTE: int +DISPLAY_DEVICE_DISCONNECT: int +DC_FIELDS: int +DC_PAPERS: int +DC_PAPERSIZE: int +DC_MINEXTENT: int +DC_MAXEXTENT: int +DC_BINS: int +DC_DUPLEX: int +DC_SIZE: int +DC_EXTRA: int +DC_VERSION: int +DC_DRIVER: int +DC_BINNAMES: int +DC_ENUMRESOLUTIONS: int +DC_FILEDEPENDENCIES: int +DC_TRUETYPE: int +DC_PAPERNAMES: int +DC_ORIENTATION: int +DC_COPIES: int +DC_BINADJUST: int +DC_EMF_COMPLIANT: int +DC_DATATYPE_PRODUCED: int +DC_COLLATE: int +DC_MANUFACTURER: int +DC_MODEL: int +DC_PERSONALITY: int +DC_PRINTRATE: int +DC_PRINTRATEUNIT: int +DC_PRINTERMEM: int +DC_MEDIAREADY: int +DC_STAPLE: int +DC_PRINTRATEPPM: int +DC_COLORDEVICE: int +DC_NUP: int +DC_MEDIATYPENAMES: int +DC_MEDIATYPES: int +PRINTRATEUNIT_PPM: int +PRINTRATEUNIT_CPS: int +PRINTRATEUNIT_LPM: int +PRINTRATEUNIT_IPM: int +DCTT_BITMAP: int +DCTT_DOWNLOAD: int +DCTT_SUBDEV: int +DCTT_DOWNLOAD_OUTLINE: int +DCBA_FACEUPNONE: int +DCBA_FACEUPCENTER: int +DCBA_FACEUPLEFT: int +DCBA_FACEUPRIGHT: int +DCBA_FACEDOWNNONE: int +DCBA_FACEDOWNCENTER: int +DCBA_FACEDOWNLEFT: int +DCBA_FACEDOWNRIGHT: int +CA_NEGATIVE: int +CA_LOG_FILTER: int +ILLUMINANT_DEVICE_DEFAULT: int +ILLUMINANT_A: int +ILLUMINANT_B: int +ILLUMINANT_C: int +ILLUMINANT_D50: int +ILLUMINANT_D55: int +ILLUMINANT_D65: int +ILLUMINANT_D75: int +ILLUMINANT_F2: int +ILLUMINANT_MAX_INDEX: int +ILLUMINANT_TUNGSTEN: int +ILLUMINANT_DAYLIGHT: int +ILLUMINANT_FLUORESCENT: int +ILLUMINANT_NTSC: int +FONTMAPPER_MAX: int +ENHMETA_SIGNATURE: int +ENHMETA_STOCK_OBJECT: int +EMR_HEADER: int +EMR_POLYBEZIER: int +EMR_POLYGON: int +EMR_POLYLINE: int +EMR_POLYBEZIERTO: int +EMR_POLYLINETO: int +EMR_POLYPOLYLINE: int +EMR_POLYPOLYGON: int +EMR_SETWINDOWEXTEX: int +EMR_SETWINDOWORGEX: int +EMR_SETVIEWPORTEXTEX: int +EMR_SETVIEWPORTORGEX: int +EMR_SETBRUSHORGEX: int +EMR_EOF: int +EMR_SETPIXELV: int +EMR_SETMAPPERFLAGS: int +EMR_SETMAPMODE: int +EMR_SETBKMODE: int +EMR_SETPOLYFILLMODE: int +EMR_SETROP2: int +EMR_SETSTRETCHBLTMODE: int +EMR_SETTEXTALIGN: int +EMR_SETCOLORADJUSTMENT: int +EMR_SETTEXTCOLOR: int +EMR_SETBKCOLOR: int +EMR_OFFSETCLIPRGN: int +EMR_MOVETOEX: int +EMR_SETMETARGN: int +EMR_EXCLUDECLIPRECT: int +EMR_INTERSECTCLIPRECT: int +EMR_SCALEVIEWPORTEXTEX: int +EMR_SCALEWINDOWEXTEX: int +EMR_SAVEDC: int +EMR_RESTOREDC: int +EMR_SETWORLDTRANSFORM: int +EMR_MODIFYWORLDTRANSFORM: int +EMR_SELECTOBJECT: int +EMR_CREATEPEN: int +EMR_CREATEBRUSHINDIRECT: int +EMR_DELETEOBJECT: int +EMR_ANGLEARC: int +EMR_ELLIPSE: int +EMR_RECTANGLE: int +EMR_ROUNDRECT: int +EMR_ARC: int +EMR_CHORD: int +EMR_PIE: int +EMR_SELECTPALETTE: int +EMR_CREATEPALETTE: int +EMR_SETPALETTEENTRIES: int +EMR_RESIZEPALETTE: int +EMR_REALIZEPALETTE: int +EMR_EXTFLOODFILL: int +EMR_LINETO: int +EMR_ARCTO: int +EMR_POLYDRAW: int +EMR_SETARCDIRECTION: int +EMR_SETMITERLIMIT: int +EMR_BEGINPATH: int +EMR_ENDPATH: int +EMR_CLOSEFIGURE: int +EMR_FILLPATH: int +EMR_STROKEANDFILLPATH: int +EMR_STROKEPATH: int +EMR_FLATTENPATH: int +EMR_WIDENPATH: int +EMR_SELECTCLIPPATH: int +EMR_ABORTPATH: int +EMR_GDICOMMENT: int +EMR_FILLRGN: int +EMR_FRAMERGN: int +EMR_INVERTRGN: int +EMR_PAINTRGN: int +EMR_EXTSELECTCLIPRGN: int +EMR_BITBLT: int +EMR_STRETCHBLT: int +EMR_MASKBLT: int +EMR_PLGBLT: int +EMR_SETDIBITSTODEVICE: int +EMR_STRETCHDIBITS: int +EMR_EXTCREATEFONTINDIRECTW: int +EMR_EXTTEXTOUTA: int +EMR_EXTTEXTOUTW: int +EMR_POLYBEZIER16: int +EMR_POLYGON16: int +EMR_POLYLINE16: int +EMR_POLYBEZIERTO16: int +EMR_POLYLINETO16: int +EMR_POLYPOLYLINE16: int +EMR_POLYPOLYGON16: int +EMR_POLYDRAW16: int +EMR_CREATEMONOBRUSH: int +EMR_CREATEDIBPATTERNBRUSHPT: int +EMR_EXTCREATEPEN: int +EMR_POLYTEXTOUTA: int +EMR_POLYTEXTOUTW: int +EMR_MIN: int +EMR_MAX: int +PANOSE_COUNT: int +PAN_FAMILYTYPE_INDEX: int +PAN_SERIFSTYLE_INDEX: int +PAN_WEIGHT_INDEX: int +PAN_PROPORTION_INDEX: int +PAN_CONTRAST_INDEX: int +PAN_STROKEVARIATION_INDEX: int +PAN_ARMSTYLE_INDEX: int +PAN_LETTERFORM_INDEX: int +PAN_MIDLINE_INDEX: int +PAN_XHEIGHT_INDEX: int +PAN_CULTURE_LATIN: int +PAN_ANY: int +PAN_NO_FIT: int +PAN_FAMILY_TEXT_DISPLAY: int +PAN_FAMILY_SCRIPT: int +PAN_FAMILY_DECORATIVE: int +PAN_FAMILY_PICTORIAL: int +PAN_SERIF_COVE: int +PAN_SERIF_OBTUSE_COVE: int +PAN_SERIF_SQUARE_COVE: int +PAN_SERIF_OBTUSE_SQUARE_COVE: int +PAN_SERIF_SQUARE: int +PAN_SERIF_THIN: int +PAN_SERIF_BONE: int +PAN_SERIF_EXAGGERATED: int +PAN_SERIF_TRIANGLE: int +PAN_SERIF_NORMAL_SANS: int +PAN_SERIF_OBTUSE_SANS: int +PAN_SERIF_PERP_SANS: int +PAN_SERIF_FLARED: int +PAN_SERIF_ROUNDED: int +PAN_WEIGHT_VERY_LIGHT: int +PAN_WEIGHT_LIGHT: int +PAN_WEIGHT_THIN: int +PAN_WEIGHT_BOOK: int +PAN_WEIGHT_MEDIUM: int +PAN_WEIGHT_DEMI: int +PAN_WEIGHT_BOLD: int +PAN_WEIGHT_HEAVY: int +PAN_WEIGHT_BLACK: int +PAN_WEIGHT_NORD: int +PAN_PROP_OLD_STYLE: int +PAN_PROP_MODERN: int +PAN_PROP_EVEN_WIDTH: int +PAN_PROP_EXPANDED: int +PAN_PROP_CONDENSED: int +PAN_PROP_VERY_EXPANDED: int +PAN_PROP_VERY_CONDENSED: int +PAN_PROP_MONOSPACED: int +PAN_CONTRAST_NONE: int +PAN_CONTRAST_VERY_LOW: int +PAN_CONTRAST_LOW: int +PAN_CONTRAST_MEDIUM_LOW: int +PAN_CONTRAST_MEDIUM: int +PAN_CONTRAST_MEDIUM_HIGH: int +PAN_CONTRAST_HIGH: int +PAN_CONTRAST_VERY_HIGH: int +PAN_STROKE_GRADUAL_DIAG: int +PAN_STROKE_GRADUAL_TRAN: int +PAN_STROKE_GRADUAL_VERT: int +PAN_STROKE_GRADUAL_HORZ: int +PAN_STROKE_RAPID_VERT: int +PAN_STROKE_RAPID_HORZ: int +PAN_STROKE_INSTANT_VERT: int +PAN_STRAIGHT_ARMS_HORZ: int +PAN_STRAIGHT_ARMS_WEDGE: int +PAN_STRAIGHT_ARMS_VERT: int +PAN_STRAIGHT_ARMS_SINGLE_SERIF: int +PAN_STRAIGHT_ARMS_DOUBLE_SERIF: int +PAN_BENT_ARMS_HORZ: int +PAN_BENT_ARMS_WEDGE: int +PAN_BENT_ARMS_VERT: int +PAN_BENT_ARMS_SINGLE_SERIF: int +PAN_BENT_ARMS_DOUBLE_SERIF: int +PAN_LETT_NORMAL_CONTACT: int +PAN_LETT_NORMAL_WEIGHTED: int +PAN_LETT_NORMAL_BOXED: int +PAN_LETT_NORMAL_FLATTENED: int +PAN_LETT_NORMAL_ROUNDED: int +PAN_LETT_NORMAL_OFF_CENTER: int +PAN_LETT_NORMAL_SQUARE: int +PAN_LETT_OBLIQUE_CONTACT: int +PAN_LETT_OBLIQUE_WEIGHTED: int +PAN_LETT_OBLIQUE_BOXED: int +PAN_LETT_OBLIQUE_FLATTENED: int +PAN_LETT_OBLIQUE_ROUNDED: int +PAN_LETT_OBLIQUE_OFF_CENTER: int +PAN_LETT_OBLIQUE_SQUARE: int +PAN_MIDLINE_STANDARD_TRIMMED: int +PAN_MIDLINE_STANDARD_POINTED: int +PAN_MIDLINE_STANDARD_SERIFED: int +PAN_MIDLINE_HIGH_TRIMMED: int +PAN_MIDLINE_HIGH_POINTED: int +PAN_MIDLINE_HIGH_SERIFED: int +PAN_MIDLINE_CONSTANT_TRIMMED: int +PAN_MIDLINE_CONSTANT_POINTED: int +PAN_MIDLINE_CONSTANT_SERIFED: int +PAN_MIDLINE_LOW_TRIMMED: int +PAN_MIDLINE_LOW_POINTED: int +PAN_MIDLINE_LOW_SERIFED: int +PAN_XHEIGHT_CONSTANT_SMALL: int +PAN_XHEIGHT_CONSTANT_STD: int +PAN_XHEIGHT_CONSTANT_LARGE: int +PAN_XHEIGHT_DUCKING_SMALL: int +PAN_XHEIGHT_DUCKING_STD: int +PAN_XHEIGHT_DUCKING_LARGE: int +ELF_VENDOR_SIZE: int +ELF_VERSION: int +ELF_CULTURE_LATIN: int +RASTER_FONTTYPE: int +DEVICE_FONTTYPE: int +TRUETYPE_FONTTYPE: int + +def PALETTEINDEX(i: int) -> int: ... + +PC_RESERVED: int +PC_EXPLICIT: int +PC_NOCOLLAPSE: int + +def GetRValue(rgb: int) -> int: ... +def GetGValue(rgb: int) -> int: ... +def GetBValue(rgb: int) -> int: ... + +TRANSPARENT: int +OPAQUE: int +BKMODE_LAST: int +GM_COMPATIBLE: int +GM_ADVANCED: int +GM_LAST: int +PT_CLOSEFIGURE: int +PT_LINETO: int +PT_BEZIERTO: int +PT_MOVETO: int +MM_TEXT: int +MM_LOMETRIC: int +MM_HIMETRIC: int +MM_LOENGLISH: int +MM_HIENGLISH: int +MM_TWIPS: int +MM_ISOTROPIC: int +MM_ANISOTROPIC: int +MM_MIN: int +MM_MAX: int +MM_MAX_FIXEDSCALE: int +ABSOLUTE: int +RELATIVE: int +WHITE_BRUSH: int +LTGRAY_BRUSH: int +GRAY_BRUSH: int +DKGRAY_BRUSH: int +BLACK_BRUSH: int +NULL_BRUSH: int +HOLLOW_BRUSH: int +WHITE_PEN: int +BLACK_PEN: int +NULL_PEN: int +OEM_FIXED_FONT: int +ANSI_FIXED_FONT: int +ANSI_VAR_FONT: int +SYSTEM_FONT: int +DEVICE_DEFAULT_FONT: int +DEFAULT_PALETTE: int +SYSTEM_FIXED_FONT: int +STOCK_LAST: int +CLR_INVALID: int +DC_BRUSH: int +DC_PEN: int +STATUS_WAIT_0: int +STATUS_ABANDONED_WAIT_0: int +STATUS_USER_APC: int +STATUS_TIMEOUT: int +STATUS_PENDING: int +STATUS_SEGMENT_NOTIFICATION: int +STATUS_GUARD_PAGE_VIOLATION: int +STATUS_DATATYPE_MISALIGNMENT: int +STATUS_BREAKPOINT: int +STATUS_SINGLE_STEP: int +STATUS_ACCESS_VIOLATION: int +STATUS_IN_PAGE_ERROR: int +STATUS_INVALID_HANDLE: int +STATUS_NO_MEMORY: int +STATUS_ILLEGAL_INSTRUCTION: int +STATUS_NONCONTINUABLE_EXCEPTION: int +STATUS_INVALID_DISPOSITION: int +STATUS_ARRAY_BOUNDS_EXCEEDED: int +STATUS_FLOAT_DENORMAL_OPERAND: int +STATUS_FLOAT_DIVIDE_BY_ZERO: int +STATUS_FLOAT_INEXACT_RESULT: int +STATUS_FLOAT_INVALID_OPERATION: int +STATUS_FLOAT_OVERFLOW: int +STATUS_FLOAT_STACK_CHECK: int +STATUS_FLOAT_UNDERFLOW: int +STATUS_INTEGER_DIVIDE_BY_ZERO: int +STATUS_INTEGER_OVERFLOW: int +STATUS_PRIVILEGED_INSTRUCTION: int +STATUS_STACK_OVERFLOW: int +STATUS_CONTROL_C_EXIT: int +WAIT_FAILED: int +WAIT_OBJECT_0: int +WAIT_ABANDONED: int +WAIT_ABANDONED_0: int +WAIT_TIMEOUT: int +WAIT_IO_COMPLETION: int +STILL_ACTIVE: int +EXCEPTION_ACCESS_VIOLATION: int +EXCEPTION_DATATYPE_MISALIGNMENT: int +EXCEPTION_BREAKPOINT: int +EXCEPTION_SINGLE_STEP: int +EXCEPTION_ARRAY_BOUNDS_EXCEEDED: int +EXCEPTION_FLT_DENORMAL_OPERAND: int +EXCEPTION_FLT_DIVIDE_BY_ZERO: int +EXCEPTION_FLT_INEXACT_RESULT: int +EXCEPTION_FLT_INVALID_OPERATION: int +EXCEPTION_FLT_OVERFLOW: int +EXCEPTION_FLT_STACK_CHECK: int +EXCEPTION_FLT_UNDERFLOW: int +EXCEPTION_INT_DIVIDE_BY_ZERO: int +EXCEPTION_INT_OVERFLOW: int +EXCEPTION_PRIV_INSTRUCTION: int +EXCEPTION_IN_PAGE_ERROR: int +EXCEPTION_ILLEGAL_INSTRUCTION: int +EXCEPTION_NONCONTINUABLE_EXCEPTION: int +EXCEPTION_STACK_OVERFLOW: int +EXCEPTION_INVALID_DISPOSITION: int +EXCEPTION_GUARD_PAGE: int +EXCEPTION_INVALID_HANDLE: int +CONTROL_C_EXIT: int +SPI_GETBEEP: int +SPI_SETBEEP: int +SPI_GETMOUSE: int +SPI_SETMOUSE: int +SPI_GETBORDER: int +SPI_SETBORDER: int +SPI_GETKEYBOARDSPEED: int +SPI_SETKEYBOARDSPEED: int +SPI_LANGDRIVER: int +SPI_ICONHORIZONTALSPACING: int +SPI_GETSCREENSAVETIMEOUT: int +SPI_SETSCREENSAVETIMEOUT: int +SPI_GETSCREENSAVEACTIVE: int +SPI_SETSCREENSAVEACTIVE: int +SPI_GETGRIDGRANULARITY: int +SPI_SETGRIDGRANULARITY: int +SPI_SETDESKWALLPAPER: int +SPI_SETDESKPATTERN: int +SPI_GETKEYBOARDDELAY: int +SPI_SETKEYBOARDDELAY: int +SPI_ICONVERTICALSPACING: int +SPI_GETICONTITLEWRAP: int +SPI_SETICONTITLEWRAP: int +SPI_GETMENUDROPALIGNMENT: int +SPI_SETMENUDROPALIGNMENT: int +SPI_SETDOUBLECLKWIDTH: int +SPI_SETDOUBLECLKHEIGHT: int +SPI_GETICONTITLELOGFONT: int +SPI_SETDOUBLECLICKTIME: int +SPI_SETMOUSEBUTTONSWAP: int +SPI_SETICONTITLELOGFONT: int +SPI_GETFASTTASKSWITCH: int +SPI_SETFASTTASKSWITCH: int +SPI_SETDRAGFULLWINDOWS: int +SPI_GETDRAGFULLWINDOWS: int +SPI_GETNONCLIENTMETRICS: int +SPI_SETNONCLIENTMETRICS: int +SPI_GETMINIMIZEDMETRICS: int +SPI_SETMINIMIZEDMETRICS: int +SPI_GETICONMETRICS: int +SPI_SETICONMETRICS: int +SPI_SETWORKAREA: int +SPI_GETWORKAREA: int +SPI_SETPENWINDOWS: int +SPI_GETFILTERKEYS: int +SPI_SETFILTERKEYS: int +SPI_GETTOGGLEKEYS: int +SPI_SETTOGGLEKEYS: int +SPI_GETMOUSEKEYS: int +SPI_SETMOUSEKEYS: int +SPI_GETSHOWSOUNDS: int +SPI_SETSHOWSOUNDS: int +SPI_GETSTICKYKEYS: int +SPI_SETSTICKYKEYS: int +SPI_GETACCESSTIMEOUT: int +SPI_SETACCESSTIMEOUT: int +SPI_GETSERIALKEYS: int +SPI_SETSERIALKEYS: int +SPI_GETSOUNDSENTRY: int +SPI_SETSOUNDSENTRY: int +SPI_GETHIGHCONTRAST: int +SPI_SETHIGHCONTRAST: int +SPI_GETKEYBOARDPREF: int +SPI_SETKEYBOARDPREF: int +SPI_GETSCREENREADER: int +SPI_SETSCREENREADER: int +SPI_GETANIMATION: int +SPI_SETANIMATION: int +SPI_GETFONTSMOOTHING: int +SPI_SETFONTSMOOTHING: int +SPI_SETDRAGWIDTH: int +SPI_SETDRAGHEIGHT: int +SPI_SETHANDHELD: int +SPI_GETLOWPOWERTIMEOUT: int +SPI_GETPOWEROFFTIMEOUT: int +SPI_SETLOWPOWERTIMEOUT: int +SPI_SETPOWEROFFTIMEOUT: int +SPI_GETLOWPOWERACTIVE: int +SPI_GETPOWEROFFACTIVE: int +SPI_SETLOWPOWERACTIVE: int +SPI_SETPOWEROFFACTIVE: int +SPI_SETCURSORS: int +SPI_SETICONS: int +SPI_GETDEFAULTINPUTLANG: int +SPI_SETDEFAULTINPUTLANG: int +SPI_SETLANGTOGGLE: int +SPI_GETWINDOWSEXTENSION: int +SPI_SETMOUSETRAILS: int +SPI_GETMOUSETRAILS: int +SPI_GETSNAPTODEFBUTTON: int +SPI_SETSNAPTODEFBUTTON: int +SPI_SETSCREENSAVERRUNNING: int +SPI_SCREENSAVERRUNNING: int +SPI_GETMOUSEHOVERWIDTH: int +SPI_SETMOUSEHOVERWIDTH: int +SPI_GETMOUSEHOVERHEIGHT: int +SPI_SETMOUSEHOVERHEIGHT: int +SPI_GETMOUSEHOVERTIME: int +SPI_SETMOUSEHOVERTIME: int +SPI_GETWHEELSCROLLLINES: int +SPI_SETWHEELSCROLLLINES: int +SPI_GETMENUSHOWDELAY: int +SPI_SETMENUSHOWDELAY: int +SPI_GETSHOWIMEUI: int +SPI_SETSHOWIMEUI: int +SPI_GETMOUSESPEED: int +SPI_SETMOUSESPEED: int +SPI_GETSCREENSAVERRUNNING: int +SPI_GETDESKWALLPAPER: int +SPI_GETACTIVEWINDOWTRACKING: int +SPI_SETACTIVEWINDOWTRACKING: int +SPI_GETMENUANIMATION: int +SPI_SETMENUANIMATION: int +SPI_GETCOMBOBOXANIMATION: int +SPI_SETCOMBOBOXANIMATION: int +SPI_GETGRADIENTCAPTIONS: int +SPI_SETGRADIENTCAPTIONS: int +SPI_GETKEYBOARDCUES: int +SPI_SETKEYBOARDCUES: int +SPI_GETMENUUNDERLINES: int +SPI_SETMENUUNDERLINES: int +SPI_GETACTIVEWNDTRKZORDER: int +SPI_SETACTIVEWNDTRKZORDER: int +SPI_GETHOTTRACKING: int +SPI_SETHOTTRACKING: int +SPI_GETMENUFADE: int +SPI_SETMENUFADE: int +SPI_GETSELECTIONFADE: int +SPI_SETSELECTIONFADE: int +SPI_GETTOOLTIPANIMATION: int +SPI_SETTOOLTIPANIMATION: int +SPI_GETTOOLTIPFADE: int +SPI_SETTOOLTIPFADE: int +SPI_GETCURSORSHADOW: int +SPI_SETCURSORSHADOW: int +SPI_GETMOUSESONAR: int +SPI_SETMOUSESONAR: int +SPI_GETMOUSECLICKLOCK: int +SPI_SETMOUSECLICKLOCK: int +SPI_GETMOUSEVANISH: int +SPI_SETMOUSEVANISH: int +SPI_GETFLATMENU: int +SPI_SETFLATMENU: int +SPI_GETDROPSHADOW: int +SPI_SETDROPSHADOW: int +SPI_GETBLOCKSENDINPUTRESETS: int +SPI_SETBLOCKSENDINPUTRESETS: int +SPI_GETUIEFFECTS: int +SPI_SETUIEFFECTS: int +SPI_GETFOREGROUNDLOCKTIMEOUT: int +SPI_SETFOREGROUNDLOCKTIMEOUT: int +SPI_GETACTIVEWNDTRKTIMEOUT: int +SPI_SETACTIVEWNDTRKTIMEOUT: int +SPI_GETFOREGROUNDFLASHCOUNT: int +SPI_SETFOREGROUNDFLASHCOUNT: int +SPI_GETCARETWIDTH: int +SPI_SETCARETWIDTH: int +SPI_GETMOUSECLICKLOCKTIME: int +SPI_SETMOUSECLICKLOCKTIME: int +SPI_GETFONTSMOOTHINGTYPE: int +SPI_SETFONTSMOOTHINGTYPE: int +SPI_GETFONTSMOOTHINGCONTRAST: int +SPI_SETFONTSMOOTHINGCONTRAST: int +SPI_GETFOCUSBORDERWIDTH: int +SPI_SETFOCUSBORDERWIDTH: int +SPI_GETFOCUSBORDERHEIGHT: int +SPI_SETFOCUSBORDERHEIGHT: int +SPI_GETFONTSMOOTHINGORIENTATION: int +SPI_SETFONTSMOOTHINGORIENTATION: int +SPIF_UPDATEINIFILE: int +SPIF_SENDWININICHANGE: int +SPIF_SENDCHANGE: int +FE_FONTSMOOTHINGSTANDARD: int +FE_FONTSMOOTHINGCLEARTYPE: int +FE_FONTSMOOTHINGDOCKING: int +METRICS_USEDEFAULT: int +ARW_BOTTOMLEFT: int +ARW_BOTTOMRIGHT: int +ARW_TOPLEFT: int +ARW_TOPRIGHT: int +ARW_STARTMASK: int +ARW_STARTRIGHT: int +ARW_STARTTOP: int +ARW_LEFT: int +ARW_RIGHT: int +ARW_UP: int +ARW_DOWN: int +ARW_HIDE: int +SERKF_SERIALKEYSON: int +SERKF_AVAILABLE: int +SERKF_INDICATOR: int +HCF_HIGHCONTRASTON: int +HCF_AVAILABLE: int +HCF_HOTKEYACTIVE: int +HCF_CONFIRMHOTKEY: int +HCF_HOTKEYSOUND: int +HCF_INDICATOR: int +HCF_HOTKEYAVAILABLE: int +CDS_UPDATEREGISTRY: int +CDS_TEST: int +CDS_FULLSCREEN: int +CDS_GLOBAL: int +CDS_SET_PRIMARY: int +CDS_RESET: int +CDS_SETRECT: int +CDS_NORESET: int +DISP_CHANGE_SUCCESSFUL: int +DISP_CHANGE_RESTART: int +DISP_CHANGE_FAILED: int +DISP_CHANGE_BADMODE: int +DISP_CHANGE_NOTUPDATED: int +DISP_CHANGE_BADFLAGS: int +DISP_CHANGE_BADPARAM: int +DISP_CHANGE_BADDUALVIEW: int +ENUM_CURRENT_SETTINGS: int +ENUM_REGISTRY_SETTINGS: int +FKF_FILTERKEYSON: int +FKF_AVAILABLE: int +FKF_HOTKEYACTIVE: int +FKF_CONFIRMHOTKEY: int +FKF_HOTKEYSOUND: int +FKF_INDICATOR: int +FKF_CLICKON: int +SKF_STICKYKEYSON: int +SKF_AVAILABLE: int +SKF_HOTKEYACTIVE: int +SKF_CONFIRMHOTKEY: int +SKF_HOTKEYSOUND: int +SKF_INDICATOR: int +SKF_AUDIBLEFEEDBACK: int +SKF_TRISTATE: int +SKF_TWOKEYSOFF: int +SKF_LALTLATCHED: int +SKF_LCTLLATCHED: int +SKF_LSHIFTLATCHED: int +SKF_RALTLATCHED: int +SKF_RCTLLATCHED: int +SKF_RSHIFTLATCHED: int +SKF_LWINLATCHED: int +SKF_RWINLATCHED: int +SKF_LALTLOCKED: int +SKF_LCTLLOCKED: int +SKF_LSHIFTLOCKED: int +SKF_RALTLOCKED: int +SKF_RCTLLOCKED: int +SKF_RSHIFTLOCKED: int +SKF_LWINLOCKED: int +SKF_RWINLOCKED: int +MKF_MOUSEKEYSON: int +MKF_AVAILABLE: int +MKF_HOTKEYACTIVE: int +MKF_CONFIRMHOTKEY: int +MKF_HOTKEYSOUND: int +MKF_INDICATOR: int +MKF_MODIFIERS: int +MKF_REPLACENUMBERS: int +MKF_LEFTBUTTONSEL: int +MKF_RIGHTBUTTONSEL: int +MKF_LEFTBUTTONDOWN: int +MKF_RIGHTBUTTONDOWN: int +MKF_MOUSEMODE: int +ATF_TIMEOUTON: int +ATF_ONOFFFEEDBACK: int +SSGF_NONE: int +SSGF_DISPLAY: int +SSTF_NONE: int +SSTF_CHARS: int +SSTF_BORDER: int +SSTF_DISPLAY: int +SSWF_NONE: int +SSWF_TITLE: int +SSWF_WINDOW: int +SSWF_DISPLAY: int +SSWF_CUSTOM: int +SSF_SOUNDSENTRYON: int +SSF_AVAILABLE: int +SSF_INDICATOR: int +TKF_TOGGLEKEYSON: int +TKF_AVAILABLE: int +TKF_HOTKEYACTIVE: int +TKF_CONFIRMHOTKEY: int +TKF_HOTKEYSOUND: int +TKF_INDICATOR: int +SLE_ERROR: int +SLE_MINORERROR: int +SLE_WARNING: int +MONITOR_DEFAULTTONULL: int +MONITOR_DEFAULTTOPRIMARY: int +MONITOR_DEFAULTTONEAREST: int +MONITORINFOF_PRIMARY: int +CHILDID_SELF: int +INDEXID_OBJECT: int +INDEXID_CONTAINER: int +OBJID_WINDOW: int +OBJID_SYSMENU: int +OBJID_TITLEBAR: int +OBJID_MENU: int +OBJID_CLIENT: int +OBJID_VSCROLL: int +OBJID_HSCROLL: int +OBJID_SIZEGRIP: int +OBJID_CARET: int +OBJID_CURSOR: int +OBJID_ALERT: int +OBJID_SOUND: int +EVENT_MIN: int +EVENT_MAX: int +EVENT_SYSTEM_SOUND: int +EVENT_SYSTEM_ALERT: int +EVENT_SYSTEM_FOREGROUND: int +EVENT_SYSTEM_MENUSTART: int +EVENT_SYSTEM_MENUEND: int +EVENT_SYSTEM_MENUPOPUPSTART: int +EVENT_SYSTEM_MENUPOPUPEND: int +EVENT_SYSTEM_CAPTURESTART: int +EVENT_SYSTEM_CAPTUREEND: int +EVENT_SYSTEM_MOVESIZESTART: int +EVENT_SYSTEM_MOVESIZEEND: int +EVENT_SYSTEM_CONTEXTHELPSTART: int +EVENT_SYSTEM_CONTEXTHELPEND: int +EVENT_SYSTEM_DRAGDROPSTART: int +EVENT_SYSTEM_DRAGDROPEND: int +EVENT_SYSTEM_DIALOGSTART: int +EVENT_SYSTEM_DIALOGEND: int +EVENT_SYSTEM_SCROLLINGSTART: int +EVENT_SYSTEM_SCROLLINGEND: int +EVENT_SYSTEM_SWITCHSTART: int +EVENT_SYSTEM_SWITCHEND: int +EVENT_SYSTEM_MINIMIZESTART: int +EVENT_SYSTEM_MINIMIZEEND: int +EVENT_OBJECT_CREATE: int +EVENT_OBJECT_DESTROY: int +EVENT_OBJECT_SHOW: int +EVENT_OBJECT_HIDE: int +EVENT_OBJECT_REORDER: int +EVENT_OBJECT_FOCUS: int +EVENT_OBJECT_SELECTION: int +EVENT_OBJECT_SELECTIONADD: int +EVENT_OBJECT_SELECTIONREMOVE: int +EVENT_OBJECT_SELECTIONWITHIN: int +EVENT_OBJECT_STATECHANGE: int +EVENT_OBJECT_LOCATIONCHANGE: int +EVENT_OBJECT_NAMECHANGE: int +EVENT_OBJECT_DESCRIPTIONCHANGE: int +EVENT_OBJECT_VALUECHANGE: int +EVENT_OBJECT_PARENTCHANGE: int +EVENT_OBJECT_HELPCHANGE: int +EVENT_OBJECT_DEFACTIONCHANGE: int +EVENT_OBJECT_ACCELERATORCHANGE: int +SOUND_SYSTEM_STARTUP: int +SOUND_SYSTEM_SHUTDOWN: int +SOUND_SYSTEM_BEEP: int +SOUND_SYSTEM_ERROR: int +SOUND_SYSTEM_QUESTION: int +SOUND_SYSTEM_WARNING: int +SOUND_SYSTEM_INFORMATION: int +SOUND_SYSTEM_MAXIMIZE: int +SOUND_SYSTEM_MINIMIZE: int +SOUND_SYSTEM_RESTOREUP: int +SOUND_SYSTEM_RESTOREDOWN: int +SOUND_SYSTEM_APPSTART: int +SOUND_SYSTEM_FAULT: int +SOUND_SYSTEM_APPEND: int +SOUND_SYSTEM_MENUCOMMAND: int +SOUND_SYSTEM_MENUPOPUP: int +CSOUND_SYSTEM: int +ALERT_SYSTEM_INFORMATIONAL: int +ALERT_SYSTEM_WARNING: int +ALERT_SYSTEM_ERROR: int +ALERT_SYSTEM_QUERY: int +ALERT_SYSTEM_CRITICAL: int +CALERT_SYSTEM: int +WINEVENT_OUTOFCONTEXT: int +WINEVENT_SKIPOWNTHREAD: int +WINEVENT_SKIPOWNPROCESS: int +WINEVENT_INCONTEXT: int +GUI_CARETBLINKING: int +GUI_INMOVESIZE: int +GUI_INMENUMODE: int +GUI_SYSTEMMENUMODE: int +GUI_POPUPMENUMODE: int +STATE_SYSTEM_UNAVAILABLE: int +STATE_SYSTEM_SELECTED: int +STATE_SYSTEM_FOCUSED: int +STATE_SYSTEM_PRESSED: int +STATE_SYSTEM_CHECKED: int +STATE_SYSTEM_MIXED: int +STATE_SYSTEM_READONLY: int +STATE_SYSTEM_HOTTRACKED: int +STATE_SYSTEM_DEFAULT: int +STATE_SYSTEM_EXPANDED: int +STATE_SYSTEM_COLLAPSED: int +STATE_SYSTEM_BUSY: int +STATE_SYSTEM_FLOATING: int +STATE_SYSTEM_MARQUEED: int +STATE_SYSTEM_ANIMATED: int +STATE_SYSTEM_INVISIBLE: int +STATE_SYSTEM_OFFSCREEN: int +STATE_SYSTEM_SIZEABLE: int +STATE_SYSTEM_MOVEABLE: int +STATE_SYSTEM_SELFVOICING: int +STATE_SYSTEM_FOCUSABLE: int +STATE_SYSTEM_SELECTABLE: int +STATE_SYSTEM_LINKED: int +STATE_SYSTEM_TRAVERSED: int +STATE_SYSTEM_MULTISELECTABLE: int +STATE_SYSTEM_EXTSELECTABLE: int +STATE_SYSTEM_ALERT_LOW: int +STATE_SYSTEM_ALERT_MEDIUM: int +STATE_SYSTEM_ALERT_HIGH: int +STATE_SYSTEM_VALID: int +CCHILDREN_TITLEBAR: int +CCHILDREN_SCROLLBAR: int +CURSOR_SHOWING: int +WS_ACTIVECAPTION: int +GA_MIC: int +GA_PARENT: int +GA_ROOT: int +GA_ROOTOWNER: int +GA_MAC: int +BF_LEFT: int +BF_TOP: int +BF_RIGHT: int +BF_BOTTOM: int +BF_TOPLEFT: int +BF_TOPRIGHT: int +BF_BOTTOMLEFT: int +BF_BOTTOMRIGHT: int +BF_RECT: int +BF_DIAGONAL: int +BF_DIAGONAL_ENDTOPRIGHT: int +BF_DIAGONAL_ENDTOPLEFT: int +BF_DIAGONAL_ENDBOTTOMLEFT: int +BF_DIAGONAL_ENDBOTTOMRIGHT: int +BF_MIDDLE: int +BF_SOFT: int +BF_ADJUST: int +BF_FLAT: int +BF_MONO: int +DFC_CAPTION: int +DFC_MENU: int +DFC_SCROLL: int +DFC_BUTTON: int +DFC_POPUPMENU: int +DFCS_CAPTIONCLOSE: int +DFCS_CAPTIONMIN: int +DFCS_CAPTIONMAX: int +DFCS_CAPTIONRESTORE: int +DFCS_CAPTIONHELP: int +DFCS_MENUARROW: int +DFCS_MENUCHECK: int +DFCS_MENUBULLET: int +DFCS_MENUARROWRIGHT: int +DFCS_SCROLLUP: int +DFCS_SCROLLDOWN: int +DFCS_SCROLLLEFT: int +DFCS_SCROLLRIGHT: int +DFCS_SCROLLCOMBOBOX: int +DFCS_SCROLLSIZEGRIP: int +DFCS_SCROLLSIZEGRIPRIGHT: int +DFCS_BUTTONCHECK: int +DFCS_BUTTONRADIOIMAGE: int +DFCS_BUTTONRADIOMASK: int +DFCS_BUTTONRADIO: int +DFCS_BUTTON3STATE: int +DFCS_BUTTONPUSH: int +DFCS_INACTIVE: int +DFCS_PUSHED: int +DFCS_CHECKED: int +DFCS_TRANSPARENT: int +DFCS_HOT: int +DFCS_ADJUSTRECT: int +DFCS_FLAT: int +DFCS_MONO: int +DC_ACTIVE: int +DC_SMALLCAP: int +DC_ICON: int +DC_TEXT: int +DC_INBUTTON: int +DC_GRADIENT: int +IDANI_OPEN: int +IDANI_CLOSE: int +IDANI_CAPTION: int +CF_TEXT: int +CF_BITMAP: int +CF_METAFILEPICT: int +CF_SYLK: int +CF_DIF: int +CF_TIFF: int +CF_OEMTEXT: int +CF_DIB: int +CF_PALETTE: int +CF_PENDATA: int +CF_RIFF: int +CF_WAVE: int +CF_UNICODETEXT: int +CF_ENHMETAFILE: int +CF_HDROP: int +CF_LOCALE: int +CF_DIBV5: int +CF_MAX: int +CF_OWNERDISPLAY: int +CF_DSPTEXT: int +CF_DSPBITMAP: int +CF_DSPMETAFILEPICT: int +CF_DSPENHMETAFILE: int +CF_PRIVATEFIRST: int +CF_PRIVATELAST: int +CF_GDIOBJFIRST: int +CF_GDIOBJLAST: int +FVIRTKEY: int +FNOINVERT: int +FSHIFT: int +FCONTROL: int +FALT: int +WPF_SETMINPOSITION: int +WPF_RESTORETOMAXIMIZED: int +ODT_MENU: int +ODT_COMBOBOX: int +ODT_BUTTON: int +ODT_STATIC: int +ODA_DRAWENTIRE: int +ODA_SELECT: int +ODA_FOCUS: int +ODS_SELECTED: int +ODS_GRAYED: int +ODS_DISABLED: int +ODS_CHECKED: int +ODS_FOCUS: int +ODS_DEFAULT: int +ODS_COMBOBOXEDIT: int +ODS_HOTLIGHT: int +ODS_INACTIVE: int +PM_NOREMOVE: int +PM_REMOVE: int +PM_NOYIELD: int +MOD_ALT: int +MOD_CONTROL: int +MOD_SHIFT: int +MOD_WIN: int +IDHOT_SNAPWINDOW: int +IDHOT_SNAPDESKTOP: int +ENDSESSION_LOGOFF: int +EWX_LOGOFF: int +EWX_SHUTDOWN: int +EWX_REBOOT: int +EWX_FORCE: int +EWX_POWEROFF: int +EWX_FORCEIFHUNG: int +BSM_ALLCOMPONENTS: int +BSM_VXDS: int +BSM_NETDRIVER: int +BSM_INSTALLABLEDRIVERS: int +BSM_APPLICATIONS: int +BSM_ALLDESKTOPS: int +BSF_QUERY: int +BSF_IGNORECURRENTTASK: int +BSF_FLUSHDISK: int +BSF_NOHANG: int +BSF_POSTMESSAGE: int +BSF_FORCEIFHUNG: int +BSF_NOTIMEOUTIFNOTHUNG: int +BROADCAST_QUERY_DENY: int +DBWF_LPARAMPOINTER: int +SWP_NOSIZE: int +SWP_NOMOVE: int +SWP_NOZORDER: int +SWP_NOREDRAW: int +SWP_NOACTIVATE: int +SWP_FRAMECHANGED: int +SWP_SHOWWINDOW: int +SWP_HIDEWINDOW: int +SWP_NOCOPYBITS: int +SWP_NOOWNERZORDER: int +SWP_NOSENDCHANGING: int +SWP_DRAWFRAME: int +SWP_NOREPOSITION: int +SWP_DEFERERASE: int +SWP_ASYNCWINDOWPOS: int +DLGWINDOWEXTRA: int +KEYEVENTF_EXTENDEDKEY: int +KEYEVENTF_KEYUP: int +MOUSEEVENTF_MOVE: int +MOUSEEVENTF_LEFTDOWN: int +MOUSEEVENTF_LEFTUP: int +MOUSEEVENTF_RIGHTDOWN: int +MOUSEEVENTF_RIGHTUP: int +MOUSEEVENTF_MIDDLEDOWN: int +MOUSEEVENTF_MIDDLEUP: int +MOUSEEVENTF_ABSOLUTE: int +INPUT_MOUSE: int +INPUT_KEYBOARD: int +INPUT_HARDWARE: int +MWMO_WAITALL: int +MWMO_ALERTABLE: int +MWMO_INPUTAVAILABLE: int +QS_KEY: int +QS_MOUSEMOVE: int +QS_MOUSEBUTTON: int +QS_POSTMESSAGE: int +QS_TIMER: int +QS_PAINT: int +QS_SENDMESSAGE: int +QS_HOTKEY: int +QS_MOUSE: int +QS_INPUT: int +QS_ALLEVENTS: int +QS_ALLINPUT: int +IMN_CLOSESTATUSWINDOW: int +IMN_OPENSTATUSWINDOW: int +IMN_CHANGECANDIDATE: int +IMN_CLOSECANDIDATE: int +IMN_OPENCANDIDATE: int +IMN_SETCONVERSIONMODE: int +IMN_SETSENTENCEMODE: int +IMN_SETOPENSTATUS: int +IMN_SETCANDIDATEPOS: int +IMN_SETCOMPOSITIONFONT: int +IMN_SETCOMPOSITIONWINDOW: int +IMN_SETSTATUSWINDOWPOS: int +IMN_GUIDELINE: int +IMN_PRIVATE: int +HELP_CONTEXT: int +HELP_QUIT: int +HELP_INDEX: int +HELP_CONTENTS: int +HELP_HELPONHELP: int +HELP_SETINDEX: int +HELP_SETCONTENTS: int +HELP_CONTEXTPOPUP: int +HELP_FORCEFILE: int +HELP_KEY: int +HELP_COMMAND: int +HELP_PARTIALKEY: int +HELP_MULTIKEY: int +HELP_SETWINPOS: int +HELP_CONTEXTMENU: int +HELP_FINDER: int +HELP_WM_HELP: int +HELP_SETPOPUP_POS: int +HELP_TCARD: int +HELP_TCARD_DATA: int +HELP_TCARD_OTHER_CALLER: int +IDH_NO_HELP: int +IDH_MISSING_CONTEXT: int +IDH_GENERIC_HELP_BUTTON: int +IDH_OK: int +IDH_CANCEL: int +IDH_HELP: int +GR_GDIOBJECTS: int +GR_USEROBJECTS: int +SRCCOPY: int +SRCPAINT: int +SRCAND: int +SRCINVERT: int +SRCERASE: int +NOTSRCCOPY: int +NOTSRCERASE: int +MERGECOPY: int +MERGEPAINT: int +PATCOPY: int +PATPAINT: int +PATINVERT: int +DSTINVERT: int +BLACKNESS: int +WHITENESS: int +R2_BLACK: int +R2_NOTMERGEPEN: int +R2_MASKNOTPEN: int +R2_NOTCOPYPEN: int +R2_MASKPENNOT: int +R2_NOT: int +R2_XORPEN: int +R2_NOTMASKPEN: int +R2_MASKPEN: int +R2_NOTXORPEN: int +R2_NOP: int +R2_MERGENOTPEN: int +R2_COPYPEN: int +R2_MERGEPENNOT: int +R2_MERGEPEN: int +R2_WHITE: int +R2_LAST: int +GDI_ERROR: int +ERROR: int +NULLREGION: int +SIMPLEREGION: int +COMPLEXREGION: int +RGN_ERROR: int +RGN_AND: int +RGN_OR: int +RGN_XOR: int +RGN_DIFF: int +RGN_COPY: int +RGN_MIN: int +RGN_MAX: int +BLACKONWHITE: int +WHITEONBLACK: int +COLORONCOLOR: int +HALFTONE: int +MAXSTRETCHBLTMODE: int +STRETCH_ANDSCANS: int +STRETCH_ORSCANS: int +STRETCH_DELETESCANS: int +STRETCH_HALFTONE: int +ALTERNATE: int +WINDING: int +POLYFILL_LAST: int +LAYOUT_RTL: int +LAYOUT_BTT: int +LAYOUT_VBH: int +LAYOUT_ORIENTATIONMASK: int +LAYOUT_BITMAPORIENTATIONPRESERVED: int +TA_NOUPDATECP: int +TA_UPDATECP: int +TA_LEFT: int +TA_RIGHT: int +TA_CENTER: int +TA_TOP: int +TA_BOTTOM: int +TA_BASELINE: int +TA_MASK: int +VTA_BASELINE: int +VTA_LEFT: int +VTA_RIGHT: int +VTA_CENTER: int +VTA_BOTTOM: int +VTA_TOP: int +ETO_GRAYED: int +ETO_OPAQUE: int +ETO_CLIPPED: int +ASPECT_FILTERING: int +DCB_RESET: int +DCB_ACCUMULATE: int +DCB_DIRTY: int +DCB_SET: int +DCB_ENABLE: int +DCB_DISABLE: int +META_SETBKCOLOR: int +META_SETBKMODE: int +META_SETMAPMODE: int +META_SETROP2: int +META_SETRELABS: int +META_SETPOLYFILLMODE: int +META_SETSTRETCHBLTMODE: int +META_SETTEXTCHAREXTRA: int +META_SETTEXTCOLOR: int +META_SETTEXTJUSTIFICATION: int +META_SETWINDOWORG: int +META_SETWINDOWEXT: int +META_SETVIEWPORTORG: int +META_SETVIEWPORTEXT: int +META_OFFSETWINDOWORG: int +META_SCALEWINDOWEXT: int +META_OFFSETVIEWPORTORG: int +META_SCALEVIEWPORTEXT: int +META_LINETO: int +META_MOVETO: int +META_EXCLUDECLIPRECT: int +META_INTERSECTCLIPRECT: int +META_ARC: int +META_ELLIPSE: int +META_FLOODFILL: int +META_PIE: int +META_RECTANGLE: int +META_ROUNDRECT: int +META_PATBLT: int +META_SAVEDC: int +META_SETPIXEL: int +META_OFFSETCLIPRGN: int +META_TEXTOUT: int +META_BITBLT: int +META_STRETCHBLT: int +META_POLYGON: int +META_POLYLINE: int +META_ESCAPE: int +META_RESTOREDC: int +META_FILLREGION: int +META_FRAMEREGION: int +META_INVERTREGION: int +META_PAINTREGION: int +META_SELECTCLIPREGION: int +META_SELECTOBJECT: int +META_SETTEXTALIGN: int +META_CHORD: int +META_SETMAPPERFLAGS: int +META_EXTTEXTOUT: int +META_SETDIBTODEV: int +META_SELECTPALETTE: int +META_REALIZEPALETTE: int +META_ANIMATEPALETTE: int +META_SETPALENTRIES: int +META_POLYPOLYGON: int +META_RESIZEPALETTE: int +META_DIBBITBLT: int +META_DIBSTRETCHBLT: int +META_DIBCREATEPATTERNBRUSH: int +META_STRETCHDIB: int +META_EXTFLOODFILL: int +META_DELETEOBJECT: int +META_CREATEPALETTE: int +META_CREATEPATTERNBRUSH: int +META_CREATEPENINDIRECT: int +META_CREATEFONTINDIRECT: int +META_CREATEBRUSHINDIRECT: int +META_CREATEREGION: int +FILE_BEGIN: int +FILE_CURRENT: int +FILE_END: int +FILE_FLAG_WRITE_THROUGH: int +FILE_FLAG_OVERLAPPED: int +FILE_FLAG_NO_BUFFERING: int +FILE_FLAG_RANDOM_ACCESS: int +FILE_FLAG_SEQUENTIAL_SCAN: int +FILE_FLAG_DELETE_ON_CLOSE: int +FILE_FLAG_BACKUP_SEMANTICS: int +FILE_FLAG_POSIX_SEMANTICS: int +CREATE_NEW: int +CREATE_ALWAYS: int +OPEN_EXISTING: int +OPEN_ALWAYS: int +TRUNCATE_EXISTING: int +PIPE_ACCESS_INBOUND: int +PIPE_ACCESS_OUTBOUND: int +PIPE_ACCESS_DUPLEX: int +PIPE_CLIENT_END: int +PIPE_SERVER_END: int +PIPE_WAIT: int +PIPE_NOWAIT: int +PIPE_READMODE_BYTE: int +PIPE_READMODE_MESSAGE: int +PIPE_TYPE_BYTE: int +PIPE_TYPE_MESSAGE: int +PIPE_UNLIMITED_INSTANCES: int +SECURITY_CONTEXT_TRACKING: int +SECURITY_EFFECTIVE_ONLY: int +SECURITY_SQOS_PRESENT: int +SECURITY_VALID_SQOS_FLAGS: int +DTR_CONTROL_DISABLE: int +DTR_CONTROL_ENABLE: int +DTR_CONTROL_HANDSHAKE: int +RTS_CONTROL_DISABLE: int +RTS_CONTROL_ENABLE: int +RTS_CONTROL_HANDSHAKE: int +RTS_CONTROL_TOGGLE: int +GMEM_FIXED: int +GMEM_MOVEABLE: int +GMEM_NOCOMPACT: int +GMEM_NODISCARD: int +GMEM_ZEROINIT: int +GMEM_MODIFY: int +GMEM_DISCARDABLE: int +GMEM_NOT_BANKED: int +GMEM_SHARE: int +GMEM_DDESHARE: int +GMEM_NOTIFY: int +GMEM_LOWER: int +GMEM_VALID_FLAGS: int +GMEM_INVALID_HANDLE: int +GHND: int +GPTR: int +GMEM_DISCARDED: int +GMEM_LOCKCOUNT: int +LMEM_FIXED: int +LMEM_MOVEABLE: int +LMEM_NOCOMPACT: int +LMEM_NODISCARD: int +LMEM_ZEROINIT: int +LMEM_MODIFY: int +LMEM_DISCARDABLE: int +LMEM_VALID_FLAGS: int +LMEM_INVALID_HANDLE: int +LHND: int +LPTR: int +NONZEROLHND: int +NONZEROLPTR: int +LMEM_DISCARDED: int +LMEM_LOCKCOUNT: int +DEBUG_PROCESS: int +DEBUG_ONLY_THIS_PROCESS: int +CREATE_SUSPENDED: int +DETACHED_PROCESS: int +CREATE_NEW_CONSOLE: int +NORMAL_PRIORITY_CLASS: int +IDLE_PRIORITY_CLASS: int +HIGH_PRIORITY_CLASS: int +REALTIME_PRIORITY_CLASS: int +CREATE_NEW_PROCESS_GROUP: int +CREATE_UNICODE_ENVIRONMENT: int +CREATE_SEPARATE_WOW_VDM: int +CREATE_SHARED_WOW_VDM: int +CREATE_DEFAULT_ERROR_MODE: int +CREATE_NO_WINDOW: int +PROFILE_USER: int +PROFILE_KERNEL: int +PROFILE_SERVER: int +THREAD_BASE_PRIORITY_LOWRT: int +THREAD_BASE_PRIORITY_MAX: int +THREAD_BASE_PRIORITY_MIN: int +THREAD_BASE_PRIORITY_IDLE: int +THREAD_PRIORITY_LOWEST: int +THREAD_PRIORITY_BELOW_NORMAL: int +THREAD_PRIORITY_HIGHEST: int +THREAD_PRIORITY_ABOVE_NORMAL: int +THREAD_PRIORITY_ERROR_RETURN: int +THREAD_PRIORITY_TIME_CRITICAL: int +THREAD_PRIORITY_IDLE: int +THREAD_PRIORITY_NORMAL: int +THREAD_MODE_BACKGROUND_BEGIN: int +THREAD_MODE_BACKGROUND_END: int +EXCEPTION_DEBUG_EVENT: int +CREATE_THREAD_DEBUG_EVENT: int +CREATE_PROCESS_DEBUG_EVENT: int +EXIT_THREAD_DEBUG_EVENT: int +EXIT_PROCESS_DEBUG_EVENT: int +LOAD_DLL_DEBUG_EVENT: int +UNLOAD_DLL_DEBUG_EVENT: int +OUTPUT_DEBUG_STRING_EVENT: int +RIP_EVENT: int +DRIVE_UNKNOWN: int +DRIVE_NO_ROOT_DIR: int +DRIVE_REMOVABLE: int +DRIVE_FIXED: int +DRIVE_REMOTE: int +DRIVE_CDROM: int +DRIVE_RAMDISK: int +FILE_TYPE_UNKNOWN: int +FILE_TYPE_DISK: int +FILE_TYPE_CHAR: int +FILE_TYPE_PIPE: int +FILE_TYPE_REMOTE: int +NOPARITY: int +ODDPARITY: int +EVENPARITY: int +MARKPARITY: int +SPACEPARITY: int +ONESTOPBIT: int +ONE5STOPBITS: int +TWOSTOPBITS: int +CBR_110: int +CBR_300: int +CBR_600: int +CBR_1200: int +CBR_2400: int +CBR_4800: int +CBR_9600: int +CBR_14400: int +CBR_19200: int +CBR_38400: int +CBR_56000: int +CBR_57600: int +CBR_115200: int +CBR_128000: int +CBR_256000: int +S_QUEUEEMPTY: int +S_THRESHOLD: int +S_ALLTHRESHOLD: int +S_NORMAL: int +S_LEGATO: int +S_STACCATO: int +NMPWAIT_WAIT_FOREVER: int +NMPWAIT_NOWAIT: int +NMPWAIT_USE_DEFAULT_WAIT: int +OF_READ: int +OF_WRITE: int +OF_READWRITE: int +OF_SHARE_COMPAT: int +OF_SHARE_EXCLUSIVE: int +OF_SHARE_DENY_WRITE: int +OF_SHARE_DENY_READ: int +OF_SHARE_DENY_NONE: int +OF_PARSE: int +OF_DELETE: int +OF_VERIFY: int +OF_CANCEL: int +OF_CREATE: int +OF_PROMPT: int +OF_EXIST: int +OF_REOPEN: int +OFS_MAXPATHNAME: int +MAXINTATOM: int +PROCESS_HEAP_REGION: int +PROCESS_HEAP_UNCOMMITTED_RANGE: int +PROCESS_HEAP_ENTRY_BUSY: int +PROCESS_HEAP_ENTRY_MOVEABLE: int +PROCESS_HEAP_ENTRY_DDESHARE: int +SCS_32BIT_BINARY: int +SCS_DOS_BINARY: int +SCS_WOW_BINARY: int +SCS_PIF_BINARY: int +SCS_POSIX_BINARY: int +SCS_OS216_BINARY: int +SEM_FAILCRITICALERRORS: int +SEM_NOGPFAULTERRORBOX: int +SEM_NOALIGNMENTFAULTEXCEPT: int +SEM_NOOPENFILEERRORBOX: int +LOCKFILE_FAIL_IMMEDIATELY: int +LOCKFILE_EXCLUSIVE_LOCK: int +HANDLE_FLAG_INHERIT: int +HANDLE_FLAG_PROTECT_FROM_CLOSE: int +HINSTANCE_ERROR: int +GET_TAPE_MEDIA_INFORMATION: int +GET_TAPE_DRIVE_INFORMATION: int +SET_TAPE_MEDIA_INFORMATION: int +SET_TAPE_DRIVE_INFORMATION: int +FORMAT_MESSAGE_ALLOCATE_BUFFER: int +FORMAT_MESSAGE_IGNORE_INSERTS: int +FORMAT_MESSAGE_FROM_STRING: int +FORMAT_MESSAGE_FROM_HMODULE: int +FORMAT_MESSAGE_FROM_SYSTEM: int +FORMAT_MESSAGE_ARGUMENT_ARRAY: int +FORMAT_MESSAGE_MAX_WIDTH_MASK: int +BACKUP_INVALID: int +BACKUP_DATA: int +BACKUP_EA_DATA: int +BACKUP_SECURITY_DATA: int +BACKUP_ALTERNATE_DATA: int +BACKUP_LINK: int +BACKUP_PROPERTY_DATA: int +BACKUP_OBJECT_ID: int +BACKUP_REPARSE_DATA: int +BACKUP_SPARSE_BLOCK: int +STREAM_NORMAL_ATTRIBUTE: int +STREAM_MODIFIED_WHEN_READ: int +STREAM_CONTAINS_SECURITY: int +STREAM_CONTAINS_PROPERTIES: int +STARTF_USESHOWWINDOW: int +STARTF_USESIZE: int +STARTF_USEPOSITION: int +STARTF_USECOUNTCHARS: int +STARTF_USEFILLATTRIBUTE: int +STARTF_FORCEONFEEDBACK: int +STARTF_FORCEOFFFEEDBACK: int +STARTF_USESTDHANDLES: int +STARTF_USEHOTKEY: int +SHUTDOWN_NORETRY: int +DONT_RESOLVE_DLL_REFERENCES: int +LOAD_LIBRARY_AS_DATAFILE: int +LOAD_WITH_ALTERED_SEARCH_PATH: int +DDD_RAW_TARGET_PATH: int +DDD_REMOVE_DEFINITION: int +DDD_EXACT_MATCH_ON_REMOVE: int +MOVEFILE_REPLACE_EXISTING: int +MOVEFILE_COPY_ALLOWED: int +MOVEFILE_DELAY_UNTIL_REBOOT: int +MAX_COMPUTERNAME_LENGTH: int +LOGON32_LOGON_INTERACTIVE: int +LOGON32_LOGON_NETWORK: int +LOGON32_LOGON_BATCH: int +LOGON32_LOGON_SERVICE: int +LOGON32_LOGON_UNLOCK: int +LOGON32_LOGON_NETWORK_CLEARTEXT: int +LOGON32_LOGON_NEW_CREDENTIALS: int +LOGON32_PROVIDER_DEFAULT: int +LOGON32_PROVIDER_WINNT35: int +LOGON32_PROVIDER_WINNT40: int +LOGON32_PROVIDER_WINNT50: int +VER_PLATFORM_WIN32s: int +VER_PLATFORM_WIN32_WINDOWS: int +VER_PLATFORM_WIN32_NT: int +TC_NORMAL: int +TC_HARDERR: int +TC_GP_TRAP: int +TC_SIGNAL: int +AC_LINE_OFFLINE: int +AC_LINE_ONLINE: int +AC_LINE_BACKUP_POWER: int +AC_LINE_UNKNOWN: int +BATTERY_FLAG_HIGH: int +BATTERY_FLAG_LOW: int +BATTERY_FLAG_CRITICAL: int +BATTERY_FLAG_CHARGING: int +BATTERY_FLAG_NO_BATTERY: int +BATTERY_FLAG_UNKNOWN: int +BATTERY_PERCENTAGE_UNKNOWN: int +BATTERY_LIFE_UNKNOWN: int +cchTextLimitDefault: int +EN_MSGFILTER: int +EN_REQUESTRESIZE: int +EN_SELCHANGE: int +EN_DROPFILES: int +EN_PROTECTED: int +EN_CORRECTTEXT: int +EN_STOPNOUNDO: int +EN_IMECHANGE: int +EN_SAVECLIPBOARD: int +EN_OLEOPFAILED: int +ENM_NONE: int +ENM_CHANGE: int +ENM_UPDATE: int +ENM_SCROLL: int +ENM_KEYEVENTS: int +ENM_MOUSEEVENTS: int +ENM_REQUESTRESIZE: int +ENM_SELCHANGE: int +ENM_DROPFILES: int +ENM_PROTECTED: int +ENM_CORRECTTEXT: int +ENM_IMECHANGE: int +ES_SAVESEL: int +ES_SUNKEN: int +ES_DISABLENOSCROLL: int +ES_SELECTIONBAR: int +ES_EX_NOCALLOLEINIT: int +ES_VERTICAL: int +ES_NOIME: int +ES_SELFIME: int +ECO_AUTOWORDSELECTION: int +ECO_AUTOVSCROLL: int +ECO_AUTOHSCROLL: int +ECO_NOHIDESEL: int +ECO_READONLY: int +ECO_WANTRETURN: int +ECO_SAVESEL: int +ECO_SELECTIONBAR: int +ECO_VERTICAL: int +ECOOP_SET: int +ECOOP_OR: int +ECOOP_AND: int +ECOOP_XOR: int +WB_CLASSIFY: int +WB_MOVEWORDLEFT: int +WB_MOVEWORDRIGHT: int +WB_LEFTBREAK: int +WB_RIGHTBREAK: int +WB_MOVEWORDPREV: int +WB_MOVEWORDNEXT: int +WB_PREVBREAK: int +WB_NEXTBREAK: int +PC_FOLLOWING: int +PC_LEADING: int +PC_OVERFLOW: int +PC_DELIMITER: int +WBF_WORDWRAP: int +WBF_WORDBREAK: int +WBF_OVERFLOW: int +WBF_LEVEL1: int +WBF_LEVEL2: int +WBF_CUSTOM: int +CFM_BOLD: int +CFM_ITALIC: int +CFM_UNDERLINE: int +CFM_STRIKEOUT: int +CFM_PROTECTED: int +CFM_SIZE: int +CFM_COLOR: int +CFM_FACE: int +CFM_OFFSET: int +CFM_CHARSET: int +CFE_BOLD: int +CFE_ITALIC: int +CFE_UNDERLINE: int +CFE_STRIKEOUT: int +CFE_PROTECTED: int +CFE_AUTOCOLOR: int +yHeightCharPtsMost: int +SCF_SELECTION: int +SCF_WORD: int +SF_TEXT: int +SF_RTF: int +SF_RTFNOOBJS: int +SF_TEXTIZED: int +SFF_SELECTION: int +SFF_PLAINRTF: int +MAX_TAB_STOPS: int +lDefaultTab: int +PFM_STARTINDENT: int +PFM_RIGHTINDENT: int +PFM_OFFSET: int +PFM_ALIGNMENT: int +PFM_TABSTOPS: int +PFM_NUMBERING: int +PFM_OFFSETINDENT: int +PFN_BULLET: int +PFA_LEFT: int +PFA_RIGHT: int +PFA_CENTER: int +SEL_EMPTY: int +SEL_TEXT: int +SEL_OBJECT: int +SEL_MULTICHAR: int +SEL_MULTIOBJECT: int +OLEOP_DOVERB: int +CF_RTF: str +CF_RTFNOOBJS: str +CF_RETEXTOBJ: str +RIGHT_ALT_PRESSED: int +LEFT_ALT_PRESSED: int +RIGHT_CTRL_PRESSED: int +LEFT_CTRL_PRESSED: int +SHIFT_PRESSED: int +NUMLOCK_ON: int +SCROLLLOCK_ON: int +CAPSLOCK_ON: int +ENHANCED_KEY: int +NLS_DBCSCHAR: int +NLS_ALPHANUMERIC: int +NLS_KATAKANA: int +NLS_HIRAGANA: int +NLS_ROMAN: int +NLS_IME_CONVERSION: int +NLS_IME_DISABLE: int +FROM_LEFT_1ST_BUTTON_PRESSED: int +RIGHTMOST_BUTTON_PRESSED: int +FROM_LEFT_2ND_BUTTON_PRESSED: int +FROM_LEFT_3RD_BUTTON_PRESSED: int +FROM_LEFT_4TH_BUTTON_PRESSED: int +CTRL_C_EVENT: int +CTRL_BREAK_EVENT: int +CTRL_CLOSE_EVENT: int +CTRL_LOGOFF_EVENT: int +CTRL_SHUTDOWN_EVENT: int +MOUSE_MOVED: int +DOUBLE_CLICK: int +MOUSE_WHEELED: int +PSM_SETCURSEL: int +PSM_REMOVEPAGE: int +PSM_ADDPAGE: int +PSM_CHANGED: int +PSM_RESTARTWINDOWS: int +PSM_REBOOTSYSTEM: int +PSM_CANCELTOCLOSE: int +PSM_QUERYSIBLINGS: int +PSM_UNCHANGED: int +PSM_APPLY: int +PSM_SETTITLEA: int +PSM_SETTITLEW: int +PSM_SETWIZBUTTONS: int +PSM_PRESSBUTTON: int +PSM_SETCURSELID: int +PSM_SETFINISHTEXTA: int +PSM_SETFINISHTEXTW: int +PSM_GETTABCONTROL: int +PSM_ISDIALOGMESSAGE: int +PSM_GETCURRENTPAGEHWND: int +PSM_INSERTPAGE: int +PSM_SETHEADERTITLEA: int +PSM_SETHEADERTITLEW: int +PSM_SETHEADERSUBTITLEA: int +PSM_SETHEADERSUBTITLEW: int +PSM_HWNDTOINDEX: int +PSM_INDEXTOHWND: int +PSM_PAGETOINDEX: int +PSM_INDEXTOPAGE: int +PSM_IDTOINDEX: int +PSM_INDEXTOID: int +PSM_GETRESULT: int +PSM_RECALCPAGESIZES: int +NameUnknown: int +NameFullyQualifiedDN: int +NameSamCompatible: int +NameDisplay: int +NameUniqueId: int +NameCanonical: int +NameUserPrincipal: int +NameCanonicalEx: int +NameServicePrincipal: int +NameDnsDomain: int +ComputerNameNetBIOS: int +ComputerNameDnsHostname: int +ComputerNameDnsDomain: int +ComputerNameDnsFullyQualified: int +ComputerNamePhysicalNetBIOS: int +ComputerNamePhysicalDnsHostname: int +ComputerNamePhysicalDnsDomain: int +ComputerNamePhysicalDnsFullyQualified: int +LWA_COLORKEY: int +LWA_ALPHA: int +ULW_COLORKEY: int +ULW_ALPHA: int +ULW_OPAQUE: int +TRUE: int +FALSE: int +MAX_PATH: int +AC_SRC_OVER: int +AC_SRC_ALPHA: int +GRADIENT_FILL_RECT_H: int +GRADIENT_FILL_RECT_V: int +GRADIENT_FILL_TRIANGLE: int +GRADIENT_FILL_OP_FLAG: int +MM_WORKING_SET_MAX_HARD_ENABLE: int +MM_WORKING_SET_MAX_HARD_DISABLE: int +MM_WORKING_SET_MIN_HARD_ENABLE: int +MM_WORKING_SET_MIN_HARD_DISABLE: int +VOLUME_NAME_DOS: int +VOLUME_NAME_GUID: int +VOLUME_NAME_NT: int +VOLUME_NAME_NONE: int +FILE_NAME_NORMALIZED: int +FILE_NAME_OPENED: int +DEVICE_NOTIFY_WINDOW_HANDLE: int +DEVICE_NOTIFY_SERVICE_HANDLE: int +BSF_MSGSRV32ISOK: int +BSF_MSGSRV32ISOK_BIT: int +DBT_APPYEND: int +DBT_DEVNODES_CHANGED: int +DBT_QUERYCHANGECONFIG: int +DBT_CONFIGCHANGED: int +DBT_CONFIGCHANGECANCELED: int +DBT_MONITORCHANGE: int +DBT_SHELLLOGGEDON: int +DBT_CONFIGMGAPI32: int +DBT_VXDINITCOMPLETE: int +DBT_VOLLOCKQUERYLOCK: int +DBT_VOLLOCKLOCKTAKEN: int +DBT_VOLLOCKLOCKFAILED: int +DBT_VOLLOCKQUERYUNLOCK: int +DBT_VOLLOCKLOCKRELEASED: int +DBT_VOLLOCKUNLOCKFAILED: int +LOCKP_ALLOW_WRITES: int +LOCKP_FAIL_WRITES: int +LOCKP_FAIL_MEM_MAPPING: int +LOCKP_ALLOW_MEM_MAPPING: int +LOCKP_USER_MASK: int +LOCKP_LOCK_FOR_FORMAT: int +LOCKF_LOGICAL_LOCK: int +LOCKF_PHYSICAL_LOCK: int +DBT_NO_DISK_SPACE: int +DBT_LOW_DISK_SPACE: int +DBT_CONFIGMGPRIVATE: int +DBT_DEVICEARRIVAL: int +DBT_DEVICEQUERYREMOVE: int +DBT_DEVICEQUERYREMOVEFAILED: int +DBT_DEVICEREMOVEPENDING: int +DBT_DEVICEREMOVECOMPLETE: int +DBT_DEVICETYPESPECIFIC: int +DBT_CUSTOMEVENT: int +DBT_DEVTYP_OEM: int +DBT_DEVTYP_DEVNODE: int +DBT_DEVTYP_VOLUME: int +DBT_DEVTYP_PORT: int +DBT_DEVTYP_NET: int +DBT_DEVTYP_DEVICEINTERFACE: int +DBT_DEVTYP_HANDLE: int +DBTF_MEDIA: int +DBTF_NET: int +DBTF_RESOURCE: int +DBTF_XPORT: int +DBTF_SLOWNET: int +DBT_VPOWERDAPI: int +DBT_USERDEFINED: int +CBS_DROPDOWNLIST: int +CDM_GETFOLDERIDLIST: int +CTLCOLOR_LISTBOX: int +DBT_APPYBEGIN: int +FILE_NAMED_STREAMS: int +FILE_READ_ONLY_VOLUME: int +FILE_SEQUENTIAL_WRITE_ONCE: int +FILE_SUPPORTS_ENCRYPTION: int +FILE_SUPPORTS_EXTENDED_ATTRIBUTES: int +FILE_SUPPORTS_HARD_LINKS: int +FILE_SUPPORTS_OBJECT_IDS: int +FILE_SUPPORTS_OPEN_BY_FILE_ID: int +FILE_SUPPORTS_REPARSE_POINTS: int +FILE_SUPPORTS_SPARSE_FILES: int +FILE_SUPPORTS_TRANSACTIONS: int +FILE_SUPPORTS_USN_JOURNAL: int +FILE_VOLUME_QUOTAS: int +KEYEVENTF_SCANCODE: int +KEYEVENTF_UNICODE: int +MOUSEEVENTF_HWHEEL: int +MOUSEEVENTF_MOVE_NOCOALESCE: int +MOUSEEVENTF_VIRTUALDESK: int +ODT_LISTBOX: int +REG_RESOURCE_LIST: int +REG_RESOURCE_REQUIREMENTS_LIST: int +SC_TASKLIST: int +SPI_GETLISTBOXSMOOTHSCROLLING: int +SPI_SETLISTBOXSMOOTHSCROLLING: int +WM_CTLCOLORLISTBOX: int diff --git a/stubs/pywin32/win32/lib/win32cryptcon.pyi b/stubs/pywin32/win32/lib/win32cryptcon.pyi new file mode 100644 index 0000000..c3865ab --- /dev/null +++ b/stubs/pywin32/win32/lib/win32cryptcon.pyi @@ -0,0 +1,1790 @@ +def GET_ALG_CLASS(x: int) -> int: ... +def GET_ALG_TYPE(x: int) -> int: ... +def GET_ALG_SID(x: int) -> int: ... + +ALG_CLASS_ANY: int +ALG_CLASS_SIGNATURE: int +ALG_CLASS_MSG_ENCRYPT: int +ALG_CLASS_DATA_ENCRYPT: int +ALG_CLASS_HASH: int +ALG_CLASS_KEY_EXCHANGE: int +ALG_CLASS_ALL: int +ALG_TYPE_ANY: int +ALG_TYPE_DSS: int +ALG_TYPE_RSA: int +ALG_TYPE_BLOCK: int +ALG_TYPE_STREAM: int +ALG_TYPE_DH: int +ALG_TYPE_SECURECHANNEL: int +ALG_SID_ANY: int +ALG_SID_RSA_ANY: int +ALG_SID_RSA_PKCS: int +ALG_SID_RSA_MSATWORK: int +ALG_SID_RSA_ENTRUST: int +ALG_SID_RSA_PGP: int +ALG_SID_DSS_ANY: int +ALG_SID_DSS_PKCS: int +ALG_SID_DSS_DMS: int +ALG_SID_DES: int +ALG_SID_3DES: int +ALG_SID_DESX: int +ALG_SID_IDEA: int +ALG_SID_CAST: int +ALG_SID_SAFERSK64: int +ALG_SID_SAFERSK128: int +ALG_SID_3DES_112: int +ALG_SID_CYLINK_MEK: int +ALG_SID_RC5: int +ALG_SID_AES_128: int +ALG_SID_AES_192: int +ALG_SID_AES_256: int +ALG_SID_AES: int +ALG_SID_SKIPJACK: int +ALG_SID_TEK: int +CRYPT_MODE_CBCI: int +CRYPT_MODE_CFBP: int +CRYPT_MODE_OFBP: int +CRYPT_MODE_CBCOFM: int +CRYPT_MODE_CBCOFMI: int +ALG_SID_RC2: int +ALG_SID_RC4: int +ALG_SID_SEAL: int +ALG_SID_DH_SANDF: int +ALG_SID_DH_EPHEM: int +ALG_SID_AGREED_KEY_ANY: int +ALG_SID_KEA: int +ALG_SID_MD2: int +ALG_SID_MD4: int +ALG_SID_MD5: int +ALG_SID_SHA: int +ALG_SID_SHA1: int +ALG_SID_MAC: int +ALG_SID_RIPEMD: int +ALG_SID_RIPEMD160: int +ALG_SID_SSL3SHAMD5: int +ALG_SID_HMAC: int +ALG_SID_TLS1PRF: int +ALG_SID_HASH_REPLACE_OWF: int +ALG_SID_SHA_256: int +ALG_SID_SHA_384: int +ALG_SID_SHA_512: int +ALG_SID_SSL3_MASTER: int +ALG_SID_SCHANNEL_MASTER_HASH: int +ALG_SID_SCHANNEL_MAC_KEY: int +ALG_SID_PCT1_MASTER: int +ALG_SID_SSL2_MASTER: int +ALG_SID_TLS1_MASTER: int +ALG_SID_SCHANNEL_ENC_KEY: int +ALG_SID_EXAMPLE: int +CALG_MD2: int +CALG_MD4: int +CALG_MD5: int +CALG_SHA: int +CALG_SHA1: int +CALG_MAC: int +CALG_RSA_SIGN: int +CALG_DSS_SIGN: int +CALG_NO_SIGN: int +CALG_RSA_KEYX: int +CALG_DES: int +CALG_3DES_112: int +CALG_3DES: int +CALG_DESX: int +CALG_RC2: int +CALG_RC4: int +CALG_SEAL: int +CALG_DH_SF: int +CALG_DH_EPHEM: int +CALG_AGREEDKEY_ANY: int +CALG_KEA_KEYX: int +CALG_HUGHES_MD5: int +CALG_SKIPJACK: int +CALG_TEK: int +CALG_CYLINK_MEK: int +CALG_SSL3_SHAMD5: int +CALG_SSL3_MASTER: int +CALG_SCHANNEL_MASTER_HASH: int +CALG_SCHANNEL_MAC_KEY: int +CALG_SCHANNEL_ENC_KEY: int +CALG_PCT1_MASTER: int +CALG_SSL2_MASTER: int +CALG_TLS1_MASTER: int +CALG_RC5: int +CALG_HMAC: int +CALG_TLS1PRF: int +CALG_HASH_REPLACE_OWF: int +CALG_AES_128: int +CALG_AES_192: int +CALG_AES_256: int +CALG_AES: int +CALG_SHA_256: int +CALG_SHA_384: int +CALG_SHA_512: int +CRYPT_VERIFYCONTEXT: int +CRYPT_NEWKEYSET: int +CRYPT_DELETEKEYSET: int +CRYPT_MACHINE_KEYSET: int +CRYPT_SILENT: int +CRYPT_EXPORTABLE: int +CRYPT_USER_PROTECTED: int +CRYPT_CREATE_SALT: int +CRYPT_UPDATE_KEY: int +CRYPT_NO_SALT: int +CRYPT_PREGEN: int +CRYPT_RECIPIENT: int +CRYPT_INITIATOR: int +CRYPT_ONLINE: int +CRYPT_SF: int +CRYPT_CREATE_IV: int +CRYPT_KEK: int +CRYPT_DATA_KEY: int +CRYPT_VOLATILE: int +CRYPT_SGCKEY: int +CRYPT_ARCHIVABLE: int +RSA1024BIT_KEY: int +CRYPT_SERVER: int +KEY_LENGTH_MASK: int +CRYPT_Y_ONLY: int +CRYPT_SSL2_FALLBACK: int +CRYPT_DESTROYKEY: int +CRYPT_OAEP: int +CRYPT_BLOB_VER3: int +CRYPT_IPSEC_HMAC_KEY: int +CRYPT_DECRYPT_RSA_NO_PADDING_CHECK: int +CRYPT_SECRETDIGEST: int +CRYPT_OWF_REPL_LM_HASH: int +CRYPT_LITTLE_ENDIAN: int +CRYPT_NOHASHOID: int +CRYPT_TYPE2_FORMAT: int +CRYPT_X931_FORMAT: int +CRYPT_MACHINE_DEFAULT: int +CRYPT_USER_DEFAULT: int +CRYPT_DELETE_DEFAULT: int +SIMPLEBLOB: int +PUBLICKEYBLOB: int +PRIVATEKEYBLOB: int +PLAINTEXTKEYBLOB: int +OPAQUEKEYBLOB: int +PUBLICKEYBLOBEX: int +SYMMETRICWRAPKEYBLOB: int +AT_KEYEXCHANGE: int +AT_SIGNATURE: int +CRYPT_USERDATA: int +KP_IV: int +KP_SALT: int +KP_PADDING: int +KP_MODE: int +KP_MODE_BITS: int +KP_PERMISSIONS: int +KP_ALGID: int +KP_BLOCKLEN: int +KP_KEYLEN: int +KP_SALT_EX: int +KP_P: int +KP_G: int +KP_Q: int +KP_X: int +KP_Y: int +KP_RA: int +KP_RB: int +KP_INFO: int +KP_EFFECTIVE_KEYLEN: int +KP_SCHANNEL_ALG: int +KP_CLIENT_RANDOM: int +KP_SERVER_RANDOM: int +KP_RP: int +KP_PRECOMP_MD5: int +KP_PRECOMP_SHA: int +KP_CERTIFICATE: int +KP_CLEAR_KEY: int +KP_PUB_EX_LEN: int +KP_PUB_EX_VAL: int +KP_KEYVAL: int +KP_ADMIN_PIN: int +KP_KEYEXCHANGE_PIN: int +KP_SIGNATURE_PIN: int +KP_PREHASH: int +KP_ROUNDS: int +KP_OAEP_PARAMS: int +KP_CMS_KEY_INFO: int +KP_CMS_DH_KEY_INFO: int +KP_PUB_PARAMS: int +KP_VERIFY_PARAMS: int +KP_HIGHEST_VERSION: int +KP_GET_USE_COUNT: int +PKCS5_PADDING: int +RANDOM_PADDING: int +ZERO_PADDING: int +CRYPT_MODE_CBC: int +CRYPT_MODE_ECB: int +CRYPT_MODE_OFB: int +CRYPT_MODE_CFB: int +CRYPT_MODE_CTS: int +CRYPT_ENCRYPT: int +CRYPT_DECRYPT: int +CRYPT_EXPORT: int +CRYPT_READ: int +CRYPT_WRITE: int +CRYPT_MAC: int +CRYPT_EXPORT_KEY: int +CRYPT_IMPORT_KEY: int +CRYPT_ARCHIVE: int +HP_ALGID: int +HP_HASHVAL: int +HP_HASHSIZE: int +HP_HMAC_INFO: int +HP_TLS1PRF_LABEL: int +HP_TLS1PRF_SEED: int +CRYPT_FAILED: int +CRYPT_SUCCEED: int + +def RCRYPT_SUCCEEDED(rt: int) -> bool: ... +def RCRYPT_FAILED(rt: int) -> bool: ... + +PP_ENUMALGS: int +PP_ENUMCONTAINERS: int +PP_IMPTYPE: int +PP_NAME: int +PP_VERSION: int +PP_CONTAINER: int +PP_CHANGE_PASSWORD: int +PP_KEYSET_SEC_DESCR: int +PP_CERTCHAIN: int +PP_KEY_TYPE_SUBTYPE: int +PP_PROVTYPE: int +PP_KEYSTORAGE: int +PP_APPLI_CERT: int +PP_SYM_KEYSIZE: int +PP_SESSION_KEYSIZE: int +PP_UI_PROMPT: int +PP_ENUMALGS_EX: int +PP_ENUMMANDROOTS: int +PP_ENUMELECTROOTS: int +PP_KEYSET_TYPE: int +PP_ADMIN_PIN: int +PP_KEYEXCHANGE_PIN: int +PP_SIGNATURE_PIN: int +PP_SIG_KEYSIZE_INC: int +PP_KEYX_KEYSIZE_INC: int +PP_UNIQUE_CONTAINER: int +PP_SGC_INFO: int +PP_USE_HARDWARE_RNG: int +PP_KEYSPEC: int +PP_ENUMEX_SIGNING_PROT: int +PP_CRYPT_COUNT_KEY_USE: int +CRYPT_FIRST: int +CRYPT_NEXT: int +CRYPT_SGC_ENUM: int +CRYPT_IMPL_HARDWARE: int +CRYPT_IMPL_SOFTWARE: int +CRYPT_IMPL_MIXED: int +CRYPT_IMPL_UNKNOWN: int +CRYPT_IMPL_REMOVABLE: int +CRYPT_SEC_DESCR: int +CRYPT_PSTORE: int +CRYPT_UI_PROMPT: int +CRYPT_FLAG_PCT1: int +CRYPT_FLAG_SSL2: int +CRYPT_FLAG_SSL3: int +CRYPT_FLAG_TLS1: int +CRYPT_FLAG_IPSEC: int +CRYPT_FLAG_SIGNING: int +CRYPT_SGC: int +CRYPT_FASTSGC: int +PP_CLIENT_HWND: int +PP_CONTEXT_INFO: int +PP_KEYEXCHANGE_KEYSIZE: int +PP_SIGNATURE_KEYSIZE: int +PP_KEYEXCHANGE_ALG: int +PP_SIGNATURE_ALG: int +PP_DELETEKEY: int +PROV_RSA_FULL: int +PROV_RSA_SIG: int +PROV_DSS: int +PROV_FORTEZZA: int +PROV_MS_EXCHANGE: int +PROV_SSL: int +PROV_RSA_SCHANNEL: int +PROV_DSS_DH: int +PROV_EC_ECDSA_SIG: int +PROV_EC_ECNRA_SIG: int +PROV_EC_ECDSA_FULL: int +PROV_EC_ECNRA_FULL: int +PROV_DH_SCHANNEL: int +PROV_SPYRUS_LYNKS: int +PROV_RNG: int +PROV_INTEL_SEC: int +PROV_REPLACE_OWF: int +PROV_RSA_AES: int +MS_DEF_PROV_A: str +MS_DEF_PROV: str +MS_ENHANCED_PROV_A: str +MS_ENHANCED_PROV: str +MS_STRONG_PROV_A: str +MS_STRONG_PROV: str +MS_DEF_RSA_SIG_PROV_A: str +MS_DEF_RSA_SIG_PROV: str +MS_DEF_RSA_SCHANNEL_PROV_A: str +MS_DEF_RSA_SCHANNEL_PROV: str +MS_DEF_DSS_PROV_A: str +MS_DEF_DSS_PROV: str +MS_DEF_DSS_DH_PROV_A: str +MS_DEF_DSS_DH_PROV: str +MS_ENH_DSS_DH_PROV_A: str +MS_ENH_DSS_DH_PROV: str +MS_DEF_DH_SCHANNEL_PROV_A: str +MS_DEF_DH_SCHANNEL_PROV: str +MS_SCARD_PROV_A: str +MS_SCARD_PROV: str +MS_ENH_RSA_AES_PROV_A: str +MS_ENH_RSA_AES_PROV: str +MAXUIDLEN: int +EXPO_OFFLOAD_REG_VALUE: str +EXPO_OFFLOAD_FUNC_NAME: str +szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS: str +szFORCE_KEY_PROTECTION: str +dwFORCE_KEY_PROTECTION_DISABLED: int +dwFORCE_KEY_PROTECTION_USER_SELECT: int +dwFORCE_KEY_PROTECTION_HIGH: int +szKEY_CACHE_ENABLED: str +szKEY_CACHE_SECONDS: str +CUR_BLOB_VERSION: int +SCHANNEL_MAC_KEY: int +SCHANNEL_ENC_KEY: int +INTERNATIONAL_USAGE: int +szOID_RSA: str +szOID_PKCS: str +szOID_RSA_HASH: str +szOID_RSA_ENCRYPT: str +szOID_PKCS_1: str +szOID_PKCS_2: str +szOID_PKCS_3: str +szOID_PKCS_4: str +szOID_PKCS_5: str +szOID_PKCS_6: str +szOID_PKCS_7: str +szOID_PKCS_8: str +szOID_PKCS_9: str +szOID_PKCS_10: str +szOID_PKCS_12: str +szOID_RSA_RSA: str +szOID_RSA_MD2RSA: str +szOID_RSA_MD4RSA: str +szOID_RSA_MD5RSA: str +szOID_RSA_SHA1RSA: str +szOID_RSA_SETOAEP_RSA: str +szOID_RSA_DH: str +szOID_RSA_data: str +szOID_RSA_signedData: str +szOID_RSA_envelopedData: str +szOID_RSA_signEnvData: str +szOID_RSA_digestedData: str +szOID_RSA_hashedData: str +szOID_RSA_encryptedData: str +szOID_RSA_emailAddr: str +szOID_RSA_unstructName: str +szOID_RSA_contentType: str +szOID_RSA_messageDigest: str +szOID_RSA_signingTime: str +szOID_RSA_counterSign: str +szOID_RSA_challengePwd: str +szOID_RSA_unstructAddr: str +szOID_RSA_extCertAttrs: str +szOID_RSA_certExtensions: str +szOID_RSA_SMIMECapabilities: str +szOID_RSA_preferSignedData: str +szOID_RSA_SMIMEalg: str +szOID_RSA_SMIMEalgESDH: str +szOID_RSA_SMIMEalgCMS3DESwrap: str +szOID_RSA_SMIMEalgCMSRC2wrap: str +szOID_RSA_MD2: str +szOID_RSA_MD4: str +szOID_RSA_MD5: str +szOID_RSA_RC2CBC: str +szOID_RSA_RC4: str +szOID_RSA_DES_EDE3_CBC: str +szOID_RSA_RC5_CBCPad: str +szOID_ANSI_X942: str +szOID_ANSI_X942_DH: str +szOID_X957: str +szOID_X957_DSA: str +szOID_X957_SHA1DSA: str +szOID_DS: str +szOID_DSALG: str +szOID_DSALG_CRPT: str +szOID_DSALG_HASH: str +szOID_DSALG_SIGN: str +szOID_DSALG_RSA: str +szOID_OIW: str +szOID_OIWSEC: str +szOID_OIWSEC_md4RSA: str +szOID_OIWSEC_md5RSA: str +szOID_OIWSEC_md4RSA2: str +szOID_OIWSEC_desECB: str +szOID_OIWSEC_desCBC: str +szOID_OIWSEC_desOFB: str +szOID_OIWSEC_desCFB: str +szOID_OIWSEC_desMAC: str +szOID_OIWSEC_rsaSign: str +szOID_OIWSEC_dsa: str +szOID_OIWSEC_shaDSA: str +szOID_OIWSEC_mdc2RSA: str +szOID_OIWSEC_shaRSA: str +szOID_OIWSEC_dhCommMod: str +szOID_OIWSEC_desEDE: str +szOID_OIWSEC_sha: str +szOID_OIWSEC_mdc2: str +szOID_OIWSEC_dsaComm: str +szOID_OIWSEC_dsaCommSHA: str +szOID_OIWSEC_rsaXchg: str +szOID_OIWSEC_keyHashSeal: str +szOID_OIWSEC_md2RSASign: str +szOID_OIWSEC_md5RSASign: str +szOID_OIWSEC_sha1: str +szOID_OIWSEC_dsaSHA1: str +szOID_OIWSEC_dsaCommSHA1: str +szOID_OIWSEC_sha1RSASign: str +szOID_OIWDIR: str +szOID_OIWDIR_CRPT: str +szOID_OIWDIR_HASH: str +szOID_OIWDIR_SIGN: str +szOID_OIWDIR_md2: str +szOID_OIWDIR_md2RSA: str +szOID_INFOSEC: str +szOID_INFOSEC_sdnsSignature: str +szOID_INFOSEC_mosaicSignature: str +szOID_INFOSEC_sdnsConfidentiality: str +szOID_INFOSEC_mosaicConfidentiality: str +szOID_INFOSEC_sdnsIntegrity: str +szOID_INFOSEC_mosaicIntegrity: str +szOID_INFOSEC_sdnsTokenProtection: str +szOID_INFOSEC_mosaicTokenProtection: str +szOID_INFOSEC_sdnsKeyManagement: str +szOID_INFOSEC_mosaicKeyManagement: str +szOID_INFOSEC_sdnsKMandSig: str +szOID_INFOSEC_mosaicKMandSig: str +szOID_INFOSEC_SuiteASignature: str +szOID_INFOSEC_SuiteAConfidentiality: str +szOID_INFOSEC_SuiteAIntegrity: str +szOID_INFOSEC_SuiteATokenProtection: str +szOID_INFOSEC_SuiteAKeyManagement: str +szOID_INFOSEC_SuiteAKMandSig: str +szOID_INFOSEC_mosaicUpdatedSig: str +szOID_INFOSEC_mosaicKMandUpdSig: str +szOID_INFOSEC_mosaicUpdatedInteg: str +szOID_COMMON_NAME: str +szOID_SUR_NAME: str +szOID_DEVICE_SERIAL_NUMBER: str +szOID_COUNTRY_NAME: str +szOID_LOCALITY_NAME: str +szOID_STATE_OR_PROVINCE_NAME: str +szOID_STREET_ADDRESS: str +szOID_ORGANIZATION_NAME: str +szOID_ORGANIZATIONAL_UNIT_NAME: str +szOID_TITLE: str +szOID_DESCRIPTION: str +szOID_SEARCH_GUIDE: str +szOID_BUSINESS_CATEGORY: str +szOID_POSTAL_ADDRESS: str +szOID_POSTAL_CODE: str +szOID_POST_OFFICE_BOX: str +szOID_PHYSICAL_DELIVERY_OFFICE_NAME: str +szOID_TELEPHONE_NUMBER: str +szOID_TELEX_NUMBER: str +szOID_TELETEXT_TERMINAL_IDENTIFIER: str +szOID_FACSIMILE_TELEPHONE_NUMBER: str +szOID_X21_ADDRESS: str +szOID_INTERNATIONAL_ISDN_NUMBER: str +szOID_REGISTERED_ADDRESS: str +szOID_DESTINATION_INDICATOR: str +szOID_PREFERRED_DELIVERY_METHOD: str +szOID_PRESENTATION_ADDRESS: str +szOID_SUPPORTED_APPLICATION_CONTEXT: str +szOID_MEMBER: str +szOID_OWNER: str +szOID_ROLE_OCCUPANT: str +szOID_SEE_ALSO: str +szOID_USER_PASSWORD: str +szOID_USER_CERTIFICATE: str +szOID_CA_CERTIFICATE: str +szOID_CROSS_CERTIFICATE_PAIR: str +szOID_GIVEN_NAME: str +szOID_INITIALS: str +szOID_DN_QUALIFIER: str +szOID_DOMAIN_COMPONENT: str +szOID_PKCS_12_FRIENDLY_NAME_ATTR: str +szOID_PKCS_12_LOCAL_KEY_ID: str +szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR: str +szOID_LOCAL_MACHINE_KEYSET: str +szOID_KEYID_RDN: str +CERT_RDN_ANY_TYPE: int +CERT_RDN_ENCODED_BLOB: int +CERT_RDN_OCTET_STRING: int +CERT_RDN_NUMERIC_STRING: int +CERT_RDN_PRINTABLE_STRING: int +CERT_RDN_TELETEX_STRING: int +CERT_RDN_T61_STRING: int +CERT_RDN_VIDEOTEX_STRING: int +CERT_RDN_IA5_STRING: int +CERT_RDN_GRAPHIC_STRING: int +CERT_RDN_VISIBLE_STRING: int +CERT_RDN_ISO646_STRING: int +CERT_RDN_GENERAL_STRING: int +CERT_RDN_UNIVERSAL_STRING: int +CERT_RDN_INT4_STRING: int +CERT_RDN_BMP_STRING: int +CERT_RDN_UNICODE_STRING: int +CERT_RDN_UTF8_STRING: int +CERT_RDN_TYPE_MASK: int +CERT_RDN_FLAGS_MASK: int +CERT_RDN_ENABLE_T61_UNICODE_FLAG: int +CERT_RDN_ENABLE_UTF8_UNICODE_FLAG: int +CERT_RDN_DISABLE_CHECK_TYPE_FLAG: int +CERT_RDN_DISABLE_IE4_UTF8_FLAG: int +CERT_RSA_PUBLIC_KEY_OBJID: str +CERT_DEFAULT_OID_PUBLIC_KEY_SIGN: str +CERT_DEFAULT_OID_PUBLIC_KEY_XCHG: str +CERT_V1: int +CERT_V2: int +CERT_V3: int +CERT_INFO_VERSION_FLAG: int +CERT_INFO_SERIAL_NUMBER_FLAG: int +CERT_INFO_SIGNATURE_ALGORITHM_FLAG: int +CERT_INFO_ISSUER_FLAG: int +CERT_INFO_NOT_BEFORE_FLAG: int +CERT_INFO_NOT_AFTER_FLAG: int +CERT_INFO_SUBJECT_FLAG: int +CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG: int +CERT_INFO_ISSUER_UNIQUE_ID_FLAG: int +CERT_INFO_SUBJECT_UNIQUE_ID_FLAG: int +CERT_INFO_EXTENSION_FLAG: int +CRL_V1: int +CRL_V2: int +CERT_REQUEST_V1: int +CERT_KEYGEN_REQUEST_V1: int +CTL_V1: int +CERT_ENCODING_TYPE_MASK: int +CMSG_ENCODING_TYPE_MASK: int + +def GET_CERT_ENCODING_TYPE(X: int) -> int: ... +def GET_CMSG_ENCODING_TYPE(X: int) -> int: ... + +CRYPT_ASN_ENCODING: int +CRYPT_NDR_ENCODING: int +X509_ASN_ENCODING: int +X509_NDR_ENCODING: int +PKCS_7_ASN_ENCODING: int +PKCS_7_NDR_ENCODING: int +CRYPT_FORMAT_STR_MULTI_LINE: int +CRYPT_FORMAT_STR_NO_HEX: int +CRYPT_FORMAT_SIMPLE: int +CRYPT_FORMAT_X509: int +CRYPT_FORMAT_OID: int +CRYPT_FORMAT_RDN_SEMICOLON: int +CRYPT_FORMAT_RDN_CRLF: int +CRYPT_FORMAT_RDN_UNQUOTE: int +CRYPT_FORMAT_RDN_REVERSE: int +CRYPT_FORMAT_COMMA: int +CRYPT_FORMAT_SEMICOLON: int +CRYPT_FORMAT_CRLF: int +CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: int +CRYPT_ENCODE_ALLOC_FLAG: int +CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG: int +CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG: int +CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG: int +CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: int +CRYPT_DECODE_NOCOPY_FLAG: int +CRYPT_DECODE_TO_BE_SIGNED_FLAG: int +CRYPT_DECODE_SHARE_OID_STRING_FLAG: int +CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: int +CRYPT_DECODE_ALLOC_FLAG: int +CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG: int +CRYPT_ENCODE_DECODE_NONE: int +X509_CERT: int +X509_CERT_TO_BE_SIGNED: int +X509_CERT_CRL_TO_BE_SIGNED: int +X509_CERT_REQUEST_TO_BE_SIGNED: int +X509_EXTENSIONS: int +X509_NAME_VALUE: int +X509_NAME: int +X509_PUBLIC_KEY_INFO: int +X509_AUTHORITY_KEY_ID: int +X509_KEY_ATTRIBUTES: int +X509_KEY_USAGE_RESTRICTION: int +X509_ALTERNATE_NAME: int +X509_BASIC_CONSTRAINTS: int +X509_KEY_USAGE: int +X509_BASIC_CONSTRAINTS2: int +X509_CERT_POLICIES: int +PKCS_UTC_TIME: int +PKCS_TIME_REQUEST: int +RSA_CSP_PUBLICKEYBLOB: int +X509_UNICODE_NAME: int +X509_KEYGEN_REQUEST_TO_BE_SIGNED: int +PKCS_ATTRIBUTE: int +PKCS_CONTENT_INFO_SEQUENCE_OF_ANY: int +X509_UNICODE_NAME_VALUE: int +X509_ANY_STRING: int +X509_UNICODE_ANY_STRING: int +X509_OCTET_STRING: int +X509_BITS: int +X509_INTEGER: int +X509_MULTI_BYTE_INTEGER: int +X509_ENUMERATED: int +X509_CHOICE_OF_TIME: int +X509_AUTHORITY_KEY_ID2: int +X509_AUTHORITY_INFO_ACCESS: int +X509_SUBJECT_INFO_ACCESS: int +X509_CRL_REASON_CODE: int +PKCS_CONTENT_INFO: int +X509_SEQUENCE_OF_ANY: int +X509_CRL_DIST_POINTS: int +X509_ENHANCED_KEY_USAGE: int +PKCS_CTL: int +X509_MULTI_BYTE_UINT: int +X509_DSS_PUBLICKEY: int +X509_DSS_PARAMETERS: int +X509_DSS_SIGNATURE: int +PKCS_RC2_CBC_PARAMETERS: int +PKCS_SMIME_CAPABILITIES: int +X509_QC_STATEMENTS_EXT: int +PKCS_RSA_PRIVATE_KEY: int +PKCS_PRIVATE_KEY_INFO: int +PKCS_ENCRYPTED_PRIVATE_KEY_INFO: int +X509_PKIX_POLICY_QUALIFIER_USERNOTICE: int +X509_DH_PUBLICKEY: int +X509_DH_PARAMETERS: int +PKCS_ATTRIBUTES: int +PKCS_SORTED_CTL: int +X509_ECC_SIGNATURE: int +X942_DH_PARAMETERS: int +X509_BITS_WITHOUT_TRAILING_ZEROES: int +X942_OTHER_INFO: int +X509_CERT_PAIR: int +X509_ISSUING_DIST_POINT: int +X509_NAME_CONSTRAINTS: int +X509_POLICY_MAPPINGS: int +X509_POLICY_CONSTRAINTS: int +X509_CROSS_CERT_DIST_POINTS: int +CMC_DATA: int +CMC_RESPONSE: int +CMC_STATUS: int +CMC_ADD_EXTENSIONS: int +CMC_ADD_ATTRIBUTES: int +X509_CERTIFICATE_TEMPLATE: int +OCSP_SIGNED_REQUEST: int +OCSP_REQUEST: int +OCSP_RESPONSE: int +OCSP_BASIC_SIGNED_RESPONSE: int +OCSP_BASIC_RESPONSE: int +X509_LOGOTYPE_EXT: int +X509_BIOMETRIC_EXT: int +CNG_RSA_PUBLIC_KEY_BLOB: int +X509_OBJECT_IDENTIFIER: int +X509_ALGORITHM_IDENTIFIER: int +PKCS_RSA_SSA_PSS_PARAMETERS: int +PKCS_RSAES_OAEP_PARAMETERS: int +ECC_CMS_SHARED_INFO: int +TIMESTAMP_REQUEST: int +TIMESTAMP_RESPONSE: int +TIMESTAMP_INFO: int +X509_CERT_BUNDLE: int +PKCS7_SIGNER_INFO: int +CMS_SIGNER_INFO: int +szOID_AUTHORITY_KEY_IDENTIFIER: str +szOID_KEY_ATTRIBUTES: str +szOID_CERT_POLICIES_95: str +szOID_KEY_USAGE_RESTRICTION: str +szOID_SUBJECT_ALT_NAME: str +szOID_ISSUER_ALT_NAME: str +szOID_BASIC_CONSTRAINTS: str +szOID_KEY_USAGE: str +szOID_PRIVATEKEY_USAGE_PERIOD: str +szOID_BASIC_CONSTRAINTS2: str +szOID_CERT_POLICIES: str +szOID_ANY_CERT_POLICY: str +szOID_AUTHORITY_KEY_IDENTIFIER2: str +szOID_SUBJECT_KEY_IDENTIFIER: str +szOID_SUBJECT_ALT_NAME2: str +szOID_ISSUER_ALT_NAME2: str +szOID_CRL_REASON_CODE: str +szOID_REASON_CODE_HOLD: str +szOID_CRL_DIST_POINTS: str +szOID_ENHANCED_KEY_USAGE: str +szOID_CRL_NUMBER: str +szOID_DELTA_CRL_INDICATOR: str +szOID_ISSUING_DIST_POINT: str +szOID_FRESHEST_CRL: str +szOID_NAME_CONSTRAINTS: str +szOID_POLICY_MAPPINGS: str +szOID_LEGACY_POLICY_MAPPINGS: str +szOID_POLICY_CONSTRAINTS: str +szOID_RENEWAL_CERTIFICATE: str +szOID_ENROLLMENT_NAME_VALUE_PAIR: str +szOID_ENROLLMENT_CSP_PROVIDER: str +szOID_OS_VERSION: str +szOID_ENROLLMENT_AGENT: str +szOID_PKIX: str +szOID_PKIX_PE: str +szOID_AUTHORITY_INFO_ACCESS: str +szOID_CERT_EXTENSIONS: str +szOID_NEXT_UPDATE_LOCATION: str +szOID_REMOVE_CERTIFICATE: str +szOID_CROSS_CERT_DIST_POINTS: str +szOID_CTL: str +szOID_SORTED_CTL: str +szOID_SERIALIZED: str +szOID_NT_PRINCIPAL_NAME: str +szOID_PRODUCT_UPDATE: str +szOID_ANY_APPLICATION_POLICY: str +szOID_AUTO_ENROLL_CTL_USAGE: str +szOID_ENROLL_CERTTYPE_EXTENSION: str +szOID_CERT_MANIFOLD: str +szOID_CERTSRV_CA_VERSION: str +szOID_CERTSRV_PREVIOUS_CERT_HASH: str +szOID_CRL_VIRTUAL_BASE: str +szOID_CRL_NEXT_PUBLISH: str +szOID_KP_CA_EXCHANGE: str +szOID_KP_KEY_RECOVERY_AGENT: str +szOID_CERTIFICATE_TEMPLATE: str +szOID_ENTERPRISE_OID_ROOT: str +szOID_RDN_DUMMY_SIGNER: str +szOID_APPLICATION_CERT_POLICIES: str +szOID_APPLICATION_POLICY_MAPPINGS: str +szOID_APPLICATION_POLICY_CONSTRAINTS: str +szOID_ARCHIVED_KEY_ATTR: str +szOID_CRL_SELF_CDP: str +szOID_REQUIRE_CERT_CHAIN_POLICY: str +szOID_ARCHIVED_KEY_CERT_HASH: str +szOID_ISSUED_CERT_HASH: str +szOID_DS_EMAIL_REPLICATION: str +szOID_REQUEST_CLIENT_INFO: str +szOID_ENCRYPTED_KEY_HASH: str +szOID_CERTSRV_CROSSCA_VERSION: str +szOID_NTDS_REPLICATION: str +szOID_SUBJECT_DIR_ATTRS: str +szOID_PKIX_KP: str +szOID_PKIX_KP_SERVER_AUTH: str +szOID_PKIX_KP_CLIENT_AUTH: str +szOID_PKIX_KP_CODE_SIGNING: str +szOID_PKIX_KP_EMAIL_PROTECTION: str +szOID_PKIX_KP_IPSEC_END_SYSTEM: str +szOID_PKIX_KP_IPSEC_TUNNEL: str +szOID_PKIX_KP_IPSEC_USER: str +szOID_PKIX_KP_TIMESTAMP_SIGNING: str +szOID_IPSEC_KP_IKE_INTERMEDIATE: str +szOID_KP_CTL_USAGE_SIGNING: str +szOID_KP_TIME_STAMP_SIGNING: str +szOID_SERVER_GATED_CRYPTO: str +szOID_SGC_NETSCAPE: str +szOID_KP_EFS: str +szOID_EFS_RECOVERY: str +szOID_WHQL_CRYPTO: str +szOID_NT5_CRYPTO: str +szOID_OEM_WHQL_CRYPTO: str +szOID_EMBEDDED_NT_CRYPTO: str +szOID_KP_QUALIFIED_SUBORDINATION: str +szOID_KP_KEY_RECOVERY: str +szOID_KP_DOCUMENT_SIGNING: str +szOID_KP_LIFETIME_SIGNING: str +szOID_KP_MOBILE_DEVICE_SOFTWARE: str +szOID_DRM: str +szOID_DRM_INDIVIDUALIZATION: str +szOID_LICENSES: str +szOID_LICENSE_SERVER: str +szOID_KP_SMARTCARD_LOGON: str +szOID_YESNO_TRUST_ATTR: str +szOID_PKIX_POLICY_QUALIFIER_CPS: str +szOID_PKIX_POLICY_QUALIFIER_USERNOTICE: str +szOID_CERT_POLICIES_95_QUALIFIER1: str +CERT_UNICODE_RDN_ERR_INDEX_MASK: int +CERT_UNICODE_RDN_ERR_INDEX_SHIFT: int +CERT_UNICODE_ATTR_ERR_INDEX_MASK: int +CERT_UNICODE_ATTR_ERR_INDEX_SHIFT: int +CERT_UNICODE_VALUE_ERR_INDEX_MASK: int +CERT_UNICODE_VALUE_ERR_INDEX_SHIFT: int +CERT_DIGITAL_SIGNATURE_KEY_USAGE: int +CERT_NON_REPUDIATION_KEY_USAGE: int +CERT_KEY_ENCIPHERMENT_KEY_USAGE: int +CERT_DATA_ENCIPHERMENT_KEY_USAGE: int +CERT_KEY_AGREEMENT_KEY_USAGE: int +CERT_KEY_CERT_SIGN_KEY_USAGE: int +CERT_OFFLINE_CRL_SIGN_KEY_USAGE: int +CERT_CRL_SIGN_KEY_USAGE: int +CERT_ENCIPHER_ONLY_KEY_USAGE: int +CERT_DECIPHER_ONLY_KEY_USAGE: int +CERT_ALT_NAME_OTHER_NAME: int +CERT_ALT_NAME_RFC822_NAME: int +CERT_ALT_NAME_DNS_NAME: int +CERT_ALT_NAME_X400_ADDRESS: int +CERT_ALT_NAME_DIRECTORY_NAME: int +CERT_ALT_NAME_EDI_PARTY_NAME: int +CERT_ALT_NAME_URL: int +CERT_ALT_NAME_IP_ADDRESS: int +CERT_ALT_NAME_REGISTERED_ID: int +CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK: int +CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT: int +CERT_ALT_NAME_VALUE_ERR_INDEX_MASK: int +CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT: int +CERT_CA_SUBJECT_FLAG: int +CERT_END_ENTITY_SUBJECT_FLAG: int +szOID_PKIX_ACC_DESCR: str +szOID_PKIX_OCSP: str +szOID_PKIX_CA_ISSUERS: str +CRL_REASON_UNSPECIFIED: int +CRL_REASON_KEY_COMPROMISE: int +CRL_REASON_CA_COMPROMISE: int +CRL_REASON_AFFILIATION_CHANGED: int +CRL_REASON_SUPERSEDED: int +CRL_REASON_CESSATION_OF_OPERATION: int +CRL_REASON_CERTIFICATE_HOLD: int +CRL_REASON_REMOVE_FROM_CRL: int +CRL_DIST_POINT_NO_NAME: int +CRL_DIST_POINT_FULL_NAME: int +CRL_DIST_POINT_ISSUER_RDN_NAME: int +CRL_REASON_UNUSED_FLAG: int +CRL_REASON_KEY_COMPROMISE_FLAG: int +CRL_REASON_CA_COMPROMISE_FLAG: int +CRL_REASON_AFFILIATION_CHANGED_FLAG: int +CRL_REASON_SUPERSEDED_FLAG: int +CRL_REASON_CESSATION_OF_OPERATION_FLAG: int +CRL_REASON_CERTIFICATE_HOLD_FLAG: int +CRL_DIST_POINT_ERR_INDEX_MASK: int +CRL_DIST_POINT_ERR_INDEX_SHIFT: int +CRL_DIST_POINT_ERR_CRL_ISSUER_BIT: int +CROSS_CERT_DIST_POINT_ERR_INDEX_MASK: int +CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT: int +CERT_EXCLUDED_SUBTREE_BIT: int +SORTED_CTL_EXT_FLAGS_OFFSET: int +SORTED_CTL_EXT_COUNT_OFFSET: int +SORTED_CTL_EXT_MAX_COLLISION_OFFSET: int +SORTED_CTL_EXT_HASH_BUCKET_OFFSET: int +SORTED_CTL_EXT_HASHED_SUBJECT_IDENTIFIER_FLAG: int +CERT_DSS_R_LEN: int +CERT_DSS_S_LEN: int +CERT_DSS_SIGNATURE_LEN: int +CERT_MAX_ASN_ENCODED_DSS_SIGNATURE_LEN: int +CRYPT_X942_COUNTER_BYTE_LENGTH: int +CRYPT_X942_KEY_LENGTH_BYTE_LENGTH: int +CRYPT_X942_PUB_INFO_BYTE_LENGTH: float +CRYPT_RC2_40BIT_VERSION: int +CRYPT_RC2_56BIT_VERSION: int +CRYPT_RC2_64BIT_VERSION: int +CRYPT_RC2_128BIT_VERSION: int +szOID_VERISIGN_PRIVATE_6_9: str +szOID_VERISIGN_ONSITE_JURISDICTION_HASH: str +szOID_VERISIGN_BITSTRING_6_13: str +szOID_VERISIGN_ISS_STRONG_CRYPTO: str +szOID_NETSCAPE: str +szOID_NETSCAPE_CERT_EXTENSION: str +szOID_NETSCAPE_CERT_TYPE: str +szOID_NETSCAPE_BASE_URL: str +szOID_NETSCAPE_REVOCATION_URL: str +szOID_NETSCAPE_CA_REVOCATION_URL: str +szOID_NETSCAPE_CERT_RENEWAL_URL: str +szOID_NETSCAPE_CA_POLICY_URL: str +szOID_NETSCAPE_SSL_SERVER_NAME: str +szOID_NETSCAPE_COMMENT: str +szOID_NETSCAPE_DATA_TYPE: str +szOID_NETSCAPE_CERT_SEQUENCE: str +NETSCAPE_SSL_CLIENT_AUTH_CERT_TYPE: int +NETSCAPE_SSL_SERVER_AUTH_CERT_TYPE: int +NETSCAPE_SMIME_CERT_TYPE: int +NETSCAPE_SIGN_CERT_TYPE: int +NETSCAPE_SSL_CA_CERT_TYPE: int +NETSCAPE_SMIME_CA_CERT_TYPE: int +NETSCAPE_SIGN_CA_CERT_TYPE: int +szOID_CT_PKI_DATA: str +szOID_CT_PKI_RESPONSE: str +szOID_PKIX_NO_SIGNATURE: str +szOID_CMC: str +szOID_CMC_STATUS_INFO: str +szOID_CMC_IDENTIFICATION: str +szOID_CMC_IDENTITY_PROOF: str +szOID_CMC_DATA_RETURN: str +szOID_CMC_TRANSACTION_ID: str +szOID_CMC_SENDER_NONCE: str +szOID_CMC_RECIPIENT_NONCE: str +szOID_CMC_ADD_EXTENSIONS: str +szOID_CMC_ENCRYPTED_POP: str +szOID_CMC_DECRYPTED_POP: str +szOID_CMC_LRA_POP_WITNESS: str +szOID_CMC_GET_CERT: str +szOID_CMC_GET_CRL: str +szOID_CMC_REVOKE_REQUEST: str +szOID_CMC_REG_INFO: str +szOID_CMC_RESPONSE_INFO: str +szOID_CMC_QUERY_PENDING: str +szOID_CMC_ID_POP_LINK_RANDOM: str +szOID_CMC_ID_POP_LINK_WITNESS: str +szOID_CMC_ID_CONFIRM_CERT_ACCEPTANCE: str +szOID_CMC_ADD_ATTRIBUTES: str +CMC_TAGGED_CERT_REQUEST_CHOICE: int +CMC_OTHER_INFO_NO_CHOICE: int +CMC_OTHER_INFO_FAIL_CHOICE: int +CMC_OTHER_INFO_PEND_CHOICE: int +CMC_STATUS_SUCCESS: int +CMC_STATUS_FAILED: int +CMC_STATUS_PENDING: int +CMC_STATUS_NO_SUPPORT: int +CMC_STATUS_CONFIRM_REQUIRED: int +CMC_FAIL_BAD_ALG: int +CMC_FAIL_BAD_MESSAGE_CHECK: int +CMC_FAIL_BAD_REQUEST: int +CMC_FAIL_BAD_TIME: int +CMC_FAIL_BAD_CERT_ID: int +CMC_FAIL_UNSUPORTED_EXT: int +CMC_FAIL_MUST_ARCHIVE_KEYS: int +CMC_FAIL_BAD_IDENTITY: int +CMC_FAIL_POP_REQUIRED: int +CMC_FAIL_POP_FAILED: int +CMC_FAIL_NO_KEY_REUSE: int +CMC_FAIL_INTERNAL_CA_ERROR: int +CMC_FAIL_TRY_LATER: int +CRYPT_OID_ENCODE_OBJECT_FUNC: str +CRYPT_OID_DECODE_OBJECT_FUNC: str +CRYPT_OID_ENCODE_OBJECT_EX_FUNC: str +CRYPT_OID_DECODE_OBJECT_EX_FUNC: str +CRYPT_OID_CREATE_COM_OBJECT_FUNC: str +CRYPT_OID_VERIFY_REVOCATION_FUNC: str +CRYPT_OID_VERIFY_CTL_USAGE_FUNC: str +CRYPT_OID_FORMAT_OBJECT_FUNC: str +CRYPT_OID_FIND_OID_INFO_FUNC: str +CRYPT_OID_FIND_LOCALIZED_NAME_FUNC: str +CRYPT_OID_REGPATH: str +CRYPT_OID_REG_ENCODING_TYPE_PREFIX: str +CRYPT_OID_REG_DLL_VALUE_NAME: str +CRYPT_OID_REG_FUNC_NAME_VALUE_NAME: str +CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A: str +CRYPT_OID_REG_FLAGS_VALUE_NAME: str +CRYPT_DEFAULT_OID: str +CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG: int +CRYPT_GET_INSTALLED_OID_FUNC_FLAG: int +CRYPT_REGISTER_FIRST_INDEX: int +CRYPT_REGISTER_LAST_INDEX: int +CRYPT_MATCH_ANY_ENCODING_TYPE: int +CRYPT_HASH_ALG_OID_GROUP_ID: int +CRYPT_ENCRYPT_ALG_OID_GROUP_ID: int +CRYPT_PUBKEY_ALG_OID_GROUP_ID: int +CRYPT_SIGN_ALG_OID_GROUP_ID: int +CRYPT_RDN_ATTR_OID_GROUP_ID: int +CRYPT_EXT_OR_ATTR_OID_GROUP_ID: int +CRYPT_ENHKEY_USAGE_OID_GROUP_ID: int +CRYPT_POLICY_OID_GROUP_ID: int +CRYPT_TEMPLATE_OID_GROUP_ID: int +CRYPT_LAST_OID_GROUP_ID: int +CRYPT_FIRST_ALG_OID_GROUP_ID: int +CRYPT_LAST_ALG_OID_GROUP_ID: int +CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG: int +CRYPT_OID_USE_PUBKEY_PARA_FOR_PKCS7_FLAG: int +CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG: int +CRYPT_OID_INFO_OID_KEY: int +CRYPT_OID_INFO_NAME_KEY: int +CRYPT_OID_INFO_ALGID_KEY: int +CRYPT_OID_INFO_SIGN_KEY: int +CRYPT_INSTALL_OID_INFO_BEFORE_FLAG: int +CRYPT_LOCALIZED_NAME_ENCODING_TYPE: int +CRYPT_LOCALIZED_NAME_OID: str +szOID_PKCS_7_DATA: str +szOID_PKCS_7_SIGNED: str +szOID_PKCS_7_ENVELOPED: str +szOID_PKCS_7_SIGNEDANDENVELOPED: str +szOID_PKCS_7_DIGESTED: str +szOID_PKCS_7_ENCRYPTED: str +szOID_PKCS_9_CONTENT_TYPE: str +szOID_PKCS_9_MESSAGE_DIGEST: str +CMSG_DATA: int +CMSG_SIGNED: int +CMSG_ENVELOPED: int +CMSG_SIGNED_AND_ENVELOPED: int +CMSG_HASHED: int +CMSG_ENCRYPTED: int +CMSG_ALL_FLAGS: int +CMSG_DATA_FLAG: int +CMSG_SIGNED_FLAG: int +CMSG_ENVELOPED_FLAG: int +CMSG_SIGNED_AND_ENVELOPED_FLAG: int +CMSG_HASHED_FLAG: int +CMSG_ENCRYPTED_FLAG: int +CERT_ID_ISSUER_SERIAL_NUMBER: int +CERT_ID_KEY_IDENTIFIER: int +CERT_ID_SHA1_HASH: int +CMSG_KEY_AGREE_EPHEMERAL_KEY_CHOICE: int +CMSG_KEY_AGREE_STATIC_KEY_CHOICE: int +CMSG_KEY_TRANS_RECIPIENT: int +CMSG_KEY_AGREE_RECIPIENT: int +CMSG_SP3_COMPATIBLE_ENCRYPT_FLAG: int +CMSG_RC4_NO_SALT_FLAG: int +CMSG_INDEFINITE_LENGTH: int +CMSG_BARE_CONTENT_FLAG: int +CMSG_LENGTH_ONLY_FLAG: int +CMSG_DETACHED_FLAG: int +CMSG_AUTHENTICATED_ATTRIBUTES_FLAG: int +CMSG_CONTENTS_OCTETS_FLAG: int +CMSG_MAX_LENGTH_FLAG: int +CMSG_CMS_ENCAPSULATED_CONTENT_FLAG: int +CMSG_CRYPT_RELEASE_CONTEXT_FLAG: int +CMSG_TYPE_PARAM: int +CMSG_CONTENT_PARAM: int +CMSG_BARE_CONTENT_PARAM: int +CMSG_INNER_CONTENT_TYPE_PARAM: int +CMSG_SIGNER_COUNT_PARAM: int +CMSG_SIGNER_INFO_PARAM: int +CMSG_SIGNER_CERT_INFO_PARAM: int +CMSG_SIGNER_HASH_ALGORITHM_PARAM: int +CMSG_SIGNER_AUTH_ATTR_PARAM: int +CMSG_SIGNER_UNAUTH_ATTR_PARAM: int +CMSG_CERT_COUNT_PARAM: int +CMSG_CERT_PARAM: int +CMSG_CRL_COUNT_PARAM: int +CMSG_CRL_PARAM: int +CMSG_ENVELOPE_ALGORITHM_PARAM: int +CMSG_RECIPIENT_COUNT_PARAM: int +CMSG_RECIPIENT_INDEX_PARAM: int +CMSG_RECIPIENT_INFO_PARAM: int +CMSG_HASH_ALGORITHM_PARAM: int +CMSG_HASH_DATA_PARAM: int +CMSG_COMPUTED_HASH_PARAM: int +CMSG_ENCRYPT_PARAM: int +CMSG_ENCRYPTED_DIGEST: int +CMSG_ENCODED_SIGNER: int +CMSG_ENCODED_MESSAGE: int +CMSG_VERSION_PARAM: int +CMSG_ATTR_CERT_COUNT_PARAM: int +CMSG_ATTR_CERT_PARAM: int +CMSG_CMS_RECIPIENT_COUNT_PARAM: int +CMSG_CMS_RECIPIENT_INDEX_PARAM: int +CMSG_CMS_RECIPIENT_ENCRYPTED_KEY_INDEX_PARAM: int +CMSG_CMS_RECIPIENT_INFO_PARAM: int +CMSG_UNPROTECTED_ATTR_PARAM: int +CMSG_SIGNER_CERT_ID_PARAM: int +CMSG_CMS_SIGNER_INFO_PARAM: int +CMSG_SIGNED_DATA_V1: int +CMSG_SIGNED_DATA_V3: int +CMSG_SIGNED_DATA_PKCS_1_5_VERSION: int +CMSG_SIGNED_DATA_CMS_VERSION: int +CMSG_SIGNER_INFO_V1: int +CMSG_SIGNER_INFO_V3: int +CMSG_SIGNER_INFO_PKCS_1_5_VERSION: int +CMSG_SIGNER_INFO_CMS_VERSION: int +CMSG_HASHED_DATA_V0: int +CMSG_HASHED_DATA_V2: int +CMSG_HASHED_DATA_PKCS_1_5_VERSION: int +CMSG_HASHED_DATA_CMS_VERSION: int +CMSG_ENVELOPED_DATA_V0: int +CMSG_ENVELOPED_DATA_V2: int +CMSG_ENVELOPED_DATA_PKCS_1_5_VERSION: int +CMSG_ENVELOPED_DATA_CMS_VERSION: int +CMSG_KEY_AGREE_ORIGINATOR_CERT: int +CMSG_KEY_AGREE_ORIGINATOR_PUBLIC_KEY: int +CMSG_ENVELOPED_RECIPIENT_V0: int +CMSG_ENVELOPED_RECIPIENT_V2: int +CMSG_ENVELOPED_RECIPIENT_V3: int +CMSG_ENVELOPED_RECIPIENT_V4: int +CMSG_KEY_TRANS_PKCS_1_5_VERSION: int +CMSG_KEY_TRANS_CMS_VERSION: int +CMSG_KEY_AGREE_VERSION: int +CMSG_CTRL_VERIFY_SIGNATURE: int +CMSG_CTRL_DECRYPT: int +CMSG_CTRL_VERIFY_HASH: int +CMSG_CTRL_ADD_SIGNER: int +CMSG_CTRL_DEL_SIGNER: int +CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR: int +CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR: int +CMSG_CTRL_ADD_CERT: int +CMSG_CTRL_DEL_CERT: int +CMSG_CTRL_ADD_CRL: int +CMSG_CTRL_DEL_CRL: int +CMSG_CTRL_ADD_ATTR_CERT: int +CMSG_CTRL_DEL_ATTR_CERT: int +CMSG_CTRL_KEY_TRANS_DECRYPT: int +CMSG_CTRL_KEY_AGREE_DECRYPT: int +CMSG_CTRL_VERIFY_SIGNATURE_EX: int +CMSG_CTRL_ADD_CMS_SIGNER_INFO: int +CMSG_VERIFY_SIGNER_PUBKEY: int +CMSG_VERIFY_SIGNER_CERT: int +CMSG_VERIFY_SIGNER_CHAIN: int +CMSG_VERIFY_SIGNER_NULL: int +CMSG_OID_GEN_ENCRYPT_KEY_FUNC: str +CMSG_OID_EXPORT_ENCRYPT_KEY_FUNC: str +CMSG_OID_IMPORT_ENCRYPT_KEY_FUNC: str +CMSG_CONTENT_ENCRYPT_PAD_ENCODED_LEN_FLAG: int +CMSG_DEFAULT_INSTALLABLE_FUNC_OID: int +CMSG_CONTENT_ENCRYPT_FREE_PARA_FLAG: int +CMSG_CONTENT_ENCRYPT_RELEASE_CONTEXT_FLAG: int +CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC: str +CMSG_KEY_TRANS_ENCRYPT_FREE_PARA_FLAG: int +CMSG_OID_EXPORT_KEY_TRANS_FUNC: str +CMSG_KEY_AGREE_ENCRYPT_FREE_PARA_FLAG: int +CMSG_KEY_AGREE_ENCRYPT_FREE_MATERIAL_FLAG: int +CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_ALG_FLAG: int +CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_PARA_FLAG: int +CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_BITS_FLAG: int +CMSG_OID_EXPORT_KEY_AGREE_FUNC: str +CMSG_OID_IMPORT_KEY_TRANS_FUNC: str +CMSG_OID_IMPORT_KEY_AGREE_FUNC: str +CERT_KEY_PROV_HANDLE_PROP_ID: int +CERT_KEY_PROV_INFO_PROP_ID: int +CERT_SHA1_HASH_PROP_ID: int +CERT_MD5_HASH_PROP_ID: int +CERT_HASH_PROP_ID: int +CERT_KEY_CONTEXT_PROP_ID: int +CERT_KEY_SPEC_PROP_ID: int +CERT_IE30_RESERVED_PROP_ID: int +CERT_PUBKEY_HASH_RESERVED_PROP_ID: int +CERT_ENHKEY_USAGE_PROP_ID: int +CERT_CTL_USAGE_PROP_ID: int +CERT_NEXT_UPDATE_LOCATION_PROP_ID: int +CERT_FRIENDLY_NAME_PROP_ID: int +CERT_PVK_FILE_PROP_ID: int +CERT_DESCRIPTION_PROP_ID: int +CERT_ACCESS_STATE_PROP_ID: int +CERT_SIGNATURE_HASH_PROP_ID: int +CERT_SMART_CARD_DATA_PROP_ID: int +CERT_EFS_PROP_ID: int +CERT_FORTEZZA_DATA_PROP_ID: int +CERT_ARCHIVED_PROP_ID: int +CERT_KEY_IDENTIFIER_PROP_ID: int +CERT_AUTO_ENROLL_PROP_ID: int +CERT_PUBKEY_ALG_PARA_PROP_ID: int +CERT_CROSS_CERT_DIST_POINTS_PROP_ID: int +CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: int +CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: int +CERT_ENROLLMENT_PROP_ID: int +CERT_DATE_STAMP_PROP_ID: int +CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: int +CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: int +CERT_EXTENDED_ERROR_INFO_PROP_ID: int +CERT_RENEWAL_PROP_ID: int +CERT_ARCHIVED_KEY_HASH_PROP_ID: int +CERT_AUTO_ENROLL_RETRY_PROP_ID: int +CERT_AIA_URL_RETRIEVED_PROP_ID: int +CERT_AUTHORITY_INFO_ACCESS_PROP_ID: int +CERT_BACKED_UP_PROP_ID: int +CERT_OCSP_RESPONSE_PROP_ID: int +CERT_REQUEST_ORIGINATOR_PROP_ID: int +CERT_SOURCE_LOCATION_PROP_ID: int +CERT_SOURCE_URL_PROP_ID: int +CERT_NEW_KEY_PROP_ID: int +CERT_OCSP_CACHE_PREFIX_PROP_ID: int +CERT_SMART_CARD_ROOT_INFO_PROP_ID: int +CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID: int +CERT_NCRYPT_KEY_HANDLE_PROP_ID: int +CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID: int +CERT_SUBJECT_INFO_ACCESS_PROP_ID: int +CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: int +CERT_CA_DISABLE_CRL_PROP_ID: int +CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID: int +CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID: int +CERT_SUBJECT_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: int +CERT_SUBJECT_DISABLE_CRL_PROP_ID: int +CERT_CEP_PROP_ID: int +CERT_SIGN_HASH_CNG_ALG_PROP_ID: int +CERT_SCARD_PIN_ID_PROP_ID: int +CERT_SCARD_PIN_INFO_PROP_ID: int +CERT_FIRST_RESERVED_PROP_ID: int +CERT_LAST_RESERVED_PROP_ID: int +CERT_FIRST_USER_PROP_ID: int +CERT_LAST_USER_PROP_ID: int +szOID_CERT_PROP_ID_PREFIX: str +szOID_CERT_KEY_IDENTIFIER_PROP_ID: str +szOID_CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: str +szOID_CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: str +CERT_ACCESS_STATE_WRITE_PERSIST_FLAG: int +CERT_ACCESS_STATE_SYSTEM_STORE_FLAG: int +CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG: int +CERT_SET_KEY_PROV_HANDLE_PROP_ID: int +CERT_SET_KEY_CONTEXT_PROP_ID: int +sz_CERT_STORE_PROV_MEMORY: str +sz_CERT_STORE_PROV_FILENAME_W: str +sz_CERT_STORE_PROV_FILENAME: str +sz_CERT_STORE_PROV_SYSTEM_W: str +sz_CERT_STORE_PROV_SYSTEM: str +sz_CERT_STORE_PROV_PKCS7: str +sz_CERT_STORE_PROV_SERIALIZED: str +sz_CERT_STORE_PROV_COLLECTION: str +sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W: str +sz_CERT_STORE_PROV_SYSTEM_REGISTRY: str +sz_CERT_STORE_PROV_PHYSICAL_W: str +sz_CERT_STORE_PROV_PHYSICAL: str +sz_CERT_STORE_PROV_SMART_CARD_W: str +sz_CERT_STORE_PROV_SMART_CARD: str +sz_CERT_STORE_PROV_LDAP_W: str +sz_CERT_STORE_PROV_LDAP: str +CERT_STORE_SIGNATURE_FLAG: int +CERT_STORE_TIME_VALIDITY_FLAG: int +CERT_STORE_REVOCATION_FLAG: int +CERT_STORE_NO_CRL_FLAG: int +CERT_STORE_NO_ISSUER_FLAG: int +CERT_STORE_BASE_CRL_FLAG: int +CERT_STORE_DELTA_CRL_FLAG: int +CERT_STORE_NO_CRYPT_RELEASE_FLAG: int +CERT_STORE_SET_LOCALIZED_NAME_FLAG: int +CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG: int +CERT_STORE_DELETE_FLAG: int +CERT_STORE_UNSAFE_PHYSICAL_FLAG: int +CERT_STORE_SHARE_STORE_FLAG: int +CERT_STORE_SHARE_CONTEXT_FLAG: int +CERT_STORE_MANIFOLD_FLAG: int +CERT_STORE_ENUM_ARCHIVED_FLAG: int +CERT_STORE_UPDATE_KEYID_FLAG: int +CERT_STORE_BACKUP_RESTORE_FLAG: int +CERT_STORE_READONLY_FLAG: int +CERT_STORE_OPEN_EXISTING_FLAG: int +CERT_STORE_CREATE_NEW_FLAG: int +CERT_STORE_MAXIMUM_ALLOWED_FLAG: int +CERT_SYSTEM_STORE_MASK: int +CERT_SYSTEM_STORE_RELOCATE_FLAG: int +CERT_SYSTEM_STORE_UNPROTECTED_FLAG: int +CERT_SYSTEM_STORE_LOCATION_MASK: int +CERT_SYSTEM_STORE_LOCATION_SHIFT: int +CERT_SYSTEM_STORE_CURRENT_USER_ID: int +CERT_SYSTEM_STORE_LOCAL_MACHINE_ID: int +CERT_SYSTEM_STORE_CURRENT_SERVICE_ID: int +CERT_SYSTEM_STORE_SERVICES_ID: int +CERT_SYSTEM_STORE_USERS_ID: int +CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID: int +CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID: int +CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID: int +CERT_SYSTEM_STORE_CURRENT_USER: int +CERT_SYSTEM_STORE_LOCAL_MACHINE: int +CERT_SYSTEM_STORE_CURRENT_SERVICE: int +CERT_SYSTEM_STORE_SERVICES: int +CERT_SYSTEM_STORE_USERS: int +CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY: int +CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY: int +CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE: int +CERT_PROT_ROOT_DISABLE_CURRENT_USER_FLAG: int +CERT_PROT_ROOT_INHIBIT_ADD_AT_INIT_FLAG: int +CERT_PROT_ROOT_INHIBIT_PURGE_LM_FLAG: int +CERT_PROT_ROOT_DISABLE_LM_AUTH_FLAG: int +CERT_PROT_ROOT_ONLY_LM_GPT_FLAG: int +CERT_PROT_ROOT_DISABLE_NT_AUTH_REQUIRED_FLAG: int +CERT_PROT_ROOT_DISABLE_NOT_DEFINED_NAME_CONSTRAINT_FLAG: int +CERT_TRUST_PUB_ALLOW_TRUST_MASK: int +CERT_TRUST_PUB_ALLOW_END_USER_TRUST: int +CERT_TRUST_PUB_ALLOW_MACHINE_ADMIN_TRUST: int +CERT_TRUST_PUB_ALLOW_ENTERPRISE_ADMIN_TRUST: int +CERT_TRUST_PUB_CHECK_PUBLISHER_REV_FLAG: int +CERT_TRUST_PUB_CHECK_TIMESTAMP_REV_FLAG: int +CERT_AUTH_ROOT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH: str +CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_UNTRUSTED_ROOT_LOGGING_FLAG: int +CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_PARTIAL_CHAIN_LOGGING_FLAG: int +CERT_AUTH_ROOT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME: str +CERT_AUTH_ROOT_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME: str +CERT_AUTH_ROOT_AUTO_UPDATE_FLAGS_VALUE_NAME: str +CERT_AUTH_ROOT_CTL_FILENAME: str +CERT_AUTH_ROOT_CTL_FILENAME_A: str +CERT_AUTH_ROOT_CAB_FILENAME: str +CERT_AUTH_ROOT_SEQ_FILENAME: str +CERT_AUTH_ROOT_CERT_EXT: str +CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH: str +CERT_EFSBLOB_REGPATH: str +CERT_EFSBLOB_VALUE_NAME: str +CERT_PROT_ROOT_FLAGS_REGPATH: str +CERT_PROT_ROOT_FLAGS_VALUE_NAME: str +CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH: str +CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH: str +CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH: str +CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME: str +CERT_OCM_SUBCOMPONENTS_LOCAL_MACHINE_REGPATH: str +CERT_OCM_SUBCOMPONENTS_ROOT_AUTO_UPDATE_VALUE_NAME: str +CERT_DISABLE_ROOT_AUTO_UPDATE_REGPATH: str +CERT_DISABLE_ROOT_AUTO_UPDATE_VALUE_NAME: str +CERT_REGISTRY_STORE_REMOTE_FLAG: int +CERT_REGISTRY_STORE_SERIALIZED_FLAG: int +CERT_REGISTRY_STORE_CLIENT_GPT_FLAG: int +CERT_REGISTRY_STORE_LM_GPT_FLAG: int +CERT_REGISTRY_STORE_ROAMING_FLAG: int +CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG: int +CERT_IE_DIRTY_FLAGS_REGPATH: str +CERT_FILE_STORE_COMMIT_ENABLE_FLAG: int +CERT_LDAP_STORE_SIGN_FLAG: int +CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG: int +CERT_LDAP_STORE_OPENED_FLAG: int +CERT_LDAP_STORE_UNBIND_FLAG: int +CRYPT_OID_OPEN_STORE_PROV_FUNC: str +CERT_STORE_PROV_EXTERNAL_FLAG: int +CERT_STORE_PROV_DELETED_FLAG: int +CERT_STORE_PROV_NO_PERSIST_FLAG: int +CERT_STORE_PROV_SYSTEM_STORE_FLAG: int +CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG: int +CERT_STORE_PROV_CLOSE_FUNC: int +CERT_STORE_PROV_READ_CERT_FUNC: int +CERT_STORE_PROV_WRITE_CERT_FUNC: int +CERT_STORE_PROV_DELETE_CERT_FUNC: int +CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC: int +CERT_STORE_PROV_READ_CRL_FUNC: int +CERT_STORE_PROV_WRITE_CRL_FUNC: int +CERT_STORE_PROV_DELETE_CRL_FUNC: int +CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC: int +CERT_STORE_PROV_READ_CTL_FUNC: int +CERT_STORE_PROV_WRITE_CTL_FUNC: int +CERT_STORE_PROV_DELETE_CTL_FUNC: int +CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC: int +CERT_STORE_PROV_CONTROL_FUNC: int +CERT_STORE_PROV_FIND_CERT_FUNC: int +CERT_STORE_PROV_FREE_FIND_CERT_FUNC: int +CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC: int +CERT_STORE_PROV_FIND_CRL_FUNC: int +CERT_STORE_PROV_FREE_FIND_CRL_FUNC: int +CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC: int +CERT_STORE_PROV_FIND_CTL_FUNC: int +CERT_STORE_PROV_FREE_FIND_CTL_FUNC: int +CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC: int +CERT_STORE_PROV_WRITE_ADD_FLAG: int +CERT_STORE_SAVE_AS_STORE: int +CERT_STORE_SAVE_AS_PKCS7: int +CERT_STORE_SAVE_TO_FILE: int +CERT_STORE_SAVE_TO_MEMORY: int +CERT_STORE_SAVE_TO_FILENAME_A: int +CERT_STORE_SAVE_TO_FILENAME_W: int +CERT_STORE_SAVE_TO_FILENAME: int +CERT_CLOSE_STORE_FORCE_FLAG: int +CERT_CLOSE_STORE_CHECK_FLAG: int +CERT_COMPARE_MASK: int +CERT_COMPARE_SHIFT: int +CERT_COMPARE_ANY: int +CERT_COMPARE_SHA1_HASH: int +CERT_COMPARE_NAME: int +CERT_COMPARE_ATTR: int +CERT_COMPARE_MD5_HASH: int +CERT_COMPARE_PROPERTY: int +CERT_COMPARE_PUBLIC_KEY: int +CERT_COMPARE_HASH: int +CERT_COMPARE_NAME_STR_A: int +CERT_COMPARE_NAME_STR_W: int +CERT_COMPARE_KEY_SPEC: int +CERT_COMPARE_ENHKEY_USAGE: int +CERT_COMPARE_CTL_USAGE: int +CERT_COMPARE_SUBJECT_CERT: int +CERT_COMPARE_ISSUER_OF: int +CERT_COMPARE_EXISTING: int +CERT_COMPARE_SIGNATURE_HASH: int +CERT_COMPARE_KEY_IDENTIFIER: int +CERT_COMPARE_CERT_ID: int +CERT_COMPARE_CROSS_CERT_DIST_POINTS: int +CERT_COMPARE_PUBKEY_MD5_HASH: int +CERT_FIND_ANY: int +CERT_FIND_SHA1_HASH: int +CERT_FIND_MD5_HASH: int +CERT_FIND_SIGNATURE_HASH: int +CERT_FIND_KEY_IDENTIFIER: int +CERT_FIND_HASH: int +CERT_FIND_PROPERTY: int +CERT_FIND_PUBLIC_KEY: int +CERT_FIND_SUBJECT_NAME: int +CERT_FIND_SUBJECT_ATTR: int +CERT_FIND_ISSUER_NAME: int +CERT_FIND_ISSUER_ATTR: int +CERT_FIND_SUBJECT_STR_A: int +CERT_FIND_SUBJECT_STR_W: int +CERT_FIND_SUBJECT_STR: int +CERT_FIND_ISSUER_STR_A: int +CERT_FIND_ISSUER_STR_W: int +CERT_FIND_ISSUER_STR: int +CERT_FIND_KEY_SPEC: int +CERT_FIND_ENHKEY_USAGE: int +CERT_FIND_CTL_USAGE: int +CERT_FIND_SUBJECT_CERT: int +CERT_FIND_ISSUER_OF: int +CERT_FIND_EXISTING: int +CERT_FIND_CERT_ID: int +CERT_FIND_CROSS_CERT_DIST_POINTS: int +CERT_FIND_PUBKEY_MD5_HASH: int +CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG: int +CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG: int +CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG: int +CERT_FIND_NO_ENHKEY_USAGE_FLAG: int +CERT_FIND_OR_ENHKEY_USAGE_FLAG: int +CERT_FIND_VALID_ENHKEY_USAGE_FLAG: int +CERT_FIND_OPTIONAL_CTL_USAGE_FLAG: int +CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG: int +CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG: int +CERT_FIND_NO_CTL_USAGE_FLAG: int +CERT_FIND_OR_CTL_USAGE_FLAG: int +CERT_FIND_VALID_CTL_USAGE_FLAG: int +CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG: int +CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG: int +CTL_ENTRY_FROM_PROP_CHAIN_FLAG: int +CRL_FIND_ANY: int +CRL_FIND_ISSUED_BY: int +CRL_FIND_EXISTING: int +CRL_FIND_ISSUED_FOR: int +CRL_FIND_ISSUED_BY_AKI_FLAG: int +CRL_FIND_ISSUED_BY_SIGNATURE_FLAG: int +CRL_FIND_ISSUED_BY_DELTA_FLAG: int +CRL_FIND_ISSUED_BY_BASE_FLAG: int +CERT_STORE_ADD_NEW: int +CERT_STORE_ADD_USE_EXISTING: int +CERT_STORE_ADD_REPLACE_EXISTING: int +CERT_STORE_ADD_ALWAYS: int +CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: int +CERT_STORE_ADD_NEWER: int +CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: int +CERT_STORE_CERTIFICATE_CONTEXT: int +CERT_STORE_CRL_CONTEXT: int +CERT_STORE_CTL_CONTEXT: int +CERT_STORE_ALL_CONTEXT_FLAG: int +CERT_STORE_CERTIFICATE_CONTEXT_FLAG: int +CERT_STORE_CRL_CONTEXT_FLAG: int +CERT_STORE_CTL_CONTEXT_FLAG: int +CTL_ANY_SUBJECT_TYPE: int +CTL_CERT_SUBJECT_TYPE: int +CTL_FIND_ANY: int +CTL_FIND_SHA1_HASH: int +CTL_FIND_MD5_HASH: int +CTL_FIND_USAGE: int +CTL_FIND_SUBJECT: int +CTL_FIND_EXISTING: int +CTL_FIND_SAME_USAGE_FLAG: int +CERT_STORE_CTRL_RESYNC: int +CERT_STORE_CTRL_NOTIFY_CHANGE: int +CERT_STORE_CTRL_COMMIT: int +CERT_STORE_CTRL_AUTO_RESYNC: int +CERT_STORE_CTRL_CANCEL_NOTIFY: int +CERT_STORE_CTRL_INHIBIT_DUPLICATE_HANDLE_FLAG: int +CERT_STORE_CTRL_COMMIT_FORCE_FLAG: int +CERT_STORE_CTRL_COMMIT_CLEAR_FLAG: int +CERT_STORE_LOCALIZED_NAME_PROP_ID: int +CERT_CREATE_CONTEXT_NOCOPY_FLAG: int +CERT_CREATE_CONTEXT_SORTED_FLAG: int +CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG: int +CERT_CREATE_CONTEXT_NO_ENTRY_FLAG: int +CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG: int +CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG: int +CERT_PHYSICAL_STORE_REMOTE_OPEN_DISABLE_FLAG: int +CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG: int +CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG: int +CERT_PHYSICAL_STORE_DEFAULT_NAME: str +CERT_PHYSICAL_STORE_GROUP_POLICY_NAME: str +CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME: str +CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME: str +CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME: str +CERT_PHYSICAL_STORE_ENTERPRISE_NAME: str +CERT_PHYSICAL_STORE_AUTH_ROOT_NAME: str +CERT_PHYSICAL_STORE_SMART_CARD_NAME: str +CRYPT_OID_OPEN_SYSTEM_STORE_PROV_FUNC: str +CRYPT_OID_REGISTER_SYSTEM_STORE_FUNC: str +CRYPT_OID_UNREGISTER_SYSTEM_STORE_FUNC: str +CRYPT_OID_ENUM_SYSTEM_STORE_FUNC: str +CRYPT_OID_REGISTER_PHYSICAL_STORE_FUNC: str +CRYPT_OID_UNREGISTER_PHYSICAL_STORE_FUNC: str +CRYPT_OID_ENUM_PHYSICAL_STORE_FUNC: str +CRYPT_OID_SYSTEM_STORE_LOCATION_VALUE_NAME: str +CMSG_TRUSTED_SIGNER_FLAG: int +CMSG_SIGNER_ONLY_FLAG: int +CMSG_USE_SIGNER_INDEX_FLAG: int +CMSG_CMS_ENCAPSULATED_CTL_FLAG: int +CMSG_ENCODE_SORTED_CTL_FLAG: int +CMSG_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: int +CERT_VERIFY_INHIBIT_CTL_UPDATE_FLAG: int +CERT_VERIFY_TRUSTED_SIGNERS_FLAG: int +CERT_VERIFY_NO_TIME_CHECK_FLAG: int +CERT_VERIFY_ALLOW_MORE_USAGE_FLAG: int +CERT_VERIFY_UPDATED_CTL_FLAG: int +CERT_CONTEXT_REVOCATION_TYPE: int +CERT_VERIFY_REV_CHAIN_FLAG: int +CERT_VERIFY_CACHE_ONLY_BASED_REVOCATION: int +CERT_VERIFY_REV_ACCUMULATIVE_TIMEOUT_FLAG: int +CERT_UNICODE_IS_RDN_ATTRS_FLAG: int +CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG: int +CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB: int +CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT: int +CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL: int +CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY: int +CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT: int +CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN: int +CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL: int +CRYPT_DEFAULT_CONTEXT_AUTO_RELEASE_FLAG: int +CRYPT_DEFAULT_CONTEXT_PROCESS_FLAG: int +CRYPT_DEFAULT_CONTEXT_CERT_SIGN_OID: int +CRYPT_DEFAULT_CONTEXT_MULTI_CERT_SIGN_OID: int +CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC: str +CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC: str +CRYPT_ACQUIRE_CACHE_FLAG: int +CRYPT_ACQUIRE_USE_PROV_INFO_FLAG: int +CRYPT_ACQUIRE_COMPARE_KEY_FLAG: int +CRYPT_ACQUIRE_SILENT_FLAG: int +CRYPT_FIND_USER_KEYSET_FLAG: int +CRYPT_FIND_MACHINE_KEYSET_FLAG: int +CRYPT_FIND_SILENT_KEYSET_FLAG: int +CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC: str +CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC: str +CRYPT_DELETE_KEYSET: int +CERT_SIMPLE_NAME_STR: int +CERT_OID_NAME_STR: int +CERT_X500_NAME_STR: int +CERT_NAME_STR_SEMICOLON_FLAG: int +CERT_NAME_STR_NO_PLUS_FLAG: int +CERT_NAME_STR_NO_QUOTING_FLAG: int +CERT_NAME_STR_CRLF_FLAG: int +CERT_NAME_STR_COMMA_FLAG: int +CERT_NAME_STR_REVERSE_FLAG: int +CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG: int +CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG: int +CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG: int +CERT_NAME_EMAIL_TYPE: int +CERT_NAME_RDN_TYPE: int +CERT_NAME_ATTR_TYPE: int +CERT_NAME_SIMPLE_DISPLAY_TYPE: int +CERT_NAME_FRIENDLY_DISPLAY_TYPE: int +CERT_NAME_DNS_TYPE: int +CERT_NAME_URL_TYPE: int +CERT_NAME_UPN_TYPE: int +CERT_NAME_ISSUER_FLAG: int +CERT_NAME_DISABLE_IE4_UTF8_FLAG: int +CRYPT_MESSAGE_BARE_CONTENT_OUT_FLAG: int +CRYPT_MESSAGE_ENCAPSULATED_CONTENT_OUT_FLAG: int +CRYPT_MESSAGE_KEYID_SIGNER_FLAG: int +CRYPT_MESSAGE_SILENT_KEYSET_FLAG: int +CRYPT_MESSAGE_KEYID_RECIPIENT_FLAG: int +CERT_QUERY_OBJECT_FILE: int +CERT_QUERY_OBJECT_BLOB: int +CERT_QUERY_CONTENT_CERT: int +CERT_QUERY_CONTENT_CTL: int +CERT_QUERY_CONTENT_CRL: int +CERT_QUERY_CONTENT_SERIALIZED_STORE: int +CERT_QUERY_CONTENT_SERIALIZED_CERT: int +CERT_QUERY_CONTENT_SERIALIZED_CTL: int +CERT_QUERY_CONTENT_SERIALIZED_CRL: int +CERT_QUERY_CONTENT_PKCS7_SIGNED: int +CERT_QUERY_CONTENT_PKCS7_UNSIGNED: int +CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED: int +CERT_QUERY_CONTENT_PKCS10: int +CERT_QUERY_CONTENT_PFX: int +CERT_QUERY_CONTENT_CERT_PAIR: int +CERT_QUERY_CONTENT_FLAG_CERT: int +CERT_QUERY_CONTENT_FLAG_CTL: int +CERT_QUERY_CONTENT_FLAG_CRL: int +CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE: int +CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT: int +CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL: int +CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL: int +CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED: int +CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED: int +CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED: int +CERT_QUERY_CONTENT_FLAG_PKCS10: int +CERT_QUERY_CONTENT_FLAG_PFX: int +CERT_QUERY_CONTENT_FLAG_CERT_PAIR: int +CERT_QUERY_CONTENT_FLAG_ALL: int +CERT_QUERY_FORMAT_BINARY: int +CERT_QUERY_FORMAT_BASE64_ENCODED: int +CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED: int +CERT_QUERY_FORMAT_FLAG_BINARY: int +CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED: int +CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED: int +CERT_QUERY_FORMAT_FLAG_ALL: int +CREDENTIAL_OID_PASSWORD_CREDENTIALS_A: int +CREDENTIAL_OID_PASSWORD_CREDENTIALS_W: int +CREDENTIAL_OID_PASSWORD_CREDENTIALS: int +SCHEME_OID_RETRIEVE_ENCODED_OBJECT_FUNC: str +SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC: str +CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC: str +CONTEXT_OID_CERTIFICATE: int +CONTEXT_OID_CRL: int +CONTEXT_OID_CTL: int +CONTEXT_OID_PKCS7: int +CONTEXT_OID_CAPI2_ANY: int +CONTEXT_OID_OCSP_RESP: int +CRYPT_RETRIEVE_MULTIPLE_OBJECTS: int +CRYPT_CACHE_ONLY_RETRIEVAL: int +CRYPT_WIRE_ONLY_RETRIEVAL: int +CRYPT_DONT_CACHE_RESULT: int +CRYPT_ASYNC_RETRIEVAL: int +CRYPT_STICKY_CACHE_RETRIEVAL: int +CRYPT_LDAP_SCOPE_BASE_ONLY_RETRIEVAL: int +CRYPT_OFFLINE_CHECK_RETRIEVAL: int +CRYPT_LDAP_INSERT_ENTRY_ATTRIBUTE: int +CRYPT_LDAP_SIGN_RETRIEVAL: int +CRYPT_NO_AUTH_RETRIEVAL: int +CRYPT_LDAP_AREC_EXCLUSIVE_RETRIEVAL: int +CRYPT_AIA_RETRIEVAL: int +CRYPT_VERIFY_CONTEXT_SIGNATURE: int +CRYPT_VERIFY_DATA_HASH: int +CRYPT_KEEP_TIME_VALID: int +CRYPT_DONT_VERIFY_SIGNATURE: int +CRYPT_DONT_CHECK_TIME_VALIDITY: int +CRYPT_CHECK_FRESHNESS_TIME_VALIDITY: int +CRYPT_ACCUMULATIVE_TIMEOUT: int +CRYPT_PARAM_ASYNC_RETRIEVAL_COMPLETION: int +CRYPT_PARAM_CANCEL_ASYNC_RETRIEVAL: int +CRYPT_GET_URL_FROM_PROPERTY: int +CRYPT_GET_URL_FROM_EXTENSION: int +CRYPT_GET_URL_FROM_UNAUTH_ATTRIBUTE: int +CRYPT_GET_URL_FROM_AUTH_ATTRIBUTE: int +URL_OID_GET_OBJECT_URL_FUNC: str +TIME_VALID_OID_GET_OBJECT_FUNC: str +TIME_VALID_OID_FLUSH_OBJECT_FUNC: str +TIME_VALID_OID_GET_CTL: int +TIME_VALID_OID_GET_CRL: int +TIME_VALID_OID_GET_CRL_FROM_CERT: int +TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CERT: int +TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CRL: int +TIME_VALID_OID_FLUSH_CTL: int +TIME_VALID_OID_FLUSH_CRL: int +TIME_VALID_OID_FLUSH_CRL_FROM_CERT: int +TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CERT: int +TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CRL: int +CRYPTPROTECT_PROMPT_ON_UNPROTECT: int +CRYPTPROTECT_PROMPT_ON_PROTECT: int +CRYPTPROTECT_PROMPT_RESERVED: int +CRYPTPROTECT_PROMPT_STRONG: int +CRYPTPROTECT_PROMPT_REQUIRE_STRONG: int +CRYPTPROTECT_UI_FORBIDDEN: int +CRYPTPROTECT_LOCAL_MACHINE: int +CRYPTPROTECT_CRED_SYNC: int +CRYPTPROTECT_AUDIT: int +CRYPTPROTECT_NO_RECOVERY: int +CRYPTPROTECT_VERIFY_PROTECTION: int +CRYPTPROTECT_CRED_REGENERATE: int +CRYPTPROTECT_FIRST_RESERVED_FLAGVAL: int +CRYPTPROTECT_LAST_RESERVED_FLAGVAL: int +CRYPTPROTECTMEMORY_BLOCK_SIZE: int +CRYPTPROTECTMEMORY_SAME_PROCESS: int +CRYPTPROTECTMEMORY_CROSS_PROCESS: int +CRYPTPROTECTMEMORY_SAME_LOGON: int +CERT_CREATE_SELFSIGN_NO_SIGN: int +CERT_CREATE_SELFSIGN_NO_KEY_INFO: int +CRYPT_KEYID_MACHINE_FLAG: int +CRYPT_KEYID_ALLOC_FLAG: int +CRYPT_KEYID_DELETE_FLAG: int +CRYPT_KEYID_SET_NEW_FLAG: int +CERT_CHAIN_MAX_AIA_URL_COUNT_IN_CERT_DEFAULT: int +CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_COUNT_PER_CHAIN_DEFAULT: int +CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_BYTE_COUNT_DEFAULT: int +CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_CERT_COUNT_DEFAULT: int +CERT_CHAIN_CACHE_END_CERT: int +CERT_CHAIN_THREAD_STORE_SYNC: int +CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL: int +CERT_CHAIN_USE_LOCAL_MACHINE_STORE: int +CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE: int +CERT_CHAIN_ENABLE_SHARE_STORE: int +CERT_TRUST_NO_ERROR: int +CERT_TRUST_IS_NOT_TIME_VALID: int +CERT_TRUST_IS_NOT_TIME_NESTED: int +CERT_TRUST_IS_REVOKED: int +CERT_TRUST_IS_NOT_SIGNATURE_VALID: int +CERT_TRUST_IS_NOT_VALID_FOR_USAGE: int +CERT_TRUST_IS_UNTRUSTED_ROOT: int +CERT_TRUST_REVOCATION_STATUS_UNKNOWN: int +CERT_TRUST_IS_CYCLIC: int +CERT_TRUST_INVALID_EXTENSION: int +CERT_TRUST_INVALID_POLICY_CONSTRAINTS: int +CERT_TRUST_INVALID_BASIC_CONSTRAINTS: int +CERT_TRUST_INVALID_NAME_CONSTRAINTS: int +CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT: int +CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT: int +CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT: int +CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT: int +CERT_TRUST_IS_OFFLINE_REVOCATION: int +CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY: int +CERT_TRUST_IS_PARTIAL_CHAIN: int +CERT_TRUST_CTL_IS_NOT_TIME_VALID: int +CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID: int +CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE: int +CERT_TRUST_HAS_EXACT_MATCH_ISSUER: int +CERT_TRUST_HAS_KEY_MATCH_ISSUER: int +CERT_TRUST_HAS_NAME_MATCH_ISSUER: int +CERT_TRUST_IS_SELF_SIGNED: int +CERT_TRUST_HAS_PREFERRED_ISSUER: int +CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY: int +CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS: int +CERT_TRUST_IS_COMPLEX_CHAIN: int +USAGE_MATCH_TYPE_AND: int +USAGE_MATCH_TYPE_OR: int +CERT_CHAIN_REVOCATION_CHECK_END_CERT: int +CERT_CHAIN_REVOCATION_CHECK_CHAIN: int +CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: int +CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY: int +CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT: int +CERT_CHAIN_DISABLE_PASS1_QUALITY_FILTERING: int +CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS: int +CERT_CHAIN_DISABLE_AUTH_ROOT_AUTO_UPDATE: int +CERT_CHAIN_TIMESTAMP_TIME: int +REVOCATION_OID_CRL_REVOCATION: int +CERT_CHAIN_FIND_BY_ISSUER: int +CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG: int +CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG: int +CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG: int +CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG: int +CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG: int +CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG: int +CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG: int +CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG: int +CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG: int +CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG: int +CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS: int +CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG: int +CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG: int +CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG: int +CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG: int +CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG: int +CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG: int +CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG: int +CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG: int +CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS: int +CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG: int +CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG: int +CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC: str +AUTHTYPE_CLIENT: int +AUTHTYPE_SERVER: int +BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_CA_FLAG: int +BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_END_ENTITY_FLAG: int +MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG: int +CRYPT_STRING_BASE64HEADER: int +CRYPT_STRING_BASE64: int +CRYPT_STRING_BINARY: int +CRYPT_STRING_BASE64REQUESTHEADER: int +CRYPT_STRING_HEX: int +CRYPT_STRING_HEXASCII: int +CRYPT_STRING_BASE64_ANY: int +CRYPT_STRING_ANY: int +CRYPT_STRING_HEX_ANY: int +CRYPT_STRING_BASE64X509CRLHEADER: int +CRYPT_STRING_HEXADDR: int +CRYPT_STRING_HEXASCIIADDR: int +CRYPT_STRING_NOCR: int +CRYPT_USER_KEYSET: int +PKCS12_IMPORT_RESERVED_MASK: int +REPORT_NO_PRIVATE_KEY: int +REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY: int +EXPORT_PRIVATE_KEYS: int +PKCS12_EXPORT_RESERVED_MASK: int +CERT_STORE_PROV_MSG: int +CERT_STORE_PROV_MEMORY: int +CERT_STORE_PROV_FILE: int +CERT_STORE_PROV_REG: int +CERT_STORE_PROV_PKCS7: int +CERT_STORE_PROV_SERIALIZED: int +CERT_STORE_PROV_FILENAME: int +CERT_STORE_PROV_SYSTEM: int +CERT_STORE_PROV_COLLECTION: int +CERT_STORE_PROV_SYSTEM_REGISTRY: int +CERT_STORE_PROV_PHYSICAL: int +CERT_STORE_PROV_SMART_CARD: int +CERT_STORE_PROV_LDAP: int +URL_OID_CERTIFICATE_ISSUER: int +URL_OID_CERTIFICATE_CRL_DIST_POINT: int +URL_OID_CTL_ISSUER: int +URL_OID_CTL_NEXT_UPDATE: int +URL_OID_CRL_ISSUER: int +URL_OID_CERTIFICATE_FRESHEST_CRL: int +URL_OID_CRL_FRESHEST_CRL: int +URL_OID_CROSS_CERT_DIST_POINT: int +URL_OID_CERTIFICATE_OCSP: int +URL_OID_CERTIFICATE_OCSP_AND_CRL_DIST_POINT: int +URL_OID_CERTIFICATE_CRL_DIST_POINT_AND_OCSP: int +URL_OID_CROSS_CERT_SUBJECT_INFO_ACCESS: int +URL_OID_CERTIFICATE_ONLY_OCSP: int +CMSG_CTRL_MAIL_LIST_DECRYPT: int +CMSG_MAIL_LIST_ENCRYPT_FREE_PARA_FLAG: int +CMSG_MAIL_LIST_HANDLE_KEY_CHOICE: int +CMSG_MAIL_LIST_RECIPIENT: int +CMSG_MAIL_LIST_VERSION: int +CMSG_OID_EXPORT_MAIL_LIST_FUNC: str +CMSG_OID_IMPORT_MAIL_LIST_FUNC: str +CTL_FIND_NO_LIST_ID_CBDATA: int +szOID_AUTHORITY_REVOCATION_LIST: str +szOID_CERTIFICATE_REVOCATION_LIST: str +szOID_ROOT_LIST_SIGNER: str diff --git a/stubs/pywin32/win32/lib/win32evtlogutil.pyi b/stubs/pywin32/win32/lib/win32evtlogutil.pyi new file mode 100644 index 0000000..faf4b30 --- /dev/null +++ b/stubs/pywin32/win32/lib/win32evtlogutil.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete + +error: Incomplete +langid: Incomplete + +def AddSourceToRegistry( + appName, msgDLL: Incomplete | None = ..., eventLogType: str = ..., eventLogFlags: Incomplete | None = ... +) -> None: ... +def RemoveSourceFromRegistry(appName, eventLogType: str = ...) -> None: ... +def ReportEvent( + appName, + eventID, + eventCategory: int = ..., + eventType=..., + strings: Incomplete | None = ..., + data: Incomplete | None = ..., + sid: Incomplete | None = ..., +) -> None: ... +def FormatMessage(eventLogRecord, logType: str = ...): ... +def SafeFormatMessage(eventLogRecord, logType: Incomplete | None = ...): ... +def FeedEventLogRecords(feeder, machineName: Incomplete | None = ..., logName: str = ..., readFlags: Incomplete | None = ...): ... diff --git a/stubs/pywin32/win32/lib/win32gui_struct.pyi b/stubs/pywin32/win32/lib/win32gui_struct.pyi new file mode 100644 index 0000000..e7f2c24 --- /dev/null +++ b/stubs/pywin32/win32/lib/win32gui_struct.pyi @@ -0,0 +1,198 @@ +from _typeshed import Incomplete, ReadableBuffer +from array import array +from typing import NamedTuple + +is64bit: bool + +class _WMNOTIFY(NamedTuple): + hwndFrom: Incomplete + idFrom: Incomplete + code: Incomplete + +def UnpackWMNOTIFY(lparam: int) -> _WMNOTIFY: ... + +class _NMITEMACTIVATE(NamedTuple): + hwndFrom: Incomplete + idFrom: Incomplete + code: Incomplete + iItem: Incomplete + iSubItem: Incomplete + uNewState: Incomplete + uOldState: Incomplete + uChanged: Incomplete + actionx: Incomplete + actiony: Incomplete + lParam: Incomplete + +def UnpackNMITEMACTIVATE(lparam) -> _NMITEMACTIVATE: ... +def PackMENUITEMINFO( + fType: Incomplete | None = ..., + fState: Incomplete | None = ..., + wID: Incomplete | None = ..., + hSubMenu: Incomplete | None = ..., + hbmpChecked: Incomplete | None = ..., + hbmpUnchecked: Incomplete | None = ..., + dwItemData: Incomplete | None = ..., + text: Incomplete | None = ..., + hbmpItem: Incomplete | None = ..., + dwTypeData: Incomplete | None = ..., +) -> tuple[array[int], list[Incomplete]]: ... + +class _MENUITEMINFO(NamedTuple): + fType: int | None + fState: int | None + wID: int | None + hSubMenu: int | None + hbmpChecked: int | None + hbmpUnchecked: int | None + dwItemData: int | None + text: str | None + hbmpItem: int | None + +def UnpackMENUITEMINFO(s: ReadableBuffer) -> _MENUITEMINFO: ... +def EmptyMENUITEMINFO(mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[array[int]]]: ... +def PackMENUINFO( + dwStyle: Incomplete | None = ..., + cyMax: Incomplete | None = ..., + hbrBack: Incomplete | None = ..., + dwContextHelpID: Incomplete | None = ..., + dwMenuData: Incomplete | None = ..., + fMask: int = ..., +) -> array[int]: ... + +class _MENUINFO(NamedTuple): + dwStyle: Incomplete | None + cyMax: Incomplete | None + hbrBack: Incomplete | None + dwContextHelpID: Incomplete | None + dwMenuData: Incomplete | None + +def UnpackMENUINFO(s: ReadableBuffer) -> _MENUINFO: ... +def EmptyMENUINFO(mask: Incomplete | None = ...) -> array[int]: ... +def PackTVINSERTSTRUCT(parent, insertAfter, tvitem) -> tuple[bytes, list[Incomplete]]: ... +def PackTVITEM(hitem, state, stateMask, text, image, selimage, citems, param) -> tuple[array[int], list[Incomplete]]: ... +def EmptyTVITEM(hitem, mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ... + +class _TVITEM(NamedTuple): + item_hItem: Incomplete + item_state: Incomplete | None + item_stateMask: Incomplete | None + text: Incomplete | None + item_image: Incomplete | None + item_selimage: Incomplete | None + item_cChildren: Incomplete | None + item_param: Incomplete | None + +def UnpackTVITEM(buffer: ReadableBuffer) -> _TVITEM: ... + +class _TVNOTIFY(NamedTuple): + hwndFrom: Incomplete + id: Incomplete + code: Incomplete + action: Incomplete + item_old: _TVITEM + item_new: _TVITEM + +def UnpackTVNOTIFY(lparam: int) -> _TVNOTIFY: ... + +class _TVDISPINFO(NamedTuple): + hwndFrom: Incomplete + id: Incomplete + code: Incomplete + item: _TVITEM + +def UnpackTVDISPINFO(lparam: int) -> _TVDISPINFO: ... +def PackLVITEM( + item: Incomplete | None = ..., + subItem: Incomplete | None = ..., + state: Incomplete | None = ..., + stateMask: Incomplete | None = ..., + text: Incomplete | None = ..., + image: Incomplete | None = ..., + param: Incomplete | None = ..., + indent: Incomplete | None = ..., +) -> tuple[array[int], list[Incomplete]]: ... + +class _LVITEM(NamedTuple): + item_item: Incomplete + item_subItem: Incomplete + item_state: Incomplete | None + item_stateMask: Incomplete | None + text: Incomplete | None + item_image: Incomplete | None + item_param: Incomplete | None + item_indent: Incomplete | None + +def UnpackLVITEM(buffer: ReadableBuffer) -> _LVITEM: ... + +class _LVDISPINFO(NamedTuple): + hwndFrom: Incomplete + id: Incomplete + code: Incomplete + item: _LVITEM + +def UnpackLVDISPINFO(lparam: int) -> _LVDISPINFO: ... + +class _UnpackLVNOTIFY(NamedTuple): + hwndFrom: Incomplete + id: Incomplete + code: Incomplete + item: Incomplete + subitem: Incomplete + newstate: Incomplete + oldstate: Incomplete + changed: Incomplete + pt: tuple[Incomplete, Incomplete] + lparam: Incomplete + +def UnpackLVNOTIFY(lparam: int) -> _UnpackLVNOTIFY: ... +def EmptyLVITEM( + item, subitem, mask: Incomplete | None = ..., text_buf_size: int = ... +) -> tuple[array[int], list[Incomplete]]: ... +def PackLVCOLUMN( + fmt: Incomplete | None = ..., + cx: Incomplete | None = ..., + text: Incomplete | None = ..., + subItem: Incomplete | None = ..., + image: Incomplete | None = ..., + order: Incomplete | None = ..., +) -> tuple[array[int], list[Incomplete]]: ... + +class _LVCOLUMN(NamedTuple): + fmt: Incomplete | None + cx: Incomplete | None + text: Incomplete | None + subItem: Incomplete | None + image: Incomplete | None + order: Incomplete | None + +def UnpackLVCOLUMN(lparam: ReadableBuffer) -> _LVCOLUMN: ... +def EmptyLVCOLUMN(mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ... +def PackLVHITTEST(pt) -> tuple[array[int], None]: ... + +class _LVHITTEST(NamedTuple): + pt: tuple[Incomplete, Incomplete] + flags: Incomplete + item: Incomplete + subitem: Incomplete + +def UnpackLVHITTEST(buf: ReadableBuffer) -> tuple[tuple[Incomplete, Incomplete], Incomplete, Incomplete, Incomplete]: ... +def PackHDITEM( + cxy: Incomplete | None = ..., + text: Incomplete | None = ..., + hbm: Incomplete | None = ..., + fmt: Incomplete | None = ..., + param: Incomplete | None = ..., + image: Incomplete | None = ..., + order: Incomplete | None = ..., +) -> tuple[array[int], list[Incomplete]]: ... +def PackDEV_BROADCAST(devicetype, rest_fmt, rest_data, extra_data=...) -> bytes: ... +def PackDEV_BROADCAST_HANDLE(handle, hdevnotify: int = ..., guid=..., name_offset: int = ..., data=...) -> bytes: ... +def PackDEV_BROADCAST_VOLUME(unitmask, flags) -> bytes: ... +def PackDEV_BROADCAST_DEVICEINTERFACE(classguid, name: str = ...) -> bytes: ... + +class DEV_BROADCAST_INFO: + devicetype: Incomplete + def __init__(self, devicetype, **kw) -> None: ... + +def UnpackDEV_BROADCAST(lparam: int) -> DEV_BROADCAST_INFO | None: ... diff --git a/stubs/pywin32/win32/lib/win32inetcon.pyi b/stubs/pywin32/win32/lib/win32inetcon.pyi new file mode 100644 index 0000000..10e562a --- /dev/null +++ b/stubs/pywin32/win32/lib/win32inetcon.pyi @@ -0,0 +1,989 @@ +INTERNET_INVALID_PORT_NUMBER: int +INTERNET_DEFAULT_FTP_PORT: int +INTERNET_DEFAULT_GOPHER_PORT: int +INTERNET_DEFAULT_HTTP_PORT: int +INTERNET_DEFAULT_HTTPS_PORT: int +INTERNET_DEFAULT_SOCKS_PORT: int +INTERNET_MAX_HOST_NAME_LENGTH: int +INTERNET_MAX_USER_NAME_LENGTH: int +INTERNET_MAX_PASSWORD_LENGTH: int +INTERNET_MAX_PORT_NUMBER_LENGTH: int +INTERNET_MAX_PORT_NUMBER_VALUE: int +INTERNET_MAX_PATH_LENGTH: int +INTERNET_MAX_SCHEME_LENGTH: int +INTERNET_KEEP_ALIVE_ENABLED: int +INTERNET_KEEP_ALIVE_DISABLED: int +INTERNET_REQFLAG_FROM_CACHE: int +INTERNET_REQFLAG_ASYNC: int +INTERNET_REQFLAG_VIA_PROXY: int +INTERNET_REQFLAG_NO_HEADERS: int +INTERNET_REQFLAG_PASSIVE: int +INTERNET_REQFLAG_CACHE_WRITE_DISABLED: int +INTERNET_REQFLAG_NET_TIMEOUT: int +INTERNET_FLAG_RELOAD: int +INTERNET_FLAG_RAW_DATA: int +INTERNET_FLAG_EXISTING_CONNECT: int +INTERNET_FLAG_ASYNC: int +INTERNET_FLAG_PASSIVE: int +INTERNET_FLAG_NO_CACHE_WRITE: int +INTERNET_FLAG_DONT_CACHE: int +INTERNET_FLAG_MAKE_PERSISTENT: int +INTERNET_FLAG_FROM_CACHE: int +INTERNET_FLAG_OFFLINE: int +INTERNET_FLAG_SECURE: int +INTERNET_FLAG_KEEP_CONNECTION: int +INTERNET_FLAG_NO_AUTO_REDIRECT: int +INTERNET_FLAG_READ_PREFETCH: int +INTERNET_FLAG_NO_COOKIES: int +INTERNET_FLAG_NO_AUTH: int +INTERNET_FLAG_RESTRICTED_ZONE: int +INTERNET_FLAG_CACHE_IF_NET_FAIL: int +INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP: int +INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS: int +INTERNET_FLAG_IGNORE_CERT_DATE_INVALID: int +INTERNET_FLAG_IGNORE_CERT_CN_INVALID: int +INTERNET_FLAG_RESYNCHRONIZE: int +INTERNET_FLAG_HYPERLINK: int +INTERNET_FLAG_NO_UI: int +INTERNET_FLAG_PRAGMA_NOCACHE: int +INTERNET_FLAG_CACHE_ASYNC: int +INTERNET_FLAG_FORMS_SUBMIT: int +INTERNET_FLAG_FWD_BACK: int +INTERNET_FLAG_NEED_FILE: int +INTERNET_FLAG_MUST_CACHE_REQUEST: int +SECURITY_INTERNET_MASK: int +INTERNET_ERROR_MASK_INSERT_CDROM: int +INTERNET_ERROR_MASK_COMBINED_SEC_CERT: int +INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG: int +INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: int +WININET_API_FLAG_ASYNC: int +WININET_API_FLAG_SYNC: int +WININET_API_FLAG_USE_CONTEXT: int +INTERNET_NO_CALLBACK: int +IDSI_FLAG_KEEP_ALIVE: int +IDSI_FLAG_SECURE: int +IDSI_FLAG_PROXY: int +IDSI_FLAG_TUNNEL: int +INTERNET_PER_CONN_FLAGS: int +INTERNET_PER_CONN_PROXY_SERVER: int +INTERNET_PER_CONN_PROXY_BYPASS: int +INTERNET_PER_CONN_AUTOCONFIG_URL: int +INTERNET_PER_CONN_AUTODISCOVERY_FLAGS: int +INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL: int +INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS: int +INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME: int +INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL: int +PROXY_TYPE_DIRECT: int +PROXY_TYPE_PROXY: int +PROXY_TYPE_AUTO_PROXY_URL: int +PROXY_TYPE_AUTO_DETECT: int +AUTO_PROXY_FLAG_USER_SET: int +AUTO_PROXY_FLAG_ALWAYS_DETECT: int +AUTO_PROXY_FLAG_DETECTION_RUN: int +AUTO_PROXY_FLAG_MIGRATED: int +AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT: int +AUTO_PROXY_FLAG_CACHE_INIT_RUN: int +AUTO_PROXY_FLAG_DETECTION_SUSPECT: int +ISO_FORCE_DISCONNECTED: int +INTERNET_RFC1123_FORMAT: int +INTERNET_RFC1123_BUFSIZE: int +ICU_ESCAPE: int +ICU_USERNAME: int +ICU_NO_ENCODE: int +ICU_DECODE: int +ICU_NO_META: int +ICU_ENCODE_SPACES_ONLY: int +ICU_BROWSER_MODE: int +ICU_ENCODE_PERCENT: int +INTERNET_OPEN_TYPE_PRECONFIG: int +INTERNET_OPEN_TYPE_DIRECT: int +INTERNET_OPEN_TYPE_PROXY: int +INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY: int +PRE_CONFIG_INTERNET_ACCESS: int +LOCAL_INTERNET_ACCESS: int +CERN_PROXY_INTERNET_ACCESS: int +INTERNET_SERVICE_FTP: int +INTERNET_SERVICE_GOPHER: int +INTERNET_SERVICE_HTTP: int +IRF_ASYNC: int +IRF_SYNC: int +IRF_USE_CONTEXT: int +IRF_NO_WAIT: int +ISO_GLOBAL: int +ISO_REGISTRY: int +ISO_VALID_FLAGS: int +INTERNET_OPTION_CALLBACK: int +INTERNET_OPTION_CONNECT_TIMEOUT: int +INTERNET_OPTION_CONNECT_RETRIES: int +INTERNET_OPTION_CONNECT_BACKOFF: int +INTERNET_OPTION_SEND_TIMEOUT: int +INTERNET_OPTION_CONTROL_SEND_TIMEOUT: int +INTERNET_OPTION_RECEIVE_TIMEOUT: int +INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT: int +INTERNET_OPTION_DATA_SEND_TIMEOUT: int +INTERNET_OPTION_DATA_RECEIVE_TIMEOUT: int +INTERNET_OPTION_HANDLE_TYPE: int +INTERNET_OPTION_READ_BUFFER_SIZE: int +INTERNET_OPTION_WRITE_BUFFER_SIZE: int +INTERNET_OPTION_ASYNC_ID: int +INTERNET_OPTION_ASYNC_PRIORITY: int +INTERNET_OPTION_PARENT_HANDLE: int +INTERNET_OPTION_KEEP_CONNECTION: int +INTERNET_OPTION_REQUEST_FLAGS: int +INTERNET_OPTION_EXTENDED_ERROR: int +INTERNET_OPTION_OFFLINE_MODE: int +INTERNET_OPTION_CACHE_STREAM_HANDLE: int +INTERNET_OPTION_USERNAME: int +INTERNET_OPTION_PASSWORD: int +INTERNET_OPTION_ASYNC: int +INTERNET_OPTION_SECURITY_FLAGS: int +INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT: int +INTERNET_OPTION_DATAFILE_NAME: int +INTERNET_OPTION_URL: int +INTERNET_OPTION_SECURITY_CERTIFICATE: int +INTERNET_OPTION_SECURITY_KEY_BITNESS: int +INTERNET_OPTION_REFRESH: int +INTERNET_OPTION_PROXY: int +INTERNET_OPTION_SETTINGS_CHANGED: int +INTERNET_OPTION_VERSION: int +INTERNET_OPTION_USER_AGENT: int +INTERNET_OPTION_END_BROWSER_SESSION: int +INTERNET_OPTION_PROXY_USERNAME: int +INTERNET_OPTION_PROXY_PASSWORD: int +INTERNET_OPTION_CONTEXT_VALUE: int +INTERNET_OPTION_CONNECT_LIMIT: int +INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT: int +INTERNET_OPTION_POLICY: int +INTERNET_OPTION_DISCONNECTED_TIMEOUT: int +INTERNET_OPTION_CONNECTED_STATE: int +INTERNET_OPTION_IDLE_STATE: int +INTERNET_OPTION_OFFLINE_SEMANTICS: int +INTERNET_OPTION_SECONDARY_CACHE_KEY: int +INTERNET_OPTION_CALLBACK_FILTER: int +INTERNET_OPTION_CONNECT_TIME: int +INTERNET_OPTION_SEND_THROUGHPUT: int +INTERNET_OPTION_RECEIVE_THROUGHPUT: int +INTERNET_OPTION_REQUEST_PRIORITY: int +INTERNET_OPTION_HTTP_VERSION: int +INTERNET_OPTION_RESET_URLCACHE_SESSION: int +INTERNET_OPTION_ERROR_MASK: int +INTERNET_OPTION_FROM_CACHE_TIMEOUT: int +INTERNET_OPTION_BYPASS_EDITED_ENTRY: int +INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO: int +INTERNET_OPTION_CODEPAGE: int +INTERNET_OPTION_CACHE_TIMESTAMPS: int +INTERNET_OPTION_DISABLE_AUTODIAL: int +INTERNET_OPTION_MAX_CONNS_PER_SERVER: int +INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: int +INTERNET_OPTION_PER_CONNECTION_OPTION: int +INTERNET_OPTION_DIGEST_AUTH_UNLOAD: int +INTERNET_OPTION_IGNORE_OFFLINE: int +INTERNET_OPTION_IDENTITY: int +INTERNET_OPTION_REMOVE_IDENTITY: int +INTERNET_OPTION_ALTER_IDENTITY: int +INTERNET_OPTION_SUPPRESS_BEHAVIOR: int +INTERNET_OPTION_AUTODIAL_MODE: int +INTERNET_OPTION_AUTODIAL_CONNECTION: int +INTERNET_OPTION_CLIENT_CERT_CONTEXT: int +INTERNET_OPTION_AUTH_FLAGS: int +INTERNET_OPTION_COOKIES_3RD_PARTY: int +INTERNET_OPTION_DISABLE_PASSPORT_AUTH: int +INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY: int +INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT: int +INTERNET_OPTION_ENABLE_PASSPORT_AUTH: int +INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS: int +INTERNET_OPTION_ACTIVATE_WORKER_THREADS: int +INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS: int +INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH: int +INTERNET_OPTION_PROXY_SETTINGS_CHANGED: int +INTERNET_FIRST_OPTION: int +INTERNET_LAST_OPTION: int +INTERNET_PRIORITY_FOREGROUND: int +INTERNET_HANDLE_TYPE_INTERNET: int +INTERNET_HANDLE_TYPE_CONNECT_FTP: int +INTERNET_HANDLE_TYPE_CONNECT_GOPHER: int +INTERNET_HANDLE_TYPE_CONNECT_HTTP: int +INTERNET_HANDLE_TYPE_FTP_FIND: int +INTERNET_HANDLE_TYPE_FTP_FIND_HTML: int +INTERNET_HANDLE_TYPE_FTP_FILE: int +INTERNET_HANDLE_TYPE_FTP_FILE_HTML: int +INTERNET_HANDLE_TYPE_GOPHER_FIND: int +INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML: int +INTERNET_HANDLE_TYPE_GOPHER_FILE: int +INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML: int +INTERNET_HANDLE_TYPE_HTTP_REQUEST: int +INTERNET_HANDLE_TYPE_FILE_REQUEST: int +AUTH_FLAG_DISABLE_NEGOTIATE: int +AUTH_FLAG_ENABLE_NEGOTIATE: int +SECURITY_FLAG_SECURE: int +SECURITY_FLAG_STRENGTH_WEAK: int +SECURITY_FLAG_STRENGTH_MEDIUM: int +SECURITY_FLAG_STRENGTH_STRONG: int +SECURITY_FLAG_UNKNOWNBIT: int +SECURITY_FLAG_FORTEZZA: int +SECURITY_FLAG_NORMALBITNESS: int +SECURITY_FLAG_SSL: int +SECURITY_FLAG_SSL3: int +SECURITY_FLAG_PCT: int +SECURITY_FLAG_PCT4: int +SECURITY_FLAG_IETFSSL4: int +SECURITY_FLAG_40BIT: int +SECURITY_FLAG_128BIT: int +SECURITY_FLAG_56BIT: int +SECURITY_FLAG_IGNORE_REVOCATION: int +SECURITY_FLAG_IGNORE_UNKNOWN_CA: int +SECURITY_FLAG_IGNORE_WRONG_USAGE: int +SECURITY_FLAG_IGNORE_CERT_CN_INVALID: int +SECURITY_FLAG_IGNORE_CERT_DATE_INVALID: int +SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS: int +SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP: int +SECURITY_SET_MASK: int +AUTODIAL_MODE_NEVER: int +AUTODIAL_MODE_ALWAYS: int +AUTODIAL_MODE_NO_NETWORK_PRESENT: int +INTERNET_STATUS_RESOLVING_NAME: int +INTERNET_STATUS_NAME_RESOLVED: int +INTERNET_STATUS_CONNECTING_TO_SERVER: int +INTERNET_STATUS_CONNECTED_TO_SERVER: int +INTERNET_STATUS_SENDING_REQUEST: int +INTERNET_STATUS_REQUEST_SENT: int +INTERNET_STATUS_RECEIVING_RESPONSE: int +INTERNET_STATUS_RESPONSE_RECEIVED: int +INTERNET_STATUS_CTL_RESPONSE_RECEIVED: int +INTERNET_STATUS_PREFETCH: int +INTERNET_STATUS_CLOSING_CONNECTION: int +INTERNET_STATUS_CONNECTION_CLOSED: int +INTERNET_STATUS_HANDLE_CREATED: int +INTERNET_STATUS_HANDLE_CLOSING: int +INTERNET_STATUS_DETECTING_PROXY: int +INTERNET_STATUS_REQUEST_COMPLETE: int +INTERNET_STATUS_REDIRECT: int +INTERNET_STATUS_INTERMEDIATE_RESPONSE: int +INTERNET_STATUS_USER_INPUT_REQUIRED: int +INTERNET_STATUS_STATE_CHANGE: int +INTERNET_STATUS_COOKIE_SENT: int +INTERNET_STATUS_COOKIE_RECEIVED: int +INTERNET_STATUS_PRIVACY_IMPACTED: int +INTERNET_STATUS_P3P_HEADER: int +INTERNET_STATUS_P3P_POLICYREF: int +INTERNET_STATUS_COOKIE_HISTORY: int +INTERNET_STATE_CONNECTED: int +INTERNET_STATE_DISCONNECTED: int +INTERNET_STATE_DISCONNECTED_BY_USER: int +INTERNET_STATE_IDLE: int +INTERNET_STATE_BUSY: int +FTP_TRANSFER_TYPE_UNKNOWN: int +FTP_TRANSFER_TYPE_ASCII: int +FTP_TRANSFER_TYPE_BINARY: int +FTP_TRANSFER_TYPE_MASK: int +MAX_GOPHER_DISPLAY_TEXT: int +MAX_GOPHER_SELECTOR_TEXT: int +MAX_GOPHER_HOST_NAME: int +MAX_GOPHER_LOCATOR_LENGTH: int +GOPHER_TYPE_TEXT_FILE: int +GOPHER_TYPE_DIRECTORY: int +GOPHER_TYPE_CSO: int +GOPHER_TYPE_ERROR: int +GOPHER_TYPE_MAC_BINHEX: int +GOPHER_TYPE_DOS_ARCHIVE: int +GOPHER_TYPE_UNIX_UUENCODED: int +GOPHER_TYPE_INDEX_SERVER: int +GOPHER_TYPE_TELNET: int +GOPHER_TYPE_BINARY: int +GOPHER_TYPE_REDUNDANT: int +GOPHER_TYPE_TN3270: int +GOPHER_TYPE_GIF: int +GOPHER_TYPE_IMAGE: int +GOPHER_TYPE_BITMAP: int +GOPHER_TYPE_MOVIE: int +GOPHER_TYPE_SOUND: int +GOPHER_TYPE_HTML: int +GOPHER_TYPE_PDF: int +GOPHER_TYPE_CALENDAR: int +GOPHER_TYPE_INLINE: int +GOPHER_TYPE_UNKNOWN: int +GOPHER_TYPE_ASK: int +GOPHER_TYPE_GOPHER_PLUS: int +GOPHER_TYPE_FILE_MASK: int +MAX_GOPHER_CATEGORY_NAME: int +MAX_GOPHER_ATTRIBUTE_NAME: int +MIN_GOPHER_ATTRIBUTE_LENGTH: int +GOPHER_ATTRIBUTE_ID_BASE: int +GOPHER_CATEGORY_ID_ALL: int +GOPHER_CATEGORY_ID_INFO: int +GOPHER_CATEGORY_ID_ADMIN: int +GOPHER_CATEGORY_ID_VIEWS: int +GOPHER_CATEGORY_ID_ABSTRACT: int +GOPHER_CATEGORY_ID_VERONICA: int +GOPHER_CATEGORY_ID_ASK: int +GOPHER_CATEGORY_ID_UNKNOWN: int +GOPHER_ATTRIBUTE_ID_ALL: int +GOPHER_ATTRIBUTE_ID_ADMIN: int +GOPHER_ATTRIBUTE_ID_MOD_DATE: int +GOPHER_ATTRIBUTE_ID_TTL: int +GOPHER_ATTRIBUTE_ID_SCORE: int +GOPHER_ATTRIBUTE_ID_RANGE: int +GOPHER_ATTRIBUTE_ID_SITE: int +GOPHER_ATTRIBUTE_ID_ORG: int +GOPHER_ATTRIBUTE_ID_LOCATION: int +GOPHER_ATTRIBUTE_ID_GEOG: int +GOPHER_ATTRIBUTE_ID_TIMEZONE: int +GOPHER_ATTRIBUTE_ID_PROVIDER: int +GOPHER_ATTRIBUTE_ID_VERSION: int +GOPHER_ATTRIBUTE_ID_ABSTRACT: int +GOPHER_ATTRIBUTE_ID_VIEW: int +GOPHER_ATTRIBUTE_ID_TREEWALK: int +GOPHER_ATTRIBUTE_ID_UNKNOWN: int +HTTP_MAJOR_VERSION: int +HTTP_MINOR_VERSION: int +HTTP_VERSIONA: str +HTTP_VERSION: str +HTTP_QUERY_MIME_VERSION: int +HTTP_QUERY_CONTENT_TYPE: int +HTTP_QUERY_CONTENT_TRANSFER_ENCODING: int +HTTP_QUERY_CONTENT_ID: int +HTTP_QUERY_CONTENT_DESCRIPTION: int +HTTP_QUERY_CONTENT_LENGTH: int +HTTP_QUERY_CONTENT_LANGUAGE: int +HTTP_QUERY_ALLOW: int +HTTP_QUERY_PUBLIC: int +HTTP_QUERY_DATE: int +HTTP_QUERY_EXPIRES: int +HTTP_QUERY_LAST_MODIFIED: int +HTTP_QUERY_MESSAGE_ID: int +HTTP_QUERY_URI: int +HTTP_QUERY_DERIVED_FROM: int +HTTP_QUERY_COST: int +HTTP_QUERY_LINK: int +HTTP_QUERY_PRAGMA: int +HTTP_QUERY_VERSION: int +HTTP_QUERY_STATUS_CODE: int +HTTP_QUERY_STATUS_TEXT: int +HTTP_QUERY_RAW_HEADERS: int +HTTP_QUERY_RAW_HEADERS_CRLF: int +HTTP_QUERY_CONNECTION: int +HTTP_QUERY_ACCEPT: int +HTTP_QUERY_ACCEPT_CHARSET: int +HTTP_QUERY_ACCEPT_ENCODING: int +HTTP_QUERY_ACCEPT_LANGUAGE: int +HTTP_QUERY_AUTHORIZATION: int +HTTP_QUERY_CONTENT_ENCODING: int +HTTP_QUERY_FORWARDED: int +HTTP_QUERY_FROM: int +HTTP_QUERY_IF_MODIFIED_SINCE: int +HTTP_QUERY_LOCATION: int +HTTP_QUERY_ORIG_URI: int +HTTP_QUERY_REFERER: int +HTTP_QUERY_RETRY_AFTER: int +HTTP_QUERY_SERVER: int +HTTP_QUERY_TITLE: int +HTTP_QUERY_USER_AGENT: int +HTTP_QUERY_WWW_AUTHENTICATE: int +HTTP_QUERY_PROXY_AUTHENTICATE: int +HTTP_QUERY_ACCEPT_RANGES: int +HTTP_QUERY_SET_COOKIE: int +HTTP_QUERY_COOKIE: int +HTTP_QUERY_REQUEST_METHOD: int +HTTP_QUERY_REFRESH: int +HTTP_QUERY_CONTENT_DISPOSITION: int +HTTP_QUERY_AGE: int +HTTP_QUERY_CACHE_CONTROL: int +HTTP_QUERY_CONTENT_BASE: int +HTTP_QUERY_CONTENT_LOCATION: int +HTTP_QUERY_CONTENT_MD5: int +HTTP_QUERY_CONTENT_RANGE: int +HTTP_QUERY_ETAG: int +HTTP_QUERY_HOST: int +HTTP_QUERY_IF_MATCH: int +HTTP_QUERY_IF_NONE_MATCH: int +HTTP_QUERY_IF_RANGE: int +HTTP_QUERY_IF_UNMODIFIED_SINCE: int +HTTP_QUERY_MAX_FORWARDS: int +HTTP_QUERY_PROXY_AUTHORIZATION: int +HTTP_QUERY_RANGE: int +HTTP_QUERY_TRANSFER_ENCODING: int +HTTP_QUERY_UPGRADE: int +HTTP_QUERY_VARY: int +HTTP_QUERY_VIA: int +HTTP_QUERY_WARNING: int +HTTP_QUERY_EXPECT: int +HTTP_QUERY_PROXY_CONNECTION: int +HTTP_QUERY_UNLESS_MODIFIED_SINCE: int +HTTP_QUERY_ECHO_REQUEST: int +HTTP_QUERY_ECHO_REPLY: int +HTTP_QUERY_ECHO_HEADERS: int +HTTP_QUERY_ECHO_HEADERS_CRLF: int +HTTP_QUERY_PROXY_SUPPORT: int +HTTP_QUERY_AUTHENTICATION_INFO: int +HTTP_QUERY_PASSPORT_URLS: int +HTTP_QUERY_PASSPORT_CONFIG: int +HTTP_QUERY_MAX: int +HTTP_QUERY_CUSTOM: int +HTTP_QUERY_FLAG_REQUEST_HEADERS: int +HTTP_QUERY_FLAG_SYSTEMTIME: int +HTTP_QUERY_FLAG_NUMBER: int +HTTP_QUERY_FLAG_COALESCE: int +HTTP_QUERY_MODIFIER_FLAGS_MASK: int +HTTP_QUERY_HEADER_MASK: int +HTTP_STATUS_CONTINUE: int +HTTP_STATUS_SWITCH_PROTOCOLS: int +HTTP_STATUS_OK: int +HTTP_STATUS_CREATED: int +HTTP_STATUS_ACCEPTED: int +HTTP_STATUS_PARTIAL: int +HTTP_STATUS_NO_CONTENT: int +HTTP_STATUS_RESET_CONTENT: int +HTTP_STATUS_PARTIAL_CONTENT: int +HTTP_STATUS_AMBIGUOUS: int +HTTP_STATUS_MOVED: int +HTTP_STATUS_REDIRECT: int +HTTP_STATUS_REDIRECT_METHOD: int +HTTP_STATUS_NOT_MODIFIED: int +HTTP_STATUS_USE_PROXY: int +HTTP_STATUS_REDIRECT_KEEP_VERB: int +HTTP_STATUS_BAD_REQUEST: int +HTTP_STATUS_DENIED: int +HTTP_STATUS_PAYMENT_REQ: int +HTTP_STATUS_FORBIDDEN: int +HTTP_STATUS_NOT_FOUND: int +HTTP_STATUS_BAD_METHOD: int +HTTP_STATUS_NONE_ACCEPTABLE: int +HTTP_STATUS_PROXY_AUTH_REQ: int +HTTP_STATUS_REQUEST_TIMEOUT: int +HTTP_STATUS_CONFLICT: int +HTTP_STATUS_GONE: int +HTTP_STATUS_LENGTH_REQUIRED: int +HTTP_STATUS_PRECOND_FAILED: int +HTTP_STATUS_REQUEST_TOO_LARGE: int +HTTP_STATUS_URI_TOO_LONG: int +HTTP_STATUS_UNSUPPORTED_MEDIA: int +HTTP_STATUS_RETRY_WITH: int +HTTP_STATUS_SERVER_ERROR: int +HTTP_STATUS_NOT_SUPPORTED: int +HTTP_STATUS_BAD_GATEWAY: int +HTTP_STATUS_SERVICE_UNAVAIL: int +HTTP_STATUS_GATEWAY_TIMEOUT: int +HTTP_STATUS_VERSION_NOT_SUP: int +HTTP_STATUS_FIRST: int +HTTP_STATUS_LAST: int +HTTP_ADDREQ_INDEX_MASK: int +HTTP_ADDREQ_FLAGS_MASK: int +HTTP_ADDREQ_FLAG_ADD_IF_NEW: int +HTTP_ADDREQ_FLAG_ADD: int +HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA: int +HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON: int +HTTP_ADDREQ_FLAG_COALESCE: int +HTTP_ADDREQ_FLAG_REPLACE: int +HSR_ASYNC: int +HSR_SYNC: int +HSR_USE_CONTEXT: int +HSR_INITIATE: int +HSR_DOWNLOAD: int +HSR_CHUNKED: int +INTERNET_COOKIE_IS_SECURE: int +INTERNET_COOKIE_IS_SESSION: int +INTERNET_COOKIE_THIRD_PARTY: int +INTERNET_COOKIE_PROMPT_REQUIRED: int +INTERNET_COOKIE_EVALUATE_P3P: int +INTERNET_COOKIE_APPLY_P3P: int +INTERNET_COOKIE_P3P_ENABLED: int +INTERNET_COOKIE_IS_RESTRICTED: int +INTERNET_COOKIE_IE6: int +INTERNET_COOKIE_IS_LEGACY: int +FLAG_ICC_FORCE_CONNECTION: int +FLAGS_ERROR_UI_FILTER_FOR_ERRORS: int +FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS: int +FLAGS_ERROR_UI_FLAGS_GENERATE_DATA: int +FLAGS_ERROR_UI_FLAGS_NO_UI: int +FLAGS_ERROR_UI_SERIALIZE_DIALOGS: int +INTERNET_ERROR_BASE: int +ERROR_INTERNET_OUT_OF_HANDLES: int +ERROR_INTERNET_TIMEOUT: int +ERROR_INTERNET_EXTENDED_ERROR: int +ERROR_INTERNET_INTERNAL_ERROR: int +ERROR_INTERNET_INVALID_URL: int +ERROR_INTERNET_UNRECOGNIZED_SCHEME: int +ERROR_INTERNET_NAME_NOT_RESOLVED: int +ERROR_INTERNET_PROTOCOL_NOT_FOUND: int +ERROR_INTERNET_INVALID_OPTION: int +ERROR_INTERNET_BAD_OPTION_LENGTH: int +ERROR_INTERNET_OPTION_NOT_SETTABLE: int +ERROR_INTERNET_SHUTDOWN: int +ERROR_INTERNET_INCORRECT_USER_NAME: int +ERROR_INTERNET_INCORRECT_PASSWORD: int +ERROR_INTERNET_LOGIN_FAILURE: int +ERROR_INTERNET_INVALID_OPERATION: int +ERROR_INTERNET_OPERATION_CANCELLED: int +ERROR_INTERNET_INCORRECT_HANDLE_TYPE: int +ERROR_INTERNET_INCORRECT_HANDLE_STATE: int +ERROR_INTERNET_NOT_PROXY_REQUEST: int +ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND: int +ERROR_INTERNET_BAD_REGISTRY_PARAMETER: int +ERROR_INTERNET_NO_DIRECT_ACCESS: int +ERROR_INTERNET_NO_CONTEXT: int +ERROR_INTERNET_NO_CALLBACK: int +ERROR_INTERNET_REQUEST_PENDING: int +ERROR_INTERNET_INCORRECT_FORMAT: int +ERROR_INTERNET_ITEM_NOT_FOUND: int +ERROR_INTERNET_CANNOT_CONNECT: int +ERROR_INTERNET_CONNECTION_ABORTED: int +ERROR_INTERNET_CONNECTION_RESET: int +ERROR_INTERNET_FORCE_RETRY: int +ERROR_INTERNET_INVALID_PROXY_REQUEST: int +ERROR_INTERNET_NEED_UI: int +ERROR_INTERNET_HANDLE_EXISTS: int +ERROR_INTERNET_SEC_CERT_DATE_INVALID: int +ERROR_INTERNET_SEC_CERT_CN_INVALID: int +ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: int +ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR: int +ERROR_INTERNET_MIXED_SECURITY: int +ERROR_INTERNET_CHG_POST_IS_NON_SECURE: int +ERROR_INTERNET_POST_IS_NON_SECURE: int +ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED: int +ERROR_INTERNET_INVALID_CA: int +ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP: int +ERROR_INTERNET_ASYNC_THREAD_FAILED: int +ERROR_INTERNET_REDIRECT_SCHEME_CHANGE: int +ERROR_INTERNET_DIALOG_PENDING: int +ERROR_INTERNET_RETRY_DIALOG: int +ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR: int +ERROR_INTERNET_INSERT_CDROM: int +ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED: int +ERROR_INTERNET_SEC_CERT_ERRORS: int +ERROR_INTERNET_SEC_CERT_NO_REV: int +ERROR_INTERNET_SEC_CERT_REV_FAILED: int +ERROR_FTP_TRANSFER_IN_PROGRESS: int +ERROR_FTP_DROPPED: int +ERROR_FTP_NO_PASSIVE_MODE: int +ERROR_GOPHER_PROTOCOL_ERROR: int +ERROR_GOPHER_NOT_FILE: int +ERROR_GOPHER_DATA_ERROR: int +ERROR_GOPHER_END_OF_DATA: int +ERROR_GOPHER_INVALID_LOCATOR: int +ERROR_GOPHER_INCORRECT_LOCATOR_TYPE: int +ERROR_GOPHER_NOT_GOPHER_PLUS: int +ERROR_GOPHER_ATTRIBUTE_NOT_FOUND: int +ERROR_GOPHER_UNKNOWN_LOCATOR: int +ERROR_HTTP_HEADER_NOT_FOUND: int +ERROR_HTTP_DOWNLEVEL_SERVER: int +ERROR_HTTP_INVALID_SERVER_RESPONSE: int +ERROR_HTTP_INVALID_HEADER: int +ERROR_HTTP_INVALID_QUERY_REQUEST: int +ERROR_HTTP_HEADER_ALREADY_EXISTS: int +ERROR_HTTP_REDIRECT_FAILED: int +ERROR_HTTP_NOT_REDIRECTED: int +ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION: int +ERROR_HTTP_COOKIE_DECLINED: int +ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION: int +ERROR_INTERNET_SECURITY_CHANNEL_ERROR: int +ERROR_INTERNET_UNABLE_TO_CACHE_FILE: int +ERROR_INTERNET_TCPIP_NOT_INSTALLED: int +ERROR_INTERNET_DISCONNECTED: int +ERROR_INTERNET_SERVER_UNREACHABLE: int +ERROR_INTERNET_PROXY_SERVER_UNREACHABLE: int +ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT: int +ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT: int +ERROR_INTERNET_SEC_INVALID_CERT: int +ERROR_INTERNET_SEC_CERT_REVOKED: int +ERROR_INTERNET_FAILED_DUETOSECURITYCHECK: int +ERROR_INTERNET_NOT_INITIALIZED: int +ERROR_INTERNET_NEED_MSN_SSPI_PKG: int +ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: int +INTERNET_ERROR_LAST: int +NORMAL_CACHE_ENTRY: int +STICKY_CACHE_ENTRY: int +EDITED_CACHE_ENTRY: int +TRACK_OFFLINE_CACHE_ENTRY: int +TRACK_ONLINE_CACHE_ENTRY: int +SPARSE_CACHE_ENTRY: int +COOKIE_CACHE_ENTRY: int +URLHISTORY_CACHE_ENTRY: int +URLCACHE_FIND_DEFAULT_FILTER: int +CACHEGROUP_ATTRIBUTE_GET_ALL: int +CACHEGROUP_ATTRIBUTE_BASIC: int +CACHEGROUP_ATTRIBUTE_FLAG: int +CACHEGROUP_ATTRIBUTE_TYPE: int +CACHEGROUP_ATTRIBUTE_QUOTA: int +CACHEGROUP_ATTRIBUTE_GROUPNAME: int +CACHEGROUP_ATTRIBUTE_STORAGE: int +CACHEGROUP_FLAG_NONPURGEABLE: int +CACHEGROUP_FLAG_GIDONLY: int +CACHEGROUP_FLAG_FLUSHURL_ONDELETE: int +CACHEGROUP_SEARCH_ALL: int +CACHEGROUP_SEARCH_BYURL: int +CACHEGROUP_TYPE_INVALID: int +CACHEGROUP_READWRITE_MASK: int +GROUPNAME_MAX_LENGTH: int +GROUP_OWNER_STORAGE_SIZE: int +CACHE_ENTRY_ATTRIBUTE_FC: int +CACHE_ENTRY_HITRATE_FC: int +CACHE_ENTRY_MODTIME_FC: int +CACHE_ENTRY_EXPTIME_FC: int +CACHE_ENTRY_ACCTIME_FC: int +CACHE_ENTRY_SYNCTIME_FC: int +CACHE_ENTRY_HEADERINFO_FC: int +CACHE_ENTRY_EXEMPT_DELTA_FC: int +INTERNET_CACHE_GROUP_ADD: int +INTERNET_CACHE_GROUP_REMOVE: int +INTERNET_DIAL_FORCE_PROMPT: int +INTERNET_DIAL_SHOW_OFFLINE: int +INTERNET_DIAL_UNATTENDED: int +INTERENT_GOONLINE_REFRESH: int +INTERENT_GOONLINE_MASK: int +INTERNET_AUTODIAL_FORCE_ONLINE: int +INTERNET_AUTODIAL_FORCE_UNATTENDED: int +INTERNET_AUTODIAL_FAILIFSECURITYCHECK: int +INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT: int +INTERNET_AUTODIAL_FLAGS_MASK: int +PROXY_AUTO_DETECT_TYPE_DHCP: int +PROXY_AUTO_DETECT_TYPE_DNS_A: int +INTERNET_CONNECTION_MODEM: int +INTERNET_CONNECTION_LAN: int +INTERNET_CONNECTION_PROXY: int +INTERNET_CONNECTION_MODEM_BUSY: int +INTERNET_RAS_INSTALLED: int +INTERNET_CONNECTION_OFFLINE: int +INTERNET_CONNECTION_CONFIGURED: int +INTERNET_CUSTOMDIAL_CONNECT: int +INTERNET_CUSTOMDIAL_UNATTENDED: int +INTERNET_CUSTOMDIAL_DISCONNECT: int +INTERNET_CUSTOMDIAL_SHOWOFFLINE: int +INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED: int +INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE: int +INTERNET_CUSTOMDIAL_CAN_HANGUP: int +INTERNET_DIALSTATE_DISCONNECTED: int +INTERNET_IDENTITY_FLAG_PRIVATE_CACHE: int +INTERNET_IDENTITY_FLAG_SHARED_CACHE: int +INTERNET_IDENTITY_FLAG_CLEAR_DATA: int +INTERNET_IDENTITY_FLAG_CLEAR_COOKIES: int +INTERNET_IDENTITY_FLAG_CLEAR_HISTORY: int +INTERNET_IDENTITY_FLAG_CLEAR_CONTENT: int +INTERNET_SUPPRESS_RESET_ALL: int +INTERNET_SUPPRESS_COOKIE_POLICY: int +INTERNET_SUPPRESS_COOKIE_POLICY_RESET: int +PRIVACY_TEMPLATE_NO_COOKIES: int +PRIVACY_TEMPLATE_HIGH: int +PRIVACY_TEMPLATE_MEDIUM_HIGH: int +PRIVACY_TEMPLATE_MEDIUM: int +PRIVACY_TEMPLATE_MEDIUM_LOW: int +PRIVACY_TEMPLATE_LOW: int +PRIVACY_TEMPLATE_CUSTOM: int +PRIVACY_TEMPLATE_ADVANCED: int +PRIVACY_TEMPLATE_MAX: int +PRIVACY_TYPE_FIRST_PARTY: int +PRIVACY_TYPE_THIRD_PARTY: int +INTERNET_DEFAULT_PORT: int +WINHTTP_FLAG_ASYNC: int +WINHTTP_FLAG_SECURE: int +WINHTTP_FLAG_ESCAPE_PERCENT: int +WINHTTP_FLAG_NULL_CODEPAGE: int +WINHTTP_FLAG_BYPASS_PROXY_CACHE: int +WINHTTP_FLAG_REFRESH: int +WINHTTP_FLAG_ESCAPE_DISABLE: int +WINHTTP_FLAG_ESCAPE_DISABLE_QUERY: int +SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE: int +INTERNET_SCHEME_HTTP: int +INTERNET_SCHEME_HTTPS: int +WINHTTP_AUTOPROXY_AUTO_DETECT: int +WINHTTP_AUTOPROXY_CONFIG_URL: int +WINHTTP_AUTOPROXY_RUN_INPROCESS: int +WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY: int +WINHTTP_AUTO_DETECT_TYPE_DHCP: int +WINHTTP_AUTO_DETECT_TYPE_DNS_A: int +WINHTTP_TIME_FORMAT_BUFSIZE: int +ICU_ESCAPE_AUTHORITY: int +ICU_REJECT_USERPWD: int +WINHTTP_ACCESS_TYPE_DEFAULT_PROXY: int +WINHTTP_ACCESS_TYPE_NO_PROXY: int +WINHTTP_ACCESS_TYPE_NAMED_PROXY: int +WINHTTP_OPTION_CALLBACK: int +WINHTTP_OPTION_RESOLVE_TIMEOUT: int +WINHTTP_OPTION_CONNECT_TIMEOUT: int +WINHTTP_OPTION_CONNECT_RETRIES: int +WINHTTP_OPTION_SEND_TIMEOUT: int +WINHTTP_OPTION_RECEIVE_TIMEOUT: int +WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT: int +WINHTTP_OPTION_HANDLE_TYPE: int +WINHTTP_OPTION_READ_BUFFER_SIZE: int +WINHTTP_OPTION_WRITE_BUFFER_SIZE: int +WINHTTP_OPTION_PARENT_HANDLE: int +WINHTTP_OPTION_EXTENDED_ERROR: int +WINHTTP_OPTION_SECURITY_FLAGS: int +WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT: int +WINHTTP_OPTION_URL: int +WINHTTP_OPTION_SECURITY_KEY_BITNESS: int +WINHTTP_OPTION_PROXY: int +WINHTTP_OPTION_USER_AGENT: int +WINHTTP_OPTION_CONTEXT_VALUE: int +WINHTTP_OPTION_CLIENT_CERT_CONTEXT: int +WINHTTP_OPTION_REQUEST_PRIORITY: int +WINHTTP_OPTION_HTTP_VERSION: int +WINHTTP_OPTION_DISABLE_FEATURE: int +WINHTTP_OPTION_CODEPAGE: int +WINHTTP_OPTION_MAX_CONNS_PER_SERVER: int +WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER: int +WINHTTP_OPTION_AUTOLOGON_POLICY: int +WINHTTP_OPTION_SERVER_CERT_CONTEXT: int +WINHTTP_OPTION_ENABLE_FEATURE: int +WINHTTP_OPTION_WORKER_THREAD_COUNT: int +WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT: int +WINHTTP_OPTION_PASSPORT_COBRANDING_URL: int +WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH: int +WINHTTP_OPTION_SECURE_PROTOCOLS: int +WINHTTP_OPTION_ENABLETRACING: int +WINHTTP_OPTION_PASSPORT_SIGN_OUT: int +WINHTTP_OPTION_PASSPORT_RETURN_URL: int +WINHTTP_OPTION_REDIRECT_POLICY: int +WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS: int +WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE: int +WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE: int +WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE: int +WINHTTP_OPTION_CONNECTION_INFO: int +WINHTTP_OPTION_SPN: int +WINHTTP_OPTION_GLOBAL_PROXY_CREDS: int +WINHTTP_OPTION_GLOBAL_SERVER_CREDS: int +WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT: int +WINHTTP_OPTION_REJECT_USERPWD_IN_URL: int +WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS: int +WINHTTP_LAST_OPTION: int +WINHTTP_OPTION_USERNAME: int +WINHTTP_OPTION_PASSWORD: int +WINHTTP_OPTION_PROXY_USERNAME: int +WINHTTP_OPTION_PROXY_PASSWORD: int +WINHTTP_CONNS_PER_SERVER_UNLIMITED: int +WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM: int +WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW: int +WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH: int +WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT: int +WINHTTP_OPTION_REDIRECT_POLICY_NEVER: int +WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP: int +WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS: int +WINHTTP_OPTION_REDIRECT_POLICY_LAST: int +WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT: int +WINHTTP_DISABLE_PASSPORT_AUTH: int +WINHTTP_ENABLE_PASSPORT_AUTH: int +WINHTTP_DISABLE_PASSPORT_KEYRING: int +WINHTTP_ENABLE_PASSPORT_KEYRING: int +WINHTTP_DISABLE_COOKIES: int +WINHTTP_DISABLE_REDIRECTS: int +WINHTTP_DISABLE_AUTHENTICATION: int +WINHTTP_DISABLE_KEEP_ALIVE: int +WINHTTP_ENABLE_SSL_REVOCATION: int +WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION: int +WINHTTP_DISABLE_SPN_SERVER_PORT: int +WINHTTP_ENABLE_SPN_SERVER_PORT: int +WINHTTP_OPTION_SPN_MASK: int +WINHTTP_HANDLE_TYPE_SESSION: int +WINHTTP_HANDLE_TYPE_CONNECT: int +WINHTTP_HANDLE_TYPE_REQUEST: int +WINHTTP_AUTH_SCHEME_BASIC: int +WINHTTP_AUTH_SCHEME_NTLM: int +WINHTTP_AUTH_SCHEME_PASSPORT: int +WINHTTP_AUTH_SCHEME_DIGEST: int +WINHTTP_AUTH_SCHEME_NEGOTIATE: int +WINHTTP_AUTH_TARGET_SERVER: int +WINHTTP_AUTH_TARGET_PROXY: int +WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED: int +WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT: int +WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED: int +WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA: int +WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID: int +WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID: int +WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE: int +WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR: int +WINHTTP_FLAG_SECURE_PROTOCOL_SSL2: int +WINHTTP_FLAG_SECURE_PROTOCOL_SSL3: int +WINHTTP_FLAG_SECURE_PROTOCOL_TLS1: int +WINHTTP_FLAG_SECURE_PROTOCOL_ALL: int +WINHTTP_CALLBACK_STATUS_RESOLVING_NAME: int +WINHTTP_CALLBACK_STATUS_NAME_RESOLVED: int +WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER: int +WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER: int +WINHTTP_CALLBACK_STATUS_SENDING_REQUEST: int +WINHTTP_CALLBACK_STATUS_REQUEST_SENT: int +WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE: int +WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED: int +WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION: int +WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED: int +WINHTTP_CALLBACK_STATUS_HANDLE_CREATED: int +WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING: int +WINHTTP_CALLBACK_STATUS_DETECTING_PROXY: int +WINHTTP_CALLBACK_STATUS_REDIRECT: int +WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE: int +WINHTTP_CALLBACK_STATUS_SECURE_FAILURE: int +WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE: int +WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE: int +WINHTTP_CALLBACK_STATUS_READ_COMPLETE: int +WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE: int +WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: int +WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE: int +API_RECEIVE_RESPONSE: int +API_QUERY_DATA_AVAILABLE: int +API_READ_DATA: int +API_WRITE_DATA: int +API_SEND_REQUEST: int +WINHTTP_CALLBACK_FLAG_RESOLVE_NAME: int +WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER: int +WINHTTP_CALLBACK_FLAG_SEND_REQUEST: int +WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE: int +WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION: int +WINHTTP_CALLBACK_FLAG_HANDLES: int +WINHTTP_CALLBACK_FLAG_DETECTING_PROXY: int +WINHTTP_CALLBACK_FLAG_REDIRECT: int +WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE: int +WINHTTP_CALLBACK_FLAG_SECURE_FAILURE: int +WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE: int +WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE: int +WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE: int +WINHTTP_CALLBACK_FLAG_READ_COMPLETE: int +WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE: int +WINHTTP_CALLBACK_FLAG_REQUEST_ERROR: int +WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS: int +WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS: int +WINHTTP_QUERY_MIME_VERSION: int +WINHTTP_QUERY_CONTENT_TYPE: int +WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING: int +WINHTTP_QUERY_CONTENT_ID: int +WINHTTP_QUERY_CONTENT_DESCRIPTION: int +WINHTTP_QUERY_CONTENT_LENGTH: int +WINHTTP_QUERY_CONTENT_LANGUAGE: int +WINHTTP_QUERY_ALLOW: int +WINHTTP_QUERY_PUBLIC: int +WINHTTP_QUERY_DATE: int +WINHTTP_QUERY_EXPIRES: int +WINHTTP_QUERY_LAST_MODIFIED: int +WINHTTP_QUERY_MESSAGE_ID: int +WINHTTP_QUERY_URI: int +WINHTTP_QUERY_DERIVED_FROM: int +WINHTTP_QUERY_COST: int +WINHTTP_QUERY_LINK: int +WINHTTP_QUERY_PRAGMA: int +WINHTTP_QUERY_VERSION: int +WINHTTP_QUERY_STATUS_CODE: int +WINHTTP_QUERY_STATUS_TEXT: int +WINHTTP_QUERY_RAW_HEADERS: int +WINHTTP_QUERY_RAW_HEADERS_CRLF: int +WINHTTP_QUERY_CONNECTION: int +WINHTTP_QUERY_ACCEPT: int +WINHTTP_QUERY_ACCEPT_CHARSET: int +WINHTTP_QUERY_ACCEPT_ENCODING: int +WINHTTP_QUERY_ACCEPT_LANGUAGE: int +WINHTTP_QUERY_AUTHORIZATION: int +WINHTTP_QUERY_CONTENT_ENCODING: int +WINHTTP_QUERY_FORWARDED: int +WINHTTP_QUERY_FROM: int +WINHTTP_QUERY_IF_MODIFIED_SINCE: int +WINHTTP_QUERY_LOCATION: int +WINHTTP_QUERY_ORIG_URI: int +WINHTTP_QUERY_REFERER: int +WINHTTP_QUERY_RETRY_AFTER: int +WINHTTP_QUERY_SERVER: int +WINHTTP_QUERY_TITLE: int +WINHTTP_QUERY_USER_AGENT: int +WINHTTP_QUERY_WWW_AUTHENTICATE: int +WINHTTP_QUERY_PROXY_AUTHENTICATE: int +WINHTTP_QUERY_ACCEPT_RANGES: int +WINHTTP_QUERY_SET_COOKIE: int +WINHTTP_QUERY_COOKIE: int +WINHTTP_QUERY_REQUEST_METHOD: int +WINHTTP_QUERY_REFRESH: int +WINHTTP_QUERY_CONTENT_DISPOSITION: int +WINHTTP_QUERY_AGE: int +WINHTTP_QUERY_CACHE_CONTROL: int +WINHTTP_QUERY_CONTENT_BASE: int +WINHTTP_QUERY_CONTENT_LOCATION: int +WINHTTP_QUERY_CONTENT_MD5: int +WINHTTP_QUERY_CONTENT_RANGE: int +WINHTTP_QUERY_ETAG: int +WINHTTP_QUERY_HOST: int +WINHTTP_QUERY_IF_MATCH: int +WINHTTP_QUERY_IF_NONE_MATCH: int +WINHTTP_QUERY_IF_RANGE: int +WINHTTP_QUERY_IF_UNMODIFIED_SINCE: int +WINHTTP_QUERY_MAX_FORWARDS: int +WINHTTP_QUERY_PROXY_AUTHORIZATION: int +WINHTTP_QUERY_RANGE: int +WINHTTP_QUERY_TRANSFER_ENCODING: int +WINHTTP_QUERY_UPGRADE: int +WINHTTP_QUERY_VARY: int +WINHTTP_QUERY_VIA: int +WINHTTP_QUERY_WARNING: int +WINHTTP_QUERY_EXPECT: int +WINHTTP_QUERY_PROXY_CONNECTION: int +WINHTTP_QUERY_UNLESS_MODIFIED_SINCE: int +WINHTTP_QUERY_PROXY_SUPPORT: int +WINHTTP_QUERY_AUTHENTICATION_INFO: int +WINHTTP_QUERY_PASSPORT_URLS: int +WINHTTP_QUERY_PASSPORT_CONFIG: int +WINHTTP_QUERY_MAX: int +WINHTTP_QUERY_CUSTOM: int +WINHTTP_QUERY_FLAG_REQUEST_HEADERS: int +WINHTTP_QUERY_FLAG_SYSTEMTIME: int +WINHTTP_QUERY_FLAG_NUMBER: int +HTTP_STATUS_WEBDAV_MULTI_STATUS: int +WINHTTP_ADDREQ_INDEX_MASK: int +WINHTTP_ADDREQ_FLAGS_MASK: int +WINHTTP_ADDREQ_FLAG_ADD_IF_NEW: int +WINHTTP_ADDREQ_FLAG_ADD: int +WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA: int +WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON: int +WINHTTP_ADDREQ_FLAG_COALESCE: int +WINHTTP_ADDREQ_FLAG_REPLACE: int +WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH: int +WINHTTP_ERROR_BASE: int +ERROR_WINHTTP_OUT_OF_HANDLES: int +ERROR_WINHTTP_TIMEOUT: int +ERROR_WINHTTP_INTERNAL_ERROR: int +ERROR_WINHTTP_INVALID_URL: int +ERROR_WINHTTP_UNRECOGNIZED_SCHEME: int +ERROR_WINHTTP_NAME_NOT_RESOLVED: int +ERROR_WINHTTP_INVALID_OPTION: int +ERROR_WINHTTP_OPTION_NOT_SETTABLE: int +ERROR_WINHTTP_SHUTDOWN: int +ERROR_WINHTTP_LOGIN_FAILURE: int +ERROR_WINHTTP_OPERATION_CANCELLED: int +ERROR_WINHTTP_INCORRECT_HANDLE_TYPE: int +ERROR_WINHTTP_INCORRECT_HANDLE_STATE: int +ERROR_WINHTTP_CANNOT_CONNECT: int +ERROR_WINHTTP_CONNECTION_ERROR: int +ERROR_WINHTTP_RESEND_REQUEST: int +ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED: int +ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN: int +ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND: int +ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND: int +ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN: int +ERROR_WINHTTP_HEADER_NOT_FOUND: int +ERROR_WINHTTP_INVALID_SERVER_RESPONSE: int +ERROR_WINHTTP_INVALID_HEADER: int +ERROR_WINHTTP_INVALID_QUERY_REQUEST: int +ERROR_WINHTTP_HEADER_ALREADY_EXISTS: int +ERROR_WINHTTP_REDIRECT_FAILED: int +ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR: int +ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT: int +ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT: int +ERROR_WINHTTP_NOT_INITIALIZED: int +ERROR_WINHTTP_SECURE_FAILURE: int +ERROR_WINHTTP_SECURE_CERT_DATE_INVALID: int +ERROR_WINHTTP_SECURE_CERT_CN_INVALID: int +ERROR_WINHTTP_SECURE_INVALID_CA: int +ERROR_WINHTTP_SECURE_CERT_REV_FAILED: int +ERROR_WINHTTP_SECURE_CHANNEL_ERROR: int +ERROR_WINHTTP_SECURE_INVALID_CERT: int +ERROR_WINHTTP_SECURE_CERT_REVOKED: int +ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE: int +ERROR_WINHTTP_AUTODETECTION_FAILED: int +ERROR_WINHTTP_HEADER_COUNT_EXCEEDED: int +ERROR_WINHTTP_HEADER_SIZE_OVERFLOW: int +ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW: int +ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW: int +ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY: int +ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY: int +WINHTTP_ERROR_LAST: int +WINHTTP_NO_PROXY_NAME: None +WINHTTP_NO_PROXY_BYPASS: None +WINHTTP_NO_REFERER: None +WINHTTP_DEFAULT_ACCEPT_TYPES: None +WINHTTP_NO_ADDITIONAL_HEADERS: None +WINHTTP_NO_REQUEST_DATA: None +INTERNET_OPTION_LISTEN_TIMEOUT: int +WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST: int diff --git a/stubs/pywin32/win32/lib/win32netcon.pyi b/stubs/pywin32/win32/lib/win32netcon.pyi new file mode 100644 index 0000000..0538f44 --- /dev/null +++ b/stubs/pywin32/win32/lib/win32netcon.pyi @@ -0,0 +1,571 @@ +CNLEN: int +LM20_CNLEN: int +DNLEN: int +LM20_DNLEN: int +UNCLEN: int +LM20_UNCLEN: int +NNLEN: int +LM20_NNLEN: int +RMLEN: int +LM20_RMLEN: int +SNLEN: int +LM20_SNLEN: int +STXTLEN: int +LM20_STXTLEN: int +PATHLEN: int +LM20_PATHLEN: int +DEVLEN: int +LM20_DEVLEN: int +EVLEN: int +UNLEN: int +LM20_UNLEN: int +GNLEN: int +LM20_GNLEN: int +PWLEN: int +LM20_PWLEN: int +SHPWLEN: int +CLTYPE_LEN: int +MAXCOMMENTSZ: int +LM20_MAXCOMMENTSZ: int +QNLEN: int +LM20_QNLEN: int +ALERTSZ: int +NETBIOS_NAME_LEN: int +CRYPT_KEY_LEN: int +CRYPT_TXT_LEN: int +ENCRYPTED_PWLEN: int +SESSION_PWLEN: int +SESSION_CRYPT_KLEN: int +PARMNUM_ALL: int +PARM_ERROR_NONE: int +PARMNUM_BASE_INFOLEVEL: int +NULL: int +PLATFORM_ID_DOS: int +PLATFORM_ID_OS2: int +PLATFORM_ID_NT: int +PLATFORM_ID_OSF: int +PLATFORM_ID_VMS: int +MAX_LANMAN_MESSAGE_ID: int +UF_SCRIPT: int +UF_ACCOUNTDISABLE: int +UF_HOMEDIR_REQUIRED: int +UF_LOCKOUT: int +UF_PASSWD_NOTREQD: int +UF_PASSWD_CANT_CHANGE: int +UF_TEMP_DUPLICATE_ACCOUNT: int +UF_NORMAL_ACCOUNT: int +UF_INTERDOMAIN_TRUST_ACCOUNT: int +UF_WORKSTATION_TRUST_ACCOUNT: int +UF_SERVER_TRUST_ACCOUNT: int +UF_MACHINE_ACCOUNT_MASK: int +UF_ACCOUNT_TYPE_MASK: int +UF_DONT_EXPIRE_PASSWD: int +UF_MNS_LOGON_ACCOUNT: int +UF_SETTABLE_BITS: int +FILTER_TEMP_DUPLICATE_ACCOUNT: int +FILTER_NORMAL_ACCOUNT: int +FILTER_INTERDOMAIN_TRUST_ACCOUNT: int +FILTER_WORKSTATION_TRUST_ACCOUNT: int +FILTER_SERVER_TRUST_ACCOUNT: int +LG_INCLUDE_INDIRECT: int +AF_OP_PRINT: int +AF_OP_COMM: int +AF_OP_SERVER: int +AF_OP_ACCOUNTS: int +AF_SETTABLE_BITS: int +UAS_ROLE_STANDALONE: int +UAS_ROLE_MEMBER: int +UAS_ROLE_BACKUP: int +UAS_ROLE_PRIMARY: int +USER_NAME_PARMNUM: int +USER_PASSWORD_PARMNUM: int +USER_PASSWORD_AGE_PARMNUM: int +USER_PRIV_PARMNUM: int +USER_HOME_DIR_PARMNUM: int +USER_COMMENT_PARMNUM: int +USER_FLAGS_PARMNUM: int +USER_SCRIPT_PATH_PARMNUM: int +USER_AUTH_FLAGS_PARMNUM: int +USER_FULL_NAME_PARMNUM: int +USER_USR_COMMENT_PARMNUM: int +USER_PARMS_PARMNUM: int +USER_WORKSTATIONS_PARMNUM: int +USER_LAST_LOGON_PARMNUM: int +USER_LAST_LOGOFF_PARMNUM: int +USER_ACCT_EXPIRES_PARMNUM: int +USER_MAX_STORAGE_PARMNUM: int +USER_UNITS_PER_WEEK_PARMNUM: int +USER_LOGON_HOURS_PARMNUM: int +USER_PAD_PW_COUNT_PARMNUM: int +USER_NUM_LOGONS_PARMNUM: int +USER_LOGON_SERVER_PARMNUM: int +USER_COUNTRY_CODE_PARMNUM: int +USER_CODE_PAGE_PARMNUM: int +USER_PRIMARY_GROUP_PARMNUM: int +USER_PROFILE: int +USER_PROFILE_PARMNUM: int +USER_HOME_DIR_DRIVE_PARMNUM: int +USER_NAME_INFOLEVEL: int +USER_PASSWORD_INFOLEVEL: int +USER_PASSWORD_AGE_INFOLEVEL: int +USER_PRIV_INFOLEVEL: int +USER_HOME_DIR_INFOLEVEL: int +USER_COMMENT_INFOLEVEL: int +USER_FLAGS_INFOLEVEL: int +USER_SCRIPT_PATH_INFOLEVEL: int +USER_AUTH_FLAGS_INFOLEVEL: int +USER_FULL_NAME_INFOLEVEL: int +USER_USR_COMMENT_INFOLEVEL: int +USER_PARMS_INFOLEVEL: int +USER_WORKSTATIONS_INFOLEVEL: int +USER_LAST_LOGON_INFOLEVEL: int +USER_LAST_LOGOFF_INFOLEVEL: int +USER_ACCT_EXPIRES_INFOLEVEL: int +USER_MAX_STORAGE_INFOLEVEL: int +USER_UNITS_PER_WEEK_INFOLEVEL: int +USER_LOGON_HOURS_INFOLEVEL: int +USER_PAD_PW_COUNT_INFOLEVEL: int +USER_NUM_LOGONS_INFOLEVEL: int +USER_LOGON_SERVER_INFOLEVEL: int +USER_COUNTRY_CODE_INFOLEVEL: int +USER_CODE_PAGE_INFOLEVEL: int +USER_PRIMARY_GROUP_INFOLEVEL: int +USER_HOME_DIR_DRIVE_INFOLEVEL: int +NULL_USERSETINFO_PASSWD: str +UNITS_PER_DAY: int +UNITS_PER_WEEK: int +USER_PRIV_MASK: int +USER_PRIV_GUEST: int +USER_PRIV_USER: int +USER_PRIV_ADMIN: int +MAX_PASSWD_LEN: int +DEF_MIN_PWLEN: int +DEF_PWUNIQUENESS: int +DEF_MAX_PWHIST: int +DEF_MAX_BADPW: int +VALIDATED_LOGON: int +PASSWORD_EXPIRED: int +NON_VALIDATED_LOGON: int +VALID_LOGOFF: int +MODALS_MIN_PASSWD_LEN_PARMNUM: int +MODALS_MAX_PASSWD_AGE_PARMNUM: int +MODALS_MIN_PASSWD_AGE_PARMNUM: int +MODALS_FORCE_LOGOFF_PARMNUM: int +MODALS_PASSWD_HIST_LEN_PARMNUM: int +MODALS_ROLE_PARMNUM: int +MODALS_PRIMARY_PARMNUM: int +MODALS_DOMAIN_NAME_PARMNUM: int +MODALS_DOMAIN_ID_PARMNUM: int +MODALS_LOCKOUT_DURATION_PARMNUM: int +MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM: int +MODALS_LOCKOUT_THRESHOLD_PARMNUM: int +MODALS_MIN_PASSWD_LEN_INFOLEVEL: int +MODALS_MAX_PASSWD_AGE_INFOLEVEL: int +MODALS_MIN_PASSWD_AGE_INFOLEVEL: int +MODALS_FORCE_LOGOFF_INFOLEVEL: int +MODALS_PASSWD_HIST_LEN_INFOLEVEL: int +MODALS_ROLE_INFOLEVEL: int +MODALS_PRIMARY_INFOLEVEL: int +MODALS_DOMAIN_NAME_INFOLEVEL: int +MODALS_DOMAIN_ID_INFOLEVEL: int +GROUPIDMASK: int +GROUP_ALL_PARMNUM: int +GROUP_NAME_PARMNUM: int +GROUP_COMMENT_PARMNUM: int +GROUP_ATTRIBUTES_PARMNUM: int +GROUP_ALL_INFOLEVEL: int +GROUP_NAME_INFOLEVEL: int +GROUP_COMMENT_INFOLEVEL: int +GROUP_ATTRIBUTES_INFOLEVEL: int +LOCALGROUP_NAME_PARMNUM: int +LOCALGROUP_COMMENT_PARMNUM: int +MAXPERMENTRIES: int +ACCESS_NONE: int +ACCESS_READ: int +ACCESS_WRITE: int +ACCESS_CREATE: int +ACCESS_EXEC: int +ACCESS_DELETE: int +ACCESS_ATRIB: int +ACCESS_PERM: int +ACCESS_GROUP: int +ACCESS_AUDIT: int +ACCESS_SUCCESS_OPEN: int +ACCESS_SUCCESS_WRITE: int +ACCESS_SUCCESS_DELETE: int +ACCESS_SUCCESS_ACL: int +ACCESS_SUCCESS_MASK: int +ACCESS_FAIL_OPEN: int +ACCESS_FAIL_WRITE: int +ACCESS_FAIL_DELETE: int +ACCESS_FAIL_ACL: int +ACCESS_FAIL_MASK: int +ACCESS_FAIL_SHIFT: int +ACCESS_RESOURCE_NAME_PARMNUM: int +ACCESS_ATTR_PARMNUM: int +ACCESS_COUNT_PARMNUM: int +ACCESS_RESOURCE_NAME_INFOLEVEL: int +ACCESS_ATTR_INFOLEVEL: int +ACCESS_COUNT_INFOLEVEL: int +ACCESS_LETTERS: str +NETLOGON_CONTROL_QUERY: int +NETLOGON_CONTROL_REPLICATE: int +NETLOGON_CONTROL_SYNCHRONIZE: int +NETLOGON_CONTROL_PDC_REPLICATE: int +NETLOGON_CONTROL_REDISCOVER: int +NETLOGON_CONTROL_TC_QUERY: int +NETLOGON_CONTROL_TRANSPORT_NOTIFY: int +NETLOGON_CONTROL_FIND_USER: int +NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL: int +NETLOGON_CONTROL_BACKUP_CHANGE_LOG: int +NETLOGON_CONTROL_TRUNCATE_LOG: int +NETLOGON_CONTROL_SET_DBFLAG: int +NETLOGON_CONTROL_BREAKPOINT: int +NETLOGON_REPLICATION_NEEDED: int +NETLOGON_REPLICATION_IN_PROGRESS: int +NETLOGON_FULL_SYNC_REPLICATION: int +NETLOGON_REDO_NEEDED: int + +def TEXT(x: str) -> str: ... + +MAX_PREFERRED_LENGTH: int +PARM_ERROR_UNKNOWN: int +MESSAGE_FILENAME: str +OS2MSG_FILENAME: str +HELP_MSG_FILENAME: str +BACKUP_MSG_FILENAME: str +TIMEQ_FOREVER: int +USER_MAXSTORAGE_UNLIMITED: int +USER_NO_LOGOFF: int +DEF_MAX_PWAGE: int +DEF_MIN_PWAGE: int +DEF_FORCE_LOGOFF: int +ONE_DAY: int +GROUP_SPECIALGRP_USERS: str +GROUP_SPECIALGRP_ADMINS: str +GROUP_SPECIALGRP_GUESTS: str +GROUP_SPECIALGRP_LOCAL: str +ACCESS_ALL: int +SV_PLATFORM_ID_OS2: int +SV_PLATFORM_ID_NT: int +MAJOR_VERSION_MASK: int +SV_TYPE_WORKSTATION: int +SV_TYPE_SERVER: int +SV_TYPE_SQLSERVER: int +SV_TYPE_DOMAIN_CTRL: int +SV_TYPE_DOMAIN_BAKCTRL: int +SV_TYPE_TIME_SOURCE: int +SV_TYPE_AFP: int +SV_TYPE_NOVELL: int +SV_TYPE_DOMAIN_MEMBER: int +SV_TYPE_PRINTQ_SERVER: int +SV_TYPE_DIALIN_SERVER: int +SV_TYPE_XENIX_SERVER: int +SV_TYPE_SERVER_UNIX: int +SV_TYPE_NT: int +SV_TYPE_WFW: int +SV_TYPE_SERVER_MFPN: int +SV_TYPE_SERVER_NT: int +SV_TYPE_POTENTIAL_BROWSER: int +SV_TYPE_BACKUP_BROWSER: int +SV_TYPE_MASTER_BROWSER: int +SV_TYPE_DOMAIN_MASTER: int +SV_TYPE_SERVER_OSF: int +SV_TYPE_SERVER_VMS: int +SV_TYPE_WINDOWS: int +SV_TYPE_DFS: int +SV_TYPE_CLUSTER_NT: int +SV_TYPE_DCE: int +SV_TYPE_ALTERNATE_XPORT: int +SV_TYPE_DOMAIN_ENUM: int +SV_TYPE_ALL: int +SV_NODISC: int +SV_USERSECURITY: int +SV_SHARESECURITY: int +SV_HIDDEN: int +SV_VISIBLE: int +SV_PLATFORM_ID_PARMNUM: int +SV_NAME_PARMNUM: int +SV_VERSION_MAJOR_PARMNUM: int +SV_VERSION_MINOR_PARMNUM: int +SV_TYPE_PARMNUM: int +SV_COMMENT_PARMNUM: int +SV_USERS_PARMNUM: int +SV_DISC_PARMNUM: int +SV_HIDDEN_PARMNUM: int +SV_ANNOUNCE_PARMNUM: int +SV_ANNDELTA_PARMNUM: int +SV_USERPATH_PARMNUM: int +SV_ALERTS_PARMNUM: int +SV_SECURITY_PARMNUM: int +SV_NUMADMIN_PARMNUM: int +SV_LANMASK_PARMNUM: int +SV_GUESTACC_PARMNUM: int +SV_CHDEVQ_PARMNUM: int +SV_CHDEVJOBS_PARMNUM: int +SV_CONNECTIONS_PARMNUM: int +SV_SHARES_PARMNUM: int +SV_OPENFILES_PARMNUM: int +SV_SESSREQS_PARMNUM: int +SV_ACTIVELOCKS_PARMNUM: int +SV_NUMREQBUF_PARMNUM: int +SV_NUMBIGBUF_PARMNUM: int +SV_NUMFILETASKS_PARMNUM: int +SV_ALERTSCHED_PARMNUM: int +SV_ERRORALERT_PARMNUM: int +SV_LOGONALERT_PARMNUM: int +SV_ACCESSALERT_PARMNUM: int +SV_DISKALERT_PARMNUM: int +SV_NETIOALERT_PARMNUM: int +SV_MAXAUDITSZ_PARMNUM: int +SV_SRVHEURISTICS_PARMNUM: int +SV_SESSOPENS_PARMNUM: int +SV_SESSVCS_PARMNUM: int +SV_OPENSEARCH_PARMNUM: int +SV_SIZREQBUF_PARMNUM: int +SV_INITWORKITEMS_PARMNUM: int +SV_MAXWORKITEMS_PARMNUM: int +SV_RAWWORKITEMS_PARMNUM: int +SV_IRPSTACKSIZE_PARMNUM: int +SV_MAXRAWBUFLEN_PARMNUM: int +SV_SESSUSERS_PARMNUM: int +SV_SESSCONNS_PARMNUM: int +SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM: int +SV_MAXPAGEDMEMORYUSAGE_PARMNUM: int +SV_ENABLESOFTCOMPAT_PARMNUM: int +SV_ENABLEFORCEDLOGOFF_PARMNUM: int +SV_TIMESOURCE_PARMNUM: int +SV_ACCEPTDOWNLEVELAPIS_PARMNUM: int +SV_LMANNOUNCE_PARMNUM: int +SV_DOMAIN_PARMNUM: int +SV_MAXCOPYREADLEN_PARMNUM: int +SV_MAXCOPYWRITELEN_PARMNUM: int +SV_MINKEEPSEARCH_PARMNUM: int +SV_MAXKEEPSEARCH_PARMNUM: int +SV_MINKEEPCOMPLSEARCH_PARMNUM: int +SV_MAXKEEPCOMPLSEARCH_PARMNUM: int +SV_THREADCOUNTADD_PARMNUM: int +SV_NUMBLOCKTHREADS_PARMNUM: int +SV_SCAVTIMEOUT_PARMNUM: int +SV_MINRCVQUEUE_PARMNUM: int +SV_MINFREEWORKITEMS_PARMNUM: int +SV_XACTMEMSIZE_PARMNUM: int +SV_THREADPRIORITY_PARMNUM: int +SV_MAXMPXCT_PARMNUM: int +SV_OPLOCKBREAKWAIT_PARMNUM: int +SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM: int +SV_ENABLEOPLOCKS_PARMNUM: int +SV_ENABLEOPLOCKFORCECLOSE_PARMNUM: int +SV_ENABLEFCBOPENS_PARMNUM: int +SV_ENABLERAW_PARMNUM: int +SV_ENABLESHAREDNETDRIVES_PARMNUM: int +SV_MINFREECONNECTIONS_PARMNUM: int +SV_MAXFREECONNECTIONS_PARMNUM: int +SV_INITSESSTABLE_PARMNUM: int +SV_INITCONNTABLE_PARMNUM: int +SV_INITFILETABLE_PARMNUM: int +SV_INITSEARCHTABLE_PARMNUM: int +SV_ALERTSCHEDULE_PARMNUM: int +SV_ERRORTHRESHOLD_PARMNUM: int +SV_NETWORKERRORTHRESHOLD_PARMNUM: int +SV_DISKSPACETHRESHOLD_PARMNUM: int +SV_MAXLINKDELAY_PARMNUM: int +SV_MINLINKTHROUGHPUT_PARMNUM: int +SV_LINKINFOVALIDTIME_PARMNUM: int +SV_SCAVQOSINFOUPDATETIME_PARMNUM: int +SV_MAXWORKITEMIDLETIME_PARMNUM: int +SV_MAXRAWWORKITEMS_PARMNUM: int +SV_PRODUCTTYPE_PARMNUM: int +SV_SERVERSIZE_PARMNUM: int +SV_CONNECTIONLESSAUTODISC_PARMNUM: int +SV_SHARINGVIOLATIONRETRIES_PARMNUM: int +SV_SHARINGVIOLATIONDELAY_PARMNUM: int +SV_MAXGLOBALOPENSEARCH_PARMNUM: int +SV_REMOVEDUPLICATESEARCHES_PARMNUM: int +SV_LOCKVIOLATIONRETRIES_PARMNUM: int +SV_LOCKVIOLATIONOFFSET_PARMNUM: int +SV_LOCKVIOLATIONDELAY_PARMNUM: int +SV_MDLREADSWITCHOVER_PARMNUM: int +SV_CACHEDOPENLIMIT_PARMNUM: int +SV_CRITICALTHREADS_PARMNUM: int +SV_RESTRICTNULLSESSACCESS_PARMNUM: int +SV_ENABLEWFW311DIRECTIPX_PARMNUM: int +SV_OTHERQUEUEAFFINITY_PARMNUM: int +SV_QUEUESAMPLESECS_PARMNUM: int +SV_BALANCECOUNT_PARMNUM: int +SV_PREFERREDAFFINITY_PARMNUM: int +SV_MAXFREERFCBS_PARMNUM: int +SV_MAXFREEMFCBS_PARMNUM: int +SV_MAXFREELFCBS_PARMNUM: int +SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM: int +SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM: int +SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM: int +SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM: int +SV_MAXTHREADSPERQUEUE_PARMNUM: int +SV_CACHEDDIRECTORYLIMIT_PARMNUM: int +SV_MAXCOPYLENGTH_PARMNUM: int +SV_ENABLEBULKTRANSFER_PARMNUM: int +SV_ENABLECOMPRESSION_PARMNUM: int +SV_AUTOSHAREWKS_PARMNUM: int +SV_AUTOSHARESERVER_PARMNUM: int +SV_ENABLESECURITYSIGNATURE_PARMNUM: int +SV_REQUIRESECURITYSIGNATURE_PARMNUM: int +SV_MINCLIENTBUFFERSIZE_PARMNUM: int +SV_CONNECTIONNOSESSIONSTIMEOUT_PARMNUM: int +SVI1_NUM_ELEMENTS: int +SVI2_NUM_ELEMENTS: int +SVI3_NUM_ELEMENTS: int +SW_AUTOPROF_LOAD_MASK: int +SW_AUTOPROF_SAVE_MASK: int +SV_MAX_SRV_HEUR_LEN: int +SV_USERS_PER_LICENSE: int +SVTI2_REMAP_PIPE_NAMES: int +SHARE_NETNAME_PARMNUM: int +SHARE_TYPE_PARMNUM: int +SHARE_REMARK_PARMNUM: int +SHARE_PERMISSIONS_PARMNUM: int +SHARE_MAX_USES_PARMNUM: int +SHARE_CURRENT_USES_PARMNUM: int +SHARE_PATH_PARMNUM: int +SHARE_PASSWD_PARMNUM: int +SHARE_FILE_SD_PARMNUM: int +SHI1_NUM_ELEMENTS: int +SHI2_NUM_ELEMENTS: int +STYPE_DISKTREE: int +STYPE_PRINTQ: int +STYPE_DEVICE: int +STYPE_IPC: int +STYPE_SPECIAL: int +SHI1005_FLAGS_DFS: int +SHI1005_FLAGS_DFS_ROOT: int +COW_PERMACHINE: int +COW_PERUSER: int +CSC_CACHEABLE: int +CSC_NOFLOWOPS: int +CSC_AUTO_INWARD: int +CSC_AUTO_OUTWARD: int +SHI1005_VALID_FLAGS_SET: int +SHI1007_VALID_FLAGS_SET: int +SESS_GUEST: int +SESS_NOENCRYPTION: int +SESI1_NUM_ELEMENTS: int +SESI2_NUM_ELEMENTS: int +PERM_FILE_READ: int +PERM_FILE_WRITE: int +PERM_FILE_CREATE: int +WNNC_NET_MSNET: int +WNNC_NET_LANMAN: int +WNNC_NET_NETWARE: int +WNNC_NET_VINES: int +WNNC_NET_10NET: int +WNNC_NET_LOCUS: int +WNNC_NET_SUN_PC_NFS: int +WNNC_NET_LANSTEP: int +WNNC_NET_9TILES: int +WNNC_NET_LANTASTIC: int +WNNC_NET_AS400: int +WNNC_NET_FTP_NFS: int +WNNC_NET_PATHWORKS: int +WNNC_NET_LIFENET: int +WNNC_NET_POWERLAN: int +WNNC_NET_BWNFS: int +WNNC_NET_COGENT: int +WNNC_NET_FARALLON: int +WNNC_NET_APPLETALK: int +WNNC_NET_INTERGRAPH: int +WNNC_NET_SYMFONET: int +WNNC_NET_CLEARCASE: int +WNNC_NET_FRONTIER: int +WNNC_NET_BMC: int +WNNC_NET_DCE: int +WNNC_NET_DECORB: int +WNNC_NET_PROTSTOR: int +WNNC_NET_FJ_REDIR: int +WNNC_NET_DISTINCT: int +WNNC_NET_TWINS: int +WNNC_NET_RDR2SAMPLE: int +RESOURCE_CONNECTED: int +RESOURCE_GLOBALNET: int +RESOURCE_REMEMBERED: int +RESOURCE_RECENT: int +RESOURCE_CONTEXT: int +RESOURCETYPE_ANY: int +RESOURCETYPE_DISK: int +RESOURCETYPE_PRINT: int +RESOURCETYPE_RESERVED: int +RESOURCETYPE_UNKNOWN: int +RESOURCEUSAGE_CONNECTABLE: int +RESOURCEUSAGE_CONTAINER: int +RESOURCEUSAGE_NOLOCALDEVICE: int +RESOURCEUSAGE_SIBLING: int +RESOURCEUSAGE_ATTACHED: int +RESOURCEUSAGE_ALL: int +RESOURCEUSAGE_RESERVED: int +RESOURCEDISPLAYTYPE_GENERIC: int +RESOURCEDISPLAYTYPE_DOMAIN: int +RESOURCEDISPLAYTYPE_SERVER: int +RESOURCEDISPLAYTYPE_SHARE: int +RESOURCEDISPLAYTYPE_FILE: int +RESOURCEDISPLAYTYPE_GROUP: int +RESOURCEDISPLAYTYPE_NETWORK: int +RESOURCEDISPLAYTYPE_ROOT: int +RESOURCEDISPLAYTYPE_SHAREADMIN: int +RESOURCEDISPLAYTYPE_DIRECTORY: int +RESOURCEDISPLAYTYPE_TREE: int +RESOURCEDISPLAYTYPE_NDSCONTAINER: int +NETPROPERTY_PERSISTENT: int +CONNECT_UPDATE_PROFILE: int +CONNECT_UPDATE_RECENT: int +CONNECT_TEMPORARY: int +CONNECT_INTERACTIVE: int +CONNECT_PROMPT: int +CONNECT_NEED_DRIVE: int +CONNECT_REFCOUNT: int +CONNECT_REDIRECT: int +CONNECT_LOCALDRIVE: int +CONNECT_CURRENT_MEDIA: int +CONNECT_DEFERRED: int +CONNECT_RESERVED: int +CONNDLG_RO_PATH: int +CONNDLG_CONN_POINT: int +CONNDLG_USE_MRU: int +CONNDLG_HIDE_BOX: int +CONNDLG_PERSIST: int +CONNDLG_NOT_PERSIST: int +DISC_UPDATE_PROFILE: int +DISC_NO_FORCE: int +UNIVERSAL_NAME_INFO_LEVEL: int +REMOTE_NAME_INFO_LEVEL: int +WNFMT_MULTILINE: int +WNFMT_ABBREVIATED: int +WNFMT_INENUM: int +WNFMT_CONNECTION: int +NETINFO_DLL16: int +NETINFO_DISKRED: int +NETINFO_PRINTERRED: int +RP_LOGON: int +RP_INIFILE: int +PP_DISPLAYERRORS: int +WNCON_FORNETCARD: int +WNCON_NOTROUTED: int +WNCON_SLOWLINK: int +WNCON_DYNAMIC: int +NetSetupUnknown: int +NetSetupMachine: int +NetSetupWorkgroup: int +NetSetupDomain: int +NetSetupNonExistentDomain: int +NetSetupDnsMachine: int +NetSetupUnknownStatus: int +NetSetupUnjoined: int +NetSetupWorkgroupName: int +NetSetupDomainName: int +NetValidateAuthentication: int +NetValidatePasswordChange: int +NetValidatePasswordReset: int +ACCESS_ACCESS_LIST_INFOLEVEL: int +ACCESS_ACCESS_LIST_PARMNUM: int +SV_ALIST_MTIME_PARMNUM: int +SV_GLIST_MTIME_PARMNUM: int +SV_TYPE_LOCAL_LIST_ONLY: int +SV_ULIST_MTIME_PARMNUM: int diff --git a/stubs/pywin32/win32/lib/win32pdhquery.pyi b/stubs/pywin32/win32/lib/win32pdhquery.pyi new file mode 100644 index 0000000..61267b0 --- /dev/null +++ b/stubs/pywin32/win32/lib/win32pdhquery.pyi @@ -0,0 +1,42 @@ +from _typeshed import Incomplete + +class BaseQuery: + counters: Incomplete + paths: Incomplete + active: int + curpaths: Incomplete + def __init__(self, paths: Incomplete | None = ...) -> None: ... + def addcounterbybrowsing(self, flags=..., windowtitle: str = ...) -> None: ... + def rawaddcounter( + self, object, counter, instance: Incomplete | None = ..., inum: int = ..., machine: Incomplete | None = ... + ) -> None: ... + def addcounter( + self, object, counter, instance: Incomplete | None = ..., inum: int = ..., machine: Incomplete | None = ... + ): ... + def open(self): ... + def killbase(self, base: Incomplete | None = ...) -> None: ... + def close(self) -> None: ... + __del__: Incomplete + def collectdata(self, format=...): ... + def collectdataslave(self, format=...): ... + def __getinitargs__(self): ... + +class Query(BaseQuery): + volatilecounters: Incomplete + def __init__(self, *args, **namedargs) -> None: ... + def addinstcounter( + self, object, counter, machine: Incomplete | None = ..., objtype: str = ..., volatile: int = ..., format=... + ) -> None: ... + def getinstpaths(self, object, counter, machine: Incomplete | None = ..., objtype: str = ..., format=...): ... + def open(self, *args, **namedargs) -> None: ... + curresults: Incomplete + def collectdatafor(self, totalperiod, period: int = ...) -> None: ... + collectdatawhile_active: int + def collectdatawhile(self, period: int = ...) -> None: ... + def collectdatawhile_stop(self) -> None: ... + def collectdatawhile_slave(self, period) -> None: ... + def __getinitargs__(self): ... + +class QueryError: + query: Incomplete + def __init__(self, query) -> None: ... diff --git a/stubs/pywin32/win32/lib/win32timezone.pyi b/stubs/pywin32/win32/lib/win32timezone.pyi new file mode 100644 index 0000000..ae0abe3 --- /dev/null +++ b/stubs/pywin32/win32/lib/win32timezone.pyi @@ -0,0 +1,73 @@ +import datetime +from _typeshed import Incomplete + +log: Incomplete + +class _SimpleStruct: + def __init__(self, *args, **kw) -> None: ... + def field_names(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + +class SYSTEMTIME(_SimpleStruct): ... +class TIME_ZONE_INFORMATION(_SimpleStruct): ... +class DYNAMIC_TIME_ZONE_INFORMATION(_SimpleStruct): ... + +class TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION): + def __init__(self, *args, **kwargs) -> None: ... + def __getattribute__(self, attr): ... + @classmethod + def current(cls): ... + def set(self) -> None: ... + def copy(self): ... + def locate_daylight_start(self, year): ... + def locate_standard_start(self, year): ... + +class TimeZoneInfo(datetime.tzinfo): + tzRegKey: str + timeZoneName: Incomplete + fixedStandardTime: Incomplete + def __init__(self, param: Incomplete | None = ..., fix_standard_time: bool = ...) -> None: ... + def tzname(self, dt): ... + def getWinInfo(self, targetYear): ... + def utcoffset(self, dt): ... + def dst(self, dt): ... + def GetDSTStartTime(self, year): ... + def GetDSTEndTime(self, year): ... + def __cmp__(self, other): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + @classmethod + def local(cls): ... + @classmethod + def utc(cls): ... + @staticmethod + def get_sorted_time_zone_names(): ... + @staticmethod + def get_all_time_zones(): ... + @staticmethod + def get_sorted_time_zones(key: Incomplete | None = ...): ... + +def utcnow(): ... +def now(): ... +def GetTZCapabilities(): ... + +class DLLHandleCache: + def __getitem__(self, filename): ... + +DLLCache: Incomplete + +def resolveMUITimeZone(spec): ... + +class RangeMap(dict[int, str]): + sort_params: Incomplete + match: Incomplete + def __init__(self, source, sort_params=..., key_match_comparator=...) -> None: ... + def __getitem__(self, item): ... + def get(self, key, default: Incomplete | None = ...): ... + def bounds(self): ... + undefined_value: Incomplete + + class Item(int): ... + first_item: Incomplete + last_item: Incomplete diff --git a/stubs/pywin32/win32/lib/winerror.pyi b/stubs/pywin32/win32/lib/winerror.pyi new file mode 100644 index 0000000..de99b3d --- /dev/null +++ b/stubs/pywin32/win32/lib/winerror.pyi @@ -0,0 +1,2586 @@ +TRUST_E_PROVIDER_UNKNOWN: int +TRUST_E_ACTION_UNKNOWN: int +TRUST_E_SUBJECT_FORM_UNKNOWN: int +TRUST_E_SUBJECT_NOT_TRUSTED: int +FACILITY_WINRM: int +FACILITY_WINDOWSUPDATE: int +FACILITY_WINDOWS_DEFENDER: int +FACILITY_WINDOWS_CE: int +FACILITY_WINDOWS: int +FACILITY_URT: int +FACILITY_UMI: int +FACILITY_TPM_SOFTWARE: int +FACILITY_TPM_SERVICES: int +FACILITY_SXS: int +FACILITY_STORAGE: int +FACILITY_STATE_MANAGEMENT: int +FACILITY_SSPI: int +FACILITY_SCARD: int +FACILITY_SHELL: int +FACILITY_SETUPAPI: int +FACILITY_SECURITY: int +FACILITY_RPC: int +FACILITY_PLA: int +FACILITY_WIN32: int +FACILITY_CONTROL: int +FACILITY_NULL: int +FACILITY_NDIS: int +FACILITY_METADIRECTORY: int +FACILITY_MSMQ: int +FACILITY_MEDIASERVER: int +FACILITY_INTERNET: int +FACILITY_ITF: int +FACILITY_USERMODE_HYPERVISOR: int +FACILITY_HTTP: int +FACILITY_GRAPHICS: int +FACILITY_FWP: int +FACILITY_FVE: int +FACILITY_USERMODE_FILTER_MANAGER: int +FACILITY_DPLAY: int +FACILITY_DISPATCH: int +FACILITY_DIRECTORYSERVICE: int +FACILITY_CONFIGURATION: int +FACILITY_COMPLUS: int +FACILITY_USERMODE_COMMONLOG: int +FACILITY_CMI: int +FACILITY_CERT: int +FACILITY_BACKGROUNDCOPY: int +FACILITY_ACS: int +FACILITY_AAF: int +ERROR_SUCCESS: int +NO_ERROR: int +S_OK: int +S_FALSE: int +ERROR_INVALID_FUNCTION: int +ERROR_FILE_NOT_FOUND: int +ERROR_PATH_NOT_FOUND: int +ERROR_TOO_MANY_OPEN_FILES: int +ERROR_ACCESS_DENIED: int +ERROR_INVALID_HANDLE: int +ERROR_ARENA_TRASHED: int +ERROR_NOT_ENOUGH_MEMORY: int +ERROR_INVALID_BLOCK: int +ERROR_BAD_ENVIRONMENT: int +ERROR_BAD_FORMAT: int +ERROR_INVALID_ACCESS: int +ERROR_INVALID_DATA: int +ERROR_OUTOFMEMORY: int +ERROR_INVALID_DRIVE: int +ERROR_CURRENT_DIRECTORY: int +ERROR_NOT_SAME_DEVICE: int +ERROR_NO_MORE_FILES: int +ERROR_WRITE_PROTECT: int +ERROR_BAD_UNIT: int +ERROR_NOT_READY: int +ERROR_BAD_COMMAND: int +ERROR_CRC: int +ERROR_BAD_LENGTH: int +ERROR_SEEK: int +ERROR_NOT_DOS_DISK: int +ERROR_SECTOR_NOT_FOUND: int +ERROR_OUT_OF_PAPER: int +ERROR_WRITE_FAULT: int +ERROR_READ_FAULT: int +ERROR_GEN_FAILURE: int +ERROR_SHARING_VIOLATION: int +ERROR_LOCK_VIOLATION: int +ERROR_WRONG_DISK: int +ERROR_SHARING_BUFFER_EXCEEDED: int +ERROR_HANDLE_EOF: int +ERROR_HANDLE_DISK_FULL: int +ERROR_NOT_SUPPORTED: int +ERROR_REM_NOT_LIST: int +ERROR_DUP_NAME: int +ERROR_BAD_NETPATH: int +ERROR_NETWORK_BUSY: int +ERROR_DEV_NOT_EXIST: int +ERROR_TOO_MANY_CMDS: int +ERROR_ADAP_HDW_ERR: int +ERROR_BAD_NET_RESP: int +ERROR_UNEXP_NET_ERR: int +ERROR_BAD_REM_ADAP: int +ERROR_PRINTQ_FULL: int +ERROR_NO_SPOOL_SPACE: int +ERROR_PRINT_CANCELLED: int +ERROR_NETNAME_DELETED: int +ERROR_NETWORK_ACCESS_DENIED: int +ERROR_BAD_DEV_TYPE: int +ERROR_BAD_NET_NAME: int +ERROR_TOO_MANY_NAMES: int +ERROR_TOO_MANY_SESS: int +ERROR_SHARING_PAUSED: int +ERROR_REQ_NOT_ACCEP: int +ERROR_REDIR_PAUSED: int +ERROR_FILE_EXISTS: int +ERROR_CANNOT_MAKE: int +ERROR_FAIL_I24: int +ERROR_OUT_OF_STRUCTURES: int +ERROR_ALREADY_ASSIGNED: int +ERROR_INVALID_PASSWORD: int +ERROR_INVALID_PARAMETER: int +ERROR_NET_WRITE_FAULT: int +ERROR_NO_PROC_SLOTS: int +ERROR_TOO_MANY_SEMAPHORES: int +ERROR_EXCL_SEM_ALREADY_OWNED: int +ERROR_SEM_IS_SET: int +ERROR_TOO_MANY_SEM_REQUESTS: int +ERROR_INVALID_AT_INTERRUPT_TIME: int +ERROR_SEM_OWNER_DIED: int +ERROR_SEM_USER_LIMIT: int +ERROR_DISK_CHANGE: int +ERROR_DRIVE_LOCKED: int +ERROR_BROKEN_PIPE: int +ERROR_OPEN_FAILED: int +ERROR_BUFFER_OVERFLOW: int +ERROR_DISK_FULL: int +ERROR_NO_MORE_SEARCH_HANDLES: int +ERROR_INVALID_TARGET_HANDLE: int +ERROR_INVALID_CATEGORY: int +ERROR_INVALID_VERIFY_SWITCH: int +ERROR_BAD_DRIVER_LEVEL: int +ERROR_CALL_NOT_IMPLEMENTED: int +ERROR_SEM_TIMEOUT: int +ERROR_INSUFFICIENT_BUFFER: int +ERROR_INVALID_NAME: int +ERROR_INVALID_LEVEL: int +ERROR_NO_VOLUME_LABEL: int +ERROR_MOD_NOT_FOUND: int +ERROR_PROC_NOT_FOUND: int +ERROR_WAIT_NO_CHILDREN: int +ERROR_CHILD_NOT_COMPLETE: int +ERROR_DIRECT_ACCESS_HANDLE: int +ERROR_NEGATIVE_SEEK: int +ERROR_SEEK_ON_DEVICE: int +ERROR_IS_JOIN_TARGET: int +ERROR_IS_JOINED: int +ERROR_IS_SUBSTED: int +ERROR_NOT_JOINED: int +ERROR_NOT_SUBSTED: int +ERROR_JOIN_TO_JOIN: int +ERROR_SUBST_TO_SUBST: int +ERROR_JOIN_TO_SUBST: int +ERROR_SUBST_TO_JOIN: int +ERROR_BUSY_DRIVE: int +ERROR_SAME_DRIVE: int +ERROR_DIR_NOT_ROOT: int +ERROR_DIR_NOT_EMPTY: int +ERROR_IS_SUBST_PATH: int +ERROR_IS_JOIN_PATH: int +ERROR_PATH_BUSY: int +ERROR_IS_SUBST_TARGET: int +ERROR_SYSTEM_TRACE: int +ERROR_INVALID_EVENT_COUNT: int +ERROR_TOO_MANY_MUXWAITERS: int +ERROR_INVALID_LIST_FORMAT: int +ERROR_LABEL_TOO_LONG: int +ERROR_TOO_MANY_TCBS: int +ERROR_SIGNAL_REFUSED: int +ERROR_DISCARDED: int +ERROR_NOT_LOCKED: int +ERROR_BAD_THREADID_ADDR: int +ERROR_BAD_ARGUMENTS: int +ERROR_BAD_PATHNAME: int +ERROR_SIGNAL_PENDING: int +ERROR_MAX_THRDS_REACHED: int +ERROR_LOCK_FAILED: int +ERROR_BUSY: int +ERROR_CANCEL_VIOLATION: int +ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: int +ERROR_INVALID_SEGMENT_NUMBER: int +ERROR_INVALID_ORDINAL: int +ERROR_ALREADY_EXISTS: int +ERROR_INVALID_FLAG_NUMBER: int +ERROR_SEM_NOT_FOUND: int +ERROR_INVALID_STARTING_CODESEG: int +ERROR_INVALID_STACKSEG: int +ERROR_INVALID_MODULETYPE: int +ERROR_INVALID_EXE_SIGNATURE: int +ERROR_EXE_MARKED_INVALID: int +ERROR_BAD_EXE_FORMAT: int +ERROR_ITERATED_DATA_EXCEEDS_64k: int +ERROR_INVALID_MINALLOCSIZE: int +ERROR_DYNLINK_FROM_INVALID_RING: int +ERROR_IOPL_NOT_ENABLED: int +ERROR_INVALID_SEGDPL: int +ERROR_AUTODATASEG_EXCEEDS_64k: int +ERROR_RING2SEG_MUST_BE_MOVABLE: int +ERROR_RELOC_CHAIN_XEEDS_SEGLIM: int +ERROR_INFLOOP_IN_RELOC_CHAIN: int +ERROR_ENVVAR_NOT_FOUND: int +ERROR_NO_SIGNAL_SENT: int +ERROR_FILENAME_EXCED_RANGE: int +ERROR_RING2_STACK_IN_USE: int +ERROR_META_EXPANSION_TOO_LONG: int +ERROR_INVALID_SIGNAL_NUMBER: int +ERROR_THREAD_1_INACTIVE: int +ERROR_LOCKED: int +ERROR_TOO_MANY_MODULES: int +ERROR_NESTING_NOT_ALLOWED: int +ERROR_EXE_MACHINE_TYPE_MISMATCH: int +ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: int +ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: int +ERROR_FILE_CHECKED_OUT: int +ERROR_CHECKOUT_REQUIRED: int +ERROR_BAD_FILE_TYPE: int +ERROR_FILE_TOO_LARGE: int +ERROR_FORMS_AUTH_REQUIRED: int +ERROR_VIRUS_INFECTED: int +ERROR_VIRUS_DELETED: int +ERROR_PIPE_LOCAL: int +ERROR_BAD_PIPE: int +ERROR_PIPE_BUSY: int +ERROR_NO_DATA: int +ERROR_PIPE_NOT_CONNECTED: int +ERROR_MORE_DATA: int +ERROR_VC_DISCONNECTED: int +ERROR_INVALID_EA_NAME: int +ERROR_EA_LIST_INCONSISTENT: int +WAIT_TIMEOUT: int +ERROR_NO_MORE_ITEMS: int +ERROR_CANNOT_COPY: int +ERROR_DIRECTORY: int +ERROR_EAS_DIDNT_FIT: int +ERROR_EA_FILE_CORRUPT: int +ERROR_EA_TABLE_FULL: int +ERROR_INVALID_EA_HANDLE: int +ERROR_EAS_NOT_SUPPORTED: int +ERROR_NOT_OWNER: int +ERROR_TOO_MANY_POSTS: int +ERROR_PARTIAL_COPY: int +ERROR_OPLOCK_NOT_GRANTED: int +ERROR_INVALID_OPLOCK_PROTOCOL: int +ERROR_DISK_TOO_FRAGMENTED: int +ERROR_DELETE_PENDING: int +ERROR_MR_MID_NOT_FOUND: int +ERROR_SCOPE_NOT_FOUND: int +ERROR_FAIL_NOACTION_REBOOT: int +ERROR_FAIL_SHUTDOWN: int +ERROR_FAIL_RESTART: int +ERROR_MAX_SESSIONS_REACHED: int +ERROR_THREAD_MODE_ALREADY_BACKGROUND: int +ERROR_THREAD_MODE_NOT_BACKGROUND: int +ERROR_PROCESS_MODE_ALREADY_BACKGROUND: int +ERROR_PROCESS_MODE_NOT_BACKGROUND: int +ERROR_INVALID_ADDRESS: int +ERROR_USER_PROFILE_LOAD: int +ERROR_ARITHMETIC_OVERFLOW: int +ERROR_PIPE_CONNECTED: int +ERROR_PIPE_LISTENING: int +ERROR_VERIFIER_STOP: int +ERROR_ABIOS_ERROR: int +ERROR_WX86_WARNING: int +ERROR_WX86_ERROR: int +ERROR_TIMER_NOT_CANCELED: int +ERROR_UNWIND: int +ERROR_BAD_STACK: int +ERROR_INVALID_UNWIND_TARGET: int +ERROR_INVALID_PORT_ATTRIBUTES: int +ERROR_PORT_MESSAGE_TOO_LONG: int +ERROR_INVALID_QUOTA_LOWER: int +ERROR_DEVICE_ALREADY_ATTACHED: int +ERROR_INSTRUCTION_MISALIGNMENT: int +ERROR_PROFILING_NOT_STARTED: int +ERROR_PROFILING_NOT_STOPPED: int +ERROR_COULD_NOT_INTERPRET: int +ERROR_PROFILING_AT_LIMIT: int +ERROR_CANT_WAIT: int +ERROR_CANT_TERMINATE_SELF: int +ERROR_UNEXPECTED_MM_CREATE_ERR: int +ERROR_UNEXPECTED_MM_MAP_ERROR: int +ERROR_UNEXPECTED_MM_EXTEND_ERR: int +ERROR_BAD_FUNCTION_TABLE: int +ERROR_NO_GUID_TRANSLATION: int +ERROR_INVALID_LDT_SIZE: int +ERROR_INVALID_LDT_OFFSET: int +ERROR_INVALID_LDT_DESCRIPTOR: int +ERROR_TOO_MANY_THREADS: int +ERROR_THREAD_NOT_IN_PROCESS: int +ERROR_PAGEFILE_QUOTA_EXCEEDED: int +ERROR_LOGON_SERVER_CONFLICT: int +ERROR_SYNCHRONIZATION_REQUIRED: int +ERROR_NET_OPEN_FAILED: int +ERROR_IO_PRIVILEGE_FAILED: int +ERROR_CONTROL_C_EXIT: int +ERROR_MISSING_SYSTEMFILE: int +ERROR_UNHANDLED_EXCEPTION: int +ERROR_APP_INIT_FAILURE: int +ERROR_PAGEFILE_CREATE_FAILED: int +ERROR_INVALID_IMAGE_HASH: int +ERROR_NO_PAGEFILE: int +ERROR_ILLEGAL_FLOAT_CONTEXT: int +ERROR_NO_EVENT_PAIR: int +ERROR_DOMAIN_CTRLR_CONFIG_ERROR: int +ERROR_ILLEGAL_CHARACTER: int +ERROR_UNDEFINED_CHARACTER: int +ERROR_FLOPPY_VOLUME: int +ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: int +ERROR_BACKUP_CONTROLLER: int +ERROR_MUTANT_LIMIT_EXCEEDED: int +ERROR_FS_DRIVER_REQUIRED: int +ERROR_CANNOT_LOAD_REGISTRY_FILE: int +ERROR_DEBUG_ATTACH_FAILED: int +ERROR_SYSTEM_PROCESS_TERMINATED: int +ERROR_DATA_NOT_ACCEPTED: int +ERROR_VDM_HARD_ERROR: int +ERROR_DRIVER_CANCEL_TIMEOUT: int +ERROR_REPLY_MESSAGE_MISMATCH: int +ERROR_LOST_WRITEBEHIND_DATA: int +ERROR_CLIENT_SERVER_PARAMETERS_INVALID: int +ERROR_NOT_TINY_STREAM: int +ERROR_STACK_OVERFLOW_READ: int +ERROR_CONVERT_TO_LARGE: int +ERROR_FOUND_OUT_OF_SCOPE: int +ERROR_ALLOCATE_BUCKET: int +ERROR_MARSHALL_OVERFLOW: int +ERROR_INVALID_VARIANT: int +ERROR_BAD_COMPRESSION_BUFFER: int +ERROR_AUDIT_FAILED: int +ERROR_TIMER_RESOLUTION_NOT_SET: int +ERROR_INSUFFICIENT_LOGON_INFO: int +ERROR_BAD_DLL_ENTRYPOINT: int +ERROR_BAD_SERVICE_ENTRYPOINT: int +ERROR_IP_ADDRESS_CONFLICT1: int +ERROR_IP_ADDRESS_CONFLICT2: int +ERROR_REGISTRY_QUOTA_LIMIT: int +ERROR_NO_CALLBACK_ACTIVE: int +ERROR_PWD_TOO_SHORT: int +ERROR_PWD_TOO_RECENT: int +ERROR_PWD_HISTORY_CONFLICT: int +ERROR_UNSUPPORTED_COMPRESSION: int +ERROR_INVALID_HW_PROFILE: int +ERROR_INVALID_PLUGPLAY_DEVICE_PATH: int +ERROR_QUOTA_LIST_INCONSISTENT: int +ERROR_EVALUATION_EXPIRATION: int +ERROR_ILLEGAL_DLL_RELOCATION: int +ERROR_DLL_INIT_FAILED_LOGOFF: int +ERROR_VALIDATE_CONTINUE: int +ERROR_NO_MORE_MATCHES: int +ERROR_RANGE_LIST_CONFLICT: int +ERROR_SERVER_SID_MISMATCH: int +ERROR_CANT_ENABLE_DENY_ONLY: int +ERROR_FLOAT_MULTIPLE_FAULTS: int +ERROR_FLOAT_MULTIPLE_TRAPS: int +ERROR_NOINTERFACE: int +ERROR_DRIVER_FAILED_SLEEP: int +ERROR_CORRUPT_SYSTEM_FILE: int +ERROR_COMMITMENT_MINIMUM: int +ERROR_PNP_RESTART_ENUMERATION: int +ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: int +ERROR_PNP_REBOOT_REQUIRED: int +ERROR_INSUFFICIENT_POWER: int +ERROR_MULTIPLE_FAULT_VIOLATION: int +ERROR_SYSTEM_SHUTDOWN: int +ERROR_PORT_NOT_SET: int +ERROR_DS_VERSION_CHECK_FAILURE: int +ERROR_RANGE_NOT_FOUND: int +ERROR_NOT_SAFE_MODE_DRIVER: int +ERROR_FAILED_DRIVER_ENTRY: int +ERROR_DEVICE_ENUMERATION_ERROR: int +ERROR_MOUNT_POINT_NOT_RESOLVED: int +ERROR_INVALID_DEVICE_OBJECT_PARAMETER: int +ERROR_MCA_OCCURED: int +ERROR_DRIVER_DATABASE_ERROR: int +ERROR_SYSTEM_HIVE_TOO_LARGE: int +ERROR_DRIVER_FAILED_PRIOR_UNLOAD: int +ERROR_VOLSNAP_PREPARE_HIBERNATE: int +ERROR_HIBERNATION_FAILURE: int +ERROR_FILE_SYSTEM_LIMITATION: int +ERROR_ASSERTION_FAILURE: int +ERROR_ACPI_ERROR: int +ERROR_WOW_ASSERTION: int +ERROR_PNP_BAD_MPS_TABLE: int +ERROR_PNP_TRANSLATION_FAILED: int +ERROR_PNP_IRQ_TRANSLATION_FAILED: int +ERROR_PNP_INVALID_ID: int +ERROR_WAKE_SYSTEM_DEBUGGER: int +ERROR_HANDLES_CLOSED: int +ERROR_EXTRANEOUS_INFORMATION: int +ERROR_RXACT_COMMIT_NECESSARY: int +ERROR_MEDIA_CHECK: int +ERROR_GUID_SUBSTITUTION_MADE: int +ERROR_STOPPED_ON_SYMLINK: int +ERROR_LONGJUMP: int +ERROR_PLUGPLAY_QUERY_VETOED: int +ERROR_UNWIND_CONSOLIDATE: int +ERROR_REGISTRY_HIVE_RECOVERED: int +ERROR_DLL_MIGHT_BE_INSECURE: int +ERROR_DLL_MIGHT_BE_INCOMPATIBLE: int +ERROR_DBG_EXCEPTION_NOT_HANDLED: int +ERROR_DBG_REPLY_LATER: int +ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: int +ERROR_DBG_TERMINATE_THREAD: int +ERROR_DBG_TERMINATE_PROCESS: int +ERROR_DBG_CONTROL_C: int +ERROR_DBG_PRINTEXCEPTION_C: int +ERROR_DBG_RIPEXCEPTION: int +ERROR_DBG_CONTROL_BREAK: int +ERROR_DBG_COMMAND_EXCEPTION: int +ERROR_OBJECT_NAME_EXISTS: int +ERROR_THREAD_WAS_SUSPENDED: int +ERROR_IMAGE_NOT_AT_BASE: int +ERROR_RXACT_STATE_CREATED: int +ERROR_SEGMENT_NOTIFICATION: int +ERROR_BAD_CURRENT_DIRECTORY: int +ERROR_FT_READ_RECOVERY_FROM_BACKUP: int +ERROR_FT_WRITE_RECOVERY: int +ERROR_IMAGE_MACHINE_TYPE_MISMATCH: int +ERROR_RECEIVE_PARTIAL: int +ERROR_RECEIVE_EXPEDITED: int +ERROR_RECEIVE_PARTIAL_EXPEDITED: int +ERROR_EVENT_DONE: int +ERROR_EVENT_PENDING: int +ERROR_CHECKING_FILE_SYSTEM: int +ERROR_FATAL_APP_EXIT: int +ERROR_PREDEFINED_HANDLE: int +ERROR_WAS_UNLOCKED: int +ERROR_SERVICE_NOTIFICATION: int +ERROR_WAS_LOCKED: int +ERROR_LOG_HARD_ERROR: int +ERROR_ALREADY_WIN32: int +ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: int +ERROR_NO_YIELD_PERFORMED: int +ERROR_TIMER_RESUME_IGNORED: int +ERROR_ARBITRATION_UNHANDLED: int +ERROR_CARDBUS_NOT_SUPPORTED: int +ERROR_MP_PROCESSOR_MISMATCH: int +ERROR_HIBERNATED: int +ERROR_RESUME_HIBERNATION: int +ERROR_FIRMWARE_UPDATED: int +ERROR_DRIVERS_LEAKING_LOCKED_PAGES: int +ERROR_WAKE_SYSTEM: int +ERROR_WAIT_1: int +ERROR_WAIT_2: int +ERROR_WAIT_3: int +ERROR_WAIT_63: int +ERROR_ABANDONED_WAIT_0: int +ERROR_ABANDONED_WAIT_63: int +ERROR_USER_APC: int +ERROR_KERNEL_APC: int +ERROR_ALERTED: int +ERROR_ELEVATION_REQUIRED: int +ERROR_REPARSE: int +ERROR_OPLOCK_BREAK_IN_PROGRESS: int +ERROR_VOLUME_MOUNTED: int +ERROR_RXACT_COMMITTED: int +ERROR_NOTIFY_CLEANUP: int +ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: int +ERROR_PAGE_FAULT_TRANSITION: int +ERROR_PAGE_FAULT_DEMAND_ZERO: int +ERROR_PAGE_FAULT_COPY_ON_WRITE: int +ERROR_PAGE_FAULT_GUARD_PAGE: int +ERROR_PAGE_FAULT_PAGING_FILE: int +ERROR_CACHE_PAGE_LOCKED: int +ERROR_CRASH_DUMP: int +ERROR_BUFFER_ALL_ZEROS: int +ERROR_REPARSE_OBJECT: int +ERROR_RESOURCE_REQUIREMENTS_CHANGED: int +ERROR_TRANSLATION_COMPLETE: int +ERROR_NOTHING_TO_TERMINATE: int +ERROR_PROCESS_NOT_IN_JOB: int +ERROR_PROCESS_IN_JOB: int +ERROR_VOLSNAP_HIBERNATE_READY: int +ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: int +ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: int +ERROR_INTERRUPT_STILL_CONNECTED: int +ERROR_WAIT_FOR_OPLOCK: int +ERROR_DBG_EXCEPTION_HANDLED: int +ERROR_DBG_CONTINUE: int +ERROR_CALLBACK_POP_STACK: int +ERROR_COMPRESSION_DISABLED: int +ERROR_CANTFETCHBACKWARDS: int +ERROR_CANTSCROLLBACKWARDS: int +ERROR_ROWSNOTRELEASED: int +ERROR_BAD_ACCESSOR_FLAGS: int +ERROR_ERRORS_ENCOUNTERED: int +ERROR_NOT_CAPABLE: int +ERROR_REQUEST_OUT_OF_SEQUENCE: int +ERROR_VERSION_PARSE_ERROR: int +ERROR_BADSTARTPOSITION: int +ERROR_MEMORY_HARDWARE: int +ERROR_DISK_REPAIR_DISABLED: int +ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: int +ERROR_SYSTEM_POWERSTATE_TRANSITION: int +ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: int +ERROR_MCA_EXCEPTION: int +ERROR_ACCESS_AUDIT_BY_POLICY: int +ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: int +ERROR_ABANDON_HIBERFILE: int +ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: int +ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: int +ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: int +ERROR_BAD_MCFG_TABLE: int +ERROR_EA_ACCESS_DENIED: int +ERROR_OPERATION_ABORTED: int +ERROR_IO_INCOMPLETE: int +ERROR_IO_PENDING: int +ERROR_NOACCESS: int +ERROR_SWAPERROR: int +ERROR_STACK_OVERFLOW: int +ERROR_INVALID_MESSAGE: int +ERROR_CAN_NOT_COMPLETE: int +ERROR_INVALID_FLAGS: int +ERROR_UNRECOGNIZED_VOLUME: int +ERROR_FILE_INVALID: int +ERROR_FULLSCREEN_MODE: int +ERROR_NO_TOKEN: int +ERROR_BADDB: int +ERROR_BADKEY: int +ERROR_CANTOPEN: int +ERROR_CANTREAD: int +ERROR_CANTWRITE: int +ERROR_REGISTRY_RECOVERED: int +ERROR_REGISTRY_CORRUPT: int +ERROR_REGISTRY_IO_FAILED: int +ERROR_NOT_REGISTRY_FILE: int +ERROR_KEY_DELETED: int +ERROR_NO_LOG_SPACE: int +ERROR_KEY_HAS_CHILDREN: int +ERROR_CHILD_MUST_BE_VOLATILE: int +ERROR_NOTIFY_ENUM_DIR: int +ERROR_DEPENDENT_SERVICES_RUNNING: int +ERROR_INVALID_SERVICE_CONTROL: int +ERROR_SERVICE_REQUEST_TIMEOUT: int +ERROR_SERVICE_NO_THREAD: int +ERROR_SERVICE_DATABASE_LOCKED: int +ERROR_SERVICE_ALREADY_RUNNING: int +ERROR_INVALID_SERVICE_ACCOUNT: int +ERROR_SERVICE_DISABLED: int +ERROR_CIRCULAR_DEPENDENCY: int +ERROR_SERVICE_DOES_NOT_EXIST: int +ERROR_SERVICE_CANNOT_ACCEPT_CTRL: int +ERROR_SERVICE_NOT_ACTIVE: int +ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: int +ERROR_EXCEPTION_IN_SERVICE: int +ERROR_DATABASE_DOES_NOT_EXIST: int +ERROR_SERVICE_SPECIFIC_ERROR: int +ERROR_PROCESS_ABORTED: int +ERROR_SERVICE_DEPENDENCY_FAIL: int +ERROR_SERVICE_LOGON_FAILED: int +ERROR_SERVICE_START_HANG: int +ERROR_INVALID_SERVICE_LOCK: int +ERROR_SERVICE_MARKED_FOR_DELETE: int +ERROR_SERVICE_EXISTS: int +ERROR_ALREADY_RUNNING_LKG: int +ERROR_SERVICE_DEPENDENCY_DELETED: int +ERROR_BOOT_ALREADY_ACCEPTED: int +ERROR_SERVICE_NEVER_STARTED: int +ERROR_DUPLICATE_SERVICE_NAME: int +ERROR_DIFFERENT_SERVICE_ACCOUNT: int +ERROR_CANNOT_DETECT_DRIVER_FAILURE: int +ERROR_CANNOT_DETECT_PROCESS_ABORT: int +ERROR_NO_RECOVERY_PROGRAM: int +ERROR_SERVICE_NOT_IN_EXE: int +ERROR_NOT_SAFEBOOT_SERVICE: int +ERROR_END_OF_MEDIA: int +ERROR_FILEMARK_DETECTED: int +ERROR_BEGINNING_OF_MEDIA: int +ERROR_SETMARK_DETECTED: int +ERROR_NO_DATA_DETECTED: int +ERROR_PARTITION_FAILURE: int +ERROR_INVALID_BLOCK_LENGTH: int +ERROR_DEVICE_NOT_PARTITIONED: int +ERROR_UNABLE_TO_LOCK_MEDIA: int +ERROR_UNABLE_TO_UNLOAD_MEDIA: int +ERROR_MEDIA_CHANGED: int +ERROR_BUS_RESET: int +ERROR_NO_MEDIA_IN_DRIVE: int +ERROR_NO_UNICODE_TRANSLATION: int +ERROR_DLL_INIT_FAILED: int +ERROR_SHUTDOWN_IN_PROGRESS: int +ERROR_NO_SHUTDOWN_IN_PROGRESS: int +ERROR_IO_DEVICE: int +ERROR_SERIAL_NO_DEVICE: int +ERROR_IRQ_BUSY: int +ERROR_MORE_WRITES: int +ERROR_COUNTER_TIMEOUT: int +ERROR_FLOPPY_ID_MARK_NOT_FOUND: int +ERROR_FLOPPY_WRONG_CYLINDER: int +ERROR_FLOPPY_UNKNOWN_ERROR: int +ERROR_FLOPPY_BAD_REGISTERS: int +ERROR_DISK_RECALIBRATE_FAILED: int +ERROR_DISK_OPERATION_FAILED: int +ERROR_DISK_RESET_FAILED: int +ERROR_EOM_OVERFLOW: int +ERROR_NOT_ENOUGH_SERVER_MEMORY: int +ERROR_POSSIBLE_DEADLOCK: int +ERROR_MAPPED_ALIGNMENT: int +ERROR_SET_POWER_STATE_VETOED: int +ERROR_SET_POWER_STATE_FAILED: int +ERROR_TOO_MANY_LINKS: int +ERROR_OLD_WIN_VERSION: int +ERROR_APP_WRONG_OS: int +ERROR_SINGLE_INSTANCE_APP: int +ERROR_RMODE_APP: int +ERROR_INVALID_DLL: int +ERROR_NO_ASSOCIATION: int +ERROR_DDE_FAIL: int +ERROR_DLL_NOT_FOUND: int +ERROR_NO_MORE_USER_HANDLES: int +ERROR_MESSAGE_SYNC_ONLY: int +ERROR_SOURCE_ELEMENT_EMPTY: int +ERROR_DESTINATION_ELEMENT_FULL: int +ERROR_ILLEGAL_ELEMENT_ADDRESS: int +ERROR_MAGAZINE_NOT_PRESENT: int +ERROR_DEVICE_REINITIALIZATION_NEEDED: int +ERROR_DEVICE_REQUIRES_CLEANING: int +ERROR_DEVICE_DOOR_OPEN: int +ERROR_DEVICE_NOT_CONNECTED: int +ERROR_NOT_FOUND: int +ERROR_NO_MATCH: int +ERROR_SET_NOT_FOUND: int +ERROR_POINT_NOT_FOUND: int +ERROR_NO_TRACKING_SERVICE: int +ERROR_NO_VOLUME_ID: int +ERROR_CONNECTED_OTHER_PASSWORD: int +ERROR_BAD_USERNAME: int +ERROR_NOT_CONNECTED: int +ERROR_OPEN_FILES: int +ERROR_ACTIVE_CONNECTIONS: int +ERROR_DEVICE_IN_USE: int +ERROR_BAD_DEVICE: int +ERROR_CONNECTION_UNAVAIL: int +ERROR_DEVICE_ALREADY_REMEMBERED: int +ERROR_NO_NET_OR_BAD_PATH: int +ERROR_BAD_PROVIDER: int +ERROR_CANNOT_OPEN_PROFILE: int +ERROR_BAD_PROFILE: int +ERROR_NOT_CONTAINER: int +ERROR_EXTENDED_ERROR: int +ERROR_INVALID_GROUPNAME: int +ERROR_INVALID_COMPUTERNAME: int +ERROR_INVALID_EVENTNAME: int +ERROR_INVALID_DOMAINNAME: int +ERROR_INVALID_SERVICENAME: int +ERROR_INVALID_NETNAME: int +ERROR_INVALID_SHARENAME: int +ERROR_INVALID_PASSWORDNAME: int +ERROR_INVALID_MESSAGENAME: int +ERROR_INVALID_MESSAGEDEST: int +ERROR_SESSION_CREDENTIAL_CONFLICT: int +ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: int +ERROR_DUP_DOMAINNAME: int +ERROR_NO_NETWORK: int +ERROR_CANCELLED: int +ERROR_USER_MAPPED_FILE: int +ERROR_CONNECTION_REFUSED: int +ERROR_GRACEFUL_DISCONNECT: int +ERROR_ADDRESS_ALREADY_ASSOCIATED: int +ERROR_ADDRESS_NOT_ASSOCIATED: int +ERROR_CONNECTION_INVALID: int +ERROR_CONNECTION_ACTIVE: int +ERROR_NETWORK_UNREACHABLE: int +ERROR_HOST_UNREACHABLE: int +ERROR_PROTOCOL_UNREACHABLE: int +ERROR_PORT_UNREACHABLE: int +ERROR_REQUEST_ABORTED: int +ERROR_CONNECTION_ABORTED: int +ERROR_RETRY: int +ERROR_CONNECTION_COUNT_LIMIT: int +ERROR_LOGIN_TIME_RESTRICTION: int +ERROR_LOGIN_WKSTA_RESTRICTION: int +ERROR_INCORRECT_ADDRESS: int +ERROR_ALREADY_REGISTERED: int +ERROR_SERVICE_NOT_FOUND: int +ERROR_NOT_AUTHENTICATED: int +ERROR_NOT_LOGGED_ON: int +ERROR_CONTINUE: int +ERROR_ALREADY_INITIALIZED: int +ERROR_NO_MORE_DEVICES: int +ERROR_NO_SUCH_SITE: int +ERROR_DOMAIN_CONTROLLER_EXISTS: int +ERROR_DS_NOT_INSTALLED: int +ERROR_NOT_ALL_ASSIGNED: int +ERROR_SOME_NOT_MAPPED: int +ERROR_NO_QUOTAS_FOR_ACCOUNT: int +ERROR_LOCAL_USER_SESSION_KEY: int +ERROR_NULL_LM_PASSWORD: int +ERROR_UNKNOWN_REVISION: int +ERROR_REVISION_MISMATCH: int +ERROR_INVALID_OWNER: int +ERROR_INVALID_PRIMARY_GROUP: int +ERROR_NO_IMPERSONATION_TOKEN: int +ERROR_CANT_DISABLE_MANDATORY: int +ERROR_NO_LOGON_SERVERS: int +ERROR_NO_SUCH_LOGON_SESSION: int +ERROR_NO_SUCH_PRIVILEGE: int +ERROR_PRIVILEGE_NOT_HELD: int +ERROR_INVALID_ACCOUNT_NAME: int +ERROR_USER_EXISTS: int +ERROR_NO_SUCH_USER: int +ERROR_GROUP_EXISTS: int +ERROR_NO_SUCH_GROUP: int +ERROR_MEMBER_IN_GROUP: int +ERROR_MEMBER_NOT_IN_GROUP: int +ERROR_LAST_ADMIN: int +ERROR_WRONG_PASSWORD: int +ERROR_ILL_FORMED_PASSWORD: int +ERROR_PASSWORD_RESTRICTION: int +ERROR_LOGON_FAILURE: int +ERROR_ACCOUNT_RESTRICTION: int +ERROR_INVALID_LOGON_HOURS: int +ERROR_INVALID_WORKSTATION: int +ERROR_PASSWORD_EXPIRED: int +ERROR_ACCOUNT_DISABLED: int +ERROR_NONE_MAPPED: int +ERROR_TOO_MANY_LUIDS_REQUESTED: int +ERROR_LUIDS_EXHAUSTED: int +ERROR_INVALID_SUB_AUTHORITY: int +ERROR_INVALID_ACL: int +ERROR_INVALID_SID: int +ERROR_INVALID_SECURITY_DESCR: int +ERROR_BAD_INHERITANCE_ACL: int +ERROR_SERVER_DISABLED: int +ERROR_SERVER_NOT_DISABLED: int +ERROR_INVALID_ID_AUTHORITY: int +ERROR_ALLOTTED_SPACE_EXCEEDED: int +ERROR_INVALID_GROUP_ATTRIBUTES: int +ERROR_BAD_IMPERSONATION_LEVEL: int +ERROR_CANT_OPEN_ANONYMOUS: int +ERROR_BAD_VALIDATION_CLASS: int +ERROR_BAD_TOKEN_TYPE: int +ERROR_NO_SECURITY_ON_OBJECT: int +ERROR_CANT_ACCESS_DOMAIN_INFO: int +ERROR_INVALID_SERVER_STATE: int +ERROR_INVALID_DOMAIN_STATE: int +ERROR_INVALID_DOMAIN_ROLE: int +ERROR_NO_SUCH_DOMAIN: int +ERROR_DOMAIN_EXISTS: int +ERROR_DOMAIN_LIMIT_EXCEEDED: int +ERROR_INTERNAL_DB_CORRUPTION: int +ERROR_INTERNAL_ERROR: int +ERROR_GENERIC_NOT_MAPPED: int +ERROR_BAD_DESCRIPTOR_FORMAT: int +ERROR_NOT_LOGON_PROCESS: int +ERROR_LOGON_SESSION_EXISTS: int +ERROR_NO_SUCH_PACKAGE: int +ERROR_BAD_LOGON_SESSION_STATE: int +ERROR_LOGON_SESSION_COLLISION: int +ERROR_INVALID_LOGON_TYPE: int +ERROR_CANNOT_IMPERSONATE: int +ERROR_RXACT_INVALID_STATE: int +ERROR_RXACT_COMMIT_FAILURE: int +ERROR_SPECIAL_ACCOUNT: int +ERROR_SPECIAL_GROUP: int +ERROR_SPECIAL_USER: int +ERROR_MEMBERS_PRIMARY_GROUP: int +ERROR_TOKEN_ALREADY_IN_USE: int +ERROR_NO_SUCH_ALIAS: int +ERROR_MEMBER_NOT_IN_ALIAS: int +ERROR_MEMBER_IN_ALIAS: int +ERROR_ALIAS_EXISTS: int +ERROR_LOGON_NOT_GRANTED: int +ERROR_TOO_MANY_SECRETS: int +ERROR_SECRET_TOO_LONG: int +ERROR_INTERNAL_DB_ERROR: int +ERROR_TOO_MANY_CONTEXT_IDS: int +ERROR_LOGON_TYPE_NOT_GRANTED: int +ERROR_NT_CROSS_ENCRYPTION_REQUIRED: int +ERROR_NO_SUCH_MEMBER: int +ERROR_INVALID_MEMBER: int +ERROR_TOO_MANY_SIDS: int +ERROR_LM_CROSS_ENCRYPTION_REQUIRED: int +ERROR_NO_INHERITANCE: int +ERROR_FILE_CORRUPT: int +ERROR_DISK_CORRUPT: int +ERROR_NO_USER_SESSION_KEY: int +ERROR_LICENSE_QUOTA_EXCEEDED: int +ERROR_INVALID_WINDOW_HANDLE: int +ERROR_INVALID_MENU_HANDLE: int +ERROR_INVALID_CURSOR_HANDLE: int +ERROR_INVALID_ACCEL_HANDLE: int +ERROR_INVALID_HOOK_HANDLE: int +ERROR_INVALID_DWP_HANDLE: int +ERROR_TLW_WITH_WSCHILD: int +ERROR_CANNOT_FIND_WND_CLASS: int +ERROR_WINDOW_OF_OTHER_THREAD: int +ERROR_HOTKEY_ALREADY_REGISTERED: int +ERROR_CLASS_ALREADY_EXISTS: int +ERROR_CLASS_DOES_NOT_EXIST: int +ERROR_CLASS_HAS_WINDOWS: int +ERROR_INVALID_INDEX: int +ERROR_INVALID_ICON_HANDLE: int +ERROR_PRIVATE_DIALOG_INDEX: int +ERROR_LISTBOX_ID_NOT_FOUND: int +ERROR_NO_WILDCARD_CHARACTERS: int +ERROR_CLIPBOARD_NOT_OPEN: int +ERROR_HOTKEY_NOT_REGISTERED: int +ERROR_WINDOW_NOT_DIALOG: int +ERROR_CONTROL_ID_NOT_FOUND: int +ERROR_INVALID_COMBOBOX_MESSAGE: int +ERROR_WINDOW_NOT_COMBOBOX: int +ERROR_INVALID_EDIT_HEIGHT: int +ERROR_DC_NOT_FOUND: int +ERROR_INVALID_HOOK_FILTER: int +ERROR_INVALID_FILTER_PROC: int +ERROR_HOOK_NEEDS_HMOD: int +ERROR_GLOBAL_ONLY_HOOK: int +ERROR_JOURNAL_HOOK_SET: int +ERROR_HOOK_NOT_INSTALLED: int +ERROR_INVALID_LB_MESSAGE: int +ERROR_SETCOUNT_ON_BAD_LB: int +ERROR_LB_WITHOUT_TABSTOPS: int +ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: int +ERROR_CHILD_WINDOW_MENU: int +ERROR_NO_SYSTEM_MENU: int +ERROR_INVALID_MSGBOX_STYLE: int +ERROR_INVALID_SPI_VALUE: int +ERROR_SCREEN_ALREADY_LOCKED: int +ERROR_HWNDS_HAVE_DIFF_PARENT: int +ERROR_NOT_CHILD_WINDOW: int +ERROR_INVALID_GW_COMMAND: int +ERROR_INVALID_THREAD_ID: int +ERROR_NON_MDICHILD_WINDOW: int +ERROR_POPUP_ALREADY_ACTIVE: int +ERROR_NO_SCROLLBARS: int +ERROR_INVALID_SCROLLBAR_RANGE: int +ERROR_INVALID_SHOWWIN_COMMAND: int +ERROR_NO_SYSTEM_RESOURCES: int +ERROR_NONPAGED_SYSTEM_RESOURCES: int +ERROR_PAGED_SYSTEM_RESOURCES: int +ERROR_WORKING_SET_QUOTA: int +ERROR_PAGEFILE_QUOTA: int +ERROR_COMMITMENT_LIMIT: int +ERROR_MENU_ITEM_NOT_FOUND: int +ERROR_INVALID_KEYBOARD_HANDLE: int +ERROR_HOOK_TYPE_NOT_ALLOWED: int +ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: int +ERROR_TIMEOUT: int +ERROR_INVALID_MONITOR_HANDLE: int +ERROR_INCORRECT_SIZE: int +ERROR_SYMLINK_CLASS_DISABLED: int +ERROR_SYMLINK_NOT_SUPPORTED: int +ERROR_XML_PARSE_ERROR: int +ERROR_XMLDSIG_ERROR: int +ERROR_RESTART_APPLICATION: int +ERROR_WRONG_COMPARTMENT: int +ERROR_AUTHIP_FAILURE: int +ERROR_EVENTLOG_FILE_CORRUPT: int +ERROR_EVENTLOG_CANT_START: int +ERROR_LOG_FILE_FULL: int +ERROR_EVENTLOG_FILE_CHANGED: int +ERROR_INSTALL_SERVICE: int +ERROR_INSTALL_USEREXIT: int +ERROR_INSTALL_FAILURE: int +ERROR_INSTALL_SUSPEND: int +ERROR_UNKNOWN_PRODUCT: int +ERROR_UNKNOWN_FEATURE: int +ERROR_UNKNOWN_COMPONENT: int +ERROR_UNKNOWN_PROPERTY: int +ERROR_INVALID_HANDLE_STATE: int +ERROR_BAD_CONFIGURATION: int +ERROR_INDEX_ABSENT: int +ERROR_INSTALL_SOURCE_ABSENT: int +ERROR_BAD_DATABASE_VERSION: int +ERROR_PRODUCT_UNINSTALLED: int +ERROR_BAD_QUERY_SYNTAX: int +ERROR_INVALID_FIELD: int +ERROR_DEVICE_REMOVED: int +ERROR_INSTALL_ALREADY_RUNNING: int +ERROR_INSTALL_PACKAGE_OPEN_FAILED: int +ERROR_INSTALL_PACKAGE_INVALID: int +ERROR_INSTALL_UI_FAILURE: int +ERROR_INSTALL_LOG_FAILURE: int +ERROR_INSTALL_LANGUAGE_UNSUPPORTED: int +ERROR_INSTALL_TRANSFORM_FAILURE: int +ERROR_INSTALL_PACKAGE_REJECTED: int +ERROR_FUNCTION_NOT_CALLED: int +ERROR_FUNCTION_FAILED: int +ERROR_INVALID_TABLE: int +ERROR_DATATYPE_MISMATCH: int +ERROR_UNSUPPORTED_TYPE: int +ERROR_CREATE_FAILED: int +ERROR_INSTALL_TEMP_UNWRITABLE: int +ERROR_INSTALL_PLATFORM_UNSUPPORTED: int +ERROR_INSTALL_NOTUSED: int +ERROR_PATCH_PACKAGE_OPEN_FAILED: int +ERROR_PATCH_PACKAGE_INVALID: int +ERROR_PATCH_PACKAGE_UNSUPPORTED: int +ERROR_PRODUCT_VERSION: int +ERROR_INVALID_COMMAND_LINE: int +ERROR_INSTALL_REMOTE_DISALLOWED: int +ERROR_SUCCESS_REBOOT_INITIATED: int +ERROR_PATCH_TARGET_NOT_FOUND: int +ERROR_PATCH_PACKAGE_REJECTED: int +ERROR_INSTALL_TRANSFORM_REJECTED: int +ERROR_INSTALL_REMOTE_PROHIBITED: int +ERROR_PATCH_REMOVAL_UNSUPPORTED: int +ERROR_UNKNOWN_PATCH: int +ERROR_PATCH_NO_SEQUENCE: int +ERROR_PATCH_REMOVAL_DISALLOWED: int +ERROR_INVALID_PATCH_XML: int +ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: int +ERROR_INSTALL_SERVICE_SAFEBOOT: int +RPC_S_INVALID_STRING_BINDING: int +RPC_S_WRONG_KIND_OF_BINDING: int +RPC_S_INVALID_BINDING: int +RPC_S_PROTSEQ_NOT_SUPPORTED: int +RPC_S_INVALID_RPC_PROTSEQ: int +RPC_S_INVALID_STRING_UUID: int +RPC_S_INVALID_ENDPOINT_FORMAT: int +RPC_S_INVALID_NET_ADDR: int +RPC_S_NO_ENDPOINT_FOUND: int +RPC_S_INVALID_TIMEOUT: int +RPC_S_OBJECT_NOT_FOUND: int +RPC_S_ALREADY_REGISTERED: int +RPC_S_TYPE_ALREADY_REGISTERED: int +RPC_S_ALREADY_LISTENING: int +RPC_S_NO_PROTSEQS_REGISTERED: int +RPC_S_NOT_LISTENING: int +RPC_S_UNKNOWN_MGR_TYPE: int +RPC_S_UNKNOWN_IF: int +RPC_S_NO_BINDINGS: int +RPC_S_NO_PROTSEQS: int +RPC_S_CANT_CREATE_ENDPOINT: int +RPC_S_OUT_OF_RESOURCES: int +RPC_S_SERVER_UNAVAILABLE: int +RPC_S_SERVER_TOO_BUSY: int +RPC_S_INVALID_NETWORK_OPTIONS: int +RPC_S_NO_CALL_ACTIVE: int +RPC_S_CALL_FAILED: int +RPC_S_CALL_FAILED_DNE: int +RPC_S_PROTOCOL_ERROR: int +RPC_S_PROXY_ACCESS_DENIED: int +RPC_S_UNSUPPORTED_TRANS_SYN: int +RPC_S_UNSUPPORTED_TYPE: int +RPC_S_INVALID_TAG: int +RPC_S_INVALID_BOUND: int +RPC_S_NO_ENTRY_NAME: int +RPC_S_INVALID_NAME_SYNTAX: int +RPC_S_UNSUPPORTED_NAME_SYNTAX: int +RPC_S_UUID_NO_ADDRESS: int +RPC_S_DUPLICATE_ENDPOINT: int +RPC_S_UNKNOWN_AUTHN_TYPE: int +RPC_S_MAX_CALLS_TOO_SMALL: int +RPC_S_STRING_TOO_LONG: int +RPC_S_PROTSEQ_NOT_FOUND: int +RPC_S_PROCNUM_OUT_OF_RANGE: int +RPC_S_BINDING_HAS_NO_AUTH: int +RPC_S_UNKNOWN_AUTHN_SERVICE: int +RPC_S_UNKNOWN_AUTHN_LEVEL: int +RPC_S_INVALID_AUTH_IDENTITY: int +RPC_S_UNKNOWN_AUTHZ_SERVICE: int +EPT_S_INVALID_ENTRY: int +EPT_S_CANT_PERFORM_OP: int +EPT_S_NOT_REGISTERED: int +RPC_S_NOTHING_TO_EXPORT: int +RPC_S_INCOMPLETE_NAME: int +RPC_S_INVALID_VERS_OPTION: int +RPC_S_NO_MORE_MEMBERS: int +RPC_S_NOT_ALL_OBJS_UNEXPORTED: int +RPC_S_INTERFACE_NOT_FOUND: int +RPC_S_ENTRY_ALREADY_EXISTS: int +RPC_S_ENTRY_NOT_FOUND: int +RPC_S_NAME_SERVICE_UNAVAILABLE: int +RPC_S_INVALID_NAF_ID: int +RPC_S_CANNOT_SUPPORT: int +RPC_S_NO_CONTEXT_AVAILABLE: int +RPC_S_INTERNAL_ERROR: int +RPC_S_ZERO_DIVIDE: int +RPC_S_ADDRESS_ERROR: int +RPC_S_FP_DIV_ZERO: int +RPC_S_FP_UNDERFLOW: int +RPC_S_FP_OVERFLOW: int +RPC_X_NO_MORE_ENTRIES: int +RPC_X_SS_CHAR_TRANS_OPEN_FAIL: int +RPC_X_SS_CHAR_TRANS_SHORT_FILE: int +RPC_X_SS_IN_NULL_CONTEXT: int +RPC_X_SS_CONTEXT_DAMAGED: int +RPC_X_SS_HANDLES_MISMATCH: int +RPC_X_SS_CANNOT_GET_CALL_HANDLE: int +RPC_X_NULL_REF_POINTER: int +RPC_X_ENUM_VALUE_OUT_OF_RANGE: int +RPC_X_BYTE_COUNT_TOO_SMALL: int +RPC_X_BAD_STUB_DATA: int +ERROR_INVALID_USER_BUFFER: int +ERROR_UNRECOGNIZED_MEDIA: int +ERROR_NO_TRUST_LSA_SECRET: int +ERROR_NO_TRUST_SAM_ACCOUNT: int +ERROR_TRUSTED_DOMAIN_FAILURE: int +ERROR_TRUSTED_RELATIONSHIP_FAILURE: int +ERROR_TRUST_FAILURE: int +RPC_S_CALL_IN_PROGRESS: int +ERROR_NETLOGON_NOT_STARTED: int +ERROR_ACCOUNT_EXPIRED: int +ERROR_REDIRECTOR_HAS_OPEN_HANDLES: int +ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: int +ERROR_UNKNOWN_PORT: int +ERROR_UNKNOWN_PRINTER_DRIVER: int +ERROR_UNKNOWN_PRINTPROCESSOR: int +ERROR_INVALID_SEPARATOR_FILE: int +ERROR_INVALID_PRIORITY: int +ERROR_INVALID_PRINTER_NAME: int +ERROR_PRINTER_ALREADY_EXISTS: int +ERROR_INVALID_PRINTER_COMMAND: int +ERROR_INVALID_DATATYPE: int +ERROR_INVALID_ENVIRONMENT: int +RPC_S_NO_MORE_BINDINGS: int +ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: int +ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: int +ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: int +ERROR_DOMAIN_TRUST_INCONSISTENT: int +ERROR_SERVER_HAS_OPEN_HANDLES: int +ERROR_RESOURCE_DATA_NOT_FOUND: int +ERROR_RESOURCE_TYPE_NOT_FOUND: int +ERROR_RESOURCE_NAME_NOT_FOUND: int +ERROR_RESOURCE_LANG_NOT_FOUND: int +ERROR_NOT_ENOUGH_QUOTA: int +RPC_S_NO_INTERFACES: int +RPC_S_CALL_CANCELLED: int +RPC_S_BINDING_INCOMPLETE: int +RPC_S_COMM_FAILURE: int +RPC_S_UNSUPPORTED_AUTHN_LEVEL: int +RPC_S_NO_PRINC_NAME: int +RPC_S_NOT_RPC_ERROR: int +RPC_S_UUID_LOCAL_ONLY: int +RPC_S_SEC_PKG_ERROR: int +RPC_S_NOT_CANCELLED: int +RPC_X_INVALID_ES_ACTION: int +RPC_X_WRONG_ES_VERSION: int +RPC_X_WRONG_STUB_VERSION: int +RPC_X_INVALID_PIPE_OBJECT: int +RPC_X_WRONG_PIPE_ORDER: int +RPC_X_WRONG_PIPE_VERSION: int +RPC_S_GROUP_MEMBER_NOT_FOUND: int +EPT_S_CANT_CREATE: int +RPC_S_INVALID_OBJECT: int +ERROR_INVALID_TIME: int +ERROR_INVALID_FORM_NAME: int +ERROR_INVALID_FORM_SIZE: int +ERROR_ALREADY_WAITING: int +ERROR_PRINTER_DELETED: int +ERROR_INVALID_PRINTER_STATE: int +ERROR_PASSWORD_MUST_CHANGE: int +ERROR_DOMAIN_CONTROLLER_NOT_FOUND: int +ERROR_ACCOUNT_LOCKED_OUT: int +OR_INVALID_OXID: int +OR_INVALID_OID: int +OR_INVALID_SET: int +RPC_S_SEND_INCOMPLETE: int +RPC_S_INVALID_ASYNC_HANDLE: int +RPC_S_INVALID_ASYNC_CALL: int +RPC_X_PIPE_CLOSED: int +RPC_X_PIPE_DISCIPLINE_ERROR: int +RPC_X_PIPE_EMPTY: int +ERROR_NO_SITENAME: int +ERROR_CANT_ACCESS_FILE: int +ERROR_CANT_RESOLVE_FILENAME: int +RPC_S_ENTRY_TYPE_MISMATCH: int +RPC_S_NOT_ALL_OBJS_EXPORTED: int +RPC_S_INTERFACE_NOT_EXPORTED: int +RPC_S_PROFILE_NOT_ADDED: int +RPC_S_PRF_ELT_NOT_ADDED: int +RPC_S_PRF_ELT_NOT_REMOVED: int +RPC_S_GRP_ELT_NOT_ADDED: int +RPC_S_GRP_ELT_NOT_REMOVED: int +ERROR_KM_DRIVER_BLOCKED: int +ERROR_CONTEXT_EXPIRED: int +ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: int +ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: int +ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: int +ERROR_AUTHENTICATION_FIREWALL_FAILED: int +ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: int +ERROR_NTLM_BLOCKED: int +ERROR_INVALID_PIXEL_FORMAT: int +ERROR_BAD_DRIVER: int +ERROR_INVALID_WINDOW_STYLE: int +ERROR_METAFILE_NOT_SUPPORTED: int +ERROR_TRANSFORM_NOT_SUPPORTED: int +ERROR_CLIPPING_NOT_SUPPORTED: int +ERROR_INVALID_CMM: int +ERROR_INVALID_PROFILE: int +ERROR_TAG_NOT_FOUND: int +ERROR_TAG_NOT_PRESENT: int +ERROR_DUPLICATE_TAG: int +ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE: int +ERROR_PROFILE_NOT_FOUND: int +ERROR_INVALID_COLORSPACE: int +ERROR_ICM_NOT_ENABLED: int +ERROR_DELETING_ICM_XFORM: int +ERROR_INVALID_TRANSFORM: int +ERROR_COLORSPACE_MISMATCH: int +ERROR_INVALID_COLORINDEX: int +ERROR_PROFILE_DOES_NOT_MATCH_DEVICE: int +ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: int +ERROR_UNKNOWN_PRINT_MONITOR: int +ERROR_PRINTER_DRIVER_IN_USE: int +ERROR_SPOOL_FILE_NOT_FOUND: int +ERROR_SPL_NO_STARTDOC: int +ERROR_SPL_NO_ADDJOB: int +ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED: int +ERROR_PRINT_MONITOR_ALREADY_INSTALLED: int +ERROR_INVALID_PRINT_MONITOR: int +ERROR_PRINT_MONITOR_IN_USE: int +ERROR_PRINTER_HAS_JOBS_QUEUED: int +ERROR_SUCCESS_REBOOT_REQUIRED: int +ERROR_SUCCESS_RESTART_REQUIRED: int +ERROR_PRINTER_NOT_FOUND: int +ERROR_PRINTER_DRIVER_WARNED: int +ERROR_PRINTER_DRIVER_BLOCKED: int +ERROR_PRINTER_DRIVER_PACKAGE_IN_USE: int +ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND: int +ERROR_FAIL_REBOOT_REQUIRED: int +ERROR_FAIL_REBOOT_INITIATED: int +ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED: int +ERROR_PRINT_JOB_RESTART_REQUIRED: int +ERROR_IO_REISSUE_AS_CACHED: int +ERROR_WINS_INTERNAL: int +ERROR_CAN_NOT_DEL_LOCAL_WINS: int +ERROR_STATIC_INIT: int +ERROR_INC_BACKUP: int +ERROR_FULL_BACKUP: int +ERROR_REC_NON_EXISTENT: int +ERROR_RPL_NOT_ALLOWED: int +ERROR_DHCP_ADDRESS_CONFLICT: int +ERROR_WMI_GUID_NOT_FOUND: int +ERROR_WMI_INSTANCE_NOT_FOUND: int +ERROR_WMI_ITEMID_NOT_FOUND: int +ERROR_WMI_TRY_AGAIN: int +ERROR_WMI_DP_NOT_FOUND: int +ERROR_WMI_UNRESOLVED_INSTANCE_REF: int +ERROR_WMI_ALREADY_ENABLED: int +ERROR_WMI_GUID_DISCONNECTED: int +ERROR_WMI_SERVER_UNAVAILABLE: int +ERROR_WMI_DP_FAILED: int +ERROR_WMI_INVALID_MOF: int +ERROR_WMI_INVALID_REGINFO: int +ERROR_WMI_ALREADY_DISABLED: int +ERROR_WMI_READ_ONLY: int +ERROR_WMI_SET_FAILURE: int +ERROR_INVALID_MEDIA: int +ERROR_INVALID_LIBRARY: int +ERROR_INVALID_MEDIA_POOL: int +ERROR_DRIVE_MEDIA_MISMATCH: int +ERROR_MEDIA_OFFLINE: int +ERROR_LIBRARY_OFFLINE: int +ERROR_EMPTY: int +ERROR_NOT_EMPTY: int +ERROR_MEDIA_UNAVAILABLE: int +ERROR_RESOURCE_DISABLED: int +ERROR_INVALID_CLEANER: int +ERROR_UNABLE_TO_CLEAN: int +ERROR_OBJECT_NOT_FOUND: int +ERROR_DATABASE_FAILURE: int +ERROR_DATABASE_FULL: int +ERROR_MEDIA_INCOMPATIBLE: int +ERROR_RESOURCE_NOT_PRESENT: int +ERROR_INVALID_OPERATION: int +ERROR_MEDIA_NOT_AVAILABLE: int +ERROR_DEVICE_NOT_AVAILABLE: int +ERROR_REQUEST_REFUSED: int +ERROR_INVALID_DRIVE_OBJECT: int +ERROR_LIBRARY_FULL: int +ERROR_MEDIUM_NOT_ACCESSIBLE: int +ERROR_UNABLE_TO_LOAD_MEDIUM: int +ERROR_UNABLE_TO_INVENTORY_DRIVE: int +ERROR_UNABLE_TO_INVENTORY_SLOT: int +ERROR_UNABLE_TO_INVENTORY_TRANSPORT: int +ERROR_TRANSPORT_FULL: int +ERROR_CONTROLLING_IEPORT: int +ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA: int +ERROR_CLEANER_SLOT_SET: int +ERROR_CLEANER_SLOT_NOT_SET: int +ERROR_CLEANER_CARTRIDGE_SPENT: int +ERROR_UNEXPECTED_OMID: int +ERROR_CANT_DELETE_LAST_ITEM: int +ERROR_MESSAGE_EXCEEDS_MAX_SIZE: int +ERROR_VOLUME_CONTAINS_SYS_FILES: int +ERROR_INDIGENOUS_TYPE: int +ERROR_NO_SUPPORTING_DRIVES: int +ERROR_CLEANER_CARTRIDGE_INSTALLED: int +ERROR_IEPORT_FULL: int +ERROR_FILE_OFFLINE: int +ERROR_REMOTE_STORAGE_NOT_ACTIVE: int +ERROR_REMOTE_STORAGE_MEDIA_ERROR: int +ERROR_NOT_A_REPARSE_POINT: int +ERROR_REPARSE_ATTRIBUTE_CONFLICT: int +ERROR_INVALID_REPARSE_DATA: int +ERROR_REPARSE_TAG_INVALID: int +ERROR_REPARSE_TAG_MISMATCH: int +ERROR_VOLUME_NOT_SIS_ENABLED: int +ERROR_DEPENDENT_RESOURCE_EXISTS: int +ERROR_DEPENDENCY_NOT_FOUND: int +ERROR_DEPENDENCY_ALREADY_EXISTS: int +ERROR_RESOURCE_NOT_ONLINE: int +ERROR_HOST_NODE_NOT_AVAILABLE: int +ERROR_RESOURCE_NOT_AVAILABLE: int +ERROR_RESOURCE_NOT_FOUND: int +ERROR_SHUTDOWN_CLUSTER: int +ERROR_CANT_EVICT_ACTIVE_NODE: int +ERROR_OBJECT_ALREADY_EXISTS: int +ERROR_OBJECT_IN_LIST: int +ERROR_GROUP_NOT_AVAILABLE: int +ERROR_GROUP_NOT_FOUND: int +ERROR_GROUP_NOT_ONLINE: int +ERROR_HOST_NODE_NOT_RESOURCE_OWNER: int +ERROR_HOST_NODE_NOT_GROUP_OWNER: int +ERROR_RESMON_CREATE_FAILED: int +ERROR_RESMON_ONLINE_FAILED: int +ERROR_RESOURCE_ONLINE: int +ERROR_QUORUM_RESOURCE: int +ERROR_NOT_QUORUM_CAPABLE: int +ERROR_CLUSTER_SHUTTING_DOWN: int +ERROR_INVALID_STATE: int +ERROR_RESOURCE_PROPERTIES_STORED: int +ERROR_NOT_QUORUM_CLASS: int +ERROR_CORE_RESOURCE: int +ERROR_QUORUM_RESOURCE_ONLINE_FAILED: int +ERROR_QUORUMLOG_OPEN_FAILED: int +ERROR_CLUSTERLOG_CORRUPT: int +ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE: int +ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE: int +ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND: int +ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE: int +ERROR_QUORUM_OWNER_ALIVE: int +ERROR_NETWORK_NOT_AVAILABLE: int +ERROR_NODE_NOT_AVAILABLE: int +ERROR_ALL_NODES_NOT_AVAILABLE: int +ERROR_RESOURCE_FAILED: int +ERROR_CLUSTER_INVALID_NODE: int +ERROR_CLUSTER_NODE_EXISTS: int +ERROR_CLUSTER_JOIN_IN_PROGRESS: int +ERROR_CLUSTER_NODE_NOT_FOUND: int +ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND: int +ERROR_CLUSTER_NETWORK_EXISTS: int +ERROR_CLUSTER_NETWORK_NOT_FOUND: int +ERROR_CLUSTER_NETINTERFACE_EXISTS: int +ERROR_CLUSTER_NETINTERFACE_NOT_FOUND: int +ERROR_CLUSTER_INVALID_REQUEST: int +ERROR_CLUSTER_INVALID_NETWORK_PROVIDER: int +ERROR_CLUSTER_NODE_DOWN: int +ERROR_CLUSTER_NODE_UNREACHABLE: int +ERROR_CLUSTER_NODE_NOT_MEMBER: int +ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS: int +ERROR_CLUSTER_INVALID_NETWORK: int +ERROR_CLUSTER_NODE_UP: int +ERROR_CLUSTER_IPADDR_IN_USE: int +ERROR_CLUSTER_NODE_NOT_PAUSED: int +ERROR_CLUSTER_NO_SECURITY_CONTEXT: int +ERROR_CLUSTER_NETWORK_NOT_INTERNAL: int +ERROR_CLUSTER_NODE_ALREADY_UP: int +ERROR_CLUSTER_NODE_ALREADY_DOWN: int +ERROR_CLUSTER_NETWORK_ALREADY_ONLINE: int +ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE: int +ERROR_CLUSTER_NODE_ALREADY_MEMBER: int +ERROR_CLUSTER_LAST_INTERNAL_NETWORK: int +ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS: int +ERROR_INVALID_OPERATION_ON_QUORUM: int +ERROR_DEPENDENCY_NOT_ALLOWED: int +ERROR_CLUSTER_NODE_PAUSED: int +ERROR_NODE_CANT_HOST_RESOURCE: int +ERROR_CLUSTER_NODE_NOT_READY: int +ERROR_CLUSTER_NODE_SHUTTING_DOWN: int +ERROR_CLUSTER_JOIN_ABORTED: int +ERROR_CLUSTER_INCOMPATIBLE_VERSIONS: int +ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED: int +ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED: int +ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND: int +ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED: int +ERROR_CLUSTER_RESNAME_NOT_FOUND: int +ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED: int +ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST: int +ERROR_CLUSTER_DATABASE_SEQMISMATCH: int +ERROR_RESMON_INVALID_STATE: int +ERROR_CLUSTER_GUM_NOT_LOCKER: int +ERROR_QUORUM_DISK_NOT_FOUND: int +ERROR_DATABASE_BACKUP_CORRUPT: int +ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT: int +ERROR_RESOURCE_PROPERTY_UNCHANGEABLE: int +ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE: int +ERROR_CLUSTER_QUORUMLOG_NOT_FOUND: int +ERROR_CLUSTER_MEMBERSHIP_HALT: int +ERROR_CLUSTER_INSTANCE_ID_MISMATCH: int +ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP: int +ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH: int +ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP: int +ERROR_CLUSTER_PARAMETER_MISMATCH: int +ERROR_NODE_CANNOT_BE_CLUSTERED: int +ERROR_CLUSTER_WRONG_OS_VERSION: int +ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME: int +ERROR_CLUSCFG_ALREADY_COMMITTED: int +ERROR_CLUSCFG_ROLLBACK_FAILED: int +ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT: int +ERROR_CLUSTER_OLD_VERSION: int +ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME: int +ERROR_CLUSTER_NO_NET_ADAPTERS: int +ERROR_CLUSTER_POISONED: int +ERROR_CLUSTER_GROUP_MOVING: int +ERROR_CLUSTER_RESOURCE_TYPE_BUSY: int +ERROR_RESOURCE_CALL_TIMED_OUT: int +ERROR_INVALID_CLUSTER_IPV6_ADDRESS: int +ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION: int +ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS: int +ERROR_CLUSTER_PARTIAL_SEND: int +ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION: int +ERROR_CLUSTER_INVALID_STRING_TERMINATION: int +ERROR_CLUSTER_INVALID_STRING_FORMAT: int +ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS: int +ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS: int +ERROR_CLUSTER_NULL_DATA: int +ERROR_CLUSTER_PARTIAL_READ: int +ERROR_CLUSTER_PARTIAL_WRITE: int +ERROR_CLUSTER_CANT_DESERIALIZE_DATA: int +ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT: int +ERROR_CLUSTER_NO_QUORUM: int +ERROR_CLUSTER_INVALID_IPV6_NETWORK: int +ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK: int +ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP: int +ERROR_DEPENDENCY_TREE_TOO_COMPLEX: int +ERROR_EXCEPTION_IN_RESOURCE_CALL: int +ERROR_CLUSTER_RHS_FAILED_INITIALIZATION: int +ERROR_CLUSTER_NOT_INSTALLED: int +ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE: int +ERROR_ENCRYPTION_FAILED: int +ERROR_DECRYPTION_FAILED: int +ERROR_FILE_ENCRYPTED: int +ERROR_NO_RECOVERY_POLICY: int +ERROR_NO_EFS: int +ERROR_WRONG_EFS: int +ERROR_NO_USER_KEYS: int +ERROR_FILE_NOT_ENCRYPTED: int +ERROR_NOT_EXPORT_FORMAT: int +ERROR_FILE_READ_ONLY: int +ERROR_DIR_EFS_DISALLOWED: int +ERROR_EFS_SERVER_NOT_TRUSTED: int +ERROR_BAD_RECOVERY_POLICY: int +ERROR_EFS_ALG_BLOB_TOO_BIG: int +ERROR_VOLUME_NOT_SUPPORT_EFS: int +ERROR_EFS_DISABLED: int +ERROR_EFS_VERSION_NOT_SUPPORT: int +ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: int +ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: int +ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: int +ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: int +ERROR_CS_ENCRYPTION_FILE_NOT_CSE: int +ERROR_NO_BROWSER_SERVERS_FOUND: int +ERROR_LOG_SECTOR_INVALID: int +ERROR_LOG_SECTOR_PARITY_INVALID: int +ERROR_LOG_SECTOR_REMAPPED: int +ERROR_LOG_BLOCK_INCOMPLETE: int +ERROR_LOG_INVALID_RANGE: int +ERROR_LOG_BLOCKS_EXHAUSTED: int +ERROR_LOG_READ_CONTEXT_INVALID: int +ERROR_LOG_RESTART_INVALID: int +ERROR_LOG_BLOCK_VERSION: int +ERROR_LOG_BLOCK_INVALID: int +ERROR_LOG_READ_MODE_INVALID: int +ERROR_LOG_NO_RESTART: int +ERROR_LOG_METADATA_CORRUPT: int +ERROR_LOG_METADATA_INVALID: int +ERROR_LOG_METADATA_INCONSISTENT: int +ERROR_LOG_RESERVATION_INVALID: int +ERROR_LOG_CANT_DELETE: int +ERROR_LOG_CONTAINER_LIMIT_EXCEEDED: int +ERROR_LOG_START_OF_LOG: int +ERROR_LOG_POLICY_ALREADY_INSTALLED: int +ERROR_LOG_POLICY_NOT_INSTALLED: int +ERROR_LOG_POLICY_INVALID: int +ERROR_LOG_POLICY_CONFLICT: int +ERROR_LOG_PINNED_ARCHIVE_TAIL: int +ERROR_LOG_RECORD_NONEXISTENT: int +ERROR_LOG_RECORDS_RESERVED_INVALID: int +ERROR_LOG_SPACE_RESERVED_INVALID: int +ERROR_LOG_TAIL_INVALID: int +ERROR_LOG_FULL: int +ERROR_COULD_NOT_RESIZE_LOG: int +ERROR_LOG_MULTIPLEXED: int +ERROR_LOG_DEDICATED: int +ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS: int +ERROR_LOG_ARCHIVE_IN_PROGRESS: int +ERROR_LOG_EPHEMERAL: int +ERROR_LOG_NOT_ENOUGH_CONTAINERS: int +ERROR_LOG_CLIENT_ALREADY_REGISTERED: int +ERROR_LOG_CLIENT_NOT_REGISTERED: int +ERROR_LOG_FULL_HANDLER_IN_PROGRESS: int +ERROR_LOG_CONTAINER_READ_FAILED: int +ERROR_LOG_CONTAINER_WRITE_FAILED: int +ERROR_LOG_CONTAINER_OPEN_FAILED: int +ERROR_LOG_CONTAINER_STATE_INVALID: int +ERROR_LOG_STATE_INVALID: int +ERROR_LOG_PINNED: int +ERROR_LOG_METADATA_FLUSH_FAILED: int +ERROR_LOG_INCONSISTENT_SECURITY: int +ERROR_LOG_APPENDED_FLUSH_FAILED: int +ERROR_LOG_PINNED_RESERVATION: int +ERROR_INVALID_TRANSACTION: int +ERROR_TRANSACTION_NOT_ACTIVE: int +ERROR_TRANSACTION_REQUEST_NOT_VALID: int +ERROR_TRANSACTION_NOT_REQUESTED: int +ERROR_TRANSACTION_ALREADY_ABORTED: int +ERROR_TRANSACTION_ALREADY_COMMITTED: int +ERROR_TM_INITIALIZATION_FAILED: int +ERROR_RESOURCEMANAGER_READ_ONLY: int +ERROR_TRANSACTION_NOT_JOINED: int +ERROR_TRANSACTION_SUPERIOR_EXISTS: int +ERROR_CRM_PROTOCOL_ALREADY_EXISTS: int +ERROR_TRANSACTION_PROPAGATION_FAILED: int +ERROR_CRM_PROTOCOL_NOT_FOUND: int +ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER: int +ERROR_CURRENT_TRANSACTION_NOT_VALID: int +ERROR_TRANSACTION_NOT_FOUND: int +ERROR_RESOURCEMANAGER_NOT_FOUND: int +ERROR_ENLISTMENT_NOT_FOUND: int +ERROR_TRANSACTIONMANAGER_NOT_FOUND: int +ERROR_TRANSACTIONMANAGER_NOT_ONLINE: int +ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: int +ERROR_TRANSACTION_NOT_ROOT: int +ERROR_TRANSACTION_OBJECT_EXPIRED: int +ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED: int +ERROR_TRANSACTION_RECORD_TOO_LONG: int +ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED: int +ERROR_TRANSACTION_INTEGRITY_VIOLATED: int +ERROR_TRANSACTIONAL_CONFLICT: int +ERROR_RM_NOT_ACTIVE: int +ERROR_RM_METADATA_CORRUPT: int +ERROR_DIRECTORY_NOT_RM: int +ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE: int +ERROR_LOG_RESIZE_INVALID_SIZE: int +ERROR_OBJECT_NO_LONGER_EXISTS: int +ERROR_STREAM_MINIVERSION_NOT_FOUND: int +ERROR_STREAM_MINIVERSION_NOT_VALID: int +ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: int +ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: int +ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS: int +ERROR_REMOTE_FILE_VERSION_MISMATCH: int +ERROR_HANDLE_NO_LONGER_VALID: int +ERROR_NO_TXF_METADATA: int +ERROR_LOG_CORRUPTION_DETECTED: int +ERROR_CANT_RECOVER_WITH_HANDLE_OPEN: int +ERROR_RM_DISCONNECTED: int +ERROR_ENLISTMENT_NOT_SUPERIOR: int +ERROR_RECOVERY_NOT_NEEDED: int +ERROR_RM_ALREADY_STARTED: int +ERROR_FILE_IDENTITY_NOT_PERSISTENT: int +ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: int +ERROR_CANT_CROSS_RM_BOUNDARY: int +ERROR_TXF_DIR_NOT_EMPTY: int +ERROR_INDOUBT_TRANSACTIONS_EXIST: int +ERROR_TM_VOLATILE: int +ERROR_ROLLBACK_TIMER_EXPIRED: int +ERROR_TXF_ATTRIBUTE_CORRUPT: int +ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION: int +ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED: int +ERROR_LOG_GROWTH_FAILED: int +ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: int +ERROR_TXF_METADATA_ALREADY_PRESENT: int +ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: int +ERROR_TRANSACTION_REQUIRED_PROMOTION: int +ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION: int +ERROR_TRANSACTIONS_NOT_FROZEN: int +ERROR_TRANSACTION_FREEZE_IN_PROGRESS: int +ERROR_NOT_SNAPSHOT_VOLUME: int +ERROR_NO_SAVEPOINT_WITH_OPEN_FILES: int +ERROR_DATA_LOST_REPAIR: int +ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION: int +ERROR_TM_IDENTITY_MISMATCH: int +ERROR_FLOATED_SECTION: int +ERROR_CANNOT_ACCEPT_TRANSACTED_WORK: int +ERROR_CANNOT_ABORT_TRANSACTIONS: int +ERROR_BAD_CLUSTERS: int +ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: int +ERROR_VOLUME_DIRTY: int +ERROR_NO_LINK_TRACKING_IN_TRANSACTION: int +ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: int +ERROR_CTX_WINSTATION_NAME_INVALID: int +ERROR_CTX_INVALID_PD: int +ERROR_CTX_PD_NOT_FOUND: int +ERROR_CTX_WD_NOT_FOUND: int +ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY: int +ERROR_CTX_SERVICE_NAME_COLLISION: int +ERROR_CTX_CLOSE_PENDING: int +ERROR_CTX_NO_OUTBUF: int +ERROR_CTX_MODEM_INF_NOT_FOUND: int +ERROR_CTX_INVALID_MODEMNAME: int +ERROR_CTX_MODEM_RESPONSE_ERROR: int +ERROR_CTX_MODEM_RESPONSE_TIMEOUT: int +ERROR_CTX_MODEM_RESPONSE_NO_CARRIER: int +ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE: int +ERROR_CTX_MODEM_RESPONSE_BUSY: int +ERROR_CTX_MODEM_RESPONSE_VOICE: int +ERROR_CTX_TD_ERROR: int +ERROR_CTX_WINSTATION_NOT_FOUND: int +ERROR_CTX_WINSTATION_ALREADY_EXISTS: int +ERROR_CTX_WINSTATION_BUSY: int +ERROR_CTX_BAD_VIDEO_MODE: int +ERROR_CTX_GRAPHICS_INVALID: int +ERROR_CTX_LOGON_DISABLED: int +ERROR_CTX_NOT_CONSOLE: int +ERROR_CTX_CLIENT_QUERY_TIMEOUT: int +ERROR_CTX_CONSOLE_DISCONNECT: int +ERROR_CTX_CONSOLE_CONNECT: int +ERROR_CTX_SHADOW_DENIED: int +ERROR_CTX_WINSTATION_ACCESS_DENIED: int +ERROR_CTX_INVALID_WD: int +ERROR_CTX_SHADOW_INVALID: int +ERROR_CTX_SHADOW_DISABLED: int +ERROR_CTX_CLIENT_LICENSE_IN_USE: int +ERROR_CTX_CLIENT_LICENSE_NOT_SET: int +ERROR_CTX_LICENSE_NOT_AVAILABLE: int +ERROR_CTX_LICENSE_CLIENT_INVALID: int +ERROR_CTX_LICENSE_EXPIRED: int +ERROR_CTX_SHADOW_NOT_RUNNING: int +ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE: int +ERROR_ACTIVATION_COUNT_EXCEEDED: int +ERROR_CTX_WINSTATIONS_DISABLED: int +ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED: int +ERROR_CTX_SESSION_IN_USE: int +ERROR_CTX_NO_FORCE_LOGOFF: int +ERROR_CTX_ACCOUNT_RESTRICTION: int +ERROR_RDP_PROTOCOL_ERROR: int +ERROR_CTX_CDM_CONNECT: int +ERROR_CTX_CDM_DISCONNECT: int +ERROR_CTX_SECURITY_LAYER_ERROR: int +ERROR_TS_INCOMPATIBLE_SESSIONS: int +FRS_ERR_INVALID_API_SEQUENCE: int +FRS_ERR_STARTING_SERVICE: int +FRS_ERR_STOPPING_SERVICE: int +FRS_ERR_INTERNAL_API: int +FRS_ERR_INTERNAL: int +FRS_ERR_SERVICE_COMM: int +FRS_ERR_INSUFFICIENT_PRIV: int +FRS_ERR_AUTHENTICATION: int +FRS_ERR_PARENT_INSUFFICIENT_PRIV: int +FRS_ERR_PARENT_AUTHENTICATION: int +FRS_ERR_CHILD_TO_PARENT_COMM: int +FRS_ERR_PARENT_TO_CHILD_COMM: int +FRS_ERR_SYSVOL_POPULATE: int +FRS_ERR_SYSVOL_POPULATE_TIMEOUT: int +FRS_ERR_SYSVOL_IS_BUSY: int +FRS_ERR_SYSVOL_DEMOTE: int +FRS_ERR_INVALID_SERVICE_PARAMETER: int +DS_S_SUCCESS: int +ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: int +ERROR_DS_NO_ATTRIBUTE_OR_VALUE: int +ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: int +ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: int +ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: int +ERROR_DS_BUSY: int +ERROR_DS_UNAVAILABLE: int +ERROR_DS_NO_RIDS_ALLOCATED: int +ERROR_DS_NO_MORE_RIDS: int +ERROR_DS_INCORRECT_ROLE_OWNER: int +ERROR_DS_RIDMGR_INIT_ERROR: int +ERROR_DS_OBJ_CLASS_VIOLATION: int +ERROR_DS_CANT_ON_NON_LEAF: int +ERROR_DS_CANT_ON_RDN: int +ERROR_DS_CANT_MOD_OBJ_CLASS: int +ERROR_DS_CROSS_DOM_MOVE_ERROR: int +ERROR_DS_GC_NOT_AVAILABLE: int +ERROR_SHARED_POLICY: int +ERROR_POLICY_OBJECT_NOT_FOUND: int +ERROR_POLICY_ONLY_IN_DS: int +ERROR_PROMOTION_ACTIVE: int +ERROR_NO_PROMOTION_ACTIVE: int +ERROR_DS_OPERATIONS_ERROR: int +ERROR_DS_PROTOCOL_ERROR: int +ERROR_DS_TIMELIMIT_EXCEEDED: int +ERROR_DS_SIZELIMIT_EXCEEDED: int +ERROR_DS_ADMIN_LIMIT_EXCEEDED: int +ERROR_DS_COMPARE_FALSE: int +ERROR_DS_COMPARE_TRUE: int +ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: int +ERROR_DS_STRONG_AUTH_REQUIRED: int +ERROR_DS_INAPPROPRIATE_AUTH: int +ERROR_DS_AUTH_UNKNOWN: int +ERROR_DS_REFERRAL: int +ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: int +ERROR_DS_CONFIDENTIALITY_REQUIRED: int +ERROR_DS_INAPPROPRIATE_MATCHING: int +ERROR_DS_CONSTRAINT_VIOLATION: int +ERROR_DS_NO_SUCH_OBJECT: int +ERROR_DS_ALIAS_PROBLEM: int +ERROR_DS_INVALID_DN_SYNTAX: int +ERROR_DS_IS_LEAF: int +ERROR_DS_ALIAS_DEREF_PROBLEM: int +ERROR_DS_UNWILLING_TO_PERFORM: int +ERROR_DS_LOOP_DETECT: int +ERROR_DS_NAMING_VIOLATION: int +ERROR_DS_OBJECT_RESULTS_TOO_LARGE: int +ERROR_DS_AFFECTS_MULTIPLE_DSAS: int +ERROR_DS_SERVER_DOWN: int +ERROR_DS_LOCAL_ERROR: int +ERROR_DS_ENCODING_ERROR: int +ERROR_DS_DECODING_ERROR: int +ERROR_DS_FILTER_UNKNOWN: int +ERROR_DS_PARAM_ERROR: int +ERROR_DS_NOT_SUPPORTED: int +ERROR_DS_NO_RESULTS_RETURNED: int +ERROR_DS_CONTROL_NOT_FOUND: int +ERROR_DS_CLIENT_LOOP: int +ERROR_DS_REFERRAL_LIMIT_EXCEEDED: int +ERROR_DS_SORT_CONTROL_MISSING: int +ERROR_DS_OFFSET_RANGE_ERROR: int +ERROR_DS_ROOT_MUST_BE_NC: int +ERROR_DS_ADD_REPLICA_INHIBITED: int +ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: int +ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: int +ERROR_DS_OBJ_STRING_NAME_EXISTS: int +ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: int +ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: int +ERROR_DS_NO_REQUESTED_ATTS_FOUND: int +ERROR_DS_USER_BUFFER_TO_SMALL: int +ERROR_DS_ATT_IS_NOT_ON_OBJ: int +ERROR_DS_ILLEGAL_MOD_OPERATION: int +ERROR_DS_OBJ_TOO_LARGE: int +ERROR_DS_BAD_INSTANCE_TYPE: int +ERROR_DS_MASTERDSA_REQUIRED: int +ERROR_DS_OBJECT_CLASS_REQUIRED: int +ERROR_DS_MISSING_REQUIRED_ATT: int +ERROR_DS_ATT_NOT_DEF_FOR_CLASS: int +ERROR_DS_ATT_ALREADY_EXISTS: int +ERROR_DS_CANT_ADD_ATT_VALUES: int +ERROR_DS_SINGLE_VALUE_CONSTRAINT: int +ERROR_DS_RANGE_CONSTRAINT: int +ERROR_DS_ATT_VAL_ALREADY_EXISTS: int +ERROR_DS_CANT_REM_MISSING_ATT: int +ERROR_DS_CANT_REM_MISSING_ATT_VAL: int +ERROR_DS_ROOT_CANT_BE_SUBREF: int +ERROR_DS_NO_CHAINING: int +ERROR_DS_NO_CHAINED_EVAL: int +ERROR_DS_NO_PARENT_OBJECT: int +ERROR_DS_PARENT_IS_AN_ALIAS: int +ERROR_DS_CANT_MIX_MASTER_AND_REPS: int +ERROR_DS_CHILDREN_EXIST: int +ERROR_DS_OBJ_NOT_FOUND: int +ERROR_DS_ALIASED_OBJ_MISSING: int +ERROR_DS_BAD_NAME_SYNTAX: int +ERROR_DS_ALIAS_POINTS_TO_ALIAS: int +ERROR_DS_CANT_DEREF_ALIAS: int +ERROR_DS_OUT_OF_SCOPE: int +ERROR_DS_OBJECT_BEING_REMOVED: int +ERROR_DS_CANT_DELETE_DSA_OBJ: int +ERROR_DS_GENERIC_ERROR: int +ERROR_DS_DSA_MUST_BE_INT_MASTER: int +ERROR_DS_CLASS_NOT_DSA: int +ERROR_DS_INSUFF_ACCESS_RIGHTS: int +ERROR_DS_ILLEGAL_SUPERIOR: int +ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: int +ERROR_DS_NAME_TOO_MANY_PARTS: int +ERROR_DS_NAME_TOO_LONG: int +ERROR_DS_NAME_VALUE_TOO_LONG: int +ERROR_DS_NAME_UNPARSEABLE: int +ERROR_DS_NAME_TYPE_UNKNOWN: int +ERROR_DS_NOT_AN_OBJECT: int +ERROR_DS_SEC_DESC_TOO_SHORT: int +ERROR_DS_SEC_DESC_INVALID: int +ERROR_DS_NO_DELETED_NAME: int +ERROR_DS_SUBREF_MUST_HAVE_PARENT: int +ERROR_DS_NCNAME_MUST_BE_NC: int +ERROR_DS_CANT_ADD_SYSTEM_ONLY: int +ERROR_DS_CLASS_MUST_BE_CONCRETE: int +ERROR_DS_INVALID_DMD: int +ERROR_DS_OBJ_GUID_EXISTS: int +ERROR_DS_NOT_ON_BACKLINK: int +ERROR_DS_NO_CROSSREF_FOR_NC: int +ERROR_DS_SHUTTING_DOWN: int +ERROR_DS_UNKNOWN_OPERATION: int +ERROR_DS_INVALID_ROLE_OWNER: int +ERROR_DS_COULDNT_CONTACT_FSMO: int +ERROR_DS_CROSS_NC_DN_RENAME: int +ERROR_DS_CANT_MOD_SYSTEM_ONLY: int +ERROR_DS_REPLICATOR_ONLY: int +ERROR_DS_OBJ_CLASS_NOT_DEFINED: int +ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: int +ERROR_DS_NAME_REFERENCE_INVALID: int +ERROR_DS_CROSS_REF_EXISTS: int +ERROR_DS_CANT_DEL_MASTER_CROSSREF: int +ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: int +ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: int +ERROR_DS_DUP_RDN: int +ERROR_DS_DUP_OID: int +ERROR_DS_DUP_MAPI_ID: int +ERROR_DS_DUP_SCHEMA_ID_GUID: int +ERROR_DS_DUP_LDAP_DISPLAY_NAME: int +ERROR_DS_SEMANTIC_ATT_TEST: int +ERROR_DS_SYNTAX_MISMATCH: int +ERROR_DS_EXISTS_IN_MUST_HAVE: int +ERROR_DS_EXISTS_IN_MAY_HAVE: int +ERROR_DS_NONEXISTENT_MAY_HAVE: int +ERROR_DS_NONEXISTENT_MUST_HAVE: int +ERROR_DS_AUX_CLS_TEST_FAIL: int +ERROR_DS_NONEXISTENT_POSS_SUP: int +ERROR_DS_SUB_CLS_TEST_FAIL: int +ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: int +ERROR_DS_EXISTS_IN_AUX_CLS: int +ERROR_DS_EXISTS_IN_SUB_CLS: int +ERROR_DS_EXISTS_IN_POSS_SUP: int +ERROR_DS_RECALCSCHEMA_FAILED: int +ERROR_DS_TREE_DELETE_NOT_FINISHED: int +ERROR_DS_CANT_DELETE: int +ERROR_DS_ATT_SCHEMA_REQ_ID: int +ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: int +ERROR_DS_CANT_CACHE_ATT: int +ERROR_DS_CANT_CACHE_CLASS: int +ERROR_DS_CANT_REMOVE_ATT_CACHE: int +ERROR_DS_CANT_REMOVE_CLASS_CACHE: int +ERROR_DS_CANT_RETRIEVE_DN: int +ERROR_DS_MISSING_SUPREF: int +ERROR_DS_CANT_RETRIEVE_INSTANCE: int +ERROR_DS_CODE_INCONSISTENCY: int +ERROR_DS_DATABASE_ERROR: int +ERROR_DS_GOVERNSID_MISSING: int +ERROR_DS_MISSING_EXPECTED_ATT: int +ERROR_DS_NCNAME_MISSING_CR_REF: int +ERROR_DS_SECURITY_CHECKING_ERROR: int +ERROR_DS_SCHEMA_NOT_LOADED: int +ERROR_DS_SCHEMA_ALLOC_FAILED: int +ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: int +ERROR_DS_GCVERIFY_ERROR: int +ERROR_DS_DRA_SCHEMA_MISMATCH: int +ERROR_DS_CANT_FIND_DSA_OBJ: int +ERROR_DS_CANT_FIND_EXPECTED_NC: int +ERROR_DS_CANT_FIND_NC_IN_CACHE: int +ERROR_DS_CANT_RETRIEVE_CHILD: int +ERROR_DS_SECURITY_ILLEGAL_MODIFY: int +ERROR_DS_CANT_REPLACE_HIDDEN_REC: int +ERROR_DS_BAD_HIERARCHY_FILE: int +ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: int +ERROR_DS_CONFIG_PARAM_MISSING: int +ERROR_DS_COUNTING_AB_INDICES_FAILED: int +ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: int +ERROR_DS_INTERNAL_FAILURE: int +ERROR_DS_UNKNOWN_ERROR: int +ERROR_DS_ROOT_REQUIRES_CLASS_TOP: int +ERROR_DS_REFUSING_FSMO_ROLES: int +ERROR_DS_MISSING_FSMO_SETTINGS: int +ERROR_DS_UNABLE_TO_SURRENDER_ROLES: int +ERROR_DS_DRA_GENERIC: int +ERROR_DS_DRA_INVALID_PARAMETER: int +ERROR_DS_DRA_BUSY: int +ERROR_DS_DRA_BAD_DN: int +ERROR_DS_DRA_BAD_NC: int +ERROR_DS_DRA_DN_EXISTS: int +ERROR_DS_DRA_INTERNAL_ERROR: int +ERROR_DS_DRA_INCONSISTENT_DIT: int +ERROR_DS_DRA_CONNECTION_FAILED: int +ERROR_DS_DRA_BAD_INSTANCE_TYPE: int +ERROR_DS_DRA_OUT_OF_MEM: int +ERROR_DS_DRA_MAIL_PROBLEM: int +ERROR_DS_DRA_REF_ALREADY_EXISTS: int +ERROR_DS_DRA_REF_NOT_FOUND: int +ERROR_DS_DRA_OBJ_IS_REP_SOURCE: int +ERROR_DS_DRA_DB_ERROR: int +ERROR_DS_DRA_NO_REPLICA: int +ERROR_DS_DRA_ACCESS_DENIED: int +ERROR_DS_DRA_NOT_SUPPORTED: int +ERROR_DS_DRA_RPC_CANCELLED: int +ERROR_DS_DRA_SOURCE_DISABLED: int +ERROR_DS_DRA_SINK_DISABLED: int +ERROR_DS_DRA_NAME_COLLISION: int +ERROR_DS_DRA_SOURCE_REINSTALLED: int +ERROR_DS_DRA_MISSING_PARENT: int +ERROR_DS_DRA_PREEMPTED: int +ERROR_DS_DRA_ABANDON_SYNC: int +ERROR_DS_DRA_SHUTDOWN: int +ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: int +ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: int +ERROR_DS_DRA_EXTN_CONNECTION_FAILED: int +ERROR_DS_INSTALL_SCHEMA_MISMATCH: int +ERROR_DS_DUP_LINK_ID: int +ERROR_DS_NAME_ERROR_RESOLVING: int +ERROR_DS_NAME_ERROR_NOT_FOUND: int +ERROR_DS_NAME_ERROR_NOT_UNIQUE: int +ERROR_DS_NAME_ERROR_NO_MAPPING: int +ERROR_DS_NAME_ERROR_DOMAIN_ONLY: int +ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: int +ERROR_DS_CONSTRUCTED_ATT_MOD: int +ERROR_DS_WRONG_OM_OBJ_CLASS: int +ERROR_DS_DRA_REPL_PENDING: int +ERROR_DS_DS_REQUIRED: int +ERROR_DS_INVALID_LDAP_DISPLAY_NAME: int +ERROR_DS_NON_BASE_SEARCH: int +ERROR_DS_CANT_RETRIEVE_ATTS: int +ERROR_DS_BACKLINK_WITHOUT_LINK: int +ERROR_DS_EPOCH_MISMATCH: int +ERROR_DS_SRC_NAME_MISMATCH: int +ERROR_DS_SRC_AND_DST_NC_IDENTICAL: int +ERROR_DS_DST_NC_MISMATCH: int +ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: int +ERROR_DS_SRC_GUID_MISMATCH: int +ERROR_DS_CANT_MOVE_DELETED_OBJECT: int +ERROR_DS_PDC_OPERATION_IN_PROGRESS: int +ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: int +ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: int +ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: int +ERROR_DS_NC_MUST_HAVE_NC_PARENT: int +ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: int +ERROR_DS_DST_DOMAIN_NOT_NATIVE: int +ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: int +ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: int +ERROR_DS_CANT_MOVE_RESOURCE_GROUP: int +ERROR_DS_INVALID_SEARCH_FLAG: int +ERROR_DS_NO_TREE_DELETE_ABOVE_NC: int +ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: int +ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: int +ERROR_DS_SAM_INIT_FAILURE: int +ERROR_DS_SENSITIVE_GROUP_VIOLATION: int +ERROR_DS_CANT_MOD_PRIMARYGROUPID: int +ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: int +ERROR_DS_NONSAFE_SCHEMA_CHANGE: int +ERROR_DS_SCHEMA_UPDATE_DISALLOWED: int +ERROR_DS_CANT_CREATE_UNDER_SCHEMA: int +ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: int +ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: int +ERROR_DS_INVALID_GROUP_TYPE: int +ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: int +ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: int +ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: int +ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: int +ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: int +ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: int +ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: int +ERROR_DS_HAVE_PRIMARY_MEMBERS: int +ERROR_DS_STRING_SD_CONVERSION_FAILED: int +ERROR_DS_NAMING_MASTER_GC: int +ERROR_DS_DNS_LOOKUP_FAILURE: int +ERROR_DS_COULDNT_UPDATE_SPNS: int +ERROR_DS_CANT_RETRIEVE_SD: int +ERROR_DS_KEY_NOT_UNIQUE: int +ERROR_DS_WRONG_LINKED_ATT_SYNTAX: int +ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: int +ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: int +ERROR_DS_CANT_START: int +ERROR_DS_INIT_FAILURE: int +ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: int +ERROR_DS_SOURCE_DOMAIN_IN_FOREST: int +ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: int +ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: int +ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: int +ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: int +ERROR_DS_SRC_SID_EXISTS_IN_FOREST: int +ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: int +ERROR_SAM_INIT_FAILURE: int +ERROR_DS_DRA_SCHEMA_INFO_SHIP: int +ERROR_DS_DRA_SCHEMA_CONFLICT: int +ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: int +ERROR_DS_DRA_OBJ_NC_MISMATCH: int +ERROR_DS_NC_STILL_HAS_DSAS: int +ERROR_DS_GC_REQUIRED: int +ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: int +ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: int +ERROR_DS_CANT_ADD_TO_GC: int +ERROR_DS_NO_CHECKPOINT_WITH_PDC: int +ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: int +ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: int +ERROR_DS_INVALID_NAME_FOR_SPN: int +ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: int +ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: int +ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: int +ERROR_DS_MUST_BE_RUN_ON_DST_DC: int +ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: int +ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: int +ERROR_DS_INIT_FAILURE_CONSOLE: int +ERROR_DS_SAM_INIT_FAILURE_CONSOLE: int +ERROR_DS_FOREST_VERSION_TOO_HIGH: int +ERROR_DS_DOMAIN_VERSION_TOO_HIGH: int +ERROR_DS_FOREST_VERSION_TOO_LOW: int +ERROR_DS_DOMAIN_VERSION_TOO_LOW: int +ERROR_DS_INCOMPATIBLE_VERSION: int +ERROR_DS_LOW_DSA_VERSION: int +ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: int +ERROR_DS_NOT_SUPPORTED_SORT_ORDER: int +ERROR_DS_NAME_NOT_UNIQUE: int +ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: int +ERROR_DS_OUT_OF_VERSION_STORE: int +ERROR_DS_INCOMPATIBLE_CONTROLS_USED: int +ERROR_DS_NO_REF_DOMAIN: int +ERROR_DS_RESERVED_LINK_ID: int +ERROR_DS_LINK_ID_NOT_AVAILABLE: int +ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: int +ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: int +ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: int +ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: int +ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: int +ERROR_DS_NAME_ERROR_TRUST_REFERRAL: int +ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: int +ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: int +ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: int +ERROR_DS_THREAD_LIMIT_EXCEEDED: int +ERROR_DS_NOT_CLOSEST: int +ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: int +ERROR_DS_SINGLE_USER_MODE_FAILED: int +ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: int +ERROR_DS_NTDSCRIPT_PROCESS_ERROR: int +ERROR_DS_DIFFERENT_REPL_EPOCHS: int +ERROR_DS_DRS_EXTENSIONS_CHANGED: int +ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: int +ERROR_DS_NO_MSDS_INTID: int +ERROR_DS_DUP_MSDS_INTID: int +ERROR_DS_EXISTS_IN_RDNATTID: int +ERROR_DS_AUTHORIZATION_FAILED: int +ERROR_DS_INVALID_SCRIPT: int +ERROR_DS_REMOTE_CROSSREF_OP_FAILED: int +ERROR_DS_CROSS_REF_BUSY: int +ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: int +ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: int +ERROR_DS_DUPLICATE_ID_FOUND: int +ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: int +ERROR_DS_GROUP_CONVERSION_ERROR: int +ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: int +ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: int +ERROR_DS_ROLE_NOT_VERIFIED: int +ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: int +ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: int +ERROR_DS_EXISTING_AD_CHILD_NC: int +ERROR_DS_REPL_LIFETIME_EXCEEDED: int +ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: int +ERROR_DS_LDAP_SEND_QUEUE_FULL: int +ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: int +ERROR_DS_POLICY_NOT_KNOWN: int +ERROR_NO_SITE_SETTINGS_OBJECT: int +ERROR_NO_SECRETS: int +ERROR_NO_WRITABLE_DC_FOUND: int +ERROR_DS_NO_SERVER_OBJECT: int +ERROR_DS_NO_NTDSA_OBJECT: int +ERROR_DS_NON_ASQ_SEARCH: int +ERROR_DS_AUDIT_FAILURE: int +ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: int +ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: int +ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: int +SEVERITY_SUCCESS: int +SEVERITY_ERROR: int + +def HRESULT_FROM_WIN32(scode): ... +def SUCCEEDED(Status): ... +def FAILED(Status): ... +def HRESULT_CODE(hr): ... +def SCODE_CODE(sc): ... +def HRESULT_FACILITY(hr): ... +def SCODE_FACILITY(sc): ... +def HRESULT_SEVERITY(hr): ... +def SCODE_SEVERITY(sc): ... + +FACILITY_NT_BIT: int + +def HRESULT_FROM_NT(x): ... +def GetScode(hr): ... +def ResultFromScode(sc): ... + +NOERROR: int +E_UNEXPECTED: int +E_NOTIMPL: int +E_OUTOFMEMORY: int +E_INVALIDARG: int +E_NOINTERFACE: int +E_POINTER: int +E_HANDLE: int +E_ABORT: int +E_FAIL: int +E_ACCESSDENIED: int +win16_E_NOTIMPL: int +win16_E_OUTOFMEMORY: int +win16_E_INVALIDARG: int +win16_E_NOINTERFACE: int +win16_E_POINTER: int +win16_E_HANDLE: int +win16_E_ABORT: int +win16_E_FAIL: int +win16_E_ACCESSDENIED: int +E_PENDING: int +CO_E_INIT_TLS: int +CO_E_INIT_SHARED_ALLOCATOR: int +CO_E_INIT_MEMORY_ALLOCATOR: int +CO_E_INIT_CLASS_CACHE: int +CO_E_INIT_RPC_CHANNEL: int +CO_E_INIT_TLS_SET_CHANNEL_CONTROL: int +CO_E_INIT_TLS_CHANNEL_CONTROL: int +CO_E_INIT_UNACCEPTED_USER_ALLOCATOR: int +CO_E_INIT_SCM_MUTEX_EXISTS: int +CO_E_INIT_SCM_FILE_MAPPING_EXISTS: int +CO_E_INIT_SCM_MAP_VIEW_OF_FILE: int +CO_E_INIT_SCM_EXEC_FAILURE: int +CO_E_INIT_ONLY_SINGLE_THREADED: int +CO_E_CANT_REMOTE: int +CO_E_BAD_SERVER_NAME: int +CO_E_WRONG_SERVER_IDENTITY: int +CO_E_OLE1DDE_DISABLED: int +CO_E_RUNAS_SYNTAX: int +CO_E_CREATEPROCESS_FAILURE: int +CO_E_RUNAS_CREATEPROCESS_FAILURE: int +CO_E_RUNAS_LOGON_FAILURE: int +CO_E_LAUNCH_PERMSSION_DENIED: int +CO_E_START_SERVICE_FAILURE: int +CO_E_REMOTE_COMMUNICATION_FAILURE: int +CO_E_SERVER_START_TIMEOUT: int +CO_E_CLSREG_INCONSISTENT: int +CO_E_IIDREG_INCONSISTENT: int +CO_E_NOT_SUPPORTED: int +CO_E_RELOAD_DLL: int +CO_E_MSI_ERROR: int +OLE_E_FIRST: int +OLE_E_LAST: int +OLE_S_FIRST: int +OLE_S_LAST: int +OLE_E_OLEVERB: int +OLE_E_ADVF: int +OLE_E_ENUM_NOMORE: int +OLE_E_ADVISENOTSUPPORTED: int +OLE_E_NOCONNECTION: int +OLE_E_NOTRUNNING: int +OLE_E_NOCACHE: int +OLE_E_BLANK: int +OLE_E_CLASSDIFF: int +OLE_E_CANT_GETMONIKER: int +OLE_E_CANT_BINDTOSOURCE: int +OLE_E_STATIC: int +OLE_E_PROMPTSAVECANCELLED: int +OLE_E_INVALIDRECT: int +OLE_E_WRONGCOMPOBJ: int +OLE_E_INVALIDHWND: int +OLE_E_NOT_INPLACEACTIVE: int +OLE_E_CANTCONVERT: int +OLE_E_NOSTORAGE: int +DV_E_FORMATETC: int +DV_E_DVTARGETDEVICE: int +DV_E_STGMEDIUM: int +DV_E_STATDATA: int +DV_E_LINDEX: int +DV_E_TYMED: int +DV_E_CLIPFORMAT: int +DV_E_DVASPECT: int +DV_E_DVTARGETDEVICE_SIZE: int +DV_E_NOIVIEWOBJECT: int +DRAGDROP_E_FIRST: int +DRAGDROP_E_LAST: int +DRAGDROP_S_FIRST: int +DRAGDROP_S_LAST: int +DRAGDROP_E_NOTREGISTERED: int +DRAGDROP_E_ALREADYREGISTERED: int +DRAGDROP_E_INVALIDHWND: int +CLASSFACTORY_E_FIRST: int +CLASSFACTORY_E_LAST: int +CLASSFACTORY_S_FIRST: int +CLASSFACTORY_S_LAST: int +CLASS_E_NOAGGREGATION: int +CLASS_E_CLASSNOTAVAILABLE: int +CLASS_E_NOTLICENSED: int +MARSHAL_E_FIRST: int +MARSHAL_E_LAST: int +MARSHAL_S_FIRST: int +MARSHAL_S_LAST: int +DATA_E_FIRST: int +DATA_E_LAST: int +DATA_S_FIRST: int +DATA_S_LAST: int +VIEW_E_FIRST: int +VIEW_E_LAST: int +VIEW_S_FIRST: int +VIEW_S_LAST: int +VIEW_E_DRAW: int +REGDB_E_FIRST: int +REGDB_E_LAST: int +REGDB_S_FIRST: int +REGDB_S_LAST: int +REGDB_E_READREGDB: int +REGDB_E_WRITEREGDB: int +REGDB_E_KEYMISSING: int +REGDB_E_INVALIDVALUE: int +REGDB_E_CLASSNOTREG: int +REGDB_E_IIDNOTREG: int +CAT_E_FIRST: int +CAT_E_LAST: int +CAT_E_CATIDNOEXIST: int +CAT_E_NODESCRIPTION: int +CS_E_FIRST: int +CS_E_LAST: int +CS_E_PACKAGE_NOTFOUND: int +CS_E_NOT_DELETABLE: int +CS_E_CLASS_NOTFOUND: int +CS_E_INVALID_VERSION: int +CS_E_NO_CLASSSTORE: int +CACHE_E_FIRST: int +CACHE_E_LAST: int +CACHE_S_FIRST: int +CACHE_S_LAST: int +CACHE_E_NOCACHE_UPDATED: int +OLEOBJ_E_FIRST: int +OLEOBJ_E_LAST: int +OLEOBJ_S_FIRST: int +OLEOBJ_S_LAST: int +OLEOBJ_E_NOVERBS: int +OLEOBJ_E_INVALIDVERB: int +CLIENTSITE_E_FIRST: int +CLIENTSITE_E_LAST: int +CLIENTSITE_S_FIRST: int +CLIENTSITE_S_LAST: int +INPLACE_E_NOTUNDOABLE: int +INPLACE_E_NOTOOLSPACE: int +INPLACE_E_FIRST: int +INPLACE_E_LAST: int +INPLACE_S_FIRST: int +INPLACE_S_LAST: int +ENUM_E_FIRST: int +ENUM_E_LAST: int +ENUM_S_FIRST: int +ENUM_S_LAST: int +CONVERT10_E_FIRST: int +CONVERT10_E_LAST: int +CONVERT10_S_FIRST: int +CONVERT10_S_LAST: int +CONVERT10_E_OLESTREAM_GET: int +CONVERT10_E_OLESTREAM_PUT: int +CONVERT10_E_OLESTREAM_FMT: int +CONVERT10_E_OLESTREAM_BITMAP_TO_DIB: int +CONVERT10_E_STG_FMT: int +CONVERT10_E_STG_NO_STD_STREAM: int +CONVERT10_E_STG_DIB_TO_BITMAP: int +CLIPBRD_E_FIRST: int +CLIPBRD_E_LAST: int +CLIPBRD_S_FIRST: int +CLIPBRD_S_LAST: int +CLIPBRD_E_CANT_OPEN: int +CLIPBRD_E_CANT_EMPTY: int +CLIPBRD_E_CANT_SET: int +CLIPBRD_E_BAD_DATA: int +CLIPBRD_E_CANT_CLOSE: int +MK_E_FIRST: int +MK_E_LAST: int +MK_S_FIRST: int +MK_S_LAST: int +MK_E_CONNECTMANUALLY: int +MK_E_EXCEEDEDDEADLINE: int +MK_E_NEEDGENERIC: int +MK_E_UNAVAILABLE: int +MK_E_SYNTAX: int +MK_E_NOOBJECT: int +MK_E_INVALIDEXTENSION: int +MK_E_INTERMEDIATEINTERFACENOTSUPPORTED: int +MK_E_NOTBINDABLE: int +MK_E_NOTBOUND: int +MK_E_CANTOPENFILE: int +MK_E_MUSTBOTHERUSER: int +MK_E_NOINVERSE: int +MK_E_NOSTORAGE: int +MK_E_NOPREFIX: int +MK_E_ENUMERATION_FAILED: int +CO_E_FIRST: int +CO_E_LAST: int +CO_S_FIRST: int +CO_S_LAST: int +CO_E_NOTINITIALIZED: int +CO_E_ALREADYINITIALIZED: int +CO_E_CANTDETERMINECLASS: int +CO_E_CLASSSTRING: int +CO_E_IIDSTRING: int +CO_E_APPNOTFOUND: int +CO_E_APPSINGLEUSE: int +CO_E_ERRORINAPP: int +CO_E_DLLNOTFOUND: int +CO_E_ERRORINDLL: int +CO_E_WRONGOSFORAPP: int +CO_E_OBJNOTREG: int +CO_E_OBJISREG: int +CO_E_OBJNOTCONNECTED: int +CO_E_APPDIDNTREG: int +CO_E_RELEASED: int +CO_E_FAILEDTOIMPERSONATE: int +CO_E_FAILEDTOGETSECCTX: int +CO_E_FAILEDTOOPENTHREADTOKEN: int +CO_E_FAILEDTOGETTOKENINFO: int +CO_E_TRUSTEEDOESNTMATCHCLIENT: int +CO_E_FAILEDTOQUERYCLIENTBLANKET: int +CO_E_FAILEDTOSETDACL: int +CO_E_ACCESSCHECKFAILED: int +CO_E_NETACCESSAPIFAILED: int +CO_E_WRONGTRUSTEENAMESYNTAX: int +CO_E_INVALIDSID: int +CO_E_CONVERSIONFAILED: int +CO_E_NOMATCHINGSIDFOUND: int +CO_E_LOOKUPACCSIDFAILED: int +CO_E_NOMATCHINGNAMEFOUND: int +CO_E_LOOKUPACCNAMEFAILED: int +CO_E_SETSERLHNDLFAILED: int +CO_E_FAILEDTOGETWINDIR: int +CO_E_PATHTOOLONG: int +CO_E_FAILEDTOGENUUID: int +CO_E_FAILEDTOCREATEFILE: int +CO_E_FAILEDTOCLOSEHANDLE: int +CO_E_EXCEEDSYSACLLIMIT: int +CO_E_ACESINWRONGORDER: int +CO_E_INCOMPATIBLESTREAMVERSION: int +CO_E_FAILEDTOOPENPROCESSTOKEN: int +CO_E_DECODEFAILED: int +CO_E_ACNOTINITIALIZED: int +OLE_S_USEREG: int +OLE_S_STATIC: int +OLE_S_MAC_CLIPFORMAT: int +DRAGDROP_S_DROP: int +DRAGDROP_S_CANCEL: int +DRAGDROP_S_USEDEFAULTCURSORS: int +DATA_S_SAMEFORMATETC: int +VIEW_S_ALREADY_FROZEN: int +CACHE_S_FORMATETC_NOTSUPPORTED: int +CACHE_S_SAMECACHE: int +CACHE_S_SOMECACHES_NOTUPDATED: int +OLEOBJ_S_INVALIDVERB: int +OLEOBJ_S_CANNOT_DOVERB_NOW: int +OLEOBJ_S_INVALIDHWND: int +INPLACE_S_TRUNCATED: int +CONVERT10_S_NO_PRESENTATION: int +MK_S_REDUCED_TO_SELF: int +MK_S_ME: int +MK_S_HIM: int +MK_S_US: int +MK_S_MONIKERALREADYREGISTERED: int +CO_E_CLASS_CREATE_FAILED: int +CO_E_SCM_ERROR: int +CO_E_SCM_RPC_FAILURE: int +CO_E_BAD_PATH: int +CO_E_SERVER_EXEC_FAILURE: int +CO_E_OBJSRV_RPC_FAILURE: int +MK_E_NO_NORMALIZED: int +CO_E_SERVER_STOPPING: int +MEM_E_INVALID_ROOT: int +MEM_E_INVALID_LINK: int +MEM_E_INVALID_SIZE: int +CO_S_NOTALLINTERFACES: int +DISP_E_UNKNOWNINTERFACE: int +DISP_E_MEMBERNOTFOUND: int +DISP_E_PARAMNOTFOUND: int +DISP_E_TYPEMISMATCH: int +DISP_E_UNKNOWNNAME: int +DISP_E_NONAMEDARGS: int +DISP_E_BADVARTYPE: int +DISP_E_EXCEPTION: int +DISP_E_OVERFLOW: int +DISP_E_BADINDEX: int +DISP_E_UNKNOWNLCID: int +DISP_E_ARRAYISLOCKED: int +DISP_E_BADPARAMCOUNT: int +DISP_E_PARAMNOTOPTIONAL: int +DISP_E_BADCALLEE: int +DISP_E_NOTACOLLECTION: int +DISP_E_DIVBYZERO: int +TYPE_E_BUFFERTOOSMALL: int +TYPE_E_FIELDNOTFOUND: int +TYPE_E_INVDATAREAD: int +TYPE_E_UNSUPFORMAT: int +TYPE_E_REGISTRYACCESS: int +TYPE_E_LIBNOTREGISTERED: int +TYPE_E_UNDEFINEDTYPE: int +TYPE_E_QUALIFIEDNAMEDISALLOWED: int +TYPE_E_INVALIDSTATE: int +TYPE_E_WRONGTYPEKIND: int +TYPE_E_ELEMENTNOTFOUND: int +TYPE_E_AMBIGUOUSNAME: int +TYPE_E_NAMECONFLICT: int +TYPE_E_UNKNOWNLCID: int +TYPE_E_DLLFUNCTIONNOTFOUND: int +TYPE_E_BADMODULEKIND: int +TYPE_E_SIZETOOBIG: int +TYPE_E_DUPLICATEID: int +TYPE_E_INVALIDID: int +TYPE_E_TYPEMISMATCH: int +TYPE_E_OUTOFBOUNDS: int +TYPE_E_IOERROR: int +TYPE_E_CANTCREATETMPFILE: int +TYPE_E_CANTLOADLIBRARY: int +TYPE_E_INCONSISTENTPROPFUNCS: int +TYPE_E_CIRCULARTYPE: int +STG_E_INVALIDFUNCTION: int +STG_E_FILENOTFOUND: int +STG_E_PATHNOTFOUND: int +STG_E_TOOMANYOPENFILES: int +STG_E_ACCESSDENIED: int +STG_E_INVALIDHANDLE: int +STG_E_INSUFFICIENTMEMORY: int +STG_E_INVALIDPOINTER: int +STG_E_NOMOREFILES: int +STG_E_DISKISWRITEPROTECTED: int +STG_E_SEEKERROR: int +STG_E_WRITEFAULT: int +STG_E_READFAULT: int +STG_E_SHAREVIOLATION: int +STG_E_LOCKVIOLATION: int +STG_E_FILEALREADYEXISTS: int +STG_E_INVALIDPARAMETER: int +STG_E_MEDIUMFULL: int +STG_E_PROPSETMISMATCHED: int +STG_E_ABNORMALAPIEXIT: int +STG_E_INVALIDHEADER: int +STG_E_INVALIDNAME: int +STG_E_UNKNOWN: int +STG_E_UNIMPLEMENTEDFUNCTION: int +STG_E_INVALIDFLAG: int +STG_E_INUSE: int +STG_E_NOTCURRENT: int +STG_E_REVERTED: int +STG_E_CANTSAVE: int +STG_E_OLDFORMAT: int +STG_E_OLDDLL: int +STG_E_SHAREREQUIRED: int +STG_E_NOTFILEBASEDSTORAGE: int +STG_E_EXTANTMARSHALLINGS: int +STG_E_DOCFILECORRUPT: int +STG_E_BADBASEADDRESS: int +STG_E_INCOMPLETE: int +STG_E_TERMINATED: int +STG_S_CONVERTED: int +STG_S_BLOCK: int +STG_S_RETRYNOW: int +STG_S_MONITORING: int +STG_S_MULTIPLEOPENS: int +STG_S_CONSOLIDATIONFAILED: int +STG_S_CANNOTCONSOLIDATE: int +RPC_E_CALL_REJECTED: int +RPC_E_CALL_CANCELED: int +RPC_E_CANTPOST_INSENDCALL: int +RPC_E_CANTCALLOUT_INASYNCCALL: int +RPC_E_CANTCALLOUT_INEXTERNALCALL: int +RPC_E_CONNECTION_TERMINATED: int +RPC_E_SERVER_DIED: int +RPC_E_CLIENT_DIED: int +RPC_E_INVALID_DATAPACKET: int +RPC_E_CANTTRANSMIT_CALL: int +RPC_E_CLIENT_CANTMARSHAL_DATA: int +RPC_E_CLIENT_CANTUNMARSHAL_DATA: int +RPC_E_SERVER_CANTMARSHAL_DATA: int +RPC_E_SERVER_CANTUNMARSHAL_DATA: int +RPC_E_INVALID_DATA: int +RPC_E_INVALID_PARAMETER: int +RPC_E_CANTCALLOUT_AGAIN: int +RPC_E_SERVER_DIED_DNE: int +RPC_E_SYS_CALL_FAILED: int +RPC_E_OUT_OF_RESOURCES: int +RPC_E_ATTEMPTED_MULTITHREAD: int +RPC_E_NOT_REGISTERED: int +RPC_E_FAULT: int +RPC_E_SERVERFAULT: int +RPC_E_CHANGED_MODE: int +RPC_E_INVALIDMETHOD: int +RPC_E_DISCONNECTED: int +RPC_E_RETRY: int +RPC_E_SERVERCALL_RETRYLATER: int +RPC_E_SERVERCALL_REJECTED: int +RPC_E_INVALID_CALLDATA: int +RPC_E_CANTCALLOUT_ININPUTSYNCCALL: int +RPC_E_WRONG_THREAD: int +RPC_E_THREAD_NOT_INIT: int +RPC_E_VERSION_MISMATCH: int +RPC_E_INVALID_HEADER: int +RPC_E_INVALID_EXTENSION: int +RPC_E_INVALID_IPID: int +RPC_E_INVALID_OBJECT: int +RPC_S_CALLPENDING: int +RPC_S_WAITONTIMER: int +RPC_E_CALL_COMPLETE: int +RPC_E_UNSECURE_CALL: int +RPC_E_TOO_LATE: int +RPC_E_NO_GOOD_SECURITY_PACKAGES: int +RPC_E_ACCESS_DENIED: int +RPC_E_REMOTE_DISABLED: int +RPC_E_INVALID_OBJREF: int +RPC_E_NO_CONTEXT: int +RPC_E_TIMEOUT: int +RPC_E_NO_SYNC: int +RPC_E_UNEXPECTED: int +NTE_BAD_UID: int +NTE_BAD_HASH: int +NTE_BAD_KEY: int +NTE_BAD_LEN: int +NTE_BAD_DATA: int +NTE_BAD_SIGNATURE: int +NTE_BAD_VER: int +NTE_BAD_ALGID: int +NTE_BAD_FLAGS: int +NTE_BAD_TYPE: int +NTE_BAD_KEY_STATE: int +NTE_BAD_HASH_STATE: int +NTE_NO_KEY: int +NTE_NO_MEMORY: int +NTE_EXISTS: int +NTE_PERM: int +NTE_NOT_FOUND: int +NTE_DOUBLE_ENCRYPT: int +NTE_BAD_PROVIDER: int +NTE_BAD_PROV_TYPE: int +NTE_BAD_PUBLIC_KEY: int +NTE_BAD_KEYSET: int +NTE_PROV_TYPE_NOT_DEF: int +NTE_PROV_TYPE_ENTRY_BAD: int +NTE_KEYSET_NOT_DEF: int +NTE_KEYSET_ENTRY_BAD: int +NTE_PROV_TYPE_NO_MATCH: int +NTE_SIGNATURE_FILE_BAD: int +NTE_PROVIDER_DLL_FAIL: int +NTE_PROV_DLL_NOT_FOUND: int +NTE_BAD_KEYSET_PARAM: int +NTE_FAIL: int +NTE_SYS_ERR: int +CRYPT_E_MSG_ERROR: int +CRYPT_E_UNKNOWN_ALGO: int +CRYPT_E_OID_FORMAT: int +CRYPT_E_INVALID_MSG_TYPE: int +CRYPT_E_UNEXPECTED_ENCODING: int +CRYPT_E_AUTH_ATTR_MISSING: int +CRYPT_E_HASH_VALUE: int +CRYPT_E_INVALID_INDEX: int +CRYPT_E_ALREADY_DECRYPTED: int +CRYPT_E_NOT_DECRYPTED: int +CRYPT_E_RECIPIENT_NOT_FOUND: int +CRYPT_E_CONTROL_TYPE: int +CRYPT_E_ISSUER_SERIALNUMBER: int +CRYPT_E_SIGNER_NOT_FOUND: int +CRYPT_E_ATTRIBUTES_MISSING: int +CRYPT_E_STREAM_MSG_NOT_READY: int +CRYPT_E_STREAM_INSUFFICIENT_DATA: int +CRYPT_E_BAD_LEN: int +CRYPT_E_BAD_ENCODE: int +CRYPT_E_FILE_ERROR: int +CRYPT_E_NOT_FOUND: int +CRYPT_E_EXISTS: int +CRYPT_E_NO_PROVIDER: int +CRYPT_E_SELF_SIGNED: int +CRYPT_E_DELETED_PREV: int +CRYPT_E_NO_MATCH: int +CRYPT_E_UNEXPECTED_MSG_TYPE: int +CRYPT_E_NO_KEY_PROPERTY: int +CRYPT_E_NO_DECRYPT_CERT: int +CRYPT_E_BAD_MSG: int +CRYPT_E_NO_SIGNER: int +CRYPT_E_PENDING_CLOSE: int +CRYPT_E_REVOKED: int +CRYPT_E_NO_REVOCATION_DLL: int +CRYPT_E_NO_REVOCATION_CHECK: int +CRYPT_E_REVOCATION_OFFLINE: int +CRYPT_E_NOT_IN_REVOCATION_DATABASE: int +CRYPT_E_INVALID_NUMERIC_STRING: int +CRYPT_E_INVALID_PRINTABLE_STRING: int +CRYPT_E_INVALID_IA5_STRING: int +CRYPT_E_INVALID_X500_STRING: int +CRYPT_E_NOT_CHAR_STRING: int +CRYPT_E_FILERESIZED: int +CRYPT_E_SECURITY_SETTINGS: int +CRYPT_E_NO_VERIFY_USAGE_DLL: int +CRYPT_E_NO_VERIFY_USAGE_CHECK: int +CRYPT_E_VERIFY_USAGE_OFFLINE: int +CRYPT_E_NOT_IN_CTL: int +CRYPT_E_NO_TRUSTED_SIGNER: int +CRYPT_E_OSS_ERROR: int +CERTSRV_E_BAD_REQUESTSUBJECT: int +CERTSRV_E_NO_REQUEST: int +CERTSRV_E_BAD_REQUESTSTATUS: int +CERTSRV_E_PROPERTY_EMPTY: int +CERTDB_E_JET_ERROR: int +TRUST_E_SYSTEM_ERROR: int +TRUST_E_NO_SIGNER_CERT: int +TRUST_E_COUNTER_SIGNER: int +TRUST_E_CERT_SIGNATURE: int +TRUST_E_TIME_STAMP: int +TRUST_E_BAD_DIGEST: int +TRUST_E_BASIC_CONSTRAINTS: int +TRUST_E_FINANCIAL_CRITERIA: int +NTE_OP_OK: int +DIGSIG_E_ENCODE: int +DIGSIG_E_DECODE: int +DIGSIG_E_EXTENSIBILITY: int +DIGSIG_E_CRYPTO: int +PERSIST_E_SIZEDEFINITE: int +PERSIST_E_SIZEINDEFINITE: int +PERSIST_E_NOTSELFSIZING: int +TRUST_E_NOSIGNATURE: int +CERT_E_EXPIRED: int +CERT_E_VALIDITYPERIODNESTING: int +CERT_E_ROLE: int +CERT_E_PATHLENCONST: int +CERT_E_CRITICAL: int +CERT_E_PURPOSE: int +CERT_E_ISSUERCHAINING: int +CERT_E_MALFORMED: int +CERT_E_UNTRUSTEDROOT: int +CERT_E_CHAINING: int +TRUST_E_FAIL: int +CERT_E_REVOKED: int +CERT_E_UNTRUSTEDTESTROOT: int +CERT_E_REVOCATION_FAILURE: int +CERT_E_CN_NO_MATCH: int +CERT_E_WRONG_USAGE: int +SPAPI_E_EXPECTED_SECTION_NAME: int +SPAPI_E_BAD_SECTION_NAME_LINE: int +SPAPI_E_SECTION_NAME_TOO_LONG: int +SPAPI_E_GENERAL_SYNTAX: int +SPAPI_E_WRONG_INF_STYLE: int +SPAPI_E_SECTION_NOT_FOUND: int +SPAPI_E_LINE_NOT_FOUND: int +SPAPI_E_NO_ASSOCIATED_CLASS: int +SPAPI_E_CLASS_MISMATCH: int +SPAPI_E_DUPLICATE_FOUND: int +SPAPI_E_NO_DRIVER_SELECTED: int +SPAPI_E_KEY_DOES_NOT_EXIST: int +SPAPI_E_INVALID_DEVINST_NAME: int +SPAPI_E_INVALID_CLASS: int +SPAPI_E_DEVINST_ALREADY_EXISTS: int +SPAPI_E_DEVINFO_NOT_REGISTERED: int +SPAPI_E_INVALID_REG_PROPERTY: int +SPAPI_E_NO_INF: int +SPAPI_E_NO_SUCH_DEVINST: int +SPAPI_E_CANT_LOAD_CLASS_ICON: int +SPAPI_E_INVALID_CLASS_INSTALLER: int +SPAPI_E_DI_DO_DEFAULT: int +SPAPI_E_DI_NOFILECOPY: int +SPAPI_E_INVALID_HWPROFILE: int +SPAPI_E_NO_DEVICE_SELECTED: int +SPAPI_E_DEVINFO_LIST_LOCKED: int +SPAPI_E_DEVINFO_DATA_LOCKED: int +SPAPI_E_DI_BAD_PATH: int +SPAPI_E_NO_CLASSINSTALL_PARAMS: int +SPAPI_E_FILEQUEUE_LOCKED: int +SPAPI_E_BAD_SERVICE_INSTALLSECT: int +SPAPI_E_NO_CLASS_DRIVER_LIST: int +SPAPI_E_NO_ASSOCIATED_SERVICE: int +SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE: int +SPAPI_E_DEVICE_INTERFACE_ACTIVE: int +SPAPI_E_DEVICE_INTERFACE_REMOVED: int +SPAPI_E_BAD_INTERFACE_INSTALLSECT: int +SPAPI_E_NO_SUCH_INTERFACE_CLASS: int +SPAPI_E_INVALID_REFERENCE_STRING: int +SPAPI_E_INVALID_MACHINENAME: int +SPAPI_E_REMOTE_COMM_FAILURE: int +SPAPI_E_MACHINE_UNAVAILABLE: int +SPAPI_E_NO_CONFIGMGR_SERVICES: int +SPAPI_E_INVALID_PROPPAGE_PROVIDER: int +SPAPI_E_NO_SUCH_DEVICE_INTERFACE: int +SPAPI_E_DI_POSTPROCESSING_REQUIRED: int +SPAPI_E_INVALID_COINSTALLER: int +SPAPI_E_NO_COMPAT_DRIVERS: int +SPAPI_E_NO_DEVICE_ICON: int +SPAPI_E_INVALID_INF_LOGCONFIG: int +SPAPI_E_DI_DONT_INSTALL: int +SPAPI_E_INVALID_FILTER_DRIVER: int +SPAPI_E_ERROR_NOT_INSTALLED: int +CDERR_DIALOGFAILURE: int +CDERR_GENERALCODES: int +CDERR_STRUCTSIZE: int +CDERR_INITIALIZATION: int +CDERR_NOTEMPLATE: int +CDERR_NOHINSTANCE: int +CDERR_LOADSTRFAILURE: int +CDERR_FINDRESFAILURE: int +CDERR_LOADRESFAILURE: int +CDERR_LOCKRESFAILURE: int +CDERR_MEMALLOCFAILURE: int +CDERR_MEMLOCKFAILURE: int +CDERR_NOHOOK: int +CDERR_REGISTERMSGFAIL: int +PDERR_PRINTERCODES: int +PDERR_SETUPFAILURE: int +PDERR_PARSEFAILURE: int +PDERR_RETDEFFAILURE: int +PDERR_LOADDRVFAILURE: int +PDERR_GETDEVMODEFAIL: int +PDERR_INITFAILURE: int +PDERR_NODEVICES: int +PDERR_NODEFAULTPRN: int +PDERR_DNDMMISMATCH: int +PDERR_CREATEICFAILURE: int +PDERR_PRINTERNOTFOUND: int +PDERR_DEFAULTDIFFERENT: int +CFERR_CHOOSEFONTCODES: int +CFERR_NOFONTS: int +CFERR_MAXLESSTHANMIN: int +FNERR_FILENAMECODES: int +FNERR_SUBCLASSFAILURE: int +FNERR_INVALIDFILENAME: int +FNERR_BUFFERTOOSMALL: int +FRERR_FINDREPLACECODES: int +FRERR_BUFFERLENGTHZERO: int +CCERR_CHOOSECOLORCODES: int diff --git a/stubs/pywin32/win32/lib/winioctlcon.pyi b/stubs/pywin32/win32/lib/winioctlcon.pyi new file mode 100644 index 0000000..49028ce --- /dev/null +++ b/stubs/pywin32/win32/lib/winioctlcon.pyi @@ -0,0 +1,661 @@ +import _win32typing + +def CTL_CODE(DeviceType: int, Function: int, Method: int, Access: int) -> int: ... +def DEVICE_TYPE_FROM_CTL_CODE(ctrlCode: int) -> int: ... + +FILE_DEVICE_BEEP: int +FILE_DEVICE_CD_ROM: int +FILE_DEVICE_CD_ROM_FILE_SYSTEM: int +FILE_DEVICE_CONTROLLER: int +FILE_DEVICE_DATALINK: int +FILE_DEVICE_DFS: int +FILE_DEVICE_DISK: int +FILE_DEVICE_DISK_FILE_SYSTEM: int +FILE_DEVICE_FILE_SYSTEM: int +FILE_DEVICE_INPORT_PORT: int +FILE_DEVICE_KEYBOARD: int +FILE_DEVICE_MAILSLOT: int +FILE_DEVICE_MIDI_IN: int +FILE_DEVICE_MIDI_OUT: int +FILE_DEVICE_MOUSE: int +FILE_DEVICE_MULTI_UNC_PROVIDER: int +FILE_DEVICE_NAMED_PIPE: int +FILE_DEVICE_NETWORK: int +FILE_DEVICE_NETWORK_BROWSER: int +FILE_DEVICE_NETWORK_FILE_SYSTEM: int +FILE_DEVICE_NULL: int +FILE_DEVICE_PARALLEL_PORT: int +FILE_DEVICE_PHYSICAL_NETCARD: int +FILE_DEVICE_PRINTER: int +FILE_DEVICE_SCANNER: int +FILE_DEVICE_SERIAL_MOUSE_PORT: int +FILE_DEVICE_SERIAL_PORT: int +FILE_DEVICE_SCREEN: int +FILE_DEVICE_SOUND: int +FILE_DEVICE_STREAMS: int +FILE_DEVICE_TAPE: int +FILE_DEVICE_TAPE_FILE_SYSTEM: int +FILE_DEVICE_TRANSPORT: int +FILE_DEVICE_UNKNOWN: int +FILE_DEVICE_VIDEO: int +FILE_DEVICE_VIRTUAL_DISK: int +FILE_DEVICE_WAVE_IN: int +FILE_DEVICE_WAVE_OUT: int +FILE_DEVICE_8042_PORT: int +FILE_DEVICE_NETWORK_REDIRECTOR: int +FILE_DEVICE_BATTERY: int +FILE_DEVICE_BUS_EXTENDER: int +FILE_DEVICE_MODEM: int +FILE_DEVICE_VDM: int +FILE_DEVICE_MASS_STORAGE: int +FILE_DEVICE_SMB: int +FILE_DEVICE_KS: int +FILE_DEVICE_CHANGER: int +FILE_DEVICE_SMARTCARD: int +FILE_DEVICE_ACPI: int +FILE_DEVICE_DVD: int +FILE_DEVICE_FULLSCREEN_VIDEO: int +FILE_DEVICE_DFS_FILE_SYSTEM: int +FILE_DEVICE_DFS_VOLUME: int +FILE_DEVICE_SERENUM: int +FILE_DEVICE_TERMSRV: int +FILE_DEVICE_KSEC: int +FILE_DEVICE_FIPS: int +FILE_DEVICE_INFINIBAND: int +METHOD_BUFFERED: int +METHOD_IN_DIRECT: int +METHOD_OUT_DIRECT: int +METHOD_NEITHER: int +METHOD_DIRECT_TO_HARDWARE: int +METHOD_DIRECT_FROM_HARDWARE: int +FILE_ANY_ACCESS: int +FILE_SPECIAL_ACCESS: int +FILE_READ_ACCESS: int +FILE_WRITE_ACCESS: int +IOCTL_STORAGE_BASE: int +RECOVERED_WRITES_VALID: int +UNRECOVERED_WRITES_VALID: int +RECOVERED_READS_VALID: int +UNRECOVERED_READS_VALID: int +WRITE_COMPRESSION_INFO_VALID: int +READ_COMPRESSION_INFO_VALID: int +TAPE_RETURN_STATISTICS: int +TAPE_RETURN_ENV_INFO: int +TAPE_RESET_STATISTICS: int +MEDIA_ERASEABLE: int +MEDIA_WRITE_ONCE: int +MEDIA_READ_ONLY: int +MEDIA_READ_WRITE: int +MEDIA_WRITE_PROTECTED: int +MEDIA_CURRENTLY_MOUNTED: int +IOCTL_DISK_BASE: int +PARTITION_ENTRY_UNUSED: int +PARTITION_FAT_12: int +PARTITION_XENIX_1: int +PARTITION_XENIX_2: int +PARTITION_FAT_16: int +PARTITION_EXTENDED: int +PARTITION_HUGE: int +PARTITION_IFS: int +PARTITION_OS2BOOTMGR: int +PARTITION_FAT32: int +PARTITION_FAT32_XINT13: int +PARTITION_XINT13: int +PARTITION_XINT13_EXTENDED: int +PARTITION_PREP: int +PARTITION_LDM: int +PARTITION_UNIX: int +VALID_NTFT: int +PARTITION_NTFT: int +GPT_ATTRIBUTE_PLATFORM_REQUIRED: int +GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER: int +GPT_BASIC_DATA_ATTRIBUTE_HIDDEN: int +GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY: int +GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY: int +HIST_NO_OF_BUCKETS: int +DISK_LOGGING_START: int +DISK_LOGGING_STOP: int +DISK_LOGGING_DUMP: int +DISK_BINNING: int +CAP_ATA_ID_CMD: int +CAP_ATAPI_ID_CMD: int +CAP_SMART_CMD: int +ATAPI_ID_CMD: int +ID_CMD: int +SMART_CMD: int +SMART_CYL_LOW: int +SMART_CYL_HI: int +SMART_NO_ERROR: int +SMART_IDE_ERROR: int +SMART_INVALID_FLAG: int +SMART_INVALID_COMMAND: int +SMART_INVALID_BUFFER: int +SMART_INVALID_DRIVE: int +SMART_INVALID_IOCTL: int +SMART_ERROR_NO_MEM: int +SMART_INVALID_REGISTER: int +SMART_NOT_SUPPORTED: int +SMART_NO_IDE_DEVICE: int +SMART_OFFLINE_ROUTINE_OFFLINE: int +SMART_SHORT_SELFTEST_OFFLINE: int +SMART_EXTENDED_SELFTEST_OFFLINE: int +SMART_ABORT_OFFLINE_SELFTEST: int +SMART_SHORT_SELFTEST_CAPTIVE: int +SMART_EXTENDED_SELFTEST_CAPTIVE: int +READ_ATTRIBUTE_BUFFER_SIZE: int +IDENTIFY_BUFFER_SIZE: int +READ_THRESHOLD_BUFFER_SIZE: int +SMART_LOG_SECTOR_SIZE: int +READ_ATTRIBUTES: int +READ_THRESHOLDS: int +ENABLE_DISABLE_AUTOSAVE: int +SAVE_ATTRIBUTE_VALUES: int +EXECUTE_OFFLINE_DIAGS: int +SMART_READ_LOG: int +SMART_WRITE_LOG: int +ENABLE_SMART: int +DISABLE_SMART: int +RETURN_SMART_STATUS: int +ENABLE_DISABLE_AUTO_OFFLINE: int +IOCTL_CHANGER_BASE: int +MAX_VOLUME_ID_SIZE: int +MAX_VOLUME_TEMPLATE_SIZE: int +VENDOR_ID_LENGTH: int +PRODUCT_ID_LENGTH: int +REVISION_LENGTH: int +SERIAL_NUMBER_LENGTH: int +CHANGER_BAR_CODE_SCANNER_INSTALLED: int +CHANGER_INIT_ELEM_STAT_WITH_RANGE: int +CHANGER_CLOSE_IEPORT: int +CHANGER_OPEN_IEPORT: int +CHANGER_STATUS_NON_VOLATILE: int +CHANGER_EXCHANGE_MEDIA: int +CHANGER_CLEANER_SLOT: int +CHANGER_LOCK_UNLOCK: int +CHANGER_CARTRIDGE_MAGAZINE: int +CHANGER_MEDIUM_FLIP: int +CHANGER_POSITION_TO_ELEMENT: int +CHANGER_REPORT_IEPORT_STATE: int +CHANGER_STORAGE_DRIVE: int +CHANGER_STORAGE_IEPORT: int +CHANGER_STORAGE_SLOT: int +CHANGER_STORAGE_TRANSPORT: int +CHANGER_DRIVE_CLEANING_REQUIRED: int +CHANGER_PREDISMOUNT_EJECT_REQUIRED: int +CHANGER_CLEANER_ACCESS_NOT_VALID: int +CHANGER_PREMOUNT_EJECT_REQUIRED: int +CHANGER_VOLUME_IDENTIFICATION: int +CHANGER_VOLUME_SEARCH: int +CHANGER_VOLUME_ASSERT: int +CHANGER_VOLUME_REPLACE: int +CHANGER_VOLUME_UNDEFINE: int +CHANGER_SERIAL_NUMBER_VALID: int +CHANGER_DEVICE_REINITIALIZE_CAPABLE: int +CHANGER_KEYPAD_ENABLE_DISABLE: int +CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS: int +CHANGER_RESERVED_BIT: int +CHANGER_PREDISMOUNT_ALIGN_TO_SLOT: int +CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE: int +CHANGER_CLEANER_AUTODISMOUNT: int +CHANGER_TRUE_EXCHANGE_CAPABLE: int +CHANGER_SLOTS_USE_TRAYS: int +CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR: int +CHANGER_CLEANER_OPS_NOT_SUPPORTED: int +CHANGER_IEPORT_USER_CONTROL_OPEN: int +CHANGER_IEPORT_USER_CONTROL_CLOSE: int +CHANGER_MOVE_EXTENDS_IEPORT: int +CHANGER_MOVE_RETRACTS_IEPORT: int +CHANGER_TO_TRANSPORT: int +CHANGER_TO_SLOT: int +CHANGER_TO_IEPORT: int +CHANGER_TO_DRIVE: int +LOCK_UNLOCK_IEPORT: int +LOCK_UNLOCK_DOOR: int +LOCK_UNLOCK_KEYPAD: int +LOCK_ELEMENT: int +UNLOCK_ELEMENT: int +EXTEND_IEPORT: int +RETRACT_IEPORT: int +ELEMENT_STATUS_FULL: int +ELEMENT_STATUS_IMPEXP: int +ELEMENT_STATUS_EXCEPT: int +ELEMENT_STATUS_ACCESS: int +ELEMENT_STATUS_EXENAB: int +ELEMENT_STATUS_INENAB: int +ELEMENT_STATUS_PRODUCT_DATA: int +ELEMENT_STATUS_LUN_VALID: int +ELEMENT_STATUS_ID_VALID: int +ELEMENT_STATUS_NOT_BUS: int +ELEMENT_STATUS_INVERT: int +ELEMENT_STATUS_SVALID: int +ELEMENT_STATUS_PVOLTAG: int +ELEMENT_STATUS_AVOLTAG: int +ERROR_LABEL_UNREADABLE: int +ERROR_LABEL_QUESTIONABLE: int +ERROR_SLOT_NOT_PRESENT: int +ERROR_DRIVE_NOT_INSTALLED: int +ERROR_TRAY_MALFUNCTION: int +ERROR_INIT_STATUS_NEEDED: int +ERROR_UNHANDLED_ERROR: int +SEARCH_ALL: int +SEARCH_PRIMARY: int +SEARCH_ALTERNATE: int +SEARCH_ALL_NO_SEQ: int +SEARCH_PRI_NO_SEQ: int +SEARCH_ALT_NO_SEQ: int +ASSERT_PRIMARY: int +ASSERT_ALTERNATE: int +REPLACE_PRIMARY: int +REPLACE_ALTERNATE: int +UNDEFINE_PRIMARY: int +UNDEFINE_ALTERNATE: int +USN_PAGE_SIZE: int +USN_REASON_DATA_OVERWRITE: int +USN_REASON_DATA_EXTEND: int +USN_REASON_DATA_TRUNCATION: int +USN_REASON_NAMED_DATA_OVERWRITE: int +USN_REASON_NAMED_DATA_EXTEND: int +USN_REASON_NAMED_DATA_TRUNCATION: int +USN_REASON_FILE_CREATE: int +USN_REASON_FILE_DELETE: int +USN_REASON_EA_CHANGE: int +USN_REASON_SECURITY_CHANGE: int +USN_REASON_RENAME_OLD_NAME: int +USN_REASON_RENAME_NEW_NAME: int +USN_REASON_INDEXABLE_CHANGE: int +USN_REASON_BASIC_INFO_CHANGE: int +USN_REASON_HARD_LINK_CHANGE: int +USN_REASON_COMPRESSION_CHANGE: int +USN_REASON_ENCRYPTION_CHANGE: int +USN_REASON_OBJECT_ID_CHANGE: int +USN_REASON_REPARSE_POINT_CHANGE: int +USN_REASON_STREAM_CHANGE: int +USN_REASON_TRANSACTED_CHANGE: int +USN_REASON_CLOSE: int +USN_DELETE_FLAG_DELETE: int +USN_DELETE_FLAG_NOTIFY: int +USN_DELETE_VALID_FLAGS: int +USN_SOURCE_DATA_MANAGEMENT: int +USN_SOURCE_AUXILIARY_DATA: int +USN_SOURCE_REPLICATION_MANAGEMENT: int +MARK_HANDLE_PROTECT_CLUSTERS: int +MARK_HANDLE_TXF_SYSTEM_LOG: int +MARK_HANDLE_NOT_TXF_SYSTEM_LOG: int +VOLUME_IS_DIRTY: int +VOLUME_UPGRADE_SCHEDULED: int +VOLUME_SESSION_OPEN: int +FILE_PREFETCH_TYPE_FOR_CREATE: int +FILE_PREFETCH_TYPE_FOR_DIRENUM: int +FILE_PREFETCH_TYPE_FOR_CREATE_EX: int +FILE_PREFETCH_TYPE_FOR_DIRENUM_EX: int +FILE_PREFETCH_TYPE_MAX: int +FILESYSTEM_STATISTICS_TYPE_NTFS: int +FILESYSTEM_STATISTICS_TYPE_FAT: int +FILE_SET_ENCRYPTION: int +FILE_CLEAR_ENCRYPTION: int +STREAM_SET_ENCRYPTION: int +STREAM_CLEAR_ENCRYPTION: int +MAXIMUM_ENCRYPTION_VALUE: int +ENCRYPTION_FORMAT_DEFAULT: int +COMPRESSION_FORMAT_SPARSE: int +COPYFILE_SIS_LINK: int +COPYFILE_SIS_REPLACE: int +COPYFILE_SIS_FLAGS: int +WMI_DISK_GEOMETRY_GUID: _win32typing.PyIID +GUID_DEVINTERFACE_CDROM: _win32typing.PyIID +GUID_DEVINTERFACE_FLOPPY: _win32typing.PyIID +GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR: _win32typing.PyIID +GUID_DEVINTERFACE_COMPORT: _win32typing.PyIID +GUID_DEVINTERFACE_DISK: _win32typing.PyIID +GUID_DEVINTERFACE_STORAGEPORT: _win32typing.PyIID +GUID_DEVINTERFACE_CDCHANGER: _win32typing.PyIID +GUID_DEVINTERFACE_PARTITION: _win32typing.PyIID +GUID_DEVINTERFACE_VOLUME: _win32typing.PyIID +GUID_DEVINTERFACE_WRITEONCEDISK: _win32typing.PyIID +GUID_DEVINTERFACE_TAPE: _win32typing.PyIID +GUID_DEVINTERFACE_MEDIUMCHANGER: _win32typing.PyIID +GUID_SERENUM_BUS_ENUMERATOR: int +GUID_CLASS_COMPORT: int +DiskClassGuid: int +CdRomClassGuid: int +PartitionClassGuid: int +TapeClassGuid: int +WriteOnceDiskClassGuid: int +VolumeClassGuid: int +MediumChangerClassGuid: int +FloppyClassGuid: int +CdChangerClassGuid: int +StoragePortClassGuid: int +IOCTL_STORAGE_CHECK_VERIFY: int +IOCTL_STORAGE_CHECK_VERIFY2: int +IOCTL_STORAGE_MEDIA_REMOVAL: int +IOCTL_STORAGE_EJECT_MEDIA: int +IOCTL_STORAGE_LOAD_MEDIA: int +IOCTL_STORAGE_LOAD_MEDIA2: int +IOCTL_STORAGE_RESERVE: int +IOCTL_STORAGE_RELEASE: int +IOCTL_STORAGE_FIND_NEW_DEVICES: int +IOCTL_STORAGE_EJECTION_CONTROL: int +IOCTL_STORAGE_MCN_CONTROL: int +IOCTL_STORAGE_GET_MEDIA_TYPES: int +IOCTL_STORAGE_GET_MEDIA_TYPES_EX: int +IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER: int +IOCTL_STORAGE_GET_HOTPLUG_INFO: int +IOCTL_STORAGE_SET_HOTPLUG_INFO: int +IOCTL_STORAGE_RESET_BUS: int +IOCTL_STORAGE_RESET_DEVICE: int +IOCTL_STORAGE_BREAK_RESERVATION: int +IOCTL_STORAGE_GET_DEVICE_NUMBER: int +IOCTL_STORAGE_PREDICT_FAILURE: int +IOCTL_DISK_GET_DRIVE_GEOMETRY: int +IOCTL_DISK_GET_PARTITION_INFO: int +IOCTL_DISK_SET_PARTITION_INFO: int +IOCTL_DISK_GET_DRIVE_LAYOUT: int +IOCTL_DISK_SET_DRIVE_LAYOUT: int +IOCTL_DISK_VERIFY: int +IOCTL_DISK_FORMAT_TRACKS: int +IOCTL_DISK_REASSIGN_BLOCKS: int +IOCTL_DISK_PERFORMANCE: int +IOCTL_DISK_IS_WRITABLE: int +IOCTL_DISK_LOGGING: int +IOCTL_DISK_FORMAT_TRACKS_EX: int +IOCTL_DISK_HISTOGRAM_STRUCTURE: int +IOCTL_DISK_HISTOGRAM_DATA: int +IOCTL_DISK_HISTOGRAM_RESET: int +IOCTL_DISK_REQUEST_STRUCTURE: int +IOCTL_DISK_REQUEST_DATA: int +IOCTL_DISK_PERFORMANCE_OFF: int +IOCTL_DISK_CONTROLLER_NUMBER: int +SMART_GET_VERSION: int +SMART_SEND_DRIVE_COMMAND: int +SMART_RCV_DRIVE_DATA: int +IOCTL_DISK_GET_PARTITION_INFO_EX: int +IOCTL_DISK_SET_PARTITION_INFO_EX: int +IOCTL_DISK_GET_DRIVE_LAYOUT_EX: int +IOCTL_DISK_SET_DRIVE_LAYOUT_EX: int +IOCTL_DISK_CREATE_DISK: int +IOCTL_DISK_GET_LENGTH_INFO: int +IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: int +IOCTL_DISK_REASSIGN_BLOCKS_EX: int +IOCTL_DISK_UPDATE_DRIVE_SIZE: int +IOCTL_DISK_GROW_PARTITION: int +IOCTL_DISK_GET_CACHE_INFORMATION: int +IOCTL_DISK_SET_CACHE_INFORMATION: int +OBSOLETE_IOCTL_STORAGE_RESET_BUS: int +OBSOLETE_IOCTL_STORAGE_RESET_DEVICE: int +OBSOLETE_DISK_GET_WRITE_CACHE_STATE: int +IOCTL_DISK_GET_WRITE_CACHE_STATE: int +IOCTL_DISK_DELETE_DRIVE_LAYOUT: int +IOCTL_DISK_UPDATE_PROPERTIES: int +IOCTL_DISK_FORMAT_DRIVE: int +IOCTL_DISK_SENSE_DEVICE: int +IOCTL_DISK_CHECK_VERIFY: int +IOCTL_DISK_MEDIA_REMOVAL: int +IOCTL_DISK_EJECT_MEDIA: int +IOCTL_DISK_LOAD_MEDIA: int +IOCTL_DISK_RESERVE: int +IOCTL_DISK_RELEASE: int +IOCTL_DISK_FIND_NEW_DEVICES: int +IOCTL_DISK_GET_MEDIA_TYPES: int +DISK_HISTOGRAM_SIZE: int +HISTOGRAM_BUCKET_SIZE: int +IOCTL_CHANGER_GET_PARAMETERS: int +IOCTL_CHANGER_GET_STATUS: int +IOCTL_CHANGER_GET_PRODUCT_DATA: int +IOCTL_CHANGER_SET_ACCESS: int +IOCTL_CHANGER_GET_ELEMENT_STATUS: int +IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS: int +IOCTL_CHANGER_SET_POSITION: int +IOCTL_CHANGER_EXCHANGE_MEDIUM: int +IOCTL_CHANGER_MOVE_MEDIUM: int +IOCTL_CHANGER_REINITIALIZE_TRANSPORT: int +IOCTL_CHANGER_QUERY_VOLUME_TAGS: int +IOCTL_SERIAL_LSRMST_INSERT: int +IOCTL_SERENUM_EXPOSE_HARDWARE: int +IOCTL_SERENUM_REMOVE_HARDWARE: int +IOCTL_SERENUM_PORT_DESC: int +IOCTL_SERENUM_GET_PORT_NAME: int +SERIAL_LSRMST_ESCAPE: int +SERIAL_LSRMST_LSR_DATA: int +SERIAL_LSRMST_LSR_NODATA: int +SERIAL_LSRMST_MST: int +SERIAL_IOC_FCR_FIFO_ENABLE: int +SERIAL_IOC_FCR_RCVR_RESET: int +SERIAL_IOC_FCR_XMIT_RESET: int +SERIAL_IOC_FCR_DMA_MODE: int +SERIAL_IOC_FCR_RES1: int +SERIAL_IOC_FCR_RES2: int +SERIAL_IOC_FCR_RCVR_TRIGGER_LSB: int +SERIAL_IOC_FCR_RCVR_TRIGGER_MSB: int +SERIAL_IOC_MCR_DTR: int +SERIAL_IOC_MCR_RTS: int +SERIAL_IOC_MCR_OUT1: int +SERIAL_IOC_MCR_OUT2: int +SERIAL_IOC_MCR_LOOP: int +FSCTL_REQUEST_OPLOCK_LEVEL_1: int +FSCTL_REQUEST_OPLOCK_LEVEL_2: int +FSCTL_REQUEST_BATCH_OPLOCK: int +FSCTL_OPLOCK_BREAK_ACKNOWLEDGE: int +FSCTL_OPBATCH_ACK_CLOSE_PENDING: int +FSCTL_OPLOCK_BREAK_NOTIFY: int +FSCTL_LOCK_VOLUME: int +FSCTL_UNLOCK_VOLUME: int +FSCTL_DISMOUNT_VOLUME: int +FSCTL_IS_VOLUME_MOUNTED: int +FSCTL_IS_PATHNAME_VALID: int +FSCTL_MARK_VOLUME_DIRTY: int +FSCTL_QUERY_RETRIEVAL_POINTERS: int +FSCTL_GET_COMPRESSION: int +FSCTL_SET_COMPRESSION: int +FSCTL_MARK_AS_SYSTEM_HIVE: int +FSCTL_OPLOCK_BREAK_ACK_NO_2: int +FSCTL_INVALIDATE_VOLUMES: int +FSCTL_QUERY_FAT_BPB: int +FSCTL_REQUEST_FILTER_OPLOCK: int +FSCTL_FILESYSTEM_GET_STATISTICS: int +FSCTL_GET_NTFS_VOLUME_DATA: int +FSCTL_GET_NTFS_FILE_RECORD: int +FSCTL_GET_VOLUME_BITMAP: int +FSCTL_GET_RETRIEVAL_POINTERS: int +FSCTL_MOVE_FILE: int +FSCTL_IS_VOLUME_DIRTY: int +FSCTL_ALLOW_EXTENDED_DASD_IO: int +FSCTL_FIND_FILES_BY_SID: int +FSCTL_SET_OBJECT_ID: int +FSCTL_GET_OBJECT_ID: int +FSCTL_DELETE_OBJECT_ID: int +FSCTL_SET_REPARSE_POINT: int +FSCTL_GET_REPARSE_POINT: int +FSCTL_DELETE_REPARSE_POINT: int +FSCTL_ENUM_USN_DATA: int +FSCTL_SECURITY_ID_CHECK: int +FSCTL_READ_USN_JOURNAL: int +FSCTL_SET_OBJECT_ID_EXTENDED: int +FSCTL_CREATE_OR_GET_OBJECT_ID: int +FSCTL_SET_SPARSE: int +FSCTL_SET_ZERO_DATA: int +FSCTL_QUERY_ALLOCATED_RANGES: int +FSCTL_SET_ENCRYPTION: int +FSCTL_ENCRYPTION_FSCTL_IO: int +FSCTL_WRITE_RAW_ENCRYPTED: int +FSCTL_READ_RAW_ENCRYPTED: int +FSCTL_CREATE_USN_JOURNAL: int +FSCTL_READ_FILE_USN_DATA: int +FSCTL_WRITE_USN_CLOSE_RECORD: int +FSCTL_EXTEND_VOLUME: int +FSCTL_QUERY_USN_JOURNAL: int +FSCTL_DELETE_USN_JOURNAL: int +FSCTL_MARK_HANDLE: int +FSCTL_SIS_COPYFILE: int +FSCTL_SIS_LINK_FILES: int +FSCTL_HSM_MSG: int +FSCTL_HSM_DATA: int +FSCTL_RECALL_FILE: int +FSCTL_READ_FROM_PLEX: int +FSCTL_FILE_PREFETCH: int +FSCTL_MAKE_MEDIA_COMPATIBLE: int +FSCTL_SET_DEFECT_MANAGEMENT: int +FSCTL_QUERY_SPARING_INFO: int +FSCTL_QUERY_ON_DISK_VOLUME_INFO: int +FSCTL_SET_VOLUME_COMPRESSION_STATE: int +FSCTL_TXFS_MODIFY_RM: int +FSCTL_TXFS_QUERY_RM_INFORMATION: int +FSCTL_TXFS_ROLLFORWARD_REDO: int +FSCTL_TXFS_ROLLFORWARD_UNDO: int +FSCTL_TXFS_START_RM: int +FSCTL_TXFS_SHUTDOWN_RM: int +FSCTL_TXFS_READ_BACKUP_INFORMATION: int +FSCTL_TXFS_WRITE_BACKUP_INFORMATION: int +FSCTL_TXFS_CREATE_SECONDARY_RM: int +FSCTL_TXFS_GET_METADATA_INFO: int +FSCTL_TXFS_GET_TRANSACTED_VERSION: int +FSCTL_TXFS_CREATE_MINIVERSION: int +FSCTL_TXFS_TRANSACTION_ACTIVE: int +FSCTL_SET_ZERO_ON_DEALLOCATION: int +FSCTL_SET_REPAIR: int +FSCTL_GET_REPAIR: int +FSCTL_WAIT_FOR_REPAIR: int +FSCTL_INITIATE_REPAIR: int +FSCTL_CSC_INTERNAL: int +FSCTL_SHRINK_VOLUME: int +FSCTL_SET_SHORT_NAME_BEHAVIOR: int +FSCTL_DFSR_SET_GHOST_HANDLE_STATE: int +FSCTL_QUERY_PAGEFILE_ENCRYPTION: int +IOCTL_VOLUME_BASE: int +IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: int +IOCTL_VOLUME_ONLINE: int +IOCTL_VOLUME_OFFLINE: int +IOCTL_VOLUME_IS_CLUSTERED: int +IOCTL_VOLUME_GET_GPT_ATTRIBUTES: int +DDS_4mm: int +MiniQic: int +Travan: int +QIC: int +MP_8mm: int +AME_8mm: int +AIT1_8mm: int +DLT: int +NCTP: int +IBM_3480: int +IBM_3490E: int +IBM_Magstar_3590: int +IBM_Magstar_MP: int +STK_DATA_D3: int +SONY_DTF: int +DV_6mm: int +DMI: int +SONY_D2: int +CLEANER_CARTRIDGE: int +CD_ROM: int +CD_R: int +CD_RW: int +DVD_ROM: int +DVD_R: int +DVD_RW: int +MO_3_RW: int +MO_5_WO: int +MO_5_RW: int +MO_5_LIMDOW: int +PC_5_WO: int +PC_5_RW: int +PD_5_RW: int +ABL_5_WO: int +PINNACLE_APEX_5_RW: int +SONY_12_WO: int +PHILIPS_12_WO: int +HITACHI_12_WO: int +CYGNET_12_WO: int +KODAK_14_WO: int +MO_NFR_525: int +NIKON_12_RW: int +IOMEGA_ZIP: int +IOMEGA_JAZ: int +SYQUEST_EZ135: int +SYQUEST_EZFLYER: int +SYQUEST_SYJET: int +AVATAR_F2: int +MP2_8mm: int +DST_S: int +DST_M: int +DST_L: int +VXATape_1: int +VXATape_2: int +STK_9840: int +LTO_Ultrium: int +LTO_Accelis: int +DVD_RAM: int +AIT_8mm: int +ADR_1: int +ADR_2: int +STK_9940: int +BusTypeUnknown: int +BusTypeScsi: int +BusTypeAtapi: int +BusTypeAta: int +BusType1394: int +BusTypeSsa: int +BusTypeFibre: int +BusTypeUsb: int +BusTypeRAID: int +BusTypeiScsi: int +BusTypeSas: int +BusTypeSata: int +BusTypeMaxReserved: int +Unknown: int +F5_1Pt2_512: int +F3_1Pt44_512: int +F3_2Pt88_512: int +F3_20Pt8_512: int +F3_720_512: int +F5_360_512: int +F5_320_512: int +F5_320_1024: int +F5_180_512: int +F5_160_512: int +RemovableMedia: int +FixedMedia: int +F3_120M_512: int +F3_640_512: int +F5_640_512: int +F5_720_512: int +F3_1Pt2_512: int +F3_1Pt23_1024: int +F5_1Pt23_1024: int +F3_128Mb_512: int +F3_230Mb_512: int +F8_256_128: int +F3_200Mb_512: int +F3_240M_512: int +F3_32M_512: int +PARTITION_STYLE_MBR: int +PARTITION_STYLE_GPT: int +PARTITION_STYLE_RAW: int +DetectNone: int +DetectInt13: int +DetectExInt13: int +EqualPriority: int +KeepPrefetchedData: int +KeepReadData: int +DiskWriteCacheNormal: int +DiskWriteCacheForceDisable: int +DiskWriteCacheDisableNotSupported: int +RequestSize: int +RequestLocation: int +DeviceProblemNone: int +DeviceProblemHardware: int +DeviceProblemCHMError: int +DeviceProblemDoorOpen: int +DeviceProblemCalibrationError: int +DeviceProblemTargetFailure: int +DeviceProblemCHMMoveError: int +DeviceProblemCHMZeroError: int +DeviceProblemCartridgeInsertError: int +DeviceProblemPositionError: int +DeviceProblemSensorError: int +DeviceProblemCartridgeEjectError: int +DeviceProblemGripperError: int +DeviceProblemDriveError: int +FILE_READ_DATA: int +FILE_WRITE_DATA: int +FSCTL_TXFS_LIST_TRANSACTIONS: int +FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES: int diff --git a/stubs/pywin32/win32/lib/winnt.pyi b/stubs/pywin32/win32/lib/winnt.pyi new file mode 100644 index 0000000..9c49122 --- /dev/null +++ b/stubs/pywin32/win32/lib/winnt.pyi @@ -0,0 +1,1137 @@ +from _typeshed import Incomplete + +APPLICATION_ERROR_MASK: int +ERROR_SEVERITY_SUCCESS: int +ERROR_SEVERITY_INFORMATIONAL: int +ERROR_SEVERITY_WARNING: int +ERROR_SEVERITY_ERROR: int +MINCHAR: int +MAXCHAR: int +MINSHORT: int +MAXSHORT: int +MINLONG: int +MAXLONG: int +MAXBYTE: int +MAXWORD: int +MAXDWORD: int +LANG_NEUTRAL: int +LANG_AFRIKAANS: int +LANG_ALBANIAN: int +LANG_ARABIC: int +LANG_BASQUE: int +LANG_BELARUSIAN: int +LANG_BULGARIAN: int +LANG_CATALAN: int +LANG_CHINESE: int +LANG_CROATIAN: int +LANG_CZECH: int +LANG_DANISH: int +LANG_DUTCH: int +LANG_ENGLISH: int +LANG_ESTONIAN: int +LANG_FAEROESE: int +LANG_FARSI: int +LANG_FINNISH: int +LANG_FRENCH: int +LANG_GERMAN: int +LANG_GREEK: int +LANG_HEBREW: int +LANG_HINDI: int +LANG_HUNGARIAN: int +LANG_ICELANDIC: int +LANG_INDONESIAN: int +LANG_ITALIAN: int +LANG_JAPANESE: int +LANG_KOREAN: int +LANG_LATVIAN: int +LANG_LITHUANIAN: int +LANG_MACEDONIAN: int +LANG_MALAY: int +LANG_NORWEGIAN: int +LANG_POLISH: int +LANG_PORTUGUESE: int +LANG_ROMANIAN: int +LANG_RUSSIAN: int +LANG_SERBIAN: int +LANG_SLOVAK: int +LANG_SLOVENIAN: int +LANG_SPANISH: int +LANG_SWAHILI: int +LANG_SWEDISH: int +LANG_THAI: int +LANG_TURKISH: int +LANG_UKRAINIAN: int +LANG_VIETNAMESE: int +SUBLANG_NEUTRAL: int +SUBLANG_DEFAULT: int +SUBLANG_SYS_DEFAULT: int +SUBLANG_ARABIC_SAUDI_ARABIA: int +SUBLANG_ARABIC_IRAQ: int +SUBLANG_ARABIC_EGYPT: int +SUBLANG_ARABIC_LIBYA: int +SUBLANG_ARABIC_ALGERIA: int +SUBLANG_ARABIC_MOROCCO: int +SUBLANG_ARABIC_TUNISIA: int +SUBLANG_ARABIC_OMAN: int +SUBLANG_ARABIC_YEMEN: int +SUBLANG_ARABIC_SYRIA: int +SUBLANG_ARABIC_JORDAN: int +SUBLANG_ARABIC_LEBANON: int +SUBLANG_ARABIC_KUWAIT: int +SUBLANG_ARABIC_UAE: int +SUBLANG_ARABIC_BAHRAIN: int +SUBLANG_ARABIC_QATAR: int +SUBLANG_CHINESE_TRADITIONAL: int +SUBLANG_CHINESE_SIMPLIFIED: int +SUBLANG_CHINESE_HONGKONG: int +SUBLANG_CHINESE_SINGAPORE: int +SUBLANG_CHINESE_MACAU: int +SUBLANG_DUTCH: int +SUBLANG_DUTCH_BELGIAN: int +SUBLANG_ENGLISH_US: int +SUBLANG_ENGLISH_UK: int +SUBLANG_ENGLISH_AUS: int +SUBLANG_ENGLISH_CAN: int +SUBLANG_ENGLISH_NZ: int +SUBLANG_ENGLISH_EIRE: int +SUBLANG_ENGLISH_SOUTH_AFRICA: int +SUBLANG_ENGLISH_JAMAICA: int +SUBLANG_ENGLISH_CARIBBEAN: int +SUBLANG_ENGLISH_BELIZE: int +SUBLANG_ENGLISH_TRINIDAD: int +SUBLANG_ENGLISH_ZIMBABWE: int +SUBLANG_ENGLISH_PHILIPPINES: int +SUBLANG_FRENCH: int +SUBLANG_FRENCH_BELGIAN: int +SUBLANG_FRENCH_CANADIAN: int +SUBLANG_FRENCH_SWISS: int +SUBLANG_FRENCH_LUXEMBOURG: int +SUBLANG_FRENCH_MONACO: int +SUBLANG_GERMAN: int +SUBLANG_GERMAN_SWISS: int +SUBLANG_GERMAN_AUSTRIAN: int +SUBLANG_GERMAN_LUXEMBOURG: int +SUBLANG_GERMAN_LIECHTENSTEIN: int +SUBLANG_ITALIAN: int +SUBLANG_ITALIAN_SWISS: int +SUBLANG_KOREAN: int +SUBLANG_KOREAN_JOHAB: int +SUBLANG_LITHUANIAN: int +SUBLANG_LITHUANIAN_CLASSIC: int +SUBLANG_MALAY_MALAYSIA: int +SUBLANG_MALAY_BRUNEI_DARUSSALAM: int +SUBLANG_NORWEGIAN_BOKMAL: int +SUBLANG_NORWEGIAN_NYNORSK: int +SUBLANG_PORTUGUESE: int +SUBLANG_PORTUGUESE_BRAZILIAN: int +SUBLANG_SERBIAN_LATIN: int +SUBLANG_SERBIAN_CYRILLIC: int +SUBLANG_SPANISH: int +SUBLANG_SPANISH_MEXICAN: int +SUBLANG_SPANISH_MODERN: int +SUBLANG_SPANISH_GUATEMALA: int +SUBLANG_SPANISH_COSTA_RICA: int +SUBLANG_SPANISH_PANAMA: int +SUBLANG_SPANISH_DOMINICAN_REPUBLIC: int +SUBLANG_SPANISH_VENEZUELA: int +SUBLANG_SPANISH_COLOMBIA: int +SUBLANG_SPANISH_PERU: int +SUBLANG_SPANISH_ARGENTINA: int +SUBLANG_SPANISH_ECUADOR: int +SUBLANG_SPANISH_CHILE: int +SUBLANG_SPANISH_URUGUAY: int +SUBLANG_SPANISH_PARAGUAY: int +SUBLANG_SPANISH_BOLIVIA: int +SUBLANG_SPANISH_EL_SALVADOR: int +SUBLANG_SPANISH_HONDURAS: int +SUBLANG_SPANISH_NICARAGUA: int +SUBLANG_SPANISH_PUERTO_RICO: int +SUBLANG_SWEDISH: int +SUBLANG_SWEDISH_FINLAND: int +SORT_DEFAULT: int +SORT_JAPANESE_XJIS: int +SORT_JAPANESE_UNICODE: int +SORT_CHINESE_BIG5: int +SORT_CHINESE_PRCP: int +SORT_CHINESE_UNICODE: int +SORT_CHINESE_PRC: int +SORT_KOREAN_KSC: int +SORT_KOREAN_UNICODE: int +SORT_GERMAN_PHONE_BOOK: int + +def PRIMARYLANGID(lgid): ... +def SUBLANGID(lgid): ... + +NLS_VALID_LOCALE_MASK: int + +def LANGIDFROMLCID(lcid): ... +def SORTIDFROMLCID(lcid): ... +def UNREFERENCED_PARAMETER(P): ... +def DBG_UNREFERENCED_PARAMETER(P): ... +def DBG_UNREFERENCED_LOCAL_VARIABLE(V): ... + +MAXIMUM_WAIT_OBJECTS: int +MAXIMUM_SUSPEND_COUNT: int +EXCEPTION_NONCONTINUABLE: int +EXCEPTION_MAXIMUM_PARAMETERS: int +PROCESS_TERMINATE: int +PROCESS_CREATE_THREAD: int +PROCESS_VM_OPERATION: int +PROCESS_VM_READ: int +PROCESS_VM_WRITE: int +PROCESS_DUP_HANDLE: int +PROCESS_CREATE_PROCESS: int +PROCESS_SET_QUOTA: int +PROCESS_SET_INFORMATION: int +PROCESS_QUERY_INFORMATION: int +PROCESS_SUSPEND_RESUME: int +PROCESS_QUERY_LIMITED_INFORMATION: int +PROCESS_SET_LIMITED_INFORMATION: int +MAXIMUM_PROCESSORS: int +THREAD_TERMINATE: int +THREAD_SUSPEND_RESUME: int +THREAD_GET_CONTEXT: int +THREAD_SET_CONTEXT: int +THREAD_SET_INFORMATION: int +THREAD_QUERY_INFORMATION: int +THREAD_SET_THREAD_TOKEN: int +THREAD_IMPERSONATE: int +THREAD_DIRECT_IMPERSONATION: int +THREAD_SET_LIMITED_INFORMATION: int +THREAD_QUERY_LIMITED_INFORMATION: int +THREAD_RESUME: int +JOB_OBJECT_ASSIGN_PROCESS: int +JOB_OBJECT_SET_ATTRIBUTES: int +JOB_OBJECT_QUERY: int +JOB_OBJECT_TERMINATE: int +TLS_MINIMUM_AVAILABLE: int +THREAD_BASE_PRIORITY_LOWRT: int +THREAD_BASE_PRIORITY_MAX: int +THREAD_BASE_PRIORITY_MIN: int +THREAD_BASE_PRIORITY_IDLE: int +JOB_OBJECT_LIMIT_WORKINGSET: int +JOB_OBJECT_LIMIT_PROCESS_TIME: int +JOB_OBJECT_LIMIT_JOB_TIME: int +JOB_OBJECT_LIMIT_ACTIVE_PROCESS: int +JOB_OBJECT_LIMIT_AFFINITY: int +JOB_OBJECT_LIMIT_PRIORITY_CLASS: int +JOB_OBJECT_LIMIT_VALID_FLAGS: int +EVENT_MODIFY_STATE: int +MUTANT_QUERY_STATE: int +SEMAPHORE_MODIFY_STATE: int +TIME_ZONE_ID_UNKNOWN: int +TIME_ZONE_ID_STANDARD: int +TIME_ZONE_ID_DAYLIGHT: int +PROCESSOR_INTEL_386: int +PROCESSOR_INTEL_486: int +PROCESSOR_INTEL_PENTIUM: int +PROCESSOR_MIPS_R4000: int +PROCESSOR_ALPHA_21064: int +PROCESSOR_HITACHI_SH3: int +PROCESSOR_HITACHI_SH3E: int +PROCESSOR_HITACHI_SH4: int +PROCESSOR_MOTOROLA_821: int +PROCESSOR_ARM_7TDMI: int +PROCESSOR_ARCHITECTURE_INTEL: int +PROCESSOR_ARCHITECTURE_MIPS: int +PROCESSOR_ARCHITECTURE_ALPHA: int +PROCESSOR_ARCHITECTURE_PPC: int +PROCESSOR_ARCHITECTURE_SH: int +PROCESSOR_ARCHITECTURE_ARM: int +PROCESSOR_ARCHITECTURE_IA64: int +PROCESSOR_ARCHITECTURE_ALPHA64: int +PROCESSOR_ARCHITECTURE_MSIL: int +PROCESSOR_ARCHITECTURE_AMD64: int +PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: int +PROCESSOR_ARCHITECTURE_UNKNOWN: int +PF_FLOATING_POINT_PRECISION_ERRATA: int +PF_FLOATING_POINT_EMULATED: int +PF_COMPARE_EXCHANGE_DOUBLE: int +PF_MMX_INSTRUCTIONS_AVAILABLE: int +PF_PPC_MOVEMEM_64BIT_OK: int +PF_ALPHA_BYTE_INSTRUCTIONS: int +SECTION_QUERY: int +SECTION_MAP_WRITE: int +SECTION_MAP_READ: int +SECTION_MAP_EXECUTE: int +SECTION_EXTEND_SIZE: int +PAGE_NOACCESS: int +PAGE_READONLY: int +PAGE_READWRITE: int +PAGE_WRITECOPY: int +PAGE_EXECUTE: int +PAGE_EXECUTE_READ: int +PAGE_EXECUTE_READWRITE: int +PAGE_EXECUTE_WRITECOPY: int +PAGE_GUARD: int +PAGE_NOCACHE: int +MEM_COMMIT: int +MEM_RESERVE: int +MEM_DECOMMIT: int +MEM_RELEASE: int +MEM_FREE: int +MEM_PRIVATE: int +MEM_MAPPED: int +MEM_RESET: int +MEM_TOP_DOWN: int +MEM_4MB_PAGES: int +SEC_FILE: int +SEC_IMAGE: int +SEC_VLM: int +SEC_RESERVE: int +SEC_COMMIT: int +SEC_NOCACHE: int +MEM_IMAGE: int +FILE_READ_DATA: int +FILE_LIST_DIRECTORY: int +FILE_WRITE_DATA: int +FILE_ADD_FILE: int +FILE_APPEND_DATA: int +FILE_ADD_SUBDIRECTORY: int +FILE_CREATE_PIPE_INSTANCE: int +FILE_READ_EA: int +FILE_WRITE_EA: int +FILE_EXECUTE: int +FILE_TRAVERSE: int +FILE_DELETE_CHILD: int +FILE_READ_ATTRIBUTES: int +FILE_WRITE_ATTRIBUTES: int +FILE_SHARE_READ: int +FILE_SHARE_WRITE: int +FILE_SHARE_DELETE: int +FILE_ATTRIBUTE_READONLY: int +FILE_ATTRIBUTE_HIDDEN: int +FILE_ATTRIBUTE_SYSTEM: int +FILE_ATTRIBUTE_DIRECTORY: int +FILE_ATTRIBUTE_ARCHIVE: int +FILE_ATTRIBUTE_DEVICE: int +FILE_ATTRIBUTE_NORMAL: int +FILE_ATTRIBUTE_TEMPORARY: int +FILE_ATTRIBUTE_SPARSE_FILE: int +FILE_ATTRIBUTE_REPARSE_POINT: int +FILE_ATTRIBUTE_COMPRESSED: int +FILE_ATTRIBUTE_OFFLINE: int +FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: int +FILE_ATTRIBUTE_ENCRYPTED: int +FILE_ATTRIBUTE_VIRTUAL: int +FILE_NOTIFY_CHANGE_FILE_NAME: int +FILE_NOTIFY_CHANGE_DIR_NAME: int +FILE_NOTIFY_CHANGE_ATTRIBUTES: int +FILE_NOTIFY_CHANGE_SIZE: int +FILE_NOTIFY_CHANGE_LAST_WRITE: int +FILE_NOTIFY_CHANGE_LAST_ACCESS: int +FILE_NOTIFY_CHANGE_CREATION: int +FILE_NOTIFY_CHANGE_SECURITY: int +FILE_ACTION_ADDED: int +FILE_ACTION_REMOVED: int +FILE_ACTION_MODIFIED: int +FILE_ACTION_RENAMED_OLD_NAME: int +FILE_ACTION_RENAMED_NEW_NAME: int +FILE_CASE_SENSITIVE_SEARCH: int +FILE_CASE_PRESERVED_NAMES: int +FILE_UNICODE_ON_DISK: int +FILE_PERSISTENT_ACLS: int +FILE_FILE_COMPRESSION: int +FILE_VOLUME_QUOTAS: int +FILE_SUPPORTS_SPARSE_FILES: int +FILE_SUPPORTS_REPARSE_POINTS: int +FILE_SUPPORTS_REMOTE_STORAGE: int +FILE_VOLUME_IS_COMPRESSED: int +FILE_SUPPORTS_OBJECT_IDS: int +FILE_SUPPORTS_ENCRYPTION: int +MAXIMUM_REPARSE_DATA_BUFFER_SIZE: Incomplete +IO_REPARSE_TAG_RESERVED_ZERO: int +IO_REPARSE_TAG_RESERVED_ONE: int +IO_REPARSE_TAG_SYMBOLIC_LINK: int +IO_REPARSE_TAG_NSS: int +IO_REPARSE_TAG_FILTER_MANAGER: int +IO_REPARSE_TAG_DFS: int +IO_REPARSE_TAG_SIS: int +IO_REPARSE_TAG_MOUNT_POINT: int +IO_REPARSE_TAG_HSM: int +IO_REPARSE_TAG_NSSRECOVER: int +IO_REPARSE_TAG_RESERVED_MS_RANGE: int +IO_REPARSE_TAG_RESERVED_RANGE: int +IO_COMPLETION_MODIFY_STATE: int +DUPLICATE_CLOSE_SOURCE: int +DUPLICATE_SAME_ACCESS: int +DELETE: int +READ_CONTROL: int +WRITE_DAC: int +WRITE_OWNER: int +SYNCHRONIZE: int +STANDARD_RIGHTS_REQUIRED: int +STANDARD_RIGHTS_READ: int +STANDARD_RIGHTS_WRITE: int +STANDARD_RIGHTS_EXECUTE: int +STANDARD_RIGHTS_ALL: int +SPECIFIC_RIGHTS_ALL: int +IO_COMPLETION_ALL_ACCESS: Incomplete +ACCESS_SYSTEM_SECURITY: int +MAXIMUM_ALLOWED: int +GENERIC_READ: int +GENERIC_WRITE: int +GENERIC_EXECUTE: int +GENERIC_ALL: int +SID_REVISION: int +SID_MAX_SUB_AUTHORITIES: int +SID_RECOMMENDED_SUB_AUTHORITIES: int +SidTypeUser: int +SidTypeGroup: int +SidTypeDomain: int +SidTypeAlias: int +SidTypeWellKnownGroup: int +SidTypeDeletedAccount: int +SidTypeInvalid: int +SidTypeUnknown: int +SECURITY_NULL_RID: int +SECURITY_WORLD_RID: int +SECURITY_LOCAL_RID: int +SECURITY_CREATOR_OWNER_RID: int +SECURITY_CREATOR_GROUP_RID: int +SECURITY_CREATOR_OWNER_SERVER_RID: int +SECURITY_CREATOR_GROUP_SERVER_RID: int +SECURITY_DIALUP_RID: int +SECURITY_NETWORK_RID: int +SECURITY_BATCH_RID: int +SECURITY_INTERACTIVE_RID: int +SECURITY_SERVICE_RID: int +SECURITY_ANONYMOUS_LOGON_RID: int +SECURITY_PROXY_RID: int +SECURITY_SERVER_LOGON_RID: int +SECURITY_PRINCIPAL_SELF_RID: int +SECURITY_AUTHENTICATED_USER_RID: int +SECURITY_LOGON_IDS_RID: int +SECURITY_LOGON_IDS_RID_COUNT: int +SECURITY_LOCAL_SYSTEM_RID: int +SECURITY_NT_NON_UNIQUE: int +SECURITY_BUILTIN_DOMAIN_RID: int +DOMAIN_USER_RID_ADMIN: int +DOMAIN_USER_RID_GUEST: int +DOMAIN_GROUP_RID_ADMINS: int +DOMAIN_GROUP_RID_USERS: int +DOMAIN_GROUP_RID_GUESTS: int +DOMAIN_ALIAS_RID_ADMINS: int +DOMAIN_ALIAS_RID_USERS: int +DOMAIN_ALIAS_RID_GUESTS: int +DOMAIN_ALIAS_RID_POWER_USERS: int +DOMAIN_ALIAS_RID_ACCOUNT_OPS: int +DOMAIN_ALIAS_RID_SYSTEM_OPS: int +DOMAIN_ALIAS_RID_PRINT_OPS: int +DOMAIN_ALIAS_RID_BACKUP_OPS: int +DOMAIN_ALIAS_RID_REPLICATOR: int +SE_GROUP_MANDATORY: int +SE_GROUP_ENABLED_BY_DEFAULT: int +SE_GROUP_ENABLED: int +SE_GROUP_OWNER: int +SE_GROUP_LOGON_ID: int +ACL_REVISION: int +ACL_REVISION_DS: int +ACL_REVISION1: int +ACL_REVISION2: int +ACL_REVISION3: int +ACL_REVISION4: int +MAX_ACL_REVISION: int +ACCESS_MIN_MS_ACE_TYPE: int +ACCESS_ALLOWED_ACE_TYPE: int +ACCESS_DENIED_ACE_TYPE: int +SYSTEM_AUDIT_ACE_TYPE: int +SYSTEM_ALARM_ACE_TYPE: int +ACCESS_MAX_MS_V2_ACE_TYPE: int +ACCESS_ALLOWED_COMPOUND_ACE_TYPE: int +ACCESS_MAX_MS_V3_ACE_TYPE: int +ACCESS_MIN_MS_OBJECT_ACE_TYPE: int +ACCESS_ALLOWED_OBJECT_ACE_TYPE: int +ACCESS_DENIED_OBJECT_ACE_TYPE: int +SYSTEM_AUDIT_OBJECT_ACE_TYPE: int +SYSTEM_ALARM_OBJECT_ACE_TYPE: int +ACCESS_MAX_MS_OBJECT_ACE_TYPE: int +ACCESS_MAX_MS_V4_ACE_TYPE: int +ACCESS_MAX_MS_ACE_TYPE: int +ACCESS_ALLOWED_CALLBACK_ACE_TYPE: int +ACCESS_DENIED_CALLBACK_ACE_TYPE: int +ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE: int +ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE: int +SYSTEM_AUDIT_CALLBACK_ACE_TYPE: int +SYSTEM_ALARM_CALLBACK_ACE_TYPE: int +SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE: int +SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE: int +SYSTEM_MANDATORY_LABEL_ACE_TYPE: int +ACCESS_MAX_MS_V5_ACE_TYPE: int +OBJECT_INHERIT_ACE: int +CONTAINER_INHERIT_ACE: int +NO_PROPAGATE_INHERIT_ACE: int +INHERIT_ONLY_ACE: int +INHERITED_ACE: int +VALID_INHERIT_FLAGS: int +SUCCESSFUL_ACCESS_ACE_FLAG: int +FAILED_ACCESS_ACE_FLAG: int +ACE_OBJECT_TYPE_PRESENT: int +ACE_INHERITED_OBJECT_TYPE_PRESENT: int +SECURITY_DESCRIPTOR_REVISION: int +SECURITY_DESCRIPTOR_REVISION1: int +SECURITY_DESCRIPTOR_MIN_LENGTH: int +SE_OWNER_DEFAULTED: int +SE_GROUP_DEFAULTED: int +SE_DACL_PRESENT: int +SE_DACL_DEFAULTED: int +SE_SACL_PRESENT: int +SE_SACL_DEFAULTED: int +SE_DACL_AUTO_INHERIT_REQ: int +SE_SACL_AUTO_INHERIT_REQ: int +SE_DACL_AUTO_INHERITED: int +SE_SACL_AUTO_INHERITED: int +SE_DACL_PROTECTED: int +SE_SACL_PROTECTED: int +SE_SELF_RELATIVE: int +ACCESS_OBJECT_GUID: int +ACCESS_PROPERTY_SET_GUID: int +ACCESS_PROPERTY_GUID: int +ACCESS_MAX_LEVEL: int +AUDIT_ALLOW_NO_PRIVILEGE: int +ACCESS_DS_SOURCE_A: str +ACCESS_DS_OBJECT_TYPE_NAME_A: str +SE_PRIVILEGE_ENABLED_BY_DEFAULT: int +SE_PRIVILEGE_ENABLED: int +SE_PRIVILEGE_USED_FOR_ACCESS: int +PRIVILEGE_SET_ALL_NECESSARY: int +SE_CREATE_TOKEN_NAME: str +SE_ASSIGNPRIMARYTOKEN_NAME: str +SE_LOCK_MEMORY_NAME: str +SE_INCREASE_QUOTA_NAME: str +SE_UNSOLICITED_INPUT_NAME: str +SE_MACHINE_ACCOUNT_NAME: str +SE_TCB_NAME: str +SE_SECURITY_NAME: str +SE_TAKE_OWNERSHIP_NAME: str +SE_LOAD_DRIVER_NAME: str +SE_SYSTEM_PROFILE_NAME: str +SE_SYSTEMTIME_NAME: str +SE_PROF_SINGLE_PROCESS_NAME: str +SE_INC_BASE_PRIORITY_NAME: str +SE_CREATE_PAGEFILE_NAME: str +SE_CREATE_PERMANENT_NAME: str +SE_BACKUP_NAME: str +SE_RESTORE_NAME: str +SE_SHUTDOWN_NAME: str +SE_DEBUG_NAME: str +SE_AUDIT_NAME: str +SE_SYSTEM_ENVIRONMENT_NAME: str +SE_CHANGE_NOTIFY_NAME: str +SE_REMOTE_SHUTDOWN_NAME: str +TOKEN_ASSIGN_PRIMARY: int +TOKEN_DUPLICATE: int +TOKEN_IMPERSONATE: int +TOKEN_QUERY: int +TOKEN_QUERY_SOURCE: int +TOKEN_ADJUST_PRIVILEGES: int +TOKEN_ADJUST_GROUPS: int +TOKEN_ADJUST_DEFAULT: int +TOKEN_ALL_ACCESS: Incomplete +TOKEN_READ: Incomplete +TOKEN_WRITE: Incomplete +TOKEN_EXECUTE: int +TOKEN_SOURCE_LENGTH: int +TokenPrimary: int +TokenImpersonation: int +TokenUser: int +TokenGroups: int +TokenPrivileges: int +TokenOwner: int +TokenPrimaryGroup: int +TokenDefaultDacl: int +TokenSource: int +TokenType: int +TokenImpersonationLevel: int +TokenStatistics: int +TokenRestrictedSids: int +TokenSessionId: int +TokenGroupsAndPrivileges: int +TokenSessionReference: int +TokenSandBoxInert: int +TokenAuditPolicy: int +TokenOrigin: int +TokenElevationType: int +TokenLinkedToken: int +TokenElevation: int +TokenHasRestrictions: int +TokenAccessInformation: int +TokenVirtualizationAllowed: int +TokenVirtualizationEnabled: int +TokenIntegrityLevel: int +TokenUIAccess: int +TokenMandatoryPolicy: int +TokenLogonSid: int +OWNER_SECURITY_INFORMATION: int +GROUP_SECURITY_INFORMATION: int +DACL_SECURITY_INFORMATION: int +SACL_SECURITY_INFORMATION: int +LABEL_SECURITY_INFORMATION: int +IMAGE_DOS_SIGNATURE: int +IMAGE_OS2_SIGNATURE: int +IMAGE_OS2_SIGNATURE_LE: int +IMAGE_VXD_SIGNATURE: int +IMAGE_NT_SIGNATURE: int +IMAGE_SIZEOF_FILE_HEADER: int +IMAGE_FILE_RELOCS_STRIPPED: int +IMAGE_FILE_EXECUTABLE_IMAGE: int +IMAGE_FILE_LINE_NUMS_STRIPPED: int +IMAGE_FILE_LOCAL_SYMS_STRIPPED: int +IMAGE_FILE_AGGRESIVE_WS_TRIM: int +IMAGE_FILE_LARGE_ADDRESS_AWARE: int +IMAGE_FILE_BYTES_REVERSED_LO: int +IMAGE_FILE_32BIT_MACHINE: int +IMAGE_FILE_DEBUG_STRIPPED: int +IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: int +IMAGE_FILE_NET_RUN_FROM_SWAP: int +IMAGE_FILE_SYSTEM: int +IMAGE_FILE_DLL: int +IMAGE_FILE_UP_SYSTEM_ONLY: int +IMAGE_FILE_BYTES_REVERSED_HI: int +IMAGE_FILE_MACHINE_UNKNOWN: int +IMAGE_FILE_MACHINE_I386: int +IMAGE_FILE_MACHINE_R3000: int +IMAGE_FILE_MACHINE_R4000: int +IMAGE_FILE_MACHINE_R10000: int +IMAGE_FILE_MACHINE_WCEMIPSV2: int +IMAGE_FILE_MACHINE_ALPHA: int +IMAGE_FILE_MACHINE_POWERPC: int +IMAGE_FILE_MACHINE_SH3: int +IMAGE_FILE_MACHINE_SH3E: int +IMAGE_FILE_MACHINE_SH4: int +IMAGE_FILE_MACHINE_ARM: int +IMAGE_NUMBEROF_DIRECTORY_ENTRIES: int +IMAGE_SIZEOF_ROM_OPTIONAL_HEADER: int +IMAGE_SIZEOF_STD_OPTIONAL_HEADER: int +IMAGE_SIZEOF_NT_OPTIONAL_HEADER: int +IMAGE_NT_OPTIONAL_HDR_MAGIC: int +IMAGE_ROM_OPTIONAL_HDR_MAGIC: int +IMAGE_SUBSYSTEM_UNKNOWN: int +IMAGE_SUBSYSTEM_NATIVE: int +IMAGE_SUBSYSTEM_WINDOWS_GUI: int +IMAGE_SUBSYSTEM_WINDOWS_CUI: int +IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: int +IMAGE_SUBSYSTEM_OS2_CUI: int +IMAGE_SUBSYSTEM_POSIX_CUI: int +IMAGE_SUBSYSTEM_RESERVED8: int +IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: int +IMAGE_DIRECTORY_ENTRY_EXPORT: int +IMAGE_DIRECTORY_ENTRY_IMPORT: int +IMAGE_DIRECTORY_ENTRY_RESOURCE: int +IMAGE_DIRECTORY_ENTRY_EXCEPTION: int +IMAGE_DIRECTORY_ENTRY_SECURITY: int +IMAGE_DIRECTORY_ENTRY_BASERELOC: int +IMAGE_DIRECTORY_ENTRY_DEBUG: int +IMAGE_DIRECTORY_ENTRY_COPYRIGHT: int +IMAGE_DIRECTORY_ENTRY_GLOBALPTR: int +IMAGE_DIRECTORY_ENTRY_TLS: int +IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: int +IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: int +IMAGE_DIRECTORY_ENTRY_IAT: int +IMAGE_SIZEOF_SHORT_NAME: int +IMAGE_SIZEOF_SECTION_HEADER: int +IMAGE_SCN_TYPE_NO_PAD: int +IMAGE_SCN_CNT_CODE: int +IMAGE_SCN_CNT_INITIALIZED_DATA: int +IMAGE_SCN_CNT_UNINITIALIZED_DATA: int +IMAGE_SCN_LNK_OTHER: int +IMAGE_SCN_LNK_INFO: int +IMAGE_SCN_LNK_REMOVE: int +IMAGE_SCN_LNK_COMDAT: int +IMAGE_SCN_MEM_FARDATA: int +IMAGE_SCN_MEM_PURGEABLE: int +IMAGE_SCN_MEM_16BIT: int +IMAGE_SCN_MEM_LOCKED: int +IMAGE_SCN_MEM_PRELOAD: int +IMAGE_SCN_ALIGN_1BYTES: int +IMAGE_SCN_ALIGN_2BYTES: int +IMAGE_SCN_ALIGN_4BYTES: int +IMAGE_SCN_ALIGN_8BYTES: int +IMAGE_SCN_ALIGN_16BYTES: int +IMAGE_SCN_ALIGN_32BYTES: int +IMAGE_SCN_ALIGN_64BYTES: int +IMAGE_SCN_LNK_NRELOC_OVFL: int +IMAGE_SCN_MEM_DISCARDABLE: int +IMAGE_SCN_MEM_NOT_CACHED: int +IMAGE_SCN_MEM_NOT_PAGED: int +IMAGE_SCN_MEM_SHARED: int +IMAGE_SCN_MEM_EXECUTE: int +IMAGE_SCN_MEM_READ: int +IMAGE_SCN_MEM_WRITE: int +IMAGE_SCN_SCALE_INDEX: int +IMAGE_SIZEOF_SYMBOL: int +IMAGE_SYM_TYPE_NULL: int +IMAGE_SYM_TYPE_VOID: int +IMAGE_SYM_TYPE_CHAR: int +IMAGE_SYM_TYPE_SHORT: int +IMAGE_SYM_TYPE_INT: int +IMAGE_SYM_TYPE_LONG: int +IMAGE_SYM_TYPE_FLOAT: int +IMAGE_SYM_TYPE_DOUBLE: int +IMAGE_SYM_TYPE_STRUCT: int +IMAGE_SYM_TYPE_UNION: int +IMAGE_SYM_TYPE_ENUM: int +IMAGE_SYM_TYPE_MOE: int +IMAGE_SYM_TYPE_BYTE: int +IMAGE_SYM_TYPE_WORD: int +IMAGE_SYM_TYPE_UINT: int +IMAGE_SYM_TYPE_DWORD: int +IMAGE_SYM_TYPE_PCODE: int +IMAGE_SYM_DTYPE_NULL: int +IMAGE_SYM_DTYPE_POINTER: int +IMAGE_SYM_DTYPE_FUNCTION: int +IMAGE_SYM_DTYPE_ARRAY: int +IMAGE_SYM_CLASS_NULL: int +IMAGE_SYM_CLASS_AUTOMATIC: int +IMAGE_SYM_CLASS_EXTERNAL: int +IMAGE_SYM_CLASS_STATIC: int +IMAGE_SYM_CLASS_REGISTER: int +IMAGE_SYM_CLASS_EXTERNAL_DEF: int +IMAGE_SYM_CLASS_LABEL: int +IMAGE_SYM_CLASS_UNDEFINED_LABEL: int +IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: int +IMAGE_SYM_CLASS_ARGUMENT: int +IMAGE_SYM_CLASS_STRUCT_TAG: int +IMAGE_SYM_CLASS_MEMBER_OF_UNION: int +IMAGE_SYM_CLASS_UNION_TAG: int +IMAGE_SYM_CLASS_TYPE_DEFINITION: int +IMAGE_SYM_CLASS_UNDEFINED_STATIC: int +IMAGE_SYM_CLASS_ENUM_TAG: int +IMAGE_SYM_CLASS_MEMBER_OF_ENUM: int +IMAGE_SYM_CLASS_REGISTER_PARAM: int +IMAGE_SYM_CLASS_BIT_FIELD: int +IMAGE_SYM_CLASS_FAR_EXTERNAL: int +IMAGE_SYM_CLASS_BLOCK: int +IMAGE_SYM_CLASS_FUNCTION: int +IMAGE_SYM_CLASS_END_OF_STRUCT: int +IMAGE_SYM_CLASS_FILE: int +IMAGE_SYM_CLASS_SECTION: int +IMAGE_SYM_CLASS_WEAK_EXTERNAL: int +N_BTMASK: int +N_TMASK: int +N_TMASK1: int +N_TMASK2: int +N_BTSHFT: int +N_TSHIFT: int + +def BTYPE(x): ... +def ISPTR(x): ... +def ISFCN(x): ... +def ISARY(x): ... +def INCREF(x): ... +def DECREF(x): ... + +IMAGE_SIZEOF_AUX_SYMBOL: int +IMAGE_COMDAT_SELECT_NODUPLICATES: int +IMAGE_COMDAT_SELECT_ANY: int +IMAGE_COMDAT_SELECT_SAME_SIZE: int +IMAGE_COMDAT_SELECT_EXACT_MATCH: int +IMAGE_COMDAT_SELECT_ASSOCIATIVE: int +IMAGE_COMDAT_SELECT_LARGEST: int +IMAGE_COMDAT_SELECT_NEWEST: int +IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY: int +IMAGE_WEAK_EXTERN_SEARCH_LIBRARY: int +IMAGE_WEAK_EXTERN_SEARCH_ALIAS: int +IMAGE_SIZEOF_RELOCATION: int +IMAGE_REL_I386_ABSOLUTE: int +IMAGE_REL_I386_DIR16: int +IMAGE_REL_I386_REL16: int +IMAGE_REL_I386_DIR32: int +IMAGE_REL_I386_DIR32NB: int +IMAGE_REL_I386_SEG12: int +IMAGE_REL_I386_SECTION: int +IMAGE_REL_I386_SECREL: int +IMAGE_REL_I386_REL32: int +IMAGE_REL_MIPS_ABSOLUTE: int +IMAGE_REL_MIPS_REFHALF: int +IMAGE_REL_MIPS_REFWORD: int +IMAGE_REL_MIPS_JMPADDR: int +IMAGE_REL_MIPS_REFHI: int +IMAGE_REL_MIPS_REFLO: int +IMAGE_REL_MIPS_GPREL: int +IMAGE_REL_MIPS_LITERAL: int +IMAGE_REL_MIPS_SECTION: int +IMAGE_REL_MIPS_SECREL: int +IMAGE_REL_MIPS_SECRELLO: int +IMAGE_REL_MIPS_SECRELHI: int +IMAGE_REL_MIPS_REFWORDNB: int +IMAGE_REL_MIPS_PAIR: int +IMAGE_REL_ALPHA_ABSOLUTE: int +IMAGE_REL_ALPHA_REFLONG: int +IMAGE_REL_ALPHA_REFQUAD: int +IMAGE_REL_ALPHA_GPREL32: int +IMAGE_REL_ALPHA_LITERAL: int +IMAGE_REL_ALPHA_LITUSE: int +IMAGE_REL_ALPHA_GPDISP: int +IMAGE_REL_ALPHA_BRADDR: int +IMAGE_REL_ALPHA_HINT: int +IMAGE_REL_ALPHA_INLINE_REFLONG: int +IMAGE_REL_ALPHA_REFHI: int +IMAGE_REL_ALPHA_REFLO: int +IMAGE_REL_ALPHA_PAIR: int +IMAGE_REL_ALPHA_MATCH: int +IMAGE_REL_ALPHA_SECTION: int +IMAGE_REL_ALPHA_SECREL: int +IMAGE_REL_ALPHA_REFLONGNB: int +IMAGE_REL_ALPHA_SECRELLO: int +IMAGE_REL_ALPHA_SECRELHI: int +IMAGE_REL_PPC_ABSOLUTE: int +IMAGE_REL_PPC_ADDR64: int +IMAGE_REL_PPC_ADDR32: int +IMAGE_REL_PPC_ADDR24: int +IMAGE_REL_PPC_ADDR16: int +IMAGE_REL_PPC_ADDR14: int +IMAGE_REL_PPC_REL24: int +IMAGE_REL_PPC_REL14: int +IMAGE_REL_PPC_TOCREL16: int +IMAGE_REL_PPC_TOCREL14: int +IMAGE_REL_PPC_ADDR32NB: int +IMAGE_REL_PPC_SECREL: int +IMAGE_REL_PPC_SECTION: int +IMAGE_REL_PPC_IFGLUE: int +IMAGE_REL_PPC_IMGLUE: int +IMAGE_REL_PPC_SECREL16: int +IMAGE_REL_PPC_REFHI: int +IMAGE_REL_PPC_REFLO: int +IMAGE_REL_PPC_PAIR: int +IMAGE_REL_PPC_SECRELLO: int +IMAGE_REL_PPC_SECRELHI: int +IMAGE_REL_PPC_TYPEMASK: int +IMAGE_REL_PPC_NEG: int +IMAGE_REL_PPC_BRTAKEN: int +IMAGE_REL_PPC_BRNTAKEN: int +IMAGE_REL_PPC_TOCDEFN: int +IMAGE_REL_SH3_ABSOLUTE: int +IMAGE_REL_SH3_DIRECT16: int +IMAGE_REL_SH3_DIRECT32: int +IMAGE_REL_SH3_DIRECT8: int +IMAGE_REL_SH3_DIRECT8_WORD: int +IMAGE_REL_SH3_DIRECT8_LONG: int +IMAGE_REL_SH3_DIRECT4: int +IMAGE_REL_SH3_DIRECT4_WORD: int +IMAGE_REL_SH3_DIRECT4_LONG: int +IMAGE_REL_SH3_PCREL8_WORD: int +IMAGE_REL_SH3_PCREL8_LONG: int +IMAGE_REL_SH3_PCREL12_WORD: int +IMAGE_REL_SH3_STARTOF_SECTION: int +IMAGE_REL_SH3_SIZEOF_SECTION: int +IMAGE_REL_SH3_SECTION: int +IMAGE_REL_SH3_SECREL: int +IMAGE_REL_SH3_DIRECT32_NB: int +IMAGE_SIZEOF_LINENUMBER: int +IMAGE_SIZEOF_BASE_RELOCATION: int +IMAGE_REL_BASED_ABSOLUTE: int +IMAGE_REL_BASED_HIGH: int +IMAGE_REL_BASED_LOW: int +IMAGE_REL_BASED_HIGHLOW: int +IMAGE_REL_BASED_HIGHADJ: int +IMAGE_REL_BASED_MIPS_JMPADDR: int +IMAGE_REL_BASED_SECTION: int +IMAGE_REL_BASED_REL32: int +IMAGE_ARCHIVE_START_SIZE: int +IMAGE_ARCHIVE_START: str +IMAGE_ARCHIVE_END: str +IMAGE_ARCHIVE_PAD: str +IMAGE_ARCHIVE_LINKER_MEMBER: str +IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR: int +IMAGE_ORDINAL_FLAG: int + +def IMAGE_SNAP_BY_ORDINAL(Ordina): ... +def IMAGE_ORDINAL(Ordina): ... + +IMAGE_RESOURCE_NAME_IS_STRING: int +IMAGE_RESOURCE_DATA_IS_DIRECTORY: int +IMAGE_DEBUG_TYPE_UNKNOWN: int +IMAGE_DEBUG_TYPE_COFF: int +IMAGE_DEBUG_TYPE_CODEVIEW: int +IMAGE_DEBUG_TYPE_FPO: int +IMAGE_DEBUG_TYPE_MISC: int +IMAGE_DEBUG_TYPE_EXCEPTION: int +IMAGE_DEBUG_TYPE_FIXUP: int +IMAGE_DEBUG_TYPE_OMAP_TO_SRC: int +IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: int +IMAGE_DEBUG_TYPE_BORLAND: int +FRAME_FPO: int +FRAME_TRAP: int +FRAME_TSS: int +FRAME_NONFPO: int +SIZEOF_RFPO_DATA: int +IMAGE_DEBUG_MISC_EXENAME: int +IMAGE_SEPARATE_DEBUG_SIGNATURE: int +IMAGE_SEPARATE_DEBUG_FLAGS_MASK: int +IMAGE_SEPARATE_DEBUG_MISMATCH: int +NULL: int +HEAP_NO_SERIALIZE: int +HEAP_GROWABLE: int +HEAP_GENERATE_EXCEPTIONS: int +HEAP_ZERO_MEMORY: int +HEAP_REALLOC_IN_PLACE_ONLY: int +HEAP_TAIL_CHECKING_ENABLED: int +HEAP_FREE_CHECKING_ENABLED: int +HEAP_DISABLE_COALESCE_ON_FREE: int +HEAP_CREATE_ALIGN_16: int +HEAP_CREATE_ENABLE_TRACING: int +HEAP_MAXIMUM_TAG: int +HEAP_PSEUDO_TAG_FLAG: int +HEAP_TAG_SHIFT: int +IS_TEXT_UNICODE_ASCII16: int +IS_TEXT_UNICODE_REVERSE_ASCII16: int +IS_TEXT_UNICODE_STATISTICS: int +IS_TEXT_UNICODE_REVERSE_STATISTICS: int +IS_TEXT_UNICODE_CONTROLS: int +IS_TEXT_UNICODE_REVERSE_CONTROLS: int +IS_TEXT_UNICODE_SIGNATURE: int +IS_TEXT_UNICODE_REVERSE_SIGNATURE: int +IS_TEXT_UNICODE_ILLEGAL_CHARS: int +IS_TEXT_UNICODE_ODD_LENGTH: int +IS_TEXT_UNICODE_DBCS_LEADBYTE: int +IS_TEXT_UNICODE_NULL_BYTES: int +IS_TEXT_UNICODE_UNICODE_MASK: int +IS_TEXT_UNICODE_REVERSE_MASK: int +IS_TEXT_UNICODE_NOT_UNICODE_MASK: int +IS_TEXT_UNICODE_NOT_ASCII_MASK: int +COMPRESSION_FORMAT_NONE: int +COMPRESSION_FORMAT_DEFAULT: int +COMPRESSION_FORMAT_LZNT1: int +COMPRESSION_ENGINE_STANDARD: int +COMPRESSION_ENGINE_MAXIMUM: int +MESSAGE_RESOURCE_UNICODE: int +RTL_CRITSECT_TYPE: int +RTL_RESOURCE_TYPE: int +SEF_DACL_AUTO_INHERIT: int +SEF_SACL_AUTO_INHERIT: int +SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT: int +SEF_AVOID_PRIVILEGE_CHECK: int +DLL_PROCESS_ATTACH: int +DLL_THREAD_ATTACH: int +DLL_THREAD_DETACH: int +DLL_PROCESS_DETACH: int +EVENTLOG_SEQUENTIAL_READ: int +EVENTLOG_SEEK_READ: int +EVENTLOG_FORWARDS_READ: int +EVENTLOG_BACKWARDS_READ: int +EVENTLOG_SUCCESS: int +EVENTLOG_ERROR_TYPE: int +EVENTLOG_WARNING_TYPE: int +EVENTLOG_INFORMATION_TYPE: int +EVENTLOG_AUDIT_SUCCESS: int +EVENTLOG_AUDIT_FAILURE: int +EVENTLOG_START_PAIRED_EVENT: int +EVENTLOG_END_PAIRED_EVENT: int +EVENTLOG_END_ALL_PAIRED_EVENTS: int +EVENTLOG_PAIRED_EVENT_ACTIVE: int +EVENTLOG_PAIRED_EVENT_INACTIVE: int +KEY_QUERY_VALUE: int +KEY_SET_VALUE: int +KEY_CREATE_SUB_KEY: int +KEY_ENUMERATE_SUB_KEYS: int +KEY_NOTIFY: int +KEY_CREATE_LINK: int +KEY_READ: Incomplete +KEY_WRITE: Incomplete +KEY_EXECUTE: Incomplete +KEY_ALL_ACCESS: Incomplete +REG_OPTION_RESERVED: int +REG_OPTION_NON_VOLATILE: int +REG_OPTION_VOLATILE: int +REG_OPTION_CREATE_LINK: int +REG_OPTION_BACKUP_RESTORE: int +REG_OPTION_OPEN_LINK: int +REG_LEGAL_OPTION: Incomplete +REG_CREATED_NEW_KEY: int +REG_OPENED_EXISTING_KEY: int +REG_STANDARD_FORMAT: int +REG_LATEST_FORMAT: int +REG_NO_COMPRESSION: int +REG_WHOLE_HIVE_VOLATILE: int +REG_REFRESH_HIVE: int +REG_NO_LAZY_FLUSH: int +REG_FORCE_RESTORE: int +REG_NOTIFY_CHANGE_NAME: int +REG_NOTIFY_CHANGE_ATTRIBUTES: int +REG_NOTIFY_CHANGE_LAST_SET: int +REG_NOTIFY_CHANGE_SECURITY: int +REG_LEGAL_CHANGE_FILTER: Incomplete +REG_NONE: int +REG_SZ: int +REG_EXPAND_SZ: int +REG_BINARY: int +REG_DWORD: int +REG_DWORD_LITTLE_ENDIAN: int +REG_DWORD_BIG_ENDIAN: int +REG_LINK: int +REG_MULTI_SZ: int +REG_RESOURCE_LIST: int +REG_FULL_RESOURCE_DESCRIPTOR: int +REG_RESOURCE_REQUIREMENTS_LIST: int +SERVICE_KERNEL_DRIVER: int +SERVICE_FILE_SYSTEM_DRIVER: int +SERVICE_ADAPTER: int +SERVICE_RECOGNIZER_DRIVER: int +SERVICE_DRIVER: Incomplete +SERVICE_WIN32_OWN_PROCESS: int +SERVICE_WIN32_SHARE_PROCESS: int +SERVICE_WIN32: Incomplete +SERVICE_INTERACTIVE_PROCESS: int +SERVICE_TYPE_ALL: Incomplete +SERVICE_BOOT_START: int +SERVICE_SYSTEM_START: int +SERVICE_AUTO_START: int +SERVICE_DEMAND_START: int +SERVICE_DISABLED: int +SERVICE_ERROR_IGNORE: int +SERVICE_ERROR_NORMAL: int +SERVICE_ERROR_SEVERE: int +SERVICE_ERROR_CRITICAL: int +TAPE_ERASE_SHORT: int +TAPE_ERASE_LONG: int +TAPE_LOAD: int +TAPE_UNLOAD: int +TAPE_TENSION: int +TAPE_LOCK: int +TAPE_UNLOCK: int +TAPE_FORMAT: int +TAPE_SETMARKS: int +TAPE_FILEMARKS: int +TAPE_SHORT_FILEMARKS: int +TAPE_LONG_FILEMARKS: int +TAPE_ABSOLUTE_POSITION: int +TAPE_LOGICAL_POSITION: int +TAPE_PSEUDO_LOGICAL_POSITION: int +TAPE_REWIND: int +TAPE_ABSOLUTE_BLOCK: int +TAPE_LOGICAL_BLOCK: int +TAPE_PSEUDO_LOGICAL_BLOCK: int +TAPE_SPACE_END_OF_DATA: int +TAPE_SPACE_RELATIVE_BLOCKS: int +TAPE_SPACE_FILEMARKS: int +TAPE_SPACE_SEQUENTIAL_FMKS: int +TAPE_SPACE_SETMARKS: int +TAPE_SPACE_SEQUENTIAL_SMKS: int +TAPE_DRIVE_FIXED: int +TAPE_DRIVE_SELECT: int +TAPE_DRIVE_INITIATOR: int +TAPE_DRIVE_ERASE_SHORT: int +TAPE_DRIVE_ERASE_LONG: int +TAPE_DRIVE_ERASE_BOP_ONLY: int +TAPE_DRIVE_ERASE_IMMEDIATE: int +TAPE_DRIVE_TAPE_CAPACITY: int +TAPE_DRIVE_TAPE_REMAINING: int +TAPE_DRIVE_FIXED_BLOCK: int +TAPE_DRIVE_VARIABLE_BLOCK: int +TAPE_DRIVE_WRITE_PROTECT: int +TAPE_DRIVE_EOT_WZ_SIZE: int +TAPE_DRIVE_ECC: int +TAPE_DRIVE_COMPRESSION: int +TAPE_DRIVE_PADDING: int +TAPE_DRIVE_REPORT_SMKS: int +TAPE_DRIVE_GET_ABSOLUTE_BLK: int +TAPE_DRIVE_GET_LOGICAL_BLK: int +TAPE_DRIVE_SET_EOT_WZ_SIZE: int +TAPE_DRIVE_EJECT_MEDIA: int +TAPE_DRIVE_RESERVED_BIT: int +TAPE_DRIVE_LOAD_UNLOAD: int +TAPE_DRIVE_TENSION: int +TAPE_DRIVE_LOCK_UNLOCK: int +TAPE_DRIVE_REWIND_IMMEDIATE: int +TAPE_DRIVE_SET_BLOCK_SIZE: int +TAPE_DRIVE_LOAD_UNLD_IMMED: int +TAPE_DRIVE_TENSION_IMMED: int +TAPE_DRIVE_LOCK_UNLK_IMMED: int +TAPE_DRIVE_SET_ECC: int +TAPE_DRIVE_SET_COMPRESSION: int +TAPE_DRIVE_SET_PADDING: int +TAPE_DRIVE_SET_REPORT_SMKS: int +TAPE_DRIVE_ABSOLUTE_BLK: int +TAPE_DRIVE_ABS_BLK_IMMED: int +TAPE_DRIVE_LOGICAL_BLK: int +TAPE_DRIVE_LOG_BLK_IMMED: int +TAPE_DRIVE_END_OF_DATA: int +TAPE_DRIVE_RELATIVE_BLKS: int +TAPE_DRIVE_FILEMARKS: int +TAPE_DRIVE_SEQUENTIAL_FMKS: int +TAPE_DRIVE_SETMARKS: int +TAPE_DRIVE_SEQUENTIAL_SMKS: int +TAPE_DRIVE_REVERSE_POSITION: int +TAPE_DRIVE_SPACE_IMMEDIATE: int +TAPE_DRIVE_WRITE_SETMARKS: int +TAPE_DRIVE_WRITE_FILEMARKS: int +TAPE_DRIVE_WRITE_SHORT_FMKS: int +TAPE_DRIVE_WRITE_LONG_FMKS: int +TAPE_DRIVE_WRITE_MARK_IMMED: int +TAPE_DRIVE_FORMAT: int +TAPE_DRIVE_FORMAT_IMMEDIATE: int +TAPE_DRIVE_HIGH_FEATURES: int +TAPE_FIXED_PARTITIONS: int +TAPE_SELECT_PARTITIONS: int +TAPE_INITIATOR_PARTITIONS: int +TRANSACTIONMANAGER_QUERY_INFORMATION: int +TRANSACTIONMANAGER_SET_INFORMATION: int +TRANSACTIONMANAGER_RECOVER: int +TRANSACTIONMANAGER_RENAME: int +TRANSACTIONMANAGER_CREATE_RM: int +TRANSACTIONMANAGER_BIND_TRANSACTION: int +TRANSACTIONMANAGER_GENERIC_READ: Incomplete +TRANSACTIONMANAGER_GENERIC_WRITE: Incomplete +TRANSACTIONMANAGER_GENERIC_EXECUTE: int +TRANSACTIONMANAGER_ALL_ACCESS: Incomplete +TRANSACTION_QUERY_INFORMATION: int +TRANSACTION_SET_INFORMATION: int +TRANSACTION_ENLIST: int +TRANSACTION_COMMIT: int +TRANSACTION_ROLLBACK: int +TRANSACTION_PROPAGATE: int +TRANSACTION_SAVEPOINT: int +TRANSACTION_MARSHALL: int +TRANSACTION_GENERIC_READ: Incomplete +TRANSACTION_GENERIC_WRITE: Incomplete +TRANSACTION_GENERIC_EXECUTE: Incomplete +TRANSACTION_ALL_ACCESS: Incomplete +TRANSACTION_RESOURCE_MANAGER_RIGHTS: Incomplete +RESOURCEMANAGER_QUERY_INFORMATION: int +RESOURCEMANAGER_SET_INFORMATION: int +RESOURCEMANAGER_RECOVER: int +RESOURCEMANAGER_ENLIST: int +RESOURCEMANAGER_GET_NOTIFICATION: int +RESOURCEMANAGER_REGISTER_PROTOCOL: int +RESOURCEMANAGER_COMPLETE_PROPAGATION: int +RESOURCEMANAGER_GENERIC_READ: Incomplete +RESOURCEMANAGER_GENERIC_WRITE: Incomplete +RESOURCEMANAGER_GENERIC_EXECUTE: Incomplete +RESOURCEMANAGER_ALL_ACCESS: Incomplete +ENLISTMENT_QUERY_INFORMATION: int +ENLISTMENT_SET_INFORMATION: int +ENLISTMENT_RECOVER: int +ENLISTMENT_SUBORDINATE_RIGHTS: int +ENLISTMENT_SUPERIOR_RIGHTS: int +ENLISTMENT_GENERIC_READ: Incomplete +ENLISTMENT_GENERIC_WRITE: Incomplete +ENLISTMENT_GENERIC_EXECUTE: Incomplete +ENLISTMENT_ALL_ACCESS: Incomplete +TransactionOutcomeUndetermined: int +TransactionOutcomeCommitted: int +TransactionOutcomeAborted: int +TransactionStateNormal: int +TransactionStateIndoubt: int +TransactionStateCommittedNotify: int +TransactionBasicInformation: int +TransactionPropertiesInformation: int +TransactionEnlistmentInformation: int +TransactionFullInformation: int +TransactionManagerBasicInformation: int +TransactionManagerLogInformation: int +TransactionManagerLogPathInformation: int +TransactionManagerOnlineProbeInformation: int +ResourceManagerBasicInformation: int +ResourceManagerCompletionInformation: int +ResourceManagerFullInformation: int +ResourceManagerNameInformation: int +EnlistmentBasicInformation: int +EnlistmentRecoveryInformation: int +EnlistmentFullInformation: int +EnlistmentNameInformation: int +KTMOBJECT_TRANSACTION: int +KTMOBJECT_TRANSACTION_MANAGER: int +KTMOBJECT_RESOURCE_MANAGER: int +KTMOBJECT_ENLISTMENT: int +KTMOBJECT_INVALID: int diff --git a/stubs/pywin32/win32/lib/winperf.pyi b/stubs/pywin32/win32/lib/winperf.pyi new file mode 100644 index 0000000..bcda5bf --- /dev/null +++ b/stubs/pywin32/win32/lib/winperf.pyi @@ -0,0 +1,73 @@ +from _typeshed import Incomplete + +PERF_DATA_VERSION: int +PERF_DATA_REVISION: int +PERF_NO_INSTANCES: int +PERF_SIZE_DWORD: int +PERF_SIZE_LARGE: int +PERF_SIZE_ZERO: int +PERF_SIZE_VARIABLE_LEN: int +PERF_TYPE_NUMBER: int +PERF_TYPE_COUNTER: int +PERF_TYPE_TEXT: int +PERF_TYPE_ZERO: int +PERF_NUMBER_HEX: int +PERF_NUMBER_DECIMAL: int +PERF_NUMBER_DEC_1000: int +PERF_COUNTER_VALUE: int +PERF_COUNTER_RATE: int +PERF_COUNTER_FRACTION: int +PERF_COUNTER_BASE: int +PERF_COUNTER_ELAPSED: int +PERF_COUNTER_QUEUELEN: int +PERF_COUNTER_HISTOGRAM: int +PERF_TEXT_UNICODE: int +PERF_TEXT_ASCII: int +PERF_TIMER_TICK: int +PERF_TIMER_100NS: int +PERF_OBJECT_TIMER: int +PERF_DELTA_COUNTER: int +PERF_DELTA_BASE: int +PERF_INVERSE_COUNTER: int +PERF_MULTI_COUNTER: int +PERF_DISPLAY_NO_SUFFIX: int +PERF_DISPLAY_PER_SEC: int +PERF_DISPLAY_PERCENT: int +PERF_DISPLAY_SECONDS: int +PERF_DISPLAY_NOSHOW: int +PERF_COUNTER_COUNTER: Incomplete +PERF_COUNTER_TIMER: Incomplete +PERF_COUNTER_QUEUELEN_TYPE: Incomplete +PERF_COUNTER_LARGE_QUEUELEN_TYPE: Incomplete +PERF_COUNTER_BULK_COUNT: Incomplete +PERF_COUNTER_TEXT: Incomplete +PERF_COUNTER_RAWCOUNT: Incomplete +PERF_COUNTER_LARGE_RAWCOUNT: Incomplete +PERF_COUNTER_RAWCOUNT_HEX: Incomplete +PERF_COUNTER_LARGE_RAWCOUNT_HEX: Incomplete +PERF_SAMPLE_FRACTION: Incomplete +PERF_SAMPLE_COUNTER: Incomplete +PERF_COUNTER_NODATA: Incomplete +PERF_COUNTER_TIMER_INV: Incomplete +PERF_SAMPLE_BASE: Incomplete +PERF_AVERAGE_TIMER: Incomplete +PERF_AVERAGE_BASE: Incomplete +PERF_AVERAGE_BULK: Incomplete +PERF_100NSEC_TIMER: Incomplete +PERF_100NSEC_TIMER_INV: Incomplete +PERF_COUNTER_MULTI_TIMER: Incomplete +PERF_COUNTER_MULTI_TIMER_INV: Incomplete +PERF_COUNTER_MULTI_BASE: Incomplete +PERF_100NSEC_MULTI_TIMER: Incomplete +PERF_100NSEC_MULTI_TIMER_INV: Incomplete +PERF_RAW_FRACTION: Incomplete +PERF_RAW_BASE: Incomplete +PERF_ELAPSED_TIME: Incomplete +PERF_COUNTER_HISTOGRAM_TYPE: int +PERF_COUNTER_DELTA: Incomplete +PERF_COUNTER_LARGE_DELTA: Incomplete +PERF_DETAIL_NOVICE: int +PERF_DETAIL_ADVANCED: int +PERF_DETAIL_EXPERT: int +PERF_DETAIL_WIZARD: int +PERF_NO_UNIQUE_ID: int diff --git a/stubs/pywin32/win32/lib/winxptheme.pyi b/stubs/pywin32/win32/lib/winxptheme.pyi new file mode 100644 index 0000000..080eb53 --- /dev/null +++ b/stubs/pywin32/win32/lib/winxptheme.pyi @@ -0,0 +1,25 @@ +import _win32typing + +def OpenThemeData(hwnd: int, pszClasslist: str) -> _win32typing.PyHTHEME: ... +def CloseThemeData(hTheme: _win32typing.PyHTHEME) -> None: ... +def DrawThemeBackground(hTheme: _win32typing.PyHTHEME, hdc, iPartId, iStateId, pRect, pClipRect) -> None: ... +def DrawThemeText( + hTheme: _win32typing.PyHTHEME, hdc, iPartId, iStateId, pszText: str, dwCharCount, dwTextFlags, dwTextFlags2, pRect +) -> None: ... +def GetThemeBackgroundContentRect(hTheme: _win32typing.PyHTHEME, hdc, iPartId, iStateId, pBoundingRect): ... +def GetThemeBackgroundExtent(hTheme: _win32typing.PyHTHEME, hdc, iPartId, iStateId, pContentRect): ... +def IsThemeActive() -> int: ... +def IsAppThemed() -> int: ... +def GetWindowTheme(hwnd: int) -> _win32typing.PyHTHEME: ... +def EnableThemeDialogTexture(hdlg, dwFlags) -> None: ... +def IsThemeDialogTextureEnabled(__hdlg: int | None) -> bool: ... +def GetThemeAppProperties(): ... +def EnableTheming(fEnable) -> None: ... +def SetWindowTheme(hwnd: int, pszSubAppName: str, pszSubIdlist: str) -> None: ... +def GetCurrentThemeName() -> tuple[str, str, str]: ... + +ETDT_DISABLE: int +ETDT_ENABLE: int +ETDT_ENABLETAB: int +ETDT_USETABTEXTURE: int +UNICODE: int diff --git a/stubs/pywin32/win32/mmapfile.pyi b/stubs/pywin32/win32/mmapfile.pyi new file mode 100644 index 0000000..8d943c3 --- /dev/null +++ b/stubs/pywin32/win32/mmapfile.pyi @@ -0,0 +1,6 @@ +import _win32typing +from win32.lib.pywintypes import error as error + +def mmapfile( + File, Name, MaximumSize: int = ..., FileOffset: int = ..., NumberOfBytesToMap: int = ... +) -> _win32typing.Pymmapfile: ... diff --git a/stubs/pywin32/win32/odbc.pyi b/stubs/pywin32/win32/odbc.pyi new file mode 100644 index 0000000..8ba629f --- /dev/null +++ b/stubs/pywin32/win32/odbc.pyi @@ -0,0 +1,29 @@ +from _typeshed import Incomplete +from typing_extensions import Literal, TypeAlias + +import _win32typing + +def odbc(connectionString: str) -> _win32typing.connection: ... +def SQLDataSources(direction) -> tuple[Incomplete, Incomplete]: ... + +_odbcError: TypeAlias = type # noqa: Y042 # Does not exist at runtime, but odbc.odbcError is a valid type. +DATE: str +NUMBER: str +RAW: str +SQL_FETCH_ABSOLUTE: int +SQL_FETCH_FIRST: int +SQL_FETCH_FIRST_SYSTEM: int +SQL_FETCH_FIRST_USER: int +SQL_FETCH_LAST: int +SQL_FETCH_NEXT: int +SQL_FETCH_PRIOR: int +SQL_FETCH_RELATIVE: int +STRING: str +TYPES: tuple[Literal["STRING"], Literal["RAW"], Literal["NUMBER"], Literal["DATE"]] +dataError: Incomplete +error: _odbcError +integrityError: Incomplete +internalError: Incomplete +noError: Incomplete +opError: Incomplete +progError: Incomplete diff --git a/stubs/pywin32/win32/perfmon.pyi b/stubs/pywin32/win32/perfmon.pyi new file mode 100644 index 0000000..4639a21 --- /dev/null +++ b/stubs/pywin32/win32/perfmon.pyi @@ -0,0 +1,12 @@ +import _win32typing + +def LoadPerfCounterTextStrings() -> None: ... +def UnloadPerfCounterTextStrings() -> None: ... +def CounterDefinition() -> _win32typing.PyPERF_COUNTER_DEFINITION: ... +def ObjectType() -> _win32typing.PyPERF_OBJECT_TYPE: ... +def PerfMonManager( + serviceName: str, + seqPerfObTypes: list[_win32typing.PyPERF_OBJECT_TYPE], + mappingName: str | None = ..., + eventSourceName: str | None = ..., +) -> _win32typing.PyPerfMonManager: ... diff --git a/stubs/pywin32/win32/servicemanager.pyi b/stubs/pywin32/win32/servicemanager.pyi new file mode 100644 index 0000000..5b61d79 --- /dev/null +++ b/stubs/pywin32/win32/servicemanager.pyi @@ -0,0 +1,34 @@ +from _typeshed import Incomplete + +def CoInitializeEx() -> None: ... +def CoUninitialize() -> None: ... +def RegisterServiceCtrlHandler(serviceName: str, callback, extra_args: bool = ...): ... +def LogMsg(errorType, eventId, inserts: tuple[str, Incomplete] | None = ...) -> None: ... +def LogInfoMsg(msg: str) -> None: ... +def LogErrorMsg(msg: str) -> None: ... +def LogWarningMsg(msg: str) -> None: ... +def PumpWaitingMessages(): ... +def Debugging(newVal: int = ...): ... +def Initialize(eventSourceName: str | None = ..., eventSourceFile: str | None = ...) -> None: ... +def Finalize() -> None: ... +def PrepareToHostSingle(klass: Incomplete | None = ...) -> None: ... +def PrepareToHostMultiple(service_name: str, klass) -> None: ... +def RunningAsService(): ... +def SetEventSourceName(sourceName: str, registerNow: bool = ...) -> None: ... +def StartServiceCtrlDispatcher(*args, **kwargs): ... # incomplete + +COINIT_APARTMENTTHREADED: int +COINIT_DISABLE_OLE1DDE: int +COINIT_MULTITHREADED: int +COINIT_SPEED_OVER_MEMORY: int +EVENTLOG_AUDIT_FAILURE: int +EVENTLOG_AUDIT_SUCCESS: int +EVENTLOG_ERROR_TYPE: int +EVENTLOG_INFORMATION_TYPE: int +EVENTLOG_WARNING_TYPE: int +PYS_SERVICE_STARTED: int +PYS_SERVICE_STARTING: int +PYS_SERVICE_STOPPED: int +PYS_SERVICE_STOPPING: int + +class startup_error(Exception): ... diff --git a/stubs/pywin32/win32/timer.pyi b/stubs/pywin32/win32/timer.pyi new file mode 100644 index 0000000..751757b --- /dev/null +++ b/stubs/pywin32/win32/timer.pyi @@ -0,0 +1,6 @@ +from win32.lib.pywintypes import error as error + +def set_timer(Elapse, TimerFunc): ... +def kill_timer(timer_id): ... + +__version__: bytes diff --git a/stubs/pywin32/win32/win32api.pyi b/stubs/pywin32/win32/win32api.pyi new file mode 100644 index 0000000..447409a --- /dev/null +++ b/stubs/pywin32/win32/win32api.pyi @@ -0,0 +1,287 @@ +from _typeshed import Incomplete +from typing_extensions import TypedDict + +import _win32typing +from win32.lib.pywintypes import error as error + +class _MonitorInfo(TypedDict): + Monitor: tuple[int, int, int, int] + Work: tuple[int, int, int, int] + Flags: int + Device: str + +def AbortSystemShutdown(computerName: str) -> None: ... +def InitiateSystemShutdown(computerName: str, message: str, timeOut, bForceClose, bRebootAfterShutdown) -> None: ... +def Apply(exceptionHandler, func, args): ... +def Beep(freq, dur) -> None: ... +def BeginUpdateResource(filename: str, delete) -> int: ... +def ChangeDisplaySettings(DevMode: _win32typing.PyDEVMODE, Flags): ... +def ChangeDisplaySettingsEx(DeviceName: Incomplete | None = ..., DevMode: _win32typing.PyDEVMODE | None = ..., Flags=...): ... +def ClipCursor(arg: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... +def CloseHandle(handle: int) -> None: ... +def CopyFile(src, dest: str, bFailOnExist: int = ...) -> None: ... +def DebugBreak() -> None: ... +def DeleteFile(fileName: str) -> None: ... +def DragQueryFile(hDrop, fileNum: int = ...) -> str: ... +def DragFinish(hDrop) -> None: ... +def DuplicateHandle( + hSourceProcess: int, hSource: int, hTargetProcessHandle: int, desiredAccess, bInheritHandle, options +) -> int: ... +def EndUpdateResource(handle: int, discard) -> None: ... +def EnumDisplayDevices(Device: str | None = ..., DevNum: int = ..., Flags: int = ...) -> _win32typing.PyDISPLAY_DEVICE: ... +def EnumDisplayMonitors( + hdc: int | None = ..., rcClip: _win32typing.PyRECT | None = ... +) -> list[tuple[_win32typing.PyHANDLE, _win32typing.PyHANDLE, tuple[int, int, int, int]]]: ... +def EnumDisplaySettings(DeviceName: str | None = ..., ModeNum: int = ...) -> _win32typing.PyDEVMODE: ... +def EnumDisplaySettingsEx(ModeNum, DeviceName: str | None = ..., Flags=...) -> _win32typing.PyDEVMODE: ... +def EnumResourceLanguages( + hmodule: int, lpType: _win32typing.PyResourceId, lpName: _win32typing.PyResourceId +) -> list[Incomplete]: ... +def EnumResourceNames(hmodule: int, resType: _win32typing.PyResourceId) -> list[str]: ... +def EnumResourceTypes(hmodule: int) -> list[Incomplete]: ... +def ExpandEnvironmentStrings(_in: str) -> str: ... +def ExitWindows(reserved1: int = ..., reserved2: int = ...) -> None: ... +def ExitWindowsEx(flags, reserved: int = ...) -> None: ... +def FindFiles(fileSpec: str): ... +def FindFirstChangeNotification(pathName: str, bSubDirs, _filter): ... +def FindNextChangeNotification(handle: int) -> None: ... +def FindCloseChangeNotification(handle) -> None: ... +def FindExecutable(filename: str, _dir: str) -> tuple[Incomplete, str]: ... +def FormatMessage(flags, source, messageId, languageID, inserts, errCode: int = ...) -> str: ... +def FormatMessageW(flags, source, messageId, languageID, inserts, errCode: int = ...) -> str: ... +def FreeLibrary(hModule: int) -> None: ... +def GenerateConsoleCtrlEvent(controlEvent, processGroupId): ... +def GetAsyncKeyState(key): ... +def GetCommandLine() -> str: ... +def GetComputerName() -> str: ... +def GetComputerNameEx(NameType) -> str: ... +def GetComputerObjectName(NameFormat) -> str: ... +def GetMonitorInfo(hMonitor: int) -> _MonitorInfo: ... +def GetUserName() -> str: ... +def GetUserNameEx(NameFormat) -> str: ... +def GetCursorPos() -> tuple[Incomplete, Incomplete]: ... +def GetCurrentThread(): ... +def GetCurrentThreadId(): ... +def GetCurrentProcessId(): ... +def GetCurrentProcess(): ... +def GetConsoleTitle() -> str: ... +def GetDateFormat(locale, flags, time: _win32typing.PyTime, _format: str) -> str: ... +def GetDiskFreeSpace(rootPath: str): ... +def GetDiskFreeSpaceEx(rootPath: str): ... +def GetDllDirectory() -> str: ... +def GetDomainName() -> str: ... +def GetEnvironmentVariable(variable): ... +def GetEnvironmentVariableW(Name) -> str: ... +def GetFileAttributes(pathName: str): ... +def GetFileVersionInfo(Filename: str, SubBlock: str) -> None: ... +def GetFocus(): ... +def GetFullPathName(fileName: str) -> str: ... +def GetHandleInformation(Object: int): ... +def GetKeyboardLayout(threadId: int = ...): ... +def GetKeyboardLayoutName(): ... +def GetKeyboardState() -> str: ... +def GetKeyState(key): ... +def GetLastError(): ... +def GetLastInputInfo(): ... +def GetLocalTime(): ... +def GetLongPathName(fileName: str) -> str: ... +def GetLongPathNameW(fileName: str) -> str: ... +def GetLogicalDrives(): ... +def GetLogicalDriveStrings() -> str: ... +def GetModuleFileName(hModule: int) -> str: ... +def GetModuleFileNameW(hModule: int) -> str: ... +def GetModuleHandle(fileName: str | None = ...): ... +def GetPwrCapabilities(): ... +def GetProfileSection(section: str, iniName: str | None = ...): ... +def GetProcAddress(hModule: int, functionName: _win32typing.PyResourceId): ... +def GetProfileVal(section: str, entry: str, defValue: str, iniName: str | None = ...) -> str: ... +def GetShortPathName(path: str) -> str: ... +def GetStdHandle(handle) -> None: ... +def GetSysColor(index): ... +def GetSystemDefaultLangID(): ... +def GetSystemDefaultLCID(): ... +def GetSystemDirectory() -> str: ... +def GetSystemFileCacheSize(): ... +def SetSystemFileCacheSize(MinimumFileCacheSize, MaximumFileCacheSize, Flags=...) -> None: ... +def GetSystemInfo(): ... +def GetNativeSystemInfo(): ... +def GetSystemMetrics(index): ... +def GetSystemTime(): ... +def GetTempFileName(path: str, prefix: str, nUnique): ... +def GetTempPath() -> str: ... +def GetThreadLocale(): ... +def GetTickCount(): ... +def GetTimeFormat(locale, flags, time: _win32typing.PyTime, _format: str) -> str: ... +def GetTimeZoneInformation(times_as_tuples: bool = ...): ... +def GetVersion(): ... +def GetVersionEx(_format: int = ...): ... +def GetVolumeInformation(path: str): ... +def GetWindowsDirectory() -> str: ... +def GetWindowLong(hwnd: int, offset): ... +def GetUserDefaultLangID(): ... +def GetUserDefaultLCID(): ... +def GlobalMemoryStatus(): ... +def GlobalMemoryStatusEx(): ... +def keybd_event(bVk, bScan, dwFlags: int = ..., dwExtraInfo: int = ...) -> None: ... +def mouse_event(dx, dy, dwData, dwFlags: int = ..., dwExtraInfo=...) -> None: ... +def LoadCursor(hInstance: int, cursorid: _win32typing.PyResourceId) -> int: ... +def LoadKeyboardLayout(KLID: str, Flags: int = ...): ... +def LoadLibrary(fileName: str): ... +def LoadLibraryEx(fileName: str, handle: int, handle1) -> int: ... +def LoadResource(handle: int, _type: _win32typing.PyResourceId, name: _win32typing.PyResourceId, language) -> str: ... +def LoadString(handle: int, stringId, numChars: int = ...) -> str: ... +def MessageBeep(arg): ... +def MessageBox(hwnd: int, message: str, title: str, arg, arg1): ... +def MonitorFromPoint(pt: tuple[Incomplete, Incomplete], Flags: int = ...) -> int: ... +def MonitorFromRect(__rc: _win32typing.PyRECT | tuple[int, int, int, int], __Flags: int = ...) -> int: ... +def MonitorFromWindow(hwnd: int, Flags: int = ...) -> int: ... +def MoveFile(srcName: str, destName: str) -> None: ... +def MoveFileEx(srcName: str, destName: str, flag) -> None: ... +def OpenProcess(reqdAccess, bInherit, pid) -> int: ... +def OutputDebugString(msg: str) -> None: ... +def PostMessage(hwnd: int, idMessage, wParam: Incomplete | None = ..., lParam: Incomplete | None = ...) -> None: ... +def PostQuitMessage(exitCode: int = ...) -> None: ... +def PostThreadMessage(tid, idMessage, wParam: Incomplete | None = ..., lParam: Incomplete | None = ...) -> None: ... +def RegCloseKey(key: _win32typing.PyHKEY) -> None: ... +def RegConnectRegistry(computerName: str, key): ... +def RegCopyTree(KeySrc: _win32typing.PyHKEY, SubKey: str, KeyDest: _win32typing.PyHKEY) -> None: ... +def RegCreateKey(key: _win32typing.PyHKEY, subKey: str) -> _win32typing.PyHKEY: ... +def RegCreateKeyEx( + Key: _win32typing.PyHKEY, + SubKey: str, + samDesired, + Options, + Class: str | None = ..., + SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., + Transaction: int | None = ..., +) -> tuple[_win32typing.PyHKEY, Incomplete]: ... +def RegDeleteKey(key: _win32typing.PyHKEY, subKey: str) -> None: ... +def RegDeleteKeyEx(Key: _win32typing.PyHKEY, SubKey: str, samDesired: int = ..., Transaction: int | None = ...) -> None: ... +def RegDeleteTree(Key: _win32typing.PyHKEY, SubKey: str) -> None: ... +def RegDeleteValue(key: _win32typing.PyHKEY, value: str) -> None: ... +def RegEnumKey(key: _win32typing.PyHKEY, index) -> str: ... +def RegEnumKeyEx(Key: _win32typing.PyHKEY): ... +def RegEnumKeyExW(Key: _win32typing.PyHKEY): ... +def RegEnumValue(key: _win32typing.PyHKEY, index) -> tuple[str, Incomplete, Incomplete]: ... +def RegFlushKey(key: _win32typing.PyHKEY) -> None: ... +def RegGetKeySecurity(key: _win32typing.PyHKEY, security_info) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def RegLoadKey(key: _win32typing.PyHKEY, subKey: str, filename: str) -> None: ... +def RegOpenCurrentUser(samDesired) -> _win32typing.PyHKEY: ... +def RegOpenKey() -> _win32typing.PyHKEY: ... +def RegOpenKeyEx(key: _win32typing.PyHKEY, subKey: str, sam, reserved=...) -> _win32typing.PyHKEY: ... +def RegOpenKeyTransacted( + Key: _win32typing.PyHKEY, SubKey: str, samDesired, Transaction: int, Options: int = ... +) -> _win32typing.PyHKEY: ... +def RegOverridePredefKey(Key: _win32typing.PyHKEY, NewKey: _win32typing.PyHKEY) -> None: ... +def RegQueryValue(key: _win32typing.PyHKEY, subKey: str) -> str: ... +def RegQueryValueEx(key: _win32typing.PyHKEY, valueName: str) -> tuple[Incomplete, Incomplete]: ... +def RegQueryInfoKey(key: _win32typing.PyHKEY) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def RegQueryInfoKeyW(Key: _win32typing.PyHKEY): ... +def RegRestoreKey(Key: _win32typing.PyHKEY, File: str, Flags: int = ...) -> None: ... +def RegSaveKey(key: _win32typing.PyHKEY, filename: str, sa: _win32typing.PySECURITY_ATTRIBUTES | None = ...) -> None: ... +def RegSaveKeyEx( + Key: _win32typing.PyHKEY, File: str, Flags, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ... +) -> None: ... +def RegSetKeySecurity(key: _win32typing.PyHKEY, security_info, sd: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... +def RegSetValue(key: _win32typing.PyHKEY, subKey: str, _type, value: str) -> None: ... +def RegSetValueEx(key: _win32typing.PyHKEY, valueName: str, reserved, _type, value) -> None: ... +def RegUnLoadKey(key: _win32typing.PyHKEY, subKey: str) -> None: ... +def RegisterWindowMessage(msgString: str) -> None: ... +def RegNotifyChangeKeyValue(key: _win32typing.PyHKEY, bWatchSubTree, dwNotifyFilter, hKey: int, fAsynchronous) -> None: ... +def SearchPath(path: str, fileName: str, fileExt: str | None = ...): ... +def SendMessage(hwnd: int, idMessage, wParam: str | None = ..., lParam: str | None = ...) -> None: ... +def SetConsoleCtrlHandler(ctrlHandler, bAdd) -> None: ... +def SetConsoleTitle(title: str) -> None: ... +def SetCursorPos(arg: tuple[Incomplete, Incomplete]) -> None: ... +def SetDllDirectory(PathName: str) -> None: ... +def SetErrorMode(errorMode): ... +def SetFileAttributes(pathName: str, attrs): ... +def SetLastError(): ... +def SetSysColors(Elements, RgbValues) -> None: ... +def SetLocalTime(SystemTime: _win32typing.PyTime) -> None: ... +def SetSystemTime(year, month, dayOfWeek, day, hour, minute, second, millseconds): ... +def SetClassLong(hwnd: int, offset, val): ... +def SetClassWord(hwnd: int, offset, val): ... +def SetCursor(hCursor: int) -> int: ... +def SetEnvironmentVariable(Name, Value) -> None: ... +def SetEnvironmentVariableW(Name, Value) -> None: ... +def SetHandleInformation(Object: int, Mask, Flags) -> None: ... +def SetStdHandle(handle, handle1: int) -> None: ... +def SetSystemPowerState(Suspend, Force) -> None: ... +def SetThreadLocale(lcid) -> None: ... +def SetTimeZoneInformation(tzi): ... +def SetWindowLong(hwnd: int, offset, val): ... +def ShellExecute(hwnd: int, op: str, file: str, params: str, _dir: str, bShow): ... +def ShowCursor(show): ... +def Sleep(time, bAlterable: int = ...): ... +def TerminateProcess(handle: int, exitCode) -> None: ... +def ToAsciiEx(vk, scancode, keyboardstate, flags: int = ..., hlayout: Incomplete | None = ...): ... +def Unicode() -> str: ... +def UpdateResource( + handle: int, _type: _win32typing.PyResourceId, name: _win32typing.PyResourceId, data: str, language +) -> None: ... +def VkKeyScan(char, char1): ... +def WinExec(cmdLine: str, arg) -> None: ... +def WinHelp(hwnd: int, hlpFile: str, cmd, data: str | int = ...) -> None: ... +def WriteProfileSection(section: str, data: str, iniName: str | None = ...): ... +def WriteProfileVal(section: str, entry: str, value: str, iniName: str | None = ...) -> None: ... +def HIBYTE(val): ... +def LOBYTE(val): ... +def HIWORD(val): ... +def LOWORD(val): ... +def RGB(red, green, blue): ... +def MAKELANGID(PrimaryLanguage, SubLanguage): ... +def MAKEWORD(low, high): ... +def MAKELONG(low, high): ... +def CommandLineToArgv(*args, **kwargs): ... # incomplete +def GetKeyboardLayoutList(*args, **kwargs): ... # incomplete +def MapVirtualKey(*args, **kwargs): ... # incomplete +def MessageBoxEx(*args, **kwargs): ... # incomplete +def OpenThread(*args, **kwargs): ... # incomplete +def SleepEx(*args, **kwargs): ... # incomplete +def VkKeyScanEx(*args, **kwargs): ... # incomplete + +NameCanonical: int +NameCanonicalEx: int +NameDisplay: int +NameFullyQualifiedDN: int +NameSamCompatible: int +NameServicePrincipal: int +NameUniqueId: int +NameUnknown: int +NameUserPrincipal: int +PyDISPLAY_DEVICEType = _win32typing.PyDISPLAY_DEVICE +REG_NOTIFY_CHANGE_ATTRIBUTES: int +REG_NOTIFY_CHANGE_LAST_SET: int +REG_NOTIFY_CHANGE_NAME: int +REG_NOTIFY_CHANGE_SECURITY: int +STD_ERROR_HANDLE: int +STD_INPUT_HANDLE: int +STD_OUTPUT_HANDLE: int +VFT_APP: int +VFT_DLL: int +VFT_DRV: int +VFT_FONT: int +VFT_STATIC_LIB: int +VFT_UNKNOWN: int +VFT_VXD: int +VOS_DOS: int +VOS_DOS_WINDOWS16: int +VOS_DOS_WINDOWS32: int +VOS_NT: int +VOS_NT_WINDOWS32: int +VOS_OS216: int +VOS_OS216_PM16: int +VOS_OS232: int +VOS_OS232_PM32: int +VOS_UNKNOWN: int +VOS__PM16: int +VOS__PM32: int +VOS__WINDOWS16: int +VOS__WINDOWS32: int +VS_FF_DEBUG: int +VS_FF_INFOINFERRED: int +VS_FF_PATCHED: int +VS_FF_PRERELEASE: int +VS_FF_PRIVATEBUILD: int +VS_FF_SPECIALBUILD: int diff --git a/stubs/pywin32/win32/win32clipboard.pyi b/stubs/pywin32/win32/win32clipboard.pyi new file mode 100644 index 0000000..5fbc2c4 --- /dev/null +++ b/stubs/pywin32/win32/win32clipboard.pyi @@ -0,0 +1,47 @@ +from win32.lib.pywintypes import error as error + +def ChangeClipboardChain(hWndRemove: int, hWndNewNext: int): ... +def CloseClipboard(): ... +def CountClipboardFormats(): ... +def EmptyClipboard(): ... +def EnumClipboardFormats(_format: int = ...): ... +def GetClipboardData(_format) -> str: ... +def GetClipboardDataHandle(_format): ... +def GetClipboardFormatName(_format) -> str: ... +def GetClipboardOwner(): ... +def GetClipboardSequenceNumber(): ... +def GetClipboardViewer(): ... +def GetGlobalMemory(hglobal: int) -> str: ... +def GetOpenClipboardWindow(): ... +def GetPriorityClipboardFormat(formats): ... +def IsClipboardFormatAvailable(__format: int) -> int: ... +def OpenClipboard(hWnd: int | None = ...): ... +def RegisterClipboardFormat(name: str): ... +def SetClipboardData(_format, hMem): ... +def SetClipboardText(text, _format): ... +def SetClipboardViewer(hWndNewViewer: int) -> int: ... + +CF_BITMAP: int +CF_DIB: int +CF_DIBV5: int +CF_DIF: int +CF_DSPBITMAP: int +CF_DSPENHMETAFILE: int +CF_DSPMETAFILEPICT: int +CF_DSPTEXT: int +CF_ENHMETAFILE: int +CF_HDROP: int +CF_LOCALE: int +CF_MAX: int +CF_METAFILEPICT: int +CF_OEMTEXT: int +CF_OWNERDISPLAY: int +CF_PALETTE: int +CF_PENDATA: int +CF_RIFF: int +CF_SYLK: int +CF_TEXT: int +CF_TIFF: int +CF_UNICODETEXT: int +CF_WAVE: int +UNICODE: bool diff --git a/stubs/pywin32/win32/win32console.pyi b/stubs/pywin32/win32/win32console.pyi new file mode 100644 index 0000000..eccd920 --- /dev/null +++ b/stubs/pywin32/win32/win32console.pyi @@ -0,0 +1,74 @@ +import _win32typing +from win32.lib.pywintypes import error as error + +def CreateConsoleScreenBuffer( + DesiredAccess, ShareMode, Flags, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ... +) -> _win32typing.PyConsoleScreenBuffer: ... +def GetConsoleDisplayMode(): ... +def AttachConsole(ProcessId) -> None: ... +def AllocConsole() -> None: ... +def FreeConsole() -> None: ... +def GetConsoleCP(): ... +def GetConsoleOutputCP(): ... +def SetConsoleCP(CodePageId) -> None: ... +def SetConsoleOutputCP(CodePageID) -> None: ... +def GetConsoleSelectionInfo(): ... +def AddConsoleAlias(Source, Target, ExeName) -> None: ... +def GetConsoleAliases(ExeName): ... +def GetConsoleAliasExes(): ... +def GetConsoleWindow(): ... +def GetNumberOfConsoleFonts(): ... +def SetConsoleTitle(ConsoleTitle) -> None: ... +def GetConsoleTitle(): ... +def GenerateConsoleCtrlEvent(CtrlEvent, ProcessGroupId: int = ...) -> None: ... +def GetStdHandle(StdHandle) -> _win32typing.PyConsoleScreenBuffer: ... +def GetConsoleProcessList(*args, **kwargs): ... # incomplete + +ATTACH_PARENT_PROCESS: int +BACKGROUND_BLUE: int +BACKGROUND_GREEN: int +BACKGROUND_INTENSITY: int +BACKGROUND_RED: int +COMMON_LVB_GRID_HORIZONTAL: int +COMMON_LVB_GRID_LVERTICAL: int +COMMON_LVB_GRID_RVERTICAL: int +COMMON_LVB_LEADING_BYTE: int +COMMON_LVB_REVERSE_VIDEO: int +COMMON_LVB_TRAILING_BYTE: int +COMMON_LVB_UNDERSCORE: int +CONSOLE_FULLSCREEN: int +CONSOLE_FULLSCREEN_HARDWARE: int +CONSOLE_FULLSCREEN_MODE: int +CONSOLE_MOUSE_DOWN: int +CONSOLE_MOUSE_SELECTION: int +CONSOLE_NO_SELECTION: int +CONSOLE_SELECTION_IN_PROGRESS: int +CONSOLE_SELECTION_NOT_EMPTY: int +CONSOLE_TEXTMODE_BUFFER: int +CONSOLE_WINDOWED_MODE: int +CTRL_BREAK_EVENT: int +CTRL_C_EVENT: int +ENABLE_ECHO_INPUT: int +ENABLE_LINE_INPUT: int +ENABLE_MOUSE_INPUT: int +ENABLE_PROCESSED_INPUT: int +ENABLE_PROCESSED_OUTPUT: int +ENABLE_WINDOW_INPUT: int +ENABLE_WRAP_AT_EOL_OUTPUT: int +FOCUS_EVENT: int +FOREGROUND_BLUE: int +FOREGROUND_GREEN: int +FOREGROUND_INTENSITY: int +FOREGROUND_RED: int +KEY_EVENT: int +LOCALE_USER_DEFAULT: int +MENU_EVENT: int +MOUSE_EVENT: int +PyCOORDType = _win32typing.PyCOORD +PyConsoleScreenBufferType = _win32typing.PyConsoleScreenBuffer +PyINPUT_RECORDType = _win32typing.PyINPUT_RECORD +PySMALL_RECTType = _win32typing.PySMALL_RECT +STD_ERROR_HANDLE: int +STD_INPUT_HANDLE: int +STD_OUTPUT_HANDLE: int +WINDOW_BUFFER_SIZE_EVENT: int diff --git a/stubs/pywin32/win32/win32cred.pyi b/stubs/pywin32/win32/win32cred.pyi new file mode 100644 index 0000000..a915399 --- /dev/null +++ b/stubs/pywin32/win32/win32cred.pyi @@ -0,0 +1,85 @@ +from _typeshed import Incomplete + +def CredMarshalCredential(CredType, Credential: str) -> str: ... +def CredUnmarshalCredential(MarshaledCredential: str) -> tuple[Incomplete, str]: ... +def CredIsMarshaledCredential(MarshaledCredential: str): ... +def CredEnumerate(Filter: str | None = ..., Flags: int = ...) -> tuple[Incomplete, ...]: ... +def CredGetTargetInfo(TargetName: str, Flags: int = ...): ... +def CredWriteDomainCredentials(TargetInfo, Credential, Flags: int = ...) -> None: ... +def CredReadDomainCredentials(TargetInfo, Flags: int = ...) -> tuple[Incomplete, ...]: ... +def CredDelete(TargetName: str, Type, Flags: int = ...) -> None: ... +def CredWrite(Credential, Flags: int = ...) -> None: ... +def CredRead(TargetName: str, Type, Flags: int = ...): ... +def CredRename(OldTargetName: str, NewTargetName: str, Type, Flags: int = ...): ... +def CredUICmdLinePromptForCredentials( + TargetName: str, Flags, AuthError: int = ..., UserName: str | None = ..., Password: str | None = ..., Save: int = ... +) -> tuple[str, str, Incomplete]: ... +def CredUIPromptForCredentials( + TargetName: str, + AuthError: int = ..., + UserName: str | None = ..., + Password: str | None = ..., + Save: bool = ..., + Flags: int = ..., + UiInfo: Incomplete | None = ..., +) -> tuple[str, str, Incomplete]: ... +def CredUIConfirmCredentials(TargetName: str, Confirm) -> None: ... +def CredUIReadSSOCredW(Realm: str | None = ...) -> str: ... +def CredUIStoreSSOCredW(Realm: str, Username: str, Password: str, Persist) -> None: ... +def CredUIParseUserName(UserName: str) -> tuple[str, str]: ... + +CREDUI_FLAGS_ALWAYS_SHOW_UI: int +CREDUI_FLAGS_COMPLETE_USERNAME: int +CREDUI_FLAGS_DO_NOT_PERSIST: int +CREDUI_FLAGS_EXCLUDE_CERTIFICATES: int +CREDUI_FLAGS_EXPECT_CONFIRMATION: int +CREDUI_FLAGS_GENERIC_CREDENTIALS: int +CREDUI_FLAGS_INCORRECT_PASSWORD: int +CREDUI_FLAGS_KEEP_USERNAME: int +CREDUI_FLAGS_PASSWORD_ONLY_OK: int +CREDUI_FLAGS_PERSIST: int +CREDUI_FLAGS_PROMPT_VALID: int +CREDUI_FLAGS_REQUEST_ADMINISTRATOR: int +CREDUI_FLAGS_REQUIRE_CERTIFICATE: int +CREDUI_FLAGS_REQUIRE_SMARTCARD: int +CREDUI_FLAGS_SERVER_CREDENTIAL: int +CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX: int +CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS: int +CREDUI_FLAGS_VALIDATE_USERNAME: int +CREDUI_MAX_CAPTION_LENGTH: int +CREDUI_MAX_DOMAIN_TARGET_LENGTH: int +CREDUI_MAX_GENERIC_TARGET_LENGTH: int +CREDUI_MAX_MESSAGE_LENGTH: int +CREDUI_MAX_PASSWORD_LENGTH: int +CREDUI_MAX_USERNAME_LENGTH: int +CRED_ALLOW_NAME_RESOLUTION: int +CRED_CACHE_TARGET_INFORMATION: int +CRED_FLAGS_OWF_CRED_BLOB: int +CRED_FLAGS_PASSWORD_FOR_CERT: int +CRED_FLAGS_PROMPT_NOW: int +CRED_FLAGS_USERNAME_TARGET: int +CRED_FLAGS_VALID_FLAGS: int +CRED_MAX_ATTRIBUTES: int +CRED_MAX_DOMAIN_TARGET_NAME_LENGTH: int +CRED_MAX_GENERIC_TARGET_NAME_LENGTH: int +CRED_MAX_STRING_LENGTH: int +CRED_MAX_USERNAME_LENGTH: int +CRED_MAX_VALUE_SIZE: int +CRED_PERSIST_ENTERPRISE: int +CRED_PERSIST_LOCAL_MACHINE: int +CRED_PERSIST_NONE: int +CRED_PERSIST_SESSION: int +CRED_PRESERVE_CREDENTIAL_BLOB: int +CRED_TI_CREATE_EXPLICIT_CRED: int +CRED_TI_DOMAIN_FORMAT_UNKNOWN: int +CRED_TI_ONLY_PASSWORD_REQUIRED: int +CRED_TI_SERVER_FORMAT_UNKNOWN: int +CRED_TI_USERNAME_TARGET: int +CRED_TI_VALID_FLAGS: int +CRED_TI_WORKGROUP_MEMBER: int +CRED_TYPE_DOMAIN_CERTIFICATE: int +CRED_TYPE_DOMAIN_PASSWORD: int +CRED_TYPE_DOMAIN_VISIBLE_PASSWORD: int +CRED_TYPE_GENERIC: int +CertCredential: int +UsernameTargetCredential: int diff --git a/stubs/pywin32/win32/win32crypt.pyi b/stubs/pywin32/win32/win32crypt.pyi new file mode 100644 index 0000000..9a5d442 --- /dev/null +++ b/stubs/pywin32/win32/win32crypt.pyi @@ -0,0 +1,100 @@ +from _typeshed import Incomplete + +import _win32typing + +def CryptProtectData( + DataIn, + DataDescr: str | None = ..., + OptionalEntropy: Incomplete | None = ..., + Reserved: Incomplete | None = ..., + PromptStruct: _win32typing.PyCRYPTPROTECT_PROMPTSTRUCT | None = ..., + Flags: int = ..., +): ... +def CryptUnprotectData( + DataIn, + OptionalEntropy: Incomplete | None = ..., + Reserved: Incomplete | None = ..., + PromptStruct: _win32typing.PyCRYPTPROTECT_PROMPTSTRUCT | None = ..., + Flags: int = ..., +) -> tuple[Incomplete, Incomplete]: ... +def CryptEnumProviders() -> list[tuple[str, Incomplete]]: ... +def CryptEnumProviderTypes() -> list[tuple[str, Incomplete]]: ... +def CryptGetDefaultProvider(ProvType, Flags) -> str: ... +def CryptSetProviderEx(ProvName: str, ProvType, Flags) -> None: ... +def CryptAcquireContext(Container: str, Provider: str, ProvType, Flags) -> _win32typing.PyCRYPTPROV: ... +def CryptFindLocalizedName(CryptName: str) -> str: ... +def CertEnumSystemStore(dwFlags, pvSystemStoreLocationPara: Incomplete | None = ...) -> list[Incomplete]: ... +def CertEnumSystemStoreLocation(Flags: int = ...) -> list[Incomplete]: ... +def CertEnumPhysicalStore(pvSystemStore: str, dwFlags) -> list[Incomplete]: ... +def CertRegisterSystemStore(SystemStore: str, Flags) -> None: ... +def CertUnregisterSystemStore(SystemStore: str, Flags) -> None: ... +def CertOpenStore( + StoreProvider, MsgAndCertEncodingType, CryptProv: _win32typing.PyCRYPTPROV, Flags, Para: Incomplete | None = ... +) -> _win32typing.PyCERTSTORE: ... +def CertOpenSystemStore(SubsystemProtocol: str, Prov: _win32typing.PyCRYPTPROV | None = ...) -> _win32typing.PyCERTSTORE: ... +def CryptFindOIDInfo(KeyType, Key, GroupId: int = ...): ... +def CertAlgIdToOID(AlgId) -> str: ... +def CertOIDToAlgId(ObjId: str): ... +def CryptGetKeyIdentifierProperty(KeyIdentifier: str, PropId, Flags: int = ..., ComputerName: str | None = ...): ... +def CryptEnumKeyIdentifierProperties( + KeyIdentifier: str | None = ..., PropId: int = ..., Flags: int = ..., ComputerName: str | None = ... +): ... +def CryptEnumOIDInfo(GroupId: int = ...): ... +def CertAddSerializedElementToStore( + CertStore: _win32typing.PyCERTSTORE, Element, AddDisposition, ContextTypeFlags, Flags: int = ... +) -> _win32typing.PyCERT_CONTEXT: ... +def CryptQueryObject(ObjectType, Object, ExpectedContentTypeFlags, ExpectedFormatTypeFlags, Flags: int = ...): ... +def CryptDecodeMessage( + EncodedBlob, + DecryptPara, + MsgTypeFlags, + VerifyPara: Incomplete | None = ..., + SignerIndex: int = ..., + PrevInnerContentType: int = ..., + ReturnData: bool = ..., +): ... +def CryptEncryptMessage( + EncryptPara: _win32typing.PyCRYPT_ENCRYPT_MESSAGE_PARA, RecipientCert: tuple[_win32typing.PyCERT_CONTEXT, ...], ToBeEncrypted +): ... +def CryptDecryptMessage( + DecryptPara: _win32typing.PyCRYPT_DECRYPT_MESSAGE_PARA, EncryptedBlob +) -> tuple[Incomplete, _win32typing.PyCERT_CONTEXT]: ... +def CryptSignAndEncryptMessage( + SignPara: _win32typing.PyCRYPT_SIGN_MESSAGE_PARA, + EncryptPara: _win32typing.PyCRYPT_ENCRYPT_MESSAGE_PARA, + RecipientCert: tuple[_win32typing.PyCERT_CONTEXT, ...], + ToBeSignedAndEncrypted, +): ... +def CryptVerifyMessageSignature( + SignedBlob, SignerIndex: int = ..., VerifyPara: _win32typing.PyCRYPT_VERIFY_MESSAGE_PARA | None = ..., ReturnData: bool = ... +) -> tuple[_win32typing.PyCERT_CONTEXT, Incomplete]: ... +def CryptGetMessageCertificates( + SignedBlob, MsgAndCertEncodingType, CryptProv: _win32typing.PyCRYPTPROV | None = ..., Flags: int = ... +) -> _win32typing.PyCERTSTORE: ... +def CryptGetMessageSignerCount(SignedBlob, MsgEncodingType): ... +def CryptSignMessage( + SignPara: _win32typing.PyCRYPT_SIGN_MESSAGE_PARA, ToBeSigned: tuple[Incomplete, ...], DetachedSignature: bool = ... +): ... +def CryptVerifyDetachedMessageSignature( + SignerIndex, + DetachedSignBlob, + ToBeSigned: tuple[Incomplete, ...], + VerifyPara: _win32typing.PyCRYPT_VERIFY_MESSAGE_PARA | None = ..., +) -> _win32typing.PyCERT_CONTEXT: ... +def CryptDecryptAndVerifyMessageSignature( + EncryptedBlob, + DecryptPara: _win32typing.PyCRYPT_DECRYPT_MESSAGE_PARA, + VerifyPara: _win32typing.PyCRYPT_VERIFY_MESSAGE_PARA | None = ..., + SignerIndex: int = ..., +): ... +def CryptEncodeObjectEx(StructType, StructInfo, CertEncodingType, Flags: int = ..., EncodePara: Incomplete | None = ...): ... +def CryptDecodeObjectEx(StructType, Encoded, CertEncodingType, Flags: int = ..., DecodePara: Incomplete | None = ...): ... +def CertNameToStr(Name, StrType, CertEncodingType): ... +def CryptFormatObject( + StructType, Encoded, CertEncodingType, FormatStrType: int = ..., FormatType: int = ..., FormatStruct: Incomplete | None = ... +): ... +def PFXImportCertStore(PFX, Password, Flags) -> _win32typing.PyCERTSTORE: ... +def PFXVerifyPassword(PFX, Password, Flags): ... +def PFXIsPFXBlob(PFX): ... +def CryptBinaryToString(Binary, Flags): ... +def CryptStringToBinary(String, Flags) -> tuple[Incomplete, Incomplete, Incomplete]: ... diff --git a/stubs/pywin32/win32/win32event.pyi b/stubs/pywin32/win32/win32event.pyi new file mode 100644 index 0000000..b552a45 --- /dev/null +++ b/stubs/pywin32/win32/win32event.pyi @@ -0,0 +1,53 @@ +import _win32typing +from win32.lib.pywintypes import error as error + +def CancelWaitableTimer() -> None: ... +def CreateEvent(EventAttributes: _win32typing.PySECURITY_ATTRIBUTES, bManualReset, bInitialState, Name: str) -> int: ... +def CreateMutex(MutexAttributes: _win32typing.PySECURITY_ATTRIBUTES, InitialOwner, Name: str) -> int: ... +def CreateSemaphore( + SemaphoreAttributes: _win32typing.PySECURITY_ATTRIBUTES, InitialCount, MaximumCount, SemaphoreName +) -> int: ... +def CreateWaitableTimer(TimerAttributes: _win32typing.PySECURITY_ATTRIBUTES, ManualReset, TimerName) -> int: ... +def MsgWaitForMultipleObjects(handlelist: list[int], bWaitAll, milliseconds, wakeMask): ... +def MsgWaitForMultipleObjectsEx(handlelist: list[int], milliseconds, wakeMask, waitFlags): ... +def OpenEvent(desiredAccess, bInheritHandle, name: str) -> int: ... +def OpenMutex(desiredAccess, bInheritHandle, name: str) -> int: ... +def OpenSemaphore(desiredAccess, bInheritHandle, name: str) -> int: ... +def OpenWaitableTimer(desiredAccess, bInheritHandle, timerName) -> int: ... +def PulseEvent(hEvent: int) -> None: ... +def ReleaseMutex(hEvent: int) -> None: ... +def ReleaseSemaphore(hEvent: int, lReleaseCount): ... +def ResetEvent(hEvent: int) -> None: ... +def SetEvent(hEvent: int) -> None: ... +def SetWaitableTimer(handle: int, dueTime, period, func, param, resume_state) -> None: ... +def WaitForMultipleObjects(handlelist: list[int], bWaitAll, milliseconds): ... +def WaitForMultipleObjectsEx(handlelist: list[int], bWaitAll, milliseconds, bAlertable): ... +def WaitForSingleObject(hHandle: int, milliseconds): ... +def WaitForSingleObjectEx(hHandle: int, milliseconds, bAlertable): ... +def WaitForInputIdle(hProcess: int, milliseconds): ... +def SignalObjectAndWait(*args, **kwargs): ... # incomplete + +EVENT_ALL_ACCESS: int +EVENT_MODIFY_STATE: int +INFINITE: int +MAXIMUM_WAIT_OBJECTS: int +QS_ALLEVENTS: int +QS_ALLINPUT: int +QS_HOTKEY: int +QS_INPUT: int +QS_KEY: int +QS_MOUSE: int +QS_MOUSEBUTTON: int +QS_MOUSEMOVE: int +QS_PAINT: int +QS_POSTMESSAGE: int +QS_SENDMESSAGE: int +QS_TIMER: int +SYNCHRONIZE: int +WAIT_ABANDONED: int +WAIT_ABANDONED_0: int +WAIT_FAILED: int +WAIT_IO_COMPLETION: int +WAIT_OBJECT_0: int +WAIT_TIMEOUT: int +UNICODE: int diff --git a/stubs/pywin32/win32/win32evtlog.pyi b/stubs/pywin32/win32/win32evtlog.pyi new file mode 100644 index 0000000..5a9685d --- /dev/null +++ b/stubs/pywin32/win32/win32evtlog.pyi @@ -0,0 +1,260 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def ReadEventLog(Handle, Flags, Offset, Size=...) -> list[Incomplete]: ... +def ClearEventLog(handle, eventLogName: str) -> None: ... +def BackupEventLog(handle, eventLogName: str) -> None: ... +def CloseEventLog(handle) -> None: ... +def DeregisterEventSource(handle) -> None: ... +def NotifyChangeEventLog(handle, handle1) -> None: ... +def GetNumberOfEventLogRecords(handle): ... +def GetOldestEventLogRecord(): ... +def OpenEventLog(serverName: str, sourceName: str) -> _win32typing.PyEVTLOG_HANDLE: ... +def RegisterEventSource(serverName: str, sourceName: str): ... +def OpenBackupEventLog(serverName: str, fileName: str) -> _win32typing.PyEVTLOG_HANDLE: ... +def ReportEvent(EventLog: int, Type, Category, EventID, UserSid: _win32typing.PySID, Strings, RawData) -> None: ... +def EvtOpenChannelEnum(Session: _win32typing.PyEVT_HANDLE | None = ..., Flags: int = ...) -> _win32typing.PyEVT_HANDLE: ... +def EvtNextChannelPath(ChannelEnum: _win32typing.PyEVT_HANDLE): ... +def EvtOpenLog(Path, Flags, Session: _win32typing.PyEVT_HANDLE | None = ...) -> _win32typing.PyEVT_HANDLE: ... +def EvtClearLog( + ChannelPath, TargetFilePath: Incomplete | None = ..., Session: _win32typing.PyEVT_HANDLE | None = ..., Flags: int = ... +) -> None: ... +def EvtExportLog( + Path, TargetFilePath, Flags, Query: Incomplete | None = ..., Session: _win32typing.PyEVT_HANDLE | None = ... +) -> None: ... +def EvtArchiveExportedLog(LogFilePath, Locale, Session: _win32typing.PyEVT_HANDLE | None = ..., Flags=...) -> None: ... +def EvtGetExtendedStatus(): ... +def EvtQuery( + Path, Flags, Query: Incomplete | None = ..., Session: _win32typing.PyEVT_HANDLE | None = ... +) -> _win32typing.PyEVT_HANDLE: ... +def EvtNext( + ResultSet: _win32typing.PyEVT_HANDLE, Count, Timeout: int = ..., Flags=... +) -> tuple[_win32typing.PyEVT_HANDLE, ...]: ... +def EvtSeek( + ResultSet: _win32typing.PyEVT_HANDLE, Position, Flags, Bookmark: _win32typing.PyEVT_HANDLE | None = ..., Timeout: int = ... +) -> None: ... +def EvtRender(Event: _win32typing.PyEVT_HANDLE, Flags): ... +def EvtSubscribe( + ChannelPath, + Flags, + SignalEvent: Incomplete | None = ..., + Callback: Incomplete | None = ..., + Context: Incomplete | None = ..., + Query: Incomplete | None = ..., + Session: _win32typing.PyEVT_HANDLE | None = ..., + Bookmark: _win32typing.PyEVT_HANDLE | None = ..., +) -> _win32typing.PyEVT_HANDLE: ... +def EvtCreateBookmark(BookmarkXML: Incomplete | None = ...) -> _win32typing.PyEVT_HANDLE: ... +def EvtUpdateBookmark(Bookmark: _win32typing.PyEVT_HANDLE, Event: _win32typing.PyEVT_HANDLE) -> _win32typing.PyEVT_HANDLE: ... +def EvtGetChannelConfigProperty( + ChannelConfig: _win32typing.PyEVT_HANDLE, PropertyId, Flags=... +) -> tuple[Incomplete, Incomplete]: ... +def EvtOpenChannelConfig( + ChannelPath, Session: _win32typing.PyEVT_HANDLE | None = ..., Flags=... +) -> _win32typing.PyEVT_HANDLE: ... +def EvtOpenSession( + Login: _win32typing.PyEVT_RPC_LOGIN, LoginClass, Timeout: int = ..., Flags=... +) -> _win32typing.PyEVT_HANDLE: ... +def EvtOpenPublisherEnum(Session: _win32typing.PyEVT_HANDLE | None = ..., Flags: int = ...) -> _win32typing.PyEVT_HANDLE: ... +def EvtNextPublisherId(PublisherEnum: _win32typing.PyEVT_HANDLE): ... +def EvtOpenPublisherMetadata( + PublisherIdentity, + Session: _win32typing.PyEVT_HANDLE | None = ..., + LogFilePath: Incomplete | None = ..., + Locale: int = ..., + Flags: int = ..., +) -> _win32typing.PyEVT_HANDLE: ... +def EvtGetPublisherMetadataProperty( + PublisherMetadata: _win32typing.PyEVT_HANDLE, PropertyId, Flags=... +) -> tuple[Incomplete, Incomplete]: ... +def EvtOpenEventMetadataEnum(PublisherMetadata: _win32typing.PyEVT_HANDLE, Flags=...) -> _win32typing.PyEVT_HANDLE: ... +def EvtNextEventMetadata(EventMetadataEnum: _win32typing.PyEVT_HANDLE, Flags=...) -> _win32typing.PyEVT_HANDLE: ... +def EvtGetEventMetadataProperty( + EventMetadata: _win32typing.PyEVT_HANDLE, PropertyId, Flags=... +) -> tuple[Incomplete, Incomplete]: ... +def EvtGetLogInfo(Log: _win32typing.PyEVT_HANDLE, PropertyId) -> tuple[Incomplete, Incomplete]: ... +def EvtGetEventInfo(Event: _win32typing.PyEVT_HANDLE, PropertyId) -> tuple[Incomplete, Incomplete]: ... +def EvtGetObjectArraySize(ObjectArray: _win32typing.PyEVT_HANDLE): ... +def EvtGetObjectArrayProperty( + ObjectArray: _win32typing.PyEVT_HANDLE, PropertyId, ArrayIndex, Flags=... +) -> tuple[Incomplete, Incomplete]: ... +def EvtCreateRenderContext(*args, **kwargs): ... # incomplete +def EvtFormatMessage(*args, **kwargs): ... # incomplete + +EVENTLOG_AUDIT_FAILURE: int +EVENTLOG_AUDIT_SUCCESS: int +EVENTLOG_BACKWARDS_READ: int +EVENTLOG_END_ALL_PAIRED_EVENTS: int +EVENTLOG_END_PAIRED_EVENT: int +EVENTLOG_ERROR_TYPE: int +EVENTLOG_FORWARDS_READ: int +EVENTLOG_INFORMATION_TYPE: int +EVENTLOG_PAIRED_EVENT_ACTIVE: int +EVENTLOG_PAIRED_EVENT_INACTIVE: int +EVENTLOG_SEEK_READ: int +EVENTLOG_SEQUENTIAL_READ: int +EVENTLOG_START_PAIRED_EVENT: int +EVENTLOG_SUCCESS: int +EVENTLOG_WARNING_TYPE: int +EventMetadataEventChannel: int +EventMetadataEventID: int +EventMetadataEventKeyword: int +EventMetadataEventLevel: int +EventMetadataEventMessageID: int +EventMetadataEventOpcode: int +EventMetadataEventTask: int +EventMetadataEventTemplate: int +EventMetadataEventVersion: int +EvtChannelConfigAccess: int +EvtChannelConfigClassicEventlog: int +EvtChannelConfigEnabled: int +EvtChannelConfigIsolation: int +EvtChannelConfigOwningPublisher: int +EvtChannelConfigPropertyIdEND: int +EvtChannelConfigType: int +EvtChannelLoggingConfigAutoBackup: int +EvtChannelLoggingConfigLogFilePath: int +EvtChannelLoggingConfigMaxSize: int +EvtChannelLoggingConfigRetention: int +EvtChannelPublishingConfigBufferSize: int +EvtChannelPublishingConfigClockType: int +EvtChannelPublishingConfigControlGuid: int +EvtChannelPublishingConfigKeywords: int +EvtChannelPublishingConfigLatency: int +EvtChannelPublishingConfigLevel: int +EvtChannelPublishingConfigMaxBuffers: int +EvtChannelPublishingConfigMinBuffers: int +EvtChannelPublishingConfigSidType: int +EvtEventMetadataPropertyIdEND: int +EvtEventPath: int +EvtEventPropertyIdEND: int +EvtEventQueryIDs: int +EvtExportLogChannelPath: int +EvtExportLogFilePath: int +EvtExportLogTolerateQueryErrors: int +EvtLogAttributes: int +EvtLogCreationTime: int +EvtLogFileSize: int +EvtLogFull: int +EvtLogLastAccessTime: int +EvtLogLastWriteTime: int +EvtLogNumberOfLogRecords: int +EvtLogOldestRecordNumber: int +EvtOpenChannelPath: int +EvtOpenFilePath: int +EvtPublisherMetadataChannelReferenceFlags: int +EvtPublisherMetadataChannelReferenceID: int +EvtPublisherMetadataChannelReferenceIndex: int +EvtPublisherMetadataChannelReferenceMessageID: int +EvtPublisherMetadataChannelReferencePath: int +EvtPublisherMetadataChannelReferences: int +EvtPublisherMetadataHelpLink: int +EvtPublisherMetadataKeywordMessageID: int +EvtPublisherMetadataKeywordName: int +EvtPublisherMetadataKeywords: int +EvtPublisherMetadataKeywordValue: int +EvtPublisherMetadataLevelMessageID: int +EvtPublisherMetadataLevelName: int +EvtPublisherMetadataLevels: int +EvtPublisherMetadataLevelValue: int +EvtPublisherMetadataMessageFilePath: int +EvtPublisherMetadataOpcodeMessageID: int +EvtPublisherMetadataOpcodeName: int +EvtPublisherMetadataOpcodes: int +EvtPublisherMetadataOpcodeValue: int +EvtPublisherMetadataParameterFilePath: int +EvtPublisherMetadataPropertyIdEND: int +EvtPublisherMetadataPublisherGuid: int +EvtPublisherMetadataPublisherMessageID: int +EvtPublisherMetadataResourceFilePath: int +EvtPublisherMetadataTaskEventGuid: int +EvtPublisherMetadataTaskMessageID: int +EvtPublisherMetadataTaskName: int +EvtPublisherMetadataTasks: int +EvtPublisherMetadataTaskValue: int +EvtQueryChannelPath: int +EvtQueryFilePath: int +EvtQueryForwardDirection: int +EvtQueryReverseDirection: int +EvtQueryTolerateQueryErrors: int +EvtRenderBookmark: int +EvtRenderEventValues: int +EvtRenderEventXml: int +EvtRpcLogin: int +EvtRpcLoginAuthDefault: int +EvtRpcLoginAuthKerberos: int +EvtRpcLoginAuthNegotiate: int +EvtRpcLoginAuthNTLM: int +EvtSeekOriginMask: int +EvtSeekRelativeToBookmark: int +EvtSeekRelativeToCurrent: int +EvtSeekRelativeToFirst: int +EvtSeekRelativeToLast: int +EvtSeekStrict: int +EvtSubscribeActionDeliver: int +EvtSubscribeActionError: int +EvtSubscribeOriginMask: int +EvtSubscribeStartAfterBookmark: int +EvtSubscribeStartAtOldestRecord: int +EvtSubscribeStrict: int +EvtSubscribeToFutureEvents: int +EvtSubscribeTolerateQueryErrors: int +EvtVarTypeAnsiString: int +EvtVarTypeBinary: int +EvtVarTypeBoolean: int +EvtVarTypeByte: int +EvtVarTypeDouble: int +EvtVarTypeEvtHandle: int +EvtVarTypeEvtXml: int +EvtVarTypeFileTime: int +EvtVarTypeGuid: int +EvtVarTypeHexInt32: int +EvtVarTypeHexInt64: int +EvtVarTypeInt16: int +EvtVarTypeInt32: int +EvtVarTypeInt64: int +EvtVarTypeNull: int +EvtVarTypeSByte: int +EvtVarTypeSid: int +EvtVarTypeSingle: int +EvtVarTypeSizeT: int +EvtVarTypeString: int +EvtVarTypeSysTime: int +EvtVarTypeUInt16: int +EvtVarTypeUInt32: int +EvtVarTypeUInt64: int +EvtChannelPublisherList: int +EvtFormatMessageChannel: int +EvtFormatMessageEvent: int +EvtFormatMessageId: int +EvtFormatMessageKeyword: int +EvtFormatMessageLevel: int +EvtFormatMessageOpcode: int +EvtFormatMessageProvider: int +EvtFormatMessageTask: int +EvtFormatMessageXml: int +EvtRenderContextSystem: int +EvtRenderContextUser: int +EvtRenderContextValues: int +EvtSystemActivityID: int +EvtSystemChannel: int +EvtSystemComputer: int +EvtSystemEventID: int +EvtSystemEventRecordId: int +EvtSystemKeywords: int +EvtSystemLevel: int +EvtSystemOpcode: int +EvtSystemProcessID: int +EvtSystemPropertyIdEND: int +EvtSystemProviderGuid: int +EvtSystemProviderName: int +EvtSystemQualifiers: int +EvtSystemRelatedActivityID: int +EvtSystemTask: int +EvtSystemThreadID: int +EvtSystemTimeCreated: int +EvtSystemUserID: int +EvtSystemVersion: int +UNICODE: int diff --git a/stubs/pywin32/win32/win32file.pyi b/stubs/pywin32/win32/win32file.pyi new file mode 100644 index 0000000..7161497 --- /dev/null +++ b/stubs/pywin32/win32/win32file.pyi @@ -0,0 +1,439 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def AreFileApisANSI(): ... +def CancelIo(handle: int) -> None: ... +def CopyFile(_from: str, to: str, bFailIfExists) -> None: ... +def CopyFileW(_from: str, to: str, bFailIfExists) -> None: ... +def CreateDirectory(name: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... +def CreateDirectoryW(name: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... +def CreateDirectoryEx(templateName: str, newDirectory: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... +def CreateFile( + fileName: str, + desiredAccess, + shareMode, + attributes: _win32typing.PySECURITY_ATTRIBUTES, + CreationDisposition, + flagsAndAttributes, + hTemplateFile: int, +) -> int: ... +def CreateIoCompletionPort(handle: int, existing: int, completionKey, numThreads) -> int: ... +def CreateMailslot(Name, MaxMessageSize, ReadTimeout, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES) -> int: ... +def GetMailslotInfo(Mailslot: int) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def SetMailslotInfo(Mailslot: int, ReadTimeout) -> None: ... +def DefineDosDevice(flags, deviceName: str, targetPath: str) -> None: ... +def DefineDosDeviceW(flags, deviceName: str, targetPath: str) -> None: ... +def DeleteFile(fileName: str) -> None: ... +def DeviceIoControl(Device: int, IoControlCode, InBuffer, OutBuffer, Overlapped: _win32typing.PyOVERLAPPED | None = ...): ... +def FindClose(hFindFile) -> None: ... +def FindCloseChangeNotification(hChangeHandle) -> None: ... +def FindFirstChangeNotification(pathName: str, bWatchSubtree, notifyFilter): ... +def FindNextChangeNotification(hChangeHandle): ... +def FlushFileBuffers(hFile: int) -> None: ... +def GetBinaryType(appName: str): ... +def GetDiskFreeSpace(rootPathName: str) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def GetDiskFreeSpaceEx(rootPathName: str) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def GetDriveType(rootPathName: str): ... +def GetDriveTypeW(rootPathName: str): ... +def GetFileAttributes(fileName: str): ... +def GetFileAttributesW(fileName: str): ... +def GetFileTime( + handle: int, creationTime: _win32typing.PyTime, accessTime: _win32typing.PyTime, writeTime: _win32typing.PyTime +) -> tuple[_win32typing.PyTime, _win32typing.PyTime, _win32typing.PyTime]: ... +def SetFileTime( + File: int, + CreationTime: _win32typing.PyTime | None = ..., + LastAccessTime: _win32typing.PyTime | None = ..., + LastWriteTime: _win32typing.PyTime | None = ..., + UTCTimes: bool = ..., +) -> None: ... +def GetFileInformationByHandle(handle: int): ... +def GetCompressedFileSize(): ... +def GetFileSize(): ... +def AllocateReadBuffer(bufSize) -> _win32typing.PyOVERLAPPEDReadBuffer: ... +def ReadFile( + hFile: int, buffer_bufSize: _win32typing.PyOVERLAPPEDReadBuffer, overlapped: _win32typing.PyOVERLAPPED | None = ... +) -> tuple[Incomplete, str]: ... +def WriteFile( + hFile: int, data: str | _win32typing.PyOVERLAPPEDReadBuffer, ol: _win32typing.PyOVERLAPPED | None = ... +) -> tuple[Incomplete, Incomplete]: ... +def CloseHandle(handle: int) -> None: ... +def LockFileEx(hFile: int, _int, _int1, _int2, ol: _win32typing.PyOVERLAPPED | None = ...) -> None: ... +def UnlockFileEx(hFile: int, _int, _int1, ol: _win32typing.PyOVERLAPPED | None = ...) -> None: ... +def GetQueuedCompletionStatus(hPort: int, timeOut) -> tuple[Incomplete, Incomplete, Incomplete, _win32typing.PyOVERLAPPED]: ... +def PostQueuedCompletionStatus( + handle: int, numberOfbytes: int = ..., completionKey: int = ..., overlapped: _win32typing.PyOVERLAPPED | None = ... +): ... +def GetFileType(hFile: int): ... +def GetLogicalDrives(): ... +def GetOverlappedResult(hFile: int, overlapped: _win32typing.PyOVERLAPPED, bWait): ... +def LockFile(hFile: int, offsetLow, offsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh) -> None: ... +def MoveFile(existingFileName: str, newFileName: str) -> None: ... +def MoveFileW(existingFileName: str, newFileName: str) -> None: ... +def MoveFileEx(existingFileName: str, newFileName: str, flags) -> None: ... +def MoveFileExW(existingFileName: str, newFileName: str, flags) -> None: ... +def QueryDosDevice(DeviceName: str) -> str: ... +def ReadDirectoryChangesW( + handle: int, size, bWatchSubtree, dwNotifyFilter, overlapped: _win32typing.PyOVERLAPPED | None = ... +) -> None: ... +def FILE_NOTIFY_INFORMATION(buffer: str, size) -> tuple[tuple[Incomplete, Incomplete], ...]: ... +def SetCurrentDirectory(lpPathName: str) -> None: ... +def SetEndOfFile(hFile: int) -> None: ... +def SetFileApisToANSI() -> None: ... +def SetFileApisToOEM() -> None: ... +def SetFileAttributes(filename: str, newAttributes) -> None: ... +def SetFilePointer(handle: int, offset, moveMethod) -> None: ... +def SetVolumeLabel(rootPathName: str, volumeName: str) -> None: ... +def UnlockFile(hFile: int, offsetLow, offsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh) -> None: ... +def TransmitFile( + Socket, + File: int, + NumberOfBytesToWrite, + NumberOfBytesPerSend, + Overlapped: _win32typing.PyOVERLAPPED, + Flags, + Head: Incomplete | None = ..., + Tail: Incomplete | None = ..., +) -> None: ... +def ConnectEx( + s, name, Overlapped: _win32typing.PyOVERLAPPED, SendBuffer: Incomplete | None = ... +) -> tuple[Incomplete, Incomplete]: ... +def AcceptEx(slistening, sAccepting, buffer, ol: _win32typing.PyOVERLAPPED) -> None: ... +def CalculateSocketEndPointSize(socket): ... +def GetAcceptExSockaddrs( + sAccepting, buffer: _win32typing.PyOVERLAPPEDReadBuffer +) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def WSAEventSelect(socket, hEvent, networkEvents) -> None: ... +def WSAEnumNetworkEvents(s, hEvent: int): ... +def WSAAsyncSelect(socket, hwnd: int, _int, networkEvents) -> None: ... +def WSASend(s, buffer: str, ol: _win32typing.PyOVERLAPPED, dwFlags) -> tuple[Incomplete, Incomplete]: ... +def WSARecv(s, buffer, ol: _win32typing.PyOVERLAPPED, dwFlags) -> tuple[Incomplete, Incomplete]: ... +def BuildCommDCB(_def: str, dcb: _win32typing.PyDCB) -> _win32typing.PyDCB: ... +def ClearCommError(PyHANDLE) -> tuple[Incomplete, _win32typing.PyCOMSTAT]: ... +def EscapeCommFunction(handle: int) -> None: ... +def GetCommState(handle: int) -> _win32typing.PyDCB: ... +def SetCommState(handle: int, dcb: _win32typing.PyDCB) -> None: ... +def ClearCommBreak(handle: int) -> None: ... +def GetCommMask(handle: int): ... +def SetCommMask(handle: int, val): ... +def GetCommModemStatus(handle: int): ... +def GetCommTimeouts(handle: int): ... +def SetCommTimeouts(handle: int, val): ... +def PurgeComm(handle: int, action) -> None: ... +def SetCommBreak(handle: int) -> None: ... +def SetupComm(handle: int, dwInQueue, dwOutQueue) -> None: ... +def TransmitCommChar(handle: int, cChar) -> None: ... +def WaitCommEvent(handle: int, overlapped: _win32typing.PyOVERLAPPED) -> None: ... +def SetVolumeMountPoint(VolumeMountPoint: str, VolumeName: str) -> str: ... +def DeleteVolumeMountPoint(VolumeMountPoint: str) -> None: ... +def GetVolumeNameForVolumeMountPoint(VolumeMountPoint: str) -> str: ... +def GetVolumePathName(FileName: str, BufferLength: int = ...) -> str: ... +def GetVolumePathNamesForVolumeName(VolumeName: str) -> list[Incomplete]: ... +def CreateHardLink( + FileName: str, + ExistingFileName: str, + SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., + Transaction: int | None = ..., +) -> None: ... +def CreateSymbolicLink(SymlinkFileName: str, TargetFileName: str, Flags: int = ..., Transaction: int | None = ...) -> None: ... +def EncryptFile(filename: str) -> None: ... +def DecryptFile(filename: str) -> None: ... +def EncryptionDisable(DirName: str, Disable) -> None: ... +def FileEncryptionStatus(FileName: str): ... +def QueryUsersOnEncryptedFile(FileName: str) -> tuple[_win32typing.PySID, str, Incomplete]: ... +def QueryRecoveryAgentsOnEncryptedFile(FileName: str) -> tuple[_win32typing.PySID, str, Incomplete]: ... +def RemoveUsersFromEncryptedFile(FileName: str, pHashes: tuple[tuple[_win32typing.PySID, str, Incomplete], ...]) -> None: ... +def AddUsersToEncryptedFile(FileName: str, pUsers: tuple[tuple[_win32typing.PySID, str, Incomplete], ...]) -> None: ... +def DuplicateEncryptionInfoFile( + SrcFileName: str, + DstFileName: str, + CreationDisposition, + Attributes, + SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., +) -> None: ... +def BackupRead( + hFile: int, NumberOfBytesToRead, Buffer, bAbort, bProcessSecurity, lpContext +) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def BackupSeek(hFile: int, NumberOfBytesToSeek, lpContext): ... +def BackupWrite( + hFile: int, NumberOfBytesToWrite, Buffer: str, bAbort, bProcessSecurity, lpContext +) -> tuple[Incomplete, Incomplete]: ... +def SetFileShortName(hFile: int, ShortName) -> None: ... +def CopyFileEx( + ExistingFileName, + NewFileName, + ProgressRoutine: _win32typing.CopyProgressRoutine | None = ..., + Data: Incomplete | None = ..., + Cancel: bool = ..., + CopyFlags: int = ..., + Transaction: int | None = ..., +) -> None: ... +def MoveFileWithProgress( + ExistingFileName, + NewFileName, + ProgressRoutine: _win32typing.CopyProgressRoutine | None = ..., + Data: Incomplete | None = ..., + Flags: int = ..., + Transaction: int | None = ..., +) -> None: ... +def ReplaceFile( + ReplacedFileName, + ReplacementFileName, + BackupFileName: Incomplete | None = ..., + ReplaceFlags: int = ..., + Exclude: Incomplete | None = ..., + Reserved: Incomplete | None = ..., +) -> None: ... +def OpenEncryptedFileRaw(FileName, Flags): ... +def ReadEncryptedFileRaw(ExportCallback, CallbackContext, Context) -> None: ... +def WriteEncryptedFileRaw(ImportCallback, CallbackContext, Context) -> None: ... +def CloseEncryptedFileRaw(Context) -> None: ... +def CreateFileW( + FileName: str, + DesiredAccess, + ShareMode, + SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES, + CreationDisposition, + FlagsAndAttributes, + TemplateFile: int | None = ..., + Transaction: int | None = ..., + MiniVersion: Incomplete | None = ..., + ExtendedParameter: Incomplete | None = ..., +) -> int: ... +def DeleteFileW(FileName: str, Transaction: int | None = ...) -> None: ... +def GetFileAttributesEx(FileName: str, InfoLevelId, Transaction: int | None = ...): ... +def SetFileAttributesW(FileName, FileAttributes, Transaction: int | None = ...) -> None: ... +def CreateDirectoryExW( + TemplateDirectory: str, + NewDirectory: str, + SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., + Transaction: int | None = ..., +) -> None: ... +def RemoveDirectory(PathName: str, Transaction: int | None = ...) -> None: ... +def FindFilesW(FileName: str, Transaction: int | None = ...): ... +def FindFilesIterator(FileName: str, Transaction: int | None = ...): ... +def FindStreams(FileName: str, Transaction: int | None = ...) -> list[tuple[Incomplete, str]]: ... +def FindFileNames(FileName: str, Transaction: int | None = ...) -> list[Incomplete]: ... +def GetFinalPathNameByHandle(File: int, Flags) -> str: ... +def SfcGetNextProtectedFile() -> list[Incomplete]: ... +def SfcIsFileProtected(ProtFileName: str): ... +def GetLongPathName(ShortPath: str, Transaction: int | None = ...) -> str: ... +def GetFullPathName(FileName, Transaction: int | None = ...): ... +def Wow64DisableWow64FsRedirection(): ... +def Wow64RevertWow64FsRedirection(OldValue) -> None: ... +def GetFileInformationByHandleEx(File: int, FileInformationClass): ... +def SetFileInformationByHandle(File: int, FileInformationClass, Information) -> None: ... +def ReOpenFile(OriginalFile: int, DesiredAccess, ShareMode, Flags) -> int: ... +def OpenFileById( + File: int, + FileId: _win32typing.PyIID, + DesiredAccess, + ShareMode, + Flags, + SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., +) -> int: ... +def DCB(*args, **kwargs): ... # incomplete +def GetFileAttributesExW(*args, **kwargs): ... # incomplete +def OVERLAPPED(*args, **kwargs): ... # incomplete + +CALLBACK_CHUNK_FINISHED: int +CALLBACK_STREAM_SWITCH: int +CBR_110: int +CBR_115200: int +CBR_1200: int +CBR_128000: int +CBR_14400: int +CBR_19200: int +CBR_2400: int +CBR_256000: int +CBR_300: int +CBR_38400: int +CBR_4800: int +CBR_56000: int +CBR_57600: int +CBR_600: int +CBR_9600: int +CLRBREAK: int +CLRDTR: int +CLRRTS: int +COPY_FILE_ALLOW_DECRYPTED_DESTINATION: int +COPY_FILE_FAIL_IF_EXISTS: int +COPY_FILE_OPEN_SOURCE_FOR_WRITE: int +COPY_FILE_RESTARTABLE: int +CREATE_ALWAYS: int +CREATE_FOR_DIR: int +CREATE_FOR_IMPORT: int +CREATE_NEW: int +DRIVE_CDROM: int +DRIVE_FIXED: int +DRIVE_NO_ROOT_DIR: int +DRIVE_RAMDISK: int +DRIVE_REMOTE: int +DRIVE_REMOVABLE: int +DRIVE_UNKNOWN: int +DTR_CONTROL_DISABLE: int +DTR_CONTROL_ENABLE: int +DTR_CONTROL_HANDSHAKE: int +EV_BREAK: int +EV_CTS: int +EV_DSR: int +EV_ERR: int +EV_RING: int +EV_RLSD: int +EV_RXCHAR: int +EV_RXFLAG: int +EV_TXEMPTY: int +EVENPARITY: int +FD_ACCEPT: int +FD_CLOSE: int +FD_CONNECT: int +FD_GROUP_QOS: int +FD_OOB: int +FD_QOS: int +FD_READ: int +FD_ROUTING_INTERFACE_CHANGE: int +FD_WRITE: int +FILE_ALL_ACCESS: int +FILE_ATTRIBUTE_ARCHIVE: int +FILE_ATTRIBUTE_COMPRESSED: int +FILE_ATTRIBUTE_DIRECTORY: int +FILE_ATTRIBUTE_HIDDEN: int +FILE_ATTRIBUTE_NORMAL: int +FILE_ATTRIBUTE_OFFLINE: int +FILE_ATTRIBUTE_READONLY: int +FILE_ATTRIBUTE_SYSTEM: int +FILE_ATTRIBUTE_TEMPORARY: int +FILE_BEGIN: int +FILE_CURRENT: int +FILE_ENCRYPTABLE: int +FILE_END: int +FILE_FLAG_BACKUP_SEMANTICS: int +FILE_FLAG_DELETE_ON_CLOSE: int +FILE_FLAG_NO_BUFFERING: int +FILE_FLAG_OPEN_REPARSE_POINT: int +FILE_FLAG_OVERLAPPED: int +FILE_FLAG_POSIX_SEMANTICS: int +FILE_FLAG_RANDOM_ACCESS: int +FILE_FLAG_SEQUENTIAL_SCAN: int +FILE_FLAG_WRITE_THROUGH: int +FILE_GENERIC_READ: int +FILE_GENERIC_WRITE: int +FILE_IS_ENCRYPTED: int +FILE_READ_ONLY: int +FILE_ROOT_DIR: int +FILE_SHARE_DELETE: int +FILE_SHARE_READ: int +FILE_SHARE_WRITE: int +FILE_SYSTEM_ATTR: int +FILE_SYSTEM_DIR: int +FILE_SYSTEM_NOT_SUPPORT: int +FILE_TYPE_CHAR: int +FILE_TYPE_DISK: int +FILE_TYPE_PIPE: int +FILE_TYPE_UNKNOWN: int +FILE_UNKNOWN: int +FILE_USER_DISALLOWED: int +FileAllocationInfo: int +FileAttributeTagInfo: int +FileBasicInfo: int +FileCompressionInfo: int +FileDispositionInfo: int +FileEndOfFileInfo: int +FileIdBothDirectoryInfo: int +FileIdBothDirectoryRestartInfo: int +FileIdType: int +FileIoPriorityHintInfo: int +FileNameInfo: int +FileRenameInfo: int +FileStandardInfo: int +FileStreamInfo: int +GENERIC_EXECUTE: int +GENERIC_READ: int +GENERIC_WRITE: int +GetFileExInfoStandard: int +IoPriorityHintLow: int +IoPriorityHintNormal: int +IoPriorityHintVeryLow: int +MARKPARITY: int +MOVEFILE_COPY_ALLOWED: int +MOVEFILE_CREATE_HARDLINK: int +MOVEFILE_DELAY_UNTIL_REBOOT: int +MOVEFILE_FAIL_IF_NOT_TRACKABLE: int +MOVEFILE_REPLACE_EXISTING: int +MOVEFILE_WRITE_THROUGH: int +NOPARITY: int +ObjectIdType: int +ODDPARITY: int +ONE5STOPBITS: int +ONESTOPBIT: int +OPEN_ALWAYS: int +OPEN_EXISTING: int +OVERWRITE_HIDDEN: int +PROGRESS_CANCEL: int +PROGRESS_CONTINUE: int +PROGRESS_QUIET: int +PROGRESS_STOP: int +PURGE_RXABORT: int +PURGE_RXCLEAR: int +PURGE_TXABORT: int +PURGE_TXCLEAR: int +REPLACEFILE_IGNORE_MERGE_ERRORS: int +REPLACEFILE_WRITE_THROUGH: int +RTS_CONTROL_DISABLE: int +RTS_CONTROL_ENABLE: int +RTS_CONTROL_HANDSHAKE: int +RTS_CONTROL_TOGGLE: int +SCS_32BIT_BINARY: int +SCS_DOS_BINARY: int +SCS_OS216_BINARY: int +SCS_PIF_BINARY: int +SCS_POSIX_BINARY: int +SCS_WOW_BINARY: int +SECURITY_ANONYMOUS: int +SECURITY_CONTEXT_TRACKING: int +SECURITY_DELEGATION: int +SECURITY_EFFECTIVE_ONLY: int +SECURITY_IDENTIFICATION: int +SECURITY_IMPERSONATION: int +SETBREAK: int +SETDTR: int +SETRTS: int +SETXOFF: int +SETXON: int +SO_CONNECT_TIME: int +SO_UPDATE_ACCEPT_CONTEXT: int +SO_UPDATE_CONNECT_CONTEXT: int +SPACEPARITY: int +SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: int +SYMBOLIC_LINK_FLAG_DIRECTORY: int +TF_DISCONNECT: int +TF_REUSE_SOCKET: int +TF_USE_DEFAULT_WORKER: int +TF_USE_KERNEL_APC: int +TF_USE_SYSTEM_THREAD: int +TF_WRITE_BEHIND: int +TRUNCATE_EXISTING: int +TWOSTOPBITS: int +WSA_IO_PENDING: int +WSA_OPERATION_ABORTED: int +WSAECONNABORTED: int +WSAECONNRESET: int +WSAEDISCON: int +WSAEFAULT: int +WSAEINPROGRESS: int +WSAEINTR: int +WSAEINVAL: int +WSAEMSGSIZE: int +WSAENETDOWN: int +WSAENETRESET: int +WSAENOBUFS: int +WSAENOTCONN: int +WSAENOTSOCK: int +WSAEOPNOTSUPP: int +WSAESHUTDOWN: int +WSAEWOULDBLOCK: int +FD_ADDRESS_LIST_CHANGE: int +INVALID_HANDLE_VALUE: int +UNICODE: int diff --git a/stubs/pywin32/win32/win32gui.pyi b/stubs/pywin32/win32/win32gui.pyi new file mode 100644 index 0000000..8b4d893 --- /dev/null +++ b/stubs/pywin32/win32/win32gui.pyi @@ -0,0 +1,497 @@ +from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer +from collections.abc import Callable +from typing import TypeVar + +import _win32typing +from win32.lib.pywintypes import error as error + +_T = TypeVar("_T") + +def EnumFontFamilies(hdc: int, Family: str, EnumFontFamProc, Param): ... +def set_logger(logger) -> None: ... +def LOGFONT() -> _win32typing.PyLOGFONT: ... +def CreateFontIndirect(lplf: _win32typing.PyLOGFONT): ... +def GetObject(handle: int): ... +def GetObjectType(h: int): ... +def PyGetMemory(__addr: int, __len: int): ... +def PyGetString(addr, _len) -> str: ... +def PySetString(addr, String, maxLen): ... +def PySetMemory(addr, String): ... +def PyGetArraySignedLong(array, index): ... +def PyGetBufferAddressAndLen(obj): ... +def FlashWindow(hwnd: int, bInvert): ... +def FlashWindowEx(hwnd: int, dwFlags, uCount, dwTimeout): ... +def GetWindowLong(hwnd: int, index): ... +def GetClassLong(hwnd: int, index): ... +def SetWindowLong(hwnd: int, index, value): ... +def CallWindowProc(wndproc, hwnd: int, msg, wparam, lparam): ... +def SendMessage( + __hwnd: int | None, __message: int, __wparam: int | None = ..., __lparam: ReadableBuffer | float | None = ... +) -> int: ... +def SendMessageTimeout( + __hwnd: int, + __message: int, + __wparam: ReadableBuffer | float | None, + __lparam: ReadableBuffer | float | None, + __flags: int, + __timeout: int, +) -> tuple[int, int]: ... +def PostMessage( + __hwnd: int | None, __message: int, __wparam: int | None = ..., __lparam: ReadableBuffer | float | None = ... +) -> None: ... +def PostThreadMessage(threadId, message, wparam, lparam) -> None: ... +def ReplyMessage(result): ... +def RegisterWindowMessage(name: str): ... +def DefWindowProc( + hwnd: int | None, message: int, wparam: ReadableBuffer | float | None, lparam: ReadableBuffer | float | None +) -> int: ... +def EnumWindows(__callback: Callable[[int, _T], object], __extra: _T) -> None: ... +def EnumThreadWindows(dwThreadId, __callback: Callable[[int, _T], object], __extra: _T) -> None: ... +def EnumChildWindows(__hwnd: int | None, __callback: Callable[[int, _T], object], __extra: _T) -> None: ... +def DialogBox(hInstance: int, TemplateName: _win32typing.PyResourceId, hWndParent: int, DialogFunc, InitParam: int = ...): ... +def DialogBoxParam(): ... +def DialogBoxIndirect( + hInstance: int, controllist: _win32typing.PyDialogTemplate, hWndParent: int, DialogFunc, InitParam: int = ... +): ... +def DialogBoxIndirectParam(): ... +def CreateDialogIndirect( + hInstance: int, controllist: _win32typing.PyDialogTemplate, hWndParent: int, DialogFunc, InitParam: int = ... +): ... +def EndDialog(hwnd: int, result) -> None: ... +def GetDlgItem(hDlg: int, IDDlgItem): ... +def GetDlgItemInt(hDlg: int, IDDlgItem, Signed) -> None: ... +def SetDlgItemInt(hDlg: int, IDDlgItem, Value, Signed) -> None: ... +def GetDlgCtrlID(hwnd: int): ... +def GetDlgItemText(hDlg: int, IDDlgItem) -> str: ... +def SetDlgItemText(hDlg: int, IDDlgItem, String) -> None: ... +def GetNextDlgTabItem(hDlg, hCtl, bPrevious): ... +def GetNextDlgGroupItem(hDlg, hCtl, bPrevious): ... +def SetWindowText() -> None: ... +def GetWindowText(hwnd: int) -> str: ... +def InitCommonControls() -> None: ... +def InitCommonControlsEx(flag) -> None: ... +def LoadCursor(hinstance, resid): ... +def SetCursor(hcursor): ... +def GetCursor(): ... +def GetCursorInfo() -> tuple[int, int, int, int]: ... +def CreateAcceleratorTable(accels: tuple[tuple[Incomplete, Incomplete, Incomplete], ...]): ... +def LoadMenu(hinstance, resource_id: str): ... +def DestroyMenu() -> None: ... +def SetMenu(hwnd: int, hmenu) -> None: ... +def GetMenu(__hwnd: int) -> int: ... +def LoadIcon(hinstance, resource_id: str): ... +def CopyIcon(hicon): ... +def DrawIcon(hDC, X, Y, hicon) -> None: ... +def DrawIconEx( + hDC, xLeft, yTop, hIcon, cxWidth, cyWidth, istepIfAniCur, hbrFlickerFreeDraw: _win32typing.PyGdiHANDLE, diFlags +) -> None: ... +def CreateIconIndirect(iconinfo: _win32typing.PyICONINFO): ... +def CreateIconFromResource(bits: str, fIcon, ver: int = ...) -> int: ... +def LoadImage(hinst, name: str, _type, cxDesired, cyDesired, fuLoad): ... +def DeleteObject(handle: _win32typing.PyGdiHANDLE) -> None: ... +def BitBlt(hdcDest, x, y, width, height, hdcSrc, nXSrc, nYSrc, dwRop) -> None: ... +def StretchBlt(hdcDest, x, y, width, height, hdcSrc, nXSrc, nYSrc, nWidthSrc, nHeightSrc, dwRop) -> None: ... +def PatBlt(hdc: int, XLeft, YLeft, Width, Height, Rop) -> None: ... +def SetStretchBltMode(hdc: int, StretchMode): ... +def GetStretchBltMode(hdc: int): ... +def TransparentBlt( + Dest: int, XOriginDest, YOriginDest, WidthDest, HeightDest, Src: int, XOriginSrc, YOriginSrc, WidthSrc, HeightSrc, Transparent +) -> None: ... +def MaskBlt( + Dest: int, XDest, YDest, Width, Height, Src: int, XSrc, YSrc, Mask: _win32typing.PyGdiHANDLE, xMask, yMask, Rop +) -> None: ... +def AlphaBlend( + Dest: int, + XOriginDest, + YOriginDest, + WidthDest, + HeightDest, + Src: int, + XOriginSrc, + YOriginSrc, + WidthSrc, + HeightSrc, + blendFunction: _win32typing.PyBLENDFUNCTION, +) -> None: ... +def MessageBox(parent, text: str, caption: str, flags): ... +def MessageBeep(_type) -> None: ... +def CreateWindow(className: str, windowTitle: str, style, x, y, width, height, parent, menu, hinstance, reserved): ... +def DestroyWindow(hwnd: int) -> None: ... +def EnableWindow(hWnd: int, bEnable): ... +def FindWindow(__ClassName: _win32typing.PyResourceId | str | None, __WindowName: str | None) -> int: ... +def FindWindowEx( + __Parent: int | None, __ChildAfter: int | None, __ClassName: _win32typing.PyResourceId | str, __WindowName: str +) -> int: ... +def DragAcceptFiles(hwnd: int, fAccept) -> None: ... +def DragDetect(hwnd: int, point: tuple[Incomplete, Incomplete]) -> None: ... +def SetDoubleClickTime(newVal) -> None: ... +def GetDoubleClickTime(): ... +def HideCaret(hWnd: int) -> None: ... +def SetCaretPos(x, y) -> None: ... +def GetCaretPos() -> tuple[Incomplete, Incomplete]: ... +def ShowCaret(hWnd: int) -> None: ... +def ShowWindow(__hWnd: int | None, __cmdShow: int) -> int: ... +def IsWindowVisible(__hwnd: int | None) -> int: ... +def IsWindowEnabled(__hwnd: int | None) -> int: ... +def SetFocus(hwnd: int) -> None: ... +def GetFocus() -> None: ... +def UpdateWindow(hwnd: int) -> None: ... +def BringWindowToTop(hwnd: int) -> None: ... +def SetActiveWindow(hwnd: int): ... +def GetActiveWindow(): ... +def SetForegroundWindow(__hwnd: int) -> None: ... +def GetForegroundWindow() -> int: ... +def GetClientRect(hwnd: int) -> tuple[int, int, int, int]: ... +def GetDC(hwnd: int): ... +def SaveDC(hdc: int): ... +def RestoreDC(hdc: int, SavedDC) -> None: ... +def DeleteDC(hdc) -> None: ... +def CreateCompatibleDC(dc): ... +def CreateCompatibleBitmap(hdc, width, height) -> _win32typing.PyGdiHANDLE: ... +def CreateBitmap(width, height, cPlanes, cBitsPerPixel, bitmap_bits) -> _win32typing.PyGdiHANDLE: ... +def SelectObject(hdc, _object): ... +def GetCurrentObject(hdc: int, ObjectType) -> int: ... +def GetWindowRect(hwnd: int) -> tuple[int, int, int, int]: ... +def GetStockObject(Object) -> int: ... +def PostQuitMessage(rc) -> None: ... +def WaitMessage() -> None: ... +def SetWindowPos(__hWnd: int, __InsertAfter: int | None, __X: int, __Y: int, __cx: int, __cy: int, __Flags: int) -> None: ... +def GetWindowPlacement(__hwnd: int) -> tuple[int, int, tuple[int, int], tuple[int, int], tuple[int, int, int, int]]: ... +def SetWindowPlacement(hWnd: int, placement) -> None: ... +def RegisterClass(wndClass: _win32typing.PyWNDCLASS): ... +def UnregisterClass(atom: _win32typing.PyResourceId, hinst: int) -> None: ... +def PumpMessages() -> None: ... +def PumpWaitingMessages(): ... +def GetMessage(hwnd: int, _min, _max): ... +def TranslateMessage(msg): ... +def DispatchMessage(msg): ... +def TranslateAccelerator(hwnd: int, haccel, msg): ... +def PeekMessage(hwnd: int, filterMin, filterMax, removalOptions): ... +def Shell_NotifyIcon(Message, nid: _win32typing.PyNOTIFYICONDATA) -> None: ... +def GetSystemMenu(hwnd: int, bRevert): ... +def DrawMenuBar(hwnd: int) -> None: ... +def MoveWindow(__hwnd: int, __x: int, __y: int, __width: int, __height: int, __bRepaint: bool) -> None: ... +def CloseWindow() -> None: ... +def DeleteMenu(hmenu, position, flags) -> None: ... +def RemoveMenu(hmenu, position, flags) -> None: ... +def CreateMenu(): ... +def CreatePopupMenu(): ... +def TrackPopupMenu(hmenu, flags, x, y, reserved, hwnd: int, prcRect: _win32typing.PyRECT): ... +def CommDlgExtendedError(): ... +def ExtractIcon(hinstance, moduleName: str, index): ... +def ExtractIconEx(moduleName: str, index, numIcons: int = ...): ... +def DestroyIcon(hicon) -> None: ... +def GetIconInfo(hicon: int) -> _win32typing.PyICONINFO: ... +def ScreenToClient(hWnd: int, Point: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... +def ClientToScreen(hWnd: int, Point: tuple[Incomplete, Incomplete]) -> tuple[Incomplete, Incomplete]: ... +def PaintDesktop(hdc: int) -> None: ... +def RedrawWindow(hWnd: int, rcUpdate: tuple[int, int, int, int], hrgnUpdate: _win32typing.PyGdiHANDLE, flags) -> None: ... +def GetTextExtentPoint32(hdc: int, _str: str) -> tuple[Incomplete, Incomplete]: ... +def GetTextMetrics(): ... +def GetTextCharacterExtra(hdc: int): ... +def SetTextCharacterExtra(hdc: int, CharExtra): ... +def GetTextAlign(hdc: int): ... +def SetTextAlign(hdc: int, Mode): ... +def GetTextFace(hdc: int) -> str: ... +def GetMapMode(hdc: int): ... +def SetMapMode(hdc: int, MapMode): ... +def GetGraphicsMode(hdc: int): ... +def SetGraphicsMode(hdc: int, Mode): ... +def GetLayout(hdc: int): ... +def SetLayout(hdc: int, Layout): ... +def GetPolyFillMode(hdc: int): ... +def SetPolyFillMode(hdc: int, PolyFillMode): ... +def GetWorldTransform(hdc: int) -> _win32typing.PyXFORM: ... +def SetWorldTransform(hdc: int, Xform: _win32typing.PyXFORM) -> None: ... +def ModifyWorldTransform(hdc: int, Xform: _win32typing.PyXFORM, Mode) -> None: ... +def CombineTransform(xform1: _win32typing.PyXFORM, xform2: _win32typing.PyXFORM) -> _win32typing.PyXFORM: ... +def GetWindowOrgEx(hdc: int) -> tuple[Incomplete, Incomplete]: ... +def SetWindowOrgEx(hdc: int, X, Y) -> tuple[Incomplete, Incomplete]: ... +def GetViewportOrgEx(hdc: int) -> tuple[Incomplete, Incomplete]: ... +def SetViewportOrgEx(hdc: int, X, Y) -> tuple[Incomplete, Incomplete]: ... +def GetWindowExtEx(hdc: int) -> tuple[Incomplete, Incomplete]: ... +def SetWindowExtEx(hdc: int, XExtent, YExtent) -> tuple[Incomplete, Incomplete]: ... +def GetViewportExtEx(hdc: int) -> tuple[Incomplete, Incomplete]: ... +def SetViewportExtEx(hdc: int, XExtent, YExtent) -> tuple[Incomplete, Incomplete]: ... +def GradientFill(hdc, Vertex: tuple[_win32typing.PyTRIVERTEX, ...], Mesh, Mode) -> None: ... +def GetOpenFileName(OPENFILENAME: str): ... +def InsertMenuItem(hMenu, uItem, fByPosition, menuItem) -> None: ... +def SetMenuItemInfo(hMenu, uItem, fByPosition, menuItem) -> None: ... +def GetMenuItemInfo(__hMenu: int, __uItem: int, __fByPosition: bool, __menuItem: ReadableBuffer) -> None: ... +def GetMenuItemCount(__hMenu: int | None) -> int: ... + +# Actually returns a list of int|tuple, but lists don't support positional types +def GetMenuItemRect(__hWnd: int | None, __hMenu: int | None, __uItem: int) -> tuple[int, tuple[int, int, int, int]]: ... +def GetMenuState(hMenu, uID, flags): ... +def SetMenuDefaultItem(hMenu, uItem, fByPos) -> None: ... +def GetMenuDefaultItem(hMenu, fByPos, flags): ... +def AppendMenu() -> None: ... +def InsertMenu() -> None: ... +def EnableMenuItem() -> None: ... +def CheckMenuItem(): ... +def GetSubMenu(hMenu, nPos): ... +def ModifyMenu(hMnu, uPosition, uFlags, uIDNewItem, newItem: str) -> None: ... +def GetMenuItemID(hMenu, nPos): ... +def SetMenuItemBitmaps( + hMenu, uPosition, uFlags, hBitmapUnchecked: _win32typing.PyGdiHANDLE, hBitmapChecked: _win32typing.PyGdiHANDLE +) -> None: ... +def CheckMenuRadioItem(hMenu, idFirst, idLast, idCheck, uFlags) -> None: ... +def SetMenuInfo(hmenu, info) -> None: ... +def GetMenuInfo(__hmenu: int, __info: WriteableBuffer) -> None: ... +def DrawFocusRect(hDC: int, rc: tuple[int, int, int, int]) -> None: ... +def DrawText(hDC: int, String, nCount, Rect: _win32typing.PyRECT, Format) -> tuple[Incomplete, _win32typing.PyRECT]: ... +def LineTo(hdc: int, XEnd, YEnd) -> None: ... +def Ellipse(hdc: int, LeftRect, TopRect, RightRect, BottomRect) -> None: ... +def Pie(hdc: int, LeftRect, TopRect, RightRect, BottomRect, XRadial1, YRadial1, XRadial2, YRadial2) -> None: ... +def Arc(hdc: int, LeftRect, TopRect, RightRect, BottomRect, XRadial1, YRadial1, XRadial2, YRadial2) -> None: ... +def ArcTo(hdc: int, LeftRect, TopRect, RightRect, BottomRect, XRadial1, YRadial1, XRadial2, YRadial2) -> None: ... +def AngleArc(hdc: int, Y, Y1, Radius, StartAngle: float, SweepAngle: float) -> None: ... +def Chord(hdc: int, LeftRect, TopRect, RightRect, BottomRect, XRadial1, YRadial1, XRadial2, YRadial2) -> None: ... +def ExtFloodFill(arg: int, XStart, YStart, Color, FillType) -> None: ... +def SetPixel(hdc: int, X, Y, Color): ... +def GetPixel(hdc: int, XPos, YPos): ... +def GetROP2(hdc: int): ... +def SetROP2(hdc: int, DrawMode): ... +def SetPixelV(hdc: int, X, Y, Color) -> None: ... +def MoveToEx(hdc: int, X, Y) -> tuple[Incomplete, Incomplete]: ... +def GetCurrentPositionEx(hdc: int) -> tuple[Incomplete, Incomplete]: ... +def GetArcDirection(hdc: int): ... +def SetArcDirection(hdc: int, ArcDirection): ... +def Polygon(hdc: int, Points: list[tuple[Incomplete, Incomplete]]) -> None: ... +def Polyline(hdc: int, Points: list[tuple[Incomplete, Incomplete]]) -> None: ... +def PolylineTo(hdc: int, Points: list[tuple[Incomplete, Incomplete]]) -> None: ... +def PolyBezier(hdc: int, Points: list[tuple[Incomplete, Incomplete]]) -> None: ... +def PolyBezierTo(hdc: int, Points: list[tuple[Incomplete, Incomplete]]) -> None: ... +def PlgBlt( + Dest: int, + Point, + Src: int, + XSrc, + YSrc, + Width, + Height, + Mask: _win32typing.PyGdiHANDLE | None = ..., + xMask: int = ..., + yMask: int = ..., +) -> None: ... +def CreatePolygonRgn(Points: list[tuple[Incomplete, Incomplete]], PolyFillMode) -> _win32typing.PyGdiHANDLE: ... +def ExtTextOut( + hdc: int, _int, _int1, _int2, rect: _win32typing.PyRECT, string, _tuple: tuple[tuple[Incomplete, Incomplete], ...] +): ... +def GetTextColor(hdc): ... +def SetTextColor(hdc, color): ... +def GetBkMode(hdc: int): ... +def SetBkMode(hdc: int, BkMode): ... +def GetBkColor(hdc: int): ... +def SetBkColor(hdc: int, color): ... +def DrawEdge(hdc: int, rc: _win32typing.PyRECT, edge, Flags) -> _win32typing.PyRECT: ... +def FillRect(hDC: int, rc: _win32typing.PyRECT, hbr: _win32typing.PyGdiHANDLE) -> None: ... +def FillRgn(hdc: int, hrgn: _win32typing.PyGdiHANDLE, hbr: _win32typing.PyGdiHANDLE) -> None: ... +def PaintRgn(hdc: int, hrgn: _win32typing.PyGdiHANDLE) -> None: ... +def FrameRgn(hdc: int, hrgn, hbr, Width, Height) -> None: ... +def InvertRgn(hdc: int, hrgn) -> None: ... +def EqualRgn(SrcRgn1, SrcRgn2): ... +def PtInRegion(hrgn, X, Y): ... +def PtInRect(rect: tuple[int, int, int, int], point: tuple[Incomplete, Incomplete]): ... +def RectInRegion(hrgn, rc: _win32typing.PyRECT): ... +def SetRectRgn(hrgn, LeftRect, TopRect, RightRect, BottomRect) -> None: ... +def CombineRgn(Dest, Src1, Src2, CombineMode): ... +def DrawAnimatedRects(hwnd: int, idAni, minCoords: _win32typing.PyRECT, restCoords: _win32typing.PyRECT) -> None: ... +def CreateSolidBrush(Color) -> _win32typing.PyGdiHANDLE: ... +def CreatePatternBrush(hbmp: _win32typing.PyGdiHANDLE) -> _win32typing.PyGdiHANDLE: ... +def CreateHatchBrush(Style, clrref) -> _win32typing.PyGdiHANDLE: ... +def CreatePen(PenStyle, Width, Color) -> _win32typing.PyGdiHANDLE: ... +def GetSysColor(Index): ... +def GetSysColorBrush(Index) -> _win32typing.PyGdiHANDLE: ... +def InvalidateRect(hWnd: int, Rect: _win32typing.PyRECT, Erase) -> None: ... +def FrameRect(hDC: int, rc: _win32typing.PyRECT, hbr: _win32typing.PyGdiHANDLE) -> None: ... +def InvertRect(hDC: int, rc: _win32typing.PyRECT) -> None: ... +def WindowFromDC(hDC: int) -> int: ... +def GetUpdateRgn(hWnd: int, hRgn: _win32typing.PyGdiHANDLE, Erase): ... +def GetWindowRgn(hWnd: int, hRgn: _win32typing.PyGdiHANDLE): ... +def SetWindowRgn(hWnd: int, hRgn: _win32typing.PyGdiHANDLE, Redraw) -> None: ... +def ValidateRgn(hWnd: int, hRgn: _win32typing.PyGdiHANDLE) -> None: ... +def InvalidateRgn(hWnd: int, hRgn: _win32typing.PyGdiHANDLE, Erase) -> None: ... +def GetRgnBox(hrgn: _win32typing.PyGdiHANDLE) -> tuple[Incomplete, _win32typing.PyRECT]: ... +def OffsetRgn(hrgn: _win32typing.PyGdiHANDLE, XOffset, YOffset): ... +def Rectangle(hdc: int, LeftRect, TopRect, RightRect, BottomRect) -> None: ... +def RoundRect(hdc: int, LeftRect, TopRect, RightRect, BottomRect, Width, Height) -> None: ... +def BeginPaint() -> tuple[Incomplete, Incomplete]: ... +def EndPaint(hwnd: int, ps) -> None: ... +def BeginPath(hdc: int) -> None: ... +def EndPath(hdc: int) -> None: ... +def AbortPath(hdc: int) -> None: ... +def CloseFigure(hdc: int) -> None: ... +def FlattenPath(hdc: int) -> None: ... +def FillPath(hdc: int) -> None: ... +def WidenPath(hdc: int) -> None: ... +def StrokePath(hdc: int) -> None: ... +def StrokeAndFillPath(hdc: int) -> None: ... +def GetMiterLimit(hdc: int) -> float: ... +def SetMiterLimit(hdc: int, NewLimit: float) -> float: ... +def PathToRegion(hdc: int) -> _win32typing.PyGdiHANDLE: ... +def GetPath(hdc: int) -> tuple[Incomplete, Incomplete]: ... +def CreateRoundRectRgn(LeftRect, TopRect, RightRect, BottomRect, WidthEllipse, HeightEllipse): ... +def CreateRectRgnIndirect(rc: _win32typing.PyRECT): ... +def CreateEllipticRgnIndirect(rc: _win32typing.PyRECT): ... +def CreateWindowEx( + dwExStyle, className: str, windowTitle: str, style, x, y, width, height, parent, menu, hinstance, reserved +): ... +def GetParent(child: int) -> int: ... +def SetParent(__child: int, __child1: int | None | _win32typing.PyHANDLE) -> int: ... +def GetCursorPos() -> tuple[Incomplete, Incomplete]: ... +def GetDesktopWindow(): ... +def GetWindow(__hWnd: int, __uCmd: int) -> int: ... +def GetWindowDC(hWnd: int) -> int: ... +def IsIconic(__hWnd: int) -> int: ... +def IsWindow(__hWnd: int) -> int: ... +def IsChild(__hWndParent: int, hWnd: int) -> int: ... +def ReleaseCapture() -> None: ... +def GetCapture(): ... +def SetCapture() -> None: ... +def ReleaseDC(hWnd: int, hDC): ... +def CreateCaret(hWnd: int, hBitmap: _win32typing.PyGdiHANDLE, nWidth, nHeight) -> None: ... +def DestroyCaret() -> None: ... +def ScrollWindowEx( + hWnd: int, dx, dy, rcScroll: _win32typing.PyRECT, rcClip: _win32typing.PyRECT, hrgnUpdate, flags +) -> tuple[Incomplete, _win32typing.PyRECT]: ... +def SetScrollInfo(hwnd: int, nBar, scollInfo: _win32typing.PySCROLLINFO, bRedraw=...) -> None: ... +def GetScrollInfo(hwnd: int, nBar, mask) -> _win32typing.PySCROLLINFO: ... +def GetClassName(hwnd: int) -> str: ... +def WindowFromPoint(point: tuple[int, int]) -> int: ... +def ChildWindowFromPoint(hwndParent: int, point: tuple[Incomplete, Incomplete]): ... +def CreateDC(Driver: str, Device: str, InitData: _win32typing.PyDEVMODE): ... +def GetSaveFileNameW( + hwndOwner: int | None = ..., + hInstance: int | None = ..., + Filter: Incomplete | None = ..., + CustomFilter: Incomplete | None = ..., + FilterIndex: int = ..., + File: Incomplete | None = ..., + MaxFile: int = ..., + InitialDir: Incomplete | None = ..., + Title: Incomplete | None = ..., + Flags: int = ..., + DefExt: Incomplete | None = ..., + TemplateName: _win32typing.PyResourceId | None = ..., +) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def GetOpenFileNameW( + hwndOwner: int | None = ..., + hInstance: int | None = ..., + Filter: Incomplete | None = ..., + CustomFilter: Incomplete | None = ..., + FilterIndex: int = ..., + File: Incomplete | None = ..., + MaxFile: int = ..., + InitialDir: Incomplete | None = ..., + Title: Incomplete | None = ..., + Flags: int = ..., + DefExt: Incomplete | None = ..., + TemplateName: _win32typing.PyResourceId | None = ..., +) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def SystemParametersInfo(Action, Param: Incomplete | None = ..., WinIni: int = ...) -> None: ... +def SetLayeredWindowAttributes(hwnd: int, Key, Alpha, Flags) -> None: ... +def GetLayeredWindowAttributes(hwnd: int) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def UpdateLayeredWindow( + hwnd: int, + arg: tuple[int, int, int, int], + hdcDst: int | None = ..., + ptDst: tuple[Incomplete, Incomplete] | None = ..., + size: tuple[Incomplete, Incomplete] | None = ..., + hdcSrc: Incomplete | None = ..., + ptSrc: tuple[Incomplete, Incomplete] | None = ..., + Key: int = ..., + Flags: int = ..., +) -> None: ... +def AnimateWindow(hwnd: int, Time, Flags) -> None: ... +def CreateBrushIndirect(lb: _win32typing.PyLOGBRUSH) -> _win32typing.PyGdiHANDLE: ... +def ExtCreatePen(PenStyle, Width, lb: _win32typing.PyLOGBRUSH, Style: tuple[Incomplete, ...] | None = ...) -> int: ... +def DrawTextW(hDC: int, String: str, Count, Rect: _win32typing.PyRECT, Format) -> tuple[Incomplete, _win32typing.PyRECT]: ... +def EnumPropsEx(hWnd: int, EnumFunc, Param) -> None: ... +def RegisterDeviceNotification(handle: int, _filter, flags) -> _win32typing.PyHDEVNOTIFY: ... +def UnregisterDeviceNotification() -> None: ... +def RegisterHotKey(hWnd: int, _id, Modifiers, vk) -> None: ... +def ChildWindowFromPointEx(*args, **kwargs): ... # incomplete +def CreateDialogIndirectParam(*args, **kwargs): ... # incomplete +def DestroyAcceleratorTable(*args, **kwargs): ... # incomplete +def Edit_GetLine(*args, **kwargs): ... # incomplete +def GetModuleHandle(*args, **kwargs): ... # incomplete +def GetWindowTextLength(*args, **kwargs): ... # incomplete +def HIWORD(*args, **kwargs): ... # incomplete +def ImageList_Add(*args, **kwargs): ... # incomplete +def ImageList_Create(*args, **kwargs): ... # incomplete +def ImageList_Destroy(*args, **kwargs): ... # incomplete +def ImageList_Draw(*args, **kwargs): ... # incomplete +def ImageList_DrawEx(*args, **kwargs): ... # incomplete +def ImageList_GetIcon(*args, **kwargs): ... # incomplete +def ImageList_GetImageCount(*args, **kwargs): ... # incomplete +def ImageList_LoadBitmap(*args, **kwargs): ... # incomplete +def ImageList_LoadImage(*args, **kwargs): ... # incomplete +def ImageList_Remove(*args, **kwargs): ... # incomplete +def ImageList_Replace(*args, **kwargs): ... # incomplete +def ImageList_ReplaceIcon(*args, **kwargs): ... # incomplete +def ImageList_SetBkColor(*args, **kwargs): ... # incomplete +def ImageList_SetOverlayImage(*args, **kwargs): ... # incomplete +def LOWORD(*args, **kwargs): ... # incomplete +def ListView_SortItems(*args, **kwargs): ... # incomplete +def ListView_SortItemsEx(*args, **kwargs): ... # incomplete +def ValidateRect(*args, **kwargs): ... # incomplete +def WNDCLASS(*args, **kwargs): ... # incomplete +def lpstr(*args, **kwargs): ... # incomplete + +CLR_NONE: int +ILC_COLOR: int +ILC_COLOR16: int +ILC_COLOR24: int +ILC_COLOR32: int +ILC_COLOR4: int +ILC_COLOR8: int +ILC_COLORDDB: int +ILC_MASK: int +ILD_BLEND: int +ILD_BLEND25: int +ILD_BLEND50: int +ILD_FOCUS: int +ILD_MASK: int +ILD_NORMAL: int +ILD_SELECTED: int +ILD_TRANSPARENT: int +IMAGE_BITMAP: int +IMAGE_CURSOR: int +IMAGE_ICON: int +LR_CREATEDIBSECTION: int +LR_DEFAULTCOLOR: int +LR_DEFAULTSIZE: int +LR_LOADFROMFILE: int +LR_LOADMAP3DCOLORS: int +LR_LOADTRANSPARENT: int +LR_MONOCHROME: int +LR_SHARED: int +LR_VGACOLOR: int +NIF_ICON: int +NIF_INFO: int +NIF_MESSAGE: int +NIF_STATE: int +NIF_TIP: int +NIIF_ERROR: int +NIIF_ICON_MASK: int +NIIF_INFO: int +NIIF_NONE: int +NIIF_NOSOUND: int +NIIF_WARNING: int +NIM_ADD: int +NIM_DELETE: int +NIM_MODIFY: int +NIM_SETVERSION: int +TPM_BOTTOMALIGN: int +TPM_CENTERALIGN: int +TPM_LEFTALIGN: int +TPM_LEFTBUTTON: int +TPM_NONOTIFY: int +TPM_RETURNCMD: int +TPM_RIGHTALIGN: int +TPM_RIGHTBUTTON: int +TPM_TOPALIGN: int +TPM_VCENTERALIGN: int +UNICODE: bool +dllhandle: int diff --git a/stubs/pywin32/win32/win32help.pyi b/stubs/pywin32/win32/win32help.pyi new file mode 100644 index 0000000..7d8b001 --- /dev/null +++ b/stubs/pywin32/win32/win32help.pyi @@ -0,0 +1,180 @@ +import _win32typing + +def WinHelp(hwnd: int, hlpFile: str, cmd, data: str | None = ...) -> None: ... +def HH_AKLINK() -> _win32typing.PyHH_AKLINK: ... +def HH_FTS_QUERY() -> _win32typing.PyHH_FTS_QUERY: ... +def HH_POPUP() -> _win32typing.PyHH_POPUP: ... +def HH_WINTYPE() -> _win32typing.PyHH_WINTYPE: ... +def NMHDR() -> _win32typing.PyNMHDR: ... +def HHN_NOTIFY() -> _win32typing.PyHHN_NOTIFY: ... +def HHNTRACK() -> _win32typing.PyHHNTRACK: ... +def HtmlHelp(hwnd: int, file: str, cmd, data: str | tuple[int] | int = ...): ... + +debug: int +HH_ALINK_LOOKUP: int +HH_CLOSE_ALL: int +HH_DISPLAY_INDEX: int +HH_DISPLAY_SEARCH: int +HH_DISPLAY_TEXT_POPUP: int +HH_DISPLAY_TOC: int +HH_DISPLAY_TOPIC: int +HH_ENUM_CATEGORY: int +HH_ENUM_CATEGORY_IT: int +HH_ENUM_INFO_TYPE: int +HH_FTS_DEFAULT_PROXIMITY: int +HH_GET_LAST_ERROR: int +HH_GET_WIN_HANDLE: int +HH_GET_WIN_TYPE: int +HH_GPROPID_CONTENT_LANGUAGE: int +HH_GPROPID_CURRENT_SUBSET: int +HH_GPROPID_SINGLETHREAD: int +HH_GPROPID_TOOLBAR_MARGIN: int +HH_GPROPID_UI_LANGUAGE: int +HH_HELP_CONTEXT: int +HH_HELP_FINDER: int +HH_INITIALIZE: int +HH_KEYWORD_LOOKUP: int +HH_MAX_TABS_CUSTOM: int +HH_PRETRANSLATEMESSAGE: int +HH_RESERVED1: int +HH_RESERVED2: int +HH_RESERVED3: int +HH_RESET_IT_FILTER: int +HH_SET_EXCLUSIVE_FILTER: int +HH_SET_GLOBAL_PROPERTY: int +HH_SET_INCLUSIVE_FILTER: int +HH_SET_INFO_TYPE: int +HH_SET_WIN_TYPE: int +HH_SYNC: int +HH_TAB_AUTHOR: int +HH_TAB_CONTENTS: int +HH_TAB_CUSTOM_FIRST: int +HH_TAB_CUSTOM_LAST: int +HH_TAB_FAVORITES: int +HH_TAB_HISTORY: int +HH_TAB_INDEX: int +HH_TAB_SEARCH: int +HH_TP_HELP_CONTEXTMENU: int +HH_TP_HELP_WM_HELP: int +HH_UNINITIALIZE: int +HHACT_BACK: int +HHACT_CONTRACT: int +HHACT_CUSTOMIZE: int +HHACT_EXPAND: int +HHACT_FORWARD: int +HHACT_HIGHLIGHT: int +HHACT_HOME: int +HHACT_JUMP1: int +HHACT_JUMP2: int +HHACT_LAST_ENUM: int +HHACT_NOTES: int +HHACT_OPTIONS: int +HHACT_PRINT: int +HHACT_REFRESH: int +HHACT_STOP: int +HHACT_SYNC: int +HHACT_TAB_CONTENTS: int +HHACT_TAB_FAVORITES: int +HHACT_TAB_HISTORY: int +HHACT_TAB_INDEX: int +HHACT_TAB_SEARCH: int +HHACT_TOC_NEXT: int +HHACT_TOC_PREV: int +HHACT_ZOOM: int +HHN_FIRST: int +HHN_LAST: int +HHN_NAVCOMPLETE: int +HHN_TRACK: int +HHN_WINDOW_CREATE: int +HHWIN_BUTTON_BACK: int +HHWIN_BUTTON_BROWSE_BCK: int +HHWIN_BUTTON_BROWSE_FWD: int +HHWIN_BUTTON_CONTENTS: int +HHWIN_BUTTON_EXPAND: int +HHWIN_BUTTON_FAVORITES: int +HHWIN_BUTTON_FORWARD: int +HHWIN_BUTTON_HISTORY: int +HHWIN_BUTTON_HOME: int +HHWIN_BUTTON_INDEX: int +HHWIN_BUTTON_JUMP1: int +HHWIN_BUTTON_JUMP2: int +HHWIN_BUTTON_NOTES: int +HHWIN_BUTTON_OPTIONS: int +HHWIN_BUTTON_PRINT: int +HHWIN_BUTTON_REFRESH: int +HHWIN_BUTTON_SEARCH: int +HHWIN_BUTTON_STOP: int +HHWIN_BUTTON_SYNC: int +HHWIN_BUTTON_TOC_NEXT: int +HHWIN_BUTTON_TOC_PREV: int +HHWIN_BUTTON_ZOOM: int +HHWIN_DEF_BUTTONS: int +HHWIN_NAVTAB_BOTTOM: int +HHWIN_NAVTAB_LEFT: int +HHWIN_NAVTAB_TOP: int +HHWIN_PARAM_CUR_TAB: int +HHWIN_PARAM_EXPANSION: int +HHWIN_PARAM_EXSTYLES: int +HHWIN_PARAM_HISTORY_COUNT: int +HHWIN_PARAM_INFOTYPES: int +HHWIN_PARAM_NAV_WIDTH: int +HHWIN_PARAM_PROPERTIES: int +HHWIN_PARAM_RECT: int +HHWIN_PARAM_SHOWSTATE: int +HHWIN_PARAM_STYLES: int +HHWIN_PARAM_TABORDER: int +HHWIN_PARAM_TABPOS: int +HHWIN_PARAM_TB_FLAGS: int +HHWIN_PROP_AUTO_SYNC: int +HHWIN_PROP_CHANGE_TITLE: int +HHWIN_PROP_MENU: int +HHWIN_PROP_NAV_ONLY_WIN: int +HHWIN_PROP_NO_TOOLBAR: int +HHWIN_PROP_NODEF_EXSTYLES: int +HHWIN_PROP_NODEF_STYLES: int +HHWIN_PROP_NOTB_TEXT: int +HHWIN_PROP_NOTITLEBAR: int +HHWIN_PROP_ONTOP: int +HHWIN_PROP_POST_QUIT: int +HHWIN_PROP_TAB_ADVSEARCH: int +HHWIN_PROP_TAB_AUTOHIDESHOW: int +HHWIN_PROP_TAB_CUSTOM1: int +HHWIN_PROP_TAB_CUSTOM2: int +HHWIN_PROP_TAB_CUSTOM3: int +HHWIN_PROP_TAB_CUSTOM4: int +HHWIN_PROP_TAB_CUSTOM5: int +HHWIN_PROP_TAB_CUSTOM6: int +HHWIN_PROP_TAB_CUSTOM7: int +HHWIN_PROP_TAB_CUSTOM8: int +HHWIN_PROP_TAB_CUSTOM9: int +HHWIN_PROP_TAB_FAVORITES: int +HHWIN_PROP_TAB_HISTORY: int +HHWIN_PROP_TAB_SEARCH: int +HHWIN_PROP_TRACKING: int +HHWIN_PROP_TRI_PANE: int +HHWIN_PROP_USER_POS: int +HHWIN_TB_MARGIN: int +IDTB_BACK: int +IDTB_BROWSE_BACK: int +IDTB_BROWSE_FWD: int +IDTB_CONTENTS: int +IDTB_CONTRACT: int +IDTB_CUSTOMIZE: int +IDTB_EXPAND: int +IDTB_FAVORITES: int +IDTB_FORWARD: int +IDTB_HISTORY: int +IDTB_HOME: int +IDTB_INDEX: int +IDTB_JUMP1: int +IDTB_JUMP2: int +IDTB_NOTES: int +IDTB_OPTIONS: int +IDTB_PRINT: int +IDTB_REFRESH: int +IDTB_SEARCH: int +IDTB_STOP: int +IDTB_SYNC: int +IDTB_TOC_NEXT: int +IDTB_TOC_PREV: int +IDTB_ZOOM: int diff --git a/stubs/pywin32/win32/win32inet.pyi b/stubs/pywin32/win32/win32inet.pyi new file mode 100644 index 0000000..ec5eb22 --- /dev/null +++ b/stubs/pywin32/win32/win32inet.pyi @@ -0,0 +1,69 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def InternetSetCookie(url: str, lpszCookieName: str, data: str) -> None: ... +def InternetGetCookie(Url: str, CookieName: str) -> str: ... +def InternetAttemptConnect(Reserved: int = ...) -> None: ... +def InternetCheckConnection(Url: str, Flags: int = ..., Reserved: int = ...) -> None: ... +def InternetGoOnline(Url: str, Parent: Incomplete | None = ..., Flags: int = ...) -> None: ... +def InternetCloseHandle(handle: _win32typing.PyHINTERNET) -> None: ... +def InternetConnect( + Internet: _win32typing.PyHINTERNET, + ServerName: str, + ServerPort, + Username: str, + Password: str, + Service, + Flags, + Context: Incomplete | None = ..., +) -> None: ... +def InternetOpen(agent: str, proxyName: str, proxyBypass: str, flags) -> None: ... +def InternetOpenUrl( + Internet: _win32typing.PyHINTERNET, Url: str, Headers: str | None = ..., Flags: int = ..., Context: Incomplete | None = ... +) -> _win32typing.PyHINTERNET: ... +def InternetCanonicalizeUrl(url: str, flags: int = ...) -> str: ... +def InternetGetLastResponseInfo() -> tuple[Incomplete, str]: ... +def InternetReadFile(hInternet: _win32typing.PyHINTERNET, size) -> str: ... +def InternetWriteFile(File: _win32typing.PyHINTERNET, Buffer: str): ... +def FtpOpenFile( + hConnect: _win32typing.PyHINTERNET, FileName: str, Access, Flags, Context: Incomplete | None = ... +) -> _win32typing.PyHINTERNET: ... +def FtpCommand( + Connect: _win32typing.PyHINTERNET, ExpectResponse, Flags, Command: str, Context: Incomplete | None = ... +) -> _win32typing.PyHINTERNET: ... +def InternetQueryOption(hInternet: _win32typing.PyHINTERNET, Option): ... +def InternetSetOption(hInternet: _win32typing.PyHINTERNET, Option, Buffer) -> None: ... +def FindFirstUrlCacheEntry(SearchPattern: Incomplete | None = ...) -> tuple[_win32typing.PyUrlCacheHANDLE, Incomplete]: ... +def FindNextUrlCacheEntry(EnumHandle: _win32typing.PyUrlCacheHANDLE): ... +def FindFirstUrlCacheEntryEx( + SearchPattern: Incomplete | None = ..., Flags: int = ..., Filter: int = ..., GroupId=... +) -> tuple[_win32typing.PyUrlCacheHANDLE, Incomplete]: ... +def FindNextUrlCacheEntryEx(EnumHandle: _win32typing.PyUrlCacheHANDLE): ... +def FindCloseUrlCache(EnumHandle: _win32typing.PyUrlCacheHANDLE) -> None: ... +def FindFirstUrlCacheGroup(Filter) -> tuple[_win32typing.PyUrlCacheHANDLE, Incomplete]: ... +def FindNextUrlCacheGroup(Find: int): ... +def GetUrlCacheEntryInfo(UrlName): ... +def DeleteUrlCacheGroup(GroupId, Attributes) -> None: ... +def CreateUrlCacheGroup(Flags: int = ...): ... +def CreateUrlCacheEntry(UrlName, ExpectedFileSize, FileExtension): ... +def CommitUrlCacheEntry( + UrlName, + LocalFileName, + CacheEntryType, + ExpireTime: _win32typing.PyTime | None = ..., + LastModifiedTime: _win32typing.PyTime | None = ..., + HeaderInfo: Incomplete | None = ..., + OriginalUrl: Incomplete | None = ..., +): ... +def SetUrlCacheEntryGroup(UrlName, Flags, GroupId) -> None: ... +def GetUrlCacheGroupAttribute(GroupId, Attributes): ... +def SetUrlCacheGroupAttribute(GroupId, Attributes, GroupInfo, Flags=...) -> None: ... +def DeleteUrlCacheEntry(UrlName) -> None: ... +def WinHttpGetDefaultProxyConfiguration(*args, **kwargs): ... # incomplete +def WinHttpGetIEProxyConfigForCurrentUser(*args, **kwargs): ... # incomplete +def WinHttpGetProxyForUrl(*args, **kwargs): ... # incomplete +def WinHttpOpen(*args, **kwargs): ... # incomplete + +UNICODE: int diff --git a/stubs/pywin32/win32/win32job.pyi b/stubs/pywin32/win32/win32job.pyi new file mode 100644 index 0000000..2edda45 --- /dev/null +++ b/stubs/pywin32/win32/win32job.pyi @@ -0,0 +1,74 @@ +import _win32typing +from win32.lib.pywintypes import error as error + +def AssignProcessToJobObject(hJob: int, hProcess: int) -> None: ... +def CreateJobObject(jobAttributes: _win32typing.PySECURITY_ATTRIBUTES, name) -> None: ... +def OpenJobObject(desiredAccess, inheritHandles, name) -> None: ... +def TerminateJobObject(hJob: int, exitCode) -> None: ... +def UserHandleGrantAccess(hUserHandle: int, hJob: int, grant) -> None: ... +def IsProcessInJob(__hProcess: int, __hJob: int): ... +def QueryInformationJobObject(Job: int, JobObjectInfoClass): ... +def SetInformationJobObject(Job: int, JobObjectInfoClass, JobObjectInfo) -> None: ... + +JOB_OBJECT_ALL_ACCESS: int +JOB_OBJECT_ASSIGN_PROCESS: int +JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS: int +JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS: int +JOB_OBJECT_LIMIT_ACTIVE_PROCESS: int +JOB_OBJECT_LIMIT_AFFINITY: int +JOB_OBJECT_LIMIT_BREAKAWAY_OK: int +JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION: int +JOB_OBJECT_LIMIT_JOB_MEMORY: int +JOB_OBJECT_LIMIT_JOB_TIME: int +JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: int +JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME: int +JOB_OBJECT_LIMIT_PRIORITY_CLASS: int +JOB_OBJECT_LIMIT_PROCESS_MEMORY: int +JOB_OBJECT_LIMIT_PROCESS_TIME: int +JOB_OBJECT_LIMIT_SCHEDULING_CLASS: int +JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK: int +JOB_OBJECT_LIMIT_VALID_FLAGS: int +JOB_OBJECT_LIMIT_WORKINGSET: int +JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: int +JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT: int +JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: int +JOB_OBJECT_MSG_END_OF_JOB_TIME: int +JOB_OBJECT_MSG_END_OF_PROCESS_TIME: int +JOB_OBJECT_MSG_EXIT_PROCESS: int +JOB_OBJECT_MSG_JOB_MEMORY_LIMIT: int +JOB_OBJECT_MSG_NEW_PROCESS: int +JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: int +JOB_OBJECT_POST_AT_END_OF_JOB: int +JOB_OBJECT_QUERY: int +JOB_OBJECT_SECURITY_FILTER_TOKENS: int +JOB_OBJECT_SECURITY_NO_ADMIN: int +JOB_OBJECT_SECURITY_ONLY_TOKEN: int +JOB_OBJECT_SECURITY_RESTRICTED_TOKEN: int +JOB_OBJECT_SECURITY_VALID_FLAGS: int +JOB_OBJECT_SET_ATTRIBUTES: int +JOB_OBJECT_SET_SECURITY_ATTRIBUTES: int +JOB_OBJECT_TERMINATE: int +JOB_OBJECT_TERMINATE_AT_END_OF_JOB: int +JOB_OBJECT_UI_VALID_FLAGS: int +JOB_OBJECT_UILIMIT_ALL: int +JOB_OBJECT_UILIMIT_DESKTOP: int +JOB_OBJECT_UILIMIT_DISPLAYSETTINGS: int +JOB_OBJECT_UILIMIT_EXITWINDOWS: int +JOB_OBJECT_UILIMIT_GLOBALATOMS: int +JOB_OBJECT_UILIMIT_HANDLES: int +JOB_OBJECT_UILIMIT_NONE: int +JOB_OBJECT_UILIMIT_READCLIPBOARD: int +JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS: int +JOB_OBJECT_UILIMIT_WRITECLIPBOARD: int +JobObjectAssociateCompletionPortInformation: int +JobObjectBasicAccountingInformation: int +JobObjectBasicAndIoAccountingInformation: int +JobObjectBasicLimitInformation: int +JobObjectBasicUIRestrictions: int +JobObjectEndOfJobTimeInformation: int +JobObjectExtendedLimitInformation: int +JobObjectJobSetInformation: int +JobObjectSecurityLimitInformation: int +MaxJobObjectInfoClass: int +JobObjectBasicProcessIdList: int +UNICODE: int diff --git a/stubs/pywin32/win32/win32lz.pyi b/stubs/pywin32/win32/win32lz.pyi new file mode 100644 index 0000000..21a271c --- /dev/null +++ b/stubs/pywin32/win32/win32lz.pyi @@ -0,0 +1,9 @@ +from _typeshed import Incomplete + +from win32.lib.pywintypes import error as error + +def GetExpandedName(Source) -> str: ... +def Close(handle) -> None: ... +def Copy(hSrc, hDest): ... +def Init(handle) -> None: ... +def OpenFile(fileName: str, action) -> tuple[Incomplete, Incomplete]: ... diff --git a/stubs/pywin32/win32/win32net.pyi b/stubs/pywin32/win32/win32net.pyi new file mode 100644 index 0000000..4536810 --- /dev/null +++ b/stubs/pywin32/win32/win32net.pyi @@ -0,0 +1,90 @@ +from _typeshed import Incomplete + +from win32.lib.pywintypes import error as error + +def NetGetJoinInformation() -> tuple[str, Incomplete]: ... +def NetGroupGetInfo(server: str, groupname: str, level): ... +def NetGroupGetUsers( + server: str, groupName: str, level, resumeHandle: int = ..., prefLen: int = ... +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetGroupSetUsers(server: str, group: str, level, members: tuple[Incomplete, Incomplete]) -> None: ... +def NetGroupSetInfo(server: str, groupname: str, level, data) -> None: ... +def NetGroupAdd(server: str, level, data) -> None: ... +def NetGroupAddUser(server: str, group: str, username: str) -> None: ... +def NetGroupDel(server: str, groupname: str) -> None: ... +def NetGroupDelUser(server: str, group: str, username: str) -> None: ... +def NetGroupEnum(server: str, level, prefLen, resumeHandle=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetLocalGroupAddMembers(server: str, group: str, level, members: tuple[Incomplete, Incomplete]) -> None: ... +def NetLocalGroupDelMembers(server: str, group: str, members: list[str]) -> None: ... +def NetLocalGroupGetMembers( + server: str, groupName: str, level, resumeHandle: int = ..., prefLen: int = ... +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetLocalGroupSetMembers(server: str, group: str, level, members: tuple[Incomplete, Incomplete]) -> None: ... +def NetMessageBufferSend(domain: str, userName: str, fromName: str, message: str) -> None: ... +def NetMessageNameAdd(server, msgname) -> None: ... +def NetMessageNameDel(server, msgname) -> None: ... +def NetMessageNameEnum(Server) -> None: ... +def NetServerEnum( + server: str, level, _type, prefLen, domain: str | None = ..., resumeHandle: int = ... +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetServerGetInfo(server: str, level): ... +def NetServerSetInfo(server: str, level, data) -> None: ... +def NetShareAdd(server: str, level, data) -> None: ... +def NetShareDel(server: str, shareName: str, reserved: int = ...) -> None: ... +def NetShareCheck(server: str, deviceName: str) -> tuple[Incomplete, Incomplete]: ... +def NetShareEnum( + server: str, level, prefLen, serverName, resumeHandle=... +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetShareGetInfo(server: str, netname: str, level): ... +def NetShareSetInfo(server: str, netname: str, level, data) -> None: ... +def NetUserAdd(server: str, level, data) -> None: ... +def NetUserChangePassword(server: str, username: str, oldPassword: str, newPassword: str) -> None: ... +def NetUserEnum(server: str, level, arg, prefLen, resumeHandle=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetUserGetGroups(serverName: str, userName: str) -> list[tuple[Incomplete, Incomplete]]: ... +def NetUserGetInfo(server: str, username: str, level): ... +def NetUserGetLocalGroups(serverName: str, userName: str, flags) -> list[Incomplete]: ... +def NetUserSetInfo(server: str, username: str, level, data) -> None: ... +def NetUserDel(server: str, username: str) -> None: ... +def NetUserModalsGet(server: str, level): ... +def NetUserModalsSet(server: str, level, data) -> None: ... +def NetWkstaUserEnum(server: str, level, prefLen, resumeHandle=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetWkstaGetInfo(server: str, level): ... +def NetWkstaSetInfo(server: str, level, data) -> None: ... +def NetWkstaTransportEnum( + server: str, level, prefLen, resumeHandle=... +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetWkstaTransportAdd(server: str, level, data) -> None: ... +def NetWkstaTransportDel(server: str, TransportName: str, ucond: int = ...) -> None: ... +def NetServerDiskEnum(server: str, level): ... +def NetUseAdd(server: str, level, data) -> None: ... +def NetUseDel(server: str, useName: str, forceCond: int = ...) -> None: ... +def NetUseEnum(server: str, level, prefLen, resumeHandle=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def NetUseGetInfo(server: str, usename: str, level: int = ...): ... +def NetGetAnyDCName(server: str | None = ..., domain: str | None = ...) -> str: ... +def NetGetDCName(server: str | None = ..., domain: str | None = ...) -> str: ... +def NetSessionEnum( + level, server: str | None = ..., client: str | None = ..., username: str | None = ... +) -> tuple[Incomplete, ...]: ... +def NetSessionDel(server: str, client: str | None = ..., username: str | None = ...) -> None: ... +def NetSessionGetInfo(level, server: str, client: str, username: str): ... +def NetFileEnum( + level, servername: str | None = ..., basepath: str | None = ..., username: str | None = ... +) -> tuple[Incomplete, ...]: ... +def NetFileClose(servername: str, fileid) -> None: ... +def NetFileGetInfo(level, servername: str, fileid): ... +def NetStatisticsGet(server: str, service: str, level, options): ... +def NetServerComputerNameAdd(ServerName: str, EmulatedDomainName: str, EmulatedServerName: str) -> None: ... +def NetServerComputerNameDel(ServerName: str, EmulatedServerName: str) -> None: ... +def NetValidateName(Server: str, Name: str, NameType, Account: str | None = ..., Password: str | None = ...) -> None: ... +def NetValidatePasswordPolicy(Server: str, Qualifier, ValidationType, arg) -> None: ... +def NetLocalGroupAdd(*args, **kwargs): ... # incomplete +def NetLocalGroupDel(*args, **kwargs): ... # incomplete +def NetLocalGroupEnum(*args, **kwargs): ... # incomplete +def NetLocalGroupGetInfo(*args, **kwargs): ... # incomplete +def NetLocalGroupSetInfo(*args, **kwargs): ... # incomplete + +SERVICE_SERVER: str +SERVICE_WORKSTATION: str +USE_FORCE: int +USE_LOTS_OF_FORCE: int +USE_NOFORCE: int diff --git a/stubs/pywin32/win32/win32pdh.pyi b/stubs/pywin32/win32/win32pdh.pyi new file mode 100644 index 0000000..9ae7795 --- /dev/null +++ b/stubs/pywin32/win32/win32pdh.pyi @@ -0,0 +1,60 @@ +from _typeshed import Incomplete + +from win32.lib.pywintypes import error as error + +def AddCounter(hQuery, path: str, userData: int = ...): ... +def AddEnglishCounter(hQuery, path: str, userData: int = ...): ... +def RemoveCounter(handle) -> None: ... +def EnumObjectItems(DataSource: str, machine: str, _object: str, detailLevel, flags=...): ... +def EnumObjects(DataSource: str, machine: str, detailLevel, refresh: int = ...): ... +def OpenQuery(DataSource: Incomplete | None = ..., userData: int = ...): ... +def CloseQuery(handle) -> None: ... +def MakeCounterPath( + elements: tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete], flags=... +) -> None: ... +def GetCounterInfo(handle, bRetrieveExplainText) -> None: ... +def GetFormattedCounterValue(handle, _format) -> tuple[Incomplete, Incomplete]: ... +def CollectQueryData(hQuery) -> None: ... +def ValidatePath(path: str): ... +def ExpandCounterPath(wildCardPath: str) -> tuple[Incomplete, Incomplete]: ... +def ParseCounterPath(path: str, flags=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... +def ParseInstanceName(instanceName: str) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def SetCounterScaleFactor(hCounter, factor) -> None: ... +def BrowseCounters( + Flags: tuple[Incomplete, ...], + hWndOwner: int, + CallBack1, + CallBack2, + DialogBoxCaption: str | None = ..., + InitialPath: Incomplete | None = ..., + DataSource: Incomplete | None = ..., + ReturnMultiple: bool = ..., + CallBackArg: Incomplete | None = ..., +) -> str: ... +def ConnectMachine(machineName: str) -> str: ... +def LookupPerfIndexByName(machineName: str, instanceName: str): ... +def LookupPerfNameByIndex(machineName: str, index) -> str: ... +def GetFormattedCounterArray(*args, **kwargs): ... # incomplete + +PDH_FMT_1000: int +PDH_FMT_ANSI: int +PDH_FMT_DOUBLE: int +PDH_FMT_LARGE: int +PDH_FMT_LONG: int +PDH_FMT_NODATA: int +PDH_FMT_NOSCALE: int +PDH_FMT_RAW: int +PDH_FMT_UNICODE: int +PDH_MAX_SCALE: int +PDH_MIN_SCALE: int +PDH_PATH_WBEM_INPUT: int +PDH_PATH_WBEM_RESULT: int +PDH_VERSION: int +PERF_DETAIL_ADVANCED: int +PERF_DETAIL_EXPERT: int +PERF_DETAIL_NOVICE: int +PERF_DETAIL_WIZARD: int + +class counter_status_error(Exception): ... + +PDH_FMT_NOCAP100: int diff --git a/stubs/pywin32/win32/win32pipe.pyi b/stubs/pywin32/win32/win32pipe.pyi new file mode 100644 index 0000000..5e62224 --- /dev/null +++ b/stubs/pywin32/win32/win32pipe.pyi @@ -0,0 +1,55 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def GetNamedPipeHandleState(hPipe: int, bGetCollectionData=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, str]: ... +def SetNamedPipeHandleState(hPipe: int, Mode, MaxCollectionCount, CollectDataTimeout) -> None: ... +def ConnectNamedPipe(hPipe: int, overlapped: _win32typing.PyOVERLAPPED | None = ...): ... +def TransactNamedPipe( + pipeName, + writeData: str, + buffer_bufSize: _win32typing.PyOVERLAPPEDReadBuffer, + overlapped: _win32typing.PyOVERLAPPED | None = ..., +) -> str: ... +def CallNamedPipe(pipeName, data: str, bufSize, timeOut) -> str: ... +def CreatePipe(sa: _win32typing.PySECURITY_ATTRIBUTES, nSize) -> tuple[int, int]: ... +def FdCreatePipe(sa: _win32typing.PySECURITY_ATTRIBUTES, nSize, mode) -> tuple[Incomplete, Incomplete]: ... +def CreateNamedPipe( + pipeName: str, + openMode, + pipeMode, + nMaxInstances, + nOutBufferSize, + nInBufferSize, + nDefaultTimeOut, + sa: _win32typing.PySECURITY_ATTRIBUTES, +) -> int: ... +def DisconnectNamedPipe(hFile: int) -> None: ... +def GetOverlappedResult(hFile: int, overlapped: _win32typing.PyOVERLAPPED, bWait): ... +def WaitNamedPipe(pipeName: str, timeout) -> None: ... +def GetNamedPipeInfo(hNamedPipe: int) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +def PeekNamedPipe(hPipe: int, size) -> tuple[str, Incomplete, Incomplete]: ... +def GetNamedPipeClientProcessId(hPipe: int): ... +def GetNamedPipeServerProcessId(hPipe: int): ... +def GetNamedPipeClientSessionId(hPipe: int): ... +def GetNamedPipeServerSessionId(hPipe: int): ... +def popen(cmdstring: str, mode: str): ... +def popen2(*args, **kwargs): ... # incomplete +def popen3(*args, **kwargs): ... # incomplete +def popen4(*args, **kwargs): ... # incomplete + +NMPWAIT_NOWAIT: int +NMPWAIT_USE_DEFAULT_WAIT: int +NMPWAIT_WAIT_FOREVER: int +PIPE_ACCESS_DUPLEX: int +PIPE_ACCESS_INBOUND: int +PIPE_ACCESS_OUTBOUND: int +PIPE_NOWAIT: int +PIPE_READMODE_BYTE: int +PIPE_READMODE_MESSAGE: int +PIPE_TYPE_BYTE: int +PIPE_TYPE_MESSAGE: int +PIPE_UNLIMITED_INSTANCES: int +PIPE_WAIT: int +UNICODE: int diff --git a/stubs/pywin32/win32/win32print.pyi b/stubs/pywin32/win32/win32print.pyi new file mode 100644 index 0000000..7d726f4 --- /dev/null +++ b/stubs/pywin32/win32/win32print.pyi @@ -0,0 +1,197 @@ +from _typeshed import Incomplete + +import _win32typing + +def OpenPrinter(printer: str, Defaults: Incomplete | None = ...) -> _win32typing.PyPrinterHANDLE: ... +def GetPrinter(hPrinter: _win32typing.PyPrinterHANDLE, Level: int = ...): ... +def SetPrinter(hPrinter: _win32typing.PyPrinterHANDLE, Level, pPrinter, Command) -> None: ... +def ClosePrinter(hPrinter: _win32typing.PyPrinterHANDLE) -> None: ... +def AddPrinterConnection(printer: str): ... +def DeletePrinterConnection(printer: str): ... +def EnumPrinters(flags, name: str | None = ..., level: int = ...): ... +def GetDefaultPrinter() -> str: ... +def GetDefaultPrinterW() -> str: ... +def SetDefaultPrinter(printer: str): ... +def SetDefaultPrinterW(Printer: str): ... +def StartDocPrinter(hprinter: _win32typing.PyPrinterHANDLE, _tuple, level: int = ...): ... +def EndDocPrinter(hPrinter: _win32typing.PyPrinterHANDLE): ... +def AbortPrinter(hPrinter: _win32typing.PyPrinterHANDLE) -> None: ... +def StartPagePrinter(hprinter: _win32typing.PyPrinterHANDLE) -> None: ... +def EndPagePrinter(hprinter: _win32typing.PyPrinterHANDLE) -> None: ... +def StartDoc(hdc: int, docinfo): ... +def EndDoc(hdc: int) -> None: ... +def AbortDoc(hdc: int) -> None: ... +def StartPage(hdc: int) -> None: ... +def EndPage(hdc: int) -> None: ... +def WritePrinter(hprinter: _win32typing.PyPrinterHANDLE, buf: str): ... +def EnumJobs(hPrinter: _win32typing.PyPrinterHANDLE, FirstJob, NoJobs, Level=...): ... +def GetJob(hPrinter: _win32typing.PyPrinterHANDLE, JobID, Level: int = ...): ... +def SetJob(hPrinter: _win32typing.PyPrinterHANDLE, JobID, Level, JobInfo, Command): ... +def DocumentProperties( + HWnd: int, + hPrinter: _win32typing.PyPrinterHANDLE, + DeviceName: str, + DevModeOutput: _win32typing.PyDEVMODE, + DevModeInput: _win32typing.PyDEVMODE, + Mode, +): ... +def EnumPrintProcessors(Server: str | None = ..., Environment: str | None = ...) -> tuple[str, ...]: ... +def EnumPrintProcessorDatatypes(ServerName: str, PrintProcessorName: str) -> tuple[str, ...]: ... +def EnumPrinterDrivers(Server: str | None = ..., Environment: str | None = ..., Level=...) -> tuple[Incomplete, ...]: ... +def EnumForms(hprinter: _win32typing.PyPrinterHANDLE) -> tuple[_win32typing.FORM_INFO_1, ...]: ... +def AddForm(hprinter: _win32typing.PyPrinterHANDLE, Form) -> None: ... +def DeleteForm(hprinter: _win32typing.PyPrinterHANDLE, FormName: str) -> None: ... +def GetForm(hprinter: _win32typing.PyPrinterHANDLE, FormName: str) -> None: ... +def SetForm(hprinter: _win32typing.PyPrinterHANDLE, FormName: str, Form) -> None: ... +def AddJob(hprinter: _win32typing.PyPrinterHANDLE) -> None: ... +def ScheduleJob(hprinter: _win32typing.PyPrinterHANDLE, JobId) -> None: ... +def DeviceCapabilities(Device: str, Port: str, Capability, DEVMODE: _win32typing.PyDEVMODE | None = ...) -> None: ... +def GetDeviceCaps(hdc: int, Index): ... +def EnumMonitors(Name: str, Level) -> tuple[Incomplete, ...]: ... +def EnumPorts(Name: str, Level) -> tuple[Incomplete, ...]: ... +def GetPrintProcessorDirectory(Name: str, Environment: str) -> str: ... +def GetPrinterDriverDirectory(Name: str, Environment: str) -> str: ... +def AddPrinter(Name: str, Level, pPrinter) -> _win32typing.PyPrinterHANDLE: ... +def DeletePrinter(hPrinter: _win32typing.PyPrinterHANDLE) -> None: ... +def DeletePrinterDriver(Server: str, Environment: str, DriverName: str) -> None: ... +def DeletePrinterDriverEx(Server: str, Environment: str, DriverName: str, DeleteFlag, VersionFlag) -> None: ... +def FlushPrinter(Printer: _win32typing.PyPrinterHANDLE, Buf, Sleep): ... + +DEF_PRIORITY: int +DI_APPBANDING: int +DI_ROPS_READ_DESTINATION: int +DPD_DELETE_ALL_FILES: int +DPD_DELETE_SPECIFIC_VERSION: int +DPD_DELETE_UNUSED_FILES: int +DSPRINT_PENDING: int +DSPRINT_PUBLISH: int +DSPRINT_REPUBLISH: int +DSPRINT_UNPUBLISH: int +DSPRINT_UPDATE: int +FORM_BUILTIN: int +FORM_PRINTER: int +FORM_USER: int +JOB_ACCESS_ADMINISTER: int +JOB_ACCESS_READ: int +JOB_ALL_ACCESS: int +JOB_CONTROL_CANCEL: int +JOB_CONTROL_DELETE: int +JOB_CONTROL_LAST_PAGE_EJECTED: int +JOB_CONTROL_PAUSE: int +JOB_CONTROL_RESTART: int +JOB_CONTROL_RESUME: int +JOB_CONTROL_SENT_TO_PRINTER: int +JOB_EXECUTE: int +JOB_INFO_1: int +JOB_POSITION_UNSPECIFIED: int +JOB_READ: int +JOB_STATUS_BLOCKED_DEVQ: int +JOB_STATUS_COMPLETE: int +JOB_STATUS_DELETED: int +JOB_STATUS_DELETING: int +JOB_STATUS_ERROR: int +JOB_STATUS_OFFLINE: int +JOB_STATUS_PAPEROUT: int +JOB_STATUS_PAUSED: int +JOB_STATUS_PRINTED: int +JOB_STATUS_PRINTING: int +JOB_STATUS_RESTART: int +JOB_STATUS_SPOOLING: int +JOB_STATUS_USER_INTERVENTION: int +JOB_WRITE: int +MAX_PRIORITY: int +MIN_PRIORITY: int +PORT_STATUS_DOOR_OPEN: int +PORT_STATUS_NO_TONER: int +PORT_STATUS_OFFLINE: int +PORT_STATUS_OUTPUT_BIN_FULL: int +PORT_STATUS_OUT_OF_MEMORY: int +PORT_STATUS_PAPER_JAM: int +PORT_STATUS_PAPER_OUT: int +PORT_STATUS_PAPER_PROBLEM: int +PORT_STATUS_POWER_SAVE: int +PORT_STATUS_TONER_LOW: int +PORT_STATUS_TYPE_ERROR: int +PORT_STATUS_TYPE_INFO: int +PORT_STATUS_TYPE_WARNING: int +PORT_STATUS_USER_INTERVENTION: int +PORT_STATUS_WARMING_UP: int +PORT_TYPE_NET_ATTACHED: int +PORT_TYPE_READ: int +PORT_TYPE_REDIRECTED: int +PORT_TYPE_WRITE: int +PRINTER_ACCESS_ADMINISTER: int +PRINTER_ACCESS_USE: int +PRINTER_ALL_ACCESS: int +PRINTER_ATTRIBUTE_DEFAULT: int +PRINTER_ATTRIBUTE_DIRECT: int +PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST: int +PRINTER_ATTRIBUTE_ENABLE_BIDI: int +PRINTER_ATTRIBUTE_ENABLE_DEVQ: int +PRINTER_ATTRIBUTE_FAX: int +PRINTER_ATTRIBUTE_HIDDEN: int +PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS: int +PRINTER_ATTRIBUTE_LOCAL: int +PRINTER_ATTRIBUTE_NETWORK: int +PRINTER_ATTRIBUTE_PUBLISHED: int +PRINTER_ATTRIBUTE_QUEUED: int +PRINTER_ATTRIBUTE_RAW_ONLY: int +PRINTER_ATTRIBUTE_SHARED: int +PRINTER_ATTRIBUTE_TS: int +PRINTER_ATTRIBUTE_WORK_OFFLINE: int +PRINTER_CONTROL_PAUSE: int +PRINTER_CONTROL_PURGE: int +PRINTER_CONTROL_RESUME: int +PRINTER_CONTROL_SET_STATUS: int +PRINTER_ENUM_CONNECTIONS: int +PRINTER_ENUM_CONTAINER: int +PRINTER_ENUM_DEFAULT: int +PRINTER_ENUM_EXPAND: int +PRINTER_ENUM_ICON1: int +PRINTER_ENUM_ICON2: int +PRINTER_ENUM_ICON3: int +PRINTER_ENUM_ICON4: int +PRINTER_ENUM_ICON5: int +PRINTER_ENUM_ICON6: int +PRINTER_ENUM_ICON7: int +PRINTER_ENUM_ICON8: int +PRINTER_ENUM_LOCAL: int +PRINTER_ENUM_NAME: int +PRINTER_ENUM_NETWORK: int +PRINTER_ENUM_REMOTE: int +PRINTER_ENUM_SHARED: int +PRINTER_EXECUTE: int +PRINTER_INFO_1: int +PRINTER_READ: int +PRINTER_STATUS_BUSY: int +PRINTER_STATUS_DOOR_OPEN: int +PRINTER_STATUS_ERROR: int +PRINTER_STATUS_INITIALIZING: int +PRINTER_STATUS_IO_ACTIVE: int +PRINTER_STATUS_MANUAL_FEED: int +PRINTER_STATUS_NOT_AVAILABLE: int +PRINTER_STATUS_NO_TONER: int +PRINTER_STATUS_OFFLINE: int +PRINTER_STATUS_OUTPUT_BIN_FULL: int +PRINTER_STATUS_OUT_OF_MEMORY: int +PRINTER_STATUS_PAGE_PUNT: int +PRINTER_STATUS_PAPER_JAM: int +PRINTER_STATUS_PAPER_OUT: int +PRINTER_STATUS_PAPER_PROBLEM: int +PRINTER_STATUS_PAUSED: int +PRINTER_STATUS_PENDING_DELETION: int +PRINTER_STATUS_POWER_SAVE: int +PRINTER_STATUS_PRINTING: int +PRINTER_STATUS_PROCESSING: int +PRINTER_STATUS_SERVER_UNKNOWN: int +PRINTER_STATUS_TONER_LOW: int +PRINTER_STATUS_USER_INTERVENTION: int +PRINTER_STATUS_WAITING: int +PRINTER_STATUS_WARMING_UP: int +PRINTER_WRITE: int +SERVER_ACCESS_ADMINISTER: int +SERVER_ACCESS_ENUMERATE: int +SERVER_ALL_ACCESS: int +SERVER_EXECUTE: int +SERVER_READ: int +SERVER_WRITE: int diff --git a/stubs/pywin32/win32/win32process.pyi b/stubs/pywin32/win32/win32process.pyi new file mode 100644 index 0000000..3b38c78 --- /dev/null +++ b/stubs/pywin32/win32/win32process.pyi @@ -0,0 +1,122 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def STARTUPINFO() -> _win32typing.PySTARTUPINFO: ... +def beginthreadex(sa: _win32typing.PySECURITY_ATTRIBUTES, stackSize, entryPoint, args, flags) -> tuple[int, Incomplete]: ... +def CreateRemoteThread( + hprocess: int, sa: _win32typing.PySECURITY_ATTRIBUTES, stackSize, entryPoint, Parameter, flags +) -> tuple[int, Incomplete]: ... +def CreateProcess( + appName: str, + commandLine: str, + processAttributes: _win32typing.PySECURITY_ATTRIBUTES, + threadAttributes: _win32typing.PySECURITY_ATTRIBUTES, + bInheritHandles, + dwCreationFlags, + newEnvironment, + currentDirectory: str, + startupinfo: _win32typing.PySTARTUPINFO, +) -> tuple[int, int, Incomplete, Incomplete]: ... +def CreateProcessAsUser( + hToken: int, + appName: str, + commandLine: str, + processAttributes: _win32typing.PySECURITY_ATTRIBUTES, + threadAttributes: _win32typing.PySECURITY_ATTRIBUTES, + bInheritHandles, + dwCreationFlags, + newEnvironment, + currentDirectory: str, + startupinfo: _win32typing.PySTARTUPINFO, +) -> tuple[int, int, Incomplete, Incomplete]: ... +def GetCurrentProcess(): ... +def GetProcessVersion(processId): ... +def GetCurrentProcessId(): ... +def GetStartupInfo() -> _win32typing.PySTARTUPINFO: ... +def GetPriorityClass(handle: int): ... +def GetExitCodeThread(handle: int): ... +def GetExitCodeProcess(handle: int): ... +def GetWindowThreadProcessId(__hwnd: int | None) -> tuple[int, int]: ... +def SetThreadPriority(handle: int, nPriority) -> None: ... +def GetThreadPriority(handle: int): ... +def GetProcessPriorityBoost(Process: int): ... +def SetProcessPriorityBoost(Process: int, DisablePriorityBoost) -> None: ... +def GetThreadPriorityBoost(Thread: int): ... +def SetThreadPriorityBoost(Thread: int, DisablePriorityBoost) -> None: ... +def GetThreadIOPendingFlag(Thread: int): ... +def GetThreadTimes(Thread: int): ... +def GetProcessId(Process: int): ... +def SetPriorityClass(handle: int, dwPriorityClass) -> None: ... +def AttachThreadInput(idAttach, idAttachTo, Attach) -> None: ... +def SetThreadIdealProcessor(handle: int, dwIdealProcessor): ... +def GetProcessAffinityMask(hProcess: int) -> tuple[Incomplete, Incomplete]: ... +def SetProcessAffinityMask(hProcess: int, mask) -> None: ... +def SetThreadAffinityMask(hThread: int, ThreadAffinityMask): ... +def SuspendThread(handle: int): ... +def ResumeThread(handle: int): ... +def TerminateProcess(handle: int, exitCode) -> None: ... +def ExitProcess(exitCode) -> None: ... +def EnumProcesses() -> tuple[Incomplete, Incomplete]: ... +def EnumProcessModules(hProcess: int) -> tuple[Incomplete, Incomplete]: ... +def EnumProcessModulesEx(hProcess: int, FilterFlag) -> tuple[Incomplete, Incomplete]: ... +def GetModuleFileNameEx(hProcess: int, hModule: int): ... +def GetProcessMemoryInfo(hProcess: int): ... +def GetProcessTimes(hProcess: int): ... +def GetProcessIoCounters(hProcess: int): ... +def GetProcessWindowStation() -> None: ... +def GetProcessWorkingSetSize(hProcess: int) -> tuple[Incomplete, Incomplete]: ... +def SetProcessWorkingSetSize(hProcess: int, MinimumWorkingSetSize, MaximumWorkingSetSize) -> None: ... +def GetProcessShutdownParameters() -> tuple[Incomplete, Incomplete]: ... +def SetProcessShutdownParameters(Level, Flags) -> None: ... +def GetGuiResources(Process: int, Flags): ... +def IsWow64Process(__Process: int | None = ...) -> bool: ... +def ReadProcessMemory(*args, **kwargs): ... # incomplete +def VirtualAllocEx(*args, **kwargs): ... # incomplete +def VirtualFreeEx(*args, **kwargs): ... # incomplete +def WriteProcessMemory(*args, **kwargs): ... # incomplete + +ABOVE_NORMAL_PRIORITY_CLASS: int +BELOW_NORMAL_PRIORITY_CLASS: int +CREATE_BREAKAWAY_FROM_JOB: int +CREATE_DEFAULT_ERROR_MODE: int +CREATE_NEW_CONSOLE: int +CREATE_NEW_PROCESS_GROUP: int +CREATE_NO_WINDOW: int +CREATE_PRESERVE_CODE_AUTHZ_LEVEL: int +CREATE_SEPARATE_WOW_VDM: int +CREATE_SHARED_WOW_VDM: int +CREATE_SUSPENDED: int +CREATE_UNICODE_ENVIRONMENT: int +DEBUG_ONLY_THIS_PROCESS: int +DEBUG_PROCESS: int +DETACHED_PROCESS: int +HIGH_PRIORITY_CLASS: int +IDLE_PRIORITY_CLASS: int +MAXIMUM_PROCESSORS: int +NORMAL_PRIORITY_CLASS: int +REALTIME_PRIORITY_CLASS: int +STARTF_FORCEOFFFEEDBACK: int +STARTF_FORCEONFEEDBACK: int +STARTF_RUNFULLSCREEN: int +STARTF_USECOUNTCHARS: int +STARTF_USEFILLATTRIBUTE: int +STARTF_USEPOSITION: int +STARTF_USESHOWWINDOW: int +STARTF_USESIZE: int +STARTF_USESTDHANDLES: int +THREAD_MODE_BACKGROUND_BEGIN: int +THREAD_MODE_BACKGROUND_END: int +THREAD_PRIORITY_ABOVE_NORMAL: int +THREAD_PRIORITY_BELOW_NORMAL: int +THREAD_PRIORITY_HIGHEST: int +THREAD_PRIORITY_IDLE: int +THREAD_PRIORITY_LOWEST: int +THREAD_PRIORITY_NORMAL: int +THREAD_PRIORITY_TIME_CRITICAL: int +LIST_MODULES_32BIT: int +LIST_MODULES_64BIT: int +LIST_MODULES_ALL: int +LIST_MODULES_DEFAULT: int +UNICODE: int diff --git a/stubs/pywin32/win32/win32profile.pyi b/stubs/pywin32/win32/win32profile.pyi new file mode 100644 index 0000000..155a77c --- /dev/null +++ b/stubs/pywin32/win32/win32profile.pyi @@ -0,0 +1,19 @@ +import _win32typing + +def CreateEnvironmentBlock(Token: int, Inherit): ... +def DeleteProfile(SidString: str, ProfilePath: str | None = ..., ComputerName: str | None = ...) -> None: ... +def ExpandEnvironmentStringsForUser(Token: int, Src: str) -> str: ... +def GetAllUsersProfileDirectory() -> str: ... +def GetDefaultUserProfileDirectory() -> str: ... +def GetEnvironmentStrings(): ... +def GetProfilesDirectory() -> str: ... +def GetProfileType(): ... +def GetUserProfileDirectory(Token: int) -> str: ... +def LoadUserProfile(hToken: int, ProfileInfo: _win32typing.PyPROFILEINFO) -> _win32typing.PyHKEY: ... +def UnloadUserProfile(Token: int, Profile: _win32typing.PyHKEY) -> None: ... + +PI_APPLYPOLICY: int +PI_NOUI: int +PT_MANDATORY: int +PT_ROAMING: int +PT_TEMPORARY: int diff --git a/stubs/pywin32/win32/win32ras.pyi b/stubs/pywin32/win32/win32ras.pyi new file mode 100644 index 0000000..57be9a1 --- /dev/null +++ b/stubs/pywin32/win32/win32ras.pyi @@ -0,0 +1,54 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def CreatePhonebookEntry(hWnd: int, fileName: str | None = ...) -> None: ... +def Dial(dialExtensions, fileName: str, RasDialParams: _win32typing.RASDIALPARAMS, callback) -> tuple[Incomplete, Incomplete]: ... +def EditPhonebookEntry(hWnd: int, fileName: str, entryName: str | None = ...) -> None: ... +def EnumConnections(): ... +def EnumEntries(reserved: str | None = ..., fileName: str | None = ...) -> None: ... +def GetConnectStatus(hrasconn) -> tuple[Incomplete, Incomplete, str, str]: ... +def GetEntryDialParams( + fileName: str, entryName: str +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... +def GetErrorString(error) -> str: ... # noqa: F811 +def HangUp(hras) -> None: ... +def IsHandleValid(__hras: int | None) -> bool: ... +def SetEntryDialParams(fileName: str, RasDialParams, bSavePassword) -> None: ... +def RASDIALEXTENSIONS(*args, **kwargs): ... # incomplete + +RASCS_AllDevicesConnected: int +RASCS_AuthAck: int +RASCS_AuthCallback: int +RASCS_AuthChangePassword: int +RASCS_Authenticate: int +RASCS_Authenticated: int +RASCS_AuthLinkSpeed: int +RASCS_AuthNotify: int +RASCS_AuthProject: int +RASCS_AuthRetry: int +RASCS_CallbackComplete: int +RASCS_CallbackSetByCaller: int +RASCS_ConnectDevice: int +RASCS_Connected: int +RASCS_DeviceConnected: int +RASCS_Disconnected: int +RASCS_Interactive: int +RASCS_LogonNetwork: int +RASCS_OpenPort: int +RASCS_PasswordExpired: int +RASCS_PortOpened: int +RASCS_PrepareForCallback: int +RASCS_Projected: int +RASCS_ReAuthenticate: int +RASCS_RetryAuthentication: int +RASCS_StartAuthentication: int +RASCS_WaitForCallback: int +RASCS_WaitForModemReset: int + +def GetEapUserIdentity(*args, **kwargs): ... # incomplete + +RASEAPF_Logon: int +RASEAPF_NonInteractive: int +RASEAPF_Preview: int diff --git a/stubs/pywin32/win32/win32security.pyi b/stubs/pywin32/win32/win32security.pyi new file mode 100644 index 0000000..b391d28 --- /dev/null +++ b/stubs/pywin32/win32/win32security.pyi @@ -0,0 +1,569 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def DsGetSpn( + ServiceType, + ServiceClass: str, + ServiceName: str, + InstancePort: int = ..., + InstanceNames: tuple[str, ...] | None = ..., + InstancePorts: tuple[Incomplete, ...] | None = ..., +) -> tuple[str, ...]: ... +def DsWriteAccountSpn(hDS: _win32typing.PyDS_HANDLE, Operation, Account: str, Spns: tuple[str, ...]) -> None: ... +def DsBind(DomainController: str, DnsDomainName: str) -> _win32typing.PyDS_HANDLE: ... +def DsUnBind(hDS: _win32typing.PyDS_HANDLE) -> None: ... +def DsGetDcName( + computerName: str | None = ..., + domainName: str | None = ..., + domainGUID: _win32typing.PyIID | None = ..., + siteName: str | None = ..., + flags: int = ..., +): ... +def DsCrackNames( + hds: _win32typing.PyDS_HANDLE, flags, formatOffered, formatDesired, names: list[Incomplete] +) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def ACL(bufSize: int = ...) -> _win32typing.PyACL: ... +def SID() -> _win32typing.PySID: ... +def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ... +def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... +def ImpersonateNamedPipeClient(handle) -> None: ... +def ImpersonateLoggedOnUser(handle: int) -> None: ... +def ImpersonateAnonymousToken(ThreadHandle: int) -> None: ... +def IsTokenRestricted(__TokenHandle: int | None) -> bool: ... +def RevertToSelf() -> None: ... +def LogonUser(Username: str, Domain: str, Password: str, LogonType, LogonProvider) -> int: ... +def LogonUserEx( + Username: str, Domain: str, Password: str, LogonType, LogonProvider +) -> tuple[int, _win32typing.PySID, Incomplete, Incomplete]: ... +def LookupAccountName(systemName: str, accountName: str) -> tuple[_win32typing.PySID, str, Incomplete]: ... +def LookupAccountSid(systemName: str, sid: _win32typing.PySID) -> tuple[str, str, Incomplete]: ... +def GetBinarySid(SID: str) -> _win32typing.PySID: ... +def SetSecurityInfo( + handle: int, + ObjectType, + SecurityInfo, + Owner: _win32typing.PySID, + Group: _win32typing.PySID, + Dacl: _win32typing.PyACL, + Sacl: _win32typing.PyACL, +) -> None: ... +def GetSecurityInfo(handle: int, ObjectType, SecurityInfo) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def SetNamedSecurityInfo( + ObjectName, + ObjectType, + SecurityInfo, + Owner: _win32typing.PySID, + Group: _win32typing.PySID, + Dacl: _win32typing.PyACL, + Sacl: _win32typing.PyACL, +) -> None: ... +def GetNamedSecurityInfo(ObjectName, ObjectType, SecurityInfo) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def OpenProcessToken(processHandle, desiredAccess) -> int: ... +def LookupPrivilegeValue(systemName: str, privilegeName: str) -> _win32typing.LARGE_INTEGER: ... +def LookupPrivilegeName(SystemName: str, luid: _win32typing.LARGE_INTEGER) -> str: ... +def LookupPrivilegeDisplayName(SystemName: str, Name: str) -> str: ... +def AdjustTokenPrivileges( + TokenHandle: int, bDisableAllPrivileges, NewState: _win32typing.PyTOKEN_PRIVILEGES +) -> _win32typing.PyTOKEN_PRIVILEGES: ... +def AdjustTokenGroups(TokenHandle: int, ResetToDefault, NewState: _win32typing.PyTOKEN_GROUPS) -> _win32typing.PyTOKEN_GROUPS: ... +def GetTokenInformation(TokenHandle: int, TokenInformationClass): ... +def OpenThreadToken(handle: int, desiredAccess, openAsSelf): ... +def SetThreadToken(Thread: int, Token: int) -> None: ... +def GetFileSecurity(filename: str, info) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def SetFileSecurity(filename: str, info, security: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... +def GetUserObjectSecurity(handle: int, info) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def SetUserObjectSecurity(handle: int, info, security: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... +def GetKernelObjectSecurity(handle: int, info) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def SetKernelObjectSecurity(handle: int, info, security: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... +def SetTokenInformation(TokenHandle: int, TokenInformationClass, TokenInformation) -> None: ... +def LsaOpenPolicy(system_name: str, access_mask) -> _win32typing.PyLSA_HANDLE: ... +def LsaClose(PolicyHandle: int) -> None: ... +def LsaQueryInformationPolicy(PolicyHandle: _win32typing.PyLSA_HANDLE, InformationClass) -> None: ... +def LsaSetInformationPolicy(PolicyHandle: _win32typing.PyLSA_HANDLE, InformationClass, Information) -> None: ... +def LsaAddAccountRights( + PolicyHandle: _win32typing.PyLSA_HANDLE, AccountSid: _win32typing.PySID, UserRights: tuple[Incomplete, ...] +) -> None: ... +def LsaRemoveAccountRights( + PolicyHandle: _win32typing.PyLSA_HANDLE, AccountSid: _win32typing.PySID, AllRights, UserRights: tuple[Incomplete, ...] +) -> None: ... +def LsaEnumerateAccountRights(PolicyHandle: _win32typing.PyLSA_HANDLE, AccountSid: _win32typing.PySID) -> list[str]: ... +def LsaEnumerateAccountsWithUserRight(PolicyHandle: _win32typing.PyLSA_HANDLE, UserRight) -> tuple[_win32typing.PySID, ...]: ... +def ConvertSidToStringSid(Sid: _win32typing.PySID) -> str: ... +def ConvertStringSidToSid(StringSid: str) -> _win32typing.PySID: ... +def ConvertSecurityDescriptorToStringSecurityDescriptor( + SecurityDescriptor: _win32typing.PySECURITY_DESCRIPTOR, RequestedStringSDRevision, SecurityInformation +) -> str: ... +def ConvertStringSecurityDescriptorToSecurityDescriptor( + StringSecurityDescriptor: str, StringSDRevision +) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def LsaStorePrivateData(PolicyHandle: _win32typing.PyLSA_HANDLE, KeyName: str, PrivateData) -> None: ... +def LsaRetrievePrivateData(PolicyHandle: _win32typing.PyLSA_HANDLE, KeyName: str) -> str: ... +def LsaRegisterPolicyChangeNotification(InformationClass, NotificationEventHandle: int) -> None: ... +def LsaUnregisterPolicyChangeNotification(InformationClass, NotificationEventHandle: int) -> None: ... +def CryptEnumProviders() -> list[tuple[str, Incomplete]]: ... +def EnumerateSecurityPackages() -> tuple[Incomplete, ...]: ... +def AllocateLocallyUniqueId() -> None: ... +def ImpersonateSelf(ImpersonationLevel) -> None: ... +def DuplicateToken(ExistingTokenHandle: int, ImpersonationLevel) -> int: ... +def DuplicateTokenEx( + ExistingToken: int, + ImpersonationLevel, + DesiredAccess, + TokenType, + TokenAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., +) -> int: ... +def CheckTokenMembership(TokenHandle: int, SidToCheck: _win32typing.PySID): ... +def CreateRestrictedToken( + ExistingTokenHandle: int, + Flags, + SidsToDisable: tuple[_win32typing.PySID_AND_ATTRIBUTES, ...], + PrivilegesToDelete: tuple[_win32typing.PyLUID_AND_ATTRIBUTES, ...], + SidsToRestrict: tuple[_win32typing.PySID_AND_ATTRIBUTES, ...], +) -> int: ... +def LsaRegisterLogonProcess(LogonProcessName: str) -> _win32typing.PyLsaLogon_HANDLE: ... +def LsaConnectUntrusted() -> _win32typing.PyLsaLogon_HANDLE: ... +def LsaDeregisterLogonProcess(LsaHandle: _win32typing.PyLsaLogon_HANDLE) -> None: ... +def LsaLookupAuthenticationPackage(LsaHandle: _win32typing.PyLsaLogon_HANDLE, PackageName: str): ... +def LsaEnumerateLogonSessions() -> tuple[Incomplete, ...]: ... +def LsaGetLogonSessionData(LogonId) -> tuple[Incomplete, ...]: ... +def AcquireCredentialsHandle( + Principal, Package, CredentialUse, LogonID, AuthData +) -> tuple[_win32typing.PyCredHandle, _win32typing.PyTime]: ... +def InitializeSecurityContext( + Credential: _win32typing.PyCredHandle, + Context: _win32typing.PyCtxtHandle, + TargetName, + ContextReq, + TargetDataRep, + pInput: _win32typing.PySecBufferDesc, + NewContext: _win32typing.PyCtxtHandle, + pOutput: _win32typing.PySecBufferDesc, +) -> tuple[Incomplete, Incomplete, _win32typing.PyTime]: ... +def AcceptSecurityContext( + Credential: _win32typing.PyCredHandle, + Context: _win32typing.PyCtxtHandle, + pInput: _win32typing.PySecBufferDesc, + ContextReq, + TargetDataRep, + NewContext: _win32typing.PyCtxtHandle, + pOutput: _win32typing.PySecBufferDesc, +) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def QuerySecurityPackageInfo(PackageName): ... +def LsaCallAuthenticationPackage( + LsaHandle: _win32typing.PyLsaLogon_HANDLE, AuthenticationPackage, MessageType, ProtocolSubmitBuffer +) -> None: ... +def TranslateName(accountName: str, accountNameFormat, accountNameFormat1, numChars=...) -> str: ... +def CreateWellKnownSid(WellKnownSidType, DomainSid: _win32typing.PySID | None = ...) -> _win32typing.PySID: ... +def MapGenericMask(AccessMask, GenericMapping: tuple[Incomplete, Incomplete, Incomplete, Incomplete]): ... + +ACCESS_ALLOWED_ACE_TYPE: int +ACCESS_ALLOWED_OBJECT_ACE_TYPE: int +ACCESS_DENIED_ACE_TYPE: int +ACCESS_DENIED_OBJECT_ACE_TYPE: int +ACL_REVISION: int +ACL_REVISION_DS: int +AuditCategoryAccountLogon: int +AuditCategoryAccountManagement: int +AuditCategoryDetailedTracking: int +AuditCategoryDirectoryServiceAccess: int +AuditCategoryLogon: int +AuditCategoryObjectAccess: int +AuditCategoryPolicyChange: int +AuditCategoryPrivilegeUse: int +AuditCategorySystem: int +CONTAINER_INHERIT_ACE: int +DACL_SECURITY_INFORMATION: int +DENY_ACCESS: int +DISABLE_MAX_PRIVILEGE: int +DS_SPN_ADD_SPN_OP: int +DS_SPN_DELETE_SPN_OP: int +DS_SPN_DN_HOST: int +DS_SPN_DNS_HOST: int +DS_SPN_DOMAIN: int +DS_SPN_NB_DOMAIN: int +DS_SPN_NB_HOST: int +DS_SPN_REPLACE_SPN_OP: int +DS_SPN_SERVICE: int +FAILED_ACCESS_ACE_FLAG: int +GRANT_ACCESS: int +GROUP_SECURITY_INFORMATION: int +INHERIT_ONLY_ACE: int +INHERITED_ACE: int +LABEL_SECURITY_INFORMATION: int +LOGON32_LOGON_BATCH: int +LOGON32_LOGON_INTERACTIVE: int +LOGON32_LOGON_NETWORK: int +LOGON32_LOGON_NETWORK_CLEARTEXT: int +LOGON32_LOGON_NEW_CREDENTIALS: int +LOGON32_LOGON_SERVICE: int +LOGON32_LOGON_UNLOCK: int +LOGON32_PROVIDER_DEFAULT: int +LOGON32_PROVIDER_WINNT35: int +LOGON32_PROVIDER_WINNT40: int +LOGON32_PROVIDER_WINNT50: int +NO_INHERITANCE: int +NO_PROPAGATE_INHERIT_ACE: int +NOT_USED_ACCESS: int +OBJECT_INHERIT_ACE: int +OWNER_SECURITY_INFORMATION: int +POLICY_ALL_ACCESS: int +POLICY_AUDIT_EVENT_FAILURE: int +POLICY_AUDIT_EVENT_NONE: int +POLICY_AUDIT_EVENT_SUCCESS: int +POLICY_AUDIT_EVENT_UNCHANGED: int +POLICY_AUDIT_LOG_ADMIN: int +POLICY_CREATE_ACCOUNT: int +POLICY_CREATE_PRIVILEGE: int +POLICY_CREATE_SECRET: int +POLICY_EXECUTE: int +POLICY_GET_PRIVATE_INFORMATION: int +POLICY_LOOKUP_NAMES: int +POLICY_NOTIFICATION: int +POLICY_READ: int +POLICY_SERVER_ADMIN: int +POLICY_SET_AUDIT_REQUIREMENTS: int +POLICY_SET_DEFAULT_QUOTA_LIMITS: int +POLICY_TRUST_ADMIN: int +POLICY_VIEW_AUDIT_INFORMATION: int +POLICY_VIEW_LOCAL_INFORMATION: int +POLICY_WRITE: int +PolicyAccountDomainInformation: int +PolicyAuditEventsInformation: int +PolicyAuditFullQueryInformation: int +PolicyAuditFullSetInformation: int +PolicyAuditLogInformation: int +PolicyDefaultQuotaInformation: int +PolicyDnsDomainInformation: int +PolicyLsaServerRoleInformation: int +PolicyModificationInformation: int +PolicyNotifyAccountDomainInformation: int +PolicyNotifyAuditEventsInformation: int +PolicyNotifyDnsDomainInformation: int +PolicyNotifyDomainEfsInformation: int +PolicyNotifyDomainKerberosTicketInformation: int +PolicyNotifyMachineAccountPasswordInformation: int +PolicyNotifyServerRoleInformation: int +PolicyPdAccountInformation: int +PolicyPrimaryDomainInformation: int +PolicyReplicaSourceInformation: int +PolicyServerDisabled: int +PolicyServerEnabled: int +PolicyServerRoleBackup: int +PolicyServerRolePrimary: int +PROTECTED_DACL_SECURITY_INFORMATION: int +PROTECTED_SACL_SECURITY_INFORMATION: int +REVOKE_ACCESS: int +SACL_SECURITY_INFORMATION: int +SANDBOX_INERT: int +SDDL_REVISION_1: int +SE_DACL_AUTO_INHERITED: int +SE_DACL_DEFAULTED: int +SE_DACL_PRESENT: int +SE_DACL_PROTECTED: int +SE_DS_OBJECT: int +SE_DS_OBJECT_ALL: int +SE_FILE_OBJECT: int +SE_GROUP_DEFAULTED: int +SE_GROUP_ENABLED: int +SE_GROUP_ENABLED_BY_DEFAULT: int +SE_GROUP_LOGON_ID: int +SE_GROUP_MANDATORY: int +SE_GROUP_OWNER: int +SE_GROUP_RESOURCE: int +SE_GROUP_USE_FOR_DENY_ONLY: int +SE_KERNEL_OBJECT: int +SE_LMSHARE: int +SE_OWNER_DEFAULTED: int +SE_PRINTER: int +SE_PRIVILEGE_ENABLED: int +SE_PRIVILEGE_ENABLED_BY_DEFAULT: int +SE_PRIVILEGE_REMOVED: int +SE_PRIVILEGE_USED_FOR_ACCESS: int +SE_PROVIDER_DEFINED_OBJECT: int +SE_REGISTRY_KEY: int +SE_REGISTRY_WOW64_32KEY: int +SE_SACL_AUTO_INHERITED: int +SE_SACL_DEFAULTED: int +SE_SACL_PRESENT: int +SE_SACL_PROTECTED: int +SE_SELF_RELATIVE: int +SE_SERVICE: int +SE_UNKNOWN_OBJECT_TYPE: int +SE_WINDOW_OBJECT: int +SE_WMIGUID_OBJECT: int +SECPKG_CRED_BOTH: int +SECPKG_CRED_INBOUND: int +SECPKG_CRED_OUTBOUND: int +SECPKG_FLAG_ACCEPT_WIN32_NAME: int +SECPKG_FLAG_CLIENT_ONLY: int +SECPKG_FLAG_CONNECTION: int +SECPKG_FLAG_DATAGRAM: int +SECPKG_FLAG_EXTENDED_ERROR: int +SECPKG_FLAG_IMPERSONATION: int +SECPKG_FLAG_INTEGRITY: int +SECPKG_FLAG_MULTI_REQUIRED: int +SECPKG_FLAG_PRIVACY: int +SECPKG_FLAG_STREAM: int +SECPKG_FLAG_TOKEN_ONLY: int +SECURITY_CREATOR_SID_AUTHORITY: int +SECURITY_LOCAL_SID_AUTHORITY: int +SECURITY_NON_UNIQUE_AUTHORITY: int +SECURITY_NT_AUTHORITY: int +SECURITY_NULL_SID_AUTHORITY: int +SECURITY_RESOURCE_MANAGER_AUTHORITY: int +SECURITY_WORLD_SID_AUTHORITY: int +SecurityAnonymous: int +SecurityDelegation: int +SecurityIdentification: int +SecurityImpersonation: int +SET_ACCESS: int +SET_AUDIT_FAILURE: int +SET_AUDIT_SUCCESS: int +SidTypeAlias: int +SidTypeComputer: int +SidTypeDeletedAccount: int +SidTypeDomain: int +SidTypeGroup: int +SidTypeInvalid: int +SidTypeUnknown: int +SidTypeUser: int +SidTypeWellKnownGroup: int +STYPE_DEVICE: int +STYPE_DISKTREE: int +STYPE_IPC: int +STYPE_PRINTQ: int +STYPE_SPECIAL: int +STYPE_TEMPORARY: int +SUB_CONTAINERS_AND_OBJECTS_INHERIT: int +SUB_CONTAINERS_ONLY_INHERIT: int +SUB_OBJECTS_ONLY_INHERIT: int +SUCCESSFUL_ACCESS_ACE_FLAG: int +SYSTEM_AUDIT_ACE_TYPE: int +SYSTEM_AUDIT_OBJECT_ACE_TYPE: int +TOKEN_ADJUST_DEFAULT: int +TOKEN_ADJUST_GROUPS: int +TOKEN_ADJUST_PRIVILEGES: int +TOKEN_ALL_ACCESS: int +TOKEN_ASSIGN_PRIMARY: int +TOKEN_DUPLICATE: int +TOKEN_EXECUTE: int +TOKEN_IMPERSONATE: int +TOKEN_QUERY: int +TOKEN_QUERY_SOURCE: int +TOKEN_READ: int +TOKEN_WRITE: int +TokenImpersonation: int +TokenPrimary: int +TrustedControllersInformation: int +TrustedDomainAuthInformation: int +TrustedDomainAuthInformationInternal: int +TrustedDomainFullInformation: int +TrustedDomainFullInformation2Internal: int +TrustedDomainFullInformationInternal: int +TrustedDomainInformationBasic: int +TrustedDomainInformationEx: int +TrustedDomainInformationEx2Internal: int +TrustedDomainNameInformation: int +TrustedPasswordInformation: int +TrustedPosixOffsetInformation: int +TRUSTEE_BAD_FORM: int +TRUSTEE_IS_ALIAS: int +TRUSTEE_IS_COMPUTER: int +TRUSTEE_IS_DELETED: int +TRUSTEE_IS_DOMAIN: int +TRUSTEE_IS_GROUP: int +TRUSTEE_IS_INVALID: int +TRUSTEE_IS_NAME: int +TRUSTEE_IS_OBJECTS_AND_NAME: int +TRUSTEE_IS_OBJECTS_AND_SID: int +TRUSTEE_IS_SID: int +TRUSTEE_IS_UNKNOWN: int +TRUSTEE_IS_USER: int +TRUSTEE_IS_WELL_KNOWN_GROUP: int +UNPROTECTED_DACL_SECURITY_INFORMATION: int +UNPROTECTED_SACL_SECURITY_INFORMATION: int +CredHandleType = _win32typing.PyCredHandle +CtxtHandleType = _win32typing.PyCtxtHandle + +def DsListDomainsInSite(*args, **kwargs): ... # incomplete +def DsListInfoForServer(*args, **kwargs): ... # incomplete +def DsListRoles(*args, **kwargs): ... # incomplete +def DsListServersForDomainInSite(*args, **kwargs): ... # incomplete +def DsListServersInSite(*args, **kwargs): ... # incomplete +def DsListSites(*args, **kwargs): ... # incomplete +def GetPolicyHandle(*args, **kwargs): ... # incomplete + +MICROSOFT_KERBEROS_NAME_A: bytes +MSV1_0_PACKAGE_NAME: bytes +PyCredHandleType = _win32typing.PyCredHandle +PyCtxtHandleType = _win32typing.PyCtxtHandle +PySecBufferDescType = _win32typing.PySecBufferDesc +PySecBufferType = _win32typing.PySecBuffer +SE_ASSIGNPRIMARYTOKEN_NAME: str +SE_AUDIT_NAME: str +SE_BACKUP_NAME: str +SE_BATCH_LOGON_NAME: str +SE_CHANGE_NOTIFY_NAME: str +SE_CREATE_GLOBAL_NAME: str +SE_CREATE_PAGEFILE_NAME: str +SE_CREATE_PERMANENT_NAME: str +SE_CREATE_SYMBOLIC_LINK_NAME: str +SE_CREATE_TOKEN_NAME: str +SE_DEBUG_NAME: str +SE_DENY_BATCH_LOGON_NAME: str +SE_DENY_INTERACTIVE_LOGON_NAME: str +SE_DENY_NETWORK_LOGON_NAME: str +SE_DENY_REMOTE_INTERACTIVE_LOGON_NAME: str +SE_DENY_SERVICE_LOGON_NAME: str +SE_ENABLE_DELEGATION_NAME: str +SE_GROUP_INTEGRITY: int +SE_GROUP_INTEGRITY_ENABLED: int +SE_IMPERSONATE_NAME: str +SE_INCREASE_QUOTA_NAME: str +SE_INC_BASE_PRIORITY_NAME: str +SE_INC_WORKING_SET_NAME: str +SE_INTERACTIVE_LOGON_NAME: str +SE_LOAD_DRIVER_NAME: str +SE_LOCK_MEMORY_NAME: str +SE_MACHINE_ACCOUNT_NAME: str +SE_MANAGE_VOLUME_NAME: str +SE_NETWORK_LOGON_NAME: str +SE_PROF_SINGLE_PROCESS_NAME: str +SE_RELABEL_NAME: str +SE_REMOTE_INTERACTIVE_LOGON_NAME: str +SE_REMOTE_SHUTDOWN_NAME: str +SE_RESTORE_NAME: str +SE_SECURITY_NAME: str +SE_SERVICE_LOGON_NAME: str +SE_SHUTDOWN_NAME: str +SE_SYNC_AGENT_NAME: str +SE_SYSTEMTIME_NAME: str +SE_SYSTEM_ENVIRONMENT_NAME: str +SE_SYSTEM_PROFILE_NAME: str +SE_TAKE_OWNERSHIP_NAME: str +SE_TCB_NAME: str +SE_TIME_ZONE_NAME: str +SE_TRUSTED_CREDMAN_ACCESS_NAME: str +SE_UNDOCK_NAME: str +SE_UNSOLICITED_INPUT_NAME: str +SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP: int +SYSTEM_MANDATORY_LABEL_NO_READ_UP: int +SYSTEM_MANDATORY_LABEL_NO_WRITE_UP: int +SYSTEM_MANDATORY_LABEL_VALID_MASK: int +SecBufferDescType = _win32typing.PySecBufferDesc +SecBufferType = _win32typing.PySecBuffer +TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN: int +TOKEN_MANDATORY_POLICY_NO_WRITE_UP: int +TOKEN_MANDATORY_POLICY_OFF: int +TOKEN_MANDATORY_POLICY_VALID_MASK: int +TokenAccessInformation: int +TokenAuditPolicy: int +TokenDefaultDacl: int +TokenElevation: int +TokenElevationType: int +TokenElevationTypeDefault: int +TokenElevationTypeFull: int +TokenElevationTypeLimited: int +TokenGroups: int +TokenGroupsAndPrivileges: int +TokenHasRestrictions: int +TokenImpersonationLevel: int +TokenIntegrityLevel: int +TokenLinkedToken: int +TokenLogonSid: int +TokenMandatoryPolicy: int +TokenOrigin: int +TokenOwner: int +TokenPrimaryGroup: int +TokenPrivileges: int +TokenRestrictedSids: int +TokenSandBoxInert: int +TokenSessionId: int +TokenSessionReference: int +TokenSource: int +TokenStatistics: int +TokenType: int +TokenUIAccess: int +TokenUser: int +TokenVirtualizationAllowed: int +TokenVirtualizationEnabled: int +UNICODE: int +WinAccountAdministratorSid: int +WinAccountCertAdminsSid: int +WinAccountComputersSid: int +WinAccountControllersSid: int +WinAccountDomainAdminsSid: int +WinAccountDomainGuestsSid: int +WinAccountDomainUsersSid: int +WinAccountEnterpriseAdminsSid: int +WinAccountGuestSid: int +WinAccountKrbtgtSid: int +WinAccountPolicyAdminsSid: int +WinAccountRasAndIasServersSid: int +WinAccountReadonlyControllersSid: int +WinAccountSchemaAdminsSid: int +WinAnonymousSid: int +WinAuthenticatedUserSid: int +WinBatchSid: int +WinBuiltinAccountOperatorsSid: int +WinBuiltinAdministratorsSid: int +WinBuiltinAuthorizationAccessSid: int +WinBuiltinBackupOperatorsSid: int +WinBuiltinCryptoOperatorsSid: int +WinBuiltinDCOMUsersSid: int +WinBuiltinDomainSid: int +WinBuiltinEventLogReadersGroup: int +WinBuiltinGuestsSid: int +WinBuiltinIUsersSid: int +WinBuiltinIncomingForestTrustBuildersSid: int +WinBuiltinNetworkConfigurationOperatorsSid: int +WinBuiltinPerfLoggingUsersSid: int +WinBuiltinPerfMonitoringUsersSid: int +WinBuiltinPowerUsersSid: int +WinBuiltinPreWindows2000CompatibleAccessSid: int +WinBuiltinPrintOperatorsSid: int +WinBuiltinRemoteDesktopUsersSid: int +WinBuiltinReplicatorSid: int +WinBuiltinSystemOperatorsSid: int +WinBuiltinTerminalServerLicenseServersSid: int +WinBuiltinUsersSid: int +WinCacheablePrincipalsGroupSid: int +WinCreatorGroupServerSid: int +WinCreatorGroupSid: int +WinCreatorOwnerRightsSid: int +WinCreatorOwnerServerSid: int +WinCreatorOwnerSid: int +WinDialupSid: int +WinDigestAuthenticationSid: int +WinEnterpriseControllersSid: int +WinEnterpriseReadonlyControllersSid: int +WinHighLabelSid: int +WinIUserSid: int +WinInteractiveSid: int +WinLocalServiceSid: int +WinLocalSid: int +WinLocalSystemSid: int +WinLogonIdsSid: int +WinLowLabelSid: int +WinMediumLabelSid: int +WinNTLMAuthenticationSid: int +WinNetworkServiceSid: int +WinNetworkSid: int +WinNonCacheablePrincipalsGroupSid: int +WinNtAuthoritySid: int +WinNullSid: int +WinOtherOrganizationSid: int +WinProxySid: int +WinRemoteLogonIdSid: int +WinRestrictedCodeSid: int +WinSChannelAuthenticationSid: int +WinSelfSid: int +WinServiceSid: int +WinSystemLabelSid: int +WinTerminalServerSid: int +WinThisOrganizationSid: int +WinUntrustedLabelSid: int +WinWorldSid: int +WinWriteRestrictedCodeSid: int diff --git a/stubs/pywin32/win32/win32service.pyi b/stubs/pywin32/win32/win32service.pyi new file mode 100644 index 0000000..1f95aa9 --- /dev/null +++ b/stubs/pywin32/win32/win32service.pyi @@ -0,0 +1,178 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def GetThreadDesktop(ThreadId) -> _win32typing.PyHDESK: ... +def EnumWindowStations() -> tuple[tuple[str, Incomplete], ...]: ... +def GetUserObjectInformation(Handle: int, _type) -> None: ... +def SetUserObjectInformation(Handle: int, info, _type) -> None: ... +def OpenWindowStation(szWinSta, Inherit, DesiredAccess) -> _win32typing.PyHWINSTA: ... +def OpenDesktop(szDesktop, Flags, Inherit, DesiredAccess) -> _win32typing.PyHDESK: ... +def CreateDesktop( + Desktop, Flags, DesiredAccess, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES +) -> _win32typing.PyHDESK: ... +def OpenInputDesktop(Flags, Inherit, DesiredAccess) -> _win32typing.PyHDESK: ... +def GetProcessWindowStation() -> _win32typing.PyHWINSTA: ... +def CreateWindowStation( + WindowStation, Flags, DesiredAccess, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES +) -> _win32typing.PyHWINSTA: ... +def EnumServicesStatus(hSCManager: _win32typing.PySC_HANDLE, ServiceType, ServiceState) -> tuple[Incomplete, ...]: ... +def EnumServicesStatusEx( + SCManager: _win32typing.PySC_HANDLE, ServiceType, ServiceState, InfoLevel, GroupName: Incomplete | None = ... +) -> tuple[Incomplete, ...]: ... +def EnumDependentServices(hService: _win32typing.PySC_HANDLE, ServiceState) -> tuple[Incomplete, ...]: ... +def QueryServiceConfig(hService: _win32typing.PySC_HANDLE): ... +def StartService(hService: _win32typing.PySC_HANDLE, args: list[str]) -> None: ... +def OpenService(scHandle: _win32typing.PySC_HANDLE, name: str, desiredAccess) -> _win32typing.PySC_HANDLE: ... +def OpenSCManager(machineName: str, dbName: str, desiredAccess) -> _win32typing.PySC_HANDLE: ... +def CloseServiceHandle(scHandle: _win32typing.PySC_HANDLE) -> None: ... +def QueryServiceStatus(hService: _win32typing.PySC_HANDLE) -> _win32typing.SERVICE_STATUS: ... +def QueryServiceStatusEx(hService: _win32typing.PySC_HANDLE) -> _win32typing.SERVICE_STATUS: ... +def SetServiceObjectSecurity( + Handle: _win32typing.PySC_HANDLE, SecurityInformation, SecurityDescriptor: _win32typing.PySECURITY_DESCRIPTOR +) -> None: ... +def QueryServiceObjectSecurity(Handle: _win32typing.PySC_HANDLE, SecurityInformation) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def GetServiceKeyName(hSCManager: _win32typing.PySC_HANDLE, DisplayName): ... +def GetServiceDisplayName(hSCManager: _win32typing.PySC_HANDLE, ServiceName): ... +def SetServiceStatus(scHandle, serviceStatus: _win32typing.SERVICE_STATUS) -> None: ... +def ControlService(scHandle: _win32typing.PySC_HANDLE, code) -> _win32typing.SERVICE_STATUS: ... +def DeleteService(scHandle: _win32typing.PySC_HANDLE) -> None: ... +def CreateService( + scHandle: _win32typing.PySC_HANDLE, + name: str, + displayName: str, + desiredAccess, + serviceType, + startType, + errorControl, + binaryFile: str, + loadOrderGroup: str, + bFetchTag, + serviceDeps: list[Incomplete], + acctName: str, + password: str, +) -> tuple[_win32typing.PySC_HANDLE]: ... +def ChangeServiceConfig( + hService: _win32typing.PySC_HANDLE, + serviceType, + startType, + errorControl, + binaryFile: str, + loadOrderGroup: str, + bFetchTag, + serviceDeps: list[Incomplete], + acctName: str, + password: str, + displayName: str, +): ... +def LockServiceDatabase(sc_handle: _win32typing.PySC_HANDLE): ... +def UnlockServiceDatabase(lock): ... +def QueryServiceLockStatus(hSCManager: _win32typing.PySC_HANDLE) -> tuple[Incomplete, str, Incomplete]: ... +def ChangeServiceConfig2(hService: _win32typing.PySC_HANDLE, InfoLevel, info) -> None: ... +def QueryServiceConfig2(hService: _win32typing.PySC_HANDLE, InfoLevel): ... + +DBT_CONFIGCHANGECANCELED: int +DBT_CONFIGCHANGED: int +DBT_CUSTOMEVENT: int +DBT_DEVICEARRIVAL: int +DBT_DEVICEQUERYREMOVE: int +DBT_DEVICEQUERYREMOVEFAILED: int +DBT_DEVICEREMOVECOMPLETE: int +DBT_DEVICEREMOVEPENDING: int +DBT_DEVICETYPESPECIFIC: int +DBT_QUERYCHANGECONFIG: int +DF_ALLOWOTHERACCOUNTHOOK: int +SC_ACTION_NONE: int +SC_ACTION_REBOOT: int +SC_ACTION_RESTART: int +SC_ACTION_RUN_COMMAND: int +SC_ENUM_PROCESS_INFO: int +SC_GROUP_IDENTIFIER: int +SC_MANAGER_ALL_ACCESS: int +SC_MANAGER_CONNECT: int +SC_MANAGER_CREATE_SERVICE: int +SC_MANAGER_ENUMERATE_SERVICE: int +SC_MANAGER_LOCK: int +SC_MANAGER_MODIFY_BOOT_CONFIG: int +SC_MANAGER_QUERY_LOCK_STATUS: int +SERVICE_ACCEPT_HARDWAREPROFILECHANGE: int +SERVICE_ACCEPT_NETBINDCHANGE: int +SERVICE_ACCEPT_PARAMCHANGE: int +SERVICE_ACCEPT_PAUSE_CONTINUE: int +SERVICE_ACCEPT_POWEREVENT: int +SERVICE_ACCEPT_PRESHUTDOWN: int +SERVICE_ACCEPT_SESSIONCHANGE: int +SERVICE_ACCEPT_SHUTDOWN: int +SERVICE_ACCEPT_STOP: int +SERVICE_ACTIVE: int +SERVICE_ALL_ACCESS: int +SERVICE_AUTO_START: int +SERVICE_BOOT_START: int +SERVICE_CHANGE_CONFIG: int +SERVICE_CONFIG_DELAYED_AUTO_START_INFO: int +SERVICE_CONFIG_DESCRIPTION: int +SERVICE_CONFIG_FAILURE_ACTIONS: int +SERVICE_CONFIG_FAILURE_ACTIONS_FLAG: int +SERVICE_CONFIG_PRESHUTDOWN_INFO: int +SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO: int +SERVICE_CONFIG_SERVICE_SID_INFO: int +SERVICE_CONTINUE_PENDING: int +SERVICE_CONTROL_CONTINUE: int +SERVICE_CONTROL_DEVICEEVENT: int +SERVICE_CONTROL_HARDWAREPROFILECHANGE: int +SERVICE_CONTROL_INTERROGATE: int +SERVICE_CONTROL_NETBINDADD: int +SERVICE_CONTROL_NETBINDDISABLE: int +SERVICE_CONTROL_NETBINDENABLE: int +SERVICE_CONTROL_NETBINDREMOVE: int +SERVICE_CONTROL_PARAMCHANGE: int +SERVICE_CONTROL_PAUSE: int +SERVICE_CONTROL_POWEREVENT: int +SERVICE_CONTROL_PRESHUTDOWN: int +SERVICE_CONTROL_SESSIONCHANGE: int +SERVICE_CONTROL_SHUTDOWN: int +SERVICE_CONTROL_STOP: int +SERVICE_DEMAND_START: int +SERVICE_DISABLED: int +SERVICE_DRIVER: int +SERVICE_ENUMERATE_DEPENDENTS: int +SERVICE_ERROR_CRITICAL: int +SERVICE_ERROR_IGNORE: int +SERVICE_ERROR_NORMAL: int +SERVICE_ERROR_SEVERE: int +SERVICE_FILE_SYSTEM_DRIVER: int +SERVICE_INACTIVE: int +SERVICE_INTERACTIVE_PROCESS: int +SERVICE_INTERROGATE: int +SERVICE_KERNEL_DRIVER: int +SERVICE_NO_CHANGE: int +SERVICE_PAUSE_CONTINUE: int +SERVICE_PAUSE_PENDING: int +SERVICE_PAUSED: int +SERVICE_QUERY_CONFIG: int +SERVICE_QUERY_STATUS: int +SERVICE_RUNNING: int +SERVICE_SID_TYPE_NONE: int +SERVICE_SID_TYPE_RESTRICTED: int +SERVICE_SID_TYPE_UNRESTRICTED: int +SERVICE_SPECIFIC_ERROR: int +SERVICE_START: int +SERVICE_START_PENDING: int +SERVICE_STATE_ALL: int +SERVICE_STOP: int +SERVICE_STOP_PENDING: int +SERVICE_STOPPED: int +SERVICE_SYSTEM_START: int +SERVICE_USER_DEFINED_CONTROL: int +SERVICE_WIN32: int +SERVICE_WIN32_OWN_PROCESS: int +SERVICE_WIN32_SHARE_PROCESS: int +UOI_FLAGS: int +UOI_NAME: int +UOI_TYPE: int +UOI_USER_SID: int +WSF_VISIBLE: int +HDESKType = _win32typing.PyHDESK +HWINSTAType = _win32typing.PyHWINSTA +UNICODE: int diff --git a/stubs/pywin32/win32/win32trace.pyi b/stubs/pywin32/win32/win32trace.pyi new file mode 100644 index 0000000..542d733 --- /dev/null +++ b/stubs/pywin32/win32/win32trace.pyi @@ -0,0 +1,13 @@ +from win32.lib.pywintypes import error as error + +def GetHandle(*args, **kwargs): ... # incomplete +def GetTracer(*args, **kwargs): ... # incomplete +def InitRead(*args, **kwargs): ... # incomplete +def InitWrite(*args, **kwargs): ... # incomplete +def TermRead(*args, **kwargs): ... # incomplete +def TermWrite(*args, **kwargs): ... # incomplete +def blockingread(*args, **kwargs): ... # incomplete +def flush(*args, **kwargs): ... # incomplete +def read(*args, **kwargs): ... # incomplete +def setprint(*args, **kwargs): ... # incomplete +def write(*args, **kwargs): ... # incomplete diff --git a/stubs/pywin32/win32/win32transaction.pyi b/stubs/pywin32/win32/win32transaction.pyi new file mode 100644 index 0000000..26d5077 --- /dev/null +++ b/stubs/pywin32/win32/win32transaction.pyi @@ -0,0 +1,18 @@ +import _win32typing +from win32.lib.pywintypes import error as error + +def CreateTransaction( + TransactionAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ..., + UOW: _win32typing.PyIID | None = ..., + CreateOptions: int = ..., + IsolationLevel: int = ..., + IsolationFlags: int = ..., + Timeout: int = ..., + Description: str | None = ..., +) -> int: ... +def RollbackTransaction(TransactionHandle: int) -> None: ... +def RollbackTransactionAsync(TransactionHandle: int) -> None: ... +def CommitTransaction(TransactionHandle: int) -> None: ... +def CommitTransactionAsync(TransactionHandle: int) -> None: ... +def GetTransactionId(TransactionHandle: int) -> _win32typing.PyIID: ... +def OpenTransaction(DesiredAccess, TransactionId: _win32typing.PyIID) -> int: ... diff --git a/stubs/pywin32/win32/win32ts.pyi b/stubs/pywin32/win32/win32ts.pyi new file mode 100644 index 0000000..853682e --- /dev/null +++ b/stubs/pywin32/win32/win32ts.pyi @@ -0,0 +1,96 @@ +from _typeshed import Incomplete + +def WTSOpenServer(ServerName: str) -> int: ... +def WTSCloseServer(Server: int) -> None: ... +def WTSQueryUserConfig(ServerName: str, UserName: str, ConfigClass): ... +def WTSSetUserConfig(ServerName: str, UserName: str, ConfigClass) -> None: ... +def WTSEnumerateServers(DomainName: str | None = ..., Version: int = ..., Reserved=...) -> tuple[str, ...]: ... +def WTSEnumerateSessions(Server: int, Version: int = ..., Reserved=...) -> tuple[Incomplete, ...]: ... +def WTSLogoffSession(Server: int, SessionId, Wait) -> None: ... +def WTSDisconnectSession(Server: int, SessionId, Wait) -> None: ... +def WTSQuerySessionInformation(Server: int, SessionId, WTSInfoClass) -> None: ... +def WTSEnumerateProcesses(Server: int, Version: int = ..., Reserved: int = ...) -> tuple[str, ...]: ... +def WTSQueryUserToken(SessionId) -> int: ... +def WTSShutdownSystem(Server: int, ShutdownFlag) -> None: ... +def WTSTerminateProcess(Server: int, ProcessId, ExitCode) -> None: ... +def ProcessIdToSessionId(ProcessId): ... +def WTSGetActiveConsoleSessionId(): ... +def WTSRegisterSessionNotification(Wnd: int, Flags) -> None: ... +def WTSUnRegisterSessionNotification(Wnd: int) -> None: ... +def WTSWaitSystemEvent(Server: int, EventMask): ... +def WTSSendMessage(Server: int, SessionId, Title: str, Message: str, Style, Timeout, Wait): ... + +NOTIFY_FOR_ALL_SESSIONS: int +NOTIFY_FOR_THIS_SESSION: int +WTSActive: int +WTSApplicationName: int +WTSClientAddress: int +WTSClientBuildNumber: int +WTSClientDirectory: int +WTSClientDisplay: int +WTSClientHardwareId: int +WTSClientName: int +WTSClientProductId: int +WTSClientProtocolType: int +WTSConnectQuery: int +WTSConnectState: int +WTSConnected: int +WTSDisconnected: int +WTSDomainName: int +WTSDown: int +WTSIdle: int +WTSInit: int +WTSInitialProgram: int +WTSListen: int +WTSOEMId: int +WTSReset: int +WTSSessionId: int +WTSShadow: int +WTSUserConfigBrokenTimeoutSettings: int +WTSUserConfigInitialProgram: int +WTSUserConfigModemCallbackPhoneNumber: int +WTSUserConfigModemCallbackSettings: int +WTSUserConfigReconnectSettings: int +WTSUserConfigShadowingSettings: int +WTSUserConfigTerminalServerHomeDir: int +WTSUserConfigTerminalServerHomeDirDrive: int +WTSUserConfigTerminalServerProfilePath: int +WTSUserConfigTimeoutSettingsConnections: int +WTSUserConfigTimeoutSettingsDisconnections: int +WTSUserConfigTimeoutSettingsIdle: int +WTSUserConfigWorkingDirectory: int +WTSUserConfigfAllowLogonTerminalServer: int +WTSUserConfigfDeviceClientDefaultPrinter: int +WTSUserConfigfDeviceClientDrives: int +WTSUserConfigfDeviceClientPrinters: int +WTSUserConfigfInheritInitialProgram: int +WTSUserConfigfTerminalServerRemoteHomeDir: int +WTSUserName: int +WTSVirtualClientData: int +WTSVirtualFileHandle: int +WTSWinStationName: int +WTSWorkingDirectory: int +WTS_CURRENT_SERVER: int +WTS_CURRENT_SERVER_HANDLE: int +WTS_CURRENT_SERVER_NAME: Incomplete +WTS_CURRENT_SESSION: int +WTS_EVENT_ALL: int +WTS_EVENT_CONNECT: int +WTS_EVENT_CREATE: int +WTS_EVENT_DELETE: int +WTS_EVENT_DISCONNECT: int +WTS_EVENT_FLUSH: int +WTS_EVENT_LICENSE: int +WTS_EVENT_LOGOFF: int +WTS_EVENT_LOGON: int +WTS_EVENT_NONE: int +WTS_EVENT_RENAME: int +WTS_EVENT_STATECHANGE: int +WTS_PROTOCOL_TYPE_CONSOLE: int +WTS_PROTOCOL_TYPE_ICA: int +WTS_PROTOCOL_TYPE_RDP: int +WTS_WSD_FASTREBOOT: int +WTS_WSD_LOGOFF: int +WTS_WSD_POWEROFF: int +WTS_WSD_REBOOT: int +WTS_WSD_SHUTDOWN: int diff --git a/stubs/pywin32/win32/win32wnet.pyi b/stubs/pywin32/win32/win32wnet.pyi new file mode 100644 index 0000000..320fac3 --- /dev/null +++ b/stubs/pywin32/win32/win32wnet.pyi @@ -0,0 +1,35 @@ +from _typeshed import Incomplete + +import _win32typing +from win32.lib.pywintypes import error as error + +def NCBBuffer(size): ... +def Netbios(ncb: _win32typing.NCB): ... +def WNetAddConnection2( + NetResource: _win32typing.PyNETRESOURCE, + Password: Incomplete | None = ..., + UserName: Incomplete | None = ..., + Flags: int = ..., +) -> None: ... +def WNetAddConnection3( + HwndParent: int, + NetResource: _win32typing.PyNETRESOURCE, + Password: Incomplete | None = ..., + UserName: Incomplete | None = ..., + Flags: int = ..., +) -> None: ... +def WNetCancelConnection2(name: str, flags, force) -> None: ... +def WNetOpenEnum(scope, _type, usage, resource: _win32typing.PyNETRESOURCE) -> int: ... +def WNetCloseEnum(handle: int) -> None: ... +def WNetEnumResource(handle: int, maxExtries: int = ...) -> list[_win32typing.PyNETRESOURCE]: ... +def WNetGetUser(connection: str | None = ...) -> str: ... +def WNetGetUniversalName(localPath: str, infoLevel) -> str: ... +def WNetGetResourceInformation(NetResource: _win32typing.PyNETRESOURCE) -> tuple[_win32typing.PyNETRESOURCE, Incomplete]: ... +def WNetGetLastError() -> tuple[Incomplete, Incomplete, Incomplete]: ... +def WNetGetResourceParent(NetResource: _win32typing.PyNETRESOURCE) -> _win32typing.PyNETRESOURCE: ... +def WNetGetConnection(connection: str | None = ...) -> str: ... + +NCB = _win32typing.PyNCB +NCBType = _win32typing.PyNCB +NETRESOURCE = _win32typing.PyNETRESOURCE +NETRESOURCEType = _win32typing.PyNETRESOURCE diff --git a/stubs/pywin32/win32/winxpgui.pyi b/stubs/pywin32/win32/winxpgui.pyi new file mode 100644 index 0000000..3b2b41a --- /dev/null +++ b/stubs/pywin32/win32/winxpgui.pyi @@ -0,0 +1 @@ +from win32.win32gui import * diff --git a/stubs/pywin32/win32api.pyi b/stubs/pywin32/win32api.pyi new file mode 100644 index 0000000..8beb8a8 --- /dev/null +++ b/stubs/pywin32/win32api.pyi @@ -0,0 +1 @@ +from win32.win32api import * diff --git a/stubs/pywin32/win32clipboard.pyi b/stubs/pywin32/win32clipboard.pyi new file mode 100644 index 0000000..77dbe66 --- /dev/null +++ b/stubs/pywin32/win32clipboard.pyi @@ -0,0 +1 @@ +from win32.win32clipboard import * diff --git a/stubs/pywin32/win32com/__init__.pyi b/stubs/pywin32/win32com/__init__.pyi new file mode 100644 index 0000000..3ceebb0 --- /dev/null +++ b/stubs/pywin32/win32com/__init__.pyi @@ -0,0 +1,9 @@ +from _typeshed import Incomplete + +__gen_path__: str +__build_path__: Incomplete + +def SetupEnvironment() -> None: ... +def __PackageSupportBuildPath__(package_path) -> None: ... + +gen_py: Incomplete diff --git a/stubs/pywin32/win32com/adsi/__init__.pyi b/stubs/pywin32/win32com/adsi/__init__.pyi new file mode 100644 index 0000000..548c6c6 --- /dev/null +++ b/stubs/pywin32/win32com/adsi/__init__.pyi @@ -0,0 +1 @@ +from win32comext.adsi import * diff --git a/stubs/pywin32/win32com/adsi/adsi.pyi b/stubs/pywin32/win32com/adsi/adsi.pyi new file mode 100644 index 0000000..a6269d4 --- /dev/null +++ b/stubs/pywin32/win32com/adsi/adsi.pyi @@ -0,0 +1 @@ +from win32comext.adsi.adsi import * diff --git a/stubs/pywin32/win32com/adsi/adsicon.pyi b/stubs/pywin32/win32com/adsi/adsicon.pyi new file mode 100644 index 0000000..1776450 --- /dev/null +++ b/stubs/pywin32/win32com/adsi/adsicon.pyi @@ -0,0 +1 @@ +from win32comext.adsi.adsicon import * diff --git a/stubs/pywin32/win32com/authorization/__init__.pyi b/stubs/pywin32/win32com/authorization/__init__.pyi new file mode 100644 index 0000000..975c5a8 --- /dev/null +++ b/stubs/pywin32/win32com/authorization/__init__.pyi @@ -0,0 +1 @@ +from win32comext.authorization import * diff --git a/stubs/pywin32/win32com/authorization/authorization.pyi b/stubs/pywin32/win32com/authorization/authorization.pyi new file mode 100644 index 0000000..0ad104f --- /dev/null +++ b/stubs/pywin32/win32com/authorization/authorization.pyi @@ -0,0 +1 @@ +from win32comext.authorization.authorization import * diff --git a/stubs/pywin32/win32com/axcontrol/__init__.pyi b/stubs/pywin32/win32com/axcontrol/__init__.pyi new file mode 100644 index 0000000..fde8be5 --- /dev/null +++ b/stubs/pywin32/win32com/axcontrol/__init__.pyi @@ -0,0 +1 @@ +from win32comext.axcontrol import * diff --git a/stubs/pywin32/win32com/axcontrol/axcontrol.pyi b/stubs/pywin32/win32com/axcontrol/axcontrol.pyi new file mode 100644 index 0000000..d3c7344 --- /dev/null +++ b/stubs/pywin32/win32com/axcontrol/axcontrol.pyi @@ -0,0 +1 @@ +from win32comext.axcontrol.axcontrol import * diff --git a/stubs/pywin32/win32com/axdebug/__init__.pyi b/stubs/pywin32/win32com/axdebug/__init__.pyi new file mode 100644 index 0000000..97d083e --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/__init__.pyi @@ -0,0 +1 @@ +from win32comext.axdebug import * diff --git a/stubs/pywin32/win32com/axdebug/adb.pyi b/stubs/pywin32/win32com/axdebug/adb.pyi new file mode 100644 index 0000000..48966a1 --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/adb.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.adb import * diff --git a/stubs/pywin32/win32com/axdebug/axdebug.pyi b/stubs/pywin32/win32com/axdebug/axdebug.pyi new file mode 100644 index 0000000..45b1113 --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/axdebug.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.axdebug import * diff --git a/stubs/pywin32/win32com/axdebug/codecontainer.pyi b/stubs/pywin32/win32com/axdebug/codecontainer.pyi new file mode 100644 index 0000000..60d3a50 --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/codecontainer.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.codecontainer import * diff --git a/stubs/pywin32/win32com/axdebug/contexts.pyi b/stubs/pywin32/win32com/axdebug/contexts.pyi new file mode 100644 index 0000000..c1c9fbf --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/contexts.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.contexts import * diff --git a/stubs/pywin32/win32com/axdebug/debugger.pyi b/stubs/pywin32/win32com/axdebug/debugger.pyi new file mode 100644 index 0000000..83a0e9c --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/debugger.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.debugger import * diff --git a/stubs/pywin32/win32com/axdebug/documents.pyi b/stubs/pywin32/win32com/axdebug/documents.pyi new file mode 100644 index 0000000..e0d1bb7 --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/documents.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.documents import * diff --git a/stubs/pywin32/win32com/axdebug/expressions.pyi b/stubs/pywin32/win32com/axdebug/expressions.pyi new file mode 100644 index 0000000..3816f76 --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/expressions.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.expressions import * diff --git a/stubs/pywin32/win32com/axdebug/gateways.pyi b/stubs/pywin32/win32com/axdebug/gateways.pyi new file mode 100644 index 0000000..517204a --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/gateways.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.gateways import * diff --git a/stubs/pywin32/win32com/axdebug/stackframe.pyi b/stubs/pywin32/win32com/axdebug/stackframe.pyi new file mode 100644 index 0000000..3184248 --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/stackframe.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.stackframe import * diff --git a/stubs/pywin32/win32com/axdebug/util.pyi b/stubs/pywin32/win32com/axdebug/util.pyi new file mode 100644 index 0000000..1ea282e --- /dev/null +++ b/stubs/pywin32/win32com/axdebug/util.pyi @@ -0,0 +1 @@ +from win32comext.axdebug.util import * diff --git a/stubs/pywin32/win32com/axscript/__init__.pyi b/stubs/pywin32/win32com/axscript/__init__.pyi new file mode 100644 index 0000000..afc72ec --- /dev/null +++ b/stubs/pywin32/win32com/axscript/__init__.pyi @@ -0,0 +1 @@ +from win32comext.axscript import * diff --git a/stubs/pywin32/win32com/axscript/asputil.pyi b/stubs/pywin32/win32com/axscript/asputil.pyi new file mode 100644 index 0000000..1e04c85 --- /dev/null +++ b/stubs/pywin32/win32com/axscript/asputil.pyi @@ -0,0 +1 @@ +from win32comext.axscript.asputil import * diff --git a/stubs/pywin32/win32com/axscript/axscript.pyi b/stubs/pywin32/win32com/axscript/axscript.pyi new file mode 100644 index 0000000..7ec0b34 --- /dev/null +++ b/stubs/pywin32/win32com/axscript/axscript.pyi @@ -0,0 +1 @@ +from win32comext.axscript.axscript import * diff --git a/stubs/pywin32/win32com/axscript/client/__init__.pyi b/stubs/pywin32/win32com/axscript/client/__init__.pyi new file mode 100644 index 0000000..203d0ab --- /dev/null +++ b/stubs/pywin32/win32com/axscript/client/__init__.pyi @@ -0,0 +1 @@ +from win32comext.axscript.client import * diff --git a/stubs/pywin32/win32com/axscript/client/error.pyi b/stubs/pywin32/win32com/axscript/client/error.pyi new file mode 100644 index 0000000..f1a3310 --- /dev/null +++ b/stubs/pywin32/win32com/axscript/client/error.pyi @@ -0,0 +1 @@ +from win32comext.axscript.client.error import * diff --git a/stubs/pywin32/win32com/axscript/server/__init__.pyi b/stubs/pywin32/win32com/axscript/server/__init__.pyi new file mode 100644 index 0000000..6cb0b07 --- /dev/null +++ b/stubs/pywin32/win32com/axscript/server/__init__.pyi @@ -0,0 +1 @@ +from win32comext.axscript.server import * diff --git a/stubs/pywin32/win32com/axscript/server/axsite.pyi b/stubs/pywin32/win32com/axscript/server/axsite.pyi new file mode 100644 index 0000000..e071034 --- /dev/null +++ b/stubs/pywin32/win32com/axscript/server/axsite.pyi @@ -0,0 +1 @@ +from win32comext.axscript.server.axsite import * diff --git a/stubs/pywin32/win32com/axscript/server/error.pyi b/stubs/pywin32/win32com/axscript/server/error.pyi new file mode 100644 index 0000000..6de1e5d --- /dev/null +++ b/stubs/pywin32/win32com/axscript/server/error.pyi @@ -0,0 +1 @@ +from win32comext.axscript.server.error import * diff --git a/stubs/pywin32/win32com/bits/__init__.pyi b/stubs/pywin32/win32com/bits/__init__.pyi new file mode 100644 index 0000000..020ede0 --- /dev/null +++ b/stubs/pywin32/win32com/bits/__init__.pyi @@ -0,0 +1 @@ +from win32comext.bits import * diff --git a/stubs/pywin32/win32com/bits/bits.pyi b/stubs/pywin32/win32com/bits/bits.pyi new file mode 100644 index 0000000..fcea1eb --- /dev/null +++ b/stubs/pywin32/win32com/bits/bits.pyi @@ -0,0 +1 @@ +from win32comext.bits.bits import * diff --git a/stubs/pywin32/win32com/client/__init__.pyi b/stubs/pywin32/win32com/client/__init__.pyi new file mode 100644 index 0000000..797a3ed --- /dev/null +++ b/stubs/pywin32/win32com/client/__init__.pyi @@ -0,0 +1,70 @@ +from _typeshed import Incomplete + +from win32com.client import dynamic as dynamic + +def GetObject(Pathname: str | None = ..., Class: Incomplete | None = ..., clsctx: Incomplete | None = ...) -> CDispatch: ... +def GetActiveObject(Class, clsctx=...): ... +def Moniker(Pathname, clsctx=...): ... +def Dispatch( + dispatch, + userName: Incomplete | None = ..., + resultCLSID: Incomplete | None = ..., + typeinfo: Incomplete | None = ..., + UnicodeToString: Incomplete | None = ..., + clsctx=..., +): ... +def DispatchEx( + clsid, + machine: Incomplete | None = ..., + userName: Incomplete | None = ..., + resultCLSID: Incomplete | None = ..., + typeinfo: Incomplete | None = ..., + UnicodeToString: Incomplete | None = ..., + clsctx: Incomplete | None = ..., +): ... + +class CDispatch(dynamic.CDispatch): + def __dir__(self): ... + +def CastTo(ob, target, typelib: Incomplete | None = ...): ... + +class Constants: + __dicts__: Incomplete + def __getattr__(self, a): ... + +constants: Incomplete + +class EventsProxy: + def __init__(self, ob) -> None: ... + def __del__(self) -> None: ... + def __getattr__(self, attr): ... + def __setattr__(self, attr, val) -> None: ... + +def DispatchWithEvents(clsid, user_event_class): ... +def WithEvents(disp, user_event_class): ... +def getevents(clsid): ... +def Record(name, object): ... + +class DispatchBaseClass: + def __init__(self, oobj: Incomplete | None = ...) -> None: ... + def __dir__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __getattr__(self, attr): ... + def __setattr__(self, attr, value) -> None: ... + +class CoClassBaseClass: + def __init__(self, oobj: Incomplete | None = ...) -> None: ... + def __getattr__(self, attr): ... + def __setattr__(self, attr, value) -> None: ... + def __maybe__call__(self, *args, **kwargs): ... + def __maybe__str__(self, *args): ... + def __maybe__int__(self, *args): ... + def __maybe__iter__(self): ... + def __maybe__len__(self): ... + def __maybe__nonzero__(self): ... + +class VARIANT: + varianttype: Incomplete + def __init__(self, vt, value) -> None: ... + value: Incomplete diff --git a/stubs/pywin32/win32com/client/dynamic.pyi b/stubs/pywin32/win32com/client/dynamic.pyi new file mode 100644 index 0000000..8a5d4d4 --- /dev/null +++ b/stubs/pywin32/win32com/client/dynamic.pyi @@ -0,0 +1,28 @@ +from _typeshed import Incomplete +from typing import Any + +# Necessary for mypy to not throw AssertionError with win32com.client +class CDispatch: + def __init__( + self, + IDispatch, + olerepr, + userName: Incomplete | None = ..., + UnicodeToString: Incomplete | None = ..., + lazydata: Incomplete | None = ..., + ) -> None: ... + def __call__(self, *args): ... + def __bool__(self): ... + def __dir__(self): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __int__(self): ... + def __len__(self): ... + def __getitem__(self, index): ... + def __setitem__(self, index, *args): ... + def __LazyMap__(self, attr): ... + def __AttrToID__(self, attr): ... + ob: Incomplete + # CDispatch objects are dynamically generated and too complex to type + def __getattr__(self, attr: str) -> Any: ... + def __setattr__(self, attr: str, value: Any) -> None: ... diff --git a/stubs/pywin32/win32com/directsound/__init__.pyi b/stubs/pywin32/win32com/directsound/__init__.pyi new file mode 100644 index 0000000..6ac36b6 --- /dev/null +++ b/stubs/pywin32/win32com/directsound/__init__.pyi @@ -0,0 +1 @@ +from win32comext.directsound import * diff --git a/stubs/pywin32/win32com/directsound/directsound.pyi b/stubs/pywin32/win32com/directsound/directsound.pyi new file mode 100644 index 0000000..ec66ab4 --- /dev/null +++ b/stubs/pywin32/win32com/directsound/directsound.pyi @@ -0,0 +1 @@ +from win32comext.directsound.directsound import * diff --git a/stubs/pywin32/win32com/ifilter/__init__.pyi b/stubs/pywin32/win32com/ifilter/__init__.pyi new file mode 100644 index 0000000..258d3a3 --- /dev/null +++ b/stubs/pywin32/win32com/ifilter/__init__.pyi @@ -0,0 +1 @@ +from win32comext.ifilter import * diff --git a/stubs/pywin32/win32com/ifilter/ifilter.pyi b/stubs/pywin32/win32com/ifilter/ifilter.pyi new file mode 100644 index 0000000..01872b2 --- /dev/null +++ b/stubs/pywin32/win32com/ifilter/ifilter.pyi @@ -0,0 +1 @@ +from win32comext.ifilter.ifilter import * diff --git a/stubs/pywin32/win32com/ifilter/ifiltercon.pyi b/stubs/pywin32/win32com/ifilter/ifiltercon.pyi new file mode 100644 index 0000000..8f2260e --- /dev/null +++ b/stubs/pywin32/win32com/ifilter/ifiltercon.pyi @@ -0,0 +1 @@ +from win32comext.ifilter.ifiltercon import * diff --git a/stubs/pywin32/win32com/internet/__init__.pyi b/stubs/pywin32/win32com/internet/__init__.pyi new file mode 100644 index 0000000..8fb46e5 --- /dev/null +++ b/stubs/pywin32/win32com/internet/__init__.pyi @@ -0,0 +1 @@ +from win32comext.internet import * diff --git a/stubs/pywin32/win32com/internet/inetcon.pyi b/stubs/pywin32/win32com/internet/inetcon.pyi new file mode 100644 index 0000000..58e4a62 --- /dev/null +++ b/stubs/pywin32/win32com/internet/inetcon.pyi @@ -0,0 +1 @@ +from win32comext.internet.inetcon import * diff --git a/stubs/pywin32/win32com/internet/internet.pyi b/stubs/pywin32/win32com/internet/internet.pyi new file mode 100644 index 0000000..e08fbee --- /dev/null +++ b/stubs/pywin32/win32com/internet/internet.pyi @@ -0,0 +1 @@ +from win32comext.internet.internet import * diff --git a/stubs/pywin32/win32com/mapi/__init__.pyi b/stubs/pywin32/win32com/mapi/__init__.pyi new file mode 100644 index 0000000..cc183a9 --- /dev/null +++ b/stubs/pywin32/win32com/mapi/__init__.pyi @@ -0,0 +1 @@ +from win32comext.mapi import * diff --git a/stubs/pywin32/win32com/mapi/_exchdapi.pyi b/stubs/pywin32/win32com/mapi/_exchdapi.pyi new file mode 100644 index 0000000..fe5f8ed --- /dev/null +++ b/stubs/pywin32/win32com/mapi/_exchdapi.pyi @@ -0,0 +1 @@ +from win32comext.mapi._exchdapi import * diff --git a/stubs/pywin32/win32com/mapi/emsabtags.pyi b/stubs/pywin32/win32com/mapi/emsabtags.pyi new file mode 100644 index 0000000..d38198b --- /dev/null +++ b/stubs/pywin32/win32com/mapi/emsabtags.pyi @@ -0,0 +1 @@ +from win32comext.mapi.emsabtags import * diff --git a/stubs/pywin32/win32com/mapi/exchange.pyi b/stubs/pywin32/win32com/mapi/exchange.pyi new file mode 100644 index 0000000..1d4b98a --- /dev/null +++ b/stubs/pywin32/win32com/mapi/exchange.pyi @@ -0,0 +1 @@ +from win32comext.mapi.exchange import * diff --git a/stubs/pywin32/win32com/mapi/mapi.pyi b/stubs/pywin32/win32com/mapi/mapi.pyi new file mode 100644 index 0000000..e7bacd9 --- /dev/null +++ b/stubs/pywin32/win32com/mapi/mapi.pyi @@ -0,0 +1 @@ +from win32comext.mapi.mapi import * diff --git a/stubs/pywin32/win32com/mapi/mapitags.pyi b/stubs/pywin32/win32com/mapi/mapitags.pyi new file mode 100644 index 0000000..f4ff53e --- /dev/null +++ b/stubs/pywin32/win32com/mapi/mapitags.pyi @@ -0,0 +1 @@ +from win32comext.mapi.mapitags import * diff --git a/stubs/pywin32/win32com/mapi/mapiutil.pyi b/stubs/pywin32/win32com/mapi/mapiutil.pyi new file mode 100644 index 0000000..cd19df1 --- /dev/null +++ b/stubs/pywin32/win32com/mapi/mapiutil.pyi @@ -0,0 +1 @@ +from win32comext.mapi.mapiutil import * diff --git a/stubs/pywin32/win32com/olectl.pyi b/stubs/pywin32/win32com/olectl.pyi new file mode 100644 index 0000000..33c1107 --- /dev/null +++ b/stubs/pywin32/win32com/olectl.pyi @@ -0,0 +1,54 @@ +FACILITY_CONTROL: int + +def MAKE_SCODE(sev: int, fac: int, code: int) -> int: ... +def STD_CTL_SCODE(n: int) -> int: ... + +CTL_E_ILLEGALFUNCTIONCALL: int +CTL_E_OVERFLOW: int +CTL_E_OUTOFMEMORY: int +CTL_E_DIVISIONBYZERO: int +CTL_E_OUTOFSTRINGSPACE: int +CTL_E_OUTOFSTACKSPACE: int +CTL_E_BADFILENAMEORNUMBER: int +CTL_E_FILENOTFOUND: int +CTL_E_BADFILEMODE: int +CTL_E_FILEALREADYOPEN: int +CTL_E_DEVICEIOERROR: int +CTL_E_FILEALREADYEXISTS: int +CTL_E_BADRECORDLENGTH: int +CTL_E_DISKFULL: int +CTL_E_BADRECORDNUMBER: int +CTL_E_BADFILENAME: int +CTL_E_TOOMANYFILES: int +CTL_E_DEVICEUNAVAILABLE: int +CTL_E_PERMISSIONDENIED: int +CTL_E_DISKNOTREADY: int +CTL_E_PATHFILEACCESSERROR: int +CTL_E_PATHNOTFOUND: int +CTL_E_INVALIDPATTERNSTRING: int +CTL_E_INVALIDUSEOFNULL: int +CTL_E_INVALIDFILEFORMAT: int +CTL_E_INVALIDPROPERTYVALUE: int +CTL_E_INVALIDPROPERTYARRAYINDEX: int +CTL_E_SETNOTSUPPORTEDATRUNTIME: int +CTL_E_SETNOTSUPPORTED: int +CTL_E_NEEDPROPERTYARRAYINDEX: int +CTL_E_SETNOTPERMITTED: int +CTL_E_GETNOTSUPPORTEDATRUNTIME: int +CTL_E_GETNOTSUPPORTED: int +CTL_E_PROPERTYNOTFOUND: int +CTL_E_INVALIDCLIPBOARDFORMAT: int +CTL_E_INVALIDPICTURE: int +CTL_E_PRINTERERROR: int +CTL_E_CANTSAVEFILETOTEMP: int +CTL_E_SEARCHTEXTNOTFOUND: int +CTL_E_REPLACEMENTSTOOLONG: int +CONNECT_E_FIRST: int +CONNECT_E_LAST: int +CONNECT_S_FIRST: int +CONNECT_S_LAST: int +CONNECT_E_NOCONNECTION: int +CONNECT_E_ADVISELIMIT: int +CONNECT_E_CANNOTCONNECT: int +CONNECT_E_OVERRIDDEN: int +CLASS_E_NOTLICENSED: int diff --git a/stubs/pywin32/win32com/propsys/__init__.pyi b/stubs/pywin32/win32com/propsys/__init__.pyi new file mode 100644 index 0000000..34b7210 --- /dev/null +++ b/stubs/pywin32/win32com/propsys/__init__.pyi @@ -0,0 +1 @@ +from win32comext.propsys import * diff --git a/stubs/pywin32/win32com/propsys/propsys.pyi b/stubs/pywin32/win32com/propsys/propsys.pyi new file mode 100644 index 0000000..c5afd3c --- /dev/null +++ b/stubs/pywin32/win32com/propsys/propsys.pyi @@ -0,0 +1 @@ +from win32comext.propsys.propsys import * diff --git a/stubs/pywin32/win32com/propsys/pscon.pyi b/stubs/pywin32/win32com/propsys/pscon.pyi new file mode 100644 index 0000000..0f35b47 --- /dev/null +++ b/stubs/pywin32/win32com/propsys/pscon.pyi @@ -0,0 +1 @@ +from win32comext.propsys.pscon import * diff --git a/stubs/beautifulsoup4/@tests/stubtest_allowlist.txt b/stubs/pywin32/win32com/server/__init__.pyi similarity index 100% rename from stubs/beautifulsoup4/@tests/stubtest_allowlist.txt rename to stubs/pywin32/win32com/server/__init__.pyi diff --git a/stubs/pywin32/win32com/server/connect.pyi b/stubs/pywin32/win32com/server/connect.pyi new file mode 100644 index 0000000..cf8670a --- /dev/null +++ b/stubs/pywin32/win32com/server/connect.pyi @@ -0,0 +1,18 @@ +from _typeshed import Incomplete + +from win32com import olectl as olectl +from win32com.server.exception import Exception as Exception + +IConnectionPointContainer_methods: Incomplete +IConnectionPoint_methods: Incomplete + +class ConnectableServer: + cookieNo: int + connections: Incomplete + def EnumConnections(self) -> None: ... + def GetConnectionInterface(self) -> None: ... + def GetConnectionPointContainer(self): ... + def Advise(self, pUnk): ... + def Unadvise(self, cookie) -> None: ... + def EnumConnectionPoints(self) -> None: ... + def FindConnectionPoint(self, iid): ... diff --git a/stubs/pywin32/win32com/server/dispatcher.pyi b/stubs/pywin32/win32com/server/dispatcher.pyi new file mode 100644 index 0000000..dde27d7 --- /dev/null +++ b/stubs/pywin32/win32com/server/dispatcher.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +from win32com.server.exception import IsCOMServerException as IsCOMServerException +from win32com.util import IIDToInterfaceName as IIDToInterfaceName + +class DispatcherBase: + policy: Incomplete + logger: Incomplete + def __init__(self, policyClass, object) -> None: ... + +class DispatcherTrace(DispatcherBase): ... + +class DispatcherWin32trace(DispatcherTrace): + def __init__(self, policyClass, object) -> None: ... + +class DispatcherOutputDebugString(DispatcherTrace): ... + +class DispatcherWin32dbg(DispatcherBase): + def __init__(self, policyClass, ob) -> None: ... + +DefaultDebugDispatcher: TypeAlias = DispatcherWin32trace diff --git a/stubs/pywin32/win32com/server/exception.pyi b/stubs/pywin32/win32com/server/exception.pyi new file mode 100644 index 0000000..6d27f70 --- /dev/null +++ b/stubs/pywin32/win32com/server/exception.pyi @@ -0,0 +1,25 @@ +from _typeshed import Incomplete + +import pythoncom + +class COMException(pythoncom.com_error): + scode: Incomplete + description: Incomplete + source: Incomplete + helpfile: Incomplete + helpcontext: Incomplete + def __init__( + self, + description: Incomplete | None = ..., + scode: Incomplete | None = ..., + source: Incomplete | None = ..., + helpfile: Incomplete | None = ..., + helpContext: Incomplete | None = ..., + desc: Incomplete | None = ..., + hresult: Incomplete | None = ..., + ) -> None: ... + +Exception = COMException + +def IsCOMException(t: Incomplete | None = ...): ... +def IsCOMServerException(t: Incomplete | None = ...): ... diff --git a/stubs/pywin32/win32com/server/policy.pyi b/stubs/pywin32/win32com/server/policy.pyi new file mode 100644 index 0000000..6de24c3 --- /dev/null +++ b/stubs/pywin32/win32com/server/policy.pyi @@ -0,0 +1,44 @@ +from _typeshed import Incomplete + +from pythoncom import ( + DISPID_COLLECT as DISPID_COLLECT, + DISPID_CONSTRUCTOR as DISPID_CONSTRUCTOR, + DISPID_DESTRUCTOR as DISPID_DESTRUCTOR, + DISPID_UNKNOWN as DISPID_UNKNOWN, +) +from win32com.server.dispatcher import DispatcherTrace as DispatcherTrace, DispatcherWin32trace as DispatcherWin32trace +from win32com.server.exception import COMException as COMException + +S_OK: int +IDispatchType: Incomplete +IUnknownType: Incomplete +error: Incomplete +regSpec: str +regPolicy: str +regDispatcher: str +regAddnPath: str + +def CreateInstance(clsid, reqIID): ... + +class BasicWrapPolicy: + def __init__(self, object) -> None: ... + +class MappedWrapPolicy(BasicWrapPolicy): ... +class DesignatedWrapPolicy(MappedWrapPolicy): ... +class EventHandlerPolicy(DesignatedWrapPolicy): ... +class DynamicPolicy(BasicWrapPolicy): ... + +DefaultPolicy = DesignatedWrapPolicy + +def resolve_func(spec): ... +def call_func(spec, *args): ... + +DISPATCH_METHOD: int +DISPATCH_PROPERTYGET: int +DISPATCH_PROPERTYPUT: int +DISPATCH_PROPERTYPUTREF: int +DISPID_EVALUATE: int +DISPID_NEWENUM: int +DISPID_PROPERTYPUT: int +DISPID_STARTENUM: int +DISPID_VALUE: int diff --git a/stubs/pywin32/win32com/server/util.pyi b/stubs/pywin32/win32com/server/util.pyi new file mode 100644 index 0000000..14fe4b0 --- /dev/null +++ b/stubs/pywin32/win32com/server/util.pyi @@ -0,0 +1,40 @@ +from _typeshed import Incomplete + +from win32com.server import policy as policy +from win32com.server.exception import COMException as COMException + +def wrap(ob, iid: Incomplete | None = ..., usePolicy: Incomplete | None = ..., useDispatcher: Incomplete | None = ...): ... +def unwrap(ob): ... + +class ListEnumerator: + index: Incomplete + def __init__(self, data, index: int = ..., iid=...) -> None: ... + def Next(self, count): ... + def Skip(self, count) -> None: ... + def Reset(self) -> None: ... + def Clone(self): ... + +class ListEnumeratorGateway(ListEnumerator): + def Next(self, count): ... + +def NewEnum(seq, cls=..., iid=..., usePolicy: Incomplete | None = ..., useDispatcher: Incomplete | None = ...): ... + +class Collection: + data: Incomplete + def __init__(self, data: Incomplete | None = ..., readOnly: int = ...) -> None: ... + def Item(self, *args): ... + def Count(self): ... + def Add(self, value) -> None: ... + def Remove(self, index) -> None: ... + def Insert(self, index, value) -> None: ... + +def NewCollection(seq, cls=...): ... + +class FileStream: + file: Incomplete + def __init__(self, file) -> None: ... + def Read(self, amount): ... + def Write(self, data): ... + def Clone(self): ... + def CopyTo(self, dest, cb): ... + def Seek(self, offset, origin): ... diff --git a/stubs/pywin32/win32com/shell/__init__.pyi b/stubs/pywin32/win32com/shell/__init__.pyi new file mode 100644 index 0000000..1074dc6 --- /dev/null +++ b/stubs/pywin32/win32com/shell/__init__.pyi @@ -0,0 +1 @@ +from win32comext.shell import * diff --git a/stubs/pywin32/win32com/shell/shell.pyi b/stubs/pywin32/win32com/shell/shell.pyi new file mode 100644 index 0000000..63f0421 --- /dev/null +++ b/stubs/pywin32/win32com/shell/shell.pyi @@ -0,0 +1 @@ +from win32comext.shell.shell import * diff --git a/stubs/pywin32/win32com/shell/shellcon.pyi b/stubs/pywin32/win32com/shell/shellcon.pyi new file mode 100644 index 0000000..d10057f --- /dev/null +++ b/stubs/pywin32/win32com/shell/shellcon.pyi @@ -0,0 +1 @@ +from win32comext.shell.shellcon import * diff --git a/stubs/pywin32/win32com/storagecon.pyi b/stubs/pywin32/win32com/storagecon.pyi new file mode 100644 index 0000000..3242473 --- /dev/null +++ b/stubs/pywin32/win32com/storagecon.pyi @@ -0,0 +1,113 @@ +STGC_DEFAULT: int +STGC_OVERWRITE: int +STGC_ONLYIFCURRENT: int +STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE: int +STGC_CONSOLIDATE: int +STGTY_STORAGE: int +STGTY_STREAM: int +STGTY_LOCKBYTES: int +STGTY_PROPERTY: int +STREAM_SEEK_SET: int +STREAM_SEEK_CUR: int +STREAM_SEEK_END: int +LOCK_WRITE: int +LOCK_EXCLUSIVE: int +LOCK_ONLYONCE: int +CWCSTORAGENAME: int +STGM_DIRECT: int +STGM_TRANSACTED: int +STGM_SIMPLE: int +STGM_READ: int +STGM_WRITE: int +STGM_READWRITE: int +STGM_SHARE_DENY_NONE: int +STGM_SHARE_DENY_READ: int +STGM_SHARE_DENY_WRITE: int +STGM_SHARE_EXCLUSIVE: int +STGM_PRIORITY: int +STGM_DELETEONRELEASE: int +STGM_NOSCRATCH: int +STGM_CREATE: int +STGM_CONVERT: int +STGM_FAILIFTHERE: int +STGM_NOSNAPSHOT: int +ASYNC_MODE_COMPATIBILITY: int +ASYNC_MODE_DEFAULT: int +STGTY_REPEAT: int +STG_TOEND: int +STG_LAYOUT_SEQUENTIAL: int +STG_LAYOUT_INTERLEAVED: int +COM_RIGHTS_EXECUTE: int +COM_RIGHTS_EXECUTE_LOCAL: int +COM_RIGHTS_EXECUTE_REMOTE: int +COM_RIGHTS_ACTIVATE_LOCAL: int +COM_RIGHTS_ACTIVATE_REMOTE: int +STGFMT_DOCUMENT: int +STGFMT_STORAGE: int +STGFMT_NATIVE: int +STGFMT_FILE: int +STGFMT_ANY: int +STGFMT_DOCFILE: int +PID_DICTIONARY: int +PID_CODEPAGE: int +PID_FIRST_USABLE: int +PID_FIRST_NAME_DEFAULT: int +PID_LOCALE: int +PID_MODIFY_TIME: int +PID_SECURITY: int +PID_BEHAVIOR: int +PID_ILLEGAL: int +PID_MIN_READONLY: int +PID_MAX_READONLY: int +PIDDI_THUMBNAIL: int +PIDSI_TITLE: int +PIDSI_SUBJECT: int +PIDSI_AUTHOR: int +PIDSI_KEYWORDS: int +PIDSI_COMMENTS: int +PIDSI_TEMPLATE: int +PIDSI_LASTAUTHOR: int +PIDSI_REVNUMBER: int +PIDSI_EDITTIME: int +PIDSI_LASTPRINTED: int +PIDSI_CREATE_DTM: int +PIDSI_LASTSAVE_DTM: int +PIDSI_PAGECOUNT: int +PIDSI_WORDCOUNT: int +PIDSI_CHARCOUNT: int +PIDSI_THUMBNAIL: int +PIDSI_APPNAME: int +PIDSI_DOC_SECURITY: int +PIDDSI_CATEGORY: int +PIDDSI_PRESFORMAT: int +PIDDSI_BYTECOUNT: int +PIDDSI_LINECOUNT: int +PIDDSI_PARCOUNT: int +PIDDSI_SLIDECOUNT: int +PIDDSI_NOTECOUNT: int +PIDDSI_HIDDENCOUNT: int +PIDDSI_MMCLIPCOUNT: int +PIDDSI_SCALE: int +PIDDSI_HEADINGPAIR: int +PIDDSI_DOCPARTS: int +PIDDSI_MANAGER: int +PIDDSI_COMPANY: int +PIDDSI_LINKSDIRTY: int +PIDMSI_EDITOR: int +PIDMSI_SUPPLIER: int +PIDMSI_SOURCE: int +PIDMSI_SEQUENCE_NO: int +PIDMSI_PROJECT: int +PIDMSI_STATUS: int +PIDMSI_OWNER: int +PIDMSI_RATING: int +PIDMSI_PRODUCTION: int +PIDMSI_COPYRIGHT: int +PROPSETFLAG_DEFAULT: int +PROPSETFLAG_NONSIMPLE: int +PROPSETFLAG_ANSI: int +PROPSETFLAG_UNBUFFERED: int +PROPSETFLAG_CASE_SENSITIVE: int +STGMOVE_MOVE: int +STGMOVE_COPY: int +STGMOVE_SHALLOWCOPY: int diff --git a/stubs/pywin32/win32com/taskscheduler/__init__.pyi b/stubs/pywin32/win32com/taskscheduler/__init__.pyi new file mode 100644 index 0000000..2d22e3f --- /dev/null +++ b/stubs/pywin32/win32com/taskscheduler/__init__.pyi @@ -0,0 +1 @@ +from win32comext.taskscheduler import * diff --git a/stubs/pywin32/win32com/taskscheduler/taskscheduler.pyi b/stubs/pywin32/win32com/taskscheduler/taskscheduler.pyi new file mode 100644 index 0000000..7771ba7 --- /dev/null +++ b/stubs/pywin32/win32com/taskscheduler/taskscheduler.pyi @@ -0,0 +1 @@ +from win32comext.taskscheduler.taskscheduler import * diff --git a/stubs/pywin32/win32com/universal.pyi b/stubs/pywin32/win32com/universal.pyi new file mode 100644 index 0000000..8d9a1fd --- /dev/null +++ b/stubs/pywin32/win32com/universal.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete + +from pythoncom import com_error as com_error + +def RegisterInterfaces(typelibGUID, lcid, major, minor, interface_names: Incomplete | None = ...): ... + +class Arg: + name: Incomplete + size: Incomplete + offset: int + def __init__(self, arg_info, name: Incomplete | None = ...) -> None: ... + +class Method: + dispid: Incomplete + invkind: Incomplete + name: Incomplete + args: Incomplete + cbArgs: Incomplete + def __init__(self, method_info, isEventSink: int = ...) -> None: ... + +class Definition: + def __init__(self, iid, is_dispatch, method_defs) -> None: ... + def iid(self): ... + def vtbl_argsizes(self): ... + def vtbl_argcounts(self): ... + def dispatch(self, ob, index, argPtr, ReadFromInTuple=..., WriteFromOutTuple=...): ... diff --git a/stubs/pywin32/win32com/util.pyi b/stubs/pywin32/win32com/util.pyi new file mode 100644 index 0000000..6c896a8 --- /dev/null +++ b/stubs/pywin32/win32com/util.pyi @@ -0,0 +1 @@ +def IIDToInterfaceName(iid): ... diff --git a/stubs/jsonschema/jsonschema/compat.pyi b/stubs/pywin32/win32comext/__init__.pyi similarity index 100% rename from stubs/jsonschema/jsonschema/compat.pyi rename to stubs/pywin32/win32comext/__init__.pyi diff --git a/stubs/pywin32/win32comext/adsi/__init__.pyi b/stubs/pywin32/win32comext/adsi/__init__.pyi new file mode 100644 index 0000000..0b7df41 --- /dev/null +++ b/stubs/pywin32/win32comext/adsi/__init__.pyi @@ -0,0 +1,73 @@ +from _typeshed import Incomplete + +import _win32typing +import win32com.client +from win32comext.adsi.adsi import ( + DBPROPSET_ADSISEARCH as DBPROPSET_ADSISEARCH, + ADsBuildEnumerator as ADsBuildEnumerator, + ADsEnumerateNext as ADsEnumerateNext, + ADsGetLastError as ADsGetLastError, + CLSID_AccessControlEntry as CLSID_AccessControlEntry, + CLSID_AccessControlList as CLSID_AccessControlList, + CLSID_ADsDSOObject as CLSID_ADsDSOObject, + CLSID_DsObjectPicker as CLSID_DsObjectPicker, + CLSID_SecurityDescriptor as CLSID_SecurityDescriptor, + DBGUID_LDAPDialect as DBGUID_LDAPDialect, + DSOP_SCOPE_INIT_INFOs as DSOP_SCOPE_INIT_INFOs, + IID_IADs as IID_IADs, + IID_IADsClass as IID_IADsClass, + IID_IADsCollection as IID_IADsCollection, + IID_IADsComputer as IID_IADsComputer, + IID_IADsComputerOperations as IID_IADsComputerOperations, + IID_IADsContainer as IID_IADsContainer, + IID_IADsDeleteOps as IID_IADsDeleteOps, + IID_IADsDomain as IID_IADsDomain, + IID_IADsFileService as IID_IADsFileService, + IID_IADsFileServiceOperations as IID_IADsFileServiceOperations, + IID_IADsFileShare as IID_IADsFileShare, + IID_IADsGroup as IID_IADsGroup, + IID_IADsLocality as IID_IADsLocality, + IID_IADsMembers as IID_IADsMembers, + IID_IADsNamespaces as IID_IADsNamespaces, + IID_IADsO as IID_IADsO, + IID_IADsOpenDSObject as IID_IADsOpenDSObject, + IID_IADsOU as IID_IADsOU, + IID_IADsPrintJob as IID_IADsPrintJob, + IID_IADsPrintJobOperations as IID_IADsPrintJobOperations, + IID_IADsPrintQueue as IID_IADsPrintQueue, + IID_IADsPrintQueueOperations as IID_IADsPrintQueueOperations, + IID_IADsProperty as IID_IADsProperty, + IID_IADsPropertyList as IID_IADsPropertyList, + IID_IADsResource as IID_IADsResource, + IID_IADsSearch as IID_IADsSearch, + IID_IADsService as IID_IADsService, + IID_IADsServiceOperations as IID_IADsServiceOperations, + IID_IADsSession as IID_IADsSession, + IID_IADsSyntax as IID_IADsSyntax, + IID_IADsUser as IID_IADsUser, + IID_IDirectoryObject as IID_IDirectoryObject, + IID_IDirectorySearch as IID_IDirectorySearch, + IID_IDsObjectPicker as IID_IDsObjectPicker, + LIBID_ADs as LIBID_ADs, + StringAsDS_SELECTION_LIST as StringAsDS_SELECTION_LIST, +) + +LCID: int +IDispatchType: Incomplete +IADsContainerType: Incomplete + +class ADSIEnumerator: + index: int + def __init__(self, ob) -> None: ... + def __getitem__(self, index): ... + def __call__(self, index): ... + +class ADSIDispatch(win32com.client.CDispatch): + def __getattr__(self, attr): ... + def QueryInterface(self, iid): ... + +# Redefinition making "iid" optional. +def ADsGetObject(path, iid: _win32typing.PyIID = ...): ... + +# Redefinition with flipped "reserved" and "iid" arguments. +def ADsOpenObject(path, username, password, reserved: int = ..., iid: _win32typing.PyIID = ...): ... diff --git a/stubs/pywin32/win32comext/adsi/adsi.pyi b/stubs/pywin32/win32comext/adsi/adsi.pyi new file mode 100644 index 0000000..4004c54 --- /dev/null +++ b/stubs/pywin32/win32comext/adsi/adsi.pyi @@ -0,0 +1,58 @@ +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +import _win32typing +from win32.lib.pywintypes import com_error + +error: TypeAlias = com_error # noqa: Y042 + +def ADsOpenObject(path, username, password, iid: _win32typing.PyIID, reserved: int = ...): ... +def ADsGetObject(path, iid: _win32typing.PyIID): ... +def ADsBuildEnumerator(container: _win32typing.PyIADsContainer): ... +def ADsEnumerateNext(enum, num: int = ...): ... +def ADsGetLastError() -> tuple[Incomplete, Incomplete, Incomplete]: ... +def StringAsDS_SELECTION_LIST(*args, **kwargs): ... # incomplete + +DSOP_SCOPE_INIT_INFOs = _win32typing.PyDSOP_SCOPE_INIT_INFOs +CLSID_ADsDSOObject: _win32typing.PyIID +CLSID_AccessControlEntry: _win32typing.PyIID +CLSID_AccessControlList: _win32typing.PyIID +CLSID_DsObjectPicker: _win32typing.PyIID +CLSID_SecurityDescriptor: _win32typing.PyIID +DBGUID_LDAPDialect: _win32typing.PyIID +DBPROPSET_ADSISEARCH: _win32typing.PyIID +IID_IADs: _win32typing.PyIID +IID_IADsClass: _win32typing.PyIID +IID_IADsCollection: _win32typing.PyIID +IID_IADsComputer: _win32typing.PyIID +IID_IADsComputerOperations: _win32typing.PyIID +IID_IADsContainer: _win32typing.PyIID +IID_IADsDeleteOps: _win32typing.PyIID +IID_IADsDomain: _win32typing.PyIID +IID_IADsFileService: _win32typing.PyIID +IID_IADsFileServiceOperations: _win32typing.PyIID +IID_IADsFileShare: _win32typing.PyIID +IID_IADsGroup: _win32typing.PyIID +IID_IADsLocality: _win32typing.PyIID +IID_IADsMembers: _win32typing.PyIID +IID_IADsNamespaces: _win32typing.PyIID +IID_IADsO: _win32typing.PyIID +IID_IADsOU: _win32typing.PyIID +IID_IADsOpenDSObject: _win32typing.PyIID +IID_IADsPrintJob: _win32typing.PyIID +IID_IADsPrintJobOperations: _win32typing.PyIID +IID_IADsPrintQueue: _win32typing.PyIID +IID_IADsPrintQueueOperations: _win32typing.PyIID +IID_IADsProperty: _win32typing.PyIID +IID_IADsPropertyList: _win32typing.PyIID +IID_IADsResource: _win32typing.PyIID +IID_IADsSearch: _win32typing.PyIID +IID_IADsService: _win32typing.PyIID +IID_IADsServiceOperations: _win32typing.PyIID +IID_IADsSession: _win32typing.PyIID +IID_IADsSyntax: _win32typing.PyIID +IID_IADsUser: _win32typing.PyIID +IID_IDirectoryObject: _win32typing.PyIID +IID_IDirectorySearch: _win32typing.PyIID +IID_IDsObjectPicker: _win32typing.PyIID +LIBID_ADs: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/adsi/adsicon.pyi b/stubs/pywin32/win32comext/adsi/adsicon.pyi new file mode 100644 index 0000000..f31229d --- /dev/null +++ b/stubs/pywin32/win32comext/adsi/adsicon.pyi @@ -0,0 +1,318 @@ +from _typeshed import Incomplete + +ADS_ATTR_CLEAR: int +ADS_ATTR_UPDATE: int +ADS_ATTR_APPEND: int +ADS_ATTR_DELETE: int +ADS_EXT_MINEXTDISPID: int +ADS_EXT_MAXEXTDISPID: int +ADS_EXT_INITCREDENTIALS: int +ADS_EXT_INITIALIZE_COMPLETE: int +ADS_SEARCHPREF_ASYNCHRONOUS: int +ADS_SEARCHPREF_DEREF_ALIASES: int +ADS_SEARCHPREF_SIZE_LIMIT: int +ADS_SEARCHPREF_TIME_LIMIT: int +ADS_SEARCHPREF_ATTRIBTYPES_ONLY: int +ADS_SEARCHPREF_SEARCH_SCOPE: int +ADS_SEARCHPREF_TIMEOUT: int +ADS_SEARCHPREF_PAGESIZE: int +ADS_SEARCHPREF_PAGED_TIME_LIMIT: int +ADS_SEARCHPREF_CHASE_REFERRALS: int +ADS_SEARCHPREF_SORT_ON: int +ADS_SEARCHPREF_CACHE_RESULTS: int +ADS_SEARCHPREF_DIRSYNC: int +ADS_SEARCHPREF_TOMBSTONE: int +ADS_SCOPE_BASE: int +ADS_SCOPE_ONELEVEL: int +ADS_SCOPE_SUBTREE: int +ADS_SECURE_AUTHENTICATION: int +ADS_USE_ENCRYPTION: int +ADS_USE_SSL: int +ADS_READONLY_SERVER: int +ADS_PROMPT_CREDENTIALS: int +ADS_NO_AUTHENTICATION: int +ADS_FAST_BIND: int +ADS_USE_SIGNING: int +ADS_USE_SEALING: int +ADS_USE_DELEGATION: int +ADS_SERVER_BIND: int +ADSTYPE_INVALID: int +ADSTYPE_DN_STRING: Incomplete +ADSTYPE_CASE_EXACT_STRING: Incomplete +ADSTYPE_CASE_IGNORE_STRING: Incomplete +ADSTYPE_PRINTABLE_STRING: Incomplete +ADSTYPE_NUMERIC_STRING: Incomplete +ADSTYPE_BOOLEAN: Incomplete +ADSTYPE_INTEGER: Incomplete +ADSTYPE_OCTET_STRING: Incomplete +ADSTYPE_UTC_TIME: Incomplete +ADSTYPE_LARGE_INTEGER: Incomplete +ADSTYPE_PROV_SPECIFIC: Incomplete +ADSTYPE_OBJECT_CLASS: Incomplete +ADSTYPE_CASEIGNORE_LIST: Incomplete +ADSTYPE_OCTET_LIST: Incomplete +ADSTYPE_PATH: Incomplete +ADSTYPE_POSTALADDRESS: Incomplete +ADSTYPE_TIMESTAMP: Incomplete +ADSTYPE_BACKLINK: Incomplete +ADSTYPE_TYPEDNAME: Incomplete +ADSTYPE_HOLD: Incomplete +ADSTYPE_NETADDRESS: Incomplete +ADSTYPE_REPLICAPOINTER: Incomplete +ADSTYPE_FAXNUMBER: Incomplete +ADSTYPE_EMAIL: Incomplete +ADSTYPE_NT_SECURITY_DESCRIPTOR: Incomplete +ADSTYPE_UNKNOWN: Incomplete +ADSTYPE_DN_WITH_BINARY: Incomplete +ADSTYPE_DN_WITH_STRING: Incomplete +ADS_PROPERTY_CLEAR: int +ADS_PROPERTY_UPDATE: int +ADS_PROPERTY_APPEND: int +ADS_PROPERTY_DELETE: int +ADS_SYSTEMFLAG_DISALLOW_DELETE: int +ADS_SYSTEMFLAG_CONFIG_ALLOW_RENAME: int +ADS_SYSTEMFLAG_CONFIG_ALLOW_MOVE: int +ADS_SYSTEMFLAG_CONFIG_ALLOW_LIMITED_MOVE: int +ADS_SYSTEMFLAG_DOMAIN_DISALLOW_RENAME: int +ADS_SYSTEMFLAG_DOMAIN_DISALLOW_MOVE: int +ADS_SYSTEMFLAG_CR_NTDS_NC: int +ADS_SYSTEMFLAG_CR_NTDS_DOMAIN: int +ADS_SYSTEMFLAG_ATTR_NOT_REPLICATED: int +ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED: int +ADS_GROUP_TYPE_GLOBAL_GROUP: int +ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP: int +ADS_GROUP_TYPE_LOCAL_GROUP: int +ADS_GROUP_TYPE_UNIVERSAL_GROUP: int +ADS_GROUP_TYPE_SECURITY_ENABLED: int +ADS_UF_SCRIPT: int +ADS_UF_ACCOUNTDISABLE: int +ADS_UF_HOMEDIR_REQUIRED: int +ADS_UF_LOCKOUT: int +ADS_UF_PASSWD_NOTREQD: int +ADS_UF_PASSWD_CANT_CHANGE: int +ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED: int +ADS_UF_TEMP_DUPLICATE_ACCOUNT: int +ADS_UF_NORMAL_ACCOUNT: int +ADS_UF_INTERDOMAIN_TRUST_ACCOUNT: int +ADS_UF_WORKSTATION_TRUST_ACCOUNT: int +ADS_UF_SERVER_TRUST_ACCOUNT: int +ADS_UF_DONT_EXPIRE_PASSWD: int +ADS_UF_MNS_LOGON_ACCOUNT: int +ADS_UF_SMARTCARD_REQUIRED: int +ADS_UF_TRUSTED_FOR_DELEGATION: int +ADS_UF_NOT_DELEGATED: int +ADS_UF_USE_DES_KEY_ONLY: int +ADS_UF_DONT_REQUIRE_PREAUTH: int +ADS_UF_PASSWORD_EXPIRED: int +ADS_UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: int +ADS_RIGHT_DELETE: int +ADS_RIGHT_READ_CONTROL: int +ADS_RIGHT_WRITE_DAC: int +ADS_RIGHT_WRITE_OWNER: int +ADS_RIGHT_SYNCHRONIZE: int +ADS_RIGHT_ACCESS_SYSTEM_SECURITY: int +ADS_RIGHT_GENERIC_READ: int +ADS_RIGHT_GENERIC_WRITE: int +ADS_RIGHT_GENERIC_EXECUTE: int +ADS_RIGHT_GENERIC_ALL: int +ADS_RIGHT_DS_CREATE_CHILD: int +ADS_RIGHT_DS_DELETE_CHILD: int +ADS_RIGHT_ACTRL_DS_LIST: int +ADS_RIGHT_DS_SELF: int +ADS_RIGHT_DS_READ_PROP: int +ADS_RIGHT_DS_WRITE_PROP: int +ADS_RIGHT_DS_DELETE_TREE: int +ADS_RIGHT_DS_LIST_OBJECT: int +ADS_RIGHT_DS_CONTROL_ACCESS: int +ADS_ACETYPE_ACCESS_ALLOWED: int +ADS_ACETYPE_ACCESS_DENIED: int +ADS_ACETYPE_SYSTEM_AUDIT: int +ADS_ACETYPE_ACCESS_ALLOWED_OBJECT: int +ADS_ACETYPE_ACCESS_DENIED_OBJECT: int +ADS_ACETYPE_SYSTEM_AUDIT_OBJECT: int +ADS_ACETYPE_SYSTEM_ALARM_OBJECT: int +ADS_ACETYPE_ACCESS_ALLOWED_CALLBACK: int +ADS_ACETYPE_ACCESS_DENIED_CALLBACK: int +ADS_ACETYPE_ACCESS_ALLOWED_CALLBACK_OBJECT: int +ADS_ACETYPE_ACCESS_DENIED_CALLBACK_OBJECT: int +ADS_ACETYPE_SYSTEM_AUDIT_CALLBACK: int +ADS_ACETYPE_SYSTEM_ALARM_CALLBACK: int +ADS_ACETYPE_SYSTEM_AUDIT_CALLBACK_OBJECT: int +ADS_ACETYPE_SYSTEM_ALARM_CALLBACK_OBJECT: int +ADS_ACEFLAG_INHERIT_ACE: int +ADS_ACEFLAG_NO_PROPAGATE_INHERIT_ACE: int +ADS_ACEFLAG_INHERIT_ONLY_ACE: int +ADS_ACEFLAG_INHERITED_ACE: int +ADS_ACEFLAG_VALID_INHERIT_FLAGS: int +ADS_ACEFLAG_SUCCESSFUL_ACCESS: int +ADS_ACEFLAG_FAILED_ACCESS: int +ADS_FLAG_OBJECT_TYPE_PRESENT: int +ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT: int +ADS_SD_CONTROL_SE_OWNER_DEFAULTED: int +ADS_SD_CONTROL_SE_GROUP_DEFAULTED: int +ADS_SD_CONTROL_SE_DACL_PRESENT: int +ADS_SD_CONTROL_SE_DACL_DEFAULTED: int +ADS_SD_CONTROL_SE_SACL_PRESENT: int +ADS_SD_CONTROL_SE_SACL_DEFAULTED: int +ADS_SD_CONTROL_SE_DACL_AUTO_INHERIT_REQ: int +ADS_SD_CONTROL_SE_SACL_AUTO_INHERIT_REQ: int +ADS_SD_CONTROL_SE_DACL_AUTO_INHERITED: int +ADS_SD_CONTROL_SE_SACL_AUTO_INHERITED: int +ADS_SD_CONTROL_SE_DACL_PROTECTED: int +ADS_SD_CONTROL_SE_SACL_PROTECTED: int +ADS_SD_CONTROL_SE_SELF_RELATIVE: int +ADS_SD_REVISION_DS: int +ADS_NAME_TYPE_1779: int +ADS_NAME_TYPE_CANONICAL: int +ADS_NAME_TYPE_NT4: int +ADS_NAME_TYPE_DISPLAY: int +ADS_NAME_TYPE_DOMAIN_SIMPLE: int +ADS_NAME_TYPE_ENTERPRISE_SIMPLE: int +ADS_NAME_TYPE_GUID: int +ADS_NAME_TYPE_UNKNOWN: int +ADS_NAME_TYPE_USER_PRINCIPAL_NAME: int +ADS_NAME_TYPE_CANONICAL_EX: int +ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME: int +ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME: int +ADS_NAME_INITTYPE_DOMAIN: int +ADS_NAME_INITTYPE_SERVER: int +ADS_NAME_INITTYPE_GC: int +ADS_OPTION_SERVERNAME: int +ADS_OPTION_REFERRALS: Incomplete +ADS_OPTION_PAGE_SIZE: Incomplete +ADS_OPTION_SECURITY_MASK: Incomplete +ADS_OPTION_MUTUAL_AUTH_STATUS: Incomplete +ADS_OPTION_QUOTA: Incomplete +ADS_OPTION_PASSWORD_PORTNUMBER: Incomplete +ADS_OPTION_PASSWORD_METHOD: Incomplete +ADS_SECURITY_INFO_OWNER: int +ADS_SECURITY_INFO_GROUP: int +ADS_SECURITY_INFO_DACL: int +ADS_SECURITY_INFO_SACL: int +ADS_SETTYPE_FULL: int +ADS_SETTYPE_PROVIDER: int +ADS_SETTYPE_SERVER: int +ADS_SETTYPE_DN: int +ADS_FORMAT_WINDOWS: int +ADS_FORMAT_WINDOWS_NO_SERVER: int +ADS_FORMAT_WINDOWS_DN: int +ADS_FORMAT_WINDOWS_PARENT: int +ADS_FORMAT_X500: int +ADS_FORMAT_X500_NO_SERVER: int +ADS_FORMAT_X500_DN: int +ADS_FORMAT_X500_PARENT: int +ADS_FORMAT_SERVER: int +ADS_FORMAT_PROVIDER: int +ADS_FORMAT_LEAF: int +ADS_DISPLAY_FULL: int +ADS_DISPLAY_VALUE_ONLY: int +ADS_ESCAPEDMODE_DEFAULT: int +ADS_ESCAPEDMODE_ON: int +ADS_ESCAPEDMODE_OFF: int +ADS_ESCAPEDMODE_OFF_EX: int +ADS_PATH_FILE: int +ADS_PATH_FILESHARE: int +ADS_PATH_REGISTRY: int +ADS_SD_FORMAT_IID: int +ADS_SD_FORMAT_RAW: int +ADS_SD_FORMAT_HEXSTRING: int +E_ADS_BAD_PATHNAME: Incomplete +E_ADS_INVALID_DOMAIN_OBJECT: Incomplete +E_ADS_INVALID_USER_OBJECT: Incomplete +E_ADS_INVALID_COMPUTER_OBJECT: Incomplete +E_ADS_UNKNOWN_OBJECT: Incomplete +E_ADS_PROPERTY_NOT_SET: Incomplete +E_ADS_PROPERTY_NOT_SUPPORTED: Incomplete +E_ADS_PROPERTY_INVALID: Incomplete +E_ADS_BAD_PARAMETER: Incomplete +E_ADS_OBJECT_UNBOUND: Incomplete +E_ADS_PROPERTY_NOT_MODIFIED: Incomplete +E_ADS_PROPERTY_MODIFIED: Incomplete +E_ADS_CANT_CONVERT_DATATYPE: Incomplete +E_ADS_PROPERTY_NOT_FOUND: Incomplete +E_ADS_OBJECT_EXISTS: Incomplete +E_ADS_SCHEMA_VIOLATION: Incomplete +E_ADS_COLUMN_NOT_SET: Incomplete +S_ADS_ERRORSOCCURRED: Incomplete +S_ADS_NOMORE_ROWS: Incomplete +S_ADS_NOMORE_COLUMNS: Incomplete +E_ADS_INVALID_FILTER: Incomplete +ADS_DEREF_NEVER: int +ADS_DEREF_SEARCHING: int +ADS_DEREF_FINDING: int +ADS_DEREF_ALWAYS: int +ADSIPROP_ASYNCHRONOUS: int +ADSIPROP_DEREF_ALIASES: int +ADSIPROP_SIZE_LIMIT: int +ADSIPROP_TIME_LIMIT: int +ADSIPROP_ATTRIBTYPES_ONLY: int +ADSIPROP_SEARCH_SCOPE: int +ADSIPROP_TIMEOUT: int +ADSIPROP_PAGESIZE: int +ADSIPROP_PAGED_TIME_LIMIT: int +ADSIPROP_CHASE_REFERRALS: int +ADSIPROP_SORT_ON: int +ADSIPROP_CACHE_RESULTS: int +ADSIPROP_ADSIFLAG: int +ADSI_DIALECT_LDAP: int +ADSI_DIALECT_SQL: int +ADS_CHASE_REFERRALS_NEVER: int +ADS_CHASE_REFERRALS_SUBORDINATE: int +ADS_CHASE_REFERRALS_EXTERNAL: int +ADS_CHASE_REFERRALS_ALWAYS: Incomplete +DSOP_SCOPE_TYPE_TARGET_COMPUTER: int +DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN: int +DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN: int +DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN: int +DSOP_SCOPE_TYPE_GLOBAL_CATALOG: int +DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN: int +DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN: int +DSOP_SCOPE_TYPE_WORKGROUP: int +DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE: int +DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE: int +DSOP_SCOPE_FLAG_STARTING_SCOPE: int +DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT: int +DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP: int +DSOP_SCOPE_FLAG_WANT_PROVIDER_GC: int +DSOP_SCOPE_FLAG_WANT_SID_PATH: int +DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH: int +DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS: int +DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS: int +DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS: int +DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS: int +DSOP_FILTER_INCLUDE_ADVANCED_VIEW: int +DSOP_FILTER_USERS: int +DSOP_FILTER_BUILTIN_GROUPS: int +DSOP_FILTER_WELL_KNOWN_PRINCIPALS: int +DSOP_FILTER_UNIVERSAL_GROUPS_DL: int +DSOP_FILTER_UNIVERSAL_GROUPS_SE: int +DSOP_FILTER_GLOBAL_GROUPS_DL: int +DSOP_FILTER_GLOBAL_GROUPS_SE: int +DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL: int +DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE: int +DSOP_FILTER_CONTACTS: int +DSOP_FILTER_COMPUTERS: int +DSOP_DOWNLEVEL_FILTER_USERS: int +DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS: int +DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS: int +DSOP_DOWNLEVEL_FILTER_COMPUTERS: int +DSOP_DOWNLEVEL_FILTER_WORLD: int +DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER: int +DSOP_DOWNLEVEL_FILTER_ANONYMOUS: int +DSOP_DOWNLEVEL_FILTER_BATCH: int +DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER: int +DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP: int +DSOP_DOWNLEVEL_FILTER_DIALUP: int +DSOP_DOWNLEVEL_FILTER_INTERACTIVE: int +DSOP_DOWNLEVEL_FILTER_NETWORK: int +DSOP_DOWNLEVEL_FILTER_SERVICE: int +DSOP_DOWNLEVEL_FILTER_SYSTEM: int +DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS: int +DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER: int +DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS: int +DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE: int +DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE: int +DSOP_DOWNLEVEL_FILTER_REMOTE_LOGON: int +DSOP_FLAG_MULTISELECT: int +DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK: int +CFSTR_DSOP_DS_SELECTION_LIST: str diff --git a/tests/mypy_exclude_list.txt b/stubs/pywin32/win32comext/authorization/__init__.pyi similarity index 100% rename from tests/mypy_exclude_list.txt rename to stubs/pywin32/win32comext/authorization/__init__.pyi diff --git a/stubs/pywin32/win32comext/authorization/authorization.pyi b/stubs/pywin32/win32comext/authorization/authorization.pyi new file mode 100644 index 0000000..0a98818 --- /dev/null +++ b/stubs/pywin32/win32comext/authorization/authorization.pyi @@ -0,0 +1,5 @@ +import _win32typing + +def EditSecurity(*args, **kwargs): ... # incomplete + +IID_ISecurityInformation: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/axcontrol/__init__.pyi b/stubs/pywin32/win32comext/axcontrol/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/axcontrol/axcontrol.pyi b/stubs/pywin32/win32comext/axcontrol/axcontrol.pyi new file mode 100644 index 0000000..c4f346b --- /dev/null +++ b/stubs/pywin32/win32comext/axcontrol/axcontrol.pyi @@ -0,0 +1,60 @@ +import _win32typing + +def OleCreate( + clsid, + clsid1, + obCLSID: _win32typing.PyIID, + obIID: _win32typing.PyIID, + renderopt, + obFormatEtc, + obOleClientSite: _win32typing.PyIOleClientSite, + obStorage: _win32typing.PyIStorage, +) -> _win32typing.PyIOleObject: ... +def OleLoadPicture( + stream: _win32typing.PyIStream, size, runMode, arg: _win32typing.PyIID, arg1: _win32typing.PyIID +) -> _win32typing.PyIUnknown: ... +def OleLoadPicturePath( + url_or_path: str, unk, reserved, clr, arg: _win32typing.PyIID, arg1: _win32typing.PyIID +) -> _win32typing.PyIUnknown: ... +def OleSetContainedObject(unk: _win32typing.PyIUnknown, fContained) -> None: ... +def OleTranslateAccelerator(frame: _win32typing.PyIOleInPlaceFrame, frame_info, msg: _win32typing.PyMSG) -> None: ... + +EMBDHLP_CREATENOW: int +EMBDHLP_DELAYCREATE: int +EMBDHLP_INPROC_HANDLER: int +EMBDHLP_INPROC_SERVER: int +OLECLOSE_NOSAVE: int +OLECLOSE_PROMPTSAVE: int +OLECLOSE_SAVEIFDIRTY: int +OLECMDF_ENABLED: int +OLECMDF_LATCHED: int +OLECMDF_NINCHED: int +OLECMDF_SUPPORTED: int +OLECMDTEXTF_NAME: int +OLECMDTEXTF_NONE: int +OLECMDTEXTF_STATUS: int +OLECREATE_LEAVERUNNING: int +OLEIVERB_DISCARDUNDOSTATE: int +OLEIVERB_HIDE: int +OLEIVERB_INPLACEACTIVATE: int +OLEIVERB_OPEN: int +OLEIVERB_PRIMARY: int +OLEIVERB_SHOW: int +OLEIVERB_UIACTIVATE: int +IID_IObjectWithSite: _win32typing.PyIID +IID_IOleClientSite: _win32typing.PyIID +IID_IOleCommandTarget: _win32typing.PyIID +IID_IOleControl: _win32typing.PyIID +IID_IOleControlSite: _win32typing.PyIID +IID_IOleInPlaceActiveObject: _win32typing.PyIID +IID_IOleInPlaceFrame: _win32typing.PyIID +IID_IOleInPlaceObject: _win32typing.PyIID +IID_IOleInPlaceSite: _win32typing.PyIID +IID_IOleInPlaceSiteEx: _win32typing.PyIID +IID_IOleInPlaceSiteWindowless: _win32typing.PyIID +IID_IOleInPlaceUIWindow: _win32typing.PyIID +IID_IOleLink: _win32typing.PyIID +IID_IOleObject: _win32typing.PyIID +IID_ISpecifyPropertyPages: _win32typing.PyIID +IID_IViewObject: _win32typing.PyIID +IID_IViewObject2: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/axdebug/__init__.pyi b/stubs/pywin32/win32comext/axdebug/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/axdebug/adb.pyi b/stubs/pywin32/win32comext/axdebug/adb.pyi new file mode 100644 index 0000000..6f3ab4f --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/adb.pyi @@ -0,0 +1,71 @@ +import bdb +from _typeshed import Incomplete + +from win32com.axdebug.util import trace +from win32com.server.util import unwrap as unwrap +from win32comext.axdebug import gateways as gateways + +def fnull(*args) -> None: ... + +debugging: int +traceenter = fnull +tracev = fnull +traceenter = trace +tracev = trace + +class OutputReflector: + writefunc: Incomplete + file: Incomplete + def __init__(self, file, writefunc) -> None: ... + def __getattr__(self, name): ... + def write(self, message) -> None: ... + +g_adb: Incomplete + +def OnSetBreakPoint(codeContext, breakPointState, lineNo) -> None: ... + +class Adb(bdb.Bdb, gateways.RemoteDebugApplicationEvents): + debugApplication: Incomplete + debuggingThread: Incomplete + debuggingThreadStateHandle: Incomplete + stackSnifferCookie: Incomplete + codeContainerProvider: Incomplete + breakFlags: Incomplete + breakReason: Incomplete + appDebugger: Incomplete + appEventConnection: Incomplete + logicalbotframe: Incomplete + currentframe: Incomplete + recursiveData: Incomplete + def canonic(self, fname): ... + def reset(self) -> None: ... + def stop_here(self, frame): ... + def break_here(self, frame): ... + def break_anywhere(self, frame): ... + def dispatch_return(self, frame, arg): ... + def dispatch_line(self, frame): ... + def dispatch_call(self, frame, arg): ... + def trace_dispatch(self, frame, event, arg): ... + def user_line(self, frame) -> None: ... + def user_return(self, frame, return_value) -> None: ... + def user_exception(self, frame, exc_info) -> None: ... + def set_trace(self) -> None: ... # type: ignore[override] + def CloseApp(self) -> None: ... + stackSniffer: Incomplete + def AttachApp(self, debugApplication, codeContainerProvider) -> None: ... + def ResetAXDebugging(self) -> None: ... + botframe: Incomplete + stopframe: Incomplete + def SetupAXDebugging(self, baseFrame: Incomplete | None = ..., userFrame: Incomplete | None = ...) -> None: ... + def OnConnectDebugger(self, appDebugger): ... + def OnDisconnectDebugger(self) -> None: ... + def OnSetName(self, name) -> None: ... + def OnDebugOutput(self, string) -> None: ... + def OnClose(self) -> None: ... + def OnEnterBreakPoint(self, rdat) -> None: ... + def OnLeaveBreakPoint(self, rdat) -> None: ... + def OnCreateThread(self, rdat) -> None: ... + def OnDestroyThread(self, rdat) -> None: ... + def OnBreakFlagChange(self, abf, rdat) -> None: ... + +def Debugger(): ... diff --git a/stubs/pywin32/win32comext/axdebug/axdebug.pyi b/stubs/pywin32/win32comext/axdebug/axdebug.pyi new file mode 100644 index 0000000..2ecd306 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/axdebug.pyi @@ -0,0 +1,124 @@ +# Can't generate with stubgen because: +# "ImportError: DLL load failed while importing axdebug: The specified module could not be found." +# https://github.com/python/mypy/issues/13822 +import _win32typing + +APPBREAKFLAG_DEBUGGER_BLOCK: int +APPBREAKFLAG_DEBUGGER_HALT: int +APPBREAKFLAG_STEP: int +BREAKPOINT_DELETED: int +BREAKPOINT_DISABLED: int +BREAKPOINT_ENABLED: int +BREAKREASON_BREAKPOINT: int +BREAKREASON_DEBUGGER_BLOCK: int +BREAKREASON_DEBUGGER_HALT: int +BREAKREASON_ERROR: int +BREAKREASON_HOST_INITIATED: int +BREAKREASON_LANGUAGE_INITIATED: int +BREAKREASON_STEP: int +BREAKRESUMEACTION_ABORT: int +BREAKRESUMEACTION_CONTINUE: int +BREAKRESUMEACTION_STEP_INTO: int +BREAKRESUMEACTION_STEP_OUT: int +BREAKRESUMEACTION_STEP_OVER: int +CLSID_DefaultDebugSessionProvider: int +CLSID_MachineDebugManager: int +CLSID_ProcessDebugManager: int +DBGPROP_ATTRIB_ACCESS_FINAL: int +DBGPROP_ATTRIB_ACCESS_PRIVATE: int +DBGPROP_ATTRIB_ACCESS_PROTECTED: int +DBGPROP_ATTRIB_ACCESS_PUBLIC: int +DBGPROP_ATTRIB_HAS_EXTENDED_ATTRIBS: int +DBGPROP_ATTRIB_NO_ATTRIB: int +DBGPROP_ATTRIB_STORAGE_FIELD: int +DBGPROP_ATTRIB_STORAGE_GLOBAL: int +DBGPROP_ATTRIB_STORAGE_STATIC: int +DBGPROP_ATTRIB_STORAGE_VIRTUAL: int +DBGPROP_ATTRIB_TYPE_IS_CONSTANT: int +DBGPROP_ATTRIB_TYPE_IS_SYNCHRONIZED: int +DBGPROP_ATTRIB_TYPE_IS_VOLATILE: int +DBGPROP_ATTRIB_VALUE_IS_EXPANDABLE: int +DBGPROP_ATTRIB_VALUE_IS_INVALID: int +DBGPROP_ATTRIB_VALUE_READONLY: int +DBGPROP_INFO_ATTRIBUTES: int +DBGPROP_INFO_AUTOEXPAND: int +DBGPROP_INFO_DEBUGPROP: int +DBGPROP_INFO_FULLNAME: int +DBGPROP_INFO_NAME: int +DBGPROP_INFO_TYPE: int +DBGPROP_INFO_VALUE: int +DEBUG_TEXT_ALLOWBREAKPOINTS: int +DEBUG_TEXT_ISEXPRESSION: int +DOCUMENTNAMETYPE_APPNODE: int +DOCUMENTNAMETYPE_FILE_TAIL: int +DOCUMENTNAMETYPE_TITLE: int +DOCUMENTNAMETYPE_URL: int +ERRORRESUMEACTION_AbortCallAndReturnErrorToCaller: int +ERRORRESUMEACTION_ReexecuteErrorStatement: int +ERRORRESUMEACTION_SkipErrorStatement: int +EX_DBGPROP_INFO_DEBUGEXTPROP: int +EX_DBGPROP_INFO_ID: int +EX_DBGPROP_INFO_LOCKBYTES: int +EX_DBGPROP_INFO_NTYPE: int +EX_DBGPROP_INFO_NVALUE: int +SOURCETEXT_ATTR_COMMENT: int +SOURCETEXT_ATTR_FUNCTION_START: int +SOURCETEXT_ATTR_KEYWORD: int +SOURCETEXT_ATTR_NONSOURCE: int +SOURCETEXT_ATTR_NUMBER: int +SOURCETEXT_ATTR_OPERATOR: int +SOURCETEXT_ATTR_STRING: int +TEXT_DOC_ATTR_READONLY: int +APPBREAKFLAG_IN_BREAKPOINT: int +APPBREAKFLAG_STEPTYPE_BYTECODE: int +APPBREAKFLAG_STEPTYPE_MACHINE: int +APPBREAKFLAG_STEPTYPE_MASK: int +APPBREAKFLAG_STEPTYPE_SOURCE: int + +def GetStackAddress(*args, **kwargs): ... # incomplete +def GetThreadStateHandle(*args, **kwargs): ... # incomplete + +IID_IActiveScriptDebug: _win32typing.PyIID +IID_IActiveScriptErrorDebug: _win32typing.PyIID +IID_IActiveScriptSiteDebug: _win32typing.PyIID +IID_IApplicationDebugger: _win32typing.PyIID +IID_IDebugApplication: _win32typing.PyIID +IID_IDebugApplicationNode: _win32typing.PyIID +IID_IDebugApplicationNodeEvents: _win32typing.PyIID +IID_IDebugApplicationThread: _win32typing.PyIID +IID_IDebugCodeContext: _win32typing.PyIID +IID_IDebugDocument: _win32typing.PyIID +IID_IDebugDocumentContext: _win32typing.PyIID +IID_IDebugDocumentHelper: _win32typing.PyIID +IID_IDebugDocumentHost: _win32typing.PyIID +IID_IDebugDocumentInfo: _win32typing.PyIID +IID_IDebugDocumentProvider: _win32typing.PyIID +IID_IDebugDocumentText: _win32typing.PyIID +IID_IDebugDocumentTextAuthor: _win32typing.PyIID +IID_IDebugDocumentTextEvents: _win32typing.PyIID +IID_IDebugDocumentTextExternalAuthor: _win32typing.PyIID +IID_IDebugExpression: _win32typing.PyIID +IID_IDebugExpressionCallBack: _win32typing.PyIID +IID_IDebugExpressionContext: _win32typing.PyIID +IID_IDebugProperty: _win32typing.PyIID +IID_IDebugSessionProvider: _win32typing.PyIID +IID_IDebugStackFrame: _win32typing.PyIID +IID_IDebugStackFrameSniffer: _win32typing.PyIID +IID_IDebugStackFrameSnifferEx: _win32typing.PyIID +IID_IDebugSyncOperation: _win32typing.PyIID +IID_IEnumDebugApplicationNodes: _win32typing.PyIID +IID_IEnumDebugCodeContexts: _win32typing.PyIID +IID_IEnumDebugExpressionContexts: _win32typing.PyIID +IID_IEnumDebugPropertyInfo: _win32typing.PyIID +IID_IEnumDebugStackFrames: _win32typing.PyIID +IID_IEnumRemoteDebugApplicationThreads: _win32typing.PyIID +IID_IEnumRemoteDebugApplications: _win32typing.PyIID +IID_IMachineDebugManager: _win32typing.PyIID +IID_IMachineDebugManagerEvents: _win32typing.PyIID +IID_IProcessDebugManager: _win32typing.PyIID +IID_IProvideExpressionContexts: _win32typing.PyIID +IID_IRemoteDebugApplication: _win32typing.PyIID +IID_IRemoteDebugApplicationEvents: _win32typing.PyIID +IID_IRemoteDebugApplicationThread: _win32typing.PyIID + +def SetThreadStateTrace(*args, **kwargs): ... # incomplete diff --git a/stubs/pywin32/win32comext/axdebug/codecontainer.pyi b/stubs/pywin32/win32comext/axdebug/codecontainer.pyi new file mode 100644 index 0000000..e42c470 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/codecontainer.pyi @@ -0,0 +1,43 @@ +from _typeshed import Incomplete + +from win32comext.axdebug import contexts as contexts +from win32comext.axdebug.util import RaiseNotImpl as RaiseNotImpl + +class SourceCodeContainer: + sourceContext: Incomplete + text: Incomplete + nextLineNo: int + fileName: Incomplete + codeContexts: Incomplete + site: Incomplete + startLineNumber: Incomplete + debugDocument: Incomplete + def __init__( + self, + text, + fileName: str = ..., + sourceContext: int = ..., + startLineNumber: int = ..., + site: Incomplete | None = ..., + debugDocument: Incomplete | None = ..., + ) -> None: ... + def GetText(self): ... + def GetName(self, dnt) -> None: ... + def GetFileName(self): ... + def GetPositionOfLine(self, cLineNumber): ... + def GetLineOfPosition(self, charPos): ... + def GetNextLine(self): ... + def GetLine(self, num): ... + def GetNumChars(self): ... + def GetNumLines(self): ... + lastPos: int + attrs: Incomplete + def GetSyntaxColorAttributes(self): ... + def GetCodeContextAtPosition(self, charPos): ... + +class SourceModuleContainer(SourceCodeContainer): + module: Incomplete + def __init__(self, module) -> None: ... + text: Incomplete + def GetText(self): ... + def GetName(self, dnt): ... diff --git a/stubs/pywin32/win32comext/axdebug/contexts.pyi b/stubs/pywin32/win32comext/axdebug/contexts.pyi new file mode 100644 index 0000000..4561b45 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/contexts.pyi @@ -0,0 +1,19 @@ +from _typeshed import Incomplete + +from win32comext.axdebug import adb as adb, gateways +from win32comext.axdebug.util import trace as trace + +class DebugCodeContext(gateways.DebugCodeContext, gateways.DebugDocumentContext): + debugSite: Incomplete + offset: Incomplete + length: Incomplete + breakPointState: int + lineno: Incomplete + codeContainer: Incomplete + def __init__(self, lineNo, charPos, len, codeContainer, debugSite) -> None: ... + def GetDocumentContext(self): ... + def SetBreakPoint(self, bps) -> None: ... + def GetDocument(self): ... + def EnumCodeContexts(self): ... + +class EnumDebugCodeContexts(gateways.EnumDebugCodeContexts): ... diff --git a/stubs/pywin32/win32comext/axdebug/debugger.pyi b/stubs/pywin32/win32comext/axdebug/debugger.pyi new file mode 100644 index 0000000..f8d294b --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/debugger.pyi @@ -0,0 +1,58 @@ +from _typeshed import Incomplete + +from win32com.axdebug import contexts as contexts, documents, gateways as gateways +from win32com.axdebug.util import trace as trace +from win32com.axscript import axscript as axscript + +currentDebugger: Incomplete + +class ModuleTreeNode: + moduleName: Incomplete + module: Incomplete + realNode: Incomplete + cont: Incomplete + def __init__(self, module) -> None: ... + def Attach(self, parentRealNode) -> None: ... + def Close(self) -> None: ... + +def BuildModule(module, built_nodes, rootNode, create_node_fn, create_node_args) -> None: ... +def RefreshAllModules(builtItems, rootNode, create_node, create_node_args) -> None: ... + +class CodeContainerProvider(documents.CodeContainerProvider): + axdebugger: Incomplete + currentNumModules: Incomplete + nodes: Incomplete + def __init__(self, axdebugger) -> None: ... + def FromFileName(self, fname): ... + def Close(self) -> None: ... + +class OriginalInterfaceMaker: + cookie: Incomplete + def MakeInterfaces(self, pdm): ... + def CloseInterfaces(self, pdm) -> None: ... + +class SimpleHostStyleInterfaceMaker: + def MakeInterfaces(self, pdm): ... + def CloseInterfaces(self, pdm) -> None: ... + +class AXDebugger: + pydebugger: Incomplete + pdm: Incomplete + interfaceMaker: Incomplete + expressionCookie: Incomplete + def __init__(self, interfaceMaker: Incomplete | None = ..., processName: Incomplete | None = ...) -> None: ... + def Break(self) -> None: ... + app: Incomplete + root: Incomplete + def Close(self) -> None: ... + def RefreshAllModules(self, nodes, containerProvider) -> None: ... + def CreateApplicationNode(self, node, containerProvider): ... + +def Break() -> None: ... + +brk = Break +set_trace = Break + +def dosomethingelse() -> None: ... +def dosomething() -> None: ... +def test() -> None: ... diff --git a/stubs/pywin32/win32comext/axdebug/documents.pyi b/stubs/pywin32/win32comext/axdebug/documents.pyi new file mode 100644 index 0000000..4fe834a --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/documents.pyi @@ -0,0 +1,33 @@ +from _typeshed import Incomplete + +from win32com.server.exception import Exception as Exception +from win32comext.axdebug import codecontainer as codecontainer, contexts as contexts, gateways +from win32comext.axdebug.util import RaiseNotImpl as RaiseNotImpl, trace as trace + +def GetGoodFileName(fname): ... + +class DebugDocumentProvider(gateways.DebugDocumentProvider): + doc: Incomplete + def __init__(self, doc) -> None: ... + def GetName(self, dnt): ... + def GetDocumentClassId(self): ... + def GetDocument(self): ... + +# error: Cannot determine consistent method resolution order (MRO) for "DebugDocumentText" +class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc] + codeContainer: Incomplete + def __init__(self, codeContainer) -> None: ... + def GetName(self, dnt): ... + def GetDocumentClassId(self): ... + def GetSize(self): ... + def GetPositionOfLine(self, cLineNumber): ... + def GetLineOfPosition(self, charPos): ... + def GetText(self, charPos, maxChars, wantAttr): ... + def GetPositionOfContext(self, context): ... + def GetContextOfPosition(self, charPos, maxChars): ... + +class CodeContainerProvider: + ccsAndNodes: Incomplete + def AddCodeContainer(self, cc, node: Incomplete | None = ...) -> None: ... + def FromFileName(self, fname): ... + def Close(self) -> None: ... diff --git a/stubs/pywin32/win32comext/axdebug/expressions.pyi b/stubs/pywin32/win32comext/axdebug/expressions.pyi new file mode 100644 index 0000000..fac9280 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/expressions.pyi @@ -0,0 +1,69 @@ +from _typeshed import Incomplete + +from win32com.server.exception import COMException as COMException +from win32com.server.util import ListEnumeratorGateway +from win32comext.axdebug import gateways +from win32comext.axdebug.util import RaiseNotImpl as RaiseNotImpl + +def MakeNiceString(ob): ... + +class ProvideExpressionContexts(gateways.ProvideExpressionContexts): ... + +class ExpressionContext(gateways.DebugExpressionContext): + frame: Incomplete + def __init__(self, frame) -> None: ... + def ParseLanguageText(self, code, radix, delim, flags): ... + def GetLanguageInfo(self): ... + +class Expression(gateways.DebugExpression): + callback: Incomplete + frame: Incomplete + code: Incomplete + radix: Incomplete + delim: Incomplete + flags: Incomplete + isComplete: int + result: Incomplete + hresult: Incomplete + def __init__(self, frame, code, radix, delim, flags) -> None: ... + def Start(self, callback): ... + def Abort(self) -> None: ... + def QueryIsComplete(self): ... + def GetResultAsString(self): ... + def GetResultAsDebugProperty(self): ... + +def MakeEnumDebugProperty(object, dwFieldSpec, nRadix, iid, stackFrame: Incomplete | None = ...): ... +def GetPropertyInfo( + obname, + obvalue, + dwFieldSpec, + nRadix, + hresult: int = ..., + dictionary: Incomplete | None = ..., + stackFrame: Incomplete | None = ..., +): ... + +class EnumDebugPropertyInfo(ListEnumeratorGateway): + def GetCount(self): ... + +class DebugProperty: + name: Incomplete + value: Incomplete + parent: Incomplete + hresult: Incomplete + dictionary: Incomplete + stackFrame: Incomplete + def __init__( + self, + name, + value, + parent: Incomplete | None = ..., + hresult: int = ..., + dictionary: Incomplete | None = ..., + stackFrame: Incomplete | None = ..., + ) -> None: ... + def GetPropertyInfo(self, dwFieldSpec, nRadix): ... + def GetExtendedInfo(self) -> None: ... + def SetValueAsString(self, value, radix) -> None: ... + def EnumMembers(self, dwFieldSpec, nRadix, iid): ... + def GetParent(self) -> None: ... diff --git a/stubs/pywin32/win32comext/axdebug/gateways.pyi b/stubs/pywin32/win32comext/axdebug/gateways.pyi new file mode 100644 index 0000000..8ed3bb3 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/gateways.pyi @@ -0,0 +1,114 @@ +from _typeshed import Incomplete + +from win32com.server.util import ListEnumeratorGateway + +class EnumDebugCodeContexts(ListEnumeratorGateway): ... +class EnumDebugStackFrames(ListEnumeratorGateway): ... +class EnumDebugApplicationNodes(ListEnumeratorGateway): ... +class EnumRemoteDebugApplications(ListEnumeratorGateway): ... +class EnumRemoteDebugApplicationThreads(ListEnumeratorGateway): ... + +class DebugDocumentInfo: + def GetName(self, dnt) -> None: ... + def GetDocumentClassId(self) -> None: ... + +class DebugDocumentProvider(DebugDocumentInfo): + def GetDocument(self) -> None: ... + +class DebugApplicationNode(DebugDocumentProvider): + def EnumChildren(self) -> None: ... + def GetParent(self) -> None: ... + def SetDocumentProvider(self, pddp) -> None: ... + def Close(self) -> None: ... + def Attach(self, parent) -> None: ... + def Detach(self) -> None: ... + +class DebugApplicationNodeEvents: + def onAddChild(self, child) -> None: ... + def onRemoveChild(self, child) -> None: ... + def onDetach(self) -> None: ... + def onAttach(self, parent) -> None: ... + +class DebugDocument(DebugDocumentInfo): ... + +class DebugDocumentText(DebugDocument): + def GetDocumentAttributes(self) -> None: ... + def GetSize(self) -> None: ... + def GetPositionOfLine(self, cLineNumber) -> None: ... + def GetLineOfPosition(self, charPos) -> None: ... + def GetText(self, charPos, maxChars, wantAttr) -> None: ... + def GetPositionOfContext(self, debugDocumentContext) -> None: ... + def GetContextOfPosition(self, charPos, maxChars) -> None: ... + +class DebugDocumentTextExternalAuthor: + def GetPathName(self) -> None: ... + def GetFileName(self) -> None: ... + def NotifyChanged(self) -> None: ... + +class DebugDocumentTextEvents: + def onDestroy(self) -> None: ... + def onInsertText(self, cCharacterPosition, cNumToInsert) -> None: ... + def onRemoveText(self, cCharacterPosition, cNumToRemove) -> None: ... + def onReplaceText(self, cCharacterPosition, cNumToReplace) -> None: ... + def onUpdateTextAttributes(self, cCharacterPosition, cNumToUpdate) -> None: ... + def onUpdateDocumentAttributes(self, textdocattr) -> None: ... + +class DebugDocumentContext: + def GetDocument(self) -> None: ... + def EnumCodeContexts(self) -> None: ... + +class DebugCodeContext: + def GetDocumentContext(self) -> None: ... + def SetBreakPoint(self, bps) -> None: ... + +class DebugStackFrame: + def GetCodeContext(self) -> None: ... + def GetDescriptionString(self, fLong) -> None: ... + def GetLanguageString(self) -> None: ... + def GetThread(self) -> None: ... + def GetDebugProperty(self) -> None: ... + +class DebugDocumentHost: + def GetDeferredText(self, dwTextStartCookie, maxChars, bWantAttr) -> None: ... + def GetScriptTextAttributes(self, codeText, delimterText, flags) -> None: ... + def OnCreateDocumentContext(self) -> None: ... + def GetPathName(self) -> None: ... + def GetFileName(self) -> None: ... + def NotifyChanged(self) -> None: ... + +class DebugDocumentTextConnectServer: + cookieNo: int + connections: Incomplete + def EnumConnections(self) -> None: ... + def GetConnectionInterface(self) -> None: ... + def GetConnectionPointContainer(self): ... + def Advise(self, pUnk): ... + def Unadvise(self, cookie): ... + def EnumConnectionPoints(self) -> None: ... + def FindConnectionPoint(self, iid): ... + +class RemoteDebugApplicationEvents: + def OnConnectDebugger(self, appDebugger) -> None: ... + def OnDisconnectDebugger(self) -> None: ... + def OnSetName(self, name) -> None: ... + def OnDebugOutput(self, string) -> None: ... + def OnClose(self) -> None: ... + def OnEnterBreakPoint(self, rdat) -> None: ... + def OnLeaveBreakPoint(self, rdat) -> None: ... + def OnCreateThread(self, rdat) -> None: ... + def OnDestroyThread(self, rdat) -> None: ... + def OnBreakFlagChange(self, abf, rdat) -> None: ... + +class DebugExpressionContext: + def ParseLanguageText(self, code, radix, delim, flags) -> None: ... + def GetLanguageInfo(self) -> None: ... + +class DebugExpression: + def Start(self, callback) -> None: ... + def Abort(self) -> None: ... + def QueryIsComplete(self) -> None: ... + def GetResultAsString(self) -> None: ... + def GetResultAsDebugProperty(self) -> None: ... + +class ProvideExpressionContexts: + def EnumExpressionContexts(self) -> None: ... diff --git a/stubs/pywin32/win32comext/axdebug/stackframe.pyi b/stubs/pywin32/win32comext/axdebug/stackframe.pyi new file mode 100644 index 0000000..6383241 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/stackframe.pyi @@ -0,0 +1,35 @@ +from _typeshed import Incomplete + +from win32com.server.exception import COMException as COMException +from win32comext.axdebug import gateways +from win32comext.axdebug.util import RaiseNotImpl as RaiseNotImpl, trace as trace + +class EnumDebugStackFrames(gateways.EnumDebugStackFrames): + def __init__(self, debugger) -> None: ... + def Next(self, count): ... + +class DebugStackFrame(gateways.DebugStackFrame): + frame: Incomplete + lineno: Incomplete + codeContainer: Incomplete + expressionContext: Incomplete + def __init__(self, frame, lineno, codeContainer) -> None: ... + def GetThread(self) -> None: ... + def GetCodeContext(self): ... + def GetDescriptionString(self, fLong): ... + def GetLanguageString(self, fLong): ... + def GetDebugProperty(self): ... + +class DebugStackFrameSniffer: + debugger: Incomplete + def __init__(self, debugger) -> None: ... + def EnumStackFrames(self): ... + +class StackFrameDebugProperty: + frame: Incomplete + def __init__(self, frame) -> None: ... + def GetPropertyInfo(self, dwFieldSpec, nRadix) -> None: ... + def GetExtendedInfo(self) -> None: ... + def SetValueAsString(self, value, radix) -> None: ... + def EnumMembers(self, dwFieldSpec, nRadix, iid): ... + def GetParent(self) -> None: ... diff --git a/stubs/pywin32/win32comext/axdebug/util.pyi b/stubs/pywin32/win32comext/axdebug/util.pyi new file mode 100644 index 0000000..5ec04b3 --- /dev/null +++ b/stubs/pywin32/win32comext/axdebug/util.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete + +import win32com.server.policy + +debugging: int + +def trace(*args) -> None: ... + +all_wrapped: Incomplete + +def RaiseNotImpl(who: Incomplete | None = ...) -> None: ... + +class Dispatcher(win32com.server.policy.DispatcherWin32trace): + def __init__(self, policyClass, object) -> None: ... diff --git a/stubs/pywin32/win32comext/axscript/__init__.pyi b/stubs/pywin32/win32comext/axscript/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/axscript/asputil.pyi b/stubs/pywin32/win32comext/axscript/asputil.pyi new file mode 100644 index 0000000..37227df --- /dev/null +++ b/stubs/pywin32/win32comext/axscript/asputil.pyi @@ -0,0 +1 @@ +def iif(cond, t, f): ... diff --git a/stubs/pywin32/win32comext/axscript/axscript.pyi b/stubs/pywin32/win32comext/axscript/axscript.pyi new file mode 100644 index 0000000..8914786 --- /dev/null +++ b/stubs/pywin32/win32comext/axscript/axscript.pyi @@ -0,0 +1,52 @@ +import _win32typing + +CATID_ActiveScript: _win32typing.PyIID +CATID_ActiveScriptParse: _win32typing.PyIID +IID_IActiveScript: _win32typing.PyIID +IID_IActiveScriptError: _win32typing.PyIID +IID_IActiveScriptParse: _win32typing.PyIID +IID_IActiveScriptParseProcedure: _win32typing.PyIID +IID_IActiveScriptSite: _win32typing.PyIID +IID_IObjectSafety: _win32typing.PyIID +IID_IProvideMultipleClassInfo: _win32typing.PyIID +INTERFACESAFE_FOR_UNTRUSTED_CALLER: int +INTERFACESAFE_FOR_UNTRUSTED_DATA: int +INTERFACE_USES_DISPEX: int +INTERFACE_USES_SECURITY_MANAGER: int +MULTICLASSINFO_GETIIDPRIMARY: int +MULTICLASSINFO_GETIIDSOURCE: int +MULTICLASSINFO_GETNUMRESERVEDDISPIDS: int +MULTICLASSINFO_GETTYPEINFO: int +SCRIPTINFO_ALL_FLAGS: int +SCRIPTINFO_ITYPEINFO: int +SCRIPTINFO_IUNKNOWN: int +SCRIPTINTERRUPT_ALL_FLAGS: int +SCRIPTINTERRUPT_DEBUG: int +SCRIPTINTERRUPT_RAISEEXCEPTION: int +SCRIPTITEM_ALL_FLAGS: int +SCRIPTITEM_CODEONLY: int +SCRIPTITEM_GLOBALMEMBERS: int +SCRIPTITEM_ISPERSISTENT: int +SCRIPTITEM_ISSOURCE: int +SCRIPTITEM_ISVISIBLE: int +SCRIPTITEM_NOCODE: int +SCRIPTPROC_ALL_FLAGS: int +SCRIPTPROC_HOSTMANAGESSOURCE: int +SCRIPTPROC_IMPLICIT_PARENTS: int +SCRIPTPROC_IMPLICIT_THIS: int +SCRIPTSTATE_CLOSED: int +SCRIPTSTATE_CONNECTED: int +SCRIPTSTATE_DISCONNECTED: int +SCRIPTSTATE_INITIALIZED: int +SCRIPTSTATE_STARTED: int +SCRIPTSTATE_UNINITIALIZED: int +SCRIPTTEXT_ALL_FLAGS: int +SCRIPTTEXT_ISEXPRESSION: int +SCRIPTTEXT_ISPERSISTENT: int +SCRIPTTEXT_ISVISIBLE: int +SCRIPTTHREADSTATE_NOTINSCRIPT: int +SCRIPTTHREADSTATE_RUNNING: int +SCRIPTTYPELIB_ISCONTROL: int +SCRIPTTYPELIB_ISPERSISTENT: int +SCRIPT_E_REPORTED: int +TIFLAGS_EXTENDDISPATCHONLY: int diff --git a/stubs/pywin32/win32comext/axscript/client/__init__.pyi b/stubs/pywin32/win32comext/axscript/client/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/axscript/client/error.pyi b/stubs/pywin32/win32comext/axscript/client/error.pyi new file mode 100644 index 0000000..24ce7a5 --- /dev/null +++ b/stubs/pywin32/win32comext/axscript/client/error.pyi @@ -0,0 +1,21 @@ +from win32com.server.exception import COMException + +debugging: int + +def FormatForAX(text): ... +def ExpandTabs(text): ... +def AddCR(text): ... + +class IActiveScriptError: + def GetSourceLineText(self): ... + def GetSourcePosition(self): ... + def GetExceptionInfo(self): ... + +class AXScriptException(COMException): + sourceContext: int + startLineNo: int + linetext: str + def __init__(self, site, codeBlock, exc_type, exc_value, exc_traceback) -> None: ... + def ExtractTracebackInfo(self, tb, site): ... + +def ProcessAXScriptException(scriptingSite, debugManager, exceptionInstance): ... diff --git a/stubs/pywin32/win32comext/axscript/client/pyscript.pyi b/stubs/pywin32/win32comext/axscript/client/pyscript.pyi new file mode 100644 index 0000000..548e95f --- /dev/null +++ b/stubs/pywin32/win32comext/axscript/client/pyscript.pyi @@ -0,0 +1,3 @@ +# Necessary for mypy to not fail with: +# 'error: Cannot find implementation or library stub for module named "win32comext.axscript.client.pyscript"' +# in: .gateways, .stackframe, .expressions, .adb, .contexts, .codecontainer, .documents, .debugger diff --git a/stubs/pywin32/win32comext/axscript/server/__init__.pyi b/stubs/pywin32/win32comext/axscript/server/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/axscript/server/axsite.pyi b/stubs/pywin32/win32comext/axscript/server/axsite.pyi new file mode 100644 index 0000000..aa77ad5 --- /dev/null +++ b/stubs/pywin32/win32comext/axscript/server/axsite.pyi @@ -0,0 +1,32 @@ +from _typeshed import Incomplete + +class AXEngine: + eScript: Incomplete + eParse: Incomplete + eSafety: Incomplete + def __init__(self, site, engine) -> None: ... + def __del__(self) -> None: ... + def GetScriptDispatch(self, name: Incomplete | None = ...): ... + def AddNamedItem(self, item, flags): ... + def AddCode(self, code, flags: int = ...) -> None: ... + def EvalCode(self, code): ... + def Start(self) -> None: ... + def Close(self) -> None: ... + def SetScriptState(self, state) -> None: ... + +IActiveScriptSite_methods: Incomplete + +class AXSite: + lcid: Incomplete + objModel: Incomplete + engine: Incomplete + def __init__(self, objModel=..., engine: Incomplete | None = ..., lcid: int = ...) -> None: ... + def AddEngine(self, engine): ... + def GetLCID(self): ... + def GetItemInfo(self, name, returnMask): ... + def GetDocVersionString(self): ... + def OnScriptTerminate(self, result, excepInfo) -> None: ... + def OnStateChange(self, state) -> None: ... + def OnScriptError(self, errorInterface): ... + def OnEnterScript(self) -> None: ... + def OnLeaveScript(self) -> None: ... diff --git a/stubs/pywin32/win32comext/axscript/server/error.pyi b/stubs/pywin32/win32comext/axscript/server/error.pyi new file mode 100644 index 0000000..2eb45eb --- /dev/null +++ b/stubs/pywin32/win32comext/axscript/server/error.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete + +class Exception: + activeScriptError: Incomplete + def __init__(self, activeScriptError) -> None: ... + def __getattr__(self, attr): ... diff --git a/stubs/pywin32/win32comext/bits/__init__.pyi b/stubs/pywin32/win32comext/bits/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/bits/bits.pyi b/stubs/pywin32/win32comext/bits/bits.pyi new file mode 100644 index 0000000..8bc0c05 --- /dev/null +++ b/stubs/pywin32/win32comext/bits/bits.pyi @@ -0,0 +1,61 @@ +import _win32typing + +BG_AUTH_SCHEME_BASIC: int +BG_AUTH_SCHEME_DIGEST: int +BG_AUTH_SCHEME_NEGOTIATE: int +BG_AUTH_SCHEME_NTLM: int +BG_AUTH_SCHEME_PASSPORT: int +BG_AUTH_TARGET_PROXY: int +BG_AUTH_TARGET_SERVER: int +BG_CERT_STORE_LOCATION_CURRENT_SERVICE: int +BG_CERT_STORE_LOCATION_CURRENT_USER: int +BG_CERT_STORE_LOCATION_CURRENT_USER_GROUP_POLICY: int +BG_CERT_STORE_LOCATION_LOCAL_MACHINE: int +BG_CERT_STORE_LOCATION_LOCAL_MACHINE_ENTERPRISE: int +BG_CERT_STORE_LOCATION_LOCAL_MACHINE_GROUP_POLICY: int +BG_CERT_STORE_LOCATION_SERVICES: int +BG_CERT_STORE_LOCATION_USERS: int +BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER: int +BG_ERROR_CONTEXT_GENERAL_TRANSPORT: int +BG_ERROR_CONTEXT_LOCAL_FILE: int +BG_ERROR_CONTEXT_NONE: int +BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION: int +BG_ERROR_CONTEXT_REMOTE_APPLICATION: int +BG_ERROR_CONTEXT_REMOTE_FILE: int +BG_ERROR_CONTEXT_UNKNOWN: int +BG_JOB_ENUM_ALL_USERS: int +BG_JOB_PRIORITY_FOREGROUND: int +BG_JOB_PRIORITY_HIGH: int +BG_JOB_PRIORITY_LOW: int +BG_JOB_PRIORITY_NORMAL: int +BG_JOB_PROXY_USAGE_AUTODETECT: int +BG_JOB_PROXY_USAGE_NO_PROXY: int +BG_JOB_PROXY_USAGE_OVERRIDE: int +BG_JOB_PROXY_USAGE_PRECONFIG: int +BG_JOB_STATE_ACKNOWLEDGED: int +BG_JOB_STATE_CANCELLED: int +BG_JOB_STATE_CONNECTING: int +BG_JOB_STATE_ERROR: int +BG_JOB_STATE_QUEUED: int +BG_JOB_STATE_SUSPENDED: int +BG_JOB_STATE_TRANSFERRED: int +BG_JOB_STATE_TRANSFERRING: int +BG_JOB_STATE_TRANSIENT_ERROR: int +BG_JOB_TYPE_DOWNLOAD: int +BG_JOB_TYPE_UPLOAD: int +BG_JOB_TYPE_UPLOAD_REPLY: int +BG_NOTIFY_DISABLE: int +BG_NOTIFY_JOB_ERROR: int +BG_NOTIFY_JOB_MODIFICATION: int +BG_NOTIFY_JOB_TRANSFERRED: int +CLSID_BackgroundCopyManager: _win32typing.PyIID +IID_IBackgroundCopyCallback: _win32typing.PyIID +IID_IBackgroundCopyError: _win32typing.PyIID +IID_IBackgroundCopyFile: _win32typing.PyIID +IID_IBackgroundCopyFile2: _win32typing.PyIID +IID_IBackgroundCopyJob: _win32typing.PyIID +IID_IBackgroundCopyJob2: _win32typing.PyIID +IID_IBackgroundCopyJob3: _win32typing.PyIID +IID_IBackgroundCopyManager: _win32typing.PyIID +IID_IEnumBackgroundCopyFiles: _win32typing.PyIID +IID_IEnumBackgroundCopyJobs: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/directsound/__init__.pyi b/stubs/pywin32/win32comext/directsound/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/directsound/directsound.pyi b/stubs/pywin32/win32comext/directsound/directsound.pyi new file mode 100644 index 0000000..3fee306 --- /dev/null +++ b/stubs/pywin32/win32comext/directsound/directsound.pyi @@ -0,0 +1,114 @@ +from _typeshed import Incomplete + +import _win32typing + +def DirectSoundCreate(guid: _win32typing.PyIID | None = ..., unk: Incomplete | None = ...) -> _win32typing.PyIUnknown: ... +def DirectSoundEnumerate(): ... +def DirectSoundCaptureCreate(guid: _win32typing.PyIID | None = ..., unk: Incomplete | None = ...) -> _win32typing.PyIUnknown: ... +def DirectSoundCaptureEnumerate(): ... +def DSCAPS() -> _win32typing.PyDSCAPS: ... +def DSBCAPS() -> _win32typing.PyDSBCAPS: ... +def DSCCAPS() -> _win32typing.PyDSCCAPS: ... +def DSCBCAPS() -> _win32typing.PyDSCBCAPS: ... +def DSBUFFERDESC() -> _win32typing.PyDSBUFFERDESC: ... +def DSCBUFFERDESC() -> _win32typing.PyDSCBUFFERDESC: ... + +DS3DMODE_DISABLE: int +DS3DMODE_HEADRELATIVE: int +DS3DMODE_NORMAL: int +DSBCAPS_CTRL3D: int +DSBCAPS_CTRLFREQUENCY: int +DSBCAPS_CTRLPAN: int +DSBCAPS_CTRLPOSITIONNOTIFY: int +DSBCAPS_CTRLVOLUME: int +DSBCAPS_GETCURRENTPOSITION2: int +DSBCAPS_GLOBALFOCUS: int +DSBCAPS_LOCHARDWARE: int +DSBCAPS_LOCSOFTWARE: int +DSBCAPS_MUTE3DATMAXDISTANCE: int +DSBCAPS_PRIMARYBUFFER: int +DSBCAPS_STATIC: int +DSBCAPS_STICKYFOCUS: int +DSBLOCK_ENTIREBUFFER: int +DSBLOCK_FROMWRITECURSOR: int +DSBPLAY_LOOPING: int +DSBSTATUS_BUFFERLOST: int +DSBSTATUS_LOOPING: int +DSBSTATUS_PLAYING: int +DSCAPS_CERTIFIED: int +DSCAPS_CONTINUOUSRATE: int +DSCAPS_EMULDRIVER: int +DSCAPS_PRIMARY16BIT: int +DSCAPS_PRIMARY8BIT: int +DSCAPS_PRIMARYMONO: int +DSCAPS_PRIMARYSTEREO: int +DSCAPS_SECONDARY16BIT: int +DSCAPS_SECONDARY8BIT: int +DSCAPS_SECONDARYMONO: int +DSCAPS_SECONDARYSTEREO: int +DSCBCAPS_WAVEMAPPED: int +DSCCAPS_EMULDRIVER: int +DSSCL_EXCLUSIVE: int +DSSCL_NORMAL: int +DSSCL_PRIORITY: int +DSSCL_WRITEPRIMARY: int +DSSPEAKER_GEOMETRY_MAX: int +DSSPEAKER_GEOMETRY_MIN: int +DSSPEAKER_GEOMETRY_NARROW: int +DSSPEAKER_GEOMETRY_WIDE: int +DSSPEAKER_HEADPHONE: int +DSSPEAKER_MONO: int +DSSPEAKER_QUAD: int +DSSPEAKER_STEREO: int +DSSPEAKER_SURROUND: int +DSBCAPSType = _win32typing.PyDSBCAPS +DSBFREQUENCY_MAX: int +DSBFREQUENCY_MIN: int +DSBFREQUENCY_ORIGINAL: int +DSBPAN_CENTER: int +DSBPAN_LEFT: int +DSBPAN_RIGHT: int +DSBPN_OFFSETSTOP: int +DSBSIZE_MAX: int +DSBSIZE_MIN: int +DSBUFFERDESCType = _win32typing.PyDSBUFFERDESC +DSBVOLUME_MAX: int +DSBVOLUME_MIN: int +DSCAPSType = _win32typing.PyDSCAPSType +DSCBCAPSType = _win32typing.PyDSCBCAPSType +DSCBLOCK_ENTIREBUFFER: int +DSCBSTART_LOOPING: int +DSCBSTATUS_CAPTURING: int +DSCBSTATUS_LOOPING: int +DSCBUFFERDESCType = _win32typing.PyDSCBUFFERDESC +DSCCAPSType = _win32typing.PyDSCCAPSType +DSERR_ACCESSDENIED: int +DSERR_ALLOCATED: int +DSERR_ALREADYINITIALIZED: int +DSERR_BADFORMAT: int +DSERR_BADSENDBUFFERGUID: int +DSERR_BUFFERLOST: int +DSERR_BUFFERTOOSMALL: int +DSERR_CONTROLUNAVAIL: int +DSERR_DS8_REQUIRED: int +DSERR_FXUNAVAILABLE: int +DSERR_GENERIC: int +DSERR_INVALIDCALL: int +DSERR_INVALIDPARAM: int +DSERR_NOAGGREGATION: int +DSERR_NODRIVER: int +DSERR_NOINTERFACE: int +DSERR_OBJECTNOTFOUND: int +DSERR_OTHERAPPHASPRIO: int +DSERR_OUTOFMEMORY: int +DSERR_PRIOLEVELNEEDED: int +DSERR_SENDLOOP: int +DSERR_UNINITIALIZED: int +DSERR_UNSUPPORTED: int +DS_NO_VIRTUALIZATION: int +DS_OK: int +IID_IDirectSound: _win32typing.PyIID +IID_IDirectSoundBuffer: _win32typing.PyIID +IID_IDirectSoundCapture: _win32typing.PyIID +IID_IDirectSoundCaptureBuffer: _win32typing.PyIID +IID_IDirectSoundNotify: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/ifilter/__init__.pyi b/stubs/pywin32/win32comext/ifilter/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/ifilter/ifilter.pyi b/stubs/pywin32/win32comext/ifilter/ifilter.pyi new file mode 100644 index 0000000..9d7a520 --- /dev/null +++ b/stubs/pywin32/win32comext/ifilter/ifilter.pyi @@ -0,0 +1,33 @@ +import _win32typing + +def BindIFilterFromStorage(*args, **kwargs): ... # incomplete +def BindIFilterFromStream(*args, **kwargs): ... # incomplete +def LoadIFilter(*args, **kwargs): ... # incomplete + +CHUNK_EOC: int +CHUNK_EOP: int +CHUNK_EOS: int +CHUNK_EOW: int +CHUNK_NO_BREAK: int +CHUNK_TEXT: int +CHUNK_VALUE: int +FILTER_E_ACCESS: int +FILTER_E_EMBEDDING_UNAVAILABLE: int +FILTER_E_END_OF_CHUNKS: int +FILTER_E_LINK_UNAVAILABLE: int +FILTER_E_NO_MORE_TEXT: int +FILTER_E_NO_MORE_VALUES: int +FILTER_E_NO_TEXT: int +FILTER_E_NO_VALUES: int +FILTER_E_PASSWORD: int +FILTER_S_LAST_TEXT: int +IFILTER_FLAGS_OLE_PROPERTIES: int +IFILTER_INIT_APPLY_INDEX_ATTRIBUTES: int +IFILTER_INIT_APPLY_OTHER_ATTRIBUTES: int +IFILTER_INIT_CANON_HYPHENS: int +IFILTER_INIT_CANON_PARAGRAPHS: int +IFILTER_INIT_CANON_SPACES: int +IFILTER_INIT_HARD_LINE_BREAKS: int +IFILTER_INIT_INDEXING_ONLY: int +IFILTER_INIT_SEARCH_LINKS: int +IID_IFilter: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/ifilter/ifiltercon.pyi b/stubs/pywin32/win32comext/ifilter/ifiltercon.pyi new file mode 100644 index 0000000..2b66234 --- /dev/null +++ b/stubs/pywin32/win32comext/ifilter/ifiltercon.pyi @@ -0,0 +1,103 @@ +from _typeshed import Incomplete + +PSGUID_STORAGE: Incomplete +PSGUID_SUMMARYINFORMATION: Incomplete +PSGUID_HTMLINFORMATION: Incomplete +PSGUID_HTML2_INFORMATION: Incomplete +IFILTER_INIT_CANON_PARAGRAPHS: int +IFILTER_INIT_HARD_LINE_BREAKS: int +IFILTER_INIT_CANON_HYPHENS: int +IFILTER_INIT_CANON_SPACES: int +IFILTER_INIT_APPLY_INDEX_ATTRIBUTES: int +IFILTER_INIT_APPLY_CRAWL_ATTRIBUTES: int +IFILTER_INIT_APPLY_OTHER_ATTRIBUTES: int +IFILTER_INIT_INDEXING_ONLY: int +IFILTER_INIT_SEARCH_LINKS: int +IFILTER_INIT_FILTER_OWNED_VALUE_OK: int +IFILTER_FLAGS_OLE_PROPERTIES: int +CHUNK_TEXT: int +CHUNK_VALUE: int +CHUNK_NO_BREAK: int +CHUNK_EOW: int +CHUNK_EOS: int +CHUNK_EOP: int +CHUNK_EOC: int +NOT_AN_ERROR: int +FILTER_E_END_OF_CHUNKS: int +FILTER_E_NO_MORE_TEXT: int +FILTER_E_NO_MORE_VALUES: int +FILTER_E_ACCESS: int +FILTER_W_MONIKER_CLIPPED: int +FILTER_E_NO_TEXT: int +FILTER_E_NO_VALUES: int +FILTER_E_EMBEDDING_UNAVAILABLE: int +FILTER_E_LINK_UNAVAILABLE: int +FILTER_S_LAST_TEXT: int +FILTER_S_LAST_VALUES: int +FILTER_E_PASSWORD: int +FILTER_E_UNKNOWNFORMAT: int +PROPSETFLAG_DEFAULT: int +PROPSETFLAG_NONSIMPLE: int +PROPSETFLAG_ANSI: int +PROPSETFLAG_UNBUFFERED: int +PROPSETFLAG_CASE_SENSITIVE: int +PROPSET_BEHAVIOR_CASE_SENSITIVE: int +PID_DICTIONARY: int +PID_CODEPAGE: int +PID_FIRST_USABLE: int +PID_FIRST_NAME_DEFAULT: int +PID_LOCALE: int +PID_MODIFY_TIME: int +PID_SECURITY: int +PID_BEHAVIOR: int +PID_ILLEGAL: int +PID_MIN_READONLY: int +PID_MAX_READONLY: int +PIDDI_THUMBNAIL: int +PIDSI_TITLE: int +PIDSI_SUBJECT: int +PIDSI_AUTHOR: int +PIDSI_KEYWORDS: int +PIDSI_COMMENTS: int +PIDSI_TEMPLATE: int +PIDSI_LASTAUTHOR: int +PIDSI_REVNUMBER: int +PIDSI_EDITTIME: int +PIDSI_LASTPRINTED: int +PIDSI_CREATE_DTM: int +PIDSI_LASTSAVE_DTM: int +PIDSI_PAGECOUNT: int +PIDSI_WORDCOUNT: int +PIDSI_CHARCOUNT: int +PIDSI_THUMBNAIL: int +PIDSI_APPNAME: int +PIDSI_DOC_SECURITY: int +PIDDSI_CATEGORY: int +PIDDSI_PRESFORMAT: int +PIDDSI_BYTECOUNT: int +PIDDSI_LINECOUNT: int +PIDDSI_PARCOUNT: int +PIDDSI_SLIDECOUNT: int +PIDDSI_NOTECOUNT: int +PIDDSI_HIDDENCOUNT: int +PIDDSI_MMCLIPCOUNT: int +PIDDSI_SCALE: int +PIDDSI_HEADINGPAIR: int +PIDDSI_DOCPARTS: int +PIDDSI_MANAGER: int +PIDDSI_COMPANY: int +PIDDSI_LINKSDIRTY: int +PIDMSI_EDITOR: int +PIDMSI_SUPPLIER: int +PIDMSI_SOURCE: int +PIDMSI_SEQUENCE_NO: int +PIDMSI_PROJECT: int +PIDMSI_STATUS: int +PIDMSI_OWNER: int +PIDMSI_RATING: int +PIDMSI_PRODUCTION: int +PIDMSI_COPYRIGHT: int +PRSPEC_INVALID: int +PRSPEC_LPWSTR: int +PRSPEC_PROPID: int +CCH_MAX_PROPSTG_NAME: int diff --git a/stubs/pywin32/win32comext/internet/__init__.pyi b/stubs/pywin32/win32comext/internet/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/internet/inetcon.pyi b/stubs/pywin32/win32comext/internet/inetcon.pyi new file mode 100644 index 0000000..7a90c63 --- /dev/null +++ b/stubs/pywin32/win32comext/internet/inetcon.pyi @@ -0,0 +1,254 @@ +from _typeshed import Incomplete + +INET_E_USE_DEFAULT_PROTOCOLHANDLER: int +INET_E_USE_DEFAULT_SETTING: int +INET_E_DEFAULT_ACTION: int +INET_E_QUERYOPTION_UNKNOWN: int +INET_E_REDIRECTING: int +INET_E_INVALID_URL: int +INET_E_NO_SESSION: int +INET_E_CANNOT_CONNECT: int +INET_E_RESOURCE_NOT_FOUND: int +INET_E_OBJECT_NOT_FOUND: int +INET_E_DATA_NOT_AVAILABLE: int +INET_E_DOWNLOAD_FAILURE: int +INET_E_AUTHENTICATION_REQUIRED: int +INET_E_NO_VALID_MEDIA: int +INET_E_CONNECTION_TIMEOUT: int +INET_E_INVALID_REQUEST: int +INET_E_UNKNOWN_PROTOCOL: int +INET_E_SECURITY_PROBLEM: int +INET_E_CANNOT_LOAD_DATA: int +INET_E_CANNOT_INSTANTIATE_OBJECT: int +INET_E_INVALID_CERTIFICATE: int +INET_E_REDIRECT_FAILED: int +INET_E_REDIRECT_TO_DIR: int +INET_E_CANNOT_LOCK_REQUEST: int +INET_E_USE_EXTEND_BINDING: int +INET_E_TERMINATED_BIND: int +INET_E_CODE_DOWNLOAD_DECLINED: int +INET_E_RESULT_DISPATCHED: int +INET_E_CANNOT_REPLACE_SFP_FILE: int +INET_E_CODE_INSTALL_SUPPRESSED: int +INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY: int +MKSYS_URLMONIKER: int +URL_MK_LEGACY: int +URL_MK_UNIFORM: int +URL_MK_NO_CANONICALIZE: int +FIEF_FLAG_FORCE_JITUI: int +FIEF_FLAG_PEEK: int +FIEF_FLAG_SKIP_INSTALLED_VERSION_CHECK: int +FMFD_DEFAULT: int +FMFD_URLASFILENAME: int +FMFD_ENABLEMIMESNIFFING: int +FMFD_IGNOREMIMETEXTPLAIN: int +URLMON_OPTION_USERAGENT: int +URLMON_OPTION_USERAGENT_REFRESH: int +URLMON_OPTION_URL_ENCODING: int +URLMON_OPTION_USE_BINDSTRINGCREDS: int +URLMON_OPTION_USE_BROWSERAPPSDOCUMENTS: int +CF_NULL: int +Uri_CREATE_ALLOW_RELATIVE: int +Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME: int +Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME: int +Uri_CREATE_NOFRAG: int +Uri_CREATE_NO_CANONICALIZE: int +Uri_CREATE_CANONICALIZE: int +Uri_CREATE_FILE_USE_DOS_PATH: int +Uri_CREATE_DECODE_EXTRA_INFO: int +Uri_CREATE_NO_DECODE_EXTRA_INFO: int +Uri_CREATE_CRACK_UNKNOWN_SCHEMES: int +Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES: int +Uri_CREATE_PRE_PROCESS_HTML_URI: int +Uri_CREATE_NO_PRE_PROCESS_HTML_URI: int +Uri_CREATE_IE_SETTINGS: int +Uri_CREATE_NO_IE_SETTINGS: int +Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS: int +Uri_DISPLAY_NO_FRAGMENT: int +Uri_PUNYCODE_IDN_HOST: int +Uri_DISPLAY_IDN_HOST: int +Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8: int +Uri_ENCODING_USER_INFO_AND_PATH_IS_CP: int +Uri_ENCODING_HOST_IS_IDN: int +Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8: int +Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP: int +Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8: int +Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP: int +Uri_ENCODING_RFC: Incomplete +UriBuilder_USE_ORIGINAL_FLAGS: int +WININETINFO_OPTION_LOCK_HANDLE: int +URLOSTRM_USECACHEDCOPY_ONLY: int +URLOSTRM_USECACHEDCOPY: int +URLOSTRM_GETNEWESTVERSION: int +SET_FEATURE_ON_THREAD: int +SET_FEATURE_ON_PROCESS: int +SET_FEATURE_IN_REGISTRY: int +SET_FEATURE_ON_THREAD_LOCALMACHINE: int +SET_FEATURE_ON_THREAD_INTRANET: int +SET_FEATURE_ON_THREAD_TRUSTED: int +SET_FEATURE_ON_THREAD_INTERNET: int +SET_FEATURE_ON_THREAD_RESTRICTED: int +GET_FEATURE_FROM_THREAD: int +GET_FEATURE_FROM_PROCESS: int +GET_FEATURE_FROM_REGISTRY: int +GET_FEATURE_FROM_THREAD_LOCALMACHINE: int +GET_FEATURE_FROM_THREAD_INTRANET: int +GET_FEATURE_FROM_THREAD_TRUSTED: int +GET_FEATURE_FROM_THREAD_INTERNET: int +GET_FEATURE_FROM_THREAD_RESTRICTED: int +PROTOCOLFLAG_NO_PICS_CHECK: int +MUTZ_NOSAVEDFILECHECK: int +MUTZ_ISFILE: int +MUTZ_ACCEPT_WILDCARD_SCHEME: int +MUTZ_ENFORCERESTRICTED: int +MUTZ_RESERVED: int +MUTZ_REQUIRESAVEDFILECHECK: int +MUTZ_DONT_UNESCAPE: int +MUTZ_DONT_USE_CACHE: int +MUTZ_FORCE_INTRANET_FLAGS: int +MUTZ_IGNORE_ZONE_MAPPINGS: int +MAX_SIZE_SECURITY_ID: int +URLACTION_MIN: int +URLACTION_DOWNLOAD_MIN: int +URLACTION_DOWNLOAD_SIGNED_ACTIVEX: int +URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX: int +URLACTION_DOWNLOAD_CURR_MAX: int +URLACTION_DOWNLOAD_MAX: int +URLACTION_ACTIVEX_MIN: int +URLACTION_ACTIVEX_RUN: int +URLPOLICY_ACTIVEX_CHECK_LIST: int +URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY: int +URLACTION_ACTIVEX_OVERRIDE_DATA_SAFETY: int +URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY: int +URLACTION_SCRIPT_OVERRIDE_SAFETY: int +URLACTION_ACTIVEX_CONFIRM_NOOBJECTSAFETY: int +URLACTION_ACTIVEX_TREATASUNTRUSTED: int +URLACTION_ACTIVEX_NO_WEBOC_SCRIPT: int +URLACTION_ACTIVEX_OVERRIDE_REPURPOSEDETECTION: int +URLACTION_ACTIVEX_OVERRIDE_OPTIN: int +URLACTION_ACTIVEX_SCRIPTLET_RUN: int +URLACTION_ACTIVEX_DYNSRC_VIDEO_AND_ANIMATION: int +URLACTION_ACTIVEX_CURR_MAX: int +URLACTION_ACTIVEX_MAX: int +URLACTION_SCRIPT_MIN: int +URLACTION_SCRIPT_RUN: int +URLACTION_SCRIPT_JAVA_USE: int +URLACTION_SCRIPT_SAFE_ACTIVEX: int +URLACTION_CROSS_DOMAIN_DATA: int +URLACTION_SCRIPT_PASTE: int +URLACTION_ALLOW_XDOMAIN_SUBFRAME_RESIZE: int +URLACTION_SCRIPT_CURR_MAX: int +URLACTION_SCRIPT_MAX: int +URLACTION_HTML_MIN: int +URLACTION_HTML_SUBMIT_FORMS: int +URLACTION_HTML_SUBMIT_FORMS_FROM: int +URLACTION_HTML_SUBMIT_FORMS_TO: int +URLACTION_HTML_FONT_DOWNLOAD: int +URLACTION_HTML_JAVA_RUN: int +URLACTION_HTML_USERDATA_SAVE: int +URLACTION_HTML_SUBFRAME_NAVIGATE: int +URLACTION_HTML_META_REFRESH: int +URLACTION_HTML_MIXED_CONTENT: int +URLACTION_HTML_INCLUDE_FILE_PATH: int +URLACTION_HTML_MAX: int +URLACTION_SHELL_MIN: int +URLACTION_SHELL_INSTALL_DTITEMS: int +URLACTION_SHELL_MOVE_OR_COPY: int +URLACTION_SHELL_FILE_DOWNLOAD: int +URLACTION_SHELL_VERB: int +URLACTION_SHELL_WEBVIEW_VERB: int +URLACTION_SHELL_SHELLEXECUTE: int +URLACTION_SHELL_EXECUTE_HIGHRISK: int +URLACTION_SHELL_EXECUTE_MODRISK: int +URLACTION_SHELL_EXECUTE_LOWRISK: int +URLACTION_SHELL_POPUPMGR: int +URLACTION_SHELL_RTF_OBJECTS_LOAD: int +URLACTION_SHELL_ENHANCED_DRAGDROP_SECURITY: int +URLACTION_SHELL_EXTENSIONSECURITY: int +URLACTION_SHELL_SECURE_DRAGSOURCE: int +URLACTION_SHELL_CURR_MAX: int +URLACTION_SHELL_MAX: int +URLACTION_NETWORK_MIN: int +URLACTION_CREDENTIALS_USE: int +URLPOLICY_CREDENTIALS_SILENT_LOGON_OK: int +URLPOLICY_CREDENTIALS_MUST_PROMPT_USER: int +URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT: int +URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY: int +URLACTION_AUTHENTICATE_CLIENT: int +URLPOLICY_AUTHENTICATE_CLEARTEXT_OK: int +URLPOLICY_AUTHENTICATE_CHALLENGE_RESPONSE: int +URLPOLICY_AUTHENTICATE_MUTUAL_ONLY: int +URLACTION_COOKIES: int +URLACTION_COOKIES_SESSION: int +URLACTION_CLIENT_CERT_PROMPT: int +URLACTION_COOKIES_THIRD_PARTY: int +URLACTION_COOKIES_SESSION_THIRD_PARTY: int +URLACTION_COOKIES_ENABLED: int +URLACTION_NETWORK_CURR_MAX: int +URLACTION_NETWORK_MAX: int +URLACTION_JAVA_MIN: int +URLACTION_JAVA_PERMISSIONS: int +URLPOLICY_JAVA_PROHIBIT: int +URLPOLICY_JAVA_HIGH: int +URLPOLICY_JAVA_MEDIUM: int +URLPOLICY_JAVA_LOW: int +URLPOLICY_JAVA_CUSTOM: int +URLACTION_JAVA_CURR_MAX: int +URLACTION_JAVA_MAX: int +URLACTION_INFODELIVERY_MIN: int +URLACTION_INFODELIVERY_NO_ADDING_CHANNELS: int +URLACTION_INFODELIVERY_NO_EDITING_CHANNELS: int +URLACTION_INFODELIVERY_NO_REMOVING_CHANNELS: int +URLACTION_INFODELIVERY_NO_ADDING_SUBSCRIPTIONS: int +URLACTION_INFODELIVERY_NO_EDITING_SUBSCRIPTIONS: int +URLACTION_INFODELIVERY_NO_REMOVING_SUBSCRIPTIONS: int +URLACTION_INFODELIVERY_NO_CHANNEL_LOGGING: int +URLACTION_INFODELIVERY_CURR_MAX: int +URLACTION_INFODELIVERY_MAX: int +URLACTION_CHANNEL_SOFTDIST_MIN: int +URLACTION_CHANNEL_SOFTDIST_PERMISSIONS: int +URLPOLICY_CHANNEL_SOFTDIST_PROHIBIT: int +URLPOLICY_CHANNEL_SOFTDIST_PRECACHE: int +URLPOLICY_CHANNEL_SOFTDIST_AUTOINSTALL: int +URLACTION_CHANNEL_SOFTDIST_MAX: int +URLACTION_BEHAVIOR_MIN: int +URLACTION_BEHAVIOR_RUN: int +URLPOLICY_BEHAVIOR_CHECK_LIST: int +URLACTION_FEATURE_MIN: int +URLACTION_FEATURE_MIME_SNIFFING: int +URLACTION_FEATURE_ZONE_ELEVATION: int +URLACTION_FEATURE_WINDOW_RESTRICTIONS: int +URLACTION_FEATURE_SCRIPT_STATUS_BAR: int +URLACTION_FEATURE_FORCE_ADDR_AND_STATUS: int +URLACTION_FEATURE_BLOCK_INPUT_PROMPTS: int +URLACTION_AUTOMATIC_DOWNLOAD_UI_MIN: int +URLACTION_AUTOMATIC_DOWNLOAD_UI: int +URLACTION_AUTOMATIC_ACTIVEX_UI: int +URLACTION_ALLOW_RESTRICTEDPROTOCOLS: int +URLACTION_ALLOW_APEVALUATION: int +URLACTION_WINDOWS_BROWSER_APPLICATIONS: int +URLACTION_XPS_DOCUMENTS: int +URLACTION_LOOSE_XAML: int +URLACTION_LOWRIGHTS: int +URLACTION_WINFX_SETUP: int +URLPOLICY_ALLOW: int +URLPOLICY_QUERY: int +URLPOLICY_DISALLOW: int +URLPOLICY_NOTIFY_ON_ALLOW: int +URLPOLICY_NOTIFY_ON_DISALLOW: int +URLPOLICY_LOG_ON_ALLOW: int +URLPOLICY_LOG_ON_DISALLOW: int +URLPOLICY_MASK_PERMISSIONS: int +URLPOLICY_DONTCHECKDLGBOX: int +URLZONE_ESC_FLAG: int +SECURITY_IE_STATE_GREEN: int +SECURITY_IE_STATE_RED: int +SOFTDIST_FLAG_USAGE_EMAIL: int +SOFTDIST_FLAG_USAGE_PRECACHE: int +SOFTDIST_FLAG_USAGE_AUTOINSTALL: int +SOFTDIST_FLAG_DELETE_SUBSCRIPTION: int +SOFTDIST_ADSTATE_NONE: int +SOFTDIST_ADSTATE_AVAILABLE: int +SOFTDIST_ADSTATE_DOWNLOADED: int +SOFTDIST_ADSTATE_INSTALLED: int +CONFIRMSAFETYACTION_LOADOBJECT: int diff --git a/stubs/pywin32/win32comext/internet/internet.pyi b/stubs/pywin32/win32comext/internet/internet.pyi new file mode 100644 index 0000000..2bfbaf6 --- /dev/null +++ b/stubs/pywin32/win32comext/internet/internet.pyi @@ -0,0 +1,44 @@ +# Can't generate with stubgen because: +# "SystemError: CoInternetCreateSecurityManager() method: bad call flags" +import _win32typing + +def CoInternetCreateSecurityManager(reserved) -> _win32typing.PyIInternetSecurityManager: ... +def CoInternetIsFeatureEnabled(flags): ... +def CoInternetSetFeatureEnabled(flags, enable): ... + +FEATURE_ADDON_MANAGEMENT: int +FEATURE_BEHAVIORS: int +FEATURE_DISABLE_MK_PROTOCOL: int +FEATURE_ENTRY_COUNT: int +FEATURE_GET_URL_DOM_FILEPATH_UNENCODED: int +FEATURE_HTTP_USERNAME_PASSWORD_DISABLE: int +FEATURE_LOCALMACHINE_LOCKDOWN: int +FEATURE_MIME_HANDLING: int +FEATURE_MIME_SNIFFING: int +FEATURE_OBJECT_CACHING: int +FEATURE_PROTOCOL_LOCKDOWN: int +FEATURE_RESTRICT_ACTIVEXINSTALL: int +FEATURE_RESTRICT_FILEDOWNLOAD: int +FEATURE_SAFE_BINDTOOBJECT: int +FEATURE_SECURITYBAND: int +FEATURE_UNC_SAVEDFILECHECK: int +FEATURE_VALIDATE_NAVIGATE_URL: int +FEATURE_WEBOC_POPUPMANAGEMENT: int +FEATURE_WINDOW_RESTRICTIONS: int +FEATURE_ZONE_ELEVATION: int +GET_FEATURE_FROM_PROCESS: int +GET_FEATURE_FROM_REGISTRY: int +GET_FEATURE_FROM_THREAD: int +GET_FEATURE_FROM_THREAD_INTERNET: int +GET_FEATURE_FROM_THREAD_INTRANET: int +GET_FEATURE_FROM_THREAD_LOCALMACHINE: int +GET_FEATURE_FROM_THREAD_RESTRICTED: int +GET_FEATURE_FROM_THREAD_TRUSTED: int +SET_FEATURE_IN_REGISTRY: int +SET_FEATURE_ON_PROCESS: int +SET_FEATURE_ON_THREAD: int +SET_FEATURE_ON_THREAD_INTERNET: int +SET_FEATURE_ON_THREAD_INTRANET: int +SET_FEATURE_ON_THREAD_LOCALMACHINE: int +SET_FEATURE_ON_THREAD_RESTRICTED: int +SET_FEATURE_ON_THREAD_TRUSTED: int diff --git a/stubs/pywin32/win32comext/mapi/__init__.pyi b/stubs/pywin32/win32comext/mapi/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/mapi/_exchdapi.pyi b/stubs/pywin32/win32comext/mapi/_exchdapi.pyi new file mode 100644 index 0000000..2d86d5b --- /dev/null +++ b/stubs/pywin32/win32comext/mapi/_exchdapi.pyi @@ -0,0 +1,43 @@ +from _typeshed import Incomplete + +import _win32typing + +def HrInstallService() -> None: ... +def HrInstallMailboxAgent() -> None: ... +def HrCreateMailboxAgentProfile(serviceName: str, profile: str) -> None: ... +def HrCreateGatewayProfile(serviceName: str, profile: str) -> None: ... +def HrMailboxAgentExists(server: str, siteDN: str, rdn: str) -> None: ... +def HrAdminProgramExists() -> None: ... +def HrRemoveMailboxAgent(server: str, siteDN: str, rdn: str) -> None: ... +def HrRemoveProfile(profile: str) -> None: ... +def HrEnumOrganizations(rootDN: str, server: str) -> list[str]: ... +def HrEnumSites(server: str, organizationDN: str) -> list[str]: ... +def HrEnumContainers(server: str, siteDN: str, fSubtree) -> list[str]: ... +def HrEnumSiteAdmins(server: str, siteDN: str) -> list[str]: ... +def HrGetServiceAccountName(serviceName: str, serviceName1: str) -> str: ... +def HrCreateDirEntryIdEx(addrBook: _win32typing.PyIAddrBook, distinguishedName: str) -> str: ... +def HrCreateProfileName(profPrefix: str) -> str: ... +def HrFindExchangeGlobalAddresslist(addrBook: _win32typing.PyIAddrBook) -> str: ... +def HrGetExchangeStatus(server: str) -> tuple[Incomplete, Incomplete]: ... +def HrGetMailboxDN(session) -> str: ... +def HrGetServerDN(session) -> str: ... +def HrMAPIFindDefaultMsgStore(session: _win32typing.PyIMAPISession) -> str: ... +def HrMAPIFindFolder(folder: _win32typing.PyIMAPIFolder, name: str) -> str: ... +def HrMAPIFindFolderEx(msgStore: _win32typing.PyIMsgStore, sepString: str, path: str) -> str: ... +def HrMAPIFindIPMSubtree(msgStore: _win32typing.PyIMsgStore) -> str: ... +def HrMAPIFindInbox(msgStore: _win32typing.PyIMsgStore) -> str: ... +def HrMAPIFindStore(session: _win32typing.PyIMAPISession, name: str) -> _win32typing.PyIMsgStore: ... +def HrMAPIFindSubfolderEx(rootFolder: _win32typing.PyIMAPIFolder, sep: str, name: str) -> _win32typing.PyIMsgStore: ... +def HrMAPIOpenFolderEx(msgStore: _win32typing.PyIMsgStore, sep: str, name: str) -> _win32typing.PyIMAPIFolder: ... +def HrMAPISetPropBoolean(obj: _win32typing.PyIMAPIProp, tag) -> None: ... +def HrMAPISetPropLong(obj: _win32typing.PyIMAPIProp, tag) -> None: ... +def HrMailboxLogoff(inbox: _win32typing.PyIMsgStore) -> None: ... +def HrMailboxLogon( + session: _win32typing.PyIMAPISession, msgStore: _win32typing.PyIMsgStore, msgStoreDN: str, mailboxDN: str +) -> _win32typing.PyIMsgStore: ... +def HrOpenExchangePrivateStore(session: _win32typing.PyIMAPISession) -> _win32typing.PyIMsgStore: ... +def HrOpenExchangePublicFolders(store: _win32typing.PyIMsgStore) -> _win32typing.PyIMAPIFolder: ... +def HrOpenExchangePublicStore(session: _win32typing.PyIMAPISession) -> _win32typing.PyIMsgStore: ... +def HrOpenSessionObject(session: _win32typing.PyIMAPISession) -> _win32typing.PyIMAPIProp: ... +def HrOpenSiteContainer(session: _win32typing.PyIMAPISession) -> _win32typing.PyIMAPIProp: ... +def HrOpenSiteContainerAddressing(session: _win32typing.PyIMAPISession) -> _win32typing.PyIMAPIProp: ... diff --git a/stubs/pywin32/win32comext/mapi/emsabtags.pyi b/stubs/pywin32/win32comext/mapi/emsabtags.pyi new file mode 100644 index 0000000..59cfd21 --- /dev/null +++ b/stubs/pywin32/win32comext/mapi/emsabtags.pyi @@ -0,0 +1,865 @@ +from _typeshed import Incomplete + +from win32comext.mapi.mapitags import ( + PROP_TAG as PROP_TAG, + PT_APPTIME as PT_APPTIME, + PT_BINARY as PT_BINARY, + PT_BOOLEAN as PT_BOOLEAN, + PT_CLSID as PT_CLSID, + PT_CURRENCY as PT_CURRENCY, + PT_DOUBLE as PT_DOUBLE, + PT_ERROR as PT_ERROR, + PT_FLOAT as PT_FLOAT, + PT_I2 as PT_I2, + PT_I4 as PT_I4, + PT_I8 as PT_I8, + PT_LONG as PT_LONG, + PT_LONGLONG as PT_LONGLONG, + PT_MV_APPTIME as PT_MV_APPTIME, + PT_MV_BINARY as PT_MV_BINARY, + PT_MV_CLSID as PT_MV_CLSID, + PT_MV_CURRENCY as PT_MV_CURRENCY, + PT_MV_DOUBLE as PT_MV_DOUBLE, + PT_MV_FLOAT as PT_MV_FLOAT, + PT_MV_I2 as PT_MV_I2, + PT_MV_I4 as PT_MV_I4, + PT_MV_I8 as PT_MV_I8, + PT_MV_LONG as PT_MV_LONG, + PT_MV_LONGLONG as PT_MV_LONGLONG, + PT_MV_R4 as PT_MV_R4, + PT_MV_R8 as PT_MV_R8, + PT_MV_SHORT as PT_MV_SHORT, + PT_MV_STRING8 as PT_MV_STRING8, + PT_MV_SYSTIME as PT_MV_SYSTIME, + PT_MV_TSTRING as PT_MV_TSTRING, + PT_MV_UNICODE as PT_MV_UNICODE, + PT_NULL as PT_NULL, + PT_OBJECT as PT_OBJECT, + PT_R4 as PT_R4, + PT_SHORT as PT_SHORT, + PT_STRING8 as PT_STRING8, + PT_SYSTIME as PT_SYSTIME, + PT_TSTRING as PT_TSTRING, + PT_UNICODE as PT_UNICODE, + PT_UNSPECIFIED as PT_UNSPECIFIED, +) + +AB_SHOW_PHANTOMS: int +AB_SHOW_OTHERS: int +EMS_AB_ADDRESS_LOOKUP: int +PR_EMS_AB_SERVER: Incomplete +PR_EMS_AB_SERVER_A: Incomplete +PR_EMS_AB_SERVER_W: Incomplete +PR_EMS_AB_CONTAINERID: Incomplete +PR_EMS_AB_DOS_ENTRYID: Incomplete +PR_EMS_AB_PARENT_ENTRYID: Incomplete +PR_EMS_AB_IS_MASTER: Incomplete +PR_EMS_AB_OBJECT_OID: Incomplete +PR_EMS_AB_HIERARCHY_PATH: Incomplete +PR_EMS_AB_HIERARCHY_PATH_A: Incomplete +PR_EMS_AB_HIERARCHY_PATH_W: Incomplete +PR_EMS_AB_CHILD_RDNS: Incomplete +MIN_EMS_AB_CONSTRUCTED_PROP_ID: int +PR_EMS_AB_OTHER_RECIPS: Incomplete +PR_EMS_AB_DISPLAY_NAME_PRINTABLE: Incomplete +PR_EMS_AB_DISPLAY_NAME_PRINTABLE_A: Incomplete +PR_EMS_AB_DISPLAY_NAME_PRINTABLE_W: Incomplete +PR_EMS_AB_ACCESS_CATEGORY: Incomplete +PR_EMS_AB_ACTIVATION_SCHEDULE: Incomplete +PR_EMS_AB_ACTIVATION_STYLE: Incomplete +PR_EMS_AB_ADDRESS_ENTRY_DISPLAY_TABLE: Incomplete +PR_EMS_AB_ADDRESS_ENTRY_DISPLAY_TABLE_MSDOS: Incomplete +PR_EMS_AB_ADDRESS_SYNTAX: Incomplete +PR_EMS_AB_ADDRESS_TYPE: Incomplete +PR_EMS_AB_ADDRESS_TYPE_A: Incomplete +PR_EMS_AB_ADDRESS_TYPE_W: Incomplete +PR_EMS_AB_ADMD: Incomplete +PR_EMS_AB_ADMD_A: Incomplete +PR_EMS_AB_ADMD_W: Incomplete +PR_EMS_AB_ADMIN_DESCRIPTION: Incomplete +PR_EMS_AB_ADMIN_DESCRIPTION_A: Incomplete +PR_EMS_AB_ADMIN_DESCRIPTION_W: Incomplete +PR_EMS_AB_ADMIN_DISPLAY_NAME: Incomplete +PR_EMS_AB_ADMIN_DISPLAY_NAME_A: Incomplete +PR_EMS_AB_ADMIN_DISPLAY_NAME_W: Incomplete +PR_EMS_AB_ADMIN_EXTENSION_DLL: Incomplete +PR_EMS_AB_ADMIN_EXTENSION_DLL_A: Incomplete +PR_EMS_AB_ADMIN_EXTENSION_DLL_W: Incomplete +PR_EMS_AB_ALIASED_OBJECT_NAME: Incomplete +PR_EMS_AB_ALIASED_OBJECT_NAME_A: Incomplete +PR_EMS_AB_ALIASED_OBJECT_NAME_W: Incomplete +PR_EMS_AB_ALIASED_OBJECT_NAME_O: Incomplete +PR_EMS_AB_ALIASED_OBJECT_NAME_T: Incomplete +PR_EMS_AB_ALT_RECIPIENT: Incomplete +PR_EMS_AB_ALT_RECIPIENT_A: Incomplete +PR_EMS_AB_ALT_RECIPIENT_W: Incomplete +PR_EMS_AB_ALT_RECIPIENT_O: Incomplete +PR_EMS_AB_ALT_RECIPIENT_T: Incomplete +PR_EMS_AB_ALT_RECIPIENT_BL: Incomplete +PR_EMS_AB_ALT_RECIPIENT_BL_A: Incomplete +PR_EMS_AB_ALT_RECIPIENT_BL_W: Incomplete +PR_EMS_AB_ALT_RECIPIENT_BL_O: Incomplete +PR_EMS_AB_ALT_RECIPIENT_BL_T: Incomplete +PR_EMS_AB_ANCESTOR_ID: Incomplete +PR_EMS_AB_ASSOC_NT_ACCOUNT: Incomplete +PR_EMS_AB_ASSOC_REMOTE_DXA: Incomplete +PR_EMS_AB_ASSOC_REMOTE_DXA_A: Incomplete +PR_EMS_AB_ASSOC_REMOTE_DXA_W: Incomplete +PR_EMS_AB_ASSOC_REMOTE_DXA_O: Incomplete +PR_EMS_AB_ASSOC_REMOTE_DXA_T: Incomplete +PR_EMS_AB_ASSOCIATION_LIFETIME: Incomplete +PR_EMS_AB_AUTH_ORIG_BL: Incomplete +PR_EMS_AB_AUTH_ORIG_BL_A: Incomplete +PR_EMS_AB_AUTH_ORIG_BL_W: Incomplete +PR_EMS_AB_AUTH_ORIG_BL_O: Incomplete +PR_EMS_AB_AUTH_ORIG_BL_T: Incomplete +PR_EMS_AB_AUTHORITY_REVOCATION_LIST: Incomplete +PR_EMS_AB_AUTHORIZED_DOMAIN: Incomplete +PR_EMS_AB_AUTHORIZED_DOMAIN_A: Incomplete +PR_EMS_AB_AUTHORIZED_DOMAIN_W: Incomplete +PR_EMS_AB_AUTHORIZED_PASSWORD: Incomplete +PR_EMS_AB_AUTHORIZED_USER: Incomplete +PR_EMS_AB_AUTHORIZED_USER_A: Incomplete +PR_EMS_AB_AUTHORIZED_USER_W: Incomplete +PR_EMS_AB_AUTOREPLY: Incomplete +PR_EMS_AB_AUTOREPLY_MESSAGE: Incomplete +PR_EMS_AB_AUTOREPLY_MESSAGE_A: Incomplete +PR_EMS_AB_AUTOREPLY_MESSAGE_W: Incomplete +PR_EMS_AB_AUTOREPLY_SUBJECT: Incomplete +PR_EMS_AB_AUTOREPLY_SUBJECT_A: Incomplete +PR_EMS_AB_AUTOREPLY_SUBJECT_W: Incomplete +PR_EMS_AB_BRIDGEHEAD_SERVERS: Incomplete +PR_EMS_AB_BRIDGEHEAD_SERVERS_A: Incomplete +PR_EMS_AB_BRIDGEHEAD_SERVERS_W: Incomplete +PR_EMS_AB_BRIDGEHEAD_SERVERS_O: Incomplete +PR_EMS_AB_BRIDGEHEAD_SERVERS_T: Incomplete +PR_EMS_AB_BUSINESS_CATEGORY: Incomplete +PR_EMS_AB_BUSINESS_CATEGORY_A: Incomplete +PR_EMS_AB_BUSINESS_CATEGORY_W: Incomplete +PR_EMS_AB_BUSINESS_ROLES: Incomplete +PR_EMS_AB_CA_CERTIFICATE: Incomplete +PR_EMS_AB_CAN_CREATE_PF: Incomplete +PR_EMS_AB_CAN_CREATE_PF_A: Incomplete +PR_EMS_AB_CAN_CREATE_PF_W: Incomplete +PR_EMS_AB_CAN_CREATE_PF_O: Incomplete +PR_EMS_AB_CAN_CREATE_PF_T: Incomplete +PR_EMS_AB_CAN_CREATE_PF_BL: Incomplete +PR_EMS_AB_CAN_CREATE_PF_BL_A: Incomplete +PR_EMS_AB_CAN_CREATE_PF_BL_W: Incomplete +PR_EMS_AB_CAN_CREATE_PF_BL_O: Incomplete +PR_EMS_AB_CAN_CREATE_PF_BL_T: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_A: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_W: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_O: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_T: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_BL: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_BL_A: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_BL_W: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_BL_O: Incomplete +PR_EMS_AB_CAN_CREATE_PF_DL_BL_T: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_A: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_W: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_O: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_T: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_BL: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_BL_A: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_BL_W: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_BL_O: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_BL_T: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_A: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_W: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_O: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_T: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_BL: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_BL_A: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_BL_W: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_BL_O: Incomplete +PR_EMS_AB_CAN_NOT_CREATE_PF_DL_BL_T: Incomplete +PR_EMS_AB_CAN_PRESERVE_DNS: Incomplete +PR_EMS_AB_CERTIFICATE_REVOCATION_LIST: Incomplete +PR_EMS_AB_CLOCK_ALERT_OFFSET: Incomplete +PR_EMS_AB_CLOCK_ALERT_REPAIR: Incomplete +PR_EMS_AB_CLOCK_WARNING_OFFSET: Incomplete +PR_EMS_AB_CLOCK_WARNING_REPAIR: Incomplete +PR_EMS_AB_COMPUTER_NAME: Incomplete +PR_EMS_AB_COMPUTER_NAME_A: Incomplete +PR_EMS_AB_COMPUTER_NAME_W: Incomplete +PR_EMS_AB_CONNECTED_DOMAINS: Incomplete +PR_EMS_AB_CONNECTED_DOMAINS_A: Incomplete +PR_EMS_AB_CONNECTED_DOMAINS_W: Incomplete +PR_EMS_AB_CONTAINER_INFO: Incomplete +PR_EMS_AB_COST: Incomplete +PR_EMS_AB_COUNTRY_NAME: Incomplete +PR_EMS_AB_COUNTRY_NAME_A: Incomplete +PR_EMS_AB_COUNTRY_NAME_W: Incomplete +PR_EMS_AB_CROSS_CERTIFICATE_PAIR: Incomplete +PR_EMS_AB_DELIV_CONT_LENGTH: Incomplete +PR_EMS_AB_DELIV_EITS: Incomplete +PR_EMS_AB_DELIV_EXT_CONT_TYPES: Incomplete +PR_EMS_AB_DELIVER_AND_REDIRECT: Incomplete +PR_EMS_AB_DELIVERY_MECHANISM: Incomplete +PR_EMS_AB_DESCRIPTION: Incomplete +PR_EMS_AB_DESCRIPTION_A: Incomplete +PR_EMS_AB_DESCRIPTION_W: Incomplete +PR_EMS_AB_DESTINATION_INDICATOR: Incomplete +PR_EMS_AB_DESTINATION_INDICATOR_A: Incomplete +PR_EMS_AB_DESTINATION_INDICATOR_W: Incomplete +PR_EMS_AB_DIAGNOSTIC_REG_KEY: Incomplete +PR_EMS_AB_DIAGNOSTIC_REG_KEY_A: Incomplete +PR_EMS_AB_DIAGNOSTIC_REG_KEY_W: Incomplete +PR_EMS_AB_DISPLAY_NAME_OVERRIDE: Incomplete +PR_EMS_AB_DL_MEM_REJECT_PERMS_BL: Incomplete +PR_EMS_AB_DL_MEM_REJECT_PERMS_BL_A: Incomplete +PR_EMS_AB_DL_MEM_REJECT_PERMS_BL_W: Incomplete +PR_EMS_AB_DL_MEM_REJECT_PERMS_BL_O: Incomplete +PR_EMS_AB_DL_MEM_REJECT_PERMS_BL_T: Incomplete +PR_EMS_AB_DL_MEM_SUBMIT_PERMS_BL: Incomplete +PR_EMS_AB_DL_MEM_SUBMIT_PERMS_BL_A: Incomplete +PR_EMS_AB_DL_MEM_SUBMIT_PERMS_BL_W: Incomplete +PR_EMS_AB_DL_MEM_SUBMIT_PERMS_BL_O: Incomplete +PR_EMS_AB_DL_MEM_SUBMIT_PERMS_BL_T: Incomplete +PR_EMS_AB_DL_MEMBER_RULE: Incomplete +PR_EMS_AB_DOMAIN_DEF_ALT_RECIP: Incomplete +PR_EMS_AB_DOMAIN_DEF_ALT_RECIP_A: Incomplete +PR_EMS_AB_DOMAIN_DEF_ALT_RECIP_W: Incomplete +PR_EMS_AB_DOMAIN_DEF_ALT_RECIP_O: Incomplete +PR_EMS_AB_DOMAIN_DEF_ALT_RECIP_T: Incomplete +PR_EMS_AB_DOMAIN_NAME: Incomplete +PR_EMS_AB_DOMAIN_NAME_A: Incomplete +PR_EMS_AB_DOMAIN_NAME_W: Incomplete +PR_EMS_AB_DSA_SIGNATURE: Incomplete +PR_EMS_AB_DXA_ADMIN_COPY: Incomplete +PR_EMS_AB_DXA_ADMIN_FORWARD: Incomplete +PR_EMS_AB_DXA_ADMIN_UPDATE: Incomplete +PR_EMS_AB_DXA_APPEND_REQCN: Incomplete +PR_EMS_AB_DXA_CONF_CONTAINER_LIST: Incomplete +PR_EMS_AB_DXA_CONF_CONTAINER_LIST_A: Incomplete +PR_EMS_AB_DXA_CONF_CONTAINER_LIST_W: Incomplete +PR_EMS_AB_DXA_CONF_CONTAINER_LIST_O: Incomplete +PR_EMS_AB_DXA_CONF_CONTAINER_LIST_T: Incomplete +PR_EMS_AB_DXA_CONF_REQ_TIME: Incomplete +PR_EMS_AB_DXA_CONF_SEQ: Incomplete +PR_EMS_AB_DXA_CONF_SEQ_A: Incomplete +PR_EMS_AB_DXA_CONF_SEQ_W: Incomplete +PR_EMS_AB_DXA_CONF_SEQ_USN: Incomplete +PR_EMS_AB_DXA_EXCHANGE_OPTIONS: Incomplete +PR_EMS_AB_DXA_EXPORT_NOW: Incomplete +PR_EMS_AB_DXA_FLAGS: Incomplete +PR_EMS_AB_DXA_IMP_SEQ: Incomplete +PR_EMS_AB_DXA_IMP_SEQ_A: Incomplete +PR_EMS_AB_DXA_IMP_SEQ_W: Incomplete +PR_EMS_AB_DXA_IMP_SEQ_TIME: Incomplete +PR_EMS_AB_DXA_IMP_SEQ_USN: Incomplete +PR_EMS_AB_DXA_IMPORT_NOW: Incomplete +PR_EMS_AB_DXA_IN_TEMPLATE_MAP: Incomplete +PR_EMS_AB_DXA_IN_TEMPLATE_MAP_A: Incomplete +PR_EMS_AB_DXA_IN_TEMPLATE_MAP_W: Incomplete +PR_EMS_AB_DXA_LOCAL_ADMIN: Incomplete +PR_EMS_AB_DXA_LOCAL_ADMIN_A: Incomplete +PR_EMS_AB_DXA_LOCAL_ADMIN_W: Incomplete +PR_EMS_AB_DXA_LOCAL_ADMIN_O: Incomplete +PR_EMS_AB_DXA_LOCAL_ADMIN_T: Incomplete +PR_EMS_AB_DXA_LOGGING_LEVEL: Incomplete +PR_EMS_AB_DXA_NATIVE_ADDRESS_TYPE: Incomplete +PR_EMS_AB_DXA_NATIVE_ADDRESS_TYPE_A: Incomplete +PR_EMS_AB_DXA_NATIVE_ADDRESS_TYPE_W: Incomplete +PR_EMS_AB_DXA_OUT_TEMPLATE_MAP: Incomplete +PR_EMS_AB_DXA_OUT_TEMPLATE_MAP_A: Incomplete +PR_EMS_AB_DXA_OUT_TEMPLATE_MAP_W: Incomplete +PR_EMS_AB_DXA_PASSWORD: Incomplete +PR_EMS_AB_DXA_PASSWORD_A: Incomplete +PR_EMS_AB_DXA_PASSWORD_W: Incomplete +PR_EMS_AB_DXA_PREV_EXCHANGE_OPTIONS: Incomplete +PR_EMS_AB_DXA_PREV_EXPORT_NATIVE_ONLY: Incomplete +PR_EMS_AB_DXA_PREV_IN_EXCHANGE_SENSITIVITY: Incomplete +PR_EMS_AB_DXA_PREV_REMOTE_ENTRIES: Incomplete +PR_EMS_AB_DXA_PREV_REMOTE_ENTRIES_A: Incomplete +PR_EMS_AB_DXA_PREV_REMOTE_ENTRIES_W: Incomplete +PR_EMS_AB_DXA_PREV_REMOTE_ENTRIES_O: Incomplete +PR_EMS_AB_DXA_PREV_REMOTE_ENTRIES_T: Incomplete +PR_EMS_AB_DXA_PREV_REPLICATION_SENSITIVITY: Incomplete +PR_EMS_AB_DXA_PREV_TEMPLATE_OPTIONS: Incomplete +PR_EMS_AB_DXA_PREV_TYPES: Incomplete +PR_EMS_AB_DXA_RECIPIENT_CP: Incomplete +PR_EMS_AB_DXA_RECIPIENT_CP_A: Incomplete +PR_EMS_AB_DXA_RECIPIENT_CP_W: Incomplete +PR_EMS_AB_DXA_REMOTE_CLIENT: Incomplete +PR_EMS_AB_DXA_REMOTE_CLIENT_A: Incomplete +PR_EMS_AB_DXA_REMOTE_CLIENT_W: Incomplete +PR_EMS_AB_DXA_REMOTE_CLIENT_O: Incomplete +PR_EMS_AB_DXA_REMOTE_CLIENT_T: Incomplete +PR_EMS_AB_DXA_REQ_SEQ: Incomplete +PR_EMS_AB_DXA_REQ_SEQ_A: Incomplete +PR_EMS_AB_DXA_REQ_SEQ_W: Incomplete +PR_EMS_AB_DXA_REQ_SEQ_TIME: Incomplete +PR_EMS_AB_DXA_REQ_SEQ_USN: Incomplete +PR_EMS_AB_DXA_REQNAME: Incomplete +PR_EMS_AB_DXA_REQNAME_A: Incomplete +PR_EMS_AB_DXA_REQNAME_W: Incomplete +PR_EMS_AB_DXA_SVR_SEQ: Incomplete +PR_EMS_AB_DXA_SVR_SEQ_A: Incomplete +PR_EMS_AB_DXA_SVR_SEQ_W: Incomplete +PR_EMS_AB_DXA_SVR_SEQ_TIME: Incomplete +PR_EMS_AB_DXA_SVR_SEQ_USN: Incomplete +PR_EMS_AB_DXA_TASK: Incomplete +PR_EMS_AB_DXA_TEMPLATE_OPTIONS: Incomplete +PR_EMS_AB_DXA_TEMPLATE_TIMESTAMP: Incomplete +PR_EMS_AB_DXA_TYPES: Incomplete +PR_EMS_AB_DXA_UNCONF_CONTAINER_LIST: Incomplete +PR_EMS_AB_DXA_UNCONF_CONTAINER_LIST_A: Incomplete +PR_EMS_AB_DXA_UNCONF_CONTAINER_LIST_W: Incomplete +PR_EMS_AB_DXA_UNCONF_CONTAINER_LIST_O: Incomplete +PR_EMS_AB_DXA_UNCONF_CONTAINER_LIST_T: Incomplete +PR_EMS_AB_ENABLED_PROTOCOLS: Incomplete +PR_EMS_AB_ENCAPSULATION_METHOD: Incomplete +PR_EMS_AB_ENCRYPT: Incomplete +PR_EMS_AB_ENCRYPT_ALG_LIST_NA: Incomplete +PR_EMS_AB_ENCRYPT_ALG_LIST_NA_A: Incomplete +PR_EMS_AB_ENCRYPT_ALG_LIST_NA_W: Incomplete +PR_EMS_AB_ENCRYPT_ALG_LIST_OTHER: Incomplete +PR_EMS_AB_ENCRYPT_ALG_LIST_OTHER_A: Incomplete +PR_EMS_AB_ENCRYPT_ALG_LIST_OTHER_W: Incomplete +PR_EMS_AB_ENCRYPT_ALG_SELECTED_NA: Incomplete +PR_EMS_AB_ENCRYPT_ALG_SELECTED_NA_A: Incomplete +PR_EMS_AB_ENCRYPT_ALG_SELECTED_NA_W: Incomplete +PR_EMS_AB_ENCRYPT_ALG_SELECTED_OTHER: Incomplete +PR_EMS_AB_ENCRYPT_ALG_SELECTED_OTHER_A: Incomplete +PR_EMS_AB_ENCRYPT_ALG_SELECTED_OTHER_W: Incomplete +PR_EMS_AB_EXPAND_DLS_LOCALLY: Incomplete +PR_EMS_AB_EXPIRATION_TIME: Incomplete +PR_EMS_AB_EXPORT_CONTAINERS: Incomplete +PR_EMS_AB_EXPORT_CONTAINERS_A: Incomplete +PR_EMS_AB_EXPORT_CONTAINERS_W: Incomplete +PR_EMS_AB_EXPORT_CONTAINERS_O: Incomplete +PR_EMS_AB_EXPORT_CONTAINERS_T: Incomplete +PR_EMS_AB_EXPORT_CUSTOM_RECIPIENTS: Incomplete +PR_EMS_AB_EXTENDED_CHARS_ALLOWED: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_1: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_1_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_1_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_10: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_10_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_10_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_2: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_2_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_2_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_3: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_3_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_3_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_4: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_4_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_4_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_5: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_5_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_5_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_6: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_6_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_6_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_7: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_7_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_7_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_8: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_8_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_8_W: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_9: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_9_A: Incomplete +PR_EMS_AB_EXTENSION_ATTRIBUTE_9_W: Incomplete +PR_EMS_AB_EXTENSION_DATA: Incomplete +PR_EMS_AB_EXTENSION_NAME: Incomplete +PR_EMS_AB_EXTENSION_NAME_A: Incomplete +PR_EMS_AB_EXTENSION_NAME_W: Incomplete +PR_EMS_AB_EXTENSION_NAME_INHERITED: Incomplete +PR_EMS_AB_EXTENSION_NAME_INHERITED_A: Incomplete +PR_EMS_AB_EXTENSION_NAME_INHERITED_W: Incomplete +PR_EMS_AB_FACSIMILE_TELEPHONE_NUMBER: Incomplete +PR_EMS_AB_FILE_VERSION: Incomplete +PR_EMS_AB_FILTER_LOCAL_ADDRESSES: Incomplete +PR_EMS_AB_FOLDER_PATHNAME: Incomplete +PR_EMS_AB_FOLDER_PATHNAME_A: Incomplete +PR_EMS_AB_FOLDER_PATHNAME_W: Incomplete +PR_EMS_AB_FOLDERS_CONTAINER: Incomplete +PR_EMS_AB_FOLDERS_CONTAINER_A: Incomplete +PR_EMS_AB_FOLDERS_CONTAINER_W: Incomplete +PR_EMS_AB_FOLDERS_CONTAINER_O: Incomplete +PR_EMS_AB_FOLDERS_CONTAINER_T: Incomplete +PR_EMS_AB_GARBAGE_COLL_PERIOD: Incomplete +PR_EMS_AB_GATEWAY_LOCAL_CRED: Incomplete +PR_EMS_AB_GATEWAY_LOCAL_CRED_A: Incomplete +PR_EMS_AB_GATEWAY_LOCAL_CRED_W: Incomplete +PR_EMS_AB_GATEWAY_LOCAL_DESIG: Incomplete +PR_EMS_AB_GATEWAY_LOCAL_DESIG_A: Incomplete +PR_EMS_AB_GATEWAY_LOCAL_DESIG_W: Incomplete +PR_EMS_AB_GATEWAY_PROXY: Incomplete +PR_EMS_AB_GATEWAY_PROXY_A: Incomplete +PR_EMS_AB_GATEWAY_PROXY_W: Incomplete +PR_EMS_AB_GATEWAY_ROUTING_TREE: Incomplete +PR_EMS_AB_GWART_LAST_MODIFIED: Incomplete +PR_EMS_AB_HAS_FULL_REPLICA_NCS: Incomplete +PR_EMS_AB_HAS_FULL_REPLICA_NCS_A: Incomplete +PR_EMS_AB_HAS_FULL_REPLICA_NCS_W: Incomplete +PR_EMS_AB_HAS_FULL_REPLICA_NCS_O: Incomplete +PR_EMS_AB_HAS_FULL_REPLICA_NCS_T: Incomplete +PR_EMS_AB_HAS_MASTER_NCS: Incomplete +PR_EMS_AB_HAS_MASTER_NCS_A: Incomplete +PR_EMS_AB_HAS_MASTER_NCS_W: Incomplete +PR_EMS_AB_HAS_MASTER_NCS_O: Incomplete +PR_EMS_AB_HAS_MASTER_NCS_T: Incomplete +PR_EMS_AB_HELP_DATA16: Incomplete +PR_EMS_AB_HELP_DATA32: Incomplete +PR_EMS_AB_HELP_FILE_NAME: Incomplete +PR_EMS_AB_HELP_FILE_NAME_A: Incomplete +PR_EMS_AB_HELP_FILE_NAME_W: Incomplete +PR_EMS_AB_HEURISTICS: Incomplete +PR_EMS_AB_HIDE_DL_MEMBERSHIP: Incomplete +PR_EMS_AB_HIDE_FROM_ADDRESS_BOOK: Incomplete +PR_EMS_AB_HOME_MDB: Incomplete +PR_EMS_AB_HOME_MDB_A: Incomplete +PR_EMS_AB_HOME_MDB_W: Incomplete +PR_EMS_AB_HOME_MDB_O: Incomplete +PR_EMS_AB_HOME_MDB_T: Incomplete +PR_EMS_AB_HOME_MDB_BL: Incomplete +PR_EMS_AB_HOME_MDB_BL_A: Incomplete +PR_EMS_AB_HOME_MDB_BL_W: Incomplete +PR_EMS_AB_HOME_MDB_BL_O: Incomplete +PR_EMS_AB_HOME_MDB_BL_T: Incomplete +PR_EMS_AB_HOME_MTA: Incomplete +PR_EMS_AB_HOME_MTA_A: Incomplete +PR_EMS_AB_HOME_MTA_W: Incomplete +PR_EMS_AB_HOME_MTA_O: Incomplete +PR_EMS_AB_HOME_MTA_T: Incomplete +PR_EMS_AB_HOME_PUBLIC_SERVER: Incomplete +PR_EMS_AB_HOME_PUBLIC_SERVER_A: Incomplete +PR_EMS_AB_HOME_PUBLIC_SERVER_W: Incomplete +PR_EMS_AB_HOME_PUBLIC_SERVER_O: Incomplete +PR_EMS_AB_HOME_PUBLIC_SERVER_T: Incomplete +PR_EMS_AB_IMPORT_CONTAINER: Incomplete +PR_EMS_AB_IMPORT_CONTAINER_A: Incomplete +PR_EMS_AB_IMPORT_CONTAINER_W: Incomplete +PR_EMS_AB_IMPORT_CONTAINER_O: Incomplete +PR_EMS_AB_IMPORT_CONTAINER_T: Incomplete +PR_EMS_AB_IMPORT_SENSITIVITY: Incomplete +PR_EMS_AB_IMPORTED_FROM: Incomplete +PR_EMS_AB_IMPORTED_FROM_A: Incomplete +PR_EMS_AB_IMPORTED_FROM_W: Incomplete +PR_EMS_AB_INBOUND_SITES: Incomplete +PR_EMS_AB_INBOUND_SITES_A: Incomplete +PR_EMS_AB_INBOUND_SITES_W: Incomplete +PR_EMS_AB_INBOUND_SITES_O: Incomplete +PR_EMS_AB_INBOUND_SITES_T: Incomplete +PR_EMS_AB_INSTANCE_TYPE: Incomplete +PR_EMS_AB_INTERNATIONAL_ISDN_NUMBER: Incomplete +PR_EMS_AB_INTERNATIONAL_ISDN_NUMBER_A: Incomplete +PR_EMS_AB_INTERNATIONAL_ISDN_NUMBER_W: Incomplete +PR_EMS_AB_INVOCATION_ID: Incomplete +PR_EMS_AB_IS_DELETED: Incomplete +PR_EMS_AB_IS_MEMBER_OF_DL: Incomplete +PR_EMS_AB_IS_MEMBER_OF_DL_A: Incomplete +PR_EMS_AB_IS_MEMBER_OF_DL_W: Incomplete +PR_EMS_AB_IS_MEMBER_OF_DL_O: Incomplete +PR_EMS_AB_IS_MEMBER_OF_DL_T: Incomplete +PR_EMS_AB_IS_SINGLE_VALUED: Incomplete +PR_EMS_AB_KCC_STATUS: Incomplete +PR_EMS_AB_KM_SERVER: Incomplete +PR_EMS_AB_KM_SERVER_A: Incomplete +PR_EMS_AB_KM_SERVER_W: Incomplete +PR_EMS_AB_KM_SERVER_O: Incomplete +PR_EMS_AB_KM_SERVER_T: Incomplete +PR_EMS_AB_KNOWLEDGE_INFORMATION: Incomplete +PR_EMS_AB_KNOWLEDGE_INFORMATION_A: Incomplete +PR_EMS_AB_KNOWLEDGE_INFORMATION_W: Incomplete +PR_EMS_AB_LANGUAGE: Incomplete +PR_EMS_AB_LDAP_DISPLAY_NAME: Incomplete +PR_EMS_AB_LDAP_DISPLAY_NAME_A: Incomplete +PR_EMS_AB_LDAP_DISPLAY_NAME_W: Incomplete +PR_EMS_AB_LINE_WRAP: Incomplete +PR_EMS_AB_LINK_ID: Incomplete +PR_EMS_AB_LOCAL_BRIDGE_HEAD: Incomplete +PR_EMS_AB_LOCAL_BRIDGE_HEAD_A: Incomplete +PR_EMS_AB_LOCAL_BRIDGE_HEAD_W: Incomplete +PR_EMS_AB_LOCAL_BRIDGE_HEAD_ADDRESS: Incomplete +PR_EMS_AB_LOCAL_BRIDGE_HEAD_ADDRESS_A: Incomplete +PR_EMS_AB_LOCAL_BRIDGE_HEAD_ADDRESS_W: Incomplete +PR_EMS_AB_LOCAL_INITIAL_TURN: Incomplete +PR_EMS_AB_LOCAL_SCOPE: Incomplete +PR_EMS_AB_LOCAL_SCOPE_A: Incomplete +PR_EMS_AB_LOCAL_SCOPE_W: Incomplete +PR_EMS_AB_LOCAL_SCOPE_O: Incomplete +PR_EMS_AB_LOCAL_SCOPE_T: Incomplete +PR_EMS_AB_LOG_FILENAME: Incomplete +PR_EMS_AB_LOG_FILENAME_A: Incomplete +PR_EMS_AB_LOG_FILENAME_W: Incomplete +PR_EMS_AB_LOG_ROLLOVER_INTERVAL: Incomplete +PR_EMS_AB_MAINTAIN_AUTOREPLY_HISTORY: Incomplete +PR_EMS_AB_MANAGER: Incomplete +PR_EMS_AB_MANAGER_A: Incomplete +PR_EMS_AB_MANAGER_W: Incomplete +PR_EMS_AB_MANAGER_O: Incomplete +PR_EMS_AB_MANAGER_T: Incomplete +PR_EMS_AB_MAPI_DISPLAY_TYPE: Incomplete +PR_EMS_AB_MAPI_ID: Incomplete +PR_EMS_AB_MAXIMUM_OBJECT_ID: Incomplete +PR_EMS_AB_MDB_BACKOFF_INTERVAL: Incomplete +PR_EMS_AB_MDB_MSG_TIME_OUT_PERIOD: Incomplete +PR_EMS_AB_MDB_OVER_QUOTA_LIMIT: Incomplete +PR_EMS_AB_MDB_STORAGE_QUOTA: Incomplete +PR_EMS_AB_MDB_UNREAD_LIMIT: Incomplete +PR_EMS_AB_MDB_USE_DEFAULTS: Incomplete +PR_EMS_AB_MEMBER: Incomplete +PR_EMS_AB_MEMBER_A: Incomplete +PR_EMS_AB_MEMBER_W: Incomplete +PR_EMS_AB_MEMBER_O: Incomplete +PR_EMS_AB_MEMBER_T: Incomplete +PR_EMS_AB_MESSAGE_TRACKING_ENABLED: Incomplete +PR_EMS_AB_MONITOR_CLOCK: Incomplete +PR_EMS_AB_MONITOR_SERVERS: Incomplete +PR_EMS_AB_MONITOR_SERVICES: Incomplete +PR_EMS_AB_MONITORED_CONFIGURATIONS: Incomplete +PR_EMS_AB_MONITORED_CONFIGURATIONS_A: Incomplete +PR_EMS_AB_MONITORED_CONFIGURATIONS_W: Incomplete +PR_EMS_AB_MONITORED_CONFIGURATIONS_O: Incomplete +PR_EMS_AB_MONITORED_CONFIGURATIONS_T: Incomplete +PR_EMS_AB_MONITORED_SERVERS: Incomplete +PR_EMS_AB_MONITORED_SERVERS_A: Incomplete +PR_EMS_AB_MONITORED_SERVERS_W: Incomplete +PR_EMS_AB_MONITORED_SERVERS_O: Incomplete +PR_EMS_AB_MONITORED_SERVERS_T: Incomplete +PR_EMS_AB_MONITORED_SERVICES: Incomplete +PR_EMS_AB_MONITORED_SERVICES_A: Incomplete +PR_EMS_AB_MONITORED_SERVICES_W: Incomplete +PR_EMS_AB_MONITORING_ALERT_DELAY: Incomplete +PR_EMS_AB_MONITORING_ALERT_UNITS: Incomplete +PR_EMS_AB_MONITORING_AVAILABILITY_STYLE: Incomplete +PR_EMS_AB_MONITORING_AVAILABILITY_WINDOW: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_MAIL: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_MAIL_A: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_MAIL_W: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_MAIL_O: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_MAIL_T: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_RPC: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_RPC_A: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_RPC_W: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_RPC_O: Incomplete +PR_EMS_AB_MONITORING_CACHED_VIA_RPC_T: Incomplete +PR_EMS_AB_MONITORING_ESCALATION_PROCEDURE: Incomplete +PR_EMS_AB_MONITORING_HOTSITE_POLL_INTERVAL: Incomplete +PR_EMS_AB_MONITORING_HOTSITE_POLL_UNITS: Incomplete +PR_EMS_AB_MONITORING_MAIL_UPDATE_INTERVAL: Incomplete +PR_EMS_AB_MONITORING_MAIL_UPDATE_UNITS: Incomplete +PR_EMS_AB_MONITORING_NORMAL_POLL_INTERVAL: Incomplete +PR_EMS_AB_MONITORING_NORMAL_POLL_UNITS: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_A: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_W: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_O: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_T: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_NDR: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_NDR_A: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_NDR_W: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_NDR_O: Incomplete +PR_EMS_AB_MONITORING_RECIPIENTS_NDR_T: Incomplete +PR_EMS_AB_MONITORING_RPC_UPDATE_INTERVAL: Incomplete +PR_EMS_AB_MONITORING_RPC_UPDATE_UNITS: Incomplete +PR_EMS_AB_MONITORING_WARNING_DELAY: Incomplete +PR_EMS_AB_MONITORING_WARNING_UNITS: Incomplete +PR_EMS_AB_MTA_LOCAL_CRED: Incomplete +PR_EMS_AB_MTA_LOCAL_CRED_A: Incomplete +PR_EMS_AB_MTA_LOCAL_CRED_W: Incomplete +PR_EMS_AB_MTA_LOCAL_DESIG: Incomplete +PR_EMS_AB_MTA_LOCAL_DESIG_A: Incomplete +PR_EMS_AB_MTA_LOCAL_DESIG_W: Incomplete +PR_EMS_AB_N_ADDRESS: Incomplete +PR_EMS_AB_N_ADDRESS_TYPE: Incomplete +PR_EMS_AB_NETWORK_ADDRESS: Incomplete +PR_EMS_AB_NETWORK_ADDRESS_A: Incomplete +PR_EMS_AB_NETWORK_ADDRESS_W: Incomplete +PR_EMS_AB_NNTP_CHARACTER_SET: Incomplete +PR_EMS_AB_NNTP_CHARACTER_SET_A: Incomplete +PR_EMS_AB_NNTP_CHARACTER_SET_W: Incomplete +PR_EMS_AB_NNTP_CONTENT_FORMAT: Incomplete +PR_EMS_AB_NNTP_CONTENT_FORMAT_A: Incomplete +PR_EMS_AB_NNTP_CONTENT_FORMAT_W: Incomplete +PR_EMS_AB_NT_MACHINE_NAME: Incomplete +PR_EMS_AB_NT_MACHINE_NAME_A: Incomplete +PR_EMS_AB_NT_MACHINE_NAME_W: Incomplete +PR_EMS_AB_NT_SECURITY_DESCRIPTOR: Incomplete +PR_EMS_AB_NUM_OF_OPEN_RETRIES: Incomplete +PR_EMS_AB_NUM_OF_TRANSFER_RETRIES: Incomplete +PR_EMS_AB_OBJ_DIST_NAME: Incomplete +PR_EMS_AB_OBJ_DIST_NAME_A: Incomplete +PR_EMS_AB_OBJ_DIST_NAME_W: Incomplete +PR_EMS_AB_OBJ_DIST_NAME_O: Incomplete +PR_EMS_AB_OBJ_DIST_NAME_T: Incomplete +PR_EMS_AB_OBJECT_CLASS_CATEGORY: Incomplete +PR_EMS_AB_OBJECT_VERSION: Incomplete +PR_EMS_AB_OFF_LINE_AB_CONTAINERS: Incomplete +PR_EMS_AB_OFF_LINE_AB_CONTAINERS_A: Incomplete +PR_EMS_AB_OFF_LINE_AB_CONTAINERS_W: Incomplete +PR_EMS_AB_OFF_LINE_AB_CONTAINERS_O: Incomplete +PR_EMS_AB_OFF_LINE_AB_CONTAINERS_T: Incomplete +PR_EMS_AB_OFF_LINE_AB_SCHEDULE: Incomplete +PR_EMS_AB_OFF_LINE_AB_SERVER: Incomplete +PR_EMS_AB_OFF_LINE_AB_SERVER_A: Incomplete +PR_EMS_AB_OFF_LINE_AB_SERVER_W: Incomplete +PR_EMS_AB_OFF_LINE_AB_SERVER_O: Incomplete +PR_EMS_AB_OFF_LINE_AB_SERVER_T: Incomplete +PR_EMS_AB_OFF_LINE_AB_STYLE: Incomplete +PR_EMS_AB_OID_TYPE: Incomplete +PR_EMS_AB_OM_OBJECT_CLASS: Incomplete +PR_EMS_AB_OM_SYNTAX: Incomplete +PR_EMS_AB_OOF_REPLY_TO_ORIGINATOR: Incomplete +PR_EMS_AB_OPEN_RETRY_INTERVAL: Incomplete +PR_EMS_AB_ORGANIZATION_NAME: Incomplete +PR_EMS_AB_ORGANIZATION_NAME_A: Incomplete +PR_EMS_AB_ORGANIZATION_NAME_W: Incomplete +PR_EMS_AB_ORGANIZATIONAL_UNIT_NAME: Incomplete +PR_EMS_AB_ORGANIZATIONAL_UNIT_NAME_A: Incomplete +PR_EMS_AB_ORGANIZATIONAL_UNIT_NAME_W: Incomplete +PR_EMS_AB_ORIGINAL_DISPLAY_TABLE: Incomplete +PR_EMS_AB_ORIGINAL_DISPLAY_TABLE_MSDOS: Incomplete +PR_EMS_AB_OUTBOUND_SITES: Incomplete +PR_EMS_AB_OUTBOUND_SITES_A: Incomplete +PR_EMS_AB_OUTBOUND_SITES_W: Incomplete +PR_EMS_AB_OUTBOUND_SITES_O: Incomplete +PR_EMS_AB_OUTBOUND_SITES_T: Incomplete +PR_EMS_AB_OWNER: Incomplete +PR_EMS_AB_OWNER_A: Incomplete +PR_EMS_AB_OWNER_W: Incomplete +PR_EMS_AB_OWNER_O: Incomplete +PR_EMS_AB_OWNER_T: Incomplete +PR_EMS_AB_OWNER_BL: Incomplete +PR_EMS_AB_OWNER_BL_A: Incomplete +PR_EMS_AB_OWNER_BL_W: Incomplete +PR_EMS_AB_OWNER_BL_O: Incomplete +PR_EMS_AB_OWNER_BL_T: Incomplete +PR_EMS_AB_P_SELECTOR: Incomplete +PR_EMS_AB_P_SELECTOR_INBOUND: Incomplete +PR_EMS_AB_PER_MSG_DIALOG_DISPLAY_TABLE: Incomplete +PR_EMS_AB_PER_RECIP_DIALOG_DISPLAY_TABLE: Incomplete +PR_EMS_AB_PERIOD_REP_SYNC_TIMES: Incomplete +PR_EMS_AB_PERIOD_REPL_STAGGER: Incomplete +PR_EMS_AB_PF_CONTACTS: Incomplete +PR_EMS_AB_PF_CONTACTS_A: Incomplete +PR_EMS_AB_PF_CONTACTS_W: Incomplete +PR_EMS_AB_PF_CONTACTS_O: Incomplete +PR_EMS_AB_PF_CONTACTS_T: Incomplete +PR_EMS_AB_POP_CHARACTER_SET: Incomplete +PR_EMS_AB_POP_CHARACTER_SET_A: Incomplete +PR_EMS_AB_POP_CHARACTER_SET_W: Incomplete +PR_EMS_AB_POP_CONTENT_FORMAT: Incomplete +PR_EMS_AB_POP_CONTENT_FORMAT_A: Incomplete +PR_EMS_AB_POP_CONTENT_FORMAT_W: Incomplete +PR_EMS_AB_POSTAL_ADDRESS: Incomplete +PR_EMS_AB_PREFERRED_DELIVERY_METHOD: Incomplete +PR_EMS_AB_PRMD: Incomplete +PR_EMS_AB_PRMD_A: Incomplete +PR_EMS_AB_PRMD_W: Incomplete +PR_EMS_AB_PROXY_ADDRESSES: Incomplete +PR_EMS_AB_PROXY_ADDRESSES_A: Incomplete +PR_EMS_AB_PROXY_ADDRESSES_W: Incomplete +PR_EMS_AB_PROXY_GENERATOR_DLL: Incomplete +PR_EMS_AB_PROXY_GENERATOR_DLL_A: Incomplete +PR_EMS_AB_PROXY_GENERATOR_DLL_W: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_A: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_W: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_O: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_T: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_BL: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_BL_A: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_BL_W: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_BL_O: Incomplete +PR_EMS_AB_PUBLIC_DELEGATES_BL_T: Incomplete +PR_EMS_AB_QUOTA_NOTIFICATION_SCHEDULE: Incomplete +PR_EMS_AB_QUOTA_NOTIFICATION_STYLE: Incomplete +PR_EMS_AB_RANGE_LOWER: Incomplete +PR_EMS_AB_RANGE_UPPER: Incomplete +PR_EMS_AB_RAS_CALLBACK_NUMBER: Incomplete +PR_EMS_AB_RAS_CALLBACK_NUMBER_A: Incomplete +PR_EMS_AB_RAS_CALLBACK_NUMBER_W: Incomplete +PR_EMS_AB_RAS_PHONE_NUMBER: Incomplete +PR_EMS_AB_RAS_PHONE_NUMBER_A: Incomplete +PR_EMS_AB_RAS_PHONE_NUMBER_W: Incomplete +PR_EMS_AB_RAS_PHONEBOOK_ENTRY_NAME: Incomplete +PR_EMS_AB_RAS_PHONEBOOK_ENTRY_NAME_A: Incomplete +PR_EMS_AB_RAS_PHONEBOOK_ENTRY_NAME_W: Incomplete +PR_EMS_AB_RAS_REMOTE_SRVR_NAME: Incomplete +PR_EMS_AB_RAS_REMOTE_SRVR_NAME_A: Incomplete +PR_EMS_AB_RAS_REMOTE_SRVR_NAME_W: Incomplete +PR_EMS_AB_REGISTERED_ADDRESS: Incomplete +PR_EMS_AB_REMOTE_BRIDGE_HEAD: Incomplete +PR_EMS_AB_REMOTE_BRIDGE_HEAD_A: Incomplete +PR_EMS_AB_REMOTE_BRIDGE_HEAD_W: Incomplete +PR_EMS_AB_REMOTE_BRIDGE_HEAD_ADDRESS: Incomplete +PR_EMS_AB_REMOTE_BRIDGE_HEAD_ADDRESS_A: Incomplete +PR_EMS_AB_REMOTE_BRIDGE_HEAD_ADDRESS_W: Incomplete +PR_EMS_AB_REMOTE_OUT_BH_SERVER: Incomplete +PR_EMS_AB_REMOTE_OUT_BH_SERVER_A: Incomplete +PR_EMS_AB_REMOTE_OUT_BH_SERVER_W: Incomplete +PR_EMS_AB_REMOTE_OUT_BH_SERVER_O: Incomplete +PR_EMS_AB_REMOTE_OUT_BH_SERVER_T: Incomplete +PR_EMS_AB_REMOTE_SITE: Incomplete +PR_EMS_AB_REMOTE_SITE_A: Incomplete +PR_EMS_AB_REMOTE_SITE_W: Incomplete +PR_EMS_AB_REMOTE_SITE_O: Incomplete +PR_EMS_AB_REMOTE_SITE_T: Incomplete +PR_EMS_AB_REPLICATION_MAIL_MSG_SIZE: Incomplete +PR_EMS_AB_REPLICATION_SENSITIVITY: Incomplete +PR_EMS_AB_REPLICATION_STAGGER: Incomplete +PR_EMS_AB_REPORT_TO_ORIGINATOR: Incomplete +PR_EMS_AB_REPORT_TO_OWNER: Incomplete +PR_EMS_AB_REPORTS: Incomplete +PR_EMS_AB_REPORTS_A: Incomplete +PR_EMS_AB_REPORTS_W: Incomplete +PR_EMS_AB_REPORTS_O: Incomplete +PR_EMS_AB_REPORTS_T: Incomplete +PR_EMS_AB_REQ_SEQ: Incomplete +PR_EMS_AB_RESPONSIBLE_LOCAL_DXA: Incomplete +PR_EMS_AB_RESPONSIBLE_LOCAL_DXA_A: Incomplete +PR_EMS_AB_RESPONSIBLE_LOCAL_DXA_W: Incomplete +PR_EMS_AB_RESPONSIBLE_LOCAL_DXA_O: Incomplete +PR_EMS_AB_RESPONSIBLE_LOCAL_DXA_T: Incomplete +PR_EMS_AB_RID_SERVER: Incomplete +PR_EMS_AB_RID_SERVER_A: Incomplete +PR_EMS_AB_RID_SERVER_W: Incomplete +PR_EMS_AB_RID_SERVER_O: Incomplete +PR_EMS_AB_RID_SERVER_T: Incomplete +PR_EMS_AB_ROLE_OCCUPANT: Incomplete +PR_EMS_AB_ROLE_OCCUPANT_A: Incomplete +PR_EMS_AB_ROLE_OCCUPANT_W: Incomplete +PR_EMS_AB_ROLE_OCCUPANT_O: Incomplete +PR_EMS_AB_ROLE_OCCUPANT_T: Incomplete +PR_EMS_AB_ROUTING_LIST: Incomplete +PR_EMS_AB_ROUTING_LIST_A: Incomplete +PR_EMS_AB_ROUTING_LIST_W: Incomplete +PR_EMS_AB_RTS_CHECKPOINT_SIZE: Incomplete +PR_EMS_AB_RTS_RECOVERY_TIMEOUT: Incomplete +PR_EMS_AB_RTS_WINDOW_SIZE: Incomplete +PR_EMS_AB_RUNS_ON: Incomplete +PR_EMS_AB_RUNS_ON_A: Incomplete +PR_EMS_AB_RUNS_ON_W: Incomplete +PR_EMS_AB_RUNS_ON_O: Incomplete +PR_EMS_AB_RUNS_ON_T: Incomplete +PR_EMS_AB_S_SELECTOR: Incomplete +PR_EMS_AB_S_SELECTOR_INBOUND: Incomplete +PR_EMS_AB_SCHEMA_FLAGS: Incomplete +PR_EMS_AB_SCHEMA_VERSION: Incomplete +PR_EMS_AB_SEARCH_FLAGS: Incomplete +PR_EMS_AB_SEARCH_GUIDE: Incomplete +PR_EMS_AB_SECURITY_PROTOCOL: Incomplete +PR_EMS_AB_SEE_ALSO: Incomplete +PR_EMS_AB_SEE_ALSO_A: Incomplete +PR_EMS_AB_SEE_ALSO_W: Incomplete +PR_EMS_AB_SEE_ALSO_O: Incomplete +PR_EMS_AB_SEE_ALSO_T: Incomplete +PR_EMS_AB_SERIAL_NUMBER: Incomplete +PR_EMS_AB_SERIAL_NUMBER_A: Incomplete +PR_EMS_AB_SERIAL_NUMBER_W: Incomplete +PR_EMS_AB_SERVICE_ACTION_FIRST: Incomplete +PR_EMS_AB_SERVICE_ACTION_OTHER: Incomplete +PR_EMS_AB_SERVICE_ACTION_SECOND: Incomplete +PR_EMS_AB_SERVICE_RESTART_DELAY: Incomplete +PR_EMS_AB_SERVICE_RESTART_MESSAGE: Incomplete +PR_EMS_AB_SERVICE_RESTART_MESSAGE_A: Incomplete +PR_EMS_AB_SERVICE_RESTART_MESSAGE_W: Incomplete +PR_EMS_AB_SESSION_DISCONNECT_TIMER: Incomplete +PR_EMS_AB_SITE_AFFINITY: Incomplete +PR_EMS_AB_SITE_AFFINITY_A: Incomplete +PR_EMS_AB_SITE_AFFINITY_W: Incomplete +PR_EMS_AB_SITE_FOLDER_GUID: Incomplete +PR_EMS_AB_SITE_FOLDER_SERVER: Incomplete +PR_EMS_AB_SITE_FOLDER_SERVER_A: Incomplete +PR_EMS_AB_SITE_FOLDER_SERVER_W: Incomplete +PR_EMS_AB_SITE_FOLDER_SERVER_O: Incomplete +PR_EMS_AB_SITE_FOLDER_SERVER_T: Incomplete +PR_EMS_AB_SITE_PROXY_SPACE: Incomplete +PR_EMS_AB_SITE_PROXY_SPACE_A: Incomplete +PR_EMS_AB_SITE_PROXY_SPACE_W: Incomplete +PR_EMS_AB_SPACE_LAST_COMPUTED: Incomplete +PR_EMS_AB_STREET_ADDRESS: Incomplete +PR_EMS_AB_STREET_ADDRESS_A: Incomplete +PR_EMS_AB_STREET_ADDRESS_W: Incomplete +PR_EMS_AB_SUB_REFS: Incomplete +PR_EMS_AB_SUB_REFS_A: Incomplete +PR_EMS_AB_SUB_REFS_W: Incomplete +PR_EMS_AB_SUB_REFS_O: Incomplete +PR_EMS_AB_SUB_REFS_T: Incomplete +PR_EMS_AB_SUB_SITE: Incomplete +PR_EMS_AB_SUB_SITE_A: Incomplete +PR_EMS_AB_SUB_SITE_W: Incomplete +PR_EMS_AB_SUBMISSION_CONT_LENGTH: Incomplete +PR_EMS_AB_SUPPORTED_APPLICATION_CONTEXT: Incomplete +PR_EMS_AB_SUPPORTING_STACK: Incomplete +PR_EMS_AB_SUPPORTING_STACK_A: Incomplete +PR_EMS_AB_SUPPORTING_STACK_W: Incomplete +PR_EMS_AB_SUPPORTING_STACK_O: Incomplete +PR_EMS_AB_SUPPORTING_STACK_T: Incomplete +PR_EMS_AB_SUPPORTING_STACK_BL: Incomplete +PR_EMS_AB_SUPPORTING_STACK_BL_A: Incomplete +PR_EMS_AB_SUPPORTING_STACK_BL_W: Incomplete +PR_EMS_AB_SUPPORTING_STACK_BL_O: Incomplete +PR_EMS_AB_SUPPORTING_STACK_BL_T: Incomplete +PR_EMS_AB_T_SELECTOR: Incomplete +PR_EMS_AB_T_SELECTOR_INBOUND: Incomplete +PR_EMS_AB_TARGET_ADDRESS: Incomplete +PR_EMS_AB_TARGET_ADDRESS_A: Incomplete +PR_EMS_AB_TARGET_ADDRESS_W: Incomplete +PR_EMS_AB_TARGET_MTAS: Incomplete +PR_EMS_AB_TARGET_MTAS_A: Incomplete +PR_EMS_AB_TARGET_MTAS_W: Incomplete +PR_EMS_AB_TELEPHONE_NUMBER: Incomplete +PR_EMS_AB_TELEPHONE_NUMBER_A: Incomplete +PR_EMS_AB_TELEPHONE_NUMBER_W: Incomplete +PR_EMS_AB_TELETEX_TERMINAL_IDENTIFIER: Incomplete +PR_EMS_AB_TEMP_ASSOC_THRESHOLD: Incomplete +PR_EMS_AB_TOMBSTONE_LIFETIME: Incomplete +PR_EMS_AB_TRACKING_LOG_PATH_NAME: Incomplete +PR_EMS_AB_TRACKING_LOG_PATH_NAME_A: Incomplete +PR_EMS_AB_TRACKING_LOG_PATH_NAME_W: Incomplete +PR_EMS_AB_TRANS_RETRY_MINS: Incomplete +PR_EMS_AB_TRANS_TIMEOUT_MINS: Incomplete +PR_EMS_AB_TRANSFER_RETRY_INTERVAL: Incomplete +PR_EMS_AB_TRANSFER_TIMEOUT_NON_URGENT: Incomplete +PR_EMS_AB_TRANSFER_TIMEOUT_NORMAL: Incomplete +PR_EMS_AB_TRANSFER_TIMEOUT_URGENT: Incomplete +PR_EMS_AB_TRANSLATION_TABLE_USED: Incomplete +PR_EMS_AB_TRANSPORT_EXPEDITED_DATA: Incomplete +PR_EMS_AB_TRUST_LEVEL: Incomplete +PR_EMS_AB_TURN_REQUEST_THRESHOLD: Incomplete +PR_EMS_AB_TWO_WAY_ALTERNATE_FACILITY: Incomplete +PR_EMS_AB_UNAUTH_ORIG_BL: Incomplete +PR_EMS_AB_UNAUTH_ORIG_BL_A: Incomplete +PR_EMS_AB_UNAUTH_ORIG_BL_W: Incomplete +PR_EMS_AB_UNAUTH_ORIG_BL_O: Incomplete +PR_EMS_AB_UNAUTH_ORIG_BL_T: Incomplete +PR_EMS_AB_USE_SERVER_VALUES: Incomplete +PR_EMS_AB_USER_PASSWORD: Incomplete +PR_EMS_AB_USN_CHANGED: Incomplete +PR_EMS_AB_USN_CREATED: Incomplete +PR_EMS_AB_USN_DSA_LAST_OBJ_REMOVED: Incomplete +PR_EMS_AB_USN_INTERSITE: Incomplete +PR_EMS_AB_USN_LAST_OBJ_REM: Incomplete +PR_EMS_AB_USN_SOURCE: Incomplete +PR_EMS_AB_WWW_HOME_PAGE: Incomplete +PR_EMS_AB_WWW_HOME_PAGE_A: Incomplete +PR_EMS_AB_WWW_HOME_PAGE_W: Incomplete +PR_EMS_AB_X121_ADDRESS: Incomplete +PR_EMS_AB_X121_ADDRESS_A: Incomplete +PR_EMS_AB_X121_ADDRESS_W: Incomplete +PR_EMS_AB_X25_CALL_USER_DATA_INCOMING: Incomplete +PR_EMS_AB_X25_CALL_USER_DATA_OUTGOING: Incomplete +PR_EMS_AB_X25_FACILITIES_DATA_INCOMING: Incomplete +PR_EMS_AB_X25_FACILITIES_DATA_OUTGOING: Incomplete +PR_EMS_AB_X25_LEASED_LINE_PORT: Incomplete +PR_EMS_AB_X25_LEASED_OR_SWITCHED: Incomplete +PR_EMS_AB_X25_REMOTE_MTA_PHONE: Incomplete +PR_EMS_AB_X25_REMOTE_MTA_PHONE_A: Incomplete +PR_EMS_AB_X25_REMOTE_MTA_PHONE_W: Incomplete +PR_EMS_AB_X400_ATTACHMENT_TYPE: Incomplete +PR_EMS_AB_X400_SELECTOR_SYNTAX: Incomplete +PR_EMS_AB_X500_ACCESS_CONTROL_LIST: Incomplete +PR_EMS_AB_XMIT_TIMEOUT_NON_URGENT: Incomplete +PR_EMS_AB_XMIT_TIMEOUT_NORMAL: Incomplete +PR_EMS_AB_XMIT_TIMEOUT_URGENT: Incomplete diff --git a/stubs/pywin32/win32comext/mapi/exchange.pyi b/stubs/pywin32/win32comext/mapi/exchange.pyi new file mode 100644 index 0000000..ac1a974 --- /dev/null +++ b/stubs/pywin32/win32comext/mapi/exchange.pyi @@ -0,0 +1,9 @@ +import _win32typing + +OPENSTORE_HOME_LOGON: int +OPENSTORE_OVERRIDE_HOME_MDB: int +OPENSTORE_PUBLIC: int +OPENSTORE_TAKE_OWNERSHIP: int +OPENSTORE_USE_ADMIN_PRIVILEGE: int +IID_IExchangeManageStore: _win32typing.PyIID +IID_IExchangeManageStoreEx: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/mapi/mapi.pyi b/stubs/pywin32/win32comext/mapi/mapi.pyi new file mode 100644 index 0000000..2eddb48 --- /dev/null +++ b/stubs/pywin32/win32comext/mapi/mapi.pyi @@ -0,0 +1,331 @@ +from _typeshed import Incomplete + +import _win32typing + +def HexFromBin(val: str) -> str: ... +def BinFromHex(val: str) -> str: ... +def MAPIUninitialize() -> None: ... +def MAPIInitialize(init: _win32typing.MAPIINIT_0) -> None: ... +def MAPILogonEx(uiParam, profileName: str, password: str | None = ..., flags=...) -> _win32typing.PyIMAPISession: ... +def MAPIAdminProfiles(fFlags) -> _win32typing.PyIProfAdmin: ... +def HrQueryAllRows( + table: _win32typing.PyIMAPITable, + properties: _win32typing.PySPropTagArray, + restrictions: _win32typing.PySRestriction, + sortOrderSet: _win32typing.PySSortOrderSet, + rowsMax, +): ... +def RTFSync(message: _win32typing.PyIMessage, flags): ... +def WrapCompressedRTFStream(stream: _win32typing.PyIStream, flags) -> _win32typing.PyIStream: ... +def WrapCompressedRTFStreamEx() -> tuple[_win32typing.PyIStream, Incomplete]: ... +def OpenIMsgSession(): ... +def CloseIMsgSession() -> None: ... +def OpenIMsgOnIStg( + session, + support, + storage: _win32typing.PyIStorage, + callback: Incomplete | None = ..., + callbackData: int = ..., + flags: int = ..., +) -> _win32typing.PyIMessage: ... +def RTFStreamToHTML(The_stream_to_read_the_uncompressed_RTF_from: _win32typing.PyIStream) -> None: ... +def OpenStreamOnFile(filename: str, flags: int = ..., prefix: str | None = ...) -> _win32typing.PyIStream: ... +def OpenStreamOnFileW(filename, flags: int = ..., prefix: Incomplete | None = ...) -> _win32typing.PyIStream: ... +def HrGetOneProp(prop: _win32typing.PyIMAPIProp, propTag): ... +def HrSetOneProp(prop: _win32typing.PyIMAPIProp, propValue: _win32typing.PySPropValue): ... +def HrAllocAdviseSink(callback, context): ... +def HrThisThreadAdviseSink(_object): ... +def HrDispatchNotifications(*args, **kwargs): ... # incomplete +def MAPIUIDFromBinary(*args, **kwargs): ... # incomplete + +AB_NO_DIALOG: int +ATTACH_BY_REF_ONLY: int +ATTACH_BY_REF_RESOLVE: int +ATTACH_BY_REFERENCE: int +ATTACH_BY_VALUE: int +ATTACH_EMBEDDED_MSG: int +ATTACH_OLE: int +BMR_EQZ: int +BMR_NEZ: int +BOOKMARK_BEGINNING: int +BOOKMARK_CURRENT: int +BOOKMARK_END: int +CCSF_8BITHEADERS: int +CCSF_EMBEDDED_MESSAGE: int +CCSF_INCLUDE_BCC: int +CCSF_NO_MSGID: int +CCSF_NOHEADERS: int +CCSF_PLAIN_TEXT_ONLY: int +CCSF_PRESERVE_SOURCE: int +CCSF_SMTP: int +CCSF_USE_RTF: int +CCSF_USE_TNEF: int +CLEAR_NRN_PENDING: int +CLEAR_READ_FLAG: int +CLEAR_RN_PENDING: int +CONVENIENT_DEPTH: int +DEL_FOLDERS: int +DEL_MESSAGES: int +DELETE_HARD_DELETE: int +DIR_BACKWARD: int +FL_FULLSTRING: int +FL_IGNORECASE: int +FL_IGNORENONSPACE: int +FL_LOOSE: int +FL_PREFIX: int +FL_SUBSTRING: int +FLUSH_ASYNC_OK: int +FLUSH_DOWNLOAD: int +FLUSH_FORCE: int +FLUSH_NO_UI: int +FLUSH_UPLOAD: int +fnevCriticalError: int +fnevExtended: int +fnevNewMail: int +fnevObjectCopied: int +fnevObjectCreated: int +fnevObjectDeleted: int +fnevObjectModified: int +fnevObjectMoved: int +fnevReservedForMapi: int +fnevSearchComplete: int +fnevStatusObjectModified: int +fnevTableModified: int +FOLDER_DIALOG: int +FOLDER_GENERIC: int +FOLDER_SEARCH: int +FORCE_SAVE: int +GENERATE_RECEIPT_ONLY: int +KEEP_OPEN_READONLY: int +KEEP_OPEN_READWRITE: int +MAIL_E_NAMENOTFOUND: int +MAPI_ABCONT: int +MAPI_ADDRBOOK: int +MAPI_ALLOW_OTHERS: int +MAPI_ASSOCIATED: int +MAPI_ATTACH: int +MAPI_BCC: int +MAPI_BEST_ACCESS: int +MAPI_CC: int +MAPI_CREATE: int +MAPI_DEFAULT_SERVICES: int +MAPI_DEFERRED_ERRORS: int +MAPI_DIALOG: int +MAPI_E_ACCOUNT_DISABLED: int +MAPI_E_AMBIGUOUS_RECIP: int +MAPI_E_BAD_CHARWIDTH: int +MAPI_E_BAD_COLUMN: int +MAPI_E_BAD_VALUE: int +MAPI_E_BUSY: int +MAPI_E_CALL_FAILED: int +MAPI_E_CANCEL: int +MAPI_E_COLLISION: int +MAPI_E_COMPUTED: int +MAPI_E_CORRUPT_DATA: int +MAPI_E_CORRUPT_STORE: int +MAPI_E_DECLINE_COPY: int +MAPI_E_DISK_ERROR: int +MAPI_E_END_OF_SESSION: int +MAPI_E_EXTENDED_ERROR: int +MAPI_E_FAILONEPROVIDER: int +MAPI_E_FOLDER_CYCLE: int +MAPI_E_HAS_FOLDERS: int +MAPI_E_HAS_MESSAGES: int +MAPI_E_INTERFACE_NOT_SUPPORTED: int +MAPI_E_INVALID_ACCESS_TIME: int +MAPI_E_INVALID_BOOKMARK: int +MAPI_E_INVALID_ENTRYID: int +MAPI_E_INVALID_OBJECT: int +MAPI_E_INVALID_PARAMETER: int +MAPI_E_INVALID_TYPE: int +MAPI_E_INVALID_WORKSTATION_ACCOUNT: int +MAPI_E_LOCKID_LIMIT: int +MAPI_E_LOGON_FAILED: int +MAPI_E_MISSING_REQUIRED_COLUMN: int +MAPI_E_NAMED_PROP_QUOTA_EXCEEDED: int +MAPI_E_NETWORK_ERROR: int +MAPI_E_NO_ACCESS: int +MAPI_E_NO_RECIPIENTS: int +MAPI_E_NO_SUPPORT: int +MAPI_E_NO_SUPPRESS: int +MAPI_E_NON_STANDARD: int +MAPI_E_NOT_ENOUGH_DISK: int +MAPI_E_NOT_ENOUGH_MEMORY: int +MAPI_E_NOT_ENOUGH_RESOURCES: int +MAPI_E_NOT_FOUND: int +MAPI_E_NOT_IN_QUEUE: int +MAPI_E_NOT_INITIALIZED: int +MAPI_E_NOT_ME: int +MAPI_E_OBJECT_CHANGED: int +MAPI_E_OBJECT_DELETED: int +MAPI_E_OFFLINE: int +MAPI_E_PASSWORD_CHANGE_REQUIRED: int +MAPI_E_PASSWORD_EXPIRED: int +MAPI_E_PROFILE_DELETED: int +MAPI_E_RECONNECTED: int +MAPI_E_SESSION_LIMIT: int +MAPI_E_STORE_FULL: int +MAPI_E_STRING_TOO_LONG: int +MAPI_E_SUBMITTED: int +MAPI_E_TABLE_EMPTY: int +MAPI_E_TABLE_TOO_BIG: int +MAPI_E_TIMEOUT: int +MAPI_E_TOO_BIG: int +MAPI_E_TOO_COMPLEX: int +MAPI_E_TYPE_NO_SUPPORT: int +MAPI_E_UNABLE_TO_ABORT: int +MAPI_E_UNABLE_TO_COMPLETE: int +MAPI_E_UNCONFIGURED: int +MAPI_E_UNEXPECTED_ID: int +MAPI_E_UNEXPECTED_TYPE: int +MAPI_E_UNKNOWN_CPID: int +MAPI_E_UNKNOWN_ENTRYID: int +MAPI_E_UNKNOWN_FLAGS: int +MAPI_E_UNKNOWN_LCID: int +MAPI_E_USER_CANCEL: int +MAPI_E_VERSION: int +MAPI_E_WAIT: int +MAPI_EXPLICIT_PROFILE: int +MAPI_EXTENDED: int +MAPI_FOLDER: int +MAPI_FORCE_ACCESS: int +MAPI_FORCE_DOWNLOAD: int +MAPI_FORMINFO: int +MAPI_INIT_VERSION: int +MAPI_LOGON_UI: int +MAPI_MAILUSER: int +MAPI_MESSAGE: int +MAPI_MODIFY: int +MAPI_MOVE: int +MAPI_MULTITHREAD_NOTIFICATIONS: int +MAPI_NATIVE_BODY: int +MAPI_NATIVE_BODY_TYPE_HTML: int +MAPI_NATIVE_BODY_TYPE_PLAINTEXT: int +MAPI_NATIVE_BODY_TYPE_RTF: int +MAPI_NEW_SESSION: int +MAPI_NO_IDS: int +MAPI_NO_MAIL: int +MAPI_NO_STRINGS: int +MAPI_NOREPLACE: int +MAPI_NT_SERVICE: int +MAPI_P1: int +MAPI_PASSWORD_UI: int +MAPI_PROFSECT: int +MAPI_SERVICE_UI_ALWAYS: int +MAPI_SESSION: int +MAPI_STATUS: int +MAPI_STORE: int +MAPI_SUBMITTED: int +MAPI_TIMEOUT_SHORT: int +MAPI_TO: int +MAPI_UNICODE: int +MAPI_USE_DEFAULT: int +MAPI_W_APPROX_COUNT: int +MAPI_W_CANCEL_MESSAGE: int +MAPI_W_ERRORS_RETURNED: int +MAPI_W_NO_SERVICE: int +MAPI_W_PARTIAL_COMPLETION: int +MAPI_W_POSITION_CHANGED: int +MDB_NO_DIALOG: int +MDB_NO_MAIL: int +MDB_TEMPORARY: int +MDB_WRITE: int +MESSAGE_DIALOG: int +MODRECIP_ADD: int +MODRECIP_MODIFY: int +MODRECIP_REMOVE: int +NO_ATTACHMENT: int +OPEN_IF_EXISTS: int +PSTF_BEST_ENCRYPTION: int +PSTF_COMPRESSABLE_ENCRYPTION: int +PSTF_NO_ENCRYPTION: int +RELOP_EQ: int +RELOP_GE: int +RELOP_GT: int +RELOP_LE: int +RELOP_LT: int +RELOP_NE: int +RELOP_RE: int +RES_AND: int +RES_BITMASK: int +RES_COMMENT: int +RES_COMPAREPROPS: int +RES_CONTENT: int +RES_EXIST: int +RES_NOT: int +RES_OR: int +RES_PROPERTY: int +RES_SIZE: int +RES_SUBRESTRICTION: int +RTF_SYNC_BODY_CHANGED: int +RTF_SYNC_RTF_CHANGED: int +SERVICE_UI_ALLOWED: int +SERVICE_UI_ALWAYS: int +SHOW_SOFT_DELETES: int +SOF_UNIQUEFILENAME: int +STATUS_DEFAULT_STORE: int +STATUS_FLUSH_QUEUES: int +STATUS_INBOUND_FLUSH: int +STATUS_OUTBOUND_FLUSH: int +SUPPRESS_RECEIPT: int +TABLE_CHANGED: int +TABLE_ERROR: int +TABLE_RELOAD: int +TABLE_RESTRICT_DONE: int +TABLE_ROW_ADDED: int +TABLE_ROW_DELETED: int +TABLE_ROW_MODIFIED: int +TABLE_SETCOL_DONE: int +TABLE_SORT_ASCEND: int +TABLE_SORT_COMBINE: int +TABLE_SORT_DESCEND: int +TABLE_SORT_DONE: int +TBL_ALL_COLUMNS: int +TBL_ASYNC: int +TBL_BATCH: int +CLSID_IConverterSession: _win32typing.PyIID +CLSID_MailMessage: _win32typing.PyIID +IID_IABContainer: _win32typing.PyIID +IID_IAddrBook: _win32typing.PyIID +IID_IAttachment: _win32typing.PyIID +IID_IConverterSession: _win32typing.PyIID +IID_IDistList: _win32typing.PyIID +IID_IMAPIAdviseSink: _win32typing.PyIID +IID_IMAPIContainer: _win32typing.PyIID +IID_IMAPIFolder: _win32typing.PyIID +IID_IMAPIProp: _win32typing.PyIID +IID_IMAPISession: _win32typing.PyIID +IID_IMAPIStatus: _win32typing.PyIID +IID_IMAPITable: _win32typing.PyIID +IID_IMailUser: _win32typing.PyIID +IID_IMessage: _win32typing.PyIID +IID_IMsgServiceAdmin: _win32typing.PyIID +IID_IMsgServiceAdmin2: _win32typing.PyIID +IID_IMsgStore: _win32typing.PyIID +IID_IProfAdmin: _win32typing.PyIID +IID_IProfSect: _win32typing.PyIID +IID_IProviderAdmin: _win32typing.PyIID +MAPI_DISTLIST: int +MSPST_UID_PROVIDER: _win32typing.PyIID +PSETID_Address: _win32typing.PyIID +PSETID_AirSync: _win32typing.PyIID +PSETID_Appointment: _win32typing.PyIID +PSETID_Common: _win32typing.PyIID +PSETID_Log: _win32typing.PyIID +PSETID_Meeting: _win32typing.PyIID +PSETID_Messaging: _win32typing.PyIID +PSETID_Note: _win32typing.PyIID +PSETID_PostRss: _win32typing.PyIID +PSETID_Remote: _win32typing.PyIID +PSETID_Report: _win32typing.PyIID +PSETID_Sharing: _win32typing.PyIID +PSETID_Task: _win32typing.PyIID +PSETID_UnifiedMessaging: _win32typing.PyIID +PS_INTERNET_HEADERS: _win32typing.PyIID +PS_MAPI: _win32typing.PyIID +PS_PUBLIC_STRINGS: _win32typing.PyIID +PS_ROUTING_ADDRTYPE: _win32typing.PyIID +PS_ROUTING_DISPLAY_NAME: _win32typing.PyIID +PS_ROUTING_EMAIL_ADDRESSES: _win32typing.PyIID +PS_ROUTING_ENTRYID: _win32typing.PyIID +PS_ROUTING_SEARCH_KEY: _win32typing.PyIID diff --git a/stubs/pywin32/win32comext/mapi/mapitags.pyi b/stubs/pywin32/win32comext/mapi/mapitags.pyi new file mode 100644 index 0000000..660f492 --- /dev/null +++ b/stubs/pywin32/win32comext/mapi/mapitags.pyi @@ -0,0 +1,991 @@ +MV_FLAG: int +PT_UNSPECIFIED: int +PT_NULL: int +PT_I2: int +PT_LONG: int +PT_R4: int +PT_DOUBLE: int +PT_CURRENCY: int +PT_APPTIME: int +PT_ERROR: int +PT_BOOLEAN: int +PT_OBJECT: int +PT_I8: int +PT_STRING8: int +PT_UNICODE: int +PT_SYSTIME: int +PT_CLSID: int +PT_BINARY: int +PT_SHORT: int +PT_I4: int +PT_FLOAT: int +PT_R8: int +PT_LONGLONG: int +PT_MV_I2: int +PT_MV_LONG: int +PT_MV_R4: int +PT_MV_DOUBLE: int +PT_MV_CURRENCY: int +PT_MV_APPTIME: int +PT_MV_SYSTIME: int +PT_MV_STRING8: int +PT_MV_BINARY: int +PT_MV_UNICODE: int +PT_MV_CLSID: int +PT_MV_I8: int +PT_MV_SHORT: int +PT_MV_I4: int +PT_MV_FLOAT: int +PT_MV_R8: int +PT_MV_LONGLONG: int +PT_TSTRING: int +PT_MV_TSTRING: int +PROP_TYPE_MASK: int + +def PROP_TYPE(ulPropTag: int) -> int: ... +def PROP_ID(ulPropTag: int) -> int: ... +def PROP_TAG(ulPropType: int, ulPropID: int) -> int: ... + +PROP_ID_NULL: int +PROP_ID_INVALID: int +PR_NULL: int +PR_ACKNOWLEDGEMENT_MODE: int +PR_ALTERNATE_RECIPIENT_ALLOWED: int +PR_AUTHORIZING_USERS: int +PR_AUTO_FORWARD_COMMENT: int +PR_AUTO_FORWARD_COMMENT_W: int +PR_AUTO_FORWARD_COMMENT_A: int +PR_AUTO_FORWARDED: int +PR_CONTENT_CONFIDENTIALITY_ALGORITHM_ID: int +PR_CONTENT_CORRELATOR: int +PR_CONTENT_IDENTIFIER: int +PR_CONTENT_IDENTIFIER_W: int +PR_CONTENT_IDENTIFIER_A: int +PR_CONTENT_LENGTH: int +PR_CONTENT_RETURN_REQUESTED: int +PR_CONVERSATION_KEY: int +PR_CONVERSION_EITS: int +PR_CONVERSION_WITH_LOSS_PROHIBITED: int +PR_CONVERTED_EITS: int +PR_DEFERRED_DELIVERY_TIME: int +PR_DELIVER_TIME: int +PR_DISCARD_REASON: int +PR_DISCLOSURE_OF_RECIPIENTS: int +PR_DL_EXPANSION_HISTORY: int +PR_DL_EXPANSION_PROHIBITED: int +PR_EXPIRY_TIME: int +PR_IMPLICIT_CONVERSION_PROHIBITED: int +PR_IMPORTANCE: int +PR_IPM_ID: int +PR_LATEST_DELIVERY_TIME: int +PR_MESSAGE_CLASS: int +PR_MESSAGE_CLASS_W: int +PR_MESSAGE_CLASS_A: int +PR_MESSAGE_DELIVERY_ID: int +PR_MESSAGE_SECURITY_LABEL: int +PR_OBSOLETED_IPMS: int +PR_ORIGINALLY_INTENDED_RECIPIENT_NAME: int +PR_ORIGINAL_EITS: int +PR_ORIGINATOR_CERTIFICATE: int +PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED: int +PR_ORIGINATOR_RETURN_ADDRESS: int +PR_PARENT_KEY: int +PR_PRIORITY: int +PR_ORIGIN_CHECK: int +PR_PROOF_OF_SUBMISSION_REQUESTED: int +PR_READ_RECEIPT_REQUESTED: int +PR_RECEIPT_TIME: int +PR_RECIPIENT_REASSIGNMENT_PROHIBITED: int +PR_REDIRECTION_HISTORY: int +PR_RELATED_IPMS: int +PR_ORIGINAL_SENSITIVITY: int +PR_LANGUAGES: int +PR_LANGUAGES_W: int +PR_LANGUAGES_A: int +PR_REPLY_TIME: int +PR_REPORT_TAG: int +PR_REPORT_TIME: int +PR_RETURNED_IPM: int +PR_SECURITY: int +PR_INCOMPLETE_COPY: int +PR_SENSITIVITY: int +PR_SUBJECT: int +PR_SUBJECT_W: int +PR_SUBJECT_A: int +PR_SUBJECT_IPM: int +PR_CLIENT_SUBMIT_TIME: int +PR_REPORT_NAME: int +PR_REPORT_NAME_W: int +PR_REPORT_NAME_A: int +PR_SENT_REPRESENTING_SEARCH_KEY: int +PR_X400_CONTENT_TYPE: int +PR_SUBJECT_PREFIX: int +PR_SUBJECT_PREFIX_W: int +PR_SUBJECT_PREFIX_A: int +PR_NON_RECEIPT_REASON: int +PR_RECEIVED_BY_ENTRYID: int +PR_RECEIVED_BY_NAME: int +PR_RECEIVED_BY_NAME_W: int +PR_RECEIVED_BY_NAME_A: int +PR_SENT_REPRESENTING_ENTRYID: int +PR_SENT_REPRESENTING_NAME: int +PR_SENT_REPRESENTING_NAME_W: int +PR_SENT_REPRESENTING_NAME_A: int +PR_RCVD_REPRESENTING_ENTRYID: int +PR_RCVD_REPRESENTING_NAME: int +PR_RCVD_REPRESENTING_NAME_W: int +PR_RCVD_REPRESENTING_NAME_A: int +PR_REPORT_ENTRYID: int +PR_READ_RECEIPT_ENTRYID: int +PR_MESSAGE_SUBMISSION_ID: int +PR_PROVIDER_SUBMIT_TIME: int +PR_ORIGINAL_SUBJECT: int +PR_ORIGINAL_SUBJECT_W: int +PR_ORIGINAL_SUBJECT_A: int +PR_DISC_VAL: int +PR_ORIG_MESSAGE_CLASS: int +PR_ORIG_MESSAGE_CLASS_W: int +PR_ORIG_MESSAGE_CLASS_A: int +PR_ORIGINAL_AUTHOR_ENTRYID: int +PR_ORIGINAL_AUTHOR_NAME: int +PR_ORIGINAL_AUTHOR_NAME_W: int +PR_ORIGINAL_AUTHOR_NAME_A: int +PR_ORIGINAL_SUBMIT_TIME: int +PR_REPLY_RECIPIENT_ENTRIES: int +PR_REPLY_RECIPIENT_NAMES: int +PR_REPLY_RECIPIENT_NAMES_W: int +PR_REPLY_RECIPIENT_NAMES_A: int +PR_RECEIVED_BY_SEARCH_KEY: int +PR_RCVD_REPRESENTING_SEARCH_KEY: int +PR_READ_RECEIPT_SEARCH_KEY: int +PR_REPORT_SEARCH_KEY: int +PR_ORIGINAL_DELIVERY_TIME: int +PR_ORIGINAL_AUTHOR_SEARCH_KEY: int +PR_MESSAGE_TO_ME: int +PR_MESSAGE_CC_ME: int +PR_MESSAGE_RECIP_ME: int +PR_ORIGINAL_SENDER_NAME: int +PR_ORIGINAL_SENDER_NAME_W: int +PR_ORIGINAL_SENDER_NAME_A: int +PR_ORIGINAL_SENDER_ENTRYID: int +PR_ORIGINAL_SENDER_SEARCH_KEY: int +PR_ORIGINAL_SENT_REPRESENTING_NAME: int +PR_ORIGINAL_SENT_REPRESENTING_NAME_W: int +PR_ORIGINAL_SENT_REPRESENTING_NAME_A: int +PR_ORIGINAL_SENT_REPRESENTING_ENTRYID: int +PR_ORIGINAL_SENT_REPRESENTING_SEARCH_KEY: int +PR_START_DATE: int +PR_END_DATE: int +PR_OWNER_APPT_ID: int +PR_RESPONSE_REQUESTED: int +PR_SENT_REPRESENTING_ADDRTYPE: int +PR_SENT_REPRESENTING_ADDRTYPE_W: int +PR_SENT_REPRESENTING_ADDRTYPE_A: int +PR_SENT_REPRESENTING_EMAIL_ADDRESS: int +PR_SENT_REPRESENTING_EMAIL_ADDRESS_W: int +PR_SENT_REPRESENTING_EMAIL_ADDRESS_A: int +PR_ORIGINAL_SENDER_ADDRTYPE: int +PR_ORIGINAL_SENDER_ADDRTYPE_W: int +PR_ORIGINAL_SENDER_ADDRTYPE_A: int +PR_ORIGINAL_SENDER_EMAIL_ADDRESS: int +PR_ORIGINAL_SENDER_EMAIL_ADDRESS_W: int +PR_ORIGINAL_SENDER_EMAIL_ADDRESS_A: int +PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE: int +PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE_W: int +PR_ORIGINAL_SENT_REPRESENTING_ADDRTYPE_A: int +PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS: int +PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS_W: int +PR_ORIGINAL_SENT_REPRESENTING_EMAIL_ADDRESS_A: int +PR_CONVERSATION_TOPIC: int +PR_CONVERSATION_TOPIC_W: int +PR_CONVERSATION_TOPIC_A: int +PR_CONVERSATION_INDEX: int +PR_ORIGINAL_DISPLAY_BCC: int +PR_ORIGINAL_DISPLAY_BCC_W: int +PR_ORIGINAL_DISPLAY_BCC_A: int +PR_ORIGINAL_DISPLAY_CC: int +PR_ORIGINAL_DISPLAY_CC_W: int +PR_ORIGINAL_DISPLAY_CC_A: int +PR_ORIGINAL_DISPLAY_TO: int +PR_ORIGINAL_DISPLAY_TO_W: int +PR_ORIGINAL_DISPLAY_TO_A: int +PR_RECEIVED_BY_ADDRTYPE: int +PR_RECEIVED_BY_ADDRTYPE_W: int +PR_RECEIVED_BY_ADDRTYPE_A: int +PR_RECEIVED_BY_EMAIL_ADDRESS: int +PR_RECEIVED_BY_EMAIL_ADDRESS_W: int +PR_RECEIVED_BY_EMAIL_ADDRESS_A: int +PR_RCVD_REPRESENTING_ADDRTYPE: int +PR_RCVD_REPRESENTING_ADDRTYPE_W: int +PR_RCVD_REPRESENTING_ADDRTYPE_A: int +PR_RCVD_REPRESENTING_EMAIL_ADDRESS: int +PR_RCVD_REPRESENTING_EMAIL_ADDRESS_W: int +PR_RCVD_REPRESENTING_EMAIL_ADDRESS_A: int +PR_ORIGINAL_AUTHOR_ADDRTYPE: int +PR_ORIGINAL_AUTHOR_ADDRTYPE_W: int +PR_ORIGINAL_AUTHOR_ADDRTYPE_A: int +PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS: int +PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS_W: int +PR_ORIGINAL_AUTHOR_EMAIL_ADDRESS_A: int +PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE: int +PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE_W: int +PR_ORIGINALLY_INTENDED_RECIP_ADDRTYPE_A: int +PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS: int +PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS_W: int +PR_ORIGINALLY_INTENDED_RECIP_EMAIL_ADDRESS_A: int +PR_TRANSPORT_MESSAGE_HEADERS: int +PR_TRANSPORT_MESSAGE_HEADERS_W: int +PR_TRANSPORT_MESSAGE_HEADERS_A: int +PR_DELEGATION: int +PR_TNEF_CORRELATION_KEY: int +PR_BODY: int +PR_BODY_W: int +PR_BODY_A: int +PR_BODY_HTML: int +PR_BODY_HTML_W: int +PR_BODY_HTML_A: int +PR_REPORT_TEXT: int +PR_REPORT_TEXT_W: int +PR_REPORT_TEXT_A: int +PR_ORIGINATOR_AND_DL_EXPANSION_HISTORY: int +PR_REPORTING_DL_NAME: int +PR_REPORTING_MTA_CERTIFICATE: int +PR_RTF_SYNC_BODY_CRC: int +PR_RTF_SYNC_BODY_COUNT: int +PR_RTF_SYNC_BODY_TAG: int +PR_RTF_SYNC_BODY_TAG_W: int +PR_RTF_SYNC_BODY_TAG_A: int +PR_RTF_COMPRESSED: int +PR_RTF_SYNC_PREFIX_COUNT: int +PR_RTF_SYNC_TRAILING_COUNT: int +PR_ORIGINALLY_INTENDED_RECIP_ENTRYID: int +PR_CONTENT_INTEGRITY_CHECK: int +PR_EXPLICIT_CONVERSION: int +PR_IPM_RETURN_REQUESTED: int +PR_MESSAGE_TOKEN: int +PR_NDR_REASON_CODE: int +PR_NDR_DIAG_CODE: int +PR_NON_RECEIPT_NOTIFICATION_REQUESTED: int +PR_DELIVERY_POINT: int +PR_ORIGINATOR_NON_DELIVERY_REPORT_REQUESTED: int +PR_ORIGINATOR_REQUESTED_ALTERNATE_RECIPIENT: int +PR_PHYSICAL_DELIVERY_BUREAU_FAX_DELIVERY: int +PR_PHYSICAL_DELIVERY_MODE: int +PR_PHYSICAL_DELIVERY_REPORT_REQUEST: int +PR_PHYSICAL_FORWARDING_ADDRESS: int +PR_PHYSICAL_FORWARDING_ADDRESS_REQUESTED: int +PR_PHYSICAL_FORWARDING_PROHIBITED: int +PR_PHYSICAL_RENDITION_ATTRIBUTES: int +PR_PROOF_OF_DELIVERY: int +PR_PROOF_OF_DELIVERY_REQUESTED: int +PR_RECIPIENT_CERTIFICATE: int +PR_RECIPIENT_NUMBER_FOR_ADVICE: int +PR_RECIPIENT_NUMBER_FOR_ADVICE_W: int +PR_RECIPIENT_NUMBER_FOR_ADVICE_A: int +PR_RECIPIENT_TYPE: int +PR_REGISTERED_MAIL_TYPE: int +PR_REPLY_REQUESTED: int +PR_REQUESTED_DELIVERY_METHOD: int +PR_SENDER_ENTRYID: int +PR_SENDER_NAME: int +PR_SENDER_NAME_W: int +PR_SENDER_NAME_A: int +PR_SUPPLEMENTARY_INFO: int +PR_SUPPLEMENTARY_INFO_W: int +PR_SUPPLEMENTARY_INFO_A: int +PR_TYPE_OF_MTS_USER: int +PR_SENDER_SEARCH_KEY: int +PR_SENDER_ADDRTYPE: int +PR_SENDER_ADDRTYPE_W: int +PR_SENDER_ADDRTYPE_A: int +PR_SENDER_EMAIL_ADDRESS: int +PR_SENDER_EMAIL_ADDRESS_W: int +PR_SENDER_EMAIL_ADDRESS_A: int +PR_CURRENT_VERSION: int +PR_DELETE_AFTER_SUBMIT: int +PR_DISPLAY_BCC: int +PR_DISPLAY_BCC_W: int +PR_DISPLAY_BCC_A: int +PR_DISPLAY_CC: int +PR_DISPLAY_CC_W: int +PR_DISPLAY_CC_A: int +PR_DISPLAY_TO: int +PR_DISPLAY_TO_W: int +PR_DISPLAY_TO_A: int +PR_PARENT_DISPLAY: int +PR_PARENT_DISPLAY_W: int +PR_PARENT_DISPLAY_A: int +PR_MESSAGE_DELIVERY_TIME: int +PR_MESSAGE_FLAGS: int +PR_MESSAGE_SIZE: int +PR_PARENT_ENTRYID: int +PR_SENTMAIL_ENTRYID: int +PR_CORRELATE: int +PR_CORRELATE_MTSID: int +PR_DISCRETE_VALUES: int +PR_RESPONSIBILITY: int +PR_SPOOLER_STATUS: int +PR_TRANSPORT_STATUS: int +PR_MESSAGE_RECIPIENTS: int +PR_MESSAGE_ATTACHMENTS: int +PR_SUBMIT_FLAGS: int +PR_RECIPIENT_STATUS: int +PR_TRANSPORT_KEY: int +PR_MSG_STATUS: int +PR_MESSAGE_DOWNLOAD_TIME: int +PR_CREATION_VERSION: int +PR_MODIFY_VERSION: int +PR_HASATTACH: int +PR_BODY_CRC: int +PR_NORMALIZED_SUBJECT: int +PR_NORMALIZED_SUBJECT_W: int +PR_NORMALIZED_SUBJECT_A: int +PR_RTF_IN_SYNC: int +PR_ATTACH_SIZE: int +PR_ATTACH_NUM: int +PR_PREPROCESS: int +PR_ORIGINATING_MTA_CERTIFICATE: int +PR_PROOF_OF_SUBMISSION: int +PR_ENTRYID: int +PR_OBJECT_TYPE: int +PR_ICON: int +PR_MINI_ICON: int +PR_STORE_ENTRYID: int +PR_STORE_RECORD_KEY: int +PR_RECORD_KEY: int +PR_MAPPING_SIGNATURE: int +PR_ACCESS_LEVEL: int +PR_INSTANCE_KEY: int +PR_ROW_TYPE: int +PR_ACCESS: int +PR_ROWID: int +PR_DISPLAY_NAME: int +PR_DISPLAY_NAME_W: int +PR_DISPLAY_NAME_A: int +PR_ADDRTYPE: int +PR_ADDRTYPE_W: int +PR_ADDRTYPE_A: int +PR_EMAIL_ADDRESS: int +PR_EMAIL_ADDRESS_W: int +PR_EMAIL_ADDRESS_A: int +PR_COMMENT: int +PR_COMMENT_W: int +PR_COMMENT_A: int +PR_DEPTH: int +PR_PROVIDER_DISPLAY: int +PR_PROVIDER_DISPLAY_W: int +PR_PROVIDER_DISPLAY_A: int +PR_CREATION_TIME: int +PR_LAST_MODIFICATION_TIME: int +PR_RESOURCE_FLAGS: int +PR_PROVIDER_DLL_NAME: int +PR_PROVIDER_DLL_NAME_W: int +PR_PROVIDER_DLL_NAME_A: int +PR_SEARCH_KEY: int +PR_PROVIDER_UID: int +PR_PROVIDER_ORDINAL: int +PR_FORM_VERSION: int +PR_FORM_VERSION_W: int +PR_FORM_VERSION_A: int +PR_FORM_CLSID: int +PR_FORM_CONTACT_NAME: int +PR_FORM_CONTACT_NAME_W: int +PR_FORM_CONTACT_NAME_A: int +PR_FORM_CATEGORY: int +PR_FORM_CATEGORY_W: int +PR_FORM_CATEGORY_A: int +PR_FORM_CATEGORY_SUB: int +PR_FORM_CATEGORY_SUB_W: int +PR_FORM_CATEGORY_SUB_A: int +PR_FORM_HOST_MAP: int +PR_FORM_HIDDEN: int +PR_FORM_DESIGNER_NAME: int +PR_FORM_DESIGNER_NAME_W: int +PR_FORM_DESIGNER_NAME_A: int +PR_FORM_DESIGNER_GUID: int +PR_FORM_MESSAGE_BEHAVIOR: int +PR_DEFAULT_STORE: int +PR_STORE_SUPPORT_MASK: int +PR_STORE_STATE: int +PR_IPM_SUBTREE_SEARCH_KEY: int +PR_IPM_OUTBOX_SEARCH_KEY: int +PR_IPM_WASTEBASKET_SEARCH_KEY: int +PR_IPM_SENTMAIL_SEARCH_KEY: int +PR_MDB_PROVIDER: int +PR_RECEIVE_FOLDER_SETTINGS: int +PR_VALID_FOLDER_MASK: int +PR_IPM_SUBTREE_ENTRYID: int +PR_IPM_OUTBOX_ENTRYID: int +PR_IPM_WASTEBASKET_ENTRYID: int +PR_IPM_SENTMAIL_ENTRYID: int +PR_VIEWS_ENTRYID: int +PR_COMMON_VIEWS_ENTRYID: int +PR_FINDER_ENTRYID: int +PR_CONTAINER_FLAGS: int +PR_FOLDER_TYPE: int +PR_CONTENT_COUNT: int +PR_CONTENT_UNREAD: int +PR_CREATE_TEMPLATES: int +PR_DETAILS_TABLE: int +PR_SEARCH: int +PR_SELECTABLE: int +PR_SUBFOLDERS: int +PR_STATUS: int +PR_ANR: int +PR_ANR_W: int +PR_ANR_A: int +PR_CONTENTS_SORT_ORDER: int +PR_CONTAINER_HIERARCHY: int +PR_CONTAINER_CONTENTS: int +PR_FOLDER_ASSOCIATED_CONTENTS: int +PR_DEF_CREATE_DL: int +PR_DEF_CREATE_MAILUSER: int +PR_CONTAINER_CLASS: int +PR_CONTAINER_CLASS_W: int +PR_CONTAINER_CLASS_A: int +PR_CONTAINER_MODIFY_VERSION: int +PR_AB_PROVIDER_ID: int +PR_DEFAULT_VIEW_ENTRYID: int +PR_ASSOC_CONTENT_COUNT: int +PR_ATTACHMENT_X400_PARAMETERS: int +PR_ATTACH_DATA_OBJ: int +PR_ATTACH_DATA_BIN: int +PR_ATTACH_ENCODING: int +PR_ATTACH_EXTENSION: int +PR_ATTACH_EXTENSION_W: int +PR_ATTACH_EXTENSION_A: int +PR_ATTACH_FILENAME: int +PR_ATTACH_FILENAME_W: int +PR_ATTACH_FILENAME_A: int +PR_ATTACH_METHOD: int +PR_ATTACH_LONG_FILENAME: int +PR_ATTACH_LONG_FILENAME_W: int +PR_ATTACH_LONG_FILENAME_A: int +PR_ATTACH_PATHNAME: int +PR_ATTACH_PATHNAME_W: int +PR_ATTACH_PATHNAME_A: int +PR_ATTACH_RENDERING: int +PR_ATTACH_TAG: int +PR_RENDERING_POSITION: int +PR_ATTACH_TRANSPORT_NAME: int +PR_ATTACH_TRANSPORT_NAME_W: int +PR_ATTACH_TRANSPORT_NAME_A: int +PR_ATTACH_LONG_PATHNAME: int +PR_ATTACH_LONG_PATHNAME_W: int +PR_ATTACH_LONG_PATHNAME_A: int +PR_ATTACH_MIME_TAG: int +PR_ATTACH_MIME_TAG_W: int +PR_ATTACH_MIME_TAG_A: int +PR_ATTACH_ADDITIONAL_INFO: int +PR_DISPLAY_TYPE: int +PR_TEMPLATEID: int +PR_PRIMARY_CAPABILITY: int +PR_7BIT_DISPLAY_NAME: int +PR_ACCOUNT: int +PR_ACCOUNT_W: int +PR_ACCOUNT_A: int +PR_ALTERNATE_RECIPIENT: int +PR_CALLBACK_TELEPHONE_NUMBER: int +PR_CALLBACK_TELEPHONE_NUMBER_W: int +PR_CALLBACK_TELEPHONE_NUMBER_A: int +PR_CONVERSION_PROHIBITED: int +PR_DISCLOSE_RECIPIENTS: int +PR_GENERATION: int +PR_GENERATION_W: int +PR_GENERATION_A: int +PR_GIVEN_NAME: int +PR_GIVEN_NAME_W: int +PR_GIVEN_NAME_A: int +PR_GOVERNMENT_ID_NUMBER: int +PR_GOVERNMENT_ID_NUMBER_W: int +PR_GOVERNMENT_ID_NUMBER_A: int +PR_BUSINESS_TELEPHONE_NUMBER: int +PR_BUSINESS_TELEPHONE_NUMBER_W: int +PR_BUSINESS_TELEPHONE_NUMBER_A: int +PR_OFFICE_TELEPHONE_NUMBER: int +PR_OFFICE_TELEPHONE_NUMBER_W: int +PR_OFFICE_TELEPHONE_NUMBER_A: int +PR_HOME_TELEPHONE_NUMBER: int +PR_HOME_TELEPHONE_NUMBER_W: int +PR_HOME_TELEPHONE_NUMBER_A: int +PR_INITIALS: int +PR_INITIALS_W: int +PR_INITIALS_A: int +PR_KEYWORD: int +PR_KEYWORD_W: int +PR_KEYWORD_A: int +PR_LANGUAGE: int +PR_LANGUAGE_W: int +PR_LANGUAGE_A: int +PR_LOCATION: int +PR_LOCATION_W: int +PR_LOCATION_A: int +PR_MAIL_PERMISSION: int +PR_MHS_COMMON_NAME: int +PR_MHS_COMMON_NAME_W: int +PR_MHS_COMMON_NAME_A: int +PR_ORGANIZATIONAL_ID_NUMBER: int +PR_ORGANIZATIONAL_ID_NUMBER_W: int +PR_ORGANIZATIONAL_ID_NUMBER_A: int +PR_SURNAME: int +PR_SURNAME_W: int +PR_SURNAME_A: int +PR_ORIGINAL_ENTRYID: int +PR_ORIGINAL_DISPLAY_NAME: int +PR_ORIGINAL_DISPLAY_NAME_W: int +PR_ORIGINAL_DISPLAY_NAME_A: int +PR_ORIGINAL_SEARCH_KEY: int +PR_POSTAL_ADDRESS: int +PR_POSTAL_ADDRESS_W: int +PR_POSTAL_ADDRESS_A: int +PR_COMPANY_NAME: int +PR_COMPANY_NAME_W: int +PR_COMPANY_NAME_A: int +PR_TITLE: int +PR_TITLE_W: int +PR_TITLE_A: int +PR_DEPARTMENT_NAME: int +PR_DEPARTMENT_NAME_W: int +PR_DEPARTMENT_NAME_A: int +PR_OFFICE_LOCATION: int +PR_OFFICE_LOCATION_W: int +PR_OFFICE_LOCATION_A: int +PR_PRIMARY_TELEPHONE_NUMBER: int +PR_PRIMARY_TELEPHONE_NUMBER_W: int +PR_PRIMARY_TELEPHONE_NUMBER_A: int +PR_BUSINESS2_TELEPHONE_NUMBER: int +PR_BUSINESS2_TELEPHONE_NUMBER_W: int +PR_BUSINESS2_TELEPHONE_NUMBER_A: int +PR_OFFICE2_TELEPHONE_NUMBER: int +PR_OFFICE2_TELEPHONE_NUMBER_W: int +PR_OFFICE2_TELEPHONE_NUMBER_A: int +PR_MOBILE_TELEPHONE_NUMBER: int +PR_MOBILE_TELEPHONE_NUMBER_W: int +PR_MOBILE_TELEPHONE_NUMBER_A: int +PR_CELLULAR_TELEPHONE_NUMBER: int +PR_CELLULAR_TELEPHONE_NUMBER_W: int +PR_CELLULAR_TELEPHONE_NUMBER_A: int +PR_RADIO_TELEPHONE_NUMBER: int +PR_RADIO_TELEPHONE_NUMBER_W: int +PR_RADIO_TELEPHONE_NUMBER_A: int +PR_CAR_TELEPHONE_NUMBER: int +PR_CAR_TELEPHONE_NUMBER_W: int +PR_CAR_TELEPHONE_NUMBER_A: int +PR_OTHER_TELEPHONE_NUMBER: int +PR_OTHER_TELEPHONE_NUMBER_W: int +PR_OTHER_TELEPHONE_NUMBER_A: int +PR_TRANSMITABLE_DISPLAY_NAME: int +PR_TRANSMITABLE_DISPLAY_NAME_W: int +PR_TRANSMITABLE_DISPLAY_NAME_A: int +PR_PAGER_TELEPHONE_NUMBER: int +PR_PAGER_TELEPHONE_NUMBER_W: int +PR_PAGER_TELEPHONE_NUMBER_A: int +PR_BEEPER_TELEPHONE_NUMBER: int +PR_BEEPER_TELEPHONE_NUMBER_W: int +PR_BEEPER_TELEPHONE_NUMBER_A: int +PR_USER_CERTIFICATE: int +PR_PRIMARY_FAX_NUMBER: int +PR_PRIMARY_FAX_NUMBER_W: int +PR_PRIMARY_FAX_NUMBER_A: int +PR_BUSINESS_FAX_NUMBER: int +PR_BUSINESS_FAX_NUMBER_W: int +PR_BUSINESS_FAX_NUMBER_A: int +PR_HOME_FAX_NUMBER: int +PR_HOME_FAX_NUMBER_W: int +PR_HOME_FAX_NUMBER_A: int +PR_COUNTRY: int +PR_COUNTRY_W: int +PR_COUNTRY_A: int +PR_BUSINESS_ADDRESS_COUNTRY: int +PR_BUSINESS_ADDRESS_COUNTRY_W: int +PR_BUSINESS_ADDRESS_COUNTRY_A: int +PR_LOCALITY: int +PR_LOCALITY_W: int +PR_LOCALITY_A: int +PR_BUSINESS_ADDRESS_CITY: int +PR_BUSINESS_ADDRESS_CITY_W: int +PR_BUSINESS_ADDRESS_CITY_A: int +PR_STATE_OR_PROVINCE: int +PR_STATE_OR_PROVINCE_W: int +PR_STATE_OR_PROVINCE_A: int +PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE: int +PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W: int +PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A: int +PR_STREET_ADDRESS: int +PR_STREET_ADDRESS_W: int +PR_STREET_ADDRESS_A: int +PR_BUSINESS_ADDRESS_STREET: int +PR_BUSINESS_ADDRESS_STREET_W: int +PR_BUSINESS_ADDRESS_STREET_A: int +PR_POSTAL_CODE: int +PR_POSTAL_CODE_W: int +PR_POSTAL_CODE_A: int +PR_BUSINESS_ADDRESS_POSTAL_CODE: int +PR_BUSINESS_ADDRESS_POSTAL_CODE_W: int +PR_BUSINESS_ADDRESS_POSTAL_CODE_A: int +PR_POST_OFFICE_BOX: int +PR_POST_OFFICE_BOX_W: int +PR_POST_OFFICE_BOX_A: int +PR_BUSINESS_ADDRESS_POST_OFFICE_BOX: int +PR_BUSINESS_ADDRESS_POST_OFFICE_BOX_W: int +PR_BUSINESS_ADDRESS_POST_OFFICE_BOX_A: int +PR_TELEX_NUMBER: int +PR_TELEX_NUMBER_W: int +PR_TELEX_NUMBER_A: int +PR_ISDN_NUMBER: int +PR_ISDN_NUMBER_W: int +PR_ISDN_NUMBER_A: int +PR_ASSISTANT_TELEPHONE_NUMBER: int +PR_ASSISTANT_TELEPHONE_NUMBER_W: int +PR_ASSISTANT_TELEPHONE_NUMBER_A: int +PR_HOME2_TELEPHONE_NUMBER: int +PR_HOME2_TELEPHONE_NUMBER_W: int +PR_HOME2_TELEPHONE_NUMBER_A: int +PR_ASSISTANT: int +PR_ASSISTANT_W: int +PR_ASSISTANT_A: int +PR_SEND_RICH_INFO: int +PR_WEDDING_ANNIVERSARY: int +PR_BIRTHDAY: int +PR_HOBBIES: int +PR_HOBBIES_W: int +PR_HOBBIES_A: int +PR_MIDDLE_NAME: int +PR_MIDDLE_NAME_W: int +PR_MIDDLE_NAME_A: int +PR_DISPLAY_NAME_PREFIX: int +PR_DISPLAY_NAME_PREFIX_W: int +PR_DISPLAY_NAME_PREFIX_A: int +PR_PROFESSION: int +PR_PROFESSION_W: int +PR_PROFESSION_A: int +PR_PREFERRED_BY_NAME: int +PR_PREFERRED_BY_NAME_W: int +PR_PREFERRED_BY_NAME_A: int +PR_SPOUSE_NAME: int +PR_SPOUSE_NAME_W: int +PR_SPOUSE_NAME_A: int +PR_COMPUTER_NETWORK_NAME: int +PR_COMPUTER_NETWORK_NAME_W: int +PR_COMPUTER_NETWORK_NAME_A: int +PR_CUSTOMER_ID: int +PR_CUSTOMER_ID_W: int +PR_CUSTOMER_ID_A: int +PR_TTYTDD_PHONE_NUMBER: int +PR_TTYTDD_PHONE_NUMBER_W: int +PR_TTYTDD_PHONE_NUMBER_A: int +PR_FTP_SITE: int +PR_FTP_SITE_W: int +PR_FTP_SITE_A: int +PR_GENDER: int +PR_MANAGER_NAME: int +PR_MANAGER_NAME_W: int +PR_MANAGER_NAME_A: int +PR_NICKNAME: int +PR_NICKNAME_W: int +PR_NICKNAME_A: int +PR_PERSONAL_HOME_PAGE: int +PR_PERSONAL_HOME_PAGE_W: int +PR_PERSONAL_HOME_PAGE_A: int +PR_BUSINESS_HOME_PAGE: int +PR_BUSINESS_HOME_PAGE_W: int +PR_BUSINESS_HOME_PAGE_A: int +PR_CONTACT_VERSION: int +PR_CONTACT_ENTRYIDS: int +PR_CONTACT_ADDRTYPES: int +PR_CONTACT_ADDRTYPES_W: int +PR_CONTACT_ADDRTYPES_A: int +PR_CONTACT_DEFAULT_ADDRESS_INDEX: int +PR_CONTACT_EMAIL_ADDRESSES: int +PR_CONTACT_EMAIL_ADDRESSES_W: int +PR_CONTACT_EMAIL_ADDRESSES_A: int +PR_COMPANY_MAIN_PHONE_NUMBER: int +PR_COMPANY_MAIN_PHONE_NUMBER_W: int +PR_COMPANY_MAIN_PHONE_NUMBER_A: int +PR_CHILDRENS_NAMES: int +PR_CHILDRENS_NAMES_W: int +PR_CHILDRENS_NAMES_A: int +PR_HOME_ADDRESS_CITY: int +PR_HOME_ADDRESS_CITY_W: int +PR_HOME_ADDRESS_CITY_A: int +PR_HOME_ADDRESS_COUNTRY: int +PR_HOME_ADDRESS_COUNTRY_W: int +PR_HOME_ADDRESS_COUNTRY_A: int +PR_HOME_ADDRESS_POSTAL_CODE: int +PR_HOME_ADDRESS_POSTAL_CODE_W: int +PR_HOME_ADDRESS_POSTAL_CODE_A: int +PR_HOME_ADDRESS_STATE_OR_PROVINCE: int +PR_HOME_ADDRESS_STATE_OR_PROVINCE_W: int +PR_HOME_ADDRESS_STATE_OR_PROVINCE_A: int +PR_HOME_ADDRESS_STREET: int +PR_HOME_ADDRESS_STREET_W: int +PR_HOME_ADDRESS_STREET_A: int +PR_HOME_ADDRESS_POST_OFFICE_BOX: int +PR_HOME_ADDRESS_POST_OFFICE_BOX_W: int +PR_HOME_ADDRESS_POST_OFFICE_BOX_A: int +PR_OTHER_ADDRESS_CITY: int +PR_OTHER_ADDRESS_CITY_W: int +PR_OTHER_ADDRESS_CITY_A: int +PR_OTHER_ADDRESS_COUNTRY: int +PR_OTHER_ADDRESS_COUNTRY_W: int +PR_OTHER_ADDRESS_COUNTRY_A: int +PR_OTHER_ADDRESS_POSTAL_CODE: int +PR_OTHER_ADDRESS_POSTAL_CODE_W: int +PR_OTHER_ADDRESS_POSTAL_CODE_A: int +PR_OTHER_ADDRESS_STATE_OR_PROVINCE: int +PR_OTHER_ADDRESS_STATE_OR_PROVINCE_W: int +PR_OTHER_ADDRESS_STATE_OR_PROVINCE_A: int +PR_OTHER_ADDRESS_STREET: int +PR_OTHER_ADDRESS_STREET_W: int +PR_OTHER_ADDRESS_STREET_A: int +PR_OTHER_ADDRESS_POST_OFFICE_BOX: int +PR_OTHER_ADDRESS_POST_OFFICE_BOX_W: int +PR_OTHER_ADDRESS_POST_OFFICE_BOX_A: int +PR_STORE_PROVIDERS: int +PR_AB_PROVIDERS: int +PR_TRANSPORT_PROVIDERS: int +PR_DEFAULT_PROFILE: int +PR_AB_SEARCH_PATH: int +PR_AB_DEFAULT_DIR: int +PR_AB_DEFAULT_PAB: int +PR_FILTERING_HOOKS: int +PR_SERVICE_NAME: int +PR_SERVICE_NAME_W: int +PR_SERVICE_NAME_A: int +PR_SERVICE_DLL_NAME: int +PR_SERVICE_DLL_NAME_W: int +PR_SERVICE_DLL_NAME_A: int +PR_SERVICE_ENTRY_NAME: int +PR_SERVICE_UID: int +PR_SERVICE_EXTRA_UIDS: int +PR_SERVICES: int +PR_SERVICE_SUPPORT_FILES: int +PR_SERVICE_SUPPORT_FILES_W: int +PR_SERVICE_SUPPORT_FILES_A: int +PR_SERVICE_DELETE_FILES: int +PR_SERVICE_DELETE_FILES_W: int +PR_SERVICE_DELETE_FILES_A: int +PR_AB_SEARCH_PATH_UPDATE: int +PR_PROFILE_NAME: int +PR_PROFILE_NAME_A: int +PR_PROFILE_NAME_W: int +PR_IDENTITY_DISPLAY: int +PR_IDENTITY_DISPLAY_W: int +PR_IDENTITY_DISPLAY_A: int +PR_IDENTITY_ENTRYID: int +PR_RESOURCE_METHODS: int +PR_RESOURCE_TYPE: int +PR_STATUS_CODE: int +PR_IDENTITY_SEARCH_KEY: int +PR_OWN_STORE_ENTRYID: int +PR_RESOURCE_PATH: int +PR_RESOURCE_PATH_W: int +PR_RESOURCE_PATH_A: int +PR_STATUS_STRING: int +PR_STATUS_STRING_W: int +PR_STATUS_STRING_A: int +PR_X400_DEFERRED_DELIVERY_CANCEL: int +PR_HEADER_FOLDER_ENTRYID: int +PR_REMOTE_PROGRESS: int +PR_REMOTE_PROGRESS_TEXT: int +PR_REMOTE_PROGRESS_TEXT_W: int +PR_REMOTE_PROGRESS_TEXT_A: int +PR_REMOTE_VALIDATE_OK: int +PR_CONTROL_FLAGS: int +PR_CONTROL_STRUCTURE: int +PR_CONTROL_TYPE: int +PR_DELTAX: int +PR_DELTAY: int +PR_XPOS: int +PR_YPOS: int +PR_CONTROL_ID: int +PR_INITIAL_DETAILS_PANE: int +PROP_ID_SECURE_MIN: int +PROP_ID_SECURE_MAX: int +pidExchangeXmitReservedMin: int +pidExchangeNonXmitReservedMin: int +pidProfileMin: int +pidStoreMin: int +pidFolderMin: int +pidMessageReadOnlyMin: int +pidMessageWriteableMin: int +pidAttachReadOnlyMin: int +pidSpecialMin: int +pidAdminMin: int +pidSecureProfileMin: int +PR_PROFILE_VERSION: int +PR_PROFILE_CONFIG_FLAGS: int +PR_PROFILE_HOME_SERVER: int +PR_PROFILE_HOME_SERVER_DN: int +PR_PROFILE_HOME_SERVER_ADDRS: int +PR_PROFILE_USER: int +PR_PROFILE_CONNECT_FLAGS: int +PR_PROFILE_TRANSPORT_FLAGS: int +PR_PROFILE_UI_STATE: int +PR_PROFILE_UNRESOLVED_NAME: int +PR_PROFILE_UNRESOLVED_SERVER: int +PR_PROFILE_BINDING_ORDER: int +PR_PROFILE_MAX_RESTRICT: int +PR_PROFILE_AB_FILES_PATH: int +PR_PROFILE_OFFLINE_STORE_PATH: int +PR_PROFILE_OFFLINE_INFO: int +PR_PROFILE_ADDR_INFO: int +PR_PROFILE_OPTIONS_DATA: int +PR_PROFILE_SECURE_MAILBOX: int +PR_DISABLE_WINSOCK: int +PR_OST_ENCRYPTION: int +PR_PROFILE_OPEN_FLAGS: int +PR_PROFILE_TYPE: int +PR_PROFILE_MAILBOX: int +PR_PROFILE_SERVER: int +PR_PROFILE_SERVER_DN: int +PR_PROFILE_FAVFLD_DISPLAY_NAME: int +PR_PROFILE_FAVFLD_COMMENT: int +PR_PROFILE_ALLPUB_DISPLAY_NAME: int +PR_PROFILE_ALLPUB_COMMENT: int +OSTF_NO_ENCRYPTION: int +OSTF_COMPRESSABLE_ENCRYPTION: int +OSTF_BEST_ENCRYPTION: int +PR_NON_IPM_SUBTREE_ENTRYID: int +PR_EFORMS_REGISTRY_ENTRYID: int +PR_SPLUS_FREE_BUSY_ENTRYID: int +PR_OFFLINE_ADDRBOOK_ENTRYID: int +PR_EFORMS_FOR_LOCALE_ENTRYID: int +PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID: int +PR_ADDRBOOK_FOR_LOCAL_SITE_ENTRYID: int +PR_OFFLINE_MESSAGE_ENTRYID: int +PR_IPM_FAVORITES_ENTRYID: int +PR_IPM_PUBLIC_FOLDERS_ENTRYID: int +PR_GW_MTSIN_ENTRYID: int +PR_GW_MTSOUT_ENTRYID: int +PR_TRANSFER_ENABLED: int +PR_TEST_LINE_SPEED: int +PR_HIERARCHY_SYNCHRONIZER: int +PR_CONTENTS_SYNCHRONIZER: int +PR_COLLECTOR: int +PR_FAST_TRANSFER: int +PR_STORE_OFFLINE: int +PR_IN_TRANSIT: int +PR_REPLICATION_STYLE: int +PR_REPLICATION_SCHEDULE: int +PR_REPLICATION_MESSAGE_PRIORITY: int +PR_OVERALL_MSG_AGE_LIMIT: int +PR_REPLICATION_ALWAYS_INTERVAL: int +PR_REPLICATION_MSG_SIZE: int +STYLE_ALWAYS_INTERVAL_DEFAULT: int +REPLICATION_MESSAGE_SIZE_LIMIT_DEFAULT: int +STYLE_NEVER: int +STYLE_NORMAL: int +STYLE_ALWAYS: int +STYLE_DEFAULT: int +PR_SOURCE_KEY: int +PR_PARENT_SOURCE_KEY: int +PR_CHANGE_KEY: int +PR_PREDECESSOR_CHANGE_LIST: int +PR_FOLDER_CHILD_COUNT: int +PR_RIGHTS: int +PR_ACL_TABLE: int +PR_RULES_TABLE: int +PR_HAS_RULES: int +PR_ADDRESS_BOOK_ENTRYID: int +PR_ACL_DATA: int +PR_RULES_DATA: int +PR_FOLDER_DESIGN_FLAGS: int +PR_DESIGN_IN_PROGRESS: int +PR_SECURE_ORIGINATION: int +PR_PUBLISH_IN_ADDRESS_BOOK: int +PR_RESOLVE_METHOD: int +PR_ADDRESS_BOOK_DISPLAY_NAME: int +PR_EFORMS_LOCALE_ID: int +PR_REPLICA_LIST: int +PR_OVERALL_AGE_LIMIT: int +RESOLVE_METHOD_DEFAULT: int +RESOLVE_METHOD_LAST_WRITER_WINS: int +RESOLVE_METHOD_NO_CONFLICT_NOTIFICATION: int +PR_PUBLIC_FOLDER_ENTRYID: int +PR_HAS_NAMED_PROPERTIES: int +PR_CREATOR_NAME: int +PR_CREATOR_ENTRYID: int +PR_LAST_MODIFIER_NAME: int +PR_LAST_MODIFIER_ENTRYID: int +PR_HAS_DAMS: int +PR_RULE_TRIGGER_HISTORY: int +PR_MOVE_TO_STORE_ENTRYID: int +PR_MOVE_TO_FOLDER_ENTRYID: int +PR_REPLICA_SERVER: int +PR_DEFERRED_SEND_NUMBER: int +PR_DEFERRED_SEND_UNITS: int +PR_EXPIRY_NUMBER: int +PR_EXPIRY_UNITS: int +PR_DEFERRED_SEND_TIME: int +PR_GW_ADMIN_OPERATIONS: int +PR_P1_CONTENT: int +PR_P1_CONTENT_TYPE: int +PR_CLIENT_ACTIONS: int +PR_DAM_ORIGINAL_ENTRYID: int +PR_DAM_BACK_PATCHED: int +PR_RULE_ERROR: int +PR_RULE_ACTION_TYPE: int +PR_RULE_ACTION_NUMBER: int +PR_RULE_FOLDER_ENTRYID: int +PR_CONFLICT_ENTRYID: int +PR_MESSAGE_LOCALE_ID: int +PR_STORAGE_QUOTA_LIMIT: int +PR_EXCESS_STORAGE_USED: int +PR_SVR_GENERATING_QUOTA_MSG: int +PR_DELEGATED_BY_RULE: int +MSGSTATUS_IN_CONFLICT: int +PR_IN_CONFLICT: int +PR_LONGTERM_ENTRYID_FROM_TABLE: int +PR_ORIGINATOR_NAME: int +PR_ORIGINATOR_ADDR: int +PR_ORIGINATOR_ADDRTYPE: int +PR_ORIGINATOR_ENTRYID: int +PR_ARRIVAL_TIME: int +PR_TRACE_INFO: int +PR_INTERNAL_TRACE_INFO: int +PR_SUBJECT_TRACE_INFO: int +PR_RECIPIENT_NUMBER: int +PR_MTS_SUBJECT_ID: int +PR_REPORT_DESTINATION_NAME: int +PR_REPORT_DESTINATION_ENTRYID: int +PR_CONTENT_SEARCH_KEY: int +PR_FOREIGN_ID: int +PR_FOREIGN_REPORT_ID: int +PR_FOREIGN_SUBJECT_ID: int +PR_MTS_ID: int +PR_MTS_REPORT_ID: int +PR_FOLDER_FLAGS: int +PR_LAST_ACCESS_TIME: int +PR_RESTRICTION_COUNT: int +PR_CATEG_COUNT: int +PR_CACHED_COLUMN_COUNT: int +PR_NORMAL_MSG_W_ATTACH_COUNT: int +PR_ASSOC_MSG_W_ATTACH_COUNT: int +PR_RECIPIENT_ON_NORMAL_MSG_COUNT: int +PR_RECIPIENT_ON_ASSOC_MSG_COUNT: int +PR_ATTACH_ON_NORMAL_MSG_COUNT: int +PR_ATTACH_ON_ASSOC_MSG_COUNT: int +PR_NORMAL_MESSAGE_SIZE: int +PR_NORMAL_MESSAGE_SIZE_EXTENDED: int +PR_ASSOC_MESSAGE_SIZE: int +PR_ASSOC_MESSAGE_SIZE_EXTENDED: int +PR_FOLDER_PATHNAME: int +PR_OWNER_COUNT: int +PR_CONTACT_COUNT: int +PR_MESSAGE_SIZE_EXTENDED: int +PR_USERFIELDS: int +PR_FORCE_USE_ENTRYID_SERVER: int +PR_PROFILE_MDB_DN: int +PST_EXTERN_PROPID_BASE: int +PR_PST_PATH: int +PR_PST_PATH_W: int +PR_PST_PATH_A: int +PR_PST_REMEMBER_PW: int +PR_PST_ENCRYPTION: int +PR_PST_PW_SZ_OLD: int +PR_PST_PW_SZ_OLD_W: int +PR_PST_PW_SZ_OLD_A: int +PR_PST_PW_SZ_NEW: int +PR_PST_PW_SZ_NEW_W: int +PR_PST_PW_SZ_NEW_A: int diff --git a/stubs/pywin32/win32comext/mapi/mapiutil.pyi b/stubs/pywin32/win32comext/mapi/mapiutil.pyi new file mode 100644 index 0000000..f370af5 --- /dev/null +++ b/stubs/pywin32/win32comext/mapi/mapiutil.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +from win32comext.mapi import mapi as mapi, mapitags as mapitags + +TupleType = tuple +ListType = list +IntType = int +prTable: Incomplete + +def GetPropTagName(pt): ... + +mapiErrorTable: Incomplete + +def GetScodeString(hr): ... + +ptTable: Incomplete + +def GetMapiTypeName(propType, rawType: bool = ...): ... +def GetProperties(obj, propList): ... +def GetAllProperties(obj, make_tag_names: bool = ...): ... +def SetPropertyValue(obj, prop, val) -> None: ... +def SetProperties(msg, propDict) -> None: ... diff --git a/stubs/pywin32/win32comext/propsys/__init__.pyi b/stubs/pywin32/win32comext/propsys/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/propsys/propsys.pyi b/stubs/pywin32/win32comext/propsys/propsys.pyi new file mode 100644 index 0000000..8513725 --- /dev/null +++ b/stubs/pywin32/win32comext/propsys/propsys.pyi @@ -0,0 +1,60 @@ +from typing_extensions import TypeAlias + +import _win32typing +from win32.lib.pywintypes import com_error + +error: TypeAlias = com_error # noqa: Y042 + +def PSGetItemPropertyHandler( + Item: _win32typing.PyIShellItem, riid: _win32typing.PyIID, ReadWrite: int +) -> _win32typing.PyIPropertyStore: ... +def PSGetPropertyDescription( + Key: _win32typing.PyPROPERTYKEY, riid: _win32typing.PyIID +) -> _win32typing.PyIPropertyDescription: ... +def PSGetPropertySystem(riid: _win32typing.PyIID) -> _win32typing.PyIPropertySystem: ... +def PSGetNameFromPropertyKey(Key: _win32typing.PyPROPERTYKEY) -> str: ... +def PSGetPropertyKeyFromName(Name) -> _win32typing.PyPROPERTYKEY: ... +def PSRegisterPropertySchema(filename) -> None: ... +def PSUnregisterPropertySchema(filename) -> None: ... +def SHGetPropertyStoreFromParsingName( + Path: str, Flags, riid: _win32typing.PyIID, BindCtx: _win32typing.PyIBindCtx | None = ... +) -> _win32typing.PyIPropertyStore: ... +def StgSerializePropVariant(propvar: _win32typing.PyPROPVARIANT): ... +def StgDeserializePropVariant(prop) -> _win32typing.PyPROPVARIANT: ... +def PSCreateMemoryPropertyStore(riid: _win32typing.PyIID) -> _win32typing.PyIPropertyStore: ... +def PSCreatePropertyStoreFromPropertySetStorage( + pss: _win32typing.PyIPropertySetStorage, Mode, riid: _win32typing.PyIID +) -> _win32typing.PyIPropertyStore: ... +def PSLookupPropertyHandlerCLSID(FilePath) -> _win32typing.PyIID: ... +def SHGetPropertyStoreForWindow(hwnd: int, riid: _win32typing.PyIID) -> _win32typing.PyIPropertyStore: ... +def PSGetPropertyFromPropertyStorage(ps, key: _win32typing.PyPROPERTYKEY) -> _win32typing.PyPROPVARIANT: ... +def PSGetNamedPropertyFromPropertyStorage(ps, name) -> _win32typing.PyPROPVARIANT: ... +def PSCreateSimplePropertyChange( + flags, key: _win32typing.PyPROPERTYKEY, val: _win32typing.PyPROPVARIANT, riid: _win32typing.PyIID +) -> _win32typing.PyIPropertyChange: ... +def PSCreatePropertyChangeArray() -> _win32typing.PyIPropertyChangeArray: ... +def SHSetDefaultProperties( + hwnd: int, + Item: _win32typing.PyIShellItem, + FileOpFlags: int = ..., + Sink: _win32typing.PyGFileOperationProgressSink | None = ..., +) -> None: ... + +IID_IInitializeWithFile: _win32typing.PyIID +IID_IInitializeWithStream: _win32typing.PyIID +IID_INamedPropertyStore: _win32typing.PyIID +IID_IObjectWithPropertyKey: _win32typing.PyIID +IID_IPersistSerializedPropStorage: _win32typing.PyIID +IID_IPropertyChange: _win32typing.PyIID +IID_IPropertyChangeArray: _win32typing.PyIID +IID_IPropertyDescription: _win32typing.PyIID +IID_IPropertyDescriptionAliasInfo: _win32typing.PyIID +IID_IPropertyDescriptionList: _win32typing.PyIID +IID_IPropertyDescriptionSearchInfo: _win32typing.PyIID +IID_IPropertyEnumType: _win32typing.PyIID +IID_IPropertyEnumTypeList: _win32typing.PyIID +IID_IPropertyStore: _win32typing.PyIID +IID_IPropertyStoreCache: _win32typing.PyIID +IID_IPropertyStoreCapabilities: _win32typing.PyIID +IID_IPropertySystem: _win32typing.PyIID +PROPVARIANTType = _win32typing.PyPROPVARIANT diff --git a/stubs/pywin32/win32comext/propsys/pscon.pyi b/stubs/pywin32/win32comext/propsys/pscon.pyi new file mode 100644 index 0000000..f142fe8 --- /dev/null +++ b/stubs/pywin32/win32comext/propsys/pscon.pyi @@ -0,0 +1,694 @@ +from _typeshed import Incomplete + +PET_DISCRETEVALUE: int +PET_RANGEDVALUE: int +PET_DEFAULTVALUE: int +PET_ENDRANGE: int +PDTF_DEFAULT: int +PDTF_MULTIPLEVALUES: int +PDTF_ISINNATE: int +PDTF_ISGROUP: int +PDTF_CANGROUPBY: int +PDTF_CANSTACKBY: int +PDTF_ISTREEPROPERTY: int +PDTF_INCLUDEINFULLTEXTQUERY: int +PDTF_ISVIEWABLE: int +PDTF_ISQUERYABLE: int +PDTF_ISSYSTEMPROPERTY: int +PDTF_MASK_ALL: int +PDVF_DEFAULT: int +PDVF_CENTERALIGN: int +PDVF_RIGHTALIGN: int +PDVF_BEGINNEWGROUP: int +PDVF_FILLAREA: int +PDVF_SORTDESCENDING: int +PDVF_SHOWONLYIFPRESENT: int +PDVF_SHOWBYDEFAULT: int +PDVF_SHOWINPRIMARYLIST: int +PDVF_SHOWINSECONDARYLIST: int +PDVF_HIDELABEL: int +PDVF_HIDDEN: int +PDVF_CANWRAP: int +PDVF_MASK_ALL: int +PDDT_STRING: int +PDDT_NUMBER: int +PDDT_BOOLEAN: int +PDDT_DATETIME: int +PDDT_ENUMERATED: int +PDGR_DISCRETE: int +PDGR_ALPHANUMERIC: int +PDGR_SIZE: int +PDGR_DYNAMIC: int +PDGR_DATE: int +PDGR_PERCENT: int +PDGR_ENUMERATED: int +PDFF_DEFAULT: int +PDFF_PREFIXNAME: int +PDFF_FILENAME: int +PDFF_ALWAYSKB: int +PDFF_RESERVED_RIGHTTOLEFT: int +PDFF_SHORTTIME: int +PDFF_LONGTIME: int +PDFF_HIDETIME: int +PDFF_SHORTDATE: int +PDFF_LONGDATE: int +PDFF_HIDEDATE: int +PDFF_RELATIVEDATE: int +PDFF_USEEDITINVITATION: int +PDFF_READONLY: int +PDFF_NOAUTOREADINGORDER: int +PDSD_GENERAL: int +PDSD_A_Z: int +PDSD_LOWEST_HIGHEST: int +PDSD_SMALLEST_BIGGEST: int +PDSD_OLDEST_NEWEST: int +PDRDT_GENERAL: int +PDRDT_DATE: int +PDRDT_SIZE: int +PDRDT_COUNT: int +PDRDT_REVISION: int +PDRDT_LENGTH: int +PDRDT_DURATION: int +PDRDT_SPEED: int +PDRDT_RATE: int +PDRDT_RATING: int +PDRDT_PRIORITY: int +PDAT_DEFAULT: int +PDAT_FIRST: int +PDAT_SUM: int +PDAT_AVERAGE: int +PDAT_DATERANGE: int +PDAT_UNION: int +PDAT_MAX: int +PDAT_MIN: int +PDCOT_NONE: int +PDCOT_STRING: int +PDCOT_SIZE: int +PDCOT_DATETIME: int +PDCOT_BOOLEAN: int +PDCOT_NUMBER: int +PDSIF_DEFAULT: int +PDSIF_ININVERTEDINDEX: int +PDSIF_ISCOLUMN: int +PDSIF_ISCOLUMNSPARSE: int +PDCIT_NONE: int +PDCIT_ONDISK: int +PDCIT_INMEMORY: int +PDEF_ALL: int +PDEF_SYSTEM: int +PDEF_NONSYSTEM: int +PDEF_VIEWABLE: int +PDEF_QUERYABLE: int +PDEF_INFULLTEXTQUERY: int +PDEF_COLUMN: int +PSC_NORMAL: int +PSC_NOTINSOURCE: int +PSC_DIRTY: int +COP_IMPLICIT: int +COP_EQUAL: int +COP_NOTEQUAL: int +COP_LESSTHAN: int +COP_GREATERTHAN: int +COP_LESSTHANOREQUAL: int +COP_GREATERTHANOREQUAL: int +COP_VALUE_STARTSWITH: int +COP_VALUE_ENDSWITH: int +COP_VALUE_CONTAINS: int +COP_VALUE_NOTCONTAINS: int +COP_DOSWILDCARDS: int +COP_WORD_EQUAL: int +COP_WORD_STARTSWITH: int +COP_APPLICATION_SPECIFIC: int +FPSPS_READONLY: int +PKEY_PIDSTR_MAX: int +GUIDSTRING_MAX: Incomplete +PKEYSTR_MAX: Incomplete +PKEY_Audio_ChannelCount: Incomplete +PKEY_Audio_Compression: Incomplete +PKEY_Audio_EncodingBitrate: Incomplete +PKEY_Audio_Format: Incomplete +PKEY_Audio_IsVariableBitRate: Incomplete +PKEY_Audio_PeakValue: Incomplete +PKEY_Audio_SampleRate: Incomplete +PKEY_Audio_SampleSize: Incomplete +PKEY_Audio_StreamName: Incomplete +PKEY_Audio_StreamNumber: Incomplete +PKEY_Calendar_Duration: Incomplete +PKEY_Calendar_IsOnline: Incomplete +PKEY_Calendar_IsRecurring: Incomplete +PKEY_Calendar_Location: Incomplete +PKEY_Calendar_OptionalAttendeeAddresses: Incomplete +PKEY_Calendar_OptionalAttendeeNames: Incomplete +PKEY_Calendar_OrganizerAddress: Incomplete +PKEY_Calendar_OrganizerName: Incomplete +PKEY_Calendar_ReminderTime: Incomplete +PKEY_Calendar_RequiredAttendeeAddresses: Incomplete +PKEY_Calendar_RequiredAttendeeNames: Incomplete +PKEY_Calendar_Resources: Incomplete +PKEY_Calendar_ShowTimeAs: Incomplete +PKEY_Calendar_ShowTimeAsText: Incomplete +PKEY_Communication_AccountName: Incomplete +PKEY_Communication_Suffix: Incomplete +PKEY_Communication_TaskStatus: Incomplete +PKEY_Communication_TaskStatusText: Incomplete +PKEY_Computer_DecoratedFreeSpace: Incomplete +PKEY_Contact_Anniversary: Incomplete +PKEY_Contact_AssistantName: Incomplete +PKEY_Contact_AssistantTelephone: Incomplete +PKEY_Contact_Birthday: Incomplete +PKEY_Contact_BusinessAddress: Incomplete +PKEY_Contact_BusinessAddressCity: Incomplete +PKEY_Contact_BusinessAddressCountry: Incomplete +PKEY_Contact_BusinessAddressPostalCode: Incomplete +PKEY_Contact_BusinessAddressPostOfficeBox: Incomplete +PKEY_Contact_BusinessAddressState: Incomplete +PKEY_Contact_BusinessAddressStreet: Incomplete +PKEY_Contact_BusinessFaxNumber: Incomplete +PKEY_Contact_BusinessHomePage: Incomplete +PKEY_Contact_BusinessTelephone: Incomplete +PKEY_Contact_CallbackTelephone: Incomplete +PKEY_Contact_CarTelephone: Incomplete +PKEY_Contact_Children: Incomplete +PKEY_Contact_CompanyMainTelephone: Incomplete +PKEY_Contact_Department: Incomplete +PKEY_Contact_EmailAddress: Incomplete +PKEY_Contact_EmailAddress2: Incomplete +PKEY_Contact_EmailAddress3: Incomplete +PKEY_Contact_EmailAddresses: Incomplete +PKEY_Contact_EmailName: Incomplete +PKEY_Contact_FileAsName: Incomplete +PKEY_Contact_FirstName: Incomplete +PKEY_Contact_FullName: Incomplete +PKEY_Contact_Gender: Incomplete +PKEY_Contact_Hobbies: Incomplete +PKEY_Contact_HomeAddress: Incomplete +PKEY_Contact_HomeAddressCity: Incomplete +PKEY_Contact_HomeAddressCountry: Incomplete +PKEY_Contact_HomeAddressPostalCode: Incomplete +PKEY_Contact_HomeAddressPostOfficeBox: Incomplete +PKEY_Contact_HomeAddressState: Incomplete +PKEY_Contact_HomeAddressStreet: Incomplete +PKEY_Contact_HomeFaxNumber: Incomplete +PKEY_Contact_HomeTelephone: Incomplete +PKEY_Contact_IMAddress: Incomplete +PKEY_Contact_Initials: Incomplete +PKEY_Contact_JA_CompanyNamePhonetic: Incomplete +PKEY_Contact_JA_FirstNamePhonetic: Incomplete +PKEY_Contact_JA_LastNamePhonetic: Incomplete +PKEY_Contact_JobTitle: Incomplete +PKEY_Contact_Label: Incomplete +PKEY_Contact_LastName: Incomplete +PKEY_Contact_MailingAddress: Incomplete +PKEY_Contact_MiddleName: Incomplete +PKEY_Contact_MobileTelephone: Incomplete +PKEY_Contact_NickName: Incomplete +PKEY_Contact_OfficeLocation: Incomplete +PKEY_Contact_OtherAddress: Incomplete +PKEY_Contact_OtherAddressCity: Incomplete +PKEY_Contact_OtherAddressCountry: Incomplete +PKEY_Contact_OtherAddressPostalCode: Incomplete +PKEY_Contact_OtherAddressPostOfficeBox: Incomplete +PKEY_Contact_OtherAddressState: Incomplete +PKEY_Contact_OtherAddressStreet: Incomplete +PKEY_Contact_PagerTelephone: Incomplete +PKEY_Contact_PersonalTitle: Incomplete +PKEY_Contact_PrimaryAddressCity: Incomplete +PKEY_Contact_PrimaryAddressCountry: Incomplete +PKEY_Contact_PrimaryAddressPostalCode: Incomplete +PKEY_Contact_PrimaryAddressPostOfficeBox: Incomplete +PKEY_Contact_PrimaryAddressState: Incomplete +PKEY_Contact_PrimaryAddressStreet: Incomplete +PKEY_Contact_PrimaryEmailAddress: Incomplete +PKEY_Contact_PrimaryTelephone: Incomplete +PKEY_Contact_Profession: Incomplete +PKEY_Contact_SpouseName: Incomplete +PKEY_Contact_Suffix: Incomplete +PKEY_Contact_TelexNumber: Incomplete +PKEY_Contact_TTYTDDTelephone: Incomplete +PKEY_Contact_WebPage: Incomplete +PKEY_AcquisitionID: Incomplete +PKEY_ApplicationName: Incomplete +PKEY_Author: Incomplete +PKEY_Capacity: Incomplete +PKEY_Category: Incomplete +PKEY_Comment: Incomplete +PKEY_Company: Incomplete +PKEY_ComputerName: Incomplete +PKEY_ContainedItems: Incomplete +PKEY_ContentStatus: Incomplete +PKEY_ContentType: Incomplete +PKEY_Copyright: Incomplete +PKEY_DateAccessed: Incomplete +PKEY_DateAcquired: Incomplete +PKEY_DateArchived: Incomplete +PKEY_DateCompleted: Incomplete +PKEY_DateCreated: Incomplete +PKEY_DateImported: Incomplete +PKEY_DateModified: Incomplete +PKEY_DueDate: Incomplete +PKEY_EndDate: Incomplete +PKEY_FileAllocationSize: Incomplete +PKEY_FileAttributes: Incomplete +PKEY_FileCount: Incomplete +PKEY_FileDescription: Incomplete +PKEY_FileExtension: Incomplete +PKEY_FileFRN: Incomplete +PKEY_FileName: Incomplete +PKEY_FileOwner: Incomplete +PKEY_FileVersion: Incomplete +PKEY_FindData: Incomplete +PKEY_FlagColor: Incomplete +PKEY_FlagColorText: Incomplete +PKEY_FlagStatus: Incomplete +PKEY_FlagStatusText: Incomplete +PKEY_FreeSpace: Incomplete +PKEY_Identity: Incomplete +PKEY_Importance: Incomplete +PKEY_ImportanceText: Incomplete +PKEY_IsAttachment: Incomplete +PKEY_IsDeleted: Incomplete +PKEY_IsFlagged: Incomplete +PKEY_IsFlaggedComplete: Incomplete +PKEY_IsIncomplete: Incomplete +PKEY_IsRead: Incomplete +PKEY_IsSendToTarget: Incomplete +PKEY_IsShared: Incomplete +PKEY_ItemAuthors: Incomplete +PKEY_ItemDate: Incomplete +PKEY_ItemFolderNameDisplay: Incomplete +PKEY_ItemFolderPathDisplay: Incomplete +PKEY_ItemFolderPathDisplayNarrow: Incomplete +PKEY_ItemName: Incomplete +PKEY_ItemNameDisplay: Incomplete +PKEY_ItemNamePrefix: Incomplete +PKEY_ItemParticipants: Incomplete +PKEY_ItemPathDisplay: Incomplete +PKEY_ItemPathDisplayNarrow: Incomplete +PKEY_ItemType: Incomplete +PKEY_ItemTypeText: Incomplete +PKEY_ItemUrl: Incomplete +PKEY_Keywords: Incomplete +PKEY_Kind: Incomplete +PKEY_KindText: Incomplete +PKEY_Language: Incomplete +PKEY_MileageInformation: Incomplete +PKEY_MIMEType: Incomplete +PKEY_Null: Incomplete +PKEY_OfflineAvailability: Incomplete +PKEY_OfflineStatus: Incomplete +PKEY_OriginalFileName: Incomplete +PKEY_ParentalRating: Incomplete +PKEY_ParentalRatingReason: Incomplete +PKEY_ParentalRatingsOrganization: Incomplete +PKEY_ParsingBindContext: Incomplete +PKEY_ParsingName: Incomplete +PKEY_ParsingPath: Incomplete +PKEY_PerceivedType: Incomplete +PKEY_PercentFull: Incomplete +PKEY_Priority: Incomplete +PKEY_PriorityText: Incomplete +PKEY_Project: Incomplete +PKEY_ProviderItemID: Incomplete +PKEY_Rating: Incomplete +PKEY_RatingText: Incomplete +PKEY_Sensitivity: Incomplete +PKEY_SensitivityText: Incomplete +PKEY_SFGAOFlags: Incomplete +PKEY_SharedWith: Incomplete +PKEY_ShareUserRating: Incomplete +PKEY_Shell_OmitFromView: Incomplete +PKEY_SimpleRating: Incomplete +PKEY_Size: Incomplete +PKEY_SoftwareUsed: Incomplete +PKEY_SourceItem: Incomplete +PKEY_StartDate: Incomplete +PKEY_Status: Incomplete +PKEY_Subject: Incomplete +PKEY_Thumbnail: Incomplete +PKEY_ThumbnailCacheId: Incomplete +PKEY_ThumbnailStream: Incomplete +PKEY_Title: Incomplete +PKEY_TotalFileSize: Incomplete +PKEY_Trademarks: Incomplete +PKEY_Document_ByteCount: Incomplete +PKEY_Document_CharacterCount: Incomplete +PKEY_Document_ClientID: Incomplete +PKEY_Document_Contributor: Incomplete +PKEY_Document_DateCreated: Incomplete +PKEY_Document_DatePrinted: Incomplete +PKEY_Document_DateSaved: Incomplete +PKEY_Document_Division: Incomplete +PKEY_Document_DocumentID: Incomplete +PKEY_Document_HiddenSlideCount: Incomplete +PKEY_Document_LastAuthor: Incomplete +PKEY_Document_LineCount: Incomplete +PKEY_Document_Manager: Incomplete +PKEY_Document_MultimediaClipCount: Incomplete +PKEY_Document_NoteCount: Incomplete +PKEY_Document_PageCount: Incomplete +PKEY_Document_ParagraphCount: Incomplete +PKEY_Document_PresentationFormat: Incomplete +PKEY_Document_RevisionNumber: Incomplete +PKEY_Document_Security: Incomplete +PKEY_Document_SlideCount: Incomplete +PKEY_Document_Template: Incomplete +PKEY_Document_TotalEditingTime: Incomplete +PKEY_Document_Version: Incomplete +PKEY_Document_WordCount: Incomplete +PKEY_DRM_DatePlayExpires: Incomplete +PKEY_DRM_DatePlayStarts: Incomplete +PKEY_DRM_Description: Incomplete +PKEY_DRM_IsProtected: Incomplete +PKEY_DRM_PlayCount: Incomplete +PKEY_GPS_Altitude: Incomplete +PKEY_GPS_AltitudeDenominator: Incomplete +PKEY_GPS_AltitudeNumerator: Incomplete +PKEY_GPS_AltitudeRef: Incomplete +PKEY_GPS_AreaInformation: Incomplete +PKEY_GPS_Date: Incomplete +PKEY_GPS_DestBearing: Incomplete +PKEY_GPS_DestBearingDenominator: Incomplete +PKEY_GPS_DestBearingNumerator: Incomplete +PKEY_GPS_DestBearingRef: Incomplete +PKEY_GPS_DestDistance: Incomplete +PKEY_GPS_DestDistanceDenominator: Incomplete +PKEY_GPS_DestDistanceNumerator: Incomplete +PKEY_GPS_DestDistanceRef: Incomplete +PKEY_GPS_DestLatitude: Incomplete +PKEY_GPS_DestLatitudeDenominator: Incomplete +PKEY_GPS_DestLatitudeNumerator: Incomplete +PKEY_GPS_DestLatitudeRef: Incomplete +PKEY_GPS_DestLongitude: Incomplete +PKEY_GPS_DestLongitudeDenominator: Incomplete +PKEY_GPS_DestLongitudeNumerator: Incomplete +PKEY_GPS_DestLongitudeRef: Incomplete +PKEY_GPS_Differential: Incomplete +PKEY_GPS_DOP: Incomplete +PKEY_GPS_DOPDenominator: Incomplete +PKEY_GPS_DOPNumerator: Incomplete +PKEY_GPS_ImgDirection: Incomplete +PKEY_GPS_ImgDirectionDenominator: Incomplete +PKEY_GPS_ImgDirectionNumerator: Incomplete +PKEY_GPS_ImgDirectionRef: Incomplete +PKEY_GPS_Latitude: Incomplete +PKEY_GPS_LatitudeDenominator: Incomplete +PKEY_GPS_LatitudeNumerator: Incomplete +PKEY_GPS_LatitudeRef: Incomplete +PKEY_GPS_Longitude: Incomplete +PKEY_GPS_LongitudeDenominator: Incomplete +PKEY_GPS_LongitudeNumerator: Incomplete +PKEY_GPS_LongitudeRef: Incomplete +PKEY_GPS_MapDatum: Incomplete +PKEY_GPS_MeasureMode: Incomplete +PKEY_GPS_ProcessingMethod: Incomplete +PKEY_GPS_Satellites: Incomplete +PKEY_GPS_Speed: Incomplete +PKEY_GPS_SpeedDenominator: Incomplete +PKEY_GPS_SpeedNumerator: Incomplete +PKEY_GPS_SpeedRef: Incomplete +PKEY_GPS_Status: Incomplete +PKEY_GPS_Track: Incomplete +PKEY_GPS_TrackDenominator: Incomplete +PKEY_GPS_TrackNumerator: Incomplete +PKEY_GPS_TrackRef: Incomplete +PKEY_GPS_VersionID: Incomplete +PKEY_Image_BitDepth: Incomplete +PKEY_Image_ColorSpace: Incomplete +PKEY_Image_CompressedBitsPerPixel: Incomplete +PKEY_Image_CompressedBitsPerPixelDenominator: Incomplete +PKEY_Image_CompressedBitsPerPixelNumerator: Incomplete +PKEY_Image_Compression: Incomplete +PKEY_Image_CompressionText: Incomplete +PKEY_Image_Dimensions: Incomplete +PKEY_Image_HorizontalResolution: Incomplete +PKEY_Image_HorizontalSize: Incomplete +PKEY_Image_ImageID: Incomplete +PKEY_Image_ResolutionUnit: Incomplete +PKEY_Image_VerticalResolution: Incomplete +PKEY_Image_VerticalSize: Incomplete +PKEY_Journal_Contacts: Incomplete +PKEY_Journal_EntryType: Incomplete +PKEY_Link_Comment: Incomplete +PKEY_Link_DateVisited: Incomplete +PKEY_Link_Description: Incomplete +PKEY_Link_Status: Incomplete +PKEY_Link_TargetExtension: Incomplete +PKEY_Link_TargetParsingPath: Incomplete +PKEY_Link_TargetSFGAOFlags: Incomplete +PKEY_Media_AuthorUrl: Incomplete +PKEY_Media_AverageLevel: Incomplete +PKEY_Media_ClassPrimaryID: Incomplete +PKEY_Media_ClassSecondaryID: Incomplete +PKEY_Media_CollectionGroupID: Incomplete +PKEY_Media_CollectionID: Incomplete +PKEY_Media_ContentDistributor: Incomplete +PKEY_Media_ContentID: Incomplete +PKEY_Media_CreatorApplication: Incomplete +PKEY_Media_CreatorApplicationVersion: Incomplete +PKEY_Media_DateEncoded: Incomplete +PKEY_Media_DateReleased: Incomplete +PKEY_Media_Duration: Incomplete +PKEY_Media_DVDID: Incomplete +PKEY_Media_EncodedBy: Incomplete +PKEY_Media_EncodingSettings: Incomplete +PKEY_Media_FrameCount: Incomplete +PKEY_Media_MCDI: Incomplete +PKEY_Media_MetadataContentProvider: Incomplete +PKEY_Media_Producer: Incomplete +PKEY_Media_PromotionUrl: Incomplete +PKEY_Media_ProtectionType: Incomplete +PKEY_Media_ProviderRating: Incomplete +PKEY_Media_ProviderStyle: Incomplete +PKEY_Media_Publisher: Incomplete +PKEY_Media_SubscriptionContentId: Incomplete +PKEY_Media_SubTitle: Incomplete +PKEY_Media_UniqueFileIdentifier: Incomplete +PKEY_Media_UserNoAutoInfo: Incomplete +PKEY_Media_UserWebUrl: Incomplete +PKEY_Media_Writer: Incomplete +PKEY_Media_Year: Incomplete +PKEY_Message_AttachmentContents: Incomplete +PKEY_Message_AttachmentNames: Incomplete +PKEY_Message_BccAddress: Incomplete +PKEY_Message_BccName: Incomplete +PKEY_Message_CcAddress: Incomplete +PKEY_Message_CcName: Incomplete +PKEY_Message_ConversationID: Incomplete +PKEY_Message_ConversationIndex: Incomplete +PKEY_Message_DateReceived: Incomplete +PKEY_Message_DateSent: Incomplete +PKEY_Message_FromAddress: Incomplete +PKEY_Message_FromName: Incomplete +PKEY_Message_HasAttachments: Incomplete +PKEY_Message_IsFwdOrReply: Incomplete +PKEY_Message_MessageClass: Incomplete +PKEY_Message_SenderAddress: Incomplete +PKEY_Message_SenderName: Incomplete +PKEY_Message_Store: Incomplete +PKEY_Message_ToAddress: Incomplete +PKEY_Message_ToDoTitle: Incomplete +PKEY_Message_ToName: Incomplete +PKEY_Music_AlbumArtist: Incomplete +PKEY_Music_AlbumTitle: Incomplete +PKEY_Music_Artist: Incomplete +PKEY_Music_BeatsPerMinute: Incomplete +PKEY_Music_Composer: Incomplete +PKEY_Music_Conductor: Incomplete +PKEY_Music_ContentGroupDescription: Incomplete +PKEY_Music_Genre: Incomplete +PKEY_Music_InitialKey: Incomplete +PKEY_Music_Lyrics: Incomplete +PKEY_Music_Mood: Incomplete +PKEY_Music_PartOfSet: Incomplete +PKEY_Music_Period: Incomplete +PKEY_Music_SynchronizedLyrics: Incomplete +PKEY_Music_TrackNumber: Incomplete +PKEY_Note_Color: Incomplete +PKEY_Note_ColorText: Incomplete +PKEY_Photo_Aperture: Incomplete +PKEY_Photo_ApertureDenominator: Incomplete +PKEY_Photo_ApertureNumerator: Incomplete +PKEY_Photo_Brightness: Incomplete +PKEY_Photo_BrightnessDenominator: Incomplete +PKEY_Photo_BrightnessNumerator: Incomplete +PKEY_Photo_CameraManufacturer: Incomplete +PKEY_Photo_CameraModel: Incomplete +PKEY_Photo_CameraSerialNumber: Incomplete +PKEY_Photo_Contrast: Incomplete +PKEY_Photo_ContrastText: Incomplete +PKEY_Photo_DateTaken: Incomplete +PKEY_Photo_DigitalZoom: Incomplete +PKEY_Photo_DigitalZoomDenominator: Incomplete +PKEY_Photo_DigitalZoomNumerator: Incomplete +PKEY_Photo_Event: Incomplete +PKEY_Photo_EXIFVersion: Incomplete +PKEY_Photo_ExposureBias: Incomplete +PKEY_Photo_ExposureBiasDenominator: Incomplete +PKEY_Photo_ExposureBiasNumerator: Incomplete +PKEY_Photo_ExposureIndex: Incomplete +PKEY_Photo_ExposureIndexDenominator: Incomplete +PKEY_Photo_ExposureIndexNumerator: Incomplete +PKEY_Photo_ExposureProgram: Incomplete +PKEY_Photo_ExposureProgramText: Incomplete +PKEY_Photo_ExposureTime: Incomplete +PKEY_Photo_ExposureTimeDenominator: Incomplete +PKEY_Photo_ExposureTimeNumerator: Incomplete +PKEY_Photo_Flash: Incomplete +PKEY_Photo_FlashEnergy: Incomplete +PKEY_Photo_FlashEnergyDenominator: Incomplete +PKEY_Photo_FlashEnergyNumerator: Incomplete +PKEY_Photo_FlashManufacturer: Incomplete +PKEY_Photo_FlashModel: Incomplete +PKEY_Photo_FlashText: Incomplete +PKEY_Photo_FNumber: Incomplete +PKEY_Photo_FNumberDenominator: Incomplete +PKEY_Photo_FNumberNumerator: Incomplete +PKEY_Photo_FocalLength: Incomplete +PKEY_Photo_FocalLengthDenominator: Incomplete +PKEY_Photo_FocalLengthInFilm: Incomplete +PKEY_Photo_FocalLengthNumerator: Incomplete +PKEY_Photo_FocalPlaneXResolution: Incomplete +PKEY_Photo_FocalPlaneXResolutionDenominator: Incomplete +PKEY_Photo_FocalPlaneXResolutionNumerator: Incomplete +PKEY_Photo_FocalPlaneYResolution: Incomplete +PKEY_Photo_FocalPlaneYResolutionDenominator: Incomplete +PKEY_Photo_FocalPlaneYResolutionNumerator: Incomplete +PKEY_Photo_GainControl: Incomplete +PKEY_Photo_GainControlDenominator: Incomplete +PKEY_Photo_GainControlNumerator: Incomplete +PKEY_Photo_GainControlText: Incomplete +PKEY_Photo_ISOSpeed: Incomplete +PKEY_Photo_LensManufacturer: Incomplete +PKEY_Photo_LensModel: Incomplete +PKEY_Photo_LightSource: Incomplete +PKEY_Photo_MakerNote: Incomplete +PKEY_Photo_MakerNoteOffset: Incomplete +PKEY_Photo_MaxAperture: Incomplete +PKEY_Photo_MaxApertureDenominator: Incomplete +PKEY_Photo_MaxApertureNumerator: Incomplete +PKEY_Photo_MeteringMode: Incomplete +PKEY_Photo_MeteringModeText: Incomplete +PKEY_Photo_Orientation: Incomplete +PKEY_Photo_OrientationText: Incomplete +PKEY_Photo_PhotometricInterpretation: Incomplete +PKEY_Photo_PhotometricInterpretationText: Incomplete +PKEY_Photo_ProgramMode: Incomplete +PKEY_Photo_ProgramModeText: Incomplete +PKEY_Photo_RelatedSoundFile: Incomplete +PKEY_Photo_Saturation: Incomplete +PKEY_Photo_SaturationText: Incomplete +PKEY_Photo_Sharpness: Incomplete +PKEY_Photo_SharpnessText: Incomplete +PKEY_Photo_ShutterSpeed: Incomplete +PKEY_Photo_ShutterSpeedDenominator: Incomplete +PKEY_Photo_ShutterSpeedNumerator: Incomplete +PKEY_Photo_SubjectDistance: Incomplete +PKEY_Photo_SubjectDistanceDenominator: Incomplete +PKEY_Photo_SubjectDistanceNumerator: Incomplete +PKEY_Photo_TranscodedForSync: Incomplete +PKEY_Photo_WhiteBalance: Incomplete +PKEY_Photo_WhiteBalanceText: Incomplete +PKEY_PropGroup_Advanced: Incomplete +PKEY_PropGroup_Audio: Incomplete +PKEY_PropGroup_Calendar: Incomplete +PKEY_PropGroup_Camera: Incomplete +PKEY_PropGroup_Contact: Incomplete +PKEY_PropGroup_Content: Incomplete +PKEY_PropGroup_Description: Incomplete +PKEY_PropGroup_FileSystem: Incomplete +PKEY_PropGroup_General: Incomplete +PKEY_PropGroup_GPS: Incomplete +PKEY_PropGroup_Image: Incomplete +PKEY_PropGroup_Media: Incomplete +PKEY_PropGroup_MediaAdvanced: Incomplete +PKEY_PropGroup_Message: Incomplete +PKEY_PropGroup_Music: Incomplete +PKEY_PropGroup_Origin: Incomplete +PKEY_PropGroup_PhotoAdvanced: Incomplete +PKEY_PropGroup_RecordedTV: Incomplete +PKEY_PropGroup_Video: Incomplete +PKEY_PropList_ConflictPrompt: Incomplete +PKEY_PropList_ExtendedTileInfo: Incomplete +PKEY_PropList_FileOperationPrompt: Incomplete +PKEY_PropList_FullDetails: Incomplete +PKEY_PropList_InfoTip: Incomplete +PKEY_PropList_NonPersonal: Incomplete +PKEY_PropList_PreviewDetails: Incomplete +PKEY_PropList_PreviewTitle: Incomplete +PKEY_PropList_QuickTip: Incomplete +PKEY_PropList_TileInfo: Incomplete +PKEY_PropList_XPDetailsPanel: Incomplete +PKEY_RecordedTV_ChannelNumber: Incomplete +PKEY_RecordedTV_Credits: Incomplete +PKEY_RecordedTV_DateContentExpires: Incomplete +PKEY_RecordedTV_EpisodeName: Incomplete +PKEY_RecordedTV_IsATSCContent: Incomplete +PKEY_RecordedTV_IsClosedCaptioningAvailable: Incomplete +PKEY_RecordedTV_IsDTVContent: Incomplete +PKEY_RecordedTV_IsHDContent: Incomplete +PKEY_RecordedTV_IsRepeatBroadcast: Incomplete +PKEY_RecordedTV_IsSAP: Incomplete +PKEY_RecordedTV_NetworkAffiliation: Incomplete +PKEY_RecordedTV_OriginalBroadcastDate: Incomplete +PKEY_RecordedTV_ProgramDescription: Incomplete +PKEY_RecordedTV_RecordingTime: Incomplete +PKEY_RecordedTV_StationCallSign: Incomplete +PKEY_RecordedTV_StationName: Incomplete +PKEY_Search_AutoSummary: Incomplete +PKEY_Search_ContainerHash: Incomplete +PKEY_Search_Contents: Incomplete +PKEY_Search_EntryID: Incomplete +PKEY_Search_GatherTime: Incomplete +PKEY_Search_IsClosedDirectory: Incomplete +PKEY_Search_IsFullyContained: Incomplete +PKEY_Search_QueryFocusedSummary: Incomplete +PKEY_Search_Rank: Incomplete +PKEY_Search_Store: Incomplete +PKEY_Search_UrlToIndex: Incomplete +PKEY_Search_UrlToIndexWithModificationTime: Incomplete +PKEY_DescriptionID: Incomplete +PKEY_Link_TargetSFGAOFlagsStrings: Incomplete +PKEY_Link_TargetUrl: Incomplete +PKEY_Shell_SFGAOFlagsStrings: Incomplete +PKEY_Software_DateLastUsed: Incomplete +PKEY_Software_ProductName: Incomplete +PKEY_Sync_Comments: Incomplete +PKEY_Sync_ConflictDescription: Incomplete +PKEY_Sync_ConflictFirstLocation: Incomplete +PKEY_Sync_ConflictSecondLocation: Incomplete +PKEY_Sync_HandlerCollectionID: Incomplete +PKEY_Sync_HandlerID: Incomplete +PKEY_Sync_HandlerName: Incomplete +PKEY_Sync_HandlerType: Incomplete +PKEY_Sync_HandlerTypeLabel: Incomplete +PKEY_Sync_ItemID: Incomplete +PKEY_Sync_ItemName: Incomplete +PKEY_Task_BillingInformation: Incomplete +PKEY_Task_CompletionStatus: Incomplete +PKEY_Task_Owner: Incomplete +PKEY_Video_Compression: Incomplete +PKEY_Video_Director: Incomplete +PKEY_Video_EncodingBitrate: Incomplete +PKEY_Video_FourCC: Incomplete +PKEY_Video_FrameHeight: Incomplete +PKEY_Video_FrameRate: Incomplete +PKEY_Video_FrameWidth: Incomplete +PKEY_Video_HorizontalAspectRatio: Incomplete +PKEY_Video_SampleSize: Incomplete +PKEY_Video_StreamName: Incomplete +PKEY_Video_StreamNumber: Incomplete +PKEY_Video_TotalBitrate: Incomplete +PKEY_Video_VerticalAspectRatio: Incomplete +PKEY_Volume_FileSystem: Incomplete +PKEY_Volume_IsMappedDrive: Incomplete +PKEY_Volume_IsRoot: Incomplete +PKEY_AppUserModel_RelaunchCommand: Incomplete +PKEY_AppUserModel_RelaunchIconResource: Incomplete +PKEY_AppUserModel_RelaunchDisplayNameResource: Incomplete +PKEY_AppUserModel_ID: Incomplete +PKEY_AppUserModel_IsDestListSeparator: Incomplete +PKEY_AppUserModel_ExcludeFromShowInNewInstall: Incomplete +PKEY_AppUserModel_PreventPinning: Incomplete +PKA_SET: int +PKA_APPEND: int +PKA_DELETE: int diff --git a/stubs/pywin32/win32comext/shell/__init__.pyi b/stubs/pywin32/win32comext/shell/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/shell/shell.pyi b/stubs/pywin32/win32comext/shell/shell.pyi new file mode 100644 index 0000000..35a0772 --- /dev/null +++ b/stubs/pywin32/win32comext/shell/shell.pyi @@ -0,0 +1,436 @@ +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +import _win32typing +from win32.lib.pywintypes import com_error + +error: TypeAlias = com_error # noqa: Y042 + +def AssocCreate() -> _win32typing.PyIQueryAssociations: ... +def AssocCreateForClasses() -> _win32typing.PyIUnknown: ... +def DragQueryFile(hglobal: int, index) -> str: ... +def DragQueryFileW(hglobal: int, index) -> str: ... +def DragQueryPoint(hglobal: int) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def IsUserAnAdmin() -> bool: ... +def SHCreateDataObject( + parent, children: list[Incomplete], do_inner: _win32typing.PyIDataObject, iid: _win32typing.PyIID +) -> _win32typing.PyIUnknown: ... +def SHCreateDefaultContextMenu(dcm, iid: _win32typing.PyIID) -> _win32typing.PyIUnknown: ... +def SHCreateDefaultExtractIcon() -> _win32typing.PyIDefaultExtractIconInit: ... +def SHCreateShellFolderView( + sf: _win32typing.PyIShellFolder, viewOuter: _win32typing.PyIShellView | None = ..., callbacks: Incomplete | None = ... +) -> _win32typing.PyIShellView: ... +def SHCreateShellItemArray( + parent: _win32typing.PyIDL, sf: _win32typing.PyIShellFolder, children: list[_win32typing.PyIDL] +) -> _win32typing.PyIShellItemArray: ... +def SHCreateShellItemArrayFromDataObject( + do: _win32typing.PyIDataObject, iid: _win32typing.PyIID +) -> _win32typing.PyIShellItemArray: ... +def SHCreateShellItemArrayFromShellItem( + si: _win32typing.PyIShellItem, riid: _win32typing.PyIID +) -> _win32typing.PyIShellItemArray: ... +def SHBrowseForFolder( + hwndOwner: int | None = ..., + pidlRoot: _win32typing.PyIDL | None = ..., + title: str | None = ..., + flags: int = ..., + callback: Incomplete | None = ..., + callback_data: Incomplete | None = ..., +) -> tuple[_win32typing.PyIDL, Incomplete, Incomplete]: ... +def SHGetFileInfo( + name: _win32typing.PyIDL | str, dwFileAttributes, uFlags, infoAttrs: int = ... +) -> tuple[Incomplete, _win32typing.SHFILEINFO]: ... +def SHGetFolderPath(hwndOwner: int, nFolder, handle: int, flags) -> str: ... +def SHSetFolderPath(csidl, Path, hToken: int | None = ...) -> None: ... +def SHGetFolderLocation(hwndOwner: int, nFolder, hToken: int | None = ..., reserved=...) -> _win32typing.PyIDL: ... +def SHGetSpecialFolderPath(hwndOwner: int, nFolder, bCreate: int = ...) -> str: ... +def SHGetSpecialFolderLocation(hwndOwner: int, nFolder) -> _win32typing.PyIDL: ... +def SHAddToRecentDocs(Flags, data) -> None: ... +def SHEmptyRecycleBin(hwnd: int, path: str, flags) -> None: ... +def SHQueryRecycleBin(RootPath: str | None = ...) -> tuple[Incomplete, Incomplete]: ... +def SHGetDesktopFolder() -> _win32typing.PyIShellFolder: ... +def SHUpdateImage(HashItem: str, Index, Flags, ImageIndex) -> None: ... +def SHChangeNotify(EventId, Flags, Item1, Item2) -> None: ... +def SHChangeNotifyRegister(hwnd: int, sources, events, msg): ... +def SHChangeNotifyDeregister(_id) -> None: ... +def SHCreateItemFromParsingName(name, ctx: _win32typing.PyIBindCtx, riid: _win32typing.PyIID) -> _win32typing.PyIShellItem: ... +def SHCreateItemFromRelativeName( + Parent: _win32typing.PyIShellItem, Name, ctx: _win32typing.PyIBindCtx, riid: _win32typing.PyIID +) -> _win32typing.PyIShellItem: ... +def SHCreateItemInKnownFolder( + FolderId: _win32typing.PyIID, Flags, Name, riid: _win32typing.PyIID +) -> _win32typing.PyIShellItem: ... +def SHCreateItemWithParent( + Parent: _win32typing.PyIDL, sfParent: _win32typing.PyIShellFolder, child: _win32typing.PyIDL, riid: _win32typing.PyIID +) -> _win32typing.PyIShellItem: ... +def SHGetInstanceExplorer() -> _win32typing.PyIUnknown: ... +def SHFileOperation(operation: _win32typing.SHFILEOPSTRUCT) -> tuple[Incomplete, Incomplete]: ... +def StringAsCIDA(pidl: str) -> tuple[_win32typing.PyIDL, Incomplete]: ... +def CIDAAsString(pidl: str) -> str: ... +def StringAsPIDL(pidl: str) -> _win32typing.PyIDL: ... +def AddressAsPIDL(address) -> _win32typing.PyIDL: ... +def PIDLAsString(pidl: _win32typing.PyIDL) -> str: ... +def SHGetSettings(mask: int = ...): ... +def FILEGROUPDESCRIPTORAsString(descriptors: list[Incomplete], arg) -> str: ... +def StringAsFILEGROUPDESCRIPTOR(buf, make_unicode: int = ...) -> list[Incomplete]: ... +def ShellExecuteEx( + lpVerb: str, + lpFile: str, + lpParameters: str, + lpDirectory: str, + lpIDlist: _win32typing.PyIDL, + obClass: str, + hkeyClass, + dwHotKey, + hIcon: int, + hMonitor: int, + fMask: int = ..., + hwnd: int = ..., + nShow: int = ..., +): ... +def SHGetViewStatePropertyBag( + pidl: _win32typing.PyIDL, BagName: str, Flags, riid: _win32typing.PyIID +) -> _win32typing.PyIPropertyBag: ... +def SHILCreateFromPath(Path: str, Flags) -> tuple[_win32typing.PyIDL, Incomplete]: ... +def SHCreateShellItem( + pidlParent: _win32typing.PyIDL, sfParent: _win32typing.PyIShellFolder, Child: _win32typing.PyIDL +) -> _win32typing.PyIShellItem: ... +def SHOpenFolderAndSelectItems(Folder: _win32typing.PyIDL, Items: tuple[_win32typing.PyIDL, ...], Flags=...) -> None: ... +def SHCreateStreamOnFileEx(File, Mode, Attributes, Create, Template: Incomplete | None = ...) -> _win32typing.PyIStream: ... +def SetCurrentProcessExplicitAppUserModelID(AppID) -> None: ... +def GetCurrentProcessExplicitAppUserModelID(): ... +def SHParseDisplayName( + Name, Attributes, BindCtx: _win32typing.PyIBindCtx | None = ... +) -> tuple[_win32typing.PyIDL, Incomplete]: ... +def SHCreateItemFromIDList(*args, **kwargs): ... # incomplete +def SHCreateShellItemArrayFromIDLists(*args, **kwargs): ... # incomplete +def SHGetIDListFromObject(*args, **kwargs): ... # incomplete +def SHGetNameFromIDList(*args, **kwargs): ... # incomplete +def SHGetPathFromIDList(*args, **kwargs): ... # incomplete +def SHGetPathFromIDListW(*args, **kwargs): ... # incomplete + +BHID_AssociationArray: _win32typing.PyIID +BHID_DataObject: _win32typing.PyIID +BHID_EnumItems: _win32typing.PyIID +BHID_Filter: _win32typing.PyIID +BHID_LinkTargetItem: _win32typing.PyIID +BHID_PropertyStore: _win32typing.PyIID +BHID_SFObject: _win32typing.PyIID +BHID_SFUIObject: _win32typing.PyIID +BHID_SFViewObject: _win32typing.PyIID +BHID_Storage: _win32typing.PyIID +BHID_StorageEnum: _win32typing.PyIID +BHID_Stream: _win32typing.PyIID +BHID_ThumbnailHandler: _win32typing.PyIID +BHID_Transfer: _win32typing.PyIID +CGID_DefView: _win32typing.PyIID +CGID_Explorer: _win32typing.PyIID +CGID_ExplorerBarDoc: _win32typing.PyIID +CGID_ShellDocView: _win32typing.PyIID +CGID_ShellServiceObject: _win32typing.PyIID +CLSID_ActiveDesktop: _win32typing.PyIID +CLSID_ApplicationDestinations: _win32typing.PyIID +CLSID_ApplicationDocumentLists: _win32typing.PyIID +CLSID_ControlPanel: _win32typing.PyIID +CLSID_DestinationList: _win32typing.PyIID +CLSID_DragDropHelper: _win32typing.PyIID +CLSID_EnumerableObjectCollection: _win32typing.PyIID +CLSID_FileOperation: _win32typing.PyIID +CLSID_Internet: _win32typing.PyIID +CLSID_InternetShortcut: _win32typing.PyIID +CLSID_KnownFolderManager: _win32typing.PyIID +CLSID_MyComputer: _win32typing.PyIID +CLSID_MyDocuments: _win32typing.PyIID +CLSID_NetworkDomain: _win32typing.PyIID +CLSID_NetworkPlaces: _win32typing.PyIID +CLSID_NetworkServer: _win32typing.PyIID +CLSID_NetworkShare: _win32typing.PyIID +CLSID_Printers: _win32typing.PyIID +CLSID_RecycleBin: _win32typing.PyIID +CLSID_ShellDesktop: _win32typing.PyIID +CLSID_ShellFSFolder: _win32typing.PyIID +CLSID_ShellItem: _win32typing.PyIID +CLSID_ShellLibrary: _win32typing.PyIID +CLSID_ShellLink: _win32typing.PyIID +CLSID_TaskbarList: _win32typing.PyIID +EP_AdvQueryPane: _win32typing.PyIID +EP_Commands: _win32typing.PyIID +EP_Commands_Organize: _win32typing.PyIID +EP_Commands_View: _win32typing.PyIID +EP_DetailsPane: _win32typing.PyIID +EP_NavPane: _win32typing.PyIID +EP_PreviewPane: _win32typing.PyIID +EP_QueryPane: _win32typing.PyIID +FMTID_AudioSummaryInformation: _win32typing.PyIID +FMTID_Briefcase: _win32typing.PyIID +FMTID_Displaced: _win32typing.PyIID +FMTID_ImageProperties: _win32typing.PyIID +FMTID_ImageSummaryInformation: _win32typing.PyIID +FMTID_InternetSite: _win32typing.PyIID +FMTID_Intshcut: _win32typing.PyIID +FMTID_MediaFileSummaryInformation: _win32typing.PyIID +FMTID_Misc: _win32typing.PyIID +FMTID_Query: _win32typing.PyIID +FMTID_ShellDetails: _win32typing.PyIID +FMTID_Storage: _win32typing.PyIID +FMTID_SummaryInformation: _win32typing.PyIID +FMTID_Volume: _win32typing.PyIID +FMTID_WebView: _win32typing.PyIID +FOLDERID_AddNewPrograms: _win32typing.PyIID +FOLDERID_AdminTools: _win32typing.PyIID +FOLDERID_AppUpdates: _win32typing.PyIID +FOLDERID_CDBurning: _win32typing.PyIID +FOLDERID_ChangeRemovePrograms: _win32typing.PyIID +FOLDERID_CommonAdminTools: _win32typing.PyIID +FOLDERID_CommonOEMLinks: _win32typing.PyIID +FOLDERID_CommonPrograms: _win32typing.PyIID +FOLDERID_CommonStartMenu: _win32typing.PyIID +FOLDERID_CommonStartup: _win32typing.PyIID +FOLDERID_CommonTemplates: _win32typing.PyIID +FOLDERID_ComputerFolder: _win32typing.PyIID +FOLDERID_ConflictFolder: _win32typing.PyIID +FOLDERID_ConnectionsFolder: _win32typing.PyIID +FOLDERID_Contacts: _win32typing.PyIID +FOLDERID_ControlPanelFolder: _win32typing.PyIID +FOLDERID_Cookies: _win32typing.PyIID +FOLDERID_Desktop: _win32typing.PyIID +FOLDERID_DeviceMetadataStore: _win32typing.PyIID +FOLDERID_Documents: _win32typing.PyIID +FOLDERID_DocumentsLibrary: _win32typing.PyIID +FOLDERID_Downloads: _win32typing.PyIID +FOLDERID_Favorites: _win32typing.PyIID +FOLDERID_Fonts: _win32typing.PyIID +FOLDERID_GameTasks: _win32typing.PyIID +FOLDERID_Games: _win32typing.PyIID +FOLDERID_History: _win32typing.PyIID +FOLDERID_HomeGroup: _win32typing.PyIID +FOLDERID_ImplicitAppShortcuts: _win32typing.PyIID +FOLDERID_InternetCache: _win32typing.PyIID +FOLDERID_InternetFolder: _win32typing.PyIID +FOLDERID_Libraries: _win32typing.PyIID +FOLDERID_Links: _win32typing.PyIID +FOLDERID_LocalAppData: _win32typing.PyIID +FOLDERID_LocalAppDataLow: _win32typing.PyIID +FOLDERID_LocalizedResourcesDir: _win32typing.PyIID +FOLDERID_Music: _win32typing.PyIID +FOLDERID_MusicLibrary: _win32typing.PyIID +FOLDERID_NetHood: _win32typing.PyIID +FOLDERID_NetworkFolder: _win32typing.PyIID +FOLDERID_OriginalImages: _win32typing.PyIID +FOLDERID_PhotoAlbums: _win32typing.PyIID +FOLDERID_Pictures: _win32typing.PyIID +FOLDERID_PicturesLibrary: _win32typing.PyIID +FOLDERID_Playlists: _win32typing.PyIID +FOLDERID_PrintHood: _win32typing.PyIID +FOLDERID_PrintersFolder: _win32typing.PyIID +FOLDERID_Profile: _win32typing.PyIID +FOLDERID_ProgramData: _win32typing.PyIID +FOLDERID_ProgramFiles: _win32typing.PyIID +FOLDERID_ProgramFilesCommon: _win32typing.PyIID +FOLDERID_ProgramFilesCommonX64: _win32typing.PyIID +FOLDERID_ProgramFilesCommonX86: _win32typing.PyIID +FOLDERID_ProgramFilesX64: _win32typing.PyIID +FOLDERID_ProgramFilesX86: _win32typing.PyIID +FOLDERID_Programs: _win32typing.PyIID +FOLDERID_Public: _win32typing.PyIID +FOLDERID_PublicDesktop: _win32typing.PyIID +FOLDERID_PublicDocuments: _win32typing.PyIID +FOLDERID_PublicDownloads: _win32typing.PyIID +FOLDERID_PublicGameTasks: _win32typing.PyIID +FOLDERID_PublicLibraries: _win32typing.PyIID +FOLDERID_PublicMusic: _win32typing.PyIID +FOLDERID_PublicPictures: _win32typing.PyIID +FOLDERID_PublicRingtones: _win32typing.PyIID +FOLDERID_PublicVideos: _win32typing.PyIID +FOLDERID_QuickLaunch: _win32typing.PyIID +FOLDERID_Recent: _win32typing.PyIID +FOLDERID_RecordedTVLibrary: _win32typing.PyIID +FOLDERID_RecycleBinFolder: _win32typing.PyIID +FOLDERID_ResourceDir: _win32typing.PyIID +FOLDERID_Ringtones: _win32typing.PyIID +FOLDERID_RoamingAppData: _win32typing.PyIID +FOLDERID_SEARCH_CSC: _win32typing.PyIID +FOLDERID_SEARCH_MAPI: _win32typing.PyIID +FOLDERID_SampleMusic: _win32typing.PyIID +FOLDERID_SamplePictures: _win32typing.PyIID +FOLDERID_SamplePlaylists: _win32typing.PyIID +FOLDERID_SampleVideos: _win32typing.PyIID +FOLDERID_SavedGames: _win32typing.PyIID +FOLDERID_SavedSearches: _win32typing.PyIID +FOLDERID_SearchHome: _win32typing.PyIID +FOLDERID_SendTo: _win32typing.PyIID +FOLDERID_SidebarDefaultParts: _win32typing.PyIID +FOLDERID_SidebarParts: _win32typing.PyIID +FOLDERID_StartMenu: _win32typing.PyIID +FOLDERID_Startup: _win32typing.PyIID +FOLDERID_SyncManagerFolder: _win32typing.PyIID +FOLDERID_SyncResultsFolder: _win32typing.PyIID +FOLDERID_SyncSetupFolder: _win32typing.PyIID +FOLDERID_System: _win32typing.PyIID +FOLDERID_SystemX86: _win32typing.PyIID +FOLDERID_Templates: _win32typing.PyIID +FOLDERID_UserPinned: _win32typing.PyIID +FOLDERID_UserProfiles: _win32typing.PyIID +FOLDERID_UserProgramFiles: _win32typing.PyIID +FOLDERID_UserProgramFilesCommon: _win32typing.PyIID +FOLDERID_UsersFiles: _win32typing.PyIID +FOLDERID_UsersLibraries: _win32typing.PyIID +FOLDERID_Videos: _win32typing.PyIID +FOLDERID_VideosLibrary: _win32typing.PyIID +FOLDERID_Windows: _win32typing.PyIID +FOLDERTYPEID_Communications: _win32typing.PyIID +FOLDERTYPEID_CompressedFolder: _win32typing.PyIID +FOLDERTYPEID_Contacts: _win32typing.PyIID +FOLDERTYPEID_ControlPanelCategory: _win32typing.PyIID +FOLDERTYPEID_ControlPanelClassic: _win32typing.PyIID +FOLDERTYPEID_Documents: _win32typing.PyIID +FOLDERTYPEID_Games: _win32typing.PyIID +FOLDERTYPEID_Generic: _win32typing.PyIID +FOLDERTYPEID_GenericLibrary: _win32typing.PyIID +FOLDERTYPEID_GenericSearchResults: _win32typing.PyIID +FOLDERTYPEID_Invalid: _win32typing.PyIID +FOLDERTYPEID_Music: _win32typing.PyIID +FOLDERTYPEID_NetworkExplorer: _win32typing.PyIID +FOLDERTYPEID_OpenSearch: _win32typing.PyIID +FOLDERTYPEID_OtherUsers: _win32typing.PyIID +FOLDERTYPEID_Pictures: _win32typing.PyIID +FOLDERTYPEID_Printers: _win32typing.PyIID +FOLDERTYPEID_PublishedItems: _win32typing.PyIID +FOLDERTYPEID_RecordedTV: _win32typing.PyIID +FOLDERTYPEID_RecycleBin: _win32typing.PyIID +FOLDERTYPEID_SavedGames: _win32typing.PyIID +FOLDERTYPEID_SearchConnector: _win32typing.PyIID +FOLDERTYPEID_SearchHome: _win32typing.PyIID +FOLDERTYPEID_Searches: _win32typing.PyIID +FOLDERTYPEID_SoftwareExplorer: _win32typing.PyIID +FOLDERTYPEID_StartMenu: _win32typing.PyIID +FOLDERTYPEID_UserFiles: _win32typing.PyIID +FOLDERTYPEID_UsersLibraries: _win32typing.PyIID +FOLDERTYPEID_Videos: _win32typing.PyIID +HOTKEYF_ALT: int +HOTKEYF_CONTROL: int +HOTKEYF_EXT: int +HOTKEYF_SHIFT: int +IID_CDefView: _win32typing.PyIID +IID_IADesktopP2: _win32typing.PyIID +IID_IActiveDesktop: _win32typing.PyIID +IID_IActiveDesktopP: _win32typing.PyIID +IID_IApplicationDestinations: _win32typing.PyIID +IID_IApplicationDocumentLists: _win32typing.PyIID +IID_IAsyncOperation: _win32typing.PyIID +IID_IBrowserFrameOptions: _win32typing.PyIID +IID_ICategorizer: _win32typing.PyIID +IID_ICategoryProvider: _win32typing.PyIID +IID_IColumnProvider: _win32typing.PyIID +IID_IContextMenu: _win32typing.PyIID +IID_IContextMenu2: _win32typing.PyIID +IID_IContextMenu3: _win32typing.PyIID +IID_ICopyHook: _win32typing.PyIID +IID_ICopyHookA: _win32typing.PyIID +IID_ICopyHookW: _win32typing.PyIID +IID_ICurrentItem: _win32typing.PyIID +IID_ICustomDestinationList: _win32typing.PyIID +IID_IDefaultExtractIconInit: _win32typing.PyIID +IID_IDeskBand: _win32typing.PyIID +IID_IDisplayItem: _win32typing.PyIID +IID_IDockingWindow: _win32typing.PyIID +IID_IDropTargetHelper: _win32typing.PyIID +IID_IEmptyVolumeCache: _win32typing.PyIID +IID_IEmptyVolumeCache2: _win32typing.PyIID +IID_IEmptyVolumeCacheCallBack: _win32typing.PyIID +IID_IEnumExplorerCommand: _win32typing.PyIID +IID_IEnumIDList: _win32typing.PyIID +IID_IEnumObjects: _win32typing.PyIID +IID_IEnumResources: _win32typing.PyIID +IID_IEnumShellItems: _win32typing.PyIID +IID_IExplorerBrowser: _win32typing.PyIID +IID_IExplorerBrowserEvents: _win32typing.PyIID +IID_IExplorerCommand: _win32typing.PyIID +IID_IExplorerCommandProvider: _win32typing.PyIID +IID_IExplorerPaneVisibility: _win32typing.PyIID +IID_IExtractIcon: _win32typing.PyIID +IID_IExtractIconW: _win32typing.PyIID +IID_IExtractImage: _win32typing.PyIID +IID_IFileOperation: _win32typing.PyIID +IID_IFileOperationProgressSink: _win32typing.PyIID +IID_IIdentityName: _win32typing.PyIID +IID_IKnownFolder: _win32typing.PyIID +IID_IKnownFolderManager: _win32typing.PyIID +IID_INameSpaceTreeControl: _win32typing.PyIID +IID_IObjectArray: _win32typing.PyIID +IID_IObjectCollection: _win32typing.PyIID +IID_IPersistFolder: _win32typing.PyIID +IID_IPersistFolder2: _win32typing.PyIID +IID_IQueryAssociations: _win32typing.PyIID +IID_IRelatedItem: _win32typing.PyIID +IID_IShellBrowser: _win32typing.PyIID +IID_IShellCopyHook: _win32typing.PyIID +IID_IShellCopyHookA: _win32typing.PyIID +IID_IShellCopyHookW: _win32typing.PyIID +IID_IShellExtInit: _win32typing.PyIID +IID_IShellFolder: _win32typing.PyIID +IID_IShellFolder2: _win32typing.PyIID +IID_IShellIcon: _win32typing.PyIID +IID_IShellIconOverlay: _win32typing.PyIID +IID_IShellIconOverlayIdentifier: _win32typing.PyIID +IID_IShellIconOverlayManager: _win32typing.PyIID +IID_IShellItem: _win32typing.PyIID +IID_IShellItem2: _win32typing.PyIID +IID_IShellItemArray: _win32typing.PyIID +IID_IShellItemResources: _win32typing.PyIID +IID_IShellLibrary: _win32typing.PyIID +IID_IShellLink: _win32typing.PyIID +IID_IShellLinkA: _win32typing.PyIID +IID_IShellLinkDataList: _win32typing.PyIID +IID_IShellLinkW: _win32typing.PyIID +IID_IShellView: _win32typing.PyIID +IID_ITaskbarList: _win32typing.PyIID +IID_ITransferAdviseSink: _win32typing.PyIID +IID_ITransferDestination: _win32typing.PyIID +IID_ITransferMediumItem: _win32typing.PyIID +IID_ITransferSource: _win32typing.PyIID +IID_IUniformResourceLocator: _win32typing.PyIID +ResourceTypeStream: _win32typing.PyIID +SID_CtxQueryAssociations: _win32typing.PyIID +SID_DefView: _win32typing.PyIID +SID_LinkSite: _win32typing.PyIID +SID_MenuShellFolder: _win32typing.PyIID +SID_SCommDlgBrowser: _win32typing.PyIID +SID_SGetViewFromViewDual: _win32typing.PyIID +SID_SInternetExplorer: _win32typing.PyIID +SID_SMenuBandBKContextMenu: _win32typing.PyIID +SID_SMenuBandBottom: _win32typing.PyIID +SID_SMenuBandBottomSelected: _win32typing.PyIID +SID_SMenuBandChild: _win32typing.PyIID +SID_SMenuBandContextMenuModifier: _win32typing.PyIID +SID_SMenuBandParent: _win32typing.PyIID +SID_SMenuBandTop: _win32typing.PyIID +SID_SMenuPopup: _win32typing.PyIID +SID_SProgressUI: _win32typing.PyIID +SID_SShellBrowser: _win32typing.PyIID +SID_SShellDesktop: _win32typing.PyIID +SID_STopLevelBrowser: _win32typing.PyIID +SID_STopWindow: _win32typing.PyIID +SID_SUrlHistory: _win32typing.PyIID +SID_SWebBrowserApp: _win32typing.PyIID +SID_ShellFolderViewCB: _win32typing.PyIID +SLGP_RAWPATH: int +SLGP_SHORTPATH: int +SLGP_UNCPRIORITY: int +SLR_ANY_MATCH: int +SLR_INVOKE_MSI: int +SLR_NOLINKINFO: int +SLR_NOSEARCH: int +SLR_NOTRACK: int +SLR_NOUPDATE: int +SLR_NO_UI: int +SLR_UPDATE: int +VID_Details: _win32typing.PyIID +VID_LargeIcons: _win32typing.PyIID +VID_List: _win32typing.PyIID +VID_SmallIcons: _win32typing.PyIID +VID_ThumbStrip: _win32typing.PyIID +VID_Thumbnails: _win32typing.PyIID +VID_Tile: _win32typing.PyIID + +def SHGetKnownFolderPath(*args, **kwargs): ... # incomplete diff --git a/stubs/pywin32/win32comext/shell/shellcon.pyi b/stubs/pywin32/win32comext/shell/shellcon.pyi new file mode 100644 index 0000000..88e9208 --- /dev/null +++ b/stubs/pywin32/win32comext/shell/shellcon.pyi @@ -0,0 +1,1399 @@ +from _typeshed import Incomplete + +WM_USER: int +DROPEFFECT_NONE: int +DROPEFFECT_COPY: int +DROPEFFECT_MOVE: int +DROPEFFECT_LINK: int +DROPEFFECT_SCROLL: int +FO_MOVE: int +FO_COPY: int +FO_DELETE: int +FO_RENAME: int +FOF_MULTIDESTFILES: int +FOF_CONFIRMMOUSE: int +FOF_SILENT: int +FOF_RENAMEONCOLLISION: int +FOF_NOCONFIRMATION: int +FOF_WANTMAPPINGHANDLE: int +FOF_ALLOWUNDO: int +FOF_FILESONLY: int +FOF_SIMPLEPROGRESS: int +FOF_NOCONFIRMMKDIR: int +FOF_NOERRORUI: int +FOF_NOCOPYSECURITYATTRIBS: int +FOF_NORECURSION: int +FOF_NO_CONNECTED_ELEMENTS: int +FOF_WANTNUKEWARNING: int +FOF_NORECURSEREPARSE: int +FOF_NO_UI: Incomplete +FOFX_NOSKIPJUNCTIONS: int +FOFX_PREFERHARDLINK: int +FOFX_SHOWELEVATIONPROMPT: int +FOFX_EARLYFAILURE: int +FOFX_PRESERVEFILEEXTENSIONS: int +FOFX_KEEPNEWERFILE: int +FOFX_NOCOPYHOOKS: int +FOFX_NOMINIMIZEBOX: int +FOFX_MOVEACLSACROSSVOLUMES: int +FOFX_DONTDISPLAYSOURCEPATH: int +FOFX_DONTDISPLAYDESTPATH: int +FOFX_REQUIREELEVATION: int +FOFX_COPYASDOWNLOAD: int +FOFX_DONTDISPLAYLOCATIONS: int +PO_DELETE: int +PO_RENAME: int +PO_PORTCHANGE: int +PO_REN_PORT: int +SE_ERR_FNF: int +SE_ERR_PNF: int +SE_ERR_ACCESSDENIED: int +SE_ERR_OOM: int +SE_ERR_DLLNOTFOUND: int +SE_ERR_SHARE: int +SE_ERR_ASSOCINCOMPLETE: int +SE_ERR_DDETIMEOUT: int +SE_ERR_DDEFAIL: int +SE_ERR_DDEBUSY: int +SE_ERR_NOASSOC: int +SEE_MASK_CLASSNAME: int +SEE_MASK_CLASSKEY: int +SEE_MASK_IDLIST: int +SEE_MASK_INVOKEIDLIST: int +SEE_MASK_ICON: int +SEE_MASK_HOTKEY: int +SEE_MASK_NOCLOSEPROCESS: int +SEE_MASK_CONNECTNETDRV: int +SEE_MASK_FLAG_DDEWAIT: int +SEE_MASK_DOENVSUBST: int +SEE_MASK_FLAG_NO_UI: int +SEE_MASK_UNICODE: int +SEE_MASK_NO_CONSOLE: int +SEE_MASK_ASYNCOK: int +SEE_MASK_HMONITOR: int +SHERB_NOCONFIRMATION: int +SHERB_NOPROGRESSUI: int +SHERB_NOSOUND: int +NIM_ADD: int +NIM_MODIFY: int +NIM_DELETE: int +NIF_MESSAGE: int +NIF_ICON: int +NIF_TIP: int +SHGFI_ICON: int +SHGFI_DISPLAYNAME: int +SHGFI_TYPENAME: int +SHGFI_ATTRIBUTES: int +SHGFI_ICONLOCATION: int +SHGFI_EXETYPE: int +SHGFI_SYSICONINDEX: int +SHGFI_LINKOVERLAY: int +SHGFI_SELECTED: int +SHGFI_ATTR_SPECIFIED: int +SHGFI_LARGEICON: int +SHGFI_SMALLICON: int +SHGFI_OPENICON: int +SHGFI_SHELLICONSIZE: int +SHGFI_PIDL: int +SHGFI_USEFILEATTRIBUTES: int +SHGNLI_PIDL: int +SHGNLI_PREFIXNAME: int +SHGNLI_NOUNIQUE: int +PRINTACTION_OPEN: int +PRINTACTION_PROPERTIES: int +PRINTACTION_NETINSTALL: int +PRINTACTION_NETINSTALLLINK: int +PRINTACTION_TESTPAGE: int +PRINTACTION_OPENNETPRN: int +PRINTACTION_DOCUMENTDEFAULTS: int +PRINTACTION_SERVERPROPERTIES: int +CMF_NORMAL: int +CMF_DEFAULTONLY: int +CMF_VERBSONLY: int +CMF_EXPLORE: int +CMF_NOVERBS: int +CMF_CANRENAME: int +CMF_NODEFAULT: int +CMF_INCLUDESTATIC: int +CMF_ITEMMENU: int +CMF_EXTENDEDVERBS: int +CMF_DISABLEDVERBS: int +CMF_ASYNCVERBSTATE: int +CMF_OPTIMIZEFORINVOKE: int +CMF_SYNCCASCADEMENU: int +CMF_DONOTPICKDEFAULT: int +CMF_RESERVED: int +GCS_VERBA: int +GCS_HELPTEXTA: int +GCS_VALIDATEA: int +GCS_VERBW: int +GCS_HELPTEXTW: int +GCS_VALIDATEW: int +GCS_UNICODE: int +GCS_VERB: int +GCS_HELPTEXT: int +GCS_VALIDATE: int +CMDSTR_NEWFOLDERA: str +CMDSTR_VIEWLISTA: str +CMDSTR_VIEWDETAILSA: str +CMDSTR_NEWFOLDER: str +CMDSTR_VIEWLIST: str +CMDSTR_VIEWDETAILS: str +CMIC_MASK_HOTKEY: int +CMIC_MASK_ICON: int +CMIC_MASK_FLAG_NO_UI: int +CMIC_MASK_UNICODE: int +CMIC_MASK_NO_CONSOLE: int +CMIC_MASK_ASYNCOK: int +CMIC_MASK_PTINVOKE: int +GIL_OPENICON: int +GIL_FORSHELL: int +GIL_ASYNC: int +GIL_DEFAULTICON: int +GIL_FORSHORTCUT: int +GIL_CHECKSHIELD: int +GIL_SIMULATEDOC: int +GIL_PERINSTANCE: int +GIL_PERCLASS: int +GIL_NOTFILENAME: int +GIL_DONTCACHE: int +GIL_SHIELD: int +GIL_FORCENOSHIELD: int +ISIOI_ICONFILE: int +ISIOI_ICONINDEX: int +ISIOI_SYSIMAGELISTINDEX: int +FVSIF_RECT: int +FVSIF_PINNED: int +FVSIF_NEWFAILED: int +FVSIF_NEWFILE: int +FVSIF_CANVIEWIT: int +FCIDM_SHVIEWFIRST: int +FCIDM_SHVIEWLAST: int +FCIDM_BROWSERFIRST: int +FCIDM_BROWSERLAST: int +FCIDM_GLOBALFIRST: int +FCIDM_GLOBALLAST: int +FCIDM_MENU_FILE: Incomplete +FCIDM_MENU_EDIT: Incomplete +FCIDM_MENU_VIEW: Incomplete +FCIDM_MENU_VIEW_SEP_OPTIONS: Incomplete +FCIDM_MENU_TOOLS: Incomplete +FCIDM_MENU_TOOLS_SEP_GOTO: Incomplete +FCIDM_MENU_HELP: Incomplete +FCIDM_MENU_FIND: Incomplete +FCIDM_MENU_EXPLORE: Incomplete +FCIDM_MENU_FAVORITES: Incomplete +FCIDM_TOOLBAR: Incomplete +FCIDM_STATUS: Incomplete +IDC_OFFLINE_HAND: int +SBSP_DEFBROWSER: int +SBSP_SAMEBROWSER: int +SBSP_NEWBROWSER: int +SBSP_DEFMODE: int +SBSP_OPENMODE: int +SBSP_EXPLOREMODE: int +SBSP_ABSOLUTE: int +SBSP_RELATIVE: int +SBSP_PARENT: int +SBSP_NAVIGATEBACK: int +SBSP_NAVIGATEFORWARD: int +SBSP_ALLOW_AUTONAVIGATE: int +SBSP_INITIATEDBYHLINKFRAME: int +SBSP_REDIRECT: int +SBSP_WRITENOHISTORY: int +SBSP_NOAUTOSELECT: int +FCW_STATUS: int +FCW_TOOLBAR: int +FCW_TREE: int +FCW_INTERNETBAR: int +FCW_PROGRESS: int +FCT_MERGE: int +FCT_CONFIGABLE: int +FCT_ADDTOEND: int +CDBOSC_SETFOCUS: int +CDBOSC_KILLFOCUS: int +CDBOSC_SELCHANGE: int +CDBOSC_RENAME: int +SVSI_DESELECT: int +SVSI_SELECT: int +SVSI_EDIT: int +SVSI_DESELECTOTHERS: int +SVSI_ENSUREVISIBLE: int +SVSI_FOCUSED: int +SVSI_TRANSLATEPT: int +SVGIO_BACKGROUND: int +SVGIO_SELECTION: int +SVGIO_ALLVIEW: int +SVGIO_CHECKED: Incomplete +SVGIO_TYPE_MASK: Incomplete +SVGIO_FLAG_VIEWORDER: int +STRRET_WSTR: int +STRRET_OFFSET: int +STRRET_CSTR: int +CSIDL_DESKTOP: int +CSIDL_INTERNET: int +CSIDL_PROGRAMS: int +CSIDL_CONTROLS: int +CSIDL_PRINTERS: int +CSIDL_PERSONAL: int +CSIDL_FAVORITES: int +CSIDL_STARTUP: int +CSIDL_RECENT: int +CSIDL_SENDTO: int +CSIDL_BITBUCKET: int +CSIDL_STARTMENU: int +CSIDL_MYDOCUMENTS: int +CSIDL_MYMUSIC: int +CSIDL_MYVIDEO: int +CSIDL_DESKTOPDIRECTORY: int +CSIDL_DRIVES: int +CSIDL_NETWORK: int +CSIDL_NETHOOD: int +CSIDL_FONTS: int +CSIDL_TEMPLATES: int +CSIDL_COMMON_STARTMENU: int +CSIDL_COMMON_PROGRAMS: int +CSIDL_COMMON_STARTUP: int +CSIDL_COMMON_DESKTOPDIRECTORY: int +CSIDL_APPDATA: int +CSIDL_PRINTHOOD: int +CSIDL_LOCAL_APPDATA: int +CSIDL_ALTSTARTUP: int +CSIDL_COMMON_ALTSTARTUP: int +CSIDL_COMMON_FAVORITES: int +CSIDL_INTERNET_CACHE: int +CSIDL_COOKIES: int +CSIDL_HISTORY: int +CSIDL_COMMON_APPDATA: int +CSIDL_WINDOWS: int +CSIDL_SYSTEM: int +CSIDL_PROGRAM_FILES: int +CSIDL_MYPICTURES: int +CSIDL_PROFILE: int +CSIDL_SYSTEMX86: int +CSIDL_PROGRAM_FILESX86: int +CSIDL_PROGRAM_FILES_COMMON: int +CSIDL_PROGRAM_FILES_COMMONX86: int +CSIDL_COMMON_TEMPLATES: int +CSIDL_COMMON_DOCUMENTS: int +CSIDL_COMMON_ADMINTOOLS: int +CSIDL_ADMINTOOLS: int +CSIDL_CONNECTIONS: int +CSIDL_COMMON_MUSIC: int +CSIDL_COMMON_PICTURES: int +CSIDL_COMMON_VIDEO: int +CSIDL_RESOURCES: int +CSIDL_RESOURCES_LOCALIZED: int +CSIDL_COMMON_OEM_LINKS: int +CSIDL_CDBURN_AREA: int +CSIDL_COMPUTERSNEARME: int +BIF_RETURNONLYFSDIRS: int +BIF_DONTGOBELOWDOMAIN: int +BIF_STATUSTEXT: int +BIF_RETURNFSANCESTORS: int +BIF_EDITBOX: int +BIF_VALIDATE: int +BIF_BROWSEFORCOMPUTER: int +BIF_BROWSEFORPRINTER: int +BIF_BROWSEINCLUDEFILES: int +BFFM_INITIALIZED: int +BFFM_SELCHANGED: int +BFFM_VALIDATEFAILEDA: int +BFFM_VALIDATEFAILEDW: int +BFFM_SETSTATUSTEXTA: Incomplete +BFFM_ENABLEOK: Incomplete +BFFM_SETSELECTIONA: Incomplete +BFFM_SETSELECTIONW: Incomplete +BFFM_SETSTATUSTEXTW: Incomplete +BFFM_SETSTATUSTEXT: Incomplete +BFFM_SETSELECTION: Incomplete +BFFM_VALIDATEFAILED: int +SFGAO_CANCOPY: int +SFGAO_CANMOVE: int +SFGAO_CANLINK: int +SFGAO_CANRENAME: int +SFGAO_CANDELETE: int +SFGAO_HASPROPSHEET: int +SFGAO_DROPTARGET: int +SFGAO_CAPABILITYMASK: int +SFGAO_LINK: int +SFGAO_SHARE: int +SFGAO_READONLY: int +SFGAO_GHOSTED: int +SFGAO_HIDDEN: int +SFGAO_DISPLAYATTRMASK: int +SFGAO_FILESYSANCESTOR: int +SFGAO_FOLDER: int +SFGAO_FILESYSTEM: int +SFGAO_HASSUBFOLDER: int +SFGAO_CONTENTSMASK: int +SFGAO_VALIDATE: int +SFGAO_REMOVABLE: int +SFGAO_COMPRESSED: int +SFGAO_BROWSABLE: int +SFGAO_NONENUMERATED: int +SFGAO_NEWCONTENT: int +SFGAO_STORAGE: int +DWFRF_NORMAL: int +DWFRF_DELETECONFIGDATA: int +DWFAF_HIDDEN: int +DBIM_MINSIZE: int +DBIM_MAXSIZE: int +DBIM_INTEGRAL: int +DBIM_ACTUAL: int +DBIM_TITLE: int +DBIM_MODEFLAGS: int +DBIM_BKCOLOR: int +DBIMF_NORMAL: int +DBIMF_VARIABLEHEIGHT: int +DBIMF_DEBOSSED: int +DBIMF_BKCOLOR: int +DBIF_VIEWMODE_NORMAL: int +DBIF_VIEWMODE_VERTICAL: int +DBIF_VIEWMODE_FLOATING: int +DBIF_VIEWMODE_TRANSPARENT: int +COMPONENT_TOP: int +COMP_TYPE_HTMLDOC: int +COMP_TYPE_PICTURE: int +COMP_TYPE_WEBSITE: int +COMP_TYPE_CONTROL: int +COMP_TYPE_CFHTML: int +COMP_TYPE_MAX: int +AD_APPLY_SAVE: int +AD_APPLY_HTMLGEN: int +AD_APPLY_REFRESH: int +AD_APPLY_ALL: Incomplete +AD_APPLY_FORCE: int +AD_APPLY_BUFFERED_REFRESH: int +WPSTYLE_CENTER: int +WPSTYLE_TILE: int +WPSTYLE_STRETCH: int +WPSTYLE_MAX: int +COMP_ELEM_TYPE: int +COMP_ELEM_CHECKED: int +COMP_ELEM_DIRTY: int +COMP_ELEM_NOSCROLL: int +COMP_ELEM_POS_LEFT: int +COMP_ELEM_POS_TOP: int +COMP_ELEM_SIZE_WIDTH: int +COMP_ELEM_SIZE_HEIGHT: int +COMP_ELEM_POS_ZINDEX: int +COMP_ELEM_SOURCE: int +COMP_ELEM_FRIENDLYNAME: int +COMP_ELEM_SUBSCRIBEDURL: int +ADDURL_SILENT: int +CFSTR_SHELLIDLIST: str +CFSTR_SHELLIDLISTOFFSET: str +CFSTR_NETRESOURCES: str +CFSTR_FILEDESCRIPTORA: str +CFSTR_FILEDESCRIPTORW: str +CFSTR_FILECONTENTS: str +CFSTR_FILENAMEA: str +CFSTR_FILENAMEW: str +CFSTR_PRINTERGROUP: str +CFSTR_FILENAMEMAPA: str +CFSTR_FILENAMEMAPW: str +CFSTR_SHELLURL: str +CFSTR_INETURLA: str +CFSTR_INETURLW: str +CFSTR_PREFERREDDROPEFFECT: str +CFSTR_PERFORMEDDROPEFFECT: str +CFSTR_PASTESUCCEEDED: str +CFSTR_INDRAGLOOP: str +CFSTR_DRAGCONTEXT: str +CFSTR_MOUNTEDVOLUME: str +CFSTR_PERSISTEDDATAOBJECT: str +CFSTR_TARGETCLSID: str +CFSTR_LOGICALPERFORMEDDROPEFFECT: str +CFSTR_AUTOPLAY_SHELLIDLISTS: str +CFSTR_FILEDESCRIPTOR: str +CFSTR_FILENAME: str +CFSTR_FILENAMEMAP: str +DVASPECT_SHORTNAME: int +SHCNE_RENAMEITEM: int +SHCNE_CREATE: int +SHCNE_DELETE: int +SHCNE_MKDIR: int +SHCNE_RMDIR: int +SHCNE_MEDIAINSERTED: int +SHCNE_MEDIAREMOVED: int +SHCNE_DRIVEREMOVED: int +SHCNE_DRIVEADD: int +SHCNE_NETSHARE: int +SHCNE_NETUNSHARE: int +SHCNE_ATTRIBUTES: int +SHCNE_UPDATEDIR: int +SHCNE_UPDATEITEM: int +SHCNE_SERVERDISCONNECT: int +SHCNE_UPDATEIMAGE: int +SHCNE_DRIVEADDGUI: int +SHCNE_RENAMEFOLDER: int +SHCNE_FREESPACE: int +SHCNE_EXTENDED_EVENT: int +SHCNE_ASSOCCHANGED: int +SHCNE_DISKEVENTS: int +SHCNE_GLOBALEVENTS: int +SHCNE_ALLEVENTS: int +SHCNE_INTERRUPT: int +SHCNEE_ORDERCHANGED: int +SHCNF_IDLIST: int +SHCNF_PATHA: int +SHCNF_PRINTERA: int +SHCNF_DWORD: int +SHCNF_PATHW: int +SHCNF_PRINTERW: int +SHCNF_TYPE: int +SHCNF_FLUSH: int +SHCNF_FLUSHNOWAIT: int +SHCNF_PATH: int +SHCNF_PRINTER: int +QIF_CACHED: int +QIF_DONTEXPANDFOLDER: int +SHARD_PIDL: int +SHARD_PATHA: int +SHARD_PATHW: int +SHARD_APPIDINFO: int +SHARD_APPIDINFOIDLIST: int +SHARD_LINK: int +SHARD_APPIDINFOLINK: int +SHARD_SHELLITEM: int +SHARD_PATH: int +SHGDFIL_FINDDATA: int +SHGDFIL_NETRESOURCE: int +SHGDFIL_DESCRIPTIONID: int +SHDID_ROOT_REGITEM: int +SHDID_FS_FILE: int +SHDID_FS_DIRECTORY: int +SHDID_FS_OTHER: int +SHDID_COMPUTER_DRIVE35: int +SHDID_COMPUTER_DRIVE525: int +SHDID_COMPUTER_REMOVABLE: int +SHDID_COMPUTER_FIXED: int +SHDID_COMPUTER_NETDRIVE: int +SHDID_COMPUTER_CDROM: int +SHDID_COMPUTER_RAMDISK: int +SHDID_COMPUTER_OTHER: int +SHDID_NET_DOMAIN: int +SHDID_NET_SERVER: int +SHDID_NET_SHARE: int +SHDID_NET_RESTOFNET: int +SHDID_NET_OTHER: int +PID_IS_URL: int +PID_IS_NAME: int +PID_IS_WORKINGDIR: int +PID_IS_HOTKEY: int +PID_IS_SHOWCMD: int +PID_IS_ICONINDEX: int +PID_IS_ICONFILE: int +PID_IS_WHATSNEW: int +PID_IS_AUTHOR: int +PID_IS_DESCRIPTION: int +PID_IS_COMMENT: int +PID_INTSITE_WHATSNEW: int +PID_INTSITE_AUTHOR: int +PID_INTSITE_LASTVISIT: int +PID_INTSITE_LASTMOD: int +PID_INTSITE_VISITCOUNT: int +PID_INTSITE_DESCRIPTION: int +PID_INTSITE_COMMENT: int +PID_INTSITE_FLAGS: int +PID_INTSITE_CONTENTLEN: int +PID_INTSITE_CONTENTCODE: int +PID_INTSITE_RECURSE: int +PID_INTSITE_WATCH: int +PID_INTSITE_SUBSCRIPTION: int +PID_INTSITE_URL: int +PID_INTSITE_TITLE: int +PID_INTSITE_CODEPAGE: int +PID_INTSITE_TRACKING: int +PIDISF_RECENTLYCHANGED: int +PIDISF_CACHEDSTICKY: int +PIDISF_CACHEIMAGES: int +PIDISF_FOLLOWALLLINKS: int +PIDISM_GLOBAL: int +PIDISM_WATCH: int +PIDISM_DONTWATCH: int +SSF_SHOWALLOBJECTS: int +SSF_SHOWEXTENSIONS: int +SSF_SHOWCOMPCOLOR: int +SSF_SHOWSYSFILES: int +SSF_DOUBLECLICKINWEBVIEW: int +SSF_SHOWATTRIBCOL: int +SSF_DESKTOPHTML: int +SSF_WIN95CLASSIC: int +SSF_DONTPRETTYPATH: int +SSF_SHOWINFOTIP: int +SSF_MAPNETDRVBUTTON: int +SSF_NOCONFIRMRECYCLE: int +SSF_HIDEICONS: int +ABM_NEW: int +ABM_REMOVE: int +ABM_QUERYPOS: int +ABM_SETPOS: int +ABM_GETSTATE: int +ABM_GETTASKBARPOS: int +ABM_ACTIVATE: int +ABM_GETAUTOHIDEBAR: int +ABM_SETAUTOHIDEBAR: int +ABM_WINDOWPOSCHANGED: int +ABN_STATECHANGE: int +ABN_POSCHANGED: int +ABN_FULLSCREENAPP: int +ABN_WINDOWARRANGE: int +ABS_AUTOHIDE: int +ABS_ALWAYSONTOP: int +ABE_LEFT: int +ABE_TOP: int +ABE_RIGHT: int +ABE_BOTTOM: int + +def EIRESID(x): ... + +SHCONTF_FOLDERS: int +SHCONTF_NONFOLDERS: int +SHCONTF_INCLUDEHIDDEN: int +SHCONTF_INIT_ON_FIRST_NEXT: int +SHCONTF_NETPRINTERSRCH: int +SHCONTF_SHAREABLE: int +SHCONTF_STORAGE: int +SHGDN_NORMAL: int +SHGDN_INFOLDER: int +SHGDN_FOREDITING: int +SHGDN_INCLUDE_NONFILESYS: int +SHGDN_FORADDRESSBAR: int +SHGDN_FORPARSING: int +BFO_NONE: int +BFO_BROWSER_PERSIST_SETTINGS: int +BFO_RENAME_FOLDER_OPTIONS_TOINTERNET: int +BFO_BOTH_OPTIONS: int +BIF_PREFER_INTERNET_SHORTCUT: int +BFO_BROWSE_NO_IN_NEW_PROCESS: int +BFO_ENABLE_HYPERLINK_TRACKING: int +BFO_USE_IE_OFFLINE_SUPPORT: int +BFO_SUBSTITUE_INTERNET_START_PAGE: int +BFO_USE_IE_LOGOBANDING: int +BFO_ADD_IE_TOCAPTIONBAR: int +BFO_USE_DIALUP_REF: int +BFO_USE_IE_TOOLBAR: int +BFO_NO_PARENT_FOLDER_SUPPORT: int +BFO_NO_REOPEN_NEXT_RESTART: int +BFO_GO_HOME_PAGE: int +BFO_PREFER_IEPROCESS: int +BFO_SHOW_NAVIGATION_CANCELLED: int +BFO_QUERY_ALL: int +PID_FINDDATA: int +PID_NETRESOURCE: int +PID_DESCRIPTIONID: int +PID_WHICHFOLDER: int +PID_NETWORKLOCATION: int +PID_COMPUTERNAME: int +PID_DISPLACED_FROM: int +PID_DISPLACED_DATE: int +PID_SYNC_COPY_IN: int +PID_MISC_STATUS: int +PID_MISC_ACCESSCOUNT: int +PID_MISC_OWNER: int +PID_HTMLINFOTIPFILE: int +PID_MISC_PICS: int +PID_DISPLAY_PROPERTIES: int +PID_INTROTEXT: int +PIDSI_ARTIST: int +PIDSI_SONGTITLE: int +PIDSI_ALBUM: int +PIDSI_YEAR: int +PIDSI_COMMENT: int +PIDSI_TRACK: int +PIDSI_GENRE: int +PIDSI_LYRICS: int +PIDDRSI_PROTECTED: int +PIDDRSI_DESCRIPTION: int +PIDDRSI_PLAYCOUNT: int +PIDDRSI_PLAYSTARTS: int +PIDDRSI_PLAYEXPIRES: int +PIDVSI_STREAM_NAME: int +PIDVSI_FRAME_WIDTH: int +PIDVSI_FRAME_HEIGHT: int +PIDVSI_TIMELENGTH: int +PIDVSI_FRAME_COUNT: int +PIDVSI_FRAME_RATE: int +PIDVSI_DATA_RATE: int +PIDVSI_SAMPLE_SIZE: int +PIDVSI_COMPRESSION: int +PIDVSI_STREAM_NUMBER: int +PIDASI_FORMAT: int +PIDASI_TIMELENGTH: int +PIDASI_AVG_DATA_RATE: int +PIDASI_SAMPLE_RATE: int +PIDASI_SAMPLE_SIZE: int +PIDASI_CHANNEL_COUNT: int +PIDASI_STREAM_NUMBER: int +PIDASI_STREAM_NAME: int +PIDASI_COMPRESSION: int +PID_CONTROLPANEL_CATEGORY: int +PID_VOLUME_FREE: int +PID_VOLUME_CAPACITY: int +PID_VOLUME_FILESYSTEM: int +PID_SHARE_CSC_STATUS: int +PID_LINK_TARGET: int +PID_QUERY_RANK: int +PROPSETFLAG_DEFAULT: int +PROPSETFLAG_NONSIMPLE: int +PROPSETFLAG_ANSI: int +PROPSETFLAG_UNBUFFERED: int +PROPSETFLAG_CASE_SENSITIVE: int +PROPSET_BEHAVIOR_CASE_SENSITIVE: int +PID_DICTIONARY: int +PID_CODEPAGE: int +PID_FIRST_USABLE: int +PID_FIRST_NAME_DEFAULT: int +PID_LOCALE: int +PID_MODIFY_TIME: int +PID_SECURITY: int +PID_BEHAVIOR: int +PID_ILLEGAL: int +PID_MIN_READONLY: int +PID_MAX_READONLY: int +PIDDI_THUMBNAIL: int +PIDSI_TITLE: int +PIDSI_SUBJECT: int +PIDSI_AUTHOR: int +PIDSI_KEYWORDS: int +PIDSI_COMMENTS: int +PIDSI_TEMPLATE: int +PIDSI_LASTAUTHOR: int +PIDSI_REVNUMBER: int +PIDSI_EDITTIME: int +PIDSI_LASTPRINTED: int +PIDSI_CREATE_DTM: int +PIDSI_LASTSAVE_DTM: int +PIDSI_PAGECOUNT: int +PIDSI_WORDCOUNT: int +PIDSI_CHARCOUNT: int +PIDSI_THUMBNAIL: int +PIDSI_APPNAME: int +PIDSI_DOC_SECURITY: int +PIDDSI_CATEGORY: int +PIDDSI_PRESFORMAT: int +PIDDSI_BYTECOUNT: int +PIDDSI_LINECOUNT: int +PIDDSI_PARCOUNT: int +PIDDSI_SLIDECOUNT: int +PIDDSI_NOTECOUNT: int +PIDDSI_HIDDENCOUNT: int +PIDDSI_MMCLIPCOUNT: int +PIDDSI_SCALE: int +PIDDSI_HEADINGPAIR: int +PIDDSI_DOCPARTS: int +PIDDSI_MANAGER: int +PIDDSI_COMPANY: int +PIDDSI_LINKSDIRTY: int +PIDMSI_EDITOR: int +PIDMSI_SUPPLIER: int +PIDMSI_SOURCE: int +PIDMSI_SEQUENCE_NO: int +PIDMSI_PROJECT: int +PIDMSI_STATUS: int +PIDMSI_OWNER: int +PIDMSI_RATING: int +PIDMSI_PRODUCTION: int +PIDMSI_COPYRIGHT: int +PRSPEC_INVALID: int +PRSPEC_LPWSTR: int +PRSPEC_PROPID: int +SHCIDS_ALLFIELDS: int +SHCIDS_CANONICALONLY: int +SHCIDS_BITMASK: int +SHCIDS_COLUMNMASK: int +SFGAO_CANMONIKER: int +SFGAO_HASSTORAGE: int +SFGAO_STREAM: int +SFGAO_STORAGEANCESTOR: int +SFGAO_STORAGECAPMASK: int +MAXPROPPAGES: int +PSP_DEFAULT: int +PSP_DLGINDIRECT: int +PSP_USEHICON: int +PSP_USEICONID: int +PSP_USETITLE: int +PSP_RTLREADING: int +PSP_HASHELP: int +PSP_USEREFPARENT: int +PSP_USECALLBACK: int +PSP_PREMATURE: int +PSP_HIDEHEADER: int +PSP_USEHEADERTITLE: int +PSP_USEHEADERSUBTITLE: int +PSP_USEFUSIONCONTEXT: int +PSPCB_ADDREF: int +PSPCB_RELEASE: int +PSPCB_CREATE: int +PSH_DEFAULT: int +PSH_PROPTITLE: int +PSH_USEHICON: int +PSH_USEICONID: int +PSH_PROPSHEETPAGE: int +PSH_WIZARDHASFINISH: int +PSH_WIZARD: int +PSH_USEPSTARTPAGE: int +PSH_NOAPPLYNOW: int +PSH_USECALLBACK: int +PSH_HASHELP: int +PSH_MODELESS: int +PSH_RTLREADING: int +PSH_WIZARDCONTEXTHELP: int +PSH_WIZARD97: int +PSH_WATERMARK: int +PSH_USEHBMWATERMARK: int +PSH_USEHPLWATERMARK: int +PSH_STRETCHWATERMARK: int +PSH_HEADER: int +PSH_USEHBMHEADER: int +PSH_USEPAGELANG: int +PSH_WIZARD_LITE: int +PSH_NOCONTEXTHELP: int +PSCB_INITIALIZED: int +PSCB_PRECREATE: int +PSCB_BUTTONPRESSED: int +PSNRET_NOERROR: int +PSNRET_INVALID: int +PSNRET_INVALID_NOCHANGEPAGE: int +PSNRET_MESSAGEHANDLED: int +PSWIZB_BACK: int +PSWIZB_NEXT: int +PSWIZB_FINISH: int +PSWIZB_DISABLEDFINISH: int +PSBTN_BACK: int +PSBTN_NEXT: int +PSBTN_FINISH: int +PSBTN_OK: int +PSBTN_APPLYNOW: int +PSBTN_CANCEL: int +PSBTN_HELP: int +PSBTN_MAX: int +ID_PSRESTARTWINDOWS: int +ID_PSREBOOTSYSTEM: Incomplete +WIZ_CXDLG: int +WIZ_CYDLG: int +WIZ_CXBMP: int +WIZ_BODYX: int +WIZ_BODYCX: int +PROP_SM_CXDLG: int +PROP_SM_CYDLG: int +PROP_MED_CXDLG: int +PROP_MED_CYDLG: int +PROP_LG_CXDLG: int +PROP_LG_CYDLG: int +ISOLATION_AWARE_USE_STATIC_LIBRARY: int +ISOLATION_AWARE_BUILD_STATIC_LIBRARY: int +SHCOLSTATE_TYPE_STR: int +SHCOLSTATE_TYPE_INT: int +SHCOLSTATE_TYPE_DATE: int +SHCOLSTATE_TYPEMASK: int +SHCOLSTATE_ONBYDEFAULT: int +SHCOLSTATE_SLOW: int +SHCOLSTATE_EXTENDED: int +SHCOLSTATE_SECONDARYUI: int +SHCOLSTATE_HIDDEN: int +SHCOLSTATE_PREFER_VARCMP: int +FWF_AUTOARRANGE: int +FWF_ABBREVIATEDNAMES: int +FWF_SNAPTOGRID: int +FWF_OWNERDATA: int +FWF_BESTFITWINDOW: int +FWF_DESKTOP: int +FWF_SINGLESEL: int +FWF_NOSUBFOLDERS: int +FWF_TRANSPARENT: int +FWF_NOCLIENTEDGE: int +FWF_NOSCROLL: int +FWF_ALIGNLEFT: int +FWF_NOICONS: int +FWF_SHOWSELALWAYS: int +FWF_NOVISIBLE: int +FWF_SINGLECLICKACTIVATE: int +FWF_NOWEBVIEW: int +FWF_HIDEFILENAMES: int +FWF_CHECKSELECT: int +FVM_FIRST: int +FVM_ICON: int +FVM_SMALLICON: int +FVM_LIST: int +FVM_DETAILS: int +FVM_THUMBNAIL: int +FVM_TILE: int +FVM_THUMBSTRIP: int +SVUIA_DEACTIVATE: int +SVUIA_ACTIVATE_NOFOCUS: int +SVUIA_ACTIVATE_FOCUS: int +SVUIA_INPLACEACTIVATE: int +SHCNRF_InterruptLevel: int +SHCNRF_ShellLevel: int +SHCNRF_RecursiveInterrupt: int +SHCNRF_NewDelivery: int +FD_CLSID: int +FD_SIZEPOINT: int +FD_ATTRIBUTES: int +FD_CREATETIME: int +FD_ACCESSTIME: int +FD_WRITESTIME: int +FD_FILESIZE: int +FD_PROGRESSUI: int +FD_LINKUI: int +ASSOCF_INIT_NOREMAPCLSID: int +ASSOCF_INIT_BYEXENAME: int +ASSOCF_OPEN_BYEXENAME: int +ASSOCF_INIT_DEFAULTTOSTAR: int +ASSOCF_INIT_DEFAULTTOFOLDER: int +ASSOCF_NOUSERSETTINGS: int +ASSOCF_NOTRUNCATE: int +ASSOCF_VERIFY: int +ASSOCF_REMAPRUNDLL: int +ASSOCF_NOFIXUPS: int +ASSOCF_IGNOREBASECLASS: int +ASSOCSTR_COMMAND: int +ASSOCSTR_EXECUTABLE: int +ASSOCSTR_FRIENDLYDOCNAME: int +ASSOCSTR_FRIENDLYAPPNAME: int +ASSOCSTR_NOOPEN: int +ASSOCSTR_SHELLNEWVALUE: int +ASSOCSTR_DDECOMMAND: int +ASSOCSTR_DDEIFEXEC: int +ASSOCSTR_DDEAPPLICATION: int +ASSOCSTR_DDETOPIC: int +ASSOCSTR_INFOTIP: int +ASSOCSTR_QUICKTIP: int +ASSOCSTR_TILEINFO: int +ASSOCSTR_CONTENTTYPE: int +ASSOCSTR_DEFAULTICON: int +ASSOCSTR_SHELLEXTENSION: int +ASSOCKEY_SHELLEXECCLASS: int +ASSOCKEY_APP: int +ASSOCKEY_CLASS: int +ASSOCKEY_BASECLASS: int +ASSOCDATA_MSIDESCRIPTOR: int +ASSOCDATA_NOACTIVATEHANDLER: int +ASSOCDATA_QUERYCLASSSTORE: int +ASSOCDATA_HASPERUSERASSOC: int +ASSOCDATA_EDITFLAGS: int +ASSOCDATA_VALUE: int +SHGVSPB_PERUSER: int +SHGVSPB_ALLUSERS: int +SHGVSPB_PERFOLDER: int +SHGVSPB_ALLFOLDERS: int +SHGVSPB_INHERIT: int +SHGVSPB_ROAM: int +SHGVSPB_NOAUTODEFAULTS: int +SHGVSPB_FOLDER: Incomplete +SHGVSPB_FOLDERNODEFAULTS: Incomplete +SHGVSPB_USERDEFAULTS: Incomplete +SHGVSPB_GLOBALDEAFAULTS: Incomplete +SFVM_REARRANGE: int +SFVM_ADDOBJECT: int +SFVM_REMOVEOBJECT: int +SFVM_UPDATEOBJECT: int +SFVM_GETSELECTEDOBJECTS: int +SFVM_SETITEMPOS: int +SFVM_SETCLIPBOARD: int +SFVM_SETPOINTS: int +SLDF_HAS_ID_LIST: int +SLDF_HAS_LINK_INFO: int +SLDF_HAS_NAME: int +SLDF_HAS_RELPATH: int +SLDF_HAS_WORKINGDIR: int +SLDF_HAS_ARGS: int +SLDF_HAS_ICONLOCATION: int +SLDF_UNICODE: int +SLDF_FORCE_NO_LINKINFO: int +SLDF_HAS_EXP_SZ: int +SLDF_RUN_IN_SEPARATE: int +SLDF_HAS_LOGO3ID: int +SLDF_HAS_DARWINID: int +SLDF_RUNAS_USER: int +SLDF_NO_PIDL_ALIAS: int +SLDF_FORCE_UNCNAME: int +SLDF_HAS_EXP_ICON_SZ: int +SLDF_RUN_WITH_SHIMLAYER: int +SLDF_RESERVED: int +EXP_SPECIAL_FOLDER_SIG: int +NT_CONSOLE_PROPS_SIG: int +NT_FE_CONSOLE_PROPS_SIG: int +EXP_DARWIN_ID_SIG: int +EXP_LOGO3_ID_SIG: int +EXP_SZ_ICON_SIG: int +EXP_SZ_LINK_SIG: int +IURL_SETURL_FL_GUESS_PROTOCOL: int +IURL_SETURL_FL_USE_DEFAULT_PROTOCOL: int +IURL_INVOKECOMMAND_FL_ALLOW_UI: int +IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB: int +IURL_INVOKECOMMAND_FL_DDEWAIT: int +IS_NORMAL: int +IS_FULLSCREEN: int +IS_SPLIT: int +IS_VALIDSIZESTATEBITS: Incomplete +IS_VALIDSTATEBITS: Incomplete +AD_APPLY_DYNAMICREFRESH: int +COMP_ELEM_ORIGINAL_CSI: int +COMP_ELEM_RESTORED_CSI: int +COMP_ELEM_CURITEMSTATE: int +COMP_ELEM_ALL: Incomplete +DTI_ADDUI_DEFAULT: int +DTI_ADDUI_DISPSUBWIZARD: int +DTI_ADDUI_POSITIONITEM: int +COMPONENT_DEFAULT_LEFT: int +COMPONENT_DEFAULT_TOP: int +SSM_CLEAR: int +SSM_SET: int +SSM_REFRESH: int +SSM_UPDATE: int +SCHEME_DISPLAY: int +SCHEME_EDIT: int +SCHEME_LOCAL: int +SCHEME_GLOBAL: int +SCHEME_REFRESH: int +SCHEME_UPDATE: int +SCHEME_DONOTUSE: int +SCHEME_CREATE: int +GADOF_DIRTY: int +EVCF_HASSETTINGS: int +EVCF_ENABLEBYDEFAULT: int +EVCF_REMOVEFROMLIST: int +EVCF_ENABLEBYDEFAULT_AUTO: int +EVCF_DONTSHOWIFZERO: int +EVCF_SETTINGSMODE: int +EVCF_OUTOFDISKSPACE: int +EVCCBF_LASTNOTIFICATION: int +EBO_NONE: int +EBO_NAVIGATEONCE: int +EBO_SHOWFRAMES: int +EBO_ALWAYSNAVIGATE: int +EBO_NOTRAVELLOG: int +EBO_NOWRAPPERWINDOW: int +EBF_NONE: int +EBF_SELECTFROMDATAOBJECT: int +EBF_NODROPTARGET: int +ECS_ENABLED: int +ECS_DISABLED: int +ECS_HIDDEN: int +ECS_CHECKBOX: int +ECS_CHECKED: int +ECF_HASSUBCOMMANDS: int +ECF_HASSPLITBUTTON: int +ECF_HIDELABEL: int +ECF_ISSEPARATOR: int +ECF_HASLUASHIELD: int +SIATTRIBFLAGS_AND: int +SIATTRIBFLAGS_OR: int +SIATTRIBFLAGS_APPCOMPAT: int +SIATTRIBFLAGS_MASK: int +SIGDN_NORMALDISPLAY: int +SIGDN_PARENTRELATIVEPARSING: int +SIGDN_DESKTOPABSOLUTEPARSING: int +SIGDN_PARENTRELATIVEEDITING: int +SIGDN_DESKTOPABSOLUTEEDITING: int +SIGDN_FILESYSPATH: int +SIGDN_URL: int +SIGDN_PARENTRELATIVEFORADDRESSBAR: int +SIGDN_PARENTRELATIVE: int +SICHINT_DISPLAY: Incomplete +SICHINT_ALLFIELDS: int +SICHINT_CANONICAL: int +ASSOCCLASS_SHELL_KEY: int +ASSOCCLASS_PROGID_KEY: int +ASSOCCLASS_PROGID_STR: int +ASSOCCLASS_CLSID_KEY: int +ASSOCCLASS_CLSID_STR: int +ASSOCCLASS_APP_KEY: int +ASSOCCLASS_APP_STR: int +ASSOCCLASS_SYSTEM_STR: int +ASSOCCLASS_FOLDER: int +ASSOCCLASS_STAR: int +NSTCS_HASEXPANDOS: int +NSTCS_HASLINES: int +NSTCS_SINGLECLICKEXPAND: int +NSTCS_FULLROWSELECT: int +NSTCS_SPRINGEXPAND: int +NSTCS_HORIZONTALSCROLL: int +NSTCS_ROOTHASEXPANDO: int +NSTCS_SHOWSELECTIONALWAYS: int +NSTCS_NOINFOTIP: int +NSTCS_EVENHEIGHT: int +NSTCS_NOREPLACEOPEN: int +NSTCS_DISABLEDRAGDROP: int +NSTCS_NOORDERSTREAM: int +NSTCS_RICHTOOLTIP: int +NSTCS_BORDER: int +NSTCS_NOEDITLABELS: int +NSTCS_TABSTOP: int +NSTCS_FAVORITESMODE: int +NSTCS_AUTOHSCROLL: int +NSTCS_FADEINOUTEXPANDOS: int +NSTCS_EMPTYTEXT: int +NSTCS_CHECKBOXES: int +NSTCS_PARTIALCHECKBOXES: int +NSTCS_EXCLUSIONCHECKBOXES: int +NSTCS_DIMMEDCHECKBOXES: int +NSTCS_NOINDENTCHECKS: int +NSTCS_ALLOWJUNCTIONS: int +NSTCS_SHOWTABSBUTTON: int +NSTCS_SHOWDELETEBUTTON: int +NSTCS_SHOWREFRESHBUTTON: int +NSTCRS_VISIBLE: int +NSTCRS_HIDDEN: int +NSTCRS_EXPANDED: int +NSTCIS_NONE: int +NSTCIS_SELECTED: int +NSTCIS_EXPANDED: int +NSTCIS_BOLD: int +NSTCIS_DISABLED: int +NSTCGNI_NEXT: int +NSTCGNI_NEXTVISIBLE: int +NSTCGNI_PREV: int +NSTCGNI_PREVVISIBLE: int +NSTCGNI_PARENT: int +NSTCGNI_CHILD: int +NSTCGNI_FIRSTVISIBLE: int +NSTCGNI_LASTVISIBLE: int +CLSID_ExplorerBrowser: str +IBrowserFrame_Methods: Incomplete +ICategorizer_Methods: Incomplete +ICategoryProvider_Methods: Incomplete +IContextMenu_Methods: Incomplete +IExplorerCommand_Methods: Incomplete +IExplorerCommandProvider_Methods: Incomplete +IOleWindow_Methods: Incomplete +IPersist_Methods: Incomplete +IPersistFolder_Methods: Incomplete +IPersistFolder2_Methods: Incomplete +IShellExtInit_Methods: Incomplete +IShellView_Methods: Incomplete +IShellFolder_Methods: Incomplete +IShellFolder2_Methods: Incomplete +GPS_DEFAULT: int +GPS_HANDLERPROPERTIESONLY: int +GPS_READWRITE: int +GPS_TEMPORARY: int +GPS_FASTPROPERTIESONLY: int +GPS_OPENSLOWITEM: int +GPS_DELAYCREATION: int +GPS_BESTEFFORT: int +GPS_MASK_VALID: int +STR_AVOID_DRIVE_RESTRICTION_POLICY: str +STR_BIND_DELEGATE_CREATE_OBJECT: str +STR_BIND_FOLDERS_READ_ONLY: str +STR_BIND_FOLDER_ENUM_MODE: str +STR_BIND_FORCE_FOLDER_SHORTCUT_RESOLVE: str +STR_DONT_PARSE_RELATIVE: str +STR_DONT_RESOLVE_LINK: str +STR_FILE_SYS_BIND_DATA: str +STR_GET_ASYNC_HANDLER: str +STR_GPS_BESTEFFORT: str +STR_GPS_DELAYCREATION: str +STR_GPS_FASTPROPERTIESONLY: str +STR_GPS_HANDLERPROPERTIESONLY: str +STR_GPS_NO_OPLOCK: str +STR_GPS_OPENSLOWITEM: str +STR_IFILTER_FORCE_TEXT_FILTER_FALLBACK: str +STR_IFILTER_LOAD_DEFINED_FILTER: str +STR_INTERNAL_NAVIGATE: str +STR_INTERNETFOLDER_PARSE_ONLY_URLMON_BINDABLE: str +STR_ITEM_CACHE_CONTEXT: str +STR_NO_VALIDATE_FILENAME_CHARS: str +STR_PARSE_ALLOW_INTERNET_SHELL_FOLDERS: str +STR_PARSE_AND_CREATE_ITEM: str +STR_PARSE_DONT_REQUIRE_VALIDATED_URLS: str +STR_PARSE_EXPLICIT_ASSOCIATION_SUCCESSFUL: str +STR_PARSE_PARTIAL_IDLIST: str +STR_PARSE_PREFER_FOLDER_BROWSING: str +STR_PARSE_PREFER_WEB_BROWSING: str +STR_PARSE_PROPERTYSTORE: str +STR_PARSE_SHELL_PROTOCOL_TO_FILE_OBJECTS: str +STR_PARSE_SHOW_NET_DIAGNOSTICS_UI: str +STR_PARSE_SKIP_NET_CACHE: str +STR_PARSE_TRANSLATE_ALIASES: str +STR_PARSE_WITH_EXPLICIT_ASSOCAPP: str +STR_PARSE_WITH_EXPLICIT_PROGID: str +STR_PARSE_WITH_PROPERTIES: str +STR_SKIP_BINDING_CLSID: str +STR_TRACK_CLSID: str +KF_REDIRECTION_CAPABILITIES_ALLOW_ALL: int +KF_REDIRECTION_CAPABILITIES_REDIRECTABLE: int +KF_REDIRECTION_CAPABILITIES_DENY_ALL: int +KF_REDIRECTION_CAPABILITIES_DENY_POLICY_REDIRECTED: int +KF_REDIRECTION_CAPABILITIES_DENY_POLICY: int +KF_REDIRECTION_CAPABILITIES_DENY_PERMISSIONS: int +KF_REDIRECT_USER_EXCLUSIVE: int +KF_REDIRECT_COPY_SOURCE_DACL: int +KF_REDIRECT_OWNER_USER: int +KF_REDIRECT_SET_OWNER_EXPLICIT: int +KF_REDIRECT_CHECK_ONLY: int +KF_REDIRECT_WITH_UI: int +KF_REDIRECT_UNPIN: int +KF_REDIRECT_PIN: int +KF_REDIRECT_COPY_CONTENTS: int +KF_REDIRECT_DEL_SOURCE_CONTENTS: int +KF_REDIRECT_EXCLUDE_ALL_KNOWN_SUBFOLDERS: int +KF_CATEGORY_VIRTUAL: int +KF_CATEGORY_FIXED: int +KF_CATEGORY_COMMON: int +KF_CATEGORY_PERUSER: int +FFFP_EXACTMATCH: int +FFFP_NEARESTPARENTMATCH: int +KF_FLAG_CREATE: int +KF_FLAG_DONT_VERIFY: int +KF_FLAG_DONT_UNEXPAND: int +KF_FLAG_NO_ALIAS: int +KF_FLAG_INIT: int +KF_FLAG_DEFAULT_PATH: int +KF_FLAG_NOT_PARENT_RELATIVE: int +KF_FLAG_SIMPLE_IDLIST: int +ADLT_RECENT: int +ADLT_FREQUENT: int +KDC_FREQUENT: int +KDC_RECENT: int +LFF_FORCEFILESYSTEM: int +LFF_STORAGEITEMS: int +LFF_ALLITEMS: int +DSFT_DETECT: int +DSFT_PRIVATE: int +DSFT_PUBLIC: int +LOF_DEFAULT: int +LOF_PINNEDTONAVPANE: int +LOF_MASK_ALL: int +LSF_FAILIFTHERE: int +LSF_OVERRIDEEXISTING: int +LSF_MAKEUNIQUENAME: int +TSF_NORMAL: int +TSF_FAIL_EXIST: int +TSF_RENAME_EXIST: int +TSF_OVERWRITE_EXIST: int +TSF_ALLOW_DECRYPTION: int +TSF_NO_SECURITY: int +TSF_COPY_CREATION_TIME: int +TSF_COPY_WRITE_TIME: int +TSF_USE_FULL_ACCESS: int +TSF_DELETE_RECYCLE_IF_POSSIBLE: int +TSF_COPY_HARD_LINK: int +TSF_COPY_LOCALIZED_NAME: int +TSF_MOVE_AS_COPY_DELETE: int +TSF_SUSPEND_SHELLEVENTS: int +TS_NONE: int +TS_PERFORMING: int +TS_PREPARING: int +TS_INDETERMINATE: int +COPYENGINE_S_YES: int +COPYENGINE_S_NOT_HANDLED: int +COPYENGINE_S_USER_RETRY: int +COPYENGINE_S_USER_IGNORED: int +COPYENGINE_S_MERGE: int +COPYENGINE_S_DONT_PROCESS_CHILDREN: int +COPYENGINE_S_ALREADY_DONE: int +COPYENGINE_S_PENDING: int +COPYENGINE_S_KEEP_BOTH: int +COPYENGINE_S_CLOSE_PROGRAM: int +COPYENGINE_S_COLLISIONRESOLVED: int +COPYENGINE_E_USER_CANCELLED: int +COPYENGINE_E_CANCELLED: int +COPYENGINE_E_REQUIRES_ELEVATION: int +COPYENGINE_E_SAME_FILE: int +COPYENGINE_E_DIFF_DIR: int +COPYENGINE_E_MANY_SRC_1_DEST: int +COPYENGINE_E_DEST_SUBTREE: int +COPYENGINE_E_DEST_SAME_TREE: int +COPYENGINE_E_FLD_IS_FILE_DEST: int +COPYENGINE_E_FILE_IS_FLD_DEST: int +COPYENGINE_E_FILE_TOO_LARGE: int +COPYENGINE_E_REMOVABLE_FULL: int +COPYENGINE_E_DEST_IS_RO_CD: int +COPYENGINE_E_DEST_IS_RW_CD: int +COPYENGINE_E_DEST_IS_R_CD: int +COPYENGINE_E_DEST_IS_RO_DVD: int +COPYENGINE_E_DEST_IS_RW_DVD: int +COPYENGINE_E_DEST_IS_R_DVD: int +COPYENGINE_E_SRC_IS_RO_CD: int +COPYENGINE_E_SRC_IS_RW_CD: int +COPYENGINE_E_SRC_IS_R_CD: int +COPYENGINE_E_SRC_IS_RO_DVD: int +COPYENGINE_E_SRC_IS_RW_DVD: int +COPYENGINE_E_SRC_IS_R_DVD: int +COPYENGINE_E_INVALID_FILES_SRC: int +COPYENGINE_E_INVALID_FILES_DEST: int +COPYENGINE_E_PATH_TOO_DEEP_SRC: int +COPYENGINE_E_PATH_TOO_DEEP_DEST: int +COPYENGINE_E_ROOT_DIR_SRC: int +COPYENGINE_E_ROOT_DIR_DEST: int +COPYENGINE_E_ACCESS_DENIED_SRC: int +COPYENGINE_E_ACCESS_DENIED_DEST: int +COPYENGINE_E_PATH_NOT_FOUND_SRC: int +COPYENGINE_E_PATH_NOT_FOUND_DEST: int +COPYENGINE_E_NET_DISCONNECT_SRC: int +COPYENGINE_E_NET_DISCONNECT_DEST: int +COPYENGINE_E_SHARING_VIOLATION_SRC: int +COPYENGINE_E_SHARING_VIOLATION_DEST: int +COPYENGINE_E_ALREADY_EXISTS_NORMAL: int +COPYENGINE_E_ALREADY_EXISTS_READONLY: int +COPYENGINE_E_ALREADY_EXISTS_SYSTEM: int +COPYENGINE_E_ALREADY_EXISTS_FOLDER: int +COPYENGINE_E_STREAM_LOSS: int +COPYENGINE_E_EA_LOSS: int +COPYENGINE_E_PROPERTY_LOSS: int +COPYENGINE_E_PROPERTIES_LOSS: int +COPYENGINE_E_ENCRYPTION_LOSS: int +COPYENGINE_E_DISK_FULL: int +COPYENGINE_E_DISK_FULL_CLEAN: int +COPYENGINE_E_EA_NOT_SUPPORTED: int +COPYENGINE_E_CANT_REACH_SOURCE: int +COPYENGINE_E_RECYCLE_UNKNOWN_ERROR: int +COPYENGINE_E_RECYCLE_FORCE_NUKE: int +COPYENGINE_E_RECYCLE_SIZE_TOO_BIG: int +COPYENGINE_E_RECYCLE_PATH_TOO_LONG: int +COPYENGINE_E_RECYCLE_BIN_NOT_FOUND: int +COPYENGINE_E_NEWFILE_NAME_TOO_LONG: int +COPYENGINE_E_NEWFOLDER_NAME_TOO_LONG: int +COPYENGINE_E_DIR_NOT_EMPTY: int +COPYENGINE_E_FAT_MAX_IN_ROOT: int +COPYENGINE_E_ACCESSDENIED_READONLY: int +COPYENGINE_E_REDIRECTED_TO_WEBPAGE: int +COPYENGINE_E_SERVER_BAD_FILE_TYPE: int +FOLDERID_NetworkFolder: str +FOLDERID_ComputerFolder: str +FOLDERID_InternetFolder: str +FOLDERID_ControlPanelFolder: str +FOLDERID_PrintersFolder: str +FOLDERID_SyncManagerFolder: str +FOLDERID_SyncSetupFolder: str +FOLDERID_ConflictFolder: str +FOLDERID_SyncResultsFolder: str +FOLDERID_RecycleBinFolder: str +FOLDERID_ConnectionsFolder: str +FOLDERID_Fonts: str +FOLDERID_Desktop: str +FOLDERID_Startup: str +FOLDERID_Programs: str +FOLDERID_StartMenu: str +FOLDERID_Recent: str +FOLDERID_SendTo: str +FOLDERID_Documents: str +FOLDERID_Favorites: str +FOLDERID_NetHood: str +FOLDERID_PrintHood: str +FOLDERID_Templates: str +FOLDERID_CommonStartup: str +FOLDERID_CommonPrograms: str +FOLDERID_CommonStartMenu: str +FOLDERID_PublicDesktop: str +FOLDERID_ProgramData: str +FOLDERID_CommonTemplates: str +FOLDERID_PublicDocuments: str +FOLDERID_RoamingAppData: str +FOLDERID_LocalAppData: str +FOLDERID_LocalAppDataLow: str +FOLDERID_InternetCache: str +FOLDERID_Cookies: str +FOLDERID_History: str +FOLDERID_System: str +FOLDERID_SystemX86: str +FOLDERID_Windows: str +FOLDERID_Profile: str +FOLDERID_Pictures: str +FOLDERID_ProgramFilesX86: str +FOLDERID_ProgramFilesCommonX86: str +FOLDERID_ProgramFilesX64: str +FOLDERID_ProgramFilesCommonX64: str +FOLDERID_ProgramFiles: str +FOLDERID_ProgramFilesCommon: str +FOLDERID_UserProgramFiles: str +FOLDERID_UserProgramFilesCommon: str +FOLDERID_AdminTools: str +FOLDERID_CommonAdminTools: str +FOLDERID_Music: str +FOLDERID_Videos: str +FOLDERID_Ringtones: str +FOLDERID_PublicPictures: str +FOLDERID_PublicMusic: str +FOLDERID_PublicVideos: str +FOLDERID_PublicRingtones: str +FOLDERID_ResourceDir: str +FOLDERID_LocalizedResourcesDir: str +FOLDERID_CommonOEMLinks: str +FOLDERID_CDBurning: str +FOLDERID_UserProfiles: str +FOLDERID_Playlists: str +FOLDERID_SamplePlaylists: str +FOLDERID_SampleMusic: str +FOLDERID_SamplePictures: str +FOLDERID_SampleVideos: str +FOLDERID_PhotoAlbums: str +FOLDERID_Public: str +FOLDERID_ChangeRemovePrograms: str +FOLDERID_AppUpdates: str +FOLDERID_AddNewPrograms: str +FOLDERID_Downloads: str +FOLDERID_PublicDownloads: str +FOLDERID_SavedSearches: str +FOLDERID_QuickLaunch: str +FOLDERID_Contacts: str +FOLDERID_SidebarParts: str +FOLDERID_SidebarDefaultParts: str +FOLDERID_PublicGameTasks: str +FOLDERID_GameTasks: str +FOLDERID_SavedGames: str +FOLDERID_Games: str +FOLDERID_SEARCH_MAPI: str +FOLDERID_SEARCH_CSC: str +FOLDERID_Links: str +FOLDERID_UsersFiles: str +FOLDERID_UsersLibraries: str +FOLDERID_SearchHome: str +FOLDERID_OriginalImages: str +FOLDERID_DocumentsLibrary: str +FOLDERID_MusicLibrary: str +FOLDERID_PicturesLibrary: str +FOLDERID_VideosLibrary: str +FOLDERID_RecordedTVLibrary: str +FOLDERID_HomeGroup: str +FOLDERID_HomeGroupCurrentUser: str +FOLDERID_DeviceMetadataStore: str +FOLDERID_Libraries: str +FOLDERID_PublicLibraries: str +FOLDERID_UserPinned: str +FOLDERID_ImplicitAppShortcuts: str +FOLDERID_AccountPictures: str +FOLDERID_PublicUserTiles: str +FOLDERID_AppsFolder: str +FOLDERID_StartMenuAllPrograms: str +FOLDERID_CommonStartMenuPlaces: str +FOLDERID_ApplicationShortcuts: str +FOLDERID_RoamingTiles: str +FOLDERID_RoamedTileImages: str +FOLDERID_Screenshots: str +FOLDERID_CameraRoll: str +FOLDERID_SkyDrive: str +FOLDERID_OneDrive: str +FOLDERID_SkyDriveDocuments: str +FOLDERID_SkyDrivePictures: str +FOLDERID_SkyDriveMusic: str +FOLDERID_SkyDriveCameraRoll: str +FOLDERID_SearchHistory: str +FOLDERID_SearchTemplates: str +FOLDERID_CameraRollLibrary: str +FOLDERID_SavedPictures: str +FOLDERID_SavedPicturesLibrary: str +FOLDERID_RetailDemo: str +FOLDERID_Device: str +FOLDERID_DevelopmentFiles: str +FOLDERID_Objects3D: str +FOLDERID_AppCaptures: str +FOLDERID_LocalDocuments: str +FOLDERID_LocalPictures: str +FOLDERID_LocalVideos: str +FOLDERID_LocalMusic: str +FOLDERID_LocalDownloads: str +FOLDERID_RecordedCalls: str +KF_FLAG_DEFAULT: int +KF_FLAG_FORCE_APP_DATA_REDIRECTION: int +KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET: int +KF_FLAG_FORCE_PACKAGE_REDIRECTION: int +KF_FLAG_NO_PACKAGE_REDIRECTION: int +KF_FLAG_FORCE_APPCONTAINER_REDIRECTION: int +KF_FLAG_NO_APPCONTAINER_REDIRECTION: int +KF_FLAG_ALIAS_ONLY: int diff --git a/stubs/pywin32/win32comext/taskscheduler/__init__.pyi b/stubs/pywin32/win32comext/taskscheduler/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/pywin32/win32comext/taskscheduler/taskscheduler.pyi b/stubs/pywin32/win32comext/taskscheduler/taskscheduler.pyi new file mode 100644 index 0000000..b37d722 --- /dev/null +++ b/stubs/pywin32/win32comext/taskscheduler/taskscheduler.pyi @@ -0,0 +1,83 @@ +import _win32typing + +CLSID_CTask: _win32typing.PyIID +CLSID_CTaskScheduler: _win32typing.PyIID +HIGH_PRIORITY_CLASS: int +IDLE_PRIORITY_CLASS: int +IID_IProvideTaskPage: _win32typing.PyIID +IID_IScheduledWorkItem: _win32typing.PyIID +IID_ITask: _win32typing.PyIID +IID_ITaskScheduler: _win32typing.PyIID +IID_ITaskTrigger: _win32typing.PyIID +NORMAL_PRIORITY_CLASS: int +REALTIME_PRIORITY_CLASS: int +SCHED_E_ACCOUNT_DBASE_CORRUPT: int +SCHED_E_ACCOUNT_INFORMATION_NOT_SET: int +SCHED_E_ACCOUNT_NAME_NOT_FOUND: int +SCHED_E_CANNOT_OPEN_TASK: int +SCHED_E_INVALID_TASK: int +SCHED_E_SERVICE_NOT_INSTALLED: int +SCHED_E_TASK_NOT_READY: int +SCHED_E_TASK_NOT_RUNNING: int +SCHED_E_TRIGGER_NOT_FOUND: int +SCHED_E_UNKNOWN_OBJECT_VERSION: int +SCHED_S_EVENT_TRIGGER: int +SCHED_S_TASK_DISABLED: int +SCHED_S_TASK_HAS_NOT_RUN: int +SCHED_S_TASK_NOT_SCHEDULED: int +SCHED_S_TASK_NO_MORE_RUNS: int +SCHED_S_TASK_NO_VALID_TRIGGERS: int +SCHED_S_TASK_READY: int +SCHED_S_TASK_RUNNING: int +SCHED_S_TASK_TERMINATED: int +TASKPAGE_SCHEDULE: int +TASKPAGE_SETTINGS: int +TASKPAGE_TASK: int +TASK_APRIL: int +TASK_AUGUST: int +TASK_DECEMBER: int +TASK_EVENT_TRIGGER_AT_LOGON: int +TASK_EVENT_TRIGGER_AT_SYSTEMSTART: int +TASK_EVENT_TRIGGER_ON_IDLE: int +TASK_FEBRUARY: int +TASK_FIRST_WEEK: int +TASK_FLAG_DELETE_WHEN_DONE: int +TASK_FLAG_DISABLED: int +TASK_FLAG_DONT_START_IF_ON_BATTERIES: int +TASK_FLAG_HIDDEN: int +TASK_FLAG_INTERACTIVE: int +TASK_FLAG_KILL_IF_GOING_ON_BATTERIES: int +TASK_FLAG_KILL_ON_IDLE_END: int +TASK_FLAG_RESTART_ON_IDLE_RESUME: int +TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET: int +TASK_FLAG_RUN_ONLY_IF_DOCKED: int +TASK_FLAG_RUN_ONLY_IF_LOGGED_ON: int +TASK_FLAG_START_ONLY_IF_IDLE: int +TASK_FLAG_SYSTEM_REQUIRED: int +TASK_FOURTH_WEEK: int +TASK_FRIDAY: int +TASK_JANUARY: int +TASK_JULY: int +TASK_JUNE: int +TASK_LAST_WEEK: int +TASK_MARCH: int +TASK_MAY: int +TASK_MONDAY: int +TASK_NOVEMBER: int +TASK_OCTOBER: int +TASK_SATURDAY: int +TASK_SECOND_WEEK: int +TASK_SEPTEMBER: int +TASK_SUNDAY: int +TASK_THIRD_WEEK: int +TASK_THURSDAY: int +TASK_TIME_TRIGGER_DAILY: int +TASK_TIME_TRIGGER_MONTHLYDATE: int +TASK_TIME_TRIGGER_MONTHLYDOW: int +TASK_TIME_TRIGGER_ONCE: int +TASK_TIME_TRIGGER_WEEKLY: int +TASK_TRIGGER_FLAG_DISABLED: int +TASK_TRIGGER_FLAG_HAS_END_DATE: int +TASK_TRIGGER_FLAG_KILL_AT_DURATION_END: int +TASK_TUESDAY: int +TASK_WEDNESDAY: int diff --git a/stubs/pywin32/win32con.pyi b/stubs/pywin32/win32con.pyi new file mode 100644 index 0000000..54cfd26 --- /dev/null +++ b/stubs/pywin32/win32con.pyi @@ -0,0 +1 @@ +from win32.lib.win32con import * diff --git a/stubs/pywin32/win32console.pyi b/stubs/pywin32/win32console.pyi new file mode 100644 index 0000000..f8539ed --- /dev/null +++ b/stubs/pywin32/win32console.pyi @@ -0,0 +1 @@ +from win32.win32console import * diff --git a/stubs/pywin32/win32cred.pyi b/stubs/pywin32/win32cred.pyi new file mode 100644 index 0000000..6cb3e26 --- /dev/null +++ b/stubs/pywin32/win32cred.pyi @@ -0,0 +1 @@ +from win32.win32cred import * diff --git a/stubs/pywin32/win32crypt.pyi b/stubs/pywin32/win32crypt.pyi new file mode 100644 index 0000000..223df5e --- /dev/null +++ b/stubs/pywin32/win32crypt.pyi @@ -0,0 +1 @@ +from win32.win32crypt import * diff --git a/stubs/pywin32/win32cryptcon.pyi b/stubs/pywin32/win32cryptcon.pyi new file mode 100644 index 0000000..6df8b44 --- /dev/null +++ b/stubs/pywin32/win32cryptcon.pyi @@ -0,0 +1 @@ +from win32.lib.win32cryptcon import * diff --git a/stubs/pywin32/win32event.pyi b/stubs/pywin32/win32event.pyi new file mode 100644 index 0000000..53191d4 --- /dev/null +++ b/stubs/pywin32/win32event.pyi @@ -0,0 +1 @@ +from win32.win32event import * diff --git a/stubs/pywin32/win32evtlog.pyi b/stubs/pywin32/win32evtlog.pyi new file mode 100644 index 0000000..7c7ffe5 --- /dev/null +++ b/stubs/pywin32/win32evtlog.pyi @@ -0,0 +1 @@ +from win32.win32evtlog import * diff --git a/stubs/pywin32/win32evtlogutil.pyi b/stubs/pywin32/win32evtlogutil.pyi new file mode 100644 index 0000000..c37e5dd --- /dev/null +++ b/stubs/pywin32/win32evtlogutil.pyi @@ -0,0 +1 @@ +from win32.lib.win32evtlogutil import * diff --git a/stubs/pywin32/win32file.pyi b/stubs/pywin32/win32file.pyi new file mode 100644 index 0000000..3a703a9 --- /dev/null +++ b/stubs/pywin32/win32file.pyi @@ -0,0 +1 @@ +from win32.win32file import * diff --git a/stubs/pywin32/win32gui.pyi b/stubs/pywin32/win32gui.pyi new file mode 100644 index 0000000..3b2b41a --- /dev/null +++ b/stubs/pywin32/win32gui.pyi @@ -0,0 +1 @@ +from win32.win32gui import * diff --git a/stubs/pywin32/win32gui_struct.pyi b/stubs/pywin32/win32gui_struct.pyi new file mode 100644 index 0000000..3c7cd0a --- /dev/null +++ b/stubs/pywin32/win32gui_struct.pyi @@ -0,0 +1 @@ +from win32.lib.win32gui_struct import * diff --git a/stubs/pywin32/win32help.pyi b/stubs/pywin32/win32help.pyi new file mode 100644 index 0000000..bd6fce5 --- /dev/null +++ b/stubs/pywin32/win32help.pyi @@ -0,0 +1 @@ +from win32.win32help import * diff --git a/stubs/pywin32/win32inet.pyi b/stubs/pywin32/win32inet.pyi new file mode 100644 index 0000000..98e6e47 --- /dev/null +++ b/stubs/pywin32/win32inet.pyi @@ -0,0 +1 @@ +from win32.win32inet import * diff --git a/stubs/pywin32/win32inetcon.pyi b/stubs/pywin32/win32inetcon.pyi new file mode 100644 index 0000000..db893b6 --- /dev/null +++ b/stubs/pywin32/win32inetcon.pyi @@ -0,0 +1 @@ +from win32.lib.win32inetcon import * diff --git a/stubs/pywin32/win32job.pyi b/stubs/pywin32/win32job.pyi new file mode 100644 index 0000000..9c8f789 --- /dev/null +++ b/stubs/pywin32/win32job.pyi @@ -0,0 +1 @@ +from win32.win32job import * diff --git a/stubs/pywin32/win32lz.pyi b/stubs/pywin32/win32lz.pyi new file mode 100644 index 0000000..6428109 --- /dev/null +++ b/stubs/pywin32/win32lz.pyi @@ -0,0 +1 @@ +from win32.win32lz import * diff --git a/stubs/pywin32/win32net.pyi b/stubs/pywin32/win32net.pyi new file mode 100644 index 0000000..f318e55 --- /dev/null +++ b/stubs/pywin32/win32net.pyi @@ -0,0 +1 @@ +from win32.win32net import * diff --git a/stubs/pywin32/win32netcon.pyi b/stubs/pywin32/win32netcon.pyi new file mode 100644 index 0000000..f86b2ef --- /dev/null +++ b/stubs/pywin32/win32netcon.pyi @@ -0,0 +1 @@ +from win32.lib.win32netcon import * diff --git a/stubs/pywin32/win32pdh.pyi b/stubs/pywin32/win32pdh.pyi new file mode 100644 index 0000000..739ad21 --- /dev/null +++ b/stubs/pywin32/win32pdh.pyi @@ -0,0 +1 @@ +from win32.win32pdh import * diff --git a/stubs/pywin32/win32pdhquery.pyi b/stubs/pywin32/win32pdhquery.pyi new file mode 100644 index 0000000..2d0976f --- /dev/null +++ b/stubs/pywin32/win32pdhquery.pyi @@ -0,0 +1 @@ +from win32.lib.win32pdhquery import * diff --git a/stubs/pywin32/win32pipe.pyi b/stubs/pywin32/win32pipe.pyi new file mode 100644 index 0000000..bf607d6 --- /dev/null +++ b/stubs/pywin32/win32pipe.pyi @@ -0,0 +1 @@ +from win32.win32pipe import * diff --git a/stubs/pywin32/win32print.pyi b/stubs/pywin32/win32print.pyi new file mode 100644 index 0000000..ad25150 --- /dev/null +++ b/stubs/pywin32/win32print.pyi @@ -0,0 +1 @@ +from win32.win32print import * diff --git a/stubs/pywin32/win32process.pyi b/stubs/pywin32/win32process.pyi new file mode 100644 index 0000000..86b050b --- /dev/null +++ b/stubs/pywin32/win32process.pyi @@ -0,0 +1 @@ +from win32.win32process import * diff --git a/stubs/pywin32/win32profile.pyi b/stubs/pywin32/win32profile.pyi new file mode 100644 index 0000000..b89eef1 --- /dev/null +++ b/stubs/pywin32/win32profile.pyi @@ -0,0 +1 @@ +from win32.win32profile import * diff --git a/stubs/pywin32/win32ras.pyi b/stubs/pywin32/win32ras.pyi new file mode 100644 index 0000000..455d276 --- /dev/null +++ b/stubs/pywin32/win32ras.pyi @@ -0,0 +1 @@ +from win32.win32ras import * diff --git a/stubs/pywin32/win32security.pyi b/stubs/pywin32/win32security.pyi new file mode 100644 index 0000000..bc0b8d2 --- /dev/null +++ b/stubs/pywin32/win32security.pyi @@ -0,0 +1 @@ +from win32.win32security import * diff --git a/stubs/pywin32/win32service.pyi b/stubs/pywin32/win32service.pyi new file mode 100644 index 0000000..b98158e --- /dev/null +++ b/stubs/pywin32/win32service.pyi @@ -0,0 +1 @@ +from win32.win32service import * diff --git a/stubs/pywin32/win32timezone.pyi b/stubs/pywin32/win32timezone.pyi new file mode 100644 index 0000000..bd22d67 --- /dev/null +++ b/stubs/pywin32/win32timezone.pyi @@ -0,0 +1 @@ +from win32.lib.win32timezone import * diff --git a/stubs/pywin32/win32trace.pyi b/stubs/pywin32/win32trace.pyi new file mode 100644 index 0000000..3ece629 --- /dev/null +++ b/stubs/pywin32/win32trace.pyi @@ -0,0 +1 @@ +from win32.win32trace import * diff --git a/stubs/pywin32/win32transaction.pyi b/stubs/pywin32/win32transaction.pyi new file mode 100644 index 0000000..bd529b0 --- /dev/null +++ b/stubs/pywin32/win32transaction.pyi @@ -0,0 +1 @@ +from win32.win32transaction import * diff --git a/stubs/pywin32/win32ts.pyi b/stubs/pywin32/win32ts.pyi new file mode 100644 index 0000000..dd0d8a2 --- /dev/null +++ b/stubs/pywin32/win32ts.pyi @@ -0,0 +1 @@ +from win32.win32ts import * diff --git a/stubs/pywin32/win32ui.pyi b/stubs/pywin32/win32ui.pyi new file mode 100644 index 0000000..49ea5db --- /dev/null +++ b/stubs/pywin32/win32ui.pyi @@ -0,0 +1 @@ +from pythonwin.win32ui import * diff --git a/stubs/pywin32/win32uiole.pyi b/stubs/pywin32/win32uiole.pyi new file mode 100644 index 0000000..b0ae818 --- /dev/null +++ b/stubs/pywin32/win32uiole.pyi @@ -0,0 +1 @@ +from pythonwin.win32uiole import * diff --git a/stubs/pywin32/win32wnet.pyi b/stubs/pywin32/win32wnet.pyi new file mode 100644 index 0000000..67facc0 --- /dev/null +++ b/stubs/pywin32/win32wnet.pyi @@ -0,0 +1 @@ +from win32.win32wnet import * diff --git a/stubs/pywin32/winerror.pyi b/stubs/pywin32/winerror.pyi new file mode 100644 index 0000000..d0bdce6 --- /dev/null +++ b/stubs/pywin32/winerror.pyi @@ -0,0 +1 @@ +from win32.lib.winerror import * diff --git a/stubs/pywin32/winioctlcon.pyi b/stubs/pywin32/winioctlcon.pyi new file mode 100644 index 0000000..6e51730 --- /dev/null +++ b/stubs/pywin32/winioctlcon.pyi @@ -0,0 +1 @@ +from win32.lib.winioctlcon import * diff --git a/stubs/pywin32/winnt.pyi b/stubs/pywin32/winnt.pyi new file mode 100644 index 0000000..8bbdea5 --- /dev/null +++ b/stubs/pywin32/winnt.pyi @@ -0,0 +1 @@ +from win32.lib.winnt import * diff --git a/stubs/pywin32/winperf.pyi b/stubs/pywin32/winperf.pyi new file mode 100644 index 0000000..d3138f4 --- /dev/null +++ b/stubs/pywin32/winperf.pyi @@ -0,0 +1 @@ +from win32.lib.winperf import * diff --git a/stubs/pywin32/winxpgui.pyi b/stubs/pywin32/winxpgui.pyi new file mode 100644 index 0000000..9a8e623 --- /dev/null +++ b/stubs/pywin32/winxpgui.pyi @@ -0,0 +1 @@ +from win32.winxpgui import * diff --git a/stubs/pywin32/winxptheme.pyi b/stubs/pywin32/winxptheme.pyi new file mode 100644 index 0000000..e4b09f6 --- /dev/null +++ b/stubs/pywin32/winxptheme.pyi @@ -0,0 +1 @@ +from win32.lib.winxptheme import * diff --git a/stubs/redis/@tests/stubtest_allowlist.txt b/stubs/redis/@tests/stubtest_allowlist.txt index 65805b4..fab69ce 100644 --- a/stubs/redis/@tests/stubtest_allowlist.txt +++ b/stubs/redis/@tests/stubtest_allowlist.txt @@ -1,44 +1,18 @@ -redis.client.Pipeline.acl_setuser -redis.client.Pipeline.client_list -redis.client.Pipeline.flushall -redis.client.Pipeline.flushdb -redis.client.Pipeline.hscan -redis.client.Pipeline.pubsub -redis.client.Pipeline.scan -redis.client.Pipeline.scan_iter -redis.client.Pipeline.shutdown -redis.client.Pipeline.sscan -redis.client.Pipeline.transaction -redis.client.Pipeline.zinterstore -redis.client.Pipeline.zrevrange -redis.client.Pipeline.zrevrangebylex -redis.client.Pipeline.zrevrangebyscore -redis.client.Pipeline.zunionstore -redis.client.PubSub.encode -redis.client.PubSub.execute_command -redis.client.PubSub.parse_response -redis.client.PubSub.run_in_thread -redis.client.Redis.acl_setuser -redis.client.Redis.client_list -redis.client.Redis.flushall -redis.client.Redis.flushdb -redis.client.Redis.from_url -redis.client.Redis.hscan -redis.client.Redis.pubsub -redis.client.Redis.scan -redis.client.Redis.scan_iter -redis.client.Redis.shutdown -redis.client.Redis.sscan -redis.client.Redis.zinterstore -redis.client.Redis.zrevrange -redis.client.Redis.zrevrangebylex -redis.client.Redis.zrevrangebyscore -redis.client.Redis.zunionstore -redis.client.pairs_to_dict -redis.connection.HIREDIS_SUPPORTS_BYTE_BUFFER -redis.connection.HIREDIS_SUPPORTS_CALLABLE_ERRORS -redis.connection.HIREDIS_USE_BYTE_BUFFER -redis.connection.hiredis_version -redis.connection.msg -redis.utils.safe_str -redis.utils.str_if_bytes +redis.client.Pipeline.transaction # instance attribute has same name as superclass method +redis.ocsp # requires cryptography to be installed + +# async def mismatch problems +redis.asyncio.client.Pipeline.command_info +redis.asyncio.client.Pipeline.debug_segfault +redis.asyncio.client.Pipeline.memory_doctor +redis.asyncio.client.Pipeline.memory_help +redis.asyncio.client.Pipeline.script_debug +redis.asyncio.client.Pipeline.shutdown + +# unclear problems +redis.asyncio.Sentinel.master_for +redis.asyncio.Sentinel.slave_for +redis.asyncio.sentinel.Sentinel.master_for +redis.asyncio.sentinel.Sentinel.slave_for +redis.sentinel.Sentinel.master_for +redis.sentinel.Sentinel.slave_for diff --git a/stubs/redis/METADATA.toml b/stubs/redis/METADATA.toml index ec34fb2..a51d6ed 100644 --- a/stubs/redis/METADATA.toml +++ b/stubs/redis/METADATA.toml @@ -1,3 +1 @@ -version = "3.5" -python2 = true -requires = [] +version = "4.3.*" diff --git a/stubs/redis/redis/__init__.pyi b/stubs/redis/redis/__init__.pyi index 07191af..89f0cf2 100644 --- a/stubs/redis/redis/__init__.pyi +++ b/stubs/redis/redis/__init__.pyi @@ -1,15 +1,55 @@ -from . import client, connection, exceptions, utils +from . import client, connection, exceptions, sentinel, utils +from .cluster import RedisCluster as RedisCluster + +__all__ = [ + "AuthenticationError", + "AuthenticationWrongNumberOfArgsError", + "BlockingConnectionPool", + "BusyLoadingError", + "ChildDeadlockedError", + "Connection", + "ConnectionError", + "ConnectionPool", + "DataError", + "from_url", + "InvalidResponse", + "PubSubError", + "ReadOnlyError", + "Redis", + "RedisCluster", + "RedisError", + "ResponseError", + "Sentinel", + "SentinelConnectionPool", + "SentinelManagedConnection", + "SentinelManagedSSLConnection", + "SSLConnection", + "StrictRedis", + "TimeoutError", + "UnixDomainSocketConnection", + "WatchError", +] Redis = client.Redis -StrictRedis = client.StrictRedis + BlockingConnectionPool = connection.BlockingConnectionPool -ConnectionPool = connection.ConnectionPool Connection = connection.Connection +ConnectionPool = connection.ConnectionPool SSLConnection = connection.SSLConnection +StrictRedis = client.StrictRedis UnixDomainSocketConnection = connection.UnixDomainSocketConnection + from_url = utils.from_url + +Sentinel = sentinel.Sentinel +SentinelConnectionPool = sentinel.SentinelConnectionPool +SentinelManagedConnection = sentinel.SentinelManagedConnection +SentinelManagedSSLConnection = sentinel.SentinelManagedSSLConnection + AuthenticationError = exceptions.AuthenticationError +AuthenticationWrongNumberOfArgsError = exceptions.AuthenticationWrongNumberOfArgsError BusyLoadingError = exceptions.BusyLoadingError +ChildDeadlockedError = exceptions.ChildDeadlockedError ConnectionError = exceptions.ConnectionError DataError = exceptions.DataError InvalidResponse = exceptions.InvalidResponse @@ -19,3 +59,6 @@ RedisError = exceptions.RedisError ResponseError = exceptions.ResponseError TimeoutError = exceptions.TimeoutError WatchError = exceptions.WatchError + +__version__: str +VERSION: tuple[int | str, ...] diff --git a/stubs/redis/redis/asyncio/__init__.pyi b/stubs/redis/redis/asyncio/__init__.pyi new file mode 100644 index 0000000..22c85ec --- /dev/null +++ b/stubs/redis/redis/asyncio/__init__.pyi @@ -0,0 +1,58 @@ +from redis.asyncio.client import Redis as Redis, StrictRedis as StrictRedis +from redis.asyncio.connection import ( + BlockingConnectionPool as BlockingConnectionPool, + Connection as Connection, + ConnectionPool as ConnectionPool, + SSLConnection as SSLConnection, + UnixDomainSocketConnection as UnixDomainSocketConnection, +) +from redis.asyncio.sentinel import ( + Sentinel as Sentinel, + SentinelConnectionPool as SentinelConnectionPool, + SentinelManagedConnection as SentinelManagedConnection, + SentinelManagedSSLConnection as SentinelManagedSSLConnection, +) +from redis.asyncio.utils import from_url as from_url +from redis.exceptions import ( + AuthenticationError as AuthenticationError, + AuthenticationWrongNumberOfArgsError as AuthenticationWrongNumberOfArgsError, + BusyLoadingError as BusyLoadingError, + ChildDeadlockedError as ChildDeadlockedError, + ConnectionError as ConnectionError, + DataError as DataError, + InvalidResponse as InvalidResponse, + PubSubError as PubSubError, + ReadOnlyError as ReadOnlyError, + RedisError as RedisError, + ResponseError as ResponseError, + TimeoutError as TimeoutError, + WatchError as WatchError, +) + +__all__ = [ + "AuthenticationError", + "AuthenticationWrongNumberOfArgsError", + "BlockingConnectionPool", + "BusyLoadingError", + "ChildDeadlockedError", + "Connection", + "ConnectionError", + "ConnectionPool", + "DataError", + "from_url", + "InvalidResponse", + "PubSubError", + "ReadOnlyError", + "Redis", + "RedisError", + "ResponseError", + "Sentinel", + "SentinelConnectionPool", + "SentinelManagedConnection", + "SentinelManagedSSLConnection", + "SSLConnection", + "StrictRedis", + "TimeoutError", + "UnixDomainSocketConnection", + "WatchError", +] diff --git a/stubs/redis/redis/asyncio/client.pyi b/stubs/redis/redis/asyncio/client.pyi new file mode 100644 index 0000000..3aa9d0b --- /dev/null +++ b/stubs/redis/redis/asyncio/client.pyi @@ -0,0 +1,945 @@ +from _typeshed import Incomplete, Self +from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Mapping, MutableMapping, Sequence +from datetime import datetime, timedelta +from typing import Any, ClassVar, Generic, NoReturn, Protocol, overload +from typing_extensions import Literal, TypeAlias, TypedDict + +from redis import RedisError +from redis.asyncio.connection import ConnectCallbackT, Connection, ConnectionPool +from redis.asyncio.lock import Lock +from redis.asyncio.retry import Retry +from redis.client import AbstractRedis, _CommandOptions, _Key, _StrType, _Value +from redis.commands import AsyncCoreCommands, AsyncSentinelCommands, RedisModuleCommands +from redis.typing import ChannelT, EncodableT, KeyT, PatternT + +PubSubHandler: TypeAlias = Callable[[dict[str, str]], Awaitable[None]] + +class ResponseCallbackProtocol(Protocol): + def __call__(self, response: Any, **kwargs): ... + +class AsyncResponseCallbackProtocol(Protocol): + async def __call__(self, response: Any, **kwargs): ... + +ResponseCallbackT: TypeAlias = ResponseCallbackProtocol | AsyncResponseCallbackProtocol + +class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], AsyncSentinelCommands, Generic[_StrType]): + response_callbacks: MutableMapping[str | bytes, ResponseCallbackT] + auto_close_connection_pool: bool + connection_pool: Any + single_connection_client: Any + connection: Any + @classmethod + def from_url(cls, url: str, **kwargs) -> Redis[Any]: ... + def __init__( + self, + *, + host: str = ..., + port: int = ..., + db: str | int = ..., + password: str | None = ..., + socket_timeout: float | None = ..., + socket_connect_timeout: float | None = ..., + socket_keepalive: bool | None = ..., + socket_keepalive_options: Mapping[int, int | bytes] | None = ..., + connection_pool: ConnectionPool | None = ..., + unix_socket_path: str | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + decode_responses: bool = ..., + retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | None = ..., + ssl: bool = ..., + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., + ssl_cert_reqs: str = ..., + ssl_ca_certs: str | None = ..., + ssl_ca_data: str | None = ..., + ssl_check_hostname: bool = ..., + max_connections: int | None = ..., + single_connection_client: bool = ..., + health_check_interval: int = ..., + client_name: str | None = ..., + username: str | None = ..., + retry: Retry | None = ..., + auto_close_connection_pool: bool = ..., + redis_connect_func: ConnectCallbackT | None = ..., + ) -> None: ... + def __await__(self): ... + async def initialize(self: Self) -> Self: ... + def set_response_callback(self, command: str, callback: ResponseCallbackT): ... + def load_external_module(self, funcname, func) -> None: ... + def pipeline(self, transaction: bool = ..., shard_hint: str | None = ...) -> Pipeline[_StrType]: ... + async def transaction( + self, + func: Callable[[Pipeline[_StrType]], Any | Awaitable[Any]], + *watches: KeyT, + shard_hint: str | None = ..., + value_from_callable: bool = ..., + watch_delay: float | None = ..., + ): ... + def lock( + self, + name: KeyT, + timeout: float | None = ..., + sleep: float = ..., + blocking_timeout: float | None = ..., + lock_class: type[Lock] | None = ..., + thread_local: bool = ..., + ) -> Lock: ... + def pubsub(self, **kwargs) -> PubSub: ... + def monitor(self) -> Monitor: ... + def client(self) -> Redis[_StrType]: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__(self, exc_type, exc_value, traceback) -> None: ... + def __del__(self, _warnings: Any = ...) -> None: ... + async def close(self, close_connection_pool: bool | None = ...) -> None: ... + async def execute_command(self, *args, **options): ... + async def parse_response(self, connection: Connection, command_name: str | bytes, **options): ... + +StrictRedis = Redis + +class MonitorCommandInfo(TypedDict): + time: float + db: int + client_address: str + client_port: str + client_type: str + command: str + +class Monitor: + monitor_re: Any + command_re: Any + connection_pool: Any + connection: Any + def __init__(self, connection_pool: ConnectionPool) -> None: ... + async def connect(self) -> None: ... + async def __aenter__(self): ... + async def __aexit__(self, *args) -> None: ... + async def next_command(self) -> MonitorCommandInfo: ... + def listen(self) -> AsyncIterator[MonitorCommandInfo]: ... + +class PubSub: + PUBLISH_MESSAGE_TYPES: ClassVar[tuple[str, ...]] + UNSUBSCRIBE_MESSAGE_TYPES: ClassVar[tuple[str, ...]] + HEALTH_CHECK_MESSAGE: ClassVar[str] + connection_pool: Any + shard_hint: str | None + ignore_subscribe_messages: bool + connection: Any + encoder: Any + health_check_response: Iterable[str | bytes] + channels: Any + pending_unsubscribe_channels: Any + patterns: Any + pending_unsubscribe_patterns: Any + def __init__( + self, + connection_pool: ConnectionPool, + shard_hint: str | None = ..., + ignore_subscribe_messages: bool = ..., + encoder: Any | None = ..., + ) -> None: ... + async def __aenter__(self): ... + async def __aexit__(self, exc_type, exc_value, traceback) -> None: ... + def __del__(self) -> None: ... + async def reset(self) -> None: ... + def close(self) -> Awaitable[NoReturn]: ... + async def on_connect(self, connection: Connection): ... + @property + def subscribed(self) -> bool: ... + async def execute_command(self, *args: EncodableT): ... + async def parse_response(self, block: bool = ..., timeout: float = ...): ... + async def check_health(self) -> None: ... + async def psubscribe(self, *args: ChannelT, **kwargs: PubSubHandler): ... + def punsubscribe(self, *args: ChannelT) -> Awaitable[Any]: ... + async def subscribe(self, *args: ChannelT, **kwargs: Callable[..., Any]): ... + def unsubscribe(self, *args) -> Awaitable[Any]: ... + def listen(self) -> AsyncIterator[Any]: ... + async def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...): ... + def ping(self, message: Any | None = ...) -> Awaitable[Any]: ... + async def handle_message(self, response, ignore_subscribe_messages: bool = ...): ... + async def run(self, *, exception_handler: PSWorkerThreadExcHandlerT | None = ..., poll_timeout: float = ...) -> None: ... + +class PubsubWorkerExceptionHandler(Protocol): + def __call__(self, e: BaseException, pubsub: PubSub): ... + +class AsyncPubsubWorkerExceptionHandler(Protocol): + async def __call__(self, e: BaseException, pubsub: PubSub): ... + +PSWorkerThreadExcHandlerT: TypeAlias = PubsubWorkerExceptionHandler | AsyncPubsubWorkerExceptionHandler +CommandT: TypeAlias = tuple[tuple[str | bytes, ...], Mapping[str, Any]] +CommandStackT: TypeAlias = list[CommandT] + +class Pipeline(Redis[_StrType], Generic[_StrType]): + UNWATCH_COMMANDS: ClassVar[set[str]] + connection_pool: Any + connection: Any + response_callbacks: Any + is_transaction: bool + shard_hint: str | None + watching: bool + command_stack: Any + scripts: Any + explicit_transaction: bool + def __init__( + self, + connection_pool: ConnectionPool, + response_callbacks: MutableMapping[str | bytes, ResponseCallbackT], + transaction: bool, + shard_hint: str | None, + ) -> None: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__(self, exc_type, exc_value, traceback) -> None: ... + def __await__(self): ... + def __len__(self) -> int: ... + def __bool__(self) -> bool: ... + async def reset(self) -> None: ... # type: ignore[override] + def multi(self) -> None: ... + def execute_command(self, *args, **kwargs) -> Pipeline[_StrType] | Awaitable[Pipeline[_StrType]]: ... + async def immediate_execute_command(self, *args, **options): ... + def pipeline_execute_command(self, *args, **options): ... + def raise_first_error(self, commands: CommandStackT, response: Iterable[Any]): ... + def annotate_exception(self, exception: Exception, number: int, command: Iterable[object]) -> None: ... + async def parse_response(self, connection: Connection, command_name: str | bytes, **options): ... + async def load_scripts(self) -> None: ... + async def execute(self, raise_on_error: bool = ...): ... + async def discard(self) -> None: ... + async def watch(self, *names: KeyT) -> bool: ... + async def unwatch(self) -> bool: ... + # region acl commands + def acl_cat(self, category: str | None = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_genpass(self, bits: int | None = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_help(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_list(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_log(self, count: int | None = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_log_reset(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_load(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_save(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_setuser( # type: ignore[override] + self, + username: str, + enabled: bool = ..., + nopass: bool = ..., + passwords: Sequence[str] | None = ..., + hashed_passwords: Sequence[str] | None = ..., + categories: Sequence[str] | None = ..., + commands: Sequence[str] | None = ..., + keys: Sequence[str] | None = ..., + channels: Iterable[ChannelT] | None = ..., + selectors: Iterable[tuple[str, KeyT]] | None = ..., + reset: bool = ..., + reset_keys: bool = ..., + reset_passwords: bool = ..., + **kwargs: _CommandOptions, + ) -> Pipeline[_StrType]: ... + def acl_users(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def acl_whoami(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + # endregion + # region cluster commands + def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def readwrite(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def readonly(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + # endregion + # region BasicKey commands + def append(self, key, value) -> Any: ... # type: ignore[override] + def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> Any: ... # type: ignore[override] + def bitfield(self, key, default_overflow: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def bitop(self, operation, dest, *keys) -> Any: ... # type: ignore[override] + def bitpos(self, key: _Key, bit: int, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> Any: ... # type: ignore[override] + def copy(self, source, destination, destination_db: Incomplete | None = ..., replace: bool = ...) -> Any: ... # type: ignore[override] + def decr(self, name, amount: int = ...) -> Any: ... # type: ignore[override] + def decrby(self, name, amount: int = ...) -> Any: ... # type: ignore[override] + def delete(self, *names: _Key) -> Any: ... # type: ignore[override] + def dump(self, name: _Key) -> Any: ... # type: ignore[override] + def exists(self, *names: _Key) -> Any: ... # type: ignore[override] + def expire( # type: ignore[override] + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Any: ... + def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Any: ... # type: ignore[override] + def get(self, name: _Key) -> Any: ... # type: ignore[override] + def getdel(self, name: _Key) -> Any: ... # type: ignore[override] + def getex( # type: ignore[override] + self, + name, + ex: Incomplete | None = ..., + px: Incomplete | None = ..., + exat: Incomplete | None = ..., + pxat: Incomplete | None = ..., + persist: bool = ..., + ) -> Any: ... + def getbit(self, name: _Key, offset: int) -> Any: ... # type: ignore[override] + def getrange(self, key, start, end) -> Any: ... # type: ignore[override] + def getset(self, name, value) -> Any: ... # type: ignore[override] + def incr(self, name: _Key, amount: int = ...) -> Any: ... # type: ignore[override] + def incrby(self, name: _Key, amount: int = ...) -> Any: ... # type: ignore[override] + def incrbyfloat(self, name: _Key, amount: float = ...) -> Any: ... # type: ignore[override] + def keys(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def lmove( # type: ignore[override] + self, first_list: _Key, second_list: _Key, src: Literal["LEFT", "RIGHT"] = ..., dest: Literal["LEFT", "RIGHT"] = ... + ) -> Any: ... + def blmove( # type: ignore[override] + self, + first_list: _Key, + second_list: _Key, + timeout: float, + src: Literal["LEFT", "RIGHT"] = ..., + dest: Literal["LEFT", "RIGHT"] = ..., + ) -> Any: ... + def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def mset(self, mapping: Mapping[_Key, _Value]) -> Any: ... # type: ignore[override] + def msetnx(self, mapping: Mapping[_Key, _Value]) -> Any: ... # type: ignore[override] + def move(self, name: _Key, db: int) -> Any: ... # type: ignore[override] + def persist(self, name: _Key) -> Any: ... # type: ignore[override] + def pexpire( # type: ignore[override] + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Any: ... + def pexpireat( # type: ignore[override] + self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Any: ... + def psetex(self, name, time_ms, value) -> Any: ... # type: ignore[override] + def pttl(self, name: _Key) -> Any: ... # type: ignore[override] + def hrandfield(self, key, count: Incomplete | None = ..., withvalues: bool = ...) -> Any: ... # type: ignore[override] + def randomkey(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def rename(self, src, dst) -> Any: ... # type: ignore[override] + def renamenx(self, src, dst) -> Any: ... # type: ignore[override] + def restore( # type: ignore[override] + self, + name, + ttl, + value, + replace: bool = ..., + absttl: bool = ..., + idletime: Incomplete | None = ..., + frequency: Incomplete | None = ..., + ) -> Any: ... + def set( # type: ignore[override] + self, + name: _Key, + value: _Value, + ex: None | int | timedelta = ..., + px: None | int | timedelta = ..., + nx: bool = ..., + xx: bool = ..., + keepttl: bool = ..., + get: bool = ..., + exat: Incomplete | None = ..., + pxat: Incomplete | None = ..., + ) -> Any: ... + def setbit(self, name: _Key, offset: int, value: int) -> Any: ... # type: ignore[override] + def setex(self, name: _Key, time: int | timedelta, value: _Value) -> Any: ... # type: ignore[override] + def setnx(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override] + def setrange(self, name, offset, value) -> Any: ... # type: ignore[override] + def stralgo( # type: ignore[override] + self, + algo, + value1, + value2, + specific_argument: str = ..., + len: bool = ..., + idx: bool = ..., + minmatchlen: Incomplete | None = ..., + withmatchlen: bool = ..., + **kwargs: _CommandOptions, + ) -> Any: ... + def strlen(self, name) -> Any: ... # type: ignore[override] + def substr(self, name, start, end: int = ...) -> Any: ... # type: ignore[override] + def touch(self, *args) -> Any: ... # type: ignore[override] + def ttl(self, name: _Key) -> Any: ... # type: ignore[override] + def type(self, name) -> Any: ... # type: ignore[override] + def unlink(self, *names: _Key) -> Any: ... # type: ignore[override] + # endregion + # region hyperlog commands + def pfadd(self, name: _Key, *values: _Value) -> Any: ... # type: ignore[override] + def pfcount(self, name: _Key) -> Any: ... # type: ignore[override] + def pfmerge(self, dest: _Key, *sources: _Key) -> Any: ... # type: ignore[override] + # endregion + # region hash commands + def hdel(self, name: _Key, *keys: _Key) -> Any: ... # type: ignore[override] + def hexists(self, name: _Key, key: _Key) -> Any: ... # type: ignore[override] + def hget(self, name: _Key, key: _Key) -> Any: ... # type: ignore[override] + def hgetall(self, name: _Key) -> Any: ... # type: ignore[override] + def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> Any: ... # type: ignore[override] + def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> Any: ... # type: ignore[override] + def hkeys(self, name: _Key) -> Any: ... # type: ignore[override] + def hlen(self, name: _Key) -> Any: ... # type: ignore[override] + @overload + def hset( # type: ignore[override] + self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Incomplete | None = ... + ) -> Any: ... + @overload + def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Incomplete | None = ...) -> Any: ... # type: ignore[override] + @overload + def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def hsetnx(self, name: _Key, key: _Key, value: _Value) -> Any: ... # type: ignore[override] + def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> Any: ... # type: ignore[override] + def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def hvals(self, name: _Key) -> Any: ... # type: ignore[override] + def hstrlen(self, name, key) -> Any: ... # type: ignore[override] + # endregion + # region geo commands + def geoadd(self, name, values, nx: bool = ..., xx: bool = ..., ch: bool = ...) -> Any: ... # type: ignore[override] + def geodist(self, name, place1, place2, unit: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def geohash(self, name, *values) -> Any: ... # type: ignore[override] + def geopos(self, name, *values) -> Any: ... # type: ignore[override] + def georadius( # type: ignore[override] + self, + name, + longitude, + latitude, + radius, + unit: Incomplete | None = ..., + withdist: bool = ..., + withcoord: bool = ..., + withhash: bool = ..., + count: Incomplete | None = ..., + sort: Incomplete | None = ..., + store: Incomplete | None = ..., + store_dist: Incomplete | None = ..., + any: bool = ..., + ) -> Any: ... + def georadiusbymember( # type: ignore[override] + self, + name, + member, + radius, + unit: Incomplete | None = ..., + withdist: bool = ..., + withcoord: bool = ..., + withhash: bool = ..., + count: Incomplete | None = ..., + sort: Incomplete | None = ..., + store: Incomplete | None = ..., + store_dist: Incomplete | None = ..., + any: bool = ..., + ) -> Any: ... + def geosearch( # type: ignore[override] + self, + name, + member: Incomplete | None = ..., + longitude: Incomplete | None = ..., + latitude: Incomplete | None = ..., + unit: str = ..., + radius: Incomplete | None = ..., + width: Incomplete | None = ..., + height: Incomplete | None = ..., + sort: Incomplete | None = ..., + count: Incomplete | None = ..., + any: bool = ..., + withcoord: bool = ..., + withdist: bool = ..., + withhash: bool = ..., + ) -> Any: ... + def geosearchstore( # type: ignore[override] + self, + dest, + name, + member: Incomplete | None = ..., + longitude: Incomplete | None = ..., + latitude: Incomplete | None = ..., + unit: str = ..., + radius: Incomplete | None = ..., + width: Incomplete | None = ..., + height: Incomplete | None = ..., + sort: Incomplete | None = ..., + count: Incomplete | None = ..., + any: bool = ..., + storedist: bool = ..., + ) -> Any: ... + # endregion + # region list commands + @overload + def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> Any: ... # type: ignore[override] + @overload + def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> Any: ... # type: ignore[override] + @overload + def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> Any: ... # type: ignore[override] + @overload + def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> Any: ... # type: ignore[override] + def brpoplpush(self, src, dst, timeout: int | None = ...) -> Any: ... # type: ignore[override] + def lindex(self, name: _Key, index: int) -> Any: ... # type: ignore[override] + def linsert( # type: ignore[override] + self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value + ) -> Any: ... + def llen(self, name: _Key) -> Any: ... # type: ignore[override] + def lpop(self, name, count: int | None = ...) -> Any: ... # type: ignore[override] + def lpush(self, name: _Value, *values: _Value) -> Any: ... # type: ignore[override] + def lpushx(self, name, value) -> Any: ... # type: ignore[override] + def lrange(self, name: _Key, start: int, end: int) -> Any: ... # type: ignore[override] + def lrem(self, name: _Key, count: int, value: _Value) -> Any: ... # type: ignore[override] + def lset(self, name: _Key, index: int, value: _Value) -> Any: ... # type: ignore[override] + def ltrim(self, name: _Key, start: int, end: int) -> Any: ... # type: ignore[override] + def rpop(self, name, count: int | None = ...) -> Any: ... # type: ignore[override] + def rpoplpush(self, src, dst) -> Any: ... # type: ignore[override] + def rpush(self, name: _Value, *values: _Value) -> Any: ... # type: ignore[override] + def rpushx(self, name, value) -> Any: ... # type: ignore[override] + def lpos(self, name, value, rank: Incomplete | None = ..., count: Incomplete | None = ..., maxlen: Incomplete | None = ...) -> Any: ... # type: ignore[override] + @overload # type: ignore[override] + def sort( + self, + name: _Key, + start: int | None = ..., + num: int | None = ..., + by: _Key | None = ..., + get: _Key | Sequence[_Key] | None = ..., + desc: bool = ..., + alpha: bool = ..., + store: None = ..., + groups: bool = ..., + ) -> list[_StrType]: ... + @overload # type: ignore[override] + def sort( + self, + name: _Key, + start: int | None = ..., + num: int | None = ..., + by: _Key | None = ..., + get: _Key | Sequence[_Key] | None = ..., + desc: bool = ..., + alpha: bool = ..., + *, + store: _Key, + groups: bool = ..., + ) -> Any: ... + @overload # type: ignore[override] + def sort( + self, + name: _Key, + start: int | None, + num: int | None, + by: _Key | None, + get: _Key | Sequence[_Key] | None, + desc: bool, + alpha: bool, + store: _Key, + groups: bool = ..., + ) -> Any: ... + # endregion + # region scan commands + def scan( # type: ignore[override] + self, + cursor: int = ..., + match: _Key | None = ..., + count: int | None = ..., + _type: str | None = ..., + **kwargs: _CommandOptions, + ) -> Any: ... + def sscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Any: ... # type: ignore[override] + def hscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Any: ... # type: ignore[override] + @overload # type: ignore[override] + def zscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Any: ... + @overload # type: ignore[override] + def zscan( + self, + name: _Key, + cursor: int = ..., + match: _Key | None = ..., + count: int | None = ..., + *, + score_cast_func: Callable[[_StrType], Any], + ) -> Any: ... + @overload # type: ignore[override] + def zscan( + self, name: _Key, cursor: int, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], Any] + ) -> Any: ... + # endregion + # region set commands + def sadd(self, name: _Key, *values: _Value) -> Any: ... # type: ignore[override] + def scard(self, name: _Key) -> Any: ... # type: ignore[override] + def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def sismember(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override] + def smembers(self, name: _Key) -> Any: ... # type: ignore[override] + def smismember(self, name, values, *args) -> Any: ... # type: ignore[override] + def smove(self, src: _Key, dst: _Key, value: _Value) -> Any: ... # type: ignore[override] + @overload # type: ignore[override] + def spop(self, name: _Key, count: None = ...) -> Any: ... + @overload # type: ignore[override] + def spop(self, name: _Key, count: int) -> Any: ... + @overload # type: ignore[override] + def srandmember(self, name: _Key, number: None = ...) -> Any: ... + @overload # type: ignore[override] + def srandmember(self, name: _Key, number: int) -> Any: ... + def srem(self, name: _Key, *values: _Value) -> Any: ... # type: ignore[override] + def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... # type: ignore[override] + # endregion + # region stream commands + def xack(self, name, groupname, *ids) -> Any: ... # type: ignore[override] + def xadd( # type: ignore[override] + self, + name, + fields, + id: str = ..., + maxlen=..., + approximate: bool = ..., + nomkstream: bool = ..., + minid: Incomplete | None = ..., + limit: Incomplete | None = ..., + ) -> Any: ... + def xautoclaim( # type: ignore[override] + self, + name, + groupname, + consumername, + min_idle_time, + start_id: int = ..., + count: Incomplete | None = ..., + justid: bool = ..., + ) -> Any: ... + def xclaim( # type: ignore[override] + self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=... + ) -> Any: ... + def xdel(self, name, *ids) -> Any: ... # type: ignore[override] + def xgroup_create(self, name, groupname, id: str = ..., mkstream: bool = ..., entries_read: int | None = ...) -> Any: ... # type: ignore[override] + def xgroup_delconsumer(self, name, groupname, consumername) -> Any: ... # type: ignore[override] + def xgroup_destroy(self, name, groupname) -> Any: ... # type: ignore[override] + def xgroup_createconsumer(self, name, groupname, consumername) -> Any: ... # type: ignore[override] + def xgroup_setid(self, name, groupname, id, entries_read: int | None = ...) -> Any: ... # type: ignore[override] + def xinfo_consumers(self, name, groupname) -> Any: ... # type: ignore[override] + def xinfo_groups(self, name) -> Any: ... # type: ignore[override] + def xinfo_stream(self, name, full: bool = ...) -> Any: ... # type: ignore[override] + def xlen(self, name: _Key) -> Any: ... # type: ignore[override] + def xpending(self, name, groupname) -> Any: ... # type: ignore[override] + def xpending_range( # type: ignore[override] + self, name: _Key, groupname, min, max, count: int, consumername: Incomplete | None = ..., idle: int | None = ... + ) -> Any: ... + def xrange(self, name, min: str = ..., max: str = ..., count: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def xread(self, streams, count: Incomplete | None = ..., block: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def xreadgroup( # type: ignore[override] + self, groupname, consumername, streams, count: Incomplete | None = ..., block: Incomplete | None = ..., noack: bool = ... + ) -> Any: ... + def xrevrange(self, name, max: str = ..., min: str = ..., count: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def xtrim( # type: ignore[override] + self, name, maxlen: int | None = ..., approximate: bool = ..., minid: Incomplete | None = ..., limit: int | None = ... + ) -> Any: ... + # endregion + # region sorted set commands + def zadd( # type: ignore[override] + self, + name: _Key, + mapping: Mapping[_Key, _Value], + nx: bool = ..., + xx: bool = ..., + ch: bool = ..., + incr: bool = ..., + gt: Incomplete | None = ..., + lt: Incomplete | None = ..., + ) -> Any: ... + def zcard(self, name: _Key) -> Any: ... # type: ignore[override] + def zcount(self, name: _Key, min: _Value, max: _Value) -> Any: ... # type: ignore[override] + def zdiff(self, keys, withscores: bool = ...) -> Any: ... # type: ignore[override] + def zdiffstore(self, dest, keys) -> Any: ... # type: ignore[override] + def zincrby(self, name: _Key, amount: float, value: _Value) -> Any: ... # type: ignore[override] + def zinter(self, keys, aggregate: Incomplete | None = ..., withscores: bool = ...) -> Any: ... # type: ignore[override] + def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> Any: ... # type: ignore[override] + def zlexcount(self, name: _Key, min: _Value, max: _Value) -> Any: ... # type: ignore[override] + def zpopmax(self, name: _Key, count: int | None = ...) -> Any: ... # type: ignore[override] + def zpopmin(self, name: _Key, count: int | None = ...) -> Any: ... # type: ignore[override] + def zrandmember(self, key, count: Incomplete | None = ..., withscores: bool = ...) -> Any: ... # type: ignore[override] + @overload # type: ignore[override] + def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> Any: ... + @overload # type: ignore[override] + def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> Any: ... + @overload # type: ignore[override] + def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> Any: ... + @overload # type: ignore[override] + def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> Any: ... + @overload # type: ignore[override] + def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], Any], + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> Any: ... + @overload # type: ignore[override] + def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], float] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> Any: ... + @overload # type: ignore[override] + def zrange( + self, + name: _Key, + start: int, + end: int, + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], None], + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> Any: ... + @overload # type: ignore[override] + def zrange( + self, + name: _Key, + start: int, + end: int, + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], float] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> Any: ... + @overload # type: ignore[override] + def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> Any: ... + @overload # type: ignore[override] + def zrevrange( + self, name: _Key, start: int, end: int, withscores: Literal[True], score_cast_func: Callable[[_StrType], None] + ) -> Any: ... + @overload # type: ignore[override] + def zrevrange(self, name: _Key, start: int, end: int, withscores: Literal[True]) -> Any: ... + @overload # type: ignore[override] + def zrevrange( + self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ... + ) -> Any: ... + def zrangestore( # type: ignore[override] + self, + dest, + name, + start, + end, + byscore: bool = ..., + bylex: bool = ..., + desc: bool = ..., + offset: Incomplete | None = ..., + num: Incomplete | None = ..., + ) -> Any: ... + def zrangebylex(self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...) -> Any: ... # type: ignore[override] + def zrevrangebylex(self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ...) -> Any: ... # type: ignore[override] + @overload # type: ignore[override] + def zrangebyscore( + self, + name: _Key, + min: _Value, + max: _Value, + start: int | None = ..., + num: int | None = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], None], + ) -> Any: ... + @overload # type: ignore[override] + def zrangebyscore( + self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True] + ) -> Any: ... + @overload # type: ignore[override] + def zrangebyscore( + self, + name: _Key, + min: _Value, + max: _Value, + start: int | None = ..., + num: int | None = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + ) -> Any: ... + @overload # type: ignore[override] + def zrevrangebyscore( + self, + name: _Key, + max: _Value, + min: _Value, + start: int | None = ..., + num: int | None = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], Any], + ) -> Any: ... + @overload # type: ignore[override] + def zrevrangebyscore( + self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True] + ) -> Any: ... + @overload # type: ignore[override] + def zrevrangebyscore( + self, + name: _Key, + max: _Value, + min: _Value, + start: int | None = ..., + num: int | None = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + ) -> Any: ... + def zrank(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override] + def zrem(self, name: _Key, *values: _Value) -> Any: ... # type: ignore[override] + def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> Any: ... # type: ignore[override] + def zremrangebyrank(self, name: _Key, min: int, max: int) -> Any: ... # type: ignore[override] + def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Any: ... # type: ignore[override] + def zrevrank(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override] + def zscore(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override] + def zunion(self, keys, aggregate: Incomplete | None = ..., withscores: bool = ...) -> Any: ... # type: ignore[override] + def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> Any: ... # type: ignore[override] + def zmscore(self, key, members) -> Any: ... # type: ignore[override] + # endregion + # region management commands + def bgrewriteaof(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def bgsave(self, schedule: bool = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def role(self) -> Any: ... # type: ignore[override] + def client_kill(self, address: str, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_kill_filter( # type: ignore[override] + self, + _id: Incomplete | None = ..., + _type: Incomplete | None = ..., + addr: Incomplete | None = ..., + skipme: Incomplete | None = ..., + laddr: Incomplete | None = ..., + user: Incomplete | None = ..., + **kwargs: _CommandOptions, + ) -> Any: ... + def client_info(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_list(self, _type: str | None = ..., client_id: list[str] = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_getname(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_getredir(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_reply(self, reply, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_id(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_tracking_on( # type: ignore[override] + self, + clientid: Incomplete | None = ..., + prefix=..., + bcast: bool = ..., + optin: bool = ..., + optout: bool = ..., + noloop: bool = ..., + ) -> Any: ... + def client_tracking_off( # type: ignore[override] + self, + clientid: Incomplete | None = ..., + prefix=..., + bcast: bool = ..., + optin: bool = ..., + optout: bool = ..., + noloop: bool = ..., + ) -> Any: ... + def client_tracking( # type: ignore[override] + self, + on: bool = ..., + clientid: Incomplete | None = ..., + prefix=..., + bcast: bool = ..., + optin: bool = ..., + optout: bool = ..., + noloop: bool = ..., + **kwargs: _CommandOptions, + ) -> Any: ... + def client_trackinginfo(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_setname(self, name: str, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_unblock(self, client_id, error: bool = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_pause(self, timeout, all: bool = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def client_unpause(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def command(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def command_info(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def command_count(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def config_get(self, pattern: PatternT = ..., *args: PatternT, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def config_resetstat(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def config_rewrite(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def dbsize(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def debug_object(self, key, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def debug_segfault(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def echo(self, value: _Value, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def flushall(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def flushdb(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def sync(self) -> Any: ... # type: ignore[override] + def psync(self, replicationid, offset) -> Any: ... # type: ignore[override] + def swapdb(self, first, second, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def select(self, index, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def info(self, section: _Key | None = ..., *args: _Key, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def lastsave(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def migrate( # type: ignore[override] + self, + host, + port, + keys, + destination_db, + timeout, + copy: bool = ..., + replace: bool = ..., + auth: Incomplete | None = ..., + **kwargs: _CommandOptions, + ) -> Any: ... + def object(self, infotype, key, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def memory_doctor(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def memory_help(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def memory_stats(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def memory_malloc_stats(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def memory_usage(self, key, samples: Incomplete | None = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def memory_purge(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def ping(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def quit(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def replicaof(self, *args, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def save(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def shutdown( # type: ignore[override] + self, + save: bool = ..., + nosave: bool = ..., + now: bool = ..., + force: bool = ..., + abort: bool = ..., + **kwargs: _CommandOptions, + ) -> Any: ... + def slaveof(self, host: Incomplete | None = ..., port: Incomplete | None = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def slowlog_get(self, num: Incomplete | None = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def slowlog_len(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def slowlog_reset(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def time(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def wait(self, num_replicas, timeout, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + # endregion + # region module commands + def module_load(self, path, *args) -> Any: ... # type: ignore[override] + def module_unload(self, name) -> Any: ... # type: ignore[override] + def module_list(self) -> Any: ... # type: ignore[override] + def command_getkeys(self, *args) -> Any: ... # type: ignore[override] + # endregion + # region pubsub commands + def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def pubsub_channels(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def pubsub_numpat(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override] + # endregion + # region script commands + def eval(self, script, numkeys, *keys_and_args) -> Any: ... # type: ignore[override] + def evalsha(self, sha, numkeys, *keys_and_args) -> Any: ... # type: ignore[override] + def script_exists(self, *args) -> Any: ... # type: ignore[override] + def script_debug(self, *args) -> Any: ... # type: ignore[override] + def script_flush(self, sync_type: Incomplete | None = ...) -> Any: ... # type: ignore[override] + def script_kill(self) -> Any: ... # type: ignore[override] + def script_load(self, script) -> Any: ... # type: ignore[override] + def register_script(self, script: str | _StrType) -> Any: ... # type: ignore[override] + # endregion diff --git a/stubs/redis/redis/asyncio/connection.pyi b/stubs/redis/redis/asyncio/connection.pyi new file mode 100644 index 0000000..44eb4f7 --- /dev/null +++ b/stubs/redis/redis/asyncio/connection.pyi @@ -0,0 +1,293 @@ +import asyncio +import enum +import ssl +from collections.abc import Callable, Iterable, Mapping +from typing import Any, Protocol +from typing_extensions import TypeAlias, TypedDict + +from redis import RedisError +from redis.asyncio.retry import Retry +from redis.exceptions import ResponseError +from redis.typing import EncodableT, EncodedT + +hiredis: Any +NONBLOCKING_EXCEPTION_ERROR_NUMBERS: Any +NONBLOCKING_EXCEPTIONS: Any +SYM_STAR: bytes +SYM_DOLLAR: bytes +SYM_CRLF: bytes +SYM_LF: bytes +SYM_EMPTY: bytes +SERVER_CLOSED_CONNECTION_ERROR: str + +class _Sentinel(enum.Enum): + sentinel: Any + +SENTINEL: Any +MODULE_LOAD_ERROR: str +NO_SUCH_MODULE_ERROR: str +MODULE_UNLOAD_NOT_POSSIBLE_ERROR: str +MODULE_EXPORTS_DATA_TYPES_ERROR: str + +class Encoder: + encoding: Any + encoding_errors: Any + decode_responses: Any + def __init__(self, encoding: str, encoding_errors: str, decode_responses: bool) -> None: ... + def encode(self, value: EncodableT) -> EncodedT: ... + def decode(self, value: EncodableT, force: bool = ...) -> EncodableT: ... + +ExceptionMappingT: TypeAlias = Mapping[str, type[Exception] | Mapping[str, type[Exception]]] + +class BaseParser: + EXCEPTION_CLASSES: ExceptionMappingT + def __init__(self, socket_read_size: int) -> None: ... + def __del__(self) -> None: ... + def parse_error(self, response: str) -> ResponseError: ... + def on_disconnect(self) -> None: ... + def on_connect(self, connection: Connection): ... + async def can_read(self, timeout: float) -> bool: ... + async def read_response(self, disable_decoding: bool = ...) -> EncodableT | ResponseError | list[EncodableT] | None: ... + +class SocketBuffer: + socket_read_size: Any + socket_timeout: Any + bytes_written: int + bytes_read: int + def __init__(self, stream_reader: asyncio.StreamReader, socket_read_size: int, socket_timeout: float | None) -> None: ... + @property + def length(self): ... + async def can_read(self, timeout: float) -> bool: ... + async def read(self, length: int) -> bytes: ... + async def readline(self) -> bytes: ... + def purge(self) -> None: ... + def close(self) -> None: ... + +class PythonParser(BaseParser): + encoder: Any + def __init__(self, socket_read_size: int) -> None: ... + def on_connect(self, connection: Connection): ... + def on_disconnect(self) -> None: ... + async def can_read(self, timeout: float): ... + async def read_response(self, disable_decoding: bool = ...) -> EncodableT | ResponseError | None: ... + +class HiredisParser(BaseParser): + def __init__(self, socket_read_size: int) -> None: ... + def on_connect(self, connection: Connection): ... + def on_disconnect(self) -> None: ... + async def can_read(self, timeout: float): ... + async def read_from_socket(self, timeout: float | None | _Sentinel = ..., raise_on_timeout: bool = ...): ... + async def read_response(self, disable_decoding: bool = ...) -> EncodableT | list[EncodableT]: ... + +DefaultParser: type[PythonParser | HiredisParser] + +class ConnectCallbackProtocol(Protocol): + def __call__(self, connection: Connection): ... + +class AsyncConnectCallbackProtocol(Protocol): + async def __call__(self, connection: Connection): ... + +ConnectCallbackT: TypeAlias = ConnectCallbackProtocol | AsyncConnectCallbackProtocol + +class Connection: + pid: Any + host: Any + port: Any + db: Any + username: Any + client_name: Any + password: Any + socket_timeout: Any + socket_connect_timeout: Any + socket_keepalive: Any + socket_keepalive_options: Any + socket_type: Any + retry_on_timeout: Any + retry_on_error: list[type[RedisError]] + retry: Retry + health_check_interval: Any + next_health_check: int + ssl_context: Any + encoder: Any + redis_connect_func: ConnectCallbackT | None + def __init__( + self, + *, + host: str = ..., + port: str | int = ..., + db: str | int = ..., + password: str | None = ..., + socket_timeout: float | None = ..., + socket_connect_timeout: float | None = ..., + socket_keepalive: bool = ..., + socket_keepalive_options: Mapping[int, int | bytes] | None = ..., + socket_type: int = ..., + retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | _Sentinel = ..., + encoding: str = ..., + encoding_errors: str = ..., + decode_responses: bool = ..., + parser_class: type[BaseParser] = ..., + socket_read_size: int = ..., + health_check_interval: float = ..., + client_name: str | None = ..., + username: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: ConnectCallbackT | None = ..., + encoder_class: type[Encoder] = ..., + ) -> None: ... + def repr_pieces(self): ... + def __del__(self) -> None: ... + @property + def is_connected(self): ... + def register_connect_callback(self, callback) -> None: ... + def clear_connect_callbacks(self) -> None: ... + def set_parser(self, parser_class) -> None: ... + async def connect(self) -> None: ... + async def on_connect(self) -> None: ... + async def disconnect(self) -> None: ... + async def check_health(self) -> None: ... + async def send_packed_command(self, command: bytes | str | Iterable[bytes], check_health: bool = ...): ... + async def send_command(self, *args, **kwargs) -> None: ... + async def can_read(self, timeout: float = ...): ... + async def read_response(self, disable_decoding: bool = ...): ... + def pack_command(self, *args: EncodableT) -> list[bytes]: ... + def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> list[bytes]: ... + +class SSLConnection(Connection): + ssl_context: Any + def __init__( + self, + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., + ssl_cert_reqs: str = ..., + ssl_ca_certs: str | None = ..., + ssl_ca_data: str | None = ..., + ssl_check_hostname: bool = ..., + **kwargs, + ) -> None: ... + @property + def keyfile(self): ... + @property + def certfile(self): ... + @property + def cert_reqs(self): ... + @property + def ca_certs(self): ... + @property + def ca_data(self): ... + @property + def check_hostname(self): ... + +class RedisSSLContext: + keyfile: Any + certfile: Any + cert_reqs: Any + ca_certs: Any + ca_data: Any + check_hostname: Any + context: Any + def __init__( + self, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: str | None = ..., + ca_certs: str | None = ..., + ca_data: str | None = ..., + check_hostname: bool = ..., + ) -> None: ... + def get(self) -> ssl.SSLContext: ... + +class UnixDomainSocketConnection(Connection): + pid: Any + path: Any + db: Any + username: Any + client_name: Any + password: Any + socket_timeout: Any + socket_connect_timeout: Any + retry_on_timeout: Any + retry_on_error: list[type[RedisError]] + retry: Any + health_check_interval: Any + next_health_check: int + redis_connect_func: ConnectCallbackT | None + encoder: Any + def __init__( + self, + *, + path: str = ..., + db: str | int = ..., + username: str | None = ..., + password: str | None = ..., + socket_timeout: float | None = ..., + socket_connect_timeout: float | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + decode_responses: bool = ..., + retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | _Sentinel = ..., + parser_class: type[BaseParser] = ..., + socket_read_size: int = ..., + health_check_interval: float = ..., + client_name: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: ConnectCallbackT | None = ..., + ) -> None: ... + def repr_pieces(self) -> Iterable[tuple[str, str | int]]: ... + +FALSE_STRINGS: Any + +def to_bool(value) -> bool | None: ... + +URL_QUERY_ARGUMENT_PARSERS: Mapping[str, Callable[..., object]] + +class ConnectKwargs(TypedDict): + username: str + password: str + connection_class: type[Connection] + host: str + port: int + db: int + path: str + +def parse_url(url: str) -> ConnectKwargs: ... + +class ConnectionPool: + @classmethod + def from_url(cls, url: str, **kwargs) -> ConnectionPool: ... + connection_class: Any + connection_kwargs: Any + max_connections: Any + encoder_class: Any + def __init__( + self, connection_class: type[Connection] = ..., max_connections: int | None = ..., **connection_kwargs + ) -> None: ... + pid: Any + def reset(self) -> None: ... + async def get_connection(self, command_name, *keys, **options): ... + def get_encoder(self): ... + def make_connection(self): ... + async def release(self, connection: Connection): ... + def owns_connection(self, connection: Connection): ... + async def disconnect(self, inuse_connections: bool = ...): ... + +class BlockingConnectionPool(ConnectionPool): + queue_class: Any + timeout: Any + def __init__( + self, + max_connections: int = ..., + timeout: int | None = ..., + connection_class: type[Connection] = ..., + queue_class: type[asyncio.Queue[Any]] = ..., + **connection_kwargs, + ) -> None: ... + pool: Any + pid: Any + def reset(self) -> None: ... + def make_connection(self): ... + async def get_connection(self, command_name, *keys, **options): ... + async def release(self, connection: Connection): ... + async def disconnect(self, inuse_connections: bool = ...): ... diff --git a/stubs/redis/redis/asyncio/lock.pyi b/stubs/redis/redis/asyncio/lock.pyi new file mode 100644 index 0000000..c9d3a93 --- /dev/null +++ b/stubs/redis/redis/asyncio/lock.pyi @@ -0,0 +1,51 @@ +import threading +from _typeshed import Self +from collections.abc import Awaitable +from types import SimpleNamespace, TracebackType +from typing import Any, ClassVar + +from redis.asyncio import Redis +from redis.commands.core import AsyncScript + +class Lock: + lua_release: ClassVar[AsyncScript | None] + lua_extend: ClassVar[AsyncScript | None] + lua_reacquire: ClassVar[AsyncScript | None] + LUA_RELEASE_SCRIPT: ClassVar[str] + LUA_EXTEND_SCRIPT: ClassVar[str] + LUA_REACQUIRE_SCRIPT: ClassVar[str] + redis: Redis[Any] + name: str | bytes | memoryview + timeout: float | None + sleep: float + blocking: bool + blocking_timeout: float | None + thread_local: bool + local: threading.local | SimpleNamespace + def __init__( + self, + redis: Redis[Any], + name: str | bytes | memoryview, + timeout: float | None = ..., + sleep: float = ..., + blocking: bool = ..., + blocking_timeout: float | None = ..., + thread_local: bool = ..., + ) -> None: ... + def register_scripts(self) -> None: ... + async def __aenter__(self: Self) -> Self: ... + async def __aexit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + async def acquire( + self, blocking: bool | None = ..., blocking_timeout: float | None = ..., token: str | bytes | None = ... + ) -> bool: ... + async def do_acquire(self, token: str | bytes) -> bool: ... + async def locked(self) -> bool: ... + async def owned(self) -> bool: ... + def release(self) -> Awaitable[None]: ... + async def do_release(self, expected_token: bytes) -> None: ... + def extend(self, additional_time: float, replace_ttl: bool = ...) -> Awaitable[bool]: ... + async def do_extend(self, additional_time: float, replace_ttl: bool) -> bool: ... + def reacquire(self) -> Awaitable[bool]: ... + async def do_reacquire(self) -> bool: ... diff --git a/stubs/redis/redis/asyncio/parser.pyi b/stubs/redis/redis/asyncio/parser.pyi new file mode 100644 index 0000000..01a25ed --- /dev/null +++ b/stubs/redis/redis/asyncio/parser.pyi @@ -0,0 +1,8 @@ +from typing import Any + +# TODO: define and use: +# from redis.asyncio.cluster import ClusterNode + +class CommandsParser: + async def initialize(self, node: Any | None = ...) -> None: ... # TODO: ClusterNode + async def get_keys(self, *args: Any) -> tuple[str, ...] | None: ... diff --git a/stubs/redis/redis/asyncio/retry.pyi b/stubs/redis/redis/asyncio/retry.pyi new file mode 100644 index 0000000..1579606 --- /dev/null +++ b/stubs/redis/redis/asyncio/retry.pyi @@ -0,0 +1,12 @@ +from collections.abc import Awaitable, Callable, Iterable +from typing import TypeVar + +from redis.backoff import AbstractBackoff +from redis.exceptions import RedisError + +_T = TypeVar("_T") + +class Retry: + def __init__(self, backoff: AbstractBackoff, retries: int, supported_errors: tuple[type[RedisError], ...] = ...) -> None: ... + def update_supported_errors(self, specified_errors: Iterable[type[RedisError]]) -> None: ... + async def call_with_retry(self, do: Callable[[], Awaitable[_T]], fail: Callable[[RedisError], Awaitable[object]]) -> _T: ... diff --git a/stubs/redis/redis/asyncio/sentinel.pyi b/stubs/redis/redis/asyncio/sentinel.pyi new file mode 100644 index 0000000..59b31e0 --- /dev/null +++ b/stubs/redis/redis/asyncio/sentinel.pyi @@ -0,0 +1,61 @@ +from collections.abc import AsyncIterator, Iterable, Mapping, Sequence +from typing import Any + +from redis.asyncio.client import Redis +from redis.asyncio.connection import Connection, ConnectionPool, SSLConnection +from redis.commands import AsyncSentinelCommands +from redis.exceptions import ConnectionError +from redis.typing import EncodableT + +class MasterNotFoundError(ConnectionError): ... +class SlaveNotFoundError(ConnectionError): ... + +class SentinelManagedConnection(Connection): + connection_pool: Any + def __init__(self, **kwargs) -> None: ... + async def connect_to(self, address) -> None: ... + async def connect(self): ... + async def read_response(self, disable_decoding: bool = ...): ... + +class SentinelManagedSSLConnection(SentinelManagedConnection, SSLConnection): ... + +class SentinelConnectionPool(ConnectionPool): + is_master: Any + check_connection: Any + service_name: Any + sentinel_manager: Any + master_address: Any + slave_rr_counter: Any + def __init__(self, service_name, sentinel_manager, **kwargs) -> None: ... + def reset(self) -> None: ... + def owns_connection(self, connection: Connection): ... + async def get_master_address(self): ... + async def rotate_slaves(self) -> AsyncIterator[Any]: ... + +class Sentinel(AsyncSentinelCommands): + sentinel_kwargs: Any + sentinels: Any + min_other_sentinels: Any + connection_kwargs: Any + def __init__( + self, sentinels, min_other_sentinels: int = ..., sentinel_kwargs: Any | None = ..., **connection_kwargs + ) -> None: ... + async def execute_command(self, *args, **kwargs): ... + def check_master_state(self, state: dict[Any, Any], service_name: str) -> bool: ... + async def discover_master(self, service_name: str): ... + def filter_slaves(self, slaves: Iterable[Mapping[Any, Any]]) -> Sequence[tuple[EncodableT, EncodableT]]: ... + async def discover_slaves(self, service_name: str) -> Sequence[tuple[EncodableT, EncodableT]]: ... + def master_for( + self, + service_name: str, + redis_class: type[Redis[Any]] = ..., + connection_pool_class: type[SentinelConnectionPool] = ..., + **kwargs, + ): ... + def slave_for( + self, + service_name: str, + redis_class: type[Redis[Any]] = ..., + connection_pool_class: type[SentinelConnectionPool] = ..., + **kwargs, + ): ... diff --git a/stubs/redis/redis/asyncio/utils.pyi b/stubs/redis/redis/asyncio/utils.pyi new file mode 100644 index 0000000..f63aa2d --- /dev/null +++ b/stubs/redis/redis/asyncio/utils.pyi @@ -0,0 +1,12 @@ +from typing import Any, Generic + +from redis.asyncio.client import Pipeline, Redis +from redis.client import _StrType + +def from_url(url: str, **kwargs) -> Redis[Any]: ... + +class pipeline(Generic[_StrType]): + p: Pipeline[_StrType] + def __init__(self, redis_obj: Redis[_StrType]) -> None: ... + async def __aenter__(self) -> Pipeline[_StrType]: ... + async def __aexit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... diff --git a/stubs/redis/redis/backoff.pyi b/stubs/redis/redis/backoff.pyi new file mode 100644 index 0000000..643c0bc --- /dev/null +++ b/stubs/redis/redis/backoff.pyi @@ -0,0 +1,29 @@ +from abc import ABC, abstractmethod + +class AbstractBackoff(ABC): + def reset(self) -> None: ... + @abstractmethod + def compute(self, failures: int) -> float: ... + +class ConstantBackoff(AbstractBackoff): + def __init__(self, backoff: int) -> None: ... + def compute(self, failures: int) -> float: ... + +class NoBackoff(ConstantBackoff): + def __init__(self) -> None: ... + +class ExponentialBackoff(AbstractBackoff): + def __init__(self, cap: float, base: float) -> None: ... + def compute(self, failures: int) -> float: ... + +class FullJitterBackoff(AbstractBackoff): + def __init__(self, cap: float, base: float) -> None: ... + def compute(self, failures: int) -> float: ... + +class EqualJitterBackoff(AbstractBackoff): + def __init__(self, cap: float, base: float) -> None: ... + def compute(self, failures: int) -> float: ... + +class DecorrelatedJitterBackoff(AbstractBackoff): + def __init__(self, cap: float, base: float) -> None: ... + def compute(self, failures: int) -> float: ... diff --git a/stubs/redis/redis/client.pyi b/stubs/redis/redis/client.pyi index bacc88f..bfc06d5 100644 --- a/stubs/redis/redis/client.pyi +++ b/stubs/redis/redis/client.pyi @@ -1,28 +1,63 @@ +import threading +from _typeshed import Incomplete, Self, SupportsItems +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from datetime import datetime, timedelta -from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, Sequence, Set, Text, Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal +from re import Pattern +from types import TracebackType +from typing import Any, ClassVar, Generic, TypeVar, overload +from typing_extensions import Literal, TypeAlias -from .connection import ConnectionPool +from redis import RedisError + +from .commands import CoreCommands, RedisModuleCommands, SentinelCommands +from .connection import ConnectionPool, _ConnectFunc, _ConnectionPoolOptions from .lock import Lock +from .retry import Retry +from .typing import ChannelT, EncodableT, KeyT, PatternT + +_Value: TypeAlias = bytes | float | int | str +_Key: TypeAlias = str | bytes + +# Lib returns str or bytes depending on value of decode_responses +_StrType = TypeVar("_StrType", bound=str | bytes) + +_VT = TypeVar("_VT") +_T = TypeVar("_T") +_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn") + +# Keyword arguments that are passed to Redis.parse_response(). +_ParseResponseOptions: TypeAlias = Any +# Keyword arguments that are passed to Redis.execute_command(). +_CommandOptions: TypeAlias = _ConnectionPoolOptions | _ParseResponseOptions -SYM_EMPTY: Any +SYM_EMPTY: bytes +EMPTY_RESPONSE: str +NEVER_DECODE: str + +class CaseInsensitiveDict(dict[_StrType, _VT]): + def __init__(self, data: SupportsItems[_StrType, _VT]) -> None: ... + def update(self, data: SupportsItems[_StrType, _VT]) -> None: ... # type: ignore[override] + @overload + def get(self, k: _StrType, default: None = ...) -> _VT | None: ... + @overload + def get(self, k: _StrType, default: _VT | _T) -> _VT | _T: ... + # Overrides many other methods too, but without changing signature def list_or_args(keys, args): ... def timestamp_to_datetime(response): ... def string_keys_to_dict(key_string, callback): ... -def dict_merge(*dicts): ... def parse_debug_object(response): ... def parse_object(response, infotype): ... def parse_info(response): ... -SENTINEL_STATE_TYPES: Any +SENTINEL_STATE_TYPES: dict[str, type[int]] def parse_sentinel_state(item): ... def parse_sentinel_master(response): ... def parse_sentinel_masters(response): ... def parse_sentinel_slaves_and_sentinels(response): ... def parse_sentinel_get_master(response): ... -def pairs_to_dict(response): ... +def pairs_to_dict(response, decode_keys: bool = ..., decode_string_values: bool = ...): ... def pairs_to_dict_typed(response, type_info): ... def zset_score_pairs(response, **options): ... def sort_return_tuples(response, **options): ... @@ -36,308 +71,204 @@ def parse_hscan(response, **options): ... def parse_zscan(response, **options): ... def parse_slowlog_get(response, **options): ... -_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn") - -_Value = Union[bytes, float, int, Text] -_Key = Union[Text, bytes] - -# Lib returns str or bytes depending on Python version and value of decode_responses -_StrType = TypeVar("_StrType", bound=Union[Text, bytes]) - _LockType = TypeVar("_LockType") -class Redis(Generic[_StrType]): - RESPONSE_CALLBACKS: Any - @overload - @classmethod - def from_url( - cls, - url: Text, - host: Text | None, - port: int | None, - db: int | None, - password: Text | None, - socket_timeout: float | None, - socket_connect_timeout: float | None, - socket_keepalive: bool | None, - socket_keepalive_options: Mapping[str, int | str] | None, - connection_pool: ConnectionPool | None, - unix_socket_path: Text | None, - encoding: Text, - encoding_errors: Text, - charset: Text | None, - errors: Text | None, - decode_responses: Literal[True], - retry_on_timeout: bool = ..., - ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., - ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., - ssl_check_hostname: bool = ..., - max_connections: int | None = ..., - single_connection_client: bool = ..., - health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., - ) -> Redis[str]: ... +class AbstractRedis: + RESPONSE_CALLBACKS: dict[str, Any] + +class Redis(AbstractRedis, RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Generic[_StrType]): @overload @classmethod def from_url( cls, - url: Text, - host: Text | None = ..., + url: str, + *, + host: str | None = ..., port: int | None = ..., db: int | None = ..., - password: Text | None = ..., + password: str | None = ..., socket_timeout: float | None = ..., socket_connect_timeout: float | None = ..., socket_keepalive: bool | None = ..., socket_keepalive_options: Mapping[str, int | str] | None = ..., connection_pool: ConnectionPool | None = ..., - unix_socket_path: Text | None = ..., - encoding: Text = ..., - encoding_errors: Text = ..., - charset: Text | None = ..., - errors: Text | None = ..., - *, + unix_socket_path: str | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + charset: str | None = ..., + errors: str | None = ..., decode_responses: Literal[True], retry_on_timeout: bool = ..., ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., + ssl_ca_certs: str | None = ..., ssl_check_hostname: bool = ..., max_connections: int | None = ..., single_connection_client: bool = ..., health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., + client_name: str | None = ..., + username: str | None = ..., ) -> Redis[str]: ... @overload @classmethod def from_url( cls, - url: Text, - host: Text | None = ..., + url: str, + *, + host: str | None = ..., port: int | None = ..., db: int | None = ..., - password: Text | None = ..., + password: str | None = ..., socket_timeout: float | None = ..., socket_connect_timeout: float | None = ..., socket_keepalive: bool | None = ..., socket_keepalive_options: Mapping[str, int | str] | None = ..., connection_pool: ConnectionPool | None = ..., - unix_socket_path: Text | None = ..., - encoding: Text = ..., - encoding_errors: Text = ..., - charset: Text | None = ..., + unix_socket_path: str | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + charset: str | None = ..., + errors: str | None = ..., decode_responses: Literal[False] = ..., - errors: Text | None = ..., retry_on_timeout: bool = ..., ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., + ssl_ca_certs: str | None = ..., ssl_check_hostname: bool = ..., max_connections: int | None = ..., single_connection_client: bool = ..., health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., + client_name: str | None = ..., + username: str | None = ..., ) -> Redis[bytes]: ... connection_pool: Any response_callbacks: Any @overload - def __new__( - cls, - host: Text, - port: int, - db: int, - password: Text | None, - socket_timeout: float | None, - socket_connect_timeout: float | None, - socket_keepalive: bool | None, - socket_keepalive_options: Mapping[str, int | str] | None, - connection_pool: ConnectionPool | None, - unix_socket_path: Text | None, - encoding: Text, - encoding_errors: Text, - charset: Text | None, - decode_responses: Literal[True], - errors: Text | None = ..., - retry_on_timeout: bool = ..., - ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., - ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., - ssl_check_hostname: bool = ..., - max_connections: int | None = ..., - single_connection_client: bool = ..., - health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., - ) -> Redis[str]: ... - @overload - def __new__( - cls, - host: Text = ..., - port: int = ..., - db: int = ..., - password: Text | None = ..., - socket_timeout: float | None = ..., - socket_connect_timeout: float | None = ..., - socket_keepalive: bool | None = ..., - socket_keepalive_options: Mapping[str, int | str] | None = ..., - connection_pool: ConnectionPool | None = ..., - unix_socket_path: Text | None = ..., - encoding: Text = ..., - encoding_errors: Text = ..., - charset: Text | None = ..., - *, - decode_responses: Literal[True], - errors: Text | None = ..., - retry_on_timeout: bool = ..., - ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., - ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., - ssl_check_hostname: bool = ..., - max_connections: int | None = ..., - single_connection_client: bool = ..., - health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., - ) -> Redis[str]: ... - @overload - def __new__( - cls, - host: Text = ..., - port: int = ..., - db: int = ..., - password: Text | None = ..., - socket_timeout: float | None = ..., - socket_connect_timeout: float | None = ..., - socket_keepalive: bool | None = ..., - socket_keepalive_options: Mapping[str, int | str] | None = ..., - connection_pool: ConnectionPool | None = ..., - unix_socket_path: Text | None = ..., - encoding: Text = ..., - encoding_errors: Text = ..., - charset: Text | None = ..., - errors: Text | None = ..., - decode_responses: Literal[False] = ..., - retry_on_timeout: bool = ..., - ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., - ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., - ssl_check_hostname: bool = ..., - max_connections: int | None = ..., - single_connection_client: bool = ..., - health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., - ) -> Redis[bytes]: ... - @overload def __init__( self: Redis[str], - host: Text, + host: str, port: int, db: int, - password: Text | None, + password: str | None, socket_timeout: float | None, socket_connect_timeout: float | None, socket_keepalive: bool | None, socket_keepalive_options: Mapping[str, int | str] | None, connection_pool: ConnectionPool | None, - unix_socket_path: Text | None, - encoding: Text, - encoding_errors: Text, - charset: Text | None, - errors: Text | None, + unix_socket_path: str | None, + encoding: str, + encoding_errors: str, + charset: str | None, + errors: str | None, decode_responses: Literal[True], retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | None = ..., ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., + ssl_ca_certs: str | None = ..., + ssl_ca_path: Any | None = ..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., + ssl_password: Any | None = ..., + ssl_validate_ocsp: bool = ..., + ssl_validate_ocsp_stapled: bool = ..., # added in 4.1.1 + ssl_ocsp_context: Any | None = ..., # added in 4.1.1 + ssl_ocsp_expected_cert: Any | None = ..., # added in 4.1.1 max_connections: int | None = ..., single_connection_client: bool = ..., health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., + client_name: str | None = ..., + username: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: _ConnectFunc | None = ..., ) -> None: ... @overload def __init__( self: Redis[str], - host: Text = ..., + host: str = ..., port: int = ..., db: int = ..., - password: Text | None = ..., + password: str | None = ..., socket_timeout: float | None = ..., socket_connect_timeout: float | None = ..., socket_keepalive: bool | None = ..., socket_keepalive_options: Mapping[str, int | str] | None = ..., connection_pool: ConnectionPool | None = ..., - unix_socket_path: Text | None = ..., - encoding: Text = ..., - encoding_errors: Text = ..., - charset: Text | None = ..., - errors: Text | None = ..., + unix_socket_path: str | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + charset: str | None = ..., + errors: str | None = ..., *, decode_responses: Literal[True], retry_on_timeout: bool = ..., ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., + ssl_ca_certs: str | None = ..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., + ssl_password: Any | None = ..., + ssl_validate_ocsp: bool = ..., + ssl_validate_ocsp_stapled: bool = ..., # added in 4.1.1 + ssl_ocsp_context: Any | None = ..., # added in 4.1.1 + ssl_ocsp_expected_cert: Any | None = ..., # added in 4.1.1 max_connections: int | None = ..., single_connection_client: bool = ..., health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., + client_name: str | None = ..., + username: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: _ConnectFunc | None = ..., ) -> None: ... @overload def __init__( self: Redis[bytes], - host: Text = ..., + host: str = ..., port: int = ..., db: int = ..., - password: Text | None = ..., + password: str | None = ..., socket_timeout: float | None = ..., socket_connect_timeout: float | None = ..., socket_keepalive: bool | None = ..., socket_keepalive_options: Mapping[str, int | str] | None = ..., connection_pool: ConnectionPool | None = ..., - unix_socket_path: Text | None = ..., - encoding: Text = ..., - encoding_errors: Text = ..., - charset: Text | None = ..., - errors: Text | None = ..., + unix_socket_path: str | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + charset: str | None = ..., + errors: str | None = ..., decode_responses: Literal[False] = ..., retry_on_timeout: bool = ..., ssl: bool = ..., - ssl_keyfile: Text | None = ..., - ssl_certfile: Text | None = ..., + ssl_keyfile: str | None = ..., + ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: Text | None = ..., + ssl_ca_certs: str | None = ..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., + ssl_password: Any | None = ..., + ssl_validate_ocsp: bool = ..., + ssl_validate_ocsp_stapled: bool = ..., # added in 4.1.1 + ssl_ocsp_context: Any | None = ..., # added in 4.1.1 + ssl_ocsp_expected_cert: Any | None = ..., # added in 4.1.1 max_connections: int | None = ..., single_connection_client: bool = ..., health_check_interval: float = ..., - client_name: Text | None = ..., - username: Text | None = ..., + client_name: str | None = ..., + username: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: _ConnectFunc | None = ..., ) -> None: ... + def get_encoder(self): ... + def get_connection_kwargs(self): ... def set_response_callback(self, command, callback): ... def pipeline(self, transaction: bool = ..., shard_hint: Any = ...) -> Pipeline[_StrType]: ... def transaction(self, func, *watches, **kwargs): ... @@ -347,6 +278,7 @@ class Redis(Generic[_StrType]): name: _Key, timeout: float | None = ..., sleep: float = ..., + blocking: bool = ..., blocking_timeout: float | None = ..., lock_class: None = ..., thread_local: bool = ..., @@ -357,8 +289,9 @@ class Redis(Generic[_StrType]): name: _Key, timeout: float | None, sleep: float, + blocking: bool, blocking_timeout: float | None, - lock_class: Type[_LockType], + lock_class: type[_LockType], thread_local: bool = ..., ) -> _LockType: ... @overload @@ -367,402 +300,16 @@ class Redis(Generic[_StrType]): name: _Key, timeout: float | None = ..., sleep: float = ..., + blocking: bool = ..., blocking_timeout: float | None = ..., *, - lock_class: Type[_LockType], + lock_class: type[_LockType], thread_local: bool = ..., ) -> _LockType: ... - def pubsub(self, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ... - def execute_command(self, *args, **options): ... - def parse_response(self, connection, command_name, **options): ... - def acl_cat(self, category: Text | None = ...) -> list[str]: ... - def acl_deluser(self, username: Text) -> int: ... - def acl_genpass(self) -> Text: ... - def acl_getuser(self, username: Text) -> Any | None: ... - def acl_list(self) -> list[Text]: ... - def acl_load(self) -> bool: ... - def acl_setuser( - self, - username: Text = ..., - enabled: bool = ..., - nopass: bool = ..., - passwords: Sequence[Text] | None = ..., - hashed_passwords: Sequence[Text] | None = ..., - categories: Sequence[Text] | None = ..., - commands: Sequence[Text] | None = ..., - keys: Sequence[Text] | None = ..., - reset: bool = ..., - reset_keys: bool = ..., - reset_passwords: bool = ..., - ) -> bool: ... - def acl_users(self) -> list[Text]: ... - def acl_whoami(self) -> Text: ... - def bgrewriteaof(self): ... - def bgsave(self): ... - def client_id(self) -> int: ... - def client_kill(self, address: Text) -> bool: ... - def client_list(self) -> list[dict[str, str]]: ... - def client_getname(self) -> str | None: ... - def client_setname(self, name: Text) -> bool: ... - def readwrite(self) -> bool: ... - def readonly(self) -> bool: ... - def config_get(self, pattern=...): ... - def config_set(self, name, value): ... - def config_resetstat(self): ... - def config_rewrite(self): ... - def dbsize(self) -> int: ... - def debug_object(self, key): ... - def echo(self, value: _Value) -> bytes: ... - def flushall(self) -> bool: ... - def flushdb(self) -> bool: ... - def info(self, section: _Key | None = ...) -> Mapping[str, Any]: ... - def lastsave(self): ... - def object(self, infotype, key): ... - def ping(self) -> bool: ... - def save(self) -> bool: ... - def sentinel(self, *args): ... - def sentinel_get_master_addr_by_name(self, service_name): ... - def sentinel_master(self, service_name): ... - def sentinel_masters(self): ... - def sentinel_monitor(self, name, ip, port, quorum): ... - def sentinel_remove(self, name): ... - def sentinel_sentinels(self, service_name): ... - def sentinel_set(self, name, option, value): ... - def sentinel_slaves(self, service_name): ... - def shutdown(self): ... - def slaveof(self, host=..., port=...): ... - def slowlog_get(self, num=...): ... - def slowlog_len(self): ... - def slowlog_reset(self): ... - def time(self): ... - def append(self, key, value): ... - def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ...) -> int: ... - def bitop(self, operation, dest, *keys): ... - def bitpos(self, key, bit, start=..., end=...): ... - def decr(self, name, amount=...): ... - def delete(self, *names: _Key) -> int: ... - def __delitem__(self, _Key): ... - def dump(self, name): ... - def exists(self, *names: _Key) -> int: ... - __contains__: Any - def expire(self, name: _Key, time: int | timedelta) -> bool: ... - def expireat(self, name, when): ... - def get(self, name: _Key) -> _StrType | None: ... - def __getitem__(self, name): ... - def getbit(self, name: _Key, offset: int) -> int: ... - def getrange(self, key, start, end): ... - def getset(self, name, value) -> _StrType | None: ... - def incr(self, name: _Key, amount: int = ...) -> int: ... - def incrby(self, name: _Key, amount: int = ...) -> int: ... - def incrbyfloat(self, name: _Key, amount: float = ...) -> float: ... - def keys(self, pattern: _Key = ...) -> list[_StrType]: ... - def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... - def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ... - def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... - def move(self, name: _Key, db: int) -> bool: ... - def persist(self, name: _Key) -> bool: ... - def pexpire(self, name: _Key, time: int | timedelta) -> Literal[1, 0]: ... - def pexpireat(self, name: _Key, when: int | datetime) -> Literal[1, 0]: ... - def psetex(self, name, time_ms, value): ... - def pttl(self, name): ... - def randomkey(self): ... - def rename(self, src, dst): ... - def renamenx(self, src, dst): ... - def restore(self, name, ttl, value, replace: bool = ...): ... - def set( - self, - name: _Key, - value: _Value, - ex: None | int | timedelta = ..., - px: None | int | timedelta = ..., - nx: bool = ..., - xx: bool = ..., - keepttl: bool = ..., - ) -> bool | None: ... - def __setitem__(self, name, value): ... - def setbit(self, name: _Key, offset: int, value: int) -> int: ... - def setex(self, name: _Key, time: int | timedelta, value: _Value) -> bool: ... - def setnx(self, name: _Key, value: _Value) -> bool: ... - def setrange(self, name, offset, value): ... - def strlen(self, name): ... - def substr(self, name, start, end=...): ... - def ttl(self, name: _Key) -> int: ... - def type(self, name): ... - def watch(self, *names): ... - def unlink(self, *names: _Key) -> int: ... - def unwatch(self): ... - @overload - def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] = ...) -> Tuple[_StrType, _StrType]: ... - @overload - def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> Tuple[_StrType, _StrType] | None: ... - @overload - def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] = ...) -> Tuple[_StrType, _StrType]: ... - @overload - def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> Tuple[_StrType, _StrType] | None: ... - def brpoplpush(self, src, dst, timeout=...): ... - def lindex(self, name: _Key, index: int) -> _StrType | None: ... - def linsert( - self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value - ) -> int: ... - def llen(self, name: _Key) -> int: ... - def lpop(self, name): ... - def lpush(self, name: _Value, *values: _Value) -> int: ... - def lpushx(self, name, value): ... - def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ... - def lrem(self, name: _Key, count: int, value: _Value) -> int: ... - def lset(self, name: _Key, index: int, value: _Value) -> bool: ... - def ltrim(self, name: _Key, start: int, end: int) -> bool: ... - def rpop(self, name): ... - def rpoplpush(self, src, dst): ... - def rpush(self, name: _Value, *values: _Value) -> int: ... - def rpushx(self, name, value): ... - @overload - def sort( - self, - name: _Key, - start: int | None = ..., - num: int | None = ..., - by: _Key | None = ..., - get: _Key | Sequence[_Key] | None = ..., - desc: bool = ..., - alpha: bool = ..., - store: None = ..., - groups: bool = ..., - ) -> list[_StrType]: ... - @overload - def sort( - self, - name: _Key, - start: int | None = ..., - num: int | None = ..., - by: _Key | None = ..., - get: _Key | Sequence[_Key] | None = ..., - desc: bool = ..., - alpha: bool = ..., - *, - store: _Key, - groups: bool = ..., - ) -> int: ... - @overload - def sort( - self, - name: _Key, - start: int | None, - num: int | None, - by: _Key | None, - get: _Key | Sequence[_Key] | None, - desc: bool, - alpha: bool, - store: _Key, - groups: bool = ..., - ) -> int: ... - def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Tuple[int, list[_StrType]]: ... - def scan_iter(self, match: Text | None = ..., count: int | None = ...) -> Iterator[_StrType]: ... - def sscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Tuple[int, list[_StrType]]: ... - def sscan_iter(self, name, match=..., count=...): ... - def hscan( - self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ... - ) -> Tuple[int, dict[_StrType, _StrType]]: ... - def hscan_iter(self, name, match=..., count=...): ... - def zscan(self, name, cursor=..., match=..., count=..., score_cast_func=...): ... - def zscan_iter(self, name, match=..., count=..., score_cast_func=...): ... - def sadd(self, name: _Key, *values: _Value) -> int: ... - def scard(self, name: _Key) -> int: ... - def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> Set[_Value]: ... - def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> Set[_Value]: ... - def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - def sismember(self, name: _Key, value: _Value) -> bool: ... - def smembers(self, name: _Key) -> Set[_StrType]: ... - def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ... - @overload - def spop(self, name: _Key, count: None = ...) -> _Value | None: ... - @overload - def spop(self, name: _Key, count: int) -> list[_Value]: ... - @overload - def srandmember(self, name: _Key, number: None = ...) -> _Value | None: ... - @overload - def srandmember(self, name: _Key, number: int) -> list[_Value]: ... - def srem(self, name: _Key, *values: _Value) -> int: ... - def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Set[_Value]: ... - def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - def xack(self, name, groupname, *ids): ... - def xadd(self, name, fields, id=..., maxlen=..., approximate=...): ... - def xclaim( - self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=... - ): ... - def xdel(self, name, *ids): ... - def xgroup_create(self, name, groupname, id=..., mkstream=...): ... - def xgroup_delconsumer(self, name, groupname, consumername): ... - def xgroup_destroy(self, name, groupname): ... - def xgroup_setid(self, name, groupname, id): ... - def xinfo_consumers(self, name, groupname): ... - def xinfo_groups(self, name): ... - def xinfo_stream(self, name): ... - def xlen(self, name: _Key) -> int: ... - def xpending(self, name, groupname): ... - def xpending_range(self, name, groupname, min, max, count, consumername=...): ... - def xrange(self, name, min=..., max=..., count=...): ... - def xread(self, streams, count=..., block=...): ... - def xreadgroup(self, groupname, consumername, streams, count=..., block=..., noack=...): ... - def xrevrange(self, name, max=..., min=..., count=...): ... - def xtrim(self, name, maxlen, approximate=...): ... - def zadd( - self, name: _Key, mapping: Mapping[_Key, _Value], nx: bool = ..., xx: bool = ..., ch: bool = ..., incr: bool = ... - ) -> int: ... - def zcard(self, name: _Key) -> int: ... - def zcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ... - def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> int: ... - def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zpopmax(self, name: _Key, count: int | None = ...) -> list[_StrType]: ... - def zpopmin(self, name: _Key, count: int | None = ...) -> list[_StrType]: ... - @overload - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> Tuple[_StrType, _StrType, float]: ... - @overload - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> Tuple[_StrType, _StrType, float] | None: ... - @overload - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> Tuple[_StrType, _StrType, float]: ... - @overload - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> Tuple[_StrType, _StrType, float] | None: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = ..., - *, - withscores: Literal[True], - score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = ..., - withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., - ) -> list[_StrType]: ... - def zrangebylex( - self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... - ) -> list[_StrType]: ... - @overload - def zrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = ..., - num: int | None = ..., - *, - withscores: Literal[True], - score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = ..., - num: int | None = ..., - withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., - ) -> list[_StrType]: ... - def zrank(self, name: _Key, value: _Value) -> int | None: ... - def zrem(self, name: _Key, *values: _Value) -> int: ... - def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ... - def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ... - @overload - def zrevrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = ..., - *, - withscores: Literal[True], - score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrevrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = ..., - withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., - ) -> list[_StrType]: ... - @overload - def zrevrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = ..., - num: int | None = ..., - *, - withscores: Literal[True], - score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrevrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = ..., - num: int | None = ..., - withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., - ) -> list[_StrType]: ... - def zrevrangebylex( - self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... - ) -> list[_StrType]: ... - def zrevrank(self, name: _Key, value: _Value) -> int | None: ... - def zscore(self, name: _Key, value: _Value) -> float | None: ... - def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> int: ... - def pfadd(self, name: _Key, *values: _Value) -> int: ... - def pfcount(self, name: _Key) -> int: ... - def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ... - def hdel(self, name: _Key, *keys: _Key) -> int: ... - def hexists(self, name: _Key, key: _Key) -> bool: ... - def hget(self, name: _Key, key: _Key) -> _StrType | None: ... - def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ... - def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> int: ... - def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> float: ... - def hkeys(self, name: _Key) -> list[_StrType]: ... - def hlen(self, name: _Key) -> int: ... - @overload - def hset(self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ...) -> int: ... - @overload - def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value]) -> int: ... - @overload - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value]) -> int: ... - def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... - def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... - def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... - def hvals(self, name: _Key) -> list[_StrType]: ... - def publish(self, channel: _Key, message: _Key) -> int: ... - def eval(self, script, numkeys, *keys_and_args): ... - def evalsha(self, sha, numkeys, *keys_and_args): ... - def script_exists(self, *args): ... - def script_flush(self): ... - def script_kill(self): ... - def script_load(self, script): ... - def register_script(self, script: Text | _StrType) -> Script: ... - def pubsub_channels(self, pattern: _Key = ...) -> list[Text]: ... - def pubsub_numsub(self, *args: _Key) -> list[Tuple[Text, int]]: ... - def pubsub_numpat(self) -> int: ... + def pubsub(self, *, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ... + def execute_command(self, *args, **options: _CommandOptions): ... + def parse_response(self, connection, command_name, **options: _ParseResponseOptions): ... def monitor(self) -> Monitor: ... - def memory_stats(self) -> dict[str, Any]: ... - def memory_purge(self) -> bool: ... - def cluster(self, cluster_arg: str, *args: Any) -> Any: ... def __enter__(self) -> Redis[_StrType]: ... def __exit__(self, exc_type, exc_value, traceback): ... def __del__(self) -> None: ... @@ -772,27 +319,37 @@ class Redis(Generic[_StrType]): StrictRedis = Redis class PubSub: - PUBLISH_MESSAGE_TYPES: Any - UNSUBSCRIBE_MESSAGE_TYPES: Any + PUBLISH_MESSAGE_TYPES: ClassVar[tuple[str, str]] + UNSUBSCRIBE_MESSAGE_TYPES: ClassVar[tuple[str, str]] + HEALTH_CHECK_MESSAGE: ClassVar[str] connection_pool: Any shard_hint: Any ignore_subscribe_messages: Any connection: Any - encoding: Any - encoding_errors: Any - decode_responses: Any - def __init__(self, connection_pool, shard_hint=..., ignore_subscribe_messages=...) -> None: ... + subscribed_event: threading.Event + encoder: Any + health_check_response_b: bytes + health_check_response: list[str] | list[bytes] + def __init__( + self, connection_pool, shard_hint: Any | None = ..., ignore_subscribe_messages: bool = ..., encoder: Any | None = ... + ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None + ) -> None: ... def __del__(self): ... channels: Any patterns: Any def reset(self): ... def close(self) -> None: ... def on_connect(self, connection): ... - def encode(self, value): ... @property def subscribed(self): ... - def execute_command(self, *args, **kwargs): ... - def parse_response(self, block=...): ... + def execute_command(self, *args): ... + def clean_health_check_responses(self) -> None: ... + def parse_response(self, block: bool = ..., timeout: float = ...): ... + def is_health_check_response(self, response) -> bool: ... + def check_health(self) -> None: ... def psubscribe(self, *args: _Key, **kwargs: Callable[[Any], None]): ... def punsubscribe(self, *args: _Key) -> None: ... def subscribe(self, *args: _Key, **kwargs: Callable[[Any], None]) -> None: ... @@ -800,9 +357,18 @@ class PubSub: def listen(self): ... def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...) -> dict[str, Any] | None: ... def handle_message(self, response, ignore_subscribe_messages: bool = ...) -> dict[str, Any] | None: ... - def run_in_thread(self, sleep_time=...): ... + def run_in_thread(self, sleep_time: float = ..., daemon: bool = ..., exception_handler: Any | None = ...): ... def ping(self, message: _Value | None = ...) -> None: ... +class PubSubWorkerThread(threading.Thread): + daemon: Any + pubsub: Any + sleep_time: Any + exception_handler: Any + def __init__(self, pubsub, sleep_time, daemon: bool = ..., exception_handler: Any | None = ...) -> None: ... + def run(self) -> None: ... + def stop(self) -> None: ... + class Pipeline(Redis[_StrType], Generic[_StrType]): UNWATCH_COMMANDS: Any connection_pool: Any @@ -816,11 +382,12 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): scripts: Any explicit_transaction: Any def __init__(self, connection_pool, response_callbacks, transaction, shard_hint) -> None: ... - def __enter__(self) -> Pipeline[_StrType]: ... # type: ignore + def __enter__(self) -> Pipeline[_StrType]: ... # type: ignore[override] def __exit__(self, exc_type, exc_value, traceback) -> None: ... def __del__(self) -> None: ... def __len__(self) -> int: ... def __bool__(self) -> bool: ... + def discard(self) -> None: ... def reset(self) -> None: ... def multi(self) -> None: ... def execute_command(self, *args, **options): ... @@ -835,104 +402,102 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def unwatch(self) -> bool: ... # in the Redis implementation, the following methods are inherited from client. def set_response_callback(self, command, callback): ... - def pipeline(self, transaction: bool = ..., shard_hint: Any = ...) -> Pipeline[_StrType]: ... # type: ignore - def lock(self, name, timeout=..., sleep=..., blocking_timeout=..., lock_class=..., thread_local=...): ... - def pubsub(self, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ... - def acl_cat(self, category: Text | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def acl_deluser(self, username: Text) -> Pipeline[_StrType]: ... # type: ignore - def acl_genpass(self) -> Pipeline[_StrType]: ... # type: ignore - def acl_getuser(self, username: Text) -> Pipeline[_StrType]: ... # type: ignore - def acl_list(self) -> Pipeline[_StrType]: ... # type: ignore - def acl_load(self) -> Pipeline[_StrType]: ... # type: ignore - def acl_setuser( # type: ignore + def pipeline(self, transaction: bool = ..., shard_hint: Any = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_cat(self, category: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_deluser(self, username: str) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_genpass(self, bits: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_getuser(self, username: str) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_list(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_load(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_setuser( # type: ignore[override] self, - username: Text = ..., + username: str, enabled: bool = ..., nopass: bool = ..., - passwords: Sequence[Text] | None = ..., - hashed_passwords: Sequence[Text] | None = ..., - categories: Sequence[Text] | None = ..., - commands: Sequence[Text] | None = ..., - keys: Sequence[Text] | None = ..., + passwords: Sequence[str] | None = ..., + hashed_passwords: Sequence[str] | None = ..., + categories: Sequence[str] | None = ..., + commands: Sequence[str] | None = ..., + keys: Sequence[str] | None = ..., + channels: Iterable[ChannelT] | None = ..., + selectors: Iterable[tuple[str, KeyT]] | None = ..., reset: bool = ..., reset_keys: bool = ..., reset_passwords: bool = ..., ) -> Pipeline[_StrType]: ... - def acl_users(self) -> Pipeline[_StrType]: ... # type: ignore - def acl_whoami(self) -> Pipeline[_StrType]: ... # type: ignore - def bgrewriteaof(self) -> Pipeline[_StrType]: ... # type: ignore - def bgsave(self) -> Pipeline[_StrType]: ... # type: ignore - def client_id(self) -> Pipeline[_StrType]: ... # type: ignore - def client_kill(self, address: Text) -> Pipeline[_StrType]: ... # type: ignore - def client_list(self) -> Pipeline[_StrType]: ... # type: ignore - def client_getname(self) -> Pipeline[_StrType]: ... # type: ignore - def client_setname(self, name: Text) -> Pipeline[_StrType]: ... # type: ignore - def readwrite(self) -> Pipeline[_StrType]: ... # type: ignore - def readonly(self) -> Pipeline[_StrType]: ... # type: ignore - def config_get(self, pattern=...) -> Pipeline[_StrType]: ... # type: ignore - def config_set(self, name, value) -> Pipeline[_StrType]: ... # type: ignore - def config_resetstat(self) -> Pipeline[_StrType]: ... # type: ignore - def config_rewrite(self) -> Pipeline[_StrType]: ... # type: ignore - def dbsize(self) -> Pipeline[_StrType]: ... # type: ignore - def debug_object(self, key) -> Pipeline[_StrType]: ... # type: ignore - def echo(self, value) -> Pipeline[_StrType]: ... # type: ignore - def flushall(self) -> Pipeline[_StrType]: ... # type: ignore - def flushdb(self) -> Pipeline[_StrType]: ... # type: ignore - def info(self, section: _Key | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def lastsave(self) -> Pipeline[_StrType]: ... # type: ignore - def object(self, infotype, key) -> Pipeline[_StrType]: ... # type: ignore - def ping(self) -> Pipeline[_StrType]: ... # type: ignore - def save(self) -> Pipeline[_StrType]: ... # type: ignore - def sentinel(self, *args) -> None: ... - def sentinel_get_master_addr_by_name(self, service_name) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_master(self, service_name) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_masters(self) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_monitor(self, name, ip, port, quorum) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_remove(self, name) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_sentinels(self, service_name) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_set(self, name, option, value) -> Pipeline[_StrType]: ... # type: ignore - def sentinel_slaves(self, service_name) -> Pipeline[_StrType]: ... # type: ignore - def shutdown(self) -> None: ... - def slaveof(self, host=..., port=...) -> Pipeline[_StrType]: ... # type: ignore - def slowlog_get(self, num=...) -> Pipeline[_StrType]: ... # type: ignore - def slowlog_len(self) -> Pipeline[_StrType]: ... # type: ignore - def slowlog_reset(self) -> Pipeline[_StrType]: ... # type: ignore - def time(self) -> Pipeline[_StrType]: ... # type: ignore - def append(self, key, value) -> Pipeline[_StrType]: ... # type: ignore - def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def bitop(self, operation, dest, *keys) -> Pipeline[_StrType]: ... # type: ignore - def bitpos(self, key, bit, start=..., end=...) -> Pipeline[_StrType]: ... # type: ignore - def decr(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore - def delete(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore + def acl_users(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def acl_whoami(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def bgrewriteaof(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def bgsave(self, schedule: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def client_id(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def client_kill(self, address: str) -> Pipeline[_StrType]: ... # type: ignore[override] + def client_list(self, _type: str | None = ..., client_id: list[str] = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def client_getname(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def client_setname(self, name: str) -> Pipeline[_StrType]: ... # type: ignore[override] + def readwrite(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def readonly(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def config_get(self, pattern: PatternT = ..., *args: PatternT, **kwargs: _CommandOptions) -> Pipeline[_StrType]: ... # type: ignore[override] + def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions) -> Pipeline[_StrType]: ... # type: ignore[override] + def config_resetstat(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def config_rewrite(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def dbsize(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def debug_object(self, key) -> Pipeline[_StrType]: ... # type: ignore[override] + def echo(self, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def flushall(self, asynchronous: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def flushdb(self, asynchronous: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def info(self, section: _Key | None = ..., *args: _Key, **kwargs: _CommandOptions) -> Pipeline[_StrType]: ... # type: ignore[override] + def lastsave(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def object(self, infotype, key) -> Pipeline[_StrType]: ... # type: ignore[override] + def ping(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def save(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_get_master_addr_by_name(self, service_name) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_master(self, service_name) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_masters(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_monitor(self, name, ip, port, quorum) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_remove(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_sentinels(self, service_name) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_set(self, name, option, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def sentinel_slaves(self, service_name) -> Pipeline[_StrType]: ... # type: ignore[override] + def slaveof(self, host=..., port=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def slowlog_get(self, num=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def slowlog_len(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def slowlog_reset(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def time(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def append(self, key, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def bitop(self, operation, dest, *keys) -> Pipeline[_StrType]: ... # type: ignore[override] + def bitpos(self, key, bit, start=..., end=..., mode: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def decr(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def delete(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] def __delitem__(self, _Key) -> None: ... - def dump(self, name) -> Pipeline[_StrType]: ... # type: ignore - def exists(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore - def __contains__(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore - def expire(self, name: _Key, time: int | timedelta) -> Pipeline[_StrType]: ... # type: ignore - def expireat(self, name, when) -> Pipeline[_StrType]: ... # type: ignore - def get(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def __getitem__(self, name) -> Pipeline[_StrType]: ... # type: ignore - def getbit(self, name: _Key, offset: int) -> Pipeline[_StrType]: ... # type: ignore - def getrange(self, key, start, end) -> Pipeline[_StrType]: ... # type: ignore - def getset(self, name, value) -> Pipeline[_StrType]: ... # type: ignore - def incr(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore - def incrby(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore - def incrbyfloat(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore - def keys(self, pattern: _Key = ...) -> Pipeline[_StrType]: ... # type: ignore - def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def mset(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore - def msetnx(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore - def move(self, name: _Key, db: int) -> Pipeline[_StrType]: ... # type: ignore - def persist(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def pexpire(self, name: _Key, time: int | timedelta) -> Pipeline[_StrType]: ... # type: ignore - def pexpireat(self, name: _Key, when: int | datetime) -> Pipeline[_StrType]: ... # type: ignore - def psetex(self, name, time_ms, value) -> Pipeline[_StrType]: ... # type: ignore - def pttl(self, name) -> Pipeline[_StrType]: ... # type: ignore - def randomkey(self) -> Pipeline[_StrType]: ... # type: ignore - def rename(self, src, dst) -> Pipeline[_StrType]: ... # type: ignore - def renamenx(self, src, dst) -> Pipeline[_StrType]: ... # type: ignore - def restore(self, name, ttl, value, replace: bool = ...) -> Pipeline[_StrType]: ... # type: ignore - def set( # type: ignore + def dump(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def exists(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def __contains__(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def expire(self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def get(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def __getitem__(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def getbit(self, name: _Key, offset: int) -> Pipeline[_StrType]: ... # type: ignore[override] + def getrange(self, key, start, end) -> Pipeline[_StrType]: ... # type: ignore[override] + def getset(self, name, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def incr(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def incrby(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def incrbyfloat(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def keys(self, pattern: _Key = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def mset(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] + def msetnx(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] + def move(self, name: _Key, db: int) -> Pipeline[_StrType]: ... # type: ignore[override] + def persist(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def pexpire(self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def pexpireat(self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def psetex(self, name, time_ms, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def pttl(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def randomkey(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def rename(self, src, dst) -> Pipeline[_StrType]: ... # type: ignore[override] + def renamenx(self, src, dst) -> Pipeline[_StrType]: ... # type: ignore[override] + def restore(self, name, ttl, value, replace: bool = ..., absttl: bool = ..., idletime: Any | None = ..., frequency: Any | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def set( # type: ignore[override] self, name: _Key, value: _Value, @@ -941,37 +506,51 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): nx: bool = ..., xx: bool = ..., keepttl: bool = ..., + get: bool = ..., + exat: Any | None = ..., + pxat: Any | None = ..., ) -> Pipeline[_StrType]: ... def __setitem__(self, name, value) -> None: ... - def setbit(self, name: _Key, offset: int, value: int) -> Pipeline[_StrType]: ... # type: ignore - def setex(self, name: _Key, time: int | timedelta, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def setnx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore - def setrange(self, name, offset, value) -> Pipeline[_StrType]: ... # type: ignore - def strlen(self, name) -> Pipeline[_StrType]: ... # type: ignore - def substr(self, name, start, end=...) -> Pipeline[_StrType]: ... # type: ignore - def ttl(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def type(self, name) -> Pipeline[_StrType]: ... # type: ignore - def unlink(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore - def blpop(self, keys: _Value | Iterable[_Value], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore - def brpop(self, keys: _Value | Iterable[_Value], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore - def brpoplpush(self, src, dst, timeout=...) -> Pipeline[_StrType]: ... # type: ignore - def lindex(self, name: _Key, index: int) -> Pipeline[_StrType]: ... # type: ignore - def linsert( # type: ignore + def setbit(self, name: _Key, offset: int, value: int) -> Pipeline[_StrType]: ... # type: ignore[override] + def setex(self, name: _Key, time: int | timedelta, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def setnx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def setrange(self, name, offset, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def strlen(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def substr(self, name, start, end=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def ttl(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def type(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def unlink(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def blmove( # type: ignore[override] + self, + first_list: _Key, + second_list: _Key, + timeout: float, + src: Literal["LEFT", "RIGHT"] = ..., + dest: Literal["LEFT", "RIGHT"] = ..., + ) -> Pipeline[_StrType]: ... + def blpop(self, keys: _Value | Iterable[_Value], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def brpop(self, keys: _Value | Iterable[_Value], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def brpoplpush(self, src, dst, timeout=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def lindex(self, name: _Key, index: int) -> Pipeline[_StrType]: ... # type: ignore[override] + def linsert( # type: ignore[override] self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value ) -> Pipeline[_StrType]: ... - def llen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def lpop(self, name) -> Pipeline[_StrType]: ... # type: ignore - def lpush(self, name: _Value, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore - def lpushx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore - def lrange(self, name: _Key, start: int, end: int) -> Pipeline[_StrType]: ... # type: ignore - def lrem(self, name: _Key, count: int, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def lset(self, name: _Key, index: int, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def ltrim(self, name: _Key, start: int, end: int) -> Pipeline[_StrType]: ... # type: ignore - def rpop(self, name) -> Pipeline[_StrType]: ... # type: ignore - def rpoplpush(self, src, dst) -> Pipeline[_StrType]: ... # type: ignore - def rpush(self, name: _Value, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore - def rpushx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore - def sort( # type: ignore + def llen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def lmove( # type: ignore[override] + self, first_list: _Key, second_list: _Key, src: Literal["LEFT", "RIGHT"] = ..., dest: Literal["LEFT", "RIGHT"] = ... + ) -> Pipeline[_StrType]: ... + def lpop(self, name, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def lpush(self, name: _Value, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def lpushx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def lrange(self, name: _Key, start: int, end: int) -> Pipeline[_StrType]: ... # type: ignore[override] + def lrem(self, name: _Key, count: int, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def lset(self, name: _Key, index: int, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def ltrim(self, name: _Key, start: int, end: int) -> Pipeline[_StrType]: ... # type: ignore[override] + def rpop(self, name, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def rpoplpush(self, src, dst) -> Pipeline[_StrType]: ... # type: ignore[override] + def rpush(self, name: _Value, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def rpushx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore[override] + def sort( # type: ignore[override] self, name: _Key, start: int | None = ..., @@ -983,72 +562,86 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): store: _Key | None = ..., groups: bool = ..., ) -> Pipeline[_StrType]: ... - def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def scan_iter(self, match: Text | None = ..., count: int | None = ...) -> Iterator[Any]: ... - def sscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Pipeline[_StrType]: ... # type: ignore - def sscan_iter(self, name, match=..., count=...) -> Iterator[Any]: ... - def hscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Pipeline[_StrType]: ... # type: ignore - def hscan_iter(self, name, match=..., count=...) -> Iterator[Any]: ... - def zscan(self, name, cursor=..., match=..., count=..., score_cast_func=...) -> Pipeline[_StrType]: ... # type: ignore - def zscan_iter(self, name, match=..., count=..., score_cast_func=...) -> Iterator[Any]: ... - def sadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore - def scard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def sismember(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def smembers(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def smove(self, src: _Key, dst: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def spop(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def srandmember(self, name: _Key, number: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def srem(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore - def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def xack(self, name, groupname, *ids) -> Pipeline[_StrType]: ... # type: ignore - def xadd(self, name, fields, id=..., maxlen=..., approximate=...) -> Pipeline[_StrType]: ... # type: ignore + def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ..., _type: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def scan_iter(self, match: _Key | None = ..., count: int | None = ..., _type: str | None = ...) -> Iterator[Any]: ... # type: ignore[override] + def sscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def sscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> Iterator[Any]: ... + def hscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def hscan_iter(self, name, match: _Key | None = ..., count: int | None = ...) -> Iterator[Any]: ... + def zscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ..., score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def zscan_iter( + self, name: _Key, match: _Key | None = ..., count: int | None = ..., score_cast_func: Callable[[_StrType], Any] = ... + ) -> Iterator[Any]: ... + def sadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def scard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def sismember(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def smembers(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def smove(self, src: _Key, dst: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def spop(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def srandmember(self, name: _Key, number: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def srem(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def xack(self, name, groupname, *ids) -> Pipeline[_StrType]: ... # type: ignore[override] + def xadd(self, name, fields, id=..., maxlen=..., approximate: bool = ..., nomkstream: bool = ..., minid: Any | None = ..., limit: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def xclaim( self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=... - ) -> Pipeline[_StrType]: ... # type: ignore - def xdel(self, name, *ids) -> Pipeline[_StrType]: ... # type: ignore - def xgroup_create(self, name, groupname, id=..., mkstream=...) -> Pipeline[_StrType]: ... # type: ignore - def xgroup_delconsumer(self, name, groupname, consumername) -> Pipeline[_StrType]: ... # type: ignore - def xgroup_destroy(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore - def xgroup_setid(self, name, groupname, id) -> Pipeline[_StrType]: ... # type: ignore - def xinfo_consumers(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore - def xinfo_groups(self, name) -> Pipeline[_StrType]: ... # type: ignore - def xinfo_stream(self, name) -> Pipeline[_StrType]: ... # type: ignore - def xlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def xpending(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore - def xpending_range(self, name, groupname, min, max, count, consumername=...) -> Pipeline[_StrType]: ... # type: ignore - def xrange(self, name, min=..., max=..., count=...) -> Pipeline[_StrType]: ... # type: ignore - def xread(self, streams, count=..., block=...) -> Pipeline[_StrType]: ... # type: ignore - def xreadgroup(self, groupname, consumername, streams, count=..., block=..., noack=...) -> Pipeline[_StrType]: ... # type: ignore - def xrevrange(self, name, max=..., min=..., count=...) -> Pipeline[_StrType]: ... # type: ignore - def xtrim(self, name, maxlen, approximate=...) -> Pipeline[_StrType]: ... # type: ignore - def zadd( # type: ignore - self, name: _Key, mapping: Mapping[_Key, _Value], nx: bool = ..., xx: bool = ..., ch: bool = ..., incr: bool = ... + ) -> Pipeline[_StrType]: ... # type: ignore[override] + def xdel(self, name, *ids) -> Pipeline[_StrType]: ... # type: ignore[override] + def xgroup_create(self, name, groupname, id=..., mkstream=..., entries_read: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xgroup_delconsumer(self, name, groupname, consumername) -> Pipeline[_StrType]: ... # type: ignore[override] + def xgroup_destroy(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore[override] + def xgroup_setid(self, name, groupname, id, entries_read: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xinfo_consumers(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore[override] + def xinfo_groups(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] + def xinfo_stream(self, name, full: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def xpending(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore[override] + def xpending_range(self, name: _Key, groupname, min, max, count: int, consumername: Any | None = ..., idle: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xrange(self, name, min=..., max=..., count=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xread(self, streams, count=..., block=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xreadgroup(self, groupname, consumername, streams, count=..., block=..., noack=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xrevrange(self, name, max=..., min=..., count=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xtrim(self, name, maxlen: int | None = ..., approximate: bool = ..., minid: Incomplete | None = ..., limit: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def zadd( # type: ignore[override] + self, + name: _Key, + mapping: Mapping[_Key, _Value], + nx: bool = ..., + xx: bool = ..., + ch: bool = ..., + incr: bool = ..., + gt: Any | None = ..., + lt: Any | None = ..., ) -> Pipeline[_StrType]: ... - def zcard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def zcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zincrby(self, name: _Key, amount: float, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> Pipeline[_StrType]: ... # type: ignore - def zlexcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zpopmax(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def zpopmin(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore - def zrange( # type: ignore + def zcard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def zcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zincrby(self, name: _Key, amount: float, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def zlexcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zpopmax(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def zpopmin(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def zrange( # type: ignore[override] self, name: _Key, start: int, end: int, desc: bool = ..., withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., ) -> Pipeline[_StrType]: ... - def zrangebylex(self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore - def zrangebyscore( # type: ignore + def zrangebylex(self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def zrangebyscore( # type: ignore[override] self, name: _Key, min: _Value, @@ -1056,84 +649,76 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): start: int | None = ..., num: int | None = ..., withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., + score_cast_func: Callable[[_StrType], Any] = ..., ) -> Pipeline[_StrType]: ... - def zrank(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zrem(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zremrangebyrank(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zrevrange( # type: ignore - self, - name: _Key, - start: int, - end: int, - desc: bool = ..., - withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., + def zrank(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zrem(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zremrangebyrank(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zrevrange( # type: ignore[override] + self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[_StrType], Any] = ... ) -> Pipeline[_StrType]: ... - def zrevrangebyscore( # type: ignore + def zrevrangebyscore( # type: ignore[override] self, name: _Key, - min: _Value, max: _Value, + min: _Value, start: int | None = ..., num: int | None = ..., withscores: bool = ..., - score_cast_func: Callable[[Any], Any] = ..., + score_cast_func: Callable[[_StrType], Any] = ..., ) -> Pipeline[_StrType]: ... - def zrevrangebylex( # type: ignore - self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... + def zrevrangebylex( # type: ignore[override] + self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ... ) -> Pipeline[_StrType]: ... - def zrevrank(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zscore(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> Pipeline[_StrType]: ... # type: ignore - def pfadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore - def pfcount(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def pfmerge(self, dest: _Key, *sources: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hdel(self, name: _Key, *keys: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hexists(self, name: _Key, key: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hget(self, name: _Key, key: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hgetall(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> Pipeline[_StrType]: ... # type: ignore - def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> Pipeline[_StrType]: ... # type: ignore - def hkeys(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - @overload # type: ignore - def hset(self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ...) -> Pipeline[_StrType]: ... - @overload # type: ignore - def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... - @overload # type: ignore - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... - def hsetnx(self, name: _Key, key: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore - def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore - def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def hvals(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore - def publish(self, channel: _Key, message: _Key) -> Pipeline[_StrType]: ... # type: ignore - def eval(self, script, numkeys, *keys_and_args) -> Pipeline[_StrType]: ... # type: ignore - def evalsha(self, sha, numkeys, *keys_and_args) -> Pipeline[_StrType]: ... # type: ignore - def script_exists(self, *args) -> Pipeline[_StrType]: ... # type: ignore - def script_flush(self) -> Pipeline[_StrType]: ... # type: ignore - def script_kill(self) -> Pipeline[_StrType]: ... # type: ignore - def script_load(self, script) -> Pipeline[_StrType]: ... # type: ignore - def register_script(self, script: Text | _StrType) -> Script: ... - def pubsub_channels(self, pattern: _Key = ...) -> Pipeline[_StrType]: ... # type: ignore - def pubsub_numsub(self, *args: _Key) -> Pipeline[_StrType]: ... # type: ignore - def pubsub_numpat(self) -> Pipeline[_StrType]: ... # type: ignore + def zrevrank(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zscore(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def pfadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def pfcount(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def pfmerge(self, dest: _Key, *sources: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hdel(self, name: _Key, *keys: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hexists(self, name: _Key, key: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hget(self, name: _Key, key: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hgetall(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def hkeys(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + @overload # type: ignore[override] + def hset( + self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Any | None = ... + ) -> Pipeline[_StrType]: ... + @overload # type: ignore[override] + def hset( + self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Any | None = ... + ) -> Pipeline[_StrType]: ... + @overload # type: ignore[override] + def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> Pipeline[_StrType]: ... + def hsetnx(self, name: _Key, key: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] + def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] + def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def hvals(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def publish(self, channel: _Key, message: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def eval(self, script, numkeys, *keys_and_args) -> Pipeline[_StrType]: ... # type: ignore[override] + def evalsha(self, sha, numkeys, *keys_and_args) -> Pipeline[_StrType]: ... # type: ignore[override] + def script_exists(self, *args) -> Pipeline[_StrType]: ... # type: ignore[override] + def script_flush(self, sync_type: Any | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def script_kill(self) -> Pipeline[_StrType]: ... # type: ignore[override] + def script_load(self, script) -> Pipeline[_StrType]: ... # type: ignore[override] + def pubsub_channels(self, pattern: _Key = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def pubsub_numsub(self, *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] + def pubsub_numpat(self) -> Pipeline[_StrType]: ... # type: ignore[override] def monitor(self) -> Monitor: ... - def cluster(self, cluster_arg: str, *args: Any) -> Pipeline[_StrType]: ... # type: ignore + def cluster(self, cluster_arg: str, *args: Any) -> Pipeline[_StrType]: ... # type: ignore[override] def client(self) -> Any: ... -class Script: - registered_client: Any - script: Any - sha: Any - def __init__(self, registered_client, script) -> None: ... - def __call__(self, keys=..., args=..., client=...): ... - -class Monitor(object): +class Monitor: + command_re: Pattern[str] + monitor_re: Pattern[str] def __init__(self, connection_pool) -> None: ... - def __enter__(self) -> Monitor: ... - def __exit__(self, *args: Any) -> None: ... - def next_command(self) -> dict[Text, Any]: ... - def listen(self) -> Iterable[dict[Text, Any]]: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... + def next_command(self) -> dict[str, Any]: ... + def listen(self) -> Iterable[dict[str, Any]]: ... diff --git a/stubs/redis/redis/cluster.pyi b/stubs/redis/redis/cluster.pyi new file mode 100644 index 0000000..1927724 --- /dev/null +++ b/stubs/redis/redis/cluster.pyi @@ -0,0 +1,255 @@ +from _typeshed import Incomplete, Self +from collections.abc import Callable, Iterable, Sequence +from threading import Lock +from types import TracebackType +from typing import Any, ClassVar, Generic, NoReturn, Protocol +from typing_extensions import Literal + +from redis.client import CaseInsensitiveDict, PubSub, Redis, _ParseResponseOptions +from redis.commands import CommandsParser, RedisClusterCommands +from redis.commands.core import _StrType +from redis.connection import BaseParser, Connection, ConnectionPool, Encoder, _ConnectionPoolOptions, _Encodable +from redis.exceptions import MovedError, RedisError +from redis.typing import EncodableT + +def get_node_name(host: str, port: str | int) -> str: ... +def get_connection(redis_node: Redis[Any], *args, **options: _ConnectionPoolOptions) -> Connection: ... +def parse_scan_result(command: object, res, **options): ... +def parse_pubsub_numsub(command: object, res, **options: object): ... +def parse_cluster_slots(resp, **options) -> dict[tuple[int, int], dict[str, Any]]: ... + +PRIMARY: str +REPLICA: str +SLOT_ID: str +REDIS_ALLOWED_KEYS: tuple[str, ...] +KWARGS_DISABLED_KEYS: tuple[str, ...] +PIPELINE_BLOCKED_COMMANDS: tuple[str, ...] + +def cleanup_kwargs(**kwargs: Any) -> dict[str, Any]: ... + +# It uses `DefaultParser` in real life, but it is a dynamic base class. +class ClusterParser(BaseParser): ... + +class AbstractRedisCluster: + RedisClusterRequestTTL: ClassVar[int] + PRIMARIES: ClassVar[str] + REPLICAS: ClassVar[str] + ALL_NODES: ClassVar[str] + RANDOM: ClassVar[str] + DEFAULT_NODE: ClassVar[str] + NODE_FLAGS: ClassVar[set[str]] + COMMAND_FLAGS: ClassVar[dict[str, str]] + CLUSTER_COMMANDS_RESPONSE_CALLBACKS: ClassVar[dict[str, Any]] + RESULT_CALLBACKS: ClassVar[dict[str, Callable[[Incomplete, Incomplete], Incomplete]]] + ERRORS_ALLOW_RETRY: ClassVar[tuple[type[RedisError], ...]] + +class RedisCluster(AbstractRedisCluster, RedisClusterCommands[_StrType], Generic[_StrType]): + user_on_connect_func: Callable[[Connection], object] | None + encoder: Encoder + cluster_error_retry_attempts: int + command_flags: dict[str, str] + node_flags: set[str] + read_from_replicas: bool + reinitialize_counter: int + reinitialize_steps: int + nodes_manager: NodesManager + cluster_response_callbacks: CaseInsensitiveDict[str, Callable[..., Incomplete]] + result_callbacks: CaseInsensitiveDict[str, Callable[[Incomplete, Incomplete], Incomplete]] + commands_parser: CommandsParser + def __init__( # TODO: make @overloads, either `url` or `host:port` can be passed + self, + host: str | None = ..., + port: int | None = ..., + startup_nodes: list[ClusterNode] | None = ..., + cluster_error_retry_attempts: int = ..., + require_full_coverage: bool = ..., + reinitialize_steps: int = ..., + read_from_replicas: bool = ..., + dynamic_startup_nodes: bool = ..., + url: str | None = ..., + **kwargs, + ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + def __del__(self) -> None: ... + def disconnect_connection_pools(self) -> None: ... + @classmethod + def from_url(cls: type[Self], url: str, **kwargs) -> Self: ... + def on_connect(self, connection: Connection) -> None: ... + def get_redis_connection(self, node: ClusterNode) -> Redis[Any]: ... + def get_node( + self, host: str | None = ..., port: str | int | None = ..., node_name: str | None = ... + ) -> ClusterNode | None: ... + def get_primaries(self) -> list[ClusterNode]: ... + def get_replicas(self) -> list[ClusterNode]: ... + def get_random_node(self) -> ClusterNode: ... + def get_nodes(self) -> list[ClusterNode]: ... + def get_node_from_key(self, key: _Encodable, replica: bool = ...) -> ClusterNode | None: ... + def get_default_node(self) -> ClusterNode | None: ... + def set_default_node(self, node: ClusterNode | None) -> bool: ... + def monitor(self, target_node: Any | None = ...): ... + def pubsub(self, node: Any | None = ..., host: Any | None = ..., port: Any | None = ..., **kwargs): ... + def pipeline(self, transaction: Any | None = ..., shard_hint: Any | None = ...): ... + def lock( + self, + name: str, + timeout: float | None = ..., + sleep: float = ..., + blocking: bool = ..., + blocking_timeout: float | None = ..., + lock_class: type[Incomplete] | None = ..., + thread_local: bool = ..., + ): ... + def keyslot(self, key: _Encodable) -> int: ... + def determine_slot(self, *args): ... + def get_encoder(self) -> Encoder: ... + def get_connection_kwargs(self) -> dict[str, Any]: ... + def execute_command(self, *args, **kwargs): ... + def close(self) -> None: ... + +class ClusterNode: + host: str + port: int + name: str + server_type: str | None + redis_connection: Redis[Incomplete] | None + def __init__( + self, host: str, port: int, server_type: str | None = ..., redis_connection: Redis[Incomplete] | None = ... + ) -> None: ... + def __eq__(self, obj: object) -> bool: ... + def __del__(self) -> None: ... + +class LoadBalancer: + primary_to_idx: dict[str, int] + start_index: int + def __init__(self, start_index: int = ...) -> None: ... + def get_server_index(self, primary: str, list_size: int) -> int: ... + def reset(self) -> None: ... + +class NodesManager: + nodes_cache: dict[str, ClusterNode] + slots_cache: dict[str, list[ClusterNode]] + startup_nodes: dict[str, ClusterNode] + default_node: ClusterNode | None + from_url: bool + connection_kwargs: dict[str, Any] + read_load_balancer: LoadBalancer + def __init__( + self, + startup_nodes: Iterable[ClusterNode], + from_url: bool = ..., + require_full_coverage: bool = ..., + lock: Lock | None = ..., + dynamic_startup_nodes: bool = ..., + **kwargs: Any, + ) -> None: ... + def get_node( + self, host: str | None = ..., port: int | str | None = ..., node_name: str | None = ... + ) -> ClusterNode | None: ... + def update_moved_exception(self, exception: MovedError) -> None: ... + def get_node_from_slot(self, slot: str, read_from_replicas: bool = ..., server_type: str | None = ...) -> ClusterNode: ... + def get_nodes_by_server_type(self, server_type: str) -> list[ClusterNode]: ... + def populate_startup_nodes(self, nodes: Iterable[ClusterNode]) -> None: ... + def check_slots_coverage(self, slots_cache: dict[str, list[ClusterNode]]) -> bool: ... + def create_redis_connections(self, nodes: Iterable[ClusterNode]) -> None: ... + def create_redis_node(self, host: str, port: int | str, **kwargs: Any) -> Redis[Incomplete]: ... + def initialize(self) -> None: ... + def close(self) -> None: ... + def reset(self) -> None: ... + +class ClusterPubSub(PubSub): + node: ClusterNode | None + cluster: RedisCluster[Any] + def __init__( + self, + redis_cluster: RedisCluster[Any], + node: ClusterNode | None = ..., + host: str | None = ..., + port: int | None = ..., + **kwargs, + ) -> None: ... + def set_pubsub_node( + self, cluster: RedisCluster[Any], node: ClusterNode | None = ..., host: str | None = ..., port: int | None = ... + ) -> None: ... + def get_pubsub_node(self) -> ClusterNode | None: ... + def execute_command(self, *args, **kwargs) -> None: ... + def get_redis_connection(self) -> Redis[Any] | None: ... + +class ClusterPipeline(RedisCluster[_StrType], Generic[_StrType]): + command_stack: list[Incomplete] + nodes_manager: Incomplete + refresh_table_asap: bool + result_callbacks: Incomplete + startup_nodes: Incomplete + read_from_replicas: bool + command_flags: Incomplete + cluster_response_callbacks: Incomplete + cluster_error_retry_attempts: int + reinitialize_counter: int + reinitialize_steps: int + encoder: Encoder + commands_parser: Incomplete + def __init__( + self, + nodes_manager, + commands_parser, + result_callbacks: Incomplete | None = ..., + cluster_response_callbacks: Incomplete | None = ..., + startup_nodes: Incomplete | None = ..., + read_from_replicas: bool = ..., + cluster_error_retry_attempts: int = ..., + reinitialize_steps: int = ..., + lock: Lock | None = ..., + **kwargs, + ) -> None: ... + def __len__(self) -> int: ... + def __nonzero__(self) -> Literal[True]: ... + def __bool__(self) -> Literal[True]: ... + def execute_command(self, *args, **kwargs): ... + def pipeline_execute_command(self, *args, **options): ... + def raise_first_error(self, stack) -> None: ... + def annotate_exception(self, exception, number, command) -> None: ... + def execute(self, raise_on_error: bool = ...): ... + scripts: set[Any] # is only set in `reset()` + watching: bool # is only set in `reset()` + explicit_transaction: bool # is only set in `reset()` + def reset(self) -> None: ... + def send_cluster_commands(self, stack, raise_on_error: bool = ..., allow_redirections: bool = ...): ... + def eval(self) -> None: ... + def multi(self) -> None: ... + def immediate_execute_command(self, *args, **options) -> None: ... + def load_scripts(self) -> None: ... + def watch(self, *names) -> None: ... + def unwatch(self) -> None: ... + def script_load_for_pipeline(self, *args, **kwargs) -> None: ... + def delete(self, *names): ... + +def block_pipeline_command(name: str) -> Callable[..., NoReturn]: ... + +class PipelineCommand: + args: Sequence[EncodableT] + options: _ParseResponseOptions + position: int | None + result: Any | Exception | None + node: Incomplete | None + asking: bool + def __init__( + self, args: Sequence[EncodableT], options: _ParseResponseOptions | None = ..., position: int | None = ... + ) -> None: ... + +class _ParseResponseCallback(Protocol): + def __call__(self, __connection: Connection, __command: EncodableT, **kwargs: Incomplete) -> Any: ... + +class NodeCommands: + parse_response: _ParseResponseCallback + connection_pool: ConnectionPool + connection: Connection + commands: list[PipelineCommand] + def __init__( + self, parse_response: _ParseResponseCallback, connection_pool: ConnectionPool, connection: Connection + ) -> None: ... + def append(self, c: PipelineCommand) -> None: ... + def write(self) -> None: ... + def read(self) -> None: ... diff --git a/stubs/redis/redis/commands/__init__.pyi b/stubs/redis/redis/commands/__init__.pyi new file mode 100644 index 0000000..4959ea0 --- /dev/null +++ b/stubs/redis/redis/commands/__init__.pyi @@ -0,0 +1,17 @@ +from .cluster import RedisClusterCommands as RedisClusterCommands +from .core import AsyncCoreCommands as AsyncCoreCommands, CoreCommands as CoreCommands +from .helpers import list_or_args as list_or_args +from .parser import CommandsParser as CommandsParser +from .redismodules import RedisModuleCommands as RedisModuleCommands +from .sentinel import AsyncSentinelCommands as AsyncSentinelCommands, SentinelCommands as SentinelCommands + +__all__ = [ + "RedisClusterCommands", + "CommandsParser", + "AsyncCoreCommands", + "CoreCommands", + "list_or_args", + "RedisModuleCommands", + "AsyncSentinelCommands", + "SentinelCommands", +] diff --git a/stubs/redis/redis/commands/bf/__init__.pyi b/stubs/redis/redis/commands/bf/__init__.pyi new file mode 100644 index 0000000..d5ef70e --- /dev/null +++ b/stubs/redis/redis/commands/bf/__init__.pyi @@ -0,0 +1,58 @@ +from typing import Any + +from .commands import * +from .info import BFInfo as BFInfo, CFInfo as CFInfo, CMSInfo as CMSInfo, TDigestInfo as TDigestInfo, TopKInfo as TopKInfo + +class AbstractBloom: + @staticmethod + def append_items(params, items) -> None: ... + @staticmethod + def append_error(params, error) -> None: ... + @staticmethod + def append_capacity(params, capacity) -> None: ... + @staticmethod + def append_expansion(params, expansion) -> None: ... + @staticmethod + def append_no_scale(params, noScale) -> None: ... + @staticmethod + def append_weights(params, weights) -> None: ... + @staticmethod + def append_no_create(params, noCreate) -> None: ... + @staticmethod + def append_items_and_increments(params, items, increments) -> None: ... + @staticmethod + def append_values_and_weights(params, items, weights) -> None: ... + @staticmethod + def append_max_iterations(params, max_iterations) -> None: ... + @staticmethod + def append_bucket_size(params, bucket_size) -> None: ... + +class CMSBloom(CMSCommands, AbstractBloom): + client: Any + commandmixin: Any + execute_command: Any + def __init__(self, client, **kwargs) -> None: ... + +class TOPKBloom(TOPKCommands, AbstractBloom): + client: Any + commandmixin: Any + execute_command: Any + def __init__(self, client, **kwargs) -> None: ... + +class CFBloom(CFCommands, AbstractBloom): + client: Any + commandmixin: Any + execute_command: Any + def __init__(self, client, **kwargs) -> None: ... + +class TDigestBloom(TDigestCommands, AbstractBloom): + client: Any + commandmixin: Any + execute_command: Any + def __init__(self, client, **kwargs) -> None: ... + +class BFBloom(BFCommands, AbstractBloom): + client: Any + commandmixin: Any + execute_command: Any + def __init__(self, client, **kwargs) -> None: ... diff --git a/stubs/redis/redis/commands/bf/commands.pyi b/stubs/redis/redis/commands/bf/commands.pyi new file mode 100644 index 0000000..5036d11 --- /dev/null +++ b/stubs/redis/redis/commands/bf/commands.pyi @@ -0,0 +1,107 @@ +from typing import Any + +BF_RESERVE: str +BF_ADD: str +BF_MADD: str +BF_INSERT: str +BF_EXISTS: str +BF_MEXISTS: str +BF_SCANDUMP: str +BF_LOADCHUNK: str +BF_INFO: str +CF_RESERVE: str +CF_ADD: str +CF_ADDNX: str +CF_INSERT: str +CF_INSERTNX: str +CF_EXISTS: str +CF_DEL: str +CF_COUNT: str +CF_SCANDUMP: str +CF_LOADCHUNK: str +CF_INFO: str +CMS_INITBYDIM: str +CMS_INITBYPROB: str +CMS_INCRBY: str +CMS_QUERY: str +CMS_MERGE: str +CMS_INFO: str +TOPK_RESERVE: str +TOPK_ADD: str +TOPK_INCRBY: str +TOPK_QUERY: str +TOPK_COUNT: str +TOPK_LIST: str +TOPK_INFO: str +TDIGEST_CREATE: str +TDIGEST_RESET: str +TDIGEST_ADD: str +TDIGEST_MERGE: str +TDIGEST_CDF: str +TDIGEST_QUANTILE: str +TDIGEST_MIN: str +TDIGEST_MAX: str +TDIGEST_INFO: str + +class BFCommands: + def create(self, key, errorRate, capacity, expansion: Any | None = ..., noScale: Any | None = ...): ... + def add(self, key, item): ... + def madd(self, key, *items): ... + def insert( + self, + key, + items, + capacity: Any | None = ..., + error: Any | None = ..., + noCreate: Any | None = ..., + expansion: Any | None = ..., + noScale: Any | None = ..., + ): ... + def exists(self, key, item): ... + def mexists(self, key, *items): ... + def scandump(self, key, iter): ... + def loadchunk(self, key, iter, data): ... + def info(self, key): ... + +class CFCommands: + def create( + self, key, capacity, expansion: Any | None = ..., bucket_size: Any | None = ..., max_iterations: Any | None = ... + ): ... + def add(self, key, item): ... + def addnx(self, key, item): ... + def insert(self, key, items, capacity: Any | None = ..., nocreate: Any | None = ...): ... + def insertnx(self, key, items, capacity: Any | None = ..., nocreate: Any | None = ...): ... + def exists(self, key, item): ... + def delete(self, key, item): ... + def count(self, key, item): ... + def scandump(self, key, iter): ... + def loadchunk(self, key, iter, data): ... + def info(self, key): ... + +class TOPKCommands: + def reserve(self, key, k, width, depth, decay): ... + def add(self, key, *items): ... + def incrby(self, key, items, increments): ... + def query(self, key, *items): ... + def count(self, key, *items): ... + def list(self, key, withcount: bool = ...): ... + def info(self, key): ... + +class TDigestCommands: + def create(self, key, compression): ... + def reset(self, key): ... + def add(self, key, values, weights): ... + def merge(self, toKey, fromKey): ... + def min(self, key): ... + def max(self, key): ... + def quantile(self, key, quantile): ... + def cdf(self, key, value): ... + def info(self, key): ... + +class CMSCommands: + def initbydim(self, key, width, depth): ... + def initbyprob(self, key, error, probability): ... + def incrby(self, key, items, increments): ... + def query(self, key, *items): ... + def merge(self, destKey, numKeys, srcKeys, weights=...): ... + def info(self, key): ... diff --git a/stubs/redis/redis/commands/bf/info.pyi b/stubs/redis/redis/commands/bf/info.pyi new file mode 100644 index 0000000..54d1cf0 --- /dev/null +++ b/stubs/redis/redis/commands/bf/info.pyi @@ -0,0 +1,43 @@ +from typing import Any + +class BFInfo: + capacity: Any + size: Any + filterNum: Any + insertedNum: Any + expansionRate: Any + def __init__(self, args) -> None: ... + +class CFInfo: + size: Any + bucketNum: Any + filterNum: Any + insertedNum: Any + deletedNum: Any + bucketSize: Any + expansionRate: Any + maxIteration: Any + def __init__(self, args) -> None: ... + +class CMSInfo: + width: Any + depth: Any + count: Any + def __init__(self, args) -> None: ... + +class TopKInfo: + k: Any + width: Any + depth: Any + decay: Any + def __init__(self, args) -> None: ... + +class TDigestInfo: + compression: Any + capacity: Any + mergedNodes: Any + unmergedNodes: Any + mergedWeight: Any + unmergedWeight: Any + totalCompressions: Any + def __init__(self, args) -> None: ... diff --git a/stubs/redis/redis/commands/cluster.pyi b/stubs/redis/redis/commands/cluster.pyi new file mode 100644 index 0000000..66324ed --- /dev/null +++ b/stubs/redis/redis/commands/cluster.pyi @@ -0,0 +1,60 @@ +from typing import Any, Generic + +from .core import ACLCommands, DataAccessCommands, ManagementCommands, PubSubCommands, _StrType + +class ClusterMultiKeyCommands: + def mget_nonatomic(self, keys, *args): ... + def mset_nonatomic(self, mapping): ... + def exists(self, *keys): ... + def delete(self, *keys): ... + def touch(self, *keys): ... + def unlink(self, *keys): ... + +class ClusterManagementCommands(ManagementCommands): + def slaveof(self, *args, **kwargs) -> None: ... + def replicaof(self, *args, **kwargs) -> None: ... + def swapdb(self, *args, **kwargs) -> None: ... + +class ClusterDataAccessCommands(DataAccessCommands[_StrType], Generic[_StrType]): + def stralgo( + self, + algo, + value1, + value2, + specific_argument: str = ..., + len: bool = ..., + idx: bool = ..., + minmatchlen: Any | None = ..., + withmatchlen: bool = ..., + **kwargs, + ): ... + +class RedisClusterCommands( + ClusterMultiKeyCommands, + ClusterManagementCommands, + ACLCommands[_StrType], + PubSubCommands, + ClusterDataAccessCommands[_StrType], + Generic[_StrType], +): + def cluster_addslots(self, target_node, *slots): ... + def cluster_countkeysinslot(self, slot_id): ... + def cluster_count_failure_report(self, node_id): ... + def cluster_delslots(self, *slots): ... + def cluster_failover(self, target_node, option: Any | None = ...): ... + def cluster_info(self, target_nodes: Any | None = ...): ... + def cluster_keyslot(self, key): ... + def cluster_meet(self, host, port, target_nodes: Any | None = ...): ... + def cluster_nodes(self): ... + def cluster_replicate(self, target_nodes, node_id): ... + def cluster_reset(self, soft: bool = ..., target_nodes: Any | None = ...): ... + def cluster_save_config(self, target_nodes: Any | None = ...): ... + def cluster_get_keys_in_slot(self, slot, num_keys): ... + def cluster_set_config_epoch(self, epoch, target_nodes: Any | None = ...): ... + def cluster_setslot(self, target_node, node_id, slot_id, state): ... + def cluster_setslot_stable(self, slot_id): ... + def cluster_replicas(self, node_id, target_nodes: Any | None = ...): ... + def cluster_slots(self, target_nodes: Any | None = ...): ... + read_from_replicas: bool + def readonly(self, target_nodes: Any | None = ...): ... + def readwrite(self, target_nodes: Any | None = ...): ... diff --git a/stubs/redis/redis/commands/core.pyi b/stubs/redis/redis/commands/core.pyi new file mode 100644 index 0000000..7b97a37 --- /dev/null +++ b/stubs/redis/redis/commands/core.pyi @@ -0,0 +1,1636 @@ +import builtins +from _typeshed import Incomplete +from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Iterator, Mapping, Sequence +from datetime import datetime, timedelta +from typing import Any, Generic, TypeVar, overload +from typing_extensions import Literal + +from ..asyncio.client import Redis as AsyncRedis +from ..client import _CommandOptions, _Key, _Value +from ..typing import ChannelT, EncodableT, KeyT, PatternT, ScriptTextT + +_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn") +_StrType = TypeVar("_StrType", bound=str | bytes) + +class ACLCommands(Generic[_StrType]): + def acl_cat(self, category: str | None = ..., **kwargs: _CommandOptions) -> list[str]: ... + def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> int: ... + def acl_genpass(self, bits: int | None = ..., **kwargs: _CommandOptions) -> str: ... + def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any | None: ... + def acl_help(self, **kwargs: _CommandOptions): ... + def acl_list(self, **kwargs: _CommandOptions) -> list[str]: ... + def acl_log(self, count: int | None = ..., **kwargs: _CommandOptions): ... + def acl_log_reset(self, **kwargs: _CommandOptions): ... + def acl_load(self, **kwargs: _CommandOptions) -> bool: ... + def acl_save(self, **kwargs: _CommandOptions): ... + def acl_setuser( + self, + username: str, + enabled: bool = ..., + nopass: bool = ..., + passwords: Sequence[str] | None = ..., + hashed_passwords: Sequence[str] | None = ..., + categories: Sequence[str] | None = ..., + commands: Sequence[str] | None = ..., + keys: Sequence[str] | None = ..., + channels: Iterable[ChannelT] | None = ..., + selectors: Iterable[tuple[str, KeyT]] | None = ..., + reset: bool = ..., + reset_keys: bool = ..., + reset_passwords: bool = ..., + **kwargs: _CommandOptions, + ) -> bool: ... + def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ... + def acl_whoami(self, **kwargs: _CommandOptions) -> str: ... + +class AsyncACLCommands(Generic[_StrType]): + async def acl_cat(self, category: str | None = ..., **kwargs: _CommandOptions) -> list[str]: ... + async def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> int: ... + async def acl_genpass(self, bits: int | None = ..., **kwargs: _CommandOptions) -> str: ... + async def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any | None: ... + async def acl_help(self, **kwargs: _CommandOptions): ... + async def acl_list(self, **kwargs: _CommandOptions) -> list[str]: ... + async def acl_log(self, count: int | None = ..., **kwargs: _CommandOptions): ... + async def acl_log_reset(self, **kwargs: _CommandOptions): ... + async def acl_load(self, **kwargs: _CommandOptions) -> bool: ... + async def acl_save(self, **kwargs: _CommandOptions): ... + async def acl_setuser( + self, + username: str, + enabled: bool = ..., + nopass: bool = ..., + passwords: Sequence[str] | None = ..., + hashed_passwords: Sequence[str] | None = ..., + categories: Sequence[str] | None = ..., + commands: Sequence[str] | None = ..., + keys: Sequence[str] | None = ..., + channels: Iterable[ChannelT] | None = ..., + selectors: Iterable[tuple[str, KeyT]] | None = ..., + reset: bool = ..., + reset_keys: bool = ..., + reset_passwords: bool = ..., + **kwargs: _CommandOptions, + ) -> bool: ... + async def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ... + async def acl_whoami(self, **kwargs: _CommandOptions) -> str: ... + +class ManagementCommands: + def bgrewriteaof(self, **kwargs: _CommandOptions): ... + def bgsave(self, schedule: bool = ..., **kwargs: _CommandOptions): ... + def role(self): ... + def client_kill(self, address: str, **kwargs: _CommandOptions) -> bool: ... + def client_kill_filter( + self, + _id: Any | None = ..., + _type: Any | None = ..., + addr: Any | None = ..., + skipme: Any | None = ..., + laddr: Any | None = ..., + user: Any | None = ..., + **kwargs: _CommandOptions, + ): ... + def client_info(self, **kwargs: _CommandOptions): ... + def client_list( + self, _type: str | None = ..., client_id: list[str] = ..., **kwargs: _CommandOptions + ) -> list[dict[str, str]]: ... + def client_getname(self, **kwargs: _CommandOptions) -> str | None: ... + def client_getredir(self, **kwargs: _CommandOptions): ... + def client_reply(self, reply, **kwargs: _CommandOptions): ... + def client_id(self, **kwargs: _CommandOptions) -> int: ... + def client_tracking_on( + self, clientid: Any | None = ..., prefix=..., bcast: bool = ..., optin: bool = ..., optout: bool = ..., noloop: bool = ... + ): ... + def client_tracking_off( + self, clientid: Any | None = ..., prefix=..., bcast: bool = ..., optin: bool = ..., optout: bool = ..., noloop: bool = ... + ): ... + def client_tracking( + self, + on: bool = ..., + clientid: Any | None = ..., + prefix=..., + bcast: bool = ..., + optin: bool = ..., + optout: bool = ..., + noloop: bool = ..., + **kwargs: _CommandOptions, + ): ... + def client_trackinginfo(self, **kwargs: _CommandOptions): ... + def client_setname(self, name: str, **kwargs: _CommandOptions) -> bool: ... + def client_unblock(self, client_id, error: bool = ..., **kwargs: _CommandOptions): ... + def client_pause(self, timeout, all: bool = ..., **kwargs: _CommandOptions): ... + def client_unpause(self, **kwargs: _CommandOptions): ... + def command(self, **kwargs: _CommandOptions): ... + def command_info(self, **kwargs: _CommandOptions): ... + def command_count(self, **kwargs: _CommandOptions): ... + def config_get(self, pattern: PatternT = ..., *args: PatternT, **kwargs: _CommandOptions): ... + def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions): ... + def config_resetstat(self, **kwargs: _CommandOptions): ... + def config_rewrite(self, **kwargs: _CommandOptions): ... + def dbsize(self, **kwargs: _CommandOptions) -> int: ... + def debug_object(self, key, **kwargs: _CommandOptions): ... + def debug_segfault(self, **kwargs: _CommandOptions): ... + def echo(self, value: _Value, **kwargs: _CommandOptions) -> bytes: ... + def flushall(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> bool: ... + def flushdb(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> bool: ... + def sync(self): ... + def psync(self, replicationid, offset): ... + def swapdb(self, first, second, **kwargs: _CommandOptions): ... + def select(self, index, **kwargs: _CommandOptions): ... + def info(self, section: _Key | None = ..., *args: _Key, **kwargs: _CommandOptions) -> Mapping[str, Any]: ... + def lastsave(self, **kwargs: _CommandOptions): ... + def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> bytes: ... + def reset(self) -> None: ... + def migrate( + self, + host, + port, + keys, + destination_db, + timeout, + copy: bool = ..., + replace: bool = ..., + auth: Any | None = ..., + **kwargs: _CommandOptions, + ): ... + def object(self, infotype, key, **kwargs: _CommandOptions): ... + def memory_doctor(self, **kwargs: _CommandOptions): ... + def memory_help(self, **kwargs: _CommandOptions): ... + def memory_stats(self, **kwargs: _CommandOptions) -> dict[str, Any]: ... + def memory_malloc_stats(self, **kwargs: _CommandOptions): ... + def memory_usage(self, key, samples: Any | None = ..., **kwargs: _CommandOptions): ... + def memory_purge(self, **kwargs: _CommandOptions): ... + def ping(self, **kwargs: _CommandOptions) -> bool: ... + def quit(self, **kwargs: _CommandOptions): ... + def replicaof(self, *args, **kwargs: _CommandOptions): ... + def save(self, **kwargs: _CommandOptions) -> bool: ... + def shutdown( + self, + save: bool = ..., + nosave: bool = ..., + now: bool = ..., + force: bool = ..., + abort: bool = ..., + **kwargs: _CommandOptions, + ) -> None: ... + def slaveof(self, host: Any | None = ..., port: Any | None = ..., **kwargs: _CommandOptions): ... + def slowlog_get(self, num: Any | None = ..., **kwargs: _CommandOptions): ... + def slowlog_len(self, **kwargs: _CommandOptions): ... + def slowlog_reset(self, **kwargs: _CommandOptions): ... + def time(self, **kwargs: _CommandOptions): ... + def wait(self, num_replicas, timeout, **kwargs: _CommandOptions): ... + +class AsyncManagementCommands: + async def bgrewriteaof(self, **kwargs: _CommandOptions): ... + async def bgsave(self, schedule: bool = ..., **kwargs: _CommandOptions): ... + async def role(self): ... + async def client_kill(self, address: str, **kwargs: _CommandOptions) -> bool: ... + async def client_kill_filter( + self, + _id: Any | None = ..., + _type: Any | None = ..., + addr: Any | None = ..., + skipme: Any | None = ..., + laddr: Any | None = ..., + user: Any | None = ..., + **kwargs: _CommandOptions, + ): ... + async def client_info(self, **kwargs: _CommandOptions): ... + async def client_list( + self, _type: str | None = ..., client_id: list[str] = ..., **kwargs: _CommandOptions + ) -> list[dict[str, str]]: ... + async def client_getname(self, **kwargs: _CommandOptions) -> str | None: ... + async def client_getredir(self, **kwargs: _CommandOptions): ... + async def client_reply(self, reply, **kwargs: _CommandOptions): ... + async def client_id(self, **kwargs: _CommandOptions) -> int: ... + async def client_tracking_on( + self, clientid: Any | None = ..., prefix=..., bcast: bool = ..., optin: bool = ..., optout: bool = ..., noloop: bool = ... + ): ... + async def client_tracking_off( + self, clientid: Any | None = ..., prefix=..., bcast: bool = ..., optin: bool = ..., optout: bool = ..., noloop: bool = ... + ): ... + async def client_tracking( + self, + on: bool = ..., + clientid: Any | None = ..., + prefix=..., + bcast: bool = ..., + optin: bool = ..., + optout: bool = ..., + noloop: bool = ..., + **kwargs: _CommandOptions, + ): ... + async def client_trackinginfo(self, **kwargs: _CommandOptions): ... + async def client_setname(self, name: str, **kwargs: _CommandOptions) -> bool: ... + async def client_unblock(self, client_id, error: bool = ..., **kwargs: _CommandOptions): ... + async def client_pause(self, timeout, all: bool = ..., **kwargs: _CommandOptions): ... + async def client_unpause(self, **kwargs: _CommandOptions): ... + async def command(self, **kwargs: _CommandOptions): ... + async def command_info(self, **kwargs: _CommandOptions): ... + async def command_count(self, **kwargs: _CommandOptions): ... + async def config_get(self, pattern: PatternT = ..., *args: PatternT, **kwargs: _CommandOptions): ... + async def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions): ... + async def config_resetstat(self, **kwargs: _CommandOptions): ... + async def config_rewrite(self, **kwargs: _CommandOptions): ... + async def dbsize(self, **kwargs: _CommandOptions) -> int: ... + async def debug_object(self, key, **kwargs: _CommandOptions): ... + async def debug_segfault(self, **kwargs: _CommandOptions): ... + async def echo(self, value: _Value, **kwargs: _CommandOptions) -> bytes: ... + async def flushall(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> bool: ... + async def flushdb(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> bool: ... + async def sync(self): ... + async def psync(self, replicationid, offset): ... + async def swapdb(self, first, second, **kwargs: _CommandOptions): ... + async def select(self, index, **kwargs: _CommandOptions): ... + async def info(self, section: _Key | None = ..., *args: _Key, **kwargs: _CommandOptions) -> Mapping[str, Any]: ... + async def lastsave(self, **kwargs: _CommandOptions): ... + async def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> bytes: ... + async def reset(self) -> None: ... + async def migrate( + self, + host, + port, + keys, + destination_db, + timeout, + copy: bool = ..., + replace: bool = ..., + auth: Any | None = ..., + **kwargs: _CommandOptions, + ): ... + async def object(self, infotype, key, **kwargs: _CommandOptions): ... + async def memory_doctor(self, **kwargs: _CommandOptions): ... + async def memory_help(self, **kwargs: _CommandOptions): ... + async def memory_stats(self, **kwargs: _CommandOptions) -> dict[str, Any]: ... + async def memory_malloc_stats(self, **kwargs: _CommandOptions): ... + async def memory_usage(self, key, samples: Any | None = ..., **kwargs: _CommandOptions): ... + async def memory_purge(self, **kwargs: _CommandOptions): ... + async def ping(self, **kwargs: _CommandOptions) -> bool: ... + async def quit(self, **kwargs: _CommandOptions): ... + async def replicaof(self, *args, **kwargs: _CommandOptions): ... + async def save(self, **kwargs: _CommandOptions) -> bool: ... + async def shutdown( + self, + save: bool = ..., + nosave: bool = ..., + now: bool = ..., + force: bool = ..., + abort: bool = ..., + **kwargs: _CommandOptions, + ) -> None: ... + async def slaveof(self, host: Any | None = ..., port: Any | None = ..., **kwargs: _CommandOptions): ... + async def slowlog_get(self, num: Any | None = ..., **kwargs: _CommandOptions): ... + async def slowlog_len(self, **kwargs: _CommandOptions): ... + async def slowlog_reset(self, **kwargs: _CommandOptions): ... + async def time(self, **kwargs: _CommandOptions): ... + async def wait(self, num_replicas, timeout, **kwargs: _CommandOptions): ... + +class BasicKeyCommands(Generic[_StrType]): + def append(self, key, value): ... + def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> int: ... + def bitfield(self, key, default_overflow: Any | None = ...): ... + def bitop(self, operation, dest, *keys): ... + def bitpos(self, key: _Key, bit: int, start: int | None = ..., end: int | None = ..., mode: str | None = ...): ... + def copy(self, source, destination, destination_db: Any | None = ..., replace: bool = ...): ... + def decr(self, name, amount: int = ...) -> int: ... + def decrby(self, name, amount: int = ...) -> int: ... + def delete(self, *names: _Key) -> int: ... + def __delitem__(self, name: _Key) -> None: ... + def dump(self, name: _Key) -> _StrType | None: ... + def exists(self, *names: _Key) -> int: ... + __contains__ = exists + def expire( + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> bool: ... + def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...): ... + def get(self, name: _Key) -> _StrType | None: ... + def getdel(self, name: _Key) -> _StrType | None: ... + def getex( + self, + name, + ex: Any | None = ..., + px: Any | None = ..., + exat: Any | None = ..., + pxat: Any | None = ..., + persist: bool = ..., + ): ... + def __getitem__(self, name: str): ... + def getbit(self, name: _Key, offset: int) -> int: ... + def getrange(self, key, start, end): ... + def getset(self, name, value) -> _StrType | None: ... + def incr(self, name: _Key, amount: int = ...) -> int: ... + def incrby(self, name: _Key, amount: int = ...) -> int: ... + def incrbyfloat(self, name: _Key, amount: float = ...) -> float: ... + def keys(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> list[_StrType]: ... + def lmove( + self, first_list: _Key, second_list: _Key, src: Literal["LEFT", "RIGHT"] = ..., dest: Literal["LEFT", "RIGHT"] = ... + ) -> _Value: ... + def blmove( + self, + first_list: _Key, + second_list: _Key, + timeout: float, + src: Literal["LEFT", "RIGHT"] = ..., + dest: Literal["LEFT", "RIGHT"] = ..., + ) -> _Value | None: ... + def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... + def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ... + def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... + def move(self, name: _Key, db: int) -> bool: ... + def persist(self, name: _Key) -> bool: ... + def pexpire( + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Literal[1, 0]: ... + def pexpireat( + self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Literal[1, 0]: ... + def psetex(self, name, time_ms, value): ... + def pttl(self, name: _Key) -> int: ... + def hrandfield(self, key, count: Any | None = ..., withvalues: bool = ...): ... + def randomkey(self, **kwargs: _CommandOptions): ... + def rename(self, src, dst): ... + def renamenx(self, src, dst): ... + def restore( + self, name, ttl, value, replace: bool = ..., absttl: bool = ..., idletime: Any | None = ..., frequency: Any | None = ... + ): ... + def set( + self, + name: _Key, + value: _Value, + ex: None | float | timedelta = ..., + px: None | float | timedelta = ..., + nx: bool = ..., + xx: bool = ..., + keepttl: bool = ..., + get: bool = ..., + exat: Any | None = ..., + pxat: Any | None = ..., + ) -> bool | None: ... + def __setitem__(self, name, value) -> None: ... + def setbit(self, name: _Key, offset: int, value: int) -> int: ... + def setex(self, name: _Key, time: int | timedelta, value: _Value) -> bool: ... + def setnx(self, name: _Key, value: _Value) -> bool: ... + def setrange(self, name, offset, value): ... + def stralgo( + self, + algo, + value1, + value2, + specific_argument: str = ..., + len: bool = ..., + idx: bool = ..., + minmatchlen: Any | None = ..., + withmatchlen: bool = ..., + **kwargs: _CommandOptions, + ): ... + def strlen(self, name): ... + def substr(self, name, start, end: int = ...): ... + def touch(self, *args): ... + def ttl(self, name: _Key) -> int: ... + def type(self, name): ... + def watch(self, *names): ... + def unwatch(self): ... + def unlink(self, *names: _Key) -> int: ... + +class AsyncBasicKeyCommands(Generic[_StrType]): + async def append(self, key, value): ... + async def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> int: ... + async def bitfield(self, key, default_overflow: Any | None = ...): ... + async def bitop(self, operation, dest, *keys): ... + async def bitpos(self, key: _Key, bit: int, start: int | None = ..., end: int | None = ..., mode: str | None = ...): ... + async def copy(self, source, destination, destination_db: Any | None = ..., replace: bool = ...): ... + async def decr(self, name, amount: int = ...) -> int: ... + async def decrby(self, name, amount: int = ...) -> int: ... + async def delete(self, *names: _Key) -> int: ... + async def dump(self, name: _Key) -> _StrType | None: ... + async def exists(self, *names: _Key) -> int: ... + async def expire( + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> bool: ... + async def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...): ... + async def get(self, name: _Key) -> _StrType | None: ... + async def getdel(self, name: _Key) -> _StrType | None: ... + async def getex( + self, + name, + ex: Any | None = ..., + px: Any | None = ..., + exat: Any | None = ..., + pxat: Any | None = ..., + persist: bool = ..., + ): ... + async def getbit(self, name: _Key, offset: int) -> int: ... + async def getrange(self, key, start, end): ... + async def getset(self, name, value) -> _StrType | None: ... + async def incr(self, name: _Key, amount: int = ...) -> int: ... + async def incrby(self, name: _Key, amount: int = ...) -> int: ... + async def incrbyfloat(self, name: _Key, amount: float = ...) -> float: ... + async def keys(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> list[_StrType]: ... + async def lmove( + self, first_list: _Key, second_list: _Key, src: Literal["LEFT", "RIGHT"] = ..., dest: Literal["LEFT", "RIGHT"] = ... + ) -> _Value: ... + async def blmove( + self, + first_list: _Key, + second_list: _Key, + timeout: float, + src: Literal["LEFT", "RIGHT"] = ..., + dest: Literal["LEFT", "RIGHT"] = ..., + ) -> _Value | None: ... + async def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... + async def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ... + async def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... + async def move(self, name: _Key, db: int) -> bool: ... + async def persist(self, name: _Key) -> bool: ... + async def pexpire( + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Literal[1, 0]: ... + async def pexpireat( + self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Literal[1, 0]: ... + async def psetex(self, name, time_ms, value): ... + async def pttl(self, name: _Key) -> int: ... + async def hrandfield(self, key, count: Any | None = ..., withvalues: bool = ...): ... + async def randomkey(self, **kwargs: _CommandOptions): ... + async def rename(self, src, dst): ... + async def renamenx(self, src, dst): ... + async def restore( + self, name, ttl, value, replace: bool = ..., absttl: bool = ..., idletime: Any | None = ..., frequency: Any | None = ... + ): ... + async def set( + self, + name: _Key, + value: _Value, + ex: None | float | timedelta = ..., + px: None | float | timedelta = ..., + nx: bool = ..., + xx: bool = ..., + keepttl: bool = ..., + get: bool = ..., + exat: Any | None = ..., + pxat: Any | None = ..., + ) -> bool | None: ... + async def setbit(self, name: _Key, offset: int, value: int) -> int: ... + async def setex(self, name: _Key, time: int | timedelta, value: _Value) -> bool: ... + async def setnx(self, name: _Key, value: _Value) -> bool: ... + async def setrange(self, name, offset, value): ... + async def stralgo( + self, + algo, + value1, + value2, + specific_argument: str = ..., + len: bool = ..., + idx: bool = ..., + minmatchlen: Any | None = ..., + withmatchlen: bool = ..., + **kwargs: _CommandOptions, + ): ... + async def strlen(self, name): ... + async def substr(self, name, start, end: int = ...): ... + async def touch(self, *args): ... + async def ttl(self, name: _Key) -> int: ... + async def type(self, name): ... + async def watch(self, *names): ... + async def unwatch(self): ... + async def unlink(self, *names: _Key) -> int: ... + def __getitem__(self, name: str): ... + def __setitem__(self, name, value) -> None: ... + def __delitem__(self, name: _Key) -> None: ... + def __contains__(self, name: _Key) -> None: ... + +class ListCommands(Generic[_StrType]): + @overload + def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> tuple[_StrType, _StrType]: ... + @overload + def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... + @overload + def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> tuple[_StrType, _StrType]: ... + @overload + def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... + def brpoplpush(self, src, dst, timeout: int | None = ...): ... + def lindex(self, name: _Key, index: int) -> _StrType | None: ... + def linsert( + self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value + ) -> int: ... + def llen(self, name: _Key) -> int: ... + def lpop(self, name, count: int | None = ...): ... + def lpush(self, name: _Value, *values: _Value) -> int: ... + def lpushx(self, name, value): ... + def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ... + def lrem(self, name: _Key, count: int, value: _Value) -> int: ... + def lset(self, name: _Key, index: int, value: _Value) -> bool: ... + def ltrim(self, name: _Key, start: int, end: int) -> bool: ... + def rpop(self, name, count: int | None = ...): ... + def rpoplpush(self, src, dst): ... + def rpush(self, name: _Value, *values: _Value) -> int: ... + def rpushx(self, name, value): ... + def lpos(self, name, value, rank: Any | None = ..., count: Any | None = ..., maxlen: Any | None = ...): ... + @overload + def sort( + self, + name: _Key, + start: int | None = ..., + num: int | None = ..., + by: _Key | None = ..., + get: _Key | Sequence[_Key] | None = ..., + desc: bool = ..., + alpha: bool = ..., + store: None = ..., + groups: bool = ..., + ) -> list[_StrType]: ... + @overload + def sort( + self, + name: _Key, + start: int | None = ..., + num: int | None = ..., + by: _Key | None = ..., + get: _Key | Sequence[_Key] | None = ..., + desc: bool = ..., + alpha: bool = ..., + *, + store: _Key, + groups: bool = ..., + ) -> int: ... + @overload + def sort( + self, + name: _Key, + start: int | None, + num: int | None, + by: _Key | None, + get: _Key | Sequence[_Key] | None, + desc: bool, + alpha: bool, + store: _Key, + groups: bool = ..., + ) -> int: ... + +class AsyncListCommands(Generic[_StrType]): + @overload + async def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> tuple[_StrType, _StrType]: ... + @overload + async def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... + @overload + async def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> tuple[_StrType, _StrType]: ... + @overload + async def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... + async def brpoplpush(self, src, dst, timeout: int | None = ...): ... + async def lindex(self, name: _Key, index: int) -> _StrType | None: ... + async def linsert( + self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value + ) -> int: ... + async def llen(self, name: _Key) -> int: ... + async def lpop(self, name, count: int | None = ...): ... + async def lpush(self, name: _Value, *values: _Value) -> int: ... + async def lpushx(self, name, value): ... + async def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ... + async def lrem(self, name: _Key, count: int, value: _Value) -> int: ... + async def lset(self, name: _Key, index: int, value: _Value) -> bool: ... + async def ltrim(self, name: _Key, start: int, end: int) -> bool: ... + async def rpop(self, name, count: int | None = ...): ... + async def rpoplpush(self, src, dst): ... + async def rpush(self, name: _Value, *values: _Value) -> int: ... + async def rpushx(self, name, value): ... + async def lpos(self, name, value, rank: Any | None = ..., count: Any | None = ..., maxlen: Any | None = ...): ... + @overload + async def sort( + self, + name: _Key, + start: int | None = ..., + num: int | None = ..., + by: _Key | None = ..., + get: _Key | Sequence[_Key] | None = ..., + desc: bool = ..., + alpha: bool = ..., + store: None = ..., + groups: bool = ..., + ) -> list[_StrType]: ... + @overload + async def sort( + self, + name: _Key, + start: int | None = ..., + num: int | None = ..., + by: _Key | None = ..., + get: _Key | Sequence[_Key] | None = ..., + desc: bool = ..., + alpha: bool = ..., + *, + store: _Key, + groups: bool = ..., + ) -> int: ... + @overload + async def sort( + self, + name: _Key, + start: int | None, + num: int | None, + by: _Key | None, + get: _Key | Sequence[_Key] | None, + desc: bool, + alpha: bool, + store: _Key, + groups: bool = ..., + ) -> int: ... + +class ScanCommands(Generic[_StrType]): + def scan( + self, + cursor: int = ..., + match: _Key | None = ..., + count: int | None = ..., + _type: str | None = ..., + **kwargs: _CommandOptions, + ) -> tuple[int, list[_StrType]]: ... + def scan_iter( + self, match: _Key | None = ..., count: int | None = ..., _type: str | None = ..., **kwargs: _CommandOptions + ) -> Iterator[_StrType]: ... + def sscan( + self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ... + ) -> tuple[int, list[_StrType]]: ... + def sscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> Iterator[_StrType]: ... + def hscan( + self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ... + ) -> tuple[int, dict[_StrType, _StrType]]: ... + def hscan_iter( + self, name: _Key, match: _Key | None = ..., count: int | None = ... + ) -> Iterator[tuple[_StrType, _StrType]]: ... + @overload + def zscan( + self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ... + ) -> tuple[int, list[tuple[_StrType, float]]]: ... + @overload + def zscan( + self, + name: _Key, + cursor: int = ..., + match: _Key | None = ..., + count: int | None = ..., + *, + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... + @overload + def zscan( + self, + name: _Key, + cursor: int, + match: _Key | None, + count: int | None, + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... + @overload + def zscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> Iterator[tuple[_StrType, float]]: ... + @overload + def zscan_iter( + self, + name: _Key, + match: _Key | None = ..., + count: int | None = ..., + *, + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zscan_iter( + self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] + ) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... + +class AsyncScanCommands(Generic[_StrType]): + async def scan( + self, + cursor: int = ..., + match: _Key | None = ..., + count: int | None = ..., + _type: str | None = ..., + **kwargs: _CommandOptions, + ) -> tuple[int, list[_StrType]]: ... + def scan_iter( + self, match: _Key | None = ..., count: int | None = ..., _type: str | None = ..., **kwargs: _CommandOptions + ) -> AsyncIterator[_StrType]: ... + async def sscan( + self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ... + ) -> tuple[int, list[_StrType]]: ... + def sscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> AsyncIterator[_StrType]: ... + async def hscan( + self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ... + ) -> tuple[int, dict[_StrType, _StrType]]: ... + def hscan_iter( + self, name: _Key, match: _Key | None = ..., count: int | None = ... + ) -> AsyncIterator[tuple[_StrType, _StrType]]: ... + @overload + async def zscan( + self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ... + ) -> tuple[int, list[tuple[_StrType, float]]]: ... + @overload + async def zscan( + self, + name: _Key, + cursor: int = ..., + match: _Key | None = ..., + count: int | None = ..., + *, + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... + @overload + async def zscan( + self, + name: _Key, + cursor: int, + match: _Key | None, + count: int | None, + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... + @overload + def zscan_iter( + self, name: _Key, match: _Key | None = ..., count: int | None = ... + ) -> AsyncIterator[tuple[_StrType, float]]: ... + @overload + def zscan_iter( + self, + name: _Key, + match: _Key | None = ..., + count: int | None = ..., + *, + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zscan_iter( + self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] + ) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... + +class SetCommands(Generic[_StrType]): + def sadd(self, name: _Key, *values: _Value) -> int: ... + def scard(self, name: _Key) -> int: ... + def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... + def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... + def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... + def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... + def sismember(self, name: _Key, value: _Value) -> bool: ... + def smembers(self, name: _Key) -> builtins.set[_StrType]: ... + def smismember(self, name, values, *args): ... + def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ... + @overload + def spop(self, name: _Key, count: None = ...) -> _Value | None: ... + @overload + def spop(self, name: _Key, count: int) -> list[_Value]: ... + @overload + def srandmember(self, name: _Key, number: None = ...) -> _Value | None: ... + @overload + def srandmember(self, name: _Key, number: int) -> list[_Value]: ... + def srem(self, name: _Key, *values: _Value) -> int: ... + def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... + def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... + +class AsyncSetCommands(Generic[_StrType]): + async def sadd(self, name: _Key, *values: _Value) -> int: ... + async def scard(self, name: _Key) -> int: ... + async def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... + async def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... + async def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... + async def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... + async def sismember(self, name: _Key, value: _Value) -> bool: ... + async def smembers(self, name: _Key) -> builtins.set[_StrType]: ... + async def smismember(self, name, values, *args): ... + async def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ... + @overload + async def spop(self, name: _Key, count: None = ...) -> _Value | None: ... + @overload + async def spop(self, name: _Key, count: int) -> list[_Value]: ... + @overload + async def srandmember(self, name: _Key, number: None = ...) -> _Value | None: ... + @overload + async def srandmember(self, name: _Key, number: int) -> list[_Value]: ... + async def srem(self, name: _Key, *values: _Value) -> int: ... + async def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... + async def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... + +class StreamCommands: + def xack(self, name, groupname, *ids): ... + def xadd( + self, + name, + fields, + id: str = ..., + maxlen=..., + approximate: bool = ..., + nomkstream: bool = ..., + minid: Any | None = ..., + limit: Any | None = ..., + ): ... + def xautoclaim( + self, name, groupname, consumername, min_idle_time, start_id: int = ..., count: Any | None = ..., justid: bool = ... + ): ... + def xclaim( + self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=... + ): ... + def xdel(self, name, *ids): ... + def xgroup_create(self, name, groupname, id: str = ..., mkstream: bool = ..., entries_read: int | None = ...): ... + def xgroup_delconsumer(self, name, groupname, consumername): ... + def xgroup_destroy(self, name, groupname): ... + def xgroup_createconsumer(self, name, groupname, consumername): ... + def xgroup_setid(self, name, groupname, id, entries_read: int | None = ...): ... + def xinfo_consumers(self, name, groupname): ... + def xinfo_groups(self, name): ... + def xinfo_stream(self, name, full: bool = ...): ... + def xlen(self, name: _Key) -> int: ... + def xpending(self, name, groupname): ... + def xpending_range( + self, name: _Key, groupname, min, max, count: int, consumername: Any | None = ..., idle: int | None = ... + ): ... + def xrange(self, name, min: str = ..., max: str = ..., count: Any | None = ...): ... + def xread(self, streams, count: Any | None = ..., block: Any | None = ...): ... + def xreadgroup( + self, groupname, consumername, streams, count: Any | None = ..., block: Any | None = ..., noack: bool = ... + ): ... + def xrevrange(self, name, max: str = ..., min: str = ..., count: Any | None = ...): ... + def xtrim( + self, name, maxlen: int | None = ..., approximate: bool = ..., minid: Incomplete | None = ..., limit: int | None = ... + ): ... + +class AsyncStreamCommands: + async def xack(self, name, groupname, *ids): ... + async def xadd( + self, + name, + fields, + id: str = ..., + maxlen=..., + approximate: bool = ..., + nomkstream: bool = ..., + minid: Any | None = ..., + limit: Any | None = ..., + ): ... + async def xautoclaim( + self, name, groupname, consumername, min_idle_time, start_id: int = ..., count: Any | None = ..., justid: bool = ... + ): ... + async def xclaim( + self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=... + ): ... + async def xdel(self, name, *ids): ... + async def xgroup_create(self, name, groupname, id: str = ..., mkstream: bool = ..., entries_read: int | None = ...): ... + async def xgroup_delconsumer(self, name, groupname, consumername): ... + async def xgroup_destroy(self, name, groupname): ... + async def xgroup_createconsumer(self, name, groupname, consumername): ... + async def xgroup_setid(self, name, groupname, id, entries_read: int | None = ...): ... + async def xinfo_consumers(self, name, groupname): ... + async def xinfo_groups(self, name): ... + async def xinfo_stream(self, name, full: bool = ...): ... + async def xlen(self, name: _Key) -> int: ... + async def xpending(self, name, groupname): ... + async def xpending_range( + self, name: _Key, groupname, min, max, count: int, consumername: Any | None = ..., idle: int | None = ... + ): ... + async def xrange(self, name, min: str = ..., max: str = ..., count: Any | None = ...): ... + async def xread(self, streams, count: Any | None = ..., block: Any | None = ...): ... + async def xreadgroup( + self, groupname, consumername, streams, count: Any | None = ..., block: Any | None = ..., noack: bool = ... + ): ... + async def xrevrange(self, name, max: str = ..., min: str = ..., count: Any | None = ...): ... + async def xtrim( + self, name, maxlen: int | None = ..., approximate: bool = ..., minid: Incomplete | None = ..., limit: int | None = ... + ): ... + +class SortedSetCommands(Generic[_StrType]): + def zadd( + self, + name: _Key, + mapping: Mapping[_Key, _Value], + nx: bool = ..., + xx: bool = ..., + ch: bool = ..., + incr: bool = ..., + gt: Any | None = ..., + lt: Any | None = ..., + ) -> int: ... + def zcard(self, name: _Key) -> int: ... + def zcount(self, name: _Key, min: _Value, max: _Value) -> int: ... + def zdiff(self, keys, withscores: bool = ...): ... + def zdiffstore(self, dest, keys): ... + def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ... + def zinter(self, keys, aggregate: Any | None = ..., withscores: bool = ...): ... + def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> int: ... + def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ... + def zpopmax(self, name: _Key, count: int | None = ...) -> list[tuple[_StrType, float]]: ... + def zpopmin(self, name: _Key, count: int | None = ...) -> list[tuple[_StrType, float]]: ... + def zrandmember(self, key, count: Any | None = ..., withscores: bool = ...): ... + @overload + def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> tuple[_StrType, _StrType, float]: ... + @overload + def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... + @overload + def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> tuple[_StrType, _StrType, float]: ... + @overload + def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... + @overload + def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], float] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, float]]: ... + @overload + def zrange( + self, + name: _Key, + start: int, + end: int, + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zrange( + self, + name: _Key, + start: int, + end: int, + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], float] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, float]]: ... + @overload + def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[_StrType]: ... + @overload + def zrevrange( + self, + name: _Key, + start: int, + end: int, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zrevrange(self, name: _Key, start: int, end: int, withscores: Literal[True]) -> list[tuple[_StrType, float]]: ... + @overload + def zrevrange( + self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ... + ) -> list[_StrType]: ... + def zrangestore( + self, + dest, + name, + start, + end, + byscore: bool = ..., + bylex: bool = ..., + desc: bool = ..., + offset: Any | None = ..., + num: Any | None = ..., + ): ... + def zrangebylex( + self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... + ) -> list[_StrType]: ... + def zrevrangebylex( + self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ... + ) -> list[_StrType]: ... + @overload + def zrangebyscore( + self, + name: _Key, + min: _Value, + max: _Value, + start: int | None = ..., + num: int | None = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zrangebyscore( + self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True] + ) -> list[tuple[_StrType, float]]: ... + @overload + def zrangebyscore( + self, + name: _Key, + min: _Value, + max: _Value, + start: int | None = ..., + num: int | None = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + ) -> list[_StrType]: ... + @overload + def zrevrangebyscore( + self, + name: _Key, + max: _Value, + min: _Value, + start: int | None = ..., + num: int | None = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + def zrevrangebyscore( + self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True] + ) -> list[tuple[_StrType, float]]: ... + @overload + def zrevrangebyscore( + self, + name: _Key, + max: _Value, + min: _Value, + start: int | None = ..., + num: int | None = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + ) -> list[_StrType]: ... + def zrank(self, name: _Key, value: _Value) -> int | None: ... + def zrem(self, name: _Key, *values: _Value) -> int: ... + def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ... + def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ... + def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ... + def zrevrank(self, name: _Key, value: _Value) -> int | None: ... + def zscore(self, name: _Key, value: _Value) -> float | None: ... + def zunion(self, keys, aggregate: Any | None = ..., withscores: bool = ...): ... + def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> int: ... + def zmscore(self, key, members): ... + +class AsyncSortedSetCommands(Generic[_StrType]): + async def zadd( + self, + name: _Key, + mapping: Mapping[_Key, _Value], + nx: bool = ..., + xx: bool = ..., + ch: bool = ..., + incr: bool = ..., + gt: Any | None = ..., + lt: Any | None = ..., + ) -> int: ... + async def zcard(self, name: _Key) -> int: ... + async def zcount(self, name: _Key, min: _Value, max: _Value) -> int: ... + async def zdiff(self, keys, withscores: bool = ...): ... + async def zdiffstore(self, dest, keys): ... + async def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ... + async def zinter(self, keys, aggregate: Any | None = ..., withscores: bool = ...): ... + async def zinterstore( + self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ... + ) -> int: ... + async def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ... + async def zpopmax(self, name: _Key, count: int | None = ...) -> list[tuple[_StrType, float]]: ... + async def zpopmin(self, name: _Key, count: int | None = ...) -> list[tuple[_StrType, float]]: ... + async def zrandmember(self, key, count: Any | None = ..., withscores: bool = ...): ... + @overload + async def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> tuple[_StrType, _StrType, float]: ... + @overload + async def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... + @overload + async def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> tuple[_StrType, _StrType, float]: ... + @overload + async def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... + @overload + async def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + async def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], float] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, float]]: ... + @overload + async def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + async def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], float] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[tuple[_StrType, float]]: ... + @overload + async def zrange( + self, + name: _Key, + start: int, + end: int, + desc: bool = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + byscore: bool = ..., + bylex: bool = ..., + offset: int | None = ..., + num: int | None = ..., + ) -> list[_StrType]: ... + @overload + async def zrevrange( + self, + name: _Key, + start: int, + end: int, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + async def zrevrange(self, name: _Key, start: int, end: int, withscores: Literal[True]) -> list[tuple[_StrType, float]]: ... + @overload + async def zrevrange( + self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ... + ) -> list[_StrType]: ... + async def zrangestore( + self, + dest, + name, + start, + end, + byscore: bool = ..., + bylex: bool = ..., + desc: bool = ..., + offset: Any | None = ..., + num: Any | None = ..., + ): ... + async def zrangebylex( + self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... + ) -> list[_StrType]: ... + async def zrevrangebylex( + self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ... + ) -> list[_StrType]: ... + @overload + async def zrangebyscore( + self, + name: _Key, + min: _Value, + max: _Value, + start: int | None = ..., + num: int | None = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + async def zrangebyscore( + self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True] + ) -> list[tuple[_StrType, float]]: ... + @overload + async def zrangebyscore( + self, + name: _Key, + min: _Value, + max: _Value, + start: int | None = ..., + num: int | None = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + ) -> list[_StrType]: ... + @overload + async def zrevrangebyscore( + self, + name: _Key, + max: _Value, + min: _Value, + start: int | None = ..., + num: int | None = ..., + *, + withscores: Literal[True], + score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], + ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... + @overload + async def zrevrangebyscore( + self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True] + ) -> list[tuple[_StrType, float]]: ... + @overload + async def zrevrangebyscore( + self, + name: _Key, + max: _Value, + min: _Value, + start: int | None = ..., + num: int | None = ..., + withscores: bool = ..., + score_cast_func: Callable[[_StrType], Any] = ..., + ) -> list[_StrType]: ... + async def zrank(self, name: _Key, value: _Value) -> int | None: ... + async def zrem(self, name: _Key, *values: _Value) -> int: ... + async def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ... + async def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ... + async def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ... + async def zrevrank(self, name: _Key, value: _Value) -> int | None: ... + async def zscore(self, name: _Key, value: _Value) -> float | None: ... + async def zunion(self, keys, aggregate: Any | None = ..., withscores: bool = ...): ... + async def zunionstore( + self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ... + ) -> int: ... + async def zmscore(self, key, members): ... + +class HyperlogCommands: + def pfadd(self, name: _Key, *values: _Value) -> int: ... + def pfcount(self, name: _Key) -> int: ... + def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ... + +class AsyncHyperlogCommands: + async def pfadd(self, name: _Key, *values: _Value) -> int: ... + async def pfcount(self, name: _Key) -> int: ... + async def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ... + +class HashCommands(Generic[_StrType]): + def hdel(self, name: _Key, *keys: _Key) -> int: ... + def hexists(self, name: _Key, key: _Key) -> bool: ... + def hget(self, name: _Key, key: _Key) -> _StrType | None: ... + def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ... + def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> int: ... + def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> float: ... + def hkeys(self, name: _Key) -> list[_StrType]: ... + def hlen(self, name: _Key) -> int: ... + @overload + def hset( + self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Any | None = ... + ) -> int: ... + @overload + def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ... + @overload + def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ... + def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... + def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... + def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... + def hvals(self, name: _Key) -> list[_StrType]: ... + def hstrlen(self, name, key): ... + +class AsyncHashCommands(Generic[_StrType]): + async def hdel(self, name: _Key, *keys: _Key) -> int: ... + async def hexists(self, name: _Key, key: _Key) -> bool: ... + async def hget(self, name: _Key, key: _Key) -> _StrType | None: ... + async def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ... + async def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> int: ... + async def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> float: ... + async def hkeys(self, name: _Key) -> list[_StrType]: ... + async def hlen(self, name: _Key) -> int: ... + @overload + async def hset( + self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Any | None = ... + ) -> int: ... + @overload + async def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ... + @overload + async def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ... + async def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... + async def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... + async def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... + async def hvals(self, name: _Key) -> list[_StrType]: ... + async def hstrlen(self, name, key): ... + +class AsyncScript: + def __init__(self, registered_client: AsyncRedis[Any], script: ScriptTextT) -> None: ... + async def __call__( + self, keys: Sequence[KeyT] | None = ..., args: Iterable[EncodableT] | None = ..., client: AsyncRedis[Any] | None = ... + ): ... + +class PubSubCommands: + def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> int: ... + def pubsub_channels(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> list[str]: ... + def pubsub_numpat(self, **kwargs: _CommandOptions) -> int: ... + def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> list[tuple[str, int]]: ... + +class AsyncPubSubCommands: + async def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> int: ... + async def pubsub_channels(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> list[str]: ... + async def pubsub_numpat(self, **kwargs: _CommandOptions) -> int: ... + async def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> list[tuple[str, int]]: ... + +class ScriptCommands(Generic[_StrType]): + def eval(self, script, numkeys, *keys_and_args): ... + def evalsha(self, sha, numkeys, *keys_and_args): ... + def script_exists(self, *args): ... + def script_debug(self, *args): ... + def script_flush(self, sync_type: Any | None = ...): ... + def script_kill(self): ... + def script_load(self, script): ... + def register_script(self, script: str | _StrType) -> Script: ... + +class AsyncScriptCommands(Generic[_StrType]): + async def eval(self, script, numkeys, *keys_and_args): ... + async def evalsha(self, sha, numkeys, *keys_and_args): ... + async def script_exists(self, *args): ... + async def script_debug(self, *args): ... + async def script_flush(self, sync_type: Any | None = ...): ... + async def script_kill(self): ... + async def script_load(self, script): ... + def register_script(self, script: ScriptTextT) -> AsyncScript: ... # type: ignore[override] + +class GeoCommands: + def geoadd(self, name, values, nx: bool = ..., xx: bool = ..., ch: bool = ...): ... + def geodist(self, name, place1, place2, unit: Any | None = ...): ... + def geohash(self, name, *values): ... + def geopos(self, name, *values): ... + def georadius( + self, + name, + longitude, + latitude, + radius, + unit: Any | None = ..., + withdist: bool = ..., + withcoord: bool = ..., + withhash: bool = ..., + count: Any | None = ..., + sort: Any | None = ..., + store: Any | None = ..., + store_dist: Any | None = ..., + any: bool = ..., + ): ... + def georadiusbymember( + self, + name, + member, + radius, + unit: Any | None = ..., + withdist: bool = ..., + withcoord: bool = ..., + withhash: bool = ..., + count: Any | None = ..., + sort: Any | None = ..., + store: Any | None = ..., + store_dist: Any | None = ..., + any: bool = ..., + ): ... + def geosearch( + self, + name, + member: Any | None = ..., + longitude: Any | None = ..., + latitude: Any | None = ..., + unit: str = ..., + radius: Any | None = ..., + width: Any | None = ..., + height: Any | None = ..., + sort: Any | None = ..., + count: Any | None = ..., + any: bool = ..., + withcoord: bool = ..., + withdist: bool = ..., + withhash: bool = ..., + ): ... + def geosearchstore( + self, + dest, + name, + member: Any | None = ..., + longitude: Any | None = ..., + latitude: Any | None = ..., + unit: str = ..., + radius: Any | None = ..., + width: Any | None = ..., + height: Any | None = ..., + sort: Any | None = ..., + count: Any | None = ..., + any: bool = ..., + storedist: bool = ..., + ): ... + +class AsyncGeoCommands: + async def geoadd(self, name, values, nx: bool = ..., xx: bool = ..., ch: bool = ...): ... + async def geodist(self, name, place1, place2, unit: Any | None = ...): ... + async def geohash(self, name, *values): ... + async def geopos(self, name, *values): ... + async def georadius( + self, + name, + longitude, + latitude, + radius, + unit: Any | None = ..., + withdist: bool = ..., + withcoord: bool = ..., + withhash: bool = ..., + count: Any | None = ..., + sort: Any | None = ..., + store: Any | None = ..., + store_dist: Any | None = ..., + any: bool = ..., + ): ... + async def georadiusbymember( + self, + name, + member, + radius, + unit: Any | None = ..., + withdist: bool = ..., + withcoord: bool = ..., + withhash: bool = ..., + count: Any | None = ..., + sort: Any | None = ..., + store: Any | None = ..., + store_dist: Any | None = ..., + any: bool = ..., + ): ... + async def geosearch( + self, + name, + member: Any | None = ..., + longitude: Any | None = ..., + latitude: Any | None = ..., + unit: str = ..., + radius: Any | None = ..., + width: Any | None = ..., + height: Any | None = ..., + sort: Any | None = ..., + count: Any | None = ..., + any: bool = ..., + withcoord: bool = ..., + withdist: bool = ..., + withhash: bool = ..., + ): ... + async def geosearchstore( + self, + dest, + name, + member: Any | None = ..., + longitude: Any | None = ..., + latitude: Any | None = ..., + unit: str = ..., + radius: Any | None = ..., + width: Any | None = ..., + height: Any | None = ..., + sort: Any | None = ..., + count: Any | None = ..., + any: bool = ..., + storedist: bool = ..., + ): ... + +class ModuleCommands: + def module_load(self, path, *args): ... + def module_unload(self, name): ... + def module_list(self): ... + def command_info(self): ... + def command_count(self): ... + def command_getkeys(self, *args): ... + def command(self): ... + +class Script: + def __init__(self, registered_client, script) -> None: ... + def __call__(self, keys=..., args=..., client: Any | None = ...): ... + +class BitFieldOperation: + def __init__(self, client, key, default_overflow: Any | None = ...): ... + def reset(self) -> None: ... + def overflow(self, overflow): ... + def incrby(self, fmt, offset, increment, overflow: Any | None = ...): ... + def get(self, fmt, offset): ... + def set(self, fmt, offset, value): ... + @property + def command(self): ... + def execute(self): ... + +class AsyncModuleCommands(ModuleCommands): + async def command_info(self) -> None: ... + +class ClusterCommands: + def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions): ... + def readwrite(self, **kwargs: _CommandOptions) -> bool: ... + def readonly(self, **kwargs: _CommandOptions) -> bool: ... + +class AsyncClusterCommands: + async def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions): ... + async def readwrite(self, **kwargs: _CommandOptions) -> bool: ... + async def readonly(self, **kwargs: _CommandOptions) -> bool: ... + +class FunctionCommands: + def function_load(self, code: str, replace: bool | None = ...) -> Awaitable[str] | str: ... + def function_delete(self, library: str) -> Awaitable[str] | str: ... + def function_flush(self, mode: str = ...) -> Awaitable[str] | str: ... + def function_list(self, library: str | None = ..., withcode: bool | None = ...) -> Awaitable[list[Any]] | list[Any]: ... + def fcall(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... + def fcall_ro(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... + def function_dump(self) -> Awaitable[str] | str: ... + def function_restore(self, payload: str, policy: str | None = ...) -> Awaitable[str] | str: ... + def function_kill(self) -> Awaitable[str] | str: ... + def function_stats(self) -> Awaitable[list[Any]] | list[Any]: ... + +class AsyncFunctionCommands: + async def function_load(self, code: str, replace: bool | None = ...) -> Awaitable[str] | str: ... + async def function_delete(self, library: str) -> Awaitable[str] | str: ... + async def function_flush(self, mode: str = ...) -> Awaitable[str] | str: ... + async def function_list(self, library: str | None = ..., withcode: bool | None = ...) -> Awaitable[list[Any]] | list[Any]: ... + async def fcall(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... + async def fcall_ro(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... + async def function_dump(self) -> Awaitable[str] | str: ... + async def function_restore(self, payload: str, policy: str | None = ...) -> Awaitable[str] | str: ... + async def function_kill(self) -> Awaitable[str] | str: ... + async def function_stats(self) -> Awaitable[list[Any]] | list[Any]: ... + +class DataAccessCommands( + BasicKeyCommands[_StrType], + HyperlogCommands, + HashCommands[_StrType], + GeoCommands, + ListCommands[_StrType], + ScanCommands[_StrType], + SetCommands[_StrType], + StreamCommands, + SortedSetCommands[_StrType], + Generic[_StrType], +): ... +class AsyncDataAccessCommands( + AsyncBasicKeyCommands[_StrType], + AsyncHyperlogCommands, + AsyncHashCommands[_StrType], + AsyncGeoCommands, + AsyncListCommands[_StrType], + AsyncScanCommands[_StrType], + AsyncSetCommands[_StrType], + AsyncStreamCommands, + AsyncSortedSetCommands[_StrType], + Generic[_StrType], +): ... +class CoreCommands( + ACLCommands[_StrType], + ClusterCommands, + DataAccessCommands[_StrType], + ManagementCommands, + ModuleCommands, + PubSubCommands, + ScriptCommands[_StrType], + Generic[_StrType], +): ... +class AsyncCoreCommands( + AsyncACLCommands[_StrType], + AsyncClusterCommands, + AsyncDataAccessCommands[_StrType], + AsyncManagementCommands, + AsyncModuleCommands, + AsyncPubSubCommands, + AsyncScriptCommands[_StrType], + AsyncFunctionCommands, + Generic[_StrType], +): ... diff --git a/stubs/redis/redis/commands/graph/__init__.pyi b/stubs/redis/redis/commands/graph/__init__.pyi new file mode 100644 index 0000000..2586aed --- /dev/null +++ b/stubs/redis/redis/commands/graph/__init__.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from .commands import GraphCommands as GraphCommands +from .edge import Edge as Edge +from .node import Node as Node +from .path import Path as Path + +class Graph(GraphCommands): + NAME: Any + client: Any + execute_command: Any + nodes: Any + edges: Any + version: int + def __init__(self, client, name=...) -> None: ... + @property + def name(self): ... + def get_label(self, idx): ... + def get_relation(self, idx): ... + def get_property(self, idx): ... + def add_node(self, node) -> None: ... + def add_edge(self, edge) -> None: ... + def call_procedure(self, procedure, *args, read_only: bool = ..., **kwagrs): ... + def labels(self): ... + def relationship_types(self): ... + def property_keys(self): ... diff --git a/stubs/redis/redis/commands/graph/commands.pyi b/stubs/redis/redis/commands/graph/commands.pyi new file mode 100644 index 0000000..baa0613 --- /dev/null +++ b/stubs/redis/redis/commands/graph/commands.pyi @@ -0,0 +1,17 @@ +from typing import Any + +class GraphCommands: + def commit(self): ... + version: Any + def query(self, q, params: Any | None = ..., timeout: Any | None = ..., read_only: bool = ..., profile: bool = ...): ... + def merge(self, pattern): ... + def delete(self): ... + nodes: Any + edges: Any + def flush(self) -> None: ... + def explain(self, query, params: Any | None = ...): ... + def bulk(self, **kwargs) -> None: ... + def profile(self, query): ... + def slowlog(self): ... + def config(self, name, value: Any | None = ..., set: bool = ...): ... + def list_keys(self): ... diff --git a/stubs/redis/redis/commands/graph/edge.pyi b/stubs/redis/redis/commands/graph/edge.pyi new file mode 100644 index 0000000..643175d --- /dev/null +++ b/stubs/redis/redis/commands/graph/edge.pyi @@ -0,0 +1,11 @@ +from typing import Any + +class Edge: + id: Any + relation: Any + properties: Any + src_node: Any + dest_node: Any + def __init__(self, src_node, relation, dest_node, edge_id: Any | None = ..., properties: Any | None = ...) -> None: ... + def to_string(self): ... + def __eq__(self, rhs): ... diff --git a/stubs/redis/redis/commands/graph/exceptions.pyi b/stubs/redis/redis/commands/graph/exceptions.pyi new file mode 100644 index 0000000..6069e05 --- /dev/null +++ b/stubs/redis/redis/commands/graph/exceptions.pyi @@ -0,0 +1,5 @@ +from typing import Any + +class VersionMismatchException(Exception): + version: Any + def __init__(self, version) -> None: ... diff --git a/stubs/redis/redis/commands/graph/node.pyi b/stubs/redis/redis/commands/graph/node.pyi new file mode 100644 index 0000000..8c5ec73 --- /dev/null +++ b/stubs/redis/redis/commands/graph/node.pyi @@ -0,0 +1,17 @@ +from typing import Any + +class Node: + id: Any + alias: Any + label: Any + labels: Any + properties: Any + def __init__( + self, + node_id: Any | None = ..., + alias: Any | None = ..., + label: str | list[str] | None = ..., + properties: Any | None = ..., + ) -> None: ... + def to_string(self): ... + def __eq__(self, rhs): ... diff --git a/stubs/redis/redis/commands/graph/path.pyi b/stubs/redis/redis/commands/graph/path.pyi new file mode 100644 index 0000000..69106f8 --- /dev/null +++ b/stubs/redis/redis/commands/graph/path.pyi @@ -0,0 +1,18 @@ +from typing import Any + +class Path: + append_type: Any + def __init__(self, nodes, edges) -> None: ... + @classmethod + def new_empty_path(cls): ... + def nodes(self): ... + def edges(self): ... + def get_node(self, index): ... + def get_relationship(self, index): ... + def first_node(self): ... + def last_node(self): ... + def edge_count(self): ... + def nodes_count(self): ... + def add_node(self, node): ... + def add_edge(self, edge): ... + def __eq__(self, other): ... diff --git a/stubs/redis/redis/commands/graph/query_result.pyi b/stubs/redis/redis/commands/graph/query_result.pyi new file mode 100644 index 0000000..53cf3eb --- /dev/null +++ b/stubs/redis/redis/commands/graph/query_result.pyi @@ -0,0 +1,75 @@ +from typing import Any, ClassVar +from typing_extensions import Literal + +LABELS_ADDED: str +NODES_CREATED: str +NODES_DELETED: str +RELATIONSHIPS_DELETED: str +PROPERTIES_SET: str +RELATIONSHIPS_CREATED: str +INDICES_CREATED: str +INDICES_DELETED: str +CACHED_EXECUTION: str +INTERNAL_EXECUTION_TIME: str +STATS: Any + +class ResultSetColumnTypes: + COLUMN_UNKNOWN: ClassVar[Literal[0]] + COLUMN_SCALAR: ClassVar[Literal[1]] + COLUMN_NODE: ClassVar[Literal[2]] + COLUMN_RELATION: ClassVar[Literal[3]] + +class ResultSetScalarTypes: + VALUE_UNKNOWN: ClassVar[Literal[0]] + VALUE_NULL: ClassVar[Literal[1]] + VALUE_STRING: ClassVar[Literal[2]] + VALUE_INTEGER: ClassVar[Literal[3]] + VALUE_BOOLEAN: ClassVar[Literal[4]] + VALUE_DOUBLE: ClassVar[Literal[5]] + VALUE_ARRAY: ClassVar[Literal[6]] + VALUE_EDGE: ClassVar[Literal[7]] + VALUE_NODE: ClassVar[Literal[8]] + VALUE_PATH: ClassVar[Literal[9]] + VALUE_MAP: ClassVar[Literal[10]] + VALUE_POINT: ClassVar[Literal[11]] + +class QueryResult: + graph: Any + header: Any + result_set: Any + def __init__(self, graph, response, profile: bool = ...) -> None: ... + def parse_results(self, raw_result_set) -> None: ... + statistics: Any + def parse_statistics(self, raw_statistics) -> None: ... + def parse_header(self, raw_result_set): ... + def parse_records(self, raw_result_set): ... + def parse_entity_properties(self, props): ... + def parse_string(self, cell): ... + def parse_node(self, cell): ... + def parse_edge(self, cell): ... + def parse_path(self, cell): ... + def parse_map(self, cell): ... + def parse_point(self, cell): ... + def parse_scalar(self, cell): ... + def parse_profile(self, response) -> None: ... + def is_empty(self): ... + @property + def labels_added(self): ... + @property + def nodes_created(self): ... + @property + def nodes_deleted(self): ... + @property + def properties_set(self): ... + @property + def relationships_created(self): ... + @property + def relationships_deleted(self): ... + @property + def indices_created(self): ... + @property + def indices_deleted(self): ... + @property + def cached_execution(self): ... + @property + def run_time_ms(self): ... diff --git a/stubs/redis/redis/commands/helpers.pyi b/stubs/redis/redis/commands/helpers.pyi new file mode 100644 index 0000000..ec1bb28 --- /dev/null +++ b/stubs/redis/redis/commands/helpers.pyi @@ -0,0 +1,10 @@ +def list_or_args(keys, args): ... +def nativestr(x): ... +def delist(x): ... +def parse_to_list(response): ... +def parse_list_to_dict(response): ... +def parse_to_dict(response): ... +def random_string(length: int = ...) -> str: ... +def quote_string(v): ... +def decode_dict_keys(obj): ... +def stringify_param_value(value): ... diff --git a/stubs/redis/redis/commands/json/__init__.pyi b/stubs/redis/redis/commands/json/__init__.pyi new file mode 100644 index 0000000..e67c7bf --- /dev/null +++ b/stubs/redis/redis/commands/json/__init__.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from ...client import Pipeline as ClientPipeline +from .commands import JSONCommands + +class JSON(JSONCommands): + MODULE_CALLBACKS: dict[str, Any] + client: Any + execute_command: Any + MODULE_VERSION: Any | None + def __init__(self, client, version: Any | None = ..., decoder=..., encoder=...) -> None: ... + def pipeline(self, transaction: bool = ..., shard_hint: Any | None = ...) -> Pipeline: ... + +class Pipeline(JSONCommands, ClientPipeline): ... # type: ignore[misc] diff --git a/stubs/redis/redis/commands/json/commands.pyi b/stubs/redis/redis/commands/json/commands.pyi new file mode 100644 index 0000000..6f83028 --- /dev/null +++ b/stubs/redis/redis/commands/json/commands.pyi @@ -0,0 +1,30 @@ +from typing import Any + +class JSONCommands: + def arrappend(self, name, path=..., *args): ... + def arrindex(self, name, path, scalar, start: int = ..., stop: int = ...): ... + def arrinsert(self, name, path, index, *args): ... + def arrlen(self, name, path=...): ... + def arrpop(self, name, path=..., index: int = ...): ... + def arrtrim(self, name, path, start, stop): ... + def type(self, name, path=...): ... + def resp(self, name, path=...): ... + def objkeys(self, name, path=...): ... + def objlen(self, name, path=...): ... + def numincrby(self, name, path, number): ... + def nummultby(self, name, path, number): ... + def clear(self, name, path=...): ... + def delete(self, key, path=...): ... + forget = delete + def get(self, name, *args, no_escape: bool = ...): ... + def mget(self, keys, path): ... + def set(self, name, path, obj, nx: bool = ..., xx: bool = ..., decode_keys: bool = ...): ... + def set_file(self, name, path, file_name, nx: bool = ..., xx: bool = ..., decode_keys: bool = ...): ... + def set_path(self, json_path, root_folder, nx: bool = ..., xx: bool = ..., decode_keys: bool = ...): ... + def strlen(self, name, path: Any | None = ...): ... + def toggle(self, name, path=...): ... + def strappend(self, name, value, path=...): ... + def debug(self, subcommand, key: Any | None = ..., path=...): ... + def jsonget(self, *args, **kwargs): ... + def jsonmget(self, *args, **kwargs): ... + def jsonset(self, *args, **kwargs): ... diff --git a/stubs/redis/redis/commands/json/decoders.pyi b/stubs/redis/redis/commands/json/decoders.pyi new file mode 100644 index 0000000..ccea243 --- /dev/null +++ b/stubs/redis/redis/commands/json/decoders.pyi @@ -0,0 +1,4 @@ +def bulk_of_jsons(d): ... +def decode_dict_keys(obj): ... +def unstring(obj): ... +def decode_list(b): ... diff --git a/stubs/redis/redis/commands/json/path.pyi b/stubs/redis/redis/commands/json/path.pyi new file mode 100644 index 0000000..bbc35c4 --- /dev/null +++ b/stubs/redis/redis/commands/json/path.pyi @@ -0,0 +1,5 @@ +class Path: + strPath: str + @staticmethod + def root_path() -> str: ... + def __init__(self, path: str) -> None: ... diff --git a/stubs/redis/redis/commands/parser.pyi b/stubs/redis/redis/commands/parser.pyi new file mode 100644 index 0000000..f764908 --- /dev/null +++ b/stubs/redis/redis/commands/parser.pyi @@ -0,0 +1,8 @@ +from redis.client import AbstractRedis +from redis.typing import EncodableT + +class CommandsParser: + commands: dict[str, str] + def __init__(self, redis_connection: AbstractRedis) -> None: ... + def initialize(self, r: AbstractRedis) -> None: ... + def get_keys(self, redis_conn: AbstractRedis, *args: EncodableT) -> list[EncodableT] | None: ... diff --git a/stubs/redis/redis/commands/redismodules.pyi b/stubs/redis/redis/commands/redismodules.pyi new file mode 100644 index 0000000..6f535b2 --- /dev/null +++ b/stubs/redis/redis/commands/redismodules.pyi @@ -0,0 +1,14 @@ +from .json import JSON +from .search import Search +from .timeseries import TimeSeries + +class RedisModuleCommands: + def json(self, encoder=..., decoder=...) -> JSON: ... + def ft(self, index_name: str = ...) -> Search: ... + def ts(self) -> TimeSeries: ... + def bf(self): ... + def cf(self): ... + def cms(self): ... + def topk(self): ... + def tdigest(self): ... + def graph(self, index_name: str = ...): ... diff --git a/stubs/redis/redis/commands/search/__init__.pyi b/stubs/redis/redis/commands/search/__init__.pyi new file mode 100644 index 0000000..5f84523 --- /dev/null +++ b/stubs/redis/redis/commands/search/__init__.pyi @@ -0,0 +1,22 @@ +from typing import Any + +from .commands import SearchCommands + +class Search(SearchCommands): + class BatchIndexer: + def __init__(self, client, chunk_size: int = ...) -> None: ... + def add_document( + self, + doc_id, + nosave: bool = ..., + score: float = ..., + payload: Any | None = ..., + replace: bool = ..., + partial: bool = ..., + no_create: bool = ..., + **fields, + ): ... + def add_document_hash(self, doc_id, score: float = ..., replace: bool = ...): ... + def commit(self): ... + + def __init__(self, client, index_name: str = ...) -> None: ... diff --git a/stubs/redis/redis/commands/search/aggregation.pyi b/stubs/redis/redis/commands/search/aggregation.pyi new file mode 100644 index 0000000..0ccd505 --- /dev/null +++ b/stubs/redis/redis/commands/search/aggregation.pyi @@ -0,0 +1,54 @@ +from typing import Any, ClassVar +from typing_extensions import Literal + +FIELDNAME: Any + +class Limit: + offset: Any + count: Any + def __init__(self, offset: int = ..., count: int = ...) -> None: ... + def build_args(self): ... + +class Reducer: + NAME: ClassVar[None] + def __init__(self, *args) -> None: ... + def alias(self, alias): ... + @property + def args(self): ... + +class SortDirection: + DIRSTRING: ClassVar[str | None] + field: Any + def __init__(self, field) -> None: ... + +class Asc(SortDirection): + DIRSTRING: ClassVar[Literal["ASC"]] + +class Desc(SortDirection): + DIRSTRING: ClassVar[Literal["DESC"]] + +class AggregateRequest: + def __init__(self, query: str = ...) -> None: ... + def load(self, *fields): ... + def group_by(self, fields, *reducers): ... + def apply(self, **kwexpr): ... + def limit(self, offset, num): ... + def sort_by(self, *fields, **kwargs): ... + def filter(self, expressions): ... + def with_schema(self): ... + def verbatim(self): ... + def cursor(self, count: int = ..., max_idle: float = ...): ... + def build_args(self): ... + +class Cursor: + cid: Any + max_idle: int + count: int + def __init__(self, cid) -> None: ... + def build_args(self): ... + +class AggregateResult: + rows: Any + cursor: Any + schema: Any + def __init__(self, rows, cursor, schema) -> None: ... diff --git a/stubs/redis/redis/commands/search/commands.pyi b/stubs/redis/redis/commands/search/commands.pyi new file mode 100644 index 0000000..bbff97b --- /dev/null +++ b/stubs/redis/redis/commands/search/commands.pyi @@ -0,0 +1,109 @@ +from _typeshed import Incomplete +from collections.abc import Mapping +from typing import Any +from typing_extensions import Literal, TypeAlias + +from .aggregation import AggregateRequest, AggregateResult, Cursor +from .query import Query +from .result import Result + +_QueryParams: TypeAlias = Mapping[str, str | float] + +NUMERIC: Literal["NUMERIC"] + +CREATE_CMD: Literal["FT.CREATE"] +ALTER_CMD: Literal["FT.ALTER"] +SEARCH_CMD: Literal["FT.SEARCH"] +ADD_CMD: Literal["FT.ADD"] +ADDHASH_CMD: Literal["FT.ADDHASH"] +DROP_CMD: Literal["FT.DROP"] +EXPLAIN_CMD: Literal["FT.EXPLAIN"] +EXPLAINCLI_CMD: Literal["FT.EXPLAINCLI"] +DEL_CMD: Literal["FT.DEL"] +AGGREGATE_CMD: Literal["FT.AGGREGATE"] +PROFILE_CMD: Literal["FT.PROFILE"] +CURSOR_CMD: Literal["FT.CURSOR"] +SPELLCHECK_CMD: Literal["FT.SPELLCHECK"] +DICT_ADD_CMD: Literal["FT.DICTADD"] +DICT_DEL_CMD: Literal["FT.DICTDEL"] +DICT_DUMP_CMD: Literal["FT.DICTDUMP"] +GET_CMD: Literal["FT.GET"] +MGET_CMD: Literal["FT.MGET"] +CONFIG_CMD: Literal["FT.CONFIG"] +TAGVALS_CMD: Literal["FT.TAGVALS"] +ALIAS_ADD_CMD: Literal["FT.ALIASADD"] +ALIAS_UPDATE_CMD: Literal["FT.ALIASUPDATE"] +ALIAS_DEL_CMD: Literal["FT.ALIASDEL"] +INFO_CMD: Literal["FT.INFO"] +SUGADD_COMMAND: Literal["FT.SUGADD"] +SUGDEL_COMMAND: Literal["FT.SUGDEL"] +SUGLEN_COMMAND: Literal["FT.SUGLEN"] +SUGGET_COMMAND: Literal["FT.SUGGET"] +SYNUPDATE_CMD: Literal["FT.SYNUPDATE"] +SYNDUMP_CMD: Literal["FT.SYNDUMP"] + +NOOFFSETS: Literal["NOOFFSETS"] +NOFIELDS: Literal["NOFIELDS"] +STOPWORDS: Literal["STOPWORDS"] +WITHSCORES: Literal["WITHSCORES"] +FUZZY: Literal["FUZZY"] +WITHPAYLOADS: Literal["WITHPAYLOADS"] + +class SearchCommands: + def batch_indexer(self, chunk_size: int = ...): ... + def create_index( + self, + fields, + no_term_offsets: bool = ..., + no_field_flags: bool = ..., + stopwords: Any | None = ..., + definition: Any | None = ..., + max_text_fields: bool = ..., # added in 4.1.1 + temporary: Any | None = ..., # added in 4.1.1 + no_highlight: bool = ..., # added in 4.1.1 + no_term_frequencies: bool = ..., # added in 4.1.1 + skip_initial_scan: bool = ..., # added in 4.1.1 + ): ... + def alter_schema_add(self, fields): ... + def dropindex(self, delete_documents: bool = ...): ... + def add_document( + self, + doc_id, + nosave: bool = ..., + score: float = ..., + payload: Any | None = ..., + replace: bool = ..., + partial: bool = ..., + language: Any | None = ..., + no_create: bool = ..., + **fields, + ): ... + def add_document_hash(self, doc_id, score: float = ..., language: Any | None = ..., replace: bool = ...): ... + def delete_document(self, doc_id, conn: Any | None = ..., delete_actual_document: bool = ...): ... + def load_document(self, id): ... + def get(self, *ids): ... + def info(self): ... + def get_params_args(self, query_params: _QueryParams) -> list[Any]: ... + def search(self, query: str | Query, query_params: _QueryParams | None = ...) -> Result: ... + def explain(self, query: str | Query, query_params: _QueryParams | None = ...): ... + def explain_cli(self, query): ... + def aggregate(self, query: AggregateRequest | Cursor, query_params: _QueryParams | None = ...) -> AggregateResult: ... + def profile( + self, query: str | Query | AggregateRequest, limited: bool = ..., query_params: Mapping[str, str | float] | None = ... + ) -> tuple[Incomplete, Incomplete]: ... + def spellcheck(self, query, distance: Any | None = ..., include: Any | None = ..., exclude: Any | None = ...): ... + def dict_add(self, name, *terms): ... + def dict_del(self, name, *terms): ... + def dict_dump(self, name): ... + def config_set(self, option: str, value: str) -> bool: ... + def config_get(self, option: str) -> dict[str, str]: ... + def tagvals(self, tagfield): ... + def aliasadd(self, alias): ... + def aliasupdate(self, alias): ... + def aliasdel(self, alias): ... + def sugadd(self, key, *suggestions, **kwargs): ... + def suglen(self, key): ... + def sugdel(self, key, string): ... + def sugget(self, key, prefix, fuzzy: bool = ..., num: int = ..., with_scores: bool = ..., with_payloads: bool = ...): ... + def synupdate(self, groupid, skipinitial: bool = ..., *terms): ... + def syndump(self): ... diff --git a/stubs/redis/redis/commands/search/query.pyi b/stubs/redis/redis/commands/search/query.pyi new file mode 100644 index 0000000..b41ee06 --- /dev/null +++ b/stubs/redis/redis/commands/search/query.pyi @@ -0,0 +1,47 @@ +from typing import Any + +class Query: + def __init__(self, query_string) -> None: ... + def query_string(self): ... + def limit_ids(self, *ids): ... + def return_fields(self, *fields): ... + def return_field(self, field, as_field: Any | None = ...): ... + def summarize( + self, fields: Any | None = ..., context_len: Any | None = ..., num_frags: Any | None = ..., sep: Any | None = ... + ): ... + def highlight(self, fields: Any | None = ..., tags: Any | None = ...): ... + def language(self, language): ... + def slop(self, slop): ... + def in_order(self): ... + def scorer(self, scorer): ... + def get_args(self): ... + def paging(self, offset, num): ... + def verbatim(self): ... + def no_content(self): ... + def no_stopwords(self): ... + def with_payloads(self): ... + def with_scores(self): ... + def limit_fields(self, *fields): ... + def add_filter(self, flt): ... + def sort_by(self, field, asc: bool = ...): ... + def expander(self, expander): ... + +class Filter: + args: Any + def __init__(self, keyword, field, *args) -> None: ... + +class NumericFilter(Filter): + INF: str + NEG_INF: str + def __init__(self, field, minval, maxval, minExclusive: bool = ..., maxExclusive: bool = ...) -> None: ... + +class GeoFilter(Filter): + METERS: str + KILOMETERS: str + FEET: str + MILES: str + def __init__(self, field, lon, lat, radius, unit=...) -> None: ... + +class SortbyField: + args: Any + def __init__(self, field, asc: bool = ...) -> None: ... diff --git a/stubs/redis/redis/commands/search/result.pyi b/stubs/redis/redis/commands/search/result.pyi new file mode 100644 index 0000000..2908b9a --- /dev/null +++ b/stubs/redis/redis/commands/search/result.pyi @@ -0,0 +1,7 @@ +from typing import Any + +class Result: + total: Any + duration: Any + docs: Any + def __init__(self, res, hascontent, duration: int = ..., has_payload: bool = ..., with_scores: bool = ...) -> None: ... diff --git a/stubs/redis/redis/commands/sentinel.pyi b/stubs/redis/redis/commands/sentinel.pyi new file mode 100644 index 0000000..b526a45 --- /dev/null +++ b/stubs/redis/redis/commands/sentinel.pyi @@ -0,0 +1,17 @@ +class SentinelCommands: + def sentinel(self, *args): ... + def sentinel_get_master_addr_by_name(self, service_name): ... + def sentinel_master(self, service_name): ... + def sentinel_masters(self): ... + def sentinel_monitor(self, name, ip, port, quorum): ... + def sentinel_remove(self, name): ... + def sentinel_sentinels(self, service_name): ... + def sentinel_set(self, name, option, value): ... + def sentinel_slaves(self, service_name): ... + def sentinel_reset(self, pattern): ... + def sentinel_failover(self, new_master_name): ... + def sentinel_ckquorum(self, new_master_name): ... + def sentinel_flushconfig(self): ... + +class AsyncSentinelCommands(SentinelCommands): + async def sentinel(self, *args) -> None: ... diff --git a/stubs/redis/redis/commands/timeseries/__init__.pyi b/stubs/redis/redis/commands/timeseries/__init__.pyi new file mode 100644 index 0000000..fae4f84 --- /dev/null +++ b/stubs/redis/redis/commands/timeseries/__init__.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from ...client import Pipeline as ClientPipeline +from .commands import TimeSeriesCommands + +class TimeSeries(TimeSeriesCommands): + MODULE_CALLBACKS: dict[str, Any] + client: Any + execute_command: Any + def __init__(self, client: Any | None = ..., **kwargs) -> None: ... + def pipeline(self, transaction: bool = ..., shard_hint: Any | None = ...) -> Pipeline: ... + +class Pipeline(TimeSeriesCommands, ClientPipeline): ... # type: ignore[misc] diff --git a/stubs/redis/redis/commands/timeseries/commands.pyi b/stubs/redis/redis/commands/timeseries/commands.pyi new file mode 100644 index 0000000..4a5a19a --- /dev/null +++ b/stubs/redis/redis/commands/timeseries/commands.pyi @@ -0,0 +1,95 @@ +from typing import Any +from typing_extensions import Literal + +ADD_CMD: Literal["TS.ADD"] +ALTER_CMD: Literal["TS.ALTER"] +CREATERULE_CMD: Literal["TS.CREATERULE"] +CREATE_CMD: Literal["TS.CREATE"] +DECRBY_CMD: Literal["TS.DECRBY"] +DELETERULE_CMD: Literal["TS.DELETERULE"] +DEL_CMD: Literal["TS.DEL"] +GET_CMD: Literal["TS.GET"] +INCRBY_CMD: Literal["TS.INCRBY"] +INFO_CMD: Literal["TS.INFO"] +MADD_CMD: Literal["TS.MADD"] +MGET_CMD: Literal["TS.MGET"] +MRANGE_CMD: Literal["TS.MRANGE"] +MREVRANGE_CMD: Literal["TS.MREVRANGE"] +QUERYINDEX_CMD: Literal["TS.QUERYINDEX"] +RANGE_CMD: Literal["TS.RANGE"] +REVRANGE_CMD: Literal["TS.REVRANGE"] + +class TimeSeriesCommands: + def create(self, key, **kwargs): ... + def alter(self, key, **kwargs): ... + def add(self, key, timestamp, value, **kwargs): ... + def madd(self, ktv_tuples): ... + def incrby(self, key, value, **kwargs): ... + def decrby(self, key, value, **kwargs): ... + def delete(self, key, from_time, to_time): ... + def createrule(self, source_key, dest_key, aggregation_type, bucket_size_msec): ... + def deleterule(self, source_key, dest_key): ... + def range( + self, + key, + from_time, + to_time, + count: Any | None = ..., + aggregation_type: Any | None = ..., + bucket_size_msec: int = ..., + filter_by_ts: Any | None = ..., + filter_by_min_value: Any | None = ..., + filter_by_max_value: Any | None = ..., + align: Any | None = ..., + ): ... + def revrange( + self, + key, + from_time, + to_time, + count: Any | None = ..., + aggregation_type: Any | None = ..., + bucket_size_msec: int = ..., + filter_by_ts: Any | None = ..., + filter_by_min_value: Any | None = ..., + filter_by_max_value: Any | None = ..., + align: Any | None = ..., + ): ... + def mrange( + self, + from_time, + to_time, + filters, + count: Any | None = ..., + aggregation_type: Any | None = ..., + bucket_size_msec: int = ..., + with_labels: bool = ..., + filter_by_ts: Any | None = ..., + filter_by_min_value: Any | None = ..., + filter_by_max_value: Any | None = ..., + groupby: Any | None = ..., + reduce: Any | None = ..., + select_labels: Any | None = ..., + align: Any | None = ..., + ): ... + def mrevrange( + self, + from_time, + to_time, + filters, + count: Any | None = ..., + aggregation_type: Any | None = ..., + bucket_size_msec: int = ..., + with_labels: bool = ..., + filter_by_ts: Any | None = ..., + filter_by_min_value: Any | None = ..., + filter_by_max_value: Any | None = ..., + groupby: Any | None = ..., + reduce: Any | None = ..., + select_labels: Any | None = ..., + align: Any | None = ..., + ): ... + def get(self, key): ... + def mget(self, filters, with_labels: bool = ...): ... + def info(self, key): ... + def queryindex(self, filters): ... diff --git a/stubs/redis/redis/commands/timeseries/info.pyi b/stubs/redis/redis/commands/timeseries/info.pyi new file mode 100644 index 0000000..425dd29 --- /dev/null +++ b/stubs/redis/redis/commands/timeseries/info.pyi @@ -0,0 +1,17 @@ +from typing import Any + +class TSInfo: + rules: list[Any] + labels: list[Any] + sourceKey: Any | None + chunk_count: Any | None + memory_usage: Any | None + total_samples: Any | None + retention_msecs: Any | None + last_time_stamp: Any | None + first_time_stamp: Any | None + + max_samples_per_chunk: Any | None + chunk_size: Any | None + duplicate_policy: Any | None + def __init__(self, args) -> None: ... diff --git a/stubs/redis/redis/commands/timeseries/utils.pyi b/stubs/redis/redis/commands/timeseries/utils.pyi new file mode 100644 index 0000000..4a0d52c --- /dev/null +++ b/stubs/redis/redis/commands/timeseries/utils.pyi @@ -0,0 +1,5 @@ +def list_to_dict(aList): ... +def parse_range(response): ... +def parse_m_range(response): ... +def parse_get(response): ... +def parse_m_get(response): ... diff --git a/stubs/redis/redis/connection.pyi b/stubs/redis/redis/connection.pyi index a8b4cc1..cec6df8 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -1,177 +1,226 @@ -from typing import Any, Mapping, Text, Tuple, Type - -ssl_available: Any -hiredis_version: Any -HIREDIS_SUPPORTS_CALLABLE_ERRORS: Any -HIREDIS_SUPPORTS_BYTE_BUFFER: Any -msg: Any -HIREDIS_USE_BYTE_BUFFER: Any -SYM_STAR: Any -SYM_DOLLAR: Any -SYM_CRLF: Any -SYM_EMPTY: Any -SERVER_CLOSED_CONNECTION_ERROR: Any +from _typeshed import Incomplete, Self +from collections.abc import Callable, Iterable, Mapping +from queue import Queue +from socket import socket +from typing import Any, ClassVar +from typing_extensions import TypeAlias + +from .retry import Retry + +ssl_available: bool +SYM_STAR: bytes +SYM_DOLLAR: bytes +SYM_CRLF: bytes +SYM_EMPTY: bytes +SERVER_CLOSED_CONNECTION_ERROR: str +NONBLOCKING_EXCEPTIONS: tuple[type[Exception], ...] +NONBLOCKING_EXCEPTION_ERROR_NUMBERS: dict[type[Exception], int] +SENTINEL: object +MODULE_LOAD_ERROR: str +NO_SUCH_MODULE_ERROR: str +MODULE_UNLOAD_NOT_POSSIBLE_ERROR: str +MODULE_EXPORTS_DATA_TYPES_ERROR: str +FALSE_STRINGS: tuple[str, ...] +URL_QUERY_ARGUMENT_PARSERS: dict[str, Callable[[Any], Any]] + +# Options as passed to Pool.get_connection(). +_ConnectionPoolOptions: TypeAlias = Any +_ConnectFunc: TypeAlias = Callable[[Connection], object] class BaseParser: - EXCEPTION_CLASSES: Any - def parse_error(self, response): ... + EXCEPTION_CLASSES: ClassVar[dict[str, type[Exception] | dict[str, type[Exception]]]] + def parse_error(self, response: str) -> Exception: ... class SocketBuffer: - socket_read_size: Any - bytes_written: Any - bytes_read: Any - def __init__(self, socket, socket_read_size, socket_timeout) -> None: ... + socket_read_size: int + bytes_written: int + bytes_read: int + socket_timeout: float | None + def __init__(self, socket: socket, socket_read_size: int, socket_timeout: float | None) -> None: ... @property - def length(self): ... - def read(self, length): ... - def readline(self): ... - def purge(self): ... - def close(self): ... - def can_read(self, timeout): ... + def length(self) -> int: ... + def read(self, length: int) -> bytes: ... + def readline(self) -> bytes: ... + def purge(self) -> None: ... + def close(self) -> None: ... + def can_read(self, timeout: float | None) -> bool: ... class PythonParser(BaseParser): - encoding: Any - socket_read_size: Any - def __init__(self, socket_read_size) -> None: ... - def __del__(self): ... - def on_connect(self, connection): ... - def on_disconnect(self): ... - def can_read(self, timeout): ... - def read_response(self): ... + encoding: str + socket_read_size: int + encoder: Encoder | None + def __init__(self, socket_read_size: int) -> None: ... + def __del__(self) -> None: ... + def on_connect(self, connection: Connection) -> None: ... + def on_disconnect(self) -> None: ... + def can_read(self, timeout: float | None) -> bool: ... + def read_response(self, disable_decoding: bool = ...) -> Any: ... # `str | bytes` or `list[str | bytes]` class HiredisParser(BaseParser): - socket_read_size: Any - def __init__(self, socket_read_size) -> None: ... - def __del__(self): ... - def on_connect(self, connection): ... - def on_disconnect(self): ... - def can_read(self, timeout): ... - def read_from_socket(self, timeout=..., raise_on_timeout: bool = ...) -> bool: ... - def read_response(self): ... + socket_read_size: int + def __init__(self, socket_read_size: int) -> None: ... + def __del__(self) -> None: ... + def on_connect(self, connection: Connection, **kwargs) -> None: ... + def on_disconnect(self) -> None: ... + def can_read(self, timeout: float | None) -> bool: ... + def read_from_socket(self, timeout: float | None = ..., raise_on_timeout: bool = ...) -> bool: ... + def read_response(self, disable_decoding: bool = ...) -> Any: ... # `str | bytes` or `list[str | bytes]` -DefaultParser: Any +DefaultParser: type[BaseParser] # Hiredis or PythonParser + +_Encodable: TypeAlias = str | bytes | memoryview | bool | float class Encoder: - def __init__(self, encoding, encoding_errors, decode_responses: bool) -> None: ... - def encode(self, value: Text | bytes | memoryview | bool | float) -> bytes: ... - def decode(self, value: Text | bytes | memoryview, force: bool = ...) -> Text: ... + encoding: str + encoding_errors: str + decode_responses: bool + def __init__(self, encoding: str, encoding_errors: str, decode_responses: bool) -> None: ... + def encode(self, value: _Encodable) -> bytes: ... + def decode(self, value: str | bytes | memoryview, force: bool = ...) -> str: ... class Connection: - description_format: Any - pid: Any - host: Any - port: Any - db: Any - password: Any - socket_timeout: Any - socket_connect_timeout: Any - socket_keepalive: Any - socket_keepalive_options: Any - retry_on_timeout: Any - encoding: Any - encoding_errors: Any - decode_responses: Any + pid: int + host: str + port: int + db: int + username: str | None + password: str | None + client_name: str | None + socket_timeout: float | None + socket_connect_timeout: float | None + socket_keepalive: bool + socket_keepalive_options: Mapping[str, int | str] + socket_type: int + retry_on_timeout: bool + retry_on_error: list[type[Exception]] + retry: Retry + redis_connect_func: _ConnectFunc | None + encoder: Encoder + next_health_check: int + health_check_interval: int def __init__( self, - host: Text = ..., + host: str = ..., port: int = ..., db: int = ..., - password: Text | None = ..., + password: str | None = ..., socket_timeout: float | None = ..., socket_connect_timeout: float | None = ..., socket_keepalive: bool = ..., socket_keepalive_options: Mapping[str, int | str] | None = ..., socket_type: int = ..., retry_on_timeout: bool = ..., - encoding: Text = ..., - encoding_errors: Text = ..., + retry_on_error: list[type[Exception]] = ..., + encoding: str = ..., + encoding_errors: str = ..., decode_responses: bool = ..., - parser_class: Type[BaseParser] = ..., + parser_class: type[BaseParser] = ..., socket_read_size: int = ..., health_check_interval: int = ..., - client_name: Text | None = ..., - username: Text | None = ..., + client_name: str | None = ..., + username: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: _ConnectFunc | None = ..., ) -> None: ... - def __del__(self): ... - def register_connect_callback(self, callback): ... - def clear_connect_callbacks(self): ... - def connect(self): ... - def on_connect(self): ... - def disconnect(self): ... + def __del__(self) -> None: ... + def register_connect_callback(self, callback: _ConnectFunc) -> None: ... + def clear_connect_callbacks(self) -> None: ... + def set_parser(self, parser_class: type[BaseParser]) -> None: ... + def connect(self) -> None: ... + def on_connect(self) -> None: ... + def disconnect(self, *args: object) -> None: ... # 'args' added in redis 4.1.2 def check_health(self) -> None: ... - def send_packed_command(self, command, check_health: bool = ...): ... - def send_command(self, *args): ... - def can_read(self, timeout=...): ... - def read_response(self): ... - def pack_command(self, *args): ... - def pack_commands(self, commands): ... - def repr_pieces(self) -> list[Tuple[Text, Text]]: ... + def send_packed_command(self, command: str | Iterable[str], check_health: bool = ...) -> None: ... + def send_command(self, *args, **kwargs) -> None: ... + def can_read(self, timeout: float | None = ...) -> bool: ... + def read_response(self, disable_decoding: bool = ...) -> Any: ... # `str | bytes` or `list[str | bytes]` + def pack_command(self, *args) -> list[bytes]: ... + def pack_commands(self, commands: Iterable[Iterable[Incomplete]]) -> list[bytes]: ... + def repr_pieces(self) -> list[tuple[str, str]]: ... class SSLConnection(Connection): - description_format: Any keyfile: Any certfile: Any cert_reqs: Any ca_certs: Any + ca_path: Any | None + check_hostname: bool + certificate_password: Any | None + ssl_validate_ocsp: bool + ssl_validate_ocsp_stapled: bool # added in 4.1.1 + ssl_ocsp_context: Any | None # added in 4.1.1 + ssl_ocsp_expected_cert: Any | None # added in 4.1.1 def __init__( - self, ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=..., ssl_check_hostname: bool = ..., **kwargs + self, + ssl_keyfile=..., + ssl_certfile=..., + ssl_cert_reqs=..., + ssl_ca_certs=..., + ssl_ca_data: Any | None = ..., + ssl_check_hostname: bool = ..., + ssl_ca_path: Any | None = ..., + ssl_password: Any | None = ..., + ssl_validate_ocsp: bool = ..., + ssl_validate_ocsp_stapled: bool = ..., # added in 4.1.1 + ssl_ocsp_context: Any | None = ..., # added in 4.1.1 + ssl_ocsp_expected_cert: Any | None = ..., # added in 4.1.1 + **kwargs, ) -> None: ... class UnixDomainSocketConnection(Connection): - description_format: Any - pid: Any - path: Any - db: Any - password: Any - socket_timeout: Any - retry_on_timeout: Any - encoding: Any - encoding_errors: Any - decode_responses: Any + path: str def __init__( self, - path=..., + path: str = ..., db: int = ..., - username=..., - password=..., - socket_timeout=..., - encoding=..., - encoding_errors=..., - decode_responses=..., - retry_on_timeout=..., - parser_class=..., + username: str | None = ..., + password: str | None = ..., + socket_timeout: float | None = ..., + encoding: str = ..., + encoding_errors: str = ..., + decode_responses: bool = ..., + retry_on_timeout: bool = ..., + retry_on_error: list[type[Exception]] = ..., + parser_class: type[BaseParser] = ..., socket_read_size: int = ..., health_check_interval: int = ..., - client_name=..., + client_name: str | None = ..., + retry: Retry | None = ..., + redis_connect_func: _ConnectFunc | None = ..., ) -> None: ... - def repr_pieces(self) -> list[Tuple[Text, Text]]: ... - -def to_bool(value: object) -> bool: ... +# TODO: make generic on `connection_class` class ConnectionPool: + connection_class: type[Connection] + connection_kwargs: dict[str, Any] + max_connections: int + pid: int @classmethod - def from_url(cls, url: Text, db: int | None = ..., decode_components: bool = ..., **kwargs) -> ConnectionPool: ... - connection_class: Any - connection_kwargs: Any - max_connections: Any - def __init__(self, connection_class=..., max_connections=..., **connection_kwargs) -> None: ... - pid: Any - def reset(self): ... - def get_connection(self, command_name, *keys, **options): ... - def make_connection(self): ... - def release(self, connection): ... - def disconnect(self, inuse_connections: bool = ...): ... + def from_url(cls: type[Self], url: str, *, db: int = ..., decode_components: bool = ..., **kwargs) -> Self: ... + def __init__( + self, connection_class: type[Connection] = ..., max_connections: int | None = ..., **connection_kwargs + ) -> None: ... + def reset(self) -> None: ... + def get_connection(self, command_name: object, *keys, **options: _ConnectionPoolOptions) -> Connection: ... + def make_connection(self) -> Connection: ... + def release(self, connection: Connection) -> None: ... + def disconnect(self, inuse_connections: bool = ...) -> None: ... def get_encoder(self) -> Encoder: ... def owns_connection(self, connection: Connection) -> bool: ... class BlockingConnectionPool(ConnectionPool): - queue_class: Any - timeout: Any - def __init__(self, max_connections=..., timeout=..., connection_class=..., queue_class=..., **connection_kwargs) -> None: ... - pid: Any - pool: Any - def reset(self): ... - def make_connection(self): ... - def get_connection(self, command_name, *keys, **options): ... - def release(self, connection): ... - def disconnect(self): ... + queue_class: type[Queue[Any]] + timeout: float + pool: Queue[Connection | None] # might not be defined + def __init__( + self, + max_connections: int = ..., + timeout: float = ..., + connection_class: type[Connection] = ..., + queue_class: type[Queue[Any]] = ..., + **connection_kwargs, + ) -> None: ... + def disconnect(self) -> None: ... # type: ignore[override] + +def to_bool(value: object) -> bool: ... +def parse_url(url: str) -> dict[str, Any]: ... diff --git a/stubs/redis/redis/crc.pyi b/stubs/redis/redis/crc.pyi new file mode 100644 index 0000000..87585a3 --- /dev/null +++ b/stubs/redis/redis/crc.pyi @@ -0,0 +1,5 @@ +from redis.typing import EncodedT + +REDIS_CLUSTER_HASH_SLOTS: int + +def key_slot(key: EncodedT, bucket: int = ...) -> int: ... diff --git a/stubs/redis/redis/exceptions.pyi b/stubs/redis/redis/exceptions.pyi index 05f09ab..1820d3d 100644 --- a/stubs/redis/redis/exceptions.pyi +++ b/stubs/redis/redis/exceptions.pyi @@ -1,10 +1,8 @@ class RedisError(Exception): ... - -def __unicode__(self): ... - class AuthenticationError(RedisError): ... class ConnectionError(RedisError): ... class TimeoutError(RedisError): ... +class AuthorizationError(ConnectionError): ... class BusyLoadingError(ConnectionError): ... class InvalidResponse(RedisError): ... class ResponseError(RedisError): ... @@ -15,7 +13,30 @@ class NoScriptError(ResponseError): ... class ExecAbortError(ResponseError): ... class ReadOnlyError(ResponseError): ... class NoPermissionError(ResponseError): ... +class ModuleError(ResponseError): ... class LockError(RedisError, ValueError): ... class LockNotOwnedError(LockError): ... class ChildDeadlockedError(Exception): ... class AuthenticationWrongNumberOfArgsError(ResponseError): ... +class RedisClusterException(Exception): ... +class ClusterError(RedisError): ... + +class ClusterDownError(ClusterError, ResponseError): + args: tuple[str] + message: str + def __init__(self, resp: str) -> None: ... + +class AskError(ResponseError): + args: tuple[str] + message: str + slot_id: int + node_addr: tuple[str, int] + host: str + port: int + def __init__(self, resp: str) -> None: ... + +class TryAgainError(ResponseError): ... +class ClusterCrossSlotError(ResponseError): ... +class MovedError(AskError): ... +class MasterDownError(ClusterDownError): ... +class SlotNotCoveredError(RedisClusterException): ... diff --git a/stubs/redis/redis/lock.pyi b/stubs/redis/redis/lock.pyi index 23ed04f..7d6bc94 100644 --- a/stubs/redis/redis/lock.pyi +++ b/stubs/redis/redis/lock.pyi @@ -1,15 +1,19 @@ +from _typeshed import Self from types import TracebackType -from typing import Any, Text, Type, Union -from typing_extensions import Protocol +from typing import Any, ClassVar, Protocol from redis.client import Redis -_TokenValue = Union[bytes, Text] - class _Local(Protocol): - token: _TokenValue | None + token: str | bytes | None class Lock: + LUA_EXTEND_SCRIPT: ClassVar[str] + LUA_REACQUIRE_SCRIPT: ClassVar[str] + LUA_RELEASE_SCRIPT: ClassVar[str] + lua_extend: ClassVar[Any | None] + lua_reacquire: ClassVar[Any | None] + lua_release: ClassVar[Any | None] local: _Local def __init__( self, @@ -22,19 +26,23 @@ class Lock: thread_local: bool = ..., ) -> None: ... def register_scripts(self) -> None: ... - def __enter__(self) -> Lock: ... + def __enter__(self: Self) -> Self: ... def __exit__( - self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> bool | None: ... def acquire( - self, blocking: bool | None = ..., blocking_timeout: None | int | float = ..., token: _TokenValue | None = ... + self, + sleep: float | None = ..., + blocking: bool | None = ..., + blocking_timeout: float | None = ..., + token: str | bytes | None = ..., ) -> bool: ... - def do_acquire(self, token: _TokenValue) -> bool: ... + def do_acquire(self, token: str | bytes) -> bool: ... def locked(self) -> bool: ... def owned(self) -> bool: ... def release(self) -> None: ... - def do_release(self, expected_token: _TokenValue) -> None: ... - def extend(self, additional_time: int | float, replace_ttl: bool = ...) -> bool: ... - def do_extend(self, additional_time: int | float, replace_ttl: bool) -> bool: ... + def do_release(self, expected_token: str | bytes) -> None: ... + def extend(self, additional_time: float, replace_ttl: bool = ...) -> bool: ... + def do_extend(self, additional_time: float, replace_ttl: bool) -> bool: ... def reacquire(self) -> bool: ... def do_reacquire(self) -> bool: ... diff --git a/stubs/redis/redis/ocsp.pyi b/stubs/redis/redis/ocsp.pyi new file mode 100644 index 0000000..41d8797 --- /dev/null +++ b/stubs/redis/redis/ocsp.pyi @@ -0,0 +1,13 @@ +from typing import Any + +class OCSPVerifier: + SOCK: Any + HOST: Any + PORT: Any + CA_CERTS: Any + def __init__(self, sock, host, port, ca_certs: Any | None = ...) -> None: ... + def components_from_socket(self): ... + def components_from_direct_connection(self): ... + def build_certificate_url(self, server, cert, issuer_cert): ... + def check_certificate(self, server, cert, issuer_url): ... + def is_valid(self): ... diff --git a/stubs/redis/redis/retry.pyi b/stubs/redis/redis/retry.pyi new file mode 100644 index 0000000..ec20224 --- /dev/null +++ b/stubs/redis/redis/retry.pyi @@ -0,0 +1,11 @@ +from collections.abc import Callable, Iterable +from typing import TypeVar + +from redis.backoff import AbstractBackoff + +_T = TypeVar("_T") + +class Retry: + def __init__(self, backoff: AbstractBackoff, retries: int, supported_errors: tuple[type[Exception], ...] = ...) -> None: ... + def update_supported_errors(self, specified_errors: Iterable[type[Exception]]) -> None: ... + def call_with_retry(self, do: Callable[[], _T], fail: Callable[[Exception], object]) -> _T: ... diff --git a/stubs/redis/redis/sentinel.pyi b/stubs/redis/redis/sentinel.pyi new file mode 100644 index 0000000..ea13ae6 --- /dev/null +++ b/stubs/redis/redis/sentinel.pyi @@ -0,0 +1,62 @@ +from collections.abc import Iterable, Iterator +from typing import Any, TypeVar, overload +from typing_extensions import Literal, TypeAlias + +from redis.client import Redis +from redis.commands.sentinel import SentinelCommands +from redis.connection import Connection, ConnectionPool, SSLConnection +from redis.exceptions import ConnectionError + +_RedisT = TypeVar("_RedisT", bound=Redis[Any]) +_AddressAndPort: TypeAlias = tuple[str, int] +_SentinelState: TypeAlias = dict[str, Any] # TODO: this can be a TypedDict + +class MasterNotFoundError(ConnectionError): ... +class SlaveNotFoundError(ConnectionError): ... + +class SentinelManagedConnection(Connection): + connection_pool: SentinelConnectionPool + def __init__(self, **kwargs) -> None: ... + def connect_to(self, address: _AddressAndPort) -> None: ... + def connect(self) -> None: ... + # The result can be either `str | bytes` or `list[str | bytes]` + def read_response(self, disable_decoding: bool = ...) -> Any: ... + +class SentinelManagedSSLConnection(SentinelManagedConnection, SSLConnection): ... + +class SentinelConnectionPool(ConnectionPool): + is_master: bool + check_connection: bool + service_name: str + sentinel_manager: Sentinel + def __init__(self, service_name: str, sentinel_manager: Sentinel, **kwargs) -> None: ... + def reset(self) -> None: ... + def owns_connection(self, connection: Connection) -> bool: ... + def get_master_address(self) -> _AddressAndPort: ... + def rotate_slaves(self) -> Iterator[_AddressAndPort]: ... + +class Sentinel(SentinelCommands): + sentinel_kwargs: dict[str, Any] + sentinels: list[Redis[Any]] + min_other_sentinels: int + connection_kwargs: dict[str, Any] + def __init__( + self, + sentinels: Iterable[_AddressAndPort], + min_other_sentinels: int = ..., + sentinel_kwargs: dict[str, Any] | None = ..., + **connection_kwargs, + ) -> None: ... + def check_master_state(self, state: _SentinelState, service_name: str) -> bool: ... + def discover_master(self, service_name: str) -> _AddressAndPort: ... + def filter_slaves(self, slaves: Iterable[_SentinelState]) -> list[_AddressAndPort]: ... + def discover_slaves(self, service_name: str) -> list[_AddressAndPort]: ... + @overload + def master_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ... + @overload + def master_for(self, service_name: str, redis_class: type[_RedisT], connection_pool_class=..., **kwargs) -> _RedisT: ... + @overload + def slave_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ... + @overload + def slave_for(self, service_name: str, redis_class: type[_RedisT], connection_pool_class=..., **kwargs) -> _RedisT: ... + def execute_command(self, *args, **kwargs) -> Literal[True]: ... diff --git a/stubs/redis/redis/typing.pyi b/stubs/redis/redis/typing.pyi new file mode 100644 index 0000000..f351ed4 --- /dev/null +++ b/stubs/redis/redis/typing.pyi @@ -0,0 +1,34 @@ +from collections.abc import Iterable +from datetime import datetime, timedelta +from typing import Protocol, TypeVar +from typing_extensions import TypeAlias + +from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool +from redis.connection import ConnectionPool + +# The following type aliases exist at runtime. +EncodedT: TypeAlias = bytes | memoryview +DecodedT: TypeAlias = str | int | float +EncodableT: TypeAlias = EncodedT | DecodedT +AbsExpiryT: TypeAlias = int | datetime +ExpiryT: TypeAlias = float | timedelta +ZScoreBoundT: TypeAlias = float | str +BitfieldOffsetT: TypeAlias = int | str +_StringLikeT: TypeAlias = bytes | str | memoryview # noqa: Y043 +KeyT: TypeAlias = _StringLikeT +PatternT: TypeAlias = _StringLikeT +FieldT: TypeAlias = EncodableT +KeysT: TypeAlias = KeyT | Iterable[KeyT] +ChannelT: TypeAlias = _StringLikeT +GroupT: TypeAlias = _StringLikeT +ConsumerT: TypeAlias = _StringLikeT +StreamIdT: TypeAlias = int | _StringLikeT +ScriptTextT: TypeAlias = _StringLikeT +TimeoutSecT: TypeAlias = int | float | _StringLikeT +AnyKeyT = TypeVar("AnyKeyT", bytes, str, memoryview) # noqa: Y001 +AnyFieldT = TypeVar("AnyFieldT", bytes, str, memoryview) # noqa: Y001 +AnyChannelT = TypeVar("AnyChannelT", bytes, str, memoryview) # noqa: Y001 + +class CommandsProtocol(Protocol): + connection_pool: AsyncConnectionPool | ConnectionPool + def execute_command(self, *args, **options): ... diff --git a/stubs/redis/redis/utils.pyi b/stubs/redis/redis/utils.pyi index aa0e827..09f2610 100644 --- a/stubs/redis/redis/utils.pyi +++ b/stubs/redis/redis/utils.pyi @@ -1,4 +1,6 @@ -from typing import Any, ContextManager, Text, TypeVar, overload +from collections.abc import Iterable, Mapping +from contextlib import AbstractContextManager +from typing import Any, TypeVar, overload from typing_extensions import Literal from .client import Pipeline, Redis, _StrType @@ -6,16 +8,15 @@ from .client import Pipeline, Redis, _StrType _T = TypeVar("_T") HIREDIS_AVAILABLE: bool +CRYPTOGRAPHY_AVAILABLE: bool @overload -def from_url(url: Text, db: int | None = ..., *, decode_responses: Literal[True], **kwargs: Any) -> Redis[str]: ... +def from_url(url: str, *, db: int = ..., decode_responses: Literal[True], **kwargs: Any) -> Redis[str]: ... @overload -def from_url(url: Text, db: int | None = ..., *, decode_responses: Literal[False] = ..., **kwargs: Any) -> Redis[bytes]: ... -@overload -def str_if_bytes(value: bytes) -> str: ... # type: ignore -@overload -def str_if_bytes(value: _T) -> _T: ... +def from_url(url: str, *, db: int = ..., decode_responses: Literal[False] = ..., **kwargs: Any) -> Redis[bytes]: ... +def pipeline(redis_obj: Redis[_StrType]) -> AbstractContextManager[Pipeline[_StrType]]: ... +def str_if_bytes(value: str | bytes) -> str: ... def safe_str(value: object) -> str: ... -def pipeline(redis_obj: Redis[_StrType]) -> ContextManager[Pipeline[_StrType]]: ... - -class dummy: ... +def dict_merge(*dicts: Mapping[str, _T]) -> dict[str, _T]: ... +def list_keys_to_dict(key_list, callback): ... # unused, alias for `dict.fromkeys` +def merge_result(command: object, res: Mapping[Any, Iterable[_T]]) -> list[_T]: ... diff --git a/stubs/regex/@tests/stubtest_allowlist.txt b/stubs/regex/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..2f05cbe --- /dev/null +++ b/stubs/regex/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +# These classes are defined in regex/_regex.c and are returned by the public API functions. +# The stubs are defined in regex/_regex.pyi but these classes aren't present at runtime. +regex._regex.Match +regex._regex.Pattern +regex._regex.Scanner +regex._regex.Splitter diff --git a/stubs/regex/METADATA.toml b/stubs/regex/METADATA.toml new file mode 100644 index 0000000..f508c79 --- /dev/null +++ b/stubs/regex/METADATA.toml @@ -0,0 +1 @@ +version = "2022.10.31" diff --git a/stubs/regex/regex/__init__.pyi b/stubs/regex/regex/__init__.pyi new file mode 100644 index 0000000..f310be6 --- /dev/null +++ b/stubs/regex/regex/__init__.pyi @@ -0,0 +1 @@ +from .regex import * diff --git a/stubs/regex/regex/_regex.pyi b/stubs/regex/regex/_regex.pyi new file mode 100644 index 0000000..9cf70db --- /dev/null +++ b/stubs/regex/regex/_regex.pyi @@ -0,0 +1,343 @@ +from _typeshed import ReadableBuffer, Self +from collections.abc import Callable, Mapping +from typing import Any, AnyStr, Generic, TypeVar, overload +from typing_extensions import Literal, final + +_T = TypeVar("_T") + +@final +class Pattern(Generic[AnyStr]): + @property + def flags(self) -> int: ... + @property + def groupindex(self) -> Mapping[str, int]: ... + @property + def groups(self) -> int: ... + @property + def pattern(self) -> AnyStr: ... + @property + def named_lists(self) -> Mapping[str, frozenset[AnyStr]]: ... + @overload + def search( + self: Pattern[str], + string: str, + pos: int = ..., + endpos: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Match[str] | None: ... + @overload + def search( + self: Pattern[bytes], + string: ReadableBuffer, + pos: int = ..., + endpos: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Match[bytes] | None: ... + @overload + def match( + self: Pattern[str], + string: str, + pos: int = ..., + endpos: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Match[str] | None: ... + @overload + def match( + self: Pattern[bytes], + string: ReadableBuffer, + pos: int = ..., + endpos: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Match[bytes] | None: ... + @overload + def fullmatch( + self: Pattern[str], + string: str, + pos: int = ..., + endpos: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Match[str] | None: ... + @overload + def fullmatch( + self: Pattern[bytes], + string: ReadableBuffer, + pos: int = ..., + endpos: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Match[bytes] | None: ... + @overload + def split( + self: Pattern[str], string: str, maxsplit: int = ..., concurrent: bool | None = ..., timeout: float | None = ... + ) -> list[str | Any]: ... + @overload + def split( + self: Pattern[bytes], + string: ReadableBuffer, + maxsplit: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> list[bytes | Any]: ... + @overload + def splititer( + self: Pattern[str], string: str, maxsplit: int = ..., concurrent: bool | None = ..., timeout: float | None = ... + ) -> Splitter[str]: ... + @overload + def splititer( + self: Pattern[bytes], + string: ReadableBuffer, + maxsplit: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Splitter[bytes]: ... + @overload + def findall( + self: Pattern[str], + string: str, + pos: int = ..., + endpos: int = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> list[Any]: ... + @overload + def findall( + self: Pattern[bytes], + string: ReadableBuffer, + pos: int = ..., + endpos: int = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> list[Any]: ... + @overload + def finditer( + self: Pattern[str], + string: str, + pos: int = ..., + endpos: int = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Scanner[str]: ... + @overload + def finditer( + self: Pattern[bytes], + string: ReadableBuffer, + pos: int = ..., + endpos: int = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Scanner[bytes]: ... + @overload + def sub( + self: Pattern[str], + repl: str | Callable[[Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> str: ... + @overload + def sub( + self: Pattern[bytes], + repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> bytes: ... + @overload + def subf( + self: Pattern[str], + format: str | Callable[[Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> str: ... + @overload + def subf( + self: Pattern[bytes], + format: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> bytes: ... + @overload + def subn( + self: Pattern[str], + repl: str | Callable[[Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> tuple[str, int]: ... + @overload + def subn( + self: Pattern[bytes], + repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> tuple[bytes, int]: ... + @overload + def subfn( + self: Pattern[str], + format: str | Callable[[Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> tuple[str, int]: ... + @overload + def subfn( + self: Pattern[bytes], + format: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> tuple[bytes, int]: ... + @overload + def scanner( + self: Pattern[str], + string: str, + pos: int | None = ..., + endpos: int | None = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Scanner[str]: ... + @overload + def scanner( + self: Pattern[bytes], + string: bytes, + pos: int | None = ..., + endpos: int | None = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ) -> Scanner[bytes]: ... + +@final +class Match(Generic[AnyStr]): + @property + def pos(self) -> int: ... + @property + def endpos(self) -> int: ... + @property + def lastindex(self) -> int | None: ... + @property + def lastgroup(self) -> str | None: ... + @property + def string(self) -> AnyStr: ... + @property + def re(self) -> Pattern[AnyStr]: ... + @property + def partial(self) -> bool: ... + @property + def regs(self) -> tuple[tuple[int, int], ...]: ... + @property + def fuzzy_counts(self) -> tuple[int, int, int]: ... + @property + def fuzzy_changes(self) -> tuple[list[int], list[int], list[int]]: ... + @overload + def group(self, __group: Literal[0] = ...) -> AnyStr: ... + @overload + def group(self, __group: int | str = ...) -> AnyStr | Any: ... + @overload + def group(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[AnyStr | Any, ...]: ... + @overload + def groups(self, default: None = ...) -> tuple[AnyStr | Any, ...]: ... + @overload + def groups(self, default: _T) -> tuple[AnyStr | _T, ...]: ... + @overload + def groupdict(self, default: None = ...) -> dict[str, AnyStr | Any]: ... + @overload + def groupdict(self, default: _T) -> dict[str, AnyStr | _T]: ... + @overload + def span(self, __group: int | str = ...) -> tuple[int, int]: ... + @overload + def span(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[tuple[int, int], ...]: ... + @overload + def spans(self, __group: int | str = ...) -> list[tuple[int, int]]: ... + @overload + def spans(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[list[tuple[int, int]], ...]: ... + @overload + def start(self, __group: int | str = ...) -> int: ... + @overload + def start(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[int, ...]: ... + @overload + def starts(self, __group: int | str = ...) -> list[int]: ... + @overload + def starts(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[list[int], ...]: ... + @overload + def end(self, __group: int | str = ...) -> int: ... + @overload + def end(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[int, ...]: ... + @overload + def ends(self, __group: int | str = ...) -> list[int]: ... + @overload + def ends(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[list[int], ...]: ... + def expand(self, template: AnyStr) -> AnyStr: ... + def expandf(self, format: AnyStr) -> AnyStr: ... + @overload + def captures(self, __group: int | str = ...) -> list[AnyStr]: ... + @overload + def captures(self, __group1: int | str, __group2: int | str, *groups: int | str) -> tuple[list[AnyStr], ...]: ... + def capturesdict(self) -> dict[str, list[AnyStr]]: ... + def detach_string(self) -> None: ... + @overload + def __getitem__(self, __key: Literal[0]) -> AnyStr: ... + @overload + def __getitem__(self, __key: int | str) -> AnyStr | Any: ... + +@final +class Splitter(Generic[AnyStr]): + @property + def pattern(self) -> Pattern[AnyStr]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> AnyStr | Any: ... + def split(self) -> AnyStr | Any: ... + +@final +class Scanner(Generic[AnyStr]): + @property + def pattern(self) -> Pattern[AnyStr]: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> Match[AnyStr]: ... + def match(self) -> Match[AnyStr] | None: ... + def search(self) -> Match[AnyStr] | None: ... diff --git a/stubs/regex/regex/_regex_core.pyi b/stubs/regex/regex/_regex_core.pyi new file mode 100644 index 0000000..5af02ff --- /dev/null +++ b/stubs/regex/regex/_regex_core.pyi @@ -0,0 +1,78 @@ +import enum +from typing import AnyStr + +class error(Exception): + def __init__(self, message: str, pattern: AnyStr | None = ..., pos: int | None = ...) -> None: ... + +class RegexFlag(enum.IntFlag): + A: int + ASCII: int + B: int + BESTMATCH: int + D: int + DEBUG: int + E: int + ENHANCEMATCH: int + F: int + FULLCASE: int + I: int + IGNORECASE: int + L: int + LOCALE: int + M: int + MULTILINE: int + P: int + POSIX: int + R: int + REVERSE: int + T: int + TEMPLATE: int + S: int + DOTALL: int + U: int + UNICODE: int + V0: int + VERSION0: int + V1: int + VERSION1: int + W: int + WORD: int + X: int + VERBOSE: int + +A: int +ASCII: int +B: int +BESTMATCH: int +D: int +DEBUG: int +E: int +ENHANCEMATCH: int +F: int +FULLCASE: int +I: int +IGNORECASE: int +L: int +LOCALE: int +M: int +MULTILINE: int +P: int +POSIX: int +R: int +REVERSE: int +T: int +TEMPLATE: int +S: int +DOTALL: int +U: int +UNICODE: int +V0: int +VERSION0: int +V1: int +VERSION1: int +W: int +WORD: int +X: int +VERBOSE: int + +DEFAULT_VERSION: int diff --git a/stubs/regex/regex/regex.pyi b/stubs/regex/regex/regex.pyi new file mode 100644 index 0000000..694da59 --- /dev/null +++ b/stubs/regex/regex/regex.pyi @@ -0,0 +1,314 @@ +from _typeshed import ReadableBuffer +from collections.abc import Callable +from typing import Any, AnyStr, overload + +from . import _regex +from ._regex import Match as Match, Pattern as Pattern +from ._regex_core import * + +__version__: str + +def compile( + pattern: AnyStr | _regex.Pattern[AnyStr], + flags: int = ..., + ignore_unused: bool = ..., + cache_pattern: bool | None = ..., + **kwargs: Any, +) -> _regex.Pattern[AnyStr]: ... +@overload +def search( + pattern: str | Pattern[str], + string: str, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Match[str] | None: ... +@overload +def search( + pattern: bytes | Pattern[bytes], + string: ReadableBuffer, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Match[bytes] | None: ... +@overload +def match( + pattern: str | Pattern[str], + string: str, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Match[str] | None: ... +@overload +def match( + pattern: bytes | Pattern[bytes], + string: ReadableBuffer, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Match[bytes] | None: ... +@overload +def fullmatch( + pattern: str | Pattern[str], + string: str, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Match[str] | None: ... +@overload +def fullmatch( + pattern: bytes | Pattern[bytes], + string: ReadableBuffer, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Match[bytes] | None: ... +@overload +def split( + pattern: str | _regex.Pattern[str], + string: str, + maxsplit: int = ..., + flags: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> list[str | Any]: ... +@overload +def split( + pattern: ReadableBuffer | _regex.Pattern[bytes], + string: ReadableBuffer, + maxsplit: int = ..., + flags: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> list[bytes | Any]: ... +@overload +def splititer( + pattern: str | _regex.Pattern[str], + string: str, + maxsplit: int = ..., + flags: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Splitter[str]: ... +@overload +def splititer( + pattern: ReadableBuffer | _regex.Pattern[bytes], + string: ReadableBuffer, + maxsplit: int = ..., + flags: int = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Splitter[bytes]: ... +@overload +def findall( + pattern: str | _regex.Pattern[str], + string: str, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> list[Any]: ... +@overload +def findall( + pattern: ReadableBuffer | _regex.Pattern[bytes], + string: ReadableBuffer, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + overlapped: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> list[Any]: ... +@overload +def finditer( + pattern: str | _regex.Pattern[str], + string: str, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + overlapped: bool = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Scanner[str]: ... +@overload +def finditer( + pattern: ReadableBuffer | _regex.Pattern[bytes], + string: ReadableBuffer, + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + overlapped: bool = ..., + partial: bool = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> _regex.Scanner[bytes]: ... +@overload +def sub( + pattern: str | _regex.Pattern[str], + repl: str | Callable[[_regex.Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> str: ... +@overload +def sub( + pattern: ReadableBuffer | _regex.Pattern[bytes], + repl: ReadableBuffer | Callable[[_regex.Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> bytes: ... +@overload +def subf( + pattern: str | _regex.Pattern[str], + format: str | Callable[[_regex.Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> str: ... +@overload +def subf( + pattern: ReadableBuffer | _regex.Pattern[bytes], + format: ReadableBuffer | Callable[[_regex.Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> bytes: ... +@overload +def subn( + pattern: str | _regex.Pattern[str], + repl: str | Callable[[_regex.Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> tuple[str, int]: ... +@overload +def subn( + pattern: ReadableBuffer | _regex.Pattern[bytes], + repl: ReadableBuffer | Callable[[_regex.Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> tuple[bytes, int]: ... +@overload +def subfn( + pattern: str | _regex.Pattern[str], + format: str | Callable[[_regex.Match[str]], str], + string: str, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> tuple[str, int]: ... +@overload +def subfn( + pattern: ReadableBuffer | _regex.Pattern[bytes], + format: ReadableBuffer | Callable[[_regex.Match[bytes]], ReadableBuffer], + string: ReadableBuffer, + count: int = ..., + flags: int = ..., + pos: int | None = ..., + endpos: int | None = ..., + concurrent: bool | None = ..., + timeout: float | None = ..., + ignore_unused: bool = ..., + **kwargs: Any, +) -> tuple[bytes, int]: ... +def purge() -> None: ... +@overload +def cache_all(value: bool = ...) -> None: ... +@overload +def cache_all(value: None) -> bool: ... +def escape(pattern: AnyStr, special_only: bool = ..., literal_spaces: bool = ...) -> AnyStr: ... +def template(pattern: AnyStr | _regex.Pattern[AnyStr], flags: int = ...) -> _regex.Pattern[AnyStr]: ... + +Regex = compile diff --git a/stubs/requests/@tests/stubtest_allowlist.txt b/stubs/requests/@tests/stubtest_allowlist.txt index c040f9c..53ca8dd 100644 --- a/stubs/requests/@tests/stubtest_allowlist.txt +++ b/stubs/requests/@tests/stubtest_allowlist.txt @@ -1,64 +1,40 @@ -requests.Session.delete -requests.Session.get -requests.Session.head -requests.Session.options -requests.Session.patch -requests.Session.post -requests.Session.put -requests.api.delete -requests.api.get -requests.api.head -requests.api.options -requests.api.patch -requests.api.post -requests.api.put -requests.api.request -requests.delete -requests.get -requests.head -requests.options -requests.packages.VendorAlias -requests.packages.urllib3.NullHandler -requests.packages.urllib3._collections.HTTPHeaderDict.from_httplib -requests.packages.urllib3._collections.HTTPHeaderDict.getlist -requests.packages.urllib3._collections.RLock -requests.packages.urllib3.connection.HTTPConnection.request -requests.packages.urllib3.connection.HTTPSConnection.__init__ -requests.packages.urllib3.connection.VerifiedHTTPSConnection.__init__ -requests.packages.urllib3.connection.VerifiedHTTPSConnection.set_cert -requests.packages.urllib3.connectionpool.ConnectionError -requests.packages.urllib3.connectionpool.HTTPConnectionPool.__init__ -requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen -requests.packages.urllib3.connectionpool.HTTPSConnectionPool.__init__ -requests.packages.urllib3.exceptions.ProxyError.__init__ -requests.packages.urllib3.fields.RequestField.__init__ -requests.packages.urllib3.fields.RequestField.from_tuples -requests.packages.urllib3.poolmanager.PoolManager.connection_from_host -requests.packages.urllib3.poolmanager.PoolManager.connection_from_url -requests.packages.urllib3.poolmanager.PoolManager.urlopen -requests.packages.urllib3.poolmanager.ProxyManager.__init__ -requests.packages.urllib3.poolmanager.ProxyManager.connection_from_host -requests.packages.urllib3.poolmanager.ProxyManager.urlopen -requests.packages.urllib3.request.RequestMethods.request_encode_url -requests.packages.urllib3.response.HTTPResponse.__init__ -requests.packages.urllib3.response.PY3 -requests.packages.urllib3.util.connection.poll -requests.packages.urllib3.util.connection.select -requests.packages.urllib3.util.retry.Retry.is_forced_retry -requests.packages.urllib3.util.retry.Retry.sleep -requests.packages.urllib3.util.ssl_.create_default_context -requests.packages.urllib3.util.ssl_.ssl_wrap_socket -requests.patch -requests.post -requests.put -requests.request -requests.sessions.Session.delete -requests.sessions.Session.get -requests.sessions.Session.head -requests.sessions.Session.options -requests.sessions.Session.patch -requests.sessions.Session.post -requests.sessions.Session.put -requests.sessions.SessionRedirectMixin.resolve_redirects -requests.structures.LookupDict.__getattr__ -requests.structures.LookupDict.get +# Re-exports from urllib3 (should be fixed in those stubs, not here) +requests.adapters.HTTPResponse.DECODER_ERROR_CLASSES +requests.adapters.PoolManager.connection_from_context +requests.adapters.PoolManager.connection_from_host +requests.adapters.PoolManager.connection_from_pool_key +requests.adapters.PoolManager.connection_from_url +requests.adapters.PoolManager.proxy_config +requests.adapters.PoolManager.urlopen +requests.adapters.Retry.DEFAULT + +# Unnecessary re-exported constants from requests.compat +requests.adapters.basestring +requests.auth.basestring +requests.utils.basestring +requests.utils.integer_types +requests.models.basestring + +# Unnecessary re-exported constant +# (you should access this as `requests.__version__` or `requests.__version__.__version__`, +# not `requests.help.requests_version`) +requests.help.requests_version + +# No reason to access this re-exported constant from `requests.sessions` instead of from `requests.utils` +requests.sessions.DEFAULT_PORTS + +# Unnecessary re-exports of third-party modules +requests.help.chardet +requests.help.cryptography +requests.help.pyopenssl +requests.help.OpenSSL + +# Loop variables that leak into the global scope +requests.packages.mod +requests.packages.package +requests.packages.target + +# Internal implementation details, not for public consumption +requests.charset_normalizer_version +requests.chardet_version +requests.utils.HEADER_VALIDATORS diff --git a/stubs/requests/@tests/test_cases/check_post.py b/stubs/requests/@tests/test_cases/check_post.py new file mode 100644 index 0000000..59c7539 --- /dev/null +++ b/stubs/requests/@tests/test_cases/check_post.py @@ -0,0 +1,58 @@ +# pyright: reportUnnecessaryTypeIgnoreComment=true + +from __future__ import annotations + +from collections.abc import Iterable + +import requests + +# ================================================================================================= +# Regression test for #7988 (multiple files should be allowed for the "files" argument) +# This snippet comes from the requests documentation +# (https://requests.readthedocs.io/en/latest/user/advanced/#post-multiple-multipart-encoded-files), +# so should pass a type checker without error +# ================================================================================================= + + +url = "https://httpbin.org/post" +multiple_files = [ + ("images", ("foo.png", open("foo.png", "rb"), "image/png")), + ("images", ("bar.png", open("bar.png", "rb"), "image/png")), +] +r = requests.post(url, files=multiple_files) + + +# ================================================================================= +# Tests for various different types being passed into the "data" parameter +# (These all return "Any", so there's not much value in using assert_type here.) +# (Just test that type checkers don't emit an error if it doesn't fail at runtime.) +# ================================================================================= + + +# Arbitrary iterable +def gen() -> Iterable[bytes]: + yield b"foo" + yield b"bar" + + +requests.post("http://httpbin.org/anything", data=gen()).json()["data"] + +# bytes +requests.post("http://httpbin.org/anything", data=b"foobar").json()["data"] + +# str +requests.post("http://httpbin.org/anything", data="foobar").json()["data"] + +# Files +requests.post("http://httpbin.org/anything", data=open("/tmp/foobar", "rb", encoding="UTF-8")).json()["data"] +requests.post("http://httpbin.org/anything", data=open("/tmp/foobar", "r", encoding="UTF-8")).json()["data"] + +# Mappings +requests.post("http://httpbin.org/anything", data={b"foo": b"bar"}).json()["form"] +requests.post("http://httpbin.org/anything", data={"foo": "bar"}).json()["form"] + +# mappings represented by an list/tuple of key-values pairs +requests.post("http://httpbin.org/anything", data=[(b"foo", b"bar")]).json()["form"] +requests.post("http://httpbin.org/anything", data=[("foo", "bar")]).json()["form"] +requests.post("http://httpbin.org/anything", data=((b"foo", b"bar"),)).json()["form"] +requests.post("http://httpbin.org/anything", data=(("foo", "bar"),)).json()["form"] diff --git a/stubs/requests/METADATA.toml b/stubs/requests/METADATA.toml index 77efa14..0fe1db2 100644 --- a/stubs/requests/METADATA.toml +++ b/stubs/requests/METADATA.toml @@ -1,2 +1,6 @@ -version = "2.25" -python2 = true +version = "2.28.*" +requires = ["types-urllib3<1.27"] # keep in sync with requests's setup.py + +[tool.stubtest] +ignore_missing_stub = false +extras = ["socks"] diff --git a/stubs/requests/requests/__init__.pyi b/stubs/requests/requests/__init__.pyi index be5664f..b3b3796 100644 --- a/stubs/requests/requests/__init__.pyi +++ b/stubs/requests/requests/__init__.pyi @@ -1,6 +1,15 @@ -import logging -from typing import Any, Text - +from .__version__ import ( + __author__ as __author__, + __author_email__ as __author_email__, + __build__ as __build__, + __cake__ as __cake__, + __copyright__ as __copyright__, + __description__ as __description__, + __license__ as __license__, + __title__ as __title__, + __url__ as __url__, + __version__ as __version__, +) from .api import ( delete as delete, get as get, @@ -16,6 +25,7 @@ from .exceptions import ( ConnectTimeout as ConnectTimeout, FileModeWarning as FileModeWarning, HTTPError as HTTPError, + JSONDecodeError as JSONDecodeError, ReadTimeout as ReadTimeout, RequestException as RequestException, Timeout as Timeout, @@ -26,13 +36,4 @@ from .models import PreparedRequest as PreparedRequest, Request as Request, Resp from .sessions import Session as Session, session as session from .status_codes import codes as codes -__title__: Any -__build__: Any -__license__: Any -__copyright__: Any -__version__: Any - -class NullHandler(logging.Handler): - def emit(self, record): ... - -def check_compatibility(urllib3_version: Text, chardet_version: Text) -> None: ... +def check_compatibility(urllib3_version: str, chardet_version: str | None, charset_normalizer_version: str | None) -> None: ... diff --git a/stubs/requests/requests/__version__.pyi b/stubs/requests/requests/__version__.pyi new file mode 100644 index 0000000..fe5db3d --- /dev/null +++ b/stubs/requests/requests/__version__.pyi @@ -0,0 +1,10 @@ +__title__: str +__description__: str +__url__: str +__version__: str +__build__: int +__author__: str +__author_email__: str +__license__: str +__copyright__: str +__cake__: str diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index bbcdd2a..dbdd59f 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -1,33 +1,36 @@ -from typing import Any, Container, Mapping, Text, Tuple +from collections.abc import Mapping +from typing import Any -from . import cookies, exceptions, models, structures, utils -from .packages.urllib3 import exceptions as urllib3_exceptions, poolmanager, response -from .packages.urllib3.util import retry +from urllib3.contrib.socks import SOCKSProxyManager as SOCKSProxyManager +from urllib3.exceptions import ( + ConnectTimeoutError as ConnectTimeoutError, + MaxRetryError as MaxRetryError, + ProtocolError as ProtocolError, + ReadTimeoutError as ReadTimeoutError, + ResponseError as ResponseError, +) +from urllib3.poolmanager import PoolManager as PoolManager, proxy_from_url as proxy_from_url +from urllib3.response import HTTPResponse as HTTPResponse +from urllib3.util.retry import Retry as Retry -PreparedRequest = models.PreparedRequest -Response = models.Response -PoolManager = poolmanager.PoolManager -proxy_from_url = poolmanager.proxy_from_url -HTTPResponse = response.HTTPResponse -Retry = retry.Retry -DEFAULT_CA_BUNDLE_PATH = utils.DEFAULT_CA_BUNDLE_PATH -get_encoding_from_headers = utils.get_encoding_from_headers -prepend_scheme_if_needed = utils.prepend_scheme_if_needed -get_auth_from_url = utils.get_auth_from_url -urldefragauth = utils.urldefragauth -CaseInsensitiveDict = structures.CaseInsensitiveDict -ConnectTimeoutError = urllib3_exceptions.ConnectTimeoutError -MaxRetryError = urllib3_exceptions.MaxRetryError -ProtocolError = urllib3_exceptions.ProtocolError -ReadTimeoutError = urllib3_exceptions.ReadTimeoutError -ResponseError = urllib3_exceptions.ResponseError -extract_cookies_to_jar = cookies.extract_cookies_to_jar -ConnectionError = exceptions.ConnectionError -ConnectTimeout = exceptions.ConnectTimeout -ReadTimeout = exceptions.ReadTimeout -SSLError = exceptions.SSLError -ProxyError = exceptions.ProxyError -RetryError = exceptions.RetryError +from .cookies import extract_cookies_to_jar as extract_cookies_to_jar +from .exceptions import ( + ConnectionError as ConnectionError, + ConnectTimeout as ConnectTimeout, + ProxyError as ProxyError, + ReadTimeout as ReadTimeout, + RetryError as RetryError, + SSLError as SSLError, +) +from .models import PreparedRequest, Response as Response +from .structures import CaseInsensitiveDict as CaseInsensitiveDict +from .utils import ( + DEFAULT_CA_BUNDLE_PATH as DEFAULT_CA_BUNDLE_PATH, + get_auth_from_url as get_auth_from_url, + get_encoding_from_headers as get_encoding_from_headers, + prepend_scheme_if_needed as prepend_scheme_if_needed, + urldefragauth as urldefragauth, +) DEFAULT_POOLBLOCK: bool DEFAULT_POOLSIZE: int @@ -40,9 +43,9 @@ class BaseAdapter: self, request: PreparedRequest, stream: bool = ..., - timeout: None | float | Tuple[float, float] | Tuple[float, None] = ..., + timeout: None | float | tuple[float, float] | tuple[float, None] = ..., verify: bool | str = ..., - cert: None | bytes | Text | Container[bytes | Text] = ..., + cert: None | bytes | str | tuple[bytes | str, bytes | str] = ..., proxies: Mapping[str, str] | None = ..., ) -> Response: ... def close(self) -> None: ... @@ -69,8 +72,8 @@ class HTTPAdapter(BaseAdapter): self, request: PreparedRequest, stream: bool = ..., - timeout: None | float | Tuple[float, float] | Tuple[float, None] = ..., + timeout: None | float | tuple[float, float] | tuple[float, None] = ..., verify: bool | str = ..., - cert: None | bytes | Text | Container[bytes | Text] = ..., + cert: None | bytes | str | tuple[bytes | str, bytes | str] = ..., proxies: Mapping[str, str] | None = ..., ) -> Response: ... diff --git a/stubs/requests/requests/api.pyi b/stubs/requests/requests/api.pyi index 1a241d3..c4b3d5c 100644 --- a/stubs/requests/requests/api.pyi +++ b/stubs/requests/requests/api.pyi @@ -1,142 +1,154 @@ -from typing import Any, Text +from collections.abc import Mapping +from typing import Any +from typing_extensions import TypeAlias from .models import Response -from .sessions import _Data, _Params +from .sessions import RequestsCookieJar, _Auth, _Cert, _Data, _Files, _HooksInput, _Params, _TextMapping, _Timeout, _Verify + +_HeadersMapping: TypeAlias = Mapping[str, str | bytes] def request( - method: Text | bytes, - url: Text | bytes, + method: str | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def get( - url: Text | bytes, + url: str | bytes, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + *, + data: _Data | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def options( - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def head( - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def post( - url: Text | bytes, - data: _Data = ..., + url: str | bytes, + data: _Data | None = ..., json: Any | None = ..., + *, params: _Params | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., ) -> Response: ... def put( - url: Text | bytes, - data: _Data = ..., + url: str | bytes, + data: _Data | None = ..., + *, params: _Params | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def patch( - url: Text | bytes, - data: _Data = ..., + url: str | bytes, + data: _Data | None = ..., + *, params: _Params | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def delete( - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... diff --git a/stubs/requests/requests/auth.pyi b/stubs/requests/requests/auth.pyi index 97e8112..4f59bdc 100644 --- a/stubs/requests/requests/auth.pyi +++ b/stubs/requests/requests/auth.pyi @@ -1,4 +1,4 @@ -from typing import Any, Text +from typing import Any from . import cookies, models, utils @@ -9,7 +9,7 @@ to_native_string = utils.to_native_string CONTENT_TYPE_FORM_URLENCODED: Any CONTENT_TYPE_MULTI_PART: Any -def _basic_auth_str(username: bytes | Text, password: bytes | Text) -> str: ... +def _basic_auth_str(username: bytes | str, password: bytes | str) -> str: ... class AuthBase: def __call__(self, r: models.PreparedRequest) -> models.PreparedRequest: ... diff --git a/stubs/requests/requests/certs.pyi b/stubs/requests/requests/certs.pyi new file mode 100644 index 0000000..7c5857d --- /dev/null +++ b/stubs/requests/requests/certs.pyi @@ -0,0 +1 @@ +# no public data diff --git a/stubs/requests/requests/compat.pyi b/stubs/requests/requests/compat.pyi index 3e79835..aea04ce 100644 --- a/stubs/requests/requests/compat.pyi +++ b/stubs/requests/requests/compat.pyi @@ -1,3 +1,25 @@ -import collections +from builtins import bytes as bytes, str as str +from collections import OrderedDict as OrderedDict +from typing_extensions import TypeAlias +from urllib.parse import ( + quote as quote, + quote_plus as quote_plus, + unquote as unquote, + unquote_plus as unquote_plus, + urldefrag as urldefrag, + urlencode as urlencode, + urljoin as urljoin, + urlparse as urlparse, + urlsplit as urlsplit, + urlunparse as urlunparse, +) +from urllib.request import getproxies as getproxies, parse_http_list as parse_http_list, proxy_bypass as proxy_bypass -OrderedDict = collections.OrderedDict +is_py2: bool +is_py3: bool +has_simplejson: bool + +builtin_str: TypeAlias = str # noqa: Y042 +basestring: tuple[type, ...] +numeric_types: tuple[type, ...] +integer_types: tuple[type, ...] diff --git a/stubs/requests/requests/cookies.pyi b/stubs/requests/requests/cookies.pyi index 6738521..d27dea7 100644 --- a/stubs/requests/requests/cookies.pyi +++ b/stubs/requests/requests/cookies.pyi @@ -1,10 +1,6 @@ -import sys -from typing import Any, MutableMapping - -if sys.version_info >= (3, 0): - from http.cookiejar import CookieJar -else: - from cookielib import CookieJar +from collections.abc import MutableMapping +from http.cookiejar import CookieJar +from typing import Any class MockRequest: type: Any diff --git a/stubs/requests/requests/exceptions.pyi b/stubs/requests/requests/exceptions.pyi index 6ad059a..88479bb 100644 --- a/stubs/requests/requests/exceptions.pyi +++ b/stubs/requests/requests/exceptions.pyi @@ -1,12 +1,14 @@ from typing import Any -from .packages.urllib3.exceptions import HTTPError as BaseHTTPError +from urllib3.exceptions import HTTPError as BaseHTTPError class RequestException(IOError): response: Any request: Any def __init__(self, *args, **kwargs) -> None: ... +class InvalidJSONError(RequestException): ... +class JSONDecodeError(InvalidJSONError): ... class HTTPError(RequestException): ... class ConnectionError(RequestException): ... class ProxyError(ConnectionError): ... diff --git a/stubs/requests/requests/help.pyi b/stubs/requests/requests/help.pyi new file mode 100644 index 0000000..e58cb3a --- /dev/null +++ b/stubs/requests/requests/help.pyi @@ -0,0 +1,34 @@ +from typing_extensions import TypedDict + +class _VersionDict(TypedDict): + version: str + +class _OptionalVersionDict(TypedDict): + version: str | None + +class _PlatformDict(TypedDict): + system: str + release: str + +class _ImplementationDict(_VersionDict): + name: str + +class _PyOpenSSLDict(_OptionalVersionDict): + openssl_version: str + +class _InfoDict(TypedDict): + platform: _PlatformDict + implementation: _ImplementationDict + system_ssl: _VersionDict + using_pyopenssl: bool + using_charset_normalizer: bool + pyOpenSSL: _PyOpenSSLDict + urllib3: _VersionDict + chardet: _OptionalVersionDict + charset_normalizer: _OptionalVersionDict + cryptography: _VersionDict + idna: _VersionDict + requests: _VersionDict + +def info() -> _InfoDict: ... +def main() -> None: ... diff --git a/stubs/requests/requests/models.pyi b/stubs/requests/requests/models.pyi index 957a0e0..e583618 100644 --- a/stubs/requests/requests/models.pyi +++ b/stubs/requests/requests/models.pyi @@ -1,13 +1,16 @@ import datetime +from _typeshed import Self +from collections.abc import Callable, Iterator from json import JSONDecoder -from typing import Any, Callable, Iterator, Text, Type +from typing import Any -from . import auth, cookies, exceptions, hooks, status_codes, structures, utils +from urllib3 import exceptions as urllib3_exceptions, fields, filepost, util + +from . import auth, cookies, exceptions, hooks, status_codes, utils from .cookies import RequestsCookieJar -from .packages.urllib3 import exceptions as urllib3_exceptions, fields, filepost, util +from .structures import CaseInsensitiveDict as CaseInsensitiveDict default_hooks = hooks.default_hooks -CaseInsensitiveDict = structures.CaseInsensitiveDict HTTPBasicAuth = auth.HTTPBasicAuth cookiejar_from_dict = cookies.cookiejar_from_dict get_cookie_header = cookies.get_cookie_header @@ -67,10 +70,10 @@ class Request(RequestHooksMixin): def prepare(self) -> PreparedRequest: ... class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): - method: str | Text | None - url: str | Text | None + method: str | None + url: str | None headers: CaseInsensitiveDict[str] - body: bytes | Text | None + body: bytes | str | None hooks: Any def __init__(self) -> None: ... def prepare( @@ -103,8 +106,8 @@ class Response: def __bool__(self) -> bool: ... def __nonzero__(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... - def __enter__(self) -> Response: ... - def __exit__(self, *args: Any) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, *args: object) -> None: ... @property def next(self) -> PreparedRequest | None: ... @property @@ -117,7 +120,7 @@ class Response: def apparent_encoding(self) -> str: ... def iter_content(self, chunk_size: int | None = ..., decode_unicode: bool = ...) -> Iterator[Any]: ... def iter_lines( - self, chunk_size: int | None = ..., decode_unicode: bool = ..., delimiter: Text | bytes | None = ... + self, chunk_size: int | None = ..., decode_unicode: bool = ..., delimiter: str | bytes | None = ... ) -> Iterator[Any]: ... @property def content(self) -> bytes: ... @@ -126,7 +129,7 @@ class Response: def json( self, *, - cls: Type[JSONDecoder] | None = ..., + cls: type[JSONDecoder] | None = ..., object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., diff --git a/stubs/requests/requests/packages.pyi b/stubs/requests/requests/packages.pyi new file mode 100644 index 0000000..22281ce --- /dev/null +++ b/stubs/requests/requests/packages.pyi @@ -0,0 +1,3 @@ +# requests also imports urllib3, idna, and chardet below +# requests.packages. The stubs don't reflect that and it's recommended to +# import these packages directly if needed. diff --git a/stubs/requests/requests/packages/__init__.pyi b/stubs/requests/requests/packages/__init__.pyi deleted file mode 100644 index b50dba3..0000000 --- a/stubs/requests/requests/packages/__init__.pyi +++ /dev/null @@ -1,4 +0,0 @@ -class VendorAlias: - def __init__(self, package_names) -> None: ... - def find_module(self, fullname, path=...): ... - def load_module(self, name): ... diff --git a/stubs/requests/requests/packages/urllib3/__init__.pyi b/stubs/requests/requests/packages/urllib3/__init__.pyi deleted file mode 100644 index f63b8fa..0000000 --- a/stubs/requests/requests/packages/urllib3/__init__.pyi +++ /dev/null @@ -1,26 +0,0 @@ -import logging -from typing import Any - -from . import connectionpool, filepost, poolmanager, response -from .util import request as _request, retry, timeout, url - -__license__: Any - -HTTPConnectionPool = connectionpool.HTTPConnectionPool -HTTPSConnectionPool = connectionpool.HTTPSConnectionPool -connection_from_url = connectionpool.connection_from_url -encode_multipart_formdata = filepost.encode_multipart_formdata -PoolManager = poolmanager.PoolManager -ProxyManager = poolmanager.ProxyManager -proxy_from_url = poolmanager.proxy_from_url -HTTPResponse = response.HTTPResponse -make_headers = _request.make_headers -get_host = url.get_host -Timeout = timeout.Timeout -Retry = retry.Retry - -class NullHandler(logging.Handler): - def emit(self, record): ... - -def add_stderr_logger(level=...): ... -def disable_warnings(category=...): ... diff --git a/stubs/requests/requests/packages/urllib3/_collections.pyi b/stubs/requests/requests/packages/urllib3/_collections.pyi deleted file mode 100644 index 15aca7b..0000000 --- a/stubs/requests/requests/packages/urllib3/_collections.pyi +++ /dev/null @@ -1,51 +0,0 @@ -from typing import Any, MutableMapping, NoReturn, TypeVar - -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") - -class RLock: - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, traceback): ... - -class RecentlyUsedContainer(MutableMapping[_KT, _VT]): - ContainerCls: Any - dispose_func: Any - lock: Any - def __init__(self, maxsize=..., dispose_func=...) -> None: ... - def __getitem__(self, key): ... - def __setitem__(self, key, value): ... - def __delitem__(self, key): ... - def __len__(self): ... - def __iter__(self): ... - def clear(self): ... - def keys(self): ... - -class HTTPHeaderDict(MutableMapping[str, str]): - def __init__(self, headers=..., **kwargs) -> None: ... - def __setitem__(self, key, val): ... - def __getitem__(self, key): ... - def __delitem__(self, key): ... - def __contains__(self, key): ... - def __eq__(self, other): ... - def __iter__(self) -> NoReturn: ... - def __len__(self) -> int: ... - def __ne__(self, other): ... - values: Any - get: Any - update: Any - iterkeys: Any - itervalues: Any - def pop(self, key, default=...): ... - def discard(self, key): ... - def add(self, key, val): ... - def extend(self, *args, **kwargs): ... - def getlist(self, key): ... - getheaders: Any - getallmatchingheaders: Any - iget: Any - def copy(self): ... - def iteritems(self): ... - def itermerged(self): ... - def items(self): ... - @classmethod - def from_httplib(cls, message, duplicates=...): ... diff --git a/stubs/requests/requests/packages/urllib3/connection.pyi b/stubs/requests/requests/packages/urllib3/connection.pyi deleted file mode 100644 index 39d0f6a..0000000 --- a/stubs/requests/requests/packages/urllib3/connection.pyi +++ /dev/null @@ -1,64 +0,0 @@ -import ssl -import sys -from typing import Any - -from . import exceptions, util -from .packages import ssl_match_hostname -from .util import ssl_ - -if sys.version_info >= (3, 0): - from builtins import ConnectionError as ConnectionError - from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException -else: - from httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException - class ConnectionError(Exception): ... - -class DummyConnection: ... - -BaseSSLError = ssl.SSLError - -ConnectTimeoutError = exceptions.ConnectTimeoutError -SystemTimeWarning = exceptions.SystemTimeWarning -SecurityWarning = exceptions.SecurityWarning -match_hostname = ssl_match_hostname.match_hostname -resolve_cert_reqs = ssl_.resolve_cert_reqs -resolve_ssl_version = ssl_.resolve_ssl_version -ssl_wrap_socket = ssl_.ssl_wrap_socket -assert_fingerprint = ssl_.assert_fingerprint -connection = util.connection - -port_by_scheme: Any -RECENT_DATE: Any - -class HTTPConnection(_HTTPConnection): - default_port: Any - default_socket_options: Any - is_verified: Any - source_address: Any - socket_options: Any - def __init__(self, *args, **kw) -> None: ... - def connect(self): ... - -class HTTPSConnection(HTTPConnection): - default_port: Any - key_file: Any - cert_file: Any - def __init__(self, host, port=..., key_file=..., cert_file=..., strict=..., timeout=..., **kw) -> None: ... - sock: Any - def connect(self): ... - -class VerifiedHTTPSConnection(HTTPSConnection): - cert_reqs: Any - ca_certs: Any - ssl_version: Any - assert_fingerprint: Any - key_file: Any - cert_file: Any - assert_hostname: Any - def set_cert(self, key_file=..., cert_file=..., cert_reqs=..., ca_certs=..., assert_hostname=..., assert_fingerprint=...): ... - sock: Any - auto_open: Any - is_verified: Any - def connect(self): ... - -UnverifiedHTTPSConnection = HTTPSConnection diff --git a/stubs/requests/requests/packages/urllib3/connectionpool.pyi b/stubs/requests/requests/packages/urllib3/connectionpool.pyi deleted file mode 100644 index 9083248..0000000 --- a/stubs/requests/requests/packages/urllib3/connectionpool.pyi +++ /dev/null @@ -1,121 +0,0 @@ -from typing import Any - -from . import connection, exceptions, request, response -from .connection import BaseSSLError as BaseSSLError, ConnectionError as ConnectionError, HTTPException as HTTPException -from .packages import ssl_match_hostname -from .util import connection as _connection, retry, timeout, url - -ClosedPoolError = exceptions.ClosedPoolError -ProtocolError = exceptions.ProtocolError -EmptyPoolError = exceptions.EmptyPoolError -HostChangedError = exceptions.HostChangedError -LocationValueError = exceptions.LocationValueError -MaxRetryError = exceptions.MaxRetryError -ProxyError = exceptions.ProxyError -ReadTimeoutError = exceptions.ReadTimeoutError -SSLError = exceptions.SSLError -TimeoutError = exceptions.TimeoutError -InsecureRequestWarning = exceptions.InsecureRequestWarning -CertificateError = ssl_match_hostname.CertificateError -port_by_scheme = connection.port_by_scheme -DummyConnection = connection.DummyConnection -HTTPConnection = connection.HTTPConnection -HTTPSConnection = connection.HTTPSConnection -VerifiedHTTPSConnection = connection.VerifiedHTTPSConnection -RequestMethods = request.RequestMethods -HTTPResponse = response.HTTPResponse -is_connection_dropped = _connection.is_connection_dropped -Retry = retry.Retry -Timeout = timeout.Timeout -get_host = url.get_host - -xrange: Any -log: Any - -class ConnectionPool: - scheme: Any - QueueCls: Any - host: Any - port: Any - def __init__(self, host, port=...) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_val, exc_tb): ... - def close(self): ... - -class HTTPConnectionPool(ConnectionPool, RequestMethods): - scheme: Any - ConnectionCls: Any - strict: Any - timeout: Any - retries: Any - pool: Any - block: Any - proxy: Any - proxy_headers: Any - num_connections: Any - num_requests: Any - conn_kw: Any - def __init__( - self, - host, - port=..., - strict=..., - timeout=..., - maxsize=..., - block=..., - headers=..., - retries=..., - _proxy=..., - _proxy_headers=..., - **conn_kw, - ) -> None: ... - def close(self): ... - def is_same_host(self, url): ... - def urlopen( - self, - method, - url, - body=..., - headers=..., - retries=..., - redirect=..., - assert_same_host=..., - timeout=..., - pool_timeout=..., - release_conn=..., - **response_kw, - ): ... - -class HTTPSConnectionPool(HTTPConnectionPool): - scheme: Any - ConnectionCls: Any - key_file: Any - cert_file: Any - cert_reqs: Any - ca_certs: Any - ssl_version: Any - assert_hostname: Any - assert_fingerprint: Any - def __init__( - self, - host, - port=..., - strict=..., - timeout=..., - maxsize=..., - block=..., - headers=..., - retries=..., - _proxy=..., - _proxy_headers=..., - key_file=..., - cert_file=..., - cert_reqs=..., - ca_certs=..., - ssl_version=..., - assert_hostname=..., - assert_fingerprint=..., - **conn_kw, - ) -> None: ... - -def connection_from_url(url, **kw): ... diff --git a/stubs/requests/requests/packages/urllib3/exceptions.pyi b/stubs/requests/requests/packages/urllib3/exceptions.pyi deleted file mode 100644 index ddb4e83..0000000 --- a/stubs/requests/requests/packages/urllib3/exceptions.pyi +++ /dev/null @@ -1,50 +0,0 @@ -from typing import Any - -class HTTPError(Exception): ... -class HTTPWarning(Warning): ... - -class PoolError(HTTPError): - pool: Any - def __init__(self, pool, message) -> None: ... - def __reduce__(self): ... - -class RequestError(PoolError): - url: Any - def __init__(self, pool, url, message) -> None: ... - def __reduce__(self): ... - -class SSLError(HTTPError): ... -class ProxyError(HTTPError): ... -class DecodeError(HTTPError): ... -class ProtocolError(HTTPError): ... - -ConnectionError: Any - -class MaxRetryError(RequestError): - reason: Any - def __init__(self, pool, url, reason=...) -> None: ... - -class HostChangedError(RequestError): - retries: Any - def __init__(self, pool, url, retries=...) -> None: ... - -class TimeoutStateError(HTTPError): ... -class TimeoutError(HTTPError): ... -class ReadTimeoutError(TimeoutError, RequestError): ... -class ConnectTimeoutError(TimeoutError): ... -class EmptyPoolError(PoolError): ... -class ClosedPoolError(PoolError): ... -class LocationValueError(ValueError, HTTPError): ... - -class LocationParseError(LocationValueError): - location: Any - def __init__(self, location) -> None: ... - -class ResponseError(HTTPError): - GENERIC_ERROR: Any - SPECIFIC_ERROR: Any - -class SecurityWarning(HTTPWarning): ... -class InsecureRequestWarning(SecurityWarning): ... -class SystemTimeWarning(SecurityWarning): ... -class InsecurePlatformWarning(SecurityWarning): ... diff --git a/stubs/requests/requests/packages/urllib3/fields.pyi b/stubs/requests/requests/packages/urllib3/fields.pyi deleted file mode 100644 index df18769..0000000 --- a/stubs/requests/requests/packages/urllib3/fields.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Any - -def guess_content_type(filename, default=...): ... -def format_header_param(name, value): ... - -class RequestField: - data: Any - headers: Any - def __init__(self, name, data, filename=..., headers=...) -> None: ... - @classmethod - def from_tuples(cls, fieldname, value): ... - def render_headers(self): ... - def make_multipart(self, content_disposition=..., content_type=..., content_location=...): ... diff --git a/stubs/requests/requests/packages/urllib3/response.pyi b/stubs/requests/requests/packages/urllib3/response.pyi deleted file mode 100644 index 1c78b48..0000000 --- a/stubs/requests/requests/packages/urllib3/response.pyi +++ /dev/null @@ -1,66 +0,0 @@ -import io -from typing import Any - -from . import _collections, exceptions -from .connection import BaseSSLError as BaseSSLError, HTTPException as HTTPException -from .util import response - -HTTPHeaderDict = _collections.HTTPHeaderDict -ProtocolError = exceptions.ProtocolError -DecodeError = exceptions.DecodeError -ReadTimeoutError = exceptions.ReadTimeoutError -binary_type = bytes # six.binary_type -PY3 = True # six.PY3 -is_fp_closed = response.is_fp_closed - -class DeflateDecoder: - def __init__(self) -> None: ... - def __getattr__(self, name): ... - def decompress(self, data): ... - -class GzipDecoder: - def __init__(self) -> None: ... - def __getattr__(self, name): ... - def decompress(self, data): ... - -class HTTPResponse(io.IOBase): - CONTENT_DECODERS: Any - REDIRECT_STATUSES: Any - headers: Any - status: Any - version: Any - reason: Any - strict: Any - decode_content: Any - def __init__( - self, - body=..., - headers=..., - status=..., - version=..., - reason=..., - strict=..., - preload_content=..., - decode_content=..., - original_response=..., - pool=..., - connection=..., - ) -> None: ... - def get_redirect_location(self): ... - def release_conn(self): ... - @property - def data(self): ... - def tell(self): ... - def read(self, amt=..., decode_content=..., cache_content=...): ... - def stream(self, amt=..., decode_content=...): ... - @classmethod - def from_httplib(cls, r, **response_kw): ... - def getheaders(self): ... - def getheader(self, name, default=...): ... - def close(self): ... - @property - def closed(self): ... - def fileno(self): ... - def flush(self): ... - def readable(self): ... - def readinto(self, b): ... diff --git a/stubs/requests/requests/packages/urllib3/util/retry.pyi b/stubs/requests/requests/packages/urllib3/util/retry.pyi deleted file mode 100644 index c4aedaa..0000000 --- a/stubs/requests/requests/packages/urllib3/util/retry.pyi +++ /dev/null @@ -1,49 +0,0 @@ -from typing import Any - -from .. import exceptions - -ConnectTimeoutError = exceptions.ConnectTimeoutError -MaxRetryError = exceptions.MaxRetryError -ProtocolError = exceptions.ProtocolError -ReadTimeoutError = exceptions.ReadTimeoutError -ResponseError = exceptions.ResponseError - -log: Any - -class Retry: - DEFAULT_METHOD_WHITELIST: Any - BACKOFF_MAX: Any - total: Any - connect: Any - read: Any - redirect: Any - status_forcelist: Any - method_whitelist: Any - backoff_factor: Any - raise_on_redirect: Any - def __init__( - self, - total=..., - connect=..., - read=..., - redirect=..., - status=..., - other=..., - allowed_methods=..., - status_forcelist=..., - backoff_factor=..., - raise_on_redirect=..., - raise_on_status=..., - history=..., - respect_retry_after_header=..., - remove_headers_on_redirect=..., - method_whitelist=..., - ) -> None: ... - def new(self, **kw): ... - @classmethod - def from_int(cls, retries, redirect=..., default=...): ... - def get_backoff_time(self): ... - def sleep(self): ... - def is_forced_retry(self, method, status_code): ... - def is_exhausted(self): ... - def increment(self, method=..., url=..., response=..., error=..., _pool=..., _stacktrace=...): ... diff --git a/stubs/requests/requests/packages/urllib3/util/url.pyi b/stubs/requests/requests/packages/urllib3/util/url.pyi deleted file mode 100644 index 2d43e2d..0000000 --- a/stubs/requests/requests/packages/urllib3/util/url.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from typing import Any - -from .. import exceptions - -LocationParseError = exceptions.LocationParseError - -url_attrs: Any - -class Url: - slots: Any - def __new__(cls, scheme=..., auth=..., host=..., port=..., path=..., query=..., fragment=...): ... - @property - def hostname(self): ... - @property - def request_uri(self): ... - @property - def netloc(self): ... - @property - def url(self): ... - -def split_first(s, delims): ... -def parse_url(url): ... -def get_host(url): ... diff --git a/stubs/requests/requests/sessions.pyi b/stubs/requests/requests/sessions.pyi index f5abcba..4da184c 100644 --- a/stubs/requests/requests/sessions.pyi +++ b/stubs/requests/requests/sessions.pyi @@ -1,11 +1,15 @@ -from _typeshed import SupportsItems -from typing import IO, Any, Callable, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, TypeVar, Union +from _typeshed import Incomplete, Self, SupportsItems, SupportsRead +from collections.abc import Callable, Iterable, Mapping, MutableMapping +from typing import Any, Union +from typing_extensions import TypeAlias, TypedDict -from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils +from urllib3._collections import RecentlyUsedContainer + +from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, utils from .models import Response -from .packages.urllib3 import _collections +from .structures import CaseInsensitiveDict as CaseInsensitiveDict -BaseAdapter = adapters.BaseAdapter +_BaseAdapter: TypeAlias = adapters.BaseAdapter OrderedDict = compat.OrderedDict cookiejar_from_dict = cookies.cookiejar_from_dict extract_cookies_to_jar = cookies.extract_cookies_to_jar @@ -23,8 +27,6 @@ TooManyRedirects = exceptions.TooManyRedirects InvalidSchema = exceptions.InvalidSchema ChunkedEncodingError = exceptions.ChunkedEncodingError ContentDecodingError = exceptions.ContentDecodingError -RecentlyUsedContainer = _collections.RecentlyUsedContainer -CaseInsensitiveDict = structures.CaseInsensitiveDict HTTPAdapter = adapters.HTTPAdapter requote_uri = utils.requote_uri get_environ_proxies = utils.get_environ_proxies @@ -38,200 +40,273 @@ def merge_setting(request_setting, session_setting, dict_class=...): ... def merge_hooks(request_hooks, session_hooks, dict_class=...): ... class SessionRedirectMixin: - def resolve_redirects(self, resp, req, stream=..., timeout=..., verify=..., cert=..., proxies=...): ... + def resolve_redirects( + self, + resp, + req, + stream: bool = ..., + timeout: Incomplete | None = ..., + verify: bool = ..., + cert: Incomplete | None = ..., + proxies: Incomplete | None = ..., + yield_requests: bool = ..., + **adapter_kwargs, + ): ... def rebuild_auth(self, prepared_request, response): ... def rebuild_proxies(self, prepared_request, proxies): ... def should_strip_auth(self, old_url, new_url): ... + def rebuild_method(self, prepared_request: PreparedRequest, response: Response) -> None: ... + def get_redirect_target(self, resp: Response) -> str | None: ... -_Data = Union[None, Text, bytes, Mapping[str, Any], Mapping[Text, Any], Iterable[Tuple[Text, Optional[Text]]], IO[Any]] - -_Hook = Callable[[Response], Any] -_Hooks = MutableMapping[Text, List[_Hook]] -_HooksInput = MutableMapping[Text, Union[Iterable[_Hook], _Hook]] +_Data: TypeAlias = ( + # used in requests.models.PreparedRequest.prepare_body + # + # case: is_stream + # see requests.adapters.HTTPAdapter.send + # will be sent directly to http.HTTPConnection.send(...) (through urllib3) + Iterable[bytes] + # case: not is_stream + # will be modified before being sent to urllib3.HTTPConnectionPool.urlopen(body=...) + # see requests.models.RequestEncodingMixin._encode_params + # see requests.models.RequestEncodingMixin._encode_files + # note that keys&values are converted from Any to str by urllib.parse.urlencode + | str + | bytes + | SupportsRead[str | bytes] + | list[tuple[Any, Any]] + | tuple[tuple[Any, Any], ...] + | Mapping[Any, Any] +) +_Auth: TypeAlias = Union[tuple[str, str], _auth.AuthBase, Callable[[PreparedRequest], PreparedRequest]] +_Cert: TypeAlias = Union[str, tuple[str, str]] +# Files is passed to requests.utils.to_key_val_list() +_FileName: TypeAlias = str | None +_FileContent: TypeAlias = SupportsRead[str | bytes] | str | bytes +_FileContentType: TypeAlias = str +_FileCustomHeaders: TypeAlias = Mapping[str, str] +_FileSpecTuple2: TypeAlias = tuple[_FileName, _FileContent] +_FileSpecTuple3: TypeAlias = tuple[_FileName, _FileContent, _FileContentType] +_FileSpecTuple4: TypeAlias = tuple[_FileName, _FileContent, _FileContentType, _FileCustomHeaders] +_FileSpec: TypeAlias = _FileContent | _FileSpecTuple2 | _FileSpecTuple3 | _FileSpecTuple4 +_Files: TypeAlias = Mapping[str, _FileSpec] | Iterable[tuple[str, _FileSpec]] +_Hook: TypeAlias = Callable[[Response], Any] +_HooksInput: TypeAlias = Mapping[str, Iterable[_Hook] | _Hook] -_ParamsMappingKeyType = Union[Text, bytes, int, float] -_ParamsMappingValueType = Union[Text, bytes, int, float, Iterable[Union[Text, bytes, int, float]], None] -_Params = Union[ +_ParamsMappingKeyType: TypeAlias = str | bytes | int | float +_ParamsMappingValueType: TypeAlias = str | bytes | int | float | Iterable[str | bytes | int | float] | None +_Params: TypeAlias = Union[ SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType], - Tuple[_ParamsMappingKeyType, _ParamsMappingValueType], - Iterable[Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]], - Union[Text, bytes], + tuple[_ParamsMappingKeyType, _ParamsMappingValueType], + Iterable[tuple[_ParamsMappingKeyType, _ParamsMappingValueType]], + str | bytes, ] -_TextMapping = MutableMapping[Text, Text] -_SessionT = TypeVar("_SessionT", bound=Session) +_TextMapping: TypeAlias = MutableMapping[str, str] +_HeadersUpdateMapping: TypeAlias = Mapping[str, str | bytes | None] +_Timeout: TypeAlias = Union[float, tuple[float, float], tuple[float, None]] +_Verify: TypeAlias = bool | str + +class _Settings(TypedDict): + verify: _Verify | None + proxies: _TextMapping + stream: bool + cert: _Cert | None class Session(SessionRedirectMixin): __attrs__: Any - headers: CaseInsensitiveDict[Text] - auth: None | Tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest] + headers: CaseInsensitiveDict[str | bytes] + auth: _Auth | None proxies: _TextMapping - hooks: _Hooks + # Don't complain if: + # - value is assumed to be a list (which it is by default) + # - a _Hook is assigned directly, without wrapping it in a list (also works) + hooks: dict[str, list[_Hook] | Any] params: _Params stream: bool - verify: None | bool | Text - cert: None | Text | Tuple[Text, Text] + verify: _Verify | None + cert: _Cert | None max_redirects: int trust_env: bool cookies: RequestsCookieJar adapters: MutableMapping[Any, Any] redirect_cache: RecentlyUsedContainer[Any, Any] def __init__(self) -> None: ... - def __enter__(self: _SessionT) -> _SessionT: ... + def __enter__(self: Self) -> Self: ... def __exit__(self, *args) -> None: ... def prepare_request(self, request: Request) -> PreparedRequest: ... def request( self, - method: str, - url: str | bytes | Text, + method: str | bytes, + url: str | bytes, params: _Params | None = ..., - data: _Data = ..., - headers: _TextMapping | None = ..., + data: _Data | None = ..., + headers: _HeadersUpdateMapping | None = ..., cookies: None | RequestsCookieJar | _TextMapping = ..., - files: MutableMapping[Text, IO[Any]] - | MutableMapping[Text, Tuple[Text, IO[Any]]] - | MutableMapping[Text, Tuple[Text, IO[Any], Text]] - | MutableMapping[Text, Tuple[Text, IO[Any], Text, _TextMapping]] - | None = ..., - auth: None | Tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest] = ..., - timeout: None | float | Tuple[float, float] | Tuple[float, None] = ..., - allow_redirects: bool | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., + allow_redirects: bool = ..., proxies: _TextMapping | None = ..., hooks: _HooksInput | None = ..., stream: bool | None = ..., - verify: None | bool | Text = ..., - cert: Text | Tuple[Text, Text] | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def get( self, - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def options( self, - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def head( self, - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def post( self, - url: Text | bytes, - data: _Data = ..., + url: str | bytes, + data: _Data | None = ..., json: Any | None = ..., + *, params: _Params | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., ) -> Response: ... def put( self, - url: Text | bytes, - data: _Data = ..., + url: str | bytes, + data: _Data | None = ..., + *, params: _Params | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def patch( self, - url: Text | bytes, - data: _Data = ..., + url: str | bytes, + data: _Data | None = ..., + *, params: _Params | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... def delete( self, - url: Text | bytes, + url: str | bytes, + *, params: _Params | None = ..., - data: Any | None = ..., - headers: Any | None = ..., - cookies: Any | None = ..., - files: Any | None = ..., - auth: Any | None = ..., - timeout: Any | None = ..., + data: _Data | None = ..., + headers: _HeadersUpdateMapping | None = ..., + cookies: RequestsCookieJar | _TextMapping | None = ..., + files: _Files | None = ..., + auth: _Auth | None = ..., + timeout: _Timeout | None = ..., allow_redirects: bool = ..., - proxies: Any | None = ..., - hooks: Any | None = ..., - stream: Any | None = ..., - verify: Any | None = ..., - cert: Any | None = ..., + proxies: _TextMapping | None = ..., + hooks: _HooksInput | None = ..., + stream: bool | None = ..., + verify: _Verify | None = ..., + cert: _Cert | None = ..., json: Any | None = ..., ) -> Response: ... - def send(self, request: PreparedRequest, **kwargs) -> Response: ... - def merge_environment_settings(self, url, proxies, stream, verify, cert): ... - def get_adapter(self, url: str) -> BaseAdapter: ... + def send( + self, + request: PreparedRequest, + *, + stream: bool | None = ..., + verify: _Verify | None = ..., + proxies: _TextMapping | None = ..., + cert: _Cert | None = ..., + timeout: _Timeout | None = ..., + allow_redirects: bool = ..., + **kwargs: Any, + ) -> Response: ... + def merge_environment_settings( + self, + url: str | bytes | None, + proxies: _TextMapping | None, + stream: bool | None, + verify: _Verify | None, + cert: _Cert | None, + ) -> _Settings: ... + def get_adapter(self, url: str) -> _BaseAdapter: ... def close(self) -> None: ... - def mount(self, prefix: Text | bytes, adapter: BaseAdapter) -> None: ... + def mount(self, prefix: str | bytes, adapter: _BaseAdapter) -> None: ... def session() -> Session: ... diff --git a/stubs/requests/requests/structures.pyi b/stubs/requests/requests/structures.pyi index c8fcfe5..14ef93c 100644 --- a/stubs/requests/requests/structures.pyi +++ b/stubs/requests/requests/structures.pyi @@ -1,10 +1,12 @@ -from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, Tuple, TypeVar +from collections.abc import Iterable, Iterator, Mapping, MutableMapping +from typing import Any, Generic, TypeVar, overload +_D = TypeVar("_D") _VT = TypeVar("_VT") class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): - def __init__(self, data: Mapping[str, _VT] | Iterable[Tuple[str, _VT]] | None = ..., **kwargs: _VT) -> None: ... - def lower_items(self) -> Iterator[Tuple[str, _VT]]: ... + def __init__(self, data: Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None = ..., **kwargs: _VT) -> None: ... + def lower_items(self) -> Iterator[tuple[str, _VT]]: ... def __setitem__(self, key: str, value: _VT) -> None: ... def __getitem__(self, key: str) -> _VT: ... def __delitem__(self, key: str) -> None: ... @@ -12,9 +14,12 @@ class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): def __len__(self) -> int: ... def copy(self) -> CaseInsensitiveDict[_VT]: ... -class LookupDict(Dict[str, _VT]): +class LookupDict(dict[str, _VT]): name: Any def __init__(self, name: Any = ...) -> None: ... - def __getitem__(self, key: str) -> _VT | None: ... # type: ignore - def __getattr__(self, attr: str) -> _VT: ... - def __setattr__(self, attr: str, value: _VT) -> None: ... + def __getitem__(self, key: str) -> _VT | None: ... # type: ignore[override] + def __setattr__(self, __attr: str, __value: _VT) -> None: ... + @overload + def get(self, key: str, default: None = ...) -> _VT | None: ... + @overload + def get(self, key: str, default: _D | _VT) -> _D | _VT: ... diff --git a/stubs/requests/requests/utils.pyi b/stubs/requests/requests/utils.pyi index 0ac3a16..34cd796 100644 --- a/stubs/requests/requests/utils.pyi +++ b/stubs/requests/requests/utils.pyi @@ -1,54 +1,68 @@ -from typing import Any, AnyStr, Iterable, Mapping, Text, Tuple +import sys +from _typeshed import StrOrBytesPath +from collections.abc import Generator, Iterable, Mapping +from contextlib import _GeneratorContextManager +from io import BufferedWriter +from typing import Any, AnyStr +from typing_extensions import TypeAlias from . import compat, cookies, exceptions, structures +from .models import PreparedRequest, Request +_Uri: TypeAlias = str | bytes OrderedDict = compat.OrderedDict -RequestsCookieJar = cookies.RequestsCookieJar cookiejar_from_dict = cookies.cookiejar_from_dict CaseInsensitiveDict = structures.CaseInsensitiveDict InvalidURL = exceptions.InvalidURL -NETRC_FILES: Any +NETRC_FILES: tuple[str, str] DEFAULT_CA_BUNDLE_PATH: Any -DEFAULT_PORTS: Any +DEFAULT_PORTS: dict[str, int] +DEFAULT_ACCEPT_ENCODING: str def dict_to_sequence(d): ... def super_len(o): ... -def get_netrc_auth(url, raise_errors: bool = ...): ... +def get_netrc_auth(url: _Uri, raise_errors: bool = ...) -> tuple[str, str] | None: ... def guess_filename(obj): ... def extract_zipped_paths(path): ... +def atomic_open(filename: StrOrBytesPath) -> _GeneratorContextManager[BufferedWriter]: ... def from_key_val_list(value): ... def to_key_val_list(value): ... def parse_list_header(value): ... def parse_dict_header(value): ... -def unquote_header_value(value, is_filename=...): ... +def unquote_header_value(value, is_filename: bool = ...): ... def dict_from_cookiejar(cj): ... def add_dict_to_cookiejar(cj, cookie_dict): ... def get_encodings_from_content(content): ... def get_encoding_from_headers(headers): ... def stream_decode_response_unicode(iterator, r): ... -def iter_slices(string, slice_length): ... +def iter_slices(string: str, slice_length: int | None) -> Generator[str, None, None]: ... def get_unicode_from_response(r): ... -UNRESERVED_SET: Any +UNRESERVED_SET: frozenset[str] -def unquote_unreserved(uri): ... -def requote_uri(uri): ... -def address_in_network(ip, net): ... -def dotted_netmask(mask): ... -def is_ipv4_address(string_ip): ... -def is_valid_cidr(string_network): ... -def set_environ(env_name, value): ... -def should_bypass_proxies(url, no_proxy: Iterable[AnyStr] | None) -> bool: ... -def get_environ_proxies(url, no_proxy: Iterable[AnyStr] | None = ...) -> dict[Any, Any]: ... -def select_proxy(url: Text, proxies: Mapping[Any, Any] | None): ... -def default_user_agent(name=...): ... -def default_headers(): ... -def parse_header_links(value): ... +def unquote_unreserved(uri: str) -> str: ... +def requote_uri(uri: str) -> str: ... +def address_in_network(ip: str, net: str) -> bool: ... +def dotted_netmask(mask: int) -> str: ... +def is_ipv4_address(string_ip: str) -> bool: ... +def is_valid_cidr(string_network: str) -> bool: ... +def set_environ(env_name: str, value: None) -> _GeneratorContextManager[None]: ... +def should_bypass_proxies(url: _Uri, no_proxy: Iterable[str] | None) -> bool: ... +def get_environ_proxies(url: _Uri, no_proxy: Iterable[str] | None = ...) -> dict[Any, Any]: ... +def select_proxy(url: _Uri, proxies: Mapping[Any, Any] | None): ... +def resolve_proxies(request: Request | PreparedRequest, proxies: Mapping[str, str] | None, trust_env: bool = ...): ... +def default_user_agent(name: str = ...) -> str: ... +def default_headers() -> CaseInsensitiveDict[str]: ... +def parse_header_links(value: str) -> list[dict[str, str]]: ... def guess_json_utf(data): ... def prepend_scheme_if_needed(url, new_scheme): ... -def get_auth_from_url(url): ... +def get_auth_from_url(url: _Uri) -> tuple[str, str]: ... def to_native_string(string, encoding=...): ... -def urldefragauth(url): ... -def rewind_body(prepared_request): ... -def check_header_validity(header: Tuple[AnyStr, AnyStr]) -> None: ... +def urldefragauth(url: _Uri): ... +def rewind_body(prepared_request: PreparedRequest) -> None: ... +def check_header_validity(header: tuple[AnyStr, AnyStr]) -> None: ... + +if sys.platform == "win32": + def proxy_bypass_registry(host: str) -> bool: ... + def proxy_bypass(host: str) -> bool: ... diff --git a/stubs/retry/@tests/stubtest_allowlist.txt b/stubs/retry/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..0e4e3d2 --- /dev/null +++ b/stubs/retry/@tests/stubtest_allowlist.txt @@ -0,0 +1,3 @@ +retry.compat +retry.tests +retry.tests.test_retry diff --git a/stubs/retry/METADATA.toml b/stubs/retry/METADATA.toml index ca732ba..1548770 100644 --- a/stubs/retry/METADATA.toml +++ b/stubs/retry/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.9" -python2 = true +version = "0.9.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/retry/retry/api.pyi b/stubs/retry/retry/api.pyi index dd7f376..32f16dd 100644 --- a/stubs/retry/retry/api.pyi +++ b/stubs/retry/retry/api.pyi @@ -1,6 +1,7 @@ from _typeshed import IdentityFunction +from collections.abc import Callable, Sequence from logging import Logger -from typing import Any, Callable, Sequence, Tuple, Type, TypeVar +from typing import Any, TypeVar _R = TypeVar("_R") @@ -8,20 +9,20 @@ def retry_call( f: Callable[..., _R], fargs: Sequence[Any] | None = ..., fkwargs: dict[str, Any] | None = ..., - exceptions: Type[Exception] | Tuple[Type[Exception], ...] = ..., + exceptions: type[Exception] | tuple[type[Exception], ...] = ..., tries: int = ..., delay: float = ..., max_delay: float | None = ..., backoff: float = ..., - jitter: Tuple[float, float] | float = ..., + jitter: tuple[float, float] | float = ..., logger: Logger | None = ..., ) -> _R: ... def retry( - exceptions: Type[Exception] | Tuple[Type[Exception], ...] = ..., + exceptions: type[Exception] | tuple[type[Exception], ...] = ..., tries: int = ..., delay: float = ..., max_delay: float | None = ..., backoff: float = ..., - jitter: Tuple[float, float] | float = ..., + jitter: tuple[float, float] | float = ..., logger: Logger | None = ..., ) -> IdentityFunction: ... diff --git a/stubs/selenium/METADATA.toml b/stubs/selenium/METADATA.toml deleted file mode 100644 index 115c7fe..0000000 --- a/stubs/selenium/METADATA.toml +++ /dev/null @@ -1 +0,0 @@ -version = "3.141" diff --git a/stubs/selenium/selenium/common/__init__.pyi b/stubs/selenium/selenium/common/__init__.pyi deleted file mode 100644 index baafbaf..0000000 --- a/stubs/selenium/selenium/common/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -from . import exceptions as exceptions diff --git a/stubs/selenium/selenium/common/exceptions.pyi b/stubs/selenium/selenium/common/exceptions.pyi deleted file mode 100644 index f3f9f6d..0000000 --- a/stubs/selenium/selenium/common/exceptions.pyi +++ /dev/null @@ -1,49 +0,0 @@ -from typing import Any - -class WebDriverException(Exception): - msg: Any - screen: Any - stacktrace: Any - def __init__(self, msg: Any | None = ..., screen: Any | None = ..., stacktrace: Any | None = ...) -> None: ... - -class ErrorInResponseException(WebDriverException): - response: Any - def __init__(self, response, msg) -> None: ... - -class InvalidSwitchToTargetException(WebDriverException): ... -class NoSuchFrameException(InvalidSwitchToTargetException): ... -class NoSuchWindowException(InvalidSwitchToTargetException): ... -class NoSuchElementException(WebDriverException): ... -class NoSuchAttributeException(WebDriverException): ... -class StaleElementReferenceException(WebDriverException): ... -class InvalidElementStateException(WebDriverException): ... - -class UnexpectedAlertPresentException(WebDriverException): - alert_text: Any - def __init__( - self, msg: Any | None = ..., screen: Any | None = ..., stacktrace: Any | None = ..., alert_text: Any | None = ... - ) -> None: ... - -class NoAlertPresentException(WebDriverException): ... -class ElementNotVisibleException(InvalidElementStateException): ... -class ElementNotInteractableException(InvalidElementStateException): ... -class ElementNotSelectableException(InvalidElementStateException): ... -class InvalidCookieDomainException(WebDriverException): ... -class UnableToSetCookieException(WebDriverException): ... -class RemoteDriverServerException(WebDriverException): ... -class TimeoutException(WebDriverException): ... -class MoveTargetOutOfBoundsException(WebDriverException): ... -class UnexpectedTagNameException(WebDriverException): ... -class InvalidSelectorException(NoSuchElementException): ... -class ImeNotAvailableException(WebDriverException): ... -class ImeActivationFailedException(WebDriverException): ... -class InvalidArgumentException(WebDriverException): ... -class JavascriptException(WebDriverException): ... -class NoSuchCookieException(WebDriverException): ... -class ScreenshotException(WebDriverException): ... -class ElementClickInterceptedException(WebDriverException): ... -class InsecureCertificateException(WebDriverException): ... -class InvalidCoordinatesException(WebDriverException): ... -class InvalidSessionIdException(WebDriverException): ... -class SessionNotCreatedException(WebDriverException): ... -class UnknownMethodException(WebDriverException): ... diff --git a/stubs/selenium/selenium/webdriver/__init__.pyi b/stubs/selenium/selenium/webdriver/__init__.pyi deleted file mode 100644 index 8f27116..0000000 --- a/stubs/selenium/selenium/webdriver/__init__.pyi +++ /dev/null @@ -1,44 +0,0 @@ -from .android.webdriver import WebDriver as Android -from .blackberry.webdriver import WebDriver as BlackBerry -from .chrome.options import Options as ChromeOptions -from .chrome.webdriver import WebDriver as Chrome -from .common.action_chains import ActionChains as ActionChains -from .common.desired_capabilities import DesiredCapabilities as DesiredCapabilities -from .common.proxy import Proxy as Proxy -from .common.touch_actions import TouchActions as TouchActions -from .edge.webdriver import WebDriver as Edge -from .firefox.firefox_profile import FirefoxProfile as FirefoxProfile -from .firefox.options import Options as FirefoxOptions -from .firefox.webdriver import WebDriver as Firefox -from .ie.options import Options as IeOptions -from .ie.webdriver import WebDriver as Ie -from .opera.webdriver import WebDriver as Opera -from .phantomjs.webdriver import WebDriver as PhantomJS -from .remote.webdriver import WebDriver as Remote -from .safari.webdriver import WebDriver as Safari -from .webkitgtk.options import Options as WebKitGTKOptions -from .webkitgtk.webdriver import WebDriver as WebKitGTK - -# We need an explicit __all__ because some of the above won't otherwise be exported. -__all__ = [ - "Firefox", - "FirefoxProfile", - "FirefoxOptions", - "Chrome", - "ChromeOptions", - "Ie", - "IeOptions", - "Edge", - "Opera", - "Safari", - "BlackBerry", - "PhantomJS", - "Android", - "WebKitGTK", - "WebKitGTKOptions", - "Remote", - "DesiredCapabilities", - "ActionChains", - "TouchActions", - "Proxy", -] diff --git a/stubs/selenium/selenium/webdriver/android/webdriver.pyi b/stubs/selenium/selenium/webdriver/android/webdriver.pyi deleted file mode 100644 index c310c4a..0000000 --- a/stubs/selenium/selenium/webdriver/android/webdriver.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities as DesiredCapabilities -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -class WebDriver(RemoteWebDriver): - def __init__(self, host: str = ..., port: int = ..., desired_capabilities=...) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/blackberry/webdriver.pyi b/stubs/selenium/selenium/webdriver/blackberry/webdriver.pyi deleted file mode 100644 index 8caafb6..0000000 --- a/stubs/selenium/selenium/webdriver/blackberry/webdriver.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -LOAD_TIMEOUT: int - -class WebDriver(RemoteWebDriver): - def __init__( - self, device_password, bb_tools_dir: Any | None = ..., hostip: str = ..., port: int = ..., desired_capabilities=... - ): ... - def quit(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/chrome/options.pyi b/stubs/selenium/selenium/webdriver/chrome/options.pyi deleted file mode 100644 index 83baf8a..0000000 --- a/stubs/selenium/selenium/webdriver/chrome/options.pyi +++ /dev/null @@ -1,30 +0,0 @@ -class Options: - KEY: str - def __init__(self) -> None: ... - @property - def binary_location(self): ... - @binary_location.setter - def binary_location(self, value) -> None: ... - @property - def capabilities(self): ... - def set_capability(self, name, value) -> None: ... - @property - def debugger_address(self): ... - @debugger_address.setter - def debugger_address(self, value) -> None: ... - @property - def arguments(self): ... - def add_argument(self, argument) -> None: ... - @property - def extensions(self): ... - def add_extension(self, extension) -> None: ... - def add_encoded_extension(self, extension) -> None: ... - @property - def experimental_options(self): ... - def add_experimental_option(self, name, value) -> None: ... - @property - def headless(self): ... - @headless.setter - def headless(self, value) -> None: ... - def set_headless(self, headless: bool = ...) -> None: ... - def to_capabilities(self): ... diff --git a/stubs/selenium/selenium/webdriver/chrome/remote_connection.pyi b/stubs/selenium/selenium/webdriver/chrome/remote_connection.pyi deleted file mode 100644 index 0e5870a..0000000 --- a/stubs/selenium/selenium/webdriver/chrome/remote_connection.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from selenium.webdriver.remote.remote_connection import RemoteConnection as RemoteConnection - -class ChromeRemoteConnection(RemoteConnection): - def __init__(self, remote_server_addr, keep_alive: bool = ...) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/chrome/service.pyi b/stubs/selenium/selenium/webdriver/chrome/service.pyi deleted file mode 100644 index d581b79..0000000 --- a/stubs/selenium/selenium/webdriver/chrome/service.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - service_args: Any - def __init__( - self, executable_path, port: int = ..., service_args: Any | None = ..., log_path: Any | None = ..., env: Any | None = ... - ) -> None: ... - def command_line_args(self): ... diff --git a/stubs/selenium/selenium/webdriver/chrome/webdriver.pyi b/stubs/selenium/selenium/webdriver/chrome/webdriver.pyi deleted file mode 100644 index 754ebf5..0000000 --- a/stubs/selenium/selenium/webdriver/chrome/webdriver.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -from .remote_connection import ChromeRemoteConnection as ChromeRemoteConnection - -class WebDriver(RemoteWebDriver): - service: Any - def __init__( - self, - executable_path: str = ..., - port: int = ..., - options: Any | None = ..., - service_args: Any | None = ..., - desired_capabilities: Any | None = ..., - service_log_path: Any | None = ..., - chrome_options: Any | None = ..., - keep_alive: bool = ..., - ) -> None: ... - def launch_app(self, id): ... - def get_network_conditions(self): ... - def set_network_conditions(self, **network_conditions) -> None: ... - def execute_cdp_cmd(self, cmd, cmd_args): ... - def quit(self) -> None: ... - def create_options(self): ... diff --git a/stubs/selenium/selenium/webdriver/common/action_chains.pyi b/stubs/selenium/selenium/webdriver/common/action_chains.pyi deleted file mode 100644 index e1ab3cd..0000000 --- a/stubs/selenium/selenium/webdriver/common/action_chains.pyi +++ /dev/null @@ -1,29 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.command import Command as Command - -from .actions.action_builder import ActionBuilder as ActionBuilder -from .utils import keys_to_typing as keys_to_typing - -class ActionChains: - w3c_actions: Any - def __init__(self, driver) -> None: ... - def perform(self) -> None: ... - def reset_actions(self) -> None: ... - def click(self, on_element: Any | None = ...): ... - def click_and_hold(self, on_element: Any | None = ...): ... - def context_click(self, on_element: Any | None = ...): ... - def double_click(self, on_element: Any | None = ...): ... - def drag_and_drop(self, source, target): ... - def drag_and_drop_by_offset(self, source, xoffset, yoffset): ... - def key_down(self, value, element: Any | None = ...): ... - def key_up(self, value, element: Any | None = ...): ... - def move_by_offset(self, xoffset, yoffset): ... - def move_to_element(self, to_element): ... - def move_to_element_with_offset(self, to_element, xoffset, yoffset): ... - def pause(self, seconds): ... - def release(self, on_element: Any | None = ...): ... - def send_keys(self, *keys_to_send): ... - def send_keys_to_element(self, element, *keys_to_send): ... - def __enter__(self): ... - def __exit__(self, _type, _value, _traceback) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/action_builder.pyi b/stubs/selenium/selenium/webdriver/common/actions/action_builder.pyi deleted file mode 100644 index 40be962..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/action_builder.pyi +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.command import Command as Command - -from . import interaction as interaction -from .key_actions import KeyActions as KeyActions -from .key_input import KeyInput as KeyInput -from .pointer_actions import PointerActions as PointerActions -from .pointer_input import PointerInput as PointerInput - -class ActionBuilder: - devices: Any - driver: Any - def __init__(self, driver, mouse: Any | None = ..., keyboard: Any | None = ...) -> None: ... - def get_device_with(self, name): ... - @property - def pointer_inputs(self): ... - @property - def key_inputs(self): ... - @property - def key_action(self): ... - @property - def pointer_action(self): ... - def add_key_input(self, name): ... - def add_pointer_input(self, kind, name): ... - def perform(self) -> None: ... - def clear_actions(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/input_device.pyi b/stubs/selenium/selenium/webdriver/common/actions/input_device.pyi deleted file mode 100644 index 461e84e..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/input_device.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from typing import Any - -class InputDevice: - name: Any - actions: Any - def __init__(self, name: Any | None = ...) -> None: ... - def add_action(self, action) -> None: ... - def clear_actions(self) -> None: ... - def create_pause(self, duraton: int = ...) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/interaction.pyi b/stubs/selenium/selenium/webdriver/common/actions/interaction.pyi deleted file mode 100644 index 61cb9ee..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/interaction.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Any - -KEY: str -POINTER: str -NONE: str -SOURCE_TYPES: Any -POINTER_MOUSE: str -POINTER_TOUCH: str -POINTER_PEN: str -POINTER_KINDS: Any - -class Interaction: - PAUSE: str - source: Any - def __init__(self, source) -> None: ... - -class Pause(Interaction): - source: Any - duration: Any - def __init__(self, source, duration: int = ...) -> None: ... - def encode(self): ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/key_actions.pyi b/stubs/selenium/selenium/webdriver/common/actions/key_actions.pyi deleted file mode 100644 index b5412a6..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/key_actions.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Any - -from ..utils import keys_to_typing as keys_to_typing -from .interaction import KEY as KEY, Interaction as Interaction -from .key_input import KeyInput as KeyInput - -class KeyActions(Interaction): - source: Any - def __init__(self, source: Any | None = ...) -> None: ... - def key_down(self, letter): ... - def key_up(self, letter): ... - def pause(self, duration: int = ...): ... - def send_keys(self, text): ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/key_input.pyi b/stubs/selenium/selenium/webdriver/common/actions/key_input.pyi deleted file mode 100644 index 7444226..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/key_input.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Any - -from . import interaction as interaction -from .input_device import InputDevice as InputDevice -from .interaction import Interaction as Interaction, Pause as Pause - -class KeyInput(InputDevice): - name: Any - type: Any - def __init__(self, name) -> None: ... - def encode(self): ... - def create_key_down(self, key) -> None: ... - def create_key_up(self, key) -> None: ... - def create_pause(self, pause_duration: int = ...) -> None: ... - -class TypingInteraction(Interaction): - type: Any - key: Any - def __init__(self, source, type_, key) -> None: ... - def encode(self): ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/mouse_button.pyi b/stubs/selenium/selenium/webdriver/common/actions/mouse_button.pyi deleted file mode 100644 index 603c6f6..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/mouse_button.pyi +++ /dev/null @@ -1,4 +0,0 @@ -class MouseButton: - LEFT: int - MIDDLE: int - RIGHT: int diff --git a/stubs/selenium/selenium/webdriver/common/actions/pointer_actions.pyi b/stubs/selenium/selenium/webdriver/common/actions/pointer_actions.pyi deleted file mode 100644 index 4cf6e0c..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/pointer_actions.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webelement import WebElement as WebElement - -from . import interaction as interaction -from .interaction import Interaction as Interaction -from .mouse_button import MouseButton as MouseButton -from .pointer_input import PointerInput as PointerInput - -class PointerActions(Interaction): - source: Any - def __init__(self, source: Any | None = ...) -> None: ... - def pointer_down(self, button=...) -> None: ... - def pointer_up(self, button=...) -> None: ... - def move_to(self, element, x: Any | None = ..., y: Any | None = ...): ... - def move_by(self, x, y): ... - def move_to_location(self, x, y): ... - def click(self, element: Any | None = ...): ... - def context_click(self, element: Any | None = ...): ... - def click_and_hold(self, element: Any | None = ...): ... - def release(self): ... - def double_click(self, element: Any | None = ...) -> None: ... - def pause(self, duration: int = ...): ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi b/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi deleted file mode 100644 index ba8b834..0000000 --- a/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import Any - -from .input_device import InputDevice as InputDevice -from .interaction import POINTER as POINTER, POINTER_KINDS as POINTER_KINDS - -class PointerInput(InputDevice): - DEFAULT_MOVE_DURATION: int - type: Any - kind: Any - name: Any - def __init__(self, kind, name) -> None: ... - def create_pointer_move(self, duration=..., x: Any | None = ..., y: Any | None = ..., origin: Any | None = ...) -> None: ... - def create_pointer_down(self, button) -> None: ... - def create_pointer_up(self, button) -> None: ... - def create_pointer_cancel(self) -> None: ... - def create_pause(self, pause_duration) -> None: ... # type: ignore - def encode(self): ... diff --git a/stubs/selenium/selenium/webdriver/common/alert.pyi b/stubs/selenium/selenium/webdriver/common/alert.pyi deleted file mode 100644 index 9427022..0000000 --- a/stubs/selenium/selenium/webdriver/common/alert.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any - -class Alert: - driver: Any - def __init__(self, driver) -> None: ... - @property - def text(self): ... - def dismiss(self) -> None: ... - def accept(self) -> None: ... - def send_keys(self, keysToSend) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/by.pyi b/stubs/selenium/selenium/webdriver/common/by.pyi deleted file mode 100644 index fbdf77b..0000000 --- a/stubs/selenium/selenium/webdriver/common/by.pyi +++ /dev/null @@ -1,9 +0,0 @@ -class By: - ID: str - XPATH: str - LINK_TEXT: str - PARTIAL_LINK_TEXT: str - NAME: str - TAG_NAME: str - CLASS_NAME: str - CSS_SELECTOR: str diff --git a/stubs/selenium/selenium/webdriver/common/desired_capabilities.pyi b/stubs/selenium/selenium/webdriver/common/desired_capabilities.pyi deleted file mode 100644 index c9b16ca..0000000 --- a/stubs/selenium/selenium/webdriver/common/desired_capabilities.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any - -class DesiredCapabilities: - FIREFOX: Any - INTERNETEXPLORER: Any - EDGE: Any - CHROME: Any - OPERA: Any - SAFARI: Any - HTMLUNIT: Any - HTMLUNITWITHJS: Any - IPHONE: Any - IPAD: Any - ANDROID: Any - PHANTOMJS: Any - WEBKITGTK: Any diff --git a/stubs/selenium/selenium/webdriver/common/html5/application_cache.pyi b/stubs/selenium/selenium/webdriver/common/html5/application_cache.pyi deleted file mode 100644 index 248010e..0000000 --- a/stubs/selenium/selenium/webdriver/common/html5/application_cache.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Any - -class ApplicationCache: - UNCACHED: int - IDLE: int - CHECKING: int - DOWNLOADING: int - UPDATE_READY: int - OBSOLETE: int - driver: Any - def __init__(self, driver) -> None: ... - @property - def status(self): ... diff --git a/stubs/selenium/selenium/webdriver/common/keys.pyi b/stubs/selenium/selenium/webdriver/common/keys.pyi deleted file mode 100644 index b93ef38..0000000 --- a/stubs/selenium/selenium/webdriver/common/keys.pyi +++ /dev/null @@ -1,67 +0,0 @@ -from typing import Any - -class Keys: - NULL: str - CANCEL: str - HELP: str - BACKSPACE: str - BACK_SPACE: Any - TAB: str - CLEAR: str - RETURN: str - ENTER: str - SHIFT: str - LEFT_SHIFT: Any - CONTROL: str - LEFT_CONTROL: Any - ALT: str - LEFT_ALT: Any - PAUSE: str - ESCAPE: str - SPACE: str - PAGE_UP: str - PAGE_DOWN: str - END: str - HOME: str - LEFT: str - ARROW_LEFT: Any - UP: str - ARROW_UP: Any - RIGHT: str - ARROW_RIGHT: Any - DOWN: str - ARROW_DOWN: Any - INSERT: str - DELETE: str - SEMICOLON: str - EQUALS: str - NUMPAD0: str - NUMPAD1: str - NUMPAD2: str - NUMPAD3: str - NUMPAD4: str - NUMPAD5: str - NUMPAD6: str - NUMPAD7: str - NUMPAD8: str - NUMPAD9: str - MULTIPLY: str - ADD: str - SEPARATOR: str - SUBTRACT: str - DECIMAL: str - DIVIDE: str - F1: str - F2: str - F3: str - F4: str - F5: str - F6: str - F7: str - F8: str - F9: str - F10: str - F11: str - F12: str - META: str - COMMAND: str diff --git a/stubs/selenium/selenium/webdriver/common/proxy.pyi b/stubs/selenium/selenium/webdriver/common/proxy.pyi deleted file mode 100644 index a058d9d..0000000 --- a/stubs/selenium/selenium/webdriver/common/proxy.pyi +++ /dev/null @@ -1,70 +0,0 @@ -from typing import Any - -class ProxyTypeFactory: - @staticmethod - def make(ff_value, string): ... - -class ProxyType: - DIRECT: Any - MANUAL: Any - PAC: Any - RESERVED_1: Any - AUTODETECT: Any - SYSTEM: Any - UNSPECIFIED: Any - @classmethod - def load(cls, value): ... - -class Proxy: - proxyType: Any - autodetect: bool - ftpProxy: str - httpProxy: str - noProxy: str - proxyAutoconfigUrl: str - sslProxy: str - socksProxy: str - socksUsername: str - socksPassword: str - def __init__(self, raw: Any | None = ...) -> None: ... - @property - def proxy_type(self): ... - @proxy_type.setter - def proxy_type(self, value) -> None: ... - @property - def auto_detect(self): ... - @auto_detect.setter - def auto_detect(self, value) -> None: ... - @property - def ftp_proxy(self): ... - @ftp_proxy.setter - def ftp_proxy(self, value) -> None: ... - @property - def http_proxy(self): ... - @http_proxy.setter - def http_proxy(self, value) -> None: ... - @property - def no_proxy(self): ... - @no_proxy.setter - def no_proxy(self, value) -> None: ... - @property - def proxy_autoconfig_url(self): ... - @proxy_autoconfig_url.setter - def proxy_autoconfig_url(self, value) -> None: ... - @property - def ssl_proxy(self): ... - @ssl_proxy.setter - def ssl_proxy(self, value) -> None: ... - @property - def socks_proxy(self): ... - @socks_proxy.setter - def socks_proxy(self, value) -> None: ... - @property - def socks_username(self): ... - @socks_username.setter - def socks_username(self, value) -> None: ... - @property - def socks_password(self): ... - @socks_password.setter - def socks_password(self, value) -> None: ... - def add_to_capabilities(self, capabilities) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/service.pyi b/stubs/selenium/selenium/webdriver/common/service.pyi deleted file mode 100644 index f8b2811..0000000 --- a/stubs/selenium/selenium/webdriver/common/service.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Any - -class Service: - path: Any - port: Any - start_error_message: Any - log_file: Any - env: Any - def __init__( - self, executable, port: int = ..., log_file=..., env: Any | None = ..., start_error_message: str = ... - ) -> None: ... - @property - def service_url(self): ... - def command_line_args(self) -> None: ... - process: Any - def start(self) -> None: ... - def assert_process_still_running(self) -> None: ... - def is_connectable(self): ... - def send_remote_shutdown_command(self) -> None: ... - def stop(self) -> None: ... - def __del__(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/touch_actions.pyi b/stubs/selenium/selenium/webdriver/common/touch_actions.pyi deleted file mode 100644 index 04a5d17..0000000 --- a/stubs/selenium/selenium/webdriver/common/touch_actions.pyi +++ /dev/null @@ -1,15 +0,0 @@ -class TouchActions: - def __init__(self, driver) -> None: ... - def perform(self) -> None: ... - def tap(self, on_element): ... - def double_tap(self, on_element): ... - def tap_and_hold(self, xcoord, ycoord): ... - def move(self, xcoord, ycoord): ... - def release(self, xcoord, ycoord): ... - def scroll(self, xoffset, yoffset): ... - def scroll_from_element(self, on_element, xoffset, yoffset): ... - def long_press(self, on_element): ... - def flick(self, xspeed, yspeed): ... - def flick_element(self, on_element, xoffset, yoffset, speed): ... - def __enter__(self): ... - def __exit__(self, _type, _value, _traceback) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/utils.pyi b/stubs/selenium/selenium/webdriver/common/utils.pyi deleted file mode 100644 index ffd7772..0000000 --- a/stubs/selenium/selenium/webdriver/common/utils.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any - -from selenium.webdriver.common.keys import Keys as Keys - -basestring = str - -def free_port(): ... -def find_connectable_ip(host, port: Any | None = ...): ... -def join_host_port(host, port): ... -def is_connectable(port, host: str = ...): ... -def is_url_connectable(port): ... -def keys_to_typing(value): ... diff --git a/stubs/selenium/selenium/webdriver/edge/options.pyi b/stubs/selenium/selenium/webdriver/edge/options.pyi deleted file mode 100644 index 990c092..0000000 --- a/stubs/selenium/selenium/webdriver/edge/options.pyi +++ /dev/null @@ -1,10 +0,0 @@ -class Options: - def __init__(self) -> None: ... - @property - def page_load_strategy(self): ... - @page_load_strategy.setter - def page_load_strategy(self, value) -> None: ... - @property - def capabilities(self): ... - def set_capability(self, name, value) -> None: ... - def to_capabilities(self): ... diff --git a/stubs/selenium/selenium/webdriver/edge/service.pyi b/stubs/selenium/selenium/webdriver/edge/service.pyi deleted file mode 100644 index 87abed5..0000000 --- a/stubs/selenium/selenium/webdriver/edge/service.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - service_args: Any - def __init__(self, executable_path, port: int = ..., verbose: bool = ..., log_path: Any | None = ...) -> None: ... - def command_line_args(self): ... diff --git a/stubs/selenium/selenium/webdriver/edge/webdriver.pyi b/stubs/selenium/selenium/webdriver/edge/webdriver.pyi deleted file mode 100644 index 1a76a70..0000000 --- a/stubs/selenium/selenium/webdriver/edge/webdriver.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -class WebDriver(RemoteWebDriver): - port: Any - edge_service: Any - def __init__( - self, - executable_path: str = ..., - capabilities: Any | None = ..., - port: int = ..., - verbose: bool = ..., - service_log_path: Any | None = ..., - log_path: Any | None = ..., - keep_alive: bool = ..., - ) -> None: ... - def quit(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/firefox/extension_connection.pyi b/stubs/selenium/selenium/webdriver/firefox/extension_connection.pyi deleted file mode 100644 index d47e2b8..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/extension_connection.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.remote_connection import RemoteConnection as RemoteConnection - -LOGGER: Any -PORT: int -HOST: Any - -class ExtensionConnection(RemoteConnection): - profile: Any - binary: Any - def __init__(self, host, firefox_profile, firefox_binary: Any | None = ..., timeout: int = ...) -> None: ... - def quit(self, sessionId: Any | None = ...) -> None: ... - def connect(self): ... - @classmethod - def connect_and_quit(cls) -> None: ... - @classmethod - def is_connectable(cls) -> None: ... - -class ExtensionConnectionError(Exception): ... diff --git a/stubs/selenium/selenium/webdriver/firefox/firefox_binary.pyi b/stubs/selenium/selenium/webdriver/firefox/firefox_binary.pyi deleted file mode 100644 index 4b146ba..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/firefox_binary.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -class FirefoxBinary: - NO_FOCUS_LIBRARY_NAME: str - command_line: Any - def __init__(self, firefox_path: Any | None = ..., log_file: Any | None = ...) -> None: ... - def add_command_line_options(self, *args) -> None: ... - profile: Any - def launch_browser(self, profile, timeout: int = ...) -> None: ... - def kill(self) -> None: ... - def which(self, fname): ... diff --git a/stubs/selenium/selenium/webdriver/firefox/firefox_profile.pyi b/stubs/selenium/selenium/webdriver/firefox/firefox_profile.pyi deleted file mode 100644 index 885b254..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/firefox_profile.pyi +++ /dev/null @@ -1,41 +0,0 @@ -from typing import Any - -WEBDRIVER_EXT: str -WEBDRIVER_PREFERENCES: str -EXTENSION_NAME: str - -class AddonFormatError(Exception): ... - -class FirefoxProfile: - ANONYMOUS_PROFILE_NAME: str - DEFAULT_PREFERENCES: Any - default_preferences: Any - profile_dir: Any - tempfolder: Any - extensionsDir: Any - userPrefs: Any - def __init__(self, profile_directory: Any | None = ...) -> None: ... - def set_preference(self, key, value) -> None: ... - def add_extension(self, extension=...) -> None: ... - def update_preferences(self) -> None: ... - @property - def path(self): ... - @property - def port(self): ... - @port.setter - def port(self, port) -> None: ... - @property - def accept_untrusted_certs(self): ... - @accept_untrusted_certs.setter - def accept_untrusted_certs(self, value) -> None: ... - @property - def assume_untrusted_cert_issuer(self): ... - @assume_untrusted_cert_issuer.setter - def assume_untrusted_cert_issuer(self, value) -> None: ... - @property - def native_events_enabled(self): ... - @native_events_enabled.setter - def native_events_enabled(self, value) -> None: ... - @property - def encoded(self): ... - def set_proxy(self, proxy) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/firefox/options.pyi b/stubs/selenium/selenium/webdriver/firefox/options.pyi deleted file mode 100644 index d5f52f8..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/options.pyi +++ /dev/null @@ -1,46 +0,0 @@ -from typing import Any - -class Log: - level: Any - def __init__(self) -> None: ... - def to_capabilities(self): ... - -class Options: - KEY: str - log: Any - def __init__(self) -> None: ... - @property - def binary(self): ... - @binary.setter - def binary(self, new_binary) -> None: ... - @property - def binary_location(self): ... - @binary_location.setter - def binary_location(self, value) -> None: ... - @property - def accept_insecure_certs(self): ... - @accept_insecure_certs.setter - def accept_insecure_certs(self, value) -> None: ... - @property - def capabilities(self): ... - def set_capability(self, name, value) -> None: ... - @property - def preferences(self): ... - def set_preference(self, name, value) -> None: ... - @property - def proxy(self): ... - @proxy.setter - def proxy(self, value) -> None: ... - @property - def profile(self): ... - @profile.setter - def profile(self, new_profile) -> None: ... - @property - def arguments(self): ... - def add_argument(self, argument) -> None: ... - @property - def headless(self): ... - @headless.setter - def headless(self, value) -> None: ... - def set_headless(self, headless: bool = ...) -> None: ... - def to_capabilities(self): ... diff --git a/stubs/selenium/selenium/webdriver/firefox/remote_connection.pyi b/stubs/selenium/selenium/webdriver/firefox/remote_connection.pyi deleted file mode 100644 index 7bfe084..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/remote_connection.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from selenium.webdriver.remote.remote_connection import RemoteConnection as RemoteConnection - -class FirefoxRemoteConnection(RemoteConnection): - def __init__(self, remote_server_addr, keep_alive: bool = ...) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/firefox/service.pyi b/stubs/selenium/selenium/webdriver/firefox/service.pyi deleted file mode 100644 index a28db43..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/service.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - service_args: Any - def __init__( - self, executable_path, port: int = ..., service_args: Any | None = ..., log_path: str = ..., env: Any | None = ... - ) -> None: ... - def command_line_args(self): ... - def send_remote_shutdown_command(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/firefox/webdriver.pyi b/stubs/selenium/selenium/webdriver/firefox/webdriver.pyi deleted file mode 100644 index e76cf3b..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/webdriver.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from collections.abc import Generator -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -from .extension_connection import ExtensionConnection as ExtensionConnection -from .firefox_binary import FirefoxBinary as FirefoxBinary -from .firefox_profile import FirefoxProfile as FirefoxProfile -from .options import Options as Options -from .remote_connection import FirefoxRemoteConnection as FirefoxRemoteConnection -from .service import Service as Service -from .webelement import FirefoxWebElement as FirefoxWebElement - -basestring = str - -class WebDriver(RemoteWebDriver): - NATIVE_EVENTS_ALLOWED: Any - CONTEXT_CHROME: str - CONTEXT_CONTENT: str - binary: Any - profile: Any - service: Any - def __init__( - self, - firefox_profile: Any | None = ..., - firefox_binary: Any | None = ..., - timeout: int = ..., - capabilities: Any | None = ..., - proxy: Any | None = ..., - executable_path: str = ..., - options: Any | None = ..., - service_log_path: str = ..., - firefox_options: Any | None = ..., - service_args: Any | None = ..., - desired_capabilities: Any | None = ..., - log_path: Any | None = ..., - keep_alive: bool = ..., - ) -> None: ... - def quit(self) -> None: ... - @property - def firefox_profile(self): ... - def set_context(self, context) -> None: ... - def context(self, context) -> Generator[None, None, None]: ... - def install_addon(self, path, temporary: Any | None = ...): ... - def uninstall_addon(self, identifier) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/firefox/webelement.pyi b/stubs/selenium/selenium/webdriver/firefox/webelement.pyi deleted file mode 100644 index 1a4b49f..0000000 --- a/stubs/selenium/selenium/webdriver/firefox/webelement.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from selenium.webdriver.remote.webelement import WebElement as RemoteWebElement - -class FirefoxWebElement(RemoteWebElement): - @property - def anonymous_children(self): ... - def find_anonymous_element_by_attribute(self, name, value): ... diff --git a/stubs/selenium/selenium/webdriver/ie/options.pyi b/stubs/selenium/selenium/webdriver/ie/options.pyi deleted file mode 100644 index e32af17..0000000 --- a/stubs/selenium/selenium/webdriver/ie/options.pyi +++ /dev/null @@ -1,95 +0,0 @@ -class ElementScrollBehavior: - TOP: int - BOTTOM: int - -class Options: - KEY: str - SWITCHES: str - BROWSER_ATTACH_TIMEOUT: str - ELEMENT_SCROLL_BEHAVIOR: str - ENSURE_CLEAN_SESSION: str - FILE_UPLOAD_DIALOG_TIMEOUT: str - FORCE_CREATE_PROCESS_API: str - FORCE_SHELL_WINDOWS_API: str - FULL_PAGE_SCREENSHOT: str - IGNORE_PROTECTED_MODE_SETTINGS: str - IGNORE_ZOOM_LEVEL: str - INITIAL_BROWSER_URL: str - NATIVE_EVENTS: str - PERSISTENT_HOVER: str - REQUIRE_WINDOW_FOCUS: str - USE_PER_PROCESS_PROXY: str - VALIDATE_COOKIE_DOCUMENT_TYPE: str - def __init__(self) -> None: ... - @property - def arguments(self): ... - def add_argument(self, argument) -> None: ... - @property - def options(self): ... - @property - def capabilities(self): ... - def set_capability(self, name, value) -> None: ... - @property - def browser_attach_timeout(self): ... - @browser_attach_timeout.setter - def browser_attach_timeout(self, value) -> None: ... - @property - def element_scroll_behavior(self): ... - @element_scroll_behavior.setter - def element_scroll_behavior(self, value) -> None: ... - @property - def ensure_clean_session(self): ... - @ensure_clean_session.setter - def ensure_clean_session(self, value) -> None: ... - @property - def file_upload_dialog_timeout(self): ... - @file_upload_dialog_timeout.setter - def file_upload_dialog_timeout(self, value) -> None: ... - @property - def force_create_process_api(self): ... - @force_create_process_api.setter - def force_create_process_api(self, value) -> None: ... - @property - def force_shell_windows_api(self): ... - @force_shell_windows_api.setter - def force_shell_windows_api(self, value) -> None: ... - @property - def full_page_screenshot(self): ... - @full_page_screenshot.setter - def full_page_screenshot(self, value) -> None: ... - @property - def ignore_protected_mode_settings(self): ... - @ignore_protected_mode_settings.setter - def ignore_protected_mode_settings(self, value) -> None: ... - @property - def ignore_zoom_level(self): ... - @ignore_zoom_level.setter - def ignore_zoom_level(self, value) -> None: ... - @property - def initial_browser_url(self): ... - @initial_browser_url.setter - def initial_browser_url(self, value) -> None: ... - @property - def native_events(self): ... - @native_events.setter - def native_events(self, value) -> None: ... - @property - def persistent_hover(self): ... - @persistent_hover.setter - def persistent_hover(self, value) -> None: ... - @property - def require_window_focus(self): ... - @require_window_focus.setter - def require_window_focus(self, value) -> None: ... - @property - def use_per_process_proxy(self): ... - @use_per_process_proxy.setter - def use_per_process_proxy(self, value) -> None: ... - @property - def validate_cookie_document_type(self): ... - @validate_cookie_document_type.setter - def validate_cookie_document_type(self, value) -> None: ... - @property - def additional_options(self): ... - def add_additional_option(self, name, value) -> None: ... - def to_capabilities(self): ... diff --git a/stubs/selenium/selenium/webdriver/ie/service.pyi b/stubs/selenium/selenium/webdriver/ie/service.pyi deleted file mode 100644 index faae611..0000000 --- a/stubs/selenium/selenium/webdriver/ie/service.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - service_args: Any - def __init__( - self, executable_path, port: int = ..., host: Any | None = ..., log_level: Any | None = ..., log_file: Any | None = ... - ) -> None: ... - def command_line_args(self): ... diff --git a/stubs/selenium/selenium/webdriver/ie/webdriver.pyi b/stubs/selenium/selenium/webdriver/ie/webdriver.pyi deleted file mode 100644 index 94e0038..0000000 --- a/stubs/selenium/selenium/webdriver/ie/webdriver.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -from .options import Options as Options -from .service import Service as Service - -DEFAULT_TIMEOUT: int -DEFAULT_PORT: int -DEFAULT_HOST: Any -DEFAULT_LOG_LEVEL: Any -DEFAULT_SERVICE_LOG_PATH: Any - -class WebDriver(RemoteWebDriver): - port: Any - host: Any - iedriver: Any - def __init__( - self, - executable_path: str = ..., - capabilities: Any | None = ..., - port=..., - timeout=..., - host=..., - log_level=..., - service_log_path=..., - options: Any | None = ..., - ie_options: Any | None = ..., - desired_capabilities: Any | None = ..., - log_file: Any | None = ..., - keep_alive: bool = ..., - ) -> None: ... - def quit(self) -> None: ... - def create_options(self): ... diff --git a/stubs/selenium/selenium/webdriver/opera/options.pyi b/stubs/selenium/selenium/webdriver/opera/options.pyi deleted file mode 100644 index 508b61b..0000000 --- a/stubs/selenium/selenium/webdriver/opera/options.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from selenium.webdriver.chrome.options import Options as ChromeOptions - -class Options(ChromeOptions): - KEY: str - def __init__(self) -> None: ... - @property - def capabilities(self): ... - def set_capability(self, name, value) -> None: ... - @property - def android_package_name(self): ... - @android_package_name.setter - def android_package_name(self, value) -> None: ... - @property - def android_device_socket(self): ... - @android_device_socket.setter - def android_device_socket(self, value) -> None: ... - @property - def android_command_line_file(self): ... - @android_command_line_file.setter - def android_command_line_file(self, value) -> None: ... - def to_capabilities(self): ... - -class AndroidOptions(Options): - android_package_name: str - def __init__(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/opera/webdriver.pyi b/stubs/selenium/selenium/webdriver/opera/webdriver.pyi deleted file mode 100644 index bad77b1..0000000 --- a/stubs/selenium/selenium/webdriver/opera/webdriver.pyi +++ /dev/null @@ -1,32 +0,0 @@ -from typing import Any - -from selenium.webdriver.chrome.webdriver import WebDriver as ChromiumDriver - -from .options import Options as Options - -class OperaDriver(ChromiumDriver): - def __init__( - self, - executable_path: Any | None = ..., - port: int = ..., - options: Any | None = ..., - service_args: Any | None = ..., - desired_capabilities: Any | None = ..., - service_log_path: Any | None = ..., - opera_options: Any | None = ..., - keep_alive: bool = ..., - ) -> None: ... - def create_options(self): ... - -class WebDriver(OperaDriver): - class ServiceType: - CHROMIUM: int - def __init__( - self, - desired_capabilities: Any | None = ..., - executable_path: Any | None = ..., - port: int = ..., - service_log_path: Any | None = ..., - service_args: Any | None = ..., - options: Any | None = ..., - ) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/phantomjs/service.pyi b/stubs/selenium/selenium/webdriver/phantomjs/service.pyi deleted file mode 100644 index bc6d763..0000000 --- a/stubs/selenium/selenium/webdriver/phantomjs/service.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - service_args: Any - def __init__(self, executable_path, port: int = ..., service_args: Any | None = ..., log_path: Any | None = ...) -> None: ... - def command_line_args(self): ... - @property - def service_url(self): ... - def send_remote_shutdown_command(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/phantomjs/webdriver.pyi b/stubs/selenium/selenium/webdriver/phantomjs/webdriver.pyi deleted file mode 100644 index e57f488..0000000 --- a/stubs/selenium/selenium/webdriver/phantomjs/webdriver.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -from .service import Service as Service - -class WebDriver(RemoteWebDriver): - service: Any - def __init__( - self, - executable_path: str = ..., - port: int = ..., - desired_capabilities=..., - service_args: Any | None = ..., - service_log_path: Any | None = ..., - ) -> None: ... - def quit(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/remote/command.pyi b/stubs/selenium/selenium/webdriver/remote/command.pyi deleted file mode 100644 index 18918be..0000000 --- a/stubs/selenium/selenium/webdriver/remote/command.pyi +++ /dev/null @@ -1,126 +0,0 @@ -class Command: - STATUS: str - NEW_SESSION: str - GET_ALL_SESSIONS: str - DELETE_SESSION: str - CLOSE: str - QUIT: str - GET: str - GO_BACK: str - GO_FORWARD: str - REFRESH: str - ADD_COOKIE: str - GET_COOKIE: str - GET_ALL_COOKIES: str - DELETE_COOKIE: str - DELETE_ALL_COOKIES: str - FIND_ELEMENT: str - FIND_ELEMENTS: str - FIND_CHILD_ELEMENT: str - FIND_CHILD_ELEMENTS: str - CLEAR_ELEMENT: str - CLICK_ELEMENT: str - SEND_KEYS_TO_ELEMENT: str - SEND_KEYS_TO_ACTIVE_ELEMENT: str - SUBMIT_ELEMENT: str - UPLOAD_FILE: str - GET_CURRENT_WINDOW_HANDLE: str - W3C_GET_CURRENT_WINDOW_HANDLE: str - GET_WINDOW_HANDLES: str - W3C_GET_WINDOW_HANDLES: str - GET_WINDOW_SIZE: str - W3C_GET_WINDOW_SIZE: str - W3C_GET_WINDOW_POSITION: str - GET_WINDOW_POSITION: str - SET_WINDOW_SIZE: str - W3C_SET_WINDOW_SIZE: str - SET_WINDOW_RECT: str - GET_WINDOW_RECT: str - SET_WINDOW_POSITION: str - W3C_SET_WINDOW_POSITION: str - SWITCH_TO_WINDOW: str - SWITCH_TO_FRAME: str - SWITCH_TO_PARENT_FRAME: str - GET_ACTIVE_ELEMENT: str - W3C_GET_ACTIVE_ELEMENT: str - GET_CURRENT_URL: str - GET_PAGE_SOURCE: str - GET_TITLE: str - EXECUTE_SCRIPT: str - W3C_EXECUTE_SCRIPT: str - W3C_EXECUTE_SCRIPT_ASYNC: str - GET_ELEMENT_TEXT: str - GET_ELEMENT_VALUE: str - GET_ELEMENT_TAG_NAME: str - SET_ELEMENT_SELECTED: str - IS_ELEMENT_SELECTED: str - IS_ELEMENT_ENABLED: str - IS_ELEMENT_DISPLAYED: str - GET_ELEMENT_LOCATION: str - GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW: str - GET_ELEMENT_SIZE: str - GET_ELEMENT_RECT: str - GET_ELEMENT_ATTRIBUTE: str - GET_ELEMENT_PROPERTY: str - GET_ELEMENT_VALUE_OF_CSS_PROPERTY: str - SCREENSHOT: str - ELEMENT_SCREENSHOT: str - IMPLICIT_WAIT: str - EXECUTE_ASYNC_SCRIPT: str - SET_SCRIPT_TIMEOUT: str - SET_TIMEOUTS: str - MAXIMIZE_WINDOW: str - W3C_MAXIMIZE_WINDOW: str - GET_LOG: str - GET_AVAILABLE_LOG_TYPES: str - FULLSCREEN_WINDOW: str - MINIMIZE_WINDOW: str - DISMISS_ALERT: str - W3C_DISMISS_ALERT: str - ACCEPT_ALERT: str - W3C_ACCEPT_ALERT: str - SET_ALERT_VALUE: str - W3C_SET_ALERT_VALUE: str - GET_ALERT_TEXT: str - W3C_GET_ALERT_TEXT: str - SET_ALERT_CREDENTIALS: str - W3C_ACTIONS: str - W3C_CLEAR_ACTIONS: str - CLICK: str - DOUBLE_CLICK: str - MOUSE_DOWN: str - MOUSE_UP: str - MOVE_TO: str - SET_SCREEN_ORIENTATION: str - GET_SCREEN_ORIENTATION: str - SINGLE_TAP: str - TOUCH_DOWN: str - TOUCH_UP: str - TOUCH_MOVE: str - TOUCH_SCROLL: str - DOUBLE_TAP: str - LONG_PRESS: str - FLICK: str - EXECUTE_SQL: str - GET_LOCATION: str - SET_LOCATION: str - GET_APP_CACHE: str - GET_APP_CACHE_STATUS: str - CLEAR_APP_CACHE: str - GET_LOCAL_STORAGE_ITEM: str - REMOVE_LOCAL_STORAGE_ITEM: str - GET_LOCAL_STORAGE_KEYS: str - SET_LOCAL_STORAGE_ITEM: str - CLEAR_LOCAL_STORAGE: str - GET_LOCAL_STORAGE_SIZE: str - GET_SESSION_STORAGE_ITEM: str - REMOVE_SESSION_STORAGE_ITEM: str - GET_SESSION_STORAGE_KEYS: str - SET_SESSION_STORAGE_ITEM: str - CLEAR_SESSION_STORAGE: str - GET_SESSION_STORAGE_SIZE: str - GET_NETWORK_CONNECTION: str - SET_NETWORK_CONNECTION: str - CURRENT_CONTEXT_HANDLE: str - CONTEXT_HANDLES: str - SWITCH_TO_CONTEXT: str diff --git a/stubs/selenium/selenium/webdriver/remote/errorhandler.pyi b/stubs/selenium/selenium/webdriver/remote/errorhandler.pyi deleted file mode 100644 index 5bdaa46..0000000 --- a/stubs/selenium/selenium/webdriver/remote/errorhandler.pyi +++ /dev/null @@ -1,74 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import ( - ElementClickInterceptedException as ElementClickInterceptedException, - ElementNotInteractableException as ElementNotInteractableException, - ElementNotSelectableException as ElementNotSelectableException, - ElementNotVisibleException as ElementNotVisibleException, - ErrorInResponseException as ErrorInResponseException, - ImeActivationFailedException as ImeActivationFailedException, - ImeNotAvailableException as ImeNotAvailableException, - InsecureCertificateException as InsecureCertificateException, - InvalidArgumentException as InvalidArgumentException, - InvalidCookieDomainException as InvalidCookieDomainException, - InvalidCoordinatesException as InvalidCoordinatesException, - InvalidElementStateException as InvalidElementStateException, - InvalidSelectorException as InvalidSelectorException, - InvalidSessionIdException as InvalidSessionIdException, - JavascriptException as JavascriptException, - MoveTargetOutOfBoundsException as MoveTargetOutOfBoundsException, - NoAlertPresentException as NoAlertPresentException, - NoSuchCookieException as NoSuchCookieException, - NoSuchElementException as NoSuchElementException, - NoSuchFrameException as NoSuchFrameException, - NoSuchWindowException as NoSuchWindowException, - ScreenshotException as ScreenshotException, - SessionNotCreatedException as SessionNotCreatedException, - StaleElementReferenceException as StaleElementReferenceException, - TimeoutException as TimeoutException, - UnableToSetCookieException as UnableToSetCookieException, - UnexpectedAlertPresentException as UnexpectedAlertPresentException, - UnknownMethodException as UnknownMethodException, - WebDriverException as WebDriverException, -) - -class ErrorCode: - SUCCESS: int - NO_SUCH_ELEMENT: Any - NO_SUCH_FRAME: Any - UNKNOWN_COMMAND: Any - STALE_ELEMENT_REFERENCE: Any - ELEMENT_NOT_VISIBLE: Any - INVALID_ELEMENT_STATE: Any - UNKNOWN_ERROR: Any - ELEMENT_IS_NOT_SELECTABLE: Any - JAVASCRIPT_ERROR: Any - XPATH_LOOKUP_ERROR: Any - TIMEOUT: Any - NO_SUCH_WINDOW: Any - INVALID_COOKIE_DOMAIN: Any - UNABLE_TO_SET_COOKIE: Any - UNEXPECTED_ALERT_OPEN: Any - NO_ALERT_OPEN: Any - SCRIPT_TIMEOUT: Any - INVALID_ELEMENT_COORDINATES: Any - IME_NOT_AVAILABLE: Any - IME_ENGINE_ACTIVATION_FAILED: Any - INVALID_SELECTOR: Any - SESSION_NOT_CREATED: Any - MOVE_TARGET_OUT_OF_BOUNDS: Any - INVALID_XPATH_SELECTOR: Any - INVALID_XPATH_SELECTOR_RETURN_TYPER: Any - ELEMENT_NOT_INTERACTABLE: Any - INSECURE_CERTIFICATE: Any - INVALID_ARGUMENT: Any - INVALID_COORDINATES: Any - INVALID_SESSION_ID: Any - NO_SUCH_COOKIE: Any - UNABLE_TO_CAPTURE_SCREEN: Any - ELEMENT_CLICK_INTERCEPTED: Any - UNKNOWN_METHOD: Any - METHOD_NOT_ALLOWED: Any - -class ErrorHandler: - def check_response(self, response) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/remote/file_detector.pyi b/stubs/selenium/selenium/webdriver/remote/file_detector.pyi deleted file mode 100644 index cbb4739..0000000 --- a/stubs/selenium/selenium/webdriver/remote/file_detector.pyi +++ /dev/null @@ -1,13 +0,0 @@ -import abc -from typing import Any - -class FileDetector(metaclass=abc.ABCMeta): - __metaclass__: Any - @abc.abstractmethod - def is_local_file(self, *keys): ... - -class UselessFileDetector(FileDetector): - def is_local_file(self, *keys) -> None: ... - -class LocalFileDetector(FileDetector): - def is_local_file(self, *keys): ... diff --git a/stubs/selenium/selenium/webdriver/remote/mobile.pyi b/stubs/selenium/selenium/webdriver/remote/mobile.pyi deleted file mode 100644 index 2f05913..0000000 --- a/stubs/selenium/selenium/webdriver/remote/mobile.pyi +++ /dev/null @@ -1,28 +0,0 @@ -from typing import Any - -from .command import Command as Command - -class Mobile: - class ConnectionType: - mask: Any - def __init__(self, mask) -> None: ... - @property - def airplane_mode(self): ... - @property - def wifi(self): ... - @property - def data(self): ... - ALL_NETWORK: Any - WIFI_NETWORK: Any - DATA_NETWORK: Any - AIRPLANE_MODE: Any - def __init__(self, driver) -> None: ... - @property - def network_connection(self): ... - def set_network_connection(self, network): ... - @property - def context(self): ... - @context.setter - def context(self, new_context) -> None: ... - @property - def contexts(self): ... diff --git a/stubs/selenium/selenium/webdriver/remote/remote_connection.pyi b/stubs/selenium/selenium/webdriver/remote/remote_connection.pyi deleted file mode 100644 index 9e6d103..0000000 --- a/stubs/selenium/selenium/webdriver/remote/remote_connection.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from typing import Any - -from .command import Command as Command -from .errorhandler import ErrorCode as ErrorCode - -LOGGER: Any - -class RemoteConnection: - @classmethod - def get_timeout(cls): ... - @classmethod - def set_timeout(cls, timeout) -> None: ... - @classmethod - def reset_timeout(cls) -> None: ... - @classmethod - def get_remote_connection_headers(cls, parsed_url, keep_alive: bool = ...): ... - keep_alive: Any - def __init__(self, remote_server_addr, keep_alive: bool = ..., resolve_ip: bool = ...) -> None: ... - def execute(self, command, params): ... diff --git a/stubs/selenium/selenium/webdriver/remote/switch_to.pyi b/stubs/selenium/selenium/webdriver/remote/switch_to.pyi deleted file mode 100644 index 52e8b96..0000000 --- a/stubs/selenium/selenium/webdriver/remote/switch_to.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from selenium.common.exceptions import ( - NoSuchElementException as NoSuchElementException, - NoSuchFrameException as NoSuchFrameException, - NoSuchWindowException as NoSuchWindowException, -) -from selenium.webdriver.common.alert import Alert as Alert -from selenium.webdriver.common.by import By as By - -from .command import Command as Command - -basestring = str - -class SwitchTo: - def __init__(self, driver) -> None: ... - @property - def active_element(self): ... - @property - def alert(self): ... - def default_content(self) -> None: ... - def frame(self, frame_reference) -> None: ... - def parent_frame(self) -> None: ... - def window(self, window_name) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/remote/utils.pyi b/stubs/selenium/selenium/webdriver/remote/utils.pyi deleted file mode 100644 index d9cea73..0000000 --- a/stubs/selenium/selenium/webdriver/remote/utils.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Any - -LOGGER: Any - -def format_json(json_struct): ... -def dump_json(json_struct): ... -def load_json(s): ... -def unzip_to_temp_dir(zip_file_name): ... diff --git a/stubs/selenium/selenium/webdriver/remote/webdriver.pyi b/stubs/selenium/selenium/webdriver/remote/webdriver.pyi deleted file mode 100644 index 95ab425..0000000 --- a/stubs/selenium/selenium/webdriver/remote/webdriver.pyi +++ /dev/null @@ -1,126 +0,0 @@ -from collections.abc import Generator -from typing import Any - -from selenium.common.exceptions import ( - InvalidArgumentException as InvalidArgumentException, - NoSuchCookieException as NoSuchCookieException, - WebDriverException as WebDriverException, -) -from selenium.webdriver.common.by import By as By -from selenium.webdriver.common.html5.application_cache import ApplicationCache as ApplicationCache - -from .command import Command as Command -from .errorhandler import ErrorHandler as ErrorHandler -from .file_detector import FileDetector as FileDetector, LocalFileDetector as LocalFileDetector -from .mobile import Mobile as Mobile -from .remote_connection import RemoteConnection as RemoteConnection -from .switch_to import SwitchTo as SwitchTo -from .webelement import WebElement as WebElement - -class WebDriver: - command_executor: Any - session_id: Any - capabilities: Any - error_handler: Any - def __init__( - self, - command_executor: str | RemoteConnection = ..., - desired_capabilities: Any | None = ..., - browser_profile: Any | None = ..., - proxy: Any | None = ..., - keep_alive: bool = ..., - file_detector: Any | None = ..., - options: Any | None = ..., - ) -> None: ... - def __enter__(self): ... - def __exit__(self, *args) -> None: ... - def file_detector_context(self, file_detector_class, *args, **kwargs) -> Generator[None, None, None]: ... - @property - def mobile(self): ... - @property - def name(self): ... - def start_client(self) -> None: ... - def stop_client(self) -> None: ... - w3c: Any - def start_session(self, capabilities, browser_profile: Any | None = ...) -> None: ... - def create_web_element(self, element_id): ... - def execute(self, driver_command, params: Any | None = ...): ... - def get(self, url) -> None: ... - @property - def title(self): ... - def find_element_by_id(self, id_): ... - def find_elements_by_id(self, id_): ... - def find_element_by_xpath(self, xpath): ... - def find_elements_by_xpath(self, xpath): ... - def find_element_by_link_text(self, link_text): ... - def find_elements_by_link_text(self, text): ... - def find_element_by_partial_link_text(self, link_text): ... - def find_elements_by_partial_link_text(self, link_text): ... - def find_element_by_name(self, name): ... - def find_elements_by_name(self, name): ... - def find_element_by_tag_name(self, name): ... - def find_elements_by_tag_name(self, name): ... - def find_element_by_class_name(self, name): ... - def find_elements_by_class_name(self, name): ... - def find_element_by_css_selector(self, css_selector): ... - def find_elements_by_css_selector(self, css_selector): ... - def execute_script(self, script, *args): ... - def execute_async_script(self, script, *args): ... - @property - def current_url(self): ... - @property - def page_source(self): ... - def close(self) -> None: ... - def quit(self) -> None: ... - @property - def current_window_handle(self): ... - @property - def window_handles(self): ... - def maximize_window(self) -> None: ... - def fullscreen_window(self) -> None: ... - def minimize_window(self) -> None: ... - @property - def switch_to(self): ... - def switch_to_active_element(self): ... - def switch_to_window(self, window_name) -> None: ... - def switch_to_frame(self, frame_reference) -> None: ... - def switch_to_default_content(self) -> None: ... - def switch_to_alert(self): ... - def back(self) -> None: ... - def forward(self) -> None: ... - def refresh(self) -> None: ... - def get_cookies(self): ... - def get_cookie(self, name): ... - def delete_cookie(self, name) -> None: ... - def delete_all_cookies(self) -> None: ... - def add_cookie(self, cookie_dict) -> None: ... - def implicitly_wait(self, time_to_wait) -> None: ... - def set_script_timeout(self, time_to_wait) -> None: ... - def set_page_load_timeout(self, time_to_wait) -> None: ... - def find_element(self, by=..., value: Any | None = ...): ... - def find_elements(self, by=..., value: Any | None = ...): ... - @property - def desired_capabilities(self): ... - def get_screenshot_as_file(self, filename): ... - def save_screenshot(self, filename): ... - def get_screenshot_as_png(self): ... - def get_screenshot_as_base64(self): ... - def set_window_size(self, width, height, windowHandle: str = ...) -> None: ... - def get_window_size(self, windowHandle: str = ...): ... - def set_window_position(self, x, y, windowHandle: str = ...): ... - def get_window_position(self, windowHandle: str = ...): ... - def get_window_rect(self): ... - def set_window_rect(self, x: Any | None = ..., y: Any | None = ..., width: Any | None = ..., height: Any | None = ...): ... - @property - def file_detector(self): ... - @file_detector.setter - def file_detector(self, detector) -> None: ... - @property - def orientation(self): ... - @orientation.setter - def orientation(self, value) -> None: ... - @property - def application_cache(self): ... - @property - def log_types(self): ... - def get_log(self, log_type): ... diff --git a/stubs/selenium/selenium/webdriver/remote/webelement.pyi b/stubs/selenium/selenium/webdriver/remote/webelement.pyi deleted file mode 100644 index 8aa4772..0000000 --- a/stubs/selenium/selenium/webdriver/remote/webelement.pyi +++ /dev/null @@ -1,64 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import WebDriverException as WebDriverException -from selenium.webdriver.common.by import By as By - -from .command import Command as Command - -getAttribute_js: Any -isDisplayed_js: Any - -class WebElement: - def __init__(self, parent, id_, w3c: bool = ...) -> None: ... - @property - def tag_name(self): ... - @property - def text(self): ... - def click(self) -> None: ... - def submit(self) -> None: ... - def clear(self) -> None: ... - def get_property(self, name): ... - def get_attribute(self, name): ... - def is_selected(self): ... - def is_enabled(self): ... - def find_element_by_id(self, id_): ... - def find_elements_by_id(self, id_): ... - def find_element_by_name(self, name): ... - def find_elements_by_name(self, name): ... - def find_element_by_link_text(self, link_text): ... - def find_elements_by_link_text(self, link_text): ... - def find_element_by_partial_link_text(self, link_text): ... - def find_elements_by_partial_link_text(self, link_text): ... - def find_element_by_tag_name(self, name): ... - def find_elements_by_tag_name(self, name): ... - def find_element_by_xpath(self, xpath): ... - def find_elements_by_xpath(self, xpath): ... - def find_element_by_class_name(self, name): ... - def find_elements_by_class_name(self, name): ... - def find_element_by_css_selector(self, css_selector): ... - def find_elements_by_css_selector(self, css_selector): ... - def send_keys(self, *value) -> None: ... - def is_displayed(self): ... - @property - def location_once_scrolled_into_view(self): ... - @property - def size(self): ... - def value_of_css_property(self, property_name): ... - @property - def location(self): ... - @property - def rect(self): ... - @property - def screenshot_as_base64(self): ... - @property - def screenshot_as_png(self): ... - def screenshot(self, filename): ... - @property - def parent(self): ... - @property - def id(self): ... - def __eq__(self, element): ... - def __ne__(self, element): ... - def find_element(self, by=..., value: Any | None = ...): ... - def find_elements(self, by=..., value: Any | None = ...): ... - def __hash__(self): ... diff --git a/stubs/selenium/selenium/webdriver/safari/permissions.pyi b/stubs/selenium/selenium/webdriver/safari/permissions.pyi deleted file mode 100644 index dc83876..0000000 --- a/stubs/selenium/selenium/webdriver/safari/permissions.pyi +++ /dev/null @@ -1,2 +0,0 @@ -class Permission: - GET_USER_MEDIA: str diff --git a/stubs/selenium/selenium/webdriver/safari/remote_connection.pyi b/stubs/selenium/selenium/webdriver/safari/remote_connection.pyi deleted file mode 100644 index ae5623f..0000000 --- a/stubs/selenium/selenium/webdriver/safari/remote_connection.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from selenium.webdriver.remote.remote_connection import RemoteConnection as RemoteConnection - -class SafariRemoteConnection(RemoteConnection): - def __init__(self, remote_server_addr, keep_alive: bool = ...) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/safari/service.pyi b/stubs/selenium/selenium/webdriver/safari/service.pyi deleted file mode 100644 index d45b052..0000000 --- a/stubs/selenium/selenium/webdriver/safari/service.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - service_args: Any - quiet: Any - def __init__(self, executable_path, port: int = ..., quiet: bool = ..., service_args: Any | None = ...) -> None: ... - def command_line_args(self): ... - @property - def service_url(self): ... diff --git a/stubs/selenium/selenium/webdriver/safari/webdriver.pyi b/stubs/selenium/selenium/webdriver/safari/webdriver.pyi deleted file mode 100644 index 3f9c07b..0000000 --- a/stubs/selenium/selenium/webdriver/safari/webdriver.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import WebDriverException as WebDriverException -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities as DesiredCapabilities -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -from .remote_connection import SafariRemoteConnection as SafariRemoteConnection -from .service import Service as Service - -class WebDriver(RemoteWebDriver): - service: Any - def __init__( - self, - port: int = ..., - executable_path: str = ..., - reuse_service: bool = ..., - desired_capabilities=..., - quiet: bool = ..., - keep_alive: bool = ..., - service_args: Any | None = ..., - ) -> None: ... - def quit(self) -> None: ... - def set_permission(self, permission, value) -> None: ... - def get_permission(self, permission): ... - def debug(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/support/abstract_event_listener.pyi b/stubs/selenium/selenium/webdriver/support/abstract_event_listener.pyi deleted file mode 100644 index afea816..0000000 --- a/stubs/selenium/selenium/webdriver/support/abstract_event_listener.pyi +++ /dev/null @@ -1,20 +0,0 @@ -class AbstractEventListener: - def before_navigate_to(self, url, driver) -> None: ... - def after_navigate_to(self, url, driver) -> None: ... - def before_navigate_back(self, driver) -> None: ... - def after_navigate_back(self, driver) -> None: ... - def before_navigate_forward(self, driver) -> None: ... - def after_navigate_forward(self, driver) -> None: ... - def before_find(self, by, value, driver) -> None: ... - def after_find(self, by, value, driver) -> None: ... - def before_click(self, element, driver) -> None: ... - def after_click(self, element, driver) -> None: ... - def before_change_value_of(self, element, driver) -> None: ... - def after_change_value_of(self, element, driver) -> None: ... - def before_execute_script(self, script, driver) -> None: ... - def after_execute_script(self, script, driver) -> None: ... - def before_close(self, driver) -> None: ... - def after_close(self, driver) -> None: ... - def before_quit(self, driver) -> None: ... - def after_quit(self, driver) -> None: ... - def on_exception(self, exception, driver) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/support/color.pyi b/stubs/selenium/selenium/webdriver/support/color.pyi deleted file mode 100644 index 48bde30..0000000 --- a/stubs/selenium/selenium/webdriver/support/color.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Any - -RGB_PATTERN: str -RGB_PCT_PATTERN: str -RGBA_PATTERN: str -RGBA_PCT_PATTERN: str -HEX_PATTERN: str -HEX3_PATTERN: str -HSL_PATTERN: str -HSLA_PATTERN: str - -class Color: - match_obj: Any - @staticmethod - def from_string(str_): ... - red: Any - green: Any - blue: Any - alpha: Any - def __init__(self, red, green, blue, alpha: int = ...) -> None: ... - @property - def rgb(self): ... - @property - def rgba(self): ... - @property - def hex(self): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __hash__(self): ... - -Colors: Any diff --git a/stubs/selenium/selenium/webdriver/support/event_firing_webdriver.pyi b/stubs/selenium/selenium/webdriver/support/event_firing_webdriver.pyi deleted file mode 100644 index 0720d7f..0000000 --- a/stubs/selenium/selenium/webdriver/support/event_firing_webdriver.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import WebDriverException as WebDriverException -from selenium.webdriver.common.by import By as By -from selenium.webdriver.remote.webdriver import WebDriver as WebDriver -from selenium.webdriver.remote.webelement import WebElement as WebElement - -from .abstract_event_listener import AbstractEventListener as AbstractEventListener - -class EventFiringWebDriver: - def __init__(self, driver, event_listener) -> None: ... - @property - def wrapped_driver(self): ... - def get(self, url) -> None: ... - def back(self) -> None: ... - def forward(self) -> None: ... - def execute_script(self, script, *args): ... - def execute_async_script(self, script, *args): ... - def close(self) -> None: ... - def quit(self) -> None: ... - def find_element(self, by=..., value: Any | None = ...): ... - def find_elements(self, by=..., value: Any | None = ...): ... - def find_element_by_id(self, id_): ... - def find_elements_by_id(self, id_): ... - def find_element_by_xpath(self, xpath): ... - def find_elements_by_xpath(self, xpath): ... - def find_element_by_link_text(self, link_text): ... - def find_elements_by_link_text(self, text): ... - def find_element_by_partial_link_text(self, link_text): ... - def find_elements_by_partial_link_text(self, link_text): ... - def find_element_by_name(self, name): ... - def find_elements_by_name(self, name): ... - def find_element_by_tag_name(self, name): ... - def find_elements_by_tag_name(self, name): ... - def find_element_by_class_name(self, name): ... - def find_elements_by_class_name(self, name): ... - def find_element_by_css_selector(self, css_selector): ... - def find_elements_by_css_selector(self, css_selector): ... - def __setattr__(self, item, value) -> None: ... - def __getattr__(self, name): ... - -class EventFiringWebElement: - def __init__(self, webelement, ef_driver) -> None: ... - @property - def wrapped_element(self): ... - def click(self) -> None: ... - def clear(self) -> None: ... - def send_keys(self, *value) -> None: ... - def find_element(self, by=..., value: Any | None = ...): ... - def find_elements(self, by=..., value: Any | None = ...): ... - def find_element_by_id(self, id_): ... - def find_elements_by_id(self, id_): ... - def find_element_by_name(self, name): ... - def find_elements_by_name(self, name): ... - def find_element_by_link_text(self, link_text): ... - def find_elements_by_link_text(self, link_text): ... - def find_element_by_partial_link_text(self, link_text): ... - def find_elements_by_partial_link_text(self, link_text): ... - def find_element_by_tag_name(self, name): ... - def find_elements_by_tag_name(self, name): ... - def find_element_by_xpath(self, xpath): ... - def find_elements_by_xpath(self, xpath): ... - def find_element_by_class_name(self, name): ... - def find_elements_by_class_name(self, name): ... - def find_element_by_css_selector(self, css_selector): ... - def find_elements_by_css_selector(self, css_selector): ... - def __setattr__(self, item, value) -> None: ... - def __getattr__(self, name): ... diff --git a/stubs/selenium/selenium/webdriver/support/events.pyi b/stubs/selenium/selenium/webdriver/support/events.pyi deleted file mode 100644 index 1e3e7dd..0000000 --- a/stubs/selenium/selenium/webdriver/support/events.pyi +++ /dev/null @@ -1,2 +0,0 @@ -from .abstract_event_listener import AbstractEventListener as AbstractEventListener -from .event_firing_webdriver import EventFiringWebDriver as EventFiringWebDriver diff --git a/stubs/selenium/selenium/webdriver/support/expected_conditions.pyi b/stubs/selenium/selenium/webdriver/support/expected_conditions.pyi deleted file mode 100644 index 642f401..0000000 --- a/stubs/selenium/selenium/webdriver/support/expected_conditions.pyi +++ /dev/null @@ -1,140 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import ( - NoAlertPresentException as NoAlertPresentException, - NoSuchElementException as NoSuchElementException, - NoSuchFrameException as NoSuchFrameException, - StaleElementReferenceException as StaleElementReferenceException, - WebDriverException as WebDriverException, -) -from selenium.webdriver.remote.webdriver import WebElement as WebElement - -class title_is: - title: Any - def __init__(self, title) -> None: ... - def __call__(self, driver): ... - -class title_contains: - title: Any - def __init__(self, title) -> None: ... - def __call__(self, driver): ... - -class presence_of_element_located: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class url_contains: - url: Any - def __init__(self, url) -> None: ... - def __call__(self, driver): ... - -class url_matches: - pattern: Any - def __init__(self, pattern) -> None: ... - def __call__(self, driver): ... - -class url_to_be: - url: Any - def __init__(self, url) -> None: ... - def __call__(self, driver): ... - -class url_changes: - url: Any - def __init__(self, url) -> None: ... - def __call__(self, driver): ... - -class visibility_of_element_located: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class visibility_of: - element: Any - def __init__(self, element) -> None: ... - def __call__(self, ignored): ... - -class presence_of_all_elements_located: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class visibility_of_any_elements_located: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class visibility_of_all_elements_located: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class text_to_be_present_in_element: - locator: Any - text: Any - def __init__(self, locator, text_) -> None: ... - def __call__(self, driver): ... - -class text_to_be_present_in_element_value: - locator: Any - text: Any - def __init__(self, locator, text_) -> None: ... - def __call__(self, driver): ... - -class frame_to_be_available_and_switch_to_it: - frame_locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class invisibility_of_element_located: - target: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class invisibility_of_element(invisibility_of_element_located): ... - -class element_to_be_clickable: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class staleness_of: - element: Any - def __init__(self, element) -> None: ... - def __call__(self, ignored): ... - -class element_to_be_selected: - element: Any - def __init__(self, element) -> None: ... - def __call__(self, ignored): ... - -class element_located_to_be_selected: - locator: Any - def __init__(self, locator) -> None: ... - def __call__(self, driver): ... - -class element_selection_state_to_be: - element: Any - is_selected: Any - def __init__(self, element, is_selected) -> None: ... - def __call__(self, ignored): ... - -class element_located_selection_state_to_be: - locator: Any - is_selected: Any - def __init__(self, locator, is_selected) -> None: ... - def __call__(self, driver): ... - -class number_of_windows_to_be: - num_windows: Any - def __init__(self, num_windows) -> None: ... - def __call__(self, driver): ... - -class new_window_is_opened: - current_handles: Any - def __init__(self, current_handles) -> None: ... - def __call__(self, driver): ... - -class alert_is_present: - def __init__(self) -> None: ... - def __call__(self, driver): ... diff --git a/stubs/selenium/selenium/webdriver/support/select.pyi b/stubs/selenium/selenium/webdriver/support/select.pyi deleted file mode 100644 index 690656a..0000000 --- a/stubs/selenium/selenium/webdriver/support/select.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import ( - NoSuchElementException as NoSuchElementException, - UnexpectedTagNameException as UnexpectedTagNameException, -) -from selenium.webdriver.common.by import By as By - -class Select: - is_multiple: Any - def __init__(self, webelement) -> None: ... - @property - def options(self): ... - @property - def all_selected_options(self): ... - @property - def first_selected_option(self): ... - def select_by_value(self, value) -> None: ... - def select_by_index(self, index) -> None: ... - def select_by_visible_text(self, text) -> None: ... - def deselect_all(self) -> None: ... - def deselect_by_value(self, value) -> None: ... - def deselect_by_index(self, index) -> None: ... - def deselect_by_visible_text(self, text) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/support/ui.pyi b/stubs/selenium/selenium/webdriver/support/ui.pyi deleted file mode 100644 index 5ab0b93..0000000 --- a/stubs/selenium/selenium/webdriver/support/ui.pyi +++ /dev/null @@ -1,2 +0,0 @@ -from .select import Select as Select -from .wait import WebDriverWait as WebDriverWait diff --git a/stubs/selenium/selenium/webdriver/support/wait.pyi b/stubs/selenium/selenium/webdriver/support/wait.pyi deleted file mode 100644 index 5106348..0000000 --- a/stubs/selenium/selenium/webdriver/support/wait.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -from selenium.common.exceptions import NoSuchElementException as NoSuchElementException, TimeoutException as TimeoutException - -POLL_FREQUENCY: float -IGNORED_EXCEPTIONS: Any - -class WebDriverWait: - def __init__(self, driver, timeout, poll_frequency=..., ignored_exceptions: Any | None = ...) -> None: ... - def until(self, method, message: str = ...): ... - def until_not(self, method, message: str = ...): ... diff --git a/stubs/selenium/selenium/webdriver/webkitgtk/options.pyi b/stubs/selenium/selenium/webdriver/webkitgtk/options.pyi deleted file mode 100644 index 61f298c..0000000 --- a/stubs/selenium/selenium/webdriver/webkitgtk/options.pyi +++ /dev/null @@ -1,18 +0,0 @@ -class Options: - KEY: str - def __init__(self) -> None: ... - @property - def capabilities(self): ... - def set_capability(self, name, value) -> None: ... - @property - def binary_location(self): ... - @binary_location.setter - def binary_location(self, value) -> None: ... - @property - def arguments(self): ... - def add_argument(self, argument) -> None: ... - @property - def overlay_scrollbars_enabled(self): ... - @overlay_scrollbars_enabled.setter - def overlay_scrollbars_enabled(self, value) -> None: ... - def to_capabilities(self): ... diff --git a/stubs/selenium/selenium/webdriver/webkitgtk/service.pyi b/stubs/selenium/selenium/webdriver/webkitgtk/service.pyi deleted file mode 100644 index dc2804f..0000000 --- a/stubs/selenium/selenium/webdriver/webkitgtk/service.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Any - -from selenium.webdriver.common import service as service - -class Service(service.Service): - def __init__(self, executable_path, port: int = ..., log_path: Any | None = ...) -> None: ... - def command_line_args(self): ... - def send_remote_shutdown_command(self) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/webkitgtk/webdriver.pyi b/stubs/selenium/selenium/webdriver/webkitgtk/webdriver.pyi deleted file mode 100644 index 4bc5b02..0000000 --- a/stubs/selenium/selenium/webdriver/webkitgtk/webdriver.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any - -from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver - -from .service import Service as Service - -class WebDriver(RemoteWebDriver): - service: Any - def __init__( - self, - executable_path: str = ..., - port: int = ..., - options: Any | None = ..., - desired_capabilities=..., - service_log_path: Any | None = ..., - keep_alive: bool = ..., - ) -> None: ... - def quit(self) -> None: ... diff --git a/stubs/setuptools/@tests/stubtest_allowlist.txt b/stubs/setuptools/@tests/stubtest_allowlist.txt index e06f406..5f259d4 100644 --- a/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -26,3 +26,12 @@ pkg_resources.get_provider pkg_resources.py31compat pkg_resources.split_sections pkg_resources.to_filename + +# Only available on Windows +setuptools._distutils.command.bdist_msi + +# Unclear import from stdlib/sub-classing related error +setuptools._distutils.core.Distribution.parse_config_files + +# Only present if docutils is installed +setuptools._distutils.command.check.SilentReporter diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index b575da9..076ac57 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1 +1 @@ -version = "57.4" +version = "65.5.*" diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index ce3699c..d256d21 100644 --- a/stubs/setuptools/pkg_resources/__init__.pyi +++ b/stubs/setuptools/pkg_resources/__init__.pyi @@ -1,20 +1,23 @@ import importlib.abc import types import zipimport +from _typeshed import Self from abc import ABCMeta -from typing import IO, Any, Callable, Generator, Iterable, Optional, Sequence, Set, Tuple, TypeVar, Union, overload +from collections.abc import Callable, Generator, Iterable, Sequence +from typing import IO, Any, TypeVar, overload +from typing_extensions import TypeAlias -LegacyVersion = Any # from packaging.version -Version = Any # from packaging.version +_LegacyVersion: TypeAlias = Any # from packaging.version +_Version: TypeAlias = Any # from packaging.version _T = TypeVar("_T") -_NestedStr = Union[str, Iterable[Union[str, Iterable[Any]]]] -_InstallerType = Callable[[Requirement], Optional[Distribution]] -_EPDistType = Union[Distribution, Requirement, str] -_MetadataType = Optional[IResourceProvider] -_PkgReqType = Union[str, Requirement] -_DistFinderType = Callable[[_Importer, str, bool], Generator[Distribution, None, None]] -_NSHandlerType = Callable[[_Importer, str, str, types.ModuleType], str] +_NestedStr: TypeAlias = str | Iterable[str | Iterable[Any]] +_InstallerType: TypeAlias = Callable[[Requirement], Distribution | None] +_EPDistType: TypeAlias = Distribution | Requirement | str +_MetadataType: TypeAlias = IResourceProvider | None +_PkgReqType: TypeAlias = str | Requirement +_DistFinderType: TypeAlias = Callable[[_Importer, str, bool], Generator[Distribution, None, None]] +_NSHandlerType: TypeAlias = Callable[[_Importer, str, str, types.ModuleType], str] def declare_namespace(name: str) -> None: ... def fixup_namespace_packages(path_item: str) -> None: ... @@ -33,10 +36,10 @@ class WorkingSet: self, requirements: Iterable[Requirement], env: Environment | None = ..., installer: _InstallerType | None = ... ) -> list[Distribution]: ... def add(self, dist: Distribution, entry: str | None = ..., insert: bool = ..., replace: bool = ...) -> None: ... - def subscribe(self, callback: Callable[[Distribution], None]) -> None: ... + def subscribe(self, callback: Callable[[Distribution], object]) -> None: ... def find_plugins( self, plugin_env: Environment, full_env: Environment | None = ..., fallback: bool = ... - ) -> Tuple[list[Distribution], dict[Distribution, Exception]]: ... + ) -> tuple[list[Distribution], dict[Distribution, Exception]]: ... working_set: WorkingSet = ... @@ -53,15 +56,17 @@ class Environment: def remove(self, dist: Distribution) -> None: ... def can_add(self, dist: Distribution) -> bool: ... def __add__(self, other: Distribution | Environment) -> Environment: ... - def __iadd__(self, other: Distribution | Environment) -> Environment: ... + def __iadd__(self: Self, other: Distribution | Environment) -> Self: ... @overload - def best_match(self, req: Requirement, working_set: WorkingSet) -> Distribution: ... + def best_match(self, req: Requirement, working_set: WorkingSet, *, replace_conflicting: bool = ...) -> Distribution: ... @overload - def best_match(self, req: Requirement, working_set: WorkingSet, installer: Callable[[Requirement], _T] = ...) -> _T: ... + def best_match( + self, req: Requirement, working_set: WorkingSet, installer: Callable[[Requirement], _T], replace_conflicting: bool = ... + ) -> _T: ... @overload def obtain(self, requirement: Requirement) -> None: ... @overload - def obtain(self, requirement: Requirement, installer: Callable[[Requirement], _T] = ...) -> _T: ... + def obtain(self, requirement: Requirement, installer: Callable[[Requirement], _T]) -> _T: ... def scan(self, search_path: Sequence[str] | None = ...) -> None: ... def parse_requirements(strs: str | Iterable[str]) -> Generator[Requirement, None, None]: ... @@ -70,15 +75,15 @@ class Requirement: unsafe_name: str project_name: str key: str - extras: Tuple[str, ...] - specs: list[Tuple[str, str]] + extras: tuple[str, ...] + specs: list[tuple[str, str]] # TODO: change this to packaging.markers.Marker | None once we can import # packaging.markers marker: Any | None @staticmethod def parse(s: str | Iterable[str]) -> Requirement: ... - def __contains__(self, item: Distribution | str | Tuple[str, ...]) -> bool: ... - def __eq__(self, other_requirement: Any) -> bool: ... + def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool: ... + def __eq__(self, other_requirement: object) -> bool: ... def load_entry_point(dist: _EPDistType, group: str, name: str) -> Any: ... def get_entry_info(dist: _EPDistType, group: str, name: str) -> EntryPoint | None: ... @@ -90,15 +95,15 @@ def get_entry_map(dist: _EPDistType, group: str) -> dict[str, EntryPoint]: ... class EntryPoint: name: str module_name: str - attrs: Tuple[str, ...] - extras: Tuple[str, ...] + attrs: tuple[str, ...] + extras: tuple[str, ...] dist: Distribution | None def __init__( self, name: str, module_name: str, - attrs: Tuple[str, ...] = ..., - extras: Tuple[str, ...] = ..., + attrs: tuple[str, ...] = ..., + extras: tuple[str, ...] = ..., dist: Distribution | None = ..., ) -> None: ... @classmethod @@ -120,10 +125,14 @@ class Distribution(IResourceProvider, IMetadataProvider): PKG_INFO: str location: str project_name: str - key: str - extras: list[str] - version: str - parsed_version: Tuple[str, ...] + @property + def key(self) -> str: ... + @property + def extras(self) -> list[str]: ... + @property + def version(self) -> str: ... + @property + def parsed_version(self) -> tuple[str, ...]: ... py_version: str platform: str | None precedence: int @@ -145,7 +154,7 @@ class Distribution(IResourceProvider, IMetadataProvider): def from_filename(cls, filename: str, metadata: _MetadataType = ..., **kw: str | None | int) -> Distribution: ... def activate(self, path: list[str] | None = ...) -> None: ... def as_requirement(self) -> Requirement: ... - def requires(self, extras: Tuple[str, ...] = ...) -> list[Requirement]: ... + def requires(self, extras: tuple[str, ...] = ...) -> list[Requirement]: ... def clone(self, **kw: str | int | None) -> Requirement: ... def egg_name(self) -> str: ... def __cmp__(self, other: Any) -> bool: ... @@ -203,7 +212,7 @@ class DistributionNotFound(ResolutionError): @property def req(self) -> Requirement: ... @property - def requirers(self) -> Set[str]: ... + def requirers(self) -> set[str]: ... @property def requirers_str(self) -> str: ... def report(self) -> str: ... @@ -214,11 +223,11 @@ class VersionConflict(ResolutionError): @property def req(self) -> Any: ... def report(self) -> str: ... - def with_context(self, required_by: Set[Distribution | str]) -> VersionConflict: ... + def with_context(self, required_by: set[Distribution | str]) -> VersionConflict: ... class ContextualVersionConflict(VersionConflict): @property - def required_by(self) -> Set[Distribution | str]: ... + def required_by(self) -> set[Distribution | str]: ... class UnknownExtra(ResolutionError): ... @@ -253,9 +262,9 @@ empty_provider: EmptyProvider class FileMetadata(EmptyProvider, IResourceProvider): def __init__(self, path_to_pkg_info: str) -> None: ... -def parse_version(v: str) -> Version | LegacyVersion: ... -def yield_lines(strs: _NestedStr) -> Generator[str, None, None]: ... -def split_sections(strs: _NestedStr) -> Generator[Tuple[str | None, str], None, None]: ... +def parse_version(v: str) -> _Version | _LegacyVersion: ... +def yield_lines(iterable: _NestedStr) -> Generator[str, None, None]: ... +def split_sections(strs: _NestedStr) -> Generator[tuple[str | None, list[str]], None, None]: ... def safe_name(name: str) -> str: ... def safe_version(version: str) -> str: ... def safe_extra(extra: str) -> str: ... diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index 25bd93d..bc712d2 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -1,7 +1,7 @@ from abc import abstractmethod from collections.abc import Iterable, Mapping from distutils.core import Command as _Command -from typing import Any, Type +from typing import Any from setuptools._deprecation_warning import SetuptoolsDeprecationWarning as SetuptoolsDeprecationWarning from setuptools.depends import Require as Require @@ -36,14 +36,14 @@ def setup( scripts: list[str] = ..., ext_modules: list[Extension] = ..., classifiers: list[str] = ..., - distclass: Type[Distribution] = ..., + distclass: type[Distribution] = ..., script_name: str = ..., script_args: list[str] = ..., options: Mapping[str, Any] = ..., license: str = ..., keywords: list[str] | str = ..., platforms: list[str] | str = ..., - cmdclass: Mapping[str, Type[Command]] = ..., + cmdclass: Mapping[str, type[_Command]] = ..., data_files: list[tuple[str, list[str]]] = ..., package_dir: Mapping[str, str] = ..., obsoletes: list[str] = ..., diff --git a/stubs/setuptools/setuptools/_distutils/__init__.pyi b/stubs/setuptools/setuptools/_distutils/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/setuptools/setuptools/_distutils/archive_util.pyi b/stubs/setuptools/setuptools/_distutils/archive_util.pyi new file mode 100644 index 0000000..38458fc --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/archive_util.pyi @@ -0,0 +1,20 @@ +def make_archive( + base_name: str, + format: str, + root_dir: str | None = ..., + base_dir: str | None = ..., + verbose: int = ..., + dry_run: int = ..., + owner: str | None = ..., + group: str | None = ..., +) -> str: ... +def make_tarball( + base_name: str, + base_dir: str, + compress: str | None = ..., + verbose: int = ..., + dry_run: int = ..., + owner: str | None = ..., + group: str | None = ..., +) -> str: ... +def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ... diff --git a/stdlib/@python2/distutils/bcppcompiler.pyi b/stubs/setuptools/setuptools/_distutils/bcppcompiler.pyi similarity index 100% rename from stdlib/@python2/distutils/bcppcompiler.pyi rename to stubs/setuptools/setuptools/_distutils/bcppcompiler.pyi diff --git a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi new file mode 100644 index 0000000..5b92c5f --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi @@ -0,0 +1,152 @@ +from collections.abc import Callable +from typing import Any, Union +from typing_extensions import TypeAlias + +_Macro: TypeAlias = Union[tuple[str], tuple[str, str | None]] + +def gen_lib_options( + compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str] +) -> list[str]: ... +def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ... +def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ... +def new_compiler( + plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ... +) -> CCompiler: ... +def show_compilers() -> None: ... + +class CCompiler: + dry_run: bool + force: bool + verbose: bool + output_dir: str | None + macros: list[_Macro] + include_dirs: list[str] + libraries: list[str] + library_dirs: list[str] + runtime_library_dirs: list[str] + objects: list[str] + def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ... + def add_include_dir(self, dir: str) -> None: ... + def set_include_dirs(self, dirs: list[str]) -> None: ... + def add_library(self, libname: str) -> None: ... + def set_libraries(self, libnames: list[str]) -> None: ... + def add_library_dir(self, dir: str) -> None: ... + def set_library_dirs(self, dirs: list[str]) -> None: ... + def add_runtime_library_dir(self, dir: str) -> None: ... + def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... + def define_macro(self, name: str, value: str | None = ...) -> None: ... + def undefine_macro(self, name: str) -> None: ... + def add_link_object(self, object: str) -> None: ... + def set_link_objects(self, objects: list[str]) -> None: ... + def detect_language(self, sources: str | list[str]) -> str | None: ... + def find_library_file(self, dirs: list[str], lib: str, debug: bool = ...) -> str | None: ... + def has_function( + self, + funcname: str, + includes: list[str] | None = ..., + include_dirs: list[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + ) -> bool: ... + def library_dir_option(self, dir: str) -> str: ... + def library_option(self, lib: str) -> str: ... + def runtime_library_dir_option(self, dir: str) -> str: ... + def set_executables(self, **args: str) -> None: ... + def compile( + self, + sources: list[str], + output_dir: str | None = ..., + macros: _Macro | None = ..., + include_dirs: list[str] | None = ..., + debug: bool = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + depends: list[str] | None = ..., + ) -> list[str]: ... + def create_static_lib( + self, + objects: list[str], + output_libname: str, + output_dir: str | None = ..., + debug: bool = ..., + target_lang: str | None = ..., + ) -> None: ... + def link( + self, + target_desc: str, + objects: list[str], + output_filename: str, + output_dir: str | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., + debug: bool = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + build_temp: str | None = ..., + target_lang: str | None = ..., + ) -> None: ... + def link_executable( + self, + objects: list[str], + output_progname: str, + output_dir: str | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + debug: bool = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + target_lang: str | None = ..., + ) -> None: ... + def link_shared_lib( + self, + objects: list[str], + output_libname: str, + output_dir: str | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., + debug: bool = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + build_temp: str | None = ..., + target_lang: str | None = ..., + ) -> None: ... + def link_shared_object( + self, + objects: list[str], + output_filename: str, + output_dir: str | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., + debug: bool = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + build_temp: str | None = ..., + target_lang: str | None = ..., + ) -> None: ... + def preprocess( + self, + source: str, + output_file: str | None = ..., + macros: list[_Macro] | None = ..., + include_dirs: list[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + ) -> None: ... + def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... + def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... + def object_filenames(self, source_filenames: list[str], strip_dir: int = ..., output_dir: str = ...) -> list[str]: ... + def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... + def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... + def spawn(self, cmd: list[str]) -> None: ... + def mkpath(self, name: str, mode: int = ...) -> None: ... + def move_file(self, src: str, dst: str) -> str: ... + def announce(self, msg: str, level: int = ...) -> None: ... + def warn(self, msg: str) -> None: ... + def debug_print(self, msg: str) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/cmd.pyi b/stubs/setuptools/setuptools/_distutils/cmd.pyi new file mode 100644 index 0000000..e706bdb --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -0,0 +1,68 @@ +from abc import abstractmethod +from collections.abc import Callable, Iterable +from distutils.dist import Distribution +from typing import Any + +class Command: + sub_commands: list[tuple[str, Callable[[Command], bool] | None]] + def __init__(self, dist: Distribution) -> None: ... + @abstractmethod + def initialize_options(self) -> None: ... + @abstractmethod + def finalize_options(self) -> None: ... + @abstractmethod + def run(self) -> None: ... + def announce(self, msg: str, level: int = ...) -> None: ... + def debug_print(self, msg: str) -> None: ... + def ensure_string(self, option: str, default: str | None = ...) -> None: ... + def ensure_string_list(self, option: str | list[str]) -> None: ... + def ensure_filename(self, option: str) -> None: ... + def ensure_dirname(self, option: str) -> None: ... + def get_command_name(self) -> str: ... + def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ... + def get_finalized_command(self, command: str, create: int = ...) -> Command: ... + def reinitialize_command(self, command: Command | str, reinit_subcommands: int = ...) -> Command: ... + def run_command(self, command: str) -> None: ... + def get_sub_commands(self) -> list[str]: ... + def warn(self, msg: str) -> None: ... + def execute(self, func: Callable[..., object], args: Iterable[Any], msg: str | None = ..., level: int = ...) -> None: ... + def mkpath(self, name: str, mode: int = ...) -> None: ... + def copy_file( + self, + infile: str, + outfile: str, + preserve_mode: int = ..., + preserve_times: int = ..., + link: str | None = ..., + level: Any = ..., + ) -> tuple[str, bool]: ... # level is not used + def copy_tree( + self, + infile: str, + outfile: str, + preserve_mode: int = ..., + preserve_times: int = ..., + preserve_symlinks: int = ..., + level: Any = ..., + ) -> list[str]: ... # level is not used + def move_file(self, src: str, dst: str, level: Any = ...) -> str: ... # level is not used + def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used + def make_archive( + self, + base_name: str, + format: str, + root_dir: str | None = ..., + base_dir: str | None = ..., + owner: str | None = ..., + group: str | None = ..., + ) -> str: ... + def make_file( + self, + infiles: str | list[str] | tuple[str, ...], + outfile: str, + func: Callable[..., object], + args: list[Any], + exec_msg: str | None = ..., + skip_msg: str | None = ..., + level: Any = ..., + ) -> None: ... # level is not used diff --git a/stubs/setuptools/setuptools/_distutils/command/__init__.pyi b/stubs/setuptools/setuptools/_distutils/command/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/setuptools/setuptools/_distutils/command/bdist.pyi b/stubs/setuptools/setuptools/_distutils/command/bdist.pyi new file mode 100644 index 0000000..e1f141d --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/bdist.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from ..cmd import Command + +def show_formats() -> None: ... + +class bdist(Command): + description: str + user_options: Any + boolean_options: Any + help_options: Any + no_format_option: Any + default_format: Any + format_commands: Any + format_command: Any + bdist_base: Any + plat_name: Any + formats: Any + dist_dir: Any + skip_build: int + group: Any + owner: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/bdist_dumb.pyi b/stubs/setuptools/setuptools/_distutils/command/bdist_dumb.pyi new file mode 100644 index 0000000..74cca4d --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/bdist_dumb.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from ..cmd import Command + +class bdist_dumb(Command): + description: str + user_options: Any + boolean_options: Any + default_format: Any + bdist_dir: Any + plat_name: Any + format: Any + keep_temp: int + dist_dir: Any + skip_build: Any + relative: int + owner: Any + group: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/bdist_msi.pyi b/stubs/setuptools/setuptools/_distutils/command/bdist_msi.pyi new file mode 100644 index 0000000..66202e8 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/bdist_msi.pyi @@ -0,0 +1,45 @@ +import sys +from typing import Any + +from ..cmd import Command + +if sys.platform == "win32": + from msilib import Dialog + + class PyDialog(Dialog): + def __init__(self, *args, **kw) -> None: ... + def title(self, title) -> None: ... + def back(self, title, next, name: str = ..., active: int = ...): ... + def cancel(self, title, next, name: str = ..., active: int = ...): ... + def next(self, title, next, name: str = ..., active: int = ...): ... + def xbutton(self, name, title, next, xpos): ... + + class bdist_msi(Command): + description: str + user_options: Any + boolean_options: Any + all_versions: Any + other_version: str + if sys.version_info >= (3, 9): + def __init__(self, *args, **kw) -> None: ... + bdist_dir: Any + plat_name: Any + keep_temp: int + no_target_compile: int + no_target_optimize: int + target_version: Any + dist_dir: Any + skip_build: Any + install_script: Any + pre_install_script: Any + versions: Any + def initialize_options(self) -> None: ... + install_script_key: Any + def finalize_options(self) -> None: ... + db: Any + def run(self) -> None: ... + def add_files(self) -> None: ... + def add_find_python(self) -> None: ... + def add_scripts(self) -> None: ... + def add_ui(self) -> None: ... + def get_installer_filename(self, fullname): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/bdist_rpm.pyi b/stubs/setuptools/setuptools/_distutils/command/bdist_rpm.pyi new file mode 100644 index 0000000..7669131 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/bdist_rpm.pyi @@ -0,0 +1,52 @@ +from typing import Any + +from ..cmd import Command + +class bdist_rpm(Command): + description: str + user_options: Any + boolean_options: Any + negative_opt: Any + bdist_base: Any + rpm_base: Any + dist_dir: Any + python: Any + fix_python: Any + spec_only: Any + binary_only: Any + source_only: Any + use_bzip2: Any + distribution_name: Any + group: Any + release: Any + serial: Any + vendor: Any + packager: Any + doc_files: Any + changelog: Any + icon: Any + prep_script: Any + build_script: Any + install_script: Any + clean_script: Any + verify_script: Any + pre_install: Any + post_install: Any + pre_uninstall: Any + post_uninstall: Any + prep: Any + provides: Any + requires: Any + conflicts: Any + build_requires: Any + obsoletes: Any + keep_temp: int + use_rpm_opt_flags: int + rpm3_mode: int + no_autoreq: int + force_arch: Any + quiet: int + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def finalize_package_data(self) -> None: ... + def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/build.pyi b/stubs/setuptools/setuptools/_distutils/command/build.pyi new file mode 100644 index 0000000..cf3c8a5 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/build.pyi @@ -0,0 +1,31 @@ +from typing import Any + +from ..cmd import Command + +def show_compilers() -> None: ... + +class build(Command): + description: str + user_options: Any + boolean_options: Any + help_options: Any + build_base: str + build_purelib: Any + build_platlib: Any + build_lib: Any + build_temp: Any + build_scripts: Any + compiler: Any + plat_name: Any + debug: Any + force: int + executable: Any + parallel: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def has_pure_modules(self): ... + def has_c_libraries(self): ... + def has_ext_modules(self): ... + def has_scripts(self): ... + sub_commands: Any diff --git a/stubs/setuptools/setuptools/_distutils/command/build_clib.pyi b/stubs/setuptools/setuptools/_distutils/command/build_clib.pyi new file mode 100644 index 0000000..32ab182 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/build_clib.pyi @@ -0,0 +1,27 @@ +from typing import Any + +from ..cmd import Command + +def show_compilers() -> None: ... + +class build_clib(Command): + description: str + user_options: Any + boolean_options: Any + help_options: Any + build_clib: Any + build_temp: Any + libraries: Any + include_dirs: Any + define: Any + undef: Any + debug: Any + force: int + compiler: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def check_library_list(self, libraries) -> None: ... + def get_library_names(self): ... + def get_source_files(self): ... + def build_libraries(self, libraries) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi b/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi new file mode 100644 index 0000000..80cd789 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi @@ -0,0 +1,50 @@ +from typing import Any + +from ..cmd import Command + +extension_name_re: Any + +def show_compilers() -> None: ... + +class build_ext(Command): + description: str + sep_by: Any + user_options: Any + boolean_options: Any + help_options: Any + extensions: Any + build_lib: Any + plat_name: Any + build_temp: Any + inplace: int + package: Any + include_dirs: Any + define: Any + undef: Any + libraries: Any + library_dirs: Any + rpath: Any + link_objects: Any + debug: Any + force: Any + compiler: Any + swig: Any + swig_cpp: Any + swig_opts: Any + user: Any + parallel: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def check_extensions_list(self, extensions) -> None: ... + def get_source_files(self): ... + def get_outputs(self): ... + def build_extensions(self) -> None: ... + def build_extension(self, ext) -> None: ... + def swig_sources(self, sources, extension): ... + def find_swig(self): ... + def get_ext_fullpath(self, ext_name): ... + def get_ext_fullname(self, ext_name): ... + def get_ext_filename(self, ext_name): ... + def get_export_symbols(self, ext): ... + def get_libraries(self, ext): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/build_py.pyi b/stubs/setuptools/setuptools/_distutils/command/build_py.pyi new file mode 100644 index 0000000..f4803e3 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/build_py.pyi @@ -0,0 +1,38 @@ +from typing import Any + +from ..cmd import Command + +class build_py(Command): + description: str + user_options: Any + boolean_options: Any + negative_opt: Any + build_lib: Any + py_modules: Any + package: Any + package_data: Any + package_dir: Any + compile: int + optimize: int + force: Any + def initialize_options(self) -> None: ... + packages: Any + data_files: Any + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def get_data_files(self): ... + def find_data_files(self, package, src_dir): ... + def build_package_data(self) -> None: ... + def get_package_dir(self, package): ... + def check_package(self, package, package_dir): ... + def check_module(self, module, module_file): ... + def find_package_modules(self, package, package_dir): ... + def find_modules(self): ... + def find_all_modules(self): ... + def get_source_files(self): ... + def get_module_outfile(self, build_dir, package, module): ... + def get_outputs(self, include_bytecode: int = ...): ... + def build_module(self, module, module_file, package): ... + def build_modules(self) -> None: ... + def build_packages(self) -> None: ... + def byte_compile(self, files) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/build_scripts.pyi b/stubs/setuptools/setuptools/_distutils/command/build_scripts.pyi new file mode 100644 index 0000000..9ce9d7b --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/build_scripts.pyi @@ -0,0 +1,21 @@ +from re import Pattern +from typing import Any + +from ..cmd import Command + +first_line_re: Pattern[str] + +class build_scripts(Command): + description: str + user_options: Any + boolean_options: Any + build_dir: Any + scripts: Any + force: Any + executable: Any + outfiles: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def get_source_files(self): ... + def run(self) -> None: ... + def copy_scripts(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/check.pyi b/stubs/setuptools/setuptools/_distutils/command/check.pyi new file mode 100644 index 0000000..7404e6c --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/check.pyi @@ -0,0 +1,35 @@ +from typing import Any +from typing_extensions import TypeAlias + +from ..cmd import Command + +_Reporter: TypeAlias = Any # really docutils.utils.Reporter + +# Only defined if docutils is installed. +class SilentReporter(_Reporter): + messages: Any + def __init__( + self, + source, + report_level, + halt_level, + stream: Any | None = ..., + debug: int = ..., + encoding: str = ..., + error_handler: str = ..., + ) -> None: ... + def system_message(self, level, message, *children, **kwargs): ... + +class check(Command): + description: str + user_options: Any + boolean_options: Any + restructuredtext: int + metadata: int + strict: int + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def warn(self, msg): ... + def run(self) -> None: ... + def check_metadata(self) -> None: ... + def check_restructuredtext(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/clean.pyi b/stubs/setuptools/setuptools/_distutils/command/clean.pyi new file mode 100644 index 0000000..99560aa --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/clean.pyi @@ -0,0 +1,17 @@ +from typing import Any + +from ..cmd import Command + +class clean(Command): + description: str + user_options: Any + boolean_options: Any + build_base: Any + build_lib: Any + build_temp: Any + build_scripts: Any + bdist_base: Any + all: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/config.pyi b/stubs/setuptools/setuptools/_distutils/command/config.pyi new file mode 100644 index 0000000..03466ca --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/config.pyi @@ -0,0 +1,83 @@ +from collections.abc import Sequence +from re import Pattern +from typing import Any + +from ..ccompiler import CCompiler +from ..cmd import Command + +LANG_EXT: dict[str, str] + +class config(Command): + description: str + # Tuple is full name, short name, description + user_options: Sequence[tuple[str, str | None, str]] + compiler: str | CCompiler + cc: str | None + include_dirs: Sequence[str] | None + libraries: Sequence[str] | None + library_dirs: Sequence[str] | None + noisy: int + dump_source: int + temp_files: Sequence[str] + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def try_cpp( + self, + body: str | None = ..., + headers: Sequence[str] | None = ..., + include_dirs: Sequence[str] | None = ..., + lang: str = ..., + ) -> bool: ... + def search_cpp( + self, + pattern: Pattern[str] | str, + body: str | None = ..., + headers: Sequence[str] | None = ..., + include_dirs: Sequence[str] | None = ..., + lang: str = ..., + ) -> bool: ... + def try_compile( + self, body: str, headers: Sequence[str] | None = ..., include_dirs: Sequence[str] | None = ..., lang: str = ... + ) -> bool: ... + def try_link( + self, + body: str, + headers: Sequence[str] | None = ..., + include_dirs: Sequence[str] | None = ..., + libraries: Sequence[str] | None = ..., + library_dirs: Sequence[str] | None = ..., + lang: str = ..., + ) -> bool: ... + def try_run( + self, + body: str, + headers: Sequence[str] | None = ..., + include_dirs: Sequence[str] | None = ..., + libraries: Sequence[str] | None = ..., + library_dirs: Sequence[str] | None = ..., + lang: str = ..., + ) -> bool: ... + def check_func( + self, + func: str, + headers: Sequence[str] | None = ..., + include_dirs: Sequence[str] | None = ..., + libraries: Sequence[str] | None = ..., + library_dirs: Sequence[str] | None = ..., + decl: int = ..., + call: int = ..., + ) -> bool: ... + def check_lib( + self, + library: str, + library_dirs: Sequence[str] | None = ..., + headers: Sequence[str] | None = ..., + include_dirs: Sequence[str] | None = ..., + other_libraries: list[str] = ..., + ) -> bool: ... + def check_header( + self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ... + ) -> bool: ... + +def dump_file(filename: str, head: Any | None = ...) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/install.pyi b/stubs/setuptools/setuptools/_distutils/command/install.pyi new file mode 100644 index 0000000..661d256 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/install.pyi @@ -0,0 +1,63 @@ +from typing import Any + +from ..cmd import Command + +HAS_USER_SITE: bool +SCHEME_KEYS: tuple[str, ...] +INSTALL_SCHEMES: dict[str, dict[Any, Any]] + +class install(Command): + description: str + user_options: Any + boolean_options: Any + negative_opt: Any + prefix: str | None + exec_prefix: Any + home: str | None + user: bool + install_base: Any + install_platbase: Any + root: str | None + install_purelib: Any + install_platlib: Any + install_headers: Any + install_lib: str | None + install_scripts: Any + install_data: Any + install_userbase: Any + install_usersite: Any + compile: Any + optimize: Any + extra_path: Any + install_path_file: int + force: int + skip_build: int + warn_dir: int + build_base: Any + build_lib: Any + record: Any + def initialize_options(self) -> None: ... + config_vars: Any + install_libbase: Any + def finalize_options(self) -> None: ... + def dump_dirs(self, msg) -> None: ... + def finalize_unix(self) -> None: ... + def finalize_other(self) -> None: ... + def select_scheme(self, name) -> None: ... + def expand_basedirs(self) -> None: ... + def expand_dirs(self) -> None: ... + def convert_paths(self, *names) -> None: ... + path_file: Any + extra_dirs: Any + def handle_extra_path(self) -> None: ... + def change_roots(self, *names) -> None: ... + def create_home_path(self) -> None: ... + def run(self) -> None: ... + def create_path_file(self) -> None: ... + def get_outputs(self): ... + def get_inputs(self): ... + def has_lib(self): ... + def has_headers(self): ... + def has_scripts(self): ... + def has_data(self): ... + sub_commands: Any diff --git a/stubs/setuptools/setuptools/_distutils/command/install_data.pyi b/stubs/setuptools/setuptools/_distutils/command/install_data.pyi new file mode 100644 index 0000000..6cc9b52 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/install_data.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from ..cmd import Command + +class install_data(Command): + description: str + user_options: Any + boolean_options: Any + install_dir: Any + outfiles: Any + root: Any + force: int + data_files: Any + warn_dir: int + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def get_inputs(self): ... + def get_outputs(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/install_egg_info.pyi b/stubs/setuptools/setuptools/_distutils/command/install_egg_info.pyi new file mode 100644 index 0000000..776eafc --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/install_egg_info.pyi @@ -0,0 +1,18 @@ +from typing import Any, ClassVar + +from ..cmd import Command + +class install_egg_info(Command): + description: ClassVar[str] + user_options: ClassVar[list[tuple[str, str | None, str]]] + install_dir: Any + def initialize_options(self) -> None: ... + target: Any + outputs: Any + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def get_outputs(self) -> list[str]: ... + +def safe_name(name): ... +def safe_version(version): ... +def to_filename(name): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/install_headers.pyi b/stubs/setuptools/setuptools/_distutils/command/install_headers.pyi new file mode 100644 index 0000000..795bd1c --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/install_headers.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from ..cmd import Command + +class install_headers(Command): + description: str + user_options: Any + boolean_options: Any + install_dir: Any + force: int + outfiles: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def get_inputs(self): ... + def get_outputs(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/install_lib.pyi b/stubs/setuptools/setuptools/_distutils/command/install_lib.pyi new file mode 100644 index 0000000..a6a5e4e --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/install_lib.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from ..cmd import Command + +PYTHON_SOURCE_EXTENSION: str + +class install_lib(Command): + description: str + user_options: Any + boolean_options: Any + negative_opt: Any + install_dir: Any + build_dir: Any + force: int + compile: Any + optimize: Any + skip_build: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def build(self) -> None: ... + def install(self): ... + def byte_compile(self, files) -> None: ... + def get_outputs(self): ... + def get_inputs(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/install_scripts.pyi b/stubs/setuptools/setuptools/_distutils/command/install_scripts.pyi new file mode 100644 index 0000000..92728a1 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/install_scripts.pyi @@ -0,0 +1,18 @@ +from typing import Any + +from ..cmd import Command + +class install_scripts(Command): + description: str + user_options: Any + boolean_options: Any + install_dir: Any + force: int + build_dir: Any + skip_build: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + outfiles: Any + def run(self) -> None: ... + def get_inputs(self): ... + def get_outputs(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/py37compat.pyi b/stubs/setuptools/setuptools/_distutils/command/py37compat.pyi new file mode 100644 index 0000000..9d921db --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/py37compat.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete + +def compose(f1, f2): ... + +pythonlib: Incomplete diff --git a/stubs/setuptools/setuptools/_distutils/command/register.pyi b/stubs/setuptools/setuptools/_distutils/command/register.pyi new file mode 100644 index 0000000..a1a7a45 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/register.pyi @@ -0,0 +1,18 @@ +from typing import Any + +from ..config import PyPIRCCommand + +class register(PyPIRCCommand): + description: str + sub_commands: Any + list_classifiers: int + strict: int + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def check_metadata(self) -> None: ... + def classifiers(self) -> None: ... + def verify_metadata(self) -> None: ... + def send_metadata(self) -> None: ... + def build_post_data(self, action): ... + def post_to_server(self, data, auth: Any | None = ...): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/sdist.pyi b/stubs/setuptools/setuptools/_distutils/command/sdist.pyi new file mode 100644 index 0000000..636c4a3 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/sdist.pyi @@ -0,0 +1,42 @@ +from typing import Any + +from ..cmd import Command + +def show_formats() -> None: ... + +class sdist(Command): + description: str + def checking_metadata(self): ... + user_options: Any + boolean_options: Any + help_options: Any + negative_opt: Any + sub_commands: Any + READMES: Any + template: Any + manifest: Any + use_defaults: int + prune: int + manifest_only: int + force_manifest: int + formats: Any + keep_temp: int + dist_dir: Any + archive_files: Any + metadata_check: int + owner: Any + group: Any + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + filelist: Any + def run(self) -> None: ... + def check_metadata(self) -> None: ... + def get_file_list(self) -> None: ... + def add_defaults(self) -> None: ... + def read_template(self) -> None: ... + def prune_file_list(self) -> None: ... + def write_manifest(self) -> None: ... + def read_manifest(self) -> None: ... + def make_release_tree(self, base_dir, files) -> None: ... + def make_distribution(self) -> None: ... + def get_archive_files(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/command/upload.pyi b/stubs/setuptools/setuptools/_distutils/command/upload.pyi new file mode 100644 index 0000000..e6b7782 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/command/upload.pyi @@ -0,0 +1,17 @@ +from typing import Any, ClassVar + +from ..config import PyPIRCCommand + +class upload(PyPIRCCommand): + description: ClassVar[str] + username: str + password: str + show_response: int + sign: bool + identity: Any + def initialize_options(self) -> None: ... + repository: Any + realm: Any + def finalize_options(self) -> None: ... + def run(self) -> None: ... + def upload_file(self, command: str, pyversion: str, filename: str) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/config.pyi b/stubs/setuptools/setuptools/_distutils/config.pyi new file mode 100644 index 0000000..5814a82 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/config.pyi @@ -0,0 +1,17 @@ +from abc import abstractmethod +from distutils.cmd import Command +from typing import ClassVar + +DEFAULT_PYPIRC: str + +class PyPIRCCommand(Command): + DEFAULT_REPOSITORY: ClassVar[str] + DEFAULT_REALM: ClassVar[str] + repository: None + realm: None + user_options: ClassVar[list[tuple[str, str | None, str]]] + boolean_options: ClassVar[list[str]] + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + @abstractmethod + def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/core.pyi b/stubs/setuptools/setuptools/_distutils/core.pyi new file mode 100644 index 0000000..199a4d7 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/core.pyi @@ -0,0 +1,49 @@ +from collections.abc import Mapping +from distutils.cmd import Command as Command +from distutils.dist import Distribution as Distribution +from distutils.extension import Extension as Extension +from typing import Any + +def setup( + *, + name: str = ..., + version: str = ..., + description: str = ..., + long_description: str = ..., + author: str = ..., + author_email: str = ..., + maintainer: str = ..., + maintainer_email: str = ..., + url: str = ..., + download_url: str = ..., + packages: list[str] = ..., + py_modules: list[str] = ..., + scripts: list[str] = ..., + ext_modules: list[Extension] = ..., + classifiers: list[str] = ..., + distclass: type[Distribution] = ..., + script_name: str = ..., + script_args: list[str] = ..., + options: Mapping[str, Any] = ..., + license: str = ..., + keywords: list[str] | str = ..., + platforms: list[str] | str = ..., + cmdclass: Mapping[str, type[Command]] = ..., + data_files: list[tuple[str, list[str]]] = ..., + package_dir: Mapping[str, str] = ..., + obsoletes: list[str] = ..., + provides: list[str] = ..., + requires: list[str] = ..., + command_packages: list[str] = ..., + command_options: Mapping[str, Mapping[str, tuple[Any, Any]]] = ..., + package_data: Mapping[str, list[str]] = ..., + include_package_data: bool = ..., + libraries: list[str] = ..., + headers: list[str] = ..., + ext_package: str = ..., + include_dirs: list[str] = ..., + password: str = ..., + fullname: str = ..., + **attrs: Any, +) -> None: ... +def run_setup(script_name: str, script_args: list[str] | None = ..., stop_after: str = ...) -> Distribution: ... diff --git a/stdlib/@python2/distutils/cygwinccompiler.pyi b/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi similarity index 100% rename from stdlib/@python2/distutils/cygwinccompiler.pyi rename to stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi diff --git a/stubs/setuptools/setuptools/_distutils/debug.pyi b/stubs/setuptools/setuptools/_distutils/debug.pyi new file mode 100644 index 0000000..11f28a8 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/debug.pyi @@ -0,0 +1 @@ +DEBUG: bool | None diff --git a/stubs/setuptools/setuptools/_distutils/dep_util.pyi b/stubs/setuptools/setuptools/_distutils/dep_util.pyi new file mode 100644 index 0000000..929d6ff --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/dep_util.pyi @@ -0,0 +1,3 @@ +def newer(source: str, target: str) -> bool: ... +def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... +def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ... diff --git a/stubs/setuptools/setuptools/_distutils/dir_util.pyi b/stubs/setuptools/setuptools/_distutils/dir_util.pyi new file mode 100644 index 0000000..ffe5ff1 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/dir_util.pyi @@ -0,0 +1,13 @@ +def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> list[str]: ... +def create_tree(base_dir: str, files: list[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... +def copy_tree( + src: str, + dst: str, + preserve_mode: int = ..., + preserve_times: int = ..., + preserve_symlinks: int = ..., + update: int = ..., + verbose: int = ..., + dry_run: int = ..., +) -> list[str]: ... +def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/dist.pyi b/stubs/setuptools/setuptools/_distutils/dist.pyi new file mode 100644 index 0000000..ef47e4e --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/dist.pyi @@ -0,0 +1,59 @@ +from _typeshed import StrOrBytesPath, SupportsWrite +from collections.abc import Iterable, Mapping +from distutils.cmd import Command +from typing import IO, Any + +class DistributionMetadata: + def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ... + name: str | None + version: str | None + author: str | None + author_email: str | None + maintainer: str | None + maintainer_email: str | None + url: str | None + license: str | None + description: str | None + long_description: str | None + keywords: str | list[str] | None + platforms: str | list[str] | None + classifiers: str | list[str] | None + download_url: str | None + provides: list[str] | None + requires: list[str] | None + obsoletes: list[str] | None + def read_pkg_file(self, file: IO[str]) -> None: ... + def write_pkg_info(self, base_dir: str) -> None: ... + def write_pkg_file(self, file: SupportsWrite[str]) -> None: ... + def get_name(self) -> str: ... + def get_version(self) -> str: ... + def get_fullname(self) -> str: ... + def get_author(self) -> str: ... + def get_author_email(self) -> str: ... + def get_maintainer(self) -> str: ... + def get_maintainer_email(self) -> str: ... + def get_contact(self) -> str: ... + def get_contact_email(self) -> str: ... + def get_url(self) -> str: ... + def get_license(self) -> str: ... + def get_licence(self) -> str: ... + def get_description(self) -> str: ... + def get_long_description(self) -> str: ... + def get_keywords(self) -> str | list[str]: ... + def get_platforms(self) -> str | list[str]: ... + def get_classifiers(self) -> str | list[str]: ... + def get_download_url(self) -> str: ... + def get_requires(self) -> list[str]: ... + def set_requires(self, value: Iterable[str]) -> None: ... + def get_provides(self) -> list[str]: ... + def set_provides(self, value: Iterable[str]) -> None: ... + def get_obsoletes(self) -> list[str]: ... + def set_obsoletes(self, value: Iterable[str]) -> None: ... + +class Distribution: + cmdclass: dict[str, type[Command]] + metadata: DistributionMetadata + def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ... + def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ... + def parse_config_files(self, filenames: Iterable[str] | None = ...) -> None: ... + def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ... diff --git a/stdlib/@python2/distutils/errors.pyi b/stubs/setuptools/setuptools/_distutils/errors.pyi similarity index 100% rename from stdlib/@python2/distutils/errors.pyi rename to stubs/setuptools/setuptools/_distutils/errors.pyi diff --git a/stubs/setuptools/setuptools/_distutils/extension.pyi b/stubs/setuptools/setuptools/_distutils/extension.pyi new file mode 100644 index 0000000..5639f44 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/extension.pyi @@ -0,0 +1,36 @@ +class Extension: + name: str + sources: list[str] + include_dirs: list[str] + define_macros: list[tuple[str, str | None]] + undef_macros: list[str] + library_dirs: list[str] + libraries: list[str] + runtime_library_dirs: list[str] + extra_objects: list[str] + extra_compile_args: list[str] + extra_link_args: list[str] + export_symbols: list[str] + swig_opts: list[str] + depends: list[str] + language: str | None + optional: bool | None + def __init__( + self, + name: str, + sources: list[str], + include_dirs: list[str] | None = ..., + define_macros: list[tuple[str, str | None]] | None = ..., + undef_macros: list[str] | None = ..., + library_dirs: list[str] | None = ..., + libraries: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + extra_objects: list[str] | None = ..., + extra_compile_args: list[str] | None = ..., + extra_link_args: list[str] | None = ..., + export_symbols: list[str] | None = ..., + swig_opts: list[str] | None = ..., + depends: list[str] | None = ..., + language: str | None = ..., + optional: bool | None = ..., + ) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/fancy_getopt.pyi b/stubs/setuptools/setuptools/_distutils/fancy_getopt.pyi new file mode 100644 index 0000000..6a7124b --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/fancy_getopt.pyi @@ -0,0 +1,24 @@ +from collections.abc import Iterable, Mapping +from typing import Any, overload +from typing_extensions import TypeAlias + +_Option: TypeAlias = tuple[str, str | None, str] +_GR: TypeAlias = tuple[list[str], OptionDummy] + +def fancy_getopt( + options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None +) -> list[str] | _GR: ... +def wrap_text(text: str, width: int) -> list[str]: ... + +class FancyGetopt: + def __init__(self, option_table: list[_Option] | None = ...) -> None: ... + # TODO kinda wrong, `getopt(object=object())` is invalid + @overload + def getopt(self, args: list[str] | None = ...) -> _GR: ... + @overload + def getopt(self, args: list[str] | None, object: Any) -> list[str]: ... + def get_option_order(self) -> list[tuple[str, str]]: ... + def generate_help(self, header: str | None = ...) -> list[str]: ... + +class OptionDummy: + def __init__(self, options: Iterable[str] = ...) -> None: ... diff --git a/stdlib/@python2/distutils/file_util.pyi b/stubs/setuptools/setuptools/_distutils/file_util.pyi similarity index 85% rename from stdlib/@python2/distutils/file_util.pyi rename to stubs/setuptools/setuptools/_distutils/file_util.pyi index cfe840e..b312784 100644 --- a/stdlib/@python2/distutils/file_util.pyi +++ b/stubs/setuptools/setuptools/_distutils/file_util.pyi @@ -1,4 +1,4 @@ -from typing import Sequence, Tuple +from collections.abc import Sequence def copy_file( src: str, @@ -9,6 +9,6 @@ def copy_file( link: str | None = ..., verbose: bool = ..., dry_run: bool = ..., -) -> Tuple[str, str]: ... +) -> tuple[str, str]: ... def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ... def write_file(filename: str, contents: Sequence[str]) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/filelist.pyi b/stubs/setuptools/setuptools/_distutils/filelist.pyi new file mode 100644 index 0000000..1cfdcf0 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/filelist.pyi @@ -0,0 +1,51 @@ +from collections.abc import Iterable +from re import Pattern +from typing import overload +from typing_extensions import Literal + +# class is entirely undocumented +class FileList: + allfiles: Iterable[str] | None + files: list[str] + def __init__(self, warn: None = ..., debug_print: None = ...) -> None: ... + def set_allfiles(self, allfiles: Iterable[str]) -> None: ... + def findall(self, dir: str = ...) -> None: ... + def debug_print(self, msg: str) -> None: ... + def append(self, item: str) -> None: ... + def extend(self, items: Iterable[str]) -> None: ... + def sort(self) -> None: ... + def remove_duplicates(self) -> None: ... + def process_template_line(self, line: str) -> None: ... + @overload + def include_pattern( + self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... + ) -> bool: ... + @overload + def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... + @overload + def include_pattern( + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... + ) -> bool: ... + @overload + def exclude_pattern( + self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... + ) -> bool: ... + @overload + def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... + @overload + def exclude_pattern( + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... + ) -> bool: ... + +def findall(dir: str = ...) -> list[str]: ... +def glob_to_re(pattern: str) -> str: ... +@overload +def translate_pattern( + pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[False, 0] = ... +) -> Pattern[str]: ... +@overload +def translate_pattern(pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ... +@overload +def translate_pattern( + pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... +) -> Pattern[str]: ... diff --git a/stubs/setuptools/setuptools/_distutils/log.pyi b/stubs/setuptools/setuptools/_distutils/log.pyi new file mode 100644 index 0000000..549b569 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/log.pyi @@ -0,0 +1,25 @@ +from typing import Any + +DEBUG: int +INFO: int +WARN: int +ERROR: int +FATAL: int + +class Log: + def __init__(self, threshold: int = ...) -> None: ... + def log(self, level: int, msg: str, *args: Any) -> None: ... + def debug(self, msg: str, *args: Any) -> None: ... + def info(self, msg: str, *args: Any) -> None: ... + def warn(self, msg: str, *args: Any) -> None: ... + def error(self, msg: str, *args: Any) -> None: ... + def fatal(self, msg: str, *args: Any) -> None: ... + +def log(level: int, msg: str, *args: Any) -> None: ... +def debug(msg: str, *args: Any) -> None: ... +def info(msg: str, *args: Any) -> None: ... +def warn(msg: str, *args: Any) -> None: ... +def error(msg: str, *args: Any) -> None: ... +def fatal(msg: str, *args: Any) -> None: ... +def set_threshold(level: int) -> int: ... +def set_verbosity(v: int) -> None: ... diff --git a/stdlib/@python2/distutils/msvccompiler.pyi b/stubs/setuptools/setuptools/_distutils/msvccompiler.pyi similarity index 100% rename from stdlib/@python2/distutils/msvccompiler.pyi rename to stubs/setuptools/setuptools/_distutils/msvccompiler.pyi diff --git a/stubs/setuptools/setuptools/_distutils/spawn.pyi b/stubs/setuptools/setuptools/_distutils/spawn.pyi new file mode 100644 index 0000000..2dc07dc --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/spawn.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete + +def spawn( + cmd: list[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ..., env: Incomplete | None = ... +) -> None: ... +def find_executable(executable: str, path: str | None = ...) -> str | None: ... diff --git a/stubs/setuptools/setuptools/_distutils/sysconfig.pyi b/stubs/setuptools/setuptools/_distutils/sysconfig.pyi new file mode 100644 index 0000000..bf7db9c --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/sysconfig.pyi @@ -0,0 +1,13 @@ +from collections.abc import Mapping +from distutils.ccompiler import CCompiler + +PREFIX: str +EXEC_PREFIX: str + +def get_config_var(name: str) -> int | str | None: ... +def get_config_vars(*args: str) -> Mapping[str, int | str]: ... +def get_config_h_filename() -> str: ... +def get_makefile_filename() -> str: ... +def get_python_inc(plat_specific: bool = ..., prefix: str | None = ...) -> str: ... +def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = ...) -> str: ... +def customize_compiler(compiler: CCompiler) -> None: ... diff --git a/stdlib/@python2/distutils/text_file.pyi b/stubs/setuptools/setuptools/_distutils/text_file.pyi similarity index 75% rename from stdlib/@python2/distutils/text_file.pyi rename to stubs/setuptools/setuptools/_distutils/text_file.pyi index 26ba5a6..ace642e 100644 --- a/stdlib/@python2/distutils/text_file.pyi +++ b/stubs/setuptools/setuptools/_distutils/text_file.pyi @@ -1,4 +1,4 @@ -from typing import IO, List, Tuple +from typing import IO class TextFile: def __init__( @@ -15,7 +15,7 @@ class TextFile: ) -> None: ... def open(self, filename: str) -> None: ... def close(self) -> None: ... - def warn(self, msg: str, line: List[int] | Tuple[int, int] | int = ...) -> None: ... + def warn(self, msg: str, line: list[int] | tuple[int, int] | int | None = ...) -> None: ... def readline(self) -> str | None: ... - def readlines(self) -> List[str]: ... + def readlines(self) -> list[str]: ... def unreadline(self, line: str) -> str: ... diff --git a/stdlib/@python2/distutils/unixccompiler.pyi b/stubs/setuptools/setuptools/_distutils/unixccompiler.pyi similarity index 100% rename from stdlib/@python2/distutils/unixccompiler.pyi rename to stubs/setuptools/setuptools/_distutils/unixccompiler.pyi diff --git a/stubs/setuptools/setuptools/_distutils/util.pyi b/stubs/setuptools/setuptools/_distutils/util.pyi new file mode 100644 index 0000000..6790712 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/util.pyi @@ -0,0 +1,30 @@ +from collections.abc import Callable, Mapping +from typing import Any +from typing_extensions import Literal + +def get_host_platform() -> str: ... +def get_platform() -> str: ... +def get_macosx_target_ver_from_syscfg(): ... +def get_macosx_target_ver(): ... +def split_version(s: str) -> list[int]: ... +def convert_path(pathname: str) -> str: ... +def change_root(new_root: str, pathname: str) -> str: ... +def check_environ() -> None: ... +def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... +def grok_environment_error(exc: object, prefix: str = ...) -> str: ... +def split_quoted(s: str) -> list[str]: ... +def execute( + func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... +) -> None: ... +def strtobool(val: str) -> Literal[0, 1]: ... +def byte_compile( + py_files: list[str], + optimize: int = ..., + force: bool = ..., + prefix: str | None = ..., + base_dir: str | None = ..., + verbose: bool = ..., + dry_run: bool = ..., + direct: bool | None = ..., +) -> None: ... +def rfc822_escape(header: str) -> str: ... diff --git a/stubs/setuptools/setuptools/_distutils/version.pyi b/stubs/setuptools/setuptools/_distutils/version.pyi new file mode 100644 index 0000000..7e807d7 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/version.pyi @@ -0,0 +1,26 @@ +from _typeshed import Self +from re import Pattern + +class Version: + def __init__(self, vstring: str | None = ...) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self: Self, other: Self | str) -> bool: ... + def __le__(self: Self, other: Self | str) -> bool: ... + def __gt__(self: Self, other: Self | str) -> bool: ... + def __ge__(self: Self, other: Self | str) -> bool: ... + +class StrictVersion(Version): + version_re: Pattern[str] + version: tuple[int, int, int] + prerelease: tuple[str, int] | None + def __init__(self, vstring: str | None = ...) -> None: ... + def parse(self: Self, vstring: str) -> Self: ... + def _cmp(self: Self, other: Self | str) -> bool: ... + +class LooseVersion(Version): + component_re: Pattern[str] + vstring: str + version: tuple[str | int, ...] + def __init__(self, vstring: str | None = ...) -> None: ... + def parse(self: Self, vstring: str) -> Self: ... + def _cmp(self: Self, other: Self | str) -> bool: ... diff --git a/stubs/setuptools/setuptools/command/build_py.pyi b/stubs/setuptools/setuptools/command/build_py.pyi index 8e121cb..8e5e773 100644 --- a/stubs/setuptools/setuptools/command/build_py.pyi +++ b/stubs/setuptools/setuptools/command/build_py.pyi @@ -1,11 +1,9 @@ import distutils.command.build_py as orig from typing import Any -from setuptools.lib2to3_ex import Mixin2to3 - def make_writable(target) -> None: ... -class build_py(orig.build_py, Mixin2to3): +class build_py(orig.build_py): package_data: Any exclude_package_data: Any def finalize_options(self) -> None: ... diff --git a/stubs/setuptools/setuptools/command/develop.pyi b/stubs/setuptools/setuptools/command/develop.pyi index 8bd432b..8b099dc 100644 --- a/stubs/setuptools/setuptools/command/develop.pyi +++ b/stubs/setuptools/setuptools/command/develop.pyi @@ -9,7 +9,7 @@ class develop(namespaces.DevelopInstaller, easy_install): boolean_options: Any command_consumes_arguments: bool multi_version: bool - def run(self) -> None: ... # type: ignore + def run(self) -> None: ... # type: ignore[override] uninstall: Any egg_path: Any setup_path: Any diff --git a/stubs/setuptools/setuptools/command/easy_install.pyi b/stubs/setuptools/setuptools/command/easy_install.pyi index 11f8224..af87321 100644 --- a/stubs/setuptools/setuptools/command/easy_install.pyi +++ b/stubs/setuptools/setuptools/command/easy_install.pyi @@ -1,10 +1,9 @@ -from typing import Any, List +from collections.abc import Iterator +from typing import Any from pkg_resources import Environment from setuptools import Command, SetuptoolsDeprecationWarning -def samefile(p1, p2): ... - class easy_install(Command): description: str command_consumes_arguments: bool @@ -106,19 +105,19 @@ class RewritePthDistributions(PthDistributions): prelude: Any postlude: Any -class CommandSpec(List[str]): +class CommandSpec(list[str]): options: Any split_args: Any @classmethod - def best(cls): ... + def best(cls) -> type[CommandSpec]: ... @classmethod - def from_param(cls, param): ... + def from_param(cls, param) -> CommandSpec: ... @classmethod - def from_environment(cls): ... + def from_environment(cls) -> CommandSpec: ... @classmethod - def from_string(cls, string): ... - def install_options(self, script_text) -> None: ... - def as_header(self): ... + def from_string(cls, string: str) -> CommandSpec: ... + def install_options(self, script_text: str) -> None: ... + def as_header(self) -> str: ... class WindowsCommandSpec(CommandSpec): split_args: Any @@ -127,17 +126,17 @@ class ScriptWriter: template: Any command_spec_class: Any @classmethod - def get_script_args(cls, dist, executable: Any | None = ..., wininst: bool = ...): ... + def get_script_args(cls, dist, executable: Any | None = ..., wininst: bool = ...) -> Iterator[tuple[str, str]]: ... @classmethod - def get_script_header(cls, script_text, executable: Any | None = ..., wininst: bool = ...): ... + def get_script_header(cls, script_text, executable: Any | None = ..., wininst: bool = ...) -> str: ... @classmethod - def get_args(cls, dist, header: Any | None = ...) -> None: ... + def get_args(cls, dist, header: Any | None = ...) -> Iterator[tuple[str, str]]: ... @classmethod - def get_writer(cls, force_windows): ... + def get_writer(cls, force_windows: bool) -> type[ScriptWriter]: ... @classmethod - def best(cls): ... + def best(cls) -> type[ScriptWriter]: ... @classmethod - def get_header(cls, script_text: str = ..., executable: Any | None = ...): ... + def get_header(cls, script_text: str = ..., executable: Any | None = ...) -> str: ... class WindowsScriptWriter(ScriptWriter): command_spec_class: Any diff --git a/stubs/setuptools/setuptools/command/egg_info.pyi b/stubs/setuptools/setuptools/command/egg_info.pyi index 3be97af..4d01d62 100644 --- a/stubs/setuptools/setuptools/command/egg_info.pyi +++ b/stubs/setuptools/setuptools/command/egg_info.pyi @@ -13,7 +13,8 @@ class InfoCommon: def name(self): ... def tagged_version(self): ... def tags(self): ... - vtags: Any + @property + def vtags(self): ... class egg_info(InfoCommon, Command): description: str @@ -41,6 +42,7 @@ class egg_info(InfoCommon, Command): def check_broken_egg_info(self) -> None: ... class FileList(_FileList): + def __init__(self, warn=..., debug_print=..., ignore_egg_info_dir: bool = ...) -> None: ... def process_template_line(self, line) -> None: ... def include(self, pattern): ... def exclude(self, pattern): ... diff --git a/stubs/setuptools/setuptools/command/py36compat.pyi b/stubs/setuptools/setuptools/command/py36compat.pyi index 2143abc..eac9370 100644 --- a/stubs/setuptools/setuptools/command/py36compat.pyi +++ b/stubs/setuptools/setuptools/command/py36compat.pyi @@ -1,5 +1 @@ -import sys - -class sdist_add_defaults: - if sys.version_info < (3, 7): - def add_defaults(self) -> None: ... +class sdist_add_defaults: ... diff --git a/stubs/setuptools/setuptools/command/test.pyi b/stubs/setuptools/setuptools/command/test.pyi index c188926..2e11178 100644 --- a/stubs/setuptools/setuptools/command/test.pyi +++ b/stubs/setuptools/setuptools/command/test.pyi @@ -1,6 +1,7 @@ from _typeshed import Self +from collections.abc import Callable from types import ModuleType -from typing import Any, Callable, Generic, TypeVar, overload +from typing import Any, Generic, TypeVar, overload from unittest import TestLoader, TestSuite from setuptools import Command @@ -9,7 +10,7 @@ _T = TypeVar("_T") class ScanningLoader(TestLoader): def __init__(self) -> None: ... - def loadTestsFromModule(self, module: ModuleType, pattern: Any | None = ...) -> list[TestSuite]: ... # type: ignore + def loadTestsFromModule(self, module: ModuleType, pattern: Any | None = ...) -> list[TestSuite]: ... # type: ignore[override] class NonDataProperty(Generic[_T]): fget: Callable[..., _T] @@ -28,8 +29,8 @@ class test(Command): test_runner: Any def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... - # TODO: uncomment once https://github.com/python/mypy/pull/10884 is released - # def test_args(self): ... + @NonDataProperty + def test_args(self) -> list[str]: ... def with_project_on_sys_path(self, func) -> None: ... def project_on_sys_path(self, include_dists=...): ... @staticmethod diff --git a/stubs/setuptools/setuptools/command/upload_docs.pyi b/stubs/setuptools/setuptools/command/upload_docs.pyi index 21ef541..0660bff 100644 --- a/stubs/setuptools/setuptools/command/upload_docs.pyi +++ b/stubs/setuptools/setuptools/command/upload_docs.pyi @@ -15,4 +15,4 @@ class upload_docs(upload): def finalize_options(self) -> None: ... def create_zipfile(self, filename) -> None: ... def run(self) -> None: ... - def upload_file(self, filename) -> None: ... # type: ignore + def upload_file(self, filename) -> None: ... # type: ignore[override] diff --git a/stubs/setuptools/setuptools/config.pyi b/stubs/setuptools/setuptools/config.pyi index fb1862c..251f2b8 100644 --- a/stubs/setuptools/setuptools/config.pyi +++ b/stubs/setuptools/setuptools/config.pyi @@ -1,44 +1,2 @@ -from typing import Any - -class StaticModule: - def __init__(self, name) -> None: ... - def __getattr__(self, attr): ... - -def patch_path(path) -> None: ... def read_configuration(filepath, find_others: bool = ..., ignore_option_errors: bool = ...): ... -def configuration_to_dict(handlers): ... def parse_configuration(distribution, command_options, ignore_option_errors: bool = ...): ... - -class ConfigHandler: - section_prefix: Any - aliases: Any - ignore_option_errors: Any - target_obj: Any - sections: Any - set_options: Any - def __init__(self, target_obj, options, ignore_option_errors: bool = ...) -> None: ... - @property - def parsers(self) -> None: ... - def __setitem__(self, option_name, value) -> None: ... - def parse_section(self, section_options) -> None: ... - def parse(self) -> None: ... - -class ConfigMetadataHandler(ConfigHandler): - section_prefix: str - aliases: Any - strict_mode: bool - package_dir: Any - def __init__(self, target_obj, options, ignore_option_errors: bool = ..., package_dir: Any | None = ...) -> None: ... - @property - def parsers(self): ... - -class ConfigOptionsHandler(ConfigHandler): - section_prefix: str - @property - def parsers(self): ... - def parse_section_packages__find(self, section_options): ... - def parse_section_entry_points(self, section_options) -> None: ... - def parse_section_package_data(self, section_options) -> None: ... - def parse_section_exclude_package_data(self, section_options) -> None: ... - def parse_section_extras_require(self, section_options) -> None: ... - def parse_section_data_files(self, section_options) -> None: ... diff --git a/stubs/setuptools/setuptools/dist.pyi b/stubs/setuptools/setuptools/dist.pyi index a53f22b..b47795f 100644 --- a/stubs/setuptools/setuptools/dist.pyi +++ b/stubs/setuptools/setuptools/dist.pyi @@ -1,19 +1,19 @@ +from _typeshed import Incomplete from distutils.core import Distribution as _Distribution -from typing import Any from setuptools import SetuptoolsDeprecationWarning class Distribution(_Distribution): def patch_missing_pkg_info(self, attrs) -> None: ... - package_data: Any - dist_files: Any - src_root: Any - dependency_links: Any - setup_requires: Any - def __init__(self, attrs: Any | None = ...) -> None: ... + package_data: Incomplete + dist_files: Incomplete + src_root: Incomplete + dependency_links: Incomplete + setup_requires: Incomplete + def __init__(self, attrs: Incomplete | None = ...) -> None: ... def warn_dash_deprecation(self, opt, section): ... def make_option_lowercase(self, opt, section): ... - def parse_config_files(self, filenames: Any | None = ..., ignore_option_errors: bool = ...) -> None: ... + def parse_config_files(self, filenames: Incomplete | None = ..., ignore_option_errors: bool = ...) -> None: ... def fetch_build_eggs(self, requires): ... def finalize_options(self): ... def get_egg_cache_dir(self): ... @@ -22,9 +22,9 @@ class Distribution(_Distribution): def print_commands(self): ... def get_command_list(self): ... def include(self, **attrs) -> None: ... - packages: Any - py_modules: Any - ext_modules: Any + packages: Incomplete + py_modules: Incomplete + ext_modules: Incomplete def exclude_package(self, package) -> None: ... def has_contents_for(self, package): ... def exclude(self, **attrs) -> None: ... diff --git a/stubs/setuptools/setuptools/lib2to3_ex.pyi b/stubs/setuptools/setuptools/lib2to3_ex.pyi deleted file mode 100644 index a7cc306..0000000 --- a/stubs/setuptools/setuptools/lib2to3_ex.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from distutils.util import Mixin2to3 as _Mixin2to3 -from lib2to3.refactor import RefactoringTool - -class DistutilsRefactoringTool(RefactoringTool): - def log_error(self, msg, *args, **kw) -> None: ... # type: ignore - def log_message(self, msg, *args) -> None: ... - def log_debug(self, msg, *args) -> None: ... - -class Mixin2to3(_Mixin2to3): - def run_2to3(self, files, doctests: bool = ...) -> None: ... diff --git a/stubs/setuptools/setuptools/msvc.pyi b/stubs/setuptools/setuptools/msvc.pyi index 0bf9ce7..9313c69 100644 --- a/stubs/setuptools/setuptools/msvc.pyi +++ b/stubs/setuptools/setuptools/msvc.pyi @@ -6,9 +6,6 @@ class winreg: HKEY_LOCAL_MACHINE: Any HKEY_CLASSES_ROOT: Any -def msvc9_find_vcvarsall(version): ... -def msvc9_query_vcvarsall(ver, arch: str = ..., *args, **kwargs): ... - PLAT_SPEC_TO_RUNTIME: Any def msvc14_get_vc_env(plat_spec): ... diff --git a/stubs/setuptools/setuptools/sandbox.pyi b/stubs/setuptools/setuptools/sandbox.pyi index 293d112..994ff29 100644 --- a/stubs/setuptools/setuptools/sandbox.pyi +++ b/stubs/setuptools/setuptools/sandbox.pyi @@ -13,7 +13,6 @@ class ExceptionSaver: def run_setup(setup_script, args): ... class AbstractSandbox: - def __init__(self) -> None: ... def __enter__(self) -> None: ... def __exit__(self, exc_type, exc_value, traceback) -> None: ... def run(self, func): ... diff --git a/stubs/simplejson/METADATA.toml b/stubs/simplejson/METADATA.toml index 7a888df..b4d0bc7 100644 --- a/stubs/simplejson/METADATA.toml +++ b/stubs/simplejson/METADATA.toml @@ -1,2 +1 @@ -version = "3.17" -python2 = true +version = "3.17.*" diff --git a/stubs/simplejson/simplejson/__init__.pyi b/stubs/simplejson/simplejson/__init__.pyi index 798a770..5cfcc6d 100644 --- a/stubs/simplejson/simplejson/__init__.pyi +++ b/stubs/simplejson/simplejson/__init__.pyi @@ -1,11 +1,12 @@ -from typing import IO, Any, Text, Union +from typing import IO, Any +from typing_extensions import TypeAlias from simplejson.decoder import JSONDecoder as JSONDecoder from simplejson.encoder import JSONEncoder as JSONEncoder, JSONEncoderForHTML as JSONEncoderForHTML from simplejson.raw_json import RawJSON as RawJSON from simplejson.scanner import JSONDecodeError as JSONDecodeError -_LoadsString = Union[Text, bytes, bytearray] +_LoadsString: TypeAlias = str | bytes | bytearray def dumps(obj: Any, *args: Any, **kwds: Any) -> str: ... def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ... diff --git a/stubs/simplejson/simplejson/decoder.pyi b/stubs/simplejson/simplejson/decoder.pyi index 0d726af..d2b1ac1 100644 --- a/stubs/simplejson/simplejson/decoder.pyi +++ b/stubs/simplejson/simplejson/decoder.pyi @@ -1,6 +1,7 @@ -from typing import Any, Match +from re import Match +from typing import Any -class JSONDecoder(object): +class JSONDecoder: def __init__(self, **kwargs: Any) -> None: ... - def decode(self, s: str, _w: Match[str], _PY3: bool): ... - def raw_decode(self, s: str, idx: int, _w: Match[str], _PY3: bool): ... + def decode(self, s: str, _w: Match[str], _PY3: bool) -> Any: ... + def raw_decode(self, s: str, idx: int, _w: Match[str], _PY3: bool) -> tuple[Any, int]: ... diff --git a/stubs/simplejson/simplejson/encoder.pyi b/stubs/simplejson/simplejson/encoder.pyi index 9a3c5e4..004545b 100644 --- a/stubs/simplejson/simplejson/encoder.pyi +++ b/stubs/simplejson/simplejson/encoder.pyi @@ -1,9 +1,10 @@ -from typing import Any +from collections.abc import Iterator +from typing import Any, NoReturn -class JSONEncoder(object): +class JSONEncoder: def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def encode(self, o: Any): ... - def default(self, o: Any): ... - def iterencode(self, o: Any, _one_shot: bool): ... + def encode(self, o: Any) -> str: ... + def default(self, o: Any) -> NoReturn: ... + def iterencode(self, o: Any, _one_shot: bool) -> Iterator[str]: ... class JSONEncoderForHTML(JSONEncoder): ... diff --git a/stubs/simplejson/simplejson/errors.pyi b/stubs/simplejson/simplejson/errors.pyi new file mode 100644 index 0000000..10cff3f --- /dev/null +++ b/stubs/simplejson/simplejson/errors.pyi @@ -0,0 +1,16 @@ +__all__ = ["JSONDecodeError"] + +def linecol(doc: str, pos: int) -> tuple[int, int]: ... +def errmsg(msg: str, doc: str, pos: int, end: int | None = ...) -> str: ... + +class JSONDecodeError(ValueError): + msg: str + doc: str + pos: int + end: int | None + lineno: int + colno: int + endlineno: int | None + endcolno: int | None + def __init__(self, msg: str, doc: str, pos: int, end: int | None = ...) -> None: ... + def __reduce__(self) -> tuple[JSONDecodeError, tuple[str, str, int, int | None]]: ... diff --git a/stubs/simplejson/simplejson/raw_json.pyi b/stubs/simplejson/simplejson/raw_json.pyi index 25976ea..bacd755 100644 --- a/stubs/simplejson/simplejson/raw_json.pyi +++ b/stubs/simplejson/simplejson/raw_json.pyi @@ -1,3 +1,3 @@ -class RawJSON(object): +class RawJSON: encoded_json: str def __init__(self, encoded_json: str) -> None: ... diff --git a/stubs/singledispatch/@tests/stubtest_allowlist.txt b/stubs/singledispatch/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..d455fe6 --- /dev/null +++ b/stubs/singledispatch/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +singledispatch.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable diff --git a/stubs/singledispatch/METADATA.toml b/stubs/singledispatch/METADATA.toml index 9509ba1..1cc4540 100644 --- a/stubs/singledispatch/METADATA.toml +++ b/stubs/singledispatch/METADATA.toml @@ -1,2 +1 @@ -version = "3.7" -python2 = true +version = "3.7.*" diff --git a/stubs/singledispatch/singledispatch.pyi b/stubs/singledispatch/singledispatch.pyi index f264047..59d201d 100644 --- a/stubs/singledispatch/singledispatch.pyi +++ b/stubs/singledispatch/singledispatch.pyi @@ -1,4 +1,5 @@ -from typing import Any, Callable, Generic, Mapping, TypeVar, overload +from collections.abc import Callable, Mapping +from typing import Any, Generic, TypeVar, overload _T = TypeVar("_T") @@ -13,3 +14,15 @@ class _SingleDispatchCallable(Generic[_T]): def __call__(self, *args: Any, **kwargs: Any) -> _T: ... def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ... + +class singledispatchmethod(Generic[_T]): + dispatcher: _SingleDispatchCallable[_T] + func: Callable[..., _T] + def __init__(self, func: Callable[..., _T]) -> None: ... + @overload + 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[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... + def __call__(self, *args: Any, **kwargs: Any) -> _T: ... diff --git a/stubs/six/@python2/six/__init__.pyi b/stubs/six/@python2/six/__init__.pyi deleted file mode 100644 index 5c44810..0000000 --- a/stubs/six/@python2/six/__init__.pyi +++ /dev/null @@ -1,121 +0,0 @@ -from __future__ import print_function - -import types -import typing -import unittest -from __builtin__ import unichr as unichr -from functools import wraps as wraps -from StringIO import StringIO as StringIO -from typing import ( - Any, - AnyStr, - Callable, - ItemsView, - Iterable, - KeysView, - Mapping, - NoReturn, - Pattern, - Text, - Tuple, - Type, - TypeVar, - ValuesView, - overload, -) -from typing_extensions import Literal - -from . import moves - -BytesIO = StringIO - -_T = TypeVar("_T") -_K = TypeVar("_K") -_V = TypeVar("_V") - -__author__: str -__version__: str - -PY2: Literal[True] -PY3: Literal[False] -PY34: Literal[False] - -string_types: tuple[Type[str], Type[unicode]] -integer_types: tuple[Type[int], Type[long]] -class_types: tuple[Type[Type[Any]], Type[types.ClassType]] -text_type: Type[unicode] -binary_type: Type[str] - -MAXSIZE: int - -def advance_iterator(it: typing.Iterator[_T]) -> _T: ... - -next = advance_iterator - -def callable(obj: object) -> bool: ... -def get_unbound_function(unbound: types.MethodType) -> types.FunctionType: ... -def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ... -def create_unbound_method(func: types.FunctionType, cls: type | types.ClassType) -> types.MethodType: ... - -class Iterator: - def next(self) -> Any: ... - -def get_method_function(meth: types.MethodType) -> types.FunctionType: ... -def get_method_self(meth: types.MethodType) -> object | None: ... -def get_function_closure(fun: types.FunctionType) -> Tuple[types._Cell, ...] | None: ... -def get_function_code(fun: types.FunctionType) -> types.CodeType: ... -def get_function_defaults(fun: types.FunctionType) -> Tuple[Any, ...] | None: ... -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 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 viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ... -def b(s: str) -> str: ... -def u(s: str) -> unicode: ... - -int2byte = chr - -def byte2int(bs: str) -> int: ... -def indexbytes(buf: str, i: int) -> int: ... -def iterbytes(buf: str) -> typing.Iterator[int]: ... -def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = ...) -> None: ... -@overload -def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ... -@overload -def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... -def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str = ...) -> None: ... -def reraise(tp: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ... -def exec_(_code_: unicode | types.CodeType, _globs_: dict[str, Any] = ..., _locs_: dict[str, Any] = ...): ... -def raise_from(value: BaseException | Type[BaseException], from_value: BaseException | None) -> NoReturn: ... - -print_ = print - -def with_metaclass(meta: type, *bases: type) -> type: ... -def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ... -def ensure_binary(s: bytes | Text, encoding: str = ..., errors: str = ...) -> bytes: ... -def ensure_str(s: bytes | Text, encoding: str = ..., errors: str = ...) -> str: ... -def ensure_text(s: bytes | Text, encoding: str = ..., errors: str = ...) -> Text: ... -def python_2_unicode_compatible(klass: _T) -> _T: ... - -class _LazyDescr(object): - name: str - def __init__(self, name: str) -> None: ... - def __get__(self, obj: object | None, type: Type[Any] | None = ...) -> Any: ... - -class MovedModule(_LazyDescr): - mod: str - def __init__(self, name: str, old: str, new: str | None = ...) -> None: ... - def __getattr__(self, attr: str) -> Any: ... - -class MovedAttribute(_LazyDescr): - mod: str - attr: str - def __init__(self, name: str, old_mod: str, new_mod: str, old_attr: str | None = ..., new_attr: str | None = ...) -> None: ... - -def add_move(move: MovedModule | MovedAttribute) -> None: ... -def remove_move(name: str) -> None: ... diff --git a/stubs/six/@python2/six/moves/BaseHTTPServer.pyi b/stubs/six/@python2/six/moves/BaseHTTPServer.pyi deleted file mode 100644 index 16f7a9d..0000000 --- a/stubs/six/@python2/six/moves/BaseHTTPServer.pyi +++ /dev/null @@ -1 +0,0 @@ -from BaseHTTPServer import * diff --git a/stubs/six/@python2/six/moves/CGIHTTPServer.pyi b/stubs/six/@python2/six/moves/CGIHTTPServer.pyi deleted file mode 100644 index b39390c..0000000 --- a/stubs/six/@python2/six/moves/CGIHTTPServer.pyi +++ /dev/null @@ -1 +0,0 @@ -from CGIHTTPServer import * diff --git a/stubs/six/@python2/six/moves/SimpleHTTPServer.pyi b/stubs/six/@python2/six/moves/SimpleHTTPServer.pyi deleted file mode 100644 index 97cfe77..0000000 --- a/stubs/six/@python2/six/moves/SimpleHTTPServer.pyi +++ /dev/null @@ -1 +0,0 @@ -from SimpleHTTPServer import * diff --git a/stubs/six/@python2/six/moves/__init__.pyi b/stubs/six/@python2/six/moves/__init__.pyi deleted file mode 100644 index 5f34153..0000000 --- a/stubs/six/@python2/six/moves/__init__.pyi +++ /dev/null @@ -1,78 +0,0 @@ -# Stubs for six.moves -# -# Note: Commented out items means they weren't implemented at the time. -# Uncomment them when the modules have been added to the typeshed. -import __builtin__ -import itertools -import os -import pipes -from __builtin__ import intern as intern, reduce as reduce, xrange as xrange -from cStringIO import StringIO as _cStringIO -from StringIO import StringIO as StringIO -from UserDict import UserDict as UserDict -from UserList import UserList as UserList -from UserString import UserString as UserString - -# import Tkinter as tkinter -# import Dialog as tkinter_dialog -# import FileDialog as tkinter_filedialog -# import ScrolledText as tkinter_scrolledtext -# import SimpleDialog as tkinter_simpledialog -# import Tix as tkinter_tix -# import ttk as tkinter_ttk -# import Tkconstants as tkinter_constants -# import Tkdnd as tkinter_dnd -# import tkColorChooser as tkinter_colorchooser -# import tkCommonDialog as tkinter_commondialog -# import tkFileDialog as tkinter_tkfiledialog -# import tkFont as tkinter_font -# import tkMessageBox as tkinter_messagebox -# import tkSimpleDialog as tkinter_tksimpledialog -# import email.MIMEBase as email_mime_base -# import email.MIMEMultipart as email_mime_multipart -# import email.MIMENonMultipart as email_mime_nonmultipart -# import copy_reg as copyreg -# import gdbm as dbm_gnu -from . import ( - BaseHTTPServer, - CGIHTTPServer, - SimpleHTTPServer, - _dummy_thread, - _thread, - configparser, - cPickle, - email_mime_text, - html_entities, - html_parser, - http_client, - http_cookiejar, - http_cookies, - queue, - reprlib, - socketserver, - urllib, - urllib_error, - urllib_parse, - urllib_robotparser, - xmlrpc_client, -) - -# import SimpleXMLRPCServer as xmlrpc_server - -builtins = __builtin__ -input = __builtin__.raw_input -reload_module = __builtin__.reload -range = __builtin__.xrange - -cStringIO = _cStringIO - -filter = itertools.ifilter -filterfalse = itertools.ifilterfalse -map = itertools.imap -zip = itertools.izip -zip_longest = itertools.izip_longest - -getcwdb = os.getcwd -getcwd = os.getcwdu - -shlex_quote = pipes.quote diff --git a/stubs/six/@python2/six/moves/_dummy_thread.pyi b/stubs/six/@python2/six/moves/_dummy_thread.pyi deleted file mode 100644 index 3efe922..0000000 --- a/stubs/six/@python2/six/moves/_dummy_thread.pyi +++ /dev/null @@ -1 +0,0 @@ -from dummy_thread import * diff --git a/stubs/six/@python2/six/moves/_thread.pyi b/stubs/six/@python2/six/moves/_thread.pyi deleted file mode 100644 index b27f4c7..0000000 --- a/stubs/six/@python2/six/moves/_thread.pyi +++ /dev/null @@ -1 +0,0 @@ -from thread import * diff --git a/stubs/six/@python2/six/moves/cPickle.pyi b/stubs/six/@python2/six/moves/cPickle.pyi deleted file mode 100644 index ca829a7..0000000 --- a/stubs/six/@python2/six/moves/cPickle.pyi +++ /dev/null @@ -1 +0,0 @@ -from cPickle import * diff --git a/stubs/six/@python2/six/moves/collections_abc.pyi b/stubs/six/@python2/six/moves/collections_abc.pyi deleted file mode 100644 index 9400561..0000000 --- a/stubs/six/@python2/six/moves/collections_abc.pyi +++ /dev/null @@ -1 +0,0 @@ -from collections import * diff --git a/stubs/six/@python2/six/moves/configparser.pyi b/stubs/six/@python2/six/moves/configparser.pyi deleted file mode 100644 index b2da53a..0000000 --- a/stubs/six/@python2/six/moves/configparser.pyi +++ /dev/null @@ -1 +0,0 @@ -from ConfigParser import * diff --git a/stubs/six/@python2/six/moves/email_mime_base.pyi b/stubs/six/@python2/six/moves/email_mime_base.pyi deleted file mode 100644 index 4df155c..0000000 --- a/stubs/six/@python2/six/moves/email_mime_base.pyi +++ /dev/null @@ -1 +0,0 @@ -from email.mime.base import * diff --git a/stubs/six/@python2/six/moves/email_mime_multipart.pyi b/stubs/six/@python2/six/moves/email_mime_multipart.pyi deleted file mode 100644 index 4f31241..0000000 --- a/stubs/six/@python2/six/moves/email_mime_multipart.pyi +++ /dev/null @@ -1 +0,0 @@ -from email.mime.multipart import * diff --git a/stubs/six/@python2/six/moves/email_mime_nonmultipart.pyi b/stubs/six/@python2/six/moves/email_mime_nonmultipart.pyi deleted file mode 100644 index c15c8c0..0000000 --- a/stubs/six/@python2/six/moves/email_mime_nonmultipart.pyi +++ /dev/null @@ -1 +0,0 @@ -from email.mime.nonmultipart import * diff --git a/stubs/six/@python2/six/moves/email_mime_text.pyi b/stubs/six/@python2/six/moves/email_mime_text.pyi deleted file mode 100644 index 214bf1e..0000000 --- a/stubs/six/@python2/six/moves/email_mime_text.pyi +++ /dev/null @@ -1 +0,0 @@ -from email.MIMEText import * diff --git a/stubs/six/@python2/six/moves/html_entities.pyi b/stubs/six/@python2/six/moves/html_entities.pyi deleted file mode 100644 index 9e15d01..0000000 --- a/stubs/six/@python2/six/moves/html_entities.pyi +++ /dev/null @@ -1 +0,0 @@ -from htmlentitydefs import * diff --git a/stubs/six/@python2/six/moves/html_parser.pyi b/stubs/six/@python2/six/moves/html_parser.pyi deleted file mode 100644 index 984cee6..0000000 --- a/stubs/six/@python2/six/moves/html_parser.pyi +++ /dev/null @@ -1 +0,0 @@ -from HTMLParser import * diff --git a/stubs/six/@python2/six/moves/http_client.pyi b/stubs/six/@python2/six/moves/http_client.pyi deleted file mode 100644 index 24ef0b4..0000000 --- a/stubs/six/@python2/six/moves/http_client.pyi +++ /dev/null @@ -1 +0,0 @@ -from httplib import * diff --git a/stubs/six/@python2/six/moves/http_cookiejar.pyi b/stubs/six/@python2/six/moves/http_cookiejar.pyi deleted file mode 100644 index 1357ad3..0000000 --- a/stubs/six/@python2/six/moves/http_cookiejar.pyi +++ /dev/null @@ -1 +0,0 @@ -from cookielib import * diff --git a/stubs/six/@python2/six/moves/http_cookies.pyi b/stubs/six/@python2/six/moves/http_cookies.pyi deleted file mode 100644 index 5115c0d..0000000 --- a/stubs/six/@python2/six/moves/http_cookies.pyi +++ /dev/null @@ -1 +0,0 @@ -from Cookie import * diff --git a/stubs/six/@python2/six/moves/queue.pyi b/stubs/six/@python2/six/moves/queue.pyi deleted file mode 100644 index 7ce3ccb..0000000 --- a/stubs/six/@python2/six/moves/queue.pyi +++ /dev/null @@ -1 +0,0 @@ -from Queue import * diff --git a/stubs/six/@python2/six/moves/reprlib.pyi b/stubs/six/@python2/six/moves/reprlib.pyi deleted file mode 100644 index 40ad103..0000000 --- a/stubs/six/@python2/six/moves/reprlib.pyi +++ /dev/null @@ -1 +0,0 @@ -from repr import * diff --git a/stubs/six/@python2/six/moves/socketserver.pyi b/stubs/six/@python2/six/moves/socketserver.pyi deleted file mode 100644 index c80a6e7..0000000 --- a/stubs/six/@python2/six/moves/socketserver.pyi +++ /dev/null @@ -1 +0,0 @@ -from SocketServer import * diff --git a/stubs/six/@python2/six/moves/urllib/__init__.pyi b/stubs/six/@python2/six/moves/urllib/__init__.pyi deleted file mode 100644 index d08209c..0000000 --- a/stubs/six/@python2/six/moves/urllib/__init__.pyi +++ /dev/null @@ -1,5 +0,0 @@ -import six.moves.urllib.error as error -import six.moves.urllib.parse as parse -import six.moves.urllib.request as request -import six.moves.urllib.response as response -import six.moves.urllib.robotparser as robotparser diff --git a/stubs/six/@python2/six/moves/urllib/error.pyi b/stubs/six/@python2/six/moves/urllib/error.pyi deleted file mode 100644 index 0c6c1c3..0000000 --- a/stubs/six/@python2/six/moves/urllib/error.pyi +++ /dev/null @@ -1,2 +0,0 @@ -from urllib import ContentTooShortError as ContentTooShortError -from urllib2 import HTTPError as HTTPError, URLError as URLError diff --git a/stubs/six/@python2/six/moves/urllib/parse.pyi b/stubs/six/@python2/six/moves/urllib/parse.pyi deleted file mode 100644 index 569b073..0000000 --- a/stubs/six/@python2/six/moves/urllib/parse.pyi +++ /dev/null @@ -1,29 +0,0 @@ -from urllib import ( - quote as quote, - quote_plus as quote_plus, - splitquery as splitquery, - splittag as splittag, - splituser as splituser, - unquote as unquote, - unquote_plus as unquote_plus, - urlencode as urlencode, -) -from urlparse import ( - ParseResult as ParseResult, - SplitResult as SplitResult, - parse_qs as parse_qs, - parse_qsl as parse_qsl, - urldefrag as urldefrag, - urljoin as urljoin, - urlparse as urlparse, - urlsplit as urlsplit, - urlunparse as urlunparse, - urlunsplit as urlunsplit, - uses_fragment as uses_fragment, - uses_netloc as uses_netloc, - uses_params as uses_params, - uses_query as uses_query, - uses_relative as uses_relative, -) - -unquote_to_bytes = unquote diff --git a/stubs/six/@python2/six/moves/urllib/request.pyi b/stubs/six/@python2/six/moves/urllib/request.pyi deleted file mode 100644 index 549bd40..0000000 --- a/stubs/six/@python2/six/moves/urllib/request.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from urllib import ( - FancyURLopener as FancyURLopener, - URLopener as URLopener, - getproxies as getproxies, - pathname2url as pathname2url, - proxy_bypass as proxy_bypass, - url2pathname as url2pathname, - urlcleanup as urlcleanup, - urlretrieve as urlretrieve, -) -from urllib2 import ( - AbstractBasicAuthHandler as AbstractBasicAuthHandler, - AbstractDigestAuthHandler as AbstractDigestAuthHandler, - BaseHandler as BaseHandler, - CacheFTPHandler as CacheFTPHandler, - FileHandler as FileHandler, - FTPHandler as FTPHandler, - HTTPBasicAuthHandler as HTTPBasicAuthHandler, - HTTPCookieProcessor as HTTPCookieProcessor, - HTTPDefaultErrorHandler as HTTPDefaultErrorHandler, - HTTPDigestAuthHandler as HTTPDigestAuthHandler, - HTTPErrorProcessor as HTTPErrorProcessor, - HTTPHandler as HTTPHandler, - HTTPPasswordMgr as HTTPPasswordMgr, - HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm, - HTTPRedirectHandler as HTTPRedirectHandler, - HTTPSHandler as HTTPSHandler, - OpenerDirector as OpenerDirector, - ProxyBasicAuthHandler as ProxyBasicAuthHandler, - ProxyDigestAuthHandler as ProxyDigestAuthHandler, - ProxyHandler as ProxyHandler, - Request as Request, - UnknownHandler as UnknownHandler, - build_opener as build_opener, - install_opener as install_opener, - parse_http_list as parse_http_list, - parse_keqv_list as parse_keqv_list, - urlopen as urlopen, -) diff --git a/stubs/six/@python2/six/moves/urllib/response.pyi b/stubs/six/@python2/six/moves/urllib/response.pyi deleted file mode 100644 index b560da8..0000000 --- a/stubs/six/@python2/six/moves/urllib/response.pyi +++ /dev/null @@ -1 +0,0 @@ -from urllib import addbase as addbase, addclosehook as addclosehook, addinfo as addinfo, addinfourl as addinfourl diff --git a/stubs/six/@python2/six/moves/urllib/robotparser.pyi b/stubs/six/@python2/six/moves/urllib/robotparser.pyi deleted file mode 100644 index 11eef50..0000000 --- a/stubs/six/@python2/six/moves/urllib/robotparser.pyi +++ /dev/null @@ -1 +0,0 @@ -from robotparser import RobotFileParser as RobotFileParser diff --git a/stubs/six/@python2/six/moves/urllib_error.pyi b/stubs/six/@python2/six/moves/urllib_error.pyi deleted file mode 100644 index b560812..0000000 --- a/stubs/six/@python2/six/moves/urllib_error.pyi +++ /dev/null @@ -1 +0,0 @@ -from .urllib.error import * diff --git a/stubs/six/@python2/six/moves/urllib_parse.pyi b/stubs/six/@python2/six/moves/urllib_parse.pyi deleted file mode 100644 index bdb4d1c..0000000 --- a/stubs/six/@python2/six/moves/urllib_parse.pyi +++ /dev/null @@ -1 +0,0 @@ -from .urllib.parse import * diff --git a/stubs/six/@python2/six/moves/urllib_request.pyi b/stubs/six/@python2/six/moves/urllib_request.pyi deleted file mode 100644 index dc03dce..0000000 --- a/stubs/six/@python2/six/moves/urllib_request.pyi +++ /dev/null @@ -1 +0,0 @@ -from .urllib.request import * diff --git a/stubs/six/@python2/six/moves/urllib_response.pyi b/stubs/six/@python2/six/moves/urllib_response.pyi deleted file mode 100644 index bbee522..0000000 --- a/stubs/six/@python2/six/moves/urllib_response.pyi +++ /dev/null @@ -1 +0,0 @@ -from .urllib.response import * diff --git a/stubs/six/@python2/six/moves/urllib_robotparser.pyi b/stubs/six/@python2/six/moves/urllib_robotparser.pyi deleted file mode 100644 index ddb63b7..0000000 --- a/stubs/six/@python2/six/moves/urllib_robotparser.pyi +++ /dev/null @@ -1 +0,0 @@ -from robotparser import * diff --git a/stubs/six/@python2/six/moves/xmlrpc_client.pyi b/stubs/six/@python2/six/moves/xmlrpc_client.pyi deleted file mode 100644 index 1b3bd74..0000000 --- a/stubs/six/@python2/six/moves/xmlrpc_client.pyi +++ /dev/null @@ -1 +0,0 @@ -from xmlrpclib import * diff --git a/stubs/six/@tests/stubtest_allowlist.txt b/stubs/six/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..16cd857 --- /dev/null +++ b/stubs/six/@tests/stubtest_allowlist.txt @@ -0,0 +1,24 @@ +# Problems inherited from the standard library +six.BytesIO.readlines +six.BytesIO.seek +six.StringIO.seek +six.StringIO.truncate +six.create_bound_method.__closure__ +six.create_bound_method.__defaults__ +six.moves.* + +# Implemented using "operator" functions in the implementation +six.byte2int +six.indexbytes +six.get_function_closure +six.get_function_code +six.get_function_defaults +six.get_function_globals +six.get_method_function +six.get_method_self +six.viewitems +six.viewkeys +six.viewvalues + +# Unclear problems +six.callable diff --git a/stubs/six/METADATA.toml b/stubs/six/METADATA.toml index ff19b61..7aac804 100644 --- a/stubs/six/METADATA.toml +++ b/stubs/six/METADATA.toml @@ -1,2 +1 @@ -version = "1.16" -python2 = true +version = "1.16.*" diff --git a/stubs/six/six/__init__.pyi b/stubs/six/six/__init__.pyi index 1f36799..68454f6 100644 --- a/stubs/six/six/__init__.pyi +++ b/stubs/six/six/__init__.pyi @@ -1,12 +1,14 @@ -from __future__ import print_function - +import builtins import types import unittest +from _typeshed import IdentityFunction from builtins import next as next from collections.abc import Callable, ItemsView, Iterable, Iterator as _Iterator, KeysView, Mapping, ValuesView from functools import wraps as wraps +from importlib.util import spec_from_loader as spec_from_loader from io import BytesIO as BytesIO, StringIO as StringIO -from typing import Any, AnyStr, NoReturn, Pattern, Tuple, Type, TypeVar, overload +from re import Pattern +from typing import Any, AnyStr, NoReturn, TypeVar, overload from typing_extensions import Literal from . import moves as moves @@ -22,26 +24,29 @@ PY2: Literal[False] PY3: Literal[True] PY34: Literal[True] -string_types: tuple[Type[str]] -integer_types: tuple[Type[int]] -class_types: tuple[Type[Type[Any]]] +string_types: tuple[type[str]] +integer_types: tuple[type[int]] +class_types: tuple[type[type]] text_type = str binary_type = bytes MAXSIZE: int -def callable(obj: object) -> bool: ... +callable = builtins.callable + def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ... -def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ... + +create_bound_method = types.MethodType + def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ... Iterator = object def get_method_function(meth: types.MethodType) -> types.FunctionType: ... def get_method_self(meth: types.MethodType) -> object | None: ... -def get_function_closure(fun: types.FunctionType) -> Tuple[types._Cell, ...] | None: ... +def get_function_closure(fun: types.FunctionType) -> tuple[types._Cell, ...] | None: ... def get_function_code(fun: types.FunctionType) -> types.CodeType: ... -def get_function_defaults(fun: types.FunctionType) -> Tuple[Any, ...] | None: ... +def get_function_defaults(fun: types.FunctionType) -> tuple[Any, ...] | None: ... def get_function_globals(fun: types.FunctionType) -> dict[str, Any]: ... def iterkeys(d: Mapping[_K, Any]) -> _Iterator[_K]: ... def itervalues(d: Mapping[Any, _V]) -> _Iterator[_V]: ... @@ -65,20 +70,20 @@ def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Itera @overload def assertRaisesRegex(self: unittest.TestCase, msg: str | None = ...) -> Any: ... @overload -def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... +def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., object], *args: Any, **kwargs: Any) -> Any: ... def assertRegex( self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str | None = ... ) -> None: ... exec_ = exec -def reraise(tp: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ... -def raise_from(value: BaseException | Type[BaseException], from_value: BaseException | None) -> NoReturn: ... +def reraise(tp: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ... +def raise_from(value: BaseException | type[BaseException], from_value: BaseException | None) -> NoReturn: ... print_ = print def with_metaclass(meta: type, *bases: type) -> type: ... -def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ... +def add_metaclass(metaclass: type) -> IdentityFunction: ... def ensure_binary(s: bytes | str, encoding: str = ..., errors: str = ...) -> bytes: ... def ensure_str(s: bytes | str, encoding: str = ..., errors: str = ...) -> str: ... def ensure_text(s: bytes | str, encoding: str = ..., errors: str = ...) -> str: ... @@ -87,7 +92,7 @@ def python_2_unicode_compatible(klass: _T) -> _T: ... class _LazyDescr: name: str def __init__(self, name: str) -> None: ... - def __get__(self, obj: object | None, type: Type[Any] | None = ...) -> Any: ... + def __get__(self, obj: object | None, tp: object) -> Any: ... class MovedModule(_LazyDescr): mod: str diff --git a/stubs/six/six/moves/__init__.pyi b/stubs/six/six/moves/__init__.pyi index 3455676..ae64ae6 100644 --- a/stubs/six/six/moves/__init__.pyi +++ b/stubs/six/six/moves/__init__.pyi @@ -20,7 +20,6 @@ from sys import intern as intern # import tkinter.scrolledtext as tkinter_scrolledtext # import tkinter.simpledialog as tkinter_simpledialog # import tkinter.tix as tkinter_tix -# import copyreg as copyreg # import dbm.gnu as dbm_gnu from . import ( BaseHTTPServer as BaseHTTPServer, @@ -30,6 +29,7 @@ from . import ( _thread as _thread, builtins as builtins, configparser as configparser, + copyreg as copyreg, cPickle as cPickle, email_mime_base as email_mime_base, email_mime_multipart as email_mime_multipart, diff --git a/stubs/six/six/moves/_dummy_thread.pyi b/stubs/six/six/moves/_dummy_thread.pyi index 2487961..410232d 100644 --- a/stubs/six/six/moves/_dummy_thread.pyi +++ b/stubs/six/six/moves/_dummy_thread.pyi @@ -1 +1,6 @@ -from _dummy_thread import * +import sys + +if sys.version_info >= (3, 9): + from _thread import * +else: + from _dummy_thread import * diff --git a/stubs/six/six/moves/configparser.pyi b/stubs/six/six/moves/configparser.pyi index 044861c..3367dbd 100644 --- a/stubs/six/six/moves/configparser.pyi +++ b/stubs/six/six/moves/configparser.pyi @@ -1 +1,3 @@ +# Error is not included in __all__ so export it explicitly from configparser import * +from configparser import Error as Error diff --git a/stubs/six/six/moves/copyreg.pyi b/stubs/six/six/moves/copyreg.pyi new file mode 100644 index 0000000..1848b74 --- /dev/null +++ b/stubs/six/six/moves/copyreg.pyi @@ -0,0 +1 @@ +from copyreg import * diff --git a/stubs/six/six/moves/http_client.pyi b/stubs/six/six/moves/http_client.pyi index 36d29b9..ecfce42 100644 --- a/stubs/six/six/moves/http_client.pyi +++ b/stubs/six/six/moves/http_client.pyi @@ -1 +1,61 @@ +# Many definitions are not included in http.client.__all__ from http.client import * +from http.client import ( + ACCEPTED as ACCEPTED, + BAD_GATEWAY as BAD_GATEWAY, + BAD_REQUEST as BAD_REQUEST, + CONFLICT as CONFLICT, + CONTINUE as CONTINUE, + CREATED as CREATED, + EXPECTATION_FAILED as EXPECTATION_FAILED, + FAILED_DEPENDENCY as FAILED_DEPENDENCY, + FORBIDDEN as FORBIDDEN, + FOUND as FOUND, + GATEWAY_TIMEOUT as GATEWAY_TIMEOUT, + GONE as GONE, + HTTP_PORT as HTTP_PORT, + HTTP_VERSION_NOT_SUPPORTED as HTTP_VERSION_NOT_SUPPORTED, + HTTPS_PORT as HTTPS_PORT, + IM_USED as IM_USED, + INSUFFICIENT_STORAGE as INSUFFICIENT_STORAGE, + INTERNAL_SERVER_ERROR as INTERNAL_SERVER_ERROR, + LENGTH_REQUIRED as LENGTH_REQUIRED, + LOCKED as LOCKED, + METHOD_NOT_ALLOWED as METHOD_NOT_ALLOWED, + MOVED_PERMANENTLY as MOVED_PERMANENTLY, + MULTI_STATUS as MULTI_STATUS, + MULTIPLE_CHOICES as MULTIPLE_CHOICES, + NETWORK_AUTHENTICATION_REQUIRED as NETWORK_AUTHENTICATION_REQUIRED, + NO_CONTENT as NO_CONTENT, + NON_AUTHORITATIVE_INFORMATION as NON_AUTHORITATIVE_INFORMATION, + NOT_ACCEPTABLE as NOT_ACCEPTABLE, + NOT_EXTENDED as NOT_EXTENDED, + NOT_FOUND as NOT_FOUND, + NOT_IMPLEMENTED as NOT_IMPLEMENTED, + NOT_MODIFIED as NOT_MODIFIED, + OK as OK, + PARTIAL_CONTENT as PARTIAL_CONTENT, + PAYMENT_REQUIRED as PAYMENT_REQUIRED, + PRECONDITION_FAILED as PRECONDITION_FAILED, + PRECONDITION_REQUIRED as PRECONDITION_REQUIRED, + PROCESSING as PROCESSING, + PROXY_AUTHENTICATION_REQUIRED as PROXY_AUTHENTICATION_REQUIRED, + REQUEST_ENTITY_TOO_LARGE as REQUEST_ENTITY_TOO_LARGE, + REQUEST_HEADER_FIELDS_TOO_LARGE as REQUEST_HEADER_FIELDS_TOO_LARGE, + REQUEST_TIMEOUT as REQUEST_TIMEOUT, + REQUEST_URI_TOO_LONG as REQUEST_URI_TOO_LONG, + REQUESTED_RANGE_NOT_SATISFIABLE as REQUESTED_RANGE_NOT_SATISFIABLE, + RESET_CONTENT as RESET_CONTENT, + SEE_OTHER as SEE_OTHER, + SERVICE_UNAVAILABLE as SERVICE_UNAVAILABLE, + SWITCHING_PROTOCOLS as SWITCHING_PROTOCOLS, + TEMPORARY_REDIRECT as TEMPORARY_REDIRECT, + TOO_MANY_REQUESTS as TOO_MANY_REQUESTS, + UNAUTHORIZED as UNAUTHORIZED, + UNPROCESSABLE_ENTITY as UNPROCESSABLE_ENTITY, + UNSUPPORTED_MEDIA_TYPE as UNSUPPORTED_MEDIA_TYPE, + UPGRADE_REQUIRED as UPGRADE_REQUIRED, + USE_PROXY as USE_PROXY, + HTTPMessage as HTTPMessage, + parse_headers as parse_headers, +) diff --git a/stubs/six/six/moves/http_cookies.pyi b/stubs/six/six/moves/http_cookies.pyi index 9c59a53..1e168c8 100644 --- a/stubs/six/six/moves/http_cookies.pyi +++ b/stubs/six/six/moves/http_cookies.pyi @@ -1 +1,3 @@ +# Morsel is not included in __all__ so export it explicitly from http.cookies import * +from http.cookies import Morsel as Morsel diff --git a/stubs/six/six/moves/urllib/__init__.pyi b/stubs/six/six/moves/urllib/__init__.pyi index d08209c..fa6dc97 100644 --- a/stubs/six/six/moves/urllib/__init__.pyi +++ b/stubs/six/six/moves/urllib/__init__.pyi @@ -1,5 +1 @@ -import six.moves.urllib.error as error -import six.moves.urllib.parse as parse -import six.moves.urllib.request as request -import six.moves.urllib.response as response -import six.moves.urllib.robotparser as robotparser +from six.moves.urllib import error as error, parse as parse, request as request, response as response, robotparser as robotparser diff --git a/stubs/slumber/METADATA.toml b/stubs/slumber/METADATA.toml index 12c154c..161ee7a 100644 --- a/stubs/slumber/METADATA.toml +++ b/stubs/slumber/METADATA.toml @@ -1 +1,4 @@ -version = "0.7" +version = "0.7.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/stdlib-list/@tests/stubtest_allowlist.txt b/stubs/stdlib-list/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..9a2ba76 --- /dev/null +++ b/stubs/stdlib-list/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +# looks like developer tooling that's not part of the public API +stdlib_list.fetch diff --git a/stubs/stdlib-list/METADATA.toml b/stubs/stdlib-list/METADATA.toml new file mode 100644 index 0000000..5404249 --- /dev/null +++ b/stubs/stdlib-list/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.8.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/stdlib-list/stdlib_list/__init__.pyi b/stubs/stdlib-list/stdlib_list/__init__.pyi new file mode 100644 index 0000000..33cfc9c --- /dev/null +++ b/stubs/stdlib-list/stdlib_list/__init__.pyi @@ -0,0 +1,9 @@ +from .base import ( + get_canonical_version as get_canonical_version, + in_stdlib as in_stdlib, + long_versions as long_versions, + short_versions as short_versions, + stdlib_list as stdlib_list, +) + +__version__: str diff --git a/stubs/stdlib-list/stdlib_list/_version.pyi b/stubs/stdlib-list/stdlib_list/_version.pyi new file mode 100644 index 0000000..feb0b16 --- /dev/null +++ b/stubs/stdlib-list/stdlib_list/_version.pyi @@ -0,0 +1,5 @@ +from typing import Any + +version_json: str + +def get_versions() -> dict[str, Any]: ... diff --git a/stubs/stdlib-list/stdlib_list/base.pyi b/stubs/stdlib-list/stdlib_list/base.pyi new file mode 100644 index 0000000..8332104 --- /dev/null +++ b/stubs/stdlib-list/stdlib_list/base.pyi @@ -0,0 +1,6 @@ +long_versions: list[str] +short_versions: list[str] + +def get_canonical_version(version: str) -> str: ... +def stdlib_list(version: str | None = ...) -> list[str]: ... +def in_stdlib(module_name: str, version: str | None = ...) -> bool: ... diff --git a/stubs/stripe/@tests/stubtest_allowlist.txt b/stubs/stripe/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..cd5b29f --- /dev/null +++ b/stubs/stripe/@tests/stubtest_allowlist.txt @@ -0,0 +1,6 @@ +# The following methods have custom classmethod decorators +stripe\..*\.delete +stripe\..*PaymentIntent\.confirm +stripe\.api_resources\.test_helpers\.test_clock\.TestClock\.advance +stripe\.api_resources\..*\.SearchableAPIResource\.search # Not defined on the actual class in v3, but expected to exist. +stripe\.api_resources\..*\.SearchableAPIResource\.search_auto_paging_iter # Not defined on the actual class in v3, but expected to exist. diff --git a/stubs/stripe/METADATA.toml b/stubs/stripe/METADATA.toml index 62a74a9..204547d 100644 --- a/stubs/stripe/METADATA.toml +++ b/stubs/stripe/METADATA.toml @@ -1 +1 @@ -version = "2.59" +version = "3.5.*" diff --git a/stubs/stripe/stripe/__init__.pyi b/stubs/stripe/stripe/__init__.pyi index c0c1a3d..3fa008c 100644 --- a/stubs/stripe/stripe/__init__.pyi +++ b/stubs/stripe/stripe/__init__.pyi @@ -4,7 +4,7 @@ from stripe.api_resources import * from stripe.oauth import OAuth as OAuth from stripe.webhook import Webhook as Webhook, WebhookSignature as WebhookSignature -api_key: Any +api_key: str | None client_id: Any api_base: str connect_api_base: str diff --git a/stubs/stripe/stripe/api_resources/__init__.pyi b/stubs/stripe/stripe/api_resources/__init__.pyi index 2bf4dae..77cdcbd 100644 --- a/stubs/stripe/stripe/api_resources/__init__.pyi +++ b/stubs/stripe/stripe/api_resources/__init__.pyi @@ -44,7 +44,6 @@ from stripe.api_resources.list_object import ListObject as ListObject from stripe.api_resources.login_link import LoginLink as LoginLink from stripe.api_resources.mandate import Mandate as Mandate from stripe.api_resources.order import Order as Order -from stripe.api_resources.order_return import OrderReturn as OrderReturn from stripe.api_resources.payment_intent import PaymentIntent as PaymentIntent from stripe.api_resources.payment_method import PaymentMethod as PaymentMethod from stripe.api_resources.payout import Payout as Payout @@ -59,6 +58,7 @@ from stripe.api_resources.recipient_transfer import RecipientTransfer as Recipie from stripe.api_resources.refund import Refund as Refund from stripe.api_resources.reversal import Reversal as Reversal from stripe.api_resources.review import Review as Review +from stripe.api_resources.search_result_object import SearchResultObject as SearchResultObject from stripe.api_resources.setup_attempt import SetupAttempt as SetupAttempt from stripe.api_resources.setup_intent import SetupIntent as SetupIntent from stripe.api_resources.sku import SKU as SKU diff --git a/stubs/stripe/stripe/api_resources/abstract/__init__.pyi b/stubs/stripe/stripe/api_resources/abstract/__init__.pyi index a3d7726..f73b09f 100644 --- a/stubs/stripe/stripe/api_resources/abstract/__init__.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/__init__.pyi @@ -6,6 +6,7 @@ from stripe.api_resources.abstract.listable_api_resource import ListableAPIResou from stripe.api_resources.abstract.nested_resource_class_methods import ( nested_resource_class_methods as nested_resource_class_methods, ) +from stripe.api_resources.abstract.searchable_api_resource import SearchableAPIResource as SearchableAPIResource from stripe.api_resources.abstract.singleton_api_resource import SingletonAPIResource as SingletonAPIResource from stripe.api_resources.abstract.updateable_api_resource import UpdateableAPIResource as UpdateableAPIResource from stripe.api_resources.abstract.verify_mixin import VerifyMixin as VerifyMixin diff --git a/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi index b6e5f16..70e8183 100644 --- a/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from typing import Any from stripe import api_requestor as api_requestor, error as error @@ -5,8 +6,8 @@ from stripe.stripe_object import StripeObject as StripeObject class APIResource(StripeObject): @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params): ... - def refresh(self): ... + def retrieve(cls: type[Self], id, api_key: Any | None = ..., **params) -> Self: ... + def refresh(self: Self) -> Self: ... @classmethod - def class_url(cls): ... - def instance_url(self): ... + def class_url(cls) -> str: ... + def instance_url(self) -> str: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi index ebc47b8..073c378 100644 --- a/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from typing import Any from stripe import api_requestor as api_requestor @@ -6,10 +7,10 @@ from stripe.api_resources.abstract.api_resource import APIResource as APIResourc class CreateableAPIResource(APIResource): @classmethod def create( - cls, + cls: type[Self], api_key: Any | None = ..., - idempotency_key: Any | None = ..., + idempotency_key: str | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params, - ): ... + ) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi index cd8de71..1543552 100644 --- a/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi @@ -1,4 +1,7 @@ +from _typeshed import Self + from stripe.api_resources.abstract.api_resource import APIResource as APIResource class DeletableAPIResource(APIResource): - def delete(self, **params): ... + @classmethod + def delete(cls: type[Self], sid: str = ..., **params) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/listable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/listable_api_resource.pyi index a1c1e07..6db62c6 100644 --- a/stubs/stripe/stripe/api_resources/abstract/listable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/listable_api_resource.pyi @@ -1,10 +1,14 @@ +from collections.abc import Iterator from typing import Any from stripe import api_requestor as api_requestor from stripe.api_resources.abstract.api_resource import APIResource as APIResource +from stripe.api_resources.list_object import ListObject class ListableAPIResource(APIResource): @classmethod - def auto_paging_iter(cls, *args, **params): ... + def auto_paging_iter(cls, *args, **params) -> Iterator[Any]: ... @classmethod - def list(cls, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params): ... + def list( + cls, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params + ) -> ListObject: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi new file mode 100644 index 0000000..e8cf8ce --- /dev/null +++ b/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi @@ -0,0 +1,11 @@ +from _typeshed import Self +from collections.abc import Iterator + +from stripe.api_resources.abstract.api_resource import APIResource as APIResource +from stripe.api_resources.search_result_object import SearchResultObject + +class SearchableAPIResource(APIResource): + @classmethod + def search(cls: type[Self], *args: str | None, **kwargs) -> SearchResultObject[Self]: ... + @classmethod + def search_auto_paging_iter(cls: type[Self], *args: str | None, **kwargs) -> Iterator[Self]: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi index 13ca707..b7ee885 100644 --- a/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi @@ -1,8 +1,8 @@ -from typing import Any +from _typeshed import Self from stripe.api_resources.abstract.api_resource import APIResource as APIResource class UpdateableAPIResource(APIResource): @classmethod - def modify(cls, sid, **params): ... - def save(self, idempotency_key: Any | None = ...): ... + def modify(cls: type[Self], sid: str, **params) -> Self: ... + def save(self: Self, idempotency_key: str | None = ...) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/verify_mixin.pyi b/stubs/stripe/stripe/api_resources/abstract/verify_mixin.pyi index 2b5f795..139533f 100644 --- a/stubs/stripe/stripe/api_resources/abstract/verify_mixin.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/verify_mixin.pyi @@ -1,4 +1,2 @@ -from typing import Any - class VerifyMixin: - def verify(self, idempotency_key: Any | None = ..., **params): ... + def verify(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/account.pyi b/stubs/stripe/stripe/api_resources/account.pyi index 8851ecb..58c6a4d 100644 --- a/stubs/stripe/stripe/api_resources/account.pyi +++ b/stubs/stripe/stripe/api_resources/account.pyi @@ -12,12 +12,62 @@ from stripe.api_resources.abstract import ( class Account(CreateableAPIResource, DeletableAPIResource, ListableAPIResource): OBJECT_NAME: str - def reject(self, idempotency_key: Any | None = ..., **params): ... + def reject(self, idempotency_key: str | None = ..., **params): ... @classmethod def retrieve(cls, id: Any | None = ..., api_key: Any | None = ..., **params): ... @classmethod def modify(cls, id: Any | None = ..., **params): ... def instance_url(self): ... - def persons(self, **params): ... + def persons(self, idempotency_key: str | None = ..., **params): ... def deauthorize(self, **params): ... def serialize(self, previous): ... + @classmethod + def capabilitys_url(cls, id, nested_id=...): ... + @classmethod + def capabilitys_request( + cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params + ): ... + @classmethod + def retrieve_capability(cls, id, nested_id, **params): ... + @classmethod + def modify_capability(cls, id, nested_id, **params): ... + @classmethod + def list_capabilities(cls, id, **params): ... + @classmethod + def external_accounts_url(cls, id, nested_id=...): ... + @classmethod + def external_accounts_request( + cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params + ): ... + @classmethod + def create_external_account(cls, id, **params): ... + @classmethod + def retrieve_external_account(cls, id, nested_id, **params): ... + @classmethod + def modify_external_account(cls, id, nested_id, **params): ... + @classmethod + def delete_external_account(cls, id, nested_id, **params): ... + @classmethod + def list_external_accounts(cls, id, **params): ... + @classmethod + def login_links_url(cls, id, nested_id=...): ... + @classmethod + def login_links_request( + cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params + ): ... + @classmethod + def create_login_link(cls, id, **params): ... + @classmethod + def persons_url(cls, id, nested_id=...): ... + @classmethod + def persons_request(cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params): ... + @classmethod + def create_person(cls, id, **params): ... + @classmethod + def retrieve_person(cls, id, nested_id, **params): ... + @classmethod + def modify_person(cls, id, nested_id, **params): ... + @classmethod + def delete_person(cls, id, nested_id, **params): ... + @classmethod + def list_persons(cls, id, **params): ... diff --git a/stubs/stripe/stripe/api_resources/alipay_account.pyi b/stubs/stripe/stripe/api_resources/alipay_account.pyi index e9a5991..f308c7e 100644 --- a/stubs/stripe/stripe/api_resources/alipay_account.pyi +++ b/stubs/stripe/stripe/api_resources/alipay_account.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, NoReturn from stripe.api_resources.abstract import ( DeletableAPIResource as DeletableAPIResource, @@ -14,4 +14,4 @@ class AlipayAccount(DeletableAPIResource, UpdateableAPIResource): @classmethod def retrieve( cls, id, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params - ) -> None: ... + ) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/application_fee.pyi b/stubs/stripe/stripe/api_resources/application_fee.pyi index e6f0ec5..e9d275a 100644 --- a/stubs/stripe/stripe/api_resources/application_fee.pyi +++ b/stubs/stripe/stripe/api_resources/application_fee.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( ListableAPIResource as ListableAPIResource, nested_resource_class_methods as nested_resource_class_methods, @@ -7,4 +5,4 @@ from stripe.api_resources.abstract import ( class ApplicationFee(ListableAPIResource): OBJECT_NAME: str - def refund(self, idempotency_key: Any | None = ..., **params): ... + def refund(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/application_fee_refund.pyi b/stubs/stripe/stripe/api_resources/application_fee_refund.pyi index 1d8822c..948ff9c 100644 --- a/stubs/stripe/stripe/api_resources/application_fee_refund.pyi +++ b/stubs/stripe/stripe/api_resources/application_fee_refund.pyi @@ -1,4 +1,5 @@ -from typing import Any +from _typeshed import Self +from typing import Any, NoReturn from stripe.api_resources import ApplicationFee as ApplicationFee from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPIResource @@ -6,7 +7,7 @@ from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPI class ApplicationFeeRefund(UpdateableAPIResource): OBJECT_NAME: str @classmethod - def modify(cls, fee, sid, **params): ... - def instance_url(self): ... + def modify(cls: type[Self], fee, sid: str, **params) -> Self: ... # type: ignore[override] + def instance_url(self) -> str: ... @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params) -> None: ... + def retrieve(cls, id, api_key: Any | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/bank_account.pyi b/stubs/stripe/stripe/api_resources/bank_account.pyi index a662c86..c09ec67 100644 --- a/stubs/stripe/stripe/api_resources/bank_account.pyi +++ b/stubs/stripe/stripe/api_resources/bank_account.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, NoReturn from stripe import error as error from stripe.api_resources.abstract import ( @@ -11,10 +11,10 @@ from stripe.api_resources.customer import Customer as Customer class BankAccount(DeletableAPIResource, UpdateableAPIResource, VerifyMixin): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def modify(cls, sid, **params) -> None: ... + def modify(cls, sid, **params) -> NoReturn: ... @classmethod def retrieve( cls, id, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params - ) -> None: ... + ) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/capability.pyi b/stubs/stripe/stripe/api_resources/capability.pyi index 9d3f1a7..a7ceb56 100644 --- a/stubs/stripe/stripe/api_resources/capability.pyi +++ b/stubs/stripe/stripe/api_resources/capability.pyi @@ -1,12 +1,12 @@ -from typing import Any +from typing import Any, NoReturn from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPIResource from stripe.api_resources.account import Account as Account class Capability(UpdateableAPIResource): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def modify(cls, sid, **params) -> None: ... + def modify(cls, sid, **params) -> NoReturn: ... @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params) -> None: ... + def retrieve(cls, id, api_key: Any | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/card.pyi b/stubs/stripe/stripe/api_resources/card.pyi index a8c5a4c..f6025f1 100644 --- a/stubs/stripe/stripe/api_resources/card.pyi +++ b/stubs/stripe/stripe/api_resources/card.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, NoReturn from stripe import error as error from stripe.api_resources.abstract import ( @@ -11,10 +11,10 @@ from stripe.api_resources.recipient import Recipient as Recipient class Card(DeletableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def modify(cls, sid, **params) -> None: ... + def modify(cls, sid, **params) -> NoReturn: ... @classmethod def retrieve( cls, id, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params - ) -> None: ... + ) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/charge.pyi b/stubs/stripe/stripe/api_resources/charge.pyi index 2e3467e..a9c6246 100644 --- a/stubs/stripe/stripe/api_resources/charge.pyi +++ b/stubs/stripe/stripe/api_resources/charge.pyi @@ -1,18 +1,17 @@ -from typing import Any - from stripe import api_requestor as api_requestor from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, custom_method as custom_method, ) -class Charge(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Charge(CreateableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def capture(self, idempotency_key: Any | None = ..., **params): ... - def refund(self, idempotency_key: Any | None = ..., **params): ... - def update_dispute(self, idempotency_key: Any | None = ..., **params): ... - def close_dispute(self, idempotency_key: Any | None = ..., **params): ... - def mark_as_fraudulent(self, idempotency_key: Any | None = ...): ... - def mark_as_safe(self, idempotency_key: Any | None = ...): ... + def capture(self, idempotency_key: str | None = ..., **params): ... + def refund(self, idempotency_key: str | None = ..., **params): ... + def update_dispute(self, idempotency_key: str | None = ..., **params): ... + def close_dispute(self, idempotency_key: str | None = ..., **params): ... + def mark_as_fraudulent(self, idempotency_key: str | None = ...): ... + def mark_as_safe(self, idempotency_key: str | None = ...): ... diff --git a/stubs/stripe/stripe/api_resources/credit_note.pyi b/stubs/stripe/stripe/api_resources/credit_note.pyi index 06c0d94..c6badb7 100644 --- a/stubs/stripe/stripe/api_resources/credit_note.pyi +++ b/stubs/stripe/stripe/api_resources/credit_note.pyi @@ -10,6 +10,6 @@ from stripe.api_resources.abstract import ( class CreditNote(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def void_credit_note(self, idempotency_key: Any | None = ..., **params): ... + def void_credit_note(self, idempotency_key: str | None = ..., **params): ... @classmethod def preview(cls, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/customer.pyi b/stubs/stripe/stripe/api_resources/customer.pyi index c8694d0..36e3327 100644 --- a/stubs/stripe/stripe/api_resources/customer.pyi +++ b/stubs/stripe/stripe/api_resources/customer.pyi @@ -3,11 +3,52 @@ from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, DeletableAPIResource as DeletableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, custom_method as custom_method, nested_resource_class_methods as nested_resource_class_methods, ) -class Customer(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Customer(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str def delete_discount(self, **params) -> None: ... + @classmethod + def balance_transactions_url(cls, id, nested_id=...): ... + @classmethod + def balance_transactions_request( + cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params + ): ... + @classmethod + def create_balance_transaction(cls, id, **params): ... + @classmethod + def retrieve_balance_transaction(cls, id, nested_id, **params): ... + @classmethod + def modify_balance_transaction(cls, id, nested_id, **params): ... + @classmethod + def list_balance_transactions(cls, id, **params): ... + @classmethod + def sources_url(cls, id, nested_id=...): ... + @classmethod + def sources_request(cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params): ... + @classmethod + def create_source(cls, id, **params): ... + @classmethod + def retrieve_source(cls, id, nested_id, **params): ... + @classmethod + def modify_source(cls, id, nested_id, **params): ... + @classmethod + def delete_source(cls, id, nested_id, **params): ... + @classmethod + def list_sources(cls, id, **params): ... + @classmethod + def tax_ids_url(cls, id, nested_id=...): ... + @classmethod + def tax_ids_request(cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params): ... + @classmethod + def create_tax_id(cls, id, **params): ... + @classmethod + def retrieve_tax_id(cls, id, nested_id, **params): ... + @classmethod + def delete_tax_id(cls, id, nested_id, **params): ... + @classmethod + def list_tax_ids(cls, id, **params): ... diff --git a/stubs/stripe/stripe/api_resources/customer_balance_transaction.pyi b/stubs/stripe/stripe/api_resources/customer_balance_transaction.pyi index 32654b3..703f930 100644 --- a/stubs/stripe/stripe/api_resources/customer_balance_transaction.pyi +++ b/stubs/stripe/stripe/api_resources/customer_balance_transaction.pyi @@ -1,10 +1,10 @@ -from typing import Any +from typing import Any, NoReturn from stripe.api_resources.abstract import APIResource as APIResource from stripe.api_resources.customer import Customer as Customer class CustomerBalanceTransaction(APIResource): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params) -> None: ... + def retrieve(cls, id, api_key: Any | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/dispute.pyi b/stubs/stripe/stripe/api_resources/dispute.pyi index 6cf7605..6f79d2a 100644 --- a/stubs/stripe/stripe/api_resources/dispute.pyi +++ b/stubs/stripe/stripe/api_resources/dispute.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( ListableAPIResource as ListableAPIResource, UpdateableAPIResource as UpdateableAPIResource, @@ -8,4 +6,4 @@ from stripe.api_resources.abstract import ( class Dispute(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def close(self, idempotency_key: Any | None = ..., **params): ... + def close(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/ephemeral_key.pyi b/stubs/stripe/stripe/api_resources/ephemeral_key.pyi index e2059ea..6aca7ef 100644 --- a/stubs/stripe/stripe/api_resources/ephemeral_key.pyi +++ b/stubs/stripe/stripe/api_resources/ephemeral_key.pyi @@ -9,7 +9,7 @@ class EphemeralKey(DeletableAPIResource): def create( cls, api_key: Any | None = ..., - idempotency_key: Any | None = ..., + idempotency_key: str | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params, diff --git a/stubs/stripe/stripe/api_resources/identity/verification_session.pyi b/stubs/stripe/stripe/api_resources/identity/verification_session.pyi index 1ae41f5..5a9e29c 100644 --- a/stubs/stripe/stripe/api_resources/identity/verification_session.pyi +++ b/stubs/stripe/stripe/api_resources/identity/verification_session.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,5 +7,5 @@ from stripe.api_resources.abstract import ( class VerificationSession(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... - def redact(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def redact(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/invoice.pyi b/stubs/stripe/stripe/api_resources/invoice.pyi index 625604b..8c994d0 100644 --- a/stubs/stripe/stripe/api_resources/invoice.pyi +++ b/stubs/stripe/stripe/api_resources/invoice.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from typing import Any from stripe import api_requestor as api_requestor @@ -5,18 +6,19 @@ from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, DeletableAPIResource as DeletableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, custom_method as custom_method, ) -class Invoice(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Invoice(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def finalize_invoice(self, idempotency_key: Any | None = ..., **params): ... - def mark_uncollectible(self, idempotency_key: Any | None = ..., **params): ... - def pay(self, idempotency_key: Any | None = ..., **params): ... - def send_invoice(self, idempotency_key: Any | None = ..., **params): ... - def void_invoice(self, idempotency_key: Any | None = ..., **params): ... + def finalize_invoice(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def mark_uncollectible(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def pay(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def send_invoice(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def void_invoice(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... @classmethod def upcoming( cls, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params - ): ... + ) -> Invoice: ... diff --git a/stubs/stripe/stripe/api_resources/issuing/authorization.pyi b/stubs/stripe/stripe/api_resources/issuing/authorization.pyi index 82058b9..dd75800 100644 --- a/stubs/stripe/stripe/api_resources/issuing/authorization.pyi +++ b/stubs/stripe/stripe/api_resources/issuing/authorization.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( ListableAPIResource as ListableAPIResource, UpdateableAPIResource as UpdateableAPIResource, @@ -8,5 +6,5 @@ from stripe.api_resources.abstract import ( class Authorization(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def approve(self, idempotency_key: Any | None = ..., **params): ... - def decline(self, idempotency_key: Any | None = ..., **params): ... + def approve(self, idempotency_key: str | None = ..., **params): ... + def decline(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/issuing/card.pyi b/stubs/stripe/stripe/api_resources/issuing/card.pyi index d5bb8c2..0fdab4b 100644 --- a/stubs/stripe/stripe/api_resources/issuing/card.pyi +++ b/stubs/stripe/stripe/api_resources/issuing/card.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,4 +7,4 @@ from stripe.api_resources.abstract import ( class Card(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def details(self, idempotency_key: Any | None = ..., **params): ... + def details(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/issuing/dispute.pyi b/stubs/stripe/stripe/api_resources/issuing/dispute.pyi index cfec61f..ed3b674 100644 --- a/stubs/stripe/stripe/api_resources/issuing/dispute.pyi +++ b/stubs/stripe/stripe/api_resources/issuing/dispute.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,4 +7,4 @@ from stripe.api_resources.abstract import ( class Dispute(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def submit(self, idempotency_key: Any | None = ..., **params): ... + def submit(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/list_object.pyi b/stubs/stripe/stripe/api_resources/list_object.pyi index bce7cd6..ca6de08 100644 --- a/stubs/stripe/stripe/api_resources/list_object.pyi +++ b/stubs/stripe/stripe/api_resources/list_object.pyi @@ -1,4 +1,4 @@ -from collections.abc import Generator +from collections.abc import Iterator from typing import Any from stripe import api_requestor as api_requestor @@ -6,11 +6,13 @@ from stripe.stripe_object import StripeObject as StripeObject class ListObject(StripeObject): OBJECT_NAME: str - def list(self, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params): ... + def list( + self, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params + ) -> ListObject: ... def create( self, api_key: Any | None = ..., - idempotency_key: Any | None = ..., + idempotency_key: str | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params, @@ -20,16 +22,18 @@ class ListObject(StripeObject): ): ... def __getitem__(self, k): ... def __iter__(self): ... - def __len__(self): ... + def __len__(self) -> int: ... def __reversed__(self): ... - def auto_paging_iter(self) -> Generator[Any, None, None]: ... + def auto_paging_iter(self) -> Iterator[Any]: ... @classmethod - def empty_list(cls, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ...): ... + def empty_list( + cls, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ... + ) -> ListObject: ... @property - def is_empty(self): ... + def is_empty(self) -> bool: ... def next_page( self, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params - ): ... + ) -> ListObject: ... def previous_page( self, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params - ): ... + ) -> ListObject: ... diff --git a/stubs/stripe/stripe/api_resources/order.pyi b/stubs/stripe/stripe/api_resources/order.pyi index 14d5764..1a9dfac 100644 --- a/stubs/stripe/stripe/api_resources/order.pyi +++ b/stubs/stripe/stripe/api_resources/order.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,5 +7,7 @@ from stripe.api_resources.abstract import ( class Order(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def pay(self, idempotency_key: Any | None = ..., **params): ... - def return_order(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def list_line_items(self, idempotency_key: str | None = ..., **params): ... + def reopen(self, idempotency_key: str | None = ..., **params): ... + def submit(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/order_return.pyi b/stubs/stripe/stripe/api_resources/order_return.pyi deleted file mode 100644 index a5515fe..0000000 --- a/stubs/stripe/stripe/api_resources/order_return.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from stripe.api_resources.abstract import ListableAPIResource as ListableAPIResource - -class OrderReturn(ListableAPIResource): - OBJECT_NAME: str diff --git a/stubs/stripe/stripe/api_resources/payment_intent.pyi b/stubs/stripe/stripe/api_resources/payment_intent.pyi index c5761ca..203ce28 100644 --- a/stubs/stripe/stripe/api_resources/payment_intent.pyi +++ b/stubs/stripe/stripe/api_resources/payment_intent.pyi @@ -1,14 +1,22 @@ -from typing import Any +from typing import overload from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, custom_method as custom_method, ) -class PaymentIntent(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): +class PaymentIntent(CreateableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... - def capture(self, idempotency_key: Any | None = ..., **params): ... - def confirm(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def capture(self, idempotency_key: str | None = ..., **params): ... + @overload + @classmethod + def confirm( + cls, intent: str, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params + ): ... + @overload + @classmethod + def confirm(cls, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/payment_method.pyi b/stubs/stripe/stripe/api_resources/payment_method.pyi index da90f0e..4a8f174 100644 --- a/stubs/stripe/stripe/api_resources/payment_method.pyi +++ b/stubs/stripe/stripe/api_resources/payment_method.pyi @@ -1,4 +1,4 @@ -from typing import Any +from _typeshed import Self from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, @@ -9,5 +9,5 @@ from stripe.api_resources.abstract import ( class PaymentMethod(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def attach(self, idempotency_key: Any | None = ..., **params): ... - def detach(self, idempotency_key: Any | None = ..., **params): ... + def attach(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def detach(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/payout.pyi b/stubs/stripe/stripe/api_resources/payout.pyi index 4d20db1..95855d0 100644 --- a/stubs/stripe/stripe/api_resources/payout.pyi +++ b/stubs/stripe/stripe/api_resources/payout.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,5 +7,5 @@ from stripe.api_resources.abstract import ( class Payout(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... - def reverse(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def reverse(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/person.pyi b/stubs/stripe/stripe/api_resources/person.pyi index 8ebef88..a380d74 100644 --- a/stubs/stripe/stripe/api_resources/person.pyi +++ b/stubs/stripe/stripe/api_resources/person.pyi @@ -1,12 +1,12 @@ -from typing import Any +from typing import Any, NoReturn from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPIResource from stripe.api_resources.account import Account as Account class Person(UpdateableAPIResource): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def modify(cls, sid, **params) -> None: ... + def modify(cls, sid, **params) -> NoReturn: ... @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params) -> None: ... + def retrieve(cls, id, api_key: Any | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/price.pyi b/stubs/stripe/stripe/api_resources/price.pyi index 7c1c736..773254d 100644 --- a/stubs/stripe/stripe/api_resources/price.pyi +++ b/stubs/stripe/stripe/api_resources/price.pyi @@ -1,8 +1,9 @@ from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, ) -class Price(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Price(CreateableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str diff --git a/stubs/stripe/stripe/api_resources/product.pyi b/stubs/stripe/stripe/api_resources/product.pyi index 8e42ea0..10149e0 100644 --- a/stubs/stripe/stripe/api_resources/product.pyi +++ b/stubs/stripe/stripe/api_resources/product.pyi @@ -2,8 +2,9 @@ from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, DeletableAPIResource as DeletableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, ) -class Product(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Product(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str diff --git a/stubs/stripe/stripe/api_resources/quote.pyi b/stubs/stripe/stripe/api_resources/quote.pyi index 5dd2bb4..cb97dd2 100644 --- a/stubs/stripe/stripe/api_resources/quote.pyi +++ b/stubs/stripe/stripe/api_resources/quote.pyi @@ -10,10 +10,10 @@ from stripe.api_resources.abstract import ( class Quote(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def accept(self, idempotency_key: Any | None = ..., **params): ... - def cancel(self, idempotency_key: Any | None = ..., **params): ... - def finalize_quote(self, idempotency_key: Any | None = ..., **params): ... - def list_line_items(self, idempotency_key: Any | None = ..., **params): ... + def accept(self, idempotency_key: str | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def finalize_quote(self, idempotency_key: str | None = ..., **params): ... + def list_line_items(self, idempotency_key: str | None = ..., **params): ... def pdf( self, api_key: Any | None = ..., diff --git a/stubs/stripe/stripe/api_resources/reversal.pyi b/stubs/stripe/stripe/api_resources/reversal.pyi index 58bd5fb..dff98c0 100644 --- a/stubs/stripe/stripe/api_resources/reversal.pyi +++ b/stubs/stripe/stripe/api_resources/reversal.pyi @@ -1,12 +1,12 @@ -from typing import Any +from typing import Any, NoReturn from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPIResource from stripe.api_resources.transfer import Transfer as Transfer class Reversal(UpdateableAPIResource): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def modify(cls, sid, **params) -> None: ... + def modify(cls, sid, **params) -> NoReturn: ... @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params) -> None: ... + def retrieve(cls, id, api_key: Any | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/review.pyi b/stubs/stripe/stripe/api_resources/review.pyi index 943b3c8..cc04d65 100644 --- a/stubs/stripe/stripe/api_resources/review.pyi +++ b/stubs/stripe/stripe/api_resources/review.pyi @@ -1,7 +1,5 @@ -from typing import Any - from stripe.api_resources.abstract import ListableAPIResource as ListableAPIResource, custom_method as custom_method class Review(ListableAPIResource): OBJECT_NAME: str - def approve(self, idempotency_key: Any | None = ..., **params): ... + def approve(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/search_result_object.pyi b/stubs/stripe/stripe/api_resources/search_result_object.pyi new file mode 100644 index 0000000..f6b858c --- /dev/null +++ b/stubs/stripe/stripe/api_resources/search_result_object.pyi @@ -0,0 +1,33 @@ +from _typeshed import Self +from collections.abc import Iterator +from typing import Any, ClassVar, Generic, TypeVar +from typing_extensions import Literal + +from stripe.stripe_object import StripeObject + +_T = TypeVar("_T") + +class SearchResultObject(StripeObject, Generic[_T]): + OBJECT_NAME: ClassVar[Literal["search_result"]] + url: str + has_more: bool + data: list[_T] + next_page: str + total_count: int + + def search( + self: Self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params + ) -> Self: ... + def __getitem__(self, k: str) -> Any: ... + def __iter__(self) -> Iterator[_T]: ... + def __len__(self) -> int: ... + def auto_paging_iter(self) -> Iterator[_T]: ... + @classmethod + def empty_search_result( + cls: type[Self], api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ... + ) -> Self: ... + @property + def is_empty(self) -> bool: ... + def next_search_result_page( + self: Self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params + ) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/setup_intent.pyi b/stubs/stripe/stripe/api_resources/setup_intent.pyi index b976313..8da1117 100644 --- a/stubs/stripe/stripe/api_resources/setup_intent.pyi +++ b/stubs/stripe/stripe/api_resources/setup_intent.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,5 +7,5 @@ from stripe.api_resources.abstract import ( class SetupIntent(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... - def confirm(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def confirm(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/source.pyi b/stubs/stripe/stripe/api_resources/source.pyi index 2442465..547e229 100644 --- a/stubs/stripe/stripe/api_resources/source.pyi +++ b/stubs/stripe/stripe/api_resources/source.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe import error as error from stripe.api_resources import Customer as Customer from stripe.api_resources.abstract import ( @@ -11,5 +9,5 @@ from stripe.api_resources.abstract import ( class Source(CreateableAPIResource, UpdateableAPIResource, VerifyMixin): OBJECT_NAME: str - def detach(self, idempotency_key: Any | None = ..., **params): ... + def detach(self, idempotency_key: str | None = ..., **params): ... def source_transactions(self, **params): ... diff --git a/stubs/stripe/stripe/api_resources/subscription.pyi b/stubs/stripe/stripe/api_resources/subscription.pyi index ddd2ce4..511d2ae 100644 --- a/stubs/stripe/stripe/api_resources/subscription.pyi +++ b/stubs/stripe/stripe/api_resources/subscription.pyi @@ -3,10 +3,13 @@ from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, DeletableAPIResource as DeletableAPIResource, ListableAPIResource as ListableAPIResource, + SearchableAPIResource as SearchableAPIResource, UpdateableAPIResource as UpdateableAPIResource, custom_method as custom_method, ) -class Subscription(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Subscription( + CreateableAPIResource, DeletableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource +): OBJECT_NAME: str def delete_discount(self, **params) -> None: ... diff --git a/stubs/stripe/stripe/api_resources/subscription_item.pyi b/stubs/stripe/stripe/api_resources/subscription_item.pyi index b107e7e..df891e9 100644 --- a/stubs/stripe/stripe/api_resources/subscription_item.pyi +++ b/stubs/stripe/stripe/api_resources/subscription_item.pyi @@ -9,3 +9,19 @@ from stripe.api_resources.abstract import ( class SubscriptionItem(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str def usage_record_summaries(self, **params): ... + @classmethod + def usage_records_url(cls, id, nested_id=...): ... + @classmethod + def usage_records_request( + cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params + ): ... + @classmethod + def create_usage_record(cls, id, **params): ... + @classmethod + def usage_record_summarys_url(cls, id, nested_id=...): ... + @classmethod + def usage_record_summarys_request( + cls, method, url, api_key=..., idempotency_key=..., stripe_version=..., stripe_account=..., **params + ): ... + @classmethod + def list_usage_record_summaries(cls, id, **params): ... diff --git a/stubs/stripe/stripe/api_resources/subscription_schedule.pyi b/stubs/stripe/stripe/api_resources/subscription_schedule.pyi index 0699802..315c15b 100644 --- a/stubs/stripe/stripe/api_resources/subscription_schedule.pyi +++ b/stubs/stripe/stripe/api_resources/subscription_schedule.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,5 +7,5 @@ from stripe.api_resources.abstract import ( class SubscriptionSchedule(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... - def release(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... + def release(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/tax_id.pyi b/stubs/stripe/stripe/api_resources/tax_id.pyi index 25d6fa1..3bd167a 100644 --- a/stubs/stripe/stripe/api_resources/tax_id.pyi +++ b/stubs/stripe/stripe/api_resources/tax_id.pyi @@ -1,10 +1,10 @@ -from typing import Any +from typing import Any, NoReturn from stripe.api_resources.abstract import APIResource as APIResource from stripe.api_resources.customer import Customer as Customer class TaxId(APIResource): OBJECT_NAME: str - def instance_url(self): ... + def instance_url(self) -> str: ... @classmethod - def retrieve(cls, id, api_key: Any | None = ..., **params) -> None: ... + def retrieve(cls, id, api_key: Any | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/test_helpers/__init__.pyi b/stubs/stripe/stripe/api_resources/test_helpers/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi b/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi new file mode 100644 index 0000000..86495c3 --- /dev/null +++ b/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi @@ -0,0 +1,11 @@ +from _typeshed import Self +from typing import Any +from typing_extensions import Literal + +from stripe.api_resources.abstract import CreateableAPIResource, DeletableAPIResource, ListableAPIResource + +class TestClock(CreateableAPIResource, DeletableAPIResource, ListableAPIResource): + OBJECT_NAME: Literal["test_helpers.test_clock"] + + @classmethod + def advance(cls: type[Self], idempotency_key: str | None = ..., **params: Any) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/topup.pyi b/stubs/stripe/stripe/api_resources/topup.pyi index ff0f1d3..e6619c8 100644 --- a/stubs/stripe/stripe/api_resources/topup.pyi +++ b/stubs/stripe/stripe/api_resources/topup.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -9,4 +7,4 @@ from stripe.api_resources.abstract import ( class Topup(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/transfer.pyi b/stubs/stripe/stripe/api_resources/transfer.pyi index 16774b6..aa4edd4 100644 --- a/stubs/stripe/stripe/api_resources/transfer.pyi +++ b/stubs/stripe/stripe/api_resources/transfer.pyi @@ -1,5 +1,3 @@ -from typing import Any - from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, ListableAPIResource as ListableAPIResource, @@ -10,4 +8,4 @@ from stripe.api_resources.abstract import ( class Transfer(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def cancel(self, idempotency_key: Any | None = ..., **params): ... + def cancel(self, idempotency_key: str | None = ..., **params): ... diff --git a/stubs/stripe/stripe/api_resources/usage_record.pyi b/stubs/stripe/stripe/api_resources/usage_record.pyi index bdd663b..14dd15c 100644 --- a/stubs/stripe/stripe/api_resources/usage_record.pyi +++ b/stubs/stripe/stripe/api_resources/usage_record.pyi @@ -9,7 +9,7 @@ class UsageRecord(APIResource): def create( cls, api_key: Any | None = ..., - idempotency_key: Any | None = ..., + idempotency_key: str | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ..., **params, diff --git a/stubs/stripe/stripe/stripe_object.pyi b/stubs/stripe/stripe/stripe_object.pyi index 25ed72a..6b93f44 100644 --- a/stubs/stripe/stripe/stripe_object.pyi +++ b/stubs/stripe/stripe/stripe_object.pyi @@ -1,11 +1,13 @@ import json -from typing import Any, Dict +from _typeshed import Self +from typing import Any from stripe import api_requestor as api_requestor -class StripeObject(Dict[Any, Any]): +class StripeObject(dict[Any, Any]): class ReprJSONEncoder(json.JSONEncoder): def default(self, obj): ... + def __init__( self, id: Any | None = ..., @@ -27,14 +29,19 @@ class StripeObject(Dict[Any, Any]): def __reduce__(self): ... @classmethod def construct_from( - cls, values, key, stripe_version: Any | None = ..., stripe_account: Any | None = ..., last_response: Any | None = ... - ): ... + cls: type[Self], + values: Any, + key: str | None, + stripe_version: Any | None = ..., + stripe_account: Any | None = ..., + last_response: Any | None = ..., + ) -> Self: ... api_key: Any stripe_version: Any stripe_account: Any def refresh_from( self, - values, + values: Any, api_key: Any | None = ..., partial: bool = ..., stripe_version: Any | None = ..., @@ -50,5 +57,5 @@ class StripeObject(Dict[Any, Any]): @property def stripe_id(self): ... def serialize(self, previous): ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... + def __copy__(self) -> StripeObject: ... + def __deepcopy__(self, memo: Any) -> StripeObject: ... diff --git a/stubs/stripe/stripe/util.pyi b/stubs/stripe/stripe/util.pyi index 67f93be..7aef874 100644 --- a/stubs/stripe/stripe/util.pyi +++ b/stubs/stripe/stripe/util.pyi @@ -1,4 +1,8 @@ -from typing import Any +from typing import Any, overload +from typing_extensions import TypeAlias + +from stripe.stripe_object import StripeObject +from stripe.stripe_response import StripeResponse def utf8(value): ... def log_debug(message, **params) -> None: ... @@ -12,3 +16,20 @@ class class_method_variant: method: Any def __call__(self, method): ... def __get__(self, obj, objtype: Any | None = ...): ... + +@overload +def populate_headers(idempotency_key: None) -> None: ... +@overload +def populate_headers(idempotency_key: str) -> dict[str, str]: ... + +_RespType: TypeAlias = dict[Any, Any] | StripeObject | StripeResponse + +# undocumented +@overload +def convert_to_stripe_object( + resp: list[Any], api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ... +) -> list[Any]: ... +@overload +def convert_to_stripe_object( + resp: _RespType, api_key: Any | None = ..., stripe_version: Any | None = ..., stripe_account: Any | None = ... +) -> StripeObject: ... diff --git a/stubs/stripe/stripe/webhook.pyi b/stubs/stripe/stripe/webhook.pyi index d5eac8d..12cfe57 100644 --- a/stubs/stripe/stripe/webhook.pyi +++ b/stubs/stripe/stripe/webhook.pyi @@ -1,13 +1,17 @@ -from typing import Any +from typing_extensions import Literal -from stripe import error as error +from stripe import Event, error as error class Webhook: DEFAULT_TOLERANCE: int @staticmethod - def construct_event(payload, sig_header, secret, tolerance=..., api_key: Any | None = ...): ... + def construct_event( + payload: bytes | str, sig_header: str, secret: str, tolerance: int = ..., api_key: str | None = ... + ) -> Event: ... class WebhookSignature: EXPECTED_SCHEME: str @classmethod - def verify_header(cls, payload, header, secret, tolerance: Any | None = ...): ... + def verify_header(cls, payload: bytes | str, header: str, secret: str, tolerance: int | None = ...) -> Literal[True]: ... + @staticmethod + def _compute_signature(payload: str, secret: str) -> str: ... diff --git a/stubs/tabulate/METADATA.toml b/stubs/tabulate/METADATA.toml index 59d3db9..1548770 100644 --- a/stubs/tabulate/METADATA.toml +++ b/stubs/tabulate/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.8" -python2 = true +version = "0.9.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/tabulate/tabulate.pyi b/stubs/tabulate/tabulate.pyi deleted file mode 100644 index 8b5efde..0000000 --- a/stubs/tabulate/tabulate.pyi +++ /dev/null @@ -1,46 +0,0 @@ -from typing import Any, Callable, Container, Iterable, List, Mapping, NamedTuple, Sequence, Union - -LATEX_ESCAPE_RULES: dict[str, str] -MIN_PADDING: int -PRESERVE_WHITESPACE: bool -WIDE_CHARS_MODE: bool -multiline_formats: dict[str, str] -tabulate_formats: list[str] - -class Line(NamedTuple): - begin: str - hline: str - sep: str - end: str - -class DataRow(NamedTuple): - begin: str - sep: str - end: str - -_TableFormatLine = Union[None, Line, Callable[[List[int], List[str]], str]] -_TableFormatRow = Union[None, DataRow, Callable[[List[Any], List[int], List[str]], str]] - -class TableFormat(NamedTuple): - lineabove: _TableFormatLine - linebelowheader: _TableFormatLine - linebetweenrows: _TableFormatLine - linebelow: _TableFormatLine - headerrow: _TableFormatRow - datarow: _TableFormatRow - padding: int - with_header_hide: Container[str] | None - -def simple_separated_format(separator: str) -> TableFormat: ... -def tabulate( - tabular_data: Mapping[str, Iterable[Any]] | Iterable[Iterable[Any]], - headers: str | dict[str, str] | Sequence[str] = ..., - tablefmt: str | TableFormat = ..., - floatfmt: str | Iterable[str] = ..., - numalign: str | None = ..., - stralign: str | None = ..., - missingval: str | Iterable[str] = ..., - showindex: str | bool | Iterable[Any] = ..., - disable_numparse: bool | Iterable[int] = ..., - colalign: Iterable[str | None] | None = ..., -) -> str: ... diff --git a/stubs/tabulate/tabulate/__init__.pyi b/stubs/tabulate/tabulate/__init__.pyi new file mode 100644 index 0000000..ff023bc --- /dev/null +++ b/stubs/tabulate/tabulate/__init__.pyi @@ -0,0 +1,54 @@ +from collections.abc import Callable, Container, Iterable, Mapping, Sequence +from typing import Any, NamedTuple +from typing_extensions import TypeAlias + +__version__: str + +LATEX_ESCAPE_RULES: dict[str, str] +MIN_PADDING: int +PRESERVE_WHITESPACE: bool +WIDE_CHARS_MODE: bool +multiline_formats: dict[str, str] +tabulate_formats: list[str] + +class Line(NamedTuple): + begin: str + hline: str + sep: str + end: str + +class DataRow(NamedTuple): + begin: str + sep: str + end: str + +_TableFormatLine: TypeAlias = None | Line | Callable[[list[int], list[str]], str] +_TableFormatRow: TypeAlias = None | DataRow | Callable[[list[Any], list[int], list[str]], str] + +class TableFormat(NamedTuple): + lineabove: _TableFormatLine + linebelowheader: _TableFormatLine + linebetweenrows: _TableFormatLine + linebelow: _TableFormatLine + headerrow: _TableFormatRow + datarow: _TableFormatRow + padding: int + with_header_hide: Container[str] | None + +def simple_separated_format(separator: str) -> TableFormat: ... +def tabulate( + tabular_data: Mapping[str, Iterable[Any]] | Iterable[Iterable[Any]], + headers: str | dict[str, str] | Sequence[str] = ..., + tablefmt: str | TableFormat = ..., + floatfmt: str | Iterable[str] = ..., + intfmt: str | Iterable[str] = ..., + numalign: str | None = ..., + stralign: str | None = ..., + missingval: str | Iterable[str] = ..., + showindex: str | bool | Iterable[Any] = ..., + disable_numparse: bool | Iterable[int] = ..., + colalign: Iterable[str | None] | None = ..., + maxcolwidths: int | Iterable[int | None] | None = ..., + rowalign: str | Iterable[str] | None = ..., + maxheadercolwidths: int | Iterable[int] | None = ..., +) -> str: ... diff --git a/stubs/tabulate/tabulate/version.pyi b/stubs/tabulate/tabulate/version.pyi new file mode 100644 index 0000000..c07756e --- /dev/null +++ b/stubs/tabulate/tabulate/version.pyi @@ -0,0 +1,3 @@ +version: str +version_tuple: tuple[int, int, int] +__version_tuple__: tuple[int, int, int] diff --git a/stubs/termcolor/METADATA.toml b/stubs/termcolor/METADATA.toml index cf311fd..2d2c9e9 100644 --- a/stubs/termcolor/METADATA.toml +++ b/stubs/termcolor/METADATA.toml @@ -1,2 +1,5 @@ -version = "1.1" -python2 = true +version = "1.1.*" +obsolete_since = "2.0.0" # Released on 2022-09-11 + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/termcolor/termcolor.pyi b/stubs/termcolor/termcolor.pyi index 534ae27..71350db 100644 --- a/stubs/termcolor/termcolor.pyi +++ b/stubs/termcolor/termcolor.pyi @@ -1,11 +1,14 @@ -from typing import Any, Iterable, Text +from collections.abc import Iterable +from typing import Any +__ALL__: list[str] +VERSION: tuple[int, ...] ATTRIBUTES: dict[str, int] COLORS: dict[str, int] HIGHLIGHTS: dict[str, int] RESET: str -def colored(text: Text, color: Text | None = ..., on_color: Text | None = ..., attrs: Iterable[Text] | None = ...) -> Text: ... +def colored(text: str, color: str | None = ..., on_color: str | None = ..., attrs: Iterable[str] | None = ...) -> str: ... def cprint( - text: Text, color: Text | None = ..., on_color: Text | None = ..., attrs: Iterable[Text] | None = ..., **kwargs: Any + text: str, color: str | None = ..., on_color: str | None = ..., attrs: Iterable[str] | None = ..., **kwargs: Any ) -> None: ... diff --git a/stubs/toml/@tests/stubtest_allowlist.txt b/stubs/toml/@tests/stubtest_allowlist.txt deleted file mode 100644 index 83e897d..0000000 --- a/stubs/toml/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,5 +0,0 @@ -toml.TomlDecodeError.__init__ -toml.dump -toml.dumps -toml.load -toml.loads diff --git a/stubs/toml/METADATA.toml b/stubs/toml/METADATA.toml index b4e82d6..5c7ed21 100644 --- a/stubs/toml/METADATA.toml +++ b/stubs/toml/METADATA.toml @@ -1,2 +1 @@ -version = "0.10" -python2 = true +version = "0.10.*" diff --git a/stubs/toml/toml.pyi b/stubs/toml/toml.pyi deleted file mode 100644 index 3f8580b..0000000 --- a/stubs/toml/toml.pyi +++ /dev/null @@ -1,19 +0,0 @@ -import sys -from _typeshed import StrPath, SupportsWrite -from typing import IO, Any, Mapping, MutableMapping, Text, Type, Union - -if sys.version_info >= (3, 6): - _PathLike = StrPath -elif sys.version_info >= (3, 4): - import pathlib - - _PathLike = Union[StrPath, pathlib.PurePath] -else: - _PathLike = StrPath - -class TomlDecodeError(Exception): ... - -def load(f: _PathLike | list[Text] | IO[str], _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... -def loads(s: Text, _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... -def dump(o: Mapping[str, Any], f: SupportsWrite[str]) -> str: ... -def dumps(o: Mapping[str, Any]) -> str: ... diff --git a/stubs/toml/toml/__init__.pyi b/stubs/toml/toml/__init__.pyi new file mode 100644 index 0000000..61bf348 --- /dev/null +++ b/stubs/toml/toml/__init__.pyi @@ -0,0 +1,18 @@ +from . import decoder as decoder, encoder as encoder +from .decoder import ( + TomlDecodeError as TomlDecodeError, + TomlDecoder as TomlDecoder, + TomlPreserveCommentDecoder as TomlPreserveCommentDecoder, + load as load, + loads as loads, +) +from .encoder import ( + TomlArraySeparatorEncoder as TomlArraySeparatorEncoder, + TomlEncoder as TomlEncoder, + TomlNumpyEncoder as TomlNumpyEncoder, + TomlPathlibEncoder as TomlPathlibEncoder, + TomlPreserveCommentEncoder as TomlPreserveCommentEncoder, + TomlPreserveInlineDictEncoder as TomlPreserveInlineDictEncoder, + dump as dump, + dumps as dumps, +) diff --git a/stubs/toml/toml/decoder.pyi b/stubs/toml/toml/decoder.pyi new file mode 100644 index 0000000..a492ac9 --- /dev/null +++ b/stubs/toml/toml/decoder.pyi @@ -0,0 +1,70 @@ +from _typeshed import SupportsRead +from collections.abc import Callable, MutableMapping +from pathlib import PurePath +from re import Pattern +from typing import Any, Generic, TypeVar, overload +from typing_extensions import TypeAlias + +_MutableMappingT = TypeVar("_MutableMappingT", bound=MutableMapping[str, Any]) +_PathLike: TypeAlias = str | bytes | PurePath + +FNFError = FileNotFoundError +TIME_RE: Pattern[str] + +class TomlDecodeError(ValueError): + msg: str + doc: str + pos: int + lineno: int + colno: int + def __init__(self, msg: str, doc: str, pos: int) -> None: ... + +class CommentValue: + val: Any + comment: str + def __init__(self, val: Any, comment: str, beginline: bool, _dict: type[MutableMapping[str, Any]]) -> None: ... + def __getitem__(self, key: Any) -> Any: ... + def __setitem__(self, key: Any, value: Any) -> None: ... + def dump(self, dump_value_func: Callable[[Any], str]) -> str: ... + +@overload +def load( + f: _PathLike | list[Any] | SupportsRead[str], # list[_PathLike] is invariance + _dict: type[_MutableMappingT], + decoder: TomlDecoder[_MutableMappingT] | None = ..., +) -> _MutableMappingT: ... +@overload +def load( + f: _PathLike | list[Any] | SupportsRead[str], # list[_PathLike] is invariance + _dict: type[dict[str, Any]] = ..., + decoder: TomlDecoder[dict[str, Any]] | None = ..., +) -> dict[str, Any]: ... +@overload +def loads(s: str, _dict: type[_MutableMappingT], decoder: TomlDecoder[_MutableMappingT] | None = ...) -> _MutableMappingT: ... +@overload +def loads(s: str, _dict: type[dict[str, Any]] = ..., decoder: TomlDecoder[dict[str, Any]] | None = ...) -> dict[str, Any]: ... + +class InlineTableDict: ... + +class TomlDecoder(Generic[_MutableMappingT]): + _dict: type[_MutableMappingT] + @overload + def __init__(self, _dict: type[_MutableMappingT]) -> None: ... + @overload + def __init__(self: TomlDecoder[dict[str, Any]], _dict: type[dict[str, Any]] = ...) -> None: ... + def get_empty_table(self) -> _MutableMappingT: ... + def get_empty_inline_table(self) -> InlineTableDict: ... # incomplete python/typing#213 + def load_inline_object( + self, line: str, currentlevel: _MutableMappingT, multikey: bool = ..., multibackslash: bool = ... + ) -> None: ... + def load_line( + self, line: str, currentlevel: _MutableMappingT, multikey: bool | None, multibackslash: bool + ) -> tuple[bool | None, str, bool] | None: ... + def load_value(self, v: str, strictly_valid: bool = ...) -> tuple[Any, str]: ... + def bounded_string(self, s: str) -> bool: ... + def load_array(self, a: str) -> list[Any]: ... + def preserve_comment(self, line_no: int, key: str, comment: str, beginline: bool) -> None: ... + def embed_comments(self, idx: int, currentlevel: _MutableMappingT) -> None: ... + +class TomlPreserveCommentDecoder(TomlDecoder[_MutableMappingT]): + saved_comments: dict[int, tuple[str, str, bool]] diff --git a/stubs/toml/toml/encoder.pyi b/stubs/toml/toml/encoder.pyi new file mode 100644 index 0000000..992b18e --- /dev/null +++ b/stubs/toml/toml/encoder.pyi @@ -0,0 +1,45 @@ +from _typeshed import SupportsWrite +from collections.abc import Callable, Iterable, Mapping, MutableMapping +from typing import Any, Generic, TypeVar, overload + +_MappingT = TypeVar("_MappingT", bound=Mapping[str, Any]) + +def dump(o: _MappingT, f: SupportsWrite[str], encoder: TomlEncoder[_MappingT] | None = ...) -> str: ... +def dumps(o: _MappingT, encoder: TomlEncoder[_MappingT] | None = ...) -> str: ... + +class TomlEncoder(Generic[_MappingT]): + _dict: type[_MappingT] + preserve: bool + dump_funcs: MutableMapping[type[Any], Callable[[Any], str]] + @overload + def __init__(self, _dict: type[_MappingT], preserve: bool = ...) -> None: ... + @overload + def __init__(self: TomlEncoder[dict[str, Any]], _dict: type[dict[str, Any]] = ..., preserve: bool = ...) -> None: ... + def get_empty_table(self) -> _MappingT: ... + def dump_list(self, v: Iterable[object]) -> str: ... + def dump_inline_table(self, section: dict[str, Any] | Any) -> str: ... + def dump_value(self, v: Any) -> str: ... + def dump_sections(self, o: _MappingT, sup: str) -> tuple[str, _MappingT]: ... + +class TomlPreserveInlineDictEncoder(TomlEncoder[_MappingT]): + @overload + def __init__(self, _dict: type[_MappingT]) -> None: ... + @overload + def __init__(self: TomlPreserveInlineDictEncoder[dict[str, Any]], _dict: type[dict[str, Any]] = ...) -> None: ... + +class TomlArraySeparatorEncoder(TomlEncoder[_MappingT]): + separator: str + @overload + def __init__(self, _dict: type[_MappingT], preserve: bool = ..., separator: str = ...) -> None: ... + @overload + def __init__( + self: TomlArraySeparatorEncoder[dict[str, Any]], + _dict: type[dict[str, Any]] = ..., + preserve: bool = ..., + separator: str = ..., + ) -> None: ... + def dump_list(self, v: Iterable[Any]) -> str: ... + +class TomlNumpyEncoder(TomlEncoder[_MappingT]): ... +class TomlPreserveCommentEncoder(TomlEncoder[_MappingT]): ... +class TomlPathlibEncoder(TomlEncoder[_MappingT]): ... diff --git a/stubs/toml/toml/ordered.pyi b/stubs/toml/toml/ordered.pyi new file mode 100644 index 0000000..1c2f223 --- /dev/null +++ b/stubs/toml/toml/ordered.pyi @@ -0,0 +1,11 @@ +from collections import OrderedDict +from typing import Any + +from .decoder import TomlDecoder +from .encoder import TomlEncoder + +class TomlOrderedDecoder(TomlDecoder[OrderedDict[str, Any]]): + def __init__(self) -> None: ... + +class TomlOrderedEncoder(TomlEncoder[OrderedDict[str, Any]]): + def __init__(self) -> None: ... diff --git a/stubs/toml/toml/tz.pyi b/stubs/toml/toml/tz.pyi new file mode 100644 index 0000000..398a3e5 --- /dev/null +++ b/stubs/toml/toml/tz.pyi @@ -0,0 +1,10 @@ +from _typeshed import Self +from datetime import datetime, timedelta, tzinfo +from typing import Any + +class TomlTz(tzinfo): + def __init__(self, toml_offset: str) -> None: ... + def __deepcopy__(self: Self, memo: Any) -> Self: ... + def tzname(self, dt: datetime | None) -> str: ... + def utcoffset(self, dt: datetime | None) -> timedelta: ... + def dst(self, dt: datetime | None) -> timedelta: ... diff --git a/stubs/toposort/METADATA.toml b/stubs/toposort/METADATA.toml index 83bb457..2312745 100644 --- a/stubs/toposort/METADATA.toml +++ b/stubs/toposort/METADATA.toml @@ -1 +1,4 @@ -version = "1.6" +version = "1.7" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/toposort/toposort.pyi b/stubs/toposort/toposort.pyi index 9410d82..76af531 100644 --- a/stubs/toposort/toposort.pyi +++ b/stubs/toposort/toposort.pyi @@ -1,10 +1,17 @@ -from typing import Any, Iterator, TypeVar +from _typeshed import SupportsItems +from collections.abc import Iterable, Iterator +from typing import Any, Protocol, TypeVar +_KT_co = TypeVar("_KT_co", covariant=True) +_VT_co = TypeVar("_VT_co", covariant=True) _T = TypeVar("_T") +class _SupportsItemsAndLen(SupportsItems[_KT_co, _VT_co], Protocol[_KT_co, _VT_co]): + def __len__(self) -> int: ... + class CircularDependencyError(ValueError): data: dict[Any, set[Any]] def __init__(self, data: dict[Any, set[Any]]) -> None: ... -def toposort(data: dict[_T, set[_T]]) -> Iterator[set[_T]]: ... -def toposort_flatten(data: dict[_T, set[_T]], sort: bool = ...) -> list[_T]: ... +def toposort(data: _SupportsItemsAndLen[_T, Iterable[_T]]) -> Iterator[set[_T]]: ... +def toposort_flatten(data: _SupportsItemsAndLen[_T, Iterable[_T]], sort: bool = ...) -> list[_T]: ... diff --git a/stubs/tqdm/@tests/requirements-stubtest.txt b/stubs/tqdm/@tests/requirements-stubtest.txt new file mode 100644 index 0000000..5f9b957 --- /dev/null +++ b/stubs/tqdm/@tests/requirements-stubtest.txt @@ -0,0 +1,4 @@ +tensorflow +pandas +dask +rich diff --git a/stubs/tqdm/@tests/stubtest_allowlist.txt b/stubs/tqdm/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..aff04d2 --- /dev/null +++ b/stubs/tqdm/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +tqdm.contrib.discord diff --git a/stubs/tqdm/METADATA.toml b/stubs/tqdm/METADATA.toml new file mode 100644 index 0000000..8b856db --- /dev/null +++ b/stubs/tqdm/METADATA.toml @@ -0,0 +1,4 @@ +version = "4.64.*" + +[tool.stubtest] +extras = ["slack", "telegram"] diff --git a/stubs/tqdm/tqdm/__init__.pyi b/stubs/tqdm/tqdm/__init__.pyi new file mode 100644 index 0000000..a48d6f4 --- /dev/null +++ b/stubs/tqdm/tqdm/__init__.pyi @@ -0,0 +1,41 @@ +from _typeshed import Incomplete + +from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning +from ._tqdm_pandas import tqdm_pandas as tqdm_pandas +from .cli import main as main +from .gui import tqdm as tqdm_gui, trange as tgrange +from .notebook import tqdm_notebook as tqdm_notebook_cls +from .std import ( + TqdmDeprecationWarning as TqdmDeprecationWarning, + TqdmExperimentalWarning as TqdmExperimentalWarning, + TqdmKeyError as TqdmKeyError, + TqdmMonitorWarning as TqdmMonitorWarning, + TqdmTypeError as TqdmTypeError, + TqdmWarning as TqdmWarning, + tqdm as tqdm, + trange as trange, +) +from .version import __version__ as __version__ + +__all__ = [ + "tqdm", + "tqdm_gui", + "trange", + "tgrange", + "tqdm_pandas", + "tqdm_notebook", + "tnrange", + "main", + "TMonitor", + "TqdmTypeError", + "TqdmKeyError", + "TqdmWarning", + "TqdmDeprecationWarning", + "TqdmExperimentalWarning", + "TqdmMonitorWarning", + "TqdmSynchronisationWarning", + "__version__", +] + +def tqdm_notebook(*args, **kwargs) -> tqdm_notebook_cls[Incomplete]: ... +def tnrange(*args, **kwargs) -> tqdm_notebook_cls[int]: ... diff --git a/stubs/tqdm/tqdm/_dist_ver.pyi b/stubs/tqdm/tqdm/_dist_ver.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/tqdm/tqdm/_main.pyi b/stubs/tqdm/tqdm/_main.pyi new file mode 100644 index 0000000..81525aa --- /dev/null +++ b/stubs/tqdm/tqdm/_main.pyi @@ -0,0 +1,4 @@ +from .cli import * + +# Names in __all__ with no definition: +# main diff --git a/stubs/tqdm/tqdm/_monitor.pyi b/stubs/tqdm/tqdm/_monitor.pyi new file mode 100644 index 0000000..bb8ee47 --- /dev/null +++ b/stubs/tqdm/tqdm/_monitor.pyi @@ -0,0 +1,18 @@ +from _typeshed import Incomplete +from threading import Thread + +__all__ = ["TMonitor", "TqdmSynchronisationWarning"] + +class TqdmSynchronisationWarning(RuntimeWarning): ... + +class TMonitor(Thread): + daemon: bool + woken: int + tqdm_cls: type[Incomplete] + sleep_interval: float + was_killed: Incomplete + def __init__(self, tqdm_cls: type[Incomplete], sleep_interval: float) -> None: ... + def exit(self): ... + def get_instances(self): ... + def run(self) -> None: ... + def report(self): ... diff --git a/stubs/tqdm/tqdm/_tqdm.pyi b/stubs/tqdm/tqdm/_tqdm.pyi new file mode 100644 index 0000000..e279683 --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm.pyi @@ -0,0 +1,11 @@ +from .std import * +from .std import TqdmDeprecationWarning as TqdmDeprecationWarning + +# Names in __all__ with no definition: +# TqdmExperimentalWarning +# TqdmKeyError +# TqdmMonitorWarning +# TqdmTypeError +# TqdmWarning +# tqdm +# trange diff --git a/stubs/tqdm/tqdm/_tqdm_gui.pyi b/stubs/tqdm/tqdm/_tqdm_gui.pyi new file mode 100644 index 0000000..4c489bd --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm_gui.pyi @@ -0,0 +1,7 @@ +from .gui import * + +# Names in __all__ with no definition: +# tgrange +# tqdm +# tqdm_gui +# trange diff --git a/stubs/tqdm/tqdm/_tqdm_notebook.pyi b/stubs/tqdm/tqdm/_tqdm_notebook.pyi new file mode 100644 index 0000000..5c9a361 --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm_notebook.pyi @@ -0,0 +1,7 @@ +from .notebook import * + +# Names in __all__ with no definition: +# tnrange +# tqdm +# tqdm_notebook +# trange diff --git a/stubs/tqdm/tqdm/_tqdm_pandas.pyi b/stubs/tqdm/tqdm/_tqdm_pandas.pyi new file mode 100644 index 0000000..9f48444 --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm_pandas.pyi @@ -0,0 +1,3 @@ +__all__ = ["tqdm_pandas"] + +def tqdm_pandas(tclass, **tqdm_kwargs) -> None: ... diff --git a/stubs/tqdm/tqdm/_utils.pyi b/stubs/tqdm/tqdm/_utils.pyi new file mode 100644 index 0000000..2d60c39 --- /dev/null +++ b/stubs/tqdm/tqdm/_utils.pyi @@ -0,0 +1,10 @@ +from .std import TqdmDeprecationWarning as TqdmDeprecationWarning +from .utils import ( + CUR_OS as CUR_OS, + IS_NIX as IS_NIX, + IS_WIN as IS_WIN, + RE_ANSI as RE_ANSI, + Comparable as Comparable, + FormatReplace as FormatReplace, + SimpleTextIOWrapper as SimpleTextIOWrapper, +) diff --git a/stubs/tqdm/tqdm/asyncio.pyi b/stubs/tqdm/tqdm/asyncio.pyi new file mode 100644 index 0000000..bea159a --- /dev/null +++ b/stubs/tqdm/tqdm/asyncio.pyi @@ -0,0 +1,208 @@ +from _typeshed import Incomplete, Self, SupportsWrite +from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm + +__all__ = ["tqdm_asyncio", "tarange", "tqdm", "trange"] + +_T = TypeVar("_T") + +class tqdm_asyncio(Generic[_T], std_tqdm[_T]): + iterable_awaitable: bool + iterable_next: Callable[[], _T | Awaitable[_T]] + iterable_iterator: Iterator[_T] + + def __aiter__(self: Self) -> Self: ... + async def __anext__(self) -> Awaitable[_T]: ... + def send(self, *args, **kwargs): ... + @classmethod + def as_completed( + cls, + fs: Iterable[Awaitable[_T]], + *, + loop: bool | None = ..., + timeout: float | None = ..., + total: int | None = ..., + desc: str | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ) -> Generator[Incomplete, Incomplete, None]: ... + @classmethod + async def gather( + cls, + *fs: Awaitable[_T], + loop: bool | None = ..., + timeout: float | None = ..., + total: int | None = ..., + iterable: Iterable[_T] = ..., + desc: str | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ): ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_asyncio[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + +@overload +def tarange( + start: int, + stop: int, + step: int | None = ..., + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm_asyncio[int]: ... +@overload +def tarange( + stop: int, + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm_asyncio[int]: ... + +tqdm = tqdm_asyncio +trange = tarange diff --git a/stubs/tqdm/tqdm/auto.pyi b/stubs/tqdm/tqdm/auto.pyi new file mode 100644 index 0000000..037ba24 --- /dev/null +++ b/stubs/tqdm/tqdm/auto.pyi @@ -0,0 +1,3 @@ +from .asyncio import tqdm as tqdm, trange as trange + +__all__ = ["tqdm", "trange"] diff --git a/stubs/tqdm/tqdm/autonotebook.pyi b/stubs/tqdm/tqdm/autonotebook.pyi new file mode 100644 index 0000000..2e610d5 --- /dev/null +++ b/stubs/tqdm/tqdm/autonotebook.pyi @@ -0,0 +1,3 @@ +from .std import tqdm as tqdm, trange as trange + +__all__ = ["tqdm", "trange"] diff --git a/stubs/tqdm/tqdm/cli.pyi b/stubs/tqdm/tqdm/cli.pyi new file mode 100644 index 0000000..742ea29 --- /dev/null +++ b/stubs/tqdm/tqdm/cli.pyi @@ -0,0 +1,5 @@ +from collections.abc import Sequence + +__all__ = ["main"] + +def main(fp=..., argv: Sequence[str] | None = ...) -> None: ... diff --git a/stubs/tqdm/tqdm/contrib/__init__.pyi b/stubs/tqdm/tqdm/contrib/__init__.pyi new file mode 100644 index 0000000..fd7f096 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/__init__.pyi @@ -0,0 +1,15 @@ +from _typeshed import Incomplete +from collections.abc import Callable, Generator + +from ..utils import ObjectWrapper + +__all__ = ["tenumerate", "tzip", "tmap"] + +class DummyTqdmFile(ObjectWrapper): + def __init__(self, wrapped) -> None: ... + def write(self, x, nolock: bool = ...) -> None: ... + def __del__(self) -> None: ... + +def tenumerate(iterable, start: int = ..., total: Incomplete | None = ..., tqdm_class: type[Incomplete] = ..., **tqdm_kwargs): ... +def tzip(iter1, *iter2plus, **tqdm_kwargs) -> Generator[Incomplete, None, None]: ... +def tmap(function: Callable[..., Incomplete], *sequences, **tqdm_kwargs) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/tqdm/tqdm/contrib/bells.pyi b/stubs/tqdm/tqdm/contrib/bells.pyi new file mode 100644 index 0000000..97e27c8 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/bells.pyi @@ -0,0 +1,3 @@ +from ..auto import tqdm as tqdm, trange as trange + +__all__ = ["tqdm", "trange"] diff --git a/stubs/tqdm/tqdm/contrib/concurrent.pyi b/stubs/tqdm/tqdm/contrib/concurrent.pyi new file mode 100644 index 0000000..40e070a --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/concurrent.pyi @@ -0,0 +1,4 @@ +__all__ = ["thread_map", "process_map"] + +def thread_map(fn, *iterables, **tqdm_kwargs): ... +def process_map(fn, *iterables, **tqdm_kwargs): ... diff --git a/stubs/tqdm/tqdm/contrib/discord.pyi b/stubs/tqdm/tqdm/contrib/discord.pyi new file mode 100644 index 0000000..05133f0 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/discord.pyi @@ -0,0 +1,95 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from ..auto import tqdm as tqdm_auto +from .utils_worker import MonoWorker + +__all__ = ["DiscordIO", "tqdm_discord", "tdrange", "tqdm", "trange"] + +class DiscordIO(MonoWorker): + text: Incomplete + message: Incomplete + def __init__(self, token, channel_id) -> None: ... + def write(self, s): ... + +_T = TypeVar("_T") + +class tqdm_discord(Generic[_T], tqdm_auto[_T]): + dio: Incomplete + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_discord[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + def display( + self, + msg: str | None = ..., + pos: int | None = ..., + close: bool = ..., + bar_style: Incomplete = ..., + check_delay: bool = ..., + ) -> None: ... + def clear(self, *args, **kwargs) -> None: ... + +def tdrange(*args, **kwargs) -> tqdm_discord[int]: ... + +tqdm = tqdm_discord +trange = tdrange diff --git a/stubs/tqdm/tqdm/contrib/itertools.pyi b/stubs/tqdm/tqdm/contrib/itertools.pyi new file mode 100644 index 0000000..991181f --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/itertools.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete +from collections.abc import Generator, Iterable + +__all__ = ["product"] + +def product(*iterables: Iterable[Incomplete], **tqdm_kwargs) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/tqdm/tqdm/contrib/logging.pyi b/stubs/tqdm/tqdm/contrib/logging.pyi new file mode 100644 index 0000000..0bb9e0e --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/logging.pyi @@ -0,0 +1,21 @@ +import logging +from _typeshed import Incomplete +from collections.abc import Callable, Sequence +from contextlib import _GeneratorContextManager +from typing import Any, TypeVar, overload + +from ..std import tqdm as std_tqdm + +_TqdmT = TypeVar("_TqdmT", bound=std_tqdm[Any]) + +def logging_redirect_tqdm( + loggers: Sequence[logging.Logger] | None = ..., tqdm_class: type[std_tqdm[Any]] = ... +) -> _GeneratorContextManager[None]: ... + +# TODO type *args, **kwargs here more precisely +# The type ignore is because mypy complains that the second overload will never be matched +# (I'm not sure that's true) +@overload +def tqdm_logging_redirect(*args, tqdm_class: Callable[..., _TqdmT], **kwargs) -> _GeneratorContextManager[_TqdmT]: ... +@overload +def tqdm_logging_redirect(*args, **kwargs) -> _GeneratorContextManager[std_tqdm[Incomplete]]: ... # type: ignore[misc] diff --git a/stubs/tqdm/tqdm/contrib/slack.pyi b/stubs/tqdm/tqdm/contrib/slack.pyi new file mode 100644 index 0000000..b08e68b --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/slack.pyi @@ -0,0 +1,93 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from ..auto import tqdm as tqdm_auto +from .utils_worker import MonoWorker + +__all__ = ["SlackIO", "tqdm_slack", "tsrange", "tqdm", "trange"] + +class SlackIO(MonoWorker): + client: Incomplete + text: Incomplete + message: Incomplete + def __init__(self, token, channel) -> None: ... + def write(self, s): ... + +_T = TypeVar("_T") + +class tqdm_slack(Generic[_T], tqdm_auto[_T]): + sio: Incomplete + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + token: str = ..., + channel: int = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_slack[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + token: str = ..., + channel: int = ..., + **kwargs, + ) -> None: ... + def display(self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style: Incomplete = ..., check_delay: bool = ...) -> None: ... # type: ignore[override] + def clear(self, *args, **kwargs) -> None: ... + +def tsrange(*args, **kwargs) -> tqdm_slack[int]: ... + +tqdm = tqdm_slack +trange = tsrange diff --git a/stubs/tqdm/tqdm/contrib/telegram.pyi b/stubs/tqdm/tqdm/contrib/telegram.pyi new file mode 100644 index 0000000..4f78e24 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/telegram.pyi @@ -0,0 +1,99 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from ..auto import tqdm as tqdm_auto +from .utils_worker import MonoWorker + +__all__ = ["TelegramIO", "tqdm_telegram", "ttgrange", "tqdm", "trange"] + +class TelegramIO(MonoWorker): + API: str + token: Incomplete + chat_id: Incomplete + session: Incomplete + text: Incomplete + def __init__(self, token, chat_id) -> None: ... + @property + def message_id(self): ... + def write(self, s: str) -> Incomplete | None: ... + def delete(self): ... + +_T = TypeVar("_T") + +class tqdm_telegram(Generic[_T], tqdm_auto[_T]): + tgio: Incomplete + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + token: str = ..., + chat_id: str = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_telegram[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + token: str = ..., + chat_id: str = ..., + **kwargs, + ) -> None: ... + def display(self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style: Incomplete = ..., check_delay: bool = ...) -> None: ... # type: ignore[override] + def clear(self, *args, **kwargs) -> None: ... + def close(self) -> None: ... + +def ttgrange(*args, **kwargs) -> tqdm_telegram[int]: ... + +tqdm = tqdm_telegram +trange = ttgrange diff --git a/stubs/tqdm/tqdm/contrib/utils_worker.pyi b/stubs/tqdm/tqdm/contrib/utils_worker.pyi new file mode 100644 index 0000000..bff8262 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/utils_worker.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete +from collections import deque +from collections.abc import Callable +from concurrent.futures import Future, ThreadPoolExecutor +from typing import TypeVar +from typing_extensions import ParamSpec + +__all__ = ["MonoWorker"] + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +class MonoWorker: + pool: ThreadPoolExecutor + futures: deque[Future[Incomplete]] + def submit(self, func: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> Future[_R]: ... diff --git a/stubs/tqdm/tqdm/dask.pyi b/stubs/tqdm/tqdm/dask.pyi new file mode 100644 index 0000000..2509750 --- /dev/null +++ b/stubs/tqdm/tqdm/dask.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete +from typing import Any +from typing_extensions import TypeAlias + +__all__ = ["TqdmCallback"] + +_Callback: TypeAlias = Any # Actually dask.callbacks.Callback + +class TqdmCallback(_Callback): + tqdm_class: type[Incomplete] + def __init__( + self, start: Incomplete | None = ..., pretask: Incomplete | None = ..., tqdm_class: type[Incomplete] = ..., **tqdm_kwargs + ) -> None: ... + def display(self) -> None: ... diff --git a/stubs/tqdm/tqdm/gui.pyi b/stubs/tqdm/tqdm/gui.pyi new file mode 100644 index 0000000..8d34133 --- /dev/null +++ b/stubs/tqdm/tqdm/gui.pyi @@ -0,0 +1,92 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm + +__all__ = ["tqdm_gui", "tgrange", "tqdm", "trange"] + +_T = TypeVar("_T") + +class tqdm_gui(Generic[_T], std_tqdm[_T]): + mpl: Incomplete + plt: Incomplete + toolbar: Incomplete + mininterval: Incomplete + xdata: Incomplete + ydata: Incomplete + zdata: Incomplete + hspan: Incomplete + wasion: Incomplete + ax: Incomplete + disable: bool + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def display(self, *_, **__) -> None: ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_gui[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + +def tgrange(*args, **kwargs) -> tqdm_gui[int]: ... + +tqdm = tqdm_gui +trange = tgrange diff --git a/stubs/tqdm/tqdm/keras.pyi b/stubs/tqdm/tqdm/keras.pyi new file mode 100644 index 0000000..0a5f5c7 --- /dev/null +++ b/stubs/tqdm/tqdm/keras.pyi @@ -0,0 +1,31 @@ +from _typeshed import Incomplete +from typing import Any +from typing_extensions import TypeAlias + +__all__ = ["TqdmCallback"] + +_Callback: TypeAlias = Any # Actually tensorflow.keras.callbacks.Callback + +class TqdmCallback(_Callback): + @staticmethod + def bar2callback(bar, pop: Incomplete | None = ..., delta=...): ... + tqdm_class: Incomplete + epoch_bar: Incomplete + on_epoch_end: Incomplete + batches: Incomplete + verbose: Incomplete + batch_bar: Incomplete + on_batch_end: Incomplete + def __init__( + self, + epochs: Incomplete | None = ..., + data_size: Incomplete | None = ..., + batch_size: Incomplete | None = ..., + verbose: int = ..., + tqdm_class=..., + **tqdm_kwargs, + ) -> None: ... + def on_train_begin(self, *_, **__) -> None: ... + def on_epoch_begin(self, epoch, *_, **__) -> None: ... + def on_train_end(self, *_, **__) -> None: ... + def display(self) -> None: ... diff --git a/stubs/tqdm/tqdm/notebook.pyi b/stubs/tqdm/tqdm/notebook.pyi new file mode 100644 index 0000000..dbd7855 --- /dev/null +++ b/stubs/tqdm/tqdm/notebook.pyi @@ -0,0 +1,101 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Iterator, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm, trange as trange + +__all__ = ["tqdm_notebook", "tnrange", "tqdm", "trange"] + +_T = TypeVar("_T") + +class tqdm_notebook(Generic[_T], std_tqdm[_T]): + @staticmethod + def status_printer( + _: SupportsWrite[str] | None, total: float | None = ..., desc: str | None = ..., ncols: int | None = ... + ): ... + displayed: bool + def display( + self, + msg: str | None = ..., + pos: int | None = ..., + close: bool = ..., + bar_style: str | None = ..., + check_delay: bool = ..., + ) -> None: ... + @property + def colour(self): ... + @colour.setter + def colour(self, bar_color: str) -> None: ... + disp: Incomplete + ncols: Incomplete + container: Incomplete + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + display: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_notebook[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + display: bool = ..., + **kwargs, + ) -> None: ... + def __iter__(self) -> Iterator[_T]: ... + def update(self, n: int = ...): ... # type: ignore[override] + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def reset(self, total: float | None = ...): ... + +tqdm = tqdm_notebook +tnrange = trange diff --git a/stubs/tqdm/tqdm/rich.pyi b/stubs/tqdm/tqdm/rich.pyi new file mode 100644 index 0000000..a10a5c0 --- /dev/null +++ b/stubs/tqdm/tqdm/rich.pyi @@ -0,0 +1,100 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Any, Generic, NoReturn, TypeVar, overload +from typing_extensions import TypeAlias + +from .std import tqdm as std_tqdm + +__all__ = ["tqdm_rich", "trrange", "tqdm", "trange"] + +_ProgressColumn: TypeAlias = Any # Actually rich.progress.ProgressColumn + +class FractionColumn(_ProgressColumn): + unit_scale: bool + unit_divisor: int + + def __init__(self, unit_scale: bool = ..., unit_divisor: int = ...) -> None: ... + def render(self, task): ... + +class RateColumn(_ProgressColumn): + unit: str + unit_scale: bool + unit_divisor: int + + def __init__(self, unit: str = ..., unit_scale: bool = ..., unit_divisor: int = ...) -> None: ... + def render(self, task): ... + +_T = TypeVar("_T") + +class tqdm_rich(Generic[_T], std_tqdm[_T]): + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def display(self, *_, **__) -> None: ... + def reset(self, total: Incomplete | None = ...) -> None: ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_rich[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + +def trrange(*args, **kwargs) -> tqdm_rich[int]: ... + +tqdm = tqdm_rich +trange = trrange diff --git a/stubs/tqdm/tqdm/std.pyi b/stubs/tqdm/tqdm/std.pyi new file mode 100644 index 0000000..59f2ea1 --- /dev/null +++ b/stubs/tqdm/tqdm/std.pyi @@ -0,0 +1,285 @@ +import contextlib +from _typeshed import Incomplete, Self, SupportsWrite +from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping +from typing import Any, ClassVar, Generic, NoReturn, TypeVar, overload +from typing_extensions import Literal + +from .utils import Comparable + +__all__ = [ + "tqdm", + "trange", + "TqdmTypeError", + "TqdmKeyError", + "TqdmWarning", + "TqdmExperimentalWarning", + "TqdmDeprecationWarning", + "TqdmMonitorWarning", +] + +class TqdmTypeError(TypeError): ... +class TqdmKeyError(KeyError): ... + +class TqdmWarning(Warning): + def __init__(self, msg, fp_write: Incomplete | None = ..., *a, **k) -> None: ... + +class TqdmExperimentalWarning(TqdmWarning, FutureWarning): ... +class TqdmDeprecationWarning(TqdmWarning, DeprecationWarning): ... +class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): ... + +_T = TypeVar("_T") + +class tqdm(Generic[_T], Iterable[_T], Comparable): + monitor_interval: ClassVar[int] + + @staticmethod + def format_sizeof(num: float, suffix: str = ..., divisor: float = ...) -> str: ... + @staticmethod + def format_interval(t: float) -> str: ... + @staticmethod + def format_num(n: float) -> str: ... + @staticmethod + def status_printer(file: SupportsWrite[str]) -> Callable[[str], None]: ... + @staticmethod + def format_meter( + n: float, + total: float, + elapsed: float, + ncols: int | None = ..., + prefix: str | None = ..., + ascii: bool | str | None = ..., + unit: str | None = ..., + unit_scale: bool | float | None = ..., + rate: float | None = ..., + bar_format: str | None = ..., + postfix: str | Mapping[str, object] | None = ..., + unit_divisor: float | None = ..., + initial: float | None = ..., + colour: str | None = ..., + ) -> str: ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + def __new__(cls: type[Self], *_, **__) -> Self: ... + @classmethod + def write(cls, s: str, file: SupportsWrite[str] | None = ..., end: str = ..., nolock: bool = ...) -> None: ... + @classmethod + def external_write_mode( + cls, file: SupportsWrite[str] | None = ..., nolock: bool = ... + ) -> contextlib._GeneratorContextManager[None]: ... + @classmethod + def set_lock(cls, lock) -> None: ... + @classmethod + def get_lock(cls): ... + @classmethod + def pandas( + cls, + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ) -> None: ... + + iterable: Incomplete + disable: Incomplete + pos: Incomplete + n: Incomplete + total: Incomplete + leave: Incomplete + desc: Incomplete + fp: Incomplete + ncols: Incomplete + nrows: Incomplete + mininterval: Incomplete + maxinterval: Incomplete + miniters: Incomplete + dynamic_miniters: Incomplete + ascii: Incomplete + unit: Incomplete + unit_scale: Incomplete + unit_divisor: Incomplete + initial: Incomplete + lock_args: Incomplete + delay: Incomplete + gui: Incomplete + dynamic_ncols: Incomplete + smoothing: Incomplete + bar_format: Incomplete + postfix: Incomplete + colour: Incomplete + last_print_n: Incomplete + sp: Incomplete + last_print_t: Incomplete + start_t: Incomplete + + def __bool__(self) -> bool: ... + def __nonzero__(self) -> bool: ... + def __len__(self) -> int: ... + def __reversed__(self) -> Iterator[_T]: ... + def __contains__(self, item: object) -> bool: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... + def __del__(self) -> None: ... + def __hash__(self) -> int: ... + def __iter__(self) -> Iterator[_T]: ... + def update(self, n: float | None = ...) -> bool | None: ... + def close(self) -> None: ... + def clear(self, nolock: bool = ...) -> None: ... + def refresh( + self, nolock: bool = ..., lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ... + ) -> None: ... + def unpause(self) -> None: ... + def reset(self, total: float | None = ...) -> None: ... + def set_description(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + def set_description_str(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + def set_postfix(self, ordered_dict: Mapping[str, object] | None = ..., refresh: bool | None = ..., **kwargs) -> None: ... + def set_postfix_str(self, s: str = ..., refresh: bool = ...) -> None: ... + def moveto(self, n) -> None: ... + @property + def format_dict(self) -> MutableMapping[str, Any]: ... + def display(self, msg: str | None = ..., pos: int | None = ...) -> None: ... + @classmethod + def wrapattr( + cls, stream, method: Literal["read", "write"], total: float | None = ..., bytes: bool | None = ..., **tqdm_kwargs + ) -> contextlib._GeneratorContextManager[Incomplete]: ... + +@overload +def trange( + start: int, + stop: int, + step: int | None = ..., + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm[int]: ... +@overload +def trange( + stop: int, + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm[int]: ... diff --git a/stubs/tqdm/tqdm/tk.pyi b/stubs/tqdm/tqdm/tk.pyi new file mode 100644 index 0000000..7ae5a2d --- /dev/null +++ b/stubs/tqdm/tqdm/tk.pyi @@ -0,0 +1,93 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm + +__all__ = ["tqdm_tk", "ttkrange", "tqdm", "trange"] + +_T = TypeVar("_T") + +class tqdm_tk(Generic[_T], std_tqdm[_T]): + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + grab=..., + tk_parent=..., + cancel_callback=..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_tk[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool | None = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + grab=..., + tk_parent=..., + cancel_callback=..., + **kwargs, + ) -> None: ... + disable: bool + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def display(self, *_, **__) -> None: ... + def set_description(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + desc: Incomplete + def set_description_str(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + def cancel(self) -> None: ... + def reset(self, total: Incomplete | None = ...) -> None: ... + +def ttkrange(*args, **kwargs) -> tqdm_tk[int]: ... + +tqdm = tqdm_tk +trange = ttkrange diff --git a/stubs/tqdm/tqdm/utils.pyi b/stubs/tqdm/tqdm/utils.pyi new file mode 100644 index 0000000..3055987 --- /dev/null +++ b/stubs/tqdm/tqdm/utils.pyi @@ -0,0 +1,55 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from re import Pattern +from typing import Protocol, TypeVar +from typing_extensions import ParamSpec + +CUR_OS: str +IS_WIN: bool +IS_NIX: bool +RE_ANSI: Pattern[str] + +class FormatReplace: + replace: str + format_called: int + def __init__(self, replace: str = ...) -> None: ... + def __format__(self, _) -> str: ... + +class _Has__Comparable(Protocol): + _comparable: Incomplete + +class Comparable: + _comparable: Incomplete + def __lt__(self, other: _Has__Comparable) -> bool: ... + def __le__(self, other: _Has__Comparable) -> bool: ... + def __eq__(self, other: _Has__Comparable) -> bool: ... # type: ignore[override] + def __ne__(self, other: _Has__Comparable) -> bool: ... # type: ignore[override] + def __gt__(self, other: _Has__Comparable) -> bool: ... + def __ge__(self, other: _Has__Comparable) -> bool: ... + +class ObjectWrapper: + def __getattr__(self, name: str): ... + def __setattr__(self, name: str, value) -> None: ... + def wrapper_getattr(self, name): ... + def wrapper_setattr(self, name, value): ... + def __init__(self, wrapped) -> None: ... + +class SimpleTextIOWrapper(ObjectWrapper): + def __init__(self, wrapped, encoding) -> None: ... + def write(self, s: str): ... + def __eq__(self, other: object) -> bool: ... + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +class DisableOnWriteError(ObjectWrapper): + @staticmethod + def disable_on_exception(tqdm_instance, func: Callable[_P, _R]) -> Callable[_P, _R]: ... + def __init__(self, wrapped, tqdm_instance) -> None: ... + def __eq__(self, other: object) -> bool: ... + +class CallbackIOWrapper(ObjectWrapper): + def __init__(self, callback: Callable[[int], object], stream, method: str = ...) -> None: ... + +def disp_len(data: str) -> int: ... +def disp_trim(data: str, length: int) -> str: ... diff --git a/stubs/tqdm/tqdm/version.pyi b/stubs/tqdm/tqdm/version.pyi new file mode 100644 index 0000000..bda5b5a --- /dev/null +++ b/stubs/tqdm/tqdm/version.pyi @@ -0,0 +1 @@ +__version__: str diff --git a/stubs/tree-sitter-languages/@tests/stubtest_allowlist.txt b/stubs/tree-sitter-languages/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..ba06659 --- /dev/null +++ b/stubs/tree-sitter-languages/@tests/stubtest_allowlist.txt @@ -0,0 +1,5 @@ +# No idea what this is, seems to be auto-generated +tree_sitter_languages.core.__test__ + +# Fails to import and is not supposed to be imported, but stubtest finds it somehow +tree_sitter_languages.languages diff --git a/stubs/tree-sitter-languages/METADATA.toml b/stubs/tree-sitter-languages/METADATA.toml new file mode 100644 index 0000000..0eefa03 --- /dev/null +++ b/stubs/tree-sitter-languages/METADATA.toml @@ -0,0 +1,5 @@ +version = "1.5.*" +requires = ["types-tree-sitter"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/tree-sitter-languages/tree_sitter_languages/__init__.pyi b/stubs/tree-sitter-languages/tree_sitter_languages/__init__.pyi new file mode 100644 index 0000000..59a0838 --- /dev/null +++ b/stubs/tree-sitter-languages/tree_sitter_languages/__init__.pyi @@ -0,0 +1,7 @@ +from .core import get_language as get_language, get_parser as get_parser + +__version__: str +__title__: str +__author__: str +__license__: str +__copyright__: str diff --git a/stubs/tree-sitter-languages/tree_sitter_languages/core.pyi b/stubs/tree-sitter-languages/tree_sitter_languages/core.pyi new file mode 100644 index 0000000..b59c21d --- /dev/null +++ b/stubs/tree-sitter-languages/tree_sitter_languages/core.pyi @@ -0,0 +1,4 @@ +from tree_sitter import Language, Parser + +def get_language(language: str) -> Language: ... +def get_parser(language: str) -> Parser: ... diff --git a/stubs/tree-sitter/@tests/stubtest_allowlist.txt b/stubs/tree-sitter/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..45a56be --- /dev/null +++ b/stubs/tree-sitter/@tests/stubtest_allowlist.txt @@ -0,0 +1,39 @@ +# "self" argument is missing when stubtest inspects these methods +tree_sitter.Node.child_by_field_id +tree_sitter.Node.child_by_field_name +tree_sitter.Node.children_by_field_id +tree_sitter.Node.children_by_field_name +tree_sitter.Node.sexp +tree_sitter.Node.walk +tree_sitter.Parser.parse +tree_sitter.Parser.set_language +tree_sitter.Tree.edit +tree_sitter.Tree.get_changed_ranges +tree_sitter.Tree.walk +tree_sitter.TreeCursor.copy +tree_sitter.TreeCursor.current_field_name +tree_sitter.TreeCursor.goto_first_child +tree_sitter.TreeCursor.goto_next_sibling +tree_sitter.TreeCursor.goto_parent +tree_sitter.binding.Node.child_by_field_id +tree_sitter.binding.Node.child_by_field_name +tree_sitter.binding.Node.children_by_field_id +tree_sitter.binding.Node.children_by_field_name +tree_sitter.binding.Node.sexp +tree_sitter.binding.Node.walk +tree_sitter.binding.Parser.parse +tree_sitter.binding.Parser.set_language +tree_sitter.binding.Query.captures +tree_sitter.binding.Query.matches +tree_sitter.binding.Tree.edit +tree_sitter.binding.Tree.get_changed_ranges +tree_sitter.binding.Tree.walk +tree_sitter.binding.TreeCursor.copy +tree_sitter.binding.TreeCursor.current_field_name +tree_sitter.binding.TreeCursor.goto_first_child +tree_sitter.binding.TreeCursor.goto_next_sibling +tree_sitter.binding.TreeCursor.goto_parent + +# Runtime takes *args and **kwargs and ignores them. Passing arguments is most likely a mistake. +tree_sitter.Parser.__init__ +tree_sitter.binding.Parser.__init__ diff --git a/stubs/tree-sitter/METADATA.toml b/stubs/tree-sitter/METADATA.toml new file mode 100644 index 0000000..997ea09 --- /dev/null +++ b/stubs/tree-sitter/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.20.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/tree-sitter/tree_sitter/__init__.pyi b/stubs/tree-sitter/tree_sitter/__init__.pyi new file mode 100644 index 0000000..d26b176 --- /dev/null +++ b/stubs/tree-sitter/tree_sitter/__init__.pyi @@ -0,0 +1,17 @@ +import ctypes +from _typeshed import StrPath +from collections.abc import Sequence + +# At runtime, Query and Range are available only in tree_sitter.binding +from tree_sitter.binding import Node as Node, Parser as Parser, Query, Tree as Tree, TreeCursor as TreeCursor + +class Language: + @staticmethod + def build_library(output_path: str, repo_paths: Sequence[StrPath]) -> bool: ... + name: str + lib: ctypes.CDLL + language_id: int + # library_path is passed into ctypes LoadLibrary + def __init__(self, library_path: str, name: str) -> None: ... + def field_id_for_name(self, name: str) -> int | None: ... + def query(self, source: str) -> Query: ... diff --git a/stubs/tree-sitter/tree_sitter/binding.pyi b/stubs/tree-sitter/tree_sitter/binding.pyi new file mode 100644 index 0000000..f8d4d32 --- /dev/null +++ b/stubs/tree-sitter/tree_sitter/binding.pyi @@ -0,0 +1,116 @@ +from typing import Any, ClassVar +from typing_extensions import final + +from tree_sitter import Language + +@final +class Node: + @property + def start_byte(self) -> int: ... + @property + def start_point(self) -> tuple[int, int]: ... + @property + def end_byte(self) -> int: ... + @property + def end_point(self) -> tuple[int, int]: ... + @property + def has_changes(self) -> bool: ... + @property + def has_error(self) -> bool: ... + @property + def id(self) -> int: ... + @property + def is_missing(self) -> bool: ... + @property + def is_named(self) -> bool: ... + @property + def child_count(self) -> int: ... + @property + def named_child_count(self) -> bool: ... + @property + def children(self) -> list[Node]: ... + @property + def named_children(self) -> list[Node]: ... + @property + def next_named_sibling(self) -> Node | None: ... + @property + def next_sibling(self) -> Node | None: ... + @property + def parent(self) -> Node | None: ... + @property + def prev_named_sibling(self) -> Node | None: ... + @property + def prev_sibling(self) -> Node | None: ... + @property + def text(self) -> bytes | Any: ... # can be None, but annoying to check + @property + def type(self) -> str: ... + def children_by_field_name(self, name: str) -> list[Node]: ... + def children_by_field_id(self, __id: int) -> list[Node]: ... + def field_name_for_child(self, __child_index: int) -> str: ... + def child_by_field_id(self, __id: int) -> Node | None: ... + def child_by_field_name(self, __name: str) -> Node | None: ... + __hash__: ClassVar[None] # type: ignore[assignment] + def sexp(self) -> str: ... + def walk(self) -> TreeCursor: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + # There are __ge__, __gt__, __le__, __lt__ methods but they always return False + # + # >>> n + # + # >>> n >= "", n <= "", n >= 0, n <= 0, n >= (0,0), n <= (0,0) + # (False, False, False, False, False, False) + +@final +class Parser: + # At runtime, Parser(1, 2, 3) ignores the arguments, but that's most likely buggy code + def __init__(self) -> None: ... + def parse(self, source: bytes, old_tree: Tree | None = ..., keep_text: bool = ...) -> Tree: ... + def set_language(self, __language: Language) -> None: ... + +@final +class Query: + # start_point and end_point arguments don't seem to do anything + # TODO: sync with + # https://github.com/tree-sitter/py-tree-sitter/blob/d3016edac2c33ce647653d896fbfb435ac2a6245/tree_sitter/binding.c#L1304 + def captures(self, node: Node) -> list[tuple[Node, str]]: ... + +@final +class Range: + @property + def start_byte(self) -> int: ... + @property + def end_byte(self) -> int: ... + @property + def start_point(self) -> tuple[int, int]: ... + @property + def end_point(self) -> tuple[int, int]: ... + +@final +class Tree: + @property + def root_node(self) -> Node: ... + @property + def text(self) -> bytes | Any: ... # technically ReadableBuffer | Any + def edit( + self, + start_byte: int, + old_end_byte: int, + new_end_byte: int, + start_point: tuple[int, int], + old_end_point: tuple[int, int], + new_end_point: tuple[int, int], + ) -> None: ... + def get_changed_ranges(self, new_tree: Tree) -> list[Range]: ... + def walk(self) -> TreeCursor: ... + +@final +class TreeCursor: + @property + def node(self) -> Node: ... + def copy(self) -> TreeCursor: ... + def current_field_name(self) -> str | None: ... + def goto_first_child(self) -> bool: ... + def goto_next_sibling(self) -> bool: ... + def goto_parent(self) -> bool: ... diff --git a/stubs/ttkthemes/METADATA.toml b/stubs/ttkthemes/METADATA.toml index ffc5a1c..38c9468 100644 --- a/stubs/ttkthemes/METADATA.toml +++ b/stubs/ttkthemes/METADATA.toml @@ -1 +1 @@ -version = "3.2" +version = "3.2.*" diff --git a/stubs/ttkthemes/ttkthemes/themed_style.pyi b/stubs/ttkthemes/ttkthemes/themed_style.pyi index 9566fb3..e70eb8a 100644 --- a/stubs/ttkthemes/ttkthemes/themed_style.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_style.pyi @@ -8,5 +8,5 @@ class ThemedStyle(ttk.Style, ThemedWidget): self, master: tkinter.Misc | None = ..., *, theme: str | None = ..., gif_override: bool | None = ..., **kwargs ) -> None: ... # theme_use() can't return None (differs from ttk.Style) - def theme_use(self, theme_name: str | None = ...) -> str: ... # type: ignore - def theme_names(self) -> list[str]: ... # type: ignore + def theme_use(self, theme_name: str | None = ...) -> str: ... # type: ignore[override] + def theme_names(self) -> list[str]: ... # type: ignore[override] diff --git a/stubs/ttkthemes/ttkthemes/themed_tk.pyi b/stubs/ttkthemes/ttkthemes/themed_tk.pyi index 3a2c9d7..1cf27bf 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -23,8 +23,8 @@ class ThemedTk(tkinter.Tk, ThemedWidget): ) -> None: ... def set_theme(self, theme_name, toplevel: bool | None = ..., themebg: bool | None = ...) -> None: ... # TODO: currently no good way to say "use the same big list of kwargs as parent class but also add these" - def config(self, kw: Any | None = ..., **kwargs): ... # type: ignore + def config(self, kw: Any | None = ..., **kwargs): ... # type: ignore[override] def cget(self, k): ... - def configure(self, kw: Any | None = ..., **kwargs): ... # type: ignore + def configure(self, kw: Any | None = ..., **kwargs): ... # type: ignore[override] def __getitem__(self, k): ... def __setitem__(self, k, v): ... diff --git a/stubs/typed-ast/METADATA.toml b/stubs/typed-ast/METADATA.toml index 46f5153..c7bd82d 100644 --- a/stubs/typed-ast/METADATA.toml +++ b/stubs/typed-ast/METADATA.toml @@ -1 +1,4 @@ -version = "1.4" +version = "1.5.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/typed-ast/typed_ast/ast27.pyi b/stubs/typed-ast/typed_ast/ast27.pyi index 93dbae1..ff3ccdc 100644 --- a/stubs/typed-ast/typed_ast/ast27.pyi +++ b/stubs/typed-ast/typed_ast/ast27.pyi @@ -1,5 +1,7 @@ -import typing -from typing import Any, Iterator +from _typeshed import ReadableBuffer +from collections.abc import Iterator +from typing import Any +from typing_extensions import TypeAlias class NodeVisitor: def visit(self, node: AST) -> Any: ... @@ -8,14 +10,14 @@ class NodeVisitor: class NodeTransformer(NodeVisitor): def generic_visit(self, node: AST) -> None: ... -def parse(source: str | bytes, filename: str | bytes = ..., mode: str = ...) -> AST: ... +def parse(source: str | ReadableBuffer, filename: str | ReadableBuffer = ..., mode: str = ...) -> AST: ... def copy_location(new_node: AST, old_node: AST) -> AST: ... def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... def fix_missing_locations(node: AST) -> AST: ... -def get_docstring(node: AST, clean: bool = ...) -> bytes | None: ... +def get_docstring(node: AST, clean: bool = ...) -> str | bytes | None: ... def increment_lineno(node: AST, n: int = ...) -> AST: ... def iter_child_nodes(node: AST) -> Iterator[AST]: ... -def iter_fields(node: AST) -> Iterator[typing.Tuple[str, Any]]: ... +def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ... def literal_eval(node_or_string: str | AST) -> Any: ... def walk(node: AST) -> Iterator[AST]: ... @@ -23,11 +25,11 @@ PyCF_ONLY_AST: int # ast classes -identifier = str +_Identifier: TypeAlias = str class AST: - _attributes: typing.Tuple[str, ...] - _fields: typing.Tuple[str, ...] + _attributes: tuple[str, ...] + _fields: tuple[str, ...] def __init__(self, *args: Any, **kwargs: Any) -> None: ... class mod(AST): ... @@ -54,14 +56,14 @@ class stmt(AST): col_offset: int class FunctionDef(stmt): - name: identifier + name: _Identifier args: arguments body: list[stmt] decorator_list: list[expr] type_comment: str | None class ClassDef(stmt): - name: identifier + name: _Identifier bases: list[expr] body: list[stmt] decorator_list: list[expr] @@ -132,7 +134,7 @@ class Import(stmt): names: list[alias] class ImportFrom(stmt): - module: identifier | None + module: _Identifier | None names: list[alias] level: int | None @@ -142,7 +144,7 @@ class Exec(stmt): locals: expr | None class Global(stmt): - names: list[identifier] + names: list[_Identifier] class Expr(stmt): value: expr @@ -152,7 +154,7 @@ class Break(stmt): ... class Continue(stmt): ... class slice(AST): ... -_slice = slice # this lets us type the variable named 'slice' below +_Slice: TypeAlias = slice # this lets us type the variable named 'slice' below class Slice(slice): lower: expr | None @@ -236,7 +238,7 @@ class Repr(expr): value: expr class Num(expr): - n: int | float | complex + n: complex class Str(expr): s: str | bytes @@ -244,16 +246,16 @@ class Str(expr): class Attribute(expr): value: expr - attr: identifier + attr: _Identifier ctx: expr_context class Subscript(expr): value: expr - slice: _slice + slice: _Slice ctx: expr_context class Name(expr): - id: identifier + id: _Identifier ctx: expr_context class List(expr): @@ -318,18 +320,18 @@ class ExceptHandler(AST): class arguments(AST): args: list[expr] - vararg: identifier | None - kwarg: identifier | None + vararg: _Identifier | None + kwarg: _Identifier | None defaults: list[expr] type_comments: list[str | None] class keyword(AST): - arg: identifier + arg: _Identifier value: expr class alias(AST): - name: identifier - asname: identifier | None + name: _Identifier + asname: _Identifier | None class TypeIgnore(AST): lineno: int diff --git a/stubs/typed-ast/typed_ast/ast3.pyi b/stubs/typed-ast/typed_ast/ast3.pyi index 8d0a830..02abd13 100644 --- a/stubs/typed-ast/typed_ast/ast3.pyi +++ b/stubs/typed-ast/typed_ast/ast3.pyi @@ -1,5 +1,9 @@ -import typing -from typing import Any, Iterator +from _typeshed import ReadableBuffer +from collections.abc import Iterator +from typing import Any +from typing_extensions import TypeAlias + +LATEST_MINOR_VERSION: int class NodeVisitor: def visit(self, node: AST) -> Any: ... @@ -8,14 +12,16 @@ class NodeVisitor: class NodeTransformer(NodeVisitor): def generic_visit(self, node: AST) -> None: ... -def parse(source: str | bytes, filename: str | bytes = ..., mode: str = ..., feature_version: int = ...) -> AST: ... +def parse( + source: str | ReadableBuffer, filename: str | ReadableBuffer = ..., mode: str = ..., feature_version: int = ... +) -> AST: ... def copy_location(new_node: AST, old_node: AST) -> AST: ... def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... def fix_missing_locations(node: AST) -> AST: ... def get_docstring(node: AST, clean: bool = ...) -> str | None: ... def increment_lineno(node: AST, n: int = ...) -> AST: ... def iter_child_nodes(node: AST) -> Iterator[AST]: ... -def iter_fields(node: AST) -> Iterator[typing.Tuple[str, Any]]: ... +def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ... def literal_eval(node_or_string: str | AST) -> Any: ... def walk(node: AST) -> Iterator[AST]: ... @@ -23,11 +29,11 @@ PyCF_ONLY_AST: int # ast classes -identifier = str +_Identifier: TypeAlias = str class AST: - _attributes: typing.Tuple[str, ...] - _fields: typing.Tuple[str, ...] + _attributes: tuple[str, ...] + _fields: tuple[str, ...] def __init__(self, *args: Any, **kwargs: Any) -> None: ... class mod(AST): ... @@ -54,7 +60,7 @@ class stmt(AST): col_offset: int class FunctionDef(stmt): - name: identifier + name: _Identifier args: arguments body: list[stmt] decorator_list: list[expr] @@ -62,7 +68,7 @@ class FunctionDef(stmt): type_comment: str | None class AsyncFunctionDef(stmt): - name: identifier + name: _Identifier args: arguments body: list[stmt] decorator_list: list[expr] @@ -70,7 +76,7 @@ class AsyncFunctionDef(stmt): type_comment: str | None class ClassDef(stmt): - name: identifier + name: _Identifier bases: list[expr] keywords: list[keyword] body: list[stmt] @@ -150,15 +156,15 @@ class Import(stmt): names: list[alias] class ImportFrom(stmt): - module: identifier | None + module: _Identifier | None names: list[alias] level: int | None class Global(stmt): - names: list[identifier] + names: list[_Identifier] class Nonlocal(stmt): - names: list[identifier] + names: list[_Identifier] class Expr(stmt): value: expr @@ -168,7 +174,7 @@ class Break(stmt): ... class Continue(stmt): ... class slice(AST): ... -_slice = slice # this lets us type the variable named 'slice' below +_Slice: TypeAlias = slice # this lets us type the variable named 'slice' below class Slice(slice): lower: expr | None @@ -251,7 +257,7 @@ class Call(expr): keywords: list[keyword] class Num(expr): - n: float | int | complex + n: complex class Str(expr): s: str @@ -275,12 +281,12 @@ class Ellipsis(expr): ... class Attribute(expr): value: expr - attr: identifier + attr: _Identifier ctx: expr_context class Subscript(expr): value: expr - slice: _slice + slice: _Slice ctx: expr_context class Starred(expr): @@ -288,7 +294,7 @@ class Starred(expr): ctx: expr_context class Name(expr): - id: identifier + id: _Identifier ctx: expr_context class List(expr): @@ -348,7 +354,7 @@ class comprehension(AST): class ExceptHandler(AST): type: expr | None - name: identifier | None + name: _Identifier | None body: list[stmt] lineno: int col_offset: int @@ -357,24 +363,24 @@ class arguments(AST): args: list[arg] vararg: arg | None kwonlyargs: list[arg] - kw_defaults: list[expr] + kw_defaults: list[expr | None] kwarg: arg | None defaults: list[expr] class arg(AST): - arg: identifier + arg: _Identifier annotation: expr | None lineno: int col_offset: int type_comment: str | None class keyword(AST): - arg: identifier | None + arg: _Identifier | None value: expr class alias(AST): - name: identifier - asname: identifier | None + name: _Identifier + asname: _Identifier | None class withitem(AST): context_expr: expr diff --git a/stubs/tzlocal/@tests/stubtest_allowlist.txt b/stubs/tzlocal/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..1850fb5 --- /dev/null +++ b/stubs/tzlocal/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +tzlocal.unix +tzlocal.win32 diff --git a/stubs/tzlocal/METADATA.toml b/stubs/tzlocal/METADATA.toml index 43a3246..7d629ef 100644 --- a/stubs/tzlocal/METADATA.toml +++ b/stubs/tzlocal/METADATA.toml @@ -1,3 +1,5 @@ -version = "0.1" -python2 = true +version = "4.2" requires = ["types-pytz"] + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/tzlocal/tzlocal/__init__.pyi b/stubs/tzlocal/tzlocal/__init__.pyi index 7df53ad..81c2351 100644 --- a/stubs/tzlocal/tzlocal/__init__.pyi +++ b/stubs/tzlocal/tzlocal/__init__.pyi @@ -2,3 +2,4 @@ from pytz import BaseTzInfo def reload_localzone() -> None: ... def get_localzone() -> BaseTzInfo: ... +def get_localzone_name() -> str: ... diff --git a/stubs/tzlocal/tzlocal/utils.pyi b/stubs/tzlocal/tzlocal/utils.pyi new file mode 100644 index 0000000..aedc34a --- /dev/null +++ b/stubs/tzlocal/tzlocal/utils.pyi @@ -0,0 +1,16 @@ +import datetime +import sys + +import pytz + +if sys.version_info >= (3, 9): + import zoneinfo + + class ZoneInfoNotFoundError(pytz.UnknownTimeZoneError, zoneinfo.ZoneInfoNotFoundError): ... + +else: + class ZoneInfoNotFoundError(pytz.UnknownTimeZoneError): ... + +def get_system_offset() -> int: ... +def get_tz_offset(tz: datetime.tzinfo) -> int: ... +def assert_tz_offset(tz: datetime.tzinfo) -> None: ... diff --git a/stubs/tzlocal/tzlocal/windows_tz.pyi b/stubs/tzlocal/tzlocal/windows_tz.pyi new file mode 100644 index 0000000..9ff7d81 --- /dev/null +++ b/stubs/tzlocal/tzlocal/windows_tz.pyi @@ -0,0 +1,3 @@ +win_tz: dict[str, str] +tz_names: dict[str, str] +tz_win: dict[str, str] diff --git a/stubs/ujson/METADATA.toml b/stubs/ujson/METADATA.toml index 31f638b..008616f 100644 --- a/stubs/ujson/METADATA.toml +++ b/stubs/ujson/METADATA.toml @@ -1,2 +1,4 @@ -version = "0.1" -python2 = true +version = "5.5.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/ujson/ujson.pyi b/stubs/ujson/ujson.pyi index f96d475..b2528a9 100644 --- a/stubs/ujson/ujson.pyi +++ b/stubs/ujson/ujson.pyi @@ -33,3 +33,5 @@ def dump( def decode(s: AnyStr, precise_float: bool = ...) -> Any: ... def loads(s: AnyStr, precise_float: bool = ...) -> Any: ... def load(fp: IO[AnyStr], precise_float: bool = ...) -> Any: ... + +class JSONDecodeError(ValueError): ... diff --git a/stubs/urllib3/@tests/stubtest_allowlist.txt b/stubs/urllib3/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..317477c --- /dev/null +++ b/stubs/urllib3/@tests/stubtest_allowlist.txt @@ -0,0 +1,30 @@ +urllib3.NullHandler +urllib3._collections.HTTPHeaderDict.from_httplib +urllib3._collections.HTTPHeaderDict.getlist +urllib3._collections.RLock +urllib3.connection.HTTPConnection.request +urllib3.connection.HTTPSConnection.__init__ +urllib3.connection.VerifiedHTTPSConnection.__init__ +urllib3.connection.VerifiedHTTPSConnection.set_cert +urllib3.connectionpool.ConnectionError +# TODO: remove ResponseCls ignore when https://github.com/python/mypy/issues/13316 is closed +urllib3.connectionpool.HTTPConnectionPool.ResponseCls +urllib3.connectionpool.HTTPConnectionPool.__init__ +urllib3.connectionpool.HTTPConnectionPool.urlopen +urllib3.connectionpool.HTTPSConnectionPool.__init__ +urllib3.connectionpool.VerifiedHTTPSConnection.__init__ +urllib3.connectionpool.VerifiedHTTPSConnection.set_cert +urllib3.packages.ssl_match_hostname +urllib3.packages.ssl_match_hostname._implementation +urllib3.poolmanager.PoolManager.connection_from_host +urllib3.poolmanager.PoolManager.connection_from_url +urllib3.poolmanager.PoolManager.urlopen +urllib3.poolmanager.ProxyManager.__init__ +urllib3.poolmanager.ProxyManager.connection_from_host +urllib3.poolmanager.ProxyManager.urlopen +urllib3.request.RequestMethods.request_encode_url +urllib3.response.BrotliDecoder +urllib3.util.connection.poll +urllib3.util.connection.select +urllib3.util.ssl_.create_default_context +urllib3.util.ssl_.ssl_wrap_socket diff --git a/stubs/urllib3/METADATA.toml b/stubs/urllib3/METADATA.toml new file mode 100644 index 0000000..0976018 --- /dev/null +++ b/stubs/urllib3/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.26.*" + +[tool.stubtest] +extras = ["socks"] diff --git a/stubs/urllib3/urllib3/__init__.pyi b/stubs/urllib3/urllib3/__init__.pyi new file mode 100644 index 0000000..12ca610 --- /dev/null +++ b/stubs/urllib3/urllib3/__init__.pyi @@ -0,0 +1,28 @@ +import logging +from typing import TextIO + +from . import connectionpool, filepost, poolmanager, response +from .util import request as _request, retry, timeout, url + +__author__: str +__license__: str +__version__: str + +HTTPConnectionPool = connectionpool.HTTPConnectionPool +HTTPSConnectionPool = connectionpool.HTTPSConnectionPool +connection_from_url = connectionpool.connection_from_url +encode_multipart_formdata = filepost.encode_multipart_formdata +PoolManager = poolmanager.PoolManager +ProxyManager = poolmanager.ProxyManager +proxy_from_url = poolmanager.proxy_from_url +HTTPResponse = response.HTTPResponse +make_headers = _request.make_headers +get_host = url.get_host +Timeout = timeout.Timeout +Retry = retry.Retry + +class NullHandler(logging.Handler): + def emit(self, record): ... + +def add_stderr_logger(level: int = ...) -> logging.StreamHandler[TextIO]: ... +def disable_warnings(category: type[Warning] = ...) -> None: ... diff --git a/stubs/urllib3/urllib3/_collections.pyi b/stubs/urllib3/urllib3/_collections.pyi new file mode 100644 index 0000000..27366cc --- /dev/null +++ b/stubs/urllib3/urllib3/_collections.pyi @@ -0,0 +1,52 @@ +from collections.abc import MutableMapping +from typing import Any, NoReturn, TypeVar + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + +class RLock: + def __enter__(self): ... + def __exit__(self, exc_type, exc_value, traceback): ... + +class RecentlyUsedContainer(MutableMapping[_KT, _VT]): + ContainerCls: Any + dispose_func: Any + lock: Any + def __init__(self, maxsize=..., dispose_func=...) -> None: ... + def __getitem__(self, key): ... + def __setitem__(self, key, value): ... + def __delitem__(self, key): ... + def __len__(self): ... + def __iter__(self): ... + def clear(self): ... + def keys(self): ... + +class HTTPHeaderDict(MutableMapping[str, str]): + def __init__(self, headers=..., **kwargs) -> None: ... + def __setitem__(self, key, val): ... + def __getitem__(self, key): ... + def __delitem__(self, key): ... + def __contains__(self, key): ... + def __eq__(self, other): ... + def __iter__(self) -> NoReturn: ... + def __len__(self) -> int: ... + def __ne__(self, other): ... + values: Any + get: Any + update: Any + iterkeys: Any + itervalues: Any + def pop(self, key, default=...): ... + def discard(self, key): ... + def add(self, key, val): ... + def extend(self, *args, **kwargs): ... + def getlist(self, key): ... + getheaders: Any + getallmatchingheaders: Any + iget: Any + def copy(self): ... + def iteritems(self): ... + def itermerged(self): ... + def items(self): ... + @classmethod + def from_httplib(cls, message, duplicates=...): ... diff --git a/stubs/urllib3/urllib3/connection.pyi b/stubs/urllib3/urllib3/connection.pyi new file mode 100644 index 0000000..8baca88 --- /dev/null +++ b/stubs/urllib3/urllib3/connection.pyi @@ -0,0 +1,55 @@ +import ssl +from builtins import ConnectionError as ConnectionError +from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException +from typing import Any + +from . import exceptions, util +from .packages import ssl_match_hostname +from .util import ssl_ + +class DummyConnection: ... + +BaseSSLError = ssl.SSLError + +ConnectTimeoutError = exceptions.ConnectTimeoutError +SystemTimeWarning = exceptions.SystemTimeWarning +match_hostname = ssl_match_hostname.match_hostname +resolve_cert_reqs = ssl_.resolve_cert_reqs +resolve_ssl_version = ssl_.resolve_ssl_version +ssl_wrap_socket = ssl_.ssl_wrap_socket +assert_fingerprint = ssl_.assert_fingerprint +connection = util.connection + +port_by_scheme: Any +RECENT_DATE: Any + +class HTTPConnection(_HTTPConnection): + default_port: Any + default_socket_options: Any + is_verified: Any + source_address: Any + socket_options: Any + def __init__(self, *args, **kw) -> None: ... + def connect(self): ... + +class HTTPSConnection(HTTPConnection): + default_port: Any + key_file: Any + cert_file: Any + def __init__(self, host, port=..., key_file=..., cert_file=..., strict=..., timeout=..., **kw) -> None: ... + sock: Any + def connect(self): ... + +class VerifiedHTTPSConnection(HTTPSConnection): + cert_reqs: Any + ca_certs: Any + ssl_version: Any + assert_fingerprint: Any + key_file: Any + cert_file: Any + assert_hostname: Any + def set_cert(self, key_file=..., cert_file=..., cert_reqs=..., ca_certs=..., assert_hostname=..., assert_fingerprint=...): ... + sock: Any + auto_open: Any + is_verified: Any + def connect(self): ... diff --git a/stubs/urllib3/urllib3/connectionpool.pyi b/stubs/urllib3/urllib3/connectionpool.pyi new file mode 100644 index 0000000..b0987db --- /dev/null +++ b/stubs/urllib3/urllib3/connectionpool.pyi @@ -0,0 +1,131 @@ +import queue +from _typeshed import Self +from collections.abc import Mapping +from logging import Logger +from types import TracebackType +from typing import Any, ClassVar +from typing_extensions import Literal, TypeAlias + +from . import connection, exceptions, request, response +from .connection import BaseSSLError as BaseSSLError, ConnectionError as ConnectionError, HTTPException as HTTPException +from .packages import ssl_match_hostname +from .util import Url, connection as _connection, queue as urllib3queue, retry, timeout, url + +ClosedPoolError = exceptions.ClosedPoolError +ProtocolError = exceptions.ProtocolError +EmptyPoolError = exceptions.EmptyPoolError +HostChangedError = exceptions.HostChangedError +LocationValueError = exceptions.LocationValueError +MaxRetryError = exceptions.MaxRetryError +ProxyError = exceptions.ProxyError +ReadTimeoutError = exceptions.ReadTimeoutError +SSLError = exceptions.SSLError +TimeoutError = exceptions.TimeoutError +InsecureRequestWarning = exceptions.InsecureRequestWarning +CertificateError = ssl_match_hostname.CertificateError +port_by_scheme = connection.port_by_scheme +DummyConnection = connection.DummyConnection +HTTPConnection = connection.HTTPConnection +HTTPSConnection = connection.HTTPSConnection +VerifiedHTTPSConnection = connection.VerifiedHTTPSConnection +RequestMethods = request.RequestMethods +HTTPResponse = response.HTTPResponse +is_connection_dropped = _connection.is_connection_dropped +Retry = retry.Retry +Timeout = timeout.Timeout +get_host = url.get_host + +_Timeout: TypeAlias = Timeout | float +_Retries: TypeAlias = Retry | bool | int + +xrange: Any +log: Logger + +class ConnectionPool: + scheme: ClassVar[str | None] + QueueCls: ClassVar[type[queue.Queue[Any]]] + host: str + port: int | None + def __init__(self, host: str, port: int | None = ...) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> Literal[False]: ... + def close(self) -> None: ... + +class HTTPConnectionPool(ConnectionPool, RequestMethods): + scheme: ClassVar[str] + ConnectionCls: ClassVar[type[HTTPConnection | HTTPSConnection]] + ResponseCls: ClassVar[type[HTTPResponse]] + strict: bool + timeout: _Timeout + retries: _Retries | None + pool: urllib3queue.LifoQueue | None + block: bool + proxy: Url | None + proxy_headers: Mapping[str, str] + num_connections: int + num_requests: int + conn_kw: Any + def __init__( + self, + host: str, + port: int | None = ..., + strict: bool = ..., + timeout: _Timeout = ..., + maxsize: int = ..., + block: bool = ..., + headers: Mapping[str, str] | None = ..., + retries: _Retries | None = ..., + _proxy: Url | None = ..., + _proxy_headers: Mapping[str, str] | None = ..., + **conn_kw, + ) -> None: ... + def close(self) -> None: ... + def is_same_host(self, url: str) -> bool: ... + def urlopen( + self, + method, + url, + body=..., + headers=..., + retries=..., + redirect=..., + assert_same_host=..., + timeout=..., + pool_timeout=..., + release_conn=..., + **response_kw, + ): ... + +class HTTPSConnectionPool(HTTPConnectionPool): + key_file: str | None + cert_file: str | None + cert_reqs: int | str | None + ca_certs: str | None + ssl_version: int | str | None + assert_hostname: str | Literal[False] | None + assert_fingerprint: str | None + def __init__( + self, + host: str, + port: int | None = ..., + strict: bool = ..., + timeout: _Timeout = ..., + maxsize: int = ..., + block: bool = ..., + headers: Mapping[str, str] | None = ..., + retries: _Retries | None = ..., + _proxy: Url | None = ..., + _proxy_headers: Mapping[str, str] | None = ..., + key_file: str | None = ..., + cert_file: str | None = ..., + cert_reqs: int | str | None = ..., + ca_certs: str | None = ..., + ssl_version: int | str | None = ..., + assert_hostname: str | Literal[False] | None = ..., + assert_fingerprint: str | None = ..., + **conn_kw, + ) -> None: ... + +def connection_from_url(url: str, **kw) -> HTTPConnectionPool: ... diff --git a/stubs/urllib3/urllib3/contrib/__init__.pyi b/stubs/urllib3/urllib3/contrib/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/urllib3/urllib3/contrib/socks.pyi b/stubs/urllib3/urllib3/contrib/socks.pyi new file mode 100644 index 0000000..f2137f8 --- /dev/null +++ b/stubs/urllib3/urllib3/contrib/socks.pyi @@ -0,0 +1,45 @@ +from collections.abc import Mapping +from typing import ClassVar +from typing_extensions import TypedDict + +from ..connection import HTTPConnection, HTTPSConnection +from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool +from ..poolmanager import PoolManager + +class _TYPE_SOCKS_OPTIONS(TypedDict): + socks_version: int + proxy_host: str | None + proxy_port: str | None + username: str | None + password: str | None + rdns: bool + +class SOCKSConnection(HTTPConnection): + def __init__(self, _socks_options: _TYPE_SOCKS_OPTIONS, *args, **kwargs) -> None: ... + +class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): ... + +class SOCKSHTTPConnectionPool(HTTPConnectionPool): + ConnectionCls: ClassVar[type[SOCKSConnection]] + +class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): + ConnectionCls: ClassVar[type[SOCKSHTTPSConnection]] + +class _ConnectionPoolClasses(TypedDict): + http: type[SOCKSHTTPConnectionPool] + https: type[SOCKSHTTPSConnectionPool] + +class SOCKSProxyManager(PoolManager): + # has a class-level default, but is overridden on instances, so not a ClassVar + pool_classes_by_scheme: _ConnectionPoolClasses + proxy_url: str + + def __init__( + self, + proxy_url: str, + username: str | None = ..., + password: str | None = ..., + num_pools: int = ..., + headers: Mapping[str, str] | None = ..., + **connection_pool_kw, + ) -> None: ... diff --git a/stubs/urllib3/urllib3/exceptions.pyi b/stubs/urllib3/urllib3/exceptions.pyi new file mode 100644 index 0000000..8c20906 --- /dev/null +++ b/stubs/urllib3/urllib3/exceptions.pyi @@ -0,0 +1,87 @@ +from email.errors import MessageDefect +from http.client import IncompleteRead as httplib_IncompleteRead +from typing import Any + +from urllib3.connectionpool import ConnectionPool, HTTPResponse +from urllib3.util.retry import Retry + +class HTTPError(Exception): ... +class HTTPWarning(Warning): ... + +class PoolError(HTTPError): + pool: ConnectionPool + def __init__(self, pool: ConnectionPool, message: str) -> None: ... + +class RequestError(PoolError): + url: str + def __init__(self, pool: ConnectionPool, url: str, message: str) -> None: ... + +class SSLError(HTTPError): ... + +class ProxyError(HTTPError): + original_error: Exception + def __init__(self, message: str, error: Exception, *args: Any) -> None: ... + +class DecodeError(HTTPError): ... +class ProtocolError(HTTPError): ... + +ConnectionError = ProtocolError + +class MaxRetryError(RequestError): + reason: Exception | None + def __init__(self, pool: ConnectionPool, url: str, reason: Exception | None = ...) -> None: ... + +class HostChangedError(RequestError): + retries: Retry | int + def __init__(self, pool: ConnectionPool, url: str, retries: Retry | int = ...) -> None: ... + +class TimeoutStateError(HTTPError): ... +class TimeoutError(HTTPError): ... +class ReadTimeoutError(TimeoutError, RequestError): ... +class ConnectTimeoutError(TimeoutError): ... +class NewConnectionError(ConnectTimeoutError, HTTPError): ... +class EmptyPoolError(PoolError): ... +class ClosedPoolError(PoolError): ... +class LocationValueError(ValueError, HTTPError): ... + +class LocationParseError(LocationValueError): + location: str + def __init__(self, location: str) -> None: ... + +class URLSchemeUnknown(LocationValueError): + scheme: str + def __init__(self, scheme: str) -> None: ... + +class ResponseError(HTTPError): + GENERIC_ERROR: str + SPECIFIC_ERROR: str + +class SecurityWarning(HTTPWarning): ... +class SubjectAltNameWarning(SecurityWarning): ... +class InsecureRequestWarning(SecurityWarning): ... +class SystemTimeWarning(SecurityWarning): ... +class InsecurePlatformWarning(SecurityWarning): ... +class SNIMissingWarning(HTTPWarning): ... +class DependencyWarning(HTTPWarning): ... +class ResponseNotChunked(ProtocolError, ValueError): ... +class BodyNotHttplibCompatible(HTTPError): ... + +class IncompleteRead(HTTPError, httplib_IncompleteRead): + def __init__(self, partial: bytes, expected: int | None) -> None: ... + +class InvalidChunkLength(HTTPError, httplib_IncompleteRead): + response: HTTPResponse + length: bytes + def __init__(self, response: HTTPResponse, length: bytes) -> None: ... + +class InvalidHeader(HTTPError): ... + +class ProxySchemeUnknown(AssertionError, URLSchemeUnknown): + def __init__(self, scheme: str | None) -> None: ... + +class ProxySchemeUnsupported(ValueError): ... + +class HeaderParsingError(HTTPError): + def __init__(self, defects: list[MessageDefect], unparsed_data: str | bytes | None) -> None: ... + +class UnrewindableBodyError(HTTPError): ... diff --git a/stubs/urllib3/urllib3/fields.pyi b/stubs/urllib3/urllib3/fields.pyi new file mode 100644 index 0000000..8127d72 --- /dev/null +++ b/stubs/urllib3/urllib3/fields.pyi @@ -0,0 +1,32 @@ +from collections.abc import Callable, Mapping +from typing import Any, Union +from typing_extensions import TypeAlias + +_FieldValue: TypeAlias = str | bytes +_FieldValueTuple: TypeAlias = Union[_FieldValue, tuple[str, _FieldValue], tuple[str, _FieldValue, str]] + +def guess_content_type(filename: str | None, default: str = ...) -> str: ... +def format_header_param_rfc2231(name: str, value: _FieldValue) -> str: ... +def format_header_param_html5(name: str, value: _FieldValue) -> str: ... + +format_header_param = format_header_param_html5 + +class RequestField: + data: Any + headers: Any + def __init__( + self, + name: str, + data: _FieldValue, + filename: str | None = ..., + headers: Mapping[str, str] | None = ..., + header_formatter: Callable[[str, _FieldValue], str] = ..., + ) -> None: ... + @classmethod + def from_tuples( + cls, fieldname: str, value: _FieldValueTuple, header_formatter: Callable[[str, _FieldValue], str] = ... + ) -> RequestField: ... + def render_headers(self) -> str: ... + def make_multipart( + self, content_disposition: str | None = ..., content_type: str | None = ..., content_location: str | None = ... + ) -> None: ... diff --git a/stubs/requests/requests/packages/urllib3/filepost.pyi b/stubs/urllib3/urllib3/filepost.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/filepost.pyi rename to stubs/urllib3/urllib3/filepost.pyi diff --git a/stubs/urllib3/urllib3/packages/__init__.pyi b/stubs/urllib3/urllib3/packages/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi b/stubs/urllib3/urllib3/packages/ssl_match_hostname/__init__.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi rename to stubs/urllib3/urllib3/packages/ssl_match_hostname/__init__.pyi diff --git a/stubs/urllib3/urllib3/packages/ssl_match_hostname/_implementation.pyi b/stubs/urllib3/urllib3/packages/ssl_match_hostname/_implementation.pyi new file mode 100644 index 0000000..c219980 --- /dev/null +++ b/stubs/urllib3/urllib3/packages/ssl_match_hostname/_implementation.pyi @@ -0,0 +1,3 @@ +class CertificateError(ValueError): ... + +def match_hostname(cert, hostname): ... diff --git a/stubs/requests/requests/packages/urllib3/poolmanager.pyi b/stubs/urllib3/urllib3/poolmanager.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/poolmanager.pyi rename to stubs/urllib3/urllib3/poolmanager.pyi diff --git a/stubs/requests/requests/packages/urllib3/request.pyi b/stubs/urllib3/urllib3/request.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/request.pyi rename to stubs/urllib3/urllib3/request.pyi diff --git a/stubs/urllib3/urllib3/response.pyi b/stubs/urllib3/urllib3/response.pyi new file mode 100644 index 0000000..ac72ced --- /dev/null +++ b/stubs/urllib3/urllib3/response.pyi @@ -0,0 +1,99 @@ +import io +from _typeshed import Self +from collections.abc import Iterable, Iterator, Mapping +from http.client import HTTPMessage as _HttplibHTTPMessage, HTTPResponse as _HttplibHTTPResponse +from typing import IO, Any +from typing_extensions import Literal, TypeAlias + +from urllib3.connectionpool import HTTPConnection + +from . import HTTPConnectionPool, Retry +from ._collections import HTTPHeaderDict + +_TYPE_BODY: TypeAlias = bytes | IO[Any] | Iterable[bytes] | str + +class DeflateDecoder: + def __getattr__(self, name: str) -> Any: ... + def decompress(self, data: bytes) -> bytes: ... + +class GzipDecoderState: + FIRST_MEMBER: Literal[0] + OTHER_MEMBERS: Literal[1] + SWALLOW_DATA: Literal[2] + +class GzipDecoder: + def __getattr__(self, name: str) -> Any: ... + def decompress(self, data: bytes) -> bytes: ... + +# This class is only available if +# `brotli` is available for import. +class BrotliDecoder: + def flush(self) -> bytes: ... + +class MultiDecoder: + def __init__(self, modes: str) -> None: ... + def flush(self) -> bytes: ... + def decompress(self, data: bytes) -> bytes: ... + +class HTTPResponse(io.IOBase): + CONTENT_DECODERS: list[str] + REDIRECT_STATUSES: list[int] + headers: HTTPHeaderDict + status: int + version: int + reason: str | None + strict: int + decode_content: bool + retries: Retry | None + enforce_content_length: bool + auto_close: bool + msg: _HttplibHTTPMessage | None + chunked: bool + chunk_left: int | None + length_remaining: int | None + def __init__( + self, + body: _TYPE_BODY = ..., + headers: Mapping[str, str] | Mapping[bytes, bytes] | None = ..., + status: int = ..., + version: int = ..., + reason: str | None = ..., + strict: int = ..., + preload_content: bool = ..., + decode_content: bool = ..., + original_response: _HttplibHTTPResponse | None = ..., + pool: HTTPConnectionPool | None = ..., + connection: HTTPConnection | None = ..., + msg: _HttplibHTTPMessage | None = ..., + retries: Retry | None = ..., + enforce_content_length: bool = ..., + request_method: str | None = ..., + request_url: str | None = ..., + auto_close: bool = ..., + ) -> None: ... + def get_redirect_location(self) -> Literal[False] | str | None: ... + def release_conn(self) -> None: ... + def drain_conn(self) -> None: ... + @property + def data(self) -> bytes | Any: ... + @property + def connection(self) -> HTTPConnection | Any: ... + def isclosed(self) -> bool: ... + def tell(self) -> int: ... + def read(self, amt: int | None = ..., decode_content: bool | None = ..., cache_content: bool = ...) -> bytes: ... + def stream(self, amt: int | None = ..., decode_content: bool | None = ...) -> Iterator[bytes]: ... + @classmethod + def from_httplib(cls: type[Self], r: _HttplibHTTPResponse, **response_kw: Any) -> Self: ... + def getheaders(self) -> HTTPHeaderDict: ... + def getheader(self, name, default=...) -> str | None: ... + def info(self) -> HTTPHeaderDict: ... + def close(self) -> None: ... + @property + def closed(self) -> bool: ... + def fileno(self) -> int: ... + def flush(self) -> None: ... + def readable(self) -> bool: ... + def readinto(self, b: bytearray) -> int: ... + def supports_chunked_reads(self) -> bool: ... + def read_chunked(self, amt: int | None = ..., decode_content: bool | None = ...) -> Iterator[bytes]: ... + def geturl(self) -> str | None: ... diff --git a/stubs/requests/requests/packages/urllib3/util/__init__.pyi b/stubs/urllib3/urllib3/util/__init__.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/util/__init__.pyi rename to stubs/urllib3/urllib3/util/__init__.pyi diff --git a/stubs/requests/requests/packages/urllib3/util/connection.pyi b/stubs/urllib3/urllib3/util/connection.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/util/connection.pyi rename to stubs/urllib3/urllib3/util/connection.pyi diff --git a/stubs/urllib3/urllib3/util/queue.pyi b/stubs/urllib3/urllib3/util/queue.pyi new file mode 100644 index 0000000..bffa681 --- /dev/null +++ b/stubs/urllib3/urllib3/util/queue.pyi @@ -0,0 +1,4 @@ +from queue import Queue +from typing import Any + +class LifoQueue(Queue[Any]): ... diff --git a/stubs/requests/requests/packages/urllib3/util/request.pyi b/stubs/urllib3/urllib3/util/request.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/util/request.pyi rename to stubs/urllib3/urllib3/util/request.pyi diff --git a/stubs/requests/requests/packages/urllib3/util/response.pyi b/stubs/urllib3/urllib3/util/response.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/util/response.pyi rename to stubs/urllib3/urllib3/util/response.pyi diff --git a/stubs/urllib3/urllib3/util/retry.pyi b/stubs/urllib3/urllib3/util/retry.pyi new file mode 100644 index 0000000..bd1a5ff --- /dev/null +++ b/stubs/urllib3/urllib3/util/retry.pyi @@ -0,0 +1,85 @@ +import logging +from _typeshed import Self +from collections.abc import Collection +from types import TracebackType +from typing import Any, ClassVar, NamedTuple +from typing_extensions import Literal + +from .. import exceptions +from ..connectionpool import ConnectionPool +from ..response import HTTPResponse + +ConnectTimeoutError = exceptions.ConnectTimeoutError +MaxRetryError = exceptions.MaxRetryError +ProtocolError = exceptions.ProtocolError +ReadTimeoutError = exceptions.ReadTimeoutError +ResponseError = exceptions.ResponseError + +log: logging.Logger + +class RequestHistory(NamedTuple): + method: str | None + url: str | None + error: Exception | None + status: int | None + redirect_location: str | None + +class Retry: + DEFAULT_ALLOWED_METHODS: ClassVar[frozenset[str]] + RETRY_AFTER_STATUS_CODES: ClassVar[frozenset[int]] + DEFAULT_REMOVE_HEADERS_ON_REDIRECT: ClassVar[frozenset[str]] + DEFAULT_BACKOFF_MAX: ClassVar[int] + + total: bool | int | None + connect: int | None + read: int | None + redirect: Literal[True] | int | None + status: int | None + other: int | None + allowed_methods: Collection[str] | Literal[False] | None + status_forcelist: Collection[int] + backoff_factor: float + raise_on_redirect: bool + raise_on_status: bool + history: tuple[RequestHistory, ...] + respect_retry_after_header: bool + remove_headers_on_redirect: frozenset[str] + def __init__( + self, + total: bool | int | None = ..., + connect: int | None = ..., + read: int | None = ..., + redirect: bool | int | None = ..., + status: int | None = ..., + other: int | None = ..., + allowed_methods: Collection[str] | Literal[False] | None = ..., + status_forcelist: Collection[int] | None = ..., + backoff_factor: float = ..., + raise_on_redirect: bool = ..., + raise_on_status: bool = ..., + history: tuple[RequestHistory, ...] | None = ..., + respect_retry_after_header: bool = ..., + remove_headers_on_redirect: Collection[str] = ..., + method_whitelist: Collection[str] | None = ..., + ) -> None: ... + def new(self: Self, **kw: Any) -> Self: ... + @classmethod + def from_int( + cls, retries: Retry | bool | int | None, redirect: bool | int | None = ..., default: Retry | bool | int | None = ... + ) -> Retry: ... + def get_backoff_time(self) -> float: ... + def parse_retry_after(self, retry_after: str) -> float: ... + def get_retry_after(self, response: HTTPResponse) -> float | None: ... + def sleep_for_retry(self, response: HTTPResponse | None = ...) -> bool: ... + def sleep(self, response: HTTPResponse | None = ...) -> None: ... + def is_retry(self, method: str, status_code: int, has_retry_after: bool = ...) -> bool: ... + def is_exhausted(self) -> bool: ... + def increment( + self, + method: str | None = ..., + url: str | None = ..., + response: HTTPResponse | None = ..., + error: Exception | None = ..., + _pool: ConnectionPool | None = ..., + _stacktrace: TracebackType | None = ..., + ) -> Retry: ... diff --git a/stubs/requests/requests/packages/urllib3/util/ssl_.pyi b/stubs/urllib3/urllib3/util/ssl_.pyi similarity index 97% rename from stubs/requests/requests/packages/urllib3/util/ssl_.pyi rename to stubs/urllib3/urllib3/util/ssl_.pyi index 1542e91..3a3c539 100644 --- a/stubs/requests/requests/packages/urllib3/util/ssl_.pyi +++ b/stubs/urllib3/urllib3/util/ssl_.pyi @@ -12,6 +12,7 @@ create_default_context: Any OP_NO_SSLv2: Any OP_NO_SSLv3: Any OP_NO_COMPRESSION: Any +DEFAULT_CIPHERS: str def assert_fingerprint(cert, fingerprint): ... def resolve_cert_reqs(candidate): ... diff --git a/stubs/requests/requests/packages/urllib3/util/timeout.pyi b/stubs/urllib3/urllib3/util/timeout.pyi similarity index 100% rename from stubs/requests/requests/packages/urllib3/util/timeout.pyi rename to stubs/urllib3/urllib3/util/timeout.pyi diff --git a/stubs/urllib3/urllib3/util/url.pyi b/stubs/urllib3/urllib3/util/url.pyi new file mode 100644 index 0000000..91a36ab --- /dev/null +++ b/stubs/urllib3/urllib3/util/url.pyi @@ -0,0 +1,40 @@ +from typing import NamedTuple + +from .. import exceptions + +LocationParseError = exceptions.LocationParseError + +url_attrs: list[str] + +class _UrlBase(NamedTuple): + auth: str | None + fragment: str | None + host: str | None + path: str | None + port: str | None + query: str | None + scheme: str | None + +class Url(_UrlBase): + def __new__( + cls, + scheme: str | None = ..., + auth: str | None = ..., + host: str | None = ..., + port: str | None = ..., + path: str | None = ..., + query: str | None = ..., + fragment: str | None = ..., + ): ... + @property + def hostname(self) -> str | None: ... + @property + def request_uri(self) -> str: ... + @property + def netloc(self) -> str | None: ... + @property + def url(self) -> str: ... + +def split_first(s: str, delims: str) -> tuple[str, str, str | None]: ... +def parse_url(url: str) -> Url: ... +def get_host(url: str) -> tuple[str, str | None, str | None]: ... diff --git a/stubs/vobject/@tests/stubtest_allowlist.txt b/stubs/vobject/@tests/stubtest_allowlist.txt index 071ab58..04093ce 100644 --- a/stubs/vobject/@tests/stubtest_allowlist.txt +++ b/stubs/vobject/@tests/stubtest_allowlist.txt @@ -3,3 +3,18 @@ vobject.base.VBase.__init__ # only available on Windows vobject.win32tz + +# dependencies +vobject.change_tz.PyICU +vobject.icalendar.Pytz +vobject.icalendar.pytz + +# re-exports +vobject.hcalendar.CRLF + +# python2 compat +vobject.base.basestring +vobject.base.str_ +vobject.base.to_unicode +vobject.base.to_basestring +vobject.vcard.basestring diff --git a/stubs/vobject/METADATA.toml b/stubs/vobject/METADATA.toml index 16fd217..1548770 100644 --- a/stubs/vobject/METADATA.toml +++ b/stubs/vobject/METADATA.toml @@ -1 +1,4 @@ -version = "0.9" +version = "0.9.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/vobject/vobject/base.pyi b/stubs/vobject/vobject/base.pyi index 213b3d2..69be407 100644 --- a/stubs/vobject/vobject/base.pyi +++ b/stubs/vobject/vobject/base.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsWrite -from collections.abc import Iterable +from collections.abc import Iterable, Iterator from typing import Any, TypeVar, overload from typing_extensions import Literal @@ -133,7 +133,6 @@ def defaultSerialize(obj, buf, lineLength): ... class Stack: stack: Any - def __init__(self) -> None: ... def __len__(self): ... def top(self): ... def topName(self): ... @@ -143,7 +142,7 @@ class Stack: def readComponents( streamOrString, validate: bool = ..., transform: bool = ..., ignoreUnreadable: bool = ..., allowQP: bool = ... -) -> None: ... +) -> Iterator[Component]: ... def readOne(stream, validate: bool = ..., transform: bool = ..., ignoreUnreadable: bool = ..., allowQP: bool = ...): ... def registerBehavior(behavior, name: Any | None = ..., default: bool = ..., id: Any | None = ...) -> None: ... def getBehavior(name, id: Any | None = ...): ... diff --git a/stubs/vobject/vobject/behavior.pyi b/stubs/vobject/vobject/behavior.pyi index c165c72..9c6e5a6 100644 --- a/stubs/vobject/vobject/behavior.pyi +++ b/stubs/vobject/vobject/behavior.pyi @@ -12,7 +12,6 @@ class Behavior: allowGroup: bool forceUTC: bool sortFirst: Any - def __init__(self) -> None: ... @classmethod def validate(cls, obj, raiseException: bool = ..., complainUnrecognized: bool = ...): ... @classmethod diff --git a/stubs/vobject/vobject/icalendar.pyi b/stubs/vobject/vobject/icalendar.pyi index 72f9ae5..6a9728e 100644 --- a/stubs/vobject/vobject/icalendar.pyi +++ b/stubs/vobject/vobject/icalendar.pyi @@ -1,15 +1,15 @@ from datetime import timedelta -from typing import Any, Tuple +from typing import Any from .base import Component from .behavior import Behavior -DATENAMES: Tuple[str, ...] -RULENAMES: Tuple[str, ...] -DATESANDRULES: Tuple[str, ...] +DATENAMES: tuple[str, ...] +RULENAMES: tuple[str, ...] +DATESANDRULES: tuple[str, ...] PRODID: str -WEEKDAYS: Tuple[str, ...] -FREQUENCIES: Tuple[str, ...] +WEEKDAYS: tuple[str, ...] +FREQUENCIES: tuple[str, ...] zeroDelta: timedelta twoHours: timedelta @@ -36,7 +36,7 @@ class TimezoneComponent(Component): normal_attributes: Any @staticmethod def pickTzid(tzinfo, allowUTC: bool = ...): ... - def prettyPrint(self, level, tabwidth) -> None: ... # type: ignore + def prettyPrint(self, level, tabwidth) -> None: ... # type: ignore[override] class RecurringComponent(Component): isNative: bool diff --git a/stubs/vobject/vobject/vcard.pyi b/stubs/vobject/vobject/vcard.pyi index 08d6836..8dfd0be 100644 --- a/stubs/vobject/vobject/vcard.pyi +++ b/stubs/vobject/vobject/vcard.pyi @@ -78,7 +78,7 @@ class Photo(VCardTextBehavior): @classmethod def valueRepr(cls, line): ... @classmethod - def serialize(cls, obj, buf, lineLength, validate) -> None: ... # type: ignore + def serialize(cls, obj, buf, lineLength, validate) -> None: ... # type: ignore[override] def toListOrString(string): ... def splitFields(string): ... diff --git a/stubs/vobject/vobject/win32tz.pyi b/stubs/vobject/vobject/win32tz.pyi index a36ceb3..32936fb 100644 --- a/stubs/vobject/vobject/win32tz.pyi +++ b/stubs/vobject/vobject/win32tz.pyi @@ -9,13 +9,16 @@ if sys.platform == "win32": localkey: Any WEEKS: Any def list_timezones(): ... + class win32tz(datetime.tzinfo): data: Any def __init__(self, name) -> None: ... def utcoffset(self, dt): ... def dst(self, dt): ... def tzname(self, dt): ... + def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek): ... + class win32tz_data: display: Any dstname: Any @@ -33,4 +36,5 @@ if sys.platform == "win32": dsthour: Any dstminute: Any def __init__(self, path) -> None: ... + def valuesToDict(key): ... diff --git a/stubs/waitress/@tests/stubtest_allowlist.txt b/stubs/waitress/@tests/stubtest_allowlist.txt index d839ceb..8468ef5 100644 --- a/stubs/waitress/@tests/stubtest_allowlist.txt +++ b/stubs/waitress/@tests/stubtest_allowlist.txt @@ -9,14 +9,6 @@ waitress.channel.HTTPChannel.error_task_class waitress.channel.HTTPChannel.parser_class waitress.channel.HTTPChannel.request waitress.channel.HTTPChannel.task_class -waitress.channel.wasyncore.compat.qualname -waitress.channel.wasyncore.compat.reraise -waitress.channel.wasyncore.compat.set_nonblocking -waitress.channel.wasyncore.compat.text_ -waitress.channel.wasyncore.compat.tobytes -waitress.channel.wasyncore.compat.tostr -waitress.channel.wasyncore.compat.unquote_bytes_to_wsgi -waitress.channel.wasyncore.dispatcher_with_send.handle_write waitress.compat.PY2 waitress.compat.PY3 waitress.compat.ResourceWarning @@ -40,20 +32,6 @@ waitress.server.WSGIServer waitress.task.ErrorTask.content_length waitress.task.ThreadedTaskDispatcher.start_new_thread waitress.task.WSGITask.content_length -waitress.trigger.wasyncore.compat.qualname -waitress.trigger.wasyncore.compat.reraise -waitress.trigger.wasyncore.compat.set_nonblocking -waitress.trigger.wasyncore.compat.text_ -waitress.trigger.wasyncore.compat.tobytes -waitress.trigger.wasyncore.compat.tostr -waitress.trigger.wasyncore.compat.unquote_bytes_to_wsgi -waitress.trigger.wasyncore.dispatcher_with_send.handle_write -waitress.wasyncore.compat.qualname -waitress.wasyncore.compat.reraise -waitress.wasyncore.compat.set_nonblocking -waitress.wasyncore.compat.text_ -waitress.wasyncore.compat.tobytes -waitress.wasyncore.compat.tostr -waitress.wasyncore.compat.unquote_bytes_to_wsgi -waitress.wasyncore.dispatcher_with_send.handle_write +waitress.rfc7230.BWS waitress.wasyncore.map +waitress.wasyncore.dispatcher_with_send.handle_write diff --git a/stubs/waitress/METADATA.toml b/stubs/waitress/METADATA.toml index 40f3c61..91331cf 100644 --- a/stubs/waitress/METADATA.toml +++ b/stubs/waitress/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.1" +version = "2.1.*" requires = [] diff --git a/stubs/waitress/waitress/__init__.pyi b/stubs/waitress/waitress/__init__.pyi index 2abd726..f3aef6f 100644 --- a/stubs/waitress/waitress/__init__.pyi +++ b/stubs/waitress/waitress/__init__.pyi @@ -1,7 +1,7 @@ -from typing import Any, Tuple +from typing import Any from waitress.server import create_server as create_server def serve(app: Any, **kw: Any) -> None: ... def serve_paste(app: Any, global_conf: Any, **kw: Any) -> int: ... -def profile(cmd: Any, globals: Any, locals: Any, sort_order: Tuple[str, ...], callers: bool) -> None: ... +def profile(cmd: Any, globals: Any, locals: Any, sort_order: tuple[str, ...], callers: bool) -> None: ... diff --git a/stubs/waitress/waitress/adjustments.pyi b/stubs/waitress/waitress/adjustments.pyi index 1374444..433f795 100644 --- a/stubs/waitress/waitress/adjustments.pyi +++ b/stubs/waitress/waitress/adjustments.pyi @@ -1,17 +1,18 @@ +from collections.abc import Iterable, Sequence from socket import socket -from typing import Any, FrozenSet, Iterable, Sequence, Set, Tuple +from typing import Any 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[Any] -KNOWN_PROXY_HEADERS: FrozenSet[Any] +truthy: frozenset[Any] +KNOWN_PROXY_HEADERS: frozenset[Any] def asbool(s: bool | str | int | None) -> bool: ... def asoctal(s: str) -> int: ... def aslist_cronly(value: str) -> list[str]: ... def aslist(value: str) -> list[str]: ... -def asset(value: str | None) -> Set[str]: ... +def asset(value: str | None) -> set[str]: ... def slash_fixed_str(s: str | None) -> str: ... def str_iftruthy(s: str | None) -> str | None: ... def as_socket_list(sockets: Sequence[object]) -> list[socket]: ... @@ -27,7 +28,7 @@ class Adjustments: threads: int = ... trusted_proxy: str | None = ... trusted_proxy_count: int | None = ... - trusted_proxy_headers: Set[str] = ... + trusted_proxy_headers: set[str] = ... log_untrusted_proxy_headers: bool = ... clear_untrusted_proxy_headers: _bool_marker | bool = ... url_scheme: str = ... @@ -48,7 +49,7 @@ class Adjustments: expose_tracebacks: bool = ... unix_socket: str | None = ... unix_socket_perms: int = ... - socket_options: list[Tuple[int, int, int]] = ... + socket_options: list[tuple[int, int, int]] = ... asyncore_loop_timeout: int = ... asyncore_use_poll: bool = ... ipv4: bool = ... @@ -56,6 +57,6 @@ class Adjustments: sockets: list[socket] = ... def __init__(self, **kw: Any) -> None: ... @classmethod - def parse_args(cls, argv: str) -> Tuple[dict[str, Any], Any]: ... + def parse_args(cls, argv: str) -> tuple[dict[str, Any], Any]: ... @classmethod def check_sockets(cls, sockets: Iterable[socket]) -> None: ... diff --git a/stubs/waitress/waitress/buffers.pyi b/stubs/waitress/waitress/buffers.pyi index 128b1ce..0babdda 100644 --- a/stubs/waitress/waitress/buffers.pyi +++ b/stubs/waitress/waitress/buffers.pyi @@ -1,5 +1,6 @@ +from collections.abc import Callable from io import BufferedIOBase, BufferedRandom, BytesIO -from typing import Any, Callable +from typing import Any COPY_BYTES: int STRBUF_LIMIT: int diff --git a/stubs/waitress/waitress/channel.pyi b/stubs/waitress/waitress/channel.pyi index 1e3b84c..d14dff8 100644 --- a/stubs/waitress/waitress/channel.pyi +++ b/stubs/waitress/waitress/channel.pyi @@ -1,6 +1,6 @@ +from collections.abc import Mapping, Sequence from socket import socket from threading import Condition, Lock -from typing import Mapping, Sequence, Tuple from waitress.adjustments import Adjustments from waitress.buffers import OverflowableBuffer @@ -31,7 +31,7 @@ class HTTPChannel(wasyncore.dispatcher): sendbuf_len: int = ... task_lock: Lock = ... outbuf_lock: Condition = ... - addr: Tuple[str, int] = ... + addr: tuple[str, int] = ... def __init__( self, server: BaseWSGIServer, sock: socket, addr: str, adj: Adjustments, map: Mapping[int, socket] | None = ... ) -> None: ... diff --git a/stubs/waitress/waitress/compat.pyi b/stubs/waitress/waitress/compat.pyi index 94bbb9e..4c00c69 100644 --- a/stubs/waitress/waitress/compat.pyi +++ b/stubs/waitress/waitress/compat.pyi @@ -1,15 +1,12 @@ from io import TextIOWrapper -from typing import Any, Tuple +from typing import Any PY2: bool PY3: bool WIN: bool -string_types: Tuple[str] -integer_types: Tuple[int] -class_types: Tuple[type] -text_type = str -binary_type = bytes -long = int +string_types: tuple[str] +integer_types: tuple[int] +class_types: tuple[type] def unquote_bytes_to_wsgi(bytestring: bytes) -> str: ... def text_(s: str, encoding: str = ..., errors: str = ...) -> str: ... diff --git a/stubs/waitress/waitress/parser.pyi b/stubs/waitress/waitress/parser.pyi index 8b7a091..a3867aa 100644 --- a/stubs/waitress/waitress/parser.pyi +++ b/stubs/waitress/waitress/parser.pyi @@ -1,12 +1,12 @@ +from collections.abc import Mapping, Sequence from io import BytesIO -from typing import Any, Mapping, Pattern, Sequence, Tuple +from re import Pattern +from typing import Any from waitress.adjustments import Adjustments from waitress.receiver import ChunkedReceiver, FixedStreamReceiver from waitress.utilities import Error -from .rfc7230 import HEADER_FIELD as HEADER_FIELD - class ParsingError(Exception): ... class TransferEncodingNotImplemented(Exception): ... @@ -35,9 +35,9 @@ class HTTPRequestParser: def get_body_stream(self) -> BytesIO: ... def close(self) -> None: ... -def split_uri(uri: bytes) -> Tuple[str, str, bytes, str, str]: ... +def split_uri(uri: bytes) -> tuple[str, str, bytes, str, str]: ... def get_header_lines(header: bytes) -> Sequence[bytes]: ... first_line_re: Pattern[Any] -def crack_first_line(line: str) -> Tuple[bytes, bytes, bytes]: ... +def crack_first_line(line: str) -> tuple[bytes, bytes, bytes]: ... diff --git a/stubs/waitress/waitress/proxy_headers.pyi b/stubs/waitress/waitress/proxy_headers.pyi index b13a2e9..d5b7745 100644 --- a/stubs/waitress/waitress/proxy_headers.pyi +++ b/stubs/waitress/waitress/proxy_headers.pyi @@ -1,5 +1,6 @@ +from collections.abc import Callable, Mapping, Sequence from logging import Logger -from typing import Any, Callable, Mapping, NamedTuple, Sequence, Set +from typing import Any, NamedTuple from .utilities import BadRequest as BadRequest @@ -21,14 +22,14 @@ def proxy_headers_middleware( app: Any, trusted_proxy: str | None = ..., trusted_proxy_count: int = ..., - trusted_proxy_headers: Set[str] | None = ..., + trusted_proxy_headers: set[str] | None = ..., clear_untrusted: bool = ..., log_untrusted: bool = ..., logger: Logger = ..., ) -> Callable[..., Any]: ... def parse_proxy_headers( - environ: Mapping[str, str], trusted_proxy_count: int, trusted_proxy_headers: Set[str], logger: Logger = ... -) -> Set[str]: ... + environ: Mapping[str, str], trusted_proxy_count: int, trusted_proxy_headers: set[str], logger: Logger = ... +) -> set[str]: ... def strip_brackets(addr: str) -> str: ... def clear_untrusted_headers( environ: Mapping[str, str], untrusted_headers: Sequence[str], log_warning: bool = ..., logger: Logger = ... diff --git a/stubs/waitress/waitress/rfc7230.pyi b/stubs/waitress/waitress/rfc7230.pyi index af3bd2e..2759377 100644 --- a/stubs/waitress/waitress/rfc7230.pyi +++ b/stubs/waitress/waitress/rfc7230.pyi @@ -1,5 +1,3 @@ -from typing import Any, Pattern - from .compat import tobytes as tobytes WS: str @@ -13,4 +11,3 @@ VCHAR: str FIELD_VCHAR: str FIELD_CONTENT: str FIELD_VALUE: str -HEADER_FIELD: Pattern[Any] diff --git a/stubs/waitress/waitress/runner.pyi b/stubs/waitress/waitress/runner.pyi index ad7e9fd..aeced93 100644 --- a/stubs/waitress/waitress/runner.pyi +++ b/stubs/waitress/waitress/runner.pyi @@ -1,11 +1,13 @@ +from collections.abc import Callable, Sequence from io import TextIOWrapper -from typing import Any, Callable, Pattern, Sequence, Tuple +from re import Pattern +from typing import Any HELP: str RUNNER_PATTERN: Pattern[Any] -def match(obj_name: str) -> Tuple[str, str]: ... +def match(obj_name: str) -> tuple[str, str]: ... def resolve(module_name: str, object_name: str) -> Any: ... def show_help(stream: TextIOWrapper, name: str, error: str | None = ...) -> None: ... def show_exception(stream: TextIOWrapper) -> None: ... -def run(argv: Sequence[str] = ..., _serve: Callable[..., Any] = ...) -> None: ... +def run(argv: Sequence[str] = ..., _serve: Callable[..., object] = ...) -> None: ... diff --git a/stubs/waitress/waitress/server.pyi b/stubs/waitress/waitress/server.pyi index 269a390..e8cb00a 100644 --- a/stubs/waitress/waitress/server.pyi +++ b/stubs/waitress/waitress/server.pyi @@ -1,5 +1,6 @@ +from collections.abc import Sequence from socket import socket -from typing import Any, Sequence, Tuple +from typing import Any from waitress.adjustments import Adjustments from waitress.channel import HTTPChannel @@ -20,13 +21,13 @@ class MultiSocketServer: asyncore: Any = ... adj: Adjustments = ... map: Any = ... - effective_listen: Sequence[Tuple[str, int]] = ... + effective_listen: Sequence[tuple[str, int]] = ... task_dispatcher: ThreadedTaskDispatcher = ... def __init__( self, map: Any | None = ..., adj: Adjustments | None = ..., - effective_listen: Sequence[Tuple[str, int]] | None = ..., + effective_listen: Sequence[tuple[str, int]] | None = ..., dispatcher: ThreadedTaskDispatcher | None = ..., ) -> None: ... def print_listen(self, format_str: str) -> None: ... @@ -38,7 +39,7 @@ class BaseWSGIServer(wasyncore.dispatcher): next_channel_cleanup: int = ... socketmod: socket = ... asyncore: Any = ... - sockinfo: Tuple[int, int, int, Tuple[str, int]] = ... + sockinfo: tuple[int, int, int, tuple[str, int]] = ... family: int = ... socktype: int = ... application: Any = ... @@ -80,7 +81,7 @@ class BaseWSGIServer(wasyncore.dispatcher): class TcpWSGIServer(BaseWSGIServer): def bind_server_socket(self) -> None: ... - def getsockname(self) -> Tuple[str, Tuple[str, int]]: ... + def getsockname(self) -> tuple[str, tuple[str, int]]: ... def set_socket_options(self, conn: socket) -> None: ... class UnixWSGIServer(BaseWSGIServer): @@ -96,8 +97,8 @@ class UnixWSGIServer(BaseWSGIServer): **kw: Any, ) -> None: ... def bind_server_socket(self) -> None: ... - def getsockname(self) -> Tuple[str, Tuple[str, int]]: ... - def fix_addr(self, addr: Any) -> Tuple[str, None]: ... + def getsockname(self) -> tuple[str, tuple[str, int]]: ... + def fix_addr(self, addr: Any) -> tuple[str, None]: ... def get_server_name(self, ip: Any) -> str: ... WSGIServer: TcpWSGIServer diff --git a/stubs/waitress/waitress/task.pyi b/stubs/waitress/waitress/task.pyi index c0dea9f..7a88a9c 100644 --- a/stubs/waitress/waitress/task.pyi +++ b/stubs/waitress/waitress/task.pyi @@ -1,6 +1,8 @@ +from collections import deque +from collections.abc import Mapping, Sequence from logging import Logger from threading import Condition, Lock -from typing import Any, Deque, Mapping, Sequence, Tuple +from typing import Any from .channel import HTTPChannel from .utilities import Error @@ -14,11 +16,10 @@ class ThreadedTaskDispatcher: logger: Logger = ... queue_logger: Logger = ... threads: set[Any] = ... - queue: Deque[Task] = ... + queue: deque[Task] = ... lock: Lock = ... queue_cv: Condition = ... thread_exit_cv: Condition = ... - def __init__(self) -> None: ... def start_new_thread(self, target: Any, args: Any) -> None: ... def handler_thread(self, thread_no: int) -> None: ... def set_thread_count(self, count: int) -> None: ... @@ -39,7 +40,7 @@ class Task: logger: Logger = ... channel: HTTPChannel = ... request: Error = ... - response_headers: Sequence[Tuple[str, str]] = ... + response_headers: Sequence[tuple[str, str]] = ... version: str = ... def __init__(self, channel: HTTPChannel, request: Error) -> None: ... def service(self) -> None: ... @@ -60,7 +61,7 @@ class ErrorTask(Task): class WSGITask(Task): environ: Any | None = ... - response_headers: Sequence[Tuple[str, str]] = ... + response_headers: Sequence[tuple[str, str]] = ... complete: bool = ... status: str = ... content_length: int = ... diff --git a/stubs/waitress/waitress/trigger.pyi b/stubs/waitress/waitress/trigger.pyi index 8196dbb..8736ece 100644 --- a/stubs/waitress/waitress/trigger.pyi +++ b/stubs/waitress/waitress/trigger.pyi @@ -1,7 +1,7 @@ import sys +from collections.abc import Callable, Mapping from socket import socket from threading import Lock -from typing import Callable, Mapping from typing_extensions import Literal from . import wasyncore as wasyncore @@ -10,13 +10,12 @@ class _triggerbase: kind: str | None = ... lock: Lock = ... thunks: Callable[[None], None] = ... - def __init__(self) -> None: ... def readable(self) -> Literal[True]: ... def writable(self) -> Literal[False]: ... def handle_connect(self) -> None: ... def handle_close(self) -> None: ... def close(self) -> None: ... - def pull_trigger(self, thunk: Callable[[None], None] | None = ...) -> None: ... + def pull_trigger(self, thunk: Callable[[None], object] | None = ...) -> None: ... def handle_read(self) -> None: ... if sys.platform == "linux" or sys.platform == "darwin": diff --git a/stubs/waitress/waitress/utilities.pyi b/stubs/waitress/waitress/utilities.pyi index a7b7b3c..cf3d44c 100644 --- a/stubs/waitress/waitress/utilities.pyi +++ b/stubs/waitress/waitress/utilities.pyi @@ -1,7 +1,8 @@ +from _typeshed.wsgi import StartResponse +from collections.abc import Iterator, Mapping, Sequence from logging import Logger -from typing import Any, Callable, Mapping, Match, Pattern, Sequence, Tuple - -from .rfc7230 import OBS_TEXT as OBS_TEXT, VCHAR as VCHAR +from re import Match, Pattern +from typing import Any logger: Logger queue_logger: Logger @@ -23,27 +24,18 @@ months_reg: str rfc822_date: str rfc822_reg: Pattern[Any] -def unpack_rfc822(m: Match[Any]) -> Tuple[int, int, int, int, int, int, int, int, int]: ... +def unpack_rfc822(m: Match[Any]) -> tuple[int, int, int, int, int, int, int, int, int]: ... rfc850_date: str rfc850_reg: Pattern[Any] -def unpack_rfc850(m: Match[Any]) -> Tuple[int, int, int, int, int, int, int, int, int]: ... +def unpack_rfc850(m: Match[Any]) -> tuple[int, int, int, int, int, int, int, int, int]: ... weekdayname: Sequence[str] monthname: Sequence[str] def build_http_date(when: int) -> str: ... def parse_http_date(d: str) -> int: ... - -vchar_re: str -obs_text_re: str -qdtext_re: str -quoted_pair_re: str -quoted_string_re: str -quoted_string: Pattern[Any] -quoted_pair: Pattern[Any] - def undquote(value: str) -> str: ... def cleanup_unix_socket(path: str) -> None: ... @@ -52,8 +44,8 @@ class Error: reason: str = ... body: str = ... def __init__(self, body: str) -> None: ... - def to_response(self) -> Tuple[str, Sequence[Tuple[str, str]], str]: ... - def wsgi_response(self, environ: Any, start_response: Callable[[str, Sequence[Tuple[str, str]]], None]) -> str: ... + def to_response(self) -> tuple[str, Sequence[tuple[str, str]], str]: ... + def wsgi_response(self, environ: Any, start_response: StartResponse) -> Iterator[str]: ... class BadRequest(Error): code: int = ... diff --git a/stubs/waitress/waitress/wasyncore.pyi b/stubs/waitress/waitress/wasyncore.pyi index 003c17e..0338799 100644 --- a/stubs/waitress/waitress/wasyncore.pyi +++ b/stubs/waitress/waitress/wasyncore.pyi @@ -1,11 +1,13 @@ +from collections.abc import Callable, Mapping from io import BytesIO from logging import Logger from socket import socket -from typing import Any, Callable, Mapping, Tuple +from typing import Any +from typing_extensions import TypeAlias from . import compat as compat, utilities as utilities -_socket = socket +_Socket: TypeAlias = socket socket_map: Mapping[int, socket] map: Mapping[int, socket] @@ -21,7 +23,7 @@ def poll2(timeout: float = ..., map: Mapping[int, socket] | None = ...) -> None: poll3 = poll2 def loop(timeout: float = ..., use_poll: bool = ..., map: Mapping[int, socket] | None = ..., count: int | None = ...) -> None: ... -def compact_traceback() -> Tuple[Tuple[str, str, str], BaseException, BaseException, str]: ... +def compact_traceback() -> tuple[tuple[str, str, str], BaseException, BaseException, str]: ... class dispatcher: debug: bool = ... @@ -29,25 +31,25 @@ class dispatcher: accepting: bool = ... connecting: bool = ... closing: bool = ... - addr: Tuple[str, int] | None = ... + addr: tuple[str, int] | None = ... ignore_log_types: frozenset[Any] logger: Logger = ... - compact_traceback: Callable[[], Tuple[Tuple[str, str, str], BaseException, BaseException, str]] = ... - socket: _socket | None = ... - def __init__(self, sock: _socket | None = ..., map: Mapping[int, _socket] | None = ...) -> None: ... - def add_channel(self, map: Mapping[int, _socket] | None = ...) -> None: ... - def del_channel(self, map: Mapping[int, _socket] | None = ...) -> None: ... - family_and_type: Tuple[int, int] = ... + compact_traceback: Callable[[], tuple[tuple[str, str, str], BaseException, BaseException, str]] = ... + socket: _Socket | None = ... + def __init__(self, sock: _Socket | None = ..., map: Mapping[int, _Socket] | None = ...) -> None: ... + def add_channel(self, map: Mapping[int, _Socket] | None = ...) -> None: ... + def del_channel(self, map: Mapping[int, _Socket] | None = ...) -> None: ... + family_and_type: tuple[int, int] = ... def create_socket(self, family: int = ..., type: int = ...) -> None: ... - def set_socket(self, sock: _socket, map: Mapping[int, _socket] | None = ...) -> None: ... + def set_socket(self, sock: _Socket, map: Mapping[int, _Socket] | None = ...) -> None: ... def set_reuse_addr(self) -> None: ... def readable(self) -> bool: ... def writable(self) -> bool: ... def listen(self, num: int) -> None: ... - def bind(self, addr: Tuple[str, int]) -> None: ... - def connect(self, address: Tuple[str, int]) -> None: ... - def accept(self) -> Tuple[_socket, Tuple[str, int]] | None: ... - def send(self, data: bytes) -> int: ... + def bind(self, addr: tuple[str, int]) -> None: ... + def connect(self, address: tuple[str, int]) -> None: ... + def accept(self) -> tuple[_Socket, tuple[str, int]] | None: ... + def send(self, data: bytes, do_close: bool = ...) -> int: ... def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... def log(self, message: str) -> None: ... @@ -62,7 +64,7 @@ class dispatcher: def handle_write(self) -> None: ... def handle_connect(self) -> None: ... def handle_accept(self) -> None: ... - def handle_accepted(self, sock: _socket, addr: Any) -> None: ... + def handle_accepted(self, sock: _Socket, addr: Any) -> None: ... def handle_close(self) -> None: ... class dispatcher_with_send(dispatcher): @@ -71,7 +73,7 @@ class dispatcher_with_send(dispatcher): def initiate_send(self) -> None: ... handle_write: Callable[[], None] = ... def writable(self) -> bool: ... - def send(self, data: bytes) -> None: ... # type: ignore + def send(self, data: bytes) -> None: ... # type: ignore[override] def close_all(map: Mapping[int, socket] | None = ..., ignore_all: bool = ...) -> None: ... @@ -89,6 +91,6 @@ class file_wrapper: class file_dispatcher(dispatcher): connected: bool = ... - def __init__(self, fd: BytesIO, map: Mapping[int, _socket] | None = ...) -> None: ... - socket: _socket = ... + def __init__(self, fd: BytesIO, map: Mapping[int, _Socket] | None = ...) -> None: ... + socket: _Socket = ... def set_file(self, fd: BytesIO) -> None: ... diff --git a/stubs/whatthepatch/METADATA.toml b/stubs/whatthepatch/METADATA.toml new file mode 100644 index 0000000..516f11f --- /dev/null +++ b/stubs/whatthepatch/METADATA.toml @@ -0,0 +1,4 @@ +version = "1.0.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/whatthepatch/whatthepatch/__init__.pyi b/stubs/whatthepatch/whatthepatch/__init__.pyi new file mode 100644 index 0000000..600e452 --- /dev/null +++ b/stubs/whatthepatch/whatthepatch/__init__.pyi @@ -0,0 +1,2 @@ +from .apply import apply_diff as apply_diff +from .patch import parse_patch as parse_patch diff --git a/stubs/whatthepatch/whatthepatch/apply.pyi b/stubs/whatthepatch/whatthepatch/apply.pyi new file mode 100644 index 0000000..c927a4c --- /dev/null +++ b/stubs/whatthepatch/whatthepatch/apply.pyi @@ -0,0 +1,8 @@ +from collections.abc import Iterable + +from . import patch as patch +from .exceptions import HunkApplyException as HunkApplyException, SubprocessException as SubprocessException +from .snippets import remove as remove, which as which + +def apply_patch(diffs: patch.diffobj | Iterable[patch.diffobj]) -> None: ... +def apply_diff(diff: patch.diffobj, text: str | Iterable[str], reverse: bool = ..., use_patch: bool = ...) -> list[str]: ... diff --git a/stubs/whatthepatch/whatthepatch/exceptions.pyi b/stubs/whatthepatch/whatthepatch/exceptions.pyi new file mode 100644 index 0000000..918275e --- /dev/null +++ b/stubs/whatthepatch/whatthepatch/exceptions.pyi @@ -0,0 +1,14 @@ +class WhatThePatchException(Exception): ... + +class HunkException(WhatThePatchException): + hunk: int | None + def __init__(self, msg: str, hunk: int | None = ...) -> None: ... + +class ApplyException(WhatThePatchException): ... + +class SubprocessException(ApplyException): + code: int + def __init__(self, msg: str, code: int) -> None: ... + +class HunkApplyException(HunkException, ApplyException, ValueError): ... +class ParseException(HunkException, ValueError): ... diff --git a/stubs/whatthepatch/whatthepatch/patch.pyi b/stubs/whatthepatch/whatthepatch/patch.pyi new file mode 100644 index 0000000..9e03e3d --- /dev/null +++ b/stubs/whatthepatch/whatthepatch/patch.pyi @@ -0,0 +1,78 @@ +from collections.abc import Iterable, Iterator +from re import Pattern +from typing import NamedTuple + +from . import exceptions as exceptions +from .snippets import findall_regex as findall_regex, split_by_regex as split_by_regex + +class header(NamedTuple): + index_path: str | None + old_path: str + old_version: str | None + new_path: str + new_version: str | None + +class diffobj(NamedTuple): + header: header | None + changes: list[Change] | None + text: str + +class Change(NamedTuple): + old: int | None + new: int | None + line: int | None + hunk: int + +file_timestamp_str: str +diffcmd_header: Pattern[str] +unified_header_index: Pattern[str] +unified_header_old_line: Pattern[str] +unified_header_new_line: Pattern[str] +unified_hunk_start: Pattern[str] +unified_change: Pattern[str] +context_header_old_line: Pattern[str] +context_header_new_line: Pattern[str] +context_hunk_start: Pattern[str] +context_hunk_old: Pattern[str] +context_hunk_new: Pattern[str] +context_change: Pattern[str] +ed_hunk_start: Pattern[str] +ed_hunk_end: Pattern[str] +rcs_ed_hunk_start: Pattern[str] +default_hunk_start: Pattern[str] +default_hunk_mid: Pattern[str] +default_change: Pattern[str] +git_diffcmd_header: Pattern[str] +git_header_index: Pattern[str] +git_header_old_line: Pattern[str] +git_header_new_line: Pattern[str] +git_header_file_mode: Pattern[str] +git_header_binary_file: Pattern[str] +bzr_header_index: Pattern[str] +bzr_header_old_line: Pattern[str] +bzr_header_new_line: Pattern[str] +svn_header_index: Pattern[str] +svn_header_timestamp_version: Pattern[str] +svn_header_timestamp: Pattern[str] +cvs_header_index: Pattern[str] +cvs_header_rcs: Pattern[str] +cvs_header_timestamp: Pattern[str] +cvs_header_timestamp_colon: Pattern[str] +old_cvs_diffcmd_header: Pattern[str] + +def parse_patch(text: str | Iterable[str]) -> Iterator[diffobj]: ... +def parse_header(text: str | Iterable[str]) -> header | None: ... +def parse_scm_header(text: str | Iterable[str]) -> header | None: ... +def parse_diff_header(text: str | Iterable[str]) -> header | None: ... +def parse_diff(text: str | Iterable[str]) -> list[Change] | None: ... +def parse_git_header(text: str | Iterable[str]) -> header | None: ... +def parse_svn_header(text: str | Iterable[str]) -> header | None: ... +def parse_cvs_header(text: str | Iterable[str]) -> header | None: ... +def parse_diffcmd_header(text: str | Iterable[str]) -> header | None: ... +def parse_unified_header(text: str | Iterable[str]) -> header | None: ... +def parse_context_header(text: str | Iterable[str]) -> header | None: ... +def parse_default_diff(text: str | Iterable[str]) -> list[Change] | None: ... +def parse_unified_diff(text: str | Iterable[str]) -> list[Change] | None: ... +def parse_context_diff(text: str | Iterable[str]) -> list[Change] | None: ... +def parse_ed_diff(text: str | Iterable[str]) -> list[Change] | None: ... +def parse_rcs_ed_diff(text: str | Iterable[str]) -> list[Change] | None: ... diff --git a/stubs/whatthepatch/whatthepatch/snippets.pyi b/stubs/whatthepatch/whatthepatch/snippets.pyi new file mode 100644 index 0000000..edb748f --- /dev/null +++ b/stubs/whatthepatch/whatthepatch/snippets.pyi @@ -0,0 +1,7 @@ +from collections.abc import Sequence +from re import Pattern + +def remove(path: str) -> None: ... +def findall_regex(items: Sequence[str], regex: Pattern[str]) -> list[int]: ... +def split_by_regex(items: Sequence[str], regex: Pattern[str]) -> list[Sequence[str]]: ... +def which(program: str) -> str | None: ... diff --git a/stubs/xmltodict/METADATA.toml b/stubs/xmltodict/METADATA.toml new file mode 100644 index 0000000..18912b6 --- /dev/null +++ b/stubs/xmltodict/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.13.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/xmltodict/xmltodict.pyi b/stubs/xmltodict/xmltodict.pyi new file mode 100644 index 0000000..c370329 --- /dev/null +++ b/stubs/xmltodict/xmltodict.pyi @@ -0,0 +1,38 @@ +from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite +from collections import OrderedDict +from collections.abc import Mapping +from types import GeneratorType +from typing import Any, overload + +__license__: str + +class ParsingInterrupted(Exception): ... + +def parse( + xml_input: str | ReadableBuffer | SupportsRead[bytes] | GeneratorType[ReadableBuffer, Any, Any], + encoding: str | None = ..., + expat: Any = ..., + process_namespaces: bool = ..., + namespace_separator: str = ..., + disable_entities: bool = ..., + process_comments: bool = ..., + **kwargs: Any, +) -> OrderedDict[str, Any]: ... +@overload +def unparse( + input_dict: Mapping[str, Any], + output: SupportsWrite[bytes] | SupportsWrite[str], + encoding: str = ..., + full_document: bool = ..., + short_empty_elements: bool = ..., + **kwargs: Any, +) -> None: ... +@overload +def unparse( + input_dict: Mapping[str, Any], + output: None = ..., + encoding: str = ..., + full_document: bool = ..., + short_empty_elements: bool = ..., + **kwargs: Any, +) -> str: ... diff --git a/stubs/xxhash/METADATA.toml b/stubs/xxhash/METADATA.toml index 0f01cc4..07d7251 100644 --- a/stubs/xxhash/METADATA.toml +++ b/stubs/xxhash/METADATA.toml @@ -1,2 +1,5 @@ -version = "2.0" -python2 = true +version = "3.0.*" +obsolete_since = "3.1.0" # Released on 2022-10-19 + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/xxhash/xxhash.pyi b/stubs/xxhash/xxhash.pyi deleted file mode 100644 index 0e0b7cf..0000000 --- a/stubs/xxhash/xxhash.pyi +++ /dev/null @@ -1,51 +0,0 @@ -import sys -from _typeshed import ReadableBuffer -from typing_extensions import SupportsIndex, final - -if sys.version_info >= (3, 0): - from hashlib import _Hash -else: - from hashlib import _hash as _Hash - -VERSION: str -XXHASH_VERSION: str - -class _IntDigestHash(_Hash): - @property - def seed(self) -> int: ... - @property - def digestsize(self) -> int: ... - def __init__(self, input: ReadableBuffer | str = ..., seed: SupportsIndex = ...) -> None: ... - def intdigest(self) -> int: ... - def reset(self) -> None: ... - -# python-xxhash v2.0.0 does not support the string or usedforsecurity kwargs -@final -class xxh32(_IntDigestHash): ... - -@final -class xxh64(_IntDigestHash): ... - -@final -class xxh3_64(_IntDigestHash): ... - -@final -class xxh3_128(_IntDigestHash): ... - -def xxh32_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... -def xxh32_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... -def xxh32_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... -def xxh64_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... -def xxh64_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... -def xxh64_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... -def xxh3_64_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... -def xxh3_64_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... -def xxh3_64_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... -def xxh3_128_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... -def xxh3_128_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... -def xxh3_128_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... - -xxh128 = xxh3_128 -xxh128_digest = xxh3_128_digest -xxh128_intdigest = xxh3_128_intdigest -xxh128_hexdigest = xxh3_128_hexdigest diff --git a/stubs/xxhash/xxhash/__init__.pyi b/stubs/xxhash/xxhash/__init__.pyi new file mode 100644 index 0000000..a98e66c --- /dev/null +++ b/stubs/xxhash/xxhash/__init__.pyi @@ -0,0 +1,49 @@ +from _typeshed import ReadableBuffer +from hashlib import _Hash +from typing_extensions import SupportsIndex, final + +VERSION: str +XXHASH_VERSION: str +VERSION_TUPLE: tuple[int, ...] + +algorithms_available: set[str] + +class _IntDigestHash(_Hash): + @property + def seed(self) -> int: ... + @property + def digestsize(self) -> int: ... + def __init__(self, input: ReadableBuffer | str = ..., seed: SupportsIndex = ...) -> None: ... + def intdigest(self) -> int: ... + def reset(self) -> None: ... + +# python-xxhash v2.0.0 does not support the string or usedforsecurity kwargs +@final +class xxh32(_IntDigestHash): ... + +@final +class xxh64(_IntDigestHash): ... + +@final +class xxh3_64(_IntDigestHash): ... + +@final +class xxh3_128(_IntDigestHash): ... + +def xxh32_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... +def xxh32_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... +def xxh32_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... +def xxh64_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... +def xxh64_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... +def xxh64_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... +def xxh3_64_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... +def xxh3_64_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... +def xxh3_64_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... +def xxh3_128_digest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> bytes: ... +def xxh3_128_intdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> int: ... +def xxh3_128_hexdigest(input: ReadableBuffer | str, seed: SupportsIndex = ...) -> str: ... + +xxh128 = xxh3_128 +xxh128_digest = xxh3_128_digest +xxh128_intdigest = xxh3_128_intdigest +xxh128_hexdigest = xxh3_128_hexdigest diff --git a/stubs/xxhash/xxhash/version.pyi b/stubs/xxhash/xxhash/version.pyi new file mode 100644 index 0000000..b18bf8c --- /dev/null +++ b/stubs/xxhash/xxhash/version.pyi @@ -0,0 +1,4 @@ +from _typeshed import Incomplete + +VERSION: str +VERSION_TUPLE: Incomplete diff --git a/stubs/zxcvbn/@tests/stubtest_allowlist.txt b/stubs/zxcvbn/@tests/stubtest_allowlist.txt new file mode 100644 index 0000000..a1ee3d2 --- /dev/null +++ b/stubs/zxcvbn/@tests/stubtest_allowlist.txt @@ -0,0 +1,7 @@ +zxcvbn.__main__ + +# re-exports: +zxcvbn.feedback.ALL_UPPER +zxcvbn.feedback.START_UPPER +zxcvbn.scoring.ADJACENCY_GRAPHS +zxcvbn.matching.FREQUENCY_LISTS diff --git a/stubs/zxcvbn/METADATA.toml b/stubs/zxcvbn/METADATA.toml new file mode 100644 index 0000000..023b896 --- /dev/null +++ b/stubs/zxcvbn/METADATA.toml @@ -0,0 +1,4 @@ +version = "4.4.*" + +[tool.stubtest] +ignore_missing_stub = false diff --git a/stubs/zxcvbn/zxcvbn/__init__.pyi b/stubs/zxcvbn/zxcvbn/__init__.pyi new file mode 100644 index 0000000..f363552 --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/__init__.pyi @@ -0,0 +1,18 @@ +import datetime +from collections.abc import Iterable +from decimal import Decimal +from typing_extensions import TypedDict + +from .feedback import _Feedback +from .matching import _Match +from .time_estimates import _TimeEstimate + +class _Result(_TimeEstimate, TypedDict): + password: str + guesses: Decimal + guesses_log10: float + sequence: list[_Match] + calc_time: datetime.timedelta + feedback: _Feedback + +def zxcvbn(password: str, user_inputs: Iterable[object] | None = ...) -> _Result: ... diff --git a/stubs/zxcvbn/zxcvbn/adjacency_graphs.pyi b/stubs/zxcvbn/zxcvbn/adjacency_graphs.pyi new file mode 100644 index 0000000..8b1e8e8 --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/adjacency_graphs.pyi @@ -0,0 +1,5 @@ +from typing_extensions import TypeAlias + +_Graph: TypeAlias = dict[str, list[str | None]] + +ADJACENCY_GRAPHS: dict[str, _Graph] diff --git a/stubs/zxcvbn/zxcvbn/feedback.pyi b/stubs/zxcvbn/zxcvbn/feedback.pyi new file mode 100644 index 0000000..31b8e63 --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/feedback.pyi @@ -0,0 +1,12 @@ +from collections.abc import Sequence +from typing_extensions import Literal, TypedDict + +from .matching import _Match + +class _Feedback(TypedDict): + warning: str + suggestions: list[str] + +def get_feedback(score: Literal[0, 1, 2, 3, 4], sequence: Sequence[_Match]) -> _Feedback: ... +def get_match_feedback(match: _Match, is_sole_match: bool) -> _Feedback: ... +def get_dictionary_match_feedback(match: _Match, is_sole_match: bool) -> _Feedback: ... diff --git a/stubs/zxcvbn/zxcvbn/frequency_lists.pyi b/stubs/zxcvbn/zxcvbn/frequency_lists.pyi new file mode 100644 index 0000000..0844500 --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/frequency_lists.pyi @@ -0,0 +1 @@ +FREQUENCY_LISTS: dict[str, list[str]] diff --git a/stubs/zxcvbn/zxcvbn/matching.pyi b/stubs/zxcvbn/zxcvbn/matching.pyi new file mode 100644 index 0000000..8d78713 --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/matching.pyi @@ -0,0 +1,95 @@ +from collections.abc import Iterable, Mapping +from decimal import Decimal +from re import Pattern +from typing import Any +from typing_extensions import Literal, NotRequired, TypedDict + +from .adjacency_graphs import _Graph + +class _Match(TypedDict): + pattern: Literal["dictionary", "spatial", "repeat", "sequence", "regex", "date"] + token: str + i: int + j: int + guesses: NotRequired[int] # all patterns except 'date' + guesses_log10: NotRequired[float] # all patterns except 'date' + + # pattern == 'date' + separator: NotRequired[str] + year: NotRequired[int] + month: NotRequired[int] + day: NotRequired[int] + + # pattern == 'dictionary' + matched_word: NotRequired[str] + dictionary_name: NotRequired[str] + l33t: NotRequired[bool] + reversed: NotRequired[bool] + rank: NotRequired[int] + base_guesses: NotRequired[int | Decimal] # Decimal for 'repeat', see below + uppercase_variations: NotRequired[int] + l33t_variations: NotRequired[int] + + # pattern == 'spatial' + turns: NotRequired[int] + + # pattern == 'repeat' + base_token: NotRequired[str] + # base_guesses: NotRequired[Decimal] + base_matches: NotRequired[list[Any]] # Any = _Match, https://github.com/python/mypy/issues/731 + repeat_count: NotRequired[float] + + # pattern == 'regex' + regex_name: NotRequired[str] + +def build_ranked_dict(ordered_list: Iterable[str]) -> dict[str, int]: ... + +RANKED_DICTIONARIES: dict[str, dict[str, int]] + +def add_frequency_lists(frequency_lists_: Mapping[str, Iterable[str]]) -> None: ... + +GRAPHS: dict[str, dict[str, list[str | None]]] +L33T_TABLE: dict[str, list[str]] +REGEXEN: dict[str, Pattern[str]] +DATE_MAX_YEAR: int +DATE_MIN_YEAR: int +DATE_SPLITS: dict[int, list[list[int]]] + +def omnimatch(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... +def dictionary_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... +def reverse_dictionary_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... +def relevant_l33t_subtable(password: str, table: Mapping[str, Iterable[str]]) -> dict[str, list[str]]: ... +def enumerate_l33t_subs(table: Mapping[str, Iterable[str]]) -> list[dict[str, str]]: ... +def translate(string: str, chr_map: Mapping[str, str]) -> str: ... +def l33t_match( + password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ..., _l33t_table: dict[str, list[str]] = ... +) -> list[_Match]: ... +def repeat_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... +def spatial_match( + password: str, _graphs: dict[str, _Graph] = ..., _ranked_dictionaries: dict[str, dict[str, int]] = ... +) -> list[_Match]: ... + +SHIFTED_RX: Pattern[str] + +def spatial_match_helper(password: str, graph: _Graph, graph_name: str) -> list[_Match]: ... + +MAX_DELTA: int + +def sequence_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... +def regex_match( + password: str, _regexen: dict[str, Pattern[str]] = ..., _ranked_dictionaries: dict[str, dict[str, int]] = ... +) -> list[_Match]: ... +def date_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ... + +class _DM(TypedDict): + month: int + day: int + +class _DMY(TypedDict): + year: int + month: int + day: int + +def map_ints_to_dmy(ints: tuple[int, int, int]) -> _DMY | None: ... +def map_ints_to_dm(ints: tuple[int, int]) -> _DM | None: ... +def two_to_four_digit_year(year: int) -> int: ... diff --git a/stubs/zxcvbn/zxcvbn/scoring.pyi b/stubs/zxcvbn/zxcvbn/scoring.pyi new file mode 100644 index 0000000..1d7d7be --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/scoring.pyi @@ -0,0 +1,47 @@ +from collections.abc import Iterable +from decimal import Decimal +from re import Pattern +from typing_extensions import TypedDict + +from .adjacency_graphs import _Graph +from .matching import _Match + +def calc_average_degree(graph: _Graph) -> float: ... + +BRUTEFORCE_CARDINALITY: int +MIN_GUESSES_BEFORE_GROWING_SEQUENCE: int +MIN_SUBMATCH_GUESSES_SINGLE_CHAR: int +MIN_SUBMATCH_GUESSES_MULTI_CHAR: int +MIN_YEAR_SPACE: int +REFERENCE_YEAR: int + +class _GuessesResult(TypedDict): + password: str + guesses: int + guesses_log10: float + sequence: list[_Match] + +def nCk(n: int, k: int) -> float: ... +def most_guessable_match_sequence(password: str, matches: Iterable[_Match], _exclude_additive: bool = ...) -> _GuessesResult: ... +def estimate_guesses(match: _Match, password: str) -> Decimal: ... +def bruteforce_guesses(match: _Match) -> int: ... +def dictionary_guesses(match: _Match) -> int: ... +def repeat_guesses(match: _Match) -> Decimal: ... +def sequence_guesses(match: _Match) -> int: ... +def regex_guesses(match: _Match) -> int | None: ... +def date_guesses(match: _Match) -> int: ... + +KEYBOARD_AVERAGE_DEGREE: float +KEYPAD_AVERAGE_DEGREE: float +KEYBOARD_STARTING_POSITIONS: int +KEYPAD_STARTING_POSITIONS: int + +def spatial_guesses(match: _Match) -> int: ... + +START_UPPER: Pattern[str] +END_UPPER: Pattern[str] +ALL_UPPER: Pattern[str] +ALL_LOWER: Pattern[str] + +def uppercase_variations(match: _Match) -> int: ... +def l33t_variations(match: _Match) -> int: ... diff --git a/stubs/zxcvbn/zxcvbn/time_estimates.pyi b/stubs/zxcvbn/zxcvbn/time_estimates.pyi new file mode 100644 index 0000000..deafec4 --- /dev/null +++ b/stubs/zxcvbn/zxcvbn/time_estimates.pyi @@ -0,0 +1,24 @@ +from decimal import Decimal +from typing_extensions import Literal, TypedDict + +class _TimeEstimate(TypedDict): + crack_times_seconds: _CrackTimeSeconds + crack_times_display: _CrackTimesDisplay + score: Literal[0, 1, 2, 3, 4] + +class _CrackTimeSeconds(TypedDict): + online_throttling_100_per_hour: Decimal + online_no_throttling_10_per_second: Decimal + offline_slow_hashing_1e4_per_second: Decimal + offline_fast_hashing_1e10_per_second: Decimal + +class _CrackTimesDisplay(TypedDict): + online_throttling_100_per_hour: str + online_no_throttling_10_per_second: str + offline_slow_hashing_1e4_per_second: str + offline_fast_hashing_1e10_per_second: str + +def estimate_attack_times(guesses: Decimal | float) -> _TimeEstimate: ... +def guesses_to_score(guesses: Decimal) -> Literal[0, 1, 2, 3, 4]: ... +def display_time(seconds: float) -> str: ... +def float_to_decimal(f: float) -> Decimal: ... diff --git a/test_cases/README.md b/test_cases/README.md new file mode 100644 index 0000000..add87f5 --- /dev/null +++ b/test_cases/README.md @@ -0,0 +1,95 @@ +## Regression tests for typeshed + +This directory contains code samples that act as a regression test for +typeshed's stdlib stubs. + +**This directory should *only* contain test cases for functions and classes which +are known to have caused problems in the past, where the stubs are difficult to +get right.** 100% test coverage for typeshed is neither necessary nor +desirable, as it would lead to code duplication. Moreover, typeshed has +multiple other mechanisms for spotting errors in the stubs. + +### Where are the third-party test cases? + +Not all third-party stubs packages in typeshed have test cases, and not all of +them need test cases. For those that do have test cases, however, the samples +can be found in `@tests/test_cases` subdirectories for each stubs package. For +example, the test cases for `requests` can be found in the +`stubs/requests/@tests/test_cases` directory. + +### The purpose of these tests + +Different test cases in this directory serve different purposes. For some stubs in +typeshed, the type annotations are complex enough that it's useful to have +sanity checks that test whether a type checker understands the intent of +the annotations correctly. Examples of tests like these are +`stdlib/builtins/check_pow.py` and `stdlib/asyncio/check_gather.py`. + +Other test cases, such as the samples for `ExitStack` in `stdlib/check_contextlib.py` +and the samples for `LogRecord` in `stdlib/check_logging.py`, do not relate to +stubs where the annotations are particularly complex, but they *do* relate to +stubs where decisions have been taken that might be slightly unusual. These +test cases serve a different purpose: to check that type checkers do not emit +false-positive errors for idiomatic usage of these classes. + +### How the tests work + +The code in this directory is not intended to be directly executed. Instead, +type checkers are run on the code, to check that typing errors are +emitted at the correct places. + +Some files in this directory simply contain samples of idiomatic Python, which +should not (if the stubs are correct) cause a type checker to emit any errors. + +Many test cases also make use of +[`assert_type`](https://docs.python.org/3.11/library/typing.html#typing.assert_type), +a function which allows us to test whether a type checker's inferred type of an +expression is what we'd like it be. + +Finally, some tests make use of `# type: ignore` comments (in combination with +mypy's +[`--warn-unused-ignores`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-warn-unused-ignores) +setting and pyright's +[`reportUnnecessaryTypeIgnoreComment`](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#type-check-diagnostics-settings) +setting) to test instances where a type checker *should* emit some kind of +error, if the stubs are correct. Both settings are enabled by default for the entire +subdirectory. + +For more information on using `assert_type` and +`--warn-unused-ignores`/`reportUnnecessaryTypeIgnoreComment` to test type +annotations, +[this page](https://typing.readthedocs.io/en/latest/source/quality.html#testing-using-assert-type-and-warn-unused-ignores) +provides a useful guide. + +### Naming convention + +Use the same top-level name for the module / package you would like to test. +Use the `check_${thing}.py` naming pattern for individual test files. + +By default, test cases go into a file with the same name as the stub file, prefixed with `check_`. +For example: `stdlib/check_contextlib.py`. + +If that file becomes too big, we instead create a directory with files named after individual objects being tested. +For example: `stdlib/builtins/check_dict.py`. + +### Differences to the rest of typeshed + +Unlike the rest of typeshed, this directory largely contains `.py` files. This +is because the purpose of this folder is to test the implications of typeshed +changes for end users, who will mainly be using `.py` files rather than `.pyi` +files. + +Another difference to the rest of typeshed is that the test cases in this +directory cannot always use modern syntax for type hints. + +For example, PEP 604 +syntax (unions with a pipe `|` operator) is new in Python 3.10. While this +syntax can be used on older Python versions in a `.pyi` file, code using this +syntax will fail at runtime on Python <=3.9. Since the test cases all use `.py` +extensions, and since the tests need to pass on all Python versions >=3.7, PEP +604 syntax cannot be used in a test case. Use `typing.Union` and +`typing.Optional` instead. + +PEP 585 syntax can also not be used in the `test_cases` directory. Use +`typing.Tuple` instead of `tuple`, `typing.Callable` instead of +`collections.abc.Callable`, and `typing.Match` instead of `re.Match` (etc.). diff --git a/test_cases/stdlib/asyncio/check_coroutines.py b/test_cases/stdlib/asyncio/check_coroutines.py new file mode 100644 index 0000000..e2c3d19 --- /dev/null +++ b/test_cases/stdlib/asyncio/check_coroutines.py @@ -0,0 +1,24 @@ +from asyncio import iscoroutinefunction +from collections.abc import Awaitable, Callable, Coroutine +from typing import Any, Union +from typing_extensions import assert_type + + +def test_iscoroutinefunction( + x: Callable[[str, int], Coroutine[str, int, bytes]], + y: Callable[[str, int], Awaitable[bytes]], + z: Callable[[str, int], Union[str, Awaitable[bytes]]], + xx: object, +) -> None: + + if iscoroutinefunction(x): + assert_type(x, Callable[[str, int], Coroutine[str, int, bytes]]) + + if iscoroutinefunction(y): + assert_type(y, Callable[[str, int], Coroutine[Any, Any, bytes]]) + + if iscoroutinefunction(z): + assert_type(z, Callable[[str, int], Coroutine[Any, Any, Any]]) + + if iscoroutinefunction(xx): + assert_type(xx, Callable[..., Coroutine[Any, Any, Any]]) diff --git a/test_cases/stdlib/asyncio/check_gather.py b/test_cases/stdlib/asyncio/check_gather.py new file mode 100644 index 0000000..c64af0b --- /dev/null +++ b/test_cases/stdlib/asyncio/check_gather.py @@ -0,0 +1,32 @@ +import asyncio +from typing import Any, Awaitable, List, Tuple, Union +from typing_extensions import assert_type + + +async def coro1() -> int: + return 42 + + +async def coro2() -> str: + return "spam" + + +async def test_gather(awaitable1: Awaitable[int], awaitable2: Awaitable[str]) -> None: + a = await asyncio.gather(awaitable1) + assert_type(a, Tuple[int]) + + b = await asyncio.gather(awaitable1, awaitable2, return_exceptions=True) + assert_type(b, Tuple[Union[int, BaseException], Union[str, BaseException]]) + + c = await asyncio.gather(awaitable1, awaitable2, awaitable1, awaitable1, awaitable1, awaitable1) + assert_type(c, List[Any]) + + awaitables_list: List[Awaitable[int]] = [awaitable1] + d = await asyncio.gather(*awaitables_list) + assert_type(d, List[Any]) + + e = await asyncio.gather() + assert_type(e, List[Any]) + + +asyncio.run(test_gather(coro1(), coro2())) diff --git a/test_cases/stdlib/asyncio/check_task.py b/test_cases/stdlib/asyncio/check_task.py new file mode 100644 index 0000000..69bcf8f --- /dev/null +++ b/test_cases/stdlib/asyncio/check_task.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +import asyncio + + +class Waiter: + def __init__(self) -> None: + self.tasks: list[asyncio.Task[object]] = [] + + def add(self, t: asyncio.Task[object]) -> None: + self.tasks.append(t) + + async def join(self) -> None: + await asyncio.wait(self.tasks) + + +async def foo() -> int: + return 42 + + +async def main() -> None: + # asyncio.Task is covariant in its type argument, which is unusual since its parent class + # asyncio.Future is invariant in its type argument. This is only sound because asyncio.Task + # is not actually Liskov substitutable for asyncio.Future: it does not implement set_result. + w = Waiter() + t: asyncio.Task[int] = asyncio.create_task(foo()) + w.add(t) + await w.join() diff --git a/test_cases/stdlib/builtins/check_dict.py b/test_cases/stdlib/builtins/check_dict.py new file mode 100644 index 0000000..3ba6ce8 --- /dev/null +++ b/test_cases/stdlib/builtins/check_dict.py @@ -0,0 +1,49 @@ +from typing import Dict, Generic, Iterable, Tuple, TypeVar +from typing_extensions import assert_type + +# These do follow `__init__` overloads order: +# mypy and pyright have different opinions about this one: +# mypy raises: 'Need type annotation for "bad"' +# pyright is fine with it. +# bad = dict() +good: Dict[str, str] = dict() +assert_type(good, Dict[str, str]) + +assert_type(dict(arg=1), Dict[str, int]) + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + + +class KeysAndGetItem(Generic[_KT, _VT]): + data: Dict[_KT, _VT] + + def keys(self) -> Iterable[_KT]: + return self.data.keys() + + def __getitem__(self, __k: _KT) -> _VT: + return self.data[__k] + + +kt1: KeysAndGetItem[int, str] = KeysAndGetItem() +assert_type(dict(kt1), Dict[int, str]) +dict(kt1, arg="a") # type: ignore + +kt2: KeysAndGetItem[str, int] = KeysAndGetItem() +assert_type(dict(kt2, arg=1), Dict[str, int]) + + +def test_iterable_tuple_overload(x: Iterable[Tuple[int, str]]) -> Dict[int, str]: + return dict(x) + + +i1: Iterable[Tuple[int, str]] = [(1, "a"), (2, "b")] +test_iterable_tuple_overload(i1) +dict(i1, arg="a") # type: ignore + +i2: Iterable[Tuple[str, int]] = [("a", 1), ("b", 2)] +assert_type(dict(i2, arg=1), Dict[str, int]) + +i3: Iterable[str] = ["a.b"] +assert_type(dict(string.split(".") for string in i3), Dict[str, str]) +dict(["foo", "bar", "baz"]) # type: ignore diff --git a/test_cases/stdlib/builtins/check_iteration.py b/test_cases/stdlib/builtins/check_iteration.py new file mode 100644 index 0000000..7195c8b --- /dev/null +++ b/test_cases/stdlib/builtins/check_iteration.py @@ -0,0 +1,14 @@ +from typing import Iterator +from typing_extensions import assert_type + + +class OldStyleIter: + def __getitem__(self, index: int) -> str: + return str(index) + + +for x in iter(OldStyleIter()): + assert_type(x, str) + +assert_type(iter(OldStyleIter()), Iterator[str]) +assert_type(next(iter(OldStyleIter())), str) diff --git a/test_cases/stdlib/builtins/check_list.py b/test_cases/stdlib/builtins/check_list.py new file mode 100644 index 0000000..793d795 --- /dev/null +++ b/test_cases/stdlib/builtins/check_list.py @@ -0,0 +1,19 @@ +from typing import List, Union +from typing_extensions import assert_type + + +# list.__add__ example from #8292 +class Foo: + def asd(self) -> int: + return 1 + + +class Bar: + def asd(self) -> int: + return 2 + + +combined = [Foo()] + [Bar()] +assert_type(combined, List[Union[Foo, Bar]]) +for item in combined: + assert_type(item.asd(), int) diff --git a/test_cases/stdlib/builtins/check_object.py b/test_cases/stdlib/builtins/check_object.py new file mode 100644 index 0000000..f2b56e4 --- /dev/null +++ b/test_cases/stdlib/builtins/check_object.py @@ -0,0 +1,11 @@ +from typing import Any, Tuple, Union + + +# The following should pass without error (see #6661): +class Diagnostic: + def __reduce__(self) -> Union[str, Tuple[Any, ...]]: + res = super().__reduce__() + if isinstance(res, tuple) and len(res) >= 3: + res[2]["_info"] = 42 + + return res diff --git a/test_cases/stdlib/builtins/check_pow.py b/test_cases/stdlib/builtins/check_pow.py new file mode 100644 index 0000000..c1ff749 --- /dev/null +++ b/test_cases/stdlib/builtins/check_pow.py @@ -0,0 +1,89 @@ +from decimal import Decimal +from fractions import Fraction +from typing import Any +from typing_extensions import Literal, assert_type + +# See #7163 +assert_type(pow(1, 0), Literal[1]) +assert_type(1**0, Literal[1]) +assert_type(pow(1, 0, None), Literal[1]) + +# TODO: We don't have a good way of expressing the fact +# that passing 0 for the third argument will lead to an exception being raised +# (see discussion in #8566) +# +# assert_type(pow(2, 4, 0), NoReturn) + +assert_type(pow(2, 4), int) +assert_type(2**4, int) +assert_type(pow(4, 6, None), int) + +assert_type(pow(5, -7), float) +assert_type(5**-7, float) + +assert_type(pow(2, 4, 5), int) # pow(, , ) +assert_type(pow(2, 35, 3), int) # pow(, , ) + +assert_type(pow(2, 8.5), float) +assert_type(2**8.6, float) +assert_type(pow(2, 8.6, None), float) + +# TODO: Why does this pass pyright but not mypy?? +# assert_type((-2) ** 0.5, complex) + +assert_type(pow((-5), 8.42, None), complex) + +assert_type(pow(4.6, 8), float) +assert_type(4.6**8, float) +assert_type(pow(5.1, 4, None), float) + +assert_type(pow(complex(6), 6.2), complex) +assert_type(complex(6) ** 6.2, complex) +assert_type(pow(complex(9), 7.3, None), complex) + +assert_type(pow(Fraction(), 4, None), Fraction) +assert_type(Fraction() ** 4, Fraction) + +assert_type(pow(Fraction(3, 7), complex(1, 8)), complex) +assert_type(Fraction(3, 7) ** complex(1, 8), complex) + +assert_type(pow(complex(4, -8), Fraction(2, 3)), complex) +assert_type(complex(4, -8) ** Fraction(2, 3), complex) + +assert_type(pow(Decimal("1.0"), Decimal("1.6")), Decimal) +assert_type(Decimal("1.0") ** Decimal("1.6"), Decimal) + +assert_type(pow(Decimal("1.0"), Decimal("1.0"), Decimal("1.0")), Decimal) +assert_type(pow(Decimal("4.6"), 7, None), Decimal) +assert_type(Decimal("4.6") ** 7, Decimal) + +# These would ideally be more precise, but `Any` is acceptable +# They have to be `Any` due to the fact that type-checkers can't distinguish +# between positive and negative numbers for the second argument to `pow()` +# +# int for positive 2nd-arg, float otherwise +assert_type(pow(4, 65), Any) +assert_type(pow(2, -45), Any) +assert_type(pow(3, 57, None), Any) +assert_type(pow(67, 0.98, None), Any) +assert_type(87**7.32, Any) +# pow(, ) -> float +# pow(, ) -> complex +assert_type(pow(4.7, 7.4), Any) +assert_type(pow(-9.8, 8.3), Any) +assert_type(pow(-9.3, -88.2), Any) +assert_type(pow(8.2, -9.8), Any) +assert_type(pow(4.7, 9.2, None), Any) +# See #7046 -- float for a positive 1st arg, complex otherwise +assert_type((-95) ** 8.42, Any) + +# All of the following cases should fail a type-checker. +pow(1.9, 4, 6) # type: ignore +pow(4, 7, 4.32) # type: ignore +pow(6.2, 5.9, 73) # type: ignore +pow(complex(6), 6.2, 7) # type: ignore +pow(Fraction(), 5, 8) # type: ignore +Decimal("8.7") ** 3.14 # type: ignore + +# TODO: This fails at runtime, but currently passes mypy and pyright: +pow(Decimal("8.5"), 3.21) diff --git a/test_cases/stdlib/builtins/check_sum.py b/test_cases/stdlib/builtins/check_sum.py new file mode 100644 index 0000000..0f256fd --- /dev/null +++ b/test_cases/stdlib/builtins/check_sum.py @@ -0,0 +1,53 @@ +from typing import Any, List, Union +from typing_extensions import Literal, assert_type + + +class Foo: + def __add__(self, other: Any) -> "Foo": + return Foo() + + +class Bar: + def __radd__(self, other: Any) -> "Bar": + return Bar() + + +class Baz: + def __add__(self, other: Any) -> "Baz": + return Baz() + + def __radd__(self, other: Any) -> "Baz": + return Baz() + + +literal_list: List[Literal[0, 1]] = [0, 1, 1] + +assert_type(sum([2, 4]), int) +assert_type(sum([3, 5], 4), int) + +assert_type(sum([True, False]), int) +assert_type(sum([True, False], True), int) +assert_type(sum(literal_list), int) + +assert_type(sum([["foo"], ["bar"]], ["baz"]), List[str]) + +assert_type(sum([Foo(), Foo()], Foo()), Foo) +assert_type(sum([Baz(), Baz()]), Union[Baz, Literal[0]]) + +# mypy and pyright infer the types differently for these, so we can't use assert_type +# Just test that no error is emitted for any of these +sum([("foo",), ("bar", "baz")], ()) # mypy: `tuple[str, ...]`; pyright: `tuple[()] | tuple[str] | tuple[str, str]` +sum([5.6, 3.2]) # mypy: `float`; pyright: `float | Literal[0]` +sum([2.5, 5.8], 5) # mypy: `float`; pyright: `float | int` + +# These all fail at runtime +sum("abcde") # type: ignore +sum([["foo"], ["bar"]]) # type: ignore +sum([("foo",), ("bar", "baz")]) # type: ignore +sum([Foo(), Foo()]) # type: ignore +sum([Bar(), Bar()], Bar()) # type: ignore +sum([Bar(), Bar()]) # type: ignore + +# TODO: these pass pyright with the current stubs, but mypy erroneously emits an error: +# sum([3, Fraction(7, 22), complex(8, 0), 9.83]) +# sum([3, Decimal('0.98')]) diff --git a/test_cases/stdlib/builtins/check_tuple.py b/test_cases/stdlib/builtins/check_tuple.py new file mode 100644 index 0000000..bf066fe --- /dev/null +++ b/test_cases/stdlib/builtins/check_tuple.py @@ -0,0 +1,11 @@ +from typing import Tuple +from typing_extensions import assert_type + + +# Empty tuples, see #8275 +class TupleSub(Tuple[int, ...]): + pass + + +assert_type(TupleSub(), TupleSub) +assert_type(TupleSub([1, 2, 3]), TupleSub) diff --git a/test_cases/stdlib/check_codecs.py b/test_cases/stdlib/check_codecs.py new file mode 100644 index 0000000..0657416 --- /dev/null +++ b/test_cases/stdlib/check_codecs.py @@ -0,0 +1,11 @@ +import codecs +from typing_extensions import assert_type + +assert_type(codecs.decode("x", "unicode-escape"), str) +assert_type(codecs.decode(b"x", "unicode-escape"), str) + +assert_type(codecs.decode(b"x", "utf-8"), str) +codecs.decode("x", "utf-8") # type: ignore + +assert_type(codecs.decode("ab", "hex"), bytes) +assert_type(codecs.decode(b"ab", "hex"), bytes) diff --git a/test_cases/stdlib/check_contextlib.py b/test_cases/stdlib/check_contextlib.py new file mode 100644 index 0000000..2625332 --- /dev/null +++ b/test_cases/stdlib/check_contextlib.py @@ -0,0 +1,18 @@ +from contextlib import ExitStack +from typing_extensions import assert_type + + +# See issue #7961 +class Thing(ExitStack): + pass + + +stack = ExitStack() +thing = Thing() +assert_type(stack.enter_context(Thing()), Thing) +assert_type(thing.enter_context(ExitStack()), ExitStack) + +with stack as cm: + assert_type(cm, ExitStack) +with thing as cm2: + assert_type(cm2, Thing) diff --git a/test_cases/stdlib/check_logging.py b/test_cases/stdlib/check_logging.py new file mode 100644 index 0000000..dd57253 --- /dev/null +++ b/test_cases/stdlib/check_logging.py @@ -0,0 +1,16 @@ +import logging +from typing import Any + +# This pattern comes from the logging docs, and should therefore pass a type checker +# See https://docs.python.org/3/library/logging.html#logrecord-objects + +old_factory = logging.getLogRecordFactory() + + +def record_factory(*args: Any, **kwargs: Any) -> logging.LogRecord: + record = old_factory(*args, **kwargs) + record.custom_attribute = 0xDECAFBAD + return record + + +logging.setLogRecordFactory(record_factory) diff --git a/test_cases/stdlib/check_threading.py b/test_cases/stdlib/check_threading.py new file mode 100644 index 0000000..9b67ac5 --- /dev/null +++ b/test_cases/stdlib/check_threading.py @@ -0,0 +1,12 @@ +import _threading_local +import threading + +loc = threading.local() +loc.foo = 42 +del loc.foo +loc.baz = ["spam", "eggs"] +del loc.baz + +l2 = _threading_local.local() +l2.asdfasdf = 56 +del l2.asdfasdf diff --git a/test_cases/stdlib/check_unittest.py b/test_cases/stdlib/check_unittest.py new file mode 100644 index 0000000..b8a16e7 --- /dev/null +++ b/test_cases/stdlib/check_unittest.py @@ -0,0 +1,86 @@ +import unittest +from datetime import datetime, timedelta +from decimal import Decimal +from fractions import Fraction + +case = unittest.TestCase() + +### +# Tests for assertAlmostEqual +### + +case.assertAlmostEqual(1, 2.4) +case.assertAlmostEqual(2.4, 2.41) +case.assertAlmostEqual(Fraction(49, 50), Fraction(48, 50)) +case.assertAlmostEqual(3.14, complex(5, 6)) +case.assertAlmostEqual(datetime(1999, 1, 2), datetime(1999, 1, 2, microsecond=1), delta=timedelta(hours=1)) +case.assertAlmostEqual(datetime(1999, 1, 2), datetime(1999, 1, 2, microsecond=1), None, "foo", timedelta(hours=1)) +case.assertAlmostEqual(Decimal("1.1"), Decimal("1.11")) +case.assertAlmostEqual(2.4, 2.41, places=8) +case.assertAlmostEqual(2.4, 2.41, delta=0.02) +case.assertAlmostEqual(2.4, 2.41, None, "foo", 0.02) + +case.assertAlmostEqual(2.4, 2.41, places=9, delta=0.02) # type: ignore +case.assertAlmostEqual("foo", "bar") # type: ignore +case.assertAlmostEqual(datetime(1999, 1, 2), datetime(1999, 1, 2, microsecond=1)) # type: ignore +case.assertAlmostEqual(Decimal("0.4"), Fraction(1, 2)) # type: ignore +case.assertAlmostEqual(complex(2, 3), Decimal("0.9")) # type: ignore + +### +# Tests for assertNotAlmostEqual +### + +case.assertAlmostEqual(1, 2.4) +case.assertNotAlmostEqual(Fraction(49, 50), Fraction(48, 50)) +case.assertAlmostEqual(3.14, complex(5, 6)) +case.assertNotAlmostEqual(datetime(1999, 1, 2), datetime(1999, 1, 2, microsecond=1), delta=timedelta(hours=1)) +case.assertNotAlmostEqual(datetime(1999, 1, 2), datetime(1999, 1, 2, microsecond=1), None, "foo", timedelta(hours=1)) + +case.assertNotAlmostEqual(2.4, 2.41, places=9, delta=0.02) # type: ignore +case.assertNotAlmostEqual("foo", "bar") # type: ignore +case.assertNotAlmostEqual(datetime(1999, 1, 2), datetime(1999, 1, 2, microsecond=1)) # type: ignore +case.assertNotAlmostEqual(Decimal("0.4"), Fraction(1, 2)) # type: ignore +case.assertNotAlmostEqual(complex(2, 3), Decimal("0.9")) # type: ignore + +### +# Tests for assertGreater +### + + +class Spam: + def __lt__(self, other: object) -> bool: + return True + + +class Eggs: + def __gt__(self, other: object) -> bool: + return True + + +class Ham: + def __lt__(self, other: "Ham") -> bool: + if not isinstance(other, Ham): + return NotImplemented + return True + + +class Bacon: + def __gt__(self, other: "Bacon") -> bool: + if not isinstance(other, Bacon): + return NotImplemented + return True + + +case.assertGreater(5.8, 3) +case.assertGreater(Decimal("4.5"), Fraction(3, 2)) +case.assertGreater(Fraction(3, 2), 0.9) +case.assertGreater(Eggs(), object()) +case.assertGreater(object(), Spam()) +case.assertGreater(Ham(), Ham()) +case.assertGreater(Bacon(), Bacon()) + +case.assertGreater(object(), object()) # type: ignore +case.assertGreater(datetime(1999, 1, 2), 1) # type: ignore +case.assertGreater(Spam(), Eggs()) # type: ignore +case.assertGreater(Ham(), Bacon()) # type: ignore +case.assertGreater(Bacon(), Ham()) # type: ignore diff --git a/test_cases/stdlib/typing/check_all.py b/test_cases/stdlib/typing/check_all.py new file mode 100644 index 0000000..3519912 --- /dev/null +++ b/test_cases/stdlib/typing/check_all.py @@ -0,0 +1,15 @@ +# pyright: reportWildcardImportFromLibrary=false + +""" +This tests that star imports work when using "all += " syntax. +""" + +import sys +from typing import * # noqa: F403 +from zipfile import * # noqa: F403 + +if sys.version_info >= (3, 9): + x: Annotated[int, 42] # noqa: F405 + +if sys.version_info >= (3, 8): + p: Path # noqa: F405 diff --git a/test_cases/stdlib/typing/check_pattern.py b/test_cases/stdlib/typing/check_pattern.py new file mode 100644 index 0000000..69978c4 --- /dev/null +++ b/test_cases/stdlib/typing/check_pattern.py @@ -0,0 +1,8 @@ +from typing import Match, Optional, Pattern +from typing_extensions import assert_type + + +def test_search(str_pat: Pattern[str], bytes_pat: Pattern[bytes]) -> None: + assert_type(str_pat.search("x"), Optional[Match[str]]) + assert_type(bytes_pat.search(b"x"), Optional[Match[bytes]]) + assert_type(bytes_pat.search(bytearray(b"x")), Optional[Match[bytes]]) diff --git a/tests/README.md b/tests/README.md index 5d57949..994ef4d 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,42 +1,60 @@ This directory contains several tests: - `tests/mypy_test.py` -tests typeshed with [mypy](https://github.com/python/mypy/) -- `tests/pytype_test.py` tests typeshed with +tests the stubs with [mypy](https://github.com/python/mypy/) +- `tests/pytype_test.py` tests the stubs with [pytype](https://github.com/google/pytype/). -- `tests/pyright_test.py` tests typeshed with +- `tests/pyright_test.py` tests the stubs with [pyright](https://github.com/microsoft/pyright). +- `tests/regr_test.py` runs mypy against the test cases for typeshed's +stubs, guarding against accidental regressions. - `tests/check_consistent.py` checks certain files in typeshed remain consistent with each other. - `tests/stubtest_stdlib.py` checks standard library stubs against the objects at runtime. - `tests/stubtest_third_party.py` checks third-party stubs against the objects at runtime. +- `tests/typecheck_typeshed.py` runs mypy against typeshed's own code +in the `tests` and `scripts` directories. To run the tests, follow the [setup instructions](../CONTRIBUTING.md#preparing-the-environment) -in the `CONTRIBUTING.md` document. +in the `CONTRIBUTING.md` document. In particular, we recommend running with Python 3.9+. + +## Run all tests for a specific stub + +Run using: +``` +(.venv3)$ python3 scripts/runtests.py / +``` + +This script will run all tests below for a specific typeshed directory. If a +test supports multiple python versions, the oldest supported by typeshed will +be selected. A summary of the results will be printed to the terminal. + +You must provide a single argument which is a path to the stubs to test, like +so: `stdlib/os` or `stubs/requests`. ## mypy\_test.py -This test requires Python 3.6 or higher; Python 3.6.1 or higher is recommended. Run using: ``` (.venv3)$ python3 tests/mypy_test.py ``` +The test has two parts: running mypy on the stdlib stubs, +and running mypy on the third-party stubs. + This test is shallow — it verifies that all stubs can be imported but doesn't check whether stubs match their implementation -(in the Python standard library or a third-party package). It has an exclude list of -modules that are not tested at all, which also lives in the tests directory. +(in the Python standard library or a third-party package). -You can restrict mypy tests to a single version by passing `-p2` or `-p3.9`: -```bash -(.venv3)$ python3 tests/mypy_test.py -p3.9 -``` +Run `python tests/mypy_test.py --help` for information on the various configuration options +for this script. ## pytype\_test.py -This test requires Python 2.7 and Python 3.6. Pytype will -find these automatically if they're in `PATH`. +Note: this test cannot be run on Windows +systems unless you are using Windows Subsystem for Linux. + Run using: ``` (.venv3)$ python3 tests/pytype_test.py @@ -46,9 +64,9 @@ This test works similarly to `mypy_test.py`, except it uses `pytype`. ## pyright\_test.py -This test requires [Node.js](https://nodejs.org) to be installed. It is -currently not part of the CI, -but it uses the same pyright version and configuration as the CI. +This test requires [Node.js](https://nodejs.org) to be installed. Although +typeshed runs pyright in CI, it does not currently use this script. However, +this script uses the same pyright version and configuration as the CI. ``` (.venv3)$ python3 tests/pyright_test.py # Check all files (.venv3)$ python3 tests/pyright_test.py stdlib/sys.pyi # Check one file @@ -56,8 +74,16 @@ but it uses the same pyright version and configuration as the CI. ``` `pyrightconfig.stricter.json` is a stricter configuration that enables additional -checks that would typically fail on incomplete stubs (such as `Unknown` checks), -and is run on a subset of stubs (including the standard library). +checks that would typically fail on incomplete stubs (such as `Unknown` checks). +In typeshed's CI, pyright is run with these configuration settings on a subset of +the stubs in typeshed (including the standard library). + +## regr\_test.py + +This test runs mypy against the test cases for typeshed's stdlib and third-party +stubs. See the README in the `test_cases` directory for more information about what +these test cases are for and how they work. Run `python tests/regr_test.py --help` +for information on the various configuration options. ## check\_consistent.py @@ -68,7 +94,6 @@ python3 tests/check_consistent.py ## stubtest\_stdlib.py -This test requires Python 3.6 or higher. Run using ``` (.venv3)$ python3 tests/stubtest_stdlib.py @@ -77,30 +102,27 @@ Run using This test compares the stdlib stubs against the objects at runtime. Because of this, the output depends on which version of Python and on what kind of system it is run. -Thus the easiest way to run this test is via Github Actions on your fork; -if you run it locally, it'll likely complain about system-specific -differences (in e.g, `socket`) that the type system cannot capture. +As such, if you run this test locally, it may complain about system-specific +differences (in e.g, `socket`) that the type system cannot capture or our stubtest settings +in CI do not account for. If you run into this issue, consider opening a draft PR and letting CI +test it automatically (or +[running the test via Github Actions](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow) +on your typeshed fork). + If you need a specific version of Python to repro a CI failure, -[pyenv](https://github.com/pyenv/pyenv) can help. +[pyenv](https://github.com/pyenv/pyenv) can also help. Due to its dynamic nature, you may run into false positives. In this case, you can add to the allowlists for each affected Python version in `tests/stubtest_allowlists`. Please file issues for stubtest false positives at [mypy](https://github.com/python/mypy/issues). -To run stubtest against third party stubs, it's easiest to use stubtest -directly, with -``` -(.venv3)$ python3 -m mypy.stubtest \ - --custom-typeshed-dir \ - -``` -stubtest can also help you find things missing from the stubs. - - ## stubtest\_third\_party.py -This test requires Python 3.6 or higher. +:warning: This script downloads and executes arbitrary code from PyPI. Only run +this script locally if you know you can trust the packages you're running +stubtest on. + Run using ``` (.venv3)$ python3 tests/stubtest_third_party.py @@ -114,6 +136,47 @@ check on the command line: (.venv3)$ python3 tests/stubtest_third_party.py Pillow toml # check stubs/Pillow and stubs/toml ``` +If you have the runtime package installed in your local virtual environment, you can also run stubtest +directly, with +``` +(.venv3)$ MYPYPATH= python3 -m mypy.stubtest \ + --custom-typeshed-dir \ + +``` + For each distribution, stubtest ignores definitions listed in a `@tests/stubtest_allowlist.txt` file, relative to the distribution. Additional packages that are needed to run stubtest for a distribution can be added to `@tests/requirements-stubtest.txt`. + +### Using stubtest to find objects missing from the stubs + +By default, stubtest emits an error if a public object is present at runtime +but missing from the stub. However, this behaviour can be disabled using the +`--ignore-missing-stub` option. + +Many third-party stubs packages in typeshed are currently incomplete, and so by +default, `stubtest_third_party.py` runs stubtest with the +`--ignore-missing-stub` option to test our third-party stubs. However, this +option is not used if the distribution has `ignore_missing_stub = false` in the +`tool.stubtest` section of its `tests/METADATA.toml` file. This setting +indicates that the package is considered "complete", for example: +https://github.com/python/typeshed/blob/6950c3237065e6e2a9b64810765fec716252d52a/stubs/emoji/METADATA.toml#L3-L4 + +You can help make typeshed's stubs more complete by adding +`ignore_missing_stub = false` to the `tests/METADATA.toml` file for a +third-party stubs distribution, running stubtest, and then adding things that +stubtest reports to be missing to the stub. However, note that not *everything* +that stubtest reports to be missing should necessarily be added to the stub. +For some implementation details, it is often better to add allowlist entries +for missing objects rather than trying to match the runtime in every detail. + +## typecheck\_typeshed.py + +Run using +``` +(.venv3)$ python3 tests/typecheck_typeshed.py +``` + +This is a small wrapper script that uses mypy to typecheck typeshed's own code in the +`scripts` and `tests` directories. Run `python tests/typecheck_typeshed.py --help` for +information on the various configuration options. diff --git a/tests/check_consistent.py b/tests/check_consistent.py index a29c71f..a22d908 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -3,117 +3,103 @@ # 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. +from __future__ import annotations -# 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. - -import filecmp import os import re +import sys +from pathlib import Path import tomli - -consistent_files = [ - {"stdlib/@python2/builtins.pyi", "stdlib/@python2/__builtin__.pyi"}, - {"stdlib/threading.pyi", "stdlib/_dummy_threading.pyi"}, -] -metadata_keys = {"version", "python2", "requires", "extra_description", "obsolete_since"} -allowed_files = {"README.md"} - - -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: - if file in allowed_files: - continue - 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" +import yaml +from packaging.requirements import Requirement +from packaging.specifiers import SpecifierSet +from packaging.version import Version +from utils import VERSIONS_RE, get_all_testcase_directories, get_gitignore_spec, spec_matches_path, strip_comments + +metadata_keys = {"version", "requires", "extra_description", "obsolete_since", "no_longer_updated", "tool"} +tool_keys = {"stubtest": {"skip", "apt_dependencies", "extras", "ignore_missing_stub"}} +extension_descriptions = {".pyi": "stub", ".py": ".py"} + + +def assert_consistent_filetypes(directory: Path, *, kind: str, allowed: set[str]) -> None: + """Check that given directory contains only valid Python files of a certain kind.""" + allowed_paths = {Path(f) for f in allowed} + contents = list(directory.iterdir()) + gitignore_spec = get_gitignore_spec() + while contents: + entry = contents.pop() + if spec_matches_path(gitignore_spec, entry): + continue + if entry.relative_to(directory) in allowed_paths: + # Note if a subdirectory is allowed, we will not check its contents + continue + if entry.is_file(): + assert entry.stem.isidentifier(), f'Files must be valid modules, got: "{entry}"' + bad_filetype = f'Only {extension_descriptions[kind]!r} files allowed in the "{directory}" directory; got: {entry}' + assert entry.suffix == kind, bad_filetype else: - assert_stubs_only(os.path.join("stdlib/@python2", entry)) + assert entry.name.isidentifier(), f"Directories must be valid packages, got: {entry}" + contents.extend(entry.iterdir()) -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 in ("@python2", "@tests"): - 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] +def check_stdlib() -> None: + assert_consistent_filetypes(Path("stdlib"), kind=".pyi", allowed={"_typeshed/README.md", "VERSIONS"}) + + +def check_stubs() -> None: + gitignore_spec = get_gitignore_spec() + for dist in Path("stubs").iterdir(): + if spec_matches_path(gitignore_spec, dist): + continue + assert dist.is_dir(), f"Only directories allowed in stubs, got {dist}" + + valid_dist_name = "^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$" # courtesy of PEP 426 + assert re.fullmatch( + valid_dist_name, dist.name, re.IGNORECASE + ), f"Directory name must be a valid distribution name: {dist}" + assert not dist.name.startswith("types-"), f"Directory name not allowed to start with 'types-': {dist}" + + allowed = {"METADATA.toml", "README", "README.md", "README.rst", "@tests"} + assert_consistent_filetypes(dist, kind=".pyi", allowed=allowed) + + +def check_test_cases() -> None: + for package_name, testcase_dir in get_all_testcase_directories(): + assert_consistent_filetypes(testcase_dir, kind=".py", allowed={"README.md"}) + bad_test_case_filename = 'Files in a `test_cases` directory must have names starting with "check_"; got "{}"' + for file in testcase_dir.rglob("*.py"): + assert file.stem.startswith("check_"), bad_test_case_filename.format(file) + if package_name != "stdlib": + with open(file, encoding="UTF-8") as f: + lines = {line.strip() for line in f} + pyright_setting_not_enabled_msg = ( + f'Third-party test-case file "{file}" must have ' + f'"# pyright: reportUnnecessaryTypeIgnoreComment=true" ' + f"at the top of the file" + ) + has_pyright_setting_enabled = "# pyright: reportUnnecessaryTypeIgnoreComment=true" in lines + assert has_pyright_setting_enabled, pyright_setting_not_enabled_msg + + +def check_no_symlinks() -> None: + files = [os.path.join(root, file) for root, _, 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: _, ext = os.path.splitext(file) if ext == ".pyi" and os.path.islink(file): raise ValueError(no_symlink.format(file)) - for file1, *others in consistent_files: - f1 = os.path.join(os.getcwd(), file1) - for file2 in others: - f2 = os.path.join(os.getcwd(), file2) - if not filecmp.cmp(f1, f2): - raise ValueError( - "File {f1} does not match file {f2}. Please copy it to {f2}\n" - "Run either:\ncp {f1} {f2}\nOr:\ncp {f2} {f1}".format(f1=file1, f2=file2) - ) - -_VERSIONS_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_.]*): [23]\.\d{1,2}-(?:[23]\.\d{1,2})?$") - -def check_versions(): +def check_versions() -> None: versions = set() - with open("stdlib/VERSIONS") as f: + with open("stdlib/VERSIONS", encoding="UTF-8") as f: data = f.read().splitlines() for line in data: - line = line.split("#")[0].strip() + line = strip_comments(line) if line == "": continue - m = _VERSIONS_RE.match(line) + m = VERSIONS_RE.match(line) if not m: raise AssertionError(f"Bad line in VERSIONS: {line}") module = m.group(1) @@ -130,8 +116,6 @@ def check_versions(): def _find_stdlib_modules() -> set[str]: modules = set() for path, _, files in os.walk("stdlib"): - if "@python2" in path: - continue for filename in files: base_module = ".".join(os.path.normpath(path).split(os.sep)[1:]) if filename == "__init__.pyi": @@ -142,55 +126,74 @@ def _find_stdlib_modules() -> set[str]: return modules -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(): +def check_metadata() -> None: for distribution in os.listdir("stubs"): - with open(os.path.join("stubs", distribution, "METADATA.toml")) as f: + with open(os.path.join("stubs", distribution, "METADATA.toml"), encoding="UTF-8") as f: data = tomli.loads(f.read()) assert "version" in data, f"Missing version for {distribution}" version = data["version"] - msg = f"Unsupported Python version {version}" - assert re.match(r"^\d+\.\d+(\.\d+)?$", version), msg + msg = f"Unsupported version {repr(version)}" + assert isinstance(version, str), msg + # Check that the version parses + Version(version.removesuffix(".*")) for key in data: assert key in metadata_keys, f"Unexpected key {key} for {distribution}" - assert isinstance(data.get("python2", False), bool), f"Invalid python2 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 isinstance(dep, str), f"Invalid requirement {repr(dep)} for {distribution}" 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) - 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 + assert space not in dep, f"For consistency, requirement should not have whitespace: {dep}" + # Check that the requirement parses + Requirement(dep) + + assert set(data.get("tool", [])).issubset(tool_keys.keys()), f"Unrecognised tool for {distribution}" + for tool, tk in tool_keys.items(): + for key in data.get("tool", {}).get(tool, {}): + assert key in tk, f"Unrecognised {tool} key {key} for {distribution}" + + +def get_txt_requirements() -> dict[str, SpecifierSet]: + with open("requirements-tests.txt", encoding="UTF-8") as requirements_file: + stripped_lines = map(strip_comments, requirements_file) + requirements = map(Requirement, filter(None, stripped_lines)) + return {requirement.name: requirement.specifier for requirement in requirements} + + +def get_precommit_requirements() -> dict[str, SpecifierSet]: + with open(".pre-commit-config.yaml", encoding="UTF-8") as precommit_file: + precommit = precommit_file.read() + yam = yaml.load(precommit, Loader=yaml.Loader) + precommit_requirements = {} + for repo in yam["repos"]: + hook = repo["hooks"][0] + package_name, package_rev = hook["id"], repo["rev"] + package_specifier = SpecifierSet(f"=={package_rev.removeprefix('v')}") + precommit_requirements[package_name] = package_specifier + for additional_req in hook.get("additional_dependencies", []): + req = Requirement(additional_req) + precommit_requirements[req.name] = req.specifier + return precommit_requirements + + +def check_requirements() -> None: + requirements_txt_requirements = get_txt_requirements() + precommit_requirements = get_precommit_requirements() + no_txt_entry_msg = "All pre-commit requirements must also be listed in `requirements-tests.txt` (missing {requirement!r})" + for requirement, specifier in precommit_requirements.items(): + assert requirement in requirements_txt_requirements, no_txt_entry_msg.format(requirement) + specifier_mismatch = ( + f'Specifier "{specifier}" for {requirement!r} in `.pre-commit-config.yaml` ' + f'does not match specifier "{requirements_txt_requirements[requirement]}" in `requirements-tests.txt`' + ) + assert specifier == requirements_txt_requirements[requirement], specifier_mismatch if __name__ == "__main__": + assert sys.version_info >= (3, 9), "Python 3.9+ is required to run this test" check_stdlib() check_versions() check_stubs() check_metadata() - check_same_files() + check_no_symlinks() + check_test_cases() + check_requirements() diff --git a/tests/check_new_syntax.py b/tests/check_new_syntax.py new file mode 100755 index 0000000..4c47557 --- /dev/null +++ b/tests/check_new_syntax.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 + +from __future__ import annotations + +import ast +import sys +from itertools import chain +from pathlib import Path + + +def check_new_syntax(tree: ast.AST, path: Path, stub: str) -> list[str]: + errors = [] + sourcelines = stub.splitlines() + + class AnnotationUnionFinder(ast.NodeVisitor): + def visit_Subscript(self, node: ast.Subscript) -> None: + if isinstance(node.value, ast.Name): + if node.value.id == "Union" and isinstance(node.slice, ast.Tuple): + new_syntax = " | ".join(ast.unparse(x) for x in node.slice.elts) + errors.append(f"{path}:{node.lineno}: Use PEP 604 syntax for Union, e.g. `{new_syntax}`") + if node.value.id == "Optional": + new_syntax = f"{ast.unparse(node.slice)} | None" + errors.append(f"{path}:{node.lineno}: Use PEP 604 syntax for Optional, e.g. `{new_syntax}`") + + self.generic_visit(node) + + class NonAnnotationUnionFinder(ast.NodeVisitor): + def visit_Subscript(self, node: ast.Subscript) -> None: + if isinstance(node.value, ast.Name): + nodelines = sourcelines[(node.lineno - 1) : node.end_lineno] + for line in nodelines: + # A hack to workaround various PEP 604 bugs in mypy + if any(x in line for x in {"tuple[", "Callable[", "type["}): + return None + if node.value.id == "Union" and isinstance(node.slice, ast.Tuple): + new_syntax = " | ".join(ast.unparse(x) for x in node.slice.elts) + errors.append(f"{path}:{node.lineno}: Use PEP 604 syntax for Union, e.g. `{new_syntax}`") + elif node.value.id == "Optional": + new_syntax = f"{ast.unparse(node.slice)} | None" + errors.append(f"{path}:{node.lineno}: Use PEP 604 syntax for Optional, e.g. `{new_syntax}`") + + self.generic_visit(node) + + class OldSyntaxFinder(ast.NodeVisitor): + def visit_AnnAssign(self, node: ast.AnnAssign) -> None: + AnnotationUnionFinder().visit(node.annotation) + if node.value is not None: + NonAnnotationUnionFinder().visit(node.value) + self.generic_visit(node) + + def visit_arg(self, node: ast.arg) -> None: + if node.annotation is not None: + AnnotationUnionFinder().visit(node.annotation) + self.generic_visit(node) + + def _visit_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: + if node.returns is not None: + AnnotationUnionFinder().visit(node.returns) + self.generic_visit(node) + + def visit_FunctionDef(self, node: ast.FunctionDef) -> None: + self._visit_function(node) + + def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None: + self._visit_function(node) + + def visit_Assign(self, node: ast.Assign) -> None: + NonAnnotationUnionFinder().visit(node.value) + self.generic_visit(node) + + def visit_ClassDef(self, node: ast.ClassDef) -> None: + for base in node.bases: + NonAnnotationUnionFinder().visit(base) + self.generic_visit(node) + + class IfFinder(ast.NodeVisitor): + def visit_If(self, node: ast.If) -> None: + if ( + isinstance(node.test, ast.Compare) + and ast.unparse(node.test).startswith("sys.version_info < ") + and node.orelse + and not (len(node.orelse) == 1 and isinstance(node.orelse[0], ast.If)) # elif statement (#6728) + ): + new_syntax = "if " + ast.unparse(node.test).replace("<", ">=", 1) + errors.append( + f"{path}:{node.lineno}: When using if/else with sys.version_info, " + f"put the code for new Python versions first, e.g. `{new_syntax}`" + ) + self.generic_visit(node) + + OldSyntaxFinder().visit(tree) + IfFinder().visit(tree) + return errors + + +def main() -> None: + errors = [] + for path in chain(Path("stdlib").rglob("*.pyi"), Path("stubs").rglob("*.pyi")): + with open(path, encoding="UTF-8") as f: + stub = f.read() + tree = ast.parse(stub) + errors.extend(check_new_syntax(tree, path, stub)) + + if errors: + print("\n".join(errors)) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/tests/check_pep_604.py b/tests/check_pep_604.py deleted file mode 100755 index 3cf19f5..0000000 --- a/tests/check_pep_604.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 - -import ast -import sys -from itertools import chain -from pathlib import Path - - -def check_pep_604(tree: ast.AST, path: Path) -> list[str]: - errors = [] - - class UnionFinder(ast.NodeVisitor): - def visit_Subscript(self, node: ast.Subscript) -> None: - if ( - isinstance(node.value, ast.Name) - and node.value.id == "Union" - and isinstance(node.slice, ast.Tuple) - ): - new_syntax = " | ".join(ast.unparse(x) for x in node.slice.elts) - errors.append( - (f"{path}:{node.lineno}: Use PEP 604 syntax for Union, e.g. `{new_syntax}`") - ) - if ( - isinstance(node.value, ast.Name) - and node.value.id == "Optional" - ): - new_syntax = f"{ast.unparse(node.slice)} | None" - errors.append( - (f"{path}:{node.lineno}: Use PEP 604 syntax for Optional, e.g. `{new_syntax}`") - ) - - # This doesn't check type aliases (or type var bounds, etc), since those are not - # currently supported - class AnnotationFinder(ast.NodeVisitor): - def visit_AnnAssign(self, node: ast.AnnAssign) -> None: - UnionFinder().visit(node.annotation) - - def visit_arg(self, node: ast.arg) -> None: - if node.annotation is not None: - UnionFinder().visit(node.annotation) - - def visit_FunctionDef(self, node: ast.FunctionDef) -> None: - if node.returns is not None: - UnionFinder().visit(node.returns) - self.generic_visit(node) - - def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None: - if node.returns is not None: - UnionFinder().visit(node.returns) - self.generic_visit(node) - - AnnotationFinder().visit(tree) - return errors - - -def main() -> None: - errors = [] - for path in chain(Path("stdlib").rglob("*.pyi"), Path("stubs").rglob("*.pyi")): - if "@python2" in path.parts: - continue - if Path("stubs/protobuf/google/protobuf") in path.parents: # TODO: fix protobuf stubs - continue - - with open(path) as f: - tree = ast.parse(f.read()) - errors.extend(check_pep_604(tree, path)) - - if errors: - print("\n".join(errors)) - sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/tests/get_apt_packages.py b/tests/get_apt_packages.py new file mode 100755 index 0000000..9a902ee --- /dev/null +++ b/tests/get_apt_packages.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +import os +import sys + +import tomli + +distributions = sys.argv[1:] +if not distributions: + distributions = os.listdir("stubs") + +for distribution in distributions: + with open(f"stubs/{distribution}/METADATA.toml", "rb") as file: + for apt_package in tomli.load(file).get("tool", {}).get("stubtest", {}).get("apt_dependencies", []): + print(apt_package) diff --git a/tests/mypy_test.py b/tests/mypy_test.py old mode 100755 new mode 100644 index 0b812b6..b0da93e --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -1,88 +1,142 @@ #!/usr/bin/env python3 -"""Test runner for typeshed. +"""Run mypy on typeshed's stdlib and third-party stubs.""" -Depends on mypy being installed. - -Approach: - -1. Parse sys.argv -2. Compute appropriate arguments for mypy -3. Stuff those arguments into sys.argv -4. Run mypy.main('') -5. Repeat steps 2-4 for other mypy runs (e.g. --py2) -""" +from __future__ import annotations import argparse import os import re import sys import tempfile -from glob import glob +from contextlib import redirect_stderr, redirect_stdout +from dataclasses import dataclass +from io import StringIO +from itertools import product from pathlib import Path -from typing import Dict, NamedTuple +from typing import TYPE_CHECKING, Any, NamedTuple + +if TYPE_CHECKING: + from _typeshed import StrPath + +from typing_extensions import Annotated, TypeAlias import tomli +from utils import ( + VERSIONS_RE as VERSION_LINE_RE, + colored, + get_gitignore_spec, + get_recursive_requirements, + print_error, + print_success_msg, + spec_matches_path, + strip_comments, +) + +SUPPORTED_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"] +SUPPORTED_PLATFORMS = ("linux", "win32", "darwin") +DIRECTORIES_TO_TEST = [Path("stdlib"), Path("stubs")] + +ReturnCode: TypeAlias = int +VersionString: TypeAlias = Annotated[str, "Must be one of the entries in SUPPORTED_VERSIONS"] +VersionTuple: TypeAlias = tuple[int, int] +Platform: TypeAlias = Annotated[str, "Must be one of the entries in SUPPORTED_PLATFORMS"] + + +class CommandLineArgs(argparse.Namespace): + verbose: int + filter: list[Path] + exclude: list[Path] | None + python_version: list[VersionString] | None + platform: list[Platform] | None + + +def valid_path(cmd_arg: str) -> Path: + """Helper function for argument-parsing""" + path = Path(cmd_arg) + if not path.exists(): + raise argparse.ArgumentTypeError(f'"{path}" does not exist in typeshed!') + if not (path in DIRECTORIES_TO_TEST or any(directory in path.parents for directory in DIRECTORIES_TO_TEST)): + raise argparse.ArgumentTypeError('mypy_test.py only tests the stubs found in the "stdlib" and "stubs" directories') + return path + -parser = argparse.ArgumentParser(description="Test runner for typeshed. Patterns are unanchored regexps on the full path.") +parser = argparse.ArgumentParser( + description="Typecheck typeshed's stubs with mypy. Patterns are unanchored regexps on the full path." +) +parser.add_argument( + "filter", + type=valid_path, + nargs="*", + help='Test these files and directories (defaults to all files in the "stdlib" and "stubs" directories)', +) +parser.add_argument("-x", "--exclude", type=valid_path, nargs="*", help="Exclude these files and directories") 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") -parser.add_argument("-p", "--python-version", type=str, nargs="*", help="These versions only (major[.minor])") -parser.add_argument("--platform", help="Run mypy for a certain OS platform (defaults to sys.platform)") parser.add_argument( - "--warn-unused-ignores", - action="store_true", - help="Run mypy with --warn-unused-ignores " - "(hint: only get rid of warnings that are " - "unused for all platforms and Python versions)", + "-p", + "--python-version", + type=str, + choices=SUPPORTED_VERSIONS, + nargs="*", + action="extend", + help="These versions only (major[.minor])", ) +parser.add_argument( + "--platform", + choices=SUPPORTED_PLATFORMS, + nargs="*", + action="extend", + help="Run mypy for certain OS platforms (defaults to sys.platform only)", +) + -parser.add_argument("filter", type=str, nargs="*", help="Include pattern (default all)") +@dataclass +class TestConfig: + """Configuration settings for a single run of the `test_typeshed` function.""" + verbose: int + filter: list[Path] + exclude: list[Path] + version: VersionString + platform: Platform -def log(args, *varargs): + +def log(args: TestConfig, *varargs: object) -> None: if args.verbose >= 2: print(*varargs) -def match(fn, args, exclude_list): - if exclude_list.match(fn): - log(args, fn, "exluded by exclude list") - return False - if not args.filter and not args.exclude: - log(args, fn, "accept by default") - return True - if args.exclude: - for f in args.exclude: - if re.search(f, fn): - log(args, fn, "excluded by pattern", f) - return False - if args.filter: - for f in args.filter: - if re.search(f, fn): - log(args, fn, "accepted by pattern", f) - return True - if args.filter: - log(args, fn, "rejected (no pattern matches)") - return False - log(args, fn, "accepted (no exclude pattern matches)") - return True - - -_VERSION_LINE_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_.]*): ([23]\.\d{1,2})-([23]\.\d{1,2})?$") - - -def parse_versions(fname): +def match(path: Path, args: TestConfig) -> bool: + for excluded_path in args.exclude: + if path == excluded_path: + log(args, path, "explicitly excluded") + return False + if excluded_path in path.parents: + log(args, path, f'is in an explicitly excluded directory "{excluded_path}"') + return False + for included_path in args.filter: + if path == included_path: + log(args, path, "was explicitly included") + return True + if included_path in path.parents: + log(args, path, f'is in an explicitly included directory "{included_path}"') + return True + log_msg = ( + f'is implicitly excluded: was not in any of the directories or paths specified on the command line: "{args.filter!r}"' + ) + log(args, path, log_msg) + return False + + +def parse_versions(fname: StrPath) -> dict[str, tuple[VersionTuple, VersionTuple]]: result = {} - with open(fname) as f: + with open(fname, encoding="UTF-8") as f: for line in f: - # Allow having some comments or empty lines. - line = line.split("#")[0].strip() + line = strip_comments(line) if line == "": continue - m = _VERSION_LINE_RE.match(line) - assert m, "invalid VERSIONS line: " + line - mod = m.group(1) + m = VERSION_LINE_RE.match(line) + assert m, f"invalid VERSIONS line: {line}" + mod: str = m.group(1) min_version = parse_version(m.group(2)) max_version = parse_version(m.group(3)) if m.group(3) else (99, 99) result[mod] = min_version, max_version @@ -92,52 +146,24 @@ def parse_versions(fname): _VERSION_RE = re.compile(r"^([23])\.(\d+)$") -def parse_version(v_str): +def parse_version(v_str: str) -> tuple[int, int]: m = _VERSION_RE.match(v_str) - assert m, "invalid version: " + v_str + assert m, f"invalid version: {v_str}" return int(m.group(1)), int(m.group(2)) -def is_supported(distribution, major): - dist_path = Path("stubs", distribution) - with open(dist_path / "METADATA.toml") as f: - data = dict(tomli.loads(f.read())) - if major == 2: - # Python 2 is not supported by default. - return bool(data.get("python2", False)) or (dist_path / "@python2").exists() - # Python 3 is supported by default. - return has_py3_stubs(dist_path) - - -# Keep this in sync with stubtest_third_party.py -def has_py3_stubs(dist: Path) -> bool: - return len(glob(f"{dist}/*.pyi")) > 0 or len(glob(f"{dist}/[!@]*/__init__.pyi")) > 0 - - -def add_files(files, seen, root, name, args, exclude_list): +def add_files(files: list[Path], module: Path, args: TestConfig) -> None: """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) + if module.is_file() and module.suffix == ".pyi": + if match(module, args): + files.append(module) + else: + files.extend(sorted(file for file in module.rglob("*.pyi") if match(file, args))) class MypyDistConf(NamedTuple): module_name: str - values: Dict + values: dict[str, dict[str, Any]] # The configuration section in the metadata file looks like the following, with multiple module sections possible @@ -149,12 +175,9 @@ class MypyDistConf(NamedTuple): # disallow_untyped_defs = true -def add_configuration(configurations, seen_dist_configs, distribution): - if distribution in seen_dist_configs: - return - - with open(os.path.join("stubs", distribution, "METADATA.toml")) as f: - data = dict(tomli.loads(f.read())) +def add_configuration(configurations: list[MypyDistConf], distribution: str) -> None: + with Path("stubs", distribution, "METADATA.toml").open("rb") as f: + data = tomli.load(f) mypy_tests_conf = data.get("mypy-tests") if not mypy_tests_conf: @@ -162,144 +185,226 @@ def add_configuration(configurations, seen_dist_configs, distribution): assert isinstance(mypy_tests_conf, dict), "mypy-tests should be a section" for section_name, mypy_section in mypy_tests_conf.items(): - assert isinstance(mypy_section, dict), "{} should be a section".format(section_name) + assert isinstance(mypy_section, dict), f"{section_name} should be a section" module_name = mypy_section.get("module_name") - assert module_name is not None, "{} should have a module_name key".format(section_name) - assert isinstance(module_name, str), "{} should be a key-value pair".format(section_name) + assert module_name is not None, f"{section_name} should have a module_name key" + assert isinstance(module_name, str), f"{section_name} should be a key-value pair" values = mypy_section.get("values") - assert values is not None, "{} should have a values section".format(section_name) + assert values is not None, f"{section_name} should have a values section" assert isinstance(values, dict), "values should be a section" configurations.append(MypyDistConf(module_name, values.copy())) - seen_dist_configs.add(distribution) -def run_mypy(args, configurations, major, minor, files, *, custom_typeshed=False): +def run_mypy(args: TestConfig, configurations: list[MypyDistConf], files: list[Path]) -> ReturnCode: try: - from mypy.main import main as mypy_main + from mypy.api import run as mypy_run except ImportError: - print("Cannot import mypy. Did you install it?") + print_error("Cannot import mypy. Did you install it?") sys.exit(1) with tempfile.NamedTemporaryFile("w+") as temp: temp.write("[mypy]\n") for dist_conf in configurations: - temp.write("[mypy-%s]\n" % dist_conf.module_name) + temp.write(f"[mypy-{dist_conf.module_name}]\n") for k, v in dist_conf.values.items(): - temp.write("{} = {}\n".format(k, v)) + temp.write(f"{k} = {v}\n") temp.flush() - flags = [ - "--python-version", - "%d.%d" % (major, minor), - "--config-file", - temp.name, - "--strict-optional", - "--no-site-packages", - "--show-traceback", - "--no-implicit-optional", - "--disallow-any-generics", - "--disallow-subclassing-any", - "--warn-incomplete-stub", - ] - if custom_typeshed: - # Setting custom typeshed dir prevents mypy from falling back to its bundled - # typeshed in case of stub deletions - flags.extend(["--custom-typeshed-dir", os.path.dirname(os.path.dirname(__file__))]) - if args.warn_unused_ignores: - flags.append("--warn-unused-ignores") - if args.platform: - flags.extend(["--platform", args.platform]) - sys.argv = ["mypy"] + flags + files + flags = get_mypy_flags(args, temp.name) + mypy_args = [*flags, *map(str, files)] if args.verbose: - print("running", " ".join(sys.argv)) + print("running mypy", " ".join(mypy_args)) + stdout_redirect, stderr_redirect = StringIO(), StringIO() + with redirect_stdout(stdout_redirect), redirect_stderr(stderr_redirect): + returned_stdout, returned_stderr, exit_code = mypy_run(mypy_args) + + if exit_code: + print_error("failure\n") + captured_stdout = stdout_redirect.getvalue() + captured_stderr = stderr_redirect.getvalue() + if returned_stderr: + print_error(returned_stderr) + if captured_stderr: + print_error(captured_stderr) + if returned_stdout: + print_error(returned_stdout) + if captured_stdout: + print_error(captured_stdout, end="") else: - print("running mypy", " ".join(flags), "# with", len(files), "files") - if not args.dry_run: - try: - mypy_main("", sys.stdout, sys.stderr) - except SystemExit as err: - return err.code - return 0 + print_success_msg() + return exit_code + + +def get_mypy_flags(args: TestConfig, temp_name: str) -> list[str]: + return [ + "--python-version", + args.version, + "--show-traceback", + "--warn-incomplete-stub", + "--show-error-codes", + "--no-error-summary", + "--platform", + args.platform, + "--no-site-packages", + "--custom-typeshed-dir", + str(Path(__file__).parent.parent), + "--no-implicit-optional", + "--disallow-untyped-decorators", + "--disallow-any-generics", + "--strict-equality", + "--enable-error-code", + "ignore-without-code", + "--config-file", + temp_name, + ] + + +def add_third_party_files( + distribution: str, files: list[Path], args: TestConfig, configurations: list[MypyDistConf], seen_dists: set[str] +) -> None: + if distribution in seen_dists: + return + seen_dists.add(distribution) + stubs_dir = Path("stubs") + dependencies = get_recursive_requirements(distribution) -def main(): - args = parser.parse_args() + for dependency in dependencies: + if dependency in seen_dists: + continue + seen_dists.add(dependency) + files_to_add = sorted((stubs_dir / dependency).rglob("*.pyi")) + files.extend(files_to_add) + for file in files_to_add: + log(args, file, f"included as a dependency of {distribution!r}") - with open(os.path.join(os.path.dirname(__file__), "mypy_exclude_list.txt")) as f: - exclude_list = re.compile("(%s)$" % "|".join(re.findall(r"^\s*([^\s#]+)\s*(?:#.*)?$", f.read(), flags=re.M))) + root = stubs_dir / distribution + for name in os.listdir(root): + if name.startswith("."): + continue + add_files(files, (root / name), args) + add_configuration(configurations, distribution) - versions = [(3, 10), (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: - print("--- no versions selected ---") - sys.exit(1) - code = 0 - runs = 0 - for major, minor in versions: - seen = {"__builtin__", "builtins", "typing"} # Always ignore these. - configurations = [] - seen_dist_configs = set() - - # Test standard library files. - files = [] - if major == 2: - root = os.path.join("stdlib", "@python2") - for name in os.listdir(root): - mod, _ = os.path.splitext(name) - if mod in seen or mod.startswith("."): - continue - 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 == "@python2" or name == "VERSIONS": - continue - mod, _ = os.path.splitext(name) - if supported_versions[mod][0] <= (major, minor) <= supported_versions[mod][1]: - add_files(files, seen, root, name, args, exclude_list) - - if files: - this_code = run_mypy(args, configurations, major, minor, files, custom_typeshed=True) - code = max(code, this_code) - runs += 1 +class TestResults(NamedTuple): + exit_code: int + files_checked: int - # Test files of all third party distributions. - files = [] - for distribution in os.listdir("stubs"): - if not is_supported(distribution, major): - continue - if major == 2 and os.path.isdir(os.path.join("stubs", distribution, "@python2")): - root = os.path.join("stubs", distribution, "@python2") - else: - root = os.path.join("stubs", distribution) - for name in os.listdir(root): - if name == "@python2": - continue - mod, _ = os.path.splitext(name) - if mod in seen or mod.startswith("."): - continue - add_files(files, seen, root, name, args, exclude_list) - add_configuration(configurations, seen_dist_configs, distribution) - - if files: - # TODO: remove custom_typeshed after mypy 0.920 is released - this_code = run_mypy(args, configurations, major, minor, files, custom_typeshed=True) + +def test_third_party_distribution(distribution: str, args: TestConfig) -> TestResults: + """Test the stubs of a third-party distribution. + + Return a tuple, where the first element indicates mypy's return code + and the second element is the number of checked files. + """ + + files: list[Path] = [] + configurations: list[MypyDistConf] = [] + seen_dists: set[str] = set() + add_third_party_files(distribution, files, args, configurations, seen_dists) + + if not files and args.filter: + return TestResults(0, 0) + + print(f"testing {distribution} ({len(files)} files)... ", end="") + + if not files: + print_error("no files found") + sys.exit(1) + + code = run_mypy(args, configurations, files) + return TestResults(code, len(files)) + + +def test_stdlib(code: int, args: TestConfig) -> TestResults: + files: list[Path] = [] + stdlib = Path("stdlib") + supported_versions = parse_versions(stdlib / "VERSIONS") + for name in os.listdir(stdlib): + if name == "VERSIONS" or name.startswith("."): + continue + module = Path(name).stem + module_min_version, module_max_version = supported_versions[module] + if module_min_version <= tuple(map(int, args.version.split("."))) <= module_max_version: + add_files(files, (stdlib / name), args) + + if files: + print(f"Testing stdlib ({len(files)} files)...") + print("Running mypy " + " ".join(get_mypy_flags(args, "/tmp/..."))) + this_code = run_mypy(args, [], files) + code = max(code, this_code) + + return TestResults(code, len(files)) + + +def test_third_party_stubs(code: int, args: TestConfig) -> TestResults: + print("Testing third-party packages...") + print("Running mypy " + " ".join(get_mypy_flags(args, "/tmp/..."))) + files_checked = 0 + gitignore_spec = get_gitignore_spec() + + for distribution in sorted(os.listdir("stubs")): + distribution_path = Path("stubs", distribution) + + if spec_matches_path(gitignore_spec, distribution_path): + continue + + if ( + distribution_path in args.filter + or Path("stubs") in args.filter + or any(distribution_path in path.parents for path in args.filter) + ): + this_code, checked = test_third_party_distribution(distribution, args) code = max(code, this_code) - runs += 1 + files_checked += checked + + return TestResults(code, files_checked) + + +def test_typeshed(code: int, args: TestConfig) -> TestResults: + print(f"*** Testing Python {args.version} on {args.platform}") + files_checked_this_version = 0 + stdlib_dir, stubs_dir = Path("stdlib"), Path("stubs") + if stdlib_dir in args.filter or any(stdlib_dir in path.parents for path in args.filter): + code, stdlib_files_checked = test_stdlib(code, args) + files_checked_this_version += stdlib_files_checked + print() + + if stubs_dir in args.filter or any(stubs_dir in path.parents for path in args.filter): + code, third_party_files_checked = test_third_party_stubs(code, args) + files_checked_this_version += third_party_files_checked + print() + return TestResults(code, files_checked_this_version) + + +def main() -> None: + args = parser.parse_args(namespace=CommandLineArgs()) + versions = args.python_version or SUPPORTED_VERSIONS + platforms = args.platform or [sys.platform] + filter = args.filter or DIRECTORIES_TO_TEST + exclude = args.exclude or [] + code = 0 + total_files_checked = 0 + for version, platform in product(versions, platforms): + config = TestConfig(args.verbose, filter, exclude, version, platform) + code, files_checked_this_version = test_typeshed(code, args=config) + total_files_checked += files_checked_this_version if code: - print("--- exit status", code, "---") + print_error(f"--- exit status {code}, {total_files_checked} files checked ---") sys.exit(code) - if not runs: - print("--- nothing to do; exit 1 ---") + if not total_files_checked: + print_error("--- nothing to do; exit 1 ---") sys.exit(1) + print(colored(f"--- success, {total_files_checked} files checked ---", "green")) if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + print_error("\n\n!!!\nTest aborted due to KeyboardInterrupt\n!!!") + sys.exit(1) diff --git a/tests/pyright_test.py b/tests/pyright_test.py index d2adf45..c4ffe7a 100755 --- a/tests/pyright_test.py +++ b/tests/pyright_test.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +import os import shutil import subprocess import sys from pathlib import Path -_PYRIGHT_VERSION = "1.1.175" # Must match tests.yml. +_PYRIGHT_VERSION = "1.1.278" # Must match .github/workflows/tests.yml. _WELL_KNOWN_FILE = Path("tests", "pyright_test.py") @@ -27,7 +28,9 @@ def main() -> None: print("error running npx; is Node.js installed?", file=sys.stderr) sys.exit(1) - command = [npx, "-p", "pyright@" + _PYRIGHT_VERSION, "pyright"] + sys.argv[1:] + os.environ["PYRIGHT_PYTHON_FORCE_VERSION"] = _PYRIGHT_VERSION + command = [npx, f"pyright@{_PYRIGHT_VERSION}"] + sys.argv[1:] + print("Running:", " ".join(command)) ret = subprocess.run(command).returncode sys.exit(ret) diff --git a/tests/pytype_exclude_list.txt b/tests/pytype_exclude_list.txt index 28b0f6b..fd47c9e 100644 --- a/tests/pytype_exclude_list.txt +++ b/tests/pytype_exclude_list.txt @@ -2,9 +2,6 @@ # pytype has its own version of these files, and thus doesn't mind if it # can't parse the typeshed version: -stdlib/@python2/__builtin__.pyi -stdlib/@python2/builtins.pyi -stdlib/@python2/typing.pyi stdlib/builtins.pyi stdlib/typing.pyi @@ -13,10 +10,6 @@ stubs/mysqlclient/MySQLdb/__init__.pyi stubs/mysqlclient/MySQLdb/connections.pyi stubs/mysqlclient/MySQLdb/cursors.pyi -# third_party stubs with constructs that pytype doesn't yet support: -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 @@ -30,6 +23,8 @@ 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/decoder.pyi +stubs/protobuf/google/protobuf/internal/encoder.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 @@ -44,78 +39,72 @@ stubs/protobuf/google/protobuf/timestamp_pb2.pyi stubs/protobuf/google/protobuf/type_pb2.pyi stubs/protobuf/google/protobuf/wrappers_pb2.pyi -stubs/braintree/braintree/__init__.pyi -stubs/braintree/braintree/braintree_gateway.pyi -stubs/braintree/braintree/credit_card_gateway.pyi -stubs/braintree/braintree/credit_card_verification_gateway.pyi -stubs/braintree/braintree/credit_card_verification_search.pyi -stubs/braintree/braintree/customer.pyi -stubs/braintree/braintree/customer_gateway.pyi -stubs/braintree/braintree/customer_search.pyi -stubs/braintree/braintree/disbursement.pyi -stubs/braintree/braintree/dispute_search.pyi -stubs/braintree/braintree/ids_search.pyi -stubs/braintree/braintree/local_payment_completed.pyi -stubs/braintree/braintree/payment_method_gateway.pyi -stubs/braintree/braintree/search.pyi -stubs/braintree/braintree/subscription.pyi -stubs/braintree/braintree/subscription_gateway.pyi -stubs/braintree/braintree/subscription_search.pyi -stubs/braintree/braintree/testing_gateway.pyi -stubs/braintree/braintree/transaction.pyi -stubs/braintree/braintree/transaction_gateway.pyi -stubs/braintree/braintree/transaction_search.pyi -stubs/braintree/braintree/us_bank_account_verification_gateway.pyi -stubs/braintree/braintree/us_bank_account_verification_search.pyi -stubs/braintree/braintree/webhook_notification.pyi -stubs/braintree/braintree/webhook_notification_gateway.pyi -stubs/braintree/braintree/webhook_testing_gateway.pyi -stubs/braintree/braintree/account_updater_daily_report.pyi -stubs/braintree/braintree/configuration.pyi -stubs/braintree/braintree/discount.pyi -stubs/braintree/braintree/discount_gateway.pyi -stubs/braintree/braintree/dispute.pyi -stubs/braintree/braintree/dispute_gateway.pyi -stubs/braintree/braintree/document_upload.pyi -stubs/braintree/braintree/document_upload_gateway.pyi -stubs/braintree/braintree/europe_bank_account.pyi -stubs/braintree/braintree/merchant.pyi -stubs/braintree/braintree/merchant_account/__init__.pyi -stubs/braintree/braintree/merchant_account/merchant_account.pyi -stubs/braintree/braintree/merchant_account_gateway.pyi -stubs/braintree/braintree/merchant_gateway.pyi -stubs/braintree/braintree/partner_merchant.pyi -stubs/braintree/braintree/payment_method.pyi -stubs/braintree/braintree/payment_method_nonce.pyi -stubs/braintree/braintree/payment_method_nonce_gateway.pyi -stubs/braintree/braintree/payment_method_parser.pyi -stubs/braintree/braintree/paypal_account.pyi -stubs/braintree/braintree/paypal_account_gateway.pyi -stubs/braintree/braintree/plan.pyi -stubs/braintree/braintree/plan_gateway.pyi -stubs/braintree/braintree/revoked_payment_method_metadata.pyi -stubs/braintree/braintree/settlement_batch_summary.pyi -stubs/braintree/braintree/settlement_batch_summary_gateway.pyi -stubs/braintree/braintree/transaction_line_item.pyi -stubs/braintree/braintree/transaction_line_item_gateway.pyi -stubs/braintree/braintree/us_bank_account.pyi -stubs/braintree/braintree/us_bank_account_gateway.pyi -stubs/braintree/braintree/us_bank_account_verification.pyi -stubs/braintree/braintree/util/__init__.pyi -stubs/braintree/braintree/util/graphql_client.pyi -stubs/braintree/braintree/util/http.pyi -stubs/braintree/braintree/add_on.pyi -stubs/braintree/braintree/webhook_testing.pyi -stubs/braintree/braintree/add_on_gateway.pyi -stubs/braintree/braintree/address.pyi -stubs/braintree/braintree/masterpass_card.pyi -stubs/braintree/braintree/samsung_pay_card.pyi -stubs/braintree/braintree/visa_checkout_card.pyi -stubs/braintree/braintree/address_gateway.pyi -stubs/braintree/braintree/apple_pay_gateway.pyi -stubs/braintree/braintree/credit_card_verification.pyi -stubs/braintree/braintree/client_token.pyi -stubs/braintree/braintree/client_token_gateway.pyi -stubs/braintree/braintree/credit_card.pyi -stubs/braintree/braintree/error_result.pyi -stubs/braintree/braintree/oauth_gateway.pyi +# pytype doesn't support inner classes properly +stubs/SQLAlchemy/sqlalchemy/databases/__init__.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/__init__.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/__init__.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/base.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/information_schema.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/json.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/mxodbc.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pymssql.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/__init__.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/aiomysql.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/asyncmy.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/base.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/cymysql.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/dml.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/expression.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/json.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadb.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mariadbconnector.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqlconnector.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/mysqldb.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/oursql.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pymysql.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/oracle/base.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/__init__.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/asyncpg.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/dml.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ext.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/json.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pg8000.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/psycopg2cffi.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/pygresql.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/__init__.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/aiosqlite.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/base.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/dml.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/json.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlcipher.pyi +stubs/SQLAlchemy/sqlalchemy/dialects/sqlite/pysqlite.pyi +stubs/SQLAlchemy/sqlalchemy/engine/cursor.pyi +stubs/SQLAlchemy/sqlalchemy/engine/result.pyi +stubs/SQLAlchemy/sqlalchemy/engine/row.pyi +stubs/SQLAlchemy/sqlalchemy/ext/asyncio/result.pyi +stubs/SQLAlchemy/sqlalchemy/ext/horizontal_shard.pyi +stubs/SQLAlchemy/sqlalchemy/orm/attributes.pyi +stubs/SQLAlchemy/sqlalchemy/orm/descriptor_props.pyi +stubs/SQLAlchemy/sqlalchemy/orm/dynamic.pyi +stubs/SQLAlchemy/sqlalchemy/orm/mapper.pyi +stubs/SQLAlchemy/sqlalchemy/orm/query.pyi +stubs/SQLAlchemy/sqlalchemy/orm/strategy_options.pyi +stubs/SQLAlchemy/sqlalchemy/orm/util.pyi +stubs/SQLAlchemy/sqlalchemy/sql/compiler.pyi +stubs/SQLAlchemy/sqlalchemy/sql/crud.pyi +stubs/SQLAlchemy/sqlalchemy/sql/ddl.pyi +stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi +stubs/SQLAlchemy/sqlalchemy/sql/functions.pyi +stubs/SQLAlchemy/sqlalchemy/sql/lambdas.pyi +stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi +stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi +stubs/Flask-SQLAlchemy/flask_sqlalchemy/__init__.pyi +stubs/Flask-SQLAlchemy/flask_sqlalchemy/model.pyi +stubs/Flask-SQLAlchemy/flask_sqlalchemy/utils.pyi diff --git a/tests/pytype_test.py b/tests/pytype_test.py index cacfd67..01a50d3 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -4,28 +4,25 @@ Depends on pytype being installed. If pytype is installed: - 1. For every pyi, do nothing if it is in pytype_exclude_list.txt or is - Python 2-only. + 1. For every pyi, do nothing if it is in pytype_exclude_list.txt. 2. Otherwise, call 'pytype.io.parse_pyi'. Option two will load the file and all the builtins, typeshed dependencies. This will also discover incorrect usage of imported modules. """ +from __future__ import annotations + import argparse import os import sys import traceback -from typing import List, Optional, Sequence +from collections.abc import Sequence -from pytype import config as pytype_config, load_pytd -from pytype.pytd import typeshed +from pytype import config as pytype_config, load_pytd # type: ignore[import] +from pytype.imports import typeshed # type: ignore[import] TYPESHED_SUBDIRS = ["stdlib", "stubs"] - - TYPESHED_HOME = "TYPESHED_HOME" -UNSET = object() # marker for tracking the TYPESHED_HOME environment variable - _LOADERS = {} @@ -34,16 +31,13 @@ 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) + old_typeshed_home = os.environ.get(TYPESHED_HOME) 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, - typeshed_location=typeshed_location, - print_stderr=args.print_stderr, - dry_run=args.dry_run, + files_to_test=files_to_test, typeshed_location=typeshed_location, print_stderr=args.print_stderr, dry_run=args.dry_run ) - if old_typeshed_home is UNSET: + if old_typeshed_home is None: del os.environ[TYPESHED_HOME] else: os.environ[TYPESHED_HOME] = old_typeshed_home @@ -59,23 +53,19 @@ def create_parser() -> argparse.ArgumentParser: "--print-stderr", action="store_true", default=False, help="Print stderr every time an error is encountered." ) parser.add_argument( - "files", - metavar="FILE", - type=str, - nargs="*", - help="Files or directories to check. (Default: Check all files.)", + "files", metavar="FILE", type=str, nargs="*", help="Files or directories to check. (Default: Check all files.)" ) return parser -def run_pytype(*, filename: str, python_version: str, typeshed_location: str) -> Optional[str]: +def run_pytype(*, filename: str, python_version: str, typeshed_location: str) -> str | None: """Runs pytype, returning the stderr if any.""" if python_version not in _LOADERS: - options = pytype_config.Options.create( - "", parse_pyi=True, python_version=python_version) + options = pytype_config.Options.create("", parse_pyi=True, python_version=python_version) loader = load_pytd.create_loader(options) _LOADERS[python_version] = (options, loader) options, loader = _LOADERS[python_version] + stderr: str | None try: with pytype_config.verbosity_from(options): ast = loader.load_file(_get_module_name(filename), filename) @@ -91,7 +81,7 @@ def _get_relative(filename: str) -> str: top = 0 for d in TYPESHED_SUBDIRS: try: - top = filename.index(d) + top = filename.index(d + os.path.sep) except ValueError: continue else: @@ -102,9 +92,7 @@ def _get_relative(filename: str) -> str: def _get_module_name(filename: str) -> str: """Converts a filename {subdir}/m.n/module/foo to module.foo.""" parts = _get_relative(filename).split(os.path.sep) - if "@python2" in parts: - module_parts = parts[parts.index("@python2") + 1:] - elif parts[0] == "stdlib": + if parts[0] == "stdlib": module_parts = parts[1:] else: assert parts[0] == "stubs" @@ -113,16 +101,16 @@ def _get_module_name(filename: str) -> str: def _is_version(path: str, version: str) -> bool: - return any("{}{}{}".format(d, os.path.sep, version) in path for d in TYPESHED_SUBDIRS) + return any(f"{d}{os.path.sep}{version}" in path for d in TYPESHED_SUBDIRS) -def check_subdirs_discoverable(subdir_paths: List[str]) -> None: +def check_subdirs_discoverable(subdir_paths: list[str]) -> None: for p in subdir_paths: if not os.path.isdir(p): - raise SystemExit("Cannot find typeshed subdir at {} (specify parent dir via --typeshed-location)".format(p)) + raise SystemExit(f"Cannot find typeshed subdir at {p} (specify parent dir via --typeshed-location)") -def determine_files_to_test(*, typeshed_location: str, paths: Sequence[str]) -> List[str]: +def determine_files_to_test(*, typeshed_location: str, paths: Sequence[str]) -> list[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.""" @@ -132,14 +120,14 @@ def determine_files_to_test(*, typeshed_location: str, paths: Sequence[str]) -> files = [] for f in sorted(filenames): rel = _get_relative(f) - if rel in skipped or "@python2" in f: + if rel in skipped: continue files.append(f) return files -def find_stubs_in_paths(paths: Sequence[str]) -> List[str]: - filenames = [] +def find_stubs_in_paths(paths: Sequence[str]) -> list[str]: + filenames: list[str] = [] for path in paths: if os.path.isdir(path): for root, _, fns in os.walk(path): @@ -157,13 +145,7 @@ def run_all_tests(*, files_to_test: Sequence[str], typeshed_location: str, print for i, f in enumerate(files_to_test): python_version = "{0.major}.{0.minor}".format(sys.version_info) stderr = ( - run_pytype( - filename=f, - python_version=python_version, - typeshed_location=typeshed_location, - ) - if not dry_run - else None + run_pytype(filename=f, python_version=python_version, typeshed_location=typeshed_location) if not dry_run else None ) if stderr: if print_stderr: @@ -174,11 +156,11 @@ def run_all_tests(*, files_to_test: Sequence[str], typeshed_location: str, print runs = i + 1 if runs % 25 == 0: - print(" {:3d}/{:d} with {:3d} errors".format(runs, total_tests, errors)) + print(f" {runs:3d}/{total_tests:d} with {errors:3d} errors") - print("Ran pytype with {:d} pyis, got {:d} errors.".format(total_tests, errors)) + print(f"Ran pytype with {total_tests:d} pyis, got {errors:d} errors.") for f, v, err in bad: - print("{} ({}): {}".format(f, v, err)) + print(f"{f} ({v}): {err}") if errors: raise SystemExit("\nRun again with --print-stderr to get the full stacktrace.") diff --git a/tests/regr_test.py b/tests/regr_test.py new file mode 100644 index 0000000..fc9f4b1 --- /dev/null +++ b/tests/regr_test.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python3 +"""Run mypy on the test cases for the stdlib and third-party stubs.""" + +from __future__ import annotations + +import argparse +import os +import shutil +import subprocess +import sys +import tempfile +from itertools import product +from pathlib import Path +from typing_extensions import TypeAlias + +from utils import ( + PackageInfo, + colored, + get_all_testcase_directories, + get_recursive_requirements, + print_error, + print_success_msg, + testcase_dir_from_package_name, +) + +ReturnCode: TypeAlias = int + +SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"] +SUPPORTED_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"] + + +def package_with_test_cases(package_name: str) -> PackageInfo: + """Helper function for argument-parsing""" + + if package_name == "stdlib": + return PackageInfo("stdlib", Path("test_cases")) + test_case_dir = testcase_dir_from_package_name(package_name) + if test_case_dir.is_dir(): + return PackageInfo(package_name, test_case_dir) + raise argparse.ArgumentTypeError(f"No test cases found for {package_name!r}!") + + +parser = argparse.ArgumentParser(description="Script to run mypy against various test cases for typeshed's stubs") +parser.add_argument( + "packages_to_test", + type=package_with_test_cases, + nargs="*", + action="extend", + help="Test only these packages (defaults to all typeshed stubs that have test cases)", +) +parser.add_argument( + "--all", + action="store_true", + help=( + 'Run tests on all available platforms and versions (defaults to "False"). ' + "Note that this cannot be specified if --platform and/or --python-version are specified." + ), +) +parser.add_argument( + "--platform", + dest="platforms_to_test", + choices=SUPPORTED_PLATFORMS, + nargs="*", + action="extend", + help=( + "Run mypy for certain OS platforms (defaults to sys.platform). " + "Note that this cannot be specified if --all is also specified." + ), +) +parser.add_argument( + "-p", + "--python-version", + dest="versions_to_test", + choices=SUPPORTED_VERSIONS, + nargs="*", + action="extend", + help=( + "Run mypy for certain Python versions (defaults to sys.version_info[:2])" + "Note that this cannot be specified if --all is also specified." + ), +) + + +def test_testcase_directory(package: PackageInfo, version: str, platform: str) -> ReturnCode: + package_name, test_case_directory = package + is_stdlib = package_name == "stdlib" + + msg = f"Running mypy --platform {platform} --python-version {version} on the " + msg += "standard library test cases..." if is_stdlib else f"test cases for {package_name!r}..." + print(msg, end=" ") + + flags = [ + "--python-version", + version, + "--show-traceback", + "--show-error-codes", + "--no-error-summary", + "--platform", + platform, + "--no-site-packages", + "--strict", + ] + + # --warn-unused-ignores doesn't work for files inside typeshed. + # SO, to work around this, we copy the test_cases directory into a TemporaryDirectory. + with tempfile.TemporaryDirectory() as td: + td_path = Path(td) + new_test_case_dir = td_path / "test_cases" + shutil.copytree(test_case_directory, new_test_case_dir) + env_vars = dict(os.environ) + if is_stdlib: + flags.extend(["--custom-typeshed-dir", str(Path(__file__).parent.parent)]) + else: + # HACK: we want to run these test cases in an isolated environment -- + # we want mypy to see all stub packages listed in the "requires" field of METADATA.toml + # (and all stub packages required by those stub packages, etc. etc.), + # but none of the other stubs in typeshed. + # + # The best way of doing that without stopping --warn-unused-ignore from working + # seems to be to create a "new typeshed" directory in a tempdir + # that has only the required stubs copied over. + new_typeshed = td_path / "typeshed" + os.mkdir(new_typeshed) + shutil.copytree(Path("stdlib"), new_typeshed / "stdlib") + requirements = get_recursive_requirements(package_name) + # mypy refuses to consider a directory a "valid typeshed directory" + # unless there's a stubs/mypy-extensions path inside it, + # so add that to the list of stubs to copy over to the new directory + for requirement in requirements + ["mypy-extensions"]: + shutil.copytree(Path("stubs", requirement), new_typeshed / "stubs" / requirement) + env_vars["MYPYPATH"] = os.pathsep.join(map(str, new_typeshed.glob("stubs/*"))) + flags.extend(["--custom-typeshed-dir", str(td_path / "typeshed")]) + result = subprocess.run([sys.executable, "-m", "mypy", new_test_case_dir, *flags], capture_output=True, env=env_vars) + + if result.returncode: + print_error("failure\n") + replacements = (str(new_test_case_dir), str(test_case_directory)) + if result.stderr: + print_error(result.stderr.decode(), fix_path=replacements) + if result.stdout: + print_error(result.stdout.decode(), fix_path=replacements) + else: + print_success_msg() + return result.returncode + + +def main() -> ReturnCode: + args = parser.parse_args() + + testcase_directories = args.packages_to_test or get_all_testcase_directories() + if args.all: + if args.platforms_to_test: + raise TypeError("Cannot specify both --platform and --all") + if args.versions_to_test: + raise TypeError("Cannot specify both --python-version and --all") + platforms_to_test, versions_to_test = SUPPORTED_PLATFORMS, SUPPORTED_VERSIONS + else: + platforms_to_test = args.platforms_to_test or [sys.platform] + versions_to_test = args.versions_to_test or [f"3.{sys.version_info[1]}"] + + code = 0 + for platform, version, directory in product(platforms_to_test, versions_to_test, testcase_directories): + code = max(code, test_testcase_directory(directory, version, platform)) + if code: + print_error("\nTest completed with errors") + else: + print(colored("\nTest completed successfully!", "green")) + + return code + + +if __name__ == "__main__": + try: + code = main() + except KeyboardInterrupt: + print_error("Test aborted due to KeyboardInterrupt!") + code = 1 + raise SystemExit(code) diff --git a/tests/stubtest_allowlists/darwin-py310.txt b/tests/stubtest_allowlists/darwin-py310.txt index e264ecc..f41bd70 100644 --- a/tests/stubtest_allowlists/darwin-py310.txt +++ b/tests/stubtest_allowlists/darwin-py310.txt @@ -1,3 +1,16 @@ -_?curses.A_ITALIC -_curses.color_pair -curses.color_pair +_?curses.color_pair +webbrowser.MacOSXOSAScript.__init__ + +# Github Actions on macOS with Python 3.10.5 claims these are missing, but they do exist locally +(locale.bind_textdomain_codeset)? +(locale.bindtextdomain)? +(locale.dcgettext)? +(locale.dgettext)? +(locale.gettext)? +(locale.textdomain)? + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below diff --git a/tests/stubtest_allowlists/darwin-py311.txt b/tests/stubtest_allowlists/darwin-py311.txt new file mode 100644 index 0000000..a2f7f5a --- /dev/null +++ b/tests/stubtest_allowlists/darwin-py311.txt @@ -0,0 +1,13 @@ +_?curses.color_pair +xxlimited.Xxo.x_exports + +# Exists at runtime, missing from stub +socket.TCP_CONNECTION_INFO + +(dbm.gnu)? +(locale.bind_textdomain_codeset)? +(locale.bindtextdomain)? +(locale.dcgettext) +(locale.dgettext)? +(locale.gettext)? +(locale.textdomain)? \ No newline at end of file diff --git a/tests/stubtest_allowlists/darwin-py36.txt b/tests/stubtest_allowlists/darwin-py36.txt deleted file mode 100644 index 088b045..0000000 --- a/tests/stubtest_allowlists/darwin-py36.txt +++ /dev/null @@ -1,4 +0,0 @@ -ctypes.wintypes -pwd.getpwnam -ssl.PROTOCOL_SSLv3 # Depends on openssl compilation -ssl.RAND_egd # Depends on openssl compilation diff --git a/tests/stubtest_allowlists/darwin-py37.txt b/tests/stubtest_allowlists/darwin-py37.txt index 05014d7..cfd8f1b 100644 --- a/tests/stubtest_allowlists/darwin-py37.txt +++ b/tests/stubtest_allowlists/darwin-py37.txt @@ -1,3 +1,10 @@ -_?curses.A_ITALIC ctypes.wintypes pwd.getpwnam +webbrowser.MacOSXOSAScript.__init__ + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below +ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 diff --git a/tests/stubtest_allowlists/darwin-py38.txt b/tests/stubtest_allowlists/darwin-py38.txt index 340d297..1617e02 100644 --- a/tests/stubtest_allowlists/darwin-py38.txt +++ b/tests/stubtest_allowlists/darwin-py38.txt @@ -1 +1,7 @@ -_?curses.A_ITALIC +webbrowser.MacOSXOSAScript.__init__ + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below diff --git a/tests/stubtest_allowlists/darwin-py39.txt b/tests/stubtest_allowlists/darwin-py39.txt index 340d297..1617e02 100644 --- a/tests/stubtest_allowlists/darwin-py39.txt +++ b/tests/stubtest_allowlists/darwin-py39.txt @@ -1 +1,7 @@ -_?curses.A_ITALIC +webbrowser.MacOSXOSAScript.__init__ + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below diff --git a/tests/stubtest_allowlists/darwin.txt b/tests/stubtest_allowlists/darwin.txt index 43c03a7..e50de9e 100644 --- a/tests/stubtest_allowlists/darwin.txt +++ b/tests/stubtest_allowlists/darwin.txt @@ -1,25 +1,43 @@ +_?curses.A_ITALIC + _posixsubprocess.cloexec_pipe -_?curses.ACS_.* # ACS codes are initialized only after initscr call. -curses.COLORS # Initialized after start_color -curses.COLOR_PAIRS # Initialized after start_color -curses.COLS # Initialized only after initscr call. -curses.LINES # Initialized only after initscr call. -distutils.command.bdist_msi # msi is only available on windows -grp.struct_group._asdict # PyStructSequence -grp.struct_group._make # PyStructSequence -grp.struct_group._replace # PyStructSequence os.EX_NOTFOUND os.SF_MNOWAIT os.SF_NODISKIO os.SF_SYNC -posix.sched_param # system dependent. Unclear if macos has it. +(os|posix).sched_param # system dependent. Unclear if macos has it. posix.EX_NOTFOUND -posix.XATTR.* # Value seems to be in docs but not defined in github macos readline.append_history_file # not defined in macos select.KQ_FILTER_NETDEV # system dependent select.kqueue.__init__ # default C signature is wrong select.POLLMSG # system dependent +# Sometimes these seem to exist on darwin, sometimes not +(_socket.MSG_NOSIGNAL)? +(socket.MsgFlag.MSG_NOSIGNAL)? +(socket.MSG_NOSIGNAL)? +(os.preadv)? +(os.pwritev)? +(posix.preadv)? +(posix.pwritev)? + +# Exists at runtime, but missing from stubs +distutils.msvccompiler.MSVCCompiler.get_msvc_paths +distutils.msvccompiler.MSVCCompiler.set_path_env_var +distutils.msvccompiler.MacroExpander +mimetypes.MimeTypes.read_windows_registry +selectors.DefaultSelector.fileno +socket.PF_SYSTEM +socket.SYSPROTO_CONTROL + +_ctypes.dlclose +_ctypes.dlopen +_ctypes.dlsym + +posix.NGROUPS_MAX +select.POLLRDHUP +webbrowser.MacOSX.__init__ + # ========== # Allowlist entries that cannot or should not be fixed # ========== @@ -36,13 +54,22 @@ winsound ossaudiodev spwd -# NamedTuple like, but not actually NamedTuples (PyStructSequence) -posix.[a-z]+_(param|result)._(asdict|make|replace) +# multiprocessing.popen_spawn_win32 exists on Darwin but fail to import +multiprocessing.popen_spawn_win32 # Platform differences that cannot be captured by the type system -fcntl.[A-Z0-9_]+ os.SCHED_[A-Z_]+ +posix.SCHED_[A-Z_]+ + +# Some of these exist on non-windows, but they are useless and this is not intended +stat.FILE_ATTRIBUTE_[A-Z_]+ + +# Methods that come from __getattr__() at runtime +tkinter.Tk.createfilehandler +tkinter.Tk.deletefilehandler -# Loadable SQLite extensions are disabled on GitHub runners -(sqlite3(.dbapi2)?.Connection.enable_load_extension)? -(sqlite3(.dbapi2)?.Connection.load_extension)? +_?curses.ACS_.* # ACS codes are initialized only after initscr call +curses.COLORS # Initialized after start_color +curses.COLOR_PAIRS # Initialized after start_color +curses.COLS # Initialized only after initscr call +curses.LINES # Initialized only after initscr call diff --git a/tests/stubtest_allowlists/linux-py310.txt b/tests/stubtest_allowlists/linux-py310.txt index 724f6f1..7cbbe36 100644 --- a/tests/stubtest_allowlists/linux-py310.txt +++ b/tests/stubtest_allowlists/linux-py310.txt @@ -1,19 +1,23 @@ -_curses.color_pair -curses.color_pair -os.pipe2 -os.posix_fadvise -os.posix_fallocate -os.sched_getaffinity -os.sched_getparam -os.sched_getscheduler -os.sched_rr_get_interval -os.sched_setaffinity -os.sched_setparam -os.sched_setscheduler -os.setresgid -os.setresuid -os.waitid -os.sendfile +_?curses.color_pair +(os|posix).EFD_CLOEXEC +(os|posix).EFD_NONBLOCK +(os|posix).EFD_SEMAPHORE +(os|posix).SPLICE_F_MORE +(os|posix).SPLICE_F_MOVE +(os|posix).SPLICE_F_NONBLOCK +(os|posix).setresgid +(os|posix).setresuid +(os|posix).sendfile +(os|posix).eventfd +(os|posix).eventfd_read +(os|posix).eventfd_write +(os|posix).splice signal.sigtimedwait signal.sigwaitinfo select.epoll.register + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below diff --git a/tests/stubtest_allowlists/linux-py311.txt b/tests/stubtest_allowlists/linux-py311.txt new file mode 100644 index 0000000..85d034b --- /dev/null +++ b/tests/stubtest_allowlists/linux-py311.txt @@ -0,0 +1,33 @@ +_?curses.color_pair +mmap.MAP_STACK +(os|posix).EFD_CLOEXEC +(os|posix).EFD_NONBLOCK +(os|posix).EFD_SEMAPHORE +(os|posix).SPLICE_F_MORE +(os|posix).SPLICE_F_MOVE +(os|posix).SPLICE_F_NONBLOCK +(os|posix).setresgid +(os|posix).setresuid +(os|posix).sendfile +(os|posix).eventfd +(os|posix).eventfd_read +(os|posix).eventfd_write +(os|posix).splice +signal.SIGSTKFLT +signal.Signals.SIGSTKFLT +signal.sigtimedwait +signal.sigwaitinfo +select.epoll.register +sqlite3.Connection.deserialize +sqlite3.Connection.serialize +sqlite3.SQLITE_BUSY_TIMEOUT +sqlite3.SQLITE_CORRUPT_INDEX +sqlite3.SQLITE_IOERR_CORRUPTFS +sqlite3.SQLITE_IOERR_DATA +sqlite3.dbapi2.Connection.deserialize +sqlite3.dbapi2.Connection.serialize +sqlite3.dbapi2.SQLITE_BUSY_TIMEOUT +sqlite3.dbapi2.SQLITE_CORRUPT_INDEX +sqlite3.dbapi2.SQLITE_IOERR_CORRUPTFS +sqlite3.dbapi2.SQLITE_IOERR_DATA +xxlimited.Xxo.x_exports diff --git a/tests/stubtest_allowlists/linux-py36.txt b/tests/stubtest_allowlists/linux-py36.txt deleted file mode 100644 index 088b045..0000000 --- a/tests/stubtest_allowlists/linux-py36.txt +++ /dev/null @@ -1,4 +0,0 @@ -ctypes.wintypes -pwd.getpwnam -ssl.PROTOCOL_SSLv3 # Depends on openssl compilation -ssl.RAND_egd # Depends on openssl compilation diff --git a/tests/stubtest_allowlists/linux-py37.txt b/tests/stubtest_allowlists/linux-py37.txt index 8968528..e300b9f 100644 --- a/tests/stubtest_allowlists/linux-py37.txt +++ b/tests/stubtest_allowlists/linux-py37.txt @@ -1,2 +1,9 @@ ctypes.wintypes pwd.getpwnam + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below +ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 diff --git a/tests/stubtest_allowlists/linux-py38.txt b/tests/stubtest_allowlists/linux-py38.txt index 2c83581..e13cc7b 100644 --- a/tests/stubtest_allowlists/linux-py38.txt +++ b/tests/stubtest_allowlists/linux-py38.txt @@ -1 +1,7 @@ select.epoll.register + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below diff --git a/tests/stubtest_allowlists/linux-py39.txt b/tests/stubtest_allowlists/linux-py39.txt index 0fb0a87..6537156 100644 --- a/tests/stubtest_allowlists/linux-py39.txt +++ b/tests/stubtest_allowlists/linux-py39.txt @@ -1,2 +1,8 @@ -os.sendfile +(os|posix).sendfile select.epoll.register + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +distutils.command.bdist_msi # Only available on Windows and Python 3.10 and below diff --git a/tests/stubtest_allowlists/linux.txt b/tests/stubtest_allowlists/linux.txt index 36fcfe4..3f54330 100644 --- a/tests/stubtest_allowlists/linux.txt +++ b/tests/stubtest_allowlists/linux.txt @@ -1,29 +1,31 @@ +_socket.* _posixsubprocess.cloexec_pipe -_?curses.ACS_.* # ACS codes are initialized only after initscr call. -curses.COLORS # Initialized after start_color -curses.COLOR_PAIRS # Initialized after start_color -curses.COLS # Initialized only after initscr call. -curses.LINES # Initialized only after initscr call. -distutils.command.bdist_msi # msi is only available on windows -grp.struct_group._asdict # PyStructSequence -grp.struct_group._make # PyStructSequence -grp.struct_group._replace # PyStructSequence os.EX_NOTFOUND os.SF_MNOWAIT os.SF_NODISKIO os.SF_SYNC -os.chflags -os.lchflags -os.lchmod os.plock posix.EX_NOTFOUND +posix.NGROUPS_MAX select.EPOLL_RDHUP selectors.KqueueSelector signal.SIGEMT signal.SIGINFO -spwd.struct_spwd._asdict # PyStructSequence -spwd.struct_spwd._make # PyStructSequence -spwd.struct_spwd._replace # PyStructSequence +socket.[A-Z0-9_]+ +errno.[A-Z0-9]+ + +# Exists at runtime, but missing from stubs +distutils.msvccompiler.MSVCCompiler.get_msvc_paths +distutils.msvccompiler.MSVCCompiler.set_path_env_var +distutils.msvccompiler.MacroExpander +mimetypes.MimeTypes.read_windows_registry +selectors.DefaultSelector.fileno +spwd.struct_spwd.sp_nam +spwd.struct_spwd.sp_pwd + +_ctypes.dlclose +_ctypes.dlopen +_ctypes.dlsym # ========== # Allowlist entries that cannot or should not be fixed @@ -39,13 +41,23 @@ msvcrt winreg winsound -# NamedTuple like, but not actually NamedTuples (PyStructSequence) -posix.[a-z]+_(param|result)._(asdict|make|replace) +# multiprocessing.popen_spawn_win32 exists on Linux but fail to import +multiprocessing.popen_spawn_win32 # Platform differences that cannot be captured by the type system -fcntl.[A-Z0-9_]+ +fcntl.I_[A-Z0-9_]+ os.SCHED_[A-Z_]+ +posix.SCHED_[A-Z_]+ -# Loadable SQLite extensions are disabled on GitHub runners -(sqlite3(.dbapi2)?.Connection.enable_load_extension)? -(sqlite3(.dbapi2)?.Connection.load_extension)? +# Some of these exist on non-windows, but they are useless and this is not intended +stat.FILE_ATTRIBUTE_[A-Z_]+ + +# Methods that come from __getattr__() at runtime +tkinter.Tk.createfilehandler +tkinter.Tk.deletefilehandler + +_?curses.ACS_.* # ACS codes are initialized only after initscr call +curses.COLORS # Initialized after start_color +curses.COLOR_PAIRS # Initialized after start_color +curses.COLS # Initialized only after initscr call +curses.LINES # Initialized only after initscr call diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 72c5498..6b214f9 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -1,55 +1,29 @@ -_ast.ImportFrom.level _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running -_collections_abc.AsyncGenerator.asend -_collections_abc.AsyncGenerator.athrow -_collections_abc.Container.__contains__ -_collections_abc.Coroutine.send -_collections_abc.Coroutine.throw -_collections_abc.Generator.send -_collections_abc.Generator.throw +_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ -_dummy_thread -ast.Bytes.__new__ -ast.Ellipsis.__new__ -ast.ExtSlice.__new__ -ast.ImportFrom.level -ast.Index.__new__ -ast.NameConstant.__new__ -ast.Num.__new__ -ast.Str.__new__ -asyncio.compat # module removed in 3.7 +_weakref.ProxyType.__reversed__ # Doesn't really exist asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object -builtins.dict.get -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running -collections.abc.ItemsView.__reversed__ -collections.abc.KeysView.__reversed__ -collections.abc.ValuesView.__reversed__ -contextvars.Context.__init__ # Default C __init__ signature is wrong -dataclasses.field -dataclasses.KW_ONLY -dummy_threading -enum.Enum._generate_next_value_ +builtins.float.__setformat__ # Internal method for CPython test suite +builtins.property.__set_name__ # Doesn't actually exist +contextlib.AbstractAsyncContextManager.__class_getitem__ +contextlib.AbstractContextManager.__class_getitem__ +# Missing from distutils module (deprecated, to be removed in 3.12) +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -ftplib.FTP.__init__ -ftplib.FTP_TLS.__init__ -functools.partialmethod.__get__ -functools.singledispatchmethod.__call__ gettext.install gettext.translation hmac.new # Stub is a white lie; see comments in the stub -http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded -importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol +importlib.metadata._meta.SimplePath.__truediv__ # See comments in the stub ipaddress.IPv4Interface.hostmask ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address @@ -57,29 +31,16 @@ ipaddress._BaseNetwork.hostmask multiprocessing.spawn._main pickle.Pickler.reducer_override # implemented in C pickler # platform.uname_result's processor field is now dynamically made to exist +platform.uname_result.__match_args__ platform.uname_result.__new__ platform.uname_result._fields platform.uname_result.processor -queue.SimpleQueue.__init__ # Default C __init__ signature is wrong -smtplib.LMTP.__init__ -ssl.PROTOCOL_SSLv3 # Depends on ssl compilation -ssl.RAND_egd # Depends on openssl compilation -symtable.SymbolTable.has_exec sys.UnraisableHookArgs # Not exported from sys -types.ClassMethodDescriptorType.__get__ -types.CodeType.replace +tkinter.Tk.split types.GenericAlias.__getattr__ -types.MethodDescriptorType.__get__ -types.WrapperDescriptorType.__get__ -typing.ForwardRef._evaluate -typing.SupportsAbs.__init__ -typing.SupportsBytes.__init__ -typing.SupportsComplex.__init__ -typing.SupportsFloat.__init__ -typing.SupportsIndex.__init__ -typing.SupportsInt.__init__ -typing.SupportsRound.__init__ -typing._SpecialForm.__init__ +types.GenericAlias.__mro_entries__ +types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 +typing._SpecialForm.__mro_entries__ typing._TypedDict.__delitem__ typing._TypedDict.__ior__ typing._TypedDict.__or__ @@ -90,81 +51,116 @@ typing._TypedDict.pop typing._TypedDict.setdefault typing._TypedDict.update typing._TypedDict.values +weakref.ProxyType.__reversed__ # Doesn't really exist weakref.WeakValueDictionary.update -xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature -xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature - -# positional-only complaints -builtins.bytearray.pop -builtins.bytearray.remove -collections.OrderedDict.fromkeys -collections.OrderedDict.setdefault -collections.abc.AsyncGenerator.asend -collections.abc.AsyncGenerator.athrow -collections.abc.Container.__contains__ -collections.abc.Coroutine.send -collections.abc.Coroutine.throw -collections.abc.Generator.send -collections.abc.Generator.throw -contextvars.ContextVar.reset -contextvars.ContextVar.set -io.IncrementalNewlineDecoder.setstate -random.SystemRandom.getrandbits -secrets.SystemRandom.getrandbits -# These enums derive from (str, Enum). See comment in py3_common.txt -pstats.SortKey.__new__ -tkinter.EventType.__new__ -# Rest of these errors are new in Python 3.10: -_markupbase.ParserBase.error -asyncio.proactor_events._ProactorReadPipeTransport.__init__ -builtins.aiter -distutils.command.bdist_wininst -importlib.abc.ResourceReader.is_resource -importlib.machinery.BuiltinImporter.create_module -importlib.machinery.BuiltinImporter.exec_module -importlib.machinery.FrozenImporter.create_module -importlib.machinery.PathFinder.invalidate_caches -importlib.metadata.MetadataPathFinder.invalidate_caches -locale.strcoll -locale.strxfrm -logging.Formatter.__init__ -logging.LoggerAdapter.__init__ -logging.PercentStyle.__init__ -pathlib.Path.chmod -pathlib.Path.stat -pathlib.Path.write_text -py_compile.main -pyclbr.Class.__init__ -pyclbr.Function.__init__ -sched.Event.__new__ -sched.Event._fields -signal.default_int_handler -sqlite3.Connection.interrupt -sqlite3.Connection.iterdump -sqlite3.Connection.rollback -sqlite3.Connection.set_authorizer -sqlite3.Connection.set_progress_handler -sqlite3.Connection.set_trace_callback -sqlite3.Cursor.close -sqlite3.Cursor.setinputsizes -sqlite3.Cursor.setoutputsize -sqlite3.Row.keys -sqlite3.complete_statement -sqlite3.dbapi2.Connection.interrupt -sqlite3.dbapi2.Connection.iterdump -sqlite3.dbapi2.Connection.rollback -sqlite3.dbapi2.Connection.set_authorizer -sqlite3.dbapi2.Connection.set_progress_handler -sqlite3.dbapi2.Connection.set_trace_callback -sqlite3.dbapi2.Cursor.close -sqlite3.dbapi2.Cursor.setinputsizes -sqlite3.dbapi2.Cursor.setoutputsize -sqlite3.dbapi2.Row.keys -sqlite3.dbapi2.complete_statement +# stubtest complains that in 3.10 the default argument is inconsistent with the annotation, +# but in 3.10+ calling the function without the default argument is in fact deprecated, +# so it's better to ignore stubtest ssl.SSLContext.__new__ ssl._create_unverified_context -ssl.get_server_certificate -tempfile.TemporaryDirectory.__init__ -unicodedata.ucnhash_CAPI -unittest.mock.create_autospec + +# SpooledTemporaryFile implements IO except these methods before Python 3.11 +# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918 +tempfile.SpooledTemporaryFile.__next__ +tempfile.SpooledTemporaryFile.readable +tempfile.SpooledTemporaryFile.seekable +tempfile.SpooledTemporaryFile.writable + +# Exists at runtime, but missing from stubs +_collections_abc.AsyncIterable.__class_getitem__ +_collections_abc.Awaitable.__class_getitem__ +_collections_abc.Container.__class_getitem__ +_collections_abc.Iterable.__class_getitem__ +_collections_abc.MappingView.__class_getitem__ +_csv.Reader +_csv.Writer +asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone needs this +bdb.Breakpoint.clearBreakpoints +distutils.util.get_host_platform +inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this +inspect.Signature.from_function # Removed in 3.11, can add if someone needs this +multiprocessing.managers.SharedMemoryServer.create +multiprocessing.managers.SharedMemoryServer.list_segments +multiprocessing.managers.SharedMemoryServer.public +multiprocessing.managers.SharedMemoryServer.release_segment +multiprocessing.managers.SharedMemoryServer.shutdown +multiprocessing.managers.SharedMemoryServer.track_segment + +# ========== +# Related to positional-only arguments +# ========== + +# These are not positional-only at runtime, but we treat them +# as positional-only to match dict. +_collections_abc.MutableMapping.pop +_collections_abc.MutableMapping.setdefault + +# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer +# to mark these as positional-only for compatibility with existing sub-classes. +typing.BinaryIO.write +typing.IO.read +typing.IO.readline +typing.IO.readlines +typing.IO.seek +typing.IO.truncate +typing.IO.write +typing.IO.writelines + +# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib +_collections_abc.Coroutine.send +_collections_abc.Coroutine.throw +_collections_abc.Generator.send +_collections_abc.Generator.throw + +# typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface +types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences + +# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 +posixpath.join +ntpath.join +os.path.join + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +# Side effects from module initialization +_compat_pickle.excname +email.contentmanager.maintype +email.contentmanager.subtype +inspect.k +inspect.mod_dict +inspect.v +json.encoder.i +lib2to3.pgen2.grammar.line +lib2to3.pgen2.grammar.name +lib2to3.pgen2.grammar.op +pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 + +# C signature is broader than what is actually accepted +ast.Bytes.__new__ +ast.Ellipsis.__new__ +ast.ExtSlice.__new__ +ast.Index.__new__ +ast.NameConstant.__new__ +ast.Num.__new__ +ast.Str.__new__ +queue.SimpleQueue.__init__ +xml.etree.ElementTree.XMLParser.__init__ +xml.etree.cElementTree.XMLParser.__init__ + +ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 +os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem +types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime +_ast.ImportFrom.level # None on the class, but never None on instances +ast.ImportFrom.level # None on the class, but never None on instances + +# White lies around defaults +dataclasses.KW_ONLY + +# stubtest confuses stdlib distutils with setuptools-bundled distutils (#8410), +# and the whole directory is going to be removed in 3.12 anyway +distutils\..* diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt new file mode 100644 index 0000000..e7b2793 --- /dev/null +++ b/tests/stubtest_allowlists/py311.txt @@ -0,0 +1,149 @@ +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running +_collections_abc.AsyncIterable.__class_getitem__ +_collections_abc.Awaitable.__class_getitem__ +_collections_abc.Container.__class_getitem__ +_collections_abc.ItemsView.__reversed__ +_collections_abc.Iterable.__class_getitem__ +_collections_abc.KeysView.__reversed__ +_collections_abc.MappingView.__class_getitem__ +_collections_abc.ValuesView.__reversed__ +_csv.Reader +_csv.Writer +argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group +asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone needs this +configparser.LegacyInterpolation.__init__ +enum.Enum.__init__ +fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve +ftplib.FTP.trust_server_pasv_ipv4_address +ipaddress.IPv4Interface.hostmask +ipaddress.IPv6Interface.hostmask +ipaddress._BaseNetwork.broadcast_address +ipaddress._BaseNetwork.hostmask +multiprocessing.managers.SharedMemoryServer.create +multiprocessing.managers.SharedMemoryServer.list_segments +multiprocessing.managers.SharedMemoryServer.public +multiprocessing.managers.SharedMemoryServer.release_segment +multiprocessing.managers.SharedMemoryServer.shutdown +multiprocessing.managers.SharedMemoryServer.track_segment +multiprocessing.spawn._main +# platform.uname_result's processor field is now dynamically made to exist +platform.uname_result.__match_args__ +platform.uname_result.__new__ +platform.uname_result._fields +platform.uname_result.processor +queue.SimpleQueue.__init__ +sys.UnraisableHookArgs # Not exported from sys +tkinter._VersionInfoType.__doc__ +typing.NewType.__call__ +typing.NewType.__mro_entries__ +weakref.WeakValueDictionary.update + +# stubtest complains that in 3.10 the default argument is inconsistent with the annotation, +# but in 3.10+ calling the function without the default argument is in fact deprecated, +# so it's better to ignore stubtest +ssl.SSLContext.__new__ +ssl._create_unverified_context + +# ========== +# Related to positional-only arguments +# ========== + +# These are not positional-only at runtime, but we treat them +# as positional-only to match dict. +_collections_abc.MutableMapping.pop +_collections_abc.MutableMapping.setdefault + +# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer +# to mark these as positional-only for compatibility with existing sub-classes. +typing.BinaryIO.write +typing.IO.read +typing.IO.readline +typing.IO.readlines +typing.IO.seek +typing.IO.truncate +typing.IO.write +typing.IO.writelines + +# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib +_collections_abc.Coroutine.send +_collections_abc.Coroutine.throw +_collections_abc.Generator.send +_collections_abc.Generator.throw + +# typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface +types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences + +# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812 +posixpath.join +ntpath.join +os.path.join + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. +_weakref.ProxyType.__reversed__ # Doesn't really exist +builtins.property.__set_name__ # Doesn't actually exist +hmac.new # Stub is a white lie; see comments in the stub +http.HTTPMethod.description # mutable instance attribute at runtime but we pretend it's a property +pickle.Pickler.reducer_override # implemented in C pickler +types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 +types.GenericAlias.__getattr__ +types.GenericAlias.__mro_entries__ +weakref.ProxyType.__reversed__ # Doesn't really exist +inspect._ParameterKind.description # Still exists, but stubtest can't see it + +# C signature is broader than what is actually accepted +ast.Bytes.__new__ +ast.Ellipsis.__new__ +ast.ExtSlice.__new__ +ast.Index.__new__ +ast.NameConstant.__new__ +ast.Num.__new__ +ast.Str.__new__ +asyncio.futures.Future.__init__ +asyncio.Future.__init__ +contextvars.Context.__init__ +queue.SimpleQueue.__init__ +xml.etree.ElementTree.XMLParser.__init__ +xml.etree.cElementTree.XMLParser.__init__ + +os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem +types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime +_ast.ImportFrom.level # None on the class, but never None on instances +ast.ImportFrom.level # None on the class, but never None on instances + +# Treated an alias of a typing class in the stubs, +# they are generic to type checkers anyway. +contextlib.AbstractAsyncContextManager.__class_getitem__ +contextlib.AbstractContextManager.__class_getitem__ + +# The argument to is_python_build() is deprecated since Python 3.11 and +# has a default value of None to check for its existence and warn if it's +# supplied. None is not supposed to be passed by user code and therefore +# not included in the stubs. +sysconfig.is_python_build + +# Super-special typing primitives +typing._SpecialForm.__mro_entries__ +typing._TypedDict.__delitem__ +typing._TypedDict.__ior__ +typing._TypedDict.__or__ +typing._TypedDict.copy +typing._TypedDict.items +typing._TypedDict.keys +typing._TypedDict.pop +typing._TypedDict.setdefault +typing._TypedDict.update +typing._TypedDict.values + +# White lies around defaults +dataclasses.KW_ONLY + +# stubtest confuses stdlib distutils with setuptools-bundled distutils (#8410), +# and the whole directory is going to be removed in 3.12 anyway +distutils\..* diff --git a/tests/stubtest_allowlists/py36.txt b/tests/stubtest_allowlists/py36.txt deleted file mode 100644 index b4c0e2d..0000000 --- a/tests/stubtest_allowlists/py36.txt +++ /dev/null @@ -1,81 +0,0 @@ -_collections_abc.AsyncGenerator.ag_await -_collections_abc.AsyncGenerator.ag_code -_collections_abc.AsyncGenerator.ag_frame -_collections_abc.AsyncGenerator.ag_running -asyncio.Future.__init__ # Usually initialized from c object -asyncio.exceptions # Added in Python 3.8 -asyncio.format_helpers # Added in Python 3.7 -asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures._TracebackLogger.__init__ -asyncio.runners # Added in Python 3.7 -asyncio.staggered # Added in Python 3.8 -asyncio.threads # Added in Python 3.9 -asyncio.trsock # Added in Python 3.8 -builtins.str.maketrans -cmath.log -collections.AsyncGenerator.ag_await -collections.AsyncGenerator.ag_code -collections.AsyncGenerator.ag_frame -collections.AsyncGenerator.ag_running -collections.Callable -collections.UserString.maketrans -contextlib._GeneratorContextManager.__init__ -enum.Enum._generate_next_value_ -fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -hmac.HMAC.__init__ -importlib.metadata # Added in 3.8 -importlib.resources # Added in 3.7 -io.StringIO.readline -ipaddress._BaseNetwork.__init__ -json.loads -mmap.ACCESS_DEFAULT -multiprocessing.shared_memory -os.utime -plistlib.Dict.__init__ -pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args -random.Random.randrange # missing undocumented arg _int -random.randrange # missing undocumented arg _int -sched.Event.__doc__ # __slots__ is overridden -sre_compile.dis -typing.AsyncGenerator.ag_await -typing.AsyncGenerator.ag_code -typing.AsyncGenerator.ag_frame -typing.AsyncGenerator.ag_running -typing.Coroutine.cr_await -typing.Coroutine.cr_code -typing.Coroutine.cr_frame -typing.Coroutine.cr_running -typing.Generator.__new__ -typing.Generator.gi_code -typing.Generator.gi_frame -typing.Generator.gi_running -typing.Generator.gi_yieldfrom -typing.GenericMeta.__new__ -typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493 -typing.Mapping.get -typing.NamedTuple.__new__ -typing.NamedTuple._asdict -typing.NamedTuple._make -typing.NamedTuple._replace -typing.Sequence.index -typing.runtime_checkable -unittest.async_case # Added in Python 3.8 -uuid.UUID.int -xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 -xml.etree.cElementTree.TreeBuilder.start # bpo-39495 -xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args -# These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt -tkinter.EventType.__new__ - -builtins.memoryview.__iter__ # C type that implements __getitem__ -builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only -collections.Coroutine.cr_await -collections.Coroutine.cr_code -collections.Coroutine.cr_frame -collections.Coroutine.cr_running -collections.Generator.gi_code -collections.Generator.gi_frame -collections.Generator.gi_running -collections.Generator.gi_yieldfrom -collections.Mapping.get # Adding None to the Union messed up mypy -collections.Sequence.index # Supporting None in end is not mandatory diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index 968cfd6..f7edf5b 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -2,69 +2,55 @@ _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running -asyncio.compat # Removed in 3.7 +_dummy_threading +asyncio.AbstractEventLoop.run_in_executor # allowed to return a Future, changed in 3.8 +asyncio.events.AbstractEventLoop.run_in_executor # allowed to return a Future, changed in 3.8 asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object -asyncio.exceptions # Added in Python 3.8 asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object -asyncio.staggered # Added in Python 3.8 -asyncio.threads # Added in Python 3.9 -asyncio.trsock # Added in Python 3.8 -builtins.dict.get +asyncio.locks._ContextManagerMixin.__enter__ # Always raises; deliberately omitted from the stub +asyncio.locks._ContextManagerMixin.__exit__ # Always raises; deliberately omitted from the stub +asyncio.transports.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself +asyncio.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself +builtins.float.__set_format__ # Internal method for CPython test suite builtins.str.maketrans cmath.log +collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. +collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491 +collections.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491 +collections.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491 collections.AsyncGenerator.ag_await collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame collections.AsyncGenerator.ag_running collections.Callable +collections.Mapping.__reversed__ # Set to None at runtime for a better error message collections.UserString.maketrans -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running -contextvars.Context.__init__ # Default C __init__ signature is wrong contextvars.ContextVar.get -dataclasses.field -enum.Enum._generate_next_value_ +distutils.command.bdist_wininst # see #6523 +dummy_threading.Condition.acquire +dummy_threading.Condition.release +dummy_threading.Event.isSet +dummy_threading.local.__new__ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve hmac.HMAC.__init__ -http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded -importlib.metadata # Added in 3.8 +inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this +inspect.Signature.from_function # Removed in 3.11, can add if someone needs this ipaddress._BaseNetwork.__init__ json.loads -multiprocessing.shared_memory -os.utime -pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args -queue.SimpleQueue.__init__ # Default C __init__ signature is wrong +(os|posix).utime random.Random.randrange # missing undocumented arg _int -random.randrange # missing undocumented arg _int sched.Event.__doc__ # __slots__ is overridden -ssl.PROTOCOL_SSLv3 # Depends on ssl compilation -ssl.RAND_egd # Depends on openssl compilation -types.ClassMethodDescriptorType.__get__ -types.MethodDescriptorType.__get__ -types.WrapperDescriptorType.__get__ typing.NamedTuple._asdict typing.NamedTuple._make typing.NamedTuple._replace -typing._SpecialForm.__init__ typing._SpecialForm.__new__ typing.runtime_checkable -unittest.async_case # Added in Python 3.8 uuid.UUID.int uuid.UUID.is_safe uuid.getnode # undocumented, unused parameter getters that was later removed xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 xml.etree.cElementTree.TreeBuilder.start # bpo-39495 -xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args -# These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt -pstats.SortKey.__new__ -tkinter.EventType.__new__ -builtins.memoryview.__iter__ # C type that implements __getitem__ -builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only collections.Coroutine.cr_await collections.Coroutine.cr_code collections.Coroutine.cr_frame @@ -75,3 +61,152 @@ collections.Generator.gi_running collections.Generator.gi_yieldfrom collections.Mapping.get # Adding None to the Union messed up mypy collections.Sequence.index # Supporting None in end is not mandatory + +# SpooledTemporaryFile implements IO except these methods before Python 3.11 +# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918 +tempfile.SpooledTemporaryFile.__next__ +tempfile.SpooledTemporaryFile.readable +tempfile.SpooledTemporaryFile.seekable +tempfile.SpooledTemporaryFile.writable + +# Exists at runtime, but missing from stubs +contextvars.ContextVar.__class_getitem__ +datetime.datetime_CAPI +distutils.sysconfig.expand_makefile_vars +distutils.sysconfig.get_python_version +distutils.cygwinccompiler.RE_VERSION +distutils.dist.command_re +distutils.fancy_getopt.longopt_re +distutils.fancy_getopt.neg_alias_re +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords +dummy_threading.Lock +dummy_threading.RLock +dummy_threading.stack_size +html.parser.HTMLParser.unescape +platform.popen +plistlib.Data.asBase64 +plistlib.Data.fromBase64 +ssl.OP_ENABLE_MIDDLEBOX_COMPAT +ssl.Options.OP_ENABLE_MIDDLEBOX_COMPAT +ssl.SSLObject.verify_client_post_handshake +ssl.SSLSocket.verify_client_post_handshake +stringprep.unicodedata # re-exported from unicodedata +tempfile.SpooledTemporaryFile.softspace +tkinter.Tk.split +tkinter.commondialog.[A-Z_]+ +tkinter.commondialog.TclVersion +tkinter.commondialog.TkVersion +tkinter.commondialog.wantobjects +tkinter.dialog.[A-Z_]+ +tkinter.dialog.TclVersion +tkinter.dialog.TkVersion +tkinter.dialog.wantobjects +tkinter.dnd.Icon +tkinter.dnd.Tester +tkinter.dnd.test +tkinter.filedialog.[A-Z_]+ +tkinter.filedialog.TclVersion +tkinter.filedialog.TkVersion +tkinter.filedialog.wantobjects +tkinter.simpledialog.wantobjects +tkinter.tix.wantobjects + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +# Side effects from module initialization +_compat_pickle.excname +email.contentmanager.maintype +email.contentmanager.subtype +inspect.k +inspect.mod_dict +inspect.v +json.encoder.i +lib2to3.pgen2.grammar.line +lib2to3.pgen2.grammar.name +lib2to3.pgen2.grammar.op +pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 + +# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414. +collections.Set.__rand__ +collections.Set.__ror__ +collections.Set.__rsub__ +collections.Set.__rxor__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only + +# C signature is broader than what is actually accepted +queue.SimpleQueue.__init__ + +pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args +xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args +pyexpat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322) +xml.parsers.expat.XMLParserType.intern # does exist but stubtest can't see it (https://github.com/python/cpython/blob/3.7/Modules/pyexpat.c#L1322) + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ + +# Missing from distutils (deprecated, to be removed in 3.12) +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords +distutils.core.Command.dump_options +distutils.core.Command.ensure_finalized +distutils.core.Distribution.announce +distutils.core.Distribution.common_usage +distutils.core.Distribution.display_option_names +distutils.core.Distribution.display_options +distutils.core.Distribution.dump_option_dicts +distutils.core.Distribution.find_config_files +distutils.core.Distribution.get_command_packages +distutils.core.Distribution.global_options +distutils.core.Distribution.has_c_libraries +distutils.core.Distribution.has_data_files +distutils.core.Distribution.has_ext_modules +distutils.core.Distribution.has_headers +distutils.core.Distribution.has_modules +distutils.core.Distribution.has_pure_modules +distutils.core.Distribution.has_scripts +distutils.core.Distribution.is_pure +distutils.core.Distribution.negative_opt +distutils.core.Distribution.parse_command_line +distutils.core.Distribution.print_command_list +distutils.core.Distribution.reinitialize_command +distutils.core.Distribution.run_commands +distutils.cygwinccompiler.PIPE +distutils.cygwinccompiler.is_cygwingcc +distutils.dist.Distribution.announce +distutils.dist.Distribution.common_usage +distutils.dist.Distribution.display_option_names +distutils.dist.Distribution.display_options +distutils.dist.Distribution.dump_option_dicts +distutils.dist.Distribution.find_config_files +distutils.dist.Distribution.get_command_packages +distutils.dist.Distribution.global_options +distutils.dist.Distribution.has_c_libraries +distutils.dist.Distribution.has_data_files +distutils.dist.Distribution.has_ext_modules +distutils.dist.Distribution.has_headers +distutils.dist.Distribution.has_modules +distutils.dist.Distribution.has_pure_modules +distutils.dist.Distribution.has_scripts +distutils.dist.Distribution.is_pure +distutils.dist.Distribution.negative_opt +distutils.dist.Distribution.parse_command_line +distutils.dist.Distribution.print_command_list +distutils.dist.Distribution.reinitialize_command +distutils.dist.Distribution.run_commands diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 249e9c4..f81bd86 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -5,18 +5,23 @@ _collections_abc.AsyncGenerator.ag_running _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ +_dummy_threading ast.Bytes.__new__ ast.Ellipsis.__new__ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ -asyncio.compat # removed in 3.7 asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object -asyncio.threads # Added in Python 3.9 -builtins.dict.get +asyncio.locks._ContextManagerMixin.__enter__ # Always raises; deliberately omitted from the stub +asyncio.locks._ContextManagerMixin.__exit__ # Always raises; deliberately omitted from the stub +asyncio.transports.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself +asyncio.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself +builtins.float.__set_format__ # Internal method for CPython test suite +collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. +collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491 +collections.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491 +collections.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491 collections.AsyncGenerator.ag_await collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame @@ -25,65 +30,45 @@ collections.Callable collections.ItemsView.__reversed__ collections.KeysView.__reversed__ collections.ValuesView.__reversed__ -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running -collections.abc.ItemsView.__reversed__ -collections.abc.KeysView.__reversed__ -collections.abc.ValuesView.__reversed__ -contextvars.Context.__init__ # Default C __init__ signature is wrong -dataclasses.field -enum.Enum._generate_next_value_ +collections.Mapping.__reversed__ # Set to None at runtime for a better error message +distutils.command.bdist_wininst # see #6523 +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords +dummy_threading.Condition.acquire +dummy_threading.Condition.release +dummy_threading.Event.isSet +dummy_threading.Thread.native_id +dummy_threading.local.__new__ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -functools.partialmethod.__get__ -functools.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable +ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 gettext.install # codeset default value is ['unspecified'] so can't be specified gettext.translation # codeset default value is ['unspecified'] so can't be specified hmac.new # Stub is a white lie; see comments in the stub -http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded +inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this +inspect.Signature.from_function # Removed in 3.11, can add if someone needs this ipaddress.IPv4Interface.hostmask ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address ipaddress._BaseNetwork.hostmask multiprocessing.spawn._main pickle.Pickler.reducer_override # implemented in C pickler -queue.SimpleQueue.__init__ # Default C __init__ signature is wrong random.Random.randrange # missing undocumented arg _int -random.randrange # missing undocumented arg _int sched.Event.__doc__ # __slots__ is overridden -ssl.PROTOCOL_SSLv3 # Depends on ssl compilation -ssl.RAND_egd # Depends on openssl compilation sys.UnraisableHookArgs # Not exported from sys -types.ClassMethodDescriptorType.__get__ -types.CodeType.replace -types.MethodDescriptorType.__get__ -types.WrapperDescriptorType.__get__ typing.NamedTuple.__new__ typing.NamedTuple._asdict typing.NamedTuple._make typing.NamedTuple._replace -typing.SupportsAbs.__init__ -typing.SupportsBytes.__init__ -typing.SupportsComplex.__init__ -typing.SupportsFloat.__init__ -typing.SupportsIndex.__init__ -typing.SupportsInt.__init__ -typing.SupportsRound.__init__ -typing._SpecialForm.__init__ typing._SpecialForm.__new__ -uuid.getnode # undocumented, unused parameter getters that was later removed weakref.WeakValueDictionary.update xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature xml.etree.cElementTree.TreeBuilder.start # bpo-39495 xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature -# These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt -pstats.SortKey.__new__ -tkinter.EventType.__new__ -builtins.memoryview.__iter__ # C type that implements __getitem__ -builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only collections.Coroutine.cr_await collections.Coroutine.cr_code collections.Coroutine.cr_frame @@ -94,3 +79,148 @@ collections.Generator.gi_running collections.Generator.gi_yieldfrom collections.Mapping.get # Adding None to the Union messed up mypy collections.Sequence.index # Supporting None in end is not mandatory + +# SpooledTemporaryFile implements IO except these methods before Python 3.11 +# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918 +tempfile.SpooledTemporaryFile.__next__ +tempfile.SpooledTemporaryFile.readable +tempfile.SpooledTemporaryFile.seekable +tempfile.SpooledTemporaryFile.writable + +# Exists at runtime, but missing from stubs +contextvars.ContextVar.__class_getitem__ +datetime.datetime_CAPI +distutils.sysconfig.expand_makefile_vars +distutils.sysconfig.get_python_version +distutils.util.get_host_platform +distutils.cygwinccompiler.RE_VERSION +distutils.dist.command_re +distutils.fancy_getopt.longopt_re +distutils.fancy_getopt.neg_alias_re +dummy_threading.ExceptHookArgs +dummy_threading.Lock +dummy_threading.RLock +dummy_threading.stack_size +html.parser.HTMLParser.unescape +multiprocessing.managers.SharedMemoryServer.create +multiprocessing.managers.SharedMemoryServer.list_segments +multiprocessing.managers.SharedMemoryServer.public +multiprocessing.managers.SharedMemoryServer.release_segment +multiprocessing.managers.SharedMemoryServer.shutdown +multiprocessing.managers.SharedMemoryServer.track_segment +plistlib.Data.asBase64 +plistlib.Data.fromBase64 +stringprep.unicodedata # re-exported from unicodedata +tempfile.SpooledTemporaryFile.softspace +tkinter.Tk.split +tkinter.commondialog.[A-Z_]+ +tkinter.commondialog.TclVersion +tkinter.commondialog.TkVersion +tkinter.commondialog.wantobjects +tkinter.dialog.[A-Z_]+ +tkinter.dialog.TclVersion +tkinter.dialog.TkVersion +tkinter.dialog.wantobjects +tkinter.dnd.Icon +tkinter.dnd.Tester +tkinter.dnd.test +tkinter.filedialog.[A-Z_]+ +tkinter.filedialog.TclVersion +tkinter.filedialog.TkVersion +tkinter.filedialog.wantobjects +tkinter.simpledialog.wantobjects +tkinter.tix.wantobjects + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +# Side effects from module initialization +_compat_pickle.excname +email.contentmanager.maintype +email.contentmanager.subtype +inspect.k +inspect.mod_dict +inspect.v +json.encoder.i +lib2to3.pgen2.grammar.line +lib2to3.pgen2.grammar.name +lib2to3.pgen2.grammar.op +pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 + +# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414. +collections.Set.__rand__ +collections.Set.__ror__ +collections.Set.__rsub__ +collections.Set.__rxor__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only + +# C signature is broader than what is actually accepted +queue.SimpleQueue.__init__ + +uuid.getnode # undocumented, unused parameter getters that was later removed +types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ + +# Missing from distutils (deprecated, to be removed in 3.12) +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords +distutils.core.Command.dump_options +distutils.core.Command.ensure_finalized +distutils.core.Distribution.announce +distutils.core.Distribution.common_usage +distutils.core.Distribution.display_option_names +distutils.core.Distribution.display_options +distutils.core.Distribution.dump_option_dicts +distutils.core.Distribution.find_config_files +distutils.core.Distribution.get_command_packages +distutils.core.Distribution.global_options +distutils.core.Distribution.has_c_libraries +distutils.core.Distribution.has_data_files +distutils.core.Distribution.has_ext_modules +distutils.core.Distribution.has_headers +distutils.core.Distribution.has_modules +distutils.core.Distribution.has_pure_modules +distutils.core.Distribution.has_scripts +distutils.core.Distribution.is_pure +distutils.core.Distribution.negative_opt +distutils.core.Distribution.parse_command_line +distutils.core.Distribution.print_command_list +distutils.core.Distribution.reinitialize_command +distutils.core.Distribution.run_commands +distutils.cygwinccompiler.PIPE +distutils.cygwinccompiler.is_cygwingcc +distutils.dist.Distribution.announce +distutils.dist.Distribution.common_usage +distutils.dist.Distribution.display_option_names +distutils.dist.Distribution.display_options +distutils.dist.Distribution.dump_option_dicts +distutils.dist.Distribution.find_config_files +distutils.dist.Distribution.get_command_packages +distutils.dist.Distribution.global_options +distutils.dist.Distribution.has_c_libraries +distutils.dist.Distribution.has_data_files +distutils.dist.Distribution.has_ext_modules +distutils.dist.Distribution.has_headers +distutils.dist.Distribution.has_modules +distutils.dist.Distribution.has_pure_modules +distutils.dist.Distribution.has_scripts +distutils.dist.Distribution.is_pure +distutils.dist.Distribution.negative_opt +distutils.dist.Distribution.parse_command_line +distutils.dist.Distribution.print_command_list +distutils.dist.Distribution.reinitialize_command +distutils.dist.Distribution.run_commands diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index 3d7084d..da7d32d 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -1,4 +1,3 @@ -_ast.ImportFrom.level _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame @@ -6,50 +5,44 @@ _collections_abc.AsyncGenerator.ag_running _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ -_dummy_thread +_weakref.ProxyType.__reversed__ # Doesn't really exist ast.Bytes.__new__ ast.Ellipsis.__new__ ast.ExtSlice.__new__ -ast.ImportFrom.level ast.Index.__new__ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ -asyncio.compat # module removed in 3.7 asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object -builtins.dict.get +builtins.float.__setformat__ # Internal method for CPython test suite +collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. +collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491 +collections.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491 +collections.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491 collections.AsyncGenerator.ag_await collections.AsyncGenerator.ag_code collections.AsyncGenerator.ag_frame collections.AsyncGenerator.ag_running collections.Callable +collections.Mapping.__reversed__ # Set to None at runtime for a better error message collections.ItemsView.__reversed__ collections.KeysView.__reversed__ collections.ValuesView.__reversed__ -collections.abc.AsyncGenerator.ag_await -collections.abc.AsyncGenerator.ag_code -collections.abc.AsyncGenerator.ag_frame -collections.abc.AsyncGenerator.ag_running -collections.abc.ItemsView.__reversed__ -collections.abc.KeysView.__reversed__ -collections.abc.ValuesView.__reversed__ -contextvars.Context.__init__ # Default C __init__ signature is wrong -dataclasses.field -dummy_threading -enum.Enum._generate_next_value_ +contextlib.AbstractAsyncContextManager.__class_getitem__ +contextlib.AbstractContextManager.__class_getitem__ +distutils.command.bdist_wininst # see #6523 +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -ftplib.FTP.__init__ -ftplib.FTP_TLS.__init__ -functools.partialmethod.__get__ -functools.singledispatchmethod.__call__ gettext.install gettext.translation hmac.new # Stub is a white lie; see comments in the stub -http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded -importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol +inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this +inspect.Signature.from_function # Removed in 3.11, can add if someone needs this ipaddress.IPv4Interface.hostmask ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address @@ -60,27 +53,12 @@ pickle.Pickler.reducer_override # implemented in C pickler platform.uname_result.__new__ platform.uname_result._fields platform.uname_result.processor -queue.SimpleQueue.__init__ # Default C __init__ signature is wrong sched.Event.__doc__ # __slots__ is overridden -smtplib.LMTP.__init__ -ssl.PROTOCOL_SSLv3 # Depends on ssl compilation -ssl.RAND_egd # Depends on openssl compilation -symtable.SymbolTable.has_exec sys.UnraisableHookArgs # Not exported from sys -types.ClassMethodDescriptorType.__get__ -types.CodeType.replace +tkinter.Tk.split +types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime types.GenericAlias.__getattr__ -types.MethodDescriptorType.__get__ -types.WrapperDescriptorType.__get__ -typing.ForwardRef._evaluate -typing.SupportsAbs.__init__ -typing.SupportsBytes.__init__ -typing.SupportsComplex.__init__ -typing.SupportsFloat.__init__ -typing.SupportsIndex.__init__ -typing.SupportsInt.__init__ -typing.SupportsRound.__init__ -typing._SpecialForm.__init__ +types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 typing._TypedDict.__delitem__ typing._TypedDict.__ior__ typing._TypedDict.__or__ @@ -91,16 +69,9 @@ typing._TypedDict.pop typing._TypedDict.setdefault typing._TypedDict.update typing._TypedDict.values +weakref.ProxyType.__reversed__ # Doesn't really exist weakref.WeakValueDictionary.update -xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature -xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature -# These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt -pstats.SortKey.__new__ -tkinter.EventType.__new__ - -builtins.memoryview.__iter__ # C type that implements __getitem__ -builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only collections.Coroutine.cr_await collections.Coroutine.cr_code collections.Coroutine.cr_frame @@ -111,3 +82,142 @@ collections.Generator.gi_running collections.Generator.gi_yieldfrom collections.Mapping.get # Adding None to the Union messed up mypy collections.Sequence.index # Supporting None in end is not mandatory + +# Exists at runtime, but missing from stubs +_collections_abc.AsyncIterable.__class_getitem__ +_collections_abc.Awaitable.__class_getitem__ +_collections_abc.Container.__class_getitem__ +_collections_abc.Iterable.__class_getitem__ +_collections_abc.MappingView.__class_getitem__ +collections.AsyncIterable.__class_getitem__ +collections.Awaitable.__class_getitem__ +collections.Container.__class_getitem__ +collections.Iterable.__class_getitem__ +collections.MappingView.__class_getitem__ +distutils.sysconfig.expand_makefile_vars +distutils.sysconfig.get_python_version +distutils.util.get_host_platform +distutils.cygwinccompiler.RE_VERSION +distutils.dist.command_re +distutils.fancy_getopt.longopt_re +distutils.fancy_getopt.neg_alias_re +hmac.HMAC.digest_cons +hmac.HMAC.inner +hmac.HMAC.outer +multiprocessing.managers.SharedMemoryServer.create +multiprocessing.managers.SharedMemoryServer.list_segments +multiprocessing.managers.SharedMemoryServer.public +multiprocessing.managers.SharedMemoryServer.release_segment +multiprocessing.managers.SharedMemoryServer.shutdown +multiprocessing.managers.SharedMemoryServer.track_segment +stringprep.unicodedata # re-exported from unicodedata +types.GenericAlias.__mro_entries__ +typing._SpecialForm.__mro_entries__ + +# SpooledTemporaryFile implements IO except these methods before Python 3.11 +# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918 +tempfile.SpooledTemporaryFile.__next__ +tempfile.SpooledTemporaryFile.readable +tempfile.SpooledTemporaryFile.seekable +tempfile.SpooledTemporaryFile.writable + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +# Side effects from module initialization +_compat_pickle.excname +email.contentmanager.maintype +email.contentmanager.subtype +inspect.k +inspect.mod_dict +inspect.v +json.encoder.i +lib2to3.pgen2.grammar.line +lib2to3.pgen2.grammar.name +lib2to3.pgen2.grammar.op +pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 +pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 + +# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414. +collections.Set.__rand__ +collections.Set.__ror__ +collections.Set.__rsub__ +collections.Set.__rxor__ + +builtins.memoryview.__iter__ # C type that implements __getitem__ +builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only + +# C signature is broader than what is actually accepted +queue.SimpleQueue.__init__ +xml.etree.ElementTree.XMLParser.__init__ +xml.etree.cElementTree.XMLParser.__init__ + +ast.FormattedValue.conversion # None on the class, but never None on instances +_ast.FormattedValue.conversion # None on the class, but never None on instances +_ast.ImportFrom.level # None on the class, but never None on instances +ast.ImportFrom.level # None on the class, but never None on instances + +ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 +os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +builtins.classmethod.__get__ +builtins.property.__get__ +builtins.staticmethod.__get__ +types.FunctionType.__get__ +types.LambdaType.__get__ + +# Missing from distutils (deprecated, to be removed in 3.12) +distutils.core.DEBUG +distutils.core.USAGE +distutils.core.extension_keywords +distutils.core.gen_usage +distutils.core.setup_keywords +distutils.core.Command.dump_options +distutils.core.Command.ensure_finalized +distutils.core.Distribution.announce +distutils.core.Distribution.common_usage +distutils.core.Distribution.display_option_names +distutils.core.Distribution.display_options +distutils.core.Distribution.dump_option_dicts +distutils.core.Distribution.find_config_files +distutils.core.Distribution.get_command_packages +distutils.core.Distribution.global_options +distutils.core.Distribution.has_c_libraries +distutils.core.Distribution.has_data_files +distutils.core.Distribution.has_ext_modules +distutils.core.Distribution.has_headers +distutils.core.Distribution.has_modules +distutils.core.Distribution.has_pure_modules +distutils.core.Distribution.has_scripts +distutils.core.Distribution.is_pure +distutils.core.Distribution.negative_opt +distutils.core.Distribution.parse_command_line +distutils.core.Distribution.print_command_list +distutils.core.Distribution.reinitialize_command +distutils.core.Distribution.run_commands +distutils.cygwinccompiler.PIPE +distutils.cygwinccompiler.is_cygwingcc +distutils.dist.Distribution.announce +distutils.dist.Distribution.common_usage +distutils.dist.Distribution.display_option_names +distutils.dist.Distribution.display_options +distutils.dist.Distribution.dump_option_dicts +distutils.dist.Distribution.find_config_files +distutils.dist.Distribution.get_command_packages +distutils.dist.Distribution.global_options +distutils.dist.Distribution.has_c_libraries +distutils.dist.Distribution.has_data_files +distutils.dist.Distribution.has_ext_modules +distutils.dist.Distribution.has_headers +distutils.dist.Distribution.has_modules +distutils.dist.Distribution.has_pure_modules +distutils.dist.Distribution.has_scripts +distutils.dist.Distribution.is_pure +distutils.dist.Distribution.negative_opt +distutils.dist.Distribution.parse_command_line +distutils.dist.Distribution.print_command_list +distutils.dist.Distribution.reinitialize_command +distutils.dist.Distribution.run_commands diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index 25f81d3..03db863 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -1,4 +1,9 @@ -_collections_abc.Callable # Some typecheckers need this as specialform +# ========== +# Allowlist entries that should be fixed +# ========== + +# Please keep sorted alphabetically + # Coroutine and Generator properties are added programmatically _collections_abc.Coroutine.cr_await _collections_abc.Coroutine.cr_code @@ -8,20 +13,27 @@ _collections_abc.Generator.gi_code _collections_abc.Generator.gi_frame _collections_abc.Generator.gi_running _collections_abc.Generator.gi_yieldfrom +_collections_abc.Mapping.__reversed__ # set to None at runtime for a better error message _collections_abc.Mapping.get # Adding None to the Union messed up mypy _collections_abc.Sequence.index # Supporting None in end is not mandatory + +# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414. +_collections_abc.Set.__rand__ +_collections_abc.Set.__ror__ +_collections_abc.Set.__rsub__ +_collections_abc.Set.__rxor__ + _csv.Dialect.__init__ # C __init__ signature is inaccurate -_dummy_threading -_socket.* _threading_local.local.__new__ -_typeshed.* # Utility types for typeshed, doesn't exist at runtime -abc.abstractclassmethod -abc.abstractstaticmethod -abc.ABCMeta.__new__ # pytype wants the parameter named cls and not mcls +_weakref.ref.* # Alias for _weakref.ReferenceType, problems should be fixed there _weakref.CallableProxyType.__getattr__ # Should have all attributes of proxy _weakref.ProxyType.__getattr__ # Should have all attributes of proxy _weakref.ReferenceType.__call__ # C function default annotation is wrong +_weakref.ReferenceType.__init__ # Runtime defines __new__ but stubtest thinks __init__ is also defined. argparse.Namespace.__getattr__ # The whole point of this class is its attributes are dynamic +asynchat.async_chat.encoding # Removal planned for 3.12, can add if someone needs this +asynchat.async_chat.use_encoding # Removal planned for 3.12, can add if someone needs this +asynchat.find_prefix_at_end # Removal planned for 3.12, can add if someone needs this asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them # Condition functions are exported in __init__ asyncio.Condition.acquire @@ -34,13 +46,13 @@ asyncio.locks.Condition.locked asyncio.locks.Condition.release asyncio.proactor_events.BaseProactorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation asyncio.selector_events.BaseSelectorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation -builtins.classmethod.__get__ # this function can accept no value for the type parameter. +builtins.OSError.characters_written # GetSetDescriptor that always raises AttributeError +builtins.dict.get builtins.ellipsis # type is not exposed anywhere builtins.function builtins.memoryview.__contains__ # C type that implements __getitem__ builtins.object.__init__ # default C signature is incorrect -builtins.property.__get__ # this function can accept no value for the type parameter. -builtins.staticmethod.__get__ # this function can accept no value for the type parameter. +builtins.type.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute. bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set # The following CodecInfo properties are added in __new__ codecs.CodecInfo.decode @@ -49,17 +61,9 @@ codecs.CodecInfo.incrementaldecoder codecs.CodecInfo.incrementalencoder codecs.CodecInfo.streamreader codecs.CodecInfo.streamwriter -# Coroutine and Generator properties are added programmatically collections.ChainMap.get # Adding None to the underlying Mapping Union messed up mypy -# Coroutine and Generator properties are added programmatically -collections.abc.Coroutine.cr_await -collections.abc.Coroutine.cr_code -collections.abc.Coroutine.cr_frame -collections.abc.Coroutine.cr_running -collections.abc.Generator.gi_code -collections.abc.Generator.gi_frame -collections.abc.Generator.gi_running -collections.abc.Generator.gi_yieldfrom +collections.ChainMap.fromkeys # Runtime has *args which can really only be one argument +collections.UserList.sort # Runtime has *args but will error if any are supplied configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used # SectionProxy get functions are set in __init__ configparser.SectionProxy.getboolean @@ -72,36 +76,31 @@ csv.Dialect.doublequote csv.Dialect.lineterminator csv.Dialect.quoting csv.Dialect.skipinitialspace -ctypes.Array.__iter__ # mypy doesn't support using __getitem__ instead of __iter__ so this is here https://github.com/python/mypy/issues/2220 +csv.DictReader.__init__ # runtime sig has *args but will error if more than 5 positional args are supplied +csv.DictWriter.__init__ # runtime sig has *args but will error if more than 5 positional args are supplied +ctypes.Array._type_ # _type_ and _length_ are abstract, https://github.com/python/typeshed/pull/6361 +ctypes.Array._length_ ctypes.CDLL._FuncPtr # None at class level but initialized in __init__ to this value ctypes.memmove # CFunctionType ctypes.memset # CFunctionType -ctypes.pointer # imported C function ctypes.string_at # docstring argument name is wrong ctypes.wstring_at # docstring argument name is wrong -difflib.SequenceMatcher.__init__ # mypy default value for generic parameter issues. See https://github.com/python/mypy/issues/3737 distutils.command.bdist_packager # It exists in docs as package name but not in code except as a mention in a comment. distutils.version.Version._cmp # class should have declared this distutils.version.Version.parse # class should have declared this -email.headerregistry.BaseHeader.max_count # docs say subclasses should have this property -enum.EnumMeta.__call__ -enum.EnumMeta.__new__ +enum.Enum._generate_next_value_ +hashlib.sha3_\d+ # Can be a class or a built-in function, can't be subclassed at runtime +hashlib.shake_\d+ # Can be a class or a built-in function, can't be subclassed at runtime http.HTTPStatus.description # set in __new__ http.HTTPStatus.phrase # set in __new__ http.client.HTTPConnection.response_class # the actual type at runtime is abc.ABCMeta -imaplib.IMAP4_SSL.ssl # Dependent on SSL existence importlib.abc.FileLoader.get_filename # Wrapped with _check_name decorator which changes runtime signature importlib.abc.FileLoader.load_module # Wrapped with _check_name decorator which changes runtime signature -importlib.abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatability +importlib.abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility importlib.abc.MetaPathFinder.find_spec # Not defined on the actual class, but expected to exist. importlib.abc.PathEntryFinder.find_spec # Not defined on the actual class, but expected to exist. importlib.machinery.ExtensionFileLoader.get_filename # Wrapped with _check_name decorator which changes runtime signature inspect.Parameter.empty # set as private marker _empty -inspect.Parameter.KEYWORD_ONLY -inspect.Parameter.POSITIONAL_ONLY -inspect.Parameter.POSITIONAL_OR_KEYWORD -inspect.Parameter.VAR_KEYWORD -inspect.Parameter.VAR_POSITIONAL inspect.Signature.empty # set as private marker _empty io.BufferedRandom.truncate io.BufferedReader.seek @@ -133,7 +132,9 @@ lib2to3.pytree.BasePattern.__new__ lib2to3.pytree.BasePattern.type lib2to3.pytree.NegatedPattern.match lib2to3.pytree.NegatedPattern.match_seq -mmap.mmap.__iter__ # has __getitem__ but mypy doesn't derive __iter__ from it: https://github.com/python/mypy/issues/2220 +# LC_MESSAGES is sometimes present in __all__, sometimes not, +# so stubtest will sometimes complain about exported names being different at runtime to the exported names in the stub +(locale)? multiprocessing.JoinableQueue multiprocessing.Queue multiprocessing.SimpleQueue @@ -158,71 +159,224 @@ numbers.Number.__hash__ # typeshed marks this as abstract but code just sets th optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr pickle.Pickler.persistent_id # C pickler persistent_id is an attribute pickle.Unpickler.persistent_load # C unpickler persistent_load is an attribute +pickle._Unpickler\..* # Best effort typing for undocumented internals +pickle._Pickler\..* # Best effort typing for undocumented internals poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi -pydoc.HTMLDoc.docdata -pydoc.HTMLDoc.docproperty -pydoc.HTMLDoc.docroutine -pydoc.TextDoc.docdata -pydoc.TextDoc.docmodule -pydoc.TextDoc.docother -pydoc.TextDoc.docproperty -pydoc.TextDoc.docroutine +pyexpat.expat_CAPI select.poll # Depends on configuration selectors.DevpollSelector # Depends on configuration +socketserver.BaseServer.RequestHandlerClass # is defined as a property, because we need `Self` type socketserver.BaseServer.fileno # implemented in derived classes socketserver.BaseServer.get_request # implemented in derived classes socketserver.BaseServer.server_bind # implemented in derived classes -ssl.PROTOCOL_SSLv2 # Defined only if compiled with ssl v2 ssl.Purpose.__new__ # You cannot override __new__ in NamedTuple and runtime uses namedtuple. ssl._ASN1Object.__new__ # You cannot override __new__ in NamedTuple and runtime uses namedtuple. -subprocess.Popen.__init__ -sys.gettotalrefcount # Available on python debug builds +(sys.get_int_max_str_digits)? # Added in a patch release, backported to all security branches, but has yet to find its way to all GitHub Actions images sys.implementation # Actually SimpleNamespace but then you wouldn't have convenient attributes +(sys.set_int_max_str_digits)? # Added in a patch release, backported to all security branches, but has yet to find its way to all GitHub Actions images +sys.thread_info tarfile.TarFile.errors # errors is initialized for some reason as None even though it really only accepts str -# SpooledTemporaryFile implements IO except these methods -# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918 -tempfile.SpooledTemporaryFile.__next__ -tempfile.SpooledTemporaryFile.readable -tempfile.SpooledTemporaryFile.seekable -tempfile.SpooledTemporaryFile.writable threading.Condition.acquire # Condition functions are exported in __init__ threading.Condition.release # Condition functions are exported in __init__ +tkinter.simpledialog.[A-Z_]+ +tkinter.simpledialog.TclVersion +tkinter.simpledialog.TkVersion +tkinter.tix.[A-Z_]+ +tkinter.tix.TclVersion +tkinter.tix.TkVersion +multiprocessing.dummy.Condition.acquire +multiprocessing.dummy.Condition.release threading.Lock # A factory function that returns 'most efficient lock'. Marking it as a function will make it harder for users to mark the Lock type. +threading.RLock # Similar to above +multiprocessing.dummy.Lock # Similar to above +multiprocessing.dummy.RLock # Similar to above +# alias for a class defined elsewhere, mypy infers the variable has type `(*args) -> ForkingPickler` but stubtest infers the runtime type as +multiprocessing.reduction.AbstractReducer.ForkingPickler tkinter.Misc.grid_propagate # The noarg placeholder is a set value list tkinter.Misc.pack_propagate # The noarg placeholder is a set value list -tkinter.Misc.grid_columnconfigure # an empty dict literal is actually a valid default for a TypedDict(total=False) parameter -tkinter.Misc.grid_rowconfigure # an empty dict literal is actually a valid default for a TypedDict(total=False) parameter 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) -traceback.TracebackException.from_exception # explicitly expanding arguemnts going into TracebackException __init__ -types.GetSetDescriptorType.__get__ # this function can accept no value for the type parameter. -types.MemberDescriptorType.__get__ # this function can accept no value for the type parameter. +traceback.TracebackException.from_exception # explicitly expanding arguments going into TracebackException __init__ +types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist. +types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist. +types.ModuleType.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute. +types.ModuleType.__getattr__ # this doesn't exist at runtime types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature -typing.IO.__iter__ # Added because IO streams are iterable. See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3 typing.IO.__next__ # Added because IO streams are iterable. See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3 typing.type_check_only # typing decorator that is not available at runtime unittest.mock.patch # It's a complicated overload and I haven't been able to figure out why stubtest doesn't like it urllib.parse._DefragResultBase.__new__ # Generic NamedTuple is problematic in mypy, so regular tuple was used. See https://github.com/python/mypy/issues/685 urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified -warnings.catch_warnings.__init__ # Defining this ruins the __new__ overrides weakref.CallableProxyType.__getattr__ # Should have all attributes of proxy weakref.ProxyType.__getattr__ # Should have all attributes of proxy -weakref.ReferenceType.__call__ # C function default annotation is wrong +weakref.ReferenceType.* # Alias for _weakref.ReferenceType, problems should be fixed there weakref.WeakKeyDictionary.get weakref.WeakKeyDictionary.update weakref.WeakValueDictionary.get +weakref.ref.* # Alias for _weakref.ReferenceType, problems should be fixed there webbrowser.UnixBrowser.remote_action # always overridden in inheriting class webbrowser.UnixBrowser.remote_action_newtab # always overridden in inheriting class webbrowser.UnixBrowser.remote_action_newwin # always overridden in inheriting class -wsgiref.types # Doesn't exist, see comments in file +xml.parsers.expat.expat_CAPI + +# ========== +# Exists at runtime, but missing from stubs +# ========== +_json.encode_basestring +_socket.CAPI +_thread.LockType.acquire_lock +_thread.LockType.locked_lock +_thread.LockType.release_lock +_thread.RLock +_thread.allocate +_thread.exit_thread +_thread.start_new +_threading_local._localimpl.localargs +_threading_local._localimpl.locallock +builtins.SyntaxError.print_file_and_line +bz2.BZ2File.peek +codecs.StreamReader.charbuffertype +codecs.StreamReader.seek +codecs.StreamWriter.seek +configparser.ParsingError.filename +configparser.RawConfigParser.converters +ctypes.ARRAY +ctypes.SetPointerType +ctypes.c_voidp +ctypes.util.test +importlib.abc.Finder.find_module +lib2to3.pgen2.grammar.Grammar.loads +logging.config.BaseConfigurator +logging.config.ConvertingDict +logging.config.ConvertingList +logging.config.ConvertingMixin +logging.config.ConvertingTuple +logging.config.DictConfigurator +logging.config.dictConfigClass +mimetypes.MimeTypes.add_type +modulefinder.test +multiprocessing.managers.Server.accepter +multiprocessing.managers.Server.create +multiprocessing.managers.Server.debug_info +multiprocessing.managers.Server.decref +multiprocessing.managers.Server.dummy +multiprocessing.managers.Server.fallback_getvalue +multiprocessing.managers.Server.fallback_mapping +multiprocessing.managers.Server.fallback_repr +multiprocessing.managers.Server.fallback_str +multiprocessing.managers.Server.get_methods +multiprocessing.managers.Server.handle_request +multiprocessing.managers.Server.incref +multiprocessing.managers.Server.number_of_objects +multiprocessing.managers.Server.public +multiprocessing.managers.Server.serve_client +multiprocessing.managers.Server.shutdown +multiprocessing.managers.SyncManager.Barrier +multiprocessing.managers.SyncManager.JoinableQueue +multiprocessing.managers.SyncManager.Pool +multiprocessing.pool.Pool.Process +multiprocessing.pool.ThreadPool.Process +multiprocessing.synchronize.Semaphore.get_value +socket.CAPI +tkinter.Misc.config +tkinter.font.Font.counter +tkinter.tix.CObjView +tkinter.tix.DialogShell +tkinter.tix.ExFileSelectDialog +tkinter.tix.FileSelectDialog +tkinter.tix.FileTypeList +tkinter.tix.Grid +tkinter.tix.NoteBookFrame +tkinter.tix.OptionName +tkinter.tix.ResizeHandle +tkinter.tix.ScrolledGrid +tkinter.tix.ScrolledHList +tkinter.tix.ScrolledListBox +tkinter.tix.ScrolledTList +tkinter.tix.ScrolledText +tkinter.tix.ScrolledWindow +tkinter.tix.Shell +turtle.TNavigator.speed + +# Undocumented implementation details of a deprecated class +importlib.machinery.WindowsRegistryFinder.DEBUG_BUILD +importlib.machinery.WindowsRegistryFinder.REGISTRY_KEY +importlib.machinery.WindowsRegistryFinder.REGISTRY_KEY_DEBUG + +# Undocumented implementation details +profile.Profile.dispatch +profile.Profile.fake_code +profile.Profile.fake_frame +profile.Profile.trace_dispatch +profile.Profile.trace_dispatch_c_call +profile.Profile.trace_dispatch_call +profile.Profile.trace_dispatch_exception +profile.Profile.trace_dispatch_i +profile.Profile.trace_dispatch_l +profile.Profile.trace_dispatch_mac +profile.Profile.trace_dispatch_return +cgi.FieldStorage.bufsize +cgi.FieldStorage.read_binary +cgi.FieldStorage.read_lines +cgi.FieldStorage.read_lines_to_eof +cgi.FieldStorage.read_lines_to_outerboundary +cgi.FieldStorage.read_multi +cgi.FieldStorage.read_single +cgi.FieldStorage.read_urlencoded +cgi.FieldStorage.skip_lines +email.contentmanager.get_and_fixup_unknown_message_content +email.contentmanager.get_message_content +email.contentmanager.get_non_text_content +email.contentmanager.get_text_content +email.contentmanager.set_bytes_content +email.contentmanager.set_message_content +email.contentmanager.set_text_content +pipes.Template.makepipeline +pipes.Template.open_r +pipes.Template.open_w +sunau.Au_read.initfp +sunau.Au_write.initfp +turtle.ScrolledCanvas.adjustScrolls +turtle.ScrolledCanvas.onResize +wave.Wave_read.initfp +wave.Wave_write.initfp + +_ctypes.Array +_ctypes.CFuncPtr +_ctypes.POINTER +_ctypes.PyObj_FromPtr +_ctypes.Py_DECREF +_ctypes.Py_INCREF +_ctypes.Structure +_ctypes.Union +_ctypes.addressof +_ctypes.alignment +_ctypes.buffer_info +_ctypes.byref +_ctypes.call_cdeclfunction +_ctypes.call_function +_ctypes.get_errno +_ctypes.pointer +_ctypes.resize +_ctypes.set_errno +_ctypes.sizeof # ========== # Allowlist entries that cannot or should not be fixed # ========== + +ctypes.Array.raw # exists but stubtest can't see it; only available if _CT == c_char + +_collections_abc.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. +_collections_abc.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491 +_collections_abc.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491 +_collections_abc.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491 _pydecimal.* # See comments in file +_weakref.ProxyType.__bytes__ # Doesn't really exist ast.NodeVisitor.visit_\w+ # Methods are discovered dynamically, see #3796 + # Weird special builtins that are typed as functions, but aren't functions builtins.copyright builtins.credits @@ -230,40 +384,379 @@ builtins.exit builtins.help builtins.license builtins.quit -# Builtins that mypy pretends exist -builtins.reveal_locals -builtins.reveal_type + +builtins.float.__getformat__ # Internal method for CPython test suite + +# These super() dunders don't seem to be particularly useful, +# and having them pop up on autocomplete suggestions would be annoying +builtins.super.__self__ +builtins.super.__self_class__ +builtins.super.__thisclass__ + +# These enums derive from (int, IntEnum) or (str, Enum). +pstats.SortKey.__new__ +tkinter.EventType.__new__ + +# These multiprocessing proxy methods have *args, **kwargs signatures at runtime, +# But have more precise (accurate) signatures in the stub +multiprocessing.managers.BaseListProxy.__imul__ +multiprocessing.managers.BaseListProxy.__len__ +multiprocessing.managers.BaseListProxy.__reversed__ +multiprocessing.managers.BaseListProxy.reverse +multiprocessing.managers.BaseListProxy.sort +multiprocessing.managers.DictProxy.__iter__ +multiprocessing.managers.DictProxy.__len__ +multiprocessing.managers.DictProxy.clear +multiprocessing.managers.DictProxy.copy +multiprocessing.managers.DictProxy.items +multiprocessing.managers.DictProxy.keys +multiprocessing.managers.DictProxy.popitem +multiprocessing.managers.DictProxy.values + +# Items that depend on the existence and flags of SSL +imaplib.IMAP4_SSL.ssl +ssl.PROTOCOL_SSLv2 +ssl.PROTOCOL_SSLv3 +ssl.RAND_egd + collections.abc.* # Types are re-exported from _collections_abc, so errors should be fixed there distutils.command.check.SilentReporter # only defined if docutils in installed -# Dynamically specified by __getattr__, and thus don't exist on the class -tempfile._TemporaryFileWrapper.[\w_]+ +hmac.HMAC.blocksize # use block_size instead +pickle.Pickler.memo # undocumented implementation detail, has different type in C/Python implementations +pickle.Unpickler.memo # undocumented implementation detail, has different type in C/Python implementations +re.Pattern.scanner # Undocumented and not useful. #6405 +tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class + +# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) +types.ClassMethodDescriptorType.__get__ +types.GetSetDescriptorType.__get__ +types.MemberDescriptorType.__get__ +types.MethodDescriptorType.__get__ +types.WrapperDescriptorType.__get__ + # Various classes in typing aren't types at runtime. In addition, mypy thinks some special forms are tautologically defined. typing.[A-Z]\w+ typing_extensions\..* + +# These are abstract properties at runtime, +# but marking them as such in the stub breaks half the the typed-Python ecosystem (see #8726) +typing.IO.closed +typing.IO.mode +typing.IO.name +typing.TextIO.buffer +typing.TextIO.encoding +typing.TextIO.errors +typing.TextIO.line_buffering +typing.TextIO.newlines + +# Typing-related weirdness +_collections_abc.Callable +_typeshed.* # Utility types for typeshed, doesn't exist at runtime +typing._SpecialForm.__call__ +typing._SpecialForm.__init__ + +# Builtins that type checkers pretends exist +builtins.reveal_locals +builtins.reveal_type + +# White lies around defaults +dataclasses.field + # We can't distinguish not having a default value from having a default value of inspect.Parameter.empty inspect.Parameter.__init__ inspect.Signature.__init__ -# Any field can be set on Namespace -multiprocessing.(dummy|managers).Namespace.__[gs]etattr__ -os.[a-z]+_(param|result)._(asdict|make|replace) # NamedTuple like, but not actually NamedTuples + +# C signature is broader than what is actually accepted +contextvars.Context.__init__ + +multiprocessing.(dummy|managers).Namespace.__[gs]etattr__ # Any field can be set on Namespace + # sys attributes that are not always defined +sys.gettotalrefcount # Available on python debug builds sys.last_traceback sys.last_type sys.last_value sys.ps1 sys.ps2 sys.tracebacklimit + # See comments in file. List out methods that are delegated by __getattr__ at runtime. # Used to make the relevant class satisfy BinaryIO interface. codecs.StreamReaderWriter.\w+ codecs.StreamRecoder.\w+ urllib.response.addbase.\w+ +weakref.ProxyType.__bytes__ # Doesn't actually exist + +# Dynamically created, has unnecessary *args +turtle.ScrolledCanvas.find_all +turtle.ScrolledCanvas.select_clear +turtle.ScrolledCanvas.select_item + +# Unnecessary re-exports +asyncore\.E[A-Z]+ # re-exported from errno +asyncore.errorcode # re-exported from errno +email._header_value_parser.hexdigits +logging.handlers.ST_[A-Z]+ +xml.dom.expatbuilder.EMPTY_NAMESPACE +xml.dom.expatbuilder.EMPTY_PREFIX +xml.dom.expatbuilder.XMLNS_NAMESPACE +xml.dom.minidom.EMPTY_NAMESPACE +xml.dom.minidom.EMPTY_PREFIX +xml.dom.minidom.XMLNS_NAMESPACE +xml.dom.minidom.StringTypes + +# __all__-related weirdness (see #6523) +distutils.command.build +distutils.command.build_py +distutils.command.build_ext +distutils.command.build_clib +distutils.command.build_scripts +distutils.command.clean +distutils.command.install +distutils.command.install_lib +distutils.command.install_headers +distutils.command.install_scripts +distutils.command.install_data +distutils.command.sdist +distutils.command.register +distutils.command.bdist +distutils.command.bdist_dumb +distutils.command.bdist_rpm +distutils.command.check +distutils.command.upload +email.base64mime +email.charset +email.encoders +email.errors +email.feedparser +email.generator +email.header +email.iterators +email.message +email.mime +email.parser +email.quoprimime +email.utils +xml.dom +xml.etree +xml.sax + # Platform differences that cannot be captured by the type system -errno.[A-Z0-9]+ os.O_[A-Z_]+ (posix.O_[A-Z_]+)? (posix.ST_[A-Z]+)? socket.AF_DECnet -socket.[A-Z0-9_]+ (termios.[A-Z0-9_]+)? + +# Loadable SQLite extensions are disabled on GitHub runners +(sqlite3(.dbapi2)?.Connection.enable_load_extension)? +(sqlite3(.dbapi2)?.Connection.load_extension)? + +# Missing aliases to existing methods that not many people seem to use. +# Complicated multiple inheritance, confuses type checkers. +tkinter.Grid.bbox +tkinter.Grid.columnconfigure +tkinter.Grid.config +tkinter.Grid.configure +tkinter.Grid.forget +tkinter.Grid.grid_bbox +tkinter.Grid.grid_columnconfigure +tkinter.Grid.grid_location +tkinter.Grid.grid_propagate +tkinter.Grid.grid_rowconfigure +tkinter.Grid.grid_size +tkinter.Grid.grid_slaves +tkinter.Grid.info +tkinter.Grid.propagate +tkinter.Grid.rowconfigure +tkinter.Grid.slaves +tkinter.Pack.config +tkinter.Pack.configure +tkinter.Pack.info +tkinter.Pack.pack_propagate +tkinter.Pack.pack_slaves +tkinter.Pack.slaves +tkinter.Place.config +tkinter.Place.configure +tkinter.Place.forget +tkinter.Place.place_slaves +tkinter.Place.slaves + +# Methods that come from __getattr__() at runtime +tkinter.Tk.adderrorinfo +tkinter.Tk.call +tkinter.Tk.createcommand +tkinter.Tk.createtimerhandler +tkinter.Tk.dooneevent +tkinter.Tk.evalfile +tkinter.Tk.exprboolean +tkinter.Tk.exprdouble +tkinter.Tk.exprlong +tkinter.Tk.exprstring +tkinter.Tk.globalgetvar +tkinter.Tk.globalsetvar +tkinter.Tk.globalunsetvar +tkinter.Tk.interpaddr +tkinter.Tk.record +tkinter.Tk.splitlist +tkinter.Tk.unsetvar +tkinter.Tk.wantobjects +tkinter.Tk.willdispatch + +# Undocumented and have a comment in the source code saying "State variables (don't mess with these)" +wsgiref.handlers.BaseHandler.bytes_sent +wsgiref.handlers.BaseHandler.headers +wsgiref.handlers.BaseHandler.headers_sent +wsgiref.handlers.BaseHandler.result +wsgiref.handlers.BaseHandler.status + +# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__) +# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220 +ctypes.Array.__iter__ +mmap.mmap.__iter__ +xml.etree.ElementTree.Element.__iter__ +xml.etree.cElementTree.Element.__iter__ +typing.IO.__iter__ # See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3 + +# ========== +# Missing from deprecated modules +# Any of these can be added if someone needs them +# ========== + +# Removal planned for 3.12 +asyncore.dispatcher.addr +asyncore.dispatcher.handle_accepted +# Missing from distutils module (deprecated, to be removed in 3.12) +distutils.archive_util.ARCHIVE_FORMATS +distutils.archive_util.check_archive_formats +distutils.bcppcompiler.BCPPCompiler.compiler_type +distutils.bcppcompiler.BCPPCompiler.exe_extension +distutils.bcppcompiler.BCPPCompiler.executables +distutils.bcppcompiler.BCPPCompiler.obj_extension +distutils.bcppcompiler.BCPPCompiler.shared_lib_extension +distutils.bcppcompiler.BCPPCompiler.shared_lib_format +distutils.bcppcompiler.BCPPCompiler.src_extensions +distutils.bcppcompiler.BCPPCompiler.static_lib_extension +distutils.bcppcompiler.BCPPCompiler.static_lib_format +distutils.ccompiler.CCompiler.EXECUTABLE +distutils.ccompiler.CCompiler.SHARED_LIBRARY +distutils.ccompiler.CCompiler.SHARED_OBJECT +distutils.ccompiler.CCompiler.compiler_type +distutils.ccompiler.CCompiler.exe_extension +distutils.ccompiler.CCompiler.language_map +distutils.ccompiler.CCompiler.language_order +distutils.ccompiler.CCompiler.obj_extension +distutils.ccompiler.CCompiler.set_executable +distutils.ccompiler.CCompiler.shared_lib_extension +distutils.ccompiler.CCompiler.shared_lib_format +distutils.ccompiler.CCompiler.src_extensions +distutils.ccompiler.CCompiler.static_lib_extension +distutils.ccompiler.CCompiler.static_lib_format +distutils.ccompiler.compiler_class +distutils.cmd.Command.dump_options +distutils.cmd.Command.ensure_finalized +distutils.command.bdist +distutils.command.bdist_rpm.DEBUG +distutils.command.build_ext.USER_BASE +distutils.command.build_scripts.ST_MODE +distutils.command.install.* +distutils.command.install_scripts.ST_MODE +distutils.core.Distribution.finalize_options +distutils.core.Distribution.get_command_class +distutils.core.Distribution.get_command_list +distutils.core.Distribution.handle_display_options +distutils.core.Distribution.print_commands +distutils.core.Distribution.run_command +distutils.cygwinccompiler.CONFIG_H_NOTOK +distutils.cygwinccompiler.CONFIG_H_OK +distutils.cygwinccompiler.CONFIG_H_UNCERTAIN +distutils.cygwinccompiler.CygwinCCompiler.compiler_type +distutils.cygwinccompiler.CygwinCCompiler.exe_extension +distutils.cygwinccompiler.CygwinCCompiler.obj_extension +distutils.cygwinccompiler.CygwinCCompiler.shared_lib_extension +distutils.cygwinccompiler.CygwinCCompiler.shared_lib_format +distutils.cygwinccompiler.CygwinCCompiler.static_lib_extension +distutils.cygwinccompiler.CygwinCCompiler.static_lib_format +distutils.cygwinccompiler.Mingw32CCompiler.compiler_type +distutils.cygwinccompiler.check_config_h +distutils.cygwinccompiler.get_msvcr +distutils.cygwinccompiler.get_versions +distutils.dir_util.ensure_relative +distutils.dist.DEBUG +distutils.dist.Distribution.finalize_options +distutils.dist.Distribution.get_command_class +distutils.dist.Distribution.get_command_list +distutils.dist.Distribution.handle_display_options +distutils.dist.Distribution.print_commands +distutils.dist.Distribution.run_command +distutils.dist.DistributionMetadata.set_classifiers +distutils.dist.DistributionMetadata.set_keywords +distutils.dist.DistributionMetadata.set_platforms +distutils.dist.fix_help_options +distutils.extension.read_setup_file +distutils.fancy_getopt.WS_TRANS +distutils.fancy_getopt.FancyGetopt.add_option +distutils.fancy_getopt.FancyGetopt.get_attr_name +distutils.fancy_getopt.FancyGetopt.has_option +distutils.fancy_getopt.FancyGetopt.print_help +distutils.fancy_getopt.FancyGetopt.set_aliases +distutils.fancy_getopt.FancyGetopt.set_negative_aliases +distutils.fancy_getopt.FancyGetopt.set_option_table +distutils.fancy_getopt.longopt_pat +distutils.fancy_getopt.longopt_xlate +distutils.fancy_getopt.translate_longopt +distutils.msvccompiler.MSVCCompiler.compiler_type +distutils.msvccompiler.MSVCCompiler.exe_extension +distutils.msvccompiler.MSVCCompiler.executables +distutils.msvccompiler.MSVCCompiler.find_exe +distutils.msvccompiler.MSVCCompiler.initialize +distutils.msvccompiler.MSVCCompiler.obj_extension +distutils.msvccompiler.MSVCCompiler.res_extension +distutils.msvccompiler.MSVCCompiler.shared_lib_extension +distutils.msvccompiler.MSVCCompiler.shared_lib_format +distutils.msvccompiler.MSVCCompiler.src_extensions +distutils.msvccompiler.MSVCCompiler.static_lib_extension +distutils.msvccompiler.MSVCCompiler.static_lib_format +distutils.msvccompiler.convert_mbcs +distutils.msvccompiler.get_build_architecture +distutils.msvccompiler.get_build_version +distutils.msvccompiler.normalize_and_reduce_paths +distutils.msvccompiler.read_keys +distutils.msvccompiler.read_values +distutils.spawn.DEBUG +distutils.sysconfig.BASE_EXEC_PREFIX +distutils.sysconfig.BASE_PREFIX +distutils.sysconfig.build_flags +distutils.sysconfig.parse_config_h +distutils.sysconfig.parse_makefile +distutils.sysconfig.project_base +distutils.sysconfig.python_build +distutils.text_file.TextFile.default_options +distutils.text_file.TextFile.error +distutils.text_file.TextFile.gen_error +distutils.unixccompiler.UnixCCompiler.compiler_type +distutils.unixccompiler.UnixCCompiler.dylib_lib_extension +distutils.unixccompiler.UnixCCompiler.dylib_lib_format +distutils.unixccompiler.UnixCCompiler.executables +distutils.unixccompiler.UnixCCompiler.obj_extension +distutils.unixccompiler.UnixCCompiler.shared_lib_extension +distutils.unixccompiler.UnixCCompiler.shared_lib_format +distutils.unixccompiler.UnixCCompiler.src_extensions +distutils.unixccompiler.UnixCCompiler.static_lib_extension +distutils.unixccompiler.UnixCCompiler.static_lib_format +distutils.unixccompiler.UnixCCompiler.xcode_stub_lib_extension +distutils.unixccompiler.UnixCCompiler.xcode_stub_lib_format +distutils.util.grok_environment_error + +# Missing from pkgutil.ImpImporter/ImpLoader (both deprecated since 3.3, can add if someone needs it) +pkgutil.ImpImporter.find_module +pkgutil.ImpImporter.iter_modules +pkgutil.ImpLoader.code +pkgutil.ImpLoader.get_code +pkgutil.ImpLoader.get_data +pkgutil.ImpLoader.get_filename +pkgutil.ImpLoader.get_source +pkgutil.ImpLoader.is_package +pkgutil.ImpLoader.load_module +pkgutil.ImpLoader.source diff --git a/tests/stubtest_allowlists/win32-py310.txt b/tests/stubtest_allowlists/win32-py310.txt index ea57614..264c489 100644 --- a/tests/stubtest_allowlists/win32-py310.txt +++ b/tests/stubtest_allowlists/win32-py310.txt @@ -1,7 +1,11 @@ -_msi.CreateRecord -_msi.FCICreate -_msi.OpenDatabase -sqlite3.Connection.enable_load_extension -sqlite3.Connection.load_extension -sqlite3.dbapi2.Connection.enable_load_extension -sqlite3.dbapi2.Connection.load_extension +# Exists at runtime, but missing from stubs +_winapi.CreateFileMapping +_winapi.MapViewOfFile +_winapi.OpenFileMapping +_winapi.VirtualQuerySize +asyncio.IocpProactor.recvfrom +asyncio.IocpProactor.sendto +asyncio.windows_events.IocpProactor.recvfrom +asyncio.windows_events.IocpProactor.sendto +msvcrt.GetErrorMode +subprocess.STARTUPINFO.copy diff --git a/tests/stubtest_allowlists/win32-py311.txt b/tests/stubtest_allowlists/win32-py311.txt new file mode 100644 index 0000000..bfda0e0 --- /dev/null +++ b/tests/stubtest_allowlists/win32-py311.txt @@ -0,0 +1,14 @@ + +_winapi.CreateFileMapping +_winapi.MapViewOfFile +_winapi.OpenFileMapping +_winapi.VirtualQuerySize +asyncio.IocpProactor.recvfrom +asyncio.IocpProactor.recvfrom_into +asyncio.IocpProactor.sendto +asyncio.windows_events.IocpProactor.recvfrom +asyncio.windows_events.IocpProactor.recvfrom_into +asyncio.windows_events.IocpProactor.sendto +msvcrt.GetErrorMode +os.EX_OK +subprocess.STARTUPINFO.copy diff --git a/tests/stubtest_allowlists/win32-py36.txt b/tests/stubtest_allowlists/win32-py36.txt deleted file mode 100644 index 8d55cba..0000000 --- a/tests/stubtest_allowlists/win32-py36.txt +++ /dev/null @@ -1,11 +0,0 @@ - # 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 -urllib.parse.parse_qs -urllib.parse.parse_qsl - -hashlib.scrypt -os.startfile diff --git a/tests/stubtest_allowlists/win32-py37.txt b/tests/stubtest_allowlists/win32-py37.txt index 855f4d4..f82edee 100644 --- a/tests/stubtest_allowlists/win32-py37.txt +++ b/tests/stubtest_allowlists/win32-py37.txt @@ -9,3 +9,12 @@ urllib.parse.parse_qs urllib.parse.parse_qsl os.startfile + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +# pathlib methods that exist on Windows, but always raise NotImplementedError, +# so are omitted from the stub +pathlib.WindowsPath.group +pathlib.WindowsPath.owner diff --git a/tests/stubtest_allowlists/win32-py38.txt b/tests/stubtest_allowlists/win32-py38.txt index e69de29..91ec592 100644 --- a/tests/stubtest_allowlists/win32-py38.txt +++ b/tests/stubtest_allowlists/win32-py38.txt @@ -0,0 +1,19 @@ +# Exists at runtime, but missing from stubs +_winapi.CreateFileMapping +_winapi.MapViewOfFile +_winapi.OpenFileMapping +_winapi.VirtualQuerySize +asyncio.IocpProactor.recvfrom +asyncio.IocpProactor.sendto +asyncio.windows_events.IocpProactor.recvfrom +asyncio.windows_events.IocpProactor.sendto +subprocess.STARTUPINFO.copy + +# ========== +# Allowlist entries that cannot or should not be fixed +# ========== + +# pathlib methods that exist on Windows, but always raise NotImplementedError, +# so are omitted from the stub +pathlib.WindowsPath.group +pathlib.WindowsPath.owner diff --git a/tests/stubtest_allowlists/win32-py39.txt b/tests/stubtest_allowlists/win32-py39.txt new file mode 100644 index 0000000..c575656 --- /dev/null +++ b/tests/stubtest_allowlists/win32-py39.txt @@ -0,0 +1,10 @@ +# Exists at runtime, but missing from stubs +_winapi.CreateFileMapping +_winapi.MapViewOfFile +_winapi.OpenFileMapping +_winapi.VirtualQuerySize +asyncio.IocpProactor.recvfrom +asyncio.IocpProactor.sendto +asyncio.windows_events.IocpProactor.recvfrom +asyncio.windows_events.IocpProactor.sendto +subprocess.STARTUPINFO.copy diff --git a/tests/stubtest_allowlists/win32.txt b/tests/stubtest_allowlists/win32.txt index a1f8693..6714168 100644 --- a/tests/stubtest_allowlists/win32.txt +++ b/tests/stubtest_allowlists/win32.txt @@ -1,9 +1,37 @@ ctypes.GetLastError # Is actually a pointer +distutils.archive_util.getgrnam +distutils.archive_util.getpwnam +distutils.msvccompiler.HKEYS +locale.[A-Z0-9_]+ # Constants that should be moved to _locale and re-exported conditionally +locale.nl_langinfo # Function that should be moved to _locale and re-exported conditionally +mmap.PAGESIZE +# alias for a class defined elsewhere, +# mypy infers the variable has type `(*args) -> DupHandle` but stubtest infers the runtime type as +multiprocessing.reduction.AbstractReducer.DupHandle +msilib.text.dirname +msvcrt.CRT_ASSEMBLY_VERSION selectors.KqueueSelector signal.SIGEMT signal.SIGINFO -locale.[A-Z0-9_]+ # Constants that should be moved to _locale and re-exported conditionally -locale.nl_langinfo # Function that should be moved to _locale and re-exported conditionally +winsound.SND_APPLICATION +xmlrpc.server.fcntl + +# Exists at runtime, but missing from stubs +_msi.MSIError +distutils.msvccompiler.MSVCCompiler.manifest_get_embed_info +distutils.msvccompiler.MSVCCompiler.manifest_setup_ldargs +distutils.msvccompiler.OldMSVCCompiler +msvcrt.SetErrorMode +ssl.SSLSocket.recvmsg +ssl.SSLSocket.recvmsg_into +ssl.SSLSocket.sendmsg +winreg.HKEYType.handle +_ctypes.FormatError +_ctypes.FreeLibrary +_ctypes.LoadLibrary +_ctypes.get_last_error +_ctypes.set_last_error + # ========== # Allowlist entries that cannot or should not be fixed @@ -29,12 +57,26 @@ syslog termios xxlimited +# multiprocessing.popen_fork, popen_forkserver, and popen_spawn_posix exist on Windows but fail to import +multiprocessing.popen_fork +multiprocessing.popen_forkserver +multiprocessing.popen_spawn_posix + # Modules that rely on _curses curses curses.ascii +curses.has_key curses.panel curses.textpad # Modules that rely on termios pty tty + +# pathlib functions that rely on modules that don't exist on Windows +pathlib.Path.owner +pathlib.Path.group +# pathlib methods that exist on Windows, but always raise NotImplementedError, +# so are omitted from the stub +pathlib.Path.is_mount +pathlib.WindowsPath.is_mount diff --git a/tests/stubtest_stdlib.py b/tests/stubtest_stdlib.py index 8558860..c008353 100755 --- a/tests/stubtest_stdlib.py +++ b/tests/stubtest_stdlib.py @@ -3,7 +3,7 @@ stubtest is a script in the mypy project that compares stubs to the actual objects at runtime. Note that therefore the output of stubtest depends on which Python version it is run with. -In typeshed CI, we run stubtest with each currently supported Python minor version, except 2.7. +In typeshed CI, we run stubtest with each currently supported Python minor version. """ @@ -14,20 +14,14 @@ def run_stubtest(typeshed_dir: Path) -> int: allowlist_dir = typeshed_dir / "tests" / "stubtest_allowlists" - version_allowlist = "py{}{}.txt".format(sys.version_info.major, sys.version_info.minor) - platform_allowlist = "{}.txt".format(sys.platform) - combined_allowlist = "{}-py{}{}.txt".format(sys.platform, sys.version_info.major, sys.version_info.minor) - - ignore_unused_allowlist = "--ignore-unused-allowlist" in sys.argv[1:] + version_allowlist = f"py{sys.version_info.major}{sys.version_info.minor}.txt" + platform_allowlist = f"{sys.platform}.txt" + combined_allowlist = f"{sys.platform}-py{sys.version_info.major}{sys.version_info.minor}.txt" cmd = [ sys.executable, "-m", "mypy.stubtest", - # Use --ignore-missing-stub, because if someone makes a correct addition, they'll need to - # also make a allowlist change and if someone makes an incorrect addition, they'll run into - # false negatives. - "--ignore-missing-stub", "--check-typeshed", "--custom-typeshed-dir", str(typeshed_dir), @@ -36,34 +30,27 @@ def run_stubtest(typeshed_dir: Path) -> int: "--allowlist", str(allowlist_dir / version_allowlist), ] - if ignore_unused_allowlist: - cmd += ["--ignore-unused-allowlist"] if (allowlist_dir / platform_allowlist).exists(): - cmd += [ - "--allowlist", - str(allowlist_dir / platform_allowlist), - ] + cmd += ["--allowlist", str(allowlist_dir / platform_allowlist)] if (allowlist_dir / combined_allowlist).exists(): - cmd += [ - "--allowlist", - str(allowlist_dir / combined_allowlist), - ] + cmd += ["--allowlist", str(allowlist_dir / combined_allowlist)] if sys.version_info < (3, 10): # As discussed in https://github.com/python/typeshed/issues/3693, we only aim for # positional-only arg accuracy for the latest Python version. cmd += ["--ignore-positional-only"] + print(" ".join(cmd), file=sys.stderr) try: - print(" ".join(cmd), file=sys.stderr) subprocess.run(cmd, check=True) except subprocess.CalledProcessError as e: print( "\nNB: stubtest output depends on the Python version (and system) it is run with. " "See README.md for more details.\n" "NB: We only check positional-only arg accuracy for Python 3.10.\n" - "\nCommand run was: {}\n".format(" ".join(cmd)), + f"\nCommand run was: {' '.join(cmd)}\n", file=sys.stderr, ) - print("stubtest failed", file=sys.stderr) + print("\n\n", file=sys.stderr) + print(f'To fix "unused allowlist" errors, remove the corresponding entries from {allowlist_dir}', file=sys.stderr) return e.returncode else: print("stubtest succeeded", file=sys.stderr) diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index 0cbe272..2f3e558 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -1,57 +1,58 @@ #!/usr/bin/env python3 """Test typeshed's third party stubs using stubtest""" +from __future__ import annotations + import argparse import functools +import os import subprocess import sys import tempfile -import tomli import venv -from glob import glob from pathlib import Path +from typing import NoReturn - -EXCLUDE_LIST = [ - "Flask", # fails when stubtest tries to stringify some object - "pyaudio", # install failure locally - "backports", # errors on python version - "six", # ??? - "aiofiles", # easily fixable, some platform specific difference between local and ci - "pycurl" # install failure, missing libcurl -] - - -class StubtestFailed(Exception): - pass +import tomli +from utils import colored, print_error, print_success_msg @functools.lru_cache() -def get_mypy_req(): - with open("requirements-tests-py3.txt") as f: +def get_mypy_req() -> str: + with open("requirements-tests.txt", encoding="UTF-8") as f: return next(line.strip() for line in f if "mypy" in line) -def run_stubtest(dist: Path) -> None: - with open(dist / "METADATA.toml") as f: +def run_stubtest(dist: Path, *, verbose: bool = False) -> bool: + with open(dist / "METADATA.toml", encoding="UTF-8") as f: metadata = dict(tomli.loads(f.read())) - # Ignore stubs that don't support Python 3 - if not has_py3_stubs(dist): - return + print(f"{dist.name}... ", end="") + + stubtest_meta = metadata.get("tool", {}).get("stubtest", {}) + if stubtest_meta.get("skip", False): + print(colored("skipping", "yellow")) + return True with tempfile.TemporaryDirectory() as tmp: venv_dir = Path(tmp) venv.create(venv_dir, with_pip=True, clear=True) - pip_exe = str(venv_dir / "bin" / "pip") - python_exe = str(venv_dir / "bin" / "python") - - dist_version = metadata.get("version") - if dist_version is None or dist_version == "0.1": - dist_req = dist.name + if sys.platform == "win32": + pip = venv_dir / "Scripts" / "pip.exe" + python = venv_dir / "Scripts" / "python.exe" else: - dist_req = f"{dist.name}=={dist_version}.*" + pip = venv_dir / "bin" / "pip" + python = venv_dir / "bin" / "python" + + pip_exe, python_exe = str(pip), str(python) + + dist_version = metadata["version"] + extras = stubtest_meta.get("extras", []) + assert isinstance(dist_version, str) + assert isinstance(extras, list) + dist_extras = ", ".join(extras) + dist_req = f"{dist.name}[{dist_extras}]=={dist_version}" # If @tests/requirements-stubtest.txt exists, run "pip install" on it. req_path = dist / "@tests" / "requirements-stubtest.txt" @@ -60,10 +61,8 @@ def run_stubtest(dist: Path) -> None: pip_cmd = [pip_exe, "install", "-r", str(req_path)] subprocess.run(pip_cmd, check=True, capture_output=True) except subprocess.CalledProcessError as e: - print(f"Failed to install requirements for {dist.name}", file=sys.stderr) - print(e.stdout.decode(), file=sys.stderr) - print(e.stderr.decode(), file=sys.stderr) - raise + print_command_failure("Failed to install requirements", e) + return False # We need stubtest to be able to import the package, so install mypy into the venv # Hopefully mypy continues to not need too many dependencies @@ -71,61 +70,93 @@ def run_stubtest(dist: Path) -> None: dists_to_install = [dist_req, get_mypy_req()] dists_to_install.extend(metadata.get("requires", [])) pip_cmd = [pip_exe, "install"] + dists_to_install - print(" ".join(pip_cmd), file=sys.stderr) try: subprocess.run(pip_cmd, check=True, capture_output=True) except subprocess.CalledProcessError as e: - print(f"Failed to install {dist.name}", file=sys.stderr) - print(e.stdout.decode(), file=sys.stderr) - print(e.stderr.decode(), file=sys.stderr) - raise + print_command_failure("Failed to install", e) + return False + ignore_missing_stub = ["--ignore-missing-stub"] if stubtest_meta.get("ignore_missing_stub", True) else [] packages_to_check = [d.name for d in dist.iterdir() if d.is_dir() and d.name.isidentifier()] modules_to_check = [d.stem for d in dist.iterdir() if d.is_file() and d.suffix == ".pyi"] - cmd = [ + stubtest_cmd = [ python_exe, "-m", "mypy.stubtest", - # Use --ignore-missing-stub, because if someone makes a correct addition, they'll need to - # also make a allowlist change and if someone makes an incorrect addition, they'll run into - # false negatives. - "--ignore-missing-stub", # Use --custom-typeshed-dir in case we make linked changes to stdlib or _typeshed "--custom-typeshed-dir", str(dist.parent.parent), + *ignore_missing_stub, *packages_to_check, *modules_to_check, ] + + # For packages that need a display, we need to pass at least $DISPLAY + # to stubtest. $DISPLAY is set by xvfb-run in CI. + # + # It seems that some other environment variables are needed too, + # because the CI fails if we pass only os.environ["DISPLAY"]. I didn't + # "bisect" to see which variables are actually needed. + stubtest_env = os.environ | {"MYPYPATH": str(dist), "MYPY_FORCE_COLOR": "1"} + allowlist_path = dist / "@tests/stubtest_allowlist.txt" if allowlist_path.exists(): - cmd.extend(["--allowlist", str(allowlist_path)]) + stubtest_cmd.extend(["--allowlist", str(allowlist_path)]) try: - print(f"MYPYPATH={dist}", " ".join(cmd), file=sys.stderr) - subprocess.run(cmd, env={"MYPYPATH": str(dist), "MYPY_FORCE_COLOR": "1"}, check=True) - except subprocess.CalledProcessError: - print(f"stubtest failed for {dist.name}", file=sys.stderr) - print("\n\n", file=sys.stderr) - if not allowlist_path.exists(): + subprocess.run(stubtest_cmd, env=stubtest_env, check=True, capture_output=True) + except subprocess.CalledProcessError as e: + print_error("fail") + print_commands(dist, pip_cmd, stubtest_cmd) + print_command_output(e) + + print("Ran with the following environment:", file=sys.stderr) + ret = subprocess.run([pip_exe, "freeze", "--all"], capture_output=True) + print_command_output(ret) + + if allowlist_path.exists(): print( - "Re-running stubtest with --generate-allowlist.\n" - f"Add the following to {allowlist_path}:" + f'To fix "unused allowlist" errors, remove the corresponding entries from {allowlist_path}', file=sys.stderr ) - subprocess.run(cmd + ["--generate-allowlist"], env={"MYPYPATH": str(dist)}) - print("\n\n") - raise StubtestFailed from None + print(file=sys.stderr) + else: + print(f"Re-running stubtest with --generate-allowlist.\nAdd the following to {allowlist_path}:", file=sys.stderr) + ret = subprocess.run(stubtest_cmd + ["--generate-allowlist"], env=stubtest_env, capture_output=True) + print_command_output(ret) + + return False else: - print(f"stubtest succeeded for {dist.name}", file=sys.stderr) - print("\n\n", file=sys.stderr) + print_success_msg() + + if verbose: + print_commands(dist, pip_cmd, stubtest_cmd) + + return True -# Keep this in sync with mypy_test.py -def has_py3_stubs(dist: Path) -> bool: - return len(glob(f"{dist}/*.pyi")) > 0 or len(glob(f"{dist}/[!@]*/__init__.pyi")) > 0 +def print_commands(dist: Path, pip_cmd: list[str], stubtest_cmd: list[str]) -> None: + print(file=sys.stderr) + print(" ".join(pip_cmd), file=sys.stderr) + print(f"MYPYPATH={dist}", " ".join(stubtest_cmd), file=sys.stderr) + print(file=sys.stderr) -def main(): +def print_command_failure(message: str, e: subprocess.CalledProcessError) -> None: + print_error("fail") + print(file=sys.stderr) + print(message, file=sys.stderr) + print_command_output(e) + + +def print_command_output(e: subprocess.CalledProcessError | subprocess.CompletedProcess[bytes]) -> None: + print(e.stdout.decode(), end="", file=sys.stderr) + print(e.stderr.decode(), end="", file=sys.stderr) + print(file=sys.stderr) + + +def main() -> NoReturn: parser = argparse.ArgumentParser() + parser.add_argument("-v", "--verbose", action="store_true", help="verbose output") parser.add_argument("--num-shards", type=int, default=1) parser.add_argument("--shard-index", type=int, default=0) parser.add_argument("dists", metavar="DISTRIBUTION", type=str, nargs=argparse.ZERO_OR_MORE) @@ -137,13 +168,17 @@ def main(): else: dists = [typeshed_dir / "stubs" / d for d in args.dists] + result = 0 for i, dist in enumerate(dists): if i % args.num_shards != args.shard_index: continue - if dist.name in EXCLUDE_LIST: - continue - run_stubtest(dist) + if not run_stubtest(dist, verbose=args.verbose): + result = 1 + sys.exit(result) if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + pass diff --git a/tests/stubtest_unused.py b/tests/stubtest_unused.py deleted file mode 100755 index c2b52fb..0000000 --- a/tests/stubtest_unused.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 - -# Runs stubtest and prints each unused allowlist entry with filename. -import subprocess -import sys -from pathlib import Path -from typing import List, Tuple - -_UNUSED_NOTE = "note: unused allowlist entry " -_ALLOWLIST_PATH = Path("tests") / "stubtest_allowlists" - - -def main() -> None: - unused = run_stubtest() - with_filenames = [] - for uu in unused: - with_filenames.extend(unused_files(uu)) - for file, uu in with_filenames: - print(file + ":" + uu) - - -def run_stubtest() -> List[str]: - proc = subprocess.run([sys.executable, "tests/stubtest_stdlib.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - output = proc.stdout.decode("utf-8").splitlines() - return [line[len(_UNUSED_NOTE) :].strip() for line in output if line.startswith(_UNUSED_NOTE)] - - -def unused_files(unused: str) -> List[Tuple[str, str]]: - version = "py{}{}".format(sys.version_info[0], sys.version_info[1]) - files = ["py3_common.txt", version + ".txt", sys.platform + ".txt", sys.platform + "-" + version + ".txt"] - found = [] - for file in files: - path = _ALLOWLIST_PATH / file - if find_unused_in_file(unused, path): - found.append((path.as_posix(), unused)) - if not found: - raise ValueError("unused item {} not found in any allowlist file".format(unused)) - return found - - -def find_unused_in_file(unused: str, path: Path) -> bool: - try: - with open(path) as f: - return any(line.strip().split(" ")[0] == unused for line in f) - except FileNotFoundError: - return False - - -if __name__ == "__main__": - main() diff --git a/tests/typecheck_typeshed.py b/tests/typecheck_typeshed.py new file mode 100644 index 0000000..2106755 --- /dev/null +++ b/tests/typecheck_typeshed.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Run mypy on the "tests" and "scripts" directories.""" +from __future__ import annotations + +import argparse +import subprocess +import sys +from itertools import product +from typing_extensions import TypeAlias + +from utils import colored, print_error + +ReturnCode: TypeAlias = int + +SUPPORTED_PLATFORMS = ("linux", "darwin", "win32") +SUPPORTED_VERSIONS = ("3.11", "3.10", "3.9") +DIRECTORIES_TO_TEST = ("scripts", "tests") + +parser = argparse.ArgumentParser(description="Run mypy on typeshed's own code in the `scripts` and `tests` directories.") +parser.add_argument( + "dir", + choices=DIRECTORIES_TO_TEST + ([],), + nargs="*", + action="extend", + help=f"Test only these top-level typeshed directories (defaults to {DIRECTORIES_TO_TEST!r})", +) +parser.add_argument( + "--platform", + choices=SUPPORTED_PLATFORMS, + nargs="*", + action="extend", + help="Run mypy for certain OS platforms (defaults to sys.platform)", +) +parser.add_argument( + "-p", + "--python-version", + choices=SUPPORTED_VERSIONS, + nargs="*", + action="extend", + help="Run mypy for certain Python versions (defaults to sys.version_info[:2])", +) + + +def run_mypy_as_subprocess(directory: str, platform: str, version: str) -> ReturnCode: + command = [ + sys.executable, + "-m", + "mypy", + directory, + "--platform", + platform, + "--python-version", + version, + "--strict", + "--show-traceback", + "--show-error-codes", + "--no-error-summary", + "--enable-error-code", + "ignore-without-code", + "--namespace-packages", + ] + if directory == "tests" and platform == "win32": + command.extend(["--exclude", "tests/pytype_test.py"]) + result = subprocess.run(command, capture_output=True) + stdout, stderr = result.stdout, result.stderr + if stderr: + print_error(stderr.decode()) + if stdout: + print_error(stdout.decode()) + return result.returncode + + +def main() -> ReturnCode: + args = parser.parse_args() + directories = args.dir or DIRECTORIES_TO_TEST + platforms = args.platform or [sys.platform] + versions = args.python_version or [f"3.{sys.version_info[1]}"] + + code = 0 + + for directory, platform, version in product(directories, platforms, versions): + print(f'Running "mypy --platform {platform} --python-version {version}" on the "{directory}" directory...') + code = max(code, run_mypy_as_subprocess(directory, platform, version)) + + if code: + print_error("Test completed with errors") + else: + print(colored("Test completed successfully!", "green")) + return code + + +if __name__ == "__main__": + try: + code = main() + except KeyboardInterrupt: + print_error("\n\n!!!\nTest aborted due to KeyboardInterrupt\n!!!") + code = 1 + raise SystemExit(code) diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..97e6f09 --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,112 @@ +"""Utilities that are imported by multiple scripts in the tests directory.""" + +from __future__ import annotations + +import os +import re +from functools import cache +from itertools import filterfalse +from pathlib import Path +from typing import NamedTuple + +import pathspec # type: ignore[import] +import tomli + + +def strip_comments(text: str) -> str: + return text.split("#")[0].strip() + + +try: + from termcolor import colored as colored +except ImportError: + + def colored(s: str, _: str) -> str: # type: ignore[misc] + return s + + +def print_error(error: str, end: str = "\n", fix_path: tuple[str, str] = ("", "")) -> None: + error_split = error.split("\n") + old, new = fix_path + for line in error_split[:-1]: + print(colored(line.replace(old, new), "red")) + print(colored(error_split[-1], "red"), end=end) + + +def print_success_msg() -> None: + print(colored("success", "green")) + + +# ==================================================================== +# Reading dependencies from METADATA.toml files +# ==================================================================== + + +@cache +def read_dependencies(distribution: str) -> tuple[str, ...]: + with Path("stubs", distribution, "METADATA.toml").open("rb") as f: + data = tomli.load(f) + requires = data.get("requires", []) + assert isinstance(requires, list) + dependencies = [] + for dependency in requires: + assert isinstance(dependency, str) + assert dependency.startswith("types-"), f"unrecognized dependency {dependency!r}" + dependencies.append(dependency[6:].split("<")[0]) + return tuple(dependencies) + + +def get_recursive_requirements(package_name: str, seen: set[str] | None = None) -> list[str]: + seen = seen if seen is not None else {package_name} + for dependency in filterfalse(seen.__contains__, read_dependencies(package_name)): + seen.update(get_recursive_requirements(dependency, seen)) + return sorted(seen | {package_name}) + + +# ==================================================================== +# Parsing the stdlib/VERSIONS file +# ==================================================================== + + +VERSIONS_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_.]*): ([23]\.\d{1,2})-([23]\.\d{1,2})?$") + + +# ==================================================================== +# Getting test-case directories from package names +# ==================================================================== + + +class PackageInfo(NamedTuple): + name: str + test_case_directory: Path + + +def testcase_dir_from_package_name(package_name: str) -> Path: + return Path("stubs", package_name, "@tests/test_cases") + + +def get_all_testcase_directories() -> list[PackageInfo]: + testcase_directories = [PackageInfo("stdlib", Path("test_cases"))] + for package_name in os.listdir("stubs"): + potential_testcase_dir = testcase_dir_from_package_name(package_name) + if potential_testcase_dir.is_dir(): + testcase_directories.append(PackageInfo(package_name, potential_testcase_dir)) + return sorted(testcase_directories) + + +# ==================================================================== +# Parsing .gitignore +# ==================================================================== + + +@cache +def get_gitignore_spec() -> pathspec.PathSpec: + with open(".gitignore", encoding="UTF-8") as f: + return pathspec.PathSpec.from_lines("gitwildmatch", f.readlines()) + + +def spec_matches_path(spec: pathspec.PathSpec, path: Path) -> bool: + normalized_path = path.as_posix() + if path.is_dir(): + normalized_path += "/" + return spec.match_file(normalized_path) # type: ignore[no-any-return]